verstak 0.24.303 → 0.24.308
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/html/DraggableArea.view.js +3 -3
- package/build/dist/source/html/El.js +8 -3
- package/build/dist/source/html/Elements.d.ts +11 -6
- package/build/dist/source/html/Elements.js +15 -14
- package/build/dist/source/html/Handlers.d.ts +1 -0
- package/build/dist/source/html/Handlers.js +29 -0
- package/build/dist/source/html/HtmlElements.d.ts +174 -174
- package/build/dist/source/html/HtmlElements.js +175 -175
- package/build/dist/source/html/sensors/ButtonSensor.js +20 -15
- package/build/dist/source/html/sensors/FocusSensor.js +17 -12
- package/build/dist/source/html/sensors/HoverSensor.js +19 -14
- package/build/dist/source/html/sensors/HtmlDragSensor.js +24 -19
- package/build/dist/source/html/sensors/KeyboardSensor.js +17 -12
- package/build/dist/source/html/sensors/PointerSensor.js +15 -10
- package/build/dist/source/html/sensors/ScrollSensor.js +13 -8
- package/build/dist/source/html/sensors/WheelSensor.js +13 -8
- package/package.json +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Mode } from "reactronic";
|
|
1
|
+
import { Mode, RxNode } from "reactronic";
|
|
2
2
|
import { Div } from "./HtmlElements.js";
|
|
3
3
|
import { Handling } from "./Elements.js";
|
|
4
4
|
export function DraggableArea(draggingId, builder) {
|
|
5
|
-
return (Div(builder, {
|
|
5
|
+
return (Div(RxNode.rebased(builder, {
|
|
6
6
|
mode: Mode.independentUpdate,
|
|
7
7
|
script: b => {
|
|
8
8
|
const e = b.native;
|
|
@@ -33,5 +33,5 @@ export function DraggableArea(draggingId, builder) {
|
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
35
|
},
|
|
36
|
-
}));
|
|
36
|
+
})));
|
|
37
37
|
}
|
|
@@ -65,8 +65,8 @@ export class ElImpl {
|
|
|
65
65
|
this._kind = ElKind.part;
|
|
66
66
|
this._place = undefined;
|
|
67
67
|
this._coords = UndefinedElCoords;
|
|
68
|
-
this._width =
|
|
69
|
-
this._height =
|
|
68
|
+
this._width = new Size();
|
|
69
|
+
this._height = new Size();
|
|
70
70
|
this._horizontal = undefined;
|
|
71
71
|
this._vertical = undefined;
|
|
72
72
|
this._contentHorizontal = undefined;
|
|
@@ -557,7 +557,12 @@ export class ElImpl {
|
|
|
557
557
|
const e = element.native;
|
|
558
558
|
if (e instanceof HTMLElement) {
|
|
559
559
|
element.sealed = value;
|
|
560
|
-
|
|
560
|
+
const t = Transaction.current;
|
|
561
|
+
Transaction.outside(() => {
|
|
562
|
+
t.whenFinished(true).then(() => {
|
|
563
|
+
e.sensors.resize.observeResizing(element, value !== undefined);
|
|
564
|
+
}, e => { });
|
|
565
|
+
});
|
|
561
566
|
}
|
|
562
567
|
}
|
|
563
568
|
static applyStylingPreset(element, secondary, styleName, enabled) {
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import { RxNodeDecl, RxNodeDriver, RxNode, Script, MergedItem } from "reactronic";
|
|
1
|
+
import { RxNodeDecl, RxNodeDriver, RxNode, Script, Mode, MergedItem, ScriptAsync } from "reactronic";
|
|
2
2
|
import { CursorCommandDriver, El, ElPlace } from "./El.js";
|
|
3
3
|
import { HtmlDriver } from "./HtmlDriver.js";
|
|
4
|
-
export declare function Panel<M = unknown>(
|
|
5
|
-
export declare function
|
|
4
|
+
export declare function Panel<M = unknown>(script?: Script<El<HTMLElement, M>>, scriptAsync?: ScriptAsync<El<HTMLElement, M>>, key?: string, mode?: Mode, creation?: Script<El<HTMLElement, M>>, creationAsync?: ScriptAsync<El<HTMLElement, M>>, destruction?: Script<El<HTMLElement, M>>, triggers?: unknown, basis?: RxNodeDecl<El<HTMLElement, M>>): RxNode<El<HTMLElement, M>>;
|
|
5
|
+
export declare function Panel<M = unknown>(declaration?: RxNodeDecl<El<HTMLElement, M>>): RxNode<El<HTMLElement, M>>;
|
|
6
|
+
export declare function Table<M = unknown>(script?: Script<El<HTMLElement, M>>, scriptAsync?: ScriptAsync<El<HTMLElement, M>>, key?: string, mode?: Mode, creation?: Script<El<HTMLElement, M>>, creationAsync?: ScriptAsync<El<HTMLElement, M>>, destruction?: Script<El<HTMLElement, M>>, triggers?: unknown, basis?: RxNodeDecl<El<HTMLElement, M>>): RxNode<El<HTMLElement, M>>;
|
|
7
|
+
export declare function Table<M = unknown>(declaration?: RxNodeDecl<El<HTMLElement, M>>): RxNode<El<HTMLElement, M>>;
|
|
6
8
|
export declare function row<T = void>(builder?: (element: void) => T, shiftCursorDown?: number): void;
|
|
7
|
-
export declare function Splitter<M = unknown,
|
|
9
|
+
export declare function Splitter<M = unknown>(script?: Script<El<HTMLElement, M>>, scriptAsync?: ScriptAsync<El<HTMLElement, M>>, key?: string, mode?: Mode, creation?: Script<El<HTMLElement, M>>, creationAsync?: ScriptAsync<El<HTMLElement, M>>, destruction?: Script<El<HTMLElement, M>>, triggers?: unknown, basis?: RxNodeDecl<El<HTMLElement, M>>): RxNode<El<HTMLElement, M>>;
|
|
10
|
+
export declare function Splitter<M = unknown>(declaration?: RxNodeDecl<El<HTMLElement, M>>): RxNode<El<HTMLElement, M>>;
|
|
8
11
|
export declare function rowBreak(shiftCursorDown?: number): void;
|
|
9
12
|
export declare function declareSplitter<T>(index: number, splitViewNode: RxNode<El<T>>): RxNode<El<HTMLElement>>;
|
|
10
13
|
export declare function cursor(areaParams: ElPlace): void;
|
|
11
14
|
export declare function Note(content: string, formatted?: boolean, declaration?: RxNodeDecl<El<HTMLElement, void>>): RxNode<El<HTMLElement, void>>;
|
|
12
|
-
export declare function Group<M = unknown,
|
|
15
|
+
export declare function Group<M = unknown>(script?: Script<El<HTMLElement, M>>, scriptAsync?: ScriptAsync<El<HTMLElement, M>>, key?: string, mode?: Mode, creation?: Script<El<HTMLElement, M>>, creationAsync?: ScriptAsync<El<HTMLElement, M>>, destruction?: Script<El<HTMLElement, M>>, triggers?: unknown, basis?: RxNodeDecl<El<HTMLElement, M>>): RxNode<El<HTMLElement, M>>;
|
|
16
|
+
export declare function Group<M = unknown>(declaration?: RxNodeDecl<El<HTMLElement, M>>): RxNode<El<HTMLElement, M>>;
|
|
13
17
|
export declare function Handling<M = unknown>(script: Script<El<void, M>>): RxNode<El<void, M>>;
|
|
14
|
-
export declare function SyntheticElement<M = unknown>(
|
|
18
|
+
export declare function SyntheticElement<M = unknown>(script?: Script<El<void, M>>, scriptAsync?: ScriptAsync<El<void, M>>, key?: string, mode?: Mode, creation?: Script<El<void, M>>, creationAsync?: ScriptAsync<El<void, M>>, destruction?: Script<El<void, M>>, triggers?: unknown, basis?: RxNodeDecl<El<void, M>>): RxNode<El<void, M>>;
|
|
19
|
+
export declare function SyntheticElement<M = unknown>(declaration?: RxNodeDecl<El<void, M>>): RxNode<El<void, M>>;
|
|
15
20
|
export declare class PanelDriver<T extends HTMLElement> extends HtmlDriver<T> {
|
|
16
21
|
update(node: RxNode<El<T>>): void | Promise<void>;
|
|
17
22
|
child(ownerNode: RxNode<El<T, any>>, childDriver: RxNodeDriver<any>, childDeclaration?: RxNodeDecl<any> | undefined, childBasis?: RxNodeDecl<any> | undefined): MergedItem<RxNode> | undefined;
|
|
@@ -4,18 +4,18 @@ import { getPrioritiesForEmptySpaceDistribution, getPrioritiesForSizeChanging, r
|
|
|
4
4
|
import { Axis, BodyFontSize, Dimension, toPx } from "./Sizes.js";
|
|
5
5
|
import { HtmlDriver } from "./HtmlDriver.js";
|
|
6
6
|
import { clamp } from "./ElUtils.js";
|
|
7
|
-
export function Panel(
|
|
8
|
-
return RxNode.declare(Drivers.panel,
|
|
7
|
+
export function Panel(scriptOrDeclaration, scriptAsync, key, mode, creation, creationAsync, destruction, triggers, basis) {
|
|
8
|
+
return RxNode.declare(Drivers.panel, scriptOrDeclaration, scriptAsync, key, mode, creation, creationAsync, destruction, triggers, basis);
|
|
9
9
|
}
|
|
10
|
-
export function Table(
|
|
11
|
-
return RxNode.declare(Drivers.table,
|
|
10
|
+
export function Table(scriptOrDeclaration, scriptAsync, key, mode, creation, creationAsync, destruction, triggers, basis) {
|
|
11
|
+
return RxNode.declare(Drivers.table, scriptOrDeclaration, scriptAsync, key, mode, creation, creationAsync, destruction, triggers, basis);
|
|
12
12
|
}
|
|
13
13
|
export function row(builder, shiftCursorDown) {
|
|
14
14
|
rowBreak(shiftCursorDown);
|
|
15
15
|
builder === null || builder === void 0 ? void 0 : builder();
|
|
16
16
|
}
|
|
17
|
-
export function Splitter(
|
|
18
|
-
return RxNode.declare(Drivers.splitter,
|
|
17
|
+
export function Splitter(scriptOrDeclaration, scriptAsync, key, mode, creation, creationAsync, destruction, triggers, basis) {
|
|
18
|
+
return RxNode.declare(Drivers.splitter, scriptOrDeclaration, scriptAsync, key, mode, creation, creationAsync, destruction, triggers, basis);
|
|
19
19
|
}
|
|
20
20
|
export function rowBreak(shiftCursorDown) {
|
|
21
21
|
RxNode.declare(Drivers.partition);
|
|
@@ -81,23 +81,23 @@ export function cursor(areaParams) {
|
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
export function Note(content, formatted, declaration) {
|
|
84
|
-
return RxNode.declare(Drivers.note, declaration, {
|
|
84
|
+
return RxNode.declare(Drivers.note, RxNode.rebased(declaration, {
|
|
85
85
|
script: el => {
|
|
86
86
|
if (formatted)
|
|
87
87
|
el.native.innerHTML = content;
|
|
88
88
|
else
|
|
89
89
|
el.native.innerText = content;
|
|
90
90
|
},
|
|
91
|
-
});
|
|
91
|
+
}));
|
|
92
92
|
}
|
|
93
|
-
export function Group(
|
|
94
|
-
return RxNode.declare(Drivers.group,
|
|
93
|
+
export function Group(scriptOrDeclaration, scriptAsync, key, mode, creation, creationAsync, destruction, triggers, basis) {
|
|
94
|
+
return RxNode.declare(Drivers.group, scriptOrDeclaration, scriptAsync, key, mode, creation, creationAsync, destruction, triggers, basis);
|
|
95
95
|
}
|
|
96
96
|
export function Handling(script) {
|
|
97
97
|
return SyntheticElement({ mode: Mode.independentUpdate, script });
|
|
98
98
|
}
|
|
99
|
-
export function SyntheticElement(
|
|
100
|
-
return RxNode.declare(Drivers.synthetic,
|
|
99
|
+
export function SyntheticElement(scriptOrDeclaration, scriptAsync, key, mode, creation, creationAsync, destruction, triggers, basis) {
|
|
100
|
+
return RxNode.declare(Drivers.synthetic, scriptOrDeclaration, scriptAsync, key, mode, creation, creationAsync, destruction, triggers, basis);
|
|
101
101
|
}
|
|
102
102
|
export class PanelDriver extends HtmlDriver {
|
|
103
103
|
update(node) {
|
|
@@ -121,7 +121,7 @@ export class PanelDriver extends HtmlDriver {
|
|
|
121
121
|
layoutInfo.contentSizeYpx = contentBoxPx.blockSize;
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
|
-
SyntheticElement({
|
|
124
|
+
const relayoutEl = SyntheticElement({
|
|
125
125
|
mode: Mode.independentUpdate,
|
|
126
126
|
script: () => {
|
|
127
127
|
const native = el.native;
|
|
@@ -155,7 +155,7 @@ export class PanelDriver extends HtmlDriver {
|
|
|
155
155
|
size.preferred = undefined;
|
|
156
156
|
preferred.push(i);
|
|
157
157
|
}
|
|
158
|
-
const sizePx =
|
|
158
|
+
const sizePx = partEl.layoutInfo.effectiveSizePx = clamp(partEl.layoutInfo.effectiveSizePx, minPx, maxPx);
|
|
159
159
|
sizesPx.push({ node: child.instance, sizePx });
|
|
160
160
|
i++;
|
|
161
161
|
}
|
|
@@ -169,6 +169,7 @@ export class PanelDriver extends HtmlDriver {
|
|
|
169
169
|
});
|
|
170
170
|
RxNode.updateNestedNodesThenDo(() => {
|
|
171
171
|
layoutInfo.isUpdateFinished = true;
|
|
172
|
+
RxNode.triggerUpdate(relayoutEl, { stamp: node.stamp });
|
|
172
173
|
});
|
|
173
174
|
}
|
|
174
175
|
return result;
|
|
@@ -3,5 +3,6 @@ import { FocusModel } from "./sensors/FocusSensor.js";
|
|
|
3
3
|
import { ResizedElement } from "./sensors/ResizeSensor.js";
|
|
4
4
|
import { PointerSensor } from "./sensors/PointerSensor.js";
|
|
5
5
|
export declare function OnClick(target: HTMLElement, action: ((pointer: PointerSensor) => void) | ToggleRef | undefined, key?: string): void;
|
|
6
|
+
export declare function OnClickAsync(target: HTMLElement, action: ((pointer: PointerSensor) => Promise<void>) | ToggleRef | undefined, key?: string): void;
|
|
6
7
|
export declare function OnResize(target: HTMLElement, action: ((element: ResizedElement) => void) | undefined, key?: string): void;
|
|
7
8
|
export declare function OnFocus(target: HTMLElement, model: FocusModel, switchEditMode?: ((model: FocusModel) => void) | undefined, key?: string): void;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
import { Mode, ToggleRef, unobs } from "reactronic";
|
|
2
11
|
import { SyntheticElement } from "./Elements.js";
|
|
3
12
|
export function OnClick(target, action, key) {
|
|
@@ -20,6 +29,26 @@ export function OnClick(target, action, key) {
|
|
|
20
29
|
});
|
|
21
30
|
}
|
|
22
31
|
}
|
|
32
|
+
export function OnClickAsync(target, action, key) {
|
|
33
|
+
if (action !== undefined) {
|
|
34
|
+
SyntheticElement({
|
|
35
|
+
key,
|
|
36
|
+
mode: Mode.independentUpdate,
|
|
37
|
+
triggers: { target },
|
|
38
|
+
scriptAsync: (el) => __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const pointer = target.sensors.pointer;
|
|
40
|
+
if (target.dataForSensor.click !== undefined && pointer.clicked === target.dataForSensor.click || target.dataForSensor.click === undefined && pointer.clicked) {
|
|
41
|
+
if (action instanceof Function) {
|
|
42
|
+
yield unobs(() => action(pointer));
|
|
43
|
+
}
|
|
44
|
+
else if (action instanceof ToggleRef) {
|
|
45
|
+
unobs(() => action.toggle());
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}),
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
23
52
|
export function OnResize(target, action, key) {
|
|
24
53
|
if (action) {
|
|
25
54
|
SyntheticElement({
|