verstak 0.24.269 → 0.24.271
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 +89 -30
- package/build/dist/source/html/El.js +313 -132
- 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 +221 -16
- package/build/dist/source/html/Handlers.d.ts +1 -1
- 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 +27 -0
- package/build/dist/source/html/SplitViewMath.js +323 -0
- package/build/dist/source/html/api.d.ts +2 -0
- package/build/dist/source/html/api.js +2 -0
- 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.js +4 -0
- package/package.json +2 -2
|
@@ -1,10 +1,14 @@
|
|
|
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
|
-
export class ElDriver extends BaseDriver {
|
|
4
|
-
allocate(node) {
|
|
5
|
-
return new ElImpl(node);
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
12
|
export var ElKind;
|
|
9
13
|
(function (ElKind) {
|
|
10
14
|
ElKind[ElKind["section"] = 0] = "section";
|
|
@@ -12,23 +16,43 @@ export var ElKind;
|
|
|
12
16
|
ElKind[ElKind["note"] = 2] = "note";
|
|
13
17
|
ElKind[ElKind["group"] = 3] = "group";
|
|
14
18
|
ElKind[ElKind["part"] = 4] = "part";
|
|
15
|
-
ElKind[ElKind["
|
|
16
|
-
ElKind[ElKind["
|
|
19
|
+
ElKind[ElKind["splitter"] = 5] = "splitter";
|
|
20
|
+
ElKind[ElKind["cursor"] = 6] = "cursor";
|
|
21
|
+
ElKind[ElKind["native"] = 7] = "native";
|
|
17
22
|
})(ElKind || (ElKind = {}));
|
|
18
|
-
export var
|
|
19
|
-
(function (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
})(
|
|
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 SplitView;
|
|
38
|
+
(function (SplitView) {
|
|
39
|
+
SplitView[SplitView["horizontal"] = 0] = "horizontal";
|
|
40
|
+
SplitView[SplitView["vertical"] = 1] = "vertical";
|
|
41
|
+
})(SplitView || (SplitView = {}));
|
|
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
|
+
}
|
|
51
|
+
export class ElDriver extends BaseDriver {
|
|
52
|
+
allocate(node) {
|
|
53
|
+
return new ElImpl(node);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
32
56
|
export class ElImpl {
|
|
33
57
|
constructor(node) {
|
|
34
58
|
this.node = node;
|
|
@@ -40,14 +64,17 @@ export class ElImpl {
|
|
|
40
64
|
this._kind = ElKind.part;
|
|
41
65
|
this._area = undefined;
|
|
42
66
|
this._coords = UndefinedElCoords;
|
|
43
|
-
this._width =
|
|
44
|
-
this._height =
|
|
45
|
-
this._alignment =
|
|
46
|
-
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;
|
|
47
73
|
this._stretchingStrengthX = undefined;
|
|
48
74
|
this._stretchingStrengthY = undefined;
|
|
49
75
|
this._contentWrapping = true;
|
|
50
76
|
this._overlayVisible = undefined;
|
|
77
|
+
this._splitView = undefined;
|
|
51
78
|
this._hasStylingPresets = false;
|
|
52
79
|
}
|
|
53
80
|
prepareForUpdate() {
|
|
@@ -89,59 +116,89 @@ export class ElImpl {
|
|
|
89
116
|
else
|
|
90
117
|
this.rowBreak();
|
|
91
118
|
}
|
|
92
|
-
get width() { return this._width; }
|
|
119
|
+
get width() { return this._width.raw; }
|
|
93
120
|
set width(value) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
updated = true;
|
|
100
|
-
}
|
|
101
|
-
if (value.max !== w.max) {
|
|
102
|
-
ElImpl.applyMaxWidth(this, (_b = value.max) !== null && _b !== void 0 ? _b : "");
|
|
103
|
-
updated = true;
|
|
121
|
+
const w = this._width.raw;
|
|
122
|
+
if (value.min !== w.min || value.max !== w.max) {
|
|
123
|
+
ElImpl.applyWidth(this, value);
|
|
124
|
+
this._width.raw = value;
|
|
125
|
+
this._width.preferredUsed = false;
|
|
104
126
|
}
|
|
105
|
-
if (updated)
|
|
106
|
-
this._width = value;
|
|
107
127
|
}
|
|
108
|
-
get
|
|
128
|
+
get widthPx() { return this._width; }
|
|
129
|
+
set widthPx(value) {
|
|
130
|
+
const w = this._width;
|
|
131
|
+
if (value.minPx !== w.minPx)
|
|
132
|
+
this._width.minPx = value.minPx;
|
|
133
|
+
if (value.maxPx !== w.maxPx)
|
|
134
|
+
this._width.maxPx = value.maxPx;
|
|
135
|
+
}
|
|
136
|
+
get preferredWidthUsed() {
|
|
137
|
+
return this._width.preferredUsed;
|
|
138
|
+
}
|
|
139
|
+
set preferredWidthUsed(value) {
|
|
140
|
+
this._width.preferredUsed = value;
|
|
141
|
+
}
|
|
142
|
+
get height() { return this._height.raw; }
|
|
109
143
|
set height(value) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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;
|
|
144
|
+
const h = this._height.raw;
|
|
145
|
+
if (value.min !== h.min || value.max !== h.max) {
|
|
146
|
+
ElImpl.applyHeight(this, value);
|
|
147
|
+
this._height.raw = value;
|
|
148
|
+
this._height.preferredUsed = false;
|
|
120
149
|
}
|
|
121
|
-
|
|
122
|
-
|
|
150
|
+
}
|
|
151
|
+
get heightPx() { return this._height; }
|
|
152
|
+
set heightPx(value) {
|
|
153
|
+
const w = this._height;
|
|
154
|
+
if (value.minPx !== w.minPx)
|
|
155
|
+
this._height.minPx = value.minPx;
|
|
156
|
+
if (value.maxPx !== w.maxPx)
|
|
157
|
+
this._height.maxPx = value.maxPx;
|
|
158
|
+
}
|
|
159
|
+
get preferredHeightUsed() {
|
|
160
|
+
return this._height.preferredUsed;
|
|
161
|
+
}
|
|
162
|
+
set preferredHeightUsed(value) {
|
|
163
|
+
this._height.preferredUsed = value;
|
|
123
164
|
}
|
|
124
165
|
get alignment() { return this._alignment; }
|
|
125
166
|
set alignment(value) {
|
|
126
167
|
const existing = this._alignment;
|
|
127
168
|
if (value !== existing) {
|
|
128
|
-
ElImpl.applyAlignment(this, existing, value, this.
|
|
169
|
+
ElImpl.applyAlignment(this, existing, value, this._alignmentInside, this._alignmentInside, this._stretchingStrengthX);
|
|
129
170
|
this._alignment = value;
|
|
130
171
|
}
|
|
131
172
|
}
|
|
132
|
-
get
|
|
133
|
-
set
|
|
134
|
-
const existing = this.
|
|
173
|
+
get verticalAlignment() { return this._verticalAlignment; }
|
|
174
|
+
set verticalAlignment(value) {
|
|
175
|
+
const existing = this._verticalAlignment;
|
|
176
|
+
if (value !== existing) {
|
|
177
|
+
ElImpl.applyVerticalAlignment(this, existing, value, this._verticalAlignmentInside, this._verticalAlignmentInside, this._stretchingStrengthY);
|
|
178
|
+
this._verticalAlignment = value;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
get alignmentInside() { return this._alignmentInside; }
|
|
182
|
+
set alignmentInside(value) {
|
|
183
|
+
const existing = this._alignmentInside;
|
|
184
|
+
if (value !== existing) {
|
|
185
|
+
ElImpl.applyAlignment(this, this._alignment, this._alignment, existing, value, this._stretchingStrengthX);
|
|
186
|
+
this._alignmentInside = value;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
get verticalAlignmentInside() { return this._verticalAlignmentInside; }
|
|
190
|
+
set verticalAlignmentInside(value) {
|
|
191
|
+
const existing = this._verticalAlignmentInside;
|
|
135
192
|
if (value !== existing) {
|
|
136
|
-
ElImpl.
|
|
137
|
-
this.
|
|
193
|
+
ElImpl.applyVerticalAlignment(this, this._verticalAlignment, this._verticalAlignment, existing, value, this._stretchingStrengthY);
|
|
194
|
+
this._verticalAlignmentInside = value;
|
|
138
195
|
}
|
|
139
196
|
}
|
|
140
197
|
get stretchingStrengthX() { return this._stretchingStrengthX; }
|
|
141
198
|
set stretchingStrengthX(value) {
|
|
142
199
|
const existing = this._stretchingStrengthX;
|
|
143
200
|
if (value !== existing) {
|
|
144
|
-
ElImpl.applyStretchingStrengthX(this, existing
|
|
201
|
+
ElImpl.applyStretchingStrengthX(this, existing, value);
|
|
145
202
|
this._stretchingStrengthX = value;
|
|
146
203
|
}
|
|
147
204
|
}
|
|
@@ -149,7 +206,7 @@ export class ElImpl {
|
|
|
149
206
|
set stretchingStrengthY(value) {
|
|
150
207
|
const existing = this._stretchingStrengthY;
|
|
151
208
|
if (value !== existing) {
|
|
152
|
-
ElImpl.applyStretchingStrengthY(this, existing
|
|
209
|
+
ElImpl.applyStretchingStrengthY(this, existing, value);
|
|
153
210
|
this._stretchingStrengthY = value;
|
|
154
211
|
}
|
|
155
212
|
}
|
|
@@ -167,6 +224,19 @@ export class ElImpl {
|
|
|
167
224
|
this._overlayVisible = value;
|
|
168
225
|
}
|
|
169
226
|
}
|
|
227
|
+
get splitView() { return this._splitView; }
|
|
228
|
+
set splitView(value) {
|
|
229
|
+
if (value !== this._splitView) {
|
|
230
|
+
ElImpl.applySplitView(this, value);
|
|
231
|
+
this._splitView = value;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
get partitionSizeInSplitViewPx() {
|
|
235
|
+
var _a;
|
|
236
|
+
if (this.layoutInfo === undefined)
|
|
237
|
+
this.layoutInfo = new ElLayoutInfo(InitialElLayoutInfo);
|
|
238
|
+
return (_a = this.layoutInfo.effectiveSizePx) !== null && _a !== void 0 ? _a : 0;
|
|
239
|
+
}
|
|
170
240
|
get style() { return this.native.style; }
|
|
171
241
|
useStylingPreset(stylingPresetName, enabled) {
|
|
172
242
|
ElImpl.applyStylingPreset(this, this._hasStylingPresets, stylingPresetName, enabled);
|
|
@@ -177,6 +247,9 @@ export class ElImpl {
|
|
|
177
247
|
for (const child of this.node.children.items(after))
|
|
178
248
|
yield child.instance.element;
|
|
179
249
|
}
|
|
250
|
+
static *childrenOf(node, onlyAfter) {
|
|
251
|
+
return node.element.children(onlyAfter);
|
|
252
|
+
}
|
|
180
253
|
rowBreak() {
|
|
181
254
|
var _a, _b;
|
|
182
255
|
const node = this.node;
|
|
@@ -203,36 +276,50 @@ export class ElImpl {
|
|
|
203
276
|
else
|
|
204
277
|
s.gridArea = "";
|
|
205
278
|
}
|
|
206
|
-
static
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
279
|
+
static applyWidth(element, value) {
|
|
280
|
+
var _a, _b;
|
|
281
|
+
const s = element.style;
|
|
282
|
+
const node = element.node;
|
|
283
|
+
const owner = node.owner;
|
|
284
|
+
const ownerEl = owner.element;
|
|
285
|
+
if (ownerEl.splitView === SplitView.horizontal) {
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
s.minWidth = (_a = value.min) !== null && _a !== void 0 ? _a : "";
|
|
289
|
+
s.maxWidth = (_b = value.max) !== null && _b !== void 0 ? _b : "";
|
|
290
|
+
}
|
|
214
291
|
}
|
|
215
|
-
static
|
|
216
|
-
|
|
292
|
+
static applyHeight(element, value) {
|
|
293
|
+
var _a, _b;
|
|
294
|
+
const s = element.style;
|
|
295
|
+
const node = element.node;
|
|
296
|
+
const owner = node.owner;
|
|
297
|
+
const ownerEl = owner.element;
|
|
298
|
+
if (ownerEl.splitView === SplitView.vertical) {
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
s.minHeight = (_a = value.min) !== null && _a !== void 0 ? _a : "";
|
|
302
|
+
s.maxHeight = (_b = value.max) !== null && _b !== void 0 ? _b : "";
|
|
303
|
+
}
|
|
217
304
|
}
|
|
218
|
-
static applyAlignment(element, oldPrimary, newPrimary,
|
|
305
|
+
static applyAlignment(element, oldPrimary, newPrimary, oldInside, newInside, strength) {
|
|
219
306
|
var _a;
|
|
307
|
+
oldPrimary !== null && oldPrimary !== void 0 ? oldPrimary : (oldPrimary = Alignment.left);
|
|
308
|
+
newPrimary !== null && newPrimary !== void 0 ? newPrimary : (newPrimary = Alignment.left);
|
|
309
|
+
oldInside !== null && oldInside !== void 0 ? oldInside : (oldInside = oldPrimary);
|
|
310
|
+
newInside !== null && newInside !== void 0 ? newInside : (newInside = newPrimary);
|
|
220
311
|
const css = element.style;
|
|
221
312
|
let hostLayout = undefined;
|
|
222
|
-
let hostCss = undefined;
|
|
223
313
|
if (element.node.host.driver.isPartition) {
|
|
224
314
|
const hostEl = element.node.host.element;
|
|
225
|
-
hostCss = hostEl.style;
|
|
226
315
|
hostLayout = hostEl.layoutInfo;
|
|
227
316
|
if (hostLayout === undefined)
|
|
228
317
|
hostLayout = hostEl.layoutInfo = new ElLayoutInfo(InitialElLayoutInfo);
|
|
229
318
|
}
|
|
230
|
-
if (newExtra === Align.default)
|
|
231
|
-
newExtra = newPrimary;
|
|
232
319
|
let isEffectiveAlignerX = false;
|
|
233
320
|
if (hostLayout) {
|
|
234
|
-
const isAligner =
|
|
235
|
-
|
|
321
|
+
const isAligner = newPrimary === Alignment.center ||
|
|
322
|
+
newPrimary === Alignment.right;
|
|
236
323
|
isEffectiveAlignerX = isAligner && (hostLayout.alignerX === undefined ||
|
|
237
324
|
element.index <= hostLayout.alignerX.index);
|
|
238
325
|
if (hostLayout.alignerX === element) {
|
|
@@ -250,69 +337,86 @@ export class ElImpl {
|
|
|
250
337
|
}
|
|
251
338
|
}
|
|
252
339
|
}
|
|
253
|
-
switch (newPrimary
|
|
340
|
+
switch (newPrimary) {
|
|
254
341
|
default:
|
|
255
|
-
case
|
|
342
|
+
case Alignment.left:
|
|
256
343
|
css.justifySelf = "start";
|
|
257
|
-
if (
|
|
344
|
+
if (oldPrimary === Alignment.center) {
|
|
258
345
|
css.marginLeft = "";
|
|
259
346
|
css.marginRight = "";
|
|
260
347
|
}
|
|
261
|
-
else if (
|
|
348
|
+
else if (oldPrimary === Alignment.right)
|
|
262
349
|
css.marginLeft = "";
|
|
263
350
|
break;
|
|
264
|
-
case
|
|
351
|
+
case Alignment.center:
|
|
265
352
|
css.justifySelf = "center";
|
|
266
353
|
if (hostLayout)
|
|
267
354
|
css.marginLeft = isEffectiveAlignerX ? "auto" : "";
|
|
268
355
|
css.marginRight = "auto";
|
|
269
356
|
break;
|
|
270
|
-
case
|
|
357
|
+
case Alignment.right:
|
|
271
358
|
css.justifySelf = "end";
|
|
272
359
|
if (hostLayout)
|
|
273
360
|
css.marginLeft = isEffectiveAlignerX ? "auto" : "";
|
|
274
|
-
if (
|
|
361
|
+
if (oldPrimary === Alignment.center)
|
|
275
362
|
css.marginRight = "";
|
|
276
363
|
break;
|
|
277
|
-
case
|
|
364
|
+
case Alignment.stretch:
|
|
278
365
|
css.justifySelf = "stretch";
|
|
279
|
-
if (
|
|
366
|
+
if (oldPrimary === Alignment.center) {
|
|
280
367
|
css.marginLeft = "";
|
|
281
368
|
css.marginRight = "";
|
|
282
369
|
}
|
|
283
|
-
else if (
|
|
370
|
+
else if (oldPrimary === Alignment.right)
|
|
284
371
|
css.marginLeft = "";
|
|
285
372
|
break;
|
|
286
373
|
}
|
|
287
|
-
switch (
|
|
374
|
+
switch (newInside) {
|
|
288
375
|
default:
|
|
289
|
-
case
|
|
376
|
+
case Alignment.left:
|
|
290
377
|
css.alignItems = "start";
|
|
291
378
|
css.textAlign = "left";
|
|
292
379
|
break;
|
|
293
|
-
case
|
|
380
|
+
case Alignment.center:
|
|
294
381
|
css.alignItems = "center";
|
|
295
382
|
css.textAlign = "center";
|
|
296
383
|
break;
|
|
297
|
-
case
|
|
384
|
+
case Alignment.right:
|
|
298
385
|
css.alignItems = "end";
|
|
299
386
|
css.textAlign = "right";
|
|
300
387
|
break;
|
|
301
|
-
case
|
|
388
|
+
case Alignment.stretch:
|
|
302
389
|
css.alignItems = "stretch";
|
|
303
390
|
css.textAlign = "justify";
|
|
304
391
|
break;
|
|
305
392
|
}
|
|
393
|
+
if (newPrimary === Alignment.stretch && strength === undefined)
|
|
394
|
+
ElImpl.applyStretchingStrengthX(element, 0, 1);
|
|
395
|
+
}
|
|
396
|
+
static applyVerticalAlignment(element, oldPrimary, newPrimary, oldInside, newInside, strength) {
|
|
397
|
+
oldPrimary !== null && oldPrimary !== void 0 ? oldPrimary : (oldPrimary = VerticalAlignment.top);
|
|
398
|
+
newPrimary !== null && newPrimary !== void 0 ? newPrimary : (newPrimary = VerticalAlignment.top);
|
|
399
|
+
oldInside !== null && oldInside !== void 0 ? oldInside : (oldInside = oldPrimary);
|
|
400
|
+
newInside !== null && newInside !== void 0 ? newInside : (newInside = newPrimary);
|
|
401
|
+
const css = element.style;
|
|
402
|
+
let hostLayout = undefined;
|
|
403
|
+
let hostCss = undefined;
|
|
404
|
+
if (element.node.host.driver.isPartition) {
|
|
405
|
+
const hostEl = element.node.host.element;
|
|
406
|
+
hostCss = hostEl.style;
|
|
407
|
+
hostLayout = hostEl.layoutInfo;
|
|
408
|
+
if (hostLayout === undefined)
|
|
409
|
+
hostLayout = hostEl.layoutInfo = new ElLayoutInfo(InitialElLayoutInfo);
|
|
410
|
+
}
|
|
306
411
|
let isEffectiveAlignerY = false;
|
|
307
412
|
if (hostLayout) {
|
|
308
|
-
const isAligner =
|
|
309
|
-
|
|
413
|
+
const isAligner = newPrimary === VerticalAlignment.center ||
|
|
414
|
+
newPrimary === VerticalAlignment.bottom;
|
|
310
415
|
isEffectiveAlignerY = isAligner && (hostLayout.alignerY === undefined ||
|
|
311
|
-
|
|
416
|
+
hostLayout.alignerY.verticalAlignment !== VerticalAlignment.center);
|
|
312
417
|
if (hostLayout.alignerY === element) {
|
|
313
418
|
if (!isEffectiveAlignerY) {
|
|
314
419
|
hostCss.marginTop = "";
|
|
315
|
-
throw new Error("changing alignment leader is not implemented yet");
|
|
316
420
|
}
|
|
317
421
|
}
|
|
318
422
|
else {
|
|
@@ -322,55 +426,49 @@ export class ElImpl {
|
|
|
322
426
|
}
|
|
323
427
|
}
|
|
324
428
|
}
|
|
325
|
-
switch (newPrimary
|
|
429
|
+
switch (newPrimary) {
|
|
326
430
|
default:
|
|
327
|
-
case
|
|
431
|
+
case VerticalAlignment.top:
|
|
328
432
|
css.alignSelf = "start";
|
|
329
433
|
break;
|
|
330
|
-
case
|
|
434
|
+
case VerticalAlignment.center:
|
|
331
435
|
css.alignSelf = "center";
|
|
332
436
|
break;
|
|
333
|
-
case
|
|
437
|
+
case VerticalAlignment.bottom:
|
|
334
438
|
css.alignSelf = "end";
|
|
335
439
|
break;
|
|
336
|
-
case
|
|
440
|
+
case VerticalAlignment.stretch:
|
|
337
441
|
css.alignSelf = "stretch";
|
|
338
442
|
break;
|
|
339
443
|
}
|
|
340
|
-
switch (
|
|
444
|
+
switch (newInside) {
|
|
341
445
|
default:
|
|
342
|
-
case
|
|
446
|
+
case VerticalAlignment.top:
|
|
343
447
|
css.justifyContent = "start";
|
|
344
448
|
break;
|
|
345
|
-
case
|
|
449
|
+
case VerticalAlignment.center:
|
|
346
450
|
css.justifyContent = "center";
|
|
347
451
|
break;
|
|
348
|
-
case
|
|
452
|
+
case VerticalAlignment.bottom:
|
|
349
453
|
css.justifyContent = "end";
|
|
350
454
|
break;
|
|
351
|
-
case
|
|
455
|
+
case VerticalAlignment.stretch:
|
|
352
456
|
css.justifyContent = "stretch";
|
|
353
457
|
break;
|
|
354
458
|
}
|
|
355
|
-
if (
|
|
356
|
-
ElImpl.applyStretchingStrengthX(element, 0, 1);
|
|
357
|
-
if (alignIs(newPrimary, Align.stretchY) && strengthY === undefined)
|
|
459
|
+
if (newPrimary === VerticalAlignment.stretch && strength === undefined)
|
|
358
460
|
ElImpl.applyStretchingStrengthY(element, 0, 1);
|
|
359
461
|
}
|
|
360
462
|
static applyStretchingStrengthX(element, existing, value) {
|
|
361
463
|
var _a;
|
|
362
464
|
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
465
|
const host = element.node.host;
|
|
372
|
-
if (host.driver.isPartition) {
|
|
466
|
+
if (host.driver.isPartition && element.splitView === undefined) {
|
|
467
|
+
const hostEl = host.element;
|
|
468
|
+
hostEl._stretchingStrengthX = value;
|
|
373
469
|
let delta = 0;
|
|
470
|
+
existing !== null && existing !== void 0 ? existing : (existing = 0);
|
|
471
|
+
value !== null && value !== void 0 ? value : (value = 0);
|
|
374
472
|
if (existing === 0) {
|
|
375
473
|
if (value !== 0)
|
|
376
474
|
delta = 1;
|
|
@@ -380,7 +478,6 @@ export class ElImpl {
|
|
|
380
478
|
delta = -1;
|
|
381
479
|
}
|
|
382
480
|
if (delta !== 0) {
|
|
383
|
-
const hostEl = host.element;
|
|
384
481
|
const count = (_a = hostEl._stretchingStrengthX) !== null && _a !== void 0 ? _a : 0 + delta;
|
|
385
482
|
if (count === 1)
|
|
386
483
|
s.alignSelf = "stretch";
|
|
@@ -388,12 +485,25 @@ export class ElImpl {
|
|
|
388
485
|
s.alignSelf = "";
|
|
389
486
|
}
|
|
390
487
|
}
|
|
488
|
+
value !== null && value !== void 0 ? value : (value = 0);
|
|
489
|
+
if (value > 0) {
|
|
490
|
+
s.flexGrow = `${value}`;
|
|
491
|
+
s.flexBasis = "0";
|
|
492
|
+
}
|
|
493
|
+
else {
|
|
494
|
+
s.flexGrow = "";
|
|
495
|
+
s.flexBasis = "";
|
|
496
|
+
}
|
|
391
497
|
}
|
|
392
498
|
static applyStretchingStrengthY(element, existing, value) {
|
|
393
499
|
var _a;
|
|
394
500
|
const host = element.node.host;
|
|
395
|
-
if (host.driver.isPartition) {
|
|
501
|
+
if (host.driver.isPartition && element.splitView === undefined) {
|
|
502
|
+
const hostElement = host.element;
|
|
503
|
+
hostElement._stretchingStrengthY = value;
|
|
396
504
|
let delta = 0;
|
|
505
|
+
existing !== null && existing !== void 0 ? existing : (existing = 0);
|
|
506
|
+
value !== null && value !== void 0 ? value : (value = 0);
|
|
397
507
|
if (existing === 0) {
|
|
398
508
|
if (value !== 0)
|
|
399
509
|
delta = 1;
|
|
@@ -403,7 +513,6 @@ export class ElImpl {
|
|
|
403
513
|
delta = -1;
|
|
404
514
|
}
|
|
405
515
|
if (delta !== 0) {
|
|
406
|
-
const hostElement = host.element;
|
|
407
516
|
const count = (_a = hostElement._stretchingStrengthY) !== null && _a !== void 0 ? _a : 0 + delta;
|
|
408
517
|
const s = hostElement.style;
|
|
409
518
|
if (count === 1)
|
|
@@ -457,6 +566,13 @@ export class ElImpl {
|
|
|
457
566
|
s.position = s.display = s.left = s.right = s.top = s.bottom = "";
|
|
458
567
|
}
|
|
459
568
|
}
|
|
569
|
+
static applySplitView(element, value) {
|
|
570
|
+
const e = element.native;
|
|
571
|
+
if (e instanceof HTMLElement) {
|
|
572
|
+
e.style.position = value !== undefined ? "relative" : "";
|
|
573
|
+
Transaction.separate(() => e.sensors.resize.observeResizing(element, value !== undefined));
|
|
574
|
+
}
|
|
575
|
+
}
|
|
460
576
|
static applyStylingPreset(element, secondary, styleName, enabled) {
|
|
461
577
|
const native = element.native;
|
|
462
578
|
enabled !== null && enabled !== void 0 ? enabled : (enabled = true);
|
|
@@ -466,7 +582,7 @@ export class ElImpl {
|
|
|
466
582
|
native.className = enabled ? styleName : "";
|
|
467
583
|
}
|
|
468
584
|
}
|
|
469
|
-
class ElLayoutInfo {
|
|
585
|
+
export class ElLayoutInfo {
|
|
470
586
|
constructor(prev) {
|
|
471
587
|
this.x = prev.x;
|
|
472
588
|
this.y = prev.y;
|
|
@@ -475,17 +591,58 @@ class ElLayoutInfo {
|
|
|
475
591
|
this.alignerX = undefined;
|
|
476
592
|
this.alignerY = undefined;
|
|
477
593
|
this.flags = prev.flags & ~ElLayoutInfoFlags.ownCursorPosition;
|
|
594
|
+
this.effectiveSizePx = 0;
|
|
595
|
+
this.offsetXpx = 0;
|
|
596
|
+
this.offsetYpx = 0;
|
|
597
|
+
this.contentSizeXpx = 0;
|
|
598
|
+
this.contentSizeYpx = 0;
|
|
599
|
+
this.borderSizeXpx = 0;
|
|
600
|
+
this.borderSizeYpx = 0;
|
|
601
|
+
this.isConstrained = false;
|
|
478
602
|
}
|
|
479
603
|
}
|
|
604
|
+
__decorate([
|
|
605
|
+
obs,
|
|
606
|
+
__metadata("design:type", Number)
|
|
607
|
+
], ElLayoutInfo.prototype, "effectiveSizePx", void 0);
|
|
608
|
+
__decorate([
|
|
609
|
+
obs,
|
|
610
|
+
__metadata("design:type", Number)
|
|
611
|
+
], ElLayoutInfo.prototype, "offsetXpx", void 0);
|
|
612
|
+
__decorate([
|
|
613
|
+
obs,
|
|
614
|
+
__metadata("design:type", Number)
|
|
615
|
+
], ElLayoutInfo.prototype, "offsetYpx", void 0);
|
|
616
|
+
__decorate([
|
|
617
|
+
obs,
|
|
618
|
+
__metadata("design:type", Number)
|
|
619
|
+
], ElLayoutInfo.prototype, "contentSizeXpx", void 0);
|
|
620
|
+
__decorate([
|
|
621
|
+
obs,
|
|
622
|
+
__metadata("design:type", Number)
|
|
623
|
+
], ElLayoutInfo.prototype, "contentSizeYpx", void 0);
|
|
624
|
+
__decorate([
|
|
625
|
+
obs,
|
|
626
|
+
__metadata("design:type", Number)
|
|
627
|
+
], ElLayoutInfo.prototype, "borderSizeYpx", void 0);
|
|
628
|
+
__decorate([
|
|
629
|
+
obs,
|
|
630
|
+
__metadata("design:type", Number)
|
|
631
|
+
], ElLayoutInfo.prototype, "borderSizeXpx", void 0);
|
|
632
|
+
__decorate([
|
|
633
|
+
obs,
|
|
634
|
+
__metadata("design:type", Boolean)
|
|
635
|
+
], ElLayoutInfo.prototype, "isConstrained", void 0);
|
|
480
636
|
var ElLayoutInfoFlags;
|
|
481
637
|
(function (ElLayoutInfoFlags) {
|
|
482
638
|
ElLayoutInfoFlags[ElLayoutInfoFlags["none"] = 0] = "none";
|
|
483
639
|
ElLayoutInfoFlags[ElLayoutInfoFlags["ownCursorPosition"] = 1] = "ownCursorPosition";
|
|
484
640
|
ElLayoutInfoFlags[ElLayoutInfoFlags["usesRunningColumnCount"] = 2] = "usesRunningColumnCount";
|
|
485
641
|
ElLayoutInfoFlags[ElLayoutInfoFlags["usesRunningRowCount"] = 4] = "usesRunningRowCount";
|
|
642
|
+
ElLayoutInfoFlags[ElLayoutInfoFlags["childrenRelayoutIsNeeded"] = 8] = "childrenRelayoutIsNeeded";
|
|
486
643
|
})(ElLayoutInfoFlags || (ElLayoutInfoFlags = {}));
|
|
487
644
|
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 }));
|
|
645
|
+
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 }));
|
|
489
646
|
function getElCoordsAndAdjustLayoutInfo(isRegularElement, area, maxX, maxY, prevElLayoutInfo, layoutInfo) {
|
|
490
647
|
var _a, _b;
|
|
491
648
|
let result;
|
|
@@ -597,55 +754,79 @@ export class CursorCommandDriver extends ElDriver {
|
|
|
597
754
|
export const Constants = {
|
|
598
755
|
element: "el",
|
|
599
756
|
partition: "part",
|
|
757
|
+
splitter: "splitter",
|
|
600
758
|
group: "group",
|
|
601
|
-
layouts: ["section", "table", "note", "group", "", ""],
|
|
759
|
+
layouts: ["section", "table", "note", "group", "", "", ""],
|
|
602
760
|
keyAttrName: "key",
|
|
603
761
|
kindAttrName: "kind",
|
|
604
762
|
};
|
|
605
763
|
const VerstakDriversByLayout = [
|
|
606
764
|
el => {
|
|
607
765
|
const owner = el.node.owner.element;
|
|
608
|
-
const s = el.
|
|
766
|
+
const s = el.style;
|
|
609
767
|
s.display = "flex";
|
|
610
768
|
s.flexDirection = "column";
|
|
611
769
|
s.alignSelf = owner.isTable ? "stretch" : "center";
|
|
612
770
|
s.textAlign = "initial";
|
|
613
771
|
s.flexShrink = "1";
|
|
614
772
|
s.minWidth = "0";
|
|
773
|
+
if (owner.splitView !== undefined) {
|
|
774
|
+
s.overflow = "hidden";
|
|
775
|
+
s.flexGrow = "1";
|
|
776
|
+
}
|
|
615
777
|
},
|
|
616
778
|
el => {
|
|
617
779
|
const owner = el.node.owner.element;
|
|
618
|
-
const s = el.
|
|
780
|
+
const s = el.style;
|
|
619
781
|
s.alignSelf = owner.isTable ? "stretch" : "center";
|
|
620
782
|
s.display = "grid";
|
|
621
783
|
s.flexBasis = "0";
|
|
622
784
|
s.gridAutoRows = "minmax(min-content, 1fr)";
|
|
623
785
|
s.gridAutoColumns = "minmax(min-content, 1fr)";
|
|
624
786
|
s.textAlign = "initial";
|
|
787
|
+
if (owner.splitView !== undefined) {
|
|
788
|
+
s.overflow = "hidden";
|
|
789
|
+
s.flexGrow = "1";
|
|
790
|
+
}
|
|
625
791
|
},
|
|
626
792
|
el => {
|
|
627
793
|
const owner = el.node.owner.element;
|
|
628
|
-
const s = el.
|
|
794
|
+
const s = el.style;
|
|
629
795
|
s.alignSelf = owner.isTable ? "stretch" : "center";
|
|
630
796
|
s.display = "inline-grid";
|
|
631
797
|
s.flexShrink = "1";
|
|
632
798
|
},
|
|
633
799
|
el => {
|
|
634
|
-
const s = el.
|
|
800
|
+
const s = el.style;
|
|
635
801
|
s.display = "contents";
|
|
636
802
|
},
|
|
637
803
|
el => {
|
|
638
804
|
const owner = el.node.owner.element;
|
|
639
|
-
const s = el.
|
|
805
|
+
const s = el.style;
|
|
640
806
|
s.display = owner.isTable ? "contents" : "flex";
|
|
641
807
|
s.flexDirection = "row";
|
|
642
808
|
s.gap = "inherit";
|
|
643
809
|
},
|
|
810
|
+
el => {
|
|
811
|
+
const s = el.style;
|
|
812
|
+
const owner = el.node.owner.element;
|
|
813
|
+
s.position = "absolute";
|
|
814
|
+
s.zIndex = `${Number.MAX_SAFE_INTEGER}`;
|
|
815
|
+
if (owner.splitView === SplitView.horizontal) {
|
|
816
|
+
s.width = "4px";
|
|
817
|
+
s.marginLeft = "-2px";
|
|
818
|
+
s.top = s.bottom = "0";
|
|
819
|
+
s.cursor = "col-resize";
|
|
820
|
+
}
|
|
821
|
+
else {
|
|
822
|
+
s.height = "4px";
|
|
823
|
+
s.marginTop = "-2px";
|
|
824
|
+
s.left = s.right = "0";
|
|
825
|
+
s.cursor = "row-resize";
|
|
826
|
+
}
|
|
827
|
+
},
|
|
644
828
|
el => {
|
|
645
829
|
},
|
|
646
830
|
el => {
|
|
647
831
|
},
|
|
648
832
|
];
|
|
649
|
-
function alignIs(align, like) {
|
|
650
|
-
return (align & like) == like;
|
|
651
|
-
}
|