verstak 0.24.269 → 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 +48 -15
- package/build/dist/source/html/El.js +191 -93
- 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,8 +7,9 @@ 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) {
|
|
@@ -29,6 +25,16 @@ export var Align;
|
|
|
29
25
|
Align[Align["centerXY"] = 45] = "centerXY";
|
|
30
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,14 +46,15 @@ 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() {
|
|
@@ -89,59 +96,59 @@ export class ElImpl {
|
|
|
89
96
|
else
|
|
90
97
|
this.rowBreak();
|
|
91
98
|
}
|
|
92
|
-
get width() { return this._width; }
|
|
99
|
+
get width() { return this._width.raw; }
|
|
93
100
|
set width(value) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
ElImpl.applyMinWidth(this, (_a = value.min) !== null && _a !== void 0 ? _a : "");
|
|
99
|
-
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;
|
|
100
105
|
}
|
|
101
|
-
if (value.max !== w.max) {
|
|
102
|
-
ElImpl.applyMaxWidth(this, (_b = value.max) !== null && _b !== void 0 ? _b : "");
|
|
103
|
-
updated = true;
|
|
104
|
-
}
|
|
105
|
-
if (updated)
|
|
106
|
-
this._width = value;
|
|
107
106
|
}
|
|
108
|
-
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; }
|
|
109
116
|
set height(value) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
ElImpl.applyMinHeight(this, (_a = value.min) !== null && _a !== void 0 ? _a : "");
|
|
115
|
-
updated = true;
|
|
116
|
-
}
|
|
117
|
-
if (value.max !== w.max) {
|
|
118
|
-
ElImpl.applyMaxHeight(this, (_b = value.max) !== null && _b !== void 0 ? _b : "");
|
|
119
|
-
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;
|
|
120
121
|
}
|
|
121
|
-
|
|
122
|
-
|
|
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;
|
|
123
130
|
}
|
|
124
131
|
get alignment() { return this._alignment; }
|
|
125
132
|
set alignment(value) {
|
|
126
133
|
const existing = this._alignment;
|
|
127
134
|
if (value !== existing) {
|
|
128
|
-
ElImpl.applyAlignment(this, existing, value, this.
|
|
135
|
+
ElImpl.applyAlignment(this, existing, value, this._alignmentInside, this._alignmentInside, this._stretchingStrengthX, this._stretchingStrengthY);
|
|
129
136
|
this._alignment = value;
|
|
130
137
|
}
|
|
131
138
|
}
|
|
132
|
-
get
|
|
133
|
-
set
|
|
134
|
-
const existing = this.
|
|
139
|
+
get alignmentInside() { return this._alignmentInside; }
|
|
140
|
+
set alignmentInside(value) {
|
|
141
|
+
const existing = this._alignmentInside;
|
|
135
142
|
if (value !== existing) {
|
|
136
143
|
ElImpl.applyAlignment(this, this._alignment, this._alignment, existing, value, this._stretchingStrengthX, this._stretchingStrengthY);
|
|
137
|
-
this.
|
|
144
|
+
this._alignmentInside = value;
|
|
138
145
|
}
|
|
139
146
|
}
|
|
140
147
|
get stretchingStrengthX() { return this._stretchingStrengthX; }
|
|
141
148
|
set stretchingStrengthX(value) {
|
|
142
149
|
const existing = this._stretchingStrengthX;
|
|
143
150
|
if (value !== existing) {
|
|
144
|
-
ElImpl.applyStretchingStrengthX(this, existing
|
|
151
|
+
ElImpl.applyStretchingStrengthX(this, existing, value);
|
|
145
152
|
this._stretchingStrengthX = value;
|
|
146
153
|
}
|
|
147
154
|
}
|
|
@@ -149,7 +156,7 @@ export class ElImpl {
|
|
|
149
156
|
set stretchingStrengthY(value) {
|
|
150
157
|
const existing = this._stretchingStrengthY;
|
|
151
158
|
if (value !== existing) {
|
|
152
|
-
ElImpl.applyStretchingStrengthY(this, existing
|
|
159
|
+
ElImpl.applyStretchingStrengthY(this, existing, value);
|
|
153
160
|
this._stretchingStrengthY = value;
|
|
154
161
|
}
|
|
155
162
|
}
|
|
@@ -167,6 +174,13 @@ export class ElImpl {
|
|
|
167
174
|
this._overlayVisible = value;
|
|
168
175
|
}
|
|
169
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
|
+
}
|
|
170
184
|
get style() { return this.native.style; }
|
|
171
185
|
useStylingPreset(stylingPresetName, enabled) {
|
|
172
186
|
ElImpl.applyStylingPreset(this, this._hasStylingPresets, stylingPresetName, enabled);
|
|
@@ -177,6 +191,9 @@ export class ElImpl {
|
|
|
177
191
|
for (const child of this.node.children.items(after))
|
|
178
192
|
yield child.instance.element;
|
|
179
193
|
}
|
|
194
|
+
static *childrenOf(node, onlyAfter) {
|
|
195
|
+
return node.element.children(onlyAfter);
|
|
196
|
+
}
|
|
180
197
|
rowBreak() {
|
|
181
198
|
var _a, _b;
|
|
182
199
|
const node = this.node;
|
|
@@ -203,19 +220,33 @@ export class ElImpl {
|
|
|
203
220
|
else
|
|
204
221
|
s.gridArea = "";
|
|
205
222
|
}
|
|
206
|
-
static
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
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
|
+
}
|
|
214
235
|
}
|
|
215
|
-
static
|
|
216
|
-
|
|
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
|
+
}
|
|
217
248
|
}
|
|
218
|
-
static applyAlignment(element, oldPrimary, newPrimary,
|
|
249
|
+
static applyAlignment(element, oldPrimary, newPrimary, oldInside, newInside, strengthX, strengthY) {
|
|
219
250
|
var _a;
|
|
220
251
|
const css = element.style;
|
|
221
252
|
let hostLayout = undefined;
|
|
@@ -227,12 +258,12 @@ export class ElImpl {
|
|
|
227
258
|
if (hostLayout === undefined)
|
|
228
259
|
hostLayout = hostEl.layoutInfo = new ElLayoutInfo(InitialElLayoutInfo);
|
|
229
260
|
}
|
|
230
|
-
if (
|
|
231
|
-
|
|
261
|
+
if (newInside === Align.default)
|
|
262
|
+
newInside = newPrimary;
|
|
232
263
|
let isEffectiveAlignerX = false;
|
|
233
264
|
if (hostLayout) {
|
|
234
|
-
const isAligner =
|
|
235
|
-
|
|
265
|
+
const isAligner = alignedX(newPrimary, Align.centerX) ||
|
|
266
|
+
alignedX(newPrimary, Align.right);
|
|
236
267
|
isEffectiveAlignerX = isAligner && (hostLayout.alignerX === undefined ||
|
|
237
268
|
element.index <= hostLayout.alignerX.index);
|
|
238
269
|
if (hostLayout.alignerX === element) {
|
|
@@ -254,7 +285,7 @@ export class ElImpl {
|
|
|
254
285
|
default:
|
|
255
286
|
case Align.left:
|
|
256
287
|
css.justifySelf = "start";
|
|
257
|
-
if (
|
|
288
|
+
if (alignedX(oldPrimary, Align.centerX)) {
|
|
258
289
|
css.marginLeft = "";
|
|
259
290
|
css.marginRight = "";
|
|
260
291
|
}
|
|
@@ -271,20 +302,20 @@ export class ElImpl {
|
|
|
271
302
|
css.justifySelf = "end";
|
|
272
303
|
if (hostLayout)
|
|
273
304
|
css.marginLeft = isEffectiveAlignerX ? "auto" : "";
|
|
274
|
-
if (
|
|
305
|
+
if (alignedX(oldPrimary, Align.centerX))
|
|
275
306
|
css.marginRight = "";
|
|
276
307
|
break;
|
|
277
308
|
case Align.stretchX:
|
|
278
309
|
css.justifySelf = "stretch";
|
|
279
|
-
if (
|
|
310
|
+
if (alignedX(oldPrimary, Align.centerX)) {
|
|
280
311
|
css.marginLeft = "";
|
|
281
312
|
css.marginRight = "";
|
|
282
313
|
}
|
|
283
|
-
else if (
|
|
314
|
+
else if (alignedX(oldPrimary, Align.right))
|
|
284
315
|
css.marginLeft = "";
|
|
285
316
|
break;
|
|
286
317
|
}
|
|
287
|
-
switch (
|
|
318
|
+
switch (newInside & 0b00000111) {
|
|
288
319
|
default:
|
|
289
320
|
case Align.left:
|
|
290
321
|
css.alignItems = "start";
|
|
@@ -305,14 +336,13 @@ export class ElImpl {
|
|
|
305
336
|
}
|
|
306
337
|
let isEffectiveAlignerY = false;
|
|
307
338
|
if (hostLayout) {
|
|
308
|
-
const isAligner =
|
|
309
|
-
|
|
339
|
+
const isAligner = alignedY(newPrimary, Align.centerY) ||
|
|
340
|
+
alignedY(newPrimary, Align.bottom);
|
|
310
341
|
isEffectiveAlignerY = isAligner && (hostLayout.alignerY === undefined ||
|
|
311
|
-
!
|
|
342
|
+
!alignedY(hostLayout.alignerY.alignment, Align.centerY));
|
|
312
343
|
if (hostLayout.alignerY === element) {
|
|
313
344
|
if (!isEffectiveAlignerY) {
|
|
314
345
|
hostCss.marginTop = "";
|
|
315
|
-
throw new Error("changing alignment leader is not implemented yet");
|
|
316
346
|
}
|
|
317
347
|
}
|
|
318
348
|
else {
|
|
@@ -337,7 +367,7 @@ export class ElImpl {
|
|
|
337
367
|
css.alignSelf = "stretch";
|
|
338
368
|
break;
|
|
339
369
|
}
|
|
340
|
-
switch (
|
|
370
|
+
switch (newInside & 0b00111000) {
|
|
341
371
|
default:
|
|
342
372
|
case Align.top:
|
|
343
373
|
css.justifyContent = "start";
|
|
@@ -352,25 +382,21 @@ export class ElImpl {
|
|
|
352
382
|
css.justifyContent = "stretch";
|
|
353
383
|
break;
|
|
354
384
|
}
|
|
355
|
-
if (
|
|
385
|
+
if (alignedX(newPrimary, Align.stretchX) && strengthX === undefined)
|
|
356
386
|
ElImpl.applyStretchingStrengthX(element, 0, 1);
|
|
357
|
-
if (
|
|
387
|
+
if (alignedY(newPrimary, Align.stretchY) && strengthY === undefined)
|
|
358
388
|
ElImpl.applyStretchingStrengthY(element, 0, 1);
|
|
359
389
|
}
|
|
360
390
|
static applyStretchingStrengthX(element, existing, value) {
|
|
361
391
|
var _a;
|
|
362
392
|
const s = element.style;
|
|
363
|
-
if (value > 0) {
|
|
364
|
-
s.flexGrow = `${value}`;
|
|
365
|
-
s.flexBasis = "0";
|
|
366
|
-
}
|
|
367
|
-
else {
|
|
368
|
-
s.flexGrow = "";
|
|
369
|
-
s.flexBasis = "";
|
|
370
|
-
}
|
|
371
393
|
const host = element.node.host;
|
|
372
|
-
if (host.driver.isPartition) {
|
|
394
|
+
if (host.driver.isPartition && element.splitView === undefined) {
|
|
395
|
+
const hostEl = host.element;
|
|
396
|
+
hostEl._stretchingStrengthX = value;
|
|
373
397
|
let delta = 0;
|
|
398
|
+
existing !== null && existing !== void 0 ? existing : (existing = 0);
|
|
399
|
+
value !== null && value !== void 0 ? value : (value = 0);
|
|
374
400
|
if (existing === 0) {
|
|
375
401
|
if (value !== 0)
|
|
376
402
|
delta = 1;
|
|
@@ -380,7 +406,6 @@ export class ElImpl {
|
|
|
380
406
|
delta = -1;
|
|
381
407
|
}
|
|
382
408
|
if (delta !== 0) {
|
|
383
|
-
const hostEl = host.element;
|
|
384
409
|
const count = (_a = hostEl._stretchingStrengthX) !== null && _a !== void 0 ? _a : 0 + delta;
|
|
385
410
|
if (count === 1)
|
|
386
411
|
s.alignSelf = "stretch";
|
|
@@ -388,12 +413,25 @@ export class ElImpl {
|
|
|
388
413
|
s.alignSelf = "";
|
|
389
414
|
}
|
|
390
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
|
+
}
|
|
391
425
|
}
|
|
392
426
|
static applyStretchingStrengthY(element, existing, value) {
|
|
393
427
|
var _a;
|
|
394
428
|
const host = element.node.host;
|
|
395
|
-
if (host.driver.isPartition) {
|
|
429
|
+
if (host.driver.isPartition && element.splitView === undefined) {
|
|
430
|
+
const hostElement = host.element;
|
|
431
|
+
hostElement._stretchingStrengthY = value;
|
|
396
432
|
let delta = 0;
|
|
433
|
+
existing !== null && existing !== void 0 ? existing : (existing = 0);
|
|
434
|
+
value !== null && value !== void 0 ? value : (value = 0);
|
|
397
435
|
if (existing === 0) {
|
|
398
436
|
if (value !== 0)
|
|
399
437
|
delta = 1;
|
|
@@ -403,7 +441,6 @@ export class ElImpl {
|
|
|
403
441
|
delta = -1;
|
|
404
442
|
}
|
|
405
443
|
if (delta !== 0) {
|
|
406
|
-
const hostElement = host.element;
|
|
407
444
|
const count = (_a = hostElement._stretchingStrengthY) !== null && _a !== void 0 ? _a : 0 + delta;
|
|
408
445
|
const s = hostElement.style;
|
|
409
446
|
if (count === 1)
|
|
@@ -457,6 +494,30 @@ export class ElImpl {
|
|
|
457
494
|
s.position = s.display = s.left = s.right = s.top = s.bottom = "";
|
|
458
495
|
}
|
|
459
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
|
+
}
|
|
460
521
|
static applyStylingPreset(element, secondary, styleName, enabled) {
|
|
461
522
|
const native = element.native;
|
|
462
523
|
enabled !== null && enabled !== void 0 ? enabled : (enabled = true);
|
|
@@ -466,7 +527,7 @@ export class ElImpl {
|
|
|
466
527
|
native.className = enabled ? styleName : "";
|
|
467
528
|
}
|
|
468
529
|
}
|
|
469
|
-
class ElLayoutInfo {
|
|
530
|
+
export class ElLayoutInfo {
|
|
470
531
|
constructor(prev) {
|
|
471
532
|
this.x = prev.x;
|
|
472
533
|
this.y = prev.y;
|
|
@@ -475,6 +536,11 @@ class ElLayoutInfo {
|
|
|
475
536
|
this.alignerX = undefined;
|
|
476
537
|
this.alignerY = undefined;
|
|
477
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;
|
|
478
544
|
}
|
|
479
545
|
}
|
|
480
546
|
var ElLayoutInfoFlags;
|
|
@@ -483,9 +549,10 @@ var ElLayoutInfoFlags;
|
|
|
483
549
|
ElLayoutInfoFlags[ElLayoutInfoFlags["ownCursorPosition"] = 1] = "ownCursorPosition";
|
|
484
550
|
ElLayoutInfoFlags[ElLayoutInfoFlags["usesRunningColumnCount"] = 2] = "usesRunningColumnCount";
|
|
485
551
|
ElLayoutInfoFlags[ElLayoutInfoFlags["usesRunningRowCount"] = 4] = "usesRunningRowCount";
|
|
552
|
+
ElLayoutInfoFlags[ElLayoutInfoFlags["childrenRelayoutIsNeeded"] = 8] = "childrenRelayoutIsNeeded";
|
|
486
553
|
})(ElLayoutInfoFlags || (ElLayoutInfoFlags = {}));
|
|
487
554
|
const UndefinedElCoords = Object.freeze({ x1: 0, y1: 0, x2: 0, y2: 0 });
|
|
488
|
-
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 }));
|
|
489
556
|
function getElCoordsAndAdjustLayoutInfo(isRegularElement, area, maxX, maxY, prevElLayoutInfo, layoutInfo) {
|
|
490
557
|
var _a, _b;
|
|
491
558
|
let result;
|
|
@@ -597,55 +664,86 @@ export class CursorCommandDriver extends ElDriver {
|
|
|
597
664
|
export const Constants = {
|
|
598
665
|
element: "el",
|
|
599
666
|
partition: "part",
|
|
667
|
+
splitter: "splitter",
|
|
600
668
|
group: "group",
|
|
601
|
-
layouts: ["section", "table", "note", "group", "", ""],
|
|
669
|
+
layouts: ["section", "table", "note", "group", "", "", ""],
|
|
602
670
|
keyAttrName: "key",
|
|
603
671
|
kindAttrName: "kind",
|
|
604
672
|
};
|
|
605
673
|
const VerstakDriversByLayout = [
|
|
606
674
|
el => {
|
|
607
675
|
const owner = el.node.owner.element;
|
|
608
|
-
const s = el.
|
|
676
|
+
const s = el.style;
|
|
609
677
|
s.display = "flex";
|
|
610
678
|
s.flexDirection = "column";
|
|
611
679
|
s.alignSelf = owner.isTable ? "stretch" : "center";
|
|
612
680
|
s.textAlign = "initial";
|
|
613
681
|
s.flexShrink = "1";
|
|
614
682
|
s.minWidth = "0";
|
|
683
|
+
if (owner.splitView !== undefined) {
|
|
684
|
+
s.overflow = "hidden";
|
|
685
|
+
s.flexGrow = "1";
|
|
686
|
+
}
|
|
615
687
|
},
|
|
616
688
|
el => {
|
|
617
689
|
const owner = el.node.owner.element;
|
|
618
|
-
const s = el.
|
|
690
|
+
const s = el.style;
|
|
619
691
|
s.alignSelf = owner.isTable ? "stretch" : "center";
|
|
620
692
|
s.display = "grid";
|
|
621
693
|
s.flexBasis = "0";
|
|
622
694
|
s.gridAutoRows = "minmax(min-content, 1fr)";
|
|
623
695
|
s.gridAutoColumns = "minmax(min-content, 1fr)";
|
|
624
696
|
s.textAlign = "initial";
|
|
697
|
+
if (owner.splitView !== undefined) {
|
|
698
|
+
s.overflow = "hidden";
|
|
699
|
+
s.flexGrow = "1";
|
|
700
|
+
}
|
|
625
701
|
},
|
|
626
702
|
el => {
|
|
627
703
|
const owner = el.node.owner.element;
|
|
628
|
-
const s = el.
|
|
704
|
+
const s = el.style;
|
|
629
705
|
s.alignSelf = owner.isTable ? "stretch" : "center";
|
|
630
706
|
s.display = "inline-grid";
|
|
631
707
|
s.flexShrink = "1";
|
|
632
708
|
},
|
|
633
709
|
el => {
|
|
634
|
-
const s = el.
|
|
710
|
+
const s = el.style;
|
|
635
711
|
s.display = "contents";
|
|
636
712
|
},
|
|
637
713
|
el => {
|
|
638
714
|
const owner = el.node.owner.element;
|
|
639
|
-
const s = el.
|
|
715
|
+
const s = el.style;
|
|
640
716
|
s.display = owner.isTable ? "contents" : "flex";
|
|
641
717
|
s.flexDirection = "row";
|
|
642
718
|
s.gap = "inherit";
|
|
643
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
|
+
}
|
|
738
|
+
},
|
|
644
739
|
el => {
|
|
645
740
|
},
|
|
646
741
|
el => {
|
|
647
742
|
},
|
|
648
743
|
];
|
|
649
|
-
function
|
|
650
|
-
return (align &
|
|
744
|
+
function alignedX(align, like) {
|
|
745
|
+
return (align & 0b00000011) == (like & 0b00000011);
|
|
746
|
+
}
|
|
747
|
+
function alignedY(align, like) {
|
|
748
|
+
return (align & 0b00011000) == (like & 0b00011000);
|
|
651
749
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ElCoords } from "./El.js";
|
|
2
2
|
export declare function objectHasMember<T>(obj: any, member: string): obj is T;
|
|
3
|
+
export declare function clamp(value: number, min: number, max: number): number;
|
|
3
4
|
export declare function emitLetters(n: number): string;
|
|
4
5
|
export declare function parseElCoords(text: string, result: ElCoords): ElCoords;
|
|
5
6
|
export declare function emitElCoords(value: ElCoords): string;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export function objectHasMember(obj, member) {
|
|
2
2
|
return obj === Object(obj) && !Array.isArray(obj) && member in obj;
|
|
3
3
|
}
|
|
4
|
+
export function clamp(value, min, max) {
|
|
5
|
+
return Math.min(max, Math.max(min, value));
|
|
6
|
+
}
|
|
4
7
|
export function emitLetters(n) {
|
|
5
8
|
if (n < 0)
|
|
6
9
|
throw new Error(`emitLetters: argument (${n}) should not be negative or zero`);
|
|
@@ -1,15 +1,29 @@
|
|
|
1
|
-
import { RxNodeDecl, RxNode, Delegate } from "reactronic";
|
|
2
|
-
import { El, ElArea } from "./El.js";
|
|
3
|
-
import {
|
|
1
|
+
import { RxNodeDecl, RxNodeDriver, RxNode, Delegate, MergedItem } from "reactronic";
|
|
2
|
+
import { CursorCommandDriver, El, ElArea } from "./El.js";
|
|
3
|
+
import { HtmlDriver } from "./HtmlDriver.js";
|
|
4
4
|
export declare function Section<M = unknown>(declaration?: RxNodeDecl<El<HTMLElement, M>>, preset?: RxNodeDecl<El<HTMLElement, M>>): RxNode<El<HTMLElement, M>>;
|
|
5
5
|
export declare function Table<M = unknown, R = void>(declaration?: RxNodeDecl<El<HTMLElement, M>>, preset?: RxNodeDecl<El<HTMLElement, M>>): RxNode<El<HTMLElement, M>>;
|
|
6
6
|
export declare function row<T = void>(builder?: (element: void) => T, shiftCursorDown?: number): void;
|
|
7
|
+
export declare function Splitter<M = unknown, R = void>(declaration?: RxNodeDecl<El<HTMLElement, M>>, preset?: RxNodeDecl<El<HTMLElement, M>>): RxNode<El<HTMLElement, M>>;
|
|
7
8
|
export declare function rowBreak(shiftCursorDown?: number): void;
|
|
9
|
+
export declare function declareSplitter<T>(index: number, splitViewNode: RxNode<El<T>>): RxNode<El<HTMLElement>>;
|
|
8
10
|
export declare function cursor(areaParams: ElArea): void;
|
|
9
11
|
export declare function Note(content: string, formatted?: boolean, declaration?: RxNodeDecl<El<HTMLElement, void>>): RxNode<El<HTMLElement, void>>;
|
|
10
12
|
export declare function Group<M = unknown, R = void>(declaration?: RxNodeDecl<El<HTMLElement, M>>, preset?: RxNodeDecl<El<HTMLElement, M>>): RxNode<El<HTMLElement, M>>;
|
|
11
13
|
export declare function Handling<M = unknown>(onChange: Delegate<El<void, M>>): RxNode<El<void, M>>;
|
|
12
14
|
export declare function SyntheticElement<M = unknown>(declaration?: RxNodeDecl<El<void, M>>, preset?: RxNodeDecl<El<void, M>>): RxNode<El<void, M>>;
|
|
13
|
-
export declare class
|
|
15
|
+
export declare class SectionDriver<T extends HTMLElement> extends HtmlDriver<T> {
|
|
14
16
|
update(node: RxNode<El<T>>): void | Promise<void>;
|
|
17
|
+
child(ownerNode: RxNode<El<T, any>>, childDriver: RxNodeDriver<any>, childDeclaration?: RxNodeDecl<any> | undefined, childPreset?: RxNodeDecl<any> | undefined): MergedItem<RxNode> | undefined;
|
|
15
18
|
}
|
|
19
|
+
export declare function isSplitViewPartition(childDriver: RxNodeDriver): boolean;
|
|
20
|
+
export declare const Drivers: {
|
|
21
|
+
section: SectionDriver<HTMLElement>;
|
|
22
|
+
table: HtmlDriver<HTMLElement, any>;
|
|
23
|
+
note: HtmlDriver<HTMLElement, any>;
|
|
24
|
+
group: HtmlDriver<HTMLElement, any>;
|
|
25
|
+
partition: HtmlDriver<HTMLElement, any>;
|
|
26
|
+
splitter: HtmlDriver<HTMLElement, any>;
|
|
27
|
+
cursor: CursorCommandDriver;
|
|
28
|
+
synthetic: RxNodeDriver<El<void, any>>;
|
|
29
|
+
};
|