uitheme-web 2.0.0-rc.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -102
- package/dist/bootstrap-DjA-_LjB.d.cts +104 -0
- package/dist/chunk-4HBM4JJB.cjs +1 -0
- package/dist/chunk-BYLNELO5.js +1 -0
- package/dist/chunk-DTUGFHPG.js +1 -0
- package/dist/chunk-EVSU6Y3J.cjs +1 -0
- package/dist/chunk-F4BPBR2Y.js +18 -0
- package/dist/chunk-HYVEXQI5.cjs +1 -0
- package/dist/chunk-NDTSXDQI.js +12 -0
- package/dist/chunk-R7KPCTX4.cjs +12 -0
- package/dist/chunk-UW5NJ23X.cjs +18 -0
- package/dist/chunk-ZCKIEEMW.js +1 -0
- package/dist/{constants-PAa1nGZ0.d.ts → constants-CDhU9uhC.d.cts} +2 -2
- package/dist/{constants-9M8X-rnX.d.cts → constants-DgJBS8qt.d.ts} +2 -2
- package/dist/{controller-DnMwV2nl.d.ts → controller-BASaPUJN.d.cts} +3 -1
- package/dist/{controller-83zmHd-p.d.cts → controller-D-S1gr00.d.ts} +3 -1
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.d.cts +4 -4
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +1 -1
- package/dist/{index-DQvBhaeA.d.cts → index-CT3I4-Jq.d.cts} +4 -4
- package/dist/{index-CR2g5NEe.d.ts → index-DFVZPt84.d.ts} +4 -4
- package/dist/next/index.cjs +1 -1
- package/dist/next/index.d.cts +3 -3
- package/dist/next/index.d.ts +3 -3
- package/dist/next/index.js +1 -1
- package/dist/react/index.cjs +1 -44
- package/dist/react/index.d.cts +20 -10
- package/dist/react/index.d.ts +20 -10
- package/dist/react/index.js +1 -44
- package/dist/server/index.cjs +1 -14
- package/dist/server/index.js +1 -14
- package/dist/tanstack/index.cjs +1 -1
- package/dist/tanstack/index.d.cts +3 -3
- package/dist/tanstack/index.d.ts +3 -3
- package/dist/tanstack/index.js +1 -1
- package/dist/{types-CrR56NLm.d.cts → types-C2tuWeMB.d.cts} +2 -0
- package/dist/{types-CrR56NLm.d.ts → types-C2tuWeMB.d.ts} +2 -0
- package/dist/vue/bootstrap.cjs +1 -0
- package/dist/vue/bootstrap.d.cts +2 -0
- package/dist/vue/bootstrap.js +1 -1
- package/dist/vue/index.cjs +1 -0
- package/dist/vue/index.d.cts +38 -0
- package/dist/vue/index.js +1 -1
- package/package.json +23 -10
- package/dist/chunk-CY5E6WU4.js +0 -18
- package/dist/chunk-EKVKQZNN.js +0 -12
- package/dist/chunk-EQPK72XK.js +0 -14
- package/dist/chunk-I5GA5T23.cjs +0 -18
- package/dist/chunk-KQSBORXP.cjs +0 -12
- package/dist/chunk-QM4QO6LG.cjs +0 -26
- package/dist/chunk-YGWVUGQI.js +0 -26
package/README.md
CHANGED
|
@@ -1,138 +1,99 @@
|
|
|
1
1
|
# uitheme-web
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
The runtime has no mandatory framework or UI primitive dependencies.
|
|
3
|
+
https://github.com/user-attachments/assets/2819cf70-c474-478e-b821-6b26457c8d4a
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
Animated light and dark mode for your web app, with support for color themes
|
|
6
|
+
when one look isn't enough, so one app can carry several design systems. The
|
|
7
|
+
controls come ready-made from the registry, installed via its CLI (or the shadcn
|
|
8
|
+
CLI).
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
- Light, dark and system modes
|
|
11
|
+
- Color palettes that work on top of either mode
|
|
12
|
+
- Seven built-in transitions, powered by the View Transitions API
|
|
13
|
+
- Respects reduced motion, and falls back gracefully in older browsers
|
|
14
|
+
- No flash on load with Next.js, TanStack Start and Nuxt
|
|
15
|
+
- Remembers the choice and syncs it across tabs
|
|
16
|
+
- React, Next.js, TanStack Start, Vue and Nuxt from one package
|
|
17
|
+
- No Tailwind or design system required
|
|
11
18
|
|
|
12
|
-
|
|
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 |
|
|
19
|
+
Try it on [ui-theme.dev](https://www.ui-theme.dev).
|
|
22
20
|
|
|
23
|
-
|
|
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.
|
|
21
|
+
## Install
|
|
26
22
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
'use client';
|
|
23
|
+
```sh
|
|
24
|
+
npm install uitheme-web
|
|
25
|
+
```
|
|
31
26
|
|
|
32
|
-
|
|
27
|
+
## Use
|
|
33
28
|
|
|
34
|
-
|
|
35
|
-
const { resolvedTheme, switchTheme, mounted } = useUITheme();
|
|
29
|
+
Wrap your app in the provider, and choose a transition:
|
|
36
30
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
disabled={!mounted}
|
|
40
|
-
onClick={(event) =>
|
|
41
|
-
void switchTheme(resolvedTheme === 'dark' ? 'light' : 'dark', {
|
|
42
|
-
element: event.currentTarget,
|
|
43
|
-
})
|
|
44
|
-
}
|
|
45
|
-
>
|
|
46
|
-
Change appearance
|
|
47
|
-
</button>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
31
|
+
```tsx
|
|
32
|
+
import { UIThemeProvider } from 'uitheme-web/react';
|
|
50
33
|
|
|
51
34
|
export function App() {
|
|
52
35
|
return (
|
|
53
|
-
<UIThemeProvider>
|
|
54
|
-
<
|
|
36
|
+
<UIThemeProvider animationType="slide">
|
|
37
|
+
<YourApp />
|
|
55
38
|
</UIThemeProvider>
|
|
56
39
|
);
|
|
57
40
|
}
|
|
58
41
|
```
|
|
59
42
|
|
|
60
|
-
|
|
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`.
|
|
43
|
+
Then switch themes from anywhere:
|
|
64
44
|
|
|
65
|
-
|
|
45
|
+
```tsx
|
|
46
|
+
import { useUITheme } from 'uitheme-web/react';
|
|
66
47
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
import { createUITheme } from 'uitheme-web/vue';
|
|
70
|
-
import App from './App.vue';
|
|
48
|
+
function ThemeToggle() {
|
|
49
|
+
const { resolvedTheme, switchTheme } = useUITheme();
|
|
71
50
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
51
|
+
return (
|
|
52
|
+
<button
|
|
53
|
+
onClick={() => switchTheme(resolvedTheme === 'dark' ? 'light' : 'dark')}
|
|
54
|
+
>
|
|
55
|
+
Toggle theme
|
|
56
|
+
</button>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
75
59
|
```
|
|
76
60
|
|
|
77
|
-
|
|
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.
|
|
81
|
-
|
|
82
|
-
For Nuxt 4:
|
|
83
|
-
|
|
84
|
-
```ts
|
|
85
|
-
export default defineNuxtConfig({
|
|
86
|
-
modules: ['uitheme-web/nuxt'],
|
|
87
|
-
uiTheme: { colorThemes: ['default', 'ocean'] },
|
|
88
|
-
});
|
|
89
|
-
```
|
|
61
|
+
That's it. Style dark mode with the `dark` class, like you already do.
|
|
90
62
|
|
|
91
|
-
|
|
92
|
-
It does not register styled controls. Automatic Nuxt 3 setup is unsupported.
|
|
63
|
+
## Don't want to build the toggle?
|
|
93
64
|
|
|
94
|
-
|
|
65
|
+
Grab a ready-made one. The CLI sets up the provider and drops the control
|
|
66
|
+
straight into your codebase, so it's yours to tweak:
|
|
95
67
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
Pass the clicked element for a transition origin in viewport CSS pixels.
|
|
68
|
+
```sh
|
|
69
|
+
npx uitheme-cli init
|
|
70
|
+
npx uitheme-cli add theme-toggle
|
|
71
|
+
```
|
|
101
72
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
server requests do not share a global theme store.
|
|
73
|
+
Already on shadcn? [Add the registry](https://www.ui-theme.dev/docs/installation#install-with-shadcn)
|
|
74
|
+
and use `npx shadcn@latest add @uitheme/theme-toggle`.
|
|
105
75
|
|
|
106
|
-
|
|
76
|
+
[Browse all the controls →](https://www.ui-theme.dev/docs/components)
|
|
107
77
|
|
|
108
|
-
|
|
78
|
+
## Using another framework?
|
|
109
79
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
80
|
+
Each one has a short guide:
|
|
81
|
+
[Next.js](https://www.ui-theme.dev/docs/guides/nextjs) ·
|
|
82
|
+
[TanStack Start](https://www.ui-theme.dev/docs/guides/tanstack-start) ·
|
|
83
|
+
[Vue](https://www.ui-theme.dev/docs/guides/vue) ·
|
|
84
|
+
[Nuxt](https://www.ui-theme.dev/docs/guides/nuxt)
|
|
115
85
|
|
|
116
|
-
|
|
117
|
-
|
|
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.
|
|
86
|
+
Building for mobile? Check out
|
|
87
|
+
[`uitheme-rn`](https://www.npmjs.com/package/uitheme-rn) for React Native.
|
|
120
88
|
|
|
121
|
-
|
|
89
|
+
Coming from v1? The [migration guide](https://www.ui-theme.dev/docs/migration)
|
|
90
|
+
walks you through it.
|
|
122
91
|
|
|
123
|
-
|
|
124
|
-
primitives, and their prop types have moved out of the runtime. The old runtime
|
|
125
|
-
binary has moved to `uitheme-cli`.
|
|
92
|
+
## Documentation
|
|
126
93
|
|
|
127
|
-
|
|
128
|
-
|
|
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.
|
|
94
|
+
Palettes, transition options, the full API and more live at
|
|
95
|
+
[ui-theme.dev/docs](https://www.ui-theme.dev/docs).
|
|
133
96
|
|
|
134
|
-
|
|
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.
|
|
97
|
+
## License
|
|
137
98
|
|
|
138
|
-
|
|
99
|
+
MIT
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { MaybeRefOrGetter } from 'vue';
|
|
2
|
+
|
|
3
|
+
declare enum ThemeAnimationType {
|
|
4
|
+
CIRCLE = "circle",
|
|
5
|
+
BLUR_CIRCLE = "blur-circle",
|
|
6
|
+
SLIDE = "slide",
|
|
7
|
+
CLIP_PATH = "clip-path",
|
|
8
|
+
POLYGON_GRADIENT = "polygon-gradient",
|
|
9
|
+
TRIANGLE = "triangle",
|
|
10
|
+
SVG_LOGO = "svg-logo"
|
|
11
|
+
}
|
|
12
|
+
/** Clockwise from the top-left corner. */
|
|
13
|
+
declare const TRANSITION_DIRECTIONS: readonly ["top-left", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left"];
|
|
14
|
+
type TransitionDirection = (typeof TRANSITION_DIRECTIONS)[number];
|
|
15
|
+
type AnimationPosition = TransitionDirection | 'center' | 'trigger';
|
|
16
|
+
interface ThemeAnimationSettings {
|
|
17
|
+
/** Starting edge/corner for polygon wipes. Defaults to top-left. */
|
|
18
|
+
clipPathDirection?: TransitionDirection;
|
|
19
|
+
/** Fixed circle/triangle origin; SVG_LOGO always uses the viewport center. */
|
|
20
|
+
animationPosition?: AnimationPosition;
|
|
21
|
+
/** Stationary logo width in CSS pixels or auto; default is 96 when both are omitted. */
|
|
22
|
+
logoWidth?: number | 'auto';
|
|
23
|
+
/** Logo height in CSS pixels or auto; omitted dimensions preserve the SVG aspect ratio. */
|
|
24
|
+
logoHeight?: number | 'auto';
|
|
25
|
+
/** Gradient wipe feather in CSS pixels; defaults to 80. */
|
|
26
|
+
gradientWidth?: number;
|
|
27
|
+
}
|
|
28
|
+
/** Choose one shared asset, or both destination-specific assets. */
|
|
29
|
+
type ThemeLogoOptions = {
|
|
30
|
+
logo?: string;
|
|
31
|
+
logoLight?: never;
|
|
32
|
+
logoDark?: never;
|
|
33
|
+
} | {
|
|
34
|
+
logo?: never;
|
|
35
|
+
logoLight: string;
|
|
36
|
+
logoDark: string;
|
|
37
|
+
};
|
|
38
|
+
type ThemeAnimationOptions = ThemeAnimationSettings & ThemeLogoOptions;
|
|
39
|
+
type Theme = 'light' | 'dark' | 'system';
|
|
40
|
+
type ColorTheme = string;
|
|
41
|
+
type SlideDirection = 'left' | 'right' | 'top' | 'bottom' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
42
|
+
type ThemeControlTransitionProps = {
|
|
43
|
+
duration?: number;
|
|
44
|
+
} & ({
|
|
45
|
+
animationType: 'slide';
|
|
46
|
+
slideDirection?: SlideDirection;
|
|
47
|
+
} | {
|
|
48
|
+
animationType?: 'circle' | 'blur-circle' | 'clip-path' | 'polygon-gradient' | 'triangle' | 'svg-logo';
|
|
49
|
+
slideDirection?: never;
|
|
50
|
+
});
|
|
51
|
+
interface ThemeConfig {
|
|
52
|
+
themes?: readonly Theme[];
|
|
53
|
+
colorThemes?: readonly ColorTheme[];
|
|
54
|
+
defaultTheme?: Theme;
|
|
55
|
+
defaultColorTheme?: ColorTheme;
|
|
56
|
+
globalClassName?: string;
|
|
57
|
+
colorThemePrefix?: string;
|
|
58
|
+
storageKey?: string;
|
|
59
|
+
colorStorageKey?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
type ThemeBootstrapOptions = Omit<ThemeConfig, 'themes' | 'colorThemes'> & {
|
|
63
|
+
themes?: readonly Theme[];
|
|
64
|
+
colorThemes?: readonly string[];
|
|
65
|
+
storage?: unknown;
|
|
66
|
+
};
|
|
67
|
+
declare function getThemeScript(options?: ThemeBootstrapOptions): string;
|
|
68
|
+
|
|
69
|
+
type ThemeTransitionInput = boolean | {
|
|
70
|
+
element?: Element | null;
|
|
71
|
+
origin?: {
|
|
72
|
+
x: number;
|
|
73
|
+
y: number;
|
|
74
|
+
};
|
|
75
|
+
animationOff?: boolean;
|
|
76
|
+
};
|
|
77
|
+
type ThemeTrigger = ThemeTransitionInput | MouseEvent;
|
|
78
|
+
type TransitionOptions = ThemeAnimationOptions & {
|
|
79
|
+
animationType?: ThemeAnimationType | `${ThemeAnimationType}`;
|
|
80
|
+
duration?: number;
|
|
81
|
+
easing?: string;
|
|
82
|
+
blurAmount?: number;
|
|
83
|
+
styleId?: string;
|
|
84
|
+
slideDirection?: SlideDirection;
|
|
85
|
+
slideFromX?: number;
|
|
86
|
+
slideFromY?: number;
|
|
87
|
+
slideToX?: number;
|
|
88
|
+
slideToY?: number;
|
|
89
|
+
};
|
|
90
|
+
interface ThemeStorage {
|
|
91
|
+
getItem(key: string): string | null;
|
|
92
|
+
setItem(key: string, value: string): void;
|
|
93
|
+
}
|
|
94
|
+
type UIThemeOptions = Omit<ThemeConfig, 'themes' | 'colorThemes'> & TransitionOptions & {
|
|
95
|
+
themes?: readonly Theme[];
|
|
96
|
+
colorThemes?: readonly string[];
|
|
97
|
+
storage?: ThemeStorage | false;
|
|
98
|
+
onThemeChange?: (theme: Theme) => void;
|
|
99
|
+
onColorThemeChange?: (theme: string) => void;
|
|
100
|
+
};
|
|
101
|
+
type ReactiveTransitionOptions = MaybeRefOrGetter<TransitionOptions>;
|
|
102
|
+
|
|
103
|
+
export { getThemeScript as j };
|
|
104
|
+
export type { AnimationPosition as A, ColorTheme as C, ReactiveTransitionOptions as R, SlideDirection as S, Theme as T, UIThemeOptions as U, ThemeTrigger as a, ThemeAnimationOptions as b, ThemeConfig as c, ThemeControlTransitionProps as d, ThemeLogoOptions as e, ThemeStorage as f, ThemeTransitionInput as g, TransitionDirection as h, TransitionOptions as i };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var t=e=>JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"),u='t=="dark"||t=="system"&&matchMedia("(prefers-color-scheme: dark)").matches',c=(e,n,s,r)=>e?s?`(v=g(${t(n)}),${t(s)}.includes(v)?v:${t(r)})`:`g(${t(n)})||${t(r)}`:t(r),d=(e,[n,s,r],[o,g,i],a,l)=>`(function(){try{var d=document.documentElement,l=d.classList,${e?"v,g=function(k){try{return localStorage.getItem(k)}catch(e){}},":""}t=${c(e,n,s,r)},p=${c(e,o,g,i)},q=${a};${l}}catch(e){console.warn(e)}})()`;exports.a=t;exports.b=u;exports.c=d;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {c,d,b,a}from'./chunk-CTNYTI5Q.js';var r=e=>JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"),p='t=="dark"||t=="system"&&matchMedia("(prefers-color-scheme: dark)").matches',u=(e,o,t,s)=>e?t?`(v=g(${r(o)}),${r(t)}.includes(v)?v:${r(s)})`:`g(${r(o)})||${r(s)}`:r(s),f=(e,[o,t,s],[l,m,c],a,n)=>`(function(){try{var d=document.documentElement,l=d.classList,${e?"v,g=function(k){try{return localStorage.getItem(k)}catch(e){}},":""}t=${u(e,o,t,s)},p=${u(e,l,m,c)},q=${a};${n}}catch(e){console.warn(e)}})()`;function y(e={}){let o=e.themes??["light","dark","system"],t=e.colorThemes??["default"],s=e.defaultTheme??"system",l=e.defaultColorTheme??t[0],m=e.globalClassName??c,c$1=e.colorThemePrefix??d;if(!o.length||!o.every(n=>["light","dark","system"].includes(n))||!o.includes(s))throw new Error("themes must include defaultTheme and contain light, dark, or system.");if(!l||!t.includes(l)||![m,...t.map(n=>`${c$1}${n}`)].every(n=>n.length>0&&!/\s/.test(n)))throw new Error("Color themes and class names must be valid CSS class tokens.");let a$1=e.storage===void 0;return f(a$1,[e.storageKey??a,o,s],[e.colorStorageKey??b,t,l],p,`l.toggle(${r(m)},q);d.style.colorScheme=q?"dark":"light";${r(t)}.forEach(function(v){l.toggle(${r(c$1)}+v,v==p)})`)}export{y as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=e=>JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"),u='t=="dark"||t=="system"&&matchMedia("(prefers-color-scheme: dark)").matches',c=(e,n,s,r)=>e?s?`(v=g(${t(n)}),${t(s)}.includes(v)?v:${t(r)})`:`g(${t(n)})||${t(r)}`:t(r),d=(e,[n,s,r],[o,g,i],a,l)=>`(function(){try{var d=document.documentElement,l=d.classList,${e?"v,g=function(k){try{return localStorage.getItem(k)}catch(e){}},":""}t=${c(e,n,s,r)},p=${c(e,o,g,i)},q=${a};${l}}catch(e){console.warn(e)}})()`;export{t as a,u as b,d as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkR7KPCTX4_cjs=require('./chunk-R7KPCTX4.cjs'),chunk4HBM4JJB_cjs=require('./chunk-4HBM4JJB.cjs'),chunkCYGYUQUK_cjs=require('./chunk-CYGYUQUK.cjs'),se=require('react'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var se__default=/*#__PURE__*/_interopDefault(se);var ee=t=>{let o;return {controller:chunkR7KPCTX4_cjs.j(t,{commit:e=>reactDom.flushSync(e),getElement:()=>o?.current??null}),connectTrigger:e=>{o=e;}}},B=(t={})=>{let o=se.useRef(null),[r]=se.useState(()=>ee(t)),{controller:e}=r,n=se.useRef(t),h=se.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return se.useLayoutEffect(()=>{let i=Object.fromEntries(Object.keys(n.current).filter(m=>!(m in t)).map(m=>[m,void 0]));e.updateOptions({...i,...t}),n.current=t;}),se.useLayoutEffect(()=>(r.connectTrigger(o),e.mount()),[e,r]),se.useMemo(()=>({...h,ref:o,setTheme:e.setTheme,setColorTheme:e.setColorTheme,switchTheme:e.switchTheme,switchColorTheme:e.switchColorTheme,toggleTheme:e.toggleTheme,toggleLightTheme:e.toggleLightTheme,toggleDarkTheme:e.toggleDarkTheme,toggleColorTheme:e.toggleColorTheme,createColorThemeToggle:e.createColorThemeToggle,isColorThemeActive:e.isColorThemeActive}),[h,e])};var oe=()=>()=>{},re=()=>true,ne=()=>false,$=()=>se.useSyncExternalStore(oe,re,ne);var U=se.createContext(null);var E=se.createContext(void 0),R=se__default.default.memo(({themes:t,colorThemes:o,storageKey:r,colorStorageKey:e,defaultTheme:n,defaultColorTheme:h,attribute:i,globalClassName:m,colorThemePrefix:c,nonce:u})=>{let d=chunk4HBM4JJB_cjs.c(true,[r,t,n],[e,o,h],chunk4HBM4JJB_cjs.b,`${i==="data-theme"?'d.setAttribute("data-theme",q?"dark":"light")':`l.toggle(${chunk4HBM4JJB_cjs.a(m)},q)`};d.style.colorScheme=q?"dark":"light";l.add(${chunk4HBM4JJB_cjs.a(c)}+p)`);return jsxRuntime.jsx("script",{nonce:u,suppressHydrationWarning:true,dangerouslySetInnerHTML:{__html:d}})});R.displayName="ThemePreHydrationScript";var Ne=({children:t,themes:o=["light","dark","system"],colorThemes:r=["default"],defaultTheme:e="system",defaultColorTheme:n=r[0]??"default",animationType:h="circle",clipPathDirection:i,animationPosition:m,logo:c,logoLight:u,logoDark:d,logoWidth:V,logoHeight:W,gradientWidth:Y,duration:X=400,storageKey:g=chunkCYGYUQUK_cjs.a,colorStorageKey:p=chunkCYGYUQUK_cjs.b,attribute:y="class",globalClassName:C=chunkCYGYUQUK_cjs.c,colorThemePrefix:f=chunkCYGYUQUK_cjs.d,nonce:x,disableAnimationOnInit:N=true,disablePreHydrationScript:b=false})=>{let S=$(),l=B({themes:o,colorThemes:r,defaultTheme:e,defaultColorTheme:n,animationType:h,clipPathDirection:i,animationPosition:m,...chunkR7KPCTX4_cjs.c({logo:c,logoLight:u,logoDark:d}),logoWidth:V,logoHeight:W,gradientWidth:Y,duration:X,storageKey:g,colorStorageKey:p,globalClassName:y==="class"?C:void 0,colorThemePrefix:f,nonce:x}),T=se.useCallback(async(s,P=false)=>{!S&&N?l.setTheme(s):await l.switchTheme(s,P);},[S,N,l]),I=se.useCallback((s,P)=>T(s,{element:P}),[T]),A=se.useMemo(()=>({...l,switchTheme:T,switchThemeFromElement:I}),[l,T,I]);if(!S){let s={themes:o,colorThemes:r,mounted:false,ref:{current:null},theme:e,colorTheme:n,resolvedTheme:e==="dark"?"dark":"light",systemTheme:"light",setTheme:()=>{},setColorTheme:()=>{},switchTheme:async()=>{},switchThemeFromElement:async()=>{},switchColorTheme:async()=>{},toggleTheme:async()=>{},toggleLightTheme:async()=>{},toggleDarkTheme:async()=>{},toggleColorTheme:async()=>{},createColorThemeToggle:()=>async()=>{},isColorThemeActive:()=>false};return jsxRuntime.jsx(E.Provider,{value:s,children:jsxRuntime.jsxs(U.Provider,{value:s,children:[!b&&jsxRuntime.jsx(R,{themes:o,colorThemes:r,storageKey:g,colorStorageKey:p,defaultTheme:e,defaultColorTheme:n,attribute:y,globalClassName:C,colorThemePrefix:f,nonce:x}),t]})})}return jsxRuntime.jsx(E.Provider,{value:A,children:jsxRuntime.jsxs(U.Provider,{value:A,children:[!b&&jsxRuntime.jsx(R,{themes:o,colorThemes:r,storageKey:g,colorStorageKey:p,defaultTheme:e,defaultColorTheme:n,attribute:y,globalClassName:C,colorThemePrefix:f,nonce:x}),t]})})},be=()=>{let t=se.useContext(E);if(t===void 0)throw new Error("useNextUITheme must be used within a NextUIThemeProvider");return t};exports.a=B;exports.b=U;exports.c=$;exports.d=Ne;exports.e=be;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var y=t=>{let e=document.createElement("style");return t&&(e.nonce=t),e};var x=typeof window<"u",W=t=>{if(!x||document.getElementById("ui-theme-base-style"))return;let e=y(t);e.id="ui-theme-base-style",e.textContent=`
|
|
2
|
+
html[data-ui-theme-transition]::view-transition-group(root),
|
|
3
|
+
html[data-ui-theme-transition]::view-transition-old(root),
|
|
4
|
+
html[data-ui-theme-transition]::view-transition-new(root) {
|
|
5
|
+
animation: none;
|
|
6
|
+
}
|
|
7
|
+
html[data-ui-theme-transition]::view-transition-old(root),
|
|
8
|
+
html[data-ui-theme-transition]::view-transition-new(root) {
|
|
9
|
+
mix-blend-mode: normal;
|
|
10
|
+
}
|
|
11
|
+
html[data-ui-theme-transition],
|
|
12
|
+
html[data-ui-theme-transition] *,
|
|
13
|
+
html[data-ui-theme-transition] *::before,
|
|
14
|
+
html[data-ui-theme-transition] *::after {
|
|
15
|
+
transition: none !important;
|
|
16
|
+
}
|
|
17
|
+
`,document.head.appendChild(e);},B=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>')`,M=()=>x&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",H=t=>t==="system"?M():t==="dark"?"dark":"light",I=t=>t==="system"?"system":t==="dark"?"dark":"light",D=()=>x&&document.startViewTransition instanceof Function,F=()=>x&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,j=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}}},v=t=>t/window.innerWidth*100,A=t=>t/window.innerHeight*100,$=(t,e)=>{let{innerWidth:n,innerHeight:o}=window;return Math.hypot(Math.max(Math.abs(t),Math.abs(n-t)),Math.max(Math.abs(e),Math.abs(o-e)))+1},k=()=>{let t=getComputedStyle(document.documentElement,"::view-transition-new(root)"),{innerWidth:e,innerHeight:n}=window;return {x:(parseFloat(t.width)||e)/e,y:(parseFloat(t.height)||n)/n}},P=t=>{let{innerWidth:e,innerHeight:n}=window;return t/(Math.hypot(e,n)/Math.SQRT2)*100},G=t=>{let e=t.includes("left")?0:t.includes("right")?window.innerWidth:window.innerWidth/2,n=t.includes("top")?0:t.includes("bottom")?window.innerHeight:window.innerHeight/2;return {x:e,y:n}},R=0,g=(t,e)=>{let n=document.documentElement.animate(e,{duration:t.duration,easing:t.easing,fill:"both",pseudoElement:"::view-transition-new(root)"}),o=n.effect;if(!(o instanceof KeyframeEffect))return n;let i=o.getKeyframes(),r=i.some(l=>"clipPath"in l)?"clipPath":i.some(l=>"maskImage"in l)?"maskImage":"transform";if(getComputedStyle(document.documentElement,"::view-transition-new(root)")[r]!=="none")return n;let d=n.playState==="paused",c=n.currentTime;n.cancel(),n.finished.catch(()=>{});let s=`ui-theme-reveal-${++R}`,a=y(t.nonce),p=i.map(l=>{let b=Object.entries(l).filter(([f])=>!["offset","computedOffset","easing","composite"].includes(f)).map(([f,w])=>`${f.replace(/[A-Z]/g,S=>`-${S.toLowerCase()}`)}:${w};`).join("");return `${l.computedOffset*100}%{${b}}`}).join("");a.textContent=`@keyframes ${s}{${p}}html[data-ui-theme-transition]::view-transition-new(root){animation:${s} ${t.duration}ms ${t.easing} both;}`,document.head.appendChild(a);let h=getComputedStyle(document.documentElement,"::view-transition-new(root)").animationName,u=document.getAnimations().find(l=>l instanceof CSSAnimation&&l.animationName===h);if(!u)throw a.remove(),new Error("Transition pseudo animations are unavailable");return d&&(u.pause(),u.currentTime=c),u.finished.then(()=>a.remove(),()=>a.remove()),u},K=t=>{let e=t.clipPathDirection??"top-left",n={"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 g(t,{clipPath:[n[e],o[e]]})},O=t=>{let e=t.clipPathDirection??"top-left",n=k(),o=window.innerWidth*n.x,i=window.innerHeight*n.y,r=e.includes("-"),m=e.includes("left"),d=e.includes("top"),c=e==="left"||e==="right",s=m?0:e.includes("right")?1:.5,a=d?0:e.includes("bottom")?1:.5,p=r||c?o*3:o,h=r||!c?i*3:i,u=r?`${s*100},${a*100} ${(1-s)*100},${a*100} ${s*100},${(1-a)*100}`:"0,0 100,0 100,100 0,100",l=r?p*h/Math.hypot(p,h):c?p:h,f=1-Math.max(0,Math.min(t.gradientWidth??80,l*.2))/l,w=`<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*(r?.5:c?1-s:s)}" y2="${100*(r?.5:c?a:1-a)}" gradientUnits="userSpaceOnUse"><stop offset="${f}" stop-color="black"/><stop offset="1" stop-color="black" stop-opacity="0"/></linearGradient></defs><polygon points="${u}" fill="url(#edge)"/></svg>`;return g(t,{maskImage:[`url("data:image/svg+xml,${encodeURIComponent(w)}")`,`url("data:image/svg+xml,${encodeURIComponent(w)}")`],maskMode:["alpha","alpha"],maskRepeat:["no-repeat","no-repeat"],maskSize:[r?"0px 0px":c?`0px ${h}px`:`${p}px 0px`,`${p}px ${h}px`],maskPosition:[`${s*o}px ${a*i}px`,`${s*(o-p)}px ${a*(i-h)}px`]})},U=t=>{let{x:e,y:n}=t,o=$(e,n),i=Math.sqrt(3)*o,r=(d,c)=>`${v(d)}% ${A(c)}%`,m=r(e,n);return g(t,{clipPath:[`polygon(${m}, ${m}, ${m})`,`polygon(${r(e,n-2*o)}, ${r(e+i,n+o)}, ${r(e-i,n+o)})`]})},z=t=>{let{innerWidth:e,innerHeight:n}=window;return C({...t,x:e/2,y:n/2})},C=t=>{let{x:e,y:n}=t,o=`at ${v(e)}% ${A(n)}%`;return g(t,{clipPath:[`circle(0% ${o})`,`circle(${P($(e,n))}% ${o})`]})},N=t=>{let{a:e=-100,b:n=0,x:o=0,y:i=0}=t;return g(t,{transform:[`translate(${e}%, ${n}%)`,`translate(${o}%, ${i}%)`]})},q=t=>{let{x:e,y:n,blurAmount:o}=t;if(o<=0)return C(t);let i=Math.min(o,20),r=$(e,n)+i,m=k(),[d,c,s,a]=[e*m.x,n*m.y,r*m.x,r*m.y];return g(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",`${s*2}px ${a*2}px`],maskPosition:[`${d}px ${c}px`,`${d-s}px ${c-a}px`]})};
|
|
18
|
+
export{y as a,W as b,B as c,M as d,H as e,I as f,D as g,F as h,j as i,G as j,K as k,O as l,U as m,z as n,C as o,N as p,q};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var r=e=>JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"),i='t=="dark"||t=="system"&&matchMedia("(prefers-color-scheme: dark)").matches',h=(e,o,t,s)=>e?t?`(v=g(${r(o)}),${r(t)}.includes(v)?v:${r(s)})`:`g(${r(o)})||${r(s)}`:r(s),g=(e,[o,t,s],[c,l,m],a,n)=>`(function(){try{var d=document.documentElement,l=d.classList,${e?"v,g=function(k){try{return localStorage.getItem(k)}catch(e){}},":""}t=${h(e,o,t,s)},p=${h(e,c,l,m)},q=${a};${n}}catch(e){console.warn(e)}})()`;var d="theme",p="color-theme",T="dark",u="theme-";function y(e={}){let o=e.themes??["light","dark","system"],t=e.colorThemes??["default"],s=e.defaultTheme??"system",c=e.defaultColorTheme??t[0],l=e.globalClassName??T,m=e.colorThemePrefix??u;if(!o.length||!o.every(n=>["light","dark","system"].includes(n))||!o.includes(s))throw new Error("themes must include defaultTheme and contain light, dark, or system.");if(!c||!t.includes(c)||![l,...t.map(n=>`${m}${n}`)].every(n=>n.length>0&&!/\s/.test(n)))throw new Error("Color themes and class names must be valid CSS class tokens.");let a=e.storage===void 0;return g(a,[e.storageKey??d,o,s],[e.colorStorageKey??p,t,c],i,`l.toggle(${r(l)},q);d.style.colorScheme=q?"dark":"light";${r(t)}.forEach(function(v){l.toggle(${r(m)}+v,v==p)})`)}exports.a=d;exports.b=p;exports.c=T;exports.d=u;exports.e=y;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {g,h,b as b$1,p,q,k,l,m,n,o,d,e,a as a$1,i,j}from'./chunk-F4BPBR2Y.js';import {a,b,c,d as d$1,h as h$1,f}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||{}),Ke=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"];var _=o=>{if(o.logoLight!==void 0||o.logoDark!==void 0){if(!o.logoLight||!o.logoDark)throw new Error("logoLight and logoDark must both be provided.");if(o.logo!==void 0)throw new Error("Use logo or the logoLight/logoDark pair, not both.");return {logoLight:o.logoLight,logoDark:o.logoDark}}return {logo:o.logo}},Ne=0,xe=o=>{let r=$e(o.logo);if(!r)return;let t=o.logoWidth!=="auto"&&o.logoWidth&&Number.isFinite(o.logoWidth)&&o.logoWidth>0?o.logoWidth:void 0,n=o.logoHeight!=="auto"&&o.logoHeight&&Number.isFinite(o.logoHeight)&&o.logoHeight>0?o.logoHeight:void 0,d=t??(n?n*r.aspectRatio:o.logoWidth==="auto"||o.logoHeight==="auto"?r.naturalWidth:96),m=n??d/r.aspectRatio,c=`ui-theme-logo-${++Ne}`,a=document.createElement("img");a.src=r.image,a.alt="",a.setAttribute("aria-hidden","true"),a.setAttribute("data-ui-theme-logo",""),a.style.cssText=`position:fixed;left:calc(50% - ${d/2}px);top:calc(50% - ${m/2}px);width:${d}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=a$1(o.nonce);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 ${o.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,Oe=o=>{if(typeof window>"u")return Promise.resolve();let r=Q.get(o);if(r)return r.loading;let t={loading:Promise.resolve()};return Q.set(o,t),t.loading=(async()=>{let n=new AbortController,d=setTimeout(()=>n.abort(),2e3);try{let m=await fetch(o,{signal:n.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(d);}})(),t.loading},$e=o=>o?Q.get(o)?.ready:void 0;var D=new WeakMap,Ae=async(o$1,r)=>{if(typeof document>"u"){await o$1();return}let t=D.get(document);t?.transition?.skipTransition(),t?.animation?.cancel(),t?.logo?.element.remove(),t?.logo?.style.remove();let n$1={updateDone:Promise.resolve()};D.set(document,n$1);let d=()=>{n$1.animation?.cancel(),n$1.logo?.element.remove(),n$1.logo?.style.remove(),D.get(document)===n$1&&(D.delete(document),document.documentElement.removeAttribute("data-ui-theme-transition"));};n$1.updateDone=(async()=>{if(t&&await t.updateDone.catch(()=>{}),D.get(document)!==n$1||!r||!g()||h()||document.visibilityState==="hidden"){await o$1();return}b$1(r.nonce),document.documentElement.setAttribute("data-ui-theme-transition",""),r.animationType==="svg-logo"&&(n$1.logo=xe(r));let m;try{m=document.startViewTransition(o$1);}catch{await o$1();return}n$1.transition=m,m.ready.catch(()=>{}),m.finished.then(d,d),await m.updateCallbackDone;})();try{await n$1.updateDone;let m$1=n$1.transition;if(!m$1){d();return}try{await m$1.ready;}catch{d();return}if(D.get(document)!==n$1){m$1.skipTransition();return}if(!r)return;try{n$1.animation=r.animationType==="slide"?p(r):r.animationType==="blur-circle"?q(r):r.animationType==="clip-path"?k(r):r.animationType==="polygon-gradient"?l(r):r.animationType==="triangle"?m(r):r.animationType==="svg-logo"?n(r):o(r),n$1.animation.finished.catch(()=>{});let c=n$1.animation.effect;!(n$1.animation instanceof CSSAnimation)&&(!(c instanceof KeyframeEffect)||c.pseudoElement!=="::view-transition-new(root)")&&(m$1.skipTransition(),d());}catch{m$1.skipTransition(),d();}}catch(m){throw d(),m}};var B=typeof window<"u",Ie=(o=a,r=["light","dark","system"],t="system")=>{if(!B)return t;let n;try{n=localStorage.getItem(o);}catch{return t}return r.find(d=>d===n)??t},De=(o,r=a)=>{B&&localStorage.setItem(r,o);},ke=(o=b,r=["default"],t="default")=>{if(!B)return t;let n;try{n=localStorage.getItem(o);}catch{return t}return n&&r.includes(n)?n:t},Pe=(o,r=b)=>{B&&localStorage.setItem(r,o);};function G(o){if(!["light","dark","system"].includes(o))throw new Error("Theme must be light, dark, or system.")}function M(o,r){let t=`${r}${o}`;if(!t.length||/\s/.test(t))throw new Error("Theme classes must be nonempty CSS class tokens.")}function Z(o={}){let r=o.themes??["light","dark","system"],t=o.colorThemes??["default"],n=o.defaultTheme??"system",d=o.defaultColorTheme??t[0],m=o.globalClassName??c,c$1=o.colorThemePrefix??d$1;if(!r.length||!r.every(a=>["light","dark","system"].includes(a))||!r.includes(n))throw new Error("themes must include the defaultTheme and contain light, dark, or system.");if(d===void 0||!t.includes(d))throw new Error("colorThemes must include the defaultColorTheme.");if(![m,...t.map(a=>`${c$1}${a}`)].every(a=>a.length>0&&!/\s/.test(a)))throw new Error("Theme classes must be nonempty CSS class tokens.");return {themes:Object.freeze([...r]),colorThemes:Object.freeze([...t]),defaultTheme:n,defaultColorTheme:d,globalClassName:m,colorThemePrefix:c$1,storageKey:o.storageKey??a,colorStorageKey:o.colorStorageKey??b}}var Y=(o,r)=>o.length===r.length&&o.every((t,n)=>t===r[n]),Re=o=>o&&o!==true&&"currentTarget"in o?{element:o.currentTarget,animationOff:o.detail===0}:o,ot=(o={},r={})=>{let t=o,n=Z(t);_(t);let d$1=(e,s)=>{e.theme!==void 0&&G(e.theme),e.initialTheme!==void 0&&G(e.initialTheme),e.colorTheme!==void 0&&M(e.colorTheme,s),e.initialColorTheme!==void 0&&M(e.initialColorTheme,s);};d$1(t,n.colorThemePrefix);let m=e=>{try{return t.storage?t.storage.getItem(e):null}catch{return null}},c=()=>{if(t.storage===void 0)return Ie(t.storageKey,n.themes,n.defaultTheme);let e=m(t.storageKey??a);return n.themes.find(s=>s===e)??n.defaultTheme},a$1=()=>{if(t.storage===void 0)return ke(t.colorStorageKey,n.colorThemes,n.defaultColorTheme);let e=m(t.colorStorageKey??b);return n.colorThemes.find(s=>s===e)??n.defaultColorTheme},T=t.initialTheme??c(),u=t.initialColorTheme??a$1(),ee=false,te=false,k=d(),x=false,N=0,w=0,j$1,$,K,W,q=new Set,oe=t.theme??t.initialTheme??n.defaultTheme,ne={theme:oe,colorTheme:t.colorTheme??t.initialColorTheme??n.defaultColorTheme,resolvedTheme:oe==="dark"?"dark":"light",systemTheme:"light",themes:n.themes,colorThemes:n.colorThemes,mounted:false},l={...ne,theme:t.theme??T,colorTheme:t.colorTheme??u,resolvedTheme:e(t.theme??T),systemTheme:k},O=l.theme,P=l.colorTheme,p=l.theme,b$2=l.colorTheme,_e=()=>{if(!x||typeof document>"u")return;let e=document.documentElement,s=n.globalClassName,h=n.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(i=>e.classList.remove(`${h}${i}`)),K=`${h}${l.colorTheme}`,e.classList.add(K);},E=()=>{let e=t.theme??T,s=t.colorTheme??u,h=n.themes,i=n.colorThemes,g={theme:e,colorTheme:s,resolvedTheme:e==="system"?k:e,systemTheme:k,themes:Y(l.themes,h)?l.themes:h,colorThemes:Y(l.colorThemes,i)?l.colorThemes:i,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),_e(),y&&q.forEach(C=>C());},re=()=>{if(t.animationType==="svg-logo")for(let e of [t.logo,t.logoLight,t.logoDark])e&&Oe(e);},ie=e=>{try{e();}catch(s){let h=s instanceof Error?s:new Error(String(s));r.onBrowserStorageError?r.onBrowserStorageError(h):console.warn("Unable to persist the theme preference:",h);}},se=e=>{G(e),t.storage===void 0?ie(()=>De(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=>{M(e,n.colorThemePrefix),t.storage===void 0?ie(()=>Pe(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);},Ge=(e$1=false)=>{let s=e$1===true||e$1===false?{animationOff:e$1}:e$1,h=s.logo!==void 0||s.logoLight!==void 0||s.logoDark!==void 0,i$1={...t,...Object.fromEntries(Object.entries(s).filter(([,R])=>R!==void 0))};h&&Object.assign(i$1,{logo:void 0,logoLight:void 0,logoDark:void 0,..._(s)}),_(i$1);let g=i$1.duration??400;if(s.animationOff||g<=0||typeof window>"u")return null;let y=Object.values(J).find(R=>R===i$1.animationType)??"circle",C={duration:g,easing:i$1.easing??f,animationType:y,blurAmount:i$1.blurAmount??2,styleId:i$1.styleId??h$1,nonce:t.nonce};if(y==="slide"){let R=i$1.slideFromX!==void 0&&i$1.slideFromY!==void 0?{a:i$1.slideFromX,b:i$1.slideFromY}:i(i$1.slideDirection??"left");return {...C,...R,x:i$1.slideToX??0,y:i$1.slideToY??0}}let A=s.element??r.getElement?.(),v=s.origin?null:A?.getBoundingClientRect(),f$1=(y==="svg-logo"?j("center"):null)??s.origin??(i$1.animationPosition&&i$1.animationPosition!=="trigger"?j(i$1.animationPosition):null)??(v?{x:v.left+v.width/2,y:v.top+v.height/2}:y==="circle"||y==="blur-circle"?null:j("center"));return !f$1||!Number.isFinite(f$1.x)||!Number.isFinite(f$1.y)?null:{...C,...f$1,clipPathDirection:i$1.clipPathDirection??"top-left",animationPosition:i$1.animationPosition,logo:i$1.logoLight!==void 0?e(O)==="light"?i$1.logoLight:i$1.logoDark:i$1.logo,logoWidth:i$1.logoWidth,logoHeight:i$1.logoHeight,gradientWidth:i$1.gradientWidth}},le=async(e,s)=>{let h=Ge(s),i=w,g=()=>{i===w&&e();};N++;try{await Ae(()=>{if(i===w)return r.commit?r.commit(g):g()},h);}finally{i===w&&N--;}},F=async(e,s)=>{if(G(e),!n.themes.includes(e)){console.warn(`Theme "${e}" not found in available themes`);return}if(e===p)return;p=e;let h=w;try{await le(()=>se(e),s);}catch(i){throw h===w&&p===e&&(p=O),i}},X=async(e,s)=>{if(!n.colorThemes.includes(e)){console.warn(`Color theme "${e}" not found in available themes`);return}if(e===b$2)return;b$2=e;let h=w;try{await le(()=>ae(e),s);}catch(i){throw h===w&&b$2===e&&(b$2=P),i}},z=()=>{w++,N=0,j$1?.(),j$1=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()),!te&&t.initialColorTheme===void 0&&(u=a$1()),O=p=t.theme??T,P=b$2=t.colorTheme??u,k=d();let e=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>{k=d(),E();},h=i=>{if(i.storageArea&&i.storageArea!==window.localStorage)return;let g=n.themes,y=n.colorThemes;if((i.key===null||i.key===(t.storageKey??a))&&t.theme===void 0){let C=i.newValue??n.defaultTheme,A=g.find(v=>v===C);A!==void 0&&(T=O=p=A);}if((i.key===null||i.key===(t.colorStorageKey??b))&&t.colorTheme===void 0){let C=i.newValue??n.defaultColorTheme;y.includes(C)&&(u=P=b$2=C);}E();};return e.addEventListener("change",s),$=()=>{window.removeEventListener("storage",h),t.storage===void 0&&window.addEventListener("storage",h);},$(),j$1=()=>{e.removeEventListener("change",s),window.removeEventListener("storage",h);},b$1(t.nonce),re(),E(),z},dispose:z,updateOptions:e=>{let s=l.theme,h=l.colorTheme,i={...t,...e},{logo:g,logoLight:y,logoDark:C,...A}=i,v={...A,..._({logo:g,logoLight:y,logoDark:C})},f=Z(v);d$1(v,f.colorThemePrefix),!Y(n.themes,f.themes)&&!f.themes.includes(T)&&(T=f.defaultTheme),!Y(n.colorThemes,f.colorThemes)&&!f.colorThemes.includes(u)&&(u=f.defaultColorTheme),t=v,n=f,E(),N===0&&(s!==l.theme&&(O=p=l.theme),h!==l.colorTheme&&(P=b$2=l.colorTheme)),x&&(re(),$?.());},setTheme:e=>{se(e),p=e;},setColorTheme:e=>{ae(e),b$2=e;},switchTheme:F,switchColorTheme:X,toggleTheme:e$1=>{let s=e(p)==="dark"?"light":"dark",h=n.themes.includes(s)?s:n.themes[(n.themes.indexOf(p)+1)%n.themes.length];return F(h,e$1)},toggleLightTheme:async e$1=>{e(p)!=="light"&&await F("light",e$1);},toggleDarkTheme:async e$1=>{e(p)!=="dark"&&await F("dark",e$1);},toggleColorTheme:async e=>{let s=n.colorThemes;s.length!==0&&await X(s[(s.indexOf(b$2)+1)%s.length],Re(e));},createColorThemeToggle:e=>s=>X(e,Re(s)),isColorThemeActive:e=>l.colorTheme===e}};
|
|
12
|
+
export{J as a,Ke as b,_ as c,Oe as d,Ae as e,Ie as f,De as g,ke as h,Pe as i,ot as j};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';var chunkUW5NJ23X_cjs=require('./chunk-UW5NJ23X.cjs'),chunkCYGYUQUK_cjs=require('./chunk-CYGYUQUK.cjs');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||{}),Ke=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"];var _=o=>{if(o.logoLight!==void 0||o.logoDark!==void 0){if(!o.logoLight||!o.logoDark)throw new Error("logoLight and logoDark must both be provided.");if(o.logo!==void 0)throw new Error("Use logo or the logoLight/logoDark pair, not both.");return {logoLight:o.logoLight,logoDark:o.logoDark}}return {logo:o.logo}},Ne=0,xe=o=>{let r=$e(o.logo);if(!r)return;let t=o.logoWidth!=="auto"&&o.logoWidth&&Number.isFinite(o.logoWidth)&&o.logoWidth>0?o.logoWidth:void 0,n=o.logoHeight!=="auto"&&o.logoHeight&&Number.isFinite(o.logoHeight)&&o.logoHeight>0?o.logoHeight:void 0,d=t??(n?n*r.aspectRatio:o.logoWidth==="auto"||o.logoHeight==="auto"?r.naturalWidth:96),m=n??d/r.aspectRatio,c=`ui-theme-logo-${++Ne}`,a=document.createElement("img");a.src=r.image,a.alt="",a.setAttribute("aria-hidden","true"),a.setAttribute("data-ui-theme-logo",""),a.style.cssText=`position:fixed;left:calc(50% - ${d/2}px);top:calc(50% - ${m/2}px);width:${d}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=chunkUW5NJ23X_cjs.a(o.nonce);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 ${o.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,Oe=o=>{if(typeof window>"u")return Promise.resolve();let r=Q.get(o);if(r)return r.loading;let t={loading:Promise.resolve()};return Q.set(o,t),t.loading=(async()=>{let n=new AbortController,d=setTimeout(()=>n.abort(),2e3);try{let m=await fetch(o,{signal:n.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(d);}})(),t.loading},$e=o=>o?Q.get(o)?.ready:void 0;var D=new WeakMap,Ae=async(o,r)=>{if(typeof document>"u"){await o();return}let t=D.get(document);t?.transition?.skipTransition(),t?.animation?.cancel(),t?.logo?.element.remove(),t?.logo?.style.remove();let n={updateDone:Promise.resolve()};D.set(document,n);let d=()=>{n.animation?.cancel(),n.logo?.element.remove(),n.logo?.style.remove(),D.get(document)===n&&(D.delete(document),document.documentElement.removeAttribute("data-ui-theme-transition"));};n.updateDone=(async()=>{if(t&&await t.updateDone.catch(()=>{}),D.get(document)!==n||!r||!chunkUW5NJ23X_cjs.g()||chunkUW5NJ23X_cjs.h()||document.visibilityState==="hidden"){await o();return}chunkUW5NJ23X_cjs.b(r.nonce),document.documentElement.setAttribute("data-ui-theme-transition",""),r.animationType==="svg-logo"&&(n.logo=xe(r));let m;try{m=document.startViewTransition(o);}catch{await o();return}n.transition=m,m.ready.catch(()=>{}),m.finished.then(d,d),await m.updateCallbackDone;})();try{await n.updateDone;let m=n.transition;if(!m){d();return}try{await m.ready;}catch{d();return}if(D.get(document)!==n){m.skipTransition();return}if(!r)return;try{n.animation=r.animationType==="slide"?chunkUW5NJ23X_cjs.p(r):r.animationType==="blur-circle"?chunkUW5NJ23X_cjs.q(r):r.animationType==="clip-path"?chunkUW5NJ23X_cjs.k(r):r.animationType==="polygon-gradient"?chunkUW5NJ23X_cjs.l(r):r.animationType==="triangle"?chunkUW5NJ23X_cjs.m(r):r.animationType==="svg-logo"?chunkUW5NJ23X_cjs.n(r):chunkUW5NJ23X_cjs.o(r),n.animation.finished.catch(()=>{});let c=n.animation.effect;!(n.animation instanceof CSSAnimation)&&(!(c instanceof KeyframeEffect)||c.pseudoElement!=="::view-transition-new(root)")&&(m.skipTransition(),d());}catch{m.skipTransition(),d();}}catch(m){throw d(),m}};var B=typeof window<"u",Ie=(o=chunkCYGYUQUK_cjs.a,r=["light","dark","system"],t="system")=>{if(!B)return t;let n;try{n=localStorage.getItem(o);}catch{return t}return r.find(d=>d===n)??t},De=(o,r=chunkCYGYUQUK_cjs.a)=>{B&&localStorage.setItem(r,o);},ke=(o=chunkCYGYUQUK_cjs.b,r=["default"],t="default")=>{if(!B)return t;let n;try{n=localStorage.getItem(o);}catch{return t}return n&&r.includes(n)?n:t},Pe=(o,r=chunkCYGYUQUK_cjs.b)=>{B&&localStorage.setItem(r,o);};function G(o){if(!["light","dark","system"].includes(o))throw new Error("Theme must be light, dark, or system.")}function M(o,r){let t=`${r}${o}`;if(!t.length||/\s/.test(t))throw new Error("Theme classes must be nonempty CSS class tokens.")}function Z(o={}){let r=o.themes??["light","dark","system"],t=o.colorThemes??["default"],n=o.defaultTheme??"system",d=o.defaultColorTheme??t[0],m=o.globalClassName??chunkCYGYUQUK_cjs.c,c=o.colorThemePrefix??chunkCYGYUQUK_cjs.d;if(!r.length||!r.every(a=>["light","dark","system"].includes(a))||!r.includes(n))throw new Error("themes must include the defaultTheme and contain light, dark, or system.");if(d===void 0||!t.includes(d))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([...r]),colorThemes:Object.freeze([...t]),defaultTheme:n,defaultColorTheme:d,globalClassName:m,colorThemePrefix:c,storageKey:o.storageKey??chunkCYGYUQUK_cjs.a,colorStorageKey:o.colorStorageKey??chunkCYGYUQUK_cjs.b}}var Y=(o,r)=>o.length===r.length&&o.every((t,n)=>t===r[n]),Re=o=>o&&o!==true&&"currentTarget"in o?{element:o.currentTarget,animationOff:o.detail===0}:o,ot=(o={},r={})=>{let t=o,n=Z(t);_(t);let d=(e,s)=>{e.theme!==void 0&&G(e.theme),e.initialTheme!==void 0&&G(e.initialTheme),e.colorTheme!==void 0&&M(e.colorTheme,s),e.initialColorTheme!==void 0&&M(e.initialColorTheme,s);};d(t,n.colorThemePrefix);let m=e=>{try{return t.storage?t.storage.getItem(e):null}catch{return null}},c=()=>{if(t.storage===void 0)return Ie(t.storageKey,n.themes,n.defaultTheme);let e=m(t.storageKey??chunkCYGYUQUK_cjs.a);return n.themes.find(s=>s===e)??n.defaultTheme},a=()=>{if(t.storage===void 0)return ke(t.colorStorageKey,n.colorThemes,n.defaultColorTheme);let e=m(t.colorStorageKey??chunkCYGYUQUK_cjs.b);return n.colorThemes.find(s=>s===e)??n.defaultColorTheme},T=t.initialTheme??c(),u=t.initialColorTheme??a(),ee=false,te=false,k=chunkUW5NJ23X_cjs.d(),x=false,N=0,w=0,j,$,K,W,q=new Set,oe=t.theme??t.initialTheme??n.defaultTheme,ne={theme:oe,colorTheme:t.colorTheme??t.initialColorTheme??n.defaultColorTheme,resolvedTheme:oe==="dark"?"dark":"light",systemTheme:"light",themes:n.themes,colorThemes:n.colorThemes,mounted:false},l={...ne,theme:t.theme??T,colorTheme:t.colorTheme??u,resolvedTheme:chunkUW5NJ23X_cjs.e(t.theme??T),systemTheme:k},O=l.theme,P=l.colorTheme,p=l.theme,b=l.colorTheme,_e=()=>{if(!x||typeof document>"u")return;let e=document.documentElement,s=n.globalClassName,h=n.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(i=>e.classList.remove(`${h}${i}`)),K=`${h}${l.colorTheme}`,e.classList.add(K);},E=()=>{let e=t.theme??T,s=t.colorTheme??u,h=n.themes,i=n.colorThemes,g={theme:e,colorTheme:s,resolvedTheme:e==="system"?k:e,systemTheme:k,themes:Y(l.themes,h)?l.themes:h,colorThemes:Y(l.colorThemes,i)?l.colorThemes:i,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),_e(),y&&q.forEach(C=>C());},re=()=>{if(t.animationType==="svg-logo")for(let e of [t.logo,t.logoLight,t.logoDark])e&&Oe(e);},ie=e=>{try{e();}catch(s){let h=s instanceof Error?s:new Error(String(s));r.onBrowserStorageError?r.onBrowserStorageError(h):console.warn("Unable to persist the theme preference:",h);}},se=e=>{G(e),t.storage===void 0?ie(()=>De(e,t.storageKey??chunkCYGYUQUK_cjs.a)):t.storage&&t.storage.setItem(t.storageKey??chunkCYGYUQUK_cjs.a,e),ee=true,O=e,t.theme===void 0&&(T=e),E(),t.onThemeChange?.(e);},ae=e=>{M(e,n.colorThemePrefix),t.storage===void 0?ie(()=>Pe(e,t.colorStorageKey??chunkCYGYUQUK_cjs.b)):t.storage&&t.storage.setItem(t.colorStorageKey??chunkCYGYUQUK_cjs.b,e),te=true,P=e,t.colorTheme===void 0&&(u=e),E(),t.onColorThemeChange?.(e);},Ge=(e=false)=>{let s=e===true||e===false?{animationOff:e}:e,h=s.logo!==void 0||s.logoLight!==void 0||s.logoDark!==void 0,i={...t,...Object.fromEntries(Object.entries(s).filter(([,R])=>R!==void 0))};h&&Object.assign(i,{logo:void 0,logoLight:void 0,logoDark:void 0,..._(s)}),_(i);let g=i.duration??400;if(s.animationOff||g<=0||typeof window>"u")return null;let y=Object.values(J).find(R=>R===i.animationType)??"circle",C={duration:g,easing:i.easing??chunkCYGYUQUK_cjs.f,animationType:y,blurAmount:i.blurAmount??2,styleId:i.styleId??chunkCYGYUQUK_cjs.h,nonce:t.nonce};if(y==="slide"){let R=i.slideFromX!==void 0&&i.slideFromY!==void 0?{a:i.slideFromX,b:i.slideFromY}:chunkUW5NJ23X_cjs.i(i.slideDirection??"left");return {...C,...R,x:i.slideToX??0,y:i.slideToY??0}}let A=s.element??r.getElement?.(),v=s.origin?null:A?.getBoundingClientRect(),f=(y==="svg-logo"?chunkUW5NJ23X_cjs.j("center"):null)??s.origin??(i.animationPosition&&i.animationPosition!=="trigger"?chunkUW5NJ23X_cjs.j(i.animationPosition):null)??(v?{x:v.left+v.width/2,y:v.top+v.height/2}:y==="circle"||y==="blur-circle"?null:chunkUW5NJ23X_cjs.j("center"));return !f||!Number.isFinite(f.x)||!Number.isFinite(f.y)?null:{...C,...f,clipPathDirection:i.clipPathDirection??"top-left",animationPosition:i.animationPosition,logo:i.logoLight!==void 0?chunkUW5NJ23X_cjs.e(O)==="light"?i.logoLight:i.logoDark:i.logo,logoWidth:i.logoWidth,logoHeight:i.logoHeight,gradientWidth:i.gradientWidth}},le=async(e,s)=>{let h=Ge(s),i=w,g=()=>{i===w&&e();};N++;try{await Ae(()=>{if(i===w)return r.commit?r.commit(g):g()},h);}finally{i===w&&N--;}},F=async(e,s)=>{if(G(e),!n.themes.includes(e)){console.warn(`Theme "${e}" not found in available themes`);return}if(e===p)return;p=e;let h=w;try{await le(()=>se(e),s);}catch(i){throw h===w&&p===e&&(p=O),i}},X=async(e,s)=>{if(!n.colorThemes.includes(e)){console.warn(`Color theme "${e}" not found in available themes`);return}if(e===b)return;b=e;let h=w;try{await le(()=>ae(e),s);}catch(i){throw h===w&&b===e&&(b=P),i}},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()),!te&&t.initialColorTheme===void 0&&(u=a()),O=p=t.theme??T,P=b=t.colorTheme??u,k=chunkUW5NJ23X_cjs.d();let e=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>{k=chunkUW5NJ23X_cjs.d(),E();},h=i=>{if(i.storageArea&&i.storageArea!==window.localStorage)return;let g=n.themes,y=n.colorThemes;if((i.key===null||i.key===(t.storageKey??chunkCYGYUQUK_cjs.a))&&t.theme===void 0){let C=i.newValue??n.defaultTheme,A=g.find(v=>v===C);A!==void 0&&(T=O=p=A);}if((i.key===null||i.key===(t.colorStorageKey??chunkCYGYUQUK_cjs.b))&&t.colorTheme===void 0){let C=i.newValue??n.defaultColorTheme;y.includes(C)&&(u=P=b=C);}E();};return e.addEventListener("change",s),$=()=>{window.removeEventListener("storage",h),t.storage===void 0&&window.addEventListener("storage",h);},$(),j=()=>{e.removeEventListener("change",s),window.removeEventListener("storage",h);},chunkUW5NJ23X_cjs.b(t.nonce),re(),E(),z},dispose:z,updateOptions:e=>{let s=l.theme,h=l.colorTheme,i={...t,...e},{logo:g,logoLight:y,logoDark:C,...A}=i,v={...A,..._({logo:g,logoLight:y,logoDark:C})},f=Z(v);d(v,f.colorThemePrefix),!Y(n.themes,f.themes)&&!f.themes.includes(T)&&(T=f.defaultTheme),!Y(n.colorThemes,f.colorThemes)&&!f.colorThemes.includes(u)&&(u=f.defaultColorTheme),t=v,n=f,E(),N===0&&(s!==l.theme&&(O=p=l.theme),h!==l.colorTheme&&(P=b=l.colorTheme)),x&&(re(),$?.());},setTheme:e=>{se(e),p=e;},setColorTheme:e=>{ae(e),b=e;},switchTheme:F,switchColorTheme:X,toggleTheme:e=>{let s=chunkUW5NJ23X_cjs.e(p)==="dark"?"light":"dark",h=n.themes.includes(s)?s:n.themes[(n.themes.indexOf(p)+1)%n.themes.length];return F(h,e)},toggleLightTheme:async e=>{chunkUW5NJ23X_cjs.e(p)!=="light"&&await F("light",e);},toggleDarkTheme:async e=>{chunkUW5NJ23X_cjs.e(p)!=="dark"&&await F("dark",e);},toggleColorTheme:async e=>{let s=n.colorThemes;s.length!==0&&await X(s[(s.indexOf(b)+1)%s.length],Re(e));},createColorThemeToggle:e=>s=>X(e,Re(s)),isColorThemeActive:e=>l.colorTheme===e}};
|
|
12
|
+
exports.a=J;exports.b=Ke;exports.c=_;exports.d=Oe;exports.e=Ae;exports.f=Ie;exports.g=De;exports.h=ke;exports.i=Pe;exports.j=ot;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';var y=t=>{let e=document.createElement("style");return t&&(e.nonce=t),e};var x=typeof window<"u",W=t=>{if(!x||document.getElementById("ui-theme-base-style"))return;let e=y(t);e.id="ui-theme-base-style",e.textContent=`
|
|
2
|
+
html[data-ui-theme-transition]::view-transition-group(root),
|
|
3
|
+
html[data-ui-theme-transition]::view-transition-old(root),
|
|
4
|
+
html[data-ui-theme-transition]::view-transition-new(root) {
|
|
5
|
+
animation: none;
|
|
6
|
+
}
|
|
7
|
+
html[data-ui-theme-transition]::view-transition-old(root),
|
|
8
|
+
html[data-ui-theme-transition]::view-transition-new(root) {
|
|
9
|
+
mix-blend-mode: normal;
|
|
10
|
+
}
|
|
11
|
+
html[data-ui-theme-transition],
|
|
12
|
+
html[data-ui-theme-transition] *,
|
|
13
|
+
html[data-ui-theme-transition] *::before,
|
|
14
|
+
html[data-ui-theme-transition] *::after {
|
|
15
|
+
transition: none !important;
|
|
16
|
+
}
|
|
17
|
+
`,document.head.appendChild(e);},B=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>')`,M=()=>x&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",H=t=>t==="system"?M():t==="dark"?"dark":"light",I=t=>t==="system"?"system":t==="dark"?"dark":"light",D=()=>x&&document.startViewTransition instanceof Function,F=()=>x&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,j=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}}},v=t=>t/window.innerWidth*100,A=t=>t/window.innerHeight*100,$=(t,e)=>{let{innerWidth:n,innerHeight:o}=window;return Math.hypot(Math.max(Math.abs(t),Math.abs(n-t)),Math.max(Math.abs(e),Math.abs(o-e)))+1},k=()=>{let t=getComputedStyle(document.documentElement,"::view-transition-new(root)"),{innerWidth:e,innerHeight:n}=window;return {x:(parseFloat(t.width)||e)/e,y:(parseFloat(t.height)||n)/n}},P=t=>{let{innerWidth:e,innerHeight:n}=window;return t/(Math.hypot(e,n)/Math.SQRT2)*100},G=t=>{let e=t.includes("left")?0:t.includes("right")?window.innerWidth:window.innerWidth/2,n=t.includes("top")?0:t.includes("bottom")?window.innerHeight:window.innerHeight/2;return {x:e,y:n}},R=0,g=(t,e)=>{let n=document.documentElement.animate(e,{duration:t.duration,easing:t.easing,fill:"both",pseudoElement:"::view-transition-new(root)"}),o=n.effect;if(!(o instanceof KeyframeEffect))return n;let i=o.getKeyframes(),r=i.some(l=>"clipPath"in l)?"clipPath":i.some(l=>"maskImage"in l)?"maskImage":"transform";if(getComputedStyle(document.documentElement,"::view-transition-new(root)")[r]!=="none")return n;let d=n.playState==="paused",c=n.currentTime;n.cancel(),n.finished.catch(()=>{});let s=`ui-theme-reveal-${++R}`,a=y(t.nonce),p=i.map(l=>{let b=Object.entries(l).filter(([f])=>!["offset","computedOffset","easing","composite"].includes(f)).map(([f,w])=>`${f.replace(/[A-Z]/g,S=>`-${S.toLowerCase()}`)}:${w};`).join("");return `${l.computedOffset*100}%{${b}}`}).join("");a.textContent=`@keyframes ${s}{${p}}html[data-ui-theme-transition]::view-transition-new(root){animation:${s} ${t.duration}ms ${t.easing} both;}`,document.head.appendChild(a);let h=getComputedStyle(document.documentElement,"::view-transition-new(root)").animationName,u=document.getAnimations().find(l=>l instanceof CSSAnimation&&l.animationName===h);if(!u)throw a.remove(),new Error("Transition pseudo animations are unavailable");return d&&(u.pause(),u.currentTime=c),u.finished.then(()=>a.remove(),()=>a.remove()),u},K=t=>{let e=t.clipPathDirection??"top-left",n={"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 g(t,{clipPath:[n[e],o[e]]})},O=t=>{let e=t.clipPathDirection??"top-left",n=k(),o=window.innerWidth*n.x,i=window.innerHeight*n.y,r=e.includes("-"),m=e.includes("left"),d=e.includes("top"),c=e==="left"||e==="right",s=m?0:e.includes("right")?1:.5,a=d?0:e.includes("bottom")?1:.5,p=r||c?o*3:o,h=r||!c?i*3:i,u=r?`${s*100},${a*100} ${(1-s)*100},${a*100} ${s*100},${(1-a)*100}`:"0,0 100,0 100,100 0,100",l=r?p*h/Math.hypot(p,h):c?p:h,f=1-Math.max(0,Math.min(t.gradientWidth??80,l*.2))/l,w=`<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*(r?.5:c?1-s:s)}" y2="${100*(r?.5:c?a:1-a)}" gradientUnits="userSpaceOnUse"><stop offset="${f}" stop-color="black"/><stop offset="1" stop-color="black" stop-opacity="0"/></linearGradient></defs><polygon points="${u}" fill="url(#edge)"/></svg>`;return g(t,{maskImage:[`url("data:image/svg+xml,${encodeURIComponent(w)}")`,`url("data:image/svg+xml,${encodeURIComponent(w)}")`],maskMode:["alpha","alpha"],maskRepeat:["no-repeat","no-repeat"],maskSize:[r?"0px 0px":c?`0px ${h}px`:`${p}px 0px`,`${p}px ${h}px`],maskPosition:[`${s*o}px ${a*i}px`,`${s*(o-p)}px ${a*(i-h)}px`]})},U=t=>{let{x:e,y:n}=t,o=$(e,n),i=Math.sqrt(3)*o,r=(d,c)=>`${v(d)}% ${A(c)}%`,m=r(e,n);return g(t,{clipPath:[`polygon(${m}, ${m}, ${m})`,`polygon(${r(e,n-2*o)}, ${r(e+i,n+o)}, ${r(e-i,n+o)})`]})},z=t=>{let{innerWidth:e,innerHeight:n}=window;return C({...t,x:e/2,y:n/2})},C=t=>{let{x:e,y:n}=t,o=`at ${v(e)}% ${A(n)}%`;return g(t,{clipPath:[`circle(0% ${o})`,`circle(${P($(e,n))}% ${o})`]})},N=t=>{let{a:e=-100,b:n=0,x:o=0,y:i=0}=t;return g(t,{transform:[`translate(${e}%, ${n}%)`,`translate(${o}%, ${i}%)`]})},q=t=>{let{x:e,y:n,blurAmount:o}=t;if(o<=0)return C(t);let i=Math.min(o,20),r=$(e,n)+i,m=k(),[d,c,s,a]=[e*m.x,n*m.y,r*m.x,r*m.y];return g(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",`${s*2}px ${a*2}px`],maskPosition:[`${d}px ${c}px`,`${d-s}px ${c-a}px`]})};
|
|
18
|
+
exports.a=y;exports.b=W;exports.c=B;exports.d=M;exports.e=H;exports.f=I;exports.g=D;exports.h=F;exports.i=j;exports.j=G;exports.k=K;exports.l=O;exports.m=U;exports.n=z;exports.o=C;exports.p=N;exports.q=q;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {c as c$2,j}from'./chunk-NDTSXDQI.js';import {c,b,a}from'./chunk-DTUGFHPG.js';import {d,c as c$1,b as b$1,a as a$1}from'./chunk-NDNCNR4X.js';import se,{createContext,useRef,useState,useSyncExternalStore,useLayoutEffect,useMemo,useCallback,useContext}from'react';import {flushSync}from'react-dom';import {jsx,jsxs}from'react/jsx-runtime';var ee=t=>{let o;return {controller:j(t,{commit:e=>flushSync(e),getElement:()=>o?.current??null}),connectTrigger:e=>{o=e;}}},B=(t={})=>{let o=useRef(null),[r]=useState(()=>ee(t)),{controller:e}=r,n=useRef(t),h=useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return useLayoutEffect(()=>{let i=Object.fromEntries(Object.keys(n.current).filter(m=>!(m in t)).map(m=>[m,void 0]));e.updateOptions({...i,...t}),n.current=t;}),useLayoutEffect(()=>(r.connectTrigger(o),e.mount()),[e,r]),useMemo(()=>({...h,ref:o,setTheme:e.setTheme,setColorTheme:e.setColorTheme,switchTheme:e.switchTheme,switchColorTheme:e.switchColorTheme,toggleTheme:e.toggleTheme,toggleLightTheme:e.toggleLightTheme,toggleDarkTheme:e.toggleDarkTheme,toggleColorTheme:e.toggleColorTheme,createColorThemeToggle:e.createColorThemeToggle,isColorThemeActive:e.isColorThemeActive}),[h,e])};var oe=()=>()=>{},re=()=>true,ne=()=>false,$=()=>useSyncExternalStore(oe,re,ne);var U=createContext(null);var E=createContext(void 0),R=se.memo(({themes:t,colorThemes:o,storageKey:r,colorStorageKey:e,defaultTheme:n,defaultColorTheme:h,attribute:i,globalClassName:m,colorThemePrefix:c$1,nonce:u})=>{let d=c(true,[r,t,n],[e,o,h],b,`${i==="data-theme"?'d.setAttribute("data-theme",q?"dark":"light")':`l.toggle(${a(m)},q)`};d.style.colorScheme=q?"dark":"light";l.add(${a(c$1)}+p)`);return jsx("script",{nonce:u,suppressHydrationWarning:true,dangerouslySetInnerHTML:{__html:d}})});R.displayName="ThemePreHydrationScript";var Ne=({children:t,themes:o=["light","dark","system"],colorThemes:r=["default"],defaultTheme:e="system",defaultColorTheme:n=r[0]??"default",animationType:h="circle",clipPathDirection:i,animationPosition:m,logo:c,logoLight:u,logoDark:d$1,logoWidth:V,logoHeight:W,gradientWidth:Y,duration:X=400,storageKey:g=a$1,colorStorageKey:p=b$1,attribute:y="class",globalClassName:C=c$1,colorThemePrefix:f=d,nonce:x,disableAnimationOnInit:N=true,disablePreHydrationScript:b=false})=>{let S=$(),l=B({themes:o,colorThemes:r,defaultTheme:e,defaultColorTheme:n,animationType:h,clipPathDirection:i,animationPosition:m,...c$2({logo:c,logoLight:u,logoDark:d$1}),logoWidth:V,logoHeight:W,gradientWidth:Y,duration:X,storageKey:g,colorStorageKey:p,globalClassName:y==="class"?C:void 0,colorThemePrefix:f,nonce:x}),T=useCallback(async(s,P=false)=>{!S&&N?l.setTheme(s):await l.switchTheme(s,P);},[S,N,l]),I=useCallback((s,P)=>T(s,{element:P}),[T]),A=useMemo(()=>({...l,switchTheme:T,switchThemeFromElement:I}),[l,T,I]);if(!S){let s={themes:o,colorThemes:r,mounted:false,ref:{current:null},theme:e,colorTheme:n,resolvedTheme:e==="dark"?"dark":"light",systemTheme:"light",setTheme:()=>{},setColorTheme:()=>{},switchTheme:async()=>{},switchThemeFromElement:async()=>{},switchColorTheme:async()=>{},toggleTheme:async()=>{},toggleLightTheme:async()=>{},toggleDarkTheme:async()=>{},toggleColorTheme:async()=>{},createColorThemeToggle:()=>async()=>{},isColorThemeActive:()=>false};return jsx(E.Provider,{value:s,children:jsxs(U.Provider,{value:s,children:[!b&&jsx(R,{themes:o,colorThemes:r,storageKey:g,colorStorageKey:p,defaultTheme:e,defaultColorTheme:n,attribute:y,globalClassName:C,colorThemePrefix:f,nonce:x}),t]})})}return jsx(E.Provider,{value:A,children:jsxs(U.Provider,{value:A,children:[!b&&jsx(R,{themes:o,colorThemes:r,storageKey:g,colorStorageKey:p,defaultTheme:e,defaultColorTheme:n,attribute:y,globalClassName:C,colorThemePrefix:f,nonce:x}),t]})})},be=()=>{let t=useContext(E);if(t===void 0)throw new Error("useNextUITheme must be used within a NextUIThemeProvider");return t};export{B as a,U as b,$ as c,Ne as d,be as e};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { A as AnimationConfig, e as AnimationPosition, S as SlideDirection } from './types-
|
|
1
|
+
import { A as AnimationConfig, e as AnimationPosition, S as SlideDirection } from './types-C2tuWeMB.cjs';
|
|
2
2
|
|
|
3
3
|
/** Injects styles scoped to transitions owned by this library. */
|
|
4
|
-
declare const injectBaseStyles: () => void;
|
|
4
|
+
declare const injectBaseStyles: (nonce?: string) => void;
|
|
5
5
|
/**
|
|
6
6
|
* Creates an SVG blur circle mask for animations
|
|
7
7
|
* @param blur - Blur amount for the gaussian filter
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { A as AnimationConfig, e as AnimationPosition, S as SlideDirection } from './types-
|
|
1
|
+
import { A as AnimationConfig, e as AnimationPosition, S as SlideDirection } from './types-C2tuWeMB.js';
|
|
2
2
|
|
|
3
3
|
/** Injects styles scoped to transitions owned by this library. */
|
|
4
|
-
declare const injectBaseStyles: () => void;
|
|
4
|
+
declare const injectBaseStyles: (nonce?: string) => void;
|
|
5
5
|
/**
|
|
6
6
|
* Creates an SVG blur circle mask for animations
|
|
7
7
|
* @param blur - Blur amount for the gaussian filter
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as ThemeAnimationOptions, a as ThemeAnimationType, S as SlideDirection, b as ThemeState, c as Theme, d as ThemeConfig } from './types-
|
|
1
|
+
import { T as ThemeAnimationOptions, a as ThemeAnimationType, S as SlideDirection, b as ThemeState, c as Theme, d as ThemeConfig } from './types-C2tuWeMB.cjs';
|
|
2
2
|
|
|
3
3
|
type SystemThemeMode = 'css' | 'js';
|
|
4
4
|
type ThemeTransitionSettings = ThemeAnimationOptions & {
|
|
@@ -40,6 +40,8 @@ type ThemeControllerOptions = ThemeTransitionSettings & ThemeConfig & {
|
|
|
40
40
|
initialTheme?: Theme;
|
|
41
41
|
initialColorTheme?: string;
|
|
42
42
|
systemThemeMode?: SystemThemeMode;
|
|
43
|
+
/** CSP nonce for the `<style>` elements injected for transitions. */
|
|
44
|
+
nonce?: string;
|
|
43
45
|
};
|
|
44
46
|
interface ThemeControllerSnapshot extends ThemeState {
|
|
45
47
|
readonly systemTheme: 'light' | 'dark';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as ThemeAnimationOptions, a as ThemeAnimationType, S as SlideDirection, b as ThemeState, c as Theme, d as ThemeConfig } from './types-
|
|
1
|
+
import { T as ThemeAnimationOptions, a as ThemeAnimationType, S as SlideDirection, b as ThemeState, c as Theme, d as ThemeConfig } from './types-C2tuWeMB.js';
|
|
2
2
|
|
|
3
3
|
type SystemThemeMode = 'css' | 'js';
|
|
4
4
|
type ThemeTransitionSettings = ThemeAnimationOptions & {
|
|
@@ -40,6 +40,8 @@ type ThemeControllerOptions = ThemeTransitionSettings & ThemeConfig & {
|
|
|
40
40
|
initialTheme?: Theme;
|
|
41
41
|
initialColorTheme?: string;
|
|
42
42
|
systemThemeMode?: SystemThemeMode;
|
|
43
|
+
/** CSP nonce for the `<style>` elements injected for transitions. */
|
|
44
|
+
nonce?: string;
|
|
43
45
|
};
|
|
44
46
|
interface ThemeControllerSnapshot extends ThemeState {
|
|
45
47
|
readonly systemTheme: 'light' | 'dark';
|
package/dist/core/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkR7KPCTX4_cjs=require('../chunk-R7KPCTX4.cjs'),chunkUW5NJ23X_cjs=require('../chunk-UW5NJ23X.cjs'),chunkCYGYUQUK_cjs=require('../chunk-CYGYUQUK.cjs');Object.defineProperty(exports,"TRANSITION_DIRECTIONS",{enumerable:true,get:function(){return chunkR7KPCTX4_cjs.b}});Object.defineProperty(exports,"ThemeAnimationType",{enumerable:true,get:function(){return chunkR7KPCTX4_cjs.a}});Object.defineProperty(exports,"createThemeController",{enumerable:true,get:function(){return chunkR7KPCTX4_cjs.j}});Object.defineProperty(exports,"getStoredColorTheme",{enumerable:true,get:function(){return chunkR7KPCTX4_cjs.h}});Object.defineProperty(exports,"getStoredTheme",{enumerable:true,get:function(){return chunkR7KPCTX4_cjs.f}});Object.defineProperty(exports,"preloadThemeLogo",{enumerable:true,get:function(){return chunkR7KPCTX4_cjs.d}});Object.defineProperty(exports,"runThemeTransition",{enumerable:true,get:function(){return chunkR7KPCTX4_cjs.e}});Object.defineProperty(exports,"setStoredColorTheme",{enumerable:true,get:function(){return chunkR7KPCTX4_cjs.i}});Object.defineProperty(exports,"setStoredTheme",{enumerable:true,get:function(){return chunkR7KPCTX4_cjs.g}});Object.defineProperty(exports,"createBlurCircleAnimation",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.q}});Object.defineProperty(exports,"createBlurCircleMask",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.c}});Object.defineProperty(exports,"createCircleAnimation",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.o}});Object.defineProperty(exports,"createClipPathAnimation",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.k}});Object.defineProperty(exports,"createPolygonGradientAnimation",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.l}});Object.defineProperty(exports,"createSlideAnimation",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.p}});Object.defineProperty(exports,"createSvgLogoAnimation",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.n}});Object.defineProperty(exports,"createTriangleAnimation",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.m}});Object.defineProperty(exports,"getAnimationPosition",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.j}});Object.defineProperty(exports,"getSlideFromCoords",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.i}});Object.defineProperty(exports,"getSystemTheme",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.d}});Object.defineProperty(exports,"injectBaseStyles",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.b}});Object.defineProperty(exports,"prefersReducedMotion",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.h}});Object.defineProperty(exports,"resolveTheme",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.e}});Object.defineProperty(exports,"supportsViewTransitions",{enumerable:true,get:function(){return chunkUW5NJ23X_cjs.g}});Object.defineProperty(exports,"COLOR_STORAGE_KEY",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.b}});Object.defineProperty(exports,"COLOR_THEME_PREFIX",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.d}});Object.defineProperty(exports,"DEFAULT_BLUR_AMOUNT",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.g}});Object.defineProperty(exports,"DEFAULT_DURATION",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.e}});Object.defineProperty(exports,"DEFAULT_EASING",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.f}});Object.defineProperty(exports,"DEFAULT_STYLE_ID",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.h}});Object.defineProperty(exports,"GLOBAL_CLASS_NAME",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.c}});Object.defineProperty(exports,"STORAGE_KEY",{enumerable:true,get:function(){return chunkCYGYUQUK_cjs.a}});
|
package/dist/core/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { A as AnimationConfig, C as ColorTheme, c as Theme } from '../types-
|
|
2
|
-
export { e as AnimationPosition, S as SlideDirection, f as TRANSITION_DIRECTIONS, T as ThemeAnimationOptions, a as ThemeAnimationType, d as ThemeConfig, g as ThemeControlTransitionProps, h as ThemeLogoOptions, b as ThemeState, i as TransitionDirection } from '../types-
|
|
3
|
-
export { C as COLOR_STORAGE_KEY, a as COLOR_THEME_PREFIX, D as DEFAULT_BLUR_AMOUNT, b as DEFAULT_DURATION, c as DEFAULT_EASING, d as DEFAULT_STYLE_ID, G as GLOBAL_CLASS_NAME, S as STORAGE_KEY, e as createBlurCircleAnimation, f as createBlurCircleMask, g as createCircleAnimation, h as createClipPathAnimation, i as createPolygonGradientAnimation, j as createSlideAnimation, k as createSvgLogoAnimation, l as createTriangleAnimation, m as getAnimationPosition, n as getSlideFromCoords, o as getSystemTheme, p as injectBaseStyles, q as prefersReducedMotion, s as resolveTheme, t as supportsViewTransitions } from '../constants-
|
|
4
|
-
export { C as ColorThemeToggle, a as ColorThemeToggleInput, S as SystemThemeMode, T as ThemeController, b as ThemeControllerAdapter, c as ThemeControllerOptions, d as ThemeControllerSnapshot, e as ThemeStorage, f as ThemeTransitionInput, g as ThemeTransitionOptions, h as ThemeTransitionSettings, i as createThemeController } from '../controller-
|
|
1
|
+
import { A as AnimationConfig, C as ColorTheme, c as Theme } from '../types-C2tuWeMB.cjs';
|
|
2
|
+
export { e as AnimationPosition, S as SlideDirection, f as TRANSITION_DIRECTIONS, T as ThemeAnimationOptions, a as ThemeAnimationType, d as ThemeConfig, g as ThemeControlTransitionProps, h as ThemeLogoOptions, b as ThemeState, i as TransitionDirection } from '../types-C2tuWeMB.cjs';
|
|
3
|
+
export { C as COLOR_STORAGE_KEY, a as COLOR_THEME_PREFIX, D as DEFAULT_BLUR_AMOUNT, b as DEFAULT_DURATION, c as DEFAULT_EASING, d as DEFAULT_STYLE_ID, G as GLOBAL_CLASS_NAME, S as STORAGE_KEY, e as createBlurCircleAnimation, f as createBlurCircleMask, g as createCircleAnimation, h as createClipPathAnimation, i as createPolygonGradientAnimation, j as createSlideAnimation, k as createSvgLogoAnimation, l as createTriangleAnimation, m as getAnimationPosition, n as getSlideFromCoords, o as getSystemTheme, p as injectBaseStyles, q as prefersReducedMotion, s as resolveTheme, t as supportsViewTransitions } from '../constants-CDhU9uhC.cjs';
|
|
4
|
+
export { C as ColorThemeToggle, a as ColorThemeToggleInput, S as SystemThemeMode, T as ThemeController, b as ThemeControllerAdapter, c as ThemeControllerOptions, d as ThemeControllerSnapshot, e as ThemeStorage, f as ThemeTransitionInput, g as ThemeTransitionOptions, h as ThemeTransitionSettings, i as createThemeController } from '../controller-BASaPUJN.cjs';
|
|
5
5
|
export { p as preloadThemeLogo } from '../logo-DtwtRv4y.cjs';
|
|
6
6
|
|
|
7
7
|
/** Latest request wins visually; every requested state update still runs once. */
|