react-mcu 1.3.2 → 2.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/dist/index.d.ts CHANGED
@@ -38,24 +38,67 @@ type McuConfig = {
38
38
  */
39
39
  customColors?: HexCustomColor[];
40
40
  /**
41
- * Apply contrast adjustment to tonal palette shades when true.
42
- * When true, all tonal palette shades are adjusted based on the contrast level.
43
- * When false (default), contrast adjustments only apply to core Material Design tokens.
41
+ * Prefix for generated CSS custom properties and Figma token css.variable extensions.
42
+ * Scheme tokens use `--{prefix}-sys-color-*`, palette tones use `--{prefix}-ref-palette-*`.
43
+ * Default: "md" (Material Design convention).
44
44
  */
45
- contrastAllColors?: boolean;
46
- /**
47
- * Adapt tonal palette shades for dark mode.
48
- * When true, tonal palette shades automatically invert for dark mode
49
- * (high values become dark, low values become light).
50
- * When false (default), tonal palette values remain constant across light/dark mode.
51
- */
52
- adaptiveShades?: boolean;
45
+ prefix?: string;
53
46
  };
54
47
  declare const schemeNames: readonly ["tonalSpot", "monochrome", "neutral", "vibrant", "expressive", "fidelity", "content"];
55
48
  type SchemeName = (typeof schemeNames)[number];
56
- declare const tokenNames: readonly ["background", "error", "errorContainer", "inverseOnSurface", "inversePrimary", "inverseSurface", "onBackground", "onError", "onErrorContainer", "onPrimary", "onPrimaryContainer", "onPrimaryFixed", "onPrimaryFixedVariant", "onSecondary", "onSecondaryContainer", "onSecondaryFixed", "onSecondaryFixedVariant", "onSurface", "onSurfaceVariant", "onTertiary", "onTertiaryContainer", "onTertiaryFixed", "onTertiaryFixedVariant", "outline", "outlineVariant", "primary", "primaryContainer", "primaryFixed", "primaryFixedDim", "scrim", "secondary", "secondaryContainer", "secondaryFixed", "secondaryFixedDim", "shadow", "surface", "surfaceBright", "surfaceContainer", "surfaceContainerHigh", "surfaceContainerHighest", "surfaceContainerLow", "surfaceContainerLowest", "surfaceDim", "surfaceTint", "surfaceVariant", "tertiary", "tertiaryContainer", "tertiaryFixed", "tertiaryFixedDim"];
57
- type TokenName = (typeof tokenNames)[number];
58
- declare function builder(hexSource: McuConfig["source"], { scheme, contrast, primary, secondary, tertiary, neutral, neutralVariant, error, customColors: hexCustomColors, contrastAllColors, adaptiveShades, }?: Omit<McuConfig, "source">): {
49
+ declare const tokenDescriptions: {
50
+ readonly background: "Default background color for screens and large surfaces.";
51
+ readonly error: "Color for error states, used on elements like error text and icons.";
52
+ readonly errorContainer: "Fill color for error container elements like error banners.";
53
+ readonly inverseOnSurface: "Color for text and icons on inverse surface backgrounds.";
54
+ readonly inversePrimary: "Primary color used on inverse surface, e.g. buttons on snackbars.";
55
+ readonly inverseSurface: "Background for elements that require reverse contrast, such as snackbars.";
56
+ readonly onBackground: "Color for text and icons displayed on the background.";
57
+ readonly onError: "Color for text and icons on error-colored elements.";
58
+ readonly onErrorContainer: "Color for text and icons on error container elements.";
59
+ readonly onPrimary: "Color for text and icons on primary-colored elements like filled buttons.";
60
+ readonly onPrimaryContainer: "Color for text and icons on primary container elements like tonal buttons.";
61
+ readonly onPrimaryFixed: "Color for text and icons on primary fixed elements, constant across themes.";
62
+ readonly onPrimaryFixedVariant: "Lower-emphasis color for text and icons on primary fixed elements.";
63
+ readonly onSecondary: "Color for text and icons on secondary-colored elements.";
64
+ readonly onSecondaryContainer: "Color for text and icons on secondary container elements.";
65
+ readonly onSecondaryFixed: "Color for text and icons on secondary fixed elements, constant across themes.";
66
+ readonly onSecondaryFixedVariant: "Lower-emphasis color for text and icons on secondary fixed elements.";
67
+ readonly onSurface: "High-emphasis color for text and icons on surface backgrounds.";
68
+ readonly onSurfaceVariant: "Medium-emphasis color for text and icons on surface variant backgrounds.";
69
+ readonly onTertiary: "Color for text and icons on tertiary-colored elements.";
70
+ readonly onTertiaryContainer: "Color for text and icons on tertiary container elements.";
71
+ readonly onTertiaryFixed: "Color for text and icons on tertiary fixed elements, constant across themes.";
72
+ readonly onTertiaryFixedVariant: "Lower-emphasis color for text and icons on tertiary fixed elements.";
73
+ readonly outline: "Subtle color for borders and dividers to create visual separation.";
74
+ readonly outlineVariant: "Lower-emphasis border color used for decorative dividers.";
75
+ readonly primary: "Main brand color, used for key components like filled buttons and active states.";
76
+ readonly primaryContainer: "Fill color for large primary elements like cards and tonal buttons.";
77
+ readonly primaryFixed: "Fixed primary color that stays the same in light and dark themes.";
78
+ readonly primaryFixedDim: "Dimmed variant of the fixed primary color for lower emphasis.";
79
+ readonly scrim: "Color overlay for modals and dialogs to obscure background content.";
80
+ readonly secondary: "Accent color for less prominent elements like filter chips and selections.";
81
+ readonly secondaryContainer: "Fill color for secondary container elements like tonal buttons and input fields.";
82
+ readonly secondaryFixed: "Fixed secondary color that stays the same in light and dark themes.";
83
+ readonly secondaryFixedDim: "Dimmed variant of the fixed secondary color for lower emphasis.";
84
+ readonly shadow: "Color for elevation shadows applied to surfaces and components.";
85
+ readonly surface: "Default surface color for cards, sheets, and dialogs.";
86
+ readonly surfaceBright: "Brightest surface variant, used for elevated surfaces in dark themes.";
87
+ readonly surfaceContainer: "Middle-emphasis container color for grouping related content.";
88
+ readonly surfaceContainerHigh: "Higher-emphasis container color for elements like cards.";
89
+ readonly surfaceContainerHighest: "Highest-emphasis container color for text fields and other input areas.";
90
+ readonly surfaceContainerLow: "Lower-emphasis container color for subtle surface groupings.";
91
+ readonly surfaceContainerLowest: "Lowest-emphasis container, typically the lightest surface in light theme.";
92
+ readonly surfaceDim: "Dimmest surface variant, used for recessed areas or dark theme backgrounds.";
93
+ readonly surfaceTint: "Tint color applied to surfaces for subtle primary color elevation overlay.";
94
+ readonly surfaceVariant: "Alternative surface color for differentiated areas like sidebar backgrounds.";
95
+ readonly tertiary: "Third accent color for complementary elements that balance primary and secondary.";
96
+ readonly tertiaryContainer: "Fill color for tertiary container elements like complementary cards.";
97
+ readonly tertiaryFixed: "Fixed tertiary color that stays the same in light and dark themes.";
98
+ readonly tertiaryFixedDim: "Dimmed variant of the fixed tertiary color for lower emphasis.";
99
+ };
100
+ type TokenName = keyof typeof tokenDescriptions;
101
+ declare function builder(hexSource: McuConfig["source"], { scheme, contrast, primary, secondary, tertiary, neutral, neutralVariant, error, customColors: hexCustomColors, prefix, }?: Omit<McuConfig, "source">): {
59
102
  toCss(): string;
60
103
  toJson(): {
61
104
  seed: string;
@@ -71,63 +114,47 @@ declare function builder(hexSource: McuConfig["source"], { scheme, contrast, pri
71
114
  };
72
115
  toFigmaTokens(): {
73
116
  "Light.tokens.json": {
74
- Schemes: Record<string, {
75
- $type: "color";
76
- $value: {
77
- colorSpace: "srgb";
78
- components: number[];
79
- alpha: number;
80
- hex: string;
81
- };
82
- $extensions: {
83
- "com.figma.scopes": string[];
84
- "com.figma.isOverride": boolean;
85
- };
86
- }>;
87
- Palettes: Record<string, Record<string, {
88
- $type: "color";
89
- $value: {
90
- colorSpace: "srgb";
91
- components: number[];
92
- alpha: number;
93
- hex: string;
94
- };
95
- $extensions: {
96
- "com.figma.scopes": string[];
97
- "com.figma.isOverride": boolean;
98
- };
99
- }>>;
117
+ ref: {
118
+ palette: Record<string, Record<string, {
119
+ $type: "color";
120
+ $value: {
121
+ colorSpace: "srgb";
122
+ components: number[];
123
+ alpha: number;
124
+ hex: string;
125
+ };
126
+ $extensions: {
127
+ "com.figma.scopes": string[];
128
+ "com.figma.isOverride": boolean;
129
+ };
130
+ }>>;
131
+ };
132
+ sys: {
133
+ color: Record<string, unknown>;
134
+ };
100
135
  $extensions: {
101
136
  "com.figma.modeName": string;
102
137
  };
103
138
  };
104
139
  "Dark.tokens.json": {
105
- Schemes: Record<string, {
106
- $type: "color";
107
- $value: {
108
- colorSpace: "srgb";
109
- components: number[];
110
- alpha: number;
111
- hex: string;
112
- };
113
- $extensions: {
114
- "com.figma.scopes": string[];
115
- "com.figma.isOverride": boolean;
116
- };
117
- }>;
118
- Palettes: Record<string, Record<string, {
119
- $type: "color";
120
- $value: {
121
- colorSpace: "srgb";
122
- components: number[];
123
- alpha: number;
124
- hex: string;
125
- };
126
- $extensions: {
127
- "com.figma.scopes": string[];
128
- "com.figma.isOverride": boolean;
129
- };
130
- }>>;
140
+ ref: {
141
+ palette: Record<string, Record<string, {
142
+ $type: "color";
143
+ $value: {
144
+ colorSpace: "srgb";
145
+ components: number[];
146
+ alpha: number;
147
+ hex: string;
148
+ };
149
+ $extensions: {
150
+ "com.figma.scopes": string[];
151
+ "com.figma.isOverride": boolean;
152
+ };
153
+ }>>;
154
+ };
155
+ sys: {
156
+ color: Record<string, unknown>;
157
+ };
131
158
  $extensions: {
132
159
  "com.figma.modeName": string;
133
160
  };
@@ -149,7 +176,7 @@ declare function builder(hexSource: McuConfig["source"], { scheme, contrast, pri
149
176
  };
150
177
  };
151
178
 
152
- declare function Mcu({ source, scheme, contrast, primary, secondary, tertiary, neutral, neutralVariant, error, colorMatch, customColors, contrastAllColors, adaptiveShades, children, }: McuConfig & {
179
+ declare function Mcu({ source, scheme, contrast, primary, secondary, tertiary, neutral, neutralVariant, error, colorMatch, customColors, prefix, children, }: McuConfig & {
153
180
  children?: React.ReactNode;
154
181
  }): react_jsx_runtime.JSX.Element;
155
182