verstak 0.23.124 → 0.24.104
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/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,3 +1,17 @@
|
|
|
1
|
+
export function objectHasMember(obj, member) {
|
|
2
|
+
return obj === Object(obj) && !Array.isArray(obj) && member in obj;
|
|
3
|
+
}
|
|
4
|
+
export function emitLetters(n) {
|
|
5
|
+
if (n < 0)
|
|
6
|
+
throw new Error(`emitLetters: argument (${n}) should not be negative or zero`);
|
|
7
|
+
let result = "";
|
|
8
|
+
while (n >= 0) {
|
|
9
|
+
const r = n % 26;
|
|
10
|
+
n = Math.floor(n / 26) - 1;
|
|
11
|
+
result = String.fromCharCode(65 + r) + result;
|
|
12
|
+
}
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
1
15
|
export function parseElCoords(text, result) {
|
|
2
16
|
let i = 0;
|
|
3
17
|
let value = 0;
|
|
@@ -134,17 +148,6 @@ export function emitElCoords(value) {
|
|
|
134
148
|
const p2 = emitCellPosition(value.x2, value.y2);
|
|
135
149
|
return `${p1}${p2 !== "" ? `:${p2}` : ""}`;
|
|
136
150
|
}
|
|
137
|
-
export function emitLetters(n) {
|
|
138
|
-
if (n < 0)
|
|
139
|
-
throw new Error(`emitLetters: argument (${n}) should not be negative or zero`);
|
|
140
|
-
let result = "";
|
|
141
|
-
while (n >= 0) {
|
|
142
|
-
const r = n % 26;
|
|
143
|
-
n = Math.floor(n / 26) - 1;
|
|
144
|
-
result = String.fromCharCode(65 + r) + result;
|
|
145
|
-
}
|
|
146
|
-
return result;
|
|
147
|
-
}
|
|
148
151
|
export function emitCellPosition(x, y) {
|
|
149
152
|
let result = "";
|
|
150
153
|
if (x > 0 && y > 0)
|
|
@@ -174,38 +177,3 @@ function isCapitalLetter(ch) {
|
|
|
174
177
|
function isLowercaseLetter(ch) {
|
|
175
178
|
return 97 <= ch && ch <= 122;
|
|
176
179
|
}
|
|
177
|
-
export function objectHasMember(obj, member) {
|
|
178
|
-
return obj === Object(obj) && !Array.isArray(obj) && member in obj;
|
|
179
|
-
}
|
|
180
|
-
export function getCallerInfo(prefix) {
|
|
181
|
-
const restore = Error.stackTraceLimit = 20;
|
|
182
|
-
const error = new Error();
|
|
183
|
-
const stack = error.stack || "";
|
|
184
|
-
Error.stackTraceLimit = restore;
|
|
185
|
-
const lines = stack.split("\n");
|
|
186
|
-
let i = lines.findIndex(x => x.indexOf(".specify") >= 0);
|
|
187
|
-
i = i >= 0 ? i + 2 : 5;
|
|
188
|
-
let caller = extractFunctionAndLocation(lines[i]);
|
|
189
|
-
let location = caller;
|
|
190
|
-
if (caller.func.endsWith(".update")) {
|
|
191
|
-
i = i - 1;
|
|
192
|
-
caller = extractFunctionAndLocation(lines[i]);
|
|
193
|
-
location = extractFunctionAndLocation(lines[i + 1]);
|
|
194
|
-
}
|
|
195
|
-
else {
|
|
196
|
-
while (!caller.func && i > 0) {
|
|
197
|
-
i = i - 1;
|
|
198
|
-
caller = extractFunctionAndLocation(lines[i]);
|
|
199
|
-
}
|
|
200
|
-
location = extractFunctionAndLocation(lines[i + 1]);
|
|
201
|
-
}
|
|
202
|
-
const result = `${prefix}·${caller.func}@${location.file}`;
|
|
203
|
-
return result;
|
|
204
|
-
}
|
|
205
|
-
function extractFunctionAndLocation(s) {
|
|
206
|
-
const match = s.match(/(?:\s*at\s+)?(?:(\S+)\s\()?(?:.*?)([^\/\(\):]+)(?:(:|\d)*\)?)$/);
|
|
207
|
-
return {
|
|
208
|
-
func: (match === null || match === void 0 ? void 0 : match[1]) || "",
|
|
209
|
-
file: (match === null || match === void 0 ? void 0 : match[2]) || "",
|
|
210
|
-
};
|
|
211
|
-
}
|
|
@@ -1,27 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RxNodeDecl } from "reactronic";
|
|
2
|
+
import { El, ElArea } from "./El.js";
|
|
2
3
|
import { HtmlDriver } from "./HtmlDriver.js";
|
|
3
|
-
export declare function Section<M = unknown, R = void>(
|
|
4
|
-
export declare function Table<M = unknown, R = void>(
|
|
4
|
+
export declare function Section<M = unknown, R = void>(declaration?: RxNodeDecl<El<HTMLElement, M, R>>, preset?: RxNodeDecl<El<HTMLElement, M, R>>): El<HTMLElement, M, R>;
|
|
5
|
+
export declare function Table<M = unknown, R = void>(declaration?: RxNodeDecl<El<HTMLElement, M, R>>, preset?: RxNodeDecl<El<HTMLElement, M, R>>): El<HTMLElement, M, R>;
|
|
5
6
|
export declare function row<T = void>(builder?: (element: void) => T, shiftCursorDown?: number): void;
|
|
6
7
|
export declare function startNewRow(shiftCursorDown?: number): void;
|
|
7
8
|
export declare function cursor(areaParams: ElArea): void;
|
|
8
|
-
export declare function Note(content: string,
|
|
9
|
-
export declare function HtmlNote(content: string,
|
|
10
|
-
export declare function Group<M = unknown, R = void>(
|
|
11
|
-
export declare function Fragment<M = unknown, R = void>(
|
|
9
|
+
export declare function Note(content: string, declaration?: RxNodeDecl<El<HTMLElement, void, void>>): El<HTMLElement, void, void>;
|
|
10
|
+
export declare function HtmlNote(content: string, declaration?: RxNodeDecl<El<HTMLElement, void, void>>): El<HTMLElement, void, void>;
|
|
11
|
+
export declare function Group<M = unknown, R = void>(declaration?: RxNodeDecl<El<HTMLElement, M, R>>, preset?: RxNodeDecl<El<HTMLElement, M, R>>): El<HTMLElement, M, R>;
|
|
12
|
+
export declare function Fragment<M = unknown, R = void>(declaration?: RxNodeDecl<El<void, M, R>>, preset?: RxNodeDecl<El<void, M, R>>): El<void, M, R>;
|
|
12
13
|
export declare class VerstakHtmlDriver<T extends HTMLElement> extends HtmlDriver<T> {
|
|
13
|
-
applyKind(element: El<T, any, any>, value: ElKind): void;
|
|
14
|
-
applyCoords(element: El<T>, value: ElCoords | undefined): void;
|
|
15
|
-
applyWidthGrowth(element: El<T>, value: number): void;
|
|
16
|
-
applyMinWidth(element: El<T>, value: string): void;
|
|
17
|
-
applyMaxWidth(element: El<T>, value: string): void;
|
|
18
|
-
applyHeightGrowth(element: El<T>, value: number): void;
|
|
19
|
-
applyMinHeight(element: El<T>, value: string): void;
|
|
20
|
-
applyMaxHeight(element: El<T>, value: string): void;
|
|
21
|
-
applyContentAlignment(element: El<T>, value: Align): void;
|
|
22
|
-
applyElementAlignment(element: El<T>, value: Align): void;
|
|
23
|
-
applyContentWrapping(element: El<T>, value: boolean): void;
|
|
24
|
-
applyOverlayVisible(element: El<T>, value: boolean | undefined): void;
|
|
25
|
-
applyStyle(element: El<T, any, any>, secondary: boolean, styleName: string, enabled?: boolean): void;
|
|
26
14
|
update(element: El<T>): void | Promise<void>;
|
|
27
15
|
}
|
|
@@ -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: MergeItem<El<any>>): MergeItem<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 { Rx } from "reactronic";
|
|
2
|
-
import {
|
|
3
|
-
export class
|
|
4
|
-
create(element) {
|
|
5
|
-
super.create(element);
|
|
6
|
-
}
|
|
1
|
+
import { Rx, RxTree } from "reactronic";
|
|
2
|
+
import { Constants, ElDriver, ElImpl, ElKind } from "./El.js";
|
|
3
|
+
export class VerstakDriver extends ElDriver {
|
|
7
4
|
initialize(element) {
|
|
8
|
-
if (Rx.isLogging && !element.node.driver.
|
|
9
|
-
element.native.setAttribute(
|
|
5
|
+
if (Rx.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) {
|