@sanity/ui 2.1.6 → 2.1.8

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.js CHANGED
@@ -989,8 +989,7 @@ const BORDER_WIDTH = 1, OUTLINE_WIDTH = 0.5, defaultThemeConfig = {
989
989
  function themeColor_v0_v2(color_v0) {
990
990
  var _a, _b, _c;
991
991
  const cached_v2 = cache$4.get(color_v0);
992
- if (cached_v2)
993
- return cached_v2;
992
+ if (cached_v2) return cached_v2;
994
993
  const base = stateThemeColor_v0_v2(color_v0, color_v0.card.enabled), color_v2 = {
995
994
  _blend: color_v0._blend || (color_v0.dark ? "screen" : "multiply"),
996
995
  _dark: color_v0.dark,
@@ -1179,11 +1178,9 @@ function inputStateThemeColor_v0_v2(state) {
1179
1178
  const cache$3 = /* @__PURE__ */ new WeakMap();
1180
1179
  function getTheme_v2(theme) {
1181
1180
  var _a, _b;
1182
- if ((_a = theme.sanity.v2) != null && _a._resolved)
1183
- return theme.sanity.v2;
1181
+ if ((_a = theme.sanity.v2) != null && _a._resolved) return theme.sanity.v2;
1184
1182
  const cached_v2 = cache$3.get(theme);
1185
- if (cached_v2)
1186
- return cached_v2;
1183
+ if (cached_v2) return cached_v2;
1187
1184
  const v2 = {
1188
1185
  _version: 2,
1189
1186
  _resolved: !0,
@@ -1232,11 +1229,9 @@ function is_v2(themeProp) {
1232
1229
  }
1233
1230
  const cache$2 = /* @__PURE__ */ new WeakMap();
1234
1231
  function v0_v2(v0) {
1235
- if (v0.v2)
1236
- return v0.v2;
1232
+ if (v0.v2) return v0.v2;
1237
1233
  const cached_v2 = cache$2.get(v0);
1238
- if (cached_v2)
1239
- return cached_v2;
1234
+ if (cached_v2) return cached_v2;
1240
1235
  const {
1241
1236
  avatar,
1242
1237
  button,
@@ -1311,8 +1306,7 @@ function v0_v2(v0) {
1311
1306
  const cache$1 = /* @__PURE__ */ new WeakMap();
1312
1307
  function v2_v0(v2) {
1313
1308
  const cachedTheme = cache$1.get(v2);
1314
- if (cachedTheme)
1315
- return cachedTheme;
1309
+ if (cachedTheme) return cachedTheme;
1316
1310
  const {
1317
1311
  avatar,
1318
1312
  button,
@@ -2915,8 +2909,7 @@ function parseHsl(str) {
2915
2909
  return { h: parseInt(res[1]), s: parseFloat(res[3]), l: parseFloat(res[5]) };
2916
2910
  }
2917
2911
  function parseColor(color2) {
2918
- if (!color2)
2919
- return { r: 0, g: 0, b: 0 };
2912
+ if (!color2) return { r: 0, g: 0, b: 0 };
2920
2913
  if (typeof color2 != "string")
2921
2914
  throw new Error("parseColor: expected a string");
2922
2915
  if (isHex(color2))
@@ -3331,8 +3324,7 @@ function buildTheme(config) {
3331
3324
  const cache = /* @__PURE__ */ new Map();
3332
3325
  function getScopedTheme(themeProp, scheme, tone) {
3333
3326
  const cachedTheme = _getCachedTheme(themeProp, scheme, tone);
3334
- if (cachedTheme)
3335
- return cachedTheme;
3327
+ if (cachedTheme) return cachedTheme;
3336
3328
  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 = {
3337
3329
  sanity: {
3338
3330
  ...v0,
@@ -3350,8 +3342,7 @@ function getScopedTheme(themeProp, scheme, tone) {
3350
3342
  }
3351
3343
  function _getCachedTheme(rootTheme, scheme, tone) {
3352
3344
  const schemeCache = cache.get(scheme);
3353
- if (!schemeCache)
3354
- return;
3345
+ if (!schemeCache) return;
3355
3346
  const toneCache = schemeCache.get(tone);
3356
3347
  if (toneCache)
3357
3348
  return toneCache.get(rootTheme);