@tachui/core 0.8.0-alpha → 0.8.1-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -2
- package/dist/bundles/assets.d.ts +19 -0
- package/dist/bundles/assets.d.ts.map +1 -0
- package/dist/bundles/context.d.ts +22 -0
- package/dist/bundles/context.d.ts.map +1 -0
- package/dist/bundles/minimal.d.ts +6 -2
- package/dist/bundles/minimal.d.ts.map +1 -1
- package/dist/common.js +394 -393
- package/dist/compiler/codegen.d.ts.map +1 -1
- package/dist/compiler/index.js +6 -1393
- package/dist/compiler/parser.d.ts +1 -1
- package/dist/compiler/parser.d.ts.map +1 -1
- package/dist/compiler/plugin.d.ts.map +1 -1
- package/dist/compiler/types.d.ts +28 -0
- package/dist/compiler/types.d.ts.map +1 -1
- package/dist/essential.js +394 -393
- package/dist/{index-DCPJFUm9.js → index-DEBd8cq7.js} +315 -578
- package/dist/index.js +394 -393
- package/dist/minimal.js +112 -98
- package/dist/observed-object-Cos-FtjP.js +269 -0
- package/dist/plugin-BCAdZXKq.js +1680 -0
- package/dist/runtime/concatenation-aria.d.ts +24 -0
- package/dist/runtime/concatenation-aria.d.ts.map +1 -0
- package/dist/runtime/concatenation-aria.js +53 -0
- package/dist/runtime/concatenation-full.d.ts +30 -0
- package/dist/runtime/concatenation-full.d.ts.map +1 -0
- package/dist/runtime/concatenation-full.js +77 -0
- package/dist/runtime/concatenation-minimal.d.ts +25 -0
- package/dist/runtime/concatenation-minimal.d.ts.map +1 -0
- package/dist/runtime/concatenation-minimal.js +40 -0
- package/package.json +24 -4
|
@@ -1,133 +1,134 @@
|
|
|
1
1
|
import { infinity as c } from "./constants/layout.js";
|
|
2
|
-
import { LayoutModifier as
|
|
3
|
-
import { C as
|
|
4
|
-
import { a as
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
2
|
+
import { LayoutModifier as l } from "./modifiers/base.js";
|
|
3
|
+
import { C as b, u as D } from "./concatenated-component-ByPl3_FF.js";
|
|
4
|
+
import { a as j, j as z, R as I, L as A, v as G } from "./production-minimal-BY_gMc-l.js";
|
|
5
|
+
import { p as P, E as k } from "./observed-object-Cos-FtjP.js";
|
|
6
|
+
import "./scheduler-BKeqwrYE.js";
|
|
7
|
+
import "typescript";
|
|
8
8
|
import "./component-XAzF1xqs.js";
|
|
9
9
|
import "./index-vdsiw6gQ.js";
|
|
10
|
+
import "./dom-bridge-CAa1N2zX.js";
|
|
10
11
|
import "./component-base-x2XmHFjy.js";
|
|
11
12
|
import "./plugins/index.js";
|
|
12
13
|
import "./validation/index.js";
|
|
13
|
-
function
|
|
14
|
-
return new
|
|
14
|
+
function le() {
|
|
15
|
+
return new l({
|
|
15
16
|
frame: {
|
|
16
17
|
maxWidth: c
|
|
17
18
|
}
|
|
18
19
|
});
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
-
return new
|
|
21
|
+
function de() {
|
|
22
|
+
return new l({
|
|
22
23
|
frame: {
|
|
23
24
|
maxHeight: c
|
|
24
25
|
}
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
-
return new
|
|
28
|
+
function pe() {
|
|
29
|
+
return new l({
|
|
29
30
|
frame: {
|
|
30
31
|
maxWidth: c,
|
|
31
32
|
maxHeight: c
|
|
32
33
|
}
|
|
33
34
|
});
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
-
return new
|
|
36
|
+
function he() {
|
|
37
|
+
return new l({
|
|
37
38
|
frame: {
|
|
38
39
|
width: c,
|
|
39
40
|
height: c
|
|
40
41
|
}
|
|
41
42
|
});
|
|
42
43
|
}
|
|
43
|
-
function
|
|
44
|
-
return new
|
|
44
|
+
function ge(r) {
|
|
45
|
+
return new l({
|
|
45
46
|
frame: {
|
|
46
|
-
width:
|
|
47
|
+
width: r,
|
|
47
48
|
maxHeight: c
|
|
48
49
|
}
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
|
-
function
|
|
52
|
-
return new
|
|
52
|
+
function me(r) {
|
|
53
|
+
return new l({
|
|
53
54
|
frame: {
|
|
54
|
-
height:
|
|
55
|
+
height: r,
|
|
55
56
|
maxWidth: c
|
|
56
57
|
}
|
|
57
58
|
});
|
|
58
59
|
}
|
|
59
|
-
function
|
|
60
|
-
return new
|
|
60
|
+
function fe(r, e) {
|
|
61
|
+
return new l({
|
|
61
62
|
frame: {
|
|
62
63
|
width: c,
|
|
63
64
|
height: c,
|
|
64
|
-
maxWidth:
|
|
65
|
+
maxWidth: r,
|
|
65
66
|
maxHeight: e
|
|
66
67
|
}
|
|
67
68
|
});
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
-
return new
|
|
70
|
+
function be(r, e, t, n) {
|
|
71
|
+
return new l({
|
|
71
72
|
frame: {
|
|
72
73
|
width: c,
|
|
73
74
|
height: c,
|
|
74
|
-
minWidth:
|
|
75
|
+
minWidth: r,
|
|
75
76
|
maxWidth: e,
|
|
76
77
|
minHeight: t,
|
|
77
|
-
maxHeight:
|
|
78
|
+
maxHeight: n
|
|
78
79
|
}
|
|
79
80
|
});
|
|
80
81
|
}
|
|
81
|
-
function
|
|
82
|
-
return new
|
|
82
|
+
function ye() {
|
|
83
|
+
return new l({
|
|
83
84
|
frame: {
|
|
84
85
|
maxWidth: c,
|
|
85
86
|
maxHeight: c
|
|
86
87
|
}
|
|
87
88
|
});
|
|
88
89
|
}
|
|
89
|
-
function
|
|
90
|
-
return new
|
|
90
|
+
function Se() {
|
|
91
|
+
return new l({
|
|
91
92
|
frame: {
|
|
92
93
|
width: "100vw",
|
|
93
94
|
height: "100vh"
|
|
94
95
|
}
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
|
-
function
|
|
98
|
-
return new
|
|
98
|
+
function ve() {
|
|
99
|
+
return new l({
|
|
99
100
|
frame: {
|
|
100
101
|
width: c,
|
|
101
102
|
height: c
|
|
102
103
|
}
|
|
103
104
|
});
|
|
104
105
|
}
|
|
105
|
-
function
|
|
106
|
-
return new
|
|
106
|
+
function we() {
|
|
107
|
+
return new l({
|
|
107
108
|
frame: {
|
|
108
109
|
width: c
|
|
109
110
|
}
|
|
110
111
|
});
|
|
111
112
|
}
|
|
112
|
-
const
|
|
113
|
-
function
|
|
114
|
-
return
|
|
113
|
+
const Ce = Symbol.for("tachui.concat");
|
|
114
|
+
function xe(r) {
|
|
115
|
+
return r && typeof r == "object" && typeof r.isConcatenatable == "function" && r.isConcatenatable();
|
|
115
116
|
}
|
|
116
|
-
function
|
|
117
|
-
return
|
|
117
|
+
function Oe(r) {
|
|
118
|
+
return r && typeof r == "object" && r.constructor.name === "ConcatenatedComponent";
|
|
118
119
|
}
|
|
119
|
-
const
|
|
120
|
-
class
|
|
120
|
+
const _e = Symbol.for("tachui.concat");
|
|
121
|
+
class Me {
|
|
121
122
|
/**
|
|
122
123
|
* Concatenate this component with another concatenatable component
|
|
123
124
|
*/
|
|
124
125
|
concat(e) {
|
|
125
|
-
const t = this.toSegment(),
|
|
126
|
-
return e instanceof
|
|
126
|
+
const t = this.toSegment(), n = e.toSegment();
|
|
127
|
+
return e instanceof b ? new b(
|
|
127
128
|
[t, ...e.segments],
|
|
128
129
|
this.mergeMetadata(e.metadata, e.segments.length + 1)
|
|
129
|
-
) : new
|
|
130
|
-
[t,
|
|
130
|
+
) : new b(
|
|
131
|
+
[t, n],
|
|
131
132
|
this.createMetadata(2)
|
|
132
133
|
);
|
|
133
134
|
}
|
|
@@ -186,10 +187,10 @@ class Ke {
|
|
|
186
187
|
return t === "inline" && e === "inline" ? "inline" : t === "block" && e === "block" ? "block" : "mixed";
|
|
187
188
|
}
|
|
188
189
|
}
|
|
189
|
-
function
|
|
190
|
-
const e =
|
|
190
|
+
function Ee(r) {
|
|
191
|
+
const e = r;
|
|
191
192
|
return e.concat = function(t) {
|
|
192
|
-
const
|
|
193
|
+
const n = {
|
|
193
194
|
id: this.id,
|
|
194
195
|
component: this,
|
|
195
196
|
modifiers: this.modifiers || [],
|
|
@@ -198,15 +199,15 @@ function Je(n) {
|
|
|
198
199
|
return Array.isArray(s) ? s[0] : s;
|
|
199
200
|
}
|
|
200
201
|
}, i = t.toSegment();
|
|
201
|
-
return t instanceof
|
|
202
|
-
[
|
|
202
|
+
return t instanceof b ? new b(
|
|
203
|
+
[n, ...t.segments],
|
|
203
204
|
{
|
|
204
205
|
totalSegments: t.segments.length + 1,
|
|
205
206
|
accessibilityRole: "group",
|
|
206
207
|
semanticStructure: "mixed"
|
|
207
208
|
}
|
|
208
|
-
) : new
|
|
209
|
-
[
|
|
209
|
+
) : new b(
|
|
210
|
+
[n, i],
|
|
210
211
|
{
|
|
211
212
|
totalSegments: 2,
|
|
212
213
|
accessibilityRole: "group",
|
|
@@ -227,8 +228,8 @@ function Je(n) {
|
|
|
227
228
|
return !0;
|
|
228
229
|
}, e;
|
|
229
230
|
}
|
|
230
|
-
const
|
|
231
|
-
class
|
|
231
|
+
const p = /* @__PURE__ */ new Map(), N = 300 * 1e3, E = 100;
|
|
232
|
+
class Te {
|
|
232
233
|
/**
|
|
233
234
|
* Optimize an array of segments by merging compatible adjacent text segments
|
|
234
235
|
* Enhanced with caching and performance monitoring
|
|
@@ -236,23 +237,23 @@ class Xe {
|
|
|
236
237
|
static optimize(e) {
|
|
237
238
|
const t = performance.now();
|
|
238
239
|
if (e.length < 2) return e;
|
|
239
|
-
const
|
|
240
|
+
const n = this.generateCacheKey(e), i = this.getCachedOptimization(n);
|
|
240
241
|
if (i)
|
|
241
242
|
return i.optimizedSegments;
|
|
242
243
|
const s = this.performOptimization(e), a = performance.now() - t, o = {
|
|
243
244
|
...this.getOptimizationStats(e, s),
|
|
244
245
|
processingTimeMs: a
|
|
245
246
|
};
|
|
246
|
-
return this.cacheOptimization(
|
|
247
|
+
return this.cacheOptimization(n, s, o), process.env.NODE_ENV === "development" && a > 5 && console.log(`TachUI Concatenation: Optimization took ${a.toFixed(2)}ms for ${e.length} segments`), s;
|
|
247
248
|
}
|
|
248
249
|
/**
|
|
249
250
|
* Core optimization algorithm separated for clarity
|
|
250
251
|
*/
|
|
251
252
|
static performOptimization(e) {
|
|
252
253
|
const t = [];
|
|
253
|
-
for (const
|
|
254
|
+
for (const n of e) {
|
|
254
255
|
const i = t[t.length - 1];
|
|
255
|
-
i && this.canMergeTextSegments(i,
|
|
256
|
+
i && this.canMergeTextSegments(i, n) ? t[t.length - 1] = this.mergeTextSegments(i, n) : t.push(n);
|
|
256
257
|
}
|
|
257
258
|
return t;
|
|
258
259
|
}
|
|
@@ -260,8 +261,8 @@ class Xe {
|
|
|
260
261
|
* Generate a cache key from segments
|
|
261
262
|
*/
|
|
262
263
|
static generateCacheKey(e) {
|
|
263
|
-
return e.map((
|
|
264
|
-
const i =
|
|
264
|
+
return e.map((n) => {
|
|
265
|
+
const i = n.component, s = this.extractTextContent(i), a = this.hashModifiers(n.modifiers);
|
|
265
266
|
return `${i.constructor.name}:${s}:${a}`;
|
|
266
267
|
}).join("|");
|
|
267
268
|
}
|
|
@@ -274,8 +275,8 @@ class Xe {
|
|
|
274
275
|
const t = e.map((i) => ({
|
|
275
276
|
type: i.type,
|
|
276
277
|
props: i.properties
|
|
277
|
-
})),
|
|
278
|
-
return typeof btoa == "function" ? btoa(
|
|
278
|
+
})), n = JSON.stringify(t);
|
|
279
|
+
return typeof btoa == "function" ? btoa(n).substring(0, 8) : this.simpleHash(n).toString(16).substring(0, 8);
|
|
279
280
|
} catch {
|
|
280
281
|
return "hash-error";
|
|
281
282
|
}
|
|
@@ -285,8 +286,8 @@ class Xe {
|
|
|
285
286
|
*/
|
|
286
287
|
static simpleHash(e) {
|
|
287
288
|
let t = 0;
|
|
288
|
-
for (let
|
|
289
|
-
const i = e.charCodeAt(
|
|
289
|
+
for (let n = 0; n < e.length; n++) {
|
|
290
|
+
const i = e.charCodeAt(n);
|
|
290
291
|
t = (t << 5) - t + i, t = t & t;
|
|
291
292
|
}
|
|
292
293
|
return Math.abs(t);
|
|
@@ -295,20 +296,20 @@ class Xe {
|
|
|
295
296
|
* Get cached optimization result
|
|
296
297
|
*/
|
|
297
298
|
static getCachedOptimization(e) {
|
|
298
|
-
const t =
|
|
299
|
-
return t ? Date.now() - t.timestamp >
|
|
299
|
+
const t = p.get(e);
|
|
300
|
+
return t ? Date.now() - t.timestamp > N ? (p.delete(e), null) : t : null;
|
|
300
301
|
}
|
|
301
302
|
/**
|
|
302
303
|
* Cache optimization result
|
|
303
304
|
*/
|
|
304
|
-
static cacheOptimization(e, t,
|
|
305
|
-
if (
|
|
306
|
-
const i =
|
|
307
|
-
i &&
|
|
305
|
+
static cacheOptimization(e, t, n) {
|
|
306
|
+
if (p.size >= E) {
|
|
307
|
+
const i = p.keys().next().value;
|
|
308
|
+
i && p.delete(i);
|
|
308
309
|
}
|
|
309
|
-
|
|
310
|
+
p.set(e, {
|
|
310
311
|
optimizedSegments: t,
|
|
311
|
-
stats:
|
|
312
|
+
stats: n,
|
|
312
313
|
timestamp: Date.now()
|
|
313
314
|
});
|
|
314
315
|
}
|
|
@@ -316,15 +317,15 @@ class Xe {
|
|
|
316
317
|
* Clear optimization cache (useful for testing)
|
|
317
318
|
*/
|
|
318
319
|
static clearCache() {
|
|
319
|
-
|
|
320
|
+
p.clear();
|
|
320
321
|
}
|
|
321
322
|
/**
|
|
322
323
|
* Get cache statistics
|
|
323
324
|
*/
|
|
324
325
|
static getCacheStats() {
|
|
325
326
|
return {
|
|
326
|
-
size:
|
|
327
|
-
maxSize:
|
|
327
|
+
size: p.size,
|
|
328
|
+
maxSize: E,
|
|
328
329
|
hitRate: 0
|
|
329
330
|
// Would need to track hits/misses to calculate this
|
|
330
331
|
};
|
|
@@ -340,8 +341,8 @@ class Xe {
|
|
|
340
341
|
*/
|
|
341
342
|
static modifiersCompatible(e, t) {
|
|
342
343
|
if (e.length !== t.length) return !1;
|
|
343
|
-
for (let
|
|
344
|
-
if (!this.modifierEqual(e[
|
|
344
|
+
for (let n = 0; n < e.length; n++)
|
|
345
|
+
if (!this.modifierEqual(e[n], t[n]))
|
|
345
346
|
return !1;
|
|
346
347
|
return !0;
|
|
347
348
|
}
|
|
@@ -360,13 +361,13 @@ class Xe {
|
|
|
360
361
|
* Merge two text segments into a single segment
|
|
361
362
|
*/
|
|
362
363
|
static mergeTextSegments(e, t) {
|
|
363
|
-
const
|
|
364
|
+
const n = e.component, i = t.component, s = this.extractTextContent(n), a = this.extractTextContent(i), o = s + a;
|
|
364
365
|
return {
|
|
365
366
|
id: `merged-${e.id}-${t.id}`,
|
|
366
|
-
component: this.createMergedTextComponent(o,
|
|
367
|
+
component: this.createMergedTextComponent(o, n.props, e.modifiers),
|
|
367
368
|
modifiers: e.modifiers,
|
|
368
369
|
// Use modifiers from first segment (they're identical)
|
|
369
|
-
render: () => this.createMergedTextComponent(o,
|
|
370
|
+
render: () => this.createMergedTextComponent(o, n.props, e.modifiers).render()[0]
|
|
370
371
|
};
|
|
371
372
|
}
|
|
372
373
|
/**
|
|
@@ -379,7 +380,7 @@ class Xe {
|
|
|
379
380
|
/**
|
|
380
381
|
* Create a new merged text component
|
|
381
382
|
*/
|
|
382
|
-
static createMergedTextComponent(e, t,
|
|
383
|
+
static createMergedTextComponent(e, t, n) {
|
|
383
384
|
const i = {
|
|
384
385
|
...t,
|
|
385
386
|
content: e
|
|
@@ -390,7 +391,7 @@ class Xe {
|
|
|
390
391
|
props: i,
|
|
391
392
|
mounted: !1,
|
|
392
393
|
cleanup: [],
|
|
393
|
-
modifiers:
|
|
394
|
+
modifiers: n,
|
|
394
395
|
render() {
|
|
395
396
|
const s = globalThis.__tachui_runtime;
|
|
396
397
|
if (s && s.h && s.text) {
|
|
@@ -407,8 +408,8 @@ class Xe {
|
|
|
407
408
|
static shouldOptimize(e) {
|
|
408
409
|
if (e.length < 2) return !1;
|
|
409
410
|
let t = 0;
|
|
410
|
-
for (let
|
|
411
|
-
const i = e[
|
|
411
|
+
for (let n = 0; n < e.length - 1; n++) {
|
|
412
|
+
const i = e[n], s = e[n + 1];
|
|
412
413
|
i.component.constructor.name === "EnhancedText" && s.component.constructor.name === "EnhancedText" && t++;
|
|
413
414
|
}
|
|
414
415
|
return t > 0;
|
|
@@ -417,30 +418,30 @@ class Xe {
|
|
|
417
418
|
* Get optimization statistics (enhanced for Phase 4.1)
|
|
418
419
|
*/
|
|
419
420
|
static getOptimizationStats(e, t) {
|
|
420
|
-
const
|
|
421
|
+
const n = e.length - t.length, i = e.length > 0 ? Math.round(n / e.length * 100) : 0;
|
|
421
422
|
return {
|
|
422
423
|
originalCount: e.length,
|
|
423
424
|
optimizedCount: t.length,
|
|
424
425
|
reductionPercent: i,
|
|
425
|
-
textSegmentsMerged:
|
|
426
|
+
textSegmentsMerged: n
|
|
426
427
|
};
|
|
427
428
|
}
|
|
428
429
|
/**
|
|
429
430
|
* Advanced optimization analysis for performance monitoring
|
|
430
431
|
*/
|
|
431
432
|
static analyzeOptimizationOpportunities(e) {
|
|
432
|
-
let t = 0,
|
|
433
|
+
let t = 0, n = 0, i = 0, s = 0;
|
|
433
434
|
for (let o = 0; o < e.length; o++) {
|
|
434
|
-
const
|
|
435
|
-
switch (
|
|
435
|
+
const d = e[o];
|
|
436
|
+
switch (d.component.constructor.name) {
|
|
436
437
|
case "EnhancedText":
|
|
437
438
|
if (t++, o < e.length - 1) {
|
|
438
|
-
const
|
|
439
|
-
this.canMergeTextSegments(
|
|
439
|
+
const f = e[o + 1];
|
|
440
|
+
this.canMergeTextSegments(d, f) && s++;
|
|
440
441
|
}
|
|
441
442
|
break;
|
|
442
443
|
case "EnhancedImage":
|
|
443
|
-
|
|
444
|
+
n++;
|
|
444
445
|
break;
|
|
445
446
|
case "EnhancedButton":
|
|
446
447
|
case "EnhancedLinkComponent":
|
|
@@ -452,43 +453,43 @@ class Xe {
|
|
|
452
453
|
return {
|
|
453
454
|
totalSegments: e.length,
|
|
454
455
|
textSegments: t,
|
|
455
|
-
imageSegments:
|
|
456
|
+
imageSegments: n,
|
|
456
457
|
interactiveSegments: i,
|
|
457
458
|
optimizableTextPairs: s,
|
|
458
459
|
estimatedReductionPercent: a
|
|
459
460
|
};
|
|
460
461
|
}
|
|
461
462
|
}
|
|
462
|
-
class
|
|
463
|
+
class je {
|
|
463
464
|
// Placeholder implementation
|
|
464
465
|
}
|
|
465
|
-
function
|
|
466
|
+
function Ve() {
|
|
466
467
|
}
|
|
467
|
-
function
|
|
468
|
+
function De() {
|
|
468
469
|
}
|
|
469
|
-
function
|
|
470
|
+
function ze() {
|
|
470
471
|
}
|
|
471
|
-
function
|
|
472
|
+
function Ie() {
|
|
472
473
|
}
|
|
473
|
-
class
|
|
474
|
+
class U extends j {
|
|
474
475
|
constructor(e, t) {
|
|
475
476
|
super(e), this.definitions = t;
|
|
476
477
|
}
|
|
477
478
|
resolve() {
|
|
478
479
|
const e = this.getCurrentTheme(), t = this.definitions[e] || this.definitions.light;
|
|
479
|
-
return
|
|
480
|
+
return D(t);
|
|
480
481
|
}
|
|
481
482
|
getCurrentTheme() {
|
|
482
483
|
return typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
483
484
|
}
|
|
484
485
|
}
|
|
485
|
-
function
|
|
486
|
-
return new
|
|
486
|
+
function Ae(r) {
|
|
487
|
+
return new U("gradient-asset", r);
|
|
487
488
|
}
|
|
488
|
-
var
|
|
489
|
-
class
|
|
490
|
-
constructor(e, t,
|
|
491
|
-
super(e), this.reactiveDefinition = t,
|
|
489
|
+
var $ = Object.defineProperty, R = (r, e, t) => e in r ? $(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, x = (r, e, t) => R(r, typeof e != "symbol" ? e + "" : e, t);
|
|
490
|
+
class O extends j {
|
|
491
|
+
constructor(e, t, n) {
|
|
492
|
+
super(e), this.reactiveDefinition = t, x(this, "currentGradient"), x(this, "subscriptions", []), x(this, "updateCallback"), this.updateCallback = n, this.currentGradient = this.resolveStaticGradient(), this.setupSignalSubscriptions();
|
|
492
493
|
}
|
|
493
494
|
/**
|
|
494
495
|
* Resolve current gradient to CSS
|
|
@@ -518,12 +519,12 @@ class E extends D {
|
|
|
518
519
|
const { type: e, options: t } = this.reactiveDefinition;
|
|
519
520
|
switch (e) {
|
|
520
521
|
case "linear":
|
|
521
|
-
return
|
|
522
|
+
return A(this.resolveLinearOptions(t));
|
|
522
523
|
case "radial":
|
|
523
|
-
return
|
|
524
|
+
return I(this.resolveRadialOptions(t));
|
|
524
525
|
case "angular":
|
|
525
526
|
case "conic":
|
|
526
|
-
return
|
|
527
|
+
return z(this.resolveAngularOptions(t));
|
|
527
528
|
default:
|
|
528
529
|
throw new Error(`Unsupported reactive gradient type: ${e}`);
|
|
529
530
|
}
|
|
@@ -566,16 +567,16 @@ class E extends D {
|
|
|
566
567
|
this.subscribeToSignalsInOptions(this.reactiveDefinition.options);
|
|
567
568
|
}
|
|
568
569
|
subscribeToSignalsInOptions(e) {
|
|
569
|
-
for (const [t,
|
|
570
|
-
if (Array.isArray(
|
|
571
|
-
|
|
570
|
+
for (const [t, n] of Object.entries(e))
|
|
571
|
+
if (Array.isArray(n))
|
|
572
|
+
n.forEach((i) => {
|
|
572
573
|
if (this.isSignal(i)) {
|
|
573
574
|
const s = i.subscribe(() => this.handleSignalChange());
|
|
574
575
|
this.subscriptions.push(s);
|
|
575
576
|
}
|
|
576
577
|
});
|
|
577
|
-
else if (this.isSignal(
|
|
578
|
-
const i =
|
|
578
|
+
else if (this.isSignal(n)) {
|
|
579
|
+
const i = n.subscribe(() => this.handleSignalChange());
|
|
579
580
|
this.subscriptions.push(i);
|
|
580
581
|
}
|
|
581
582
|
}
|
|
@@ -590,17 +591,17 @@ class E extends D {
|
|
|
590
591
|
return t(e);
|
|
591
592
|
}
|
|
592
593
|
}
|
|
593
|
-
class
|
|
594
|
-
constructor(e, t,
|
|
595
|
-
const i =
|
|
596
|
-
super(e, i), this.reactiveStateGradients = t, this.updateCallback =
|
|
594
|
+
class u extends G {
|
|
595
|
+
constructor(e, t, n) {
|
|
596
|
+
const i = u.resolveStateOptions(t);
|
|
597
|
+
super(e, i), this.reactiveStateGradients = t, this.updateCallback = n, x(this, "reactiveSubscriptions", []), this.setupStateSignalSubscriptions();
|
|
597
598
|
}
|
|
598
599
|
/**
|
|
599
600
|
* Update reactive state configuration
|
|
600
601
|
*/
|
|
601
602
|
updateReactiveState(e) {
|
|
602
603
|
this.cleanupStateSubscriptions(), this.reactiveStateGradients = e;
|
|
603
|
-
const t =
|
|
604
|
+
const t = u.resolveStateOptions(e);
|
|
604
605
|
this.updateStateGradients(t), this.setupStateSignalSubscriptions(), this.notifyStateUpdate();
|
|
605
606
|
}
|
|
606
607
|
/**
|
|
@@ -611,10 +612,10 @@ class l extends H {
|
|
|
611
612
|
}
|
|
612
613
|
static resolveStateOptions(e) {
|
|
613
614
|
const t = {
|
|
614
|
-
default:
|
|
615
|
+
default: u.resolveValue(e.default),
|
|
615
616
|
animation: e.animation
|
|
616
617
|
};
|
|
617
|
-
return e.hover && (t.hover =
|
|
618
|
+
return e.hover && (t.hover = u.resolveValue(e.hover)), e.active && (t.active = u.resolveValue(e.active)), e.focus && (t.focus = u.resolveValue(e.focus)), e.disabled && (t.disabled = u.resolveValue(e.disabled)), t;
|
|
618
619
|
}
|
|
619
620
|
static resolveValue(e) {
|
|
620
621
|
return e !== null && typeof e == "object" && "value" in e && "subscribe" in e ? e.value : e;
|
|
@@ -624,61 +625,61 @@ class l extends H {
|
|
|
624
625
|
}
|
|
625
626
|
setupStateSignalSubscriptions() {
|
|
626
627
|
Object.entries(this.reactiveStateGradients).forEach(([e, t]) => {
|
|
627
|
-
if (e !== "animation" &&
|
|
628
|
-
const
|
|
629
|
-
this.reactiveSubscriptions.push(
|
|
628
|
+
if (e !== "animation" && u.isSignal(t)) {
|
|
629
|
+
const n = t.subscribe(() => this.handleStateSignalChange());
|
|
630
|
+
this.reactiveSubscriptions.push(n);
|
|
630
631
|
}
|
|
631
632
|
});
|
|
632
633
|
}
|
|
633
634
|
handleStateSignalChange() {
|
|
634
|
-
const e =
|
|
635
|
+
const e = u.resolveStateOptions(this.reactiveStateGradients);
|
|
635
636
|
this.updateStateGradients(e), this.notifyStateUpdate();
|
|
636
637
|
}
|
|
637
638
|
notifyStateUpdate() {
|
|
638
639
|
this.updateCallback && this.updateCallback();
|
|
639
640
|
}
|
|
640
641
|
}
|
|
641
|
-
const
|
|
642
|
+
const _ = {
|
|
642
643
|
/**
|
|
643
644
|
* Create a reactive linear gradient
|
|
644
645
|
*/
|
|
645
|
-
linear: (
|
|
646
|
+
linear: (r, e) => new O(
|
|
646
647
|
"reactive-linear",
|
|
647
|
-
{ type: "linear", options:
|
|
648
|
+
{ type: "linear", options: r, __reactive: !0 },
|
|
648
649
|
e
|
|
649
650
|
),
|
|
650
651
|
/**
|
|
651
652
|
* Create a reactive radial gradient
|
|
652
653
|
*/
|
|
653
|
-
radial: (
|
|
654
|
+
radial: (r, e) => new O(
|
|
654
655
|
"reactive-radial",
|
|
655
|
-
{ type: "radial", options:
|
|
656
|
+
{ type: "radial", options: r, __reactive: !0 },
|
|
656
657
|
e
|
|
657
658
|
),
|
|
658
659
|
/**
|
|
659
660
|
* Create a reactive angular gradient
|
|
660
661
|
*/
|
|
661
|
-
angular: (
|
|
662
|
+
angular: (r, e) => new O(
|
|
662
663
|
"reactive-angular",
|
|
663
|
-
{ type: "angular", options:
|
|
664
|
+
{ type: "angular", options: r, __reactive: !0 },
|
|
664
665
|
e
|
|
665
666
|
),
|
|
666
667
|
/**
|
|
667
668
|
* Create a reactive state gradient
|
|
668
669
|
*/
|
|
669
|
-
state: (
|
|
670
|
-
},
|
|
670
|
+
state: (r, e, t) => new u(r, e, t)
|
|
671
|
+
}, Ge = {
|
|
671
672
|
/**
|
|
672
673
|
* Create an animated gradient that cycles through colors
|
|
673
674
|
*/
|
|
674
|
-
createAnimatedGradient: (
|
|
675
|
+
createAnimatedGradient: (r, e = 3e3) => {
|
|
675
676
|
const t = {
|
|
676
|
-
value:
|
|
677
|
-
subscribe: (
|
|
677
|
+
value: r[0],
|
|
678
|
+
subscribe: (n) => () => {
|
|
678
679
|
}
|
|
679
680
|
};
|
|
680
|
-
return
|
|
681
|
-
colors: [t,
|
|
681
|
+
return _.linear({
|
|
682
|
+
colors: [t, r[1]],
|
|
682
683
|
startPoint: "top",
|
|
683
684
|
endPoint: "bottom"
|
|
684
685
|
});
|
|
@@ -686,9 +687,9 @@ const V = {
|
|
|
686
687
|
/**
|
|
687
688
|
* Create a progress gradient that fills based on a signal
|
|
688
689
|
*/
|
|
689
|
-
createProgressGradient: (
|
|
690
|
+
createProgressGradient: (r, e = "#007AFF") => _.linear({
|
|
690
691
|
colors: [e, "transparent"],
|
|
691
|
-
stops: [
|
|
692
|
+
stops: [r, r],
|
|
692
693
|
// Both stops use the same signal
|
|
693
694
|
startPoint: "leading",
|
|
694
695
|
endPoint: "trailing"
|
|
@@ -696,103 +697,103 @@ const V = {
|
|
|
696
697
|
/**
|
|
697
698
|
* Create a data-driven gradient that reflects numeric values
|
|
698
699
|
*/
|
|
699
|
-
createDataGradient: (
|
|
700
|
-
colors:
|
|
700
|
+
createDataGradient: (r, e, t, n = ["#ff0000", "#ffff00", "#00ff00"]) => _.linear({
|
|
701
|
+
colors: n,
|
|
701
702
|
startPoint: "top",
|
|
702
703
|
endPoint: "bottom"
|
|
703
704
|
})
|
|
704
|
-
},
|
|
705
|
+
}, Pe = {
|
|
705
706
|
/**
|
|
706
707
|
* Check if a background value is reactive
|
|
707
708
|
*/
|
|
708
|
-
isReactiveBackground: (
|
|
709
|
+
isReactiveBackground: (r) => r instanceof O || r instanceof u,
|
|
709
710
|
/**
|
|
710
711
|
* Create a reactive background from a signal
|
|
711
712
|
*/
|
|
712
|
-
fromSignal: (
|
|
713
|
-
default:
|
|
713
|
+
fromSignal: (r) => _.state("signal-background", {
|
|
714
|
+
default: r
|
|
714
715
|
})
|
|
715
716
|
};
|
|
716
|
-
function M(
|
|
717
|
-
const { fallback: t, errorFallback:
|
|
718
|
-
let a = !1, o = null,
|
|
719
|
-
const
|
|
720
|
-
a ||
|
|
717
|
+
function M(r, e = {}) {
|
|
718
|
+
const { fallback: t, errorFallback: n, timeout: i = 1e4, preload: s = "never" } = e;
|
|
719
|
+
let a = !1, o = null, d = !1, m = null, f = null;
|
|
720
|
+
const w = async () => {
|
|
721
|
+
a || d || o || f || (a = !0, d = !0, m = null, f = (async () => {
|
|
721
722
|
try {
|
|
722
|
-
const
|
|
723
|
-
|
|
723
|
+
const g = await Promise.race([
|
|
724
|
+
r(),
|
|
724
725
|
new Promise(
|
|
725
|
-
(
|
|
726
|
+
(y, C) => setTimeout(() => C(new Error("Component load timeout")), i)
|
|
726
727
|
)
|
|
727
728
|
]);
|
|
728
|
-
o = "default" in
|
|
729
|
-
} catch (
|
|
730
|
-
const
|
|
731
|
-
(typeof process > "u" || process.env.NODE_ENV !== "test") && console.error("Failed to load lazy component:",
|
|
729
|
+
o = "default" in g ? g.default : g;
|
|
730
|
+
} catch (g) {
|
|
731
|
+
const y = g;
|
|
732
|
+
(typeof process > "u" || process.env.NODE_ENV !== "test") && console.error("Failed to load lazy component:", y), m = y;
|
|
732
733
|
} finally {
|
|
733
|
-
|
|
734
|
+
d = !1, f = null;
|
|
734
735
|
}
|
|
735
|
-
})(), await
|
|
736
|
+
})(), await f);
|
|
736
737
|
};
|
|
737
738
|
return s === "idle" && typeof requestIdleCallback < "u" ? requestIdleCallback(() => {
|
|
738
|
-
|
|
739
|
+
w().catch(() => {
|
|
739
740
|
});
|
|
740
741
|
}) : s === "idle" ? setTimeout(() => {
|
|
741
|
-
|
|
742
|
+
w().catch(() => {
|
|
742
743
|
});
|
|
743
|
-
}, 100) : s === "immediate" &&
|
|
744
|
-
}), (
|
|
745
|
-
if (!a && !
|
|
744
|
+
}, 100) : s === "immediate" && w().catch(() => {
|
|
745
|
+
}), (g) => {
|
|
746
|
+
if (!a && !d && !o && w().catch(() => {
|
|
746
747
|
}), m)
|
|
747
|
-
return
|
|
748
|
-
if (
|
|
749
|
-
return t ||
|
|
748
|
+
return n ? n(m) : T(m);
|
|
749
|
+
if (d || !o)
|
|
750
|
+
return t || H();
|
|
750
751
|
try {
|
|
751
|
-
return typeof o == "function" ? o(
|
|
752
|
-
} catch (
|
|
753
|
-
const
|
|
754
|
-
return (typeof process > "u" || process.env.NODE_ENV !== "test") && console.error("Error rendering lazy component:",
|
|
752
|
+
return typeof o == "function" ? o(g) : o;
|
|
753
|
+
} catch (y) {
|
|
754
|
+
const C = y;
|
|
755
|
+
return (typeof process > "u" || process.env.NODE_ENV !== "test") && console.error("Error rendering lazy component:", C), T(C);
|
|
755
756
|
}
|
|
756
757
|
};
|
|
757
758
|
}
|
|
758
|
-
function
|
|
759
|
+
function ke(r) {
|
|
759
760
|
return {
|
|
760
761
|
type: "component",
|
|
761
762
|
render: () => ({
|
|
762
763
|
type: "element",
|
|
763
764
|
tag: "div",
|
|
764
765
|
props: { class: "tachui-suspense" },
|
|
765
|
-
children:
|
|
766
|
+
children: r.children.map(() => ({
|
|
766
767
|
type: "element",
|
|
767
768
|
tag: "div",
|
|
768
769
|
children: []
|
|
769
770
|
}))
|
|
770
771
|
}),
|
|
771
|
-
props:
|
|
772
|
+
props: r,
|
|
772
773
|
id: `suspense-${Math.random().toString(36).substr(2, 9)}`
|
|
773
774
|
};
|
|
774
775
|
}
|
|
775
|
-
function
|
|
776
|
-
return
|
|
776
|
+
function B(r) {
|
|
777
|
+
return r().then((e) => e && typeof e == "object" && "default" in e ? e.default : e);
|
|
777
778
|
}
|
|
778
|
-
function
|
|
779
|
+
function Ne(r, e = {}) {
|
|
779
780
|
const t = {};
|
|
780
|
-
for (const [
|
|
781
|
-
t[
|
|
781
|
+
for (const [n, i] of Object.entries(r))
|
|
782
|
+
t[n] = M(i, e);
|
|
782
783
|
return t;
|
|
783
784
|
}
|
|
784
|
-
function
|
|
785
|
-
const e = Object.entries(
|
|
786
|
-
async ([t,
|
|
785
|
+
function Ue(r) {
|
|
786
|
+
const e = Object.entries(r).map(
|
|
787
|
+
async ([t, n]) => [t, await B(n)]
|
|
787
788
|
);
|
|
788
789
|
return Promise.all(e).then((t) => {
|
|
789
|
-
const
|
|
790
|
+
const n = {};
|
|
790
791
|
for (const [i, s] of t)
|
|
791
|
-
|
|
792
|
-
return
|
|
792
|
+
n[i] = s;
|
|
793
|
+
return n;
|
|
793
794
|
});
|
|
794
795
|
}
|
|
795
|
-
function
|
|
796
|
+
function H() {
|
|
796
797
|
return {
|
|
797
798
|
type: "element",
|
|
798
799
|
tag: "div",
|
|
@@ -808,7 +809,7 @@ function Q() {
|
|
|
808
809
|
]
|
|
809
810
|
};
|
|
810
811
|
}
|
|
811
|
-
function
|
|
812
|
+
function T(r) {
|
|
812
813
|
return {
|
|
813
814
|
type: "element",
|
|
814
815
|
tag: "div",
|
|
@@ -819,293 +820,41 @@ function N(n) {
|
|
|
819
820
|
children: [
|
|
820
821
|
{
|
|
821
822
|
type: "text",
|
|
822
|
-
text: `Failed to load component: ${
|
|
823
|
+
text: `Failed to load component: ${r.message}`
|
|
823
824
|
}
|
|
824
825
|
]
|
|
825
826
|
};
|
|
826
827
|
}
|
|
827
|
-
function
|
|
828
|
-
const { rootMargin: t = "50px", threshold:
|
|
828
|
+
function $e(r, e = {}) {
|
|
829
|
+
const { rootMargin: t = "50px", threshold: n = 0.1, ...i } = e;
|
|
829
830
|
return i.preload === "visible" && typeof IntersectionObserver < "u" ? (s) => {
|
|
830
|
-
const a = M(
|
|
831
|
+
const a = M(r, { ...i, preload: "never" });
|
|
831
832
|
return setTimeout(() => {
|
|
832
833
|
a(s);
|
|
833
834
|
}, 100), a(s);
|
|
834
|
-
} : M(
|
|
835
|
-
}
|
|
836
|
-
var ee = Object.defineProperty, te = (n, e, t) => e in n ? ee(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, g = (n, e, t) => te(n, typeof e != "symbol" ? e + "" : e, t);
|
|
837
|
-
class ne {
|
|
838
|
-
constructor(e) {
|
|
839
|
-
g(this, "_signal"), g(this, "_setter"), g(this, "_subscribers", /* @__PURE__ */ new Set());
|
|
840
|
-
const [t, r] = I(e);
|
|
841
|
-
this._signal = t, this._setter = r;
|
|
842
|
-
}
|
|
843
|
-
get value() {
|
|
844
|
-
return this._signal();
|
|
845
|
-
}
|
|
846
|
-
set value(e) {
|
|
847
|
-
this._setter(e), this.notifySubscribers();
|
|
848
|
-
}
|
|
849
|
-
/**
|
|
850
|
-
* Update a property of the environment object
|
|
851
|
-
*/
|
|
852
|
-
updateProperty(e, t) {
|
|
853
|
-
const i = { ...this._signal(), [e]: t };
|
|
854
|
-
this._setter(i), this.notifySubscribers();
|
|
855
|
-
}
|
|
856
|
-
/**
|
|
857
|
-
* Subscribe to changes
|
|
858
|
-
*/
|
|
859
|
-
subscribe(e) {
|
|
860
|
-
return this._subscribers.add(e), () => this._subscribers.delete(e);
|
|
861
|
-
}
|
|
862
|
-
notifySubscribers() {
|
|
863
|
-
for (const e of this._subscribers)
|
|
864
|
-
try {
|
|
865
|
-
e();
|
|
866
|
-
} catch (t) {
|
|
867
|
-
console.error("Error in environment object subscriber:", t);
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
/**
|
|
871
|
-
* Create a reactive effect that runs when this object changes
|
|
872
|
-
*/
|
|
873
|
-
onChange(e) {
|
|
874
|
-
const t = A(() => {
|
|
875
|
-
e(this._signal());
|
|
876
|
-
});
|
|
877
|
-
return () => t.dispose();
|
|
878
|
-
}
|
|
879
|
-
}
|
|
880
|
-
class $ {
|
|
881
|
-
constructor(e, t) {
|
|
882
|
-
g(this, "key"), g(this, "componentContext"), g(this, "_cachedValue"), g(this, "_subscriptionCleanup"), this.key = e, this.componentContext = t, t.onCleanup(() => {
|
|
883
|
-
this._subscriptionCleanup && this._subscriptionCleanup();
|
|
884
|
-
});
|
|
885
|
-
}
|
|
886
|
-
get wrappedValue() {
|
|
887
|
-
if (this._cachedValue === void 0 && (this._cachedValue = q(this.key), this._cachedValue && typeof this._cachedValue == "object" && "subscribe" in this._cachedValue)) {
|
|
888
|
-
const e = this._cachedValue;
|
|
889
|
-
typeof e.subscribe == "function" && (this._subscriptionCleanup = e.subscribe(() => {
|
|
890
|
-
this.componentContext.setState(`_env_${this.key.name}_trigger`, Date.now());
|
|
891
|
-
}));
|
|
892
|
-
}
|
|
893
|
-
return this._cachedValue;
|
|
894
|
-
}
|
|
895
|
-
get projectedValue() {
|
|
896
|
-
return this;
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
function re(n) {
|
|
900
|
-
const e = L();
|
|
901
|
-
return new $(n, e);
|
|
902
|
-
}
|
|
903
|
-
function ie(n, e) {
|
|
904
|
-
F(n, e);
|
|
905
|
-
}
|
|
906
|
-
function ut(n, e) {
|
|
907
|
-
return new ne(e);
|
|
908
|
-
}
|
|
909
|
-
function lt(n) {
|
|
910
|
-
return n && typeof n == "object" && "wrappedValue" in n && "key" in n && "componentContext" in n && n instanceof $;
|
|
911
|
-
}
|
|
912
|
-
const dt = {
|
|
913
|
-
/**
|
|
914
|
-
* Application theme
|
|
915
|
-
*/
|
|
916
|
-
Theme: S("Theme", {
|
|
917
|
-
mode: "light",
|
|
918
|
-
primaryColor: "#007AFF",
|
|
919
|
-
secondaryColor: "#5856D6"
|
|
920
|
-
}),
|
|
921
|
-
/**
|
|
922
|
-
* Localization service
|
|
923
|
-
*/
|
|
924
|
-
Localization: S("Localization"),
|
|
925
|
-
/**
|
|
926
|
-
* Navigation service
|
|
927
|
-
*/
|
|
928
|
-
Navigation: S("Navigation"),
|
|
929
|
-
/**
|
|
930
|
-
* Application configuration
|
|
931
|
-
*/
|
|
932
|
-
Config: S("Config"),
|
|
933
|
-
/**
|
|
934
|
-
* User authentication
|
|
935
|
-
*/
|
|
936
|
-
Auth: S("Auth")
|
|
937
|
-
};
|
|
938
|
-
var se = Object.defineProperty, ae = (n, e, t) => e in n ? se(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, C = (n, e, t) => ae(n, typeof e != "symbol" ? e + "" : e, t);
|
|
939
|
-
class k {
|
|
940
|
-
constructor() {
|
|
941
|
-
C(this, "_objectWillChange"), C(this, "_notifyCount", 0);
|
|
942
|
-
const [e, t] = I(void 0);
|
|
943
|
-
this._objectWillChange = {
|
|
944
|
-
getValue: e,
|
|
945
|
-
peek: e
|
|
946
|
-
}, this._notifySetter = t;
|
|
947
|
-
}
|
|
948
|
-
get objectWillChange() {
|
|
949
|
-
return this._objectWillChange;
|
|
950
|
-
}
|
|
951
|
-
/**
|
|
952
|
-
* Notify observers that the object has changed
|
|
953
|
-
* Call this method whenever properties of the object change
|
|
954
|
-
*/
|
|
955
|
-
notifyChange() {
|
|
956
|
-
this._notifyCount++;
|
|
957
|
-
const e = this._notifySetter;
|
|
958
|
-
e && e(void 0);
|
|
959
|
-
}
|
|
960
|
-
/**
|
|
961
|
-
* Get the current notification count (for debugging)
|
|
962
|
-
*/
|
|
963
|
-
get notificationCount() {
|
|
964
|
-
return this._notifyCount;
|
|
965
|
-
}
|
|
966
|
-
}
|
|
967
|
-
class oe {
|
|
968
|
-
constructor(e, t, r, i = {}) {
|
|
969
|
-
C(this, "_object"), C(this, "_metadata"), C(this, "_effectCleanup"), this._object = e, this._metadata = {
|
|
970
|
-
type: "ObservedObject",
|
|
971
|
-
propertyName: r,
|
|
972
|
-
componentId: t.id,
|
|
973
|
-
options: i
|
|
974
|
-
}, this.setupObservation();
|
|
975
|
-
const s = z();
|
|
976
|
-
s && s.cleanups.push(() => {
|
|
977
|
-
this.cleanup();
|
|
978
|
-
});
|
|
979
|
-
}
|
|
980
|
-
get wrappedValue() {
|
|
981
|
-
return this._object;
|
|
982
|
-
}
|
|
983
|
-
get projectedValue() {
|
|
984
|
-
return this;
|
|
985
|
-
}
|
|
986
|
-
/**
|
|
987
|
-
* Get property wrapper metadata
|
|
988
|
-
*/
|
|
989
|
-
get metadata() {
|
|
990
|
-
return this._metadata;
|
|
991
|
-
}
|
|
992
|
-
/**
|
|
993
|
-
* Set up reactive observation of the object
|
|
994
|
-
*/
|
|
995
|
-
setupObservation() {
|
|
996
|
-
const e = A(() => {
|
|
997
|
-
this._object.objectWillChange();
|
|
998
|
-
});
|
|
999
|
-
this._effectCleanup = () => e.dispose();
|
|
1000
|
-
}
|
|
1001
|
-
/**
|
|
1002
|
-
* Cleanup observation
|
|
1003
|
-
*/
|
|
1004
|
-
cleanup() {
|
|
1005
|
-
this._effectCleanup && (this._effectCleanup(), this._effectCleanup = void 0);
|
|
1006
|
-
}
|
|
1007
|
-
/**
|
|
1008
|
-
* Replace the observed object (advanced usage)
|
|
1009
|
-
*/
|
|
1010
|
-
updateObject(e) {
|
|
1011
|
-
this.cleanup(), this._object = e, this.setupObservation();
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
const ce = (n, e = {}) => {
|
|
1015
|
-
const t = le(), r = de() || "observedObject";
|
|
1016
|
-
return new oe(n, t, r, e);
|
|
1017
|
-
};
|
|
1018
|
-
function ue(n, e = {}) {
|
|
1019
|
-
const t = new k();
|
|
1020
|
-
return new Proxy(n, {
|
|
1021
|
-
set(i, s, a) {
|
|
1022
|
-
const o = i[s], u = Reflect.set(i, s, a);
|
|
1023
|
-
return u && o !== a && e.autoNotify !== !1 && t.notifyChange(), u;
|
|
1024
|
-
},
|
|
1025
|
-
get(i, s) {
|
|
1026
|
-
return s === "objectWillChange" ? t.objectWillChange : s === "notifyChange" ? () => t.notifyChange() : s === "notificationCount" ? t.notificationCount : Reflect.get(i, s);
|
|
1027
|
-
}
|
|
1028
|
-
});
|
|
1029
|
-
}
|
|
1030
|
-
function ht(n = {}) {
|
|
1031
|
-
return (e) => class extends e {
|
|
1032
|
-
constructor(...t) {
|
|
1033
|
-
super(...t), C(this, "_observableBase", new k()), n.autoNotify !== !1 && this.setupAutoNotification();
|
|
1034
|
-
}
|
|
1035
|
-
get objectWillChange() {
|
|
1036
|
-
return this._observableBase.objectWillChange;
|
|
1037
|
-
}
|
|
1038
|
-
get notificationCount() {
|
|
1039
|
-
return this._observableBase.notificationCount;
|
|
1040
|
-
}
|
|
1041
|
-
notifyChange() {
|
|
1042
|
-
this._observableBase.notifyChange();
|
|
1043
|
-
}
|
|
1044
|
-
setupAutoNotification() {
|
|
1045
|
-
const t = Object.getOwnPropertyNames(this);
|
|
1046
|
-
for (const r of t) {
|
|
1047
|
-
if (r.startsWith("_") || typeof this[r] == "function")
|
|
1048
|
-
continue;
|
|
1049
|
-
let i = this[r];
|
|
1050
|
-
Object.defineProperty(this, r, {
|
|
1051
|
-
get: () => i,
|
|
1052
|
-
set: (s) => {
|
|
1053
|
-
i !== s && (i = s, this.notifyChange());
|
|
1054
|
-
},
|
|
1055
|
-
enumerable: !0,
|
|
1056
|
-
configurable: !0
|
|
1057
|
-
});
|
|
1058
|
-
}
|
|
1059
|
-
}
|
|
1060
|
-
};
|
|
835
|
+
} : M(r, i);
|
|
1061
836
|
}
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
if (!n?.context.has(P))
|
|
1065
|
-
throw new Error("@ObservedObject can only be used within a component context");
|
|
1066
|
-
return n.context.get(P);
|
|
1067
|
-
}
|
|
1068
|
-
function de() {
|
|
1069
|
-
try {
|
|
1070
|
-
const n = new Error().stack;
|
|
1071
|
-
if (n)
|
|
1072
|
-
return n.match(/at (\w+)\./)?.[1] || null;
|
|
1073
|
-
} catch {
|
|
1074
|
-
}
|
|
1075
|
-
return null;
|
|
1076
|
-
}
|
|
1077
|
-
const P = Symbol("TachUI.ComponentContext");
|
|
1078
|
-
function he(n) {
|
|
1079
|
-
return n && typeof n == "object" && "objectWillChange" in n && "notifyChange" in n;
|
|
1080
|
-
}
|
|
1081
|
-
function pt(n) {
|
|
1082
|
-
return n && typeof n == "object" && "wrappedValue" in n && "projectedValue" in n && he(n.wrappedValue);
|
|
1083
|
-
}
|
|
1084
|
-
function ft(n, e = {}) {
|
|
1085
|
-
return ue({ ...n }, e);
|
|
1086
|
-
}
|
|
1087
|
-
const gt = ce;
|
|
1088
|
-
var pe = Object.defineProperty, fe = (n, e, t) => e in n ? pe(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, p = (n, e, t) => fe(n, typeof e != "symbol" ? e + "" : e, t);
|
|
1089
|
-
class ge {
|
|
837
|
+
var L = Object.defineProperty, W = (r, e, t) => e in r ? L(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, h = (r, e, t) => W(r, typeof e != "symbol" ? e + "" : e, t);
|
|
838
|
+
class F {
|
|
1090
839
|
constructor(e) {
|
|
1091
|
-
this.componentContext = e,
|
|
840
|
+
this.componentContext = e, h(this, "states", /* @__PURE__ */ new Map()), h(this, "bindings", /* @__PURE__ */ new Map()), h(this, "observedObjects", /* @__PURE__ */ new Map()), h(this, "environmentObjects", /* @__PURE__ */ new Map()), h(this, "registry"), this.registry = new q();
|
|
1092
841
|
}
|
|
1093
842
|
/**
|
|
1094
843
|
* Register a @State property wrapper
|
|
1095
844
|
*/
|
|
1096
845
|
registerState(e, t = {}) {
|
|
1097
|
-
const
|
|
1098
|
-
if (
|
|
1099
|
-
const i = `${
|
|
1100
|
-
this.states.set(i, e), this.registry.register(
|
|
846
|
+
const n = e.metadata;
|
|
847
|
+
if (n) {
|
|
848
|
+
const i = `${n.componentId}_${n.propertyName}`;
|
|
849
|
+
this.states.set(i, e), this.registry.register(n), process.env.NODE_ENV === "development" && this.setupStateDebugging(e, n);
|
|
1101
850
|
}
|
|
1102
851
|
}
|
|
1103
852
|
/**
|
|
1104
853
|
* Register a @Binding property wrapper
|
|
1105
854
|
*/
|
|
1106
855
|
registerBinding(e, t = {}) {
|
|
1107
|
-
const
|
|
1108
|
-
this.bindings.set(
|
|
856
|
+
const n = `${this.componentContext.id}_${t.name || "binding"}_${Date.now()}`;
|
|
857
|
+
this.bindings.set(n, e);
|
|
1109
858
|
const i = {
|
|
1110
859
|
type: "Binding",
|
|
1111
860
|
propertyName: t.name || "binding",
|
|
@@ -1118,20 +867,20 @@ class ge {
|
|
|
1118
867
|
* Register an @ObservedObject property wrapper
|
|
1119
868
|
*/
|
|
1120
869
|
registerObservedObject(e, t = {}) {
|
|
1121
|
-
const
|
|
1122
|
-
if (
|
|
1123
|
-
const i = `${
|
|
1124
|
-
this.observedObjects.set(i, e), this.registry.register(
|
|
870
|
+
const n = e.metadata;
|
|
871
|
+
if (n) {
|
|
872
|
+
const i = `${n.componentId}_${n.propertyName}`;
|
|
873
|
+
this.observedObjects.set(i, e), this.registry.register(n), process.env.NODE_ENV === "development" && this.setupObservedObjectDebugging(e, n);
|
|
1125
874
|
}
|
|
1126
875
|
}
|
|
1127
876
|
/**
|
|
1128
877
|
* Register an @EnvironmentObject property wrapper
|
|
1129
878
|
*/
|
|
1130
879
|
registerEnvironmentObject(e, t) {
|
|
1131
|
-
const
|
|
1132
|
-
if (
|
|
1133
|
-
const i = `${
|
|
1134
|
-
this.environmentObjects.set(i, e), this.registry.register(
|
|
880
|
+
const n = e.metadata;
|
|
881
|
+
if (n) {
|
|
882
|
+
const i = `${n.componentId}_${n.propertyName}`;
|
|
883
|
+
this.environmentObjects.set(i, e), this.registry.register(n);
|
|
1135
884
|
}
|
|
1136
885
|
}
|
|
1137
886
|
/**
|
|
@@ -1175,8 +924,8 @@ class ge {
|
|
|
1175
924
|
*/
|
|
1176
925
|
setupStateDebugging(e, t) {
|
|
1177
926
|
if (typeof window < "u") {
|
|
1178
|
-
const
|
|
1179
|
-
|
|
927
|
+
const n = window.__TACHUI_DEBUG__ || {};
|
|
928
|
+
n.states || (n.states = {}), n.states[`${t.componentId}_${t.propertyName}`] = {
|
|
1180
929
|
state: e,
|
|
1181
930
|
metadata: t,
|
|
1182
931
|
getValue: () => e.wrappedValue,
|
|
@@ -1184,7 +933,7 @@ class ge {
|
|
|
1184
933
|
e.projectedValue.set(i);
|
|
1185
934
|
},
|
|
1186
935
|
getBinding: () => e.projectedValue
|
|
1187
|
-
}, window.__TACHUI_DEBUG__ =
|
|
936
|
+
}, window.__TACHUI_DEBUG__ = n;
|
|
1188
937
|
}
|
|
1189
938
|
}
|
|
1190
939
|
/**
|
|
@@ -1192,27 +941,27 @@ class ge {
|
|
|
1192
941
|
*/
|
|
1193
942
|
setupObservedObjectDebugging(e, t) {
|
|
1194
943
|
if (typeof window < "u") {
|
|
1195
|
-
const
|
|
1196
|
-
|
|
944
|
+
const n = window.__TACHUI_DEBUG__ || {};
|
|
945
|
+
n.observedObjects || (n.observedObjects = {}), n.observedObjects[`${t.componentId}_${t.propertyName}`] = {
|
|
1197
946
|
observedObject: e,
|
|
1198
947
|
metadata: t,
|
|
1199
948
|
getObject: () => e.wrappedValue,
|
|
1200
949
|
getNotificationCount: () => e.wrappedValue.notificationCount || 0,
|
|
1201
950
|
triggerChange: () => e.wrappedValue.notifyChange()
|
|
1202
|
-
}, window.__TACHUI_DEBUG__ =
|
|
951
|
+
}, window.__TACHUI_DEBUG__ = n;
|
|
1203
952
|
}
|
|
1204
953
|
}
|
|
1205
954
|
}
|
|
1206
|
-
class
|
|
955
|
+
class q {
|
|
1207
956
|
constructor() {
|
|
1208
|
-
|
|
957
|
+
h(this, "metadata", /* @__PURE__ */ new Map());
|
|
1209
958
|
}
|
|
1210
959
|
/**
|
|
1211
960
|
* Register property wrapper metadata
|
|
1212
961
|
*/
|
|
1213
962
|
register(e) {
|
|
1214
|
-
const t = e.componentId,
|
|
1215
|
-
|
|
963
|
+
const t = e.componentId, n = this.metadata.get(t) || [];
|
|
964
|
+
n.push(e), this.metadata.set(t, n);
|
|
1216
965
|
}
|
|
1217
966
|
/**
|
|
1218
967
|
* Unregister a specific property wrapper
|
|
@@ -1240,15 +989,15 @@ class me {
|
|
|
1240
989
|
return new Map(this.metadata);
|
|
1241
990
|
}
|
|
1242
991
|
}
|
|
1243
|
-
function
|
|
1244
|
-
return new
|
|
992
|
+
function Re(r) {
|
|
993
|
+
return new F(r);
|
|
1245
994
|
}
|
|
1246
|
-
const
|
|
995
|
+
const V = class S {
|
|
1247
996
|
constructor() {
|
|
1248
|
-
|
|
997
|
+
h(this, "managers", /* @__PURE__ */ new Map());
|
|
1249
998
|
}
|
|
1250
999
|
static getInstance() {
|
|
1251
|
-
return
|
|
1000
|
+
return S.instance || (S.instance = new S()), S.instance;
|
|
1252
1001
|
}
|
|
1253
1002
|
register(e, t) {
|
|
1254
1003
|
this.managers.set(e, t);
|
|
@@ -1267,141 +1016,129 @@ const G = class v {
|
|
|
1267
1016
|
*/
|
|
1268
1017
|
getDebugInfo() {
|
|
1269
1018
|
const e = {};
|
|
1270
|
-
for (const [t,
|
|
1019
|
+
for (const [t, n] of this.managers)
|
|
1271
1020
|
e[t] = {
|
|
1272
|
-
states:
|
|
1273
|
-
bindings:
|
|
1274
|
-
observedObjects:
|
|
1275
|
-
environmentObjects:
|
|
1276
|
-
metadata:
|
|
1021
|
+
states: n.getStates().size,
|
|
1022
|
+
bindings: n.getBindings().size,
|
|
1023
|
+
observedObjects: n.getObservedObjects().size,
|
|
1024
|
+
environmentObjects: n.getEnvironmentObjects().size,
|
|
1025
|
+
metadata: n.getRegistry().getMetadata(t)
|
|
1277
1026
|
};
|
|
1278
1027
|
return e;
|
|
1279
1028
|
}
|
|
1280
1029
|
};
|
|
1281
|
-
|
|
1282
|
-
let
|
|
1283
|
-
function
|
|
1284
|
-
|
|
1030
|
+
h(V, "instance");
|
|
1031
|
+
let v = V;
|
|
1032
|
+
function Be(r, e) {
|
|
1033
|
+
v.getInstance().register(r, e);
|
|
1285
1034
|
}
|
|
1286
|
-
function
|
|
1287
|
-
|
|
1035
|
+
function He(r) {
|
|
1036
|
+
v.getInstance().unregister(r);
|
|
1288
1037
|
}
|
|
1289
|
-
function
|
|
1290
|
-
return
|
|
1038
|
+
function J(r) {
|
|
1039
|
+
return v.getInstance().getManager(r);
|
|
1291
1040
|
}
|
|
1292
|
-
function
|
|
1293
|
-
return
|
|
1041
|
+
function K() {
|
|
1042
|
+
return v.getInstance().getAllManagers();
|
|
1294
1043
|
}
|
|
1295
|
-
function
|
|
1296
|
-
return
|
|
1044
|
+
function Q() {
|
|
1045
|
+
return v.getInstance().getDebugInfo();
|
|
1297
1046
|
}
|
|
1298
|
-
function
|
|
1047
|
+
function Le() {
|
|
1299
1048
|
if (typeof window < "u" && process.env.NODE_ENV === "development") {
|
|
1300
|
-
const
|
|
1301
|
-
|
|
1302
|
-
getAll:
|
|
1303
|
-
getDebugInfo:
|
|
1304
|
-
getManager:
|
|
1305
|
-
}, window.__TACHUI_DEBUG__ =
|
|
1049
|
+
const r = window.__TACHUI_DEBUG__ || {};
|
|
1050
|
+
r.stateManagers = {
|
|
1051
|
+
getAll: K,
|
|
1052
|
+
getDebugInfo: Q,
|
|
1053
|
+
getManager: J
|
|
1054
|
+
}, window.__TACHUI_DEBUG__ = r, console.log(
|
|
1306
1055
|
"TachUI State Management debugging enabled. Use window.__TACHUI_DEBUG__.stateManagers"
|
|
1307
1056
|
);
|
|
1308
1057
|
}
|
|
1309
1058
|
}
|
|
1310
|
-
const
|
|
1311
|
-
function
|
|
1312
|
-
return console.warn("useEnvironmentObject is deprecated, use EnvironmentObject instead"),
|
|
1059
|
+
const We = P;
|
|
1060
|
+
function Fe(r) {
|
|
1061
|
+
return console.warn("useEnvironmentObject is deprecated, use EnvironmentObject instead"), k(r);
|
|
1313
1062
|
}
|
|
1314
|
-
const
|
|
1063
|
+
const qe = {
|
|
1315
1064
|
/**
|
|
1316
1065
|
* Check if a value is any kind of property wrapper
|
|
1317
1066
|
*/
|
|
1318
|
-
isPropertyWrapper(
|
|
1319
|
-
return
|
|
1067
|
+
isPropertyWrapper(r) {
|
|
1068
|
+
return r && typeof r == "object" && "wrappedValue" in r && "projectedValue" in r;
|
|
1320
1069
|
},
|
|
1321
1070
|
/**
|
|
1322
1071
|
* Extract the wrapped value from any property wrapper
|
|
1323
1072
|
*/
|
|
1324
|
-
unwrap(
|
|
1325
|
-
return this.isPropertyWrapper(
|
|
1073
|
+
unwrap(r) {
|
|
1074
|
+
return this.isPropertyWrapper(r) ? r.wrappedValue : r;
|
|
1326
1075
|
},
|
|
1327
1076
|
/**
|
|
1328
1077
|
* Create a debug snapshot of all property wrappers in a component
|
|
1329
1078
|
*/
|
|
1330
|
-
createDebugSnapshot(
|
|
1079
|
+
createDebugSnapshot(r) {
|
|
1331
1080
|
if (typeof window < "u") {
|
|
1332
1081
|
const e = window.__TACHUI_DEBUG__;
|
|
1333
1082
|
if (e)
|
|
1334
1083
|
return {
|
|
1335
|
-
states: e.states ? Object.keys(e.states).filter((t) => t.startsWith(
|
|
1336
|
-
observedObjects: e.observedObjects ? Object.keys(e.observedObjects).filter((t) => t.startsWith(
|
|
1337
|
-
notificationCount: e.observedObjects[
|
|
1338
|
-
object: e.observedObjects[
|
|
1084
|
+
states: e.states ? Object.keys(e.states).filter((t) => t.startsWith(r)).reduce((t, n) => (t[n] = e.states[n].getValue(), t), {}) : {},
|
|
1085
|
+
observedObjects: e.observedObjects ? Object.keys(e.observedObjects).filter((t) => t.startsWith(r)).reduce((t, n) => (t[n] = {
|
|
1086
|
+
notificationCount: e.observedObjects[n].getNotificationCount(),
|
|
1087
|
+
object: e.observedObjects[n].getObject()
|
|
1339
1088
|
}, t), {}) : {}
|
|
1340
1089
|
};
|
|
1341
1090
|
}
|
|
1342
1091
|
return null;
|
|
1343
1092
|
}
|
|
1344
|
-
},
|
|
1093
|
+
}, Je = "0.1.0";
|
|
1345
1094
|
export {
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
Ae as h,
|
|
1389
|
-
Le as i,
|
|
1390
|
-
$e as j,
|
|
1391
|
-
ke as k,
|
|
1392
|
-
Ue as l,
|
|
1393
|
-
Je as m,
|
|
1394
|
-
Re as n,
|
|
1395
|
-
Be as o,
|
|
1396
|
-
We as p,
|
|
1397
|
-
at as q,
|
|
1398
|
-
Ge as r,
|
|
1399
|
-
ct as s,
|
|
1095
|
+
Pe as A,
|
|
1096
|
+
Ve as B,
|
|
1097
|
+
Ce as C,
|
|
1098
|
+
De as D,
|
|
1099
|
+
ze as E,
|
|
1100
|
+
Ie as F,
|
|
1101
|
+
U as G,
|
|
1102
|
+
We as H,
|
|
1103
|
+
Fe as I,
|
|
1104
|
+
qe as J,
|
|
1105
|
+
Re as K,
|
|
1106
|
+
je as L,
|
|
1107
|
+
K as M,
|
|
1108
|
+
J as N,
|
|
1109
|
+
Q as O,
|
|
1110
|
+
Le as P,
|
|
1111
|
+
Be as Q,
|
|
1112
|
+
O as R,
|
|
1113
|
+
ke as S,
|
|
1114
|
+
Te as T,
|
|
1115
|
+
F as U,
|
|
1116
|
+
Je as V,
|
|
1117
|
+
He as W,
|
|
1118
|
+
Oe as a,
|
|
1119
|
+
Me as b,
|
|
1120
|
+
_e as c,
|
|
1121
|
+
de as d,
|
|
1122
|
+
pe as e,
|
|
1123
|
+
le as f,
|
|
1124
|
+
he as g,
|
|
1125
|
+
ge as h,
|
|
1126
|
+
xe as i,
|
|
1127
|
+
me as j,
|
|
1128
|
+
fe as k,
|
|
1129
|
+
ye as l,
|
|
1130
|
+
Ee as m,
|
|
1131
|
+
Se as n,
|
|
1132
|
+
ve as o,
|
|
1133
|
+
we as p,
|
|
1134
|
+
Ne as q,
|
|
1135
|
+
be as r,
|
|
1136
|
+
$e as s,
|
|
1400
1137
|
M as t,
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1138
|
+
B as u,
|
|
1139
|
+
Ue as v,
|
|
1140
|
+
Ae as w,
|
|
1141
|
+
u as x,
|
|
1142
|
+
_ as y,
|
|
1143
|
+
Ge as z
|
|
1407
1144
|
};
|