@tachui/core 0.8.16 → 0.8.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common.js +383 -382
- package/dist/essential.js +396 -395
- package/dist/index-Bgna5tXS.js +733 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +376 -375
- package/dist/utils/sanitize-svg.d.ts +2 -0
- package/dist/utils/sanitize-svg.d.ts.map +1 -0
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/dist/index-BaBj0d3d.js +0 -618
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize-svg.d.ts","sourceRoot":"","sources":["../../src/utils/sanitize-svg.ts"],"names":[],"mappings":"AAgKA,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAsBlD"}
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachui/core",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.17",
|
|
4
4
|
"description": "tachUI core framework with reactive system and compiler",
|
|
5
5
|
"homepage": "https://tachui.dev/",
|
|
6
6
|
"type": "module",
|
|
@@ -141,8 +141,8 @@
|
|
|
141
141
|
"dist"
|
|
142
142
|
],
|
|
143
143
|
"dependencies": {
|
|
144
|
-
"@tachui/types": "0.8.
|
|
145
|
-
"@tachui/registry": "0.8.
|
|
144
|
+
"@tachui/types": "0.8.17",
|
|
145
|
+
"@tachui/registry": "0.8.17"
|
|
146
146
|
},
|
|
147
147
|
"devDependencies": {
|
|
148
148
|
"@types/jsdom": "^21.1.6",
|
package/dist/index-BaBj0d3d.js
DELETED
|
@@ -1,618 +0,0 @@
|
|
|
1
|
-
import { infinity as c } from "./constants/layout.js";
|
|
2
|
-
import { LayoutModifier as m } from "./modifiers/base.js";
|
|
3
|
-
import { y as h, t as T, h as w } from "./concatenated-component-BCrw_7cC.js";
|
|
4
|
-
import { g as z, a as E } from "./proxy-gO-vDCUZ.js";
|
|
5
|
-
import "./assets/index.js";
|
|
6
|
-
import "./scheduler-DppMK9mR.js";
|
|
7
|
-
import "./theme-CRLPHryV.js";
|
|
8
|
-
import "@tachui/types/reactive";
|
|
9
|
-
import "@tachui/types/modifiers";
|
|
10
|
-
import "typescript";
|
|
11
|
-
import "@tachui/registry";
|
|
12
|
-
import "./presets-B9x94uRn.js";
|
|
13
|
-
import "./component-D-O9yq0P.js";
|
|
14
|
-
import "./hooks-WGmpzYgD.js";
|
|
15
|
-
import "./runtime/dom-bridge.js";
|
|
16
|
-
import "./component-base-C41K3NTe.js";
|
|
17
|
-
import "@tachui/types/gradients";
|
|
18
|
-
import "./index-JQ1sW1SK.js";
|
|
19
|
-
import "./plugins/index.js";
|
|
20
|
-
import "./state/index.js";
|
|
21
|
-
import "./validation/index.js";
|
|
22
|
-
function X() {
|
|
23
|
-
return new m({
|
|
24
|
-
frame: {
|
|
25
|
-
maxWidth: c
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
function Y() {
|
|
30
|
-
return new m({
|
|
31
|
-
frame: {
|
|
32
|
-
maxHeight: c
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
function Z() {
|
|
37
|
-
return new m({
|
|
38
|
-
frame: {
|
|
39
|
-
maxWidth: c,
|
|
40
|
-
maxHeight: c
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
function Q() {
|
|
45
|
-
return new m({
|
|
46
|
-
frame: {
|
|
47
|
-
width: c,
|
|
48
|
-
height: c
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
function ee(o) {
|
|
53
|
-
return new m({
|
|
54
|
-
frame: {
|
|
55
|
-
width: o,
|
|
56
|
-
maxHeight: c
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
function te(o) {
|
|
61
|
-
return new m({
|
|
62
|
-
frame: {
|
|
63
|
-
height: o,
|
|
64
|
-
maxWidth: c
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
function ne(o, e) {
|
|
69
|
-
return new m({
|
|
70
|
-
frame: {
|
|
71
|
-
width: c,
|
|
72
|
-
height: c,
|
|
73
|
-
maxWidth: o,
|
|
74
|
-
maxHeight: e
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
function re(o, e, t, n) {
|
|
79
|
-
return new m({
|
|
80
|
-
frame: {
|
|
81
|
-
width: c,
|
|
82
|
-
height: c,
|
|
83
|
-
minWidth: o,
|
|
84
|
-
maxWidth: e,
|
|
85
|
-
minHeight: t,
|
|
86
|
-
maxHeight: n
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
function oe() {
|
|
91
|
-
return new m({
|
|
92
|
-
frame: {
|
|
93
|
-
maxWidth: c,
|
|
94
|
-
maxHeight: c
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
function ie() {
|
|
99
|
-
return new m({
|
|
100
|
-
frame: {
|
|
101
|
-
width: "100vw",
|
|
102
|
-
height: "100vh"
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
function ae() {
|
|
107
|
-
return new m({
|
|
108
|
-
frame: {
|
|
109
|
-
width: c,
|
|
110
|
-
height: c
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
function ce() {
|
|
115
|
-
return new m({
|
|
116
|
-
frame: {
|
|
117
|
-
width: c
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
const se = Symbol.for("tachui.concat");
|
|
122
|
-
function me(o) {
|
|
123
|
-
return o && typeof o == "object" && typeof o.isConcatenatable == "function" && o.isConcatenatable();
|
|
124
|
-
}
|
|
125
|
-
function ue(o) {
|
|
126
|
-
return o && typeof o == "object" && o.constructor.name === "ConcatenatedComponent";
|
|
127
|
-
}
|
|
128
|
-
const le = Symbol.for("tachui.concat");
|
|
129
|
-
class pe {
|
|
130
|
-
/**
|
|
131
|
-
* Concatenate this component with another concatenatable component
|
|
132
|
-
*/
|
|
133
|
-
concat(e) {
|
|
134
|
-
const t = this.toSegment(), n = e.toSegment();
|
|
135
|
-
return e instanceof h ? new h(
|
|
136
|
-
[t, ...e.segments],
|
|
137
|
-
this.mergeMetadata(e.metadata, e.segments.length + 1)
|
|
138
|
-
) : new h(
|
|
139
|
-
[t, n],
|
|
140
|
-
this.createMetadata(2)
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Check if this component supports concatenation
|
|
145
|
-
*/
|
|
146
|
-
isConcatenatable() {
|
|
147
|
-
return !0;
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Create metadata for a new concatenated component
|
|
151
|
-
*/
|
|
152
|
-
createMetadata(e) {
|
|
153
|
-
return {
|
|
154
|
-
totalSegments: e,
|
|
155
|
-
accessibilityRole: this.determineAccessibilityRole(),
|
|
156
|
-
semanticStructure: this.determineSemanticStructure()
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Merge metadata when concatenating with existing concatenated component
|
|
161
|
-
*/
|
|
162
|
-
mergeMetadata(e, t) {
|
|
163
|
-
return {
|
|
164
|
-
totalSegments: t,
|
|
165
|
-
accessibilityRole: this.mergeAccessibilityRoles(e.accessibilityRole),
|
|
166
|
-
semanticStructure: this.mergeSemanticStructures(e.semanticStructure)
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Determine the accessibility role for this component
|
|
171
|
-
*/
|
|
172
|
-
determineAccessibilityRole() {
|
|
173
|
-
const e = this.constructor.name;
|
|
174
|
-
return e === "EnhancedText" ? "text" : e === "EnhancedImage" || e === "EnhancedButton" || e === "EnhancedLink" ? "group" : "composite";
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Determine the semantic structure for this component
|
|
178
|
-
*/
|
|
179
|
-
determineSemanticStructure() {
|
|
180
|
-
const e = this.constructor.name;
|
|
181
|
-
return e === "EnhancedText" || e === "EnhancedImage" ? "inline" : "mixed";
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Merge accessibility roles when combining components
|
|
185
|
-
*/
|
|
186
|
-
mergeAccessibilityRoles(e) {
|
|
187
|
-
const t = this.determineAccessibilityRole();
|
|
188
|
-
return t === "text" && e === "text" ? "text" : t === "composite" || e === "composite" ? "composite" : "group";
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Merge semantic structures when combining components
|
|
192
|
-
*/
|
|
193
|
-
mergeSemanticStructures(e) {
|
|
194
|
-
const t = this.determineSemanticStructure();
|
|
195
|
-
return t === "inline" && e === "inline" ? "inline" : t === "block" && e === "block" ? "block" : "mixed";
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
function de(o) {
|
|
199
|
-
const e = o;
|
|
200
|
-
return e.concat = function(t) {
|
|
201
|
-
const n = {
|
|
202
|
-
id: this.id,
|
|
203
|
-
component: this,
|
|
204
|
-
modifiers: this.modifiers || [],
|
|
205
|
-
render: () => {
|
|
206
|
-
const i = this.render();
|
|
207
|
-
return Array.isArray(i) ? i[0] : i;
|
|
208
|
-
}
|
|
209
|
-
}, r = t.toSegment();
|
|
210
|
-
return t instanceof h ? new h(
|
|
211
|
-
[n, ...t.segments],
|
|
212
|
-
{
|
|
213
|
-
totalSegments: t.segments.length + 1,
|
|
214
|
-
accessibilityRole: "group",
|
|
215
|
-
semanticStructure: "mixed"
|
|
216
|
-
}
|
|
217
|
-
) : new h(
|
|
218
|
-
[n, r],
|
|
219
|
-
{
|
|
220
|
-
totalSegments: 2,
|
|
221
|
-
accessibilityRole: "group",
|
|
222
|
-
semanticStructure: "mixed"
|
|
223
|
-
}
|
|
224
|
-
);
|
|
225
|
-
}, e.toSegment = function() {
|
|
226
|
-
return {
|
|
227
|
-
id: this.id,
|
|
228
|
-
component: this,
|
|
229
|
-
modifiers: this.modifiers || [],
|
|
230
|
-
render: () => {
|
|
231
|
-
const t = this.render();
|
|
232
|
-
return Array.isArray(t) ? t[0] : t;
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
}, e.isConcatenatable = function() {
|
|
236
|
-
return !0;
|
|
237
|
-
}, e;
|
|
238
|
-
}
|
|
239
|
-
const l = /* @__PURE__ */ new Map(), M = 300 * 1e3, S = 100;
|
|
240
|
-
class fe {
|
|
241
|
-
/**
|
|
242
|
-
* Optimize an array of segments by merging compatible adjacent text segments
|
|
243
|
-
* Enhanced with caching and performance monitoring
|
|
244
|
-
*/
|
|
245
|
-
static optimize(e) {
|
|
246
|
-
const t = performance.now();
|
|
247
|
-
if (e.length < 2) return e;
|
|
248
|
-
const n = this.generateCacheKey(e), r = this.getCachedOptimization(n);
|
|
249
|
-
if (r)
|
|
250
|
-
return r.optimizedSegments;
|
|
251
|
-
const i = this.performOptimization(e), s = performance.now() - t, a = {
|
|
252
|
-
...this.getOptimizationStats(e, i),
|
|
253
|
-
processingTimeMs: s
|
|
254
|
-
};
|
|
255
|
-
return this.cacheOptimization(n, i, a), process.env.NODE_ENV === "development" && s > 5 && console.log(`TachUI Concatenation: Optimization took ${s.toFixed(2)}ms for ${e.length} segments`), i;
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Core optimization algorithm separated for clarity
|
|
259
|
-
*/
|
|
260
|
-
static performOptimization(e) {
|
|
261
|
-
const t = [];
|
|
262
|
-
for (const n of e) {
|
|
263
|
-
const r = t[t.length - 1];
|
|
264
|
-
r && this.canMergeTextSegments(r, n) ? t[t.length - 1] = this.mergeTextSegments(r, n) : t.push(n);
|
|
265
|
-
}
|
|
266
|
-
return t;
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Generate a cache key from segments
|
|
270
|
-
*/
|
|
271
|
-
static generateCacheKey(e) {
|
|
272
|
-
return e.map((n) => {
|
|
273
|
-
const r = n.component, i = this.extractTextContent(r), s = this.hashModifiers(n.modifiers);
|
|
274
|
-
return `${r.constructor.name}:${i}:${s}`;
|
|
275
|
-
}).join("|");
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* Hash modifiers for cache key generation
|
|
279
|
-
*/
|
|
280
|
-
static hashModifiers(e) {
|
|
281
|
-
if (e.length === 0) return "none";
|
|
282
|
-
try {
|
|
283
|
-
const t = e.map((r) => ({
|
|
284
|
-
type: r.type,
|
|
285
|
-
props: r.properties
|
|
286
|
-
})), n = JSON.stringify(t);
|
|
287
|
-
return typeof btoa == "function" ? btoa(n).substring(0, 8) : this.simpleHash(n).toString(16).substring(0, 8);
|
|
288
|
-
} catch {
|
|
289
|
-
return "hash-error";
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Simple hash function fallback for environments without btoa
|
|
294
|
-
*/
|
|
295
|
-
static simpleHash(e) {
|
|
296
|
-
let t = 0;
|
|
297
|
-
for (let n = 0; n < e.length; n++) {
|
|
298
|
-
const r = e.charCodeAt(n);
|
|
299
|
-
t = (t << 5) - t + r, t = t & t;
|
|
300
|
-
}
|
|
301
|
-
return Math.abs(t);
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* Get cached optimization result
|
|
305
|
-
*/
|
|
306
|
-
static getCachedOptimization(e) {
|
|
307
|
-
const t = l.get(e);
|
|
308
|
-
return t ? Date.now() - t.timestamp > M ? (l.delete(e), null) : t : null;
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
* Cache optimization result
|
|
312
|
-
*/
|
|
313
|
-
static cacheOptimization(e, t, n) {
|
|
314
|
-
if (l.size >= S) {
|
|
315
|
-
const r = l.keys().next().value;
|
|
316
|
-
r && l.delete(r);
|
|
317
|
-
}
|
|
318
|
-
l.set(e, {
|
|
319
|
-
optimizedSegments: t,
|
|
320
|
-
stats: n,
|
|
321
|
-
timestamp: Date.now()
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Clear optimization cache (useful for testing)
|
|
326
|
-
*/
|
|
327
|
-
static clearCache() {
|
|
328
|
-
l.clear();
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* Get cache statistics
|
|
332
|
-
*/
|
|
333
|
-
static getCacheStats() {
|
|
334
|
-
return {
|
|
335
|
-
size: l.size,
|
|
336
|
-
maxSize: S,
|
|
337
|
-
hitRate: 0
|
|
338
|
-
// Would need to track hits/misses to calculate this
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
* Check if two segments can be merged
|
|
343
|
-
*/
|
|
344
|
-
static canMergeTextSegments(e, t) {
|
|
345
|
-
return e.component.constructor.name !== "EnhancedText" || t.component.constructor.name !== "EnhancedText" ? !1 : this.modifiersCompatible(e.modifiers, t.modifiers);
|
|
346
|
-
}
|
|
347
|
-
/**
|
|
348
|
-
* Check if two modifier arrays are compatible for merging
|
|
349
|
-
*/
|
|
350
|
-
static modifiersCompatible(e, t) {
|
|
351
|
-
if (e.length !== t.length) return !1;
|
|
352
|
-
for (let n = 0; n < e.length; n++)
|
|
353
|
-
if (!this.modifierEqual(e[n], t[n]))
|
|
354
|
-
return !1;
|
|
355
|
-
return !0;
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* Check if two modifiers are equal (simplified comparison)
|
|
359
|
-
*/
|
|
360
|
-
static modifierEqual(e, t) {
|
|
361
|
-
if (e.type !== t.type) return !1;
|
|
362
|
-
try {
|
|
363
|
-
return JSON.stringify(e.properties) === JSON.stringify(t.properties);
|
|
364
|
-
} catch {
|
|
365
|
-
return !1;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
/**
|
|
369
|
-
* Merge two text segments into a single segment
|
|
370
|
-
*/
|
|
371
|
-
static mergeTextSegments(e, t) {
|
|
372
|
-
const n = e.component, r = t.component, i = this.extractTextContent(n), s = this.extractTextContent(r), a = i + s;
|
|
373
|
-
return {
|
|
374
|
-
id: `merged-${e.id}-${t.id}`,
|
|
375
|
-
component: this.createMergedTextComponent(a, n.props, e.modifiers),
|
|
376
|
-
modifiers: e.modifiers,
|
|
377
|
-
// Use modifiers from first segment (they're identical)
|
|
378
|
-
render: () => this.createMergedTextComponent(a, n.props, e.modifiers).render()[0]
|
|
379
|
-
};
|
|
380
|
-
}
|
|
381
|
-
/**
|
|
382
|
-
* Extract text content from a text component
|
|
383
|
-
*/
|
|
384
|
-
static extractTextContent(e) {
|
|
385
|
-
const t = e.props?.content;
|
|
386
|
-
return typeof t == "string" ? t : typeof t == "function" ? t() : t && typeof t == "object" && "peek" in t && t.peek() || "";
|
|
387
|
-
}
|
|
388
|
-
/**
|
|
389
|
-
* Create a new merged text component
|
|
390
|
-
*/
|
|
391
|
-
static createMergedTextComponent(e, t, n) {
|
|
392
|
-
const r = {
|
|
393
|
-
...t,
|
|
394
|
-
content: e
|
|
395
|
-
};
|
|
396
|
-
return {
|
|
397
|
-
type: "Text",
|
|
398
|
-
id: `merged-text-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
|
|
399
|
-
props: r,
|
|
400
|
-
mounted: !1,
|
|
401
|
-
cleanup: [],
|
|
402
|
-
modifiers: n,
|
|
403
|
-
render() {
|
|
404
|
-
const i = T(e);
|
|
405
|
-
return [w("span", {}, i)];
|
|
406
|
-
}
|
|
407
|
-
};
|
|
408
|
-
}
|
|
409
|
-
/**
|
|
410
|
-
* Analyze segments and determine if optimization would be beneficial
|
|
411
|
-
*/
|
|
412
|
-
static shouldOptimize(e) {
|
|
413
|
-
if (e.length < 2) return !1;
|
|
414
|
-
let t = 0;
|
|
415
|
-
for (let n = 0; n < e.length - 1; n++) {
|
|
416
|
-
const r = e[n], i = e[n + 1];
|
|
417
|
-
r.component.constructor.name === "EnhancedText" && i.component.constructor.name === "EnhancedText" && t++;
|
|
418
|
-
}
|
|
419
|
-
return t > 0;
|
|
420
|
-
}
|
|
421
|
-
/**
|
|
422
|
-
* Get optimization statistics (enhanced for Phase 4.1)
|
|
423
|
-
*/
|
|
424
|
-
static getOptimizationStats(e, t) {
|
|
425
|
-
const n = e.length - t.length, r = e.length > 0 ? Math.round(n / e.length * 100) : 0;
|
|
426
|
-
return {
|
|
427
|
-
originalCount: e.length,
|
|
428
|
-
optimizedCount: t.length,
|
|
429
|
-
reductionPercent: r,
|
|
430
|
-
textSegmentsMerged: n
|
|
431
|
-
};
|
|
432
|
-
}
|
|
433
|
-
/**
|
|
434
|
-
* Advanced optimization analysis for performance monitoring
|
|
435
|
-
*/
|
|
436
|
-
static analyzeOptimizationOpportunities(e) {
|
|
437
|
-
let t = 0, n = 0, r = 0, i = 0;
|
|
438
|
-
for (let a = 0; a < e.length; a++) {
|
|
439
|
-
const u = e[a];
|
|
440
|
-
switch (u.component.constructor.name) {
|
|
441
|
-
case "EnhancedText":
|
|
442
|
-
if (t++, a < e.length - 1) {
|
|
443
|
-
const f = e[a + 1];
|
|
444
|
-
this.canMergeTextSegments(u, f) && i++;
|
|
445
|
-
}
|
|
446
|
-
break;
|
|
447
|
-
case "EnhancedImage":
|
|
448
|
-
n++;
|
|
449
|
-
break;
|
|
450
|
-
case "EnhancedButton":
|
|
451
|
-
case "EnhancedLinkComponent":
|
|
452
|
-
r++;
|
|
453
|
-
break;
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
const s = e.length > 0 ? Math.round(i / e.length * 100) : 0;
|
|
457
|
-
return {
|
|
458
|
-
totalSegments: e.length,
|
|
459
|
-
textSegments: t,
|
|
460
|
-
imageSegments: n,
|
|
461
|
-
interactiveSegments: r,
|
|
462
|
-
optimizableTextPairs: i,
|
|
463
|
-
estimatedReductionPercent: s
|
|
464
|
-
};
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
function C(o, e = {}) {
|
|
468
|
-
const { fallback: t, errorFallback: n, timeout: r = 1e4, preload: i = "never" } = e;
|
|
469
|
-
let s = !1, a = null, u = !1, d = null, f = null;
|
|
470
|
-
const y = async () => {
|
|
471
|
-
s || u || a || f || (s = !0, u = !0, d = null, f = (async () => {
|
|
472
|
-
try {
|
|
473
|
-
const p = await Promise.race([
|
|
474
|
-
o(),
|
|
475
|
-
new Promise(
|
|
476
|
-
(g, x) => setTimeout(() => x(new Error("Component load timeout")), r)
|
|
477
|
-
)
|
|
478
|
-
]);
|
|
479
|
-
a = "default" in p ? p.default : p;
|
|
480
|
-
} catch (p) {
|
|
481
|
-
const g = p;
|
|
482
|
-
(typeof process > "u" || process.env.NODE_ENV !== "test") && console.error("Failed to load lazy component:", g), d = g;
|
|
483
|
-
} finally {
|
|
484
|
-
u = !1, f = null;
|
|
485
|
-
}
|
|
486
|
-
})(), await f);
|
|
487
|
-
};
|
|
488
|
-
return i === "idle" && typeof requestIdleCallback < "u" ? requestIdleCallback(() => {
|
|
489
|
-
y().catch(() => {
|
|
490
|
-
});
|
|
491
|
-
}) : i === "idle" ? setTimeout(() => {
|
|
492
|
-
y().catch(() => {
|
|
493
|
-
});
|
|
494
|
-
}, 100) : i === "immediate" && y().catch(() => {
|
|
495
|
-
}), (p) => {
|
|
496
|
-
if (!s && !u && !a && y().catch(() => {
|
|
497
|
-
}), d)
|
|
498
|
-
return n ? n(d) : b(d);
|
|
499
|
-
if (u || !a)
|
|
500
|
-
return t || k();
|
|
501
|
-
try {
|
|
502
|
-
return typeof a == "function" ? a(p) : a;
|
|
503
|
-
} catch (g) {
|
|
504
|
-
const x = g;
|
|
505
|
-
return (typeof process > "u" || process.env.NODE_ENV !== "test") && console.error("Error rendering lazy component:", x), b(x);
|
|
506
|
-
}
|
|
507
|
-
};
|
|
508
|
-
}
|
|
509
|
-
function he(o) {
|
|
510
|
-
return {
|
|
511
|
-
type: "component",
|
|
512
|
-
render: () => ({
|
|
513
|
-
type: "element",
|
|
514
|
-
tag: "div",
|
|
515
|
-
props: { class: "tachui-suspense" },
|
|
516
|
-
children: o.children.map(() => ({
|
|
517
|
-
type: "element",
|
|
518
|
-
tag: "div",
|
|
519
|
-
children: []
|
|
520
|
-
}))
|
|
521
|
-
}),
|
|
522
|
-
props: o,
|
|
523
|
-
id: `suspense-${Math.random().toString(36).substr(2, 9)}`
|
|
524
|
-
};
|
|
525
|
-
}
|
|
526
|
-
function O(o) {
|
|
527
|
-
return o().then((e) => e && typeof e == "object" && "default" in e ? e.default : e);
|
|
528
|
-
}
|
|
529
|
-
function ge(o, e = {}) {
|
|
530
|
-
const t = {};
|
|
531
|
-
for (const [n, r] of Object.entries(o))
|
|
532
|
-
t[n] = C(r, e);
|
|
533
|
-
return t;
|
|
534
|
-
}
|
|
535
|
-
function ye(o) {
|
|
536
|
-
const e = Object.entries(o).map(
|
|
537
|
-
async ([t, n]) => [t, await O(n)]
|
|
538
|
-
);
|
|
539
|
-
return Promise.all(e).then((t) => {
|
|
540
|
-
const n = {};
|
|
541
|
-
for (const [r, i] of t)
|
|
542
|
-
n[r] = i;
|
|
543
|
-
return n;
|
|
544
|
-
});
|
|
545
|
-
}
|
|
546
|
-
function k() {
|
|
547
|
-
return {
|
|
548
|
-
type: "element",
|
|
549
|
-
tag: "div",
|
|
550
|
-
props: {
|
|
551
|
-
class: "tachui-lazy-loading",
|
|
552
|
-
style: "padding: 16px; color: #666; text-align: center;"
|
|
553
|
-
},
|
|
554
|
-
children: [
|
|
555
|
-
{
|
|
556
|
-
type: "text",
|
|
557
|
-
text: "Loading component..."
|
|
558
|
-
}
|
|
559
|
-
]
|
|
560
|
-
};
|
|
561
|
-
}
|
|
562
|
-
function b(o) {
|
|
563
|
-
return {
|
|
564
|
-
type: "element",
|
|
565
|
-
tag: "div",
|
|
566
|
-
props: {
|
|
567
|
-
class: "tachui-lazy-error",
|
|
568
|
-
style: "padding: 16px; color: #d32f2f; border: 1px solid #d32f2f; border-radius: 4px; background: #ffeaea;"
|
|
569
|
-
},
|
|
570
|
-
children: [
|
|
571
|
-
{
|
|
572
|
-
type: "text",
|
|
573
|
-
text: `Failed to load component: ${o.message}`
|
|
574
|
-
}
|
|
575
|
-
]
|
|
576
|
-
};
|
|
577
|
-
}
|
|
578
|
-
function xe(o, e = {}) {
|
|
579
|
-
const { rootMargin: t = "50px", threshold: n = 0.1, ...r } = e;
|
|
580
|
-
return r.preload === "visible" && typeof IntersectionObserver < "u" ? (i) => {
|
|
581
|
-
const s = C(o, { ...r, preload: "never" });
|
|
582
|
-
return setTimeout(() => {
|
|
583
|
-
s(i);
|
|
584
|
-
}, 100), s(i);
|
|
585
|
-
} : C(o, r);
|
|
586
|
-
}
|
|
587
|
-
const Ce = Object.freeze({
|
|
588
|
-
configure: E,
|
|
589
|
-
getFeatureFlags: z
|
|
590
|
-
});
|
|
591
|
-
export {
|
|
592
|
-
se as C,
|
|
593
|
-
he as S,
|
|
594
|
-
fe as T,
|
|
595
|
-
ue as a,
|
|
596
|
-
pe as b,
|
|
597
|
-
le as c,
|
|
598
|
-
Y as d,
|
|
599
|
-
Z as e,
|
|
600
|
-
X as f,
|
|
601
|
-
Q as g,
|
|
602
|
-
ee as h,
|
|
603
|
-
me as i,
|
|
604
|
-
te as j,
|
|
605
|
-
ne as k,
|
|
606
|
-
oe as l,
|
|
607
|
-
de as m,
|
|
608
|
-
ie as n,
|
|
609
|
-
ae as o,
|
|
610
|
-
ce as p,
|
|
611
|
-
ge as q,
|
|
612
|
-
re as r,
|
|
613
|
-
xe as s,
|
|
614
|
-
Ce as t,
|
|
615
|
-
C as u,
|
|
616
|
-
O as v,
|
|
617
|
-
ye as w
|
|
618
|
-
};
|