@space-man/react-theme-animation 2.1.0 → 2.3.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 +72 -142
- package/dist/core/index.cjs +74 -0
- package/dist/core/index.cjs.map +1 -0
- package/dist/{esm/types/index.d.ts → core/index.d.cts} +26 -8
- package/dist/{cjs/types → core}/index.d.ts +26 -8
- package/dist/core/index.js +66 -0
- package/dist/core/index.js.map +1 -0
- package/dist/index.cjs +1756 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1706 -0
- package/dist/index.js.map +1 -0
- package/dist/react/index.cjs +1742 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.cts +224 -0
- package/dist/react/index.d.ts +224 -0
- package/dist/react/index.js +1697 -0
- package/dist/react/index.js.map +1 -0
- package/dist/tanstack/index.cjs +34 -0
- package/dist/tanstack/index.cjs.map +1 -0
- package/dist/tanstack/index.d.cts +20 -0
- package/dist/tanstack/index.d.ts +20 -0
- package/dist/tanstack/index.js +27 -0
- package/dist/tanstack/index.js.map +1 -0
- package/package.json +66 -37
- package/dist/cjs/components/NextThemeProvider.d.ts +0 -81
- package/dist/cjs/components/NextThemeProvider.js +0 -223
- package/dist/cjs/components/SpacemanThemeProvider.d.ts +0 -57
- package/dist/cjs/components/SpacemanThemeProvider.js +0 -113
- package/dist/cjs/components/TanStackThemeProvider.d.ts +0 -68
- package/dist/cjs/components/TanStackThemeProvider.js +0 -183
- package/dist/cjs/components/ThemeSelector.d.ts +0 -3
- package/dist/cjs/components/ThemeSelector.js +0 -39
- package/dist/cjs/components/ThemeSwitcher.d.ts +0 -3
- package/dist/cjs/components/ThemeSwitcher.js +0 -81
- package/dist/cjs/components/ViteThemeProvider.d.ts +0 -61
- package/dist/cjs/components/ViteThemeProvider.js +0 -140
- package/dist/cjs/components/ui/select.d.ts +0 -15
- package/dist/cjs/components/ui/select.js +0 -83
- package/dist/cjs/hooks/use-theme-animation.d.ts +0 -2
- package/dist/cjs/hooks/use-theme-animation.js +0 -234
- package/dist/cjs/index.d.ts +0 -10
- package/dist/cjs/index.js +0 -30
- package/dist/cjs/types/index.js +0 -9
- package/dist/cjs/utils/animations.d.ts +0 -21
- package/dist/cjs/utils/animations.js +0 -189
- package/dist/esm/components/NextThemeProvider.d.ts +0 -81
- package/dist/esm/components/NextThemeProvider.js +0 -185
- package/dist/esm/components/SpacemanThemeProvider.d.ts +0 -57
- package/dist/esm/components/SpacemanThemeProvider.js +0 -108
- package/dist/esm/components/TanStackThemeProvider.d.ts +0 -68
- package/dist/esm/components/TanStackThemeProvider.js +0 -178
- package/dist/esm/components/ThemeSelector.d.ts +0 -3
- package/dist/esm/components/ThemeSelector.js +0 -35
- package/dist/esm/components/ThemeSwitcher.d.ts +0 -3
- package/dist/esm/components/ThemeSwitcher.js +0 -77
- package/dist/esm/components/ViteThemeProvider.d.ts +0 -61
- package/dist/esm/components/ViteThemeProvider.js +0 -135
- package/dist/esm/components/ui/select.d.ts +0 -15
- package/dist/esm/components/ui/select.js +0 -39
- package/dist/esm/hooks/use-theme-animation.d.ts +0 -2
- package/dist/esm/hooks/use-theme-animation.js +0 -230
- package/dist/esm/index.d.ts +0 -10
- package/dist/esm/index.js +0 -10
- package/dist/esm/types/index.js +0 -6
- package/dist/esm/utils/animations.d.ts +0 -21
- package/dist/esm/utils/animations.js +0 -177
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
3
|
-
import { motion } from 'motion/react';
|
|
4
|
-
import { clsx } from 'clsx';
|
|
5
|
-
import { useThemeAnimation } from '../hooks/use-theme-animation';
|
|
6
|
-
import { useSpacemanTheme } from './SpacemanThemeProvider';
|
|
7
|
-
const SunIcon = () => (_jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("circle", { cx: "12", cy: "12", r: "5" }), _jsx("path", { d: "M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42" })] }));
|
|
8
|
-
const MoonIcon = () => (_jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" }) }));
|
|
9
|
-
const MonitorIcon = () => (_jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("rect", { width: "20", height: "14", x: "2", y: "3", rx: "2" }), _jsx("line", { x1: "8", x2: "16", y1: "21", y2: "21" }), _jsx("line", { x1: "12", x2: "12", y1: "17", y2: "21" })] }));
|
|
10
|
-
const ThemeOption = ({ icon, value, isActive, isHovered, onClick, onMouseEnter, onMouseLeave, buttonRef, }) => {
|
|
11
|
-
return (_jsxs("button", { ref: isActive ? buttonRef : undefined, className: clsx('relative flex h-9 w-12 cursor-pointer items-center justify-center', 'text-muted-foreground hover:text-foreground', isActive && 'text-foreground font-medium'), role: "radio", "aria-checked": isActive, "aria-label": `Switch to ${value} theme`, onClick: event => onClick(value, event), onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, style: {
|
|
12
|
-
borderRadius: 'var(--radius)',
|
|
13
|
-
}, children: [isHovered && (_jsx(motion.div, { layoutId: "theme-hover", className: "absolute inset-0 bg-muted", style: {
|
|
14
|
-
borderRadius: 'var(--radius)',
|
|
15
|
-
}, transition: {
|
|
16
|
-
type: 'spring',
|
|
17
|
-
bounce: 0,
|
|
18
|
-
stiffness: 100,
|
|
19
|
-
damping: 10,
|
|
20
|
-
duration: 0.3,
|
|
21
|
-
} })), _jsx("div", { className: "relative z-10 flex items-center justify-center", children: _jsx("div", { className: "[&_svg]:size-4", children: icon }) }), isActive && (_jsx("div", { className: "absolute bottom-0 left-1/2 h-0.5 w-6 -translate-x-1/2 rounded-full", style: {
|
|
22
|
-
backgroundColor: 'hsl(var(--primary))',
|
|
23
|
-
} }))] }));
|
|
24
|
-
};
|
|
25
|
-
const THEME_OPTIONS = [
|
|
26
|
-
{
|
|
27
|
-
icon: _jsx(MonitorIcon, {}),
|
|
28
|
-
value: 'system',
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
icon: _jsx(SunIcon, {}),
|
|
32
|
-
value: 'light',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
icon: _jsx(MoonIcon, {}),
|
|
36
|
-
value: 'dark',
|
|
37
|
-
},
|
|
38
|
-
];
|
|
39
|
-
export const ThemeSwitcher = ({ themes = ['light', 'dark', 'system'], currentTheme, onThemeChange, animationType, duration, className, }) => {
|
|
40
|
-
let contextTheme = null;
|
|
41
|
-
try {
|
|
42
|
-
contextTheme = useSpacemanTheme();
|
|
43
|
-
}
|
|
44
|
-
catch { }
|
|
45
|
-
const standaloneHook = useThemeAnimation({
|
|
46
|
-
animationType,
|
|
47
|
-
duration,
|
|
48
|
-
themes,
|
|
49
|
-
...(currentTheme !== undefined && { theme: currentTheme }),
|
|
50
|
-
onThemeChange,
|
|
51
|
-
});
|
|
52
|
-
const isControlled = contextTheme !== null;
|
|
53
|
-
const { ref, theme, switchTheme } = isControlled
|
|
54
|
-
? { ref: contextTheme.ref, theme: contextTheme.theme, switchTheme: contextTheme.switchTheme }
|
|
55
|
-
: standaloneHook;
|
|
56
|
-
const [isMounted, setIsMounted] = useState(false);
|
|
57
|
-
const [hoveredTheme, setHoveredTheme] = useState(null);
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
setIsMounted(true);
|
|
60
|
-
}, []);
|
|
61
|
-
const handleThemeChange = async (newTheme, event) => {
|
|
62
|
-
if (isControlled && contextTheme.switchThemeFromElement && event) {
|
|
63
|
-
await contextTheme.switchThemeFromElement(newTheme, event.currentTarget);
|
|
64
|
-
if (onThemeChange) {
|
|
65
|
-
onThemeChange(newTheme);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
await switchTheme(newTheme);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
const filteredOptions = THEME_OPTIONS.filter(option => themes.includes(option.value));
|
|
73
|
-
return (_jsx("div", { className: clsx('inline-flex h-9 items-center overflow-hidden bg-background shadow-sm border border-border', isMounted ? 'opacity-100' : 'opacity-0', className), style: {
|
|
74
|
-
borderRadius: 'var(--radius)',
|
|
75
|
-
backgroundColor: 'hsl(var(--background))',
|
|
76
|
-
}, role: "radiogroup", onMouseLeave: () => setHoveredTheme(null), children: filteredOptions.map(option => (_jsx(ThemeOption, { icon: option.icon, value: option.value, isActive: theme === option.value, isHovered: hoveredTheme === option.value, onClick: handleThemeChange, onMouseEnter: () => setHoveredTheme(option.value), onMouseLeave: () => { }, buttonRef: theme === option.value ? ref : undefined }, option.value))) }));
|
|
77
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import { Theme, ColorTheme, ThemeAnimationType } from '../types';
|
|
3
|
-
interface ViteThemeContextType {
|
|
4
|
-
ref: React.RefObject<HTMLButtonElement | null>;
|
|
5
|
-
theme: Theme;
|
|
6
|
-
colorTheme: ColorTheme;
|
|
7
|
-
resolvedTheme: 'light' | 'dark';
|
|
8
|
-
systemTheme: 'light' | 'dark';
|
|
9
|
-
setTheme: (theme: Theme) => void;
|
|
10
|
-
setColorTheme: (colorTheme: ColorTheme) => void;
|
|
11
|
-
switchTheme: (theme: Theme, animationOff?: boolean) => Promise<void>;
|
|
12
|
-
switchColorTheme: (colorTheme: string) => void;
|
|
13
|
-
toggleTheme: (animationOff?: boolean) => Promise<void>;
|
|
14
|
-
toggleLightTheme: (animationOff?: boolean) => Promise<void>;
|
|
15
|
-
toggleDarkTheme: (animationOff?: boolean) => Promise<void>;
|
|
16
|
-
toggleColorTheme: () => void;
|
|
17
|
-
createColorThemeToggle: (targetColorTheme: string) => () => void;
|
|
18
|
-
isColorThemeActive: (targetColorTheme: string) => boolean;
|
|
19
|
-
switchThemeFromElement: (theme: Theme, element: HTMLButtonElement) => Promise<void>;
|
|
20
|
-
}
|
|
21
|
-
interface ViteThemeProviderProps {
|
|
22
|
-
children: ReactNode;
|
|
23
|
-
themes?: Theme[];
|
|
24
|
-
colorThemes?: ColorTheme[];
|
|
25
|
-
defaultTheme?: Theme;
|
|
26
|
-
defaultColorTheme?: ColorTheme;
|
|
27
|
-
animationType?: ThemeAnimationType;
|
|
28
|
-
duration?: number;
|
|
29
|
-
attribute?: 'class' | 'data-theme';
|
|
30
|
-
disableTransitionOnChange?: boolean;
|
|
31
|
-
storageKey?: string;
|
|
32
|
-
colorStorageKey?: string;
|
|
33
|
-
globalClassName?: string;
|
|
34
|
-
colorThemePrefix?: string;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Vite Theme Provider - Optimized for Vite SPA applications
|
|
38
|
-
*
|
|
39
|
-
* This provider is designed for Vite-based single-page applications with optional
|
|
40
|
-
* transition disabling to prevent flash during theme switches.
|
|
41
|
-
*
|
|
42
|
-
* Note: For flash prevention on initial load, add a script to your index.html
|
|
43
|
-
* or inject it via Vite plugin to apply theme before React loads.
|
|
44
|
-
*
|
|
45
|
-
* @param children - React children to wrap with theme context
|
|
46
|
-
* @param themes - Available theme options
|
|
47
|
-
* @param colorThemes - Available color theme options
|
|
48
|
-
* @param defaultTheme - Default theme to use
|
|
49
|
-
* @param defaultColorTheme - Default color theme to use
|
|
50
|
-
* @param animationType - Animation type for theme transitions
|
|
51
|
-
* @param duration - Animation duration in milliseconds
|
|
52
|
-
* @param attribute - HTML attribute to use for theme ('class' or 'data-theme')
|
|
53
|
-
* @param disableTransitionOnChange - Temporarily disable CSS transitions during theme switch
|
|
54
|
-
* @param storageKey - LocalStorage key for theme preference
|
|
55
|
-
* @param colorStorageKey - LocalStorage key for color theme preference
|
|
56
|
-
* @param globalClassName - Class name for dark theme (when using 'class' attribute)
|
|
57
|
-
* @param colorThemePrefix - Prefix for color theme classes
|
|
58
|
-
*/
|
|
59
|
-
export declare const ViteThemeProvider: React.FC<ViteThemeProviderProps>;
|
|
60
|
-
export declare const useViteTheme: () => ViteThemeContextType;
|
|
61
|
-
export {};
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useContext, useCallback } from 'react';
|
|
3
|
-
import { useThemeAnimation } from '../hooks/use-theme-animation';
|
|
4
|
-
import { ThemeAnimationType } from '../types';
|
|
5
|
-
const ViteThemeContext = createContext(undefined);
|
|
6
|
-
/**
|
|
7
|
-
* Vite Theme Provider - Optimized for Vite SPA applications
|
|
8
|
-
*
|
|
9
|
-
* This provider is designed for Vite-based single-page applications with optional
|
|
10
|
-
* transition disabling to prevent flash during theme switches.
|
|
11
|
-
*
|
|
12
|
-
* Note: For flash prevention on initial load, add a script to your index.html
|
|
13
|
-
* or inject it via Vite plugin to apply theme before React loads.
|
|
14
|
-
*
|
|
15
|
-
* @param children - React children to wrap with theme context
|
|
16
|
-
* @param themes - Available theme options
|
|
17
|
-
* @param colorThemes - Available color theme options
|
|
18
|
-
* @param defaultTheme - Default theme to use
|
|
19
|
-
* @param defaultColorTheme - Default color theme to use
|
|
20
|
-
* @param animationType - Animation type for theme transitions
|
|
21
|
-
* @param duration - Animation duration in milliseconds
|
|
22
|
-
* @param attribute - HTML attribute to use for theme ('class' or 'data-theme')
|
|
23
|
-
* @param disableTransitionOnChange - Temporarily disable CSS transitions during theme switch
|
|
24
|
-
* @param storageKey - LocalStorage key for theme preference
|
|
25
|
-
* @param colorStorageKey - LocalStorage key for color theme preference
|
|
26
|
-
* @param globalClassName - Class name for dark theme (when using 'class' attribute)
|
|
27
|
-
* @param colorThemePrefix - Prefix for color theme classes
|
|
28
|
-
*/
|
|
29
|
-
export const ViteThemeProvider = ({ children, themes = ['light', 'dark', 'system'], colorThemes = ['default'], defaultTheme = 'system', defaultColorTheme = 'default', animationType = ThemeAnimationType.CIRCLE, duration = 750, attribute = 'class', disableTransitionOnChange = false, storageKey = 'vite-theme', colorStorageKey = 'vite-color-theme', globalClassName = 'dark', colorThemePrefix = 'theme-', }) => {
|
|
30
|
-
const themeState = useThemeAnimation({
|
|
31
|
-
themes,
|
|
32
|
-
colorThemes,
|
|
33
|
-
defaultTheme,
|
|
34
|
-
defaultColorTheme,
|
|
35
|
-
animationType,
|
|
36
|
-
duration,
|
|
37
|
-
storageKey,
|
|
38
|
-
colorStorageKey,
|
|
39
|
-
globalClassName: attribute === 'class' ? globalClassName : undefined,
|
|
40
|
-
colorThemePrefix,
|
|
41
|
-
});
|
|
42
|
-
const applyTransitionDisable = useCallback(() => {
|
|
43
|
-
if (!disableTransitionOnChange)
|
|
44
|
-
return () => { };
|
|
45
|
-
const css = document.createElement('style');
|
|
46
|
-
css.textContent = `*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`;
|
|
47
|
-
document.head.appendChild(css);
|
|
48
|
-
window.getComputedStyle(document.body);
|
|
49
|
-
return () => {
|
|
50
|
-
setTimeout(() => {
|
|
51
|
-
document.head.removeChild(css);
|
|
52
|
-
}, 1);
|
|
53
|
-
};
|
|
54
|
-
}, [disableTransitionOnChange]);
|
|
55
|
-
const wrappedSetTheme = useCallback((theme) => {
|
|
56
|
-
const cleanup = applyTransitionDisable();
|
|
57
|
-
themeState.setTheme(theme);
|
|
58
|
-
cleanup();
|
|
59
|
-
}, [themeState.setTheme, applyTransitionDisable]);
|
|
60
|
-
const wrappedSwitchTheme = useCallback(async (theme, animationOff = false) => {
|
|
61
|
-
const cleanup = applyTransitionDisable();
|
|
62
|
-
await themeState.switchTheme(theme, animationOff);
|
|
63
|
-
cleanup();
|
|
64
|
-
}, [themeState.switchTheme, applyTransitionDisable]);
|
|
65
|
-
const wrappedToggleTheme = useCallback(async (animationOff = false) => {
|
|
66
|
-
const cleanup = applyTransitionDisable();
|
|
67
|
-
await themeState.toggleTheme(animationOff);
|
|
68
|
-
cleanup();
|
|
69
|
-
}, [themeState.toggleTheme, applyTransitionDisable]);
|
|
70
|
-
const wrappedToggleLightTheme = useCallback(async (animationOff = false) => {
|
|
71
|
-
const cleanup = applyTransitionDisable();
|
|
72
|
-
await themeState.toggleLightTheme(animationOff);
|
|
73
|
-
cleanup();
|
|
74
|
-
}, [themeState.toggleLightTheme, applyTransitionDisable]);
|
|
75
|
-
const wrappedToggleDarkTheme = useCallback(async (animationOff = false) => {
|
|
76
|
-
const cleanup = applyTransitionDisable();
|
|
77
|
-
await themeState.toggleDarkTheme(animationOff);
|
|
78
|
-
cleanup();
|
|
79
|
-
}, [themeState.toggleDarkTheme, applyTransitionDisable]);
|
|
80
|
-
const switchThemeFromElement = async (theme, element) => {
|
|
81
|
-
const cleanup = applyTransitionDisable();
|
|
82
|
-
if (themeState.ref.current) {
|
|
83
|
-
const originalRef = themeState.ref.current;
|
|
84
|
-
Object.defineProperty(themeState.ref, 'current', {
|
|
85
|
-
value: element,
|
|
86
|
-
writable: true,
|
|
87
|
-
configurable: true,
|
|
88
|
-
});
|
|
89
|
-
await themeState.switchTheme(theme);
|
|
90
|
-
Object.defineProperty(themeState.ref, 'current', {
|
|
91
|
-
value: originalRef,
|
|
92
|
-
writable: true,
|
|
93
|
-
configurable: true,
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
Object.defineProperty(themeState.ref, 'current', {
|
|
98
|
-
value: element,
|
|
99
|
-
writable: true,
|
|
100
|
-
configurable: true,
|
|
101
|
-
});
|
|
102
|
-
await themeState.switchTheme(theme);
|
|
103
|
-
}
|
|
104
|
-
cleanup();
|
|
105
|
-
};
|
|
106
|
-
const systemTheme = typeof window !== 'undefined' && window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
107
|
-
? 'dark'
|
|
108
|
-
: 'light';
|
|
109
|
-
const contextValue = {
|
|
110
|
-
ref: themeState.ref,
|
|
111
|
-
theme: themeState.theme,
|
|
112
|
-
colorTheme: themeState.colorTheme,
|
|
113
|
-
resolvedTheme: themeState.resolvedTheme,
|
|
114
|
-
systemTheme,
|
|
115
|
-
setTheme: wrappedSetTheme,
|
|
116
|
-
setColorTheme: themeState.setColorTheme,
|
|
117
|
-
switchTheme: wrappedSwitchTheme,
|
|
118
|
-
switchThemeFromElement,
|
|
119
|
-
switchColorTheme: themeState.switchColorTheme,
|
|
120
|
-
toggleTheme: wrappedToggleTheme,
|
|
121
|
-
toggleLightTheme: wrappedToggleLightTheme,
|
|
122
|
-
toggleDarkTheme: wrappedToggleDarkTheme,
|
|
123
|
-
toggleColorTheme: themeState.toggleColorTheme,
|
|
124
|
-
createColorThemeToggle: themeState.createColorThemeToggle,
|
|
125
|
-
isColorThemeActive: themeState.isColorThemeActive,
|
|
126
|
-
};
|
|
127
|
-
return _jsx(ViteThemeContext.Provider, { value: contextValue, children: children });
|
|
128
|
-
};
|
|
129
|
-
export const useViteTheme = () => {
|
|
130
|
-
const context = useContext(ViteThemeContext);
|
|
131
|
-
if (context === undefined) {
|
|
132
|
-
throw new Error('useViteTheme must be used within a ViteThemeProvider');
|
|
133
|
-
}
|
|
134
|
-
return context;
|
|
135
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
3
|
-
declare function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
declare function SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
declare function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
declare function SelectTrigger({ className, size, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
|
|
7
|
-
size?: 'sm' | 'default';
|
|
8
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
declare function SelectContent({ className, children, position, ...props }: React.ComponentProps<typeof SelectPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
declare function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
declare function SelectItem({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
declare function SelectSeparator({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Separator>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
declare function SelectScrollUpButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
declare function SelectScrollDownButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, };
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
3
|
-
import { clsx } from 'clsx';
|
|
4
|
-
function Select({ ...props }) {
|
|
5
|
-
return _jsx(SelectPrimitive.Root, { "data-slot": "select", ...props });
|
|
6
|
-
}
|
|
7
|
-
function SelectGroup({ ...props }) {
|
|
8
|
-
return _jsx(SelectPrimitive.Group, { "data-slot": "select-group", ...props });
|
|
9
|
-
}
|
|
10
|
-
function SelectValue({ ...props }) {
|
|
11
|
-
return _jsx(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
|
|
12
|
-
}
|
|
13
|
-
const ChevronDownIcon = () => (_jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("path", { d: "m6 9 6 6 6-6" }) }));
|
|
14
|
-
const ChevronUpIcon = () => (_jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("path", { d: "m18 15-6-6-6 6" }) }));
|
|
15
|
-
const CheckIcon = () => (_jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("path", { d: "M20 6 9 17l-5-5" }) }));
|
|
16
|
-
function SelectTrigger({ className, size = 'default', children, ...props }) {
|
|
17
|
-
return (_jsxs(SelectPrimitive.Trigger, { "data-slot": "select-trigger", "data-size": size, className: clsx("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), ...props, children: [children, _jsx(SelectPrimitive.Icon, { asChild: true, children: _jsx(ChevronDownIcon, {}) })] }));
|
|
18
|
-
}
|
|
19
|
-
function SelectContent({ className, children, position = 'popper', ...props }) {
|
|
20
|
-
return (_jsx(SelectPrimitive.Portal, { children: _jsx(SelectPrimitive.Content, { "data-slot": "select-content", className: clsx('bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md', position === 'popper' &&
|
|
21
|
-
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1', className), position: position, ...props, children: _jsx(SelectPrimitive.Viewport, { className: clsx('p-1', position === 'popper' &&
|
|
22
|
-
'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]'), children: children }) }) }));
|
|
23
|
-
}
|
|
24
|
-
function SelectLabel({ className, ...props }) {
|
|
25
|
-
return (_jsx(SelectPrimitive.Label, { "data-slot": "select-label", className: clsx('py-1.5 pl-8 pr-2 text-sm font-semibold', className), ...props }));
|
|
26
|
-
}
|
|
27
|
-
function SelectItem({ className, children, ...props }) {
|
|
28
|
-
return (_jsxs(SelectPrimitive.Item, { "data-slot": "select-item", className: clsx("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className), ...props, children: [_jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: _jsx(SelectPrimitive.ItemIndicator, { children: _jsx(CheckIcon, {}) }) }), _jsx(SelectPrimitive.ItemText, { children: children })] }));
|
|
29
|
-
}
|
|
30
|
-
function SelectSeparator({ className, ...props }) {
|
|
31
|
-
return (_jsx(SelectPrimitive.Separator, { "data-slot": "select-separator", className: clsx('-mx-1 my-1 h-px bg-muted', className), ...props }));
|
|
32
|
-
}
|
|
33
|
-
function SelectScrollUpButton({ className, ...props }) {
|
|
34
|
-
return (_jsx(SelectPrimitive.ScrollUpButton, { "data-slot": "select-scroll-up-button", className: clsx('flex cursor-default items-center justify-center py-1', className), ...props, children: _jsx(ChevronUpIcon, {}) }));
|
|
35
|
-
}
|
|
36
|
-
function SelectScrollDownButton({ className, ...props }) {
|
|
37
|
-
return (_jsx(SelectPrimitive.ScrollDownButton, { "data-slot": "select-scroll-down-button", className: clsx('flex cursor-default items-center justify-center py-1', className), ...props, children: _jsx(ChevronDownIcon, {}) }));
|
|
38
|
-
}
|
|
39
|
-
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, };
|
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef, useState, useCallback } from 'react';
|
|
2
|
-
import { flushSync } from 'react-dom';
|
|
3
|
-
import { ThemeAnimationType, } from '../types';
|
|
4
|
-
import { injectBaseStyles, resolveTheme, getSystemTheme, supportsViewTransitions, prefersReducedMotion, createCircleAnimation, createBlurCircleAnimation, createSlideAnimation, } from '../utils/animations';
|
|
5
|
-
const isBrowser = typeof window !== 'undefined';
|
|
6
|
-
export const useThemeAnimation = (props = {}) => {
|
|
7
|
-
const { duration: propsDuration = 750, easing = 'ease-in-out', animationType = ThemeAnimationType.CIRCLE, blurAmount = 2, styleId = 'spaceman-theme-style', themes = ['light', 'dark', 'system'], colorThemes = ['default'], defaultTheme = 'system', defaultColorTheme = 'default', globalClassName = 'dark', colorThemePrefix = 'theme-', storageKey = 'theme', colorStorageKey = 'color-theme', theme: externalTheme, colorTheme: externalColorTheme, onThemeChange, onColorThemeChange,
|
|
8
|
-
// Slide animation options
|
|
9
|
-
slideDirection = 'left', slideFromX, slideFromY, slideToX = 0, slideToY = 0, } = props;
|
|
10
|
-
const isHighResolution = isBrowser && (window.innerWidth >= 3000 || window.innerHeight >= 2000);
|
|
11
|
-
const duration = isHighResolution ? Math.max(propsDuration * 0.8, 500) : propsDuration;
|
|
12
|
-
const [mounted, setMounted] = useState(false);
|
|
13
|
-
// Inject base styles once on mount
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
injectBaseStyles();
|
|
16
|
-
setMounted(true);
|
|
17
|
-
}, []);
|
|
18
|
-
const [internalTheme, setInternalTheme] = useState(() => {
|
|
19
|
-
if (!isBrowser)
|
|
20
|
-
return defaultTheme;
|
|
21
|
-
const saved = localStorage.getItem(storageKey);
|
|
22
|
-
return saved && themes.indexOf(saved) !== -1 ? saved : defaultTheme;
|
|
23
|
-
});
|
|
24
|
-
const [internalColorTheme, setInternalColorTheme] = useState(() => {
|
|
25
|
-
if (!isBrowser)
|
|
26
|
-
return defaultColorTheme;
|
|
27
|
-
const saved = localStorage.getItem(colorStorageKey);
|
|
28
|
-
return saved && colorThemes.indexOf(saved) !== -1 ? saved : defaultColorTheme;
|
|
29
|
-
});
|
|
30
|
-
const currentTheme = externalTheme ?? internalTheme;
|
|
31
|
-
const currentColorTheme = externalColorTheme ?? internalColorTheme;
|
|
32
|
-
const [, setSystemTheme] = useState(() => getSystemTheme());
|
|
33
|
-
const resolvedTheme = resolveTheme(currentTheme);
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
if (!isBrowser)
|
|
36
|
-
return;
|
|
37
|
-
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
|
38
|
-
const handleChange = () => setSystemTheme(getSystemTheme());
|
|
39
|
-
mediaQuery.addEventListener('change', handleChange);
|
|
40
|
-
return () => mediaQuery.removeEventListener('change', handleChange);
|
|
41
|
-
}, []);
|
|
42
|
-
// Apply theme classes to DOM
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
if (!isBrowser || !mounted)
|
|
45
|
-
return;
|
|
46
|
-
if (resolvedTheme === 'dark') {
|
|
47
|
-
document.documentElement.classList.add(globalClassName);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
document.documentElement.classList.remove(globalClassName);
|
|
51
|
-
}
|
|
52
|
-
colorThemes.forEach(theme => {
|
|
53
|
-
document.documentElement.classList.remove(`${colorThemePrefix}${theme}`);
|
|
54
|
-
});
|
|
55
|
-
document.documentElement.classList.add(`${colorThemePrefix}${currentColorTheme}`);
|
|
56
|
-
}, [resolvedTheme, currentColorTheme, globalClassName, colorThemePrefix, colorThemes, mounted]);
|
|
57
|
-
const ref = useRef(null);
|
|
58
|
-
const setTheme = useCallback((newTheme) => {
|
|
59
|
-
// Always save to localStorage
|
|
60
|
-
if (isBrowser) {
|
|
61
|
-
localStorage.setItem(storageKey, newTheme);
|
|
62
|
-
}
|
|
63
|
-
// Update internal state if no external control
|
|
64
|
-
if (externalTheme === undefined) {
|
|
65
|
-
setInternalTheme(newTheme);
|
|
66
|
-
}
|
|
67
|
-
// Call external callback if provided
|
|
68
|
-
if (onThemeChange) {
|
|
69
|
-
onThemeChange(newTheme);
|
|
70
|
-
}
|
|
71
|
-
}, [onThemeChange, externalTheme, storageKey]);
|
|
72
|
-
const setColorTheme = useCallback((newColorTheme) => {
|
|
73
|
-
// Always save to localStorage
|
|
74
|
-
if (isBrowser) {
|
|
75
|
-
localStorage.setItem(colorStorageKey, newColorTheme);
|
|
76
|
-
}
|
|
77
|
-
// Update internal state if no external control
|
|
78
|
-
if (externalColorTheme === undefined) {
|
|
79
|
-
setInternalColorTheme(newColorTheme);
|
|
80
|
-
}
|
|
81
|
-
// Call external callback if provided
|
|
82
|
-
if (onColorThemeChange) {
|
|
83
|
-
onColorThemeChange(newColorTheme);
|
|
84
|
-
}
|
|
85
|
-
}, [onColorThemeChange, externalColorTheme, colorStorageKey]);
|
|
86
|
-
const switchTheme = useCallback(async (newTheme, animationOff = false) => {
|
|
87
|
-
if (!ref.current || !supportsViewTransitions() || prefersReducedMotion() || animationOff) {
|
|
88
|
-
setTheme(newTheme);
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
// Helper function to convert direction to from coordinates
|
|
92
|
-
const getSlideFromCoords = (direction) => {
|
|
93
|
-
switch (direction) {
|
|
94
|
-
case 'left':
|
|
95
|
-
return { a: -100, b: 0 };
|
|
96
|
-
case 'right':
|
|
97
|
-
return { a: 100, b: 0 };
|
|
98
|
-
case 'top':
|
|
99
|
-
return { a: 0, b: -100 };
|
|
100
|
-
case 'bottom':
|
|
101
|
-
return { a: 0, b: 100 };
|
|
102
|
-
case 'top-left':
|
|
103
|
-
return { a: -100, b: -100 };
|
|
104
|
-
case 'top-right':
|
|
105
|
-
return { a: 100, b: -100 };
|
|
106
|
-
case 'bottom-left':
|
|
107
|
-
return { a: -100, b: 100 };
|
|
108
|
-
case 'bottom-right':
|
|
109
|
-
return { a: 100, b: 100 };
|
|
110
|
-
default:
|
|
111
|
-
return { a: -100, b: 0 };
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
let animationConfig;
|
|
115
|
-
if (animationType === ThemeAnimationType.SLIDE) {
|
|
116
|
-
// Use custom coordinates if provided, otherwise use direction
|
|
117
|
-
const fromCoords = slideFromX !== undefined && slideFromY !== undefined
|
|
118
|
-
? { a: slideFromX, b: slideFromY }
|
|
119
|
-
: getSlideFromCoords(slideDirection);
|
|
120
|
-
animationConfig = {
|
|
121
|
-
a: fromCoords.a,
|
|
122
|
-
b: fromCoords.b,
|
|
123
|
-
x: slideToX,
|
|
124
|
-
y: slideToY,
|
|
125
|
-
duration,
|
|
126
|
-
easing,
|
|
127
|
-
animationType,
|
|
128
|
-
blurAmount,
|
|
129
|
-
styleId,
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
// For circle and blur circle animations, use button center
|
|
134
|
-
const { top, left, width, height } = ref.current.getBoundingClientRect();
|
|
135
|
-
const x = left + width / 2;
|
|
136
|
-
const y = top + height / 2;
|
|
137
|
-
animationConfig = {
|
|
138
|
-
x,
|
|
139
|
-
y,
|
|
140
|
-
duration,
|
|
141
|
-
easing,
|
|
142
|
-
animationType,
|
|
143
|
-
blurAmount,
|
|
144
|
-
styleId,
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
if (animationType === ThemeAnimationType.BLUR_CIRCLE) {
|
|
148
|
-
createBlurCircleAnimation(animationConfig);
|
|
149
|
-
}
|
|
150
|
-
if (animationType === ThemeAnimationType.SLIDE) {
|
|
151
|
-
createSlideAnimation(animationConfig);
|
|
152
|
-
}
|
|
153
|
-
// Start the view transition
|
|
154
|
-
await document.startViewTransition(() => {
|
|
155
|
-
flushSync(() => {
|
|
156
|
-
setTheme(newTheme);
|
|
157
|
-
});
|
|
158
|
-
}).ready;
|
|
159
|
-
if (animationType === ThemeAnimationType.CIRCLE) {
|
|
160
|
-
createCircleAnimation(animationConfig);
|
|
161
|
-
}
|
|
162
|
-
}, [
|
|
163
|
-
setTheme,
|
|
164
|
-
duration,
|
|
165
|
-
easing,
|
|
166
|
-
animationType,
|
|
167
|
-
blurAmount,
|
|
168
|
-
styleId,
|
|
169
|
-
slideDirection,
|
|
170
|
-
slideFromX,
|
|
171
|
-
slideFromY,
|
|
172
|
-
slideToX,
|
|
173
|
-
slideToY,
|
|
174
|
-
]);
|
|
175
|
-
const switchColorTheme = useCallback((newColorTheme) => {
|
|
176
|
-
if (colorThemes.indexOf(newColorTheme) === -1) {
|
|
177
|
-
console.warn(`Color theme "${newColorTheme}" not found in available themes`);
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
setColorTheme(newColorTheme);
|
|
181
|
-
}, [colorThemes, setColorTheme]);
|
|
182
|
-
const toggleTheme = useCallback(async (animationOff = false) => {
|
|
183
|
-
const newTheme = resolvedTheme === 'dark' ? 'light' : 'dark';
|
|
184
|
-
await switchTheme(newTheme, animationOff);
|
|
185
|
-
}, [resolvedTheme, switchTheme]);
|
|
186
|
-
const toggleLightTheme = useCallback(async (animationOff = false) => {
|
|
187
|
-
if (resolvedTheme === 'light')
|
|
188
|
-
return;
|
|
189
|
-
await switchTheme('light', animationOff);
|
|
190
|
-
}, [resolvedTheme, switchTheme]);
|
|
191
|
-
const toggleDarkTheme = useCallback(async (animationOff = false) => {
|
|
192
|
-
if (resolvedTheme === 'dark')
|
|
193
|
-
return;
|
|
194
|
-
await switchTheme('dark', animationOff);
|
|
195
|
-
}, [resolvedTheme, switchTheme]);
|
|
196
|
-
const toggleColorTheme = useCallback(() => {
|
|
197
|
-
const currentIndex = colorThemes.indexOf(currentColorTheme);
|
|
198
|
-
const nextIndex = (currentIndex + 1) % colorThemes.length;
|
|
199
|
-
const nextColorTheme = colorThemes[nextIndex];
|
|
200
|
-
setColorTheme(nextColorTheme);
|
|
201
|
-
}, [currentColorTheme, colorThemes, setColorTheme]);
|
|
202
|
-
const createColorThemeToggle = useCallback((targetColorTheme) => {
|
|
203
|
-
return () => {
|
|
204
|
-
if (colorThemes.indexOf(targetColorTheme) === -1) {
|
|
205
|
-
console.warn(`Color theme "${targetColorTheme}" not found in available themes`);
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
setColorTheme(targetColorTheme);
|
|
209
|
-
};
|
|
210
|
-
}, [colorThemes, setColorTheme]);
|
|
211
|
-
const isColorThemeActive = useCallback((targetColorTheme) => {
|
|
212
|
-
return currentColorTheme === targetColorTheme;
|
|
213
|
-
}, [currentColorTheme]);
|
|
214
|
-
return {
|
|
215
|
-
ref,
|
|
216
|
-
theme: currentTheme,
|
|
217
|
-
colorTheme: currentColorTheme,
|
|
218
|
-
resolvedTheme,
|
|
219
|
-
setTheme,
|
|
220
|
-
setColorTheme,
|
|
221
|
-
switchTheme,
|
|
222
|
-
switchColorTheme,
|
|
223
|
-
toggleTheme,
|
|
224
|
-
toggleLightTheme,
|
|
225
|
-
toggleDarkTheme,
|
|
226
|
-
toggleColorTheme,
|
|
227
|
-
createColorThemeToggle,
|
|
228
|
-
isColorThemeActive,
|
|
229
|
-
};
|
|
230
|
-
};
|
package/dist/esm/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { useThemeAnimation } from './hooks/use-theme-animation';
|
|
2
|
-
export { ThemeSwitcher } from './components/ThemeSwitcher';
|
|
3
|
-
export { ThemeSelector } from './components/ThemeSelector';
|
|
4
|
-
export { SpacemanThemeProvider, useSpacemanTheme } from './components/SpacemanThemeProvider';
|
|
5
|
-
export { NextThemeProvider, useNextTheme } from './components/NextThemeProvider';
|
|
6
|
-
export { TanStackThemeProvider, useTanStackTheme } from './components/TanStackThemeProvider';
|
|
7
|
-
export { ViteThemeProvider, useViteTheme } from './components/ViteThemeProvider';
|
|
8
|
-
export type { UseThemeAnimationProps, UseThemeAnimationReturn, ThemeSwitcherProps, ThemeSelectorProps, Theme, ColorTheme, SlideDirection, } from './types';
|
|
9
|
-
export { ThemeAnimationType } from './types';
|
|
10
|
-
export { injectBaseStyles, getSystemTheme, resolveTheme, supportsViewTransitions, prefersReducedMotion, } from './utils/animations';
|
package/dist/esm/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { useThemeAnimation } from './hooks/use-theme-animation';
|
|
2
|
-
export { ThemeSwitcher } from './components/ThemeSwitcher';
|
|
3
|
-
export { ThemeSelector } from './components/ThemeSelector';
|
|
4
|
-
export { SpacemanThemeProvider, useSpacemanTheme } from './components/SpacemanThemeProvider';
|
|
5
|
-
// Framework-specific optimized providers
|
|
6
|
-
export { NextThemeProvider, useNextTheme } from './components/NextThemeProvider';
|
|
7
|
-
export { TanStackThemeProvider, useTanStackTheme } from './components/TanStackThemeProvider';
|
|
8
|
-
export { ViteThemeProvider, useViteTheme } from './components/ViteThemeProvider';
|
|
9
|
-
export { ThemeAnimationType } from './types';
|
|
10
|
-
export { injectBaseStyles, getSystemTheme, resolveTheme, supportsViewTransitions, prefersReducedMotion, } from './utils/animations';
|
package/dist/esm/types/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ThemeAnimationType } from '../types';
|
|
2
|
-
export declare const injectBaseStyles: () => void;
|
|
3
|
-
export declare const createBlurCircleMask: (blur: number) => string;
|
|
4
|
-
export declare const getSystemTheme: () => "light" | "dark";
|
|
5
|
-
export declare const resolveTheme: (theme: string) => "light" | "dark";
|
|
6
|
-
export declare const supportsViewTransitions: () => boolean;
|
|
7
|
-
export declare const prefersReducedMotion: () => boolean;
|
|
8
|
-
export interface AnimationConfig {
|
|
9
|
-
a?: number;
|
|
10
|
-
b?: number;
|
|
11
|
-
x: number;
|
|
12
|
-
y: number;
|
|
13
|
-
duration: number;
|
|
14
|
-
easing: string;
|
|
15
|
-
animationType: ThemeAnimationType;
|
|
16
|
-
blurAmount: number;
|
|
17
|
-
styleId: string;
|
|
18
|
-
}
|
|
19
|
-
export declare const createCircleAnimation: (config: AnimationConfig) => void;
|
|
20
|
-
export declare const createSlideAnimation: (config: AnimationConfig) => void;
|
|
21
|
-
export declare const createBlurCircleAnimation: (config: AnimationConfig) => void;
|