@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
|
@@ -4709,7 +4709,7 @@ function _temp3(v_0) {
|
|
|
4709
4709
|
return v_0 === 0 || v_0 === 1 ? 0 : v_0 === 2 ? 1 : v_0 - 1;
|
|
4710
4710
|
}
|
|
4711
4711
|
function useDelayedState(initialState) {
|
|
4712
|
-
const $ = c(
|
|
4712
|
+
const $ = c(5), [state, setState] = useState(initialState), delayedAction = useRef(void 0);
|
|
4713
4713
|
let t0;
|
|
4714
4714
|
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = (nextState, delay) => {
|
|
4715
4715
|
const action = () => {
|
|
@@ -4720,8 +4720,12 @@ function useDelayedState(initialState) {
|
|
|
4720
4720
|
delayedAction.current = setTimeout(action, delay);
|
|
4721
4721
|
}, $[0] = t0) : t0 = $[0];
|
|
4722
4722
|
const onStateChange = t0;
|
|
4723
|
-
let t1;
|
|
4724
|
-
|
|
4723
|
+
let t1, t2;
|
|
4724
|
+
$[1] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => () => {
|
|
4725
|
+
delayedAction.current && clearTimeout(delayedAction.current);
|
|
4726
|
+
}, t2 = [], $[1] = t1, $[2] = t2) : (t1 = $[1], t2 = $[2]), useEffect(t1, t2);
|
|
4727
|
+
let t3;
|
|
4728
|
+
return $[3] !== state ? (t3 = [state, onStateChange], $[3] = state, $[4] = t3) : t3 = $[4], t3;
|
|
4725
4729
|
}
|
|
4726
4730
|
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 = {
|
|
4727
4731
|
top: ["top-end", "top-start", "bottom", "left", "right"],
|