softable-pixels-web 1.0.0 → 1.0.2

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.
@@ -0,0 +1,528 @@
1
+ import { useInsertionEffect, useMemo } from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+
4
+ //#region src/hooks/useThemedStyles/utils/hasString.ts
5
+ /**
6
+ * Small deterministic hash for strings (djb2 variant).
7
+ * Used to generate stable class ids and cache keys.
8
+ */
9
+ function hashStr(str) {
10
+ let h = 5381;
11
+ for (let i = 0; i < str.length; i++) h = h * 33 ^ str.charCodeAt(i);
12
+ return (h >>> 0).toString(36);
13
+ }
14
+
15
+ //#endregion
16
+ //#region src/hooks/useThemedStyles/utils/stableStringfy.ts
17
+ /**
18
+ * Stable stringify (order-independent) for hashing.
19
+ * Sorts object keys to keep output deterministic.
20
+ */
21
+ function stableStringify(obj) {
22
+ if (obj == null || typeof obj !== "object") return String(obj);
23
+ if (Array.isArray(obj)) return `[${obj.map(stableStringify).join(",")}]`;
24
+ return `{${Object.keys(obj).sort().map((k) => `${k}:${stableStringify(obj[k])}`).join(",")}}`;
25
+ }
26
+
27
+ //#endregion
28
+ //#region src/hooks/useThemedStyles/utils/injectSlotsRule.ts
29
+ /** biome-ignore-all lint/suspicious/noExplicitAny: <Not needed> */
30
+ /**
31
+ * Single <style> tag used for all runtime rules.
32
+ */
33
+ const STYLE_ID = "__px_runtime_rules__";
34
+ /**
35
+ * Prevents injecting identical rules multiple times.
36
+ */
37
+ const CACHE = /* @__PURE__ */ new Set();
38
+ /**
39
+ * Ensures the runtime <style> element exists and returns it.
40
+ */
41
+ function ensureStyleEl() {
42
+ if (typeof document === "undefined") return null;
43
+ let el = document.getElementById(STYLE_ID);
44
+ if (!el) {
45
+ el = document.createElement("style");
46
+ el.id = STYLE_ID;
47
+ document.head.appendChild(el);
48
+ }
49
+ return el;
50
+ }
51
+ /**
52
+ * CSS properties that should NOT automatically receive "px" when given a number.
53
+ *
54
+ * Example:
55
+ * - opacity: 0.5 (NOT 0.5px)
56
+ * - zIndex: 10 (NOT 10px)
57
+ * - lineHeight: 1.2 (NOT 1.2px)
58
+ */
59
+ const UNITLESS = new Set([
60
+ "opacity",
61
+ "zIndex",
62
+ "fontWeight",
63
+ "flex",
64
+ "flexGrow",
65
+ "flexShrink",
66
+ "order",
67
+ "lineHeight"
68
+ ]);
69
+ /**
70
+ * Converts camelCase CSS property names to kebab-case.
71
+ * Keeps CSS variables intact (e.g. "--px-bg").
72
+ */
73
+ function toKebab(prop) {
74
+ if (prop.startsWith("--")) return prop;
75
+ return prop.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
76
+ }
77
+ /**
78
+ * Converts a JS value to a CSS value.
79
+ *
80
+ * - `number` => `"${n}px"` for most properties
81
+ * - `number` => `"${n}"` for unitless properties
82
+ * - `string` => string as-is
83
+ */
84
+ function toCssValue(prop, value) {
85
+ if (value == null) return null;
86
+ if (typeof value === "number" && !UNITLESS.has(prop)) return `${value}px`;
87
+ return String(value);
88
+ }
89
+ /**
90
+ * Converts a declaration object to CSS string.
91
+ *
92
+ * Example:
93
+ * `{ backgroundColor: "red", padding: 8 }`
94
+ * => `"background-color:red;padding:8px;"`
95
+ */
96
+ function declToCss(decl) {
97
+ const parts = [];
98
+ for (const [k, v] of Object.entries(decl)) {
99
+ const cssValue = toCssValue(k, v);
100
+ if (cssValue == null) continue;
101
+ parts.push(`${toKebab(k)}:${cssValue};`);
102
+ }
103
+ return parts.join("");
104
+ }
105
+ /**
106
+ * Scopes a selector to a generated slot class.
107
+ *
108
+ * Rules:
109
+ * - selectors containing "&" are replaced: "&:hover" => ".slot:hover"
110
+ * - selectors starting with ":" become pseudo: ":hover" => ".slot:hover"
111
+ * - otherwise it's treated as descendant: "p" => ".slot p"
112
+ */
113
+ function scopeSelector(selector, baseClass) {
114
+ const base = `.${baseClass}`;
115
+ if (selector.includes("&")) return selector.replaceAll("&", base);
116
+ if (selector.startsWith(":")) return `${base}${selector}`;
117
+ return `${base} ${selector}`;
118
+ }
119
+ /**
120
+ * Injects CSS rules for one slot class into the runtime <style> tag.
121
+ *
122
+ * The injected CSS is cached using a hash of (slotClass + rules).
123
+ */
124
+ function injectSlotRules(slotClass, rules) {
125
+ if (!rules || Object.keys(rules).length === 0) return;
126
+ if (typeof document === "undefined") return;
127
+ const key = hashStr(`${slotClass}:${stableStringify(rules)}`);
128
+ if (CACHE.has(key)) return;
129
+ const css = Object.entries(rules).map(([sel, decl]) => `${scopeSelector(sel, slotClass)}{${declToCss(decl)}}`).join("\n");
130
+ const el = ensureStyleEl();
131
+ if (!el) return;
132
+ el.appendChild(document.createTextNode(`\n${css}\n`));
133
+ CACHE.add(key);
134
+ }
135
+
136
+ //#endregion
137
+ //#region src/hooks/useThemedStyles/utils/mergeStyleMaps.ts
138
+ /**
139
+ * Shallow-merge style maps slot-by-slot.
140
+ * Warns when override contains unknown slots (developer UX).
141
+ */
142
+ /** biome-ignore-all lint/suspicious/noExplicitAny: <Not needed> */
143
+ function mergeStyleMaps(base, override) {
144
+ if (!override) return base;
145
+ const out = { ...base };
146
+ for (const key in override) {
147
+ if (!(key in base)) console.warn(`[useThemedStyles] Unknown style slot "${key}". Available slots: ${Object.keys(base).join(", ")}`);
148
+ out[key] = {
149
+ ...base[key] ?? {},
150
+ ...override[key] ?? {}
151
+ };
152
+ }
153
+ return out;
154
+ }
155
+
156
+ //#endregion
157
+ //#region src/hooks/useThemedStyles/utils/resolveCommonStyleProps.ts
158
+ function toCss(v) {
159
+ return typeof v === "number" ? `${v}rem` : v;
160
+ }
161
+ /**
162
+ * Source of truth: common prop -> how it maps into CSSProperties.
163
+ * Add new common props ONLY here.
164
+ */
165
+ const COMMON_MAP = {
166
+ m: (v, o) => {
167
+ o.margin = toCss(v);
168
+ },
169
+ mx: (v, o) => {
170
+ o.marginLeft = toCss(v);
171
+ o.marginRight = toCss(v);
172
+ },
173
+ my: (v, o) => {
174
+ o.marginTop = toCss(v);
175
+ o.marginBottom = toCss(v);
176
+ },
177
+ mt: (v, o) => {
178
+ o.marginTop = toCss(v);
179
+ },
180
+ mr: (v, o) => {
181
+ o.marginRight = toCss(v);
182
+ },
183
+ mb: (v, o) => {
184
+ o.marginBottom = toCss(v);
185
+ },
186
+ ml: (v, o) => {
187
+ o.marginLeft = toCss(v);
188
+ },
189
+ p: (v, o) => {
190
+ o.padding = toCss(v);
191
+ },
192
+ px: (v, o) => {
193
+ o.paddingLeft = toCss(v);
194
+ o.paddingRight = toCss(v);
195
+ },
196
+ py: (v, o) => {
197
+ o.paddingTop = toCss(v);
198
+ o.paddingBottom = toCss(v);
199
+ },
200
+ pt: (v, o) => {
201
+ o.paddingTop = toCss(v);
202
+ },
203
+ pr: (v, o) => {
204
+ o.paddingRight = toCss(v);
205
+ },
206
+ pb: (v, o) => {
207
+ o.paddingBottom = toCss(v);
208
+ },
209
+ pl: (v, o) => {
210
+ o.paddingLeft = toCss(v);
211
+ },
212
+ fontSize: (v, o) => {
213
+ o.fontSize = toCss(v);
214
+ },
215
+ fontWeight: (v, o) => {
216
+ o.fontWeight = v;
217
+ },
218
+ lineHeight: (v, o) => {
219
+ o.lineHeight = toCss(v);
220
+ },
221
+ textAlign: (v, o) => {
222
+ o.textAlign = v;
223
+ },
224
+ w: (v, o) => {
225
+ o.width = toCss(v);
226
+ },
227
+ h: (v, o) => {
228
+ o.height = toCss(v);
229
+ },
230
+ minW: (v, o) => {
231
+ o.minWidth = toCss(v);
232
+ },
233
+ maxW: (v, o) => {
234
+ o.maxWidth = toCss(v);
235
+ },
236
+ minH: (v, o) => {
237
+ o.minHeight = toCss(v);
238
+ },
239
+ maxH: (v, o) => {
240
+ o.maxHeight = toCss(v);
241
+ }
242
+ };
243
+ const COMMON_KEYS = Object.keys(COMMON_MAP);
244
+ function hasAnyCommonStyleProps(props) {
245
+ for (const k of COMMON_KEYS) if (props[k] != null) return true;
246
+ return false;
247
+ }
248
+ function resolveCommonStyleProps(props) {
249
+ const out = {};
250
+ for (const k of COMMON_KEYS) {
251
+ const value = props[k];
252
+ if (value != null) COMMON_MAP[k](value, out);
253
+ }
254
+ return out;
255
+ }
256
+ /**
257
+ * Applies common style props (if present) to a chosen slot.
258
+ * Common props are resolved by `resolveCommonStyleProps`.
259
+ */
260
+ function applyCommonsToStyles(styles, props, slotOverride) {
261
+ if (!hasAnyCommonStyleProps(props)) return styles;
262
+ const keys = Object.keys(styles);
263
+ if (keys.length === 0) return styles;
264
+ const slot = slotOverride ?? ("container" in styles ? "container" : keys[0]);
265
+ const common = resolveCommonStyleProps(props);
266
+ return {
267
+ ...styles,
268
+ [slot]: {
269
+ ...styles[slot] ?? {},
270
+ ...common
271
+ }
272
+ };
273
+ }
274
+
275
+ //#endregion
276
+ //#region src/hooks/useThemedStyles/utils/splitRules.ts
277
+ /**
278
+ * Splits the style map into:
279
+ * - `inline`: slot styles without `__rules`
280
+ * - `rulesBySlot`: extracted `__rules` grouped by slot
281
+ *
282
+ * This lets us:
283
+ * - apply inline styles directly via `style={...}`
284
+ * - inject selectors/pseudos via generated CSS classes
285
+ */
286
+ function splitRules(styles) {
287
+ const inline = {};
288
+ const rulesBySlot = {};
289
+ for (const key in styles) {
290
+ const slot = styles[key];
291
+ if (!slot) continue;
292
+ const { __rules, ...rest } = slot;
293
+ inline[key] = rest;
294
+ if (__rules && Object.keys(__rules).length > 0) rulesBySlot[key] = __rules;
295
+ }
296
+ return {
297
+ inline,
298
+ rulesBySlot
299
+ };
300
+ }
301
+
302
+ //#endregion
303
+ //#region src/hooks/useThemedStyles/utils/stripCommonProps.ts
304
+ const COMMON_KEY_SET = new Set(COMMON_KEYS);
305
+
306
+ //#endregion
307
+ //#region src/hooks/useThemedStyles/index.ts
308
+ /** biome-ignore-all lint/suspicious/noExplicitAny: <Not needed> */
309
+ /**
310
+ * useThemedStyles
311
+ *
312
+ * A React-Native-like style factory hook for React Web that also supports:
313
+ * - CSS variables in inline styles
314
+ * - Pseudo selectors, nested selectors, and vendor selectors via `__rules`
315
+ *
316
+ * It returns two maps:
317
+ * - `styles`: inline styles for each slot
318
+ * - `classes`: generated classes for each slot (needed for `__rules`)
319
+ *
320
+ * Usage:
321
+ * ```tsx
322
+ * const { styles, classes } = useThemedStyles(props, createStyles)
323
+ *
324
+ * return (
325
+ * <button style={styles.item} className={classes.item}>
326
+ * <p style={styles.label} className={classes.label}>Hello</p>
327
+ * </button>
328
+ * )
329
+ * ```
330
+ *
331
+ * Notes:
332
+ * - If a slot has no `__rules`, you can omit `className` for that slot.
333
+ * - If you use `__rules`, you MUST apply the corresponding class for scoping.
334
+ */
335
+ function useThemedStyles(props, factory, options) {
336
+ const raw = useMemo(() => factory(props), [factory, ...options?.deps ?? (options?.pick ? options.pick(props) : [props])]);
337
+ const { inline, rulesBySlot } = useMemo(() => splitRules(raw), [raw]);
338
+ const merged = useMemo(() => mergeStyleMaps(inline, options?.override), [inline, options?.override]);
339
+ const withCommons = useMemo(() => {
340
+ if (!options?.applyCommonProps) return merged;
341
+ return applyCommonsToStyles(merged, props, options.commonSlot);
342
+ }, [
343
+ merged,
344
+ props,
345
+ options?.applyCommonProps,
346
+ options?.commonSlot
347
+ ]);
348
+ /**
349
+ * Base id is derived only from the rules signature.
350
+ * This keeps class names stable whenever rules don't change.
351
+ */
352
+ const baseId = useMemo(() => {
353
+ const key = hashStr(stableStringify(rulesBySlot));
354
+ return options?.debugName ? `pxr-${options.debugName}-${key}` : `pxr-${key}`;
355
+ }, [rulesBySlot, options?.debugName]);
356
+ /**
357
+ * Generated class per slot.
358
+ * Example: pxr-<hash>__item
359
+ */
360
+ const classes = useMemo(() => {
361
+ const out = {};
362
+ for (const slotKey of Object.keys(withCommons)) out[slotKey] = `${baseId}__${slotKey}`;
363
+ return out;
364
+ }, [baseId, withCommons]);
365
+ /**
366
+ * Inject rules into the runtime <style> tag.
367
+ *
368
+ * We use `useInsertionEffect` so styles are inserted before layout/paint
369
+ * when supported (best for CSS-in-JS style injection).
370
+ */
371
+ useInsertionEffect(() => {
372
+ for (const slotKey of Object.keys(rulesBySlot)) {
373
+ const rules = rulesBySlot[slotKey];
374
+ if (!rules) continue;
375
+ injectSlotRules(classes[slotKey], rules);
376
+ }
377
+ }, [rulesBySlot, classes]);
378
+ return {
379
+ styles: withCommons,
380
+ classes
381
+ };
382
+ }
383
+
384
+ //#endregion
385
+ //#region src/components/toolkit/Typography/config.ts
386
+ const primaryColor = "var(--px-text-primary)";
387
+ const secondaryColor = "var(--px-text-secondary)";
388
+ const typographyVariants = {
389
+ h1: {
390
+ fontSize: "3rem",
391
+ fontWeight: "700",
392
+ lineHeight: "1.25",
393
+ color: primaryColor
394
+ },
395
+ h2: {
396
+ fontSize: "2.25rem",
397
+ fontWeight: "600",
398
+ lineHeight: "1.35",
399
+ color: primaryColor
400
+ },
401
+ h3: {
402
+ fontSize: "1.875rem",
403
+ fontWeight: "600",
404
+ color: primaryColor
405
+ },
406
+ h4: {
407
+ fontSize: "1.5rem",
408
+ fontWeight: "500",
409
+ color: primaryColor
410
+ },
411
+ h5: {
412
+ fontSize: "1.25rem",
413
+ fontWeight: "500",
414
+ color: primaryColor
415
+ },
416
+ b1: {
417
+ fontSize: "1rem",
418
+ fontWeight: "500",
419
+ color: primaryColor
420
+ },
421
+ b2: {
422
+ fontSize: "0.875rem",
423
+ color: secondaryColor
424
+ },
425
+ b3: {
426
+ fontSize: "0.75rem",
427
+ color: secondaryColor
428
+ },
429
+ caption: {
430
+ fontSize: "0.75rem",
431
+ color: secondaryColor
432
+ },
433
+ legal: {
434
+ fontSize: "0.65rem",
435
+ textTransform: "uppercase",
436
+ letterSpacing: "0.025em",
437
+ color: secondaryColor
438
+ }
439
+ };
440
+ const variantToElement = {
441
+ h1: "h1",
442
+ h2: "h2",
443
+ h3: "h3",
444
+ h4: "h4",
445
+ h5: "h5",
446
+ b1: "p",
447
+ b2: "p",
448
+ b3: "p",
449
+ caption: "span",
450
+ legal: "span"
451
+ };
452
+ const alignText = {
453
+ left: { textAlign: "left" },
454
+ center: { textAlign: "center" },
455
+ right: { textAlign: "right" },
456
+ justify: { textAlign: "justify" }
457
+ };
458
+
459
+ //#endregion
460
+ //#region src/components/toolkit/Typography/style.ts
461
+ function createTypographyStyles(props) {
462
+ const { isLoading, variant, align = "left" } = props;
463
+ return {
464
+ base: {
465
+ display: "flex",
466
+ flexDirection: "row",
467
+ alignItems: "center",
468
+ borderBottom: "1px solid var(--pixel-border, #e5e7eb)",
469
+ gap: 0,
470
+ animation: isLoading ? "animate-pulse 1.5s infinite" : void 0
471
+ },
472
+ loading: {
473
+ width: "50%",
474
+ height: "1em",
475
+ display: "inline-block",
476
+ backgroundColor: "var(--pixel-gray-300, #d1d5db)",
477
+ borderRadius: "0.25rem"
478
+ },
479
+ text: {
480
+ ...alignText[align],
481
+ ...typographyVariants[variant]
482
+ }
483
+ };
484
+ }
485
+
486
+ //#endregion
487
+ //#region src/components/toolkit/Typography/index.tsx
488
+ function Typography(props) {
489
+ const { id, as, href, variant, children, placeholder, isLoading = false, styles: styleTypography } = props;
490
+ const { styles } = useThemedStyles(props, createTypographyStyles, {
491
+ pick: (p) => [
492
+ p.isLoading,
493
+ p.variant,
494
+ p.align
495
+ ],
496
+ commonSlot: "text",
497
+ applyCommonProps: true,
498
+ override: styleTypography
499
+ });
500
+ const Component = as ?? variantToElement[variant];
501
+ if (isLoading) return /* @__PURE__ */ jsx("span", {
502
+ id,
503
+ "aria-hidden": "true",
504
+ role: "presentation",
505
+ style: {
506
+ ...styles.text,
507
+ ...styles.loading
508
+ }
509
+ });
510
+ const sharedProps = {
511
+ id,
512
+ style: styles.text,
513
+ "aria-label": placeholder
514
+ };
515
+ if (href) return /* @__PURE__ */ jsx("a", {
516
+ href,
517
+ ...sharedProps,
518
+ children
519
+ });
520
+ return /* @__PURE__ */ jsx(Component, {
521
+ ...sharedProps,
522
+ children
523
+ });
524
+ }
525
+
526
+ //#endregion
527
+ export { useThemedStyles as n, Typography as t };
528
+ //# sourceMappingURL=Typography-Dn1vnPBy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Typography-Dn1vnPBy.js","names":["parts: string[]","COMMON_MAP: Record<\n keyof CommonStyleProps,\n (value: any, out: React.CSSProperties) => void\n>","out: React.CSSProperties","inline: any","rulesBySlot: any","out: any","typographyVariants: Record<TypographyVariant, CSSProperties>","variantToElement: Record<\n TypographyVariant,\n keyof JSX.IntrinsicElements\n>","alignText: Record<TextAlign, CSSProperties>"],"sources":["../src/hooks/useThemedStyles/utils/hasString.ts","../src/hooks/useThemedStyles/utils/stableStringfy.ts","../src/hooks/useThemedStyles/utils/injectSlotsRule.ts","../src/hooks/useThemedStyles/utils/mergeStyleMaps.ts","../src/hooks/useThemedStyles/utils/resolveCommonStyleProps.ts","../src/hooks/useThemedStyles/utils/splitRules.ts","../src/hooks/useThemedStyles/utils/stripCommonProps.ts","../src/hooks/useThemedStyles/index.ts","../src/components/toolkit/Typography/config.ts","../src/components/toolkit/Typography/style.ts","../src/components/toolkit/Typography/index.tsx"],"sourcesContent":["/**\n * Small deterministic hash for strings (djb2 variant).\n * Used to generate stable class ids and cache keys.\n */\nexport function hashStr(str: string) {\n let h = 5381\n for (let i = 0; i < str.length; i++) h = (h * 33) ^ str.charCodeAt(i)\n return (h >>> 0).toString(36)\n}\n","/**\n * Stable stringify (order-independent) for hashing.\n * Sorts object keys to keep output deterministic.\n */\nexport function stableStringify(obj: any): string {\n if (obj == null || typeof obj !== 'object') return String(obj)\n if (Array.isArray(obj)) return `[${obj.map(stableStringify).join(',')}]`\n const keys = Object.keys(obj).sort()\n return `{${keys.map(k => `${k}:${stableStringify(obj[k])}`).join(',')}}`\n}\n","/** biome-ignore-all lint/suspicious/noExplicitAny: <Not needed> */\n\n// Utils\nimport { hashStr } from './hasString'\nimport { stableStringify } from './stableStringfy'\n\n// Types\nimport type { RuleMap } from '../types'\n\n/**\n * Single <style> tag used for all runtime rules.\n */\nconst STYLE_ID = '__px_runtime_rules__'\n\n/**\n * Prevents injecting identical rules multiple times.\n */\nconst CACHE = new Set<string>()\n\n/**\n * Ensures the runtime <style> element exists and returns it.\n */\nfunction ensureStyleEl(): HTMLStyleElement | null {\n if (typeof document === 'undefined') return null\n let el = document.getElementById(STYLE_ID) as HTMLStyleElement | null\n if (!el) {\n el = document.createElement('style')\n el.id = STYLE_ID\n document.head.appendChild(el)\n }\n return el\n}\n\n/**\n * CSS properties that should NOT automatically receive \"px\" when given a number.\n *\n * Example:\n * - opacity: 0.5 (NOT 0.5px)\n * - zIndex: 10 (NOT 10px)\n * - lineHeight: 1.2 (NOT 1.2px)\n */\nconst UNITLESS = new Set([\n 'opacity',\n 'zIndex',\n 'fontWeight',\n 'flex',\n 'flexGrow',\n 'flexShrink',\n 'order',\n 'lineHeight'\n])\n\n/**\n * Converts camelCase CSS property names to kebab-case.\n * Keeps CSS variables intact (e.g. \"--px-bg\").\n */\nfunction toKebab(prop: string) {\n if (prop.startsWith('--')) return prop\n return prop.replace(/[A-Z]/g, m => `-${m.toLowerCase()}`)\n}\n\n/**\n * Converts a JS value to a CSS value.\n *\n * - `number` => `\"${n}px\"` for most properties\n * - `number` => `\"${n}\"` for unitless properties\n * - `string` => string as-is\n */\nfunction toCssValue(prop: string, value: any) {\n if (value == null) return null\n if (typeof value === 'number' && !UNITLESS.has(prop)) return `${value}px`\n return String(value)\n}\n\n/**\n * Converts a declaration object to CSS string.\n *\n * Example:\n * `{ backgroundColor: \"red\", padding: 8 }`\n * => `\"background-color:red;padding:8px;\"`\n */\nfunction declToCss(decl: Record<string, any>) {\n const parts: string[] = []\n for (const [k, v] of Object.entries(decl)) {\n const cssValue = toCssValue(k, v)\n if (cssValue == null) continue\n parts.push(`${toKebab(k)}:${cssValue};`)\n }\n return parts.join('')\n}\n\n/**\n * Scopes a selector to a generated slot class.\n *\n * Rules:\n * - selectors containing \"&\" are replaced: \"&:hover\" => \".slot:hover\"\n * - selectors starting with \":\" become pseudo: \":hover\" => \".slot:hover\"\n * - otherwise it's treated as descendant: \"p\" => \".slot p\"\n */\nfunction scopeSelector(selector: string, baseClass: string) {\n const base = `.${baseClass}`\n\n if (selector.includes('&')) return selector.replaceAll('&', base)\n if (selector.startsWith(':')) return `${base}${selector}`\n return `${base} ${selector}`\n}\n\n/**\n * Injects CSS rules for one slot class into the runtime <style> tag.\n *\n * The injected CSS is cached using a hash of (slotClass + rules).\n */\nexport function injectSlotRules(slotClass: string, rules?: RuleMap) {\n if (!rules || Object.keys(rules).length === 0) return\n if (typeof document === 'undefined') return\n\n const signature = `${slotClass}:${stableStringify(rules)}`\n const key = hashStr(signature)\n if (CACHE.has(key)) return\n\n const css = Object.entries(rules)\n .map(\n ([sel, decl]) => `${scopeSelector(sel, slotClass)}{${declToCss(decl)}}`\n )\n .join('\\n')\n\n const el = ensureStyleEl()\n if (!el) return\n\n el.appendChild(document.createTextNode(`\\n${css}\\n`))\n CACHE.add(key)\n}\n","/**\n * Shallow-merge style maps slot-by-slot.\n * Warns when override contains unknown slots (developer UX).\n */\n/** biome-ignore-all lint/suspicious/noExplicitAny: <Not needed> */\nexport function mergeStyleMaps<T extends Record<string, any>>(\n base: T,\n override?: Partial<T>\n): T {\n if (!override) return base\n const out = { ...base } as T\n\n for (const key in override) {\n if (!(key in base)) {\n console.warn(\n `[useThemedStyles] Unknown style slot \"${key}\". Available slots: ${Object.keys(base).join(', ')}`\n )\n }\n\n out[key] = { ...(base[key] ?? {}), ...(override[key] ?? {}) } as any\n }\n\n return out\n}\n","/** biome-ignore-all lint/suspicious/noExplicitAny: <Not needed> */\n\n// Types\nimport type { CommonStyleProps } from '../types'\n\nfunction toCss(v: number | string | undefined) {\n return typeof v === 'number' ? `${v}rem` : v\n}\n\n/**\n * Source of truth: common prop -> how it maps into CSSProperties.\n * Add new common props ONLY here.\n */\nconst COMMON_MAP: Record<\n keyof CommonStyleProps,\n (value: any, out: React.CSSProperties) => void\n> = {\n // margin\n m: (v, o) => {\n o.margin = toCss(v)\n },\n mx: (v, o) => {\n o.marginLeft = toCss(v)\n o.marginRight = toCss(v)\n },\n my: (v, o) => {\n o.marginTop = toCss(v)\n o.marginBottom = toCss(v)\n },\n mt: (v, o) => {\n o.marginTop = toCss(v)\n },\n mr: (v, o) => {\n o.marginRight = toCss(v)\n },\n mb: (v, o) => {\n o.marginBottom = toCss(v)\n },\n ml: (v, o) => {\n o.marginLeft = toCss(v)\n },\n\n // padding\n p: (v, o) => {\n o.padding = toCss(v)\n },\n px: (v, o) => {\n o.paddingLeft = toCss(v)\n o.paddingRight = toCss(v)\n },\n py: (v, o) => {\n o.paddingTop = toCss(v)\n o.paddingBottom = toCss(v)\n },\n pt: (v, o) => {\n o.paddingTop = toCss(v)\n },\n pr: (v, o) => {\n o.paddingRight = toCss(v)\n },\n pb: (v, o) => {\n o.paddingBottom = toCss(v)\n },\n pl: (v, o) => {\n o.paddingLeft = toCss(v)\n },\n\n // text\n fontSize: (v, o) => {\n o.fontSize = toCss(v)\n },\n fontWeight: (v, o) => {\n o.fontWeight = v\n },\n lineHeight: (v, o) => {\n o.lineHeight = toCss(v)\n },\n textAlign: (v, o) => {\n o.textAlign = v\n },\n\n // layout\n w: (v, o) => {\n o.width = toCss(v)\n },\n h: (v, o) => {\n o.height = toCss(v)\n },\n minW: (v, o) => {\n o.minWidth = toCss(v)\n },\n maxW: (v, o) => {\n o.maxWidth = toCss(v)\n },\n minH: (v, o) => {\n o.minHeight = toCss(v)\n },\n maxH: (v, o) => {\n o.maxHeight = toCss(v)\n }\n}\n\nexport const COMMON_KEYS = Object.keys(COMMON_MAP) as Array<\n keyof CommonStyleProps\n>\n\nexport function hasAnyCommonStyleProps(props: Partial<CommonStyleProps>) {\n for (const k of COMMON_KEYS) {\n if (props[k] != null) return true\n }\n return false\n}\n\nexport function resolveCommonStyleProps(\n props: Partial<CommonStyleProps>\n): React.CSSProperties {\n const out: React.CSSProperties = {}\n\n for (const k of COMMON_KEYS) {\n const value = props[k]\n if (value != null) COMMON_MAP[k](value, out)\n }\n\n return out\n}\n\n/**\n * Applies common style props (if present) to a chosen slot.\n * Common props are resolved by `resolveCommonStyleProps`.\n */\nexport function applyCommonsToStyles<TStyles extends Record<string, any>>(\n styles: TStyles,\n props: Partial<CommonStyleProps>,\n slotOverride?: keyof TStyles\n): TStyles {\n if (!hasAnyCommonStyleProps(props)) return styles\n\n const keys = Object.keys(styles)\n if (keys.length === 0) return styles\n\n const slot =\n slotOverride ??\n (('container' in styles ? 'container' : keys[0]) as keyof TStyles)\n\n const common = resolveCommonStyleProps(props)\n\n return {\n ...styles,\n [slot]: { ...(styles[slot] ?? {}), ...common }\n } as TStyles\n}\n","// Types\n/** biome-ignore-all lint/suspicious/noExplicitAny: <Not needed> */\nimport type { SplitResult, StyleMap } from '../types'\n\n/**\n * Splits the style map into:\n * - `inline`: slot styles without `__rules`\n * - `rulesBySlot`: extracted `__rules` grouped by slot\n *\n * This lets us:\n * - apply inline styles directly via `style={...}`\n * - inject selectors/pseudos via generated CSS classes\n */\nexport function splitRules<TStyles extends StyleMap>(\n styles: TStyles\n): SplitResult<TStyles> {\n const inline: any = {}\n const rulesBySlot: any = {}\n\n for (const key in styles) {\n const slot = styles[key]\n if (!slot) continue\n\n const { __rules, ...rest } = slot as any\n inline[key] = rest\n\n if (__rules && Object.keys(__rules).length > 0) {\n rulesBySlot[key] = __rules\n }\n }\n\n return { inline, rulesBySlot }\n}\n","/** biome-ignore-all lint/suspicious/noExplicitAny: <Not needed> */\n\nimport type { CommonStyleProps } from '../types'\n\nimport { COMMON_KEYS } from './resolveCommonStyleProps'\n\nconst COMMON_KEY_SET = new Set<string>(COMMON_KEYS as readonly string[])\n\nexport function stripCommonProps<T extends object>(\n props: T\n): Omit<T, keyof CommonStyleProps> {\n const out: Record<string, unknown> = {}\n\n for (const key of Object.keys(props as any)) {\n if (!COMMON_KEY_SET.has(key)) {\n out[key] = (props as any)[key]\n }\n }\n\n return out as Omit<T, keyof CommonStyleProps>\n}\n","/** biome-ignore-all lint/suspicious/noExplicitAny: <Not needed> */\n\n// External Libraries\nimport { useMemo, useInsertionEffect } from 'react'\n\n// Utils\nimport {\n hashStr,\n splitRules,\n mergeStyleMaps,\n injectSlotRules,\n stableStringify,\n applyCommonsToStyles\n} from './utils'\n\n// Types\nimport type {\n CSSVars,\n RuleMap,\n StyleMap,\n StylesFactory,\n UseThemedStylesOptions\n} from './types'\n\n/**\n * useThemedStyles\n *\n * A React-Native-like style factory hook for React Web that also supports:\n * - CSS variables in inline styles\n * - Pseudo selectors, nested selectors, and vendor selectors via `__rules`\n *\n * It returns two maps:\n * - `styles`: inline styles for each slot\n * - `classes`: generated classes for each slot (needed for `__rules`)\n *\n * Usage:\n * ```tsx\n * const { styles, classes } = useThemedStyles(props, createStyles)\n *\n * return (\n * <button style={styles.item} className={classes.item}>\n * <p style={styles.label} className={classes.label}>Hello</p>\n * </button>\n * )\n * ```\n *\n * Notes:\n * - If a slot has no `__rules`, you can omit `className` for that slot.\n * - If you use `__rules`, you MUST apply the corresponding class for scoping.\n */\nexport function useThemedStyles<TProps, TStyles extends StyleMap>(\n props: TProps,\n factory: StylesFactory<TProps, TStyles>,\n options?: UseThemedStylesOptions<TProps, TStyles>\n): {\n styles: Record<keyof TStyles, React.CSSProperties | CSSVars>\n classes: Record<keyof TStyles, string>\n} {\n /**\n * Memoization priority:\n * 1) deps (manual)\n * 2) pick(props) (recommended)\n * 3) props reference (default behavior)\n */\n const memoKey =\n options?.deps ?? (options?.pick ? options.pick(props) : [props])\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: controlled by deps/pick\n const raw = useMemo(() => factory(props), [factory, ...memoKey])\n\n const { inline, rulesBySlot } = useMemo(() => splitRules(raw), [raw])\n\n const merged = useMemo(\n () => mergeStyleMaps(inline as any, options?.override),\n [inline, options?.override]\n )\n\n const withCommons = useMemo(() => {\n if (!options?.applyCommonProps) return merged\n return applyCommonsToStyles(merged as any, props as any, options.commonSlot)\n }, [merged, props, options?.applyCommonProps, options?.commonSlot])\n\n /**\n * Base id is derived only from the rules signature.\n * This keeps class names stable whenever rules don't change.\n */\n const baseId = useMemo(() => {\n const sig = stableStringify(rulesBySlot)\n const key = hashStr(sig)\n return options?.debugName ? `pxr-${options.debugName}-${key}` : `pxr-${key}`\n }, [rulesBySlot, options?.debugName])\n\n /**\n * Generated class per slot.\n * Example: pxr-<hash>__item\n */\n const classes = useMemo(() => {\n const out: any = {}\n for (const slotKey of Object.keys(withCommons)) {\n out[slotKey] = `${baseId}__${slotKey}`\n }\n return out as Record<keyof TStyles, string>\n }, [baseId, withCommons])\n\n /**\n * Inject rules into the runtime <style> tag.\n *\n * We use `useInsertionEffect` so styles are inserted before layout/paint\n * when supported (best for CSS-in-JS style injection).\n */\n useInsertionEffect(() => {\n for (const slotKey of Object.keys(rulesBySlot as any)) {\n const rules = (rulesBySlot as any)[slotKey] as RuleMap | undefined\n if (!rules) continue\n injectSlotRules((classes as any)[slotKey], rules)\n }\n }, [rulesBySlot, classes])\n\n return { styles: withCommons as any, classes }\n}\n","// External Libraries\nimport type { CSSProperties, JSX } from 'react'\n\n// Types\nimport type { TextAlign, TypographyVariant } from './types'\n\nconst primaryColor = 'var(--px-text-primary)'\nconst secondaryColor = 'var(--px-text-secondary)'\n\nexport const typographyVariants: Record<TypographyVariant, CSSProperties> = {\n h1: {\n fontSize: '3rem',\n fontWeight: '700',\n lineHeight: '1.25',\n color: primaryColor\n },\n h2: {\n fontSize: '2.25rem',\n fontWeight: '600',\n lineHeight: '1.35',\n color: primaryColor\n },\n h3: {\n fontSize: '1.875rem',\n fontWeight: '600',\n color: primaryColor\n },\n h4: {\n fontSize: '1.5rem',\n fontWeight: '500',\n color: primaryColor\n },\n h5: {\n fontSize: '1.25rem',\n fontWeight: '500',\n color: primaryColor\n },\n b1: {\n fontSize: '1rem',\n fontWeight: '500',\n color: primaryColor\n },\n b2: {\n fontSize: '0.875rem',\n color: secondaryColor\n },\n b3: {\n fontSize: '0.75rem',\n color: secondaryColor\n },\n caption: {\n fontSize: '0.75rem',\n color: secondaryColor\n },\n legal: {\n fontSize: '0.65rem',\n textTransform: 'uppercase',\n letterSpacing: '0.025em',\n color: secondaryColor\n }\n}\n\nexport const variantToElement: Record<\n TypographyVariant,\n keyof JSX.IntrinsicElements\n> = {\n h1: 'h1',\n h2: 'h2',\n h3: 'h3',\n h4: 'h4',\n h5: 'h5',\n b1: 'p',\n b2: 'p',\n b3: 'p',\n caption: 'span',\n legal: 'span'\n}\n\nexport const alignText: Record<TextAlign, CSSProperties> = {\n left: { textAlign: 'left' },\n center: { textAlign: 'center' },\n right: { textAlign: 'right' },\n justify: { textAlign: 'justify' }\n}\n","// Utils\nimport { alignText, typographyVariants } from './config'\n\n// Types\nimport type { TypographyProps } from './types'\nimport type { StyleMap } from '@hooks/useThemedStyles/types'\n\nexport function createTypographyStyles(props: TypographyProps): StyleMap {\n const { isLoading, variant, align = 'left' } = props\n\n return {\n base: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n borderBottom: '1px solid var(--pixel-border, #e5e7eb)',\n gap: 0,\n animation: isLoading ? 'animate-pulse 1.5s infinite' : undefined\n },\n\n loading: {\n width: '50%',\n height: '1em',\n display: 'inline-block',\n backgroundColor: 'var(--pixel-gray-300, #d1d5db)',\n borderRadius: '0.25rem'\n },\n\n text: {\n ...alignText[align],\n ...typographyVariants[variant]\n }\n }\n}\n","// Utils\nimport { variantToElement } from './config'\n\n// Types\nimport type { TypographyProps } from './types'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Styles\nimport { createTypographyStyles } from './style'\n\nexport function Typography(props: TypographyProps) {\n const {\n id,\n as,\n href,\n variant,\n children,\n placeholder,\n isLoading = false,\n styles: styleTypography\n } = props\n\n const { styles } = useThemedStyles(props, createTypographyStyles, {\n pick: p => [p.isLoading, p.variant, p.align],\n commonSlot: 'text',\n applyCommonProps: true,\n override: styleTypography\n })\n\n const Component = as ?? variantToElement[variant]\n\n if (isLoading) {\n return (\n <span\n id={id}\n aria-hidden=\"true\"\n role=\"presentation\"\n style={{ ...styles.text, ...styles.loading }}\n />\n )\n }\n\n const sharedProps = {\n id,\n style: styles.text,\n 'aria-label': placeholder\n }\n\n if (href) {\n return (\n <a href={href} {...sharedProps}>\n {children}\n </a>\n )\n }\n\n return <Component {...sharedProps}>{children}</Component>\n}\n"],"mappings":";;;;;;;;AAIA,SAAgB,QAAQ,KAAa;CACnC,IAAI,IAAI;AACR,MAAK,IAAI,IAAI,GAAG,IAAI,IAAI,QAAQ,IAAK,KAAK,IAAI,KAAM,IAAI,WAAW,EAAE;AACrE,SAAQ,MAAM,GAAG,SAAS,GAAG;;;;;;;;;ACH/B,SAAgB,gBAAgB,KAAkB;AAChD,KAAI,OAAO,QAAQ,OAAO,QAAQ,SAAU,QAAO,OAAO,IAAI;AAC9D,KAAI,MAAM,QAAQ,IAAI,CAAE,QAAO,IAAI,IAAI,IAAI,gBAAgB,CAAC,KAAK,IAAI,CAAC;AAEtE,QAAO,IADM,OAAO,KAAK,IAAI,CAAC,MAAM,CACpB,KAAI,MAAK,GAAG,EAAE,GAAG,gBAAgB,IAAI,GAAG,GAAG,CAAC,KAAK,IAAI,CAAC;;;;;;;;;ACIxE,MAAM,WAAW;;;;AAKjB,MAAM,wBAAQ,IAAI,KAAa;;;;AAK/B,SAAS,gBAAyC;AAChD,KAAI,OAAO,aAAa,YAAa,QAAO;CAC5C,IAAI,KAAK,SAAS,eAAe,SAAS;AAC1C,KAAI,CAAC,IAAI;AACP,OAAK,SAAS,cAAc,QAAQ;AACpC,KAAG,KAAK;AACR,WAAS,KAAK,YAAY,GAAG;;AAE/B,QAAO;;;;;;;;;;AAWT,MAAM,WAAW,IAAI,IAAI;CACvB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;;;;AAMF,SAAS,QAAQ,MAAc;AAC7B,KAAI,KAAK,WAAW,KAAK,CAAE,QAAO;AAClC,QAAO,KAAK,QAAQ,WAAU,MAAK,IAAI,EAAE,aAAa,GAAG;;;;;;;;;AAU3D,SAAS,WAAW,MAAc,OAAY;AAC5C,KAAI,SAAS,KAA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,cAAc;GACd,KAAK;GACL,WAAW,YAAY,gCAAgC;GACxD;EAED,SAAS;GACP,OAAO;GACP,QAAQ;GACR,SAAS;GACT,iBAAiB;GACjB,cAAc;GACf;EAED,MAAM;GACJ,GAAG,UAAU;GACb,GAAG,mBAAmB;GACvB;EACF;;;;;ACpBH,SAAgB,WAAW,OAAwB;CACjD,MAAM,EACJ,IACA,IACA,MACA,SACA,UACA,aACA,YAAY,OACZ,QAAQ,oBACN;CAEJ,MAAM,EAAE,WAAW,gBAAgB,OAAO,wBAAwB;EAChE,OAAM,MAAK;GAAC,EAAE;GAAW,EAAE;GAAS,EAAE;GAAM;EAC5C,YAAY;EACZ,kBAAkB;EAClB,UAAU;EACX,CAAC;CAEF,MAAM,YAAY,MAAM,iBAAiB;AAEzC,KAAI,UACF,QACE,oBAAC;EACK;EACJ,eAAY;EACZ,MAAK;EACL,OAAO;GAAE,GAAG,OAAO;GAAM,GAAG,OAAO;GAAS;GAC5C;CAIN,MAAM,cAAc;EAClB;EACA,OAAO,OAAO;EACd,cAAc;EACf;AAED,KAAI,KACF,QACE,oBAAC;EAAQ;EAAM,GAAI;EAChB;GACC;AAIR,QAAO,oBAAC;EAAU,GAAI;EAAc;GAAqB"}
@@ -0,0 +1,32 @@
1
+ import { n as CommonStyleProps, t as StyleMap } from "./useThemedStyles-DyrejrCM.js";
2
+ import { ReactNode } from "react";
3
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
4
+
5
+ //#region src/components/toolkit/TabSwitch/styles.d.ts
6
+ declare function createTabSwitchStyles<T>(props: TabSwitchProps<T>): StyleMap;
7
+ //#endregion
8
+ //#region src/components/toolkit/TabSwitch/types.d.ts
9
+ interface SwitchOption<T> {
10
+ value: T;
11
+ label: string;
12
+ disabled?: boolean;
13
+ icon?: ReactNode;
14
+ }
15
+ interface TabSwitchProps<T> extends CommonStyleProps {
16
+ currentValue: T;
17
+ options: SwitchOption<T>[];
18
+ disabled?: boolean;
19
+ fitContent?: boolean;
20
+ layoutId?: string;
21
+ selectedColor?: string;
22
+ selectedLabelColor?: string;
23
+ variant?: 'default' | 'underline';
24
+ styles?: Partial<ReturnType<typeof createTabSwitchStyles>>;
25
+ onChange: (value: T) => void;
26
+ }
27
+ //#endregion
28
+ //#region src/components/toolkit/TabSwitch/index.d.ts
29
+ declare const TabSwitch: <T>(props: TabSwitchProps<T>) => react_jsx_runtime0.JSX.Element;
30
+ //#endregion
31
+ export { SwitchOption as n, TabSwitchProps as r, TabSwitch as t };
32
+ //# sourceMappingURL=index--nD5Wzza.d.ts.map
@@ -99,15 +99,15 @@ interface ThemeTokens {
99
99
  * Spacing scale (in px numbers, usually converted to `px` in styles).
100
100
  * Keeps spacing consistent across components.
101
101
  */
102
- spacing: Record<'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl', number>;
102
+ spacing: Record<'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl', number | string>;
103
103
  /**
104
104
  * Border radius scale (in px numbers).
105
105
  */
106
- borderRadius: Record<'none' | 'sm' | 'md' | 'lg' | 'full', number>;
106
+ borderRadius: Record<'none' | 'sm' | 'md' | 'lg' | 'full', number | string>;
107
107
  /**
108
108
  * Font size scale (in px numbers).
109
109
  */
110
- fontSize: Record<'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl', number>;
110
+ fontSize: Record<'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl', number | string>;
111
111
  /**
112
112
  * Font weight scale (numeric values).
113
113
  */
@@ -274,4 +274,4 @@ declare const ThemeProvider: React.FC<ThemeProviderProps>;
274
274
  declare function useTheme(): ThemeContextData;
275
275
  //#endregion
276
276
  export { ThemeName as a, ThemeRegistry as c, ThemeMode as i, ThemeTokens as l, useTheme as n, ThemePersistence as o, ThemeContextData as r, ThemeProviderProps as s, ThemeProvider as t };
277
- //# sourceMappingURL=index-jFi4YRO5.d.ts.map
277
+ //# sourceMappingURL=index-B0CCFNqx.d.ts.map
@@ -0,0 +1,27 @@
1
+ import { r as TextProps, t as StyleMap } from "./useThemedStyles-DyrejrCM.js";
2
+ import { ElementType, ReactNode } from "react";
3
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
4
+
5
+ //#region src/components/toolkit/Typography/style.d.ts
6
+ declare function createTypographyStyles(props: TypographyProps): StyleMap;
7
+ //#endregion
8
+ //#region src/components/toolkit/Typography/types.d.ts
9
+ interface TypographyProps extends TextProps {
10
+ variant: TypographyVariant;
11
+ id?: string;
12
+ href?: string;
13
+ as?: ElementType;
14
+ children: ReactNode;
15
+ align?: TextAlign;
16
+ isLoading?: boolean;
17
+ placeholder?: string;
18
+ styles?: Partial<ReturnType<typeof createTypographyStyles>>;
19
+ }
20
+ type TextAlign = 'left' | 'center' | 'right' | 'justify';
21
+ type TypographyVariant = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'b1' | 'b2' | 'b3' | 'caption' | 'legal';
22
+ //#endregion
23
+ //#region src/components/toolkit/Typography/index.d.ts
24
+ declare function Typography(props: TypographyProps): react_jsx_runtime0.JSX.Element;
25
+ //#endregion
26
+ export { Typography as t };
27
+ //# sourceMappingURL=index-C_T04IuG.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
- import { n as SwitchOption, r as TabSwitchProps, t as TabSwitch } from "./index-CZOu4S--.js";
2
- import { a as ThemeName, c as ThemeRegistry, i as ThemeMode, l as ThemeTokens, n as useTheme, o as ThemePersistence, r as ThemeContextData, s as ThemeProviderProps, t as ThemeProvider } from "./index-jFi4YRO5.js";
3
- export { SwitchOption, TabSwitch, TabSwitchProps, ThemeContextData, ThemeMode, ThemeName, ThemePersistence, ThemeProvider, ThemeProviderProps, ThemeRegistry, ThemeTokens, useTheme };
1
+ import { n as SwitchOption, r as TabSwitchProps, t as TabSwitch } from "./index--nD5Wzza.js";
2
+ import { t as Typography } from "./index-C_T04IuG.js";
3
+ import { a as ThemeName, c as ThemeRegistry, i as ThemeMode, l as ThemeTokens, n as useTheme, o as ThemePersistence, r as ThemeContextData, s as ThemeProviderProps, t as ThemeProvider } from "./index-B0CCFNqx.js";
4
+ export { SwitchOption, TabSwitch, TabSwitchProps, ThemeContextData, ThemeMode, ThemeName, ThemePersistence, ThemeProvider, ThemeProviderProps, ThemeRegistry, ThemeTokens, Typography, useTheme };