@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
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contember/react-utils",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "2.1.0-alpha.
|
|
4
|
+
"version": "2.1.0-alpha.36",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "./dist/production/index.js",
|
|
@@ -29,9 +29,17 @@
|
|
|
29
29
|
"ae:test": "api-extractor run"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"react": "
|
|
32
|
+
"react": "catalog:"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@testing-library/react": "catalog:"
|
|
33
36
|
},
|
|
34
37
|
"dependencies": {
|
|
35
|
-
"fast-deep-equal": "
|
|
38
|
+
"fast-deep-equal": "catalog:"
|
|
39
|
+
},
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "git+https://github.com/contember/contember.git",
|
|
43
|
+
"directory": "packages/react-utils"
|
|
36
44
|
}
|
|
37
45
|
}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createContext, memo, ReactNode, useContext, useMemo, useRef } from 'react'
|
|
2
2
|
import { isNoopScopedConsole, noopScopedConsole } from './Constants'
|
|
3
3
|
import { ScopedConsoleContextType } from './Types'
|
|
4
4
|
|
|
5
5
|
function createPrefixedConsole(message: string, prefixedConsole?: ScopedConsoleContextType): ScopedConsoleContextType {
|
|
6
6
|
return {
|
|
7
7
|
error: function error(...parameters: any[]) {
|
|
8
|
-
(prefixedConsole ?? console).error(message, ...parameters)
|
|
8
|
+
;(prefixedConsole ?? console).error(message, ...parameters)
|
|
9
9
|
},
|
|
10
|
-
errored: function errored<T
|
|
11
|
-
(prefixedConsole ?? console).error(message, value)
|
|
10
|
+
errored: function errored<T,>(message: string, value: T): T {
|
|
11
|
+
;(prefixedConsole ?? console).error(message, value)
|
|
12
12
|
return value
|
|
13
13
|
},
|
|
14
14
|
log: function log(...parameters: any[]) {
|
|
15
|
-
(prefixedConsole ?? console).log(message, ...parameters)
|
|
15
|
+
;(prefixedConsole ?? console).log(message, ...parameters)
|
|
16
16
|
},
|
|
17
|
-
logged: function logged<T
|
|
18
|
-
(prefixedConsole ?? console).log(message, value)
|
|
17
|
+
logged: function logged<T,>(message: string, value: T): T {
|
|
18
|
+
;(prefixedConsole ?? console).log(message, value)
|
|
19
19
|
return value
|
|
20
20
|
},
|
|
21
21
|
trace: function trace(...parameters: any[]) {
|
|
22
|
-
(prefixedConsole ?? console).trace(message, ...parameters)
|
|
22
|
+
;(prefixedConsole ?? console).trace(message, ...parameters)
|
|
23
23
|
},
|
|
24
|
-
traced: function traced<T
|
|
25
|
-
(prefixedConsole ?? console).trace(message, value)
|
|
24
|
+
traced: function traced<T,>(message: string, value: T): T {
|
|
25
|
+
;(prefixedConsole ?? console).trace(message, value)
|
|
26
26
|
return value
|
|
27
27
|
},
|
|
28
28
|
warn: function warn(...parameters: any[]) {
|
|
29
|
-
(prefixedConsole ?? console).warn(message, ...parameters)
|
|
29
|
+
;(prefixedConsole ?? console).warn(message, ...parameters)
|
|
30
30
|
},
|
|
31
|
-
warned: function warned<T
|
|
32
|
-
(prefixedConsole ?? console).warn(message, value)
|
|
31
|
+
warned: function warned<T,>(message: string, value: T): T {
|
|
32
|
+
;(prefixedConsole ?? console).warn(message, value)
|
|
33
33
|
return value
|
|
34
34
|
},
|
|
35
35
|
}
|
|
@@ -20,9 +20,9 @@ export const useArrayMapMemo = <Item, OutputItem>(
|
|
|
20
20
|
// in the sense that the items are identical, albeit computed via a different map function, we still want to
|
|
21
21
|
// preserve the referential equality of the original. Hence the second memo.
|
|
22
22
|
|
|
23
|
-
//
|
|
23
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: intentional
|
|
24
24
|
const mapped = useMemo(() => items.map(map), [map, ...items])
|
|
25
25
|
|
|
26
|
-
//
|
|
26
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: intentional
|
|
27
27
|
return useMemo(() => mapped, mapped) // This is deliberately not `[mapped]`
|
|
28
28
|
}
|
|
@@ -48,6 +48,7 @@ export const useAutoHeightTextArea = (
|
|
|
48
48
|
measure(unwrapRefValue(textAreaRef), minRows, maxRows)
|
|
49
49
|
})
|
|
50
50
|
|
|
51
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: intentional
|
|
51
52
|
useLayoutEffect(() => {
|
|
52
53
|
measure(unwrapRefValue(textAreaRef), minRows, maxRows)
|
|
53
54
|
}, [maxRows, measure, minRows, textAreaRef, value])
|
|
@@ -11,7 +11,6 @@ function normalize(text: string): string {
|
|
|
11
11
|
*
|
|
12
12
|
* @param node - The children to walk through.
|
|
13
13
|
* @returns String representation of the text content or undefined if there is no text content.
|
|
14
|
-
*
|
|
15
14
|
*/
|
|
16
15
|
export function getChildrenAsLabel(node: ReactNode): string | undefined {
|
|
17
16
|
if (typeof node === 'string' || typeof node === 'number') {
|
|
@@ -27,18 +26,19 @@ export function getChildrenAsLabel(node: ReactNode): string | undefined {
|
|
|
27
26
|
if (child === null || child === undefined || typeof child === 'boolean') {
|
|
28
27
|
} else if (typeof child === 'string') {
|
|
29
28
|
label.push(child)
|
|
30
|
-
} else if (typeof child === 'number') {
|
|
31
|
-
label.push(child)
|
|
29
|
+
} else if (typeof child === 'number' || typeof child === 'bigint') {
|
|
30
|
+
label.push(String(child))
|
|
32
31
|
} else if (Array.isArray(child)) {
|
|
33
32
|
const childLabel = getChildrenAsLabel(child)
|
|
34
33
|
|
|
35
34
|
if (childLabel) {
|
|
36
35
|
label.push(childLabel)
|
|
37
36
|
}
|
|
38
|
-
} else {
|
|
39
|
-
// ReactElement |
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
} else if (typeof child === 'object') {
|
|
38
|
+
// ReactElement | ReactPortal | Iterable
|
|
39
|
+
const props = 'props' in child ? child.props as Record<string, unknown> : null
|
|
40
|
+
if (props && 'children' in props) {
|
|
41
|
+
const childLabel = getChildrenAsLabel(props.children as ReactNode)
|
|
42
42
|
|
|
43
43
|
if (childLabel) {
|
|
44
44
|
label.push(childLabel)
|
|
@@ -65,7 +65,6 @@ export function getChildrenAsLabel(node: ReactNode): string | undefined {
|
|
|
65
65
|
*
|
|
66
66
|
* @param node - The children to walk through.
|
|
67
67
|
* @returns String representation of the text content or undefined if there is no text content.
|
|
68
|
-
*
|
|
69
68
|
*/
|
|
70
69
|
export function useChildrenAsLabel(node: ReactNode): string | undefined {
|
|
71
70
|
return useMemo(() => getChildrenAsLabel(node), [node])
|
|
@@ -3,12 +3,10 @@ import { usePreviousValue } from './usePreviousValue'
|
|
|
3
3
|
// This entire hook should get optimized away for prod
|
|
4
4
|
export const useConstantLengthInvariant = <Item>(items: Item[], message?: string) => {
|
|
5
5
|
if (import.meta.env.DEV) {
|
|
6
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
7
6
|
const previous = usePreviousValue(items)
|
|
8
7
|
if (previous.length !== items.length) {
|
|
9
8
|
throw new Error(
|
|
10
|
-
`Invariant violation: ${message || 'Changing the length of an array whose length must remain constant between renders.'
|
|
11
|
-
}`,
|
|
9
|
+
`Invariant violation: ${message || 'Changing the length of an array whose length must remain constant between renders.'}`,
|
|
12
10
|
)
|
|
13
11
|
}
|
|
14
12
|
}
|
|
@@ -3,7 +3,6 @@ import { usePreviousValue } from './usePreviousValue'
|
|
|
3
3
|
// This entire hook should get optimized away for prod
|
|
4
4
|
export const useConstantValueInvariant = <Value>(value: Value, message?: string) => {
|
|
5
5
|
if (import.meta.env.DEV) {
|
|
6
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
7
6
|
const previous = usePreviousValue(value)
|
|
8
7
|
if (previous !== value) {
|
|
9
8
|
throw new Error(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef } from 'react'
|
|
2
2
|
|
|
3
3
|
export const useDebounceCallback = (cb: () => any, debounceMs: number) => {
|
|
4
|
-
const timerRef = useRef<ReturnType<typeof setTimeout>>()
|
|
4
|
+
const timerRef = useRef<ReturnType<typeof setTimeout>>(undefined)
|
|
5
5
|
const cbRef = useRef(cb)
|
|
6
6
|
cbRef.current = cb
|
|
7
7
|
|
|
@@ -26,20 +26,23 @@ import { useRef } from 'react'
|
|
|
26
26
|
export function useExpectSameValueReference<T>(next: T, shouldThrow: boolean = false) {
|
|
27
27
|
const previous = useRef(next)
|
|
28
28
|
|
|
29
|
-
if (
|
|
29
|
+
if (
|
|
30
|
+
next !== previous.current
|
|
30
31
|
&& typeof next === 'object'
|
|
31
32
|
&& typeof previous.current === 'object'
|
|
32
33
|
&& deepEqual(next, previous.current)
|
|
33
34
|
) {
|
|
34
35
|
if (import.meta.env.DEV) {
|
|
35
36
|
console.error(
|
|
36
|
-
'Previous and next values do not match in reference although match in value. '
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
'Previous and next values do not match in reference although match in value. '
|
|
38
|
+
+ 'Try declaring constants outside of the component scope. '
|
|
39
|
+
+ 'Otherwise try to memoize callbacks with useCallback, '
|
|
40
|
+
+ 'useReferentiallyStableCallback useEvent, useRef or useMemo.',
|
|
41
|
+
{
|
|
40
42
|
previous: previous.current,
|
|
41
43
|
next,
|
|
42
|
-
}
|
|
44
|
+
},
|
|
45
|
+
)
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
if (shouldThrow) {
|
|
@@ -21,7 +21,7 @@ export function useOnElementMouseEnterDelayedCallback(
|
|
|
21
21
|
const refValue = unwrapRefValue(refOrElement)
|
|
22
22
|
|
|
23
23
|
if (refValue) {
|
|
24
|
-
let timeoutID: ReturnType<typeof setTimeout> | undefined
|
|
24
|
+
let timeoutID: ReturnType<typeof setTimeout> | undefined
|
|
25
25
|
|
|
26
26
|
function handleMouseEnter(event: MouseEvent) {
|
|
27
27
|
clearTimeout(timeoutID)
|
|
@@ -11,7 +11,8 @@ export function useOnElementResize(
|
|
|
11
11
|
const scopedConsoleRef = useScopedConsoleRef('useOnElementResize')
|
|
12
12
|
|
|
13
13
|
const { box = 'border-box' } = options
|
|
14
|
-
const callbackRef = useRef(callback)
|
|
14
|
+
const callbackRef = useRef(callback)
|
|
15
|
+
callbackRef.current = callback
|
|
15
16
|
const lastTimeStamp = useRef<number>(0)
|
|
16
17
|
|
|
17
18
|
useLayoutEffect(() => {
|
|
@@ -7,9 +7,11 @@ export function useOnWindowResize(
|
|
|
7
7
|
) {
|
|
8
8
|
const scopedConsoleRef = useScopedConsoleRef('useOnWindowResize')
|
|
9
9
|
|
|
10
|
-
const callbackRef = useRef(callback)
|
|
10
|
+
const callbackRef = useRef(callback)
|
|
11
|
+
callbackRef.current = callback
|
|
11
12
|
const lastTimeStamp = useRef<number>(0)
|
|
12
13
|
|
|
14
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: intentional
|
|
13
15
|
useLayoutEffect(() => {
|
|
14
16
|
let timeoutID: ReturnType<typeof setTimeout>
|
|
15
17
|
|
|
@@ -12,7 +12,6 @@ export interface StateStorage {
|
|
|
12
12
|
setItem(key: StateStorageKey, value: Serializable): void
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
16
15
|
export const urlStateStorage: StateStorage = {
|
|
17
16
|
getItem(key) {
|
|
18
17
|
const searchParams = new URLSearchParams(window.location.search)
|
|
@@ -58,7 +57,11 @@ const builtInStorages = {
|
|
|
58
57
|
|
|
59
58
|
export type StateStorageOrName = StateStorage | 'url' | 'session' | 'local' | 'null'
|
|
60
59
|
|
|
61
|
-
export const useStoredState = <V extends Serializable>(
|
|
60
|
+
export const useStoredState = <V extends Serializable>(
|
|
61
|
+
storageOrName: StateStorageOrName | StateStorageOrName[],
|
|
62
|
+
key: StateStorageKey,
|
|
63
|
+
initializeValue: ValueInitializer<V>,
|
|
64
|
+
): [V, SetState<V>] => {
|
|
62
65
|
const storage = useMemo(() => {
|
|
63
66
|
return getStateStorage(storageOrName)
|
|
64
67
|
}, [storageOrName])
|
|
@@ -94,7 +97,6 @@ export const getStateStorage = (storageOrName: StateStorageOrName | StateStorage
|
|
|
94
97
|
return typeof storageOrName === 'string' ? builtInStorages[storageOrName] : storageOrName
|
|
95
98
|
}
|
|
96
99
|
|
|
97
|
-
|
|
98
100
|
const createFallbackStorage = (storageTypes: StateStorage[]): StateStorage => {
|
|
99
101
|
return {
|
|
100
102
|
getItem(key) {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { useCallback, useRef } from 'react'
|
|
2
2
|
|
|
3
|
-
export type NoConstructor<T extends Function> =
|
|
4
|
-
|
|
5
|
-
? never
|
|
6
|
-
: T
|
|
3
|
+
export type NoConstructor<T extends Function> = T extends new(...args: unknown[]) => unknown ? never
|
|
4
|
+
: T
|
|
7
5
|
// TODO: Should be possible to remove when React.useEvent() lands
|
|
8
6
|
export const useReferentiallyStableCallback = <T extends Function>(callback: NoConstructor<T>): T => {
|
|
9
7
|
const ref = useRef(callback)
|
|
10
8
|
ref.current = callback
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
return useCallback<T>(
|
|
10
|
+
((...args: any[]) => {
|
|
11
|
+
return ref.current(...args)
|
|
12
|
+
}) as unknown as T,
|
|
13
|
+
[],
|
|
14
|
+
)
|
|
15
15
|
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const createRequiredContext = require("./src/context/createRequiredContext.cjs");
|
|
4
|
-
const createContext = require("./src/context/createContext.cjs");
|
|
5
|
-
const Constants = require("./src/debug-context/Constants.cjs");
|
|
6
|
-
const Context = require("./src/debug-context/Context.cjs");
|
|
7
|
-
const unwrapRefValue = require("./src/hooks/unwrapRefValue.cjs");
|
|
8
|
-
const useAbortController = require("./src/hooks/useAbortController.cjs");
|
|
9
|
-
const useArrayMapMemo = require("./src/hooks/useArrayMapMemo.cjs");
|
|
10
|
-
const useAutoHeightTextArea = require("./src/hooks/useAutoHeightTextArea.cjs");
|
|
11
|
-
const useChildrenAsLabel = require("./src/hooks/useChildrenAsLabel.cjs");
|
|
12
|
-
const useComposeRef = require("./src/hooks/useComposeRef.cjs");
|
|
13
|
-
const useConstantLengthInvariant = require("./src/hooks/useConstantLengthInvariant.cjs");
|
|
14
|
-
const useConstantValueInvariant = require("./src/hooks/useConstantValueInvariant.cjs");
|
|
15
|
-
const useDebounce = require("./src/hooks/useDebounce.cjs");
|
|
16
|
-
const useDebounceCallback = require("./src/hooks/useDebounceCallback.cjs");
|
|
17
|
-
const useDocumentTitle = require("./src/hooks/useDocumentTitle.cjs");
|
|
18
|
-
const useExpectSameValueReference = require("./src/hooks/useExpectSameValueReference.cjs");
|
|
19
|
-
const useForceRender = require("./src/hooks/useForceRender.cjs");
|
|
20
|
-
const useId = require("./src/hooks/useId.cjs");
|
|
21
|
-
const useIsMounted = require("./src/hooks/useIsMounted.cjs");
|
|
22
|
-
const useObjectMemo = require("./src/hooks/useObjectMemo.cjs");
|
|
23
|
-
const useOnElementClickOutsideCallback = require("./src/hooks/useOnElementClickOutsideCallback.cjs");
|
|
24
|
-
const useOnElementMouseEnterDelayedCallback = require("./src/hooks/useOnElementMouseEnterDelayedCallback.cjs");
|
|
25
|
-
const useOnElementResize = require("./src/hooks/useOnElementResize.cjs");
|
|
26
|
-
const useOnWindowResize = require("./src/hooks/useOnWindowResize.cjs");
|
|
27
|
-
const usePreviousValue = require("./src/hooks/usePreviousValue.cjs");
|
|
28
|
-
const useStoredState = require("./src/hooks/useStoredState.cjs");
|
|
29
|
-
const useUpdatedRef = require("./src/hooks/useUpdatedRef.cjs");
|
|
30
|
-
const useWindowSize = require("./src/hooks/useWindowSize.cjs");
|
|
31
|
-
const emptyArray = require("./src/referentiallyStable/emptyArray.cjs");
|
|
32
|
-
const emptyObject = require("./src/referentiallyStable/emptyObject.cjs");
|
|
33
|
-
const identityFunction = require("./src/referentiallyStable/identityFunction.cjs");
|
|
34
|
-
const noop = require("./src/referentiallyStable/noop.cjs");
|
|
35
|
-
const returnFalse = require("./src/referentiallyStable/returnFalse.cjs");
|
|
36
|
-
const returnTrue = require("./src/referentiallyStable/returnTrue.cjs");
|
|
37
|
-
const useReferentiallyStableCallback = require("./src/referentiallyStable/useReferentiallyStableCallback.cjs");
|
|
38
|
-
exports.createRequiredContext = createRequiredContext.createRequiredContext;
|
|
39
|
-
exports.createContext = createContext.createContext;
|
|
40
|
-
exports.isNoopScopedConsole = Constants.isNoopScopedConsole;
|
|
41
|
-
exports.noopLog = Constants.noopLog;
|
|
42
|
-
exports.noopLogged = Constants.noopLogged;
|
|
43
|
-
exports.noopScopedConsole = Constants.noopScopedConsole;
|
|
44
|
-
exports.DebugChildren = Context.DebugChildren;
|
|
45
|
-
exports.ScopedConsoleContext = Context.ScopedConsoleContext;
|
|
46
|
-
exports.useScopedConsoleRef = Context.useScopedConsoleRef;
|
|
47
|
-
exports.unwrapRefValue = unwrapRefValue.unwrapRefValue;
|
|
48
|
-
exports.useAbortController = useAbortController.useAbortController;
|
|
49
|
-
exports.useArrayMapMemo = useArrayMapMemo.useArrayMapMemo;
|
|
50
|
-
exports.useAutoHeightTextArea = useAutoHeightTextArea.useAutoHeightTextArea;
|
|
51
|
-
exports.getChildrenAsLabel = useChildrenAsLabel.getChildrenAsLabel;
|
|
52
|
-
exports.useChildrenAsLabel = useChildrenAsLabel.useChildrenAsLabel;
|
|
53
|
-
exports.useComposeRef = useComposeRef.useComposeRef;
|
|
54
|
-
exports.useConstantLengthInvariant = useConstantLengthInvariant.useConstantLengthInvariant;
|
|
55
|
-
exports.useConstantValueInvariant = useConstantValueInvariant.useConstantValueInvariant;
|
|
56
|
-
exports.useDebounce = useDebounce.useDebounce;
|
|
57
|
-
exports.useDebounceCallback = useDebounceCallback.useDebounceCallback;
|
|
58
|
-
exports.useDocumentTitle = useDocumentTitle.useDocumentTitle;
|
|
59
|
-
exports.useExpectSameValueReference = useExpectSameValueReference.useExpectSameValueReference;
|
|
60
|
-
exports.useForceRender = useForceRender.useForceRender;
|
|
61
|
-
exports.useId = useId.useId;
|
|
62
|
-
exports.useIsMounted = useIsMounted.useIsMounted;
|
|
63
|
-
exports.useObjectMemo = useObjectMemo.useObjectMemo;
|
|
64
|
-
exports.useOnElementClickOutsideCallback = useOnElementClickOutsideCallback.useOnElementClickOutsideCallback;
|
|
65
|
-
exports.useOnElementMouseEnterDelayedCallback = useOnElementMouseEnterDelayedCallback.useOnElementMouseEnterDelayedCallback;
|
|
66
|
-
exports.useOnElementResize = useOnElementResize.useOnElementResize;
|
|
67
|
-
exports.useOnWindowResize = useOnWindowResize.useOnWindowResize;
|
|
68
|
-
exports.usePreviousValue = usePreviousValue.usePreviousValue;
|
|
69
|
-
exports.getStateStorage = useStoredState.getStateStorage;
|
|
70
|
-
exports.localStateStorage = useStoredState.localStateStorage;
|
|
71
|
-
exports.nullStorage = useStoredState.nullStorage;
|
|
72
|
-
exports.sessionStateStorage = useStoredState.sessionStateStorage;
|
|
73
|
-
exports.urlStateStorage = useStoredState.urlStateStorage;
|
|
74
|
-
exports.useLocalStorageState = useStoredState.useLocalStorageState;
|
|
75
|
-
exports.useSessionStorageState = useStoredState.useSessionStorageState;
|
|
76
|
-
exports.useStoredState = useStoredState.useStoredState;
|
|
77
|
-
exports.useUpdatedRef = useUpdatedRef.useUpdatedRef;
|
|
78
|
-
exports.useWindowSize = useWindowSize.useWindowSize;
|
|
79
|
-
exports.emptyArray = emptyArray.emptyArray;
|
|
80
|
-
exports.emptyObject = emptyObject.emptyObject;
|
|
81
|
-
exports.identityFunction = identityFunction.identityFunction;
|
|
82
|
-
exports.noop = noop.noop;
|
|
83
|
-
exports.returnFalse = returnFalse.returnFalse;
|
|
84
|
-
exports.returnTrue = returnTrue.returnTrue;
|
|
85
|
-
exports.useReferentiallyStableCallback = useReferentiallyStableCallback.useReferentiallyStableCallback;
|
|
86
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { createRequiredContext } from "./src/context/createRequiredContext.js";
|
|
2
|
-
import { createContext } from "./src/context/createContext.js";
|
|
3
|
-
import { isNoopScopedConsole, noopLog, noopLogged, noopScopedConsole } from "./src/debug-context/Constants.js";
|
|
4
|
-
import { DebugChildren, ScopedConsoleContext, useScopedConsoleRef } from "./src/debug-context/Context.js";
|
|
5
|
-
import { unwrapRefValue } from "./src/hooks/unwrapRefValue.js";
|
|
6
|
-
import { useAbortController } from "./src/hooks/useAbortController.js";
|
|
7
|
-
import { useArrayMapMemo } from "./src/hooks/useArrayMapMemo.js";
|
|
8
|
-
import { useAutoHeightTextArea } from "./src/hooks/useAutoHeightTextArea.js";
|
|
9
|
-
import { getChildrenAsLabel, useChildrenAsLabel } from "./src/hooks/useChildrenAsLabel.js";
|
|
10
|
-
import { useComposeRef } from "./src/hooks/useComposeRef.js";
|
|
11
|
-
import { useConstantLengthInvariant } from "./src/hooks/useConstantLengthInvariant.js";
|
|
12
|
-
import { useConstantValueInvariant } from "./src/hooks/useConstantValueInvariant.js";
|
|
13
|
-
import { useDebounce } from "./src/hooks/useDebounce.js";
|
|
14
|
-
import { useDebounceCallback } from "./src/hooks/useDebounceCallback.js";
|
|
15
|
-
import { useDocumentTitle } from "./src/hooks/useDocumentTitle.js";
|
|
16
|
-
import { useExpectSameValueReference } from "./src/hooks/useExpectSameValueReference.js";
|
|
17
|
-
import { useForceRender } from "./src/hooks/useForceRender.js";
|
|
18
|
-
import { useId } from "./src/hooks/useId.js";
|
|
19
|
-
import { useIsMounted } from "./src/hooks/useIsMounted.js";
|
|
20
|
-
import { useObjectMemo } from "./src/hooks/useObjectMemo.js";
|
|
21
|
-
import { useOnElementClickOutsideCallback } from "./src/hooks/useOnElementClickOutsideCallback.js";
|
|
22
|
-
import { useOnElementMouseEnterDelayedCallback } from "./src/hooks/useOnElementMouseEnterDelayedCallback.js";
|
|
23
|
-
import { useOnElementResize } from "./src/hooks/useOnElementResize.js";
|
|
24
|
-
import { useOnWindowResize } from "./src/hooks/useOnWindowResize.js";
|
|
25
|
-
import { usePreviousValue } from "./src/hooks/usePreviousValue.js";
|
|
26
|
-
import { getStateStorage, localStateStorage, nullStorage, sessionStateStorage, urlStateStorage, useLocalStorageState, useSessionStorageState, useStoredState } from "./src/hooks/useStoredState.js";
|
|
27
|
-
import { useUpdatedRef } from "./src/hooks/useUpdatedRef.js";
|
|
28
|
-
import { useWindowSize } from "./src/hooks/useWindowSize.js";
|
|
29
|
-
import { emptyArray } from "./src/referentiallyStable/emptyArray.js";
|
|
30
|
-
import { emptyObject } from "./src/referentiallyStable/emptyObject.js";
|
|
31
|
-
import { identityFunction } from "./src/referentiallyStable/identityFunction.js";
|
|
32
|
-
import { noop } from "./src/referentiallyStable/noop.js";
|
|
33
|
-
import { returnFalse } from "./src/referentiallyStable/returnFalse.js";
|
|
34
|
-
import { returnTrue } from "./src/referentiallyStable/returnTrue.js";
|
|
35
|
-
import { useReferentiallyStableCallback } from "./src/referentiallyStable/useReferentiallyStableCallback.js";
|
|
36
|
-
export {
|
|
37
|
-
DebugChildren,
|
|
38
|
-
ScopedConsoleContext,
|
|
39
|
-
createContext,
|
|
40
|
-
createRequiredContext,
|
|
41
|
-
emptyArray,
|
|
42
|
-
emptyObject,
|
|
43
|
-
getChildrenAsLabel,
|
|
44
|
-
getStateStorage,
|
|
45
|
-
identityFunction,
|
|
46
|
-
isNoopScopedConsole,
|
|
47
|
-
localStateStorage,
|
|
48
|
-
noop,
|
|
49
|
-
noopLog,
|
|
50
|
-
noopLogged,
|
|
51
|
-
noopScopedConsole,
|
|
52
|
-
nullStorage,
|
|
53
|
-
returnFalse,
|
|
54
|
-
returnTrue,
|
|
55
|
-
sessionStateStorage,
|
|
56
|
-
unwrapRefValue,
|
|
57
|
-
urlStateStorage,
|
|
58
|
-
useAbortController,
|
|
59
|
-
useArrayMapMemo,
|
|
60
|
-
useAutoHeightTextArea,
|
|
61
|
-
useChildrenAsLabel,
|
|
62
|
-
useComposeRef,
|
|
63
|
-
useConstantLengthInvariant,
|
|
64
|
-
useConstantValueInvariant,
|
|
65
|
-
useDebounce,
|
|
66
|
-
useDebounceCallback,
|
|
67
|
-
useDocumentTitle,
|
|
68
|
-
useExpectSameValueReference,
|
|
69
|
-
useForceRender,
|
|
70
|
-
useId,
|
|
71
|
-
useIsMounted,
|
|
72
|
-
useLocalStorageState,
|
|
73
|
-
useObjectMemo,
|
|
74
|
-
useOnElementClickOutsideCallback,
|
|
75
|
-
useOnElementMouseEnterDelayedCallback,
|
|
76
|
-
useOnElementResize,
|
|
77
|
-
useOnWindowResize,
|
|
78
|
-
usePreviousValue,
|
|
79
|
-
useReferentiallyStableCallback,
|
|
80
|
-
useScopedConsoleRef,
|
|
81
|
-
useSessionStorageState,
|
|
82
|
-
useStoredState,
|
|
83
|
-
useUpdatedRef,
|
|
84
|
-
useWindowSize
|
|
85
|
-
};
|
|
86
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
function createContext(name, initialValue) {
|
|
5
|
-
const OptionalContext = React.createContext(initialValue);
|
|
6
|
-
OptionalContext.displayName = name;
|
|
7
|
-
return [OptionalContext, () => React.useContext(OptionalContext), OptionalContext.Provider];
|
|
8
|
-
}
|
|
9
|
-
exports.createContext = createContext;
|
|
10
|
-
//# sourceMappingURL=createContext.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createContext.cjs","sources":["../../../../../packages/react-utils/src/context/createContext.ts"],"sourcesContent":["import type { Context, Provider } from 'react'\nimport { createContext as baseCreateContext, useContext } from 'react'\n\nexport function createContext<T>(name: string, initialValue: T): [Context<T>, () => T, Provider<T>] {\n\tconst OptionalContext = baseCreateContext<T>(initialValue)\n\tOptionalContext.displayName = name\n\n\treturn [OptionalContext, () => useContext(OptionalContext), OptionalContext.Provider]\n}\n"],"names":["baseCreateContext","useContext"],"mappings":";;;AAGgB,SAAA,cAAiB,MAAc,cAAqD;AAC7F,QAAA,kBAAkBA,oBAAqB,YAAY;AACzD,kBAAgB,cAAc;AAE9B,SAAO,CAAC,iBAAiB,MAAMC,MAAAA,WAAW,eAAe,GAAG,gBAAgB,QAAQ;AACrF;;"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { createContext as createContext$1, useContext } from "react";
|
|
2
|
-
function createContext(name, initialValue) {
|
|
3
|
-
const OptionalContext = createContext$1(initialValue);
|
|
4
|
-
OptionalContext.displayName = name;
|
|
5
|
-
return [OptionalContext, () => useContext(OptionalContext), OptionalContext.Provider];
|
|
6
|
-
}
|
|
7
|
-
export {
|
|
8
|
-
createContext
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=createContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createContext.js","sources":["../../../../../packages/react-utils/src/context/createContext.ts"],"sourcesContent":["import type { Context, Provider } from 'react'\nimport { createContext as baseCreateContext, useContext } from 'react'\n\nexport function createContext<T>(name: string, initialValue: T): [Context<T>, () => T, Provider<T>] {\n\tconst OptionalContext = baseCreateContext<T>(initialValue)\n\tOptionalContext.displayName = name\n\n\treturn [OptionalContext, () => useContext(OptionalContext), OptionalContext.Provider]\n}\n"],"names":["baseCreateContext"],"mappings":";AAGgB,SAAA,cAAiB,MAAc,cAAqD;AAC7F,QAAA,kBAAkBA,gBAAqB,YAAY;AACzD,kBAAgB,cAAc;AAE9B,SAAO,CAAC,iBAAiB,MAAM,WAAW,eAAe,GAAG,gBAAgB,QAAQ;AACrF;"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const EmptyContextSymbol = Symbol("EmptyContextSymbol");
|
|
5
|
-
function createRequiredContext(displayName) {
|
|
6
|
-
const RequiredContext = React.createContext(EmptyContextSymbol);
|
|
7
|
-
RequiredContext.displayName = displayName;
|
|
8
|
-
const useRequiredContext = () => {
|
|
9
|
-
const context = React.useContext(RequiredContext);
|
|
10
|
-
if (context === EmptyContextSymbol) {
|
|
11
|
-
throw new Error(`use${displayName} must be used within a ${displayName} provider`);
|
|
12
|
-
}
|
|
13
|
-
return context;
|
|
14
|
-
};
|
|
15
|
-
return [RequiredContext, useRequiredContext, RequiredContext.Provider];
|
|
16
|
-
}
|
|
17
|
-
exports.createRequiredContext = createRequiredContext;
|
|
18
|
-
//# sourceMappingURL=createRequiredContext.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createRequiredContext.cjs","sources":["../../../../../packages/react-utils/src/context/createRequiredContext.ts"],"sourcesContent":["import type { Context, Provider } from 'react'\nimport { createContext, useContext } from 'react'\n\nconst EmptyContextSymbol = Symbol('EmptyContextSymbol')\n\nexport function createRequiredContext<T>(displayName: string): [Context<T>, () => T, Provider<T>] {\n\tconst RequiredContext = createContext<T>(EmptyContextSymbol as T)\n\tRequiredContext.displayName = displayName\n\n\tconst useRequiredContext = (): T => {\n\t\tconst context = useContext(RequiredContext)\n\n\t\tif (context === EmptyContextSymbol) {\n\t\t\tthrow new Error(`use${displayName} must be used within a ${displayName} provider`)\n\t\t}\n\n\t\treturn context\n\t}\n\n\treturn [RequiredContext, useRequiredContext, RequiredContext.Provider]\n}\n"],"names":["createContext","useContext"],"mappings":";;;AAGA,MAAM,qBAAqB,OAAO,oBAAoB;AAE/C,SAAS,sBAAyB,aAAyD;AAC3F,QAAA,kBAAkBA,oBAAiB,kBAAuB;AAChE,kBAAgB,cAAc;AAE9B,QAAM,qBAAqB,MAAS;AAC7B,UAAA,UAAUC,iBAAW,eAAe;AAE1C,QAAI,YAAY,oBAAoB;AACnC,YAAM,IAAI,MAAM,MAAM,WAAW,0BAA0B,WAAW,WAAW;AAAA,IAAA;AAG3E,WAAA;AAAA,EACR;AAEA,SAAO,CAAC,iBAAiB,oBAAoB,gBAAgB,QAAQ;AACtE;;"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext } from "react";
|
|
2
|
-
const EmptyContextSymbol = Symbol("EmptyContextSymbol");
|
|
3
|
-
function createRequiredContext(displayName) {
|
|
4
|
-
const RequiredContext = createContext(EmptyContextSymbol);
|
|
5
|
-
RequiredContext.displayName = displayName;
|
|
6
|
-
const useRequiredContext = () => {
|
|
7
|
-
const context = useContext(RequiredContext);
|
|
8
|
-
if (context === EmptyContextSymbol) {
|
|
9
|
-
throw new Error(`use${displayName} must be used within a ${displayName} provider`);
|
|
10
|
-
}
|
|
11
|
-
return context;
|
|
12
|
-
};
|
|
13
|
-
return [RequiredContext, useRequiredContext, RequiredContext.Provider];
|
|
14
|
-
}
|
|
15
|
-
export {
|
|
16
|
-
createRequiredContext
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=createRequiredContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createRequiredContext.js","sources":["../../../../../packages/react-utils/src/context/createRequiredContext.ts"],"sourcesContent":["import type { Context, Provider } from 'react'\nimport { createContext, useContext } from 'react'\n\nconst EmptyContextSymbol = Symbol('EmptyContextSymbol')\n\nexport function createRequiredContext<T>(displayName: string): [Context<T>, () => T, Provider<T>] {\n\tconst RequiredContext = createContext<T>(EmptyContextSymbol as T)\n\tRequiredContext.displayName = displayName\n\n\tconst useRequiredContext = (): T => {\n\t\tconst context = useContext(RequiredContext)\n\n\t\tif (context === EmptyContextSymbol) {\n\t\t\tthrow new Error(`use${displayName} must be used within a ${displayName} provider`)\n\t\t}\n\n\t\treturn context\n\t}\n\n\treturn [RequiredContext, useRequiredContext, RequiredContext.Provider]\n}\n"],"names":[],"mappings":";AAGA,MAAM,qBAAqB,OAAO,oBAAoB;AAE/C,SAAS,sBAAyB,aAAyD;AAC3F,QAAA,kBAAkB,cAAiB,kBAAuB;AAChE,kBAAgB,cAAc;AAE9B,QAAM,qBAAqB,MAAS;AAC7B,UAAA,UAAU,WAAW,eAAe;AAE1C,QAAI,YAAY,oBAAoB;AACnC,YAAM,IAAI,MAAM,MAAM,WAAW,0BAA0B,WAAW,WAAW;AAAA,IAAA;AAG3E,WAAA;AAAA,EACR;AAEA,SAAO,CAAC,iBAAiB,oBAAoB,gBAAgB,QAAQ;AACtE;"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
function noopLog(...parameters) {
|
|
4
|
-
}
|
|
5
|
-
function noopLogged(message, value) {
|
|
6
|
-
return value;
|
|
7
|
-
}
|
|
8
|
-
const noopScopedConsole = Object.freeze({
|
|
9
|
-
log: noopLog,
|
|
10
|
-
logged: noopLogged,
|
|
11
|
-
warn: noopLog,
|
|
12
|
-
warned: noopLogged,
|
|
13
|
-
error: noopLog,
|
|
14
|
-
errored: noopLogged,
|
|
15
|
-
trace: noopLog,
|
|
16
|
-
traced: noopLogged
|
|
17
|
-
});
|
|
18
|
-
function isNoopScopedConsole(value) {
|
|
19
|
-
return value === noopScopedConsole;
|
|
20
|
-
}
|
|
21
|
-
exports.isNoopScopedConsole = isNoopScopedConsole;
|
|
22
|
-
exports.noopLog = noopLog;
|
|
23
|
-
exports.noopLogged = noopLogged;
|
|
24
|
-
exports.noopScopedConsole = noopScopedConsole;
|
|
25
|
-
//# sourceMappingURL=Constants.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Constants.cjs","sources":["../../../../../packages/react-utils/src/debug-context/Constants.ts"],"sourcesContent":["import type { ScopedConsoleContextType } from './Types'\n\nexport function noopLog(...parameters: any[]) { }\n\nexport function noopLogged<T>(message: string, value: T): T {\n\treturn value\n}\n\nexport const noopScopedConsole: ScopedConsoleContextType = Object.freeze({\n\tlog: noopLog,\n\tlogged: noopLogged,\n\twarn: noopLog,\n\twarned: noopLogged,\n\terror: noopLog,\n\terrored: noopLogged,\n\ttrace: noopLog,\n\ttraced: noopLogged,\n})\n\nexport function isNoopScopedConsole(value: unknown): boolean {\n\treturn value === noopScopedConsole\n}\n"],"names":[],"mappings":";;AAEO,SAAS,WAAW,YAAmB;AAAE;AAEhC,SAAA,WAAc,SAAiB,OAAa;AACpD,SAAA;AACR;AAEa,MAAA,oBAA8C,OAAO,OAAO;AAAA,EACxE,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AACT,CAAC;AAEM,SAAS,oBAAoB,OAAyB;AAC5D,SAAO,UAAU;AAClB;;;;;"}
|