@sanity/ui 2.0.0-beta.15 → 2.0.0-beta.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ui",
3
- "version": "2.0.0-beta.15",
3
+ "version": "2.0.0-beta.16",
4
4
  "sideEffects": false,
5
5
  "types": "./dist/index.d.ts",
6
6
  "source": "./exports/index.ts",
@@ -36,6 +36,7 @@ export function getScopedTheme(
36
36
  layer: layer_v0,
37
37
  v2: {
38
38
  ...v2,
39
+ _resolved: true,
39
40
  color: color_v2,
40
41
  layer: layer_v2,
41
42
  },
@@ -114,7 +114,15 @@ export type RootTheme = BaseTheme
114
114
  /**
115
115
  * @public
116
116
  */
117
- export type Theme_v2 = Omit<RootTheme_v2, 'color'> & {color: ThemeColorCard_v2}
117
+ export type Theme_v2 = Omit<RootTheme_v2, 'color'> & {
118
+ color: ThemeColorCard_v2
119
+ /**
120
+ * Indicates whether the theme is resolved or raw, it's necessary to avoid issues
121
+ * with sanity V2 components accessing a v1 <ThemeProvider>.
122
+ * See https://github.com/sanity-io/ui/pull/1203 for more info.
123
+ */
124
+ _resolved: boolean
125
+ }
118
126
 
119
127
  /**
120
128
  * @public
@@ -6,7 +6,7 @@ const cache = new WeakMap<Theme, Theme_v2>()
6
6
 
7
7
  /** @public */
8
8
  export function getTheme_v2(theme: Theme): Theme_v2 {
9
- if (theme.sanity.v2) return theme.sanity.v2
9
+ if (theme.sanity.v2?._resolved) return theme.sanity.v2
10
10
 
11
11
  const cached_v2 = cache.get(theme)
12
12
 
@@ -14,6 +14,7 @@ export function getTheme_v2(theme: Theme): Theme_v2 {
14
14
 
15
15
  const v2: Theme_v2 = {
16
16
  _version: 2,
17
+ _resolved: true,
17
18
  avatar: {
18
19
  ...defaultThemeConfig.avatar,
19
20
  ...theme.sanity.avatar,