@sigx/terminal 0.2.0 → 0.2.2
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/dist/index.js +1294 -2843
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,190 +1,100 @@
|
|
|
1
1
|
//#region \0rolldown/runtime.js
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var pendingEffects = /* @__PURE__ */ new Set();
|
|
12
|
-
function setActiveEffect(effect) {
|
|
13
|
-
activeEffect = effect;
|
|
14
|
-
}
|
|
15
|
-
function getActiveEffect() {
|
|
16
|
-
return activeEffect;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Batch multiple reactive updates into a single flush.
|
|
20
|
-
* Effects are deferred until the batch completes, avoiding redundant re-renders.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```ts
|
|
24
|
-
* batch(() => {
|
|
25
|
-
* count.value++;
|
|
26
|
-
* name.value = 'Alice';
|
|
27
|
-
* }); // effects run once after both updates
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
function batch(fn) {
|
|
31
|
-
batchDepth++;
|
|
2
|
+
var e = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), t = Symbol("computed"), n = null, r = 0, i = /* @__PURE__ */ new Set();
|
|
3
|
+
function a(e) {
|
|
4
|
+
n = e;
|
|
5
|
+
}
|
|
6
|
+
function o() {
|
|
7
|
+
return n;
|
|
8
|
+
}
|
|
9
|
+
function s(e) {
|
|
10
|
+
r++;
|
|
32
11
|
try {
|
|
33
|
-
|
|
12
|
+
e();
|
|
34
13
|
} finally {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
for (const effect of effects) effect();
|
|
14
|
+
if (r--, r === 0) {
|
|
15
|
+
let e = Array.from(i);
|
|
16
|
+
i.clear();
|
|
17
|
+
for (let t of e) t();
|
|
40
18
|
}
|
|
41
19
|
}
|
|
42
20
|
}
|
|
43
|
-
function
|
|
44
|
-
if (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
cleanup(effectFn);
|
|
63
|
-
const prev = activeEffect;
|
|
64
|
-
activeEffect = effectFn;
|
|
21
|
+
function c(e) {
|
|
22
|
+
if (e.deps) {
|
|
23
|
+
for (let t of e.deps) t.delete(e);
|
|
24
|
+
e.deps.length = 0;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function l(e) {
|
|
28
|
+
n && (e.add(n), n.deps.push(e));
|
|
29
|
+
}
|
|
30
|
+
function u(e) {
|
|
31
|
+
let t = Array.from(e);
|
|
32
|
+
for (let e of t) r > 0 ? i.add(e) : e();
|
|
33
|
+
}
|
|
34
|
+
function d(e) {
|
|
35
|
+
let t = !1, r = function() {
|
|
36
|
+
if (t) return;
|
|
37
|
+
c(r);
|
|
38
|
+
let i = n;
|
|
39
|
+
n = r;
|
|
65
40
|
try {
|
|
66
|
-
|
|
41
|
+
e();
|
|
67
42
|
} finally {
|
|
68
|
-
|
|
43
|
+
n = i;
|
|
69
44
|
}
|
|
70
45
|
};
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* ```ts
|
|
86
|
-
* const count = signal(0);
|
|
87
|
-
* const runner = effect(() => console.log(count.value));
|
|
88
|
-
* count.value++; // logs: 1
|
|
89
|
-
* runner.stop();
|
|
90
|
-
* ```
|
|
91
|
-
*/
|
|
92
|
-
function effect(fn) {
|
|
93
|
-
return runEffect(fn);
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Execute a function without tracking any reactive dependencies.
|
|
97
|
-
* Useful for reading signals inside an effect without creating a subscription.
|
|
98
|
-
*
|
|
99
|
-
* @example
|
|
100
|
-
* ```ts
|
|
101
|
-
* effect(() => {
|
|
102
|
-
* const val = untrack(() => someSignal.value); // not tracked
|
|
103
|
-
* });
|
|
104
|
-
* ```
|
|
105
|
-
*/
|
|
106
|
-
function untrack(fn) {
|
|
107
|
-
const prev = activeEffect;
|
|
108
|
-
activeEffect = null;
|
|
46
|
+
r.deps = [], r();
|
|
47
|
+
let i = (() => r());
|
|
48
|
+
return i.stop = () => {
|
|
49
|
+
t = !0, c(r);
|
|
50
|
+
}, i;
|
|
51
|
+
}
|
|
52
|
+
function f(e) {
|
|
53
|
+
return d(e);
|
|
54
|
+
}
|
|
55
|
+
function p(e) {
|
|
56
|
+
let t = n;
|
|
57
|
+
n = null;
|
|
109
58
|
try {
|
|
110
|
-
return
|
|
59
|
+
return e();
|
|
111
60
|
} finally {
|
|
112
|
-
|
|
61
|
+
n = t;
|
|
113
62
|
}
|
|
114
63
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
*
|
|
118
|
-
* @example
|
|
119
|
-
* ```ts
|
|
120
|
-
* const scope = effectScope();
|
|
121
|
-
* scope.run(() => {
|
|
122
|
-
* effect(() => console.log(count.value));
|
|
123
|
-
* effect(() => console.log(name.value));
|
|
124
|
-
* });
|
|
125
|
-
* scope.stop(); // disposes both effects
|
|
126
|
-
* ```
|
|
127
|
-
*/
|
|
128
|
-
function effectScope(_detached) {
|
|
129
|
-
const effects = [];
|
|
130
|
-
let active = true;
|
|
64
|
+
function m(e) {
|
|
65
|
+
let t = [], n = !0;
|
|
131
66
|
return {
|
|
132
|
-
run(
|
|
133
|
-
if (
|
|
134
|
-
return fn();
|
|
67
|
+
run(e) {
|
|
68
|
+
if (n) return e();
|
|
135
69
|
},
|
|
136
70
|
stop() {
|
|
137
|
-
|
|
138
|
-
effects.forEach((e) => e());
|
|
71
|
+
n = !1, t.forEach((e) => e());
|
|
139
72
|
}
|
|
140
73
|
};
|
|
141
74
|
}
|
|
142
75
|
//#endregion
|
|
143
76
|
//#region ../reactivity/src/collections.ts
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
* Checks if a value is a collection type (Set, Map, WeakSet, WeakMap).
|
|
166
|
-
*/
|
|
167
|
-
function isCollection(value) {
|
|
168
|
-
if (!value || typeof value !== "object") return false;
|
|
169
|
-
const ctor = value.constructor;
|
|
170
|
-
return ctor === Set || ctor === Map || ctor === WeakSet || ctor === WeakMap;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Checks if a value is an iterable collection (Set or Map, not Weak variants).
|
|
174
|
-
*/
|
|
175
|
-
function isIterableCollection(value) {
|
|
176
|
-
if (!value || typeof value !== "object") return false;
|
|
177
|
-
const ctor = value.constructor;
|
|
178
|
-
return ctor === Set || ctor === Map;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Checks if a value is an "exotic" built-in object that should NOT be proxied.
|
|
182
|
-
* These objects have internal slots that cannot be accessed through Proxy.
|
|
183
|
-
* Proxying them causes errors like "Method X called on incompatible receiver".
|
|
184
|
-
*/
|
|
185
|
-
function shouldNotProxy(value) {
|
|
186
|
-
if (!value || typeof value !== "object") return false;
|
|
187
|
-
const proto = Object.prototype.toString.call(value);
|
|
77
|
+
var h = Symbol("iterate"), g = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new WeakMap();
|
|
78
|
+
function v(e) {
|
|
79
|
+
let t = g.get(e);
|
|
80
|
+
return t ? v(t) : e;
|
|
81
|
+
}
|
|
82
|
+
function ee(e) {
|
|
83
|
+
return g.has(e);
|
|
84
|
+
}
|
|
85
|
+
function y(e) {
|
|
86
|
+
if (!e || typeof e != "object") return !1;
|
|
87
|
+
let t = e.constructor;
|
|
88
|
+
return t === Set || t === Map || t === WeakSet || t === WeakMap;
|
|
89
|
+
}
|
|
90
|
+
function te(e) {
|
|
91
|
+
if (!e || typeof e != "object") return !1;
|
|
92
|
+
let t = e.constructor;
|
|
93
|
+
return t === Set || t === Map;
|
|
94
|
+
}
|
|
95
|
+
function b(e) {
|
|
96
|
+
if (!e || typeof e != "object") return !1;
|
|
97
|
+
let t = Object.prototype.toString.call(e);
|
|
188
98
|
return [
|
|
189
99
|
"[object Date]",
|
|
190
100
|
"[object RegExp]",
|
|
@@ -203,129 +113,83 @@ function shouldNotProxy(value) {
|
|
|
203
113
|
"[object Float64Array]",
|
|
204
114
|
"[object BigInt64Array]",
|
|
205
115
|
"[object BigUint64Array]"
|
|
206
|
-
].includes(
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
function
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
if (value && typeof value === "object") return rawToReactive.get(value) || value;
|
|
227
|
-
return value;
|
|
228
|
-
};
|
|
229
|
-
Object.defineProperty(instrumentations, "size", { get() {
|
|
230
|
-
const target = toRaw(this);
|
|
231
|
-
track(getOrCreateDep(ITERATE_KEY));
|
|
232
|
-
return target.size;
|
|
233
|
-
} });
|
|
234
|
-
instrumentations.forEach = function(callback, thisArg) {
|
|
235
|
-
const target = toRaw(this);
|
|
236
|
-
track(getOrCreateDep(ITERATE_KEY));
|
|
237
|
-
target.forEach((value, key) => {
|
|
238
|
-
const reactiveValue = value && typeof value === "object" ? rawToReactive.get(value) || value : value;
|
|
239
|
-
const reactiveKey = key && typeof key === "object" ? rawToReactive.get(key) || key : key;
|
|
240
|
-
callback.call(thisArg, reactiveValue, reactiveKey, this);
|
|
116
|
+
].includes(t);
|
|
117
|
+
}
|
|
118
|
+
function ne(e, t) {
|
|
119
|
+
let n = {};
|
|
120
|
+
return n.has = function(e) {
|
|
121
|
+
let n = v(this), r = v(e);
|
|
122
|
+
return l(t(r)), n.has(r);
|
|
123
|
+
}, n.get = function(e) {
|
|
124
|
+
let n = v(this), r = v(e);
|
|
125
|
+
l(t(r));
|
|
126
|
+
let i = n.get(r);
|
|
127
|
+
return i && typeof i == "object" && _.get(i) || i;
|
|
128
|
+
}, Object.defineProperty(n, "size", { get() {
|
|
129
|
+
let e = v(this);
|
|
130
|
+
return l(t(h)), e.size;
|
|
131
|
+
} }), n.forEach = function(e, n) {
|
|
132
|
+
let r = v(this);
|
|
133
|
+
l(t(h)), r.forEach((t, r) => {
|
|
134
|
+
let i = t && typeof t == "object" && _.get(t) || t, a = r && typeof r == "object" && _.get(r) || r;
|
|
135
|
+
e.call(n, i, a, this);
|
|
241
136
|
});
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
if (target instanceof Set) return createReactiveIterator(target.values(), true);
|
|
262
|
-
else return createReactiveEntriesIterator(target.entries());
|
|
263
|
-
};
|
|
264
|
-
instrumentations.add = function(value) {
|
|
265
|
-
const target = toRaw(this);
|
|
266
|
-
const rawValue = toRaw(value);
|
|
267
|
-
const hadKey = target.has(rawValue);
|
|
268
|
-
target.add(rawValue);
|
|
269
|
-
if (!hadKey) {
|
|
270
|
-
const dep = depsMap.get(rawValue);
|
|
271
|
-
if (dep) trigger(dep);
|
|
272
|
-
const iterDep = depsMap.get(ITERATE_KEY);
|
|
273
|
-
if (iterDep) trigger(iterDep);
|
|
137
|
+
}, n.keys = function() {
|
|
138
|
+
let e = v(this);
|
|
139
|
+
return l(t(h)), x(e.keys(), !1);
|
|
140
|
+
}, n.values = function() {
|
|
141
|
+
let e = v(this);
|
|
142
|
+
return l(t(h)), x(e.values(), !0);
|
|
143
|
+
}, n.entries = function() {
|
|
144
|
+
let e = v(this);
|
|
145
|
+
return l(t(h)), S(e.entries());
|
|
146
|
+
}, n[Symbol.iterator] = function() {
|
|
147
|
+
let e = v(this);
|
|
148
|
+
return l(t(h)), e instanceof Set ? x(e.values(), !0) : S(e.entries());
|
|
149
|
+
}, n.add = function(t) {
|
|
150
|
+
let n = v(this), r = v(t), i = n.has(r);
|
|
151
|
+
if (n.add(r), !i) {
|
|
152
|
+
let t = e.get(r);
|
|
153
|
+
t && u(t);
|
|
154
|
+
let n = e.get(h);
|
|
155
|
+
n && u(n);
|
|
274
156
|
}
|
|
275
157
|
return this;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
const hadKey = target.has(rawKey);
|
|
282
|
-
const oldValue = target.get(rawKey);
|
|
283
|
-
target.set(rawKey, rawValue);
|
|
284
|
-
if (!hadKey) {
|
|
285
|
-
const iterDep = depsMap.get(ITERATE_KEY);
|
|
286
|
-
if (iterDep) trigger(iterDep);
|
|
158
|
+
}, n.set = function(t, n) {
|
|
159
|
+
let r = v(this), i = v(t), a = v(n), o = r.has(i), s = r.get(i);
|
|
160
|
+
if (r.set(i, a), !o) {
|
|
161
|
+
let t = e.get(h);
|
|
162
|
+
t && u(t);
|
|
287
163
|
}
|
|
288
|
-
if (!
|
|
289
|
-
|
|
290
|
-
|
|
164
|
+
if (!o || !Object.is(s, a)) {
|
|
165
|
+
let t = e.get(i);
|
|
166
|
+
t && u(t);
|
|
291
167
|
}
|
|
292
168
|
return this;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
const dep = depsMap.get(rawKey);
|
|
301
|
-
if (dep) trigger(dep);
|
|
302
|
-
const iterDep = depsMap.get(ITERATE_KEY);
|
|
303
|
-
if (iterDep) trigger(iterDep);
|
|
169
|
+
}, n.delete = function(t) {
|
|
170
|
+
let n = v(this), r = v(t), i = n.has(r), a = n.delete(r);
|
|
171
|
+
if (i) {
|
|
172
|
+
let t = e.get(r);
|
|
173
|
+
t && u(t);
|
|
174
|
+
let n = e.get(h);
|
|
175
|
+
n && u(n);
|
|
304
176
|
}
|
|
305
|
-
return
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
target.clear();
|
|
311
|
-
if (hadItems) for (const dep of depsMap.values()) trigger(dep);
|
|
312
|
-
};
|
|
313
|
-
return instrumentations;
|
|
177
|
+
return a;
|
|
178
|
+
}, n.clear = function() {
|
|
179
|
+
let t = v(this), n = t.size > 0;
|
|
180
|
+
if (t.clear(), n) for (let t of e.values()) u(t);
|
|
181
|
+
}, n;
|
|
314
182
|
}
|
|
315
|
-
|
|
316
|
-
* Creates a reactive iterator that wraps values in reactive proxies.
|
|
317
|
-
*/
|
|
318
|
-
function createReactiveIterator(innerIterator, wrapValues) {
|
|
183
|
+
function x(e, t) {
|
|
319
184
|
return {
|
|
320
185
|
next() {
|
|
321
|
-
|
|
322
|
-
|
|
186
|
+
let { value: n, done: r } = e.next();
|
|
187
|
+
return r ? {
|
|
323
188
|
value: void 0,
|
|
324
|
-
done:
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
done: false
|
|
189
|
+
done: !0
|
|
190
|
+
} : {
|
|
191
|
+
value: t && n && typeof n == "object" && _.get(n) || n,
|
|
192
|
+
done: !1
|
|
329
193
|
};
|
|
330
194
|
},
|
|
331
195
|
[Symbol.iterator]() {
|
|
@@ -333,21 +197,18 @@ function createReactiveIterator(innerIterator, wrapValues) {
|
|
|
333
197
|
}
|
|
334
198
|
};
|
|
335
199
|
}
|
|
336
|
-
|
|
337
|
-
* Creates a reactive entries iterator that wraps both keys and values.
|
|
338
|
-
*/
|
|
339
|
-
function createReactiveEntriesIterator(innerIterator) {
|
|
200
|
+
function S(e) {
|
|
340
201
|
return {
|
|
341
202
|
next() {
|
|
342
|
-
|
|
343
|
-
if (
|
|
203
|
+
let { value: t, done: n } = e.next();
|
|
204
|
+
if (n) return {
|
|
344
205
|
value: void 0,
|
|
345
|
-
done:
|
|
206
|
+
done: !0
|
|
346
207
|
};
|
|
347
|
-
|
|
208
|
+
let [r, i] = t;
|
|
348
209
|
return {
|
|
349
|
-
value: [
|
|
350
|
-
done:
|
|
210
|
+
value: [r && typeof r == "object" && _.get(r) || r, i && typeof i == "object" && _.get(i) || i],
|
|
211
|
+
done: !1
|
|
351
212
|
};
|
|
352
213
|
},
|
|
353
214
|
[Symbol.iterator]() {
|
|
@@ -357,49 +218,31 @@ function createReactiveEntriesIterator(innerIterator) {
|
|
|
357
218
|
}
|
|
358
219
|
//#endregion
|
|
359
220
|
//#region ../reactivity/src/signal.ts
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
function
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
* Detect which reactive property a selector function accesses.
|
|
377
|
-
*
|
|
378
|
-
* Runs `selector()` while observing property accesses and returns the
|
|
379
|
-
* last `[target, key]` pair accessed, or `null` if nothing was read.
|
|
380
|
-
* Used internally by the model/two-way-binding system.
|
|
381
|
-
*
|
|
382
|
-
* @example
|
|
383
|
-
* ```ts
|
|
384
|
-
* const state = signal({ form: { name: 'Alice' } });
|
|
385
|
-
* const result = detectAccess(() => state.form.name);
|
|
386
|
-
* // result === [state.form, 'name']
|
|
387
|
-
* ```
|
|
388
|
-
*/
|
|
389
|
-
function detectAccess(selector) {
|
|
390
|
-
let result = null;
|
|
391
|
-
const prev = accessObserver;
|
|
392
|
-
accessObserver = (target, key) => {
|
|
393
|
-
result = [target, key];
|
|
221
|
+
function C(e) {
|
|
222
|
+
if (e == null) return !0;
|
|
223
|
+
let t = typeof e;
|
|
224
|
+
return t === "string" || t === "number" || t === "boolean" || t === "symbol" || t === "bigint";
|
|
225
|
+
}
|
|
226
|
+
var w = null;
|
|
227
|
+
function T() {
|
|
228
|
+
return w;
|
|
229
|
+
}
|
|
230
|
+
function E(e) {
|
|
231
|
+
w = e;
|
|
232
|
+
}
|
|
233
|
+
function D(e) {
|
|
234
|
+
let t = null, n = w;
|
|
235
|
+
w = (e, n) => {
|
|
236
|
+
t = [e, n];
|
|
394
237
|
};
|
|
395
238
|
try {
|
|
396
|
-
|
|
239
|
+
e();
|
|
397
240
|
} finally {
|
|
398
|
-
|
|
241
|
+
w = n;
|
|
399
242
|
}
|
|
400
|
-
return
|
|
243
|
+
return t;
|
|
401
244
|
}
|
|
402
|
-
var
|
|
245
|
+
var O = {};
|
|
403
246
|
[
|
|
404
247
|
"push",
|
|
405
248
|
"pop",
|
|
@@ -408,577 +251,265 @@ var arrayInstrumentations = {};
|
|
|
408
251
|
"splice",
|
|
409
252
|
"sort",
|
|
410
253
|
"reverse"
|
|
411
|
-
].forEach((
|
|
412
|
-
|
|
413
|
-
let
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
});
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
});
|
|
420
|
-
[
|
|
254
|
+
].forEach((e) => {
|
|
255
|
+
O[e] = function(...t) {
|
|
256
|
+
let n;
|
|
257
|
+
return s(() => {
|
|
258
|
+
n = Array.prototype[e].apply(this, t);
|
|
259
|
+
}), n;
|
|
260
|
+
};
|
|
261
|
+
}), [
|
|
421
262
|
"includes",
|
|
422
263
|
"indexOf",
|
|
423
264
|
"lastIndexOf"
|
|
424
|
-
].forEach((
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
if (result !== -1 && result !== false) return result;
|
|
429
|
-
return Array.prototype[method].apply(raw, args);
|
|
265
|
+
].forEach((e) => {
|
|
266
|
+
O[e] = function(...t) {
|
|
267
|
+
let n = v(this), r = Array.prototype[e].apply(this, t);
|
|
268
|
+
return r !== -1 && r !== !1 ? r : Array.prototype[e].apply(n, t);
|
|
430
269
|
};
|
|
431
270
|
});
|
|
432
|
-
function
|
|
433
|
-
if (
|
|
434
|
-
|
|
435
|
-
if (
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
const proxy = new Proxy(objectTarget, {
|
|
451
|
-
get(obj, prop, receiver) {
|
|
452
|
-
if (prop === "$set") return (newValue) => {
|
|
453
|
-
batch(() => {
|
|
454
|
-
if (Array.isArray(obj) && Array.isArray(newValue)) {
|
|
455
|
-
const len = newValue.length;
|
|
456
|
-
for (let i = 0; i < len; i++) Reflect.set(receiver, String(i), newValue[i]);
|
|
457
|
-
Reflect.set(receiver, "length", len);
|
|
271
|
+
function k(e) {
|
|
272
|
+
if (C(e)) return k({ value: e });
|
|
273
|
+
let t = e;
|
|
274
|
+
if (b(t) || ee(t)) return t;
|
|
275
|
+
let r = _.get(t);
|
|
276
|
+
if (r) return r;
|
|
277
|
+
let i = y(t), a = i ? /* @__PURE__ */ new Map() : null, o = /* @__PURE__ */ new WeakMap(), c = (e) => {
|
|
278
|
+
a ||= /* @__PURE__ */ new Map();
|
|
279
|
+
let t = a.get(e);
|
|
280
|
+
return t || (t = /* @__PURE__ */ new Set(), a.set(e, t)), t;
|
|
281
|
+
}, d = i ? ne(a, c) : null, f = new Proxy(t, {
|
|
282
|
+
get(e, t, r) {
|
|
283
|
+
if (t === "$set") return (t) => {
|
|
284
|
+
s(() => {
|
|
285
|
+
if (Array.isArray(e) && Array.isArray(t)) {
|
|
286
|
+
let e = t.length;
|
|
287
|
+
for (let n = 0; n < e; n++) Reflect.set(r, String(n), t[n]);
|
|
288
|
+
Reflect.set(r, "length", e);
|
|
458
289
|
} else {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
for (
|
|
462
|
-
for (const key of oldKeys) if (!(key in newValue)) Reflect.deleteProperty(receiver, key);
|
|
290
|
+
let n = Object.keys(t), i = Object.keys(e);
|
|
291
|
+
for (let e of n) Reflect.set(r, e, t[e]);
|
|
292
|
+
for (let e of i) e in t || Reflect.deleteProperty(r, e);
|
|
463
293
|
}
|
|
464
294
|
});
|
|
465
295
|
};
|
|
466
|
-
if (
|
|
467
|
-
if (
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
if (prop in collectionInstrumentations) {
|
|
472
|
-
const instrumented = collectionInstrumentations[prop];
|
|
473
|
-
if (typeof instrumented === "function") return instrumented.bind(receiver);
|
|
474
|
-
return instrumented;
|
|
296
|
+
if (d) {
|
|
297
|
+
if (t === "size" && te(e)) return n && l(c(h)), e.size;
|
|
298
|
+
if (t in d) {
|
|
299
|
+
let e = d[t];
|
|
300
|
+
return typeof e == "function" ? e.bind(r) : e;
|
|
475
301
|
}
|
|
476
302
|
}
|
|
477
|
-
if (Array.isArray(
|
|
478
|
-
|
|
479
|
-
if (
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
let cached = reactiveCache.get(value);
|
|
483
|
-
if (!cached) {
|
|
484
|
-
cached = signal(value);
|
|
485
|
-
reactiveCache.set(value, cached);
|
|
486
|
-
}
|
|
487
|
-
return cached;
|
|
303
|
+
if (Array.isArray(e) && typeof t == "string" && O.hasOwnProperty(t)) return O[t];
|
|
304
|
+
let i = Reflect.get(e, t);
|
|
305
|
+
if (w && w(r, t), !d && n && l(c(t)), i && typeof i == "object" && !b(i)) {
|
|
306
|
+
let e = o.get(i);
|
|
307
|
+
return e || (e = k(i), o.set(i, e)), e;
|
|
488
308
|
}
|
|
489
|
-
return
|
|
309
|
+
return i;
|
|
490
310
|
},
|
|
491
|
-
set(
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
if (prop !== "length" && obj.length !== oldLength) {
|
|
500
|
-
const lengthDep = depsMap.get("length");
|
|
501
|
-
if (lengthDep) trigger(lengthDep);
|
|
311
|
+
set(e, t, n) {
|
|
312
|
+
let r = Array.isArray(e) ? e.length : 0, i = Reflect.get(e, t), o = Reflect.set(e, t, n);
|
|
313
|
+
if (!Object.is(i, n) && a) {
|
|
314
|
+
let i = a.get(t);
|
|
315
|
+
if (i && u(i), Array.isArray(e)) {
|
|
316
|
+
if (t !== "length" && e.length !== r) {
|
|
317
|
+
let e = a.get("length");
|
|
318
|
+
e && u(e);
|
|
502
319
|
}
|
|
503
|
-
if (
|
|
504
|
-
|
|
505
|
-
|
|
320
|
+
if (t === "length" && typeof n == "number" && n < r) for (let e = n; e < r; e++) {
|
|
321
|
+
let t = a.get(String(e));
|
|
322
|
+
t && u(t);
|
|
506
323
|
}
|
|
507
324
|
}
|
|
508
325
|
}
|
|
509
|
-
return
|
|
326
|
+
return o;
|
|
510
327
|
},
|
|
511
|
-
deleteProperty(
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
if (dep) trigger(dep);
|
|
328
|
+
deleteProperty(e, t) {
|
|
329
|
+
let n = Object.prototype.hasOwnProperty.call(e, t), r = Reflect.deleteProperty(e, t);
|
|
330
|
+
if (r && n && a) {
|
|
331
|
+
let e = a.get(t);
|
|
332
|
+
e && u(e);
|
|
517
333
|
}
|
|
518
|
-
return
|
|
334
|
+
return r;
|
|
519
335
|
}
|
|
520
336
|
});
|
|
521
|
-
|
|
522
|
-
rawToReactive.set(objectTarget, proxy);
|
|
523
|
-
return proxy;
|
|
337
|
+
return g.set(f, t), _.set(t, f), f;
|
|
524
338
|
}
|
|
525
339
|
//#endregion
|
|
526
340
|
//#region ../reactivity/src/watch.ts
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
*/
|
|
533
|
-
function traverse(value, depth = Infinity, seen = /* @__PURE__ */ new Set()) {
|
|
534
|
-
if (depth <= 0) return value;
|
|
535
|
-
if (value === null || typeof value !== "object") return value;
|
|
536
|
-
if (seen.has(value)) return value;
|
|
537
|
-
seen.add(value);
|
|
538
|
-
if (Array.isArray(value)) for (let i = 0; i < value.length; i++) traverse(value[i], depth - 1, seen);
|
|
539
|
-
else if (value instanceof Map) value.forEach((v, k) => {
|
|
540
|
-
traverse(k, depth - 1, seen);
|
|
541
|
-
traverse(v, depth - 1, seen);
|
|
341
|
+
function A(e, t = Infinity, n = /* @__PURE__ */ new Set()) {
|
|
342
|
+
if (t <= 0 || typeof e != "object" || !e || n.has(e)) return e;
|
|
343
|
+
if (n.add(e), Array.isArray(e)) for (let r = 0; r < e.length; r++) A(e[r], t - 1, n);
|
|
344
|
+
else if (e instanceof Map) e.forEach((e, r) => {
|
|
345
|
+
A(r, t - 1, n), A(e, t - 1, n);
|
|
542
346
|
});
|
|
543
|
-
else if (
|
|
544
|
-
|
|
347
|
+
else if (e instanceof Set) e.forEach((e) => {
|
|
348
|
+
A(e, t - 1, n);
|
|
545
349
|
});
|
|
546
|
-
else for (
|
|
547
|
-
return
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
* const count = signal(0);
|
|
556
|
-
* const handle = watch(() => count.value, (newVal, oldVal) => {
|
|
557
|
-
* console.log(`${oldVal} → ${newVal}`);
|
|
558
|
-
* });
|
|
559
|
-
* handle.stop(); // stop watching
|
|
560
|
-
* ```
|
|
561
|
-
*/
|
|
562
|
-
function watch(source, cb, options) {
|
|
563
|
-
let oldValue;
|
|
564
|
-
let isFirst = true;
|
|
565
|
-
let cleanupFn = null;
|
|
566
|
-
let paused = false;
|
|
567
|
-
let pendingValue;
|
|
568
|
-
let hasPending = false;
|
|
569
|
-
let stopped = false;
|
|
570
|
-
const deep = options?.deep;
|
|
571
|
-
const traverseDepth = deep === true ? Infinity : typeof deep === "number" ? deep : 0;
|
|
572
|
-
const runner = effect(() => {
|
|
573
|
-
if (stopped) return;
|
|
574
|
-
let newValue = typeof source === "function" ? source() : source;
|
|
575
|
-
if (traverseDepth > 0) traverse(newValue, traverseDepth);
|
|
576
|
-
if (paused) {
|
|
577
|
-
pendingValue = newValue;
|
|
578
|
-
hasPending = true;
|
|
350
|
+
else for (let r of Object.keys(e)) A(e[r], t - 1, n);
|
|
351
|
+
return e;
|
|
352
|
+
}
|
|
353
|
+
function re(e, t, n) {
|
|
354
|
+
let r, i = !0, a = null, o = !1, s, c = !1, l = !1, u = n?.deep, d = u === !0 ? Infinity : typeof u == "number" ? u : 0, p = f(() => {
|
|
355
|
+
if (l) return;
|
|
356
|
+
let u = typeof e == "function" ? e() : e;
|
|
357
|
+
if (d > 0 && A(u, d), o) {
|
|
358
|
+
s = u, c = !0;
|
|
579
359
|
return;
|
|
580
360
|
}
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
if (cleanupFn) cleanupFn();
|
|
593
|
-
cb(newValue, oldValue, (fn) => cleanupFn = fn);
|
|
594
|
-
if (options?.once) {
|
|
595
|
-
stopped = true;
|
|
596
|
-
queueMicrotask(() => stop());
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
oldValue = newValue;
|
|
600
|
-
});
|
|
601
|
-
const stop = () => {
|
|
602
|
-
stopped = true;
|
|
603
|
-
runner.stop();
|
|
604
|
-
if (cleanupFn) cleanupFn();
|
|
605
|
-
};
|
|
606
|
-
const pause = () => {
|
|
607
|
-
paused = true;
|
|
608
|
-
};
|
|
609
|
-
const resume = () => {
|
|
610
|
-
if (!paused) return;
|
|
611
|
-
paused = false;
|
|
612
|
-
if (hasPending && !Object.is(pendingValue, oldValue)) {
|
|
613
|
-
if (cleanupFn) cleanupFn();
|
|
614
|
-
cb(pendingValue, oldValue, (fn) => cleanupFn = fn);
|
|
615
|
-
oldValue = pendingValue;
|
|
361
|
+
i ? (n?.immediate && (a && a(), t(u, r, (e) => a = e), n?.once && (l = !0, queueMicrotask(() => m()))), i = !1) : (a && a(), t(u, r, (e) => a = e), n?.once && (l = !0, queueMicrotask(() => m()))), r = u;
|
|
362
|
+
}), m = () => {
|
|
363
|
+
l = !0, p.stop(), a && a();
|
|
364
|
+
};
|
|
365
|
+
return Object.assign(m, {
|
|
366
|
+
stop: m,
|
|
367
|
+
pause: () => {
|
|
368
|
+
o = !0;
|
|
369
|
+
},
|
|
370
|
+
resume: () => {
|
|
371
|
+
o && (o = !1, c && !Object.is(s, r) && (a && a(), t(s, r, (e) => a = e), r = s), c = !1, s = void 0);
|
|
616
372
|
}
|
|
617
|
-
hasPending = false;
|
|
618
|
-
pendingValue = void 0;
|
|
619
|
-
};
|
|
620
|
-
return Object.assign(stop, {
|
|
621
|
-
stop,
|
|
622
|
-
pause,
|
|
623
|
-
resume
|
|
624
373
|
});
|
|
625
374
|
}
|
|
626
375
|
//#endregion
|
|
627
376
|
//#region ../reactivity/src/computed.ts
|
|
628
|
-
function
|
|
629
|
-
let
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
const computedEffect = function() {
|
|
640
|
-
if (!dirty) {
|
|
641
|
-
dirty = true;
|
|
642
|
-
trigger(subscribers);
|
|
643
|
-
}
|
|
644
|
-
};
|
|
645
|
-
computedEffect.deps = [];
|
|
646
|
-
const computeValue = () => {
|
|
647
|
-
cleanup(computedEffect);
|
|
648
|
-
const prevEffect = getActiveEffect();
|
|
649
|
-
setActiveEffect(computedEffect);
|
|
377
|
+
function ie(e) {
|
|
378
|
+
let n, r;
|
|
379
|
+
typeof e == "function" ? n = e : (n = e.get, r = e.set);
|
|
380
|
+
let i = /* @__PURE__ */ new Set(), s, d = !0, f = function() {
|
|
381
|
+
d || (d = !0, u(i));
|
|
382
|
+
};
|
|
383
|
+
f.deps = [];
|
|
384
|
+
let p = () => {
|
|
385
|
+
c(f);
|
|
386
|
+
let e = o();
|
|
387
|
+
a(f);
|
|
650
388
|
try {
|
|
651
|
-
|
|
652
|
-
dirty = false;
|
|
653
|
-
return cachedValue;
|
|
389
|
+
return s = n(), d = !1, s;
|
|
654
390
|
} finally {
|
|
655
|
-
|
|
391
|
+
a(e);
|
|
656
392
|
}
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
[ComputedSymbol]: true,
|
|
393
|
+
}, m = {
|
|
394
|
+
[t]: !0,
|
|
660
395
|
get value() {
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
}
|
|
666
|
-
track(subscribers);
|
|
667
|
-
const result = dirty ? computeValue() : cachedValue;
|
|
668
|
-
if (observer) setAccessObserver(observer);
|
|
669
|
-
return result;
|
|
396
|
+
let e = T();
|
|
397
|
+
e && (e(m, "value"), E(null)), l(i);
|
|
398
|
+
let t = d ? p() : s;
|
|
399
|
+
return e && E(e), t;
|
|
670
400
|
}
|
|
671
401
|
};
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
enumerable: true,
|
|
689
|
-
configurable: false
|
|
690
|
-
});
|
|
691
|
-
return computedObj;
|
|
692
|
-
}
|
|
693
|
-
return computedObj;
|
|
694
|
-
}
|
|
695
|
-
/**
|
|
696
|
-
* Type guard to check if a value is a computed signal.
|
|
697
|
-
*
|
|
698
|
-
* @example
|
|
699
|
-
* ```ts
|
|
700
|
-
* const doubled = computed(() => count.value * 2);
|
|
701
|
-
* console.log(isComputed(doubled)); // true
|
|
702
|
-
* console.log(isComputed({ value: 1 })); // false
|
|
703
|
-
* ```
|
|
704
|
-
*/
|
|
705
|
-
function isComputed(value) {
|
|
706
|
-
return value !== null && typeof value === "object" && ComputedSymbol in value;
|
|
402
|
+
return r && Object.defineProperty(m, "value", {
|
|
403
|
+
get() {
|
|
404
|
+
let e = T();
|
|
405
|
+
e && (e(m, "value"), E(null)), l(i);
|
|
406
|
+
let t = d ? p() : s;
|
|
407
|
+
return e && E(e), t;
|
|
408
|
+
},
|
|
409
|
+
set(e) {
|
|
410
|
+
r(e);
|
|
411
|
+
},
|
|
412
|
+
enumerable: !0,
|
|
413
|
+
configurable: !1
|
|
414
|
+
}), m;
|
|
415
|
+
}
|
|
416
|
+
function j(e) {
|
|
417
|
+
return typeof e == "object" && !!e && t in e;
|
|
707
418
|
}
|
|
708
419
|
//#endregion
|
|
709
420
|
//#region ../runtime-core/src/plugins.ts
|
|
710
|
-
var
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
var contextExtensions = [];
|
|
718
|
-
/**
|
|
719
|
-
* Apply all registered context extensions to a context object.
|
|
720
|
-
* Called internally by the renderer when creating component contexts.
|
|
721
|
-
*/
|
|
722
|
-
function applyContextExtensions(ctx) {
|
|
723
|
-
for (const extension of contextExtensions) extension(ctx);
|
|
421
|
+
var ae = [];
|
|
422
|
+
function oe() {
|
|
423
|
+
return ae;
|
|
424
|
+
}
|
|
425
|
+
var se = [];
|
|
426
|
+
function ce(e) {
|
|
427
|
+
for (let t of se) t(e);
|
|
724
428
|
}
|
|
725
429
|
//#endregion
|
|
726
430
|
//#region __vite-browser-external
|
|
727
|
-
var
|
|
728
|
-
|
|
729
|
-
}));
|
|
730
|
-
//#endregion
|
|
731
|
-
//#region ../runtime-core/src/async-context.ts
|
|
732
|
-
/**
|
|
733
|
-
* Try to load AsyncLocalStorage from Node.js.
|
|
734
|
-
* Returns null in browser environments.
|
|
735
|
-
*/
|
|
736
|
-
var asyncLocalStorage = null;
|
|
431
|
+
var le = /* @__PURE__ */ e(((e, t) => {
|
|
432
|
+
t.exports = {};
|
|
433
|
+
})), ue = null;
|
|
737
434
|
try {
|
|
738
|
-
if (typeof globalThis
|
|
739
|
-
|
|
740
|
-
|
|
435
|
+
if (typeof globalThis < "u" && globalThis.process !== void 0) {
|
|
436
|
+
let e = globalThis.process?.versions?.node ? le() : null;
|
|
437
|
+
e?.AsyncLocalStorage && (ue = new e.AsyncLocalStorage());
|
|
741
438
|
}
|
|
742
439
|
} catch {}
|
|
743
|
-
var
|
|
440
|
+
var de = {
|
|
744
441
|
currentComponentContext: null,
|
|
745
442
|
currentSuspenseBoundary: null
|
|
746
443
|
};
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
function getRequestContext() {
|
|
752
|
-
if (asyncLocalStorage) {
|
|
753
|
-
const store = asyncLocalStorage.getStore();
|
|
754
|
-
if (store) return store;
|
|
444
|
+
function fe() {
|
|
445
|
+
if (ue) {
|
|
446
|
+
let e = ue.getStore();
|
|
447
|
+
if (e) return e;
|
|
755
448
|
}
|
|
756
|
-
return
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
function
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
function
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
reqCtx.currentComponentContext = ctx;
|
|
772
|
-
return prev;
|
|
773
|
-
}
|
|
774
|
-
/**
|
|
775
|
-
* Get the current suspense boundary (request-safe).
|
|
776
|
-
*/
|
|
777
|
-
function getCurrentSuspenseBoundarySafe() {
|
|
778
|
-
return getRequestContext().currentSuspenseBoundary;
|
|
779
|
-
}
|
|
780
|
-
/**
|
|
781
|
-
* Set the current suspense boundary (request-safe).
|
|
782
|
-
* Returns the previous value.
|
|
783
|
-
*/
|
|
784
|
-
function setCurrentSuspenseBoundarySafe(boundary) {
|
|
785
|
-
const reqCtx = getRequestContext();
|
|
786
|
-
const prev = reqCtx.currentSuspenseBoundary;
|
|
787
|
-
reqCtx.currentSuspenseBoundary = boundary;
|
|
788
|
-
return prev;
|
|
449
|
+
return de;
|
|
450
|
+
}
|
|
451
|
+
function pe() {
|
|
452
|
+
return fe().currentComponentContext;
|
|
453
|
+
}
|
|
454
|
+
function me(e) {
|
|
455
|
+
let t = fe(), n = t.currentComponentContext;
|
|
456
|
+
return t.currentComponentContext = e, n;
|
|
457
|
+
}
|
|
458
|
+
function he() {
|
|
459
|
+
return fe().currentSuspenseBoundary;
|
|
460
|
+
}
|
|
461
|
+
function ge(e) {
|
|
462
|
+
let t = fe(), n = t.currentSuspenseBoundary;
|
|
463
|
+
return t.currentSuspenseBoundary = e, n;
|
|
789
464
|
}
|
|
790
465
|
//#endregion
|
|
791
466
|
//#region ../runtime-core/src/component.ts
|
|
792
|
-
var
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
* Register a callback to run after the component is mounted to the DOM.
|
|
819
|
-
* Must be called during component setup.
|
|
820
|
-
*
|
|
821
|
-
* @param fn - Callback receiving a {@link MountContext} with the component's root element.
|
|
822
|
-
*
|
|
823
|
-
* @example
|
|
824
|
-
* ```ts
|
|
825
|
-
* const MyComponent = component(() => {
|
|
826
|
-
* onMounted(({ el }) => {
|
|
827
|
-
* console.log('Mounted to', el);
|
|
828
|
-
* });
|
|
829
|
-
* return () => <div>Hello</div>;
|
|
830
|
-
* });
|
|
831
|
-
* ```
|
|
832
|
-
*/
|
|
833
|
-
function onMounted(fn) {
|
|
834
|
-
if (currentComponentContext) currentComponentContext.onMounted(fn);
|
|
835
|
-
else console.warn("onMounted called outside of component setup");
|
|
836
|
-
}
|
|
837
|
-
/**
|
|
838
|
-
* Register a callback to run when the component is unmounted from the DOM.
|
|
839
|
-
* Must be called during component setup. Use for cleanup (event listeners, timers, subscriptions).
|
|
840
|
-
*
|
|
841
|
-
* @param fn - Callback receiving a {@link MountContext} with the component's root element.
|
|
842
|
-
*
|
|
843
|
-
* @example
|
|
844
|
-
* ```ts
|
|
845
|
-
* const MyComponent = component(() => {
|
|
846
|
-
* const timer = setInterval(() => tick(), 1000);
|
|
847
|
-
* onUnmounted(() => clearInterval(timer));
|
|
848
|
-
* return () => <div>Tick</div>;
|
|
849
|
-
* });
|
|
850
|
-
* ```
|
|
851
|
-
*/
|
|
852
|
-
function onUnmounted(fn) {
|
|
853
|
-
if (currentComponentContext) currentComponentContext.onUnmounted(fn);
|
|
854
|
-
else console.warn("onUnmounted called outside of component setup");
|
|
855
|
-
}
|
|
856
|
-
/**
|
|
857
|
-
* Register a callback to run immediately after component setup completes,
|
|
858
|
-
* before the first render. Must be called during component setup.
|
|
859
|
-
*
|
|
860
|
-
* @example
|
|
861
|
-
* ```ts
|
|
862
|
-
* const MyComponent = component(() => {
|
|
863
|
-
* onCreated(() => console.log('Setup done, about to render'));
|
|
864
|
-
* return () => <div>Hello</div>;
|
|
865
|
-
* });
|
|
866
|
-
* ```
|
|
867
|
-
*/
|
|
868
|
-
function onCreated(fn) {
|
|
869
|
-
if (currentComponentContext) currentComponentContext.onCreated(fn);
|
|
870
|
-
else console.warn("onCreated called outside of component setup");
|
|
871
|
-
}
|
|
872
|
-
/**
|
|
873
|
-
* Register a callback to run after every reactive re-render of the component.
|
|
874
|
-
* Must be called during component setup.
|
|
875
|
-
*
|
|
876
|
-
* @example
|
|
877
|
-
* ```ts
|
|
878
|
-
* const Counter = component(() => {
|
|
879
|
-
* const state = signal({ count: 0 });
|
|
880
|
-
* onUpdated(() => console.log('Re-rendered with count:', state.count));
|
|
881
|
-
* return () => <button onClick={() => state.count++}>{state.count}</button>;
|
|
882
|
-
* });
|
|
883
|
-
* ```
|
|
884
|
-
*/
|
|
885
|
-
function onUpdated(fn) {
|
|
886
|
-
if (currentComponentContext) currentComponentContext.onUpdated(fn);
|
|
887
|
-
else console.warn("onUpdated called outside of component setup");
|
|
888
|
-
}
|
|
889
|
-
var componentRegistry = /* @__PURE__ */ new Map();
|
|
890
|
-
/**
|
|
891
|
-
* Get component metadata (for DevTools)
|
|
892
|
-
*/
|
|
893
|
-
function getComponentMeta(factory) {
|
|
894
|
-
return componentRegistry.get(factory);
|
|
895
|
-
}
|
|
896
|
-
/**
|
|
897
|
-
* Define a component. Returns a JSX factory function.
|
|
898
|
-
*
|
|
899
|
-
* @param setup - Setup function that receives context and returns a render function
|
|
900
|
-
* @param options - Optional configuration (e.g., name for DevTools)
|
|
901
|
-
*
|
|
902
|
-
* @example
|
|
903
|
-
* ```tsx
|
|
904
|
-
* type CardProps = DefineProp<"title", string> & DefineSlot<"header">;
|
|
905
|
-
*
|
|
906
|
-
* export const Card = component<CardProps>((ctx) => {
|
|
907
|
-
* const { title } = ctx.props;
|
|
908
|
-
* const { slots } = ctx;
|
|
909
|
-
*
|
|
910
|
-
* return () => (
|
|
911
|
-
* <div class="card">
|
|
912
|
-
* {slots.header?.() ?? <h2>{title}</h2>}
|
|
913
|
-
* {slots.default()}
|
|
914
|
-
* </div>
|
|
915
|
-
* );
|
|
916
|
-
* });
|
|
917
|
-
* ```
|
|
918
|
-
*/
|
|
919
|
-
function component(setup, options) {
|
|
920
|
-
const factory = function(props) {
|
|
467
|
+
var M = null;
|
|
468
|
+
function _e() {
|
|
469
|
+
return pe() ?? M;
|
|
470
|
+
}
|
|
471
|
+
function ve(e) {
|
|
472
|
+
let t = me(e), n = M;
|
|
473
|
+
return M = e, t ?? n;
|
|
474
|
+
}
|
|
475
|
+
function N(e) {
|
|
476
|
+
M ? M.onMounted(e) : console.warn("onMounted called outside of component setup");
|
|
477
|
+
}
|
|
478
|
+
function P(e) {
|
|
479
|
+
M ? M.onUnmounted(e) : console.warn("onUnmounted called outside of component setup");
|
|
480
|
+
}
|
|
481
|
+
function ye(e) {
|
|
482
|
+
M ? M.onCreated(e) : console.warn("onCreated called outside of component setup");
|
|
483
|
+
}
|
|
484
|
+
function be(e) {
|
|
485
|
+
M ? M.onUpdated(e) : console.warn("onUpdated called outside of component setup");
|
|
486
|
+
}
|
|
487
|
+
var xe = /* @__PURE__ */ new Map();
|
|
488
|
+
function Se(e) {
|
|
489
|
+
return xe.get(e);
|
|
490
|
+
}
|
|
491
|
+
function F(e, t) {
|
|
492
|
+
let n = function(e) {
|
|
921
493
|
return {
|
|
922
|
-
type:
|
|
923
|
-
props:
|
|
924
|
-
key:
|
|
494
|
+
type: n,
|
|
495
|
+
props: e || {},
|
|
496
|
+
key: e?.key || null,
|
|
925
497
|
children: [],
|
|
926
498
|
dom: null
|
|
927
499
|
};
|
|
928
500
|
};
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
factory.__ref = null;
|
|
934
|
-
factory.__slots = null;
|
|
935
|
-
componentRegistry.set(factory, {
|
|
936
|
-
name: options?.name,
|
|
937
|
-
setup
|
|
938
|
-
});
|
|
939
|
-
getComponentPlugins().forEach((p) => p.onDefine?.(options?.name, factory, setup));
|
|
940
|
-
return factory;
|
|
501
|
+
return n.__setup = e, n.__name = t?.name, n.__props = null, n.__events = null, n.__ref = null, n.__slots = null, xe.set(n, {
|
|
502
|
+
name: t?.name,
|
|
503
|
+
setup: e
|
|
504
|
+
}), oe().forEach((r) => r.onDefine?.(t?.name, n, e)), n;
|
|
941
505
|
}
|
|
942
506
|
//#endregion
|
|
943
507
|
//#region ../runtime-core/src/errors.ts
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
* Every runtime error has a unique code (SIGX001–SIGX999) so users can
|
|
948
|
-
* programmatically handle errors and look them up in documentation.
|
|
949
|
-
*
|
|
950
|
-
* @example
|
|
951
|
-
* ```ts
|
|
952
|
-
* try {
|
|
953
|
-
* app.mount('#app');
|
|
954
|
-
* } catch (e) {
|
|
955
|
-
* if (e instanceof SigxError && e.code === 'SIGX101') {
|
|
956
|
-
* // handle missing mount target
|
|
957
|
-
* }
|
|
958
|
-
* }
|
|
959
|
-
* ```
|
|
960
|
-
*/
|
|
961
|
-
/**
|
|
962
|
-
* Base error class for all SignalX runtime errors.
|
|
963
|
-
*/
|
|
964
|
-
var SigxError = class extends Error {
|
|
965
|
-
constructor(message, options) {
|
|
966
|
-
super(message);
|
|
967
|
-
this.name = "SigxError";
|
|
968
|
-
this.code = options.code;
|
|
969
|
-
this.suggestion = options.suggestion;
|
|
970
|
-
if (options.cause) this.cause = options.cause;
|
|
508
|
+
var I = class extends Error {
|
|
509
|
+
constructor(e, t) {
|
|
510
|
+
super(e), this.name = "SigxError", this.code = t.code, this.suggestion = t.suggestion, t.cause && (this.cause = t.cause);
|
|
971
511
|
}
|
|
972
|
-
}
|
|
973
|
-
/**
|
|
974
|
-
* Error codes for the SignalX runtime.
|
|
975
|
-
*
|
|
976
|
-
* Ranges:
|
|
977
|
-
* - SIGX001–SIGX099: App lifecycle
|
|
978
|
-
* - SIGX100–SIGX199: Rendering / mounting
|
|
979
|
-
* - SIGX200–SIGX299: Dependency injection
|
|
980
|
-
*/
|
|
981
|
-
var SigxErrorCode = {
|
|
512
|
+
}, L = {
|
|
982
513
|
NO_MOUNT_FUNCTION: "SIGX001",
|
|
983
514
|
RENDER_TARGET_NOT_FOUND: "SIGX100",
|
|
984
515
|
MOUNT_TARGET_NOT_FOUND: "SIGX101",
|
|
@@ -986,1902 +517,1037 @@ var SigxErrorCode = {
|
|
|
986
517
|
PROVIDE_OUTSIDE_SETUP: "SIGX200",
|
|
987
518
|
PROVIDE_INVALID_INJECTABLE: "SIGX201"
|
|
988
519
|
};
|
|
989
|
-
function
|
|
990
|
-
return new
|
|
991
|
-
code:
|
|
520
|
+
function Ce() {
|
|
521
|
+
return new I("No mount function provided and no default mount function set.", {
|
|
522
|
+
code: L.NO_MOUNT_FUNCTION,
|
|
992
523
|
suggestion: "Either pass a mount function to app.mount(), or import a platform package (e.g., @sigx/runtime-dom or @sigx/runtime-terminal) that sets the default."
|
|
993
524
|
});
|
|
994
525
|
}
|
|
995
|
-
function
|
|
996
|
-
return new
|
|
997
|
-
code:
|
|
998
|
-
suggestion: `Make sure the element exists in your HTML: <div id="${
|
|
526
|
+
function we(e) {
|
|
527
|
+
return new I(`Render target "${e}" not found.`, {
|
|
528
|
+
code: L.RENDER_TARGET_NOT_FOUND,
|
|
529
|
+
suggestion: `Make sure the element exists in your HTML: <div id="${e.replace(/^#/, "")}"></div>`
|
|
999
530
|
});
|
|
1000
531
|
}
|
|
1001
|
-
function
|
|
1002
|
-
return new
|
|
1003
|
-
code:
|
|
1004
|
-
suggestion: `Make sure the element exists in your HTML: <div id="${
|
|
532
|
+
function Te(e) {
|
|
533
|
+
return new I(`Mount target "${e}" not found.`, {
|
|
534
|
+
code: L.MOUNT_TARGET_NOT_FOUND,
|
|
535
|
+
suggestion: `Make sure the element exists in your HTML: <div id="${e.replace(/^#/, "")}"></div>`
|
|
1005
536
|
});
|
|
1006
537
|
}
|
|
1007
|
-
function
|
|
1008
|
-
return new
|
|
1009
|
-
code:
|
|
538
|
+
function Ee(e) {
|
|
539
|
+
return new I(`Async setup in component "${e}" is only supported during SSR.`, {
|
|
540
|
+
code: L.ASYNC_SETUP_CLIENT,
|
|
1010
541
|
suggestion: "On the client, use pre-loaded data from hydration or fetch in onMounted."
|
|
1011
542
|
});
|
|
1012
543
|
}
|
|
1013
|
-
function
|
|
1014
|
-
return new
|
|
1015
|
-
code:
|
|
544
|
+
function De() {
|
|
545
|
+
return new I("defineProvide must be called inside a component setup function.", {
|
|
546
|
+
code: L.PROVIDE_OUTSIDE_SETUP,
|
|
1016
547
|
suggestion: "Move the defineProvide() call inside your component's setup function, or use app.defineProvide() at the app level."
|
|
1017
548
|
});
|
|
1018
549
|
}
|
|
1019
|
-
function
|
|
1020
|
-
return new
|
|
1021
|
-
code:
|
|
550
|
+
function Oe() {
|
|
551
|
+
return new I("defineProvide must be called with a function created by defineInjectable.", {
|
|
552
|
+
code: L.PROVIDE_INVALID_INJECTABLE,
|
|
1022
553
|
suggestion: "Create an injectable first:\n const useMyService = defineInjectable(() => new MyService());\n defineProvide(useMyService);"
|
|
1023
554
|
});
|
|
1024
555
|
}
|
|
1025
556
|
//#endregion
|
|
1026
557
|
//#region ../runtime-core/src/di/injectable.ts
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
var appContextToken = Symbol("sigx:appContext");
|
|
1036
|
-
/**
|
|
1037
|
-
* Lookup a provided value by token, traversing component tree.
|
|
1038
|
-
* The AppContext is provided at the root component level, so it's found
|
|
1039
|
-
* just like any other provided value.
|
|
1040
|
-
* @internal
|
|
1041
|
-
*/
|
|
1042
|
-
function lookupProvided(token) {
|
|
1043
|
-
const ctx = getCurrentInstance();
|
|
1044
|
-
if (!ctx) return;
|
|
1045
|
-
let current = ctx;
|
|
1046
|
-
while (current) {
|
|
1047
|
-
if (current.provides && current.provides.has(token)) return current.provides.get(token);
|
|
1048
|
-
current = current.parent;
|
|
558
|
+
var ke = /* @__PURE__ */ new Map(), Ae = Symbol("sigx:appContext");
|
|
559
|
+
function je(e) {
|
|
560
|
+
let t = _e();
|
|
561
|
+
if (!t) return;
|
|
562
|
+
let n = t;
|
|
563
|
+
for (; n;) {
|
|
564
|
+
if (n.provides && n.provides.has(e)) return n.provides.get(e);
|
|
565
|
+
n = n.parent;
|
|
1049
566
|
}
|
|
1050
567
|
}
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
}
|
|
1062
|
-
/**
|
|
1063
|
-
* Define an injectable service/value that can be provided at app or component level.
|
|
1064
|
-
*
|
|
1065
|
-
* The returned function can be called to get the current instance:
|
|
1066
|
-
* - If provided at component level via `defineProvide()`, returns that instance
|
|
1067
|
-
* - If provided at app level via `app.defineProvide()`, returns that instance
|
|
1068
|
-
* - Otherwise falls back to a global singleton created by the factory
|
|
1069
|
-
*
|
|
1070
|
-
* @example
|
|
1071
|
-
* ```typescript
|
|
1072
|
-
* // Define a service
|
|
1073
|
-
* const useApiConfig = defineInjectable(() => ({
|
|
1074
|
-
* baseUrl: 'https://api.example.com'
|
|
1075
|
-
* }));
|
|
1076
|
-
*
|
|
1077
|
-
* // Use it in any component - gets nearest provided instance or global singleton
|
|
1078
|
-
* const config = useApiConfig();
|
|
1079
|
-
* console.log(config.baseUrl);
|
|
1080
|
-
* ```
|
|
1081
|
-
*/
|
|
1082
|
-
function defineInjectable(factory) {
|
|
1083
|
-
const token = Symbol();
|
|
1084
|
-
const useFn = (() => {
|
|
1085
|
-
const provided = lookupProvided(token);
|
|
1086
|
-
if (provided !== void 0) return provided;
|
|
1087
|
-
if (!globalInstances.has(token)) globalInstances.set(token, factory());
|
|
1088
|
-
return globalInstances.get(token);
|
|
568
|
+
function Me(e, t) {
|
|
569
|
+
let n = _e();
|
|
570
|
+
if (!n) throw De();
|
|
571
|
+
let r = n;
|
|
572
|
+
r.provides ||= /* @__PURE__ */ new Map(), r.provides.set(e, t);
|
|
573
|
+
}
|
|
574
|
+
function Ne(e) {
|
|
575
|
+
let t = Symbol(), n = (() => {
|
|
576
|
+
let n = je(t);
|
|
577
|
+
return n === void 0 ? (ke.has(t) || ke.set(t, e()), ke.get(t)) : n;
|
|
1089
578
|
});
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
* const config = defineProvide(useApiConfig);
|
|
1108
|
-
* config.baseUrl = 'https://custom.api.com';
|
|
1109
|
-
*
|
|
1110
|
-
* return () => <ChildComponent />;
|
|
1111
|
-
* });
|
|
1112
|
-
*
|
|
1113
|
-
* // Or provide a pre-constructed instance:
|
|
1114
|
-
* const MyComponent2 = component(() => {
|
|
1115
|
-
* const customService = createMyService({ custom: 'options' });
|
|
1116
|
-
* defineProvide(useMyService, () => customService);
|
|
1117
|
-
*
|
|
1118
|
-
* return () => <ChildComponent />;
|
|
1119
|
-
* });
|
|
1120
|
-
* ```
|
|
1121
|
-
*/
|
|
1122
|
-
function defineProvide(useFn, factory) {
|
|
1123
|
-
const actualFactory = factory ?? useFn._factory;
|
|
1124
|
-
const token = useFn._token;
|
|
1125
|
-
if (!actualFactory || !token) throw provideInvalidInjectableError();
|
|
1126
|
-
const instance = actualFactory();
|
|
1127
|
-
provideAtComponent(token, instance);
|
|
1128
|
-
return instance;
|
|
1129
|
-
}
|
|
1130
|
-
/**
|
|
1131
|
-
* Get the current AppContext from the component tree.
|
|
1132
|
-
* The AppContext is provided at the root component level during mount/hydrate/SSR.
|
|
1133
|
-
*
|
|
1134
|
-
* @example
|
|
1135
|
-
* ```typescript
|
|
1136
|
-
* const appContext = useAppContext();
|
|
1137
|
-
* console.log(appContext?.app);
|
|
1138
|
-
* ```
|
|
1139
|
-
*/
|
|
1140
|
-
function useAppContext() {
|
|
1141
|
-
return lookupProvided(appContextToken) ?? null;
|
|
1142
|
-
}
|
|
1143
|
-
/**
|
|
1144
|
-
* Get the AppContext token.
|
|
1145
|
-
* Used by renderers to provide the AppContext at the root component level.
|
|
1146
|
-
* @internal
|
|
1147
|
-
*/
|
|
1148
|
-
function getAppContextToken() {
|
|
1149
|
-
return appContextToken;
|
|
1150
|
-
}
|
|
1151
|
-
/**
|
|
1152
|
-
* Provide the AppContext on a component's provides Map.
|
|
1153
|
-
* Called by the renderer for the ROOT component only.
|
|
1154
|
-
* @internal
|
|
1155
|
-
*/
|
|
1156
|
-
function provideAppContext(ctx, appContext) {
|
|
1157
|
-
const node = ctx;
|
|
1158
|
-
if (!node.provides) node.provides = /* @__PURE__ */ new Map();
|
|
1159
|
-
node.provides.set(appContextToken, appContext);
|
|
1160
|
-
if (appContext.provides) for (const [token, value] of appContext.provides) node.provides.set(token, value);
|
|
579
|
+
return n._factory = e, n._token = t, n;
|
|
580
|
+
}
|
|
581
|
+
function Pe(e, t) {
|
|
582
|
+
let n = t ?? e._factory, r = e._token;
|
|
583
|
+
if (!n || !r) throw Oe();
|
|
584
|
+
let i = n();
|
|
585
|
+
return Me(r, i), i;
|
|
586
|
+
}
|
|
587
|
+
function Fe() {
|
|
588
|
+
return je(Ae) ?? null;
|
|
589
|
+
}
|
|
590
|
+
function Ie() {
|
|
591
|
+
return Ae;
|
|
592
|
+
}
|
|
593
|
+
function Le(e, t) {
|
|
594
|
+
let n = e;
|
|
595
|
+
if (n.provides ||= /* @__PURE__ */ new Map(), n.provides.set(Ae, t), t.provides) for (let [e, r] of t.provides) n.provides.set(e, r);
|
|
1161
596
|
}
|
|
1162
597
|
//#endregion
|
|
1163
598
|
//#region ../runtime-core/src/directives.ts
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
* Define a directive. This is an identity function that marks the definition
|
|
1171
|
-
* for type inference and runtime identification.
|
|
1172
|
-
*
|
|
1173
|
-
* @example
|
|
1174
|
-
* ```ts
|
|
1175
|
-
* const highlight = defineDirective<string>({
|
|
1176
|
-
* mounted(el, { value }) {
|
|
1177
|
-
* el.style.backgroundColor = value;
|
|
1178
|
-
* },
|
|
1179
|
-
* updated(el, { value }) {
|
|
1180
|
-
* el.style.backgroundColor = value;
|
|
1181
|
-
* }
|
|
1182
|
-
* });
|
|
1183
|
-
* ```
|
|
1184
|
-
*/
|
|
1185
|
-
function defineDirective(definition) {
|
|
1186
|
-
definition[__DIRECTIVE__] = true;
|
|
1187
|
-
return definition;
|
|
1188
|
-
}
|
|
1189
|
-
/**
|
|
1190
|
-
* Check if a value is a directive definition.
|
|
1191
|
-
*/
|
|
1192
|
-
function isDirective(value) {
|
|
1193
|
-
return value != null && typeof value === "object" && value[__DIRECTIVE__] === true;
|
|
599
|
+
var Re = Symbol.for("sigx.directive");
|
|
600
|
+
function ze(e) {
|
|
601
|
+
return e[Re] = !0, e;
|
|
602
|
+
}
|
|
603
|
+
function Be(e) {
|
|
604
|
+
return typeof e == "object" && !!e && e[Re] === !0;
|
|
1194
605
|
}
|
|
1195
606
|
//#endregion
|
|
1196
607
|
//#region ../runtime-core/src/app.ts
|
|
1197
|
-
var
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
* @example
|
|
1204
|
-
* ```typescript
|
|
1205
|
-
* // In @sigx/runtime-dom
|
|
1206
|
-
* import { setDefaultMount } from '@sigx/runtime-core';
|
|
1207
|
-
* setDefaultMount(domMount);
|
|
1208
|
-
* ```
|
|
1209
|
-
*/
|
|
1210
|
-
function setDefaultMount(mountFn) {
|
|
1211
|
-
defaultMountFn = mountFn;
|
|
1212
|
-
}
|
|
1213
|
-
/**
|
|
1214
|
-
* Create an application instance.
|
|
1215
|
-
*
|
|
1216
|
-
* @example
|
|
1217
|
-
* ```tsx
|
|
1218
|
-
* import { defineApp, defineInjectable } from '@sigx/runtime-core';
|
|
1219
|
-
*
|
|
1220
|
-
* // Define an injectable service
|
|
1221
|
-
* const useApiConfig = defineInjectable(() => ({ baseUrl: 'https://api.example.com' }));
|
|
1222
|
-
*
|
|
1223
|
-
* const app = defineApp(<App />);
|
|
1224
|
-
*
|
|
1225
|
-
* app.use(myPlugin, { option: 'value' });
|
|
1226
|
-
*
|
|
1227
|
-
* // Provide custom instance at app level
|
|
1228
|
-
* const config = app.defineProvide(useApiConfig);
|
|
1229
|
-
* config.baseUrl = 'https://custom.api.com';
|
|
1230
|
-
*
|
|
1231
|
-
* app.mount(document.getElementById('app')!);
|
|
1232
|
-
* ```
|
|
1233
|
-
*/
|
|
1234
|
-
function defineApp(rootComponent) {
|
|
1235
|
-
const installedPlugins = /* @__PURE__ */ new Set();
|
|
1236
|
-
const context = {
|
|
608
|
+
var R = typeof process < "u" && process.env.NODE_ENV !== "production" || !0, Ve = null;
|
|
609
|
+
function He(e) {
|
|
610
|
+
Ve = e;
|
|
611
|
+
}
|
|
612
|
+
function Ue(e) {
|
|
613
|
+
let t = /* @__PURE__ */ new Set(), n = {
|
|
1237
614
|
app: null,
|
|
1238
615
|
provides: /* @__PURE__ */ new Map(),
|
|
1239
616
|
config: {},
|
|
1240
617
|
hooks: [],
|
|
1241
618
|
directives: /* @__PURE__ */ new Map()
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
const app = {
|
|
1247
|
-
config: context.config,
|
|
1248
|
-
use(plugin, options) {
|
|
1249
|
-
if (installedPlugins.has(plugin)) {
|
|
1250
|
-
if (isDev) console.warn(`Plugin ${plugin.name || "anonymous"} is already installed.`);
|
|
1251
|
-
return app;
|
|
1252
|
-
}
|
|
1253
|
-
installedPlugins.add(plugin);
|
|
1254
|
-
if (typeof plugin === "function") plugin(app, options);
|
|
1255
|
-
else if (plugin && typeof plugin.install === "function") plugin.install(app, options);
|
|
1256
|
-
else if (isDev) console.warn("Invalid plugin: must be a function or have an install() method.");
|
|
1257
|
-
return app;
|
|
619
|
+
}, r = !1, i = null, a = null, o = {
|
|
620
|
+
config: n.config,
|
|
621
|
+
use(e, n) {
|
|
622
|
+
return t.has(e) ? (R && console.warn(`Plugin ${e.name || "anonymous"} is already installed.`), o) : (t.add(e), typeof e == "function" ? e(o, n) : e && typeof e.install == "function" ? e.install(o, n) : R && console.warn("Invalid plugin: must be a function or have an install() method."), o);
|
|
1258
623
|
},
|
|
1259
|
-
defineProvide(
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
context.provides.set(token, instance);
|
|
1265
|
-
return instance;
|
|
624
|
+
defineProvide(e, t) {
|
|
625
|
+
let r = t ?? e._factory, i = e._token;
|
|
626
|
+
if (!r || !i) throw Oe();
|
|
627
|
+
let a = r();
|
|
628
|
+
return n.provides.set(i, a), a;
|
|
1266
629
|
},
|
|
1267
|
-
hook(
|
|
1268
|
-
|
|
1269
|
-
return app;
|
|
630
|
+
hook(e) {
|
|
631
|
+
return n.hooks.push(e), o;
|
|
1270
632
|
},
|
|
1271
|
-
directive(
|
|
1272
|
-
|
|
1273
|
-
if (isDev && !isDirective(definition)) console.warn(`[sigx] app.directive('${name}', ...) received a value that is not a valid directive definition. Use defineDirective() to create directive definitions.`);
|
|
1274
|
-
context.directives.set(name, definition);
|
|
1275
|
-
return app;
|
|
1276
|
-
}
|
|
1277
|
-
return context.directives.get(name);
|
|
633
|
+
directive(e, t) {
|
|
634
|
+
return t === void 0 ? n.directives.get(e) : (R && !Be(t) && console.warn(`[sigx] app.directive('${e}', ...) received a value that is not a valid directive definition. Use defineDirective() to create directive definitions.`), n.directives.set(e, t), o);
|
|
1278
635
|
},
|
|
1279
|
-
mount(
|
|
1280
|
-
if (
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
container = target;
|
|
1287
|
-
isMounted = true;
|
|
1288
|
-
const result = mountFn(rootComponent, target, context);
|
|
1289
|
-
if (typeof result === "function") unmountFn = result;
|
|
1290
|
-
return app;
|
|
636
|
+
mount(t, s) {
|
|
637
|
+
if (r) return R && console.warn("App is already mounted. Call app.unmount() first."), o;
|
|
638
|
+
let c = s ?? Ve;
|
|
639
|
+
if (!c) throw Ce();
|
|
640
|
+
i = t, r = !0;
|
|
641
|
+
let l = c(e, t, n);
|
|
642
|
+
return typeof l == "function" && (a = l), o;
|
|
1291
643
|
},
|
|
1292
644
|
unmount() {
|
|
1293
|
-
if (!
|
|
1294
|
-
|
|
645
|
+
if (!r) {
|
|
646
|
+
R && console.warn("App is not mounted.");
|
|
1295
647
|
return;
|
|
1296
648
|
}
|
|
1297
|
-
|
|
1298
|
-
context.provides.clear();
|
|
1299
|
-
isMounted = false;
|
|
1300
|
-
container = null;
|
|
649
|
+
a && a(), n.provides.clear(), r = !1, i = null;
|
|
1301
650
|
},
|
|
1302
651
|
get _context() {
|
|
1303
|
-
return
|
|
652
|
+
return n;
|
|
1304
653
|
},
|
|
1305
654
|
get _isMounted() {
|
|
1306
|
-
return
|
|
655
|
+
return r;
|
|
1307
656
|
},
|
|
1308
657
|
get _container() {
|
|
1309
|
-
return
|
|
658
|
+
return i;
|
|
1310
659
|
},
|
|
1311
660
|
get _rootComponent() {
|
|
1312
|
-
return
|
|
661
|
+
return e;
|
|
1313
662
|
}
|
|
1314
663
|
};
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
function notifyComponentCreated(context, instance) {
|
|
1325
|
-
if (!context) return;
|
|
1326
|
-
for (const hooks of context.hooks) try {
|
|
1327
|
-
hooks.onComponentCreated?.(instance);
|
|
1328
|
-
} catch (err) {
|
|
1329
|
-
handleHookError(context, err, instance, "onComponentCreated");
|
|
664
|
+
n.app = o;
|
|
665
|
+
let s = Ie();
|
|
666
|
+
return n.provides.set(s, n), o;
|
|
667
|
+
}
|
|
668
|
+
function We(e, t) {
|
|
669
|
+
if (e) for (let n of e.hooks) try {
|
|
670
|
+
n.onComponentCreated?.(t);
|
|
671
|
+
} catch (n) {
|
|
672
|
+
Ye(e, n, t, "onComponentCreated");
|
|
1330
673
|
}
|
|
1331
674
|
}
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
if (!context) return;
|
|
1338
|
-
for (const hooks of context.hooks) try {
|
|
1339
|
-
hooks.onComponentMounted?.(instance);
|
|
1340
|
-
} catch (err) {
|
|
1341
|
-
handleHookError(context, err, instance, "onComponentMounted");
|
|
675
|
+
function Ge(e, t) {
|
|
676
|
+
if (e) for (let n of e.hooks) try {
|
|
677
|
+
n.onComponentMounted?.(t);
|
|
678
|
+
} catch (n) {
|
|
679
|
+
Ye(e, n, t, "onComponentMounted");
|
|
1342
680
|
}
|
|
1343
681
|
}
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
if (!context) return;
|
|
1350
|
-
for (const hooks of context.hooks) try {
|
|
1351
|
-
hooks.onComponentUnmounted?.(instance);
|
|
1352
|
-
} catch (err) {
|
|
1353
|
-
handleHookError(context, err, instance, "onComponentUnmounted");
|
|
682
|
+
function Ke(e, t) {
|
|
683
|
+
if (e) for (let n of e.hooks) try {
|
|
684
|
+
n.onComponentUnmounted?.(t);
|
|
685
|
+
} catch (n) {
|
|
686
|
+
Ye(e, n, t, "onComponentUnmounted");
|
|
1354
687
|
}
|
|
1355
688
|
}
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
if (!context) return;
|
|
1362
|
-
for (const hooks of context.hooks) try {
|
|
1363
|
-
hooks.onComponentUpdated?.(instance);
|
|
1364
|
-
} catch (err) {
|
|
1365
|
-
handleHookError(context, err, instance, "onComponentUpdated");
|
|
689
|
+
function qe(e, t) {
|
|
690
|
+
if (e) for (let n of e.hooks) try {
|
|
691
|
+
n.onComponentUpdated?.(t);
|
|
692
|
+
} catch (n) {
|
|
693
|
+
Ye(e, n, t, "onComponentUpdated");
|
|
1366
694
|
}
|
|
1367
695
|
}
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
for (const hooks of context.hooks) try {
|
|
1375
|
-
if (hooks.onComponentError?.(err, instance, info) === true) return true;
|
|
1376
|
-
} catch (hookErr) {
|
|
1377
|
-
console.error("Error in onComponentError hook:", hookErr);
|
|
696
|
+
function Je(e, t, n, r) {
|
|
697
|
+
if (!e) return !1;
|
|
698
|
+
for (let i of e.hooks) try {
|
|
699
|
+
if (i.onComponentError?.(t, n, r) === !0) return !0;
|
|
700
|
+
} catch (e) {
|
|
701
|
+
console.error("Error in onComponentError hook:", e);
|
|
1378
702
|
}
|
|
1379
|
-
if (
|
|
1380
|
-
if (
|
|
1381
|
-
} catch (
|
|
1382
|
-
console.error("Error in app.config.errorHandler:",
|
|
703
|
+
if (e.config.errorHandler) try {
|
|
704
|
+
if (e.config.errorHandler(t, n, r) === !0) return !0;
|
|
705
|
+
} catch (e) {
|
|
706
|
+
console.error("Error in app.config.errorHandler:", e);
|
|
1383
707
|
}
|
|
1384
|
-
return
|
|
1385
|
-
}
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
function handleHookError(context, err, instance, hookName) {
|
|
1390
|
-
console.error(`Error in ${hookName} hook:`, err);
|
|
1391
|
-
if (context.config.errorHandler) try {
|
|
1392
|
-
context.config.errorHandler(err, instance, `plugin hook: ${hookName}`);
|
|
708
|
+
return !1;
|
|
709
|
+
}
|
|
710
|
+
function Ye(e, t, n, r) {
|
|
711
|
+
if (console.error(`Error in ${r} hook:`, t), e.config.errorHandler) try {
|
|
712
|
+
e.config.errorHandler(t, n, `plugin hook: ${r}`);
|
|
1393
713
|
} catch {}
|
|
1394
714
|
}
|
|
1395
715
|
//#endregion
|
|
1396
716
|
//#region ../runtime-core/src/compound.ts
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
*
|
|
1400
|
-
* This enables the pattern of `Parent.Child` components (e.g., `Menu.Item`, `Card.Body`)
|
|
1401
|
-
* while preserving full TypeScript type inference for both the parent and children.
|
|
1402
|
-
*
|
|
1403
|
-
* @param main - The main/parent component factory
|
|
1404
|
-
* @param sub - An object containing sub-components to attach
|
|
1405
|
-
* @returns The main component with sub-components attached as static properties
|
|
1406
|
-
*
|
|
1407
|
-
* @example
|
|
1408
|
-
* ```tsx
|
|
1409
|
-
* // Define individual components
|
|
1410
|
-
* const _Menu = component<MenuProps>(ctx => { ... });
|
|
1411
|
-
* const _MenuItem = component<MenuItemProps>(ctx => { ... });
|
|
1412
|
-
* const _MenuTitle = component<MenuTitleProps>(ctx => { ... });
|
|
1413
|
-
*
|
|
1414
|
-
* // Create compound component
|
|
1415
|
-
* export const Menu = compound(_Menu, {
|
|
1416
|
-
* Item: _MenuItem,
|
|
1417
|
-
* Title: _MenuTitle,
|
|
1418
|
-
* });
|
|
1419
|
-
*
|
|
1420
|
-
* // Usage in JSX
|
|
1421
|
-
* <Menu>
|
|
1422
|
-
* <Menu.Title>Navigation</Menu.Title>
|
|
1423
|
-
* <Menu.Item value="home">Home</Menu.Item>
|
|
1424
|
-
* <Menu.Item value="about">About</Menu.Item>
|
|
1425
|
-
* </Menu>
|
|
1426
|
-
* ```
|
|
1427
|
-
*/
|
|
1428
|
-
function compound(main, sub) {
|
|
1429
|
-
return Object.assign(main, sub);
|
|
717
|
+
function Xe(e, t) {
|
|
718
|
+
return Object.assign(e, t);
|
|
1430
719
|
}
|
|
1431
720
|
//#endregion
|
|
1432
721
|
//#region ../runtime-core/src/model.ts
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
* Provides a single interface for reading, writing, and forwarding model bindings.
|
|
1437
|
-
*
|
|
1438
|
-
* @example
|
|
1439
|
-
* ```tsx
|
|
1440
|
-
* const Input = component<InputProps>(({ props }) => {
|
|
1441
|
-
* // Read
|
|
1442
|
-
* console.log(props.model.value);
|
|
1443
|
-
*
|
|
1444
|
-
* // Write
|
|
1445
|
-
* props.model.value = "new value";
|
|
1446
|
-
*
|
|
1447
|
-
* // Forward to child
|
|
1448
|
-
* <Child model={props.model} />
|
|
1449
|
-
*
|
|
1450
|
-
* // Forward via context
|
|
1451
|
-
* defineProvide(inputContext, () => props.model);
|
|
1452
|
-
* });
|
|
1453
|
-
* ```
|
|
1454
|
-
*/
|
|
1455
|
-
/** Symbol to identify Model objects */
|
|
1456
|
-
var MODEL_SYMBOL = Symbol.for("sigx.model");
|
|
1457
|
-
/**
|
|
1458
|
-
* Creates a Model<T> from a binding tuple and update handler.
|
|
1459
|
-
*
|
|
1460
|
-
* @param tuple - The [sourceObject, key] tuple from reactivity detection
|
|
1461
|
-
* @param updateHandler - Function called when value is set (enables parent interception)
|
|
1462
|
-
* @returns A Model<T> with .value getter/setter and .binding for forwarding
|
|
1463
|
-
*/
|
|
1464
|
-
function createModel(tuple, updateHandler) {
|
|
1465
|
-
const [obj, key] = tuple;
|
|
722
|
+
var Ze = Symbol.for("sigx.model");
|
|
723
|
+
function Qe(e, t) {
|
|
724
|
+
let [n, r] = e;
|
|
1466
725
|
return {
|
|
1467
726
|
get value() {
|
|
1468
|
-
return
|
|
727
|
+
return n[r];
|
|
1469
728
|
},
|
|
1470
|
-
set value(
|
|
1471
|
-
|
|
729
|
+
set value(e) {
|
|
730
|
+
t(e);
|
|
1472
731
|
},
|
|
1473
732
|
get binding() {
|
|
1474
733
|
return [
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
734
|
+
n,
|
|
735
|
+
r,
|
|
736
|
+
t
|
|
1478
737
|
];
|
|
1479
738
|
},
|
|
1480
|
-
[
|
|
739
|
+
[Ze]: !0
|
|
1481
740
|
};
|
|
1482
741
|
}
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
function createModelFromBinding(binding) {
|
|
1490
|
-
const [obj, key, handler] = binding;
|
|
1491
|
-
return createModel([obj, key], handler);
|
|
1492
|
-
}
|
|
1493
|
-
/**
|
|
1494
|
-
* Type guard to check if a value is a Model<T>.
|
|
1495
|
-
*
|
|
1496
|
-
* Used by JSX runtime to detect forwarded models and extract their bindings.
|
|
1497
|
-
*/
|
|
1498
|
-
function isModel(value) {
|
|
1499
|
-
return value !== null && typeof value === "object" && MODEL_SYMBOL in value && value[MODEL_SYMBOL] === true;
|
|
742
|
+
function $e(e) {
|
|
743
|
+
let [t, n, r] = e;
|
|
744
|
+
return Qe([t, n], r);
|
|
745
|
+
}
|
|
746
|
+
function z(e) {
|
|
747
|
+
return typeof e == "object" && !!e && Ze in e && e[Ze] === !0;
|
|
1500
748
|
}
|
|
1501
749
|
//#endregion
|
|
1502
750
|
//#region ../runtime-core/src/platform.ts
|
|
1503
|
-
var
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
*/
|
|
1507
|
-
function getPlatformModelProcessor() {
|
|
1508
|
-
return platformModelProcessor;
|
|
751
|
+
var et = null;
|
|
752
|
+
function tt() {
|
|
753
|
+
return et;
|
|
1509
754
|
}
|
|
1510
755
|
//#endregion
|
|
1511
756
|
//#region ../runtime-core/src/utils/is-component.ts
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
*
|
|
1515
|
-
* SignalX components are created with component() and have a __setup
|
|
1516
|
-
* property containing the setup function.
|
|
1517
|
-
*
|
|
1518
|
-
* @example
|
|
1519
|
-
* ```ts
|
|
1520
|
-
* const MyComponent = component((ctx) => () => <div/>);
|
|
1521
|
-
* isComponent(MyComponent); // true
|
|
1522
|
-
* isComponent(() => <div/>); // false (plain function component)
|
|
1523
|
-
* isComponent('div'); // false
|
|
1524
|
-
* ```
|
|
1525
|
-
*/
|
|
1526
|
-
function isComponent(type) {
|
|
1527
|
-
return typeof type === "function" && "__setup" in type;
|
|
757
|
+
function B(e) {
|
|
758
|
+
return typeof e == "function" && "__setup" in e;
|
|
1528
759
|
}
|
|
1529
760
|
//#endregion
|
|
1530
761
|
//#region ../runtime-core/src/jsx-runtime.ts
|
|
1531
|
-
var
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
762
|
+
var V = Symbol.for("sigx.Fragment"), H = Symbol.for("sigx.Text"), U = Symbol.for("sigx.Comment"), nt = {}, rt = [];
|
|
763
|
+
function it() {
|
|
764
|
+
return {
|
|
765
|
+
type: U,
|
|
766
|
+
props: nt,
|
|
767
|
+
key: null,
|
|
768
|
+
children: rt,
|
|
769
|
+
dom: null
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
function at(e) {
|
|
773
|
+
return {
|
|
774
|
+
type: H,
|
|
775
|
+
props: nt,
|
|
776
|
+
key: null,
|
|
777
|
+
children: rt,
|
|
778
|
+
dom: null,
|
|
779
|
+
text: e
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
function W(e) {
|
|
783
|
+
return e == null || e === !1 || e === !0 ? [] : j(e) ? W(e.value) : typeof e == "string" || typeof e == "number" ? [at(e)] : e.type ? [e] : Array.isArray(e) ? e.map(ot) : [];
|
|
784
|
+
}
|
|
785
|
+
function ot(e) {
|
|
786
|
+
if (e == null || e === !1 || e === !0) return it();
|
|
787
|
+
if (typeof e == "string" || typeof e == "number") return at(e);
|
|
788
|
+
if (j(e)) return W(e.value)[0] ?? it();
|
|
789
|
+
if (Array.isArray(e)) {
|
|
790
|
+
let t = W(e);
|
|
791
|
+
return t.length === 0 ? it() : t.length === 1 ? t[0] : {
|
|
792
|
+
type: V,
|
|
793
|
+
props: nt,
|
|
1548
794
|
key: null,
|
|
1549
|
-
children:
|
|
795
|
+
children: t,
|
|
1550
796
|
dom: null
|
|
1551
797
|
};
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
children: [],
|
|
1567
|
-
dom: null
|
|
1568
|
-
};
|
|
1569
|
-
if (nested.length === 1) return nested[0];
|
|
798
|
+
}
|
|
799
|
+
return e.type ? e : it();
|
|
800
|
+
}
|
|
801
|
+
function G(e, t, n) {
|
|
802
|
+
let r = B(e), i = !1;
|
|
803
|
+
if (t) {
|
|
804
|
+
for (let e in t) if (e === "model" || e.startsWith("model:")) {
|
|
805
|
+
i = !0;
|
|
806
|
+
break;
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
if (!i) {
|
|
810
|
+
if (r) {
|
|
811
|
+
let { children: r, ...i } = t || {};
|
|
1570
812
|
return {
|
|
1571
|
-
type:
|
|
1572
|
-
props: {
|
|
1573
|
-
|
|
1574
|
-
|
|
813
|
+
type: e,
|
|
814
|
+
props: {
|
|
815
|
+
...i,
|
|
816
|
+
children: r
|
|
817
|
+
},
|
|
818
|
+
key: n || i.key || null,
|
|
819
|
+
children: rt,
|
|
1575
820
|
dom: null
|
|
1576
821
|
};
|
|
1577
822
|
}
|
|
1578
|
-
if (
|
|
823
|
+
if (typeof e == "function" && e !== V) return e(t);
|
|
824
|
+
let { children: i, ...a } = t || {};
|
|
1579
825
|
return {
|
|
1580
|
-
type:
|
|
1581
|
-
props:
|
|
1582
|
-
key: null,
|
|
1583
|
-
children:
|
|
826
|
+
type: e,
|
|
827
|
+
props: a,
|
|
828
|
+
key: n || a.key || null,
|
|
829
|
+
children: W(i),
|
|
1584
830
|
dom: null
|
|
1585
831
|
};
|
|
1586
|
-
}
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
}
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
if (props) {
|
|
1606
|
-
for (const propKey in props) if (propKey === "model") {
|
|
1607
|
-
let modelBinding = props[propKey];
|
|
1608
|
-
let tuple = null;
|
|
1609
|
-
let updateHandler = null;
|
|
1610
|
-
if (isModel(modelBinding)) {
|
|
1611
|
-
const [obj, key, handler] = modelBinding.binding;
|
|
1612
|
-
tuple = [obj, key];
|
|
1613
|
-
updateHandler = handler;
|
|
1614
|
-
} else if (typeof modelBinding === "function") {
|
|
1615
|
-
const detected = detectAccess(modelBinding);
|
|
1616
|
-
if (detected && typeof detected[1] === "string") tuple = detected;
|
|
1617
|
-
} else if (Array.isArray(modelBinding) && modelBinding.length === 2 && typeof modelBinding[1] === "string") tuple = modelBinding;
|
|
1618
|
-
if (tuple) {
|
|
1619
|
-
const [stateObj, stateKey] = tuple;
|
|
1620
|
-
let handled = false;
|
|
1621
|
-
if (!updateHandler) {
|
|
1622
|
-
const existingHandler = processedProps["onUpdate:modelValue"];
|
|
1623
|
-
updateHandler = (v) => {
|
|
1624
|
-
const customHandler = stateObj[`onUpdate:${stateKey}`];
|
|
1625
|
-
if (typeof customHandler === "function") customHandler(v);
|
|
1626
|
-
else stateObj[stateKey] = v;
|
|
1627
|
-
if (existingHandler) existingHandler(v);
|
|
832
|
+
}
|
|
833
|
+
let a = { ...t }, o = {};
|
|
834
|
+
if (t) {
|
|
835
|
+
for (let n in t) if (n === "model") {
|
|
836
|
+
let i = t[n], s = null, c = null;
|
|
837
|
+
if (z(i)) {
|
|
838
|
+
let [e, t, n] = i.binding;
|
|
839
|
+
s = [e, t], c = n;
|
|
840
|
+
} else if (typeof i == "function") {
|
|
841
|
+
let e = D(i);
|
|
842
|
+
e && typeof e[1] == "string" && (s = e);
|
|
843
|
+
} else Array.isArray(i) && i.length === 2 && typeof i[1] == "string" && (s = i);
|
|
844
|
+
if (s) {
|
|
845
|
+
let [n, i] = s, l = !1;
|
|
846
|
+
if (!c) {
|
|
847
|
+
let e = a["onUpdate:modelValue"];
|
|
848
|
+
c = (t) => {
|
|
849
|
+
let r = n[`onUpdate:${i}`];
|
|
850
|
+
typeof r == "function" ? r(t) : n[i] = t, e && e(t);
|
|
1628
851
|
};
|
|
1629
852
|
}
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
if (isComponentType) {
|
|
1633
|
-
models.model = createModel(tuple, updateHandler);
|
|
1634
|
-
processedProps["onUpdate:modelValue"] = updateHandler;
|
|
1635
|
-
} else if (!handled) {
|
|
1636
|
-
processedProps.modelValue = stateObj[stateKey];
|
|
1637
|
-
processedProps["onUpdate:modelValue"] = updateHandler;
|
|
1638
|
-
}
|
|
1639
|
-
delete processedProps.model;
|
|
853
|
+
let u = tt();
|
|
854
|
+
typeof e == "string" && u && (l = u(e, a, s, t)), r ? (o.model = Qe(s, c), a["onUpdate:modelValue"] = c) : l || (a.modelValue = n[i], a["onUpdate:modelValue"] = c), delete a.model;
|
|
1640
855
|
}
|
|
1641
|
-
} else if (
|
|
1642
|
-
let
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
if (
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
if (
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
if (!updateHandler) {
|
|
1658
|
-
const existingHandler = processedProps[eventName];
|
|
1659
|
-
updateHandler = (v) => {
|
|
1660
|
-
const customHandler = stateObj[`onUpdate:${stateKey}`];
|
|
1661
|
-
if (typeof customHandler === "function") customHandler(v);
|
|
1662
|
-
else stateObj[stateKey] = v;
|
|
1663
|
-
if (existingHandler) existingHandler(v);
|
|
856
|
+
} else if (n.startsWith("model:")) {
|
|
857
|
+
let e = t[n], i = n.slice(6), s = null, c = null;
|
|
858
|
+
if (z(e)) {
|
|
859
|
+
let [t, n, r] = e.binding;
|
|
860
|
+
s = [t, n], c = r;
|
|
861
|
+
} else if (typeof e == "function") {
|
|
862
|
+
let t = D(e);
|
|
863
|
+
t && typeof t[1] == "string" && (s = t);
|
|
864
|
+
} else Array.isArray(e) && e.length === 2 && typeof e[1] == "string" && (s = e);
|
|
865
|
+
if (s) {
|
|
866
|
+
let [e, t] = s, l = `onUpdate:${i}`;
|
|
867
|
+
if (!c) {
|
|
868
|
+
let n = a[l];
|
|
869
|
+
c = (r) => {
|
|
870
|
+
let i = e[`onUpdate:${t}`];
|
|
871
|
+
typeof i == "function" ? i(r) : e[t] = r, n && n(r);
|
|
1664
872
|
};
|
|
1665
873
|
}
|
|
1666
|
-
|
|
1667
|
-
models[name] = createModel(tuple, updateHandler);
|
|
1668
|
-
processedProps[eventName] = updateHandler;
|
|
1669
|
-
} else {
|
|
1670
|
-
processedProps[name] = stateObj[stateKey];
|
|
1671
|
-
processedProps[eventName] = updateHandler;
|
|
1672
|
-
}
|
|
1673
|
-
delete processedProps[propKey];
|
|
874
|
+
r ? (o[i] = Qe(s, c), a[l] = c) : (a[i] = e[t], a[l] = c), delete a[n];
|
|
1674
875
|
}
|
|
1675
876
|
}
|
|
1676
877
|
}
|
|
1677
|
-
if (Object.keys(
|
|
1678
|
-
|
|
1679
|
-
const { children, ...rest } = processedProps;
|
|
878
|
+
if (Object.keys(o).length > 0 && (a.$models = o), B(e)) {
|
|
879
|
+
let { children: t, ...r } = a;
|
|
1680
880
|
return {
|
|
1681
|
-
type,
|
|
881
|
+
type: e,
|
|
1682
882
|
props: {
|
|
1683
|
-
...
|
|
1684
|
-
children
|
|
883
|
+
...r,
|
|
884
|
+
children: t
|
|
1685
885
|
},
|
|
1686
|
-
key:
|
|
886
|
+
key: n || r.key || null,
|
|
1687
887
|
children: [],
|
|
1688
888
|
dom: null
|
|
1689
889
|
};
|
|
1690
890
|
}
|
|
1691
|
-
if (typeof
|
|
1692
|
-
|
|
891
|
+
if (typeof e == "function" && e !== V) return e(a);
|
|
892
|
+
let { children: s, ...c } = a;
|
|
1693
893
|
return {
|
|
1694
|
-
type,
|
|
1695
|
-
props:
|
|
1696
|
-
key:
|
|
1697
|
-
children:
|
|
894
|
+
type: e,
|
|
895
|
+
props: c,
|
|
896
|
+
key: n || c.key || null,
|
|
897
|
+
children: W(s),
|
|
1698
898
|
dom: null
|
|
1699
899
|
};
|
|
1700
900
|
}
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
*/
|
|
1704
|
-
function jsxs(type, props, key) {
|
|
1705
|
-
return jsx(type, props, key);
|
|
901
|
+
function K(e, t, n) {
|
|
902
|
+
return G(e, t, n);
|
|
1706
903
|
}
|
|
1707
|
-
var
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
* Register a promise with the current Suspense boundary
|
|
1719
|
-
* @internal
|
|
1720
|
-
*/
|
|
1721
|
-
function registerPendingPromise(promise) {
|
|
1722
|
-
const boundary = getCurrentSuspenseBoundarySafe() ?? currentSuspenseBoundary;
|
|
1723
|
-
if (boundary) {
|
|
1724
|
-
boundary.pending.add(promise);
|
|
1725
|
-
promise.finally(() => {
|
|
1726
|
-
boundary.pending.delete(promise);
|
|
1727
|
-
if (boundary.pending.size === 0) boundary.onResolve();
|
|
1728
|
-
});
|
|
1729
|
-
return true;
|
|
1730
|
-
}
|
|
1731
|
-
return false;
|
|
1732
|
-
}
|
|
1733
|
-
/**
|
|
1734
|
-
* Create a lazy-loaded component wrapper.
|
|
1735
|
-
*
|
|
1736
|
-
* The component will be loaded on first render. Use with `<Suspense>` to show
|
|
1737
|
-
* a fallback while loading.
|
|
1738
|
-
*
|
|
1739
|
-
* @param loader - Function that returns a Promise resolving to the component
|
|
1740
|
-
* @returns A component factory that loads the real component on demand
|
|
1741
|
-
*
|
|
1742
|
-
* @example
|
|
1743
|
-
* ```tsx
|
|
1744
|
-
* import { lazy, Suspense } from 'sigx';
|
|
1745
|
-
*
|
|
1746
|
-
* // Component will be in a separate chunk
|
|
1747
|
-
* const HeavyChart = lazy(() => import('./components/HeavyChart'));
|
|
1748
|
-
*
|
|
1749
|
-
* // Usage
|
|
1750
|
-
* <Suspense fallback={<Spinner />}>
|
|
1751
|
-
* <HeavyChart data={chartData} />
|
|
1752
|
-
* </Suspense>
|
|
1753
|
-
*
|
|
1754
|
-
* // Preload on hover
|
|
1755
|
-
* <button onMouseEnter={() => HeavyChart.preload()}>
|
|
1756
|
-
* Show Chart
|
|
1757
|
-
* </button>
|
|
1758
|
-
* ```
|
|
1759
|
-
*/
|
|
1760
|
-
function lazy(loader) {
|
|
1761
|
-
let Component = null;
|
|
1762
|
-
let promise = null;
|
|
1763
|
-
let error = null;
|
|
1764
|
-
let state = "pending";
|
|
1765
|
-
const LazyWrapper = component((ctx) => {
|
|
1766
|
-
const loadState = ctx.signal({
|
|
1767
|
-
state,
|
|
904
|
+
var st = G, ct = null;
|
|
905
|
+
function lt(e) {
|
|
906
|
+
let t = he() ?? ct;
|
|
907
|
+
return t ? (t.pending.add(e), e.finally(() => {
|
|
908
|
+
t.pending.delete(e), t.pending.size === 0 && t.onResolve();
|
|
909
|
+
}), !0) : !1;
|
|
910
|
+
}
|
|
911
|
+
function ut(e) {
|
|
912
|
+
let t = null, n = null, r = null, i = "pending", a = F((a) => {
|
|
913
|
+
let o = a.signal({
|
|
914
|
+
state: i,
|
|
1768
915
|
tick: 0
|
|
1769
916
|
});
|
|
1770
|
-
function
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
for (const key of Object.keys(slotsFromProps)) {
|
|
1779
|
-
namedSlots[key] = slotsFromProps[key];
|
|
1780
|
-
hasNamed = true;
|
|
1781
|
-
}
|
|
1782
|
-
if (hasNamed) fwdProps.slots = namedSlots;
|
|
917
|
+
function c(e) {
|
|
918
|
+
let t = { ...a.props }, n = a.slots.default();
|
|
919
|
+
n.length > 0 && (t.children = n);
|
|
920
|
+
let r = a.slots._slotsFromProps;
|
|
921
|
+
if (r) {
|
|
922
|
+
let e = {}, n = !1;
|
|
923
|
+
for (let t of Object.keys(r)) e[t] = r[t], n = !0;
|
|
924
|
+
n && (t.slots = e);
|
|
1783
925
|
}
|
|
1784
|
-
return
|
|
926
|
+
return G(e, t);
|
|
1785
927
|
}
|
|
1786
|
-
if (
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
batch(() => {
|
|
1790
|
-
loadState.state = "resolved";
|
|
1791
|
-
loadState.tick++;
|
|
1792
|
-
});
|
|
1793
|
-
return Component;
|
|
1794
|
-
}).catch((err) => {
|
|
1795
|
-
error = err instanceof Error ? err : new Error(String(err));
|
|
1796
|
-
state = "rejected";
|
|
1797
|
-
batch(() => {
|
|
1798
|
-
loadState.state = "rejected";
|
|
1799
|
-
loadState.tick++;
|
|
1800
|
-
});
|
|
1801
|
-
throw error;
|
|
1802
|
-
});
|
|
1803
|
-
else if (state === "pending") promise.then(() => {
|
|
1804
|
-
if (loadState.state === "pending") batch(() => {
|
|
1805
|
-
loadState.state = "resolved";
|
|
1806
|
-
loadState.tick++;
|
|
928
|
+
if (n ? i === "pending" && n.then(() => {
|
|
929
|
+
o.state === "pending" && s(() => {
|
|
930
|
+
o.state = "resolved", o.tick++;
|
|
1807
931
|
});
|
|
1808
932
|
}).catch(() => {
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
loadState.tick++;
|
|
933
|
+
o.state === "pending" && s(() => {
|
|
934
|
+
o.state = "rejected", o.tick++;
|
|
1812
935
|
});
|
|
1813
|
-
})
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
936
|
+
}) : n = e().then((e) => (t = "default" in e ? e.default : e, i = "resolved", s(() => {
|
|
937
|
+
o.state = "resolved", o.tick++;
|
|
938
|
+
}), t)).catch((e) => {
|
|
939
|
+
throw r = e instanceof Error ? e : Error(String(e)), i = "rejected", s(() => {
|
|
940
|
+
o.state = "rejected", o.tick++;
|
|
941
|
+
}), r;
|
|
942
|
+
}), i === "resolved" && t) return () => c(t);
|
|
943
|
+
if (i === "rejected" && r) throw r;
|
|
944
|
+
return lt(n) || n.catch(() => {}), () => {
|
|
945
|
+
let e = o.state;
|
|
946
|
+
if (o.tick, e === "resolved" && t) return c(t);
|
|
947
|
+
if (e === "rejected" && r) throw r;
|
|
1822
948
|
return null;
|
|
1823
949
|
};
|
|
1824
950
|
}, { name: "LazyComponent" });
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
error = err instanceof Error ? err : new Error(String(err));
|
|
1833
|
-
state = "rejected";
|
|
1834
|
-
throw error;
|
|
1835
|
-
});
|
|
1836
|
-
return promise;
|
|
1837
|
-
};
|
|
1838
|
-
LazyWrapper.isLoaded = () => {
|
|
1839
|
-
return state === "resolved";
|
|
1840
|
-
};
|
|
1841
|
-
return LazyWrapper;
|
|
1842
|
-
}
|
|
1843
|
-
/**
|
|
1844
|
-
* Suspense boundary component for handling async loading states.
|
|
1845
|
-
*
|
|
1846
|
-
* Wraps lazy-loaded components and shows a fallback while they load.
|
|
1847
|
-
*
|
|
1848
|
-
* @example
|
|
1849
|
-
* ```tsx
|
|
1850
|
-
* import { lazy, Suspense } from 'sigx';
|
|
1851
|
-
*
|
|
1852
|
-
* const LazyDashboard = lazy(() => import('./Dashboard'));
|
|
1853
|
-
*
|
|
1854
|
-
* // Basic usage
|
|
1855
|
-
* <Suspense fallback={<div>Loading...</div>}>
|
|
1856
|
-
* <LazyDashboard />
|
|
1857
|
-
* </Suspense>
|
|
1858
|
-
*
|
|
1859
|
-
* // With spinner component
|
|
1860
|
-
* <Suspense fallback={<Spinner size="large" />}>
|
|
1861
|
-
* <LazyDashboard />
|
|
1862
|
-
* <LazyCharts />
|
|
1863
|
-
* </Suspense>
|
|
1864
|
-
* ```
|
|
1865
|
-
*/
|
|
1866
|
-
var Suspense = component((ctx) => {
|
|
1867
|
-
const { props, slots } = ctx;
|
|
1868
|
-
const state = ctx.signal({
|
|
1869
|
-
isReady: false,
|
|
951
|
+
return a.__lazy = !0, a.preload = () => (n ||= e().then((e) => (t = "default" in e ? e.default : e, i = "resolved", t)).catch((e) => {
|
|
952
|
+
throw r = e instanceof Error ? e : Error(String(e)), i = "rejected", r;
|
|
953
|
+
}), n), a.isLoaded = () => i === "resolved", a;
|
|
954
|
+
}
|
|
955
|
+
var dt = F((e) => {
|
|
956
|
+
let { props: t, slots: n } = e, r = e.signal({
|
|
957
|
+
isReady: !1,
|
|
1870
958
|
pendingCount: 0
|
|
1871
|
-
})
|
|
1872
|
-
const boundary = {
|
|
959
|
+
}), i = {
|
|
1873
960
|
pending: /* @__PURE__ */ new Set(),
|
|
1874
961
|
onResolve: () => {
|
|
1875
|
-
|
|
1876
|
-
if (boundary.pending.size === 0) state.isReady = true;
|
|
962
|
+
r.pendingCount = i.pending.size, i.pending.size === 0 && (r.isReady = !0);
|
|
1877
963
|
}
|
|
1878
964
|
};
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
})
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
const prevBoundary = getCurrentSuspenseBoundarySafe() ?? currentSuspenseBoundary;
|
|
1886
|
-
currentSuspenseBoundary = boundary;
|
|
1887
|
-
setCurrentSuspenseBoundarySafe(boundary);
|
|
965
|
+
return e.onMounted(() => {
|
|
966
|
+
i.pending.size === 0 && (r.isReady = !0);
|
|
967
|
+
}), () => {
|
|
968
|
+
r.isReady, r.pendingCount;
|
|
969
|
+
let e = he() ?? ct;
|
|
970
|
+
ct = i, ge(i);
|
|
1888
971
|
try {
|
|
1889
|
-
|
|
1890
|
-
if (
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
return fallback ?? null;
|
|
972
|
+
let e = n.default();
|
|
973
|
+
if (i.pending.size > 0) {
|
|
974
|
+
let e = t.fallback;
|
|
975
|
+
return typeof e == "function" ? e() : e ?? null;
|
|
1894
976
|
}
|
|
1895
|
-
if (Array.isArray(
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
if (filtered.length === 1) return filtered[0];
|
|
1899
|
-
return filtered;
|
|
977
|
+
if (Array.isArray(e)) {
|
|
978
|
+
let t = e.filter((e) => e != null && e !== !1 && e !== !0);
|
|
979
|
+
return t.length === 0 ? null : t.length === 1 ? t[0] : t;
|
|
1900
980
|
}
|
|
1901
|
-
return
|
|
1902
|
-
} catch (
|
|
1903
|
-
if (
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
return fallback ?? null;
|
|
981
|
+
return e;
|
|
982
|
+
} catch (e) {
|
|
983
|
+
if (e instanceof Promise) {
|
|
984
|
+
lt(e);
|
|
985
|
+
let n = t.fallback;
|
|
986
|
+
return typeof n == "function" ? n() : n ?? null;
|
|
1908
987
|
}
|
|
1909
|
-
throw
|
|
988
|
+
throw e;
|
|
1910
989
|
} finally {
|
|
1911
|
-
|
|
1912
|
-
setCurrentSuspenseBoundarySafe(prevBoundary);
|
|
990
|
+
ct = e, ge(e);
|
|
1913
991
|
}
|
|
1914
992
|
};
|
|
1915
993
|
}, { name: "Suspense" });
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
*/
|
|
1919
|
-
function isLazyComponent(component) {
|
|
1920
|
-
return component && component.__lazy === true;
|
|
994
|
+
function ft(e) {
|
|
995
|
+
return e && e.__lazy === !0;
|
|
1921
996
|
}
|
|
1922
997
|
//#endregion
|
|
1923
998
|
//#region ../runtime-core/src/use-async.ts
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
*
|
|
1927
|
-
* Wraps an async loader in a reactive signal with loading/error states.
|
|
1928
|
-
* No renderer changes required — works with sigx's existing effect system.
|
|
1929
|
-
*
|
|
1930
|
-
* @example
|
|
1931
|
-
* ```tsx
|
|
1932
|
-
* import { component, useAsync } from 'sigx';
|
|
1933
|
-
*
|
|
1934
|
-
* const CodeEditor = component(({ signal: s }) => {
|
|
1935
|
-
* const libs = useAsync(async () => {
|
|
1936
|
-
* const { EditorView } = await import('@codemirror/view');
|
|
1937
|
-
* const { json } = await import('@codemirror/lang-json');
|
|
1938
|
-
* return { EditorView, json };
|
|
1939
|
-
* });
|
|
1940
|
-
*
|
|
1941
|
-
* return () => {
|
|
1942
|
-
* if (libs.loading) return <div class="skeleton" />;
|
|
1943
|
-
* if (libs.error) return <div class="error">{libs.error.message}</div>;
|
|
1944
|
-
* return <div ref={el => new libs.value!.EditorView({ parent: el })} />;
|
|
1945
|
-
* };
|
|
1946
|
-
* });
|
|
1947
|
-
* ```
|
|
1948
|
-
*/
|
|
1949
|
-
/**
|
|
1950
|
-
* Load an async resource inside a component's setup function.
|
|
1951
|
-
*
|
|
1952
|
-
* Returns a reactive object with `value`, `loading`, and `error` fields.
|
|
1953
|
-
* The component's render function re-runs automatically when the state changes.
|
|
1954
|
-
*
|
|
1955
|
-
* @param loader — async function that returns the resource
|
|
1956
|
-
* @returns reactive AsyncState
|
|
1957
|
-
*/
|
|
1958
|
-
function useAsync(loader) {
|
|
1959
|
-
const state = signal({
|
|
999
|
+
function pt(e) {
|
|
1000
|
+
let t = k({
|
|
1960
1001
|
value: null,
|
|
1961
|
-
loading:
|
|
1002
|
+
loading: !0,
|
|
1962
1003
|
error: null
|
|
1963
1004
|
});
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
state.loading = false;
|
|
1005
|
+
return e().then((e) => {
|
|
1006
|
+
s(() => {
|
|
1007
|
+
t.value = e, t.loading = !1;
|
|
1968
1008
|
});
|
|
1969
|
-
}).catch((
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
state.loading = false;
|
|
1009
|
+
}).catch((e) => {
|
|
1010
|
+
s(() => {
|
|
1011
|
+
t.error = e instanceof Error ? e : Error(String(e)), t.loading = !1;
|
|
1973
1012
|
});
|
|
1974
|
-
});
|
|
1975
|
-
return state;
|
|
1013
|
+
}), t;
|
|
1976
1014
|
}
|
|
1977
1015
|
//#endregion
|
|
1978
1016
|
//#region ../runtime-core/src/error-boundary.ts
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
* Catches errors thrown during child component rendering and displays
|
|
1983
|
-
* a fallback UI. Works during both SSR and client-side rendering.
|
|
1984
|
-
*
|
|
1985
|
-
* @example
|
|
1986
|
-
* ```tsx
|
|
1987
|
-
* import { ErrorBoundary } from 'sigx';
|
|
1988
|
-
*
|
|
1989
|
-
* <ErrorBoundary
|
|
1990
|
-
* fallback={(error, retry) => (
|
|
1991
|
-
* <div>
|
|
1992
|
-
* <p>Something went wrong: {error.message}</p>
|
|
1993
|
-
* <button onClick={retry}>Retry</button>
|
|
1994
|
-
* </div>
|
|
1995
|
-
* )}
|
|
1996
|
-
* >
|
|
1997
|
-
* <RiskyComponent />
|
|
1998
|
-
* </ErrorBoundary>
|
|
1999
|
-
* ```
|
|
2000
|
-
*/
|
|
2001
|
-
/**
|
|
2002
|
-
* ErrorBoundary component.
|
|
2003
|
-
*
|
|
2004
|
-
* Wraps children and catches errors thrown during rendering.
|
|
2005
|
-
* When an error occurs, displays the `fallback` UI.
|
|
2006
|
-
* Provides a `retry` function to reset and re-render children.
|
|
2007
|
-
*/
|
|
2008
|
-
var ErrorBoundary = component((ctx) => {
|
|
2009
|
-
const { fallback } = ctx.props;
|
|
2010
|
-
const { slots } = ctx;
|
|
2011
|
-
const state = ctx.signal({
|
|
2012
|
-
hasError: false,
|
|
1017
|
+
var mt = F((e) => {
|
|
1018
|
+
let { fallback: t } = e.props, { slots: n } = e, r = e.signal({
|
|
1019
|
+
hasError: !1,
|
|
2013
1020
|
error: null
|
|
2014
|
-
})
|
|
2015
|
-
|
|
2016
|
-
state.hasError = false;
|
|
2017
|
-
state.error = null;
|
|
1021
|
+
}), i = () => {
|
|
1022
|
+
r.hasError = !1, r.error = null;
|
|
2018
1023
|
};
|
|
2019
1024
|
return () => {
|
|
2020
|
-
if (
|
|
2021
|
-
if (typeof fallback === "function") return fallback(state.error, retry);
|
|
2022
|
-
return fallback ?? null;
|
|
2023
|
-
}
|
|
1025
|
+
if (r.hasError && r.error) return typeof t == "function" ? t(r.error, i) : t ?? null;
|
|
2024
1026
|
try {
|
|
2025
|
-
return
|
|
1027
|
+
return n.default();
|
|
2026
1028
|
} catch (e) {
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
state.error = error;
|
|
2030
|
-
if (process.env.NODE_ENV !== "production") console.error("[ErrorBoundary] Caught error during render:", error);
|
|
2031
|
-
if (typeof fallback === "function") return fallback(error, retry);
|
|
2032
|
-
return fallback ?? null;
|
|
1029
|
+
let n = e instanceof Error ? e : Error(String(e));
|
|
1030
|
+
return r.hasError = !0, r.error = n, process.env.NODE_ENV !== "production" && console.error("[ErrorBoundary] Caught error during render:", n), typeof t == "function" ? t(n, i) : t ?? null;
|
|
2033
1031
|
}
|
|
2034
1032
|
};
|
|
2035
|
-
}, { name: "ErrorBoundary" })
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
var Utils = class {
|
|
2039
|
-
static isPromise(value) {
|
|
2040
|
-
return !!value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
|
|
1033
|
+
}, { name: "ErrorBoundary" }), ht = class {
|
|
1034
|
+
static isPromise(e) {
|
|
1035
|
+
return !!e && (typeof e == "object" || typeof e == "function") && typeof e.then == "function";
|
|
2041
1036
|
}
|
|
2042
1037
|
};
|
|
2043
|
-
function
|
|
2044
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(
|
|
2045
|
-
var
|
|
2046
|
-
return (
|
|
1038
|
+
function gt() {
|
|
1039
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
|
|
1040
|
+
var t = Math.random() * 16 | 0;
|
|
1041
|
+
return (e == "x" ? t : t & 3 | 8).toString(16);
|
|
2047
1042
|
});
|
|
2048
1043
|
}
|
|
2049
1044
|
//#endregion
|
|
2050
1045
|
//#region ../runtime-core/src/models/index.ts
|
|
2051
|
-
var
|
|
2052
|
-
|
|
2053
|
-
InstanceLifetimes[InstanceLifetimes["Transient"] = 0] = "Transient";
|
|
2054
|
-
InstanceLifetimes[InstanceLifetimes["Scoped"] = 1] = "Scoped";
|
|
2055
|
-
InstanceLifetimes[InstanceLifetimes["Singleton"] = 2] = "Singleton";
|
|
2056
|
-
return InstanceLifetimes;
|
|
1046
|
+
var _t = gt, vt = /* @__PURE__ */ function(e) {
|
|
1047
|
+
return e[e.Transient = 0] = "Transient", e[e.Scoped = 1] = "Scoped", e[e.Singleton = 2] = "Singleton", e;
|
|
2057
1048
|
}({});
|
|
2058
1049
|
//#endregion
|
|
2059
1050
|
//#region ../runtime-core/src/messaging/index.ts
|
|
2060
|
-
function
|
|
2061
|
-
let
|
|
2062
|
-
const publish = (data) => {
|
|
2063
|
-
subscribers.forEach((s) => s(data));
|
|
2064
|
-
};
|
|
2065
|
-
const subscribe = (handler) => {
|
|
2066
|
-
subscribers.push(handler);
|
|
2067
|
-
const unsubscribe = () => {
|
|
2068
|
-
const idx = subscribers.indexOf(handler);
|
|
2069
|
-
if (idx > -1) subscribers.splice(idx, 1);
|
|
2070
|
-
};
|
|
2071
|
-
try {
|
|
2072
|
-
onUnmounted(unsubscribe);
|
|
2073
|
-
} catch {}
|
|
2074
|
-
return { unsubscribe };
|
|
2075
|
-
};
|
|
2076
|
-
const destroy = () => {
|
|
2077
|
-
subscribers = [];
|
|
2078
|
-
};
|
|
1051
|
+
function yt(e) {
|
|
1052
|
+
let t = [];
|
|
2079
1053
|
return {
|
|
2080
|
-
publish
|
|
2081
|
-
|
|
2082
|
-
|
|
1054
|
+
publish: (e) => {
|
|
1055
|
+
t.forEach((t) => t(e));
|
|
1056
|
+
},
|
|
1057
|
+
subscribe: (e) => {
|
|
1058
|
+
t.push(e);
|
|
1059
|
+
let n = () => {
|
|
1060
|
+
let n = t.indexOf(e);
|
|
1061
|
+
n > -1 && t.splice(n, 1);
|
|
1062
|
+
};
|
|
1063
|
+
try {
|
|
1064
|
+
P(n);
|
|
1065
|
+
} catch {}
|
|
1066
|
+
return { unsubscribe: n };
|
|
1067
|
+
},
|
|
1068
|
+
destroy: () => {
|
|
1069
|
+
t = [];
|
|
1070
|
+
}
|
|
2083
1071
|
};
|
|
2084
1072
|
}
|
|
2085
|
-
function
|
|
2086
|
-
return { subscribe: (
|
|
1073
|
+
function bt(e) {
|
|
1074
|
+
return { subscribe: (t) => e.subscribe(t) };
|
|
2087
1075
|
}
|
|
2088
1076
|
//#endregion
|
|
2089
1077
|
//#region ../runtime-core/src/di/factory.ts
|
|
2090
|
-
var
|
|
1078
|
+
var xt = class {
|
|
2091
1079
|
constructor() {
|
|
2092
1080
|
this.unsubs = [];
|
|
2093
1081
|
}
|
|
2094
|
-
add(
|
|
2095
|
-
this.unsubs.push(
|
|
1082
|
+
add(e) {
|
|
1083
|
+
this.unsubs.push(e);
|
|
2096
1084
|
}
|
|
2097
1085
|
unsubscribe() {
|
|
2098
|
-
this.unsubs.forEach((
|
|
2099
|
-
this.unsubs = [];
|
|
1086
|
+
this.unsubs.forEach((e) => e()), this.unsubs = [];
|
|
2100
1087
|
}
|
|
2101
1088
|
};
|
|
2102
|
-
function
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
overrideDispose: (fn) => customDispose = fn
|
|
2111
|
-
}, ...args);
|
|
2112
|
-
const dispose = () => {
|
|
2113
|
-
deactivations.forEach((d) => d());
|
|
2114
|
-
subscriptions.unsubscribe();
|
|
2115
|
-
if (result && typeof result === "object" && "dispose" in result && typeof result.dispose === "function") result.dispose();
|
|
1089
|
+
function St(e, t, n) {
|
|
1090
|
+
let r = (...t) => {
|
|
1091
|
+
let n = new xt(), r = /* @__PURE__ */ new Set(), i = null, a = e({
|
|
1092
|
+
onDeactivated: (e) => r.add(e),
|
|
1093
|
+
subscriptions: n,
|
|
1094
|
+
overrideDispose: (e) => i = e
|
|
1095
|
+
}, ...t), o = () => {
|
|
1096
|
+
r.forEach((e) => e()), n.unsubscribe(), a && typeof a == "object" && "dispose" in a && typeof a.dispose == "function" && a.dispose();
|
|
2116
1097
|
};
|
|
2117
|
-
if (
|
|
1098
|
+
if (i) i(o);
|
|
2118
1099
|
else try {
|
|
2119
|
-
|
|
1100
|
+
P(() => o());
|
|
2120
1101
|
} catch {}
|
|
2121
1102
|
return {
|
|
2122
|
-
...
|
|
2123
|
-
dispose
|
|
1103
|
+
...a,
|
|
1104
|
+
dispose: o
|
|
2124
1105
|
};
|
|
2125
1106
|
};
|
|
2126
|
-
|
|
2127
|
-
return factoryCreator;
|
|
1107
|
+
return e.length <= 1 ? Ne(() => r()) : r;
|
|
2128
1108
|
}
|
|
2129
1109
|
//#endregion
|
|
2130
1110
|
//#region ../runtime-core/src/utils/props-accessor.ts
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
* @example
|
|
2136
|
-
* ```ts
|
|
2137
|
-
* // In component setup:
|
|
2138
|
-
* const { count = 0, label = 'Default' } = ctx.props;
|
|
2139
|
-
*
|
|
2140
|
-
* // Or spread to forward props
|
|
2141
|
-
* <ChildComponent {...ctx.props} />
|
|
2142
|
-
* ```
|
|
2143
|
-
*/
|
|
2144
|
-
function createPropsAccessor(reactiveProps) {
|
|
2145
|
-
return new Proxy(reactiveProps, {
|
|
2146
|
-
get(target, key) {
|
|
2147
|
-
if (typeof key === "symbol") return void 0;
|
|
2148
|
-
return target[key];
|
|
1111
|
+
function Ct(e) {
|
|
1112
|
+
return new Proxy(e, {
|
|
1113
|
+
get(e, t) {
|
|
1114
|
+
if (typeof t != "symbol") return e[t];
|
|
2149
1115
|
},
|
|
2150
|
-
has(
|
|
2151
|
-
|
|
2152
|
-
return key in target;
|
|
1116
|
+
has(e, t) {
|
|
1117
|
+
return typeof t == "symbol" ? !1 : t in e;
|
|
2153
1118
|
},
|
|
2154
|
-
ownKeys(
|
|
2155
|
-
return Object.keys(
|
|
1119
|
+
ownKeys(e) {
|
|
1120
|
+
return Object.keys(e);
|
|
2156
1121
|
},
|
|
2157
|
-
getOwnPropertyDescriptor(
|
|
2158
|
-
if (typeof
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
writable: false
|
|
1122
|
+
getOwnPropertyDescriptor(e, t) {
|
|
1123
|
+
if (typeof t != "symbol" && t in e) return {
|
|
1124
|
+
enumerable: !0,
|
|
1125
|
+
configurable: !0,
|
|
1126
|
+
writable: !1
|
|
2163
1127
|
};
|
|
2164
1128
|
}
|
|
2165
1129
|
});
|
|
2166
1130
|
}
|
|
2167
1131
|
//#endregion
|
|
2168
1132
|
//#region ../runtime-core/src/utils/slots.ts
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
*
|
|
2177
|
-
* Supports named slots via:
|
|
2178
|
-
* - `slots` prop object (e.g., `slots={{ header: () => <div>...</div> }}`)
|
|
2179
|
-
* - `slot` prop on children (e.g., `<div slot="header">...</div>`)
|
|
2180
|
-
*
|
|
2181
|
-
* @example
|
|
2182
|
-
* ```tsx
|
|
2183
|
-
* // Parent component
|
|
2184
|
-
* <Card slots={{ header: () => <h1>Title</h1> }}>
|
|
2185
|
-
* <p>Default content</p>
|
|
2186
|
-
* <span slot="footer">Footer text</span>
|
|
2187
|
-
* </Card>
|
|
2188
|
-
*
|
|
2189
|
-
* // Card component setup
|
|
2190
|
-
* const slots = createSlots(children, slotsFromProps);
|
|
2191
|
-
* return () => (
|
|
2192
|
-
* <div>
|
|
2193
|
-
* {slots.header()}
|
|
2194
|
-
* {slots.default()}
|
|
2195
|
-
* {slots.footer()}
|
|
2196
|
-
* </div>
|
|
2197
|
-
* );
|
|
2198
|
-
* ```
|
|
2199
|
-
*/
|
|
2200
|
-
function createSlots(children, slotsFromProps) {
|
|
2201
|
-
const versionSignal = signal({ v: 0 });
|
|
2202
|
-
function extractNamedSlotsFromChildren(c) {
|
|
2203
|
-
const defaultChildren = [];
|
|
2204
|
-
const namedSlots = {};
|
|
2205
|
-
if (c == null) return {
|
|
2206
|
-
defaultChildren,
|
|
2207
|
-
namedSlots
|
|
1133
|
+
function wt(e, t) {
|
|
1134
|
+
let n = k({ v: 0 });
|
|
1135
|
+
function r(e) {
|
|
1136
|
+
let t = [], n = {};
|
|
1137
|
+
if (e == null) return {
|
|
1138
|
+
defaultChildren: t,
|
|
1139
|
+
namedSlots: n
|
|
2208
1140
|
};
|
|
2209
|
-
|
|
2210
|
-
for (
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
} else defaultChildren.push(child);
|
|
1141
|
+
let r = Array.isArray(e) ? e : [e];
|
|
1142
|
+
for (let e of r) if (e && typeof e == "object" && e.props && e.props.slot) {
|
|
1143
|
+
let t = e.props.slot;
|
|
1144
|
+
n[t] || (n[t] = []), n[t].push(e);
|
|
1145
|
+
} else t.push(e);
|
|
2215
1146
|
return {
|
|
2216
|
-
defaultChildren,
|
|
2217
|
-
namedSlots
|
|
1147
|
+
defaultChildren: t,
|
|
1148
|
+
namedSlots: n
|
|
2218
1149
|
};
|
|
2219
1150
|
}
|
|
2220
1151
|
return new Proxy({
|
|
2221
|
-
_children:
|
|
2222
|
-
_slotsFromProps:
|
|
2223
|
-
_version:
|
|
2224
|
-
_isPatching:
|
|
1152
|
+
_children: e,
|
|
1153
|
+
_slotsFromProps: t || {},
|
|
1154
|
+
_version: n,
|
|
1155
|
+
_isPatching: !1,
|
|
2225
1156
|
default: function() {
|
|
2226
1157
|
this._version.v;
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
return defaultChildren.filter((child) => child != null && child !== false && child !== true);
|
|
1158
|
+
let e = this._children, { defaultChildren: t } = r(e);
|
|
1159
|
+
return t.filter((e) => e != null && e !== !1 && e !== !0);
|
|
2230
1160
|
}
|
|
2231
|
-
}, { get(
|
|
2232
|
-
if (
|
|
2233
|
-
if (typeof
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
if (result == null) return [];
|
|
2238
|
-
return Array.isArray(result) ? result : [result];
|
|
1161
|
+
}, { get(e, t) {
|
|
1162
|
+
if (t in e) return e[t];
|
|
1163
|
+
if (typeof t == "string") return function(n) {
|
|
1164
|
+
if (e._version.v, e._slotsFromProps && typeof e._slotsFromProps[t] == "function") {
|
|
1165
|
+
let r = e._slotsFromProps[t](n);
|
|
1166
|
+
return r == null ? [] : Array.isArray(r) ? r : [r];
|
|
2239
1167
|
}
|
|
2240
|
-
|
|
2241
|
-
return
|
|
1168
|
+
let { namedSlots: i } = r(e._children);
|
|
1169
|
+
return i[t] || [];
|
|
2242
1170
|
};
|
|
2243
1171
|
} });
|
|
2244
1172
|
}
|
|
2245
1173
|
//#endregion
|
|
2246
1174
|
//#region ../runtime-core/src/utils/normalize.ts
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
*/
|
|
2251
|
-
/**
|
|
2252
|
-
* Normalize render result to a VNode (wrapping arrays in Fragment).
|
|
2253
|
-
* Handles null, undefined, false, true by returning an empty Text node.
|
|
2254
|
-
*
|
|
2255
|
-
* This is used to normalize the return value of component render functions
|
|
2256
|
-
* into a consistent VNode structure for the renderer to process.
|
|
2257
|
-
*
|
|
2258
|
-
* @example
|
|
2259
|
-
* ```ts
|
|
2260
|
-
* // Conditional rendering returns null/false
|
|
2261
|
-
* normalizeSubTree(null) // → empty Text node
|
|
2262
|
-
* normalizeSubTree(false) // → empty Text node
|
|
2263
|
-
*
|
|
2264
|
-
* // Arrays become Fragments
|
|
2265
|
-
* normalizeSubTree([<A/>, <B/>]) // → Fragment with children
|
|
2266
|
-
*
|
|
2267
|
-
* // Primitives become Text nodes
|
|
2268
|
-
* normalizeSubTree("hello") // → Text node
|
|
2269
|
-
* normalizeSubTree(42) // → Text node
|
|
2270
|
-
*
|
|
2271
|
-
* // Computed signals are auto-unwrapped
|
|
2272
|
-
* normalizeSubTree(computed(() => "hi")) // → Text node with "hi"
|
|
2273
|
-
*
|
|
2274
|
-
* // VNodes pass through
|
|
2275
|
-
* normalizeSubTree(<div/>) // → same VNode
|
|
2276
|
-
* ```
|
|
2277
|
-
*/
|
|
2278
|
-
function normalizeSubTree(result) {
|
|
2279
|
-
if (result == null || result === false || result === true) return {
|
|
2280
|
-
type: Text,
|
|
1175
|
+
function Tt(e) {
|
|
1176
|
+
return e == null || e === !1 || e === !0 ? {
|
|
1177
|
+
type: H,
|
|
2281
1178
|
props: {},
|
|
2282
1179
|
key: null,
|
|
2283
1180
|
children: [],
|
|
2284
1181
|
dom: null,
|
|
2285
1182
|
text: ""
|
|
2286
|
-
}
|
|
2287
|
-
|
|
2288
|
-
if (Array.isArray(result)) return {
|
|
2289
|
-
type: Fragment,
|
|
1183
|
+
} : j(e) ? Tt(e.value) : Array.isArray(e) ? {
|
|
1184
|
+
type: V,
|
|
2290
1185
|
props: {},
|
|
2291
1186
|
key: null,
|
|
2292
|
-
children:
|
|
1187
|
+
children: e,
|
|
2293
1188
|
dom: null
|
|
2294
|
-
}
|
|
2295
|
-
|
|
2296
|
-
type: Text,
|
|
1189
|
+
} : typeof e == "string" || typeof e == "number" ? {
|
|
1190
|
+
type: H,
|
|
2297
1191
|
props: {},
|
|
2298
1192
|
key: null,
|
|
2299
1193
|
children: [],
|
|
2300
1194
|
dom: null,
|
|
2301
|
-
text:
|
|
2302
|
-
};
|
|
2303
|
-
return result;
|
|
1195
|
+
text: e
|
|
1196
|
+
} : e;
|
|
2304
1197
|
}
|
|
2305
1198
|
//#endregion
|
|
2306
1199
|
//#region ../runtime-core/src/hydration/index.ts
|
|
2307
|
-
|
|
2308
|
-
* Hydration utilities for SSR
|
|
2309
|
-
*
|
|
2310
|
-
* These utilities are shared between server-side rendering (stream.ts)
|
|
2311
|
-
* and client-side hydration (hydrate.ts). They are placed in runtime-core
|
|
2312
|
-
* to allow any SSR implementation to use them.
|
|
2313
|
-
*
|
|
2314
|
-
* @module
|
|
2315
|
-
*/
|
|
2316
|
-
/**
|
|
2317
|
-
* Client directive prefix used for selective hydration
|
|
2318
|
-
*/
|
|
2319
|
-
var CLIENT_DIRECTIVE_PREFIX = "client:";
|
|
2320
|
-
/**
|
|
2321
|
-
* Valid client directive names
|
|
2322
|
-
*/
|
|
2323
|
-
var CLIENT_DIRECTIVES = [
|
|
1200
|
+
var Et = "client:", Dt = [
|
|
2324
1201
|
"client:load",
|
|
2325
1202
|
"client:idle",
|
|
2326
1203
|
"client:visible",
|
|
2327
1204
|
"client:media",
|
|
2328
1205
|
"client:only"
|
|
2329
1206
|
];
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
* @example
|
|
2335
|
-
* ```ts
|
|
2336
|
-
* const emit = createEmit(reactiveProps);
|
|
2337
|
-
* emit('click', eventData); // Calls props.onClick(eventData)
|
|
2338
|
-
* ```
|
|
2339
|
-
*/
|
|
2340
|
-
function createEmit(reactiveProps) {
|
|
2341
|
-
return (event, ...args) => {
|
|
2342
|
-
const eventName = `on${event[0].toUpperCase() + event.slice(1)}`;
|
|
2343
|
-
const handler = ("value" in reactiveProps ? reactiveProps.value : reactiveProps)?.[eventName];
|
|
2344
|
-
if (handler && typeof handler === "function") handler(...args);
|
|
1207
|
+
function Ot(e) {
|
|
1208
|
+
return (t, ...n) => {
|
|
1209
|
+
let r = `on${t[0].toUpperCase() + t.slice(1)}`, i = ("value" in e ? e.value : e)?.[r];
|
|
1210
|
+
i && typeof i == "function" && i(...n);
|
|
2345
1211
|
};
|
|
2346
1212
|
}
|
|
2347
1213
|
//#endregion
|
|
2348
1214
|
//#region ../runtime-core/src/renderer.ts
|
|
2349
|
-
function
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
if (element != null && element !== false && element !== true) if (typeof element === "string" || typeof element === "number") vnode = {
|
|
2357
|
-
type: Text,
|
|
1215
|
+
function kt(e) {
|
|
1216
|
+
let { insert: t, remove: n, patchProp: r, createElement: i, createText: a, createComment: o, setText: s, setElementText: c, parentNode: l, nextSibling: u, cloneNode: d, insertStaticContent: m, patchDirective: h, onElementMounted: g, onElementUnmounted: _, getActiveElement: v, restoreFocus: ee } = e, y = null;
|
|
1217
|
+
function te(e, t, n) {
|
|
1218
|
+
n && (y = n);
|
|
1219
|
+
let r = t._vnode, i = null;
|
|
1220
|
+
e != null && e !== !1 && e !== !0 && (i = typeof e == "string" || typeof e == "number" ? {
|
|
1221
|
+
type: H,
|
|
2358
1222
|
props: {},
|
|
2359
1223
|
key: null,
|
|
2360
1224
|
children: [],
|
|
2361
1225
|
dom: null,
|
|
2362
|
-
text:
|
|
2363
|
-
}
|
|
2364
|
-
|
|
2365
|
-
type: element,
|
|
1226
|
+
text: e
|
|
1227
|
+
} : B(e) ? {
|
|
1228
|
+
type: e,
|
|
2366
1229
|
props: {},
|
|
2367
1230
|
key: null,
|
|
2368
1231
|
children: [],
|
|
2369
1232
|
dom: null
|
|
2370
|
-
};
|
|
2371
|
-
else vnode = element;
|
|
2372
|
-
if (vnode) {
|
|
2373
|
-
if (oldVNode) patch(oldVNode, vnode, container);
|
|
2374
|
-
else mount(vnode, container);
|
|
2375
|
-
container._vnode = vnode;
|
|
2376
|
-
} else if (oldVNode) {
|
|
2377
|
-
unmount(oldVNode, container);
|
|
2378
|
-
container._vnode = null;
|
|
2379
|
-
}
|
|
1233
|
+
} : e), i ? (r ? C(r, i, t) : x(i, t), t._vnode = i) : r && (S(r, t), t._vnode = null);
|
|
2380
1234
|
}
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
"animateMotion",
|
|
2385
|
-
"animateTransform",
|
|
2386
|
-
"circle",
|
|
2387
|
-
"clipPath",
|
|
2388
|
-
"defs",
|
|
2389
|
-
"desc",
|
|
2390
|
-
"ellipse",
|
|
2391
|
-
"feBlend",
|
|
2392
|
-
"feColorMatrix",
|
|
2393
|
-
"feComponentTransfer",
|
|
2394
|
-
"feComposite",
|
|
2395
|
-
"feConvolveMatrix",
|
|
2396
|
-
"feDiffuseLighting",
|
|
2397
|
-
"feDisplacementMap",
|
|
2398
|
-
"feDistantLight",
|
|
2399
|
-
"feDropShadow",
|
|
2400
|
-
"feFlood",
|
|
2401
|
-
"feFuncA",
|
|
2402
|
-
"feFuncB",
|
|
2403
|
-
"feFuncG",
|
|
2404
|
-
"feFuncR",
|
|
2405
|
-
"feGaussianBlur",
|
|
2406
|
-
"feImage",
|
|
2407
|
-
"feMerge",
|
|
2408
|
-
"feMergeNode",
|
|
2409
|
-
"feMorphology",
|
|
2410
|
-
"feOffset",
|
|
2411
|
-
"fePointLight",
|
|
2412
|
-
"feSpecularLighting",
|
|
2413
|
-
"feSpotLight",
|
|
2414
|
-
"feTile",
|
|
2415
|
-
"feTurbulence",
|
|
2416
|
-
"filter",
|
|
2417
|
-
"foreignObject",
|
|
2418
|
-
"g",
|
|
2419
|
-
"image",
|
|
2420
|
-
"line",
|
|
2421
|
-
"linearGradient",
|
|
2422
|
-
"marker",
|
|
2423
|
-
"mask",
|
|
2424
|
-
"metadata",
|
|
2425
|
-
"mpath",
|
|
2426
|
-
"path",
|
|
2427
|
-
"pattern",
|
|
2428
|
-
"polygon",
|
|
2429
|
-
"polyline",
|
|
2430
|
-
"radialGradient",
|
|
2431
|
-
"rect",
|
|
2432
|
-
"set",
|
|
2433
|
-
"stop",
|
|
2434
|
-
"switch",
|
|
2435
|
-
"symbol",
|
|
2436
|
-
"text",
|
|
2437
|
-
"textPath",
|
|
2438
|
-
"title",
|
|
2439
|
-
"tspan",
|
|
2440
|
-
"use",
|
|
2441
|
-
"view"
|
|
2442
|
-
]);
|
|
2443
|
-
function isSvgTag(tag) {
|
|
2444
|
-
return svgTags.has(tag);
|
|
1235
|
+
let b = new Set(/* @__PURE__ */ "svg.animate.animateMotion.animateTransform.circle.clipPath.defs.desc.ellipse.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.filter.foreignObject.g.image.line.linearGradient.marker.mask.metadata.mpath.path.pattern.polygon.polyline.radialGradient.rect.set.stop.switch.symbol.text.textPath.title.tspan.use.view".split("."));
|
|
1236
|
+
function ne(e) {
|
|
1237
|
+
return b.has(e);
|
|
2445
1238
|
}
|
|
2446
|
-
function
|
|
2447
|
-
if (
|
|
2448
|
-
if (
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
node.__vnode = vnode;
|
|
2452
|
-
hostInsert(node, container, before);
|
|
1239
|
+
function x(e, n, s = null, c = !1) {
|
|
1240
|
+
if (e == null || e === !1 || e === !0) return;
|
|
1241
|
+
if (e.type === H) {
|
|
1242
|
+
let r = a(String(e.text));
|
|
1243
|
+
e.dom = r, r.__vnode = e, t(r, n, s);
|
|
2453
1244
|
return;
|
|
2454
1245
|
}
|
|
2455
|
-
if (
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
hostInsert(node, container, before);
|
|
1246
|
+
if (e.type === U) {
|
|
1247
|
+
let r = o("");
|
|
1248
|
+
e.dom = r, t(r, n, s);
|
|
2459
1249
|
return;
|
|
2460
1250
|
}
|
|
2461
|
-
if (
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
hostInsert(anchor, container, before);
|
|
2465
|
-
if (vnode.children) vnode.children.forEach((child) => mount(child, container, anchor, parentIsSVG));
|
|
1251
|
+
if (e.type === V) {
|
|
1252
|
+
let r = o("");
|
|
1253
|
+
e.dom = r, t(r, n, s), e.children && e.children.forEach((e) => x(e, n, r, c));
|
|
2466
1254
|
return;
|
|
2467
1255
|
}
|
|
2468
|
-
if (
|
|
2469
|
-
|
|
1256
|
+
if (B(e.type)) {
|
|
1257
|
+
re(e, n, s, e.type.__setup);
|
|
2470
1258
|
return;
|
|
2471
1259
|
}
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
if (vnode.props) {
|
|
2478
|
-
for (const key in vnode.props) if (key !== "children" && key !== "key" && key !== "ref") if (key.charCodeAt(0) === 117 && key.startsWith("use:")) {
|
|
2479
|
-
if (hostPatchDirective) hostPatchDirective(element, key.slice(4), null, vnode.props[key], currentAppContext);
|
|
2480
|
-
} else hostPatchProp(element, key, null, vnode.props[key], isSVG);
|
|
2481
|
-
if (vnode.props.ref) untrack(() => {
|
|
2482
|
-
if (typeof vnode.props.ref === "function") vnode.props.ref(element);
|
|
2483
|
-
else if (typeof vnode.props.ref === "object") vnode.props.ref.current = element;
|
|
1260
|
+
let l = e.type, u = l === "svg" || c && l !== "foreignObject", d = i(l, u);
|
|
1261
|
+
if (e.dom = d, d.__vnode = e, e.props) {
|
|
1262
|
+
for (let t in e.props) t !== "children" && t !== "key" && t !== "ref" && (t.charCodeAt(0) === 117 && t.startsWith("use:") ? h && h(d, t.slice(4), null, e.props[t], y) : r(d, t, null, e.props[t], u));
|
|
1263
|
+
e.props.ref && p(() => {
|
|
1264
|
+
typeof e.props.ref == "function" ? e.props.ref(d) : typeof e.props.ref == "object" && (e.props.ref.current = d);
|
|
2484
1265
|
});
|
|
2485
1266
|
}
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
});
|
|
2491
|
-
hostInsert(element, container, before);
|
|
2492
|
-
if (hostOnElementMounted) hostOnElementMounted(element);
|
|
1267
|
+
let f = u && l !== "foreignObject";
|
|
1268
|
+
e.children && e.children.forEach((t) => {
|
|
1269
|
+
t.parent = e, x(t, d, null, f);
|
|
1270
|
+
}), t(d, n, s), g && g(d);
|
|
2493
1271
|
}
|
|
2494
|
-
function
|
|
2495
|
-
|
|
2496
|
-
if (
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
if (subTree) unmount(subTree, container);
|
|
2501
|
-
if (vnode.dom) hostRemove(vnode.dom);
|
|
2502
|
-
if (vnode.props?.ref) untrack(() => {
|
|
2503
|
-
if (typeof vnode.props.ref === "function") vnode.props.ref(null);
|
|
2504
|
-
else if (typeof vnode.props.ref === "object") vnode.props.ref.current = null;
|
|
1272
|
+
function S(e, t) {
|
|
1273
|
+
let r = e;
|
|
1274
|
+
if (r._effect && r._effect.stop(), e.cleanup && e.cleanup(), B(e.type)) {
|
|
1275
|
+
let i = r._subTreeRef?.current ?? r._subTree;
|
|
1276
|
+
i && S(i, t), e.dom && n(e.dom), e.props?.ref && p(() => {
|
|
1277
|
+
typeof e.props.ref == "function" ? e.props.ref(null) : typeof e.props.ref == "object" && (e.props.ref.current = null);
|
|
2505
1278
|
});
|
|
2506
1279
|
return;
|
|
2507
1280
|
}
|
|
2508
|
-
if (
|
|
2509
|
-
|
|
2510
|
-
if (vnode.dom) hostRemove(vnode.dom);
|
|
1281
|
+
if (e.type === V) {
|
|
1282
|
+
e.children && e.children.forEach((e) => S(e, t)), e.dom && n(e.dom);
|
|
2511
1283
|
return;
|
|
2512
1284
|
}
|
|
2513
|
-
if (
|
|
2514
|
-
|
|
1285
|
+
if (e.type === U) {
|
|
1286
|
+
e.dom && n(e.dom);
|
|
2515
1287
|
return;
|
|
2516
1288
|
}
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
});
|
|
2521
|
-
if (hostOnElementUnmounted && vnode.dom) hostOnElementUnmounted(vnode.dom);
|
|
2522
|
-
if (vnode.children && vnode.children.length > 0) vnode.children.forEach((child) => unmount(child, vnode.dom));
|
|
2523
|
-
if (vnode.dom) hostRemove(vnode.dom);
|
|
1289
|
+
e.props?.ref && p(() => {
|
|
1290
|
+
typeof e.props.ref == "function" ? e.props.ref(null) : e.props.ref && typeof e.props.ref == "object" && (e.props.ref.current = null);
|
|
1291
|
+
}), _ && e.dom && _(e.dom), e.children && e.children.length > 0 && e.children.forEach((t) => S(t, e.dom)), e.dom && n(e.dom);
|
|
2524
1292
|
}
|
|
2525
|
-
function
|
|
2526
|
-
if (
|
|
2527
|
-
if (!
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
unmount(oldVNode, parent);
|
|
2531
|
-
mount(newVNode, parent, nextSibling);
|
|
1293
|
+
function C(e, n, i) {
|
|
1294
|
+
if (e === n) return;
|
|
1295
|
+
if (!D(e, n)) {
|
|
1296
|
+
let t = l(e.dom) || i, r = e.dom ? u(e.dom) : null;
|
|
1297
|
+
S(e, t), x(n, t, r);
|
|
2532
1298
|
return;
|
|
2533
1299
|
}
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
for (const key in newProps) if (key !== "children" && key !== "key" && key !== "ref" && key !== "$models") {
|
|
2549
|
-
if (props[key] !== newProps[key]) props[key] = newProps[key];
|
|
2550
|
-
}
|
|
2551
|
-
for (const modelKey in newModels) {
|
|
2552
|
-
const newModel = newModels[modelKey];
|
|
2553
|
-
const oldModel = props[modelKey];
|
|
2554
|
-
if (isModel(newModel)) {
|
|
2555
|
-
if (isModel(oldModel)) {
|
|
2556
|
-
const [newObj, newKey] = newModel.binding;
|
|
2557
|
-
const [oldObj, oldKey] = oldModel.binding;
|
|
2558
|
-
if (newObj === oldObj && newKey === oldKey) continue;
|
|
1300
|
+
let o = e, c = n;
|
|
1301
|
+
if (o._effect) {
|
|
1302
|
+
n.dom = e.dom, c._effect = o._effect, c._subTree = o._subTree, c._subTreeRef = o._subTreeRef, c._slots = o._slots;
|
|
1303
|
+
let t = o._componentProps;
|
|
1304
|
+
if (c._componentProps = t, t) {
|
|
1305
|
+
let e = n.props || {}, r = n.props?.$models || {};
|
|
1306
|
+
p(() => {
|
|
1307
|
+
for (let n in e) n !== "children" && n !== "key" && n !== "ref" && n !== "$models" && t[n] !== e[n] && (t[n] = e[n]);
|
|
1308
|
+
for (let e in r) {
|
|
1309
|
+
let n = r[e], i = t[e];
|
|
1310
|
+
if (z(n)) {
|
|
1311
|
+
if (z(i)) {
|
|
1312
|
+
let [e, t] = n.binding, [r, a] = i.binding;
|
|
1313
|
+
if (e === r && t === a) continue;
|
|
2559
1314
|
}
|
|
2560
|
-
|
|
1315
|
+
t[e] = n;
|
|
2561
1316
|
}
|
|
2562
1317
|
}
|
|
2563
|
-
for (
|
|
1318
|
+
for (let n in t) !(n in e) && !(n in r) && n !== "children" && n !== "key" && n !== "ref" && n !== "$models" && delete t[n];
|
|
2564
1319
|
});
|
|
2565
1320
|
}
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
untrack(() => {
|
|
2576
|
-
slotsRef._version.v++;
|
|
2577
|
-
});
|
|
2578
|
-
} finally {
|
|
2579
|
-
slotsRef._isPatching = false;
|
|
2580
|
-
}
|
|
1321
|
+
let r = o._slots, i = n.props?.children, a = n.props?.slots;
|
|
1322
|
+
if (r && (i !== void 0 && (r._children = i), a !== void 0 && (r._slotsFromProps = a), !r._isPatching)) {
|
|
1323
|
+
r._isPatching = !0;
|
|
1324
|
+
try {
|
|
1325
|
+
p(() => {
|
|
1326
|
+
r._version.v++;
|
|
1327
|
+
});
|
|
1328
|
+
} finally {
|
|
1329
|
+
r._isPatching = !1;
|
|
2581
1330
|
}
|
|
2582
1331
|
}
|
|
2583
1332
|
return;
|
|
2584
1333
|
}
|
|
2585
|
-
if (
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
newVNode.dom = textNode;
|
|
2590
|
-
if (container) hostInsert(textNode, container, oldVNode.dom || null);
|
|
1334
|
+
if (n.type === H) {
|
|
1335
|
+
if (n.dom = e.dom, !n.dom) {
|
|
1336
|
+
let r = a(String(n.text));
|
|
1337
|
+
n.dom = r, i && t(r, i, e.dom || null);
|
|
2591
1338
|
return;
|
|
2592
1339
|
}
|
|
2593
|
-
|
|
1340
|
+
e.text !== n.text && s(n.dom, String(n.text));
|
|
2594
1341
|
return;
|
|
2595
1342
|
}
|
|
2596
|
-
if (
|
|
2597
|
-
|
|
1343
|
+
if (n.type === U) {
|
|
1344
|
+
n.dom = e.dom;
|
|
2598
1345
|
return;
|
|
2599
1346
|
}
|
|
2600
|
-
if (
|
|
2601
|
-
|
|
1347
|
+
if (n.type === V) {
|
|
1348
|
+
w(e, n, i, !1);
|
|
2602
1349
|
return;
|
|
2603
1350
|
}
|
|
2604
|
-
|
|
2605
|
-
if (!
|
|
2606
|
-
|
|
1351
|
+
let d = n.dom = e.dom;
|
|
1352
|
+
if (!d) {
|
|
1353
|
+
x(n, i);
|
|
2607
1354
|
return;
|
|
2608
1355
|
}
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
if (hostPatchDirective) hostPatchDirective(element, key.slice(4), oldProps[key], null, currentAppContext);
|
|
2615
|
-
} else hostPatchProp(element, key, oldProps[key], null, isSVG);
|
|
2616
|
-
for (const key in newProps) {
|
|
2617
|
-
const oldValue = oldProps[key];
|
|
2618
|
-
const newValue = newProps[key];
|
|
2619
|
-
if (key !== "children" && key !== "key" && key !== "ref" && oldValue !== newValue) if (key.charCodeAt(0) === 117 && key.startsWith("use:")) {
|
|
2620
|
-
if (hostPatchDirective) hostPatchDirective(element, key.slice(4), oldValue, newValue, currentAppContext);
|
|
2621
|
-
} else hostPatchProp(element, key, oldValue, newValue, isSVG);
|
|
1356
|
+
let f = n.type, m = f === "svg" || ne(f), g = e.props || {}, _ = n.props || {};
|
|
1357
|
+
for (let e in g) !(e in _) && e !== "children" && e !== "key" && e !== "ref" && (e.charCodeAt(0) === 117 && e.startsWith("use:") ? h && h(d, e.slice(4), g[e], null, y) : r(d, e, g[e], null, m));
|
|
1358
|
+
for (let e in _) {
|
|
1359
|
+
let t = g[e], n = _[e];
|
|
1360
|
+
e !== "children" && e !== "key" && e !== "ref" && t !== n && (e.charCodeAt(0) === 117 && e.startsWith("use:") ? h && h(d, e.slice(4), t, n, y) : r(d, e, t, n, m));
|
|
2622
1361
|
}
|
|
2623
|
-
|
|
1362
|
+
w(e, n, d, m && f !== "foreignObject");
|
|
2624
1363
|
}
|
|
2625
|
-
function
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
newChildren.forEach((c) => c.parent = newVNode);
|
|
2629
|
-
reconcileChildrenArray(container, oldChildren, newChildren, parentIsSVG);
|
|
1364
|
+
function w(e, t, n, r = !1) {
|
|
1365
|
+
let i = e.children, a = t.children;
|
|
1366
|
+
a.forEach((e) => e.parent = t), E(n, i, a, r);
|
|
2630
1367
|
}
|
|
2631
|
-
|
|
2632
|
-
* Check for duplicate keys in an array of VNodes and warn in development.
|
|
2633
|
-
*/
|
|
2634
|
-
function checkDuplicateKeys(children) {
|
|
1368
|
+
function T(e) {
|
|
2635
1369
|
if (process.env.NODE_ENV === "production") return;
|
|
2636
|
-
|
|
2637
|
-
for (
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
seenKeys.add(keyStr);
|
|
1370
|
+
let t = /* @__PURE__ */ new Set();
|
|
1371
|
+
for (let n of e) if (n?.key != null) {
|
|
1372
|
+
let e = String(n.key);
|
|
1373
|
+
t.has(e) && console.warn(`[SignalX] Duplicate key "${n.key}" detected in list. Keys should be unique among siblings to ensure correct reconciliation. This may cause unexpected behavior when items are reordered, added, or removed.`), t.add(e);
|
|
2641
1374
|
}
|
|
2642
1375
|
}
|
|
2643
|
-
function
|
|
2644
|
-
|
|
2645
|
-
let
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
oldStartVNode = oldChildren[++oldStartIdx];
|
|
2659
|
-
newStartVNode = newChildren[++newStartIdx];
|
|
2660
|
-
} else if (isSameVNode(oldEndVNode, newEndVNode)) {
|
|
2661
|
-
patch(oldEndVNode, newEndVNode, parent);
|
|
2662
|
-
oldEndVNode = oldChildren[--oldEndIdx];
|
|
2663
|
-
newEndVNode = newChildren[--newEndIdx];
|
|
2664
|
-
} else if (isSameVNode(oldStartVNode, newEndVNode)) {
|
|
2665
|
-
patch(oldStartVNode, newEndVNode, parent);
|
|
2666
|
-
const nodeToMove = oldStartVNode.dom;
|
|
2667
|
-
const anchor = hostNextSibling(oldEndVNode.dom);
|
|
2668
|
-
if (nodeToMove) hostInsert(nodeToMove, parent, anchor);
|
|
2669
|
-
oldStartVNode = oldChildren[++oldStartIdx];
|
|
2670
|
-
newEndVNode = newChildren[--newEndIdx];
|
|
2671
|
-
} else if (isSameVNode(oldEndVNode, newStartVNode)) {
|
|
2672
|
-
patch(oldEndVNode, newStartVNode, parent);
|
|
2673
|
-
const nodeToMove = oldEndVNode.dom;
|
|
2674
|
-
const anchor = oldStartVNode.dom;
|
|
2675
|
-
if (nodeToMove) hostInsert(nodeToMove, parent, anchor);
|
|
2676
|
-
oldEndVNode = oldChildren[--oldEndIdx];
|
|
2677
|
-
newStartVNode = newChildren[++newStartIdx];
|
|
1376
|
+
function E(e, n, r, i = !1) {
|
|
1377
|
+
process.env.NODE_ENV !== "production" && T(r);
|
|
1378
|
+
let a = 0, o = n.length - 1, s = n[0], c = n[o], l = 0, d = r.length - 1, f = r[0], p = r[d], m;
|
|
1379
|
+
for (; a <= o && l <= d;) if (s == null) s = n[++a];
|
|
1380
|
+
else if (c == null) c = n[--o];
|
|
1381
|
+
else if (D(s, f)) C(s, f, e), s = n[++a], f = r[++l];
|
|
1382
|
+
else if (D(c, p)) C(c, p, e), c = n[--o], p = r[--d];
|
|
1383
|
+
else if (D(s, p)) {
|
|
1384
|
+
C(s, p, e);
|
|
1385
|
+
let i = s.dom, o = c.dom ? u(c.dom) : null;
|
|
1386
|
+
i && t(i, e, o), s = n[++a], p = r[--d];
|
|
1387
|
+
} else if (D(c, f)) {
|
|
1388
|
+
C(c, f, e);
|
|
1389
|
+
let i = c.dom, a = s.dom ?? null;
|
|
1390
|
+
i && t(i, e, a), c = n[--o], f = r[++l];
|
|
2678
1391
|
} else {
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
if (
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
} else mount(newStartVNode, parent, oldStartVNode.dom, parentIsSVG);
|
|
2687
|
-
newStartVNode = newChildren[++newStartIdx];
|
|
1392
|
+
m ||= O(n, a, o);
|
|
1393
|
+
let c = f.key == null ? A(n, f, a, o) : m.get(String(f.key));
|
|
1394
|
+
if (c != null) {
|
|
1395
|
+
let r = n[c];
|
|
1396
|
+
C(r, f, e), n[c] = void 0, r.dom && s.dom && t(r.dom, e, s.dom);
|
|
1397
|
+
} else x(f, e, s.dom ?? null, i);
|
|
1398
|
+
f = r[++l];
|
|
2688
1399
|
}
|
|
2689
|
-
if (
|
|
2690
|
-
if (
|
|
2691
|
-
|
|
2692
|
-
for (let
|
|
1400
|
+
if (a > o) {
|
|
1401
|
+
if (l <= d) {
|
|
1402
|
+
let t = r[d + 1] == null ? null : r[d + 1].dom ?? null;
|
|
1403
|
+
for (let n = l; n <= d; n++) x(r[n], e, t, i);
|
|
2693
1404
|
}
|
|
2694
|
-
} else if (
|
|
2695
|
-
for (let i = oldStartIdx; i <= oldEndIdx; i++) if (oldChildren[i]) unmount(oldChildren[i], parent);
|
|
2696
|
-
}
|
|
1405
|
+
} else if (l > d) for (let t = a; t <= o; t++) n[t] && S(n[t], e);
|
|
2697
1406
|
}
|
|
2698
|
-
function
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
if (n1.type !== n2.type) return false;
|
|
2702
|
-
if (k1 === k2) return true;
|
|
2703
|
-
return String(k1) === String(k2);
|
|
1407
|
+
function D(e, t) {
|
|
1408
|
+
let n = e.key == null ? null : e.key, r = t.key == null ? null : t.key;
|
|
1409
|
+
return e.type === t.type ? n === r ? !0 : String(n) === String(r) : !1;
|
|
2704
1410
|
}
|
|
2705
|
-
function
|
|
2706
|
-
|
|
2707
|
-
for (let i =
|
|
2708
|
-
|
|
2709
|
-
if (
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
map.set(keyStr, i);
|
|
1411
|
+
function O(e, t, n) {
|
|
1412
|
+
let r = /* @__PURE__ */ new Map();
|
|
1413
|
+
for (let i = t; i <= n; i++) {
|
|
1414
|
+
let t = e[i]?.key;
|
|
1415
|
+
if (t != null) {
|
|
1416
|
+
let e = String(t);
|
|
1417
|
+
process.env.NODE_ENV !== "production" && r.has(e) && console.warn(`[SignalX] Duplicate key "${t}" detected in list. Keys should be unique among siblings to ensure correct reconciliation. This may cause unexpected behavior when items are reordered, added, or removed.`), r.set(e, i);
|
|
2713
1418
|
}
|
|
2714
1419
|
}
|
|
2715
|
-
return
|
|
1420
|
+
return r;
|
|
2716
1421
|
}
|
|
2717
|
-
function
|
|
2718
|
-
for (let i =
|
|
1422
|
+
function A(e, t, n, r) {
|
|
1423
|
+
for (let i = n; i <= r; i++) if (e[i] && D(e[i], t)) return i;
|
|
2719
1424
|
return null;
|
|
2720
1425
|
}
|
|
2721
|
-
function
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
const { children, slots: slotsFromProps, $models: modelsData, ...propsData } = vnode.props || {};
|
|
2729
|
-
const propsWithModels = { ...propsData };
|
|
2730
|
-
if (modelsData) for (const modelKey in modelsData) {
|
|
2731
|
-
const modelValue = modelsData[modelKey];
|
|
2732
|
-
if (isModel(modelValue)) propsWithModels[modelKey] = modelValue;
|
|
1426
|
+
function re(e, n, r, i) {
|
|
1427
|
+
let a = o("");
|
|
1428
|
+
e.dom = a, a.__vnode = e, t(a, n, r);
|
|
1429
|
+
let s = null, c = !1, { children: l, slots: u, $models: d, ...m } = e.props || {}, h = { ...m };
|
|
1430
|
+
if (d) for (let e in d) {
|
|
1431
|
+
let t = d[e];
|
|
1432
|
+
z(t) && (h[e] = t);
|
|
2733
1433
|
}
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
signal,
|
|
2748
|
-
props: createPropsAccessor(reactiveProps),
|
|
2749
|
-
slots,
|
|
2750
|
-
emit: createEmit(reactiveProps),
|
|
2751
|
-
parent: parentInstance,
|
|
2752
|
-
onMounted: (fn) => {
|
|
2753
|
-
mountHooks.push(fn);
|
|
1434
|
+
let g = k(h), _ = e;
|
|
1435
|
+
_._componentProps = g;
|
|
1436
|
+
let te = wt(l, u);
|
|
1437
|
+
_._slots = te;
|
|
1438
|
+
let b = [], ne = [], w = [], T = [], E = _e(), D = e.type.__name, O = {
|
|
1439
|
+
el: n,
|
|
1440
|
+
signal: k,
|
|
1441
|
+
props: Ct(g),
|
|
1442
|
+
slots: te,
|
|
1443
|
+
emit: Ot(g),
|
|
1444
|
+
parent: E,
|
|
1445
|
+
onMounted: (e) => {
|
|
1446
|
+
ne.push(e);
|
|
2754
1447
|
},
|
|
2755
|
-
onUnmounted: (
|
|
2756
|
-
|
|
1448
|
+
onUnmounted: (e) => {
|
|
1449
|
+
T.push(e);
|
|
2757
1450
|
},
|
|
2758
|
-
onCreated: (
|
|
2759
|
-
|
|
1451
|
+
onCreated: (e) => {
|
|
1452
|
+
b.push(e);
|
|
2760
1453
|
},
|
|
2761
|
-
onUpdated: (
|
|
2762
|
-
|
|
1454
|
+
onUpdated: (e) => {
|
|
1455
|
+
w.push(e);
|
|
2763
1456
|
},
|
|
2764
|
-
expose: (
|
|
2765
|
-
|
|
2766
|
-
exposeCalled = true;
|
|
1457
|
+
expose: (e) => {
|
|
1458
|
+
s = e, c = !0;
|
|
2767
1459
|
},
|
|
2768
1460
|
renderFn: null,
|
|
2769
1461
|
update: () => {}
|
|
2770
1462
|
};
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
vnode
|
|
2778
|
-
};
|
|
2779
|
-
const prev = setCurrentInstance(ctx);
|
|
2780
|
-
let renderFn;
|
|
1463
|
+
ce(O), O.__name = D, !E && y && Le(O, y);
|
|
1464
|
+
let A = {
|
|
1465
|
+
name: D,
|
|
1466
|
+
ctx: O,
|
|
1467
|
+
vnode: e
|
|
1468
|
+
}, re = ve(O), ie;
|
|
2781
1469
|
try {
|
|
2782
|
-
|
|
2783
|
-
if (
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
} catch (err) {
|
|
2788
|
-
if (!handleComponentError(currentAppContext, err, componentInstance, "setup")) throw err;
|
|
1470
|
+
let e = i(O);
|
|
1471
|
+
if (e && typeof e.then == "function") throw Ee(D ?? "anonymous");
|
|
1472
|
+
ie = e, We(y, A), b.forEach((e) => e());
|
|
1473
|
+
} catch (e) {
|
|
1474
|
+
if (!Je(y, e, A, "setup")) throw e;
|
|
2789
1475
|
} finally {
|
|
2790
|
-
|
|
1476
|
+
ve(re);
|
|
2791
1477
|
}
|
|
2792
|
-
if (
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
else if (vnode.props.ref && typeof vnode.props.ref === "object") vnode.props.ref.current = refValue;
|
|
1478
|
+
if (e.props?.ref) {
|
|
1479
|
+
let t = c ? s : null;
|
|
1480
|
+
p(() => {
|
|
1481
|
+
typeof e.props.ref == "function" ? e.props.ref(t) : e.props.ref && typeof e.props.ref == "object" && (e.props.ref.current = t);
|
|
2797
1482
|
});
|
|
2798
1483
|
}
|
|
2799
|
-
if (
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
1484
|
+
if (ie) {
|
|
1485
|
+
O.renderFn = ie;
|
|
1486
|
+
let e = { current: null };
|
|
1487
|
+
_._subTreeRef = e;
|
|
1488
|
+
let t = f(() => {
|
|
1489
|
+
let t = ve(O);
|
|
2805
1490
|
try {
|
|
2806
|
-
|
|
2807
|
-
if (
|
|
2808
|
-
|
|
2809
|
-
unmount(subTreeRef.current, container);
|
|
2810
|
-
subTreeRef.current = null;
|
|
2811
|
-
internalVNode._subTree = null;
|
|
2812
|
-
}
|
|
1491
|
+
let t = O.renderFn();
|
|
1492
|
+
if (t == null) {
|
|
1493
|
+
e.current && (S(e.current, n), e.current = null, _._subTree = null);
|
|
2813
1494
|
return;
|
|
2814
1495
|
}
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
} else mount(subTree, container, anchor);
|
|
2824
|
-
subTreeRef.current = subTree;
|
|
2825
|
-
internalVNode._subTree = subTree;
|
|
2826
|
-
} catch (err) {
|
|
2827
|
-
if (!handleComponentError(currentAppContext, err, componentInstance, "render")) throw err;
|
|
1496
|
+
let r = Tt(t), i = e.current;
|
|
1497
|
+
if (i) {
|
|
1498
|
+
let e = v ? v() : null;
|
|
1499
|
+
C(i, r, n), e && ee && v() !== e && ee(e), qe(y, A), w.forEach((e) => e());
|
|
1500
|
+
} else x(r, n, a);
|
|
1501
|
+
e.current = r, _._subTree = r;
|
|
1502
|
+
} catch (e) {
|
|
1503
|
+
if (!Je(y, e, A, "render")) throw e;
|
|
2828
1504
|
} finally {
|
|
2829
|
-
|
|
1505
|
+
ve(t);
|
|
2830
1506
|
}
|
|
2831
1507
|
});
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
componentEffect();
|
|
1508
|
+
_._effect = t, O.update = () => {
|
|
1509
|
+
t();
|
|
2835
1510
|
};
|
|
2836
1511
|
}
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
vnode.cleanup = () => {
|
|
2841
|
-
notifyComponentUnmounted(currentAppContext, componentInstance);
|
|
2842
|
-
unmountHooks.forEach((hook) => hook(mountCtx));
|
|
1512
|
+
let j = { el: n };
|
|
1513
|
+
p(() => ne.forEach((e) => e(j))), Ge(y, A), e.cleanup = () => {
|
|
1514
|
+
Ke(y, A), T.forEach((e) => e(j));
|
|
2843
1515
|
};
|
|
2844
1516
|
}
|
|
2845
1517
|
return {
|
|
2846
|
-
render,
|
|
2847
|
-
patch,
|
|
2848
|
-
mount,
|
|
2849
|
-
unmount,
|
|
2850
|
-
mountComponent
|
|
1518
|
+
render: te,
|
|
1519
|
+
patch: C,
|
|
1520
|
+
mount: x,
|
|
1521
|
+
unmount: S,
|
|
1522
|
+
mountComponent: re
|
|
2851
1523
|
};
|
|
2852
1524
|
}
|
|
2853
1525
|
//#endregion
|
|
2854
1526
|
//#region ../runtime-terminal/src/focus.ts
|
|
2855
|
-
var
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
focusableIds.add(id);
|
|
2859
|
-
if (focusState.activeId === null) focusState.activeId = id;
|
|
2860
|
-
}
|
|
2861
|
-
function unregisterFocusable(id) {
|
|
2862
|
-
focusableIds.delete(id);
|
|
2863
|
-
if (focusState.activeId === id) {
|
|
2864
|
-
focusState.activeId = null;
|
|
2865
|
-
if (focusableIds.size > 0) focusState.activeId = focusableIds.values().next().value || null;
|
|
2866
|
-
}
|
|
1527
|
+
var q = /* @__PURE__ */ new Set(), J = k({ activeId: null });
|
|
1528
|
+
function Y(e) {
|
|
1529
|
+
q.add(e), J.activeId === null && (J.activeId = e);
|
|
2867
1530
|
}
|
|
2868
|
-
function
|
|
2869
|
-
|
|
1531
|
+
function X(e) {
|
|
1532
|
+
q.delete(e), J.activeId === e && (J.activeId = null, q.size > 0 && (J.activeId = q.values().next().value || null));
|
|
2870
1533
|
}
|
|
2871
|
-
function
|
|
2872
|
-
|
|
2873
|
-
const ids = Array.from(focusableIds);
|
|
2874
|
-
focusState.activeId = ids[((focusState.activeId ? ids.indexOf(focusState.activeId) : -1) + 1) % ids.length];
|
|
1534
|
+
function At(e) {
|
|
1535
|
+
q.has(e) && (J.activeId = e);
|
|
2875
1536
|
}
|
|
2876
|
-
function
|
|
2877
|
-
if (
|
|
2878
|
-
|
|
2879
|
-
|
|
1537
|
+
function jt() {
|
|
1538
|
+
if (q.size === 0) return;
|
|
1539
|
+
let e = Array.from(q);
|
|
1540
|
+
J.activeId = e[((J.activeId ? e.indexOf(J.activeId) : -1) + 1) % e.length];
|
|
1541
|
+
}
|
|
1542
|
+
function Mt() {
|
|
1543
|
+
if (q.size === 0) return;
|
|
1544
|
+
let e = Array.from(q);
|
|
1545
|
+
J.activeId = e[((J.activeId ? e.indexOf(J.activeId) : -1) - 1 + e.length) % e.length];
|
|
2880
1546
|
}
|
|
2881
1547
|
//#endregion
|
|
2882
1548
|
//#region ../runtime-terminal/src/utils.ts
|
|
2883
|
-
function
|
|
2884
|
-
switch (
|
|
1549
|
+
function Nt(e) {
|
|
1550
|
+
switch (e) {
|
|
2885
1551
|
case "red": return "\x1B[31m";
|
|
2886
1552
|
case "green": return "\x1B[32m";
|
|
2887
1553
|
case "blue": return "\x1B[34m";
|
|
@@ -2892,8 +1558,8 @@ function getColorCode(color) {
|
|
|
2892
1558
|
default: return "";
|
|
2893
1559
|
}
|
|
2894
1560
|
}
|
|
2895
|
-
function
|
|
2896
|
-
switch (
|
|
1561
|
+
function Pt(e) {
|
|
1562
|
+
switch (e) {
|
|
2897
1563
|
case "red": return "\x1B[41m";
|
|
2898
1564
|
case "green": return "\x1B[42m";
|
|
2899
1565
|
case "blue": return "\x1B[44m";
|
|
@@ -2904,431 +1570,284 @@ function getBackgroundColorCode(color) {
|
|
|
2904
1570
|
default: return "";
|
|
2905
1571
|
}
|
|
2906
1572
|
}
|
|
2907
|
-
function
|
|
2908
|
-
return
|
|
1573
|
+
function Ft(e) {
|
|
1574
|
+
return e.replace(/\x1B\[[0-9;]*[a-zA-Z]/g, "");
|
|
2909
1575
|
}
|
|
2910
1576
|
//#endregion
|
|
2911
1577
|
//#region ../runtime-terminal/src/components/Input.tsx
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
const getValue = () => props.model?.value || "";
|
|
2918
|
-
const handleKey = (key) => {
|
|
2919
|
-
if (!isFocused()) return;
|
|
2920
|
-
if (!isReady) return;
|
|
2921
|
-
if (key === "\r") {
|
|
2922
|
-
emit("submit", getValue());
|
|
1578
|
+
var It = F(({ props: e, emit: t }) => {
|
|
1579
|
+
let n = Math.random().toString(36).slice(2), r = !1, i = () => J.activeId === n, a = () => e.model?.value || "", o = (n) => {
|
|
1580
|
+
if (!i() || !r) return;
|
|
1581
|
+
if (n === "\r") {
|
|
1582
|
+
t("submit", a());
|
|
2923
1583
|
return;
|
|
2924
1584
|
}
|
|
2925
|
-
if (
|
|
2926
|
-
if (
|
|
2927
|
-
|
|
2928
|
-
if (
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
emit("input", newValue);
|
|
1585
|
+
if (n === "\n") return;
|
|
1586
|
+
if (n === "" || n === "\b") {
|
|
1587
|
+
let n = a();
|
|
1588
|
+
if (n.length > 0) {
|
|
1589
|
+
let r = n.slice(0, -1);
|
|
1590
|
+
e.model && (e.model.value = r), t("input", r);
|
|
2932
1591
|
}
|
|
2933
1592
|
return;
|
|
2934
1593
|
}
|
|
2935
|
-
if (
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
registerFocusable(id);
|
|
2943
|
-
if (props.autofocus) focus(id);
|
|
2944
|
-
keyCleanup = onKey(handleKey);
|
|
2945
|
-
setTimeout(() => {
|
|
2946
|
-
isReady = true;
|
|
1594
|
+
if (n.length > 1) return;
|
|
1595
|
+
let o = a() + n;
|
|
1596
|
+
e.model && (e.model.value = o), t("input", o);
|
|
1597
|
+
}, s = null;
|
|
1598
|
+
return N(() => {
|
|
1599
|
+
Y(n), e.autofocus && At(n), s = Jt(o), setTimeout(() => {
|
|
1600
|
+
r = !0;
|
|
2947
1601
|
}, 50);
|
|
2948
|
-
})
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
return () => {
|
|
2954
|
-
const val = getValue().replace(/[\r\n]+/g, " ");
|
|
2955
|
-
const placeholder = (props.placeholder || "").replace(/[\r\n]+/g, " ");
|
|
2956
|
-
const showCursor = isFocused();
|
|
2957
|
-
return /* @__PURE__ */ jsxs("box", {
|
|
1602
|
+
}), P(() => {
|
|
1603
|
+
s && s(), X(n);
|
|
1604
|
+
}), () => {
|
|
1605
|
+
let t = a().replace(/[\r\n]+/g, " "), n = (e.placeholder || "").replace(/[\r\n]+/g, " "), r = i();
|
|
1606
|
+
return /* @__PURE__ */ K("box", {
|
|
2958
1607
|
border: "single",
|
|
2959
|
-
borderColor:
|
|
2960
|
-
label:
|
|
2961
|
-
children: [/* @__PURE__ */
|
|
1608
|
+
borderColor: r ? "green" : "white",
|
|
1609
|
+
label: e.label,
|
|
1610
|
+
children: [/* @__PURE__ */ G("text", { children: t || n }), r && /* @__PURE__ */ G("text", {
|
|
2962
1611
|
color: "cyan",
|
|
2963
1612
|
children: "_"
|
|
2964
1613
|
})]
|
|
2965
1614
|
});
|
|
2966
1615
|
};
|
|
2967
|
-
}, { name: "Input" })
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
const emptyLen = width - filledLen;
|
|
2984
|
-
return /* @__PURE__ */ jsx("box", { children: /* @__PURE__ */ jsx("text", { children: colorCode + barChar.repeat(filledLen) + emptyChar.repeat(emptyLen) + reset + ` ${Math.round(percentage * 100)}%` }) });
|
|
2985
|
-
};
|
|
2986
|
-
}, { name: "ProgressBar" });
|
|
2987
|
-
//#endregion
|
|
2988
|
-
//#region ../runtime-terminal/src/components/Button.tsx
|
|
2989
|
-
/** @jsxImportSource @sigx/runtime-core */
|
|
2990
|
-
var Button = component(({ props, emit }) => {
|
|
2991
|
-
const id = Math.random().toString(36).slice(2);
|
|
2992
|
-
const isFocused = () => focusState.activeId === id;
|
|
2993
|
-
const pressed = signal({ value: false });
|
|
2994
|
-
const handleKey = (key) => {
|
|
2995
|
-
if (!isFocused()) return;
|
|
2996
|
-
if (key === "\r" || key === " ") {
|
|
2997
|
-
pressed.value = true;
|
|
2998
|
-
if (pressTimer) clearTimeout(pressTimer);
|
|
2999
|
-
pressTimer = setTimeout(() => {
|
|
3000
|
-
pressed.value = false;
|
|
3001
|
-
pressTimer = null;
|
|
3002
|
-
}, 120);
|
|
3003
|
-
emit("click");
|
|
3004
|
-
}
|
|
3005
|
-
};
|
|
3006
|
-
let keyCleanup = null;
|
|
3007
|
-
let pressTimer = null;
|
|
3008
|
-
onMounted(() => {
|
|
3009
|
-
registerFocusable(id);
|
|
3010
|
-
keyCleanup = onKey(handleKey);
|
|
3011
|
-
});
|
|
3012
|
-
onUnmounted(() => {
|
|
3013
|
-
if (keyCleanup) keyCleanup();
|
|
3014
|
-
unregisterFocusable(id);
|
|
3015
|
-
if (pressTimer) clearTimeout(pressTimer);
|
|
3016
|
-
});
|
|
3017
|
-
return () => {
|
|
3018
|
-
const focused = isFocused();
|
|
3019
|
-
const label = props.label || "Button";
|
|
3020
|
-
const isPressed = pressed.value;
|
|
3021
|
-
return /* @__PURE__ */ jsx("box", {
|
|
1616
|
+
}, { name: "Input" }), Lt = F(({ props: e }) => () => {
|
|
1617
|
+
let t = e.value || 0, n = e.max || 100, r = e.width || 20, i = e.char || "█", a = e.emptyChar || "░", o = e.color, s = o ? Nt(o) : "", c = o ? "\x1B[0m" : "", l = Math.min(Math.max(t / n, 0), 1), u = Math.round(r * l), d = r - u;
|
|
1618
|
+
return /* @__PURE__ */ G("box", { children: /* @__PURE__ */ G("text", { children: s + i.repeat(u) + a.repeat(d) + c + ` ${Math.round(l * 100)}%` }) });
|
|
1619
|
+
}, { name: "ProgressBar" }), Rt = F(({ props: e, emit: t }) => {
|
|
1620
|
+
let n = Math.random().toString(36).slice(2), r = () => J.activeId === n, i = k({ value: !1 }), a = (e) => {
|
|
1621
|
+
r() && (e === "\r" || e === " ") && (i.value = !0, s && clearTimeout(s), s = setTimeout(() => {
|
|
1622
|
+
i.value = !1, s = null;
|
|
1623
|
+
}, 120), t("click"));
|
|
1624
|
+
}, o = null, s = null;
|
|
1625
|
+
return N(() => {
|
|
1626
|
+
Y(n), o = Jt(a);
|
|
1627
|
+
}), P(() => {
|
|
1628
|
+
o && o(), X(n), s && clearTimeout(s);
|
|
1629
|
+
}), () => {
|
|
1630
|
+
let t = r(), n = e.label || "Button", a = i.value;
|
|
1631
|
+
return /* @__PURE__ */ G("box", {
|
|
3022
1632
|
border: "single",
|
|
3023
|
-
borderColor:
|
|
3024
|
-
backgroundColor:
|
|
3025
|
-
dropShadow:
|
|
3026
|
-
children: /* @__PURE__ */
|
|
3027
|
-
color:
|
|
3028
|
-
children:
|
|
1633
|
+
borderColor: a ? "yellow" : t ? "green" : "white",
|
|
1634
|
+
backgroundColor: a ? "red" : t ? "blue" : void 0,
|
|
1635
|
+
dropShadow: e.dropShadow,
|
|
1636
|
+
children: /* @__PURE__ */ G("text", {
|
|
1637
|
+
color: t ? "white" : void 0,
|
|
1638
|
+
children: n
|
|
3029
1639
|
})
|
|
3030
1640
|
});
|
|
3031
1641
|
};
|
|
3032
|
-
}, { name: "Button" })
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
const id = Math.random().toString(36).slice(2);
|
|
3038
|
-
const isFocused = () => focusState.activeId === id;
|
|
3039
|
-
const checked = () => !!props.model?.value;
|
|
3040
|
-
const handleKey = (key) => {
|
|
3041
|
-
if (!isFocused()) return;
|
|
3042
|
-
if (props.disabled) return;
|
|
3043
|
-
if (key === "\r" || key === " ") {
|
|
3044
|
-
const next = !checked();
|
|
3045
|
-
if (props.model) props.model.value = next;
|
|
3046
|
-
emit("change", next);
|
|
1642
|
+
}, { name: "Button" }), zt = F(({ props: e, emit: t }) => {
|
|
1643
|
+
let n = Math.random().toString(36).slice(2), r = () => J.activeId === n, i = () => !!e.model?.value, a = (n) => {
|
|
1644
|
+
if (r() && !e.disabled && (n === "\r" || n === " ")) {
|
|
1645
|
+
let n = !i();
|
|
1646
|
+
e.model && (e.model.value = n), t("change", n);
|
|
3047
1647
|
}
|
|
3048
|
-
};
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
return () => {
|
|
3060
|
-
const label = props.label || "";
|
|
3061
|
-
const focused = isFocused();
|
|
3062
|
-
const isChecked = checked();
|
|
3063
|
-
const disabled = !!props.disabled;
|
|
3064
|
-
return /* @__PURE__ */ jsxs("box", { children: [
|
|
3065
|
-
/* @__PURE__ */ jsx("text", {
|
|
3066
|
-
color: focused ? "cyan" : "white",
|
|
3067
|
-
children: focused ? ">" : " "
|
|
1648
|
+
}, o = null;
|
|
1649
|
+
return N(() => {
|
|
1650
|
+
Y(n), e.autofocus && At(n), o = Jt(a);
|
|
1651
|
+
}), P(() => {
|
|
1652
|
+
o && o(), X(n);
|
|
1653
|
+
}), () => {
|
|
1654
|
+
let t = e.label || "", n = r(), a = i(), o = !!e.disabled;
|
|
1655
|
+
return /* @__PURE__ */ K("box", { children: [
|
|
1656
|
+
/* @__PURE__ */ G("text", {
|
|
1657
|
+
color: n ? "cyan" : "white",
|
|
1658
|
+
children: n ? ">" : " "
|
|
3068
1659
|
}),
|
|
3069
|
-
/* @__PURE__ */
|
|
3070
|
-
color:
|
|
1660
|
+
/* @__PURE__ */ K("text", {
|
|
1661
|
+
color: o ? "white" : a ? "green" : n ? "cyan" : "white",
|
|
3071
1662
|
children: [
|
|
3072
1663
|
"[",
|
|
3073
|
-
|
|
1664
|
+
a ? "x" : " ",
|
|
3074
1665
|
"]"
|
|
3075
1666
|
]
|
|
3076
1667
|
}),
|
|
3077
|
-
|
|
3078
|
-
color:
|
|
3079
|
-
children: [" ",
|
|
1668
|
+
t && /* @__PURE__ */ K("text", {
|
|
1669
|
+
color: o ? "white" : n ? "cyan" : void 0,
|
|
1670
|
+
children: [" ", t]
|
|
3080
1671
|
})
|
|
3081
1672
|
] });
|
|
3082
1673
|
};
|
|
3083
|
-
}, { name: "Checkbox" })
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
const handleKey = (key) => {
|
|
3096
|
-
if (!isFocused()) return;
|
|
3097
|
-
if (!isReady) return;
|
|
3098
|
-
const options = props.options || [];
|
|
3099
|
-
if (options.length === 0) return;
|
|
3100
|
-
const currentIndex = getCurrentIndex();
|
|
3101
|
-
if (key === "\x1B[A" || key === "k") {
|
|
3102
|
-
const newValue = options[currentIndex > 0 ? currentIndex - 1 : options.length - 1].value;
|
|
3103
|
-
if (props.model) props.model.value = newValue;
|
|
3104
|
-
emit("change", newValue);
|
|
1674
|
+
}, { name: "Checkbox" }), Bt = F(({ props: e, emit: t }) => {
|
|
1675
|
+
let n = Math.random().toString(36).slice(2), r = !1, i = () => J.activeId === n, a = () => {
|
|
1676
|
+
let t = (e.options || []).findIndex((t) => t.value === e.model?.value);
|
|
1677
|
+
return t >= 0 ? t : 0;
|
|
1678
|
+
}, o = (n) => {
|
|
1679
|
+
if (!i() || !r) return;
|
|
1680
|
+
let o = e.options || [];
|
|
1681
|
+
if (o.length === 0) return;
|
|
1682
|
+
let s = a();
|
|
1683
|
+
if (n === "\x1B[A" || n === "k") {
|
|
1684
|
+
let n = o[s > 0 ? s - 1 : o.length - 1].value;
|
|
1685
|
+
e.model && (e.model.value = n), t("change", n);
|
|
3105
1686
|
return;
|
|
3106
1687
|
}
|
|
3107
|
-
if (
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
emit("change", newValue);
|
|
1688
|
+
if (n === "\x1B[B" || n === "j") {
|
|
1689
|
+
let n = o[s < o.length - 1 ? s + 1 : 0].value;
|
|
1690
|
+
e.model && (e.model.value = n), t("change", n);
|
|
3111
1691
|
return;
|
|
3112
1692
|
}
|
|
3113
|
-
if (
|
|
3114
|
-
|
|
1693
|
+
if (n === "\r") {
|
|
1694
|
+
t("submit", e.model?.value || o[0]?.value || "");
|
|
3115
1695
|
return;
|
|
3116
1696
|
}
|
|
3117
|
-
};
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
if (props.autofocus) focus(id);
|
|
3122
|
-
keyCleanup = onKey(handleKey);
|
|
3123
|
-
setTimeout(() => {
|
|
3124
|
-
isReady = true;
|
|
1697
|
+
}, s = null;
|
|
1698
|
+
return N(() => {
|
|
1699
|
+
Y(n), e.autofocus && At(n), s = Jt(o), setTimeout(() => {
|
|
1700
|
+
r = !0;
|
|
3125
1701
|
}, 50);
|
|
3126
|
-
})
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
const focused = isFocused();
|
|
3134
|
-
const currentValue = props.model?.value || options[0]?.value || "";
|
|
3135
|
-
const label = props.label;
|
|
3136
|
-
const selectedOption = options.find((o) => o.value === currentValue);
|
|
3137
|
-
const optionElements = options.map((option) => {
|
|
3138
|
-
const isSelected = option.value === currentValue;
|
|
3139
|
-
return /* @__PURE__ */ jsx("box", { children: /* @__PURE__ */ jsxs("text", {
|
|
3140
|
-
color: isSelected ? "cyan" : "white",
|
|
1702
|
+
}), P(() => {
|
|
1703
|
+
s && s(), X(n);
|
|
1704
|
+
}), () => {
|
|
1705
|
+
let t = e.options || [], n = i(), r = e.model?.value || t[0]?.value || "", a = e.label, o = t.find((e) => e.value === r), s = t.map((e) => {
|
|
1706
|
+
let t = e.value === r;
|
|
1707
|
+
return /* @__PURE__ */ G("box", { children: /* @__PURE__ */ K("text", {
|
|
1708
|
+
color: t ? "cyan" : "white",
|
|
3141
1709
|
children: [
|
|
3142
|
-
|
|
1710
|
+
t ? "❯" : " ",
|
|
3143
1711
|
" ",
|
|
3144
|
-
|
|
1712
|
+
e.label
|
|
3145
1713
|
]
|
|
3146
1714
|
}) });
|
|
3147
|
-
})
|
|
3148
|
-
const descriptionElement = props.showDescription && selectedOption?.description ? /* @__PURE__ */ jsx("box", { children: /* @__PURE__ */ jsxs("text", {
|
|
1715
|
+
}), c = e.showDescription && o?.description ? /* @__PURE__ */ G("box", { children: /* @__PURE__ */ K("text", {
|
|
3149
1716
|
color: "#666666",
|
|
3150
|
-
children: [" ↳ ",
|
|
1717
|
+
children: [" ↳ ", o.description]
|
|
3151
1718
|
}) }) : null;
|
|
3152
|
-
return /* @__PURE__ */
|
|
1719
|
+
return /* @__PURE__ */ K("box", { children: [/* @__PURE__ */ G("box", {
|
|
3153
1720
|
border: "single",
|
|
3154
|
-
borderColor:
|
|
3155
|
-
label,
|
|
3156
|
-
children:
|
|
3157
|
-
}),
|
|
3158
|
-
};
|
|
3159
|
-
}, { name: "Select" })
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
el.props[key] = next;
|
|
3163
|
-
scheduleRender();
|
|
1721
|
+
borderColor: n ? "green" : "white",
|
|
1722
|
+
label: a,
|
|
1723
|
+
children: s
|
|
1724
|
+
}), c] });
|
|
1725
|
+
};
|
|
1726
|
+
}, { name: "Select" }), { render: Z } = kt({
|
|
1727
|
+
patchProp: (e, t, n, r) => {
|
|
1728
|
+
e.props[t] = r, $();
|
|
3164
1729
|
},
|
|
3165
|
-
insert: (
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
else parent.children.push(child);
|
|
3170
|
-
scheduleRender();
|
|
1730
|
+
insert: (e, t, n) => {
|
|
1731
|
+
e.parentNode = t;
|
|
1732
|
+
let r = n ? t.children.indexOf(n) : -1;
|
|
1733
|
+
r > -1 ? t.children.splice(r, 0, e) : t.children.push(e), $();
|
|
3171
1734
|
},
|
|
3172
|
-
remove: (
|
|
3173
|
-
if (
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
child.parentNode = null;
|
|
1735
|
+
remove: (e) => {
|
|
1736
|
+
if (e.parentNode) {
|
|
1737
|
+
let t = e.parentNode.children.indexOf(e);
|
|
1738
|
+
t > -1 && e.parentNode.children.splice(t, 1), e.parentNode = null;
|
|
3177
1739
|
}
|
|
3178
|
-
|
|
1740
|
+
$();
|
|
3179
1741
|
},
|
|
3180
|
-
createElement: (
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
props: {},
|
|
3201
|
-
children: []
|
|
3202
|
-
};
|
|
3203
|
-
},
|
|
3204
|
-
setText: (node, text) => {
|
|
3205
|
-
node.text = text;
|
|
3206
|
-
scheduleRender();
|
|
1742
|
+
createElement: (e) => ({
|
|
1743
|
+
type: "element",
|
|
1744
|
+
tag: e,
|
|
1745
|
+
props: {},
|
|
1746
|
+
children: []
|
|
1747
|
+
}),
|
|
1748
|
+
createText: (e) => ({
|
|
1749
|
+
type: "text",
|
|
1750
|
+
text: e,
|
|
1751
|
+
props: {},
|
|
1752
|
+
children: []
|
|
1753
|
+
}),
|
|
1754
|
+
createComment: (e) => ({
|
|
1755
|
+
type: "comment",
|
|
1756
|
+
text: e,
|
|
1757
|
+
props: {},
|
|
1758
|
+
children: []
|
|
1759
|
+
}),
|
|
1760
|
+
setText: (e, t) => {
|
|
1761
|
+
e.text = t, $();
|
|
3207
1762
|
},
|
|
3208
|
-
setElementText: (
|
|
3209
|
-
|
|
1763
|
+
setElementText: (e, t) => {
|
|
1764
|
+
e.children = [{
|
|
3210
1765
|
type: "text",
|
|
3211
|
-
text,
|
|
1766
|
+
text: t,
|
|
3212
1767
|
props: {},
|
|
3213
1768
|
children: [],
|
|
3214
|
-
parentNode:
|
|
3215
|
-
}];
|
|
3216
|
-
scheduleRender();
|
|
1769
|
+
parentNode: e
|
|
1770
|
+
}], $();
|
|
3217
1771
|
},
|
|
3218
|
-
parentNode: (
|
|
3219
|
-
nextSibling: (
|
|
3220
|
-
if (!
|
|
3221
|
-
|
|
3222
|
-
return
|
|
1772
|
+
parentNode: (e) => e.parentNode || null,
|
|
1773
|
+
nextSibling: (e) => {
|
|
1774
|
+
if (!e.parentNode) return null;
|
|
1775
|
+
let t = e.parentNode.children.indexOf(e);
|
|
1776
|
+
return e.parentNode.children[t + 1] || null;
|
|
3223
1777
|
},
|
|
3224
|
-
cloneNode: (
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
setTimeout(() => {
|
|
3237
|
-
flushRender();
|
|
3238
|
-
isRendering = false;
|
|
3239
|
-
}, 10);
|
|
3240
|
-
}
|
|
3241
|
-
function flushRender() {
|
|
3242
|
-
if (!rootNode) return;
|
|
1778
|
+
cloneNode: (e) => ({
|
|
1779
|
+
...e,
|
|
1780
|
+
children: []
|
|
1781
|
+
})
|
|
1782
|
+
}), Q = null, Vt = !1;
|
|
1783
|
+
function $() {
|
|
1784
|
+
Vt || (Vt = !0, setTimeout(() => {
|
|
1785
|
+
Ht(), Vt = !1;
|
|
1786
|
+
}, 10));
|
|
1787
|
+
}
|
|
1788
|
+
function Ht() {
|
|
1789
|
+
if (!Q) return;
|
|
3243
1790
|
process.stdout.write("\x1B[H");
|
|
3244
|
-
|
|
3245
|
-
process.stdout.write(
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
if (node.type === "text") return [node.text || ""];
|
|
3258
|
-
if (node.type === "comment") return [];
|
|
3259
|
-
let lines = [""];
|
|
3260
|
-
const color = node.props.color;
|
|
3261
|
-
const reset = color ? "\x1B[0m" : "";
|
|
3262
|
-
const colorCode = getColorCode(color);
|
|
3263
|
-
for (const child of node.children) if (child.type === "text") lines[lines.length - 1] += colorCode + (child.text || "") + reset;
|
|
3264
|
-
else if (child.tag === "br") lines.push("");
|
|
1791
|
+
let e = Wt(Q);
|
|
1792
|
+
process.stdout.write(e.join("\x1B[K\n") + "\x1B[K"), process.stdout.write("\x1B[J");
|
|
1793
|
+
}
|
|
1794
|
+
function Ut(e) {
|
|
1795
|
+
for (let t of e.children) if (t.tag === "box") return !0;
|
|
1796
|
+
return !1;
|
|
1797
|
+
}
|
|
1798
|
+
function Wt(e) {
|
|
1799
|
+
if (e.type === "text") return [e.text || ""];
|
|
1800
|
+
if (e.type === "comment") return [];
|
|
1801
|
+
let t = [""], n = e.props.color, r = n ? "\x1B[0m" : "", i = Nt(n);
|
|
1802
|
+
for (let n of e.children) if (n.type === "text") t[t.length - 1] += i + (n.text || "") + r;
|
|
1803
|
+
else if (n.tag === "br") t.push("");
|
|
3265
1804
|
else {
|
|
3266
|
-
|
|
3267
|
-
if (
|
|
3268
|
-
else
|
|
3269
|
-
else if (childLines.length > 0) if (childLines.length > 1) if (lines.length === 1 && lines[0] === "") lines = childLines;
|
|
3270
|
-
else lines.push(...childLines);
|
|
1805
|
+
let e = Wt(n);
|
|
1806
|
+
if (n.tag === "box" || Ut(n)) t.length === 1 && t[0] === "" ? t = e : t.push(...e);
|
|
1807
|
+
else if (e.length > 0) if (e.length > 1) t.length === 1 && t[0] === "" ? t = e : t.push(...e);
|
|
3271
1808
|
else {
|
|
3272
|
-
|
|
3273
|
-
for (let
|
|
1809
|
+
t[t.length - 1] += e[0];
|
|
1810
|
+
for (let n = 1; n < e.length; n++) t.push(e[n]);
|
|
3274
1811
|
}
|
|
3275
1812
|
}
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
if (labelText) {
|
|
3290
|
-
const spaceForLabel = boxInnerWidth - labelLength - 2;
|
|
3291
|
-
const leftH = Math.floor(spaceForLabel / 2);
|
|
3292
|
-
const rightH = spaceForLabel - leftH;
|
|
3293
|
-
topInner = borderChars.h.repeat(leftH) + " " + labelText + " " + borderChars.h.repeat(rightH);
|
|
3294
|
-
} else topInner = borderChars.h.repeat(boxInnerWidth);
|
|
3295
|
-
const top = bgCode + colorCode + borderChars.tl + topInner + borderChars.tr + reset;
|
|
3296
|
-
const bottom = bgCode + colorCode + borderChars.bl + borderChars.h.repeat(boxInnerWidth) + borderChars.br + reset;
|
|
3297
|
-
const result = [];
|
|
3298
|
-
result.push(top);
|
|
3299
|
-
for (const line of contentLines) {
|
|
3300
|
-
const visibleLength = stripAnsi(line).length;
|
|
3301
|
-
const padding = " ".repeat(boxInnerWidth - visibleLength);
|
|
3302
|
-
const lineWithBg = bgCode + line.replace(/\x1b\[0m/g, `\x1b[0m${bgCode}`);
|
|
3303
|
-
result.push(bgCode + colorCode + borderChars.v + reset + lineWithBg + bgCode + padding + colorCode + borderChars.v + reset);
|
|
1813
|
+
return e.tag === "box" && e.props.border ? Gt(t, e.props.border, e.props.borderColor, e.props.backgroundColor, e.props.dropShadow, e.props.label) : t;
|
|
1814
|
+
}
|
|
1815
|
+
function Gt(e, t, n, r, i, a) {
|
|
1816
|
+
let o = Kt(t), s = n ? Nt(n) : "", c = r ? Pt(r) : "", l = n || r ? "\x1B[0m" : "", u = e.reduce((e, t) => Math.max(e, Ft(t).length), 0), d = a || "", f = Ft(d).length, p = Math.max(u, f + 2), m = "";
|
|
1817
|
+
if (d) {
|
|
1818
|
+
let e = p - f - 2, t = Math.floor(e / 2), n = e - t;
|
|
1819
|
+
m = o.h.repeat(t) + " " + d + " " + o.h.repeat(n);
|
|
1820
|
+
} else m = o.h.repeat(p);
|
|
1821
|
+
let h = c + s + o.tl + m + o.tr + l, g = c + s + o.bl + o.h.repeat(p) + o.br + l, _ = [];
|
|
1822
|
+
_.push(h);
|
|
1823
|
+
for (let t of e) {
|
|
1824
|
+
let e = Ft(t).length, n = " ".repeat(p - e), r = c + t.replace(/\x1b\[0m/g, `\x1b[0m${c}`);
|
|
1825
|
+
_.push(c + s + o.v + l + r + c + n + s + o.v + l);
|
|
3304
1826
|
}
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
result.push(bottomShadow);
|
|
1827
|
+
if (_.push(g), i) {
|
|
1828
|
+
let e = "\x1B[90m▒\x1B[0m";
|
|
1829
|
+
for (let t = 1; t < _.length; t++) _[t] += e;
|
|
1830
|
+
let t = " " + e.repeat(u + 2);
|
|
1831
|
+
_.push(t);
|
|
3311
1832
|
}
|
|
3312
|
-
return
|
|
1833
|
+
return _;
|
|
3313
1834
|
}
|
|
3314
|
-
function
|
|
3315
|
-
|
|
1835
|
+
function Kt(e) {
|
|
1836
|
+
return e === "double" ? {
|
|
3316
1837
|
tl: "╔",
|
|
3317
1838
|
tr: "╗",
|
|
3318
1839
|
bl: "╚",
|
|
3319
1840
|
br: "╝",
|
|
3320
1841
|
h: "═",
|
|
3321
1842
|
v: "║"
|
|
3322
|
-
}
|
|
3323
|
-
if (style === "rounded") return {
|
|
1843
|
+
} : e === "rounded" ? {
|
|
3324
1844
|
tl: "╭",
|
|
3325
1845
|
tr: "╮",
|
|
3326
1846
|
bl: "╰",
|
|
3327
1847
|
br: "╯",
|
|
3328
1848
|
h: "─",
|
|
3329
1849
|
v: "│"
|
|
3330
|
-
}
|
|
3331
|
-
return {
|
|
1850
|
+
} : {
|
|
3332
1851
|
tl: "┌",
|
|
3333
1852
|
tr: "┐",
|
|
3334
1853
|
bl: "└",
|
|
@@ -3337,126 +1856,58 @@ function getBorderChars(style) {
|
|
|
3337
1856
|
v: "│"
|
|
3338
1857
|
};
|
|
3339
1858
|
}
|
|
3340
|
-
var
|
|
3341
|
-
function
|
|
3342
|
-
|
|
3343
|
-
return () => keyHandlers.delete(handler);
|
|
1859
|
+
var qt = /* @__PURE__ */ new Set();
|
|
1860
|
+
function Jt(e) {
|
|
1861
|
+
return qt.add(e), () => qt.delete(e);
|
|
3344
1862
|
}
|
|
3345
|
-
function
|
|
3346
|
-
if (
|
|
3347
|
-
|
|
3348
|
-
process.exit();
|
|
3349
|
-
}
|
|
3350
|
-
if (key === " ") {
|
|
3351
|
-
focusNext();
|
|
1863
|
+
function Yt(e) {
|
|
1864
|
+
if (e === "" && (process.stdout.write("\x1B[?25h"), process.exit()), e === " ") {
|
|
1865
|
+
jt();
|
|
3352
1866
|
return;
|
|
3353
1867
|
}
|
|
3354
|
-
if (
|
|
3355
|
-
|
|
1868
|
+
if (e === "\x1B[Z") {
|
|
1869
|
+
Mt();
|
|
3356
1870
|
return;
|
|
3357
1871
|
}
|
|
3358
|
-
for (
|
|
1872
|
+
for (let t of qt) t(e);
|
|
3359
1873
|
}
|
|
3360
|
-
function
|
|
3361
|
-
|
|
1874
|
+
function Xt(e, t = {}) {
|
|
1875
|
+
Q = {
|
|
3362
1876
|
type: "root",
|
|
3363
1877
|
props: {},
|
|
3364
1878
|
children: []
|
|
3365
1879
|
};
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
process.stdin.setRawMode(
|
|
3369
|
-
process.stdin.resume();
|
|
3370
|
-
process.stdin.setEncoding("utf8");
|
|
3371
|
-
process.stdin.on("data", handleInput);
|
|
3372
|
-
}
|
|
3373
|
-
if (options.clearConsole) process.stdout.write("\x1B[2J\x1B[3J\x1B[H");
|
|
3374
|
-
process.stdout.write("\x1B[?25l");
|
|
3375
|
-
render(app, container);
|
|
3376
|
-
flushRender();
|
|
3377
|
-
return { unmount: () => {
|
|
3378
|
-
render(null, container);
|
|
3379
|
-
process.stdout.write("\x1B[?25h");
|
|
3380
|
-
if (process.stdin.isTTY) {
|
|
3381
|
-
process.stdin.setRawMode(false);
|
|
3382
|
-
process.stdin.pause();
|
|
3383
|
-
process.stdin.off("data", handleInput);
|
|
3384
|
-
}
|
|
1880
|
+
let n = Q;
|
|
1881
|
+
return process.stdin.isTTY && (process.stdin.setRawMode(!0), process.stdin.resume(), process.stdin.setEncoding("utf8"), process.stdin.on("data", Yt)), t.clearConsole && process.stdout.write("\x1B[2J\x1B[3J\x1B[H"), process.stdout.write("\x1B[?25l"), Z(e, n), Ht(), { unmount: () => {
|
|
1882
|
+
Z(null, n), process.stdout.write("\x1B[?25h"), process.stdin.isTTY && (process.stdin.setRawMode(!1), process.stdin.pause(), process.stdin.off("data", Yt));
|
|
3385
1883
|
} };
|
|
3386
1884
|
}
|
|
3387
|
-
var
|
|
3388
|
-
|
|
3389
|
-
* Helper function to mount the terminal for CLI apps.
|
|
3390
|
-
* Returns a mount target that can be passed to defineApp().mount().
|
|
3391
|
-
*
|
|
3392
|
-
* @example
|
|
3393
|
-
* ```tsx
|
|
3394
|
-
* defineApp(MyApp).mount(mountTerminal());
|
|
3395
|
-
* ```
|
|
3396
|
-
*/
|
|
3397
|
-
function mountTerminal(options = { clearConsole: true }) {
|
|
1885
|
+
var Zt = null;
|
|
1886
|
+
function Qt(e = { clearConsole: !0 }) {
|
|
3398
1887
|
return {
|
|
3399
|
-
mount:
|
|
3400
|
-
options,
|
|
3401
|
-
onMount: (
|
|
3402
|
-
|
|
1888
|
+
mount: en,
|
|
1889
|
+
options: e,
|
|
1890
|
+
onMount: (e) => {
|
|
1891
|
+
Zt = e;
|
|
3403
1892
|
}
|
|
3404
1893
|
};
|
|
3405
1894
|
}
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
unmountFn();
|
|
3412
|
-
unmountFn = null;
|
|
3413
|
-
}
|
|
3414
|
-
process.stdout.write("\x1B[?25h");
|
|
3415
|
-
process.stdout.write("\x1B[2J\x1B[H");
|
|
3416
|
-
}
|
|
3417
|
-
/**
|
|
3418
|
-
* Mount function for Terminal environments.
|
|
3419
|
-
* Use this with defineApp().mount() to render to the terminal.
|
|
3420
|
-
*
|
|
3421
|
-
* @example
|
|
3422
|
-
* ```tsx
|
|
3423
|
-
* import { defineApp } from '@sigx/runtime-core';
|
|
3424
|
-
* import { terminalMount } from '@sigx/runtime-terminal';
|
|
3425
|
-
*
|
|
3426
|
-
* const app = defineApp(<Counter />);
|
|
3427
|
-
* app.use(loggingPlugin)
|
|
3428
|
-
* .mount({ clearConsole: true }, terminalMount);
|
|
3429
|
-
* ```
|
|
3430
|
-
*/
|
|
3431
|
-
var terminalMount = (component, options, appContext) => {
|
|
3432
|
-
rootNode = {
|
|
1895
|
+
function $t() {
|
|
1896
|
+
Zt &&= (Zt(), null), process.stdout.write("\x1B[?25h"), process.stdout.write("\x1B[2J\x1B[H");
|
|
1897
|
+
}
|
|
1898
|
+
var en = (e, t, n) => {
|
|
1899
|
+
Q = {
|
|
3433
1900
|
type: "root",
|
|
3434
1901
|
props: {},
|
|
3435
1902
|
children: []
|
|
3436
1903
|
};
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
process.stdin.setRawMode(
|
|
3440
|
-
process.stdin.resume();
|
|
3441
|
-
process.stdin.setEncoding("utf8");
|
|
3442
|
-
process.stdin.on("data", handleInput);
|
|
3443
|
-
}
|
|
3444
|
-
if (options?.clearConsole) process.stdout.write("\x1B[2J\x1B[3J\x1B[H");
|
|
3445
|
-
process.stdout.write("\x1B[?25l");
|
|
3446
|
-
render(component, container, appContext);
|
|
3447
|
-
flushRender();
|
|
3448
|
-
return () => {
|
|
3449
|
-
render(null, container);
|
|
3450
|
-
process.stdout.write("\x1B[?25h");
|
|
3451
|
-
if (process.stdin.isTTY) {
|
|
3452
|
-
process.stdin.setRawMode(false);
|
|
3453
|
-
process.stdin.pause();
|
|
3454
|
-
process.stdin.off("data", handleInput);
|
|
3455
|
-
}
|
|
1904
|
+
let r = Q;
|
|
1905
|
+
return process.stdin.isTTY && (process.stdin.setRawMode(!0), process.stdin.resume(), process.stdin.setEncoding("utf8"), process.stdin.on("data", Yt)), t?.clearConsole && process.stdout.write("\x1B[2J\x1B[3J\x1B[H"), process.stdout.write("\x1B[?25l"), Z(e, r, n), Ht(), () => {
|
|
1906
|
+
Z(null, r), process.stdout.write("\x1B[?25h"), process.stdin.isTTY && (process.stdin.setRawMode(!1), process.stdin.pause(), process.stdin.off("data", Yt));
|
|
3456
1907
|
};
|
|
3457
1908
|
};
|
|
3458
|
-
|
|
1909
|
+
He(en);
|
|
3459
1910
|
//#endregion
|
|
3460
|
-
export { Button, CLIENT_DIRECTIVES, CLIENT_DIRECTIVE_PREFIX, Checkbox, Comment, ComputedSymbol, ErrorBoundary, Fragment, Input, InstanceLifetimes, ProgressBar, Select, SigxError, SigxErrorCode, SubscriptionHandler, Suspense, Text, Utils, asyncSetupClientError, batch, component, compound, computed, createModel, createModelFromBinding, createTopic, defineApp, defineDirective, defineFactory, defineInjectable, defineProvide, detectAccess, effect, effectScope, exitTerminal, focus, focusNext, focusPrev, focusState, getComponentMeta, getCurrentInstance, guid, isComponent, isComputed, isDirective, isLazyComponent, isModel, isReactive, jsx, jsxDEV, jsxs, lazy, mountTargetNotFoundError, mountTerminal, noMountFunctionError, onCreated, onKey, onMounted, onUnmounted, onUpdated, provideInvalidInjectableError, provideOutsideSetupError, registerFocusable, render, renderNodeToLines, renderTargetNotFoundError, renderTerminal, signal, terminalMount, toRaw, toSubscriber, unregisterFocusable, untrack, useAppContext, useAsync, watch };
|
|
1911
|
+
export { Rt as Button, Dt as CLIENT_DIRECTIVES, Et as CLIENT_DIRECTIVE_PREFIX, zt as Checkbox, U as Comment, t as ComputedSymbol, mt as ErrorBoundary, V as Fragment, It as Input, vt as InstanceLifetimes, Lt as ProgressBar, Bt as Select, I as SigxError, L as SigxErrorCode, xt as SubscriptionHandler, dt as Suspense, H as Text, ht as Utils, Ee as asyncSetupClientError, s as batch, F as component, Xe as compound, ie as computed, Qe as createModel, $e as createModelFromBinding, yt as createTopic, Ue as defineApp, ze as defineDirective, St as defineFactory, Ne as defineInjectable, Pe as defineProvide, D as detectAccess, f as effect, m as effectScope, $t as exitTerminal, At as focus, jt as focusNext, Mt as focusPrev, J as focusState, Se as getComponentMeta, _e as getCurrentInstance, _t as guid, B as isComponent, j as isComputed, Be as isDirective, ft as isLazyComponent, z as isModel, ee as isReactive, G as jsx, st as jsxDEV, K as jsxs, ut as lazy, Te as mountTargetNotFoundError, Qt as mountTerminal, Ce as noMountFunctionError, ye as onCreated, Jt as onKey, N as onMounted, P as onUnmounted, be as onUpdated, Oe as provideInvalidInjectableError, De as provideOutsideSetupError, Y as registerFocusable, Z as render, Wt as renderNodeToLines, we as renderTargetNotFoundError, Xt as renderTerminal, k as signal, en as terminalMount, v as toRaw, bt as toSubscriber, X as unregisterFocusable, p as untrack, Fe as useAppContext, pt as useAsync, re as watch };
|
|
3461
1912
|
|
|
3462
1913
|
//# sourceMappingURL=index.js.map
|