Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let percentValue: PercentValue = {percent: 50};
let siblingReferenceValue: SiblingReferenceValue = (x: Widget) => true;
let constraintArray: ConstraintArray = ['50%'];
constraintArray = ['50%', 0, 1];
let constraintLikeObject: ConstraintLikeObject = {};
constraintLikeObject = {reference: 10};
constraintLikeObject = {percent: 10};
// Constructor
let constraint: Constraint = new Constraint(new Percent(0));
constraint = new Constraint();
constraint = new Constraint(new Percent(0), 0, 0);
constraint = new Constraint(null, null);
constraint = new Constraint(undefined, undefined);
constraint = new Constraint((x: Widget) => true, 23);
constraint = new Constraint(new Percent(0), '0');
constraint = new Constraint('auto');
constraint = new Constraint(new Percent(0), 'auto');
constraint = new Constraint(percentValue, 0);
// Instance
let auto = constraint.offset as 'auto';
let percentLikeObject = constraint.reference as PercentLikeObject;
let stringArray = constraint.toArray() as [string, string];
// ConstraintValue
let constraintValue: ConstraintValue = null;
constraintValue = undefined;
constraintValue = {};
constraintValue = new Date();
// Related types
let num: number = 23;
let percent: Percent = new Percent(0);
let reference: SiblingReference|Percent = new Composite();
let widget: Widget = new Composite();
let percentValue: PercentValue = {percent: 50};
let siblingReferenceValue: SiblingReferenceValue = (x: Widget) => true;
let constraintArray: ConstraintArray = ['50%'];
constraintArray = ['50%', 0, 1];
let constraintLikeObject: ConstraintLikeObject = {};
constraintLikeObject = {reference: 10};
constraintLikeObject = {percent: 10};
// Constructor
let constraint: Constraint = new Constraint(new Percent(0));
constraint = new Constraint();
constraint = new Constraint(new Percent(0), 0, 0);
constraint = new Constraint(null, null);
constraint = new Constraint(undefined, undefined);
constraint = new Constraint((x: Widget) => true, 23);
constraint = new Constraint(new Percent(0), '0');
constraint = new Constraint('auto');
constraint = new Constraint(new Percent(0), 'auto');
constraint = new Constraint(percentValue, 0);
// Instance
let auto = constraint.offset as 'auto';
let percentLikeObject = constraint.reference as PercentLikeObject;
let stringArray = constraint.toArray() as [string, string];
// ConstraintValue
let percent: Percent = new Percent(0);
let reference: SiblingReference|Percent = new Composite();
let widget: Widget = new Composite();
let percentValue: PercentValue = {percent: 50};
let siblingReferenceValue: SiblingReferenceValue = (x: Widget) => true;
let constraintArray: ConstraintArray = ['50%'];
constraintArray = ['50%', 0, 1];
let constraintLikeObject: ConstraintLikeObject = {};
constraintLikeObject = {reference: 10};
constraintLikeObject = {percent: 10};
// Constructor
let constraint: Constraint = new Constraint(new Percent(0));
constraint = new Constraint();
constraint = new Constraint(new Percent(0), 0, 0);
constraint = new Constraint(null, null);
constraint = new Constraint(undefined, undefined);
constraint = new Constraint((x: Widget) => true, 23);
constraint = new Constraint(new Percent(0), '0');
constraint = new Constraint('auto');
constraint = new Constraint(new Percent(0), 'auto');
constraint = new Constraint(percentValue, 0);
// Instance
let auto = constraint.offset as 'auto';
let percentLikeObject = constraint.reference as PercentLikeObject;
let stringArray = constraint.toArray() as [string, string];
// ConstraintValue
let constraintValue: ConstraintValue = null;
constraintValue = undefined;
let constraintArray: ConstraintArray = ['50%'];
constraintArray = ['50%', 0, 1];
let constraintLikeObject: ConstraintLikeObject = {};
constraintLikeObject = {reference: 10};
constraintLikeObject = {percent: 10};
// Constructor
let constraint: Constraint = new Constraint(new Percent(0));
constraint = new Constraint();
constraint = new Constraint(new Percent(0), 0, 0);
constraint = new Constraint(null, null);
constraint = new Constraint(undefined, undefined);
constraint = new Constraint((x: Widget) => true, 23);
constraint = new Constraint(new Percent(0), '0');
constraint = new Constraint('auto');
constraint = new Constraint(new Percent(0), 'auto');
constraint = new Constraint(percentValue, 0);
// Instance
let auto = constraint.offset as 'auto';
let percentLikeObject = constraint.reference as PercentLikeObject;
let stringArray = constraint.toArray() as [string, string];
// ConstraintValue
let constraintValue: ConstraintValue = null;
constraintValue = undefined;
constraintValue = {};
constraintValue = new Date();
// Statics
Constraint.from();
Constraint.from(null);
let num: number = 23;
let percent: Percent = new Percent(0);
let reference: SiblingReference|Percent = new Composite();
let widget: Widget = new Composite();
let percentValue: PercentValue = {percent: 50};
let siblingReferenceValue: SiblingReferenceValue = (x: Widget) => true;
let constraintArray: ConstraintArray = ['50%'];
constraintArray = ['50%', 0, 1];
let constraintLikeObject: ConstraintLikeObject = {};
constraintLikeObject = {reference: 10};
constraintLikeObject = {percent: 10};
// Constructor
let constraint: Constraint = new Constraint(new Percent(0));
constraint = new Constraint();
constraint = new Constraint(new Percent(0), 0, 0);
constraint = new Constraint(null, null);
constraint = new Constraint(undefined, undefined);
constraint = new Constraint((x: Widget) => true, 23);
constraint = new Constraint(new Percent(0), '0');
constraint = new Constraint('auto');
constraint = new Constraint(new Percent(0), 'auto');
constraint = new Constraint(percentValue, 0);
// Instance
let auto = constraint.offset as 'auto';
let percentLikeObject = constraint.reference as PercentLikeObject;
let stringArray = constraint.toArray() as [string, string];
// ConstraintValue
let constraintValue: ConstraintValue = null;
constraintArray = ['50%', 0, 1];
let constraintLikeObject: ConstraintLikeObject = {};
constraintLikeObject = {reference: 10};
constraintLikeObject = {percent: 10};
// Constructor
let constraint: Constraint = new Constraint(new Percent(0));
constraint = new Constraint();
constraint = new Constraint(new Percent(0), 0, 0);
constraint = new Constraint(null, null);
constraint = new Constraint(undefined, undefined);
constraint = new Constraint((x: Widget) => true, 23);
constraint = new Constraint(new Percent(0), '0');
constraint = new Constraint('auto');
constraint = new Constraint(new Percent(0), 'auto');
constraint = new Constraint(percentValue, 0);
// Instance
let auto = constraint.offset as 'auto';
let percentLikeObject = constraint.reference as PercentLikeObject;
let stringArray = constraint.toArray() as [string, string];
// ConstraintValue
let constraintValue: ConstraintValue = null;
constraintValue = undefined;
constraintValue = {};
constraintValue = new Date();
// Statics
Constraint.from();
Constraint.from(null);
Constraint.from(undefined);
let widget: Widget = new Composite();
let percentValue: PercentValue = {percent: 50};
let siblingReferenceValue: SiblingReferenceValue = (x: Widget) => true;
let constraintArray: ConstraintArray = ['50%'];
constraintArray = ['50%', 0, 1];
let constraintLikeObject: ConstraintLikeObject = {};
constraintLikeObject = {reference: 10};
constraintLikeObject = {percent: 10};
// Constructor
let constraint: Constraint = new Constraint(new Percent(0));
constraint = new Constraint();
constraint = new Constraint(new Percent(0), 0, 0);
constraint = new Constraint(null, null);
constraint = new Constraint(undefined, undefined);
constraint = new Constraint((x: Widget) => true, 23);
constraint = new Constraint(new Percent(0), '0');
constraint = new Constraint('auto');
constraint = new Constraint(new Percent(0), 'auto');
constraint = new Constraint(percentValue, 0);
// Instance
let auto = constraint.offset as 'auto';
let percentLikeObject = constraint.reference as PercentLikeObject;
let stringArray = constraint.toArray() as [string, string];
// ConstraintValue
let constraintValue: ConstraintValue = null;
constraintValue = undefined;
constraintValue = {};
constraintValue = new Date();
let siblingReferenceValue: SiblingReferenceValue = (x: Widget) => true;
let constraintArray: ConstraintArray = ['50%'];
constraintArray = ['50%', 0, 1];
let constraintLikeObject: ConstraintLikeObject = {};
constraintLikeObject = {reference: 10};
constraintLikeObject = {percent: 10};
// Constructor
let constraint: Constraint = new Constraint(new Percent(0));
constraint = new Constraint();
constraint = new Constraint(new Percent(0), 0, 0);
constraint = new Constraint(null, null);
constraint = new Constraint(undefined, undefined);
constraint = new Constraint((x: Widget) => true, 23);
constraint = new Constraint(new Percent(0), '0');
constraint = new Constraint('auto');
constraint = new Constraint(new Percent(0), 'auto');
constraint = new Constraint(percentValue, 0);
// Instance
let auto = constraint.offset as 'auto';
let percentLikeObject = constraint.reference as PercentLikeObject;
let stringArray = constraint.toArray() as [string, string];
// ConstraintValue
let constraintValue: ConstraintValue = null;
constraintValue = undefined;
constraintValue = {};
constraintValue = new Date();
// Statics
let siblingReferenceValue: SiblingReferenceValue = (x: Widget) => true;
let constraintArray: ConstraintArray = ['50%'];
constraintArray = ['50%', 0, 1];
let constraintLikeObject: ConstraintLikeObject = {};
constraintLikeObject = {reference: 10};
constraintLikeObject = {percent: 10};
// Constructor
let constraint: Constraint = new Constraint(new Percent(0));
constraint = new Constraint();
constraint = new Constraint(new Percent(0), 0, 0);
constraint = new Constraint(null, null);
constraint = new Constraint(undefined, undefined);
constraint = new Constraint((x: Widget) => true, 23);
constraint = new Constraint(new Percent(0), '0');
constraint = new Constraint('auto');
constraint = new Constraint(new Percent(0), 'auto');
constraint = new Constraint(percentValue, 0);
// Instance
let auto = constraint.offset as 'auto';
let percentLikeObject = constraint.reference as PercentLikeObject;
let stringArray = constraint.toArray() as [string, string];
// ConstraintValue
let constraintValue: ConstraintValue = null;
constraintValue = undefined;
constraintValue = {};
constraintValue = new Date();
// Statics
Constraint.from();
import {Composite, contentView, LayoutData, Constraint} from 'tabris';
// There are various ways to refer to other widgets in a constraint value,
// each applicable to string, array or Constraint constructor call expressions
const redbox = new Composite({
left: 10, top: 10, width: 100, height: 100,
background: 'red'
}).appendTo(contentView);
// you can refer to a sibling widget by reference ...
new Composite({
id: 'bluebox',
left: [redbox, 10], top: new Constraint(redbox, 10), width: 100, height: 100,
background: 'blue'
}).appendTo(contentView);
// ... by id ...
new Composite({
left: '#bluebox 10', top: ['#bluebox', 10], width: 100, height: 100,
background: 'green'
}).appendTo(contentView);
// ... or by a symbolic reference to the preceeding sibling
new Composite({
left: 'prev() 10', top: [LayoutData.prev, 10], width: 100, height: 100,
background: 'yellow'
}).appendTo(contentView);