@contember/react-utils 2.1.0-alpha.30 → 2.1.0-alpha.36
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 +11 -3
- package/src/debug-context/Constants.ts +1 -1
- package/src/debug-context/Context.tsx +13 -13
- package/src/hooks/unwrapRefValue.ts +1 -1
- package/src/hooks/useArrayMapMemo.ts +2 -2
- package/src/hooks/useAutoHeightTextArea.ts +1 -0
- package/src/hooks/useChildrenAsLabel.ts +7 -8
- package/src/hooks/useConstantLengthInvariant.ts +1 -3
- package/src/hooks/useConstantValueInvariant.ts +0 -1
- package/src/hooks/useDebounceCallback.ts +1 -1
- package/src/hooks/useExpectSameValueReference.ts +9 -6
- package/src/hooks/useOnElementMouseEnterDelayedCallback.ts +1 -1
- package/src/hooks/useOnElementResize.ts +2 -1
- package/src/hooks/useOnWindowResize.ts +3 -1
- package/src/hooks/useStoredState.ts +5 -3
- package/src/referentiallyStable/useReferentiallyStableCallback.ts +8 -8
- package/tests/hooks/useChildrenAsLabel.test.tsx +1 -0
- package/tests/hooks/useId.test.ts +1 -1
- package/dist/development/index.cjs +0 -86
- package/dist/development/index.cjs.map +0 -1
- package/dist/development/index.js +0 -86
- package/dist/development/index.js.map +0 -1
- package/dist/development/src/context/createContext.cjs +0 -10
- package/dist/development/src/context/createContext.cjs.map +0 -1
- package/dist/development/src/context/createContext.js +0 -10
- package/dist/development/src/context/createContext.js.map +0 -1
- package/dist/development/src/context/createRequiredContext.cjs +0 -18
- package/dist/development/src/context/createRequiredContext.cjs.map +0 -1
- package/dist/development/src/context/createRequiredContext.js +0 -18
- package/dist/development/src/context/createRequiredContext.js.map +0 -1
- package/dist/development/src/debug-context/Constants.cjs +0 -25
- package/dist/development/src/debug-context/Constants.cjs.map +0 -1
- package/dist/development/src/debug-context/Constants.js +0 -25
- package/dist/development/src/debug-context/Constants.js.map +0 -1
- package/dist/development/src/debug-context/Context.cjs +0 -72
- package/dist/development/src/debug-context/Context.cjs.map +0 -1
- package/dist/development/src/debug-context/Context.js +0 -72
- package/dist/development/src/debug-context/Context.js.map +0 -1
- package/dist/development/src/hooks/unwrapRefValue.cjs +0 -11
- package/dist/development/src/hooks/unwrapRefValue.cjs.map +0 -1
- package/dist/development/src/hooks/unwrapRefValue.js +0 -11
- package/dist/development/src/hooks/unwrapRefValue.js.map +0 -1
- package/dist/development/src/hooks/useAbortController.cjs +0 -17
- package/dist/development/src/hooks/useAbortController.cjs.map +0 -1
- package/dist/development/src/hooks/useAbortController.js +0 -17
- package/dist/development/src/hooks/useAbortController.js.map +0 -1
- package/dist/development/src/hooks/useArrayMapMemo.cjs +0 -11
- package/dist/development/src/hooks/useArrayMapMemo.cjs.map +0 -1
- package/dist/development/src/hooks/useArrayMapMemo.js +0 -11
- package/dist/development/src/hooks/useArrayMapMemo.js.map +0 -1
- package/dist/development/src/hooks/useAutoHeightTextArea.cjs +0 -43
- package/dist/development/src/hooks/useAutoHeightTextArea.cjs.map +0 -1
- package/dist/development/src/hooks/useAutoHeightTextArea.js +0 -43
- package/dist/development/src/hooks/useAutoHeightTextArea.js.map +0 -1
- package/dist/development/src/hooks/useChildrenAsLabel.cjs +0 -52
- package/dist/development/src/hooks/useChildrenAsLabel.cjs.map +0 -1
- package/dist/development/src/hooks/useChildrenAsLabel.js +0 -52
- package/dist/development/src/hooks/useChildrenAsLabel.js.map +0 -1
- package/dist/development/src/hooks/useComposeRef.cjs +0 -31
- package/dist/development/src/hooks/useComposeRef.cjs.map +0 -1
- package/dist/development/src/hooks/useComposeRef.js +0 -31
- package/dist/development/src/hooks/useComposeRef.js.map +0 -1
- package/dist/development/src/hooks/useConstantLengthInvariant.cjs +0 -15
- package/dist/development/src/hooks/useConstantLengthInvariant.cjs.map +0 -1
- package/dist/development/src/hooks/useConstantLengthInvariant.js +0 -15
- package/dist/development/src/hooks/useConstantLengthInvariant.js.map +0 -1
- package/dist/development/src/hooks/useConstantValueInvariant.cjs +0 -15
- package/dist/development/src/hooks/useConstantValueInvariant.cjs.map +0 -1
- package/dist/development/src/hooks/useConstantValueInvariant.js +0 -15
- package/dist/development/src/hooks/useConstantValueInvariant.js.map +0 -1
- package/dist/development/src/hooks/useDebounce.cjs +0 -15
- package/dist/development/src/hooks/useDebounce.cjs.map +0 -1
- package/dist/development/src/hooks/useDebounce.js +0 -15
- package/dist/development/src/hooks/useDebounce.js.map +0 -1
- package/dist/development/src/hooks/useDebounceCallback.cjs +0 -19
- package/dist/development/src/hooks/useDebounceCallback.cjs.map +0 -1
- package/dist/development/src/hooks/useDebounceCallback.js +0 -19
- package/dist/development/src/hooks/useDebounceCallback.js.map +0 -1
- package/dist/development/src/hooks/useDocumentTitle.cjs +0 -22
- package/dist/development/src/hooks/useDocumentTitle.cjs.map +0 -1
- package/dist/development/src/hooks/useDocumentTitle.js +0 -22
- package/dist/development/src/hooks/useDocumentTitle.js.map +0 -1
- package/dist/development/src/hooks/useExpectSameValueReference.cjs +0 -24
- package/dist/development/src/hooks/useExpectSameValueReference.cjs.map +0 -1
- package/dist/development/src/hooks/useExpectSameValueReference.js +0 -24
- package/dist/development/src/hooks/useExpectSameValueReference.js.map +0 -1
- package/dist/development/src/hooks/useForceRender.cjs +0 -9
- package/dist/development/src/hooks/useForceRender.cjs.map +0 -1
- package/dist/development/src/hooks/useForceRender.js +0 -9
- package/dist/development/src/hooks/useForceRender.js.map +0 -1
- package/dist/development/src/hooks/useId.cjs +0 -13
- package/dist/development/src/hooks/useId.cjs.map +0 -1
- package/dist/development/src/hooks/useId.js +0 -13
- package/dist/development/src/hooks/useId.js.map +0 -1
- package/dist/development/src/hooks/useIsMounted.cjs +0 -18
- package/dist/development/src/hooks/useIsMounted.cjs.map +0 -1
- package/dist/development/src/hooks/useIsMounted.js +0 -18
- package/dist/development/src/hooks/useIsMounted.js.map +0 -1
- package/dist/development/src/hooks/useObjectMemo.cjs +0 -27
- package/dist/development/src/hooks/useObjectMemo.cjs.map +0 -1
- package/dist/development/src/hooks/useObjectMemo.js +0 -27
- package/dist/development/src/hooks/useObjectMemo.js.map +0 -1
- package/dist/development/src/hooks/useOnElementClickOutsideCallback.cjs +0 -20
- package/dist/development/src/hooks/useOnElementClickOutsideCallback.cjs.map +0 -1
- package/dist/development/src/hooks/useOnElementClickOutsideCallback.js +0 -20
- package/dist/development/src/hooks/useOnElementClickOutsideCallback.js.map +0 -1
- package/dist/development/src/hooks/useOnElementMouseEnterDelayedCallback.cjs +0 -33
- package/dist/development/src/hooks/useOnElementMouseEnterDelayedCallback.cjs.map +0 -1
- package/dist/development/src/hooks/useOnElementMouseEnterDelayedCallback.js +0 -33
- package/dist/development/src/hooks/useOnElementMouseEnterDelayedCallback.js.map +0 -1
- package/dist/development/src/hooks/useOnElementResize.cjs +0 -42
- package/dist/development/src/hooks/useOnElementResize.cjs.map +0 -1
- package/dist/development/src/hooks/useOnElementResize.js +0 -42
- package/dist/development/src/hooks/useOnElementResize.js.map +0 -1
- package/dist/development/src/hooks/useOnWindowResize.cjs +0 -36
- package/dist/development/src/hooks/useOnWindowResize.cjs.map +0 -1
- package/dist/development/src/hooks/useOnWindowResize.js +0 -36
- package/dist/development/src/hooks/useOnWindowResize.js.map +0 -1
- package/dist/development/src/hooks/usePreviousValue.cjs +0 -12
- package/dist/development/src/hooks/usePreviousValue.cjs.map +0 -1
- package/dist/development/src/hooks/usePreviousValue.js +0 -12
- package/dist/development/src/hooks/usePreviousValue.js.map +0 -1
- package/dist/development/src/hooks/useStoredState.cjs +0 -100
- package/dist/development/src/hooks/useStoredState.cjs.map +0 -1
- package/dist/development/src/hooks/useStoredState.js +0 -100
- package/dist/development/src/hooks/useStoredState.js.map +0 -1
- package/dist/development/src/hooks/useUpdatedRef.cjs +0 -10
- package/dist/development/src/hooks/useUpdatedRef.cjs.map +0 -1
- package/dist/development/src/hooks/useUpdatedRef.js +0 -10
- package/dist/development/src/hooks/useUpdatedRef.js.map +0 -1
- package/dist/development/src/hooks/useWindowSize.cjs +0 -20
- package/dist/development/src/hooks/useWindowSize.cjs.map +0 -1
- package/dist/development/src/hooks/useWindowSize.js +0 -20
- package/dist/development/src/hooks/useWindowSize.js.map +0 -1
- package/dist/development/src/referentiallyStable/emptyArray.cjs +0 -5
- package/dist/development/src/referentiallyStable/emptyArray.cjs.map +0 -1
- package/dist/development/src/referentiallyStable/emptyArray.js +0 -5
- package/dist/development/src/referentiallyStable/emptyArray.js.map +0 -1
- package/dist/development/src/referentiallyStable/emptyObject.cjs +0 -5
- package/dist/development/src/referentiallyStable/emptyObject.cjs.map +0 -1
- package/dist/development/src/referentiallyStable/emptyObject.js +0 -5
- package/dist/development/src/referentiallyStable/emptyObject.js.map +0 -1
- package/dist/development/src/referentiallyStable/identityFunction.cjs +0 -5
- package/dist/development/src/referentiallyStable/identityFunction.cjs.map +0 -1
- package/dist/development/src/referentiallyStable/identityFunction.js +0 -5
- package/dist/development/src/referentiallyStable/identityFunction.js.map +0 -1
- package/dist/development/src/referentiallyStable/noop.cjs +0 -5
- package/dist/development/src/referentiallyStable/noop.cjs.map +0 -1
- package/dist/development/src/referentiallyStable/noop.js +0 -5
- package/dist/development/src/referentiallyStable/noop.js.map +0 -1
- package/dist/development/src/referentiallyStable/returnFalse.cjs +0 -5
- package/dist/development/src/referentiallyStable/returnFalse.cjs.map +0 -1
- package/dist/development/src/referentiallyStable/returnFalse.js +0 -5
- package/dist/development/src/referentiallyStable/returnFalse.js.map +0 -1
- package/dist/development/src/referentiallyStable/returnTrue.cjs +0 -5
- package/dist/development/src/referentiallyStable/returnTrue.cjs.map +0 -1
- package/dist/development/src/referentiallyStable/returnTrue.js +0 -5
- package/dist/development/src/referentiallyStable/returnTrue.js.map +0 -1
- package/dist/development/src/referentiallyStable/useReferentiallyStableCallback.cjs +0 -12
- package/dist/development/src/referentiallyStable/useReferentiallyStableCallback.cjs.map +0 -1
- package/dist/development/src/referentiallyStable/useReferentiallyStableCallback.js +0 -12
- package/dist/development/src/referentiallyStable/useReferentiallyStableCallback.js.map +0 -1
- package/dist/production/index.cjs +0 -86
- package/dist/production/index.cjs.map +0 -1
- package/dist/production/index.js +0 -86
- package/dist/production/index.js.map +0 -1
- package/dist/production/src/context/createContext.cjs +0 -10
- package/dist/production/src/context/createContext.cjs.map +0 -1
- package/dist/production/src/context/createContext.js +0 -10
- package/dist/production/src/context/createContext.js.map +0 -1
- package/dist/production/src/context/createRequiredContext.cjs +0 -18
- package/dist/production/src/context/createRequiredContext.cjs.map +0 -1
- package/dist/production/src/context/createRequiredContext.js +0 -18
- package/dist/production/src/context/createRequiredContext.js.map +0 -1
- package/dist/production/src/debug-context/Constants.cjs +0 -25
- package/dist/production/src/debug-context/Constants.cjs.map +0 -1
- package/dist/production/src/debug-context/Constants.js +0 -25
- package/dist/production/src/debug-context/Constants.js.map +0 -1
- package/dist/production/src/debug-context/Context.cjs +0 -68
- package/dist/production/src/debug-context/Context.cjs.map +0 -1
- package/dist/production/src/debug-context/Context.js +0 -68
- package/dist/production/src/debug-context/Context.js.map +0 -1
- package/dist/production/src/hooks/unwrapRefValue.cjs +0 -11
- package/dist/production/src/hooks/unwrapRefValue.cjs.map +0 -1
- package/dist/production/src/hooks/unwrapRefValue.js +0 -11
- package/dist/production/src/hooks/unwrapRefValue.js.map +0 -1
- package/dist/production/src/hooks/useAbortController.cjs +0 -17
- package/dist/production/src/hooks/useAbortController.cjs.map +0 -1
- package/dist/production/src/hooks/useAbortController.js +0 -17
- package/dist/production/src/hooks/useAbortController.js.map +0 -1
- package/dist/production/src/hooks/useArrayMapMemo.cjs +0 -9
- package/dist/production/src/hooks/useArrayMapMemo.cjs.map +0 -1
- package/dist/production/src/hooks/useArrayMapMemo.js +0 -9
- package/dist/production/src/hooks/useArrayMapMemo.js.map +0 -1
- package/dist/production/src/hooks/useAutoHeightTextArea.cjs +0 -43
- package/dist/production/src/hooks/useAutoHeightTextArea.cjs.map +0 -1
- package/dist/production/src/hooks/useAutoHeightTextArea.js +0 -43
- package/dist/production/src/hooks/useAutoHeightTextArea.js.map +0 -1
- package/dist/production/src/hooks/useChildrenAsLabel.cjs +0 -50
- package/dist/production/src/hooks/useChildrenAsLabel.cjs.map +0 -1
- package/dist/production/src/hooks/useChildrenAsLabel.js +0 -50
- package/dist/production/src/hooks/useChildrenAsLabel.js.map +0 -1
- package/dist/production/src/hooks/useComposeRef.cjs +0 -31
- package/dist/production/src/hooks/useComposeRef.cjs.map +0 -1
- package/dist/production/src/hooks/useComposeRef.js +0 -31
- package/dist/production/src/hooks/useComposeRef.js.map +0 -1
- package/dist/production/src/hooks/useConstantLengthInvariant.cjs +0 -6
- package/dist/production/src/hooks/useConstantLengthInvariant.cjs.map +0 -1
- package/dist/production/src/hooks/useConstantLengthInvariant.js +0 -6
- package/dist/production/src/hooks/useConstantLengthInvariant.js.map +0 -1
- package/dist/production/src/hooks/useConstantValueInvariant.cjs +0 -6
- package/dist/production/src/hooks/useConstantValueInvariant.cjs.map +0 -1
- package/dist/production/src/hooks/useConstantValueInvariant.js +0 -6
- package/dist/production/src/hooks/useConstantValueInvariant.js.map +0 -1
- package/dist/production/src/hooks/useDebounce.cjs +0 -15
- package/dist/production/src/hooks/useDebounce.cjs.map +0 -1
- package/dist/production/src/hooks/useDebounce.js +0 -15
- package/dist/production/src/hooks/useDebounce.js.map +0 -1
- package/dist/production/src/hooks/useDebounceCallback.cjs +0 -19
- package/dist/production/src/hooks/useDebounceCallback.cjs.map +0 -1
- package/dist/production/src/hooks/useDebounceCallback.js +0 -19
- package/dist/production/src/hooks/useDebounceCallback.js.map +0 -1
- package/dist/production/src/hooks/useDocumentTitle.cjs +0 -22
- package/dist/production/src/hooks/useDocumentTitle.cjs.map +0 -1
- package/dist/production/src/hooks/useDocumentTitle.js +0 -22
- package/dist/production/src/hooks/useDocumentTitle.js.map +0 -1
- package/dist/production/src/hooks/useExpectSameValueReference.cjs +0 -15
- package/dist/production/src/hooks/useExpectSameValueReference.cjs.map +0 -1
- package/dist/production/src/hooks/useExpectSameValueReference.js +0 -15
- package/dist/production/src/hooks/useExpectSameValueReference.js.map +0 -1
- package/dist/production/src/hooks/useForceRender.cjs +0 -9
- package/dist/production/src/hooks/useForceRender.cjs.map +0 -1
- package/dist/production/src/hooks/useForceRender.js +0 -9
- package/dist/production/src/hooks/useForceRender.js.map +0 -1
- package/dist/production/src/hooks/useId.cjs +0 -13
- package/dist/production/src/hooks/useId.cjs.map +0 -1
- package/dist/production/src/hooks/useId.js +0 -13
- package/dist/production/src/hooks/useId.js.map +0 -1
- package/dist/production/src/hooks/useIsMounted.cjs +0 -18
- package/dist/production/src/hooks/useIsMounted.cjs.map +0 -1
- package/dist/production/src/hooks/useIsMounted.js +0 -18
- package/dist/production/src/hooks/useIsMounted.js.map +0 -1
- package/dist/production/src/hooks/useObjectMemo.cjs +0 -27
- package/dist/production/src/hooks/useObjectMemo.cjs.map +0 -1
- package/dist/production/src/hooks/useObjectMemo.js +0 -27
- package/dist/production/src/hooks/useObjectMemo.js.map +0 -1
- package/dist/production/src/hooks/useOnElementClickOutsideCallback.cjs +0 -20
- package/dist/production/src/hooks/useOnElementClickOutsideCallback.cjs.map +0 -1
- package/dist/production/src/hooks/useOnElementClickOutsideCallback.js +0 -20
- package/dist/production/src/hooks/useOnElementClickOutsideCallback.js.map +0 -1
- package/dist/production/src/hooks/useOnElementMouseEnterDelayedCallback.cjs +0 -33
- package/dist/production/src/hooks/useOnElementMouseEnterDelayedCallback.cjs.map +0 -1
- package/dist/production/src/hooks/useOnElementMouseEnterDelayedCallback.js +0 -33
- package/dist/production/src/hooks/useOnElementMouseEnterDelayedCallback.js.map +0 -1
- package/dist/production/src/hooks/useOnElementResize.cjs +0 -42
- package/dist/production/src/hooks/useOnElementResize.cjs.map +0 -1
- package/dist/production/src/hooks/useOnElementResize.js +0 -42
- package/dist/production/src/hooks/useOnElementResize.js.map +0 -1
- package/dist/production/src/hooks/useOnWindowResize.cjs +0 -36
- package/dist/production/src/hooks/useOnWindowResize.cjs.map +0 -1
- package/dist/production/src/hooks/useOnWindowResize.js +0 -36
- package/dist/production/src/hooks/useOnWindowResize.js.map +0 -1
- package/dist/production/src/hooks/usePreviousValue.cjs +0 -12
- package/dist/production/src/hooks/usePreviousValue.cjs.map +0 -1
- package/dist/production/src/hooks/usePreviousValue.js +0 -12
- package/dist/production/src/hooks/usePreviousValue.js.map +0 -1
- package/dist/production/src/hooks/useStoredState.cjs +0 -100
- package/dist/production/src/hooks/useStoredState.cjs.map +0 -1
- package/dist/production/src/hooks/useStoredState.js +0 -100
- package/dist/production/src/hooks/useStoredState.js.map +0 -1
- package/dist/production/src/hooks/useUpdatedRef.cjs +0 -10
- package/dist/production/src/hooks/useUpdatedRef.cjs.map +0 -1
- package/dist/production/src/hooks/useUpdatedRef.js +0 -10
- package/dist/production/src/hooks/useUpdatedRef.js.map +0 -1
- package/dist/production/src/hooks/useWindowSize.cjs +0 -20
- package/dist/production/src/hooks/useWindowSize.cjs.map +0 -1
- package/dist/production/src/hooks/useWindowSize.js +0 -20
- package/dist/production/src/hooks/useWindowSize.js.map +0 -1
- package/dist/production/src/referentiallyStable/emptyArray.cjs +0 -5
- package/dist/production/src/referentiallyStable/emptyArray.cjs.map +0 -1
- package/dist/production/src/referentiallyStable/emptyArray.js +0 -5
- package/dist/production/src/referentiallyStable/emptyArray.js.map +0 -1
- package/dist/production/src/referentiallyStable/emptyObject.cjs +0 -5
- package/dist/production/src/referentiallyStable/emptyObject.cjs.map +0 -1
- package/dist/production/src/referentiallyStable/emptyObject.js +0 -5
- package/dist/production/src/referentiallyStable/emptyObject.js.map +0 -1
- package/dist/production/src/referentiallyStable/identityFunction.cjs +0 -5
- package/dist/production/src/referentiallyStable/identityFunction.cjs.map +0 -1
- package/dist/production/src/referentiallyStable/identityFunction.js +0 -5
- package/dist/production/src/referentiallyStable/identityFunction.js.map +0 -1
- package/dist/production/src/referentiallyStable/noop.cjs +0 -5
- package/dist/production/src/referentiallyStable/noop.cjs.map +0 -1
- package/dist/production/src/referentiallyStable/noop.js +0 -5
- package/dist/production/src/referentiallyStable/noop.js.map +0 -1
- package/dist/production/src/referentiallyStable/returnFalse.cjs +0 -5
- package/dist/production/src/referentiallyStable/returnFalse.cjs.map +0 -1
- package/dist/production/src/referentiallyStable/returnFalse.js +0 -5
- package/dist/production/src/referentiallyStable/returnFalse.js.map +0 -1
- package/dist/production/src/referentiallyStable/returnTrue.cjs +0 -5
- package/dist/production/src/referentiallyStable/returnTrue.cjs.map +0 -1
- package/dist/production/src/referentiallyStable/returnTrue.js +0 -5
- package/dist/production/src/referentiallyStable/returnTrue.js.map +0 -1
- package/dist/production/src/referentiallyStable/useReferentiallyStableCallback.cjs +0 -12
- package/dist/production/src/referentiallyStable/useReferentiallyStableCallback.cjs.map +0 -1
- package/dist/production/src/referentiallyStable/useReferentiallyStableCallback.js +0 -12
- package/dist/production/src/referentiallyStable/useReferentiallyStableCallback.js.map +0 -1
- package/dist/types/context/createContext.d.ts +0 -3
- package/dist/types/context/createContext.d.ts.map +0 -1
- package/dist/types/context/createRequiredContext.d.ts +0 -3
- package/dist/types/context/createRequiredContext.d.ts.map +0 -1
- package/dist/types/context/index.d.ts +0 -3
- package/dist/types/context/index.d.ts.map +0 -1
- package/dist/types/debug-context/Constants.d.ts +0 -6
- package/dist/types/debug-context/Constants.d.ts.map +0 -1
- package/dist/types/debug-context/Context.d.ts +0 -15
- package/dist/types/debug-context/Context.d.ts.map +0 -1
- package/dist/types/debug-context/Types.d.ts +0 -13
- package/dist/types/debug-context/Types.d.ts.map +0 -1
- package/dist/types/debug-context/index.d.ts +0 -4
- package/dist/types/debug-context/index.d.ts.map +0 -1
- package/dist/types/hooks/index.d.ts +0 -25
- package/dist/types/hooks/index.d.ts.map +0 -1
- package/dist/types/hooks/unwrapRefValue.d.ts +0 -9
- package/dist/types/hooks/unwrapRefValue.d.ts.map +0 -1
- package/dist/types/hooks/useAbortController.d.ts +0 -2
- package/dist/types/hooks/useAbortController.d.ts.map +0 -1
- package/dist/types/hooks/useArrayMapMemo.d.ts +0 -10
- package/dist/types/hooks/useArrayMapMemo.d.ts.map +0 -1
- package/dist/types/hooks/useAutoHeightTextArea.d.ts +0 -3
- package/dist/types/hooks/useAutoHeightTextArea.d.ts.map +0 -1
- package/dist/types/hooks/useChildrenAsLabel.d.ts +0 -18
- package/dist/types/hooks/useChildrenAsLabel.d.ts.map +0 -1
- package/dist/types/hooks/useComposeRef.d.ts +0 -16
- package/dist/types/hooks/useComposeRef.d.ts.map +0 -1
- package/dist/types/hooks/useConstantLengthInvariant.d.ts +0 -2
- package/dist/types/hooks/useConstantLengthInvariant.d.ts.map +0 -1
- package/dist/types/hooks/useConstantValueInvariant.d.ts +0 -2
- package/dist/types/hooks/useConstantValueInvariant.d.ts.map +0 -1
- package/dist/types/hooks/useDebounce.d.ts +0 -2
- package/dist/types/hooks/useDebounce.d.ts.map +0 -1
- package/dist/types/hooks/useDebounceCallback.d.ts +0 -2
- package/dist/types/hooks/useDebounceCallback.d.ts.map +0 -1
- package/dist/types/hooks/useDocumentTitle.d.ts +0 -2
- package/dist/types/hooks/useDocumentTitle.d.ts.map +0 -1
- package/dist/types/hooks/useExpectSameValueReference.d.ts +0 -24
- package/dist/types/hooks/useExpectSameValueReference.d.ts.map +0 -1
- package/dist/types/hooks/useForceRender.d.ts +0 -2
- package/dist/types/hooks/useForceRender.d.ts.map +0 -1
- package/dist/types/hooks/useId.d.ts +0 -10
- package/dist/types/hooks/useId.d.ts.map +0 -1
- package/dist/types/hooks/useIsMounted.d.ts +0 -2
- package/dist/types/hooks/useIsMounted.d.ts.map +0 -1
- package/dist/types/hooks/useObjectMemo.d.ts +0 -2
- package/dist/types/hooks/useObjectMemo.d.ts.map +0 -1
- package/dist/types/hooks/useOnElementClickOutsideCallback.d.ts +0 -3
- package/dist/types/hooks/useOnElementClickOutsideCallback.d.ts.map +0 -1
- package/dist/types/hooks/useOnElementMouseEnterDelayedCallback.d.ts +0 -14
- package/dist/types/hooks/useOnElementMouseEnterDelayedCallback.d.ts.map +0 -1
- package/dist/types/hooks/useOnElementResize.d.ts +0 -3
- package/dist/types/hooks/useOnElementResize.d.ts.map +0 -1
- package/dist/types/hooks/useOnWindowResize.d.ts +0 -2
- package/dist/types/hooks/useOnWindowResize.d.ts.map +0 -1
- package/dist/types/hooks/usePreviousValue.d.ts +0 -2
- package/dist/types/hooks/usePreviousValue.d.ts.map +0 -1
- package/dist/types/hooks/useStoredState.d.ts +0 -18
- package/dist/types/hooks/useStoredState.d.ts.map +0 -1
- package/dist/types/hooks/useUpdatedRef.d.ts +0 -8
- package/dist/types/hooks/useUpdatedRef.d.ts.map +0 -1
- package/dist/types/hooks/useWindowSize.d.ts +0 -5
- package/dist/types/hooks/useWindowSize.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -6
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/referentiallyStable/emptyArray.d.ts +0 -2
- package/dist/types/referentiallyStable/emptyArray.d.ts.map +0 -1
- package/dist/types/referentiallyStable/emptyObject.d.ts +0 -2
- package/dist/types/referentiallyStable/emptyObject.d.ts.map +0 -1
- package/dist/types/referentiallyStable/identityFunction.d.ts +0 -2
- package/dist/types/referentiallyStable/identityFunction.d.ts.map +0 -1
- package/dist/types/referentiallyStable/index.d.ts +0 -8
- package/dist/types/referentiallyStable/index.d.ts.map +0 -1
- package/dist/types/referentiallyStable/noop.d.ts +0 -2
- package/dist/types/referentiallyStable/noop.d.ts.map +0 -1
- package/dist/types/referentiallyStable/returnFalse.d.ts +0 -2
- package/dist/types/referentiallyStable/returnFalse.d.ts.map +0 -1
- package/dist/types/referentiallyStable/returnTrue.d.ts +0 -2
- package/dist/types/referentiallyStable/returnTrue.d.ts.map +0 -1
- package/dist/types/referentiallyStable/useReferentiallyStableCallback.d.ts +0 -3
- package/dist/types/referentiallyStable/useReferentiallyStableCallback.d.ts.map +0 -1
- package/dist/types/tsconfig.tsbuildinfo +0 -1
- package/dist/types/types/PropsWithRequiredChildren.d.ts +0 -5
- package/dist/types/types/PropsWithRequiredChildren.d.ts.map +0 -1
- package/dist/types/types/Serializable.d.ts +0 -4
- package/dist/types/types/Serializable.d.ts.map +0 -1
- package/dist/types/types/index.d.ts +0 -3
- package/dist/types/types/index.d.ts.map +0 -1
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import equal from "fast-deep-equal/es6/index.js";
|
|
2
|
-
import { useRef } from "react";
|
|
3
|
-
function useExpectSameValueReference(next, shouldThrow = false) {
|
|
4
|
-
const previous = useRef(next);
|
|
5
|
-
if (next !== previous.current && typeof next === "object" && typeof previous.current === "object" && equal(next, previous.current)) {
|
|
6
|
-
if (shouldThrow) {
|
|
7
|
-
throw new Error("Expecting same reference for same values");
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
previous.current = next;
|
|
11
|
-
}
|
|
12
|
-
export {
|
|
13
|
-
useExpectSameValueReference
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=useExpectSameValueReference.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useExpectSameValueReference.js","sources":["../../../../../packages/react-utils/src/hooks/useExpectSameValueReference.ts"],"sourcesContent":["import deepEqual from 'fast-deep-equal/es6/index.js'\nimport { useRef } from 'react'\n\n/**\n * Checks whether the next value is the same reference as the previous one\n *\n * If not, it checks whether the values are deeply equal. If not, it logs an error.\n *\n * @param next - Value to be checked.\n * @param shouldThrow - If true, it throws an error instead of logging it. Defaults to false.\n * @returns void\n * -\n * @example\n * ```ts\n * useExpectSameValueReference(style)\n * ```\n * @example\n * ```ts\n * useExpectSameValueReference(style, true)\n * ```\n * @example\n * ```ts\n * useExpectSameValueReference(style, import.meta.env.DEV)\n * ```\n */\nexport function useExpectSameValueReference<T>(next: T, shouldThrow: boolean = false) {\n\tconst previous = useRef(next)\n\n\tif (next !== previous.current\n\t\t&& typeof next === 'object'\n\t\t&& typeof previous.current === 'object'\n\t\t&& deepEqual(next, previous.current)\n\t) {\n\t\tif (import.meta.env.DEV) {\n\t\t\tconsole.error(\n\t\t\t\t'Previous and next values do not match in reference although match in value. ' +\n\t\t\t\t'Try declaring constants outside of the component scope. ' +\n\t\t\t\t'Otherwise try to memoize callbacks with useCallback, ' +\n\t\t\t\t'useReferentiallyStableCallback useEvent, useRef or useMemo.', {\n\t\t\t\t\tprevious: previous.current,\n\t\t\t\t\tnext,\n\t\t\t\t})\n\t\t}\n\n\t\tif (shouldThrow) {\n\t\t\tthrow new Error('Expecting same reference for same values')\n\t\t}\n\t}\n\n\tprevious.current = next\n}\n"],"names":["deepEqual"],"mappings":";;AAyBgB,SAAA,4BAA+B,MAAS,cAAuB,OAAO;AAC/E,QAAA,WAAW,OAAO,IAAI;AAE5B,MAAI,SAAS,SAAS,WAClB,OAAO,SAAS,YAChB,OAAO,SAAS,YAAY,YAC5BA,MAAU,MAAM,SAAS,OAAO,GAClC;AAYD,QAAI,aAAa;AACV,YAAA,IAAI,MAAM,0CAA0C;AAAA,IAAA;AAAA,EAC3D;AAGD,WAAS,UAAU;AACpB;"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const useForceRender = () => {
|
|
5
|
-
const [, forceRender] = React.useReducer((s) => s + 1, 0);
|
|
6
|
-
return forceRender;
|
|
7
|
-
};
|
|
8
|
-
exports.useForceRender = useForceRender;
|
|
9
|
-
//# sourceMappingURL=useForceRender.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useForceRender.cjs","sources":["../../../../../packages/react-utils/src/hooks/useForceRender.ts"],"sourcesContent":["import { useReducer } from 'react'\n\nexport const useForceRender = () => {\n\tconst [, forceRender] = useReducer((s: number) => s + 1, 0)\n\treturn forceRender\n}\n"],"names":["useReducer"],"mappings":";;;AAEO,MAAM,iBAAiB,MAAM;AAC7B,QAAA,CAAA,EAAG,WAAW,IAAIA,iBAAW,CAAC,MAAc,IAAI,GAAG,CAAC;AACnD,SAAA;AACR;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useForceRender.js","sources":["../../../../../packages/react-utils/src/hooks/useForceRender.ts"],"sourcesContent":["import { useReducer } from 'react'\n\nexport const useForceRender = () => {\n\tconst [, forceRender] = useReducer((s: number) => s + 1, 0)\n\treturn forceRender\n}\n"],"names":[],"mappings":";AAEO,MAAM,iBAAiB,MAAM;AAC7B,QAAA,CAAA,EAAG,WAAW,IAAI,WAAW,CAAC,MAAc,IAAI,GAAG,CAAC;AACnD,SAAA;AACR;"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const count = { current: 360 };
|
|
5
|
-
function nextId() {
|
|
6
|
-
count.current += 1;
|
|
7
|
-
return `:${count.current.toString(36)}:`;
|
|
8
|
-
}
|
|
9
|
-
function useId() {
|
|
10
|
-
return React.useMemo(() => nextId(), []);
|
|
11
|
-
}
|
|
12
|
-
exports.useId = useId;
|
|
13
|
-
//# sourceMappingURL=useId.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useId.cjs","sources":["../../../../../packages/react-utils/src/hooks/useId.ts"],"sourcesContent":["import { useMemo, useRef } from 'react'\n\nconst count = { current: 360 }\n\nfunction nextId() {\n\tcount.current += 1\n\n\treturn `:${count.current.toString(36)}:`\n}\n\n/**\n * Returns a unique ID string\n * @internal\n *\n * NOTE: This hook is a temporary solution until we stop supporting React < 18\n *\n * @returns a unique id\n */\nexport function useId() {\n\treturn useMemo(() => nextId(), [])\n}\n"],"names":["useMemo"],"mappings":";;;AAEA,MAAM,QAAQ,EAAE,SAAS,IAAI;AAE7B,SAAS,SAAS;AACjB,QAAM,WAAW;AAEjB,SAAO,IAAI,MAAM,QAAQ,SAAS,EAAE,CAAC;AACtC;AAUO,SAAS,QAAQ;AACvB,SAAOA,cAAQ,MAAM,OAAO,GAAG,EAAE;AAClC;;"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useMemo } from "react";
|
|
2
|
-
const count = { current: 360 };
|
|
3
|
-
function nextId() {
|
|
4
|
-
count.current += 1;
|
|
5
|
-
return `:${count.current.toString(36)}:`;
|
|
6
|
-
}
|
|
7
|
-
function useId() {
|
|
8
|
-
return useMemo(() => nextId(), []);
|
|
9
|
-
}
|
|
10
|
-
export {
|
|
11
|
-
useId
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=useId.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useId.js","sources":["../../../../../packages/react-utils/src/hooks/useId.ts"],"sourcesContent":["import { useMemo, useRef } from 'react'\n\nconst count = { current: 360 }\n\nfunction nextId() {\n\tcount.current += 1\n\n\treturn `:${count.current.toString(36)}:`\n}\n\n/**\n * Returns a unique ID string\n * @internal\n *\n * NOTE: This hook is a temporary solution until we stop supporting React < 18\n *\n * @returns a unique id\n */\nexport function useId() {\n\treturn useMemo(() => nextId(), [])\n}\n"],"names":[],"mappings":";AAEA,MAAM,QAAQ,EAAE,SAAS,IAAI;AAE7B,SAAS,SAAS;AACjB,QAAM,WAAW;AAEjB,SAAO,IAAI,MAAM,QAAQ,SAAS,EAAE,CAAC;AACtC;AAUO,SAAS,QAAQ;AACvB,SAAO,QAAQ,MAAM,OAAO,GAAG,EAAE;AAClC;"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const useIsMounted = () => {
|
|
5
|
-
const isMountedRef = React.useRef(true);
|
|
6
|
-
React.useEffect(
|
|
7
|
-
() => {
|
|
8
|
-
isMountedRef.current = true;
|
|
9
|
-
return () => {
|
|
10
|
-
isMountedRef.current = false;
|
|
11
|
-
};
|
|
12
|
-
},
|
|
13
|
-
[]
|
|
14
|
-
);
|
|
15
|
-
return isMountedRef;
|
|
16
|
-
};
|
|
17
|
-
exports.useIsMounted = useIsMounted;
|
|
18
|
-
//# sourceMappingURL=useIsMounted.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useIsMounted.cjs","sources":["../../../../../packages/react-utils/src/hooks/useIsMounted.ts"],"sourcesContent":["import { useEffect, useRef } from 'react'\n\nexport const useIsMounted = () => {\n\tconst isMountedRef = useRef(true)\n\tuseEffect(\n\t\t() => {\n\t\t\tisMountedRef.current = true\n\t\t\treturn () => {\n\t\t\t\tisMountedRef.current = false\n\t\t\t}\n\t\t},\n\t\t[],\n\t)\n\treturn isMountedRef\n}\n"],"names":["useRef","useEffect"],"mappings":";;;AAEO,MAAM,eAAe,MAAM;AAC3B,QAAA,eAAeA,aAAO,IAAI;AAChCC,QAAA;AAAA,IACC,MAAM;AACL,mBAAa,UAAU;AACvB,aAAO,MAAM;AACZ,qBAAa,UAAU;AAAA,MACxB;AAAA,IACD;AAAA,IACA,CAAA;AAAA,EACD;AACO,SAAA;AACR;;"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { useRef, useEffect } from "react";
|
|
2
|
-
const useIsMounted = () => {
|
|
3
|
-
const isMountedRef = useRef(true);
|
|
4
|
-
useEffect(
|
|
5
|
-
() => {
|
|
6
|
-
isMountedRef.current = true;
|
|
7
|
-
return () => {
|
|
8
|
-
isMountedRef.current = false;
|
|
9
|
-
};
|
|
10
|
-
},
|
|
11
|
-
[]
|
|
12
|
-
);
|
|
13
|
-
return isMountedRef;
|
|
14
|
-
};
|
|
15
|
-
export {
|
|
16
|
-
useIsMounted
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=useIsMounted.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useIsMounted.js","sources":["../../../../../packages/react-utils/src/hooks/useIsMounted.ts"],"sourcesContent":["import { useEffect, useRef } from 'react'\n\nexport const useIsMounted = () => {\n\tconst isMountedRef = useRef(true)\n\tuseEffect(\n\t\t() => {\n\t\t\tisMountedRef.current = true\n\t\t\treturn () => {\n\t\t\t\tisMountedRef.current = false\n\t\t\t}\n\t\t},\n\t\t[],\n\t)\n\treturn isMountedRef\n}\n"],"names":[],"mappings":";AAEO,MAAM,eAAe,MAAM;AAC3B,QAAA,eAAe,OAAO,IAAI;AAChC;AAAA,IACC,MAAM;AACL,mBAAa,UAAU;AACvB,aAAO,MAAM;AACZ,qBAAa,UAAU;AAAA,MACxB;AAAA,IACD;AAAA,IACA,CAAA;AAAA,EACD;AACO,SAAA;AACR;"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const compareObjects = (a, b) => {
|
|
5
|
-
if (a === b) {
|
|
6
|
-
return true;
|
|
7
|
-
}
|
|
8
|
-
const aEntries = Object.entries(a);
|
|
9
|
-
if (aEntries.length !== Object.keys(b).length) {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
for (const [key, val] of aEntries) {
|
|
13
|
-
if (!(key in b) || b[key] !== val) {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return true;
|
|
18
|
-
};
|
|
19
|
-
const useObjectMemo = (value) => {
|
|
20
|
-
const valueRef = React.useRef(value);
|
|
21
|
-
if (!compareObjects(valueRef.current, value)) {
|
|
22
|
-
valueRef.current = value;
|
|
23
|
-
}
|
|
24
|
-
return valueRef.current;
|
|
25
|
-
};
|
|
26
|
-
exports.useObjectMemo = useObjectMemo;
|
|
27
|
-
//# sourceMappingURL=useObjectMemo.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useObjectMemo.cjs","sources":["../../../../../packages/react-utils/src/hooks/useObjectMemo.ts"],"sourcesContent":["import { useRef } from 'react'\n\nconst compareObjects = (a: object, b: object): boolean => {\n\tif (a === b) {\n\t\treturn true\n\t}\n\tconst aEntries = Object.entries(a)\n\tif (aEntries.length !== Object.keys(b).length) {\n\t\treturn false\n\t}\n\tfor (const [key, val] of aEntries) {\n\t\tif (!(key in b) || (b as any)[key] !== val) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\nexport const useObjectMemo = <A extends object>(value: A): A => {\n\tconst valueRef = useRef(value)\n\tif (!compareObjects(valueRef.current, value)) {\n\t\tvalueRef.current = value\n\t}\n\treturn valueRef.current\n}\n"],"names":["useRef"],"mappings":";;;AAEA,MAAM,iBAAiB,CAAC,GAAW,MAAuB;AACzD,MAAI,MAAM,GAAG;AACL,WAAA;AAAA,EAAA;AAEF,QAAA,WAAW,OAAO,QAAQ,CAAC;AACjC,MAAI,SAAS,WAAW,OAAO,KAAK,CAAC,EAAE,QAAQ;AACvC,WAAA;AAAA,EAAA;AAER,aAAW,CAAC,KAAK,GAAG,KAAK,UAAU;AAClC,QAAI,EAAE,OAAO,MAAO,EAAU,GAAG,MAAM,KAAK;AACpC,aAAA;AAAA,IAAA;AAAA,EACR;AAEM,SAAA;AACR;AAEa,MAAA,gBAAgB,CAAmB,UAAgB;AACzD,QAAA,WAAWA,aAAO,KAAK;AAC7B,MAAI,CAAC,eAAe,SAAS,SAAS,KAAK,GAAG;AAC7C,aAAS,UAAU;AAAA,EAAA;AAEpB,SAAO,SAAS;AACjB;;"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { useRef } from "react";
|
|
2
|
-
const compareObjects = (a, b) => {
|
|
3
|
-
if (a === b) {
|
|
4
|
-
return true;
|
|
5
|
-
}
|
|
6
|
-
const aEntries = Object.entries(a);
|
|
7
|
-
if (aEntries.length !== Object.keys(b).length) {
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
for (const [key, val] of aEntries) {
|
|
11
|
-
if (!(key in b) || b[key] !== val) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return true;
|
|
16
|
-
};
|
|
17
|
-
const useObjectMemo = (value) => {
|
|
18
|
-
const valueRef = useRef(value);
|
|
19
|
-
if (!compareObjects(valueRef.current, value)) {
|
|
20
|
-
valueRef.current = value;
|
|
21
|
-
}
|
|
22
|
-
return valueRef.current;
|
|
23
|
-
};
|
|
24
|
-
export {
|
|
25
|
-
useObjectMemo
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=useObjectMemo.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useObjectMemo.js","sources":["../../../../../packages/react-utils/src/hooks/useObjectMemo.ts"],"sourcesContent":["import { useRef } from 'react'\n\nconst compareObjects = (a: object, b: object): boolean => {\n\tif (a === b) {\n\t\treturn true\n\t}\n\tconst aEntries = Object.entries(a)\n\tif (aEntries.length !== Object.keys(b).length) {\n\t\treturn false\n\t}\n\tfor (const [key, val] of aEntries) {\n\t\tif (!(key in b) || (b as any)[key] !== val) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\nexport const useObjectMemo = <A extends object>(value: A): A => {\n\tconst valueRef = useRef(value)\n\tif (!compareObjects(valueRef.current, value)) {\n\t\tvalueRef.current = value\n\t}\n\treturn valueRef.current\n}\n"],"names":[],"mappings":";AAEA,MAAM,iBAAiB,CAAC,GAAW,MAAuB;AACzD,MAAI,MAAM,GAAG;AACL,WAAA;AAAA,EAAA;AAEF,QAAA,WAAW,OAAO,QAAQ,CAAC;AACjC,MAAI,SAAS,WAAW,OAAO,KAAK,CAAC,EAAE,QAAQ;AACvC,WAAA;AAAA,EAAA;AAER,aAAW,CAAC,KAAK,GAAG,KAAK,UAAU;AAClC,QAAI,EAAE,OAAO,MAAO,EAAU,GAAG,MAAM,KAAK;AACpC,aAAA;AAAA,IAAA;AAAA,EACR;AAEM,SAAA;AACR;AAEa,MAAA,gBAAgB,CAAmB,UAAgB;AACzD,QAAA,WAAW,OAAO,KAAK;AAC7B,MAAI,CAAC,eAAe,SAAS,SAAS,KAAK,GAAG;AAC7C,aAAS,UAAU;AAAA,EAAA;AAEpB,SAAO,SAAS;AACjB;"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const unwrapRefValue = require("./unwrapRefValue.cjs");
|
|
5
|
-
function useOnElementClickOutsideCallback(refOrElement, callback) {
|
|
6
|
-
React.useEffect(() => {
|
|
7
|
-
const refValue = unwrapRefValue.unwrapRefValue(refOrElement);
|
|
8
|
-
const handleClickOutside = (event) => {
|
|
9
|
-
if (refValue && !refValue.contains(event.target)) {
|
|
10
|
-
callback(event);
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
14
|
-
return () => {
|
|
15
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
16
|
-
};
|
|
17
|
-
}, [callback, refOrElement]);
|
|
18
|
-
}
|
|
19
|
-
exports.useOnElementClickOutsideCallback = useOnElementClickOutsideCallback;
|
|
20
|
-
//# sourceMappingURL=useOnElementClickOutsideCallback.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useOnElementClickOutsideCallback.cjs","sources":["../../../../../packages/react-utils/src/hooks/useOnElementClickOutsideCallback.ts"],"sourcesContent":["import { useEffect } from 'react'\nimport { RefObjectOrElement, unwrapRefValue } from './unwrapRefValue'\n\nexport function useOnElementClickOutsideCallback(\n\trefOrElement: RefObjectOrElement<HTMLElement>,\n\tcallback: (event: MouseEvent) => void,\n): void {\n\tuseEffect(() => {\n\t\tconst refValue = unwrapRefValue(refOrElement)\n\n\t\tconst handleClickOutside = (event: MouseEvent) => {\n\t\t\tif (refValue && !refValue.contains(event.target as Node)) {\n\t\t\t\tcallback(event)\n\t\t\t}\n\t\t}\n\n\t\tdocument.addEventListener('mousedown', handleClickOutside)\n\n\t\treturn () => {\n\t\t\tdocument.removeEventListener('mousedown', handleClickOutside)\n\t\t}\n\t}, [callback, refOrElement])\n}\n"],"names":["useEffect","unwrapRefValue"],"mappings":";;;;AAGgB,SAAA,iCACf,cACA,UACO;AACPA,QAAAA,UAAU,MAAM;AACT,UAAA,WAAWC,8BAAe,YAAY;AAEtC,UAAA,qBAAqB,CAAC,UAAsB;AACjD,UAAI,YAAY,CAAC,SAAS,SAAS,MAAM,MAAc,GAAG;AACzD,iBAAS,KAAK;AAAA,MAAA;AAAA,IAEhB;AAES,aAAA,iBAAiB,aAAa,kBAAkB;AAEzD,WAAO,MAAM;AACH,eAAA,oBAAoB,aAAa,kBAAkB;AAAA,IAC7D;AAAA,EAAA,GACE,CAAC,UAAU,YAAY,CAAC;AAC5B;;"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
import { unwrapRefValue } from "./unwrapRefValue.js";
|
|
3
|
-
function useOnElementClickOutsideCallback(refOrElement, callback) {
|
|
4
|
-
useEffect(() => {
|
|
5
|
-
const refValue = unwrapRefValue(refOrElement);
|
|
6
|
-
const handleClickOutside = (event) => {
|
|
7
|
-
if (refValue && !refValue.contains(event.target)) {
|
|
8
|
-
callback(event);
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
12
|
-
return () => {
|
|
13
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
14
|
-
};
|
|
15
|
-
}, [callback, refOrElement]);
|
|
16
|
-
}
|
|
17
|
-
export {
|
|
18
|
-
useOnElementClickOutsideCallback
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=useOnElementClickOutsideCallback.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useOnElementClickOutsideCallback.js","sources":["../../../../../packages/react-utils/src/hooks/useOnElementClickOutsideCallback.ts"],"sourcesContent":["import { useEffect } from 'react'\nimport { RefObjectOrElement, unwrapRefValue } from './unwrapRefValue'\n\nexport function useOnElementClickOutsideCallback(\n\trefOrElement: RefObjectOrElement<HTMLElement>,\n\tcallback: (event: MouseEvent) => void,\n): void {\n\tuseEffect(() => {\n\t\tconst refValue = unwrapRefValue(refOrElement)\n\n\t\tconst handleClickOutside = (event: MouseEvent) => {\n\t\t\tif (refValue && !refValue.contains(event.target as Node)) {\n\t\t\t\tcallback(event)\n\t\t\t}\n\t\t}\n\n\t\tdocument.addEventListener('mousedown', handleClickOutside)\n\n\t\treturn () => {\n\t\t\tdocument.removeEventListener('mousedown', handleClickOutside)\n\t\t}\n\t}, [callback, refOrElement])\n}\n"],"names":[],"mappings":";;AAGgB,SAAA,iCACf,cACA,UACO;AACP,YAAU,MAAM;AACT,UAAA,WAAW,eAAe,YAAY;AAEtC,UAAA,qBAAqB,CAAC,UAAsB;AACjD,UAAI,YAAY,CAAC,SAAS,SAAS,MAAM,MAAc,GAAG;AACzD,iBAAS,KAAK;AAAA,MAAA;AAAA,IAEhB;AAES,aAAA,iBAAiB,aAAa,kBAAkB;AAEzD,WAAO,MAAM;AACH,eAAA,oBAAoB,aAAa,kBAAkB;AAAA,IAC7D;AAAA,EAAA,GACE,CAAC,UAAU,YAAY,CAAC;AAC5B;"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const unwrapRefValue = require("./unwrapRefValue.cjs");
|
|
5
|
-
function useOnElementMouseEnterDelayedCallback(refOrElement, callback, timeoutMs = 300) {
|
|
6
|
-
React.useEffect(() => {
|
|
7
|
-
const refValue = unwrapRefValue.unwrapRefValue(refOrElement);
|
|
8
|
-
if (refValue) {
|
|
9
|
-
let handleMouseEnter = function(event) {
|
|
10
|
-
clearTimeout(timeoutID);
|
|
11
|
-
timeoutID = setTimeout(() => {
|
|
12
|
-
callback(event);
|
|
13
|
-
}, timeoutMs);
|
|
14
|
-
}, handleMouseLeave = function() {
|
|
15
|
-
clearTimeout(timeoutID);
|
|
16
|
-
}, handleMouseDown = function(event) {
|
|
17
|
-
clearTimeout(timeoutID);
|
|
18
|
-
callback(event);
|
|
19
|
-
};
|
|
20
|
-
let timeoutID = void 0;
|
|
21
|
-
refValue.addEventListener("mouseenter", handleMouseEnter);
|
|
22
|
-
refValue.addEventListener("mouseleave", handleMouseLeave);
|
|
23
|
-
refValue.addEventListener("mousedown", handleMouseDown);
|
|
24
|
-
return () => {
|
|
25
|
-
refValue.removeEventListener("mouseover", handleMouseEnter);
|
|
26
|
-
refValue.removeEventListener("mouseleave", handleMouseLeave);
|
|
27
|
-
refValue.removeEventListener("mousedown", handleMouseDown);
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
}, [callback, refOrElement, timeoutMs]);
|
|
31
|
-
}
|
|
32
|
-
exports.useOnElementMouseEnterDelayedCallback = useOnElementMouseEnterDelayedCallback;
|
|
33
|
-
//# sourceMappingURL=useOnElementMouseEnterDelayedCallback.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useOnElementMouseEnterDelayedCallback.cjs","sources":["../../../../../packages/react-utils/src/hooks/useOnElementMouseEnterDelayedCallback.ts"],"sourcesContent":["import { useEffect } from 'react'\nimport { RefObjectOrElement, unwrapRefValue } from './unwrapRefValue'\n\n/**\n * Calls the callback when the mouse enters the element, but only after a timeout, e.g. for tooltips or dropdown menus.\n *\n * Calls the callback immediately if the mouse is pressed down with `event.type` of `mousedown`. This is useful for\n * dropdown menus, where the user may click on the menu item before the callback is called resulting in the menu\n * opening and closing immediately.\n *\n * @param refOrElement - The element or ref to the element to attach the event listener to.\n * @param callback - The callback to call when the mouse enters the element.\n * @param timeoutMs - The timeout in milliseconds to wait before calling the callback.\n */\nexport function useOnElementMouseEnterDelayedCallback(\n\trefOrElement: RefObjectOrElement<HTMLElement>,\n\tcallback: (event: MouseEvent) => void,\n\ttimeoutMs: number = 300,\n): void {\n\tuseEffect(() => {\n\t\tconst refValue = unwrapRefValue(refOrElement)\n\n\t\tif (refValue) {\n\t\t\tlet timeoutID: ReturnType<typeof setTimeout> | undefined = undefined\n\n\t\t\tfunction handleMouseEnter(event: MouseEvent) {\n\t\t\t\tclearTimeout(timeoutID)\n\n\t\t\t\ttimeoutID = setTimeout(() => {\n\t\t\t\t\tcallback(event)\n\t\t\t\t}, timeoutMs)\n\t\t\t}\n\n\t\t\tfunction handleMouseLeave() {\n\t\t\t\tclearTimeout(timeoutID)\n\t\t\t}\n\n\t\t\tfunction handleMouseDown(event: MouseEvent) {\n\t\t\t\tclearTimeout(timeoutID)\n\t\t\t\tcallback(event)\n\t\t\t}\n\n\t\t\trefValue.addEventListener('mouseenter', handleMouseEnter)\n\t\t\trefValue.addEventListener('mouseleave', handleMouseLeave)\n\t\t\trefValue.addEventListener('mousedown', handleMouseDown)\n\n\t\t\treturn () => {\n\t\t\t\trefValue.removeEventListener('mouseover', handleMouseEnter)\n\t\t\t\trefValue.removeEventListener('mouseleave', handleMouseLeave)\n\t\t\t\trefValue.removeEventListener('mousedown', handleMouseDown)\n\t\t\t}\n\t\t}\n\t}, [callback, refOrElement, timeoutMs])\n}\n"],"names":["useEffect","unwrapRefValue"],"mappings":";;;;AAcO,SAAS,sCACf,cACA,UACA,YAAoB,KACb;AACPA,QAAAA,UAAU,MAAM;AACT,UAAA,WAAWC,8BAAe,YAAY;AAE5C,QAAI,UAAU;AAGJ,UAAA,mBAAT,SAA0B,OAAmB;AAC5C,qBAAa,SAAS;AAEtB,oBAAY,WAAW,MAAM;AAC5B,mBAAS,KAAK;AAAA,WACZ,SAAS;AAAA,MACb,GAES,mBAAT,WAA4B;AAC3B,qBAAa,SAAS;AAAA,MAAA,GAGd,kBAAT,SAAyB,OAAmB;AAC3C,qBAAa,SAAS;AACtB,iBAAS,KAAK;AAAA,MACf;AAjBA,UAAI,YAAuD;AAmBlD,eAAA,iBAAiB,cAAc,gBAAgB;AAC/C,eAAA,iBAAiB,cAAc,gBAAgB;AAC/C,eAAA,iBAAiB,aAAa,eAAe;AAEtD,aAAO,MAAM;AACH,iBAAA,oBAAoB,aAAa,gBAAgB;AACjD,iBAAA,oBAAoB,cAAc,gBAAgB;AAClD,iBAAA,oBAAoB,aAAa,eAAe;AAAA,MAC1D;AAAA,IAAA;AAAA,EAEC,GAAA,CAAC,UAAU,cAAc,SAAS,CAAC;AACvC;;"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
import { unwrapRefValue } from "./unwrapRefValue.js";
|
|
3
|
-
function useOnElementMouseEnterDelayedCallback(refOrElement, callback, timeoutMs = 300) {
|
|
4
|
-
useEffect(() => {
|
|
5
|
-
const refValue = unwrapRefValue(refOrElement);
|
|
6
|
-
if (refValue) {
|
|
7
|
-
let handleMouseEnter = function(event) {
|
|
8
|
-
clearTimeout(timeoutID);
|
|
9
|
-
timeoutID = setTimeout(() => {
|
|
10
|
-
callback(event);
|
|
11
|
-
}, timeoutMs);
|
|
12
|
-
}, handleMouseLeave = function() {
|
|
13
|
-
clearTimeout(timeoutID);
|
|
14
|
-
}, handleMouseDown = function(event) {
|
|
15
|
-
clearTimeout(timeoutID);
|
|
16
|
-
callback(event);
|
|
17
|
-
};
|
|
18
|
-
let timeoutID = void 0;
|
|
19
|
-
refValue.addEventListener("mouseenter", handleMouseEnter);
|
|
20
|
-
refValue.addEventListener("mouseleave", handleMouseLeave);
|
|
21
|
-
refValue.addEventListener("mousedown", handleMouseDown);
|
|
22
|
-
return () => {
|
|
23
|
-
refValue.removeEventListener("mouseover", handleMouseEnter);
|
|
24
|
-
refValue.removeEventListener("mouseleave", handleMouseLeave);
|
|
25
|
-
refValue.removeEventListener("mousedown", handleMouseDown);
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
}, [callback, refOrElement, timeoutMs]);
|
|
29
|
-
}
|
|
30
|
-
export {
|
|
31
|
-
useOnElementMouseEnterDelayedCallback
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=useOnElementMouseEnterDelayedCallback.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useOnElementMouseEnterDelayedCallback.js","sources":["../../../../../packages/react-utils/src/hooks/useOnElementMouseEnterDelayedCallback.ts"],"sourcesContent":["import { useEffect } from 'react'\nimport { RefObjectOrElement, unwrapRefValue } from './unwrapRefValue'\n\n/**\n * Calls the callback when the mouse enters the element, but only after a timeout, e.g. for tooltips or dropdown menus.\n *\n * Calls the callback immediately if the mouse is pressed down with `event.type` of `mousedown`. This is useful for\n * dropdown menus, where the user may click on the menu item before the callback is called resulting in the menu\n * opening and closing immediately.\n *\n * @param refOrElement - The element or ref to the element to attach the event listener to.\n * @param callback - The callback to call when the mouse enters the element.\n * @param timeoutMs - The timeout in milliseconds to wait before calling the callback.\n */\nexport function useOnElementMouseEnterDelayedCallback(\n\trefOrElement: RefObjectOrElement<HTMLElement>,\n\tcallback: (event: MouseEvent) => void,\n\ttimeoutMs: number = 300,\n): void {\n\tuseEffect(() => {\n\t\tconst refValue = unwrapRefValue(refOrElement)\n\n\t\tif (refValue) {\n\t\t\tlet timeoutID: ReturnType<typeof setTimeout> | undefined = undefined\n\n\t\t\tfunction handleMouseEnter(event: MouseEvent) {\n\t\t\t\tclearTimeout(timeoutID)\n\n\t\t\t\ttimeoutID = setTimeout(() => {\n\t\t\t\t\tcallback(event)\n\t\t\t\t}, timeoutMs)\n\t\t\t}\n\n\t\t\tfunction handleMouseLeave() {\n\t\t\t\tclearTimeout(timeoutID)\n\t\t\t}\n\n\t\t\tfunction handleMouseDown(event: MouseEvent) {\n\t\t\t\tclearTimeout(timeoutID)\n\t\t\t\tcallback(event)\n\t\t\t}\n\n\t\t\trefValue.addEventListener('mouseenter', handleMouseEnter)\n\t\t\trefValue.addEventListener('mouseleave', handleMouseLeave)\n\t\t\trefValue.addEventListener('mousedown', handleMouseDown)\n\n\t\t\treturn () => {\n\t\t\t\trefValue.removeEventListener('mouseover', handleMouseEnter)\n\t\t\t\trefValue.removeEventListener('mouseleave', handleMouseLeave)\n\t\t\t\trefValue.removeEventListener('mousedown', handleMouseDown)\n\t\t\t}\n\t\t}\n\t}, [callback, refOrElement, timeoutMs])\n}\n"],"names":[],"mappings":";;AAcO,SAAS,sCACf,cACA,UACA,YAAoB,KACb;AACP,YAAU,MAAM;AACT,UAAA,WAAW,eAAe,YAAY;AAE5C,QAAI,UAAU;AAGJ,UAAA,mBAAT,SAA0B,OAAmB;AAC5C,qBAAa,SAAS;AAEtB,oBAAY,WAAW,MAAM;AAC5B,mBAAS,KAAK;AAAA,WACZ,SAAS;AAAA,MACb,GAES,mBAAT,WAA4B;AAC3B,qBAAa,SAAS;AAAA,MAAA,GAGd,kBAAT,SAAyB,OAAmB;AAC3C,qBAAa,SAAS;AACtB,iBAAS,KAAK;AAAA,MACf;AAjBA,UAAI,YAAuD;AAmBlD,eAAA,iBAAiB,cAAc,gBAAgB;AAC/C,eAAA,iBAAiB,cAAc,gBAAgB;AAC/C,eAAA,iBAAiB,aAAa,eAAe;AAEtD,aAAO,MAAM;AACH,iBAAA,oBAAoB,aAAa,gBAAgB;AACjD,iBAAA,oBAAoB,cAAc,gBAAgB;AAClD,iBAAA,oBAAoB,aAAa,eAAe;AAAA,MAC1D;AAAA,IAAA;AAAA,EAEC,GAAA,CAAC,UAAU,cAAc,SAAS,CAAC;AACvC;"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const unwrapRefValue = require("./unwrapRefValue.cjs");
|
|
5
|
-
const Context = require("../debug-context/Context.cjs");
|
|
6
|
-
function useOnElementResize(refOrElement, callback, options = {}, timeout = 300) {
|
|
7
|
-
const scopedConsoleRef = Context.useScopedConsoleRef("useOnElementResize");
|
|
8
|
-
const { box = "border-box" } = options;
|
|
9
|
-
const callbackRef = React.useRef(callback);
|
|
10
|
-
callbackRef.current = callback;
|
|
11
|
-
const lastTimeStamp = React.useRef(0);
|
|
12
|
-
React.useLayoutEffect(() => {
|
|
13
|
-
const element = unwrapRefValue.unwrapRefValue(refOrElement);
|
|
14
|
-
if (!element) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
if (!(element instanceof HTMLElement)) {
|
|
18
|
-
throw new Error("Exhaustive error: Expecting element to be instance of HTMLElement");
|
|
19
|
-
}
|
|
20
|
-
let timeoutID;
|
|
21
|
-
function debouncedOnChange([entry]) {
|
|
22
|
-
const timeStamp = Date.now();
|
|
23
|
-
const delta = timeStamp - lastTimeStamp.current;
|
|
24
|
-
clearTimeout(timeoutID);
|
|
25
|
-
const timeoutFinal = delta > timeout ? 0 : timeout;
|
|
26
|
-
timeoutID = setTimeout(() => {
|
|
27
|
-
const message = timeoutFinal > 0 ? "element.resize:debounced" : "element.resize:immediate";
|
|
28
|
-
scopedConsoleRef.current.warned(message, null);
|
|
29
|
-
callbackRef.current(entry);
|
|
30
|
-
lastTimeStamp.current = timeStamp;
|
|
31
|
-
}, timeoutFinal);
|
|
32
|
-
}
|
|
33
|
-
const resizeObserver = new ResizeObserver(debouncedOnChange);
|
|
34
|
-
resizeObserver.observe(element, { box });
|
|
35
|
-
return () => {
|
|
36
|
-
clearTimeout(timeoutID);
|
|
37
|
-
resizeObserver.unobserve(element);
|
|
38
|
-
};
|
|
39
|
-
}, [box, refOrElement, scopedConsoleRef, timeout]);
|
|
40
|
-
}
|
|
41
|
-
exports.useOnElementResize = useOnElementResize;
|
|
42
|
-
//# sourceMappingURL=useOnElementResize.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useOnElementResize.cjs","sources":["../../../../../packages/react-utils/src/hooks/useOnElementResize.ts"],"sourcesContent":["import { useLayoutEffect, useRef } from 'react'\nimport { useScopedConsoleRef } from '../debug-context'\nimport { RefObjectOrElement, unwrapRefValue } from './unwrapRefValue'\n\nexport function useOnElementResize(\n\trefOrElement: RefObjectOrElement<HTMLElement | null> | null,\n\tcallback: (entries: ResizeObserverEntry) => void,\n\toptions: ResizeObserverOptions = {},\n\ttimeout: number = 300,\n): void {\n\tconst scopedConsoleRef = useScopedConsoleRef('useOnElementResize')\n\n\tconst { box = 'border-box' } = options\n\tconst callbackRef = useRef(callback); callbackRef.current = callback\n\tconst lastTimeStamp = useRef<number>(0)\n\n\tuseLayoutEffect(() => {\n\t\tconst element = unwrapRefValue(refOrElement)\n\t\tif (!element) {\n\t\t\treturn\n\t\t}\n\t\tif (!(element instanceof HTMLElement)) {\n\t\t\tthrow new Error('Exhaustive error: Expecting element to be instance of HTMLElement')\n\t\t}\n\n\t\tlet timeoutID: ReturnType<typeof setTimeout>\n\n\t\tfunction debouncedOnChange([entry]: ResizeObserverEntry[]) {\n\t\t\tconst timeStamp = Date.now()\n\t\t\tconst delta = timeStamp - lastTimeStamp.current\n\n\t\t\tclearTimeout(timeoutID)\n\t\t\tconst timeoutFinal = delta > timeout ? 0 : timeout\n\n\t\t\ttimeoutID = setTimeout(() => {\n\t\t\t\tconst message = timeoutFinal > 0 ? 'element.resize:debounced' : 'element.resize:immediate'\n\t\t\t\tscopedConsoleRef.current.warned(message, null)\n\t\t\t\tcallbackRef.current(entry)\n\t\t\t\tlastTimeStamp.current = timeStamp\n\t\t\t}, timeoutFinal)\n\t\t}\n\n\t\tconst resizeObserver = new ResizeObserver(debouncedOnChange)\n\n\t\tresizeObserver.observe(element, { box })\n\n\t\treturn () => {\n\t\t\tclearTimeout(timeoutID)\n\t\t\tresizeObserver.unobserve(element)\n\t\t}\n\t}, [box, refOrElement, scopedConsoleRef, timeout])\n}\n"],"names":["useScopedConsoleRef","useRef","useLayoutEffect","unwrapRefValue"],"mappings":";;;;;AAIO,SAAS,mBACf,cACA,UACA,UAAiC,CAAC,GAClC,UAAkB,KACX;AACD,QAAA,mBAAmBA,4BAAoB,oBAAoB;AAE3D,QAAA,EAAE,MAAM,aAAA,IAAiB;AACzB,QAAA,cAAcC,aAAO,QAAQ;AAAG,cAAY,UAAU;AACtD,QAAA,gBAAgBA,aAAe,CAAC;AAEtCC,QAAAA,gBAAgB,MAAM;AACf,UAAA,UAAUC,8BAAe,YAAY;AAC3C,QAAI,CAAC,SAAS;AACb;AAAA,IAAA;AAEG,QAAA,EAAE,mBAAmB,cAAc;AAChC,YAAA,IAAI,MAAM,mEAAmE;AAAA,IAAA;AAGhF,QAAA;AAEK,aAAA,kBAAkB,CAAC,KAAK,GAA0B;AACpD,YAAA,YAAY,KAAK,IAAI;AACrB,YAAA,QAAQ,YAAY,cAAc;AAExC,mBAAa,SAAS;AAChB,YAAA,eAAe,QAAQ,UAAU,IAAI;AAE3C,kBAAY,WAAW,MAAM;AACtB,cAAA,UAAU,eAAe,IAAI,6BAA6B;AAC/C,yBAAA,QAAQ,OAAO,SAAS,IAAI;AAC7C,oBAAY,QAAQ,KAAK;AACzB,sBAAc,UAAU;AAAA,SACtB,YAAY;AAAA,IAAA;AAGV,UAAA,iBAAiB,IAAI,eAAe,iBAAiB;AAE3D,mBAAe,QAAQ,SAAS,EAAE,IAAA,CAAK;AAEvC,WAAO,MAAM;AACZ,mBAAa,SAAS;AACtB,qBAAe,UAAU,OAAO;AAAA,IACjC;AAAA,KACE,CAAC,KAAK,cAAc,kBAAkB,OAAO,CAAC;AAClD;;"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { useRef, useLayoutEffect } from "react";
|
|
2
|
-
import { unwrapRefValue } from "./unwrapRefValue.js";
|
|
3
|
-
import { useScopedConsoleRef } from "../debug-context/Context.js";
|
|
4
|
-
function useOnElementResize(refOrElement, callback, options = {}, timeout = 300) {
|
|
5
|
-
const scopedConsoleRef = useScopedConsoleRef("useOnElementResize");
|
|
6
|
-
const { box = "border-box" } = options;
|
|
7
|
-
const callbackRef = useRef(callback);
|
|
8
|
-
callbackRef.current = callback;
|
|
9
|
-
const lastTimeStamp = useRef(0);
|
|
10
|
-
useLayoutEffect(() => {
|
|
11
|
-
const element = unwrapRefValue(refOrElement);
|
|
12
|
-
if (!element) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
if (!(element instanceof HTMLElement)) {
|
|
16
|
-
throw new Error("Exhaustive error: Expecting element to be instance of HTMLElement");
|
|
17
|
-
}
|
|
18
|
-
let timeoutID;
|
|
19
|
-
function debouncedOnChange([entry]) {
|
|
20
|
-
const timeStamp = Date.now();
|
|
21
|
-
const delta = timeStamp - lastTimeStamp.current;
|
|
22
|
-
clearTimeout(timeoutID);
|
|
23
|
-
const timeoutFinal = delta > timeout ? 0 : timeout;
|
|
24
|
-
timeoutID = setTimeout(() => {
|
|
25
|
-
const message = timeoutFinal > 0 ? "element.resize:debounced" : "element.resize:immediate";
|
|
26
|
-
scopedConsoleRef.current.warned(message, null);
|
|
27
|
-
callbackRef.current(entry);
|
|
28
|
-
lastTimeStamp.current = timeStamp;
|
|
29
|
-
}, timeoutFinal);
|
|
30
|
-
}
|
|
31
|
-
const resizeObserver = new ResizeObserver(debouncedOnChange);
|
|
32
|
-
resizeObserver.observe(element, { box });
|
|
33
|
-
return () => {
|
|
34
|
-
clearTimeout(timeoutID);
|
|
35
|
-
resizeObserver.unobserve(element);
|
|
36
|
-
};
|
|
37
|
-
}, [box, refOrElement, scopedConsoleRef, timeout]);
|
|
38
|
-
}
|
|
39
|
-
export {
|
|
40
|
-
useOnElementResize
|
|
41
|
-
};
|
|
42
|
-
//# sourceMappingURL=useOnElementResize.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useOnElementResize.js","sources":["../../../../../packages/react-utils/src/hooks/useOnElementResize.ts"],"sourcesContent":["import { useLayoutEffect, useRef } from 'react'\nimport { useScopedConsoleRef } from '../debug-context'\nimport { RefObjectOrElement, unwrapRefValue } from './unwrapRefValue'\n\nexport function useOnElementResize(\n\trefOrElement: RefObjectOrElement<HTMLElement | null> | null,\n\tcallback: (entries: ResizeObserverEntry) => void,\n\toptions: ResizeObserverOptions = {},\n\ttimeout: number = 300,\n): void {\n\tconst scopedConsoleRef = useScopedConsoleRef('useOnElementResize')\n\n\tconst { box = 'border-box' } = options\n\tconst callbackRef = useRef(callback); callbackRef.current = callback\n\tconst lastTimeStamp = useRef<number>(0)\n\n\tuseLayoutEffect(() => {\n\t\tconst element = unwrapRefValue(refOrElement)\n\t\tif (!element) {\n\t\t\treturn\n\t\t}\n\t\tif (!(element instanceof HTMLElement)) {\n\t\t\tthrow new Error('Exhaustive error: Expecting element to be instance of HTMLElement')\n\t\t}\n\n\t\tlet timeoutID: ReturnType<typeof setTimeout>\n\n\t\tfunction debouncedOnChange([entry]: ResizeObserverEntry[]) {\n\t\t\tconst timeStamp = Date.now()\n\t\t\tconst delta = timeStamp - lastTimeStamp.current\n\n\t\t\tclearTimeout(timeoutID)\n\t\t\tconst timeoutFinal = delta > timeout ? 0 : timeout\n\n\t\t\ttimeoutID = setTimeout(() => {\n\t\t\t\tconst message = timeoutFinal > 0 ? 'element.resize:debounced' : 'element.resize:immediate'\n\t\t\t\tscopedConsoleRef.current.warned(message, null)\n\t\t\t\tcallbackRef.current(entry)\n\t\t\t\tlastTimeStamp.current = timeStamp\n\t\t\t}, timeoutFinal)\n\t\t}\n\n\t\tconst resizeObserver = new ResizeObserver(debouncedOnChange)\n\n\t\tresizeObserver.observe(element, { box })\n\n\t\treturn () => {\n\t\t\tclearTimeout(timeoutID)\n\t\t\tresizeObserver.unobserve(element)\n\t\t}\n\t}, [box, refOrElement, scopedConsoleRef, timeout])\n}\n"],"names":[],"mappings":";;;AAIO,SAAS,mBACf,cACA,UACA,UAAiC,CAAC,GAClC,UAAkB,KACX;AACD,QAAA,mBAAmB,oBAAoB,oBAAoB;AAE3D,QAAA,EAAE,MAAM,aAAA,IAAiB;AACzB,QAAA,cAAc,OAAO,QAAQ;AAAG,cAAY,UAAU;AACtD,QAAA,gBAAgB,OAAe,CAAC;AAEtC,kBAAgB,MAAM;AACf,UAAA,UAAU,eAAe,YAAY;AAC3C,QAAI,CAAC,SAAS;AACb;AAAA,IAAA;AAEG,QAAA,EAAE,mBAAmB,cAAc;AAChC,YAAA,IAAI,MAAM,mEAAmE;AAAA,IAAA;AAGhF,QAAA;AAEK,aAAA,kBAAkB,CAAC,KAAK,GAA0B;AACpD,YAAA,YAAY,KAAK,IAAI;AACrB,YAAA,QAAQ,YAAY,cAAc;AAExC,mBAAa,SAAS;AAChB,YAAA,eAAe,QAAQ,UAAU,IAAI;AAE3C,kBAAY,WAAW,MAAM;AACtB,cAAA,UAAU,eAAe,IAAI,6BAA6B;AAC/C,yBAAA,QAAQ,OAAO,SAAS,IAAI;AAC7C,oBAAY,QAAQ,KAAK;AACzB,sBAAc,UAAU;AAAA,SACtB,YAAY;AAAA,IAAA;AAGV,UAAA,iBAAiB,IAAI,eAAe,iBAAiB;AAE3D,mBAAe,QAAQ,SAAS,EAAE,IAAA,CAAK;AAEvC,WAAO,MAAM;AACZ,mBAAa,SAAS;AACtB,qBAAe,UAAU,OAAO;AAAA,IACjC;AAAA,KACE,CAAC,KAAK,cAAc,kBAAkB,OAAO,CAAC;AAClD;"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const Context = require("../debug-context/Context.cjs");
|
|
5
|
-
function useOnWindowResize(callback, interval = 300) {
|
|
6
|
-
const scopedConsoleRef = Context.useScopedConsoleRef("useOnWindowResize");
|
|
7
|
-
const callbackRef = React.useRef(callback);
|
|
8
|
-
callbackRef.current = callback;
|
|
9
|
-
const lastTimeStamp = React.useRef(0);
|
|
10
|
-
React.useLayoutEffect(() => {
|
|
11
|
-
let timeoutID;
|
|
12
|
-
function debouncedHandler(event) {
|
|
13
|
-
clearTimeout(timeoutID);
|
|
14
|
-
const delta = event.timeStamp - lastTimeStamp.current;
|
|
15
|
-
scopedConsoleRef.current.logged("window.resize:delta", delta);
|
|
16
|
-
if (delta > interval) {
|
|
17
|
-
scopedConsoleRef.current.warned("event:window.resize:immediately", null);
|
|
18
|
-
callbackRef.current(event);
|
|
19
|
-
lastTimeStamp.current = event.timeStamp;
|
|
20
|
-
} else {
|
|
21
|
-
timeoutID = setTimeout(() => {
|
|
22
|
-
scopedConsoleRef.current.warned("event:window.resize:debounced", null);
|
|
23
|
-
lastTimeStamp.current = event.timeStamp;
|
|
24
|
-
callbackRef.current(event);
|
|
25
|
-
}, interval);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
window.addEventListener("resize", debouncedHandler);
|
|
29
|
-
return () => {
|
|
30
|
-
clearTimeout(timeoutID);
|
|
31
|
-
window.removeEventListener("resize", debouncedHandler);
|
|
32
|
-
};
|
|
33
|
-
}, [callbackRef, interval, scopedConsoleRef]);
|
|
34
|
-
}
|
|
35
|
-
exports.useOnWindowResize = useOnWindowResize;
|
|
36
|
-
//# sourceMappingURL=useOnWindowResize.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useOnWindowResize.cjs","sources":["../../../../../packages/react-utils/src/hooks/useOnWindowResize.ts"],"sourcesContent":["import { useLayoutEffect, useRef } from 'react'\nimport { useScopedConsoleRef } from '../debug-context'\n\nexport function useOnWindowResize(\n\tcallback: (event: Event) => void,\n\tinterval: number = 300,\n) {\n\tconst scopedConsoleRef = useScopedConsoleRef('useOnWindowResize')\n\n\tconst callbackRef = useRef(callback); callbackRef.current = callback\n\tconst lastTimeStamp = useRef<number>(0)\n\n\tuseLayoutEffect(() => {\n\t\tlet timeoutID: ReturnType<typeof setTimeout>\n\n\t\tfunction debouncedHandler(event: Event) {\n\t\t\tclearTimeout(timeoutID)\n\n\t\t\tconst delta = event.timeStamp - lastTimeStamp.current\n\t\t\tscopedConsoleRef.current.logged('window.resize:delta', delta)\n\n\t\t\tif (delta > interval) {\n\t\t\t\tscopedConsoleRef.current.warned('event:window.resize:immediately', null)\n\t\t\t\tcallbackRef.current(event)\n\t\t\t\tlastTimeStamp.current = event.timeStamp\n\t\t\t} else {\n\t\t\t\ttimeoutID = setTimeout(() => {\n\t\t\t\t\tscopedConsoleRef.current.warned('event:window.resize:debounced', null)\n\t\t\t\t\tlastTimeStamp.current = event.timeStamp\n\t\t\t\t\tcallbackRef.current(event)\n\t\t\t\t}, interval)\n\t\t\t}\n\t\t}\n\n\t\twindow.addEventListener('resize', debouncedHandler)\n\n\t\treturn () => {\n\t\t\tclearTimeout(timeoutID)\n\t\t\twindow.removeEventListener('resize', debouncedHandler)\n\t\t}\n\t}, [callbackRef, interval, scopedConsoleRef])\n}\n"],"names":["useScopedConsoleRef","useRef","useLayoutEffect"],"mappings":";;;;AAGgB,SAAA,kBACf,UACA,WAAmB,KAClB;AACK,QAAA,mBAAmBA,4BAAoB,mBAAmB;AAE1D,QAAA,cAAcC,aAAO,QAAQ;AAAG,cAAY,UAAU;AACtD,QAAA,gBAAgBA,aAAe,CAAC;AAEtCC,QAAAA,gBAAgB,MAAM;AACjB,QAAA;AAEJ,aAAS,iBAAiB,OAAc;AACvC,mBAAa,SAAS;AAEhB,YAAA,QAAQ,MAAM,YAAY,cAAc;AAC7B,uBAAA,QAAQ,OAAO,uBAAuB,KAAK;AAE5D,UAAI,QAAQ,UAAU;AACJ,yBAAA,QAAQ,OAAO,mCAAmC,IAAI;AACvE,oBAAY,QAAQ,KAAK;AACzB,sBAAc,UAAU,MAAM;AAAA,MAAA,OACxB;AACN,oBAAY,WAAW,MAAM;AACX,2BAAA,QAAQ,OAAO,iCAAiC,IAAI;AACrE,wBAAc,UAAU,MAAM;AAC9B,sBAAY,QAAQ,KAAK;AAAA,WACvB,QAAQ;AAAA,MAAA;AAAA,IACZ;AAGM,WAAA,iBAAiB,UAAU,gBAAgB;AAElD,WAAO,MAAM;AACZ,mBAAa,SAAS;AACf,aAAA,oBAAoB,UAAU,gBAAgB;AAAA,IACtD;AAAA,EACE,GAAA,CAAC,aAAa,UAAU,gBAAgB,CAAC;AAC7C;;"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { useRef, useLayoutEffect } from "react";
|
|
2
|
-
import { useScopedConsoleRef } from "../debug-context/Context.js";
|
|
3
|
-
function useOnWindowResize(callback, interval = 300) {
|
|
4
|
-
const scopedConsoleRef = useScopedConsoleRef("useOnWindowResize");
|
|
5
|
-
const callbackRef = useRef(callback);
|
|
6
|
-
callbackRef.current = callback;
|
|
7
|
-
const lastTimeStamp = useRef(0);
|
|
8
|
-
useLayoutEffect(() => {
|
|
9
|
-
let timeoutID;
|
|
10
|
-
function debouncedHandler(event) {
|
|
11
|
-
clearTimeout(timeoutID);
|
|
12
|
-
const delta = event.timeStamp - lastTimeStamp.current;
|
|
13
|
-
scopedConsoleRef.current.logged("window.resize:delta", delta);
|
|
14
|
-
if (delta > interval) {
|
|
15
|
-
scopedConsoleRef.current.warned("event:window.resize:immediately", null);
|
|
16
|
-
callbackRef.current(event);
|
|
17
|
-
lastTimeStamp.current = event.timeStamp;
|
|
18
|
-
} else {
|
|
19
|
-
timeoutID = setTimeout(() => {
|
|
20
|
-
scopedConsoleRef.current.warned("event:window.resize:debounced", null);
|
|
21
|
-
lastTimeStamp.current = event.timeStamp;
|
|
22
|
-
callbackRef.current(event);
|
|
23
|
-
}, interval);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
window.addEventListener("resize", debouncedHandler);
|
|
27
|
-
return () => {
|
|
28
|
-
clearTimeout(timeoutID);
|
|
29
|
-
window.removeEventListener("resize", debouncedHandler);
|
|
30
|
-
};
|
|
31
|
-
}, [callbackRef, interval, scopedConsoleRef]);
|
|
32
|
-
}
|
|
33
|
-
export {
|
|
34
|
-
useOnWindowResize
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=useOnWindowResize.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useOnWindowResize.js","sources":["../../../../../packages/react-utils/src/hooks/useOnWindowResize.ts"],"sourcesContent":["import { useLayoutEffect, useRef } from 'react'\nimport { useScopedConsoleRef } from '../debug-context'\n\nexport function useOnWindowResize(\n\tcallback: (event: Event) => void,\n\tinterval: number = 300,\n) {\n\tconst scopedConsoleRef = useScopedConsoleRef('useOnWindowResize')\n\n\tconst callbackRef = useRef(callback); callbackRef.current = callback\n\tconst lastTimeStamp = useRef<number>(0)\n\n\tuseLayoutEffect(() => {\n\t\tlet timeoutID: ReturnType<typeof setTimeout>\n\n\t\tfunction debouncedHandler(event: Event) {\n\t\t\tclearTimeout(timeoutID)\n\n\t\t\tconst delta = event.timeStamp - lastTimeStamp.current\n\t\t\tscopedConsoleRef.current.logged('window.resize:delta', delta)\n\n\t\t\tif (delta > interval) {\n\t\t\t\tscopedConsoleRef.current.warned('event:window.resize:immediately', null)\n\t\t\t\tcallbackRef.current(event)\n\t\t\t\tlastTimeStamp.current = event.timeStamp\n\t\t\t} else {\n\t\t\t\ttimeoutID = setTimeout(() => {\n\t\t\t\t\tscopedConsoleRef.current.warned('event:window.resize:debounced', null)\n\t\t\t\t\tlastTimeStamp.current = event.timeStamp\n\t\t\t\t\tcallbackRef.current(event)\n\t\t\t\t}, interval)\n\t\t\t}\n\t\t}\n\n\t\twindow.addEventListener('resize', debouncedHandler)\n\n\t\treturn () => {\n\t\t\tclearTimeout(timeoutID)\n\t\t\twindow.removeEventListener('resize', debouncedHandler)\n\t\t}\n\t}, [callbackRef, interval, scopedConsoleRef])\n}\n"],"names":[],"mappings":";;AAGgB,SAAA,kBACf,UACA,WAAmB,KAClB;AACK,QAAA,mBAAmB,oBAAoB,mBAAmB;AAE1D,QAAA,cAAc,OAAO,QAAQ;AAAG,cAAY,UAAU;AACtD,QAAA,gBAAgB,OAAe,CAAC;AAEtC,kBAAgB,MAAM;AACjB,QAAA;AAEJ,aAAS,iBAAiB,OAAc;AACvC,mBAAa,SAAS;AAEhB,YAAA,QAAQ,MAAM,YAAY,cAAc;AAC7B,uBAAA,QAAQ,OAAO,uBAAuB,KAAK;AAE5D,UAAI,QAAQ,UAAU;AACJ,yBAAA,QAAQ,OAAO,mCAAmC,IAAI;AACvE,oBAAY,QAAQ,KAAK;AACzB,sBAAc,UAAU,MAAM;AAAA,MAAA,OACxB;AACN,oBAAY,WAAW,MAAM;AACX,2BAAA,QAAQ,OAAO,iCAAiC,IAAI;AACrE,wBAAc,UAAU,MAAM;AAC9B,sBAAY,QAAQ,KAAK;AAAA,WACvB,QAAQ;AAAA,MAAA;AAAA,IACZ;AAGM,WAAA,iBAAiB,UAAU,gBAAgB;AAElD,WAAO,MAAM;AACZ,mBAAa,SAAS;AACf,aAAA,oBAAoB,UAAU,gBAAgB;AAAA,IACtD;AAAA,EACE,GAAA,CAAC,aAAa,UAAU,gBAAgB,CAAC;AAC7C;"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const usePreviousValue = (value) => {
|
|
5
|
-
const ref = React.useRef(value);
|
|
6
|
-
React.useEffect(() => {
|
|
7
|
-
ref.current = value;
|
|
8
|
-
});
|
|
9
|
-
return ref.current;
|
|
10
|
-
};
|
|
11
|
-
exports.usePreviousValue = usePreviousValue;
|
|
12
|
-
//# sourceMappingURL=usePreviousValue.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usePreviousValue.cjs","sources":["../../../../../packages/react-utils/src/hooks/usePreviousValue.ts"],"sourcesContent":["import { useEffect, useRef } from 'react'\n\nexport const usePreviousValue = <Value>(value: Value) => {\n\tconst ref = useRef<Value>(value)\n\tuseEffect(() => {\n\t\tref.current = value\n\t})\n\treturn ref.current\n}\n"],"names":["useRef","useEffect"],"mappings":";;;AAEa,MAAA,mBAAmB,CAAQ,UAAiB;AAClD,QAAA,MAAMA,aAAc,KAAK;AAC/BC,QAAAA,UAAU,MAAM;AACf,QAAI,UAAU;AAAA,EAAA,CACd;AACD,SAAO,IAAI;AACZ;;"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { useRef, useEffect } from "react";
|
|
2
|
-
const usePreviousValue = (value) => {
|
|
3
|
-
const ref = useRef(value);
|
|
4
|
-
useEffect(() => {
|
|
5
|
-
ref.current = value;
|
|
6
|
-
});
|
|
7
|
-
return ref.current;
|
|
8
|
-
};
|
|
9
|
-
export {
|
|
10
|
-
usePreviousValue
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=usePreviousValue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usePreviousValue.js","sources":["../../../../../packages/react-utils/src/hooks/usePreviousValue.ts"],"sourcesContent":["import { useEffect, useRef } from 'react'\n\nexport const usePreviousValue = <Value>(value: Value) => {\n\tconst ref = useRef<Value>(value)\n\tuseEffect(() => {\n\t\tref.current = value\n\t})\n\treturn ref.current\n}\n"],"names":[],"mappings":";AAEa,MAAA,mBAAmB,CAAQ,UAAiB;AAClD,QAAA,MAAM,OAAc,KAAK;AAC/B,YAAU,MAAM;AACf,QAAI,UAAU;AAAA,EAAA,CACd;AACD,SAAO,IAAI;AACZ;"}
|