@sanity/ui 2.1.5 → 2.1.7

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