@sanity/ui 2.0.12 → 2.0.13-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/dist/_chunks-cjs/getScopedTheme.js +547 -0
  2. package/dist/_chunks-cjs/getScopedTheme.js.map +1 -0
  3. package/dist/_chunks-es/getScopedTheme.mjs +548 -0
  4. package/dist/_chunks-es/getScopedTheme.mjs.map +1 -0
  5. package/dist/_legacy/getScopedTheme.esm.js +548 -0
  6. package/dist/_legacy/getScopedTheme.esm.js.map +1 -0
  7. package/dist/index.d.mts +2 -2
  8. package/dist/index.d.ts +2 -2
  9. package/dist/index.esm.js +74 -74
  10. package/dist/index.esm.js.map +1 -1
  11. package/dist/index.js +202 -202
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +74 -74
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/theme.d.mts +1 -1
  16. package/dist/theme.d.ts +1 -1
  17. package/dist/theme.esm.js +51 -587
  18. package/dist/theme.esm.js.map +1 -1
  19. package/dist/theme.js +22 -560
  20. package/dist/theme.js.map +1 -1
  21. package/dist/theme.mjs +51 -587
  22. package/dist/theme.mjs.map +1 -1
  23. package/package.json +1 -1
  24. package/src/core/components/autocomplete/autocomplete.styles.tsx +1 -1
  25. package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +1 -1
  26. package/src/core/components/dialog/__workshop__/panes.tsx +1 -1
  27. package/src/core/components/dialog/dialog.tsx +1 -1
  28. package/src/core/components/dialog/styles.ts +3 -3
  29. package/src/core/components/hotkeys/hotkeys.tsx +1 -1
  30. package/src/core/components/menu/menu.tsx +1 -1
  31. package/src/core/components/menu/menuDivider.ts +1 -1
  32. package/src/core/components/skeleton/skeleton.tsx +1 -1
  33. package/src/core/components/skeleton/textSkeleton.tsx +3 -3
  34. package/src/core/components/tab/tab.tsx +1 -1
  35. package/src/core/components/tab/tabList.tsx +1 -1
  36. package/src/core/components/toast/toast.tsx +1 -1
  37. package/src/core/components/toast/toastProvider.tsx +1 -1
  38. package/src/core/components/tree/style.ts +2 -3
  39. package/src/core/components/tree/treeItem.tsx +1 -1
  40. package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +1 -1
  41. package/src/core/primitives/_selectable/selectable.tsx +1 -1
  42. package/src/core/primitives/_selectable/style.ts +1 -2
  43. package/src/core/primitives/avatar/avatar.tsx +1 -1
  44. package/src/core/primitives/avatar/avatarCounter.tsx +3 -4
  45. package/src/core/primitives/avatar/avatarStack.tsx +2 -3
  46. package/src/core/primitives/avatar/styles.ts +3 -3
  47. package/src/core/primitives/badge/badge.tsx +1 -1
  48. package/src/core/primitives/box/box.tsx +1 -1
  49. package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +1 -1
  50. package/src/core/primitives/button/__workshop__/styled1.tsx +1 -1
  51. package/src/core/primitives/button/__workshop__/styled2.tsx +1 -1
  52. package/src/core/primitives/button/button.tsx +1 -1
  53. package/src/core/primitives/button/styles.ts +3 -3
  54. package/src/core/primitives/card/__workshop__/selected.tsx +3 -3
  55. package/src/core/primitives/card/__workshop__/styled.tsx +1 -1
  56. package/src/core/primitives/card/card.tsx +1 -1
  57. package/src/core/primitives/card/styles.ts +2 -3
  58. package/src/core/primitives/checkbox/checkbox.tsx +1 -1
  59. package/src/core/primitives/checkbox/styles.ts +1 -2
  60. package/src/core/primitives/code/code.tsx +1 -1
  61. package/src/core/primitives/code/styles.ts +1 -4
  62. package/src/core/primitives/container/container.tsx +1 -1
  63. package/src/core/primitives/container/styles.ts +2 -2
  64. package/src/core/primitives/flex/__workshop__/example.tsx +1 -1
  65. package/src/core/primitives/flex/flex.tsx +1 -1
  66. package/src/core/primitives/grid/grid.tsx +1 -1
  67. package/src/core/primitives/heading/heading.tsx +1 -1
  68. package/src/core/primitives/heading/styles.ts +1 -2
  69. package/src/core/primitives/inline/inline.tsx +1 -1
  70. package/src/core/primitives/inline/styles.ts +2 -2
  71. package/src/core/primitives/kbd/kbd.tsx +1 -1
  72. package/src/core/primitives/label/label.tsx +1 -1
  73. package/src/core/primitives/label/styles.ts +1 -2
  74. package/src/core/primitives/popover/popoverCard.tsx +1 -1
  75. package/src/core/primitives/radio/radio.tsx +1 -1
  76. package/src/core/primitives/radio/styles.ts +1 -2
  77. package/src/core/primitives/select/select.tsx +1 -1
  78. package/src/core/primitives/select/styles.ts +5 -5
  79. package/src/core/primitives/spinner/spinner.tsx +1 -1
  80. package/src/core/primitives/stack/stack.tsx +1 -1
  81. package/src/core/primitives/stack/styles.ts +2 -2
  82. package/src/core/primitives/switch/styles.ts +3 -4
  83. package/src/core/primitives/switch/switch.tsx +1 -1
  84. package/src/core/primitives/text/__workshop__/colored.tsx +3 -3
  85. package/src/core/primitives/text/styles.ts +1 -2
  86. package/src/core/primitives/text/text.tsx +1 -1
  87. package/src/core/primitives/textArea/textArea.tsx +1 -1
  88. package/src/core/primitives/textInput/textInput.tsx +1 -1
  89. package/src/core/primitives/tooltip/tooltip.tsx +1 -1
  90. package/src/core/primitives/tooltip/tooltipCard.tsx +1 -1
  91. package/src/core/styles/border/borderStyle.ts +6 -6
  92. package/src/core/styles/box/boxStyle.ts +5 -5
  93. package/src/core/styles/flex/flexItemStyle.ts +2 -2
  94. package/src/core/styles/flex/flexStyle.ts +6 -6
  95. package/src/core/styles/font/responsiveFont.ts +2 -2
  96. package/src/core/styles/font/textAlignStyle.ts +2 -2
  97. package/src/core/styles/grid/gridItemStyle.ts +7 -7
  98. package/src/core/styles/grid/gridStyle.ts +9 -9
  99. package/src/core/styles/helpers.ts +2 -2
  100. package/src/core/styles/input/responsiveInputPaddingStyle.ts +2 -2
  101. package/src/core/styles/input/textInputStyle.ts +4 -4
  102. package/src/core/styles/margin/marginsStyle.test.ts +1 -1
  103. package/src/core/styles/padding/paddingStyle.test.ts +1 -1
  104. package/src/core/styles/radius/radiusStyle.ts +2 -2
  105. package/src/core/styles/shadow/shadowStyle.ts +2 -2
  106. package/src/core/theme/__workshop__/build/Root.tsx +1 -2
  107. package/src/core/theme/theme.test.tsx +1 -1
  108. package/src/core/theme/themeProvider.tsx +6 -7
  109. package/src/core/theme/useTheme.ts +2 -1
  110. package/src/core/utils/arrow/arrow.tsx +1 -1
  111. package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +1 -1
  112. package/src/core/utils/layer/layer.tsx +1 -1
  113. package/src/core/utils/srOnly/srOnly.tsx +1 -1
  114. package/src/core/utils/virtualList/virtualList.tsx +1 -1
  115. package/src/theme/system/theme.ts +1 -1
package/dist/theme.esm.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { d as defaultThemeConfig, v as v2_v0 } from "./_legacy/getScopedTheme.esm.js";
2
+ import { g, a, i, b } from "./_legacy/getScopedTheme.esm.js";
1
3
  import { COLOR_HUES, COLOR_TINTS, color } from "@sanity/color";
2
4
  function createSelectableTones(opts, base, dark, solid, muted) {
3
5
  return {
@@ -684,85 +686,7 @@ function _createColor(opts, dark, name) {
684
686
  muted
685
687
  };
686
688
  }
687
- const BORDER_WIDTH = 1, OUTLINE_WIDTH = 0.5, defaultThemeConfig = {
688
- _version: 2,
689
- avatar: {
690
- sizes: [
691
- { distance: -4, size: 19 },
692
- { distance: -4, size: 25 },
693
- { distance: -8, size: 33 },
694
- { distance: -12, size: 49 }
695
- ],
696
- focusRing: { offset: 1, width: 1 }
697
- },
698
- button: {
699
- textWeight: "medium",
700
- border: { width: BORDER_WIDTH },
701
- focusRing: { offset: -1, width: 1 }
702
- },
703
- card: {
704
- border: { width: BORDER_WIDTH },
705
- focusRing: { offset: -1, width: 1 },
706
- shadow: { outline: OUTLINE_WIDTH }
707
- },
708
- container: [320, 640, 960, 1280, 1600, 1920],
709
- media: [360, 600, 900, 1200, 1800, 2400],
710
- layer: {
711
- dialog: { zOffset: 600 },
712
- popover: { zOffset: 400 },
713
- tooltip: { zOffset: 200 }
714
- },
715
- radius: [0, 1, 3, 6, 9, 12, 21],
716
- shadow: [
717
- null,
718
- { umbra: [0, 0, 0, 0], penumbra: [0, 0, 0, 0], ambient: [0, 0, 0, 0] },
719
- { umbra: [0, 3, 5, -2], penumbra: [0, 6, 10, 0], ambient: [0, 1, 18, 1] },
720
- { umbra: [0, 7, 8, -4], penumbra: [0, 12, 17, 2], ambient: [0, 5, 22, 4] },
721
- { umbra: [0, 9, 11, -5], penumbra: [0, 18, 28, 2], ambient: [0, 7, 34, 6] },
722
- { umbra: [0, 11, 15, -7], penumbra: [0, 24, 38, 3], ambient: [0, 9, 46, 8] }
723
- ],
724
- space: [0, 4, 8, 12, 20, 32, 52, 84, 136, 220],
725
- input: {
726
- border: {
727
- width: BORDER_WIDTH
728
- },
729
- checkbox: {
730
- size: 17,
731
- focusRing: { offset: -1, width: 1 }
732
- },
733
- radio: {
734
- size: 17,
735
- markSize: 9,
736
- focusRing: { offset: -1, width: 1 }
737
- },
738
- switch: {
739
- width: 25,
740
- height: 17,
741
- padding: 5,
742
- transitionDurationMs: 150,
743
- transitionTimingFunction: "ease-out",
744
- focusRing: { offset: 1, width: 1 }
745
- },
746
- select: {
747
- focusRing: { offset: -1, width: 1 }
748
- },
749
- text: {
750
- focusRing: { offset: -1, width: 1 }
751
- }
752
- },
753
- style: {
754
- button: {
755
- root: {
756
- transition: "background-color 100ms,border-color 100ms,color 100ms"
757
- }
758
- }
759
- // card: {
760
- // root: {
761
- // transition: 'background-color 100ms,border-color 100ms,color 100ms',
762
- // },
763
- // },
764
- }
765
- }, defaultThemeFonts = {
689
+ const defaultThemeFonts = {
766
690
  code: {
767
691
  family: "ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace",
768
692
  weights: {
@@ -983,437 +907,10 @@ const BORDER_WIDTH = 1, OUTLINE_WIDTH = 0.5, defaultThemeConfig = {
983
907
  }
984
908
  ]
985
909
  }
986
- }, cache$4 = /* @__PURE__ */ new WeakMap();
987
- function themeColor_v0_v2(color_v0) {
988
- var _a, _b, _c;
989
- const cached_v2 = cache$4.get(color_v0);
990
- if (cached_v2)
991
- return cached_v2;
992
- const base = stateThemeColor_v0_v2(color_v0, color_v0.card.enabled), color_v2 = {
993
- _blend: color_v0._blend || (color_v0.dark ? "screen" : "multiply"),
994
- _dark: color_v0.dark,
995
- accent: base.accent,
996
- avatar: base.avatar,
997
- backdrop: color_v0.base.shadow.ambient,
998
- badge: base.badge,
999
- bg: color_v0.base.bg,
1000
- border: color_v0.base.border,
1001
- button: {
1002
- default: stateTonesThemeColor_v0_v2(color_v0, color_v0.button.default),
1003
- ghost: stateTonesThemeColor_v0_v2(color_v0, color_v0.button.ghost),
1004
- bleed: stateTonesThemeColor_v0_v2(color_v0, color_v0.button.bleed)
1005
- },
1006
- code: base.code,
1007
- fg: color_v0.base.fg,
1008
- focusRing: color_v0.base.focusRing,
1009
- icon: base.muted.fg,
1010
- input: {
1011
- default: inputStatesThemeColor_v0_v2(color_v0.input.default),
1012
- invalid: inputStatesThemeColor_v0_v2(color_v0.input.invalid)
1013
- },
1014
- kbd: base.kbd,
1015
- link: base.link,
1016
- muted: {
1017
- ...base.muted,
1018
- bg: ((_a = color_v0.selectable) == null ? void 0 : _a.default.enabled.bg2) || color_v0.base.bg
1019
- },
1020
- selectable: stateTonesThemeColor_v0_v2(color_v0, color_v0.selectable || color_v0.muted),
1021
- shadow: color_v0.base.shadow,
1022
- skeleton: {
1023
- from: ((_b = color_v0.skeleton) == null ? void 0 : _b.from) || color_v0.base.border,
1024
- to: ((_c = color_v0.skeleton) == null ? void 0 : _c.to) || color_v0.base.border
1025
- },
1026
- syntax: color_v0.syntax
1027
- };
1028
- return cache$4.set(color_v0, color_v2), color_v2;
1029
- }
1030
- function stateTonesThemeColor_v0_v2(v0, t) {
1031
- return {
1032
- default: {
1033
- enabled: stateThemeColor_v0_v2(v0, t.default.enabled),
1034
- hovered: stateThemeColor_v0_v2(v0, t.default.hovered),
1035
- pressed: stateThemeColor_v0_v2(v0, t.default.pressed),
1036
- selected: stateThemeColor_v0_v2(v0, t.default.selected),
1037
- disabled: stateThemeColor_v0_v2(v0, t.default.disabled)
1038
- },
1039
- primary: {
1040
- enabled: stateThemeColor_v0_v2(v0, t.primary.enabled),
1041
- hovered: stateThemeColor_v0_v2(v0, t.primary.hovered),
1042
- pressed: stateThemeColor_v0_v2(v0, t.primary.pressed),
1043
- selected: stateThemeColor_v0_v2(v0, t.primary.selected),
1044
- disabled: stateThemeColor_v0_v2(v0, t.primary.disabled)
1045
- },
1046
- positive: {
1047
- enabled: stateThemeColor_v0_v2(v0, t.positive.enabled),
1048
- hovered: stateThemeColor_v0_v2(v0, t.positive.hovered),
1049
- pressed: stateThemeColor_v0_v2(v0, t.positive.pressed),
1050
- selected: stateThemeColor_v0_v2(v0, t.positive.selected),
1051
- disabled: stateThemeColor_v0_v2(v0, t.positive.disabled)
1052
- },
1053
- caution: {
1054
- enabled: stateThemeColor_v0_v2(v0, t.caution.enabled),
1055
- hovered: stateThemeColor_v0_v2(v0, t.caution.hovered),
1056
- pressed: stateThemeColor_v0_v2(v0, t.caution.pressed),
1057
- selected: stateThemeColor_v0_v2(v0, t.caution.selected),
1058
- disabled: stateThemeColor_v0_v2(v0, t.caution.disabled)
1059
- },
1060
- critical: {
1061
- enabled: stateThemeColor_v0_v2(v0, t.critical.enabled),
1062
- hovered: stateThemeColor_v0_v2(v0, t.critical.hovered),
1063
- pressed: stateThemeColor_v0_v2(v0, t.critical.pressed),
1064
- selected: stateThemeColor_v0_v2(v0, t.critical.selected),
1065
- disabled: stateThemeColor_v0_v2(v0, t.critical.disabled)
1066
- }
1067
- };
1068
- }
1069
- function stateThemeColor_v0_v2(v0, state) {
1070
- var _a, _b;
1071
- return {
1072
- ...state,
1073
- avatar: {
1074
- gray: {
1075
- bg: v0.spot.gray,
1076
- fg: v0.base.bg
1077
- },
1078
- blue: {
1079
- bg: v0.spot.blue,
1080
- fg: v0.base.bg
1081
- },
1082
- purple: {
1083
- bg: v0.spot.purple,
1084
- fg: v0.base.bg
1085
- },
1086
- magenta: {
1087
- bg: v0.spot.magenta,
1088
- fg: v0.base.bg
1089
- },
1090
- red: {
1091
- bg: v0.spot.red,
1092
- fg: v0.base.bg
1093
- },
1094
- orange: {
1095
- bg: v0.spot.orange,
1096
- fg: v0.base.bg
1097
- },
1098
- yellow: {
1099
- bg: v0.spot.yellow,
1100
- fg: v0.base.bg
1101
- },
1102
- green: {
1103
- bg: v0.spot.green,
1104
- fg: v0.base.bg
1105
- },
1106
- cyan: {
1107
- bg: v0.spot.cyan,
1108
- fg: v0.base.bg
1109
- }
1110
- },
1111
- badge: {
1112
- default: {
1113
- bg: v0.muted.default.enabled.bg,
1114
- fg: v0.muted.default.enabled.fg,
1115
- dot: v0.muted.default.enabled.muted.fg,
1116
- icon: v0.muted.default.enabled.muted.fg
1117
- },
1118
- primary: {
1119
- bg: v0.muted.primary.enabled.bg,
1120
- fg: v0.muted.primary.enabled.fg,
1121
- dot: v0.muted.primary.enabled.muted.fg,
1122
- icon: v0.muted.primary.enabled.muted.fg
1123
- },
1124
- positive: {
1125
- bg: v0.muted.positive.enabled.bg,
1126
- fg: v0.muted.positive.enabled.fg,
1127
- dot: v0.muted.positive.enabled.muted.fg,
1128
- icon: v0.muted.positive.enabled.muted.fg
1129
- },
1130
- caution: {
1131
- bg: v0.muted.caution.enabled.bg,
1132
- fg: v0.muted.caution.enabled.fg,
1133
- dot: v0.muted.caution.enabled.muted.fg,
1134
- icon: v0.muted.caution.enabled.muted.fg
1135
- },
1136
- critical: {
1137
- bg: v0.muted.critical.enabled.bg,
1138
- fg: v0.muted.critical.enabled.fg,
1139
- dot: v0.muted.critical.enabled.muted.fg,
1140
- icon: v0.muted.critical.enabled.muted.fg
1141
- }
1142
- },
1143
- kbd: {
1144
- bg: v0.muted.default.enabled.bg,
1145
- fg: v0.muted.default.enabled.fg,
1146
- border: v0.muted.default.enabled.border
1147
- },
1148
- muted: {
1149
- ...v0.muted.default.enabled.muted,
1150
- bg: state.bg2 || state.bg
1151
- },
1152
- skeleton: {
1153
- from: ((_a = state.skeleton) == null ? void 0 : _a.from) || state.border,
1154
- to: ((_b = state.skeleton) == null ? void 0 : _b.to) || state.border
1155
- }
1156
- };
1157
- }
1158
- function inputStatesThemeColor_v0_v2(states) {
1159
- return {
1160
- enabled: inputStateThemeColor_v0_v2(states.enabled),
1161
- disabled: inputStateThemeColor_v0_v2(states.disabled),
1162
- readOnly: inputStateThemeColor_v0_v2(states.readOnly),
1163
- hovered: inputStateThemeColor_v0_v2(states.hovered)
1164
- };
1165
- }
1166
- function inputStateThemeColor_v0_v2(state) {
1167
- return {
1168
- bg: state.bg,
1169
- border: state.border,
1170
- fg: state.fg,
1171
- muted: {
1172
- bg: state.bg2
1173
- },
1174
- placeholder: state.placeholder
1175
- };
1176
- }
1177
- const cache$3 = /* @__PURE__ */ new WeakMap();
1178
- function getTheme_v2(theme) {
1179
- var _a, _b;
1180
- if ((_a = theme.sanity.v2) != null && _a._resolved)
1181
- return theme.sanity.v2;
1182
- const cached_v2 = cache$3.get(theme);
1183
- if (cached_v2)
1184
- return cached_v2;
1185
- const v2 = {
1186
- _version: 2,
1187
- _resolved: !0,
1188
- avatar: {
1189
- ...defaultThemeConfig.avatar,
1190
- ...theme.sanity.avatar
1191
- },
1192
- button: {
1193
- ...defaultThemeConfig.button,
1194
- ...theme.sanity.button
1195
- },
1196
- card: defaultThemeConfig.card,
1197
- color: themeColor_v0_v2(theme.sanity.color),
1198
- container: theme.sanity.container,
1199
- font: theme.sanity.fonts,
1200
- input: {
1201
- ...defaultThemeConfig.input,
1202
- ...theme.sanity.input,
1203
- checkbox: {
1204
- ...defaultThemeConfig.input.checkbox,
1205
- ...theme.sanity.input.checkbox
1206
- },
1207
- radio: {
1208
- ...defaultThemeConfig.input.radio,
1209
- ...theme.sanity.input.radio
1210
- },
1211
- switch: {
1212
- ...defaultThemeConfig.input.switch,
1213
- ...theme.sanity.input.switch
1214
- }
1215
- },
1216
- layer: (_b = theme.sanity.layer) != null ? _b : defaultThemeConfig.layer,
1217
- media: theme.sanity.media,
1218
- radius: theme.sanity.radius,
1219
- shadow: theme.sanity.shadows,
1220
- space: theme.sanity.space,
1221
- style: theme.sanity.styles
1222
- };
1223
- return cache$3.set(theme, v2), v2;
1224
- }
910
+ };
1225
911
  function is_v0(themeProp) {
1226
912
  return themeProp._version === 0;
1227
913
  }
1228
- function is_v2(themeProp) {
1229
- return themeProp._version === 2;
1230
- }
1231
- const cache$2 = /* @__PURE__ */ new WeakMap();
1232
- function v0_v2(v0) {
1233
- if (v0.v2)
1234
- return v0.v2;
1235
- const cached_v2 = cache$2.get(v0);
1236
- if (cached_v2)
1237
- return cached_v2;
1238
- const {
1239
- avatar,
1240
- button,
1241
- color: color2,
1242
- container,
1243
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1244
- focusRing: _unused_focusRing,
1245
- fonts: font,
1246
- input,
1247
- layer,
1248
- media,
1249
- radius,
1250
- shadows: shadow,
1251
- space,
1252
- styles: style
1253
- } = v0, v2 = {
1254
- _version: 2,
1255
- avatar: {
1256
- ...defaultThemeConfig.avatar,
1257
- ...avatar
1258
- },
1259
- button: {
1260
- ...defaultThemeConfig.button,
1261
- ...button
1262
- },
1263
- card: defaultThemeConfig.card,
1264
- color: {
1265
- light: {
1266
- transparent: themeColor_v0_v2(color2.light.transparent),
1267
- default: themeColor_v0_v2(color2.light.default),
1268
- primary: themeColor_v0_v2(color2.light.primary),
1269
- positive: themeColor_v0_v2(color2.light.positive),
1270
- caution: themeColor_v0_v2(color2.light.caution),
1271
- critical: themeColor_v0_v2(color2.light.critical)
1272
- },
1273
- dark: {
1274
- transparent: themeColor_v0_v2(color2.dark.transparent),
1275
- default: themeColor_v0_v2(color2.dark.default),
1276
- primary: themeColor_v0_v2(color2.dark.primary),
1277
- positive: themeColor_v0_v2(color2.dark.positive),
1278
- caution: themeColor_v0_v2(color2.dark.caution),
1279
- critical: themeColor_v0_v2(color2.dark.critical)
1280
- }
1281
- },
1282
- container,
1283
- font,
1284
- input: {
1285
- ...defaultThemeConfig.input,
1286
- ...input,
1287
- checkbox: {
1288
- ...defaultThemeConfig.input.checkbox,
1289
- ...input.checkbox
1290
- },
1291
- radio: {
1292
- ...defaultThemeConfig.input.radio,
1293
- ...input.radio
1294
- },
1295
- switch: {
1296
- ...defaultThemeConfig.input.switch,
1297
- ...input.switch
1298
- }
1299
- },
1300
- layer: layer != null ? layer : defaultThemeConfig.layer,
1301
- media,
1302
- radius,
1303
- shadow,
1304
- space,
1305
- style
1306
- };
1307
- return cache$2.set(v0, v2), v2;
1308
- }
1309
- const cache$1 = /* @__PURE__ */ new WeakMap();
1310
- function v2_v0(v2) {
1311
- const cachedTheme = cache$1.get(v2);
1312
- if (cachedTheme)
1313
- return cachedTheme;
1314
- const {
1315
- avatar,
1316
- button,
1317
- color: color2,
1318
- container,
1319
- font: fonts,
1320
- input,
1321
- media,
1322
- radius,
1323
- shadow: shadows,
1324
- space,
1325
- style: styles
1326
- } = v2;
1327
- return {
1328
- _version: 0,
1329
- avatar,
1330
- button,
1331
- container,
1332
- color: {
1333
- light: {
1334
- transparent: themeColor_v2_v0(color2.light.transparent),
1335
- default: themeColor_v2_v0(color2.light.default),
1336
- primary: themeColor_v2_v0(color2.light.primary),
1337
- positive: themeColor_v2_v0(color2.light.positive),
1338
- caution: themeColor_v2_v0(color2.light.caution),
1339
- critical: themeColor_v2_v0(color2.light.critical)
1340
- },
1341
- dark: {
1342
- transparent: themeColor_v2_v0(color2.dark.transparent),
1343
- default: themeColor_v2_v0(color2.dark.default),
1344
- primary: themeColor_v2_v0(color2.dark.primary),
1345
- positive: themeColor_v2_v0(color2.dark.positive),
1346
- caution: themeColor_v2_v0(color2.dark.caution),
1347
- critical: themeColor_v2_v0(color2.dark.critical)
1348
- }
1349
- },
1350
- focusRing: input.text.focusRing,
1351
- fonts,
1352
- input,
1353
- media,
1354
- radius,
1355
- shadows,
1356
- space,
1357
- styles,
1358
- v2
1359
- };
1360
- }
1361
- function themeColor_v2_v0(color_v2) {
1362
- return {
1363
- base: {
1364
- bg: color_v2.bg,
1365
- fg: color_v2.fg,
1366
- border: color_v2.border,
1367
- focusRing: color_v2.focusRing,
1368
- shadow: color_v2.shadow
1369
- },
1370
- button: color_v2.button,
1371
- card: color_v2.selectable.default,
1372
- dark: color_v2._dark,
1373
- input: {
1374
- default: inputStatesThemeColor_v2_v0(color_v2.input.default),
1375
- invalid: inputStatesThemeColor_v2_v0(color_v2.input.invalid)
1376
- },
1377
- muted: {
1378
- ...color_v2.button.ghost,
1379
- transparent: color_v2.button.ghost.default
1380
- },
1381
- solid: {
1382
- ...color_v2.button.default,
1383
- transparent: color_v2.button.default.default
1384
- },
1385
- selectable: color_v2.selectable,
1386
- spot: {
1387
- gray: color_v2.avatar.gray.bg,
1388
- blue: color_v2.avatar.blue.bg,
1389
- purple: color_v2.avatar.purple.bg,
1390
- magenta: color_v2.avatar.magenta.bg,
1391
- red: color_v2.avatar.red.bg,
1392
- orange: color_v2.avatar.orange.bg,
1393
- yellow: color_v2.avatar.yellow.bg,
1394
- green: color_v2.avatar.green.bg,
1395
- cyan: color_v2.avatar.cyan.bg
1396
- },
1397
- syntax: color_v2.syntax
1398
- };
1399
- }
1400
- function inputStatesThemeColor_v2_v0(t) {
1401
- return {
1402
- enabled: inputStateThemeColor_v2_v0(t.enabled),
1403
- disabled: inputStateThemeColor_v2_v0(t.disabled),
1404
- readOnly: inputStateThemeColor_v2_v0(t.readOnly),
1405
- hovered: inputStateThemeColor_v2_v0(t.hovered)
1406
- };
1407
- }
1408
- function inputStateThemeColor_v2_v0(t) {
1409
- return {
1410
- bg: t.bg,
1411
- bg2: t.muted.bg,
1412
- border: t.border,
1413
- fg: t.fg,
1414
- placeholder: t.placeholder
1415
- };
1416
- }
1417
914
  const THEME_COLOR_SCHEMES = ["light", "dark"], THEME_COLOR_BLEND_MODES = ["multiply", "screen"], THEME_COLOR_CARD_TONES = [
1418
915
  "transparent",
1419
916
  "default",
@@ -2740,48 +2237,48 @@ function buildSyntaxColorTheme(options, config) {
2740
2237
  };
2741
2238
  }
2742
2239
  const defaultColorPalette = color;
2743
- function mixChannel(b, s, weight) {
2744
- const delta = (s - b) * weight;
2745
- return b + delta;
2240
+ function mixChannel(b2, s, weight) {
2241
+ const delta = (s - b2) * weight;
2242
+ return b2 + delta;
2746
2243
  }
2747
- function mix(b, s, weight) {
2244
+ function mix(b2, s, weight) {
2748
2245
  return {
2749
- r: mixChannel(b.r, s.r, weight),
2750
- g: mixChannel(b.g, s.g, weight),
2751
- b: mixChannel(b.b, s.b, weight)
2246
+ r: mixChannel(b2.r, s.r, weight),
2247
+ g: mixChannel(b2.g, s.g, weight),
2248
+ b: mixChannel(b2.b, s.b, weight)
2752
2249
  };
2753
2250
  }
2754
- function multiplyChannel(b, s) {
2755
- return b * s;
2251
+ function multiplyChannel(b2, s) {
2252
+ return b2 * s;
2756
2253
  }
2757
- function multiply(b, s) {
2254
+ function multiply(b2, s) {
2758
2255
  return {
2759
- r: multiplyChannel(b.r / 255, s.r / 255) * 255,
2760
- g: multiplyChannel(b.g / 255, s.g / 255) * 255,
2761
- b: multiplyChannel(b.b / 255, s.b / 255) * 255
2256
+ r: multiplyChannel(b2.r / 255, s.r / 255) * 255,
2257
+ g: multiplyChannel(b2.g / 255, s.g / 255) * 255,
2258
+ b: multiplyChannel(b2.b / 255, s.b / 255) * 255
2762
2259
  };
2763
2260
  }
2764
- function screenChannel(b, s) {
2765
- return b + s - b * s;
2261
+ function screenChannel(b2, s) {
2262
+ return b2 + s - b2 * s;
2766
2263
  }
2767
- function screen(b, s) {
2264
+ function screen(b2, s) {
2768
2265
  return {
2769
- r: screenChannel(b.r / 255, s.r / 255) * 255,
2770
- g: screenChannel(b.g / 255, s.g / 255) * 255,
2771
- b: screenChannel(b.b / 255, s.b / 255) * 255
2266
+ r: screenChannel(b2.r / 255, s.r / 255) * 255,
2267
+ g: screenChannel(b2.g / 255, s.g / 255) * 255,
2268
+ b: screenChannel(b2.b / 255, s.b / 255) * 255
2772
2269
  };
2773
2270
  }
2774
- function lerp(x, y, a) {
2775
- return x * (1 - a) + y * a;
2271
+ function lerp(x, y, a2) {
2272
+ return x * (1 - a2) + y * a2;
2776
2273
  }
2777
- function invlerp(x, y, a) {
2778
- return clamp((a - x) / (y - x));
2274
+ function invlerp(x, y, a2) {
2275
+ return clamp((a2 - x) / (y - x));
2779
2276
  }
2780
- function clamp(a, min = 0, max = 1) {
2781
- return Math.min(max, Math.max(min, a));
2277
+ function clamp(a2, min = 0, max = 1) {
2278
+ return Math.min(max, Math.max(min, a2));
2782
2279
  }
2783
- function range(x1, y1, x2, y2, a) {
2784
- return lerp(x2, y2, invlerp(x1, y1, a));
2280
+ function range(x1, y1, x2, y2, a2) {
2281
+ return lerp(x2, y2, invlerp(x1, y1, a2));
2785
2282
  }
2786
2283
  function round(value) {
2787
2284
  return Math.round(value);
@@ -2811,22 +2308,22 @@ function rgbaToRGBA(rgba2) {
2811
2308
  };
2812
2309
  }
2813
2310
  function rgbToHex(color2) {
2814
- const r = round(clamp(Math.round(color2.r), 0, 255)), g = round(clamp(Math.round(color2.g), 0, 255)), b = round(clamp(Math.round(color2.b), 0, 255));
2815
- return "a" in color2 ? `rgba(${r},${g},${b},${color2.a})` : "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
2311
+ const r = round(clamp(Math.round(color2.r), 0, 255)), g2 = round(clamp(Math.round(color2.g), 0, 255)), b2 = round(clamp(Math.round(color2.b), 0, 255));
2312
+ return "a" in color2 ? `rgba(${r},${g2},${b2},${color2.a})` : "#" + ((1 << 24) + (r << 16) + (g2 << 8) + b2).toString(16).slice(1);
2816
2313
  }
2817
- function rgbToHsl({ r, g, b }) {
2818
- r /= 255, g /= 255, b /= 255;
2819
- const cmin = Math.min(r, g, b), cmax = Math.max(r, g, b), delta = cmax - cmin;
2314
+ function rgbToHsl({ r, g: g2, b: b2 }) {
2315
+ r /= 255, g2 /= 255, b2 /= 255;
2316
+ const cmin = Math.min(r, g2, b2), cmax = Math.max(r, g2, b2), delta = cmax - cmin;
2820
2317
  let h = 0, s = 0, l = 0;
2821
- return delta == 0 ? h = 0 : cmax == r ? h = (g - b) / delta % 6 : cmax == g ? h = (b - r) / delta + 2 : h = (r - g) / delta + 4, h = Math.round(h * 60), h < 0 && (h += 360), l = (cmax + cmin) / 2, s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1)), s = +(s * 100).toFixed(1), l = +(l * 100).toFixed(1), { h, s, l };
2318
+ return delta == 0 ? h = 0 : cmax == r ? h = (g2 - b2) / delta % 6 : cmax == g2 ? h = (b2 - r) / delta + 2 : h = (r - g2) / delta + 4, h = Math.round(h * 60), h < 0 && (h += 360), l = (cmax + cmin) / 2, s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1)), s = +(s * 100).toFixed(1), l = +(l * 100).toFixed(1), { h, s, l };
2822
2319
  }
2823
2320
  function hslToRgb(hsl) {
2824
2321
  const s = hsl.s / 100, l = hsl.l / 100, c = (1 - Math.abs(2 * l - 1)) * s, x = c * (1 - Math.abs(hsl.h / 60 % 2 - 1)), m = l - c / 2;
2825
- let r = 0, g = 0, b = 0;
2826
- return 0 <= hsl.h && hsl.h < 60 ? (r = c, g = x, b = 0) : 60 <= hsl.h && hsl.h < 120 ? (r = x, g = c, b = 0) : 120 <= hsl.h && hsl.h < 180 ? (r = 0, g = c, b = x) : 180 <= hsl.h && hsl.h < 240 ? (r = 0, g = x, b = c) : 240 <= hsl.h && hsl.h < 300 ? (r = x, g = 0, b = c) : 300 <= hsl.h && hsl.h < 360 && (r = c, g = 0, b = x), {
2322
+ let r = 0, g2 = 0, b2 = 0;
2323
+ return 0 <= hsl.h && hsl.h < 60 ? (r = c, g2 = x, b2 = 0) : 60 <= hsl.h && hsl.h < 120 ? (r = x, g2 = c, b2 = 0) : 120 <= hsl.h && hsl.h < 180 ? (r = 0, g2 = c, b2 = x) : 180 <= hsl.h && hsl.h < 240 ? (r = 0, g2 = x, b2 = c) : 240 <= hsl.h && hsl.h < 300 ? (r = x, g2 = 0, b2 = c) : 300 <= hsl.h && hsl.h < 360 && (r = c, g2 = 0, b2 = x), {
2827
2324
  r: Math.round((r + m) * 255),
2828
- g: Math.round((g + m) * 255),
2829
- b: Math.round((b + m) * 255)
2325
+ g: Math.round((g2 + m) * 255),
2326
+ b: Math.round((b2 + m) * 255)
2830
2327
  };
2831
2328
  }
2832
2329
  const HEX_CHARS = "0123456789ABCDEFabcdef", HSL_RE = /hsl\(\s*(\d+)\s*,\s*((\d+(?:\.\d+)?)%)\s*,\s*((\d+(?:\.\d+)?)%)\s*\)/i;
@@ -2862,18 +2359,18 @@ function getContrastRatio(bg, fg) {
2862
2359
  const rgb1 = parseColor(bg), rgb2 = parseColor(fg), c1 = rgb_lrgb(rgb1), c2 = rgb_lrgb(rgb2), l1 = lrgb_luminance(c1), l2 = lrgb_luminance(c2);
2863
2360
  return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
2864
2361
  }
2865
- function rgb_lrgb({ r, g, b }) {
2866
- return [rgb_lrgb1(r / 255), rgb_lrgb1(g / 255), rgb_lrgb1(b / 255)];
2362
+ function rgb_lrgb({ r, g: g2, b: b2 }) {
2363
+ return [rgb_lrgb1(r / 255), rgb_lrgb1(g2 / 255), rgb_lrgb1(b2 / 255)];
2867
2364
  }
2868
2365
  function rgb_lrgb1(v) {
2869
2366
  return v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;
2870
2367
  }
2871
- function lrgb_luminance([r, g, b]) {
2872
- return 0.2126 * r + 0.7152 * g + 0.0722 * b;
2368
+ function lrgb_luminance([r, g2, b2]) {
2369
+ return 0.2126 * r + 0.7152 * g2 + 0.0722 * b2;
2873
2370
  }
2874
- function rgba(color2, a) {
2371
+ function rgba(color2, a2) {
2875
2372
  const rgb = parseColor(color2);
2876
- return `rgba(${rgb.r},${rgb.g},${rgb.b},${a})`;
2373
+ return `rgba(${rgb.r},${rgb.g},${rgb.b},${a2})`;
2877
2374
  }
2878
2375
  const RGB_RANGE = [0, 255];
2879
2376
  function mixThemeColor(value, options) {
@@ -3259,39 +2756,6 @@ function buildTheme(config) {
3259
2756
  };
3260
2757
  return v2_v0(v2);
3261
2758
  }
3262
- const cache = /* @__PURE__ */ new Map();
3263
- function getScopedTheme(themeProp, scheme, tone) {
3264
- const cachedTheme = _getCachedTheme(themeProp, scheme, tone);
3265
- if (cachedTheme)
3266
- return cachedTheme;
3267
- const v0 = is_v2(themeProp) ? v2_v0(themeProp) : themeProp, v2 = is_v2(themeProp) ? themeProp : v0_v2(themeProp), colorScheme_v0 = v0.color[scheme] || v0.color.light, color_v0 = colorScheme_v0[tone] || colorScheme_v0.default, layer_v0 = v0.layer || defaultThemeConfig.layer, colorScheme_v2 = v2.color[scheme] || v2.color.light, color_v2 = colorScheme_v2[tone] || colorScheme_v2.default, layer_v2 = v2.layer || defaultThemeConfig.layer, theme = {
3268
- sanity: {
3269
- ...v0,
3270
- color: color_v0,
3271
- layer: layer_v0,
3272
- v2: {
3273
- ...v2,
3274
- _resolved: !0,
3275
- color: color_v2,
3276
- layer: layer_v2
3277
- }
3278
- }
3279
- };
3280
- return _setCachedTheme(themeProp, scheme, tone, theme), theme;
3281
- }
3282
- function _getCachedTheme(rootTheme, scheme, tone) {
3283
- const schemeCache = cache.get(scheme);
3284
- if (!schemeCache)
3285
- return;
3286
- const toneCache = schemeCache.get(tone);
3287
- if (toneCache)
3288
- return toneCache.get(rootTheme);
3289
- }
3290
- function _setCachedTheme(rootTheme, scheme, tone, theme) {
3291
- cache.has(scheme) || cache.set(scheme, /* @__PURE__ */ new Map());
3292
- const schemeCache = cache.get(scheme);
3293
- schemeCache.has(tone) || schemeCache.set(tone, /* @__PURE__ */ new WeakMap()), schemeCache.get(tone).set(rootTheme, theme);
3294
- }
3295
2759
  export {
3296
2760
  COLOR_CONFIG_AVATAR_COLORS,
3297
2761
  COLOR_CONFIG_BLEND_KEYS,
@@ -3314,8 +2778,8 @@ export {
3314
2778
  buildTheme,
3315
2779
  createColorTheme,
3316
2780
  getContrastRatio,
3317
- getScopedTheme,
3318
- getTheme_v2,
2781
+ g as getScopedTheme,
2782
+ a as getTheme_v2,
3319
2783
  hexToRgb,
3320
2784
  hslToRgb,
3321
2785
  isColorBlendModeValue,
@@ -3331,7 +2795,7 @@ export {
3331
2795
  isColorTokenValue,
3332
2796
  isColorValue,
3333
2797
  is_v0,
3334
- is_v2,
2798
+ i as is_v2,
3335
2799
  mix,
3336
2800
  multiply,
3337
2801
  parseColor,
@@ -3342,7 +2806,7 @@ export {
3342
2806
  rgba,
3343
2807
  rgbaToRGBA,
3344
2808
  screen,
3345
- v0_v2,
2809
+ b as v0_v2,
3346
2810
  v2_v0
3347
2811
  };
3348
2812
  //# sourceMappingURL=theme.esm.js.map