@rubixstudios/payload-typesense 1.0.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/LICENSE +22 -0
- package/README.md +182 -0
- package/dist/components/HeadlessSearchInput.d.ts +86 -0
- package/dist/components/HeadlessSearchInput.d.ts.map +1 -0
- package/dist/components/HeadlessSearchInput.js +602 -0
- package/dist/components/ThemeProvider.d.ts +10 -0
- package/dist/components/ThemeProvider.d.ts.map +1 -0
- package/dist/components/ThemeProvider.js +17 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +3 -0
- package/dist/components/themes/hooks.d.ts +52 -0
- package/dist/components/themes/hooks.d.ts.map +1 -0
- package/dist/components/themes/hooks.js +177 -0
- package/dist/components/themes/index.d.ts +5 -0
- package/dist/components/themes/index.d.ts.map +1 -0
- package/dist/components/themes/index.js +4 -0
- package/dist/components/themes/themes.d.ts +6 -0
- package/dist/components/themes/themes.d.ts.map +1 -0
- package/dist/components/themes/themes.js +156 -0
- package/dist/components/themes/types.d.ts +147 -0
- package/dist/components/themes/types.d.ts.map +1 -0
- package/dist/components/themes/types.js +1 -0
- package/dist/components/themes/utils.d.ts +30 -0
- package/dist/components/themes/utils.d.ts.map +1 -0
- package/dist/components/themes/utils.js +397 -0
- package/dist/endpoints/customEndpointHandler.d.ts +3 -0
- package/dist/endpoints/customEndpointHandler.d.ts.map +1 -0
- package/dist/endpoints/customEndpointHandler.js +5 -0
- package/dist/endpoints/health.d.ts +12 -0
- package/dist/endpoints/health.d.ts.map +1 -0
- package/dist/endpoints/health.js +174 -0
- package/dist/endpoints/search.d.ts +13 -0
- package/dist/endpoints/search.d.ts.map +1 -0
- package/dist/endpoints/search.js +375 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +148 -0
- package/dist/lib/cache.d.ts +41 -0
- package/dist/lib/cache.d.ts.map +1 -0
- package/dist/lib/cache.js +96 -0
- package/dist/lib/config-validation.d.ts +75 -0
- package/dist/lib/config-validation.d.ts.map +1 -0
- package/dist/lib/config-validation.js +174 -0
- package/dist/lib/hooks.d.ts +4 -0
- package/dist/lib/hooks.d.ts.map +1 -0
- package/dist/lib/hooks.js +54 -0
- package/dist/lib/initialization.d.ts +5 -0
- package/dist/lib/initialization.d.ts.map +1 -0
- package/dist/lib/initialization.js +102 -0
- package/dist/lib/schema-mapper.d.ts +14 -0
- package/dist/lib/schema-mapper.d.ts.map +1 -0
- package/dist/lib/schema-mapper.js +137 -0
- package/dist/lib/types.d.ts +183 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +2 -0
- package/dist/lib/typesense-client.d.ts +5 -0
- package/dist/lib/typesense-client.d.ts.map +1 -0
- package/dist/lib/typesense-client.js +20 -0
- package/package.json +92 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Theme, ThemeConfig, ThemeContextValue } from './types.js';
|
|
2
|
+
declare const ThemeContext: import("react").Context<ThemeContextValue | null>;
|
|
3
|
+
/**
|
|
4
|
+
* Hook to access theme context
|
|
5
|
+
*/
|
|
6
|
+
export declare function useTheme(): ThemeContextValue;
|
|
7
|
+
/**
|
|
8
|
+
* Hook to create theme configuration
|
|
9
|
+
*/
|
|
10
|
+
export declare function useThemeConfig(config: ThemeConfig): ThemeContextValue;
|
|
11
|
+
/**
|
|
12
|
+
* Hook to apply theme styles to CSS variables
|
|
13
|
+
*/
|
|
14
|
+
export declare function useThemeStyles(config: ThemeConfig): Record<string, string>;
|
|
15
|
+
/**
|
|
16
|
+
* Hook to get responsive theme configuration
|
|
17
|
+
*/
|
|
18
|
+
export declare function useResponsiveTheme(baseConfig: ThemeConfig, isMobile: boolean): ThemeConfig;
|
|
19
|
+
/**
|
|
20
|
+
* Hook to toggle between light and dark themes
|
|
21
|
+
*/
|
|
22
|
+
export declare function useThemeToggle(lightConfig: ThemeConfig, darkConfig: ThemeConfig, isDark: boolean): ThemeConfig;
|
|
23
|
+
/**
|
|
24
|
+
* Hook to create theme-aware CSS classes
|
|
25
|
+
*/
|
|
26
|
+
export declare function useThemeClasses(config: ThemeConfig): Record<string, string>;
|
|
27
|
+
/**
|
|
28
|
+
* Hook to get theme-aware color values
|
|
29
|
+
*/
|
|
30
|
+
export declare function useThemeColors(config: ThemeConfig): Theme['colors'];
|
|
31
|
+
/**
|
|
32
|
+
* Hook to get theme-aware spacing values
|
|
33
|
+
*/
|
|
34
|
+
export declare function useThemeSpacing(config: ThemeConfig): Theme['spacing'];
|
|
35
|
+
/**
|
|
36
|
+
* Hook to get theme-aware typography values
|
|
37
|
+
*/
|
|
38
|
+
export declare function useThemeTypography(config: ThemeConfig): Theme['typography'];
|
|
39
|
+
/**
|
|
40
|
+
* Hook to detect system theme preference
|
|
41
|
+
*/
|
|
42
|
+
export declare function useSystemTheme(): 'dark' | 'light';
|
|
43
|
+
/**
|
|
44
|
+
* Hook to create auto theme configuration based on system preference
|
|
45
|
+
*/
|
|
46
|
+
export declare function useAutoTheme(lightTheme: string, darkTheme: string): string;
|
|
47
|
+
/**
|
|
48
|
+
* Hook to create theme with custom overrides
|
|
49
|
+
*/
|
|
50
|
+
export declare function useCustomTheme(baseThemeName: string, overrides: Partial<ThemeConfig>): ThemeConfig;
|
|
51
|
+
export { ThemeContext };
|
|
52
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/components/themes/hooks.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAYvE,QAAA,MAAM,YAAY,mDAAgD,CAAA;AAElE;;GAEG;AACH,wBAAgB,QAAQ,IAAI,iBAAiB,CAM5C;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,iBAAiB,CAoBrE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAK1E;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,GAAG,WAAW,CA8B1F;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,WAAW,EACvB,MAAM,EAAE,OAAO,GACd,WAAW,CAIb;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAc3E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,KAAK,CAAC,QAAQ,CAAC,CAKnE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC,CAKrE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,GAAG,KAAK,CAAC,YAAY,CAAC,CAK3E;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,GAAG,OAAO,CAMjD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAM1E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC,GAC9B,WAAW,CAOb;AAGD,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { createContext, useCallback, useContext, useMemo } from 'react';
|
|
3
|
+
import { applyTheme, generateThemeClasses, getThemeVariables, isDarkTheme, isLightTheme, mergeThemeConfig } from './utils.js';
|
|
4
|
+
// Theme context
|
|
5
|
+
const ThemeContext = createContext(null);
|
|
6
|
+
/**
|
|
7
|
+
* Hook to access theme context
|
|
8
|
+
*/ export function useTheme() {
|
|
9
|
+
const context = useContext(ThemeContext);
|
|
10
|
+
if (!context) {
|
|
11
|
+
throw new Error('useTheme must be used within a ThemeProvider');
|
|
12
|
+
}
|
|
13
|
+
return context;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Hook to create theme configuration
|
|
17
|
+
*/ export function useThemeConfig(config) {
|
|
18
|
+
const theme = useMemo(()=>mergeThemeConfig(config), [
|
|
19
|
+
config
|
|
20
|
+
]);
|
|
21
|
+
const classes = useMemo(()=>generateThemeClasses(theme, config), [
|
|
22
|
+
theme,
|
|
23
|
+
config
|
|
24
|
+
]);
|
|
25
|
+
const applyThemeToElement = useCallback((element, variant)=>applyTheme(theme, element, variant), [
|
|
26
|
+
theme
|
|
27
|
+
]);
|
|
28
|
+
return useMemo(()=>({
|
|
29
|
+
applyTheme: applyThemeToElement,
|
|
30
|
+
classes,
|
|
31
|
+
config,
|
|
32
|
+
isDark: isDarkTheme(theme),
|
|
33
|
+
isLight: isLightTheme(theme),
|
|
34
|
+
theme
|
|
35
|
+
}), [
|
|
36
|
+
theme,
|
|
37
|
+
config,
|
|
38
|
+
classes,
|
|
39
|
+
applyThemeToElement
|
|
40
|
+
]);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Hook to apply theme styles to CSS variables
|
|
44
|
+
*/ export function useThemeStyles(config) {
|
|
45
|
+
return useMemo(()=>{
|
|
46
|
+
const theme = mergeThemeConfig(config);
|
|
47
|
+
return getThemeVariables(theme);
|
|
48
|
+
}, [
|
|
49
|
+
config
|
|
50
|
+
]);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Hook to get responsive theme configuration
|
|
54
|
+
*/ export function useResponsiveTheme(baseConfig, isMobile) {
|
|
55
|
+
return useMemo(()=>{
|
|
56
|
+
if (!baseConfig.responsive) {
|
|
57
|
+
return baseConfig;
|
|
58
|
+
}
|
|
59
|
+
const mobileConfig = {
|
|
60
|
+
...baseConfig,
|
|
61
|
+
spacing: {
|
|
62
|
+
...baseConfig.spacing,
|
|
63
|
+
// Adjust spacing for mobile
|
|
64
|
+
headerPadding: '0.75rem 1rem',
|
|
65
|
+
inputFontSize: '16px',
|
|
66
|
+
inputPadding: '0.875rem 1rem',
|
|
67
|
+
itemPadding: '0.875rem 1rem',
|
|
68
|
+
resultsMaxHeight: '20rem'
|
|
69
|
+
},
|
|
70
|
+
// Disable animations on mobile for better performance
|
|
71
|
+
animations: isMobile ? {
|
|
72
|
+
...baseConfig.animations,
|
|
73
|
+
transitionFast: '0s',
|
|
74
|
+
transitionNormal: '0s',
|
|
75
|
+
transitionSlow: '0s'
|
|
76
|
+
} : baseConfig.animations
|
|
77
|
+
};
|
|
78
|
+
return mobileConfig;
|
|
79
|
+
}, [
|
|
80
|
+
baseConfig,
|
|
81
|
+
isMobile
|
|
82
|
+
]);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Hook to toggle between light and dark themes
|
|
86
|
+
*/ export function useThemeToggle(lightConfig, darkConfig, isDark) {
|
|
87
|
+
return useMemo(()=>{
|
|
88
|
+
return isDark ? darkConfig : lightConfig;
|
|
89
|
+
}, [
|
|
90
|
+
lightConfig,
|
|
91
|
+
darkConfig,
|
|
92
|
+
isDark
|
|
93
|
+
]);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Hook to create theme-aware CSS classes
|
|
97
|
+
*/ export function useThemeClasses(config) {
|
|
98
|
+
return useMemo(()=>{
|
|
99
|
+
const theme = mergeThemeConfig(config);
|
|
100
|
+
const classes = generateThemeClasses(theme, config);
|
|
101
|
+
// Convert to a more usable format
|
|
102
|
+
const classMap = {};
|
|
103
|
+
Object.entries(classes).forEach(([key, value])=>{
|
|
104
|
+
classMap[key] = value;
|
|
105
|
+
});
|
|
106
|
+
return classMap;
|
|
107
|
+
}, [
|
|
108
|
+
config
|
|
109
|
+
]);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Hook to get theme-aware color values
|
|
113
|
+
*/ export function useThemeColors(config) {
|
|
114
|
+
return useMemo(()=>{
|
|
115
|
+
const theme = mergeThemeConfig(config);
|
|
116
|
+
return theme.colors;
|
|
117
|
+
}, [
|
|
118
|
+
config
|
|
119
|
+
]);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Hook to get theme-aware spacing values
|
|
123
|
+
*/ export function useThemeSpacing(config) {
|
|
124
|
+
return useMemo(()=>{
|
|
125
|
+
const theme = mergeThemeConfig(config);
|
|
126
|
+
return theme.spacing;
|
|
127
|
+
}, [
|
|
128
|
+
config
|
|
129
|
+
]);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Hook to get theme-aware typography values
|
|
133
|
+
*/ export function useThemeTypography(config) {
|
|
134
|
+
return useMemo(()=>{
|
|
135
|
+
const theme = mergeThemeConfig(config);
|
|
136
|
+
return theme.typography;
|
|
137
|
+
}, [
|
|
138
|
+
config
|
|
139
|
+
]);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Hook to detect system theme preference
|
|
143
|
+
*/ export function useSystemTheme() {
|
|
144
|
+
return useMemo(()=>{
|
|
145
|
+
if (typeof window === 'undefined') {
|
|
146
|
+
return 'light';
|
|
147
|
+
}
|
|
148
|
+
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
149
|
+
}, []);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Hook to create auto theme configuration based on system preference
|
|
153
|
+
*/ export function useAutoTheme(lightTheme, darkTheme) {
|
|
154
|
+
const systemTheme = useSystemTheme();
|
|
155
|
+
return useMemo(()=>{
|
|
156
|
+
return systemTheme === 'dark' ? darkTheme : lightTheme;
|
|
157
|
+
}, [
|
|
158
|
+
systemTheme,
|
|
159
|
+
lightTheme,
|
|
160
|
+
darkTheme
|
|
161
|
+
]);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Hook to create theme with custom overrides
|
|
165
|
+
*/ export function useCustomTheme(baseThemeName, overrides) {
|
|
166
|
+
return useMemo(()=>{
|
|
167
|
+
return {
|
|
168
|
+
theme: baseThemeName,
|
|
169
|
+
...overrides
|
|
170
|
+
};
|
|
171
|
+
}, [
|
|
172
|
+
baseThemeName,
|
|
173
|
+
overrides
|
|
174
|
+
]);
|
|
175
|
+
}
|
|
176
|
+
// Export context for provider
|
|
177
|
+
export { ThemeContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/themes/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themes.d.ts","sourceRoot":"","sources":["../../../src/components/themes/themes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AA2DvC,eAAO,MAAM,WAAW,EAAE,KAqDzB,CAAA;AAGD,eAAO,MAAM,SAAS,EAAE,KAqDvB,CAAA;AAGD,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAGxC,CAAA;AAGD,eAAO,MAAM,YAAY,OAAc,CAAA"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
const baseTheme = {
|
|
2
|
+
animations: {
|
|
3
|
+
animationFast: '0.15s',
|
|
4
|
+
animationNormal: '0.2s',
|
|
5
|
+
animationSlow: '0.3s',
|
|
6
|
+
easeIn: 'cubic-bezier(0.4, 0, 1, 1)',
|
|
7
|
+
easeInOut: 'cubic-bezier(0.4, 0, 0.2, 1)',
|
|
8
|
+
easeOut: 'cubic-bezier(0, 0, 0.2, 1)',
|
|
9
|
+
transitionFast: '0.15s',
|
|
10
|
+
transitionNormal: '0.2s',
|
|
11
|
+
transitionSlow: '0.3s'
|
|
12
|
+
},
|
|
13
|
+
shadows: {
|
|
14
|
+
focusShadow: '0 0 0 3px',
|
|
15
|
+
focusShadowColor: 'rgba(59, 130, 246, 0.1)',
|
|
16
|
+
shadowLg: '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)',
|
|
17
|
+
shadowMd: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)',
|
|
18
|
+
shadowSm: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
|
|
19
|
+
shadowXl: '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)'
|
|
20
|
+
},
|
|
21
|
+
spacing: {
|
|
22
|
+
headerFontSize: '0.875rem',
|
|
23
|
+
headerPadding: '0.75rem 1rem',
|
|
24
|
+
inputBorderRadius: '0.5rem',
|
|
25
|
+
inputFontSize: '1rem',
|
|
26
|
+
inputPadding: '0.5rem 0.75rem',
|
|
27
|
+
itemBorderRadius: '0',
|
|
28
|
+
itemMargin: '0',
|
|
29
|
+
itemPadding: '0.75rem 1rem',
|
|
30
|
+
metaFontSize: '0.75rem',
|
|
31
|
+
metaPadding: '0.5rem 0',
|
|
32
|
+
resultsBorderRadius: '0 0 0.5rem 0.5rem',
|
|
33
|
+
resultsMaxHeight: '24rem',
|
|
34
|
+
resultsPadding: '0'
|
|
35
|
+
},
|
|
36
|
+
typography: {
|
|
37
|
+
fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
|
|
38
|
+
fontFamilyMono: 'ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace',
|
|
39
|
+
fontSize2xl: '1.5rem',
|
|
40
|
+
fontSizeBase: '1rem',
|
|
41
|
+
fontSizeLg: '1.125rem',
|
|
42
|
+
fontSizeSm: '0.875rem',
|
|
43
|
+
fontSizeXl: '1.25rem',
|
|
44
|
+
fontSizeXs: '0.75rem',
|
|
45
|
+
fontWeightBold: '700',
|
|
46
|
+
fontWeightMedium: '500',
|
|
47
|
+
fontWeightNormal: '400',
|
|
48
|
+
fontWeightSemibold: '600',
|
|
49
|
+
lineHeightNormal: '1.5',
|
|
50
|
+
lineHeightRelaxed: '1.625',
|
|
51
|
+
lineHeightTight: '1.25'
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
// Modern theme - clean, professional, with subtle shadows
|
|
55
|
+
export const modernTheme = {
|
|
56
|
+
name: 'modern',
|
|
57
|
+
colors: {
|
|
58
|
+
// Input colors
|
|
59
|
+
inputBackground: '#ffffff',
|
|
60
|
+
inputBorder: '#d1d5db',
|
|
61
|
+
inputBorderFocus: '#3b82f6',
|
|
62
|
+
inputPlaceholder: '#6b7280',
|
|
63
|
+
inputText: '#111827',
|
|
64
|
+
// Results container colors
|
|
65
|
+
resultsBackground: '#ffffff',
|
|
66
|
+
resultsBorder: '#d1d5db',
|
|
67
|
+
resultsShadow: '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)',
|
|
68
|
+
// Header colors
|
|
69
|
+
headerBackground: '#f9fafb',
|
|
70
|
+
headerBorder: '#e5e7eb',
|
|
71
|
+
headerText: '#6b7280',
|
|
72
|
+
// Result item colors
|
|
73
|
+
resultBackground: '#ffffff',
|
|
74
|
+
resultBackgroundFocus: '#eff6ff',
|
|
75
|
+
resultBackgroundHover: '#f8fafc',
|
|
76
|
+
resultBorder: '#f3f4f6',
|
|
77
|
+
// Text colors
|
|
78
|
+
descriptionText: '#6b7280',
|
|
79
|
+
highlightBackground: '#fef3c7',
|
|
80
|
+
highlightText: '#92400e',
|
|
81
|
+
metaText: '#9ca3af',
|
|
82
|
+
titleText: '#111827',
|
|
83
|
+
// Interactive elements
|
|
84
|
+
collectionBadge: '#dbeafe',
|
|
85
|
+
collectionBadgeText: '#1e40af',
|
|
86
|
+
scoreBadge: '#dcfce7',
|
|
87
|
+
scoreBadgeText: '#166534',
|
|
88
|
+
// State colors
|
|
89
|
+
errorBackground: '#fef2f2',
|
|
90
|
+
errorText: '#dc2626',
|
|
91
|
+
loadingText: '#6b7280',
|
|
92
|
+
noResultsText: '#6b7280',
|
|
93
|
+
// Facet colors
|
|
94
|
+
facetActiveBackground: '#3b82f6',
|
|
95
|
+
facetActiveText: '#ffffff',
|
|
96
|
+
facetBackground: '#f3f4f6',
|
|
97
|
+
facetBorder: '#d1d5db',
|
|
98
|
+
facetText: '#374151'
|
|
99
|
+
},
|
|
100
|
+
...baseTheme
|
|
101
|
+
};
|
|
102
|
+
// Dark theme - perfect for dark mode applications
|
|
103
|
+
export const darkTheme = {
|
|
104
|
+
name: 'dark',
|
|
105
|
+
colors: {
|
|
106
|
+
// Input colors
|
|
107
|
+
inputBackground: '#1f2937',
|
|
108
|
+
inputBorder: '#374151',
|
|
109
|
+
inputBorderFocus: '#3b82f6',
|
|
110
|
+
inputPlaceholder: '#9ca3af',
|
|
111
|
+
inputText: '#f9fafb',
|
|
112
|
+
// Results container colors
|
|
113
|
+
resultsBackground: '#1f2937',
|
|
114
|
+
resultsBorder: '#374151',
|
|
115
|
+
resultsShadow: '0 25px 50px -12px rgba(0, 0, 0, 0.5)',
|
|
116
|
+
// Header colors
|
|
117
|
+
headerBackground: '#111827',
|
|
118
|
+
headerBorder: '#374151',
|
|
119
|
+
headerText: '#9ca3af',
|
|
120
|
+
// Result item colors
|
|
121
|
+
resultBackground: '#1f2937',
|
|
122
|
+
resultBackgroundFocus: '#1e3a8a',
|
|
123
|
+
resultBackgroundHover: '#111827',
|
|
124
|
+
resultBorder: '#374151',
|
|
125
|
+
// Text colors
|
|
126
|
+
descriptionText: '#d1d5db',
|
|
127
|
+
highlightBackground: '#451a03',
|
|
128
|
+
highlightText: '#fbbf24',
|
|
129
|
+
metaText: '#9ca3af',
|
|
130
|
+
titleText: '#f9fafb',
|
|
131
|
+
// Interactive elements
|
|
132
|
+
collectionBadge: '#1e3a8a',
|
|
133
|
+
collectionBadgeText: '#93c5fd',
|
|
134
|
+
scoreBadge: '#064e3b',
|
|
135
|
+
scoreBadgeText: '#6ee7b7',
|
|
136
|
+
// State colors
|
|
137
|
+
errorBackground: '#7f1d1d',
|
|
138
|
+
errorText: '#fca5a5',
|
|
139
|
+
loadingText: '#9ca3af',
|
|
140
|
+
noResultsText: '#9ca3af',
|
|
141
|
+
// Facet colors
|
|
142
|
+
facetActiveBackground: '#3b82f6',
|
|
143
|
+
facetActiveText: '#ffffff',
|
|
144
|
+
facetBackground: '#374151',
|
|
145
|
+
facetBorder: '#4b5563',
|
|
146
|
+
facetText: '#d1d5db'
|
|
147
|
+
},
|
|
148
|
+
...baseTheme
|
|
149
|
+
};
|
|
150
|
+
// All available themes
|
|
151
|
+
export const themes = {
|
|
152
|
+
dark: darkTheme,
|
|
153
|
+
modern: modernTheme
|
|
154
|
+
};
|
|
155
|
+
// Default theme
|
|
156
|
+
export const defaultTheme = modernTheme;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
export interface ThemeColors {
|
|
2
|
+
collectionBadge: string;
|
|
3
|
+
collectionBadgeText: string;
|
|
4
|
+
descriptionText: string;
|
|
5
|
+
errorBackground: string;
|
|
6
|
+
errorText: string;
|
|
7
|
+
facetActiveBackground: string;
|
|
8
|
+
facetActiveText: string;
|
|
9
|
+
facetBackground: string;
|
|
10
|
+
facetBorder: string;
|
|
11
|
+
facetText: string;
|
|
12
|
+
headerBackground: string;
|
|
13
|
+
headerBorder: string;
|
|
14
|
+
headerText: string;
|
|
15
|
+
highlightBackground: string;
|
|
16
|
+
highlightText: string;
|
|
17
|
+
inputBackground: string;
|
|
18
|
+
inputBorder: string;
|
|
19
|
+
inputBorderFocus: string;
|
|
20
|
+
inputPlaceholder: string;
|
|
21
|
+
inputText: string;
|
|
22
|
+
loadingText: string;
|
|
23
|
+
metaText: string;
|
|
24
|
+
noResultsText: string;
|
|
25
|
+
resultBackground: string;
|
|
26
|
+
resultBackgroundFocus: string;
|
|
27
|
+
resultBackgroundHover: string;
|
|
28
|
+
resultBorder: string;
|
|
29
|
+
resultsBackground: string;
|
|
30
|
+
resultsBorder: string;
|
|
31
|
+
resultsShadow: string;
|
|
32
|
+
scoreBadge: string;
|
|
33
|
+
scoreBadgeText: string;
|
|
34
|
+
titleText: string;
|
|
35
|
+
}
|
|
36
|
+
export interface ThemeSpacing {
|
|
37
|
+
headerFontSize: string;
|
|
38
|
+
headerPadding: string;
|
|
39
|
+
inputBorderRadius: string;
|
|
40
|
+
inputFontSize: string;
|
|
41
|
+
inputPadding: string;
|
|
42
|
+
itemBorderRadius: string;
|
|
43
|
+
itemMargin: string;
|
|
44
|
+
itemPadding: string;
|
|
45
|
+
metaFontSize: string;
|
|
46
|
+
metaPadding: string;
|
|
47
|
+
resultsBorderRadius: string;
|
|
48
|
+
resultsMaxHeight: string;
|
|
49
|
+
resultsPadding: string;
|
|
50
|
+
}
|
|
51
|
+
export interface ThemeTypography {
|
|
52
|
+
fontFamily: string;
|
|
53
|
+
fontFamilyMono: string;
|
|
54
|
+
fontSize2xl: string;
|
|
55
|
+
fontSizeBase: string;
|
|
56
|
+
fontSizeLg: string;
|
|
57
|
+
fontSizeSm: string;
|
|
58
|
+
fontSizeXl: string;
|
|
59
|
+
fontSizeXs: string;
|
|
60
|
+
fontWeightBold: string;
|
|
61
|
+
fontWeightMedium: string;
|
|
62
|
+
fontWeightNormal: string;
|
|
63
|
+
fontWeightSemibold: string;
|
|
64
|
+
lineHeightNormal: string;
|
|
65
|
+
lineHeightRelaxed: string;
|
|
66
|
+
lineHeightTight: string;
|
|
67
|
+
}
|
|
68
|
+
export interface ThemeAnimations {
|
|
69
|
+
animationFast: string;
|
|
70
|
+
animationNormal: string;
|
|
71
|
+
animationSlow: string;
|
|
72
|
+
easeIn: string;
|
|
73
|
+
easeInOut: string;
|
|
74
|
+
easeOut: string;
|
|
75
|
+
transitionFast: string;
|
|
76
|
+
transitionNormal: string;
|
|
77
|
+
transitionSlow: string;
|
|
78
|
+
}
|
|
79
|
+
export interface ThemeShadows {
|
|
80
|
+
focusShadow: string;
|
|
81
|
+
focusShadowColor: string;
|
|
82
|
+
shadowLg: string;
|
|
83
|
+
shadowMd: string;
|
|
84
|
+
shadowSm: string;
|
|
85
|
+
shadowXl: string;
|
|
86
|
+
}
|
|
87
|
+
export interface Theme {
|
|
88
|
+
animations: ThemeAnimations;
|
|
89
|
+
colors: ThemeColors;
|
|
90
|
+
name: string;
|
|
91
|
+
shadows: ThemeShadows;
|
|
92
|
+
spacing: ThemeSpacing;
|
|
93
|
+
typography: ThemeTypography;
|
|
94
|
+
}
|
|
95
|
+
export interface ThemeConfig {
|
|
96
|
+
animations?: Partial<ThemeAnimations>;
|
|
97
|
+
colors?: Partial<ThemeColors>;
|
|
98
|
+
enableAnimations?: boolean;
|
|
99
|
+
enableRoundedCorners?: boolean;
|
|
100
|
+
enableShadows?: boolean;
|
|
101
|
+
mobileOptimized?: boolean;
|
|
102
|
+
responsive?: boolean;
|
|
103
|
+
shadows?: Partial<ThemeShadows>;
|
|
104
|
+
spacing?: Partial<ThemeSpacing>;
|
|
105
|
+
theme: string | Theme;
|
|
106
|
+
typography?: Partial<ThemeTypography>;
|
|
107
|
+
}
|
|
108
|
+
export interface ThemeClasses {
|
|
109
|
+
collectionBadge: string;
|
|
110
|
+
container: string;
|
|
111
|
+
error: string;
|
|
112
|
+
facetContainer: string;
|
|
113
|
+
facetItem: string;
|
|
114
|
+
facetItemActive: string;
|
|
115
|
+
focusable: string;
|
|
116
|
+
hidden: string;
|
|
117
|
+
input: string;
|
|
118
|
+
inputContainer: string;
|
|
119
|
+
inputDisabled: string;
|
|
120
|
+
inputFocus: string;
|
|
121
|
+
loading: string;
|
|
122
|
+
loadingSpinner: string;
|
|
123
|
+
noResults: string;
|
|
124
|
+
resultDescription: string;
|
|
125
|
+
resultHighlight: string;
|
|
126
|
+
resultItem: string;
|
|
127
|
+
resultItemActive: string;
|
|
128
|
+
resultItemFocus: string;
|
|
129
|
+
resultItemHover: string;
|
|
130
|
+
resultMeta: string;
|
|
131
|
+
results: string;
|
|
132
|
+
resultsContainer: string;
|
|
133
|
+
resultsHeader: string;
|
|
134
|
+
resultsList: string;
|
|
135
|
+
resultTitle: string;
|
|
136
|
+
scoreBadge: string;
|
|
137
|
+
visible: string;
|
|
138
|
+
}
|
|
139
|
+
export interface ThemeContextValue {
|
|
140
|
+
applyTheme: (element: string, variant?: string) => string;
|
|
141
|
+
classes: ThemeClasses;
|
|
142
|
+
config: ThemeConfig;
|
|
143
|
+
isDark: boolean;
|
|
144
|
+
isLight: boolean;
|
|
145
|
+
theme: Theme;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/themes/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAE1B,eAAe,EAAE,MAAM,CAAA;IACvB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,eAAe,EAAE,MAAM,CAAA;IACvB,eAAe,EAAE,MAAM,CAAA;IACvB,SAAS,EAAE,MAAM,CAAA;IAEjB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,eAAe,EAAE,MAAM,CAAA;IAEvB,eAAe,EAAE,MAAM,CAAA;IAEvB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IAEjB,gBAAgB,EAAE,MAAM,CAAA;IAExB,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,aAAa,EAAE,MAAM,CAAA;IAGrB,eAAe,EAAE,MAAM,CAAA;IACvB,WAAW,EAAE,MAAM,CAAA;IACnB,gBAAgB,EAAE,MAAM,CAAA;IACxB,gBAAgB,EAAE,MAAM,CAAA;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,YAAY,CAAA;IACrB,MAAM,EAAE,WAAW,CAAA;IACnB,MAAM,EAAE,OAAO,CAAA;IACf,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,KAAK,CAAA;CACb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Theme, ThemeClasses, ThemeConfig } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Get a theme by name or return the default theme
|
|
4
|
+
*/
|
|
5
|
+
export declare function getTheme(themeName: string): Theme;
|
|
6
|
+
/**
|
|
7
|
+
* Merge theme configurations with custom overrides
|
|
8
|
+
*/
|
|
9
|
+
export declare function mergeThemeConfig(config: ThemeConfig): Theme;
|
|
10
|
+
/**
|
|
11
|
+
* Generate CSS classes from theme configuration
|
|
12
|
+
*/
|
|
13
|
+
export declare function generateThemeClasses(theme: Theme, config?: Partial<ThemeConfig>): ThemeClasses;
|
|
14
|
+
/**
|
|
15
|
+
* Apply theme to a CSS class with optional variant
|
|
16
|
+
*/
|
|
17
|
+
export declare function applyTheme(theme: Theme, element: string, variant?: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Check if theme is dark mode
|
|
20
|
+
*/
|
|
21
|
+
export declare function isDarkTheme(theme: Theme): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Check if theme is light mode
|
|
24
|
+
*/
|
|
25
|
+
export declare function isLightTheme(theme: Theme): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Get theme-specific CSS variables
|
|
28
|
+
*/
|
|
29
|
+
export declare function getThemeVariables(theme: Theme): Record<string, string>;
|
|
30
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/themes/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAIlE;;GAEG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,KAAK,CAEjD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,GAAG,KAAK,CA0B3D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,KAAK,EACZ,MAAM,GAAE,OAAO,CAAC,WAAW,CAAM,GAChC,YAAY,CAkWd;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAUlF;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAMjD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAElD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAgCtE"}
|