@tachui/core 0.8.1-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 +40 -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/minimal.d.ts +2 -0
- package/dist/bundles/minimal.d.ts.map +1 -1
- package/dist/common.js +427 -394
- 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 +427 -394
- 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 +427 -394
- package/dist/minimal-prod.js +94 -93
- package/dist/minimal.js +114 -108
- 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-Cos-FtjP.js → observed-object-DepiqSgg.js} +3 -3
- package/dist/optimization-CbKNA9w4.js +21 -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.map +1 -1
- package/dist/runtime/concatenation-aria.js +18 -13
- package/dist/runtime/concatenation-full.d.ts.map +1 -1
- package/dist/runtime/concatenation-full.js +42 -34
- package/dist/runtime/concatenation-minimal.d.ts.map +1 -1
- package/dist/runtime/concatenation-minimal.js +13 -8
- 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 +51 -11
- package/dist/concatenated-component-ByPl3_FF.js +0 -2933
- package/dist/dom-bridge-CAa1N2zX.js +0 -406
- package/dist/index-DEBd8cq7.js +0 -1144
- 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-DEBd8cq7.js
DELETED
|
@@ -1,1144 +0,0 @@
|
|
|
1
|
-
import { infinity as c } from "./constants/layout.js";
|
|
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
|
-
import "./component-XAzF1xqs.js";
|
|
9
|
-
import "./index-vdsiw6gQ.js";
|
|
10
|
-
import "./dom-bridge-CAa1N2zX.js";
|
|
11
|
-
import "./component-base-x2XmHFjy.js";
|
|
12
|
-
import "./plugins/index.js";
|
|
13
|
-
import "./validation/index.js";
|
|
14
|
-
function le() {
|
|
15
|
-
return new l({
|
|
16
|
-
frame: {
|
|
17
|
-
maxWidth: c
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
function de() {
|
|
22
|
-
return new l({
|
|
23
|
-
frame: {
|
|
24
|
-
maxHeight: c
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
function pe() {
|
|
29
|
-
return new l({
|
|
30
|
-
frame: {
|
|
31
|
-
maxWidth: c,
|
|
32
|
-
maxHeight: c
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
function he() {
|
|
37
|
-
return new l({
|
|
38
|
-
frame: {
|
|
39
|
-
width: c,
|
|
40
|
-
height: c
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
function ge(r) {
|
|
45
|
-
return new l({
|
|
46
|
-
frame: {
|
|
47
|
-
width: r,
|
|
48
|
-
maxHeight: c
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
function me(r) {
|
|
53
|
-
return new l({
|
|
54
|
-
frame: {
|
|
55
|
-
height: r,
|
|
56
|
-
maxWidth: c
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
function fe(r, e) {
|
|
61
|
-
return new l({
|
|
62
|
-
frame: {
|
|
63
|
-
width: c,
|
|
64
|
-
height: c,
|
|
65
|
-
maxWidth: r,
|
|
66
|
-
maxHeight: e
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
function be(r, e, t, n) {
|
|
71
|
-
return new l({
|
|
72
|
-
frame: {
|
|
73
|
-
width: c,
|
|
74
|
-
height: c,
|
|
75
|
-
minWidth: r,
|
|
76
|
-
maxWidth: e,
|
|
77
|
-
minHeight: t,
|
|
78
|
-
maxHeight: n
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
function ye() {
|
|
83
|
-
return new l({
|
|
84
|
-
frame: {
|
|
85
|
-
maxWidth: c,
|
|
86
|
-
maxHeight: c
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
function Se() {
|
|
91
|
-
return new l({
|
|
92
|
-
frame: {
|
|
93
|
-
width: "100vw",
|
|
94
|
-
height: "100vh"
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
function ve() {
|
|
99
|
-
return new l({
|
|
100
|
-
frame: {
|
|
101
|
-
width: c,
|
|
102
|
-
height: c
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
function we() {
|
|
107
|
-
return new l({
|
|
108
|
-
frame: {
|
|
109
|
-
width: c
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
const Ce = Symbol.for("tachui.concat");
|
|
114
|
-
function xe(r) {
|
|
115
|
-
return r && typeof r == "object" && typeof r.isConcatenatable == "function" && r.isConcatenatable();
|
|
116
|
-
}
|
|
117
|
-
function Oe(r) {
|
|
118
|
-
return r && typeof r == "object" && r.constructor.name === "ConcatenatedComponent";
|
|
119
|
-
}
|
|
120
|
-
const _e = Symbol.for("tachui.concat");
|
|
121
|
-
class Me {
|
|
122
|
-
/**
|
|
123
|
-
* Concatenate this component with another concatenatable component
|
|
124
|
-
*/
|
|
125
|
-
concat(e) {
|
|
126
|
-
const t = this.toSegment(), n = e.toSegment();
|
|
127
|
-
return e instanceof b ? new b(
|
|
128
|
-
[t, ...e.segments],
|
|
129
|
-
this.mergeMetadata(e.metadata, e.segments.length + 1)
|
|
130
|
-
) : new b(
|
|
131
|
-
[t, n],
|
|
132
|
-
this.createMetadata(2)
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Check if this component supports concatenation
|
|
137
|
-
*/
|
|
138
|
-
isConcatenatable() {
|
|
139
|
-
return !0;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Create metadata for a new concatenated component
|
|
143
|
-
*/
|
|
144
|
-
createMetadata(e) {
|
|
145
|
-
return {
|
|
146
|
-
totalSegments: e,
|
|
147
|
-
accessibilityRole: this.determineAccessibilityRole(),
|
|
148
|
-
semanticStructure: this.determineSemanticStructure()
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Merge metadata when concatenating with existing concatenated component
|
|
153
|
-
*/
|
|
154
|
-
mergeMetadata(e, t) {
|
|
155
|
-
return {
|
|
156
|
-
totalSegments: t,
|
|
157
|
-
accessibilityRole: this.mergeAccessibilityRoles(e.accessibilityRole),
|
|
158
|
-
semanticStructure: this.mergeSemanticStructures(e.semanticStructure)
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Determine the accessibility role for this component
|
|
163
|
-
*/
|
|
164
|
-
determineAccessibilityRole() {
|
|
165
|
-
const e = this.constructor.name;
|
|
166
|
-
return e === "EnhancedText" ? "text" : e === "EnhancedImage" || e === "EnhancedButton" || e === "EnhancedLink" ? "group" : "composite";
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Determine the semantic structure for this component
|
|
170
|
-
*/
|
|
171
|
-
determineSemanticStructure() {
|
|
172
|
-
const e = this.constructor.name;
|
|
173
|
-
return e === "EnhancedText" || e === "EnhancedImage" ? "inline" : "mixed";
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Merge accessibility roles when combining components
|
|
177
|
-
*/
|
|
178
|
-
mergeAccessibilityRoles(e) {
|
|
179
|
-
const t = this.determineAccessibilityRole();
|
|
180
|
-
return t === "text" && e === "text" ? "text" : t === "composite" || e === "composite" ? "composite" : "group";
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Merge semantic structures when combining components
|
|
184
|
-
*/
|
|
185
|
-
mergeSemanticStructures(e) {
|
|
186
|
-
const t = this.determineSemanticStructure();
|
|
187
|
-
return t === "inline" && e === "inline" ? "inline" : t === "block" && e === "block" ? "block" : "mixed";
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
function Ee(r) {
|
|
191
|
-
const e = r;
|
|
192
|
-
return e.concat = function(t) {
|
|
193
|
-
const n = {
|
|
194
|
-
id: this.id,
|
|
195
|
-
component: this,
|
|
196
|
-
modifiers: this.modifiers || [],
|
|
197
|
-
render: () => {
|
|
198
|
-
const s = this.render();
|
|
199
|
-
return Array.isArray(s) ? s[0] : s;
|
|
200
|
-
}
|
|
201
|
-
}, i = t.toSegment();
|
|
202
|
-
return t instanceof b ? new b(
|
|
203
|
-
[n, ...t.segments],
|
|
204
|
-
{
|
|
205
|
-
totalSegments: t.segments.length + 1,
|
|
206
|
-
accessibilityRole: "group",
|
|
207
|
-
semanticStructure: "mixed"
|
|
208
|
-
}
|
|
209
|
-
) : new b(
|
|
210
|
-
[n, i],
|
|
211
|
-
{
|
|
212
|
-
totalSegments: 2,
|
|
213
|
-
accessibilityRole: "group",
|
|
214
|
-
semanticStructure: "mixed"
|
|
215
|
-
}
|
|
216
|
-
);
|
|
217
|
-
}, e.toSegment = function() {
|
|
218
|
-
return {
|
|
219
|
-
id: this.id,
|
|
220
|
-
component: this,
|
|
221
|
-
modifiers: this.modifiers || [],
|
|
222
|
-
render: () => {
|
|
223
|
-
const t = this.render();
|
|
224
|
-
return Array.isArray(t) ? t[0] : t;
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
}, e.isConcatenatable = function() {
|
|
228
|
-
return !0;
|
|
229
|
-
}, e;
|
|
230
|
-
}
|
|
231
|
-
const p = /* @__PURE__ */ new Map(), N = 300 * 1e3, E = 100;
|
|
232
|
-
class Te {
|
|
233
|
-
/**
|
|
234
|
-
* Optimize an array of segments by merging compatible adjacent text segments
|
|
235
|
-
* Enhanced with caching and performance monitoring
|
|
236
|
-
*/
|
|
237
|
-
static optimize(e) {
|
|
238
|
-
const t = performance.now();
|
|
239
|
-
if (e.length < 2) return e;
|
|
240
|
-
const n = this.generateCacheKey(e), i = this.getCachedOptimization(n);
|
|
241
|
-
if (i)
|
|
242
|
-
return i.optimizedSegments;
|
|
243
|
-
const s = this.performOptimization(e), a = performance.now() - t, o = {
|
|
244
|
-
...this.getOptimizationStats(e, s),
|
|
245
|
-
processingTimeMs: a
|
|
246
|
-
};
|
|
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;
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Core optimization algorithm separated for clarity
|
|
251
|
-
*/
|
|
252
|
-
static performOptimization(e) {
|
|
253
|
-
const t = [];
|
|
254
|
-
for (const n of e) {
|
|
255
|
-
const i = t[t.length - 1];
|
|
256
|
-
i && this.canMergeTextSegments(i, n) ? t[t.length - 1] = this.mergeTextSegments(i, n) : t.push(n);
|
|
257
|
-
}
|
|
258
|
-
return t;
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* Generate a cache key from segments
|
|
262
|
-
*/
|
|
263
|
-
static generateCacheKey(e) {
|
|
264
|
-
return e.map((n) => {
|
|
265
|
-
const i = n.component, s = this.extractTextContent(i), a = this.hashModifiers(n.modifiers);
|
|
266
|
-
return `${i.constructor.name}:${s}:${a}`;
|
|
267
|
-
}).join("|");
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Hash modifiers for cache key generation
|
|
271
|
-
*/
|
|
272
|
-
static hashModifiers(e) {
|
|
273
|
-
if (e.length === 0) return "none";
|
|
274
|
-
try {
|
|
275
|
-
const t = e.map((i) => ({
|
|
276
|
-
type: i.type,
|
|
277
|
-
props: i.properties
|
|
278
|
-
})), n = JSON.stringify(t);
|
|
279
|
-
return typeof btoa == "function" ? btoa(n).substring(0, 8) : this.simpleHash(n).toString(16).substring(0, 8);
|
|
280
|
-
} catch {
|
|
281
|
-
return "hash-error";
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* Simple hash function fallback for environments without btoa
|
|
286
|
-
*/
|
|
287
|
-
static simpleHash(e) {
|
|
288
|
-
let t = 0;
|
|
289
|
-
for (let n = 0; n < e.length; n++) {
|
|
290
|
-
const i = e.charCodeAt(n);
|
|
291
|
-
t = (t << 5) - t + i, t = t & t;
|
|
292
|
-
}
|
|
293
|
-
return Math.abs(t);
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* Get cached optimization result
|
|
297
|
-
*/
|
|
298
|
-
static getCachedOptimization(e) {
|
|
299
|
-
const t = p.get(e);
|
|
300
|
-
return t ? Date.now() - t.timestamp > N ? (p.delete(e), null) : t : null;
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* Cache optimization result
|
|
304
|
-
*/
|
|
305
|
-
static cacheOptimization(e, t, n) {
|
|
306
|
-
if (p.size >= E) {
|
|
307
|
-
const i = p.keys().next().value;
|
|
308
|
-
i && p.delete(i);
|
|
309
|
-
}
|
|
310
|
-
p.set(e, {
|
|
311
|
-
optimizedSegments: t,
|
|
312
|
-
stats: n,
|
|
313
|
-
timestamp: Date.now()
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* Clear optimization cache (useful for testing)
|
|
318
|
-
*/
|
|
319
|
-
static clearCache() {
|
|
320
|
-
p.clear();
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* Get cache statistics
|
|
324
|
-
*/
|
|
325
|
-
static getCacheStats() {
|
|
326
|
-
return {
|
|
327
|
-
size: p.size,
|
|
328
|
-
maxSize: E,
|
|
329
|
-
hitRate: 0
|
|
330
|
-
// Would need to track hits/misses to calculate this
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* Check if two segments can be merged
|
|
335
|
-
*/
|
|
336
|
-
static canMergeTextSegments(e, t) {
|
|
337
|
-
return e.component.constructor.name !== "EnhancedText" || t.component.constructor.name !== "EnhancedText" ? !1 : this.modifiersCompatible(e.modifiers, t.modifiers);
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* Check if two modifier arrays are compatible for merging
|
|
341
|
-
*/
|
|
342
|
-
static modifiersCompatible(e, t) {
|
|
343
|
-
if (e.length !== t.length) return !1;
|
|
344
|
-
for (let n = 0; n < e.length; n++)
|
|
345
|
-
if (!this.modifierEqual(e[n], t[n]))
|
|
346
|
-
return !1;
|
|
347
|
-
return !0;
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
* Check if two modifiers are equal (simplified comparison)
|
|
351
|
-
*/
|
|
352
|
-
static modifierEqual(e, t) {
|
|
353
|
-
if (e.type !== t.type) return !1;
|
|
354
|
-
try {
|
|
355
|
-
return JSON.stringify(e.properties) === JSON.stringify(t.properties);
|
|
356
|
-
} catch {
|
|
357
|
-
return !1;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
/**
|
|
361
|
-
* Merge two text segments into a single segment
|
|
362
|
-
*/
|
|
363
|
-
static mergeTextSegments(e, t) {
|
|
364
|
-
const n = e.component, i = t.component, s = this.extractTextContent(n), a = this.extractTextContent(i), o = s + a;
|
|
365
|
-
return {
|
|
366
|
-
id: `merged-${e.id}-${t.id}`,
|
|
367
|
-
component: this.createMergedTextComponent(o, n.props, e.modifiers),
|
|
368
|
-
modifiers: e.modifiers,
|
|
369
|
-
// Use modifiers from first segment (they're identical)
|
|
370
|
-
render: () => this.createMergedTextComponent(o, n.props, e.modifiers).render()[0]
|
|
371
|
-
};
|
|
372
|
-
}
|
|
373
|
-
/**
|
|
374
|
-
* Extract text content from a text component
|
|
375
|
-
*/
|
|
376
|
-
static extractTextContent(e) {
|
|
377
|
-
const t = e.props?.content;
|
|
378
|
-
return typeof t == "string" ? t : typeof t == "function" ? t() : t && typeof t == "object" && "peek" in t && t.peek() || "";
|
|
379
|
-
}
|
|
380
|
-
/**
|
|
381
|
-
* Create a new merged text component
|
|
382
|
-
*/
|
|
383
|
-
static createMergedTextComponent(e, t, n) {
|
|
384
|
-
const i = {
|
|
385
|
-
...t,
|
|
386
|
-
content: e
|
|
387
|
-
};
|
|
388
|
-
return {
|
|
389
|
-
type: "Text",
|
|
390
|
-
id: `merged-text-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
|
|
391
|
-
props: i,
|
|
392
|
-
mounted: !1,
|
|
393
|
-
cleanup: [],
|
|
394
|
-
modifiers: n,
|
|
395
|
-
render() {
|
|
396
|
-
const s = globalThis.__tachui_runtime;
|
|
397
|
-
if (s && s.h && s.text) {
|
|
398
|
-
const a = s.text(e);
|
|
399
|
-
return [s.h("span", {}, [a])];
|
|
400
|
-
}
|
|
401
|
-
return [];
|
|
402
|
-
}
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
* Analyze segments and determine if optimization would be beneficial
|
|
407
|
-
*/
|
|
408
|
-
static shouldOptimize(e) {
|
|
409
|
-
if (e.length < 2) return !1;
|
|
410
|
-
let t = 0;
|
|
411
|
-
for (let n = 0; n < e.length - 1; n++) {
|
|
412
|
-
const i = e[n], s = e[n + 1];
|
|
413
|
-
i.component.constructor.name === "EnhancedText" && s.component.constructor.name === "EnhancedText" && t++;
|
|
414
|
-
}
|
|
415
|
-
return t > 0;
|
|
416
|
-
}
|
|
417
|
-
/**
|
|
418
|
-
* Get optimization statistics (enhanced for Phase 4.1)
|
|
419
|
-
*/
|
|
420
|
-
static getOptimizationStats(e, t) {
|
|
421
|
-
const n = e.length - t.length, i = e.length > 0 ? Math.round(n / e.length * 100) : 0;
|
|
422
|
-
return {
|
|
423
|
-
originalCount: e.length,
|
|
424
|
-
optimizedCount: t.length,
|
|
425
|
-
reductionPercent: i,
|
|
426
|
-
textSegmentsMerged: n
|
|
427
|
-
};
|
|
428
|
-
}
|
|
429
|
-
/**
|
|
430
|
-
* Advanced optimization analysis for performance monitoring
|
|
431
|
-
*/
|
|
432
|
-
static analyzeOptimizationOpportunities(e) {
|
|
433
|
-
let t = 0, n = 0, i = 0, s = 0;
|
|
434
|
-
for (let o = 0; o < e.length; o++) {
|
|
435
|
-
const d = e[o];
|
|
436
|
-
switch (d.component.constructor.name) {
|
|
437
|
-
case "EnhancedText":
|
|
438
|
-
if (t++, o < e.length - 1) {
|
|
439
|
-
const f = e[o + 1];
|
|
440
|
-
this.canMergeTextSegments(d, f) && s++;
|
|
441
|
-
}
|
|
442
|
-
break;
|
|
443
|
-
case "EnhancedImage":
|
|
444
|
-
n++;
|
|
445
|
-
break;
|
|
446
|
-
case "EnhancedButton":
|
|
447
|
-
case "EnhancedLinkComponent":
|
|
448
|
-
i++;
|
|
449
|
-
break;
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
const a = e.length > 0 ? Math.round(s / e.length * 100) : 0;
|
|
453
|
-
return {
|
|
454
|
-
totalSegments: e.length,
|
|
455
|
-
textSegments: t,
|
|
456
|
-
imageSegments: n,
|
|
457
|
-
interactiveSegments: i,
|
|
458
|
-
optimizableTextPairs: s,
|
|
459
|
-
estimatedReductionPercent: a
|
|
460
|
-
};
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
class je {
|
|
464
|
-
// Placeholder implementation
|
|
465
|
-
}
|
|
466
|
-
function Ve() {
|
|
467
|
-
}
|
|
468
|
-
function De() {
|
|
469
|
-
}
|
|
470
|
-
function ze() {
|
|
471
|
-
}
|
|
472
|
-
function Ie() {
|
|
473
|
-
}
|
|
474
|
-
class U extends j {
|
|
475
|
-
constructor(e, t) {
|
|
476
|
-
super(e), this.definitions = t;
|
|
477
|
-
}
|
|
478
|
-
resolve() {
|
|
479
|
-
const e = this.getCurrentTheme(), t = this.definitions[e] || this.definitions.light;
|
|
480
|
-
return D(t);
|
|
481
|
-
}
|
|
482
|
-
getCurrentTheme() {
|
|
483
|
-
return typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
function Ae(r) {
|
|
487
|
-
return new U("gradient-asset", r);
|
|
488
|
-
}
|
|
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();
|
|
493
|
-
}
|
|
494
|
-
/**
|
|
495
|
-
* Resolve current gradient to CSS
|
|
496
|
-
*/
|
|
497
|
-
resolve() {
|
|
498
|
-
return this.gradientToCSS(this.currentGradient);
|
|
499
|
-
}
|
|
500
|
-
/**
|
|
501
|
-
* Get current static gradient (resolved from signals)
|
|
502
|
-
*/
|
|
503
|
-
getCurrentGradient() {
|
|
504
|
-
return this.currentGradient;
|
|
505
|
-
}
|
|
506
|
-
/**
|
|
507
|
-
* Update the reactive definition and re-subscribe to signals
|
|
508
|
-
*/
|
|
509
|
-
updateDefinition(e) {
|
|
510
|
-
this.cleanup(), this.reactiveDefinition = e, this.currentGradient = this.resolveStaticGradient(), this.setupSignalSubscriptions(), this.notifyUpdate();
|
|
511
|
-
}
|
|
512
|
-
/**
|
|
513
|
-
* Clean up signal subscriptions
|
|
514
|
-
*/
|
|
515
|
-
cleanup() {
|
|
516
|
-
this.subscriptions.forEach((e) => e()), this.subscriptions = [];
|
|
517
|
-
}
|
|
518
|
-
resolveStaticGradient() {
|
|
519
|
-
const { type: e, options: t } = this.reactiveDefinition;
|
|
520
|
-
switch (e) {
|
|
521
|
-
case "linear":
|
|
522
|
-
return A(this.resolveLinearOptions(t));
|
|
523
|
-
case "radial":
|
|
524
|
-
return I(this.resolveRadialOptions(t));
|
|
525
|
-
case "angular":
|
|
526
|
-
case "conic":
|
|
527
|
-
return z(this.resolveAngularOptions(t));
|
|
528
|
-
default:
|
|
529
|
-
throw new Error(`Unsupported reactive gradient type: ${e}`);
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
resolveLinearOptions(e) {
|
|
533
|
-
return {
|
|
534
|
-
colors: e.colors.map((t) => this.resolveValue(t)),
|
|
535
|
-
stops: e.stops?.map((t) => this.resolveValue(t)),
|
|
536
|
-
startPoint: this.resolveValue(e.startPoint),
|
|
537
|
-
endPoint: this.resolveValue(e.endPoint),
|
|
538
|
-
angle: e.angle ? this.resolveValue(e.angle) : void 0
|
|
539
|
-
};
|
|
540
|
-
}
|
|
541
|
-
resolveRadialOptions(e) {
|
|
542
|
-
return {
|
|
543
|
-
colors: e.colors.map((t) => this.resolveValue(t)),
|
|
544
|
-
stops: e.stops?.map((t) => this.resolveValue(t)),
|
|
545
|
-
center: this.resolveValue(e.center),
|
|
546
|
-
startRadius: this.resolveValue(e.startRadius),
|
|
547
|
-
endRadius: this.resolveValue(e.endRadius),
|
|
548
|
-
shape: e.shape ? this.resolveValue(e.shape) : void 0
|
|
549
|
-
};
|
|
550
|
-
}
|
|
551
|
-
resolveAngularOptions(e) {
|
|
552
|
-
return {
|
|
553
|
-
colors: e.colors.map((t) => this.resolveValue(t)),
|
|
554
|
-
stops: e.stops?.map((t) => this.resolveValue(t)),
|
|
555
|
-
center: this.resolveValue(e.center),
|
|
556
|
-
startAngle: this.resolveValue(e.startAngle),
|
|
557
|
-
endAngle: this.resolveValue(e.endAngle)
|
|
558
|
-
};
|
|
559
|
-
}
|
|
560
|
-
resolveValue(e) {
|
|
561
|
-
return this.isSignal(e) ? e.value : e;
|
|
562
|
-
}
|
|
563
|
-
isSignal(e) {
|
|
564
|
-
return e !== null && typeof e == "object" && "value" in e && "subscribe" in e;
|
|
565
|
-
}
|
|
566
|
-
setupSignalSubscriptions() {
|
|
567
|
-
this.subscribeToSignalsInOptions(this.reactiveDefinition.options);
|
|
568
|
-
}
|
|
569
|
-
subscribeToSignalsInOptions(e) {
|
|
570
|
-
for (const [t, n] of Object.entries(e))
|
|
571
|
-
if (Array.isArray(n))
|
|
572
|
-
n.forEach((i) => {
|
|
573
|
-
if (this.isSignal(i)) {
|
|
574
|
-
const s = i.subscribe(() => this.handleSignalChange());
|
|
575
|
-
this.subscriptions.push(s);
|
|
576
|
-
}
|
|
577
|
-
});
|
|
578
|
-
else if (this.isSignal(n)) {
|
|
579
|
-
const i = n.subscribe(() => this.handleSignalChange());
|
|
580
|
-
this.subscriptions.push(i);
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
handleSignalChange() {
|
|
584
|
-
this.currentGradient = this.resolveStaticGradient(), this.notifyUpdate();
|
|
585
|
-
}
|
|
586
|
-
notifyUpdate() {
|
|
587
|
-
this.updateCallback && this.updateCallback();
|
|
588
|
-
}
|
|
589
|
-
gradientToCSS(e) {
|
|
590
|
-
const { gradientToCSS: t } = require("./css-generator");
|
|
591
|
-
return t(e);
|
|
592
|
-
}
|
|
593
|
-
}
|
|
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();
|
|
598
|
-
}
|
|
599
|
-
/**
|
|
600
|
-
* Update reactive state configuration
|
|
601
|
-
*/
|
|
602
|
-
updateReactiveState(e) {
|
|
603
|
-
this.cleanupStateSubscriptions(), this.reactiveStateGradients = e;
|
|
604
|
-
const t = u.resolveStateOptions(e);
|
|
605
|
-
this.updateStateGradients(t), this.setupStateSignalSubscriptions(), this.notifyStateUpdate();
|
|
606
|
-
}
|
|
607
|
-
/**
|
|
608
|
-
* Clean up signal subscriptions
|
|
609
|
-
*/
|
|
610
|
-
cleanupStateSubscriptions() {
|
|
611
|
-
this.reactiveSubscriptions.forEach((e) => e()), this.reactiveSubscriptions = [];
|
|
612
|
-
}
|
|
613
|
-
static resolveStateOptions(e) {
|
|
614
|
-
const t = {
|
|
615
|
-
default: u.resolveValue(e.default),
|
|
616
|
-
animation: e.animation
|
|
617
|
-
};
|
|
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;
|
|
619
|
-
}
|
|
620
|
-
static resolveValue(e) {
|
|
621
|
-
return e !== null && typeof e == "object" && "value" in e && "subscribe" in e ? e.value : e;
|
|
622
|
-
}
|
|
623
|
-
static isSignal(e) {
|
|
624
|
-
return e !== null && typeof e == "object" && "value" in e && "subscribe" in e;
|
|
625
|
-
}
|
|
626
|
-
setupStateSignalSubscriptions() {
|
|
627
|
-
Object.entries(this.reactiveStateGradients).forEach(([e, t]) => {
|
|
628
|
-
if (e !== "animation" && u.isSignal(t)) {
|
|
629
|
-
const n = t.subscribe(() => this.handleStateSignalChange());
|
|
630
|
-
this.reactiveSubscriptions.push(n);
|
|
631
|
-
}
|
|
632
|
-
});
|
|
633
|
-
}
|
|
634
|
-
handleStateSignalChange() {
|
|
635
|
-
const e = u.resolveStateOptions(this.reactiveStateGradients);
|
|
636
|
-
this.updateStateGradients(e), this.notifyStateUpdate();
|
|
637
|
-
}
|
|
638
|
-
notifyStateUpdate() {
|
|
639
|
-
this.updateCallback && this.updateCallback();
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
const _ = {
|
|
643
|
-
/**
|
|
644
|
-
* Create a reactive linear gradient
|
|
645
|
-
*/
|
|
646
|
-
linear: (r, e) => new O(
|
|
647
|
-
"reactive-linear",
|
|
648
|
-
{ type: "linear", options: r, __reactive: !0 },
|
|
649
|
-
e
|
|
650
|
-
),
|
|
651
|
-
/**
|
|
652
|
-
* Create a reactive radial gradient
|
|
653
|
-
*/
|
|
654
|
-
radial: (r, e) => new O(
|
|
655
|
-
"reactive-radial",
|
|
656
|
-
{ type: "radial", options: r, __reactive: !0 },
|
|
657
|
-
e
|
|
658
|
-
),
|
|
659
|
-
/**
|
|
660
|
-
* Create a reactive angular gradient
|
|
661
|
-
*/
|
|
662
|
-
angular: (r, e) => new O(
|
|
663
|
-
"reactive-angular",
|
|
664
|
-
{ type: "angular", options: r, __reactive: !0 },
|
|
665
|
-
e
|
|
666
|
-
),
|
|
667
|
-
/**
|
|
668
|
-
* Create a reactive state gradient
|
|
669
|
-
*/
|
|
670
|
-
state: (r, e, t) => new u(r, e, t)
|
|
671
|
-
}, Ge = {
|
|
672
|
-
/**
|
|
673
|
-
* Create an animated gradient that cycles through colors
|
|
674
|
-
*/
|
|
675
|
-
createAnimatedGradient: (r, e = 3e3) => {
|
|
676
|
-
const t = {
|
|
677
|
-
value: r[0],
|
|
678
|
-
subscribe: (n) => () => {
|
|
679
|
-
}
|
|
680
|
-
};
|
|
681
|
-
return _.linear({
|
|
682
|
-
colors: [t, r[1]],
|
|
683
|
-
startPoint: "top",
|
|
684
|
-
endPoint: "bottom"
|
|
685
|
-
});
|
|
686
|
-
},
|
|
687
|
-
/**
|
|
688
|
-
* Create a progress gradient that fills based on a signal
|
|
689
|
-
*/
|
|
690
|
-
createProgressGradient: (r, e = "#007AFF") => _.linear({
|
|
691
|
-
colors: [e, "transparent"],
|
|
692
|
-
stops: [r, r],
|
|
693
|
-
// Both stops use the same signal
|
|
694
|
-
startPoint: "leading",
|
|
695
|
-
endPoint: "trailing"
|
|
696
|
-
}),
|
|
697
|
-
/**
|
|
698
|
-
* Create a data-driven gradient that reflects numeric values
|
|
699
|
-
*/
|
|
700
|
-
createDataGradient: (r, e, t, n = ["#ff0000", "#ffff00", "#00ff00"]) => _.linear({
|
|
701
|
-
colors: n,
|
|
702
|
-
startPoint: "top",
|
|
703
|
-
endPoint: "bottom"
|
|
704
|
-
})
|
|
705
|
-
}, Pe = {
|
|
706
|
-
/**
|
|
707
|
-
* Check if a background value is reactive
|
|
708
|
-
*/
|
|
709
|
-
isReactiveBackground: (r) => r instanceof O || r instanceof u,
|
|
710
|
-
/**
|
|
711
|
-
* Create a reactive background from a signal
|
|
712
|
-
*/
|
|
713
|
-
fromSignal: (r) => _.state("signal-background", {
|
|
714
|
-
default: r
|
|
715
|
-
})
|
|
716
|
-
};
|
|
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 () => {
|
|
722
|
-
try {
|
|
723
|
-
const g = await Promise.race([
|
|
724
|
-
r(),
|
|
725
|
-
new Promise(
|
|
726
|
-
(y, C) => setTimeout(() => C(new Error("Component load timeout")), i)
|
|
727
|
-
)
|
|
728
|
-
]);
|
|
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;
|
|
733
|
-
} finally {
|
|
734
|
-
d = !1, f = null;
|
|
735
|
-
}
|
|
736
|
-
})(), await f);
|
|
737
|
-
};
|
|
738
|
-
return s === "idle" && typeof requestIdleCallback < "u" ? requestIdleCallback(() => {
|
|
739
|
-
w().catch(() => {
|
|
740
|
-
});
|
|
741
|
-
}) : s === "idle" ? setTimeout(() => {
|
|
742
|
-
w().catch(() => {
|
|
743
|
-
});
|
|
744
|
-
}, 100) : s === "immediate" && w().catch(() => {
|
|
745
|
-
}), (g) => {
|
|
746
|
-
if (!a && !d && !o && w().catch(() => {
|
|
747
|
-
}), m)
|
|
748
|
-
return n ? n(m) : T(m);
|
|
749
|
-
if (d || !o)
|
|
750
|
-
return t || H();
|
|
751
|
-
try {
|
|
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);
|
|
756
|
-
}
|
|
757
|
-
};
|
|
758
|
-
}
|
|
759
|
-
function ke(r) {
|
|
760
|
-
return {
|
|
761
|
-
type: "component",
|
|
762
|
-
render: () => ({
|
|
763
|
-
type: "element",
|
|
764
|
-
tag: "div",
|
|
765
|
-
props: { class: "tachui-suspense" },
|
|
766
|
-
children: r.children.map(() => ({
|
|
767
|
-
type: "element",
|
|
768
|
-
tag: "div",
|
|
769
|
-
children: []
|
|
770
|
-
}))
|
|
771
|
-
}),
|
|
772
|
-
props: r,
|
|
773
|
-
id: `suspense-${Math.random().toString(36).substr(2, 9)}`
|
|
774
|
-
};
|
|
775
|
-
}
|
|
776
|
-
function B(r) {
|
|
777
|
-
return r().then((e) => e && typeof e == "object" && "default" in e ? e.default : e);
|
|
778
|
-
}
|
|
779
|
-
function Ne(r, e = {}) {
|
|
780
|
-
const t = {};
|
|
781
|
-
for (const [n, i] of Object.entries(r))
|
|
782
|
-
t[n] = M(i, e);
|
|
783
|
-
return t;
|
|
784
|
-
}
|
|
785
|
-
function Ue(r) {
|
|
786
|
-
const e = Object.entries(r).map(
|
|
787
|
-
async ([t, n]) => [t, await B(n)]
|
|
788
|
-
);
|
|
789
|
-
return Promise.all(e).then((t) => {
|
|
790
|
-
const n = {};
|
|
791
|
-
for (const [i, s] of t)
|
|
792
|
-
n[i] = s;
|
|
793
|
-
return n;
|
|
794
|
-
});
|
|
795
|
-
}
|
|
796
|
-
function H() {
|
|
797
|
-
return {
|
|
798
|
-
type: "element",
|
|
799
|
-
tag: "div",
|
|
800
|
-
props: {
|
|
801
|
-
class: "tachui-lazy-loading",
|
|
802
|
-
style: "padding: 16px; color: #666; text-align: center;"
|
|
803
|
-
},
|
|
804
|
-
children: [
|
|
805
|
-
{
|
|
806
|
-
type: "text",
|
|
807
|
-
text: "Loading component..."
|
|
808
|
-
}
|
|
809
|
-
]
|
|
810
|
-
};
|
|
811
|
-
}
|
|
812
|
-
function T(r) {
|
|
813
|
-
return {
|
|
814
|
-
type: "element",
|
|
815
|
-
tag: "div",
|
|
816
|
-
props: {
|
|
817
|
-
class: "tachui-lazy-error",
|
|
818
|
-
style: "padding: 16px; color: #d32f2f; border: 1px solid #d32f2f; border-radius: 4px; background: #ffeaea;"
|
|
819
|
-
},
|
|
820
|
-
children: [
|
|
821
|
-
{
|
|
822
|
-
type: "text",
|
|
823
|
-
text: `Failed to load component: ${r.message}`
|
|
824
|
-
}
|
|
825
|
-
]
|
|
826
|
-
};
|
|
827
|
-
}
|
|
828
|
-
function $e(r, e = {}) {
|
|
829
|
-
const { rootMargin: t = "50px", threshold: n = 0.1, ...i } = e;
|
|
830
|
-
return i.preload === "visible" && typeof IntersectionObserver < "u" ? (s) => {
|
|
831
|
-
const a = M(r, { ...i, preload: "never" });
|
|
832
|
-
return setTimeout(() => {
|
|
833
|
-
a(s);
|
|
834
|
-
}, 100), a(s);
|
|
835
|
-
} : M(r, i);
|
|
836
|
-
}
|
|
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 {
|
|
839
|
-
constructor(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();
|
|
841
|
-
}
|
|
842
|
-
/**
|
|
843
|
-
* Register a @State property wrapper
|
|
844
|
-
*/
|
|
845
|
-
registerState(e, t = {}) {
|
|
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);
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
/**
|
|
853
|
-
* Register a @Binding property wrapper
|
|
854
|
-
*/
|
|
855
|
-
registerBinding(e, t = {}) {
|
|
856
|
-
const n = `${this.componentContext.id}_${t.name || "binding"}_${Date.now()}`;
|
|
857
|
-
this.bindings.set(n, e);
|
|
858
|
-
const i = {
|
|
859
|
-
type: "Binding",
|
|
860
|
-
propertyName: t.name || "binding",
|
|
861
|
-
componentId: this.componentContext.id,
|
|
862
|
-
options: t
|
|
863
|
-
};
|
|
864
|
-
this.registry.register(i);
|
|
865
|
-
}
|
|
866
|
-
/**
|
|
867
|
-
* Register an @ObservedObject property wrapper
|
|
868
|
-
*/
|
|
869
|
-
registerObservedObject(e, t = {}) {
|
|
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);
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
/**
|
|
877
|
-
* Register an @EnvironmentObject property wrapper
|
|
878
|
-
*/
|
|
879
|
-
registerEnvironmentObject(e, t) {
|
|
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);
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
/**
|
|
887
|
-
* Clean up all property wrappers for this component
|
|
888
|
-
*/
|
|
889
|
-
cleanup() {
|
|
890
|
-
this.states.clear(), this.bindings.clear(), this.observedObjects.clear(), this.environmentObjects.clear(), this.registry.cleanup(this.componentContext.id);
|
|
891
|
-
}
|
|
892
|
-
/**
|
|
893
|
-
* Get all registered states (for debugging)
|
|
894
|
-
*/
|
|
895
|
-
getStates() {
|
|
896
|
-
return new Map(this.states);
|
|
897
|
-
}
|
|
898
|
-
/**
|
|
899
|
-
* Get all registered bindings (for debugging)
|
|
900
|
-
*/
|
|
901
|
-
getBindings() {
|
|
902
|
-
return new Map(this.bindings);
|
|
903
|
-
}
|
|
904
|
-
/**
|
|
905
|
-
* Get all registered observed objects (for debugging)
|
|
906
|
-
*/
|
|
907
|
-
getObservedObjects() {
|
|
908
|
-
return new Map(this.observedObjects);
|
|
909
|
-
}
|
|
910
|
-
/**
|
|
911
|
-
* Get all registered environment objects (for debugging)
|
|
912
|
-
*/
|
|
913
|
-
getEnvironmentObjects() {
|
|
914
|
-
return new Map(this.environmentObjects);
|
|
915
|
-
}
|
|
916
|
-
/**
|
|
917
|
-
* Get property wrapper registry
|
|
918
|
-
*/
|
|
919
|
-
getRegistry() {
|
|
920
|
-
return this.registry;
|
|
921
|
-
}
|
|
922
|
-
/**
|
|
923
|
-
* Set up debugging for @State property wrappers
|
|
924
|
-
*/
|
|
925
|
-
setupStateDebugging(e, t) {
|
|
926
|
-
if (typeof window < "u") {
|
|
927
|
-
const n = window.__TACHUI_DEBUG__ || {};
|
|
928
|
-
n.states || (n.states = {}), n.states[`${t.componentId}_${t.propertyName}`] = {
|
|
929
|
-
state: e,
|
|
930
|
-
metadata: t,
|
|
931
|
-
getValue: () => e.wrappedValue,
|
|
932
|
-
setValue: (i) => {
|
|
933
|
-
e.projectedValue.set(i);
|
|
934
|
-
},
|
|
935
|
-
getBinding: () => e.projectedValue
|
|
936
|
-
}, window.__TACHUI_DEBUG__ = n;
|
|
937
|
-
}
|
|
938
|
-
}
|
|
939
|
-
/**
|
|
940
|
-
* Set up debugging for @ObservedObject property wrappers
|
|
941
|
-
*/
|
|
942
|
-
setupObservedObjectDebugging(e, t) {
|
|
943
|
-
if (typeof window < "u") {
|
|
944
|
-
const n = window.__TACHUI_DEBUG__ || {};
|
|
945
|
-
n.observedObjects || (n.observedObjects = {}), n.observedObjects[`${t.componentId}_${t.propertyName}`] = {
|
|
946
|
-
observedObject: e,
|
|
947
|
-
metadata: t,
|
|
948
|
-
getObject: () => e.wrappedValue,
|
|
949
|
-
getNotificationCount: () => e.wrappedValue.notificationCount || 0,
|
|
950
|
-
triggerChange: () => e.wrappedValue.notifyChange()
|
|
951
|
-
}, window.__TACHUI_DEBUG__ = n;
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
class q {
|
|
956
|
-
constructor() {
|
|
957
|
-
h(this, "metadata", /* @__PURE__ */ new Map());
|
|
958
|
-
}
|
|
959
|
-
/**
|
|
960
|
-
* Register property wrapper metadata
|
|
961
|
-
*/
|
|
962
|
-
register(e) {
|
|
963
|
-
const t = e.componentId, n = this.metadata.get(t) || [];
|
|
964
|
-
n.push(e), this.metadata.set(t, n);
|
|
965
|
-
}
|
|
966
|
-
/**
|
|
967
|
-
* Unregister a specific property wrapper
|
|
968
|
-
*/
|
|
969
|
-
unregister(e, t) {
|
|
970
|
-
const i = (this.metadata.get(e) || []).filter((s) => s.propertyName !== t);
|
|
971
|
-
i.length > 0 ? this.metadata.set(e, i) : this.metadata.delete(e);
|
|
972
|
-
}
|
|
973
|
-
/**
|
|
974
|
-
* Clean up all metadata for a component
|
|
975
|
-
*/
|
|
976
|
-
cleanup(e) {
|
|
977
|
-
this.metadata.delete(e);
|
|
978
|
-
}
|
|
979
|
-
/**
|
|
980
|
-
* Get all metadata for a component
|
|
981
|
-
*/
|
|
982
|
-
getMetadata(e) {
|
|
983
|
-
return this.metadata.get(e) || [];
|
|
984
|
-
}
|
|
985
|
-
/**
|
|
986
|
-
* Get all registered metadata (for debugging)
|
|
987
|
-
*/
|
|
988
|
-
getAllMetadata() {
|
|
989
|
-
return new Map(this.metadata);
|
|
990
|
-
}
|
|
991
|
-
}
|
|
992
|
-
function Re(r) {
|
|
993
|
-
return new F(r);
|
|
994
|
-
}
|
|
995
|
-
const V = class S {
|
|
996
|
-
constructor() {
|
|
997
|
-
h(this, "managers", /* @__PURE__ */ new Map());
|
|
998
|
-
}
|
|
999
|
-
static getInstance() {
|
|
1000
|
-
return S.instance || (S.instance = new S()), S.instance;
|
|
1001
|
-
}
|
|
1002
|
-
register(e, t) {
|
|
1003
|
-
this.managers.set(e, t);
|
|
1004
|
-
}
|
|
1005
|
-
unregister(e) {
|
|
1006
|
-
this.managers.delete(e);
|
|
1007
|
-
}
|
|
1008
|
-
getManager(e) {
|
|
1009
|
-
return this.managers.get(e);
|
|
1010
|
-
}
|
|
1011
|
-
getAllManagers() {
|
|
1012
|
-
return new Map(this.managers);
|
|
1013
|
-
}
|
|
1014
|
-
/**
|
|
1015
|
-
* Get debugging information for all components
|
|
1016
|
-
*/
|
|
1017
|
-
getDebugInfo() {
|
|
1018
|
-
const e = {};
|
|
1019
|
-
for (const [t, n] of this.managers)
|
|
1020
|
-
e[t] = {
|
|
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)
|
|
1026
|
-
};
|
|
1027
|
-
return e;
|
|
1028
|
-
}
|
|
1029
|
-
};
|
|
1030
|
-
h(V, "instance");
|
|
1031
|
-
let v = V;
|
|
1032
|
-
function Be(r, e) {
|
|
1033
|
-
v.getInstance().register(r, e);
|
|
1034
|
-
}
|
|
1035
|
-
function He(r) {
|
|
1036
|
-
v.getInstance().unregister(r);
|
|
1037
|
-
}
|
|
1038
|
-
function J(r) {
|
|
1039
|
-
return v.getInstance().getManager(r);
|
|
1040
|
-
}
|
|
1041
|
-
function K() {
|
|
1042
|
-
return v.getInstance().getAllManagers();
|
|
1043
|
-
}
|
|
1044
|
-
function Q() {
|
|
1045
|
-
return v.getInstance().getDebugInfo();
|
|
1046
|
-
}
|
|
1047
|
-
function Le() {
|
|
1048
|
-
if (typeof window < "u" && process.env.NODE_ENV === "development") {
|
|
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(
|
|
1055
|
-
"TachUI State Management debugging enabled. Use window.__TACHUI_DEBUG__.stateManagers"
|
|
1056
|
-
);
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
const We = P;
|
|
1060
|
-
function Fe(r) {
|
|
1061
|
-
return console.warn("useEnvironmentObject is deprecated, use EnvironmentObject instead"), k(r);
|
|
1062
|
-
}
|
|
1063
|
-
const qe = {
|
|
1064
|
-
/**
|
|
1065
|
-
* Check if a value is any kind of property wrapper
|
|
1066
|
-
*/
|
|
1067
|
-
isPropertyWrapper(r) {
|
|
1068
|
-
return r && typeof r == "object" && "wrappedValue" in r && "projectedValue" in r;
|
|
1069
|
-
},
|
|
1070
|
-
/**
|
|
1071
|
-
* Extract the wrapped value from any property wrapper
|
|
1072
|
-
*/
|
|
1073
|
-
unwrap(r) {
|
|
1074
|
-
return this.isPropertyWrapper(r) ? r.wrappedValue : r;
|
|
1075
|
-
},
|
|
1076
|
-
/**
|
|
1077
|
-
* Create a debug snapshot of all property wrappers in a component
|
|
1078
|
-
*/
|
|
1079
|
-
createDebugSnapshot(r) {
|
|
1080
|
-
if (typeof window < "u") {
|
|
1081
|
-
const e = window.__TACHUI_DEBUG__;
|
|
1082
|
-
if (e)
|
|
1083
|
-
return {
|
|
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()
|
|
1088
|
-
}, t), {}) : {}
|
|
1089
|
-
};
|
|
1090
|
-
}
|
|
1091
|
-
return null;
|
|
1092
|
-
}
|
|
1093
|
-
}, Je = "0.1.0";
|
|
1094
|
-
export {
|
|
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,
|
|
1137
|
-
M as t,
|
|
1138
|
-
B as u,
|
|
1139
|
-
Ue as v,
|
|
1140
|
-
Ae as w,
|
|
1141
|
-
u as x,
|
|
1142
|
-
_ as y,
|
|
1143
|
-
Ge as z
|
|
1144
|
-
};
|