@sanity/ui 2.0.1 → 2.0.3

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/theme.esm.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { COLOR_HUES, COLOR_TINTS, color } from '@sanity/color';
2
+
2
3
  function createSelectableTones(opts, base, dark, solid, muted) {
3
4
  return {
4
5
  default: _createSelectableStates(opts, base, dark, solid, muted, "default"),
@@ -52,232 +53,54 @@ function _createSelectableStates(opts, base, dark, solid, muted, tone) {
52
53
  })
53
54
  };
54
55
  }
56
+
55
57
  function createSolidTones(opts, base, dark, name) {
56
58
  return {
57
59
  default: {
58
- enabled: opts.solid({
59
- base,
60
- dark,
61
- tone: "default",
62
- name,
63
- state: "enabled"
64
- }),
65
- disabled: opts.solid({
66
- base,
67
- dark,
68
- tone: "default",
69
- name,
70
- state: "disabled"
71
- }),
72
- hovered: opts.solid({
73
- base,
74
- dark,
75
- tone: "default",
76
- name,
77
- state: "hovered"
78
- }),
79
- pressed: opts.solid({
80
- base,
81
- dark,
82
- tone: "default",
83
- name,
84
- state: "pressed"
85
- }),
86
- selected: opts.solid({
87
- base,
88
- dark,
89
- tone: "default",
90
- name,
91
- state: "selected"
92
- })
60
+ enabled: opts.solid({ base, dark, tone: "default", name, state: "enabled" }),
61
+ disabled: opts.solid({ base, dark, tone: "default", name, state: "disabled" }),
62
+ hovered: opts.solid({ base, dark, tone: "default", name, state: "hovered" }),
63
+ pressed: opts.solid({ base, dark, tone: "default", name, state: "pressed" }),
64
+ selected: opts.solid({ base, dark, tone: "default", name, state: "selected" })
93
65
  },
94
66
  transparent: {
95
- enabled: opts.solid({
96
- base,
97
- dark,
98
- tone: "transparent",
99
- name,
100
- state: "enabled"
101
- }),
102
- disabled: opts.solid({
103
- base,
104
- dark,
105
- tone: "transparent",
106
- name,
107
- state: "disabled"
108
- }),
109
- hovered: opts.solid({
110
- base,
111
- dark,
112
- tone: "transparent",
113
- name,
114
- state: "hovered"
115
- }),
116
- pressed: opts.solid({
117
- base,
118
- dark,
119
- tone: "transparent",
120
- name,
121
- state: "pressed"
122
- }),
123
- selected: opts.solid({
124
- base,
125
- dark,
126
- tone: "transparent",
127
- name,
128
- state: "selected"
129
- })
67
+ enabled: opts.solid({ base, dark, tone: "transparent", name, state: "enabled" }),
68
+ disabled: opts.solid({ base, dark, tone: "transparent", name, state: "disabled" }),
69
+ hovered: opts.solid({ base, dark, tone: "transparent", name, state: "hovered" }),
70
+ pressed: opts.solid({ base, dark, tone: "transparent", name, state: "pressed" }),
71
+ selected: opts.solid({ base, dark, tone: "transparent", name, state: "selected" })
130
72
  },
131
73
  primary: {
132
- enabled: opts.solid({
133
- base,
134
- dark,
135
- tone: "primary",
136
- name,
137
- state: "enabled"
138
- }),
139
- disabled: opts.solid({
140
- base,
141
- dark,
142
- tone: "primary",
143
- name,
144
- state: "disabled"
145
- }),
146
- hovered: opts.solid({
147
- base,
148
- dark,
149
- tone: "primary",
150
- name,
151
- state: "hovered"
152
- }),
153
- pressed: opts.solid({
154
- base,
155
- dark,
156
- tone: "primary",
157
- name,
158
- state: "pressed"
159
- }),
160
- selected: opts.solid({
161
- base,
162
- dark,
163
- tone: "primary",
164
- name,
165
- state: "selected"
166
- })
74
+ enabled: opts.solid({ base, dark, tone: "primary", name, state: "enabled" }),
75
+ disabled: opts.solid({ base, dark, tone: "primary", name, state: "disabled" }),
76
+ hovered: opts.solid({ base, dark, tone: "primary", name, state: "hovered" }),
77
+ pressed: opts.solid({ base, dark, tone: "primary", name, state: "pressed" }),
78
+ selected: opts.solid({ base, dark, tone: "primary", name, state: "selected" })
167
79
  },
168
80
  positive: {
169
- enabled: opts.solid({
170
- base,
171
- dark,
172
- tone: "positive",
173
- name,
174
- state: "enabled"
175
- }),
176
- disabled: opts.solid({
177
- base,
178
- dark,
179
- tone: "positive",
180
- name,
181
- state: "disabled"
182
- }),
183
- hovered: opts.solid({
184
- base,
185
- dark,
186
- tone: "positive",
187
- name,
188
- state: "hovered"
189
- }),
190
- pressed: opts.solid({
191
- base,
192
- dark,
193
- tone: "positive",
194
- name,
195
- state: "pressed"
196
- }),
197
- selected: opts.solid({
198
- base,
199
- dark,
200
- tone: "positive",
201
- name,
202
- state: "selected"
203
- })
81
+ enabled: opts.solid({ base, dark, tone: "positive", name, state: "enabled" }),
82
+ disabled: opts.solid({ base, dark, tone: "positive", name, state: "disabled" }),
83
+ hovered: opts.solid({ base, dark, tone: "positive", name, state: "hovered" }),
84
+ pressed: opts.solid({ base, dark, tone: "positive", name, state: "pressed" }),
85
+ selected: opts.solid({ base, dark, tone: "positive", name, state: "selected" })
204
86
  },
205
87
  caution: {
206
- enabled: opts.solid({
207
- base,
208
- dark,
209
- tone: "caution",
210
- name,
211
- state: "enabled"
212
- }),
213
- disabled: opts.solid({
214
- base,
215
- dark,
216
- tone: "caution",
217
- name,
218
- state: "disabled"
219
- }),
220
- hovered: opts.solid({
221
- base,
222
- dark,
223
- tone: "caution",
224
- name,
225
- state: "hovered"
226
- }),
227
- pressed: opts.solid({
228
- base,
229
- dark,
230
- tone: "caution",
231
- name,
232
- state: "pressed"
233
- }),
234
- selected: opts.solid({
235
- base,
236
- dark,
237
- tone: "caution",
238
- name,
239
- state: "selected"
240
- })
88
+ enabled: opts.solid({ base, dark, tone: "caution", name, state: "enabled" }),
89
+ disabled: opts.solid({ base, dark, tone: "caution", name, state: "disabled" }),
90
+ hovered: opts.solid({ base, dark, tone: "caution", name, state: "hovered" }),
91
+ pressed: opts.solid({ base, dark, tone: "caution", name, state: "pressed" }),
92
+ selected: opts.solid({ base, dark, tone: "caution", name, state: "selected" })
241
93
  },
242
94
  critical: {
243
- enabled: opts.solid({
244
- base,
245
- dark,
246
- tone: "critical",
247
- name,
248
- state: "enabled"
249
- }),
250
- disabled: opts.solid({
251
- base,
252
- dark,
253
- tone: "critical",
254
- name,
255
- state: "disabled"
256
- }),
257
- hovered: opts.solid({
258
- base,
259
- dark,
260
- tone: "critical",
261
- name,
262
- state: "hovered"
263
- }),
264
- pressed: opts.solid({
265
- base,
266
- dark,
267
- tone: "critical",
268
- name,
269
- state: "pressed"
270
- }),
271
- selected: opts.solid({
272
- base,
273
- dark,
274
- tone: "critical",
275
- name,
276
- state: "selected"
277
- })
95
+ enabled: opts.solid({ base, dark, tone: "critical", name, state: "enabled" }),
96
+ disabled: opts.solid({ base, dark, tone: "critical", name, state: "disabled" }),
97
+ hovered: opts.solid({ base, dark, tone: "critical", name, state: "hovered" }),
98
+ pressed: opts.solid({ base, dark, tone: "critical", name, state: "pressed" }),
99
+ selected: opts.solid({ base, dark, tone: "critical", name, state: "selected" })
278
100
  }
279
101
  };
280
102
  }
103
+
281
104
  function createButtonTones(opts, base, dark, solid, muted, mode) {
282
105
  return {
283
106
  default: opts.button({
@@ -317,6 +140,7 @@ function createButtonTones(opts, base, dark, solid, muted, mode) {
317
140
  })
318
141
  };
319
142
  }
143
+
320
144
  function createButtonModes(opts, base, dark, solid, muted) {
321
145
  return {
322
146
  default: createButtonTones(opts, base, dark, solid, muted, "default"),
@@ -324,6 +148,7 @@ function createButtonModes(opts, base, dark, solid, muted) {
324
148
  bleed: createButtonTones(opts, base, dark, solid, muted, "bleed")
325
149
  };
326
150
  }
151
+
327
152
  function createCardStates(opts, base, dark, name, solid, muted) {
328
153
  return {
329
154
  enabled: opts.card({
@@ -368,6 +193,7 @@ function createCardStates(opts, base, dark, name, solid, muted) {
368
193
  })
369
194
  };
370
195
  }
196
+
371
197
  const black = "hsl(0, 0%, 0%)";
372
198
  const white = "hsl(0, 0%, 100%)";
373
199
  const colors = {
@@ -470,11 +296,7 @@ const tones = {
470
296
  }
471
297
  };
472
298
  const defaultOpts = {
473
- base: _ref => {
474
- let {
475
- dark,
476
- name
477
- } = _ref;
299
+ base: ({ dark, name }) => {
478
300
  if (name === "default") {
479
301
  return {
480
302
  bg: dark ? black : white,
@@ -510,13 +332,7 @@ const defaultOpts = {
510
332
  }
511
333
  };
512
334
  },
513
- solid: _ref2 => {
514
- let {
515
- base,
516
- dark,
517
- state,
518
- tone
519
- } = _ref2;
335
+ solid: ({ base, dark, state, tone }) => {
520
336
  const color = colors[tone];
521
337
  if (state === "hovered") {
522
338
  return {
@@ -563,13 +379,7 @@ const defaultOpts = {
563
379
  skeleton: base.skeleton
564
380
  };
565
381
  },
566
- muted: _ref3 => {
567
- let {
568
- base,
569
- dark,
570
- state,
571
- tone
572
- } = _ref3;
382
+ muted: ({ base, dark, state, tone }) => {
573
383
  const color = colors[tone];
574
384
  if (state === "hovered") {
575
385
  return {
@@ -616,13 +426,7 @@ const defaultOpts = {
616
426
  skeleton: base.skeleton
617
427
  };
618
428
  },
619
- button: _ref4 => {
620
- let {
621
- base,
622
- mode,
623
- muted,
624
- solid
625
- } = _ref4;
429
+ button: ({ base, mode, muted, solid }) => {
626
430
  if (mode === "bleed") {
627
431
  return {
628
432
  ...muted,
@@ -670,16 +474,14 @@ const defaultOpts = {
670
474
  }
671
475
  };
672
476
  }
673
- if (mode === "ghost") return {
674
- ...solid,
675
- enabled: muted.enabled
676
- };
477
+ if (mode === "ghost")
478
+ return {
479
+ ...solid,
480
+ enabled: muted.enabled
481
+ };
677
482
  return solid;
678
483
  },
679
- card: _ref5 => {
680
- let {
681
- base
682
- } = _ref5;
484
+ card: ({ base }) => {
683
485
  return {
684
486
  bg: black,
685
487
  bg2: black,
@@ -711,18 +513,10 @@ const defaultOpts = {
711
513
  placeholder: black
712
514
  };
713
515
  },
714
- selectable: _ref6 => {
715
- let {
716
- muted,
717
- state,
718
- tone
719
- } = _ref6;
516
+ selectable: ({ muted, state, tone }) => {
720
517
  return muted[tone][state];
721
518
  },
722
- spot: _ref7 => {
723
- let {
724
- key
725
- } = _ref7;
519
+ spot: ({ key }) => {
726
520
  return spots[key];
727
521
  },
728
522
  syntax: () => ({
@@ -764,6 +558,7 @@ const defaultOpts = {
764
558
  variable: black
765
559
  })
766
560
  };
561
+
767
562
  function createInputModes(opts, base, dark, solid, muted) {
768
563
  return {
769
564
  default: {
@@ -836,287 +631,70 @@ function createInputModes(opts, base, dark, solid, muted) {
836
631
  }
837
632
  };
838
633
  }
634
+
839
635
  function createMutedTones(opts, base, dark, name) {
840
636
  return {
841
637
  default: {
842
- enabled: opts.muted({
843
- base,
844
- dark,
845
- tone: "default",
846
- name,
847
- state: "enabled"
848
- }),
849
- disabled: opts.muted({
850
- base,
851
- dark,
852
- tone: "default",
853
- name,
854
- state: "disabled"
855
- }),
856
- hovered: opts.muted({
857
- base,
858
- dark,
859
- tone: "default",
860
- name,
861
- state: "hovered"
862
- }),
863
- pressed: opts.muted({
864
- base,
865
- dark,
866
- tone: "default",
867
- name,
868
- state: "pressed"
869
- }),
870
- selected: opts.muted({
871
- base,
872
- dark,
873
- tone: "default",
874
- name,
875
- state: "selected"
876
- })
638
+ enabled: opts.muted({ base, dark, tone: "default", name, state: "enabled" }),
639
+ disabled: opts.muted({ base, dark, tone: "default", name, state: "disabled" }),
640
+ hovered: opts.muted({ base, dark, tone: "default", name, state: "hovered" }),
641
+ pressed: opts.muted({ base, dark, tone: "default", name, state: "pressed" }),
642
+ selected: opts.muted({ base, dark, tone: "default", name, state: "selected" })
877
643
  },
878
644
  transparent: {
879
- enabled: opts.muted({
880
- base,
881
- dark,
882
- tone: "transparent",
883
- name,
884
- state: "enabled"
885
- }),
886
- disabled: opts.muted({
887
- base,
888
- dark,
889
- tone: "transparent",
890
- name,
891
- state: "disabled"
892
- }),
893
- hovered: opts.muted({
894
- base,
895
- dark,
896
- tone: "transparent",
897
- name,
898
- state: "hovered"
899
- }),
900
- pressed: opts.muted({
901
- base,
902
- dark,
903
- tone: "transparent",
904
- name,
905
- state: "pressed"
906
- }),
907
- selected: opts.muted({
908
- base,
909
- dark,
910
- tone: "transparent",
911
- name,
912
- state: "selected"
913
- })
645
+ enabled: opts.muted({ base, dark, tone: "transparent", name, state: "enabled" }),
646
+ disabled: opts.muted({ base, dark, tone: "transparent", name, state: "disabled" }),
647
+ hovered: opts.muted({ base, dark, tone: "transparent", name, state: "hovered" }),
648
+ pressed: opts.muted({ base, dark, tone: "transparent", name, state: "pressed" }),
649
+ selected: opts.muted({ base, dark, tone: "transparent", name, state: "selected" })
914
650
  },
915
651
  primary: {
916
- enabled: opts.muted({
917
- base,
918
- dark,
919
- tone: "primary",
920
- name,
921
- state: "enabled"
922
- }),
923
- disabled: opts.muted({
924
- base,
925
- dark,
926
- tone: "primary",
927
- name,
928
- state: "disabled"
929
- }),
930
- hovered: opts.muted({
931
- base,
932
- dark,
933
- tone: "primary",
934
- name,
935
- state: "hovered"
936
- }),
937
- pressed: opts.muted({
938
- base,
939
- dark,
940
- tone: "primary",
941
- name,
942
- state: "pressed"
943
- }),
944
- selected: opts.muted({
945
- base,
946
- dark,
947
- tone: "primary",
948
- name,
949
- state: "selected"
950
- })
652
+ enabled: opts.muted({ base, dark, tone: "primary", name, state: "enabled" }),
653
+ disabled: opts.muted({ base, dark, tone: "primary", name, state: "disabled" }),
654
+ hovered: opts.muted({ base, dark, tone: "primary", name, state: "hovered" }),
655
+ pressed: opts.muted({ base, dark, tone: "primary", name, state: "pressed" }),
656
+ selected: opts.muted({ base, dark, tone: "primary", name, state: "selected" })
951
657
  },
952
658
  positive: {
953
- enabled: opts.muted({
954
- base,
955
- dark,
956
- tone: "positive",
957
- name,
958
- state: "enabled"
959
- }),
960
- disabled: opts.muted({
961
- base,
962
- dark,
963
- tone: "positive",
964
- name,
965
- state: "disabled"
966
- }),
967
- hovered: opts.muted({
968
- base,
969
- dark,
970
- tone: "positive",
971
- name,
972
- state: "hovered"
973
- }),
974
- pressed: opts.muted({
975
- base,
976
- dark,
977
- tone: "positive",
978
- name,
979
- state: "pressed"
980
- }),
981
- selected: opts.muted({
982
- base,
983
- dark,
984
- tone: "positive",
985
- name,
986
- state: "selected"
987
- })
659
+ enabled: opts.muted({ base, dark, tone: "positive", name, state: "enabled" }),
660
+ disabled: opts.muted({ base, dark, tone: "positive", name, state: "disabled" }),
661
+ hovered: opts.muted({ base, dark, tone: "positive", name, state: "hovered" }),
662
+ pressed: opts.muted({ base, dark, tone: "positive", name, state: "pressed" }),
663
+ selected: opts.muted({ base, dark, tone: "positive", name, state: "selected" })
988
664
  },
989
665
  caution: {
990
- enabled: opts.muted({
991
- base,
992
- dark,
993
- tone: "caution",
994
- name,
995
- state: "enabled"
996
- }),
997
- disabled: opts.muted({
998
- base,
999
- dark,
1000
- tone: "caution",
1001
- name,
1002
- state: "disabled"
1003
- }),
1004
- hovered: opts.muted({
1005
- base,
1006
- dark,
1007
- tone: "caution",
1008
- name,
1009
- state: "hovered"
1010
- }),
1011
- pressed: opts.muted({
1012
- base,
1013
- dark,
1014
- tone: "caution",
1015
- name,
1016
- state: "pressed"
1017
- }),
1018
- selected: opts.muted({
1019
- base,
1020
- dark,
1021
- tone: "caution",
1022
- name,
1023
- state: "selected"
1024
- })
666
+ enabled: opts.muted({ base, dark, tone: "caution", name, state: "enabled" }),
667
+ disabled: opts.muted({ base, dark, tone: "caution", name, state: "disabled" }),
668
+ hovered: opts.muted({ base, dark, tone: "caution", name, state: "hovered" }),
669
+ pressed: opts.muted({ base, dark, tone: "caution", name, state: "pressed" }),
670
+ selected: opts.muted({ base, dark, tone: "caution", name, state: "selected" })
1025
671
  },
1026
672
  critical: {
1027
- enabled: opts.muted({
1028
- base,
1029
- dark,
1030
- tone: "critical",
1031
- name,
1032
- state: "enabled"
1033
- }),
1034
- disabled: opts.muted({
1035
- base,
1036
- dark,
1037
- tone: "critical",
1038
- name,
1039
- state: "disabled"
1040
- }),
1041
- hovered: opts.muted({
1042
- base,
1043
- dark,
1044
- tone: "critical",
1045
- name,
1046
- state: "hovered"
1047
- }),
1048
- pressed: opts.muted({
1049
- base,
1050
- dark,
1051
- tone: "critical",
1052
- name,
1053
- state: "pressed"
1054
- }),
1055
- selected: opts.muted({
1056
- base,
1057
- dark,
1058
- tone: "critical",
1059
- name,
1060
- state: "selected"
1061
- })
673
+ enabled: opts.muted({ base, dark, tone: "critical", name, state: "enabled" }),
674
+ disabled: opts.muted({ base, dark, tone: "critical", name, state: "disabled" }),
675
+ hovered: opts.muted({ base, dark, tone: "critical", name, state: "hovered" }),
676
+ pressed: opts.muted({ base, dark, tone: "critical", name, state: "pressed" }),
677
+ selected: opts.muted({ base, dark, tone: "critical", name, state: "selected" })
1062
678
  }
1063
679
  };
1064
680
  }
681
+
1065
682
  function createSpot(opts, base, dark) {
1066
683
  return {
1067
- gray: opts.spot({
1068
- base,
1069
- dark,
1070
- key: "gray"
1071
- }),
1072
- blue: opts.spot({
1073
- base,
1074
- dark,
1075
- key: "blue"
1076
- }),
1077
- purple: opts.spot({
1078
- base,
1079
- dark,
1080
- key: "purple"
1081
- }),
1082
- magenta: opts.spot({
1083
- base,
1084
- dark,
1085
- key: "magenta"
1086
- }),
1087
- red: opts.spot({
1088
- base,
1089
- dark,
1090
- key: "red"
1091
- }),
1092
- orange: opts.spot({
1093
- base,
1094
- dark,
1095
- key: "orange"
1096
- }),
1097
- yellow: opts.spot({
1098
- base,
1099
- dark,
1100
- key: "yellow"
1101
- }),
1102
- green: opts.spot({
1103
- base,
1104
- dark,
1105
- key: "green"
1106
- }),
1107
- cyan: opts.spot({
1108
- base,
1109
- dark,
1110
- key: "cyan"
1111
- })
684
+ gray: opts.spot({ base, dark, key: "gray" }),
685
+ blue: opts.spot({ base, dark, key: "blue" }),
686
+ purple: opts.spot({ base, dark, key: "purple" }),
687
+ magenta: opts.spot({ base, dark, key: "magenta" }),
688
+ red: opts.spot({ base, dark, key: "red" }),
689
+ orange: opts.spot({ base, dark, key: "orange" }),
690
+ yellow: opts.spot({ base, dark, key: "yellow" }),
691
+ green: opts.spot({ base, dark, key: "green" }),
692
+ cyan: opts.spot({ base, dark, key: "cyan" })
1112
693
  };
1113
694
  }
1114
- function createColorTheme() {
1115
- let partialOpts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1116
- const builders = {
1117
- ...defaultOpts,
1118
- ...partialOpts
1119
- };
695
+
696
+ function createColorTheme(partialOpts = {}) {
697
+ const builders = { ...defaultOpts, ...partialOpts };
1120
698
  return {
1121
699
  light: _createColorScheme(builders, false),
1122
700
  dark: _createColorScheme(builders, true)
@@ -1133,10 +711,7 @@ function _createColorScheme(opts, dark) {
1133
711
  };
1134
712
  }
1135
713
  function _createColor(opts, dark, name) {
1136
- const base = opts.base({
1137
- dark,
1138
- name
1139
- });
714
+ const base = opts.base({ dark, name });
1140
715
  const solid = createSolidTones(opts, base, dark, name);
1141
716
  const muted = createMutedTones(opts, base, dark, name);
1142
717
  return {
@@ -1147,94 +722,51 @@ function _createColor(opts, dark, name) {
1147
722
  input: createInputModes(opts, base, dark, solid, muted),
1148
723
  selectable: createSelectableTones(opts, base, dark, solid, muted),
1149
724
  spot: createSpot(opts, base, dark),
1150
- syntax: opts.syntax({
1151
- base,
1152
- dark
1153
- }),
725
+ syntax: opts.syntax({ base, dark }),
1154
726
  solid,
1155
727
  muted
1156
728
  };
1157
729
  }
730
+
1158
731
  const BORDER_WIDTH = 1;
1159
732
  const OUTLINE_WIDTH = 0.5;
1160
733
  const defaultThemeConfig = {
1161
734
  _version: 2,
1162
735
  avatar: {
1163
- sizes: [{
1164
- distance: -4,
1165
- size: 19
1166
- }, {
1167
- distance: -4,
1168
- size: 25
1169
- }, {
1170
- distance: -8,
1171
- size: 33
1172
- }, {
1173
- distance: -12,
1174
- size: 49
1175
- }],
1176
- focusRing: {
1177
- offset: 1,
1178
- width: 1
1179
- }
736
+ sizes: [
737
+ { distance: -4, size: 19 },
738
+ { distance: -4, size: 25 },
739
+ { distance: -8, size: 33 },
740
+ { distance: -12, size: 49 }
741
+ ],
742
+ focusRing: { offset: 1, width: 1 }
1180
743
  },
1181
744
  button: {
1182
745
  textWeight: "medium",
1183
- border: {
1184
- width: BORDER_WIDTH
1185
- },
1186
- focusRing: {
1187
- offset: -1,
1188
- width: 1
1189
- }
746
+ border: { width: BORDER_WIDTH },
747
+ focusRing: { offset: -1, width: 1 }
1190
748
  },
1191
749
  card: {
1192
- border: {
1193
- width: BORDER_WIDTH
1194
- },
1195
- focusRing: {
1196
- offset: -1,
1197
- width: 1
1198
- },
1199
- shadow: {
1200
- outline: OUTLINE_WIDTH
1201
- }
750
+ border: { width: BORDER_WIDTH },
751
+ focusRing: { offset: -1, width: 1 },
752
+ shadow: { outline: OUTLINE_WIDTH }
1202
753
  },
1203
754
  container: [320, 640, 960, 1280, 1600, 1920],
1204
755
  media: [360, 600, 900, 1200, 1800, 2400],
1205
756
  layer: {
1206
- dialog: {
1207
- zOffset: 600
1208
- },
1209
- popover: {
1210
- zOffset: 400
1211
- },
1212
- tooltip: {
1213
- zOffset: 200
1214
- }
757
+ dialog: { zOffset: 600 },
758
+ popover: { zOffset: 400 },
759
+ tooltip: { zOffset: 200 }
1215
760
  },
1216
761
  radius: [0, 1, 3, 6, 9, 12, 21],
1217
- shadow: [null, {
1218
- umbra: [0, 0, 0, 0],
1219
- penumbra: [0, 0, 0, 0],
1220
- ambient: [0, 0, 0, 0]
1221
- }, {
1222
- umbra: [0, 3, 5, -2],
1223
- penumbra: [0, 6, 10, 0],
1224
- ambient: [0, 1, 18, 1]
1225
- }, {
1226
- umbra: [0, 7, 8, -4],
1227
- penumbra: [0, 12, 17, 2],
1228
- ambient: [0, 5, 22, 4]
1229
- }, {
1230
- umbra: [0, 9, 11, -5],
1231
- penumbra: [0, 18, 28, 2],
1232
- ambient: [0, 7, 34, 6]
1233
- }, {
1234
- umbra: [0, 11, 15, -7],
1235
- penumbra: [0, 24, 38, 3],
1236
- ambient: [0, 9, 46, 8]
1237
- }],
762
+ shadow: [
763
+ null,
764
+ { umbra: [0, 0, 0, 0], penumbra: [0, 0, 0, 0], ambient: [0, 0, 0, 0] },
765
+ { umbra: [0, 3, 5, -2], penumbra: [0, 6, 10, 0], ambient: [0, 1, 18, 1] },
766
+ { umbra: [0, 7, 8, -4], penumbra: [0, 12, 17, 2], ambient: [0, 5, 22, 4] },
767
+ { umbra: [0, 9, 11, -5], penumbra: [0, 18, 28, 2], ambient: [0, 7, 34, 6] },
768
+ { umbra: [0, 11, 15, -7], penumbra: [0, 24, 38, 3], ambient: [0, 9, 46, 8] }
769
+ ],
1238
770
  space: [0, 4, 8, 12, 20, 32, 52, 84, 136, 220],
1239
771
  input: {
1240
772
  border: {
@@ -1242,18 +774,12 @@ const defaultThemeConfig = {
1242
774
  },
1243
775
  checkbox: {
1244
776
  size: 17,
1245
- focusRing: {
1246
- offset: -1,
1247
- width: 1
1248
- }
777
+ focusRing: { offset: -1, width: 1 }
1249
778
  },
1250
779
  radio: {
1251
780
  size: 17,
1252
781
  markSize: 9,
1253
- focusRing: {
1254
- offset: -1,
1255
- width: 1
1256
- }
782
+ focusRing: { offset: -1, width: 1 }
1257
783
  },
1258
784
  switch: {
1259
785
  width: 25,
@@ -1261,22 +787,13 @@ const defaultThemeConfig = {
1261
787
  padding: 5,
1262
788
  transitionDurationMs: 150,
1263
789
  transitionTimingFunction: "ease-out",
1264
- focusRing: {
1265
- offset: 1,
1266
- width: 1
1267
- }
790
+ focusRing: { offset: 1, width: 1 }
1268
791
  },
1269
792
  select: {
1270
- focusRing: {
1271
- offset: -1,
1272
- width: 1
1273
- }
793
+ focusRing: { offset: -1, width: 1 }
1274
794
  },
1275
795
  text: {
1276
- focusRing: {
1277
- offset: -1,
1278
- width: 1
1279
- }
796
+ focusRing: { offset: -1, width: 1 }
1280
797
  }
1281
798
  },
1282
799
  style: {
@@ -1292,6 +809,7 @@ const defaultThemeConfig = {
1292
809
  // },
1293
810
  }
1294
811
  };
812
+
1295
813
  const defaultThemeFonts = {
1296
814
  code: {
1297
815
  family: "ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace",
@@ -1301,42 +819,48 @@ const defaultThemeFonts = {
1301
819
  semibold: 600,
1302
820
  bold: 700
1303
821
  },
1304
- sizes: [{
1305
- ascenderHeight: 4,
1306
- descenderHeight: 4,
1307
- fontSize: 10,
1308
- iconSize: 17,
1309
- lineHeight: 15,
1310
- letterSpacing: 0
1311
- }, {
1312
- ascenderHeight: 5,
1313
- descenderHeight: 5,
1314
- fontSize: 13,
1315
- iconSize: 21,
1316
- lineHeight: 19,
1317
- letterSpacing: 0
1318
- }, {
1319
- ascenderHeight: 6,
1320
- descenderHeight: 6,
1321
- fontSize: 16,
1322
- iconSize: 25,
1323
- lineHeight: 23,
1324
- letterSpacing: 0
1325
- }, {
1326
- ascenderHeight: 7,
1327
- descenderHeight: 7,
1328
- fontSize: 19,
1329
- iconSize: 29,
1330
- lineHeight: 27,
1331
- letterSpacing: 0
1332
- }, {
1333
- ascenderHeight: 8,
1334
- descenderHeight: 8,
1335
- fontSize: 22,
1336
- iconSize: 33,
1337
- lineHeight: 31,
1338
- letterSpacing: 0
1339
- }]
822
+ sizes: [
823
+ {
824
+ ascenderHeight: 4,
825
+ descenderHeight: 4,
826
+ fontSize: 10,
827
+ iconSize: 17,
828
+ lineHeight: 15,
829
+ letterSpacing: 0
830
+ },
831
+ {
832
+ ascenderHeight: 5,
833
+ descenderHeight: 5,
834
+ fontSize: 13,
835
+ iconSize: 21,
836
+ lineHeight: 19,
837
+ letterSpacing: 0
838
+ },
839
+ {
840
+ ascenderHeight: 6,
841
+ descenderHeight: 6,
842
+ fontSize: 16,
843
+ iconSize: 25,
844
+ lineHeight: 23,
845
+ letterSpacing: 0
846
+ },
847
+ {
848
+ ascenderHeight: 7,
849
+ descenderHeight: 7,
850
+ fontSize: 19,
851
+ iconSize: 29,
852
+ lineHeight: 27,
853
+ letterSpacing: 0
854
+ },
855
+ {
856
+ ascenderHeight: 8,
857
+ descenderHeight: 8,
858
+ fontSize: 22,
859
+ iconSize: 33,
860
+ lineHeight: 31,
861
+ letterSpacing: 0
862
+ }
863
+ ]
1340
864
  },
1341
865
  heading: {
1342
866
  family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
@@ -1346,49 +870,56 @@ const defaultThemeFonts = {
1346
870
  semibold: 900,
1347
871
  bold: 900
1348
872
  },
1349
- sizes: [{
1350
- ascenderHeight: 5,
1351
- descenderHeight: 5,
1352
- fontSize: 13,
1353
- iconSize: 17,
1354
- lineHeight: 19,
1355
- letterSpacing: 0
1356
- }, {
1357
- ascenderHeight: 6,
1358
- descenderHeight: 6,
1359
- fontSize: 16,
1360
- iconSize: 25,
1361
- lineHeight: 23,
1362
- letterSpacing: 0
1363
- }, {
1364
- ascenderHeight: 7,
1365
- descenderHeight: 7,
1366
- fontSize: 21,
1367
- iconSize: 33,
1368
- lineHeight: 29,
1369
- letterSpacing: 0
1370
- }, {
1371
- ascenderHeight: 8,
1372
- descenderHeight: 8,
1373
- fontSize: 27,
1374
- iconSize: 41,
1375
- lineHeight: 35,
1376
- letterSpacing: 0
1377
- }, {
1378
- ascenderHeight: 9.5,
1379
- descenderHeight: 8.5,
1380
- fontSize: 33,
1381
- iconSize: 49,
1382
- lineHeight: 41,
1383
- letterSpacing: 0
1384
- }, {
1385
- ascenderHeight: 10.5,
1386
- descenderHeight: 9.5,
1387
- fontSize: 38,
1388
- iconSize: 53,
1389
- lineHeight: 47,
1390
- letterSpacing: 0
1391
- }]
873
+ sizes: [
874
+ {
875
+ ascenderHeight: 5,
876
+ descenderHeight: 5,
877
+ fontSize: 13,
878
+ iconSize: 17,
879
+ lineHeight: 19,
880
+ letterSpacing: 0
881
+ },
882
+ {
883
+ ascenderHeight: 6,
884
+ descenderHeight: 6,
885
+ fontSize: 16,
886
+ iconSize: 25,
887
+ lineHeight: 23,
888
+ letterSpacing: 0
889
+ },
890
+ {
891
+ ascenderHeight: 7,
892
+ descenderHeight: 7,
893
+ fontSize: 21,
894
+ iconSize: 33,
895
+ lineHeight: 29,
896
+ letterSpacing: 0
897
+ },
898
+ {
899
+ ascenderHeight: 8,
900
+ descenderHeight: 8,
901
+ fontSize: 27,
902
+ iconSize: 41,
903
+ lineHeight: 35,
904
+ letterSpacing: 0
905
+ },
906
+ {
907
+ ascenderHeight: 9.5,
908
+ descenderHeight: 8.5,
909
+ fontSize: 33,
910
+ iconSize: 49,
911
+ lineHeight: 41,
912
+ letterSpacing: 0
913
+ },
914
+ {
915
+ ascenderHeight: 10.5,
916
+ descenderHeight: 9.5,
917
+ fontSize: 38,
918
+ iconSize: 53,
919
+ lineHeight: 47,
920
+ letterSpacing: 0
921
+ }
922
+ ]
1392
923
  },
1393
924
  label: {
1394
925
  family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", system-ui, sans-serif',
@@ -1398,49 +929,56 @@ const defaultThemeFonts = {
1398
929
  semibold: 800,
1399
930
  bold: 900
1400
931
  },
1401
- sizes: [{
1402
- ascenderHeight: 2,
1403
- descenderHeight: 2,
1404
- fontSize: 8.1,
1405
- iconSize: 13,
1406
- lineHeight: 10,
1407
- letterSpacing: 0.5
1408
- }, {
1409
- ascenderHeight: 2,
1410
- descenderHeight: 2,
1411
- fontSize: 9.5,
1412
- iconSize: 15,
1413
- lineHeight: 11,
1414
- letterSpacing: 0.5
1415
- }, {
1416
- ascenderHeight: 2,
1417
- descenderHeight: 2,
1418
- fontSize: 10.8,
1419
- iconSize: 17,
1420
- lineHeight: 12,
1421
- letterSpacing: 0.5
1422
- }, {
1423
- ascenderHeight: 2,
1424
- descenderHeight: 2,
1425
- fontSize: 12.25,
1426
- iconSize: 19,
1427
- lineHeight: 13,
1428
- letterSpacing: 0.5
1429
- }, {
1430
- ascenderHeight: 2,
1431
- descenderHeight: 2,
1432
- fontSize: 13.6,
1433
- iconSize: 21,
1434
- lineHeight: 14,
1435
- letterSpacing: 0.5
1436
- }, {
1437
- ascenderHeight: 2,
1438
- descenderHeight: 2,
1439
- fontSize: 15,
1440
- iconSize: 23,
1441
- lineHeight: 15,
1442
- letterSpacing: 0.5
1443
- }]
932
+ sizes: [
933
+ {
934
+ ascenderHeight: 2,
935
+ descenderHeight: 2,
936
+ fontSize: 8.1,
937
+ iconSize: 13,
938
+ lineHeight: 10,
939
+ letterSpacing: 0.5
940
+ },
941
+ {
942
+ ascenderHeight: 2,
943
+ descenderHeight: 2,
944
+ fontSize: 9.5,
945
+ iconSize: 15,
946
+ lineHeight: 11,
947
+ letterSpacing: 0.5
948
+ },
949
+ {
950
+ ascenderHeight: 2,
951
+ descenderHeight: 2,
952
+ fontSize: 10.8,
953
+ iconSize: 17,
954
+ lineHeight: 12,
955
+ letterSpacing: 0.5
956
+ },
957
+ {
958
+ ascenderHeight: 2,
959
+ descenderHeight: 2,
960
+ fontSize: 12.25,
961
+ iconSize: 19,
962
+ lineHeight: 13,
963
+ letterSpacing: 0.5
964
+ },
965
+ {
966
+ ascenderHeight: 2,
967
+ descenderHeight: 2,
968
+ fontSize: 13.6,
969
+ iconSize: 21,
970
+ lineHeight: 14,
971
+ letterSpacing: 0.5
972
+ },
973
+ {
974
+ ascenderHeight: 2,
975
+ descenderHeight: 2,
976
+ fontSize: 15,
977
+ iconSize: 23,
978
+ lineHeight: 15,
979
+ letterSpacing: 0.5
980
+ }
981
+ ]
1444
982
  },
1445
983
  text: {
1446
984
  family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
@@ -1450,49 +988,57 @@ const defaultThemeFonts = {
1450
988
  semibold: 600,
1451
989
  bold: 700
1452
990
  },
1453
- sizes: [{
1454
- ascenderHeight: 4,
1455
- descenderHeight: 4,
1456
- fontSize: 10,
1457
- iconSize: 17,
1458
- lineHeight: 15,
1459
- letterSpacing: 0
1460
- }, {
1461
- ascenderHeight: 5,
1462
- descenderHeight: 5,
1463
- fontSize: 13,
1464
- iconSize: 21,
1465
- lineHeight: 19,
1466
- letterSpacing: 0
1467
- }, {
1468
- ascenderHeight: 6,
1469
- descenderHeight: 6,
1470
- fontSize: 15,
1471
- iconSize: 25,
1472
- lineHeight: 23,
1473
- letterSpacing: 0
1474
- }, {
1475
- ascenderHeight: 7,
1476
- descenderHeight: 7,
1477
- fontSize: 18,
1478
- iconSize: 29,
1479
- lineHeight: 27,
1480
- letterSpacing: 0
1481
- }, {
1482
- ascenderHeight: 8,
1483
- descenderHeight: 8,
1484
- fontSize: 21,
1485
- iconSize: 33,
1486
- lineHeight: 31,
1487
- letterSpacing: 0
1488
- }]
991
+ sizes: [
992
+ {
993
+ ascenderHeight: 4,
994
+ descenderHeight: 4,
995
+ fontSize: 10,
996
+ iconSize: 17,
997
+ lineHeight: 15,
998
+ letterSpacing: 0
999
+ },
1000
+ {
1001
+ ascenderHeight: 5,
1002
+ descenderHeight: 5,
1003
+ fontSize: 13,
1004
+ iconSize: 21,
1005
+ lineHeight: 19,
1006
+ letterSpacing: 0
1007
+ },
1008
+ {
1009
+ ascenderHeight: 6,
1010
+ descenderHeight: 6,
1011
+ fontSize: 15,
1012
+ iconSize: 25,
1013
+ lineHeight: 23,
1014
+ letterSpacing: 0
1015
+ },
1016
+ {
1017
+ ascenderHeight: 7,
1018
+ descenderHeight: 7,
1019
+ fontSize: 18,
1020
+ iconSize: 29,
1021
+ lineHeight: 27,
1022
+ letterSpacing: 0
1023
+ },
1024
+ {
1025
+ ascenderHeight: 8,
1026
+ descenderHeight: 8,
1027
+ fontSize: 21,
1028
+ iconSize: 33,
1029
+ lineHeight: 31,
1030
+ letterSpacing: 0
1031
+ }
1032
+ ]
1489
1033
  }
1490
1034
  };
1491
- const cache$4 = /* @__PURE__ */new WeakMap();
1035
+
1036
+ const cache$4 = /* @__PURE__ */ new WeakMap();
1492
1037
  function themeColor_v0_v2(color_v0) {
1493
1038
  var _a, _b, _c;
1494
1039
  const cached_v2 = cache$4.get(color_v0);
1495
- if (cached_v2) return cached_v2;
1040
+ if (cached_v2)
1041
+ return cached_v2;
1496
1042
  const base = stateThemeColor_v0_v2(color_v0, color_v0.card.enabled);
1497
1043
  const color_v2 = {
1498
1044
  _blend: color_v0._blend || (color_v0.dark ? "screen" : "multiply"),
@@ -1680,12 +1226,15 @@ function inputStateThemeColor_v0_v2(state) {
1680
1226
  placeholder: state.placeholder
1681
1227
  };
1682
1228
  }
1683
- const cache$3 = /* @__PURE__ */new WeakMap();
1229
+
1230
+ const cache$3 = /* @__PURE__ */ new WeakMap();
1684
1231
  function getTheme_v2(theme) {
1685
1232
  var _a, _b;
1686
- if ((_a = theme.sanity.v2) == null ? void 0 : _a._resolved) return theme.sanity.v2;
1233
+ if ((_a = theme.sanity.v2) == null ? void 0 : _a._resolved)
1234
+ return theme.sanity.v2;
1687
1235
  const cached_v2 = cache$3.get(theme);
1688
- if (cached_v2) return cached_v2;
1236
+ if (cached_v2)
1237
+ return cached_v2;
1689
1238
  const v2 = {
1690
1239
  _version: 2,
1691
1240
  _resolved: true,
@@ -1727,17 +1276,22 @@ function getTheme_v2(theme) {
1727
1276
  cache$3.set(theme, v2);
1728
1277
  return v2;
1729
1278
  }
1279
+
1730
1280
  function is_v0(themeProp) {
1731
1281
  return themeProp._version === 0;
1732
1282
  }
1283
+
1733
1284
  function is_v2(themeProp) {
1734
1285
  return themeProp._version === 2;
1735
1286
  }
1736
- const cache$2 = /* @__PURE__ */new WeakMap();
1287
+
1288
+ const cache$2 = /* @__PURE__ */ new WeakMap();
1737
1289
  function v0_v2(v0) {
1738
- if (v0.v2) return v0.v2;
1290
+ if (v0.v2)
1291
+ return v0.v2;
1739
1292
  const cached_v2 = cache$2.get(v0);
1740
- if (cached_v2) return cached_v2;
1293
+ if (cached_v2)
1294
+ return cached_v2;
1741
1295
  const {
1742
1296
  avatar,
1743
1297
  button,
@@ -1811,10 +1365,12 @@ function v0_v2(v0) {
1811
1365
  cache$2.set(v0, v2);
1812
1366
  return v2;
1813
1367
  }
1814
- const cache$1 = /* @__PURE__ */new WeakMap();
1368
+
1369
+ const cache$1 = /* @__PURE__ */ new WeakMap();
1815
1370
  function v2_v0(v2) {
1816
1371
  const cachedTheme = cache$1.get(v2);
1817
- if (cachedTheme) return cachedTheme;
1372
+ if (cachedTheme)
1373
+ return cachedTheme;
1818
1374
  const {
1819
1375
  avatar,
1820
1376
  button,
@@ -1918,15 +1474,30 @@ function inputStateThemeColor_v2_v0(t) {
1918
1474
  placeholder: t.placeholder
1919
1475
  };
1920
1476
  }
1477
+
1921
1478
  const THEME_COLOR_SCHEMES = ["light", "dark"];
1922
1479
  const THEME_COLOR_BLEND_MODES = ["multiply", "screen"];
1923
- const THEME_COLOR_CARD_TONES = ["transparent", "default", "primary", "positive", "caution", "critical"];
1924
- const THEME_COLOR_STATE_TONES = ["default", "primary", "positive", "caution", "critical"];
1480
+ const THEME_COLOR_CARD_TONES = [
1481
+ "transparent",
1482
+ "default",
1483
+ "primary",
1484
+ "positive",
1485
+ "caution",
1486
+ "critical"
1487
+ ];
1488
+ const THEME_COLOR_STATE_TONES = [
1489
+ "default",
1490
+ "primary",
1491
+ "positive",
1492
+ "caution",
1493
+ "critical"
1494
+ ];
1925
1495
  const THEME_COLOR_STATES = ["enabled", "hovered", "pressed", "selected", "disabled"];
1926
1496
  const THEME_COLOR_BUTTON_MODES = ["default", "ghost", "bleed"];
1927
1497
  const THEME_COLOR_INPUT_MODES = ["default", "invalid"];
1928
1498
  const THEME_COLOR_INPUT_STATES = ["enabled", "hovered", "readOnly", "disabled"];
1929
1499
  const THEME_COLOR_AVATAR_COLORS = COLOR_HUES;
1500
+
1930
1501
  function isColorBlendModeValue(str) {
1931
1502
  return THEME_COLOR_BLEND_MODES.includes(str);
1932
1503
  }
@@ -1939,8 +1510,35 @@ function isColorTintKey(str) {
1939
1510
  function isColorButtonMode(str) {
1940
1511
  return THEME_COLOR_BUTTON_MODES.includes(str);
1941
1512
  }
1942
- const COLOR_CONFIG_STATE_KEYS = ["_hue", "bg", "fg", "border", "focusRing", "muted/fg", "accent/fg", "link/fg", "code/bg", "code/fg", "skeleton/from", "skeleton/to", "status/dot", "status/icon"];
1943
- const COLOR_CONFIG_CARD_KEYS = [...COLOR_CONFIG_STATE_KEYS, "_hue", "bg", "fg", "border", "focusRing", "shadow/outline", "shadow/umbra", "shadow/penumbra", "shadow/ambient"];
1513
+
1514
+ const COLOR_CONFIG_STATE_KEYS = [
1515
+ "_hue",
1516
+ "bg",
1517
+ "fg",
1518
+ "border",
1519
+ "focusRing",
1520
+ "muted/fg",
1521
+ "accent/fg",
1522
+ "link/fg",
1523
+ "code/bg",
1524
+ "code/fg",
1525
+ "skeleton/from",
1526
+ "skeleton/to",
1527
+ "status/dot",
1528
+ "status/icon"
1529
+ ];
1530
+ const COLOR_CONFIG_CARD_KEYS = [
1531
+ ...COLOR_CONFIG_STATE_KEYS,
1532
+ "_hue",
1533
+ "bg",
1534
+ "fg",
1535
+ "border",
1536
+ "focusRing",
1537
+ "shadow/outline",
1538
+ "shadow/umbra",
1539
+ "shadow/penumbra",
1540
+ "shadow/ambient"
1541
+ ];
1944
1542
  const COLOR_CONFIG_BLEND_KEYS = ["_blend"];
1945
1543
  const COLOR_CONFIG_AVATAR_COLORS = ["*", ...THEME_COLOR_AVATAR_COLORS];
1946
1544
  const COLOR_CONFIG_CARD_TONES = ["*", ...THEME_COLOR_CARD_TONES];
@@ -1948,6 +1546,7 @@ const COLOR_CONFIG_STATE_TONES = ["*", ...THEME_COLOR_STATE_TONES];
1948
1546
  const COLOR_CONFIG_STATES = ["*", ...THEME_COLOR_STATES];
1949
1547
  const COLOR_CONFIG_INPUT_MODES = ["*", ...THEME_COLOR_INPUT_MODES];
1950
1548
  const COLOR_CONFIG_INPUT_STATES = ["*", ...THEME_COLOR_INPUT_STATES];
1549
+
1951
1550
  function parseTokenKey(str) {
1952
1551
  const segments = str.split("/");
1953
1552
  const segment0 = segments.shift() || "";
@@ -1995,6 +1594,7 @@ function parseTokenKey(str) {
1995
1594
  }
1996
1595
  return void 0;
1997
1596
  }
1597
+
1998
1598
  function isColorMixPercentValue(str) {
1999
1599
  return /^\d+%$/.test(str);
2000
1600
  }
@@ -2095,6 +1695,7 @@ function parseTokenValue(str) {
2095
1695
  }
2096
1696
  return void 0;
2097
1697
  }
1698
+
2098
1699
  function isColorConfigBaseTone(str) {
2099
1700
  return COLOR_CONFIG_CARD_TONES.includes(str);
2100
1701
  }
@@ -2120,6 +1721,7 @@ function isColorValue(str) {
2120
1721
  function isColorOpacityValue(str) {
2121
1722
  return str === "0" || /^0\.[0-9]+$/.test(str) || str === "1";
2122
1723
  }
1724
+
2123
1725
  function compileColorTokenValue(node) {
2124
1726
  let key = "";
2125
1727
  if (node.key === "black" || node.key === "white") {
@@ -2135,22 +1737,17 @@ function compileColorTokenValue(node) {
2135
1737
  }
2136
1738
  return key;
2137
1739
  }
1740
+
2138
1741
  const DEFAULT_COLOR_TOKEN_VALUE = ["500", "500"];
2139
- function resolveColorTokenValue(context) {
2140
- let value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_COLOR_TOKEN_VALUE;
2141
- const {
2142
- hue,
2143
- scheme
2144
- } = context;
1742
+ function resolveColorTokenValue(context, value = DEFAULT_COLOR_TOKEN_VALUE) {
1743
+ const { hue, scheme } = context;
2145
1744
  const node = parseTokenValue(value[scheme === "light" ? 0 : 1]);
2146
1745
  if (!node || node.type !== "color") {
2147
1746
  throw new Error("Invalid color token: ".concat(value[0]));
2148
1747
  }
2149
- return compileColorTokenValue({
2150
- ...node,
2151
- hue: node.hue || hue
2152
- });
1748
+ return compileColorTokenValue({ ...node, hue: node.hue || hue });
2153
1749
  }
1750
+
2154
1751
  const defaultColorTokens = {
2155
1752
  base: {
2156
1753
  "*": {
@@ -2224,24 +1821,16 @@ const defaultColorTokens = {
2224
1821
  fg: ["600", "400"]
2225
1822
  }
2226
1823
  },
2227
- primary: {
2228
- _hue: "blue"
2229
- },
1824
+ primary: { _hue: "blue" },
2230
1825
  positive: {
2231
1826
  _hue: "green",
2232
- shadow: {
2233
- outline: ["500/0.4", "500/0.4"]
2234
- }
1827
+ shadow: { outline: ["500/0.4", "500/0.4"] }
2235
1828
  },
2236
1829
  caution: {
2237
1830
  _hue: "yellow",
2238
- shadow: {
2239
- outline: ["600/0.3", "500/0.4"]
2240
- }
1831
+ shadow: { outline: ["600/0.3", "500/0.4"] }
2241
1832
  },
2242
- critical: {
2243
- _hue: "red"
2244
- }
1833
+ critical: { _hue: "red" }
2245
1834
  },
2246
1835
  button: {
2247
1836
  default: {
@@ -2735,13 +2324,12 @@ const defaultColorTokens = {
2735
2324
  variable: ["red/600", "red/400"]
2736
2325
  }
2737
2326
  };
2327
+
2738
2328
  function isRecord(value) {
2739
2329
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
2740
2330
  }
2741
- function merge() {
2742
- for (var _len = arguments.length, records = new Array(_len), _key = 0; _key < _len; _key++) {
2743
- records[_key] = arguments[_key];
2744
- }
2331
+
2332
+ function merge(...records) {
2745
2333
  const _records = records.filter(Boolean);
2746
2334
  if (_records.length === 0) {
2747
2335
  return {};
@@ -2760,6 +2348,7 @@ function _merge(acc, source) {
2760
2348
  }
2761
2349
  return acc;
2762
2350
  }
2351
+
2763
2352
  function resolveColorTokens(inputTokens) {
2764
2353
  const tokens = merge(defaultColorTokens, inputTokens);
2765
2354
  return {
@@ -2785,59 +2374,41 @@ function resolveBaseColorTones(inputTokens, tone) {
2785
2374
  ...spec,
2786
2375
  _hue: hue,
2787
2376
  avatar: {
2788
- gray: merge({
2789
- _hue: "gray"
2790
- }, (_e = spec.avatar) == null ? void 0 : _e["*"], (_f = spec.avatar) == null ? void 0 : _f.gray),
2791
- blue: merge({
2792
- _hue: "blue"
2793
- }, (_g = spec.avatar) == null ? void 0 : _g["*"], (_h = spec.avatar) == null ? void 0 : _h.blue),
2794
- purple: merge({
2795
- _hue: "purple"
2796
- }, (_i = spec.avatar) == null ? void 0 : _i["*"], (_j = spec.avatar) == null ? void 0 : _j.purple),
2797
- magenta: merge({
2798
- _hue: "magenta"
2799
- }, (_k = spec.avatar) == null ? void 0 : _k["*"], (_l = spec.avatar) == null ? void 0 : _l.magenta),
2800
- red: merge({
2801
- _hue: "red"
2802
- }, (_m = spec.avatar) == null ? void 0 : _m["*"], (_n = spec.avatar) == null ? void 0 : _n.red),
2803
- orange: merge({
2804
- _hue: "orange"
2805
- }, (_o = spec.avatar) == null ? void 0 : _o["*"], (_p = spec.avatar) == null ? void 0 : _p.orange),
2806
- yellow: merge({
2807
- _hue: "yellow"
2808
- }, (_q = spec.avatar) == null ? void 0 : _q["*"], (_r = spec.avatar) == null ? void 0 : _r.yellow),
2809
- green: merge({
2810
- _hue: "green"
2811
- }, (_s = spec.avatar) == null ? void 0 : _s["*"], (_t = spec.avatar) == null ? void 0 : _t.green),
2812
- cyan: merge({
2813
- _hue: "cyan"
2814
- }, (_u = spec.avatar) == null ? void 0 : _u["*"], (_v = spec.avatar) == null ? void 0 : _v.cyan)
2377
+ gray: merge({ _hue: "gray" }, (_e = spec.avatar) == null ? void 0 : _e["*"], (_f = spec.avatar) == null ? void 0 : _f.gray),
2378
+ blue: merge({ _hue: "blue" }, (_g = spec.avatar) == null ? void 0 : _g["*"], (_h = spec.avatar) == null ? void 0 : _h.blue),
2379
+ purple: merge({ _hue: "purple" }, (_i = spec.avatar) == null ? void 0 : _i["*"], (_j = spec.avatar) == null ? void 0 : _j.purple),
2380
+ magenta: merge({ _hue: "magenta" }, (_k = spec.avatar) == null ? void 0 : _k["*"], (_l = spec.avatar) == null ? void 0 : _l.magenta),
2381
+ red: merge({ _hue: "red" }, (_m = spec.avatar) == null ? void 0 : _m["*"], (_n = spec.avatar) == null ? void 0 : _n.red),
2382
+ orange: merge({ _hue: "orange" }, (_o = spec.avatar) == null ? void 0 : _o["*"], (_p = spec.avatar) == null ? void 0 : _p.orange),
2383
+ yellow: merge({ _hue: "yellow" }, (_q = spec.avatar) == null ? void 0 : _q["*"], (_r = spec.avatar) == null ? void 0 : _r.yellow),
2384
+ green: merge({ _hue: "green" }, (_s = spec.avatar) == null ? void 0 : _s["*"], (_t = spec.avatar) == null ? void 0 : _t.green),
2385
+ cyan: merge({ _hue: "cyan" }, (_u = spec.avatar) == null ? void 0 : _u["*"], (_v = spec.avatar) == null ? void 0 : _v.cyan)
2815
2386
  },
2816
2387
  badge: {
2817
2388
  default: {
2818
2389
  _hue: ((_x = (_w = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _w.default) == null ? void 0 : _x._hue) || hue,
2819
- ...((_y = spec.badge) == null ? void 0 : _y["*"]),
2820
- ...((_z = spec.badge) == null ? void 0 : _z.default)
2390
+ ...(_y = spec.badge) == null ? void 0 : _y["*"],
2391
+ ...(_z = spec.badge) == null ? void 0 : _z.default
2821
2392
  },
2822
2393
  primary: {
2823
2394
  _hue: ((_B = (_A = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _A.primary) == null ? void 0 : _B._hue) || hue,
2824
- ...((_C = spec.badge) == null ? void 0 : _C["*"]),
2825
- ...((_D = spec.badge) == null ? void 0 : _D.primary)
2395
+ ...(_C = spec.badge) == null ? void 0 : _C["*"],
2396
+ ...(_D = spec.badge) == null ? void 0 : _D.primary
2826
2397
  },
2827
2398
  positive: {
2828
2399
  _hue: ((_F = (_E = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _E.positive) == null ? void 0 : _F._hue) || hue,
2829
- ...((_G = spec.badge) == null ? void 0 : _G["*"]),
2830
- ...((_H = spec.badge) == null ? void 0 : _H.positive)
2400
+ ...(_G = spec.badge) == null ? void 0 : _G["*"],
2401
+ ...(_H = spec.badge) == null ? void 0 : _H.positive
2831
2402
  },
2832
2403
  caution: {
2833
2404
  _hue: ((_J = (_I = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _I.caution) == null ? void 0 : _J._hue) || hue,
2834
- ...((_K = spec.badge) == null ? void 0 : _K["*"]),
2835
- ...((_L = spec.badge) == null ? void 0 : _L.caution)
2405
+ ...(_K = spec.badge) == null ? void 0 : _K["*"],
2406
+ ...(_L = spec.badge) == null ? void 0 : _L.caution
2836
2407
  },
2837
2408
  critical: {
2838
2409
  _hue: ((_N = (_M = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _M.critical) == null ? void 0 : _N._hue) || hue,
2839
- ...((_O = spec.badge) == null ? void 0 : _O["*"]),
2840
- ...((_P = spec.badge) == null ? void 0 : _P.critical)
2410
+ ...(_O = spec.badge) == null ? void 0 : _O["*"],
2411
+ ...(_P = spec.badge) == null ? void 0 : _P.critical
2841
2412
  }
2842
2413
  }
2843
2414
  };
@@ -2865,65 +2436,52 @@ function resolveButtonModeColorTokens(inputTokens, mode, tone) {
2865
2436
  }
2866
2437
  function resolveButtonStateColorTokens(inputTokens, tone, mode, state) {
2867
2438
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z;
2868
- const spec = merge((_c = (_b = (_a = inputTokens == null ? void 0 : inputTokens.button) == null ? void 0 : _a[mode]) == null ? void 0 : _b["*"]) == null ? void 0 : _c["*"], (_f = (_e = (_d = inputTokens == null ? void 0 : inputTokens.button) == null ? void 0 : _d[mode]) == null ? void 0 : _e[tone]) == null ? void 0 : _f["*"], (_i = (_h = (_g = inputTokens == null ? void 0 : inputTokens.button) == null ? void 0 : _g[mode]) == null ? void 0 : _h["*"]) == null ? void 0 : _i[state], (_l = (_k = (_j = inputTokens == null ? void 0 : inputTokens.button) == null ? void 0 : _j[mode]) == null ? void 0 : _k[tone]) == null ? void 0 : _l[state]);
2439
+ const spec = merge(
2440
+ (_c = (_b = (_a = inputTokens == null ? void 0 : inputTokens.button) == null ? void 0 : _a[mode]) == null ? void 0 : _b["*"]) == null ? void 0 : _c["*"],
2441
+ (_f = (_e = (_d = inputTokens == null ? void 0 : inputTokens.button) == null ? void 0 : _d[mode]) == null ? void 0 : _e[tone]) == null ? void 0 : _f["*"],
2442
+ (_i = (_h = (_g = inputTokens == null ? void 0 : inputTokens.button) == null ? void 0 : _g[mode]) == null ? void 0 : _h["*"]) == null ? void 0 : _i[state],
2443
+ (_l = (_k = (_j = inputTokens == null ? void 0 : inputTokens.button) == null ? void 0 : _j[mode]) == null ? void 0 : _k[tone]) == null ? void 0 : _l[state]
2444
+ );
2869
2445
  const hue = spec._hue || ((_n = (_m = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _m[tone]) == null ? void 0 : _n._hue);
2870
2446
  return {
2871
2447
  ...spec,
2872
2448
  _hue: hue,
2873
2449
  avatar: {
2874
- gray: merge({
2875
- _hue: "gray"
2876
- }, (_o = spec.avatar) == null ? void 0 : _o["*"], (_p = spec.avatar) == null ? void 0 : _p.gray),
2877
- blue: merge({
2878
- _hue: "blue"
2879
- }, (_q = spec.avatar) == null ? void 0 : _q["*"], (_r = spec.avatar) == null ? void 0 : _r.blue),
2880
- purple: merge({
2881
- _hue: "purple"
2882
- }, (_s = spec.avatar) == null ? void 0 : _s["*"], (_t = spec.avatar) == null ? void 0 : _t.purple),
2883
- magenta: merge({
2884
- _hue: "magenta"
2885
- }, (_u = spec.avatar) == null ? void 0 : _u["*"], (_v = spec.avatar) == null ? void 0 : _v.magenta),
2886
- red: merge({
2887
- _hue: "red"
2888
- }, (_w = spec.avatar) == null ? void 0 : _w["*"], (_x = spec.avatar) == null ? void 0 : _x.red),
2889
- orange: merge({
2890
- _hue: "orange"
2891
- }, (_y = spec.avatar) == null ? void 0 : _y["*"], (_z = spec.avatar) == null ? void 0 : _z.orange),
2892
- yellow: merge({
2893
- _hue: "yellow"
2894
- }, (_A = spec.avatar) == null ? void 0 : _A["*"], (_B = spec.avatar) == null ? void 0 : _B.yellow),
2895
- green: merge({
2896
- _hue: "green"
2897
- }, (_C = spec.avatar) == null ? void 0 : _C["*"], (_D = spec.avatar) == null ? void 0 : _D.green),
2898
- cyan: merge({
2899
- _hue: "cyan"
2900
- }, (_E = spec.avatar) == null ? void 0 : _E["*"], (_F = spec.avatar) == null ? void 0 : _F.cyan)
2450
+ gray: merge({ _hue: "gray" }, (_o = spec.avatar) == null ? void 0 : _o["*"], (_p = spec.avatar) == null ? void 0 : _p.gray),
2451
+ blue: merge({ _hue: "blue" }, (_q = spec.avatar) == null ? void 0 : _q["*"], (_r = spec.avatar) == null ? void 0 : _r.blue),
2452
+ purple: merge({ _hue: "purple" }, (_s = spec.avatar) == null ? void 0 : _s["*"], (_t = spec.avatar) == null ? void 0 : _t.purple),
2453
+ magenta: merge({ _hue: "magenta" }, (_u = spec.avatar) == null ? void 0 : _u["*"], (_v = spec.avatar) == null ? void 0 : _v.magenta),
2454
+ red: merge({ _hue: "red" }, (_w = spec.avatar) == null ? void 0 : _w["*"], (_x = spec.avatar) == null ? void 0 : _x.red),
2455
+ orange: merge({ _hue: "orange" }, (_y = spec.avatar) == null ? void 0 : _y["*"], (_z = spec.avatar) == null ? void 0 : _z.orange),
2456
+ yellow: merge({ _hue: "yellow" }, (_A = spec.avatar) == null ? void 0 : _A["*"], (_B = spec.avatar) == null ? void 0 : _B.yellow),
2457
+ green: merge({ _hue: "green" }, (_C = spec.avatar) == null ? void 0 : _C["*"], (_D = spec.avatar) == null ? void 0 : _D.green),
2458
+ cyan: merge({ _hue: "cyan" }, (_E = spec.avatar) == null ? void 0 : _E["*"], (_F = spec.avatar) == null ? void 0 : _F.cyan)
2901
2459
  },
2902
2460
  badge: {
2903
2461
  default: {
2904
2462
  _hue: (_H = (_G = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _G.default) == null ? void 0 : _H._hue,
2905
- ...((_I = spec.badge) == null ? void 0 : _I["*"]),
2906
- ...((_J = spec.badge) == null ? void 0 : _J.default)
2463
+ ...(_I = spec.badge) == null ? void 0 : _I["*"],
2464
+ ...(_J = spec.badge) == null ? void 0 : _J.default
2907
2465
  },
2908
2466
  primary: {
2909
2467
  _hue: (_L = (_K = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _K.primary) == null ? void 0 : _L._hue,
2910
- ...((_M = spec.badge) == null ? void 0 : _M["*"]),
2911
- ...((_N = spec.badge) == null ? void 0 : _N.primary)
2468
+ ...(_M = spec.badge) == null ? void 0 : _M["*"],
2469
+ ...(_N = spec.badge) == null ? void 0 : _N.primary
2912
2470
  },
2913
2471
  positive: {
2914
2472
  _hue: (_P = (_O = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _O.positive) == null ? void 0 : _P._hue,
2915
- ...((_Q = spec.badge) == null ? void 0 : _Q["*"]),
2916
- ...((_R = spec.badge) == null ? void 0 : _R.positive)
2473
+ ...(_Q = spec.badge) == null ? void 0 : _Q["*"],
2474
+ ...(_R = spec.badge) == null ? void 0 : _R.positive
2917
2475
  },
2918
2476
  caution: {
2919
2477
  _hue: (_T = (_S = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _S.caution) == null ? void 0 : _T._hue,
2920
- ...((_U = spec.badge) == null ? void 0 : _U["*"]),
2921
- ...((_V = spec.badge) == null ? void 0 : _V.caution)
2478
+ ...(_U = spec.badge) == null ? void 0 : _U["*"],
2479
+ ...(_V = spec.badge) == null ? void 0 : _V.caution
2922
2480
  },
2923
2481
  critical: {
2924
2482
  _hue: (_X = (_W = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _W.critical) == null ? void 0 : _X._hue,
2925
- ...((_Y = spec.badge) == null ? void 0 : _Y["*"]),
2926
- ...((_Z = spec.badge) == null ? void 0 : _Z.critical)
2483
+ ...(_Y = spec.badge) == null ? void 0 : _Y["*"],
2484
+ ...(_Z = spec.badge) == null ? void 0 : _Z.critical
2927
2485
  }
2928
2486
  }
2929
2487
  };
@@ -2944,12 +2502,14 @@ function resolveInputModeColorTokens(inputTokens, mode) {
2944
2502
  }
2945
2503
  function resolveInputStateColorTokens(inputTokens, mode, state) {
2946
2504
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
2947
- const spec = merge((_b = (_a = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _a["*"]) == null ? void 0 : _b["*"], (_d = (_c = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _c[mode]) == null ? void 0 : _d["*"], (_f = (_e = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _e["*"]) == null ? void 0 : _f[state], (_h = (_g = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _g[mode]) == null ? void 0 : _h[state]);
2505
+ const spec = merge(
2506
+ (_b = (_a = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _a["*"]) == null ? void 0 : _b["*"],
2507
+ (_d = (_c = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _c[mode]) == null ? void 0 : _d["*"],
2508
+ (_f = (_e = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _e["*"]) == null ? void 0 : _f[state],
2509
+ (_h = (_g = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _g[mode]) == null ? void 0 : _h[state]
2510
+ );
2948
2511
  const hue = spec._hue || ((_j = (_i = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _i[mode]) == null ? void 0 : _j._hue);
2949
- return {
2950
- ...spec,
2951
- _hue: hue
2952
- };
2512
+ return { ...spec, _hue: hue };
2953
2513
  }
2954
2514
  function resolveSelectableColorTokens(inputTokens) {
2955
2515
  const tokens = {};
@@ -2970,126 +2530,84 @@ function resolveSelectableToneColorTokens(inputTokens, tone) {
2970
2530
  }
2971
2531
  function resolveSelectableStateColorTokens(inputTokens, tone, state) {
2972
2532
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V;
2973
- const spec = merge((_b = (_a = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _a["*"]) == null ? void 0 : _b["*"], (_d = (_c = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _c[tone]) == null ? void 0 : _d["*"], (_f = (_e = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _e["*"]) == null ? void 0 : _f[state], (_h = (_g = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _g[tone]) == null ? void 0 : _h[state]);
2533
+ const spec = merge(
2534
+ (_b = (_a = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _a["*"]) == null ? void 0 : _b["*"],
2535
+ (_d = (_c = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _c[tone]) == null ? void 0 : _d["*"],
2536
+ (_f = (_e = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _e["*"]) == null ? void 0 : _f[state],
2537
+ (_h = (_g = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _g[tone]) == null ? void 0 : _h[state]
2538
+ );
2974
2539
  const hue = spec._hue || ((_j = (_i = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _i[tone]) == null ? void 0 : _j._hue);
2975
2540
  return {
2976
2541
  ...spec,
2977
2542
  _hue: hue,
2978
2543
  avatar: {
2979
- gray: merge({
2980
- _hue: "gray"
2981
- }, (_k = spec.avatar) == null ? void 0 : _k["*"], (_l = spec.avatar) == null ? void 0 : _l.gray),
2982
- blue: merge({
2983
- _hue: "blue"
2984
- }, (_m = spec.avatar) == null ? void 0 : _m["*"], (_n = spec.avatar) == null ? void 0 : _n.blue),
2985
- purple: merge({
2986
- _hue: "purple"
2987
- }, (_o = spec.avatar) == null ? void 0 : _o["*"], (_p = spec.avatar) == null ? void 0 : _p.purple),
2988
- magenta: merge({
2989
- _hue: "magenta"
2990
- }, (_q = spec.avatar) == null ? void 0 : _q["*"], (_r = spec.avatar) == null ? void 0 : _r.magenta),
2991
- red: merge({
2992
- _hue: "red"
2993
- }, (_s = spec.avatar) == null ? void 0 : _s["*"], (_t = spec.avatar) == null ? void 0 : _t.red),
2994
- orange: merge({
2995
- _hue: "orange"
2996
- }, (_u = spec.avatar) == null ? void 0 : _u["*"], (_v = spec.avatar) == null ? void 0 : _v.orange),
2997
- yellow: merge({
2998
- _hue: "yellow"
2999
- }, (_w = spec.avatar) == null ? void 0 : _w["*"], (_x = spec.avatar) == null ? void 0 : _x.yellow),
3000
- green: merge({
3001
- _hue: "green"
3002
- }, (_y = spec.avatar) == null ? void 0 : _y["*"], (_z = spec.avatar) == null ? void 0 : _z.green),
3003
- cyan: merge({
3004
- _hue: "cyan"
3005
- }, (_A = spec.avatar) == null ? void 0 : _A["*"], (_B = spec.avatar) == null ? void 0 : _B.cyan)
2544
+ gray: merge({ _hue: "gray" }, (_k = spec.avatar) == null ? void 0 : _k["*"], (_l = spec.avatar) == null ? void 0 : _l.gray),
2545
+ blue: merge({ _hue: "blue" }, (_m = spec.avatar) == null ? void 0 : _m["*"], (_n = spec.avatar) == null ? void 0 : _n.blue),
2546
+ purple: merge({ _hue: "purple" }, (_o = spec.avatar) == null ? void 0 : _o["*"], (_p = spec.avatar) == null ? void 0 : _p.purple),
2547
+ magenta: merge({ _hue: "magenta" }, (_q = spec.avatar) == null ? void 0 : _q["*"], (_r = spec.avatar) == null ? void 0 : _r.magenta),
2548
+ red: merge({ _hue: "red" }, (_s = spec.avatar) == null ? void 0 : _s["*"], (_t = spec.avatar) == null ? void 0 : _t.red),
2549
+ orange: merge({ _hue: "orange" }, (_u = spec.avatar) == null ? void 0 : _u["*"], (_v = spec.avatar) == null ? void 0 : _v.orange),
2550
+ yellow: merge({ _hue: "yellow" }, (_w = spec.avatar) == null ? void 0 : _w["*"], (_x = spec.avatar) == null ? void 0 : _x.yellow),
2551
+ green: merge({ _hue: "green" }, (_y = spec.avatar) == null ? void 0 : _y["*"], (_z = spec.avatar) == null ? void 0 : _z.green),
2552
+ cyan: merge({ _hue: "cyan" }, (_A = spec.avatar) == null ? void 0 : _A["*"], (_B = spec.avatar) == null ? void 0 : _B.cyan)
3006
2553
  },
3007
2554
  badge: {
3008
2555
  default: {
3009
2556
  _hue: (_D = (_C = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _C.default) == null ? void 0 : _D._hue,
3010
- ...((_E = spec.badge) == null ? void 0 : _E["*"]),
3011
- ...((_F = spec.badge) == null ? void 0 : _F.default)
2557
+ ...(_E = spec.badge) == null ? void 0 : _E["*"],
2558
+ ...(_F = spec.badge) == null ? void 0 : _F.default
3012
2559
  },
3013
2560
  primary: {
3014
2561
  _hue: (_H = (_G = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _G.primary) == null ? void 0 : _H._hue,
3015
- ...((_I = spec.badge) == null ? void 0 : _I["*"]),
3016
- ...((_J = spec.badge) == null ? void 0 : _J.primary)
2562
+ ...(_I = spec.badge) == null ? void 0 : _I["*"],
2563
+ ...(_J = spec.badge) == null ? void 0 : _J.primary
3017
2564
  },
3018
2565
  positive: {
3019
2566
  _hue: (_L = (_K = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _K.positive) == null ? void 0 : _L._hue,
3020
- ...((_M = spec.badge) == null ? void 0 : _M["*"]),
3021
- ...((_N = spec.badge) == null ? void 0 : _N.positive)
2567
+ ...(_M = spec.badge) == null ? void 0 : _M["*"],
2568
+ ...(_N = spec.badge) == null ? void 0 : _N.positive
3022
2569
  },
3023
2570
  caution: {
3024
2571
  _hue: (_P = (_O = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _O.caution) == null ? void 0 : _P._hue,
3025
- ...((_Q = spec.badge) == null ? void 0 : _Q["*"]),
3026
- ...((_R = spec.badge) == null ? void 0 : _R.caution)
2572
+ ...(_Q = spec.badge) == null ? void 0 : _Q["*"],
2573
+ ...(_R = spec.badge) == null ? void 0 : _R.caution
3027
2574
  },
3028
2575
  critical: {
3029
2576
  _hue: (_T = (_S = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _S.critical) == null ? void 0 : _T._hue,
3030
- ...((_U = spec.badge) == null ? void 0 : _U["*"]),
3031
- ...((_V = spec.badge) == null ? void 0 : _V.critical)
2577
+ ...(_U = spec.badge) == null ? void 0 : _U["*"],
2578
+ ...(_V = spec.badge) == null ? void 0 : _V.critical
3032
2579
  }
3033
2580
  }
3034
2581
  };
3035
2582
  }
2583
+
3036
2584
  function buildColorTheme(config) {
3037
2585
  const resolvedConfig = {
3038
2586
  ...config,
3039
2587
  color: resolveColorTokens(config == null ? void 0 : config.color)
3040
2588
  };
3041
2589
  return {
3042
- light: buildColorScheme({
3043
- scheme: "light"
3044
- }, resolvedConfig),
3045
- dark: buildColorScheme({
3046
- scheme: "dark"
3047
- }, resolvedConfig)
2590
+ light: buildColorScheme({ scheme: "light" }, resolvedConfig),
2591
+ dark: buildColorScheme({ scheme: "dark" }, resolvedConfig)
3048
2592
  };
3049
2593
  }
3050
2594
  function buildColorScheme(options, config) {
3051
- const {
3052
- scheme
3053
- } = options;
2595
+ const { scheme } = options;
3054
2596
  return {
3055
- transparent: buildCardColorTheme({
3056
- scheme,
3057
- tone: "transparent"
3058
- }, config),
3059
- default: buildCardColorTheme({
3060
- scheme,
3061
- tone: "default"
3062
- }, config),
3063
- primary: buildCardColorTheme({
3064
- scheme,
3065
- tone: "primary"
3066
- }, config),
3067
- positive: buildCardColorTheme({
3068
- scheme,
3069
- tone: "positive"
3070
- }, config),
3071
- caution: buildCardColorTheme({
3072
- scheme,
3073
- tone: "caution"
3074
- }, config),
3075
- critical: buildCardColorTheme({
3076
- scheme,
3077
- tone: "critical"
3078
- }, config)
2597
+ transparent: buildCardColorTheme({ scheme, tone: "transparent" }, config),
2598
+ default: buildCardColorTheme({ scheme, tone: "default" }, config),
2599
+ primary: buildCardColorTheme({ scheme, tone: "primary" }, config),
2600
+ positive: buildCardColorTheme({ scheme, tone: "positive" }, config),
2601
+ caution: buildCardColorTheme({ scheme, tone: "caution" }, config),
2602
+ critical: buildCardColorTheme({ scheme, tone: "critical" }, config)
3079
2603
  };
3080
2604
  }
3081
2605
  function buildCardColorTheme(options, config) {
3082
2606
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
3083
- const {
3084
- scheme,
3085
- tone
3086
- } = options;
2607
+ const { scheme, tone } = options;
3087
2608
  const tokens = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.base) == null ? void 0 : _b[tone];
3088
2609
  const hue = (tokens == null ? void 0 : tokens._hue) || "gray";
3089
- const context = {
3090
- hue,
3091
- scheme
3092
- };
2610
+ const context = { hue, scheme };
3093
2611
  const blendMode = (tokens == null ? void 0 : tokens._blend) || ["multiply", "screen"];
3094
2612
  return {
3095
2613
  _blend: blendMode[scheme === "light" ? 0 : 1],
@@ -3097,18 +2615,12 @@ function buildCardColorTheme(options, config) {
3097
2615
  accent: {
3098
2616
  fg: resolveColorTokenValue(context, (_c = tokens == null ? void 0 : tokens.accent) == null ? void 0 : _c.fg)
3099
2617
  },
3100
- avatar: buildAvatarColorTheme({
3101
- scheme
3102
- }, tokens),
2618
+ avatar: buildAvatarColorTheme({ scheme }, tokens),
3103
2619
  backdrop: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.backdrop),
3104
- badge: buildBadgeColorTheme(tokens == null ? void 0 : tokens.badge, {
3105
- scheme
3106
- }, config),
2620
+ badge: buildBadgeColorTheme(tokens == null ? void 0 : tokens.badge, { scheme }, config),
3107
2621
  bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
3108
2622
  border: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.border),
3109
- button: buildButtonColorTheme({
3110
- scheme
3111
- }, config),
2623
+ button: buildButtonColorTheme({ scheme }, config),
3112
2624
  code: {
3113
2625
  bg: resolveColorTokenValue(context, (_d = tokens == null ? void 0 : tokens.code) == null ? void 0 : _d.bg),
3114
2626
  fg: resolveColorTokenValue(context, (_e = tokens == null ? void 0 : tokens.code) == null ? void 0 : _e.fg)
@@ -3116,10 +2628,7 @@ function buildCardColorTheme(options, config) {
3116
2628
  fg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.fg),
3117
2629
  focusRing: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.focusRing),
3118
2630
  icon: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.icon),
3119
- input: buildInputColorTheme({
3120
- scheme,
3121
- tone
3122
- }, config),
2631
+ input: buildInputColorTheme({ scheme, tone }, config),
3123
2632
  kbd: {
3124
2633
  bg: resolveColorTokenValue(context, (_f = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _f.bg),
3125
2634
  fg: resolveColorTokenValue(context, (_g = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _g.fg),
@@ -3132,34 +2641,21 @@ function buildCardColorTheme(options, config) {
3132
2641
  bg: resolveColorTokenValue(context, (_j = tokens == null ? void 0 : tokens.muted) == null ? void 0 : _j.bg),
3133
2642
  fg: resolveColorTokenValue(context, (_k = tokens == null ? void 0 : tokens.muted) == null ? void 0 : _k.fg)
3134
2643
  },
3135
- selectable: buildSelectableColorTheme({
3136
- scheme
3137
- }, config),
3138
- shadow: buildShadowColorTheme({
3139
- scheme,
3140
- tone
3141
- }, config),
2644
+ selectable: buildSelectableColorTheme({ scheme }, config),
2645
+ shadow: buildShadowColorTheme({ scheme, tone }, config),
3142
2646
  skeleton: {
3143
2647
  from: resolveColorTokenValue(context, (_l = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _l.from),
3144
2648
  to: resolveColorTokenValue(context, (_m = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _m.to)
3145
2649
  },
3146
- syntax: buildSyntaxColorTheme({
3147
- scheme
3148
- }, config)
2650
+ syntax: buildSyntaxColorTheme({ scheme }, config)
3149
2651
  };
3150
2652
  }
3151
2653
  function buildShadowColorTheme(options, config) {
3152
2654
  var _a, _b, _c, _d, _e, _f;
3153
- const {
3154
- scheme,
3155
- tone
3156
- } = options;
2655
+ const { scheme, tone } = options;
3157
2656
  const tokens = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.base) == null ? void 0 : _b[tone];
3158
2657
  const hue = (tokens == null ? void 0 : tokens._hue) || "gray";
3159
- const context = {
3160
- hue,
3161
- scheme
3162
- };
2658
+ const context = { hue, scheme };
3163
2659
  return {
3164
2660
  outline: resolveColorTokenValue(context, (_c = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _c.outline),
3165
2661
  umbra: resolveColorTokenValue(context, (_d = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _d.umbra),
@@ -3168,59 +2664,24 @@ function buildShadowColorTheme(options, config) {
3168
2664
  };
3169
2665
  }
3170
2666
  function buildAvatarColorTheme(options, stateTokens) {
3171
- const {
3172
- scheme
3173
- } = options;
2667
+ const { scheme } = options;
3174
2668
  return {
3175
- gray: _buildAvatarColorTheme({
3176
- color: "gray",
3177
- scheme
3178
- }, stateTokens),
3179
- blue: _buildAvatarColorTheme({
3180
- color: "blue",
3181
- scheme
3182
- }, stateTokens),
3183
- purple: _buildAvatarColorTheme({
3184
- color: "purple",
3185
- scheme
3186
- }, stateTokens),
3187
- magenta: _buildAvatarColorTheme({
3188
- color: "magenta",
3189
- scheme
3190
- }, stateTokens),
3191
- red: _buildAvatarColorTheme({
3192
- color: "red",
3193
- scheme
3194
- }, stateTokens),
3195
- orange: _buildAvatarColorTheme({
3196
- color: "orange",
3197
- scheme
3198
- }, stateTokens),
3199
- yellow: _buildAvatarColorTheme({
3200
- color: "yellow",
3201
- scheme
3202
- }, stateTokens),
3203
- green: _buildAvatarColorTheme({
3204
- color: "green",
3205
- scheme
3206
- }, stateTokens),
3207
- cyan: _buildAvatarColorTheme({
3208
- color: "cyan",
3209
- scheme
3210
- }, stateTokens)
2669
+ gray: _buildAvatarColorTheme({ color: "gray", scheme }, stateTokens),
2670
+ blue: _buildAvatarColorTheme({ color: "blue", scheme }, stateTokens),
2671
+ purple: _buildAvatarColorTheme({ color: "purple", scheme }, stateTokens),
2672
+ magenta: _buildAvatarColorTheme({ color: "magenta", scheme }, stateTokens),
2673
+ red: _buildAvatarColorTheme({ color: "red", scheme }, stateTokens),
2674
+ orange: _buildAvatarColorTheme({ color: "orange", scheme }, stateTokens),
2675
+ yellow: _buildAvatarColorTheme({ color: "yellow", scheme }, stateTokens),
2676
+ green: _buildAvatarColorTheme({ color: "green", scheme }, stateTokens),
2677
+ cyan: _buildAvatarColorTheme({ color: "cyan", scheme }, stateTokens)
3211
2678
  };
3212
2679
  }
3213
2680
  function _buildAvatarColorTheme(options, stateTokens) {
3214
2681
  var _a;
3215
- const {
3216
- color,
3217
- scheme
3218
- } = options;
2682
+ const { color, scheme } = options;
3219
2683
  const tokens = (_a = stateTokens == null ? void 0 : stateTokens.avatar) == null ? void 0 : _a[color];
3220
- const context = {
3221
- hue: (tokens == null ? void 0 : tokens._hue) || "gray",
3222
- scheme
3223
- };
2684
+ const context = { hue: (tokens == null ? void 0 : tokens._hue) || "gray", scheme };
3224
2685
  const blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"];
3225
2686
  return {
3226
2687
  _blend: blendMode[scheme === "light" ? 0 : 1],
@@ -3229,44 +2690,21 @@ function _buildAvatarColorTheme(options, stateTokens) {
3229
2690
  };
3230
2691
  }
3231
2692
  function buildBadgeColorTheme(tokens, options, config) {
3232
- const {
3233
- scheme
3234
- } = options;
2693
+ const { scheme } = options;
3235
2694
  return {
3236
- default: _buildBadgeColorTheme(tokens, {
3237
- scheme,
3238
- tone: "default"
3239
- }, config),
3240
- primary: _buildBadgeColorTheme(tokens, {
3241
- scheme,
3242
- tone: "primary"
3243
- }, config),
3244
- positive: _buildBadgeColorTheme(tokens, {
3245
- scheme,
3246
- tone: "positive"
3247
- }, config),
3248
- caution: _buildBadgeColorTheme(tokens, {
3249
- scheme,
3250
- tone: "caution"
3251
- }, config),
3252
- critical: _buildBadgeColorTheme(tokens, {
3253
- scheme,
3254
- tone: "critical"
3255
- }, config)
2695
+ default: _buildBadgeColorTheme(tokens, { scheme, tone: "default" }, config),
2696
+ primary: _buildBadgeColorTheme(tokens, { scheme, tone: "primary" }, config),
2697
+ positive: _buildBadgeColorTheme(tokens, { scheme, tone: "positive" }, config),
2698
+ caution: _buildBadgeColorTheme(tokens, { scheme, tone: "caution" }, config),
2699
+ critical: _buildBadgeColorTheme(tokens, { scheme, tone: "critical" }, config)
3256
2700
  };
3257
2701
  }
3258
2702
  function _buildBadgeColorTheme(parentTokens, options, config) {
3259
2703
  var _a, _b, _c;
3260
- const {
3261
- scheme,
3262
- tone
3263
- } = options;
2704
+ const { scheme, tone } = options;
3264
2705
  const tokens = parentTokens == null ? void 0 : parentTokens[tone];
3265
2706
  const hue = (tokens == null ? void 0 : tokens._hue) || ((_c = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.base) == null ? void 0 : _b[tone]) == null ? void 0 : _c._hue) || "gray";
3266
- const context = {
3267
- hue,
3268
- scheme
3269
- };
2707
+ const context = { hue, scheme };
3270
2708
  return {
3271
2709
  bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
3272
2710
  fg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.fg),
@@ -3275,76 +2713,43 @@ function _buildBadgeColorTheme(parentTokens, options, config) {
3275
2713
  };
3276
2714
  }
3277
2715
  function buildButtonColorTheme(options, config) {
3278
- const {
3279
- scheme
3280
- } = options;
2716
+ const { scheme } = options;
3281
2717
  const modes = {};
3282
2718
  for (const mode of THEME_COLOR_BUTTON_MODES) {
3283
- modes[mode] = buildButtonTonesColorTheme({
3284
- scheme,
3285
- mode
3286
- }, config);
2719
+ modes[mode] = buildButtonTonesColorTheme({ scheme, mode }, config);
3287
2720
  }
3288
2721
  return modes;
3289
2722
  }
3290
2723
  function buildButtonTonesColorTheme(options, config) {
3291
- const {
3292
- mode,
3293
- scheme
3294
- } = options;
2724
+ const { mode, scheme } = options;
3295
2725
  const tones = {};
3296
2726
  for (const tone of THEME_COLOR_STATE_TONES) {
3297
- tones[tone] = buildButtonStatesColorTheme({
3298
- mode,
3299
- scheme,
3300
- tone
3301
- }, config);
2727
+ tones[tone] = buildButtonStatesColorTheme({ mode, scheme, tone }, config);
3302
2728
  }
3303
2729
  return tones;
3304
2730
  }
3305
2731
  function buildButtonStatesColorTheme(options, config) {
3306
- const {
3307
- mode,
3308
- scheme,
3309
- tone
3310
- } = options;
2732
+ const { mode, scheme, tone } = options;
3311
2733
  const states = {};
3312
2734
  for (const state of THEME_COLOR_STATES) {
3313
- states[state] = buildButtonStateColorTheme({
3314
- mode,
3315
- tone,
3316
- scheme,
3317
- state
3318
- }, config);
2735
+ states[state] = buildButtonStateColorTheme({ mode, tone, scheme, state }, config);
3319
2736
  }
3320
2737
  return states;
3321
2738
  }
3322
2739
  function buildButtonStateColorTheme(options, config) {
3323
2740
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
3324
- const {
3325
- mode,
3326
- tone,
3327
- scheme,
3328
- state
3329
- } = options;
2741
+ const { mode, tone, scheme, state } = options;
3330
2742
  const tokens = (_d = (_c = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.button) == null ? void 0 : _b[mode]) == null ? void 0 : _c[tone]) == null ? void 0 : _d[state];
3331
2743
  const hue = (tokens == null ? void 0 : tokens._hue) || "gray";
3332
2744
  const blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"];
3333
- const context = {
3334
- hue,
3335
- scheme
3336
- };
2745
+ const context = { hue, scheme };
3337
2746
  return {
3338
2747
  _blend: blendMode[scheme === "light" ? 0 : 1],
3339
2748
  accent: {
3340
2749
  fg: resolveColorTokenValue(context, (_e = tokens == null ? void 0 : tokens.accent) == null ? void 0 : _e.fg)
3341
2750
  },
3342
- avatar: buildAvatarColorTheme({
3343
- scheme
3344
- }, tokens),
3345
- badge: buildBadgeColorTheme(tokens == null ? void 0 : tokens.badge, {
3346
- scheme
3347
- }, config),
2751
+ avatar: buildAvatarColorTheme({ scheme }, tokens),
2752
+ badge: buildBadgeColorTheme(tokens == null ? void 0 : tokens.badge, { scheme }, config),
3348
2753
  bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
3349
2754
  border: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.border),
3350
2755
  code: {
@@ -3372,71 +2777,28 @@ function buildButtonStateColorTheme(options, config) {
3372
2777
  };
3373
2778
  }
3374
2779
  function buildInputColorTheme(options, config) {
3375
- const {
3376
- scheme,
3377
- tone
3378
- } = options;
2780
+ const { scheme, tone } = options;
3379
2781
  return {
3380
- default: buildInputStatesColorTheme({
3381
- mode: "default",
3382
- scheme,
3383
- tone
3384
- }, config),
3385
- invalid: buildInputStatesColorTheme({
3386
- mode: "invalid",
3387
- scheme,
3388
- tone
3389
- }, config)
2782
+ default: buildInputStatesColorTheme({ mode: "default", scheme, tone }, config),
2783
+ invalid: buildInputStatesColorTheme({ mode: "invalid", scheme, tone }, config)
3390
2784
  };
3391
2785
  }
3392
2786
  function buildInputStatesColorTheme(options, config) {
3393
- const {
3394
- mode,
3395
- scheme,
3396
- tone
3397
- } = options;
2787
+ const { mode, scheme, tone } = options;
3398
2788
  return {
3399
- enabled: buildInputStateColorTheme({
3400
- mode,
3401
- scheme,
3402
- state: "enabled",
3403
- tone
3404
- }, config),
3405
- hovered: buildInputStateColorTheme({
3406
- mode,
3407
- scheme,
3408
- state: "hovered",
3409
- tone
3410
- }, config),
3411
- readOnly: buildInputStateColorTheme({
3412
- mode,
3413
- scheme,
3414
- state: "readOnly",
3415
- tone
3416
- }, config),
3417
- disabled: buildInputStateColorTheme({
3418
- mode,
3419
- scheme,
3420
- state: "disabled",
3421
- tone
3422
- }, config)
2789
+ enabled: buildInputStateColorTheme({ mode, scheme, state: "enabled", tone }, config),
2790
+ hovered: buildInputStateColorTheme({ mode, scheme, state: "hovered", tone }, config),
2791
+ readOnly: buildInputStateColorTheme({ mode, scheme, state: "readOnly", tone }, config),
2792
+ disabled: buildInputStateColorTheme({ mode, scheme, state: "disabled", tone }, config)
3423
2793
  };
3424
2794
  }
3425
2795
  function buildInputStateColorTheme(options, config) {
3426
2796
  var _a, _b, _c, _d, _e, _f, _g;
3427
- const {
3428
- mode,
3429
- tone,
3430
- scheme,
3431
- state
3432
- } = options;
2797
+ const { mode, tone, scheme, state } = options;
3433
2798
  const tokens = (_c = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.input) == null ? void 0 : _b[mode]) == null ? void 0 : _c[state];
3434
2799
  const hue = (tokens == null ? void 0 : tokens._hue) || ((_f = (_e = (_d = config == null ? void 0 : config.color) == null ? void 0 : _d.base) == null ? void 0 : _e[tone]) == null ? void 0 : _f._hue) || "gray";
3435
2800
  const blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"];
3436
- const context = {
3437
- hue,
3438
- scheme
3439
- };
2801
+ const context = { hue, scheme };
3440
2802
  return {
3441
2803
  _blend: blendMode[scheme === "light" ? 0 : 1],
3442
2804
  bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
@@ -3449,58 +2811,35 @@ function buildInputStateColorTheme(options, config) {
3449
2811
  };
3450
2812
  }
3451
2813
  function buildSelectableColorTheme(options, config) {
3452
- const {
3453
- scheme
3454
- } = options;
2814
+ const { scheme } = options;
3455
2815
  const tones = {};
3456
2816
  for (const tone of THEME_COLOR_STATE_TONES) {
3457
- tones[tone] = buildSelectableStatesColorTheme({
3458
- scheme,
3459
- tone
3460
- }, config);
2817
+ tones[tone] = buildSelectableStatesColorTheme({ scheme, tone }, config);
3461
2818
  }
3462
2819
  return tones;
3463
2820
  }
3464
2821
  function buildSelectableStatesColorTheme(options, config) {
3465
- const {
3466
- scheme,
3467
- tone
3468
- } = options;
2822
+ const { scheme, tone } = options;
3469
2823
  const states = {};
3470
2824
  for (const state of THEME_COLOR_STATES) {
3471
- states[state] = buildSelectableStateColorTheme({
3472
- tone,
3473
- scheme,
3474
- state
3475
- }, config);
2825
+ states[state] = buildSelectableStateColorTheme({ tone, scheme, state }, config);
3476
2826
  }
3477
2827
  return states;
3478
2828
  }
3479
2829
  function buildSelectableStateColorTheme(options, config) {
3480
2830
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
3481
- const {
3482
- scheme,
3483
- state,
3484
- tone
3485
- } = options;
2831
+ const { scheme, state, tone } = options;
3486
2832
  const tokens = (_c = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.selectable) == null ? void 0 : _b[tone]) == null ? void 0 : _c[state];
3487
2833
  const hue = (tokens == null ? void 0 : tokens._hue) || "gray";
3488
2834
  const blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"];
3489
- const context = {
3490
- hue,
3491
- scheme
3492
- };
2835
+ const context = { hue, scheme };
3493
2836
  return {
3494
2837
  _blend: blendMode[scheme === "light" ? 0 : 1],
3495
2838
  accent: {
3496
2839
  fg: resolveColorTokenValue(context, (_d = tokens == null ? void 0 : tokens.accent) == null ? void 0 : _d.fg)
3497
2840
  },
3498
- avatar: buildAvatarColorTheme({
3499
- scheme
3500
- }, tokens),
3501
- badge: buildBadgeColorTheme(tokens == null ? void 0 : tokens.badge, {
3502
- scheme
3503
- }, config),
2841
+ avatar: buildAvatarColorTheme({ scheme }, tokens),
2842
+ badge: buildBadgeColorTheme(tokens == null ? void 0 : tokens.badge, { scheme }, config),
3504
2843
  bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
3505
2844
  border: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.border),
3506
2845
  code: {
@@ -3529,14 +2868,9 @@ function buildSelectableStateColorTheme(options, config) {
3529
2868
  }
3530
2869
  function buildSyntaxColorTheme(options, config) {
3531
2870
  var _a;
3532
- const {
3533
- scheme
3534
- } = options;
2871
+ const { scheme } = options;
3535
2872
  const tokens = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.syntax;
3536
- const context = {
3537
- hue: "gray",
3538
- scheme
3539
- };
2873
+ const context = { hue: "gray", scheme };
3540
2874
  return {
3541
2875
  atrule: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.atrule),
3542
2876
  attrName: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.attrName),
@@ -3576,7 +2910,9 @@ function buildSyntaxColorTheme(options, config) {
3576
2910
  variable: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.variable)
3577
2911
  };
3578
2912
  }
2913
+
3579
2914
  const defaultColorPalette = color;
2915
+
3580
2916
  function mixChannel(b, s, weight) {
3581
2917
  const diff = s - b;
3582
2918
  const delta = diff * weight;
@@ -3589,6 +2925,7 @@ function mix(b, s, weight) {
3589
2925
  b: mixChannel(b.b, s.b, weight)
3590
2926
  };
3591
2927
  }
2928
+
3592
2929
  function multiplyChannel(b, s) {
3593
2930
  return b * s;
3594
2931
  }
@@ -3599,6 +2936,7 @@ function multiply(b, s) {
3599
2936
  b: multiplyChannel(b.b / 255, s.b / 255) * 255
3600
2937
  };
3601
2938
  }
2939
+
3602
2940
  function screenChannel(b, s) {
3603
2941
  return b + s - b * s;
3604
2942
  }
@@ -3609,15 +2947,14 @@ function screen(b, s) {
3609
2947
  b: screenChannel(b.b / 255, s.b / 255) * 255
3610
2948
  };
3611
2949
  }
2950
+
3612
2951
  function lerp(x, y, a) {
3613
2952
  return x * (1 - a) + y * a;
3614
2953
  }
3615
2954
  function invlerp(x, y, a) {
3616
2955
  return clamp((a - x) / (y - x));
3617
2956
  }
3618
- function clamp(a) {
3619
- let min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
3620
- let max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
2957
+ function clamp(a, min = 0, max = 1) {
3621
2958
  return Math.min(max, Math.max(min, a));
3622
2959
  }
3623
2960
  function range(x1, y1, x2, y2, a) {
@@ -3626,6 +2963,7 @@ function range(x1, y1, x2, y2, a) {
3626
2963
  function round(value) {
3627
2964
  return Math.round(value);
3628
2965
  }
2966
+
3629
2967
  function hexToRgb(hex) {
3630
2968
  if (hex.length === 4) {
3631
2969
  const hexR = hex.slice(1, 2);
@@ -3661,12 +2999,7 @@ function rgbToHex(color) {
3661
2999
  }
3662
3000
  return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
3663
3001
  }
3664
- function rgbToHsl(_ref8) {
3665
- let {
3666
- r,
3667
- g,
3668
- b
3669
- } = _ref8;
3002
+ function rgbToHsl({ r, g, b }) {
3670
3003
  r /= 255;
3671
3004
  g /= 255;
3672
3005
  b /= 255;
@@ -3676,18 +3009,22 @@ function rgbToHsl(_ref8) {
3676
3009
  let h = 0;
3677
3010
  let s = 0;
3678
3011
  let l = 0;
3679
- if (delta == 0) h = 0;else if (cmax == r) h = (g - b) / delta % 6;else if (cmax == g) h = (b - r) / delta + 2;else h = (r - g) / delta + 4;
3012
+ if (delta == 0)
3013
+ h = 0;
3014
+ else if (cmax == r)
3015
+ h = (g - b) / delta % 6;
3016
+ else if (cmax == g)
3017
+ h = (b - r) / delta + 2;
3018
+ else
3019
+ h = (r - g) / delta + 4;
3680
3020
  h = Math.round(h * 60);
3681
- if (h < 0) h += 360;
3021
+ if (h < 0)
3022
+ h += 360;
3682
3023
  l = (cmax + cmin) / 2;
3683
3024
  s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));
3684
3025
  s = +(s * 100).toFixed(1);
3685
3026
  l = +(l * 100).toFixed(1);
3686
- return {
3687
- h,
3688
- s,
3689
- l
3690
- };
3027
+ return { h, s, l };
3691
3028
  }
3692
3029
  function hslToRgb(hsl) {
3693
3030
  const s = hsl.s / 100;
@@ -3729,6 +3066,7 @@ function hslToRgb(hsl) {
3729
3066
  b: Math.round((b + m) * 255)
3730
3067
  };
3731
3068
  }
3069
+
3732
3070
  const HEX_CHARS = "0123456789ABCDEFabcdef";
3733
3071
  const HSL_RE = /hsl\(\s*(\d+)\s*,\s*((\d+(?:\.\d+)?)%)\s*,\s*((\d+(?:\.\d+)?)%)\s*\)/i;
3734
3072
  function isHexChars(str) {
@@ -3740,8 +3078,10 @@ function isHexChars(str) {
3740
3078
  return true;
3741
3079
  }
3742
3080
  function isHex(str) {
3743
- if (str[0] !== "#") return false;
3744
- if (!(str.length === 4 || str.length === 7)) return false;
3081
+ if (str[0] !== "#")
3082
+ return false;
3083
+ if (!(str.length === 4 || str.length === 7))
3084
+ return false;
3745
3085
  return isHexChars(str.slice(1));
3746
3086
  }
3747
3087
  function parseHsl(str) {
@@ -3749,18 +3089,11 @@ function parseHsl(str) {
3749
3089
  if (!res) {
3750
3090
  throw new Error('parseHsl: string is not a HSL color: "'.concat(str, '"'));
3751
3091
  }
3752
- return {
3753
- h: parseInt(res[1]),
3754
- s: parseFloat(res[3]),
3755
- l: parseFloat(res[5])
3756
- };
3092
+ return { h: parseInt(res[1]), s: parseFloat(res[3]), l: parseFloat(res[5]) };
3757
3093
  }
3758
3094
  function parseColor(color) {
3759
- if (!color) return {
3760
- r: 0,
3761
- g: 0,
3762
- b: 0
3763
- };
3095
+ if (!color)
3096
+ return { r: 0, g: 0, b: 0 };
3764
3097
  if (typeof color !== "string") {
3765
3098
  throw new Error("parseColor: expected a string");
3766
3099
  }
@@ -3775,6 +3108,7 @@ function parseColor(color) {
3775
3108
  }
3776
3109
  throw new Error('parseColor: unexpected color format: "'.concat(color, '"'));
3777
3110
  }
3111
+
3778
3112
  function getContrastRatio(bg, fg) {
3779
3113
  const rgb1 = parseColor(bg);
3780
3114
  const rgb2 = parseColor(fg);
@@ -3784,30 +3118,24 @@ function getContrastRatio(bg, fg) {
3784
3118
  const l2 = lrgb_luminance(c2);
3785
3119
  return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
3786
3120
  }
3787
- function rgb_lrgb(_ref9) {
3788
- let {
3789
- r,
3790
- g,
3791
- b
3792
- } = _ref9;
3121
+ function rgb_lrgb({ r, g, b }) {
3793
3122
  return [rgb_lrgb1(r / 255), rgb_lrgb1(g / 255), rgb_lrgb1(b / 255)];
3794
3123
  }
3795
3124
  function rgb_lrgb1(v) {
3796
3125
  return v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;
3797
3126
  }
3798
- function lrgb_luminance(_ref10) {
3799
- let [r, g, b] = _ref10;
3127
+ function lrgb_luminance([r, g, b]) {
3800
3128
  return 0.2126 * r + 0.7152 * g + 0.0722 * b;
3801
3129
  }
3130
+
3802
3131
  function rgba(color, a) {
3803
3132
  const rgb = parseColor(color);
3804
3133
  return "rgba(".concat(rgb.r, ",").concat(rgb.g, ",").concat(rgb.b, ",").concat(a, ")");
3805
3134
  }
3135
+
3806
3136
  const RGB_RANGE = [0, 255];
3807
3137
  function mixThemeColor(value, options) {
3808
- const {
3809
- blendMode
3810
- } = options;
3138
+ const { blendMode } = options;
3811
3139
  const color = parseColor(value);
3812
3140
  const black = parseColor(options.black);
3813
3141
  const white = parseColor(options.white);
@@ -3835,12 +3163,9 @@ function mixThemeColor(value, options) {
3835
3163
  };
3836
3164
  return rgbToHex(v);
3837
3165
  }
3166
+
3838
3167
  function renderColorValue(str, options) {
3839
- const {
3840
- bg,
3841
- blendMode,
3842
- colorPalette
3843
- } = options;
3168
+ const { bg, blendMode, colorPalette } = options;
3844
3169
  if (bg === "white") {
3845
3170
  throw new Error("Cannot blend with white background");
3846
3171
  }
@@ -3892,6 +3217,7 @@ function renderColorValue(str, options) {
3892
3217
  function renderColorHex(color) {
3893
3218
  return typeof color === "string" ? color : color.hex;
3894
3219
  }
3220
+
3895
3221
  function renderThemeColorSchemes(value, config) {
3896
3222
  var _a;
3897
3223
  const colorPalette = (_a = config == null ? void 0 : config.palette) != null ? _a : defaultColorPalette;
@@ -3902,51 +3228,25 @@ function renderThemeColorSchemes(value, config) {
3902
3228
  }
3903
3229
  function renderThemeColorScheme(colorPalette, value) {
3904
3230
  const toneEntries = Object.entries(value);
3905
- const [, transparentTone] = toneEntries.find(_ref11 => {
3906
- let [k] = _ref11;
3907
- return k === "transparent";
3908
- });
3909
- const [, defaultTone] = toneEntries.find(_ref12 => {
3910
- let [k] = _ref12;
3911
- return k === "default";
3912
- });
3913
- const renderedTransparentTone = renderThemeColor(transparentTone, {
3914
- colorPalette
3915
- });
3916
- const renderedDefaultTone = renderThemeColor(defaultTone, {
3917
- colorPalette
3918
- });
3231
+ const [, transparentTone] = toneEntries.find(([k]) => k === "transparent");
3232
+ const [, defaultTone] = toneEntries.find(([k]) => k === "default");
3233
+ const renderedTransparentTone = renderThemeColor(transparentTone, { colorPalette });
3234
+ const renderedDefaultTone = renderThemeColor(defaultTone, { colorPalette });
3919
3235
  const bg = renderedDefaultTone.bg;
3920
3236
  if (bg === "white") {
3921
3237
  throw new Error("Cannot blend with white background");
3922
3238
  }
3923
- return Object.fromEntries([["transparent", renderedTransparentTone], ["default", renderedDefaultTone], ...toneEntries.filter(_ref13 => {
3924
- let [k] = _ref13;
3925
- return k !== "default" && k !== "transparent";
3926
- }).map(_ref14 => {
3927
- let [k, v] = _ref14;
3928
- return [k, renderThemeColor(v, {
3929
- bg,
3930
- colorPalette
3931
- })];
3932
- })]);
3239
+ return Object.fromEntries([
3240
+ ["transparent", renderedTransparentTone],
3241
+ ["default", renderedDefaultTone],
3242
+ ...toneEntries.filter(([k]) => k !== "default" && k !== "transparent").map(([k, v]) => [k, renderThemeColor(v, { bg, colorPalette })])
3243
+ ]);
3933
3244
  }
3934
3245
  function renderThemeColor(value, options) {
3935
- const {
3936
- colorPalette,
3937
- bg
3938
- } = options;
3246
+ const { colorPalette, bg } = options;
3939
3247
  const blendMode = value._blend || "multiply";
3940
- const baseBg = renderColorValue(value.bg, {
3941
- colorPalette,
3942
- bg,
3943
- blendMode
3944
- });
3945
- const colorOptions = {
3946
- colorPalette,
3947
- bg: baseBg,
3948
- blendMode
3949
- };
3248
+ const baseBg = renderColorValue(value.bg, { colorPalette, bg, blendMode });
3249
+ const colorOptions = { colorPalette, bg: baseBg, blendMode };
3950
3250
  const button = renderThemeColorButton(value.button, {
3951
3251
  baseBg,
3952
3252
  blendMode,
@@ -3962,26 +3262,17 @@ function renderThemeColor(value, options) {
3962
3262
  umbra: renderColorValue(value.shadow.umbra, {
3963
3263
  ...colorOptions,
3964
3264
  bg: void 0,
3965
- colorPalette: {
3966
- ...colorPalette,
3967
- black: "#000000"
3968
- }
3265
+ colorPalette: { ...colorPalette, black: "#000000" }
3969
3266
  }),
3970
3267
  penumbra: renderColorValue(value.shadow.penumbra, {
3971
3268
  ...colorOptions,
3972
3269
  bg: void 0,
3973
- colorPalette: {
3974
- ...colorPalette,
3975
- black: "#000000"
3976
- }
3270
+ colorPalette: { ...colorPalette, black: "#000000" }
3977
3271
  }),
3978
3272
  ambient: renderColorValue(value.shadow.ambient, {
3979
3273
  ...colorOptions,
3980
3274
  bg: void 0,
3981
- colorPalette: {
3982
- ...colorPalette,
3983
- black: "#000000"
3984
- }
3275
+ colorPalette: { ...colorPalette, black: "#000000" }
3985
3276
  })
3986
3277
  };
3987
3278
  return {
@@ -3990,17 +3281,9 @@ function renderThemeColor(value, options) {
3990
3281
  accent: {
3991
3282
  fg: renderColorValue(value.accent.fg, colorOptions)
3992
3283
  },
3993
- avatar: renderThemeColorAvatar(value.avatar, {
3994
- baseBg,
3995
- colorPalette,
3996
- blendMode
3997
- }),
3284
+ avatar: renderThemeColorAvatar(value.avatar, { baseBg, colorPalette, blendMode }),
3998
3285
  backdrop: renderColorValue(value.backdrop, colorOptions),
3999
- badge: renderThemeColorBadge(value.badge, {
4000
- baseBg,
4001
- colorPalette,
4002
- blendMode
4003
- }),
3286
+ badge: renderThemeColorBadge(value.badge, { baseBg, colorPalette, blendMode }),
4004
3287
  bg: baseBg,
4005
3288
  border: renderColorValue(value.border, colorOptions),
4006
3289
  button,
@@ -4011,16 +3294,8 @@ function renderThemeColor(value, options) {
4011
3294
  fg: renderColorValue(value.fg, colorOptions),
4012
3295
  focusRing: renderColorValue(value.focusRing, colorOptions),
4013
3296
  icon: renderColorValue(value.icon, colorOptions),
4014
- input: renderThemeColorInput(value.input, {
4015
- baseBg,
4016
- colorPalette,
4017
- blendMode
4018
- }),
4019
- kbd: renderThemeColorKBD(value.kbd, {
4020
- baseBg,
4021
- colorPalette,
4022
- blendMode
4023
- }),
3297
+ input: renderThemeColorInput(value.input, { baseBg, colorPalette, blendMode }),
3298
+ kbd: renderThemeColorKBD(value.kbd, { baseBg, colorPalette, blendMode }),
4024
3299
  link: {
4025
3300
  fg: renderColorValue(value.link.fg, colorOptions)
4026
3301
  },
@@ -4033,20 +3308,12 @@ function renderThemeColor(value, options) {
4033
3308
  from: renderColorValue(value.skeleton.from, colorOptions),
4034
3309
  to: renderColorValue(value.skeleton.to, colorOptions)
4035
3310
  },
4036
- syntax: renderSyntaxColorTheme(value.syntax, {
4037
- baseBg,
4038
- colorPalette,
4039
- blendMode
4040
- }),
3311
+ syntax: renderSyntaxColorTheme(value.syntax, { baseBg, colorPalette, blendMode }),
4041
3312
  selectable
4042
3313
  };
4043
3314
  }
4044
3315
  function renderThemeColorKBD(value, options) {
4045
- const {
4046
- baseBg,
4047
- blendMode,
4048
- colorPalette
4049
- } = options;
3316
+ const { baseBg, blendMode, colorPalette } = options;
4050
3317
  const rootOptions = {
4051
3318
  bg: baseBg,
4052
3319
  blendMode,
@@ -4078,11 +3345,7 @@ function renderThemeColorAvatar(value, options) {
4078
3345
  };
4079
3346
  }
4080
3347
  function renderThemeColorAvatarColor(value, options) {
4081
- const {
4082
- baseBg,
4083
- blendMode: rootBlendMode,
4084
- colorPalette
4085
- } = options;
3348
+ const { baseBg, blendMode: rootBlendMode, colorPalette } = options;
4086
3349
  const blendMode = value._blend || "multiply";
4087
3350
  const rootOptions = {
4088
3351
  bg: baseBg,
@@ -4111,11 +3374,7 @@ function renderThemeColorBadge(value, options) {
4111
3374
  };
4112
3375
  }
4113
3376
  function renderThemeColorBadgeColor(value, options) {
4114
- const {
4115
- baseBg,
4116
- blendMode: rootBlendMode,
4117
- colorPalette
4118
- } = options;
3377
+ const { baseBg, blendMode: rootBlendMode, colorPalette } = options;
4119
3378
  const blendMode = rootBlendMode;
4120
3379
  const rootOptions = {
4121
3380
  bg: baseBg,
@@ -4162,11 +3421,7 @@ function renderThemeColorButtonStates(value, options) {
4162
3421
  }
4163
3422
  function renderThemeColorState(value, options) {
4164
3423
  var _a, _b;
4165
- const {
4166
- baseBg,
4167
- blendMode: rootBlendMode,
4168
- colorPalette
4169
- } = options;
3424
+ const { baseBg, blendMode: rootBlendMode, colorPalette } = options;
4170
3425
  const blendMode = value._blend || "multiply";
4171
3426
  const rootOptions = {
4172
3427
  bg: baseBg,
@@ -4184,16 +3439,8 @@ function renderThemeColorState(value, options) {
4184
3439
  accent: {
4185
3440
  fg: renderColorValue(value.accent.fg, colorOptions)
4186
3441
  },
4187
- avatar: renderThemeColorAvatar(value.avatar, {
4188
- baseBg,
4189
- colorPalette,
4190
- blendMode
4191
- }),
4192
- badge: renderThemeColorBadge(value.badge, {
4193
- baseBg: bg,
4194
- colorPalette,
4195
- blendMode
4196
- }),
3442
+ avatar: renderThemeColorAvatar(value.avatar, { baseBg, colorPalette, blendMode }),
3443
+ badge: renderThemeColorBadge(value.badge, { baseBg: bg, colorPalette, blendMode }),
4197
3444
  bg,
4198
3445
  border: renderColorValue(value.border, colorOptions),
4199
3446
  code: {
@@ -4235,23 +3482,11 @@ function renderInputStatesColorTheme(value, options) {
4235
3482
  };
4236
3483
  }
4237
3484
  function renderInputStateColorTheme(value, options) {
4238
- const {
4239
- baseBg,
4240
- blendMode: rootBlendMode,
4241
- colorPalette
4242
- } = options;
3485
+ const { baseBg, blendMode: rootBlendMode, colorPalette } = options;
4243
3486
  const blendMode = value._blend || "multiply";
4244
- const rootOptions = {
4245
- colorPalette,
4246
- bg: baseBg,
4247
- blendMode: rootBlendMode
4248
- };
3487
+ const rootOptions = { colorPalette, bg: baseBg, blendMode: rootBlendMode };
4249
3488
  const bg = renderColorValue(value.bg, rootOptions);
4250
- const colorOptions = {
4251
- colorPalette,
4252
- bg,
4253
- blendMode
4254
- };
3489
+ const colorOptions = { colorPalette, bg, blendMode };
4255
3490
  return {
4256
3491
  _blend: blendMode,
4257
3492
  bg,
@@ -4282,16 +3517,8 @@ function renderThemeColorSelectableStates(value, options) {
4282
3517
  };
4283
3518
  }
4284
3519
  function renderSyntaxColorTheme(value, options) {
4285
- const {
4286
- colorPalette,
4287
- baseBg,
4288
- blendMode
4289
- } = options;
4290
- const colorOptions = {
4291
- colorPalette,
4292
- bg: baseBg,
4293
- blendMode
4294
- };
3520
+ const { colorPalette, baseBg, blendMode } = options;
3521
+ const colorOptions = { colorPalette, bg: baseBg, blendMode };
4295
3522
  return {
4296
3523
  atrule: renderColorValue(value.atrule, colorOptions),
4297
3524
  attrName: renderColorValue(value.attrName, colorOptions),
@@ -4331,6 +3558,7 @@ function renderSyntaxColorTheme(value, options) {
4331
3558
  variable: renderColorValue(value.variable, colorOptions)
4332
3559
  };
4333
3560
  }
3561
+
4334
3562
  function buildTheme(config) {
4335
3563
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
4336
3564
  const colorTheme = buildColorTheme(config);
@@ -4357,10 +3585,12 @@ function buildTheme(config) {
4357
3585
  };
4358
3586
  return v2_v0(v2);
4359
3587
  }
4360
- const cache = /* @__PURE__ */new Map();
3588
+
3589
+ const cache = /* @__PURE__ */ new Map();
4361
3590
  function getScopedTheme(themeProp, scheme, tone) {
4362
3591
  const cachedTheme = _getCachedTheme(themeProp, scheme, tone);
4363
- if (cachedTheme) return cachedTheme;
3592
+ if (cachedTheme)
3593
+ return cachedTheme;
4364
3594
  const v0 = is_v2(themeProp) ? v2_v0(themeProp) : themeProp;
4365
3595
  const v2 = is_v2(themeProp) ? themeProp : v0_v2(themeProp);
4366
3596
  const colorScheme_v0 = v0.color[scheme] || v0.color.light;
@@ -4387,17 +3617,22 @@ function getScopedTheme(themeProp, scheme, tone) {
4387
3617
  }
4388
3618
  function _getCachedTheme(rootTheme, scheme, tone) {
4389
3619
  const schemeCache = cache.get(scheme);
4390
- if (!schemeCache) return void 0;
3620
+ if (!schemeCache)
3621
+ return void 0;
4391
3622
  const toneCache = schemeCache.get(tone);
4392
- if (!toneCache) return void 0;
3623
+ if (!toneCache)
3624
+ return void 0;
4393
3625
  return toneCache.get(rootTheme);
4394
3626
  }
4395
3627
  function _setCachedTheme(rootTheme, scheme, tone, theme) {
4396
- if (!cache.has(scheme)) cache.set(scheme, /* @__PURE__ */new Map());
3628
+ if (!cache.has(scheme))
3629
+ cache.set(scheme, /* @__PURE__ */ new Map());
4397
3630
  const schemeCache = cache.get(scheme);
4398
- if (!schemeCache.has(tone)) schemeCache.set(tone, /* @__PURE__ */new WeakMap());
3631
+ if (!schemeCache.has(tone))
3632
+ schemeCache.set(tone, /* @__PURE__ */ new WeakMap());
4399
3633
  const toneCache = schemeCache.get(tone);
4400
3634
  toneCache.set(rootTheme, theme);
4401
3635
  }
3636
+
4402
3637
  export { COLOR_CONFIG_AVATAR_COLORS, COLOR_CONFIG_BLEND_KEYS, COLOR_CONFIG_CARD_KEYS, COLOR_CONFIG_CARD_TONES, COLOR_CONFIG_INPUT_MODES, COLOR_CONFIG_INPUT_STATES, COLOR_CONFIG_STATES, COLOR_CONFIG_STATE_KEYS, COLOR_CONFIG_STATE_TONES, THEME_COLOR_AVATAR_COLORS, THEME_COLOR_BLEND_MODES, THEME_COLOR_BUTTON_MODES, THEME_COLOR_CARD_TONES, THEME_COLOR_INPUT_MODES, THEME_COLOR_INPUT_STATES, THEME_COLOR_SCHEMES, THEME_COLOR_STATES, THEME_COLOR_STATE_TONES, buildTheme, createColorTheme, getContrastRatio, getScopedTheme, getTheme_v2, hexToRgb, hslToRgb, isColorBlendModeValue, isColorButtonMode, isColorConfigBaseKey, isColorConfigBaseTone, isColorConfigBlendKey, isColorConfigStateKey, isColorConfigStateTone, isColorHueKey, isColorOpacityValue, isColorTintKey, isColorTokenValue, isColorValue, is_v0, is_v2, mix, multiply, parseColor, parseTokenKey, parseTokenValue, rgbToHex, rgbToHsl, rgba, rgbaToRGBA, screen, v0_v2, v2_v0 };
4403
3638
  //# sourceMappingURL=theme.esm.js.map