@tachui/responsive 0.8.0-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/LICENSE +363 -0
- package/README.md +507 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2538 -0
- package/dist/index.js.map +1 -0
- package/dist/modifiers/index.d.ts +5 -0
- package/dist/modifiers/index.d.ts.map +1 -0
- package/dist/modifiers/responsive/advanced-utilities.d.ts +121 -0
- package/dist/modifiers/responsive/advanced-utilities.d.ts.map +1 -0
- package/dist/modifiers/responsive/breakpoints.d.ts +81 -0
- package/dist/modifiers/responsive/breakpoints.d.ts.map +1 -0
- package/dist/modifiers/responsive/css-generator.d.ts +100 -0
- package/dist/modifiers/responsive/css-generator.d.ts.map +1 -0
- package/dist/modifiers/responsive/dev-tools.d.ts +107 -0
- package/dist/modifiers/responsive/dev-tools.d.ts.map +1 -0
- package/dist/modifiers/responsive/index.d.ts +29 -0
- package/dist/modifiers/responsive/index.d.ts.map +1 -0
- package/dist/modifiers/responsive/layout-patterns.d.ts +230 -0
- package/dist/modifiers/responsive/layout-patterns.d.ts.map +1 -0
- package/dist/modifiers/responsive/performance.d.ts +130 -0
- package/dist/modifiers/responsive/performance.d.ts.map +1 -0
- package/dist/modifiers/responsive/responsive-builder.d.ts +133 -0
- package/dist/modifiers/responsive/responsive-builder.d.ts.map +1 -0
- package/dist/modifiers/responsive/responsive-modifier.d.ts +123 -0
- package/dist/modifiers/responsive/responsive-modifier.d.ts.map +1 -0
- package/dist/modifiers/responsive/types.d.ts +183 -0
- package/dist/modifiers/responsive/types.d.ts.map +1 -0
- package/dist/modifiers/responsive/utilities.d.ts +149 -0
- package/dist/modifiers/responsive/utilities.d.ts.map +1 -0
- package/package.json +73 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,2538 @@
|
|
|
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 = `
|
|
1455
|
+
position: fixed;
|
|
1456
|
+
${e.includes("top") ? "top: 10px" : "bottom: 10px"};
|
|
1457
|
+
${e.includes("right") ? "right: 10px" : "left: 10px"};
|
|
1458
|
+
background: rgba(0, 0, 0, 0.8);
|
|
1459
|
+
color: white;
|
|
1460
|
+
padding: 8px 12px;
|
|
1461
|
+
border-radius: 4px;
|
|
1462
|
+
font-family: monospace;
|
|
1463
|
+
font-size: 12px;
|
|
1464
|
+
z-index: 9999;
|
|
1465
|
+
pointer-events: none;
|
|
1466
|
+
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 = `
|
|
2120
|
+
position: fixed;
|
|
2121
|
+
${t.includes("top") ? "top: 10px" : "bottom: 10px"};
|
|
2122
|
+
${t.includes("right") ? "right: 10px" : "left: 10px"};
|
|
2123
|
+
background: rgba(0, 0, 0, 0.9);
|
|
2124
|
+
color: white;
|
|
2125
|
+
padding: 12px;
|
|
2126
|
+
border-radius: 8px;
|
|
2127
|
+
font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
|
|
2128
|
+
font-size: 12px;
|
|
2129
|
+
z-index: 10000;
|
|
2130
|
+
pointer-events: auto;
|
|
2131
|
+
cursor: pointer;
|
|
2132
|
+
max-width: 300px;
|
|
2133
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
|
|
2134
|
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
2135
|
+
`;
|
|
2136
|
+
const i = document.createElement("div");
|
|
2137
|
+
i.textContent = "×", i.style.cssText = `
|
|
2138
|
+
position: absolute;
|
|
2139
|
+
top: 4px;
|
|
2140
|
+
right: 8px;
|
|
2141
|
+
cursor: pointer;
|
|
2142
|
+
font-size: 16px;
|
|
2143
|
+
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 = `
|
|
2159
|
+
<div style="margin-bottom: 8px; font-weight: bold; color: #4fc3f7;">
|
|
2160
|
+
📱 Responsive Debug
|
|
2161
|
+
</div>
|
|
2162
|
+
`;
|
|
2163
|
+
if (n += `
|
|
2164
|
+
<div style="margin-bottom: 6px;">
|
|
2165
|
+
<strong>Current:</strong> <span style="color: #66bb6a;">${t.current}</span>
|
|
2166
|
+
</div>
|
|
2167
|
+
<div style="margin-bottom: 6px;">
|
|
2168
|
+
<strong>Size:</strong> ${t.width}×${t.height}
|
|
2169
|
+
</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}
|
|
2177
|
+
</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 += `
|
|
2184
|
+
<div style="margin-bottom: 2px;">
|
|
2185
|
+
Cache: ${a.size} rules (${(a.hitRate * 100).toFixed(1)}% hit rate)
|
|
2186
|
+
</div>
|
|
2187
|
+
`, Object.keys(s).length > 0)
|
|
2188
|
+
for (const [d, c] of Object.entries(s))
|
|
2189
|
+
n += `
|
|
2190
|
+
<div style="margin-bottom: 2px;">
|
|
2191
|
+
${d}: ${c.average.toFixed(2)}ms avg
|
|
2192
|
+
</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}
|
|
2207
|
+
</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 = `
|
|
2219
|
+
.tachui-responsive-element {
|
|
2220
|
+
outline: 2px dashed #4fc3f7 !important;
|
|
2221
|
+
outline-offset: 2px !important;
|
|
2222
|
+
position: relative !important;
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2225
|
+
.tachui-responsive-element::before {
|
|
2226
|
+
content: 'R';
|
|
2227
|
+
position: absolute !important;
|
|
2228
|
+
top: -8px !important;
|
|
2229
|
+
right: -8px !important;
|
|
2230
|
+
background: #4fc3f7 !important;
|
|
2231
|
+
color: white !important;
|
|
2232
|
+
width: 16px !important;
|
|
2233
|
+
height: 16px !important;
|
|
2234
|
+
border-radius: 50% !important;
|
|
2235
|
+
font-size: 10px !important;
|
|
2236
|
+
font-weight: bold !important;
|
|
2237
|
+
display: flex !important;
|
|
2238
|
+
align-items: center !important;
|
|
2239
|
+
justify-content: center !important;
|
|
2240
|
+
z-index: 10001 !important;
|
|
2241
|
+
font-family: monospace !important;
|
|
2242
|
+
}
|
|
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
|
+
};
|
|
2538
|
+
//# sourceMappingURL=index.js.map
|