verstak 0.24.270 → 0.24.272
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.
- package/build/dist/source/html/El.d.ts +56 -25
- package/build/dist/source/html/El.js +197 -117
- package/build/dist/source/html/ElUtils.d.ts +14 -0
- package/build/dist/source/html/ElUtils.js +38 -9
- package/build/dist/source/html/Elements.js +124 -68
- package/build/dist/source/html/Handlers.d.ts +1 -1
- package/build/dist/source/html/Handlers.js +2 -0
- package/build/dist/source/html/SplitViewMath.d.ts +15 -6
- package/build/dist/source/html/SplitViewMath.js +195 -128
- package/build/dist/source/html/api.d.ts +1 -0
- package/build/dist/source/html/api.js +1 -0
- package/build/dist/source/html/sensors/BasePointerSensor.d.ts +1 -2
- package/build/dist/source/html/sensors/BasePointerSensor.js +2 -2
- package/build/dist/source/html/sensors/ButtonSensor.d.ts +1 -2
- package/build/dist/source/html/sensors/ButtonSensor.js +2 -2
- package/build/dist/source/html/sensors/DataForSensor.d.ts +1 -0
- package/build/dist/source/html/sensors/DataForSensor.js +3 -3
- package/build/dist/source/html/sensors/FocusSensor.js +1 -1
- package/build/dist/source/html/sensors/HtmlDragSensor.d.ts +1 -2
- package/build/dist/source/html/sensors/HtmlDragSensor.js +2 -2
- package/build/dist/source/html/sensors/HtmlElementSensor.d.ts +1 -2
- package/build/dist/source/html/sensors/HtmlElementSensor.js +1 -6
- package/build/dist/source/html/sensors/HtmlSensors.js +3 -3
- package/build/dist/source/html/sensors/KeyboardSensor.d.ts +1 -0
- package/build/dist/source/html/sensors/KeyboardSensor.js +5 -0
- package/build/dist/source/html/sensors/PointerSensor.d.ts +1 -2
- package/build/dist/source/html/sensors/PointerSensor.js +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { RxNode, BaseDriver, Transaction, obs, ObservableObject } from "reactronic";
|
|
2
11
|
import { equalElCoords, parseElCoords } from "./ElUtils.js";
|
|
3
12
|
export var ElKind;
|
|
4
13
|
(function (ElKind) {
|
|
@@ -11,25 +20,34 @@ export var ElKind;
|
|
|
11
20
|
ElKind[ElKind["cursor"] = 6] = "cursor";
|
|
12
21
|
ElKind[ElKind["native"] = 7] = "native";
|
|
13
22
|
})(ElKind || (ElKind = {}));
|
|
14
|
-
export var
|
|
15
|
-
(function (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
})(
|
|
28
|
-
export var
|
|
29
|
-
(function (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
})(
|
|
23
|
+
export var Alignment;
|
|
24
|
+
(function (Alignment) {
|
|
25
|
+
Alignment[Alignment["left"] = 0] = "left";
|
|
26
|
+
Alignment[Alignment["center"] = 1] = "center";
|
|
27
|
+
Alignment[Alignment["right"] = 2] = "right";
|
|
28
|
+
Alignment[Alignment["stretch"] = 3] = "stretch";
|
|
29
|
+
})(Alignment || (Alignment = {}));
|
|
30
|
+
export var VerticalAlignment;
|
|
31
|
+
(function (VerticalAlignment) {
|
|
32
|
+
VerticalAlignment[VerticalAlignment["top"] = 0] = "top";
|
|
33
|
+
VerticalAlignment[VerticalAlignment["center"] = 1] = "center";
|
|
34
|
+
VerticalAlignment[VerticalAlignment["bottom"] = 2] = "bottom";
|
|
35
|
+
VerticalAlignment[VerticalAlignment["stretch"] = 3] = "stretch";
|
|
36
|
+
})(VerticalAlignment || (VerticalAlignment = {}));
|
|
37
|
+
export var Direction;
|
|
38
|
+
(function (Direction) {
|
|
39
|
+
Direction[Direction["horizontal"] = 0] = "horizontal";
|
|
40
|
+
Direction[Direction["vertical"] = 1] = "vertical";
|
|
41
|
+
})(Direction || (Direction = {}));
|
|
42
|
+
class Size extends ObservableObject {
|
|
43
|
+
constructor() {
|
|
44
|
+
super();
|
|
45
|
+
this.raw = { min: "", max: "" };
|
|
46
|
+
this.minPx = 0;
|
|
47
|
+
this.maxPx = Number.POSITIVE_INFINITY;
|
|
48
|
+
this.preferredUsed = false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
33
51
|
export class ElDriver extends BaseDriver {
|
|
34
52
|
allocate(node) {
|
|
35
53
|
return new ElImpl(node);
|
|
@@ -46,14 +64,17 @@ export class ElImpl {
|
|
|
46
64
|
this._kind = ElKind.part;
|
|
47
65
|
this._area = undefined;
|
|
48
66
|
this._coords = UndefinedElCoords;
|
|
49
|
-
this._width =
|
|
50
|
-
this._height =
|
|
51
|
-
this._alignment =
|
|
52
|
-
this.
|
|
67
|
+
this._width = Transaction.separate(() => new Size());
|
|
68
|
+
this._height = Transaction.separate(() => new Size());
|
|
69
|
+
this._alignment = undefined;
|
|
70
|
+
this._verticalAlignment = undefined;
|
|
71
|
+
this._alignmentInside = undefined;
|
|
72
|
+
this._verticalAlignmentInside = undefined;
|
|
53
73
|
this._stretchingStrengthX = undefined;
|
|
54
74
|
this._stretchingStrengthY = undefined;
|
|
55
75
|
this._contentWrapping = true;
|
|
56
76
|
this._overlayVisible = undefined;
|
|
77
|
+
this._sealed = undefined;
|
|
57
78
|
this._splitView = undefined;
|
|
58
79
|
this._hasStylingPresets = false;
|
|
59
80
|
}
|
|
@@ -102,6 +123,7 @@ export class ElImpl {
|
|
|
102
123
|
if (value.min !== w.min || value.max !== w.max) {
|
|
103
124
|
ElImpl.applyWidth(this, value);
|
|
104
125
|
this._width.raw = value;
|
|
126
|
+
this._width.preferredUsed = false;
|
|
105
127
|
}
|
|
106
128
|
}
|
|
107
129
|
get widthPx() { return this._width; }
|
|
@@ -112,12 +134,19 @@ export class ElImpl {
|
|
|
112
134
|
if (value.maxPx !== w.maxPx)
|
|
113
135
|
this._width.maxPx = value.maxPx;
|
|
114
136
|
}
|
|
137
|
+
get preferredWidthUsed() {
|
|
138
|
+
return this._width.preferredUsed;
|
|
139
|
+
}
|
|
140
|
+
set preferredWidthUsed(value) {
|
|
141
|
+
this._width.preferredUsed = value;
|
|
142
|
+
}
|
|
115
143
|
get height() { return this._height.raw; }
|
|
116
144
|
set height(value) {
|
|
117
145
|
const h = this._height.raw;
|
|
118
146
|
if (value.min !== h.min || value.max !== h.max) {
|
|
119
147
|
ElImpl.applyHeight(this, value);
|
|
120
148
|
this._height.raw = value;
|
|
149
|
+
this._height.preferredUsed = false;
|
|
121
150
|
}
|
|
122
151
|
}
|
|
123
152
|
get heightPx() { return this._height; }
|
|
@@ -128,22 +157,44 @@ export class ElImpl {
|
|
|
128
157
|
if (value.maxPx !== w.maxPx)
|
|
129
158
|
this._height.maxPx = value.maxPx;
|
|
130
159
|
}
|
|
160
|
+
get preferredHeightUsed() {
|
|
161
|
+
return this._height.preferredUsed;
|
|
162
|
+
}
|
|
163
|
+
set preferredHeightUsed(value) {
|
|
164
|
+
this._height.preferredUsed = value;
|
|
165
|
+
}
|
|
131
166
|
get alignment() { return this._alignment; }
|
|
132
167
|
set alignment(value) {
|
|
133
168
|
const existing = this._alignment;
|
|
134
169
|
if (value !== existing) {
|
|
135
|
-
ElImpl.applyAlignment(this, existing, value, this._alignmentInside, this._alignmentInside, this._stretchingStrengthX
|
|
170
|
+
ElImpl.applyAlignment(this, existing, value, this._alignmentInside, this._alignmentInside, this._stretchingStrengthX);
|
|
136
171
|
this._alignment = value;
|
|
137
172
|
}
|
|
138
173
|
}
|
|
174
|
+
get verticalAlignment() { return this._verticalAlignment; }
|
|
175
|
+
set verticalAlignment(value) {
|
|
176
|
+
const existing = this._verticalAlignment;
|
|
177
|
+
if (value !== existing) {
|
|
178
|
+
ElImpl.applyVerticalAlignment(this, existing, value, this._verticalAlignmentInside, this._verticalAlignmentInside, this._stretchingStrengthY);
|
|
179
|
+
this._verticalAlignment = value;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
139
182
|
get alignmentInside() { return this._alignmentInside; }
|
|
140
183
|
set alignmentInside(value) {
|
|
141
184
|
const existing = this._alignmentInside;
|
|
142
185
|
if (value !== existing) {
|
|
143
|
-
ElImpl.applyAlignment(this, this._alignment, this._alignment, existing, value, this._stretchingStrengthX
|
|
186
|
+
ElImpl.applyAlignment(this, this._alignment, this._alignment, existing, value, this._stretchingStrengthX);
|
|
144
187
|
this._alignmentInside = value;
|
|
145
188
|
}
|
|
146
189
|
}
|
|
190
|
+
get verticalAlignmentInside() { return this._verticalAlignmentInside; }
|
|
191
|
+
set verticalAlignmentInside(value) {
|
|
192
|
+
const existing = this._verticalAlignmentInside;
|
|
193
|
+
if (value !== existing) {
|
|
194
|
+
ElImpl.applyVerticalAlignment(this, this._verticalAlignment, this._verticalAlignment, existing, value, this._stretchingStrengthY);
|
|
195
|
+
this._verticalAlignmentInside = value;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
147
198
|
get stretchingStrengthX() { return this._stretchingStrengthX; }
|
|
148
199
|
set stretchingStrengthX(value) {
|
|
149
200
|
const existing = this._stretchingStrengthX;
|
|
@@ -174,6 +225,13 @@ export class ElImpl {
|
|
|
174
225
|
this._overlayVisible = value;
|
|
175
226
|
}
|
|
176
227
|
}
|
|
228
|
+
get sealed() { return this._sealed; }
|
|
229
|
+
set sealed(value) {
|
|
230
|
+
if (value !== this._sealed) {
|
|
231
|
+
ElImpl.applySealed(this, value);
|
|
232
|
+
this._sealed = value;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
177
235
|
get splitView() { return this._splitView; }
|
|
178
236
|
set splitView(value) {
|
|
179
237
|
if (value !== this._splitView) {
|
|
@@ -181,6 +239,12 @@ export class ElImpl {
|
|
|
181
239
|
this._splitView = value;
|
|
182
240
|
}
|
|
183
241
|
}
|
|
242
|
+
get partitionSizeInSplitViewPx() {
|
|
243
|
+
var _a;
|
|
244
|
+
if (this.layoutInfo === undefined)
|
|
245
|
+
this.layoutInfo = new ElLayoutInfo(InitialElLayoutInfo);
|
|
246
|
+
return (_a = this.layoutInfo.effectiveSizePx) !== null && _a !== void 0 ? _a : 0;
|
|
247
|
+
}
|
|
184
248
|
get style() { return this.native.style; }
|
|
185
249
|
useStylingPreset(stylingPresetName, enabled) {
|
|
186
250
|
ElImpl.applyStylingPreset(this, this._hasStylingPresets, stylingPresetName, enabled);
|
|
@@ -226,7 +290,7 @@ export class ElImpl {
|
|
|
226
290
|
const node = element.node;
|
|
227
291
|
const owner = node.owner;
|
|
228
292
|
const ownerEl = owner.element;
|
|
229
|
-
if (ownerEl.splitView ===
|
|
293
|
+
if (ownerEl.splitView === Direction.horizontal) {
|
|
230
294
|
}
|
|
231
295
|
else {
|
|
232
296
|
s.minWidth = (_a = value.min) !== null && _a !== void 0 ? _a : "";
|
|
@@ -239,31 +303,31 @@ export class ElImpl {
|
|
|
239
303
|
const node = element.node;
|
|
240
304
|
const owner = node.owner;
|
|
241
305
|
const ownerEl = owner.element;
|
|
242
|
-
if (ownerEl.splitView ===
|
|
306
|
+
if (ownerEl.splitView === Direction.vertical) {
|
|
243
307
|
}
|
|
244
308
|
else {
|
|
245
309
|
s.minHeight = (_a = value.min) !== null && _a !== void 0 ? _a : "";
|
|
246
310
|
s.maxHeight = (_b = value.max) !== null && _b !== void 0 ? _b : "";
|
|
247
311
|
}
|
|
248
312
|
}
|
|
249
|
-
static applyAlignment(element, oldPrimary, newPrimary, oldInside, newInside,
|
|
250
|
-
var _a;
|
|
313
|
+
static applyAlignment(element, oldPrimary, newPrimary, oldInside, newInside, strength) {
|
|
314
|
+
var _a, _b;
|
|
315
|
+
oldPrimary !== null && oldPrimary !== void 0 ? oldPrimary : (oldPrimary = Alignment.left);
|
|
316
|
+
newPrimary !== null && newPrimary !== void 0 ? newPrimary : (newPrimary = Alignment.left);
|
|
317
|
+
oldInside !== null && oldInside !== void 0 ? oldInside : (oldInside = oldPrimary);
|
|
318
|
+
newInside !== null && newInside !== void 0 ? newInside : (newInside = newPrimary);
|
|
251
319
|
const css = element.style;
|
|
252
320
|
let hostLayout = undefined;
|
|
253
|
-
let hostCss = undefined;
|
|
254
321
|
if (element.node.host.driver.isPartition) {
|
|
255
322
|
const hostEl = element.node.host.element;
|
|
256
|
-
hostCss = hostEl.style;
|
|
257
323
|
hostLayout = hostEl.layoutInfo;
|
|
258
324
|
if (hostLayout === undefined)
|
|
259
325
|
hostLayout = hostEl.layoutInfo = new ElLayoutInfo(InitialElLayoutInfo);
|
|
260
326
|
}
|
|
261
|
-
if (newInside === Align.default)
|
|
262
|
-
newInside = newPrimary;
|
|
263
327
|
let isEffectiveAlignerX = false;
|
|
264
328
|
if (hostLayout) {
|
|
265
|
-
const isAligner =
|
|
266
|
-
|
|
329
|
+
const isAligner = newPrimary === Alignment.center ||
|
|
330
|
+
newPrimary === Alignment.right;
|
|
267
331
|
isEffectiveAlignerX = isAligner && (hostLayout.alignerX === undefined ||
|
|
268
332
|
element.index <= hostLayout.alignerX.index);
|
|
269
333
|
if (hostLayout.alignerX === element) {
|
|
@@ -274,72 +338,90 @@ export class ElImpl {
|
|
|
274
338
|
}
|
|
275
339
|
else {
|
|
276
340
|
if (isEffectiveAlignerX) {
|
|
277
|
-
const existingAlignerCss = (_a = hostLayout.alignerX) === null || _a === void 0 ? void 0 : _a.style;
|
|
341
|
+
const existingAlignerCss = (_b = (_a = hostLayout.alignerX) === null || _a === void 0 ? void 0 : _a.native) === null || _b === void 0 ? void 0 : _b.style;
|
|
278
342
|
if (existingAlignerCss)
|
|
279
343
|
existingAlignerCss.marginLeft = "";
|
|
280
344
|
hostLayout.alignerX = element;
|
|
281
345
|
}
|
|
282
346
|
}
|
|
283
347
|
}
|
|
284
|
-
switch (newPrimary
|
|
348
|
+
switch (newPrimary) {
|
|
285
349
|
default:
|
|
286
|
-
case
|
|
350
|
+
case Alignment.left:
|
|
287
351
|
css.justifySelf = "start";
|
|
288
|
-
if (
|
|
352
|
+
if (oldPrimary === Alignment.center) {
|
|
289
353
|
css.marginLeft = "";
|
|
290
354
|
css.marginRight = "";
|
|
291
355
|
}
|
|
292
|
-
else if (
|
|
356
|
+
else if (oldPrimary === Alignment.right)
|
|
293
357
|
css.marginLeft = "";
|
|
294
358
|
break;
|
|
295
|
-
case
|
|
359
|
+
case Alignment.center:
|
|
296
360
|
css.justifySelf = "center";
|
|
297
361
|
if (hostLayout)
|
|
298
362
|
css.marginLeft = isEffectiveAlignerX ? "auto" : "";
|
|
299
363
|
css.marginRight = "auto";
|
|
300
364
|
break;
|
|
301
|
-
case
|
|
365
|
+
case Alignment.right:
|
|
302
366
|
css.justifySelf = "end";
|
|
303
367
|
if (hostLayout)
|
|
304
368
|
css.marginLeft = isEffectiveAlignerX ? "auto" : "";
|
|
305
|
-
if (
|
|
369
|
+
if (oldPrimary === Alignment.center)
|
|
306
370
|
css.marginRight = "";
|
|
307
371
|
break;
|
|
308
|
-
case
|
|
372
|
+
case Alignment.stretch:
|
|
309
373
|
css.justifySelf = "stretch";
|
|
310
|
-
if (
|
|
374
|
+
if (oldPrimary === Alignment.center) {
|
|
311
375
|
css.marginLeft = "";
|
|
312
376
|
css.marginRight = "";
|
|
313
377
|
}
|
|
314
|
-
else if (
|
|
378
|
+
else if (oldPrimary === Alignment.right)
|
|
315
379
|
css.marginLeft = "";
|
|
316
380
|
break;
|
|
317
381
|
}
|
|
318
|
-
switch (newInside
|
|
382
|
+
switch (newInside) {
|
|
319
383
|
default:
|
|
320
|
-
case
|
|
384
|
+
case Alignment.left:
|
|
321
385
|
css.alignItems = "start";
|
|
322
386
|
css.textAlign = "left";
|
|
323
387
|
break;
|
|
324
|
-
case
|
|
388
|
+
case Alignment.center:
|
|
325
389
|
css.alignItems = "center";
|
|
326
390
|
css.textAlign = "center";
|
|
327
391
|
break;
|
|
328
|
-
case
|
|
392
|
+
case Alignment.right:
|
|
329
393
|
css.alignItems = "end";
|
|
330
394
|
css.textAlign = "right";
|
|
331
395
|
break;
|
|
332
|
-
case
|
|
396
|
+
case Alignment.stretch:
|
|
333
397
|
css.alignItems = "stretch";
|
|
334
398
|
css.textAlign = "justify";
|
|
335
399
|
break;
|
|
336
400
|
}
|
|
401
|
+
if (newPrimary === Alignment.stretch && strength === undefined)
|
|
402
|
+
ElImpl.applyStretchingStrengthX(element, 0, 1);
|
|
403
|
+
}
|
|
404
|
+
static applyVerticalAlignment(element, oldPrimary, newPrimary, oldInside, newInside, strength) {
|
|
405
|
+
oldPrimary !== null && oldPrimary !== void 0 ? oldPrimary : (oldPrimary = VerticalAlignment.top);
|
|
406
|
+
newPrimary !== null && newPrimary !== void 0 ? newPrimary : (newPrimary = VerticalAlignment.top);
|
|
407
|
+
oldInside !== null && oldInside !== void 0 ? oldInside : (oldInside = oldPrimary);
|
|
408
|
+
newInside !== null && newInside !== void 0 ? newInside : (newInside = newPrimary);
|
|
409
|
+
const css = element.style;
|
|
410
|
+
let hostLayout = undefined;
|
|
411
|
+
let hostCss = undefined;
|
|
412
|
+
if (element.node.host.driver.isPartition) {
|
|
413
|
+
const hostEl = element.node.host.element;
|
|
414
|
+
hostCss = hostEl.style;
|
|
415
|
+
hostLayout = hostEl.layoutInfo;
|
|
416
|
+
if (hostLayout === undefined)
|
|
417
|
+
hostLayout = hostEl.layoutInfo = new ElLayoutInfo(InitialElLayoutInfo);
|
|
418
|
+
}
|
|
337
419
|
let isEffectiveAlignerY = false;
|
|
338
420
|
if (hostLayout) {
|
|
339
|
-
const isAligner =
|
|
340
|
-
|
|
421
|
+
const isAligner = newPrimary === VerticalAlignment.center ||
|
|
422
|
+
newPrimary === VerticalAlignment.bottom;
|
|
341
423
|
isEffectiveAlignerY = isAligner && (hostLayout.alignerY === undefined ||
|
|
342
|
-
|
|
424
|
+
hostLayout.alignerY.verticalAlignment !== VerticalAlignment.center);
|
|
343
425
|
if (hostLayout.alignerY === element) {
|
|
344
426
|
if (!isEffectiveAlignerY) {
|
|
345
427
|
hostCss.marginTop = "";
|
|
@@ -352,66 +434,47 @@ export class ElImpl {
|
|
|
352
434
|
}
|
|
353
435
|
}
|
|
354
436
|
}
|
|
355
|
-
switch (newPrimary
|
|
437
|
+
switch (newPrimary) {
|
|
356
438
|
default:
|
|
357
|
-
case
|
|
439
|
+
case VerticalAlignment.top:
|
|
358
440
|
css.alignSelf = "start";
|
|
359
441
|
break;
|
|
360
|
-
case
|
|
442
|
+
case VerticalAlignment.center:
|
|
361
443
|
css.alignSelf = "center";
|
|
362
444
|
break;
|
|
363
|
-
case
|
|
445
|
+
case VerticalAlignment.bottom:
|
|
364
446
|
css.alignSelf = "end";
|
|
365
447
|
break;
|
|
366
|
-
case
|
|
448
|
+
case VerticalAlignment.stretch:
|
|
367
449
|
css.alignSelf = "stretch";
|
|
368
450
|
break;
|
|
369
451
|
}
|
|
370
|
-
switch (newInside
|
|
452
|
+
switch (newInside) {
|
|
371
453
|
default:
|
|
372
|
-
case
|
|
454
|
+
case VerticalAlignment.top:
|
|
373
455
|
css.justifyContent = "start";
|
|
374
456
|
break;
|
|
375
|
-
case
|
|
457
|
+
case VerticalAlignment.center:
|
|
376
458
|
css.justifyContent = "center";
|
|
377
459
|
break;
|
|
378
|
-
case
|
|
460
|
+
case VerticalAlignment.bottom:
|
|
379
461
|
css.justifyContent = "end";
|
|
380
462
|
break;
|
|
381
|
-
case
|
|
463
|
+
case VerticalAlignment.stretch:
|
|
382
464
|
css.justifyContent = "stretch";
|
|
383
465
|
break;
|
|
384
466
|
}
|
|
385
|
-
if (
|
|
386
|
-
ElImpl.applyStretchingStrengthX(element, 0, 1);
|
|
387
|
-
if (alignedY(newPrimary, Align.stretchY) && strengthY === undefined)
|
|
467
|
+
if (newPrimary === VerticalAlignment.stretch && strength === undefined)
|
|
388
468
|
ElImpl.applyStretchingStrengthY(element, 0, 1);
|
|
389
469
|
}
|
|
390
470
|
static applyStretchingStrengthX(element, existing, value) {
|
|
391
|
-
var _a;
|
|
392
471
|
const s = element.style;
|
|
393
472
|
const host = element.node.host;
|
|
394
|
-
if (host.driver.isPartition
|
|
473
|
+
if (host.driver.isPartition) {
|
|
395
474
|
const hostEl = host.element;
|
|
396
475
|
hostEl._stretchingStrengthX = value;
|
|
397
|
-
let delta = 0;
|
|
398
476
|
existing !== null && existing !== void 0 ? existing : (existing = 0);
|
|
399
477
|
value !== null && value !== void 0 ? value : (value = 0);
|
|
400
|
-
if (existing === 0) {
|
|
401
|
-
if (value !== 0)
|
|
402
|
-
delta = 1;
|
|
403
|
-
}
|
|
404
|
-
else if (value === 0) {
|
|
405
|
-
if (existing !== 0)
|
|
406
|
-
delta = -1;
|
|
407
|
-
}
|
|
408
|
-
if (delta !== 0) {
|
|
409
|
-
const count = (_a = hostEl._stretchingStrengthX) !== null && _a !== void 0 ? _a : 0 + delta;
|
|
410
|
-
if (count === 1)
|
|
411
|
-
s.alignSelf = "stretch";
|
|
412
|
-
else if (count === 0)
|
|
413
|
-
s.alignSelf = "";
|
|
414
|
-
}
|
|
415
478
|
}
|
|
416
479
|
value !== null && value !== void 0 ? value : (value = 0);
|
|
417
480
|
if (value > 0) {
|
|
@@ -426,7 +489,7 @@ export class ElImpl {
|
|
|
426
489
|
static applyStretchingStrengthY(element, existing, value) {
|
|
427
490
|
var _a;
|
|
428
491
|
const host = element.node.host;
|
|
429
|
-
if (host.driver.isPartition
|
|
492
|
+
if (host.driver.isPartition) {
|
|
430
493
|
const hostElement = host.element;
|
|
431
494
|
hostElement._stretchingStrengthY = value;
|
|
432
495
|
let delta = 0;
|
|
@@ -494,30 +557,19 @@ export class ElImpl {
|
|
|
494
557
|
s.position = s.display = s.left = s.right = s.top = s.bottom = "";
|
|
495
558
|
}
|
|
496
559
|
}
|
|
497
|
-
static
|
|
560
|
+
static applySealed(element, value) {
|
|
498
561
|
const e = element.native;
|
|
499
562
|
if (e instanceof HTMLElement) {
|
|
500
|
-
const s = e.style;
|
|
501
|
-
if (value !== undefined) {
|
|
502
|
-
s.display = "flex";
|
|
503
|
-
s.position = "relative";
|
|
504
|
-
if (value === SplitView.horizontal) {
|
|
505
|
-
s.flexDirection = "row";
|
|
506
|
-
s.overflow = "scroll hidden";
|
|
507
|
-
}
|
|
508
|
-
else {
|
|
509
|
-
s.flexDirection = "column";
|
|
510
|
-
s.overflow = "hidden scroll";
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
else {
|
|
514
|
-
s.display = "";
|
|
515
|
-
s.position = "";
|
|
516
|
-
s.overflow = "";
|
|
517
|
-
}
|
|
518
563
|
Transaction.separate(() => e.sensors.resize.observeResizing(element, value !== undefined));
|
|
519
564
|
}
|
|
520
565
|
}
|
|
566
|
+
static applySplitView(element, value) {
|
|
567
|
+
const e = element.native;
|
|
568
|
+
if (e instanceof HTMLElement) {
|
|
569
|
+
element.sealed = value;
|
|
570
|
+
e.style.position = value !== undefined ? "relative" : "";
|
|
571
|
+
}
|
|
572
|
+
}
|
|
521
573
|
static applyStylingPreset(element, secondary, styleName, enabled) {
|
|
522
574
|
const native = element.native;
|
|
523
575
|
enabled !== null && enabled !== void 0 ? enabled : (enabled = true);
|
|
@@ -539,10 +591,45 @@ export class ElLayoutInfo {
|
|
|
539
591
|
this.effectiveSizePx = 0;
|
|
540
592
|
this.offsetXpx = 0;
|
|
541
593
|
this.offsetYpx = 0;
|
|
542
|
-
this.
|
|
543
|
-
this.
|
|
594
|
+
this.contentSizeXpx = 0;
|
|
595
|
+
this.contentSizeYpx = 0;
|
|
596
|
+
this.borderSizeXpx = 0;
|
|
597
|
+
this.borderSizeYpx = 0;
|
|
598
|
+
this.isConstrained = false;
|
|
544
599
|
}
|
|
545
600
|
}
|
|
601
|
+
__decorate([
|
|
602
|
+
obs,
|
|
603
|
+
__metadata("design:type", Number)
|
|
604
|
+
], ElLayoutInfo.prototype, "effectiveSizePx", void 0);
|
|
605
|
+
__decorate([
|
|
606
|
+
obs,
|
|
607
|
+
__metadata("design:type", Number)
|
|
608
|
+
], ElLayoutInfo.prototype, "offsetXpx", void 0);
|
|
609
|
+
__decorate([
|
|
610
|
+
obs,
|
|
611
|
+
__metadata("design:type", Number)
|
|
612
|
+
], ElLayoutInfo.prototype, "offsetYpx", void 0);
|
|
613
|
+
__decorate([
|
|
614
|
+
obs,
|
|
615
|
+
__metadata("design:type", Number)
|
|
616
|
+
], ElLayoutInfo.prototype, "contentSizeXpx", void 0);
|
|
617
|
+
__decorate([
|
|
618
|
+
obs,
|
|
619
|
+
__metadata("design:type", Number)
|
|
620
|
+
], ElLayoutInfo.prototype, "contentSizeYpx", void 0);
|
|
621
|
+
__decorate([
|
|
622
|
+
obs,
|
|
623
|
+
__metadata("design:type", Number)
|
|
624
|
+
], ElLayoutInfo.prototype, "borderSizeYpx", void 0);
|
|
625
|
+
__decorate([
|
|
626
|
+
obs,
|
|
627
|
+
__metadata("design:type", Number)
|
|
628
|
+
], ElLayoutInfo.prototype, "borderSizeXpx", void 0);
|
|
629
|
+
__decorate([
|
|
630
|
+
obs,
|
|
631
|
+
__metadata("design:type", Boolean)
|
|
632
|
+
], ElLayoutInfo.prototype, "isConstrained", void 0);
|
|
546
633
|
var ElLayoutInfoFlags;
|
|
547
634
|
(function (ElLayoutInfoFlags) {
|
|
548
635
|
ElLayoutInfoFlags[ElLayoutInfoFlags["none"] = 0] = "none";
|
|
@@ -552,7 +639,7 @@ var ElLayoutInfoFlags;
|
|
|
552
639
|
ElLayoutInfoFlags[ElLayoutInfoFlags["childrenRelayoutIsNeeded"] = 8] = "childrenRelayoutIsNeeded";
|
|
553
640
|
})(ElLayoutInfoFlags || (ElLayoutInfoFlags = {}));
|
|
554
641
|
const UndefinedElCoords = Object.freeze({ x1: 0, y1: 0, x2: 0, y2: 0 });
|
|
555
|
-
export const InitialElLayoutInfo = Object.freeze(new ElLayoutInfo({ x: 1, y: 1, runningMaxX: 0, runningMaxY: 0, flags: ElLayoutInfoFlags.none, effectiveSizePx: 0, offsetXpx: 0, offsetYpx: 0,
|
|
642
|
+
export const InitialElLayoutInfo = Object.freeze(new ElLayoutInfo({ x: 1, y: 1, runningMaxX: 0, runningMaxY: 0, flags: ElLayoutInfoFlags.none, effectiveSizePx: 0, offsetXpx: 0, offsetYpx: 0, contentSizeXpx: 0, contentSizeYpx: 0, borderSizeXpx: 0, borderSizeYpx: 0, isConstrained: false }));
|
|
556
643
|
function getElCoordsAndAdjustLayoutInfo(isRegularElement, area, maxX, maxY, prevElLayoutInfo, layoutInfo) {
|
|
557
644
|
var _a, _b;
|
|
558
645
|
let result;
|
|
@@ -722,8 +809,7 @@ const VerstakDriversByLayout = [
|
|
|
722
809
|
const owner = el.node.owner.element;
|
|
723
810
|
s.position = "absolute";
|
|
724
811
|
s.zIndex = `${Number.MAX_SAFE_INTEGER}`;
|
|
725
|
-
|
|
726
|
-
if (owner.splitView === SplitView.horizontal) {
|
|
812
|
+
if (owner.splitView === Direction.horizontal) {
|
|
727
813
|
s.width = "4px";
|
|
728
814
|
s.marginLeft = "-2px";
|
|
729
815
|
s.top = s.bottom = "0";
|
|
@@ -741,9 +827,3 @@ const VerstakDriversByLayout = [
|
|
|
741
827
|
el => {
|
|
742
828
|
},
|
|
743
829
|
];
|
|
744
|
-
function alignedX(align, like) {
|
|
745
|
-
return (align & 0b00000011) == (like & 0b00000011);
|
|
746
|
-
}
|
|
747
|
-
function alignedY(align, like) {
|
|
748
|
-
return (align & 0b00011000) == (like & 0b00011000);
|
|
749
|
-
}
|
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import { ElCoords } from "./El.js";
|
|
2
2
|
export declare function objectHasMember<T>(obj: any, member: string): obj is T;
|
|
3
3
|
export declare function clamp(value: number, min: number, max: number): number;
|
|
4
|
+
export declare function parseLetters(value: string): number;
|
|
4
5
|
export declare function emitLetters(n: number): string;
|
|
6
|
+
export declare function parseSignedLetters(letters: string): number;
|
|
7
|
+
export declare function emitSignedLetters(num: number): string;
|
|
8
|
+
export declare function parseSignedNumber(number: string): number;
|
|
9
|
+
export declare function emitSignedNumber(num: number): string;
|
|
10
|
+
export declare function parseSign(value: string): {
|
|
11
|
+
sign: number;
|
|
12
|
+
value: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function emitSign(sign: number, num: number | string): string;
|
|
5
15
|
export declare function parseElCoords(text: string, result: ElCoords): ElCoords;
|
|
6
16
|
export declare function emitElCoords(value: ElCoords): string;
|
|
7
17
|
export declare function emitCellPosition(x: number, y: number): string;
|
|
8
18
|
export declare function equalElCoords(a: ElCoords, b: ElCoords): boolean;
|
|
19
|
+
export declare function isWhitespace(char: number): boolean;
|
|
20
|
+
export declare function isDigit(input: number, index?: number): boolean;
|
|
21
|
+
export declare function isCapitalLetter(ch: number): boolean;
|
|
22
|
+
export declare function isLowercaseLetter(ch: number): boolean;
|
|
@@ -4,6 +4,9 @@ export function objectHasMember(obj, member) {
|
|
|
4
4
|
export function clamp(value, min, max) {
|
|
5
5
|
return Math.min(max, Math.max(min, value));
|
|
6
6
|
}
|
|
7
|
+
export function parseLetters(value) {
|
|
8
|
+
return value.split("").reduce((p, c) => p * 26 + parseInt(c, 36) - 9, 0);
|
|
9
|
+
}
|
|
7
10
|
export function emitLetters(n) {
|
|
8
11
|
if (n < 0)
|
|
9
12
|
throw new Error(`emitLetters: argument (${n}) should not be negative or zero`);
|
|
@@ -15,6 +18,32 @@ export function emitLetters(n) {
|
|
|
15
18
|
}
|
|
16
19
|
return result;
|
|
17
20
|
}
|
|
21
|
+
export function parseSignedLetters(letters) {
|
|
22
|
+
const { sign, value } = parseSign(letters);
|
|
23
|
+
return sign * parseLetters(value);
|
|
24
|
+
}
|
|
25
|
+
export function emitSignedLetters(num) {
|
|
26
|
+
const letters = emitLetters(Math.abs(num) - 1);
|
|
27
|
+
return emitSign(Math.sign(num), letters);
|
|
28
|
+
}
|
|
29
|
+
export function parseSignedNumber(number) {
|
|
30
|
+
const { sign, value } = parseSign(number);
|
|
31
|
+
return sign * Number.parseInt(value);
|
|
32
|
+
}
|
|
33
|
+
export function emitSignedNumber(num) {
|
|
34
|
+
return emitSign(Math.sign(num), Math.abs(num));
|
|
35
|
+
}
|
|
36
|
+
export function parseSign(value) {
|
|
37
|
+
const openBraceIndex = value.indexOf("(");
|
|
38
|
+
const closeBraceIndex = value.indexOf(")");
|
|
39
|
+
const sign = ~openBraceIndex && ~closeBraceIndex ? -1 : 1;
|
|
40
|
+
if (sign < 0)
|
|
41
|
+
value = value.substring(openBraceIndex + 1, closeBraceIndex);
|
|
42
|
+
return { sign, value };
|
|
43
|
+
}
|
|
44
|
+
export function emitSign(sign, num) {
|
|
45
|
+
return sign < 0 ? `(${num})` : `${num}`;
|
|
46
|
+
}
|
|
18
47
|
export function parseElCoords(text, result) {
|
|
19
48
|
let i = 0;
|
|
20
49
|
let value = 0;
|
|
@@ -26,14 +55,14 @@ export function parseElCoords(text, result) {
|
|
|
26
55
|
if (component % 2 === 0)
|
|
27
56
|
value = value * 26 + charCode - 64;
|
|
28
57
|
else
|
|
29
|
-
console.error(`Digit is expected, but letter (
|
|
58
|
+
console.error(`Digit is expected, but letter ("${text[i]}") was read`);
|
|
30
59
|
}
|
|
31
60
|
else if (isLowercaseLetter(charCode)) {
|
|
32
61
|
if (component % 2 === 0) {
|
|
33
62
|
value = value * 26 + charCode - 96;
|
|
34
63
|
}
|
|
35
64
|
else {
|
|
36
|
-
console.error(`Digit is expected, but letter (
|
|
65
|
+
console.error(`Digit is expected, but letter ("${text[i]}") was read`);
|
|
37
66
|
}
|
|
38
67
|
}
|
|
39
68
|
else if (isDigit(charCode)) {
|
|
@@ -87,18 +116,18 @@ export function parseElCoords(text, result) {
|
|
|
87
116
|
}
|
|
88
117
|
else if (charCode === 58) {
|
|
89
118
|
if (sign < 0)
|
|
90
|
-
console.error(`area
|
|
119
|
+
console.error(`area "${text}": e1`);
|
|
91
120
|
if (component === 1)
|
|
92
121
|
result.y1 = value * sign;
|
|
93
122
|
else if (component !== 2)
|
|
94
|
-
console.error(`area
|
|
123
|
+
console.error(`area "${text}": [e2] component = ${component}`);
|
|
95
124
|
component = 2;
|
|
96
125
|
value = 0;
|
|
97
126
|
}
|
|
98
127
|
else if (isWhitespace(charCode)) {
|
|
99
128
|
}
|
|
100
129
|
else {
|
|
101
|
-
console.error(`Unknown symbol
|
|
130
|
+
console.error(`Unknown symbol "${text[i]}" in "${text}"`);
|
|
102
131
|
}
|
|
103
132
|
i++;
|
|
104
133
|
}
|
|
@@ -168,15 +197,15 @@ export function emitCellPosition(x, y) {
|
|
|
168
197
|
export function equalElCoords(a, b) {
|
|
169
198
|
return a.x1 === b.x1 && a.y1 === b.y1 && a.x2 === b.x2 && a.y1 === b.y2;
|
|
170
199
|
}
|
|
171
|
-
function isWhitespace(char) {
|
|
200
|
+
export function isWhitespace(char) {
|
|
172
201
|
return char === 32 || (char >= 9 && char <= 13) || char === 133 || char === 160;
|
|
173
202
|
}
|
|
174
|
-
function isDigit(input, index) {
|
|
203
|
+
export function isDigit(input, index) {
|
|
175
204
|
return 48 <= input && input <= 57;
|
|
176
205
|
}
|
|
177
|
-
function isCapitalLetter(ch) {
|
|
206
|
+
export function isCapitalLetter(ch) {
|
|
178
207
|
return 65 <= ch && ch <= 90;
|
|
179
208
|
}
|
|
180
|
-
function isLowercaseLetter(ch) {
|
|
209
|
+
export function isLowercaseLetter(ch) {
|
|
181
210
|
return 97 <= ch && ch <= 122;
|
|
182
211
|
}
|