@sanity/ui 2.15.14 → 2.15.15
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.15.
|
|
3
|
+
"version": "2.15.15",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"sanity",
|
|
6
6
|
"ui",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"@sanity/icons": "^3.7.0",
|
|
121
121
|
"csstype": "^3.1.3",
|
|
122
122
|
"framer-motion": "^12.9.2",
|
|
123
|
-
"react-compiler-runtime": "19.
|
|
123
|
+
"react-compiler-runtime": "19.1.0-rc.1",
|
|
124
124
|
"react-refractor": "^2.2.0",
|
|
125
125
|
"use-effect-event": "^1.0.2"
|
|
126
126
|
},
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
"@sanity/pkg-utils": "^7.2.2",
|
|
136
136
|
"@sanity/prettier-config": "^1.0.3",
|
|
137
137
|
"@sanity/semantic-release-preset": "^5.0.0",
|
|
138
|
-
"@sanity/ui-workshop": "^2.
|
|
138
|
+
"@sanity/ui-workshop": "^2.1.2",
|
|
139
139
|
"@storybook/addon-a11y": "^8.6.12",
|
|
140
140
|
"@storybook/addon-docs": "^8.6.12",
|
|
141
141
|
"@storybook/addon-essentials": "^8.6.12",
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
"@types/react-is": "^19.0.0",
|
|
163
163
|
"@types/refractor": "^3.4.1",
|
|
164
164
|
"@vitejs/plugin-react": "^4.4.1",
|
|
165
|
-
"babel-plugin-react-compiler": "19.
|
|
165
|
+
"babel-plugin-react-compiler": "19.1.0-rc.1",
|
|
166
166
|
"babel-plugin-styled-components": "^2.1.4",
|
|
167
167
|
"commitizen": "^4.3.1",
|
|
168
168
|
"cypress": "^13.17.0",
|
|
@@ -175,8 +175,7 @@
|
|
|
175
175
|
"eslint-plugin-import": "^2.31.0",
|
|
176
176
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
177
177
|
"eslint-plugin-react": "^7.37.5",
|
|
178
|
-
"eslint-plugin-react-
|
|
179
|
-
"eslint-plugin-react-hooks": "experimental",
|
|
178
|
+
"eslint-plugin-react-hooks": "0.0.0-experimental-0038c501-20250429",
|
|
180
179
|
"eslint-plugin-react-refresh": "^0.4.20",
|
|
181
180
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
182
181
|
"eslint-plugin-storybook": "^0.12.0",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {useCallback, useDebugValue, useSyncExternalStore} from 'react'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Efficiently subscribes to `window.matchMedia` queries
|
|
@@ -11,36 +11,18 @@ export function useMatchMedia(
|
|
|
11
11
|
mediaQueryString: `(${string})`,
|
|
12
12
|
getServerSnapshot?: () => boolean,
|
|
13
13
|
): boolean {
|
|
14
|
-
const {subscribe, getSnapshot} = useMemo(() => {
|
|
15
|
-
/**
|
|
16
|
-
* `subscribe` and `getSnapshot` are only called on the client and both need access to the same `matchMedia` instance
|
|
17
|
-
* we don't want to eagerly instantiate it to ensure it's only created when actually used
|
|
18
|
-
*/
|
|
19
|
-
let MEDIA_QUERY_CACHE: MediaQueryList | undefined
|
|
20
|
-
|
|
21
|
-
const getMatchMedia = (): MediaQueryList => {
|
|
22
|
-
if (!MEDIA_QUERY_CACHE) {
|
|
23
|
-
// As this function is only called during `subscribe` and `getSnapshot`, we can assume that the
|
|
24
|
-
// the `window` global is available and we're in a browser environment
|
|
25
|
-
MEDIA_QUERY_CACHE = window.matchMedia(mediaQueryString)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return MEDIA_QUERY_CACHE
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return {
|
|
32
|
-
subscribe: (onStoreChange: () => void): (() => void) => {
|
|
33
|
-
const matchMedia = getMatchMedia()
|
|
34
|
-
|
|
35
|
-
matchMedia.addEventListener('change', onStoreChange)
|
|
36
|
-
|
|
37
|
-
return () => matchMedia.removeEventListener('change', onStoreChange)
|
|
38
|
-
},
|
|
39
|
-
getSnapshot: () => getMatchMedia().matches,
|
|
40
|
-
}
|
|
41
|
-
}, [mediaQueryString])
|
|
42
|
-
|
|
43
14
|
useDebugValue(mediaQueryString)
|
|
44
15
|
|
|
45
|
-
return useSyncExternalStore(
|
|
16
|
+
return useSyncExternalStore(
|
|
17
|
+
useCallback(
|
|
18
|
+
(onStoreChange) => {
|
|
19
|
+
const media = window.matchMedia(mediaQueryString)
|
|
20
|
+
media.addEventListener('change', onStoreChange)
|
|
21
|
+
return () => media.removeEventListener('change', onStoreChange)
|
|
22
|
+
},
|
|
23
|
+
[mediaQueryString],
|
|
24
|
+
),
|
|
25
|
+
() => window.matchMedia(mediaQueryString).matches,
|
|
26
|
+
getServerSnapshot,
|
|
27
|
+
)
|
|
46
28
|
}
|