material-theme-builder 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +249 -0
- package/dist/cli.js +828 -0
- package/dist/index.d.ts +191 -0
- package/dist/index.js +888 -0
- package/dist/tailwind.css +181 -0
- package/package.json +105 -0
- package/src/tailwind.css +181 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,888 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/lib/builder.ts
|
|
4
|
+
import {
|
|
5
|
+
argbFromHex,
|
|
6
|
+
Blend,
|
|
7
|
+
blueFromArgb,
|
|
8
|
+
DynamicColor,
|
|
9
|
+
DynamicScheme,
|
|
10
|
+
greenFromArgb,
|
|
11
|
+
Hct,
|
|
12
|
+
hexFromArgb,
|
|
13
|
+
MaterialDynamicColors,
|
|
14
|
+
redFromArgb,
|
|
15
|
+
SchemeContent,
|
|
16
|
+
SchemeExpressive,
|
|
17
|
+
SchemeFidelity,
|
|
18
|
+
SchemeMonochrome,
|
|
19
|
+
SchemeNeutral,
|
|
20
|
+
SchemeTonalSpot,
|
|
21
|
+
SchemeVibrant,
|
|
22
|
+
TonalPalette
|
|
23
|
+
} from "@material/material-color-utilities";
|
|
24
|
+
import { kebabCase, startCase, upperFirst } from "lodash-es";
|
|
25
|
+
var schemesMap = {
|
|
26
|
+
tonalSpot: SchemeTonalSpot,
|
|
27
|
+
monochrome: SchemeMonochrome,
|
|
28
|
+
neutral: SchemeNeutral,
|
|
29
|
+
vibrant: SchemeVibrant,
|
|
30
|
+
expressive: SchemeExpressive,
|
|
31
|
+
fidelity: SchemeFidelity,
|
|
32
|
+
content: SchemeContent
|
|
33
|
+
};
|
|
34
|
+
var DEFAULT_SCHEME = "tonalSpot";
|
|
35
|
+
var DEFAULT_CONTRAST = 0;
|
|
36
|
+
var DEFAULT_CUSTOM_COLORS = [];
|
|
37
|
+
var DEFAULT_BLEND = true;
|
|
38
|
+
var DEFAULT_PREFIX = "md";
|
|
39
|
+
var STANDARD_TONES = [
|
|
40
|
+
0,
|
|
41
|
+
4,
|
|
42
|
+
5,
|
|
43
|
+
6,
|
|
44
|
+
10,
|
|
45
|
+
12,
|
|
46
|
+
15,
|
|
47
|
+
17,
|
|
48
|
+
20,
|
|
49
|
+
22,
|
|
50
|
+
24,
|
|
51
|
+
25,
|
|
52
|
+
30,
|
|
53
|
+
35,
|
|
54
|
+
40,
|
|
55
|
+
50,
|
|
56
|
+
60,
|
|
57
|
+
70,
|
|
58
|
+
80,
|
|
59
|
+
87,
|
|
60
|
+
90,
|
|
61
|
+
92,
|
|
62
|
+
94,
|
|
63
|
+
95,
|
|
64
|
+
96,
|
|
65
|
+
98,
|
|
66
|
+
99,
|
|
67
|
+
100
|
|
68
|
+
];
|
|
69
|
+
var MTB_TONES = [
|
|
70
|
+
0,
|
|
71
|
+
5,
|
|
72
|
+
10,
|
|
73
|
+
15,
|
|
74
|
+
20,
|
|
75
|
+
25,
|
|
76
|
+
30,
|
|
77
|
+
35,
|
|
78
|
+
40,
|
|
79
|
+
50,
|
|
80
|
+
60,
|
|
81
|
+
70,
|
|
82
|
+
80,
|
|
83
|
+
90,
|
|
84
|
+
95,
|
|
85
|
+
98,
|
|
86
|
+
99,
|
|
87
|
+
100
|
|
88
|
+
];
|
|
89
|
+
var Variant = {
|
|
90
|
+
MONOCHROME: 0,
|
|
91
|
+
NEUTRAL: 1,
|
|
92
|
+
TONAL_SPOT: 2,
|
|
93
|
+
VIBRANT: 3,
|
|
94
|
+
EXPRESSIVE: 4,
|
|
95
|
+
FIDELITY: 5,
|
|
96
|
+
CONTENT: 6,
|
|
97
|
+
RAINBOW: 7,
|
|
98
|
+
FRUIT_SALAD: 8
|
|
99
|
+
};
|
|
100
|
+
var schemeToVariant = {
|
|
101
|
+
monochrome: Variant.MONOCHROME,
|
|
102
|
+
neutral: Variant.NEUTRAL,
|
|
103
|
+
tonalSpot: Variant.TONAL_SPOT,
|
|
104
|
+
vibrant: Variant.VIBRANT,
|
|
105
|
+
expressive: Variant.EXPRESSIVE,
|
|
106
|
+
fidelity: Variant.FIDELITY,
|
|
107
|
+
content: Variant.CONTENT
|
|
108
|
+
};
|
|
109
|
+
var tokenDescriptions = {
|
|
110
|
+
background: "Default background color for screens and large surfaces.",
|
|
111
|
+
error: "Color for error states, used on elements like error text and icons.",
|
|
112
|
+
errorContainer: "Fill color for error container elements like error banners.",
|
|
113
|
+
inverseOnSurface: "Color for text and icons on inverse surface backgrounds.",
|
|
114
|
+
inversePrimary: "Primary color used on inverse surface, e.g. buttons on snackbars.",
|
|
115
|
+
inverseSurface: "Background for elements that require reverse contrast, such as snackbars.",
|
|
116
|
+
onBackground: "Color for text and icons displayed on the background.",
|
|
117
|
+
onError: "Color for text and icons on error-colored elements.",
|
|
118
|
+
onErrorContainer: "Color for text and icons on error container elements.",
|
|
119
|
+
onPrimary: "Color for text and icons on primary-colored elements like filled buttons.",
|
|
120
|
+
onPrimaryContainer: "Color for text and icons on primary container elements like tonal buttons.",
|
|
121
|
+
onPrimaryFixed: "Color for text and icons on primary fixed elements, constant across themes.",
|
|
122
|
+
onPrimaryFixedVariant: "Lower-emphasis color for text and icons on primary fixed elements.",
|
|
123
|
+
onSecondary: "Color for text and icons on secondary-colored elements.",
|
|
124
|
+
onSecondaryContainer: "Color for text and icons on secondary container elements.",
|
|
125
|
+
onSecondaryFixed: "Color for text and icons on secondary fixed elements, constant across themes.",
|
|
126
|
+
onSecondaryFixedVariant: "Lower-emphasis color for text and icons on secondary fixed elements.",
|
|
127
|
+
onSurface: "High-emphasis color for text and icons on surface backgrounds.",
|
|
128
|
+
onSurfaceVariant: "Medium-emphasis color for text and icons on surface variant backgrounds.",
|
|
129
|
+
onTertiary: "Color for text and icons on tertiary-colored elements.",
|
|
130
|
+
onTertiaryContainer: "Color for text and icons on tertiary container elements.",
|
|
131
|
+
onTertiaryFixed: "Color for text and icons on tertiary fixed elements, constant across themes.",
|
|
132
|
+
onTertiaryFixedVariant: "Lower-emphasis color for text and icons on tertiary fixed elements.",
|
|
133
|
+
outline: "Subtle color for borders and dividers to create visual separation.",
|
|
134
|
+
outlineVariant: "Lower-emphasis border color used for decorative dividers.",
|
|
135
|
+
primary: "Main brand color, used for key components like filled buttons and active states.",
|
|
136
|
+
primaryContainer: "Fill color for large primary elements like cards and tonal buttons.",
|
|
137
|
+
primaryFixed: "Fixed primary color that stays the same in light and dark themes.",
|
|
138
|
+
primaryFixedDim: "Dimmed variant of the fixed primary color for lower emphasis.",
|
|
139
|
+
scrim: "Color overlay for modals and dialogs to obscure background content.",
|
|
140
|
+
secondary: "Accent color for less prominent elements like filter chips and selections.",
|
|
141
|
+
secondaryContainer: "Fill color for secondary container elements like tonal buttons and input fields.",
|
|
142
|
+
secondaryFixed: "Fixed secondary color that stays the same in light and dark themes.",
|
|
143
|
+
secondaryFixedDim: "Dimmed variant of the fixed secondary color for lower emphasis.",
|
|
144
|
+
shadow: "Color for elevation shadows applied to surfaces and components.",
|
|
145
|
+
surface: "Default surface color for cards, sheets, and dialogs.",
|
|
146
|
+
surfaceBright: "Brightest surface variant, used for elevated surfaces in dark themes.",
|
|
147
|
+
surfaceContainer: "Middle-emphasis container color for grouping related content.",
|
|
148
|
+
surfaceContainerHigh: "Higher-emphasis container color for elements like cards.",
|
|
149
|
+
surfaceContainerHighest: "Highest-emphasis container color for text fields and other input areas.",
|
|
150
|
+
surfaceContainerLow: "Lower-emphasis container color for subtle surface groupings.",
|
|
151
|
+
surfaceContainerLowest: "Lowest-emphasis container, typically the lightest surface in light theme.",
|
|
152
|
+
surfaceDim: "Dimmest surface variant, used for recessed areas or dark theme backgrounds.",
|
|
153
|
+
surfaceTint: "Tint color applied to surfaces for subtle primary color elevation overlay.",
|
|
154
|
+
surfaceVariant: "Alternative surface color for differentiated areas like sidebar backgrounds.",
|
|
155
|
+
tertiary: "Third accent color for complementary elements that balance primary and secondary.",
|
|
156
|
+
tertiaryContainer: "Fill color for tertiary container elements like complementary cards.",
|
|
157
|
+
tertiaryFixed: "Fixed tertiary color that stays the same in light and dark themes.",
|
|
158
|
+
tertiaryFixedDim: "Dimmed variant of the fixed tertiary color for lower emphasis."
|
|
159
|
+
};
|
|
160
|
+
var tokenNames = Object.keys(
|
|
161
|
+
tokenDescriptions
|
|
162
|
+
);
|
|
163
|
+
function toRecord(arr, getEntry) {
|
|
164
|
+
return Object.fromEntries(arr.map(getEntry));
|
|
165
|
+
}
|
|
166
|
+
function getPalette(palettes, colorName) {
|
|
167
|
+
const palette = palettes[colorName];
|
|
168
|
+
if (!palette) {
|
|
169
|
+
throw new Error(
|
|
170
|
+
`Custom color palette not found for '${colorName}'. This is likely a bug in the implementation.`
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
return palette;
|
|
174
|
+
}
|
|
175
|
+
function mergeBaseAndCustomColors(scheme, customColors, colorPalettes) {
|
|
176
|
+
const baseVars = toRecord(tokenNames, (tokenName) => {
|
|
177
|
+
const dynamicColor = MaterialDynamicColors[tokenName];
|
|
178
|
+
const argb = dynamicColor.getArgb(scheme);
|
|
179
|
+
return [tokenName, argb];
|
|
180
|
+
});
|
|
181
|
+
const customVars = {};
|
|
182
|
+
customColors.forEach((color) => {
|
|
183
|
+
const colorname = color.name;
|
|
184
|
+
const getPaletteForColor = (s) => getPalette(colorPalettes, colorname);
|
|
185
|
+
const getTone = (baseTone) => (_s) => {
|
|
186
|
+
return baseTone;
|
|
187
|
+
};
|
|
188
|
+
const colorDynamicColor = new DynamicColor(
|
|
189
|
+
colorname,
|
|
190
|
+
getPaletteForColor,
|
|
191
|
+
(s) => getTone(s.isDark ? 80 : 40)(s),
|
|
192
|
+
// Main color: lighter in dark mode, darker in light mode
|
|
193
|
+
true
|
|
194
|
+
// background
|
|
195
|
+
);
|
|
196
|
+
const onColorDynamicColor = new DynamicColor(
|
|
197
|
+
`on${upperFirst(colorname)}`,
|
|
198
|
+
getPaletteForColor,
|
|
199
|
+
(s) => getTone(s.isDark ? 20 : 100)(s),
|
|
200
|
+
// Text on main color: high contrast (dark on light, light on dark)
|
|
201
|
+
false
|
|
202
|
+
);
|
|
203
|
+
const containerDynamicColor = new DynamicColor(
|
|
204
|
+
`${colorname}Container`,
|
|
205
|
+
getPaletteForColor,
|
|
206
|
+
(s) => getTone(s.isDark ? 30 : 90)(s),
|
|
207
|
+
// Container: subtle variant (darker in dark mode, lighter in light mode)
|
|
208
|
+
true
|
|
209
|
+
// background
|
|
210
|
+
);
|
|
211
|
+
const onContainerDynamicColor = new DynamicColor(
|
|
212
|
+
`on${upperFirst(colorname)}Container`,
|
|
213
|
+
getPaletteForColor,
|
|
214
|
+
(s) => getTone(s.isDark ? 90 : 30)(s),
|
|
215
|
+
// Text on container: high contrast against container background
|
|
216
|
+
false
|
|
217
|
+
);
|
|
218
|
+
customVars[colorname] = colorDynamicColor.getArgb(scheme);
|
|
219
|
+
customVars[`on${upperFirst(colorname)}`] = onColorDynamicColor.getArgb(scheme);
|
|
220
|
+
customVars[`${colorname}Container`] = containerDynamicColor.getArgb(scheme);
|
|
221
|
+
customVars[`on${upperFirst(colorname)}Container`] = onContainerDynamicColor.getArgb(scheme);
|
|
222
|
+
});
|
|
223
|
+
return { ...baseVars, ...customVars };
|
|
224
|
+
}
|
|
225
|
+
function createColorPalette(colorDef, baseScheme, effectiveSourceForHarmonization) {
|
|
226
|
+
const colorArgb = argbFromHex(colorDef.hex);
|
|
227
|
+
const harmonizedArgb = colorDef.blend ? Blend.harmonize(colorArgb, effectiveSourceForHarmonization) : colorArgb;
|
|
228
|
+
const hct = Hct.fromInt(harmonizedArgb);
|
|
229
|
+
let targetChroma;
|
|
230
|
+
if (colorDef.core && colorDef.chromaSource) {
|
|
231
|
+
if (colorDef.chromaSource === "neutral") {
|
|
232
|
+
targetChroma = baseScheme.neutralPalette.chroma;
|
|
233
|
+
} else if (colorDef.chromaSource === "neutralVariant") {
|
|
234
|
+
targetChroma = baseScheme.neutralVariantPalette.chroma;
|
|
235
|
+
} else {
|
|
236
|
+
targetChroma = baseScheme.primaryPalette.chroma;
|
|
237
|
+
}
|
|
238
|
+
} else {
|
|
239
|
+
targetChroma = baseScheme.primaryPalette.chroma;
|
|
240
|
+
}
|
|
241
|
+
return TonalPalette.fromHueAndChroma(hct.hue, targetChroma);
|
|
242
|
+
}
|
|
243
|
+
function builder(hexSource, {
|
|
244
|
+
scheme = DEFAULT_SCHEME,
|
|
245
|
+
contrast = DEFAULT_CONTRAST,
|
|
246
|
+
primary,
|
|
247
|
+
secondary,
|
|
248
|
+
tertiary,
|
|
249
|
+
neutral,
|
|
250
|
+
neutralVariant,
|
|
251
|
+
error,
|
|
252
|
+
customColors: hexCustomColors = DEFAULT_CUSTOM_COLORS,
|
|
253
|
+
prefix = DEFAULT_PREFIX
|
|
254
|
+
} = {}) {
|
|
255
|
+
const sourceArgb = argbFromHex(hexSource);
|
|
256
|
+
const sourceHct = Hct.fromInt(sourceArgb);
|
|
257
|
+
const effectiveSource = primary || hexSource;
|
|
258
|
+
const effectiveSourceArgb = argbFromHex(effectiveSource);
|
|
259
|
+
const effectiveSourceForHarmonization = primary ? argbFromHex(primary) : sourceArgb;
|
|
260
|
+
const SchemeClass = schemesMap[scheme];
|
|
261
|
+
const primaryHct = Hct.fromInt(effectiveSourceArgb);
|
|
262
|
+
const baseScheme = new SchemeClass(primaryHct, false, contrast);
|
|
263
|
+
const allColors = [
|
|
264
|
+
// Core colors (hex may be undefined)
|
|
265
|
+
{
|
|
266
|
+
name: "primary",
|
|
267
|
+
hex: primary,
|
|
268
|
+
core: true,
|
|
269
|
+
chromaSource: "primary"
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
name: "secondary",
|
|
273
|
+
hex: secondary,
|
|
274
|
+
core: true,
|
|
275
|
+
chromaSource: "primary"
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
name: "tertiary",
|
|
279
|
+
hex: tertiary,
|
|
280
|
+
core: true,
|
|
281
|
+
chromaSource: "primary"
|
|
282
|
+
},
|
|
283
|
+
{ name: "error", hex: error, core: true, chromaSource: "primary" },
|
|
284
|
+
{
|
|
285
|
+
name: "neutral",
|
|
286
|
+
hex: neutral,
|
|
287
|
+
core: true,
|
|
288
|
+
chromaSource: "neutral"
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
name: "neutralVariant",
|
|
292
|
+
hex: neutralVariant,
|
|
293
|
+
core: true,
|
|
294
|
+
chromaSource: "neutralVariant"
|
|
295
|
+
},
|
|
296
|
+
//
|
|
297
|
+
// Custom colors
|
|
298
|
+
//
|
|
299
|
+
...hexCustomColors.map((c) => ({
|
|
300
|
+
name: c.name,
|
|
301
|
+
hex: c.hex,
|
|
302
|
+
blend: c.blend,
|
|
303
|
+
core: false
|
|
304
|
+
}))
|
|
305
|
+
];
|
|
306
|
+
const definedColors = allColors.filter(
|
|
307
|
+
(c) => c.hex !== void 0
|
|
308
|
+
);
|
|
309
|
+
const colorPalettes = Object.fromEntries(
|
|
310
|
+
definedColors.map((colorDef) => [
|
|
311
|
+
colorDef.name,
|
|
312
|
+
createColorPalette(colorDef, baseScheme, effectiveSourceForHarmonization)
|
|
313
|
+
])
|
|
314
|
+
);
|
|
315
|
+
const variant = schemeToVariant[scheme];
|
|
316
|
+
const schemeConfig = {
|
|
317
|
+
sourceColorArgb: effectiveSourceArgb,
|
|
318
|
+
variant,
|
|
319
|
+
contrastLevel: contrast,
|
|
320
|
+
primaryPalette: colorPalettes["primary"] || baseScheme.primaryPalette,
|
|
321
|
+
secondaryPalette: colorPalettes["secondary"] || baseScheme.secondaryPalette,
|
|
322
|
+
tertiaryPalette: colorPalettes["tertiary"] || baseScheme.tertiaryPalette,
|
|
323
|
+
neutralPalette: colorPalettes["neutral"] || baseScheme.neutralPalette,
|
|
324
|
+
neutralVariantPalette: colorPalettes["neutralVariant"] || baseScheme.neutralVariantPalette
|
|
325
|
+
};
|
|
326
|
+
const lightScheme = new DynamicScheme({ ...schemeConfig, isDark: false });
|
|
327
|
+
const darkScheme = new DynamicScheme({ ...schemeConfig, isDark: true });
|
|
328
|
+
const errorPalette = colorPalettes["error"];
|
|
329
|
+
if (errorPalette) {
|
|
330
|
+
lightScheme.errorPalette = errorPalette;
|
|
331
|
+
darkScheme.errorPalette = errorPalette;
|
|
332
|
+
}
|
|
333
|
+
const allPalettes = {
|
|
334
|
+
primary: lightScheme.primaryPalette,
|
|
335
|
+
secondary: lightScheme.secondaryPalette,
|
|
336
|
+
tertiary: lightScheme.tertiaryPalette,
|
|
337
|
+
error: lightScheme.errorPalette,
|
|
338
|
+
neutral: lightScheme.neutralPalette,
|
|
339
|
+
"neutral-variant": lightScheme.neutralVariantPalette,
|
|
340
|
+
// Add custom color palettes
|
|
341
|
+
...Object.fromEntries(
|
|
342
|
+
definedColors.filter((c) => !c.core).map((colorDef) => [colorDef.name, colorPalettes[colorDef.name]])
|
|
343
|
+
)
|
|
344
|
+
};
|
|
345
|
+
const customColors = definedColors.filter((c) => !c.core).map((c) => ({
|
|
346
|
+
name: c.name,
|
|
347
|
+
blend: c.blend ?? DEFAULT_BLEND,
|
|
348
|
+
value: argbFromHex(c.hex)
|
|
349
|
+
}));
|
|
350
|
+
const mergedColorsLight = mergeBaseAndCustomColors(
|
|
351
|
+
lightScheme,
|
|
352
|
+
customColors,
|
|
353
|
+
colorPalettes
|
|
354
|
+
);
|
|
355
|
+
const mergedColorsDark = mergeBaseAndCustomColors(
|
|
356
|
+
darkScheme,
|
|
357
|
+
customColors,
|
|
358
|
+
colorPalettes
|
|
359
|
+
);
|
|
360
|
+
const schemePalettes = [
|
|
361
|
+
["primary", lightScheme.primaryPalette],
|
|
362
|
+
["secondary", lightScheme.secondaryPalette],
|
|
363
|
+
["tertiary", lightScheme.tertiaryPalette],
|
|
364
|
+
["error", lightScheme.errorPalette],
|
|
365
|
+
["neutral", lightScheme.neutralPalette],
|
|
366
|
+
["neutral-variant", lightScheme.neutralVariantPalette]
|
|
367
|
+
];
|
|
368
|
+
function buildTokenToPaletteMap(schemePalettes2, scheme2) {
|
|
369
|
+
const result = {};
|
|
370
|
+
for (const propName of Object.getOwnPropertyNames(MaterialDynamicColors)) {
|
|
371
|
+
const dc = MaterialDynamicColors[propName];
|
|
372
|
+
if (!(dc instanceof DynamicColor)) continue;
|
|
373
|
+
const palette = dc.palette(scheme2);
|
|
374
|
+
for (const [palName, pal] of schemePalettes2) {
|
|
375
|
+
if (palette === pal) {
|
|
376
|
+
result[propName] = palName;
|
|
377
|
+
break;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
return result;
|
|
382
|
+
}
|
|
383
|
+
const tokenToPalette = buildTokenToPaletteMap(schemePalettes, lightScheme);
|
|
384
|
+
const allPaletteNamesKebab = new Set(Object.keys(allPalettes).map(kebabCase));
|
|
385
|
+
function deriveCustomPaletteName(tokenName) {
|
|
386
|
+
let baseName = tokenName;
|
|
387
|
+
if (/^on[A-Z]/.test(baseName) && baseName.length > 2) {
|
|
388
|
+
baseName = baseName.charAt(2).toLowerCase() + baseName.slice(3);
|
|
389
|
+
}
|
|
390
|
+
if (baseName.endsWith("Container")) {
|
|
391
|
+
baseName = baseName.slice(0, -"Container".length);
|
|
392
|
+
}
|
|
393
|
+
const kebab = kebabCase(baseName);
|
|
394
|
+
return allPaletteNamesKebab.has(kebab) ? kebab : void 0;
|
|
395
|
+
}
|
|
396
|
+
return {
|
|
397
|
+
//
|
|
398
|
+
// ██████ ███████ ███████
|
|
399
|
+
// ██ ██ ██
|
|
400
|
+
// ██ ███████ ███████
|
|
401
|
+
// ██ ██ ██
|
|
402
|
+
// ██████ ███████ ███████
|
|
403
|
+
//
|
|
404
|
+
toCss() {
|
|
405
|
+
function buildRefPaletteLookup() {
|
|
406
|
+
const lookup = {};
|
|
407
|
+
for (const [name, palette] of Object.entries(allPalettes)) {
|
|
408
|
+
const paletteName = kebabCase(name);
|
|
409
|
+
for (const tone of STANDARD_TONES) {
|
|
410
|
+
const hex = hexFromArgb(palette.tone(tone));
|
|
411
|
+
if (!lookup[hex]) lookup[hex] = [];
|
|
412
|
+
lookup[hex].push({ paletteName, tone });
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
return lookup;
|
|
416
|
+
}
|
|
417
|
+
function sysColorVar(colorName, colorValue, lookup) {
|
|
418
|
+
const name = `--${prefix}-sys-color-${kebabCase(colorName)}`;
|
|
419
|
+
const hex = hexFromArgb(colorValue);
|
|
420
|
+
const matches = lookup[hex];
|
|
421
|
+
if (matches && matches.length > 0) {
|
|
422
|
+
const preferred = tokenToPalette[colorName] ?? deriveCustomPaletteName(colorName);
|
|
423
|
+
const match = (preferred ? matches.find((m) => m.paletteName === preferred) : void 0) ?? matches[0];
|
|
424
|
+
return `${name}:var(--${prefix}-ref-palette-${match.paletteName}-${match.tone});`;
|
|
425
|
+
}
|
|
426
|
+
return `${name}:${hex};`;
|
|
427
|
+
}
|
|
428
|
+
function toCssVars(mergedColors, lookup) {
|
|
429
|
+
return Object.entries(mergedColors).map(([name, value]) => sysColorVar(name, value, lookup)).join(" ");
|
|
430
|
+
}
|
|
431
|
+
function refPaletteVar(paletteName, tone, colorValue) {
|
|
432
|
+
const name = `--${prefix}-ref-palette-${paletteName}-${tone}`;
|
|
433
|
+
const value = hexFromArgb(colorValue);
|
|
434
|
+
return `${name}:${value};`;
|
|
435
|
+
}
|
|
436
|
+
function generateTonalPaletteVars(paletteName, palette) {
|
|
437
|
+
return STANDARD_TONES.map((tone) => {
|
|
438
|
+
const color = palette.tone(tone);
|
|
439
|
+
return refPaletteVar(paletteName, tone, color);
|
|
440
|
+
}).join(" ");
|
|
441
|
+
}
|
|
442
|
+
function generateTonalVars() {
|
|
443
|
+
return Object.entries(allPalettes).map(
|
|
444
|
+
([name, palette]) => generateTonalPaletteVars(kebabCase(name), palette)
|
|
445
|
+
).join(" ");
|
|
446
|
+
}
|
|
447
|
+
const refPaletteLookup = buildRefPaletteLookup();
|
|
448
|
+
const lightVars = toCssVars(mergedColorsLight, refPaletteLookup);
|
|
449
|
+
const darkVars = toCssVars(mergedColorsDark, refPaletteLookup);
|
|
450
|
+
const tonalVars = generateTonalVars();
|
|
451
|
+
return `
|
|
452
|
+
:root { ${lightVars} ${tonalVars} }
|
|
453
|
+
.dark { ${darkVars} ${tonalVars} }
|
|
454
|
+
`;
|
|
455
|
+
},
|
|
456
|
+
//
|
|
457
|
+
// ██ ███████ ██████ ███ ██
|
|
458
|
+
// ██ ██ ██ ██ ████ ██
|
|
459
|
+
// ██ ███████ ██ ██ ██ ██ ██
|
|
460
|
+
// ██ ██ ██ ██ ██ ██ ██ ██
|
|
461
|
+
// █████ ███████ ██████ ██ ████
|
|
462
|
+
//
|
|
463
|
+
toJson() {
|
|
464
|
+
const fixtureTokenOrder = [
|
|
465
|
+
"primary",
|
|
466
|
+
"surfaceTint",
|
|
467
|
+
"onPrimary",
|
|
468
|
+
"primaryContainer",
|
|
469
|
+
"onPrimaryContainer",
|
|
470
|
+
"secondary",
|
|
471
|
+
"onSecondary",
|
|
472
|
+
"secondaryContainer",
|
|
473
|
+
"onSecondaryContainer",
|
|
474
|
+
"tertiary",
|
|
475
|
+
"onTertiary",
|
|
476
|
+
"tertiaryContainer",
|
|
477
|
+
"onTertiaryContainer",
|
|
478
|
+
"error",
|
|
479
|
+
"onError",
|
|
480
|
+
"errorContainer",
|
|
481
|
+
"onErrorContainer",
|
|
482
|
+
"background",
|
|
483
|
+
"onBackground",
|
|
484
|
+
"surface",
|
|
485
|
+
"onSurface",
|
|
486
|
+
"surfaceVariant",
|
|
487
|
+
"onSurfaceVariant",
|
|
488
|
+
"outline",
|
|
489
|
+
"outlineVariant",
|
|
490
|
+
"shadow",
|
|
491
|
+
"scrim",
|
|
492
|
+
"inverseSurface",
|
|
493
|
+
"inverseOnSurface",
|
|
494
|
+
"inversePrimary",
|
|
495
|
+
"primaryFixed",
|
|
496
|
+
"onPrimaryFixed",
|
|
497
|
+
"primaryFixedDim",
|
|
498
|
+
"onPrimaryFixedVariant",
|
|
499
|
+
"secondaryFixed",
|
|
500
|
+
"onSecondaryFixed",
|
|
501
|
+
"secondaryFixedDim",
|
|
502
|
+
"onSecondaryFixedVariant",
|
|
503
|
+
"tertiaryFixed",
|
|
504
|
+
"onTertiaryFixed",
|
|
505
|
+
"tertiaryFixedDim",
|
|
506
|
+
"onTertiaryFixedVariant",
|
|
507
|
+
"surfaceDim",
|
|
508
|
+
"surfaceBright",
|
|
509
|
+
"surfaceContainerLowest",
|
|
510
|
+
"surfaceContainerLow",
|
|
511
|
+
"surfaceContainer",
|
|
512
|
+
"surfaceContainerHigh",
|
|
513
|
+
"surfaceContainerHighest"
|
|
514
|
+
];
|
|
515
|
+
const neuHct = neutral ? Hct.fromInt(argbFromHex(neutral)) : sourceHct;
|
|
516
|
+
const nvHct = neutralVariant ? Hct.fromInt(argbFromHex(neutralVariant)) : sourceHct;
|
|
517
|
+
const rawPalettes = {
|
|
518
|
+
primary: TonalPalette.fromInt(effectiveSourceArgb),
|
|
519
|
+
secondary: secondary ? TonalPalette.fromInt(argbFromHex(secondary)) : TonalPalette.fromHueAndChroma(sourceHct.hue, sourceHct.chroma / 3),
|
|
520
|
+
tertiary: tertiary ? TonalPalette.fromInt(argbFromHex(tertiary)) : TonalPalette.fromHueAndChroma(
|
|
521
|
+
(sourceHct.hue + 60) % 360,
|
|
522
|
+
sourceHct.chroma / 2
|
|
523
|
+
),
|
|
524
|
+
neutral: TonalPalette.fromHueAndChroma(
|
|
525
|
+
neuHct.hue,
|
|
526
|
+
Math.min(neuHct.chroma / 12, 4)
|
|
527
|
+
),
|
|
528
|
+
"neutral-variant": TonalPalette.fromHueAndChroma(
|
|
529
|
+
nvHct.hue,
|
|
530
|
+
Math.min(nvHct.chroma / 6, 8)
|
|
531
|
+
)
|
|
532
|
+
};
|
|
533
|
+
function buildJsonSchemes() {
|
|
534
|
+
function extractSchemeColors(scheme2, backgroundScheme) {
|
|
535
|
+
const colors = {};
|
|
536
|
+
for (const tokenName of fixtureTokenOrder) {
|
|
537
|
+
const dynamicColor = MaterialDynamicColors[tokenName];
|
|
538
|
+
const useScheme = backgroundScheme && (tokenName === "background" || tokenName === "onBackground") ? backgroundScheme : scheme2;
|
|
539
|
+
colors[tokenName] = hexFromArgb(
|
|
540
|
+
dynamicColor.getArgb(useScheme)
|
|
541
|
+
).toUpperCase();
|
|
542
|
+
}
|
|
543
|
+
return colors;
|
|
544
|
+
}
|
|
545
|
+
function resolveOverridePalette(hex, role) {
|
|
546
|
+
if (!hex) return null;
|
|
547
|
+
return new SchemeClass(Hct.fromInt(argbFromHex(hex)), false, 0)[role];
|
|
548
|
+
}
|
|
549
|
+
const secPalette = resolveOverridePalette(secondary, "primaryPalette");
|
|
550
|
+
const terPalette = resolveOverridePalette(tertiary, "primaryPalette");
|
|
551
|
+
const errPalette = resolveOverridePalette(error, "primaryPalette");
|
|
552
|
+
const neuPalette = resolveOverridePalette(neutral, "neutralPalette");
|
|
553
|
+
const nvPalette = resolveOverridePalette(
|
|
554
|
+
neutralVariant,
|
|
555
|
+
"neutralVariantPalette"
|
|
556
|
+
);
|
|
557
|
+
const jsonSchemes = {};
|
|
558
|
+
const jsonContrastLevels = [
|
|
559
|
+
{ name: "light", isDark: false, contrast: 0 },
|
|
560
|
+
{ name: "light-medium-contrast", isDark: false, contrast: 0.5 },
|
|
561
|
+
{ name: "light-high-contrast", isDark: false, contrast: 1 },
|
|
562
|
+
{ name: "dark", isDark: true, contrast: 0 },
|
|
563
|
+
{ name: "dark-medium-contrast", isDark: true, contrast: 0.5 },
|
|
564
|
+
{ name: "dark-high-contrast", isDark: true, contrast: 1 }
|
|
565
|
+
];
|
|
566
|
+
for (const { name, isDark, contrast: contrast2 } of jsonContrastLevels) {
|
|
567
|
+
const baseScheme2 = new SchemeClass(primaryHct, isDark, contrast2);
|
|
568
|
+
const composedScheme = new DynamicScheme({
|
|
569
|
+
sourceColorArgb: effectiveSourceArgb,
|
|
570
|
+
variant: schemeToVariant[scheme],
|
|
571
|
+
contrastLevel: contrast2,
|
|
572
|
+
isDark,
|
|
573
|
+
primaryPalette: baseScheme2.primaryPalette,
|
|
574
|
+
secondaryPalette: secPalette || baseScheme2.secondaryPalette,
|
|
575
|
+
tertiaryPalette: terPalette || baseScheme2.tertiaryPalette,
|
|
576
|
+
neutralPalette: neuPalette || baseScheme2.neutralPalette,
|
|
577
|
+
neutralVariantPalette: nvPalette || baseScheme2.neutralVariantPalette
|
|
578
|
+
});
|
|
579
|
+
if (errPalette) composedScheme.errorPalette = errPalette;
|
|
580
|
+
jsonSchemes[name] = extractSchemeColors(composedScheme, baseScheme2);
|
|
581
|
+
}
|
|
582
|
+
return jsonSchemes;
|
|
583
|
+
}
|
|
584
|
+
function rawPalettesToJson() {
|
|
585
|
+
const jsonPalettes = {};
|
|
586
|
+
const RAW_PALETTE_NAMES = [
|
|
587
|
+
"primary",
|
|
588
|
+
"secondary",
|
|
589
|
+
"tertiary",
|
|
590
|
+
"neutral",
|
|
591
|
+
"neutral-variant"
|
|
592
|
+
];
|
|
593
|
+
for (const name of RAW_PALETTE_NAMES) {
|
|
594
|
+
const palette = rawPalettes[name];
|
|
595
|
+
const tones = {};
|
|
596
|
+
for (const tone of MTB_TONES) {
|
|
597
|
+
tones[tone.toString()] = hexFromArgb(
|
|
598
|
+
palette.tone(tone)
|
|
599
|
+
).toUpperCase();
|
|
600
|
+
}
|
|
601
|
+
jsonPalettes[name] = tones;
|
|
602
|
+
}
|
|
603
|
+
return jsonPalettes;
|
|
604
|
+
}
|
|
605
|
+
function buildCoreColors(opts) {
|
|
606
|
+
const colors = { primary: opts.primary };
|
|
607
|
+
if (opts.secondary) colors.secondary = opts.secondary.toUpperCase();
|
|
608
|
+
if (opts.tertiary) colors.tertiary = opts.tertiary.toUpperCase();
|
|
609
|
+
if (opts.error) colors.error = opts.error.toUpperCase();
|
|
610
|
+
if (opts.neutral) colors.neutral = opts.neutral.toUpperCase();
|
|
611
|
+
if (opts.neutralVariant)
|
|
612
|
+
colors.neutralVariant = opts.neutralVariant.toUpperCase();
|
|
613
|
+
return colors;
|
|
614
|
+
}
|
|
615
|
+
const seed = hexSource.toUpperCase();
|
|
616
|
+
const coreColors = buildCoreColors({
|
|
617
|
+
primary: (primary || hexSource).toUpperCase(),
|
|
618
|
+
secondary,
|
|
619
|
+
tertiary,
|
|
620
|
+
error,
|
|
621
|
+
neutral,
|
|
622
|
+
neutralVariant
|
|
623
|
+
});
|
|
624
|
+
const extendedColors = hexCustomColors.map((c) => ({
|
|
625
|
+
name: c.name,
|
|
626
|
+
color: c.hex.toUpperCase(),
|
|
627
|
+
description: "",
|
|
628
|
+
harmonized: c.blend ?? DEFAULT_BLEND
|
|
629
|
+
}));
|
|
630
|
+
return {
|
|
631
|
+
seed,
|
|
632
|
+
coreColors,
|
|
633
|
+
extendedColors,
|
|
634
|
+
schemes: buildJsonSchemes(),
|
|
635
|
+
palettes: rawPalettesToJson()
|
|
636
|
+
};
|
|
637
|
+
},
|
|
638
|
+
//
|
|
639
|
+
// ███████ ██ ██████ ███ ███ █████
|
|
640
|
+
// ██ ██ ██ ████ ████ ██ ██
|
|
641
|
+
// █████ ██ ██ ███ ██ ████ ██ ███████
|
|
642
|
+
// ██ ██ ██ ██ ██ ██ ██ ██ ██
|
|
643
|
+
// ██ ██ ██████ ██ ██ ██ ██
|
|
644
|
+
//
|
|
645
|
+
toFigmaTokens() {
|
|
646
|
+
function argbToFigmaColorValue(argb) {
|
|
647
|
+
return {
|
|
648
|
+
colorSpace: "srgb",
|
|
649
|
+
components: [
|
|
650
|
+
redFromArgb(argb) / 255,
|
|
651
|
+
greenFromArgb(argb) / 255,
|
|
652
|
+
blueFromArgb(argb) / 255
|
|
653
|
+
],
|
|
654
|
+
alpha: 1,
|
|
655
|
+
hex: hexFromArgb(argb).toUpperCase()
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
function figmaToken(argb) {
|
|
659
|
+
return {
|
|
660
|
+
$type: "color",
|
|
661
|
+
$value: argbToFigmaColorValue(argb),
|
|
662
|
+
$extensions: {
|
|
663
|
+
"com.figma.scopes": ["ALL_SCOPES"],
|
|
664
|
+
"com.figma.isOverride": true
|
|
665
|
+
}
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
function buildRefPaletteTokens() {
|
|
669
|
+
const palettes = {};
|
|
670
|
+
for (const [name, palette] of Object.entries(allPalettes)) {
|
|
671
|
+
const tones = {};
|
|
672
|
+
for (const tone of STANDARD_TONES) {
|
|
673
|
+
const argb = palette.tone(tone);
|
|
674
|
+
tones[tone.toString()] = figmaToken(argb);
|
|
675
|
+
}
|
|
676
|
+
palettes[startCase(name)] = tones;
|
|
677
|
+
}
|
|
678
|
+
return palettes;
|
|
679
|
+
}
|
|
680
|
+
function findToneInPalette(hex, paletteName, tones) {
|
|
681
|
+
for (const [tone, token] of Object.entries(tones)) {
|
|
682
|
+
if (token.$value.hex === hex) {
|
|
683
|
+
return `{ref.palette.${paletteName}.${tone}}`;
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
return null;
|
|
687
|
+
}
|
|
688
|
+
function findAlias(hex, tokenName, refPalettes2) {
|
|
689
|
+
const preferredPaletteKebab = tokenToPalette[tokenName] ?? deriveCustomPaletteName(tokenName);
|
|
690
|
+
const preferredPalette = preferredPaletteKebab ? startCase(preferredPaletteKebab) : void 0;
|
|
691
|
+
if (preferredPalette && refPalettes2[preferredPalette]) {
|
|
692
|
+
const match = findToneInPalette(
|
|
693
|
+
hex,
|
|
694
|
+
preferredPalette,
|
|
695
|
+
refPalettes2[preferredPalette]
|
|
696
|
+
);
|
|
697
|
+
if (match) return match;
|
|
698
|
+
}
|
|
699
|
+
for (const [palName, tones] of Object.entries(refPalettes2)) {
|
|
700
|
+
const match = findToneInPalette(hex, palName, tones);
|
|
701
|
+
if (match) return match;
|
|
702
|
+
}
|
|
703
|
+
return null;
|
|
704
|
+
}
|
|
705
|
+
function resolveModeValue(argb, tokenName, refPalettes2) {
|
|
706
|
+
const hex = hexFromArgb(argb).toUpperCase();
|
|
707
|
+
return findAlias(hex, tokenName, refPalettes2) ?? argbToFigmaColorValue(argb);
|
|
708
|
+
}
|
|
709
|
+
function buildSysColorTokens(mergedColors, refPalettes2) {
|
|
710
|
+
const tokens = {};
|
|
711
|
+
for (const [name, argb] of Object.entries(mergedColors)) {
|
|
712
|
+
const description = tokenDescriptions[name];
|
|
713
|
+
const cssVar = `--${prefix}-sys-color-${kebabCase(name)}`;
|
|
714
|
+
const value = resolveModeValue(argb, name, refPalettes2);
|
|
715
|
+
tokens[startCase(name)] = {
|
|
716
|
+
$type: "color",
|
|
717
|
+
$value: value,
|
|
718
|
+
...description ? { $description: description } : {},
|
|
719
|
+
$extensions: {
|
|
720
|
+
"com.figma.scopes": ["ALL_SCOPES"],
|
|
721
|
+
"css.variable": cssVar
|
|
722
|
+
}
|
|
723
|
+
};
|
|
724
|
+
}
|
|
725
|
+
return tokens;
|
|
726
|
+
}
|
|
727
|
+
const refPalettes = buildRefPaletteTokens();
|
|
728
|
+
function buildModeFile(modeName, mergedColors) {
|
|
729
|
+
return {
|
|
730
|
+
ref: {
|
|
731
|
+
palette: refPalettes
|
|
732
|
+
},
|
|
733
|
+
sys: {
|
|
734
|
+
color: buildSysColorTokens(mergedColors, refPalettes)
|
|
735
|
+
},
|
|
736
|
+
$extensions: {
|
|
737
|
+
"com.figma.modeName": modeName
|
|
738
|
+
}
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
return {
|
|
742
|
+
"Light.tokens.json": buildModeFile("Light", mergedColorsLight),
|
|
743
|
+
"Dark.tokens.json": buildModeFile("Dark", mergedColorsDark)
|
|
744
|
+
};
|
|
745
|
+
},
|
|
746
|
+
//
|
|
747
|
+
// API
|
|
748
|
+
//
|
|
749
|
+
mergedColorsLight,
|
|
750
|
+
mergedColorsDark,
|
|
751
|
+
allPalettes
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
// src/Mcu.tsx
|
|
756
|
+
import { useMemo as useMemo2 } from "react";
|
|
757
|
+
|
|
758
|
+
// src/Mcu.context.tsx
|
|
759
|
+
import {
|
|
760
|
+
hexFromArgb as hexFromArgb2
|
|
761
|
+
} from "@material/material-color-utilities";
|
|
762
|
+
import React, {
|
|
763
|
+
useCallback,
|
|
764
|
+
useInsertionEffect,
|
|
765
|
+
useMemo,
|
|
766
|
+
useState
|
|
767
|
+
} from "react";
|
|
768
|
+
|
|
769
|
+
// src/lib/createRequiredContext.ts
|
|
770
|
+
import { createContext, useContext } from "react";
|
|
771
|
+
var createRequiredContext = () => {
|
|
772
|
+
const Ctx = createContext(null);
|
|
773
|
+
const useCtx = () => {
|
|
774
|
+
const contextValue = useContext(Ctx);
|
|
775
|
+
if (contextValue === null) {
|
|
776
|
+
throw new Error("Context value is null");
|
|
777
|
+
}
|
|
778
|
+
return contextValue;
|
|
779
|
+
};
|
|
780
|
+
return [useCtx, Ctx.Provider, Ctx];
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
// src/Mcu.context.tsx
|
|
784
|
+
import { jsx } from "react/jsx-runtime";
|
|
785
|
+
var [useMcu, Provider, McuContext] = createRequiredContext();
|
|
786
|
+
var McuProvider = ({
|
|
787
|
+
styleId,
|
|
788
|
+
children,
|
|
789
|
+
...configProps
|
|
790
|
+
}) => {
|
|
791
|
+
const [initials] = useState(() => configProps);
|
|
792
|
+
const [mcuConfig, setMcuConfig] = useState(initials);
|
|
793
|
+
const configKey = JSON.stringify(configProps);
|
|
794
|
+
React.useEffect(() => {
|
|
795
|
+
setMcuConfig(configProps);
|
|
796
|
+
}, [configKey]);
|
|
797
|
+
const { css, mergedColorsLight, mergedColorsDark, allPalettes } = useMemo(() => {
|
|
798
|
+
const { toCss, ...rest } = builder(mcuConfig.source, mcuConfig);
|
|
799
|
+
return { css: toCss(), ...rest };
|
|
800
|
+
}, [mcuConfig]);
|
|
801
|
+
useInsertionEffect(() => {
|
|
802
|
+
let tag = document.getElementById(styleId);
|
|
803
|
+
if (!tag) {
|
|
804
|
+
tag = document.createElement("style");
|
|
805
|
+
tag.id = styleId;
|
|
806
|
+
document.head.appendChild(tag);
|
|
807
|
+
}
|
|
808
|
+
tag.textContent = css;
|
|
809
|
+
}, [css, styleId]);
|
|
810
|
+
const getMcuColor = useCallback(
|
|
811
|
+
(colorName, theme) => {
|
|
812
|
+
const mergedColors = theme === "light" ? mergedColorsLight : mergedColorsDark;
|
|
813
|
+
const colorValue = mergedColors[colorName];
|
|
814
|
+
if (colorValue === void 0) {
|
|
815
|
+
throw new Error(`Unknown MCU token '${colorName}'`);
|
|
816
|
+
}
|
|
817
|
+
return hexFromArgb2(colorValue);
|
|
818
|
+
},
|
|
819
|
+
[mergedColorsDark, mergedColorsLight]
|
|
820
|
+
);
|
|
821
|
+
const value = useMemo(
|
|
822
|
+
() => ({
|
|
823
|
+
initials,
|
|
824
|
+
setMcuConfig,
|
|
825
|
+
getMcuColor,
|
|
826
|
+
allPalettes
|
|
827
|
+
}),
|
|
828
|
+
[getMcuColor, initials, allPalettes]
|
|
829
|
+
);
|
|
830
|
+
return /* @__PURE__ */ jsx(Provider, { value, children });
|
|
831
|
+
};
|
|
832
|
+
|
|
833
|
+
// src/Mcu.tsx
|
|
834
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
835
|
+
var mcuStyleId = "mcu-styles";
|
|
836
|
+
var DEFAULT_COLOR_MATCH = false;
|
|
837
|
+
function Mcu({
|
|
838
|
+
source,
|
|
839
|
+
scheme = DEFAULT_SCHEME,
|
|
840
|
+
contrast = DEFAULT_CONTRAST,
|
|
841
|
+
primary,
|
|
842
|
+
secondary,
|
|
843
|
+
tertiary,
|
|
844
|
+
neutral,
|
|
845
|
+
neutralVariant,
|
|
846
|
+
error,
|
|
847
|
+
colorMatch = DEFAULT_COLOR_MATCH,
|
|
848
|
+
customColors = DEFAULT_CUSTOM_COLORS,
|
|
849
|
+
prefix = DEFAULT_PREFIX,
|
|
850
|
+
children
|
|
851
|
+
}) {
|
|
852
|
+
const config = useMemo2(
|
|
853
|
+
() => ({
|
|
854
|
+
source,
|
|
855
|
+
scheme,
|
|
856
|
+
contrast,
|
|
857
|
+
primary,
|
|
858
|
+
secondary,
|
|
859
|
+
tertiary,
|
|
860
|
+
neutral,
|
|
861
|
+
neutralVariant,
|
|
862
|
+
error,
|
|
863
|
+
colorMatch,
|
|
864
|
+
customColors,
|
|
865
|
+
prefix
|
|
866
|
+
}),
|
|
867
|
+
[
|
|
868
|
+
contrast,
|
|
869
|
+
customColors,
|
|
870
|
+
scheme,
|
|
871
|
+
source,
|
|
872
|
+
primary,
|
|
873
|
+
secondary,
|
|
874
|
+
tertiary,
|
|
875
|
+
neutral,
|
|
876
|
+
neutralVariant,
|
|
877
|
+
error,
|
|
878
|
+
colorMatch,
|
|
879
|
+
prefix
|
|
880
|
+
]
|
|
881
|
+
);
|
|
882
|
+
return /* @__PURE__ */ jsx2(McuProvider, { ...config, styleId: mcuStyleId, children });
|
|
883
|
+
}
|
|
884
|
+
export {
|
|
885
|
+
Mcu,
|
|
886
|
+
builder,
|
|
887
|
+
useMcu
|
|
888
|
+
};
|