@tachui/core 0.8.1-alpha → 0.8.8

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.
Files changed (163) hide show
  1. package/README.md +41 -3
  2. package/dist/assets/AssetCollection.d.ts.map +1 -1
  3. package/dist/assets/ColorAsset.d.ts.map +1 -1
  4. package/dist/assets/index.d.ts +1 -0
  5. package/dist/assets/index.d.ts.map +1 -1
  6. package/dist/assets/index.js +486 -0
  7. package/dist/assets/types.d.ts +8 -68
  8. package/dist/assets/types.d.ts.map +1 -1
  9. package/dist/binding-DCV5PKkK.js +308 -0
  10. package/dist/build-plugins/index.d.ts +3 -0
  11. package/dist/build-plugins/index.d.ts.map +1 -0
  12. package/dist/build-plugins/modifier-types.d.ts +12 -0
  13. package/dist/build-plugins/modifier-types.d.ts.map +1 -0
  14. package/dist/build-tools/typegen-runner.d.ts +29 -0
  15. package/dist/build-tools/typegen-runner.d.ts.map +1 -0
  16. package/dist/bundles/minimal.d.ts +2 -0
  17. package/dist/bundles/minimal.d.ts.map +1 -1
  18. package/dist/common.js +427 -394
  19. package/dist/{component-XAzF1xqs.js → component-D-O9yq0P.js} +80 -68
  20. package/dist/{component-base-x2XmHFjy.js → component-base-C41K3NTe.js} +9 -7
  21. package/dist/component-context-B9HI2nZH.js +176 -0
  22. package/dist/components/factory.d.ts +24 -0
  23. package/dist/components/factory.d.ts.map +1 -0
  24. package/dist/components/index.d.ts +3 -2
  25. package/dist/components/index.d.ts.map +1 -1
  26. package/dist/components/index.js +8 -6
  27. package/dist/components/wrapper.d.ts +70 -30
  28. package/dist/components/wrapper.d.ts.map +1 -1
  29. package/dist/concatenated-component-CP81AwgI.js +2288 -0
  30. package/dist/concatenation/concatenated-component.d.ts +16 -2
  31. package/dist/concatenation/concatenated-component.d.ts.map +1 -1
  32. package/dist/concatenation/text-optimizer.d.ts.map +1 -1
  33. package/dist/config.d.ts +7 -0
  34. package/dist/config.d.ts.map +1 -0
  35. package/dist/constants/layout.d.ts +2 -9
  36. package/dist/constants/layout.d.ts.map +1 -1
  37. package/dist/css-classes/index.js +15 -173
  38. package/dist/{effect-B9Knft0b.js → effect-BsW3fy1q.js} +3 -3
  39. package/dist/enhanced-renderer-BXwg8n7F.js +172 -0
  40. package/dist/essential.js +427 -394
  41. package/dist/{index-DIvMCJQO.js → factories-B3-rmvkB.js} +13 -13
  42. package/dist/factory-BgnjJRGE.js +485 -0
  43. package/dist/gradients/css-generator.js +99 -0
  44. package/dist/gradients/index.js +56 -0
  45. package/dist/gradients/reactive.d.ts.map +1 -1
  46. package/dist/gradients/types.d.ts +3 -91
  47. package/dist/gradients/types.d.ts.map +1 -1
  48. package/dist/hooks-WGmpzYgD.js +446 -0
  49. package/dist/index-JQ1sW1SK.js +2049 -0
  50. package/dist/index-ykdS-3xs.js +618 -0
  51. package/dist/index.d.ts +8 -1
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +427 -394
  54. package/dist/minimal-prod.js +100 -98
  55. package/dist/minimal.js +116 -109
  56. package/dist/modifiers/alignment.d.ts +5 -0
  57. package/dist/modifiers/alignment.d.ts.map +1 -0
  58. package/dist/modifiers/base.d.ts +7 -7
  59. package/dist/modifiers/base.d.ts.map +1 -1
  60. package/dist/modifiers/base.js +220 -92
  61. package/dist/modifiers/builder.d.ts +28 -165
  62. package/dist/modifiers/builder.d.ts.map +1 -1
  63. package/dist/modifiers/builder.js +7 -7
  64. package/dist/modifiers/core.d.ts +0 -1
  65. package/dist/modifiers/core.d.ts.map +1 -1
  66. package/dist/modifiers/corner-radius.d.ts +8 -0
  67. package/dist/modifiers/corner-radius.d.ts.map +1 -0
  68. package/dist/modifiers/index.d.ts +9 -6
  69. package/dist/modifiers/index.d.ts.map +1 -1
  70. package/dist/modifiers/index.js +36 -30
  71. package/dist/modifiers/layout-priority.d.ts +8 -0
  72. package/dist/modifiers/layout-priority.d.ts.map +1 -0
  73. package/dist/modifiers/opacity.d.ts +8 -0
  74. package/dist/modifiers/opacity.d.ts.map +1 -0
  75. package/dist/modifiers/presets.d.ts.map +1 -1
  76. package/dist/modifiers/proxy.d.ts +4 -0
  77. package/dist/modifiers/proxy.d.ts.map +1 -0
  78. package/dist/modifiers/reactive-style-bindings.d.ts +22 -0
  79. package/dist/modifiers/reactive-style-bindings.d.ts.map +1 -0
  80. package/dist/modifiers/registration-utils.d.ts +7 -0
  81. package/dist/modifiers/registration-utils.d.ts.map +1 -0
  82. package/dist/modifiers/registry.d.ts +18 -9
  83. package/dist/modifiers/registry.d.ts.map +1 -1
  84. package/dist/modifiers/registry.js +2 -2
  85. package/dist/modifiers/type-generator.d.ts +82 -0
  86. package/dist/modifiers/type-generator.d.ts.map +1 -0
  87. package/dist/modifiers/types.d.ts +2 -479
  88. package/dist/modifiers/types.d.ts.map +1 -1
  89. package/dist/modifiers/types.js +1 -4
  90. package/dist/{observed-object-Cos-FtjP.js → observed-object-p1CLdrFm.js} +3 -3
  91. package/dist/optimization-CbKNA9w4.js +21 -0
  92. package/dist/plugins/index.js +28 -8
  93. package/dist/plugins/simplified-lazy-loader.d.ts.map +1 -1
  94. package/dist/presets-B9x94uRn.js +381 -0
  95. package/dist/proxy-522Jjabr.js +188 -0
  96. package/dist/reactive/cleanup.d.ts.map +1 -1
  97. package/dist/reactive/computed.d.ts +4 -1
  98. package/dist/reactive/computed.d.ts.map +1 -1
  99. package/dist/reactive/context.d.ts +4 -3
  100. package/dist/reactive/context.d.ts.map +1 -1
  101. package/dist/reactive/index.d.ts +1 -0
  102. package/dist/reactive/index.d.ts.map +1 -1
  103. package/dist/reactive/index.js +84 -490
  104. package/dist/reactive/signal-list.d.ts +100 -0
  105. package/dist/reactive/signal-list.d.ts.map +1 -0
  106. package/dist/reactive/signal.d.ts.map +1 -1
  107. package/dist/reactive/types.d.ts +2 -89
  108. package/dist/reactive/types.d.ts.map +1 -1
  109. package/dist/reactive/types.js +1 -4
  110. package/dist/registration-utils-CNsN4eoU.js +27 -0
  111. package/dist/runtime/component.d.ts.map +1 -1
  112. package/dist/runtime/concatenation-aria.d.ts.map +1 -1
  113. package/dist/runtime/concatenation-aria.js +18 -13
  114. package/dist/runtime/concatenation-full.d.ts.map +1 -1
  115. package/dist/runtime/concatenation-full.js +42 -34
  116. package/dist/runtime/concatenation-minimal.d.ts.map +1 -1
  117. package/dist/runtime/concatenation-minimal.js +13 -8
  118. package/dist/runtime/context.d.ts.map +1 -1
  119. package/dist/runtime/dom-bridge.d.ts +1 -1
  120. package/dist/runtime/dom-bridge.d.ts.map +1 -1
  121. package/dist/runtime/dom-bridge.js +239 -12
  122. package/dist/runtime/event-delegation.d.ts +59 -0
  123. package/dist/runtime/event-delegation.d.ts.map +1 -0
  124. package/dist/runtime/index.d.ts +3 -1
  125. package/dist/runtime/index.d.ts.map +1 -1
  126. package/dist/runtime/index.js +96 -0
  127. package/dist/runtime/layout-scheduler.d.ts +89 -0
  128. package/dist/runtime/layout-scheduler.d.ts.map +1 -0
  129. package/dist/runtime/props.d.ts.map +1 -1
  130. package/dist/runtime/renderer.d.ts +54 -2
  131. package/dist/runtime/renderer.d.ts.map +1 -1
  132. package/dist/runtime/renderer.js +11 -7
  133. package/dist/runtime/semantic-role-manager.d.ts.map +1 -1
  134. package/dist/runtime/types.d.ts +2 -226
  135. package/dist/runtime/types.d.ts.map +1 -1
  136. package/dist/runtime/types.js +1 -1
  137. package/dist/scheduler-DppMK9mR.js +169 -0
  138. package/dist/signal-list-07gNXGiW.js +525 -0
  139. package/dist/state/index.js +319 -0
  140. package/dist/theme-CRLPHryV.js +687 -0
  141. package/dist/utils/clone-helpers.d.ts +11 -0
  142. package/dist/utils/clone-helpers.d.ts.map +1 -0
  143. package/dist/validation/index.js +28 -26
  144. package/dist/version.d.ts +19 -0
  145. package/dist/version.d.ts.map +1 -0
  146. package/dist/version.js +6 -0
  147. package/package.json +52 -11
  148. package/dist/concatenated-component-ByPl3_FF.js +0 -2933
  149. package/dist/dom-bridge-CAa1N2zX.js +0 -406
  150. package/dist/index-DEBd8cq7.js +0 -1144
  151. package/dist/index-vdsiw6gQ.js +0 -777
  152. package/dist/modifiers/as-html-validator.d.ts +0 -20
  153. package/dist/modifiers/as-html-validator.d.ts.map +0 -1
  154. package/dist/modifiers/as-html.d.ts +0 -65
  155. package/dist/modifiers/as-html.d.ts.map +0 -1
  156. package/dist/modifiers/background.d.ts +0 -51
  157. package/dist/modifiers/background.d.ts.map +0 -1
  158. package/dist/modifiers/basic-sanitizer.d.ts +0 -54
  159. package/dist/modifiers/basic-sanitizer.d.ts.map +0 -1
  160. package/dist/modifiers/css.d.ts +0 -86
  161. package/dist/modifiers/css.d.ts.map +0 -1
  162. package/dist/production-minimal-BY_gMc-l.js +0 -2532
  163. package/dist/scheduler-BKeqwrYE.js +0 -814
@@ -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
- };