@react-x11/components 0.2.1 → 0.4.0
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/README.md +6 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/heights.d.ts +26 -1
- package/dist/internal/heights.d.ts.map +1 -1
- package/dist/internal/heights.js +57 -6
- package/dist/internal/heights.js.map +1 -1
- package/dist/internal/scroll.d.ts +11 -0
- package/dist/internal/scroll.d.ts.map +1 -1
- package/dist/internal/scroll.js +43 -3
- package/dist/internal/scroll.js.map +1 -1
- package/dist/internal/timers.d.ts +8 -0
- package/dist/internal/timers.d.ts.map +1 -1
- package/dist/internal/timers.js +10 -0
- package/dist/internal/timers.js.map +1 -1
- package/dist/internal/window.d.ts +161 -0
- package/dist/internal/window.d.ts.map +1 -0
- package/dist/internal/window.js +417 -0
- package/dist/internal/window.js.map +1 -0
- package/dist/qml/containers.d.ts +3 -0
- package/dist/qml/containers.d.ts.map +1 -0
- package/dist/qml/containers.js +331 -0
- package/dist/qml/containers.js.map +1 -0
- package/dist/qml/controls.d.ts +12 -0
- package/dist/qml/controls.d.ts.map +1 -0
- package/dist/qml/controls.js +21 -0
- package/dist/qml/controls.js.map +1 -0
- package/dist/qml/globals.d.ts +6 -0
- package/dist/qml/globals.d.ts.map +1 -0
- package/dist/qml/globals.js +25 -0
- package/dist/qml/globals.js.map +1 -0
- package/dist/qml/index.d.ts +15 -0
- package/dist/qml/index.d.ts.map +1 -0
- package/dist/qml/index.js +25 -0
- package/dist/qml/index.js.map +1 -0
- package/dist/qml/interaction.d.ts +12 -0
- package/dist/qml/interaction.d.ts.map +1 -0
- package/dist/qml/interaction.js +246 -0
- package/dist/qml/interaction.js.map +1 -0
- package/dist/qml/ir.d.ts +106 -0
- package/dist/qml/ir.d.ts.map +1 -0
- package/dist/qml/ir.js +7 -0
- package/dist/qml/ir.js.map +1 -0
- package/dist/qml/layouts.d.ts +3 -0
- package/dist/qml/layouts.d.ts.map +1 -0
- package/dist/qml/layouts.js +122 -0
- package/dist/qml/layouts.js.map +1 -0
- package/dist/qml/models.d.ts +14 -0
- package/dist/qml/models.d.ts.map +1 -0
- package/dist/qml/models.js +80 -0
- package/dist/qml/models.js.map +1 -0
- package/dist/qml/objects.d.ts +228 -0
- package/dist/qml/objects.d.ts.map +1 -0
- package/dist/qml/objects.js +1103 -0
- package/dist/qml/objects.js.map +1 -0
- package/dist/qml/parse.d.ts +10 -0
- package/dist/qml/parse.d.ts.map +1 -0
- package/dist/qml/parse.js +607 -0
- package/dist/qml/parse.js.map +1 -0
- package/dist/qml/qtquick.d.ts +7 -0
- package/dist/qml/qtquick.d.ts.map +1 -0
- package/dist/qml/qtquick.js +347 -0
- package/dist/qml/qtquick.js.map +1 -0
- package/dist/qml/react.d.ts +83 -0
- package/dist/qml/react.d.ts.map +1 -0
- package/dist/qml/react.js +323 -0
- package/dist/qml/react.js.map +1 -0
- package/dist/qml/resolver.d.ts +38 -0
- package/dist/qml/resolver.d.ts.map +1 -0
- package/dist/qml/resolver.js +64 -0
- package/dist/qml/resolver.js.map +1 -0
- package/dist/qml/slots.d.ts +65 -0
- package/dist/qml/slots.d.ts.map +1 -0
- package/dist/qml/slots.js +230 -0
- package/dist/qml/slots.js.map +1 -0
- package/dist/qml/states.d.ts +5 -0
- package/dist/qml/states.d.ts.map +1 -0
- package/dist/qml/states.js +276 -0
- package/dist/qml/states.js.map +1 -0
- package/dist/qml/view-utils.d.ts +42 -0
- package/dist/qml/view-utils.d.ts.map +1 -0
- package/dist/qml/view-utils.js +121 -0
- package/dist/qml/view-utils.js.map +1 -0
- package/dist/table/index.d.ts +73 -2
- package/dist/table/index.d.ts.map +1 -1
- package/dist/table/index.js +405 -161
- package/dist/table/index.js.map +1 -1
- package/dist/tabs/hx.d.ts +18 -0
- package/dist/tabs/hx.d.ts.map +1 -0
- package/dist/tabs/hx.js +10 -0
- package/dist/tabs/hx.js.map +1 -0
- package/dist/tabs/index.d.ts +143 -0
- package/dist/tabs/index.d.ts.map +1 -0
- package/dist/tabs/index.js +602 -0
- package/dist/tabs/index.js.map +1 -0
- package/dist/terminal/vt/index.d.ts +1 -1
- package/dist/terminal/vt/index.d.ts.map +1 -1
- package/dist/terminal/vt/index.js +3 -3
- package/dist/terminal/vt/index.js.map +1 -1
- package/dist/terminal/vt/pty.d.ts +16 -0
- package/dist/terminal/vt/pty.d.ts.map +1 -1
- package/dist/terminal/vt/pty.js +186 -0
- package/dist/terminal/vt/pty.js.map +1 -1
- package/dist/tree/index.d.ts +65 -5
- package/dist/tree/index.d.ts.map +1 -1
- package/dist/tree/index.js +446 -189
- package/dist/tree/index.js.map +1 -1
- package/package.json +11 -1
- package/src/index.ts +44 -0
- package/src/internal/heights.ts +57 -6
- package/src/internal/scroll.ts +59 -3
- package/src/internal/timers.ts +13 -0
- package/src/internal/window.ts +570 -0
- package/src/qml/containers.tsx +380 -0
- package/src/qml/controls.tsx +47 -0
- package/src/qml/globals.ts +33 -0
- package/src/qml/index.ts +67 -0
- package/src/qml/interaction.tsx +317 -0
- package/src/qml/ir.ts +80 -0
- package/src/qml/layouts.tsx +141 -0
- package/src/qml/models.ts +101 -0
- package/src/qml/objects.ts +1431 -0
- package/src/qml/parse.ts +624 -0
- package/src/qml/qtquick.tsx +413 -0
- package/src/qml/react.tsx +454 -0
- package/src/qml/resolver.ts +99 -0
- package/src/qml/slots.ts +249 -0
- package/src/qml/states.ts +318 -0
- package/src/qml/view-utils.ts +140 -0
- package/src/table/index.ts +599 -178
- package/src/tabs/hx.ts +31 -0
- package/src/tabs/index.ts +850 -0
- package/src/terminal/vt/index.ts +4 -2
- package/src/terminal/vt/pty.ts +243 -0
- package/src/tree/index.ts +687 -260
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
// The reactive core: slots, dependency tracking, batched invalidation.
|
|
2
|
+
//
|
|
3
|
+
// One Slot per QML property. A slot holds a *base* layer — a plain value or
|
|
4
|
+
// a binding (a compiled function re-run when anything it read changes) —
|
|
5
|
+
// and, above it, a stack of *override* layers. Overrides are how `states`
|
|
6
|
+
// (`PropertyChanges`) and the `Binding` element sit on top of a document's
|
|
7
|
+
// own bindings without destroying them: push on entry, pop on exit, and the
|
|
8
|
+
// base — still tracked while covered — is current the moment it shows again.
|
|
9
|
+
//
|
|
10
|
+
// Assignment replaces the active layer's binding with the value — QML's
|
|
11
|
+
// binding-breaking semantics, load-bearing for fidelity and pinned in
|
|
12
|
+
// test/qml.test.ts.
|
|
13
|
+
//
|
|
14
|
+
// Granularity is the point of this file: a property change re-renders only
|
|
15
|
+
// the React component wrapping that one QML object (each subscribes to its
|
|
16
|
+
// object via useSyncExternalStore). React reconciliation is reserved for
|
|
17
|
+
// structural change; scalar traffic — animation, dragging — stays in the
|
|
18
|
+
// graph.
|
|
19
|
+
import { microtask } from './globals.js';
|
|
20
|
+
let activeDeps = null; // collected during a binding eval
|
|
21
|
+
let flushQueue = null;
|
|
22
|
+
let flushScheduled = false;
|
|
23
|
+
const pendingNotify = new Set();
|
|
24
|
+
export function trackedEval(fn) {
|
|
25
|
+
const prev = activeDeps;
|
|
26
|
+
activeDeps = new Set();
|
|
27
|
+
try {
|
|
28
|
+
const value = fn();
|
|
29
|
+
return { value, deps: activeDeps };
|
|
30
|
+
}
|
|
31
|
+
finally {
|
|
32
|
+
activeDeps = prev;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function scheduleFlush() {
|
|
36
|
+
if (flushScheduled)
|
|
37
|
+
return;
|
|
38
|
+
flushScheduled = true;
|
|
39
|
+
microtask(flushBindings);
|
|
40
|
+
}
|
|
41
|
+
export function flushBindings() {
|
|
42
|
+
flushScheduled = false;
|
|
43
|
+
// Re-evaluate dirty bindings, then run watchers — and keep going while
|
|
44
|
+
// either creates more work, so a watcher that assigns (a `when` clause
|
|
45
|
+
// switching states, a positioner re-pinning) settles in this flush
|
|
46
|
+
// rather than a later microtask.
|
|
47
|
+
for (let guard = 0;; guard++) {
|
|
48
|
+
if (guard > 200)
|
|
49
|
+
throw new Error('QML binding loop did not settle');
|
|
50
|
+
if (flushQueue && flushQueue.size) {
|
|
51
|
+
const batch = flushQueue;
|
|
52
|
+
flushQueue = null;
|
|
53
|
+
for (const slot of batch)
|
|
54
|
+
slot._reevaluate();
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (pendingNotify.size) {
|
|
58
|
+
const toNotify = [...pendingNotify];
|
|
59
|
+
pendingNotify.clear();
|
|
60
|
+
for (const fn of toNotify)
|
|
61
|
+
fn();
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export class Slot {
|
|
68
|
+
owner;
|
|
69
|
+
name;
|
|
70
|
+
/** The current effective value — the top layer's answer, cached. */
|
|
71
|
+
value;
|
|
72
|
+
base;
|
|
73
|
+
overrides = [];
|
|
74
|
+
subscribers = null; // slots whose bindings read this one
|
|
75
|
+
watchers = null; // onXChanged, React, positioners
|
|
76
|
+
/** True while the implicit `width ← implicitWidth` default binding holds
|
|
77
|
+
* (Qt's `widthValid`): the renderer may size the element by content. */
|
|
78
|
+
isDefault = false;
|
|
79
|
+
/** True once assigned at runtime — interactive state, carried across
|
|
80
|
+
* hot reloads. */
|
|
81
|
+
userSet = false;
|
|
82
|
+
lastError = null;
|
|
83
|
+
constructor(owner, name, value) {
|
|
84
|
+
this.owner = owner;
|
|
85
|
+
this.name = name;
|
|
86
|
+
this.value = value;
|
|
87
|
+
this.base = { binding: null, value, deps: null, owner: null };
|
|
88
|
+
}
|
|
89
|
+
get() {
|
|
90
|
+
if (activeDeps)
|
|
91
|
+
activeDeps.add(this);
|
|
92
|
+
return this.value;
|
|
93
|
+
}
|
|
94
|
+
peek() {
|
|
95
|
+
return this.value;
|
|
96
|
+
}
|
|
97
|
+
hasBinding() {
|
|
98
|
+
return this.base.binding !== null;
|
|
99
|
+
}
|
|
100
|
+
active() {
|
|
101
|
+
return this.overrides.length
|
|
102
|
+
? this.overrides[this.overrides.length - 1]
|
|
103
|
+
: this.base;
|
|
104
|
+
}
|
|
105
|
+
/** Imperative assignment: breaks the active layer's binding. */
|
|
106
|
+
set(value) {
|
|
107
|
+
this.userSet = true;
|
|
108
|
+
this.assign(value);
|
|
109
|
+
}
|
|
110
|
+
/** Activation-time write (literals, model context): breaks the binding
|
|
111
|
+
* but is not user state — hot-reload migration must not preserve it. */
|
|
112
|
+
assign(value) {
|
|
113
|
+
const layer = this.active();
|
|
114
|
+
this._dropLayerBinding(layer);
|
|
115
|
+
if (layer === this.base)
|
|
116
|
+
this.isDefault = false;
|
|
117
|
+
layer.value = value;
|
|
118
|
+
this._settle();
|
|
119
|
+
}
|
|
120
|
+
setBinding(fn, { isDefault = false } = {}) {
|
|
121
|
+
this._dropLayerBinding(this.base);
|
|
122
|
+
this.isDefault = isDefault;
|
|
123
|
+
this.base.binding = fn;
|
|
124
|
+
this._evaluateLayer(this.base);
|
|
125
|
+
this._settle();
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* States and the `Binding` element: sit a value or binding above the
|
|
129
|
+
* base. The base keeps evaluating underneath, so popping is instant and
|
|
130
|
+
* exact. `owner` is the pop token.
|
|
131
|
+
*/
|
|
132
|
+
pushOverride(owner, init) {
|
|
133
|
+
const layer = {
|
|
134
|
+
binding: init.binding ?? null,
|
|
135
|
+
value: init.value,
|
|
136
|
+
deps: null,
|
|
137
|
+
owner,
|
|
138
|
+
};
|
|
139
|
+
this.overrides.push(layer);
|
|
140
|
+
if (layer.binding)
|
|
141
|
+
this._evaluateLayer(layer);
|
|
142
|
+
this._settle();
|
|
143
|
+
}
|
|
144
|
+
popOverride(owner) {
|
|
145
|
+
for (let i = this.overrides.length - 1; i >= 0; i--) {
|
|
146
|
+
if (this.overrides[i].owner === owner) {
|
|
147
|
+
this._dropLayerBinding(this.overrides[i]);
|
|
148
|
+
this.overrides.splice(i, 1);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
this._settle();
|
|
152
|
+
}
|
|
153
|
+
_dropLayerBinding(layer) {
|
|
154
|
+
if (layer.deps) {
|
|
155
|
+
for (const dep of layer.deps)
|
|
156
|
+
dep.subscribers?.delete(this);
|
|
157
|
+
layer.deps = null;
|
|
158
|
+
}
|
|
159
|
+
layer.binding = null;
|
|
160
|
+
}
|
|
161
|
+
_evaluateLayer(layer) {
|
|
162
|
+
if (!layer.binding)
|
|
163
|
+
return;
|
|
164
|
+
const { value, deps } = trackedEval(layer.binding);
|
|
165
|
+
if (layer.deps)
|
|
166
|
+
for (const dep of layer.deps)
|
|
167
|
+
dep.subscribers?.delete(this);
|
|
168
|
+
layer.deps = deps;
|
|
169
|
+
for (const dep of deps)
|
|
170
|
+
(dep.subscribers ??= new Set()).add(this);
|
|
171
|
+
layer.value = value;
|
|
172
|
+
}
|
|
173
|
+
/** A dependency changed: re-evaluate every bound layer, then settle. */
|
|
174
|
+
_reevaluate() {
|
|
175
|
+
if (this.base.binding)
|
|
176
|
+
this._evaluateLayer(this.base);
|
|
177
|
+
for (const layer of this.overrides) {
|
|
178
|
+
if (layer.binding)
|
|
179
|
+
this._evaluateLayer(layer);
|
|
180
|
+
}
|
|
181
|
+
this._settle();
|
|
182
|
+
}
|
|
183
|
+
_settle() {
|
|
184
|
+
const effective = this.active().value;
|
|
185
|
+
if (Object.is(effective, this.value))
|
|
186
|
+
return;
|
|
187
|
+
this.value = effective;
|
|
188
|
+
if (this.subscribers) {
|
|
189
|
+
flushQueue ??= new Set();
|
|
190
|
+
for (const sub of this.subscribers)
|
|
191
|
+
flushQueue.add(sub);
|
|
192
|
+
scheduleFlush();
|
|
193
|
+
}
|
|
194
|
+
if (this.watchers) {
|
|
195
|
+
for (const w of this.watchers)
|
|
196
|
+
pendingNotify.add(w);
|
|
197
|
+
scheduleFlush();
|
|
198
|
+
}
|
|
199
|
+
this.owner?._changed?.(this);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Layout read-back: reflect an externally computed value — yoga's answer
|
|
203
|
+
* for a Layout-managed item — into the slot without disturbing its
|
|
204
|
+
* binding, default or user flags. A later binding evaluation may
|
|
205
|
+
* overwrite it; the next layout pass reflects again. Expressions reading
|
|
206
|
+
* the slot see the laid-out number either way.
|
|
207
|
+
*/
|
|
208
|
+
reflect(value) {
|
|
209
|
+
const layer = this.overrides.length
|
|
210
|
+
? this.overrides[this.overrides.length - 1]
|
|
211
|
+
: this.base;
|
|
212
|
+
if (Object.is(layer.value, value) && Object.is(this.value, value))
|
|
213
|
+
return;
|
|
214
|
+
layer.value = value;
|
|
215
|
+
this._settle();
|
|
216
|
+
}
|
|
217
|
+
watch(fn) {
|
|
218
|
+
(this.watchers ??= new Set()).add(fn);
|
|
219
|
+
return () => this.watchers?.delete(fn);
|
|
220
|
+
}
|
|
221
|
+
destroy() {
|
|
222
|
+
this._dropLayerBinding(this.base);
|
|
223
|
+
for (const layer of this.overrides)
|
|
224
|
+
this._dropLayerBinding(layer);
|
|
225
|
+
this.overrides.length = 0;
|
|
226
|
+
this.watchers = null;
|
|
227
|
+
this.subscribers = null;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
//# sourceMappingURL=slots.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slots.js","sourceRoot":"","sources":["../../src/qml/slots.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,EAAE;AACF,4EAA4E;AAC5E,yEAAyE;AACzE,0EAA0E;AAC1E,2EAA2E;AAC3E,4EAA4E;AAC5E,6EAA6E;AAC7E,EAAE;AACF,wEAAwE;AACxE,sEAAsE;AACtE,oBAAoB;AACpB,EAAE;AACF,2EAA2E;AAC3E,2EAA2E;AAC3E,yEAAyE;AACzE,yEAAyE;AACzE,SAAS;AAET,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAgBzC,IAAI,UAAU,GAAqB,IAAI,CAAC,CAAC,kCA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CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC;YAAE,OAAO;QAC1E,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,EAAc;QAClB,CAAC,IAAI,CAAC,QAAQ,KAAK,IAAI,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACtC,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,OAAO;QACL,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,SAAS;YAAE,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAClE,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { QmlInstance, type QmlTypeDef } from './objects.js';
|
|
2
|
+
/** Wire `states:`/`transitions:` on an Item, when the document has them. */
|
|
3
|
+
export declare function setupStates(inst: QmlInstance): void;
|
|
4
|
+
export declare const stateTypes: Record<string, QmlTypeDef>;
|
|
5
|
+
//# sourceMappingURL=states.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"states.d.ts","sourceRoot":"","sources":["../../src/qml/states.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,WAAW,EAIX,KAAK,UAAU,EAEhB,MAAM,cAAc,CAAC;AAkBtB,4EAA4E;AAC5E,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CA0FnD;AAqDD,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAoIjD,CAAC"}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
// States, PropertyChanges, Transition — and the two elements that share
|
|
2
|
+
// their machinery, `Binding` and `Connections`.
|
|
3
|
+
//
|
|
4
|
+
// A state is an *override layer* on the target slots (slots.ts): entering
|
|
5
|
+
// pushes, leaving pops, and the document's own bindings keep evaluating
|
|
6
|
+
// underneath, so exit is exact with no bookkeeping. A `PropertyChanges`
|
|
7
|
+
// binding stays live while its state is active: the pushed override is a
|
|
8
|
+
// forwarding binding onto the PropertyChanges instance's own slot, whose
|
|
9
|
+
// document-scoped binding keeps re-evaluating — dependency tracking chains
|
|
10
|
+
// through.
|
|
11
|
+
//
|
|
12
|
+
// A `Transition`'s animations lower onto the style `transition` engine the
|
|
13
|
+
// way `Behavior` does: the switch commits new values with per-property
|
|
14
|
+
// durations, and the renderer eases. The divergence (properties jump,
|
|
15
|
+
// pixels ease) is the documented one.
|
|
16
|
+
import { QmlInstance, instanceOf, instantiateTemplate, makeHandlerFor, } from './objects.js';
|
|
17
|
+
import { Slot, flushBindings } from './slots.js';
|
|
18
|
+
import { warn } from './globals.js';
|
|
19
|
+
const num = (v) => typeof v === 'number' && Number.isFinite(v) ? v : 0;
|
|
20
|
+
const RESERVED_PC = new Set(['target', 'explicit', 'restoreEntryValues']);
|
|
21
|
+
/** Wire `states:`/`transitions:` on an Item, when the document has them. */
|
|
22
|
+
export function setupStates(inst) {
|
|
23
|
+
const stateTpls = inst.state['templates:states'];
|
|
24
|
+
if (!stateTpls?.length)
|
|
25
|
+
return;
|
|
26
|
+
const transTpls = inst.state['templates:transitions'] ?? [];
|
|
27
|
+
const engine = {
|
|
28
|
+
token: {},
|
|
29
|
+
stateInsts: stateTpls.map((tpl) => instantiateTemplate(tpl, inst).inst),
|
|
30
|
+
transInsts: transTpls.map((tpl) => instantiateTemplate(tpl, inst).inst),
|
|
31
|
+
targets: new Set([inst]),
|
|
32
|
+
applied: [],
|
|
33
|
+
current: '',
|
|
34
|
+
};
|
|
35
|
+
inst.state.stateEngine = engine;
|
|
36
|
+
inst.onDestruction.push(() => {
|
|
37
|
+
for (const s of engine.stateInsts)
|
|
38
|
+
s.destroy();
|
|
39
|
+
for (const t of engine.transInsts)
|
|
40
|
+
t.destroy();
|
|
41
|
+
});
|
|
42
|
+
for (const st of engine.stateInsts) {
|
|
43
|
+
for (const pc of propertyChangesOf(st)) {
|
|
44
|
+
const target = instanceOf(pc.slot('target').peek());
|
|
45
|
+
if (target)
|
|
46
|
+
engine.targets.add(target);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const stateSlot = inst.slot('state');
|
|
50
|
+
const switchTo = () => {
|
|
51
|
+
const to = String(stateSlot.peek() ?? '');
|
|
52
|
+
if (to === engine.current)
|
|
53
|
+
return;
|
|
54
|
+
installTransitionDurations(engine, engine.current, to);
|
|
55
|
+
for (const s of engine.applied)
|
|
56
|
+
s.popOverride(engine.token);
|
|
57
|
+
engine.applied = [];
|
|
58
|
+
const st = engine.stateInsts.find((s) => String(s.slot('name').peek() ?? '') === to);
|
|
59
|
+
if (to && !st) {
|
|
60
|
+
warnOnce(`qml-state-${to}`, `QML: state '${to}' matches no State in the states list`);
|
|
61
|
+
}
|
|
62
|
+
engine.current = to;
|
|
63
|
+
if (st) {
|
|
64
|
+
for (const pc of propertyChangesOf(st)) {
|
|
65
|
+
const target = instanceOf(pc.slot('target').peek());
|
|
66
|
+
if (!target) {
|
|
67
|
+
warnOnce('qml-pc-target', 'QML: PropertyChanges without a resolvable `target` is ignored');
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
for (const [propName, pcSlot] of pc.slots) {
|
|
71
|
+
if (RESERVED_PC.has(propName))
|
|
72
|
+
continue;
|
|
73
|
+
const targetSlot = target.slots.get(propName);
|
|
74
|
+
if (!targetSlot) {
|
|
75
|
+
warnOnce(`qml-pc-${propName}`, `QML: PropertyChanges names '${propName}', which ${target.typeInfo.name} does not have`);
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
targetSlot.pushOverride(engine.token, {
|
|
79
|
+
binding: () => pcSlot.get(),
|
|
80
|
+
});
|
|
81
|
+
engine.applied.push(targetSlot);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
flushBindings();
|
|
86
|
+
};
|
|
87
|
+
stateSlot.watch(switchTo);
|
|
88
|
+
// `when` clauses: a state that turns itself on and off.
|
|
89
|
+
for (const st of engine.stateInsts) {
|
|
90
|
+
const whenSlot = st.slots.get('when');
|
|
91
|
+
if (!whenSlot || (!whenSlot.hasBinding() && whenSlot.peek() === undefined))
|
|
92
|
+
continue;
|
|
93
|
+
const name = String(st.slot('name').peek() ?? '');
|
|
94
|
+
const check = () => {
|
|
95
|
+
const active = whenSlot.peek() === true;
|
|
96
|
+
const current = String(stateSlot.peek() ?? '');
|
|
97
|
+
if (active && current !== name)
|
|
98
|
+
stateSlot.assign(name);
|
|
99
|
+
else if (!active && current === name)
|
|
100
|
+
stateSlot.assign('');
|
|
101
|
+
};
|
|
102
|
+
whenSlot.watch(check);
|
|
103
|
+
check();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function propertyChangesOf(state) {
|
|
107
|
+
return state.children.filter((c) => c.typeInfo.name === 'PropertyChanges');
|
|
108
|
+
}
|
|
109
|
+
/** Pick the matching Transition and hand its per-property durations to
|
|
110
|
+
* every state target; their views merge them into `style.transition`. */
|
|
111
|
+
function installTransitionDurations(engine, from, to) {
|
|
112
|
+
const matches = (v, name) => {
|
|
113
|
+
const s = String(v ?? '');
|
|
114
|
+
return s === '' || s === '*' || s.split(',').some((p) => p.trim() === name);
|
|
115
|
+
};
|
|
116
|
+
const t = engine.transInsts.find((tr) => matches(tr.slot('from').peek(), from) &&
|
|
117
|
+
matches(tr.slot('to').peek(), to));
|
|
118
|
+
const durations = {};
|
|
119
|
+
if (t) {
|
|
120
|
+
for (const anim of t.children) {
|
|
121
|
+
if (!anim.slots.has('duration'))
|
|
122
|
+
continue;
|
|
123
|
+
const props = String(anim.slots.get('properties')?.peek() ||
|
|
124
|
+
anim.slots.get('property')?.peek() ||
|
|
125
|
+
'')
|
|
126
|
+
.split(',')
|
|
127
|
+
.map((p) => p.trim())
|
|
128
|
+
.filter(Boolean);
|
|
129
|
+
const d = num(anim.slot('duration').peek()) || 250;
|
|
130
|
+
for (const p of props)
|
|
131
|
+
durations[p] = d;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
for (const target of engine.targets) {
|
|
135
|
+
target.state.stateTransitions = durations;
|
|
136
|
+
target._changed();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const warnedOnce = new Set();
|
|
140
|
+
function warnOnce(key, message) {
|
|
141
|
+
if (warnedOnce.has(key))
|
|
142
|
+
return;
|
|
143
|
+
warnedOnce.add(key);
|
|
144
|
+
warn(message);
|
|
145
|
+
}
|
|
146
|
+
// --- the type definitions --------------------------------------------------
|
|
147
|
+
export const stateTypes = {
|
|
148
|
+
State: {
|
|
149
|
+
nonVisual: true,
|
|
150
|
+
properties: { name: { default: '' }, when: { default: undefined } },
|
|
151
|
+
},
|
|
152
|
+
PropertyChanges: {
|
|
153
|
+
nonVisual: true,
|
|
154
|
+
dynamicProperties: true,
|
|
155
|
+
properties: {
|
|
156
|
+
target: { default: undefined },
|
|
157
|
+
explicit: { default: false },
|
|
158
|
+
restoreEntryValues: { default: true },
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
Transition: {
|
|
162
|
+
nonVisual: true,
|
|
163
|
+
properties: {
|
|
164
|
+
from: { default: '' },
|
|
165
|
+
to: { default: '' },
|
|
166
|
+
reversible: { default: false },
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
/**
|
|
170
|
+
* `Binding { target: obj; property: "width"; value: expr; when: cond }` —
|
|
171
|
+
* an override pushed while `when` holds, popped when it stops; the
|
|
172
|
+
* target's own binding survives underneath.
|
|
173
|
+
*/
|
|
174
|
+
Binding: {
|
|
175
|
+
nonVisual: true,
|
|
176
|
+
properties: {
|
|
177
|
+
target: { default: undefined },
|
|
178
|
+
property: { default: '' },
|
|
179
|
+
value: { default: undefined },
|
|
180
|
+
when: { default: true },
|
|
181
|
+
},
|
|
182
|
+
init(bi) {
|
|
183
|
+
let current = null;
|
|
184
|
+
const sync = () => {
|
|
185
|
+
if (current) {
|
|
186
|
+
current.popOverride(bi);
|
|
187
|
+
current = null;
|
|
188
|
+
}
|
|
189
|
+
if (bi.destroyed)
|
|
190
|
+
return;
|
|
191
|
+
if (bi.slot('when').peek() === false) {
|
|
192
|
+
flushBindings();
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
const target = instanceOf(bi.slot('target').peek());
|
|
196
|
+
const prop = String(bi.slot('property').peek() ?? '');
|
|
197
|
+
const targetSlot = target?.slots.get(prop);
|
|
198
|
+
if (!target || !prop)
|
|
199
|
+
return;
|
|
200
|
+
if (!targetSlot) {
|
|
201
|
+
warnOnce(`qml-binding-${prop}`, `QML: Binding names '${prop}', which ${target.typeInfo.name} does not have`);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
targetSlot.pushOverride(bi, { binding: () => bi.slot('value').get() });
|
|
205
|
+
current = targetSlot;
|
|
206
|
+
flushBindings();
|
|
207
|
+
};
|
|
208
|
+
bi.slot('when').watch(sync);
|
|
209
|
+
bi.slot('target').watch(sync);
|
|
210
|
+
bi.slot('property').watch(sync);
|
|
211
|
+
bi.state.syncBinding = sync;
|
|
212
|
+
sync();
|
|
213
|
+
},
|
|
214
|
+
dispose(bi) {
|
|
215
|
+
bi.state.syncBinding?.();
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
/**
|
|
219
|
+
* `Connections { target: id; function onClicked(mouse) { … } }` — both
|
|
220
|
+
* the function form and the old `onClicked:` handler form; handlers are
|
|
221
|
+
* compiled in the Connections scope and subscribed to the target.
|
|
222
|
+
*/
|
|
223
|
+
Connections: {
|
|
224
|
+
nonVisual: true,
|
|
225
|
+
deferHandlers: true,
|
|
226
|
+
properties: {
|
|
227
|
+
target: { default: undefined },
|
|
228
|
+
enabled: { default: true },
|
|
229
|
+
ignoreUnknownSignals: { default: false },
|
|
230
|
+
},
|
|
231
|
+
init(ci) {
|
|
232
|
+
let offs = [];
|
|
233
|
+
const wire = () => {
|
|
234
|
+
for (const off of offs)
|
|
235
|
+
off();
|
|
236
|
+
offs = [];
|
|
237
|
+
if (ci.destroyed || ci.slot('enabled').peek() === false)
|
|
238
|
+
return;
|
|
239
|
+
const target = instanceOf(ci.slot('target').peek());
|
|
240
|
+
if (!target)
|
|
241
|
+
return;
|
|
242
|
+
const quiet = ci.slot('ignoreUnknownSignals').peek() === true;
|
|
243
|
+
const wireOne = (name, fn) => {
|
|
244
|
+
const base = name[2].toLowerCase() + name.slice(3);
|
|
245
|
+
if (!target.signalParams.has(base)) {
|
|
246
|
+
if (!quiet)
|
|
247
|
+
warnOnce(`qml-connections-${base}`, `QML: Connections: ${target.typeInfo.name} has no signal '${base}'`);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
offs.push(target.onSignal(base, fn));
|
|
251
|
+
};
|
|
252
|
+
for (const { name, value } of ci.deferredHandlers) {
|
|
253
|
+
const base = name[2].toLowerCase() + name.slice(3);
|
|
254
|
+
const params = target.signalParams.get(base) ?? [];
|
|
255
|
+
wireOne(name, makeHandlerFor(ci, value, params));
|
|
256
|
+
}
|
|
257
|
+
for (const [name, method] of ci.methods) {
|
|
258
|
+
if (/^on[A-Z]/.test(name))
|
|
259
|
+
wireOne(name, method);
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
ci.slot('target').watch(wire);
|
|
263
|
+
ci.slot('enabled').watch(wire);
|
|
264
|
+
ci.state.unwire = () => {
|
|
265
|
+
for (const off of offs)
|
|
266
|
+
off();
|
|
267
|
+
offs = [];
|
|
268
|
+
};
|
|
269
|
+
wire();
|
|
270
|
+
},
|
|
271
|
+
dispose(ci) {
|
|
272
|
+
ci.state.unwire?.();
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
};
|
|
276
|
+
//# sourceMappingURL=states.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"states.js","sourceRoot":"","sources":["../../src/qml/states.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,gDAAgD;AAChD,EAAE;AACF,0EAA0E;AAC1E,wEAAwE;AACxE,wEAAwE;AACxE,yEAAyE;AACzE,yEAAyE;AACzE,2EAA2E;AAC3E,WAAW;AACX,EAAE;AACF,2EAA2E;AAC3E,uEAAuE;AACvE,sEAAsE;AACtE,sCAAsC;AAEtC,OAAO,EACL,WAAW,EACX,UAAU,EACV,mBAAmB,EACnB,cAAc,GAGf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,MAAM,GAAG,GAAG,CAAC,CAAU,EAAU,EAAE,CACjC,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEtD,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,UAAU,EAAE,oBAAoB,CAAC,CAAC,CAAC;AAW1E,4EAA4E;AAC5E,MAAM,UAAU,WAAW,CAAC,IAAiB;IAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAA8B,CAAC;IAC9E,IAAI,CAAC,SAAS,EAAE,MAAM;QAAE,OAAO;IAC/B,MAAM,SAAS,GACZ,IAAI,CAAC,KAAK,CAAC,uBAAuB,CAA+B,IAAI,EAAE,CAAC;IAE3E,MAAM,MAAM,GAAgB;QAC1B,KAAK,EAAE,EAAE;QACT,UAA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AW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;oBACnD,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;oBACnD,OAAO,CAAC,IAAI,EAAE,cAAc,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;gBACnD,CAAC;gBACD,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;oBACxC,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;wBAAE,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;gBACnD,CAAC;YACH,CAAC,CAAC;YACF,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC9B,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC/B,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,EAAE;gBACrB,KAAK,MAAM,GAAG,IAAI,IAAI;oBAAE,GAAG,EAAE,CAAC;gBAC9B,IAAI,GAAG,EAAE,CAAC;YACZ,CAAC,CAAC;YACF,IAAI,EAAE,CAAC;QACT,CAAC;QACD,OAAO,CAAC,EAAE;YACP,EAAE,CAAC,KAAK,CAAC,MAAmC,EAAE,EAAE,CAAC;QACpD,CAAC;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Style } from 'react-x11/style';
|
|
2
|
+
import type { DrawnNode } from 'react-x11';
|
|
3
|
+
import { QmlInstance } from './objects.js';
|
|
4
|
+
import { geometryStyle } from './react.js';
|
|
5
|
+
export declare const num: (v: unknown) => number;
|
|
6
|
+
export declare const str: (v: unknown) => string;
|
|
7
|
+
/** QML hex colours put alpha FIRST (#AARRGGBB); CSS puts it last. */
|
|
8
|
+
export declare function qmlColor(v: unknown): string | undefined;
|
|
9
|
+
/** QML property name → the style key the renderer animates. */
|
|
10
|
+
export declare const STYLE_KEY: Record<string, string>;
|
|
11
|
+
export interface MotionState {
|
|
12
|
+
/** `Behavior on x` instances, by property name. */
|
|
13
|
+
behaviors?: Record<string, QmlInstance>;
|
|
14
|
+
/** Durations installed by the active state `Transition`. */
|
|
15
|
+
stateTransitions?: Record<string, number>;
|
|
16
|
+
/** `NumberAnimation on x { loops: Animation.Infinite }` lowerings. */
|
|
17
|
+
loopAnims?: Record<string, {
|
|
18
|
+
from: unknown;
|
|
19
|
+
to: unknown;
|
|
20
|
+
duration: number;
|
|
21
|
+
}>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Merge the instance's motion sources into the style. The renderer
|
|
25
|
+
* animates; the property jumps — the declared divergence from
|
|
26
|
+
* docs/components/qml.md ("Behavior").
|
|
27
|
+
*/
|
|
28
|
+
export declare function applyMotion(inst: QmlInstance, style: Style): void;
|
|
29
|
+
/** Ref callback capturing the host node for coordinate re-basing, text
|
|
30
|
+
* measurement and `forceActiveFocus()`. */
|
|
31
|
+
export declare function captureNode(inst: QmlInstance): (node: DrawnNode | null) => void;
|
|
32
|
+
export declare const hostNode: (inst: QmlInstance) => DrawnNode | null;
|
|
33
|
+
/** The `anchors.*` slot set every Item carries. */
|
|
34
|
+
export declare const anchorProperties: Record<string, {
|
|
35
|
+
default?: unknown;
|
|
36
|
+
}>;
|
|
37
|
+
/** Item's own init: focus plumbing and the state engine. A type that
|
|
38
|
+
* declares its own `init` replaces this (registry semantics), so it calls
|
|
39
|
+
* `initItem(inst)` first — Row, Flickable and Loader all do. */
|
|
40
|
+
export declare function initItem(inst: QmlInstance): void;
|
|
41
|
+
export { geometryStyle };
|
|
42
|
+
//# sourceMappingURL=view-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-utils.d.ts","sourceRoot":"","sources":["../../src/qml/view-utils.ts"],"names":[],"mappings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