@sanity/ui 2.8.23 → 2.8.24-canary.1
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.d.mts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.esm.js +22 -13
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +22 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +27 -35
- package/src/core/hooks/useArrayProp.ts +8 -6
- package/src/core/styles/helpers.ts +2 -2
- package/src/core/utils/portal/portalProvider.tsx +10 -8
package/dist/index.js
CHANGED
|
@@ -39,8 +39,8 @@ function _responsive(media, values, callback) {
|
|
|
39
39
|
[`@media screen and (min-width: ${media[mediaIndex - 1]}px)`]: statement
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
function _getArrayProp(val
|
|
43
|
-
return val === void 0 ?
|
|
42
|
+
function _getArrayProp(val) {
|
|
43
|
+
return val === void 0 ? EMPTY_ARRAY : Array.isArray(val) ? val : [val];
|
|
44
44
|
}
|
|
45
45
|
function _getResponsiveSpace(theme$1, props, spaceIndexes = EMPTY_ARRAY) {
|
|
46
46
|
if (!Array.isArray(spaceIndexes))
|
|
@@ -147,12 +147,21 @@ function responsiveTextAlignStyle(props) {
|
|
|
147
147
|
function responsiveTextFont(props) {
|
|
148
148
|
return responsiveFont("text", props);
|
|
149
149
|
}
|
|
150
|
-
function useArrayProp(val
|
|
151
|
-
const $ = reactCompilerRuntime.c(
|
|
150
|
+
function useArrayProp(val) {
|
|
151
|
+
const $ = reactCompilerRuntime.c(6);
|
|
152
152
|
let t0;
|
|
153
|
-
$[0] !==
|
|
154
|
-
const [t1, setCache] = react.useState(t0), [cachedVal, cachedHash] = t1
|
|
155
|
-
|
|
153
|
+
$[0] !== val ? (t0 = () => [_getArrayProp(val), JSON.stringify(val)], $[0] = val, $[1] = t0) : t0 = $[1];
|
|
154
|
+
const [t1, setCache] = react.useState(t0), [cachedVal, cachedHash] = t1;
|
|
155
|
+
let result = cachedVal, t2;
|
|
156
|
+
$[2] !== val ? (t2 = JSON.stringify(val), $[2] = val, $[3] = t2) : t2 = $[3];
|
|
157
|
+
const hash = t2;
|
|
158
|
+
if (hash !== cachedHash) {
|
|
159
|
+
let t3;
|
|
160
|
+
$[4] !== val ? (t3 = _getArrayProp(val), $[4] = val, $[5] = t3) : t3 = $[5];
|
|
161
|
+
const current = t3;
|
|
162
|
+
setCache([current, hash]), result = current;
|
|
163
|
+
}
|
|
164
|
+
return result;
|
|
156
165
|
}
|
|
157
166
|
function _getElements(element, elementsArg) {
|
|
158
167
|
const ret = [element];
|
|
@@ -3503,9 +3512,8 @@ function PortalProvider(props) {
|
|
|
3503
3512
|
const $ = reactCompilerRuntime.c(7), {
|
|
3504
3513
|
boundaryElement,
|
|
3505
3514
|
children,
|
|
3506
|
-
element
|
|
3507
|
-
|
|
3508
|
-
} = props, elements = useUnique(elementsProp), fallbackElement = react.useSyncExternalStore(emptySubscribe, _temp$3, _temp2$1);
|
|
3515
|
+
element
|
|
3516
|
+
} = props, elements = useUnique(props.__unstable_elements), fallbackElement = react.useSyncExternalStore(emptySubscribe, _temp$3, _temp2$1);
|
|
3509
3517
|
let t0;
|
|
3510
3518
|
const t1 = boundaryElement || null, t2 = element || fallbackElement;
|
|
3511
3519
|
let t3;
|
|
@@ -3529,10 +3537,11 @@ PortalProvider.displayName = "PortalProvider";
|
|
|
3529
3537
|
const emptySubscribe = () => () => {
|
|
3530
3538
|
};
|
|
3531
3539
|
function useUnique(value) {
|
|
3532
|
-
const
|
|
3533
|
-
|
|
3540
|
+
const [cachedValue, setCachedValue] = react.useState(value);
|
|
3541
|
+
let result = cachedValue;
|
|
3542
|
+
return isEqual(cachedValue, value) || (setCachedValue(value), result = value), result;
|
|
3534
3543
|
}
|
|
3535
|
-
function
|
|
3544
|
+
function isEqual(objA, objB) {
|
|
3536
3545
|
if (!objA || !objB)
|
|
3537
3546
|
return objA === objB;
|
|
3538
3547
|
const keysA = Object.keys(objA), keysB = Object.keys(objB);
|