verstak 0.23.122 → 0.23.123
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/Interfaces.d.ts +29 -32
- package/build/dist/source/core/Utils.js +1 -1
- package/build/dist/source/core/Verstak.d.ts +10 -19
- package/build/dist/source/core/Verstak.js +159 -161
- package/build/dist/source/html/Elements.d.ts +7 -7
- package/build/dist/source/html/Elements.js +22 -22
- package/build/dist/source/html/HtmlDriver.d.ts +4 -13
- package/build/dist/source/html/HtmlDriver.js +18 -18
- package/build/dist/source/html/HtmlElements.d.ts +175 -175
- package/build/dist/source/html/HtmlElements.js +175 -175
- package/package.json +8 -8
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
import { Verstak, ElKind, Align, CursorCommandDriver, BaseDriver } from "../core/api.js";
|
|
2
2
|
import { HtmlDriver } from "./HtmlDriver.js";
|
|
3
|
-
export function Section(
|
|
4
|
-
return Verstak.
|
|
3
|
+
export function Section(spec, base) {
|
|
4
|
+
return Verstak.specify(Drivers.section, spec, base);
|
|
5
5
|
}
|
|
6
|
-
export function Table(
|
|
7
|
-
return Verstak.
|
|
6
|
+
export function Table(spec, base) {
|
|
7
|
+
return Verstak.specify(Drivers.table, spec, base);
|
|
8
8
|
}
|
|
9
9
|
export function row(builder, shiftCursorDown) {
|
|
10
10
|
startNewRow(shiftCursorDown);
|
|
11
11
|
builder === null || builder === void 0 ? void 0 : builder();
|
|
12
12
|
}
|
|
13
13
|
export function startNewRow(shiftCursorDown) {
|
|
14
|
-
Verstak.
|
|
14
|
+
Verstak.specify(Drivers.row);
|
|
15
15
|
}
|
|
16
16
|
export function cursor(areaParams) {
|
|
17
|
-
Verstak.
|
|
17
|
+
Verstak.specify(Drivers.cursor, {
|
|
18
18
|
update(b) {
|
|
19
19
|
b.area = areaParams;
|
|
20
20
|
},
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
export function Note(content,
|
|
24
|
-
return Verstak.
|
|
23
|
+
export function Note(content, spec) {
|
|
24
|
+
return Verstak.specify(Drivers.note, spec, {
|
|
25
25
|
update(b) {
|
|
26
26
|
b.native.innerText = content;
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
-
export function HtmlNote(content,
|
|
31
|
-
return Verstak.
|
|
30
|
+
export function HtmlNote(content, spec) {
|
|
31
|
+
return Verstak.specify(Drivers.note, spec, {
|
|
32
32
|
update(b) {
|
|
33
33
|
b.native.innerHTML = content;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
export function Group(
|
|
38
|
-
return Verstak.
|
|
37
|
+
export function Group(spec, base) {
|
|
38
|
+
return Verstak.specify(Drivers.group, spec, base);
|
|
39
39
|
}
|
|
40
|
-
export function Fragment(
|
|
41
|
-
return Verstak.
|
|
40
|
+
export function Fragment(spec, base) {
|
|
41
|
+
return Verstak.specify(BaseDriver.fragment, spec, base);
|
|
42
42
|
}
|
|
43
43
|
export class VerstakHtmlDriver extends HtmlDriver {
|
|
44
44
|
applyKind(element, value) {
|
|
@@ -80,7 +80,7 @@ export class VerstakHtmlDriver extends HtmlDriver {
|
|
|
80
80
|
applyHeightGrowth(element, value) {
|
|
81
81
|
const bNode = element.node;
|
|
82
82
|
const driver = bNode.driver;
|
|
83
|
-
if (driver.
|
|
83
|
+
if (driver.isSeparator) {
|
|
84
84
|
const s = element.native.style;
|
|
85
85
|
if (value > 0)
|
|
86
86
|
s.flexGrow = `${value}`;
|
|
@@ -88,10 +88,10 @@ export class VerstakHtmlDriver extends HtmlDriver {
|
|
|
88
88
|
s.flexGrow = "";
|
|
89
89
|
}
|
|
90
90
|
else {
|
|
91
|
-
const hostDriver = bNode.host.
|
|
92
|
-
if (hostDriver.
|
|
91
|
+
const hostDriver = bNode.host.driver;
|
|
92
|
+
if (hostDriver.isSeparator) {
|
|
93
93
|
driver.applyElementAlignment(element, Align.ToBounds);
|
|
94
|
-
hostDriver.applyHeightGrowth(bNode.host, value);
|
|
94
|
+
hostDriver.applyHeightGrowth(bNode.host.slot.instance, value);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -202,14 +202,14 @@ const VerstakDriversByLayout = [
|
|
|
202
202
|
const s = el.native.style;
|
|
203
203
|
s.display = "flex";
|
|
204
204
|
s.flexDirection = "column";
|
|
205
|
-
s.alignSelf = el.node.owner.isTable ? "stretch" : "center";
|
|
205
|
+
s.alignSelf = el.node.owner.slot.instance.isTable ? "stretch" : "center";
|
|
206
206
|
s.textAlign = "initial";
|
|
207
207
|
s.flexShrink = "1";
|
|
208
208
|
s.minWidth = "0";
|
|
209
209
|
},
|
|
210
210
|
el => {
|
|
211
211
|
const s = el.native.style;
|
|
212
|
-
s.alignSelf = el.node.owner.isTable ? "stretch" : "center";
|
|
212
|
+
s.alignSelf = el.node.owner.slot.instance.isTable ? "stretch" : "center";
|
|
213
213
|
s.display = "grid";
|
|
214
214
|
s.flexBasis = "0";
|
|
215
215
|
s.gridAutoRows = "minmax(min-content, 1fr)";
|
|
@@ -218,7 +218,7 @@ const VerstakDriversByLayout = [
|
|
|
218
218
|
},
|
|
219
219
|
el => {
|
|
220
220
|
const s = el.native.style;
|
|
221
|
-
s.alignSelf = el.node.owner.isTable ? "stretch" : "center";
|
|
221
|
+
s.alignSelf = el.node.owner.slot.instance.isTable ? "stretch" : "center";
|
|
222
222
|
s.display = "inline-grid";
|
|
223
223
|
s.flexShrink = "1";
|
|
224
224
|
},
|
|
@@ -228,7 +228,7 @@ const VerstakDriversByLayout = [
|
|
|
228
228
|
},
|
|
229
229
|
el => {
|
|
230
230
|
const s = el.native.style;
|
|
231
|
-
s.display = el.node.owner.isTable ? "none" : "flex";
|
|
231
|
+
s.display = el.node.owner.slot.instance.isTable ? "none" : "flex";
|
|
232
232
|
s.flexDirection = "row";
|
|
233
233
|
},
|
|
234
234
|
];
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { MergeItem } from "reactronic";
|
|
2
2
|
import { El, BaseDriver } from "../core/api.js";
|
|
3
3
|
export declare abstract class BaseHtmlDriver<T extends Element, C = unknown> extends BaseDriver<T, C> {
|
|
4
|
-
create(element: El<T, unknown, C, void
|
|
5
|
-
native?: T;
|
|
6
|
-
controller?: C;
|
|
7
|
-
}): void;
|
|
4
|
+
create(element: El<T, unknown, C, void>): void;
|
|
8
5
|
initialize(element: El<T, unknown, C, void>): void;
|
|
9
6
|
finalize(element: El<T, unknown, C>, isLeader: boolean): boolean;
|
|
10
|
-
mount(element: El<T, unknown, C
|
|
7
|
+
mount(element: El<T, unknown, C>): void;
|
|
11
8
|
relocate(element: El<T, unknown, C>): void;
|
|
12
9
|
update(element: El<T, unknown, C>): void | Promise<void>;
|
|
13
10
|
static get blinkingEffectMarker(): string | undefined;
|
|
@@ -16,14 +13,8 @@ export declare abstract class BaseHtmlDriver<T extends Element, C = unknown> ext
|
|
|
16
13
|
static findPrevSiblingHtmlElement(ties: MergeItem<El<any>>): MergeItem<El<HTMLElement | SVGElement>> | undefined;
|
|
17
14
|
}
|
|
18
15
|
export declare class HtmlDriver<T extends HTMLElement, C = unknown> extends BaseHtmlDriver<T, C> {
|
|
19
|
-
create(element: El<T, unknown, C, void
|
|
20
|
-
native?: T | undefined;
|
|
21
|
-
controller?: C | undefined;
|
|
22
|
-
}): void;
|
|
16
|
+
create(element: El<T, unknown, C, void>): void;
|
|
23
17
|
}
|
|
24
18
|
export declare class SvgDriver<T extends SVGElement, C = unknown> extends BaseHtmlDriver<T, C> {
|
|
25
|
-
create(element: El<T, unknown, C, void
|
|
26
|
-
native?: T | undefined;
|
|
27
|
-
controller?: C | undefined;
|
|
28
|
-
}): void;
|
|
19
|
+
create(element: El<T, unknown, C, void>): void;
|
|
29
20
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Rx } from "reactronic";
|
|
2
2
|
import { Verstak, BaseDriver } from "../core/api.js";
|
|
3
3
|
export class BaseHtmlDriver extends BaseDriver {
|
|
4
|
-
create(element
|
|
5
|
-
super.create(element
|
|
4
|
+
create(element) {
|
|
5
|
+
super.create(element);
|
|
6
6
|
}
|
|
7
7
|
initialize(element) {
|
|
8
|
-
if (Rx.isLogging && !element.node.driver.
|
|
8
|
+
if (Rx.isLogging && !element.node.driver.isSeparator)
|
|
9
9
|
element.native.setAttribute("key", element.node.key);
|
|
10
10
|
super.initialize(element);
|
|
11
11
|
}
|
|
@@ -20,16 +20,16 @@ export class BaseHtmlDriver extends BaseDriver {
|
|
|
20
20
|
super.finalize(element, isLeader);
|
|
21
21
|
return false;
|
|
22
22
|
}
|
|
23
|
-
mount(element
|
|
23
|
+
mount(element) {
|
|
24
24
|
const native = element.native;
|
|
25
25
|
if (native) {
|
|
26
26
|
const node = element.node;
|
|
27
|
-
const sequential = node.owner.
|
|
27
|
+
const sequential = node.owner.children.isStrict;
|
|
28
28
|
const automaticNativeHost = BaseHtmlDriver.findEffectiveHtmlElementHost(element).native;
|
|
29
29
|
if (automaticNativeHost) {
|
|
30
|
-
if (sequential && !node.driver.
|
|
31
|
-
const after = BaseHtmlDriver.findPrevSiblingHtmlElement(element.node.
|
|
32
|
-
if (after === undefined || after.instance.node.driver.
|
|
30
|
+
if (sequential && !node.driver.isSeparator) {
|
|
31
|
+
const after = BaseHtmlDriver.findPrevSiblingHtmlElement(element.node.slot);
|
|
32
|
+
if (after === undefined || after.instance.node.driver.isSeparator) {
|
|
33
33
|
if (automaticNativeHost !== native.parentNode || !native.previousSibling)
|
|
34
34
|
automaticNativeHost.prepend(native);
|
|
35
35
|
}
|
|
@@ -62,10 +62,10 @@ export class BaseHtmlDriver extends BaseDriver {
|
|
|
62
62
|
}
|
|
63
63
|
static findEffectiveHtmlElementHost(element) {
|
|
64
64
|
let p = element.node.host;
|
|
65
|
-
while (p.native instanceof HTMLElement === false &&
|
|
66
|
-
p.native instanceof SVGElement === false && p !== element)
|
|
67
|
-
p = p.
|
|
68
|
-
return p;
|
|
65
|
+
while (p.slot.instance.native instanceof HTMLElement === false &&
|
|
66
|
+
p.slot.instance.native instanceof SVGElement === false && p !== element.node)
|
|
67
|
+
p = p.host;
|
|
68
|
+
return p.slot.instance;
|
|
69
69
|
}
|
|
70
70
|
static findPrevSiblingHtmlElement(ties) {
|
|
71
71
|
let p = ties.prev;
|
|
@@ -75,15 +75,15 @@ export class BaseHtmlDriver extends BaseDriver {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
export class HtmlDriver extends BaseHtmlDriver {
|
|
78
|
-
create(element
|
|
79
|
-
|
|
80
|
-
super.create(element
|
|
78
|
+
create(element) {
|
|
79
|
+
element.native = document.createElement(element.node.driver.name);
|
|
80
|
+
super.create(element);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
export class SvgDriver extends BaseHtmlDriver {
|
|
84
|
-
create(element
|
|
85
|
-
|
|
86
|
-
super.create(element
|
|
84
|
+
create(element) {
|
|
85
|
+
element.native = document.createElementNS("http://www.w3.org/2000/svg", element.node.driver.name);
|
|
86
|
+
super.create(element);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
function blink(element, priority, revision) {
|