@ufoui/core 0.0.12 → 0.0.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/assets/icons.d.ts +5 -2
  2. package/components/accordion/accordion.d.ts +2 -2
  3. package/components/avatar/avatar.d.ts +2 -2
  4. package/components/badge/badge.d.ts +2 -2
  5. package/components/base/boxBase.d.ts +4 -4
  6. package/components/base/buttonBase.d.ts +5 -5
  7. package/components/base/checkboxBase.d.ts +2 -2
  8. package/components/base/dialogBase.d.ts +105 -9
  9. package/components/base/fieldBase.d.ts +1 -1
  10. package/components/card/card.d.ts +78 -13
  11. package/components/dialogs/dialogActions.d.ts +19 -7
  12. package/components/dialogs/dialogActions.guards.d.ts +15 -0
  13. package/components/dialogs/dialogContent.d.ts +7 -1
  14. package/components/dialogs/dialogHeader.d.ts +60 -0
  15. package/components/dialogs/dialogTitle.d.ts +9 -5
  16. package/components/dialogs/index.d.ts +1 -0
  17. package/components/link/link.d.ts +13 -14
  18. package/components/menu/menu.d.ts +2 -2
  19. package/components/rating/rating.d.ts +2 -2
  20. package/components/switch/switch.d.ts +2 -2
  21. package/components/themeProvider/themeProvider.d.ts +20 -15
  22. package/components/toolbar/toolbar.d.ts +1 -1
  23. package/components/tooltip/tooltip.d.ts +2 -2
  24. package/hooks/index.d.ts +1 -0
  25. package/hooks/useResponsive.d.ts +60 -0
  26. package/hooks/useTheme.d.ts +1 -1
  27. package/index.css +1 -1
  28. package/index.js +3186 -3023
  29. package/internal/icon/icon.d.ts +28 -0
  30. package/internal/index.d.ts +1 -0
  31. package/internal/inlineTooltip/inlineTooltipManager.d.ts +3 -3
  32. package/internal/slots/slot.d.ts +1 -1
  33. package/package.json +1 -1
  34. package/types/breakpoints.d.ts +38 -0
  35. package/types/color.d.ts +299 -0
  36. package/types/dialog.d.ts +37 -0
  37. package/types/fonts.d.ts +53 -0
  38. package/types/index.d.ts +4 -0
  39. package/types/motion.d.ts +2 -2
  40. package/types/theme.d.ts +8 -235
  41. package/utils/applyThemeColors.d.ts +10 -0
  42. package/utils/breakpoints/breakpoint.d.ts +59 -0
  43. package/utils/breakpoints/breakpointStore.d.ts +32 -0
  44. package/utils/breakpoints/index.d.ts +2 -0
  45. package/utils/calculateFloatingPosition.d.ts +3 -3
  46. package/utils/color.d.ts +14 -153
  47. package/utils/colorRegistry.d.ts +37 -0
  48. package/utils/controlStyle.d.ts +8 -8
  49. package/utils/createRipple.d.ts +17 -0
  50. package/utils/flatChildren.d.ts +17 -0
  51. package/utils/fontRegistry.d.ts +29 -0
  52. package/utils/generateMaterialColors.d.ts +9 -12
  53. package/utils/index.d.ts +9 -1
  54. package/utils/mergeOverrides.d.ts +13 -0
  55. package/utils/renderPortal.d.ts +30 -0
  56. package/utils/utils.d.ts +3 -25
  57. package/utils/generateSchemes.d.ts +0 -32
package/types/theme.d.ts CHANGED
@@ -1,211 +1,6 @@
1
- /**
2
- * Defines all color roles used in a single theme color scheme (e.g. light or dark).
3
- *
4
- * Based on the Material Design 3 palette structure with custom extensions
5
- * for semantic and system colors (e.g. info, success, warning).
6
- *
7
- * @remarks
8
- * Provides the canonical source for all `--uui-color-*` tokens in both light and dark modes.
9
- *
10
- * @category Theme
11
- */
12
- export interface ThemeScheme {
13
- /** Primary brand color used for main UI elements. */
14
- primary: string;
15
- /** Foreground color displayed on primary. */
16
- onPrimary: string;
17
- /** Container background for primary content. */
18
- primaryContainer: string;
19
- /** Foreground color on primary container. */
20
- onPrimaryContainer: string;
21
- /** Fixed version of primary for consistent tone. */
22
- primaryFixed: string;
23
- /** Foreground color on primaryFixed. */
24
- onPrimaryFixed: string;
25
- /** Dimmed tone of primaryFixed. */
26
- primaryFixedDim: string;
27
- /** Variant tone for content on primaryFixedDim. */
28
- onPrimaryFixedVariant: string;
29
- /** Secondary color for less prominent accents. */
30
- secondary: string;
31
- /** Foreground color on secondary. */
32
- onSecondary: string;
33
- /** Background container using secondary tone. */
34
- secondaryContainer: string;
35
- /** Foreground color on secondary container. */
36
- onSecondaryContainer: string;
37
- /** Fixed version of secondary tone. */
38
- secondaryFixed: string;
39
- /** Foreground color on secondaryFixed. */
40
- onSecondaryFixed: string;
41
- /** Dimmed version of secondaryFixed. */
42
- secondaryFixedDim: string;
43
- /** Variant tone for content on secondaryFixedDim. */
44
- onSecondaryFixedVariant: string;
45
- /** Tertiary color for decorative or alternative accents. */
46
- tertiary: string;
47
- /** Foreground color on tertiary. */
48
- onTertiary: string;
49
- /** Background container using tertiary tone. */
50
- tertiaryContainer: string;
51
- /** Foreground color on tertiary container. */
52
- onTertiaryContainer: string;
53
- /** Fixed version of tertiary tone. */
54
- tertiaryFixed: string;
55
- /** Foreground color on tertiaryFixed. */
56
- onTertiaryFixed: string;
57
- /** Dimmed version of tertiaryFixed. */
58
- tertiaryFixedDim: string;
59
- /** Variant tone for content on tertiaryFixedDim. */
60
- onTertiaryFixedVariant: string;
61
- /** Warning tone for alerts or cautions. */
62
- warning: string;
63
- /** Foreground color on warning. */
64
- onWarning: string;
65
- /** Container color for warning messages. */
66
- warningContainer: string;
67
- /** Foreground color on warning container. */
68
- onWarningContainer: string;
69
- /** Fixed warning tone. */
70
- warningFixed: string;
71
- /** Foreground color on warningFixed. */
72
- onWarningFixed: string;
73
- /** Dimmed warningFixed variant. */
74
- warningFixedDim: string;
75
- /** Variant foreground color for dimmed warning. */
76
- onWarningFixedVariant: string;
77
- /** Informational tone for neutral messages. */
78
- info: string;
79
- /** Foreground color on info. */
80
- onInfo: string;
81
- /** Container background for info tone. */
82
- infoContainer: string;
83
- /** Foreground color on info container. */
84
- onInfoContainer: string;
85
- /** Fixed tone for info. */
86
- infoFixed: string;
87
- /** Foreground color on infoFixed. */
88
- onInfoFixed: string;
89
- /** Dimmed infoFixed variant. */
90
- infoFixedDim: string;
91
- /** Variant foreground color for dimmed info. */
92
- onInfoFixedVariant: string;
93
- /** Success tone for positive feedback. */
94
- success: string;
95
- /** Foreground color on success. */
96
- onSuccess: string;
97
- /** Container background for success tone. */
98
- successContainer: string;
99
- /** Foreground color on success container. */
100
- onSuccessContainer: string;
101
- /** Fixed success tone. */
102
- successFixed: string;
103
- /** Foreground color on successFixed. */
104
- onSuccessFixed: string;
105
- /** Dimmed successFixed variant. */
106
- successFixedDim: string;
107
- /** Variant foreground color for dimmed success. */
108
- onSuccessFixedVariant: string;
109
- /** Error tone for destructive actions or validation. */
110
- error: string;
111
- /** Foreground color on error. */
112
- onError: string;
113
- /** Container background for error tone. */
114
- errorContainer: string;
115
- /** Foreground color on error container. */
116
- onErrorContainer: string;
117
- /** Fixed error tone. */
118
- errorFixed: string;
119
- /** Foreground color on errorFixed. */
120
- onErrorFixed: string;
121
- /** Dimmed errorFixed variant. */
122
- errorFixedDim: string;
123
- /** Variant foreground color for dimmed error. */
124
- onErrorFixedVariant: string;
125
- /** Border and divider color. */
126
- outline: string;
127
- /** Secondary outline tone. */
128
- outlineVariant: string;
129
- /** Default surface background color. */
130
- surface: string;
131
- /** Foreground color on surface. */
132
- onSurface: string;
133
- /** Variant background tone for surfaces. */
134
- surfaceVariant: string;
135
- /** Foreground color on surfaceVariant. */
136
- onSurfaceVariant: string;
137
- /** UI background color. */
138
- background: string;
139
- /** Foreground color on background. */
140
- onBackground: string;
141
- /** Inverse surface tone (e.g. for bottom navs). */
142
- inverseSurface: string;
143
- /** Foreground color on inverse surface. */
144
- inverseOnSurface: string;
145
- /** Primary accent used on inverse surfaces. */
146
- inversePrimary: string;
147
- /** Color used for shadows and elevation. */
148
- shadow: string;
149
- /** Tint overlay for elevated components. */
150
- surfaceTint: string;
151
- /** Overlay color for modals, drawers, etc. */
152
- scrim: string;
153
- /** Surface tone for highest-level containers. */
154
- surfaceContainerHighest: string;
155
- /** Surface tone for high elevation containers. */
156
- surfaceContainerHigh: string;
157
- /** Base tone for standard surface containers. */
158
- surfaceContainer: string;
159
- /** Surface tone for low elevation containers. */
160
- surfaceContainerLow: string;
161
- /** Surface tone for lowest elevation containers. */
162
- surfaceContainerLowest: string;
163
- /** Brightest surface tone variant. */
164
- surfaceBright: string;
165
- /** Dimmed surface tone variant. */
166
- surfaceDim: string;
167
- /** Pure black color used for contrast or background. */
168
- black: string;
169
- /** Foreground color displayed on black (typically white). */
170
- onBlack: string;
171
- /** Pure white color used for contrast or foreground. */
172
- white: string;
173
- /** Foreground color displayed on white (typically black). */
174
- onWhite: string;
175
- /** Allows for additional custom tokens. */
176
- [key: string]: string;
177
- }
178
- /**
179
- * A partial version of {@link ThemeScheme}, used for theme overrides
180
- * or gradual, progressive theming updates.
181
- *
182
- * @remarks
183
- * Useful when defining incomplete color sets (e.g. custom brand palettes).
184
- *
185
- * @category Theme
186
- */
187
- export type PartialThemeScheme = Partial<ThemeScheme>;
188
- /**
189
- * Collection of named color schemes (e.g. light, dark, high-contrast).
190
- * Used to organize multiple theme modes within a design system.
191
- *
192
- * @category Theme
193
- */
194
- export interface ThemeSchemes {
195
- /** Light mode color scheme. */
196
- light: PartialThemeScheme;
197
- /** Dark mode color scheme. */
198
- dark: PartialThemeScheme;
199
- /** Additional custom schemes such as high-contrast or sepia. */
200
- [key: string]: PartialThemeScheme;
201
- }
202
- /**
203
- * Partial variant of {@link ThemeSchemes}, allowing selective definition
204
- * of available color modes.
205
- *
206
- * @category Theme
207
- */
208
- export type PartialThemeSchemes = Partial<ThemeSchemes>;
1
+ import { ThemeBreakpoints } from './breakpoints';
2
+ import { ThemeFonts } from './fonts';
3
+ import { ThemeColorSchemes } from './color';
209
4
  /**
210
5
  * Defines the overall theme configuration, including
211
6
  * the active mode and all available color schemes.
@@ -216,31 +11,9 @@ export interface Theme {
216
11
  /** Indicates whether dark mode is currently active. */
217
12
  darkMode: boolean;
218
13
  /** Collection of all available color schemes. */
219
- schemes: ThemeSchemes;
14
+ schemes: ThemeColorSchemes;
15
+ /** Responsive breakpoint tokens. */
16
+ breakpoints: ThemeBreakpoints;
17
+ /** Font class map keyed by theme font token name. */
18
+ fonts: ThemeFonts;
220
19
  }
221
- /**
222
- * Core subset of theme colors representing primary semantic intents
223
- * (e.g., primary, error, success).
224
- * Commonly referenced across UI components.
225
- *
226
- * Serves as the base for {@link SemanticColor} and {@link ThemeSchemeKeys}.
227
- *
228
- * @category Theme
229
- */
230
- export declare const ThemeSemanticColorKeys: readonly ["primary", "secondary", "tertiary", "warning", "info", "success", "error"];
231
- /**
232
- * Extended set of semantic theme colors.
233
- * @category Theme
234
- */
235
- export declare const ThemeExtendedColorKeys: readonly ["primary", "secondary", "tertiary", "warning", "info", "success", "error", "primaryContainer", "primaryFixed", "primaryFixedDim", "secondaryContainer", "secondaryFixed", "secondaryFixedDim", "tertiaryContainer", "tertiaryFixed", "tertiaryFixedDim", "warningContainer", "warningFixed", "warningFixedDim", "infoContainer", "infoFixed", "infoFixedDim", "successContainer", "successFixed", "successFixedDim", "errorContainer", "errorFixed", "errorFixedDim", "black", "white"];
236
- /**
237
- * Surface-level theme colors including extended and neutral tones.
238
- * @category Theme
239
- */
240
- export declare const ThemeSurfaceColorKeys: readonly ["primary", "secondary", "tertiary", "warning", "info", "success", "error", "primaryContainer", "primaryFixed", "primaryFixedDim", "secondaryContainer", "secondaryFixed", "secondaryFixedDim", "tertiaryContainer", "tertiaryFixed", "tertiaryFixedDim", "warningContainer", "warningFixed", "warningFixedDim", "infoContainer", "infoFixed", "infoFixedDim", "successContainer", "successFixed", "successFixedDim", "errorContainer", "errorFixed", "errorFixedDim", "black", "white", "outline", "outlineVariant", "surface", "surfaceVariant", "background", "inverseSurface", "inversePrimary", "surfaceContainerHighest", "surfaceContainerHigh", "surfaceContainer", "surfaceContainerLow", "surfaceContainerLowest", "surfaceBright", "surfaceDim"];
241
- /**
242
- * Complete set of color tokens defined in {@link ThemeScheme}.
243
- * Combines all semantic, extended, and surface color roles for full theme coverage.
244
- * @category Theme
245
- */
246
- export declare const ThemeSchemeKeys: readonly ["primary", "secondary", "tertiary", "warning", "info", "success", "error", "primaryContainer", "primaryFixed", "primaryFixedDim", "secondaryContainer", "secondaryFixed", "secondaryFixedDim", "tertiaryContainer", "tertiaryFixed", "tertiaryFixedDim", "warningContainer", "warningFixed", "warningFixedDim", "infoContainer", "infoFixed", "infoFixedDim", "successContainer", "successFixed", "successFixedDim", "errorContainer", "errorFixed", "errorFixedDim", "black", "white", "outline", "outlineVariant", "surface", "surfaceVariant", "background", "inverseSurface", "inversePrimary", "surfaceContainerHighest", "surfaceContainerHigh", "surfaceContainer", "surfaceContainerLow", "surfaceContainerLowest", "surfaceBright", "surfaceDim", "onPrimary", "onPrimaryContainer", "onPrimaryFixed", "onPrimaryFixedVariant", "onSecondary", "onSecondaryContainer", "onSecondaryFixed", "onSecondaryFixedVariant", "onTertiary", "onTertiaryContainer", "onTertiaryFixed", "onTertiaryFixedVariant", "onWarning", "onWarningContainer", "onWarningFixed", "onWarningFixedVariant", "onInfo", "onInfoContainer", "onInfoFixed", "onInfoFixedVariant", "onSuccess", "onSuccessContainer", "onSuccessFixed", "onSuccessFixedVariant", "onError", "onErrorContainer", "onErrorFixed", "onErrorFixedVariant", "onSurface", "onSurfaceVariant", "onBackground", "inverseOnSurface", "inversePrimary", "shadow", "surfaceTint", "scrim"];
@@ -0,0 +1,10 @@
1
+ import { ThemeColorSchemes } from '../types';
2
+ /**
3
+ * Applies resolved theme tokens as CSS custom properties.
4
+ *
5
+ * @param schemes - Fully resolved theme schemes.
6
+ * @returns The same input object for convenient chaining.
7
+ *
8
+ * @category Theme
9
+ */
10
+ export declare function applyThemeColors(schemes: ThemeColorSchemes): ThemeColorSchemes;
@@ -0,0 +1,59 @@
1
+ import { ThemeBreakpoints } from '../../types';
2
+ /**
3
+ * Viewport snapshot used by the breakpoint store.
4
+ *
5
+ * @category Breakpoints
6
+ */
7
+ export type ViewportSnapshot = {
8
+ width: number;
9
+ isPrint: boolean;
10
+ };
11
+ type BreakpointEntry = {
12
+ key: string;
13
+ minWidth: number;
14
+ };
15
+ /**
16
+ * Converts a CSS length value to pixels.
17
+ *
18
+ * Supports `px`, `rem`, and unitless numeric strings.
19
+ *
20
+ * @function
21
+ * @param value CSS length value to convert.
22
+ *
23
+ * @category Breakpoints
24
+ */
25
+ export declare const toPx: (value: string) => number;
26
+ /**
27
+ * Returns the ordered list of theme breakpoints sorted by width.
28
+ *
29
+ * @function
30
+ * @param breakpoints Breakpoint map from the active theme.
31
+ *
32
+ * @category Breakpoints
33
+ */
34
+ export declare const getOrderedBreakpoints: (breakpoints: ThemeBreakpoints) => BreakpointEntry[];
35
+ /**
36
+ * Resolves the active breakpoint key for a viewport width.
37
+ *
38
+ * @function
39
+ * @param breakpoints Ordered breakpoint entries.
40
+ * @param width Current viewport width.
41
+ *
42
+ * @category Breakpoints
43
+ */
44
+ export declare const resolveBreakpoint: (breakpoints: BreakpointEntry[], width: number) => string;
45
+ /**
46
+ * Resolves a responsive value map against the current viewport state.
47
+ *
48
+ * @function
49
+ * @param values Responsive values keyed by breakpoint.
50
+ * @param breakpoints Ordered breakpoint entries.
51
+ * @param snapshot Current viewport snapshot.
52
+ *
53
+ * @category Breakpoints
54
+ */
55
+ export declare const resolveResponsiveValue: <T>(values: {
56
+ base?: T;
57
+ print?: T;
58
+ } & Record<string, T | undefined>, breakpoints: BreakpointEntry[], snapshot: ViewportSnapshot) => T | undefined;
59
+ export {};
@@ -0,0 +1,32 @@
1
+ import { ViewportSnapshot } from './breakpoint';
2
+ /**
3
+ * Subscriber function used by the breakpoint store.
4
+ *
5
+ * @category Hooks
6
+ */
7
+ export type BreakpointStoreSubscriber = () => void;
8
+ /**
9
+ * Shared viewport store used by responsive hooks.
10
+ *
11
+ * @category Hooks
12
+ */
13
+ export declare const breakpointStore: {
14
+ /**
15
+ * Subscribes to viewport state updates.
16
+ *
17
+ * @function
18
+ */
19
+ subscribe(listener: BreakpointStoreSubscriber): () => void;
20
+ /**
21
+ * Returns the current viewport snapshot.
22
+ *
23
+ * @function
24
+ */
25
+ getSnapshot(): ViewportSnapshot;
26
+ /**
27
+ * Returns the server-side fallback snapshot.
28
+ *
29
+ * @function
30
+ */
31
+ getServerSnapshot(): ViewportSnapshot;
32
+ };
@@ -0,0 +1,2 @@
1
+ export * from './breakpoint';
2
+ export * from './breakpointStore';
@@ -1,5 +1,5 @@
1
1
  import { RefObject } from 'react';
2
- import { ElementAlign } from './utils';
2
+ import { ElementPlacement } from './utils';
3
3
  /**
4
4
  * Floating behavior presets used by `calculateFloatingPosition()`.
5
5
  *
@@ -23,7 +23,7 @@ export type ElementFloatingMode = 'tooltip' | 'dropdown' | 'menu' | 'submenu';
23
23
  * @category Utils
24
24
  */
25
25
  export interface CalculateFloatingPositionOptions {
26
- placement?: ElementAlign;
26
+ placement?: ElementPlacement;
27
27
  offset?: number;
28
28
  mode?: ElementFloatingMode;
29
29
  }
@@ -39,7 +39,7 @@ export interface CalculateFloatingPositionOptions {
39
39
  export interface ElementFloatingPosition {
40
40
  x: number;
41
41
  y: number;
42
- placement: ElementAlign;
42
+ placement: ElementPlacement;
43
43
  }
44
44
  /**
45
45
  * Computes the optimal on-screen position for tooltips, dropdowns, menus and submenus.
package/utils/color.d.ts CHANGED
@@ -1,158 +1,19 @@
1
- import { ThemeExtendedColorKeys, ThemeSchemeKeys, ThemeSemanticColorKeys, ThemeSurfaceColorKeys } from '../types';
1
+ import { BaseColor, BorderColor, ExtendedColor, SemanticColor, SurfaceColor, ThemeColor } from '../types';
2
+ export type { CoreSemanticColor, CoreSurfaceColor, CoreThemeColor, CustomColors, SemanticBaseColor, OnColor, SemanticColor, ExtendedColor, OnExtendedColor, SurfaceColor, BaseColor, ThemeColor, BorderColor, } from '../types';
3
+ export declare function getOnColorName(colorName: ThemeColor): ThemeColor | undefined;
2
4
  /**
3
- * Represents a high-level semantic color token (e.g. `primary`, `error`, `success`).
4
- * Derived from {@link ThemeSemanticColorKeys}.
5
- * @category Color
6
- */
7
- export type SemanticColor = (typeof ThemeSemanticColorKeys)[number];
8
- /**
9
- * Represents tokens extending the {@link SemanticColor} set
10
- * with additional container and fixed variants.
11
- * Derived from {@link ThemeExtendedColorKeys}.
12
- * @category Color
13
- */
14
- export type ExtendedColor = (typeof ThemeExtendedColorKeys)[number];
15
- /**
16
- * Represents surface-related color tokens extending {@link ExtendedColor},
17
- * including background, outline, and container surface roles.
18
- * Derived from {@link ThemeSurfaceColorKeys}.
19
- * @category Color
20
- */
21
- export type SurfaceColor = (typeof ThemeSurfaceColorKeys)[number];
22
- /**
23
- * Represents any valid color token defined in the theme,
24
- * including semantic, extended, and surface roles.
25
- * Derived from {@link ThemeSchemeKeys}.
26
- * @category Color
27
- */
28
- export type ThemeColor = (typeof ThemeSchemeKeys)[number];
29
- /**
30
- * Generates utility class names (`uui-*`) for a given **semantic color** and its variants.
31
- *
32
- * @remarks
33
- * Produces `text`, `border`, and `background` class names for a semantic color and its
34
- * derived tokens (`on`, `container`, `fixed`, `fixedDim`, etc.).
35
- * If the provided key is invalid, `'primary'` is used as fallback.
36
- *
37
- * All class names follow the pattern `uui-{type}-{kebab-case-color}`.
5
+ * Returns all color names from the global registry for the selected type.
38
6
  *
39
- * @param color - Semantic color name (e.g. `'primary'`, `'error'`, `'success'`).
40
- * @returns Object with `uui-text-*`, `uui-border-*`, and `uui-bg-*` class names for all variants.
41
- *
42
- * @example
43
- * ```ts
44
- * getSemanticColorClasses('primary');
45
- * // → { textColor: 'uui-text-primary', bgOnColor: 'uui-bg-on-primary', ... }
46
- * ```
47
- * @category Color
48
- */
49
- export declare const getSemanticColorClasses: (color: SemanticColor) => {
50
- textColor: string;
51
- borderColor: string;
52
- bgColor: string;
53
- textOnColor: string;
54
- borderOnColor: string;
55
- bgOnColor: string;
56
- textContainer: string;
57
- borderContainer: string;
58
- bgContainer: string;
59
- textOnContainer: string;
60
- borderOnContainer: string;
61
- bgOnContainer: string;
62
- textFixed: string;
63
- borderFixed: string;
64
- bgFixed: string;
65
- textOnFixed: string;
66
- borderOnFixed: string;
67
- bgOnFixed: string;
68
- textFixedDim: string;
69
- borderFixedDim: string;
70
- bgFixedDim: string;
71
- textOnFixedVariant: string;
72
- borderOnFixedVariant: string;
73
- bgOnFixedVariant: string;
74
- };
75
- /**
76
- * Bidirectional mapping between theme colors and their “on” counterparts.
77
- *
78
- * @remarks
79
- * Provides both directions — e.g. `'surface' → 'onSurface'` and `'onSurface' → 'surface'` —
80
- * for all semantic, extended, and surface tokens defined in {@link ThemeColor}.
81
- * Enables consistent inverse lookups for text/background pairings.
82
- *
83
- *
84
- * @category Color
85
- */
86
- export declare const inverseColorMap: {
87
- readonly surface: "onSurface";
88
- readonly surfaceVariant: "onSurfaceVariant";
89
- readonly surfaceContainerLowest: "onSurface";
90
- readonly surfaceContainerLow: "onSurface";
91
- readonly surfaceContainer: "onSurface";
92
- readonly surfaceContainerHigh: "onSurface";
93
- readonly surfaceContainerHighest: "onSurface";
94
- readonly surfaceDim: "onSurface";
95
- readonly surfaceBright: "onSurface";
96
- readonly background: "onBackground";
97
- readonly inverseSurface: "inverseOnSurface";
98
- readonly primary: "onPrimary";
99
- readonly secondary: "onSecondary";
100
- readonly tertiary: "onTertiary";
101
- readonly warning: "onWarning";
102
- readonly info: "onInfo";
103
- readonly success: "onSuccess";
104
- readonly error: "onError";
105
- readonly primaryContainer: "onPrimaryContainer";
106
- readonly primaryFixed: "onPrimaryFixed";
107
- readonly primaryFixedDim: "onPrimaryFixedVariant";
108
- readonly secondaryContainer: "onSecondaryContainer";
109
- readonly secondaryFixed: "onSecondaryFixed";
110
- readonly secondaryFixedDim: "onSecondaryFixedVariant";
111
- readonly tertiaryContainer: "onTertiaryContainer";
112
- readonly tertiaryFixed: "onTertiaryFixed";
113
- readonly tertiaryFixedDim: "onTertiaryFixedVariant";
114
- readonly warningContainer: "onWarningContainer";
115
- readonly warningFixed: "onWarningFixed";
116
- readonly warningFixedDim: "onWarningFixedVariant";
117
- readonly infoContainer: "onInfoContainer";
118
- readonly infoFixed: "onInfoFixed";
119
- readonly infoFixedDim: "onInfoFixedVariant";
120
- readonly successContainer: "onSuccessContainer";
121
- readonly successFixed: "onSuccessFixed";
122
- readonly successFixedDim: "onSuccessFixedVariant";
123
- readonly errorContainer: "onErrorContainer";
124
- readonly errorFixed: "onErrorFixed";
125
- readonly errorFixedDim: "onErrorFixedVariant";
126
- readonly outline: "surface";
127
- readonly outlineVariant: "inverseSurface";
128
- readonly inversePrimary: "onPrimaryContainer";
129
- readonly black: "white";
130
- readonly white: "black";
131
- readonly onSurface: "surface";
132
- readonly onSurfaceVariant: "surfaceVariant";
133
- readonly onBackground: "background";
134
- readonly inverseOnSurface: "inverseSurface";
135
- readonly onPrimary: "primary";
136
- readonly onSecondary: "secondary";
137
- readonly onTertiary: "tertiary";
138
- readonly onWarning: "warning";
139
- readonly onInfo: "info";
140
- readonly onSuccess: "success";
141
- readonly onError: "error";
142
- readonly onPrimaryContainer: "primaryContainer";
143
- readonly onSecondaryContainer: "secondaryContainer";
144
- readonly onTertiaryContainer: "tertiaryContainer";
145
- readonly onWarningContainer: "warningContainer";
146
- readonly onInfoContainer: "infoContainer";
147
- readonly onSuccessContainer: "successContainer";
148
- readonly onErrorContainer: "errorContainer";
149
- };
150
- /**
151
- * Represents the available border color options.
152
- *
153
- * @category Color
7
+ * @param type - Color type to filter by.
8
+ * @returns List of color names matching the requested type.
9
+ * @category Theme
154
10
  */
155
- export type BorderColor = SurfaceColor;
11
+ export declare function getColorNames(type: 'semantic'): SemanticColor[];
12
+ export declare function getColorNames(type: 'extended'): ExtendedColor[];
13
+ export declare function getColorNames(type: 'surface'): SurfaceColor[];
14
+ export declare function getColorNames(type: 'theme'): ThemeColor[];
15
+ export declare function getColorNames(type: 'base'): BaseColor[];
16
+ export declare function getColorNames(type: 'border'): BorderColor[];
156
17
  /**
157
18
  * Returns basic CSS variable references for a **surface color**.
158
19
  *
@@ -171,7 +32,7 @@ export type BorderColor = SurfaceColor;
171
32
  * ```
172
33
  * @category Color
173
34
  */
174
- export declare const getSurfaceColorVar: (color: SurfaceColor) => {
35
+ export declare const getSurfaceColorVar: (color: BaseColor) => {
175
36
  color: string;
176
37
  onColor: string;
177
38
  };
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Runtime color type used by the generated color registry.
3
+ *
4
+ * @category Theme
5
+ */
6
+ export type ColorType = 'semantic' | 'surface' | 'extended' | 'base' | 'border' | 'theme';
7
+ /**
8
+ * Metadata entry describing how a color name should be used.
9
+ *
10
+ * @category Theme
11
+ */
12
+ export interface ColorRegistryEntry {
13
+ /** Usage type assigned to the color name. */
14
+ type: ColorType;
15
+ /** Paired contrast color name (e.g. `primary` -> `onPrimary`). */
16
+ onColor?: string;
17
+ }
18
+ /**
19
+ * Global color registry keyed by theme color names.
20
+ *
21
+ * @category Theme
22
+ */
23
+ export type ColorRegistry = Record<string, ColorRegistryEntry | undefined>;
24
+ /**
25
+ * Replaces the global color registry.
26
+ *
27
+ * @param registry - New registry produced by theme generation.
28
+ * @category Theme
29
+ */
30
+ export declare function setColorRegistry(registry: ColorRegistry): void;
31
+ /**
32
+ * Returns the current global color registry.
33
+ *
34
+ * @returns The last registry set by theme generation.
35
+ * @category Theme
36
+ */
37
+ export declare function getColorRegistry(): ColorRegistry;
@@ -1,5 +1,5 @@
1
1
  import { default as React } from 'react';
2
- import { SemanticColor, SurfaceColor, ThemeColor } from './color';
2
+ import { BaseColor, SemanticColor, ThemeColor } from './color';
3
3
  /**
4
4
  * Creates a strictly typed style builder for MD3 color tokens.
5
5
  *
@@ -9,49 +9,49 @@ type CSSPropertyKey = Extract<keyof React.CSSProperties, string>;
9
9
  type CSSVar = `--${string}`;
10
10
  export declare function ControlStyle(initial?: React.CSSProperties): {
11
11
  bg: ((color?: ThemeColor) => void) & {
12
- on(color?: SurfaceColor): void;
12
+ on(color?: BaseColor): void;
13
13
  container(color?: SemanticColor): void;
14
14
  onContainer(color?: SemanticColor): void;
15
15
  fixed(color?: SemanticColor): void;
16
16
  fixedDim(color?: SemanticColor): void;
17
17
  };
18
18
  text: ((color?: ThemeColor) => void) & {
19
- on(color?: SurfaceColor): void;
19
+ on(color?: BaseColor): void;
20
20
  container(color?: SemanticColor): void;
21
21
  onContainer(color?: SemanticColor): void;
22
22
  fixed(color?: SemanticColor): void;
23
23
  fixedDim(color?: SemanticColor): void;
24
24
  };
25
25
  border: ((color?: ThemeColor) => void) & {
26
- on(color?: SurfaceColor): void;
26
+ on(color?: BaseColor): void;
27
27
  container(color?: SemanticColor): void;
28
28
  onContainer(color?: SemanticColor): void;
29
29
  fixed(color?: SemanticColor): void;
30
30
  fixedDim(color?: SemanticColor): void;
31
31
  };
32
32
  outline: ((color?: ThemeColor) => void) & {
33
- on(color?: SurfaceColor): void;
33
+ on(color?: BaseColor): void;
34
34
  container(color?: SemanticColor): void;
35
35
  onContainer(color?: SemanticColor): void;
36
36
  fixed(color?: SemanticColor): void;
37
37
  fixedDim(color?: SemanticColor): void;
38
38
  };
39
39
  current: ((color?: ThemeColor) => void) & {
40
- on(color?: SurfaceColor): void;
40
+ on(color?: BaseColor): void;
41
41
  container(color?: SemanticColor): void;
42
42
  onContainer(color?: SemanticColor): void;
43
43
  fixed(color?: SemanticColor): void;
44
44
  fixedDim(color?: SemanticColor): void;
45
45
  };
46
46
  stroke: ((color?: ThemeColor) => void) & {
47
- on(color?: SurfaceColor): void;
47
+ on(color?: BaseColor): void;
48
48
  container(color?: SemanticColor): void;
49
49
  onContainer(color?: SemanticColor): void;
50
50
  fixed(color?: SemanticColor): void;
51
51
  fixedDim(color?: SemanticColor): void;
52
52
  };
53
53
  fill: ((color?: ThemeColor) => void) & {
54
- on(color?: SurfaceColor): void;
54
+ on(color?: BaseColor): void;
55
55
  container(color?: SemanticColor): void;
56
56
  onContainer(color?: SemanticColor): void;
57
57
  fixed(color?: SemanticColor): void;