verstak 0.24.268 → 0.24.270
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/DraggableArea.view.d.ts +11 -0
- package/build/dist/source/html/DraggableArea.view.js +37 -0
- package/build/dist/source/html/El.d.ts +67 -31
- package/build/dist/source/html/El.js +460 -232
- package/build/dist/source/html/ElUtils.d.ts +1 -0
- package/build/dist/source/html/ElUtils.js +3 -0
- package/build/dist/source/html/Elements.d.ts +18 -4
- package/build/dist/source/html/Elements.js +172 -15
- package/build/dist/source/html/HtmlDriver.d.ts +2 -2
- package/build/dist/source/html/HtmlDriver.js +2 -2
- package/build/dist/source/html/HtmlElements.js +174 -174
- package/build/dist/source/html/Sizes.d.ts +37 -0
- package/build/dist/source/html/Sizes.js +139 -0
- package/build/dist/source/html/SplitViewMath.d.ts +18 -0
- package/build/dist/source/html/SplitViewMath.js +256 -0
- 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/PointerSensor.js +4 -0
- package/package.json +2 -2
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import { RxNode, BaseDriver } from "reactronic";
|
|
1
|
+
import { RxNode, BaseDriver, Transaction } from "reactronic";
|
|
2
2
|
import { equalElCoords, parseElCoords } from "./ElUtils.js";
|
|
3
|
-
export class ElDriver extends BaseDriver {
|
|
4
|
-
allocate(node) {
|
|
5
|
-
return new ElImpl(node);
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
3
|
export var ElKind;
|
|
9
4
|
(function (ElKind) {
|
|
10
5
|
ElKind[ElKind["section"] = 0] = "section";
|
|
@@ -12,23 +7,34 @@ export var ElKind;
|
|
|
12
7
|
ElKind[ElKind["note"] = 2] = "note";
|
|
13
8
|
ElKind[ElKind["group"] = 3] = "group";
|
|
14
9
|
ElKind[ElKind["part"] = 4] = "part";
|
|
15
|
-
ElKind[ElKind["
|
|
16
|
-
ElKind[ElKind["
|
|
10
|
+
ElKind[ElKind["splitter"] = 5] = "splitter";
|
|
11
|
+
ElKind[ElKind["cursor"] = 6] = "cursor";
|
|
12
|
+
ElKind[ElKind["native"] = 7] = "native";
|
|
17
13
|
})(ElKind || (ElKind = {}));
|
|
18
14
|
export var Align;
|
|
19
15
|
(function (Align) {
|
|
20
16
|
Align[Align["default"] = 0] = "default";
|
|
21
17
|
Align[Align["left"] = 4] = "left";
|
|
22
|
-
Align[Align["
|
|
18
|
+
Align[Align["centerX"] = 5] = "centerX";
|
|
23
19
|
Align[Align["right"] = 6] = "right";
|
|
24
|
-
Align[Align["
|
|
20
|
+
Align[Align["stretchX"] = 7] = "stretchX";
|
|
25
21
|
Align[Align["top"] = 32] = "top";
|
|
26
|
-
Align[Align["
|
|
22
|
+
Align[Align["centerY"] = 40] = "centerY";
|
|
27
23
|
Align[Align["bottom"] = 48] = "bottom";
|
|
28
|
-
Align[Align["
|
|
29
|
-
Align[Align["
|
|
30
|
-
Align[Align["
|
|
24
|
+
Align[Align["stretchY"] = 56] = "stretchY";
|
|
25
|
+
Align[Align["centerXY"] = 45] = "centerXY";
|
|
26
|
+
Align[Align["stretchXY"] = 63] = "stretchXY";
|
|
31
27
|
})(Align || (Align = {}));
|
|
28
|
+
export var SplitView;
|
|
29
|
+
(function (SplitView) {
|
|
30
|
+
SplitView[SplitView["horizontal"] = 0] = "horizontal";
|
|
31
|
+
SplitView[SplitView["vertical"] = 1] = "vertical";
|
|
32
|
+
})(SplitView || (SplitView = {}));
|
|
33
|
+
export class ElDriver extends BaseDriver {
|
|
34
|
+
allocate(node) {
|
|
35
|
+
return new ElImpl(node);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
32
38
|
export class ElImpl {
|
|
33
39
|
constructor(node) {
|
|
34
40
|
this.node = node;
|
|
@@ -40,20 +46,22 @@ export class ElImpl {
|
|
|
40
46
|
this._kind = ElKind.part;
|
|
41
47
|
this._area = undefined;
|
|
42
48
|
this._coords = UndefinedElCoords;
|
|
43
|
-
this._width = { min: "", max: "" };
|
|
44
|
-
this._height = { min: "", max: "" };
|
|
49
|
+
this._width = { raw: { min: "", max: "" }, minPx: 0, maxPx: Number.POSITIVE_INFINITY };
|
|
50
|
+
this._height = { raw: { min: "", max: "" }, minPx: 0, maxPx: Number.POSITIVE_INFINITY };
|
|
45
51
|
this._alignment = Align.default;
|
|
46
|
-
this.
|
|
52
|
+
this._alignmentInside = Align.default;
|
|
47
53
|
this._stretchingStrengthX = undefined;
|
|
48
54
|
this._stretchingStrengthY = undefined;
|
|
49
55
|
this._contentWrapping = true;
|
|
50
56
|
this._overlayVisible = undefined;
|
|
57
|
+
this._splitView = undefined;
|
|
51
58
|
this._hasStylingPresets = false;
|
|
52
59
|
}
|
|
53
60
|
prepareForUpdate() {
|
|
54
61
|
this._area = undefined;
|
|
55
62
|
this._hasStylingPresets = false;
|
|
56
63
|
}
|
|
64
|
+
get index() { return this.node.seat.index; }
|
|
57
65
|
get isSection() { return this.kind === ElKind.section; }
|
|
58
66
|
get isTable() { return this.kind === ElKind.table; }
|
|
59
67
|
get isAuxiliary() { return this.kind > ElKind.note; }
|
|
@@ -61,7 +69,7 @@ export class ElImpl {
|
|
|
61
69
|
set kind(value) {
|
|
62
70
|
if (value !== this._kind || this.node.stamp >= Number.MAX_SAFE_INTEGER - 1) {
|
|
63
71
|
if (this.native !== undefined)
|
|
64
|
-
|
|
72
|
+
ElImpl.applyKind(this, value);
|
|
65
73
|
this._kind = value;
|
|
66
74
|
}
|
|
67
75
|
}
|
|
@@ -80,7 +88,7 @@ export class ElImpl {
|
|
|
80
88
|
const coords = getElCoordsAndAdjustLayoutInfo(!isCursorElement, value, ownerEl.maxColumnCount, ownerEl.maxRowCount, prevElLayoutInfo, layoutInfo);
|
|
81
89
|
if (!equalElCoords(coords, this._coords)) {
|
|
82
90
|
if (this.native !== undefined)
|
|
83
|
-
|
|
91
|
+
ElImpl.applyCoords(this, coords);
|
|
84
92
|
this._coords = coords;
|
|
85
93
|
}
|
|
86
94
|
this._area = value !== null && value !== void 0 ? value : {};
|
|
@@ -88,85 +96,104 @@ export class ElImpl {
|
|
|
88
96
|
else
|
|
89
97
|
this.rowBreak();
|
|
90
98
|
}
|
|
91
|
-
get width() { return this._width; }
|
|
99
|
+
get width() { return this._width.raw; }
|
|
92
100
|
set width(value) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
Apply.minWidth(this, (_a = value.min) !== null && _a !== void 0 ? _a : "");
|
|
98
|
-
updated = true;
|
|
99
|
-
}
|
|
100
|
-
if (value.max !== w.max) {
|
|
101
|
-
Apply.maxWidth(this, (_b = value.max) !== null && _b !== void 0 ? _b : "");
|
|
102
|
-
updated = true;
|
|
101
|
+
const w = this._width.raw;
|
|
102
|
+
if (value.min !== w.min || value.max !== w.max) {
|
|
103
|
+
ElImpl.applyWidth(this, value);
|
|
104
|
+
this._width.raw = value;
|
|
103
105
|
}
|
|
104
|
-
if (updated)
|
|
105
|
-
this._width = value;
|
|
106
106
|
}
|
|
107
|
-
get
|
|
107
|
+
get widthPx() { return this._width; }
|
|
108
|
+
set widthPx(value) {
|
|
109
|
+
const w = this._width;
|
|
110
|
+
if (value.minPx !== w.minPx)
|
|
111
|
+
this._width.minPx = value.minPx;
|
|
112
|
+
if (value.maxPx !== w.maxPx)
|
|
113
|
+
this._width.maxPx = value.maxPx;
|
|
114
|
+
}
|
|
115
|
+
get height() { return this._height.raw; }
|
|
108
116
|
set height(value) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
Apply.minHeight(this, (_a = value.min) !== null && _a !== void 0 ? _a : "");
|
|
114
|
-
updated = true;
|
|
115
|
-
}
|
|
116
|
-
if (value.max !== w.max) {
|
|
117
|
-
Apply.maxHeight(this, (_b = value.max) !== null && _b !== void 0 ? _b : "");
|
|
118
|
-
updated = true;
|
|
117
|
+
const h = this._height.raw;
|
|
118
|
+
if (value.min !== h.min || value.max !== h.max) {
|
|
119
|
+
ElImpl.applyHeight(this, value);
|
|
120
|
+
this._height.raw = value;
|
|
119
121
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
+
}
|
|
123
|
+
get heightPx() { return this._height; }
|
|
124
|
+
set heightPx(value) {
|
|
125
|
+
const w = this._height;
|
|
126
|
+
if (value.minPx !== w.minPx)
|
|
127
|
+
this._height.minPx = value.minPx;
|
|
128
|
+
if (value.maxPx !== w.maxPx)
|
|
129
|
+
this._height.maxPx = value.maxPx;
|
|
122
130
|
}
|
|
123
131
|
get alignment() { return this._alignment; }
|
|
124
132
|
set alignment(value) {
|
|
125
|
-
|
|
126
|
-
|
|
133
|
+
const existing = this._alignment;
|
|
134
|
+
if (value !== existing) {
|
|
135
|
+
ElImpl.applyAlignment(this, existing, value, this._alignmentInside, this._alignmentInside, this._stretchingStrengthX, this._stretchingStrengthY);
|
|
127
136
|
this._alignment = value;
|
|
128
137
|
}
|
|
129
138
|
}
|
|
130
|
-
get
|
|
131
|
-
set
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
this.
|
|
139
|
+
get alignmentInside() { return this._alignmentInside; }
|
|
140
|
+
set alignmentInside(value) {
|
|
141
|
+
const existing = this._alignmentInside;
|
|
142
|
+
if (value !== existing) {
|
|
143
|
+
ElImpl.applyAlignment(this, this._alignment, this._alignment, existing, value, this._stretchingStrengthX, this._stretchingStrengthY);
|
|
144
|
+
this._alignmentInside = value;
|
|
135
145
|
}
|
|
136
146
|
}
|
|
137
147
|
get stretchingStrengthX() { return this._stretchingStrengthX; }
|
|
138
148
|
set stretchingStrengthX(value) {
|
|
139
|
-
|
|
140
|
-
|
|
149
|
+
const existing = this._stretchingStrengthX;
|
|
150
|
+
if (value !== existing) {
|
|
151
|
+
ElImpl.applyStretchingStrengthX(this, existing, value);
|
|
141
152
|
this._stretchingStrengthX = value;
|
|
142
153
|
}
|
|
143
154
|
}
|
|
144
155
|
get stretchingStrengthY() { return this._stretchingStrengthY; }
|
|
145
156
|
set stretchingStrengthY(value) {
|
|
146
|
-
|
|
147
|
-
|
|
157
|
+
const existing = this._stretchingStrengthY;
|
|
158
|
+
if (value !== existing) {
|
|
159
|
+
ElImpl.applyStretchingStrengthY(this, existing, value);
|
|
148
160
|
this._stretchingStrengthY = value;
|
|
149
161
|
}
|
|
150
162
|
}
|
|
151
163
|
get contentWrapping() { return this._contentWrapping; }
|
|
152
164
|
set contentWrapping(value) {
|
|
153
165
|
if (value !== this._contentWrapping) {
|
|
154
|
-
|
|
166
|
+
ElImpl.applyContentWrapping(this, value);
|
|
155
167
|
this._contentWrapping = value;
|
|
156
168
|
}
|
|
157
169
|
}
|
|
158
170
|
get overlayVisible() { return this._overlayVisible; }
|
|
159
171
|
set overlayVisible(value) {
|
|
160
172
|
if (value !== this._overlayVisible) {
|
|
161
|
-
|
|
173
|
+
ElImpl.applyOverlayVisible(this, value);
|
|
162
174
|
this._overlayVisible = value;
|
|
163
175
|
}
|
|
164
176
|
}
|
|
177
|
+
get splitView() { return this._splitView; }
|
|
178
|
+
set splitView(value) {
|
|
179
|
+
if (value !== this._splitView) {
|
|
180
|
+
ElImpl.applySplitView(this, value);
|
|
181
|
+
this._splitView = value;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
165
184
|
get style() { return this.native.style; }
|
|
166
185
|
useStylingPreset(stylingPresetName, enabled) {
|
|
167
|
-
|
|
186
|
+
ElImpl.applyStylingPreset(this, this._hasStylingPresets, stylingPresetName, enabled);
|
|
168
187
|
this._hasStylingPresets = true;
|
|
169
188
|
}
|
|
189
|
+
*children(onlyAfter) {
|
|
190
|
+
const after = onlyAfter === null || onlyAfter === void 0 ? void 0 : onlyAfter.node.seat;
|
|
191
|
+
for (const child of this.node.children.items(after))
|
|
192
|
+
yield child.instance.element;
|
|
193
|
+
}
|
|
194
|
+
static *childrenOf(node, onlyAfter) {
|
|
195
|
+
return node.element.children(onlyAfter);
|
|
196
|
+
}
|
|
170
197
|
rowBreak() {
|
|
171
198
|
var _a, _b;
|
|
172
199
|
const node = this.node;
|
|
@@ -176,14 +203,344 @@ export class ElImpl {
|
|
|
176
203
|
layoutInfo.x = 1;
|
|
177
204
|
layoutInfo.y = layoutInfo.runningMaxY + 1;
|
|
178
205
|
}
|
|
206
|
+
static applyKind(element, value) {
|
|
207
|
+
const kind = Constants.layouts[value];
|
|
208
|
+
kind && element.native.setAttribute(Constants.kindAttrName, kind);
|
|
209
|
+
VerstakDriversByLayout[value](element);
|
|
210
|
+
}
|
|
211
|
+
static applyCoords(element, value) {
|
|
212
|
+
const s = element.style;
|
|
213
|
+
if (value) {
|
|
214
|
+
const x1 = value.x1 || 1;
|
|
215
|
+
const y1 = value.y1 || 1;
|
|
216
|
+
const x2 = value.x2 || x1;
|
|
217
|
+
const y2 = value.y2 || y1;
|
|
218
|
+
s.gridArea = `${y1} / ${x1} / span ${y2 - y1 + 1} / span ${x2 - x1 + 1}`;
|
|
219
|
+
}
|
|
220
|
+
else
|
|
221
|
+
s.gridArea = "";
|
|
222
|
+
}
|
|
223
|
+
static applyWidth(element, value) {
|
|
224
|
+
var _a, _b;
|
|
225
|
+
const s = element.style;
|
|
226
|
+
const node = element.node;
|
|
227
|
+
const owner = node.owner;
|
|
228
|
+
const ownerEl = owner.element;
|
|
229
|
+
if (ownerEl.splitView === SplitView.horizontal) {
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
s.minWidth = (_a = value.min) !== null && _a !== void 0 ? _a : "";
|
|
233
|
+
s.maxWidth = (_b = value.max) !== null && _b !== void 0 ? _b : "";
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
static applyHeight(element, value) {
|
|
237
|
+
var _a, _b;
|
|
238
|
+
const s = element.style;
|
|
239
|
+
const node = element.node;
|
|
240
|
+
const owner = node.owner;
|
|
241
|
+
const ownerEl = owner.element;
|
|
242
|
+
if (ownerEl.splitView === SplitView.vertical) {
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
s.minHeight = (_a = value.min) !== null && _a !== void 0 ? _a : "";
|
|
246
|
+
s.maxHeight = (_b = value.max) !== null && _b !== void 0 ? _b : "";
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
static applyAlignment(element, oldPrimary, newPrimary, oldInside, newInside, strengthX, strengthY) {
|
|
250
|
+
var _a;
|
|
251
|
+
const css = element.style;
|
|
252
|
+
let hostLayout = undefined;
|
|
253
|
+
let hostCss = undefined;
|
|
254
|
+
if (element.node.host.driver.isPartition) {
|
|
255
|
+
const hostEl = element.node.host.element;
|
|
256
|
+
hostCss = hostEl.style;
|
|
257
|
+
hostLayout = hostEl.layoutInfo;
|
|
258
|
+
if (hostLayout === undefined)
|
|
259
|
+
hostLayout = hostEl.layoutInfo = new ElLayoutInfo(InitialElLayoutInfo);
|
|
260
|
+
}
|
|
261
|
+
if (newInside === Align.default)
|
|
262
|
+
newInside = newPrimary;
|
|
263
|
+
let isEffectiveAlignerX = false;
|
|
264
|
+
if (hostLayout) {
|
|
265
|
+
const isAligner = alignedX(newPrimary, Align.centerX) ||
|
|
266
|
+
alignedX(newPrimary, Align.right);
|
|
267
|
+
isEffectiveAlignerX = isAligner && (hostLayout.alignerX === undefined ||
|
|
268
|
+
element.index <= hostLayout.alignerX.index);
|
|
269
|
+
if (hostLayout.alignerX === element) {
|
|
270
|
+
if (!isEffectiveAlignerX) {
|
|
271
|
+
css.marginLeft = "";
|
|
272
|
+
throw new Error("changing alignment leader is not implemented yet");
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
if (isEffectiveAlignerX) {
|
|
277
|
+
const existingAlignerCss = (_a = hostLayout.alignerX) === null || _a === void 0 ? void 0 : _a.style;
|
|
278
|
+
if (existingAlignerCss)
|
|
279
|
+
existingAlignerCss.marginLeft = "";
|
|
280
|
+
hostLayout.alignerX = element;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
switch (newPrimary & 0b00000111) {
|
|
285
|
+
default:
|
|
286
|
+
case Align.left:
|
|
287
|
+
css.justifySelf = "start";
|
|
288
|
+
if (alignedX(oldPrimary, Align.centerX)) {
|
|
289
|
+
css.marginLeft = "";
|
|
290
|
+
css.marginRight = "";
|
|
291
|
+
}
|
|
292
|
+
else if ((oldPrimary & Align.right) === Align.right)
|
|
293
|
+
css.marginLeft = "";
|
|
294
|
+
break;
|
|
295
|
+
case Align.centerX:
|
|
296
|
+
css.justifySelf = "center";
|
|
297
|
+
if (hostLayout)
|
|
298
|
+
css.marginLeft = isEffectiveAlignerX ? "auto" : "";
|
|
299
|
+
css.marginRight = "auto";
|
|
300
|
+
break;
|
|
301
|
+
case Align.right:
|
|
302
|
+
css.justifySelf = "end";
|
|
303
|
+
if (hostLayout)
|
|
304
|
+
css.marginLeft = isEffectiveAlignerX ? "auto" : "";
|
|
305
|
+
if (alignedX(oldPrimary, Align.centerX))
|
|
306
|
+
css.marginRight = "";
|
|
307
|
+
break;
|
|
308
|
+
case Align.stretchX:
|
|
309
|
+
css.justifySelf = "stretch";
|
|
310
|
+
if (alignedX(oldPrimary, Align.centerX)) {
|
|
311
|
+
css.marginLeft = "";
|
|
312
|
+
css.marginRight = "";
|
|
313
|
+
}
|
|
314
|
+
else if (alignedX(oldPrimary, Align.right))
|
|
315
|
+
css.marginLeft = "";
|
|
316
|
+
break;
|
|
317
|
+
}
|
|
318
|
+
switch (newInside & 0b00000111) {
|
|
319
|
+
default:
|
|
320
|
+
case Align.left:
|
|
321
|
+
css.alignItems = "start";
|
|
322
|
+
css.textAlign = "left";
|
|
323
|
+
break;
|
|
324
|
+
case Align.centerX:
|
|
325
|
+
css.alignItems = "center";
|
|
326
|
+
css.textAlign = "center";
|
|
327
|
+
break;
|
|
328
|
+
case Align.right:
|
|
329
|
+
css.alignItems = "end";
|
|
330
|
+
css.textAlign = "right";
|
|
331
|
+
break;
|
|
332
|
+
case Align.stretchX:
|
|
333
|
+
css.alignItems = "stretch";
|
|
334
|
+
css.textAlign = "justify";
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
337
|
+
let isEffectiveAlignerY = false;
|
|
338
|
+
if (hostLayout) {
|
|
339
|
+
const isAligner = alignedY(newPrimary, Align.centerY) ||
|
|
340
|
+
alignedY(newPrimary, Align.bottom);
|
|
341
|
+
isEffectiveAlignerY = isAligner && (hostLayout.alignerY === undefined ||
|
|
342
|
+
!alignedY(hostLayout.alignerY.alignment, Align.centerY));
|
|
343
|
+
if (hostLayout.alignerY === element) {
|
|
344
|
+
if (!isEffectiveAlignerY) {
|
|
345
|
+
hostCss.marginTop = "";
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
if (isEffectiveAlignerY) {
|
|
350
|
+
hostCss.marginTop = "auto";
|
|
351
|
+
hostLayout.alignerY = element;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
switch (newPrimary & 0b00111000) {
|
|
356
|
+
default:
|
|
357
|
+
case Align.top:
|
|
358
|
+
css.alignSelf = "start";
|
|
359
|
+
break;
|
|
360
|
+
case Align.centerY:
|
|
361
|
+
css.alignSelf = "center";
|
|
362
|
+
break;
|
|
363
|
+
case Align.bottom:
|
|
364
|
+
css.alignSelf = "end";
|
|
365
|
+
break;
|
|
366
|
+
case Align.stretchY:
|
|
367
|
+
css.alignSelf = "stretch";
|
|
368
|
+
break;
|
|
369
|
+
}
|
|
370
|
+
switch (newInside & 0b00111000) {
|
|
371
|
+
default:
|
|
372
|
+
case Align.top:
|
|
373
|
+
css.justifyContent = "start";
|
|
374
|
+
break;
|
|
375
|
+
case Align.centerY:
|
|
376
|
+
css.justifyContent = "center";
|
|
377
|
+
break;
|
|
378
|
+
case Align.bottom:
|
|
379
|
+
css.justifyContent = "end";
|
|
380
|
+
break;
|
|
381
|
+
case Align.stretchY:
|
|
382
|
+
css.justifyContent = "stretch";
|
|
383
|
+
break;
|
|
384
|
+
}
|
|
385
|
+
if (alignedX(newPrimary, Align.stretchX) && strengthX === undefined)
|
|
386
|
+
ElImpl.applyStretchingStrengthX(element, 0, 1);
|
|
387
|
+
if (alignedY(newPrimary, Align.stretchY) && strengthY === undefined)
|
|
388
|
+
ElImpl.applyStretchingStrengthY(element, 0, 1);
|
|
389
|
+
}
|
|
390
|
+
static applyStretchingStrengthX(element, existing, value) {
|
|
391
|
+
var _a;
|
|
392
|
+
const s = element.style;
|
|
393
|
+
const host = element.node.host;
|
|
394
|
+
if (host.driver.isPartition && element.splitView === undefined) {
|
|
395
|
+
const hostEl = host.element;
|
|
396
|
+
hostEl._stretchingStrengthX = value;
|
|
397
|
+
let delta = 0;
|
|
398
|
+
existing !== null && existing !== void 0 ? existing : (existing = 0);
|
|
399
|
+
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
|
+
}
|
|
416
|
+
value !== null && value !== void 0 ? value : (value = 0);
|
|
417
|
+
if (value > 0) {
|
|
418
|
+
s.flexGrow = `${value}`;
|
|
419
|
+
s.flexBasis = "0";
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
s.flexGrow = "";
|
|
423
|
+
s.flexBasis = "";
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
static applyStretchingStrengthY(element, existing, value) {
|
|
427
|
+
var _a;
|
|
428
|
+
const host = element.node.host;
|
|
429
|
+
if (host.driver.isPartition && element.splitView === undefined) {
|
|
430
|
+
const hostElement = host.element;
|
|
431
|
+
hostElement._stretchingStrengthY = value;
|
|
432
|
+
let delta = 0;
|
|
433
|
+
existing !== null && existing !== void 0 ? existing : (existing = 0);
|
|
434
|
+
value !== null && value !== void 0 ? value : (value = 0);
|
|
435
|
+
if (existing === 0) {
|
|
436
|
+
if (value !== 0)
|
|
437
|
+
delta = 1;
|
|
438
|
+
}
|
|
439
|
+
else if (value === 0) {
|
|
440
|
+
if (existing !== 0)
|
|
441
|
+
delta = -1;
|
|
442
|
+
}
|
|
443
|
+
if (delta !== 0) {
|
|
444
|
+
const count = (_a = hostElement._stretchingStrengthY) !== null && _a !== void 0 ? _a : 0 + delta;
|
|
445
|
+
const s = hostElement.style;
|
|
446
|
+
if (count === 1)
|
|
447
|
+
s.flexGrow = `${value}`;
|
|
448
|
+
else if (count === 0)
|
|
449
|
+
s.flexGrow = "";
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
static applyContentWrapping(element, value) {
|
|
454
|
+
const s = element.style;
|
|
455
|
+
if (value) {
|
|
456
|
+
s.flexFlow = "wrap";
|
|
457
|
+
s.overflow = "";
|
|
458
|
+
s.textOverflow = "";
|
|
459
|
+
s.whiteSpace = "";
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
s.flexFlow = "";
|
|
463
|
+
s.overflow = "hidden";
|
|
464
|
+
s.textOverflow = "ellipsis";
|
|
465
|
+
s.whiteSpace = "nowrap";
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
static applyOverlayVisible(element, value) {
|
|
469
|
+
const s = element.style;
|
|
470
|
+
const host = RxNode.findMatchingHost(element.node, n => n.element.native instanceof HTMLElement || n.element.native instanceof SVGElement);
|
|
471
|
+
const nativeHost = host === null || host === void 0 ? void 0 : host.element.native;
|
|
472
|
+
if (value === true) {
|
|
473
|
+
const doc = document.body;
|
|
474
|
+
const rect = nativeHost.getBoundingClientRect();
|
|
475
|
+
if (doc.offsetWidth - rect.left > rect.right)
|
|
476
|
+
s.left = "0", s.right = "";
|
|
477
|
+
else
|
|
478
|
+
s.left = "", s.right = "0";
|
|
479
|
+
if (doc.clientHeight - rect.top > rect.bottom)
|
|
480
|
+
s.top = "100%", s.bottom = "";
|
|
481
|
+
else
|
|
482
|
+
s.top = "", s.bottom = "100%";
|
|
483
|
+
s.display = "";
|
|
484
|
+
s.position = "absolute";
|
|
485
|
+
s.minWidth = "100%";
|
|
486
|
+
s.boxSizing = "border-box";
|
|
487
|
+
nativeHost.style.position = "relative";
|
|
488
|
+
}
|
|
489
|
+
else {
|
|
490
|
+
nativeHost.style.position = "";
|
|
491
|
+
if (value === false)
|
|
492
|
+
s.display = "none";
|
|
493
|
+
else
|
|
494
|
+
s.position = s.display = s.left = s.right = s.top = s.bottom = "";
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
static applySplitView(element, value) {
|
|
498
|
+
const e = element.native;
|
|
499
|
+
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
|
+
Transaction.separate(() => e.sensors.resize.observeResizing(element, value !== undefined));
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
static applyStylingPreset(element, secondary, styleName, enabled) {
|
|
522
|
+
const native = element.native;
|
|
523
|
+
enabled !== null && enabled !== void 0 ? enabled : (enabled = true);
|
|
524
|
+
if (secondary)
|
|
525
|
+
native.classList.toggle(styleName, enabled);
|
|
526
|
+
else
|
|
527
|
+
native.className = enabled ? styleName : "";
|
|
528
|
+
}
|
|
179
529
|
}
|
|
180
|
-
class ElLayoutInfo {
|
|
530
|
+
export class ElLayoutInfo {
|
|
181
531
|
constructor(prev) {
|
|
182
532
|
this.x = prev.x;
|
|
183
533
|
this.y = prev.y;
|
|
184
534
|
this.runningMaxX = prev.runningMaxX;
|
|
185
535
|
this.runningMaxY = prev.runningMaxY;
|
|
536
|
+
this.alignerX = undefined;
|
|
537
|
+
this.alignerY = undefined;
|
|
186
538
|
this.flags = prev.flags & ~ElLayoutInfoFlags.ownCursorPosition;
|
|
539
|
+
this.effectiveSizePx = 0;
|
|
540
|
+
this.offsetXpx = 0;
|
|
541
|
+
this.offsetYpx = 0;
|
|
542
|
+
this.containerSizeXpx = 0;
|
|
543
|
+
this.containerSizeYpx = 0;
|
|
187
544
|
}
|
|
188
545
|
}
|
|
189
546
|
var ElLayoutInfoFlags;
|
|
@@ -192,9 +549,10 @@ var ElLayoutInfoFlags;
|
|
|
192
549
|
ElLayoutInfoFlags[ElLayoutInfoFlags["ownCursorPosition"] = 1] = "ownCursorPosition";
|
|
193
550
|
ElLayoutInfoFlags[ElLayoutInfoFlags["usesRunningColumnCount"] = 2] = "usesRunningColumnCount";
|
|
194
551
|
ElLayoutInfoFlags[ElLayoutInfoFlags["usesRunningRowCount"] = 4] = "usesRunningRowCount";
|
|
552
|
+
ElLayoutInfoFlags[ElLayoutInfoFlags["childrenRelayoutIsNeeded"] = 8] = "childrenRelayoutIsNeeded";
|
|
195
553
|
})(ElLayoutInfoFlags || (ElLayoutInfoFlags = {}));
|
|
196
554
|
const UndefinedElCoords = Object.freeze({ x1: 0, y1: 0, x2: 0, y2: 0 });
|
|
197
|
-
const InitialElLayoutInfo = Object.freeze(new ElLayoutInfo({ x: 1, y: 1, runningMaxX: 0, runningMaxY: 0, flags: ElLayoutInfoFlags.none }));
|
|
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, containerSizeXpx: 0, containerSizeYpx: 0 }));
|
|
198
556
|
function getElCoordsAndAdjustLayoutInfo(isRegularElement, area, maxX, maxY, prevElLayoutInfo, layoutInfo) {
|
|
199
557
|
var _a, _b;
|
|
200
558
|
let result;
|
|
@@ -303,219 +661,89 @@ export class CursorCommandDriver extends ElDriver {
|
|
|
303
661
|
super("cursor", false, el => el.kind = ElKind.cursor);
|
|
304
662
|
}
|
|
305
663
|
}
|
|
306
|
-
export class Apply {
|
|
307
|
-
static kind(element, value) {
|
|
308
|
-
const kind = Constants.layouts[value];
|
|
309
|
-
kind && element.native.setAttribute(Constants.kindAttrName, kind);
|
|
310
|
-
VerstakDriversByLayout[value](element);
|
|
311
|
-
}
|
|
312
|
-
static coords(element, value) {
|
|
313
|
-
if (element.native instanceof HTMLElement) {
|
|
314
|
-
const s = element.native.style;
|
|
315
|
-
if (value) {
|
|
316
|
-
const x1 = value.x1 || 1;
|
|
317
|
-
const y1 = value.y1 || 1;
|
|
318
|
-
const x2 = value.x2 || x1;
|
|
319
|
-
const y2 = value.y2 || y1;
|
|
320
|
-
s.gridArea = `${y1} / ${x1} / span ${y2 - y1 + 1} / span ${x2 - x1 + 1}`;
|
|
321
|
-
}
|
|
322
|
-
else
|
|
323
|
-
s.gridArea = "";
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
static minWidth(element, value) {
|
|
327
|
-
if (element.native instanceof HTMLElement)
|
|
328
|
-
element.native.style.minWidth = `${value}`;
|
|
329
|
-
}
|
|
330
|
-
static maxWidth(element, value) {
|
|
331
|
-
if (element.native instanceof HTMLElement)
|
|
332
|
-
element.native.style.maxWidth = `${value}`;
|
|
333
|
-
}
|
|
334
|
-
static minHeight(element, value) {
|
|
335
|
-
if (element.native instanceof HTMLElement)
|
|
336
|
-
element.native.style.minHeight = `${value}`;
|
|
337
|
-
}
|
|
338
|
-
static maxHeight(element, value) {
|
|
339
|
-
if (element.native instanceof HTMLElement)
|
|
340
|
-
element.native.style.maxHeight = `${value}`;
|
|
341
|
-
}
|
|
342
|
-
static alignment(element, primary, extra, strengthX, strengthY) {
|
|
343
|
-
if (element.native instanceof HTMLElement) {
|
|
344
|
-
const s = element.native.style;
|
|
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];
|
|
352
|
-
}
|
|
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];
|
|
366
|
-
}
|
|
367
|
-
else {
|
|
368
|
-
v2 = v1;
|
|
369
|
-
h2 = h1;
|
|
370
|
-
t2 = t1;
|
|
371
|
-
}
|
|
372
|
-
s.justifyContent = v2;
|
|
373
|
-
s.alignItems = h2;
|
|
374
|
-
s.textAlign = t2;
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
static stretchingStrengthX(element, value) {
|
|
378
|
-
if (element.native instanceof HTMLElement) {
|
|
379
|
-
const s = element.native.style;
|
|
380
|
-
if (value > 0) {
|
|
381
|
-
s.flexGrow = `${value}`;
|
|
382
|
-
s.flexBasis = "0";
|
|
383
|
-
}
|
|
384
|
-
else {
|
|
385
|
-
s.flexGrow = "";
|
|
386
|
-
s.flexBasis = "";
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
static stretchingStrengthY(element, value) {
|
|
391
|
-
const bNode = element.node;
|
|
392
|
-
const driver = bNode.driver;
|
|
393
|
-
if (driver.isPartition) {
|
|
394
|
-
if (element.native instanceof HTMLElement) {
|
|
395
|
-
const s = element.native.style;
|
|
396
|
-
if (value > 0)
|
|
397
|
-
s.flexGrow = `${value}`;
|
|
398
|
-
else
|
|
399
|
-
s.flexGrow = "";
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
else {
|
|
403
|
-
const hostDriver = bNode.host.driver;
|
|
404
|
-
if (hostDriver.isPartition) {
|
|
405
|
-
const host = bNode.host.seat.instance;
|
|
406
|
-
Apply.alignment(host.element, Align.stretchHeight, Align.default, undefined, undefined);
|
|
407
|
-
Apply.stretchingStrengthY(host.element, value);
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
static contentWrapping(element, value) {
|
|
412
|
-
if (element.native instanceof HTMLElement) {
|
|
413
|
-
const s = element.native.style;
|
|
414
|
-
if (value) {
|
|
415
|
-
s.flexFlow = "wrap";
|
|
416
|
-
s.overflow = "";
|
|
417
|
-
s.textOverflow = "";
|
|
418
|
-
s.whiteSpace = "";
|
|
419
|
-
}
|
|
420
|
-
else {
|
|
421
|
-
s.flexFlow = "";
|
|
422
|
-
s.overflow = "hidden";
|
|
423
|
-
s.textOverflow = "ellipsis";
|
|
424
|
-
s.whiteSpace = "nowrap";
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
static overlayVisible(element, value) {
|
|
429
|
-
const e = element.native;
|
|
430
|
-
if (e instanceof HTMLElement) {
|
|
431
|
-
const s = e.style;
|
|
432
|
-
const host = RxNode.findMatchingHost(element.node, n => n.element.native instanceof HTMLElement || n.element.native instanceof SVGElement);
|
|
433
|
-
const nativeHost = host === null || host === void 0 ? void 0 : host.element.native;
|
|
434
|
-
if (value === true) {
|
|
435
|
-
const doc = document.body;
|
|
436
|
-
const rect = nativeHost.getBoundingClientRect();
|
|
437
|
-
if (doc.offsetWidth - rect.left > rect.right)
|
|
438
|
-
s.left = "0", s.right = "";
|
|
439
|
-
else
|
|
440
|
-
s.left = "", s.right = "0";
|
|
441
|
-
if (doc.clientHeight - rect.top > rect.bottom)
|
|
442
|
-
s.top = "100%", s.bottom = "";
|
|
443
|
-
else
|
|
444
|
-
s.top = "", s.bottom = "100%";
|
|
445
|
-
s.display = "";
|
|
446
|
-
s.position = "absolute";
|
|
447
|
-
s.minWidth = "100%";
|
|
448
|
-
s.boxSizing = "border-box";
|
|
449
|
-
nativeHost.style.position = "relative";
|
|
450
|
-
}
|
|
451
|
-
else {
|
|
452
|
-
nativeHost.style.position = "";
|
|
453
|
-
if (value === false)
|
|
454
|
-
s.display = "none";
|
|
455
|
-
else
|
|
456
|
-
s.position = s.display = s.left = s.right = s.top = s.bottom = "";
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
static stylingPreset(element, secondary, styleName, enabled) {
|
|
461
|
-
const native = element.native;
|
|
462
|
-
enabled !== null && enabled !== void 0 ? enabled : (enabled = true);
|
|
463
|
-
if (secondary)
|
|
464
|
-
native.classList.toggle(styleName, enabled);
|
|
465
|
-
else
|
|
466
|
-
native.className = enabled ? styleName : "";
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
664
|
export const Constants = {
|
|
470
665
|
element: "el",
|
|
471
666
|
partition: "part",
|
|
667
|
+
splitter: "splitter",
|
|
472
668
|
group: "group",
|
|
473
|
-
layouts: ["section", "table", "note", "group", "", ""],
|
|
669
|
+
layouts: ["section", "table", "note", "group", "", "", ""],
|
|
474
670
|
keyAttrName: "key",
|
|
475
671
|
kindAttrName: "kind",
|
|
476
672
|
};
|
|
477
673
|
const VerstakDriversByLayout = [
|
|
478
674
|
el => {
|
|
479
675
|
const owner = el.node.owner.element;
|
|
480
|
-
const s = el.
|
|
676
|
+
const s = el.style;
|
|
481
677
|
s.display = "flex";
|
|
482
678
|
s.flexDirection = "column";
|
|
483
679
|
s.alignSelf = owner.isTable ? "stretch" : "center";
|
|
484
680
|
s.textAlign = "initial";
|
|
485
681
|
s.flexShrink = "1";
|
|
486
682
|
s.minWidth = "0";
|
|
683
|
+
if (owner.splitView !== undefined) {
|
|
684
|
+
s.overflow = "hidden";
|
|
685
|
+
s.flexGrow = "1";
|
|
686
|
+
}
|
|
487
687
|
},
|
|
488
688
|
el => {
|
|
489
689
|
const owner = el.node.owner.element;
|
|
490
|
-
const s = el.
|
|
690
|
+
const s = el.style;
|
|
491
691
|
s.alignSelf = owner.isTable ? "stretch" : "center";
|
|
492
692
|
s.display = "grid";
|
|
493
693
|
s.flexBasis = "0";
|
|
494
694
|
s.gridAutoRows = "minmax(min-content, 1fr)";
|
|
495
695
|
s.gridAutoColumns = "minmax(min-content, 1fr)";
|
|
496
696
|
s.textAlign = "initial";
|
|
697
|
+
if (owner.splitView !== undefined) {
|
|
698
|
+
s.overflow = "hidden";
|
|
699
|
+
s.flexGrow = "1";
|
|
700
|
+
}
|
|
497
701
|
},
|
|
498
702
|
el => {
|
|
499
703
|
const owner = el.node.owner.element;
|
|
500
|
-
const s = el.
|
|
704
|
+
const s = el.style;
|
|
501
705
|
s.alignSelf = owner.isTable ? "stretch" : "center";
|
|
502
706
|
s.display = "inline-grid";
|
|
503
707
|
s.flexShrink = "1";
|
|
504
708
|
},
|
|
505
709
|
el => {
|
|
506
|
-
const s = el.
|
|
710
|
+
const s = el.style;
|
|
507
711
|
s.display = "contents";
|
|
508
712
|
},
|
|
509
713
|
el => {
|
|
510
714
|
const owner = el.node.owner.element;
|
|
511
|
-
const s = el.
|
|
715
|
+
const s = el.style;
|
|
512
716
|
s.display = owner.isTable ? "contents" : "flex";
|
|
513
717
|
s.flexDirection = "row";
|
|
718
|
+
s.gap = "inherit";
|
|
719
|
+
},
|
|
720
|
+
el => {
|
|
721
|
+
const s = el.style;
|
|
722
|
+
const owner = el.node.owner.element;
|
|
723
|
+
s.position = "absolute";
|
|
724
|
+
s.zIndex = `${Number.MAX_SAFE_INTEGER}`;
|
|
725
|
+
s.backgroundColor = "#00BB00";
|
|
726
|
+
if (owner.splitView === SplitView.horizontal) {
|
|
727
|
+
s.width = "4px";
|
|
728
|
+
s.marginLeft = "-2px";
|
|
729
|
+
s.top = s.bottom = "0";
|
|
730
|
+
s.cursor = "col-resize";
|
|
731
|
+
}
|
|
732
|
+
else {
|
|
733
|
+
s.height = "4px";
|
|
734
|
+
s.marginTop = "-2px";
|
|
735
|
+
s.left = s.right = "0";
|
|
736
|
+
s.cursor = "row-resize";
|
|
737
|
+
}
|
|
514
738
|
},
|
|
515
739
|
el => {
|
|
516
740
|
},
|
|
517
741
|
el => {
|
|
518
742
|
},
|
|
519
743
|
];
|
|
520
|
-
|
|
521
|
-
|
|
744
|
+
function alignedX(align, like) {
|
|
745
|
+
return (align & 0b00000011) == (like & 0b00000011);
|
|
746
|
+
}
|
|
747
|
+
function alignedY(align, like) {
|
|
748
|
+
return (align & 0b00011000) == (like & 0b00011000);
|
|
749
|
+
}
|