@kanso-labs/kanso-ui-core 0.5.0 → 0.6.1

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.
@@ -1,3 +1,358 @@
1
+ // src/contrast.ts
2
+ /** WCAG 2's bar for text and the glyphs that carry meaning. */
3
+ const TEXT = 4.5;
4
+ const kansoPairs = [
5
+ ...[
6
+ "paper",
7
+ "kanso-surface",
8
+ "surface-sunken",
9
+ "container"
10
+ ].flatMap((ground) => [[
11
+ "ink",
12
+ ground,
13
+ TEXT
14
+ ], [
15
+ "ink-muted",
16
+ ground,
17
+ TEXT
18
+ ]]),
19
+ [
20
+ "on-ink",
21
+ "ink",
22
+ TEXT
23
+ ],
24
+ [
25
+ "accent",
26
+ "paper",
27
+ TEXT
28
+ ],
29
+ [
30
+ "accent",
31
+ "kanso-surface",
32
+ TEXT
33
+ ],
34
+ [
35
+ "on-accent",
36
+ "accent",
37
+ TEXT
38
+ ],
39
+ [
40
+ "on-accent-soft",
41
+ "accent-soft",
42
+ TEXT
43
+ ],
44
+ [
45
+ "accent-on-ink",
46
+ "ink",
47
+ TEXT
48
+ ],
49
+ [
50
+ "on-spotlight",
51
+ "spotlight",
52
+ TEXT
53
+ ],
54
+ [
55
+ "on-spotlight-muted",
56
+ "spotlight",
57
+ TEXT
58
+ ],
59
+ [
60
+ "on-spotlight",
61
+ "spotlight-tonal over spotlight",
62
+ TEXT
63
+ ],
64
+ [
65
+ "on-spotlight-button",
66
+ "spotlight-button",
67
+ TEXT
68
+ ],
69
+ [
70
+ "spotlight-line",
71
+ "spotlight",
72
+ 3
73
+ ],
74
+ [
75
+ "positive",
76
+ "paper",
77
+ TEXT
78
+ ],
79
+ [
80
+ "positive",
81
+ "kanso-surface",
82
+ TEXT
83
+ ],
84
+ [
85
+ "on-positive-soft",
86
+ "positive-soft",
87
+ TEXT
88
+ ],
89
+ [
90
+ "caution",
91
+ "paper",
92
+ TEXT
93
+ ],
94
+ [
95
+ "caution",
96
+ "kanso-surface",
97
+ TEXT
98
+ ],
99
+ [
100
+ "caution",
101
+ "caution-soft",
102
+ 3
103
+ ],
104
+ [
105
+ "on-caution-soft",
106
+ "caution-soft",
107
+ TEXT
108
+ ],
109
+ [
110
+ "negative",
111
+ "paper",
112
+ TEXT
113
+ ],
114
+ [
115
+ "negative",
116
+ "kanso-surface",
117
+ TEXT
118
+ ],
119
+ [
120
+ "on-negative-soft",
121
+ "negative-soft",
122
+ TEXT
123
+ ],
124
+ [
125
+ "critical",
126
+ "paper",
127
+ TEXT
128
+ ],
129
+ [
130
+ "critical",
131
+ "kanso-surface",
132
+ TEXT
133
+ ],
134
+ [
135
+ "on-critical",
136
+ "critical",
137
+ TEXT
138
+ ],
139
+ [
140
+ "on-critical-soft",
141
+ "critical-soft",
142
+ TEXT
143
+ ],
144
+ [
145
+ "outline",
146
+ "paper",
147
+ 3
148
+ ],
149
+ [
150
+ "outline",
151
+ "kanso-surface",
152
+ 3
153
+ ],
154
+ [
155
+ "focus-ring",
156
+ "paper",
157
+ 3
158
+ ]
159
+ ];
160
+ const ROLE_GROUNDS = [
161
+ "surface",
162
+ "surface-container-lowest",
163
+ "surface-container-low",
164
+ "surface-container",
165
+ "surface-container-high",
166
+ "surface-container-highest",
167
+ "surface-variant"
168
+ ];
169
+ const FILLS = [
170
+ "primary",
171
+ "primary-container",
172
+ "secondary",
173
+ "secondary-container",
174
+ "tertiary",
175
+ "tertiary-container",
176
+ "error",
177
+ "error-container",
178
+ "positive",
179
+ "positive-container",
180
+ "negative",
181
+ "negative-container"
182
+ ];
183
+ const rolePairs = [
184
+ ...ROLE_GROUNDS.flatMap((ground) => [
185
+ [
186
+ "on-surface",
187
+ ground,
188
+ TEXT
189
+ ],
190
+ [
191
+ "on-surface-variant",
192
+ ground,
193
+ TEXT
194
+ ],
195
+ [
196
+ "outline",
197
+ ground,
198
+ 3
199
+ ]
200
+ ]),
201
+ ...FILLS.map((fill) => [
202
+ `on-${fill}`,
203
+ fill,
204
+ TEXT
205
+ ]),
206
+ [
207
+ "inverse-on-surface",
208
+ "inverse-surface",
209
+ TEXT
210
+ ],
211
+ [
212
+ "inverse-primary",
213
+ "inverse-surface",
214
+ TEXT
215
+ ],
216
+ [
217
+ "inverse-error",
218
+ "inverse-surface",
219
+ TEXT
220
+ ],
221
+ [
222
+ "primary",
223
+ "surface",
224
+ TEXT
225
+ ],
226
+ [
227
+ "primary",
228
+ "surface-container-low",
229
+ TEXT
230
+ ],
231
+ [
232
+ "primary",
233
+ "surface-container-highest",
234
+ TEXT
235
+ ],
236
+ [
237
+ "primary",
238
+ "primary-container",
239
+ TEXT
240
+ ],
241
+ [
242
+ "secondary",
243
+ "secondary-container",
244
+ TEXT
245
+ ],
246
+ [
247
+ "error",
248
+ "surface",
249
+ TEXT
250
+ ],
251
+ [
252
+ "error",
253
+ "surface-container-highest",
254
+ TEXT
255
+ ],
256
+ [
257
+ "positive",
258
+ "surface",
259
+ TEXT
260
+ ],
261
+ [
262
+ "negative",
263
+ "surface",
264
+ TEXT
265
+ ],
266
+ [
267
+ "secondary",
268
+ "surface",
269
+ 3
270
+ ]
271
+ ];
272
+ /** WCAG 2's contrast ratio between two opaque colours, 1 to 21. */
273
+ function contrast(first, second) {
274
+ const [lighter = 0, darker = 0] = [luminance(first), luminance(second)].toSorted((a, b) => b - a);
275
+ return (lighter + .05) / (darker + .05);
276
+ }
277
+ /** Whether a value is a colour the contrast check can read. */
278
+ function isColor(value) {
279
+ if (typeof value !== "string") return false;
280
+ try {
281
+ parseColor(value);
282
+ return true;
283
+ } catch {
284
+ return false;
285
+ }
286
+ }
287
+ function luminance([red, green, blue]) {
288
+ const [r = 0, g = 0, b = 0] = [
289
+ red,
290
+ green,
291
+ blue
292
+ ].map((channel) => {
293
+ const value = channel / 255;
294
+ return value <= .04045 ? value / 12.92 : ((value + .055) / 1.055) ** 2.4;
295
+ });
296
+ return .2126 * r + .7152 * g + .0722 * b;
297
+ }
298
+ /** A colour painted over an opaque ground, as the eye sees it. */
299
+ function over(color, ground) {
300
+ const [red, green, blue, alpha] = parseColor(color);
301
+ const mix = (top, bottom) => top * alpha + bottom * (1 - alpha);
302
+ return [
303
+ mix(red, ground[0]),
304
+ mix(green, ground[1]),
305
+ mix(blue, ground[2]),
306
+ 1
307
+ ];
308
+ }
309
+ /**
310
+ * A `#rrggbb` or `rgba(r, g, b, a)` colour, as the token file writes them, as
311
+ * its channels, 0 to 255, and its alpha. Throws for anything else.
312
+ */
313
+ function parseColor(color) {
314
+ const hex = /^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/iu.exec(color);
315
+ if (hex) {
316
+ const [, red = "", green = "", blue = ""] = hex;
317
+ return [
318
+ Number.parseInt(red, 16),
319
+ Number.parseInt(green, 16),
320
+ Number.parseInt(blue, 16),
321
+ 1
322
+ ];
323
+ }
324
+ const rgba = /^rgba\((\d{1,3}), (\d{1,3}), (\d{1,3}), (0|1|0?\.\d+|1\.0+)\)$/u.exec(color);
325
+ if (rgba) {
326
+ const [, red = "", green = "", blue = "", alpha = ""] = rgba;
327
+ const channels = [
328
+ Number(red),
329
+ Number(green),
330
+ Number(blue)
331
+ ];
332
+ if (channels.every((channel) => channel <= 255)) {
333
+ const [r = 0, g = 0, b = 0] = channels;
334
+ return [
335
+ r,
336
+ g,
337
+ b,
338
+ Number(alpha)
339
+ ];
340
+ }
341
+ }
342
+ throw new TypeError(`not a #rrggbb or rgba() colour: ${color}`);
343
+ }
344
+ /** A pair's ratio in a scheme, its ground resolved first. */
345
+ function ratioOf(scheme, foreground, ground) {
346
+ const colorOf = (name) => {
347
+ const value = scheme[`--kui-color-${name}`];
348
+ if (value === void 0) throw new Error(`no colour ${name}`);
349
+ return value;
350
+ };
351
+ const [top = "", under = top] = ground.split(" over ");
352
+ const base = parseColor(colorOf(under));
353
+ const grounded = top === under ? base : over(colorOf(top), base);
354
+ return contrast(over(colorOf(foreground), grounded), grounded);
355
+ }
1
356
  // src/tokens/defaults.ts
2
357
  /** Every property at its value in the light scheme, as `tokens.css` declares it. */
3
358
  const light = {
@@ -466,80 +821,192 @@ const breakpoints = {
466
821
  extraLarge: 1600
467
822
  };
468
823
  /**
469
- * Daily's theme: every property at its value in each scheme, with
470
- * the product roles in Daily's colour and every colour that follows them.
471
- * The `kui-theme-daily` class in `tokens.css` follows the reader's
472
- * `prefers-color-scheme` only; a page that pins its scheme hands
473
- * `daily.light` or `daily.dark` to `ThemeScope` for the scheme it pins.
824
+ * The roles a product brings its own colour for, in light and in dark: the
825
+ * accent and the spotlight, each with what is drawn on it. The base fills them
826
+ * from the neutrals, since Kanso's brand is ink and paper.
827
+ */
828
+ const productRoles = [
829
+ "accent",
830
+ "onAccent",
831
+ "accentSoft",
832
+ "onAccentSoft",
833
+ "accentOnInk",
834
+ "spotlight",
835
+ "onSpotlight",
836
+ "onSpotlightMuted",
837
+ "spotlightButton",
838
+ "onSpotlightButton",
839
+ "spotlightTonal",
840
+ "spotlightLine"
841
+ ];
842
+ /**
843
+ * Every colour that follows a product role, in each scheme, and the role it
844
+ * follows, in the scheme it reads it from: `primary` and `focus-ring`
845
+ * follow the accent, `on-primary` the on-accent, and so on. A product role
846
+ * follows itself.
474
847
  */
475
- const daily = {
848
+ const productFollowers = {
476
849
  dark: {
477
- ...dark,
478
- "--kui-color-accent": "#9fb0ff",
479
- "--kui-color-accent-on-ink": "#2e46c0",
480
- "--kui-color-accent-soft": "#25306b",
481
- "--kui-color-focus-ring": "#9fb0ff",
482
- "--kui-color-inverse-primary": "#2e46c0",
483
- "--kui-color-on-accent": "#0e1a5c",
484
- "--kui-color-on-accent-soft": "#dde3ff",
485
- "--kui-color-on-primary": "#0e1a5c",
486
- "--kui-color-on-primary-container": "#dde3ff",
487
- "--kui-color-on-primary-fixed": "#dde3ff",
488
- "--kui-color-on-primary-fixed-variant": "#dde3ff",
489
- "--kui-color-on-secondary-fixed": "#dde3ff",
490
- "--kui-color-on-secondary-fixed-variant": "#dde3ff",
491
- "--kui-color-on-spotlight-button": "#1f2f86",
492
- "--kui-color-on-tertiary": "#dde3ff",
493
- "--kui-color-on-tertiary-container": "#dde3ff",
494
- "--kui-color-on-tertiary-fixed": "#dde3ff",
495
- "--kui-color-on-tertiary-fixed-variant": "#dde3ff",
496
- "--kui-color-primary": "#9fb0ff",
497
- "--kui-color-primary-container": "#25306b",
498
- "--kui-color-primary-fixed": "#25306b",
499
- "--kui-color-primary-fixed-dim": "#25306b",
500
- "--kui-color-secondary-fixed": "#25306b",
501
- "--kui-color-secondary-fixed-dim": "#25306b",
502
- "--kui-color-spotlight": "#283c9f",
503
- "--kui-color-surface-tint": "#9fb0ff",
504
- "--kui-color-tertiary": "#25306b",
505
- "--kui-color-tertiary-container": "#25306b",
506
- "--kui-color-tertiary-fixed": "#25306b",
507
- "--kui-color-tertiary-fixed-dim": "#25306b"
850
+ "--kui-color-accent": ["dark", "accent"],
851
+ "--kui-color-accent-on-ink": ["dark", "accentOnInk"],
852
+ "--kui-color-accent-soft": ["dark", "accentSoft"],
853
+ "--kui-color-focus-ring": ["dark", "accent"],
854
+ "--kui-color-inverse-primary": ["dark", "accentOnInk"],
855
+ "--kui-color-on-accent": ["dark", "onAccent"],
856
+ "--kui-color-on-accent-soft": ["dark", "onAccentSoft"],
857
+ "--kui-color-on-primary": ["dark", "onAccent"],
858
+ "--kui-color-on-primary-container": ["dark", "onAccentSoft"],
859
+ "--kui-color-on-primary-fixed": ["dark", "onAccentSoft"],
860
+ "--kui-color-on-primary-fixed-variant": ["dark", "onAccentSoft"],
861
+ "--kui-color-on-secondary-fixed": ["dark", "onAccentSoft"],
862
+ "--kui-color-on-secondary-fixed-variant": ["dark", "onAccentSoft"],
863
+ "--kui-color-on-spotlight": ["dark", "onSpotlight"],
864
+ "--kui-color-on-spotlight-button": ["dark", "onSpotlightButton"],
865
+ "--kui-color-on-spotlight-muted": ["dark", "onSpotlightMuted"],
866
+ "--kui-color-on-tertiary": ["dark", "onAccentSoft"],
867
+ "--kui-color-on-tertiary-container": ["dark", "onAccentSoft"],
868
+ "--kui-color-on-tertiary-fixed": ["dark", "onAccentSoft"],
869
+ "--kui-color-on-tertiary-fixed-variant": ["dark", "onAccentSoft"],
870
+ "--kui-color-primary": ["dark", "accent"],
871
+ "--kui-color-primary-container": ["dark", "accentSoft"],
872
+ "--kui-color-primary-fixed": ["dark", "accentSoft"],
873
+ "--kui-color-primary-fixed-dim": ["dark", "accentSoft"],
874
+ "--kui-color-secondary-fixed": ["dark", "accentSoft"],
875
+ "--kui-color-secondary-fixed-dim": ["dark", "accentSoft"],
876
+ "--kui-color-spotlight": ["dark", "spotlight"],
877
+ "--kui-color-spotlight-button": ["dark", "spotlightButton"],
878
+ "--kui-color-spotlight-line": ["dark", "spotlightLine"],
879
+ "--kui-color-spotlight-tonal": ["dark", "spotlightTonal"],
880
+ "--kui-color-surface-tint": ["dark", "accent"],
881
+ "--kui-color-tertiary": ["dark", "accentSoft"],
882
+ "--kui-color-tertiary-container": ["dark", "accentSoft"],
883
+ "--kui-color-tertiary-fixed": ["dark", "accentSoft"],
884
+ "--kui-color-tertiary-fixed-dim": ["dark", "accentSoft"]
508
885
  },
509
886
  light: {
510
- ...light,
511
- "--kui-color-accent": "#2e46c0",
512
- "--kui-color-accent-on-ink": "#9fb0ff",
513
- "--kui-color-accent-soft": "#e4e8fb",
514
- "--kui-color-focus-ring": "#2e46c0",
515
- "--kui-color-inverse-primary": "#9fb0ff",
516
- "--kui-color-on-accent": "#ffffff",
517
- "--kui-color-on-accent-soft": "#1f2f86",
518
- "--kui-color-on-primary": "#ffffff",
519
- "--kui-color-on-primary-container": "#1f2f86",
520
- "--kui-color-on-primary-fixed": "#1f2f86",
521
- "--kui-color-on-primary-fixed-variant": "#1f2f86",
522
- "--kui-color-on-secondary-fixed": "#1f2f86",
523
- "--kui-color-on-secondary-fixed-variant": "#1f2f86",
524
- "--kui-color-on-spotlight-button": "#1f2f86",
525
- "--kui-color-on-tertiary": "#1f2f86",
526
- "--kui-color-on-tertiary-container": "#1f2f86",
527
- "--kui-color-on-tertiary-fixed": "#1f2f86",
528
- "--kui-color-on-tertiary-fixed-variant": "#1f2f86",
529
- "--kui-color-primary": "#2e46c0",
530
- "--kui-color-primary-container": "#e4e8fb",
531
- "--kui-color-primary-fixed": "#e4e8fb",
532
- "--kui-color-primary-fixed-dim": "#e4e8fb",
533
- "--kui-color-secondary-fixed": "#e4e8fb",
534
- "--kui-color-secondary-fixed-dim": "#e4e8fb",
535
- "--kui-color-spotlight": "#2e46c0",
536
- "--kui-color-surface-tint": "#2e46c0",
537
- "--kui-color-tertiary": "#e4e8fb",
538
- "--kui-color-tertiary-container": "#e4e8fb",
539
- "--kui-color-tertiary-fixed": "#e4e8fb",
540
- "--kui-color-tertiary-fixed-dim": "#e4e8fb"
887
+ "--kui-color-accent": ["light", "accent"],
888
+ "--kui-color-accent-on-ink": ["light", "accentOnInk"],
889
+ "--kui-color-accent-soft": ["light", "accentSoft"],
890
+ "--kui-color-focus-ring": ["light", "accent"],
891
+ "--kui-color-inverse-primary": ["light", "accentOnInk"],
892
+ "--kui-color-on-accent": ["light", "onAccent"],
893
+ "--kui-color-on-accent-soft": ["light", "onAccentSoft"],
894
+ "--kui-color-on-primary": ["light", "onAccent"],
895
+ "--kui-color-on-primary-container": ["light", "onAccentSoft"],
896
+ "--kui-color-on-primary-fixed": ["light", "onAccentSoft"],
897
+ "--kui-color-on-primary-fixed-variant": ["light", "onAccentSoft"],
898
+ "--kui-color-on-secondary-fixed": ["light", "onAccentSoft"],
899
+ "--kui-color-on-secondary-fixed-variant": ["light", "onAccentSoft"],
900
+ "--kui-color-on-spotlight": ["light", "onSpotlight"],
901
+ "--kui-color-on-spotlight-button": ["light", "onSpotlightButton"],
902
+ "--kui-color-on-spotlight-muted": ["light", "onSpotlightMuted"],
903
+ "--kui-color-on-tertiary": ["light", "onAccentSoft"],
904
+ "--kui-color-on-tertiary-container": ["light", "onAccentSoft"],
905
+ "--kui-color-on-tertiary-fixed": ["light", "onAccentSoft"],
906
+ "--kui-color-on-tertiary-fixed-variant": ["light", "onAccentSoft"],
907
+ "--kui-color-primary": ["light", "accent"],
908
+ "--kui-color-primary-container": ["light", "accentSoft"],
909
+ "--kui-color-primary-fixed": ["light", "accentSoft"],
910
+ "--kui-color-primary-fixed-dim": ["light", "accentSoft"],
911
+ "--kui-color-secondary-fixed": ["light", "accentSoft"],
912
+ "--kui-color-secondary-fixed-dim": ["light", "accentSoft"],
913
+ "--kui-color-spotlight": ["light", "spotlight"],
914
+ "--kui-color-spotlight-button": ["light", "spotlightButton"],
915
+ "--kui-color-spotlight-line": ["light", "spotlightLine"],
916
+ "--kui-color-spotlight-tonal": ["light", "spotlightTonal"],
917
+ "--kui-color-surface-tint": ["light", "accent"],
918
+ "--kui-color-tertiary": ["light", "accentSoft"],
919
+ "--kui-color-tertiary-container": ["light", "accentSoft"],
920
+ "--kui-color-tertiary-fixed": ["light", "accentSoft"],
921
+ "--kui-color-tertiary-fixed-dim": ["light", "accentSoft"]
541
922
  }
542
923
  };
543
- export { light as i, daily as n, dark as r, breakpoints as t };
924
+ // src/product-theme.ts
925
+ /** Thrown by {@link defineProductTheme} for a palette below a contrast target. */
926
+ var ProductThemeError = class extends Error {
927
+ /** Every pair below its target, in light and then in dark. */
928
+ failures;
929
+ constructor(failures) {
930
+ super(["The product colours miss these contrast targets:", ...failures.map(({ foreground, ground, ratio, scheme, target }) => ` ${scheme}: ${foreground} on ${ground} at ${ratio.toFixed(2)}:1, below ${target}:1`)].join("\n"));
931
+ this.name = "ProductThemeError";
932
+ this.failures = failures;
933
+ }
934
+ };
935
+ const DEFAULTS = {
936
+ dark,
937
+ light
938
+ };
939
+ /** A theme read by any property name, as the contrast pairs name them. */
940
+ function read(map) {
941
+ return map;
942
+ }
943
+ const SCHEMES = ["light", "dark"];
944
+ /**
945
+ * Builds a product's theme from its colours: every colour that follows a
946
+ * product role takes the product's value of it, `primary`, `focus-ring` and
947
+ * the other Material Design roles that alias the accent included, and
948
+ * everything else keeps its default.
949
+ *
950
+ * The colours are held to Kanso's contrast targets, WCAG 2's 4.5:1 for text
951
+ * and 3:1 for the rest, in both schemes, over the same pairs the base clears:
952
+ * those Kanso's usage notes name and those both libraries draw. A palette
953
+ * below one throws a {@link ProductThemeError} naming every pair; one missing
954
+ * a scheme or a role, naming one it does not have, or holding a value that is not a
955
+ * `#rrggbb` or `rgba()` colour throws a `TypeError`.
956
+ *
957
+ * Build it once, as a constant: both libraries' `ThemeScope` is to keep what
958
+ * it resolves for each theme object it is handed.
959
+ *
960
+ * ```ts
961
+ * const productTheme = defineProductTheme({ dark: { accent: '#cdb0f5', … }, light: { accent: '#6b3fa0', … } })
962
+ *
963
+ * <ThemeScope productTheme={productTheme}>…</ThemeScope>
964
+ * ```
965
+ */
966
+ function defineProductTheme(palette) {
967
+ for (const scheme of SCHEMES) {
968
+ const given = palette[scheme];
969
+ if (typeof given !== "object" || given === null) throw new TypeError(`the palette has no ${scheme} colours`);
970
+ const colors = new Map(Object.entries(given));
971
+ const roles = productRoles;
972
+ const unknown = [...colors.keys()].filter((role) => !roles.includes(role));
973
+ if (unknown.length > 0) throw new TypeError(`${scheme} has no product role ${unknown.join(", ")}; the roles are ${roles.join(", ")}`);
974
+ for (const role of productRoles) if (!isColor(colors.get(role))) throw new TypeError(`${scheme}.${role} takes a #rrggbb or rgba() colour, not ${String(colors.get(role))}`);
975
+ }
976
+ const followed = (scheme) => ({
977
+ ...DEFAULTS[scheme],
978
+ ...Object.fromEntries(Object.entries(productFollowers[scheme]).map(([property, from]) => [property, palette[from[0]][from[1]]]))
979
+ });
980
+ const maps = {
981
+ dark: followed("dark"),
982
+ light: followed("light")
983
+ };
984
+ const failures = SCHEMES.flatMap((scheme) => [...kansoPairs, ...rolePairs].flatMap(([foreground, ground, target]) => {
985
+ const ratio = ratioOf(maps[scheme], foreground, ground);
986
+ return ratio < target ? [{
987
+ foreground,
988
+ ground,
989
+ ratio,
990
+ scheme,
991
+ target
992
+ }] : [];
993
+ }));
994
+ if (failures.length > 0) throw new ProductThemeError(failures);
995
+ const following = Object.keys(maps.light).filter((property) => SCHEMES.some((scheme) => Object.hasOwn(productFollowers[scheme], property)));
996
+ const changesIn = (scheme) => Object.freeze(Object.fromEntries(following.map((property) => [property, read(maps[scheme])[property]])));
997
+ return Object.freeze({
998
+ changes: Object.freeze({
999
+ dark: changesIn("dark"),
1000
+ light: changesIn("light")
1001
+ }),
1002
+ dark: Object.freeze(maps.dark),
1003
+ light: Object.freeze(maps.light),
1004
+ palette: Object.freeze({
1005
+ dark: Object.freeze({ ...palette.dark }),
1006
+ light: Object.freeze({ ...palette.light })
1007
+ })
1008
+ });
1009
+ }
1010
+ export { light as a, dark as i, defineProductTheme as n, productRoles as o, breakpoints as r, ProductThemeError as t };
544
1011
 
545
- //# sourceMappingURL=defaults-BllR5oU-.js.map
1012
+ //# sourceMappingURL=product-theme-BpaQ7tJd.js.map