uitheme-web 1.2.0 → 2.0.0-rc.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.
Files changed (51) hide show
  1. package/README.md +94 -313
  2. package/dist/chunk-CTNYTI5Q.js +1 -0
  3. package/dist/{chunk-WFG34KG5.js → chunk-CY5E6WU4.js} +3 -3
  4. package/dist/chunk-CYGYUQUK.cjs +1 -0
  5. package/dist/chunk-EKVKQZNN.js +12 -0
  6. package/dist/chunk-EQPK72XK.js +14 -0
  7. package/dist/{chunk-W4YFUPGE.cjs → chunk-I5GA5T23.cjs} +3 -3
  8. package/dist/chunk-KQSBORXP.cjs +12 -0
  9. package/dist/chunk-NDNCNR4X.js +1 -0
  10. package/dist/chunk-QM4QO6LG.cjs +26 -0
  11. package/dist/chunk-SO3CO44A.js +1 -0
  12. package/dist/chunk-YGWVUGQI.js +26 -0
  13. package/dist/{constants-DmZ7yAIL.d.cts → constants-9M8X-rnX.d.cts} +2 -68
  14. package/dist/{constants-DmZ7yAIL.d.ts → constants-PAa1nGZ0.d.ts} +2 -68
  15. package/dist/controller-83zmHd-p.d.cts +76 -0
  16. package/dist/controller-DnMwV2nl.d.ts +76 -0
  17. package/dist/core/index.cjs +1 -1
  18. package/dist/core/index.d.cts +7 -5
  19. package/dist/core/index.d.ts +7 -5
  20. package/dist/core/index.js +1 -1
  21. package/dist/index-CR2g5NEe.d.ts +106 -0
  22. package/dist/index-DQvBhaeA.d.cts +106 -0
  23. package/dist/next/index.cjs +2 -0
  24. package/dist/next/index.d.cts +4 -0
  25. package/dist/next/index.d.ts +4 -0
  26. package/dist/next/index.js +2 -0
  27. package/dist/nuxt.d.ts +10 -0
  28. package/dist/nuxt.js +34 -0
  29. package/dist/react/index.cjs +11 -89
  30. package/dist/react/index.d.cts +20 -276
  31. package/dist/react/index.d.ts +20 -276
  32. package/dist/react/index.js +11 -89
  33. package/dist/server/index.cjs +14 -0
  34. package/dist/server/index.d.cts +11 -0
  35. package/dist/server/index.d.ts +11 -0
  36. package/dist/server/index.js +14 -0
  37. package/dist/tanstack/index.cjs +1 -1
  38. package/dist/tanstack/index.d.cts +5 -3
  39. package/dist/tanstack/index.d.ts +5 -3
  40. package/dist/tanstack/index.js +1 -1
  41. package/dist/types-CrR56NLm.d.cts +79 -0
  42. package/dist/types-CrR56NLm.d.ts +79 -0
  43. package/dist/types-Dd4EU8V9.d.ts +96 -0
  44. package/dist/vue/bootstrap.d.ts +13 -0
  45. package/dist/vue/bootstrap.js +1 -0
  46. package/dist/vue/index.d.ts +39 -0
  47. package/dist/vue/index.js +1 -0
  48. package/package.json +70 -20
  49. package/dist/chunk-DFJEYTIW.js +0 -12
  50. package/dist/chunk-V3LMT5IJ.cjs +0 -12
  51. package/dist/cli/index.js +0 -39
package/README.md CHANGED
@@ -1,357 +1,138 @@
1
1
  # uitheme-web
2
2
 
3
- Web framework agnostic UI theme switching library. Built with a framework-agnostic core and React adapter. Additional framework support planned for future releases.
3
+ Theme state and animated appearance and color transitions for web applications.
4
+ The runtime has no mandatory framework or UI primitive dependencies.
4
5
 
5
- ## UI-Theme version 1 release
6
-
7
- Introducing version 1 of `uitheme-web`, a comprehensive solution for managing UI themes across web applications. This release marks a significant milestone in our journey to provide developers with a robust, flexible, and easy-to-use theming library, that supports all web javascript UI frameworks.
8
-
9
- ## Installation
10
-
11
- ```bash
12
- npm install uitheme-web
13
- ```
14
-
15
- ```bash
6
+ ```sh
16
7
  pnpm add uitheme-web
17
8
  ```
18
9
 
19
- ```bash
20
- yarn add uitheme-web
21
- ```
22
-
23
- ## Migrating from `@ui-theme/web`
24
-
25
- This package was published under the name `@ui-theme/web` before the rename. That name is deprecated. Run the migration command to move a project across:
26
-
27
- ```bash
28
- npx uitheme-web migrate
29
- ```
30
-
31
- The command lists the files it will change and asks for confirmation. It then rewrites the import specifiers, the Tailwind `@source` path, and the dependency in `package.json`. The entry point names stay the same, so `/core`, `/react` and `/tanstack` are unchanged.
32
-
33
- | Option | Effect |
34
- | ------------- | --------------------------------------- |
35
- | `--yes` | Rewrite without asking for confirmation |
36
- | `--cwd <dir>` | Work on a project in another directory |
37
- | `--help` | Show the help |
38
-
39
- The command skips `node_modules`, `dist`, `.next` and other build output. It does not change prose in your markdown files.
40
-
41
- ## Tailwind Setup For Prebuilt Components
42
-
43
- `UIThemeSwitcher`, `UIThemeSelector`, and the bundled select primitives use Tailwind utility classes. `uitheme-web` does not ship a compiled CSS file for those components, so the consuming app must include the package in Tailwind's source scan.
44
-
45
- For Tailwind v4, add an `@source` directive next to your Tailwind import:
46
-
47
- ```css
48
- @import 'tailwindcss';
49
- @source '../node_modules/uitheme-web/dist';
50
- ```
51
-
52
- Adjust the relative path to match your app structure.
53
-
54
- If you are using the prebuilt components without this setup, the controls will mount but the expected borders, spacing, typography, hover states, and dropdown styling will be missing because Tailwind never sees the classes inside the installed package.
55
-
56
- ## Provider Selection
57
-
58
- Choose the right provider for your framework:
59
-
60
- | Provider | Best For | Key Features |
61
- | ----------------------- | ------------------------------ | ------------------------------------------------ |
62
- | UIThemeProvider | All React apps | Universal provider with full feature set |
63
- | NextUIThemeProvider | Next.js, Remix, SSR frameworks | Pre-hydration script, CSP support, animations |
64
- | TanStackUIThemeProvider | TanStack Start apps | Isomorphic rendering, useHydrated() integration |
65
- | ViteUIThemeProvider | Vite React SPAs | Lightweight, transition control, no SSR overhead |
10
+ Install the framework in your app. Import only the adapter you use.
66
11
 
67
- ## Quick Start
12
+ | Import | Purpose |
13
+ | ----------------------------------- | --------------------------------------------------------------- |
14
+ | `uitheme-web` or `uitheme-web/core` | Framework-neutral controller, transitions, types, and constants |
15
+ | `uitheme-web/react` | React providers and hooks |
16
+ | `uitheme-web/next` | Next.js client provider |
17
+ | `uitheme-web/next/server` | Server-safe pre-hydration script generator |
18
+ | `uitheme-web/tanstack` | Stateless TanStack Start server helpers |
19
+ | `uitheme-web/vue` | Vue 3.5 plugin, provider, and composables |
20
+ | `uitheme-web/vue/bootstrap` | Server-safe pre-hydration script generator |
21
+ | `uitheme-web/nuxt` | Nuxt 4 module |
68
22
 
69
- ### React
23
+ Core and React support ESM and CommonJS. Vue and Nuxt use ESM. React, React DOM,
24
+ Vue, and Nuxt are optional peer dependencies. The selected adapter requires its
25
+ framework in the app. Importing the core does not load a framework.
70
26
 
71
- Basic pattern that works across all providers:
27
+ ## React
72
28
 
73
29
  ```tsx
74
- import { UIThemeProvider, useUITheme } from 'uitheme-web/react';
30
+ 'use client';
75
31
 
76
- function App() {
77
- return (
78
- <UIThemeProvider defaultTheme="system" defaultColorTheme="default">
79
- <YourApp />
80
- </UIThemeProvider>
81
- );
82
- }
32
+ import { UIThemeProvider, useUITheme } from 'uitheme-web/react';
83
33
 
84
- function ThemeToggle() {
85
- const { theme, toggleTheme, ref } = useUITheme();
34
+ function Toggle() {
35
+ const { resolvedTheme, switchTheme, mounted } = useUITheme();
86
36
 
87
37
  return (
88
- <button ref={ref} onClick={() => toggleTheme()}>
89
- {theme === 'light' ? 'Dark' : 'Light'}
38
+ <button
39
+ disabled={!mounted}
40
+ onClick={(event) =>
41
+ void switchTheme(resolvedTheme === 'dark' ? 'light' : 'dark', {
42
+ element: event.currentTarget,
43
+ })
44
+ }
45
+ >
46
+ Change appearance
90
47
  </button>
91
48
  );
92
49
  }
93
- ```
94
-
95
- **Framework Setup Guides:**
96
-
97
- - [Next.js / SSR Setup Guide](../../docs/nextjs-setup.md) - Complete guide with App Router, Pages Router, CSP support
98
- - [TanStack Start Setup Guide](../../docs/tanstack-start-setup.md) - Isomorphic rendering, hydration-safe patterns
99
- - [Vite React SPA Setup Guide](../../docs/vite-setup.md) - Client-side setup, flash prevention, routing
100
-
101
- ## Animated mode and palette changes
102
-
103
- Use `switchColorTheme`, `toggleColorTheme`, or `createColorThemeToggle` for animated palettes. `setTheme` and `setColorTheme` remain immediate setters. Every provider and the standalone hook accepts the same transition options:
104
-
105
- ```tsx
106
- const { toggleTheme, switchColorTheme } = useTheme({
107
- colorThemes: ['default', 'ocean', 'rose'],
108
- });
109
-
110
- <button onClick={(event) => void toggleTheme({
111
- element: event.currentTarget,
112
- animationOff: event.detail === 0,
113
- })}>Toggle mode</button>
114
-
115
- <button onClick={(event) => void switchColorTheme('ocean', {
116
- element: event.currentTarget,
117
- animationOff: event.detail === 0,
118
- })}>Ocean palette</button>
119
- ```
120
-
121
- `element` uses the trigger's center. `origin: { x, y }` overrides it with viewport-relative **CSS pixels**, without multiplying by `devicePixelRatio`. Without either option, the hook uses its existing button `ref`; attach a shared ref to only one trigger. Slide transitions need no trigger. Boolean calls such as `toggleTheme(true)` still disable animation.
122
-
123
- `ThemeTransitionInput` is `boolean | { element?: Element | null; origin?: { x: number; y: number }; animationOff?: boolean }`. Color helpers now return `Promise<void>`; existing fire-and-forget calls still work. `toggleColorTheme` and `createColorThemeToggle('ocean')` can be used directly as `onClick`, reading the clicked element and skipping keyboard motion.
124
-
125
- The default is 400 ms with `cubic-bezier(0.32, 0.72, 0, 1)`: a steep curve for a full-viewport reveal. Explicit durations are respected at every display size. `blurAmount` is now a feather width in CSS pixels, capped at 20 px; the gradient softens the edge without blurring the page content. Unsupported browsers, failed/skipped captures, missing circle origins, and reduced motion apply the theme without a reveal. New requests interrupt older transitions; CSS transitions are suppressed only during library-owned captures and playback.
126
-
127
- Core consumers can call `runThemeTransition(update, config)` to handle capture, scoped styles, interruption, and cleanup. The React hook uses this runner internally. Low-level animation helpers should be called **after** `transition.ready` with caller-managed pseudo-element styles. They return native `Animation` handles; cancel them when done. `styleId` remains accepted for compatibility; the native animation path no longer creates a timer-owned stylesheet with that ID.
128
-
129
- [Research, browser verification, and performance evidence](../../docs/theme-transition-verification.md).
130
-
131
- ## API Reference
132
-
133
- ### Shared Hook Return (All Providers)
134
-
135
- All providers expose the same hook interface:
136
-
137
- | Property | Type | Description |
138
- | ---------------------- | --------------------------------------------------------------------- | ---------------------------------- |
139
- | theme | Theme | Current theme |
140
- | colorTheme | ColorTheme | Current color theme |
141
- | resolvedTheme | 'light' \| 'dark' | Resolved theme (system → actual) |
142
- | systemTheme | 'light' \| 'dark' | OS theme preference |
143
- | ref | RefObject<HTMLElement> | Ref for animation origin |
144
- | setTheme | (theme: Theme) => void | Set theme instantly |
145
- | setColorTheme | (colorTheme: ColorTheme) => void | Set color theme |
146
- | switchTheme | (theme: Theme, options?: ThemeTransitionInput) => Promise<void> | Switch with animation |
147
- | switchColorTheme | (colorTheme: string, options?: ThemeTransitionInput) => Promise<void> | Switch color theme with animation |
148
- | toggleTheme | (options?: ThemeTransitionInput) => Promise<void> | Toggle light/dark |
149
- | toggleLightTheme | (options?: ThemeTransitionInput) => Promise<void> | Toggle to light |
150
- | toggleDarkTheme | (options?: ThemeTransitionInput) => Promise<void> | Toggle to dark |
151
- | toggleColorTheme | ColorThemeToggle | Toggle between color themes |
152
- | createColorThemeToggle | (colorTheme: string) => ColorThemeToggle | Create color theme toggle |
153
- | isColorThemeActive | (colorTheme: string) => boolean | Check if color theme active |
154
- | switchThemeFromElement | (theme: Theme, element: HTMLElement) => Promise<void> | Switch with animation from element |
155
-
156
- ### Provider Props
157
-
158
- | Prop | UITheme | NextUITheme | TanStackUITheme | ViteUITheme | Type | Default |
159
- | ------------------------- | ------- | ----------- | --------------- | ----------- | ------------------- | --------------------------- |
160
- | defaultTheme | ✓ | ✓ | ✓ | ✓ | Theme | 'system' |
161
- | defaultColorTheme | ✓ | ✓ | ✓ | ✓ | ColorTheme | 'default' |
162
- | themes | ✓ | ✓ | ✓ | ✓ | Theme[] | ['light', 'dark', 'system'] |
163
- | colorThemes | ✓ | ✓ | ✓ | ✓ | ColorTheme[] | ['default'] |
164
- | animationType | ✓ | ✓ | ✓ | ✓ | ThemeAnimationType | CIRCLE |
165
- | clipPathDirection | ✓ | ✓ | ✓ | ✓ | TransitionDirection | 'top-left' |
166
- | animationPosition | ✓ | ✓ | ✓ | ✓ | AnimationPosition | trigger / center fallback |
167
- | logo | ✓ | ✓ | ✓ | ✓ | string (SVG URL) | - |
168
- | logoWidth | ✓ | ✓ | ✓ | ✓ | number or "auto" | 96 / aspect ratio |
169
- | logoHeight | ✓ | ✓ | ✓ | ✓ | number or "auto" | aspect ratio |
170
- | gradientWidth | ✓ | ✓ | ✓ | ✓ | number (CSS px) | 80 |
171
- | duration | ✓ | ✓ | ✓ | ✓ | number | 400 |
172
- | storageKey | ✓ | ✓ | ✓ | ✓ | string | varies |
173
- | colorStorageKey | ✓ | ✓ | ✓ | ✓ | string | varies |
174
- | nonce | ✗ | ✓ | ✗ | ✗ | string | - |
175
- | disablePreHydrationScript | ✗ | ✓ | ✗ | ✗ | boolean | false |
176
- | disableTransitionOnChange | ✗ | ✗ | ✗ | ✓ | boolean | false |
177
- | onThemeChange | ✓ | ✓ | ✓ | ✓ | function | - |
178
- | onColorThemeChange | ✓ | ✓ | ✓ | ✓ | function | - |
179
-
180
- ### Components
181
-
182
- **UIThemeSwitcher**: Pre-built theme toggle buttons with animations
183
- **UIThemeSelector**: Dropdown selector for color themes
184
-
185
- See framework-specific guides for component usage examples.
186
-
187
- ---
188
-
189
- <details>
190
- <summary>CSS Variables Setup</summary>
191
-
192
- Define theme variables in your global CSS file:
193
-
194
- ```css
195
- :root {
196
- --background: 0 0% 100%;
197
- --foreground: 222.2 84% 4.9%;
198
- --primary: 221.2 83.2% 53.3%;
199
- }
200
-
201
- .dark {
202
- --background: 222.2 84% 4.9%;
203
- --foreground: 210 40% 98%;
204
- --primary: 217.2 91.2% 59.8%;
205
- }
206
-
207
- /* Color theme variants */
208
- .theme-blue {
209
- --primary: 221.2 83.2% 53.3%;
210
- }
211
50
 
212
- .theme-blue.dark {
213
- --primary: 217.2 91.2% 59.8%;
214
- }
215
-
216
- .theme-green {
217
- --primary: 142.1 76.2% 36.3%;
218
- }
219
-
220
- .theme-green.dark {
221
- --primary: 142.1 70.6% 45.3%;
51
+ export function App() {
52
+ return (
53
+ <UIThemeProvider>
54
+ <Toggle />
55
+ </UIThemeProvider>
56
+ );
222
57
  }
223
58
  ```
224
59
 
225
- </details>
226
-
227
- <details>
228
- <summary>Browser Support</summary>
229
-
230
- - Animated reveals require View Transitions and animation of transition pseudo-elements.
231
- - Fallback: unsupported browsers apply the theme immediately.
232
- - Reduced Motion: Respects prefers-reduced-motion
233
- - Framework Support: React 18+
234
-
235
- </details>
236
-
237
- <details>
238
- <summary>Advanced Configuration</summary>
60
+ For Next.js, use `NextUIThemeProvider` from `uitheme-web/next`. It provides
61
+ pre-hydration setup and accepts a CSP nonce. For TanStack Start, retain your
62
+ existing server helpers and cookie callbacks. Each provider shares state with
63
+ `useUITheme` from `uitheme-web/react`.
239
64
 
240
- ### Animation Control
65
+ ## Vue
241
66
 
242
- Choose `CIRCLE`, `BLUR_CIRCLE`, `SLIDE`, `CLIP_PATH`, `POLYGON_GRADIENT`,
243
- `TRIANGLE`, or `SVG_LOGO` from `ThemeAnimationType`. All effects also apply to
244
- animated color-palette changes. GIF effects are not included.
67
+ ```ts
68
+ import { createApp } from 'vue';
69
+ import { createUITheme } from 'uitheme-web/vue';
70
+ import App from './App.vue';
245
71
 
246
- ```tsx
247
- import { ThemeAnimationType, UIThemeProvider } from 'uitheme-web/react';
248
-
249
- <UIThemeProvider
250
- animationType={ThemeAnimationType.CLIP_PATH}
251
- clipPathDirection="top-right"
252
- duration={400}
253
- >
254
- <App />
255
- </UIThemeProvider>;
72
+ createApp(App)
73
+ .use(createUITheme({ colorThemes: ['default', 'ocean'] }))
74
+ .mount('#app');
256
75
  ```
257
76
 
258
- `CLIP_PATH` is a sharp polygon wipe; `POLYGON_GRADIENT` feathers its leading edge.
259
- Both accept `clipPathDirection` in clockwise order: `top-left`, `top`,
260
- `top-right`, `right`, `bottom-right`, `bottom`, `bottom-left`, `left`.
261
- `POLYGON_GRADIENT` also accepts `gradientWidth` (default: 80 CSS pixels, capped
262
- relative to the mask size).
263
-
264
- For circle, blurred circle, or triangle effects, `animationPosition` can be
265
- any of those eight positions, `center`, or `trigger`. The trigger uses the clicked
266
- element or attached ref. Triangle effects fall back to the viewport
267
- center when no trigger is available. An explicit per-call `origin` takes precedence.
77
+ Use `useUITheme()` in setup. It returns readonly `theme`, `resolvedTheme`,
78
+ `colorTheme`, and `mounted` refs, plus `setTheme`, `setColorTheme`, `switchTheme`,
79
+ and `switchColorTheme`. `UIThemeProvider` can provide an isolated nested scope.
80
+ Use `getThemeScript` from `uitheme-web/vue/bootstrap` in SSR document setup.
268
81
 
269
- ### SVG logo transition
82
+ For Nuxt 4:
270
83
 
271
- Pass a self-contained SVG file URL, such as `/brand.svg`, a bundler asset import,
272
- or a blob URL created from a file input. The SVG is displayed at a fixed size in
273
- the viewport center while a circular theme reveal expands underneath it. The
274
- logo stays still and fades out over the final 15% of the transition.
275
-
276
- ```tsx
277
- <UIThemeProvider
278
- animationType={ThemeAnimationType.SVG_LOGO}
279
- logo="/brand.svg"
280
- logoWidth={120}
281
- duration={600}
282
- >
283
- <App />
284
- </UIThemeProvider>
84
+ ```ts
85
+ export default defineNuxtConfig({
86
+ modules: ['uitheme-web/nuxt'],
87
+ uiTheme: { colorThemes: ['default', 'ocean'] },
88
+ });
285
89
  ```
286
90
 
287
- `logoWidth` and `logoHeight` accept positive CSS-pixel dimensions or `"auto"`. Either dimension
288
- alone preserves the SVG aspect ratio; both dimensions define a box with
289
- `object-fit: contain`. Without either, width defaults to 96 px. The SVG effect
290
- always uses the viewport center, including when a trigger or another animation
291
- position is provided. The logo retains its artwork colors.
91
+ The module provides composables, cookie persistence, and initial theme setup.
92
+ It does not register styled controls. Automatic Nuxt 3 setup is unsupported.
292
93
 
293
- The hook preloads and decodes the logo before capture. If it is still loading,
294
- invalid, unavailable, or not an SVG, that toggle uses the circle effect instead
295
- of waiting. Core consumers can `await preloadThemeLogo(url)` before starting a
296
- transition. Use transparent backgrounds and a suitable `viewBox`; preserve the
297
- logo's intrinsic aspect ratio. SVG markup is loaded as an image, never inserted
298
- into the page.
94
+ ## State and styles
299
95
 
300
- These options work with all four providers, `useTheme`, `UIThemeSwitcher`, and
301
- `UIThemeSelector`. Reduced motion applies the theme immediately.
96
+ `theme` is `light`, `dark`, or `system`. `colorTheme` is a separate palette key.
97
+ Configure your CSS for the `dark` class and `theme-<palette>` classes. The runtime
98
+ does not supply a design system or require Tailwind. Immediate `set*` actions
99
+ change state without animation. Await `switch*` actions for animated changes.
100
+ Pass the clicked element for a transition origin in viewport CSS pixels.
302
101
 
303
- See [animation options and browser verification](../../docs/theme-animation-options.md)
304
- for the effect gallery, research, and testing boundaries.
102
+ The runtime respects reduced motion and falls back when browser View Transitions
103
+ are unavailable. Keep provider instances stable. Each provider owns its state;
104
+ server requests do not share a global theme store.
305
105
 
306
- ```tsx
307
- const { switchTheme, toggleTheme } = useUITheme();
106
+ ## Optional styled controls
308
107
 
309
- // With animation (default)
310
- await switchTheme('dark');
108
+ Controls are editable app source. They are not runtime exports.
311
109
 
312
- // Without animation
313
- await switchTheme('dark', true);
314
- await toggleTheme(true);
110
+ ```sh
111
+ npx uitheme-cli init --dry-run
112
+ npx uitheme-cli init
113
+ npx uitheme-cli add theme-toggle theme-selector color-theme-selector
315
114
  ```
316
115
 
317
- ### Custom Hook Usage
318
-
319
- ```tsx
320
- import { useTheme } from 'uitheme-web/react';
321
-
322
- const { theme, toggleTheme, ref } = useTheme({
323
- animationType: ThemeAnimationType.BLUR_CIRCLE,
324
- duration: 750,
325
- colorThemes: ['default', 'blue', 'green'],
326
- onThemeChange: (theme) => console.log('Theme:', theme),
327
- });
328
- ```
329
-
330
- </details>
331
-
332
- ## Features
333
-
334
- - Multiple theme support (light, dark, system)
335
- - Framework-agnostic core
336
- - Persistent theme storage
337
- - SSR/SSG compatible
338
- - Tree-shakeable
339
- - TypeScript support
340
- - Zero dependencies (per framework)
341
-
342
- ## License
116
+ The CLI requires an existing Tailwind 3.4 or 4 app. Choose Base UI or Radix for
117
+ React, or Reka for Vue. The installer adds only the chosen controls and their
118
+ required dependencies. Customize local files, root classes, and internal part
119
+ classes. Keep transition settings in your app and pass them to the provider.
343
120
 
344
- MIT
121
+ ## Migration from v1
345
122
 
346
- Use `logoLight` and `logoDark` together instead of `logo` to select the current theme’s asset: `logoDark` for dark-to-light, `logoLight` for light-to-dark. Use a light or white `logoDark` on the dark interface and a dark or black `logoLight` on the light interface. Both are required; combining the pair with `logo` is rejected.
123
+ This is the v2 API. Packaged `UIThemeSwitcher`, `UIThemeSelector`, select
124
+ primitives, and their prop types have moved out of the runtime. The old runtime
125
+ binary has moved to `uitheme-cli`.
347
126
 
348
- When one dimension is set and the other omitted, the omitted dimension defaults to `"auto"` and preserves the SVG aspect ratio. Explicit `"auto"` for both uses the SVG’s intrinsic size. With both omitted, the existing 96 px default width is preserved.
127
+ Run `npx uitheme-cli migrate --dry-run` to inspect supported import changes.
128
+ For old styled controls, upgrade the runtime to `^2.0.0` on a migration branch,
129
+ install the local controls, then review the migration preview. The app can have
130
+ unresolved imports until the migration is complete. Custom props and unknown
131
+ provider wiring require manual changes. `--yes` never accepts edited controls
132
+ as verified replacements.
349
133
 
350
- All built-in controls share the active state from any of the four providers.
351
- Outside a provider, they own their standalone state. Keyboard selection inside
352
- the dropdown portal skips moving reveals.
134
+ Replace `uitheme-vue` with `uitheme-web/vue`, `uitheme-vue/bootstrap` with
135
+ `uitheme-web/vue/bootstrap`, and `uitheme-vue/nuxt` with `uitheme-web/nuxt`.
136
+ The published Vue v1 package remains available. No bridge release is required.
353
137
 
354
- `useHydrated()` is exported from `uitheme-web/react`. For TanStack server/cookie
355
- callbacks, use `onServerError={(error) => ...}` to observe failed notifications;
356
- otherwise failures are reported through `console.error` without unhandled promise
357
- rejections.
138
+ See the [documentation](https://www.ui-theme.dev/docs) for integration guides.
@@ -0,0 +1 @@
1
+ var t="theme",e="color-theme",o="dark",E="theme-";export{t as a,e as b,o as c,E as d};
@@ -1,4 +1,4 @@
1
- var x=typeof window<"u",k=()=>{if(!x||document.getElementById("ui-theme-base-style"))return;let t=document.createElement("style");t.id="ui-theme-base-style",t.textContent=`
1
+ var x=typeof window<"u",S=()=>{if(!x||document.getElementById("ui-theme-base-style"))return;let t=document.createElement("style");t.id="ui-theme-base-style",t.textContent=`
2
2
  html[data-ui-theme-transition]::view-transition-group(root),
3
3
  html[data-ui-theme-transition]::view-transition-old(root),
4
4
  html[data-ui-theme-transition]::view-transition-new(root) {
@@ -14,5 +14,5 @@ var x=typeof window<"u",k=()=>{if(!x||document.getElementById("ui-theme-base-sty
14
14
  html[data-ui-theme-transition] *::after {
15
15
  transition: none !important;
16
16
  }
17
- `,document.head.appendChild(t);},E=t=>`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="-50 -50 100 100"><defs>${`<filter id="blur"><feGaussianBlur stdDeviation="${t}" /></filter>`}</defs><circle cx="0" cy="0" r="25" fill="white" filter="url(%23blur)"/></svg>')`,C=()=>x&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",M=t=>t==="system"?C():t==="dark"?"dark":"light",R=t=>t==="system"?"system":t==="dark"?"dark":"light",T=()=>x&&document.startViewTransition instanceof Function,P=()=>x&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,D=t=>{switch(t){case "left":return {a:-100,b:0};case "right":return {a:100,b:0};case "top":return {a:0,b:-100};case "bottom":return {a:0,b:100};case "top-left":return {a:-100,b:-100};case "top-right":return {a:100,b:-100};case "bottom-left":return {a:-100,b:100};case "bottom-right":return {a:100,b:100};default:return {a:-100,b:0}}},y=()=>{let t=getComputedStyle(document.documentElement,"::view-transition-new(root)"),n=Math.max(window.innerWidth,parseFloat(t.width)||0),e=Math.max(window.innerHeight,parseFloat(t.height)||0);return {width:n,height:e}},w=(t,n)=>{let{width:e,height:o}=y();return Math.hypot(Math.max(Math.abs(t),Math.abs(e-t)),Math.max(Math.abs(n),Math.abs(o-n)))+1},L=t=>{let n=t.includes("left")?0:t.includes("right")?window.innerWidth:window.innerWidth/2,e=t.includes("top")?0:t.includes("bottom")?window.innerHeight:window.innerHeight/2;return {x:n,y:e}},S=0,h=(t,n)=>{let e=document.documentElement.animate(n,{duration:t.duration,easing:t.easing,fill:"both",pseudoElement:"::view-transition-new(root)"}),o=e.effect;if(!(o instanceof KeyframeEffect))return e;let i=o.getKeyframes(),d=i.some(c=>"clipPath"in c)?"clipPath":i.some(c=>"maskImage"in c)?"maskImage":"transform";if(getComputedStyle(document.documentElement,"::view-transition-new(root)")[d]!=="none")return e;let l=e.playState==="paused",s=e.currentTime;e.cancel(),e.finished.catch(()=>{});let a=`ui-theme-reveal-${++S}`,r=document.createElement("style"),m=i.map(c=>{let $=Object.entries(c).filter(([u])=>!["offset","computedOffset","easing","composite"].includes(u)).map(([u,A])=>`${u.replace(/[A-Z]/g,v=>`-${v.toLowerCase()}`)}:${A};`).join("");return `${c.computedOffset*100}%{${$}}`}).join("");r.textContent=`@keyframes ${a}{${m}}html[data-ui-theme-transition]::view-transition-new(root){animation:${a} ${t.duration}ms ${t.easing} both;}`,document.head.appendChild(r);let f=getComputedStyle(document.documentElement,"::view-transition-new(root)").animationName,p=document.getAnimations().find(c=>c instanceof CSSAnimation&&c.animationName===f);if(!p)throw r.remove(),new Error("Transition pseudo animations are unavailable");return l&&(p.pause(),p.currentTime=s),p.finished.then(()=>r.remove(),()=>r.remove()),p},O=t=>{let n=t.clipPathDirection??"top-left",e={"top-left":"polygon(-1% -1%, 101% -101%, -101% 101%, -1% -1%)",top:"polygon(-1% -1%, 101% -1%, 101% -1%, -1% -1%)","top-right":"polygon(101% -1%, 201% 101%, -1% -101%, 101% -1%)",right:"polygon(101% -1%, 101% 101%, 101% 101%, 101% -1%)","bottom-right":"polygon(101% 101%, -1% 201%, 201% -1%, 101% 101%)",bottom:"polygon(101% 101%, -1% 101%, -1% 101%, 101% 101%)","bottom-left":"polygon(-1% 101%, -101% -1%, 101% 201%, -1% 101%)",left:"polygon(-1% 101%, -1% -1%, -1% -1%, -1% 101%)"},o={"top-left":"polygon(-1% -1%, 201% -1%, -1% 201%, -1% -1%)",top:"polygon(-1% -1%, 101% -1%, 101% 101%, -1% 101%)","top-right":"polygon(101% -1%, 101% 201%, -101% -1%, 101% -1%)",right:"polygon(101% -1%, 101% 101%, -1% 101%, -1% -1%)","bottom-right":"polygon(101% 101%, -101% 101%, 101% -101%, 101% 101%)",bottom:"polygon(101% 101%, -1% 101%, -1% -1%, 101% -1%)","bottom-left":"polygon(-1% 101%, -1% -101%, 201% 101%, -1% 101%)",left:"polygon(-1% 101%, -1% -1%, 101% -1%, 101% 101%)"};return h(t,{clipPath:[e[n],o[n]]})},_=t=>{let n=t.clipPathDirection??"top-left",{width:e,height:o}=y(),i=n.includes("-"),d=n.includes("left"),g=n.includes("top"),l=n==="left"||n==="right",s=d?0:n.includes("right")?1:.5,a=g?0:n.includes("bottom")?1:.5,r=i||l?e*3:e,m=i||!l?o*3:o,f=i?`${s*100},${a*100} ${(1-s)*100},${a*100} ${s*100},${(1-a)*100}`:"0,0 100,0 100,100 0,100",p=i?r*m/Math.hypot(r,m):l?r:m,$=1-Math.max(0,Math.min(t.gradientWidth??80,p*.2))/p,u=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"><defs><linearGradient id="edge" x1="${s*100}" y1="${a*100}" x2="${100*(i?.5:l?1-s:s)}" y2="${100*(i?.5:l?a:1-a)}" gradientUnits="userSpaceOnUse"><stop offset="${$}" stop-color="black"/><stop offset="1" stop-color="black" stop-opacity="0"/></linearGradient></defs><polygon points="${f}" fill="url(#edge)"/></svg>`;return h(t,{maskImage:[`url("data:image/svg+xml,${encodeURIComponent(u)}")`,`url("data:image/svg+xml,${encodeURIComponent(u)}")`],maskMode:["alpha","alpha"],maskRepeat:["no-repeat","no-repeat"],maskSize:[i?"0px 0px":l?`0px ${m}px`:`${r}px 0px`,`${r}px ${m}px`],maskPosition:[`${s*e}px ${a*o}px`,`${s*(e-r)}px ${a*(o-m)}px`]})},F=t=>{let{x:n,y:e}=t,o=w(n,e),i=Math.sqrt(3)*o;return h(t,{clipPath:[`polygon(${n}px ${e}px, ${n}px ${e}px, ${n}px ${e}px)`,`polygon(${n}px ${e-2*o}px, ${n+i}px ${e+o}px, ${n-i}px ${e+o}px)`]})},I=t=>{let{width:n,height:e}=y();return b({...t,x:n/2,y:e/2})},b=t=>{let{x:n,y:e}=t;return h(t,{clipPath:[`circle(0px at ${n}px ${e}px)`,`circle(${w(n,e)}px at ${n}px ${e}px)`]})},U=t=>{let{a:n=-100,b:e=0,x:o=0,y:i=0}=t;return h(t,{transform:[`translate(${n}%, ${e}%)`,`translate(${o}%, ${i}%)`]})},B=t=>{let{x:n,y:e,blurAmount:o}=t;if(o<=0)return b(t);let i=Math.min(o,20),d=w(n,e)+i,g=d*2;return h(t,{maskImage:[`radial-gradient(closest-side, #000 calc(100% - ${i}px), transparent 100%)`,`radial-gradient(closest-side, #000 calc(100% - ${i}px), transparent 100%)`],maskRepeat:["no-repeat","no-repeat"],maskSize:["0px 0px",`${g}px ${g}px`],maskPosition:[`${n}px ${e}px`,`${n-d}px ${e-d}px`]})};var N="theme",K="color-theme",z="dark",j="theme-",H=400,W="cubic-bezier(0.32, 0.72, 0, 1)",Y=2,q="ui-theme-style";
18
- export{k as a,E as b,C as c,M as d,R as e,T as f,P as g,D as h,L as i,O as j,_ as k,F as l,I as m,b as n,U as o,B as p,N as q,K as r,z as s,j as t,H as u,W as v,Y as w,q as x};
17
+ `,document.head.appendChild(t);},M=t=>`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="-50 -50 100 100"><defs>${`<filter id="blur"><feGaussianBlur stdDeviation="${t}" /></filter>`}</defs><circle cx="0" cy="0" r="25" fill="white" filter="url(%23blur)"/></svg>')`,k=()=>x&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",P=t=>t==="system"?k():t==="dark"?"dark":"light",R=t=>t==="system"?"system":t==="dark"?"dark":"light",E=()=>x&&document.startViewTransition instanceof Function,T=()=>x&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,B=t=>{switch(t){case "left":return {a:-100,b:0};case "right":return {a:100,b:0};case "top":return {a:0,b:-100};case "bottom":return {a:0,b:100};case "top-left":return {a:-100,b:-100};case "top-right":return {a:100,b:-100};case "bottom-left":return {a:-100,b:100};case "bottom-right":return {a:100,b:100};default:return {a:-100,b:0}}},w=()=>{let t=getComputedStyle(document.documentElement,"::view-transition-new(root)"),n=Math.max(window.innerWidth,parseFloat(t.width)||0),e=Math.max(window.innerHeight,parseFloat(t.height)||0);return {width:n,height:e}},y=(t,n)=>{let{width:e,height:o}=w();return Math.hypot(Math.max(Math.abs(t),Math.abs(e-t)),Math.max(Math.abs(n),Math.abs(o-n)))+1},I=t=>{let n=t.includes("left")?0:t.includes("right")?window.innerWidth:window.innerWidth/2,e=t.includes("top")?0:t.includes("bottom")?window.innerHeight:window.innerHeight/2;return {x:n,y:e}},C=0,h=(t,n)=>{let e=document.documentElement.animate(n,{duration:t.duration,easing:t.easing,fill:"both",pseudoElement:"::view-transition-new(root)"}),o=e.effect;if(!(o instanceof KeyframeEffect))return e;let i=o.getKeyframes(),d=i.some(l=>"clipPath"in l)?"clipPath":i.some(l=>"maskImage"in l)?"maskImage":"transform";if(getComputedStyle(document.documentElement,"::view-transition-new(root)")[d]!=="none")return e;let c=e.playState==="paused",s=e.currentTime;e.cancel(),e.finished.catch(()=>{});let r=`ui-theme-reveal-${++C}`,a=document.createElement("style"),m=i.map(l=>{let $=Object.entries(l).filter(([u])=>!["offset","computedOffset","easing","composite"].includes(u)).map(([u,v])=>`${u.replace(/[A-Z]/g,A=>`-${A.toLowerCase()}`)}:${v};`).join("");return `${l.computedOffset*100}%{${$}}`}).join("");a.textContent=`@keyframes ${r}{${m}}html[data-ui-theme-transition]::view-transition-new(root){animation:${r} ${t.duration}ms ${t.easing} both;}`,document.head.appendChild(a);let f=getComputedStyle(document.documentElement,"::view-transition-new(root)").animationName,p=document.getAnimations().find(l=>l instanceof CSSAnimation&&l.animationName===f);if(!p)throw a.remove(),new Error("Transition pseudo animations are unavailable");return c&&(p.pause(),p.currentTime=s),p.finished.then(()=>a.remove(),()=>a.remove()),p},D=t=>{let n=t.clipPathDirection??"top-left",e={"top-left":"polygon(-1% -1%, 101% -101%, -101% 101%, -1% -1%)",top:"polygon(-1% -1%, 101% -1%, 101% -1%, -1% -1%)","top-right":"polygon(101% -1%, 201% 101%, -1% -101%, 101% -1%)",right:"polygon(101% -1%, 101% 101%, 101% 101%, 101% -1%)","bottom-right":"polygon(101% 101%, -1% 201%, 201% -1%, 101% 101%)",bottom:"polygon(101% 101%, -1% 101%, -1% 101%, 101% 101%)","bottom-left":"polygon(-1% 101%, -101% -1%, 101% 201%, -1% 101%)",left:"polygon(-1% 101%, -1% -1%, -1% -1%, -1% 101%)"},o={"top-left":"polygon(-1% -1%, 201% -1%, -1% 201%, -1% -1%)",top:"polygon(-1% -1%, 101% -1%, 101% 101%, -1% 101%)","top-right":"polygon(101% -1%, 101% 201%, -101% -1%, 101% -1%)",right:"polygon(101% -1%, 101% 101%, -1% 101%, -1% -1%)","bottom-right":"polygon(101% 101%, -101% 101%, 101% -101%, 101% 101%)",bottom:"polygon(101% 101%, -1% 101%, -1% -1%, 101% -1%)","bottom-left":"polygon(-1% 101%, -1% -101%, 201% 101%, -1% 101%)",left:"polygon(-1% 101%, -1% -1%, 101% -1%, 101% 101%)"};return h(t,{clipPath:[e[n],o[n]]})},F=t=>{let n=t.clipPathDirection??"top-left",{width:e,height:o}=w(),i=n.includes("-"),d=n.includes("left"),g=n.includes("top"),c=n==="left"||n==="right",s=d?0:n.includes("right")?1:.5,r=g?0:n.includes("bottom")?1:.5,a=i||c?e*3:e,m=i||!c?o*3:o,f=i?`${s*100},${r*100} ${(1-s)*100},${r*100} ${s*100},${(1-r)*100}`:"0,0 100,0 100,100 0,100",p=i?a*m/Math.hypot(a,m):c?a:m,$=1-Math.max(0,Math.min(t.gradientWidth??80,p*.2))/p,u=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"><defs><linearGradient id="edge" x1="${s*100}" y1="${r*100}" x2="${100*(i?.5:c?1-s:s)}" y2="${100*(i?.5:c?r:1-r)}" gradientUnits="userSpaceOnUse"><stop offset="${$}" stop-color="black"/><stop offset="1" stop-color="black" stop-opacity="0"/></linearGradient></defs><polygon points="${f}" fill="url(#edge)"/></svg>`;return h(t,{maskImage:[`url("data:image/svg+xml,${encodeURIComponent(u)}")`,`url("data:image/svg+xml,${encodeURIComponent(u)}")`],maskMode:["alpha","alpha"],maskRepeat:["no-repeat","no-repeat"],maskSize:[i?"0px 0px":c?`0px ${m}px`:`${a}px 0px`,`${a}px ${m}px`],maskPosition:[`${s*e}px ${r*o}px`,`${s*(e-a)}px ${r*(o-m)}px`]})},j=t=>{let{x:n,y:e}=t,o=y(n,e),i=Math.sqrt(3)*o;return h(t,{clipPath:[`polygon(${n}px ${e}px, ${n}px ${e}px, ${n}px ${e}px)`,`polygon(${n}px ${e-2*o}px, ${n+i}px ${e+o}px, ${n-i}px ${e+o}px)`]})},z=t=>{let{width:n,height:e}=w();return b({...t,x:n/2,y:e/2})},b=t=>{let{x:n,y:e}=t;return h(t,{clipPath:[`circle(0px at ${n}px ${e}px)`,`circle(${y(n,e)}px at ${n}px ${e}px)`]})},G=t=>{let{a:n=-100,b:e=0,x:o=0,y:i=0}=t;return h(t,{transform:[`translate(${n}%, ${e}%)`,`translate(${o}%, ${i}%)`]})},K=t=>{let{x:n,y:e,blurAmount:o}=t;if(o<=0)return b(t);let i=Math.min(o,20),d=y(n,e)+i,g=d*2;return h(t,{maskImage:[`radial-gradient(closest-side, #000 calc(100% - ${i}px), transparent 100%)`,`radial-gradient(closest-side, #000 calc(100% - ${i}px), transparent 100%)`],maskRepeat:["no-repeat","no-repeat"],maskSize:["0px 0px",`${g}px ${g}px`],maskPosition:[`${n}px ${e}px`,`${n-d}px ${e-d}px`]})};
18
+ export{S as a,M as b,k as c,P as d,R as e,E as f,T as g,B as h,I as i,D as j,F as k,j as l,z as m,b as n,G as o,K as p};
@@ -0,0 +1 @@
1
+ 'use strict';var t="theme",e="color-theme",o="dark",E="theme-",_=400,A="cubic-bezier(0.32, 0.72, 0, 1)",c=2,r="ui-theme-style";exports.a=t;exports.b=e;exports.c=o;exports.d=E;exports.e=_;exports.f=A;exports.g=c;exports.h=r;
@@ -0,0 +1,12 @@
1
+ import {f,g,a as a$1,o,p,j,k,l,m,n,c,d,h as h$1,i}from'./chunk-CY5E6WU4.js';import {a,b,c as c$1,d as d$1,h,f as f$1}from'./chunk-NDNCNR4X.js';var J=(a=>(a.CIRCLE="circle",a.BLUR_CIRCLE="blur-circle",a.SLIDE="slide",a.CLIP_PATH="clip-path",a.POLYGON_GRADIENT="polygon-gradient",a.TRIANGLE="triangle",a.SVG_LOGO="svg-logo",a))(J||{}),$e=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"];var _=n=>{if(n.logoLight!==void 0||n.logoDark!==void 0){if(!n.logoLight||!n.logoDark)throw new Error("logoLight and logoDark must both be provided.");if(n.logo!==void 0)throw new Error("Use logo or the logoLight/logoDark pair, not both.");return {logoLight:n.logoLight,logoDark:n.logoDark}}return {logo:n.logo}},Ge=0,Ee=n=>{let i=Ne(n.logo);if(!i)return;let t=n.logoWidth!=="auto"&&n.logoWidth&&Number.isFinite(n.logoWidth)&&n.logoWidth>0?n.logoWidth:void 0,o=n.logoHeight!=="auto"&&n.logoHeight&&Number.isFinite(n.logoHeight)&&n.logoHeight>0?n.logoHeight:void 0,h=t??(o?o*i.aspectRatio:n.logoWidth==="auto"||n.logoHeight==="auto"?i.naturalWidth:96),m=o??h/i.aspectRatio,c=`ui-theme-logo-${++Ge}`,a=document.createElement("img");a.src=i.image,a.alt="",a.setAttribute("aria-hidden","true"),a.setAttribute("data-ui-theme-logo",""),a.style.cssText=`position:fixed;left:calc(50% - ${h/2}px);top:calc(50% - ${m/2}px);width:${h}px;height:${m}px;max-width:none;max-height:none;object-fit:contain;display:block;margin:0;padding:0;border:0;transform:none;pointer-events:none;z-index:2147483647;view-transition-name:${c};`;let T=document.createElement("style");return T.setAttribute("data-ui-theme-logo-style",""),T.textContent=`
2
+ @keyframes ${c}-fade { 0%, 85% { opacity:1; } 100% { opacity:0; } }
3
+ html[data-ui-theme-transition]::view-transition-group(${c}) {
4
+ z-index:2;
5
+ animation:${c}-fade ${n.duration}ms linear both;
6
+ }
7
+ html[data-ui-theme-transition]::view-transition-old(${c}) { display:none; }
8
+ html[data-ui-theme-transition]::view-transition-new(${c}) {
9
+ animation:none; mix-blend-mode:normal;
10
+ }
11
+ `,document.head.appendChild(T),document.documentElement.appendChild(a),{element:a,style:T}},Q=new Map,xe=n=>{if(typeof window>"u")return Promise.resolve();let i=Q.get(n);if(i)return i.loading;let t={loading:Promise.resolve()};return Q.set(n,t),t.loading=(async()=>{let o=new AbortController,h=setTimeout(()=>o.abort(),2e3);try{let m=await fetch(n,{signal:o.signal});if(!m.ok)return;let c=await m.text(),a=new DOMParser().parseFromString(c,"image/svg+xml");if(a.querySelector("parsererror")||a.documentElement.localName!=="svg"||a.documentElement.namespaceURI!=="http://www.w3.org/2000/svg")return;let T=`data:image/svg+xml,${encodeURIComponent(c)}`,u=new Image;u.src=T,await u.decode(),u.naturalWidth>0&&u.naturalHeight>0&&(t.ready={image:T,naturalWidth:u.naturalWidth,aspectRatio:u.naturalWidth/u.naturalHeight});}catch{}finally{clearTimeout(h);}})(),t.loading},Ne=n=>n?Q.get(n)?.ready:void 0;var D=new WeakMap,Oe=async(n$1,i)=>{if(typeof document>"u"){await n$1();return}let t=D.get(document);t?.transition?.skipTransition(),t?.animation?.cancel(),t?.logo?.element.remove(),t?.logo?.style.remove();let o$1={updateDone:Promise.resolve()};D.set(document,o$1);let h=()=>{o$1.animation?.cancel(),o$1.logo?.element.remove(),o$1.logo?.style.remove(),D.get(document)===o$1&&(D.delete(document),document.documentElement.removeAttribute("data-ui-theme-transition"));};o$1.updateDone=(async()=>{if(t&&await t.updateDone.catch(()=>{}),D.get(document)!==o$1||!i||!f()||g()||document.visibilityState==="hidden"){await n$1();return}a$1(),document.documentElement.setAttribute("data-ui-theme-transition",""),i.animationType==="svg-logo"&&(o$1.logo=Ee(i));let m;try{m=document.startViewTransition(n$1);}catch{await n$1();return}o$1.transition=m,m.ready.catch(()=>{}),m.finished.then(h,h),await m.updateCallbackDone;})();try{await o$1.updateDone;let m$1=o$1.transition;if(!m$1){h();return}try{await m$1.ready;}catch{h();return}if(D.get(document)!==o$1){m$1.skipTransition();return}if(!i)return;try{o$1.animation=i.animationType==="slide"?o(i):i.animationType==="blur-circle"?p(i):i.animationType==="clip-path"?j(i):i.animationType==="polygon-gradient"?k(i):i.animationType==="triangle"?l(i):i.animationType==="svg-logo"?m(i):n(i),o$1.animation.finished.catch(()=>{});let c=o$1.animation.effect;!(o$1.animation instanceof CSSAnimation)&&(!(c instanceof KeyframeEffect)||c.pseudoElement!=="::view-transition-new(root)")&&(m$1.skipTransition(),h());}catch{m$1.skipTransition(),h();}}catch(m){throw h(),m}};var M=typeof window<"u",Ae=(n=a,i=["light","dark","system"],t="system")=>{if(!M)return t;let o;try{o=localStorage.getItem(n);}catch{return t}return i.find(h=>h===o)??t},Ie=(n,i=a)=>{M&&localStorage.setItem(i,n);},De=(n=b,i=["default"],t="default")=>{if(!M)return t;let o;try{o=localStorage.getItem(n);}catch{return t}return o&&i.includes(o)?o:t},ke=(n,i=b)=>{M&&localStorage.setItem(i,n);};function G(n){if(!["light","dark","system"].includes(n))throw new Error("Theme must be light, dark, or system.")}function U(n,i){let t=`${i}${n}`;if(!t.length||/\s/.test(t))throw new Error("Theme classes must be nonempty CSS class tokens.")}function Z(n={}){let i=n.themes??["light","dark","system"],t=n.colorThemes??["default"],o=n.defaultTheme??"system",h=n.defaultColorTheme??t[0],m=n.globalClassName??c$1,c=n.colorThemePrefix??d$1;if(!i.length||!i.every(a=>["light","dark","system"].includes(a))||!i.includes(o))throw new Error("themes must include the defaultTheme and contain light, dark, or system.");if(h===void 0||!t.includes(h))throw new Error("colorThemes must include the defaultColorTheme.");if(![m,...t.map(a=>`${c}${a}`)].every(a=>a.length>0&&!/\s/.test(a)))throw new Error("Theme classes must be nonempty CSS class tokens.");return {themes:Object.freeze([...i]),colorThemes:Object.freeze([...t]),defaultTheme:o,defaultColorTheme:h,globalClassName:m,colorThemePrefix:c,storageKey:n.storageKey??a,colorStorageKey:n.colorStorageKey??b}}var Y=(n,i)=>n.length===i.length&&n.every((t,o)=>t===i[o]),Pe=n=>n&&n!==true&&"currentTarget"in n?{element:n.currentTarget,animationOff:n.detail===0}:n,et=(n={},i$1={})=>{let t=n,o=Z(t);_(t);let h$2=(e,s)=>{e.theme!==void 0&&G(e.theme),e.initialTheme!==void 0&&G(e.initialTheme),e.colorTheme!==void 0&&U(e.colorTheme,s),e.initialColorTheme!==void 0&&U(e.initialColorTheme,s);};h$2(t,o.colorThemePrefix);let m=e=>{try{return t.storage?t.storage.getItem(e):null}catch{return null}},c$1=()=>{if(t.storage===void 0)return Ae(t.storageKey,o.themes,o.defaultTheme);let e=m(t.storageKey??a);return o.themes.find(s=>s===e)??o.defaultTheme},a$2=()=>{if(t.storage===void 0)return De(t.colorStorageKey,o.colorThemes,o.defaultColorTheme);let e=m(t.colorStorageKey??b);return o.colorThemes.find(s=>s===e)??o.defaultColorTheme},T=t.initialTheme??c$1(),u=t.initialColorTheme??a$2(),ee=false,te=false,k=c(),x=false,N=0,w=0,j,$,K,W,q=new Set,oe=t.theme??t.initialTheme??o.defaultTheme,ne={theme:oe,colorTheme:t.colorTheme??t.initialColorTheme??o.defaultColorTheme,resolvedTheme:oe==="dark"?"dark":"light",systemTheme:"light",themes:o.themes,colorThemes:o.colorThemes,mounted:false},l={...ne,theme:t.theme??T,colorTheme:t.colorTheme??u,resolvedTheme:d(t.theme??T),systemTheme:k},O=l.theme,P=l.colorTheme,p=l.theme,b$1=l.colorTheme,Re=()=>{if(!x||typeof document>"u")return;let e=document.documentElement,s=o.globalClassName,d=o.colorThemePrefix;W&&W!==s&&e.classList.remove(W),e.classList.remove("auto","system"),t.systemThemeMode==="css"&&l.theme==="system"?(e.classList.remove(s),e.classList.add("system"),e.style.colorScheme=""):(e.classList.toggle(s,l.resolvedTheme==="dark"),e.style.colorScheme=l.resolvedTheme),W=s,K&&e.classList.remove(K),l.colorThemes.forEach(r=>e.classList.remove(`${d}${r}`)),K=`${d}${l.colorTheme}`,e.classList.add(K);},E=()=>{let e=t.theme??T,s=t.colorTheme??u,d=o.themes,r=o.colorThemes,g={theme:e,colorTheme:s,resolvedTheme:e==="system"?k:e,systemTheme:k,themes:Y(l.themes,d)?l.themes:d,colorThemes:Y(l.colorThemes,r)?l.colorThemes:r,mounted:x},y=g.theme!==l.theme||g.colorTheme!==l.colorTheme||g.resolvedTheme!==l.resolvedTheme||g.systemTheme!==l.systemTheme||g.themes!==l.themes||g.colorThemes!==l.colorThemes||g.mounted!==l.mounted;y&&(l=g),Re(),y&&q.forEach(C=>C());},ie=()=>{if(t.animationType==="svg-logo")for(let e of [t.logo,t.logoLight,t.logoDark])e&&xe(e);},re=e=>{try{e();}catch(s){if(!i$1.onBrowserStorageError)throw s;i$1.onBrowserStorageError(s instanceof Error?s:new Error(String(s)));}},se=e=>{G(e),t.storage===void 0?re(()=>Ie(e,t.storageKey??a)):t.storage&&t.storage.setItem(t.storageKey??a,e),ee=true,O=e,t.theme===void 0&&(T=e),E(),t.onThemeChange?.(e);},ae=e=>{U(e,o.colorThemePrefix),t.storage===void 0?re(()=>ke(e,t.colorStorageKey??b)):t.storage&&t.storage.setItem(t.colorStorageKey??b,e),te=true,P=e,t.colorTheme===void 0&&(u=e),E(),t.onColorThemeChange?.(e);},_e=(e=false)=>{let s=e===true||e===false?{animationOff:e}:e,d$1=s.logo!==void 0||s.logoLight!==void 0||s.logoDark!==void 0,r={...t,...Object.fromEntries(Object.entries(s).filter(([,R])=>R!==void 0))};d$1&&Object.assign(r,{logo:void 0,logoLight:void 0,logoDark:void 0,..._(s)}),_(r);let g=r.duration??400;if(s.animationOff||g<=0||typeof window>"u")return null;let y=Object.values(J).find(R=>R===r.animationType)??"circle",C={duration:g,easing:r.easing??f$1,animationType:y,blurAmount:r.blurAmount??2,styleId:r.styleId??h};if(y==="slide"){let R=r.slideFromX!==void 0&&r.slideFromY!==void 0?{a:r.slideFromX,b:r.slideFromY}:h$1(r.slideDirection??"left");return {...C,...R,x:r.slideToX??0,y:r.slideToY??0}}let A=s.element??i$1.getElement?.(),v=s.origin?null:A?.getBoundingClientRect(),f=(y==="svg-logo"?i("center"):null)??s.origin??(r.animationPosition&&r.animationPosition!=="trigger"?i(r.animationPosition):null)??(v?{x:v.left+v.width/2,y:v.top+v.height/2}:y==="circle"||y==="blur-circle"?null:i("center"));return !f||!Number.isFinite(f.x)||!Number.isFinite(f.y)?null:{...C,...f,clipPathDirection:r.clipPathDirection??"top-left",animationPosition:r.animationPosition,logo:r.logoLight!==void 0?d(O)==="light"?r.logoLight:r.logoDark:r.logo,logoWidth:r.logoWidth,logoHeight:r.logoHeight,gradientWidth:r.gradientWidth}},le=async(e,s)=>{let d=_e(s),r=w,g=()=>{r===w&&e();};N++;try{await Oe(()=>{if(r===w)return i$1.commit?i$1.commit(g):g()},d);}finally{r===w&&N--;}},F=async(e,s)=>{if(G(e),!o.themes.includes(e)){console.warn(`Theme "${e}" not found in available themes`);return}if(e===p)return;p=e;let d=w;try{await le(()=>se(e),s);}catch(r){throw d===w&&p===e&&(p=O),r}},X=async(e,s)=>{if(!o.colorThemes.includes(e)){console.warn(`Color theme "${e}" not found in available themes`);return}if(e===b$1)return;b$1=e;let d=w;try{await le(()=>ae(e),s);}catch(r){throw d===w&&b$1===e&&(b$1=P),r}},z=()=>{w++,N=0,j?.(),j=void 0,$=void 0,x=false,E();};return {getSnapshot:()=>l,getServerSnapshot:()=>ne,subscribe:e=>(q.add(e),()=>{q.delete(e);}),mount:()=>{if(x||typeof window>"u"||typeof document>"u")return z;x=true,!ee&&t.initialTheme===void 0&&(T=c$1()),!te&&t.initialColorTheme===void 0&&(u=a$2()),O=p=t.theme??T,P=b$1=t.colorTheme??u,k=c();let e=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>{k=c(),E();},d=r=>{if(r.storageArea&&r.storageArea!==window.localStorage)return;let g=o.themes,y=o.colorThemes;if((r.key===null||r.key===(t.storageKey??a))&&t.theme===void 0){let C=r.newValue??o.defaultTheme,A=g.find(v=>v===C);A!==void 0&&(T=O=p=A);}if((r.key===null||r.key===(t.colorStorageKey??b))&&t.colorTheme===void 0){let C=r.newValue??o.defaultColorTheme;y.includes(C)&&(u=P=b$1=C);}E();};return e.addEventListener("change",s),$=()=>{window.removeEventListener("storage",d),t.storage===void 0&&window.addEventListener("storage",d);},$(),j=()=>{e.removeEventListener("change",s),window.removeEventListener("storage",d);},a$1(),ie(),E(),z},dispose:z,updateOptions:e=>{let s=l.theme,d=l.colorTheme,r={...t,...e},{logo:g,logoLight:y,logoDark:C,...A}=r,v={...A,..._({logo:g,logoLight:y,logoDark:C})},f=Z(v);h$2(v,f.colorThemePrefix),!Y(o.themes,f.themes)&&!f.themes.includes(T)&&(T=f.defaultTheme),!Y(o.colorThemes,f.colorThemes)&&!f.colorThemes.includes(u)&&(u=f.defaultColorTheme),t=v,o=f,E(),N===0&&(s!==l.theme&&(O=p=l.theme),d!==l.colorTheme&&(P=b$1=l.colorTheme)),x&&(ie(),$?.());},setTheme:e=>{se(e),p=e;},setColorTheme:e=>{ae(e),b$1=e;},switchTheme:F,switchColorTheme:X,toggleTheme:e=>{let s=d(p)==="dark"?"light":"dark",d$1=o.themes.includes(s)?s:o.themes[(o.themes.indexOf(p)+1)%o.themes.length];return F(d$1,e)},toggleLightTheme:async e=>{d(p)!=="light"&&await F("light",e);},toggleDarkTheme:async e=>{d(p)!=="dark"&&await F("dark",e);},toggleColorTheme:async e=>{let s=o.colorThemes;s.length!==0&&await X(s[(s.indexOf(b$1)+1)%s.length],Pe(e));},createColorThemeToggle:e=>s=>X(e,Pe(s)),isColorThemeActive:e=>l.colorTheme===e}};
12
+ export{J as a,$e as b,_ as c,xe as d,Oe as e,Ae as f,Ie as g,De as h,ke as i,et as j};
@@ -0,0 +1,14 @@
1
+ import {c,d,b,a}from'./chunk-CTNYTI5Q.js';function i(e={}){let o=e.themes??["light","dark","system"],r=e.colorThemes??["default"],s=e.defaultTheme??"system",l=e.defaultColorTheme??r[0],a$1=e.globalClassName??c,c$1=e.colorThemePrefix??d;if(!o.length||!o.every(t=>["light","dark","system"].includes(t))||!o.includes(s))throw new Error("themes must include defaultTheme and contain light, dark, or system.");if(!l||!r.includes(l)||![a$1,...r.map(t=>`${c$1}${t}`)].every(t=>t.length>0&&!/\s/.test(t)))throw new Error("Color themes and class names must be valid CSS class tokens.");return `(() => {
2
+ const config = ${JSON.stringify({themes:o,colorThemes:r,defaultTheme:s,defaultColorTheme:l,globalClassName:a$1,colorThemePrefix:c$1,storageKey:e.storageKey??a,colorStorageKey:e.colorStorageKey??b,browserStorage:e.storage===void 0}).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")};
3
+ const root = document.documentElement;
4
+ let theme = config.defaultTheme;
5
+ let palette = config.defaultColorTheme;
6
+ if (config.browserStorage) {
7
+ try { const value = localStorage.getItem(config.storageKey); if (config.themes.includes(value)) theme = value; } catch {}
8
+ try { const value = localStorage.getItem(config.colorStorageKey); if (config.colorThemes.includes(value)) palette = value; } catch {}
9
+ }
10
+ const dark = theme === 'dark' || (theme === 'system' && matchMedia('(prefers-color-scheme: dark)').matches);
11
+ root.classList.toggle(config.globalClassName, dark);
12
+ root.style.colorScheme = dark ? 'dark' : 'light';
13
+ for (const value of config.colorThemes) root.classList.toggle(config.colorThemePrefix + value, value === palette);
14
+ })();`}export{i as a};
@@ -1,4 +1,4 @@
1
- 'use strict';var x=typeof window<"u",k=()=>{if(!x||document.getElementById("ui-theme-base-style"))return;let t=document.createElement("style");t.id="ui-theme-base-style",t.textContent=`
1
+ 'use strict';var x=typeof window<"u",S=()=>{if(!x||document.getElementById("ui-theme-base-style"))return;let t=document.createElement("style");t.id="ui-theme-base-style",t.textContent=`
2
2
  html[data-ui-theme-transition]::view-transition-group(root),
3
3
  html[data-ui-theme-transition]::view-transition-old(root),
4
4
  html[data-ui-theme-transition]::view-transition-new(root) {
@@ -14,5 +14,5 @@
14
14
  html[data-ui-theme-transition] *::after {
15
15
  transition: none !important;
16
16
  }
17
- `,document.head.appendChild(t);},E=t=>`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="-50 -50 100 100"><defs>${`<filter id="blur"><feGaussianBlur stdDeviation="${t}" /></filter>`}</defs><circle cx="0" cy="0" r="25" fill="white" filter="url(%23blur)"/></svg>')`,C=()=>x&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",M=t=>t==="system"?C():t==="dark"?"dark":"light",R=t=>t==="system"?"system":t==="dark"?"dark":"light",T=()=>x&&document.startViewTransition instanceof Function,P=()=>x&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,D=t=>{switch(t){case "left":return {a:-100,b:0};case "right":return {a:100,b:0};case "top":return {a:0,b:-100};case "bottom":return {a:0,b:100};case "top-left":return {a:-100,b:-100};case "top-right":return {a:100,b:-100};case "bottom-left":return {a:-100,b:100};case "bottom-right":return {a:100,b:100};default:return {a:-100,b:0}}},y=()=>{let t=getComputedStyle(document.documentElement,"::view-transition-new(root)"),n=Math.max(window.innerWidth,parseFloat(t.width)||0),e=Math.max(window.innerHeight,parseFloat(t.height)||0);return {width:n,height:e}},w=(t,n)=>{let{width:e,height:o}=y();return Math.hypot(Math.max(Math.abs(t),Math.abs(e-t)),Math.max(Math.abs(n),Math.abs(o-n)))+1},L=t=>{let n=t.includes("left")?0:t.includes("right")?window.innerWidth:window.innerWidth/2,e=t.includes("top")?0:t.includes("bottom")?window.innerHeight:window.innerHeight/2;return {x:n,y:e}},S=0,h=(t,n)=>{let e=document.documentElement.animate(n,{duration:t.duration,easing:t.easing,fill:"both",pseudoElement:"::view-transition-new(root)"}),o=e.effect;if(!(o instanceof KeyframeEffect))return e;let i=o.getKeyframes(),d=i.some(c=>"clipPath"in c)?"clipPath":i.some(c=>"maskImage"in c)?"maskImage":"transform";if(getComputedStyle(document.documentElement,"::view-transition-new(root)")[d]!=="none")return e;let l=e.playState==="paused",s=e.currentTime;e.cancel(),e.finished.catch(()=>{});let a=`ui-theme-reveal-${++S}`,r=document.createElement("style"),m=i.map(c=>{let $=Object.entries(c).filter(([u])=>!["offset","computedOffset","easing","composite"].includes(u)).map(([u,A])=>`${u.replace(/[A-Z]/g,v=>`-${v.toLowerCase()}`)}:${A};`).join("");return `${c.computedOffset*100}%{${$}}`}).join("");r.textContent=`@keyframes ${a}{${m}}html[data-ui-theme-transition]::view-transition-new(root){animation:${a} ${t.duration}ms ${t.easing} both;}`,document.head.appendChild(r);let f=getComputedStyle(document.documentElement,"::view-transition-new(root)").animationName,p=document.getAnimations().find(c=>c instanceof CSSAnimation&&c.animationName===f);if(!p)throw r.remove(),new Error("Transition pseudo animations are unavailable");return l&&(p.pause(),p.currentTime=s),p.finished.then(()=>r.remove(),()=>r.remove()),p},O=t=>{let n=t.clipPathDirection??"top-left",e={"top-left":"polygon(-1% -1%, 101% -101%, -101% 101%, -1% -1%)",top:"polygon(-1% -1%, 101% -1%, 101% -1%, -1% -1%)","top-right":"polygon(101% -1%, 201% 101%, -1% -101%, 101% -1%)",right:"polygon(101% -1%, 101% 101%, 101% 101%, 101% -1%)","bottom-right":"polygon(101% 101%, -1% 201%, 201% -1%, 101% 101%)",bottom:"polygon(101% 101%, -1% 101%, -1% 101%, 101% 101%)","bottom-left":"polygon(-1% 101%, -101% -1%, 101% 201%, -1% 101%)",left:"polygon(-1% 101%, -1% -1%, -1% -1%, -1% 101%)"},o={"top-left":"polygon(-1% -1%, 201% -1%, -1% 201%, -1% -1%)",top:"polygon(-1% -1%, 101% -1%, 101% 101%, -1% 101%)","top-right":"polygon(101% -1%, 101% 201%, -101% -1%, 101% -1%)",right:"polygon(101% -1%, 101% 101%, -1% 101%, -1% -1%)","bottom-right":"polygon(101% 101%, -101% 101%, 101% -101%, 101% 101%)",bottom:"polygon(101% 101%, -1% 101%, -1% -1%, 101% -1%)","bottom-left":"polygon(-1% 101%, -1% -101%, 201% 101%, -1% 101%)",left:"polygon(-1% 101%, -1% -1%, 101% -1%, 101% 101%)"};return h(t,{clipPath:[e[n],o[n]]})},_=t=>{let n=t.clipPathDirection??"top-left",{width:e,height:o}=y(),i=n.includes("-"),d=n.includes("left"),g=n.includes("top"),l=n==="left"||n==="right",s=d?0:n.includes("right")?1:.5,a=g?0:n.includes("bottom")?1:.5,r=i||l?e*3:e,m=i||!l?o*3:o,f=i?`${s*100},${a*100} ${(1-s)*100},${a*100} ${s*100},${(1-a)*100}`:"0,0 100,0 100,100 0,100",p=i?r*m/Math.hypot(r,m):l?r:m,$=1-Math.max(0,Math.min(t.gradientWidth??80,p*.2))/p,u=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"><defs><linearGradient id="edge" x1="${s*100}" y1="${a*100}" x2="${100*(i?.5:l?1-s:s)}" y2="${100*(i?.5:l?a:1-a)}" gradientUnits="userSpaceOnUse"><stop offset="${$}" stop-color="black"/><stop offset="1" stop-color="black" stop-opacity="0"/></linearGradient></defs><polygon points="${f}" fill="url(#edge)"/></svg>`;return h(t,{maskImage:[`url("data:image/svg+xml,${encodeURIComponent(u)}")`,`url("data:image/svg+xml,${encodeURIComponent(u)}")`],maskMode:["alpha","alpha"],maskRepeat:["no-repeat","no-repeat"],maskSize:[i?"0px 0px":l?`0px ${m}px`:`${r}px 0px`,`${r}px ${m}px`],maskPosition:[`${s*e}px ${a*o}px`,`${s*(e-r)}px ${a*(o-m)}px`]})},F=t=>{let{x:n,y:e}=t,o=w(n,e),i=Math.sqrt(3)*o;return h(t,{clipPath:[`polygon(${n}px ${e}px, ${n}px ${e}px, ${n}px ${e}px)`,`polygon(${n}px ${e-2*o}px, ${n+i}px ${e+o}px, ${n-i}px ${e+o}px)`]})},I=t=>{let{width:n,height:e}=y();return b({...t,x:n/2,y:e/2})},b=t=>{let{x:n,y:e}=t;return h(t,{clipPath:[`circle(0px at ${n}px ${e}px)`,`circle(${w(n,e)}px at ${n}px ${e}px)`]})},U=t=>{let{a:n=-100,b:e=0,x:o=0,y:i=0}=t;return h(t,{transform:[`translate(${n}%, ${e}%)`,`translate(${o}%, ${i}%)`]})},B=t=>{let{x:n,y:e,blurAmount:o}=t;if(o<=0)return b(t);let i=Math.min(o,20),d=w(n,e)+i,g=d*2;return h(t,{maskImage:[`radial-gradient(closest-side, #000 calc(100% - ${i}px), transparent 100%)`,`radial-gradient(closest-side, #000 calc(100% - ${i}px), transparent 100%)`],maskRepeat:["no-repeat","no-repeat"],maskSize:["0px 0px",`${g}px ${g}px`],maskPosition:[`${n}px ${e}px`,`${n-d}px ${e-d}px`]})};var N="theme",K="color-theme",z="dark",j="theme-",H=400,W="cubic-bezier(0.32, 0.72, 0, 1)",Y=2,q="ui-theme-style";
18
- exports.a=k;exports.b=E;exports.c=C;exports.d=M;exports.e=R;exports.f=T;exports.g=P;exports.h=D;exports.i=L;exports.j=O;exports.k=_;exports.l=F;exports.m=I;exports.n=b;exports.o=U;exports.p=B;exports.q=N;exports.r=K;exports.s=z;exports.t=j;exports.u=H;exports.v=W;exports.w=Y;exports.x=q;
17
+ `,document.head.appendChild(t);},M=t=>`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="-50 -50 100 100"><defs>${`<filter id="blur"><feGaussianBlur stdDeviation="${t}" /></filter>`}</defs><circle cx="0" cy="0" r="25" fill="white" filter="url(%23blur)"/></svg>')`,k=()=>x&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",P=t=>t==="system"?k():t==="dark"?"dark":"light",R=t=>t==="system"?"system":t==="dark"?"dark":"light",E=()=>x&&document.startViewTransition instanceof Function,T=()=>x&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,B=t=>{switch(t){case "left":return {a:-100,b:0};case "right":return {a:100,b:0};case "top":return {a:0,b:-100};case "bottom":return {a:0,b:100};case "top-left":return {a:-100,b:-100};case "top-right":return {a:100,b:-100};case "bottom-left":return {a:-100,b:100};case "bottom-right":return {a:100,b:100};default:return {a:-100,b:0}}},w=()=>{let t=getComputedStyle(document.documentElement,"::view-transition-new(root)"),n=Math.max(window.innerWidth,parseFloat(t.width)||0),e=Math.max(window.innerHeight,parseFloat(t.height)||0);return {width:n,height:e}},y=(t,n)=>{let{width:e,height:o}=w();return Math.hypot(Math.max(Math.abs(t),Math.abs(e-t)),Math.max(Math.abs(n),Math.abs(o-n)))+1},I=t=>{let n=t.includes("left")?0:t.includes("right")?window.innerWidth:window.innerWidth/2,e=t.includes("top")?0:t.includes("bottom")?window.innerHeight:window.innerHeight/2;return {x:n,y:e}},C=0,h=(t,n)=>{let e=document.documentElement.animate(n,{duration:t.duration,easing:t.easing,fill:"both",pseudoElement:"::view-transition-new(root)"}),o=e.effect;if(!(o instanceof KeyframeEffect))return e;let i=o.getKeyframes(),d=i.some(l=>"clipPath"in l)?"clipPath":i.some(l=>"maskImage"in l)?"maskImage":"transform";if(getComputedStyle(document.documentElement,"::view-transition-new(root)")[d]!=="none")return e;let c=e.playState==="paused",s=e.currentTime;e.cancel(),e.finished.catch(()=>{});let r=`ui-theme-reveal-${++C}`,a=document.createElement("style"),m=i.map(l=>{let $=Object.entries(l).filter(([u])=>!["offset","computedOffset","easing","composite"].includes(u)).map(([u,v])=>`${u.replace(/[A-Z]/g,A=>`-${A.toLowerCase()}`)}:${v};`).join("");return `${l.computedOffset*100}%{${$}}`}).join("");a.textContent=`@keyframes ${r}{${m}}html[data-ui-theme-transition]::view-transition-new(root){animation:${r} ${t.duration}ms ${t.easing} both;}`,document.head.appendChild(a);let f=getComputedStyle(document.documentElement,"::view-transition-new(root)").animationName,p=document.getAnimations().find(l=>l instanceof CSSAnimation&&l.animationName===f);if(!p)throw a.remove(),new Error("Transition pseudo animations are unavailable");return c&&(p.pause(),p.currentTime=s),p.finished.then(()=>a.remove(),()=>a.remove()),p},D=t=>{let n=t.clipPathDirection??"top-left",e={"top-left":"polygon(-1% -1%, 101% -101%, -101% 101%, -1% -1%)",top:"polygon(-1% -1%, 101% -1%, 101% -1%, -1% -1%)","top-right":"polygon(101% -1%, 201% 101%, -1% -101%, 101% -1%)",right:"polygon(101% -1%, 101% 101%, 101% 101%, 101% -1%)","bottom-right":"polygon(101% 101%, -1% 201%, 201% -1%, 101% 101%)",bottom:"polygon(101% 101%, -1% 101%, -1% 101%, 101% 101%)","bottom-left":"polygon(-1% 101%, -101% -1%, 101% 201%, -1% 101%)",left:"polygon(-1% 101%, -1% -1%, -1% -1%, -1% 101%)"},o={"top-left":"polygon(-1% -1%, 201% -1%, -1% 201%, -1% -1%)",top:"polygon(-1% -1%, 101% -1%, 101% 101%, -1% 101%)","top-right":"polygon(101% -1%, 101% 201%, -101% -1%, 101% -1%)",right:"polygon(101% -1%, 101% 101%, -1% 101%, -1% -1%)","bottom-right":"polygon(101% 101%, -101% 101%, 101% -101%, 101% 101%)",bottom:"polygon(101% 101%, -1% 101%, -1% -1%, 101% -1%)","bottom-left":"polygon(-1% 101%, -1% -101%, 201% 101%, -1% 101%)",left:"polygon(-1% 101%, -1% -1%, 101% -1%, 101% 101%)"};return h(t,{clipPath:[e[n],o[n]]})},F=t=>{let n=t.clipPathDirection??"top-left",{width:e,height:o}=w(),i=n.includes("-"),d=n.includes("left"),g=n.includes("top"),c=n==="left"||n==="right",s=d?0:n.includes("right")?1:.5,r=g?0:n.includes("bottom")?1:.5,a=i||c?e*3:e,m=i||!c?o*3:o,f=i?`${s*100},${r*100} ${(1-s)*100},${r*100} ${s*100},${(1-r)*100}`:"0,0 100,0 100,100 0,100",p=i?a*m/Math.hypot(a,m):c?a:m,$=1-Math.max(0,Math.min(t.gradientWidth??80,p*.2))/p,u=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"><defs><linearGradient id="edge" x1="${s*100}" y1="${r*100}" x2="${100*(i?.5:c?1-s:s)}" y2="${100*(i?.5:c?r:1-r)}" gradientUnits="userSpaceOnUse"><stop offset="${$}" stop-color="black"/><stop offset="1" stop-color="black" stop-opacity="0"/></linearGradient></defs><polygon points="${f}" fill="url(#edge)"/></svg>`;return h(t,{maskImage:[`url("data:image/svg+xml,${encodeURIComponent(u)}")`,`url("data:image/svg+xml,${encodeURIComponent(u)}")`],maskMode:["alpha","alpha"],maskRepeat:["no-repeat","no-repeat"],maskSize:[i?"0px 0px":c?`0px ${m}px`:`${a}px 0px`,`${a}px ${m}px`],maskPosition:[`${s*e}px ${r*o}px`,`${s*(e-a)}px ${r*(o-m)}px`]})},j=t=>{let{x:n,y:e}=t,o=y(n,e),i=Math.sqrt(3)*o;return h(t,{clipPath:[`polygon(${n}px ${e}px, ${n}px ${e}px, ${n}px ${e}px)`,`polygon(${n}px ${e-2*o}px, ${n+i}px ${e+o}px, ${n-i}px ${e+o}px)`]})},z=t=>{let{width:n,height:e}=w();return b({...t,x:n/2,y:e/2})},b=t=>{let{x:n,y:e}=t;return h(t,{clipPath:[`circle(0px at ${n}px ${e}px)`,`circle(${y(n,e)}px at ${n}px ${e}px)`]})},G=t=>{let{a:n=-100,b:e=0,x:o=0,y:i=0}=t;return h(t,{transform:[`translate(${n}%, ${e}%)`,`translate(${o}%, ${i}%)`]})},K=t=>{let{x:n,y:e,blurAmount:o}=t;if(o<=0)return b(t);let i=Math.min(o,20),d=y(n,e)+i,g=d*2;return h(t,{maskImage:[`radial-gradient(closest-side, #000 calc(100% - ${i}px), transparent 100%)`,`radial-gradient(closest-side, #000 calc(100% - ${i}px), transparent 100%)`],maskRepeat:["no-repeat","no-repeat"],maskSize:["0px 0px",`${g}px ${g}px`],maskPosition:[`${n}px ${e}px`,`${n-d}px ${e-d}px`]})};
18
+ exports.a=S;exports.b=M;exports.c=k;exports.d=P;exports.e=R;exports.f=E;exports.g=T;exports.h=B;exports.i=I;exports.j=D;exports.k=F;exports.l=j;exports.m=z;exports.n=b;exports.o=G;exports.p=K;