verstak 0.24.501 → 0.24.508
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/api.d.ts +1 -1
- package/build/dist/source/api.js +1 -1
- package/build/dist/source/core/El.d.ts +78 -0
- package/build/dist/source/core/El.js +32 -0
- package/build/dist/source/{html/El.d.ts → core/ElDriver.d.ts} +2 -78
- package/build/dist/source/{html/El.js → core/ElDriver.js} +10 -41
- package/build/dist/source/{html → core}/Elements.d.ts +5 -2
- package/build/dist/source/{html → core}/Elements.js +8 -3
- package/build/dist/source/{html → core}/SplitViewMath.d.ts +1 -1
- package/build/dist/source/{html/HtmlDriver.d.ts → core/WebDriver.d.ts} +2 -1
- package/build/dist/source/{html/HtmlDriver.js → core/WebDriver.js} +1 -1
- package/build/dist/source/core/api.d.ts +7 -0
- package/build/dist/source/core/api.js +7 -0
- package/build/dist/source/express/Button.v.d.ts +8 -0
- package/build/dist/source/express/Button.v.js +39 -0
- package/build/dist/source/express/Field.v.d.ts +16 -0
- package/build/dist/source/express/Field.v.js +118 -0
- package/build/dist/source/express/Icon.v.d.ts +3 -0
- package/build/dist/source/express/Icon.v.js +14 -0
- package/build/dist/source/express/Image.v.d.ts +6 -0
- package/build/dist/source/express/Image.v.js +18 -0
- package/build/dist/source/express/Markdown.v.d.ts +1 -0
- package/build/dist/source/express/Markdown.v.js +18 -0
- package/build/dist/source/express/Spinner.v.d.ts +9 -0
- package/build/dist/source/express/Spinner.v.js +23 -0
- package/build/dist/source/express/Theme.d.ts +34 -0
- package/build/dist/source/express/Theme.js +30 -0
- package/build/dist/source/express/Toggle.v.d.ts +8 -0
- package/build/dist/source/express/Toggle.v.js +40 -0
- package/build/dist/source/express/api.d.ts +9 -0
- package/build/dist/source/express/api.js +9 -0
- package/build/dist/source/express/common/Utils.d.ts +5 -0
- package/build/dist/source/express/common/Utils.js +26 -0
- package/build/dist/source/express/theme/Button.s.d.ts +11 -0
- package/build/dist/source/express/theme/Button.s.js +49 -0
- package/build/dist/source/express/theme/Field.s.d.ts +13 -0
- package/build/dist/source/express/theme/Field.s.js +68 -0
- package/build/dist/source/express/theme/Icon.s.d.ts +7 -0
- package/build/dist/source/express/theme/Icon.s.js +26 -0
- package/build/dist/source/express/theme/Styling.d.ts +16 -0
- package/build/dist/source/express/theme/Styling.js +20 -0
- package/build/dist/source/express/theme/Toggle.s.d.ts +11 -0
- package/build/dist/source/express/theme/Toggle.s.js +48 -0
- package/build/dist/source/html/DraggableArea.view.d.ts +2 -2
- package/build/dist/source/html/DraggableArea.view.js +1 -1
- package/build/dist/source/html/HtmlApiExt.d.ts +2 -2
- package/build/dist/source/html/HtmlApiExt.js +2 -2
- package/build/dist/source/html/HtmlElements.d.ts +2 -4
- package/build/dist/source/html/HtmlElements.js +2 -6
- package/build/dist/source/html/api.d.ts +0 -19
- package/build/dist/source/html/api.js +0 -19
- package/build/dist/source/{html/sensors → sensors}/FocusSensor.js +1 -1
- package/build/dist/source/{html → sensors}/Handlers.d.ts +3 -3
- package/build/dist/source/{html → sensors}/Handlers.js +1 -1
- package/build/dist/source/{html/sensors → sensors}/ResizeSensor.d.ts +1 -1
- package/build/dist/source/{html/sensors → sensors}/WindowSensor.js +1 -1
- package/build/dist/source/sensors/api.d.ts +13 -0
- package/build/dist/source/sensors/api.js +13 -0
- package/package.json +16 -4
- package/build/dist/source/{html → core}/ElUtils.d.ts +0 -0
- package/build/dist/source/{html → core}/ElUtils.js +0 -0
- package/build/dist/source/{html → core}/Sizes.d.ts +0 -0
- package/build/dist/source/{html → core}/Sizes.js +0 -0
- package/build/dist/source/{html → core}/SplitViewMath.js +1 -1
- /package/build/dist/source/{html/sensors → sensors}/BasePointerSensor.d.ts +0 -0
- /package/build/dist/source/{html/sensors → sensors}/BasePointerSensor.js +0 -0
- /package/build/dist/source/{html/sensors → sensors}/ButtonSensor.d.ts +0 -0
- /package/build/dist/source/{html/sensors → sensors}/ButtonSensor.js +0 -0
- /package/build/dist/source/{html/sensors → sensors}/DataForSensor.d.ts +0 -0
- /package/build/dist/source/{html/sensors → sensors}/DataForSensor.js +0 -0
- /package/build/dist/source/{html/sensors → sensors}/FocusSensor.d.ts +0 -0
- /package/build/dist/source/{html/sensors → sensors}/HoverSensor.d.ts +0 -0
- /package/build/dist/source/{html/sensors → sensors}/HoverSensor.js +0 -0
- /package/build/dist/source/{html/sensors → sensors}/HtmlDragSensor.d.ts +0 -0
- /package/build/dist/source/{html/sensors → sensors}/HtmlDragSensor.js +0 -0
- /package/build/dist/source/{html/sensors → sensors}/HtmlElementSensor.d.ts +0 -0
- /package/build/dist/source/{html/sensors → sensors}/HtmlElementSensor.js +0 -0
- /package/build/dist/source/{html/sensors → sensors}/HtmlSensors.d.ts +0 -0
- /package/build/dist/source/{html/sensors → sensors}/HtmlSensors.js +0 -0
- /package/build/dist/source/{html/sensors → sensors}/KeyboardSensor.d.ts +0 -0
- /package/build/dist/source/{html/sensors → sensors}/KeyboardSensor.js +0 -0
- /package/build/dist/source/{html/sensors → sensors}/PointerSensor.d.ts +0 -0
- /package/build/dist/source/{html/sensors → sensors}/PointerSensor.js +0 -0
- /package/build/dist/source/{html/sensors → sensors}/ResizeSensor.js +0 -0
- /package/build/dist/source/{html/sensors → sensors}/ScrollSensor.d.ts +0 -0
- /package/build/dist/source/{html/sensors → sensors}/ScrollSensor.js +0 -0
- /package/build/dist/source/{html/sensors → sensors}/Sensor.d.ts +0 -0
- /package/build/dist/source/{html/sensors → sensors}/Sensor.js +0 -0
- /package/build/dist/source/{html/sensors → sensors}/WheelSensor.d.ts +0 -0
- /package/build/dist/source/{html/sensors → sensors}/WheelSensor.js +0 -0
- /package/build/dist/source/{html/sensors → sensors}/WindowSensor.d.ts +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from "./core/api.js";
|
|
2
|
-
export * from "./
|
|
2
|
+
export * from "./sensors/api.js";
|
package/build/dist/source/api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from "./core/api.js";
|
|
2
|
-
export * from "./
|
|
2
|
+
export * from "./sensors/api.js";
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ReactiveNode } from "reactronic";
|
|
2
|
+
export type El<T = any, M = any> = {
|
|
3
|
+
readonly node: ReactiveNode<El<T, M>>;
|
|
4
|
+
readonly index: number;
|
|
5
|
+
native: T;
|
|
6
|
+
model: M;
|
|
7
|
+
kind: ElKind;
|
|
8
|
+
place: ElPlace;
|
|
9
|
+
width: Range;
|
|
10
|
+
height: Range;
|
|
11
|
+
horizontally: Horizontal | undefined;
|
|
12
|
+
contentHorizontally: Horizontal | undefined;
|
|
13
|
+
vertically: Vertical | undefined;
|
|
14
|
+
contentVertically: Vertical | undefined;
|
|
15
|
+
stretchingStrengthHorizontally: number | undefined;
|
|
16
|
+
stretchingStrengthVertically: number | undefined;
|
|
17
|
+
contentWrapping: boolean;
|
|
18
|
+
overlayVisible: boolean | undefined;
|
|
19
|
+
sealed: Direction | undefined;
|
|
20
|
+
splitView: Direction | undefined;
|
|
21
|
+
widthPx: {
|
|
22
|
+
minPx: number;
|
|
23
|
+
maxPx: number;
|
|
24
|
+
};
|
|
25
|
+
heightPx: {
|
|
26
|
+
minPx: number;
|
|
27
|
+
maxPx: number;
|
|
28
|
+
};
|
|
29
|
+
partitionSizeInSplitViewPx: number;
|
|
30
|
+
readonly style: CSSStyleDeclaration;
|
|
31
|
+
useStylingPreset(stylingPresetName: string, enabled?: boolean): void;
|
|
32
|
+
};
|
|
33
|
+
export declare enum ElKind {
|
|
34
|
+
panel = 0,
|
|
35
|
+
table = 1,
|
|
36
|
+
note = 2,
|
|
37
|
+
group = 3,
|
|
38
|
+
part = 4,
|
|
39
|
+
splitter = 5,
|
|
40
|
+
cursor = 6,
|
|
41
|
+
native = 7
|
|
42
|
+
}
|
|
43
|
+
export type ElCoords = {
|
|
44
|
+
x1: number;
|
|
45
|
+
y1: number;
|
|
46
|
+
x2: number;
|
|
47
|
+
y2: number;
|
|
48
|
+
};
|
|
49
|
+
export declare enum Horizontal {
|
|
50
|
+
left = 0,
|
|
51
|
+
center = 1,
|
|
52
|
+
right = 2,
|
|
53
|
+
stretch = 3,
|
|
54
|
+
stretchAndFix = 4
|
|
55
|
+
}
|
|
56
|
+
export declare enum Vertical {
|
|
57
|
+
top = 0,
|
|
58
|
+
center = 1,
|
|
59
|
+
bottom = 2,
|
|
60
|
+
stretch = 3,
|
|
61
|
+
stretchAndFix = 4
|
|
62
|
+
}
|
|
63
|
+
export type Range = {
|
|
64
|
+
readonly min?: string;
|
|
65
|
+
readonly max?: string;
|
|
66
|
+
preferred?: string;
|
|
67
|
+
};
|
|
68
|
+
export type MarkedRange = Range & {
|
|
69
|
+
readonly marker?: string;
|
|
70
|
+
};
|
|
71
|
+
export type ElPlace = undefined | string | {
|
|
72
|
+
cellsOverWidth?: number;
|
|
73
|
+
cellsOverHeight?: number;
|
|
74
|
+
};
|
|
75
|
+
export declare enum Direction {
|
|
76
|
+
horizontal = 0,
|
|
77
|
+
vertical = 1
|
|
78
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export var ElKind;
|
|
2
|
+
(function (ElKind) {
|
|
3
|
+
ElKind[ElKind["panel"] = 0] = "panel";
|
|
4
|
+
ElKind[ElKind["table"] = 1] = "table";
|
|
5
|
+
ElKind[ElKind["note"] = 2] = "note";
|
|
6
|
+
ElKind[ElKind["group"] = 3] = "group";
|
|
7
|
+
ElKind[ElKind["part"] = 4] = "part";
|
|
8
|
+
ElKind[ElKind["splitter"] = 5] = "splitter";
|
|
9
|
+
ElKind[ElKind["cursor"] = 6] = "cursor";
|
|
10
|
+
ElKind[ElKind["native"] = 7] = "native";
|
|
11
|
+
})(ElKind || (ElKind = {}));
|
|
12
|
+
export var Horizontal;
|
|
13
|
+
(function (Horizontal) {
|
|
14
|
+
Horizontal[Horizontal["left"] = 0] = "left";
|
|
15
|
+
Horizontal[Horizontal["center"] = 1] = "center";
|
|
16
|
+
Horizontal[Horizontal["right"] = 2] = "right";
|
|
17
|
+
Horizontal[Horizontal["stretch"] = 3] = "stretch";
|
|
18
|
+
Horizontal[Horizontal["stretchAndFix"] = 4] = "stretchAndFix";
|
|
19
|
+
})(Horizontal || (Horizontal = {}));
|
|
20
|
+
export var Vertical;
|
|
21
|
+
(function (Vertical) {
|
|
22
|
+
Vertical[Vertical["top"] = 0] = "top";
|
|
23
|
+
Vertical[Vertical["center"] = 1] = "center";
|
|
24
|
+
Vertical[Vertical["bottom"] = 2] = "bottom";
|
|
25
|
+
Vertical[Vertical["stretch"] = 3] = "stretch";
|
|
26
|
+
Vertical[Vertical["stretchAndFix"] = 4] = "stretchAndFix";
|
|
27
|
+
})(Vertical || (Vertical = {}));
|
|
28
|
+
export var Direction;
|
|
29
|
+
(function (Direction) {
|
|
30
|
+
Direction[Direction["horizontal"] = 0] = "horizontal";
|
|
31
|
+
Direction[Direction["vertical"] = 1] = "vertical";
|
|
32
|
+
})(Direction || (Direction = {}));
|
|
@@ -1,83 +1,7 @@
|
|
|
1
1
|
import { ReactiveNode, BaseDriver } from "reactronic";
|
|
2
|
-
|
|
3
|
-
readonly node: ReactiveNode<El<T, M>>;
|
|
4
|
-
readonly index: number;
|
|
5
|
-
native: T;
|
|
6
|
-
model: M;
|
|
7
|
-
kind: ElKind;
|
|
8
|
-
place: ElPlace;
|
|
9
|
-
width: Range;
|
|
10
|
-
height: Range;
|
|
11
|
-
horizontally: Horizontal | undefined;
|
|
12
|
-
contentHorizontally: Horizontal | undefined;
|
|
13
|
-
vertically: Vertical | undefined;
|
|
14
|
-
contentVertically: Vertical | undefined;
|
|
15
|
-
stretchingStrengthHorizontally: number | undefined;
|
|
16
|
-
stretchingStrengthVertically: number | undefined;
|
|
17
|
-
contentWrapping: boolean;
|
|
18
|
-
overlayVisible: boolean | undefined;
|
|
19
|
-
sealed: Direction | undefined;
|
|
20
|
-
splitView: Direction | undefined;
|
|
21
|
-
widthPx: {
|
|
22
|
-
minPx: number;
|
|
23
|
-
maxPx: number;
|
|
24
|
-
};
|
|
25
|
-
heightPx: {
|
|
26
|
-
minPx: number;
|
|
27
|
-
maxPx: number;
|
|
28
|
-
};
|
|
29
|
-
partitionSizeInSplitViewPx: number;
|
|
30
|
-
readonly style: CSSStyleDeclaration;
|
|
31
|
-
useStylingPreset(stylingPresetName: string, enabled?: boolean): void;
|
|
32
|
-
};
|
|
33
|
-
export declare enum ElKind {
|
|
34
|
-
panel = 0,
|
|
35
|
-
table = 1,
|
|
36
|
-
note = 2,
|
|
37
|
-
group = 3,
|
|
38
|
-
part = 4,
|
|
39
|
-
splitter = 5,
|
|
40
|
-
cursor = 6,
|
|
41
|
-
native = 7
|
|
42
|
-
}
|
|
43
|
-
export type ElCoords = {
|
|
44
|
-
x1: number;
|
|
45
|
-
y1: number;
|
|
46
|
-
x2: number;
|
|
47
|
-
y2: number;
|
|
48
|
-
};
|
|
49
|
-
export declare enum Horizontal {
|
|
50
|
-
left = 0,
|
|
51
|
-
center = 1,
|
|
52
|
-
right = 2,
|
|
53
|
-
stretch = 3,
|
|
54
|
-
stretchAndFix = 4
|
|
55
|
-
}
|
|
56
|
-
export declare enum Vertical {
|
|
57
|
-
top = 0,
|
|
58
|
-
center = 1,
|
|
59
|
-
bottom = 2,
|
|
60
|
-
stretch = 3,
|
|
61
|
-
stretchAndFix = 4
|
|
62
|
-
}
|
|
63
|
-
export type Range = {
|
|
64
|
-
readonly min?: string;
|
|
65
|
-
readonly max?: string;
|
|
66
|
-
preferred?: string;
|
|
67
|
-
};
|
|
68
|
-
export type MarkedRange = Range & {
|
|
69
|
-
readonly marker?: string;
|
|
70
|
-
};
|
|
71
|
-
export type ElPlace = undefined | string | {
|
|
72
|
-
cellsOverWidth?: number;
|
|
73
|
-
cellsOverHeight?: number;
|
|
74
|
-
};
|
|
75
|
-
export declare enum Direction {
|
|
76
|
-
horizontal = 0,
|
|
77
|
-
vertical = 1
|
|
78
|
-
}
|
|
2
|
+
import { El, ElKind, Horizontal, Vertical, Range, ElPlace, Direction } from "./El.js";
|
|
79
3
|
export declare class ElDriver<T extends Element, M = unknown> extends BaseDriver<El<T, M>> {
|
|
80
|
-
|
|
4
|
+
create(node: ReactiveNode<El<T, M>>): El<T, M>;
|
|
81
5
|
}
|
|
82
6
|
export declare class ElImpl<T extends Element = any, M = any> implements El<T, M> {
|
|
83
7
|
readonly node: ReactiveNode<El<T, M>>;
|
|
@@ -8,49 +8,10 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
10
|
import { ReactiveNode, BaseDriver, Transaction, obs, ObservableObject } from "reactronic";
|
|
11
|
+
import { ElKind, Horizontal, Vertical, Direction } from "./El.js";
|
|
11
12
|
import { equalElCoords, parseElCoords } from "./ElUtils.js";
|
|
12
|
-
export var ElKind;
|
|
13
|
-
(function (ElKind) {
|
|
14
|
-
ElKind[ElKind["panel"] = 0] = "panel";
|
|
15
|
-
ElKind[ElKind["table"] = 1] = "table";
|
|
16
|
-
ElKind[ElKind["note"] = 2] = "note";
|
|
17
|
-
ElKind[ElKind["group"] = 3] = "group";
|
|
18
|
-
ElKind[ElKind["part"] = 4] = "part";
|
|
19
|
-
ElKind[ElKind["splitter"] = 5] = "splitter";
|
|
20
|
-
ElKind[ElKind["cursor"] = 6] = "cursor";
|
|
21
|
-
ElKind[ElKind["native"] = 7] = "native";
|
|
22
|
-
})(ElKind || (ElKind = {}));
|
|
23
|
-
export var Horizontal;
|
|
24
|
-
(function (Horizontal) {
|
|
25
|
-
Horizontal[Horizontal["left"] = 0] = "left";
|
|
26
|
-
Horizontal[Horizontal["center"] = 1] = "center";
|
|
27
|
-
Horizontal[Horizontal["right"] = 2] = "right";
|
|
28
|
-
Horizontal[Horizontal["stretch"] = 3] = "stretch";
|
|
29
|
-
Horizontal[Horizontal["stretchAndFix"] = 4] = "stretchAndFix";
|
|
30
|
-
})(Horizontal || (Horizontal = {}));
|
|
31
|
-
export var Vertical;
|
|
32
|
-
(function (Vertical) {
|
|
33
|
-
Vertical[Vertical["top"] = 0] = "top";
|
|
34
|
-
Vertical[Vertical["center"] = 1] = "center";
|
|
35
|
-
Vertical[Vertical["bottom"] = 2] = "bottom";
|
|
36
|
-
Vertical[Vertical["stretch"] = 3] = "stretch";
|
|
37
|
-
Vertical[Vertical["stretchAndFix"] = 4] = "stretchAndFix";
|
|
38
|
-
})(Vertical || (Vertical = {}));
|
|
39
|
-
export var Direction;
|
|
40
|
-
(function (Direction) {
|
|
41
|
-
Direction[Direction["horizontal"] = 0] = "horizontal";
|
|
42
|
-
Direction[Direction["vertical"] = 1] = "vertical";
|
|
43
|
-
})(Direction || (Direction = {}));
|
|
44
|
-
class Size extends ObservableObject {
|
|
45
|
-
constructor() {
|
|
46
|
-
super();
|
|
47
|
-
this.raw = { min: "", max: "" };
|
|
48
|
-
this.minPx = 0;
|
|
49
|
-
this.maxPx = Number.POSITIVE_INFINITY;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
13
|
export class ElDriver extends BaseDriver {
|
|
53
|
-
|
|
14
|
+
create(node) {
|
|
54
15
|
return new ElImpl(node);
|
|
55
16
|
}
|
|
56
17
|
}
|
|
@@ -574,6 +535,14 @@ export class ElImpl {
|
|
|
574
535
|
native.className = enabled ? styleName : "";
|
|
575
536
|
}
|
|
576
537
|
}
|
|
538
|
+
class Size extends ObservableObject {
|
|
539
|
+
constructor() {
|
|
540
|
+
super();
|
|
541
|
+
this.raw = { min: "", max: "" };
|
|
542
|
+
this.minPx = 0;
|
|
543
|
+
this.maxPx = Number.POSITIVE_INFINITY;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
577
546
|
export class ElLayoutInfo {
|
|
578
547
|
constructor(prev) {
|
|
579
548
|
this.x = prev.x;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ReactiveNodeDecl, ReactiveNodeDriver, ReactiveNode, Script, Mode, MergedItem, ScriptAsync } from "reactronic";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { El, ElPlace } from "./El.js";
|
|
3
|
+
import { CursorCommandDriver } from "./ElDriver.js";
|
|
4
|
+
import { HtmlDriver } from "./WebDriver.js";
|
|
5
|
+
export declare function Window(content?: Script<El<HTMLBodyElement>>, contentAsync?: ScriptAsync<El<HTMLBodyElement>>, key?: string, mode?: Mode, preparation?: Script<El<HTMLBodyElement>>, preparationAsync?: ScriptAsync<El<HTMLBodyElement>>, finalization?: Script<El<HTMLBodyElement>>, triggers?: unknown, basis?: ReactiveNodeDecl<El<HTMLBodyElement>>): ReactiveNode<El<HTMLBodyElement>>;
|
|
6
|
+
export declare function Window(declaration?: ReactiveNodeDecl<El<HTMLBodyElement>>): ReactiveNode<El<HTMLBodyElement>>;
|
|
4
7
|
export declare function Panel<M = unknown>(content?: Script<El<HTMLElement, M>>, contentAsync?: 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?: ReactiveNodeDecl<El<HTMLElement, M>>): ReactiveNode<El<HTMLElement, M>>;
|
|
5
8
|
export declare function Panel<M = unknown>(declaration?: ReactiveNodeDecl<El<HTMLElement, M>>): ReactiveNode<El<HTMLElement, M>>;
|
|
6
9
|
export declare function Table<M = unknown>(content?: Script<El<HTMLElement, M>>, contentAsync?: 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?: ReactiveNodeDecl<El<HTMLElement, M>>): ReactiveNode<El<HTMLElement, M>>;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { ReactiveNode, Mode, unobs } from "reactronic";
|
|
2
|
-
import {
|
|
2
|
+
import { ElKind, Direction } from "./El.js";
|
|
3
|
+
import { clamp } from "./ElUtils.js";
|
|
4
|
+
import { Constants, CursorCommandDriver, ElDriver, ElLayoutInfo, InitialElLayoutInfo } from "./ElDriver.js";
|
|
3
5
|
import { getPrioritiesForEmptySpaceDistribution, getPrioritiesForSizeChanging, relayout, relayoutUsingSplitter } from "./SplitViewMath.js";
|
|
4
6
|
import { Axis, BodyFontSize, Dimension, toPx } from "./Sizes.js";
|
|
5
|
-
import { HtmlDriver } from "./
|
|
6
|
-
|
|
7
|
+
import { HtmlDriver, StaticDriver } from "./WebDriver.js";
|
|
8
|
+
export function Window(contentOrDeclaration, contentAsync, key, mode, preparation, preparationAsync, finalization, triggers, basis) {
|
|
9
|
+
const driver = new StaticDriver(global.document.body, "Page", false, el => el.kind = ElKind.panel);
|
|
10
|
+
return ReactiveNode.declare(driver, contentOrDeclaration, contentAsync, key, mode, preparation, preparationAsync, finalization, triggers, basis);
|
|
11
|
+
}
|
|
7
12
|
export function Panel(contentOrDeclaration, contentAsync, key, mode, preparation, preparationAsync, finalization, triggers, basis) {
|
|
8
13
|
return ReactiveNode.declare(Drivers.panel, contentOrDeclaration, contentAsync, key, mode, preparation, preparationAsync, finalization, triggers, basis);
|
|
9
14
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MergeList, ReactiveNode } from "reactronic";
|
|
2
|
-
import { ElImpl } from "./
|
|
2
|
+
import { ElImpl } from "./ElDriver.js";
|
|
3
3
|
export declare function equal(a: number, b: number): boolean;
|
|
4
4
|
export declare function less(a: number, b: number): boolean;
|
|
5
5
|
export declare function greater(a: number, b: number): boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactiveNode, Handler } from "reactronic";
|
|
2
|
-
import { El
|
|
2
|
+
import { El } from "./El.js";
|
|
3
|
+
import { ElDriver } from "./ElDriver.js";
|
|
3
4
|
export declare class WebDriver<T extends Element, M = unknown> extends ElDriver<T, M> {
|
|
4
5
|
setNativeElement(node: ReactiveNode<El<T, M>>): void;
|
|
5
6
|
prepare(node: ReactiveNode<El<T, M>>): void | Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactiveSystem, ReactiveNode, proceedSyncOrAsync } from "reactronic";
|
|
2
|
-
import { Constants, ElDriver, ElImpl } from "./
|
|
2
|
+
import { Constants, ElDriver, ElImpl } from "./ElDriver.js";
|
|
3
3
|
export class WebDriver extends ElDriver {
|
|
4
4
|
setNativeElement(node) {
|
|
5
5
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactiveNodeDecl, ReactiveNode } from "reactronic";
|
|
2
|
+
import { El } from "verstak";
|
|
3
|
+
export type ButtonModel = {
|
|
4
|
+
icon?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
action?(): void;
|
|
7
|
+
};
|
|
8
|
+
export declare function Button(declaration?: ReactiveNodeDecl<El<HTMLElement, ButtonModel>>): ReactiveNode<El<HTMLElement, ButtonModel>>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Mode, ReactiveNode } from "reactronic";
|
|
2
|
+
import { Panel, Note, OnClick } from "verstak";
|
|
3
|
+
import { observableModel } from "./common/Utils.js";
|
|
4
|
+
import { Theme } from "./Theme.js";
|
|
5
|
+
import { Icon } from "./Icon.v.js";
|
|
6
|
+
export function Button(declaration) {
|
|
7
|
+
return (Panel(ReactiveNode.withBasis(declaration, {
|
|
8
|
+
mode: Mode.autonomous,
|
|
9
|
+
preparation: el => {
|
|
10
|
+
var _a;
|
|
11
|
+
(_a = el.model) !== null && _a !== void 0 ? _a : (el.model = observableModel({
|
|
12
|
+
icon: "fa-solid fa-square",
|
|
13
|
+
label: ReactiveNode.key,
|
|
14
|
+
}));
|
|
15
|
+
},
|
|
16
|
+
content: el => {
|
|
17
|
+
const m = el.model;
|
|
18
|
+
const theme = Theme.current.button;
|
|
19
|
+
el.useStylingPreset(theme.main);
|
|
20
|
+
if (m.icon) {
|
|
21
|
+
Icon(m.icon, {
|
|
22
|
+
content: (el, base) => {
|
|
23
|
+
base();
|
|
24
|
+
el.useStylingPreset(theme.icon);
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
if (m.label) {
|
|
29
|
+
Note(m.label, false, {
|
|
30
|
+
content: (el, base) => {
|
|
31
|
+
base();
|
|
32
|
+
el.useStylingPreset(theme.label);
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
OnClick(el.native, m.action);
|
|
37
|
+
},
|
|
38
|
+
})));
|
|
39
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactiveNodeDecl, ReactiveNode } from "reactronic";
|
|
2
|
+
import { FocusModel, El } from "verstak";
|
|
3
|
+
import { ValuesOrRefs } from "./common/Utils.js";
|
|
4
|
+
export type FieldModel<T = string> = FocusModel & {
|
|
5
|
+
icon?: string;
|
|
6
|
+
text: string;
|
|
7
|
+
options: Array<T>;
|
|
8
|
+
selected: T | undefined;
|
|
9
|
+
multiSelected: Set<T>;
|
|
10
|
+
position: number;
|
|
11
|
+
isMultiLineText: boolean;
|
|
12
|
+
isHotText: boolean;
|
|
13
|
+
inputStyle: string;
|
|
14
|
+
};
|
|
15
|
+
export declare function Field(declaration?: ReactiveNodeDecl<El<HTMLElement, FieldModel>>): ReactiveNode<El<HTMLElement, FieldModel<string>>>;
|
|
16
|
+
export declare function composeFieldModel<T>(props?: Partial<ValuesOrRefs<FieldModel<T>>>): FieldModel<T>;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Mode, ReactiveNode } from "reactronic";
|
|
2
|
+
import { Panel, Note, OnFocus, rowBreak, Handling, KeyboardModifiers, Horizontal, Vertical } from "verstak";
|
|
3
|
+
import { observableModel } from "./common/Utils.js";
|
|
4
|
+
import { Theme } from "./Theme.js";
|
|
5
|
+
import { Icon } from "./Icon.v.js";
|
|
6
|
+
export function Field(declaration) {
|
|
7
|
+
return (Panel(ReactiveNode.withBasis(declaration, {
|
|
8
|
+
mode: Mode.autonomous,
|
|
9
|
+
preparation: el => {
|
|
10
|
+
var _a;
|
|
11
|
+
(_a = el.model) !== null && _a !== void 0 ? _a : (el.model = composeFieldModel());
|
|
12
|
+
el.native.dataForSensor.focus = el.model;
|
|
13
|
+
},
|
|
14
|
+
content: el => {
|
|
15
|
+
const m = el.model;
|
|
16
|
+
const theme = Theme.current.field;
|
|
17
|
+
el.useStylingPreset(theme.main);
|
|
18
|
+
if (m.icon)
|
|
19
|
+
Icon(m.icon, {
|
|
20
|
+
content: (el, base) => {
|
|
21
|
+
base();
|
|
22
|
+
el.useStylingPreset(theme.icon);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
FieldInput(m, theme);
|
|
26
|
+
FieldPopup(m, theme);
|
|
27
|
+
},
|
|
28
|
+
})));
|
|
29
|
+
}
|
|
30
|
+
export function composeFieldModel(props) {
|
|
31
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
32
|
+
return observableModel({
|
|
33
|
+
icon: props === null || props === void 0 ? void 0 : props.icon,
|
|
34
|
+
text: (_a = props === null || props === void 0 ? void 0 : props.text) !== null && _a !== void 0 ? _a : "",
|
|
35
|
+
options: (_b = props === null || props === void 0 ? void 0 : props.options) !== null && _b !== void 0 ? _b : [],
|
|
36
|
+
selected: props === null || props === void 0 ? void 0 : props.selected,
|
|
37
|
+
multiSelected: (_c = props === null || props === void 0 ? void 0 : props.multiSelected) !== null && _c !== void 0 ? _c : new Set(),
|
|
38
|
+
position: (_d = props === null || props === void 0 ? void 0 : props.position) !== null && _d !== void 0 ? _d : 0,
|
|
39
|
+
isMultiLineText: (_e = props === null || props === void 0 ? void 0 : props.isMultiLineText) !== null && _e !== void 0 ? _e : false,
|
|
40
|
+
isEditMode: (_f = props === null || props === void 0 ? void 0 : props.isEditMode) !== null && _f !== void 0 ? _f : false,
|
|
41
|
+
isHotText: (_g = props === null || props === void 0 ? void 0 : props.isHotText) !== null && _g !== void 0 ? _g : false,
|
|
42
|
+
inputStyle: (_h = props === null || props === void 0 ? void 0 : props.inputStyle) !== null && _h !== void 0 ? _h : "",
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function FieldInput(model, s) {
|
|
46
|
+
return (Note(model.text, false, {
|
|
47
|
+
key: FieldInput.name,
|
|
48
|
+
preparation: (el, base) => {
|
|
49
|
+
const e = el.native;
|
|
50
|
+
el.useStylingPreset(s.input);
|
|
51
|
+
el.horizontally = Horizontal.stretch;
|
|
52
|
+
el.vertically = Vertical.stretch;
|
|
53
|
+
e.tabIndex = 0;
|
|
54
|
+
e.contentEditable = "true";
|
|
55
|
+
e.dataForSensor.focus = model;
|
|
56
|
+
base();
|
|
57
|
+
},
|
|
58
|
+
content: el => {
|
|
59
|
+
const e = el.native;
|
|
60
|
+
if (!model.isEditMode)
|
|
61
|
+
e.innerText = model.text;
|
|
62
|
+
Handling(() => {
|
|
63
|
+
const keyboard = e.sensors.keyboard;
|
|
64
|
+
if (keyboard.down) {
|
|
65
|
+
if (isApplyKey(model, keyboard))
|
|
66
|
+
selectAllAndPreventDefault(e, keyboard);
|
|
67
|
+
}
|
|
68
|
+
if (keyboard.up) {
|
|
69
|
+
if (isApplyKey(model, keyboard)) {
|
|
70
|
+
selectAllAndPreventDefault(e, keyboard);
|
|
71
|
+
model.text = e.innerText;
|
|
72
|
+
}
|
|
73
|
+
else if (model.isHotText)
|
|
74
|
+
model.text = e.innerText;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
OnFocus(e, model);
|
|
78
|
+
},
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
function FieldPopup(model, s) {
|
|
82
|
+
return (Panel({
|
|
83
|
+
key: FieldPopup.name,
|
|
84
|
+
content: el => {
|
|
85
|
+
el.useStylingPreset(s.popup);
|
|
86
|
+
Handling(() => model.position = el.native.sensors.scroll.y);
|
|
87
|
+
const visible = el.overlayVisible = model.isEditMode;
|
|
88
|
+
if (visible) {
|
|
89
|
+
const options = model.options;
|
|
90
|
+
if (options.length > 0) {
|
|
91
|
+
for (const x of model.options) {
|
|
92
|
+
rowBreak();
|
|
93
|
+
Note(x, false, {
|
|
94
|
+
key: x,
|
|
95
|
+
preparation: el => {
|
|
96
|
+
el.contentWrapping = false;
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else
|
|
102
|
+
Note("(nothing)", false, { key: "(nothing)" });
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
}));
|
|
106
|
+
}
|
|
107
|
+
function isApplyKey(m, keyboard) {
|
|
108
|
+
const modifiers = keyboard.modifiers;
|
|
109
|
+
return keyboard.down === "Enter" && (!m.isMultiLineText || (modifiers & KeyboardModifiers.ctrlShiftMeta) > 0);
|
|
110
|
+
}
|
|
111
|
+
function selectAllAndPreventDefault(e, keyboard) {
|
|
112
|
+
const range = document.createRange();
|
|
113
|
+
range.selectNodeContents(e);
|
|
114
|
+
const sel = window.getSelection();
|
|
115
|
+
sel === null || sel === void 0 ? void 0 : sel.removeAllRanges();
|
|
116
|
+
sel === null || sel === void 0 ? void 0 : sel.addRange(range);
|
|
117
|
+
keyboard.preventDefault = true;
|
|
118
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Mode, ReactiveNode } from "reactronic";
|
|
2
|
+
import { Panel } from "verstak";
|
|
3
|
+
import { Theme } from "./Theme.js";
|
|
4
|
+
export function Icon(name, declaration) {
|
|
5
|
+
return (Panel(ReactiveNode.withBasis(declaration, {
|
|
6
|
+
mode: Mode.autonomous,
|
|
7
|
+
triggers: { name },
|
|
8
|
+
content: el => {
|
|
9
|
+
const theme = Theme.current.icon;
|
|
10
|
+
el.useStylingPreset(name);
|
|
11
|
+
el.useStylingPreset(theme.main);
|
|
12
|
+
},
|
|
13
|
+
})));
|
|
14
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ReactiveNodeDecl, ReactiveNode } from "reactronic";
|
|
2
|
+
import { El } from "verstak";
|
|
3
|
+
export type ImageModel = {
|
|
4
|
+
source?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function Image(declaration?: ReactiveNodeDecl<El<HTMLElement, ImageModel>>): ReactiveNode<El<HTMLElement, ImageModel>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Mode, ReactiveNode } from "reactronic";
|
|
2
|
+
import { Panel } from "verstak";
|
|
3
|
+
import { observableModel } from "./common/Utils.js";
|
|
4
|
+
export function Image(declaration) {
|
|
5
|
+
return (Panel(ReactiveNode.withBasis(declaration, {
|
|
6
|
+
mode: Mode.autonomous,
|
|
7
|
+
preparation: el => {
|
|
8
|
+
var _a;
|
|
9
|
+
(_a = el.model) !== null && _a !== void 0 ? _a : (el.model = observableModel({ source: undefined }));
|
|
10
|
+
},
|
|
11
|
+
content: el => {
|
|
12
|
+
const m = el.model;
|
|
13
|
+
el.style.backgroundImage = `url(${m.source})`;
|
|
14
|
+
el.style.backgroundSize = "contain";
|
|
15
|
+
el.style.backgroundRepeat = "no-repeat";
|
|
16
|
+
},
|
|
17
|
+
})));
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Markdown(content: string): import("reactronic").ReactiveNode<import("verstak").El<HTMLElement, void>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Note } from "verstak";
|
|
2
|
+
import Md from "markdown-it";
|
|
3
|
+
import * as prism from "prismjs";
|
|
4
|
+
export function Markdown(content) {
|
|
5
|
+
return (Note(md.render(content), true, {
|
|
6
|
+
preparation: (el, base) => {
|
|
7
|
+
el.contentWrapping = true;
|
|
8
|
+
base();
|
|
9
|
+
},
|
|
10
|
+
}));
|
|
11
|
+
}
|
|
12
|
+
const md = new Md({
|
|
13
|
+
html: true,
|
|
14
|
+
highlight: (str, lang, attrs) => {
|
|
15
|
+
const highlighted = prism.highlight(str, prism.languages[lang], lang);
|
|
16
|
+
return `<pre class="language-${lang}"><code>${highlighted}</code></pre>`;
|
|
17
|
+
},
|
|
18
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactiveNodeDecl, ReactiveNode } from "reactronic";
|
|
2
|
+
import { El } from "verstak";
|
|
3
|
+
import { ValuesOrRefs } from "./common/Utils.js";
|
|
4
|
+
export type SpinnerModel = {
|
|
5
|
+
active: boolean;
|
|
6
|
+
color: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function Spinner(declaration?: ReactiveNodeDecl<El<HTMLElement, SpinnerModel>>): ReactiveNode<El<HTMLElement, SpinnerModel>>;
|
|
9
|
+
export declare function composeSpinnerModel<T>(props?: Partial<ValuesOrRefs<SpinnerModel>>): SpinnerModel;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Mode, ReactiveNode } from "reactronic";
|
|
2
|
+
import { Panel, Note } from "verstak";
|
|
3
|
+
import { observableModel } from "./common/Utils.js";
|
|
4
|
+
export function Spinner(declaration) {
|
|
5
|
+
return (Panel(ReactiveNode.withBasis(declaration, {
|
|
6
|
+
mode: Mode.autonomous,
|
|
7
|
+
preparation: el => {
|
|
8
|
+
var _a;
|
|
9
|
+
(_a = el.model) !== null && _a !== void 0 ? _a : (el.model = composeSpinnerModel());
|
|
10
|
+
},
|
|
11
|
+
content: el => {
|
|
12
|
+
const m = el.model;
|
|
13
|
+
m.active && Note("loading...");
|
|
14
|
+
},
|
|
15
|
+
})));
|
|
16
|
+
}
|
|
17
|
+
export function composeSpinnerModel(props) {
|
|
18
|
+
var _a, _b;
|
|
19
|
+
return observableModel({
|
|
20
|
+
active: (_a = props === null || props === void 0 ? void 0 : props.active) !== null && _a !== void 0 ? _a : false,
|
|
21
|
+
color: (_b = props === null || props === void 0 ? void 0 : props.color) !== null && _b !== void 0 ? _b : "",
|
|
22
|
+
});
|
|
23
|
+
}
|