@tachui/core 0.8.23 → 0.8.25
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/assets/index.js +41 -40
- package/dist/{binding-DCV5PKkK.js → binding-DCr-JHsC.js} +9 -9
- package/dist/build-tools/typegen-runner.d.ts +4 -0
- package/dist/build-tools/typegen-runner.d.ts.map +1 -1
- package/dist/cleanup-BR8UpYPX.js +61 -0
- package/dist/common.js +272 -277
- package/dist/{component-D-O9yq0P.js → component-BzvSm8rM.js} +19 -19
- package/dist/{component-base-C41K3NTe.js → component-base-Do2EdQkr.js} +32 -33
- package/dist/{component-context-B9HI2nZH.js → component-context-C7Y6Xu6h.js} +1 -1
- package/dist/components/index.js +1 -1
- package/dist/computed-CA4Cgtoe.js +407 -0
- package/dist/{concatenated-component-2Gzy5e2c.js → concatenated-component-CA54ng_j.js} +43 -44
- package/dist/css-classes/index.js +2 -2
- package/dist/{effect-BsW3fy1q.js → effect-DgNm6jk9.js} +3 -3
- package/dist/{enhanced-renderer-t9Ni2EEG.js → enhanced-renderer-D05CCloF.js} +26 -28
- package/dist/essential.js +276 -281
- package/dist/factories-Bz6LZlk6.js +653 -0
- package/dist/{factory-gqfMcmOy.js → factory-B1YXfgU1.js} +23 -29
- package/dist/full.d.ts +12 -0
- package/dist/full.d.ts.map +1 -0
- package/dist/full.js +436 -0
- package/dist/gradients/index.js +53 -53
- package/dist/hooks-w_FYPLjI.js +158 -0
- package/dist/{index-DL9Cys3t.js → index-CmQmIgPK.js} +220 -233
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +295 -300
- package/dist/minimal-prod.js +106 -108
- package/dist/minimal.js +97 -98
- package/dist/modifiers/base.d.ts.map +1 -1
- package/dist/modifiers/base.js +188 -181
- package/dist/modifiers/builder.js +1 -1
- package/dist/modifiers/factories.d.ts.map +1 -1
- package/dist/modifiers/index.js +22 -23
- package/dist/modifiers/registry.js +1 -1
- package/dist/{observed-object-p1CLdrFm.js → observed-object-DCoyucmV.js} +3 -3
- package/dist/optimization-D9t53vNJ.js +308 -0
- package/dist/{proxy-Cp0QUXME.js → proxy-B7ZIqGd0.js} +3 -3
- package/dist/reactive/index.js +87 -85
- package/dist/runtime/dom-bridge.js +15 -17
- package/dist/runtime/index.js +71 -71
- package/dist/runtime/renderer.js +10 -11
- package/dist/signal-BRoiFOO7.js +262 -0
- package/dist/{signal-list-07gNXGiW.js → signal-list-_Eid-N7_.js} +285 -176
- package/dist/state/index.js +43 -44
- package/dist/theme-D5-09a8N.js +26 -0
- package/dist/validation/index.js +24 -26
- package/dist/version.js +1 -1
- package/package.json +16 -3
- package/dist/factories-B3-rmvkB.js +0 -268
- package/dist/hooks-WGmpzYgD.js +0 -446
- package/dist/optimization-CbKNA9w4.js +0 -21
- package/dist/presets-B9x94uRn.js +0 -381
- package/dist/scheduler-DppMK9mR.js +0 -169
- package/dist/theme-CRLPHryV.js +0 -687
- package/dist/{index-JQ1sW1SK.js → index-7vhCZc7g.js} +1 -1
|
@@ -1,118 +1,105 @@
|
|
|
1
1
|
import { infinity as c } from "./constants/layout.js";
|
|
2
|
-
import { LayoutModifier as
|
|
3
|
-
import {
|
|
4
|
-
import { g as O,
|
|
2
|
+
import { LayoutModifier as l } from "./modifiers/base.js";
|
|
3
|
+
import { C as h, t as z, h as M } from "./concatenated-component-CA54ng_j.js";
|
|
4
|
+
import { g as O, c as N } from "./proxy-B7ZIqGd0.js";
|
|
5
5
|
import "./assets/index.js";
|
|
6
|
-
import "./scheduler-DppMK9mR.js";
|
|
7
|
-
import "./theme-CRLPHryV.js";
|
|
8
|
-
import "@tachui/types/reactive";
|
|
9
6
|
import "@tachui/types/modifiers";
|
|
10
|
-
import "typescript";
|
|
11
7
|
import "@tachui/registry";
|
|
12
|
-
import "./presets-B9x94uRn.js";
|
|
13
|
-
import "./component-D-O9yq0P.js";
|
|
14
|
-
import "./hooks-WGmpzYgD.js";
|
|
15
8
|
import "./runtime/dom-bridge.js";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import "./index-JQ1sW1SK.js";
|
|
19
|
-
import "./plugins/index.js";
|
|
20
|
-
import "./state/index.js";
|
|
21
|
-
import "./validation/index.js";
|
|
22
|
-
function st() {
|
|
23
|
-
return new m({
|
|
9
|
+
function X() {
|
|
10
|
+
return new l({
|
|
24
11
|
frame: {
|
|
25
12
|
maxWidth: c
|
|
26
13
|
}
|
|
27
14
|
});
|
|
28
15
|
}
|
|
29
|
-
function
|
|
30
|
-
return new
|
|
16
|
+
function J() {
|
|
17
|
+
return new l({
|
|
31
18
|
frame: {
|
|
32
19
|
maxHeight: c
|
|
33
20
|
}
|
|
34
21
|
});
|
|
35
22
|
}
|
|
36
|
-
function
|
|
37
|
-
return new
|
|
23
|
+
function K() {
|
|
24
|
+
return new l({
|
|
38
25
|
frame: {
|
|
39
26
|
maxWidth: c,
|
|
40
27
|
maxHeight: c
|
|
41
28
|
}
|
|
42
29
|
});
|
|
43
30
|
}
|
|
44
|
-
function
|
|
45
|
-
return new
|
|
31
|
+
function Y() {
|
|
32
|
+
return new l({
|
|
46
33
|
frame: {
|
|
47
34
|
width: c,
|
|
48
35
|
height: c
|
|
49
36
|
}
|
|
50
37
|
});
|
|
51
38
|
}
|
|
52
|
-
function
|
|
53
|
-
return new
|
|
39
|
+
function Z(r) {
|
|
40
|
+
return new l({
|
|
54
41
|
frame: {
|
|
55
42
|
width: r,
|
|
56
43
|
maxHeight: c
|
|
57
44
|
}
|
|
58
45
|
});
|
|
59
46
|
}
|
|
60
|
-
function
|
|
61
|
-
return new
|
|
47
|
+
function Q(r) {
|
|
48
|
+
return new l({
|
|
62
49
|
frame: {
|
|
63
50
|
height: r,
|
|
64
51
|
maxWidth: c
|
|
65
52
|
}
|
|
66
53
|
});
|
|
67
54
|
}
|
|
68
|
-
function
|
|
69
|
-
return new
|
|
55
|
+
function ee(r, e) {
|
|
56
|
+
return new l({
|
|
70
57
|
frame: {
|
|
71
58
|
width: c,
|
|
72
59
|
height: c,
|
|
73
60
|
maxWidth: r,
|
|
74
|
-
maxHeight:
|
|
61
|
+
maxHeight: e
|
|
75
62
|
}
|
|
76
63
|
});
|
|
77
64
|
}
|
|
78
|
-
function
|
|
79
|
-
return new
|
|
65
|
+
function te(r, e, t, n) {
|
|
66
|
+
return new l({
|
|
80
67
|
frame: {
|
|
81
68
|
width: c,
|
|
82
69
|
height: c,
|
|
83
70
|
minWidth: r,
|
|
84
|
-
maxWidth:
|
|
85
|
-
minHeight:
|
|
71
|
+
maxWidth: e,
|
|
72
|
+
minHeight: t,
|
|
86
73
|
maxHeight: n
|
|
87
74
|
}
|
|
88
75
|
});
|
|
89
76
|
}
|
|
90
|
-
function
|
|
91
|
-
return new
|
|
77
|
+
function ne() {
|
|
78
|
+
return new l({
|
|
92
79
|
frame: {
|
|
93
80
|
maxWidth: c,
|
|
94
81
|
maxHeight: c
|
|
95
82
|
}
|
|
96
83
|
});
|
|
97
84
|
}
|
|
98
|
-
function
|
|
99
|
-
return new
|
|
85
|
+
function re() {
|
|
86
|
+
return new l({
|
|
100
87
|
frame: {
|
|
101
88
|
width: "100vw",
|
|
102
89
|
height: "100vh"
|
|
103
90
|
}
|
|
104
91
|
});
|
|
105
92
|
}
|
|
106
|
-
function
|
|
107
|
-
return new
|
|
93
|
+
function ie() {
|
|
94
|
+
return new l({
|
|
108
95
|
frame: {
|
|
109
96
|
width: c,
|
|
110
97
|
height: c
|
|
111
98
|
}
|
|
112
99
|
});
|
|
113
100
|
}
|
|
114
|
-
function
|
|
115
|
-
return new
|
|
101
|
+
function oe() {
|
|
102
|
+
return new l({
|
|
116
103
|
frame: {
|
|
117
104
|
width: c
|
|
118
105
|
}
|
|
@@ -181,32 +168,32 @@ function L(r) {
|
|
|
181
168
|
return r.replace(/<\?[\s\S]*?\?>/g, "").replace(/<!DOCTYPE[\s\S]*?>/gi, "").replace(/<!ENTITY[\s\S]*?>/gi, "");
|
|
182
169
|
}
|
|
183
170
|
function _(r) {
|
|
184
|
-
const
|
|
185
|
-
return
|
|
171
|
+
const e = r.toLowerCase().replace(/[\u0000-\u0020]+/g, "");
|
|
172
|
+
return e.includes("javascript:") || e.includes("data:");
|
|
186
173
|
}
|
|
187
174
|
function R(r) {
|
|
188
|
-
const
|
|
189
|
-
return /^#[A-Za-z_][\w:.-]*$/.test(
|
|
175
|
+
const e = r.trim();
|
|
176
|
+
return /^#[A-Za-z_][\w:.-]*$/.test(e);
|
|
190
177
|
}
|
|
191
178
|
function P(r) {
|
|
192
179
|
return !!r.trim().match(/^url\((["']?)(#[A-Za-z_][\w:.-]*)\1\)$/);
|
|
193
180
|
}
|
|
194
|
-
function D(r,
|
|
195
|
-
const
|
|
196
|
-
if (A.has(
|
|
197
|
-
return
|
|
181
|
+
function D(r, e) {
|
|
182
|
+
const t = r.toLowerCase();
|
|
183
|
+
if (A.has(t) && !t.startsWith("on") && !_(e))
|
|
184
|
+
return t === "href" || t === "xlink:href" ? R(e) ? e.trim() : void 0 : e.includes("url(") ? P(e) ? e.trim() : void 0 : e;
|
|
198
185
|
}
|
|
199
|
-
function E(r,
|
|
200
|
-
const
|
|
201
|
-
if (v.has(
|
|
186
|
+
function E(r, e) {
|
|
187
|
+
const t = r.tagName.toLowerCase();
|
|
188
|
+
if (v.has(t))
|
|
202
189
|
return [];
|
|
203
|
-
if (!k.has(
|
|
190
|
+
if (!k.has(t)) {
|
|
204
191
|
const i = [];
|
|
205
192
|
for (const o of r.childNodes)
|
|
206
|
-
i.push(...C(o,
|
|
193
|
+
i.push(...C(o, e));
|
|
207
194
|
return i;
|
|
208
195
|
}
|
|
209
|
-
const n =
|
|
196
|
+
const n = e.createElementNS(w, r.tagName);
|
|
210
197
|
for (const i of r.getAttributeNames()) {
|
|
211
198
|
const o = r.getAttribute(i);
|
|
212
199
|
if (o === null) continue;
|
|
@@ -214,16 +201,16 @@ function E(r, t) {
|
|
|
214
201
|
a !== void 0 && n.setAttribute(i, a);
|
|
215
202
|
}
|
|
216
203
|
for (const i of r.childNodes) {
|
|
217
|
-
const o = C(i,
|
|
204
|
+
const o = C(i, e);
|
|
218
205
|
for (const a of o)
|
|
219
206
|
n.appendChild(a);
|
|
220
207
|
}
|
|
221
208
|
return [n];
|
|
222
209
|
}
|
|
223
|
-
function C(r,
|
|
224
|
-
return r.nodeType === Node.ELEMENT_NODE ? E(r,
|
|
210
|
+
function C(r, e) {
|
|
211
|
+
return r.nodeType === Node.ELEMENT_NODE ? E(r, e) : r.nodeType === Node.TEXT_NODE ? [e.createTextNode(r.textContent ?? "")] : [];
|
|
225
212
|
}
|
|
226
|
-
function
|
|
213
|
+
function ae(r) {
|
|
227
214
|
if (typeof r != "string" || r.trim() === "") return "";
|
|
228
215
|
const n = new DOMParser().parseFromString(L(r), "image/svg+xml").documentElement;
|
|
229
216
|
if (!n || n.tagName.toLowerCase() !== "svg") return "";
|
|
@@ -232,25 +219,25 @@ function St(r) {
|
|
|
232
219
|
);
|
|
233
220
|
return !a || a.tagName.toLowerCase() !== "svg" ? "" : (i.replaceChild(a, i.documentElement), new XMLSerializer().serializeToString(i.documentElement));
|
|
234
221
|
}
|
|
235
|
-
const
|
|
236
|
-
function
|
|
222
|
+
const se = Symbol.for("tachui.concat");
|
|
223
|
+
function ce(r) {
|
|
237
224
|
return r && typeof r == "object" && typeof r.isConcatenatable == "function" && r.isConcatenatable();
|
|
238
225
|
}
|
|
239
|
-
function
|
|
226
|
+
function le(r) {
|
|
240
227
|
return r && typeof r == "object" && r.constructor.name === "ConcatenatedComponent";
|
|
241
228
|
}
|
|
242
|
-
const
|
|
243
|
-
class
|
|
229
|
+
const ue = Symbol.for("tachui.concat");
|
|
230
|
+
class me {
|
|
244
231
|
/**
|
|
245
232
|
* Concatenate this component with another concatenatable component
|
|
246
233
|
*/
|
|
247
|
-
concat(
|
|
248
|
-
const
|
|
249
|
-
return
|
|
250
|
-
[
|
|
251
|
-
this.mergeMetadata(
|
|
234
|
+
concat(e) {
|
|
235
|
+
const t = this.toSegment(), n = e.toSegment();
|
|
236
|
+
return e instanceof h ? new h(
|
|
237
|
+
[t, ...e.segments],
|
|
238
|
+
this.mergeMetadata(e.metadata, e.segments.length + 1)
|
|
252
239
|
) : new h(
|
|
253
|
-
[
|
|
240
|
+
[t, n],
|
|
254
241
|
this.createMetadata(2)
|
|
255
242
|
);
|
|
256
243
|
}
|
|
@@ -263,9 +250,9 @@ class Et {
|
|
|
263
250
|
/**
|
|
264
251
|
* Create metadata for a new concatenated component
|
|
265
252
|
*/
|
|
266
|
-
createMetadata(
|
|
253
|
+
createMetadata(e) {
|
|
267
254
|
return {
|
|
268
|
-
totalSegments:
|
|
255
|
+
totalSegments: e,
|
|
269
256
|
accessibilityRole: this.determineAccessibilityRole(),
|
|
270
257
|
semanticStructure: this.determineSemanticStructure()
|
|
271
258
|
};
|
|
@@ -273,45 +260,45 @@ class Et {
|
|
|
273
260
|
/**
|
|
274
261
|
* Merge metadata when concatenating with existing concatenated component
|
|
275
262
|
*/
|
|
276
|
-
mergeMetadata(
|
|
263
|
+
mergeMetadata(e, t) {
|
|
277
264
|
return {
|
|
278
|
-
totalSegments:
|
|
279
|
-
accessibilityRole: this.mergeAccessibilityRoles(
|
|
280
|
-
semanticStructure: this.mergeSemanticStructures(
|
|
265
|
+
totalSegments: t,
|
|
266
|
+
accessibilityRole: this.mergeAccessibilityRoles(e.accessibilityRole),
|
|
267
|
+
semanticStructure: this.mergeSemanticStructures(e.semanticStructure)
|
|
281
268
|
};
|
|
282
269
|
}
|
|
283
270
|
/**
|
|
284
271
|
* Determine the accessibility role for this component
|
|
285
272
|
*/
|
|
286
273
|
determineAccessibilityRole() {
|
|
287
|
-
const
|
|
288
|
-
return
|
|
274
|
+
const e = this.constructor.name;
|
|
275
|
+
return e === "EnhancedText" ? "text" : e === "EnhancedImage" || e === "EnhancedButton" || e === "EnhancedLink" ? "group" : "composite";
|
|
289
276
|
}
|
|
290
277
|
/**
|
|
291
278
|
* Determine the semantic structure for this component
|
|
292
279
|
*/
|
|
293
280
|
determineSemanticStructure() {
|
|
294
|
-
const
|
|
295
|
-
return
|
|
281
|
+
const e = this.constructor.name;
|
|
282
|
+
return e === "EnhancedText" || e === "EnhancedImage" ? "inline" : "mixed";
|
|
296
283
|
}
|
|
297
284
|
/**
|
|
298
285
|
* Merge accessibility roles when combining components
|
|
299
286
|
*/
|
|
300
|
-
mergeAccessibilityRoles(
|
|
301
|
-
const
|
|
302
|
-
return
|
|
287
|
+
mergeAccessibilityRoles(e) {
|
|
288
|
+
const t = this.determineAccessibilityRole();
|
|
289
|
+
return t === "text" && e === "text" ? "text" : t === "composite" || e === "composite" ? "composite" : "group";
|
|
303
290
|
}
|
|
304
291
|
/**
|
|
305
292
|
* Merge semantic structures when combining components
|
|
306
293
|
*/
|
|
307
|
-
mergeSemanticStructures(
|
|
308
|
-
const
|
|
309
|
-
return
|
|
294
|
+
mergeSemanticStructures(e) {
|
|
295
|
+
const t = this.determineSemanticStructure();
|
|
296
|
+
return t === "inline" && e === "inline" ? "inline" : t === "block" && e === "block" ? "block" : "mixed";
|
|
310
297
|
}
|
|
311
298
|
}
|
|
312
|
-
function
|
|
313
|
-
const
|
|
314
|
-
return
|
|
299
|
+
function de(r) {
|
|
300
|
+
const e = r;
|
|
301
|
+
return e.concat = function(t) {
|
|
315
302
|
const n = {
|
|
316
303
|
id: this.id,
|
|
317
304
|
component: this,
|
|
@@ -320,11 +307,11 @@ function zt(r) {
|
|
|
320
307
|
const o = this.render();
|
|
321
308
|
return Array.isArray(o) ? o[0] : o;
|
|
322
309
|
}
|
|
323
|
-
}, i =
|
|
324
|
-
return
|
|
325
|
-
[n, ...
|
|
310
|
+
}, i = t.toSegment();
|
|
311
|
+
return t instanceof h ? new h(
|
|
312
|
+
[n, ...t.segments],
|
|
326
313
|
{
|
|
327
|
-
totalSegments:
|
|
314
|
+
totalSegments: t.segments.length + 1,
|
|
328
315
|
accessibilityRole: "group",
|
|
329
316
|
semanticStructure: "mixed"
|
|
330
317
|
}
|
|
@@ -336,54 +323,54 @@ function zt(r) {
|
|
|
336
323
|
semanticStructure: "mixed"
|
|
337
324
|
}
|
|
338
325
|
);
|
|
339
|
-
},
|
|
326
|
+
}, e.toSegment = function() {
|
|
340
327
|
return {
|
|
341
328
|
id: this.id,
|
|
342
329
|
component: this,
|
|
343
330
|
modifiers: this.modifiers || [],
|
|
344
331
|
render: () => {
|
|
345
|
-
const
|
|
346
|
-
return Array.isArray(
|
|
332
|
+
const t = this.render();
|
|
333
|
+
return Array.isArray(t) ? t[0] : t;
|
|
347
334
|
}
|
|
348
335
|
};
|
|
349
|
-
},
|
|
336
|
+
}, e.isConcatenatable = function() {
|
|
350
337
|
return !0;
|
|
351
|
-
},
|
|
338
|
+
}, e;
|
|
352
339
|
}
|
|
353
|
-
const
|
|
354
|
-
class
|
|
340
|
+
const m = /* @__PURE__ */ new Map(), H = 300 * 1e3, b = 100;
|
|
341
|
+
class fe {
|
|
355
342
|
/**
|
|
356
343
|
* Optimize an array of segments by merging compatible adjacent text segments
|
|
357
344
|
* Enhanced with caching and performance monitoring
|
|
358
345
|
*/
|
|
359
|
-
static optimize(
|
|
360
|
-
const
|
|
361
|
-
if (
|
|
362
|
-
const n = this.generateCacheKey(
|
|
346
|
+
static optimize(e) {
|
|
347
|
+
const t = performance.now();
|
|
348
|
+
if (e.length < 2) return e;
|
|
349
|
+
const n = this.generateCacheKey(e), i = this.getCachedOptimization(n);
|
|
363
350
|
if (i)
|
|
364
351
|
return i.optimizedSegments;
|
|
365
|
-
const o = this.performOptimization(
|
|
366
|
-
...this.getOptimizationStats(
|
|
352
|
+
const o = this.performOptimization(e), a = performance.now() - t, s = {
|
|
353
|
+
...this.getOptimizationStats(e, o),
|
|
367
354
|
processingTimeMs: a
|
|
368
355
|
};
|
|
369
|
-
return this.cacheOptimization(n, o, s), process.env.NODE_ENV === "development" && a > 5 && console.log(`TachUI Concatenation: Optimization took ${a.toFixed(2)}ms for ${
|
|
356
|
+
return this.cacheOptimization(n, o, s), process.env.NODE_ENV === "development" && a > 5 && console.log(`TachUI Concatenation: Optimization took ${a.toFixed(2)}ms for ${e.length} segments`), o;
|
|
370
357
|
}
|
|
371
358
|
/**
|
|
372
359
|
* Core optimization algorithm separated for clarity
|
|
373
360
|
*/
|
|
374
|
-
static performOptimization(
|
|
375
|
-
const
|
|
376
|
-
for (const n of
|
|
377
|
-
const i =
|
|
378
|
-
i && this.canMergeTextSegments(i, n) ?
|
|
361
|
+
static performOptimization(e) {
|
|
362
|
+
const t = [];
|
|
363
|
+
for (const n of e) {
|
|
364
|
+
const i = t[t.length - 1];
|
|
365
|
+
i && this.canMergeTextSegments(i, n) ? t[t.length - 1] = this.mergeTextSegments(i, n) : t.push(n);
|
|
379
366
|
}
|
|
380
|
-
return
|
|
367
|
+
return t;
|
|
381
368
|
}
|
|
382
369
|
/**
|
|
383
370
|
* Generate a cache key from segments
|
|
384
371
|
*/
|
|
385
|
-
static generateCacheKey(
|
|
386
|
-
return
|
|
372
|
+
static generateCacheKey(e) {
|
|
373
|
+
return e.map((n) => {
|
|
387
374
|
const i = n.component, o = this.extractTextContent(i), a = this.hashModifiers(n.modifiers);
|
|
388
375
|
return `${i.constructor.name}:${o}:${a}`;
|
|
389
376
|
}).join("|");
|
|
@@ -391,13 +378,13 @@ class Mt {
|
|
|
391
378
|
/**
|
|
392
379
|
* Hash modifiers for cache key generation
|
|
393
380
|
*/
|
|
394
|
-
static hashModifiers(
|
|
395
|
-
if (
|
|
381
|
+
static hashModifiers(e) {
|
|
382
|
+
if (e.length === 0) return "none";
|
|
396
383
|
try {
|
|
397
|
-
const
|
|
384
|
+
const t = e.map((i) => ({
|
|
398
385
|
type: i.type,
|
|
399
386
|
props: i.properties
|
|
400
|
-
})), n = JSON.stringify(
|
|
387
|
+
})), n = JSON.stringify(t);
|
|
401
388
|
return typeof btoa == "function" ? btoa(n).substring(0, 8) : this.simpleHash(n).toString(16).substring(0, 8);
|
|
402
389
|
} catch {
|
|
403
390
|
return "hash-error";
|
|
@@ -406,31 +393,31 @@ class Mt {
|
|
|
406
393
|
/**
|
|
407
394
|
* Simple hash function fallback for environments without btoa
|
|
408
395
|
*/
|
|
409
|
-
static simpleHash(
|
|
410
|
-
let
|
|
411
|
-
for (let n = 0; n <
|
|
412
|
-
const i =
|
|
413
|
-
|
|
396
|
+
static simpleHash(e) {
|
|
397
|
+
let t = 0;
|
|
398
|
+
for (let n = 0; n < e.length; n++) {
|
|
399
|
+
const i = e.charCodeAt(n);
|
|
400
|
+
t = (t << 5) - t + i, t = t & t;
|
|
414
401
|
}
|
|
415
|
-
return Math.abs(
|
|
402
|
+
return Math.abs(t);
|
|
416
403
|
}
|
|
417
404
|
/**
|
|
418
405
|
* Get cached optimization result
|
|
419
406
|
*/
|
|
420
|
-
static getCachedOptimization(
|
|
421
|
-
const
|
|
422
|
-
return
|
|
407
|
+
static getCachedOptimization(e) {
|
|
408
|
+
const t = m.get(e);
|
|
409
|
+
return t ? Date.now() - t.timestamp > H ? (m.delete(e), null) : t : null;
|
|
423
410
|
}
|
|
424
411
|
/**
|
|
425
412
|
* Cache optimization result
|
|
426
413
|
*/
|
|
427
|
-
static cacheOptimization(
|
|
428
|
-
if (
|
|
429
|
-
const i =
|
|
430
|
-
i &&
|
|
414
|
+
static cacheOptimization(e, t, n) {
|
|
415
|
+
if (m.size >= b) {
|
|
416
|
+
const i = m.keys().next().value;
|
|
417
|
+
i && m.delete(i);
|
|
431
418
|
}
|
|
432
|
-
|
|
433
|
-
optimizedSegments:
|
|
419
|
+
m.set(e, {
|
|
420
|
+
optimizedSegments: t,
|
|
434
421
|
stats: n,
|
|
435
422
|
timestamp: Date.now()
|
|
436
423
|
});
|
|
@@ -439,14 +426,14 @@ class Mt {
|
|
|
439
426
|
* Clear optimization cache (useful for testing)
|
|
440
427
|
*/
|
|
441
428
|
static clearCache() {
|
|
442
|
-
|
|
429
|
+
m.clear();
|
|
443
430
|
}
|
|
444
431
|
/**
|
|
445
432
|
* Get cache statistics
|
|
446
433
|
*/
|
|
447
434
|
static getCacheStats() {
|
|
448
435
|
return {
|
|
449
|
-
size:
|
|
436
|
+
size: m.size,
|
|
450
437
|
maxSize: b,
|
|
451
438
|
hitRate: 0
|
|
452
439
|
// Would need to track hits/misses to calculate this
|
|
@@ -455,26 +442,26 @@ class Mt {
|
|
|
455
442
|
/**
|
|
456
443
|
* Check if two segments can be merged
|
|
457
444
|
*/
|
|
458
|
-
static canMergeTextSegments(
|
|
459
|
-
return
|
|
445
|
+
static canMergeTextSegments(e, t) {
|
|
446
|
+
return e.component.constructor.name !== "EnhancedText" || t.component.constructor.name !== "EnhancedText" ? !1 : this.modifiersCompatible(e.modifiers, t.modifiers);
|
|
460
447
|
}
|
|
461
448
|
/**
|
|
462
449
|
* Check if two modifier arrays are compatible for merging
|
|
463
450
|
*/
|
|
464
|
-
static modifiersCompatible(
|
|
465
|
-
if (
|
|
466
|
-
for (let n = 0; n <
|
|
467
|
-
if (!this.modifierEqual(
|
|
451
|
+
static modifiersCompatible(e, t) {
|
|
452
|
+
if (e.length !== t.length) return !1;
|
|
453
|
+
for (let n = 0; n < e.length; n++)
|
|
454
|
+
if (!this.modifierEqual(e[n], t[n]))
|
|
468
455
|
return !1;
|
|
469
456
|
return !0;
|
|
470
457
|
}
|
|
471
458
|
/**
|
|
472
459
|
* Check if two modifiers are equal (simplified comparison)
|
|
473
460
|
*/
|
|
474
|
-
static modifierEqual(
|
|
475
|
-
if (
|
|
461
|
+
static modifierEqual(e, t) {
|
|
462
|
+
if (e.type !== t.type) return !1;
|
|
476
463
|
try {
|
|
477
|
-
return JSON.stringify(
|
|
464
|
+
return JSON.stringify(e.properties) === JSON.stringify(t.properties);
|
|
478
465
|
} catch {
|
|
479
466
|
return !1;
|
|
480
467
|
}
|
|
@@ -482,30 +469,30 @@ class Mt {
|
|
|
482
469
|
/**
|
|
483
470
|
* Merge two text segments into a single segment
|
|
484
471
|
*/
|
|
485
|
-
static mergeTextSegments(
|
|
486
|
-
const n =
|
|
472
|
+
static mergeTextSegments(e, t) {
|
|
473
|
+
const n = e.component, i = t.component, o = this.extractTextContent(n), a = this.extractTextContent(i), s = o + a;
|
|
487
474
|
return {
|
|
488
|
-
id: `merged-${
|
|
489
|
-
component: this.createMergedTextComponent(s, n.props,
|
|
490
|
-
modifiers:
|
|
475
|
+
id: `merged-${e.id}-${t.id}`,
|
|
476
|
+
component: this.createMergedTextComponent(s, n.props, e.modifiers),
|
|
477
|
+
modifiers: e.modifiers,
|
|
491
478
|
// Use modifiers from first segment (they're identical)
|
|
492
|
-
render: () => this.createMergedTextComponent(s, n.props,
|
|
479
|
+
render: () => this.createMergedTextComponent(s, n.props, e.modifiers).render()[0]
|
|
493
480
|
};
|
|
494
481
|
}
|
|
495
482
|
/**
|
|
496
483
|
* Extract text content from a text component
|
|
497
484
|
*/
|
|
498
|
-
static extractTextContent(
|
|
499
|
-
const
|
|
500
|
-
return typeof
|
|
485
|
+
static extractTextContent(e) {
|
|
486
|
+
const t = e.props?.content;
|
|
487
|
+
return typeof t == "string" ? t : typeof t == "function" ? t() : t && typeof t == "object" && "peek" in t && t.peek() || "";
|
|
501
488
|
}
|
|
502
489
|
/**
|
|
503
490
|
* Create a new merged text component
|
|
504
491
|
*/
|
|
505
|
-
static createMergedTextComponent(
|
|
492
|
+
static createMergedTextComponent(e, t, n) {
|
|
506
493
|
const i = {
|
|
507
|
-
...
|
|
508
|
-
content:
|
|
494
|
+
...t,
|
|
495
|
+
content: e
|
|
509
496
|
};
|
|
510
497
|
return {
|
|
511
498
|
type: "Text",
|
|
@@ -515,7 +502,7 @@ class Mt {
|
|
|
515
502
|
cleanup: [],
|
|
516
503
|
modifiers: n,
|
|
517
504
|
render() {
|
|
518
|
-
const o = z(
|
|
505
|
+
const o = z(e);
|
|
519
506
|
return [M("span", {}, o)];
|
|
520
507
|
}
|
|
521
508
|
};
|
|
@@ -523,23 +510,23 @@ class Mt {
|
|
|
523
510
|
/**
|
|
524
511
|
* Analyze segments and determine if optimization would be beneficial
|
|
525
512
|
*/
|
|
526
|
-
static shouldOptimize(
|
|
527
|
-
if (
|
|
528
|
-
let
|
|
529
|
-
for (let n = 0; n <
|
|
530
|
-
const i =
|
|
531
|
-
i.component.constructor.name === "EnhancedText" && o.component.constructor.name === "EnhancedText" &&
|
|
513
|
+
static shouldOptimize(e) {
|
|
514
|
+
if (e.length < 2) return !1;
|
|
515
|
+
let t = 0;
|
|
516
|
+
for (let n = 0; n < e.length - 1; n++) {
|
|
517
|
+
const i = e[n], o = e[n + 1];
|
|
518
|
+
i.component.constructor.name === "EnhancedText" && o.component.constructor.name === "EnhancedText" && t++;
|
|
532
519
|
}
|
|
533
|
-
return
|
|
520
|
+
return t > 0;
|
|
534
521
|
}
|
|
535
522
|
/**
|
|
536
523
|
* Get optimization statistics (enhanced for Phase 4.1)
|
|
537
524
|
*/
|
|
538
|
-
static getOptimizationStats(
|
|
539
|
-
const n =
|
|
525
|
+
static getOptimizationStats(e, t) {
|
|
526
|
+
const n = e.length - t.length, i = e.length > 0 ? Math.round(n / e.length * 100) : 0;
|
|
540
527
|
return {
|
|
541
|
-
originalCount:
|
|
542
|
-
optimizedCount:
|
|
528
|
+
originalCount: e.length,
|
|
529
|
+
optimizedCount: t.length,
|
|
543
530
|
reductionPercent: i,
|
|
544
531
|
textSegmentsMerged: n
|
|
545
532
|
};
|
|
@@ -547,15 +534,15 @@ class Mt {
|
|
|
547
534
|
/**
|
|
548
535
|
* Advanced optimization analysis for performance monitoring
|
|
549
536
|
*/
|
|
550
|
-
static analyzeOptimizationOpportunities(
|
|
551
|
-
let
|
|
552
|
-
for (let s = 0; s <
|
|
553
|
-
const
|
|
554
|
-
switch (
|
|
537
|
+
static analyzeOptimizationOpportunities(e) {
|
|
538
|
+
let t = 0, n = 0, i = 0, o = 0;
|
|
539
|
+
for (let s = 0; s < e.length; s++) {
|
|
540
|
+
const u = e[s];
|
|
541
|
+
switch (u.component.constructor.name) {
|
|
555
542
|
case "EnhancedText":
|
|
556
|
-
if (
|
|
557
|
-
const
|
|
558
|
-
this.canMergeTextSegments(
|
|
543
|
+
if (t++, s < e.length - 1) {
|
|
544
|
+
const p = e[s + 1];
|
|
545
|
+
this.canMergeTextSegments(u, p) && o++;
|
|
559
546
|
}
|
|
560
547
|
break;
|
|
561
548
|
case "EnhancedImage":
|
|
@@ -567,10 +554,10 @@ class Mt {
|
|
|
567
554
|
break;
|
|
568
555
|
}
|
|
569
556
|
}
|
|
570
|
-
const a =
|
|
557
|
+
const a = e.length > 0 ? Math.round(o / e.length * 100) : 0;
|
|
571
558
|
return {
|
|
572
|
-
totalSegments:
|
|
573
|
-
textSegments:
|
|
559
|
+
totalSegments: e.length,
|
|
560
|
+
textSegments: t,
|
|
574
561
|
imageSegments: n,
|
|
575
562
|
interactiveSegments: i,
|
|
576
563
|
optimizableTextPairs: o,
|
|
@@ -578,11 +565,11 @@ class Mt {
|
|
|
578
565
|
};
|
|
579
566
|
}
|
|
580
567
|
}
|
|
581
|
-
function S(r,
|
|
582
|
-
const { fallback:
|
|
583
|
-
let a = !1, s = null,
|
|
568
|
+
function S(r, e = {}) {
|
|
569
|
+
const { fallback: t, errorFallback: n, timeout: i = 1e4, preload: o = "never" } = e;
|
|
570
|
+
let a = !1, s = null, u = !1, f = null, p = null;
|
|
584
571
|
const y = async () => {
|
|
585
|
-
a ||
|
|
572
|
+
a || u || s || p || (a = !0, u = !0, f = null, p = (async () => {
|
|
586
573
|
try {
|
|
587
574
|
const d = await Promise.race([
|
|
588
575
|
r(),
|
|
@@ -593,11 +580,11 @@ function S(r, t = {}) {
|
|
|
593
580
|
s = "default" in d ? d.default : d;
|
|
594
581
|
} catch (d) {
|
|
595
582
|
const g = d;
|
|
596
|
-
(typeof process > "u" || process.env.NODE_ENV !== "test") && console.error("Failed to load lazy component:", g),
|
|
583
|
+
(typeof process > "u" || process.env.NODE_ENV !== "test") && console.error("Failed to load lazy component:", g), f = g;
|
|
597
584
|
} finally {
|
|
598
|
-
|
|
585
|
+
u = !1, p = null;
|
|
599
586
|
}
|
|
600
|
-
})(), await
|
|
587
|
+
})(), await p);
|
|
601
588
|
};
|
|
602
589
|
return o === "idle" && typeof requestIdleCallback < "u" ? requestIdleCallback(() => {
|
|
603
590
|
y().catch(() => {
|
|
@@ -607,11 +594,11 @@ function S(r, t = {}) {
|
|
|
607
594
|
});
|
|
608
595
|
}, 100) : o === "immediate" && y().catch(() => {
|
|
609
596
|
}), (d) => {
|
|
610
|
-
if (!a && !
|
|
611
|
-
}),
|
|
612
|
-
return n ? n(
|
|
613
|
-
if (
|
|
614
|
-
return
|
|
597
|
+
if (!a && !u && !s && y().catch(() => {
|
|
598
|
+
}), f)
|
|
599
|
+
return n ? n(f) : T(f);
|
|
600
|
+
if (u || !s)
|
|
601
|
+
return t || j();
|
|
615
602
|
try {
|
|
616
603
|
return typeof s == "function" ? s(d) : s;
|
|
617
604
|
} catch (g) {
|
|
@@ -620,7 +607,7 @@ function S(r, t = {}) {
|
|
|
620
607
|
}
|
|
621
608
|
};
|
|
622
609
|
}
|
|
623
|
-
function
|
|
610
|
+
function pe(r) {
|
|
624
611
|
return {
|
|
625
612
|
type: "component",
|
|
626
613
|
render: () => ({
|
|
@@ -638,21 +625,21 @@ function Ot(r) {
|
|
|
638
625
|
};
|
|
639
626
|
}
|
|
640
627
|
function $(r) {
|
|
641
|
-
return r().then((
|
|
628
|
+
return r().then((e) => e && typeof e == "object" && "default" in e ? e.default : e);
|
|
642
629
|
}
|
|
643
|
-
function
|
|
644
|
-
const
|
|
630
|
+
function he(r, e = {}) {
|
|
631
|
+
const t = {};
|
|
645
632
|
for (const [n, i] of Object.entries(r))
|
|
646
|
-
|
|
647
|
-
return
|
|
633
|
+
t[n] = S(i, e);
|
|
634
|
+
return t;
|
|
648
635
|
}
|
|
649
|
-
function
|
|
650
|
-
const
|
|
651
|
-
async ([
|
|
636
|
+
function ge(r) {
|
|
637
|
+
const e = Object.entries(r).map(
|
|
638
|
+
async ([t, n]) => [t, await $(n)]
|
|
652
639
|
);
|
|
653
|
-
return Promise.all(
|
|
640
|
+
return Promise.all(e).then((t) => {
|
|
654
641
|
const n = {};
|
|
655
|
-
for (const [i, o] of
|
|
642
|
+
for (const [i, o] of t)
|
|
656
643
|
n[i] = o;
|
|
657
644
|
return n;
|
|
658
645
|
});
|
|
@@ -689,8 +676,8 @@ function T(r) {
|
|
|
689
676
|
]
|
|
690
677
|
};
|
|
691
678
|
}
|
|
692
|
-
function
|
|
693
|
-
const { rootMargin:
|
|
679
|
+
function ye(r, e = {}) {
|
|
680
|
+
const { rootMargin: t = "50px", threshold: n = 0.1, ...i } = e;
|
|
694
681
|
return i.preload === "visible" && typeof IntersectionObserver < "u" ? (o) => {
|
|
695
682
|
const a = S(r, { ...i, preload: "never" });
|
|
696
683
|
return setTimeout(() => {
|
|
@@ -698,36 +685,36 @@ function vt(r, t = {}) {
|
|
|
698
685
|
}, 100), a(o);
|
|
699
686
|
} : S(r, i);
|
|
700
687
|
}
|
|
701
|
-
const
|
|
688
|
+
const xe = Object.freeze({
|
|
702
689
|
configure: N,
|
|
703
690
|
getFeatureFlags: O
|
|
704
691
|
});
|
|
705
692
|
export {
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
693
|
+
se as C,
|
|
694
|
+
pe as S,
|
|
695
|
+
fe as T,
|
|
696
|
+
le as a,
|
|
697
|
+
me as b,
|
|
698
|
+
ue as c,
|
|
699
|
+
J as d,
|
|
700
|
+
K as e,
|
|
701
|
+
X as f,
|
|
702
|
+
Y as g,
|
|
703
|
+
Z as h,
|
|
704
|
+
ce as i,
|
|
705
|
+
Q as j,
|
|
706
|
+
ee as k,
|
|
707
|
+
ne as l,
|
|
708
|
+
de as m,
|
|
709
|
+
re as n,
|
|
710
|
+
ie as o,
|
|
711
|
+
oe as p,
|
|
712
|
+
he as q,
|
|
713
|
+
te as r,
|
|
714
|
+
ae as s,
|
|
715
|
+
xe as t,
|
|
716
|
+
ye as u,
|
|
730
717
|
S as v,
|
|
731
718
|
$ as w,
|
|
732
|
-
|
|
719
|
+
ge as x
|
|
733
720
|
};
|