@tachui/data 0.8.22 → 0.8.24

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 (2) hide show
  1. package/dist/List.js +356 -3830
  2. package/package.json +6 -5
package/dist/List.js CHANGED
@@ -1,3490 +1,26 @@
1
- var Pe = Object.defineProperty;
2
- var Oe = (n, e, t) => e in n ? Pe(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var m = (n, e, t) => Oe(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { withModifiers as pe, ComponentWithCSSClasses as Le, processElementOverride as ke, h as S, text as De, clonePropsPreservingReactivity as me, resetLifecycleState as ge, createSignal as N, isSignal as w, createEffect as R } from "@tachui/core";
1
+ var x = Object.defineProperty;
2
+ var R = (c, t, e) => t in c ? x(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e;
3
+ var u = (c, t, e) => R(c, typeof t != "symbol" ? t + "" : t, e);
4
+ import { withModifiers as T, createSignal as y, isSignal as S, createEffect as v, h as m } from "@tachui/core";
5
5
  import "@tachui/core/reactive";
6
6
  import "@tachui/modifiers";
7
- const y = {
8
- Clean: 0,
9
- Check: 1,
10
- Dirty: 2,
11
- Disposed: 3
12
- };
13
- var ze = Object.defineProperty, _e = (n, e, t) => e in n ? ze(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, P = (n, e, t) => _e(n, typeof e != "symbol" ? e + "" : e, t);
14
- let He = 0;
15
- const Ve = Math.random().toString(36).substr(2, 6);
16
- let ye = null, ve = null;
17
- const je = /* @__PURE__ */ new Set();
18
- je.add(Ve);
19
- const q = {
20
- get currentComputation() {
21
- return ye;
22
- },
23
- set currentComputation(n) {
24
- ye = n;
25
- },
26
- get currentOwner() {
27
- return ve;
28
- },
29
- set currentOwner(n) {
30
- ve = n;
31
- }
32
- };
33
- function Ce() {
34
- return q.currentComputation;
35
- }
36
- function Ee() {
37
- return q.currentOwner;
38
- }
39
- class Ae {
40
- constructor(e, t = null) {
41
- P(this, "id"), P(this, "owner"), P(this, "fn"), P(this, "sources", /* @__PURE__ */ new Set()), P(this, "observers", /* @__PURE__ */ new Set()), P(this, "state", y.Dirty), P(this, "value"), this.id = ++He, this.fn = e, this.owner = t, t && !t.disposed && t.sources.add(this);
42
- }
43
- execute() {
44
- if (this.state === y.Disposed)
45
- return this.value;
46
- for (const t of this.sources)
47
- t && typeof t == "object" && "removeObserver" in t && t.removeObserver(this);
48
- this.sources.clear();
49
- const e = q.currentComputation;
50
- q.currentComputation = this;
51
- try {
52
- return this.state = y.Clean, this.value = this.fn(), this.value;
53
- } catch (t) {
54
- throw this.state = y.Disposed, (typeof process > "u" || process.env.NODE_ENV !== "test") && console.error("Error in computation:", t), t;
55
- } finally {
56
- q.currentComputation = e;
57
- }
58
- }
59
- dispose() {
60
- if (this.state !== y.Disposed) {
61
- this.state = y.Disposed;
62
- for (const e of this.sources)
63
- e && typeof e == "object" && "removeObserver" in e && e.removeObserver(this);
64
- this.sources.clear();
65
- for (const e of this.observers)
66
- e.sources.delete(this);
67
- this.observers.clear(), this.owner && !this.owner.disposed && this.owner.sources.delete(this);
68
- }
69
- }
70
- }
71
- var Fe = Object.defineProperty, Be = (n, e, t) => e in n ? Fe(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, ie = (n, e, t) => Be(n, typeof e != "symbol" ? e + "" : e, t);
72
- let We = 0, Ue = class {
73
- constructor(e) {
74
- ie(this, "id"), ie(this, "observers", /* @__PURE__ */ new Set()), ie(this, "_value"), this.id = ++We, this._value = e;
75
- }
76
- /**
77
- * Get the current value and track dependency
78
- */
79
- getValue() {
80
- const e = Ce();
81
- return e && e.state !== y.Disposed && (this.observers.add(e), e.sources.add(this)), this._value;
82
- }
83
- /**
84
- * Get the current value without tracking dependency
85
- */
86
- peek() {
87
- return this._value;
88
- }
89
- /**
90
- * Set a new value and notify observers
91
- */
92
- set(e) {
93
- const t = typeof e == "function" ? e(this._value) : e;
94
- return t !== this._value && (this._value = t, this.notify()), t;
95
- }
96
- /**
97
- * Notify all observers that this signal has changed
98
- */
99
- notify() {
100
- for (const e of this.observers)
101
- e.state !== y.Disposed && (e.state = y.Dirty, Qe(e));
102
- }
103
- /**
104
- * Remove an observer (cleanup)
105
- */
106
- removeObserver(e) {
107
- this.observers.delete(e);
108
- }
109
- /**
110
- * Get debug information about this signal
111
- */
112
- [Symbol.for("tachui.debug")]() {
113
- return {
114
- id: this.id,
115
- value: this._value,
116
- observerCount: this.observers.size,
117
- type: "Signal"
118
- };
119
- }
120
- };
121
- const X = /* @__PURE__ */ new Set();
122
- let J = !1;
123
- function Qe(n) {
124
- X.add(n), !J && queueMicrotask(qe);
125
- }
126
- function qe() {
127
- if (!J) {
128
- J = !0;
129
- try {
130
- for (; X.size > 0; ) {
131
- const n = Array.from(X).sort((e, t) => e.id - t.id);
132
- X.clear();
133
- for (const e of n)
134
- e.state === y.Dirty && e.execute();
135
- }
136
- } finally {
137
- J = !1;
138
- }
139
- }
140
- }
141
- function he(n) {
142
- const e = new Ue(n), t = e.getValue.bind(e);
143
- t.peek = e.peek.bind(e);
144
- const s = e.set.bind(e);
145
- return Object.defineProperty(t, Symbol.for("tachui.signal"), {
146
- value: e,
147
- enumerable: !1
148
- }), [t, s];
149
- }
150
- function F(n) {
151
- return typeof n == "function" && Symbol.for("tachui.signal") in n;
152
- }
153
- const Ge = (n, e) => n === e;
154
- var Ke = Object.defineProperty, Ye = (n, e, t) => e in n ? Ke(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, A = (n, e, t) => Ye(n, typeof e != "symbol" ? e + "" : e, t), G = /* @__PURE__ */ ((n) => (n[n.Immediate = 0] = "Immediate", n[n.High = 1] = "High", n[n.Normal = 2] = "Normal", n[n.Low = 3] = "Low", n[n.Idle = 4] = "Idle", n))(G || {});
155
- let Ze = class extends Error {
156
- constructor(e, t, s) {
157
- super(e), this.cause = t, this.node = s, this.name = "ReactiveError";
158
- }
159
- };
160
- const Xe = class _ {
161
- constructor() {
162
- A(this, "updateQueues", /* @__PURE__ */ new Map()), A(this, "isFlushPending", !1), A(this, "isDestroyed", !1), A(this, "errorHandlers", /* @__PURE__ */ new Set()), A(this, "maxRetries", 3), A(this, "totalUpdateCycles", 0), A(this, "totalUpdateTime", 0), A(this, "errorCount", 0), A(this, "nodeRegistry", /* @__PURE__ */ new WeakSet());
163
- for (const e of Object.values(G))
164
- typeof e == "number" && this.updateQueues.set(e, /* @__PURE__ */ new Set());
165
- }
166
- static getInstance() {
167
- return _.instance || (_.instance = new _()), _.instance;
168
- }
169
- /**
170
- * Schedule reactive node for update
171
- */
172
- schedule(e) {
173
- this.isDestroyed || (this.nodeRegistry.add(e), this.getQueue(e.priority).add(e), this.isFlushPending || (this.isFlushPending = !0, this.scheduleFlush(e.priority)));
174
- }
175
- /**
176
- * Process all queued updates by priority
177
- */
178
- async flush() {
179
- if (this.isDestroyed) return;
180
- this.isFlushPending = !1;
181
- const e = performance.now();
182
- try {
183
- for (const t of [
184
- 0,
185
- 1,
186
- 2,
187
- 3,
188
- 4
189
- /* Idle */
190
- ]) {
191
- const s = this.updateQueues.get(t);
192
- if (!s || s.size === 0) continue;
193
- const r = Array.from(s);
194
- s.clear();
195
- for (const i of r)
196
- try {
197
- await this.updateNodeWithRetry(i);
198
- } catch (o) {
199
- this.handleReactiveError(
200
- new Ze(`Failed to update ${i.type} node ${i.id}`, o, i)
201
- );
202
- }
203
- if (this.hasHigherPriorityWork(t))
204
- return this.flush();
205
- }
206
- this.totalUpdateCycles++;
207
- } finally {
208
- const t = performance.now();
209
- this.totalUpdateTime += t - e;
210
- }
211
- }
212
- /**
213
- * Update node with retry logic
214
- */
215
- async updateNodeWithRetry(e, t = 1) {
216
- try {
217
- e.notify();
218
- } catch (s) {
219
- if (t < this.maxRetries)
220
- return console.warn(`Reactive update failed, retrying (${t}/${this.maxRetries})`), await new Promise((r) => setTimeout(r, t * 10)), this.updateNodeWithRetry(e, t + 1);
221
- throw s;
222
- }
223
- }
224
- /**
225
- * Schedule flush based on priority
226
- */
227
- scheduleFlush(e) {
228
- switch (e) {
229
- case 0:
230
- this.flush();
231
- break;
232
- case 1:
233
- queueMicrotask(() => this.flush());
234
- break;
235
- case 2:
236
- typeof requestAnimationFrame < "u" ? requestAnimationFrame(() => this.flush()) : queueMicrotask(() => this.flush());
237
- break;
238
- case 3:
239
- case 4:
240
- typeof requestIdleCallback < "u" ? requestIdleCallback(() => this.flush(), { timeout: 1e3 }) : setTimeout(() => this.flush(), 50);
241
- break;
242
- }
243
- }
244
- /**
245
- * Check if there's higher priority work waiting
246
- */
247
- hasHigherPriorityWork(e) {
248
- for (let t = 0; t < e; t++) {
249
- const s = this.updateQueues.get(t);
250
- if (s && s.size > 0)
251
- return !0;
252
- }
253
- return !1;
254
- }
255
- /**
256
- * Get queue for priority level
257
- */
258
- getQueue(e) {
259
- const t = this.updateQueues.get(e);
260
- if (!t)
261
- throw new Error(`Invalid priority level: ${e}`);
262
- return t;
263
- }
264
- /**
265
- * Register error handler
266
- */
267
- onError(e) {
268
- return this.errorHandlers.add(e), () => this.errorHandlers.delete(e);
269
- }
270
- /**
271
- * Handle reactive errors with recovery
272
- */
273
- handleReactiveError(e) {
274
- this.errorCount++;
275
- let t = !1;
276
- for (const s of this.errorHandlers)
277
- try {
278
- s(e), t = !0;
279
- } catch (r) {
280
- console.error("Error handler threw error:", r);
281
- }
282
- if (!t && (console.error("Unhandled reactive error:", e), process.env.NODE_ENV === "development"))
283
- throw e;
284
- }
285
- /**
286
- * Get performance metrics
287
- */
288
- getPerformanceMetrics() {
289
- let e = 0;
290
- for (const t of this.updateQueues.values())
291
- e += t.size;
292
- return {
293
- totalNodes: e,
294
- updateCycles: this.totalUpdateCycles,
295
- averageUpdateTime: this.totalUpdateCycles > 0 ? this.totalUpdateTime / this.totalUpdateCycles : 0,
296
- memoryUsage: this.estimateMemoryUsage(),
297
- errorCount: this.errorCount
298
- };
299
- }
300
- /**
301
- * Estimate memory usage (rough approximation)
302
- */
303
- estimateMemoryUsage() {
304
- let e = 0;
305
- for (const t of this.updateQueues.values())
306
- e += t.size * 50;
307
- return e += this.errorHandlers.size * 100, e;
308
- }
309
- /**
310
- * Check if node is scheduled
311
- */
312
- hasNode(e) {
313
- for (const t of this.updateQueues.values())
314
- if (t.has(e))
315
- return !0;
316
- return !1;
317
- }
318
- /**
319
- * Flush all pending updates synchronously
320
- */
321
- flushSync() {
322
- this.isFlushPending && (this.isFlushPending = !1, this.flush());
323
- }
324
- /**
325
- * Clear all pending updates
326
- */
327
- clearPending() {
328
- for (const e of this.updateQueues.values())
329
- e.clear();
330
- this.isFlushPending = !1;
331
- }
332
- /**
333
- * Cleanup all reactive nodes and destroy scheduler
334
- */
335
- destroy() {
336
- this.isDestroyed = !0;
337
- for (const e of this.updateQueues.values()) {
338
- for (const t of e)
339
- try {
340
- t.cleanup();
341
- } catch (s) {
342
- console.error("Error cleaning up reactive node:", s);
343
- }
344
- e.clear();
345
- }
346
- this.updateQueues.clear(), this.errorHandlers.clear(), _.instance = null;
347
- }
348
- /**
349
- * Get debug information
350
- */
351
- getDebugInfo() {
352
- const e = {};
353
- for (const [t, s] of this.updateQueues)
354
- e[G[t]] = s.size;
355
- return {
356
- isFlushPending: this.isFlushPending,
357
- isDestroyed: this.isDestroyed,
358
- queueSizes: e,
359
- errorHandlerCount: this.errorHandlers.size,
360
- performance: this.getPerformanceMetrics()
361
- };
362
- }
363
- };
364
- A(Xe, "instance", null);
365
- var Je = Object.defineProperty, et = (n, e, t) => e in n ? Je(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, k = (n, e, t) => et(n, typeof e != "symbol" ? e + "" : e, t);
366
- let tt = class extends Ae {
367
- constructor(e, t = {}, s = Ee()) {
368
- super(e, s), k(this, "type", "computed"), k(this, "priority"), k(this, "_hasValue", !1), k(this, "_error", null), k(this, "equalsFn"), k(this, "options"), this.priority = t.priority ?? G.Normal, this.equalsFn = t.equals ?? Ge, this.options = t;
369
- }
370
- /**
371
- * Get the computed value, tracking dependency and lazily computing
372
- */
373
- getValue() {
374
- const e = Ce();
375
- return e && e.state !== y.Disposed && (this.observers.add(e), e.sources.add(this)), (this.state === y.Dirty || !this._hasValue) && (this.execute(), this._hasValue = !0), this.value;
376
- }
377
- /**
378
- * Get the current value without tracking dependency
379
- */
380
- peek() {
381
- return (this.state === y.Dirty || !this._hasValue) && (this.execute(), this._hasValue = !0), this.value;
382
- }
383
- /**
384
- * Remove an observer (cleanup)
385
- */
386
- removeObserver(e) {
387
- this.observers.delete(e), this.options.releaseOnNoObservers === !0 && this.observers.size === 0 && e.state === y.Disposed && this.releaseSources();
388
- }
389
- releaseSources() {
390
- for (const e of this.sources)
391
- "removeObserver" in e && e.removeObserver(this);
392
- this.sources.clear(), this._hasValue = !1, this.state = y.Dirty;
393
- }
394
- /**
395
- * Execute the computation and notify observers
396
- */
397
- execute() {
398
- const e = this._hasValue ? this.value : void 0, t = super.execute();
399
- if (!this._hasValue || !this.equalsFn(e, t))
400
- for (const s of this.observers)
401
- s.state !== y.Disposed && (s.state = y.Dirty, "execute" in s && typeof s.execute == "function" && queueMicrotask(() => {
402
- s.state === y.Dirty && s.execute();
403
- }));
404
- return t;
405
- }
406
- /**
407
- * Notify method for ReactiveNode compatibility
408
- */
409
- notify() {
410
- this.execute();
411
- }
412
- /**
413
- * Complete cleanup for memory management
414
- */
415
- cleanup() {
416
- for (const e of this.sources)
417
- "removeObserver" in e && e.removeObserver(this);
418
- this.sources.clear();
419
- for (const e of this.observers)
420
- e.sources.delete(this);
421
- this.observers.clear(), this._hasValue = !1, this._error = null, this.state = y.Disposed;
422
- }
423
- /**
424
- * Dispose the computed value
425
- */
426
- dispose() {
427
- this.cleanup(), super.dispose();
428
- }
429
- /**
430
- * Debug information
431
- */
432
- [Symbol.for("tachui.debug")]() {
433
- return {
434
- id: this.id,
435
- type: this.type,
436
- value: this._hasValue ? this.value : void 0,
437
- hasValue: this._hasValue,
438
- error: this._error?.message,
439
- state: this.state,
440
- sourceCount: this.sources.size,
441
- observerCount: this.observers.size,
442
- priority: G[this.priority],
443
- debugName: this.options.debugName,
444
- equalsFn: this.equalsFn.name || "anonymous"
445
- };
446
- }
447
- toString() {
448
- return `Computed(${this.options.debugName || this.id}): ${this._hasValue ? this.value : "no value"}`;
449
- }
450
- };
451
- function st(n, e) {
452
- const t = new tt(n, e), s = t.getValue.bind(t);
453
- return s.peek = t.peek.bind(t), Object.defineProperty(s, Symbol.for("tachui.computed"), {
454
- value: t,
455
- enumerable: !1
456
- }), s;
457
- }
458
- function B(n) {
459
- return typeof n == "function" && Symbol.for("tachui.computed") in n;
460
- }
461
- const [rt, Ss] = he("light");
462
- st(() => {
463
- const n = rt();
464
- return n === "system" ? it() : n;
465
- });
466
- function it() {
467
- return typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
468
- }
469
- typeof globalThis.__DEV__ > "u" && (globalThis.__DEV__ = process.env.NODE_ENV !== "production");
470
- var nt = Object.defineProperty, ot = (n, e, t) => e in n ? nt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, be = (n, e, t) => ot(n, typeof e != "symbol" ? e + "" : e, t);
471
- let at = class {
472
- constructor() {
473
- be(this, "pending", /* @__PURE__ */ new Set()), be(this, "isFlushScheduled", !1);
474
- }
475
- schedule(e) {
476
- this.pending.add(e), this.isFlushScheduled || (this.isFlushScheduled = !0, queueMicrotask(() => this.flush()));
477
- }
478
- flush() {
479
- if (this.pending.size === 0) {
480
- this.isFlushScheduled = !1;
481
- return;
482
- }
483
- const e = Array.from(this.pending);
484
- this.pending.clear(), this.isFlushScheduled = !1;
485
- for (const t of e)
486
- try {
487
- t();
488
- } catch (s) {
489
- console.error("Error in scheduled task:", s);
490
- }
491
- this.pending.size > 0 && (this.isFlushScheduled = !0, queueMicrotask(() => this.flush()));
492
- }
493
- };
494
- new at();
495
- let ne = null;
496
- const b = class b {
497
- constructor() {
498
- m(this, "instanceId");
499
- m(this, "createdAt");
500
- m(this, "modifiers", /* @__PURE__ */ new Map());
501
- m(this, "lazyLoaders", /* @__PURE__ */ new Map());
502
- m(this, "loadingPromises", /* @__PURE__ */ new Map());
503
- // Feature flags
504
- m(this, "featureFlags", {
505
- proxyModifiers: !1,
506
- // Disabled by default for safe rollout
507
- autoTypeGeneration: !1,
508
- hmrCacheInvalidation: !1,
509
- pluginValidation: !0,
510
- performanceMonitoring: !1,
511
- metadataRegistration: !0
512
- // Enable for new system
513
- });
514
- // Metadata storage for type generation
515
- m(this, "metadata", /* @__PURE__ */ new Map());
516
- m(this, "metadataHistory", /* @__PURE__ */ new Map());
517
- m(this, "conflicts", /* @__PURE__ */ new Map());
518
- // Plugin metadata storage
519
- m(this, "plugins", /* @__PURE__ */ new Map());
520
- b.instanceCount++, this.instanceId = Math.random().toString(36).substr(2, 9), this.createdAt = Date.now(), process.env.NODE_ENV === "development" && console.log(
521
- `🏗️ ModifierRegistry instance created: ${this.instanceId} (total: ${b.instanceCount})`
522
- );
523
- }
524
- static validateModifierName(e, t = {}) {
525
- if (b.FORBIDDEN_NAMES.has(e))
526
- throw new Error(
527
- `Security Error: Cannot register modifier '${e}' (forbidden name)`
528
- );
529
- if (!b.NAME_PATTERN.test(e)) {
530
- if (t.strict)
531
- throw new Error(
532
- `Invalid modifier name '${e}'. Modifier names must match ${b.NAME_PATTERN}`
533
- );
534
- process.env.NODE_ENV !== "production" && console.warn(
535
- `⚠️ Modifier name '${e}' does not match ${b.NAME_PATTERN}. Prefer alphanumeric names for best tooling support.`
536
- );
537
- }
538
- }
539
- register(e, t) {
540
- b.validateModifierName(e), this.modifiers.set(e, t), this.lazyLoaders.delete(e), this.loadingPromises.delete(e);
541
- }
542
- registerLazy(e, t) {
543
- if (b.validateModifierName(e), this.modifiers.has(e)) {
544
- process.env.NODE_ENV === "development" && console.warn(
545
- `⚠️ Modifier '${e}' already registered, skipping lazy registration`
546
- );
547
- return;
548
- }
549
- this.lazyLoaders.set(e, t);
550
- }
551
- get(e, t) {
552
- const s = this.modifiers.get(e);
553
- if (s)
554
- return s;
555
- const r = this.lazyLoaders.get(e);
556
- if (!r) {
557
- process.env.NODE_ENV === "development" && console.warn(
558
- `⚠️ Modifier '${e}' not found in registry ${this.instanceId}`
559
- );
560
- return;
561
- }
562
- if (t?.async)
563
- return this.getAsync(e);
564
- try {
565
- const i = r();
566
- return i instanceof Promise ? i.then((o) => (this.modifiers.set(e, o), this.lazyLoaders.delete(e), o)).catch((o) => {
567
- process.env.NODE_ENV === "development" && console.warn(`⚠️ Failed to load modifier '${e}':`, o);
568
- }) : (this.modifiers.set(e, i), this.lazyLoaders.delete(e), i);
569
- } catch (i) {
570
- process.env.NODE_ENV === "development" && console.warn(
571
- `⚠️ Failed to load modifier '${e}' synchronously:`,
572
- i
573
- );
574
- return;
575
- }
576
- }
577
- async getAsync(e) {
578
- const t = this.loadingPromises.get(e);
579
- if (t)
580
- return t;
581
- const s = this.lazyLoaders.get(e);
582
- if (!s)
583
- return;
584
- const r = this.loadModifier(e, s);
585
- this.loadingPromises.set(e, r);
586
- try {
587
- const i = await r;
588
- return this.loadingPromises.delete(e), i;
589
- } catch (i) {
590
- throw this.loadingPromises.delete(e), process.env.NODE_ENV === "development" && console.error(`❌ Failed to load modifier '${e}':`, i), i;
591
- }
592
- }
593
- async loadModifier(e, t) {
594
- try {
595
- const s = await t();
596
- return this.modifiers.set(e, s), this.lazyLoaders.delete(e), s;
597
- } catch (s) {
598
- throw process.env.NODE_ENV === "development" && console.error(`❌ Error loading modifier '${e}':`, s), s;
599
- }
600
- }
601
- has(e) {
602
- return this.modifiers.has(e) || this.lazyLoaders.has(e);
603
- }
604
- list() {
605
- const e = Array.from(this.modifiers.keys()), t = Array.from(this.lazyLoaders.keys());
606
- return [...e, ...t];
607
- }
608
- clear() {
609
- this.modifiers.clear(), this.lazyLoaders.clear(), this.loadingPromises.clear(), this.metadata.clear(), this.metadataHistory.clear(), this.conflicts.clear(), this.plugins.clear(), process.env.NODE_ENV === "development" && console.log(
610
- `🧹 Cleared all modifiers and lazy loaders from registry ${this.instanceId}`
611
- );
612
- }
613
- reset() {
614
- this.clear(), process.env.NODE_ENV === "test" && (b.instanceCount = 0);
615
- }
616
- validateRegistry() {
617
- const e = this.list(), t = e.filter(
618
- (s, r) => e.indexOf(s) !== r
619
- );
620
- return {
621
- totalModifiers: this.modifiers.size + this.lazyLoaders.size,
622
- duplicateNames: t,
623
- orphanedReferences: [],
624
- // Could be enhanced to scan for broken references
625
- instanceId: this.instanceId,
626
- createdAt: this.createdAt,
627
- instanceCount: b.instanceCount
628
- };
629
- }
630
- /**
631
- * Get diagnostic information about this registry instance
632
- */
633
- getDiagnostics() {
634
- return {
635
- instanceId: this.instanceId,
636
- createdAt: this.createdAt,
637
- modifierCount: this.modifiers.size,
638
- lazyLoaderCount: this.lazyLoaders.size,
639
- modifiers: this.list(),
640
- loadedModifiers: Array.from(this.modifiers.keys()),
641
- lazyModifiers: Array.from(this.lazyLoaders.keys()),
642
- featureFlags: this.featureFlags,
643
- metadataCount: this.metadata.size
644
- };
645
- }
646
- // ============================================================================
647
- // Feature Flag Methods
648
- // ============================================================================
649
- /**
650
- * Set feature flags for the registry
651
- * Allows enabling/disabling features for gradual rollout
652
- */
653
- setFeatureFlags(e) {
654
- this.featureFlags = {
655
- ...this.featureFlags,
656
- ...e
657
- };
658
- }
659
- /**
660
- * Get current feature flags
661
- */
662
- getFeatureFlags() {
663
- return { ...this.featureFlags };
664
- }
665
- /**
666
- * Check if a specific feature is enabled
667
- */
668
- isFeatureEnabled(e) {
669
- return this.featureFlags[e] === !0;
670
- }
671
- // ============================================================================
672
- // Metadata Methods (for build-time type generation)
673
- // ============================================================================
674
- /**
675
- * Register metadata for a modifier (for type generation)
676
- */
677
- registerMetadata(e) {
678
- if (!this.isFeatureEnabled("metadataRegistration")) {
679
- process.env.NODE_ENV === "development" && console.warn(
680
- "⚠️ Metadata registration is disabled. Enable 'metadataRegistration' feature flag."
681
- );
682
- return;
683
- }
684
- if (!e.plugin)
685
- throw new Error(
686
- `Modifier metadata '${String(e.name)}' must include a plugin identifier`
687
- );
688
- typeof e.name == "string" && b.validateModifierName(e.name, {
689
- strict: !0
690
- });
691
- const t = this.metadata.get(e.name), s = t?.plugin === e.plugin;
692
- if (this.recordMetadataHistoryEntry(e), !t) {
693
- this.metadata.set(e.name, e);
694
- return;
695
- }
696
- if (s) {
697
- this.metadata.set(e.name, e);
698
- return;
699
- }
700
- if (e.priority > t.priority) {
701
- process.env.NODE_ENV === "development" && console.warn(
702
- `⚠️ Overriding modifier metadata '${String(e.name)}' from ${t.plugin} (priority ${t.priority}) with ${e.plugin} (priority ${e.priority})`
703
- ), this.metadata.set(e.name, e);
704
- return;
705
- }
706
- e.priority === t.priority && e.plugin !== t.plugin && process.env.NODE_ENV === "development" && console.error(
707
- `❌ Metadata conflict for '${String(e.name)}': ${t.plugin} vs ${e.plugin} (both priority ${e.priority})`
708
- );
709
- }
710
- recordMetadataHistoryEntry(e) {
711
- const t = this.metadataHistory.get(e.name) ?? [], s = `${e.plugin}:${e.priority}`, r = t.findIndex(
712
- (i) => `${i.plugin}:${i.priority}` === s
713
- );
714
- r >= 0 ? t[r] = e : t.push(e), this.metadataHistory.set(e.name, t), this.refreshConflictsFor(e.name, t);
715
- }
716
- refreshConflictsFor(e, t) {
717
- const s = [], r = /* @__PURE__ */ new Map();
718
- for (const i of t) {
719
- const o = r.get(i.priority) ?? /* @__PURE__ */ new Map();
720
- o.set(i.plugin, i), r.set(i.priority, o);
721
- }
722
- for (const i of r.values())
723
- if (i.size > 1)
724
- for (const o of i.values())
725
- s.push(o);
726
- s.length > 0 ? this.conflicts.set(e, s) : this.conflicts.delete(e);
727
- }
728
- /**
729
- * Get metadata for a specific modifier
730
- */
731
- getMetadata(e) {
732
- return this.metadata.get(e);
733
- }
734
- /**
735
- * Get all registered metadata
736
- */
737
- getAllMetadata() {
738
- return Array.from(this.metadata.values());
739
- }
740
- /**
741
- * Get metadata filtered by category
742
- */
743
- getModifiersByCategory(e) {
744
- return this.getAllMetadata().filter((t) => t.category === e);
745
- }
746
- getMetadataByCategory(e) {
747
- return this.getModifiersByCategory(e);
748
- }
749
- /**
750
- * Get conflicts (multiple modifiers with same name but different plugins)
751
- */
752
- getConflicts() {
753
- return new Map(
754
- Array.from(this.conflicts.entries(), ([e, t]) => [e, [...t]])
755
- );
756
- }
757
- registerPlugin(e) {
758
- if (!e.name || !e.version)
759
- throw new Error("Plugin must define both name and version");
760
- if (!e.author)
761
- throw new Error(
762
- `Plugin '${e.name}' must include an author or organization`
763
- );
764
- !e.verified && process.env.NODE_ENV !== "production" && console.warn(
765
- `⚠️ Registering unverified plugin '${e.name}'. Install plugins from trusted sources.`
766
- ), this.plugins.set(e.name, e);
767
- }
768
- getPluginInfo(e) {
769
- return this.plugins.get(e);
770
- }
771
- listPlugins() {
772
- return Array.from(this.plugins.values());
773
- }
774
- };
775
- m(b, "instanceCount", 0), m(b, "FORBIDDEN_NAMES", /* @__PURE__ */ new Set([
776
- "__proto__",
777
- "constructor",
778
- "prototype",
779
- "hasOwnProperty",
780
- "isPrototypeOf",
781
- "toString",
782
- "valueOf"
783
- ])), m(b, "NAME_PATTERN", /^[a-zA-Z_$][a-zA-Z0-9_$]*$/);
784
- let de = b;
785
- function lt() {
786
- return ne || (ne = new de()), ne;
787
- }
788
- const x = lt();
789
- function T(n, e = {}) {
790
- const t = Ee();
791
- let s;
792
- const r = () => {
793
- const o = n(s);
794
- return s = o, o;
795
- }, i = new Ae(r, t);
796
- return e.name && Object.defineProperty(i, "name", {
797
- value: e.name,
798
- enumerable: !1
799
- }), i.execute(), i;
800
- }
801
- var ct = Object.defineProperty, ht = (n, e, t) => e in n ? ct(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, dt = (n, e, t) => ht(n, e + "", t);
802
- const ut = /* @__PURE__ */ new Set([
803
- "onFocus",
804
- "onBlur",
805
- "onKeyDown",
806
- "onKeyUp",
807
- "onKeyPress",
808
- "onScroll",
809
- "onWheel",
810
- "onInput",
811
- "onChange",
812
- "onCopy",
813
- "onCut",
814
- "onPaste",
815
- "onSelect",
816
- "onTouchStart",
817
- "onTouchMove",
818
- "onTouchEnd",
819
- "onSwipeLeft",
820
- "onSwipeRight"
821
- ]);
822
- function Ie() {
823
- return x;
824
- }
825
- function d(n, ...e) {
826
- const t = Ie().get(n);
827
- if (t)
828
- try {
829
- return t.apply(null, e);
830
- } catch (s) {
831
- throw console.warn(`Error creating modifier '${n}':`, s), s;
832
- }
833
- throw new Error(
834
- `Modifier '${n}' not found in registry. Import @tachui/modifiers or @tachui/modifiers/effects to register modifiers.`
835
- );
836
- }
837
- class pt {
838
- constructor(e) {
839
- this.component = e, dt(this, "modifiers", []);
840
- }
841
- frame(e, t) {
842
- let s;
843
- return typeof e == "object" ? s = e : (s = {}, e !== void 0 && (s.width = e), t !== void 0 && (s.height = t)), this.modifiers.push(d("frame", s)), this;
844
- }
845
- // margin() moved to @tachui/modifiers - available via Proxy when imported
846
- layoutPriority(e) {
847
- return this.modifiers.push(d("layoutPriority", e)), this;
848
- }
849
- // Size, padding, and margin modifiers moved to @tachui/modifiers
850
- // All available via Proxy when @tachui/modifiers is imported:
851
- // - size(), width(), height(), minWidth(), maxWidth(), minHeight(), maxHeight()
852
- // - padding(), paddingTop(), paddingBottom(), paddingLeft(), paddingRight()
853
- // - paddingLeading(), paddingTrailing(), paddingHorizontal(), paddingVertical()
854
- // - marginTop(), marginBottom(), marginLeft(), marginRight()
855
- // - marginHorizontal(), marginVertical()
856
- // Typography modifiers moved to @tachui/modifiers:
857
- // typography(), textAlign(), textTransform(), gradientText()
858
- // Available via Proxy when @tachui/modifiers is imported
859
- // Text modifiers (lineClamp, wordBreak, overflowWrap, hyphens) moved to @tachui/modifiers
860
- // Available via Proxy when @tachui/modifiers is imported
861
- // position() and zIndex() methods have been migrated to @tachui/modifiers/layout
862
- // for enhanced SwiftUI-compatible functionality
863
- // Text spacing and overflow methods moved to @tachui/modifiers:
864
- // letterSpacing(), lineHeight(), textOverflow(), whiteSpace(), overflow()
865
- // Border modifiers moved to @tachui/modifiers:
866
- // borderTop(), borderRight(), borderBottom(), borderLeft()
867
- // Flexbox modifiers moved to @tachui/modifiers:
868
- // flexGrow(), flexShrink(), justifyContent(), alignItems(), gap(), flexDirection(), flexWrap()
869
- // Utility modifiers moved to @tachui/modifiers:
870
- // cursor(), overflowX(), overflowY(), outline(), outlineOffset(), display()
871
- // Raw CSS modifiers moved to @tachui/modifiers/utility
872
- // Import { css } from '@tachui/modifiers/utility' and apply explicitly.
873
- // textCase(), textDecoration(), and aspectRatio() moved to @tachui/modifiers
874
- // Available via Proxy when @tachui/modifiers is imported
875
- // Phase 1 SwiftUI modifiers
876
- // Note: clipped() has been moved to @tachui/modifiers
877
- // Phase 2 SwiftUI modifiers
878
- // Note: clipShape() and overlay() have been moved to @tachui/modifiers
879
- // Phase 3 SwiftUI modifiers - Critical Transform Modifiers
880
- absolutePosition(e, t) {
881
- return this.modifiers.push(d("absolutePosition", e, t)), this;
882
- }
883
- // Appearance modifiers
884
- foregroundColor(e) {
885
- return this.modifiers.push(d("foregroundColor", e)), this;
886
- }
887
- backgroundColor(e) {
888
- return this.modifiers.push(d("backgroundColor", e)), this;
889
- }
890
- background(e) {
891
- const t = d("background", e);
892
- return this.modifiers.push(t), this;
893
- }
894
- font(e) {
895
- let t;
896
- return typeof e == "object" ? (t = e, t.family !== void 0 && this.modifiers.push(
897
- d("fontFamily", t.family)
898
- ), t.size !== void 0 && this.modifiers.push(d("fontSize", t.size)), t.weight !== void 0 && this.modifiers.push(d("fontWeight", t.weight)), t.style !== void 0 && this.modifiers.push(d("fontStyle", t.style))) : (t = e !== void 0 ? { size: e } : {}, typeof e == "string" && e.startsWith(".") ? this.modifiers.push(d("fontPreset", e)) : t.size !== void 0 && this.modifiers.push(d("fontSize", t.size))), this;
899
- }
900
- fontWeight(e) {
901
- return this.modifiers.push(d("fontWeight", e)), this;
902
- }
903
- fontSize(e) {
904
- return this.modifiers.push(d("fontSize", e)), this;
905
- }
906
- fontFamily(e) {
907
- return this.modifiers.push(d("fontFamily", e)), this;
908
- }
909
- opacity(e) {
910
- return this.modifiers.push(d("opacity", e)), this;
911
- }
912
- cornerRadius(e) {
913
- return this.modifiers.push(d("cornerRadius", e)), this;
914
- }
915
- border(e, t) {
916
- let s;
917
- return typeof e == "object" ? s = e : s = {
918
- style: "solid",
919
- ...e !== void 0 && { width: e },
920
- ...t !== void 0 && { color: t }
921
- }, this.modifiers.push(d("border", s)), this;
922
- }
923
- borderWidth(e) {
924
- return this.modifiers.push(d("border", { width: e })), this;
925
- }
926
- // Shadow functionality moved to @tachui/modifiers/effects entry point
927
- // Visual Effects Modifiers (Phase 2 - Epic: Butternut)
928
- blur(e) {
929
- return this.modifiers.push(d("blur", e)), this;
930
- }
931
- brightness(e) {
932
- return this.modifiers.push(d("brightness", e)), this;
933
- }
934
- contrast(e) {
935
- return this.modifiers.push(d("contrast", e)), this;
936
- }
937
- saturation(e) {
938
- return this.modifiers.push(d("saturation", e)), this;
939
- }
940
- hueRotation(e) {
941
- return this.modifiers.push(d("hueRotation", e)), this;
942
- }
943
- grayscale(e) {
944
- return this.modifiers.push(d("grayscale", e)), this;
945
- }
946
- colorInvert(e = 1) {
947
- return this.modifiers.push(d("colorInvert", e)), this;
948
- }
949
- // ============================================================================
950
- // VISUAL EFFECTS MOVED TO @tachui/modifiers/effects ENTRY
951
- // ============================================================================
952
- //
953
- // Visual effects have been extracted to @tachui/modifiers/effects for better tree-shaking
954
- // Visual effects methods removed - use @tachui/modifiers/effects
955
- // Advanced gesture and interaction modifiers moved to @tachui/modifiers
956
- // Available via Proxy when @tachui/modifiers is imported:
957
- // - onLongPressGesture(), keyboardShortcut(), focused(), focusable(), onContinuousHover()
958
- highPriorityGesture(e, t) {
959
- return this.modifiers.push(d("highPriorityGesture", e, t)), this;
960
- }
961
- simultaneousGesture(e, t) {
962
- return this.modifiers.push(d("simultaneousGesture", e, t)), this;
963
- }
964
- // allowsHitTesting() moved to @tachui/modifiers - available via Proxy when imported
965
- // Animation modifiers
966
- transform(e) {
967
- return this.modifiers.push(d("transform", e)), this;
968
- }
969
- animation(e) {
970
- return this.modifiers.push(d("animation", e)), this;
971
- }
972
- // Lifecycle modifiers
973
- task(e, t) {
974
- return this.modifiers.push(
975
- d("task", {
976
- operation: e,
977
- id: t?.id,
978
- priority: t?.priority || "default"
979
- })
980
- ), this;
981
- }
982
- // Custom modifier application
983
- /**
984
- * @deprecated DO NOT USE - This is an internal API only.
985
- * Always use direct modifier methods instead of .modifier()
986
- *
987
- * BAD: component.modifier(padding(16))
988
- * GOOD: component.padding(16)
989
- *
990
- * If you need a modifier from @tachui/modifiers, import and use it directly:
991
- * BAD: component.modifier(shadow({ radius: 4 }))
992
- * GOOD: import { shadow } from '@tachui/modifiers'
993
- * const mod = shadow({ radius: 4 })
994
- * // Then apply via registry or component method
995
- */
996
- modifier(e) {
997
- return process.env.NODE_ENV === "development" && console.warn(
998
- `⚠️ .modifier() should NOT be used by developers.
999
- Use direct modifier methods instead:
1000
- BAD: component.modifier(padding(16))
1001
- GOOD: component.padding(16)
1002
-
1003
- If the method doesn't exist on the component, import the modifier package:
1004
- import { shadowModifier } from '@tachui/modifiers'
1005
-
1006
- This method is for internal framework use only.`
1007
- ), this.modifiers.push(e), this;
1008
- }
1009
- // Public method to add a modifier (used by Proxy)
1010
- addModifierInternal(e) {
1011
- return this.modifiers.push(e), this;
1012
- }
1013
- // Resizable modifier for images
1014
- resizable() {
1015
- return this.modifiers.push(d("resizable")), this;
1016
- }
1017
- // Responsive Design Methods
1018
- /**
1019
- * Add modifier to internal list (used by responsive builder)
1020
- */
1021
- addModifier(e) {
1022
- if (this.modifiers.push(e), "modifiers" in this.component && Array.isArray(this.component.modifiers)) {
1023
- const t = this.component;
1024
- t.modifiers = [
1025
- ...t.modifiers,
1026
- e
1027
- ];
1028
- }
1029
- }
1030
- // Responsive functionality moved to @tachui/responsive package
1031
- // Interaction modifiers
1032
- onTap(e) {
1033
- return this.modifiers.push(d("onTap", e)), this;
1034
- }
1035
- onFocus(e) {
1036
- return this.modifiers.push(d("onFocus", e)), this;
1037
- }
1038
- onBlur(e) {
1039
- return this.modifiers.push(d("onBlur", e)), this;
1040
- }
1041
- onKeyDown(e) {
1042
- return this.modifiers.push(d("onKeyDown", e)), this;
1043
- }
1044
- onScroll(e) {
1045
- return this.modifiers.push(d("onScroll", e)), this;
1046
- }
1047
- onKeyPress(e) {
1048
- return this.modifiers.push(d("onKeyPress", e)), this;
1049
- }
1050
- onKeyUp(e) {
1051
- return this.modifiers.push(d("onKeyUp", e)), this;
1052
- }
1053
- onDoubleClick(e) {
1054
- return this.modifiers.push(d("onDoubleClick", e)), this;
1055
- }
1056
- onContextMenu(e) {
1057
- return this.modifiers.push(d("onContextMenu", e)), this;
1058
- }
1059
- onWheel(e) {
1060
- return this.modifiers.push(d("onWheel", e)), this;
1061
- }
1062
- onInput(e) {
1063
- return this.modifiers.push(d("onInput", e)), this;
1064
- }
1065
- onChange(e) {
1066
- return this.modifiers.push(d("onChange", e)), this;
1067
- }
1068
- onCopy(e) {
1069
- return this.modifiers.push(d("onCopy", e)), this;
1070
- }
1071
- onCut(e) {
1072
- return this.modifiers.push(d("onCut", e)), this;
1073
- }
1074
- onPaste(e) {
1075
- return this.modifiers.push(d("onPaste", e)), this;
1076
- }
1077
- onSelect(e) {
1078
- return this.modifiers.push(d("onSelect", e)), this;
1079
- }
1080
- // Transition modifier moved to @tachui/modifiers:
1081
- // transition()
1082
- // HTML and ARIA Attributes moved to @tachui/modifiers
1083
- // Available via Proxy when @tachui/modifiers is imported:
1084
- // - id(), data(), aria(), tabIndex()
1085
- customProperties(e) {
1086
- throw new Error(
1087
- 'CSS property modifiers have been moved to @tachui/modifiers. Please import { customProperties } from "@tachui/modifiers" and use it directly instead of chaining it on components.'
1088
- );
1089
- }
1090
- customProperty(e, t) {
1091
- throw new Error(
1092
- 'CSS property modifiers have been moved to @tachui/modifiers. Please import { customProperty } from "@tachui/modifiers" and use it directly instead of chaining it on components.'
1093
- );
1094
- }
1095
- cssVariables(e) {
1096
- throw new Error(
1097
- 'CSS property modifiers have been moved to @tachui/modifiers. Please import { cssVariables } from "@tachui/modifiers" and use it directly instead of chaining it on components.'
1098
- );
1099
- }
1100
- themeColors(e) {
1101
- throw new Error(
1102
- 'Theme modifiers have been moved to @tachui/modifiers. Please import { themeColors } from "@tachui/modifiers" and use it directly instead of chaining it on components.'
1103
- );
1104
- }
1105
- designTokens(e) {
1106
- throw new Error(
1107
- 'Design token modifiers have been moved to @tachui/modifiers. Please import { designTokens } from "@tachui/modifiers" and use it directly instead of chaining it on components.'
1108
- );
1109
- }
1110
- // State modifiers
1111
- disabled(e = !0) {
1112
- return this.modifiers.push(d("disabled", e)), this;
1113
- }
1114
- asHTML(e) {
1115
- const t = d("asHTML", e);
1116
- return this.modifiers.push(t), this;
1117
- }
1118
- // Build the final component with all modifiers applied
1119
- build() {
1120
- if ("modifiers" in this.component) {
1121
- const e = this.component, t = Array.isArray(
1122
- e.modifiers
1123
- ) ? [...e.modifiers] : [], s = this.modifiers.filter(
1124
- (l) => !e.modifiers.some(
1125
- (h) => h === l
1126
- // Reference equality check
1127
- )
1128
- ), r = [...t, ...s], i = e._originalComponent || e;
1129
- let o;
1130
- if (typeof i?.clone == "function")
1131
- o = i.clone();
1132
- else {
1133
- const l = i && Object.getPrototypeOf(i) || Object.prototype;
1134
- o = Object.create(l), Object.assign(o, i), o.props = { ...i.props }, o.cleanup = Array.isArray(i.cleanup) ? [...i.cleanup] : [], o.mounted = i.mounted ?? !1, o.id = i.id, o.type = i.type, o.render = typeof i.render == "function" ? i.render.bind(i) : () => [];
1135
- }
1136
- const a = te(
1137
- o,
1138
- r
1139
- );
1140
- return process.env.NODE_ENV === "test" && this.applyModifiersToPropsForTesting(
1141
- a,
1142
- r
1143
- ), a;
1144
- } else {
1145
- const e = te(
1146
- this.component,
1147
- this.modifiers
1148
- );
1149
- return process.env.NODE_ENV === "test" && this.applyModifiersToPropsForTesting(
1150
- e,
1151
- this.modifiers
1152
- ), e;
1153
- }
1154
- }
1155
- applyModifiersToPropsForTesting(e, t) {
1156
- e.props || (e.props = {}), t.forEach((s) => {
1157
- if (s.type === "aria") {
1158
- const r = s.properties?.aria || {};
1159
- Object.entries(r).forEach(([i, o]) => {
1160
- if (o != null)
1161
- if (i === "role")
1162
- e.props.role = o;
1163
- else {
1164
- const a = i.startsWith("aria-") ? i : `aria-${i}`;
1165
- e.props[a] = typeof o == "boolean" ? o : String(o);
1166
- }
1167
- });
1168
- } else if (ut.has(s.type)) {
1169
- const r = s.properties || {};
1170
- Object.entries(r).forEach(([i, o]) => {
1171
- typeof o == "function" && (e.props[i] = o);
1172
- });
1173
- } else if (s.type === "interaction") {
1174
- const r = s.properties;
1175
- Object.entries(r).forEach(([i, o]) => {
1176
- typeof o == "function" && (e.props[i] = o);
1177
- }), (r.onSwipeLeft || r.onSwipeRight) && (e.props.onTouchStart = () => {
1178
- });
1179
- } else if (s.type === "utility") {
1180
- const r = s.properties;
1181
- e.props.style || (e.props.style = {}), Object.entries(r).forEach(([i, o]) => {
1182
- o != null && (e.props.style[i] = o);
1183
- });
1184
- } else if (s.type === "tabIndex") {
1185
- const r = s;
1186
- e.props.tabIndex = r.properties?.tabIndex;
1187
- } else if (s.type === "appearance") {
1188
- const r = s.properties;
1189
- e.props.style || (e.props.style = {}), r.backgroundColor && (e.props.style.backgroundColor = r.backgroundColor), r.foregroundColor && (e.props.style.color = r.foregroundColor), r.opacity !== void 0 && (e.props.style.opacity = r.opacity), r.role !== void 0 && (e.props.role = String(r.role)), r["aria-label"] !== void 0 && (e.props["aria-label"] = String(r["aria-label"])), r["aria-live"] !== void 0 && (e.props["aria-live"] = String(r["aria-live"])), r["aria-describedby"] !== void 0 && (e.props["aria-describedby"] = String(
1190
- r["aria-describedby"]
1191
- )), r["aria-modal"] !== void 0 && (e.props["aria-modal"] = r["aria-modal"] === "true" || r["aria-modal"] === !0), r["aria-hidden"] !== void 0 && (e.props["aria-hidden"] = String(r["aria-hidden"])), r.navigationTitle !== void 0 && (e.props.navigationTitle = String(r.navigationTitle)), r.navigationBarHidden !== void 0 && (e.props.navigationBarHidden = r.navigationBarHidden, r.navigationBarHidden && (e.props["aria-hidden"] = "true")), r.navigationBarItems !== void 0 && (e.props.navigationBarItems = r.navigationBarItems);
1192
- } else if (s.type === "foreground") {
1193
- const r = s.properties || {};
1194
- r.color !== void 0 && (e.props.style || (e.props.style = {}), e.props.style.color = r.color);
1195
- } else if (s.type === "background") {
1196
- const r = s.properties || {};
1197
- r.background !== void 0 && (e.props.style || (e.props.style = {}), e.props.style.background = r.background, typeof r.background == "string" && (e.props.style.backgroundColor = r.background));
1198
- } else if (s.type === "transition") {
1199
- const r = s.properties;
1200
- e.props.style || (e.props.style = {}), r.transition && (e.props.style.transition = r.transition);
1201
- } else if (s.type === "size") {
1202
- const r = s.properties;
1203
- e.props.style || (e.props.style = {}), r.minHeight !== void 0 && (e.props.style.minHeight = r.minHeight), r.minWidth !== void 0 && (e.props.style.minWidth = r.minWidth), r.maxHeight !== void 0 && (e.props.style.maxHeight = r.maxHeight), r.maxWidth !== void 0 && (e.props.style.maxWidth = r.maxWidth), r.width !== void 0 && (e.props.style.width = r.width), r.height !== void 0 && (e.props.style.height = r.height);
1204
- } else if (s.type === "css") {
1205
- const r = s.properties;
1206
- e.props.style || (e.props.style = {}), Object.entries(r).forEach(([i, o]) => {
1207
- o != null && (e.props.style[i] = o);
1208
- });
1209
- }
1210
- });
1211
- }
1212
- // ============================================================================
1213
- // MISSING MODIFIER METHODS - ACCESSIBILITY & NAVIGATION
1214
- // ============================================================================
1215
- // Individual ARIA methods for better developer experience
1216
- role(e) {
1217
- return this.modifiers.push(d("role", e)), this;
1218
- }
1219
- ariaLabel(e) {
1220
- return this.modifiers.push(d("ariaLabel", e)), this;
1221
- }
1222
- ariaLive(e) {
1223
- return this.modifiers.push(d("ariaLive", e)), this;
1224
- }
1225
- ariaDescribedBy(e) {
1226
- return this.modifiers.push(d("ariaDescribedBy", e)), this;
1227
- }
1228
- ariaModal(e) {
1229
- return this.modifiers.push(d("ariaModal", e)), this;
1230
- }
1231
- // Touch and gesture events
1232
- onTouchStart(e) {
1233
- return this.modifiers.push(d("onTouchStart", e)), this;
1234
- }
1235
- onTouchMove(e) {
1236
- return this.modifiers.push(d("onTouchMove", e)), this;
1237
- }
1238
- onTouchEnd(e) {
1239
- return this.modifiers.push(d("onTouchEnd", e)), this;
1240
- }
1241
- // Swipe gestures (simplified implementations)
1242
- onSwipeLeft(e) {
1243
- return this.modifiers.push(d("onSwipeLeft", e)), this;
1244
- }
1245
- onSwipeRight(e) {
1246
- return this.modifiers.push(d("onSwipeRight", e)), this;
1247
- }
1248
- // Navigation methods - these delegate to the navigation package functions
1249
- navigationTitle(e) {
1250
- return this.modifiers.push(d("navigationTitle", e)), this;
1251
- }
1252
- navigationBarHidden(e = !0) {
1253
- return this.modifiers.push(d("navigationBarHidden", e)), this;
1254
- }
1255
- navigationBarItems(e) {
1256
- return this.modifiers.push(d("navigationBarItems", e)), this;
1257
- }
1258
- // ============================================================================
1259
- // MISSING TRANSITION METHODS
1260
- // ============================================================================
1261
- transitions(e) {
1262
- return this.modifiers.push(d("transitions", e)), this;
1263
- }
1264
- // All transition methods moved to @tachui/modifiers:
1265
- // fadeTransition(), transformTransition(), colorTransition(), layoutTransition(),
1266
- // buttonTransition(), cardTransition(), modalTransition(), smoothTransition(),
1267
- // quickTransition(), slowTransition()
1268
- // ============================================================================
1269
- // SCROLL METHODS - ALL MOVED TO @tachui/modifiers
1270
- // ============================================================================
1271
- // scroll(), scrollBehavior(), overscrollBehavior(), overscrollBehaviorX(),
1272
- // overscrollBehaviorY(), scrollMargin(), scrollPadding(), scrollSnap()
1273
- // ============================================================================
1274
- // MIGRATED MODIFIERS - NOW IN SPECIALIZED PACKAGES
1275
- // ============================================================================
1276
- // Viewport lifecycle modifiers - moved to @tachui/viewport
1277
- onAppear(e) {
1278
- throw new Error(
1279
- 'onAppear modifier has been moved to @tachui/viewport. Please import { onAppear } from "@tachui/viewport/modifiers" and use it directly instead of chaining it on components.'
1280
- );
1281
- }
1282
- onDisappear(e) {
1283
- throw new Error(
1284
- 'onDisappear modifier has been moved to @tachui/viewport. Please import { onDisappear } from "@tachui/viewport/modifiers" and use it directly instead of chaining it on components.'
1285
- );
1286
- }
1287
- // Mobile gesture modifiers - moved to @tachui/mobile
1288
- refreshable(e, t) {
1289
- throw new Error(
1290
- 'refreshable modifier has been moved to @tachui/mobile. Please import { refreshable } from "@tachui/mobile/modifiers" and use it directly instead of chaining it on components.'
1291
- );
1292
- }
1293
- // onAppear and onDisappear have been moved to @tachui/viewport/modifiers
1294
- // to maintain proper architectural boundaries
1295
- // Transform modifiers
1296
- scaleEffect(e, t, s) {
1297
- return this.modifiers.push(d("scaleEffect", e, t, s)), this;
1298
- }
1299
- // Shadow and clipping modifiers moved to @tachui/modifiers
1300
- // Available via Proxy when @tachui/modifiers is imported:
1301
- // - shadow(), textShadow(), shadows(), shadowPreset(), clipped()
1302
- }
1303
- function ft(n) {
1304
- const e = new pt(n);
1305
- return new Proxy(e, {
1306
- get(t, s, r) {
1307
- if (s in t) {
1308
- const i = t[s];
1309
- return typeof i == "function" ? function(...o) {
1310
- const a = i.apply(r, o);
1311
- return a === t ? r : a;
1312
- } : i;
1313
- }
1314
- if (typeof s == "string") {
1315
- const i = Ie();
1316
- if (s === "responsive")
1317
- return function(...o) {
1318
- const a = o[0];
1319
- if (a) {
1320
- const l = d(s, a);
1321
- this.addModifierInternal(l);
1322
- }
1323
- return r;
1324
- };
1325
- if (s === "base" || s === "sm" || s === "md" || s === "lg" || s === "xl" || s === "2xl")
1326
- return new Proxy({}, {
1327
- get(o, a) {
1328
- if (typeof a == "string")
1329
- return (...l) => {
1330
- const h = { [a]: { [s]: l[0] } }, c = d("responsive", h);
1331
- return t.addModifierInternal(c), r;
1332
- };
1333
- }
1334
- });
1335
- if (i.has(s))
1336
- return function(...o) {
1337
- const a = d(s, ...o);
1338
- return this.addModifierInternal(a), r;
1339
- };
1340
- }
1341
- }
1342
- });
1343
- }
1344
- class mt {
1345
- register(e, t) {
1346
- x.register(e, t);
1347
- }
1348
- get(e) {
1349
- return x.get(e);
1350
- }
1351
- has(e) {
1352
- return x.has(e);
1353
- }
1354
- list() {
1355
- return x.list();
1356
- }
1357
- clear() {
1358
- x.clear();
1359
- }
1360
- validateRegistry() {
1361
- return x.validateRegistry();
1362
- }
1363
- }
1364
- const V = new mt();
1365
- process.env.NODE_ENV === "development" && console.log("📤 Created RegistryAdapter for globalModifierRegistry", {
1366
- registryId: x.instanceId,
1367
- currentSize: x.list().length
1368
- });
1369
- function Me(n, e, t = {}, s = {}) {
1370
- if (!e.length) return n;
1371
- const r = {
1372
- componentId: t.componentId || "unknown",
1373
- phase: t.phase || "creation",
1374
- ...t.element && { element: t.element },
1375
- ...t.parentElement && { parentElement: t.parentElement },
1376
- ...t.componentInstance && {
1377
- componentInstance: t.componentInstance
1378
- },
1379
- ...t.previousModifiers && {
1380
- previousModifiers: t.previousModifiers
1381
- }
1382
- };
1383
- switch (s.batch ? "batch" : "sequential") {
1384
- case "batch":
1385
- return yt(n, e, r, s);
1386
- default:
1387
- return gt(n, e, r, s);
1388
- }
1389
- }
1390
- function gt(n, e, t, s) {
1391
- const r = [...e].sort(
1392
- (l, h) => l.priority - h.priority
1393
- );
1394
- let i = n;
1395
- const o = [], a = [];
1396
- for (const l of r)
1397
- try {
1398
- const h = l.apply(i, t);
1399
- h && typeof h == "object" && "type" in h && (i = h), s.immediate && !s.suppressEffects && (o.forEach((c) => c()), o.length = 0);
1400
- } catch (h) {
1401
- console.error(`Failed to apply modifier ${l.type}:`, h);
1402
- }
1403
- if (a.length > 0) {
1404
- const l = i.dispose;
1405
- i.dispose = () => {
1406
- a.forEach((h) => h()), l && l();
1407
- };
1408
- }
1409
- return i;
1410
- }
1411
- function yt(n, e, t, s) {
1412
- const r = vt(e);
1413
- let i = n;
1414
- const o = [], a = [];
1415
- for (const [l, h] of r)
1416
- try {
1417
- i = bt(i, h, t);
1418
- } catch (c) {
1419
- (typeof process > "u" || process.env.NODE_ENV !== "test") && console.error(`Failed to apply modifier group ${l}:`, c);
1420
- }
1421
- if (s.suppressEffects || o.forEach((l) => l()), a.length > 0) {
1422
- const l = i.dispose;
1423
- i.dispose = () => {
1424
- a.forEach((h) => h()), l && l();
1425
- };
1426
- }
1427
- return i;
1428
- }
1429
- function vt(n) {
1430
- const e = /* @__PURE__ */ new Map();
1431
- for (const t of n) {
1432
- const s = e.get(t.type) || [];
1433
- s.push(t), e.set(t.type, s);
1434
- }
1435
- return e;
1436
- }
1437
- function bt(n, e, t) {
1438
- const s = [...e].sort(
1439
- (i, o) => i.priority - o.priority
1440
- );
1441
- let r = n;
1442
- for (const i of s)
1443
- try {
1444
- const o = i.apply(r, t);
1445
- o && typeof o == "object" && "type" in o && (r = o);
1446
- } catch (o) {
1447
- (typeof process > "u" || process.env.NODE_ENV !== "test") && console.error(`Failed to apply modifier ${i.type}:`, o);
1448
- }
1449
- return r;
1450
- }
1451
- function St(n) {
1452
- return n && typeof n.concat == "function" && typeof n.toSegment == "function" && typeof n.isConcatenatable == "function";
1453
- }
1454
- function te(n, e = []) {
1455
- const t = {
1456
- type: n.type,
1457
- id: n.id,
1458
- props: { ...n.props },
1459
- mounted: n.mounted,
1460
- cleanup: n.cleanup ? [...n.cleanup] : [],
1461
- modifiers: [...e],
1462
- modifierBuilder: null,
1463
- // Will be set after component is created
1464
- render: n.render ? n.render.bind(n) : () => [],
1465
- // Bind to original component or provide default
1466
- // Store reference to original component for modifier context
1467
- _originalComponent: n
1468
- };
1469
- t.modifierBuilder = ft(
1470
- t
1471
- ), t.modifier = t.modifierBuilder, Object.prototype.hasOwnProperty.call(n, "modifier") || Object.defineProperty(n, "modifier", {
1472
- configurable: !0,
1473
- enumerable: !1,
1474
- get() {
1475
- return t.modifierBuilder;
1476
- }
1477
- }), n.modifiableComponent = t;
1478
- const s = n._enhancedLifecycle;
1479
- s && (t._enhancedLifecycle = s, "domElements" in n && (t.domElements = n.domElements), "primaryElement" in n && (t.primaryElement = n.primaryElement), "domReady" in n && (t.domReady = n.domReady), "children" in n && (t.children = n.children));
1480
- const r = n.render ? n.render.bind(n) : () => [];
1481
- return t.render = () => {
1482
- const i = r();
1483
- return (Array.isArray(i) ? i : [i]).map((o, a) => (o && typeof o == "object" && (a === 0 ? (o.modifiers = [...t.modifiers], o.componentId = n.id, o._originalComponent = t._originalComponent) : (o.modifiers && delete o.modifiers, o.componentId && o.componentId === n.id && delete o.componentId)), o));
1484
- }, St(n) && (t.concat = function(i) {
1485
- const o = {
1486
- id: t.id,
1487
- component: t,
1488
- modifiers: t.modifiers,
1489
- render: () => {
1490
- const h = t.render();
1491
- return Array.isArray(h) ? h[0] : h;
1492
- }
1493
- }, a = i.toSegment(), l = {
1494
- totalSegments: i instanceof Y ? i.segments.length + 1 : 2,
1495
- accessibilityRole: "text",
1496
- // Simplified for now
1497
- semanticStructure: "inline"
1498
- // Simplified for now
1499
- };
1500
- return i instanceof Y ? new Y(
1501
- [o, ...i.segments],
1502
- l
1503
- ) : new Y([o, a], l);
1504
- }, t.toSegment = function() {
1505
- return {
1506
- id: t.id,
1507
- component: t,
1508
- modifiers: t.modifiers,
1509
- render: () => {
1510
- const i = t.render();
1511
- return Array.isArray(i) ? i[0] : i;
1512
- }
1513
- };
1514
- }, t.isConcatenatable = function() {
1515
- return !0;
1516
- }), typeof n?.clone == "function" && (t.clone = (i) => {
1517
- const o = n.clone(i);
1518
- return te(
1519
- o,
1520
- [...t.modifiers]
1521
- );
1522
- }), t;
1523
- }
1524
- const K = /* @__PURE__ */ new Map([
1525
- ["nav", { role: "navigation", applyARIA: !0 }],
1526
- ["main", { role: "main", applyARIA: !0 }],
1527
- ["article", { role: "article", applyARIA: !0 }],
1528
- ["section", { role: "region", applyARIA: !0 }],
1529
- ["aside", { role: "complementary", applyARIA: !0 }],
1530
- ["header", { role: "banner", applyARIA: !1 }],
1531
- // Context dependent - may not always be page banner
1532
- ["footer", { role: "contentinfo", applyARIA: !1 }],
1533
- // Context dependent - may not always be page footer
1534
- ["form", { role: "form", applyARIA: !0 }],
1535
- ["search", { role: "search", applyARIA: !0 }],
1536
- ["dialog", { role: "dialog", applyARIA: !0 }],
1537
- ["button", { role: "button", applyARIA: !1 }],
1538
- // Usually implicit
1539
- ["a", { role: "link", applyARIA: !1 }]
1540
- // Usually implicit
1541
- ]);
1542
- let wt = {
1543
- autoApplySemanticRoles: !0,
1544
- warnOnOverrides: process.env.NODE_ENV !== "production",
1545
- warnOnSemanticIssues: process.env.NODE_ENV !== "production",
1546
- validateTags: !0,
1547
- allowInvalidTags: !0
1548
- };
1549
- function Ct() {
1550
- return { ...wt };
1551
- }
1552
- var Et = Object.defineProperty, At = (n, e, t) => e in n ? Et(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, It = (n, e, t) => At(n, e + "", t);
1553
- const xe = class W {
1554
- static getInstance() {
1555
- return W.instance || (W.instance = new W()), W.instance;
1556
- }
1557
- /**
1558
- * Apply semantic ARIA attributes to an element based on its tag
1559
- */
1560
- applySemanticAttributes(e, t, s) {
1561
- const r = Ct();
1562
- if (!r.autoApplySemanticRoles) return;
1563
- const i = K.get(t);
1564
- if (!(!i || !i.applyARIA)) {
1565
- if (s?.role) {
1566
- r.warnOnSemanticIssues && process.env.NODE_ENV !== "production" && console.warn(
1567
- `ARIA role '${s.role}' overrides semantic role '${i.role}' for tag '${t}'`
1568
- );
1569
- return;
1570
- }
1571
- if (e.hasAttribute("role")) {
1572
- r.warnOnSemanticIssues && process.env.NODE_ENV !== "production" && console.warn(
1573
- `Existing role attribute overrides semantic role '${i.role}' for tag '${t}'`
1574
- );
1575
- return;
1576
- }
1577
- e.setAttribute("role", i.role);
1578
- }
1579
- }
1580
- /**
1581
- * Get semantic role information for a tag
1582
- */
1583
- getSemanticRole(e) {
1584
- return K.get(e);
1585
- }
1586
- /**
1587
- * Check if a tag has automatic ARIA role application enabled
1588
- */
1589
- hasAutoARIA(e) {
1590
- const t = K.get(e);
1591
- return t ? t.applyARIA : !1;
1592
- }
1593
- /**
1594
- * Get all tags that support automatic ARIA roles
1595
- */
1596
- getAutoARIATags() {
1597
- return Array.from(K.entries()).filter(([, e]) => e.applyARIA).map(([e]) => e);
1598
- }
1599
- /**
1600
- * Apply semantic attributes during DOM node creation
1601
- * This is called by the renderer when creating elements
1602
- */
1603
- processElementNode(e, t, s, r) {
1604
- if (this.applySemanticAttributes(e, t, r), s && process.env.NODE_ENV !== "production") {
1605
- const i = this.getSemanticRole(t);
1606
- i && e.setAttribute(
1607
- "data-tachui-semantic",
1608
- JSON.stringify({
1609
- originalComponent: s.originalType,
1610
- overriddenTo: t,
1611
- semanticRole: i.role,
1612
- autoApplied: i.applyARIA
1613
- })
1614
- );
1615
- }
1616
- }
1617
- };
1618
- It(xe, "instance");
1619
- let Mt = xe;
1620
- const xt = Mt.getInstance();
1621
- var Tt = Object.defineProperty, $t = (n, e, t) => e in n ? Tt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, oe = (n, e, t) => $t(n, typeof e != "symbol" ? e + "" : e, t);
1622
- const Nt = /* @__PURE__ */ new Set([
1623
- "click",
1624
- "dblclick",
1625
- "mousedown",
1626
- "mouseup",
1627
- "mouseover",
1628
- "mouseout",
1629
- "mouseenter",
1630
- "mouseleave",
1631
- "focusin",
1632
- // Bubbles, unlike 'focus'
1633
- "focusout",
1634
- // Bubbles, unlike 'blur'
1635
- "input",
1636
- "change",
1637
- "submit",
1638
- "keydown",
1639
- "keyup",
1640
- "keypress"
1641
- ]), Se = /* @__PURE__ */ new Set([
1642
- "scroll",
1643
- "wheel",
1644
- "touchstart",
1645
- "touchmove",
1646
- "touchend"
1647
- ]);
1648
- class Rt {
1649
- constructor() {
1650
- oe(this, "containerListeners", /* @__PURE__ */ new WeakMap()), oe(this, "elementHandlers", /* @__PURE__ */ new WeakMap()), oe(this, "handlerCounts", /* @__PURE__ */ new WeakMap());
1651
- }
1652
- /**
1653
- * Register an event handler with delegation
1654
- */
1655
- register(e, t, s, r) {
1656
- let i = this.elementHandlers.get(t);
1657
- i && i.has(s) && this.unregister(e, t, s), i || (i = /* @__PURE__ */ new Map(), this.elementHandlers.set(t, i)), i.set(s, { handler: r, element: t });
1658
- let o = this.handlerCounts.get(e);
1659
- o || (o = /* @__PURE__ */ new Map(), this.handlerCounts.set(e, o));
1660
- const a = o.get(s) || 0;
1661
- return o.set(s, a + 1), this.ensureRootListener(e, s), () => {
1662
- this.unregister(e, t, s);
1663
- };
1664
- }
1665
- /**
1666
- * Unregister an event handler
1667
- */
1668
- unregister(e, t, s) {
1669
- const r = this.elementHandlers.get(t);
1670
- r && (r.delete(s), r.size === 0 && this.elementHandlers.delete(t));
1671
- const i = this.handlerCounts.get(e);
1672
- if (i) {
1673
- const o = (i.get(s) || 0) - 1;
1674
- o <= 0 ? (i.delete(s), this.removeRootListener(e, s)) : i.set(s, o);
1675
- }
1676
- }
1677
- /**
1678
- * Ensure root listener exists for event type on container
1679
- */
1680
- ensureRootListener(e, t) {
1681
- let s = this.containerListeners.get(e);
1682
- if (s || (s = /* @__PURE__ */ new Map(), this.containerListeners.set(e, s)), s.has(t))
1683
- return;
1684
- const r = (o) => {
1685
- this.handleDelegatedEvent(e, t, o);
1686
- }, i = Se.has(t) ? { passive: !0 } : { passive: !1 };
1687
- e.addEventListener(t, r, i), s.set(t, r);
1688
- }
1689
- /**
1690
- * Remove root listener for event type on container
1691
- */
1692
- removeRootListener(e, t) {
1693
- const s = this.containerListeners.get(e);
1694
- if (!s) return;
1695
- const r = s.get(t);
1696
- r && (e.removeEventListener(t, r), s.delete(t));
1697
- }
1698
- /**
1699
- * Handle delegated event by finding target handler
1700
- */
1701
- handleDelegatedEvent(e, t, s) {
1702
- const r = s.target;
1703
- if (!r) return;
1704
- let i = r;
1705
- for (; i && i !== e; ) {
1706
- const o = this.elementHandlers.get(i);
1707
- if (o) {
1708
- const a = o.get(t);
1709
- if (a) {
1710
- try {
1711
- a.handler(s);
1712
- } catch (l) {
1713
- console.error(`Delegated event handler error for ${t}:`, l);
1714
- }
1715
- return;
1716
- }
1717
- }
1718
- i = i.parentElement;
1719
- }
1720
- }
1721
- /**
1722
- * Check if event type should use delegation
1723
- */
1724
- shouldDelegate(e) {
1725
- return Nt.has(e);
1726
- }
1727
- /**
1728
- * Check if event type should use passive listeners
1729
- */
1730
- shouldBePassive(e) {
1731
- return Se.has(e);
1732
- }
1733
- /**
1734
- * Get metrics for debugging
1735
- */
1736
- getMetrics(e) {
1737
- const t = this.handlerCounts.get(e);
1738
- if (!t)
1739
- return { eventTypes: [], totalHandlers: 0, handlersPerType: {} };
1740
- const s = {};
1741
- let r = 0;
1742
- return t.forEach((i, o) => {
1743
- s[o] = i, r += i;
1744
- }), {
1745
- eventTypes: Array.from(t.keys()),
1746
- totalHandlers: r,
1747
- handlersPerType: s
1748
- };
1749
- }
1750
- /**
1751
- * Cleanup all handlers for a container
1752
- */
1753
- cleanupContainer(e) {
1754
- const t = this.containerListeners.get(e);
1755
- t && (t.forEach((s, r) => {
1756
- e.removeEventListener(r, s);
1757
- }), this.containerListeners.delete(e)), this.handlerCounts.delete(e);
1758
- }
1759
- }
1760
- const ae = new Rt();
1761
- var Pt = Object.defineProperty, Ot = (n, e, t) => e in n ? Pt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, j = (n, e, t) => Ot(n, typeof e != "symbol" ? e + "" : e, t);
1762
- const le = "__tachuiManagedComponentId";
1763
- class Te {
1764
- constructor() {
1765
- j(this, "nodeMap", /* @__PURE__ */ new WeakMap()), j(this, "cleanupMap", /* @__PURE__ */ new WeakMap()), j(this, "renderedNodes", /* @__PURE__ */ new Set()), j(this, "elementToContainer", /* @__PURE__ */ new WeakMap()), j(this, "metrics", {
1766
- created: 0,
1767
- adopted: 0,
1768
- removed: 0,
1769
- inserted: 0,
1770
- moved: 0,
1771
- cacheHits: 0,
1772
- cacheMisses: 0,
1773
- attributeWrites: 0,
1774
- attributeRemovals: 0,
1775
- textUpdates: 0,
1776
- modifierApplications: 0
1777
- });
1778
- }
1779
- /**
1780
- * Render a DOM node to an actual DOM element
1781
- */
1782
- render(e, t) {
1783
- return Array.isArray(e) ? this.renderFragment(e, t) : this.renderSingle(e, t);
1784
- }
1785
- /**
1786
- * Check if a DOM node has been rendered and tracked.
1787
- */
1788
- hasNode(e) {
1789
- return this.nodeMap.has(e);
1790
- }
1791
- /**
1792
- * Get the rendered DOM element associated with a node.
1793
- */
1794
- getRenderedNode(e) {
1795
- return this.nodeMap.get(e);
1796
- }
1797
- /**
1798
- * Render a single DOM node
1799
- */
1800
- renderSingle(e, t) {
1801
- this.renderedNodes.add(e);
1802
- let s;
1803
- switch (e.type) {
1804
- case "element":
1805
- s = this.createOrUpdateElement(e, t);
1806
- break;
1807
- case "text":
1808
- s = this.createOrUpdateTextNode(e);
1809
- break;
1810
- case "comment":
1811
- s = this.createComment(e), this.metrics.created++;
1812
- break;
1813
- default:
1814
- throw new Error(`Unknown node type: ${e.type}`);
1815
- }
1816
- if (this.nodeMap.set(e, s), e.element = s, s instanceof Element && t && this.elementToContainer.set(s, t), s instanceof Element) {
1817
- let r = [];
1818
- "modifiers" in e && Array.isArray(e.modifiers) && e.modifiers.length > 0 && (r = e.modifiers), "componentMetadata" in e && e.componentMetadata?.modifiers && Array.isArray(e.componentMetadata.modifiers) && e.componentMetadata.modifiers.length > 0 && (r = e.componentMetadata.modifiers), r.length > 0 && this.applyModifiersToElement(s, r, e);
1819
- }
1820
- return e.dispose && this.addCleanup(s, e.dispose), t && this.appendNode(t, s), s;
1821
- }
1822
- /**
1823
- * Render multiple nodes as a document fragment
1824
- */
1825
- renderFragment(e, t) {
1826
- const s = document.createDocumentFragment();
1827
- return e.forEach((r) => {
1828
- const i = this.renderSingle(r);
1829
- s.appendChild(i);
1830
- }), t && (t.appendChild(s), this.metrics.inserted += e.length), s;
1831
- }
1832
- /**
1833
- * Create a DOM element with props and children
1834
- */
1835
- createOrUpdateElement(e, t) {
1836
- if (!e.tag)
1837
- throw new Error("Element node must have a tag");
1838
- if (e.element && e.element instanceof Element) {
1839
- const r = e.element;
1840
- return t && this.elementToContainer.set(r, t), this.updateProps(r, e, t), this.updateChildren(r, e), r;
1841
- }
1842
- const s = document.createElement(e.tag);
1843
- return this.metrics.created++, t && this.elementToContainer.set(s, t), this.applyDebugAttributes(s, e), this.updateProps(s, e, t), this.updateChildren(s, e), s;
1844
- }
1845
- updateProps(e, t, s) {
1846
- const r = t.props || {}, i = t.__appliedProps || {};
1847
- Object.keys(i).forEach((a) => {
1848
- if (!(a in r)) {
1849
- if (a === "key" || a === "children" || a.startsWith("on"))
1850
- return;
1851
- this.setElementProp(e, a, void 0);
1852
- }
1853
- }), Object.entries(r).forEach(([a, l]) => {
1854
- a === "key" || a === "children" || i && i[a] === l || this.applyProp(e, a, l, s);
1855
- });
1856
- const o = t.componentId;
1857
- if (o ? (e.getAttribute("data-component-id") !== String(o) && (e.setAttribute("data-component-id", String(o)), this.recordAttributeWrite()), e[le] = !0) : e.hasAttribute("data-component-id") && e[le] === !0 && (e.removeAttribute("data-component-id"), this.recordAttributeRemoval(), e[le] = !1), t.__appliedProps = { ...r }, "componentMetadata" in t && t.componentMetadata) {
1858
- const a = t.componentMetadata;
1859
- if (a.overriddenTo && a.originalType && t.tag)
1860
- try {
1861
- xt.processElementNode(
1862
- e,
1863
- t.tag,
1864
- a,
1865
- r?.aria || void 0
1866
- );
1867
- } catch (l) {
1868
- console.warn("[tachUI] Could not process semantic attributes:", l);
1869
- }
1870
- }
1871
- }
1872
- updateChildren(e, t) {
1873
- const s = t.__renderedChildren || [], r = t.children || [], i = this.elementToContainer.get(e), o = typeof process < "u" && process.env?.TACHUI_DEBUG_PHASE1B === "1";
1874
- if (s.length === r.length && s.length > 0 && s.every((c, u) => c === r[u])) {
1875
- r.forEach((c) => {
1876
- this.updateExistingNode(c);
1877
- }), t.__renderedChildren = r;
1878
- return;
1879
- }
1880
- if (s.length === 0) {
1881
- r.forEach((c) => {
1882
- if (!c || c.type == null) return;
1883
- const u = this.renderSingle(c, i);
1884
- this.appendNode(e, u);
1885
- }), t.__renderedChildren = r;
1886
- return;
1887
- }
1888
- const a = /* @__PURE__ */ new Map(), l = [];
1889
- s.forEach((c) => {
1890
- c.key != null ? a.set(c.key, c) : l.push(c);
1891
- });
1892
- const h = Array.from({ length: r.length });
1893
- if (r.forEach((c, u) => {
1894
- let f;
1895
- c.key != null ? (f = a.get(c.key), f && a.delete(c.key)) : l.length > 0 && (f = l.shift()), f && this.adoptNode(f, c);
1896
- const p = this.renderSingle(c, i);
1897
- h[u] = p;
1898
- }), o && t.tag) {
1899
- const c = r.map((p) => p.key ?? null), u = s.map((p) => p.key ?? null), f = h.map(
1900
- (p) => p && "getAttribute" in p ? p.getAttribute("data-id") : null
1901
- );
1902
- console.log("[diff] state", {
1903
- parent: t.tag,
1904
- prev: u,
1905
- next: c,
1906
- dom: f
1907
- });
1908
- }
1909
- if (a.forEach((c) => {
1910
- this.removeNode(c);
1911
- }), l.forEach((c) => {
1912
- this.removeNode(c);
1913
- }), typeof e.insertBefore == "function" && typeof e.appendChild == "function") {
1914
- let c = null;
1915
- for (let u = h.length - 1; u >= 0; u--) {
1916
- const f = h[u];
1917
- f && (this.insertNode(e, f, c), c = f);
1918
- }
1919
- }
1920
- t.__renderedChildren = r;
1921
- }
1922
- updateExistingNode(e) {
1923
- if (e.type === "element" && e.element instanceof Element) {
1924
- const t = this.elementToContainer.get(e.element);
1925
- this.updateProps(e.element, e, t), this.updateChildren(e.element, e);
1926
- } else e.type === "text" && e.element instanceof Text && e.element.textContent !== e.text && (e.element.textContent = e.text || "", this.recordTextUpdate());
1927
- }
1928
- /**
1929
- * Apply debug attributes to DOM element if debug mode is enabled
1930
- */
1931
- applyDebugAttributes(e, t) {
1932
- }
1933
- /**
1934
- * Create or update a text node
1935
- */
1936
- createOrUpdateTextNode(e) {
1937
- if (e.element && e.element instanceof Text) {
1938
- const t = e.element;
1939
- if (t.textContent !== e.text && (t.textContent = e.text || "", this.recordTextUpdate()), e.reactiveContent && !e.dispose) {
1940
- const s = e.reactiveContent, r = T(() => {
1941
- try {
1942
- const i = s();
1943
- e.text = String(i);
1944
- const o = t.parentElement;
1945
- if (o && o.__tachui_asHTML)
1946
- return;
1947
- t.textContent = e.text, this.recordTextUpdate();
1948
- } catch (i) {
1949
- console.error("createOrUpdateTextNode() reactive effect error:", i);
1950
- }
1951
- });
1952
- e.dispose = () => {
1953
- r.dispose();
1954
- };
1955
- }
1956
- return t;
1957
- }
1958
- return this.createTextNode(e);
1959
- }
1960
- /**
1961
- * Create a text node
1962
- */
1963
- createTextNode(e) {
1964
- const t = document.createTextNode(e.text || "");
1965
- if (this.metrics.created++, this.recordTextUpdate(), e.reactiveContent) {
1966
- const s = e.reactiveContent, r = T(() => {
1967
- try {
1968
- const i = s();
1969
- e.text = String(i);
1970
- const o = t.parentElement;
1971
- if (o && o.__tachui_asHTML)
1972
- return;
1973
- t.textContent = e.text, this.recordTextUpdate();
1974
- } catch (i) {
1975
- console.error("createTextNode() reactive effect error:", i);
1976
- }
1977
- });
1978
- e.dispose = () => {
1979
- r.dispose();
1980
- };
1981
- }
1982
- return t;
1983
- }
1984
- /**
1985
- * Create a comment node
1986
- */
1987
- createComment(e) {
1988
- return this.metrics.created++, document.createComment(e.text || "");
1989
- }
1990
- /**
1991
- * Apply props to a DOM element with reactive updates
1992
- */
1993
- applyProps(e, t) {
1994
- Object.entries(t).forEach(([s, r]) => {
1995
- this.applyProp(e, s, r);
1996
- });
1997
- }
1998
- /**
1999
- * Apply a single prop to an element
2000
- */
2001
- applyProp(e, t, s, r) {
2002
- if (t === "className" || t === "class") {
2003
- this.applyClassName(e, s);
2004
- return;
2005
- }
2006
- if (t === "style") {
2007
- this.applyStyle(e, s);
2008
- return;
2009
- }
2010
- if (t.startsWith("on") && typeof s == "function") {
2011
- this.applyEventListener(e, t, s, r);
2012
- return;
2013
- }
2014
- if (F(s) || B(s)) {
2015
- const i = T(() => {
2016
- const o = s();
2017
- this.setElementProp(e, t, o);
2018
- });
2019
- this.addCleanup(e, () => {
2020
- i.dispose();
2021
- });
2022
- return;
2023
- }
2024
- this.setElementProp(e, t, s);
2025
- }
2026
- /**
2027
- * Set a property on an element
2028
- */
2029
- setElementProp(e, t, s) {
2030
- if (s == null) {
2031
- e.hasAttribute(t) && (e.removeAttribute(t), this.recordAttributeRemoval());
2032
- return;
2033
- }
2034
- const r = e;
2035
- if ((t === "value" || t === "checked" || t === "disabled") && t in r) {
2036
- r[t] !== s && (r[t] = s, this.recordAttributeWrite());
2037
- return;
2038
- }
2039
- if (typeof s == "boolean") {
2040
- s ? e.hasAttribute(t) || (e.setAttribute(t, ""), this.recordAttributeWrite()) : e.hasAttribute(t) ? (e.removeAttribute(t), this.recordAttributeRemoval()) : e.removeAttribute(t);
2041
- return;
2042
- }
2043
- const i = e.getAttribute(t), o = String(s);
2044
- i !== o && (e.setAttribute(t, o), this.recordAttributeWrite());
2045
- }
2046
- /**
2047
- * Apply className with reactive updates
2048
- */
2049
- applyClassName(e, t) {
2050
- if (F(t) || B(t)) {
2051
- const s = T(() => {
2052
- const r = t(), i = this.normalizeClassName(r);
2053
- e.className !== i && (e.className = i, this.recordAttributeWrite());
2054
- });
2055
- this.addCleanup(e, () => {
2056
- s.dispose();
2057
- });
2058
- } else {
2059
- const s = this.normalizeClassName(t);
2060
- e.className !== s && (e.className = s, this.recordAttributeWrite());
2061
- }
2062
- }
2063
- /**
2064
- * Normalize className value
2065
- */
2066
- normalizeClassName(e) {
2067
- return Array.isArray(e) ? e.filter(Boolean).join(" ") : typeof e == "object" && e !== null ? Object.entries(e).filter(([, t]) => !!t).map(([t]) => t).join(" ") : String(e || "");
2068
- }
2069
- /**
2070
- * Apply styles with reactive updates
2071
- */
2072
- applyStyle(e, t) {
2073
- const s = e;
2074
- if (F(t) || B(t)) {
2075
- const r = T(() => {
2076
- const i = t();
2077
- this.setElementStyles(s, i);
2078
- });
2079
- this.addCleanup(e, () => {
2080
- r.dispose();
2081
- });
2082
- } else
2083
- this.setElementStyles(s, t);
2084
- }
2085
- /**
2086
- * Set styles on an element
2087
- */
2088
- setElementStyles(e, t) {
2089
- if (typeof t == "string") {
2090
- e.style.cssText !== t && (e.style.cssText = t, this.recordAttributeWrite());
2091
- return;
2092
- }
2093
- if (typeof t == "object" && t !== null) {
2094
- const s = e.__appliedStyles || {};
2095
- Object.keys(s).forEach((r) => {
2096
- r in t || (e.style.removeProperty(r.replace(/[A-Z]/g, (i) => `-${i.toLowerCase()}`)), this.recordAttributeRemoval());
2097
- }), Object.entries(t).forEach(([r, i]) => {
2098
- if (F(i) || B(i)) {
2099
- const o = T(() => {
2100
- const a = i(), l = r.replace(/[A-Z]/g, (h) => `-${h.toLowerCase()}`);
2101
- if (a == null)
2102
- e.style.removeProperty(l), this.recordAttributeRemoval();
2103
- else {
2104
- const h = String(a);
2105
- e.style.getPropertyValue(l) !== h && (e.style.setProperty(l, h), this.recordAttributeWrite());
2106
- }
2107
- });
2108
- this.addCleanup(e, () => {
2109
- o.dispose();
2110
- });
2111
- } else {
2112
- const o = r.replace(/[A-Z]/g, (a) => `-${a.toLowerCase()}`);
2113
- if (i == null)
2114
- e.style.getPropertyValue(o) && (e.style.removeProperty(o), this.recordAttributeRemoval());
2115
- else {
2116
- const a = String(i);
2117
- e.style.getPropertyValue(o) !== a && (e.style.setProperty(o, a), this.recordAttributeWrite());
2118
- }
2119
- }
2120
- }), e.__appliedStyles = { ...t };
2121
- }
2122
- }
2123
- /**
2124
- * Apply event listener (with delegation if possible)
2125
- */
2126
- applyEventListener(e, t, s, r) {
2127
- let i = t.slice(2).toLowerCase();
2128
- i === "focus" ? i = "focusin" : i === "blur" && (i = "focusout");
2129
- const o = r || this.elementToContainer.get(e);
2130
- if (o && ae.shouldDelegate(i)) {
2131
- const h = ae.register(
2132
- o,
2133
- e,
2134
- i,
2135
- s
2136
- );
2137
- this.addCleanup(e, h);
2138
- return;
2139
- }
2140
- const a = (h) => {
2141
- try {
2142
- s(h);
2143
- } catch (c) {
2144
- console.error(`Event handler error for ${t}:`, c);
2145
- }
2146
- }, l = ae.shouldBePassive(i) ? { passive: !0 } : void 0;
2147
- e.addEventListener(i, a, l), this.addCleanup(e, () => {
2148
- e.removeEventListener(i, a, l);
2149
- });
2150
- }
2151
- /**
2152
- * Add cleanup function for an element
2153
- */
2154
- addCleanup(e, t) {
2155
- const s = this.cleanupMap.get(e) || [];
2156
- s.push(t), this.cleanupMap.set(e, s);
2157
- }
2158
- /**
2159
- * Update an existing DOM node
2160
- */
2161
- updateNode(e, t) {
2162
- const s = this.nodeMap.get(e);
2163
- !s || typeof s.setAttribute != "function" || t && this.applyProps(s, t);
2164
- }
2165
- /**
2166
- * Remove a DOM node and run cleanup
2167
- */
2168
- removeNode(e) {
2169
- this.cleanupNode(e, !0);
2170
- }
2171
- /**
2172
- * Cleanup a node (and its descendants) and optionally remove from DOM.
2173
- */
2174
- cleanupNode(e, t) {
2175
- const s = this.nodeMap.get(e);
2176
- if (e.children && e.children.length > 0 && e.children.forEach((i) => {
2177
- this.cleanupNode(i, !1);
2178
- }), !s) {
2179
- e.element !== void 0 && (e.element = void 0), this.renderedNodes.delete(e), this.nodeMap.delete(e);
2180
- return;
2181
- }
2182
- const r = this.cleanupMap.get(s);
2183
- r && (r.forEach((i) => {
2184
- try {
2185
- i();
2186
- } catch (o) {
2187
- console.error("Cleanup error:", o);
2188
- }
2189
- }), this.cleanupMap.delete(s)), t && s.parentNode && s.parentNode.removeChild(s), this.nodeMap.delete(e), e.element !== void 0 && (e.element = void 0), this.renderedNodes.delete(e), this.metrics.removed++;
2190
- }
2191
- /**
2192
- * Create reactive text content
2193
- */
2194
- createReactiveText(e) {
2195
- const t = document.createTextNode("");
2196
- return T(() => {
2197
- t.textContent = e();
2198
- }), t;
2199
- }
2200
- /**
2201
- * Create reactive element with dynamic props
2202
- */
2203
- createReactiveElement(e, t, s) {
2204
- const r = document.createElement(e);
2205
- return T(() => {
2206
- const i = t();
2207
- this.applyProps(r, i);
2208
- }), s && s.forEach((i) => {
2209
- const o = this.renderSingle(i);
2210
- r.appendChild(o);
2211
- }), r;
2212
- }
2213
- /**
2214
- * Apply modifiers to a DOM element
2215
- */
2216
- applyModifiersToElement(e, t, s) {
2217
- try {
2218
- t.length > 0 && this.recordModifierApplications(t.length);
2219
- const r = s.componentInstance || s.componentMetadata && s.componentMetadata.componentInstance || s._originalComponent || // Use original component if available
2220
- s;
2221
- Me(
2222
- s,
2223
- t,
2224
- {
2225
- element: e,
2226
- componentId: s.componentId || "unknown",
2227
- phase: "creation",
2228
- componentInstance: r
2229
- // Pass the component instance
2230
- },
2231
- {
2232
- batch: !0
2233
- // Enable batched modifier application
2234
- }
2235
- );
2236
- } catch (r) {
2237
- console.error("Failed to apply modifiers to element:", r);
2238
- }
2239
- }
2240
- /**
2241
- * Adopt an existing DOM mapping from one node to another.
2242
- */
2243
- adoptNode(e, t) {
2244
- const s = this.nodeMap.get(e);
2245
- s && (this.nodeMap.set(t, s), this.nodeMap.delete(e), this.renderedNodes.delete(e), this.renderedNodes.add(t), t.element = s, e.dispose && (t.dispose = e.dispose), e.__renderedChildren && (t.__renderedChildren = e.__renderedChildren), e.__appliedProps && (t.__appliedProps = { ...e.__appliedProps }), this.metrics.adopted++);
2246
- }
2247
- /**
2248
- * Cleanup all tracked elements
2249
- */
2250
- cleanup() {
2251
- for (const e of this.renderedNodes)
2252
- if (e.dispose && typeof e.dispose == "function")
2253
- try {
2254
- e.dispose();
2255
- } catch (t) {
2256
- console.error("Cleanup error:", t);
2257
- }
2258
- this.renderedNodes.clear(), this.nodeMap = /* @__PURE__ */ new WeakMap(), this.cleanupMap = /* @__PURE__ */ new WeakMap(), this.resetMetrics();
2259
- }
2260
- resetMetrics() {
2261
- this.metrics = {
2262
- created: 0,
2263
- adopted: 0,
2264
- removed: 0,
2265
- inserted: 0,
2266
- moved: 0,
2267
- cacheHits: 0,
2268
- cacheMisses: 0,
2269
- attributeWrites: 0,
2270
- attributeRemovals: 0,
2271
- textUpdates: 0,
2272
- modifierApplications: 0
2273
- };
2274
- }
2275
- getMetrics() {
2276
- return { ...this.metrics };
2277
- }
2278
- recordCacheHit() {
2279
- this.metrics.cacheHits++;
2280
- }
2281
- recordCacheMiss() {
2282
- this.metrics.cacheMisses++;
2283
- }
2284
- insertNode(e, t, s) {
2285
- const r = typeof process < "u" && process.env?.TACHUI_DEBUG_PHASE1B === "1";
2286
- t.parentNode !== e ? (r && console.log("[diff] insertNode append", {
2287
- tag: "tagName" in t ? t.tagName : "text",
2288
- before: s && "getAttribute" in s ? s.getAttribute("data-id") : null
2289
- }), e.insertBefore(t, s), this.metrics.inserted++) : t.nextSibling !== s && (r && console.log("[diff] insertNode move", {
2290
- tag: "tagName" in t ? t.tagName : "text",
2291
- before: s && "getAttribute" in s ? s.getAttribute("data-id") : null
2292
- }), e.insertBefore(t, s), this.metrics.moved++);
2293
- }
2294
- appendNode(e, t) {
2295
- t.parentNode !== e && (e.appendChild(t), this.metrics.inserted++);
2296
- }
2297
- recordAttributeWrite() {
2298
- this.metrics.attributeWrites++;
2299
- }
2300
- recordAttributeRemoval() {
2301
- this.metrics.attributeRemovals++;
2302
- }
2303
- recordTextUpdate() {
2304
- this.metrics.textUpdates++;
2305
- }
2306
- recordModifierApplications(e) {
2307
- this.metrics.modifierApplications += e;
2308
- }
2309
- }
2310
- new Te();
2311
- function Lt(n, e, ...t) {
2312
- const s = t.flat().filter((i) => i != null).map((i) => typeof i == "string" || typeof i == "number" ? { type: "text", text: String(i) } : i), r = {
2313
- type: "element",
2314
- tag: n,
2315
- props: e || {},
2316
- children: s,
2317
- key: e?.key ?? void 0
2318
- };
2319
- return e && "componentMetadata" in e && (r.componentMetadata = e.componentMetadata), r;
2320
- }
2321
- var kt = Object.defineProperty, Dt = (n, e, t) => e in n ? kt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, O = (n, e, t) => Dt(n, typeof e != "symbol" ? e + "" : e, t);
2322
- let Y = class ee {
2323
- // Required by ModifiableComponent interface
2324
- constructor(e, t, s = !0) {
2325
- this.metadata = t, O(this, "type", "component"), O(this, "id"), O(this, "mounted", !1), O(this, "cleanup", []), O(this, "props", {}), O(this, "segments"), O(this, "modifiers", []), this.id = `concat-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, this.segments = e;
2326
- }
2327
- /**
2328
- * Render the concatenated component to DOM nodes (Enhanced - Phase 4.2)
2329
- */
2330
- render() {
2331
- const e = this.determineContainerClass(), t = this.buildAccessibilityLabel(), s = this.buildAccessibilityAttributes(), r = this.modifiers && this.modifiers.some((o) => o.type === "asHTML");
2332
- let i;
2333
- return r ? i = this.renderSegmentsWithAsHTML() : i = this.segments.map((o) => o.render()).flat(), [Lt("span", {
2334
- class: `tachui-concatenated ${e}`,
2335
- ...s,
2336
- "aria-label": t || void 0,
2337
- // Enhanced live region support for dynamic content
2338
- ...this.hasInteractiveContent() && {
2339
- "aria-live": "polite",
2340
- "aria-atomic": "true"
2341
- },
2342
- // Add debug information in development
2343
- ...process.env.NODE_ENV === "development" && {
2344
- "data-concatenated-segments": this.segments.length,
2345
- "data-semantic-structure": this.metadata.semanticStructure,
2346
- "data-accessibility-role": this.metadata.accessibilityRole
2347
- }
2348
- }, ...i)];
2349
- }
2350
- /**
2351
- * Build comprehensive accessibility attributes
2352
- */
2353
- buildAccessibilityAttributes() {
2354
- const e = {};
2355
- switch (this.metadata.accessibilityRole) {
2356
- case "text":
2357
- break;
2358
- case "group":
2359
- e.role = "group", e["aria-describedby"] = this.generateGroupDescription();
2360
- break;
2361
- case "composite":
2362
- e.role = "group", e["aria-roledescription"] = "interactive content group";
2363
- break;
2364
- }
2365
- return this.metadata.semanticStructure === "mixed" && this.segments.length > 2 && (e["aria-flowto"] = this.generateFlowTargets()), this.hasInteractiveContent() && (e.tabindex = "0", e["aria-description"] = "Contains interactive elements. Use Tab to navigate."), e;
2366
- }
2367
- /**
2368
- * Generate description for grouped content
2369
- */
2370
- generateGroupDescription() {
2371
- const e = this.getUniqueComponentTypes();
2372
- return e.length === 1 ? `Group of ${this.segments.length} ${e[0]} elements` : `Group containing ${e.join(", ")} elements`;
2373
- }
2374
- /**
2375
- * Generate flow targets for reading order
2376
- */
2377
- generateFlowTargets() {
2378
- return "";
2379
- }
2380
- /**
2381
- * Check if concatenated content contains interactive elements
2382
- */
2383
- hasInteractiveContent() {
2384
- return this.segments.some((e) => {
2385
- const t = e.component.constructor.name;
2386
- return t === "EnhancedButton" || t === "EnhancedLinkComponent";
2387
- });
2388
- }
2389
- /**
2390
- * Get unique component types in this concatenation
2391
- */
2392
- getUniqueComponentTypes() {
2393
- const e = new Set(this.segments.map((t) => {
2394
- switch (t.component.constructor.name) {
2395
- case "EnhancedText":
2396
- return "text";
2397
- case "EnhancedImage":
2398
- return "image";
2399
- case "EnhancedButton":
2400
- return "button";
2401
- case "EnhancedLinkComponent":
2402
- return "link";
2403
- default:
2404
- return "component";
2405
- }
2406
- }));
2407
- return Array.from(e);
2408
- }
2409
- /**
2410
- * Concatenate this component with another concatenatable component
2411
- */
2412
- concat(e) {
2413
- let t, s;
2414
- return e instanceof ee ? (t = [...this.segments, ...e.segments], s = this.mergeMetadata(this.metadata, e.metadata, t.length)) : (t = [...this.segments, e.toSegment()], s = this.mergeMetadata(
2415
- this.metadata,
2416
- {
2417
- totalSegments: 1,
2418
- accessibilityRole: this.determineComponentAccessibilityRole(e),
2419
- semanticStructure: this.determineComponentSemanticStructure(e)
2420
- },
2421
- t.length
2422
- )), new ee(t, s);
2423
- }
2424
- /**
2425
- * Convert this concatenated component to a segment (for further concatenation)
2426
- */
2427
- toSegment() {
2428
- return {
2429
- id: this.id,
2430
- component: this,
2431
- // Cast to satisfy interface requirements
2432
- modifiers: [],
2433
- // Concatenated components don't have their own modifiers
2434
- render: () => this.render()[0]
2435
- };
2436
- }
2437
- /**
2438
- * Check if this component supports concatenation
2439
- */
2440
- isConcatenatable() {
2441
- return !0;
2442
- }
2443
- /**
2444
- * Determine the appropriate CSS class for the container
2445
- */
2446
- determineContainerClass() {
2447
- const e = this.segments.map((o) => o.component.constructor.name), t = e.some((o) => o === "EnhancedImage"), s = e.some((o) => o === "EnhancedText"), r = e.some((o) => o === "EnhancedButton"), i = e.some((o) => o === "EnhancedLink");
2448
- return t && s && (r || i) ? "mixed-content" : t && s ? "image-text-composition" : t && !s ? "image-composition" : s && !t ? "text-composition" : "generic-composition";
2449
- }
2450
- /**
2451
- * Build comprehensive accessibility label for screen readers (Enhanced - Phase 4.2)
2452
- */
2453
- buildAccessibilityLabel() {
2454
- const e = this.segments.map((t) => this.extractAccessibilityText(t)).filter(Boolean);
2455
- return e.length === 0 ? "" : this.joinAccessibilityLabels(e);
2456
- }
2457
- /**
2458
- * Intelligently join accessibility labels based on content and structure
2459
- */
2460
- joinAccessibilityLabels(e) {
2461
- if (e.length === 1) return e[0];
2462
- switch (this.metadata.semanticStructure) {
2463
- case "inline":
2464
- return e.join(" ");
2465
- case "block":
2466
- return e.join(". ");
2467
- case "mixed":
2468
- return this.smartJoinLabels(e);
2469
- default:
2470
- return e.join(" ");
2471
- }
2472
- }
2473
- /**
2474
- * Context-aware label joining for mixed content
2475
- */
2476
- smartJoinLabels(e) {
2477
- const t = [];
2478
- for (let s = 0; s < e.length; s++) {
2479
- const r = e[s], i = e[s + 1];
2480
- t.push(r), i && (this.needsExplicitSeparator(r, i) ? t.push(". ") : t.push(" "));
2481
- }
2482
- return t.join("");
2483
- }
2484
- /**
2485
- * Determine if two accessibility labels need explicit separation
2486
- */
2487
- needsExplicitSeparator(e, t) {
2488
- const s = /[.!?:;]$/.test(e.trim()), r = /^[A-Z]/.test(t.trim());
2489
- return !s && r;
2490
- }
2491
- /**
2492
- * Extract accessibility text from a component segment
2493
- */
2494
- extractAccessibilityText(e) {
2495
- const t = e.component;
2496
- switch (t.constructor.name) {
2497
- case "EnhancedText":
2498
- return t.content || t.title || "";
2499
- case "EnhancedImage":
2500
- return t.alt || t.accessibilityLabel || "Image";
2501
- case "EnhancedButton":
2502
- return t.title || t.accessibilityLabel || "Button";
2503
- case "EnhancedLink":
2504
- return t.title || t.accessibilityLabel || "Link";
2505
- case "ConcatenatedComponent":
2506
- return t.buildAccessibilityLabel();
2507
- default:
2508
- return t.accessibilityLabel || "";
2509
- }
2510
- }
2511
- /**
2512
- * Merge metadata from two concatenation operations
2513
- */
2514
- mergeMetadata(e, t, s) {
2515
- return {
2516
- totalSegments: s,
2517
- accessibilityRole: this.mergeAccessibilityRoles(
2518
- e.accessibilityRole,
2519
- t.accessibilityRole
2520
- ),
2521
- semanticStructure: this.mergeSemanticStructures(
2522
- e.semanticStructure,
2523
- t.semanticStructure
2524
- )
2525
- };
2526
- }
2527
- /**
2528
- * Merge accessibility roles from two components
2529
- */
2530
- mergeAccessibilityRoles(e, t) {
2531
- return e === "text" && t === "text" ? "text" : e === "composite" || t === "composite" ? "composite" : "group";
2532
- }
2533
- /**
2534
- * Merge semantic structures from two components
2535
- */
2536
- mergeSemanticStructures(e, t) {
2537
- return e === "inline" && t === "inline" ? "inline" : e === "block" && t === "block" ? "block" : "mixed";
2538
- }
2539
- /**
2540
- * Determine accessibility role for a single component
2541
- */
2542
- determineComponentAccessibilityRole(e) {
2543
- switch (e.constructor.name) {
2544
- case "EnhancedText":
2545
- return "text";
2546
- case "EnhancedImage":
2547
- return "group";
2548
- case "EnhancedButton":
2549
- case "EnhancedLink":
2550
- return "group";
2551
- default:
2552
- return "composite";
2553
- }
2554
- }
2555
- /**
2556
- * Determine semantic structure for a single component
2557
- */
2558
- determineComponentSemanticStructure(e) {
2559
- switch (e.constructor.name) {
2560
- case "EnhancedText":
2561
- case "EnhancedImage":
2562
- return "inline";
2563
- case "EnhancedButton":
2564
- case "EnhancedLink":
2565
- return "inline";
2566
- // Buttons and links are typically inline in concatenation
2567
- default:
2568
- return "mixed";
2569
- }
2570
- }
2571
- /**
2572
- * Special rendering method for segments with asHTML modifiers
2573
- */
2574
- renderSegmentsWithAsHTML() {
2575
- const e = this.modifiers?.filter((s) => s.type === "asHTML") || [], t = [];
2576
- for (const s of this.segments) {
2577
- const r = s.render(), i = Array.isArray(r) ? r : [r];
2578
- if (this.isTextSegment(s) && i.length > 0) {
2579
- const o = this.applyAsHTMLToSegment(i[0], e, s);
2580
- t.push(o);
2581
- } else
2582
- t.push(...i);
2583
- }
2584
- return t;
2585
- }
2586
- /**
2587
- * Check if a segment represents a Text component
2588
- */
2589
- isTextSegment(e) {
2590
- const t = e.component;
2591
- return t ? t.constructor?.name === "TextComponent" || t.constructor?.name === "EnhancedText" || t.__tachui_component_type === "Text" || t.componentMetadata?.originalType === "Text" : !1;
2592
- }
2593
- /**
2594
- * Apply asHTML modifiers to a segment with proper component context
2595
- */
2596
- applyAsHTMLToSegment(e, t, s) {
2597
- const r = {
2598
- element: void 0,
2599
- // Will be set when the node is rendered to DOM
2600
- componentId: s.id,
2601
- phase: "creation",
2602
- componentInstance: s.component
2603
- // Pass the original component
2604
- };
2605
- return Me(e, t, r, { batch: !0 });
2606
- }
2607
- /**
2608
- * Generate comprehensive accessibility tree for this concatenated component
2609
- */
2610
- generateAccessibilityTree() {
2611
- return {
2612
- role: this.metadata.accessibilityRole,
2613
- label: this.buildAccessibilityLabel(),
2614
- children: this.segments.map((e) => this.segmentToAccessibilityNode(e))
2615
- };
2616
- }
2617
- /**
2618
- * Convert a component segment to an accessibility node
2619
- */
2620
- segmentToAccessibilityNode(e) {
2621
- const t = e.component;
2622
- return {
2623
- role: this.determineComponentAccessibilityRole(t),
2624
- label: this.extractAccessibilityText(e),
2625
- children: t instanceof ee ? t.generateAccessibilityTree().children : void 0
2626
- };
2627
- }
2628
- };
2629
- const zt = {
2630
- proxyModifiers: !0
2631
- };
2632
- let _t = { ...zt };
2633
- function $e() {
2634
- return _t.proxyModifiers === !0;
2635
- }
2636
- let we = /* @__PURE__ */ new WeakMap(), Ht = /* @__PURE__ */ new WeakMap(), Vt = /* @__PURE__ */ new WeakMap(), jt = /* @__PURE__ */ new WeakMap();
2637
- function $(n) {
2638
- if (Object.prototype.hasOwnProperty.call(n, "modifiers") && Object.prototype.hasOwnProperty.call(n, "modifierBuilder"))
2639
- return n;
2640
- if (!n._modifiableComponent) {
2641
- const e = te(n);
2642
- Object.prototype.hasOwnProperty.call(n, "modifier") || Object.defineProperty(n, "modifier", {
2643
- configurable: !0,
2644
- enumerable: !1,
2645
- get() {
2646
- return e.modifierBuilder;
2647
- },
2648
- set(t) {
2649
- Object.defineProperty(n, "modifier", {
2650
- configurable: !0,
2651
- enumerable: !1,
2652
- writable: !0,
2653
- value: t
2654
- });
2655
- }
2656
- }), n._modifiableComponent = e;
2657
- }
2658
- return n._modifiableComponent;
2659
- }
2660
- function ue(n) {
2661
- if (!$e())
2662
- return n;
2663
- const e = we.get(n);
2664
- if (e)
2665
- return e;
2666
- const t = /* @__PURE__ */ new Map();
2667
- Ht.set(n, t);
2668
- const s = /* @__PURE__ */ new Map();
2669
- Vt.set(n, s);
2670
- const r = /* @__PURE__ */ new Map();
2671
- jt.set(n, r);
2672
- const i = {
2673
- get(a, l, h) {
2674
- if (l === Symbol.toStringTag)
2675
- return Reflect.get(a, l, h);
2676
- if (l === "render") {
2677
- if (r.has(l))
2678
- return r.get(l);
2679
- const c = $(a);
2680
- if (typeof c.render == "function") {
2681
- const u = c.render.bind(c);
2682
- return r.set(l, u), u;
2683
- }
2684
- return Reflect.get(a, l, h);
2685
- }
2686
- if (l === "build") {
2687
- const c = $(a), u = c.modifierBuilder || c.modifier;
2688
- if (u && typeof u.build == "function") {
2689
- const f = u.build.bind(u);
2690
- return (...p) => {
2691
- const v = f(...p);
2692
- return v && typeof v == "object" && !Array.isArray(v) ? ue(
2693
- v
2694
- ) : v;
2695
- };
2696
- }
2697
- return;
2698
- }
2699
- if (l === "modifiers" || l === "modifier" || l === "modifierBuilder") {
2700
- if (l === "modifier") {
2701
- const u = Object.getOwnPropertyDescriptor(
2702
- a,
2703
- "modifier"
2704
- );
2705
- if (u && "value" in u)
2706
- return u.value;
2707
- }
2708
- const c = $(a);
2709
- return l === "modifiers" ? c.modifiers : c.modifierBuilder;
2710
- }
2711
- if (typeof l == "string") {
2712
- let c;
2713
- if (t.has(l) && (c = V.get(l), c)) {
2714
- const p = s.get(l);
2715
- p !== void 0 && p !== c && (t.delete(l), s.delete(l));
2716
- }
2717
- if (Reflect.has(a, l)) {
2718
- const p = Reflect.get(a, l, a);
2719
- if (typeof p != "function")
2720
- return p;
2721
- }
2722
- const u = $(a), f = u.modifierBuilder || u.modifier;
2723
- if (f) {
2724
- const p = f[l];
2725
- if (typeof p == "function") {
2726
- if (!t.has(l)) {
2727
- const v = (...L) => {
2728
- const C = $(a), E = C.modifierBuilder || C.modifier, fe = E?.[l];
2729
- if (typeof fe != "function")
2730
- throw new Error(
2731
- `Modifier '${String(l)}' is not callable`
2732
- );
2733
- const re = fe.apply(E, L);
2734
- return re && re !== E ? re : o;
2735
- };
2736
- t.set(l, v), s.set(
2737
- l,
2738
- c ?? V.get(l)
2739
- );
2740
- }
2741
- return t.get(l);
2742
- }
2743
- if (p !== void 0)
2744
- return p;
2745
- }
2746
- if (V.has(l)) {
2747
- if (!t.has(l)) {
2748
- const p = (...v) => {
2749
- const L = $(a), C = L.modifierBuilder || L.modifier, E = C?.[l];
2750
- if (typeof E != "function")
2751
- throw new Error(`Modifier '${String(l)}' is not callable`);
2752
- return E.apply(C, v), o;
2753
- };
2754
- t.set(l, p), s.set(
2755
- l,
2756
- c ?? V.get(l)
2757
- );
2758
- }
2759
- return t.get(l);
2760
- }
2761
- }
2762
- if (Reflect.has(a, l)) {
2763
- const c = Reflect.get(a, l, a);
2764
- return typeof c == "function" ? l === "clone" ? (...u) => {
2765
- const f = c.apply(a, u);
2766
- return f && typeof f == "object" ? ue(f) : f;
2767
- } : (r.has(l) || r.set(l, c.bind(a)), r.get(l)) : c;
2768
- }
2769
- },
2770
- has(a, l) {
2771
- if (l === "modifiers" || l === "modifier" || l === "modifierBuilder")
2772
- return !0;
2773
- if (typeof l == "string") {
2774
- const h = a._modifiableComponent || $(a), c = h?.modifierBuilder || h?.modifier;
2775
- if (c && typeof c[l] == "function")
2776
- return !0;
2777
- }
2778
- return Reflect.has(a, l) || V.has(l);
2779
- },
2780
- set(a, l, h, c) {
2781
- if (l === "modifier")
2782
- return Object.defineProperty(a, "modifier", {
2783
- configurable: !0,
2784
- enumerable: !1,
2785
- writable: !0,
2786
- value: h
2787
- }), t.clear(), !0;
2788
- if (l === "modifiers" && Array.isArray(h)) {
2789
- const u = $(a);
2790
- return u.modifiers = [...h], !0;
2791
- }
2792
- return Reflect.set(a, l, h, c);
2793
- }
2794
- }, o = new Proxy(n, i);
2795
- return we.set(n, o), o;
2796
- }
2797
- var Ft = Object.defineProperty, Bt = (n, e, t) => e in n ? Ft(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, M = (n, e, t) => Bt(n, typeof e != "symbol" ? e + "" : e, t);
2798
- class Wt {
2799
- constructor(e, t) {
2800
- M(this, "id"), M(this, "parent"), M(this, "providers", /* @__PURE__ */ new Map()), M(this, "consumers", /* @__PURE__ */ new Set()), M(this, "cleanup", /* @__PURE__ */ new Set()), M(this, "stateStore", /* @__PURE__ */ new Map()), M(this, "bindingStore", /* @__PURE__ */ new Map()), M(this, "createdAt", Date.now()), M(this, "updateCount", 0), this.id = e, this.parent = t;
2801
- }
2802
- /**
2803
- * Store state value for a property
2804
- */
2805
- setState(e, t) {
2806
- this.stateStore.set(e, t), this.updateCount++;
2807
- }
2808
- /**
2809
- * Get state value for a property
2810
- */
2811
- getState(e) {
2812
- return this.stateStore.get(e);
2813
- }
2814
- /**
2815
- * Check if state exists for a property
2816
- */
2817
- hasState(e) {
2818
- return this.stateStore.has(e);
2819
- }
2820
- /**
2821
- * Store binding for a property
2822
- */
2823
- setBinding(e, t) {
2824
- this.bindingStore.set(e, t);
2825
- }
2826
- /**
2827
- * Get binding for a property
2828
- */
2829
- getBinding(e) {
2830
- return this.bindingStore.get(e);
2831
- }
2832
- /**
2833
- * Provide a value for dependency injection
2834
- */
2835
- provide(e, t) {
2836
- this.providers.set(e, t);
2837
- }
2838
- /**
2839
- * Consume a value from dependency injection hierarchy
2840
- */
2841
- consume(e) {
2842
- if (this.consumers.add(e), this.providers.has(e))
2843
- return this.providers.get(e);
2844
- let t = this.parent;
2845
- for (; t; ) {
2846
- if (t.providers.has(e))
2847
- return t.providers.get(e);
2848
- t = t.parent;
2849
- }
2850
- }
2851
- /**
2852
- * Register cleanup function
2853
- */
2854
- onCleanup(e) {
2855
- this.cleanup.add(e);
2856
- }
2857
- /**
2858
- * Dispose of context and run cleanup
2859
- */
2860
- dispose() {
2861
- for (const e of this.cleanup)
2862
- try {
2863
- e();
2864
- } catch (t) {
2865
- console.error(`Error in component context cleanup (${this.id}):`, t);
2866
- }
2867
- this.cleanup.clear(), this.stateStore.clear(), this.bindingStore.clear(), this.providers.clear(), this.consumers.clear();
2868
- }
2869
- /**
2870
- * Get performance metrics
2871
- */
2872
- getMetrics() {
2873
- return {
2874
- id: this.id,
2875
- createdAt: this.createdAt,
2876
- updateCount: this.updateCount,
2877
- stateCount: this.stateStore.size,
2878
- bindingCount: this.bindingStore.size,
2879
- providerCount: this.providers.size,
2880
- consumerCount: this.consumers.size
2881
- };
2882
- }
2883
- }
2884
- function Ut(n, e) {
2885
- return new Wt(n, e);
2886
- }
2887
- var Qt = Object.defineProperty, qt = (n, e, t) => e in n ? Qt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, H = (n, e, t) => qt(n, typeof e != "symbol" ? e + "" : e, t);
2888
- const Gt = class U {
2889
- constructor() {
2890
- H(this, "components", /* @__PURE__ */ new Map()), H(this, "contexts", /* @__PURE__ */ new Map()), H(this, "cleanupQueue", /* @__PURE__ */ new Set()), H(this, "updateQueue", /* @__PURE__ */ new Set()), H(this, "isUpdating", !1);
2891
- }
2892
- static getInstance() {
2893
- return U.instance || (U.instance = new U()), U.instance;
2894
- }
2895
- /**
2896
- * Register a new component instance
2897
- */
2898
- registerComponent(e) {
2899
- this.components.set(e.id, e), e.cleanup && e.cleanup.forEach((t) => {
2900
- this.cleanupQueue.add(t);
2901
- });
2902
- }
2903
- /**
2904
- * Unregister and cleanup a component
2905
- */
2906
- unregisterComponent(e) {
2907
- const t = this.components.get(e);
2908
- t && (t.cleanup && t.cleanup.forEach((s) => {
2909
- try {
2910
- s();
2911
- } catch (r) {
2912
- console.error(`Cleanup error for component ${e}:`, r);
2913
- }
2914
- }), this.components.delete(e), t.context && this.cleanupContext(t.context.id));
2915
- }
2916
- /**
2917
- * Get component instance by ID
2918
- */
2919
- getComponent(e) {
2920
- return this.components.get(e);
2921
- }
2922
- /**
2923
- * Schedule component for update
2924
- */
2925
- scheduleUpdate(e) {
2926
- this.updateQueue.add(e), this.isUpdating || this.flushUpdates();
2927
- }
2928
- /**
2929
- * Process all scheduled updates
2930
- */
2931
- async flushUpdates() {
2932
- if (this.isUpdating) return;
2933
- this.isUpdating = !0, await new Promise((t) => queueMicrotask(() => t(void 0)));
2934
- const e = Array.from(this.updateQueue);
2935
- this.updateQueue.clear(), e.forEach((t) => {
2936
- const s = this.components.get(t);
2937
- if (s)
2938
- try {
2939
- this.updateComponent(s);
2940
- } catch (r) {
2941
- console.error(`Update error for component ${t}:`, r);
2942
- }
2943
- }), this.isUpdating = !1;
2944
- }
2945
- /**
2946
- * Update a specific component instance
2947
- */
2948
- updateComponent(e) {
2949
- e.props && (e.prevProps = { ...e.props }), e.render(), e.mounted || (e.mounted = !0);
2950
- }
2951
- /**
2952
- * Cleanup context by ID
2953
- */
2954
- cleanupContext(e) {
2955
- const t = this.contexts.get(e);
2956
- t && (t.cleanup.forEach((s) => {
2957
- try {
2958
- s();
2959
- } catch (r) {
2960
- console.error(`Context cleanup error for ${e}:`, r);
2961
- }
2962
- }), this.contexts.delete(e));
2963
- }
2964
- /**
2965
- * Get all registered components (for debugging)
2966
- */
2967
- getAllComponents() {
2968
- return Array.from(this.components.values());
2969
- }
2970
- /**
2971
- * Cleanup all components and resources
2972
- */
2973
- cleanup() {
2974
- Array.from(this.components.keys()).forEach((e) => {
2975
- this.unregisterComponent(e);
2976
- }), this.cleanupQueue.forEach((e) => {
2977
- try {
2978
- e();
2979
- } catch (t) {
2980
- console.error("Global cleanup error:", t);
2981
- }
2982
- }), this.cleanupQueue.clear(), this.updateQueue.clear();
2983
- }
2984
- };
2985
- H(Gt, "instance");
2986
- var Kt = Object.defineProperty, Yt = (n, e, t) => e in n ? Kt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, I = (n, e, t) => Yt(n, typeof e != "symbol" ? e + "" : e, t);
2987
- const Ne = class Q {
2988
- constructor() {
2989
- I(this, "contexts", /* @__PURE__ */ new Map()), I(this, "providerStack", /* @__PURE__ */ new Map()), I(this, "currentComponent", null);
2990
- }
2991
- static getInstance() {
2992
- return Q.instance || (Q.instance = new Q()), Q.instance;
2993
- }
2994
- /**
2995
- * Set the current component context for provider resolution
2996
- */
2997
- setCurrentComponent(e) {
2998
- this.currentComponent = e;
2999
- }
3000
- /**
3001
- * Get the current component context
3002
- */
3003
- getCurrentComponent() {
3004
- return this.currentComponent;
3005
- }
3006
- /**
3007
- * Register a context provider
3008
- */
3009
- registerProvider(e, t, s) {
3010
- this.providerStack.has(e) || this.providerStack.set(e, []);
3011
- const r = this.providerStack.get(e), [i, o] = he(t), a = {
3012
- value: t,
3013
- signal: [i, o],
3014
- subscribers: /* @__PURE__ */ new Set(),
3015
- providers: /* @__PURE__ */ new Set([s])
3016
- };
3017
- return r.push(a), s.providers.set(e, a), () => {
3018
- const l = r.indexOf(a);
3019
- l !== -1 && r.splice(l, 1), s.providers.delete(e), a.subscribers.clear(), a.providers.clear();
3020
- };
3021
- }
3022
- /**
3023
- * Get context value with reactive subscription
3024
- */
3025
- getContextValue(e, t) {
3026
- const s = this.providerStack.get(e), r = s && s.length > 0 ? s[s.length - 1] : null;
3027
- if (r)
3028
- return this.currentComponent && (r.subscribers.add(this.currentComponent.id), this.currentComponent.consumers.add(e)), [r.signal[0], !0];
3029
- const [i] = he(t);
3030
- return [i, !1];
3031
- }
3032
- /**
3033
- * Update context value and notify subscribers
3034
- */
3035
- updateContextValue(e, t) {
3036
- const s = this.providerStack.get(e), r = s && s.length > 0 ? s[s.length - 1] : null;
3037
- return r ? (r.value = t, r.signal[1](t), !0) : !1;
3038
- }
3039
- /**
3040
- * Get all registered contexts (for debugging)
3041
- */
3042
- getAllContexts() {
3043
- const e = /* @__PURE__ */ new Map();
3044
- for (const [t, s] of this.providerStack.entries())
3045
- s.length > 0 && e.set(t, s[s.length - 1]);
3046
- return e;
3047
- }
3048
- /**
3049
- * Clear all contexts (for testing)
3050
- */
3051
- clear() {
3052
- this.contexts.clear(), this.providerStack.clear(), this.currentComponent = null;
3053
- }
3054
- };
3055
- I(Ne, "instance");
3056
- let Zt = Ne, Xt = class {
3057
- constructor() {
3058
- I(this, "registry", Zt.getInstance());
3059
- }
3060
- /**
3061
- * Create a context provider component
3062
- */
3063
- createProvider(e, t, s) {
3064
- return {
3065
- type: "component",
3066
- render: () => {
3067
- const r = this.registry.registerProvider(
3068
- e.symbol,
3069
- t,
3070
- Ut(`provider_${e.symbol.toString()}`)
3071
- ), i = s.flatMap((o) => {
3072
- let a = o;
3073
- "build" in o && typeof o.build == "function" && (a = o.build());
3074
- const l = a.render();
3075
- return Array.isArray(l) ? l : [l];
3076
- });
3077
- return [
3078
- {
3079
- type: "element",
3080
- tag: "div",
3081
- props: { "data-context-provider": e.displayName || "provider" },
3082
- children: i,
3083
- dispose: r
3084
- }
3085
- ];
3086
- },
3087
- props: { children: s },
3088
- id: `provider_${Date.now()}`,
3089
- children: s
3090
- };
3091
- }
3092
- /**
3093
- * Set current component for context resolution
3094
- */
3095
- setCurrentComponent(e) {
3096
- this.registry.setCurrentComponent(e);
3097
- }
3098
- /**
3099
- * Update a context value
3100
- */
3101
- updateContext(e, t) {
3102
- return this.registry.updateContextValue(e.symbol, t);
3103
- }
3104
- /**
3105
- * Get all active contexts (for debugging)
3106
- */
3107
- getAllContexts() {
3108
- return this.registry.getAllContexts();
3109
- }
3110
- /**
3111
- * Clear all contexts
3112
- */
3113
- clear() {
3114
- this.registry.clear();
3115
- }
3116
- };
3117
- class Jt {
3118
- constructor() {
3119
- I(this, "services", /* @__PURE__ */ new Map()), I(this, "factories", /* @__PURE__ */ new Map()), I(this, "singletons", /* @__PURE__ */ new Map()), I(this, "scoped", /* @__PURE__ */ new Map()), I(this, "dependencies", /* @__PURE__ */ new Map());
3120
- }
3121
- /**
3122
- * Register a service with the container
3123
- */
3124
- register(e, t, s = {}) {
3125
- this.services.set(e, t), s.dependencies && this.dependencies.set(e, s.dependencies), s.singleton && this.singletons.set(e, null), s.scoped && this.scoped.set(e, null);
3126
- }
3127
- /**
3128
- * Resolve a service from the container
3129
- */
3130
- resolve(e) {
3131
- if (this.singletons.has(e)) {
3132
- let t = this.singletons.get(e);
3133
- return t === null && (t = this.createInstance(e), this.singletons.set(e, t)), t;
3134
- }
3135
- if (this.scoped.has(e)) {
3136
- let t = this.scoped.get(e);
3137
- return t === null && (t = this.createInstance(e), this.scoped.set(e, t)), t;
3138
- }
3139
- return this.createInstance(e);
3140
- }
3141
- /**
3142
- * Create instance with dependency injection
3143
- */
3144
- createInstance(e) {
3145
- const t = (this.dependencies.get(e) || []).map((i) => this.resolve(i)), s = this.factories.get(e);
3146
- if (s)
3147
- return s(...t);
3148
- const r = this.services.get(e);
3149
- if (r) {
3150
- if (typeof r == "function")
3151
- try {
3152
- return new r(...t);
3153
- } catch {
3154
- return r(...t);
3155
- }
3156
- return r;
3157
- }
3158
- throw new Error(`Service ${String(e)} not found in DI container`);
3159
- }
3160
- /**
3161
- * Check if service is registered
3162
- */
3163
- has(e) {
3164
- return this.services.has(e) || this.factories.has(e);
3165
- }
3166
- /**
3167
- * Clear the container
3168
- */
3169
- clear() {
3170
- this.services.clear(), this.factories.clear(), this.singletons.clear(), this.scoped.clear(), this.dependencies.clear();
3171
- }
3172
- /**
3173
- * Get all registered services (for debugging)
3174
- */
3175
- getRegistered() {
3176
- return [...this.services.keys(), ...this.factories.keys()];
3177
- }
3178
- }
3179
- new Jt();
3180
- new Xt();
3181
- new Te();
3182
- var es = Object.defineProperty, ts = (n, e, t) => e in n ? es(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, ce = (n, e, t) => ts(n, typeof e != "symbol" ? e + "" : e, t);
3183
- const ss = {
3184
- sanitizeClassNames: !0,
3185
- sanitizationRules: {
3186
- allowNumbers: !0,
3187
- allowUnderscores: !0,
3188
- customReplacements: {}
3189
- },
3190
- enableCaching: !0,
3191
- maxCacheSize: 1e3,
3192
- warnDuplicateClasses: process.env.NODE_ENV === "development",
3193
- warnInvalidClasses: process.env.NODE_ENV === "development"
3194
- };
3195
- let rs = class {
3196
- constructor(e = {}) {
3197
- ce(this, "config"), ce(this, "classCache"), ce(this, "processingCache"), this.config = { ...ss, ...e };
3198
- const t = (() => {
3199
- try {
3200
- return typeof Map < "u" && typeof Map == "function";
3201
- } catch {
3202
- return !1;
3203
- }
3204
- })();
3205
- this.classCache = t ? /* @__PURE__ */ new Map() : {}, this.processingCache = t ? /* @__PURE__ */ new Map() : {};
3206
- }
3207
- /**
3208
- * Cache helper methods to work with both Map and plain object fallbacks
3209
- */
3210
- cacheHas(e, t) {
3211
- try {
3212
- return e instanceof Map ? e.has(t) : t in e;
3213
- } catch {
3214
- return t in e;
3215
- }
3216
- }
3217
- cacheGet(e, t) {
3218
- try {
3219
- return e instanceof Map ? e.get(t) : e[t];
3220
- } catch {
3221
- return e[t];
3222
- }
3223
- }
3224
- cacheSet(e, t, s) {
3225
- try {
3226
- e instanceof Map ? e.set(t, s) : e[t] = s;
3227
- } catch {
3228
- e[t] = s;
3229
- }
3230
- }
3231
- cacheDelete(e, t) {
3232
- try {
3233
- e instanceof Map ? e.delete(t) : delete e[t];
3234
- } catch {
3235
- delete e[t];
3236
- }
3237
- }
3238
- cacheClear(e) {
3239
- try {
3240
- e instanceof Map ? e.clear() : Object.keys(e).forEach((t) => delete e[t]);
3241
- } catch {
3242
- Object.keys(e).forEach((t) => delete e[t]);
3243
- }
3244
- }
3245
- cacheSize(e) {
3246
- try {
3247
- return e instanceof Map ? e.size : Object.keys(e).length;
3248
- } catch {
3249
- return Object.keys(e).length;
3250
- }
3251
- }
3252
- cacheKeys(e) {
3253
- try {
3254
- return e instanceof Map ? e.keys() : Object.keys(e);
3255
- } catch {
3256
- return Object.keys(e);
3257
- }
3258
- }
3259
- /**
3260
- * Process CSS classes from various input formats
3261
- */
3262
- processClasses(e) {
3263
- if (!e) return [];
3264
- if (F(e) || B(e)) {
3265
- const i = e();
3266
- return this.processClasses(i);
3267
- }
3268
- const t = this.getCacheKey(e);
3269
- if (this.config.enableCaching && this.cacheHas(this.classCache, t))
3270
- return this.cacheGet(this.classCache, t);
3271
- let s = [];
3272
- if (typeof e == "string")
3273
- s = e.trim().split(/\s+/).filter(Boolean);
3274
- else if (Array.isArray(e))
3275
- s = e.flatMap((i) => {
3276
- if (i == null || i === "")
3277
- return [];
3278
- const o = (typeof i == "string" ? i : String(i)).trim();
3279
- return typeof i != "string" && o ? [o] : o.split(/\s+/);
3280
- }).filter(Boolean);
3281
- else {
3282
- const i = String(e).trim();
3283
- s = i ? [i] : [];
3284
- }
3285
- const r = this.processClassArray(s);
3286
- return this.config.enableCaching && this.setCachedClasses(t, r), r;
3287
- }
3288
- /**
3289
- * Process an array of class names
3290
- */
3291
- processClassArray(e) {
3292
- let t = e;
3293
- return this.config.sanitizeClassNames && (t = t.map((s) => this.sanitizeClassName(s))), t = this.deduplicateClasses(t), this.config.warnDuplicateClasses && e.length !== t.length && console.warn(
3294
- "[tachUI] Duplicate CSS classes detected and removed:",
3295
- e.filter((s, r) => e.indexOf(s) !== r)
3296
- ), t;
3297
- }
3298
- /**
3299
- * Sanitize class name to be valid CSS identifier
3300
- */
3301
- sanitizeClassName(e) {
3302
- if (!e || typeof e != "string") return "";
3303
- const t = this.config.sanitizationRules;
3304
- let s = e.trim();
3305
- s.includes(" ") && (s = s.replace(/\s+/g, "-"), this.config.warnInvalidClasses && console.warn(`[tachUI] CSS class names cannot contain spaces. Converted "${e}" to "${s}"`)), Object.entries(t.customReplacements || {}).forEach(([i, o]) => {
3306
- s = s.replace(new RegExp(i, "g"), o);
3307
- });
3308
- let r = "a-zA-Z\\-\\.";
3309
- return t.allowNumbers && (r += "0-9"), t.allowUnderscores && (r += "_"), r += ":\\[\\]/%", s = s.replace(new RegExp(`[^${r}]`, "g"), "-"), /^[0-9]/.test(s) && (s = "cls-" + s), s = s.replace(/---+/g, "--"), this.config.warnInvalidClasses && s !== e.trim() && console.warn(`[tachUI] CSS class "${e}" sanitized to "${s}"`), s;
3310
- }
3311
- /**
3312
- * Deduplicate classes while preserving first occurrence order
3313
- */
3314
- deduplicateClasses(e) {
3315
- return [...new Set(e.filter(Boolean))];
3316
- }
3317
- /**
3318
- * Combine tachUI classes with user-provided CSS classes
3319
- * User classes come AFTER tachUI classes for proper CSS cascade
3320
- */
3321
- combineClasses(e, t) {
3322
- const s = this.processClasses(t), r = [...e, ...s];
3323
- return this.deduplicateClasses(r);
3324
- }
3325
- /**
3326
- * Update configuration
3327
- */
3328
- updateConfig(e) {
3329
- this.config = { ...this.config, ...e }, this.clearCaches();
3330
- }
3331
- /**
3332
- * Get current configuration
3333
- */
3334
- getConfig() {
3335
- return { ...this.config };
3336
- }
3337
- /**
3338
- * Clear all caches
3339
- */
3340
- clearCaches() {
3341
- this.cacheClear(this.classCache), this.cacheClear(this.processingCache);
3342
- }
3343
- /**
3344
- * Get cache statistics for debugging
3345
- */
3346
- getCacheStats() {
3347
- return {
3348
- size: this.cacheSize(this.classCache),
3349
- maxSize: this.config.maxCacheSize,
3350
- hitRate: 0
3351
- // TODO: Implement hit rate tracking if needed
3352
- };
3353
- }
3354
- /**
3355
- * Generate cache key for input
3356
- */
3357
- getCacheKey(e) {
3358
- return Array.isArray(e) ? e.join("|") : e;
3359
- }
3360
- /**
3361
- * Set cached classes with LRU eviction
3362
- */
3363
- setCachedClasses(e, t) {
3364
- if (this.cacheSize(this.classCache) >= this.config.maxCacheSize) {
3365
- const s = this.cacheKeys(this.classCache), r = Array.isArray(s) ? s[0] : s.next().value;
3366
- r !== void 0 && this.cacheDelete(this.classCache, r);
3367
- }
3368
- this.cacheSet(this.classCache, e, t);
3369
- }
3370
- };
3371
- new rs();
3372
- function is(n, e, t = {}, ...s) {
3373
- const r = new n(e, ...s);
3374
- return $e() && t.prewarmProxy !== !1 && ue(r), r;
3375
- }
3376
- var ns = Object.defineProperty, os = (n, e, t) => e in n ? ns(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, D = (n, e, t) => os(n, typeof e != "symbol" ? e + "" : e, t);
3377
- class se extends Le {
3378
- constructor(e) {
3379
- super(), this.props = e, D(this, "type", "component"), D(this, "id"), D(this, "mounted", !1), D(this, "cleanup", []), D(this, "effectiveTag"), D(this, "validationResult"), this.id = `text-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
3380
- const t = this.resolveDefaultTag(), s = ke(
3381
- "Text",
3382
- t,
3383
- this.props.element
3384
- );
3385
- this.effectiveTag = s.tag, this.validationResult = s.validation;
3386
- }
3387
- resolveDefaultTag() {
3388
- return this.props.accessibilityRole === "heading" ? `h${this.props.accessibilityLevel ?? 2}` : "span";
3389
- }
3390
- /**
3391
- * Render the text component with reactive content handling, element override support, and CSS classes
3392
- */
3393
- render() {
3394
- const e = ["tachui-text"], t = this.createClassString(this.props, e);
3395
- return [S(
3396
- this.effectiveTag,
3397
- {
3398
- className: t,
3399
- // Pass through debug label for debug system
3400
- ...this.props.debugLabel && { debugLabel: this.props.debugLabel },
3401
- // Add component metadata for semantic role processing
3402
- componentMetadata: {
3403
- originalType: "Text",
3404
- overriddenTo: this.effectiveTag !== "span" ? this.effectiveTag : void 0,
3405
- validationResult: this.validationResult,
3406
- componentInstance: this
3407
- // Add reference to the Text component instance
3408
- }
3409
- },
3410
- De(this.props.content || "")
3411
- )];
3412
- }
3413
- // Concatenation support - simplified for now
3414
- concat(e) {
3415
- return this;
3416
- }
3417
- toSegment() {
3418
- return this;
3419
- }
3420
- isConcatenatable() {
3421
- return !0;
3422
- }
3423
- /**
3424
- * Cleanup resources
3425
- */
3426
- dispose() {
3427
- this.cleanup.forEach((e) => {
3428
- try {
3429
- e();
3430
- } catch (t) {
3431
- console.error("Text component cleanup error:", t);
3432
- }
3433
- }), this.cleanup = [];
3434
- }
3435
- clone(e = {}) {
3436
- return e.deep ? this.deepClone() : this.shallowClone();
3437
- }
3438
- shallowClone() {
3439
- const e = me(this.props), t = new se(e);
3440
- return ge(t), t;
3441
- }
3442
- deepClone() {
3443
- const e = me(this.props, {
3444
- deep: !0
3445
- }), t = new se(e);
3446
- return ge(t), t;
3447
- }
3448
- }
3449
- function Re(n, e) {
3450
- const t = {
3451
- content: n,
3452
- ...e
3453
- }, s = is(se, t);
3454
- return pe(s);
3455
- }
3456
- function z(n) {
3457
- return (e, t) => Re(e, {
3458
- ...t,
3459
- accessibilityRole: "heading",
3460
- accessibilityLevel: n
3461
- });
3462
- }
3463
- Object.assign(Re, {
3464
- H1: z(1),
3465
- H2: z(2),
3466
- H3: z(3),
3467
- H4: z(4),
3468
- H5: z(5),
3469
- H6: z(6)
3470
- });
3471
- var as = Object.defineProperty, ls = (n, e, t) => e in n ? as(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, g = (n, e, t) => ls(n, typeof e != "symbol" ? e + "" : e, t);
3472
- class cs {
3473
- constructor(e) {
3474
- this.props = e, g(this, "type", "component"), g(this, "id"), g(this, "mounted", !1), g(this, "cleanup", []), g(this, "scrollElement", null), g(this, "contentOffsetSignal"), g(this, "setContentOffset"), g(this, "contentSizeSignal"), g(this, "setContentSize"), g(this, "setIsScrolling"), g(this, "pullToRefreshStateSignal"), g(this, "setPullToRefreshState"), g(this, "scrollEventThrottle"), g(this, "lastScrollTime", 0), g(this, "scrollVelocity", { x: 0, y: 0 }), g(this, "lastScrollOffset", { x: 0, y: 0 }), g(this, "pullStartY", 0), g(this, "isPulling", !1), g(this, "handleScroll", (h) => {
7
+ var C = Object.defineProperty, $ = (c, t, e) => t in c ? C(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e, p = (c, t, e) => $(c, typeof t != "symbol" ? t + "" : t, e);
8
+ class z {
9
+ constructor(t) {
10
+ this.props = t, p(this, "type", "component"), p(this, "id"), p(this, "mounted", !1), p(this, "cleanup", []), p(this, "scrollElement", null), p(this, "contentOffsetSignal"), p(this, "setContentOffset"), p(this, "contentSizeSignal"), p(this, "setContentSize"), p(this, "setIsScrolling"), p(this, "pullToRefreshStateSignal"), p(this, "setPullToRefreshState"), p(this, "scrollEventThrottle"), p(this, "lastScrollTime", 0), p(this, "scrollVelocity", { x: 0, y: 0 }), p(this, "lastScrollOffset", { x: 0, y: 0 }), p(this, "pullStartY", 0), p(this, "isPulling", !1), p(this, "handleScroll", (a) => {
3475
11
  if (!this.scrollElement) return;
3476
- const c = performance.now(), u = c - this.lastScrollTime;
3477
- if (u < this.scrollEventThrottle) return;
3478
- const f = {
12
+ const h = performance.now(), r = h - this.lastScrollTime;
13
+ if (r < this.scrollEventThrottle) return;
14
+ const g = {
3479
15
  x: this.scrollElement.scrollLeft,
3480
16
  y: this.scrollElement.scrollTop
3481
17
  };
3482
- this.scrollVelocity = this.calculateVelocity(f, u), this.setContentOffset(f), this.setContentSize({
18
+ this.scrollVelocity = this.calculateVelocity(g, r), this.setContentOffset(g), this.setContentSize({
3483
19
  width: this.scrollElement.scrollWidth,
3484
20
  height: this.scrollElement.scrollHeight
3485
21
  });
3486
- const p = this.detectScrollEdges(), v = {
3487
- offset: f,
22
+ const d = this.detectScrollEdges(), I = {
23
+ offset: g,
3488
24
  velocity: this.scrollVelocity,
3489
25
  contentSize: {
3490
26
  width: this.scrollElement.scrollWidth,
@@ -3494,27 +30,27 @@ class cs {
3494
30
  width: this.scrollElement.clientWidth,
3495
31
  height: this.scrollElement.clientHeight
3496
32
  },
3497
- edges: p
33
+ edges: d
3498
34
  };
3499
- this.props.onScroll && this.props.onScroll(v), p.top && this.props.onReachTop && this.props.onReachTop(), p.bottom && this.props.onReachBottom && this.props.onReachBottom(), p.left && this.props.onReachLeft && this.props.onReachLeft(), p.right && this.props.onReachRight && this.props.onReachRight(), this.lastScrollOffset = f, this.lastScrollTime = c;
3500
- }), g(this, "handleScrollStart", () => {
35
+ this.props.onScroll && this.props.onScroll(I), d.top && this.props.onReachTop && this.props.onReachTop(), d.bottom && this.props.onReachBottom && this.props.onReachBottom(), d.left && this.props.onReachLeft && this.props.onReachLeft(), d.right && this.props.onReachRight && this.props.onReachRight(), this.lastScrollOffset = g, this.lastScrollTime = h;
36
+ }), p(this, "handleScrollStart", () => {
3501
37
  this.setIsScrolling(!0), this.props.onScrollBegin && this.props.onScrollBegin();
3502
- }), g(this, "handleScrollEnd", () => {
38
+ }), p(this, "handleScrollEnd", () => {
3503
39
  this.setIsScrolling(!1), this.props.onScrollEnd && this.props.onScrollEnd();
3504
- }), g(this, "handleTouchStart", (h) => {
3505
- this.props.refreshControl?.enabled && (this.pullStartY = h.touches[0].clientY, this.isPulling = !1);
3506
- }), g(this, "handleTouchMove", (h) => {
40
+ }), p(this, "handleTouchStart", (a) => {
41
+ this.props.refreshControl?.enabled && (this.pullStartY = a.touches[0].clientY, this.isPulling = !1);
42
+ }), p(this, "handleTouchMove", (a) => {
3507
43
  if (!this.props.refreshControl?.enabled || !this.scrollElement) return;
3508
- const c = h.touches[0].clientY - this.pullStartY, u = this.props.refreshControl.threshold || 80;
3509
- this.scrollElement.scrollTop <= 0 && c > 0 && (this.isPulling = !0, c > u ? this.setPullToRefreshState("ready") : this.setPullToRefreshState("pulling"));
3510
- }), g(this, "handleTouchEnd", async () => {
44
+ const h = a.touches[0].clientY - this.pullStartY, r = this.props.refreshControl.threshold || 80;
45
+ this.scrollElement.scrollTop <= 0 && h > 0 && (this.isPulling = !0, h > r ? this.setPullToRefreshState("ready") : this.setPullToRefreshState("pulling"));
46
+ }), p(this, "handleTouchEnd", async () => {
3511
47
  if (!(!this.props.refreshControl?.enabled || !this.isPulling)) {
3512
48
  if (this.pullToRefreshStateSignal() === "ready") {
3513
49
  this.setPullToRefreshState("refreshing");
3514
50
  try {
3515
51
  await this.props.refreshControl.onRefresh();
3516
- } catch (h) {
3517
- console.error("Pull to refresh error:", h);
52
+ } catch (a) {
53
+ console.error("Pull to refresh error:", a);
3518
54
  } finally {
3519
55
  this.setPullToRefreshState("idle");
3520
56
  }
@@ -3522,42 +58,42 @@ class cs {
3522
58
  this.setPullToRefreshState("idle");
3523
59
  this.isPulling = !1;
3524
60
  }
3525
- }), this.id = `scrollview-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, this.scrollEventThrottle = e.scrollEventThrottle || 16;
3526
- const [t, s] = N(
61
+ }), this.id = `scrollview-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, this.scrollEventThrottle = t.scrollEventThrottle || 16;
62
+ const [e, i] = y(
3527
63
  { x: 0, y: 0 }
3528
64
  );
3529
- this.contentOffsetSignal = t, this.setContentOffset = s;
3530
- const [r, i] = N({
65
+ this.contentOffsetSignal = e, this.setContentOffset = i;
66
+ const [s, n] = y({
3531
67
  width: 0,
3532
68
  height: 0
3533
69
  });
3534
- this.contentSizeSignal = r, this.setContentSize = i;
3535
- const [, o] = N(!1);
70
+ this.contentSizeSignal = s, this.setContentSize = n;
71
+ const [, o] = y(!1);
3536
72
  this.setIsScrolling = o;
3537
- const [a, l] = N("idle");
3538
- if (this.pullToRefreshStateSignal = a, this.setPullToRefreshState = l, e.contentOffset && w(e.contentOffset)) {
3539
- this.setContentOffset(e.contentOffset());
3540
- const h = R(() => {
3541
- e.contentOffset && w(e.contentOffset) && this.setContentOffset(e.contentOffset());
73
+ const [l, f] = y("idle");
74
+ if (this.pullToRefreshStateSignal = l, this.setPullToRefreshState = f, t.contentOffset && S(t.contentOffset)) {
75
+ this.setContentOffset(t.contentOffset());
76
+ const a = v(() => {
77
+ t.contentOffset && S(t.contentOffset) && this.setContentOffset(t.contentOffset());
3542
78
  });
3543
- this.cleanup.push(() => h.dispose());
79
+ this.cleanup.push(() => a.dispose());
3544
80
  }
3545
- if (e.contentSize && w(e.contentSize)) {
3546
- this.setContentSize(e.contentSize());
3547
- const h = R(() => {
3548
- e.contentSize && w(e.contentSize) && this.setContentSize(e.contentSize());
81
+ if (t.contentSize && S(t.contentSize)) {
82
+ this.setContentSize(t.contentSize());
83
+ const a = v(() => {
84
+ t.contentSize && S(t.contentSize) && this.setContentSize(t.contentSize());
3549
85
  });
3550
- this.cleanup.push(() => h.dispose());
86
+ this.cleanup.push(() => a.dispose());
3551
87
  }
3552
88
  }
3553
89
  /**
3554
90
  * Calculate scroll velocity
3555
91
  */
3556
- calculateVelocity(e, t) {
3557
- const s = e.x - this.lastScrollOffset.x, r = e.y - this.lastScrollOffset.y;
92
+ calculateVelocity(t, e) {
93
+ const i = t.x - this.lastScrollOffset.x, s = t.y - this.lastScrollOffset.y;
3558
94
  return {
3559
- x: t > 0 ? s / t : 0,
3560
- y: t > 0 ? r / t : 0
95
+ x: e > 0 ? i / e : 0,
96
+ y: e > 0 ? s / e : 0
3561
97
  };
3562
98
  }
3563
99
  /**
@@ -3567,47 +103,47 @@ class cs {
3567
103
  if (!this.scrollElement)
3568
104
  return { top: !1, bottom: !1, left: !1, right: !1 };
3569
105
  const {
3570
- scrollTop: e,
3571
- scrollLeft: t,
3572
- scrollHeight: s,
3573
- scrollWidth: r,
3574
- clientHeight: i,
106
+ scrollTop: t,
107
+ scrollLeft: e,
108
+ scrollHeight: i,
109
+ scrollWidth: s,
110
+ clientHeight: n,
3575
111
  clientWidth: o
3576
112
  } = this.scrollElement;
3577
113
  return {
3578
- top: e <= 0,
3579
- bottom: e + i >= s - 1,
3580
- left: t <= 0,
3581
- right: t + o >= r - 1
114
+ top: t <= 0,
115
+ bottom: t + n >= i - 1,
116
+ left: e <= 0,
117
+ right: e + o >= s - 1
3582
118
  };
3583
119
  }
3584
120
  /**
3585
121
  * Set up scroll event handlers
3586
122
  */
3587
- setupScrollHandlers(e) {
3588
- let t;
3589
- const s = () => {
3590
- clearTimeout(t), this.handleScrollStart();
3591
- }, r = () => {
3592
- clearTimeout(t), t = setTimeout(() => {
123
+ setupScrollHandlers(t) {
124
+ let e;
125
+ const i = () => {
126
+ clearTimeout(e), this.handleScrollStart();
127
+ }, s = () => {
128
+ clearTimeout(e), e = setTimeout(() => {
3593
129
  this.handleScrollEnd();
3594
130
  }, 150);
3595
- }, i = (o) => {
3596
- s(), this.handleScroll(o), r();
131
+ }, n = (o) => {
132
+ i(), this.handleScroll(o), s();
3597
133
  };
3598
- e.addEventListener("scroll", i, { passive: !0 }), e.addEventListener("touchstart", this.handleTouchStart, {
134
+ t.addEventListener("scroll", n, { passive: !0 }), t.addEventListener("touchstart", this.handleTouchStart, {
3599
135
  passive: !0
3600
- }), e.addEventListener("touchmove", this.handleTouchMove, {
136
+ }), t.addEventListener("touchmove", this.handleTouchMove, {
3601
137
  passive: !1
3602
- }), e.addEventListener("touchend", this.handleTouchEnd, { passive: !0 }), this.cleanup.push(() => {
3603
- e.removeEventListener("scroll", i), e.removeEventListener("touchstart", this.handleTouchStart), e.removeEventListener("touchmove", this.handleTouchMove), e.removeEventListener("touchend", this.handleTouchEnd), clearTimeout(t);
138
+ }), t.addEventListener("touchend", this.handleTouchEnd, { passive: !0 }), this.cleanup.push(() => {
139
+ t.removeEventListener("scroll", n), t.removeEventListener("touchstart", this.handleTouchStart), t.removeEventListener("touchmove", this.handleTouchMove), t.removeEventListener("touchend", this.handleTouchEnd), clearTimeout(e);
3604
140
  });
3605
141
  }
3606
142
  /**
3607
143
  * Get overflow styles based on direction
3608
144
  */
3609
- getOverflowStyles(e) {
3610
- switch (e) {
145
+ getOverflowStyles(t) {
146
+ switch (t) {
3611
147
  case "vertical":
3612
148
  return {
3613
149
  overflowX: "hidden",
@@ -3632,29 +168,29 @@ class cs {
3632
168
  /**
3633
169
  * Apply additional scroll view styling (position and overflow already set in initial render)
3634
170
  */
3635
- applyScrollViewStyles(e) {
3636
- const { showsScrollIndicator: t = !0, bounces: s = !0 } = this.props;
3637
- if (!t) {
3638
- e.style.scrollbarWidth = "none", e.style.msOverflowStyle = "none";
3639
- const r = document.createElement("style");
3640
- r.textContent = `
3641
- #${e.id}::-webkit-scrollbar {
171
+ applyScrollViewStyles(t) {
172
+ const { showsScrollIndicator: e = !0, bounces: i = !0 } = this.props;
173
+ if (!e) {
174
+ t.style.scrollbarWidth = "none", t.style.msOverflowStyle = "none";
175
+ const s = document.createElement("style");
176
+ s.textContent = `
177
+ #${t.id}::-webkit-scrollbar {
3642
178
  display: none;
3643
179
  }
3644
- `, document.head.appendChild(r), this.cleanup.push(() => {
3645
- document.head.removeChild(r);
180
+ `, document.head.appendChild(s), this.cleanup.push(() => {
181
+ document.head.removeChild(s);
3646
182
  });
3647
183
  }
3648
- s ? e.style.webkitOverflowScrolling = "touch" : e.style.overscrollBehavior = "none", e.style.scrollBehavior = "smooth";
184
+ i ? t.style.webkitOverflowScrolling = "touch" : t.style.overscrollBehavior = "none", t.style.scrollBehavior = "smooth";
3649
185
  }
3650
186
  /**
3651
187
  * Apply content insets
3652
188
  */
3653
- applyContentInsets(e) {
3654
- const { contentInset: t } = this.props;
3655
- if (t) {
3656
- const { top: s = 0, bottom: r = 0, left: i = 0, right: o = 0 } = t;
3657
- e.style.padding = `${s}px ${o}px ${r}px ${i}px`;
189
+ applyContentInsets(t) {
190
+ const { contentInset: e } = this.props;
191
+ if (e) {
192
+ const { top: i = 0, bottom: s = 0, left: n = 0, right: o = 0 } = e;
193
+ t.style.padding = `${i}px ${o}px ${s}px ${n}px`;
3658
194
  }
3659
195
  }
3660
196
  /**
@@ -3662,29 +198,29 @@ class cs {
3662
198
  */
3663
199
  createPullToRefreshIndicator() {
3664
200
  if (!this.props.refreshControl?.enabled) return null;
3665
- const e = this.pullToRefreshStateSignal(), t = this.props.refreshControl.tintColor || "#007AFF";
3666
- let s = "";
3667
- switch (e) {
201
+ const t = this.pullToRefreshStateSignal(), e = this.props.refreshControl.tintColor || "#007AFF";
202
+ let i = "";
203
+ switch (t) {
3668
204
  case "pulling":
3669
- s = "↓ Pull to refresh";
205
+ i = "↓ Pull to refresh";
3670
206
  break;
3671
207
  case "ready":
3672
- s = "↑ Release to refresh";
208
+ i = "↑ Release to refresh";
3673
209
  break;
3674
210
  case "refreshing":
3675
- s = "⟳ Refreshing...";
211
+ i = "⟳ Refreshing...";
3676
212
  break;
3677
213
  default:
3678
- s = "";
214
+ i = "";
3679
215
  }
3680
- return s ? {
216
+ return i ? {
3681
217
  type: "component",
3682
218
  id: `${this.id}-refresh`,
3683
219
  mounted: !1,
3684
220
  cleanup: [],
3685
221
  props: {},
3686
222
  render: () => [
3687
- S(
223
+ m(
3688
224
  "div",
3689
225
  {
3690
226
  style: {
@@ -3695,16 +231,16 @@ class cs {
3695
231
  padding: "10px 20px",
3696
232
  backgroundColor: "#f8f9fa",
3697
233
  borderRadius: "20px",
3698
- color: t,
234
+ color: e,
3699
235
  fontSize: "14px",
3700
236
  fontWeight: "500",
3701
237
  textAlign: "center",
3702
238
  zIndex: 1e3,
3703
239
  transition: "all 0.3s ease",
3704
- opacity: e === "idle" ? 0 : 1
240
+ opacity: t === "idle" ? 0 : 1
3705
241
  }
3706
242
  },
3707
- s
243
+ i
3708
244
  )
3709
245
  ]
3710
246
  } : null;
@@ -3712,41 +248,41 @@ class cs {
3712
248
  /**
3713
249
  * Scroll to specific position
3714
250
  */
3715
- scrollTo(e, t = "smooth") {
251
+ scrollTo(t, e = "smooth") {
3716
252
  if (!this.scrollElement) return;
3717
- const s = { behavior: t };
3718
- e.x !== void 0 && (s.left = e.x), e.y !== void 0 && (s.top = e.y), this.scrollElement.scrollTo(s);
253
+ const i = { behavior: e };
254
+ t.x !== void 0 && (i.left = t.x), t.y !== void 0 && (i.top = t.y), this.scrollElement.scrollTo(i);
3719
255
  }
3720
256
  /**
3721
257
  * Scroll to top
3722
258
  */
3723
- scrollToTop(e = "smooth") {
3724
- this.scrollTo({ x: 0, y: 0 }, e);
259
+ scrollToTop(t = "smooth") {
260
+ this.scrollTo({ x: 0, y: 0 }, t);
3725
261
  }
3726
262
  /**
3727
263
  * Scroll to bottom
3728
264
  */
3729
- scrollToBottom(e = "smooth") {
265
+ scrollToBottom(t = "smooth") {
3730
266
  this.scrollElement && this.scrollTo(
3731
267
  {
3732
268
  x: 0,
3733
269
  y: this.scrollElement.scrollHeight - this.scrollElement.clientHeight
3734
270
  },
3735
- e
271
+ t
3736
272
  );
3737
273
  }
3738
274
  /**
3739
275
  * Render the scroll view component
3740
276
  */
3741
277
  render() {
3742
- const { children: e = [], scrollEnabled: t = !0 } = this.props;
3743
- let s = [];
3744
- const r = e;
3745
- if (typeof r == "function") {
3746
- const u = r();
3747
- s = Array.isArray(u) ? u : [];
3748
- } else Array.isArray(e) && (s = e);
3749
- const i = S(
278
+ const { children: t = [], scrollEnabled: e = !0 } = this.props;
279
+ let i = [];
280
+ const s = t;
281
+ if (typeof s == "function") {
282
+ const r = s();
283
+ i = Array.isArray(r) ? r : [];
284
+ } else Array.isArray(t) && (i = t);
285
+ const n = m(
3750
286
  "div",
3751
287
  {
3752
288
  class: "tachui-scrollview-content",
@@ -3755,14 +291,14 @@ class cs {
3755
291
  minWidth: "100%"
3756
292
  }
3757
293
  },
3758
- ...s.flatMap((u) => u.render())
3759
- ), o = this.createPullToRefreshIndicator(), a = [];
294
+ ...i.flatMap((r) => r.render())
295
+ ), o = this.createPullToRefreshIndicator(), l = [];
3760
296
  if (o) {
3761
- const u = o.render(), f = Array.isArray(u) ? u : [u];
3762
- a.push(...f.filter((p) => p));
297
+ const r = o.render(), g = Array.isArray(r) ? r : [r];
298
+ l.push(...g.filter((d) => d));
3763
299
  }
3764
- a.push(i);
3765
- const { direction: l = "vertical" } = this.props, h = this.getOverflowStyles(l), c = S(
300
+ l.push(n);
301
+ const { direction: f = "vertical" } = this.props, a = this.getOverflowStyles(f), h = m(
3766
302
  "div",
3767
303
  {
3768
304
  id: this.id,
@@ -3771,133 +307,123 @@ class cs {
3771
307
  height: "100%",
3772
308
  width: "100%",
3773
309
  position: "relative",
3774
- ...h
310
+ ...a
3775
311
  }
3776
312
  },
3777
- ...a
313
+ ...l
3778
314
  );
3779
- if (c.element) {
3780
- const u = c.element;
3781
- this.scrollElement = u, this.applyScrollViewStyles(u), this.setupScrollHandlers(u), i.element && this.applyContentInsets(i.element);
3782
- const f = () => {
3783
- const p = w(t) ? t() : t;
3784
- u.style.overflow = p ? "auto" : "hidden", u.style.pointerEvents = p ? "auto" : "none";
315
+ if (h.element) {
316
+ const r = h.element;
317
+ this.scrollElement = r, this.applyScrollViewStyles(r), this.setupScrollHandlers(r), n.element && this.applyContentInsets(n.element);
318
+ const g = () => {
319
+ const d = S(e) ? e() : e;
320
+ r.style.overflow = d ? "auto" : "hidden", r.style.pointerEvents = d ? "auto" : "none";
3785
321
  };
3786
- if (w(t)) {
3787
- const p = R(f);
3788
- this.cleanup.push(() => p.dispose());
322
+ if (S(e)) {
323
+ const d = v(g);
324
+ this.cleanup.push(() => d.dispose());
3789
325
  } else
3790
- f();
3791
- if (typeof r == "function") {
3792
- const p = R(() => {
3793
- const v = r(), L = (Array.isArray(v) ? v : []).flatMap((C) => C.render());
3794
- if (i.element) {
3795
- const C = i.element;
3796
- C.innerHTML = "", L.forEach((E) => {
3797
- E && E.element && C.appendChild(E.element);
326
+ g();
327
+ if (typeof s == "function") {
328
+ const d = v(() => {
329
+ const I = s(), w = (Array.isArray(I) ? I : []).flatMap((E) => E.render());
330
+ if (n.element) {
331
+ const E = n.element;
332
+ E.innerHTML = "", w.forEach((L) => {
333
+ L && L.element && E.appendChild(L.element);
3798
334
  });
3799
335
  }
3800
336
  });
3801
- this.cleanup.push(() => p.dispose());
337
+ this.cleanup.push(() => d.dispose());
3802
338
  }
3803
339
  }
3804
- return [c];
340
+ return [h];
3805
341
  }
3806
342
  }
3807
- function hs(n = {}) {
3808
- const e = new cs(n);
3809
- return pe(e);
3810
- }
3811
- const ds = `
3812
- @keyframes spin {
3813
- from { transform: rotate(0deg); }
3814
- to { transform: rotate(360deg); }
3815
- }
3816
- `;
3817
- if (typeof document < "u") {
3818
- const n = document.createElement("style");
3819
- n.textContent = ds, document.head.appendChild(n);
343
+ function O(c = {}) {
344
+ const t = new z(c);
345
+ return T(t);
3820
346
  }
3821
347
  process.env.NODE_ENV;
3822
- class us {
3823
- constructor(e) {
3824
- m(this, "type", "component");
3825
- m(this, "id");
3826
- m(this, "mounted", !1);
3827
- m(this, "cleanup", []);
3828
- m(this, "dataSignal");
3829
- m(this, "setData");
3830
- m(this, "sectionsSignal");
3831
- m(this, "setSections");
3832
- m(this, "selectedItemsSignal");
3833
- m(this, "setSelectedItems");
3834
- m(this, "isLoadingSignal");
3835
- m(this, "setIsLoading");
348
+ class H {
349
+ constructor(t) {
350
+ u(this, "type", "component");
351
+ u(this, "id");
352
+ u(this, "mounted", !1);
353
+ u(this, "cleanup", []);
354
+ u(this, "dataSignal");
355
+ u(this, "setData");
356
+ u(this, "sectionsSignal");
357
+ u(this, "setSections");
358
+ u(this, "selectedItemsSignal");
359
+ u(this, "setSelectedItems");
360
+ u(this, "isLoadingSignal");
361
+ u(this, "setIsLoading");
3836
362
  // Virtual scrolling state
3837
- m(this, "virtualItems", []);
3838
- m(this, "visibleStartIndex", 0);
3839
- m(this, "visibleEndIndex", 0);
3840
- m(this, "scrollOffset", 0);
3841
- m(this, "containerHeight", 0);
3842
- m(this, "totalHeight", 0);
363
+ u(this, "virtualItems", []);
364
+ u(this, "visibleStartIndex", 0);
365
+ u(this, "visibleEndIndex", 0);
366
+ u(this, "scrollOffset", 0);
367
+ u(this, "containerHeight", 0);
368
+ u(this, "totalHeight", 0);
3843
369
  /**
3844
370
  * Handle scroll events for virtual scrolling and infinite scroll
3845
371
  */
3846
- m(this, "handleListScroll", (e) => {
3847
- this.scrollOffset = e.offset.y, this.containerHeight = e.containerSize.height, this.props.virtualScrolling?.enabled && this.calculateVisibleRange(), this.props.onLoadMore && e.edges.bottom && (w(this.props.hasMore) ? this.props.hasMore() : this.props.hasMore) && !this.isLoadingSignal() && (this.setIsLoading(!0), this.props.onLoadMore().finally(() => {
372
+ u(this, "handleListScroll", (t) => {
373
+ this.scrollOffset = t.offset.y, this.containerHeight = t.containerSize.height, this.props.virtualScrolling?.enabled && this.calculateVisibleRange(), this.props.onLoadMore && t.edges.bottom && (S(this.props.hasMore) ? this.props.hasMore() : this.props.hasMore) && !this.isLoadingSignal() && (this.setIsLoading(!0), this.props.onLoadMore().finally(() => {
3848
374
  this.setIsLoading(!1);
3849
- })), this.props.onScroll && this.props.onScroll(e);
375
+ })), this.props.onScroll && this.props.onScroll(t);
3850
376
  });
3851
- this.props = e, this.id = `list-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
3852
- const [t, s] = N(this.resolveData());
3853
- this.dataSignal = t, this.setData = s;
3854
- const [r, i] = N(
377
+ this.props = t, this.id = `list-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
378
+ const [e, i] = y(this.resolveData());
379
+ this.dataSignal = e, this.setData = i;
380
+ const [s, n] = y(
3855
381
  this.resolveSections()
3856
382
  );
3857
- this.sectionsSignal = r, this.setSections = i;
3858
- const o = /* @__PURE__ */ new Set(), [a, l] = N(o);
3859
- this.selectedItemsSignal = a, this.setSelectedItems = l;
3860
- const [h, c] = N(
383
+ this.sectionsSignal = s, this.setSections = n;
384
+ const o = /* @__PURE__ */ new Set(), [l, f] = y(o);
385
+ this.selectedItemsSignal = l, this.setSelectedItems = f;
386
+ const [a, h] = y(
3861
387
  this.resolveIsLoading()
3862
388
  );
3863
- this.isLoadingSignal = h, this.setIsLoading = c, this.setupReactiveUpdates(), e.virtualScrolling?.enabled && this.initializeVirtualScrolling();
389
+ this.isLoadingSignal = a, this.setIsLoading = h, this.setupReactiveUpdates(), t.virtualScrolling?.enabled && this.initializeVirtualScrolling();
3864
390
  }
3865
391
  /**
3866
392
  * Helper to flatten render results
3867
393
  */
3868
- flattenRenderResult(e) {
3869
- return Array.isArray(e) ? e : [e];
394
+ flattenRenderResult(t) {
395
+ return Array.isArray(t) ? t : [t];
3870
396
  }
3871
397
  /**
3872
398
  * Wrap arbitrary component output in a semantic list row.
3873
399
  */
3874
- wrapComponentInListItem(e, t, s, r = {}, i = {}) {
400
+ wrapComponentInListItem(t, e, i, s = {}, n = {}) {
3875
401
  const {
3876
402
  class: o,
3877
- style: a,
3878
- ...l
3879
- } = i, h = typeof o == "string" && o.length > 0 ? `${s} ${o}` : s, c = a && typeof a == "object" ? a : {};
403
+ style: l,
404
+ ...f
405
+ } = n, a = typeof o == "string" && o.length > 0 ? `${i} ${o}` : i, h = l && typeof l == "object" ? l : {};
3880
406
  return {
3881
407
  type: "component",
3882
- id: t,
408
+ id: e,
3883
409
  mounted: !1,
3884
410
  cleanup: [],
3885
411
  props: {},
3886
412
  render: () => {
3887
- const u = this.flattenRenderResult(e.render());
413
+ const r = this.flattenRenderResult(t.render());
3888
414
  return [
3889
- S(
415
+ m(
3890
416
  "li",
3891
417
  {
3892
- class: h,
418
+ class: a,
3893
419
  style: {
3894
420
  listStyle: "none",
3895
- ...r,
3896
- ...c
421
+ ...s,
422
+ ...h
3897
423
  },
3898
- ...l
424
+ ...f
3899
425
  },
3900
- ...u
426
+ ...r
3901
427
  )
3902
428
  ];
3903
429
  }
@@ -3909,70 +435,70 @@ class us {
3909
435
  * Strings and primitives are always emitted as text nodes to avoid HTML
3910
436
  * interpretation in list item rendering.
3911
437
  */
3912
- normalizeItemRenderOutput(e) {
3913
- return e && typeof e.render == "function" ? this.flattenRenderResult(e.render()) : e == null || e === !1 ? [] : typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? [{ type: "text", text: String(e) }] : this.flattenRenderResult(e);
438
+ normalizeItemRenderOutput(t) {
439
+ return t && typeof t.render == "function" ? this.flattenRenderResult(t.render()) : t == null || t === !1 ? [] : typeof t == "string" || typeof t == "number" || typeof t == "boolean" ? [{ type: "text", text: String(t) }] : this.flattenRenderResult(t);
3914
440
  }
3915
441
  /**
3916
442
  * Resolve data from various input types
3917
443
  */
3918
444
  resolveData() {
3919
- const { data: e } = this.props;
3920
- return Array.isArray(e) ? e : w(e) ? e() : [];
445
+ const { data: t } = this.props;
446
+ return Array.isArray(t) ? t : S(t) ? t() : [];
3921
447
  }
3922
448
  /**
3923
449
  * Resolve sections from various input types
3924
450
  */
3925
451
  resolveSections() {
3926
- const { sections: e } = this.props;
3927
- return Array.isArray(e) ? e : w(e) ? e() : [];
452
+ const { sections: t } = this.props;
453
+ return Array.isArray(t) ? t : S(t) ? t() : [];
3928
454
  }
3929
455
  /**
3930
456
  * Resolve loading state
3931
457
  */
3932
458
  resolveIsLoading() {
3933
- const { isLoading: e } = this.props;
3934
- return typeof e == "boolean" ? e : w(e) ? e() : !1;
459
+ const { isLoading: t } = this.props;
460
+ return typeof t == "boolean" ? t : S(t) ? t() : !1;
3935
461
  }
3936
462
  /**
3937
463
  * Set up reactive updates for data and state
3938
464
  */
3939
465
  setupReactiveUpdates() {
3940
- if (w(this.props.data)) {
3941
- const e = R(() => {
466
+ if (S(this.props.data)) {
467
+ const t = v(() => {
3942
468
  this.setData(this.resolveData()), this.updateVirtualScrolling();
3943
469
  });
3944
- this.cleanup.push(() => e.dispose());
470
+ this.cleanup.push(() => t.dispose());
3945
471
  }
3946
- if (w(this.props.sections)) {
3947
- const e = R(() => {
472
+ if (S(this.props.sections)) {
473
+ const t = v(() => {
3948
474
  this.setSections(this.resolveSections()), this.updateVirtualScrolling();
3949
475
  });
3950
- this.cleanup.push(() => e.dispose());
476
+ this.cleanup.push(() => t.dispose());
3951
477
  }
3952
- if (w(this.props.isLoading)) {
3953
- const e = R(() => {
478
+ if (S(this.props.isLoading)) {
479
+ const t = v(() => {
3954
480
  this.setIsLoading(this.resolveIsLoading());
3955
481
  });
3956
- this.cleanup.push(() => e.dispose());
482
+ this.cleanup.push(() => t.dispose());
3957
483
  }
3958
484
  if (this.props.selectedItems) {
3959
- const e = R(() => {
485
+ const t = v(() => {
3960
486
  this.props.selectedItems && this.setSelectedItems(this.props.selectedItems());
3961
487
  });
3962
- this.cleanup.push(() => e.dispose());
488
+ this.cleanup.push(() => t.dispose());
3963
489
  }
3964
490
  }
3965
491
  /**
3966
492
  * Initialize virtual scrolling calculations
3967
493
  */
3968
494
  initializeVirtualScrolling() {
3969
- const e = this.dataSignal(), s = this.props.virtualScrolling.estimatedItemHeight || 50;
3970
- this.virtualItems = e.map((r, i) => ({
3971
- index: i,
3972
- height: s,
3973
- offset: i * s,
3974
- item: r
3975
- })), this.totalHeight = e.length * s;
495
+ const t = this.dataSignal(), i = this.props.virtualScrolling.estimatedItemHeight || 50;
496
+ this.virtualItems = t.map((s, n) => ({
497
+ index: n,
498
+ height: i,
499
+ offset: n * i,
500
+ item: s
501
+ })), this.totalHeight = t.length * i;
3976
502
  }
3977
503
  /**
3978
504
  * Update virtual scrolling calculations
@@ -3985,99 +511,99 @@ class us {
3985
511
  */
3986
512
  calculateVisibleRange() {
3987
513
  if (!this.props.virtualScrolling?.enabled) return;
3988
- const e = this.props.virtualScrolling, t = e.overscan || 5, s = e.threshold || 0;
3989
- let r = 0;
514
+ const t = this.props.virtualScrolling, e = t.overscan || 5, i = t.threshold || 0;
515
+ let s = 0;
3990
516
  for (let o = 0; o < this.virtualItems.length; o++)
3991
- if (this.virtualItems[o].offset + this.virtualItems[o].height > this.scrollOffset - s) {
3992
- r = Math.max(0, o - t);
517
+ if (this.virtualItems[o].offset + this.virtualItems[o].height > this.scrollOffset - i) {
518
+ s = Math.max(0, o - e);
3993
519
  break;
3994
520
  }
3995
- let i = this.virtualItems.length - 1;
3996
- for (let o = r; o < this.virtualItems.length; o++)
3997
- if (this.virtualItems[o].offset > this.scrollOffset + this.containerHeight + s) {
3998
- i = Math.min(this.virtualItems.length - 1, o + t);
521
+ let n = this.virtualItems.length - 1;
522
+ for (let o = s; o < this.virtualItems.length; o++)
523
+ if (this.virtualItems[o].offset > this.scrollOffset + this.containerHeight + i) {
524
+ n = Math.min(this.virtualItems.length - 1, o + e);
3999
525
  break;
4000
526
  }
4001
- this.visibleStartIndex = r, this.visibleEndIndex = i;
527
+ this.visibleStartIndex = s, this.visibleEndIndex = n;
4002
528
  }
4003
529
  /**
4004
530
  * Handle item selection
4005
531
  */
4006
- handleItemSelection(e, t) {
4007
- const { selectionMode: s, getItemId: r, onSelectionChange: i } = this.props;
4008
- if (s === "none") return;
4009
- const o = r ? r(e, t) : t, a = new Set(this.selectedItemsSignal());
4010
- s === "single" ? (a.clear(), a.add(o)) : s === "multiple" && (a.has(o) ? a.delete(o) : a.add(o)), this.setSelectedItems(a), i && i(a);
532
+ handleItemSelection(t, e) {
533
+ const { selectionMode: i, getItemId: s, onSelectionChange: n } = this.props;
534
+ if (i === "none") return;
535
+ const o = s ? s(t, e) : e, l = new Set(this.selectedItemsSignal());
536
+ i === "single" ? (l.clear(), l.add(o)) : i === "multiple" && (l.has(o) ? l.delete(o) : l.add(o)), this.setSelectedItems(l), n && n(l);
4011
537
  }
4012
538
  /**
4013
539
  * Create list item component
4014
540
  */
4015
- createListItem(e, t, s) {
4016
- const { renderItem: r, style: i, onItemTap: o, onItemLongPress: a } = this.props, l = r(e, t);
541
+ createListItem(t, e, i) {
542
+ const { renderItem: s, style: n, onItemTap: o, onItemLongPress: l } = this.props, f = s(t, e);
4017
543
  return {
4018
544
  type: "component",
4019
- id: `${this.id}-item-${t}`,
545
+ id: `${this.id}-item-${e}`,
4020
546
  mounted: !1,
4021
547
  cleanup: [],
4022
548
  props: {},
4023
549
  render: () => {
4024
- const h = S(
550
+ const a = m(
4025
551
  "li",
4026
552
  {
4027
- class: `tachui-list-item tachui-list-item-${i || "plain"}`,
553
+ class: `tachui-list-item tachui-list-item-${n || "plain"}`,
4028
554
  style: {
4029
555
  listStyle: "none",
4030
556
  display: "flex",
4031
557
  flexDirection: "column",
4032
558
  position: "relative",
4033
- backgroundColor: s ? "#e6f3ff" : "transparent",
559
+ backgroundColor: i ? "#e6f3ff" : "transparent",
4034
560
  transition: "background-color 0.2s ease",
4035
561
  cursor: o ? "pointer" : "default"
4036
562
  }
4037
563
  },
4038
- ...this.normalizeItemRenderOutput(l)
564
+ ...this.normalizeItemRenderOutput(f)
4039
565
  );
4040
- if (h.element) {
4041
- const c = h.element;
4042
- if (o && c.addEventListener("click", () => o(e, t)), a) {
4043
- let u;
4044
- const f = () => {
4045
- u = setTimeout(
4046
- () => a(e, t),
566
+ if (a.element) {
567
+ const h = a.element;
568
+ if (o && h.addEventListener("click", () => o(t, e)), l) {
569
+ let r;
570
+ const g = () => {
571
+ r = setTimeout(
572
+ () => l(t, e),
4047
573
  500
4048
574
  );
4049
- }, p = () => {
4050
- clearTimeout(u);
575
+ }, d = () => {
576
+ clearTimeout(r);
4051
577
  };
4052
- c.addEventListener("mousedown", f), c.addEventListener("mouseup", p), c.addEventListener("mouseleave", p), c.addEventListener("touchstart", f), c.addEventListener("touchend", p);
578
+ h.addEventListener("mousedown", g), h.addEventListener("mouseup", d), h.addEventListener("mouseleave", d), h.addEventListener("touchstart", g), h.addEventListener("touchend", d);
4053
579
  }
4054
- this.props.selectionMode !== "none" && c.addEventListener("click", (u) => {
4055
- (u.metaKey || u.ctrlKey || this.props.selectionMode === "multiple") && (u.preventDefault(), this.handleItemSelection(e, t));
580
+ this.props.selectionMode !== "none" && h.addEventListener("click", (r) => {
581
+ (r.metaKey || r.ctrlKey || this.props.selectionMode === "multiple") && (r.preventDefault(), this.handleItemSelection(t, e));
4056
582
  });
4057
583
  }
4058
- return [h];
584
+ return [a];
4059
585
  }
4060
586
  };
4061
587
  }
4062
588
  /**
4063
589
  * Create list separator
4064
590
  */
4065
- createSeparator(e = 0) {
4066
- const { separator: t } = this.props;
4067
- return t ? typeof t == "object" && "render" in t ? this.wrapComponentInListItem(
4068
- t,
4069
- `${this.id}-separator-custom-${e}`,
591
+ createSeparator(t = 0) {
592
+ const { separator: e } = this.props;
593
+ return e ? typeof e == "object" && "render" in e ? this.wrapComponentInListItem(
594
+ e,
595
+ `${this.id}-separator-custom-${t}`,
4070
596
  "tachui-list-separator-item",
4071
597
  {},
4072
598
  { "aria-hidden": "true" }
4073
599
  ) : {
4074
600
  type: "component",
4075
- id: `${this.id}-separator-${e}`,
601
+ id: `${this.id}-separator-${t}`,
4076
602
  mounted: !1,
4077
603
  cleanup: [],
4078
604
  props: {},
4079
605
  render: () => [
4080
- S("li", {
606
+ m("li", {
4081
607
  class: "tachui-list-separator",
4082
608
  style: {
4083
609
  listStyle: "none",
@@ -4093,17 +619,17 @@ class us {
4093
619
  /**
4094
620
  * Create section header
4095
621
  */
4096
- createSectionHeader(e, t) {
4097
- if (!e.header) return null;
4098
- if (typeof e.header == "string")
622
+ createSectionHeader(t, e) {
623
+ if (!t.header) return null;
624
+ if (typeof t.header == "string")
4099
625
  return {
4100
626
  type: "component",
4101
- id: `${this.id}-section-header-${t}`,
627
+ id: `${this.id}-section-header-${e}`,
4102
628
  mounted: !1,
4103
629
  cleanup: [],
4104
630
  props: {},
4105
631
  render: () => {
4106
- const r = S("li", {
632
+ const s = m("li", {
4107
633
  class: "tachui-list-section-header",
4108
634
  style: {
4109
635
  listStyle: "none",
@@ -4115,31 +641,31 @@ class us {
4115
641
  textTransform: "uppercase",
4116
642
  letterSpacing: "0.5px"
4117
643
  }
4118
- }), i = r.element;
4119
- return i && (i.textContent = e.header), [r];
644
+ }), n = s.element;
645
+ return n && (n.textContent = t.header), [s];
4120
646
  }
4121
647
  };
4122
- const s = this.props.renderSectionHeader ? this.props.renderSectionHeader(e, t) : e.header;
648
+ const i = this.props.renderSectionHeader ? this.props.renderSectionHeader(t, e) : t.header;
4123
649
  return this.wrapComponentInListItem(
4124
- s,
4125
- `${this.id}-section-header-${t}`,
650
+ i,
651
+ `${this.id}-section-header-${e}`,
4126
652
  "tachui-list-section-header-item"
4127
653
  );
4128
654
  }
4129
655
  /**
4130
656
  * Create section footer
4131
657
  */
4132
- createSectionFooter(e, t) {
4133
- if (!e.footer) return null;
4134
- if (typeof e.footer == "string")
658
+ createSectionFooter(t, e) {
659
+ if (!t.footer) return null;
660
+ if (typeof t.footer == "string")
4135
661
  return {
4136
662
  type: "component",
4137
- id: `${this.id}-section-footer-${t}`,
663
+ id: `${this.id}-section-footer-${e}`,
4138
664
  mounted: !1,
4139
665
  cleanup: [],
4140
666
  props: {},
4141
667
  render: () => {
4142
- const r = S("li", {
668
+ const s = m("li", {
4143
669
  class: "tachui-list-section-footer",
4144
670
  style: {
4145
671
  listStyle: "none",
@@ -4147,14 +673,14 @@ class us {
4147
673
  fontSize: "12px",
4148
674
  color: "#999"
4149
675
  }
4150
- }), i = r.element;
4151
- return i && (i.textContent = e.footer), [r];
676
+ }), n = s.element;
677
+ return n && (n.textContent = t.footer), [s];
4152
678
  }
4153
679
  };
4154
- const s = this.props.renderSectionFooter ? this.props.renderSectionFooter(e, t) : e.footer;
680
+ const i = this.props.renderSectionFooter ? this.props.renderSectionFooter(t, e) : t.footer;
4155
681
  return this.wrapComponentInListItem(
4156
- s,
4157
- `${this.id}-section-footer-${t}`,
682
+ i,
683
+ `${this.id}-section-footer-${e}`,
4158
684
  "tachui-list-section-footer-item"
4159
685
  );
4160
686
  }
@@ -4162,15 +688,15 @@ class us {
4162
688
  * Create empty state component
4163
689
  */
4164
690
  createEmptyState() {
4165
- const { emptyState: e } = this.props;
4166
- return e || {
691
+ const { emptyState: t } = this.props;
692
+ return t || {
4167
693
  type: "component",
4168
694
  id: `${this.id}-empty`,
4169
695
  mounted: !1,
4170
696
  cleanup: [],
4171
697
  props: {},
4172
698
  render: () => [
4173
- S(
699
+ m(
4174
700
  "div",
4175
701
  {
4176
702
  class: "tachui-list-empty",
@@ -4193,15 +719,15 @@ class us {
4193
719
  * Create loading indicator
4194
720
  */
4195
721
  createLoadingIndicator() {
4196
- const { loadingIndicator: e } = this.props;
4197
- return e || {
722
+ const { loadingIndicator: t } = this.props;
723
+ return t || {
4198
724
  type: "component",
4199
725
  id: `${this.id}-loading`,
4200
726
  mounted: !1,
4201
727
  cleanup: [],
4202
728
  props: {},
4203
729
  render: () => [
4204
- S(
730
+ m(
4205
731
  "div",
4206
732
  {
4207
733
  class: "tachui-list-loading",
@@ -4224,79 +750,79 @@ class us {
4224
750
  renderVirtualContent() {
4225
751
  if (!this.props.virtualScrolling?.enabled)
4226
752
  return this.renderRegularContent();
4227
- const e = this.dataSignal(), t = this.selectedItemsSignal(), s = [];
753
+ const t = this.dataSignal(), e = this.selectedItemsSignal(), i = [];
4228
754
  if (this.visibleStartIndex > 0) {
4229
- const r = this.virtualItems[this.visibleStartIndex]?.offset || 0;
4230
- s.push({
755
+ const s = this.virtualItems[this.visibleStartIndex]?.offset || 0;
756
+ i.push({
4231
757
  type: "component",
4232
758
  id: `${this.id}-spacer-top`,
4233
759
  mounted: !1,
4234
760
  cleanup: [],
4235
761
  props: {},
4236
762
  render: () => [
4237
- S("li", {
763
+ m("li", {
4238
764
  class: "tachui-list-spacer tachui-list-spacer-top",
4239
- style: { listStyle: "none", height: `${r}px` },
765
+ style: { listStyle: "none", height: `${s}px` },
4240
766
  "aria-hidden": "true"
4241
767
  })
4242
768
  ]
4243
769
  });
4244
770
  }
4245
- for (let r = this.visibleStartIndex; r <= this.visibleEndIndex && r < e.length; r++) {
4246
- const i = e[r], o = this.props.getItemId ? this.props.getItemId(i, r) : r, a = t.has(o);
4247
- if (s.push(this.createListItem(i, r, a)), r < e.length - 1) {
4248
- const l = this.createSeparator(r);
4249
- if (!l) continue;
4250
- s.push(l);
771
+ for (let s = this.visibleStartIndex; s <= this.visibleEndIndex && s < t.length; s++) {
772
+ const n = t[s], o = this.props.getItemId ? this.props.getItemId(n, s) : s, l = e.has(o);
773
+ if (i.push(this.createListItem(n, s, l)), s < t.length - 1) {
774
+ const f = this.createSeparator(s);
775
+ if (!f) continue;
776
+ i.push(f);
4251
777
  }
4252
778
  }
4253
- if (this.visibleEndIndex < e.length - 1) {
4254
- const r = this.totalHeight - (this.virtualItems[this.visibleEndIndex + 1]?.offset || 0);
4255
- s.push({
779
+ if (this.visibleEndIndex < t.length - 1) {
780
+ const s = this.totalHeight - (this.virtualItems[this.visibleEndIndex + 1]?.offset || 0);
781
+ i.push({
4256
782
  type: "component",
4257
783
  id: `${this.id}-spacer-bottom`,
4258
784
  mounted: !1,
4259
785
  cleanup: [],
4260
786
  props: {},
4261
787
  render: () => [
4262
- S("li", {
788
+ m("li", {
4263
789
  class: "tachui-list-spacer tachui-list-spacer-bottom",
4264
- style: { listStyle: "none", height: `${r}px` },
790
+ style: { listStyle: "none", height: `${s}px` },
4265
791
  "aria-hidden": "true"
4266
792
  })
4267
793
  ]
4268
794
  });
4269
795
  }
4270
- return s;
796
+ return i;
4271
797
  }
4272
798
  /**
4273
799
  * Render regular (non-virtual) content
4274
800
  */
4275
801
  renderRegularContent() {
4276
- const e = this.dataSignal(), t = this.sectionsSignal(), s = this.selectedItemsSignal(), r = [];
4277
- return t.length > 0 ? t.forEach((i, o) => {
4278
- const a = this.createSectionHeader(i, o);
4279
- a && r.push(a), i.items.forEach((h, c) => {
4280
- const u = o * 1e3 + c, f = this.props.getItemId ? this.props.getItemId(h, u) : u, p = s.has(f);
4281
- if (r.push(this.createListItem(h, u, p)), c < i.items.length - 1) {
4282
- const v = this.createSeparator(u);
4283
- v && r.push(v);
802
+ const t = this.dataSignal(), e = this.sectionsSignal(), i = this.selectedItemsSignal(), s = [];
803
+ return e.length > 0 ? e.forEach((n, o) => {
804
+ const l = this.createSectionHeader(n, o);
805
+ l && s.push(l), n.items.forEach((a, h) => {
806
+ const r = o * 1e3 + h, g = this.props.getItemId ? this.props.getItemId(a, r) : r, d = i.has(g);
807
+ if (s.push(this.createListItem(a, r, d)), h < n.items.length - 1) {
808
+ const I = this.createSeparator(r);
809
+ I && s.push(I);
4284
810
  }
4285
811
  });
4286
- const l = this.createSectionFooter(i, o);
4287
- l && r.push(l);
4288
- }) : e.forEach((i, o) => {
4289
- const a = this.props.getItemId ? this.props.getItemId(i, o) : o, l = s.has(a);
4290
- if (r.push(this.createListItem(i, o, l)), o < e.length - 1) {
4291
- const h = this.createSeparator(o);
4292
- h && r.push(h);
812
+ const f = this.createSectionFooter(n, o);
813
+ f && s.push(f);
814
+ }) : t.forEach((n, o) => {
815
+ const l = this.props.getItemId ? this.props.getItemId(n, o) : o, f = i.has(l);
816
+ if (s.push(this.createListItem(n, o, f)), o < t.length - 1) {
817
+ const a = this.createSeparator(o);
818
+ a && s.push(a);
4293
819
  }
4294
- }), r;
820
+ }), s;
4295
821
  }
4296
822
  /**
4297
823
  * Wrap list rows in a semantic list container.
4298
824
  */
4299
- createListContainer(e) {
825
+ createListContainer(t) {
4300
826
  return {
4301
827
  type: "component",
4302
828
  id: `${this.id}-content`,
@@ -4304,7 +830,7 @@ class us {
4304
830
  cleanup: [],
4305
831
  props: {},
4306
832
  render: () => [
4307
- S(
833
+ m(
4308
834
  "ul",
4309
835
  {
4310
836
  role: "list",
@@ -4316,7 +842,7 @@ class us {
4316
842
  width: "100%"
4317
843
  }
4318
844
  },
4319
- ...e.flatMap((t) => t.render())
845
+ ...t.flatMap((e) => e.render())
4320
846
  )
4321
847
  ]
4322
848
  };
@@ -4325,19 +851,19 @@ class us {
4325
851
  * Render the list component
4326
852
  */
4327
853
  render() {
4328
- const e = this.dataSignal(), t = this.isLoadingSignal();
4329
- if (t && e.length === 0) {
854
+ const t = this.dataSignal(), e = this.isLoadingSignal();
855
+ if (e && t.length === 0) {
4330
856
  const o = this.createLoadingIndicator();
4331
857
  return o ? o.render() : [];
4332
858
  }
4333
- if (e.length === 0 && !t) {
859
+ if (t.length === 0 && !e) {
4334
860
  const o = this.createEmptyState();
4335
861
  return o ? o.render() : [];
4336
862
  }
4337
- const s = this.props.virtualScrolling?.enabled ? this.renderVirtualContent() : this.renderRegularContent();
4338
- if (t && e.length > 0) {
863
+ const i = this.props.virtualScrolling?.enabled ? this.renderVirtualContent() : this.renderRegularContent();
864
+ if (e && t.length > 0) {
4339
865
  const o = this.createLoadingIndicator();
4340
- o && s.push(
866
+ o && i.push(
4341
867
  this.wrapComponentInListItem(
4342
868
  o,
4343
869
  `${this.id}-loading-row`,
@@ -4345,65 +871,65 @@ class us {
4345
871
  )
4346
872
  );
4347
873
  }
4348
- const r = {
874
+ const s = {
4349
875
  ...this.props,
4350
- children: [this.createListContainer(s)],
876
+ children: [this.createListContainer(i)],
4351
877
  onScroll: this.handleListScroll
4352
878
  };
4353
- return new hs(r).render();
879
+ return new O(s).render();
4354
880
  }
4355
881
  }
4356
- function Z(n) {
4357
- const e = new us(n);
4358
- return pe(e);
882
+ function b(c) {
883
+ const t = new H(c);
884
+ return T(t);
4359
885
  }
4360
- const As = {
886
+ const k = {
4361
887
  /**
4362
888
  * Create a simple list from array
4363
889
  */
4364
- simple(n, e, t = {}) {
4365
- return Z({
4366
- ...t,
4367
- data: n,
4368
- renderItem: e
890
+ simple(c, t, e = {}) {
891
+ return b({
892
+ ...e,
893
+ data: c,
894
+ renderItem: t
4369
895
  });
4370
896
  },
4371
897
  /**
4372
898
  * Create a sectioned list
4373
899
  */
4374
- sectioned(n, e, t = {}) {
4375
- return Z({
4376
- ...t,
4377
- sections: n,
4378
- renderItem: e
900
+ sectioned(c, t, e = {}) {
901
+ return b({
902
+ ...e,
903
+ sections: c,
904
+ renderItem: t
4379
905
  });
4380
906
  },
4381
907
  /**
4382
908
  * Create a virtual scrolling list for large datasets
4383
909
  */
4384
- virtual(n, e, t, s = {}) {
4385
- return Z({
4386
- ...s,
4387
- data: n,
4388
- renderItem: e,
4389
- virtualScrolling: t
910
+ virtual(c, t, e, i = {}) {
911
+ return b({
912
+ ...i,
913
+ data: c,
914
+ renderItem: t,
915
+ virtualScrolling: e
4390
916
  });
4391
917
  },
4392
918
  /**
4393
919
  * Create an infinite scrolling list
4394
920
  */
4395
- infinite(n, e, t, s, r = {}) {
4396
- return Z({
4397
- ...r,
4398
- data: n,
4399
- renderItem: e,
4400
- onLoadMore: t,
4401
- hasMore: s
921
+ infinite(c, t, e, i, s = {}) {
922
+ return b({
923
+ ...s,
924
+ data: c,
925
+ renderItem: t,
926
+ onLoadMore: e,
927
+ hasMore: i
4402
928
  });
4403
929
  }
4404
930
  };
4405
931
  export {
4406
- us as E,
4407
- Z as L,
4408
- As as a
932
+ H as E,
933
+ b as L,
934
+ k as a
4409
935
  };