{"version":3,"file":"types.cjs","sources":["../../../components/theme-provider/types.ts"],"sourcesContent":["import type { IconOptions } from '~/icons/create-icon';\n\ninterface ValueObject {\n  [themeName: string]: string;\n}\n\nexport const COLOR_SCHEMES = ['light', 'dark'] as const;\nexport const ACCENT_COLORS = ['indigo', 'orange', 'mint'] as const;\nexport const GRAY_COLORS = ['gray', 'mauve', 'slate'] as const;\nexport const STYLE_VARIANTS = ['modern', 'traditional'] as const;\n\nexport type ColorScheme = (typeof COLOR_SCHEMES)[number];\nexport type AccentColor = (typeof ACCENT_COLORS)[number];\nexport type GrayColor = (typeof GRAY_COLORS)[number];\nexport type StyleVariant = (typeof STYLE_VARIANTS)[number];\n\n/**\n * A minimal reference to a scope's theme state. Used internally by the\n * `scopes` registry to let `useTheme({ storageKey })` target a specific\n * scope past the nearest one.\n */\nexport interface ScopeRef {\n  theme?: string;\n  setTheme: (theme: string | undefined) => void;\n}\n\nexport interface UseThemeOptions {\n  /**\n   * Target a scope (or the root) by its `storageKey` instead of the nearest\n   * ancestor. Useful for flipping the page-level theme from inside a\n   * nested scope.\n   */\n  storageKey?: string;\n}\n\nexport interface UseThemeProps {\n  /** List of all available theme names */\n  themes: string[];\n  /** Forced theme name for the current page */\n  forcedTheme?: string;\n  /**\n   * Update the theme of the nearest scope. At the root this persists the\n   * user's choice. Inside a persistent scope (a nested `<Theme storageKey=…>`)\n   * it updates and persists the scope's theme; passing `undefined` clears the\n   * scope's storage entry and re-inherits from the parent.\n   */\n  setTheme: (theme: string | undefined) => void;\n  /** Active theme name */\n  theme?: string;\n  /** The actually applied theme. Returns `forcedTheme` when set; otherwise the system preference (`\"light\"`/`\"dark\"`) when `theme` is `\"system\"`; otherwise identical to `theme`. */\n  resolvedTheme?: string;\n  /** If enableSystem is true, returns the System theme preference (\"dark\" or \"light\"), regardless what the active theme is */\n  systemTheme?: 'dark' | 'light';\n  /** Active style variant. Reflects the nearest provider's effective value. */\n  style?: StyleVariant;\n  /** Active accent color. Reflects the nearest provider's effective value. */\n  accentColor?: AccentColor;\n  /** Active gray color. Reflects the nearest provider's effective value. */\n  grayColor?: GrayColor;\n  /**\n   * Registry of all ancestor scopes keyed by `storageKey`. Used by\n   * `useTheme({ storageKey })` to address a specific scope. Internal API.\n   */\n  scopes?: Record<string, ScopeRef>;\n}\n\nexport interface ThemeProviderProps {\n  /** List of all available theme names */\n  themes?: string[];\n  /** Forced theme name for the current page */\n  forcedTheme?: string;\n  /** Whether to switch between dark and light themes based on prefers-color-scheme */\n  enableSystem?: boolean;\n  /** Disable all CSS transitions when switching themes */\n  disableTransitionOnChange?: boolean;\n  /** Whether to indicate to browsers which color scheme is used (dark or light) for built-in UI like inputs and buttons */\n  enableColorScheme?: boolean;\n  /** Key used to store theme setting in localStorage */\n  storageKey?: string;\n  /** Default theme name (for v0.0.12 and lower the default was light). If `enableSystem` is false, the default theme is light */\n  defaultTheme?: string;\n  /** HTML attribute modified based on the active theme. Accepts `class` and `data-*` (meaning any data attribute, `data-mode`, `data-color`, etc.) */\n  attribute?: string | 'class';\n  /** Mapping of theme name to HTML attribute value. Object where key is the theme name and value is the attribute value */\n  value?: ValueObject;\n  /** Nonce string to pass to the inline script for CSP headers */\n  nonce?: string;\n  /** React children to be rendered within the Theme component */\n  children?: React.ReactNode;\n  /** Style variant of the theme. Affects the radius and font properties. */\n  style?: StyleVariant;\n  /** Accent color for the theme. */\n  accentColor?: AccentColor;\n  /** Gray color variant for the theme. */\n  grayColor?: GrayColor;\n  /** Called when the active theme changes. `resolvedTheme` is the actual applied theme (`'light'`/`'dark'` when `theme` is `'system'`). Not fired on initial mount. */\n  onThemeChange?: (theme: string, resolvedTheme: string) => void;\n  /**\n   * The icons inside Apsara's components, and the props applied to every icon.\n   *\n   * `components` replaces a drawing by key — `{ ErrorIcon: MyError }`. A partial\n   * map changes only the keys it names, and a nested `<Theme icons={…}>` layers\n   * on top of an outer one, per key.\n   *\n   * `props` applies to every icon built by `createIcon`, the consumer's own\n   * included — `{ strokeWidth: 2 }`. The props at the call site still win.\n   * Prefer the `data-icon` attribute and CSS where a style rule is enough,\n   * because CSS re-renders nothing.\n   *\n   * The map holds functions, so a React Server Component cannot pass it. Set it\n   * from a client component (the `providers.tsx` pattern).\n   */\n  icons?: IconOptions;\n}\n"],"names":[],"mappings":";;MAMa,aAAa,GAAG,CAAC,OAAO,EAAE,MAAM;;;;"}