verstak 0.96.26031 → 0.96.26035
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.d.ts +2 -2
- package/build/dist/source/components/Button.v.js +2 -2
- package/build/dist/source/components/Icon.v.d.ts +2 -2
- package/build/dist/source/components/Icon.v.js +2 -2
- package/build/dist/source/components/Image.v.d.ts +2 -2
- package/build/dist/source/components/Image.v.js +2 -2
- package/build/dist/source/components/Input.v.d.ts +2 -2
- package/build/dist/source/components/Input.v.js +2 -2
- package/build/dist/source/components/Spinner.v.d.ts +2 -2
- package/build/dist/source/components/Spinner.v.js +2 -2
- package/build/dist/source/components/Toggle.v.d.ts +2 -2
- package/build/dist/source/components/Toggle.v.js +2 -2
- package/build/dist/source/core/ElDriver.d.ts +0 -14
- package/build/dist/source/core/ElDriver.js +3 -15
- package/build/dist/source/core/HtmlApiExt.d.ts +1 -1
- package/build/dist/source/core/HtmlApiExt.js +1 -1
- package/build/dist/source/core/SplitViewMath.js +3 -2
- package/build/dist/source/core/WebDriver.d.ts +1 -1
- package/build/dist/source/core/WebDriver.js +4 -4
- package/build/dist/source/core/api.d.ts +1 -1
- package/build/dist/source/core/api.js +1 -1
- package/build/dist/source/core/elements/ApplicationWindow.d.ts +13 -0
- package/build/dist/source/core/elements/ApplicationWindow.js +20 -0
- package/build/dist/source/core/elements/Cursor.d.ts +13 -0
- package/build/dist/source/core/elements/Cursor.js +19 -0
- package/build/dist/source/core/elements/Element.d.ts +15 -0
- package/build/dist/source/core/elements/Element.js +136 -0
- package/build/dist/source/core/elements/Fragment.d.ts +13 -0
- package/build/dist/source/core/elements/Fragment.js +16 -0
- package/build/dist/source/core/elements/Group.d.ts +13 -0
- package/build/dist/source/core/elements/Group.js +13 -0
- package/build/dist/source/core/elements/Partition.d.ts +17 -0
- package/build/dist/source/core/elements/Partition.js +64 -0
- package/build/dist/source/core/elements/Splitter.d.ts +15 -0
- package/build/dist/source/core/elements/Splitter.js +71 -0
- package/build/dist/source/core/elements/Table.d.ts +13 -0
- package/build/dist/source/core/elements/Table.js +13 -0
- package/build/dist/source/core/elements/api.d.ts +16 -0
- package/build/dist/source/core/elements/api.js +16 -0
- package/build/dist/source/core/elements/v5k.d.ts +1 -0
- package/build/dist/source/core/elements/v5k.js +274 -0
- package/build/dist/source/core/sensors/Handlers.js +1 -1
- package/build/dist/source/html/DraggableArea.view.d.ts +3 -3
- package/build/dist/source/html/DraggableArea.view.js +1 -1
- package/build/dist/source/html/HtmlElements.d.ts +115 -115
- package/build/dist/source/html/HtmlElements.js +115 -115
- package/build/dist/source/svg/SvgElements.d.ts +60 -60
- package/build/dist/source/svg/SvgElements.js +60 -60
- package/package.json +2 -2
- package/build/dist/source/core/Elements.d.ts +0 -44
- package/build/dist/source/core/Elements.js +0 -552
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ReactiveTreeNode,
|
|
1
|
+
import { ReactiveTreeNode, ReactiveTreeNodeDesc } from "reactronic";
|
|
2
2
|
import { El } from "verstak";
|
|
3
3
|
export type ButtonModel = {
|
|
4
4
|
icon?: string;
|
|
5
5
|
label?: string;
|
|
6
6
|
action?(): void;
|
|
7
7
|
};
|
|
8
|
-
export declare function Button(
|
|
8
|
+
export declare function Button(description?: ReactiveTreeNodeDesc<El<HTMLElement, ButtonModel>>): ReactiveTreeNode<El<HTMLElement, ButtonModel>>;
|
|
@@ -3,8 +3,8 @@ import { Element, 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
|
-
export function Button(
|
|
7
|
-
return (Element(setBasis(
|
|
6
|
+
export function Button(description) {
|
|
7
|
+
return (Element(setBasis(description, {
|
|
8
8
|
preparation() {
|
|
9
9
|
var _a;
|
|
10
10
|
(_a = this.model) !== null && _a !== void 0 ? _a : (this.model = rxModel({
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactiveTreeNodeDesc } from "reactronic";
|
|
2
2
|
import { El } from "verstak";
|
|
3
|
-
export declare function Icon(name: string,
|
|
3
|
+
export declare function Icon(name: string, description?: ReactiveTreeNodeDesc<El<HTMLElement, void>>): import("reactronic").ReactiveTreeNode<El<HTMLElement, void>>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { setBasis } from "reactronic";
|
|
2
2
|
import { Element } from "verstak";
|
|
3
3
|
import { Theme } from "./Theme.js";
|
|
4
|
-
export function Icon(name,
|
|
5
|
-
return (Element(setBasis(
|
|
4
|
+
export function Icon(name, description) {
|
|
5
|
+
return (Element(setBasis(description, {
|
|
6
6
|
signalArgs: { name },
|
|
7
7
|
body() {
|
|
8
8
|
const theme = Theme.current.icon;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactiveTreeNodeDesc } from "reactronic";
|
|
2
2
|
import { El } from "verstak";
|
|
3
3
|
export type ImageModel = {
|
|
4
4
|
source?: string;
|
|
5
5
|
};
|
|
6
|
-
export declare function Image(
|
|
6
|
+
export declare function Image(description?: ReactiveTreeNodeDesc<El<HTMLElement, ImageModel>>): import("reactronic").ReactiveTreeNode<El<HTMLElement, ImageModel>>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { setBasis } from "reactronic";
|
|
2
2
|
import { Element } from "verstak";
|
|
3
3
|
import { rxModel } from "./common/Utils.js";
|
|
4
|
-
export function Image(
|
|
5
|
-
return (Element(setBasis(
|
|
4
|
+
export function Image(description) {
|
|
5
|
+
return (Element(setBasis(description, {
|
|
6
6
|
preparation() {
|
|
7
7
|
var _a;
|
|
8
8
|
(_a = this.model) !== null && _a !== void 0 ? _a : (this.model = rxModel({ source: undefined }));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactiveTreeNodeDesc } from "reactronic";
|
|
2
2
|
import { FocusModel, El } from "verstak";
|
|
3
3
|
import { ValuesOrRefs } from "./common/Utils.js";
|
|
4
4
|
export type InputModel<T = string> = FocusModel & {
|
|
@@ -12,5 +12,5 @@ export type InputModel<T = string> = FocusModel & {
|
|
|
12
12
|
isHotText: boolean;
|
|
13
13
|
inputStyle: string;
|
|
14
14
|
};
|
|
15
|
-
export declare function Input(
|
|
15
|
+
export declare function Input(description?: ReactiveTreeNodeDesc<El<HTMLElement, InputModel>>): import("reactronic").ReactiveTreeNode<El<HTMLElement, InputModel<string>>>;
|
|
16
16
|
export declare function composeInputModel<T>(props?: Partial<ValuesOrRefs<InputModel<T>>>): InputModel<T>;
|
|
@@ -3,8 +3,8 @@ import { Element, OnFocus, rowBreak, Fragment, KeyboardModifiers, H, V } from "v
|
|
|
3
3
|
import { rxModel } from "./common/Utils.js";
|
|
4
4
|
import { Theme } from "./Theme.js";
|
|
5
5
|
import { Icon } from "./Icon.v.js";
|
|
6
|
-
export function Input(
|
|
7
|
-
return (Element(setBasis(
|
|
6
|
+
export function Input(description) {
|
|
7
|
+
return (Element(setBasis(description, {
|
|
8
8
|
preparation() {
|
|
9
9
|
var _a;
|
|
10
10
|
(_a = this.model) !== null && _a !== void 0 ? _a : (this.model = composeInputModel());
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactiveTreeNodeDesc } from "reactronic";
|
|
2
2
|
import { El } from "verstak";
|
|
3
3
|
import { ValuesOrRefs } from "./common/Utils.js";
|
|
4
4
|
export type SpinnerModel = {
|
|
5
5
|
active: boolean;
|
|
6
6
|
color: string;
|
|
7
7
|
};
|
|
8
|
-
export declare function Spinner(
|
|
8
|
+
export declare function Spinner(description?: ReactiveTreeNodeDesc<El<HTMLElement, SpinnerModel>>): import("reactronic").ReactiveTreeNode<El<HTMLElement, SpinnerModel>>;
|
|
9
9
|
export declare function composeSpinnerModel<T>(props?: Partial<ValuesOrRefs<SpinnerModel>>): SpinnerModel;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Mode, setBasis } from "reactronic";
|
|
2
2
|
import { Element } from "verstak";
|
|
3
3
|
import { rxModel } from "./common/Utils.js";
|
|
4
|
-
export function Spinner(
|
|
5
|
-
return (Element(setBasis(
|
|
4
|
+
export function Spinner(description) {
|
|
5
|
+
return (Element(setBasis(description, {
|
|
6
6
|
preparation() {
|
|
7
7
|
var _a;
|
|
8
8
|
(_a = this.model) !== null && _a !== void 0 ? _a : (this.model = composeSpinnerModel());
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ReactiveTreeNode,
|
|
1
|
+
import { ReactiveTreeNode, ReactiveTreeNodeDesc } from "reactronic";
|
|
2
2
|
import { El } from "verstak";
|
|
3
3
|
export type ToggleModel = {
|
|
4
4
|
label?: string;
|
|
5
5
|
checked?: boolean;
|
|
6
6
|
color?: string;
|
|
7
7
|
};
|
|
8
|
-
export declare function Toggle(
|
|
8
|
+
export declare function Toggle(description?: ReactiveTreeNodeDesc<El<HTMLElement, ToggleModel>>): ReactiveTreeNode<El<HTMLElement, ToggleModel>>;
|
|
@@ -3,8 +3,8 @@ import { Element, 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
|
-
export function Toggle(
|
|
7
|
-
return (Element(setBasis(
|
|
6
|
+
export function Toggle(description) {
|
|
7
|
+
return (Element(setBasis(description, {
|
|
8
8
|
preparation() {
|
|
9
9
|
var _a;
|
|
10
10
|
(_a = this.model) !== null && _a !== void 0 ? _a : (this.model = rxModel({
|
|
@@ -144,21 +144,7 @@ declare enum ElLayoutInfoFlags {
|
|
|
144
144
|
childrenRelayoutIsNeeded = 8
|
|
145
145
|
}
|
|
146
146
|
export declare const InitialElLayoutInfo: ElLayoutInfo;
|
|
147
|
-
export declare class CursorCommand {
|
|
148
|
-
absolute?: string;
|
|
149
|
-
columnShift?: number;
|
|
150
|
-
rowShift?: number;
|
|
151
|
-
}
|
|
152
|
-
export declare class CursorCommandDriver extends ElDriver<Element, unknown> {
|
|
153
|
-
constructor();
|
|
154
|
-
}
|
|
155
147
|
export declare const Constants: {
|
|
156
|
-
element: string;
|
|
157
|
-
partition: string;
|
|
158
|
-
wrapper: string;
|
|
159
|
-
splitter: string;
|
|
160
|
-
group: string;
|
|
161
|
-
layouts: string[];
|
|
162
148
|
keyAttrName: string;
|
|
163
149
|
kindAttrName: string;
|
|
164
150
|
ownReactiveTreeNodeKey: symbol;
|
|
@@ -72,7 +72,7 @@ export class ElImpl {
|
|
|
72
72
|
const prevEl = (_a = node.prev) === null || _a === void 0 ? void 0 : _a.element;
|
|
73
73
|
const prevElLayoutInfo = (_b = prevEl === null || prevEl === void 0 ? void 0 : prevEl.layoutInfo) !== null && _b !== void 0 ? _b : InitialElLayoutInfo;
|
|
74
74
|
const layoutInfo = this.layoutInfo = owner.children.isStrictOrder ? new ElLayoutInfo(prevElLayoutInfo) : undefined;
|
|
75
|
-
const isCursorElement =
|
|
75
|
+
const isCursorElement = this.kind === ElKind.cursor;
|
|
76
76
|
const coords = getElCoordsAndAdjustLayoutInfo(!isCursorElement, value, ownerEl.maxColumnCount, ownerEl.maxRowCount, prevElLayoutInfo, layoutInfo);
|
|
77
77
|
if (!equalElCoords(coords, this._coords)) {
|
|
78
78
|
if (this.native !== undefined)
|
|
@@ -352,6 +352,7 @@ export class ElImpl {
|
|
|
352
352
|
el.classList.add(StylingClassNameByAlignmentVerticalRowWise[value]);
|
|
353
353
|
}
|
|
354
354
|
static applySelfAlignmentHorizontal(element, existing, value) {
|
|
355
|
+
var _a;
|
|
355
356
|
const e = element.native;
|
|
356
357
|
if (existing !== undefined) {
|
|
357
358
|
e.classList.remove(StylingClassNameBySelfAlignmentHorizontal[existing]);
|
|
@@ -360,7 +361,7 @@ export class ElImpl {
|
|
|
360
361
|
}
|
|
361
362
|
if (value !== undefined) {
|
|
362
363
|
e.classList.add(StylingClassNameBySelfAlignmentHorizontal[value]);
|
|
363
|
-
const grow = element.selfStretchingStrengthHorizontal;
|
|
364
|
+
const grow = (_a = element.selfStretchingStrengthHorizontal) !== null && _a !== void 0 ? _a : 1;
|
|
364
365
|
if ((value === H.stretch || value === H.stretchAndFix) && grow !== undefined && grow !== 1)
|
|
365
366
|
element.style.flexGrow = `${grow}`;
|
|
366
367
|
else
|
|
@@ -669,20 +670,7 @@ function absolutizePosition(pos, cursor, max) {
|
|
|
669
670
|
pos = Math.min(pos, max);
|
|
670
671
|
return pos;
|
|
671
672
|
}
|
|
672
|
-
export class CursorCommand {
|
|
673
|
-
}
|
|
674
|
-
export class CursorCommandDriver extends ElDriver {
|
|
675
|
-
constructor() {
|
|
676
|
-
super("cursor", false, el => el.kind = ElKind.cursor);
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
673
|
export const Constants = {
|
|
680
|
-
element: "el",
|
|
681
|
-
partition: "part",
|
|
682
|
-
wrapper: "wrapper",
|
|
683
|
-
splitter: "splitter",
|
|
684
|
-
group: "group",
|
|
685
|
-
layouts: ["element", "table", "group", "", "", ""],
|
|
686
674
|
keyAttrName: "key",
|
|
687
675
|
kindAttrName: "kind",
|
|
688
676
|
ownReactiveTreeNodeKey: Symbol("own-reactive-tree-node"),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SymDataForSensor, SymHtmlSensors, SymResizeObserver } from "../core/sensors/DataForSensor.js";
|
|
2
|
-
import { HtmlSensors } from "../core/sensors/
|
|
2
|
+
import { HtmlSensors } from "../core/sensors/api.js";
|
|
3
3
|
const ElementType = Element !== null && Element !== void 0 ? Element : global.Element;
|
|
4
4
|
if (ElementType !== undefined) {
|
|
5
5
|
Object.defineProperty(ElementType.prototype, "sensors", {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Direction } from "./El.js";
|
|
2
2
|
import { clamp } from "./ElUtils.js";
|
|
3
|
-
import {
|
|
3
|
+
import { isSplitViewPartition } from "./elements/Splitter.js";
|
|
4
|
+
import { SplitterDriver } from "./elements/Splitter.js";
|
|
4
5
|
const DEBUG = false;
|
|
5
6
|
const eps = 0.0001;
|
|
6
7
|
export function equal(a, b) {
|
|
@@ -133,7 +134,7 @@ export function layout(splitViewNode) {
|
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
|
-
else if (child.driver
|
|
137
|
+
else if (child.driver instanceof SplitterDriver) {
|
|
137
138
|
const el = child.element;
|
|
138
139
|
if (el.native !== undefined) {
|
|
139
140
|
el.style.display = isSplitterEnabled ? "block" : "none";
|
|
@@ -17,7 +17,7 @@ export declare class WebDriver<T extends Element, M = unknown> extends ElDriver<
|
|
|
17
17
|
}
|
|
18
18
|
export declare class StaticDriver<T extends HTMLElement> extends WebDriver<T> {
|
|
19
19
|
readonly native: T;
|
|
20
|
-
constructor(native: T,
|
|
20
|
+
constructor(native: T, id: string, isPartition: boolean, initialize?: Handler<El<T>>);
|
|
21
21
|
assignNativeElement(node: ReactiveTreeNode<El<T>>): void;
|
|
22
22
|
}
|
|
23
23
|
export declare class HtmlDriver<T extends HTMLElement, M = any> extends WebDriver<T, M> {
|
|
@@ -105,8 +105,8 @@ export class WebDriver extends ElDriver {
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
export class StaticDriver extends WebDriver {
|
|
108
|
-
constructor(native,
|
|
109
|
-
super(
|
|
108
|
+
constructor(native, id, isPartition, initialize) {
|
|
109
|
+
super(id, isPartition, initialize);
|
|
110
110
|
this.native = native;
|
|
111
111
|
}
|
|
112
112
|
assignNativeElement(node) {
|
|
@@ -115,12 +115,12 @@ export class StaticDriver extends WebDriver {
|
|
|
115
115
|
}
|
|
116
116
|
export class HtmlDriver extends WebDriver {
|
|
117
117
|
assignNativeElement(node) {
|
|
118
|
-
node.element.native = document.createElement(node.driver.
|
|
118
|
+
node.element.native = document.createElement(node.driver.id);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
export class SvgDriver extends WebDriver {
|
|
122
122
|
assignNativeElement(node) {
|
|
123
|
-
node.element.native = document.createElementNS("http://www.w3.org/2000/svg", node.driver.
|
|
123
|
+
node.element.native = document.createElementNS("http://www.w3.org/2000/svg", node.driver.id);
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
function blink(element, priority, revision) {
|
|
@@ -5,7 +5,7 @@ export * from "./ElDriver.js";
|
|
|
5
5
|
export * from "./WebDriver.js";
|
|
6
6
|
export * from "./Sizes.js";
|
|
7
7
|
export * from "./SplitViewMath.js";
|
|
8
|
-
export * from "./
|
|
8
|
+
export * from "./elements/api.js";
|
|
9
9
|
export * from "./sensors/api.js";
|
|
10
10
|
export * from "./HtmlApiExt.js";
|
|
11
11
|
import "./HtmlApiExt.js";
|
|
@@ -5,7 +5,7 @@ export * from "./ElDriver.js";
|
|
|
5
5
|
export * from "./WebDriver.js";
|
|
6
6
|
export * from "./Sizes.js";
|
|
7
7
|
export * from "./SplitViewMath.js";
|
|
8
|
-
export * from "./
|
|
8
|
+
export * from "./elements/api.js";
|
|
9
9
|
export * from "./sensors/api.js";
|
|
10
10
|
export * from "./HtmlApiExt.js";
|
|
11
11
|
import "./HtmlApiExt.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactiveTreeNode, ReactiveTreeNodeDesc, Script, Mode, ScriptAsync } from "reactronic";
|
|
2
|
+
import { El } from "../El.js";
|
|
3
|
+
import { ElementDriver } from "./Element.js";
|
|
4
|
+
export declare function ApplicationWindow(body: Script<El<HTMLElement>>): ReactiveTreeNode<El<HTMLElement>>;
|
|
5
|
+
export declare function ApplicationWindow(key: string, body: Script<El<HTMLElement>>): ReactiveTreeNode<El<HTMLElement>>;
|
|
6
|
+
export declare function ApplicationWindow(mode: Mode, body: Script<El<HTMLElement>>): ReactiveTreeNode<El<HTMLElement>>;
|
|
7
|
+
export declare function ApplicationWindow(description: ReactiveTreeNodeDesc<El<HTMLElement>>): ReactiveTreeNode<El<HTMLElement>>;
|
|
8
|
+
export declare function ApplicationWindow(key?: string, mode?: Mode, body?: Script<El<HTMLElement>>, bodyTask?: ScriptAsync<El<HTMLElement>>, preparation?: Script<El<HTMLElement>>, preparationTask?: ScriptAsync<El<HTMLElement>>, mounting?: Script<El<HTMLElement>>, finalization?: Script<El<HTMLElement>>, signalArgs?: unknown, unmounted?: boolean, basis?: ReactiveTreeNodeDesc<El<HTMLElement>>): ReactiveTreeNode<El<HTMLElement>>;
|
|
9
|
+
export declare class ApplicationWindowDriver<T extends HTMLElement> extends ElementDriver<T> {
|
|
10
|
+
readonly native: T;
|
|
11
|
+
constructor(native: T);
|
|
12
|
+
assignNativeElement(node: ReactiveTreeNode<El<T>>): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { describe } from "reactronic";
|
|
2
|
+
import { ElementDriver } from "./Element.js";
|
|
3
|
+
import { acquireVerstakStyleSheet } from "./v5k.js";
|
|
4
|
+
export function ApplicationWindow(bodyOrKeyOrModeDescription, bodyOrMode, body, bodyTask, preparation, preparationTask, mounting, finalization, signalArgs, unmounted, basis) {
|
|
5
|
+
acquireVerstakStyleSheet();
|
|
6
|
+
const page = (document !== null && document !== void 0 ? document : global.document).body;
|
|
7
|
+
const driver = new ApplicationWindowDriver(page);
|
|
8
|
+
page.classList.add("v5k-app");
|
|
9
|
+
page.classList.add("v5k-element");
|
|
10
|
+
return describe(driver, bodyOrKeyOrModeDescription, bodyOrMode, body, bodyTask, preparation, preparationTask, mounting, finalization, signalArgs, unmounted, basis);
|
|
11
|
+
}
|
|
12
|
+
export class ApplicationWindowDriver extends ElementDriver {
|
|
13
|
+
constructor(native) {
|
|
14
|
+
super();
|
|
15
|
+
this.native = native;
|
|
16
|
+
}
|
|
17
|
+
assignNativeElement(node) {
|
|
18
|
+
node.element.native = this.native;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ElPlace } from "../El.js";
|
|
2
|
+
import { ElDriver } from "../ElDriver.js";
|
|
3
|
+
export declare function cursor(place: ElPlace): void;
|
|
4
|
+
export declare class CursorCommand {
|
|
5
|
+
absolute?: string;
|
|
6
|
+
columnShift?: number;
|
|
7
|
+
rowShift?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare class CursorCommandDriver extends ElDriver<Element, unknown> {
|
|
10
|
+
static readonly id = "cursor";
|
|
11
|
+
static readonly glob: CursorCommandDriver;
|
|
12
|
+
constructor();
|
|
13
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { describe } from "reactronic";
|
|
2
|
+
import { ElKind } from "../El.js";
|
|
3
|
+
import { ElDriver } from "../ElDriver.js";
|
|
4
|
+
export function cursor(place) {
|
|
5
|
+
describe(CursorCommandDriver.glob, {
|
|
6
|
+
body() {
|
|
7
|
+
this.place = place;
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
export class CursorCommand {
|
|
12
|
+
}
|
|
13
|
+
export class CursorCommandDriver extends ElDriver {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(CursorCommandDriver.id, false, el => el.kind = ElKind.cursor);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
CursorCommandDriver.id = "cursor";
|
|
19
|
+
CursorCommandDriver.glob = new CursorCommandDriver();
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactiveTreeNode, ReactiveTreeNodeDesc, ReactiveTreeNodeDriver, LinkedItem, Script, Mode, ScriptAsync } from "reactronic";
|
|
2
|
+
import { El } from "../El.js";
|
|
3
|
+
import { HtmlDriver } from "../WebDriver.js";
|
|
4
|
+
export declare function Element<M = unknown>(body: Script<El<HTMLElement, M>>): ReactiveTreeNode<El<HTMLElement, M>>;
|
|
5
|
+
export declare function Element<M = unknown>(key: string, body: Script<El<HTMLElement, M>>): ReactiveTreeNode<El<HTMLElement, M>>;
|
|
6
|
+
export declare function Element<M = unknown>(mode: Mode, body: Script<El<HTMLElement, M>>): ReactiveTreeNode<El<HTMLElement, M>>;
|
|
7
|
+
export declare function Element<M = unknown>(description: ReactiveTreeNodeDesc<El<HTMLElement, M>>): ReactiveTreeNode<El<HTMLElement, M>>;
|
|
8
|
+
export declare function Element<M = unknown>(key?: string, mode?: Mode, body?: Script<El<HTMLElement, M>>, bodyTask?: ScriptAsync<El<HTMLElement, M>>, preparation?: Script<El<HTMLElement, M>>, preparationTask?: ScriptAsync<El<HTMLElement, M>>, mounting?: Script<El<HTMLElement, M>>, finalization?: Script<El<HTMLElement, M>>, signalArgs?: unknown, unmounted?: boolean, basis?: ReactiveTreeNodeDesc<El<HTMLElement, M>>): ReactiveTreeNode<El<HTMLElement, M>>;
|
|
9
|
+
export declare class ElementDriver<T extends HTMLElement> extends HtmlDriver<T> {
|
|
10
|
+
static readonly id: string;
|
|
11
|
+
static readonly glob: ElementDriver<HTMLElement>;
|
|
12
|
+
constructor();
|
|
13
|
+
rebuildBody(node: ReactiveTreeNode<El<T>>): void | Promise<void>;
|
|
14
|
+
describeChild(ownerNode: ReactiveTreeNode<El<T, any>>, childDriver: ReactiveTreeNodeDriver<any>, childDescription?: ReactiveTreeNodeDesc<any> | undefined, childBasis?: ReactiveTreeNodeDesc<any> | undefined): LinkedItem<ReactiveTreeNode> | undefined;
|
|
15
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { ReactiveTreeNode, describe, runNonReactive } from "reactronic";
|
|
2
|
+
import { Direction, ElKind } from "../El.js";
|
|
3
|
+
import { clamp } from "../ElUtils.js";
|
|
4
|
+
import { ElLayoutInfo, InitialElLayoutInfo } from "../ElDriver.js";
|
|
5
|
+
import { getPrioritiesForEmptySpaceDistribution, getPrioritiesForSizeChanging, relayout } from "../SplitViewMath.js";
|
|
6
|
+
import { Axis, BodyFontSize, Dimension, toPx } from "../Sizes.js";
|
|
7
|
+
import { HtmlDriver } from "../WebDriver.js";
|
|
8
|
+
import { Fragment } from "./Fragment.js";
|
|
9
|
+
import { PartitionDriver } from "./Partition.js";
|
|
10
|
+
import { describeSplitter, isSplitViewPartition } from "./Splitter.js";
|
|
11
|
+
export function Element(bodyOrKeyOrModeDescription, bodyOrMode, body, bodyTask, preparation, preparationTask, mounting, finalization, signalArgs, unmounted, basis) {
|
|
12
|
+
return describe(ElementDriver.glob, bodyOrKeyOrModeDescription, bodyOrMode, body, bodyTask, preparation, preparationTask, mounting, finalization, signalArgs, unmounted, basis);
|
|
13
|
+
}
|
|
14
|
+
export class ElementDriver extends HtmlDriver {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(ElementDriver.id, false, el => el.kind = ElKind.element);
|
|
17
|
+
}
|
|
18
|
+
rebuildBody(node) {
|
|
19
|
+
const el = node.element;
|
|
20
|
+
const result = super.rebuildBody(node);
|
|
21
|
+
if (el.splitView !== undefined) {
|
|
22
|
+
if (el.layoutInfo === undefined)
|
|
23
|
+
el.layoutInfo = new ElLayoutInfo(InitialElLayoutInfo);
|
|
24
|
+
const layoutInfo = el.layoutInfo;
|
|
25
|
+
layoutInfo.isUpdateFinished = false;
|
|
26
|
+
Fragment(h => {
|
|
27
|
+
const native = el.native;
|
|
28
|
+
const resize = native.sensors.resize;
|
|
29
|
+
for (const x of resize.resizedElements) {
|
|
30
|
+
const borderBoxPx = x.borderBoxSize[0];
|
|
31
|
+
const contentBoxPx = x.contentBoxSize[0];
|
|
32
|
+
layoutInfo.borderSizeXpx = borderBoxPx.inlineSize;
|
|
33
|
+
layoutInfo.borderSizeYpx = borderBoxPx.blockSize;
|
|
34
|
+
layoutInfo.contentSizeXpx = contentBoxPx.inlineSize;
|
|
35
|
+
layoutInfo.contentSizeYpx = contentBoxPx.blockSize;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
const relayoutEl = Fragment({
|
|
39
|
+
body() {
|
|
40
|
+
const native = el.native;
|
|
41
|
+
const isHorizontal = el.splitView === Direction.horizontal;
|
|
42
|
+
if (layoutInfo.isUpdateFinished) {
|
|
43
|
+
const surroundingXpx = layoutInfo.borderSizeXpx - layoutInfo.contentSizeXpx;
|
|
44
|
+
const surroundingYpx = layoutInfo.borderSizeYpx - layoutInfo.contentSizeYpx;
|
|
45
|
+
let i = 0;
|
|
46
|
+
const preferred = [];
|
|
47
|
+
const sizesPx = [];
|
|
48
|
+
for (const child of node.children.items()) {
|
|
49
|
+
const partEl = child.element;
|
|
50
|
+
if (isSplitViewPartition(child.driver) && partEl !== undefined) {
|
|
51
|
+
const size = isHorizontal ? partEl.width : partEl.height;
|
|
52
|
+
const options = {
|
|
53
|
+
axis: isHorizontal ? Axis.X : Axis.Y, lineSizePx: BodyFontSize, fontSizePx: BodyFontSize,
|
|
54
|
+
containerSizeXpx: native.scrollWidth - surroundingXpx, containerSizeYpx: native.scrollHeight - surroundingYpx,
|
|
55
|
+
};
|
|
56
|
+
const minPx = size.min ? toPx(Dimension.parse(size.min), options) : 0;
|
|
57
|
+
let maxPx = size.max ? toPx(Dimension.parse(size.max), options) : Number.POSITIVE_INFINITY;
|
|
58
|
+
maxPx = Math.max(minPx, maxPx);
|
|
59
|
+
if (partEl.layoutInfo === undefined)
|
|
60
|
+
partEl.layoutInfo = new ElLayoutInfo(InitialElLayoutInfo);
|
|
61
|
+
if (isHorizontal)
|
|
62
|
+
partEl.widthPx = { minPx, maxPx };
|
|
63
|
+
else
|
|
64
|
+
partEl.heightPx = { minPx, maxPx };
|
|
65
|
+
const preferredPx = size.preferred ? toPx(Dimension.parse(size.preferred), options) : 0;
|
|
66
|
+
if (preferredPx > 0) {
|
|
67
|
+
partEl.layoutInfo.effectiveSizePx = preferredPx;
|
|
68
|
+
size.preferred = undefined;
|
|
69
|
+
preferred.push(i);
|
|
70
|
+
}
|
|
71
|
+
const sizePx = partEl.layoutInfo.effectiveSizePx = clamp(partEl.layoutInfo.effectiveSizePx, minPx, maxPx);
|
|
72
|
+
sizesPx.push({ node: child, sizePx });
|
|
73
|
+
i++;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const priorities = preferred.length > 0
|
|
77
|
+
? getPrioritiesForSizeChanging(isHorizontal, node.children, preferred)
|
|
78
|
+
: getPrioritiesForEmptySpaceDistribution(isHorizontal, node.children);
|
|
79
|
+
runNonReactive(() => relayout(node, priorities.resizable, priorities.manuallyResizable, sizesPx));
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
ReactiveTreeNode.launchNestedNodesThenDo(() => {
|
|
84
|
+
layoutInfo.isUpdateFinished = true;
|
|
85
|
+
ReactiveTreeNode.rebuildBody(relayoutEl, { stamp: node.stamp });
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return result;
|
|
89
|
+
}
|
|
90
|
+
describeChild(ownerNode, childDriver, childDescription, childBasis) {
|
|
91
|
+
let result = undefined;
|
|
92
|
+
const el = ownerNode.element;
|
|
93
|
+
if (el.splitView !== undefined) {
|
|
94
|
+
if (isSplitViewPartition(childDriver)) {
|
|
95
|
+
let partCount = 0;
|
|
96
|
+
for (const child of ownerNode.children.items()) {
|
|
97
|
+
if (isSplitViewPartition(child.driver))
|
|
98
|
+
partCount++;
|
|
99
|
+
}
|
|
100
|
+
const isHorizontal = el.splitView === Direction.horizontal;
|
|
101
|
+
if (childDescription !== undefined) {
|
|
102
|
+
if (childDescription.signalArgs === undefined)
|
|
103
|
+
childDescription.signalArgs = {};
|
|
104
|
+
Object.defineProperty(childDescription.signalArgs, "index", { value: partCount });
|
|
105
|
+
overrideMethod(childDescription, "body", el => {
|
|
106
|
+
if (isHorizontal)
|
|
107
|
+
el.style.gridColumn = `${partCount + 1}`;
|
|
108
|
+
else
|
|
109
|
+
el.style.gridRow = `${partCount + 1}`;
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
if (partCount > 0)
|
|
113
|
+
describeSplitter(partCount - 1, ownerNode);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
const last = ownerNode.children.lastItem;
|
|
118
|
+
if (childDriver.isPartition) {
|
|
119
|
+
if ((last === null || last === void 0 ? void 0 : last.driver) === childDriver)
|
|
120
|
+
result = last;
|
|
121
|
+
}
|
|
122
|
+
else if (last === undefined) {
|
|
123
|
+
describe(PartitionDriver.glob, {});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return result;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
ElementDriver.id = "el";
|
|
130
|
+
ElementDriver.glob = new ElementDriver();
|
|
131
|
+
function overrideMethod(description, method, func) {
|
|
132
|
+
const baseScript = description[method];
|
|
133
|
+
description[method] = baseScript !== undefined
|
|
134
|
+
? (el, base) => { baseScript.call(el, el, base); func.call(el, el); }
|
|
135
|
+
: (el, base) => { base(); func.call(el, el); };
|
|
136
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactiveTreeNode, ReactiveTreeNodeDesc, ReactiveTreeNodeDriver, Script, Mode, ScriptAsync } from "reactronic";
|
|
2
|
+
import { El } from "../El.js";
|
|
3
|
+
import { ElDriver } from "../ElDriver.js";
|
|
4
|
+
export declare function Fragment<M = unknown>(body: Script<El<void, M>>): ReactiveTreeNode<El<void, M>>;
|
|
5
|
+
export declare function Fragment<M = unknown>(key: string, body: Script<El<void, M>>): ReactiveTreeNode<El<void, M>>;
|
|
6
|
+
export declare function Fragment<M = unknown>(mode: Mode, body: Script<El<void, M>>): ReactiveTreeNode<El<void, M>>;
|
|
7
|
+
export declare function Fragment<M = unknown>(description: ReactiveTreeNodeDesc<El<void, M>>): ReactiveTreeNode<El<void, M>>;
|
|
8
|
+
export declare function Fragment<M = unknown>(key?: string, mode?: Mode, body?: Script<El<void, M>>, bodyTask?: ScriptAsync<El<void, M>>, preparation?: Script<El<void, M>>, preparationTask?: ScriptAsync<El<void, M>>, mounting?: Script<El<void, M>>, finalization?: Script<El<void, M>>, signalArgs?: unknown, unmounted?: boolean, basis?: ReactiveTreeNodeDesc<El<void, M>>): ReactiveTreeNode<El<void, M>>;
|
|
9
|
+
export declare class FragmentDriver extends ElDriver<HTMLElement> {
|
|
10
|
+
static readonly id = "fragment";
|
|
11
|
+
static readonly glob: ReactiveTreeNodeDriver<El<void, any>>;
|
|
12
|
+
constructor();
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Mode, args2desc, describe } from "reactronic";
|
|
2
|
+
import { ElKind } from "../El.js";
|
|
3
|
+
import { ElDriver } from "../ElDriver.js";
|
|
4
|
+
export function Fragment(bodyOrKeyOrModeDescription, bodyOrMode, body, bodyTask, preparation, preparationTask, mounting, finalization, signalArgs, unmounted, basis) {
|
|
5
|
+
var _a;
|
|
6
|
+
const desc = args2desc(bodyOrKeyOrModeDescription, bodyOrMode, body, bodyTask, preparation, preparationTask, mounting, finalization, signalArgs, unmounted, basis);
|
|
7
|
+
desc.mode = ((_a = desc.mode) !== null && _a !== void 0 ? _a : Mode.default) | Mode.fragment;
|
|
8
|
+
return describe(FragmentDriver.glob, desc);
|
|
9
|
+
}
|
|
10
|
+
export class FragmentDriver extends ElDriver {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(FragmentDriver.id, false, el => el.kind = ElKind.group);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
FragmentDriver.id = "fragment";
|
|
16
|
+
FragmentDriver.glob = new FragmentDriver();
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactiveTreeNode, ReactiveTreeNodeDesc, Script, Mode, ScriptAsync } from "reactronic";
|
|
2
|
+
import { El } from "../El.js";
|
|
3
|
+
import { HtmlDriver } from "../WebDriver.js";
|
|
4
|
+
export declare function Group<M = unknown>(body: Script<El<HTMLElement, M>>): ReactiveTreeNode<El<HTMLElement, M>>;
|
|
5
|
+
export declare function Group<M = unknown>(key: string, body: Script<El<HTMLElement, M>>): ReactiveTreeNode<El<HTMLElement, M>>;
|
|
6
|
+
export declare function Group<M = unknown>(mode: Mode, body: Script<El<HTMLElement, M>>): ReactiveTreeNode<El<HTMLElement, M>>;
|
|
7
|
+
export declare function Group<M = unknown>(description: ReactiveTreeNodeDesc<El<HTMLElement, M>>): ReactiveTreeNode<El<HTMLElement, M>>;
|
|
8
|
+
export declare function Group<M = unknown>(key?: string, mode?: Mode, body?: Script<El<HTMLElement, M>>, bodyTask?: ScriptAsync<El<HTMLElement, M>>, preparation?: Script<El<HTMLElement, M>>, preparationTask?: ScriptAsync<El<HTMLElement, M>>, mounting?: Script<El<HTMLElement, M>>, finalization?: Script<El<HTMLElement, M>>, signalArgs?: unknown, unmounted?: boolean, basis?: ReactiveTreeNodeDesc<El<HTMLElement, M>>): ReactiveTreeNode<El<HTMLElement, M>>;
|
|
9
|
+
export declare class GroupDriver extends HtmlDriver<HTMLElement> {
|
|
10
|
+
static readonly id = "group";
|
|
11
|
+
static readonly glob: GroupDriver;
|
|
12
|
+
constructor();
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { describe } from "reactronic";
|
|
2
|
+
import { ElKind } from "../El.js";
|
|
3
|
+
import { HtmlDriver } from "../WebDriver.js";
|
|
4
|
+
export function Group(bodyOrKeyOrModeDescription, bodyOrMode, body, bodyTask, preparation, preparationTask, mounting, finalization, signalArgs, unmounted, basis) {
|
|
5
|
+
return describe(GroupDriver.glob, bodyOrKeyOrModeDescription, bodyOrMode, body, bodyTask, preparation, preparationTask, mounting, finalization, signalArgs, unmounted, basis);
|
|
6
|
+
}
|
|
7
|
+
export class GroupDriver extends HtmlDriver {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(GroupDriver.id, false, el => el.kind = ElKind.group);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
GroupDriver.id = "group";
|
|
13
|
+
GroupDriver.glob = new GroupDriver();
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactiveTreeNode } from "reactronic";
|
|
2
|
+
import { El } from "../El.js";
|
|
3
|
+
import { HtmlDriver } from "../WebDriver.js";
|
|
4
|
+
export declare function row<T = void>(builder?: (element: void) => T, shiftCursorDown?: number): void;
|
|
5
|
+
export declare function rowBreak(shiftCursorDown?: number): void;
|
|
6
|
+
export declare class PartitionDriver<T extends HTMLElement> extends HtmlDriver<T> {
|
|
7
|
+
static readonly id = "part";
|
|
8
|
+
static readonly glob: PartitionDriver<HTMLElement>;
|
|
9
|
+
constructor();
|
|
10
|
+
rebuildBody(node: ReactiveTreeNode<El<T>>): void | Promise<void>;
|
|
11
|
+
provideHost(node: ReactiveTreeNode<El<T, any>>): ReactiveTreeNode<El<T, any>>;
|
|
12
|
+
}
|
|
13
|
+
export declare class WrapperDriver extends HtmlDriver<HTMLElement> {
|
|
14
|
+
static readonly id = "wrapper";
|
|
15
|
+
static readonly glob: WrapperDriver;
|
|
16
|
+
constructor();
|
|
17
|
+
}
|