@sanity/ui 2.12.0 → 2.12.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.
- package/dist/theme.esm.js +37 -2
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +37 -2
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +37 -2
- package/dist/theme.mjs.map +1 -1
- package/package.json +3 -3
- package/src/theme/getScopedTheme.ts +3 -1
- package/src/theme/versioning/themeColor_v2_v2_9.ts +49 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "2.12.
|
|
3
|
+
"version": "2.12.2",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"sanity",
|
|
6
6
|
"ui",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"@sanity/color": "^3.0.6",
|
|
121
121
|
"@sanity/icons": "^3.5.7",
|
|
122
122
|
"csstype": "^3.1.3",
|
|
123
|
-
"framer-motion": "^12.4.
|
|
123
|
+
"framer-motion": "^12.4.1",
|
|
124
124
|
"react-compiler-runtime": "19.0.0-beta-714736e-20250131",
|
|
125
125
|
"react-refractor": "^2.2.0",
|
|
126
126
|
"use-effect-event": "^1.0.2"
|
|
@@ -196,7 +196,7 @@
|
|
|
196
196
|
"semantic-release": "^24.2.1",
|
|
197
197
|
"start-server-and-test": "^2.0.10",
|
|
198
198
|
"storybook": "^8.5.3",
|
|
199
|
-
"styled-components": "^6.1.
|
|
199
|
+
"styled-components": "^6.1.15",
|
|
200
200
|
"tsconfig-paths": "^4.2.0",
|
|
201
201
|
"typescript": "5.7.3",
|
|
202
202
|
"vite": "^5.4.14",
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
ThemeColorSchemeKey,
|
|
9
9
|
} from './system'
|
|
10
10
|
import {is_v2, v0_v2, v2_v0} from './versioning'
|
|
11
|
+
import {themeColor_v0_v2_9} from './versioning/themeColor_v2_v2_9'
|
|
11
12
|
|
|
12
13
|
// cache[scheme][tone][rootTheme] = theme
|
|
13
14
|
const cache = new Map<
|
|
@@ -34,6 +35,7 @@ export function getScopedTheme(
|
|
|
34
35
|
|
|
35
36
|
const colorScheme_v2 = v2.color[scheme] || v2.color.light
|
|
36
37
|
const color_v2 = colorScheme_v2[tone] || colorScheme_v2.default
|
|
38
|
+
const color_v2_9 = themeColor_v0_v2_9(color_v2)
|
|
37
39
|
const layer_v2 = v2.layer || defaultThemeConfig.layer
|
|
38
40
|
|
|
39
41
|
const theme: Theme = {
|
|
@@ -44,7 +46,7 @@ export function getScopedTheme(
|
|
|
44
46
|
v2: {
|
|
45
47
|
...v2,
|
|
46
48
|
_resolved: true,
|
|
47
|
-
color:
|
|
49
|
+
color: color_v2_9,
|
|
48
50
|
layer: layer_v2,
|
|
49
51
|
},
|
|
50
52
|
},
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type {ThemeColorCard_v2} from '../system'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Apply `neutral` and `suggest` if they're not already part of the color object,
|
|
5
|
+
* as this was introduced in v2.9, but is not compatible with v2.0.
|
|
6
|
+
*
|
|
7
|
+
* @param color - The color object to upgrade
|
|
8
|
+
* @returns The upgraded color object. Returns as-is if already upgraded.
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export function themeColor_v0_v2_9(color: ThemeColorCard_v2): ThemeColorCard_v2 {
|
|
12
|
+
if ('neutral' in color.badge) {
|
|
13
|
+
return color // Already at >= v2.9
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// TypeScript narrows to `never` because the above should always be true
|
|
17
|
+
const colors = color as ThemeColorCard_v2
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
...colors,
|
|
21
|
+
badge: {
|
|
22
|
+
...colors.badge,
|
|
23
|
+
neutral: colors.badge.default,
|
|
24
|
+
suggest: colors.badge.primary,
|
|
25
|
+
},
|
|
26
|
+
button: {
|
|
27
|
+
bleed: {
|
|
28
|
+
...colors.button.bleed,
|
|
29
|
+
neutral: colors.button.bleed.default,
|
|
30
|
+
suggest: colors.button.bleed.primary,
|
|
31
|
+
},
|
|
32
|
+
default: {
|
|
33
|
+
...colors.button.default,
|
|
34
|
+
neutral: colors.button.default.default,
|
|
35
|
+
suggest: colors.button.default.primary,
|
|
36
|
+
},
|
|
37
|
+
ghost: {
|
|
38
|
+
...colors.button.ghost,
|
|
39
|
+
neutral: colors.button.ghost.default,
|
|
40
|
+
suggest: colors.button.ghost.primary,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
selectable: {
|
|
44
|
+
...colors.selectable,
|
|
45
|
+
neutral: colors.selectable.default,
|
|
46
|
+
suggest: colors.selectable.primary,
|
|
47
|
+
},
|
|
48
|
+
}
|
|
49
|
+
}
|