@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/dist/theme.d.ts +6 -0
- package/dist/theme.esm.js +5 -3
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +5 -3
- package/dist/theme.js.map +1 -1
- package/package.json +1 -1
- package/src/theme/getScopedTheme.ts +1 -0
- package/src/theme/system/theme.ts +9 -1
- package/src/theme/versioning/getTheme_v2.ts +2 -1
package/package.json
CHANGED
|
@@ -114,7 +114,15 @@ export type RootTheme = BaseTheme
|
|
|
114
114
|
/**
|
|
115
115
|
* @public
|
|
116
116
|
*/
|
|
117
|
-
export type Theme_v2 = Omit<RootTheme_v2, 'color'> & {
|
|
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,
|