@tachui/responsive 0.8.23 → 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.
package/dist/index.mjs CHANGED
@@ -1,2896 +1,76 @@
1
- import { globalModifierRegistry as F } from "@tachui/registry";
2
- import { BaseModifier as oe } from "@tachui/modifiers";
3
- import { createSignal as I, createEffect as V, isSignal as D, isComputed as P, getThemeSignal as ye, createComputed as m, createMemo as xe } from "@tachui/core";
4
- const g = {
5
- Clean: 0,
6
- Check: 1,
7
- Dirty: 2,
8
- Disposed: 3
9
- };
10
- let we = 0;
11
- const Se = Math.random().toString(36).substr(2, 6);
12
- let X = null, J = null;
13
- const Ce = /* @__PURE__ */ new Set();
14
- Ce.add(Se);
15
- const _ = {
16
- get currentComputation() {
17
- return X;
18
- },
19
- set currentComputation(s) {
20
- X = s;
21
- },
22
- get currentOwner() {
23
- return J;
24
- },
25
- set currentOwner(s) {
26
- J = s;
27
- }
28
- };
29
- function ae() {
30
- return _.currentComputation;
31
- }
32
- function $e() {
33
- return _.currentOwner;
34
- }
35
- class Be {
36
- id;
37
- owner;
38
- fn;
39
- sources = /* @__PURE__ */ new Set();
40
- // Signals this computation depends on
41
- observers = /* @__PURE__ */ new Set();
42
- // Computations that depend on this
43
- state = g.Dirty;
44
- value = void 0;
45
- constructor(e, t = null) {
46
- this.id = ++we, this.fn = e, this.owner = t, t && !t.disposed && t.sources.add(this);
47
- }
48
- execute() {
49
- if (this.state === g.Disposed)
50
- return this.value;
51
- for (const t of this.sources)
52
- t && typeof t == "object" && "removeObserver" in t && t.removeObserver(this);
53
- this.sources.clear();
54
- const e = _.currentComputation;
55
- _.currentComputation = this;
56
- try {
57
- return this.state = g.Clean, this.value = this.fn(), this.value;
58
- } catch (t) {
59
- throw this.state = g.Disposed, (typeof process > "u" || process.env.NODE_ENV !== "test") && console.error("Error in computation:", t), t;
60
- } finally {
61
- _.currentComputation = e;
62
- }
63
- }
64
- dispose() {
65
- if (this.state !== g.Disposed) {
66
- this.state = g.Disposed;
67
- for (const e of this.sources)
68
- e && typeof e == "object" && "removeObserver" in e && e.removeObserver(this);
69
- this.sources.clear();
70
- for (const e of this.observers)
71
- e.sources.delete(this);
72
- this.observers.clear(), this.owner && !this.owner.disposed && this.owner.sources.delete(this);
73
- }
74
- }
75
- }
76
- typeof globalThis.__DEV__ > "u" && (globalThis.__DEV__ = process.env.NODE_ENV !== "production");
77
- const ke = (s, e) => s === e;
78
- var G = /* @__PURE__ */ ((s) => (s[s.Immediate = 0] = "Immediate", s[s.High = 1] = "High", s[s.Normal = 2] = "Normal", s[s.Low = 3] = "Low", s[s.Idle = 4] = "Idle", s))(G || {});
79
- class Re extends Be {
80
- type = "computed";
81
- priority;
82
- _hasValue = !1;
83
- _error = null;
84
- equalsFn;
85
- options;
86
- constructor(e, t = {}, i = $e()) {
87
- super(e, i), this.priority = t.priority ?? G.Normal, this.equalsFn = t.equals ?? ke, this.options = t;
88
- }
89
- /**
90
- * Get the computed value, tracking dependency and lazily computing
91
- */
92
- getValue() {
93
- const e = ae();
94
- return e && e.state !== g.Disposed && (this.observers.add(e), e.sources.add(this)), (this.state === g.Dirty || !this._hasValue) && (this.execute(), this._hasValue = !0), this.value;
95
- }
96
- /**
97
- * Get the current value without tracking dependency
98
- */
99
- peek() {
100
- return (this.state === g.Dirty || !this._hasValue) && (this.execute(), this._hasValue = !0), this.value;
101
- }
102
- /**
103
- * Remove an observer (cleanup)
104
- */
105
- removeObserver(e) {
106
- this.observers.delete(e), this.options.releaseOnNoObservers === !0 && this.observers.size === 0 && e.state === g.Disposed && this.releaseSources();
107
- }
108
- releaseSources() {
109
- for (const e of this.sources)
110
- "removeObserver" in e && e.removeObserver(this);
111
- this.sources.clear(), this._hasValue = !1, this.state = g.Dirty;
112
- }
113
- /**
114
- * Execute the computation and notify observers
115
- */
116
- execute() {
117
- const e = this._hasValue ? this.value : void 0, t = super.execute();
118
- if (!this._hasValue || !this.equalsFn(e, t))
119
- for (const i of this.observers)
120
- i.state !== g.Disposed && (i.state = g.Dirty, "execute" in i && typeof i.execute == "function" && queueMicrotask(() => {
121
- i.state === g.Dirty && i.execute();
122
- }));
123
- return t;
124
- }
125
- /**
126
- * Notify method for ReactiveNode compatibility
127
- */
128
- notify() {
129
- this.execute();
130
- }
131
- /**
132
- * Complete cleanup for memory management
133
- */
134
- cleanup() {
135
- for (const e of this.sources)
136
- "removeObserver" in e && e.removeObserver(this);
137
- this.sources.clear();
138
- for (const e of this.observers)
139
- e.sources.delete(this);
140
- this.observers.clear(), this._hasValue = !1, this._error = null, this.state = g.Disposed;
141
- }
142
- /**
143
- * Dispose the computed value
144
- */
145
- dispose() {
146
- this.cleanup(), super.dispose();
147
- }
148
- /**
149
- * Debug information
150
- */
151
- [Symbol.for("tachui.debug")]() {
152
- return {
153
- id: this.id,
154
- type: this.type,
155
- value: this._hasValue ? this.value : void 0,
156
- hasValue: this._hasValue,
157
- error: this._error?.message,
158
- state: this.state,
159
- sourceCount: this.sources.size,
160
- observerCount: this.observers.size,
161
- priority: G[this.priority],
162
- debugName: this.options.debugName,
163
- equalsFn: this.equalsFn.name || "anonymous"
164
- };
165
- }
166
- toString() {
167
- return `Computed(${this.options.debugName || this.id}): ${this._hasValue ? this.value : "no value"}`;
168
- }
169
- }
170
- function Me(s, e) {
171
- const t = new Re(s, e), i = t.getValue.bind(t);
172
- return i.peek = t.peek.bind(t), Object.defineProperty(i, Symbol.for("tachui.computed"), {
173
- value: t,
174
- enumerable: !1
175
- }), i;
176
- }
177
- let Oe = 0;
178
- class Ve {
179
- id;
180
- observers = /* @__PURE__ */ new Set();
181
- _value;
182
- constructor(e) {
183
- this.id = ++Oe, this._value = e;
184
- }
185
- /**
186
- * Get the current value and track dependency
187
- */
188
- getValue() {
189
- const e = ae();
190
- return e && e.state !== g.Disposed && (this.observers.add(e), e.sources.add(this)), this._value;
191
- }
192
- /**
193
- * Get the current value without tracking dependency
194
- */
195
- peek() {
196
- return this._value;
197
- }
198
- /**
199
- * Set a new value and notify observers
200
- */
201
- set(e) {
202
- const t = typeof e == "function" ? e(this._value) : e;
203
- return t !== this._value && (this._value = t, this.notify()), t;
204
- }
205
- /**
206
- * Notify all observers that this signal has changed
207
- */
208
- notify() {
209
- for (const e of this.observers)
210
- e.state !== g.Disposed && (e.state = g.Dirty, Ee(e));
211
- }
212
- /**
213
- * Remove an observer (cleanup)
214
- */
215
- removeObserver(e) {
216
- this.observers.delete(e);
217
- }
218
- /**
219
- * Get debug information about this signal
220
- */
221
- [Symbol.for("tachui.debug")]() {
222
- return {
223
- id: this.id,
224
- value: this._value,
225
- observerCount: this.observers.size,
226
- type: "Signal"
227
- };
228
- }
229
- }
230
- const N = /* @__PURE__ */ new Set();
231
- let q = !1;
232
- function Ee(s) {
233
- N.add(s), q || queueMicrotask(Ie);
234
- }
235
- function Ie() {
236
- if (!q) {
237
- q = !0;
238
- try {
239
- for (; N.size > 0; ) {
240
- const s = Array.from(N).sort((e, t) => e.id - t.id);
241
- N.clear();
242
- for (const e of s)
243
- e.state === g.Dirty && e.execute();
244
- }
245
- } finally {
246
- q = !1;
247
- }
248
- }
249
- }
250
- function Te(s) {
251
- const e = new Ve(s), t = e.getValue.bind(e);
252
- t.peek = e.peek.bind(e);
253
- const i = e.set.bind(e);
254
- return Object.defineProperty(t, Symbol.for("tachui.signal"), {
255
- value: e,
256
- enumerable: !1
257
- }), [t, i];
258
- }
259
- const [je, at] = Te("light");
260
- Me(() => {
261
- const s = je();
262
- return s === "system" ? De() : s;
263
- });
264
- function De() {
265
- return typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
266
- }
267
- process.env.NODE_ENV, process.env.NODE_ENV;
268
- process.env.NODE_ENV === "development" && console.log("📤 Created RegistryAdapter for globalModifierRegistry", {
269
- registryId: F.instanceId,
270
- currentSize: F.list().length
271
- });
272
- const Pe = "0.8.23", _e = Pe, ee = /* @__PURE__ */ new WeakSet(), te = /* @__PURE__ */ new WeakMap(), ze = {
273
- name: "@tachui/core",
274
- version: _e,
275
- author: "TachUI Team",
276
- verified: !0
277
- };
278
- function Le(s) {
279
- ee.has(s) || (s.setFeatureFlags({
280
- metadataRegistration: !0
281
- }), ee.add(s));
282
- }
283
- function Ne(s, e) {
284
- let t = te.get(s);
285
- t || (t = /* @__PURE__ */ new Set(), te.set(s, t)), !t.has(e.name) && (s.registerPlugin(e), t.add(e.name));
286
- }
287
- function qe(s, e, t, i = F, r = ze) {
288
- Le(i), Ne(i, r), i.has(s) || i.register(s, e), i.getMetadata(s) || i.registerMetadata({
289
- ...t,
290
- name: s,
291
- plugin: r.name
292
- });
293
- }
294
- const Ae = "0.8.23", Qe = Ae, K = {
295
- base: "0px",
296
- // Mobile-first base
297
- sm: "640px",
298
- // Small tablets and large phones
299
- md: "768px",
300
- // Tablets
301
- lg: "1024px",
302
- // Laptops and small desktops
303
- xl: "1280px",
304
- // Large desktops
305
- "2xl": "1536px"
306
- // Extra large screens
307
- };
308
- function w(s) {
309
- return typeof s == "object" && s !== null && !Array.isArray(s) && Object.keys(s).some(
310
- (e) => ["base", "sm", "md", "lg", "xl", "2xl"].includes(e)
311
- );
312
- }
313
- function ie(s) {
314
- return ["base", "sm", "md", "lg", "xl", "2xl"].includes(s);
315
- }
316
- let T = {
317
- ...K
318
- };
319
- const [ce, U] = I("base"), [de, ue] = I({
320
- width: 0,
321
- height: 0
322
- });
323
- let Q = !1;
324
- const le = () => {
325
- W(), E();
326
- }, pe = () => {
327
- setTimeout(() => {
328
- W(), E();
329
- }, 100);
330
- };
331
- function ct(s) {
332
- We(s), T = {
333
- ...K,
334
- ...s
335
- }, E(), typeof window < "u" && window.addEventListener("resize", E);
336
- }
337
- function z() {
338
- return { ...T };
339
- }
340
- function x() {
341
- return ce;
342
- }
343
- function dt() {
344
- return de;
345
- }
346
- function ut() {
347
- typeof window > "u" || Q || (W(), E(), window.addEventListener("resize", le), window.addEventListener("orientationchange", pe), Q = !0);
348
- }
349
- function lt() {
350
- typeof window > "u" || (W(), E());
351
- }
352
- function pt() {
353
- T = {
354
- ...K
355
- }, U("base"), ue({
356
- width: 0,
357
- height: 0
358
- }), typeof window < "u" && Q && (window.removeEventListener("resize", le), window.removeEventListener("orientationchange", pe)), Q = !1;
359
- }
360
- function S() {
361
- const s = ce(), e = de();
362
- return {
363
- current: s,
364
- width: e.width,
365
- height: e.height,
366
- isAbove: (t) => re(s, t),
367
- isBelow: (t) => se(s, t),
368
- isBetween: (t, i) => re(s, t) && se(s, i),
369
- matches: (t) => window.matchMedia(t).matches
370
- };
371
- }
372
- function Z(s) {
373
- const e = T[s];
374
- return e.endsWith("px") ? parseInt(e, 10) : e.endsWith("em") || e.endsWith("rem") ? parseInt(e, 10) * 16 : parseInt(e, 10) || 0;
375
- }
376
- function y(s) {
377
- return ["base", "sm", "md", "lg", "xl", "2xl"].indexOf(s);
378
- }
379
- function re(s, e) {
380
- return y(s) > y(e);
381
- }
382
- function se(s, e) {
383
- return y(s) < y(e);
384
- }
385
- function He(s) {
386
- return s === "base" ? "" : `(min-width: ${T[s]})`;
387
- }
388
- function ht(s, e) {
389
- const t = [];
390
- if (s !== "base" && t.push(`(min-width: ${T[s]})`), e && e !== "2xl") {
391
- const i = ["sm", "md", "lg", "xl", "2xl"], r = i.indexOf(e);
392
- if (r >= 0 && r < i.length - 1) {
393
- const o = i[r + 1], n = `${Z(o) - 1}px`;
394
- t.push(`(max-width: ${n})`);
395
- }
396
- }
397
- return t.length > 0 ? t.join(" and ") : "";
398
- }
399
- function H() {
400
- return ["base", "sm", "md", "lg", "xl", "2xl"];
401
- }
402
- function ft(s) {
403
- const e = H(), t = e.indexOf(s);
404
- return t >= 0 ? e.slice(t + 1) : [];
405
- }
406
- function mt(s) {
407
- const e = H(), t = e.indexOf(s);
408
- return t > 0 ? e.slice(0, t) : [];
409
- }
410
- function E() {
411
- if (typeof window > "u")
412
- return;
413
- const s = window.innerWidth, e = H().reverse();
414
- for (const t of e)
415
- if (t === "base" || s >= Z(t)) {
416
- U(t);
417
- return;
418
- }
419
- U("base");
420
- }
421
- function W() {
422
- typeof window < "u" && ue({
423
- width: window.innerWidth,
424
- height: window.innerHeight
425
- });
426
- }
427
- function We(s) {
428
- for (const [t, i] of Object.entries(s)) {
429
- if (!ie(t))
430
- throw new Error(
431
- `Invalid breakpoint key: "${t}". Valid keys are: base, sm, md, lg, xl, 2xl`
432
- );
433
- if (typeof i != "string")
434
- throw new Error(
435
- `Breakpoint value for "${t}" must be a string (e.g., "768px")`
436
- );
437
- if (!i.match(/^\d+(\.\d+)?(px|em|rem|%)$/))
438
- throw new Error(
439
- `Invalid breakpoint value for "${t}": "${i}". Must be a valid CSS length (e.g., "768px", "48em")`
440
- );
441
- }
442
- const e = Object.keys(s).filter(ie).sort((t, i) => y(t) - y(i));
443
- for (let t = 1; t < e.length; t++) {
444
- const i = e[t - 1], r = e[t], o = s[i], n = s[r];
445
- if (Z(i) >= parseInt(n, 10))
446
- throw new Error(
447
- `Breakpoint "${r}" (${n}) must be larger than "${i}" (${o})`
448
- );
449
- }
450
- }
451
- const gt = {
452
- // Tailwind CSS (default)
453
- tailwind: {
454
- sm: "640px",
455
- md: "768px",
456
- lg: "1024px",
457
- xl: "1280px",
458
- "2xl": "1536px"
459
- },
460
- // Bootstrap
461
- bootstrap: {
462
- sm: "576px",
463
- md: "768px",
464
- lg: "992px",
465
- xl: "1200px",
466
- "2xl": "1400px"
467
- },
468
- // Material Design
469
- material: {
470
- sm: "600px",
471
- md: "960px",
472
- lg: "1280px",
473
- xl: "1920px",
474
- "2xl": "2560px"
475
- },
476
- // Custom mobile-first
477
- mobileFocus: {
478
- sm: "480px",
479
- md: "768px",
480
- lg: "1024px",
481
- xl: "1200px",
482
- "2xl": "1440px"
483
- }
484
- };
485
- class he {
486
- options;
487
- constructor(e) {
488
- this.options = {
489
- generateMinified: !1,
490
- includeComments: !0,
491
- optimizeOutput: !0,
492
- mobileFirst: !0,
493
- ...e
494
- };
495
- }
496
- /**
497
- * Generate complete responsive CSS from a style configuration
498
- */
499
- generateResponsiveCSS(e) {
500
- const t = [], i = [], r = {};
501
- let o = !1;
502
- for (const [n, a] of Object.entries(e))
503
- if (w(a)) {
504
- o = !0;
505
- const c = this.generatePropertyMediaQueries(n, a);
506
- t.push(...c.mediaQueries), c.baseStyles && Object.assign(r, c.baseStyles);
507
- } else
508
- r[this.toCSSPropertyName(n)] = this.formatCSSValue(
509
- n,
510
- a
511
- );
512
- return i.push(...this.generateCSSRules(t, r)), {
513
- cssRules: i,
514
- mediaQueries: t,
515
- fallbackStyles: r,
516
- hasResponsiveStyles: o
517
- };
518
- }
519
- /**
520
- * Generate media queries for a single property
521
- */
522
- generatePropertyMediaQueries(e, t) {
523
- const i = [], r = {}, o = H();
524
- for (const n of o) {
525
- const a = t[n];
526
- if (a === void 0) continue;
527
- const c = this.toCSSPropertyName(e), d = this.formatCSSValue(e, a);
528
- if (n === "base")
529
- r[c] = d;
530
- else {
531
- const l = He(n), p = { [c]: d };
532
- i.push({
533
- breakpoint: n,
534
- query: l,
535
- styles: p,
536
- selector: this.options.selector
537
- });
538
- }
539
- }
540
- return {
541
- mediaQueries: i,
542
- baseStyles: Object.keys(r).length > 0 ? r : void 0
543
- };
544
- }
545
- /**
546
- * Generate CSS rules from media queries and base styles
547
- */
548
- generateCSSRules(e, t) {
549
- const i = [];
550
- if (Object.keys(t).length > 0) {
551
- const o = this.generateCSSRule(this.options.selector, t);
552
- i.push(o);
553
- }
554
- const r = this.groupQueriesByMediaQuery(e);
555
- for (const [o, n] of Object.entries(r)) {
556
- if (o === "") continue;
557
- const a = {};
558
- for (const d of n)
559
- Object.assign(a, d.styles);
560
- const c = this.generateMediaQueryRule(
561
- o,
562
- this.options.selector,
563
- a
564
- );
565
- i.push(c);
566
- }
567
- return i;
568
- }
569
- /**
570
- * Group media queries by their query string for optimization
571
- */
572
- groupQueriesByMediaQuery(e) {
573
- const t = {};
574
- for (const i of e)
575
- t[i.query] || (t[i.query] = []), t[i.query].push(i);
576
- return t;
577
- }
578
- /**
579
- * Generate a single CSS rule
580
- */
581
- generateCSSRule(e, t) {
582
- const { generateMinified: i, includeComments: r } = this.options, o = i ? "" : " ", n = i ? "" : `
583
- `, a = i ? "" : " ";
584
- let c = `${e}${a}{${n}`;
585
- for (const [d, l] of Object.entries(t))
586
- c += `${o}${d}:${a}${l};${n}`;
587
- return c += `}${n}`, r && !i && (c = `/* Base styles (mobile-first) */${n}${c}`), c;
588
- }
589
- /**
590
- * Generate a CSS media query rule
591
- */
592
- generateMediaQueryRule(e, t, i) {
593
- const { generateMinified: r, includeComments: o } = this.options, n = r ? "" : " ", a = r ? "" : " ", c = r ? "" : `
594
- `, d = r ? "" : " ";
595
- let l = `@media ${e}${d}{${c}`;
596
- l += `${n}${t}${d}{${c}`;
597
- for (const [p, f] of Object.entries(i))
598
- l += `${a}${p}:${d}${f};${c}`;
599
- return l += `${n}}${c}`, l += `}${c}`, o && !r && (l = `/* ${this.getBreakpointFromQuery(e)} styles */${c}${l}`), l;
600
- }
601
- /**
602
- * Convert camelCase property to CSS kebab-case
603
- */
604
- toCSSProperty(e) {
605
- return e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`);
606
- }
607
- /**
608
- * Format CSS value with appropriate units and validation
609
- */
610
- formatCSSValue(e, t) {
611
- if (t == null)
612
- return "inherit";
613
- if (typeof t == "number") {
614
- const i = [
615
- "opacity",
616
- "z-index",
617
- "font-weight",
618
- "line-height",
619
- "flex-grow",
620
- "flex-shrink",
621
- "order",
622
- "grid-column-start",
623
- "grid-column-end",
624
- "grid-row-start",
625
- "grid-row-end"
626
- ], r = this.toCSSProperty(e);
627
- if (i.includes(r))
628
- return this.addImportantIfNeeded(e, t.toString());
629
- if ([
630
- "width",
631
- "height",
632
- "min-width",
633
- "max-width",
634
- "min-height",
635
- "max-height",
636
- "padding",
637
- "margin",
638
- "border-width",
639
- "border-radius",
640
- "top",
641
- "right",
642
- "bottom",
643
- "left",
644
- "font-size",
645
- "letter-spacing",
646
- "text-indent"
647
- ].some((n) => r.includes(n)))
648
- return this.addImportantIfNeeded(e, `${t}px`);
649
- }
650
- return this.addImportantIfNeeded(e, t.toString());
651
- }
652
- /**
653
- * Add !important for properties that need to override base component styles
654
- */
655
- addImportantIfNeeded(e, t) {
656
- const i = [
657
- "flexDirection",
658
- "flex-direction",
659
- "justifyContent",
660
- "justify-content",
661
- "alignItems",
662
- "align-items",
663
- "display"
664
- ], r = this.toCSSProperty(e);
665
- return i.includes(e) || i.includes(r) ? `${t} !important` : t;
666
- }
667
- /**
668
- * Convert property name to appropriate CSS property (including custom properties)
669
- */
670
- toCSSPropertyName(e) {
671
- return this.toCSSProperty(e);
672
- }
673
- /**
674
- * Extract breakpoint name from media query for comments
675
- */
676
- getBreakpointFromQuery(e) {
677
- const t = z();
678
- for (const [i, r] of Object.entries(t))
679
- if (e.includes(r))
680
- return i;
681
- return "custom";
682
- }
683
- }
684
- function bt(s, e, t, i) {
685
- if (!w(t)) {
686
- const a = e.replace(
687
- /[A-Z]/g,
688
- (d) => `-${d.toLowerCase()}`
689
- ), c = typeof t == "number" ? `${t}px` : t.toString();
690
- return [`${s} { ${a}: ${c}; }`];
691
- }
692
- const r = new he({ selector: s, ...i }), o = { [e]: t };
693
- return r.generateResponsiveCSS(o).cssRules;
694
- }
695
- function vt(s, e, t) {
696
- const { generateMinified: i = !1 } = t || {}, r = i ? "" : " ", o = i ? "" : `
697
- `, n = i ? "" : " ";
698
- let a = `@media ${e.query}${n}{${o}`;
699
- a += `${r}${s}${n}{${o}`;
700
- for (const [c, d] of Object.entries(e.styles)) {
701
- const l = c.replace(
702
- /[A-Z]/g,
703
- (f) => `-${f.toLowerCase()}`
704
- ), p = typeof d == "number" ? `${d}px` : d.toString();
705
- a += `${r}${r}${l}:${n}${p};${o}`;
706
- }
707
- return a += `${r}}${o}`, a += `}${o}`, a;
708
- }
709
- class fe {
710
- static styleSheet = null;
711
- static injectedRules = /* @__PURE__ */ new Set();
712
- /**
713
- * Get or create the tachUI responsive stylesheet
714
- */
715
- static getStyleSheet() {
716
- if (this.styleSheet)
717
- return this.styleSheet;
718
- const e = document.createElement("style");
719
- return e.setAttribute("data-tachui-responsive", "true"), document.head.appendChild(e), this.styleSheet = e.sheet, this.styleSheet;
720
- }
721
- /**
722
- * Inject CSS rules into the document
723
- */
724
- static injectCSS(e) {
725
- if (typeof document > "u")
726
- return;
727
- const t = this.getStyleSheet();
728
- for (const i of e)
729
- if (!this.injectedRules.has(i))
730
- try {
731
- t.insertRule(i, t.cssRules.length), this.injectedRules.add(i);
732
- } catch (r) {
733
- console.warn("Failed to inject CSS rule:", i, r);
734
- }
735
- }
736
- /**
737
- * Clear all injected responsive CSS
738
- */
739
- static clearCSS() {
740
- if (this.styleSheet) {
741
- for (; this.styleSheet.cssRules.length > 0; )
742
- this.styleSheet.deleteRule(0);
743
- this.injectedRules.clear();
744
- }
745
- }
746
- /**
747
- * Check if a rule has been injected
748
- */
749
- static hasRule(e) {
750
- return this.injectedRules.has(e);
751
- }
752
- }
753
- class Fe {
754
- cache = /* @__PURE__ */ new Map();
755
- hitCount = 0;
756
- missCount = 0;
757
- get(e) {
758
- const t = this.cache.get(e);
759
- return t ? this.hitCount++ : this.missCount++, t;
760
- }
761
- set(e, t) {
762
- this.cache.set(e, t);
763
- }
764
- clear() {
765
- this.cache.clear(), this.hitCount = 0, this.missCount = 0;
766
- }
767
- getStats() {
768
- return {
769
- size: this.cache.size,
770
- hitRate: this.hitCount / (this.hitCount + this.missCount) || 0,
771
- hits: this.hitCount,
772
- misses: this.missCount
773
- };
774
- }
775
- }
776
- const R = new Fe();
777
- class yt {
778
- static BATCH_SIZE = 50;
779
- static ruleQueue = [];
780
- static flushTimer = null;
781
- /**
782
- * Generate CSS with caching and batching
783
- */
784
- static generateOptimizedCSS(e, t, i = {}) {
785
- const {
786
- minify: r = process.env.NODE_ENV === "production",
787
- batch: o = !0,
788
- deduplicate: n = !0
789
- } = i, a = this.createCacheKey(e, t, { minify: r });
790
- if (n) {
791
- const d = R.get(a);
792
- if (d)
793
- return d;
794
- }
795
- const c = this.generateCSS(e, t, { minify: r });
796
- return n && R.set(a, c), o && c.trim() ? (this.addToBatch(c), "") : c;
797
- }
798
- /**
799
- * Create cache key for CSS rule
800
- */
801
- static createCacheKey(e, t, i) {
802
- return JSON.stringify({ selector: e, config: t, options: i });
803
- }
804
- /**
805
- * Generate CSS without optimizations (for comparison)
806
- */
807
- static generateCSS(e, t, i) {
808
- const { minify: r = !1 } = i, o = r ? "" : " ", n = r ? "" : `
809
- `, a = r ? "" : " ";
810
- let c = "";
811
- const d = /* @__PURE__ */ new Set(), l = this.extractBaseStyles(t);
812
- Object.keys(l).length > 0 && (c += `${e}${a}{${n}`, c += this.generateProperties(l, o, n, a), c += `}${n}`);
813
- for (const [p, f] of Object.entries(t))
814
- if (typeof f == "object" && f !== null)
815
- for (const [v, C] of Object.entries(f)) {
816
- if (v === "base") continue;
817
- const k = this.getMediaQuery(v), j = `${k}:${p}`;
818
- d.has(j) || (c += `@media ${k}${a}{${n}`, c += `${o}${e}${a}{${n}`, c += `${o}${o}${this.propertyToCSS(p)}:${a}${this.valueToCSS(C)};${n}`, c += `${o}}${n}`, c += `}${n}`, d.add(j));
819
- }
820
- return c;
821
- }
822
- /**
823
- * Add CSS to batch queue
824
- */
825
- static addToBatch(e) {
826
- this.ruleQueue.push(e), this.ruleQueue.length >= this.BATCH_SIZE ? this.flushBatch() : this.flushTimer || (this.flushTimer = window.setTimeout(() => this.flushBatch(), 16));
827
- }
828
- /**
829
- * Flush batched CSS rules
830
- */
831
- static flushBatch() {
832
- if (this.ruleQueue.length === 0) return;
833
- const e = this.ruleQueue.join("");
834
- this.ruleQueue = [], this.flushTimer && (clearTimeout(this.flushTimer), this.flushTimer = null), this.injectCSS(e);
835
- }
836
- /**
837
- * Inject CSS into document
838
- */
839
- static injectCSS(e) {
840
- if (typeof document > "u") return;
841
- let t = document.getElementById(
842
- "tachui-responsive-styles"
843
- );
844
- t || (t = document.createElement("style"), t.id = "tachui-responsive-styles", t.type = "text/css", document.head.appendChild(t)), t.appendChild(document.createTextNode(e));
845
- }
846
- /**
847
- * Extract base (non-responsive) styles
848
- */
849
- static extractBaseStyles(e) {
850
- const t = {};
851
- for (const [i, r] of Object.entries(e))
852
- typeof r != "object" || r === null ? t[i] = r : "base" in r && (t[i] = r.base);
853
- return t;
854
- }
855
- /**
856
- * Generate CSS properties
857
- */
858
- static generateProperties(e, t, i, r) {
859
- let o = "";
860
- for (const [n, a] of Object.entries(e))
861
- a !== void 0 && (o += `${t}${this.propertyToCSS(n)}:${r}${this.valueToCSS(a)};${i}`);
862
- return o;
863
- }
864
- /**
865
- * Convert property name to CSS
866
- */
867
- static propertyToCSS(e) {
868
- return e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`);
869
- }
870
- /**
871
- * Convert value to CSS
872
- */
873
- static valueToCSS(e) {
874
- return typeof e == "number" ? `${e}px` : e.toString();
875
- }
876
- /**
877
- * Get media query for breakpoint
878
- */
879
- static getMediaQuery(e) {
880
- return {
881
- base: "",
882
- sm: "(min-width: 640px)",
883
- md: "(min-width: 768px)",
884
- lg: "(min-width: 1024px)",
885
- xl: "(min-width: 1280px)",
886
- "2xl": "(min-width: 1536px)"
887
- }[e] || e;
888
- }
889
- /**
890
- * Force flush any pending batched CSS
891
- */
892
- static flush() {
893
- this.flushBatch();
894
- }
895
- /**
896
- * Get performance statistics
897
- */
898
- static getStats() {
899
- return {
900
- cache: R.getStats(),
901
- batch: {
902
- queueSize: this.ruleQueue.length,
903
- batchSize: this.BATCH_SIZE
904
- }
905
- };
906
- }
907
- /**
908
- * Clear all caches and reset performance counters
909
- */
910
- static reset() {
911
- R.clear(), this.ruleQueue = [], this.flushTimer && (clearTimeout(this.flushTimer), this.flushTimer = null);
912
- }
913
- }
914
- class A {
915
- static measurements = /* @__PURE__ */ new Map();
916
- /**
917
- * Start performance measurement
918
- */
919
- static startMeasurement(e) {
920
- const t = performance.now();
921
- return () => {
922
- const i = performance.now() - t;
923
- return this.recordMeasurement(e, i), i;
924
- };
925
- }
926
- /**
927
- * Record measurement
928
- */
929
- static recordMeasurement(e, t) {
930
- this.measurements.has(e) || this.measurements.set(e, []);
931
- const i = this.measurements.get(e);
932
- i.push(t), i.length > 100 && i.shift();
933
- }
934
- /**
935
- * Get performance statistics
936
- */
937
- static getStats() {
938
- const e = {};
939
- for (const [t, i] of this.measurements) {
940
- const r = [...i].sort((n, a) => n - a), o = i.reduce((n, a) => n + a, 0) / i.length;
941
- e[t] = {
942
- count: i.length,
943
- average: o,
944
- min: r[0],
945
- max: r[r.length - 1],
946
- p50: r[Math.floor(r.length * 0.5)],
947
- p95: r[Math.floor(r.length * 0.95)],
948
- p99: r[Math.floor(r.length * 0.99)]
949
- };
950
- }
951
- return e;
952
- }
953
- /**
954
- * Clear all performance data
955
- */
956
- static reset() {
957
- this.measurements.clear();
958
- }
959
- }
960
- const me = 250;
961
- class Y extends oe {
962
- type = "responsive";
963
- priority = me;
964
- generatedCSS = null;
965
- elementSelector = "";
966
- _config;
967
- constructor(e) {
968
- super(e), this._config = e;
969
- }
970
- get config() {
971
- return this._config;
972
- }
973
- /**
974
- * Apply responsive styles to the element
975
- */
976
- apply(e, t) {
977
- const i = e.element;
978
- !i || !(i instanceof HTMLElement) || (this.elementSelector = this.generateUniqueSelector(i), i.classList.add(this.getClassFromSelector(this.elementSelector)), this.generateAndInjectCSS(), this.setupReactiveUpdates());
979
- }
980
- /**
981
- * Generate and inject responsive CSS
982
- */
983
- generateAndInjectCSS() {
984
- const e = A.startMeasurement("css-generation");
985
- try {
986
- const t = new he({
987
- selector: this.elementSelector,
988
- generateMinified: process.env.NODE_ENV === "production",
989
- includeComments: process.env.NODE_ENV !== "production",
990
- optimizeOutput: !0
991
- });
992
- this.generatedCSS = t.generateResponsiveCSS(this.config), this.generatedCSS.cssRules.length > 0 && fe.injectCSS(this.generatedCSS.cssRules);
993
- } finally {
994
- e();
995
- }
996
- }
997
- /**
998
- * Set up reactive updates for dynamic responsive values
999
- */
1000
- setupReactiveUpdates() {
1001
- this.hasReactiveValues(this.properties) && V(() => {
1002
- this.trackReactiveDependencies(this.properties);
1003
- const t = this.resolveReactiveConfig(this.properties);
1004
- this.updateConfig(t);
1005
- });
1006
- }
1007
- /**
1008
- * Track reactive dependencies by accessing all reactive values
1009
- */
1010
- trackReactiveDependencies(e) {
1011
- let t = !1;
1012
- for (const [i, r] of Object.entries(e))
1013
- if (this.isReactiveValue(r))
1014
- D(r) || P(r) ? r() : this.isAsset(r) && (t = !0, r.resolve());
1015
- else if (w(r))
1016
- for (const [o, n] of Object.entries(r))
1017
- this.isReactiveValue(n) && (D(n) || P(n) ? n() : this.isAsset(n) && (t = !0, n.resolve()));
1018
- t && ye()();
1019
- }
1020
- /**
1021
- * Update configuration and regenerate CSS
1022
- */
1023
- updateConfig(e) {
1024
- this._config = e, this.generateAndInjectCSS();
1025
- }
1026
- /**
1027
- * Generate unique CSS selector for this element
1028
- */
1029
- generateUniqueSelector(e) {
1030
- return `.${`tachui-responsive-${this.generateUniqueId()}`}`;
1031
- }
1032
- /**
1033
- * Extract class name from CSS selector
1034
- */
1035
- getClassFromSelector(e) {
1036
- return e.replace(/^\./, "");
1037
- }
1038
- /**
1039
- * Generate unique ID for CSS class names
1040
- */
1041
- generateUniqueId() {
1042
- return Math.random().toString(36).substr(2, 9);
1043
- }
1044
- /**
1045
- * Check if configuration contains reactive values (signals)
1046
- */
1047
- hasReactiveValues(e) {
1048
- for (const t of Object.values(e)) {
1049
- if (this.isReactiveValue(t))
1050
- return !0;
1051
- if (w(t)) {
1052
- for (const i of Object.values(t))
1053
- if (this.isReactiveValue(i))
1054
- return !0;
1055
- }
1056
- }
1057
- return !1;
1058
- }
1059
- /**
1060
- * Check if a value is a reactive signal, computed, or Asset
1061
- */
1062
- isReactiveValue(e) {
1063
- return !!(D(e) || P(e) || this.isAsset(e));
1064
- }
1065
- /**
1066
- * Check if a value is an Asset object
1067
- */
1068
- isAsset(e) {
1069
- return e != null && typeof e == "object" && "resolve" in e && typeof e.resolve == "function";
1070
- }
1071
- /**
1072
- * Resolve configuration with current signal values
1073
- */
1074
- resolveReactiveConfig(e) {
1075
- const t = {};
1076
- for (const [i, r] of Object.entries(e))
1077
- if (this.isReactiveValue(r))
1078
- D(r) || P(r) ? t[i] = r() : this.isAsset(r) && (t[i] = r.resolve());
1079
- else if (w(r)) {
1080
- const o = {};
1081
- for (const [n, a] of Object.entries(r))
1082
- this.isReactiveValue(a) ? D(a) || P(a) ? o[n] = a() : this.isAsset(a) && (o[n] = a.resolve()) : o[n] = a;
1083
- t[i] = o;
1084
- } else
1085
- t[i] = r;
1086
- return t;
1087
- }
1088
- /**
1089
- * Get generated CSS information (for debugging)
1090
- */
1091
- getGeneratedCSS() {
1092
- return this.generatedCSS;
1093
- }
1094
- /**
1095
- * Get configuration (for debugging)
1096
- */
1097
- getConfig() {
1098
- return this.config;
1099
- }
1100
- }
1101
- function h(s) {
1102
- return new Y(s);
1103
- }
1104
- class Ge extends oe {
1105
- type = "media-query";
1106
- priority = me + 1;
1107
- // Slightly higher than responsive
1108
- elementSelector = "";
1109
- constructor(e, t) {
1110
- super({ query: e, styles: t });
1111
- }
1112
- get query() {
1113
- return this.properties.query;
1114
- }
1115
- get styles() {
1116
- return this.properties.styles;
1117
- }
1118
- apply(e, t) {
1119
- const i = e.element;
1120
- !i || !(i instanceof HTMLElement) || (this.elementSelector = this.generateUniqueSelector(i), i.classList.add(this.getClassFromSelector(this.elementSelector)), this.generateMediaQueryCSS());
1121
- }
1122
- generateMediaQueryCSS() {
1123
- const { generateMinified: e = process.env.NODE_ENV === "production" } = {}, t = e ? "" : " ", i = e ? "" : " ", r = e ? "" : `
1124
- `, o = e ? "" : " ";
1125
- let n = `@media ${this.query}${o}{${r}`;
1126
- n += `${t}${this.elementSelector}${o}{${r}`;
1127
- for (const [a, c] of Object.entries(this.styles)) {
1128
- const d = a.replace(
1129
- /[A-Z]/g,
1130
- (p) => `-${p.toLowerCase()}`
1131
- ), l = typeof c == "number" ? `${c}px` : c.toString();
1132
- n += `${i}${d}:${o}${l};${r}`;
1133
- }
1134
- n += `${t}}${r}`, n += `}${r}`, fe.injectCSS([n]);
1135
- }
1136
- generateUniqueSelector(e) {
1137
- return `.${`tachui-mq-${Math.random().toString(36).substr(2, 9)}`}`;
1138
- }
1139
- getClassFromSelector(e) {
1140
- return e.replace(/^\./, "");
1141
- }
1142
- }
1143
- function $(s, e) {
1144
- return new Ge(s, e);
1145
- }
1146
- function u(s, e) {
1147
- const t = { [s]: e };
1148
- return new Y(t);
1149
- }
1150
- function ge(s) {
1151
- const e = {};
1152
- return s.direction && (e.flexDirection = s.direction), s.wrap && (e.flexWrap = s.wrap), s.justify && (e.justifyContent = s.justify), s.align && (e.alignItems = s.align), s.gap && (e.gap = s.gap), new Y(e);
1153
- }
1154
- class be {
1155
- constructor(e) {
1156
- return this.baseBuilder = e, new Proxy(this, {
1157
- get(t, i) {
1158
- if (i === "base" || i === "sm" || i === "md" || i === "lg" || i === "xl" || i === "2xl" || i in t)
1159
- return t[i];
1160
- const r = t.baseBuilder[i];
1161
- return typeof r == "function" ? (...o) => {
1162
- const n = r.apply(t.baseBuilder, o);
1163
- return n === t.baseBuilder ? t : n;
1164
- } : r;
1165
- }
1166
- });
1167
- }
1168
- // Delegate essential builder methods
1169
- addModifier(e) {
1170
- this.baseBuilder.addModifier(e);
1171
- }
1172
- build() {
1173
- return this.baseBuilder.build();
1174
- }
1175
- // Core responsive methods
1176
- responsive(e) {
1177
- const t = h(e);
1178
- return this.baseBuilder.addModifier(t), this;
1179
- }
1180
- mediaQuery(e, t) {
1181
- const i = $(e, t);
1182
- return this.baseBuilder.addModifier(i), this;
1183
- }
1184
- // Advanced media query methods
1185
- orientation(e, t) {
1186
- const i = `(orientation: ${e})`, r = $(i, t);
1187
- return this.baseBuilder.addModifier(r), this;
1188
- }
1189
- colorScheme(e, t) {
1190
- const i = `(prefers-color-scheme: ${e})`, r = $(i, t);
1191
- return this.baseBuilder.addModifier(r), this;
1192
- }
1193
- reducedMotion(e) {
1194
- const i = $("(prefers-reduced-motion: reduce)", e);
1195
- return this.baseBuilder.addModifier(i), this;
1196
- }
1197
- highContrast(e) {
1198
- const i = $("(prefers-contrast: high)", e);
1199
- return this.baseBuilder.addModifier(i), this;
1200
- }
1201
- touchDevice(e) {
1202
- const i = $("(pointer: coarse)", e);
1203
- return this.baseBuilder.addModifier(i), this;
1204
- }
1205
- mouseDevice(e) {
1206
- const i = $("(pointer: fine)", e);
1207
- return this.baseBuilder.addModifier(i), this;
1208
- }
1209
- retina(e) {
1210
- const i = $("(min-resolution: 2dppx)", e);
1211
- return this.baseBuilder.addModifier(i), this;
1212
- }
1213
- print(e) {
1214
- const i = $("print", e);
1215
- return this.baseBuilder.addModifier(i), this;
1216
- }
1217
- // Responsive layout methods
1218
- responsiveLayout(e) {
1219
- const t = ge(e);
1220
- return this.baseBuilder.addModifier(t), this;
1221
- }
1222
- // Responsive dimension methods
1223
- responsiveWidth(e) {
1224
- const t = u("width", e);
1225
- return this.baseBuilder.addModifier(t), this;
1226
- }
1227
- responsiveHeight(e) {
1228
- const t = u("height", e);
1229
- return this.baseBuilder.addModifier(t), this;
1230
- }
1231
- responsiveSize(e) {
1232
- const t = h(e);
1233
- return this.baseBuilder.addModifier(t), this;
1234
- }
1235
- // Responsive spacing methods
1236
- responsivePadding(e) {
1237
- if (w(e) || typeof e == "string" || typeof e == "number") {
1238
- const t = u(
1239
- "padding",
1240
- e
1241
- );
1242
- this.baseBuilder.addModifier(t);
1243
- } else {
1244
- const t = {}, i = e;
1245
- i.all && (t.padding = i.all), i.horizontal && (t.paddingLeft = i.horizontal, t.paddingRight = i.horizontal), i.vertical && (t.paddingTop = i.vertical, t.paddingBottom = i.vertical), i.top && (t.paddingTop = i.top), i.right && (t.paddingRight = i.right), i.bottom && (t.paddingBottom = i.bottom), i.left && (t.paddingLeft = i.left);
1246
- const r = h(t);
1247
- this.baseBuilder.addModifier(r);
1248
- }
1249
- return this;
1250
- }
1251
- responsiveMargin(e) {
1252
- if (w(e) || typeof e == "string" || typeof e == "number") {
1253
- const t = u(
1254
- "margin",
1255
- e
1256
- );
1257
- this.baseBuilder.addModifier(t);
1258
- } else {
1259
- const t = {}, i = e;
1260
- i.all && (t.margin = i.all), i.horizontal && (t.marginLeft = i.horizontal, t.marginRight = i.horizontal), i.vertical && (t.marginTop = i.vertical, t.marginBottom = i.vertical), i.top && (t.marginTop = i.top), i.right && (t.marginRight = i.right), i.bottom && (t.marginBottom = i.bottom), i.left && (t.marginLeft = i.left);
1261
- const r = h(t);
1262
- this.baseBuilder.addModifier(r);
1263
- }
1264
- return this;
1265
- }
1266
- // Responsive typography methods
1267
- responsiveFont(e) {
1268
- const t = h(e);
1269
- return this.baseBuilder.addModifier(t), this;
1270
- }
1271
- responsiveFontSize(e) {
1272
- const t = u("fontSize", e);
1273
- return this.baseBuilder.addModifier(t), this;
1274
- }
1275
- responsiveTextAlign(e) {
1276
- const t = u("textAlign", e);
1277
- return this.baseBuilder.addModifier(t), this;
1278
- }
1279
- // Breakpoint shorthand methods
1280
- get base() {
1281
- return new O("base", this, this.baseBuilder);
1282
- }
1283
- get sm() {
1284
- return new O("sm", this, this.baseBuilder);
1285
- }
1286
- get md() {
1287
- return new O("md", this, this.baseBuilder);
1288
- }
1289
- get lg() {
1290
- return new O("lg", this, this.baseBuilder);
1291
- }
1292
- get xl() {
1293
- return new O("xl", this, this.baseBuilder);
1294
- }
1295
- get "2xl"() {
1296
- return new O("2xl", this, this.baseBuilder);
1297
- }
1298
- }
1299
- class O {
1300
- constructor(e, t, i) {
1301
- this.breakpoint = e, this.parentBuilder = t, this.baseBuilder = i;
1302
- }
1303
- // Layout properties
1304
- width(e) {
1305
- const t = { [this.breakpoint]: e }, i = u("width", t);
1306
- return this.parentBuilder.addModifier(i), this.parentBuilder;
1307
- }
1308
- height(e) {
1309
- const t = { [this.breakpoint]: e }, i = u("height", t);
1310
- return this.parentBuilder.addModifier(i), this.parentBuilder;
1311
- }
1312
- minWidth(e) {
1313
- const t = { [this.breakpoint]: e }, i = u(
1314
- "minWidth",
1315
- t
1316
- );
1317
- return this.parentBuilder.addModifier(i), this.parentBuilder;
1318
- }
1319
- maxWidth(e) {
1320
- const t = { [this.breakpoint]: e }, i = u(
1321
- "maxWidth",
1322
- t
1323
- );
1324
- return this.parentBuilder.addModifier(i), this.parentBuilder;
1325
- }
1326
- minHeight(e) {
1327
- const t = { [this.breakpoint]: e }, i = u(
1328
- "minHeight",
1329
- t
1330
- );
1331
- return this.parentBuilder.addModifier(i), this.parentBuilder;
1332
- }
1333
- maxHeight(e) {
1334
- const t = { [this.breakpoint]: e }, i = u(
1335
- "maxHeight",
1336
- t
1337
- );
1338
- return this.parentBuilder.addModifier(i), this.parentBuilder;
1339
- }
1340
- padding(e) {
1341
- const t = { [this.breakpoint]: e }, i = u(
1342
- "padding",
1343
- t
1344
- );
1345
- return this.parentBuilder.addModifier(i), this.parentBuilder;
1346
- }
1347
- paddingHorizontal(e) {
1348
- const t = { [this.breakpoint]: e }, i = u(
1349
- "paddingLeft",
1350
- t
1351
- ), r = u(
1352
- "paddingRight",
1353
- t
1354
- );
1355
- return this.parentBuilder.addModifier(i), this.parentBuilder.addModifier(r), this.parentBuilder;
1356
- }
1357
- paddingVertical(e) {
1358
- const t = { [this.breakpoint]: e }, i = u(
1359
- "paddingTop",
1360
- t
1361
- ), r = u(
1362
- "paddingBottom",
1363
- t
1364
- );
1365
- return this.parentBuilder.addModifier(i), this.parentBuilder.addModifier(r), this.parentBuilder;
1366
- }
1367
- paddingTop(e) {
1368
- const t = { [this.breakpoint]: e }, i = u(
1369
- "paddingTop",
1370
- t
1371
- );
1372
- return this.parentBuilder.addModifier(i), this.parentBuilder;
1373
- }
1374
- paddingBottom(e) {
1375
- const t = { [this.breakpoint]: e }, i = u(
1376
- "paddingBottom",
1377
- t
1378
- );
1379
- return this.parentBuilder.addModifier(i), this.parentBuilder;
1380
- }
1381
- paddingLeft(e) {
1382
- const t = { [this.breakpoint]: e }, i = u(
1383
- "paddingLeft",
1384
- t
1385
- );
1386
- return this.parentBuilder.addModifier(i), this.parentBuilder;
1387
- }
1388
- paddingRight(e) {
1389
- const t = { [this.breakpoint]: e }, i = u(
1390
- "paddingRight",
1391
- t
1392
- );
1393
- return this.parentBuilder.addModifier(i), this.parentBuilder;
1394
- }
1395
- margin(e) {
1396
- const t = { [this.breakpoint]: e }, i = u("margin", t);
1397
- return this.parentBuilder.addModifier(i), this.parentBuilder;
1398
- }
1399
- marginHorizontal(e) {
1400
- const t = { [this.breakpoint]: e }, i = u(
1401
- "marginLeft",
1402
- t
1403
- ), r = u(
1404
- "marginRight",
1405
- t
1406
- );
1407
- return this.parentBuilder.addModifier(i), this.parentBuilder.addModifier(r), this.parentBuilder;
1408
- }
1409
- marginVertical(e) {
1410
- const t = { [this.breakpoint]: e }, i = u(
1411
- "marginTop",
1412
- t
1413
- ), r = u(
1414
- "marginBottom",
1415
- t
1416
- );
1417
- return this.parentBuilder.addModifier(i), this.parentBuilder.addModifier(r), this.parentBuilder;
1418
- }
1419
- marginTop(e) {
1420
- const t = { [this.breakpoint]: e }, i = u(
1421
- "marginTop",
1422
- t
1423
- );
1424
- return this.parentBuilder.addModifier(i), this.parentBuilder;
1425
- }
1426
- marginBottom(e) {
1427
- const t = { [this.breakpoint]: e }, i = u(
1428
- "marginBottom",
1429
- t
1430
- );
1431
- return this.parentBuilder.addModifier(i), this.parentBuilder;
1432
- }
1433
- marginLeft(e) {
1434
- const t = { [this.breakpoint]: e }, i = u(
1435
- "marginLeft",
1436
- t
1437
- );
1438
- return this.parentBuilder.addModifier(i), this.parentBuilder;
1439
- }
1440
- marginRight(e) {
1441
- const t = { [this.breakpoint]: e }, i = u(
1442
- "marginRight",
1443
- t
1444
- );
1445
- return this.parentBuilder.addModifier(i), this.parentBuilder;
1446
- }
1447
- // Typography properties
1448
- fontSize(e) {
1449
- const t = { [this.breakpoint]: e }, i = u(
1450
- "fontSize",
1451
- t
1452
- );
1453
- return this.parentBuilder.addModifier(i), this.parentBuilder;
1454
- }
1455
- textAlign(e) {
1456
- const t = { [this.breakpoint]: e }, i = u(
1457
- "textAlign",
1458
- t
1459
- );
1460
- return this.parentBuilder.addModifier(i), this.parentBuilder;
1461
- }
1462
- // Display properties
1463
- display(e) {
1464
- const t = { [this.breakpoint]: e }, i = u(
1465
- "display",
1466
- t
1467
- );
1468
- return this.parentBuilder.addModifier(i), this.parentBuilder;
1469
- }
1470
- // Flexbox properties
1471
- flexDirection(e) {
1472
- const t = { [this.breakpoint]: e }, i = u(
1473
- "flexDirection",
1474
- t
1475
- );
1476
- return this.parentBuilder.addModifier(i), this.parentBuilder;
1477
- }
1478
- justifyContent(e) {
1479
- const t = { [this.breakpoint]: e }, i = u(
1480
- "justifyContent",
1481
- t
1482
- );
1483
- return this.parentBuilder.addModifier(i), this.parentBuilder;
1484
- }
1485
- alignItems(e) {
1486
- const t = { [this.breakpoint]: e }, i = u(
1487
- "alignItems",
1488
- t
1489
- );
1490
- return this.parentBuilder.addModifier(i), this.parentBuilder;
1491
- }
1492
- // Visual properties
1493
- backgroundColor(e) {
1494
- const t = { [this.breakpoint]: e }, i = u(
1495
- "backgroundColor",
1496
- t
1497
- );
1498
- return this.parentBuilder.addModifier(i), this.parentBuilder;
1499
- }
1500
- color(e) {
1501
- const t = { [this.breakpoint]: e }, i = u("color", t);
1502
- return this.parentBuilder.addModifier(i), this.parentBuilder;
1503
- }
1504
- opacity(e) {
1505
- const t = { [this.breakpoint]: e }, i = u(
1506
- "opacity",
1507
- t
1508
- );
1509
- return this.parentBuilder.addModifier(i), this.parentBuilder;
1510
- }
1511
- }
1512
- function xt(s) {
1513
- return new be(s);
1514
- }
1515
- function wt(s) {
1516
- return new be(s);
1517
- }
1518
- function St() {
1519
- const s = x(), e = m(() => S());
1520
- return {
1521
- current: s,
1522
- context: e,
1523
- isAbove: (n) => m(
1524
- () => y(s()) > y(n)
1525
- ),
1526
- isBelow: (n) => m(
1527
- () => y(s()) < y(n)
1528
- ),
1529
- isBetween: (n, a) => m(() => {
1530
- const c = y(s()), d = y(n), l = y(a);
1531
- return c >= d && c <= l;
1532
- }),
1533
- matches: (n) => {
1534
- const [a, c] = I(!1);
1535
- if (typeof window < "u") {
1536
- const d = window.matchMedia(n);
1537
- c(d.matches);
1538
- const l = (p) => c(p.matches);
1539
- d.addEventListener("change", l);
1540
- }
1541
- return a;
1542
- }
1543
- };
1544
- }
1545
- function Ct(s) {
1546
- const [e, t] = I(!1);
1547
- if (typeof window < "u") {
1548
- const i = window.matchMedia(s);
1549
- t(i.matches);
1550
- const r = (o) => t(o.matches);
1551
- i.addEventListener("change", r);
1552
- }
1553
- return e;
1554
- }
1555
- function $t(s) {
1556
- const e = x();
1557
- return m(() => {
1558
- if (!w(s))
1559
- return s;
1560
- const t = e(), i = s, r = [
1561
- "base",
1562
- "sm",
1563
- "md",
1564
- "lg",
1565
- "xl",
1566
- "2xl"
1567
- ], o = r.indexOf(t);
1568
- for (let n = o; n >= 0; n--) {
1569
- const a = r[n];
1570
- if (i[a] !== void 0)
1571
- return i[a];
1572
- }
1573
- for (const n of r)
1574
- if (i[n] !== void 0)
1575
- return i[n];
1576
- throw new Error("No responsive value found for any breakpoint");
1577
- });
1578
- }
1579
- function Bt(s, e) {
1580
- if (!w(s))
1581
- return s;
1582
- const t = s, i = e || x()(), r = [
1583
- "base",
1584
- "sm",
1585
- "md",
1586
- "lg",
1587
- "xl",
1588
- "2xl"
1589
- ], o = r.indexOf(i);
1590
- for (let n = o; n >= 0; n--) {
1591
- const a = r[n];
1592
- if (t[a] !== void 0)
1593
- return t[a];
1594
- }
1595
- for (const n of r)
1596
- if (t[n] !== void 0)
1597
- return t[n];
1598
- throw new Error("No responsive value found for any breakpoint");
1599
- }
1600
- function kt(s, e) {
1601
- const t = {};
1602
- for (const [i, r] of Object.entries(e))
1603
- if (w(r)) {
1604
- const o = r;
1605
- for (const [n, a] of Object.entries(o))
1606
- if (a !== void 0) {
1607
- const c = n === "base" ? `--${s}-${i}` : `--${s}-${i}-${n}`;
1608
- t[c] = a.toString();
1609
- }
1610
- } else
1611
- t[`--${s}-${i}`] = r.toString();
1612
- return t;
1613
- }
1614
- const b = {
1615
- // Viewport size queries
1616
- mobile: "(max-width: 767px)",
1617
- tablet: "(min-width: 768px) and (max-width: 1023px)",
1618
- desktop: "(min-width: 1024px)",
1619
- // Device orientation
1620
- landscape: "(orientation: landscape)",
1621
- portrait: "(orientation: portrait)",
1622
- // Device pixel density
1623
- highDPI: "(min-resolution: 2dppx)",
1624
- lowDPI: "(max-resolution: 1dppx)",
1625
- retinaDisplay: "(min-resolution: 2dppx)",
1626
- standardDisplay: "(max-resolution: 1.9dppx)",
1627
- // Color scheme preference
1628
- darkMode: "(prefers-color-scheme: dark)",
1629
- lightMode: "(prefers-color-scheme: light)",
1630
- noColorSchemePreference: "(prefers-color-scheme: no-preference)",
1631
- // Reduced motion preference
1632
- reducedMotion: "(prefers-reduced-motion: reduce)",
1633
- allowMotion: "(prefers-reduced-motion: no-preference)",
1634
- // Contrast preference (accessibility)
1635
- highContrast: "(prefers-contrast: high)",
1636
- lowContrast: "(prefers-contrast: low)",
1637
- normalContrast: "(prefers-contrast: no-preference)",
1638
- // Data usage preference
1639
- reduceData: "(prefers-reduced-data: reduce)",
1640
- allowData: "(prefers-reduced-data: no-preference)",
1641
- // Transparency preference
1642
- reduceTransparency: "(prefers-reduced-transparency: reduce)",
1643
- allowTransparency: "(prefers-reduced-transparency: no-preference)",
1644
- // Hover capability
1645
- canHover: "(hover: hover)",
1646
- noHover: "(hover: none)",
1647
- // Pointer capability
1648
- finePointer: "(pointer: fine)",
1649
- // Mouse, trackpad
1650
- coarsePointer: "(pointer: coarse)",
1651
- // Touch
1652
- // Any-hover (any input can hover)
1653
- anyCanHover: "(any-hover: hover)",
1654
- anyNoHover: "(any-hover: none)",
1655
- // Any-pointer (any input type)
1656
- anyFinePointer: "(any-pointer: fine)",
1657
- anyCoarsePointer: "(any-pointer: coarse)",
1658
- // Update preference
1659
- slowUpdate: "(update: slow)",
1660
- // E-ink displays
1661
- fastUpdate: "(update: fast)",
1662
- // Standard displays
1663
- // Overflow-block capability
1664
- blockScrolling: "(overflow-block: scroll)",
1665
- blockPaged: "(overflow-block: paged)",
1666
- // Overflow-inline capability
1667
- inlineScrolling: "(overflow-inline: scroll)",
1668
- // Forced colors (high contrast mode)
1669
- forcedColors: "(forced-colors: active)",
1670
- normalColors: "(forced-colors: none)",
1671
- // Inverted colors
1672
- invertedColors: "(inverted-colors: inverted)",
1673
- normalInvertedColors: "(inverted-colors: none)",
1674
- // Scripting capability
1675
- scriptingEnabled: "(scripting: enabled)",
1676
- scriptingDisabled: "(scripting: none)",
1677
- scriptingInitialOnly: "(scripting: initial-only)",
1678
- // Container queries (future)
1679
- containerSmall: "(max-width: 400px)",
1680
- containerMedium: "(min-width: 401px) and (max-width: 800px)",
1681
- containerLarge: "(min-width: 801px)",
1682
- // Custom breakpoint builders
1683
- minWidth: (s) => `(min-width: ${s}${typeof s == "number" ? "px" : ""})`,
1684
- maxWidth: (s) => `(max-width: ${s}${typeof s == "number" ? "px" : ""})`,
1685
- between: (s, e) => `(min-width: ${s}${typeof s == "number" ? "px" : ""}) and (max-width: ${e}${typeof e == "number" ? "px" : ""})`,
1686
- // Height-based queries
1687
- minHeight: (s) => `(min-height: ${s}${typeof s == "number" ? "px" : ""})`,
1688
- maxHeight: (s) => `(max-height: ${s}${typeof s == "number" ? "px" : ""})`,
1689
- heightBetween: (s, e) => `(min-height: ${s}${typeof s == "number" ? "px" : ""}) and (max-height: ${e}${typeof e == "number" ? "px" : ""})`,
1690
- // Aspect ratio queries
1691
- square: "(aspect-ratio: 1/1)",
1692
- landscape16_9: "(aspect-ratio: 16/9)",
1693
- portrait9_16: "(aspect-ratio: 9/16)",
1694
- widescreen: "(min-aspect-ratio: 16/9)",
1695
- tallscreen: "(max-aspect-ratio: 9/16)",
1696
- customAspectRatio: (s) => `(aspect-ratio: ${s})`,
1697
- minAspectRatio: (s) => `(min-aspect-ratio: ${s})`,
1698
- maxAspectRatio: (s) => `(max-aspect-ratio: ${s})`,
1699
- // Resolution queries
1700
- lowRes: "(max-resolution: 120dpi)",
1701
- standardRes: "(min-resolution: 120dpi) and (max-resolution: 192dpi)",
1702
- highRes: "(min-resolution: 192dpi)",
1703
- customResolution: (s) => `(min-resolution: ${s}dpi)`,
1704
- // Print media
1705
- print: "print",
1706
- screen: "screen",
1707
- speech: "speech",
1708
- // Device-specific queries (common patterns)
1709
- iPhone: "(max-width: 428px)",
1710
- iPad: "(min-width: 768px) and (max-width: 1024px)",
1711
- desktopSmall: "(min-width: 1024px) and (max-width: 1440px)",
1712
- desktopLarge: "(min-width: 1440px)",
1713
- // Special conditions
1714
- touchDevice: "(pointer: coarse)",
1715
- mouseDevice: "(pointer: fine)",
1716
- keyboardNavigation: "(hover: none) and (pointer: coarse)",
1717
- // Modern display features
1718
- wideColorGamut: "(color-gamut: p3)",
1719
- standardColorGamut: "(color-gamut: srgb)",
1720
- hdr: "(dynamic-range: high)",
1721
- sdr: "(dynamic-range: standard)"
1722
- };
1723
- function Rt(...s) {
1724
- return s.filter((e) => e).join(" and ");
1725
- }
1726
- function Mt(...s) {
1727
- return s.filter((e) => e).join(", ");
1728
- }
1729
- function Ot(s) {
1730
- const e = x();
1731
- return m(() => {
1732
- const t = e();
1733
- return !(s.hideOn && s.hideOn.includes(t) || s.showOn && !s.showOn.includes(t));
1734
- });
1735
- }
1736
- function Ue() {
1737
- if (typeof window > "u") return;
1738
- const s = S();
1739
- console.group("🔍 tachUI Responsive State"), console.log("Current breakpoint:", s.current), console.log("Viewport dimensions:", `${s.width}x${s.height}`), console.log("Available breakpoints:", ["base", "sm", "md", "lg", "xl", "2xl"]);
1740
- const e = {
1741
- Mobile: b.mobile,
1742
- Tablet: b.tablet,
1743
- Desktop: b.desktop,
1744
- "Dark mode": b.darkMode,
1745
- "Reduced motion": b.reducedMotion,
1746
- "Can hover": b.canHover
1747
- };
1748
- console.log("Media query matches:");
1749
- for (const [t, i] of Object.entries(e))
1750
- console.log(` ${t}: ${window.matchMedia(i).matches}`);
1751
- console.groupEnd();
1752
- }
1753
- function Vt(s = {}) {
1754
- if (typeof window > "u" || process.env.NODE_ENV === "production")
1755
- return;
1756
- const {
1757
- position: e = "top-right",
1758
- showDimensions: t = !0,
1759
- showBreakpoint: i = !0
1760
- } = s, r = document.createElement("div");
1761
- r.id = "tachui-responsive-debug", r.style.cssText = `
1762
- position: fixed;
1763
- ${e.includes("top") ? "top: 10px" : "bottom: 10px"};
1764
- ${e.includes("right") ? "right: 10px" : "left: 10px"};
1765
- background: rgba(0, 0, 0, 0.8);
1766
- color: white;
1767
- padding: 8px 12px;
1768
- border-radius: 4px;
1769
- font-family: monospace;
1770
- font-size: 12px;
1771
- z-index: 9999;
1772
- pointer-events: none;
1773
- white-space: pre-line;
1774
- `, document.body.appendChild(r);
1775
- function o() {
1776
- const n = S();
1777
- let a = "";
1778
- i && (a += `Breakpoint: ${n.current}`), t && (a && (a += `
1779
- `), a += `Size: ${n.width}×${n.height}`), r.textContent = a;
1780
- }
1781
- o(), window.addEventListener("resize", o), Ue();
1782
- }
1783
- class Ke {
1784
- /**
1785
- * Create a responsive grid with automatic column sizing
1786
- */
1787
- static autoFit(e) {
1788
- const t = {};
1789
- if (typeof e.minColumnWidth == "object") {
1790
- t.gridTemplateColumns = {};
1791
- for (const [i, r] of Object.entries(e.minColumnWidth)) {
1792
- const o = typeof r == "number" ? `${r}px` : r, n = e.maxColumns && typeof e.maxColumns == "object" ? e.maxColumns[i] || "auto" : e.maxColumns || "auto";
1793
- t.gridTemplateColumns[i] = n === "auto" ? `repeat(auto-fit, minmax(${o}, 1fr))` : `repeat(${n}, minmax(${o}, 1fr))`;
1794
- }
1795
- } else {
1796
- const i = typeof e.minColumnWidth == "number" ? `${e.minColumnWidth}px` : e.minColumnWidth, r = e.maxColumns || "auto";
1797
- t.gridTemplateColumns = r === "auto" ? `repeat(auto-fit, minmax(${i}, 1fr))` : `repeat(${r}, minmax(${i}, 1fr))`;
1798
- }
1799
- return e.gap && (t.gap = e.gap), t.display = "grid", h(t);
1800
- }
1801
- /**
1802
- * Create a responsive grid with explicit column counts
1803
- */
1804
- static columns(e, t) {
1805
- const i = {
1806
- display: "grid",
1807
- gridTemplateColumns: typeof e == "object" ? Object.fromEntries(
1808
- Object.entries(e).map(([r, o]) => [
1809
- r,
1810
- `repeat(${o}, 1fr)`
1811
- ])
1812
- ) : `repeat(${e}, 1fr)`
1813
- };
1814
- return t?.gap && (i.gap = t.gap), t?.rowGap && (i.rowGap = t.rowGap), t?.autoRows && (i.gridAutoRows = t.autoRows), h(i);
1815
- }
1816
- /**
1817
- * Create responsive masonry-style grid
1818
- */
1819
- static masonry(e) {
1820
- const t = {
1821
- display: "grid",
1822
- gridTemplateColumns: typeof e.columns == "object" ? Object.fromEntries(
1823
- Object.entries(e.columns).map(([i, r]) => [
1824
- i,
1825
- `repeat(${r}, 1fr)`
1826
- ])
1827
- ) : `repeat(${e.columns}, 1fr)`,
1828
- gridAutoRows: "max-content"
1829
- };
1830
- return e.gap && (t.gap = e.gap), h(t);
1831
- }
1832
- }
1833
- class Et {
1834
- /**
1835
- * Create a responsive flex container that stacks on mobile, flows horizontally on desktop
1836
- */
1837
- static stackToRow(e) {
1838
- const i = {
1839
- display: "flex",
1840
- flexDirection: {
1841
- base: "column",
1842
- [e?.stackBreakpoint || "md"]: "row"
1843
- }
1844
- };
1845
- return e?.gap && (i.gap = e.gap), e?.align && (i.alignItems = e.align), e?.justify && (i.justifyContent = e.justify), h(i);
1846
- }
1847
- /**
1848
- * Create a responsive flex container with wrapping behavior
1849
- */
1850
- static wrap(e) {
1851
- const t = {
1852
- display: "flex",
1853
- flexWrap: "wrap",
1854
- ...e
1855
- };
1856
- return h(t);
1857
- }
1858
- /**
1859
- * Create centered flex layout
1860
- */
1861
- static center(e = "row") {
1862
- return h({
1863
- display: "flex",
1864
- flexDirection: e,
1865
- justifyContent: "center",
1866
- alignItems: "center"
1867
- });
1868
- }
1869
- /**
1870
- * Create space-between flex layout
1871
- */
1872
- static spaceBetween(e = "row") {
1873
- return h({
1874
- display: "flex",
1875
- flexDirection: e,
1876
- justifyContent: "space-between",
1877
- alignItems: "center"
1878
- });
1879
- }
1880
- }
1881
- class It {
1882
- /**
1883
- * Create a responsive container with max-width constraints
1884
- */
1885
- static container(e) {
1886
- const t = {
1887
- width: "100%",
1888
- marginLeft: "auto",
1889
- marginRight: "auto"
1890
- };
1891
- return e?.maxWidth ? t.maxWidth = e.maxWidth : t.maxWidth = {
1892
- sm: "640px",
1893
- md: "768px",
1894
- lg: "1024px",
1895
- xl: "1280px",
1896
- "2xl": "1536px"
1897
- }, e?.padding && (t.paddingLeft = e.padding, t.paddingRight = e.padding), e?.margin && (t.marginTop = e.margin, t.marginBottom = e.margin), h(t);
1898
- }
1899
- /**
1900
- * Create a full-width container that breaks out of constraints
1901
- */
1902
- static fullWidth() {
1903
- return h({
1904
- width: "100vw",
1905
- marginLeft: "calc(-50vw + 50%)",
1906
- marginRight: "calc(-50vw + 50%)"
1907
- });
1908
- }
1909
- /**
1910
- * Create a section container with responsive padding
1911
- */
1912
- static section(e) {
1913
- const t = {};
1914
- return e?.paddingY && (t.paddingTop = e.paddingY, t.paddingBottom = e.paddingY), e?.paddingX && (t.paddingLeft = e.paddingX, t.paddingRight = e.paddingX), e?.maxWidth && (t.maxWidth = e.maxWidth, t.marginLeft = "auto", t.marginRight = "auto"), h(t);
1915
- }
1916
- }
1917
- class Tt {
1918
- /**
1919
- * Show element only on specific breakpoints
1920
- */
1921
- static showOn(e) {
1922
- const t = {
1923
- display: {}
1924
- // Start with empty object
1925
- };
1926
- for (const i of e)
1927
- t.display[i] = "block";
1928
- return h(t);
1929
- }
1930
- /**
1931
- * Hide element only on specific breakpoints
1932
- */
1933
- static hideOn(e) {
1934
- const t = {
1935
- display: {}
1936
- // Start with empty object
1937
- };
1938
- for (const i of e)
1939
- t.display[i] = "none";
1940
- return h(t);
1941
- }
1942
- /**
1943
- * Show on mobile, hide on desktop
1944
- */
1945
- static mobileOnly() {
1946
- return h({
1947
- display: {
1948
- base: "block",
1949
- md: "none"
1950
- }
1951
- });
1952
- }
1953
- /**
1954
- * Hide on mobile, show on desktop
1955
- */
1956
- static desktopOnly() {
1957
- return h({
1958
- display: {
1959
- base: "none",
1960
- md: "block"
1961
- }
1962
- });
1963
- }
1964
- /**
1965
- * Show only on tablet breakpoint
1966
- */
1967
- static tabletOnly() {
1968
- return h({
1969
- display: {
1970
- base: "none",
1971
- md: "block",
1972
- lg: "none"
1973
- }
1974
- });
1975
- }
1976
- }
1977
- class jt {
1978
- /**
1979
- * Create responsive padding
1980
- */
1981
- static padding(e) {
1982
- const t = {};
1983
- return e.all && (t.padding = e.all), e.horizontal && (t.paddingLeft = e.horizontal, t.paddingRight = e.horizontal), e.vertical && (t.paddingTop = e.vertical, t.paddingBottom = e.vertical), e.top && (t.paddingTop = e.top), e.right && (t.paddingRight = e.right), e.bottom && (t.paddingBottom = e.bottom), e.left && (t.paddingLeft = e.left), h(t);
1984
- }
1985
- /**
1986
- * Create responsive margin
1987
- */
1988
- static margin(e) {
1989
- const t = {};
1990
- return e.all && (t.margin = e.all), e.horizontal && (t.marginLeft = e.horizontal, t.marginRight = e.horizontal), e.vertical && (t.marginTop = e.vertical, t.marginBottom = e.vertical), e.top && (t.marginTop = e.top), e.right && (t.marginRight = e.right), e.bottom && (t.marginBottom = e.bottom), e.left && (t.marginLeft = e.left), h(t);
1991
- }
1992
- /**
1993
- * Create responsive gap (for flexbox and grid)
1994
- */
1995
- static gap(e) {
1996
- const t = {};
1997
- return e.all && (t.gap = e.all), e.column && (t.columnGap = e.column), e.row && (t.rowGap = e.row), h(t);
1998
- }
1999
- }
2000
- class Dt {
2001
- /**
2002
- * Create responsive font scale
2003
- */
2004
- static scale(e) {
2005
- const t = {
2006
- fontSize: e.base
2007
- };
2008
- if (e.scale && typeof e.scale == "object") {
2009
- t.fontSize = {};
2010
- for (const [i, r] of Object.entries(e.scale)) {
2011
- const o = typeof e.base == "number" ? e.base : parseFloat(e.base);
2012
- t.fontSize[i] = `${o * r}px`;
2013
- }
2014
- }
2015
- return e.lineHeight && (t.lineHeight = e.lineHeight), h(t);
2016
- }
2017
- /**
2018
- * Create fluid typography that scales smoothly
2019
- */
2020
- static fluid(e) {
2021
- const t = e.minBreakpoint || "320px", i = e.maxBreakpoint || "1200px", r = typeof e.minSize == "number" ? `${e.minSize}px` : e.minSize, o = typeof e.maxSize == "number" ? `${e.maxSize}px` : e.maxSize;
2022
- return h({
2023
- fontSize: `clamp(${r}, calc(${r} + (${o} - ${r}) * ((100vw - ${t}) / (${i} - ${t}))), ${o})`
2024
- });
2025
- }
2026
- }
2027
- const Pt = {
2028
- /**
2029
- * Sidebar layout that collapses on mobile
2030
- */
2031
- sidebar: (s) => {
2032
- const e = s?.collapseBreakpoint || "md", t = s?.sidebarWidth || "250px";
2033
- return h({
2034
- display: "grid",
2035
- gridTemplateColumns: {
2036
- base: "1fr",
2037
- [e]: `${t} 1fr`
2038
- },
2039
- gap: s?.gap || "1rem"
2040
- });
2041
- },
2042
- /**
2043
- * Holy grail layout (header, footer, sidebar, main content)
2044
- */
2045
- holyGrail: (s) => {
2046
- const e = s?.collapseBreakpoint || "lg";
2047
- return h({
2048
- display: "grid",
2049
- gridTemplateAreas: {
2050
- base: '"header" "main" "footer"',
2051
- [e]: '"header header" "sidebar main" "footer footer"'
2052
- },
2053
- gridTemplateRows: {
2054
- base: `${s?.headerHeight || "auto"} 1fr ${s?.footerHeight || "auto"}`,
2055
- [e]: `${s?.headerHeight || "auto"} 1fr ${s?.footerHeight || "auto"}`
2056
- },
2057
- gridTemplateColumns: {
2058
- base: "1fr",
2059
- [e]: `${s?.sidebarWidth || "250px"} 1fr`
2060
- },
2061
- minHeight: "100vh"
2062
- });
2063
- },
2064
- /**
2065
- * Card grid layout
2066
- */
2067
- cardGrid: (s) => Ke.autoFit({
2068
- minColumnWidth: s?.minCardWidth || "300px",
2069
- gap: s?.gap || "1rem",
2070
- maxColumns: s?.maxColumns
2071
- }),
2072
- /**
2073
- * Hero section layout
2074
- */
2075
- hero: (s) => h({
2076
- display: "flex",
2077
- flexDirection: "column",
2078
- justifyContent: "center",
2079
- alignItems: "center",
2080
- textAlign: s?.textAlign || "center",
2081
- minHeight: s?.minHeight || "50vh",
2082
- padding: s?.padding || "2rem"
2083
- })
2084
- };
2085
- class B {
2086
- /**
2087
- * Create a responsive value resolver with custom logic
2088
- */
2089
- static createResponsiveResolver(e, t = []) {
2090
- const i = x();
2091
- return m(() => {
2092
- t.forEach((n) => n());
2093
- const r = i(), o = S();
2094
- return e(r, o);
2095
- });
2096
- }
2097
- /**
2098
- * Create responsive value that interpolates between breakpoints
2099
- */
2100
- static createInterpolatedValue(e, t = {}) {
2101
- const { smoothing: i = "linear", clamp: r = !0 } = t;
2102
- return m(() => {
2103
- const n = S().width, a = z(), c = [];
2104
- for (const [v, C] of Object.entries(e))
2105
- if (C !== void 0) {
2106
- const k = v === "base" ? 0 : parseInt(a[v] || "0");
2107
- c.push({ width: k, value: C });
2108
- }
2109
- if (c.sort((v, C) => v.width - C.width), c.length === 0) return 0;
2110
- if (c.length === 1) return c[0].value;
2111
- let d = c[0], l = c[c.length - 1];
2112
- for (let v = 0; v < c.length - 1; v++)
2113
- if (n >= c[v].width && n <= c[v + 1].width) {
2114
- d = c[v], l = c[v + 1];
2115
- break;
2116
- }
2117
- if (r) {
2118
- if (n <= d.width) return d.value;
2119
- if (n >= l.width) return l.value;
2120
- }
2121
- const p = (n - d.width) / (l.width - d.width);
2122
- let f = p;
2123
- switch (i) {
2124
- case "ease":
2125
- f = 0.5 - 0.5 * Math.cos(p * Math.PI);
2126
- break;
2127
- case "ease-in":
2128
- f = p * p;
2129
- break;
2130
- case "ease-out":
2131
- f = 1 - (1 - p) * (1 - p);
2132
- break;
2133
- case "linear":
2134
- default:
2135
- f = p;
2136
- break;
2137
- }
2138
- return d.value + (l.value - d.value) * f;
2139
- });
2140
- }
2141
- /**
2142
- * Create conditional responsive behavior
2143
- */
2144
- static createConditionalResponsive(e, t, i) {
2145
- const r = x();
2146
- return m(() => {
2147
- const o = S(), a = e(o) ? t : i;
2148
- return this.resolveResponsiveValue(a, r());
2149
- });
2150
- }
2151
- /**
2152
- * Resolve responsive value at specific breakpoint
2153
- */
2154
- static resolveResponsiveValue(e, t) {
2155
- if (!w(e))
2156
- return e;
2157
- const i = e, r = [
2158
- "base",
2159
- "sm",
2160
- "md",
2161
- "lg",
2162
- "xl",
2163
- "2xl"
2164
- ], o = r.indexOf(t);
2165
- for (let n = o; n >= 0; n--) {
2166
- const a = r[n];
2167
- if (i[a] !== void 0)
2168
- return i[a];
2169
- }
2170
- for (const n of r)
2171
- if (i[n] !== void 0)
2172
- return i[n];
2173
- throw new Error("No responsive value found");
2174
- }
2175
- }
2176
- class Ze {
2177
- /**
2178
- * Hook for responsive arrays (e.g., responsive grid columns data)
2179
- */
2180
- static useResponsiveArray(e) {
2181
- const t = x();
2182
- return m(() => {
2183
- const i = t();
2184
- return B.resolveResponsiveValue(e, i) || [];
2185
- });
2186
- }
2187
- /**
2188
- * Hook for responsive object selection
2189
- */
2190
- static useResponsiveObject(e) {
2191
- const t = x();
2192
- return m(() => {
2193
- const i = t();
2194
- try {
2195
- return B.resolveResponsiveValue(
2196
- e,
2197
- i
2198
- );
2199
- } catch {
2200
- return null;
2201
- }
2202
- });
2203
- }
2204
- /**
2205
- * Hook for responsive function selection and execution
2206
- */
2207
- static useResponsiveFunction(e) {
2208
- const t = x();
2209
- return m(() => {
2210
- const i = t();
2211
- try {
2212
- return B.resolveResponsiveValue(
2213
- e,
2214
- i
2215
- );
2216
- } catch {
2217
- return null;
2218
- }
2219
- });
2220
- }
2221
- /**
2222
- * Hook for responsive state management
2223
- */
2224
- static useResponsiveState(e) {
2225
- const [t, i] = I(e), r = x();
2226
- return [m(() => {
2227
- const a = t(), c = r();
2228
- try {
2229
- return B.resolveResponsiveValue(
2230
- a,
2231
- c
2232
- );
2233
- } catch {
2234
- return;
2235
- }
2236
- }), (a) => {
2237
- w(a) ? i(a) : i({ [r()]: a });
2238
- }];
2239
- }
2240
- /**
2241
- * Hook for responsive computations with memoization
2242
- */
2243
- static useResponsiveComputation(e, t = []) {
2244
- return xe(() => {
2245
- t.forEach((r) => r());
2246
- const i = S();
2247
- return e(i);
2248
- });
2249
- }
2250
- /**
2251
- * Hook for responsive side effects
2252
- */
2253
- static useResponsiveEffect(e, t = []) {
2254
- let i, r;
2255
- V(() => {
2256
- t.forEach((a) => a());
2257
- const o = S();
2258
- i && (i(), i = void 0);
2259
- const n = e(o, r);
2260
- typeof n == "function" && (i = n), r = o;
2261
- });
2262
- }
2263
- }
2264
- class Ye {
2265
- /**
2266
- * Execute callback only on specific breakpoints
2267
- */
2268
- static onBreakpoints(e, t) {
2269
- let i;
2270
- return V(() => {
2271
- const r = S();
2272
- if (e.includes(r.current)) {
2273
- i && (i(), i = void 0);
2274
- const o = t(r);
2275
- typeof o == "function" && (i = o);
2276
- }
2277
- }), () => {
2278
- i && i();
2279
- };
2280
- }
2281
- /**
2282
- * Execute callback when breakpoint changes
2283
- */
2284
- static onBreakpointChange(e) {
2285
- let t;
2286
- return V(() => {
2287
- const i = S(), r = i.current;
2288
- t && t !== r && e(r, t, i), t = r;
2289
- }), () => {
2290
- };
2291
- }
2292
- /**
2293
- * Execute callback when entering/leaving specific breakpoint ranges
2294
- */
2295
- static onBreakpointRange(e, t, i) {
2296
- let r = !1, o, n;
2297
- return V(() => {
2298
- const a = S(), c = y(a.current), d = y(e), l = y(t), p = c >= d && c <= l;
2299
- if (p && !r) {
2300
- if (i.onEnter) {
2301
- const f = i.onEnter(a);
2302
- typeof f == "function" && (n = f);
2303
- }
2304
- r = !0;
2305
- } else !p && r && (n && (n(), n = void 0), o && (o(), o = void 0), i.onLeave && i.onLeave(a), r = !1);
2306
- if (p && i.onWithin) {
2307
- o && (o(), o = void 0);
2308
- const f = i.onWithin(a);
2309
- typeof f == "function" && (o = f);
2310
- }
2311
- }), () => {
2312
- n && n(), o && o();
2313
- };
2314
- }
2315
- }
2316
- class Xe {
2317
- /**
2318
- * Create responsive pagination
2319
- */
2320
- static createResponsivePagination(e, t) {
2321
- const [i, r] = I(1), o = x(), n = m(() => {
2322
- const C = o();
2323
- return B.resolveResponsiveValue(
2324
- t,
2325
- C
2326
- );
2327
- }), a = m(() => Math.ceil(e.length / n())), c = m(() => {
2328
- const C = n(), j = (i() - 1) * C, ve = j + C;
2329
- return e.slice(j, ve);
2330
- }), d = m(
2331
- () => i() < a()
2332
- ), l = m(() => i() > 1), p = (C) => {
2333
- const k = a();
2334
- r(Math.max(1, Math.min(C, k)));
2335
- }, f = () => {
2336
- d() && r(i() + 1);
2337
- }, v = () => {
2338
- l() && r(i() - 1);
2339
- };
2340
- return V(() => {
2341
- n(), r(1);
2342
- }), {
2343
- currentPage: i,
2344
- totalPages: a,
2345
- currentItems: c,
2346
- setPage: p,
2347
- nextPage: f,
2348
- prevPage: v,
2349
- hasNext: d,
2350
- hasPrev: l
2351
- };
2352
- }
2353
- /**
2354
- * Create responsive filtering
2355
- */
2356
- static createResponsiveFilter(e, t) {
2357
- const i = x();
2358
- return m(() => {
2359
- const r = i(), o = B.resolveResponsiveValue(
2360
- t,
2361
- r
2362
- );
2363
- return o ? e.filter(o) : e;
2364
- });
2365
- }
2366
- /**
2367
- * Create responsive sorting
2368
- */
2369
- static createResponsiveSort(e, t) {
2370
- const i = x();
2371
- return m(() => {
2372
- const r = i(), o = B.resolveResponsiveValue(
2373
- t,
2374
- r
2375
- );
2376
- return o ? [...e].sort(o) : e;
2377
- });
2378
- }
2379
- }
2380
- const _t = {
2381
- Breakpoints: B,
2382
- Hooks: Ze,
2383
- Targeting: Ye,
2384
- Data: Xe
2385
- };
2386
- class M {
2387
- static isEnabled = !1;
2388
- static debugOverlay = null;
2389
- static logLevel = "info";
2390
- /**
2391
- * Enable responsive development tools
2392
- */
2393
- static enable(e = {}) {
2394
- if (process.env.NODE_ENV === "production") {
2395
- console.warn("ResponsiveDevTools: Not enabling in production mode");
2396
- return;
2397
- }
2398
- this.isEnabled = !0, this.logLevel = e.logLevel || "info", this.log("info", "ResponsiveDevTools: Enabled"), e.showOverlay && this.createDebugOverlay(e), e.highlightResponsiveElements && this.enableElementHighlighting(), e.showPerformance && this.enablePerformanceMonitoring(), this.logResponsiveState();
2399
- }
2400
- /**
2401
- * Disable responsive development tools
2402
- */
2403
- static disable() {
2404
- this.isEnabled = !1, this.debugOverlay && (this.debugOverlay.remove(), this.debugOverlay = null), this.disableElementHighlighting(), this.log("info", "ResponsiveDevTools: Disabled");
2405
- }
2406
- /**
2407
- * Check if development tools are enabled
2408
- */
2409
- static get enabled() {
2410
- return this.isEnabled && process.env.NODE_ENV !== "production";
2411
- }
2412
- /**
2413
- * Log responsive information
2414
- */
2415
- static log(e, ...t) {
2416
- if (!this.enabled) return;
2417
- const i = ["error", "warn", "info", "debug"], r = i.indexOf(this.logLevel);
2418
- i.indexOf(e) <= r && console[e]("[ResponsiveDevTools]", ...t);
2419
- }
2420
- /**
2421
- * Create visual debug overlay
2422
- */
2423
- static createDebugOverlay(e) {
2424
- if (typeof document > "u") return;
2425
- const t = e.position || "top-right";
2426
- this.debugOverlay = document.createElement("div"), this.debugOverlay.id = "tachui-responsive-debug", this.debugOverlay.style.cssText = `
2427
- position: fixed;
2428
- ${t.includes("top") ? "top: 10px" : "bottom: 10px"};
2429
- ${t.includes("right") ? "right: 10px" : "left: 10px"};
2430
- background: rgba(0, 0, 0, 0.9);
2431
- color: white;
2432
- padding: 12px;
2433
- border-radius: 8px;
2434
- font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
2435
- font-size: 12px;
2436
- z-index: 10000;
2437
- pointer-events: auto;
2438
- cursor: pointer;
2439
- max-width: 300px;
2440
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
2441
- border: 1px solid rgba(255, 255, 255, 0.1);
2442
- `;
2443
- const i = document.createElement("div");
2444
- i.textContent = "×", i.style.cssText = `
2445
- position: absolute;
2446
- top: 4px;
2447
- right: 8px;
2448
- cursor: pointer;
2449
- font-size: 16px;
2450
- color: #ff6b6b;
2451
- `, i.onclick = () => this.disable(), this.debugOverlay.appendChild(i), document.body.appendChild(this.debugOverlay), this.updateDebugOverlay(e);
2452
- let r;
2453
- window.addEventListener("resize", () => {
2454
- clearTimeout(r), r = window.setTimeout(() => {
2455
- this.updateDebugOverlay(e);
2456
- }, 100);
2457
- });
2458
- }
2459
- /**
2460
- * Update debug overlay content
2461
- */
2462
- static updateDebugOverlay(e) {
2463
- if (!this.debugOverlay) return;
2464
- const t = S(), i = z();
2465
- let r = `
2466
- <div style="margin-bottom: 8px; font-weight: bold; color: #4fc3f7;">
2467
- 📱 Responsive Debug
2468
- </div>
2469
- `;
2470
- if (r += `
2471
- <div style="margin-bottom: 6px;">
2472
- <strong>Current:</strong> <span style="color: #66bb6a;">${t.current}</span>
2473
- </div>
2474
- <div style="margin-bottom: 6px;">
2475
- <strong>Size:</strong> ${t.width}×${t.height}
2476
- </div>
2477
- `, e.showBreakpoints) {
2478
- r += '<div style="margin: 8px 0; font-weight: bold; color: #ffb74d;">Breakpoints:</div>';
2479
- for (const [n, a] of Object.entries(i)) {
2480
- const c = n === t.current;
2481
- r += `
2482
- <div style="color: ${c ? "#66bb6a" : "#999"}; margin-bottom: 2px;">
2483
- ${c ? "▶" : "▷"} ${n}: ${a}
2484
- </div>
2485
- `;
2486
- }
2487
- }
2488
- if (e.showPerformance) {
2489
- const n = A.getStats(), a = R.getStats();
2490
- if (r += '<div style="margin: 8px 0; font-weight: bold; color: #f06292;">Performance:</div>', r += `
2491
- <div style="margin-bottom: 2px;">
2492
- Cache: ${a.size} rules (${(a.hitRate * 100).toFixed(1)}% hit rate)
2493
- </div>
2494
- `, Object.keys(n).length > 0)
2495
- for (const [c, d] of Object.entries(n))
2496
- r += `
2497
- <div style="margin-bottom: 2px;">
2498
- ${c}: ${d.average.toFixed(2)}ms avg
2499
- </div>
2500
- `;
2501
- }
2502
- r += '<div style="margin: 8px 0; font-weight: bold; color: #ba68c8;">Media Queries:</div>';
2503
- const o = {
2504
- Touch: b.touchDevice,
2505
- Dark: b.darkMode,
2506
- "Reduced Motion": b.reducedMotion,
2507
- "High Contrast": b.highContrast
2508
- };
2509
- for (const [n, a] of Object.entries(o)) {
2510
- const c = window.matchMedia(a).matches;
2511
- r += `
2512
- <div style="color: ${c ? "#66bb6a" : "#666"}; margin-bottom: 2px;">
2513
- ${c ? "✓" : "✗"} ${n}
2514
- </div>
2515
- `;
2516
- }
2517
- this.debugOverlay.innerHTML = r + this.debugOverlay.querySelector("div:last-child")?.outerHTML || "";
2518
- }
2519
- /**
2520
- * Enable element highlighting for responsive elements
2521
- */
2522
- static enableElementHighlighting() {
2523
- if (typeof document > "u") return;
2524
- const e = document.createElement("style");
2525
- e.id = "tachui-responsive-highlight", e.textContent = `
2526
- .tachui-responsive-element {
2527
- outline: 2px dashed #4fc3f7 !important;
2528
- outline-offset: 2px !important;
2529
- position: relative !important;
2530
- }
2531
-
2532
- .tachui-responsive-element::before {
2533
- content: 'R';
2534
- position: absolute !important;
2535
- top: -8px !important;
2536
- right: -8px !important;
2537
- background: #4fc3f7 !important;
2538
- color: white !important;
2539
- width: 16px !important;
2540
- height: 16px !important;
2541
- border-radius: 50% !important;
2542
- font-size: 10px !important;
2543
- font-weight: bold !important;
2544
- display: flex !important;
2545
- align-items: center !important;
2546
- justify-content: center !important;
2547
- z-index: 10001 !important;
2548
- font-family: monospace !important;
2549
- }
2550
- `, document.head.appendChild(e), new MutationObserver(() => {
2551
- this.highlightResponsiveElements();
2552
- }).observe(document.body, {
2553
- childList: !0,
2554
- subtree: !0,
2555
- attributes: !0,
2556
- attributeFilter: ["class"]
2557
- }), this.highlightResponsiveElements();
2558
- }
2559
- /**
2560
- * Disable element highlighting
2561
- */
2562
- static disableElementHighlighting() {
2563
- if (typeof document > "u") return;
2564
- const e = document.getElementById("tachui-responsive-highlight");
2565
- e && e.remove(), document.querySelectorAll(".tachui-responsive-element").forEach((t) => {
2566
- t.classList.remove("tachui-responsive-element");
2567
- });
2568
- }
2569
- /**
2570
- * Highlight elements with responsive classes
2571
- */
2572
- static highlightResponsiveElements() {
2573
- if (typeof document > "u") return;
2574
- [
2575
- '[class*="tachui-responsive-"]',
2576
- '[class*="tachui-mq-"]'
2577
- ].forEach((t) => {
2578
- document.querySelectorAll(t).forEach((i) => {
2579
- i.classList.contains("tachui-responsive-element") || i.classList.add("tachui-responsive-element");
2580
- });
2581
- });
2582
- }
2583
- /**
2584
- * Enable performance monitoring display
2585
- */
2586
- static enablePerformanceMonitoring() {
2587
- setInterval(() => {
2588
- if (!this.enabled) return;
2589
- const e = A.getStats(), t = R.getStats();
2590
- this.log("debug", "Performance Stats:", {
2591
- cache: t,
2592
- performance: e
2593
- });
2594
- }, 5e3);
2595
- }
2596
- /**
2597
- * Log current responsive state
2598
- */
2599
- static logResponsiveState() {
2600
- if (!this.enabled) return;
2601
- const e = S(), t = z();
2602
- if (console.group("🔍 TachUI Responsive State"), console.log("Current breakpoint:", e.current), console.log("Viewport:", `${e.width}×${e.height}`), console.log("Configuration:", t), typeof window < "u" && window.matchMedia) {
2603
- const i = {
2604
- Mobile: b.mobile,
2605
- Tablet: b.tablet,
2606
- Desktop: b.desktop,
2607
- "Touch Device": b.touchDevice,
2608
- "Dark Mode": b.darkMode,
2609
- "Reduced Motion": b.reducedMotion
2610
- };
2611
- console.log("Media Query Results:");
2612
- for (const [r, o] of Object.entries(i))
2613
- try {
2614
- console.log(` ${r}: ${window.matchMedia(o).matches}`);
2615
- } catch {
2616
- console.log(` ${r}: Error testing query`);
2617
- }
2618
- }
2619
- console.groupEnd();
2620
- }
2621
- /**
2622
- * Inspect a responsive value
2623
- */
2624
- static inspectResponsiveValue(e, t) {
2625
- if (!this.enabled) return;
2626
- const i = x();
2627
- if (console.group(`🔍 Responsive Value${t ? ` - ${t}` : ""}`), w(e)) {
2628
- const r = e;
2629
- console.log("Responsive object:", r);
2630
- const o = [
2631
- "base",
2632
- "sm",
2633
- "md",
2634
- "lg",
2635
- "xl",
2636
- "2xl"
2637
- ], n = o.indexOf(i());
2638
- let a;
2639
- for (let c = n; c >= 0; c--) {
2640
- const d = o[c];
2641
- if (r[d] !== void 0) {
2642
- a = r[d], console.log(`Resolved value (${d}):`, a);
2643
- break;
2644
- }
2645
- }
2646
- console.log("Defined breakpoints:");
2647
- for (const [c, d] of Object.entries(r))
2648
- if (d !== void 0) {
2649
- const l = c === i();
2650
- console.log(` ${l ? "→" : " "} ${c}:`, d);
2651
- }
2652
- } else
2653
- console.log("Static value:", e);
2654
- console.groupEnd();
2655
- }
2656
- /**
2657
- * Test responsive behavior
2658
- */
2659
- static testResponsiveBehavior(e, t = ["base", "sm", "md", "lg", "xl", "2xl"]) {
2660
- if (!this.enabled) return {};
2661
- const i = {};
2662
- return t.forEach((r) => {
2663
- this.log("debug", `Testing breakpoint ${r}:`, e);
2664
- }), i;
2665
- }
2666
- /**
2667
- * Export responsive configuration for debugging
2668
- */
2669
- static exportConfiguration() {
2670
- const e = S(), t = z(), i = A.getStats(), r = R.getStats(), o = {};
2671
- if (typeof window < "u" && window.matchMedia) {
2672
- for (const [n, a] of Object.entries(b))
2673
- if (typeof a == "string")
2674
- try {
2675
- o[n] = window.matchMedia(a).matches;
2676
- } catch {
2677
- o[n] = !1;
2678
- }
2679
- }
2680
- return {
2681
- breakpoints: t,
2682
- currentContext: e,
2683
- performance: {
2684
- cache: r,
2685
- timings: i
2686
- },
2687
- mediaQueries: o
2688
- };
2689
- }
2690
- }
2691
- function Je(s, e) {
2692
- const t = x();
2693
- return m(() => {
2694
- const i = t(), r = w(s);
2695
- let o, n = {};
2696
- if (r) {
2697
- const a = s;
2698
- n = a;
2699
- const c = [
2700
- "base",
2701
- "sm",
2702
- "md",
2703
- "lg",
2704
- "xl",
2705
- "2xl"
2706
- ], d = c.indexOf(i);
2707
- for (let l = d; l >= 0; l--) {
2708
- const p = c[l];
2709
- if (a[p] !== void 0) {
2710
- o = a[p];
2711
- break;
2712
- }
2713
- }
2714
- } else
2715
- o = s, n = { [i]: o };
2716
- return M.enabled && e && M.inspectResponsiveValue(s, e), {
2717
- resolvedValue: o,
2718
- activeBreakpoint: i,
2719
- allValues: n,
2720
- isResponsive: r
2721
- };
2722
- });
2723
- }
2724
- class et {
2725
- /**
2726
- * Test CSS features support
2727
- */
2728
- static testCSSFeatures() {
2729
- if (typeof window > "u" || typeof CSS > "u" || !CSS.supports)
2730
- return {};
2731
- const e = {};
2732
- try {
2733
- e.cssGrid = CSS.supports("display", "grid"), e.flexbox = CSS.supports("display", "flex"), e.customProperties = CSS.supports("--test", "value"), e.viewportUnits = CSS.supports("width", "100vw"), e.mediaQueries = typeof window.matchMedia == "function", e.containerQueries = CSS.supports("container-type", "inline-size"), e.logicalProperties = CSS.supports("margin-inline-start", "1rem");
2734
- } catch {
2735
- }
2736
- return e;
2737
- }
2738
- /**
2739
- * Test responsive behavior across different viewport sizes
2740
- */
2741
- static testViewportSizes(e) {
2742
- if (typeof window > "u") return;
2743
- const t = [
2744
- { width: 320, height: 568, name: "iPhone SE" },
2745
- { width: 375, height: 667, name: "iPhone 8" },
2746
- { width: 768, height: 1024, name: "iPad Portrait" },
2747
- { width: 1024, height: 768, name: "iPad Landscape" },
2748
- { width: 1280, height: 720, name: "Desktop Small" },
2749
- { width: 1920, height: 1080, name: "Desktop Large" }
2750
- ];
2751
- M.enabled && M.log("info", "Testing viewport sizes:", t), t.forEach((i) => {
2752
- e(i.width, i.height);
2753
- });
2754
- }
2755
- }
2756
- typeof window < "u" && process.env.NODE_ENV !== "production" && (window.tachUIResponsive = {
2757
- devTools: M,
2758
- inspector: Je,
2759
- compatibility: et,
2760
- logState: () => M.logResponsiveState(),
2761
- export: () => M.exportConfiguration()
2762
- });
2763
- const tt = {
2764
- name: "@tachui/responsive",
2765
- version: Qe,
2766
- author: "TachUI Team",
2767
- verified: !0
2768
- }, L = 80, it = [
2769
- [
2770
- "responsive",
2771
- h,
2772
- {
2773
- category: "layout",
2774
- priority: L,
2775
- signature: "(config: ResponsiveStyleConfig) => Modifier",
2776
- description: "Applies responsive style mappings across configured breakpoints."
2777
- }
2778
- ],
2779
- [
2780
- "mediaQuery",
2781
- $,
2782
- {
2783
- category: "layout",
2784
- priority: L,
2785
- signature: "(query: string, styles: Record<string, any>) => Modifier",
2786
- description: "Attaches custom CSS rules for a media query to a component."
2787
- }
2788
- ],
2789
- [
2790
- "responsiveProperty",
2791
- u,
2792
- {
2793
- category: "layout",
2794
- priority: L,
2795
- signature: "(property: string, value: ResponsiveValue<any>) => Modifier",
2796
- description: "Creates a responsive modifier from a single style property/value map."
2797
- }
2798
- ],
2799
- [
2800
- "responsiveLayout",
2801
- ge,
2802
- {
2803
- category: "layout",
2804
- priority: L,
2805
- signature: "(config: ResponsiveLayoutConfig) => Modifier",
2806
- description: "Configures responsive flexbox layout properties such as direction, wrap, and gap."
2807
- }
2808
- ]
2809
- ];
2810
- let ne = !1;
2811
- function rt(s) {
2812
- const e = s?.registry, t = s?.plugin ?? tt, i = s?.force === !0, r = !!(e || s?.plugin);
2813
- !r && ne && !i || (it.forEach(([o, n, a]) => {
2814
- qe(
2815
- o,
2816
- n,
2817
- a,
2818
- e,
2819
- t
2820
- );
2821
- }), r || (ne = !0));
2822
- }
2823
- rt();
1
+ import { r as e } from "./index-COhNZPIF.mjs";
2
+ import { A as o, B as r, J as t, a2 as n, t as p, D as v, s as R, L as d, M as l, a5 as u, O as g, a3 as y, F as c, $ as B, t as M, E as S, I as k, s as P, q as f, q as C, z as m, a4 as b, R as I, G as T, x as V, C as Q, y as x, y as _, v as A, x as D, v as F, Q as O, _ as w, S as E, a8 as h, a as G, e as L, j as U, c as z, a7 as K, l as N, h as j, k as q, aa as H, H as Y, o as J, a1 as W, f as X, W as Z, a0 as $, T as ee, Y as se, Z as ae, b as ie, g as oe, X as re, d as te, i as ne, U as pe, V as ve, N as Re, P as de, p as le, a9 as ue, a6 as ge, u as ye, m as ce, K as Be, n as Me, w as Se } from "./index-COhNZPIF.mjs";
3
+ e();
2824
4
  export {
2825
- B as AdvancedBreakpointUtils,
2826
- gt as BreakpointPresets,
2827
- et as BrowserCompatibility,
2828
- fe as CSSInjector,
2829
- It as Container,
2830
- K as DEFAULT_BREAKPOINTS,
2831
- Et as Flex,
2832
- Pt as LayoutPatterns,
2833
- b as MediaQueries,
2834
- Ge as MediaQueryModifier,
2835
- yt as OptimizedCSSGenerator,
2836
- me as RESPONSIVE_MODIFIER_PRIORITY,
2837
- _t as ResponsiveAdvanced,
2838
- he as ResponsiveCSSGenerator,
2839
- It as ResponsiveContainerPatterns,
2840
- Xe as ResponsiveDataUtils,
2841
- M as ResponsiveDevTools,
2842
- Et as ResponsiveFlexPatterns,
2843
- Ke as ResponsiveGrid,
2844
- Ke as ResponsiveGridPatterns,
2845
- Ze as ResponsiveHooks,
2846
- Y as ResponsiveModifier,
2847
- be as ResponsiveModifierBuilderImpl,
2848
- A as ResponsivePerformanceMonitor,
2849
- jt as ResponsiveSpacingPatterns,
2850
- Ye as ResponsiveTargeting,
2851
- Dt as ResponsiveTypography,
2852
- Dt as ResponsiveTypographyPatterns,
2853
- Tt as ResponsiveVisibilityPatterns,
2854
- jt as Spacing,
2855
- Tt as Visibility,
2856
- pt as __resetResponsiveSystemForTests,
2857
- lt as __syncResponsiveSignalsForTests,
2858
- Z as breakpointToPixels,
2859
- Rt as combineMediaQueries,
2860
- ct as configureBreakpoints,
2861
- S as createBreakpointContext,
2862
- $ as createMediaQueryModifier,
2863
- wt as createResponsiveBuilder,
2864
- kt as createResponsiveCSSVariables,
2865
- ge as createResponsiveLayoutModifier,
2866
- h as createResponsiveModifier,
2867
- u as createResponsivePropertyModifier,
2868
- Ot as createResponsiveVisibility,
2869
- R as cssRuleCache,
2870
- Vt as enableResponsiveDebugOverlay,
2871
- vt as generateCustomMediaQuery,
2872
- He as generateMediaQuery,
2873
- ht as generateRangeMediaQuery,
2874
- bt as generateResponsiveProperty,
2875
- y as getBreakpointIndex,
2876
- ft as getBreakpointsAbove,
2877
- mt as getBreakpointsBelow,
2878
- x as getCurrentBreakpoint,
2879
- z as getCurrentBreakpointConfig,
2880
- H as getSortedBreakpoints,
2881
- dt as getViewportDimensions,
2882
- ut as initializeResponsiveSystem,
2883
- re as isBreakpointAbove,
2884
- se as isBreakpointBelow,
2885
- w as isResponsiveValue,
2886
- ie as isValidBreakpointKey,
2887
- Ue as logResponsiveState,
2888
- Mt as orMediaQueries,
2889
- rt as registerResponsiveModifiers,
2890
- Bt as resolveResponsiveValue,
2891
- St as useBreakpoint,
2892
- Ct as useMediaQuery,
2893
- Je as useResponsiveInspector,
2894
- $t as useResponsiveValue,
2895
- xt as withResponsive
5
+ o as AdvancedBreakpointUtils,
6
+ r as BreakpointPresets,
7
+ t as BrowserCompatibility,
8
+ n as CSSInjector,
9
+ p as Container,
10
+ v as DEFAULT_BREAKPOINTS,
11
+ R as Flex,
12
+ d as LayoutPatterns,
13
+ l as MediaQueries,
14
+ u as MediaQueryModifier,
15
+ g as OptimizedCSSGenerator,
16
+ y as RESPONSIVE_MODIFIER_PRIORITY,
17
+ c as ResponsiveAdvanced,
18
+ B as ResponsiveCSSGenerator,
19
+ M as ResponsiveContainerPatterns,
20
+ S as ResponsiveDataUtils,
21
+ k as ResponsiveDevTools,
22
+ P as ResponsiveFlexPatterns,
23
+ f as ResponsiveGrid,
24
+ C as ResponsiveGridPatterns,
25
+ m as ResponsiveHooks,
26
+ b as ResponsiveModifier,
27
+ I as ResponsiveModifierBuilderImpl,
28
+ T as ResponsivePerformanceMonitor,
29
+ V as ResponsiveSpacingPatterns,
30
+ Q as ResponsiveTargeting,
31
+ x as ResponsiveTypography,
32
+ _ as ResponsiveTypographyPatterns,
33
+ A as ResponsiveVisibilityPatterns,
34
+ D as Spacing,
35
+ F as Visibility,
36
+ O as __resetResponsiveSystemForTests,
37
+ w as __syncResponsiveSignalsForTests,
38
+ E as breakpointToPixels,
39
+ h as combineMediaQueries,
40
+ G as configureBreakpoints,
41
+ L as createBreakpointContext,
42
+ U as createMediaQueryModifier,
43
+ z as createResponsiveBuilder,
44
+ K as createResponsiveCSSVariables,
45
+ N as createResponsiveLayoutModifier,
46
+ j as createResponsiveModifier,
47
+ q as createResponsivePropertyModifier,
48
+ H as createResponsiveVisibility,
49
+ Y as cssRuleCache,
50
+ J as enableResponsiveDebugOverlay,
51
+ W as generateCustomMediaQuery,
52
+ X as generateMediaQuery,
53
+ Z as generateRangeMediaQuery,
54
+ $ as generateResponsiveProperty,
55
+ ee as getBreakpointIndex,
56
+ se as getBreakpointsAbove,
57
+ ae as getBreakpointsBelow,
58
+ ie as getCurrentBreakpoint,
59
+ oe as getCurrentBreakpointConfig,
60
+ re as getSortedBreakpoints,
61
+ te as getViewportDimensions,
62
+ ne as initializeResponsiveSystem,
63
+ pe as isBreakpointAbove,
64
+ ve as isBreakpointBelow,
65
+ Re as isResponsiveValue,
66
+ de as isValidBreakpointKey,
67
+ le as logResponsiveState,
68
+ ue as orMediaQueries,
69
+ e as registerResponsiveModifiers,
70
+ ge as resolveResponsiveValue,
71
+ ye as useBreakpoint,
72
+ ce as useMediaQuery,
73
+ Be as useResponsiveInspector,
74
+ Me as useResponsiveValue,
75
+ Se as withResponsive
2896
76
  };