@aurora-ds/theme 3.3.0 → 3.4.0-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +100 -6
- package/dist/index.d.ts +100 -6
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -131,6 +131,27 @@ type FontFaceOptions = {
|
|
|
131
131
|
unicodeRange?: string;
|
|
132
132
|
};
|
|
133
133
|
|
|
134
|
+
/**
|
|
135
|
+
* Options for {@link createStyles}.
|
|
136
|
+
*/
|
|
137
|
+
type CreateStylesOptions = {
|
|
138
|
+
/**
|
|
139
|
+
* Explicit, stable module id used to namespace generated class names.
|
|
140
|
+
*
|
|
141
|
+
* **Strongly recommended in production** to avoid relying on
|
|
142
|
+
* `Error().stack` parsing, which is fragile across engines and
|
|
143
|
+
* unreliable after minification. When provided, this id is used as-is
|
|
144
|
+
* (after kebab-casing) and guarantees deterministic class names across
|
|
145
|
+
* builds, SSR ↔ CSR boundaries and HMR cycles.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```ts
|
|
149
|
+
* // Button.styles.ts
|
|
150
|
+
* export const styles = createStyles((theme) => ({ ... }), { id: 'button' })
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
id?: string;
|
|
154
|
+
};
|
|
134
155
|
/**
|
|
135
156
|
* Creates styles with theme support. Type is inferred from ThemeRegistry.
|
|
136
157
|
* Supports pseudo-classes, media queries, and complex selectors.
|
|
@@ -139,6 +160,8 @@ type FontFaceOptions = {
|
|
|
139
160
|
* Theme values are automatically updated when ThemeProvider's theme changes.
|
|
140
161
|
*
|
|
141
162
|
* @param stylesOrCreator - Static styles object or function that receives theme
|
|
163
|
+
* @param options - Optional configuration. Pass `{ id }` to opt-out of stack-trace based
|
|
164
|
+
* module identification (recommended for production / SSR setups).
|
|
142
165
|
*
|
|
143
166
|
* @example
|
|
144
167
|
* ```tsx
|
|
@@ -149,13 +172,11 @@ type FontFaceOptions = {
|
|
|
149
172
|
* }
|
|
150
173
|
* }))
|
|
151
174
|
*
|
|
152
|
-
* //
|
|
153
|
-
*
|
|
154
|
-
* return <div className={styles.root}>Hello</div>
|
|
155
|
-
* }
|
|
175
|
+
* // Or with an explicit id (recommended in production):
|
|
176
|
+
* const styles = createStyles((theme) => ({ ... }), { id: 'my-component' })
|
|
156
177
|
* ```
|
|
157
178
|
*/
|
|
158
|
-
declare const createStyles: <T extends Record<string, StyleWithPseudos | StyleFunction> = Record<string, StyleWithPseudos | StyleFunction>>(stylesOrCreator: T | ((theme: _InternalTheme) => T)) => { [K in keyof T]: T[K] extends (...args: infer TArgs) => StyleWithPseudos ? (...args: TArgs) => string : string; };
|
|
179
|
+
declare const createStyles: <T extends Record<string, StyleWithPseudos | StyleFunction> = Record<string, StyleWithPseudos | StyleFunction>>(stylesOrCreator: T | ((theme: _InternalTheme) => T), options?: CreateStylesOptions) => { [K in keyof T]: T[K] extends (...args: infer TArgs) => StyleWithPseudos ? (...args: TArgs) => string : string; };
|
|
159
180
|
|
|
160
181
|
/** Creates and injects a @keyframes rule, returns the animation name */
|
|
161
182
|
declare const keyframes: (frames: Record<string, CSSProperties>) => string;
|
|
@@ -173,6 +194,79 @@ declare const cssVariables: <T extends Record<string, string | number>>(variable
|
|
|
173
194
|
inject?: boolean;
|
|
174
195
|
}) => { [K in keyof T]: string; };
|
|
175
196
|
|
|
197
|
+
/**
|
|
198
|
+
* A block accepted by {@link globalStyles}. Same shape as
|
|
199
|
+
* {@link StyleWithPseudos} but additionally allows arbitrary string keys
|
|
200
|
+
* so that nested at-rules (e.g. `@media`) can declare their own child
|
|
201
|
+
* selectors (`body`, `*`, `.foo`, …).
|
|
202
|
+
*/
|
|
203
|
+
type GlobalStyleBlock = StyleWithPseudos & {
|
|
204
|
+
[selector: string]: unknown;
|
|
205
|
+
};
|
|
206
|
+
/**
|
|
207
|
+
* Injects global, top-level CSS rules. Each key is a CSS selector
|
|
208
|
+
* (`body`, `*`, `:root`, `.foo > .bar`, `@media (...)`, etc.) and each
|
|
209
|
+
* value supports the same nested-pseudo / `&` / at-rule syntax as
|
|
210
|
+
* {@link createStyles}.
|
|
211
|
+
*
|
|
212
|
+
* Rules are written into the shared global Aurora stylesheet and persist
|
|
213
|
+
* for the lifetime of the document. Calling `globalStyles` multiple times
|
|
214
|
+
* appends new rules — it is the caller's responsibility to call it once
|
|
215
|
+
* (typically at app bootstrap) per logical block.
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```ts
|
|
219
|
+
* globalStyles({
|
|
220
|
+
* 'html, body': {
|
|
221
|
+
* margin: 0,
|
|
222
|
+
* padding: 0,
|
|
223
|
+
* fontFamily: 'system-ui, sans-serif',
|
|
224
|
+
* },
|
|
225
|
+
* 'a': {
|
|
226
|
+
* color: 'inherit',
|
|
227
|
+
* ':hover': { textDecoration: 'underline' },
|
|
228
|
+
* },
|
|
229
|
+
* '@media (prefers-reduced-motion: reduce)': {
|
|
230
|
+
* '*': { animation: 'none', transition: 'none' },
|
|
231
|
+
* },
|
|
232
|
+
* })
|
|
233
|
+
* ```
|
|
234
|
+
*/
|
|
235
|
+
declare const globalStyles: (rules: Record<string, GlobalStyleBlock>) => void;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Accepted argument types for {@link cx}.
|
|
239
|
+
*
|
|
240
|
+
* - Strings are kept (when truthy).
|
|
241
|
+
* - `false`, `null`, `undefined` and empty strings are skipped, allowing
|
|
242
|
+
* conditional patterns like `cx(styles.base, isActive && styles.active)`.
|
|
243
|
+
*/
|
|
244
|
+
type CxArg = string | false | null | undefined;
|
|
245
|
+
/**
|
|
246
|
+
* Conditionally joins class names into a single space-separated string.
|
|
247
|
+
*
|
|
248
|
+
* Lightweight, dependency-free alternative to `clsx` / `classnames` tailored
|
|
249
|
+
* for usage with {@link createStyles}. Falsy values are filtered out so you
|
|
250
|
+
* can compose variants inline.
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* ```tsx
|
|
254
|
+
* import { cx } from '@aurora-ds/theme'
|
|
255
|
+
*
|
|
256
|
+
* <button
|
|
257
|
+
* className={cx(
|
|
258
|
+
* styles.base,
|
|
259
|
+
* styles[size],
|
|
260
|
+
* styles[variant],
|
|
261
|
+
* fullWidth && styles.fullWidth,
|
|
262
|
+
* loading && styles.loading,
|
|
263
|
+
* className,
|
|
264
|
+
* )}
|
|
265
|
+
* />
|
|
266
|
+
* ```
|
|
267
|
+
*/
|
|
268
|
+
declare const cx: (...args: CxArg[]) => string;
|
|
269
|
+
|
|
176
270
|
/** SSR: Returns all collected CSS rules as a single string */
|
|
177
271
|
declare const getSSRStyles: () => string;
|
|
178
272
|
/** SSR: Returns styles wrapped in a style tag */
|
|
@@ -182,4 +276,4 @@ declare const clearSSRRules: () => void;
|
|
|
182
276
|
/** SSR: Returns raw CSS rules as an array */
|
|
183
277
|
declare const getSSRRulesArray: () => string[];
|
|
184
278
|
|
|
185
|
-
export { type FontFaceOptions, type StyleWithPseudos, ThemeProvider, type ThemeRegistry, clearSSRRules, colors, createStyles, createTheme, cssVar, cssVariables, fontFace, getSSRRulesArray, getSSRStyleTag, getSSRStyles, injectCssVariables, keyframes, useTheme };
|
|
279
|
+
export { type CreateStylesOptions, type CxArg, type FontFaceOptions, type GlobalStyleBlock, type StyleWithPseudos, ThemeProvider, type ThemeRegistry, clearSSRRules, colors, createStyles, createTheme, cssVar, cssVariables, cx, fontFace, getSSRRulesArray, getSSRStyleTag, getSSRStyles, globalStyles, injectCssVariables, keyframes, useTheme };
|
package/dist/index.d.ts
CHANGED
|
@@ -131,6 +131,27 @@ type FontFaceOptions = {
|
|
|
131
131
|
unicodeRange?: string;
|
|
132
132
|
};
|
|
133
133
|
|
|
134
|
+
/**
|
|
135
|
+
* Options for {@link createStyles}.
|
|
136
|
+
*/
|
|
137
|
+
type CreateStylesOptions = {
|
|
138
|
+
/**
|
|
139
|
+
* Explicit, stable module id used to namespace generated class names.
|
|
140
|
+
*
|
|
141
|
+
* **Strongly recommended in production** to avoid relying on
|
|
142
|
+
* `Error().stack` parsing, which is fragile across engines and
|
|
143
|
+
* unreliable after minification. When provided, this id is used as-is
|
|
144
|
+
* (after kebab-casing) and guarantees deterministic class names across
|
|
145
|
+
* builds, SSR ↔ CSR boundaries and HMR cycles.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```ts
|
|
149
|
+
* // Button.styles.ts
|
|
150
|
+
* export const styles = createStyles((theme) => ({ ... }), { id: 'button' })
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
id?: string;
|
|
154
|
+
};
|
|
134
155
|
/**
|
|
135
156
|
* Creates styles with theme support. Type is inferred from ThemeRegistry.
|
|
136
157
|
* Supports pseudo-classes, media queries, and complex selectors.
|
|
@@ -139,6 +160,8 @@ type FontFaceOptions = {
|
|
|
139
160
|
* Theme values are automatically updated when ThemeProvider's theme changes.
|
|
140
161
|
*
|
|
141
162
|
* @param stylesOrCreator - Static styles object or function that receives theme
|
|
163
|
+
* @param options - Optional configuration. Pass `{ id }` to opt-out of stack-trace based
|
|
164
|
+
* module identification (recommended for production / SSR setups).
|
|
142
165
|
*
|
|
143
166
|
* @example
|
|
144
167
|
* ```tsx
|
|
@@ -149,13 +172,11 @@ type FontFaceOptions = {
|
|
|
149
172
|
* }
|
|
150
173
|
* }))
|
|
151
174
|
*
|
|
152
|
-
* //
|
|
153
|
-
*
|
|
154
|
-
* return <div className={styles.root}>Hello</div>
|
|
155
|
-
* }
|
|
175
|
+
* // Or with an explicit id (recommended in production):
|
|
176
|
+
* const styles = createStyles((theme) => ({ ... }), { id: 'my-component' })
|
|
156
177
|
* ```
|
|
157
178
|
*/
|
|
158
|
-
declare const createStyles: <T extends Record<string, StyleWithPseudos | StyleFunction> = Record<string, StyleWithPseudos | StyleFunction>>(stylesOrCreator: T | ((theme: _InternalTheme) => T)) => { [K in keyof T]: T[K] extends (...args: infer TArgs) => StyleWithPseudos ? (...args: TArgs) => string : string; };
|
|
179
|
+
declare const createStyles: <T extends Record<string, StyleWithPseudos | StyleFunction> = Record<string, StyleWithPseudos | StyleFunction>>(stylesOrCreator: T | ((theme: _InternalTheme) => T), options?: CreateStylesOptions) => { [K in keyof T]: T[K] extends (...args: infer TArgs) => StyleWithPseudos ? (...args: TArgs) => string : string; };
|
|
159
180
|
|
|
160
181
|
/** Creates and injects a @keyframes rule, returns the animation name */
|
|
161
182
|
declare const keyframes: (frames: Record<string, CSSProperties>) => string;
|
|
@@ -173,6 +194,79 @@ declare const cssVariables: <T extends Record<string, string | number>>(variable
|
|
|
173
194
|
inject?: boolean;
|
|
174
195
|
}) => { [K in keyof T]: string; };
|
|
175
196
|
|
|
197
|
+
/**
|
|
198
|
+
* A block accepted by {@link globalStyles}. Same shape as
|
|
199
|
+
* {@link StyleWithPseudos} but additionally allows arbitrary string keys
|
|
200
|
+
* so that nested at-rules (e.g. `@media`) can declare their own child
|
|
201
|
+
* selectors (`body`, `*`, `.foo`, …).
|
|
202
|
+
*/
|
|
203
|
+
type GlobalStyleBlock = StyleWithPseudos & {
|
|
204
|
+
[selector: string]: unknown;
|
|
205
|
+
};
|
|
206
|
+
/**
|
|
207
|
+
* Injects global, top-level CSS rules. Each key is a CSS selector
|
|
208
|
+
* (`body`, `*`, `:root`, `.foo > .bar`, `@media (...)`, etc.) and each
|
|
209
|
+
* value supports the same nested-pseudo / `&` / at-rule syntax as
|
|
210
|
+
* {@link createStyles}.
|
|
211
|
+
*
|
|
212
|
+
* Rules are written into the shared global Aurora stylesheet and persist
|
|
213
|
+
* for the lifetime of the document. Calling `globalStyles` multiple times
|
|
214
|
+
* appends new rules — it is the caller's responsibility to call it once
|
|
215
|
+
* (typically at app bootstrap) per logical block.
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```ts
|
|
219
|
+
* globalStyles({
|
|
220
|
+
* 'html, body': {
|
|
221
|
+
* margin: 0,
|
|
222
|
+
* padding: 0,
|
|
223
|
+
* fontFamily: 'system-ui, sans-serif',
|
|
224
|
+
* },
|
|
225
|
+
* 'a': {
|
|
226
|
+
* color: 'inherit',
|
|
227
|
+
* ':hover': { textDecoration: 'underline' },
|
|
228
|
+
* },
|
|
229
|
+
* '@media (prefers-reduced-motion: reduce)': {
|
|
230
|
+
* '*': { animation: 'none', transition: 'none' },
|
|
231
|
+
* },
|
|
232
|
+
* })
|
|
233
|
+
* ```
|
|
234
|
+
*/
|
|
235
|
+
declare const globalStyles: (rules: Record<string, GlobalStyleBlock>) => void;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Accepted argument types for {@link cx}.
|
|
239
|
+
*
|
|
240
|
+
* - Strings are kept (when truthy).
|
|
241
|
+
* - `false`, `null`, `undefined` and empty strings are skipped, allowing
|
|
242
|
+
* conditional patterns like `cx(styles.base, isActive && styles.active)`.
|
|
243
|
+
*/
|
|
244
|
+
type CxArg = string | false | null | undefined;
|
|
245
|
+
/**
|
|
246
|
+
* Conditionally joins class names into a single space-separated string.
|
|
247
|
+
*
|
|
248
|
+
* Lightweight, dependency-free alternative to `clsx` / `classnames` tailored
|
|
249
|
+
* for usage with {@link createStyles}. Falsy values are filtered out so you
|
|
250
|
+
* can compose variants inline.
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* ```tsx
|
|
254
|
+
* import { cx } from '@aurora-ds/theme'
|
|
255
|
+
*
|
|
256
|
+
* <button
|
|
257
|
+
* className={cx(
|
|
258
|
+
* styles.base,
|
|
259
|
+
* styles[size],
|
|
260
|
+
* styles[variant],
|
|
261
|
+
* fullWidth && styles.fullWidth,
|
|
262
|
+
* loading && styles.loading,
|
|
263
|
+
* className,
|
|
264
|
+
* )}
|
|
265
|
+
* />
|
|
266
|
+
* ```
|
|
267
|
+
*/
|
|
268
|
+
declare const cx: (...args: CxArg[]) => string;
|
|
269
|
+
|
|
176
270
|
/** SSR: Returns all collected CSS rules as a single string */
|
|
177
271
|
declare const getSSRStyles: () => string;
|
|
178
272
|
/** SSR: Returns styles wrapped in a style tag */
|
|
@@ -182,4 +276,4 @@ declare const clearSSRRules: () => void;
|
|
|
182
276
|
/** SSR: Returns raw CSS rules as an array */
|
|
183
277
|
declare const getSSRRulesArray: () => string[];
|
|
184
278
|
|
|
185
|
-
export { type FontFaceOptions, type StyleWithPseudos, ThemeProvider, type ThemeRegistry, clearSSRRules, colors, createStyles, createTheme, cssVar, cssVariables, fontFace, getSSRRulesArray, getSSRStyleTag, getSSRStyles, injectCssVariables, keyframes, useTheme };
|
|
279
|
+
export { type CreateStylesOptions, type CxArg, type FontFaceOptions, type GlobalStyleBlock, type StyleWithPseudos, ThemeProvider, type ThemeRegistry, clearSSRRules, colors, createStyles, createTheme, cssVar, cssVariables, cx, fontFace, getSSRRulesArray, getSSRStyleTag, getSSRStyles, globalStyles, injectCssVariables, keyframes, useTheme };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {createContext,useRef,useMemo,useLayoutEffect,useContext}from'react';import {jsx}from'react/jsx-runtime';var L=e=>e;var N={25:"#fffdfb",50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"};var j={25:"#f5f8ff",50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"};var V={25:"#f3fefe",50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"};var W={25:"#f5fefc",50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"};var z={25:"#fef5ff",50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75",950:"#4a044e"};var O={25:"#fcfcfc",50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"};var D={25:"#f6fef9",50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"};var B={25:"#f5f7ff",50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"};var H={25:"#fbfef8",50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314",950:"#1a2e05"};var Z={25:"#fffcfa",50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"};var G={25:"#fef5f9",50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"};var J={25:"#faf5ff",50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87",950:"#3b0764"};var U={25:"#fffbfb",50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"};var Y={25:"#fff5f6",50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"};var q={25:"#fcfcfd",50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"};var X={25:"#fcfcfb",50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"};var Q={25:"#f4fefe",50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"};var ee={25:"#f8f5ff",50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"};var te={25:"#fefef9",50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"};var _e={gray:O,slate:q,stone:X,red:U,orange:Z,amber:N,yellow:te,lime:H,green:D,emerald:W,teal:Q,cyan:V,blue:j,indigo:B,violet:ee,purple:J,fuchsia:z,pink:G,rose:Y,white:"#ffffff",black:"#000000",transparent:"transparent",current:"currentColor"};var h=typeof document>"u",re=null,g=null,$=[],oe=new Map([["backgroundColor","background-color"],["borderRadius","border-radius"],["fontSize","font-size"],["fontWeight","font-weight"],["lineHeight","line-height"],["marginTop","margin-top"],["marginBottom","margin-bottom"],["marginLeft","margin-left"],["marginRight","margin-right"],["paddingTop","padding-top"],["paddingBottom","padding-bottom"],["paddingLeft","padding-left"],["paddingRight","padding-right"],["textAlign","text-align"],["justifyContent","justify-content"],["alignItems","align-items"],["flexDirection","flex-direction"],["flexWrap","flex-wrap"],["boxShadow","box-shadow"],["zIndex","z-index"]]),w=new Set,I=new Set,C=new Map,x=new Map,c=null,ke=new Set(["animationIterationCount","columnCount","fillOpacity","flexGrow","flexShrink","fontWeight","lineHeight","opacity","order","orphans","widows","zIndex","zoom"]),T=new Map,R=new Map;if(!h){let e=document.getElementById("aurora-styles");if(e)g=e.sheet;else {let t=document.createElement("style");t.id="aurora-styles",document.head.appendChild(t),g=t.sheet;}}var k=e=>{let t=re;return re=e,t};var u=e=>{if(h)$.push(e);else if(g)try{g.insertRule(e,g.cssRules.length);}catch{}},fe=e=>{if(h)return null;let t=T.get(e);if(t){let o=t.cssRules.length;for(let f=o-1;f>=0;f--)t.deleteRule(f);R.delete(e);let s=C.get(e);s&&(s.forEach(f=>w.delete(f)),s.clear());let a=x.get(e);return a&&(a.forEach(f=>I.delete(f)),a.clear()),t}let r=document.createElement("style");r.id=`aurora-mod-${e}`,r.setAttribute("data-aurora-module",e),document.head.appendChild(r);let n=r.sheet;return T.set(e,n),n},p=(e,t)=>{if(h)$.push(t);else if(e)try{e.insertRule(t,e.cssRules.length);}catch{}},ne=/&/g,A=(e,t,r)=>{let n="",o=`.${t}`;for(let s in e){let a=e[s],f=s.charCodeAt(0);if(f===64){let i=S(a);i&&p(r,`${s}{${o}{${i}}}`);}else if(f===38){let i=S(a);i&&(ne.lastIndex=0,p(r,`${s.replace(ne,o)}{${i}}`));}else if(f===58){let i=S(a);i&&p(r,`${o}${s}{${i}}`);}else a!=null&&typeof a!="object"&&(n+=`${l(s)}:${ie(s,a)};`);}return n&&p(r,`${o}{${n}}`),t},Ae=500,ae=(e,t)=>{let r=R.get(e);return r||(r=new Set,R.set(e,r)),r.has(t)?true:(r.size>=Ae||r.add(t),false)},l=e=>{let t=oe.get(e);return t||(t=e.replace(/([A-Z])/g,"-$1").toLowerCase(),oe.set(e,t)),t},se=new Map,v=e=>{let t=se.get(e);return t||(t=e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase(),se.set(e,t)),t},Fe=/expression\s*\(|javascript\s*:|data\s*:\s*text\/html|behavior\s*:|@import|<\s*\/?\s*style/i,Pe=e=>{let t=e.replace(/\0/g,"");return Fe.test(t)?"unset":t},ie=(e,t)=>{if(typeof t=="number")return ke.has(e)?String(t):`${t}px`;let r=String(t);return r.charCodeAt(0)===118&&r.startsWith("var(--")?r:Pe(r)},S=e=>{let t="";for(let r in e){let n=e[r];n!=null&&typeof n!="object"&&(t+=`${l(r)}:${ie(r,n)};`);}return t};var ce=e=>{let t=e.length;if(t===0)return "";if(t===1){let r=e[0];if(r===void 0)return "u";if(r===null)return "n";if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")return String(r)}if(t<=4){let r="";for(let n=0;n<t;n++){let o=e[n],s=typeof o;if(o===void 0)r+=n?"|u":"u";else if(o===null)r+=n?"|n":"n";else if(s==="string"||s==="number"||s==="boolean")r+=n?"|"+o:String(o);else return JSON.stringify(e)}return r}return JSON.stringify(e)},le=e=>{let t=e.charCodeAt(0);if(e.length<20){if(t>=97&&t<=122||t>=65&&t<=90){let r=true;for(let n=1;n<e.length;n++){let o=e.charCodeAt(n);if(!(o>=97&&o<=122||o>=65&&o<=90||o>=48&&o<=57)){r=false;break}}if(r)return v(e)}else if(t===45||t>=48&&t<=57){let r=true;for(let n=1;n<e.length;n++)if(e.charCodeAt(n)<48||e.charCodeAt(n)>57){r=false;break}if(r)return e}}return E(e)},E=e=>{let t=5381,r=e.length;for(let n=0;n<r;n++)t=(t<<5)+t^e.charCodeAt(n);return (t>>>0).toString(36)},F=(e,t=null)=>{c=e?{name:e,sheet:t}:null;},de=e=>w.has(e),ue=e=>{if(w.add(e),c){let t=C.get(c.name);t||(t=new Set,C.set(c.name,t)),t.add(e);}},me=e=>`aurora-kf-${E(e)}`,pe=e=>{c?.sheet?p(c.sheet,e):u(e);},ge=e=>I.has(e),Se=e=>{if(I.add(e),c){let t=x.get(c.name);t||(t=new Set,x.set(c.name,t)),t.add(e);}},he=e=>{c?.sheet?p(c.sheet,e):u(e);},P=()=>$,ye=()=>{$=[],w.clear(),I.clear(),C.clear(),x.clear(),c=null,h||T.forEach((e,t)=>{let r=document.getElementById(`aurora-mod-${t}`);r&&r.remove();}),T.clear(),R.clear();};var K=typeof document>"u",Ce="aurora-theme-variables",xe="aurora-theme-transition",y="aurora-disable-transitions",b="aurora-force-transitions",Te=false,je=()=>{Te||K||(u(`.${y} *,.${y} *::before,.${y} *::after{transition:none!important}`),Te=true);},Ve=e=>{if(K)return;let t=document.getElementById(xe);t||(t=document.createElement("style"),t.id=xe,document.head.appendChild(t)),t.textContent=`.${b} *,.${b} *::before,.${b} *::after{transition:color ${e}ms,background-color ${e}ms,border-color ${e}ms,fill ${e}ms,stroke ${e}ms!important}`;},Re=createContext(void 0),$e=(e,t="theme")=>{let r="";for(let n in e){let o=e[n],s=`${t}-${l(n)}`;o&&typeof o=="object"&&!Array.isArray(o)?r+=$e(o,s):o!=null&&(r+=`--${s}:${o};`);}return r},We=({theme:e,disableTransitionsOnChange:t=true,transitionDuration:r,children:n})=>{let o=k(()=>e),s=useRef(true),a=useMemo(()=>$e(e),[e]);return useLayoutEffect(()=>{if(K)return;let f=!s.current,i=r!==void 0&&r>0,m=t&&!i&&f;m&&(je(),document.documentElement.classList.add(y)),i&&f&&(Ve(r),document.documentElement.classList.add(b));let d=document.getElementById(Ce);if(d||(d=document.createElement("style"),d.id=Ce,document.head.appendChild(d)),d.textContent=`:root{${a}}`,m&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{document.documentElement.classList.remove(y);});}),i&&f){let Ee=setTimeout(()=>{document.documentElement.classList.remove(b);},r);return s.current=false,()=>{clearTimeout(Ee);}}s.current=false;},[a,t,r]),useLayoutEffect(()=>()=>{k(o);},[o]),jsx(Re.Provider,{value:e,children:n})},ze=()=>{let e=useContext(Re);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e};var M=new Map,De=0,Be=()=>{let e=new Error().stack||"",t=e.match(/([A-Za-z0-9_]+)\.styles\.[tj]s/);if(!t?.[1])return `s${(De++).toString(36)}`;let r=v(t[1]),o=e.match(/(?:at\s+.*?\(|at\s+)((?:[A-Za-z]:)?[^\s)]+\.styles\.[tj]s)/)?.[1]||"",s=M.get(r);if(s===o)return r;if(!s)return M.set(r,o),r;let a=`${r}-${E(o)}`;return M.set(a,o),a},_=null,He=()=>{if(_)return _;let e=t=>{let r=()=>`var(--theme-${t})`;return new Proxy(r,{get(n,o){if(o===Symbol.toPrimitive)return r;if(typeof o!="string")return;if(o==="toString"||o==="valueOf")return r;let s=l(o),a=t?`${t}-${s}`:s;return e(a)},apply(){return r()}})};return _=e(""),_},we=(e,t,r)=>{let n={};for(let o in e){let s=e[o];if(s){let a=`${t}-${v(o)}`;typeof s=="function"?n[o]=(...f)=>{let i=ce(f),m=`${a}-${le(i)}`;if(!ae(t,m)){let d=s(...f);A(d,m,r);}return m}:(A(s,a,r),n[o]=a);}}return n},Ze=e=>{let t=Be(),r=fe(t);F(t,r);try{if(typeof e=="function"){let n=He(),o=e(n);return we(o,t,r)}return we(e,t,r)}finally{F(null);}};var Ge=e=>{let t="";for(let n in e)t+=`${n}{${S(e[n])}}`;let r=me(t);return de(t)||(pe(`@keyframes ${r}{${t}}`),ue(t)),r};var Je=e=>{let{fontFamily:t,src:r,fontStyle:n="normal",fontWeight:o=400,fontDisplay:s="swap",unicodeRange:a}=e,f=`font-family:"${t}";`;return f+=`src:${r};`,f+=`font-style:${n};`,f+=`font-weight:${o};`,f+=`font-display:${s};`,a&&(f+=`unicode-range:${a};`),ge(f)||(he(`@font-face{${f}}`),Se(f)),t};var Ie=(e,t)=>{let r="";for(let n in e){let o=e[n],s=l(n);o&&typeof o=="object"?r+=Ie(o,`${t}-${s}`):o!=null&&(r+=`--${t}-${s}:${o};`);}return r},Ue=(e,t="theme")=>{let r=Ie(e,t);u(`:root{${r}}`);},Ye=(e,t)=>{let r=`--theme-${e.replace(/\./g,"-")}`;return t?`var(${r}, ${t})`:`var(${r})`},qe=(e,t={})=>{let{prefix:r="",inject:n=false}=t,o={},s="";for(let a in e){let f=l(a),i=r?`--${r}-${f}`:`--${f}`;o[a]=`var(${i})`,n&&(s+=`${i}:${e[a]};`);}return n&&s&&u(`:root{${s}}`),o};var ve=()=>P().join(""),Xe=()=>{let e=ve();return e?`<style id="aurora-styles">${e}</style>`:""},Qe=()=>{ye();},et=()=>[...P()];export{We as ThemeProvider,Qe as clearSSRRules,_e as colors,Ze as createStyles,L as createTheme,Ye as cssVar,qe as cssVariables,Je as fontFace,et as getSSRRulesArray,Xe as getSSRStyleTag,ve as getSSRStyles,Ue as injectCssVariables,Ge as keyframes,ze as useTheme};//# sourceMappingURL=index.js.map
|
|
1
|
+
import*as Ee from'react';import {createContext,useRef,useMemo,useLayoutEffect,useContext}from'react';import {jsx}from'react/jsx-runtime';var W=e=>e;var O={25:"#fffdfb",50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"};var D={25:"#f5f8ff",50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"};var z={25:"#f3fefe",50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"};var B={25:"#f5fefc",50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"};var G={25:"#fef5ff",50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75",950:"#4a044e"};var H={25:"#fcfcfc",50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"};var Z={25:"#f6fef9",50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"};var J={25:"#f5f7ff",50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"};var Y={25:"#fbfef8",50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314",950:"#1a2e05"};var U={25:"#fffcfa",50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"};var q={25:"#fef5f9",50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"};var X={25:"#faf5ff",50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87",950:"#3b0764"};var Q={25:"#fffbfb",50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"};var ee={25:"#fff5f6",50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"};var te={25:"#fcfcfd",50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"};var re={25:"#fcfcfb",50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"};var ne={25:"#f4fefe",50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"};var oe={25:"#f8f5ff",50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"};var se={25:"#fefef9",50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"};var Le={gray:H,slate:te,stone:re,red:Q,orange:U,amber:O,yellow:se,lime:Y,green:Z,emerald:B,teal:ne,cyan:z,blue:D,indigo:J,violet:oe,purple:X,fuchsia:G,pink:q,rose:ee,white:"#ffffff",black:"#000000",transparent:"transparent",current:"currentColor"};var y=typeof document>"u",Ne=typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production",le=(e,...t)=>{Ne&&console.warn(`[aurora-ds] ${e}`,...t);},ie=null,S=null,E=[],fe=new Map([["backgroundColor","background-color"],["borderRadius","border-radius"],["fontSize","font-size"],["fontWeight","font-weight"],["lineHeight","line-height"],["marginTop","margin-top"],["marginBottom","margin-bottom"],["marginLeft","margin-left"],["marginRight","margin-right"],["paddingTop","padding-top"],["paddingBottom","padding-bottom"],["paddingLeft","padding-left"],["paddingRight","padding-right"],["textAlign","text-align"],["justifyContent","justify-content"],["alignItems","align-items"],["flexDirection","flex-direction"],["flexWrap","flex-wrap"],["boxShadow","box-shadow"],["zIndex","z-index"]]),I=new Set,A=new Set,R=new Map,$=new Map,c=null,Ve=new Set(["animationIterationCount","columnCount","fillOpacity","flexGrow","flexShrink","fontWeight","lineHeight","opacity","order","orphans","widows","zIndex","zoom"]),T=new Map,w=new Map;if(!y){let e=document.getElementById("aurora-styles");if(e)S=e.sheet;else {let t=document.createElement("style");t.id="aurora-styles",document.head.appendChild(t),S=t.sheet;}}var K=e=>{let t=ie;return ie=e,t};var u=e=>{if(y)E.push(e);else if(S)try{S.insertRule(e,S.cssRules.length);}catch(t){le("Failed to insert CSS rule:",e,t);}},ue=e=>{if(y)return null;let t=T.get(e);if(t){let n=t.cssRules.length;for(let i=n-1;i>=0;i--)t.deleteRule(i);w.delete(e);let s=R.get(e);s&&(s.forEach(i=>I.delete(i)),s.clear());let f=$.get(e);return f&&(f.forEach(i=>A.delete(i)),f.clear()),t}let r=document.createElement("style");r.id=`aurora-mod-${e}`,r.setAttribute("data-aurora-module",e),document.head.appendChild(r);let o=r.sheet;return T.set(e,o),o},p=(e,t)=>{if(y)E.push(t);else if(e)try{e.insertRule(t,e.cssRules.length);}catch(r){le("Failed to insert module CSS rule:",t,r);}},ae=/&/g,M=(e,t,r)=>{let o="",n=`.${t}`;for(let s in e){let f=e[s],i=s.charCodeAt(0);if(i===64){let a=d(f);a&&p(r,`${s}{${n}{${a}}}`);}else if(i===38){let a=d(f);a&&(ae.lastIndex=0,p(r,`${s.replace(ae,n)}{${a}}`));}else if(i===58){let a=d(f);a&&p(r,`${n}${s}{${a}}`);}else f!=null&&typeof f!="object"&&(o+=`${l(s)}:${_(s,f)};`);}return o&&p(r,`${n}{${o}}`),t},We=500,de=(e,t)=>{let r=w.get(e);return r||(r=new Set,w.set(e,r)),r.has(t)?true:(r.size>=We||r.add(t),false)},l=e=>{let t=fe.get(e);return t||(t=e.replace(/([A-Z])/g,"-$1").toLowerCase(),fe.set(e,t)),t},ce=new Map,h=e=>{let t=ce.get(e);return t||(t=e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase(),ce.set(e,t)),t},Oe=/expression\s*\(|javascript\s*:|data\s*:\s*text\/html|behavior\s*:|@import|<\s*\/?\s*style/i,De=e=>{let t=e.replace(/\0/g,"");return Oe.test(t)?"unset":t},_=(e,t)=>{if(typeof t=="number")return Ve.has(e)?String(t):`${t}px`;let r=String(t);return r.charCodeAt(0)===118&&r.startsWith("var(--")?r:De(r)},d=e=>{let t="";for(let r in e){let o=e[r];o!=null&&typeof o!="object"&&(t+=`${l(r)}:${_(r,o)};`);}return t};var ze=4,k=(e,t=0)=>{if(e===null||typeof e!="object"||t>=ze)return JSON.stringify(e);if(Array.isArray(e))return "["+e.map(n=>k(n,t+1)).join(",")+"]";let r=Object.keys(e).sort(),o=[];for(let n of r){let s=e[n];s!==void 0&&o.push(JSON.stringify(n)+":"+k(s,t+1));}return "{"+o.join(",")+"}"},me=e=>{let t=e.length;if(t===0)return "";if(t===1){let r=e[0];if(r===void 0)return "u";if(r===null)return "n";if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")return String(r)}if(t<=4){let r="";for(let o=0;o<t;o++){let n=e[o],s=typeof n;if(n===void 0)r+=o?"|u":"u";else if(n===null)r+=o?"|n":"n";else if(s==="string"||s==="number"||s==="boolean")r+=o?"|"+n:String(n);else return k(e)}return r}return k(e)},pe=e=>{let t=e.charCodeAt(0);if(e.length<20){if(t>=97&&t<=122||t>=65&&t<=90){let r=true;for(let o=1;o<e.length;o++){let n=e.charCodeAt(o);if(!(n>=97&&n<=122||n>=65&&n<=90||n>=48&&n<=57)){r=false;break}}if(r)return h(e)}else if(t===45||t>=48&&t<=57){let r=true;for(let o=1;o<e.length;o++)if(e.charCodeAt(o)<48||e.charCodeAt(o)>57){r=false;break}if(r)return e}}return v(e)},v=e=>{let t=5381,r=e.length;for(let o=0;o<r;o++)t=(t<<5)+t^e.charCodeAt(o);return (t>>>0).toString(36)},j=(e,t=null)=>{c=e?{name:e,sheet:t}:null;},ge=e=>I.has(e),Se=e=>{if(I.add(e),c){let t=R.get(c.name);t||(t=new Set,R.set(c.name,t)),t.add(e);}},ye=e=>`aurora-kf-${v(e)}`,he=e=>{c?.sheet?p(c.sheet,e):u(e);},be=e=>A.has(e),Ce=e=>{if(A.add(e),c){let t=$.get(c.name);t||(t=new Set,$.set(c.name,t)),t.add(e);}},xe=e=>{c?.sheet?p(c.sheet,e):u(e);},L=()=>E,Re=()=>{E=[],I.clear(),A.clear(),R.clear(),$.clear(),c=null,y||T.forEach((e,t)=>{let r=document.getElementById(`aurora-mod-${t}`);r&&r.remove();}),T.clear(),w.clear();};var N=typeof document>"u",Te="aurora-theme-variables",we="aurora-theme-transition",b="aurora-disable-transitions",C="aurora-force-transitions",Ze=Ee.useInsertionEffect??useLayoutEffect,ke=false,Je=()=>{ke||N||(u(`.${b} *,.${b} *::before,.${b} *::after{transition:none!important}`),ke=true);},Ye=e=>{if(N)return;let t=document.getElementById(we);t||(t=document.createElement("style"),t.id=we,document.head.appendChild(t)),t.textContent=`.${C} *,.${C} *::before,.${C} *::after{transition:color ${e}ms,background-color ${e}ms,border-color ${e}ms,fill ${e}ms,stroke ${e}ms!important}`;},Ae=createContext(void 0),_e=(e,t="theme")=>{let r="";for(let o in e){let n=e[o],s=`${t}-${l(o)}`;n&&typeof n=="object"&&!Array.isArray(n)?r+=_e(n,s):n!=null&&(r+=`--${s}:${n};`);}return r},Ue=({theme:e,disableTransitionsOnChange:t=true,transitionDuration:r,children:o})=>{let n=K(()=>e),s=useRef(true),f=useRef(null),i=useMemo(()=>_e(e),[e]);return Ze(()=>{if(N)return;let a=!s.current,m=r!==void 0&&r>0,x=t&&!m&&a;x&&(Je(),document.documentElement.classList.add(b)),m&&a&&(Ye(r),document.documentElement.classList.add(C));let g=document.getElementById(Te);g||(g=document.createElement("style"),g.id=Te,document.head.appendChild(g));let P=`:root{${i}}`;if(f.current!==P&&(g.textContent=P,f.current=P),x&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{document.documentElement.classList.remove(b);});}),m&&a){let je=setTimeout(()=>{document.documentElement.classList.remove(C);},r);return s.current=false,()=>{clearTimeout(je);}}s.current=false;},[i,t,r]),useLayoutEffect(()=>()=>{K(n);},[n]),jsx(Ae.Provider,{value:e,children:o})},qe=()=>{let e=useContext(Ae);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e};var V=new Map,Qe=0,et=()=>{let e=new Error().stack||"",t=e.match(/([A-Za-z0-9_]+)\.styles\.[tj]s/);if(!t?.[1])return `s${(Qe++).toString(36)}`;let r=h(t[1]),n=e.match(/(?:at\s+.*?\(|at\s+)((?:[A-Za-z]:)?[^\s)]+\.styles\.[tj]s)/)?.[1]||"",s=V.get(r);if(s===n)return r;if(!s)return V.set(r,n),r;let f=`${r}-${v(n)}`;return V.set(f,n),f},F=null,tt=()=>{if(F)return F;let e=t=>{let r=()=>`var(--theme-${t})`;return new Proxy(r,{get(o,n){if(n===Symbol.toPrimitive)return r;if(typeof n!="string")return;if(n==="toString"||n==="valueOf")return r;let s=l(n),f=t?`${t}-${s}`:s;return e(f)},apply(){return r()}})};return F=e(""),F},ve=(e,t,r)=>{let o={};for(let n in e){let s=e[n];if(s){let f=`${t}-${h(n)}`;typeof s=="function"?o[n]=(...i)=>{let a=me(i),m=`${f}-${pe(a)}`;if(!de(t,m)){let x=s(...i);M(x,m,r);}return m}:(M(s,f,r),o[n]=f);}}return o},rt=(e,t)=>{let r=t?.id?h(t.id):et(),o=ue(r);j(r,o);try{if(typeof e=="function"){let n=tt(),s=e(n);return ve(s,r,o)}return ve(e,r,o)}finally{j(null);}};var nt=e=>{let t="";for(let o in e)t+=`${o}{${d(e[o])}}`;let r=ye(t);return ge(t)||(he(`@keyframes ${r}{${t}}`),Se(t)),r};var ot=e=>{let{fontFamily:t,src:r,fontStyle:o="normal",fontWeight:n=400,fontDisplay:s="swap",unicodeRange:f}=e,i=`font-family:"${t}";`;return i+=`src:${r};`,i+=`font-style:${o};`,i+=`font-weight:${n};`,i+=`font-display:${s};`,f&&(i+=`unicode-range:${f};`),be(i)||(xe(`@font-face{${i}}`),Ce(i)),t};var Fe=(e,t)=>{let r="";for(let o in e){let n=e[o],s=l(o);n&&typeof n=="object"?r+=Fe(n,`${t}-${s}`):n!=null&&(r+=`--${t}-${s}:${n};`);}return r},st=(e,t="theme")=>{let r=Fe(e,t);u(`:root{${r}}`);},it=(e,t)=>{let r=`--theme-${e.replace(/\./g,"-")}`;return t?`var(${r}, ${t})`:`var(${r})`},ft=(e,t={})=>{let{prefix:r="",inject:o=false}=t,n={},s="";for(let f in e){let i=l(f),a=r?`--${r}-${i}`:`--${i}`;n[f]=`var(${a})`,o&&(s+=`${a}:${e[f]};`);}return o&&s&&u(`:root{${s}}`),n};var Pe=/&/g,Ke=(e,t)=>{let r=[],o="";for(let n in t){let s=t[n],f=n.charCodeAt(0);if(f===64){let i=d(s);i&&r.push(`${n}{${e}{${i}}}`);}else if(f===38){let i=d(s);i&&(Pe.lastIndex=0,r.push(`${n.replace(Pe,e)}{${i}}`));}else if(f===58){let i=d(s);i&&r.push(`${e}${n}{${i}}`);}else s!=null&&typeof s!="object"&&(o+=`${l(n)}:${_(n,s)};`);}return o&&r.unshift(`${e}{${o}}`),r},at=e=>{for(let t in e){let r=e[t];if(!r)continue;if(t.charCodeAt(0)===64){let s="";for(let f in r){let i=r[f];if(i&&typeof i=="object"){let a=Ke(f,i);s+=a.join("");}}s&&u(`${t}{${s}}`);continue}let n=Ke(t,r);for(let s=0;s<n.length;s++)u(n[s]);}};var ct=(...e)=>{let t="";for(let r=0;r<e.length;r++){let o=e[r];o&&(t=t?t+" "+o:o);}return t};var Me=()=>L().join(""),lt=()=>{let e=Me();return e?`<style id="aurora-styles">${e}</style>`:""},ut=()=>{Re();},dt=()=>[...L()];export{Ue as ThemeProvider,ut as clearSSRRules,Le as colors,rt as createStyles,W as createTheme,it as cssVar,ft as cssVariables,ct as cx,ot as fontFace,dt as getSSRRulesArray,lt as getSSRStyleTag,Me as getSSRStyles,at as globalStyles,st as injectCssVariables,nt as keyframes,qe as useTheme};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|