verstak 0.95.25047 → 0.96.26001
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/components/Button.v.js +14 -12
- package/build/dist/source/components/Icon.v.js +4 -4
- package/build/dist/source/components/Image.v.js +7 -7
- package/build/dist/source/components/Input.v.js +33 -27
- package/build/dist/source/components/Markdown.v.d.ts +1 -1
- package/build/dist/source/components/Markdown.v.js +8 -4
- package/build/dist/source/components/Spinner.v.js +11 -6
- package/build/dist/source/components/Toggle.v.js +15 -14
- package/build/dist/source/core/El.d.ts +8 -6
- package/build/dist/source/core/El.js +5 -6
- package/build/dist/source/core/ElDriver.d.ts +12 -0
- package/build/dist/source/core/ElDriver.js +62 -9
- package/build/dist/source/core/Elements.d.ts +5 -7
- package/build/dist/source/core/Elements.js +36 -45
- package/build/dist/source/core/WebDriver.d.ts +1 -1
- package/build/dist/source/core/WebDriver.js +3 -3
- package/build/dist/source/core/sensors/Handlers.js +21 -19
- package/build/dist/source/html/DraggableArea.view.js +3 -3
- package/package.json +2 -2
|
@@ -1,39 +1,41 @@
|
|
|
1
1
|
import { ReactiveTreeNode, Mode, derivative } from "reactronic";
|
|
2
|
-
import { Block,
|
|
2
|
+
import { Block, OnClick } from "verstak";
|
|
3
3
|
import { rxModel } from "./common/Utils.js";
|
|
4
4
|
import { Theme } from "./Theme.js";
|
|
5
5
|
import { Icon } from "./Icon.v.js";
|
|
6
6
|
export function Button(declaration) {
|
|
7
7
|
return (Block(derivative(declaration, {
|
|
8
8
|
mode: Mode.autonomous,
|
|
9
|
-
preparation
|
|
9
|
+
preparation() {
|
|
10
10
|
var _a;
|
|
11
|
-
(_a =
|
|
11
|
+
(_a = this.model) !== null && _a !== void 0 ? _a : (this.model = rxModel({
|
|
12
12
|
icon: "fa-solid fa-square",
|
|
13
13
|
label: ReactiveTreeNode.current.key,
|
|
14
14
|
}));
|
|
15
15
|
},
|
|
16
|
-
|
|
17
|
-
const m =
|
|
16
|
+
body() {
|
|
17
|
+
const m = this.model;
|
|
18
18
|
const theme = Theme.current.button;
|
|
19
|
-
|
|
19
|
+
this.useStylingPreset(theme.main);
|
|
20
20
|
if (m.icon) {
|
|
21
21
|
Icon(m.icon, {
|
|
22
|
-
|
|
22
|
+
body(el, base) {
|
|
23
23
|
base();
|
|
24
|
-
|
|
24
|
+
this.useStylingPreset(theme.icon);
|
|
25
25
|
},
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
if (m.label) {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
Block({
|
|
30
|
+
body(el, base) {
|
|
31
31
|
base();
|
|
32
|
-
|
|
32
|
+
this.textIsFormatted = false;
|
|
33
|
+
this.text = m.label;
|
|
34
|
+
this.useStylingPreset(theme.label);
|
|
33
35
|
},
|
|
34
36
|
});
|
|
35
37
|
}
|
|
36
|
-
OnClick(
|
|
38
|
+
OnClick(this.native, m.action);
|
|
37
39
|
},
|
|
38
40
|
})));
|
|
39
41
|
}
|
|
@@ -4,11 +4,11 @@ import { Theme } from "./Theme.js";
|
|
|
4
4
|
export function Icon(name, declaration) {
|
|
5
5
|
return (Block(derivative(declaration, {
|
|
6
6
|
mode: Mode.autonomous,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
signalArgs: { name },
|
|
8
|
+
body() {
|
|
9
9
|
const theme = Theme.current.icon;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
this.useStylingPreset(name);
|
|
11
|
+
this.useStylingPreset(theme.main);
|
|
12
12
|
},
|
|
13
13
|
})));
|
|
14
14
|
}
|
|
@@ -4,15 +4,15 @@ import { rxModel } from "./common/Utils.js";
|
|
|
4
4
|
export function Image(declaration) {
|
|
5
5
|
return (Block(derivative(declaration, {
|
|
6
6
|
mode: Mode.autonomous,
|
|
7
|
-
preparation
|
|
7
|
+
preparation() {
|
|
8
8
|
var _a;
|
|
9
|
-
(_a =
|
|
9
|
+
(_a = this.model) !== null && _a !== void 0 ? _a : (this.model = rxModel({ source: undefined }));
|
|
10
10
|
},
|
|
11
|
-
|
|
12
|
-
const m =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
body() {
|
|
12
|
+
const m = this.model;
|
|
13
|
+
this.style.backgroundImage = `url(${m.source})`;
|
|
14
|
+
this.style.backgroundSize = "contain";
|
|
15
|
+
this.style.backgroundRepeat = "no-repeat";
|
|
16
16
|
},
|
|
17
17
|
})));
|
|
18
18
|
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { Mode, derivative } from "reactronic";
|
|
2
|
-
import { Block,
|
|
2
|
+
import { Block, OnFocus, rowBreak, Fragment, KeyboardModifiers, Horizontal, Vertical } from "verstak";
|
|
3
3
|
import { rxModel } from "./common/Utils.js";
|
|
4
4
|
import { Theme } from "./Theme.js";
|
|
5
5
|
import { Icon } from "./Icon.v.js";
|
|
6
6
|
export function Input(declaration) {
|
|
7
7
|
return (Block(derivative(declaration, {
|
|
8
8
|
mode: Mode.autonomous,
|
|
9
|
-
preparation
|
|
9
|
+
preparation() {
|
|
10
10
|
var _a;
|
|
11
|
-
(_a =
|
|
12
|
-
|
|
11
|
+
(_a = this.model) !== null && _a !== void 0 ? _a : (this.model = composeInputModel());
|
|
12
|
+
this.native.dataForSensor.focus = this.model;
|
|
13
13
|
},
|
|
14
|
-
|
|
15
|
-
const m =
|
|
14
|
+
body() {
|
|
15
|
+
const m = this.model;
|
|
16
16
|
const theme = Theme.current.input;
|
|
17
|
-
|
|
17
|
+
this.useStylingPreset(theme.main);
|
|
18
18
|
if (m.icon)
|
|
19
19
|
Icon(m.icon, {
|
|
20
|
-
|
|
20
|
+
body(el, base) {
|
|
21
21
|
base();
|
|
22
|
-
|
|
22
|
+
this.useStylingPreset(theme.icon);
|
|
23
23
|
},
|
|
24
24
|
});
|
|
25
25
|
InputField(m, theme);
|
|
@@ -43,22 +43,22 @@ export function composeInputModel(props) {
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
function InputField(model, styling) {
|
|
46
|
-
return (
|
|
46
|
+
return (Block({
|
|
47
47
|
key: InputField.name,
|
|
48
|
-
preparation
|
|
49
|
-
const e =
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
preparation(el, base) {
|
|
49
|
+
const e = this.native;
|
|
50
|
+
this.useStylingPreset(styling.field);
|
|
51
|
+
this.horizontally = Horizontal.stretch;
|
|
52
|
+
this.vertically = Vertical.stretch;
|
|
53
|
+
this.textIsEditable = true;
|
|
53
54
|
e.tabIndex = 0;
|
|
54
|
-
e.contentEditable = "true";
|
|
55
55
|
e.dataForSensor.focus = model;
|
|
56
56
|
base();
|
|
57
57
|
},
|
|
58
|
-
|
|
59
|
-
const e =
|
|
58
|
+
body() {
|
|
59
|
+
const e = this.native;
|
|
60
60
|
if (!model.isEditMode)
|
|
61
|
-
|
|
61
|
+
this.text = model.text;
|
|
62
62
|
Fragment(() => {
|
|
63
63
|
const keyboard = e.sensors.keyboard;
|
|
64
64
|
if (keyboard.down) {
|
|
@@ -81,25 +81,31 @@ function InputField(model, styling) {
|
|
|
81
81
|
function InputPopup(model, styling) {
|
|
82
82
|
return (Block({
|
|
83
83
|
key: InputPopup.name,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
Fragment(() => model.position =
|
|
87
|
-
const visible =
|
|
84
|
+
body() {
|
|
85
|
+
this.useStylingPreset(styling.popup);
|
|
86
|
+
Fragment(() => model.position = this.native.sensors.scroll.y);
|
|
87
|
+
const visible = this.overlayVisible = model.isEditMode;
|
|
88
88
|
if (visible) {
|
|
89
89
|
const options = model.options;
|
|
90
90
|
if (options.length > 0) {
|
|
91
91
|
for (const x of model.options) {
|
|
92
92
|
rowBreak();
|
|
93
|
-
|
|
93
|
+
Block({
|
|
94
94
|
key: x,
|
|
95
|
-
preparation
|
|
96
|
-
|
|
95
|
+
preparation() {
|
|
96
|
+
this.text = x;
|
|
97
|
+
this.contentWrapping = false;
|
|
97
98
|
},
|
|
98
99
|
});
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
else
|
|
102
|
-
|
|
103
|
+
Block({
|
|
104
|
+
key: "(nothing)",
|
|
105
|
+
body() {
|
|
106
|
+
this.text = "(nothing)";
|
|
107
|
+
},
|
|
108
|
+
});
|
|
103
109
|
}
|
|
104
110
|
},
|
|
105
111
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function Markdown(content: string): import("reactronic").ReactiveTreeNode<import("verstak").El<HTMLElement,
|
|
1
|
+
export declare function Markdown(content: string): import("reactronic").ReactiveTreeNode<import("verstak").El<HTMLElement, unknown>>;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import { JustText } from "verstak";
|
|
2
1
|
import Md from "markdown-it";
|
|
3
2
|
import * as prism from "prismjs";
|
|
3
|
+
import { Block } from "verstak";
|
|
4
4
|
export function Markdown(content) {
|
|
5
|
-
return (
|
|
6
|
-
preparation
|
|
7
|
-
|
|
5
|
+
return (Block({
|
|
6
|
+
preparation(el, base) {
|
|
7
|
+
this.contentWrapping = true;
|
|
8
8
|
base();
|
|
9
9
|
},
|
|
10
|
+
body() {
|
|
11
|
+
this.textIsFormatted = true;
|
|
12
|
+
this.text = md.render(content);
|
|
13
|
+
},
|
|
10
14
|
}));
|
|
11
15
|
}
|
|
12
16
|
const md = new Md({
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { Mode, derivative } from "reactronic";
|
|
2
|
-
import { Block
|
|
2
|
+
import { Block } from "verstak";
|
|
3
3
|
import { rxModel } from "./common/Utils.js";
|
|
4
4
|
export function Spinner(declaration) {
|
|
5
5
|
return (Block(derivative(declaration, {
|
|
6
6
|
mode: Mode.autonomous,
|
|
7
|
-
preparation
|
|
7
|
+
preparation() {
|
|
8
8
|
var _a;
|
|
9
|
-
(_a =
|
|
9
|
+
(_a = this.model) !== null && _a !== void 0 ? _a : (this.model = composeSpinnerModel());
|
|
10
10
|
},
|
|
11
|
-
|
|
12
|
-
const m =
|
|
13
|
-
m.active
|
|
11
|
+
body() {
|
|
12
|
+
const m = this.model;
|
|
13
|
+
if (m.active)
|
|
14
|
+
Block({
|
|
15
|
+
body() {
|
|
16
|
+
this.text = "loading...";
|
|
17
|
+
},
|
|
18
|
+
});
|
|
14
19
|
},
|
|
15
20
|
})));
|
|
16
21
|
}
|
|
@@ -1,42 +1,43 @@
|
|
|
1
1
|
import { ReactiveTreeNode, Mode, derivative } from "reactronic";
|
|
2
|
-
import { Block,
|
|
2
|
+
import { Block, OnClick } from "verstak";
|
|
3
3
|
import { rxModel } from "./common/Utils.js";
|
|
4
4
|
import { Theme } from "./Theme.js";
|
|
5
5
|
import { Icon } from "./Icon.v.js";
|
|
6
6
|
export function Toggle(declaration) {
|
|
7
7
|
return (Block(derivative(declaration, {
|
|
8
8
|
mode: Mode.autonomous,
|
|
9
|
-
preparation
|
|
9
|
+
preparation() {
|
|
10
10
|
var _a;
|
|
11
|
-
(_a =
|
|
11
|
+
(_a = this.model) !== null && _a !== void 0 ? _a : (this.model = rxModel({
|
|
12
12
|
label: ReactiveTreeNode.current.key,
|
|
13
13
|
checked: true,
|
|
14
14
|
color: "green"
|
|
15
15
|
}));
|
|
16
16
|
},
|
|
17
|
-
|
|
18
|
-
const m =
|
|
17
|
+
body() {
|
|
18
|
+
const m = this.model;
|
|
19
19
|
const theme = Theme.current;
|
|
20
20
|
const toggleTheme = theme.toggle;
|
|
21
|
-
|
|
21
|
+
this.useStylingPreset(toggleTheme.main);
|
|
22
22
|
Icon(`fa-solid fa-toggle-${m.checked ? "on" : "off"}`, {
|
|
23
|
-
|
|
23
|
+
body(el, base) {
|
|
24
24
|
var _a;
|
|
25
25
|
base();
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
this.useStylingPreset(toggleTheme.icon);
|
|
27
|
+
this.style.color = m.checked ? ((_a = theme.positiveColor) !== null && _a !== void 0 ? _a : "") : "";
|
|
28
28
|
},
|
|
29
29
|
});
|
|
30
30
|
if (m.label) {
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
Block({
|
|
32
|
+
body(el, base) {
|
|
33
33
|
base();
|
|
34
|
-
|
|
34
|
+
this.text = m.label;
|
|
35
|
+
this.useStylingPreset(toggleTheme.label);
|
|
35
36
|
},
|
|
36
37
|
});
|
|
37
38
|
}
|
|
38
|
-
OnClick(
|
|
39
|
-
|
|
39
|
+
OnClick(this.native, () => {
|
|
40
|
+
this.model.checked = !this.model.checked;
|
|
40
41
|
});
|
|
41
42
|
},
|
|
42
43
|
})));
|
|
@@ -16,6 +16,9 @@ export type El<T = any, M = any> = {
|
|
|
16
16
|
stretchingStrengthVertically: number | undefined;
|
|
17
17
|
contentWrapping: boolean;
|
|
18
18
|
overlayVisible: boolean | undefined;
|
|
19
|
+
text: string | undefined;
|
|
20
|
+
textIsFormatted: boolean;
|
|
21
|
+
textIsEditable: boolean;
|
|
19
22
|
sealed: Direction | undefined;
|
|
20
23
|
splitView: Direction | undefined;
|
|
21
24
|
widthPx: {
|
|
@@ -33,12 +36,11 @@ export type El<T = any, M = any> = {
|
|
|
33
36
|
export declare enum ElKind {
|
|
34
37
|
block = 0,
|
|
35
38
|
table = 1,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
native = 7
|
|
39
|
+
group = 2,
|
|
40
|
+
partition = 3,
|
|
41
|
+
splitter = 4,
|
|
42
|
+
cursor = 5,
|
|
43
|
+
native = 6
|
|
42
44
|
}
|
|
43
45
|
export type ElCoords = {
|
|
44
46
|
x1: number;
|
|
@@ -2,12 +2,11 @@ export var ElKind;
|
|
|
2
2
|
(function (ElKind) {
|
|
3
3
|
ElKind[ElKind["block"] = 0] = "block";
|
|
4
4
|
ElKind[ElKind["table"] = 1] = "table";
|
|
5
|
-
ElKind[ElKind["
|
|
6
|
-
ElKind[ElKind["
|
|
7
|
-
ElKind[ElKind["
|
|
8
|
-
ElKind[ElKind["
|
|
9
|
-
ElKind[ElKind["
|
|
10
|
-
ElKind[ElKind["native"] = 7] = "native";
|
|
5
|
+
ElKind[ElKind["group"] = 2] = "group";
|
|
6
|
+
ElKind[ElKind["partition"] = 3] = "partition";
|
|
7
|
+
ElKind[ElKind["splitter"] = 4] = "splitter";
|
|
8
|
+
ElKind[ElKind["cursor"] = 5] = "cursor";
|
|
9
|
+
ElKind[ElKind["native"] = 6] = "native";
|
|
11
10
|
})(ElKind || (ElKind = {}));
|
|
12
11
|
export var Horizontal;
|
|
13
12
|
(function (Horizontal) {
|
|
@@ -23,6 +23,9 @@ export declare class ElImpl<T extends Element = any, M = any> implements El<T, M
|
|
|
23
23
|
private _stretchingStrengthVertically;
|
|
24
24
|
private _contentWrapping;
|
|
25
25
|
private _overlayVisible;
|
|
26
|
+
private _text;
|
|
27
|
+
private _textIsFormatted;
|
|
28
|
+
private _textIsEditable;
|
|
26
29
|
private _sealed;
|
|
27
30
|
private _splitView;
|
|
28
31
|
private _hasStylingPresets;
|
|
@@ -72,6 +75,12 @@ export declare class ElImpl<T extends Element = any, M = any> implements El<T, M
|
|
|
72
75
|
set contentWrapping(value: boolean);
|
|
73
76
|
get overlayVisible(): boolean | undefined;
|
|
74
77
|
set overlayVisible(value: boolean | undefined);
|
|
78
|
+
get text(): string | undefined;
|
|
79
|
+
set text(value: string | undefined);
|
|
80
|
+
get textIsFormatted(): boolean;
|
|
81
|
+
set textIsFormatted(value: boolean);
|
|
82
|
+
get textIsEditable(): boolean;
|
|
83
|
+
set textIsEditable(value: boolean);
|
|
75
84
|
get sealed(): Direction | undefined;
|
|
76
85
|
set sealed(value: Direction | undefined);
|
|
77
86
|
get splitView(): Direction | undefined;
|
|
@@ -94,6 +103,9 @@ export declare class ElImpl<T extends Element = any, M = any> implements El<T, M
|
|
|
94
103
|
private static applyOverlayVisible;
|
|
95
104
|
static applySealed<T extends Element>(element: El<T, any>, value: Direction | undefined): void;
|
|
96
105
|
static applySplitView<T extends Element>(element: El<T, any>, value: Direction | undefined): void;
|
|
106
|
+
static applyText<T extends Element>(element: El<T, any>, value: string | undefined): void;
|
|
107
|
+
static applyTextIsFormatted<T extends Element>(element: El<T, any>, value: boolean): void;
|
|
108
|
+
static applyTextIsEditable<T extends Element>(element: El<T, any>, value: boolean): void;
|
|
97
109
|
private static applyStylingPreset;
|
|
98
110
|
}
|
|
99
111
|
export declare class ElLayoutInfo {
|
|
@@ -36,6 +36,9 @@ export class ElImpl {
|
|
|
36
36
|
this._stretchingStrengthVertically = undefined;
|
|
37
37
|
this._contentWrapping = true;
|
|
38
38
|
this._overlayVisible = undefined;
|
|
39
|
+
this._text = "";
|
|
40
|
+
this._textIsFormatted = false;
|
|
41
|
+
this._textIsEditable = false;
|
|
39
42
|
this._sealed = undefined;
|
|
40
43
|
this._splitView = undefined;
|
|
41
44
|
this._hasStylingPresets = false;
|
|
@@ -47,7 +50,7 @@ export class ElImpl {
|
|
|
47
50
|
get index() { return this.node.slot.index; }
|
|
48
51
|
get isBlock() { return this.kind === ElKind.block; }
|
|
49
52
|
get isTable() { return this.kind === ElKind.table; }
|
|
50
|
-
get isAuxiliary() { return this.kind > ElKind.
|
|
53
|
+
get isAuxiliary() { return this.kind > ElKind.table; }
|
|
51
54
|
get kind() { return this._kind; }
|
|
52
55
|
set kind(value) {
|
|
53
56
|
if (value !== this._kind || this.node.stamp >= Number.MAX_SAFE_INTEGER - 1) {
|
|
@@ -173,6 +176,27 @@ export class ElImpl {
|
|
|
173
176
|
this._overlayVisible = value;
|
|
174
177
|
}
|
|
175
178
|
}
|
|
179
|
+
get text() { return this._text; }
|
|
180
|
+
set text(value) {
|
|
181
|
+
if (value !== this._text) {
|
|
182
|
+
ElImpl.applyText(this, value);
|
|
183
|
+
this._text = value;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
get textIsFormatted() { return this._textIsFormatted; }
|
|
187
|
+
set textIsFormatted(value) {
|
|
188
|
+
if (value !== this._textIsFormatted) {
|
|
189
|
+
ElImpl.applyTextIsFormatted(this, value);
|
|
190
|
+
this._textIsFormatted = value;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
get textIsEditable() { return this._textIsEditable; }
|
|
194
|
+
set textIsEditable(value) {
|
|
195
|
+
if (value !== this._textIsEditable) {
|
|
196
|
+
ElImpl.applyTextIsEditable(this, value);
|
|
197
|
+
this._textIsEditable = value;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
176
200
|
get sealed() { return this._sealed; }
|
|
177
201
|
set sealed(value) {
|
|
178
202
|
if (value !== this._sealed) {
|
|
@@ -526,6 +550,42 @@ export class ElImpl {
|
|
|
526
550
|
});
|
|
527
551
|
}
|
|
528
552
|
}
|
|
553
|
+
static applyText(element, value) {
|
|
554
|
+
const e = element.native;
|
|
555
|
+
if (e instanceof HTMLElement) {
|
|
556
|
+
if (value) {
|
|
557
|
+
e.style.display = "inline-grid";
|
|
558
|
+
e.style.minWidth = "";
|
|
559
|
+
}
|
|
560
|
+
else {
|
|
561
|
+
e.style.display = "flex";
|
|
562
|
+
e.style.minWidth = "0";
|
|
563
|
+
}
|
|
564
|
+
if (element.textIsFormatted)
|
|
565
|
+
e.innerHTML = value !== null && value !== void 0 ? value : "";
|
|
566
|
+
else
|
|
567
|
+
e.innerText = value !== null && value !== void 0 ? value : "";
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
static applyTextIsFormatted(element, value) {
|
|
571
|
+
var _a, _b;
|
|
572
|
+
const e = element.native;
|
|
573
|
+
if (e instanceof HTMLElement) {
|
|
574
|
+
if (value)
|
|
575
|
+
e.innerHTML = (_a = element.text) !== null && _a !== void 0 ? _a : "";
|
|
576
|
+
else
|
|
577
|
+
e.innerText = (_b = element.text) !== null && _b !== void 0 ? _b : "";
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
static applyTextIsEditable(element, value) {
|
|
581
|
+
const e = element.native;
|
|
582
|
+
if (e instanceof HTMLElement) {
|
|
583
|
+
if (value)
|
|
584
|
+
e.contentEditable = "true";
|
|
585
|
+
else
|
|
586
|
+
e.contentEditable = "";
|
|
587
|
+
}
|
|
588
|
+
}
|
|
529
589
|
static applyStylingPreset(element, secondary, styleName, enabled) {
|
|
530
590
|
const native = element.native;
|
|
531
591
|
enabled !== null && enabled !== void 0 ? enabled : (enabled = true);
|
|
@@ -708,7 +768,7 @@ export const Constants = {
|
|
|
708
768
|
wrapper: "wrapper",
|
|
709
769
|
splitter: "splitter",
|
|
710
770
|
group: "group",
|
|
711
|
-
layouts: ["block", "table", "
|
|
771
|
+
layouts: ["block", "table", "group", "", "", ""],
|
|
712
772
|
keyAttrName: "key",
|
|
713
773
|
kindAttrName: "kind",
|
|
714
774
|
ownReactiveTreeNodeKey: Symbol("own-reactive-tree-node"),
|
|
@@ -734,13 +794,6 @@ const DriversByLayout = [
|
|
|
734
794
|
s.gridAutoColumns = "minmax(min-content, 1fr)";
|
|
735
795
|
s.textAlign = "initial";
|
|
736
796
|
},
|
|
737
|
-
el => {
|
|
738
|
-
const owner = el.node.owner.element;
|
|
739
|
-
const s = el.style;
|
|
740
|
-
s.alignSelf = owner.isTable ? "stretch" : "center";
|
|
741
|
-
s.display = "inline-grid";
|
|
742
|
-
s.flexShrink = "1";
|
|
743
|
-
},
|
|
744
797
|
el => {
|
|
745
798
|
const s = el.style;
|
|
746
799
|
s.display = "contents";
|
|
@@ -14,25 +14,23 @@ export declare function Splitter<M = unknown>(declaration?: ReactiveTreeNodeDecl
|
|
|
14
14
|
export declare function rowBreak(shiftCursorDown?: number): void;
|
|
15
15
|
export declare function declareSplitter<T>(index: number, splitViewNode: ReactiveTreeNode<El<T>>): ReactiveTreeNode<El<HTMLElement>>;
|
|
16
16
|
export declare function cursor(place: ElPlace): void;
|
|
17
|
-
export declare function
|
|
18
|
-
export declare function Group<M = unknown>(script?: Script<El<HTMLElement, M>>, scriptAsync?: ScriptAsync<El<HTMLElement, M>>, key?: string, mode?: Mode, preparation?: Script<El<HTMLElement, M>>, preparationAsync?: ScriptAsync<El<HTMLElement, M>>, finalization?: Script<El<HTMLElement, M>>, triggers?: unknown, basis?: ReactiveTreeNodeDecl<El<HTMLElement, M>>): ReactiveTreeNode<El<HTMLElement, M>>;
|
|
17
|
+
export declare function Group<M = unknown>(body?: Script<El<HTMLElement, M>>, bodyTask?: ScriptAsync<El<HTMLElement, M>>, key?: string, mode?: Mode, preparation?: Script<El<HTMLElement, M>>, preparationAsync?: ScriptAsync<El<HTMLElement, M>>, finalization?: Script<El<HTMLElement, M>>, triggers?: unknown, basis?: ReactiveTreeNodeDecl<El<HTMLElement, M>>): ReactiveTreeNode<El<HTMLElement, M>>;
|
|
19
18
|
export declare function Group<M = unknown>(declaration?: ReactiveTreeNodeDecl<El<HTMLElement, M>>): ReactiveTreeNode<El<HTMLElement, M>>;
|
|
20
|
-
export declare function Fragment<M = unknown>(
|
|
21
|
-
export declare function PseudoElement<M = unknown>(
|
|
19
|
+
export declare function Fragment<M = unknown>(body: Script<El<void, M>>): ReactiveTreeNode<El<void, M>>;
|
|
20
|
+
export declare function PseudoElement<M = unknown>(body?: Script<El<void, M>>, bodyTask?: ScriptAsync<El<void, M>>, key?: string, mode?: Mode, preparation?: Script<El<void, M>>, preparationAsync?: ScriptAsync<El<void, M>>, finalization?: Script<El<void, M>>, triggers?: unknown, basis?: ReactiveTreeNodeDecl<El<void, M>>): ReactiveTreeNode<El<void, M>>;
|
|
22
21
|
export declare function PseudoElement<M = unknown>(declaration?: ReactiveTreeNodeDecl<El<void, M>>): ReactiveTreeNode<El<void, M>>;
|
|
23
22
|
export declare class BlockDriver<T extends HTMLElement> extends HtmlDriver<T> {
|
|
24
|
-
|
|
23
|
+
buildBody(node: ReactiveTreeNode<El<T>>): void | Promise<void>;
|
|
25
24
|
declareChild(ownerNode: ReactiveTreeNode<El<T, any>>, childDriver: ReactiveTreeNodeDriver<any>, childDeclaration?: ReactiveTreeNodeDecl<any> | undefined, childBasis?: ReactiveTreeNodeDecl<any> | undefined): LinkedItem<ReactiveTreeNode> | undefined;
|
|
26
25
|
}
|
|
27
26
|
export declare function isSplitViewPartition(childDriver: ReactiveTreeNodeDriver): boolean;
|
|
28
27
|
export declare class PartitionDriver<T extends HTMLElement> extends HtmlDriver<T> {
|
|
29
|
-
|
|
28
|
+
buildBody(node: ReactiveTreeNode<El<T>>): void | Promise<void>;
|
|
30
29
|
provideHost(node: ReactiveTreeNode<El<T, any>>): ReactiveTreeNode<El<T, any>>;
|
|
31
30
|
}
|
|
32
31
|
export declare const Drivers: {
|
|
33
32
|
block: BlockDriver<HTMLElement>;
|
|
34
33
|
table: HtmlDriver<HTMLElement, any>;
|
|
35
|
-
text: HtmlDriver<HTMLElement, any>;
|
|
36
34
|
group: HtmlDriver<HTMLElement, any>;
|
|
37
35
|
partition: PartitionDriver<HTMLElement>;
|
|
38
36
|
wrapper: HtmlDriver<HTMLElement, any>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactiveTreeNode, Mode, declare,
|
|
1
|
+
import { ReactiveTreeNode, Mode, declare, launch, runNonReactive } from "reactronic";
|
|
2
2
|
import { ElKind, Direction } from "./El.js";
|
|
3
3
|
import { clamp } from "./ElUtils.js";
|
|
4
4
|
import { Constants, CursorCommandDriver, ElDriver, ElLayoutInfo, InitialElLayoutInfo } from "./ElDriver.js";
|
|
@@ -30,10 +30,12 @@ export function declareSplitter(index, splitViewNode) {
|
|
|
30
30
|
return (Splitter({
|
|
31
31
|
key,
|
|
32
32
|
mode: Mode.autonomous,
|
|
33
|
-
preparation
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
preparation() {
|
|
34
|
+
this.native.className = `splitter ${key}`;
|
|
35
|
+
},
|
|
36
|
+
body() {
|
|
37
|
+
const e = this.native;
|
|
38
|
+
const model = this.model;
|
|
37
39
|
const dataForSensor = e.dataForSensor;
|
|
38
40
|
dataForSensor.draggable = key;
|
|
39
41
|
dataForSensor.drag = key;
|
|
@@ -80,35 +82,25 @@ export function declareSplitter(index, splitViewNode) {
|
|
|
80
82
|
}
|
|
81
83
|
export function cursor(place) {
|
|
82
84
|
declare(Drivers.cursor, {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
+
body() {
|
|
86
|
+
this.place = place;
|
|
85
87
|
},
|
|
86
88
|
});
|
|
87
89
|
}
|
|
88
|
-
export function
|
|
89
|
-
return declare(Drivers.
|
|
90
|
-
script: el => {
|
|
91
|
-
if (formatted)
|
|
92
|
-
el.native.innerHTML = content;
|
|
93
|
-
else
|
|
94
|
-
el.native.innerText = content;
|
|
95
|
-
},
|
|
96
|
-
}));
|
|
97
|
-
}
|
|
98
|
-
export function Group(scriptOrDeclaration, scriptAsync, key, mode, preparation, preparationAsync, finalization, triggers, basis) {
|
|
99
|
-
return declare(Drivers.group, scriptOrDeclaration, scriptAsync, key, mode, preparation, preparationAsync, finalization, triggers, basis);
|
|
90
|
+
export function Group(bodyOrDeclaration, bodyTask, key, mode, preparation, preparationAsync, finalization, triggers, basis) {
|
|
91
|
+
return declare(Drivers.group, bodyOrDeclaration, bodyTask, key, mode, preparation, preparationAsync, finalization, triggers, basis);
|
|
100
92
|
}
|
|
101
|
-
export function Fragment(
|
|
102
|
-
return PseudoElement({ mode: Mode.autonomous,
|
|
93
|
+
export function Fragment(body) {
|
|
94
|
+
return PseudoElement({ mode: Mode.autonomous, body });
|
|
103
95
|
}
|
|
104
|
-
export function PseudoElement(
|
|
105
|
-
return declare(Drivers.pseudo,
|
|
96
|
+
export function PseudoElement(bodyOrDeclaration, bodyTask, key, mode, preparation, preparationAsync, finalization, triggers, basis) {
|
|
97
|
+
return declare(Drivers.pseudo, bodyOrDeclaration, bodyTask, key, mode, preparation, preparationAsync, finalization, triggers, basis);
|
|
106
98
|
}
|
|
107
99
|
export class BlockDriver extends HtmlDriver {
|
|
108
|
-
|
|
100
|
+
buildBody(node) {
|
|
109
101
|
rowBreak();
|
|
110
102
|
const el = node.element;
|
|
111
|
-
const result = super.
|
|
103
|
+
const result = super.buildBody(node);
|
|
112
104
|
if (el.splitView !== undefined) {
|
|
113
105
|
if (el.layoutInfo === undefined)
|
|
114
106
|
el.layoutInfo = new ElLayoutInfo(InitialElLayoutInfo);
|
|
@@ -128,7 +120,7 @@ export class BlockDriver extends HtmlDriver {
|
|
|
128
120
|
});
|
|
129
121
|
const relayoutEl = PseudoElement({
|
|
130
122
|
mode: Mode.autonomous,
|
|
131
|
-
|
|
123
|
+
body() {
|
|
132
124
|
const native = el.native;
|
|
133
125
|
const isHorizontal = el.splitView === Direction.horizontal;
|
|
134
126
|
if (layoutInfo.isUpdateFinished) {
|
|
@@ -192,10 +184,10 @@ export class BlockDriver extends HtmlDriver {
|
|
|
192
184
|
}
|
|
193
185
|
const isHorizontal = el.splitView === Direction.horizontal;
|
|
194
186
|
if (childDeclaration !== undefined) {
|
|
195
|
-
if (childDeclaration.
|
|
196
|
-
childDeclaration.
|
|
197
|
-
Object.defineProperty(childDeclaration.
|
|
198
|
-
overrideMethod(childDeclaration, "
|
|
187
|
+
if (childDeclaration.signalArgs === undefined)
|
|
188
|
+
childDeclaration.signalArgs = {};
|
|
189
|
+
Object.defineProperty(childDeclaration.signalArgs, "index", { value: partCount });
|
|
190
|
+
overrideMethod(childDeclaration, "body", el => {
|
|
199
191
|
if (isHorizontal)
|
|
200
192
|
el.style.gridColumn = `${partCount + 1}`;
|
|
201
193
|
else
|
|
@@ -226,32 +218,32 @@ function overrideMethod(declaration, method, func) {
|
|
|
226
218
|
: (el, base) => { base(); func.call(el, el); };
|
|
227
219
|
}
|
|
228
220
|
export class PartitionDriver extends HtmlDriver {
|
|
229
|
-
|
|
230
|
-
const result = super.
|
|
221
|
+
buildBody(node) {
|
|
222
|
+
const result = super.buildBody(node);
|
|
231
223
|
const ownerEl = node.owner.element;
|
|
232
224
|
if (ownerEl.sealed !== undefined) {
|
|
233
225
|
node.element.style.flexGrow = "1";
|
|
234
226
|
declare(Drivers.wrapper, {
|
|
235
|
-
|
|
236
|
-
const ownerEl =
|
|
227
|
+
body() {
|
|
228
|
+
const ownerEl = this.node.owner.owner.element;
|
|
237
229
|
if (ownerEl.splitView !== undefined) {
|
|
238
|
-
|
|
239
|
-
|
|
230
|
+
this.style.display = "grid";
|
|
231
|
+
this.style.flexDirection = "";
|
|
240
232
|
}
|
|
241
233
|
else {
|
|
242
234
|
if (ownerEl.isTable) {
|
|
243
|
-
|
|
244
|
-
|
|
235
|
+
this.style.display = "contents";
|
|
236
|
+
this.style.flexDirection = "";
|
|
245
237
|
}
|
|
246
238
|
else {
|
|
247
|
-
|
|
248
|
-
|
|
239
|
+
this.style.display = "flex";
|
|
240
|
+
this.style.flexDirection = "row";
|
|
249
241
|
}
|
|
250
242
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
243
|
+
this.style.position = "absolute";
|
|
244
|
+
this.style.inset = "0";
|
|
245
|
+
this.style.overflow = "auto";
|
|
246
|
+
this.style.gap = "inherit";
|
|
255
247
|
},
|
|
256
248
|
});
|
|
257
249
|
}
|
|
@@ -270,7 +262,6 @@ export class PartitionDriver extends HtmlDriver {
|
|
|
270
262
|
export const Drivers = {
|
|
271
263
|
block: new BlockDriver(Constants.element, false, el => el.kind = ElKind.block),
|
|
272
264
|
table: new HtmlDriver(Constants.element, false, el => el.kind = ElKind.table),
|
|
273
|
-
text: new HtmlDriver(Constants.element, false, el => el.kind = ElKind.text),
|
|
274
265
|
group: new HtmlDriver(Constants.group, false, el => el.kind = ElKind.group),
|
|
275
266
|
partition: new PartitionDriver(Constants.partition, true, el => el.kind = ElKind.partition),
|
|
276
267
|
wrapper: new HtmlDriver(Constants.wrapper, false, el => el.kind = ElKind.native),
|
|
@@ -6,7 +6,7 @@ export declare class WebDriver<T extends Element, M = unknown> extends ElDriver<
|
|
|
6
6
|
runPreparation(node: ReactiveTreeNode<El<T, M>>): void | Promise<void>;
|
|
7
7
|
runFinalization(node: ReactiveTreeNode<El<T, M>>, isLeader: boolean): boolean;
|
|
8
8
|
runMount(node: ReactiveTreeNode<El<T, M>>): void;
|
|
9
|
-
|
|
9
|
+
buildBody(node: ReactiveTreeNode<El<T, M>>): void | Promise<void>;
|
|
10
10
|
private assignExtraAttributesAndProperties;
|
|
11
11
|
private clearExtraAttributesAndProperties;
|
|
12
12
|
static getOwnNodeOfNativeElement<T extends Element>(element: T): ReactiveTreeNode<El<T>> | undefined;
|
|
@@ -57,11 +57,11 @@ export class WebDriver extends ElDriver {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
buildBody(node) {
|
|
61
61
|
const el = node.element;
|
|
62
62
|
if (el instanceof ElImpl)
|
|
63
63
|
el.prepareForUpdate();
|
|
64
|
-
let result = super.
|
|
64
|
+
let result = super.buildBody(node);
|
|
65
65
|
result = proceedSyncOrAsync(result, v => {
|
|
66
66
|
if (el.place === undefined) {
|
|
67
67
|
const oel = node.owner.element;
|
|
@@ -69,7 +69,7 @@ export class WebDriver extends ElDriver {
|
|
|
69
69
|
el.place = undefined;
|
|
70
70
|
}
|
|
71
71
|
if (gBlinkingEffectMarker)
|
|
72
|
-
blink(el.native, ReactiveTreeNode.
|
|
72
|
+
blink(el.native, ReactiveTreeNode.currentBodyPriority, node.stamp);
|
|
73
73
|
}, e => {
|
|
74
74
|
});
|
|
75
75
|
return result;
|
|
@@ -14,8 +14,8 @@ export function OnClick(target, action, key) {
|
|
|
14
14
|
PseudoElement({
|
|
15
15
|
key,
|
|
16
16
|
mode: Mode.autonomous,
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
signalArgs: { target },
|
|
18
|
+
body() {
|
|
19
19
|
const pointer = target.sensors.pointer;
|
|
20
20
|
if (target.dataForSensor.click !== undefined && pointer.clicked === target.dataForSensor.click || target.dataForSensor.click === undefined && pointer.clicked) {
|
|
21
21
|
if (action instanceof Function) {
|
|
@@ -34,18 +34,20 @@ export function OnClickAsync(target, action, key) {
|
|
|
34
34
|
PseudoElement({
|
|
35
35
|
key,
|
|
36
36
|
mode: Mode.autonomous,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (
|
|
42
|
-
|
|
37
|
+
signalArgs: { target },
|
|
38
|
+
bodyTask() {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const pointer = target.sensors.pointer;
|
|
41
|
+
if (target.dataForSensor.click !== undefined && pointer.clicked === target.dataForSensor.click || target.dataForSensor.click === undefined && pointer.clicked) {
|
|
42
|
+
if (action instanceof Function) {
|
|
43
|
+
yield runNonReactive(() => action(pointer));
|
|
44
|
+
}
|
|
45
|
+
else if (action instanceof ToggleRef) {
|
|
46
|
+
runNonReactive(() => action.toggle());
|
|
47
|
+
}
|
|
43
48
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}),
|
|
49
|
+
});
|
|
50
|
+
},
|
|
49
51
|
});
|
|
50
52
|
}
|
|
51
53
|
}
|
|
@@ -54,8 +56,8 @@ export function OnResize(target, action, key) {
|
|
|
54
56
|
PseudoElement({
|
|
55
57
|
key,
|
|
56
58
|
mode: Mode.autonomous,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
signalArgs: { target },
|
|
60
|
+
body() {
|
|
59
61
|
const resize = target.sensors.resize;
|
|
60
62
|
resize.resizedElements.forEach(x => {
|
|
61
63
|
action(x);
|
|
@@ -68,11 +70,11 @@ export function OnFocus(target, model, switchEditMode = undefined, key) {
|
|
|
68
70
|
PseudoElement({
|
|
69
71
|
key,
|
|
70
72
|
mode: Mode.autonomous,
|
|
71
|
-
|
|
72
|
-
preparation
|
|
73
|
-
|
|
73
|
+
signalArgs: { target, model },
|
|
74
|
+
preparation() {
|
|
75
|
+
this.node.configureReactivity({ throttling: 0 });
|
|
74
76
|
},
|
|
75
|
-
|
|
77
|
+
body() {
|
|
76
78
|
if (switchEditMode === undefined && !(target instanceof HTMLInputElement || target.hasAttribute("tabindex")))
|
|
77
79
|
console.warn(`"${key !== null && key !== void 0 ? key : "noname"}" element must have "tabindex" attribute set in order to be focusable`);
|
|
78
80
|
if (switchEditMode !== undefined) {
|
|
@@ -4,9 +4,9 @@ import { Fragment } from "../core/Elements.js";
|
|
|
4
4
|
export function DraggableArea(draggingId, builder) {
|
|
5
5
|
return (Div(derivative(builder, {
|
|
6
6
|
mode: Mode.autonomous,
|
|
7
|
-
|
|
8
|
-
const e =
|
|
9
|
-
const model =
|
|
7
|
+
body() {
|
|
8
|
+
const e = this.native;
|
|
9
|
+
const model = this.model;
|
|
10
10
|
const dataForSensor = e.dataForSensor;
|
|
11
11
|
dataForSensor.draggable = draggingId;
|
|
12
12
|
dataForSensor.drag = draggingId;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "verstak",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.96.26001",
|
|
4
4
|
"description": "Verstak - Front-End Library",
|
|
5
5
|
"publisher": "Nezaboodka Software",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"markdown-it": "^14.1.0",
|
|
43
43
|
"markdown-it-prism": "^2.3.0",
|
|
44
44
|
"prismjs": "^1.30.0",
|
|
45
|
-
"reactronic": "^0.
|
|
45
|
+
"reactronic": "^0.96.26001"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/markdown-it": "14.1.2",
|