@contember/react-utils 2.1.0-alpha.3 → 2.1.0-alpha.35
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 +9 -5
- 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 -2
- 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,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const urlStateStorage = {
|
|
5
|
-
getItem(key) {
|
|
6
|
-
const searchParams = new URLSearchParams(window.location.search);
|
|
7
|
-
const value = searchParams.get(key[1]);
|
|
8
|
-
return value !== null && value !== void 0 ? JSON.parse(value) : null;
|
|
9
|
-
},
|
|
10
|
-
setItem(key, value) {
|
|
11
|
-
const searchParams = new URLSearchParams(window.location.search);
|
|
12
|
-
searchParams.set(key[1], JSON.stringify(value));
|
|
13
|
-
const newUrl = `${window.location.pathname}?${searchParams.toString()}`;
|
|
14
|
-
window.history.replaceState({}, "", newUrl);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
const createStateStorageFromNativeStorage = (getStorage) => {
|
|
18
|
-
return {
|
|
19
|
-
getItem(key) {
|
|
20
|
-
const value = getStorage().getItem(key.join("-"));
|
|
21
|
-
return value !== null ? JSON.parse(value) : null;
|
|
22
|
-
},
|
|
23
|
-
setItem(key, value) {
|
|
24
|
-
getStorage().setItem(key.join("-"), JSON.stringify(value));
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
const sessionStateStorage = createStateStorageFromNativeStorage(() => sessionStorage);
|
|
29
|
-
const localStateStorage = createStateStorageFromNativeStorage(() => localStorage);
|
|
30
|
-
const nullStorage = {
|
|
31
|
-
getItem() {
|
|
32
|
-
return null;
|
|
33
|
-
},
|
|
34
|
-
setItem() {
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
const builtInStorages = {
|
|
38
|
-
url: urlStateStorage,
|
|
39
|
-
session: sessionStateStorage,
|
|
40
|
-
local: localStateStorage,
|
|
41
|
-
null: nullStorage
|
|
42
|
-
};
|
|
43
|
-
const useStoredState = (storageOrName, key, initializeValue) => {
|
|
44
|
-
const storage = React.useMemo(() => {
|
|
45
|
-
return getStateStorage(storageOrName);
|
|
46
|
-
}, [storageOrName]);
|
|
47
|
-
const [value, setValue] = React.useState(() => {
|
|
48
|
-
const value2 = storage.getItem(key);
|
|
49
|
-
return initializeValue(value2);
|
|
50
|
-
});
|
|
51
|
-
return [
|
|
52
|
-
value,
|
|
53
|
-
React.useCallback((value2) => {
|
|
54
|
-
setValue((current) => {
|
|
55
|
-
const newValue = typeof value2 === "function" ? value2(current) : value2;
|
|
56
|
-
storage.setItem(key, newValue);
|
|
57
|
-
return newValue;
|
|
58
|
-
});
|
|
59
|
-
}, [key, storage])
|
|
60
|
-
];
|
|
61
|
-
};
|
|
62
|
-
const useSessionStorageState = (key, initializeValue) => {
|
|
63
|
-
return useStoredState(sessionStateStorage, key, initializeValue);
|
|
64
|
-
};
|
|
65
|
-
const useLocalStorageState = (key, initializeValue) => {
|
|
66
|
-
return useStoredState(localStateStorage, key, initializeValue);
|
|
67
|
-
};
|
|
68
|
-
const getStateStorage = (storageOrName) => {
|
|
69
|
-
if (Array.isArray(storageOrName)) {
|
|
70
|
-
return createFallbackStorage(storageOrName.map((it) => typeof it === "string" ? builtInStorages[it] : it));
|
|
71
|
-
}
|
|
72
|
-
return typeof storageOrName === "string" ? builtInStorages[storageOrName] : storageOrName;
|
|
73
|
-
};
|
|
74
|
-
const createFallbackStorage = (storageTypes) => {
|
|
75
|
-
return {
|
|
76
|
-
getItem(key) {
|
|
77
|
-
for (const storage of storageTypes) {
|
|
78
|
-
const value = storage.getItem(key);
|
|
79
|
-
if (value !== null) {
|
|
80
|
-
return value;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return null;
|
|
84
|
-
},
|
|
85
|
-
setItem(key, value) {
|
|
86
|
-
for (const storage of storageTypes) {
|
|
87
|
-
storage.setItem(key, value);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
exports.getStateStorage = getStateStorage;
|
|
93
|
-
exports.localStateStorage = localStateStorage;
|
|
94
|
-
exports.nullStorage = nullStorage;
|
|
95
|
-
exports.sessionStateStorage = sessionStateStorage;
|
|
96
|
-
exports.urlStateStorage = urlStateStorage;
|
|
97
|
-
exports.useLocalStorageState = useLocalStorageState;
|
|
98
|
-
exports.useSessionStorageState = useSessionStorageState;
|
|
99
|
-
exports.useStoredState = useStoredState;
|
|
100
|
-
//# sourceMappingURL=useStoredState.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useStoredState.cjs","sources":["../../../../../packages/react-utils/src/hooks/useStoredState.ts"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react'\nimport { Serializable } from '../types'\n\nexport type SetState<V extends Serializable> = (value: V | ((current: V) => V)) => void\nexport type StateStorageKey = [uniquePrefix: string, key: string]\n\nexport type ValueInitializer<V extends Serializable> = (storedValue: V | undefined) => V\n\nexport interface StateStorage {\n\tgetItem(key: StateStorageKey): Serializable\n\n\tsetItem(key: StateStorageKey, value: Serializable): void\n}\n\n\nexport const urlStateStorage: StateStorage = {\n\tgetItem(key) {\n\t\tconst searchParams = new URLSearchParams(window.location.search)\n\t\tconst value = searchParams.get(key[1])\n\t\treturn value !== null && value !== undefined ? JSON.parse(value) : null\n\t},\n\tsetItem(key, value) {\n\t\tconst searchParams = new URLSearchParams(window.location.search)\n\t\tsearchParams.set(key[1], JSON.stringify(value))\n\t\tconst newUrl = `${window.location.pathname}?${searchParams.toString()}`\n\t\twindow.history.replaceState({}, '', newUrl)\n\t},\n}\n\nconst createStateStorageFromNativeStorage = (getStorage: () => Storage): StateStorage => {\n\treturn {\n\t\tgetItem(key) {\n\t\t\tconst value = getStorage().getItem(key.join('-'))\n\t\t\treturn value !== null ? JSON.parse(value) : null\n\t\t},\n\t\tsetItem(key, value) {\n\t\t\tgetStorage().setItem(key.join('-'), JSON.stringify(value))\n\t\t},\n\t}\n}\n\nexport const sessionStateStorage = createStateStorageFromNativeStorage(() => sessionStorage)\nexport const localStateStorage = createStateStorageFromNativeStorage(() => localStorage)\nexport const nullStorage: StateStorage = {\n\tgetItem() {\n\t\treturn null\n\t},\n\tsetItem() {\n\t},\n}\n\nconst builtInStorages = {\n\turl: urlStateStorage,\n\tsession: sessionStateStorage,\n\tlocal: localStateStorage,\n\tnull: nullStorage,\n}\n\nexport type StateStorageOrName = StateStorage | 'url' | 'session' | 'local' | 'null'\n\nexport const useStoredState = <V extends Serializable>(storageOrName: StateStorageOrName | StateStorageOrName[], key: StateStorageKey, initializeValue: ValueInitializer<V>): [V, SetState<V>] => {\n\tconst storage = useMemo(() => {\n\t\treturn getStateStorage(storageOrName)\n\t}, [storageOrName])\n\n\tconst [value, setValue] = useState<V>(() => {\n\t\tconst value = storage.getItem(key)\n\t\treturn initializeValue(value as V)\n\t})\n\treturn [\n\t\tvalue,\n\t\tuseCallback(value => {\n\t\t\tsetValue(current => {\n\t\t\t\tconst newValue = typeof value === 'function' ? (value as (current: V) => V)(current) : value\n\t\t\t\tstorage.setItem(key, newValue)\n\t\t\t\treturn newValue\n\t\t\t})\n\t\t}, [key, storage]),\n\t]\n}\n\nexport const useSessionStorageState = <V extends Serializable>(key: StateStorageKey, initializeValue: ValueInitializer<V>): [V, SetState<V>] => {\n\treturn useStoredState<V>(sessionStateStorage, key, initializeValue)\n}\n\nexport const useLocalStorageState = <V extends Serializable>(key: StateStorageKey, initializeValue: ValueInitializer<V>): [V, SetState<V>] => {\n\treturn useStoredState<V>(localStateStorage, key, initializeValue)\n}\n\nexport const getStateStorage = (storageOrName: StateStorageOrName | StateStorageOrName[]) => {\n\tif (Array.isArray(storageOrName)) {\n\t\treturn createFallbackStorage(storageOrName.map(it => typeof it === 'string' ? builtInStorages[it] : it))\n\t}\n\treturn typeof storageOrName === 'string' ? builtInStorages[storageOrName] : storageOrName\n}\n\n\nconst createFallbackStorage = (storageTypes: StateStorage[]): StateStorage => {\n\treturn {\n\t\tgetItem(key) {\n\t\t\tfor (const storage of storageTypes) {\n\t\t\t\tconst value = storage.getItem(key)\n\t\t\t\tif (value !== null) {\n\t\t\t\t\treturn value\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null\n\t\t},\n\t\tsetItem(key, value) {\n\t\t\tfor (const storage of storageTypes) {\n\t\t\t\tstorage.setItem(key, value)\n\t\t\t}\n\t\t},\n\t}\n}\n"],"names":["useMemo","useState","value","useCallback"],"mappings":";;;AAeO,MAAM,kBAAgC;AAAA,EAC5C,QAAQ,KAAK;AACZ,UAAM,eAAe,IAAI,gBAAgB,OAAO,SAAS,MAAM;AAC/D,UAAM,QAAQ,aAAa,IAAI,IAAI,CAAC,CAAC;AACrC,WAAO,UAAU,QAAQ,UAAU,SAAY,KAAK,MAAM,KAAK,IAAI;AAAA,EACpE;AAAA,EACA,QAAQ,KAAK,OAAO;AACnB,UAAM,eAAe,IAAI,gBAAgB,OAAO,SAAS,MAAM;AAC/D,iBAAa,IAAI,IAAI,CAAC,GAAG,KAAK,UAAU,KAAK,CAAC;AACxC,UAAA,SAAS,GAAG,OAAO,SAAS,QAAQ,IAAI,aAAa,UAAU;AACrE,WAAO,QAAQ,aAAa,CAAA,GAAI,IAAI,MAAM;AAAA,EAAA;AAE5C;AAEA,MAAM,sCAAsC,CAAC,eAA4C;AACjF,SAAA;AAAA,IACN,QAAQ,KAAK;AACZ,YAAM,QAAQ,aAAa,QAAQ,IAAI,KAAK,GAAG,CAAC;AAChD,aAAO,UAAU,OAAO,KAAK,MAAM,KAAK,IAAI;AAAA,IAC7C;AAAA,IACA,QAAQ,KAAK,OAAO;AACR,iBAAA,EAAE,QAAQ,IAAI,KAAK,GAAG,GAAG,KAAK,UAAU,KAAK,CAAC;AAAA,IAAA;AAAA,EAE3D;AACD;AAEa,MAAA,sBAAsB,oCAAoC,MAAM,cAAc;AAC9E,MAAA,oBAAoB,oCAAoC,MAAM,YAAY;AAChF,MAAM,cAA4B;AAAA,EACxC,UAAU;AACF,WAAA;AAAA,EACR;AAAA,EACA,UAAU;AAAA,EAAA;AAEX;AAEA,MAAM,kBAAkB;AAAA,EACvB,KAAK;AAAA,EACL,SAAS;AAAA,EACT,OAAO;AAAA,EACP,MAAM;AACP;AAIO,MAAM,iBAAiB,CAAyB,eAA0D,KAAsB,oBAA2D;AAC3L,QAAA,UAAUA,MAAAA,QAAQ,MAAM;AAC7B,WAAO,gBAAgB,aAAa;AAAA,EAAA,GAClC,CAAC,aAAa,CAAC;AAElB,QAAM,CAAC,OAAO,QAAQ,IAAIC,eAAY,MAAM;AACrCC,UAAAA,SAAQ,QAAQ,QAAQ,GAAG;AACjC,WAAO,gBAAgBA,MAAU;AAAA,EAAA,CACjC;AACM,SAAA;AAAA,IACN;AAAA,IACAC,MAAA,YAAY,CAAAD,WAAS;AACpB,eAAS,CAAW,YAAA;AACnB,cAAM,WAAW,OAAOA,WAAU,aAAcA,OAA4B,OAAO,IAAIA;AAC/E,gBAAA,QAAQ,KAAK,QAAQ;AACtB,eAAA;AAAA,MAAA,CACP;AAAA,IAAA,GACC,CAAC,KAAK,OAAO,CAAC;AAAA,EAClB;AACD;AAEa,MAAA,yBAAyB,CAAyB,KAAsB,oBAA2D;AACxI,SAAA,eAAkB,qBAAqB,KAAK,eAAe;AACnE;AAEa,MAAA,uBAAuB,CAAyB,KAAsB,oBAA2D;AACtI,SAAA,eAAkB,mBAAmB,KAAK,eAAe;AACjE;AAEa,MAAA,kBAAkB,CAAC,kBAA6D;AACxF,MAAA,MAAM,QAAQ,aAAa,GAAG;AAC1B,WAAA,sBAAsB,cAAc,IAAI,CAAM,OAAA,OAAO,OAAO,WAAW,gBAAgB,EAAE,IAAI,EAAE,CAAC;AAAA,EAAA;AAExG,SAAO,OAAO,kBAAkB,WAAW,gBAAgB,aAAa,IAAI;AAC7E;AAGA,MAAM,wBAAwB,CAAC,iBAA+C;AACtE,SAAA;AAAA,IACN,QAAQ,KAAK;AACZ,iBAAW,WAAW,cAAc;AAC7B,cAAA,QAAQ,QAAQ,QAAQ,GAAG;AACjC,YAAI,UAAU,MAAM;AACZ,iBAAA;AAAA,QAAA;AAAA,MACR;AAEM,aAAA;AAAA,IACR;AAAA,IACA,QAAQ,KAAK,OAAO;AACnB,iBAAW,WAAW,cAAc;AAC3B,gBAAA,QAAQ,KAAK,KAAK;AAAA,MAAA;AAAA,IAC3B;AAAA,EAEF;AACD;;;;;;;;;"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { useMemo, useState, useCallback } from "react";
|
|
2
|
-
const urlStateStorage = {
|
|
3
|
-
getItem(key) {
|
|
4
|
-
const searchParams = new URLSearchParams(window.location.search);
|
|
5
|
-
const value = searchParams.get(key[1]);
|
|
6
|
-
return value !== null && value !== void 0 ? JSON.parse(value) : null;
|
|
7
|
-
},
|
|
8
|
-
setItem(key, value) {
|
|
9
|
-
const searchParams = new URLSearchParams(window.location.search);
|
|
10
|
-
searchParams.set(key[1], JSON.stringify(value));
|
|
11
|
-
const newUrl = `${window.location.pathname}?${searchParams.toString()}`;
|
|
12
|
-
window.history.replaceState({}, "", newUrl);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
const createStateStorageFromNativeStorage = (getStorage) => {
|
|
16
|
-
return {
|
|
17
|
-
getItem(key) {
|
|
18
|
-
const value = getStorage().getItem(key.join("-"));
|
|
19
|
-
return value !== null ? JSON.parse(value) : null;
|
|
20
|
-
},
|
|
21
|
-
setItem(key, value) {
|
|
22
|
-
getStorage().setItem(key.join("-"), JSON.stringify(value));
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
const sessionStateStorage = createStateStorageFromNativeStorage(() => sessionStorage);
|
|
27
|
-
const localStateStorage = createStateStorageFromNativeStorage(() => localStorage);
|
|
28
|
-
const nullStorage = {
|
|
29
|
-
getItem() {
|
|
30
|
-
return null;
|
|
31
|
-
},
|
|
32
|
-
setItem() {
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
const builtInStorages = {
|
|
36
|
-
url: urlStateStorage,
|
|
37
|
-
session: sessionStateStorage,
|
|
38
|
-
local: localStateStorage,
|
|
39
|
-
null: nullStorage
|
|
40
|
-
};
|
|
41
|
-
const useStoredState = (storageOrName, key, initializeValue) => {
|
|
42
|
-
const storage = useMemo(() => {
|
|
43
|
-
return getStateStorage(storageOrName);
|
|
44
|
-
}, [storageOrName]);
|
|
45
|
-
const [value, setValue] = useState(() => {
|
|
46
|
-
const value2 = storage.getItem(key);
|
|
47
|
-
return initializeValue(value2);
|
|
48
|
-
});
|
|
49
|
-
return [
|
|
50
|
-
value,
|
|
51
|
-
useCallback((value2) => {
|
|
52
|
-
setValue((current) => {
|
|
53
|
-
const newValue = typeof value2 === "function" ? value2(current) : value2;
|
|
54
|
-
storage.setItem(key, newValue);
|
|
55
|
-
return newValue;
|
|
56
|
-
});
|
|
57
|
-
}, [key, storage])
|
|
58
|
-
];
|
|
59
|
-
};
|
|
60
|
-
const useSessionStorageState = (key, initializeValue) => {
|
|
61
|
-
return useStoredState(sessionStateStorage, key, initializeValue);
|
|
62
|
-
};
|
|
63
|
-
const useLocalStorageState = (key, initializeValue) => {
|
|
64
|
-
return useStoredState(localStateStorage, key, initializeValue);
|
|
65
|
-
};
|
|
66
|
-
const getStateStorage = (storageOrName) => {
|
|
67
|
-
if (Array.isArray(storageOrName)) {
|
|
68
|
-
return createFallbackStorage(storageOrName.map((it) => typeof it === "string" ? builtInStorages[it] : it));
|
|
69
|
-
}
|
|
70
|
-
return typeof storageOrName === "string" ? builtInStorages[storageOrName] : storageOrName;
|
|
71
|
-
};
|
|
72
|
-
const createFallbackStorage = (storageTypes) => {
|
|
73
|
-
return {
|
|
74
|
-
getItem(key) {
|
|
75
|
-
for (const storage of storageTypes) {
|
|
76
|
-
const value = storage.getItem(key);
|
|
77
|
-
if (value !== null) {
|
|
78
|
-
return value;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return null;
|
|
82
|
-
},
|
|
83
|
-
setItem(key, value) {
|
|
84
|
-
for (const storage of storageTypes) {
|
|
85
|
-
storage.setItem(key, value);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
export {
|
|
91
|
-
getStateStorage,
|
|
92
|
-
localStateStorage,
|
|
93
|
-
nullStorage,
|
|
94
|
-
sessionStateStorage,
|
|
95
|
-
urlStateStorage,
|
|
96
|
-
useLocalStorageState,
|
|
97
|
-
useSessionStorageState,
|
|
98
|
-
useStoredState
|
|
99
|
-
};
|
|
100
|
-
//# sourceMappingURL=useStoredState.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useStoredState.js","sources":["../../../../../packages/react-utils/src/hooks/useStoredState.ts"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react'\nimport { Serializable } from '../types'\n\nexport type SetState<V extends Serializable> = (value: V | ((current: V) => V)) => void\nexport type StateStorageKey = [uniquePrefix: string, key: string]\n\nexport type ValueInitializer<V extends Serializable> = (storedValue: V | undefined) => V\n\nexport interface StateStorage {\n\tgetItem(key: StateStorageKey): Serializable\n\n\tsetItem(key: StateStorageKey, value: Serializable): void\n}\n\n\nexport const urlStateStorage: StateStorage = {\n\tgetItem(key) {\n\t\tconst searchParams = new URLSearchParams(window.location.search)\n\t\tconst value = searchParams.get(key[1])\n\t\treturn value !== null && value !== undefined ? JSON.parse(value) : null\n\t},\n\tsetItem(key, value) {\n\t\tconst searchParams = new URLSearchParams(window.location.search)\n\t\tsearchParams.set(key[1], JSON.stringify(value))\n\t\tconst newUrl = `${window.location.pathname}?${searchParams.toString()}`\n\t\twindow.history.replaceState({}, '', newUrl)\n\t},\n}\n\nconst createStateStorageFromNativeStorage = (getStorage: () => Storage): StateStorage => {\n\treturn {\n\t\tgetItem(key) {\n\t\t\tconst value = getStorage().getItem(key.join('-'))\n\t\t\treturn value !== null ? JSON.parse(value) : null\n\t\t},\n\t\tsetItem(key, value) {\n\t\t\tgetStorage().setItem(key.join('-'), JSON.stringify(value))\n\t\t},\n\t}\n}\n\nexport const sessionStateStorage = createStateStorageFromNativeStorage(() => sessionStorage)\nexport const localStateStorage = createStateStorageFromNativeStorage(() => localStorage)\nexport const nullStorage: StateStorage = {\n\tgetItem() {\n\t\treturn null\n\t},\n\tsetItem() {\n\t},\n}\n\nconst builtInStorages = {\n\turl: urlStateStorage,\n\tsession: sessionStateStorage,\n\tlocal: localStateStorage,\n\tnull: nullStorage,\n}\n\nexport type StateStorageOrName = StateStorage | 'url' | 'session' | 'local' | 'null'\n\nexport const useStoredState = <V extends Serializable>(storageOrName: StateStorageOrName | StateStorageOrName[], key: StateStorageKey, initializeValue: ValueInitializer<V>): [V, SetState<V>] => {\n\tconst storage = useMemo(() => {\n\t\treturn getStateStorage(storageOrName)\n\t}, [storageOrName])\n\n\tconst [value, setValue] = useState<V>(() => {\n\t\tconst value = storage.getItem(key)\n\t\treturn initializeValue(value as V)\n\t})\n\treturn [\n\t\tvalue,\n\t\tuseCallback(value => {\n\t\t\tsetValue(current => {\n\t\t\t\tconst newValue = typeof value === 'function' ? (value as (current: V) => V)(current) : value\n\t\t\t\tstorage.setItem(key, newValue)\n\t\t\t\treturn newValue\n\t\t\t})\n\t\t}, [key, storage]),\n\t]\n}\n\nexport const useSessionStorageState = <V extends Serializable>(key: StateStorageKey, initializeValue: ValueInitializer<V>): [V, SetState<V>] => {\n\treturn useStoredState<V>(sessionStateStorage, key, initializeValue)\n}\n\nexport const useLocalStorageState = <V extends Serializable>(key: StateStorageKey, initializeValue: ValueInitializer<V>): [V, SetState<V>] => {\n\treturn useStoredState<V>(localStateStorage, key, initializeValue)\n}\n\nexport const getStateStorage = (storageOrName: StateStorageOrName | StateStorageOrName[]) => {\n\tif (Array.isArray(storageOrName)) {\n\t\treturn createFallbackStorage(storageOrName.map(it => typeof it === 'string' ? builtInStorages[it] : it))\n\t}\n\treturn typeof storageOrName === 'string' ? builtInStorages[storageOrName] : storageOrName\n}\n\n\nconst createFallbackStorage = (storageTypes: StateStorage[]): StateStorage => {\n\treturn {\n\t\tgetItem(key) {\n\t\t\tfor (const storage of storageTypes) {\n\t\t\t\tconst value = storage.getItem(key)\n\t\t\t\tif (value !== null) {\n\t\t\t\t\treturn value\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null\n\t\t},\n\t\tsetItem(key, value) {\n\t\t\tfor (const storage of storageTypes) {\n\t\t\t\tstorage.setItem(key, value)\n\t\t\t}\n\t\t},\n\t}\n}\n"],"names":["value"],"mappings":"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"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
function useUpdatedRef(value) {
|
|
5
|
-
const ref = React.useRef(value);
|
|
6
|
-
ref.current = value;
|
|
7
|
-
return ref;
|
|
8
|
-
}
|
|
9
|
-
exports.useUpdatedRef = useUpdatedRef;
|
|
10
|
-
//# sourceMappingURL=useUpdatedRef.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useUpdatedRef.cjs","sources":["../../../../../packages/react-utils/src/hooks/useUpdatedRef.ts"],"sourcesContent":["import { useRef } from 'react'\n\n/**\n * Returns a stable mutable object with value that is updated upon each call\n *\n * @param value - Value that could update after initial call\n * @returns Mutable ref object with updated value\n */\nexport function useUpdatedRef<T>(value: T) {\n\tconst ref = useRef(value)\n\tref.current = value\n\n\treturn ref\n}\n"],"names":["useRef"],"mappings":";;;AAQO,SAAS,cAAiB,OAAU;AACpC,QAAA,MAAMA,aAAO,KAAK;AACxB,MAAI,UAAU;AAEP,SAAA;AACR;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useUpdatedRef.js","sources":["../../../../../packages/react-utils/src/hooks/useUpdatedRef.ts"],"sourcesContent":["import { useRef } from 'react'\n\n/**\n * Returns a stable mutable object with value that is updated upon each call\n *\n * @param value - Value that could update after initial call\n * @returns Mutable ref object with updated value\n */\nexport function useUpdatedRef<T>(value: T) {\n\tconst ref = useRef(value)\n\tref.current = value\n\n\treturn ref\n}\n"],"names":[],"mappings":";AAQO,SAAS,cAAiB,OAAU;AACpC,QAAA,MAAM,OAAO,KAAK;AACxB,MAAI,UAAU;AAEP,SAAA;AACR;"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const useOnWindowResize = require("./useOnWindowResize.cjs");
|
|
5
|
-
function useWindowSize() {
|
|
6
|
-
const [width, setWidth] = React.useState(window.innerWidth);
|
|
7
|
-
const [height, setHeight] = React.useState(window.innerHeight);
|
|
8
|
-
useOnWindowResize.useOnWindowResize(() => {
|
|
9
|
-
const { innerHeight, innerWidth } = window;
|
|
10
|
-
if (innerHeight !== height) {
|
|
11
|
-
setHeight(innerHeight);
|
|
12
|
-
}
|
|
13
|
-
if (innerWidth !== width) {
|
|
14
|
-
setWidth(innerWidth);
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
return React.useMemo(() => ({ height, width }), [height, width]);
|
|
18
|
-
}
|
|
19
|
-
exports.useWindowSize = useWindowSize;
|
|
20
|
-
//# sourceMappingURL=useWindowSize.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useWindowSize.cjs","sources":["../../../../../packages/react-utils/src/hooks/useWindowSize.ts"],"sourcesContent":["import { useMemo, useState } from 'react'\nimport { useOnWindowResize } from './useOnWindowResize'\n\nexport function useWindowSize() {\n\tconst [width, setWidth] = useState(window.innerWidth)\n\tconst [height, setHeight] = useState(window.innerHeight)\n\n\tuseOnWindowResize(() => {\n\t\tconst { innerHeight, innerWidth } = window\n\t\tif (innerHeight !== height) {\n\t\t\tsetHeight(innerHeight)\n\t\t}\n\n\t\tif (innerWidth !== width) {\n\t\t\tsetWidth(innerWidth)\n\t\t}\n\t})\n\n\treturn useMemo(() => ({ height, width }), [height, width])\n}\n"],"names":["useState","useOnWindowResize","useMemo"],"mappings":";;;;AAGO,SAAS,gBAAgB;AAC/B,QAAM,CAAC,OAAO,QAAQ,IAAIA,MAAAA,SAAS,OAAO,UAAU;AACpD,QAAM,CAAC,QAAQ,SAAS,IAAIA,MAAAA,SAAS,OAAO,WAAW;AAEvDC,oBAAAA,kBAAkB,MAAM;AACjB,UAAA,EAAE,aAAa,WAAA,IAAe;AACpC,QAAI,gBAAgB,QAAQ;AAC3B,gBAAU,WAAW;AAAA,IAAA;AAGtB,QAAI,eAAe,OAAO;AACzB,eAAS,UAAU;AAAA,IAAA;AAAA,EACpB,CACA;AAEM,SAAAC,MAAA,QAAQ,OAAO,EAAE,QAAQ,MAAU,IAAA,CAAC,QAAQ,KAAK,CAAC;AAC1D;;"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { useState, useMemo } from "react";
|
|
2
|
-
import { useOnWindowResize } from "./useOnWindowResize.js";
|
|
3
|
-
function useWindowSize() {
|
|
4
|
-
const [width, setWidth] = useState(window.innerWidth);
|
|
5
|
-
const [height, setHeight] = useState(window.innerHeight);
|
|
6
|
-
useOnWindowResize(() => {
|
|
7
|
-
const { innerHeight, innerWidth } = window;
|
|
8
|
-
if (innerHeight !== height) {
|
|
9
|
-
setHeight(innerHeight);
|
|
10
|
-
}
|
|
11
|
-
if (innerWidth !== width) {
|
|
12
|
-
setWidth(innerWidth);
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
return useMemo(() => ({ height, width }), [height, width]);
|
|
16
|
-
}
|
|
17
|
-
export {
|
|
18
|
-
useWindowSize
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=useWindowSize.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useWindowSize.js","sources":["../../../../../packages/react-utils/src/hooks/useWindowSize.ts"],"sourcesContent":["import { useMemo, useState } from 'react'\nimport { useOnWindowResize } from './useOnWindowResize'\n\nexport function useWindowSize() {\n\tconst [width, setWidth] = useState(window.innerWidth)\n\tconst [height, setHeight] = useState(window.innerHeight)\n\n\tuseOnWindowResize(() => {\n\t\tconst { innerHeight, innerWidth } = window\n\t\tif (innerHeight !== height) {\n\t\t\tsetHeight(innerHeight)\n\t\t}\n\n\t\tif (innerWidth !== width) {\n\t\t\tsetWidth(innerWidth)\n\t\t}\n\t})\n\n\treturn useMemo(() => ({ height, width }), [height, width])\n}\n"],"names":[],"mappings":";;AAGO,SAAS,gBAAgB;AAC/B,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,OAAO,UAAU;AACpD,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,OAAO,WAAW;AAEvD,oBAAkB,MAAM;AACjB,UAAA,EAAE,aAAa,WAAA,IAAe;AACpC,QAAI,gBAAgB,QAAQ;AAC3B,gBAAU,WAAW;AAAA,IAAA;AAGtB,QAAI,eAAe,OAAO;AACzB,eAAS,UAAU;AAAA,IAAA;AAAA,EACpB,CACA;AAEM,SAAA,QAAQ,OAAO,EAAE,QAAQ,MAAU,IAAA,CAAC,QAAQ,KAAK,CAAC;AAC1D;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"emptyArray.cjs","sources":["../../../../../packages/react-utils/src/referentiallyStable/emptyArray.ts"],"sourcesContent":["export const emptyArray = Object.freeze<any>([]) as any[]\n"],"names":[],"mappings":";;AAAO,MAAM,aAAa,OAAO,OAAY,CAAE,CAAA;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"emptyArray.js","sources":["../../../../../packages/react-utils/src/referentiallyStable/emptyArray.ts"],"sourcesContent":["export const emptyArray = Object.freeze<any>([]) as any[]\n"],"names":[],"mappings":"AAAO,MAAM,aAAa,OAAO,OAAY,CAAE,CAAA;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"emptyObject.cjs","sources":["../../../../../packages/react-utils/src/referentiallyStable/emptyObject.ts"],"sourcesContent":["export const emptyObject = Object.freeze({})\n"],"names":[],"mappings":";;AAAO,MAAM,cAAc,OAAO,OAAO,CAAE,CAAA;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"emptyObject.js","sources":["../../../../../packages/react-utils/src/referentiallyStable/emptyObject.ts"],"sourcesContent":["export const emptyObject = Object.freeze({})\n"],"names":[],"mappings":"AAAO,MAAM,cAAc,OAAO,OAAO,CAAE,CAAA;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identityFunction.cjs","sources":["../../../../../packages/react-utils/src/referentiallyStable/identityFunction.ts"],"sourcesContent":["export const identityFunction = <Value>(value: Value) => value\n"],"names":[],"mappings":";;AAAa,MAAA,mBAAmB,CAAQ,UAAiB;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identityFunction.js","sources":["../../../../../packages/react-utils/src/referentiallyStable/identityFunction.ts"],"sourcesContent":["export const identityFunction = <Value>(value: Value) => value\n"],"names":[],"mappings":"AAAa,MAAA,mBAAmB,CAAQ,UAAiB;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"noop.cjs","sources":["../../../../../packages/react-utils/src/referentiallyStable/noop.ts"],"sourcesContent":["export const noop = () => undefined\n"],"names":[],"mappings":";;AAAO,MAAM,OAAO,MAAM;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"noop.js","sources":["../../../../../packages/react-utils/src/referentiallyStable/noop.ts"],"sourcesContent":["export const noop = () => undefined\n"],"names":[],"mappings":"AAAO,MAAM,OAAO,MAAM;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"returnFalse.cjs","sources":["../../../../../packages/react-utils/src/referentiallyStable/returnFalse.ts"],"sourcesContent":["export const returnFalse = () => false\n"],"names":[],"mappings":";;AAAO,MAAM,cAAc,MAAM;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"returnFalse.js","sources":["../../../../../packages/react-utils/src/referentiallyStable/returnFalse.ts"],"sourcesContent":["export const returnFalse = () => false\n"],"names":[],"mappings":"AAAO,MAAM,cAAc,MAAM;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"returnTrue.cjs","sources":["../../../../../packages/react-utils/src/referentiallyStable/returnTrue.ts"],"sourcesContent":["export const returnTrue = () => true\n"],"names":[],"mappings":";;AAAO,MAAM,aAAa,MAAM;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"returnTrue.js","sources":["../../../../../packages/react-utils/src/referentiallyStable/returnTrue.ts"],"sourcesContent":["export const returnTrue = () => true\n"],"names":[],"mappings":"AAAO,MAAM,aAAa,MAAM;"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const useReferentiallyStableCallback = (callback) => {
|
|
5
|
-
const ref = React.useRef(callback);
|
|
6
|
-
ref.current = callback;
|
|
7
|
-
return React.useCallback((...args) => {
|
|
8
|
-
return ref.current(...args);
|
|
9
|
-
}, []);
|
|
10
|
-
};
|
|
11
|
-
exports.useReferentiallyStableCallback = useReferentiallyStableCallback;
|
|
12
|
-
//# sourceMappingURL=useReferentiallyStableCallback.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useReferentiallyStableCallback.cjs","sources":["../../../../../packages/react-utils/src/referentiallyStable/useReferentiallyStableCallback.ts"],"sourcesContent":["import { useCallback, useRef } from 'react'\n\n// TODO: Should be possible to remove when React.useEvent() lands\nexport const useReferentiallyStableCallback = <T extends (...args: any[]) => any>(callback: T): T => {\n\tconst ref = useRef(callback)\n\tref.current = callback\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\treturn useCallback<T>(((...args: any[]) => {\n\t\treturn ref.current(...args)\n\t}) as T, [])\n}\n"],"names":["useRef","useCallback"],"mappings":";;;AAGa,MAAA,iCAAiC,CAAoC,aAAmB;AAC9F,QAAA,MAAMA,aAAO,QAAQ;AAC3B,MAAI,UAAU;AAEP,SAAAC,MAAA,YAAgB,IAAI,SAAgB;AACnC,WAAA,IAAI,QAAQ,GAAG,IAAI;AAAA,EAC3B,GAAS,EAAE;AACZ;;"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { useRef, useCallback } from "react";
|
|
2
|
-
const useReferentiallyStableCallback = (callback) => {
|
|
3
|
-
const ref = useRef(callback);
|
|
4
|
-
ref.current = callback;
|
|
5
|
-
return useCallback((...args) => {
|
|
6
|
-
return ref.current(...args);
|
|
7
|
-
}, []);
|
|
8
|
-
};
|
|
9
|
-
export {
|
|
10
|
-
useReferentiallyStableCallback
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=useReferentiallyStableCallback.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useReferentiallyStableCallback.js","sources":["../../../../../packages/react-utils/src/referentiallyStable/useReferentiallyStableCallback.ts"],"sourcesContent":["import { useCallback, useRef } from 'react'\n\n// TODO: Should be possible to remove when React.useEvent() lands\nexport const useReferentiallyStableCallback = <T extends (...args: any[]) => any>(callback: T): T => {\n\tconst ref = useRef(callback)\n\tref.current = callback\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\treturn useCallback<T>(((...args: any[]) => {\n\t\treturn ref.current(...args)\n\t}) as T, [])\n}\n"],"names":[],"mappings":";AAGa,MAAA,iCAAiC,CAAoC,aAAmB;AAC9F,QAAA,MAAM,OAAO,QAAQ;AAC3B,MAAI,UAAU;AAEP,SAAA,YAAgB,IAAI,SAAgB;AACnC,WAAA,IAAI,QAAQ,GAAG,IAAI;AAAA,EAC3B,GAAS,EAAE;AACZ;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createContext.d.ts","sourceRoot":"","sources":["../../../src/context/createContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAG9C,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAKlG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createRequiredContext.d.ts","sourceRoot":"","sources":["../../../src/context/createRequiredContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAK9C,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAehG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/context/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,iBAAiB,CAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ScopedConsoleContextType } from './Types';
|
|
2
|
-
export declare function noopLog(...parameters: any[]): void;
|
|
3
|
-
export declare function noopLogged<T>(message: string, value: T): T;
|
|
4
|
-
export declare const noopScopedConsole: ScopedConsoleContextType;
|
|
5
|
-
export declare function isNoopScopedConsole(value: unknown): boolean;
|
|
6
|
-
//# sourceMappingURL=Constants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../../src/debug-context/Constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAEvD,wBAAgB,OAAO,CAAC,GAAG,UAAU,EAAE,GAAG,EAAE,QAAK;AAEjD,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAE1D;AAED,eAAO,MAAM,iBAAiB,EAAE,wBAS9B,CAAA;AAEF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE3D"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { ScopedConsoleContextType } from './Types';
|
|
3
|
-
export declare const ScopedConsoleContext: import("react").Context<ScopedConsoleContextType>;
|
|
4
|
-
export declare const useScopedConsoleRef: (prefix: string, override?: boolean) => import("react").MutableRefObject<ScopedConsoleContextType>;
|
|
5
|
-
export type DebugChildrenProps = {
|
|
6
|
-
active?: true;
|
|
7
|
-
children: ReactNode;
|
|
8
|
-
id: string;
|
|
9
|
-
} | {
|
|
10
|
-
active?: false;
|
|
11
|
-
children: ReactNode;
|
|
12
|
-
id?: string;
|
|
13
|
-
};
|
|
14
|
-
export declare const DebugChildren: import("react").NamedExoticComponent<DebugChildrenProps>;
|
|
15
|
-
//# sourceMappingURL=Context.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../src/debug-context/Context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoD,MAAM,OAAO,CAAA;AAEnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAmClD,eAAO,MAAM,oBAAoB,mDAAiD,CAAA;AAOlF,eAAO,MAAM,mBAAmB,GAAI,QAAQ,MAAM,EAAE,WAAW,OAAO,+DAkBrE,CAAA;AAED,MAAM,MAAM,kBAAkB,GAC3B;IAAE,MAAM,CAAC,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAClD;IAAE,MAAM,CAAC,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAEvD,eAAO,MAAM,aAAa,0DAYxB,CAAA"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type DebugMethod = (...parameters: any[]) => void;
|
|
2
|
-
export type ResultDebuggedMethod = <T>(message: string, value: T) => T;
|
|
3
|
-
export type ScopedConsoleContextType = {
|
|
4
|
-
log: DebugMethod;
|
|
5
|
-
logged: ResultDebuggedMethod;
|
|
6
|
-
warn: DebugMethod;
|
|
7
|
-
warned: ResultDebuggedMethod;
|
|
8
|
-
error: DebugMethod;
|
|
9
|
-
errored: ResultDebuggedMethod;
|
|
10
|
-
trace: DebugMethod;
|
|
11
|
-
traced: ResultDebuggedMethod;
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=Types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Types.d.ts","sourceRoot":"","sources":["../../../src/debug-context/Types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,UAAU,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;AACxD,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,CAAA;AAEtE,MAAM,MAAM,wBAAwB,GAAG;IACtC,GAAG,EAAE,WAAW,CAAA;IAChB,MAAM,EAAE,oBAAoB,CAAA;IAC5B,IAAI,EAAE,WAAW,CAAA;IACjB,MAAM,EAAE,oBAAoB,CAAA;IAC5B,KAAK,EAAE,WAAW,CAAA;IAClB,OAAO,EAAE,oBAAoB,CAAA;IAC7B,KAAK,EAAE,WAAW,CAAA;IAClB,MAAM,EAAE,oBAAoB,CAAA;CAC5B,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/debug-context/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export * from './unwrapRefValue';
|
|
2
|
-
export * from './useAbortController';
|
|
3
|
-
export * from './useArrayMapMemo';
|
|
4
|
-
export * from './useAutoHeightTextArea';
|
|
5
|
-
export * from './useChildrenAsLabel';
|
|
6
|
-
export * from './useComposeRef';
|
|
7
|
-
export * from './useConstantLengthInvariant';
|
|
8
|
-
export * from './useConstantValueInvariant';
|
|
9
|
-
export * from './useDebounce';
|
|
10
|
-
export * from './useDebounceCallback';
|
|
11
|
-
export * from './useDocumentTitle';
|
|
12
|
-
export * from './useExpectSameValueReference';
|
|
13
|
-
export * from './useForceRender';
|
|
14
|
-
export * from './useId';
|
|
15
|
-
export * from './useIsMounted';
|
|
16
|
-
export * from './useObjectMemo';
|
|
17
|
-
export * from './useOnElementClickOutsideCallback';
|
|
18
|
-
export * from './useOnElementMouseEnterDelayedCallback';
|
|
19
|
-
export * from './useOnElementResize';
|
|
20
|
-
export * from './useOnWindowResize';
|
|
21
|
-
export * from './usePreviousValue';
|
|
22
|
-
export * from './useStoredState';
|
|
23
|
-
export * from './useUpdatedRef';
|
|
24
|
-
export * from './useWindowSize';
|
|
25
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA;AACjC,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,8BAA8B,CAAA;AAC5C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,eAAe,CAAA;AAC7B,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,kBAAkB,CAAA;AAChC,cAAc,SAAS,CAAA;AACvB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oCAAoC,CAAA;AAClD,cAAc,yCAAyC,CAAA;AACvD,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
export type RefObjectOrElement<T> = T | RefObject<T>;
|
|
3
|
-
/**
|
|
4
|
-
* Unwraps a ref object or returns the value if it is not a ref object.
|
|
5
|
-
* @param value - Value to unwrap
|
|
6
|
-
* @returns Unwrapped value
|
|
7
|
-
*/
|
|
8
|
-
export declare function unwrapRefValue<T>(value: RefObjectOrElement<T>): T | null;
|
|
9
|
-
//# sourceMappingURL=unwrapRefValue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unwrapRefValue.d.ts","sourceRoot":"","sources":["../../../src/hooks/unwrapRefValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;AAEpD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAMxE"}
|