verstak 0.24.271 → 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 +10 -5
- package/build/dist/source/html/El.js +27 -30
- 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 +65 -57
- package/build/dist/source/html/Handlers.js +2 -0
- package/build/dist/source/html/SplitViewMath.js +5 -5
- 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/PointerSensor.d.ts +1 -2
- package/build/dist/source/html/sensors/PointerSensor.js +2 -2
- package/package.json +1 -1
|
@@ -16,7 +16,8 @@ export type El<T = any, M = any> = {
|
|
|
16
16
|
stretchingStrengthY: number | undefined;
|
|
17
17
|
contentWrapping: boolean;
|
|
18
18
|
overlayVisible: boolean | undefined;
|
|
19
|
-
|
|
19
|
+
sealed: Direction | undefined;
|
|
20
|
+
splitView: Direction | undefined;
|
|
20
21
|
widthPx: {
|
|
21
22
|
minPx: number;
|
|
22
23
|
maxPx: number;
|
|
@@ -69,7 +70,7 @@ export type ElArea = undefined | string | {
|
|
|
69
70
|
cellsOverWidth?: number;
|
|
70
71
|
cellsOverHeight?: number;
|
|
71
72
|
};
|
|
72
|
-
export declare enum
|
|
73
|
+
export declare enum Direction {
|
|
73
74
|
horizontal = 0,
|
|
74
75
|
vertical = 1
|
|
75
76
|
}
|
|
@@ -96,6 +97,7 @@ export declare class ElImpl<T extends Element = any, M = any> implements El<T, M
|
|
|
96
97
|
private _stretchingStrengthY;
|
|
97
98
|
private _contentWrapping;
|
|
98
99
|
private _overlayVisible;
|
|
100
|
+
private _sealed;
|
|
99
101
|
private _splitView;
|
|
100
102
|
private _hasStylingPresets;
|
|
101
103
|
constructor(node: RxNode<El<T, M>>);
|
|
@@ -148,8 +150,10 @@ export declare class ElImpl<T extends Element = any, M = any> implements El<T, M
|
|
|
148
150
|
set contentWrapping(value: boolean);
|
|
149
151
|
get overlayVisible(): boolean | undefined;
|
|
150
152
|
set overlayVisible(value: boolean | undefined);
|
|
151
|
-
get
|
|
152
|
-
set
|
|
153
|
+
get sealed(): Direction | undefined;
|
|
154
|
+
set sealed(value: Direction | undefined);
|
|
155
|
+
get splitView(): Direction | undefined;
|
|
156
|
+
set splitView(value: Direction | undefined);
|
|
153
157
|
get partitionSizeInSplitViewPx(): number;
|
|
154
158
|
get style(): CSSStyleDeclaration;
|
|
155
159
|
useStylingPreset(stylingPresetName: string, enabled?: boolean): void;
|
|
@@ -166,7 +170,8 @@ export declare class ElImpl<T extends Element = any, M = any> implements El<T, M
|
|
|
166
170
|
private static applyStretchingStrengthY;
|
|
167
171
|
private static applyContentWrapping;
|
|
168
172
|
private static applyOverlayVisible;
|
|
169
|
-
static
|
|
173
|
+
static applySealed<T extends Element>(element: El<T, any>, value: Direction | undefined): void;
|
|
174
|
+
static applySplitView<T extends Element>(element: El<T, any>, value: Direction | undefined): void;
|
|
170
175
|
private static applyStylingPreset;
|
|
171
176
|
}
|
|
172
177
|
export declare class ElLayoutInfo {
|
|
@@ -34,11 +34,11 @@ export var VerticalAlignment;
|
|
|
34
34
|
VerticalAlignment[VerticalAlignment["bottom"] = 2] = "bottom";
|
|
35
35
|
VerticalAlignment[VerticalAlignment["stretch"] = 3] = "stretch";
|
|
36
36
|
})(VerticalAlignment || (VerticalAlignment = {}));
|
|
37
|
-
export var
|
|
38
|
-
(function (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
})(
|
|
37
|
+
export var Direction;
|
|
38
|
+
(function (Direction) {
|
|
39
|
+
Direction[Direction["horizontal"] = 0] = "horizontal";
|
|
40
|
+
Direction[Direction["vertical"] = 1] = "vertical";
|
|
41
|
+
})(Direction || (Direction = {}));
|
|
42
42
|
class Size extends ObservableObject {
|
|
43
43
|
constructor() {
|
|
44
44
|
super();
|
|
@@ -74,6 +74,7 @@ export class ElImpl {
|
|
|
74
74
|
this._stretchingStrengthY = undefined;
|
|
75
75
|
this._contentWrapping = true;
|
|
76
76
|
this._overlayVisible = undefined;
|
|
77
|
+
this._sealed = undefined;
|
|
77
78
|
this._splitView = undefined;
|
|
78
79
|
this._hasStylingPresets = false;
|
|
79
80
|
}
|
|
@@ -224,6 +225,13 @@ export class ElImpl {
|
|
|
224
225
|
this._overlayVisible = value;
|
|
225
226
|
}
|
|
226
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
|
+
}
|
|
227
235
|
get splitView() { return this._splitView; }
|
|
228
236
|
set splitView(value) {
|
|
229
237
|
if (value !== this._splitView) {
|
|
@@ -282,7 +290,7 @@ export class ElImpl {
|
|
|
282
290
|
const node = element.node;
|
|
283
291
|
const owner = node.owner;
|
|
284
292
|
const ownerEl = owner.element;
|
|
285
|
-
if (ownerEl.splitView ===
|
|
293
|
+
if (ownerEl.splitView === Direction.horizontal) {
|
|
286
294
|
}
|
|
287
295
|
else {
|
|
288
296
|
s.minWidth = (_a = value.min) !== null && _a !== void 0 ? _a : "";
|
|
@@ -295,7 +303,7 @@ export class ElImpl {
|
|
|
295
303
|
const node = element.node;
|
|
296
304
|
const owner = node.owner;
|
|
297
305
|
const ownerEl = owner.element;
|
|
298
|
-
if (ownerEl.splitView ===
|
|
306
|
+
if (ownerEl.splitView === Direction.vertical) {
|
|
299
307
|
}
|
|
300
308
|
else {
|
|
301
309
|
s.minHeight = (_a = value.min) !== null && _a !== void 0 ? _a : "";
|
|
@@ -303,7 +311,7 @@ export class ElImpl {
|
|
|
303
311
|
}
|
|
304
312
|
}
|
|
305
313
|
static applyAlignment(element, oldPrimary, newPrimary, oldInside, newInside, strength) {
|
|
306
|
-
var _a;
|
|
314
|
+
var _a, _b;
|
|
307
315
|
oldPrimary !== null && oldPrimary !== void 0 ? oldPrimary : (oldPrimary = Alignment.left);
|
|
308
316
|
newPrimary !== null && newPrimary !== void 0 ? newPrimary : (newPrimary = Alignment.left);
|
|
309
317
|
oldInside !== null && oldInside !== void 0 ? oldInside : (oldInside = oldPrimary);
|
|
@@ -330,7 +338,7 @@ export class ElImpl {
|
|
|
330
338
|
}
|
|
331
339
|
else {
|
|
332
340
|
if (isEffectiveAlignerX) {
|
|
333
|
-
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;
|
|
334
342
|
if (existingAlignerCss)
|
|
335
343
|
existingAlignerCss.marginLeft = "";
|
|
336
344
|
hostLayout.alignerX = element;
|
|
@@ -460,30 +468,13 @@ export class ElImpl {
|
|
|
460
468
|
ElImpl.applyStretchingStrengthY(element, 0, 1);
|
|
461
469
|
}
|
|
462
470
|
static applyStretchingStrengthX(element, existing, value) {
|
|
463
|
-
var _a;
|
|
464
471
|
const s = element.style;
|
|
465
472
|
const host = element.node.host;
|
|
466
|
-
if (host.driver.isPartition
|
|
473
|
+
if (host.driver.isPartition) {
|
|
467
474
|
const hostEl = host.element;
|
|
468
475
|
hostEl._stretchingStrengthX = value;
|
|
469
|
-
let delta = 0;
|
|
470
476
|
existing !== null && existing !== void 0 ? existing : (existing = 0);
|
|
471
477
|
value !== null && value !== void 0 ? value : (value = 0);
|
|
472
|
-
if (existing === 0) {
|
|
473
|
-
if (value !== 0)
|
|
474
|
-
delta = 1;
|
|
475
|
-
}
|
|
476
|
-
else if (value === 0) {
|
|
477
|
-
if (existing !== 0)
|
|
478
|
-
delta = -1;
|
|
479
|
-
}
|
|
480
|
-
if (delta !== 0) {
|
|
481
|
-
const count = (_a = hostEl._stretchingStrengthX) !== null && _a !== void 0 ? _a : 0 + delta;
|
|
482
|
-
if (count === 1)
|
|
483
|
-
s.alignSelf = "stretch";
|
|
484
|
-
else if (count === 0)
|
|
485
|
-
s.alignSelf = "";
|
|
486
|
-
}
|
|
487
478
|
}
|
|
488
479
|
value !== null && value !== void 0 ? value : (value = 0);
|
|
489
480
|
if (value > 0) {
|
|
@@ -498,7 +489,7 @@ export class ElImpl {
|
|
|
498
489
|
static applyStretchingStrengthY(element, existing, value) {
|
|
499
490
|
var _a;
|
|
500
491
|
const host = element.node.host;
|
|
501
|
-
if (host.driver.isPartition
|
|
492
|
+
if (host.driver.isPartition) {
|
|
502
493
|
const hostElement = host.element;
|
|
503
494
|
hostElement._stretchingStrengthY = value;
|
|
504
495
|
let delta = 0;
|
|
@@ -566,11 +557,17 @@ export class ElImpl {
|
|
|
566
557
|
s.position = s.display = s.left = s.right = s.top = s.bottom = "";
|
|
567
558
|
}
|
|
568
559
|
}
|
|
560
|
+
static applySealed(element, value) {
|
|
561
|
+
const e = element.native;
|
|
562
|
+
if (e instanceof HTMLElement) {
|
|
563
|
+
Transaction.separate(() => e.sensors.resize.observeResizing(element, value !== undefined));
|
|
564
|
+
}
|
|
565
|
+
}
|
|
569
566
|
static applySplitView(element, value) {
|
|
570
567
|
const e = element.native;
|
|
571
568
|
if (e instanceof HTMLElement) {
|
|
569
|
+
element.sealed = value;
|
|
572
570
|
e.style.position = value !== undefined ? "relative" : "";
|
|
573
|
-
Transaction.separate(() => e.sensors.resize.observeResizing(element, value !== undefined));
|
|
574
571
|
}
|
|
575
572
|
}
|
|
576
573
|
static applyStylingPreset(element, secondary, styleName, enabled) {
|
|
@@ -812,7 +809,7 @@ const VerstakDriversByLayout = [
|
|
|
812
809
|
const owner = el.node.owner.element;
|
|
813
810
|
s.position = "absolute";
|
|
814
811
|
s.zIndex = `${Number.MAX_SAFE_INTEGER}`;
|
|
815
|
-
if (owner.splitView ===
|
|
812
|
+
if (owner.splitView === Direction.horizontal) {
|
|
816
813
|
s.width = "4px";
|
|
817
814
|
s.marginLeft = "-2px";
|
|
818
815
|
s.top = s.bottom = "0";
|
|
@@ -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
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RxNode, Mode, unobs } from "reactronic";
|
|
2
|
-
import { Constants, CursorCommandDriver, ElKind, ElDriver,
|
|
2
|
+
import { Constants, CursorCommandDriver, ElKind, ElDriver, Direction, ElLayoutInfo, InitialElLayoutInfo } from "./El.js";
|
|
3
3
|
import { getPrioritiesForEmptySpaceDistribution, getPrioritiesForSizeChanging, relayout, relayoutUsingSplitter } from "./SplitViewMath.js";
|
|
4
4
|
import { Axis, BodyFontSize, Dimension, toPx } from "./Sizes.js";
|
|
5
5
|
import { HtmlDriver } from "./HtmlDriver.js";
|
|
@@ -49,7 +49,7 @@ export function declareSplitter(index, splitViewNode) {
|
|
|
49
49
|
if (pointer.draggingOver) {
|
|
50
50
|
pointer.dropAllowed = true;
|
|
51
51
|
const initialSizesPx = pointer.getData();
|
|
52
|
-
const deltaPx = Math.floor(splitViewNode.element.splitView ===
|
|
52
|
+
const deltaPx = Math.floor(splitViewNode.element.splitView === Direction.horizontal
|
|
53
53
|
? pointer.positionX - pointer.startX : pointer.positionY - pointer.startY);
|
|
54
54
|
const clonedSizesPx = [];
|
|
55
55
|
for (const item of initialSizesPx) {
|
|
@@ -113,11 +113,12 @@ export class SectionDriver extends HtmlDriver {
|
|
|
113
113
|
rowBreak();
|
|
114
114
|
const result = super.update(node);
|
|
115
115
|
const el = node.element;
|
|
116
|
-
if (el.
|
|
116
|
+
if (el.sealed !== undefined) {
|
|
117
117
|
Handling(h => {
|
|
118
118
|
var _a, _b;
|
|
119
119
|
const native = el.native;
|
|
120
120
|
const resize = native.sensors.resize;
|
|
121
|
+
const isHorizontal = el.sealed === Direction.horizontal;
|
|
121
122
|
for (const x of resize.resizedElements) {
|
|
122
123
|
if (el.layoutInfo === undefined)
|
|
123
124
|
el.layoutInfo = new ElLayoutInfo(InitialElLayoutInfo);
|
|
@@ -131,7 +132,6 @@ export class SectionDriver extends HtmlDriver {
|
|
|
131
132
|
el.layoutInfo.contentSizeYpx = containerSizeYpx;
|
|
132
133
|
el.layoutInfo.borderSizeXpx = x.borderBoxSize[0].inlineSize;
|
|
133
134
|
el.layoutInfo.borderSizeYpx = x.borderBoxSize[0].blockSize;
|
|
134
|
-
const isHorizontal = el.splitView === SplitView.horizontal;
|
|
135
135
|
const wrapper = (_a = node.children.firstMergedItem()) === null || _a === void 0 ? void 0 : _a.instance;
|
|
136
136
|
if (wrapper !== undefined) {
|
|
137
137
|
const wrapperEl = wrapper.element;
|
|
@@ -143,7 +143,6 @@ export class SectionDriver extends HtmlDriver {
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
if (h.node.stamp === 1) {
|
|
146
|
-
const isHorizontal = el.splitView === SplitView.horizontal;
|
|
147
146
|
const wrapper = (_b = node.children.firstMergedItem()) === null || _b === void 0 ? void 0 : _b.instance;
|
|
148
147
|
if (wrapper !== undefined) {
|
|
149
148
|
const wrapperEl = wrapper.element;
|
|
@@ -154,57 +153,63 @@ export class SectionDriver extends HtmlDriver {
|
|
|
154
153
|
}
|
|
155
154
|
}
|
|
156
155
|
});
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
const
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
partEl.
|
|
185
|
-
|
|
186
|
-
let preferredPx = 0;
|
|
187
|
-
if (!preferredUsed) {
|
|
188
|
-
preferredPx = size.preferred ? toPx(Dimension.parse(size.preferred), options) : 0;
|
|
189
|
-
if (preferredPx > 0) {
|
|
190
|
-
partEl.layoutInfo.effectiveSizePx = preferredPx;
|
|
191
|
-
preferred.push(i);
|
|
192
|
-
}
|
|
156
|
+
}
|
|
157
|
+
if (el.splitView !== undefined) {
|
|
158
|
+
SyntheticElement({
|
|
159
|
+
mode: Mode.independentUpdate,
|
|
160
|
+
triggers: { count: el.node.stamp },
|
|
161
|
+
onChange: () => {
|
|
162
|
+
const native = el.native;
|
|
163
|
+
const isHorizontal = el.splitView === Direction.horizontal;
|
|
164
|
+
if (el.layoutInfo === undefined)
|
|
165
|
+
el.layoutInfo = new ElLayoutInfo(InitialElLayoutInfo);
|
|
166
|
+
if (el.layoutInfo.isConstrained) {
|
|
167
|
+
const surroundingXpx = el.layoutInfo.borderSizeXpx - el.layoutInfo.contentSizeXpx;
|
|
168
|
+
const surroundingYpx = el.layoutInfo.borderSizeYpx - el.layoutInfo.contentSizeYpx;
|
|
169
|
+
let i = 0;
|
|
170
|
+
const preferred = [];
|
|
171
|
+
const sizesPx = [];
|
|
172
|
+
for (const child of node.children.items()) {
|
|
173
|
+
const partEl = child.instance.element;
|
|
174
|
+
if (isSplitViewPartition(child.instance.driver) && partEl !== undefined) {
|
|
175
|
+
const size = isHorizontal ? partEl.width : partEl.height;
|
|
176
|
+
const options = {
|
|
177
|
+
axis: isHorizontal ? Axis.X : Axis.Y, lineSizePx: BodyFontSize, fontSizePx: BodyFontSize,
|
|
178
|
+
containerSizeXpx: native.scrollWidth - surroundingXpx, containerSizeYpx: native.scrollHeight - surroundingYpx,
|
|
179
|
+
};
|
|
180
|
+
const minPx = size.min ? toPx(Dimension.parse(size.min), options) : 0;
|
|
181
|
+
let maxPx = size.max ? toPx(Dimension.parse(size.max), options) : Number.POSITIVE_INFINITY;
|
|
182
|
+
maxPx = Math.max(minPx, maxPx);
|
|
183
|
+
if (partEl.layoutInfo === undefined)
|
|
184
|
+
partEl.layoutInfo = new ElLayoutInfo(InitialElLayoutInfo);
|
|
193
185
|
if (isHorizontal)
|
|
194
|
-
partEl.
|
|
186
|
+
partEl.widthPx = { minPx, maxPx };
|
|
195
187
|
else
|
|
196
|
-
partEl.
|
|
188
|
+
partEl.heightPx = { minPx, maxPx };
|
|
189
|
+
const preferredUsed = isHorizontal ? partEl.preferredWidthUsed : partEl.preferredHeightUsed;
|
|
190
|
+
let preferredPx = 0;
|
|
191
|
+
if (!preferredUsed) {
|
|
192
|
+
preferredPx = size.preferred ? toPx(Dimension.parse(size.preferred), options) : 0;
|
|
193
|
+
if (preferredPx > 0) {
|
|
194
|
+
partEl.layoutInfo.effectiveSizePx = preferredPx;
|
|
195
|
+
preferred.push(i);
|
|
196
|
+
}
|
|
197
|
+
if (isHorizontal)
|
|
198
|
+
partEl.preferredWidthUsed = true;
|
|
199
|
+
else
|
|
200
|
+
partEl.preferredHeightUsed = true;
|
|
201
|
+
}
|
|
202
|
+
const sizePx = partEl.layoutInfo.effectiveSizePx = clamp(partEl.layoutInfo.effectiveSizePx, minPx, maxPx);
|
|
203
|
+
sizesPx.push({ node: child.instance, sizePx });
|
|
204
|
+
i++;
|
|
197
205
|
}
|
|
198
|
-
const sizePx = partEl.layoutInfo.effectiveSizePx = clamp(partEl.layoutInfo.effectiveSizePx, minPx, maxPx);
|
|
199
|
-
sizesPx.push({ node: child.instance, sizePx });
|
|
200
|
-
i++;
|
|
201
206
|
}
|
|
207
|
+
const priorities = preferred.length > 0
|
|
208
|
+
? getPrioritiesForSizeChanging(isHorizontal, node.children, preferred)
|
|
209
|
+
: getPrioritiesForEmptySpaceDistribution(isHorizontal, node.children);
|
|
210
|
+
unobs(() => relayout(node, priorities.resizable, priorities.manuallyResizable, sizesPx));
|
|
202
211
|
}
|
|
203
|
-
|
|
204
|
-
? getPrioritiesForSizeChanging(isHorizontal, node.children, preferred)
|
|
205
|
-
: getPrioritiesForEmptySpaceDistribution(isHorizontal, node.children);
|
|
206
|
-
unobs(() => relayout(node, priorities.resizable, priorities.manuallyResizable, sizesPx));
|
|
207
|
-
}
|
|
212
|
+
},
|
|
208
213
|
});
|
|
209
214
|
}
|
|
210
215
|
return result;
|
|
@@ -220,9 +225,12 @@ export class SectionDriver extends HtmlDriver {
|
|
|
220
225
|
if (isSplitViewPartition(child.instance.driver))
|
|
221
226
|
partCount++;
|
|
222
227
|
}
|
|
223
|
-
const isHorizontal = el.splitView ===
|
|
228
|
+
const isHorizontal = el.splitView === Direction.horizontal;
|
|
224
229
|
if (childDeclaration !== undefined) {
|
|
225
|
-
|
|
230
|
+
if (childDeclaration.triggers === undefined)
|
|
231
|
+
childDeclaration.triggers = {};
|
|
232
|
+
Object.defineProperty(childDeclaration.triggers, "index", { value: partCount });
|
|
233
|
+
overrideMethod(childDeclaration, "onChange", el => {
|
|
226
234
|
if (isHorizontal)
|
|
227
235
|
el.style.gridColumn = `${partCount + 1}`;
|
|
228
236
|
else
|
|
@@ -246,10 +254,10 @@ export class SectionDriver extends HtmlDriver {
|
|
|
246
254
|
export function isSplitViewPartition(childDriver) {
|
|
247
255
|
return !childDriver.isPartition && childDriver !== Drivers.splitter && childDriver !== Drivers.synthetic;
|
|
248
256
|
}
|
|
249
|
-
function
|
|
250
|
-
const
|
|
251
|
-
declaration
|
|
252
|
-
? (el, base) => {
|
|
257
|
+
function overrideMethod(declaration, method, func) {
|
|
258
|
+
const baseOnChange = declaration[method];
|
|
259
|
+
declaration[method] = baseOnChange !== undefined
|
|
260
|
+
? (el, base) => { baseOnChange(el, base); func(el); }
|
|
253
261
|
: (el, base) => { base(); func(el); };
|
|
254
262
|
}
|
|
255
263
|
export const Drivers = {
|
|
@@ -44,6 +44,8 @@ export function OnFocus(target, model, switchEditMode = undefined, key) {
|
|
|
44
44
|
el.node.configureReactronic({ throttling: 0 });
|
|
45
45
|
},
|
|
46
46
|
onChange: el => {
|
|
47
|
+
if (switchEditMode === undefined && !target.hasAttribute("tabindex"))
|
|
48
|
+
console.warn(`"${key !== null && key !== void 0 ? key : "noname"}" element must have "tabindex" attribute set in order to be focusable`);
|
|
47
49
|
if (switchEditMode !== undefined) {
|
|
48
50
|
switchEditMode(model);
|
|
49
51
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ElLayoutInfo, InitialElLayoutInfo,
|
|
1
|
+
import { ElLayoutInfo, InitialElLayoutInfo, Direction } from "./El.js";
|
|
2
2
|
import { Drivers, isSplitViewPartition } from "./Elements.js";
|
|
3
3
|
import { clamp } from "./ElUtils.js";
|
|
4
4
|
const DEBUG = false;
|
|
@@ -17,7 +17,7 @@ export function relayoutUsingSplitter(splitViewNode, deltaPx, index, initialSize
|
|
|
17
17
|
if (priorities === undefined) {
|
|
18
18
|
priorities = getPrioritiesForSplitter(index + 1, initialSizesPx.length);
|
|
19
19
|
}
|
|
20
|
-
const containerSizePx = splitViewNode.element.splitView ===
|
|
20
|
+
const containerSizePx = splitViewNode.element.splitView === Direction.horizontal
|
|
21
21
|
? (_b = (_a = splitViewNode.element.layoutInfo) === null || _a === void 0 ? void 0 : _a.contentSizeXpx) !== null && _b !== void 0 ? _b : 0
|
|
22
22
|
: (_d = (_c = splitViewNode.element.layoutInfo) === null || _c === void 0 ? void 0 : _c.contentSizeYpx) !== null && _d !== void 0 ? _d : 0;
|
|
23
23
|
DEBUG && console.log(`(splitter) delta = ${deltaPx}, container = ${containerSizePx}, size = ${initialSizesPx.reduce((p, c) => p + c.sizePx, 0)}, index = ${index}`);
|
|
@@ -26,7 +26,7 @@ export function relayoutUsingSplitter(splitViewNode, deltaPx, index, initialSize
|
|
|
26
26
|
}
|
|
27
27
|
export function relayout(splitViewNode, priorities, manuallyResizablePriorities, sizesPx) {
|
|
28
28
|
var _a, _b, _c, _d;
|
|
29
|
-
const containerSizePx = splitViewNode.element.splitView ===
|
|
29
|
+
const containerSizePx = splitViewNode.element.splitView === Direction.horizontal
|
|
30
30
|
? (_b = (_a = splitViewNode.element.layoutInfo) === null || _a === void 0 ? void 0 : _a.contentSizeXpx) !== null && _b !== void 0 ? _b : 0
|
|
31
31
|
: (_d = (_c = splitViewNode.element.layoutInfo) === null || _c === void 0 ? void 0 : _c.contentSizeYpx) !== null && _d !== void 0 ? _d : 0;
|
|
32
32
|
const totalSizePx = sizesPx.reduce((p, c) => p + c.sizePx, 0);
|
|
@@ -42,7 +42,7 @@ export function relayout(splitViewNode, priorities, manuallyResizablePriorities,
|
|
|
42
42
|
layout(splitViewNode);
|
|
43
43
|
}
|
|
44
44
|
export function resizeUsingDelta(splitViewNode, deltaPx, index, priorities, sizesPx, force = false) {
|
|
45
|
-
const isHorizontal = splitViewNode.element.splitView ===
|
|
45
|
+
const isHorizontal = splitViewNode.element.splitView === Direction.horizontal;
|
|
46
46
|
let beforeDeltaPx = 0;
|
|
47
47
|
if (sizesPx.length > 0 && deltaPx !== 0) {
|
|
48
48
|
let minBeforeDeltaPx = 0;
|
|
@@ -86,7 +86,7 @@ export function resizeUsingDelta(splitViewNode, deltaPx, index, priorities, size
|
|
|
86
86
|
}
|
|
87
87
|
export function layout(splitViewNode) {
|
|
88
88
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
89
|
-
const isHorizontal = splitViewNode.element.splitView ===
|
|
89
|
+
const isHorizontal = splitViewNode.element.splitView === Direction.horizontal;
|
|
90
90
|
let posPx = 0;
|
|
91
91
|
let shrinkBefore = false;
|
|
92
92
|
let growBefore = false;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { FocusSensor } from "./FocusSensor.js";
|
|
2
1
|
import { HtmlElementSensor } from "./HtmlElementSensor.js";
|
|
3
2
|
import { KeyboardModifiers } from "./KeyboardSensor.js";
|
|
4
3
|
import { WindowSensor } from "./WindowSensor.js";
|
|
@@ -12,7 +11,7 @@ export declare class BasePointerSensor extends HtmlElementSensor {
|
|
|
12
11
|
positionX: number;
|
|
13
12
|
positionY: number;
|
|
14
13
|
modifiers: KeyboardModifiers;
|
|
15
|
-
constructor(element: HTMLElement | SVGElement,
|
|
14
|
+
constructor(element: HTMLElement | SVGElement, windowSensor?: WindowSensor);
|
|
16
15
|
}
|
|
17
16
|
export declare function extractPointerButton(e: MouseEvent): PointerButton;
|
|
18
17
|
export declare function isPointerButtonDown(button: PointerButton, buttonsMask: number): boolean;
|
|
@@ -8,8 +8,8 @@ export var PointerButton;
|
|
|
8
8
|
PointerButton[PointerButton["middle"] = 4] = "middle";
|
|
9
9
|
})(PointerButton || (PointerButton = {}));
|
|
10
10
|
export class BasePointerSensor extends HtmlElementSensor {
|
|
11
|
-
constructor(element,
|
|
12
|
-
super(element,
|
|
11
|
+
constructor(element, windowSensor) {
|
|
12
|
+
super(element, windowSensor);
|
|
13
13
|
this.positionX = Infinity;
|
|
14
14
|
this.positionY = Infinity;
|
|
15
15
|
this.modifiers = KeyboardModifiers.none;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { PointerButton, BasePointerSensor } from "./BasePointerSensor.js";
|
|
2
|
-
import { FocusSensor } from "./FocusSensor.js";
|
|
3
2
|
import { WindowSensor } from "./WindowSensor.js";
|
|
4
3
|
export declare enum ButtonState {
|
|
5
4
|
pressed = 0,
|
|
@@ -15,7 +14,7 @@ export declare class ButtonSensor extends BasePointerSensor {
|
|
|
15
14
|
selectedX: number;
|
|
16
15
|
selectedY: number;
|
|
17
16
|
selected: boolean;
|
|
18
|
-
constructor(element: HTMLElement | SVGElement,
|
|
17
|
+
constructor(element: HTMLElement | SVGElement, windowSensor: WindowSensor);
|
|
19
18
|
listen(enabled?: boolean): void;
|
|
20
19
|
protected onPointerDown(e: PointerEvent): void;
|
|
21
20
|
protected onPointerMove(e: PointerEvent): void;
|
|
@@ -19,8 +19,8 @@ export var ButtonState;
|
|
|
19
19
|
ButtonState[ButtonState["released"] = 3] = "released";
|
|
20
20
|
})(ButtonState || (ButtonState = {}));
|
|
21
21
|
export class ButtonSensor extends BasePointerSensor {
|
|
22
|
-
constructor(element,
|
|
23
|
-
super(element,
|
|
22
|
+
constructor(element, windowSensor) {
|
|
23
|
+
super(element, windowSensor);
|
|
24
24
|
this.state = ButtonState.released;
|
|
25
25
|
this.pointerButton = PointerButton.none;
|
|
26
26
|
this.originData = undefined;
|
|
@@ -43,8 +43,8 @@ export function grabElementDataList(targetPath, sym, payloadKey, existing, ignor
|
|
|
43
43
|
if (candidateData !== undefined) {
|
|
44
44
|
if (!ignoreWindow) {
|
|
45
45
|
if (window === undefined)
|
|
46
|
-
window = candidateData
|
|
47
|
-
else if (window !== candidateData
|
|
46
|
+
window = candidateData.window;
|
|
47
|
+
else if (window !== candidateData.window)
|
|
48
48
|
break;
|
|
49
49
|
}
|
|
50
50
|
payload = candidateData[payloadKey];
|
|
@@ -62,7 +62,7 @@ export function grabElementDataList(targetPath, sym, payloadKey, existing, ignor
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
if (activeData === undefined && predicate(candidate)) {
|
|
65
|
+
if (payloadKey === "focus" && activeData === undefined && (predicate(candidate) || (candidateData === null || candidateData === void 0 ? void 0 : candidateData.catchChildrenFocus))) {
|
|
66
66
|
activeData = payload;
|
|
67
67
|
}
|
|
68
68
|
i++;
|
|
@@ -13,7 +13,7 @@ import { grabElementDataList, SymDataForSensor } from "./DataForSensor.js";
|
|
|
13
13
|
import { HtmlElementSensor } from "./HtmlElementSensor.js";
|
|
14
14
|
export class FocusSensor extends HtmlElementSensor {
|
|
15
15
|
constructor(element, windowSensor) {
|
|
16
|
-
super(element,
|
|
16
|
+
super(element, windowSensor);
|
|
17
17
|
this.activeData = undefined;
|
|
18
18
|
this.oldActiveData = undefined;
|
|
19
19
|
this.contextElementDataList = [];
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { FocusSensor } from "./FocusSensor.js";
|
|
2
1
|
import { HtmlElementSensor } from "./HtmlElementSensor.js";
|
|
3
2
|
import { KeyboardModifiers } from "./KeyboardSensor.js";
|
|
4
3
|
import { WindowSensor } from "./WindowSensor.js";
|
|
@@ -33,7 +32,7 @@ export declare class HtmlDragSensor extends HtmlElementSensor {
|
|
|
33
32
|
immediatePositionX: number;
|
|
34
33
|
immediatePositionY: number;
|
|
35
34
|
immediateModifiers: KeyboardModifiers;
|
|
36
|
-
constructor(element: HTMLElement | SVGElement,
|
|
35
|
+
constructor(element: HTMLElement | SVGElement, windowSensor: WindowSensor);
|
|
37
36
|
getData(format: string): unknown;
|
|
38
37
|
setData(format: string, value: unknown): void;
|
|
39
38
|
clearData(format?: string): void;
|
|
@@ -12,8 +12,8 @@ import { findTargetElementData, SymDataForSensor } from "./DataForSensor.js";
|
|
|
12
12
|
import { HtmlElementSensor } from "./HtmlElementSensor.js";
|
|
13
13
|
import { extractModifierKeys, KeyboardModifiers } from "./KeyboardSensor.js";
|
|
14
14
|
export class HtmlDragSensor extends HtmlElementSensor {
|
|
15
|
-
constructor(element,
|
|
16
|
-
super(element,
|
|
15
|
+
constructor(element, windowSensor) {
|
|
16
|
+
super(element, windowSensor);
|
|
17
17
|
this.draggable = undefined;
|
|
18
18
|
this.dragSource = undefined;
|
|
19
19
|
this.dragTarget = undefined;
|
|
@@ -3,11 +3,10 @@ import { Sensor } from "./Sensor.js";
|
|
|
3
3
|
import { WindowSensor } from "./WindowSensor.js";
|
|
4
4
|
export declare class HtmlElementSensor extends Sensor {
|
|
5
5
|
readonly sourceElement: HTMLElement | SVGElement;
|
|
6
|
-
readonly focusSensor?: any;
|
|
7
6
|
readonly windowSensor?: WindowSensor;
|
|
8
7
|
preventDefault: boolean;
|
|
9
8
|
stopPropagation: boolean;
|
|
10
|
-
constructor(sourceElement: HTMLElement | SVGElement,
|
|
9
|
+
constructor(sourceElement: HTMLElement | SVGElement, windowSensor?: WindowSensor);
|
|
11
10
|
protected getDefaultSensorData(): DataForSensor;
|
|
12
11
|
protected setPreventDefaultAndStopPropagation(e: Event): void;
|
|
13
12
|
}
|
|
@@ -12,10 +12,9 @@ import { SymDataForSensor } from "./DataForSensor.js";
|
|
|
12
12
|
import { Sensor } from "./Sensor.js";
|
|
13
13
|
import { WindowSensor } from "./WindowSensor.js";
|
|
14
14
|
export class HtmlElementSensor extends Sensor {
|
|
15
|
-
constructor(sourceElement,
|
|
15
|
+
constructor(sourceElement, windowSensor) {
|
|
16
16
|
super();
|
|
17
17
|
this.sourceElement = sourceElement;
|
|
18
|
-
this.focusSensor = focusSensor;
|
|
19
18
|
this.windowSensor = windowSensor;
|
|
20
19
|
this.preventDefault = false;
|
|
21
20
|
this.stopPropagation = false;
|
|
@@ -38,10 +37,6 @@ __decorate([
|
|
|
38
37
|
raw,
|
|
39
38
|
__metadata("design:type", Object)
|
|
40
39
|
], HtmlElementSensor.prototype, "sourceElement", void 0);
|
|
41
|
-
__decorate([
|
|
42
|
-
raw,
|
|
43
|
-
__metadata("design:type", Object)
|
|
44
|
-
], HtmlElementSensor.prototype, "focusSensor", void 0);
|
|
45
40
|
__decorate([
|
|
46
41
|
raw,
|
|
47
42
|
__metadata("design:type", WindowSensor)
|
|
@@ -58,21 +58,21 @@ export class HtmlSensors {
|
|
|
58
58
|
}
|
|
59
59
|
get htmlDrag() {
|
|
60
60
|
if (this._htmlDrag === undefined) {
|
|
61
|
-
this._htmlDrag = new HtmlDragSensor(this._element, this.
|
|
61
|
+
this._htmlDrag = new HtmlDragSensor(this._element, this.window);
|
|
62
62
|
this._htmlDrag.listen();
|
|
63
63
|
}
|
|
64
64
|
return this._htmlDrag;
|
|
65
65
|
}
|
|
66
66
|
get button() {
|
|
67
67
|
if (this._button === undefined) {
|
|
68
|
-
this._button = new ButtonSensor(this._element, this.
|
|
68
|
+
this._button = new ButtonSensor(this._element, this.window);
|
|
69
69
|
this._button.listen();
|
|
70
70
|
}
|
|
71
71
|
return this._button;
|
|
72
72
|
}
|
|
73
73
|
get pointer() {
|
|
74
74
|
if (this._pointer === undefined) {
|
|
75
|
-
this._pointer = new PointerSensor(this._element, this.
|
|
75
|
+
this._pointer = new PointerSensor(this._element, this.window);
|
|
76
76
|
this._pointer.listen();
|
|
77
77
|
}
|
|
78
78
|
return this._pointer;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { PointerButton, BasePointerSensor } from "./BasePointerSensor.js";
|
|
2
|
-
import { FocusSensor } from "./FocusSensor.js";
|
|
3
2
|
import { KeyboardModifiers } from "./KeyboardSensor.js";
|
|
4
3
|
import { WindowSensor } from "./WindowSensor.js";
|
|
5
4
|
export declare class PointerSensor extends BasePointerSensor {
|
|
@@ -34,7 +33,7 @@ export declare class PointerSensor extends BasePointerSensor {
|
|
|
34
33
|
immediatePositionY: number;
|
|
35
34
|
immediateModifiers: KeyboardModifiers;
|
|
36
35
|
static readonly DraggingThreshold = 4;
|
|
37
|
-
constructor(element: HTMLElement | SVGElement,
|
|
36
|
+
constructor(element: HTMLElement | SVGElement, windowSensor: WindowSensor);
|
|
38
37
|
getData(): unknown;
|
|
39
38
|
setData(value: unknown): void;
|
|
40
39
|
listen(enabled?: boolean): void;
|
|
@@ -12,8 +12,8 @@ import { extractPointerButton, isPointerButtonDown, PointerButton, BasePointerSe
|
|
|
12
12
|
import { findTargetElementData, SymDataForSensor } from "./DataForSensor.js";
|
|
13
13
|
import { extractModifierKeys, KeyboardModifiers } from "./KeyboardSensor.js";
|
|
14
14
|
export class PointerSensor extends BasePointerSensor {
|
|
15
|
-
constructor(element,
|
|
16
|
-
super(element,
|
|
15
|
+
constructor(element, windowSensor) {
|
|
16
|
+
super(element, windowSensor);
|
|
17
17
|
this.hotPositionX = Infinity;
|
|
18
18
|
this.hotPositionY = Infinity;
|
|
19
19
|
this.pointerButton = PointerButton.none;
|