@aurora-ds/theme 3.4.0-dev → 3.5.0
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/README.md +640 -79
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +131 -3
- package/dist/index.d.ts +131 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -111,8 +111,31 @@ declare const ThemeProvider: ({ theme, disableTransitionsOnChange, transitionDur
|
|
|
111
111
|
*/
|
|
112
112
|
declare const useTheme: () => _InternalTheme;
|
|
113
113
|
|
|
114
|
-
/**
|
|
115
|
-
|
|
114
|
+
/**
|
|
115
|
+
* A responsive value: either a raw CSS value, or an object whose keys are
|
|
116
|
+
* the breakpoint names declared on `theme.breakpoints` (plus the special
|
|
117
|
+
* `base` key for the unmediated value).
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```ts
|
|
121
|
+
* padding: { base: 8, md: 16, lg: 24 }
|
|
122
|
+
* color: { base: 'red', md: 'blue' }
|
|
123
|
+
* ```
|
|
124
|
+
*
|
|
125
|
+
* The breakpoint keys are intentionally typed as a free `string` index so
|
|
126
|
+
* that any user-defined breakpoint (e.g. `desktop`, `wide`, `phone`) is
|
|
127
|
+
* accepted without coupling the type to a hardcoded list.
|
|
128
|
+
*/
|
|
129
|
+
type ResponsiveValue<T> = T | {
|
|
130
|
+
base?: T;
|
|
131
|
+
[breakpoint: string]: T | undefined;
|
|
132
|
+
};
|
|
133
|
+
/** Maps a CSSProperties-like object so each value can also be a {@link ResponsiveValue}. */
|
|
134
|
+
type ResponsiveCSSProperties = {
|
|
135
|
+
[K in keyof CSSProperties]?: CSSProperties[K] | ResponsiveValue<CSSProperties[K]>;
|
|
136
|
+
};
|
|
137
|
+
/** CSS properties with support for pseudo-classes, media/container queries, complex selectors and responsive token values. */
|
|
138
|
+
type StyleWithPseudos = ResponsiveCSSProperties & {
|
|
116
139
|
[key: `:${string}`]: CSSProperties;
|
|
117
140
|
[key: `@media ${string}`]: CSSProperties;
|
|
118
141
|
[key: `@container ${string}`]: CSSProperties;
|
|
@@ -178,6 +201,111 @@ type CreateStylesOptions = {
|
|
|
178
201
|
*/
|
|
179
202
|
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; };
|
|
180
203
|
|
|
204
|
+
/**
|
|
205
|
+
* A group of variant values (e.g. `{ sm: {...}, md: {...}, lg: {...} }`).
|
|
206
|
+
* @internal
|
|
207
|
+
*/
|
|
208
|
+
type VariantValues = Record<string, StyleWithPseudos>;
|
|
209
|
+
/**
|
|
210
|
+
* A map of variant groups (e.g. `{ size: {...}, color: {...} }`).
|
|
211
|
+
* @internal
|
|
212
|
+
*/
|
|
213
|
+
type VariantGroups = Record<string, VariantValues>;
|
|
214
|
+
/**
|
|
215
|
+
* Props accepted by a variant function. Each key matches a variant group,
|
|
216
|
+
* each value must be one of the declared variant values. All keys are
|
|
217
|
+
* optional — missing keys fall back to `defaultVariants`.
|
|
218
|
+
*/
|
|
219
|
+
type VariantProps<V extends VariantGroups> = {
|
|
220
|
+
[K in keyof V]?: keyof V[K];
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* Compound variant definition: applies extra styles when ALL listed
|
|
224
|
+
* variant conditions match.
|
|
225
|
+
*/
|
|
226
|
+
type CompoundVariant<V extends VariantGroups> = VariantProps<V> & {
|
|
227
|
+
styles: StyleWithPseudos;
|
|
228
|
+
};
|
|
229
|
+
/**
|
|
230
|
+
* Configuration object for {@link createVariants}.
|
|
231
|
+
*/
|
|
232
|
+
type CreateVariantsConfig<V extends VariantGroups> = {
|
|
233
|
+
/** Always-applied base styles. */
|
|
234
|
+
base?: StyleWithPseudos;
|
|
235
|
+
/** Variant groups (e.g. `size`, `variant`, `intent`). */
|
|
236
|
+
variants?: V;
|
|
237
|
+
/** Default value picked when a prop is omitted. */
|
|
238
|
+
defaultVariants?: VariantProps<V>;
|
|
239
|
+
/**
|
|
240
|
+
* Extra styles applied when ALL listed conditions match.
|
|
241
|
+
*
|
|
242
|
+
* @example
|
|
243
|
+
* ```ts
|
|
244
|
+
* compoundVariants: [
|
|
245
|
+
* { size: 'sm', variant: 'ghost', styles: { fontSize: 10 } }
|
|
246
|
+
* ]
|
|
247
|
+
* ```
|
|
248
|
+
*/
|
|
249
|
+
compoundVariants?: CompoundVariant<V>[];
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* Function returned by {@link createVariants}. Given partial variant props
|
|
253
|
+
* (all optional thanks to `defaultVariants`), it returns a single
|
|
254
|
+
* space-separated class name string ready to drop on a DOM node. Falsy
|
|
255
|
+
* extra class names can be appended via the second `className` argument.
|
|
256
|
+
*/
|
|
257
|
+
type VariantFn<V extends VariantGroups> = (props?: VariantProps<V>, className?: string | false | null | undefined) => string;
|
|
258
|
+
/**
|
|
259
|
+
* Builds variant-aware components without any wrapper React component.
|
|
260
|
+
*
|
|
261
|
+
* Inspired by `cva` (class-variance-authority) and Stitches, but built
|
|
262
|
+
* directly on top of {@link createStyles} so it benefits from the same
|
|
263
|
+
* theming, HMR, SSR and per-module stylesheet behavior.
|
|
264
|
+
*
|
|
265
|
+
* The returned function is a pure className builder — it has zero
|
|
266
|
+
* runtime cost beyond a few string concatenations and Map lookups.
|
|
267
|
+
*
|
|
268
|
+
* @param configOrCreator - Static config object, or a function receiving the theme.
|
|
269
|
+
* @param options - Optional `{ id }` namespacing (recommended in production, see {@link createStyles}).
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* ```ts
|
|
273
|
+
* // Button.styles.ts
|
|
274
|
+
* import { createVariants } from '@aurora-ds/theme'
|
|
275
|
+
*
|
|
276
|
+
* export const button = createVariants((theme) => ({
|
|
277
|
+
* base: {
|
|
278
|
+
* display: 'inline-flex',
|
|
279
|
+
* alignItems: 'center',
|
|
280
|
+
* borderRadius: theme.radius.md,
|
|
281
|
+
* cursor: 'pointer',
|
|
282
|
+
* },
|
|
283
|
+
* variants: {
|
|
284
|
+
* size: {
|
|
285
|
+
* sm: { padding: theme.spacing.xs, fontSize: 12 },
|
|
286
|
+
* md: { padding: theme.spacing.sm, fontSize: 14 },
|
|
287
|
+
* lg: { padding: theme.spacing.md, fontSize: 16 },
|
|
288
|
+
* },
|
|
289
|
+
* variant: {
|
|
290
|
+
* primary: { backgroundColor: theme.colors.primary, color: 'white' },
|
|
291
|
+
* ghost: { backgroundColor: 'transparent', color: theme.colors.text },
|
|
292
|
+
* },
|
|
293
|
+
* },
|
|
294
|
+
* defaultVariants: { size: 'md', variant: 'primary' },
|
|
295
|
+
* compoundVariants: [
|
|
296
|
+
* { size: 'sm', variant: 'ghost', styles: { fontWeight: 600 } }
|
|
297
|
+
* ],
|
|
298
|
+
* }), { id: 'button' })
|
|
299
|
+
*
|
|
300
|
+
* // Usage
|
|
301
|
+
* <button className={button({ size: 'lg' })} />
|
|
302
|
+
* <button className={button({ variant: 'ghost' }, props.className)} />
|
|
303
|
+
* ```
|
|
304
|
+
*/
|
|
305
|
+
declare const createVariants: <V extends VariantGroups>(configOrCreator: CreateVariantsConfig<V> | ((theme: _InternalTheme) => CreateVariantsConfig<V>), options?: {
|
|
306
|
+
id?: string;
|
|
307
|
+
}) => VariantFn<V>;
|
|
308
|
+
|
|
181
309
|
/** Creates and injects a @keyframes rule, returns the animation name */
|
|
182
310
|
declare const keyframes: (frames: Record<string, CSSProperties>) => string;
|
|
183
311
|
|
|
@@ -276,4 +404,4 @@ declare const clearSSRRules: () => void;
|
|
|
276
404
|
/** SSR: Returns raw CSS rules as an array */
|
|
277
405
|
declare const getSSRRulesArray: () => string[];
|
|
278
406
|
|
|
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 };
|
|
407
|
+
export { type CompoundVariant, type CreateStylesOptions, type CreateVariantsConfig, type CxArg, type FontFaceOptions, type GlobalStyleBlock, type ResponsiveCSSProperties, type ResponsiveValue, type StyleWithPseudos, ThemeProvider, type ThemeRegistry, type VariantFn, type VariantProps, clearSSRRules, colors, createStyles, createTheme, createVariants, cssVar, cssVariables, cx, fontFace, getSSRRulesArray, getSSRStyleTag, getSSRStyles, globalStyles, injectCssVariables, keyframes, useTheme };
|
package/dist/index.d.ts
CHANGED
|
@@ -111,8 +111,31 @@ declare const ThemeProvider: ({ theme, disableTransitionsOnChange, transitionDur
|
|
|
111
111
|
*/
|
|
112
112
|
declare const useTheme: () => _InternalTheme;
|
|
113
113
|
|
|
114
|
-
/**
|
|
115
|
-
|
|
114
|
+
/**
|
|
115
|
+
* A responsive value: either a raw CSS value, or an object whose keys are
|
|
116
|
+
* the breakpoint names declared on `theme.breakpoints` (plus the special
|
|
117
|
+
* `base` key for the unmediated value).
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```ts
|
|
121
|
+
* padding: { base: 8, md: 16, lg: 24 }
|
|
122
|
+
* color: { base: 'red', md: 'blue' }
|
|
123
|
+
* ```
|
|
124
|
+
*
|
|
125
|
+
* The breakpoint keys are intentionally typed as a free `string` index so
|
|
126
|
+
* that any user-defined breakpoint (e.g. `desktop`, `wide`, `phone`) is
|
|
127
|
+
* accepted without coupling the type to a hardcoded list.
|
|
128
|
+
*/
|
|
129
|
+
type ResponsiveValue<T> = T | {
|
|
130
|
+
base?: T;
|
|
131
|
+
[breakpoint: string]: T | undefined;
|
|
132
|
+
};
|
|
133
|
+
/** Maps a CSSProperties-like object so each value can also be a {@link ResponsiveValue}. */
|
|
134
|
+
type ResponsiveCSSProperties = {
|
|
135
|
+
[K in keyof CSSProperties]?: CSSProperties[K] | ResponsiveValue<CSSProperties[K]>;
|
|
136
|
+
};
|
|
137
|
+
/** CSS properties with support for pseudo-classes, media/container queries, complex selectors and responsive token values. */
|
|
138
|
+
type StyleWithPseudos = ResponsiveCSSProperties & {
|
|
116
139
|
[key: `:${string}`]: CSSProperties;
|
|
117
140
|
[key: `@media ${string}`]: CSSProperties;
|
|
118
141
|
[key: `@container ${string}`]: CSSProperties;
|
|
@@ -178,6 +201,111 @@ type CreateStylesOptions = {
|
|
|
178
201
|
*/
|
|
179
202
|
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; };
|
|
180
203
|
|
|
204
|
+
/**
|
|
205
|
+
* A group of variant values (e.g. `{ sm: {...}, md: {...}, lg: {...} }`).
|
|
206
|
+
* @internal
|
|
207
|
+
*/
|
|
208
|
+
type VariantValues = Record<string, StyleWithPseudos>;
|
|
209
|
+
/**
|
|
210
|
+
* A map of variant groups (e.g. `{ size: {...}, color: {...} }`).
|
|
211
|
+
* @internal
|
|
212
|
+
*/
|
|
213
|
+
type VariantGroups = Record<string, VariantValues>;
|
|
214
|
+
/**
|
|
215
|
+
* Props accepted by a variant function. Each key matches a variant group,
|
|
216
|
+
* each value must be one of the declared variant values. All keys are
|
|
217
|
+
* optional — missing keys fall back to `defaultVariants`.
|
|
218
|
+
*/
|
|
219
|
+
type VariantProps<V extends VariantGroups> = {
|
|
220
|
+
[K in keyof V]?: keyof V[K];
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* Compound variant definition: applies extra styles when ALL listed
|
|
224
|
+
* variant conditions match.
|
|
225
|
+
*/
|
|
226
|
+
type CompoundVariant<V extends VariantGroups> = VariantProps<V> & {
|
|
227
|
+
styles: StyleWithPseudos;
|
|
228
|
+
};
|
|
229
|
+
/**
|
|
230
|
+
* Configuration object for {@link createVariants}.
|
|
231
|
+
*/
|
|
232
|
+
type CreateVariantsConfig<V extends VariantGroups> = {
|
|
233
|
+
/** Always-applied base styles. */
|
|
234
|
+
base?: StyleWithPseudos;
|
|
235
|
+
/** Variant groups (e.g. `size`, `variant`, `intent`). */
|
|
236
|
+
variants?: V;
|
|
237
|
+
/** Default value picked when a prop is omitted. */
|
|
238
|
+
defaultVariants?: VariantProps<V>;
|
|
239
|
+
/**
|
|
240
|
+
* Extra styles applied when ALL listed conditions match.
|
|
241
|
+
*
|
|
242
|
+
* @example
|
|
243
|
+
* ```ts
|
|
244
|
+
* compoundVariants: [
|
|
245
|
+
* { size: 'sm', variant: 'ghost', styles: { fontSize: 10 } }
|
|
246
|
+
* ]
|
|
247
|
+
* ```
|
|
248
|
+
*/
|
|
249
|
+
compoundVariants?: CompoundVariant<V>[];
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* Function returned by {@link createVariants}. Given partial variant props
|
|
253
|
+
* (all optional thanks to `defaultVariants`), it returns a single
|
|
254
|
+
* space-separated class name string ready to drop on a DOM node. Falsy
|
|
255
|
+
* extra class names can be appended via the second `className` argument.
|
|
256
|
+
*/
|
|
257
|
+
type VariantFn<V extends VariantGroups> = (props?: VariantProps<V>, className?: string | false | null | undefined) => string;
|
|
258
|
+
/**
|
|
259
|
+
* Builds variant-aware components without any wrapper React component.
|
|
260
|
+
*
|
|
261
|
+
* Inspired by `cva` (class-variance-authority) and Stitches, but built
|
|
262
|
+
* directly on top of {@link createStyles} so it benefits from the same
|
|
263
|
+
* theming, HMR, SSR and per-module stylesheet behavior.
|
|
264
|
+
*
|
|
265
|
+
* The returned function is a pure className builder — it has zero
|
|
266
|
+
* runtime cost beyond a few string concatenations and Map lookups.
|
|
267
|
+
*
|
|
268
|
+
* @param configOrCreator - Static config object, or a function receiving the theme.
|
|
269
|
+
* @param options - Optional `{ id }` namespacing (recommended in production, see {@link createStyles}).
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* ```ts
|
|
273
|
+
* // Button.styles.ts
|
|
274
|
+
* import { createVariants } from '@aurora-ds/theme'
|
|
275
|
+
*
|
|
276
|
+
* export const button = createVariants((theme) => ({
|
|
277
|
+
* base: {
|
|
278
|
+
* display: 'inline-flex',
|
|
279
|
+
* alignItems: 'center',
|
|
280
|
+
* borderRadius: theme.radius.md,
|
|
281
|
+
* cursor: 'pointer',
|
|
282
|
+
* },
|
|
283
|
+
* variants: {
|
|
284
|
+
* size: {
|
|
285
|
+
* sm: { padding: theme.spacing.xs, fontSize: 12 },
|
|
286
|
+
* md: { padding: theme.spacing.sm, fontSize: 14 },
|
|
287
|
+
* lg: { padding: theme.spacing.md, fontSize: 16 },
|
|
288
|
+
* },
|
|
289
|
+
* variant: {
|
|
290
|
+
* primary: { backgroundColor: theme.colors.primary, color: 'white' },
|
|
291
|
+
* ghost: { backgroundColor: 'transparent', color: theme.colors.text },
|
|
292
|
+
* },
|
|
293
|
+
* },
|
|
294
|
+
* defaultVariants: { size: 'md', variant: 'primary' },
|
|
295
|
+
* compoundVariants: [
|
|
296
|
+
* { size: 'sm', variant: 'ghost', styles: { fontWeight: 600 } }
|
|
297
|
+
* ],
|
|
298
|
+
* }), { id: 'button' })
|
|
299
|
+
*
|
|
300
|
+
* // Usage
|
|
301
|
+
* <button className={button({ size: 'lg' })} />
|
|
302
|
+
* <button className={button({ variant: 'ghost' }, props.className)} />
|
|
303
|
+
* ```
|
|
304
|
+
*/
|
|
305
|
+
declare const createVariants: <V extends VariantGroups>(configOrCreator: CreateVariantsConfig<V> | ((theme: _InternalTheme) => CreateVariantsConfig<V>), options?: {
|
|
306
|
+
id?: string;
|
|
307
|
+
}) => VariantFn<V>;
|
|
308
|
+
|
|
181
309
|
/** Creates and injects a @keyframes rule, returns the animation name */
|
|
182
310
|
declare const keyframes: (frames: Record<string, CSSProperties>) => string;
|
|
183
311
|
|
|
@@ -276,4 +404,4 @@ declare const clearSSRRules: () => void;
|
|
|
276
404
|
/** SSR: Returns raw CSS rules as an array */
|
|
277
405
|
declare const getSSRRulesArray: () => string[];
|
|
278
406
|
|
|
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 };
|
|
407
|
+
export { type CompoundVariant, type CreateStylesOptions, type CreateVariantsConfig, type CxArg, type FontFaceOptions, type GlobalStyleBlock, type ResponsiveCSSProperties, type ResponsiveValue, type StyleWithPseudos, ThemeProvider, type ThemeRegistry, type VariantFn, type VariantProps, clearSSRRules, colors, createStyles, createTheme, createVariants, cssVar, cssVariables, cx, fontFace, getSSRRulesArray, getSSRStyleTag, getSSRStyles, globalStyles, injectCssVariables, keyframes, useTheme };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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
|
|
1
|
+
import*as Fe from'react';import {createContext,useRef,useMemo,useLayoutEffect,useContext}from'react';import {jsx}from'react/jsx-runtime';var U=e=>e;var Z={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 Y={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 J={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 X={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 q={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 Q={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 ee={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 te={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 ne={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 re={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 oe={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 se={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 ie={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 ae={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 fe={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 ce={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 le={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 ue={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 de={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 ze={gray:Q,slate:fe,stone:ce,red:ie,orange:re,amber:Z,yellow:de,lime:ne,green:ee,emerald:X,teal:le,cyan:J,blue:Y,indigo:te,violet:ue,purple:se,fuchsia:q,pink:oe,rose:ae,white:"#ffffff",black:"#000000",transparent:"transparent",current:"currentColor"};var $=typeof document>"u",N=typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production",w=(e,...t)=>{N&&console.warn(`[aurora-ds] ${e}`,...t);},pe=null,x=null,A=[],me=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"]]),F=new Set,K=new Set,v=new Map,E=new Map,p=null,He=new Set(["animationIterationCount","columnCount","fillOpacity","flexGrow","flexShrink","fontWeight","lineHeight","opacity","order","orphans","widows","zIndex","zoom"]),I=new Map,_=new Map;if(!$){let e=document.getElementById("aurora-styles");if(e)x=e.sheet;else {let t=document.createElement("style");t.id="aurora-styles",document.head.appendChild(t),x=t.sheet;}}var W=e=>{let t=pe;return pe=e,t};var g=e=>{if($)A.push(e);else if(x)try{x.insertRule(e,x.cssRules.length);}catch(t){w("Failed to insert CSS rule:",e,t);}},Se=e=>{if($)return null;let t=I.get(e);if(t){let r=t.cssRules.length;for(let i=r-1;i>=0;i--)t.deleteRule(i);_.delete(e);let s=v.get(e);s&&(s.forEach(i=>F.delete(i)),s.clear());let a=E.get(e);return a&&(a.forEach(i=>K.delete(i)),a.clear()),t}let n=document.createElement("style");n.id=`aurora-mod-${e}`,n.setAttribute("data-aurora-module",e),document.head.appendChild(n);let o=n.sheet;return I.set(e,o),o},S=(e,t)=>{if($)A.push(t);else if(e)try{e.insertRule(t,e.cssRules.length);}catch(n){w("Failed to insert module CSS rule:",t,n);}},R=new Map,he=e=>{if(R.clear(),!!e)for(let t in e){let n=e[t];n!=null&&R.set(t,typeof n=="number"?`${n}px`:String(n));}},Ue=e=>{if(!e||typeof e!="object"||Array.isArray(e)||R.size===0)return false;let t=false;for(let n in e){if(n==="base"){t=true;continue}if(!R.has(n))return false;t=true;}return t},ge=/&/g,Ze=/[<{};]/,L=(e,t,n)=>{let o="",r=`.${t}`;for(let s in e){let a=e[s],i=s.charCodeAt(0);if(N&&Ze.test(s)){w(`Suspicious style key "${s}" \u2014 contains forbidden characters (<, >, ;, {, }, ", '). This rule is ignored to prevent CSS injection.`);continue}if(i===64){let f=y(a);f&&S(n,`${s}{${r}{${f}}}`);}else if(i===38){let f=y(a);f&&(ge.lastIndex=0,S(n,`${s.replace(ge,r)}{${f}}`));}else if(i===58){let f=y(a);f&&S(n,`${r}${s}{${f}}`);}else if(a!=null&&typeof a=="object"&&Ue(a)){let f=a,l=m(s);"base"in f&&f.base!=null&&(o+=`${l}:${b(s,f.base)};`);for(let[c,d]of R){if(!(c in f))continue;let u=f[c];u!=null&&S(n,`@media (min-width:${d}){${r}{${l}:${b(s,u)};}}`);}}else a!=null&&typeof a=="object"&&!Array.isArray(a)?N&&w(`Style key "${s}" has an object value but isn't a selector (':hover', '&...', '@...') and doesn't match any registered breakpoint. This block is ignored. Did you forget the "&" prefix, or the "base" key, or to declare the breakpoint in theme.breakpoints?`):a!=null&&typeof a!="object"&&(o+=`${m(s)}:${b(s,a)};`);}return o&&S(n,`${r}{${o}}`),t},Ye=500,be=(e,t)=>{let n=_.get(e);return n||(n=new Set,_.set(e,n)),n.has(t)?true:(n.size>=Ye||n.add(t),false)},m=e=>{let t=me.get(e);return t||(t=e.replace(/([A-Z])/g,"-$1").toLowerCase(),me.set(e,t)),t},ye=new Map,T=e=>{let t=ye.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(),ye.set(e,t)),t},Je=/expression\s*\(|javascript\s*:|data\s*:\s*text\/html|behavior\s*:|@import|<\s*\/?\s*style/i,Xe=e=>{let t=e.replace(/\0/g,"");return Je.test(t)?"unset":t},b=(e,t)=>{if(typeof t=="number")return He.has(e)?String(t):`${t}px`;let n=String(t);return n.charCodeAt(0)===118&&n.startsWith("var(--")?n:Xe(n)},y=e=>{let t="";for(let n in e){let o=e[n];o!=null&&typeof o!="object"&&(t+=`${m(n)}:${b(n,o)};`);}return t};var qe=4,P=(e,t=0)=>{if(e===null||typeof e!="object"||t>=qe)return JSON.stringify(e);if(Array.isArray(e))return "["+e.map(r=>P(r,t+1)).join(",")+"]";let n=Object.keys(e).sort(),o=[];for(let r of n){let s=e[r];s!==void 0&&o.push(JSON.stringify(r)+":"+P(s,t+1));}return "{"+o.join(",")+"}"},Ce=e=>{let t=e.length;if(t===0)return "";if(t===1){let n=e[0];if(n===void 0)return "u";if(n===null)return "n";if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return String(n)}if(t<=4){let n="";for(let o=0;o<t;o++){let r=e[o],s=typeof r;if(r===void 0)n+=o?"|u":"u";else if(r===null)n+=o?"|n":"n";else if(s==="string"||s==="number"||s==="boolean")n+=o?"|"+r:String(r);else return P(e)}return n}return P(e)},xe=e=>{let t=e.charCodeAt(0);if(e.length<20){if(t>=97&&t<=122||t>=65&&t<=90){let n=true;for(let o=1;o<e.length;o++){let r=e.charCodeAt(o);if(!(r>=97&&r<=122||r>=65&&r<=90||r>=48&&r<=57)){n=false;break}}if(n)return T(e)}else if(t===45||t>=48&&t<=57){let n=true;for(let o=1;o<e.length;o++)if(e.charCodeAt(o)<48||e.charCodeAt(o)>57){n=false;break}if(n)return e}}return M(e)},M=e=>{let t=5381,n=e.length;for(let o=0;o<n;o++)t=(t<<5)+t^e.charCodeAt(o);return (t>>>0).toString(36)},O=(e,t=null)=>{p=e?{name:e,sheet:t}:null;},Re=e=>F.has(e),$e=e=>{if(F.add(e),p){let t=v.get(p.name);t||(t=new Set,v.set(p.name,t)),t.add(e);}},Te=e=>`aurora-kf-${M(e)}`,ke=e=>{p?.sheet?S(p.sheet,e):g(e);},Ve=e=>K.has(e),we=e=>{if(K.add(e),p){let t=E.get(p.name);t||(t=new Set,E.set(p.name,t)),t.add(e);}},ve=e=>{p?.sheet?S(p.sheet,e):g(e);},D=()=>A,Ee=()=>{A=[],F.clear(),K.clear(),v.clear(),E.clear(),p=null,$||I.forEach((e,t)=>{let n=document.getElementById(`aurora-mod-${t}`);n&&n.remove();}),I.clear(),_.clear();};var B=typeof document>"u",_e="aurora-theme-variables",Pe="aurora-theme-transition",k="aurora-disable-transitions",V="aurora-force-transitions",nt=Fe.useInsertionEffect??useLayoutEffect,Ae=false,rt=()=>{Ae||B||(g(`.${k} *,.${k} *::before,.${k} *::after{transition:none!important}`),Ae=true);},ot=e=>{if(B)return;let t=document.getElementById(Pe);t||(t=document.createElement("style"),t.id=Pe,document.head.appendChild(t)),t.textContent=`.${V} *,.${V} *::before,.${V} *::after{transition:color ${e}ms,background-color ${e}ms,border-color ${e}ms,fill ${e}ms,stroke ${e}ms!important}`;},Me=createContext(void 0),je=(e,t="theme")=>{let n="";for(let o in e){let r=e[o],s=`${t}-${m(o)}`;r&&typeof r=="object"&&!Array.isArray(r)?n+=je(r,s):r!=null&&(n+=`--${s}:${r};`);}return n},st=({theme:e,disableTransitionsOnChange:t=true,transitionDuration:n,children:o})=>{let r=W(()=>e),s=useRef(true),a=useRef(null),i=e.breakpoints;he(i);let f=useMemo(()=>je(e),[e]);return nt(()=>{if(B)return;let l=!s.current,c=n!==void 0&&n>0,d=t&&!c&&l;d&&(rt(),document.documentElement.classList.add(k)),c&&l&&(ot(n),document.documentElement.classList.add(V));let u=document.getElementById(_e);u||(u=document.createElement("style"),u.id=_e,document.head.appendChild(u));let h=`:root{${f}}`;if(a.current!==h&&(u.textContent=h,a.current=h),d&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{document.documentElement.classList.remove(k);});}),c&&l){let C=setTimeout(()=>{document.documentElement.classList.remove(V);},n);return s.current=false,()=>{clearTimeout(C);}}s.current=false;},[f,t,n]),useLayoutEffect(()=>()=>{W(r);},[r]),jsx(Me.Provider,{value:e,children:o})},it=()=>{let e=useContext(Me);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e};var ft=typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production",Ne=new Set,ct=e=>{if(!ft||Ne.has(e))return;let t=new Error().stack||"";/(renderWithHooks|react-dom|react-stack-bottom-frame|beginWork)/.test(t)&&(Ne.add(e),console.warn(`[aurora-ds] createStyles("${e}") was called from inside a React render. Move it to module top-level \u2014 calling it on every render creates a new stylesheet each time, hurting performance and breaking caching.`));},G=new Map,lt=0,ut=()=>{let e=new Error().stack||"",t=e.match(/([A-Za-z0-9_]+)\.styles\.[tj]s/);if(!t?.[1])return `s${(lt++).toString(36)}`;let n=T(t[1]),r=e.match(/(?:at\s+.*?\(|at\s+)((?:[A-Za-z]:)?[^\s)]+\.styles\.[tj]s)/)?.[1]||"",s=G.get(n);if(s===r)return n;if(!s)return G.set(n,r),n;let a=`${n}-${M(r)}`;return G.set(a,r),a},j=null,dt=()=>{if(j)return j;let e=t=>{let n=()=>`var(--theme-${t})`;return new Proxy(n,{get(o,r){if(r===Symbol.toPrimitive)return n;if(typeof r!="string")return;if(r==="toString"||r==="valueOf")return n;let s=m(r),a=t?`${t}-${s}`:s;return e(a)},apply(){return n()}})};return j=e(""),j},We=(e,t,n)=>{let o={};for(let r in e){let s=e[r];if(s){let a=`${t}-${T(r)}`;typeof s=="function"?o[r]=(...i)=>{let f=Ce(i),l=`${a}-${xe(f)}`;if(!be(t,l)){let c=s(...i);L(c,l,n);}return l}:(L(s,a,n),o[r]=a);}}return o},z=(e,t)=>{let n=t?.id?T(t.id):ut();ct(n);let o=Se(n);O(n,o);try{if(typeof e=="function"){let r=dt(),s=e(r);return We(s,n,o)}return We(e,n,o)}finally{O(null);}};var H=(...e)=>{let t="";for(let n=0;n<e.length;n++){let o=e[n];o&&(t=t?t+" "+o:o);}return t};var Le="compound-",pt=(e,t)=>{let n={},o=[],r=i=>{let f=typeof e=="function"?e(i):e;n=f.defaultVariants??{},o=f.compoundVariants??[];let l={};if(f.base&&(l.base=f.base),f.variants)for(let c in f.variants){let d=f.variants[c];for(let u in d)l[`${c}--${u}`]=d[u];}if(f.compoundVariants)for(let c=0;c<f.compoundVariants.length;c++)l[`${Le}${c}`]=f.compoundVariants[c].styles;return l},s=z((i=>r(i)),t),a=s.base;return (i,f)=>{let l={...n,...i??{}},c=[a];for(let d in l){let u=l[d];u==null||u===false||c.push(s[`${d}--${String(u)}`]);}for(let d=0;d<o.length;d++){let u=o[d],h=true;for(let C in u)if(C!=="styles"&&l[C]!==u[C]){h=false;break}h&&c.push(s[`${Le}${d}`]);}return f&&c.push(f),H(...c)}};var mt=e=>{let t="";for(let o in e)t+=`${o}{${y(e[o])}}`;let n=Te(t);return Re(t)||(ke(`@keyframes ${n}{${t}}`),$e(t)),n};var gt=e=>{let{fontFamily:t,src:n,fontStyle:o="normal",fontWeight:r=400,fontDisplay:s="swap",unicodeRange:a}=e,i=`font-family:"${t}";`;return i+=`src:${n};`,i+=`font-style:${o};`,i+=`font-weight:${r};`,i+=`font-display:${s};`,a&&(i+=`unicode-range:${a};`),Ve(i)||(ve(`@font-face{${i}}`),we(i)),t};var Oe=(e,t)=>{let n="";for(let o in e){let r=e[o],s=m(o);r&&typeof r=="object"?n+=Oe(r,`${t}-${s}`):r!=null&&(n+=`--${t}-${s}:${r};`);}return n},yt=(e,t="theme")=>{let n=Oe(e,t);g(`:root{${n}}`);},St=(e,t)=>{let n=`--theme-${e.replace(/\./g,"-")}`;return t?`var(${n}, ${t})`:`var(${n})`},ht=(e,t={})=>{let{prefix:n="",inject:o=false}=t,r={},s="";for(let a in e){let i=m(a),f=n?`--${n}-${i}`:`--${i}`;r[a]=`var(${f})`,o&&(s+=`${f}:${e[a]};`);}return o&&s&&g(`:root{${s}}`),r};var De=/&/g,Be=(e,t)=>{let n=[],o="";for(let r in t){let s=t[r],a=r.charCodeAt(0);if(a===64){let i=y(s);i&&n.push(`${r}{${e}{${i}}}`);}else if(a===38){let i=y(s);i&&(De.lastIndex=0,n.push(`${r.replace(De,e)}{${i}}`));}else if(a===58){let i=y(s);i&&n.push(`${e}${r}{${i}}`);}else s!=null&&typeof s!="object"&&(o+=`${m(r)}:${b(r,s)};`);}return o&&n.unshift(`${e}{${o}}`),n},bt=e=>{for(let t in e){let n=e[t];if(!n)continue;if(t.charCodeAt(0)===64){let s="";for(let a in n){let i=n[a];if(i&&typeof i=="object"){let f=Be(a,i);s+=f.join("");}}s&&g(`${t}{${s}}`);continue}let r=Be(t,n);for(let s=0;s<r.length;s++)g(r[s]);}};var Ge=()=>D().join(""),Ct=()=>{let e=Ge();return e?`<style id="aurora-styles">${e}</style>`:""},xt=()=>{Ee();},Rt=()=>[...D()];export{st as ThemeProvider,xt as clearSSRRules,ze as colors,z as createStyles,U as createTheme,pt as createVariants,St as cssVar,ht as cssVariables,H as cx,gt as fontFace,Rt as getSSRRulesArray,Ct as getSSRStyleTag,Ge as getSSRStyles,bt as globalStyles,yt as injectCssVariables,mt as keyframes,it as useTheme};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|