verstak 0.23.125 → 0.24.107
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/archive/RxDomV1.js +5 -5
- package/build/dist/source/core/api.d.ts +0 -3
- package/build/dist/source/core/api.js +0 -3
- package/build/dist/source/html/El.d.ts +163 -0
- package/build/dist/source/html/El.js +508 -0
- package/build/dist/source/{core/Utils.d.ts → html/ElUtils.d.ts} +3 -4
- package/build/dist/source/{core/Utils.js → html/ElUtils.js} +14 -46
- package/build/dist/source/html/Elements.d.ts +8 -20
- package/build/dist/source/html/Elements.js +22 -200
- package/build/dist/source/html/HtmlDriver.d.ts +18 -15
- package/build/dist/source/html/HtmlDriver.js +31 -31
- package/build/dist/source/html/HtmlElements.d.ts +176 -175
- package/build/dist/source/html/HtmlElements.js +178 -177
- package/build/dist/source/html/ReactingFocuser.js +2 -2
- 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/FocusSensor.js +1 -1
- package/build/dist/source/html/sensors/ResizeSensor.d.ts +1 -1
- package/build/dist/source/html/sensors/WindowSensor.js +1 -1
- package/package.json +2 -2
- package/build/dist/source/core/Interfaces.d.ts +0 -132
- package/build/dist/source/core/Interfaces.js +0 -34
- package/build/dist/source/core/Verstak.d.ts +0 -61
- package/build/dist/source/core/Verstak.js +0 -887
|
@@ -1,236 +1,58 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RxTree } from "reactronic";
|
|
2
|
+
import { Constants, CursorCommandDriver, ElKind } from "./El.js";
|
|
2
3
|
import { HtmlDriver } from "./HtmlDriver.js";
|
|
3
|
-
export function Section(
|
|
4
|
-
return
|
|
4
|
+
export function Section(declaration, preset) {
|
|
5
|
+
return RxTree.declare(Drivers.section, declaration, preset);
|
|
5
6
|
}
|
|
6
|
-
export function Table(
|
|
7
|
-
return
|
|
7
|
+
export function Table(declaration, preset) {
|
|
8
|
+
return RxTree.declare(Drivers.table, declaration, preset);
|
|
8
9
|
}
|
|
9
10
|
export function row(builder, shiftCursorDown) {
|
|
10
11
|
startNewRow(shiftCursorDown);
|
|
11
12
|
builder === null || builder === void 0 ? void 0 : builder();
|
|
12
13
|
}
|
|
13
14
|
export function startNewRow(shiftCursorDown) {
|
|
14
|
-
|
|
15
|
+
RxTree.declare(Drivers.partition);
|
|
15
16
|
}
|
|
16
17
|
export function cursor(areaParams) {
|
|
17
|
-
|
|
18
|
+
RxTree.declare(Drivers.cursor, {
|
|
18
19
|
update(b) {
|
|
19
20
|
b.area = areaParams;
|
|
20
21
|
},
|
|
21
22
|
});
|
|
22
23
|
}
|
|
23
|
-
export function Note(content,
|
|
24
|
-
return
|
|
24
|
+
export function Note(content, declaration) {
|
|
25
|
+
return RxTree.declare(Drivers.note, declaration, {
|
|
25
26
|
update(b) {
|
|
26
27
|
b.native.innerText = content;
|
|
27
28
|
}
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
|
-
export function HtmlNote(content,
|
|
31
|
-
return
|
|
31
|
+
export function HtmlNote(content, declaration) {
|
|
32
|
+
return RxTree.declare(Drivers.note, declaration, {
|
|
32
33
|
update(b) {
|
|
33
34
|
b.native.innerHTML = content;
|
|
34
35
|
}
|
|
35
36
|
});
|
|
36
37
|
}
|
|
37
|
-
export function Group(
|
|
38
|
-
return
|
|
38
|
+
export function Group(declaration, preset) {
|
|
39
|
+
return RxTree.declare(Drivers.group, declaration, preset);
|
|
39
40
|
}
|
|
40
|
-
export function Fragment(
|
|
41
|
-
return
|
|
41
|
+
export function Fragment(declaration, preset) {
|
|
42
|
+
return RxTree.declare(HtmlDriver.group, declaration, preset);
|
|
42
43
|
}
|
|
43
44
|
export class VerstakHtmlDriver extends HtmlDriver {
|
|
44
|
-
applyKind(element, value) {
|
|
45
|
-
const kind = Constants.layouts[value];
|
|
46
|
-
kind && element.native.setAttribute(Constants.attribute, kind);
|
|
47
|
-
VerstakDriversByLayout[value](element);
|
|
48
|
-
super.applyKind(element, value);
|
|
49
|
-
}
|
|
50
|
-
applyCoords(element, value) {
|
|
51
|
-
const s = element.native.style;
|
|
52
|
-
if (value) {
|
|
53
|
-
const x1 = value.x1 || 1;
|
|
54
|
-
const y1 = value.y1 || 1;
|
|
55
|
-
const x2 = value.x2 || x1;
|
|
56
|
-
const y2 = value.y2 || y1;
|
|
57
|
-
s.gridArea = `${y1} / ${x1} / span ${y2 - y1 + 1} / span ${x2 - x1 + 1}`;
|
|
58
|
-
}
|
|
59
|
-
else
|
|
60
|
-
s.gridArea = "";
|
|
61
|
-
super.applyCoords(element, value);
|
|
62
|
-
}
|
|
63
|
-
applyWidthGrowth(element, value) {
|
|
64
|
-
const s = element.native.style;
|
|
65
|
-
if (value > 0) {
|
|
66
|
-
s.flexGrow = `${value}`;
|
|
67
|
-
s.flexBasis = "0";
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
s.flexGrow = "";
|
|
71
|
-
s.flexBasis = "";
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
applyMinWidth(element, value) {
|
|
75
|
-
element.native.style.minWidth = `${value}`;
|
|
76
|
-
}
|
|
77
|
-
applyMaxWidth(element, value) {
|
|
78
|
-
element.native.style.maxWidth = `${value}`;
|
|
79
|
-
}
|
|
80
|
-
applyHeightGrowth(element, value) {
|
|
81
|
-
const bNode = element.node;
|
|
82
|
-
const driver = bNode.driver;
|
|
83
|
-
if (driver.isSeparator) {
|
|
84
|
-
const s = element.native.style;
|
|
85
|
-
if (value > 0)
|
|
86
|
-
s.flexGrow = `${value}`;
|
|
87
|
-
else
|
|
88
|
-
s.flexGrow = "";
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
const hostDriver = bNode.host.driver;
|
|
92
|
-
if (hostDriver.isSeparator) {
|
|
93
|
-
driver.applyElementAlignment(element, Align.ToBounds);
|
|
94
|
-
hostDriver.applyHeightGrowth(bNode.host.slot.instance, value);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
applyMinHeight(element, value) {
|
|
99
|
-
element.native.style.minHeight = `${value}`;
|
|
100
|
-
}
|
|
101
|
-
applyMaxHeight(element, value) {
|
|
102
|
-
element.native.style.maxHeight = `${value}`;
|
|
103
|
-
}
|
|
104
|
-
applyContentAlignment(element, value) {
|
|
105
|
-
const s = element.native.style;
|
|
106
|
-
if ((value & Align.Default) === 0) {
|
|
107
|
-
const v = AlignToCss[(value >> 2) & 0b11];
|
|
108
|
-
const h = AlignToCss[value & 0b11];
|
|
109
|
-
const t = TextAlignCss[value & 0b11];
|
|
110
|
-
s.justifyContent = v;
|
|
111
|
-
s.alignItems = h;
|
|
112
|
-
s.textAlign = t;
|
|
113
|
-
}
|
|
114
|
-
else
|
|
115
|
-
s.justifyContent = s.alignContent = s.textAlign = "";
|
|
116
|
-
}
|
|
117
|
-
applyElementAlignment(element, value) {
|
|
118
|
-
const s = element.native.style;
|
|
119
|
-
if ((value & Align.Default) === 0) {
|
|
120
|
-
const v = AlignToCss[(value >> 2) & 0b11];
|
|
121
|
-
const h = AlignToCss[value & 0b11];
|
|
122
|
-
s.alignSelf = v;
|
|
123
|
-
s.justifySelf = h;
|
|
124
|
-
}
|
|
125
|
-
else
|
|
126
|
-
s.alignSelf = s.justifySelf = "";
|
|
127
|
-
}
|
|
128
|
-
applyContentWrapping(element, value) {
|
|
129
|
-
const s = element.native.style;
|
|
130
|
-
if (value) {
|
|
131
|
-
s.flexFlow = "wrap";
|
|
132
|
-
s.overflow = "";
|
|
133
|
-
s.textOverflow = "";
|
|
134
|
-
s.whiteSpace = "";
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
s.flexFlow = "";
|
|
138
|
-
s.overflow = "hidden";
|
|
139
|
-
s.textOverflow = "ellipsis";
|
|
140
|
-
s.whiteSpace = "nowrap";
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
applyOverlayVisible(element, value) {
|
|
144
|
-
const e = element.native;
|
|
145
|
-
const s = e.style;
|
|
146
|
-
const host = HtmlDriver.findEffectiveHtmlElementHost(element).native;
|
|
147
|
-
if (value === true) {
|
|
148
|
-
const doc = document.body;
|
|
149
|
-
const rect = host.getBoundingClientRect();
|
|
150
|
-
if (doc.offsetWidth - rect.left > rect.right)
|
|
151
|
-
s.left = "0", s.right = "";
|
|
152
|
-
else
|
|
153
|
-
s.left = "", s.right = "0";
|
|
154
|
-
if (doc.clientHeight - rect.top > rect.bottom)
|
|
155
|
-
s.top = "100%", s.bottom = "";
|
|
156
|
-
else
|
|
157
|
-
s.top = "", s.bottom = "100%";
|
|
158
|
-
s.display = "";
|
|
159
|
-
s.position = "absolute";
|
|
160
|
-
s.minWidth = "100%";
|
|
161
|
-
s.boxSizing = "border-box";
|
|
162
|
-
host.style.position = "relative";
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
host.style.position = "";
|
|
166
|
-
if (value === false)
|
|
167
|
-
s.display = "none";
|
|
168
|
-
else
|
|
169
|
-
s.position = s.display = s.left = s.right = s.top = s.bottom = "";
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
applyStyle(element, secondary, styleName, enabled) {
|
|
173
|
-
const native = element.native;
|
|
174
|
-
enabled !== null && enabled !== void 0 ? enabled : (enabled = true);
|
|
175
|
-
if (secondary)
|
|
176
|
-
native.classList.toggle(styleName, enabled);
|
|
177
|
-
else
|
|
178
|
-
native.className = enabled ? styleName : "";
|
|
179
|
-
}
|
|
180
45
|
update(element) {
|
|
181
|
-
if (element.kind
|
|
46
|
+
if (element.kind === ElKind.Section)
|
|
182
47
|
startNewRow();
|
|
183
48
|
return super.update(element);
|
|
184
49
|
}
|
|
185
50
|
}
|
|
186
|
-
const Constants = {
|
|
187
|
-
el: "el",
|
|
188
|
-
row: "row",
|
|
189
|
-
layouts: ["section", "table", "note", "group", "", ""],
|
|
190
|
-
attribute: "kind",
|
|
191
|
-
};
|
|
192
51
|
const Drivers = {
|
|
193
|
-
section: new VerstakHtmlDriver(Constants.
|
|
194
|
-
table: new VerstakHtmlDriver(Constants.
|
|
195
|
-
note: new VerstakHtmlDriver(Constants.
|
|
196
|
-
group: new VerstakHtmlDriver(Constants.
|
|
197
|
-
|
|
52
|
+
section: new VerstakHtmlDriver(Constants.element, false, el => el.kind = ElKind.Section),
|
|
53
|
+
table: new VerstakHtmlDriver(Constants.element, false, el => el.kind = ElKind.Table),
|
|
54
|
+
note: new VerstakHtmlDriver(Constants.element, false, el => el.kind = ElKind.Note),
|
|
55
|
+
group: new VerstakHtmlDriver(Constants.element, false, el => el.kind = ElKind.Group),
|
|
56
|
+
partition: new VerstakHtmlDriver(Constants.partition, true, el => el.kind = ElKind.Part),
|
|
198
57
|
cursor: new CursorCommandDriver(),
|
|
199
58
|
};
|
|
200
|
-
const VerstakDriversByLayout = [
|
|
201
|
-
el => {
|
|
202
|
-
const s = el.native.style;
|
|
203
|
-
s.display = "flex";
|
|
204
|
-
s.flexDirection = "column";
|
|
205
|
-
s.alignSelf = el.node.owner.slot.instance.isTable ? "stretch" : "center";
|
|
206
|
-
s.textAlign = "initial";
|
|
207
|
-
s.flexShrink = "1";
|
|
208
|
-
s.minWidth = "0";
|
|
209
|
-
},
|
|
210
|
-
el => {
|
|
211
|
-
const s = el.native.style;
|
|
212
|
-
s.alignSelf = el.node.owner.slot.instance.isTable ? "stretch" : "center";
|
|
213
|
-
s.display = "grid";
|
|
214
|
-
s.flexBasis = "0";
|
|
215
|
-
s.gridAutoRows = "minmax(min-content, 1fr)";
|
|
216
|
-
s.gridAutoColumns = "minmax(min-content, 1fr)";
|
|
217
|
-
s.textAlign = "initial";
|
|
218
|
-
},
|
|
219
|
-
el => {
|
|
220
|
-
const s = el.native.style;
|
|
221
|
-
s.alignSelf = el.node.owner.slot.instance.isTable ? "stretch" : "center";
|
|
222
|
-
s.display = "inline-grid";
|
|
223
|
-
s.flexShrink = "1";
|
|
224
|
-
},
|
|
225
|
-
el => {
|
|
226
|
-
const s = el.native.style;
|
|
227
|
-
s.display = "contents";
|
|
228
|
-
},
|
|
229
|
-
el => {
|
|
230
|
-
const s = el.native.style;
|
|
231
|
-
s.display = el.node.owner.slot.instance.isTable ? "none" : "flex";
|
|
232
|
-
s.flexDirection = "row";
|
|
233
|
-
},
|
|
234
|
-
];
|
|
235
|
-
const AlignToCss = ["stretch", "start", "center", "end"];
|
|
236
|
-
const TextAlignCss = ["justify", "left", "center", "right"];
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { El,
|
|
3
|
-
export declare
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
update(element: El<T, unknown, C>): void | Promise<void>;
|
|
1
|
+
import { SimpleDelegate } from "reactronic";
|
|
2
|
+
import { El, ElDriver } from "./El.js";
|
|
3
|
+
export declare class VerstakDriver<T extends Element, M = unknown, C = unknown> extends ElDriver<T, M, C> {
|
|
4
|
+
initialize(element: El<T, M, C>): void;
|
|
5
|
+
finalize(element: El<T, M, C>, isLeader: boolean): boolean;
|
|
6
|
+
mount(element: El<T, M, C>): void;
|
|
7
|
+
relocate(element: El<T, M, C>): void;
|
|
8
|
+
update(element: El<T, M, C>): void | Promise<void>;
|
|
10
9
|
static get blinkingEffectMarker(): string | undefined;
|
|
11
10
|
static set blinkingEffectMarker(value: string | undefined);
|
|
12
|
-
static findEffectiveHtmlElementHost(element: El<any>): El<HTMLElement | SVGElement>;
|
|
13
|
-
static findPrevSiblingHtmlElement(ties: MergedItem<El<any>>): MergedItem<El<HTMLElement | SVGElement>> | undefined;
|
|
14
11
|
}
|
|
15
|
-
export declare class
|
|
16
|
-
|
|
12
|
+
export declare class StaticDriver<T extends HTMLElement> extends VerstakDriver<T> {
|
|
13
|
+
readonly native: T;
|
|
14
|
+
constructor(native: T, name: string, isRow: boolean, predefine?: SimpleDelegate<El<T>>);
|
|
15
|
+
assign(element: El<T>): void;
|
|
17
16
|
}
|
|
18
|
-
export declare class
|
|
19
|
-
|
|
17
|
+
export declare class HtmlDriver<T extends HTMLElement, M = any, C = any> extends VerstakDriver<T, M, C> {
|
|
18
|
+
static readonly group: HtmlDriver<any, any, any>;
|
|
19
|
+
assign(element: El<T, any, C, void>): void;
|
|
20
|
+
}
|
|
21
|
+
export declare class SvgDriver<T extends SVGElement, M = any, C = any> extends VerstakDriver<T, M, C> {
|
|
22
|
+
assign(element: El<T, any, C, void>): void;
|
|
20
23
|
}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export class
|
|
4
|
-
create(element) {
|
|
5
|
-
super.create(element);
|
|
6
|
-
}
|
|
1
|
+
import { RxSystem, RxTree } from "reactronic";
|
|
2
|
+
import { Constants, ElDriver, ElImpl, ElKind } from "./El.js";
|
|
3
|
+
export class VerstakDriver extends ElDriver {
|
|
7
4
|
initialize(element) {
|
|
8
|
-
if (
|
|
9
|
-
element.native.setAttribute(
|
|
5
|
+
if (RxSystem.isLogging && !element.node.driver.isPartitionSeparator)
|
|
6
|
+
element.native.setAttribute(Constants.keyAttrName, element.node.key);
|
|
10
7
|
super.initialize(element);
|
|
11
8
|
}
|
|
12
9
|
finalize(element, isLeader) {
|
|
@@ -25,16 +22,17 @@ export class BaseHtmlDriver extends BaseDriver {
|
|
|
25
22
|
if (native) {
|
|
26
23
|
const node = element.node;
|
|
27
24
|
const sequential = node.owner.children.isStrict;
|
|
28
|
-
const
|
|
25
|
+
const automaticHost = RxTree.findMatchingHost(node, n => n.element.native instanceof HTMLElement || n.element.native instanceof SVGElement);
|
|
26
|
+
const automaticNativeHost = automaticHost === null || automaticHost === void 0 ? void 0 : automaticHost.element.native;
|
|
29
27
|
if (automaticNativeHost) {
|
|
30
|
-
if (sequential && !node.driver.
|
|
31
|
-
const after =
|
|
32
|
-
if (after === undefined || after.
|
|
28
|
+
if (sequential && !node.driver.isPartitionSeparator) {
|
|
29
|
+
const after = RxTree.findMatchingPrevSibling(element.node, n => n.element.native instanceof HTMLElement || n.element.native instanceof SVGElement);
|
|
30
|
+
if (after === undefined || after.driver.isPartitionSeparator) {
|
|
33
31
|
if (automaticNativeHost !== native.parentNode || !native.previousSibling)
|
|
34
32
|
automaticNativeHost.prepend(native);
|
|
35
33
|
}
|
|
36
34
|
else {
|
|
37
|
-
const nativeAfter = after.
|
|
35
|
+
const nativeAfter = after.element.native;
|
|
38
36
|
if (nativeAfter instanceof Element) {
|
|
39
37
|
if (nativeAfter.nextSibling !== native)
|
|
40
38
|
automaticNativeHost.insertBefore(native, nativeAfter.nextSibling);
|
|
@@ -50,8 +48,13 @@ export class BaseHtmlDriver extends BaseDriver {
|
|
|
50
48
|
}
|
|
51
49
|
update(element) {
|
|
52
50
|
const result = super.update(element);
|
|
51
|
+
if (element.area === undefined) {
|
|
52
|
+
const oel = element.node.owner.element;
|
|
53
|
+
if (oel instanceof ElImpl && oel.isTable)
|
|
54
|
+
element.area = undefined;
|
|
55
|
+
}
|
|
53
56
|
if (gBlinkingEffectMarker)
|
|
54
|
-
blink(element.native,
|
|
57
|
+
blink(element.native, RxTree.currentUpdatePriority, element.node.stamp);
|
|
55
58
|
return result;
|
|
56
59
|
}
|
|
57
60
|
static get blinkingEffectMarker() {
|
|
@@ -60,30 +63,27 @@ export class BaseHtmlDriver extends BaseDriver {
|
|
|
60
63
|
static set blinkingEffectMarker(value) {
|
|
61
64
|
gBlinkingEffectMarker = value;
|
|
62
65
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return p.slot.instance;
|
|
66
|
+
}
|
|
67
|
+
export class StaticDriver extends VerstakDriver {
|
|
68
|
+
constructor(native, name, isRow, predefine) {
|
|
69
|
+
super(name, isRow, predefine);
|
|
70
|
+
this.native = native;
|
|
69
71
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
while (p && !(p.instance.native instanceof HTMLElement) && !(p.instance.native instanceof SVGElement))
|
|
73
|
-
p = p.prev;
|
|
74
|
-
return p;
|
|
72
|
+
assign(element) {
|
|
73
|
+
element.native = this.native;
|
|
75
74
|
}
|
|
76
75
|
}
|
|
77
|
-
export class HtmlDriver extends
|
|
78
|
-
|
|
76
|
+
export class HtmlDriver extends VerstakDriver {
|
|
77
|
+
assign(element) {
|
|
79
78
|
element.native = document.createElement(element.node.driver.name);
|
|
80
|
-
super.
|
|
79
|
+
super.assign(element);
|
|
81
80
|
}
|
|
82
81
|
}
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
HtmlDriver.group = new HtmlDriver("group", false, el => el.kind = ElKind.Group);
|
|
83
|
+
export class SvgDriver extends VerstakDriver {
|
|
84
|
+
assign(element) {
|
|
85
85
|
element.native = document.createElementNS("http://www.w3.org/2000/svg", element.node.driver.name);
|
|
86
|
-
super.
|
|
86
|
+
super.assign(element);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
function blink(element, priority, revision) {
|