@sanity/ui 2.7.0 → 2.7.1-canary.0
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/index.esm.js +10 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +26 -34
- package/src/core/hooks/useMatchMedia.ts +9 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "2.7.0",
|
|
3
|
+
"version": "2.7.1-canary.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"sanity",
|
|
6
6
|
"ui",
|
|
@@ -51,32 +51,6 @@
|
|
|
51
51
|
"src",
|
|
52
52
|
"theme.js"
|
|
53
53
|
],
|
|
54
|
-
"scripts": {
|
|
55
|
-
"build": "run-s clean pkg:build pkg:check figma:pkg:build",
|
|
56
|
-
"clean": "rimraf .workshop dist",
|
|
57
|
-
"commit": "cz",
|
|
58
|
-
"cypress:dev": "run-p dev cypress:open",
|
|
59
|
-
"cypress:open": "cypress open",
|
|
60
|
-
"cypress:run": "cypress run",
|
|
61
|
-
"dev": "run-p storybook:dev workshop:dev",
|
|
62
|
-
"figma:pkg:build": "cd figma && pnpm build",
|
|
63
|
-
"format": "prettier --write --cache --ignore-unknown .",
|
|
64
|
-
"lint": "eslint . --ext .cjs,.js,.jsx,.mjs,.ts,.tsx",
|
|
65
|
-
"pkg:build": "pkg build --strict",
|
|
66
|
-
"pkg:check": "pkg --strict",
|
|
67
|
-
"prepare": "husky install",
|
|
68
|
-
"prepack": "pnpm build",
|
|
69
|
-
"release": "semantic-release",
|
|
70
|
-
"storybook:build": "storybook build",
|
|
71
|
-
"storybook:dev": "storybook dev -p 6006",
|
|
72
|
-
"test": "jest",
|
|
73
|
-
"test:browser": "start-server-and-test 'run-s workshop:build workshop:start' http://localhost:1337 'run-s cypress:run'",
|
|
74
|
-
"ts:check": "tsc",
|
|
75
|
-
"watch": "pkg watch --strict",
|
|
76
|
-
"workshop:build": "workshop build",
|
|
77
|
-
"workshop:dev": "workshop dev",
|
|
78
|
-
"workshop:start": "http-server -a localhost -c-0 -p 1337 -s -P http://localhost:1337/index.html? dist"
|
|
79
|
-
},
|
|
80
54
|
"commitlint": {
|
|
81
55
|
"extends": [
|
|
82
56
|
"@commitlint/config-conventional"
|
|
@@ -194,19 +168,37 @@
|
|
|
194
168
|
"react-is": "^18",
|
|
195
169
|
"styled-components": "^5.2 || ^6"
|
|
196
170
|
},
|
|
197
|
-
"packageManager": "pnpm@9.5.0",
|
|
198
171
|
"engines": {
|
|
199
172
|
"node": ">=14.0.0"
|
|
200
173
|
},
|
|
201
174
|
"publishConfig": {
|
|
202
175
|
"access": "public"
|
|
203
176
|
},
|
|
204
|
-
"pnpm": {
|
|
205
|
-
"overrides": {
|
|
206
|
-
"conventional-changelog-conventionalcommits": ">= 8.0.0"
|
|
207
|
-
}
|
|
208
|
-
},
|
|
209
177
|
"esm.sh": {
|
|
210
178
|
"bundle": false
|
|
179
|
+
},
|
|
180
|
+
"scripts": {
|
|
181
|
+
"build": "run-s clean pkg:build pkg:check figma:pkg:build",
|
|
182
|
+
"clean": "rimraf .workshop dist",
|
|
183
|
+
"commit": "cz",
|
|
184
|
+
"cypress:dev": "run-p dev cypress:open",
|
|
185
|
+
"cypress:open": "cypress open",
|
|
186
|
+
"cypress:run": "cypress run",
|
|
187
|
+
"dev": "run-p storybook:dev workshop:dev",
|
|
188
|
+
"figma:pkg:build": "cd figma && pnpm build",
|
|
189
|
+
"format": "prettier --write --cache --ignore-unknown .",
|
|
190
|
+
"lint": "eslint . --ext .cjs,.js,.jsx,.mjs,.ts,.tsx",
|
|
191
|
+
"pkg:build": "pkg build --strict",
|
|
192
|
+
"pkg:check": "pkg --strict",
|
|
193
|
+
"release": "semantic-release",
|
|
194
|
+
"storybook:build": "storybook build",
|
|
195
|
+
"storybook:dev": "storybook dev -p 6006",
|
|
196
|
+
"test": "jest",
|
|
197
|
+
"test:browser": "start-server-and-test 'run-s workshop:build workshop:start' http://localhost:1337 'run-s cypress:run'",
|
|
198
|
+
"ts:check": "tsc",
|
|
199
|
+
"watch": "pkg watch --strict",
|
|
200
|
+
"workshop:build": "workshop build",
|
|
201
|
+
"workshop:dev": "workshop dev",
|
|
202
|
+
"workshop:start": "http-server -a localhost -c-0 -p 1337 -s -P http://localhost:1337/index.html? dist"
|
|
211
203
|
}
|
|
212
|
-
}
|
|
204
|
+
}
|
|
@@ -18,8 +18,8 @@ export function useMatchMedia(
|
|
|
18
18
|
*/
|
|
19
19
|
let MEDIA_QUERY_CACHE: MediaQueryList | undefined
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
if (
|
|
21
|
+
function getMatchMedia(): MediaQueryList {
|
|
22
|
+
if (MEDIA_QUERY_CACHE === undefined) {
|
|
23
23
|
// As this function is only called during `subscribe` and `getSnapshot`, we can assume that the
|
|
24
24
|
// the `window` global is available and we're in a browser environment
|
|
25
25
|
MEDIA_QUERY_CACHE = window.matchMedia(mediaQueryString)
|
|
@@ -36,7 +36,13 @@ export function useMatchMedia(
|
|
|
36
36
|
|
|
37
37
|
return () => matchMedia.removeEventListener('change', onStoreChange)
|
|
38
38
|
},
|
|
39
|
-
getSnapshot: () =>
|
|
39
|
+
getSnapshot: () => {
|
|
40
|
+
try {
|
|
41
|
+
return getMatchMedia().matches
|
|
42
|
+
} catch (err) {
|
|
43
|
+
throw new Error(`Failed to match media query: ${mediaQueryString}`, {cause: err})
|
|
44
|
+
}
|
|
45
|
+
},
|
|
40
46
|
}
|
|
41
47
|
}, [mediaQueryString])
|
|
42
48
|
|