{"version":3,"file":"vue-multiple-themes.cjs","sources":["../src/utils/css-injector.ts","../src/utils/dom.ts","../src/components/VmtIcon.vue","../src/components/VueMultipleThemes.vue","../src/composables/useTheme.ts","../src/components/VmtThemePicker.vue","../src/plugin.ts","../src/composables/createBrandContext.ts","../src/icons/index.ts","../src/utils/generate-theme.ts","../src/themes/presets.ts"],"sourcesContent":["import type { ThemeDefinition, ThemeOptions } from '../types'\nimport { normalizeToRgbChannels } from './color'\n\nconst DEFAULT_STYLE_ID = 'vmt-theme-styles'\n\n/** Return the `<style>` element id for the given namespace. */\nexport function getStyleId(namespace?: string): string {\n  return namespace ? `vmt-theme-styles-${namespace}` : DEFAULT_STYLE_ID\n}\n\n/**\n * Convert camelCase token names to kebab-case CSS variable segments.\n * e.g. \"primaryDark\" → \"primary-dark\"\n */\nexport function toKebab(str: string): string {\n  return str.replace(/([A-Z])/g, (_, c: string) => `-${c.toLowerCase()}`)\n}\n\n/** Build a full CSS block string for all themes. */\nexport function buildCssVars(\n  themes: ThemeDefinition[],\n  options: Pick<ThemeOptions, 'strategy' | 'attribute' | 'classPrefix' | 'cssVarPrefix' | 'target' | 'namespace'>,\n): string {\n  const {\n    strategy = 'attribute',\n    attribute = 'data-theme',\n    classPrefix = 'theme-',\n    cssVarPrefix = '--vmt-',\n    target = 'html',\n  } = options\n\n  const rootSelector = target === 'html' ? ':root' : target\n\n  function buildSelector(themeName: string, isDefault: boolean): string {\n    const parts: string[] = []\n    if (isDefault) parts.push(rootSelector)\n\n    if (strategy === 'attribute' || strategy === 'both') {\n      const base =\n        target === 'html'\n          ? `:root[${attribute}=\"${themeName}\"]`\n          : `${target}[${attribute}=\"${themeName}\"]`\n      if (!parts.includes(base)) parts.push(base)\n    }\n\n    if (strategy === 'class' || strategy === 'both') {\n      const cls = `${classPrefix}${themeName}`\n      const base = target === 'html' ? `:root.${cls}` : `${target}.${cls}`\n      if (!parts.includes(base)) parts.push(base)\n    }\n\n    return parts.join(',\\n')\n  }\n\n  const blocks: string[] = []\n\n  // Convenience icon-color variable on :root\n  blocks.push(\n    `${rootSelector} {\\n  ${cssVarPrefix}icon-color: var(${cssVarPrefix}text, currentColor);\\n}`,\n  )\n\n  for (let i = 0; i < themes.length; i++) {\n    const theme = themes[i]\n    const selector = buildSelector(theme.name, i === 0)\n    const vars = Object.entries(theme.colors)\n      .filter(([, v]) => v !== undefined)\n      .map(([k, v]) => {\n        const kebab = toKebab(k)\n        const channels = normalizeToRgbChannels(v!)\n        const lines: string[] = []\n        // RGB channels for Tailwind opacity modifier support: bg-vmt-primary/50\n        lines.push(`  ${cssVarPrefix}${kebab}: ${channels};`)\n        // Full rgb() color for direct CSS use: color: var(--vmt-primary-color)\n        lines.push(`  ${cssVarPrefix}${kebab}-color: rgb(${channels});`)\n        return lines.join('\\n')\n      })\n      .join('\\n')\n    blocks.push(`${selector} {\\n${vars}\\n}`)\n  }\n\n  return blocks.join('\\n\\n')\n}\n\n/** Inject (or update) a `<style>` tag with the generated CSS into `<head>`. */\nexport function injectStyles(css: string, namespace?: string): void {\n  if (typeof document === 'undefined') return\n\n  const id = getStyleId(namespace)\n  let el = document.getElementById(id) as HTMLStyleElement | null\n  if (!el) {\n    el = document.createElement('style')\n    el.id = id\n    document.head.appendChild(el)\n  }\n  el.textContent = css\n}\n\n/** Remove the injected `<style>` tag. */\nexport function removeStyles(namespace?: string): void {\n  if (typeof document === 'undefined') return\n  document.getElementById(getStyleId(namespace))?.remove()\n}\n","import type { ThemeOptions, ThemeTarget } from '../types'\n\n/** Resolve the target DOM element. Returns null in SSR. */\nexport function resolveTarget(target: ThemeTarget = 'html'): Element | null {\n  if (typeof document === 'undefined') return null\n  if (target === 'html') return document.documentElement\n  if (target === 'body') return document.body\n  return document.querySelector(target)\n}\n\n/**\n * Apply a theme to the DOM by setting attributes and / or CSS classes\n * on the target element, and removing the previous ones.\n */\nexport function applyThemeToDom(\n  name: string,\n  previousName: string | null,\n  options: Pick<ThemeOptions, 'strategy' | 'attribute' | 'classPrefix' | 'target'>,\n): void {\n  const {\n    strategy = 'attribute',\n    attribute = 'data-theme',\n    classPrefix = 'theme-',\n    target = 'html',\n  } = options\n\n  const el = resolveTarget(target)\n  if (!el) return\n\n  if (strategy === 'attribute' || strategy === 'both') {\n    el.setAttribute(attribute, name)\n  }\n\n  if (strategy === 'class' || strategy === 'both') {\n    // Remove ALL theme classes (not just previousName) to handle stale classes\n    // that may linger after a page refresh when previousName is null\n    const toRemove = Array.from(el.classList).filter(\n      (cls) => cls.startsWith(classPrefix) && cls !== `${classPrefix}${name}`,\n    )\n    for (const cls of toRemove) {\n      el.classList.remove(cls)\n    }\n    el.classList.add(`${classPrefix}${name}`)\n  }\n}\n\n/** Remove all theme markers from the DOM (cleanup). */\nexport function clearThemeFromDom(\n  name: string,\n  options: Pick<ThemeOptions, 'strategy' | 'attribute' | 'classPrefix' | 'target'>,\n): void {\n  const {\n    strategy = 'attribute',\n    attribute = 'data-theme',\n    classPrefix = 'theme-',\n    target = 'html',\n  } = options\n\n  const el = resolveTarget(target)\n  if (!el) return\n\n  if (strategy === 'attribute' || strategy === 'both') {\n    el.removeAttribute(attribute)\n  }\n\n  if (strategy === 'class' || strategy === 'both') {\n    el.classList.remove(`${classPrefix}${name}`)\n  }\n}\n\n/** Read / write from Web Storage, swallowing errors in private-browsing mode. */\nexport function readStorage(key: string, type: 'localStorage' | 'sessionStorage'): string | null {\n  try {\n    return window[type].getItem(key)\n  } catch {\n    return null\n  }\n}\n\nexport function writeStorage(key: string, value: string, type: 'localStorage' | 'sessionStorage'): void {\n  try {\n    window[type].setItem(key, value)\n  } catch {\n    /* ignore */\n  }\n}\n\n/** Returns 'dark' or 'light' based on OS preference (browser only). */\nexport function getSystemPreference(): 'dark' | 'light' {\n  if (typeof window === 'undefined') return 'light'\n  return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'\n}\n","<script setup lang=\"ts\">\n/**\n * VmtIcon.vue\n *\n * A thin sizing/color wrapper for any Vue icon component.\n * Works with lucide-vue-next, @heroicons/vue, @phosphor-icons/vue, etc.\n *\n * @example\n * import { Sun } from 'lucide-vue-next'\n * <VmtIcon :as=\"Sun\" :size=\"20\" />\n */\nimport type { Component } from 'vue'\n\nwithDefaults(\n    defineProps<{\n        /** Any Vue icon component (Lucide, Heroicons, Phosphor, etc.) */\n        as: Component\n        /** Icon size in pixels */\n        size?: number\n        /** Stroke / fill color — defaults to `currentColor` */\n        color?: string\n        /** Stroke width */\n        strokeWidth?: number\n    }>(),\n    {\n        size: 20,\n        color: 'currentColor',\n        strokeWidth: 2,\n    },\n)\n</script>\n\n<template>\n    <component\n        :is=\"as\"\n        :size=\"size\"\n        :color=\"color\"\n        :stroke-width=\"strokeWidth\"\n    />\n</template>\n","<script setup lang=\"ts\">\nimport {\n    computed,\n    onBeforeUnmount,\n    onMounted,\n    ref,\n    watch,\n} from \"vue\";\nimport type { Component } from \"vue\";\nimport type {\n\tThemeDefinition,\n\tThemeStrategy,\n\tThemeTarget,\n} from \"../types\";\nimport {\n\tbuildCssVars,\n\tinjectStyles,\n\tremoveStyles,\n} from \"../utils/css-injector\";\nimport {\n\tapplyThemeToDom,\n    getSystemPreference,\n\treadStorage,\n    writeStorage,\n} from \"../utils/dom\";\nimport { normalizeToRgbChannels } from \"../utils/color\";\nimport VmtIcon from \"./VmtIcon.vue\";\n// VmtIcon is used in the #icon slot default when the theme has a Component icon\n\n// ── Ref-counted instance tracking (keyed by storageKey) ────────────────────\n// Prevents a navigating-away component from wiping the shared <style> tag\n// while other components (e.g. NavThemeSwitcher) are still mounted.\nconst _componentCounts = new Map<string, number>()\n\nconst props = withDefaults(defineProps<{\n    /** All available theme definitions */\n    themes?: ThemeDefinition[];\n    /** Active theme on first render (default: first in `themes`) */\n    defaultTheme?: string;\n    /** How to stamp the theme on the DOM */\n    strategy?: ThemeStrategy;\n    /** Attribute name (default: `data-theme`) */\n    attribute?: string;\n    /** Class prefix (default: `theme-`) */\n    classPrefix?: string;\n    /** DOM element that receives the attribute / class */\n    target?: ThemeTarget;\n    /** CSS variable prefix (default: `--vmt-`) */\n    cssVarPrefix?: string;\n    /** Inject CSS variables automatically */\n    injectCssVars?: boolean;\n    /** Persist theme in storage */\n    storage?: \"localStorage\" | \"sessionStorage\" | \"none\";\n    /** Storage key for persistence */\n    storageKey?: string;\n    /** Respect OS dark/light preference on first load */\n    respectSystemPreference?: boolean;\n    /** Show the built-in toggle button */\n    showToggle?: boolean;\n    /** Show the label next to the icon */\n    showLabel?: boolean;\n    /** Size (px) of the toggle icon */\n    iconSize?: number;\n    /** Extra CSS classes on the root wrapper */\n    extraClass?: string;\n}>(), {\n    themes: () => [\n        {\n            name: \"light\",\n            label: \"Light\",\n            colors: {\n                primary: \"#3b82f6\",\n                secondary: \"#8b5cf6\",\n                accent: \"#f59e0b\",\n                background: \"#ffffff\",\n                surface: \"#f8fafc\",\n                surfaceElevated: \"#f1f5f9\",\n                text: \"#111827\",\n                textMuted: \"#6b7280\",\n                textInverse: \"#ffffff\",\n                border: \"#e5e7eb\",\n                ring: \"#3b82f6\",\n                success: \"#10b981\",\n                warning: \"#f59e0b\",\n                error: \"#ef4444\",\n                info: \"#3b82f6\",\n            },\n        },\n        {\n            name: \"dark\",\n            label: \"Dark\",\n            colors: {\n                primary: \"#60a5fa\",\n                secondary: \"#a78bfa\",\n                accent: \"#fbbf24\",\n                background: \"#0f172a\",\n                surface: \"#1e293b\",\n                surfaceElevated: \"#334155\",\n                text: \"#f8fafc\",\n                textMuted: \"#94a3b8\",\n                textInverse: \"#0f172a\",\n                border: \"#334155\",\n                ring: \"#60a5fa\",\n                success: \"#34d399\",\n                warning: \"#fbbf24\",\n                error: \"#f87171\",\n                info: \"#60a5fa\",\n            },\n        },\n        {\n            name: \"sepia\",\n            label: \"Sepia\",\n            colors: {\n                primary: \"#92400e\",\n                secondary: \"#78350f\",\n                accent: \"#d97706\",\n                background: \"#fdf6e3\",\n                surface: \"#f5e9c9\",\n                surfaceElevated: \"#ede0b5\",\n                text: \"#3c2415\",\n                textMuted: \"#78583d\",\n                textInverse: \"#fdf6e3\",\n                border: \"#d6b896\",\n                ring: \"#92400e\",\n                success: \"#166534\",\n                warning: \"#92400e\",\n                error: \"#991b1b\",\n                info: \"#1e40af\",\n            },\n        },\n    ],\n    strategy: \"attribute\",\n    attribute: \"data-theme\",\n    classPrefix: \"theme-\",\n    target: \"html\",\n    cssVarPrefix: \"--vmt-\",\n    injectCssVars: true,\n    storage: \"localStorage\",\n    storageKey: \"vmt-theme\",\n    respectSystemPreference: false,\n    showToggle: true,\n    showLabel: false,\n    iconSize: 20,\n    extraClass: \"\",\n});\n\nconst emit = defineEmits<{\n    (e: \"change\", theme: ThemeDefinition): void;\n}>();\n\n// ── Resolve initial theme ───────────────────────────────────────────\nfunction getInitial(): string {\n    if (props.storage !== \"none\") {\n        const stored = readStorage(\n            props.storageKey,\n            props.storage as \"localStorage\" | \"sessionStorage\",\n        );\n        if (\n            stored &&\n            props.themes.some((t: ThemeDefinition) => t.name === stored)\n        )\n            return stored;\n    }\n\n    if (props.respectSystemPreference) {\n        const pref = getSystemPreference();\n        const match = props.themes.find(\n            (t: ThemeDefinition) => t.name === pref,\n        );\n        if (match) return match.name;\n    }\n\n    if (\n        props.defaultTheme &&\n        props.themes.some((t: ThemeDefinition) => t.name === props.defaultTheme)\n    ) {\n        return props.defaultTheme;\n    }\n\n    return props.themes[0]?.name ?? \"light\";\n}\n\nconst currentName = ref<string>(getInitial());\nlet previousName: string | null = null;\n\nconst currentTheme = computed<ThemeDefinition>(\n    () =>\n        props.themes.find(\n            (t: ThemeDefinition) => t.name === currentName.value,\n        ) ?? props.themes[0],\n);\n\nconst isDark = computed<boolean>(() => {\n    const bg = currentTheme.value.colors.background;\n    if (bg) {\n        try {\n            const channels = normalizeToRgbChannels(bg);\n            const parts = channels.split(' ').map(Number);\n            if (parts.length === 3 && parts.every((n) => !Number.isNaN(n))) {\n                const [r, g, b] = parts.map((v) => {\n                    const c = v / 255;\n                    return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;\n                });\n                return 0.2126 * r + 0.7152 * g + 0.0722 * b < 0.5;\n            }\n        } catch { /* fall through */ }\n    }\n    return currentName.value.toLowerCase().includes(\"dark\");\n});\n\n/** Returns the icon Component from the current theme, or null. */\nconst currentIconComponent = computed<Component | null>(\n    () => (currentTheme.value.icon ?? null) as Component | null,\n);\n\n// ── Apply to DOM ────────────────────────────────────────────────────\nfunction applyTheme(name: string) {\n    applyThemeToDom(name, previousName, {\n        strategy: props.strategy,\n        attribute: props.attribute,\n        classPrefix: props.classPrefix,\n        target: props.target,\n    });\n    previousName = name;\n\n    if (props.storage !== \"none\") {\n        writeStorage(\n            props.storageKey,\n            name,\n            props.storage as \"localStorage\" | \"sessionStorage\",\n        );\n    }\n\n    emit(\"change\", currentTheme.value);\n}\n\n// ── Actions ─────────────────────────────────────────────────────────\nfunction setTheme(name: string) {\n    if (!props.themes.some((t: ThemeDefinition) => t.name === name)) {\n        console.warn(`[VueMultipleThemes] Unknown theme: \"${name}\"`);\n        return;\n    }\n    currentName.value = name;\n}\n\nfunction nextTheme() {\n    const idx = props.themes.findIndex(\n        (t: ThemeDefinition) => t.name === currentName.value,\n    );\n    currentName.value = props.themes[(idx + 1) % props.themes.length].name;\n}\n\nfunction prevTheme() {\n    const idx = props.themes.findIndex(\n        (t: ThemeDefinition) => t.name === currentName.value,\n    );\n    currentName.value =\n        props.themes[\n            (idx - 1 + props.themes.length) % props.themes.length\n        ].name;\n}\n\nfunction toggleTheme() {\n    if (props.themes.length < 2) return;\n    if (props.themes.length === 2) {\n        // Classic two-theme toggle\n        const other = props.themes.find(\n            (t: ThemeDefinition) => t.name !== currentName.value,\n        );\n        if (other) currentName.value = other.name;\n    } else {\n        // 3+ themes: cycle to next\n        nextTheme();\n    }\n}\n\n// ── Lifecycle ────────────────────────────────────────────────────────\n// Apply immediately in browser context to prevent flash of wrong theme on refresh.\nfunction ensureStylesAndApply() {\n    if (props.injectCssVars) {\n        const css = buildCssVars(props.themes, {\n            strategy: props.strategy,\n            attribute: props.attribute,\n            classPrefix: props.classPrefix,\n            cssVarPrefix: props.cssVarPrefix,\n            target: props.target,\n        });\n        injectStyles(css);\n    }\n    applyTheme(currentName.value);\n}\n\nlet appliedInSetup = false;\nif (typeof document !== \"undefined\") {\n    ensureStylesAndApply();\n    appliedInSetup = true;\n}\n\nonMounted(() => {\n    if (!appliedInSetup) {\n        ensureStylesAndApply();\n    }\n});\n\nwatch(currentName, (name) => {\n    applyTheme(name);\n});\n\n// ── Ref-counted cleanup ─────────────────────────────────────────────\n// Only remove the shared <style> tag when ALL instances using this\n// storageKey are unmounted. Mirrors the pattern in useTheme.ts.\nconst _key = props.storageKey;\n_componentCounts.set(_key, (_componentCounts.get(_key) ?? 0) + 1);\n\nonBeforeUnmount(() => {\n    const count = (_componentCounts.get(_key) ?? 1) - 1;\n    _componentCounts.set(_key, count);\n    if (count <= 0) {\n        _componentCounts.delete(_key);\n        removeStyles();\n    }\n});\n</script>\n\n<template>\n    <div class=\"vmt-root\" :class=\"[extraClass, isDark ? 'vmt-dark' : 'vmt-light']\">\n        <!-- Default slot: completely custom UI -->\n        <slot :current=\"currentTheme\" :themes=\"themes\" :set-theme=\"setTheme\" :next-theme=\"nextTheme\"\n            :prev-theme=\"prevTheme\" :toggle-theme=\"toggleTheme\" :is-dark=\"isDark\">\n            <!-- Built-in toggle button (shown when no default slot is provided) -->\n            <button v-if=\"showToggle\" class=\"vmt-toggle\"\n                :aria-label=\"'Current theme: ' + currentTheme.label + '. Click to switch theme.'\"\n                :title=\"currentTheme.label\" @click=\"nextTheme\">\n                <!-- icon: pass a Component as theme.icon, or use the #icon slot -->\n                <span v-if=\"currentIconComponent || $slots.icon\" class=\"vmt-icon\">\n                    <slot name=\"icon\" :icon=\"currentIconComponent\" :size=\"iconSize\" :theme=\"currentTheme\">\n                        <VmtIcon v-if=\"currentIconComponent\" :as=\"currentIconComponent\" :size=\"iconSize\" />\n                    </slot>\n                </span>\n                <!-- label -->\n                <span v-if=\"showLabel\" class=\"vmt-label\">\n                    {{ currentTheme.label }}\n                </span>\n            </button>\n        </slot>\n\n        <!-- Picker slot: list of all themes -->\n        <slot name=\"picker\" :current=\"currentTheme\" :themes=\"themes\" :set-theme=\"setTheme\" />\n    </div>\n</template>\n\n<style>\n.vmt-root {\n    display: inline-flex;\n    align-items: center;\n    gap: 0.5rem;\n    position: relative;\n}\n\n.vmt-toggle {\n    display: inline-flex;\n    align-items: center;\n    gap: 0.4rem;\n    padding: 0.4rem 0.6rem;\n    border-radius: 0.5rem;\n    border: 1px solid var(--vmt-border, #e5e7eb);\n    background: var(--vmt-surface-color, transparent);\n    color: var(--vmt-text-color, inherit);\n    cursor: pointer;\n    transition: background 0.2s, border-color 0.2s;\n    outline: none;\n}\n\n.vmt-toggle:hover {\n    background: var(--vmt-surface-elevated-color, rgba(0, 0, 0, 0.05));\n}\n\n.vmt-toggle:focus-visible {\n    outline: 2px solid var(--vmt-ring-color, #4f46e5);\n    outline-offset: 2px;\n}\n\n.vmt-icon {\n    display: inline-flex;\n    align-items: center;\n    color: var(--vmt-icon-color, var(--vmt-text-color, currentColor));\n    flex-shrink: 0;\n}\n\n.vmt-label {\n    font-size: 0.875rem;\n    font-weight: 500;\n    white-space: nowrap;\n    color: var(--vmt-text-color, inherit);\n}\n</style>\n","import {\n  computed,\n  onBeforeUnmount,\n  onMounted,\n  reactive,\n  ref,\n  watch,\n} from 'vue'\nimport type { ThemeDefinition, ThemeOptions, UseThemeReturn } from '../types'\nimport { buildCssVars, injectStyles, removeStyles } from '../utils/css-injector'\nimport { normalizeToRgbChannels } from '../utils/color'\nimport { applyThemeToDom, getSystemPreference, readStorage, writeStorage } from '../utils/dom'\n\n// ─── Shared singleton state (module-level) ────────────────────────────────────\n// Allows multiple useTheme() calls to share the same reactive state when\n// options match. We track instances per storage-key.\nconst singletons = new Map<\n  string,\n  {\n    current: ReturnType<typeof ref<string>>\n    options: ThemeOptions\n    _count: number\n    _mediaCleanup?: () => void\n  }\n>()\n\nfunction getSingletonKey(options: ThemeOptions): string {\n  const base = options.storageKey ?? 'vmt-theme'\n  return options.namespace ? `${options.namespace}:${base}` : base\n}\n\n// ─── Helpers ──────────────────────────────────────────────────────────────────\n\n/**\n * Determine if a theme is \"dark\" by checking the background color luminance.\n * Falls back to name-based check if no background color is defined.\n */\nfunction isThemeDark(theme: ThemeDefinition): boolean {\n  const bg = theme.colors.background\n  if (bg) {\n    try {\n      // Normalize to RGB channels, then reconstruct hex for luminance check\n      const channels = normalizeToRgbChannels(bg)\n      const parts = channels.split(' ').map(Number)\n      if (parts.length === 3 && parts.every((n) => !Number.isNaN(n))) {\n        // Calculate relative luminance: dark if < 0.5\n        const [r, g, b] = parts.map((v) => {\n          const c = v / 255\n          return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4\n        })\n        const lum = 0.2126 * r + 0.7152 * g + 0.0722 * b\n        return lum < 0.5\n      }\n    } catch {\n      // Fall through to name-based check\n    }\n  }\n  return (theme.name ?? '').toLowerCase().includes('dark')\n}\n\n/**\n * Parse a theme's colors into `{ r, g, b }` objects.\n */\nfunction resolveThemeColors(theme: ThemeDefinition): Record<string, { r: number; g: number; b: number }> {\n  const result: Record<string, { r: number; g: number; b: number }> = {}\n  for (const [key, value] of Object.entries(theme.colors)) {\n    if (value === undefined) continue\n    try {\n      const channels = normalizeToRgbChannels(value)\n      const parts = channels.split(' ').map(Number)\n      if (parts.length === 3 && parts.every((n) => !Number.isNaN(n))) {\n        result[key] = { r: parts[0], g: parts[1], b: parts[2] }\n      }\n    } catch {\n      // Skip unparseable colors\n    }\n  }\n  return result\n}\n\n// ─── Main composable ──────────────────────────────────────────────────────────\n/**\n * `useTheme(options)` – the core Composition-API composable.\n *\n * Returns reactive `ComputedRef` values that auto-unwrap in templates and can be\n * destructured for use with `watch()`:\n *\n * ```ts\n * const { current, isDark, setTheme } = useTheme({\n *   themes: [lightTheme, darkTheme, oceanTheme],\n *   defaultTheme: 'light',\n *   strategy: 'both',\n * })\n *\n * // Watch for theme changes\n * watch(current, (name) => console.log('Theme changed to', name))\n *\n * // Use in template (auto-unwraps)\n * // <span>{{ current }}</span>\n * ```\n */\nexport function useTheme(options: ThemeOptions): UseThemeReturn {\n  const {\n    themes,\n    defaultTheme,\n    strategy = 'attribute',\n    attribute = 'data-theme',\n    classPrefix = 'theme-',\n    target = 'html',\n    storage = 'localStorage',\n    storageKey = 'vmt-theme',\n    injectCssVars = true,\n    cssVarPrefix = '--vmt-',\n    respectSystemPreference = false,\n    namespace,\n    onChange,\n    onThemeChange,\n  } = options\n\n  if (themes.length === 0) {\n    throw new Error('[vue-multiple-themes] `themes` array must not be empty.')\n  }\n\n  // ─── Resolve initial theme name ─────────────────────────────────────────\n  function getInitialTheme(): string {\n    // 1. Check storage\n    if (storage !== 'none') {\n      const stored = readStorage(storageKey, storage as 'localStorage' | 'sessionStorage')\n      if (stored && themes.some((t) => t.name === stored)) return stored\n    }\n\n    // 2. OS preference\n    if (respectSystemPreference) {\n      const pref = getSystemPreference()\n      const match = themes.find((t) => t.name === pref)\n      if (match) return match.name\n    }\n\n    // 3. Explicit default\n    if (defaultTheme && themes.some((t) => t.name === defaultTheme)) {\n      return defaultTheme\n    }\n\n    // 4. First theme\n    return themes[0].name\n  }\n\n  // ─── Singleton current-name ref ─────────────────────────────────────────\n  const singletonKey = getSingletonKey(options)\n  let singleton = singletons.get(singletonKey)\n  let currentName: ReturnType<typeof ref<string>>\n\n  if (singleton) {\n    currentName = singleton.current\n  } else {\n    currentName = ref<string>(getInitialTheme())\n    singleton = { current: currentName, options, _count: 0 }\n    singletons.set(singletonKey, singleton)\n  }\n\n  // ─── Derived state (ComputedRefs) ──────────────────────────────────────\n  const currentComputed = computed<string>(\n    () => currentName.value ?? themes[0]?.name ?? '',\n  )\n\n  const themeComputed = computed<ThemeDefinition>(\n    () => themes.find((t) => t.name === currentName.value) ?? themes[0],\n  )\n\n  const isDarkComputed = computed<boolean>(() => isThemeDark(themeComputed.value))\n\n  const resolvedColorsComputed = computed<Record<string, { r: number; g: number; b: number }>>(\n    () => resolveThemeColors(themeComputed.value),\n  )\n\n  // ─── Apply theme to DOM ─────────────────────────────────────────────────\n  let previousName: string | null = null\n\n  function applyTheme(name: string) {\n    const oldName = previousName\n\n    // Add transition class for smooth color changes\n    if (typeof document !== 'undefined' && oldName !== null) {\n      const el = document.documentElement\n      el.classList.add('vmt-transitioning')\n      // Remove after transition completes\n      setTimeout(() => el.classList.remove('vmt-transitioning'), 250)\n    }\n\n    applyThemeToDom(name, previousName, { strategy, attribute, classPrefix, target })\n    previousName = name\n\n    if (storage !== 'none') {\n      writeStorage(storageKey, name, storage as 'localStorage' | 'sessionStorage')\n    }\n\n    const def = themes.find((t) => t.name === name) ?? themes[0]\n    onChange?.(def)\n\n    // Fire onThemeChange callback with old and new theme names\n    if (onThemeChange && oldName !== null && oldName !== name) {\n      onThemeChange(name, oldName)\n    }\n\n    // Dispatch DOM custom event for non-Vue consumers\n    if (typeof document !== 'undefined') {\n      document.dispatchEvent(\n        new CustomEvent('vmt:theme-change', {\n          detail: { theme: name, previous: oldName, definition: def },\n        }),\n      )\n    }\n  }\n\n  // ─── Inject CSS vars (once) ─────────────────────────────────────────────\n  function ensureStyles() {\n    if (!injectCssVars) return\n    const css = buildCssVars(themes, { strategy, attribute, classPrefix, cssVarPrefix, target, namespace })\n    injectStyles(css, namespace)\n  }\n\n  // ─── Actions ────────────────────────────────────────────────────────────\n  function setTheme(name: string) {\n    if (!themes.some((t) => t.name === name)) {\n      console.warn(`[vue-multiple-themes] Unknown theme: \"${name}\"`)\n      return\n    }\n    currentName.value = name\n  }\n\n  function nextTheme() {\n    const idx = themes.findIndex((t) => t.name === currentName.value)\n    currentName.value = themes[(idx + 1) % themes.length].name\n  }\n\n  function prevTheme() {\n    const idx = themes.findIndex((t) => t.name === currentName.value)\n    currentName.value = themes[(idx - 1 + themes.length) % themes.length].name\n  }\n\n  function toggleTheme() {\n    if (themes.length < 2) return\n    if (themes.length === 2) {\n      const other = themes.find((t) => t.name !== currentName.value) ?? themes[1]\n      currentName.value = other.name\n    } else {\n      nextTheme()\n    }\n  }\n\n  // ─── System preference watcher ──────────────────────────────────────────\n  function setupSystemPreferenceWatcher() {\n    if (typeof window === 'undefined') return\n    if (!respectSystemPreference) return\n    if (singleton!._mediaCleanup) return // Already watching\n\n    const mql = window.matchMedia('(prefers-color-scheme: dark)')\n    const handler = (e: MediaQueryListEvent) => {\n      const pref = e.matches ? 'dark' : 'light'\n      const match = themes.find((t) => t.name === pref)\n      if (match) {\n        currentName.value = match.name\n      }\n    }\n    mql.addEventListener('change', handler)\n    singleton!._mediaCleanup = () => mql.removeEventListener('change', handler)\n  }\n\n  // ─── Lifecycle ──────────────────────────────────────────────────────────\n  let appliedInSetup = false\n  if (typeof document !== 'undefined') {\n    ensureStyles()\n    const initialName = currentName.value\n    if (initialName) applyTheme(initialName)\n    appliedInSetup = true\n    setupSystemPreferenceWatcher()\n  }\n\n  onMounted(() => {\n    if (!appliedInSetup) {\n      ensureStyles()\n      const mountedName = currentName.value\n      if (mountedName) applyTheme(mountedName)\n      setupSystemPreferenceWatcher()\n    }\n  })\n\n  watch(currentName, (name) => {\n    if (name) applyTheme(name)\n  })\n\n  // Clean up injected styles only when ALL instances are unmounted\n  singleton._count++\n\n  onBeforeUnmount(() => {\n    const entry = singletons.get(singletonKey)\n    if (entry) {\n      entry._count--\n      if (entry._count <= 0) {\n        // Clean up system preference watcher\n        entry._mediaCleanup?.()\n        singletons.delete(singletonKey)\n        removeStyles(namespace)\n      }\n    }\n  })\n\n  // Wrap in reactive() so ComputedRef properties auto-unwrap in Vue templates.\n  // Both access patterns work:\n  //   Template: {{ ts.current }}     — auto-unwrapped by reactive()\n  //   Script:   ts.current.value     — still a ComputedRef when destructured\n  //   Script:   const { current } = ts; current.value — works as Ref\n  return reactive({\n    current: currentComputed,\n    theme: themeComputed,\n    isDark: isDarkComputed,\n    themes,\n    resolvedColors: resolvedColorsComputed,\n    setTheme,\n    nextTheme,\n    prevTheme,\n    toggleTheme,\n  }) as UseThemeReturn\n}\n","<script setup lang=\"ts\">\n/**\n * VmtThemePicker.vue\n *\n * Headless dropdown/popover for selecting themes.\n * Provides keyboard navigation (arrow keys, Enter, Escape) and full ARIA support.\n * No built-in styles — use slots and Tailwind classes for custom styling.\n *\n * @example\n * ```vue\n * <VmtThemePicker :themes=\"themes\" v-slot=\"{ open, toggle, items, activeIndex }\">\n *   <button @click=\"toggle\">{{ current }}</button>\n *   <ul v-if=\"open\">\n *     <li v-for=\"(item, i) in items\" :key=\"item.name\"\n *         :class=\"{ active: i === activeIndex }\"\n *         @click=\"item.select()\">\n *       {{ item.label }}\n *     </li>\n *   </ul>\n * </VmtThemePicker>\n * ```\n */\nimport { computed, ref, onMounted, onBeforeUnmount } from 'vue'\nimport type { ThemeDefinition, ThemeOptions } from '../types'\nimport { useTheme } from '../composables/useTheme'\n\nconst props = withDefaults(\n  defineProps<{\n    /** All available themes */\n    themes: ThemeDefinition[]\n    /** Theme options passed to useTheme */\n    defaultTheme?: string\n    strategy?: ThemeOptions['strategy']\n    storage?: ThemeOptions['storage']\n    storageKey?: string\n    /** Close dropdown when a theme is selected. Default: true */\n    closeOnSelect?: boolean\n  }>(),\n  {\n    strategy: 'both',\n    storage: 'localStorage',\n    storageKey: 'vmt-theme',\n    closeOnSelect: true,\n  },\n)\n\nconst emit = defineEmits<{\n  (e: 'select', theme: ThemeDefinition): void\n  (e: 'open'): void\n  (e: 'close'): void\n}>()\n\nconst themeApi = useTheme({\n  themes: props.themes,\n  defaultTheme: props.defaultTheme,\n  strategy: props.strategy,\n  storage: props.storage,\n  storageKey: props.storageKey,\n})\n\nconst isOpen = ref(false)\nconst activeIndex = ref(-1)\nconst pickerRef = ref<HTMLElement | null>(null)\n\nfunction toggle() {\n  isOpen.value = !isOpen.value\n  if (isOpen.value) {\n    activeIndex.value = props.themes.findIndex((t) => t.name === themeApi.current)\n    emit('open')\n  } else {\n    emit('close')\n  }\n}\n\nfunction open() {\n  if (!isOpen.value) {\n    isOpen.value = true\n    activeIndex.value = props.themes.findIndex((t) => t.name === themeApi.current)\n    emit('open')\n  }\n}\n\nfunction close() {\n  if (isOpen.value) {\n    isOpen.value = false\n    activeIndex.value = -1\n    emit('close')\n  }\n}\n\nfunction selectTheme(theme: ThemeDefinition) {\n  themeApi.setTheme(theme.name)\n  emit('select', theme)\n  if (props.closeOnSelect) {\n    close()\n  }\n}\n\nfunction onKeydown(e: KeyboardEvent) {\n  if (!isOpen.value) {\n    if (e.key === 'Enter' || e.key === ' ' || e.key === 'ArrowDown') {\n      e.preventDefault()\n      open()\n    }\n    return\n  }\n\n  switch (e.key) {\n    case 'ArrowDown':\n      e.preventDefault()\n      activeIndex.value = (activeIndex.value + 1) % props.themes.length\n      break\n    case 'ArrowUp':\n      e.preventDefault()\n      activeIndex.value = (activeIndex.value - 1 + props.themes.length) % props.themes.length\n      break\n    case 'Enter':\n    case ' ':\n      e.preventDefault()\n      if (activeIndex.value >= 0) {\n        selectTheme(props.themes[activeIndex.value])\n      }\n      break\n    case 'Escape':\n      e.preventDefault()\n      close()\n      break\n    case 'Home':\n      e.preventDefault()\n      activeIndex.value = 0\n      break\n    case 'End':\n      e.preventDefault()\n      activeIndex.value = props.themes.length - 1\n      break\n  }\n}\n\n// Close on outside click\nfunction onClickOutside(e: MouseEvent) {\n  if (pickerRef.value && !pickerRef.value.contains(e.target as Node)) {\n    close()\n  }\n}\n\nonMounted(() => {\n  document.addEventListener('click', onClickOutside, true)\n})\n\nonBeforeUnmount(() => {\n  document.removeEventListener('click', onClickOutside, true)\n})\n\nconst items = computed(() =>\n  props.themes.map((theme) => ({\n    name: theme.name,\n    label: theme.label ?? theme.name,\n    icon: theme.icon,\n    colors: theme.colors,\n    isActive: theme.name === themeApi.current,\n    select: () => selectTheme(theme),\n  })),\n)\n</script>\n\n<template>\n  <div\n    ref=\"pickerRef\"\n    role=\"listbox\"\n    :aria-expanded=\"isOpen\"\n    aria-label=\"Theme picker\"\n    @keydown=\"onKeydown\"\n    tabindex=\"0\"\n  >\n    <slot\n      :open=\"isOpen\"\n      :toggle=\"toggle\"\n      :close=\"close\"\n      :items=\"items\"\n      :active-index=\"activeIndex\"\n      :current=\"themeApi.current\"\n      :current-theme=\"themeApi.theme\"\n      :is-dark=\"themeApi.isDark\"\n      :set-theme=\"themeApi.setTheme\"\n      :next-theme=\"themeApi.nextTheme\"\n      :prev-theme=\"themeApi.prevTheme\"\n      :toggle-theme=\"themeApi.toggleTheme\"\n    />\n  </div>\n</template>\n","/**\n * Vue plugin for vue-multiple-themes.\n *\n * Registers `<VueMultipleThemes>` globally and optionally applies the initial\n * theme before the app mounts (useful for SSR / SSG hydration).\n *\n * @example Vue 3\n * ```ts\n * import { createApp } from 'vue'\n * import { VueMultipleThemesPlugin } from 'vue-multiple-themes'\n *\n * createApp(App).use(VueMultipleThemesPlugin, {\n *   themes: myThemes,\n *   defaultTheme: 'light',\n *   strategy: 'both',\n * }).mount('#app')\n * ```\n *\n * @example Vue 2\n * ```js\n * import Vue from 'vue'\n * import { VueMultipleThemesPlugin } from 'vue-multiple-themes'\n *\n * Vue.use(VueMultipleThemesPlugin, {\n *   themes: myThemes,\n *   defaultTheme: 'light',\n * })\n * ```\n */\n\nimport { type App } from 'vue'\nimport VueMultipleThemes from './components/VueMultipleThemes.vue'\nimport type { ThemeOptions } from './types'\nimport { buildCssVars, injectStyles } from './utils/css-injector'\nimport { applyThemeToDom, getSystemPreference, readStorage, writeStorage } from './utils/dom'\n\nexport const VueMultipleThemesPlugin = {\n  install(app: App, options: ThemeOptions = { themes: [] }) {\n    const {\n      themes,\n      defaultTheme,\n      strategy = 'attribute',\n      attribute = 'data-theme',\n      classPrefix = 'theme-',\n      target = 'html',\n      storage = 'localStorage',\n      storageKey = 'vmt-theme',\n      injectCssVars = true,\n      cssVarPrefix = '--vmt-',\n      respectSystemPreference = false,\n      namespace,\n    } = options\n\n    if (themes.length === 0) {\n      console.warn('[vue-multiple-themes] Plugin installed with empty themes array.')\n      return\n    }\n\n    // ── Resolve & apply initial theme immediately (before mount) ─────────\n    let initialTheme = themes[0]?.name ?? 'light'\n    let fromStorage = false\n\n    // 1. Check storage first (highest priority — user's previous choice)\n    if (storage !== 'none') {\n      const stored = readStorage(storageKey, storage as 'localStorage' | 'sessionStorage')\n      if (stored && themes.some((t) => t.name === stored)) {\n        initialTheme = stored\n        fromStorage = true\n      }\n    }\n\n    // 2. OS preference (only when nothing was stored)\n    if (!fromStorage && respectSystemPreference) {\n      const pref = getSystemPreference()\n      const match = themes.find((t) => t.name === pref)\n      if (match) initialTheme = match.name\n    }\n\n    // 3. Explicit default (only when neither storage nor OS preference matched)\n    if (!fromStorage && initialTheme === (themes[0]?.name ?? 'light') && defaultTheme && themes.some((t) => t.name === defaultTheme)) {\n      initialTheme = defaultTheme\n    }\n\n    // Inject CSS vars into <head> immediately\n    if (injectCssVars) {\n      const css = buildCssVars(themes, { strategy, attribute, classPrefix, cssVarPrefix, target, namespace })\n      injectStyles(css, namespace)\n    }\n\n    // Persist the resolved theme so the composable picks up the same value\n    if (storage !== 'none') {\n      writeStorage(storageKey, initialTheme, storage as 'localStorage' | 'sessionStorage')\n    }\n\n    // Apply theme to DOM\n    applyThemeToDom(initialTheme, null, { strategy, attribute, classPrefix, target })\n\n    // ── Register global component ─────────────────────────────────────────\n    app.component('VueMultipleThemes', VueMultipleThemes)\n\n    // ── Provide the options for injection ────────────────────────────────\n    if (typeof app.provide === 'function') {\n      const provideKey = namespace ? `vmt:options:${namespace}` : 'vmt:options'\n      app.provide(provideKey, options)\n    }\n  },\n}\n","/**\n * `createBrandContext` — factory for isolated, namespaced theme contexts.\n *\n * Use this when you need multiple independent theme engines in the same Vue\n * application — e.g. white-label setups, micro-frontends, or embeddable\n * widgets where each brand manages its own palette, storage key, and CSS\n * variable namespace.\n *\n * Each context gets:\n * - A scoped `<style>` tag (`id=\"vmt-theme-styles-<namespace>\"`)\n * - An isolated singleton reactive state (keyed by `<namespace>:<storageKey>`)\n * - A namespaced `provide` key (`\"vmt:options:<namespace>\"`)\n *\n * @example\n * ```ts\n * // brand-a.ts\n * import { createBrandContext } from 'vue-multiple-themes'\n * import brandAThemes from './themes/brand-a'\n *\n * export const brandA = createBrandContext({\n *   namespace: 'brand-a',\n *   themes: brandAThemes,\n *   storageKey: 'brand-a-theme',\n *   cssVarPrefix: '--brand-a-',\n *   defaultTheme: 'light',\n *   strategy: 'both',\n * })\n *\n * // In main.ts:\n * app.use(brandA.BrandPlugin)\n *\n * // In any component:\n * const { current, setTheme, isDark } = brandA.useTheme()\n * ```\n *\n * @example Multiple brands in one app\n * ```ts\n * const acme = createBrandContext({ namespace: 'acme', themes: acmeThemes, cssVarPrefix: '--acme-' })\n * const beta = createBrandContext({ namespace: 'beta', themes: betaThemes, cssVarPrefix: '--beta-' })\n *\n * app.use(acme.BrandPlugin)\n * app.use(beta.BrandPlugin)\n * ```\n */\n\nimport type { App } from 'vue'\nimport type { ThemeOptions, UseThemeReturn } from '../types'\nimport { useTheme } from './useTheme'\nimport { VueMultipleThemesPlugin } from '../plugin'\n\nexport interface BrandContext {\n  /** The namespace string that was used to create this context. */\n  readonly namespace: string\n  /**\n   * Composable — returns the reactive theme state for this brand context.\n   * Optionally accepts partial overrides (e.g. to temporarily swap themes).\n   */\n  useTheme: (overrides?: Partial<ThemeOptions>) => UseThemeReturn\n  /**\n   * Vue plugin — install this into your `app` to register the global\n   * `<VueMultipleThemes>` component and apply the initial theme.\n   *\n   * @example app.use(brandA.BrandPlugin)\n   * @example app.use(brandA.BrandPlugin, { defaultTheme: 'dark' }) // override\n   */\n  BrandPlugin: {\n    install: (app: App, overrides?: Partial<ThemeOptions>) => void\n  }\n}\n\n/**\n * Create an isolated, namespaced brand context.\n *\n * @param defaults - Base options for this brand. `namespace` is required and\n *   must be **unique per application** to prevent state collisions.\n */\nexport function createBrandContext(\n  defaults: ThemeOptions & { namespace: string },\n): BrandContext {\n  const { namespace } = defaults\n\n  return {\n    namespace,\n\n    useTheme(overrides?: Partial<ThemeOptions>): UseThemeReturn {\n      return useTheme({ ...defaults, ...overrides, namespace })\n    },\n\n    BrandPlugin: {\n      install(app: App, overrides: Partial<ThemeOptions> = {}): void {\n        VueMultipleThemesPlugin.install(app, { ...defaults, ...overrides, namespace })\n      },\n    },\n  }\n}\n","/**\n * @deprecated The built-in icon registry has been removed in v6.\n *\n * Import icon components directly from `lucide-vue-next` or any Vue icon\n * library and pass them via `<VmtIcon :as=\"IconComponent\" />` or\n * `ThemeDefinition.icon`.\n *\n * @module\n */\n\n/**\n * @deprecated No icon data is shipped by vue-multiple-themes.\n * Import icon components directly from lucide-vue-next or any Vue icon library\n * and pass them to <VmtIcon :as=\"IconComponent\" /> or ThemeDefinition.icon.\n */\nexport const LUCIDE_ICONS: Record<string, never> = {}\n\n/** @deprecated See LUCIDE_ICONS. */\nexport interface LucideIconData {\n  path: string\n  extra?: string\n}\n\n/** @deprecated See LUCIDE_ICONS. */\nexport function getIcon(_name: string): undefined {\n  return undefined\n}\n\n/**\n * @deprecated The built-in SVG path registry has been removed.\n * Returns an empty string. Replace with your icon library.\n */\nexport function iconToSvg(_name: string, _size?: number, _color?: string, _strokeWidth?: number): string {\n  return ''\n}\n","/**\n * generate-theme.ts\n *\n * Developer-experience utilities that solve the #1 pain point:\n * \"I have a brand color — how do I get a full theme from it?\"\n *\n * Core functions:\n *   generateLightTheme(baseColor, options)  → ThemeDefinition\n *   generateDarkTheme(baseColor, options)   → ThemeDefinition\n *   generateThemePair(baseColor, options)   → [light, dark] ThemeDefinition[]\n *   generateSeasonalTheme(season, options)  → ThemeDefinition\n *   generateFromCssVar(varName, options)    → CSS string (runtime, browser-only)\n */\n\nimport type { Component } from 'vue'\nimport type { ThemeColors, ThemeDefinition } from '../types'\nimport {\n  autoContrast,\n  contrastRatio,\n  ensureContrast,\n  hexToHsl,\n  hslToHex,\n  lighten,\n  mix,\n  saturate,\n  withAlpha,\n} from './color'\n\nexport interface GenerateThemeOptions {\n  /** Theme name (slug used in DOM, e.g. 'brand-light') */\n  name?: string\n  /** Human-readable label */\n  label?: string\n  /** Optional icon component (e.g. from `lucide-vue-next`) */\n  icon?: Component\n  /**\n   * Saturation boost/reduction for background tones.\n   * Positive = more colorful surfaces, negative = more neutral.\n   * Default: 0\n   */\n  saturationBias?: number\n  /**\n   * Whether to tint surfaces with the brand hue (default: true).\n   * Set false for pure white/dark surfaces.\n   */\n  tintedSurfaces?: boolean\n  /**\n   * Accent color override. Defaults to an analogous color of the primary.\n   */\n  accentColor?: string\n  /**\n   * Extra classes appended to the theme's `extraClasses` array.\n   */\n  extraClasses?: string[]\n}\n\n// ─── Light theme generator ────────────────────────────────────────────────────\n\n/**\n * Generate a WCAG-compliant light theme from a single brand color.\n *\n * @example\n * const myTheme = generateLightTheme('#7c3aed', { name: 'brand', label: 'Brand' })\n */\nexport function generateLightTheme(\n  primaryHex: string,\n  options: GenerateThemeOptions = {},\n): ThemeDefinition {\n  const {\n    name = 'generated-light',\n    label = 'Light',\n    icon,\n    saturationBias = 0,\n    tintedSurfaces = true,\n    accentColor,\n    extraClasses = [],\n  } = options\n\n  const [h, s] = hexToHsl(primaryHex)\n  const surfaceSat = tintedSurfaces ? Math.max(0, s * 0.08 + saturationBias) : 0\n  const secondary = hslToHex(h, Math.max(0, s - 15), Math.min(70, hexToHsl(primaryHex)[2] + 10))\n  const accent = accentColor ?? hslToHex((h + 30) % 360, Math.min(100, s + 5), 55)\n\n  const background = hslToHex(h, surfaceSat, 99)\n  const surface = hslToHex(h, surfaceSat + 1, 97)\n  const surfaceElevated = hslToHex(h, surfaceSat + 2, 94)\n  const border = hslToHex(h, surfaceSat + 4, 88)\n\n  // Ensure primary is visible on white background (darken if needed)\n  const primary = ensureContrast(primaryHex, background, 3)\n\n  const text = ensureContrast(hslToHex(h, Math.min(20, s * 0.3), 12), background, 7)\n  const textMuted = ensureContrast(hslToHex(h, Math.min(15, s * 0.2), 40), background, 4.5)\n  const textInverse = autoContrast(primary, '#ffffff', '#000000') === '#ffffff'\n    ? '#ffffff'\n    : '#1a1a1a'\n\n  const colors: ThemeColors = {\n    primary,\n    secondary,\n    accent,\n    background,\n    surface,\n    surfaceElevated,\n    text,\n    textMuted,\n    textInverse,\n    border,\n    ring: withAlpha(primary, 0.4),\n    success: '#16a34a',\n    warning: '#d97706',\n    error: '#dc2626',\n    info: primary,\n  }\n\n  return { name, label, icon, colors, extraClasses }\n}\n\n// ─── Dark theme generator ─────────────────────────────────────────────────────\n\n/**\n * Generate a WCAG-compliant dark theme from a single brand color.\n *\n * @example\n * const myDark = generateDarkTheme('#7c3aed', { name: 'brand-dark', label: 'Dark' })\n */\nexport function generateDarkTheme(\n  primaryHex: string,\n  options: GenerateThemeOptions = {},\n): ThemeDefinition {\n  const {\n    name = 'generated-dark',\n    label = 'Dark',\n    icon,\n    saturationBias = 0,\n    tintedSurfaces = true,\n    accentColor,\n    extraClasses = [],\n  } = options\n\n  const [h, s] = hexToHsl(primaryHex)\n  const surfaceSat = tintedSurfaces ? Math.max(0, s * 0.12 + saturationBias) : 0\n\n  // Lighten the primary so it's visible on dark backgrounds\n  const primary = lighten(saturate(primaryHex, 10), 15)\n  const secondary = hslToHex(h, Math.max(0, s - 10), 75)\n  const accent = accentColor ?? hslToHex((h + 30) % 360, Math.min(100, s + 10), 70)\n\n  const background = hslToHex(h, surfaceSat, 7)\n  const surface = hslToHex(h, surfaceSat + 1, 11)\n  const surfaceElevated = hslToHex(h, surfaceSat + 2, 16)\n  const border = hslToHex(h, surfaceSat + 3, 22)\n\n  const text = hslToHex(h, Math.min(15, s * 0.1), 96)\n  const textMuted = hslToHex(h, Math.min(12, s * 0.08), 60)\n  const textInverse = hslToHex(h, Math.min(20, s * 0.3), 10)\n\n  const colors: ThemeColors = {\n    primary,\n    secondary,\n    accent,\n    background,\n    surface,\n    surfaceElevated,\n    text,\n    textMuted,\n    textInverse,\n    border,\n    ring: withAlpha(primary, 0.5),\n    success: '#4ade80',\n    warning: '#fb923c',\n    error: '#f87171',\n    info: primary,\n  }\n\n  return { name, label, icon, colors, extraClasses }\n}\n\n// ─── Pair generator ───────────────────────────────────────────────────────────\n\n/**\n * Generate a matched [light, dark] `ThemeDefinition` pair from one color.\n *\n * @example\n * const [light, dark] = generateThemePair('#7c3aed')\n * app.use(VueMultipleThemesPlugin, { themes: [...generateThemePair('#7c3aed')] })\n */\nexport function generateThemePair(\n  primaryHex: string,\n  options: {\n    lightName?: string\n    darkName?: string\n    lightLabel?: string\n    darkLabel?: string\n    saturationBias?: number\n    tintedSurfaces?: boolean\n  } = {},\n): [ThemeDefinition, ThemeDefinition] {\n  const {\n    lightName = 'light',\n    darkName = 'dark',\n    lightLabel = 'Light',\n    darkLabel = 'Dark',\n    saturationBias,\n    tintedSurfaces,\n  } = options\n\n  return [\n    generateLightTheme(primaryHex, {\n      name: lightName,\n      label: lightLabel,\n      saturationBias,\n      tintedSurfaces,\n    }),\n    generateDarkTheme(primaryHex, {\n      name: darkName,\n      label: darkLabel,\n      saturationBias,\n      tintedSurfaces,\n    }),\n  ]\n}\n\n// ─── Palette from multiple brand colors ───────────────────────────────────────\n\nexport interface BrandPalette {\n  primary: string\n  secondary?: string\n  accent?: string\n}\n\n/**\n * Generate a full theme from a complete brand palette.\n * More control than the single-color generators.\n */\nexport function generateThemeFromPalette(\n  palette: BrandPalette,\n  variant: 'light' | 'dark',\n  options: GenerateThemeOptions = {},\n): ThemeDefinition {\n  const base = variant === 'light'\n    ? generateLightTheme(palette.primary, options)\n    : generateDarkTheme(palette.primary, options)\n\n  return {\n    ...base,\n    colors: {\n      ...base.colors,\n      ...(palette.secondary ? { secondary: palette.secondary } : {}),\n      ...(palette.accent ? { accent: palette.accent } : {}),\n    },\n  }\n}\n\n// ─── Seasonal / mood presets ──────────────────────────────────────────────────\n\ntype Season = 'spring' | 'summer' | 'autumn' | 'winter' | 'midnight' | 'neon' | 'pastel'\n\nconst SEASON_COLORS: Record<Season, string> = {\n  spring: '#34d399',   // emerald green\n  summer: '#f59e0b',   // amber\n  autumn: '#b45309',   // burnt orange\n  winter: '#7dd3fc',   // icy blue\n  midnight: '#6366f1', // indigo\n  neon:  '#22d3ee',    // cyan\n  pastel: '#f9a8d4',   // rose\n}\n\n/**\n * Generate a light + dark theme pair for a named mood/season.\n *\n * @example\n * const themes = generateSeasonalThemes('midnight')\n */\nexport function generateSeasonalThemes(season: Season): [ThemeDefinition, ThemeDefinition] {\n  const base = SEASON_COLORS[season]\n  return generateThemePair(base, {\n    lightName: `${season}-light`,\n    darkName: `${season}-dark`,\n    lightLabel: `${capitalize(season)} Light`,\n    darkLabel: `${capitalize(season)} Dark`,\n  })\n}\n\n// ─── CSS color-mix() integration (browser only) ───────────────────────────────\n\n/**\n * Build CSS custom properties using `color-mix()` so the browser does the\n * heavy lifting at runtime. Returns a CSS string ready to inject into a\n * `<style>` tag.\n *\n * > **Browser-only**: `color-mix()` requires a modern browser (Chrome 111+,\n * > Firefox 113+, Safari 16.2+). For SSR or older browsers, prefer the\n * > static generators above.\n *\n * @example\n * import { buildCssMixTheme } from 'vue-multiple-themes'\n * const css = buildCssMixTheme('#7c3aed', 'brand')\n * document.head.insertAdjacentHTML('beforeend', `<style>${css}</style>`)\n */\nexport function buildCssMixTheme(\n  primaryHex: string,\n  name: string,\n  variant: 'light' | 'dark' = 'light',\n): string {\n  const base = variant === 'dark' ? '#000000' : '#ffffff'\n  const selector = `[data-theme=\"${name}\"]`\n\n  const steps = variant === 'light'\n    ? { bg: '98%', surface: '95%', border: '85%', text: '10%' }\n    : { bg: '8%', surface: '14%', border: '24%', text: '96%' }\n\n  return `\n${selector} {\n  --vmt-primary: ${primaryHex};\n  --vmt-background: color-mix(in oklch, ${primaryHex} 3%, ${base} ${steps.bg});\n  --vmt-surface: color-mix(in oklch, ${primaryHex} 5%, ${base} ${steps.surface});\n  --vmt-surface-elevated: color-mix(in oklch, ${primaryHex} 8%, ${base});\n  --vmt-border: color-mix(in oklch, ${primaryHex} 15%, ${base} ${steps.border});\n  --vmt-foreground: color-mix(in oklch, ${primaryHex} 10%, ${base === '#ffffff' ? '#000000' : '#ffffff'} ${steps.text});\n  --vmt-foreground-muted: color-mix(in oklch, var(--vmt-foreground) 60%, ${base});\n  --vmt-ring: color-mix(in oklch, ${primaryHex} 50%, transparent);\n}`.trim()\n}\n\n// ─── Adaptive theme (detects CSS vars at runtime, browser-only) ───────────────\n\n/**\n * Read the current CSS custom properties from the document and return them\n * as a `ThemeColors` object. Useful for syncing with design tokens from\n * another design system.\n *\n * @browser-only\n */\nexport function readCssVarsAsColors(\n  varMap: Partial<Record<keyof ThemeColors, string>>,\n  element: Element = document.documentElement,\n): Partial<ThemeColors> {\n  const styles = getComputedStyle(element)\n  const result: Partial<ThemeColors> = {}\n  for (const [key, varName] of Object.entries(varMap)) {\n    const value = styles.getPropertyValue(varName as string).trim()\n    if (value) {\n      result[key as keyof ThemeColors] = value\n    }\n  }\n  return result\n}\n\n// ─── Contrast checker utility ─────────────────────────────────────────────────\n\nexport interface ContrastReport {\n  ratio: number\n  aa: boolean\n  aaLarge: boolean\n  aaa: boolean\n  aaaLarge: boolean\n}\n\n/**\n * Analyse a text/background color combination against WCAG 2.1 levels.\n *\n * @example\n * const report = checkContrast('#7c3aed', '#ffffff')\n * console.log(report.aa)  // true\n */\nexport function checkContrast(foreground: string, background: string): ContrastReport {\n  const ratio = contrastRatio(foreground, background)\n  return {\n    ratio: Math.round(ratio * 100) / 100,\n    aa: ratio >= 4.5,\n    aaLarge: ratio >= 3,\n    aaa: ratio >= 7,\n    aaaLarge: ratio >= 4.5,\n  }\n}\n\n// ─── Helpers ──────────────────────────────────────────────────────────────────\n\nfunction capitalize(s: string): string {\n  return s.charAt(0).toUpperCase() + s.slice(1)\n}\n","import type { ThemeDefinition } from '../types'\n\n// ─── Light (default) ──────────────────────────────────────────────────────────\nexport const lightTheme: ThemeDefinition = {\n  name: 'light',\n  label: 'Light',\n  colors: {\n    primary: '#3b82f6',\n    primaryLight: '#93c5fd',\n    primaryDark: '#1d4ed8',\n    secondary: '#8b5cf6',\n    accent: '#f59e0b',\n    background: '#ffffff',\n    surface: '#f8fafc',\n    surfaceElevated: '#f1f5f9',\n    text: '#111827',\n    textMuted: '#6b7280',\n    textInverse: '#ffffff',\n    border: '#e5e7eb',\n    ring: '#3b82f6',\n    success: '#10b981',\n    warning: '#f59e0b',\n    error: '#ef4444',\n    info: '#3b82f6',\n  },\n}\n\n// ─── Dark ─────────────────────────────────────────────────────────────────────\nexport const darkTheme: ThemeDefinition = {\n  name: 'dark',\n  label: 'Dark',\n  colors: {\n    primary: '#60a5fa',\n    primaryLight: '#bfdbfe',\n    primaryDark: '#3b82f6',\n    secondary: '#a78bfa',\n    accent: '#fbbf24',\n    background: '#0f172a',\n    surface: '#1e293b',\n    surfaceElevated: '#334155',\n    text: '#f8fafc',\n    textMuted: '#94a3b8',\n    textInverse: '#0f172a',\n    border: '#334155',\n    ring: '#60a5fa',\n    success: '#34d399',\n    warning: '#fbbf24',\n    error: '#f87171',\n    info: '#60a5fa',\n  },\n}\n\n// ─── Sepia ────────────────────────────────────────────────────────────────────\nexport const sepiaTheme: ThemeDefinition = {\n  name: 'sepia',\n  label: 'Sepia',\n  colors: {\n    primary: '#92400e',\n    primaryLight: '#d97706',\n    primaryDark: '#78350f',\n    secondary: '#78350f',\n    accent: '#d97706',\n    background: '#fdf6e3',\n    surface: '#f5e9c9',\n    surfaceElevated: '#ede0b5',\n    text: '#3c2415',\n    textMuted: '#78583d',\n    textInverse: '#fdf6e3',\n    border: '#d6b896',\n    ring: '#92400e',\n    success: '#166534',\n    warning: '#92400e',\n    error: '#991b1b',\n    info: '#1e40af',\n  },\n}\n\n// ─── Ocean ────────────────────────────────────────────────────────────────────\nexport const oceanTheme: ThemeDefinition = {\n  name: 'ocean',\n  label: 'Ocean',\n  colors: {\n    primary: '#0ea5e9',\n    primaryLight: '#7dd3fc',\n    primaryDark: '#0369a1',\n    secondary: '#06b6d4',\n    accent: '#f0abfc',\n    background: '#0c1a2e',\n    surface: '#132338',\n    surfaceElevated: '#1b3554',\n    text: '#e0f2fe',\n    textMuted: '#7dd3fc',\n    textInverse: '#0c1a2e',\n    border: '#1e4877',\n    ring: '#0ea5e9',\n    success: '#34d399',\n    warning: '#fbbf24',\n    error: '#f87171',\n    info: '#38bdf8',\n  },\n}\n\n// ─── Forest ───────────────────────────────────────────────────────────────────\nexport const forestTheme: ThemeDefinition = {\n  name: 'forest',\n  label: 'Forest',\n  colors: {\n    primary: '#16a34a',\n    primaryLight: '#86efac',\n    primaryDark: '#166534',\n    secondary: '#15803d',\n    accent: '#84cc16',\n    background: '#052e16',\n    surface: '#14532d',\n    surfaceElevated: '#166534',\n    text: '#dcfce7',\n    textMuted: '#86efac',\n    textInverse: '#052e16',\n    border: '#166534',\n    ring: '#16a34a',\n    success: '#4ade80',\n    warning: '#facc15',\n    error: '#f87171',\n    info: '#60a5fa',\n  },\n}\n\n// ─── Sunset ───────────────────────────────────────────────────────────────────\nexport const sunsetTheme: ThemeDefinition = {\n  name: 'sunset',\n  label: 'Sunset',\n  colors: {\n    primary: '#f97316',\n    primaryLight: '#fdba74',\n    primaryDark: '#c2410c',\n    secondary: '#fb923c',\n    accent: '#facc15',\n    background: '#1c0a00',\n    surface: '#2d1507',\n    surfaceElevated: '#3f2010',\n    text: '#fff7ed',\n    textMuted: '#fdba74',\n    textInverse: '#1c0a00',\n    border: '#7c2d12',\n    ring: '#f97316',\n    success: '#4ade80',\n    warning: '#facc15',\n    error: '#f87171',\n    info: '#60a5fa',\n  },\n}\n\n// ─── Winter ───────────────────────────────────────────────────────────────────\nexport const winterTheme: ThemeDefinition = {\n  name: 'winter',\n  label: 'Winter',\n  colors: {\n    primary: '#818cf8',\n    primaryLight: '#c7d2fe',\n    primaryDark: '#4f46e5',\n    secondary: '#a5b4fc',\n    accent: '#67e8f9',\n    background: '#0f0f23',\n    surface: '#1a1a3e',\n    surfaceElevated: '#252550',\n    text: '#e0e7ff',\n    textMuted: '#a5b4fc',\n    textInverse: '#0f0f23',\n    border: '#312e81',\n    ring: '#818cf8',\n    success: '#4ade80',\n    warning: '#fbbf24',\n    error: '#f87171',\n    info: '#67e8f9',\n  },\n}\n\n// ─── All presets ──────────────────────────────────────────────────────────────\nexport const PRESET_THEMES: ThemeDefinition[] = [\n  lightTheme,\n  darkTheme,\n  sepiaTheme,\n  oceanTheme,\n  forestTheme,\n  sunsetTheme,\n  winterTheme,\n]\n"],"names":["normalizeToRgbChannels","_openBlock","_createBlock","_resolveDynamicComponent","ref","computed","onMounted","watch","onBeforeUnmount","_createElementBlock","_normalizeClass","_renderSlot","$slots","VmtIcon","_toDisplayString","reactive","_unref","VueMultipleThemes","hexToHsl","hslToHex","ensureContrast","autoContrast","withAlpha","lighten","saturate","contrastRatio"],"mappings":";;;;AAGA,MAAM,mBAAmB;AAGlB,SAAS,WAAW,WAA4B;AACrD,SAAO,YAAY,oBAAoB,SAAS,KAAK;AACvD;AAMO,SAAS,QAAQ,KAAqB;AAC3C,SAAO,IAAI,QAAQ,YAAY,CAAC,GAAG,MAAc,IAAI,EAAE,YAAA,CAAa,EAAE;AACxE;AAGO,SAAS,aACd,QACA,SACQ;AACR,QAAM;AAAA,IACJ,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,eAAe;AAAA,IACf,SAAS;AAAA,EAAA,IACP;AAEJ,QAAM,eAAe,WAAW,SAAS,UAAU;AAEnD,WAAS,cAAc,WAAmB,WAA4B;AACpE,UAAM,QAAkB,CAAA;AACxB,QAAI,UAAW,OAAM,KAAK,YAAY;AAEtC,QAAI,aAAa,eAAe,aAAa,QAAQ;AACnD,YAAM,OACJ,WAAW,SACP,SAAS,SAAS,KAAK,SAAS,OAChC,GAAG,MAAM,IAAI,SAAS,KAAK,SAAS;AAC1C,UAAI,CAAC,MAAM,SAAS,IAAI,EAAG,OAAM,KAAK,IAAI;AAAA,IAC5C;AAEA,QAAI,aAAa,WAAW,aAAa,QAAQ;AAC/C,YAAM,MAAM,GAAG,W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