verstak 0.24.267 → 0.24.268

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,17 +35,17 @@ export type ElCoords = {
35
35
  y2: number;
36
36
  };
37
37
  export declare enum Align {
38
- left = 1,
39
- centerX = 2,
40
- right = 3,
41
- stretchX = 4,
42
- top = 8,
43
- centerY = 16,
44
- bottom = 24,
45
- stretchY = 32,
46
- center = 18,
47
- stretch = 36,
48
- default = 0
38
+ default = 0,
39
+ left = 4,
40
+ centerWidth = 5,
41
+ right = 6,
42
+ stretchWidth = 7,
43
+ top = 32,
44
+ centerHeight = 40,
45
+ bottom = 48,
46
+ stretchHeight = 56,
47
+ center = 45,
48
+ stretch = 63
49
49
  }
50
50
  export type Range = {
51
51
  readonly min?: string;
@@ -129,19 +129,18 @@ export declare class CursorCommandDriver extends ElDriver<Element, unknown> {
129
129
  constructor();
130
130
  }
131
131
  export declare class Apply {
132
- static kind<T extends Element>(element: El<T, any>, value: ElKind): void;
133
- static coords<T extends Element>(element: El<T, any>, value: ElCoords | undefined): void;
134
- static minWidth<T extends Element>(element: El<T, any>, value: string): void;
135
- static maxWidth<T extends Element>(element: El<T, any>, value: string): void;
136
- static minHeight<T extends Element>(element: El<T, any>, value: string): void;
137
- static maxHeight<T extends Element>(element: El<T, any>, value: string): void;
138
- static alignment<T extends Element>(element: El<T, any>, value: Align): void;
139
- static extraAlignment<T extends Element>(element: El<T, any>, value: Align): void;
140
- static stretchFactorX<T extends Element>(element: El<T, any>, value: number): void;
141
- static stretchFactorY<T extends Element>(element: El<T, any>, value: number): void;
142
- static contentWrapping<T extends Element>(element: El<T, any>, value: boolean): void;
143
- static overlayVisible<T extends Element>(element: El<T, any>, value: boolean | undefined): void;
144
- static stylingPreset<T extends Element>(element: El<T, any>, secondary: boolean, styleName: string, enabled?: boolean): void;
132
+ static kind<T extends Element>(element: ElImpl<T, any>, value: ElKind): void;
133
+ static coords<T extends Element>(element: ElImpl<T, any>, value: ElCoords | undefined): void;
134
+ static minWidth<T extends Element>(element: ElImpl<T, any>, value: string): void;
135
+ static maxWidth<T extends Element>(element: ElImpl<T, any>, value: string): void;
136
+ static minHeight<T extends Element>(element: ElImpl<T, any>, value: string): void;
137
+ static maxHeight<T extends Element>(element: ElImpl<T, any>, value: string): void;
138
+ static alignment<T extends Element>(element: ElImpl<T, any>, primary: Align, extra: Align, strengthX: number | undefined, strengthY: number | undefined): void;
139
+ static stretchingStrengthX<T extends Element>(element: ElImpl<T, any>, value: number): void;
140
+ static stretchingStrengthY<T extends Element>(element: ElImpl<T, any>, value: number): void;
141
+ static contentWrapping<T extends Element>(element: ElImpl<T, any>, value: boolean): void;
142
+ static overlayVisible<T extends Element>(element: ElImpl<T, any>, value: boolean | undefined): void;
143
+ static stylingPreset<T extends Element>(element: ElImpl<T, any>, secondary: boolean, styleName: string, enabled?: boolean): void;
145
144
  }
146
145
  export declare const Constants: {
147
146
  element: string;
@@ -17,17 +17,17 @@ export var ElKind;
17
17
  })(ElKind || (ElKind = {}));
18
18
  export var Align;
19
19
  (function (Align) {
20
- Align[Align["left"] = 1] = "left";
21
- Align[Align["centerX"] = 2] = "centerX";
22
- Align[Align["right"] = 3] = "right";
23
- Align[Align["stretchX"] = 4] = "stretchX";
24
- Align[Align["top"] = 8] = "top";
25
- Align[Align["centerY"] = 16] = "centerY";
26
- Align[Align["bottom"] = 24] = "bottom";
27
- Align[Align["stretchY"] = 32] = "stretchY";
28
- Align[Align["center"] = 18] = "center";
29
- Align[Align["stretch"] = 36] = "stretch";
30
20
  Align[Align["default"] = 0] = "default";
21
+ Align[Align["left"] = 4] = "left";
22
+ Align[Align["centerWidth"] = 5] = "centerWidth";
23
+ Align[Align["right"] = 6] = "right";
24
+ Align[Align["stretchWidth"] = 7] = "stretchWidth";
25
+ Align[Align["top"] = 32] = "top";
26
+ Align[Align["centerHeight"] = 40] = "centerHeight";
27
+ Align[Align["bottom"] = 48] = "bottom";
28
+ Align[Align["stretchHeight"] = 56] = "stretchHeight";
29
+ Align[Align["center"] = 45] = "center";
30
+ Align[Align["stretch"] = 63] = "stretch";
31
31
  })(Align || (Align = {}));
32
32
  export class ElImpl {
33
33
  constructor(node) {
@@ -123,28 +123,28 @@ export class ElImpl {
123
123
  get alignment() { return this._alignment; }
124
124
  set alignment(value) {
125
125
  if (value !== this._alignment) {
126
- Apply.alignment(this, value);
126
+ Apply.alignment(this, value, this._extraAlignment, this._stretchingStrengthX, this._stretchingStrengthY);
127
127
  this._alignment = value;
128
128
  }
129
129
  }
130
130
  get extraAlignment() { return this._extraAlignment; }
131
131
  set extraAlignment(value) {
132
132
  if (value !== this._extraAlignment) {
133
- Apply.extraAlignment(this, value);
133
+ Apply.alignment(this, this._alignment, value, this._stretchingStrengthX, this._stretchingStrengthY);
134
134
  this._extraAlignment = value;
135
135
  }
136
136
  }
137
137
  get stretchingStrengthX() { return this._stretchingStrengthX; }
138
138
  set stretchingStrengthX(value) {
139
139
  if (value !== this._stretchingStrengthX) {
140
- Apply.stretchFactorX(this, value !== null && value !== void 0 ? value : 0);
140
+ Apply.stretchingStrengthX(this, value !== null && value !== void 0 ? value : 0);
141
141
  this._stretchingStrengthX = value;
142
142
  }
143
143
  }
144
144
  get stretchingStrengthY() { return this._stretchingStrengthY; }
145
145
  set stretchingStrengthY(value) {
146
146
  if (value !== this._stretchingStrengthY) {
147
- Apply.stretchFactorY(this, value !== null && value !== void 0 ? value : 0);
147
+ Apply.stretchingStrengthY(this, value !== null && value !== void 0 ? value : 0);
148
148
  this._stretchingStrengthY = value;
149
149
  }
150
150
  }
@@ -339,35 +339,42 @@ export class Apply {
339
339
  if (element.native instanceof HTMLElement)
340
340
  element.native.style.maxHeight = `${value}`;
341
341
  }
342
- static alignment(element, value) {
342
+ static alignment(element, primary, extra, strengthX, strengthY) {
343
343
  if (element.native instanceof HTMLElement) {
344
344
  const s = element.native.style;
345
- if (value !== Align.default) {
346
- const v = AlignToCss[(value >> 3) & 0b11];
347
- const h = AlignToCss[value & 0b11];
348
- s.alignSelf = v;
349
- s.justifySelf = h;
345
+ let v1 = "";
346
+ let h1 = "";
347
+ let t1 = "";
348
+ if (primary !== Align.default) {
349
+ v1 = AlignToCss[(primary >> 3) & 0b11];
350
+ h1 = AlignToCss[primary & 0b11];
351
+ t1 = TextAlignCss[primary & 0b11];
350
352
  }
351
- else
352
- s.alignSelf = s.justifySelf = "";
353
- }
354
- }
355
- static extraAlignment(element, value) {
356
- if (element.native instanceof HTMLElement) {
357
- const s = element.native.style;
358
- if (value !== Align.default) {
359
- const v = AlignToCss[(value >> 3) & 0b11];
360
- const h = AlignToCss[value & 0b11];
361
- const t = TextAlignCss[value & 0b11];
362
- s.justifyContent = v;
363
- s.alignItems = h;
364
- s.textAlign = t;
353
+ s.alignSelf = v1;
354
+ s.justifySelf = h1;
355
+ if ((primary & Align.left) !== 0 && strengthX === undefined)
356
+ Apply.stretchingStrengthX(element, 1);
357
+ if ((primary & Align.top) !== 0 && strengthY === undefined)
358
+ Apply.stretchingStrengthY(element, 1);
359
+ let v2 = "";
360
+ let h2 = "";
361
+ let t2 = "";
362
+ if (extra !== Align.default) {
363
+ v2 = AlignToCss[(extra >> 3) & 0b11];
364
+ h2 = AlignToCss[extra & 0b11];
365
+ t2 = TextAlignCss[extra & 0b11];
365
366
  }
366
- else
367
- s.justifyContent = s.alignContent = s.textAlign = "";
367
+ else {
368
+ v2 = v1;
369
+ h2 = h1;
370
+ t2 = t1;
371
+ }
372
+ s.justifyContent = v2;
373
+ s.alignItems = h2;
374
+ s.textAlign = t2;
368
375
  }
369
376
  }
370
- static stretchFactorX(element, value) {
377
+ static stretchingStrengthX(element, value) {
371
378
  if (element.native instanceof HTMLElement) {
372
379
  const s = element.native.style;
373
380
  if (value > 0) {
@@ -380,7 +387,7 @@ export class Apply {
380
387
  }
381
388
  }
382
389
  }
383
- static stretchFactorY(element, value) {
390
+ static stretchingStrengthY(element, value) {
384
391
  const bNode = element.node;
385
392
  const driver = bNode.driver;
386
393
  if (driver.isPartition) {
@@ -396,8 +403,8 @@ export class Apply {
396
403
  const hostDriver = bNode.host.driver;
397
404
  if (hostDriver.isPartition) {
398
405
  const host = bNode.host.seat.instance;
399
- Apply.alignment(element, Align.stretch);
400
- Apply.stretchFactorY(host.element, value);
406
+ Apply.alignment(host.element, Align.stretchHeight, Align.default, undefined, undefined);
407
+ Apply.stretchingStrengthY(host.element, value);
401
408
  }
402
409
  }
403
410
  }
@@ -510,5 +517,5 @@ const VerstakDriversByLayout = [
510
517
  el => {
511
518
  },
512
519
  ];
513
- const AlignToCss = ["stretch", "start", "center", "end"];
514
- const TextAlignCss = ["justify", "left", "center", "right"];
520
+ const AlignToCss = ["start", "center", "end", "stretch"];
521
+ const TextAlignCss = ["left", "center", "right", "justify"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "verstak",
3
- "version": "0.24.267",
3
+ "version": "0.24.268",
4
4
  "description": "Verstak - Front-End Library",
5
5
  "publisher": "Nezaboodka Software",
6
6
  "license": "Apache-2.0",