verstak 0.24.277 → 0.24.303
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/archive/RxDomV1.js +3 -3
- package/build/dist/source/html/El.d.ts +3 -8
- package/build/dist/source/html/El.js +8 -40
- package/build/dist/source/html/Elements.d.ts +14 -9
- package/build/dist/source/html/Elements.js +79 -77
- package/build/dist/source/html/HtmlDriver.d.ts +3 -3
- package/build/dist/source/html/HtmlDriver.js +19 -13
- package/build/dist/source/html/HtmlElements.d.ts +174 -174
- package/build/dist/source/html/HtmlElements.js +175 -175
- package/build/dist/source/html/SplitViewMath.js +44 -37
- package/build/dist/source/html/sensors/ButtonSensor.js +1 -1
- package/build/dist/source/html/sensors/HtmlDragSensor.js +1 -1
- package/build/dist/source/html/sensors/PointerSensor.js +1 -1
- package/package.json +3 -3
|
@@ -56,7 +56,7 @@ export class BasicNodeType {
|
|
|
56
56
|
if (inst) {
|
|
57
57
|
inst.native = undefined;
|
|
58
58
|
if (!node.inline && node.instance)
|
|
59
|
-
Transaction.
|
|
59
|
+
Transaction.isolate(() => RxSystem.dispose(node.instance));
|
|
60
60
|
for (const x of inst.children)
|
|
61
61
|
tryToFinalize(x, initiator);
|
|
62
62
|
for (const x of inst.guests)
|
|
@@ -345,8 +345,8 @@ export class RxDom {
|
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
|
-
static renderIncrementally(
|
|
349
|
-
return __awaiter(this,
|
|
348
|
+
static renderIncrementally(parent_1, p1_1, p2_1) {
|
|
349
|
+
return __awaiter(this, arguments, void 0, function* (parent, p1, p2, checkEveryN = 30, timeLimit = 12) {
|
|
350
350
|
if (Transaction.isFrameOver(checkEveryN, timeLimit))
|
|
351
351
|
yield Transaction.requestNextFrame();
|
|
352
352
|
if (!Transaction.isCanceled) {
|
|
@@ -63,7 +63,7 @@ export declare enum PosV {
|
|
|
63
63
|
export type Range = {
|
|
64
64
|
readonly min?: string;
|
|
65
65
|
readonly max?: string;
|
|
66
|
-
|
|
66
|
+
preferred?: string;
|
|
67
67
|
};
|
|
68
68
|
export type MarkedRange = Range & {
|
|
69
69
|
readonly marker?: string;
|
|
@@ -122,8 +122,6 @@ export declare class ElImpl<T extends Element = any, M = any> implements El<T, M
|
|
|
122
122
|
minPx: number;
|
|
123
123
|
maxPx: number;
|
|
124
124
|
});
|
|
125
|
-
get preferredWidthUsed(): boolean;
|
|
126
|
-
set preferredWidthUsed(value: boolean);
|
|
127
125
|
get height(): Range;
|
|
128
126
|
set height(value: Range);
|
|
129
127
|
get heightPx(): {
|
|
@@ -134,8 +132,6 @@ export declare class ElImpl<T extends Element = any, M = any> implements El<T, M
|
|
|
134
132
|
minPx: number;
|
|
135
133
|
maxPx: number;
|
|
136
134
|
});
|
|
137
|
-
get preferredHeightUsed(): boolean;
|
|
138
|
-
set preferredHeightUsed(value: boolean);
|
|
139
135
|
get horizontal(): PosH | undefined;
|
|
140
136
|
set horizontal(value: PosH | undefined);
|
|
141
137
|
get vertical(): PosV | undefined;
|
|
@@ -185,13 +181,11 @@ export declare class ElLayoutInfo {
|
|
|
185
181
|
alignerY?: ElImpl;
|
|
186
182
|
flags: ElLayoutInfoFlags;
|
|
187
183
|
effectiveSizePx: number;
|
|
188
|
-
offsetXpx: number;
|
|
189
|
-
offsetYpx: number;
|
|
190
184
|
contentSizeXpx: number;
|
|
191
185
|
contentSizeYpx: number;
|
|
192
186
|
borderSizeYpx: number;
|
|
193
187
|
borderSizeXpx: number;
|
|
194
|
-
|
|
188
|
+
isUpdateFinished: boolean;
|
|
195
189
|
constructor(prev: ElLayoutInfo);
|
|
196
190
|
}
|
|
197
191
|
declare enum ElLayoutInfoFlags {
|
|
@@ -213,6 +207,7 @@ export declare class CursorCommandDriver extends ElDriver<Element, unknown> {
|
|
|
213
207
|
export declare const Constants: {
|
|
214
208
|
element: string;
|
|
215
209
|
partition: string;
|
|
210
|
+
wrapper: string;
|
|
216
211
|
splitter: string;
|
|
217
212
|
group: string;
|
|
218
213
|
layouts: string[];
|
|
@@ -47,7 +47,6 @@ class Size extends ObservableObject {
|
|
|
47
47
|
this.raw = { min: "", max: "" };
|
|
48
48
|
this.minPx = 0;
|
|
49
49
|
this.maxPx = Number.POSITIVE_INFINITY;
|
|
50
|
-
this.preferredUsed = false;
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
52
|
export class ElDriver extends BaseDriver {
|
|
@@ -66,8 +65,8 @@ export class ElImpl {
|
|
|
66
65
|
this._kind = ElKind.part;
|
|
67
66
|
this._place = undefined;
|
|
68
67
|
this._coords = UndefinedElCoords;
|
|
69
|
-
this._width = Transaction.
|
|
70
|
-
this._height = Transaction.
|
|
68
|
+
this._width = Transaction.isolate(() => new Size());
|
|
69
|
+
this._height = Transaction.isolate(() => new Size());
|
|
71
70
|
this._horizontal = undefined;
|
|
72
71
|
this._vertical = undefined;
|
|
73
72
|
this._contentHorizontal = undefined;
|
|
@@ -125,7 +124,6 @@ export class ElImpl {
|
|
|
125
124
|
if (value.min !== w.min || value.max !== w.max || value.preferred !== undefined) {
|
|
126
125
|
ElImpl.applyWidth(this, value);
|
|
127
126
|
this._width.raw = value;
|
|
128
|
-
this._width.preferredUsed = false;
|
|
129
127
|
}
|
|
130
128
|
}
|
|
131
129
|
get widthPx() { return this._width; }
|
|
@@ -136,19 +134,12 @@ export class ElImpl {
|
|
|
136
134
|
if (value.maxPx !== w.maxPx)
|
|
137
135
|
this._width.maxPx = value.maxPx;
|
|
138
136
|
}
|
|
139
|
-
get preferredWidthUsed() {
|
|
140
|
-
return this._width.preferredUsed;
|
|
141
|
-
}
|
|
142
|
-
set preferredWidthUsed(value) {
|
|
143
|
-
this._width.preferredUsed = value;
|
|
144
|
-
}
|
|
145
137
|
get height() { return this._height.raw; }
|
|
146
138
|
set height(value) {
|
|
147
139
|
const h = this._height.raw;
|
|
148
140
|
if (value.min !== h.min || value.max !== h.max || value.preferred !== undefined) {
|
|
149
141
|
ElImpl.applyHeight(this, value);
|
|
150
142
|
this._height.raw = value;
|
|
151
|
-
this._height.preferredUsed = false;
|
|
152
143
|
}
|
|
153
144
|
}
|
|
154
145
|
get heightPx() { return this._height; }
|
|
@@ -159,12 +150,6 @@ export class ElImpl {
|
|
|
159
150
|
if (value.maxPx !== w.maxPx)
|
|
160
151
|
this._height.maxPx = value.maxPx;
|
|
161
152
|
}
|
|
162
|
-
get preferredHeightUsed() {
|
|
163
|
-
return this._height.preferredUsed;
|
|
164
|
-
}
|
|
165
|
-
set preferredHeightUsed(value) {
|
|
166
|
-
this._height.preferredUsed = value;
|
|
167
|
-
}
|
|
168
153
|
get horizontal() { return this._horizontal; }
|
|
169
154
|
set horizontal(value) {
|
|
170
155
|
const existing = this._horizontal;
|
|
@@ -566,14 +551,13 @@ export class ElImpl {
|
|
|
566
551
|
static applySealed(element, value) {
|
|
567
552
|
const e = element.native;
|
|
568
553
|
if (e instanceof HTMLElement) {
|
|
569
|
-
Transaction.separate(() => e.sensors.resize.observeResizing(element, value !== undefined));
|
|
570
554
|
}
|
|
571
555
|
}
|
|
572
556
|
static applySplitView(element, value) {
|
|
573
557
|
const e = element.native;
|
|
574
558
|
if (e instanceof HTMLElement) {
|
|
575
559
|
element.sealed = value;
|
|
576
|
-
e.
|
|
560
|
+
Transaction.isolate(() => e.sensors.resize.observeResizing(element, value !== undefined));
|
|
577
561
|
}
|
|
578
562
|
}
|
|
579
563
|
static applyStylingPreset(element, secondary, styleName, enabled) {
|
|
@@ -595,27 +579,17 @@ export class ElLayoutInfo {
|
|
|
595
579
|
this.alignerY = undefined;
|
|
596
580
|
this.flags = prev.flags & ~ElLayoutInfoFlags.ownCursorPosition;
|
|
597
581
|
this.effectiveSizePx = 0;
|
|
598
|
-
this.offsetXpx = 0;
|
|
599
|
-
this.offsetYpx = 0;
|
|
600
582
|
this.contentSizeXpx = 0;
|
|
601
583
|
this.contentSizeYpx = 0;
|
|
602
584
|
this.borderSizeXpx = 0;
|
|
603
585
|
this.borderSizeYpx = 0;
|
|
604
|
-
this.
|
|
586
|
+
this.isUpdateFinished = false;
|
|
605
587
|
}
|
|
606
588
|
}
|
|
607
589
|
__decorate([
|
|
608
590
|
obs,
|
|
609
591
|
__metadata("design:type", Number)
|
|
610
592
|
], ElLayoutInfo.prototype, "effectiveSizePx", void 0);
|
|
611
|
-
__decorate([
|
|
612
|
-
obs,
|
|
613
|
-
__metadata("design:type", Number)
|
|
614
|
-
], ElLayoutInfo.prototype, "offsetXpx", void 0);
|
|
615
|
-
__decorate([
|
|
616
|
-
obs,
|
|
617
|
-
__metadata("design:type", Number)
|
|
618
|
-
], ElLayoutInfo.prototype, "offsetYpx", void 0);
|
|
619
593
|
__decorate([
|
|
620
594
|
obs,
|
|
621
595
|
__metadata("design:type", Number)
|
|
@@ -635,7 +609,7 @@ __decorate([
|
|
|
635
609
|
__decorate([
|
|
636
610
|
obs,
|
|
637
611
|
__metadata("design:type", Boolean)
|
|
638
|
-
], ElLayoutInfo.prototype, "
|
|
612
|
+
], ElLayoutInfo.prototype, "isUpdateFinished", void 0);
|
|
639
613
|
var ElLayoutInfoFlags;
|
|
640
614
|
(function (ElLayoutInfoFlags) {
|
|
641
615
|
ElLayoutInfoFlags[ElLayoutInfoFlags["none"] = 0] = "none";
|
|
@@ -645,7 +619,7 @@ var ElLayoutInfoFlags;
|
|
|
645
619
|
ElLayoutInfoFlags[ElLayoutInfoFlags["childrenRelayoutIsNeeded"] = 8] = "childrenRelayoutIsNeeded";
|
|
646
620
|
})(ElLayoutInfoFlags || (ElLayoutInfoFlags = {}));
|
|
647
621
|
const UndefinedElCoords = Object.freeze({ x1: 0, y1: 0, x2: 0, y2: 0 });
|
|
648
|
-
export const InitialElLayoutInfo = Object.freeze(new ElLayoutInfo({ x: 1, y: 1, runningMaxX: 0, runningMaxY: 0, flags: ElLayoutInfoFlags.none, effectiveSizePx: 0,
|
|
622
|
+
export const InitialElLayoutInfo = Object.freeze(new ElLayoutInfo({ x: 1, y: 1, runningMaxX: 0, runningMaxY: 0, flags: ElLayoutInfoFlags.none, effectiveSizePx: 0, contentSizeXpx: 0, contentSizeYpx: 0, borderSizeXpx: 0, borderSizeYpx: 0, isUpdateFinished: false }));
|
|
649
623
|
function getElCoordsAndAdjustLayoutInfo(isRegularElement, place, maxX, maxY, prevElLayoutInfo, layoutInfo) {
|
|
650
624
|
var _a, _b;
|
|
651
625
|
let result;
|
|
@@ -757,6 +731,7 @@ export class CursorCommandDriver extends ElDriver {
|
|
|
757
731
|
export const Constants = {
|
|
758
732
|
element: "el",
|
|
759
733
|
partition: "part",
|
|
734
|
+
wrapper: "wrapper",
|
|
760
735
|
splitter: "splitter",
|
|
761
736
|
group: "group",
|
|
762
737
|
layouts: ["panel", "table", "note", "group", "", "", ""],
|
|
@@ -773,10 +748,6 @@ const VerstakDriversByLayout = [
|
|
|
773
748
|
s.textAlign = "initial";
|
|
774
749
|
s.flexShrink = "1";
|
|
775
750
|
s.minWidth = "0";
|
|
776
|
-
if (owner.splitView !== undefined) {
|
|
777
|
-
s.overflow = "hidden";
|
|
778
|
-
s.flexGrow = "1";
|
|
779
|
-
}
|
|
780
751
|
},
|
|
781
752
|
el => {
|
|
782
753
|
const owner = el.node.owner.element;
|
|
@@ -787,10 +758,6 @@ const VerstakDriversByLayout = [
|
|
|
787
758
|
s.gridAutoRows = "minmax(min-content, 1fr)";
|
|
788
759
|
s.gridAutoColumns = "minmax(min-content, 1fr)";
|
|
789
760
|
s.textAlign = "initial";
|
|
790
|
-
if (owner.splitView !== undefined) {
|
|
791
|
-
s.overflow = "hidden";
|
|
792
|
-
s.flexGrow = "1";
|
|
793
|
-
}
|
|
794
761
|
},
|
|
795
762
|
el => {
|
|
796
763
|
const owner = el.node.owner.element;
|
|
@@ -810,6 +777,7 @@ const VerstakDriversByLayout = [
|
|
|
810
777
|
s.flexDirection = "row";
|
|
811
778
|
s.alignItems = "center";
|
|
812
779
|
s.gap = "inherit";
|
|
780
|
+
s.position = owner.sealed !== undefined ? "relative" : "";
|
|
813
781
|
},
|
|
814
782
|
el => {
|
|
815
783
|
const s = el.style;
|
|
@@ -1,28 +1,33 @@
|
|
|
1
|
-
import { RxNodeDecl, RxNodeDriver, RxNode,
|
|
1
|
+
import { RxNodeDecl, RxNodeDriver, RxNode, Script, MergedItem } 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>(declaration?: RxNodeDecl<El<HTMLElement, M>>,
|
|
5
|
-
export declare function Table<M = unknown, R = void>(declaration?: RxNodeDecl<El<HTMLElement, M>>,
|
|
4
|
+
export declare function Panel<M = unknown>(declaration?: RxNodeDecl<El<HTMLElement, M>>, basis?: RxNodeDecl<El<HTMLElement, M>>): RxNode<El<HTMLElement, M>>;
|
|
5
|
+
export declare function Table<M = unknown, R = void>(declaration?: RxNodeDecl<El<HTMLElement, M>>, basis?: RxNodeDecl<El<HTMLElement, M>>): RxNode<El<HTMLElement, M>>;
|
|
6
6
|
export declare function row<T = void>(builder?: (element: void) => T, shiftCursorDown?: number): void;
|
|
7
|
-
export declare function Splitter<M = unknown, R = void>(declaration?: RxNodeDecl<El<HTMLElement, M>>,
|
|
7
|
+
export declare function Splitter<M = unknown, R = void>(declaration?: RxNodeDecl<El<HTMLElement, M>>, basis?: RxNodeDecl<El<HTMLElement, M>>): RxNode<El<HTMLElement, M>>;
|
|
8
8
|
export declare function rowBreak(shiftCursorDown?: number): void;
|
|
9
9
|
export declare function declareSplitter<T>(index: number, splitViewNode: RxNode<El<T>>): RxNode<El<HTMLElement>>;
|
|
10
10
|
export declare function cursor(areaParams: ElPlace): void;
|
|
11
11
|
export declare function Note(content: string, formatted?: boolean, declaration?: RxNodeDecl<El<HTMLElement, void>>): RxNode<El<HTMLElement, void>>;
|
|
12
|
-
export declare function Group<M = unknown, R = void>(declaration?: RxNodeDecl<El<HTMLElement, M>>,
|
|
13
|
-
export declare function Handling<M = unknown>(script:
|
|
14
|
-
export declare function SyntheticElement<M = unknown>(declaration?: RxNodeDecl<El<void, M>>,
|
|
12
|
+
export declare function Group<M = unknown, R = void>(declaration?: RxNodeDecl<El<HTMLElement, M>>, basis?: RxNodeDecl<El<HTMLElement, M>>): RxNode<El<HTMLElement, M>>;
|
|
13
|
+
export declare function Handling<M = unknown>(script: Script<El<void, M>>): RxNode<El<void, M>>;
|
|
14
|
+
export declare function SyntheticElement<M = unknown>(declaration?: RxNodeDecl<El<void, M>>, basis?: RxNodeDecl<El<void, M>>): RxNode<El<void, M>>;
|
|
15
15
|
export declare class PanelDriver<T extends HTMLElement> extends HtmlDriver<T> {
|
|
16
16
|
update(node: RxNode<El<T>>): void | Promise<void>;
|
|
17
|
-
child(ownerNode: RxNode<El<T, any>>, childDriver: RxNodeDriver<any>, childDeclaration?: RxNodeDecl<any> | undefined,
|
|
17
|
+
child(ownerNode: RxNode<El<T, any>>, childDriver: RxNodeDriver<any>, childDeclaration?: RxNodeDecl<any> | undefined, childBasis?: RxNodeDecl<any> | undefined): MergedItem<RxNode> | undefined;
|
|
18
18
|
}
|
|
19
19
|
export declare function isSplitViewPartition(childDriver: RxNodeDriver): boolean;
|
|
20
|
+
export declare class PartitionDriver<T extends HTMLElement> extends HtmlDriver<T> {
|
|
21
|
+
update(node: RxNode<El<T>>): void | Promise<void>;
|
|
22
|
+
getHost(node: RxNode<El<T, any>>): RxNode<El<T, any>>;
|
|
23
|
+
}
|
|
20
24
|
export declare const Drivers: {
|
|
21
25
|
panel: PanelDriver<HTMLElement>;
|
|
22
26
|
table: HtmlDriver<HTMLElement, any>;
|
|
23
27
|
note: HtmlDriver<HTMLElement, any>;
|
|
24
28
|
group: HtmlDriver<HTMLElement, any>;
|
|
25
|
-
partition:
|
|
29
|
+
partition: PartitionDriver<HTMLElement>;
|
|
30
|
+
wrapper: HtmlDriver<HTMLElement, any>;
|
|
26
31
|
splitter: HtmlDriver<HTMLElement, any>;
|
|
27
32
|
cursor: CursorCommandDriver;
|
|
28
33
|
synthetic: RxNodeDriver<El<void, any>>;
|
|
@@ -4,30 +4,21 @@ 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(declaration,
|
|
8
|
-
return RxNode.declare(Drivers.panel, declaration,
|
|
7
|
+
export function Panel(declaration, basis) {
|
|
8
|
+
return RxNode.declare(Drivers.panel, declaration, basis);
|
|
9
9
|
}
|
|
10
|
-
export function Table(declaration,
|
|
11
|
-
return RxNode.declare(Drivers.table, declaration,
|
|
10
|
+
export function Table(declaration, basis) {
|
|
11
|
+
return RxNode.declare(Drivers.table, declaration, 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(declaration,
|
|
18
|
-
return RxNode.declare(Drivers.splitter, declaration,
|
|
17
|
+
export function Splitter(declaration, basis) {
|
|
18
|
+
return RxNode.declare(Drivers.splitter, declaration, basis);
|
|
19
19
|
}
|
|
20
20
|
export function rowBreak(shiftCursorDown) {
|
|
21
|
-
RxNode.declare(Drivers.partition
|
|
22
|
-
script: el => {
|
|
23
|
-
const ownerEl = el.node.owner.element;
|
|
24
|
-
if (ownerEl.splitView !== undefined) {
|
|
25
|
-
el.style.display = "grid";
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
});
|
|
21
|
+
RxNode.declare(Drivers.partition);
|
|
31
22
|
}
|
|
32
23
|
export function declareSplitter(index, splitViewNode) {
|
|
33
24
|
const key = `splitter-${index}`;
|
|
@@ -99,73 +90,45 @@ export function Note(content, formatted, declaration) {
|
|
|
99
90
|
},
|
|
100
91
|
});
|
|
101
92
|
}
|
|
102
|
-
export function Group(declaration,
|
|
103
|
-
return RxNode.declare(Drivers.group, declaration,
|
|
93
|
+
export function Group(declaration, basis) {
|
|
94
|
+
return RxNode.declare(Drivers.group, declaration, basis);
|
|
104
95
|
}
|
|
105
96
|
export function Handling(script) {
|
|
106
97
|
return SyntheticElement({ mode: Mode.independentUpdate, script });
|
|
107
98
|
}
|
|
108
|
-
export function SyntheticElement(declaration,
|
|
109
|
-
return RxNode.declare(Drivers.synthetic, declaration,
|
|
99
|
+
export function SyntheticElement(declaration, basis) {
|
|
100
|
+
return RxNode.declare(Drivers.synthetic, declaration, basis);
|
|
110
101
|
}
|
|
111
102
|
export class PanelDriver extends HtmlDriver {
|
|
112
103
|
update(node) {
|
|
113
104
|
rowBreak();
|
|
114
|
-
const result = super.update(node);
|
|
115
105
|
const el = node.element;
|
|
116
|
-
|
|
106
|
+
const result = super.update(node);
|
|
107
|
+
if (el.splitView !== undefined) {
|
|
108
|
+
if (el.layoutInfo === undefined)
|
|
109
|
+
el.layoutInfo = new ElLayoutInfo(InitialElLayoutInfo);
|
|
110
|
+
const layoutInfo = el.layoutInfo;
|
|
111
|
+
layoutInfo.isUpdateFinished = false;
|
|
117
112
|
Handling(h => {
|
|
118
|
-
var _a, _b;
|
|
119
113
|
const native = el.native;
|
|
120
114
|
const resize = native.sensors.resize;
|
|
121
|
-
const isHorizontal = el.sealed === Direction.horizontal;
|
|
122
115
|
for (const x of resize.resizedElements) {
|
|
123
|
-
|
|
124
|
-
el.layoutInfo = new ElLayoutInfo(InitialElLayoutInfo);
|
|
125
|
-
const rect = x.contentRect;
|
|
116
|
+
const borderBoxPx = x.borderBoxSize[0];
|
|
126
117
|
const contentBoxPx = x.contentBoxSize[0];
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
el.layoutInfo.contentSizeXpx = containerSizeXpx;
|
|
132
|
-
el.layoutInfo.contentSizeYpx = containerSizeYpx;
|
|
133
|
-
el.layoutInfo.borderSizeXpx = x.borderBoxSize[0].inlineSize;
|
|
134
|
-
el.layoutInfo.borderSizeYpx = x.borderBoxSize[0].blockSize;
|
|
135
|
-
const wrapper = (_a = node.children.firstMergedItem()) === null || _a === void 0 ? void 0 : _a.instance;
|
|
136
|
-
if (wrapper !== undefined) {
|
|
137
|
-
const wrapperEl = wrapper.element;
|
|
138
|
-
el.layoutInfo.isConstrained = true;
|
|
139
|
-
if (isHorizontal)
|
|
140
|
-
wrapperEl.style.width = wrapperEl.style.maxWidth = `${containerSizeXpx}px`;
|
|
141
|
-
else
|
|
142
|
-
wrapperEl.style.height = wrapperEl.style.maxHeight = `${containerSizeYpx}px`;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
if (h.node.stamp === 1) {
|
|
146
|
-
const wrapper = (_b = node.children.firstMergedItem()) === null || _b === void 0 ? void 0 : _b.instance;
|
|
147
|
-
if (wrapper !== undefined) {
|
|
148
|
-
const wrapperEl = wrapper.element;
|
|
149
|
-
if (isHorizontal)
|
|
150
|
-
wrapperEl.style.width = wrapperEl.style.maxWidth = "0px";
|
|
151
|
-
else
|
|
152
|
-
wrapperEl.style.height = wrapperEl.style.maxHeight = "0px";
|
|
153
|
-
}
|
|
118
|
+
layoutInfo.borderSizeXpx = borderBoxPx.inlineSize;
|
|
119
|
+
layoutInfo.borderSizeYpx = borderBoxPx.blockSize;
|
|
120
|
+
layoutInfo.contentSizeXpx = contentBoxPx.inlineSize;
|
|
121
|
+
layoutInfo.contentSizeYpx = contentBoxPx.blockSize;
|
|
154
122
|
}
|
|
155
123
|
});
|
|
156
|
-
}
|
|
157
|
-
if (el.splitView !== undefined) {
|
|
158
124
|
SyntheticElement({
|
|
159
125
|
mode: Mode.independentUpdate,
|
|
160
|
-
triggers: { stamp: el.node.stamp },
|
|
161
126
|
script: () => {
|
|
162
127
|
const native = el.native;
|
|
163
128
|
const isHorizontal = el.splitView === Direction.horizontal;
|
|
164
|
-
if (
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
const surroundingXpx = el.layoutInfo.borderSizeXpx - el.layoutInfo.contentSizeXpx;
|
|
168
|
-
const surroundingYpx = el.layoutInfo.borderSizeYpx - el.layoutInfo.contentSizeYpx;
|
|
129
|
+
if (layoutInfo.isUpdateFinished) {
|
|
130
|
+
const surroundingXpx = layoutInfo.borderSizeXpx - layoutInfo.contentSizeXpx;
|
|
131
|
+
const surroundingYpx = layoutInfo.borderSizeYpx - layoutInfo.contentSizeYpx;
|
|
169
132
|
let i = 0;
|
|
170
133
|
const preferred = [];
|
|
171
134
|
const sizesPx = [];
|
|
@@ -186,20 +149,13 @@ export class PanelDriver extends HtmlDriver {
|
|
|
186
149
|
partEl.widthPx = { minPx, maxPx };
|
|
187
150
|
else
|
|
188
151
|
partEl.heightPx = { minPx, maxPx };
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
partEl.layoutInfo.effectiveSizePx = preferredPx;
|
|
195
|
-
preferred.push(i);
|
|
196
|
-
}
|
|
197
|
-
if (isHorizontal)
|
|
198
|
-
partEl.preferredWidthUsed = true;
|
|
199
|
-
else
|
|
200
|
-
partEl.preferredHeightUsed = true;
|
|
152
|
+
const preferredPx = size.preferred ? toPx(Dimension.parse(size.preferred), options) : 0;
|
|
153
|
+
if (preferredPx > 0) {
|
|
154
|
+
partEl.layoutInfo.effectiveSizePx = preferredPx;
|
|
155
|
+
size.preferred = undefined;
|
|
156
|
+
preferred.push(i);
|
|
201
157
|
}
|
|
202
|
-
const sizePx = partEl.layoutInfo.effectiveSizePx = clamp(partEl.layoutInfo.effectiveSizePx, minPx, maxPx);
|
|
158
|
+
const sizePx = unobs(() => partEl.layoutInfo.effectiveSizePx = clamp(partEl.layoutInfo.effectiveSizePx, minPx, maxPx));
|
|
203
159
|
sizesPx.push({ node: child.instance, sizePx });
|
|
204
160
|
i++;
|
|
205
161
|
}
|
|
@@ -211,10 +167,13 @@ export class PanelDriver extends HtmlDriver {
|
|
|
211
167
|
}
|
|
212
168
|
},
|
|
213
169
|
});
|
|
170
|
+
RxNode.updateNestedNodesThenDo(() => {
|
|
171
|
+
layoutInfo.isUpdateFinished = true;
|
|
172
|
+
});
|
|
214
173
|
}
|
|
215
174
|
return result;
|
|
216
175
|
}
|
|
217
|
-
child(ownerNode, childDriver, childDeclaration,
|
|
176
|
+
child(ownerNode, childDriver, childDeclaration, childBasis) {
|
|
218
177
|
var _a;
|
|
219
178
|
let result = undefined;
|
|
220
179
|
const el = ownerNode.element;
|
|
@@ -260,12 +219,55 @@ function overrideMethod(declaration, method, func) {
|
|
|
260
219
|
? (el, base) => { baseScript(el, base); func(el); }
|
|
261
220
|
: (el, base) => { base(); func(el); };
|
|
262
221
|
}
|
|
222
|
+
export class PartitionDriver extends HtmlDriver {
|
|
223
|
+
update(node) {
|
|
224
|
+
const result = super.update(node);
|
|
225
|
+
const ownerEl = node.owner.element;
|
|
226
|
+
if (ownerEl.sealed !== undefined) {
|
|
227
|
+
node.element.style.flexGrow = "1";
|
|
228
|
+
RxNode.declare(Drivers.wrapper, {
|
|
229
|
+
script: el => {
|
|
230
|
+
const ownerEl = el.node.owner.owner.element;
|
|
231
|
+
if (ownerEl.splitView !== undefined) {
|
|
232
|
+
el.style.display = "grid";
|
|
233
|
+
el.style.flexDirection = "";
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
if (ownerEl.isTable) {
|
|
237
|
+
el.style.display = "contents";
|
|
238
|
+
el.style.flexDirection = "";
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
el.style.display = "flex";
|
|
242
|
+
el.style.flexDirection = "row";
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
el.style.position = "absolute";
|
|
246
|
+
el.style.inset = "0";
|
|
247
|
+
el.style.overflow = "auto";
|
|
248
|
+
el.style.gap = "inherit";
|
|
249
|
+
},
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
return result;
|
|
253
|
+
}
|
|
254
|
+
getHost(node) {
|
|
255
|
+
let host;
|
|
256
|
+
const ownerEl = node.owner.element;
|
|
257
|
+
if (ownerEl.sealed !== undefined)
|
|
258
|
+
host = node.children.firstMergedItem().instance;
|
|
259
|
+
else
|
|
260
|
+
host = node;
|
|
261
|
+
return host;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
263
264
|
export const Drivers = {
|
|
264
265
|
panel: new PanelDriver(Constants.element, false, el => el.kind = ElKind.panel),
|
|
265
266
|
table: new HtmlDriver(Constants.element, false, el => el.kind = ElKind.table),
|
|
266
267
|
note: new HtmlDriver(Constants.element, false, el => el.kind = ElKind.note),
|
|
267
268
|
group: new HtmlDriver(Constants.group, false, el => el.kind = ElKind.group),
|
|
268
|
-
partition: new
|
|
269
|
+
partition: new PartitionDriver(Constants.partition, true, el => el.kind = ElKind.part),
|
|
270
|
+
wrapper: new HtmlDriver(Constants.wrapper, false, el => el.kind = ElKind.native),
|
|
269
271
|
splitter: new HtmlDriver(Constants.splitter, false, el => el.kind = ElKind.splitter),
|
|
270
272
|
cursor: new CursorCommandDriver(),
|
|
271
273
|
synthetic: new ElDriver("synthetic", false, el => el.kind = ElKind.group),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { RxNode,
|
|
1
|
+
import { RxNode, Handler } from "reactronic";
|
|
2
2
|
import { El, ElDriver } from "./El.js";
|
|
3
3
|
export declare class WebDriver<T extends Element, M = unknown> extends ElDriver<T, M> {
|
|
4
4
|
setNativeElement(node: RxNode<El<T, M>>): void;
|
|
5
|
-
create(node: RxNode<El<T, M>>): void
|
|
5
|
+
create(node: RxNode<El<T, M>>): void | Promise<void>;
|
|
6
6
|
destroy(node: RxNode<El<T, M>>, isLeader: boolean): boolean;
|
|
7
7
|
mount(node: RxNode<El<T, M>>): void;
|
|
8
8
|
update(node: RxNode<El<T, M>>): void | Promise<void>;
|
|
@@ -13,7 +13,7 @@ export declare class WebDriver<T extends Element, M = unknown> extends ElDriver<
|
|
|
13
13
|
}
|
|
14
14
|
export declare class StaticDriver<T extends HTMLElement> extends WebDriver<T> {
|
|
15
15
|
readonly native: T;
|
|
16
|
-
constructor(native: T, name: string, isRow: boolean,
|
|
16
|
+
constructor(native: T, name: string, isRow: boolean, initialize?: Handler<El<T>>);
|
|
17
17
|
setNativeElement(node: RxNode<El<T>>): void;
|
|
18
18
|
}
|
|
19
19
|
export declare class HtmlDriver<T extends HTMLElement, M = any> extends WebDriver<T, M> {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RxSystem, RxNode } from "reactronic";
|
|
1
|
+
import { RxSystem, RxNode, proceedSyncOrAsync } from "reactronic";
|
|
2
2
|
import { Constants, ElDriver, ElImpl } from "./El.js";
|
|
3
3
|
export class WebDriver extends ElDriver {
|
|
4
4
|
setNativeElement(node) {
|
|
@@ -8,9 +8,10 @@ export class WebDriver extends ElDriver {
|
|
|
8
8
|
const e = node.element.native;
|
|
9
9
|
if (RxSystem.isLogging && e !== undefined && !node.driver.isPartition)
|
|
10
10
|
e.setAttribute(Constants.keyAttrName, node.key);
|
|
11
|
-
super.create(node);
|
|
11
|
+
const result = super.create(node);
|
|
12
12
|
if (e == undefined && RxSystem.isLogging && !node.driver.isPartition)
|
|
13
13
|
node.element.native.setAttribute(Constants.keyAttrName, node.key);
|
|
14
|
+
return result;
|
|
14
15
|
}
|
|
15
16
|
destroy(node, isLeader) {
|
|
16
17
|
var _a;
|
|
@@ -31,7 +32,9 @@ export class WebDriver extends ElDriver {
|
|
|
31
32
|
if (native) {
|
|
32
33
|
const sequential = node.owner.children.isStrict;
|
|
33
34
|
const automaticHost = RxNode.findMatchingHost(node, n => n.element.native instanceof HTMLElement || n.element.native instanceof SVGElement);
|
|
34
|
-
const automaticNativeHost = automaticHost
|
|
35
|
+
const automaticNativeHost = automaticHost !== node.owner
|
|
36
|
+
? automaticHost === null || automaticHost === void 0 ? void 0 : automaticHost.driver.getHost(automaticHost).element.native
|
|
37
|
+
: automaticHost === null || automaticHost === void 0 ? void 0 : automaticHost.element.native;
|
|
35
38
|
if (automaticNativeHost) {
|
|
36
39
|
if (sequential && !node.driver.isPartition) {
|
|
37
40
|
const after = RxNode.findMatchingPrevSibling(node, n => n.element.native instanceof HTMLElement || n.element.native instanceof SVGElement);
|
|
@@ -56,14 +59,17 @@ export class WebDriver extends ElDriver {
|
|
|
56
59
|
const element = node.element;
|
|
57
60
|
if (element instanceof ElImpl)
|
|
58
61
|
element.prepareForUpdate();
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
let result = super.update(node);
|
|
63
|
+
result = proceedSyncOrAsync(result, v => {
|
|
64
|
+
if (element.place === undefined) {
|
|
65
|
+
const oel = node.owner.element;
|
|
66
|
+
if (oel instanceof ElImpl && oel.isTable)
|
|
67
|
+
element.place = undefined;
|
|
68
|
+
}
|
|
69
|
+
if (gBlinkingEffectMarker)
|
|
70
|
+
blink(element.native, RxNode.currentUpdatePriority, node.stamp);
|
|
71
|
+
}, e => {
|
|
72
|
+
});
|
|
67
73
|
return result;
|
|
68
74
|
}
|
|
69
75
|
static findBrotherlyHost(node) {
|
|
@@ -80,8 +86,8 @@ export class WebDriver extends ElDriver {
|
|
|
80
86
|
}
|
|
81
87
|
}
|
|
82
88
|
export class StaticDriver extends WebDriver {
|
|
83
|
-
constructor(native, name, isRow,
|
|
84
|
-
super(name, isRow,
|
|
89
|
+
constructor(native, name, isRow, initialize) {
|
|
90
|
+
super(name, isRow, initialize);
|
|
85
91
|
this.native = native;
|
|
86
92
|
}
|
|
87
93
|
setNativeElement(node) {
|