@tachui/responsive 0.8.1-alpha → 0.8.5-alpha

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