@flipova/foundation 2.2.1 → 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/CHANGELOG.md +6 -0
- package/components/ui/gluestack-ui-provider/config.ts +69 -2
- package/components/ui/gluestack-ui-provider/index.tsx +42 -8
- package/components/ui/gluestack-ui-provider/index.web.tsx +38 -10
- package/components/ui/gluestack-ui-provider/script.ts +12 -5
- package/components/ui/gluestack-ui-provider/theme-context.ts +36 -1
- package/components/ui/gluestack-ui-provider/useGluestackColors.ts +13 -2
- package/design/canonical.index.txt +15 -1
- package/design/manifest.xml +2 -0
- package/design/schema.xsd +11 -0
- package/design/themes.xml +175 -2
- package/design/tools/sources/.generate/config.py +60 -2
- package/dist/{chunk-RPLDFHEZ.mjs → chunk-B277QSR5.mjs} +94 -9
- package/dist/chunk-B277QSR5.mjs.map +1 -0
- package/dist/{chunk-JVHJUIXV.js → chunk-GD37RFBR.js} +96 -8
- package/dist/chunk-GD37RFBR.js.map +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +303 -291
- package/dist/index.mjs +1 -1
- package/dist/ui/index.d.mts +44 -3
- package/dist/ui/index.d.ts +44 -3
- package/dist/ui/index.js +303 -291
- package/dist/ui/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-JVHJUIXV.js.map +0 -1
- package/dist/chunk-RPLDFHEZ.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -63,10 +63,77 @@ export const colors = {
|
|
|
63
63
|
'--info': '14 165 233',
|
|
64
64
|
'--info-foreground': '255 255 255',
|
|
65
65
|
},
|
|
66
|
+
'spring-light': {
|
|
67
|
+
'--background': '240 253 244',
|
|
68
|
+
'--foreground': '20 83 45',
|
|
69
|
+
'--card': '255 255 255',
|
|
70
|
+
'--card-foreground': '20 83 45',
|
|
71
|
+
'--popover': '255 255 255',
|
|
72
|
+
'--popover-foreground': '20 83 45',
|
|
73
|
+
'--primary': '22 163 74',
|
|
74
|
+
'--primary-foreground': '255 255 255',
|
|
75
|
+
'--secondary': '34 197 94',
|
|
76
|
+
'--secondary-foreground': '255 255 255',
|
|
77
|
+
'--muted': '220 252 231',
|
|
78
|
+
'--muted-foreground': '21 128 61',
|
|
79
|
+
'--accent': '187 247 208',
|
|
80
|
+
'--accent-foreground': '20 83 45',
|
|
81
|
+
'--destructive': '220 38 38',
|
|
82
|
+
'--destructive-foreground': '255 255 255',
|
|
83
|
+
'--border': '187 247 208',
|
|
84
|
+
'--input': '187 247 208',
|
|
85
|
+
'--ring': '74 222 128',
|
|
86
|
+
'--success': '22 163 74',
|
|
87
|
+
'--success-foreground': '255 255 255',
|
|
88
|
+
'--warning': '217 119 6',
|
|
89
|
+
'--warning-foreground': '255 255 255',
|
|
90
|
+
'--error': '220 38 38',
|
|
91
|
+
'--error-foreground': '255 255 255',
|
|
92
|
+
'--info': '2 132 199',
|
|
93
|
+
'--info-foreground': '255 255 255',
|
|
94
|
+
},
|
|
95
|
+
'spring-dark': {
|
|
96
|
+
'--background': '5 46 22',
|
|
97
|
+
'--foreground': '240 253 244',
|
|
98
|
+
'--card': '20 83 45',
|
|
99
|
+
'--card-foreground': '240 253 244',
|
|
100
|
+
'--popover': '20 83 45',
|
|
101
|
+
'--popover-foreground': '240 253 244',
|
|
102
|
+
'--primary': '74 222 128',
|
|
103
|
+
'--primary-foreground': '5 46 22',
|
|
104
|
+
'--secondary': '134 239 172',
|
|
105
|
+
'--secondary-foreground': '5 46 22',
|
|
106
|
+
'--muted': '20 83 45',
|
|
107
|
+
'--muted-foreground': '187 247 208',
|
|
108
|
+
'--accent': '22 101 52',
|
|
109
|
+
'--accent-foreground': '240 253 244',
|
|
110
|
+
'--destructive': '239 68 68',
|
|
111
|
+
'--destructive-foreground': '255 255 255',
|
|
112
|
+
'--border': '22 101 52',
|
|
113
|
+
'--input': '22 101 52',
|
|
114
|
+
'--ring': '134 239 172',
|
|
115
|
+
'--success': '74 222 128',
|
|
116
|
+
'--success-foreground': '5 46 22',
|
|
117
|
+
'--warning': '251 191 36',
|
|
118
|
+
'--warning-foreground': '5 46 22',
|
|
119
|
+
'--error': '248 113 113',
|
|
120
|
+
'--error-foreground': '5 46 22',
|
|
121
|
+
'--info': '56 189 248',
|
|
122
|
+
'--info-foreground': '5 46 22',
|
|
123
|
+
},
|
|
66
124
|
};
|
|
67
125
|
|
|
68
126
|
// Config for nativewind vars() - used by the provider
|
|
69
127
|
export const config = {
|
|
70
|
-
light: vars(colors
|
|
71
|
-
dark: vars(colors
|
|
128
|
+
light: vars(colors['light']),
|
|
129
|
+
dark: vars(colors['dark']),
|
|
130
|
+
'spring-light': vars(colors['spring-light']),
|
|
131
|
+
'spring-dark': vars(colors['spring-dark']),
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
// Theme variants: variant -> mode -> theme id, from the `variant` attribute in
|
|
135
|
+
// design/themes.xml. `default` holds the base light/dark pair.
|
|
136
|
+
export const variants = {
|
|
137
|
+
default: { dark: 'dark', light: 'light' },
|
|
138
|
+
spring: { dark: 'spring-dark', light: 'spring-light' },
|
|
72
139
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
|
-
import { config, colors } from './config';
|
|
2
|
+
import { config, colors, variants } from './config';
|
|
3
3
|
import { View, ViewProps } from 'react-native';
|
|
4
4
|
import { OverlayProvider } from '@gluestack-ui/core/overlay/creator';
|
|
5
5
|
import { ToastProvider } from '@gluestack-ui/core/toast/creator';
|
|
@@ -8,12 +8,21 @@ import {
|
|
|
8
8
|
useGluestackColors as useGluestackColorsHook,
|
|
9
9
|
useCalendarTheme as useCalendarThemeHook,
|
|
10
10
|
} from './useGluestackColors';
|
|
11
|
-
import { ThemeContext } from './theme-context';
|
|
11
|
+
import { ThemeContext, MountedThemeContext, resolveThemeId } from './theme-context';
|
|
12
12
|
|
|
13
|
-
export {
|
|
13
|
+
export {
|
|
14
|
+
ThemeContext,
|
|
15
|
+
MountedThemeContext,
|
|
16
|
+
useMountedColors,
|
|
17
|
+
useMountedTheme,
|
|
18
|
+
resolveThemeId,
|
|
19
|
+
} from './theme-context';
|
|
14
20
|
|
|
15
21
|
export type ModeType = 'light' | 'dark' | 'system';
|
|
16
22
|
|
|
23
|
+
/** A light/dark pair declared in `design/themes.xml` (e.g. `spring`). */
|
|
24
|
+
export type ThemeVariant = keyof typeof variants | (string & {});
|
|
25
|
+
|
|
17
26
|
/**
|
|
18
27
|
* The theme a provider is built from: the same shape `config.ts` generates, so
|
|
19
28
|
* the file an app regenerates from its own registries is accepted as it is.
|
|
@@ -28,6 +37,8 @@ export type GluestackThemeConfig = Record<string, Record<string, string>>;
|
|
|
28
37
|
export interface GluestackTheme {
|
|
29
38
|
colors: GluestackThemeConfig;
|
|
30
39
|
config?: Record<string, unknown>;
|
|
40
|
+
/** variant -> mode -> theme id, generated from the `variant` attribute. */
|
|
41
|
+
variants?: Record<string, Record<string, string>>;
|
|
31
42
|
}
|
|
32
43
|
|
|
33
44
|
// Re-export color hooks
|
|
@@ -37,6 +48,8 @@ export type { GluestackColors } from './useGluestackColors';
|
|
|
37
48
|
|
|
38
49
|
export interface GluestackUIProviderProps {
|
|
39
50
|
mode?: ModeType;
|
|
51
|
+
/** Which light/dark pair to mount (e.g. `spring`). Defaults to `default`. */
|
|
52
|
+
variant?: ThemeVariant;
|
|
40
53
|
children?: React.ReactNode;
|
|
41
54
|
style?: ViewProps['style'];
|
|
42
55
|
}
|
|
@@ -51,8 +64,12 @@ export interface GluestackUIProviderProps {
|
|
|
51
64
|
*/
|
|
52
65
|
export function createGluestackUIProvider(theme: GluestackTheme) {
|
|
53
66
|
const vars = theme.config ?? theme.colors;
|
|
67
|
+
const variantMap = theme.variants;
|
|
68
|
+
const themeIds = Object.keys(vars);
|
|
69
|
+
|
|
54
70
|
return function ThemedProvider({
|
|
55
71
|
mode = 'light',
|
|
72
|
+
variant,
|
|
56
73
|
...props
|
|
57
74
|
}: GluestackUIProviderProps) {
|
|
58
75
|
const { colorScheme, setColorScheme } = useColorScheme();
|
|
@@ -62,22 +79,39 @@ export function createGluestackUIProvider(theme: GluestackTheme) {
|
|
|
62
79
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
63
80
|
}, [mode]);
|
|
64
81
|
|
|
82
|
+
// Nativewind only reports light/dark, so `system` resolves through it while a
|
|
83
|
+
// named mode is taken as-is; either way the VARIANT picks the pair. Falling
|
|
84
|
+
// back to the mode keeps a theme set without variants working untouched.
|
|
85
|
+
const resolvedMode =
|
|
86
|
+
mode === 'system' ? colorScheme ?? 'light' : mode;
|
|
87
|
+
const themeId = resolveThemeId(variantMap, variant, resolvedMode);
|
|
88
|
+
const mountedTheme = React.useMemo(
|
|
89
|
+
() => ({ themeId, themeIds }),
|
|
90
|
+
[themeId, themeIds]
|
|
91
|
+
);
|
|
92
|
+
|
|
65
93
|
return (
|
|
66
94
|
<View
|
|
67
95
|
style={[
|
|
68
|
-
(vars as Record<string, unknown>)[
|
|
96
|
+
(vars as Record<string, unknown>)[themeId] as ViewProps['style'],
|
|
69
97
|
{ flex: 1, height: '100%', width: '100%' },
|
|
70
98
|
props.style,
|
|
71
99
|
]}
|
|
72
100
|
>
|
|
73
101
|
<ThemeContext.Provider value={theme.colors}>
|
|
74
|
-
<
|
|
75
|
-
<
|
|
76
|
-
|
|
102
|
+
<MountedThemeContext.Provider value={mountedTheme}>
|
|
103
|
+
<OverlayProvider>
|
|
104
|
+
<ToastProvider>{props.children}</ToastProvider>
|
|
105
|
+
</OverlayProvider>
|
|
106
|
+
</MountedThemeContext.Provider>
|
|
77
107
|
</ThemeContext.Provider>
|
|
78
108
|
</View>
|
|
79
109
|
);
|
|
80
110
|
};
|
|
81
111
|
}
|
|
82
112
|
|
|
83
|
-
export const GluestackUIProvider = createGluestackUIProvider({
|
|
113
|
+
export const GluestackUIProvider = createGluestackUIProvider({
|
|
114
|
+
colors,
|
|
115
|
+
config,
|
|
116
|
+
variants,
|
|
117
|
+
});
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import React, { useEffect, useLayoutEffect } from 'react';
|
|
3
|
-
import { config } from './config';
|
|
3
|
+
import { config, variants } from './config';
|
|
4
4
|
import { OverlayProvider } from '@gluestack-ui/core/overlay/creator';
|
|
5
5
|
import { ToastProvider } from '@gluestack-ui/core/toast/creator';
|
|
6
6
|
import { setFlushStyles } from '@gluestack-ui/utils/nativewind-utils';
|
|
7
7
|
import { script } from './script';
|
|
8
|
+
import { resolveThemeId } from './theme-context';
|
|
8
9
|
|
|
9
10
|
export type ModeType = 'light' | 'dark' | 'system';
|
|
10
11
|
|
|
12
|
+
/** A light/dark pair declared in `design/themes.xml` (e.g. `spring`). */
|
|
13
|
+
export type ThemeVariant = keyof typeof variants | (string & {});
|
|
14
|
+
|
|
11
15
|
const variableStyleTagId = 'nativewind-style';
|
|
12
16
|
const createStyle = (styleTagId: string) => {
|
|
13
17
|
const style = document.createElement('style');
|
|
@@ -21,40 +25,64 @@ export const useSafeLayoutEffect =
|
|
|
21
25
|
|
|
22
26
|
export function GluestackUIProvider({
|
|
23
27
|
mode = 'light',
|
|
28
|
+
variant,
|
|
24
29
|
...props
|
|
25
30
|
}: {
|
|
26
31
|
mode?: ModeType;
|
|
32
|
+
variant?: ThemeVariant;
|
|
27
33
|
children?: React.ReactNode;
|
|
28
34
|
}) {
|
|
35
|
+
// Every declared theme gets a CSS block. The two default ids keep their historic
|
|
36
|
+
// selectors (:root / .dark) so existing apps and Tailwind's dark: keep working;
|
|
37
|
+
// any OTHER theme (a variant pair such as spring-light/spring-dark) is keyed on
|
|
38
|
+
// [data-theme], which is emitted last so it wins over :root and .dark.
|
|
39
|
+
const themeIds = Object.keys(config);
|
|
40
|
+
const isDefaultId = (id: string) => id === 'light' || id === 'dark';
|
|
29
41
|
let cssVariablesWithMode = ``;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
configKey === 'dark' ? `\n .dark {\n ` : `\n:root {\n`;
|
|
42
|
+
let variantCss = ``;
|
|
43
|
+
themeIds.forEach((configKey) => {
|
|
33
44
|
const cssVariables = Object.keys(
|
|
34
45
|
config[configKey as keyof typeof config]
|
|
35
46
|
).reduce((acc: string, curr: string) => {
|
|
36
47
|
acc += `${curr}:${config[configKey as keyof typeof config][curr]}; `;
|
|
37
48
|
return acc;
|
|
38
49
|
}, '');
|
|
39
|
-
|
|
50
|
+
if (isDefaultId(configKey)) {
|
|
51
|
+
cssVariablesWithMode +=
|
|
52
|
+
configKey === 'dark' ? `\n .dark {\n ` : `\n:root {\n`;
|
|
53
|
+
cssVariablesWithMode += `${cssVariables} \n}`;
|
|
54
|
+
} else {
|
|
55
|
+
variantCss += `\n[data-theme='${configKey}'] {\n${cssVariables} \n}`;
|
|
56
|
+
}
|
|
40
57
|
});
|
|
58
|
+
cssVariablesWithMode += variantCss;
|
|
41
59
|
|
|
42
60
|
setFlushStyles(cssVariablesWithMode);
|
|
43
61
|
|
|
44
62
|
const handleMediaQuery = React.useCallback((e: MediaQueryListEvent) => {
|
|
45
|
-
|
|
46
|
-
|
|
63
|
+
const resolved = e.matches ? 'dark' : 'light';
|
|
64
|
+
script(resolved, resolveThemeId(variants, variant, resolved), resolved);
|
|
65
|
+
}, [variant]);
|
|
66
|
+
|
|
67
|
+
// The script keeps the light/dark class AND the variant class/attribute in step.
|
|
68
|
+
const activeMode = mode === 'system' ? 'light' : mode;
|
|
69
|
+
const themeId = resolveThemeId(variants, variant, activeMode);
|
|
70
|
+
const modeClass = themeId === activeMode ? '' : themeId;
|
|
47
71
|
|
|
48
72
|
useSafeLayoutEffect(() => {
|
|
49
73
|
if (mode !== 'system') {
|
|
50
74
|
const documentElement = document.documentElement;
|
|
51
75
|
if (documentElement) {
|
|
76
|
+
documentElement.setAttribute('data-theme', themeId);
|
|
77
|
+
documentElement.classList.remove('light', 'dark', modeClass);
|
|
52
78
|
documentElement.classList.add(mode);
|
|
53
|
-
|
|
79
|
+
if (modeClass) {
|
|
80
|
+
documentElement.classList.add(modeClass);
|
|
81
|
+
}
|
|
54
82
|
documentElement.style.colorScheme = mode;
|
|
55
83
|
}
|
|
56
84
|
}
|
|
57
|
-
}, [mode]);
|
|
85
|
+
}, [mode, themeId, modeClass]);
|
|
58
86
|
|
|
59
87
|
useSafeLayoutEffect(() => {
|
|
60
88
|
if (mode !== 'system') return;
|
|
@@ -85,7 +113,7 @@ export function GluestackUIProvider({
|
|
|
85
113
|
<script
|
|
86
114
|
suppressHydrationWarning
|
|
87
115
|
dangerouslySetInnerHTML={{
|
|
88
|
-
__html: `(${script.toString()})('${mode}')`,
|
|
116
|
+
__html: `(${script.toString()})('${mode}', '${themeId}', '${modeClass}')`,
|
|
89
117
|
}}
|
|
90
118
|
/>
|
|
91
119
|
<OverlayProvider>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const script = (mode: string) => {
|
|
1
|
+
export const script = (mode: string, themeId: string, modeClass: string) => {
|
|
2
2
|
const documentElement = document.documentElement;
|
|
3
3
|
|
|
4
4
|
function getSystemColorMode() {
|
|
@@ -9,10 +9,17 @@ export const script = (mode: string) => {
|
|
|
9
9
|
|
|
10
10
|
try {
|
|
11
11
|
const isSystem = mode === 'system';
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
const resolved = isSystem ? getSystemColorMode() : mode;
|
|
13
|
+
// `data-theme` carries the variant pair (spring-light, spring-dark, ...);
|
|
14
|
+
// the light/dark CLASS is kept alongside it so Tailwind's dark: variants
|
|
15
|
+
// keep working while a seasonal palette is mounted.
|
|
16
|
+
documentElement.setAttribute('data-theme', themeId);
|
|
17
|
+
documentElement.classList.remove('light', 'dark', modeClass);
|
|
18
|
+
documentElement.classList.add(resolved);
|
|
19
|
+
if (themeId !== resolved) {
|
|
20
|
+
documentElement.classList.add(modeClass);
|
|
21
|
+
}
|
|
22
|
+
documentElement.style.colorScheme = resolved;
|
|
16
23
|
} catch (e) {
|
|
17
24
|
console.error(e);
|
|
18
25
|
}
|
|
@@ -13,4 +13,39 @@ export type ThemeColors = Record<string, Record<string, string>>;
|
|
|
13
13
|
export const ThemeContext = createContext<ThemeColors | null>(null);
|
|
14
14
|
|
|
15
15
|
/** The mounted theme, or null when the package's own provider is not in the tree. */
|
|
16
|
-
export const useMountedColors = (): ThemeColors | null => useContext(ThemeContext);
|
|
16
|
+
export const useMountedColors = (): ThemeColors | null => useContext(ThemeContext);
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Which theme of the mounted set is active.
|
|
20
|
+
*
|
|
21
|
+
* A theme set declares several light/dark pairs (variants: `spring-light` /
|
|
22
|
+
* `spring-dark`, ...). Nativewind only knows `light` and `dark`, so the provider
|
|
23
|
+
* resolves the pair itself and publishes the resulting id here - otherwise a hook
|
|
24
|
+
* reading colours would look up `colors['dark']` and miss the variant entirely.
|
|
25
|
+
*/
|
|
26
|
+
export interface MountedTheme {
|
|
27
|
+
/** The active theme id, e.g. `spring-dark`. */
|
|
28
|
+
themeId: string;
|
|
29
|
+
/** Every id the mounted set declares, so a lookup can fall back safely. */
|
|
30
|
+
themeIds: string[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const MountedThemeContext = createContext<MountedTheme | null>(null);
|
|
34
|
+
|
|
35
|
+
export const useMountedTheme = (): MountedTheme | null => useContext(MountedThemeContext);
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Resolve a (variant, mode) request to a theme id.
|
|
39
|
+
*
|
|
40
|
+
* The generated `variants` table is authoritative, so a theme id never has to
|
|
41
|
+
* follow a naming convention. An unknown variant falls back to the mode itself,
|
|
42
|
+
* which is exactly the pre-variant behaviour (the `light`/`dark` ids).
|
|
43
|
+
*/
|
|
44
|
+
export function resolveThemeId(
|
|
45
|
+
variants: Record<string, Record<string, string>> | undefined,
|
|
46
|
+
variant: string | undefined,
|
|
47
|
+
mode: string
|
|
48
|
+
): string {
|
|
49
|
+
const mapped = variant ? variants?.[variant]?.[mode] : undefined;
|
|
50
|
+
return mapped ?? mode;
|
|
51
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useColorScheme } from 'nativewind';
|
|
2
2
|
import { colors } from './config';
|
|
3
|
-
import { useMountedColors } from './theme-context';
|
|
3
|
+
import { useMountedColors, useMountedTheme } from './theme-context';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Convert CSS variable name to camelCase
|
|
@@ -44,7 +44,18 @@ export function useGluestackColors(): Record<string, string> {
|
|
|
44
44
|
// The mounted theme wins: an app that adopted the registries and built its own
|
|
45
45
|
// provider must read its own colours, not the ones shipped with the package.
|
|
46
46
|
const theme = useMountedColors() ?? colors;
|
|
47
|
-
const
|
|
47
|
+
const mounted = useMountedTheme();
|
|
48
|
+
// The provider resolves the active theme id (a variant pair such as
|
|
49
|
+
// `spring-dark`). Falling back to the raw scheme keeps a tree with no mounted
|
|
50
|
+
// provider working, and an unknown id must not hand `Object.entries` undefined.
|
|
51
|
+
// `theme` is the generated literal object, so index it through a widened view:
|
|
52
|
+
// the active id is only known at runtime.
|
|
53
|
+
const palettes = theme as Record<string, Record<string, string>>;
|
|
54
|
+
const palette =
|
|
55
|
+
palettes[mounted?.themeId ?? ''] ??
|
|
56
|
+
palettes[colorScheme || 'light'] ??
|
|
57
|
+
palettes[mounted?.themeIds[0] ?? ''] ??
|
|
58
|
+
{};
|
|
48
59
|
|
|
49
60
|
// Dynamically convert all CSS variables to camelCase hex colors
|
|
50
61
|
const result: Record<string, string> = {};
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
# entries (register/id) — canonical sort by (register, id)
|
|
6
6
|
themes/dark
|
|
7
7
|
themes/light
|
|
8
|
+
themes/spring-dark
|
|
9
|
+
themes/spring-light
|
|
8
10
|
tokens/breakpoints
|
|
9
11
|
tokens/color
|
|
10
12
|
tokens/duration
|
|
@@ -22,6 +24,7 @@ tokens/zIndex
|
|
|
22
24
|
|
|
23
25
|
## references (resolved, never dangling)
|
|
24
26
|
$ref.tokens.color.black -> #000000
|
|
27
|
+
$ref.tokens.color.error.400 -> #F87171
|
|
25
28
|
$ref.tokens.color.error.500 -> #EF4444
|
|
26
29
|
$ref.tokens.color.error.600 -> #DC2626
|
|
27
30
|
$ref.tokens.color.gray.50 -> #FAFAFA
|
|
@@ -32,6 +35,7 @@ $ref.tokens.color.gray.600 -> #52525B
|
|
|
32
35
|
$ref.tokens.color.gray.700 -> #3F3F46
|
|
33
36
|
$ref.tokens.color.gray.800 -> #27272A
|
|
34
37
|
$ref.tokens.color.gray.900 -> #18181B
|
|
38
|
+
$ref.tokens.color.info.400 -> #38BDF8
|
|
35
39
|
$ref.tokens.color.info.500 -> #0EA5E9
|
|
36
40
|
$ref.tokens.color.info.600 -> #0284C7
|
|
37
41
|
$ref.tokens.color.neutral.900 -> #262626
|
|
@@ -43,11 +47,21 @@ $ref.tokens.color.primary.600 -> #2563EB
|
|
|
43
47
|
$ref.tokens.color.primary.900 -> #1E3A8A
|
|
44
48
|
$ref.tokens.color.secondary.500 -> #64748B
|
|
45
49
|
$ref.tokens.color.secondary.600 -> #475569
|
|
50
|
+
$ref.tokens.color.success.50 -> #F0FDF4
|
|
51
|
+
$ref.tokens.color.success.100 -> #DCFCE7
|
|
52
|
+
$ref.tokens.color.success.200 -> #BBF7D0
|
|
53
|
+
$ref.tokens.color.success.300 -> #86EFAC
|
|
54
|
+
$ref.tokens.color.success.400 -> #4ADE80
|
|
46
55
|
$ref.tokens.color.success.500 -> #22C55E
|
|
47
56
|
$ref.tokens.color.success.600 -> #16A34A
|
|
57
|
+
$ref.tokens.color.success.700 -> #15803D
|
|
58
|
+
$ref.tokens.color.success.800 -> #166534
|
|
59
|
+
$ref.tokens.color.success.900 -> #14532D
|
|
60
|
+
$ref.tokens.color.success.950 -> #052E16
|
|
61
|
+
$ref.tokens.color.warning.400 -> #FBBF24
|
|
48
62
|
$ref.tokens.color.warning.500 -> #F59E0B
|
|
49
63
|
$ref.tokens.color.warning.600 -> #D97706
|
|
50
64
|
$ref.tokens.color.white -> #FFFFFF
|
|
51
65
|
|
|
52
66
|
## sha256
|
|
53
|
-
|
|
67
|
+
b330516c315d00effb781f75e1229580352989b12c7131a1b6265869e3b5a9f1
|
package/design/manifest.xml
CHANGED
package/design/schema.xsd
CHANGED
|
@@ -594,6 +594,17 @@
|
|
|
594
594
|
<xs:documentation>Theme mode (e.g. "light", "dark").</xs:documentation>
|
|
595
595
|
</xs:annotation>
|
|
596
596
|
</xs:attribute>
|
|
597
|
+
<xs:attribute name="variant" type="xs:string" use="optional">
|
|
598
|
+
<xs:annotation>
|
|
599
|
+
<xs:documentation>
|
|
600
|
+
Variant this theme belongs to (e.g. "default", "spring"). A variant is a
|
|
601
|
+
coherent light/dark PAIR, so a themed product can offer several palettes
|
|
602
|
+
("spring-light"/"spring-dark", "autumn-light"/"autumn-dark") that all
|
|
603
|
+
respond to the same light/dark mode. Defaults to "default" when absent,
|
|
604
|
+
which keeps the bare "light"/"dark" ids working unchanged.
|
|
605
|
+
</xs:documentation>
|
|
606
|
+
</xs:annotation>
|
|
607
|
+
</xs:attribute>
|
|
597
608
|
</xs:complexType>
|
|
598
609
|
|
|
599
610
|
<xs:complexType name="RoleMapType">
|
package/design/themes.xml
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
default="light">
|
|
30
30
|
<items>
|
|
31
31
|
<!-- Light Theme -->
|
|
32
|
-
<theme id="light" mode="light">
|
|
32
|
+
<theme id="light" mode="light" variant="default">
|
|
33
33
|
<roleMap>
|
|
34
34
|
<role id="background">
|
|
35
35
|
<ref>$ref.tokens.color.gray.50</ref>
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
</roleMap>
|
|
116
116
|
</theme>
|
|
117
117
|
<!-- Dark Theme -->
|
|
118
|
-
<theme id="dark" mode="dark">
|
|
118
|
+
<theme id="dark" mode="dark" variant="default">
|
|
119
119
|
<roleMap>
|
|
120
120
|
<role id="background">
|
|
121
121
|
<ref>$ref.tokens.color.gray.900</ref>
|
|
@@ -200,5 +200,178 @@
|
|
|
200
200
|
</role>
|
|
201
201
|
</roleMap>
|
|
202
202
|
</theme>
|
|
203
|
+
<!-- Spring variant: a seasonal light/dark PAIR. Same roles, seasonal
|
|
204
|
+
greens, so the app can offer it as a theme and still honour the
|
|
205
|
+
light/dark mode the user picked. -->
|
|
206
|
+
<theme id="spring-light" mode="light" variant="spring">
|
|
207
|
+
<roleMap>
|
|
208
|
+
<role id="background">
|
|
209
|
+
<ref>$ref.tokens.color.success.50</ref>
|
|
210
|
+
</role>
|
|
211
|
+
<role id="foreground">
|
|
212
|
+
<ref>$ref.tokens.color.success.900</ref>
|
|
213
|
+
</role>
|
|
214
|
+
<role id="card">
|
|
215
|
+
<ref>$ref.tokens.color.white</ref>
|
|
216
|
+
</role>
|
|
217
|
+
<role id="card-foreground">
|
|
218
|
+
<ref>$ref.tokens.color.success.900</ref>
|
|
219
|
+
</role>
|
|
220
|
+
<role id="popover">
|
|
221
|
+
<ref>$ref.tokens.color.white</ref>
|
|
222
|
+
</role>
|
|
223
|
+
<role id="popover-foreground">
|
|
224
|
+
<ref>$ref.tokens.color.success.900</ref>
|
|
225
|
+
</role>
|
|
226
|
+
<role id="primary">
|
|
227
|
+
<ref>$ref.tokens.color.success.600</ref>
|
|
228
|
+
</role>
|
|
229
|
+
<role id="primary-foreground">
|
|
230
|
+
<ref>$ref.tokens.color.white</ref>
|
|
231
|
+
</role>
|
|
232
|
+
<role id="secondary">
|
|
233
|
+
<ref>$ref.tokens.color.success.500</ref>
|
|
234
|
+
</role>
|
|
235
|
+
<role id="secondary-foreground">
|
|
236
|
+
<ref>$ref.tokens.color.white</ref>
|
|
237
|
+
</role>
|
|
238
|
+
<role id="muted">
|
|
239
|
+
<ref>$ref.tokens.color.success.100</ref>
|
|
240
|
+
</role>
|
|
241
|
+
<role id="muted-foreground">
|
|
242
|
+
<ref>$ref.tokens.color.success.700</ref>
|
|
243
|
+
</role>
|
|
244
|
+
<role id="accent">
|
|
245
|
+
<ref>$ref.tokens.color.success.200</ref>
|
|
246
|
+
</role>
|
|
247
|
+
<role id="accent-foreground">
|
|
248
|
+
<ref>$ref.tokens.color.success.900</ref>
|
|
249
|
+
</role>
|
|
250
|
+
<role id="destructive">
|
|
251
|
+
<ref>$ref.tokens.color.error.600</ref>
|
|
252
|
+
</role>
|
|
253
|
+
<role id="destructive-foreground">
|
|
254
|
+
<ref>$ref.tokens.color.white</ref>
|
|
255
|
+
</role>
|
|
256
|
+
<role id="border">
|
|
257
|
+
<ref>$ref.tokens.color.success.200</ref>
|
|
258
|
+
</role>
|
|
259
|
+
<role id="input">
|
|
260
|
+
<ref>$ref.tokens.color.success.200</ref>
|
|
261
|
+
</role>
|
|
262
|
+
<role id="ring">
|
|
263
|
+
<ref>$ref.tokens.color.success.400</ref>
|
|
264
|
+
</role>
|
|
265
|
+
<role id="success">
|
|
266
|
+
<ref>$ref.tokens.color.success.600</ref>
|
|
267
|
+
</role>
|
|
268
|
+
<role id="success-foreground">
|
|
269
|
+
<ref>$ref.tokens.color.white</ref>
|
|
270
|
+
</role>
|
|
271
|
+
<role id="warning">
|
|
272
|
+
<ref>$ref.tokens.color.warning.600</ref>
|
|
273
|
+
</role>
|
|
274
|
+
<role id="warning-foreground">
|
|
275
|
+
<ref>$ref.tokens.color.white</ref>
|
|
276
|
+
</role>
|
|
277
|
+
<role id="error">
|
|
278
|
+
<ref>$ref.tokens.color.error.600</ref>
|
|
279
|
+
</role>
|
|
280
|
+
<role id="error-foreground">
|
|
281
|
+
<ref>$ref.tokens.color.white</ref>
|
|
282
|
+
</role>
|
|
283
|
+
<role id="info">
|
|
284
|
+
<ref>$ref.tokens.color.info.600</ref>
|
|
285
|
+
</role>
|
|
286
|
+
<role id="info-foreground">
|
|
287
|
+
<ref>$ref.tokens.color.white</ref>
|
|
288
|
+
</role>
|
|
289
|
+
</roleMap>
|
|
290
|
+
</theme>
|
|
291
|
+
<theme id="spring-dark" mode="dark" variant="spring">
|
|
292
|
+
<roleMap>
|
|
293
|
+
<role id="background">
|
|
294
|
+
<ref>$ref.tokens.color.success.950</ref>
|
|
295
|
+
</role>
|
|
296
|
+
<role id="foreground">
|
|
297
|
+
<ref>$ref.tokens.color.success.50</ref>
|
|
298
|
+
</role>
|
|
299
|
+
<role id="card">
|
|
300
|
+
<ref>$ref.tokens.color.success.900</ref>
|
|
301
|
+
</role>
|
|
302
|
+
<role id="card-foreground">
|
|
303
|
+
<ref>$ref.tokens.color.success.50</ref>
|
|
304
|
+
</role>
|
|
305
|
+
<role id="popover">
|
|
306
|
+
<ref>$ref.tokens.color.success.900</ref>
|
|
307
|
+
</role>
|
|
308
|
+
<role id="popover-foreground">
|
|
309
|
+
<ref>$ref.tokens.color.success.50</ref>
|
|
310
|
+
</role>
|
|
311
|
+
<role id="primary">
|
|
312
|
+
<ref>$ref.tokens.color.success.400</ref>
|
|
313
|
+
</role>
|
|
314
|
+
<role id="primary-foreground">
|
|
315
|
+
<ref>$ref.tokens.color.success.950</ref>
|
|
316
|
+
</role>
|
|
317
|
+
<role id="secondary">
|
|
318
|
+
<ref>$ref.tokens.color.success.300</ref>
|
|
319
|
+
</role>
|
|
320
|
+
<role id="secondary-foreground">
|
|
321
|
+
<ref>$ref.tokens.color.success.950</ref>
|
|
322
|
+
</role>
|
|
323
|
+
<role id="muted">
|
|
324
|
+
<ref>$ref.tokens.color.success.900</ref>
|
|
325
|
+
</role>
|
|
326
|
+
<role id="muted-foreground">
|
|
327
|
+
<ref>$ref.tokens.color.success.200</ref>
|
|
328
|
+
</role>
|
|
329
|
+
<role id="accent">
|
|
330
|
+
<ref>$ref.tokens.color.success.800</ref>
|
|
331
|
+
</role>
|
|
332
|
+
<role id="accent-foreground">
|
|
333
|
+
<ref>$ref.tokens.color.success.50</ref>
|
|
334
|
+
</role>
|
|
335
|
+
<role id="destructive">
|
|
336
|
+
<ref>$ref.tokens.color.error.500</ref>
|
|
337
|
+
</role>
|
|
338
|
+
<role id="destructive-foreground">
|
|
339
|
+
<ref>$ref.tokens.color.white</ref>
|
|
340
|
+
</role>
|
|
341
|
+
<role id="border">
|
|
342
|
+
<ref>$ref.tokens.color.success.800</ref>
|
|
343
|
+
</role>
|
|
344
|
+
<role id="input">
|
|
345
|
+
<ref>$ref.tokens.color.success.800</ref>
|
|
346
|
+
</role>
|
|
347
|
+
<role id="ring">
|
|
348
|
+
<ref>$ref.tokens.color.success.300</ref>
|
|
349
|
+
</role>
|
|
350
|
+
<role id="success">
|
|
351
|
+
<ref>$ref.tokens.color.success.400</ref>
|
|
352
|
+
</role>
|
|
353
|
+
<role id="success-foreground">
|
|
354
|
+
<ref>$ref.tokens.color.success.950</ref>
|
|
355
|
+
</role>
|
|
356
|
+
<role id="warning">
|
|
357
|
+
<ref>$ref.tokens.color.warning.400</ref>
|
|
358
|
+
</role>
|
|
359
|
+
<role id="warning-foreground">
|
|
360
|
+
<ref>$ref.tokens.color.success.950</ref>
|
|
361
|
+
</role>
|
|
362
|
+
<role id="error">
|
|
363
|
+
<ref>$ref.tokens.color.error.400</ref>
|
|
364
|
+
</role>
|
|
365
|
+
<role id="error-foreground">
|
|
366
|
+
<ref>$ref.tokens.color.success.950</ref>
|
|
367
|
+
</role>
|
|
368
|
+
<role id="info">
|
|
369
|
+
<ref>$ref.tokens.color.info.400</ref>
|
|
370
|
+
</role>
|
|
371
|
+
<role id="info-foreground">
|
|
372
|
+
<ref>$ref.tokens.color.success.950</ref>
|
|
373
|
+
</role>
|
|
374
|
+
</roleMap>
|
|
375
|
+
</theme>
|
|
203
376
|
</items>
|
|
204
377
|
</themes>
|