@sanity/ui 3.1.13 → 3.1.14
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/_chunks-cjs/_visual-editing.js +7 -3
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +7 -3
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/package.json +1 -1
- package/src/core/hooks/useDelayed.test.ts +20 -0
- package/src/core/hooks/useDelayedState.ts +9 -1
|
@@ -4705,7 +4705,7 @@ function _temp3(v_0) {
|
|
|
4705
4705
|
return v_0 === 0 || v_0 === 1 ? 0 : v_0 === 2 ? 1 : v_0 - 1;
|
|
4706
4706
|
}
|
|
4707
4707
|
function useDelayedState(initialState) {
|
|
4708
|
-
const $ = reactCompilerRuntime.c(
|
|
4708
|
+
const $ = reactCompilerRuntime.c(5), [state, setState] = react.useState(initialState), delayedAction = react.useRef(void 0);
|
|
4709
4709
|
let t0;
|
|
4710
4710
|
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = (nextState, delay) => {
|
|
4711
4711
|
const action = () => {
|
|
@@ -4716,8 +4716,12 @@ function useDelayedState(initialState) {
|
|
|
4716
4716
|
delayedAction.current = setTimeout(action, delay);
|
|
4717
4717
|
}, $[0] = t0) : t0 = $[0];
|
|
4718
4718
|
const onStateChange = t0;
|
|
4719
|
-
let t1;
|
|
4720
|
-
|
|
4719
|
+
let t1, t2;
|
|
4720
|
+
$[1] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => () => {
|
|
4721
|
+
delayedAction.current && clearTimeout(delayedAction.current);
|
|
4722
|
+
}, t2 = [], $[1] = t1, $[2] = t2) : (t1 = $[1], t2 = $[2]), react.useEffect(t1, t2);
|
|
4723
|
+
let t3;
|
|
4724
|
+
return $[3] !== state ? (t3 = [state, onStateChange], $[3] = state, $[4] = t3) : t3 = $[4], t3;
|
|
4721
4725
|
}
|
|
4722
4726
|
const DEFAULT_TOOLTIP_ARROW_WIDTH = 15, DEFAULT_TOOLTIP_ARROW_HEIGHT = 6, DEFAULT_TOOLTIP_ARROW_RADIUS = 2, DEFAULT_TOOLTIP_DISTANCE = 4, DEFAULT_TOOLTIP_PADDING = 4, DEFAULT_FALLBACK_PLACEMENTS = {
|
|
4723
4727
|
top: ["top-end", "top-start", "bottom", "left", "right"],
|