@tachui/core 0.8.0-alpha → 0.8.5-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 +58 -2
- package/dist/assets/AssetCollection.d.ts.map +1 -1
- package/dist/assets/ColorAsset.d.ts.map +1 -1
- package/dist/assets/index.d.ts +1 -0
- package/dist/assets/index.d.ts.map +1 -1
- package/dist/assets/index.js +486 -0
- package/dist/assets/types.d.ts +8 -68
- package/dist/assets/types.d.ts.map +1 -1
- package/dist/binding-CYpEQquE.js +308 -0
- package/dist/build-plugins/index.d.ts +3 -0
- package/dist/build-plugins/index.d.ts.map +1 -0
- package/dist/build-plugins/modifier-types.d.ts +12 -0
- package/dist/build-plugins/modifier-types.d.ts.map +1 -0
- package/dist/build-tools/typegen-runner.d.ts +29 -0
- package/dist/build-tools/typegen-runner.d.ts.map +1 -0
- 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 +8 -2
- package/dist/bundles/minimal.d.ts.map +1 -1
- package/dist/common.js +427 -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/{component-XAzF1xqs.js → component-CECyfUOE.js} +80 -68
- package/dist/{component-base-x2XmHFjy.js → component-base-CJ__jTlr.js} +9 -7
- package/dist/component-context-B6qX_Qsg.js +176 -0
- package/dist/components/factory.d.ts +24 -0
- package/dist/components/factory.d.ts.map +1 -0
- package/dist/components/index.d.ts +3 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +8 -6
- package/dist/components/wrapper.d.ts +70 -30
- package/dist/components/wrapper.d.ts.map +1 -1
- package/dist/concatenated-component-_tF1eMvy.js +2288 -0
- package/dist/concatenation/concatenated-component.d.ts +16 -2
- package/dist/concatenation/concatenated-component.d.ts.map +1 -1
- package/dist/concatenation/text-optimizer.d.ts.map +1 -1
- package/dist/config.d.ts +7 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/constants/layout.d.ts +2 -9
- package/dist/constants/layout.d.ts.map +1 -1
- package/dist/css-classes/index.js +15 -173
- package/dist/{effect-B9Knft0b.js → effect-DGmdACI2.js} +3 -3
- package/dist/enhanced-renderer-Bwqsh8Ku.js +172 -0
- package/dist/essential.js +425 -391
- package/dist/{index-DIvMCJQO.js → factories-Co2Lv2kJ.js} +13 -13
- package/dist/factory-D7jAY5Kn.js +485 -0
- package/dist/gradients/css-generator.js +99 -0
- package/dist/gradients/index.js +56 -0
- package/dist/gradients/reactive.d.ts.map +1 -1
- package/dist/gradients/types.d.ts +3 -91
- package/dist/gradients/types.d.ts.map +1 -1
- package/dist/hooks-DeLasj54.js +446 -0
- package/dist/index-JQ1sW1SK.js +2049 -0
- package/dist/index-X8MVY78C.js +618 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +426 -392
- package/dist/minimal-prod.js +94 -93
- package/dist/minimal.js +126 -106
- package/dist/modifiers/alignment.d.ts +5 -0
- package/dist/modifiers/alignment.d.ts.map +1 -0
- package/dist/modifiers/base.d.ts +6 -7
- package/dist/modifiers/base.d.ts.map +1 -1
- package/dist/modifiers/base.js +24 -16
- package/dist/modifiers/builder.d.ts +28 -165
- package/dist/modifiers/builder.d.ts.map +1 -1
- package/dist/modifiers/builder.js +7 -7
- package/dist/modifiers/core.d.ts +0 -1
- package/dist/modifiers/core.d.ts.map +1 -1
- package/dist/modifiers/corner-radius.d.ts +8 -0
- package/dist/modifiers/corner-radius.d.ts.map +1 -0
- package/dist/modifiers/index.d.ts +9 -6
- package/dist/modifiers/index.d.ts.map +1 -1
- package/dist/modifiers/index.js +36 -30
- package/dist/modifiers/layout-priority.d.ts +8 -0
- package/dist/modifiers/layout-priority.d.ts.map +1 -0
- package/dist/modifiers/opacity.d.ts +8 -0
- package/dist/modifiers/opacity.d.ts.map +1 -0
- package/dist/modifiers/presets.d.ts.map +1 -1
- package/dist/modifiers/proxy.d.ts +4 -0
- package/dist/modifiers/proxy.d.ts.map +1 -0
- package/dist/modifiers/registration-utils.d.ts +7 -0
- package/dist/modifiers/registration-utils.d.ts.map +1 -0
- package/dist/modifiers/registry.d.ts +18 -9
- package/dist/modifiers/registry.d.ts.map +1 -1
- package/dist/modifiers/registry.js +2 -2
- package/dist/modifiers/type-generator.d.ts +82 -0
- package/dist/modifiers/type-generator.d.ts.map +1 -0
- package/dist/modifiers/types.d.ts +2 -479
- package/dist/modifiers/types.d.ts.map +1 -1
- package/dist/modifiers/types.js +1 -4
- package/dist/observed-object-DepiqSgg.js +269 -0
- package/dist/optimization-CbKNA9w4.js +21 -0
- package/dist/plugin-BCAdZXKq.js +1680 -0
- package/dist/plugins/index.js +28 -8
- package/dist/plugins/simplified-lazy-loader.d.ts.map +1 -1
- package/dist/presets-B9x94uRn.js +381 -0
- package/dist/proxy-Cqmbiyx0.js +175 -0
- package/dist/reactive/cleanup.d.ts.map +1 -1
- package/dist/reactive/computed.d.ts +1 -1
- package/dist/reactive/computed.d.ts.map +1 -1
- package/dist/reactive/context.d.ts +4 -3
- package/dist/reactive/context.d.ts.map +1 -1
- package/dist/reactive/index.d.ts +1 -0
- package/dist/reactive/index.d.ts.map +1 -1
- package/dist/reactive/index.js +84 -490
- package/dist/reactive/signal-list.d.ts +100 -0
- package/dist/reactive/signal-list.d.ts.map +1 -0
- package/dist/reactive/signal.d.ts.map +1 -1
- package/dist/reactive/types.d.ts +2 -89
- package/dist/reactive/types.d.ts.map +1 -1
- package/dist/reactive/types.js +1 -4
- package/dist/registration-utils-CNsN4eoU.js +27 -0
- package/dist/runtime/component.d.ts.map +1 -1
- 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 +58 -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 +85 -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 +45 -0
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/dom-bridge.d.ts +1 -1
- package/dist/runtime/dom-bridge.d.ts.map +1 -1
- package/dist/runtime/dom-bridge.js +239 -12
- package/dist/runtime/event-delegation.d.ts +59 -0
- package/dist/runtime/event-delegation.d.ts.map +1 -0
- package/dist/runtime/index.d.ts +3 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +96 -0
- package/dist/runtime/layout-scheduler.d.ts +89 -0
- package/dist/runtime/layout-scheduler.d.ts.map +1 -0
- package/dist/runtime/props.d.ts.map +1 -1
- package/dist/runtime/renderer.d.ts +54 -2
- package/dist/runtime/renderer.d.ts.map +1 -1
- package/dist/runtime/renderer.js +11 -7
- package/dist/runtime/semantic-role-manager.d.ts.map +1 -1
- package/dist/runtime/types.d.ts +2 -226
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/runtime/types.js +1 -1
- package/dist/scheduler-DI_8ykMk.js +169 -0
- package/dist/signal-list-BdpxSodS.js +525 -0
- package/dist/state/index.js +319 -0
- package/dist/theme-BFaKUcjZ.js +677 -0
- package/dist/utils/clone-helpers.d.ts +11 -0
- package/dist/utils/clone-helpers.d.ts.map +1 -0
- package/dist/validation/index.js +28 -26
- package/dist/version.d.ts +19 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +6 -0
- package/package.json +69 -9
- package/dist/concatenated-component-ByPl3_FF.js +0 -2933
- package/dist/dom-bridge-CAa1N2zX.js +0 -406
- package/dist/index-DCPJFUm9.js +0 -1407
- package/dist/index-vdsiw6gQ.js +0 -777
- package/dist/modifiers/as-html-validator.d.ts +0 -20
- package/dist/modifiers/as-html-validator.d.ts.map +0 -1
- package/dist/modifiers/as-html.d.ts +0 -65
- package/dist/modifiers/as-html.d.ts.map +0 -1
- package/dist/modifiers/background.d.ts +0 -51
- package/dist/modifiers/background.d.ts.map +0 -1
- package/dist/modifiers/basic-sanitizer.d.ts +0 -54
- package/dist/modifiers/basic-sanitizer.d.ts.map +0 -1
- package/dist/modifiers/css.d.ts +0 -86
- package/dist/modifiers/css.d.ts.map +0 -1
- package/dist/production-minimal-BY_gMc-l.js +0 -2532
- package/dist/scheduler-BKeqwrYE.js +0 -814
package/dist/index-DCPJFUm9.js
DELETED
|
@@ -1,1407 +0,0 @@
|
|
|
1
|
-
import { infinity as c } from "./constants/layout.js";
|
|
2
|
-
import { LayoutModifier as d } from "./modifiers/base.js";
|
|
3
|
-
import { C as y, u as U } from "./concatenated-component-ByPl3_FF.js";
|
|
4
|
-
import { a as D, j as R, R as B, L as W, v as H } from "./production-minimal-BY_gMc-l.js";
|
|
5
|
-
import { G as I, W as z } from "./scheduler-BKeqwrYE.js";
|
|
6
|
-
import { c as A } from "./effect-B9Knft0b.js";
|
|
7
|
-
import { d as S, g as L, p as F, c as q } from "./dom-bridge-CAa1N2zX.js";
|
|
8
|
-
import "./component-XAzF1xqs.js";
|
|
9
|
-
import "./index-vdsiw6gQ.js";
|
|
10
|
-
import "./component-base-x2XmHFjy.js";
|
|
11
|
-
import "./plugins/index.js";
|
|
12
|
-
import "./validation/index.js";
|
|
13
|
-
function Pe() {
|
|
14
|
-
return new d({
|
|
15
|
-
frame: {
|
|
16
|
-
maxWidth: c
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
function De() {
|
|
21
|
-
return new d({
|
|
22
|
-
frame: {
|
|
23
|
-
maxHeight: c
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
function Ie() {
|
|
28
|
-
return new d({
|
|
29
|
-
frame: {
|
|
30
|
-
maxWidth: c,
|
|
31
|
-
maxHeight: c
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
function ze() {
|
|
36
|
-
return new d({
|
|
37
|
-
frame: {
|
|
38
|
-
width: c,
|
|
39
|
-
height: c
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
function Ae(n) {
|
|
44
|
-
return new d({
|
|
45
|
-
frame: {
|
|
46
|
-
width: n,
|
|
47
|
-
maxHeight: c
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
function $e(n) {
|
|
52
|
-
return new d({
|
|
53
|
-
frame: {
|
|
54
|
-
height: n,
|
|
55
|
-
maxWidth: c
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
function ke(n, e) {
|
|
60
|
-
return new d({
|
|
61
|
-
frame: {
|
|
62
|
-
width: c,
|
|
63
|
-
height: c,
|
|
64
|
-
maxWidth: n,
|
|
65
|
-
maxHeight: e
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
function Ge(n, e, t, r) {
|
|
70
|
-
return new d({
|
|
71
|
-
frame: {
|
|
72
|
-
width: c,
|
|
73
|
-
height: c,
|
|
74
|
-
minWidth: n,
|
|
75
|
-
maxWidth: e,
|
|
76
|
-
minHeight: t,
|
|
77
|
-
maxHeight: r
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
function Ue() {
|
|
82
|
-
return new d({
|
|
83
|
-
frame: {
|
|
84
|
-
maxWidth: c,
|
|
85
|
-
maxHeight: c
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
function Re() {
|
|
90
|
-
return new d({
|
|
91
|
-
frame: {
|
|
92
|
-
width: "100vw",
|
|
93
|
-
height: "100vh"
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
function Be() {
|
|
98
|
-
return new d({
|
|
99
|
-
frame: {
|
|
100
|
-
width: c,
|
|
101
|
-
height: c
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
function We() {
|
|
106
|
-
return new d({
|
|
107
|
-
frame: {
|
|
108
|
-
width: c
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
const He = Symbol.for("tachui.concat");
|
|
113
|
-
function Le(n) {
|
|
114
|
-
return n && typeof n == "object" && typeof n.isConcatenatable == "function" && n.isConcatenatable();
|
|
115
|
-
}
|
|
116
|
-
function Fe(n) {
|
|
117
|
-
return n && typeof n == "object" && n.constructor.name === "ConcatenatedComponent";
|
|
118
|
-
}
|
|
119
|
-
const qe = Symbol.for("tachui.concat");
|
|
120
|
-
class Ke {
|
|
121
|
-
/**
|
|
122
|
-
* Concatenate this component with another concatenatable component
|
|
123
|
-
*/
|
|
124
|
-
concat(e) {
|
|
125
|
-
const t = this.toSegment(), r = e.toSegment();
|
|
126
|
-
return e instanceof y ? new y(
|
|
127
|
-
[t, ...e.segments],
|
|
128
|
-
this.mergeMetadata(e.metadata, e.segments.length + 1)
|
|
129
|
-
) : new y(
|
|
130
|
-
[t, r],
|
|
131
|
-
this.createMetadata(2)
|
|
132
|
-
);
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Check if this component supports concatenation
|
|
136
|
-
*/
|
|
137
|
-
isConcatenatable() {
|
|
138
|
-
return !0;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Create metadata for a new concatenated component
|
|
142
|
-
*/
|
|
143
|
-
createMetadata(e) {
|
|
144
|
-
return {
|
|
145
|
-
totalSegments: e,
|
|
146
|
-
accessibilityRole: this.determineAccessibilityRole(),
|
|
147
|
-
semanticStructure: this.determineSemanticStructure()
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Merge metadata when concatenating with existing concatenated component
|
|
152
|
-
*/
|
|
153
|
-
mergeMetadata(e, t) {
|
|
154
|
-
return {
|
|
155
|
-
totalSegments: t,
|
|
156
|
-
accessibilityRole: this.mergeAccessibilityRoles(e.accessibilityRole),
|
|
157
|
-
semanticStructure: this.mergeSemanticStructures(e.semanticStructure)
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Determine the accessibility role for this component
|
|
162
|
-
*/
|
|
163
|
-
determineAccessibilityRole() {
|
|
164
|
-
const e = this.constructor.name;
|
|
165
|
-
return e === "EnhancedText" ? "text" : e === "EnhancedImage" || e === "EnhancedButton" || e === "EnhancedLink" ? "group" : "composite";
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Determine the semantic structure for this component
|
|
169
|
-
*/
|
|
170
|
-
determineSemanticStructure() {
|
|
171
|
-
const e = this.constructor.name;
|
|
172
|
-
return e === "EnhancedText" || e === "EnhancedImage" ? "inline" : "mixed";
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Merge accessibility roles when combining components
|
|
176
|
-
*/
|
|
177
|
-
mergeAccessibilityRoles(e) {
|
|
178
|
-
const t = this.determineAccessibilityRole();
|
|
179
|
-
return t === "text" && e === "text" ? "text" : t === "composite" || e === "composite" ? "composite" : "group";
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Merge semantic structures when combining components
|
|
183
|
-
*/
|
|
184
|
-
mergeSemanticStructures(e) {
|
|
185
|
-
const t = this.determineSemanticStructure();
|
|
186
|
-
return t === "inline" && e === "inline" ? "inline" : t === "block" && e === "block" ? "block" : "mixed";
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
function Je(n) {
|
|
190
|
-
const e = n;
|
|
191
|
-
return e.concat = function(t) {
|
|
192
|
-
const r = {
|
|
193
|
-
id: this.id,
|
|
194
|
-
component: this,
|
|
195
|
-
modifiers: this.modifiers || [],
|
|
196
|
-
render: () => {
|
|
197
|
-
const s = this.render();
|
|
198
|
-
return Array.isArray(s) ? s[0] : s;
|
|
199
|
-
}
|
|
200
|
-
}, i = t.toSegment();
|
|
201
|
-
return t instanceof y ? new y(
|
|
202
|
-
[r, ...t.segments],
|
|
203
|
-
{
|
|
204
|
-
totalSegments: t.segments.length + 1,
|
|
205
|
-
accessibilityRole: "group",
|
|
206
|
-
semanticStructure: "mixed"
|
|
207
|
-
}
|
|
208
|
-
) : new y(
|
|
209
|
-
[r, i],
|
|
210
|
-
{
|
|
211
|
-
totalSegments: 2,
|
|
212
|
-
accessibilityRole: "group",
|
|
213
|
-
semanticStructure: "mixed"
|
|
214
|
-
}
|
|
215
|
-
);
|
|
216
|
-
}, e.toSegment = function() {
|
|
217
|
-
return {
|
|
218
|
-
id: this.id,
|
|
219
|
-
component: this,
|
|
220
|
-
modifiers: this.modifiers || [],
|
|
221
|
-
render: () => {
|
|
222
|
-
const t = this.render();
|
|
223
|
-
return Array.isArray(t) ? t[0] : t;
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
|
-
}, e.isConcatenatable = function() {
|
|
227
|
-
return !0;
|
|
228
|
-
}, e;
|
|
229
|
-
}
|
|
230
|
-
const h = /* @__PURE__ */ new Map(), K = 300 * 1e3, T = 100;
|
|
231
|
-
class Xe {
|
|
232
|
-
/**
|
|
233
|
-
* Optimize an array of segments by merging compatible adjacent text segments
|
|
234
|
-
* Enhanced with caching and performance monitoring
|
|
235
|
-
*/
|
|
236
|
-
static optimize(e) {
|
|
237
|
-
const t = performance.now();
|
|
238
|
-
if (e.length < 2) return e;
|
|
239
|
-
const r = this.generateCacheKey(e), i = this.getCachedOptimization(r);
|
|
240
|
-
if (i)
|
|
241
|
-
return i.optimizedSegments;
|
|
242
|
-
const s = this.performOptimization(e), a = performance.now() - t, o = {
|
|
243
|
-
...this.getOptimizationStats(e, s),
|
|
244
|
-
processingTimeMs: a
|
|
245
|
-
};
|
|
246
|
-
return this.cacheOptimization(r, 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
|
-
/**
|
|
249
|
-
* Core optimization algorithm separated for clarity
|
|
250
|
-
*/
|
|
251
|
-
static performOptimization(e) {
|
|
252
|
-
const t = [];
|
|
253
|
-
for (const r of e) {
|
|
254
|
-
const i = t[t.length - 1];
|
|
255
|
-
i && this.canMergeTextSegments(i, r) ? t[t.length - 1] = this.mergeTextSegments(i, r) : t.push(r);
|
|
256
|
-
}
|
|
257
|
-
return t;
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Generate a cache key from segments
|
|
261
|
-
*/
|
|
262
|
-
static generateCacheKey(e) {
|
|
263
|
-
return e.map((r) => {
|
|
264
|
-
const i = r.component, s = this.extractTextContent(i), a = this.hashModifiers(r.modifiers);
|
|
265
|
-
return `${i.constructor.name}:${s}:${a}`;
|
|
266
|
-
}).join("|");
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Hash modifiers for cache key generation
|
|
270
|
-
*/
|
|
271
|
-
static hashModifiers(e) {
|
|
272
|
-
if (e.length === 0) return "none";
|
|
273
|
-
try {
|
|
274
|
-
const t = e.map((i) => ({
|
|
275
|
-
type: i.type,
|
|
276
|
-
props: i.properties
|
|
277
|
-
})), r = JSON.stringify(t);
|
|
278
|
-
return typeof btoa == "function" ? btoa(r).substring(0, 8) : this.simpleHash(r).toString(16).substring(0, 8);
|
|
279
|
-
} catch {
|
|
280
|
-
return "hash-error";
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
/**
|
|
284
|
-
* Simple hash function fallback for environments without btoa
|
|
285
|
-
*/
|
|
286
|
-
static simpleHash(e) {
|
|
287
|
-
let t = 0;
|
|
288
|
-
for (let r = 0; r < e.length; r++) {
|
|
289
|
-
const i = e.charCodeAt(r);
|
|
290
|
-
t = (t << 5) - t + i, t = t & t;
|
|
291
|
-
}
|
|
292
|
-
return Math.abs(t);
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Get cached optimization result
|
|
296
|
-
*/
|
|
297
|
-
static getCachedOptimization(e) {
|
|
298
|
-
const t = h.get(e);
|
|
299
|
-
return t ? Date.now() - t.timestamp > K ? (h.delete(e), null) : t : null;
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* Cache optimization result
|
|
303
|
-
*/
|
|
304
|
-
static cacheOptimization(e, t, r) {
|
|
305
|
-
if (h.size >= T) {
|
|
306
|
-
const i = h.keys().next().value;
|
|
307
|
-
i && h.delete(i);
|
|
308
|
-
}
|
|
309
|
-
h.set(e, {
|
|
310
|
-
optimizedSegments: t,
|
|
311
|
-
stats: r,
|
|
312
|
-
timestamp: Date.now()
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
/**
|
|
316
|
-
* Clear optimization cache (useful for testing)
|
|
317
|
-
*/
|
|
318
|
-
static clearCache() {
|
|
319
|
-
h.clear();
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* Get cache statistics
|
|
323
|
-
*/
|
|
324
|
-
static getCacheStats() {
|
|
325
|
-
return {
|
|
326
|
-
size: h.size,
|
|
327
|
-
maxSize: T,
|
|
328
|
-
hitRate: 0
|
|
329
|
-
// Would need to track hits/misses to calculate this
|
|
330
|
-
};
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
* Check if two segments can be merged
|
|
334
|
-
*/
|
|
335
|
-
static canMergeTextSegments(e, t) {
|
|
336
|
-
return e.component.constructor.name !== "EnhancedText" || t.component.constructor.name !== "EnhancedText" ? !1 : this.modifiersCompatible(e.modifiers, t.modifiers);
|
|
337
|
-
}
|
|
338
|
-
/**
|
|
339
|
-
* Check if two modifier arrays are compatible for merging
|
|
340
|
-
*/
|
|
341
|
-
static modifiersCompatible(e, t) {
|
|
342
|
-
if (e.length !== t.length) return !1;
|
|
343
|
-
for (let r = 0; r < e.length; r++)
|
|
344
|
-
if (!this.modifierEqual(e[r], t[r]))
|
|
345
|
-
return !1;
|
|
346
|
-
return !0;
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* Check if two modifiers are equal (simplified comparison)
|
|
350
|
-
*/
|
|
351
|
-
static modifierEqual(e, t) {
|
|
352
|
-
if (e.type !== t.type) return !1;
|
|
353
|
-
try {
|
|
354
|
-
return JSON.stringify(e.properties) === JSON.stringify(t.properties);
|
|
355
|
-
} catch {
|
|
356
|
-
return !1;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* Merge two text segments into a single segment
|
|
361
|
-
*/
|
|
362
|
-
static mergeTextSegments(e, t) {
|
|
363
|
-
const r = e.component, i = t.component, s = this.extractTextContent(r), a = this.extractTextContent(i), o = s + a;
|
|
364
|
-
return {
|
|
365
|
-
id: `merged-${e.id}-${t.id}`,
|
|
366
|
-
component: this.createMergedTextComponent(o, r.props, e.modifiers),
|
|
367
|
-
modifiers: e.modifiers,
|
|
368
|
-
// Use modifiers from first segment (they're identical)
|
|
369
|
-
render: () => this.createMergedTextComponent(o, r.props, e.modifiers).render()[0]
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Extract text content from a text component
|
|
374
|
-
*/
|
|
375
|
-
static extractTextContent(e) {
|
|
376
|
-
const t = e.props?.content;
|
|
377
|
-
return typeof t == "string" ? t : typeof t == "function" ? t() : t && typeof t == "object" && "peek" in t && t.peek() || "";
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* Create a new merged text component
|
|
381
|
-
*/
|
|
382
|
-
static createMergedTextComponent(e, t, r) {
|
|
383
|
-
const i = {
|
|
384
|
-
...t,
|
|
385
|
-
content: e
|
|
386
|
-
};
|
|
387
|
-
return {
|
|
388
|
-
type: "Text",
|
|
389
|
-
id: `merged-text-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
|
|
390
|
-
props: i,
|
|
391
|
-
mounted: !1,
|
|
392
|
-
cleanup: [],
|
|
393
|
-
modifiers: r,
|
|
394
|
-
render() {
|
|
395
|
-
const s = globalThis.__tachui_runtime;
|
|
396
|
-
if (s && s.h && s.text) {
|
|
397
|
-
const a = s.text(e);
|
|
398
|
-
return [s.h("span", {}, [a])];
|
|
399
|
-
}
|
|
400
|
-
return [];
|
|
401
|
-
}
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
|
-
/**
|
|
405
|
-
* Analyze segments and determine if optimization would be beneficial
|
|
406
|
-
*/
|
|
407
|
-
static shouldOptimize(e) {
|
|
408
|
-
if (e.length < 2) return !1;
|
|
409
|
-
let t = 0;
|
|
410
|
-
for (let r = 0; r < e.length - 1; r++) {
|
|
411
|
-
const i = e[r], s = e[r + 1];
|
|
412
|
-
i.component.constructor.name === "EnhancedText" && s.component.constructor.name === "EnhancedText" && t++;
|
|
413
|
-
}
|
|
414
|
-
return t > 0;
|
|
415
|
-
}
|
|
416
|
-
/**
|
|
417
|
-
* Get optimization statistics (enhanced for Phase 4.1)
|
|
418
|
-
*/
|
|
419
|
-
static getOptimizationStats(e, t) {
|
|
420
|
-
const r = e.length - t.length, i = e.length > 0 ? Math.round(r / e.length * 100) : 0;
|
|
421
|
-
return {
|
|
422
|
-
originalCount: e.length,
|
|
423
|
-
optimizedCount: t.length,
|
|
424
|
-
reductionPercent: i,
|
|
425
|
-
textSegmentsMerged: r
|
|
426
|
-
};
|
|
427
|
-
}
|
|
428
|
-
/**
|
|
429
|
-
* Advanced optimization analysis for performance monitoring
|
|
430
|
-
*/
|
|
431
|
-
static analyzeOptimizationOpportunities(e) {
|
|
432
|
-
let t = 0, r = 0, i = 0, s = 0;
|
|
433
|
-
for (let o = 0; o < e.length; o++) {
|
|
434
|
-
const u = e[o];
|
|
435
|
-
switch (u.component.constructor.name) {
|
|
436
|
-
case "EnhancedText":
|
|
437
|
-
if (t++, o < e.length - 1) {
|
|
438
|
-
const b = e[o + 1];
|
|
439
|
-
this.canMergeTextSegments(u, b) && s++;
|
|
440
|
-
}
|
|
441
|
-
break;
|
|
442
|
-
case "EnhancedImage":
|
|
443
|
-
r++;
|
|
444
|
-
break;
|
|
445
|
-
case "EnhancedButton":
|
|
446
|
-
case "EnhancedLinkComponent":
|
|
447
|
-
i++;
|
|
448
|
-
break;
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
const a = e.length > 0 ? Math.round(s / e.length * 100) : 0;
|
|
452
|
-
return {
|
|
453
|
-
totalSegments: e.length,
|
|
454
|
-
textSegments: t,
|
|
455
|
-
imageSegments: r,
|
|
456
|
-
interactiveSegments: i,
|
|
457
|
-
optimizableTextPairs: s,
|
|
458
|
-
estimatedReductionPercent: a
|
|
459
|
-
};
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
class Ye {
|
|
463
|
-
// Placeholder implementation
|
|
464
|
-
}
|
|
465
|
-
function Ze() {
|
|
466
|
-
}
|
|
467
|
-
function Qe() {
|
|
468
|
-
}
|
|
469
|
-
function et() {
|
|
470
|
-
}
|
|
471
|
-
function tt() {
|
|
472
|
-
}
|
|
473
|
-
class J extends D {
|
|
474
|
-
constructor(e, t) {
|
|
475
|
-
super(e), this.definitions = t;
|
|
476
|
-
}
|
|
477
|
-
resolve() {
|
|
478
|
-
const e = this.getCurrentTheme(), t = this.definitions[e] || this.definitions.light;
|
|
479
|
-
return U(t);
|
|
480
|
-
}
|
|
481
|
-
getCurrentTheme() {
|
|
482
|
-
return typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
function nt(n) {
|
|
486
|
-
return new J("gradient-asset", n);
|
|
487
|
-
}
|
|
488
|
-
var X = Object.defineProperty, Y = (n, e, t) => e in n ? X(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, j = (n, e, t) => Y(n, typeof e != "symbol" ? e + "" : e, t);
|
|
489
|
-
class E extends D {
|
|
490
|
-
constructor(e, t, r) {
|
|
491
|
-
super(e), this.reactiveDefinition = t, j(this, "currentGradient"), j(this, "subscriptions", []), j(this, "updateCallback"), this.updateCallback = r, this.currentGradient = this.resolveStaticGradient(), this.setupSignalSubscriptions();
|
|
492
|
-
}
|
|
493
|
-
/**
|
|
494
|
-
* Resolve current gradient to CSS
|
|
495
|
-
*/
|
|
496
|
-
resolve() {
|
|
497
|
-
return this.gradientToCSS(this.currentGradient);
|
|
498
|
-
}
|
|
499
|
-
/**
|
|
500
|
-
* Get current static gradient (resolved from signals)
|
|
501
|
-
*/
|
|
502
|
-
getCurrentGradient() {
|
|
503
|
-
return this.currentGradient;
|
|
504
|
-
}
|
|
505
|
-
/**
|
|
506
|
-
* Update the reactive definition and re-subscribe to signals
|
|
507
|
-
*/
|
|
508
|
-
updateDefinition(e) {
|
|
509
|
-
this.cleanup(), this.reactiveDefinition = e, this.currentGradient = this.resolveStaticGradient(), this.setupSignalSubscriptions(), this.notifyUpdate();
|
|
510
|
-
}
|
|
511
|
-
/**
|
|
512
|
-
* Clean up signal subscriptions
|
|
513
|
-
*/
|
|
514
|
-
cleanup() {
|
|
515
|
-
this.subscriptions.forEach((e) => e()), this.subscriptions = [];
|
|
516
|
-
}
|
|
517
|
-
resolveStaticGradient() {
|
|
518
|
-
const { type: e, options: t } = this.reactiveDefinition;
|
|
519
|
-
switch (e) {
|
|
520
|
-
case "linear":
|
|
521
|
-
return W(this.resolveLinearOptions(t));
|
|
522
|
-
case "radial":
|
|
523
|
-
return B(this.resolveRadialOptions(t));
|
|
524
|
-
case "angular":
|
|
525
|
-
case "conic":
|
|
526
|
-
return R(this.resolveAngularOptions(t));
|
|
527
|
-
default:
|
|
528
|
-
throw new Error(`Unsupported reactive gradient type: ${e}`);
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
resolveLinearOptions(e) {
|
|
532
|
-
return {
|
|
533
|
-
colors: e.colors.map((t) => this.resolveValue(t)),
|
|
534
|
-
stops: e.stops?.map((t) => this.resolveValue(t)),
|
|
535
|
-
startPoint: this.resolveValue(e.startPoint),
|
|
536
|
-
endPoint: this.resolveValue(e.endPoint),
|
|
537
|
-
angle: e.angle ? this.resolveValue(e.angle) : void 0
|
|
538
|
-
};
|
|
539
|
-
}
|
|
540
|
-
resolveRadialOptions(e) {
|
|
541
|
-
return {
|
|
542
|
-
colors: e.colors.map((t) => this.resolveValue(t)),
|
|
543
|
-
stops: e.stops?.map((t) => this.resolveValue(t)),
|
|
544
|
-
center: this.resolveValue(e.center),
|
|
545
|
-
startRadius: this.resolveValue(e.startRadius),
|
|
546
|
-
endRadius: this.resolveValue(e.endRadius),
|
|
547
|
-
shape: e.shape ? this.resolveValue(e.shape) : void 0
|
|
548
|
-
};
|
|
549
|
-
}
|
|
550
|
-
resolveAngularOptions(e) {
|
|
551
|
-
return {
|
|
552
|
-
colors: e.colors.map((t) => this.resolveValue(t)),
|
|
553
|
-
stops: e.stops?.map((t) => this.resolveValue(t)),
|
|
554
|
-
center: this.resolveValue(e.center),
|
|
555
|
-
startAngle: this.resolveValue(e.startAngle),
|
|
556
|
-
endAngle: this.resolveValue(e.endAngle)
|
|
557
|
-
};
|
|
558
|
-
}
|
|
559
|
-
resolveValue(e) {
|
|
560
|
-
return this.isSignal(e) ? e.value : e;
|
|
561
|
-
}
|
|
562
|
-
isSignal(e) {
|
|
563
|
-
return e !== null && typeof e == "object" && "value" in e && "subscribe" in e;
|
|
564
|
-
}
|
|
565
|
-
setupSignalSubscriptions() {
|
|
566
|
-
this.subscribeToSignalsInOptions(this.reactiveDefinition.options);
|
|
567
|
-
}
|
|
568
|
-
subscribeToSignalsInOptions(e) {
|
|
569
|
-
for (const [t, r] of Object.entries(e))
|
|
570
|
-
if (Array.isArray(r))
|
|
571
|
-
r.forEach((i) => {
|
|
572
|
-
if (this.isSignal(i)) {
|
|
573
|
-
const s = i.subscribe(() => this.handleSignalChange());
|
|
574
|
-
this.subscriptions.push(s);
|
|
575
|
-
}
|
|
576
|
-
});
|
|
577
|
-
else if (this.isSignal(r)) {
|
|
578
|
-
const i = r.subscribe(() => this.handleSignalChange());
|
|
579
|
-
this.subscriptions.push(i);
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
handleSignalChange() {
|
|
583
|
-
this.currentGradient = this.resolveStaticGradient(), this.notifyUpdate();
|
|
584
|
-
}
|
|
585
|
-
notifyUpdate() {
|
|
586
|
-
this.updateCallback && this.updateCallback();
|
|
587
|
-
}
|
|
588
|
-
gradientToCSS(e) {
|
|
589
|
-
const { gradientToCSS: t } = require("./css-generator");
|
|
590
|
-
return t(e);
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
class l extends H {
|
|
594
|
-
constructor(e, t, r) {
|
|
595
|
-
const i = l.resolveStateOptions(t);
|
|
596
|
-
super(e, i), this.reactiveStateGradients = t, this.updateCallback = r, j(this, "reactiveSubscriptions", []), this.setupStateSignalSubscriptions();
|
|
597
|
-
}
|
|
598
|
-
/**
|
|
599
|
-
* Update reactive state configuration
|
|
600
|
-
*/
|
|
601
|
-
updateReactiveState(e) {
|
|
602
|
-
this.cleanupStateSubscriptions(), this.reactiveStateGradients = e;
|
|
603
|
-
const t = l.resolveStateOptions(e);
|
|
604
|
-
this.updateStateGradients(t), this.setupStateSignalSubscriptions(), this.notifyStateUpdate();
|
|
605
|
-
}
|
|
606
|
-
/**
|
|
607
|
-
* Clean up signal subscriptions
|
|
608
|
-
*/
|
|
609
|
-
cleanupStateSubscriptions() {
|
|
610
|
-
this.reactiveSubscriptions.forEach((e) => e()), this.reactiveSubscriptions = [];
|
|
611
|
-
}
|
|
612
|
-
static resolveStateOptions(e) {
|
|
613
|
-
const t = {
|
|
614
|
-
default: l.resolveValue(e.default),
|
|
615
|
-
animation: e.animation
|
|
616
|
-
};
|
|
617
|
-
return e.hover && (t.hover = l.resolveValue(e.hover)), e.active && (t.active = l.resolveValue(e.active)), e.focus && (t.focus = l.resolveValue(e.focus)), e.disabled && (t.disabled = l.resolveValue(e.disabled)), t;
|
|
618
|
-
}
|
|
619
|
-
static resolveValue(e) {
|
|
620
|
-
return e !== null && typeof e == "object" && "value" in e && "subscribe" in e ? e.value : e;
|
|
621
|
-
}
|
|
622
|
-
static isSignal(e) {
|
|
623
|
-
return e !== null && typeof e == "object" && "value" in e && "subscribe" in e;
|
|
624
|
-
}
|
|
625
|
-
setupStateSignalSubscriptions() {
|
|
626
|
-
Object.entries(this.reactiveStateGradients).forEach(([e, t]) => {
|
|
627
|
-
if (e !== "animation" && l.isSignal(t)) {
|
|
628
|
-
const r = t.subscribe(() => this.handleStateSignalChange());
|
|
629
|
-
this.reactiveSubscriptions.push(r);
|
|
630
|
-
}
|
|
631
|
-
});
|
|
632
|
-
}
|
|
633
|
-
handleStateSignalChange() {
|
|
634
|
-
const e = l.resolveStateOptions(this.reactiveStateGradients);
|
|
635
|
-
this.updateStateGradients(e), this.notifyStateUpdate();
|
|
636
|
-
}
|
|
637
|
-
notifyStateUpdate() {
|
|
638
|
-
this.updateCallback && this.updateCallback();
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
const V = {
|
|
642
|
-
/**
|
|
643
|
-
* Create a reactive linear gradient
|
|
644
|
-
*/
|
|
645
|
-
linear: (n, e) => new E(
|
|
646
|
-
"reactive-linear",
|
|
647
|
-
{ type: "linear", options: n, __reactive: !0 },
|
|
648
|
-
e
|
|
649
|
-
),
|
|
650
|
-
/**
|
|
651
|
-
* Create a reactive radial gradient
|
|
652
|
-
*/
|
|
653
|
-
radial: (n, e) => new E(
|
|
654
|
-
"reactive-radial",
|
|
655
|
-
{ type: "radial", options: n, __reactive: !0 },
|
|
656
|
-
e
|
|
657
|
-
),
|
|
658
|
-
/**
|
|
659
|
-
* Create a reactive angular gradient
|
|
660
|
-
*/
|
|
661
|
-
angular: (n, e) => new E(
|
|
662
|
-
"reactive-angular",
|
|
663
|
-
{ type: "angular", options: n, __reactive: !0 },
|
|
664
|
-
e
|
|
665
|
-
),
|
|
666
|
-
/**
|
|
667
|
-
* Create a reactive state gradient
|
|
668
|
-
*/
|
|
669
|
-
state: (n, e, t) => new l(n, e, t)
|
|
670
|
-
}, rt = {
|
|
671
|
-
/**
|
|
672
|
-
* Create an animated gradient that cycles through colors
|
|
673
|
-
*/
|
|
674
|
-
createAnimatedGradient: (n, e = 3e3) => {
|
|
675
|
-
const t = {
|
|
676
|
-
value: n[0],
|
|
677
|
-
subscribe: (r) => () => {
|
|
678
|
-
}
|
|
679
|
-
};
|
|
680
|
-
return V.linear({
|
|
681
|
-
colors: [t, n[1]],
|
|
682
|
-
startPoint: "top",
|
|
683
|
-
endPoint: "bottom"
|
|
684
|
-
});
|
|
685
|
-
},
|
|
686
|
-
/**
|
|
687
|
-
* Create a progress gradient that fills based on a signal
|
|
688
|
-
*/
|
|
689
|
-
createProgressGradient: (n, e = "#007AFF") => V.linear({
|
|
690
|
-
colors: [e, "transparent"],
|
|
691
|
-
stops: [n, n],
|
|
692
|
-
// Both stops use the same signal
|
|
693
|
-
startPoint: "leading",
|
|
694
|
-
endPoint: "trailing"
|
|
695
|
-
}),
|
|
696
|
-
/**
|
|
697
|
-
* Create a data-driven gradient that reflects numeric values
|
|
698
|
-
*/
|
|
699
|
-
createDataGradient: (n, e, t, r = ["#ff0000", "#ffff00", "#00ff00"]) => V.linear({
|
|
700
|
-
colors: r,
|
|
701
|
-
startPoint: "top",
|
|
702
|
-
endPoint: "bottom"
|
|
703
|
-
})
|
|
704
|
-
}, it = {
|
|
705
|
-
/**
|
|
706
|
-
* Check if a background value is reactive
|
|
707
|
-
*/
|
|
708
|
-
isReactiveBackground: (n) => n instanceof E || n instanceof l,
|
|
709
|
-
/**
|
|
710
|
-
* Create a reactive background from a signal
|
|
711
|
-
*/
|
|
712
|
-
fromSignal: (n) => V.state("signal-background", {
|
|
713
|
-
default: n
|
|
714
|
-
})
|
|
715
|
-
};
|
|
716
|
-
function M(n, e = {}) {
|
|
717
|
-
const { fallback: t, errorFallback: r, timeout: i = 1e4, preload: s = "never" } = e;
|
|
718
|
-
let a = !1, o = null, u = !1, m = null, b = null;
|
|
719
|
-
const O = async () => {
|
|
720
|
-
a || u || o || b || (a = !0, u = !0, m = null, b = (async () => {
|
|
721
|
-
try {
|
|
722
|
-
const f = await Promise.race([
|
|
723
|
-
n(),
|
|
724
|
-
new Promise(
|
|
725
|
-
(_, x) => setTimeout(() => x(new Error("Component load timeout")), i)
|
|
726
|
-
)
|
|
727
|
-
]);
|
|
728
|
-
o = "default" in f ? f.default : f;
|
|
729
|
-
} catch (f) {
|
|
730
|
-
const _ = f;
|
|
731
|
-
(typeof process > "u" || process.env.NODE_ENV !== "test") && console.error("Failed to load lazy component:", _), m = _;
|
|
732
|
-
} finally {
|
|
733
|
-
u = !1, b = null;
|
|
734
|
-
}
|
|
735
|
-
})(), await b);
|
|
736
|
-
};
|
|
737
|
-
return s === "idle" && typeof requestIdleCallback < "u" ? requestIdleCallback(() => {
|
|
738
|
-
O().catch(() => {
|
|
739
|
-
});
|
|
740
|
-
}) : s === "idle" ? setTimeout(() => {
|
|
741
|
-
O().catch(() => {
|
|
742
|
-
});
|
|
743
|
-
}, 100) : s === "immediate" && O().catch(() => {
|
|
744
|
-
}), (f) => {
|
|
745
|
-
if (!a && !u && !o && O().catch(() => {
|
|
746
|
-
}), m)
|
|
747
|
-
return r ? r(m) : N(m);
|
|
748
|
-
if (u || !o)
|
|
749
|
-
return t || Q();
|
|
750
|
-
try {
|
|
751
|
-
return typeof o == "function" ? o(f) : o;
|
|
752
|
-
} catch (_) {
|
|
753
|
-
const x = _;
|
|
754
|
-
return (typeof process > "u" || process.env.NODE_ENV !== "test") && console.error("Error rendering lazy component:", x), N(x);
|
|
755
|
-
}
|
|
756
|
-
};
|
|
757
|
-
}
|
|
758
|
-
function st(n) {
|
|
759
|
-
return {
|
|
760
|
-
type: "component",
|
|
761
|
-
render: () => ({
|
|
762
|
-
type: "element",
|
|
763
|
-
tag: "div",
|
|
764
|
-
props: { class: "tachui-suspense" },
|
|
765
|
-
children: n.children.map(() => ({
|
|
766
|
-
type: "element",
|
|
767
|
-
tag: "div",
|
|
768
|
-
children: []
|
|
769
|
-
}))
|
|
770
|
-
}),
|
|
771
|
-
props: n,
|
|
772
|
-
id: `suspense-${Math.random().toString(36).substr(2, 9)}`
|
|
773
|
-
};
|
|
774
|
-
}
|
|
775
|
-
function Z(n) {
|
|
776
|
-
return n().then((e) => e && typeof e == "object" && "default" in e ? e.default : e);
|
|
777
|
-
}
|
|
778
|
-
function at(n, e = {}) {
|
|
779
|
-
const t = {};
|
|
780
|
-
for (const [r, i] of Object.entries(n))
|
|
781
|
-
t[r] = M(i, e);
|
|
782
|
-
return t;
|
|
783
|
-
}
|
|
784
|
-
function ot(n) {
|
|
785
|
-
const e = Object.entries(n).map(
|
|
786
|
-
async ([t, r]) => [t, await Z(r)]
|
|
787
|
-
);
|
|
788
|
-
return Promise.all(e).then((t) => {
|
|
789
|
-
const r = {};
|
|
790
|
-
for (const [i, s] of t)
|
|
791
|
-
r[i] = s;
|
|
792
|
-
return r;
|
|
793
|
-
});
|
|
794
|
-
}
|
|
795
|
-
function Q() {
|
|
796
|
-
return {
|
|
797
|
-
type: "element",
|
|
798
|
-
tag: "div",
|
|
799
|
-
props: {
|
|
800
|
-
class: "tachui-lazy-loading",
|
|
801
|
-
style: "padding: 16px; color: #666; text-align: center;"
|
|
802
|
-
},
|
|
803
|
-
children: [
|
|
804
|
-
{
|
|
805
|
-
type: "text",
|
|
806
|
-
text: "Loading component..."
|
|
807
|
-
}
|
|
808
|
-
]
|
|
809
|
-
};
|
|
810
|
-
}
|
|
811
|
-
function N(n) {
|
|
812
|
-
return {
|
|
813
|
-
type: "element",
|
|
814
|
-
tag: "div",
|
|
815
|
-
props: {
|
|
816
|
-
class: "tachui-lazy-error",
|
|
817
|
-
style: "padding: 16px; color: #d32f2f; border: 1px solid #d32f2f; border-radius: 4px; background: #ffeaea;"
|
|
818
|
-
},
|
|
819
|
-
children: [
|
|
820
|
-
{
|
|
821
|
-
type: "text",
|
|
822
|
-
text: `Failed to load component: ${n.message}`
|
|
823
|
-
}
|
|
824
|
-
]
|
|
825
|
-
};
|
|
826
|
-
}
|
|
827
|
-
function ct(n, e = {}) {
|
|
828
|
-
const { rootMargin: t = "50px", threshold: r = 0.1, ...i } = e;
|
|
829
|
-
return i.preload === "visible" && typeof IntersectionObserver < "u" ? (s) => {
|
|
830
|
-
const a = M(n, { ...i, preload: "never" });
|
|
831
|
-
return setTimeout(() => {
|
|
832
|
-
a(s);
|
|
833
|
-
}, 100), a(s);
|
|
834
|
-
} : M(n, i);
|
|
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
|
-
};
|
|
1061
|
-
}
|
|
1062
|
-
function le() {
|
|
1063
|
-
const n = z();
|
|
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 {
|
|
1090
|
-
constructor(e) {
|
|
1091
|
-
this.componentContext = e, p(this, "states", /* @__PURE__ */ new Map()), p(this, "bindings", /* @__PURE__ */ new Map()), p(this, "observedObjects", /* @__PURE__ */ new Map()), p(this, "environmentObjects", /* @__PURE__ */ new Map()), p(this, "registry"), this.registry = new me();
|
|
1092
|
-
}
|
|
1093
|
-
/**
|
|
1094
|
-
* Register a @State property wrapper
|
|
1095
|
-
*/
|
|
1096
|
-
registerState(e, t = {}) {
|
|
1097
|
-
const r = e.metadata;
|
|
1098
|
-
if (r) {
|
|
1099
|
-
const i = `${r.componentId}_${r.propertyName}`;
|
|
1100
|
-
this.states.set(i, e), this.registry.register(r), process.env.NODE_ENV === "development" && this.setupStateDebugging(e, r);
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
/**
|
|
1104
|
-
* Register a @Binding property wrapper
|
|
1105
|
-
*/
|
|
1106
|
-
registerBinding(e, t = {}) {
|
|
1107
|
-
const r = `${this.componentContext.id}_${t.name || "binding"}_${Date.now()}`;
|
|
1108
|
-
this.bindings.set(r, e);
|
|
1109
|
-
const i = {
|
|
1110
|
-
type: "Binding",
|
|
1111
|
-
propertyName: t.name || "binding",
|
|
1112
|
-
componentId: this.componentContext.id,
|
|
1113
|
-
options: t
|
|
1114
|
-
};
|
|
1115
|
-
this.registry.register(i);
|
|
1116
|
-
}
|
|
1117
|
-
/**
|
|
1118
|
-
* Register an @ObservedObject property wrapper
|
|
1119
|
-
*/
|
|
1120
|
-
registerObservedObject(e, t = {}) {
|
|
1121
|
-
const r = e.metadata;
|
|
1122
|
-
if (r) {
|
|
1123
|
-
const i = `${r.componentId}_${r.propertyName}`;
|
|
1124
|
-
this.observedObjects.set(i, e), this.registry.register(r), process.env.NODE_ENV === "development" && this.setupObservedObjectDebugging(e, r);
|
|
1125
|
-
}
|
|
1126
|
-
}
|
|
1127
|
-
/**
|
|
1128
|
-
* Register an @EnvironmentObject property wrapper
|
|
1129
|
-
*/
|
|
1130
|
-
registerEnvironmentObject(e, t) {
|
|
1131
|
-
const r = e.metadata;
|
|
1132
|
-
if (r) {
|
|
1133
|
-
const i = `${r.componentId}_${r.propertyName}`;
|
|
1134
|
-
this.environmentObjects.set(i, e), this.registry.register(r);
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
/**
|
|
1138
|
-
* Clean up all property wrappers for this component
|
|
1139
|
-
*/
|
|
1140
|
-
cleanup() {
|
|
1141
|
-
this.states.clear(), this.bindings.clear(), this.observedObjects.clear(), this.environmentObjects.clear(), this.registry.cleanup(this.componentContext.id);
|
|
1142
|
-
}
|
|
1143
|
-
/**
|
|
1144
|
-
* Get all registered states (for debugging)
|
|
1145
|
-
*/
|
|
1146
|
-
getStates() {
|
|
1147
|
-
return new Map(this.states);
|
|
1148
|
-
}
|
|
1149
|
-
/**
|
|
1150
|
-
* Get all registered bindings (for debugging)
|
|
1151
|
-
*/
|
|
1152
|
-
getBindings() {
|
|
1153
|
-
return new Map(this.bindings);
|
|
1154
|
-
}
|
|
1155
|
-
/**
|
|
1156
|
-
* Get all registered observed objects (for debugging)
|
|
1157
|
-
*/
|
|
1158
|
-
getObservedObjects() {
|
|
1159
|
-
return new Map(this.observedObjects);
|
|
1160
|
-
}
|
|
1161
|
-
/**
|
|
1162
|
-
* Get all registered environment objects (for debugging)
|
|
1163
|
-
*/
|
|
1164
|
-
getEnvironmentObjects() {
|
|
1165
|
-
return new Map(this.environmentObjects);
|
|
1166
|
-
}
|
|
1167
|
-
/**
|
|
1168
|
-
* Get property wrapper registry
|
|
1169
|
-
*/
|
|
1170
|
-
getRegistry() {
|
|
1171
|
-
return this.registry;
|
|
1172
|
-
}
|
|
1173
|
-
/**
|
|
1174
|
-
* Set up debugging for @State property wrappers
|
|
1175
|
-
*/
|
|
1176
|
-
setupStateDebugging(e, t) {
|
|
1177
|
-
if (typeof window < "u") {
|
|
1178
|
-
const r = window.__TACHUI_DEBUG__ || {};
|
|
1179
|
-
r.states || (r.states = {}), r.states[`${t.componentId}_${t.propertyName}`] = {
|
|
1180
|
-
state: e,
|
|
1181
|
-
metadata: t,
|
|
1182
|
-
getValue: () => e.wrappedValue,
|
|
1183
|
-
setValue: (i) => {
|
|
1184
|
-
e.projectedValue.set(i);
|
|
1185
|
-
},
|
|
1186
|
-
getBinding: () => e.projectedValue
|
|
1187
|
-
}, window.__TACHUI_DEBUG__ = r;
|
|
1188
|
-
}
|
|
1189
|
-
}
|
|
1190
|
-
/**
|
|
1191
|
-
* Set up debugging for @ObservedObject property wrappers
|
|
1192
|
-
*/
|
|
1193
|
-
setupObservedObjectDebugging(e, t) {
|
|
1194
|
-
if (typeof window < "u") {
|
|
1195
|
-
const r = window.__TACHUI_DEBUG__ || {};
|
|
1196
|
-
r.observedObjects || (r.observedObjects = {}), r.observedObjects[`${t.componentId}_${t.propertyName}`] = {
|
|
1197
|
-
observedObject: e,
|
|
1198
|
-
metadata: t,
|
|
1199
|
-
getObject: () => e.wrappedValue,
|
|
1200
|
-
getNotificationCount: () => e.wrappedValue.notificationCount || 0,
|
|
1201
|
-
triggerChange: () => e.wrappedValue.notifyChange()
|
|
1202
|
-
}, window.__TACHUI_DEBUG__ = r;
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
}
|
|
1206
|
-
class me {
|
|
1207
|
-
constructor() {
|
|
1208
|
-
p(this, "metadata", /* @__PURE__ */ new Map());
|
|
1209
|
-
}
|
|
1210
|
-
/**
|
|
1211
|
-
* Register property wrapper metadata
|
|
1212
|
-
*/
|
|
1213
|
-
register(e) {
|
|
1214
|
-
const t = e.componentId, r = this.metadata.get(t) || [];
|
|
1215
|
-
r.push(e), this.metadata.set(t, r);
|
|
1216
|
-
}
|
|
1217
|
-
/**
|
|
1218
|
-
* Unregister a specific property wrapper
|
|
1219
|
-
*/
|
|
1220
|
-
unregister(e, t) {
|
|
1221
|
-
const i = (this.metadata.get(e) || []).filter((s) => s.propertyName !== t);
|
|
1222
|
-
i.length > 0 ? this.metadata.set(e, i) : this.metadata.delete(e);
|
|
1223
|
-
}
|
|
1224
|
-
/**
|
|
1225
|
-
* Clean up all metadata for a component
|
|
1226
|
-
*/
|
|
1227
|
-
cleanup(e) {
|
|
1228
|
-
this.metadata.delete(e);
|
|
1229
|
-
}
|
|
1230
|
-
/**
|
|
1231
|
-
* Get all metadata for a component
|
|
1232
|
-
*/
|
|
1233
|
-
getMetadata(e) {
|
|
1234
|
-
return this.metadata.get(e) || [];
|
|
1235
|
-
}
|
|
1236
|
-
/**
|
|
1237
|
-
* Get all registered metadata (for debugging)
|
|
1238
|
-
*/
|
|
1239
|
-
getAllMetadata() {
|
|
1240
|
-
return new Map(this.metadata);
|
|
1241
|
-
}
|
|
1242
|
-
}
|
|
1243
|
-
function mt(n) {
|
|
1244
|
-
return new ge(n);
|
|
1245
|
-
}
|
|
1246
|
-
const G = class v {
|
|
1247
|
-
constructor() {
|
|
1248
|
-
p(this, "managers", /* @__PURE__ */ new Map());
|
|
1249
|
-
}
|
|
1250
|
-
static getInstance() {
|
|
1251
|
-
return v.instance || (v.instance = new v()), v.instance;
|
|
1252
|
-
}
|
|
1253
|
-
register(e, t) {
|
|
1254
|
-
this.managers.set(e, t);
|
|
1255
|
-
}
|
|
1256
|
-
unregister(e) {
|
|
1257
|
-
this.managers.delete(e);
|
|
1258
|
-
}
|
|
1259
|
-
getManager(e) {
|
|
1260
|
-
return this.managers.get(e);
|
|
1261
|
-
}
|
|
1262
|
-
getAllManagers() {
|
|
1263
|
-
return new Map(this.managers);
|
|
1264
|
-
}
|
|
1265
|
-
/**
|
|
1266
|
-
* Get debugging information for all components
|
|
1267
|
-
*/
|
|
1268
|
-
getDebugInfo() {
|
|
1269
|
-
const e = {};
|
|
1270
|
-
for (const [t, r] of this.managers)
|
|
1271
|
-
e[t] = {
|
|
1272
|
-
states: r.getStates().size,
|
|
1273
|
-
bindings: r.getBindings().size,
|
|
1274
|
-
observedObjects: r.getObservedObjects().size,
|
|
1275
|
-
environmentObjects: r.getEnvironmentObjects().size,
|
|
1276
|
-
metadata: r.getRegistry().getMetadata(t)
|
|
1277
|
-
};
|
|
1278
|
-
return e;
|
|
1279
|
-
}
|
|
1280
|
-
};
|
|
1281
|
-
p(G, "instance");
|
|
1282
|
-
let w = G;
|
|
1283
|
-
function bt(n, e) {
|
|
1284
|
-
w.getInstance().register(n, e);
|
|
1285
|
-
}
|
|
1286
|
-
function yt(n) {
|
|
1287
|
-
w.getInstance().unregister(n);
|
|
1288
|
-
}
|
|
1289
|
-
function be(n) {
|
|
1290
|
-
return w.getInstance().getManager(n);
|
|
1291
|
-
}
|
|
1292
|
-
function ye() {
|
|
1293
|
-
return w.getInstance().getAllManagers();
|
|
1294
|
-
}
|
|
1295
|
-
function Ce() {
|
|
1296
|
-
return w.getInstance().getDebugInfo();
|
|
1297
|
-
}
|
|
1298
|
-
function Ct() {
|
|
1299
|
-
if (typeof window < "u" && process.env.NODE_ENV === "development") {
|
|
1300
|
-
const n = window.__TACHUI_DEBUG__ || {};
|
|
1301
|
-
n.stateManagers = {
|
|
1302
|
-
getAll: ye,
|
|
1303
|
-
getDebugInfo: Ce,
|
|
1304
|
-
getManager: be
|
|
1305
|
-
}, window.__TACHUI_DEBUG__ = n, console.log(
|
|
1306
|
-
"TachUI State Management debugging enabled. Use window.__TACHUI_DEBUG__.stateManagers"
|
|
1307
|
-
);
|
|
1308
|
-
}
|
|
1309
|
-
}
|
|
1310
|
-
const _t = ie;
|
|
1311
|
-
function St(n) {
|
|
1312
|
-
return console.warn("useEnvironmentObject is deprecated, use EnvironmentObject instead"), re(n);
|
|
1313
|
-
}
|
|
1314
|
-
const vt = {
|
|
1315
|
-
/**
|
|
1316
|
-
* Check if a value is any kind of property wrapper
|
|
1317
|
-
*/
|
|
1318
|
-
isPropertyWrapper(n) {
|
|
1319
|
-
return n && typeof n == "object" && "wrappedValue" in n && "projectedValue" in n;
|
|
1320
|
-
},
|
|
1321
|
-
/**
|
|
1322
|
-
* Extract the wrapped value from any property wrapper
|
|
1323
|
-
*/
|
|
1324
|
-
unwrap(n) {
|
|
1325
|
-
return this.isPropertyWrapper(n) ? n.wrappedValue : n;
|
|
1326
|
-
},
|
|
1327
|
-
/**
|
|
1328
|
-
* Create a debug snapshot of all property wrappers in a component
|
|
1329
|
-
*/
|
|
1330
|
-
createDebugSnapshot(n) {
|
|
1331
|
-
if (typeof window < "u") {
|
|
1332
|
-
const e = window.__TACHUI_DEBUG__;
|
|
1333
|
-
if (e)
|
|
1334
|
-
return {
|
|
1335
|
-
states: e.states ? Object.keys(e.states).filter((t) => t.startsWith(n)).reduce((t, r) => (t[r] = e.states[r].getValue(), t), {}) : {},
|
|
1336
|
-
observedObjects: e.observedObjects ? Object.keys(e.observedObjects).filter((t) => t.startsWith(n)).reduce((t, r) => (t[r] = {
|
|
1337
|
-
notificationCount: e.observedObjects[r].getNotificationCount(),
|
|
1338
|
-
object: e.observedObjects[r].getObject()
|
|
1339
|
-
}, t), {}) : {}
|
|
1340
|
-
};
|
|
1341
|
-
}
|
|
1342
|
-
return null;
|
|
1343
|
-
}
|
|
1344
|
-
}, wt = "0.1.0";
|
|
1345
|
-
export {
|
|
1346
|
-
mt as $,
|
|
1347
|
-
it as A,
|
|
1348
|
-
Ze as B,
|
|
1349
|
-
He as C,
|
|
1350
|
-
Qe as D,
|
|
1351
|
-
et as E,
|
|
1352
|
-
tt as F,
|
|
1353
|
-
J as G,
|
|
1354
|
-
_t as H,
|
|
1355
|
-
St as I,
|
|
1356
|
-
vt as J,
|
|
1357
|
-
dt as K,
|
|
1358
|
-
Ye as L,
|
|
1359
|
-
ut as M,
|
|
1360
|
-
re as N,
|
|
1361
|
-
lt as O,
|
|
1362
|
-
ie as P,
|
|
1363
|
-
ft as Q,
|
|
1364
|
-
E as R,
|
|
1365
|
-
st as S,
|
|
1366
|
-
Xe as T,
|
|
1367
|
-
he as U,
|
|
1368
|
-
wt as V,
|
|
1369
|
-
pt as W,
|
|
1370
|
-
ue as X,
|
|
1371
|
-
k as Y,
|
|
1372
|
-
gt as Z,
|
|
1373
|
-
ht as _,
|
|
1374
|
-
Fe as a,
|
|
1375
|
-
ye as a0,
|
|
1376
|
-
be as a1,
|
|
1377
|
-
Ce as a2,
|
|
1378
|
-
Ct as a3,
|
|
1379
|
-
bt as a4,
|
|
1380
|
-
ge as a5,
|
|
1381
|
-
yt as a6,
|
|
1382
|
-
Ke as b,
|
|
1383
|
-
qe as c,
|
|
1384
|
-
De as d,
|
|
1385
|
-
Ie as e,
|
|
1386
|
-
Pe as f,
|
|
1387
|
-
ze as g,
|
|
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,
|
|
1400
|
-
M as t,
|
|
1401
|
-
Z as u,
|
|
1402
|
-
ot as v,
|
|
1403
|
-
nt as w,
|
|
1404
|
-
l as x,
|
|
1405
|
-
V as y,
|
|
1406
|
-
rt as z
|
|
1407
|
-
};
|