@contember/react-utils 1.3.0-rc.3 → 2.0.0-alpha.10
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/api-extractor.json +3 -0
- package/dist/development/index.cjs +35 -72
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +35 -72
- package/dist/development/index.js.map +1 -1
- package/dist/development/{context → src/context}/createContext.cjs +3 -3
- package/dist/development/src/context/createContext.cjs.map +1 -0
- package/dist/development/src/context/createContext.js.map +1 -0
- package/dist/{production → development/src}/context/createRequiredContext.cjs +3 -3
- package/dist/development/src/context/createRequiredContext.cjs.map +1 -0
- package/dist/development/src/context/createRequiredContext.js.map +1 -0
- package/dist/development/src/debug-context/Constants.cjs.map +1 -0
- package/dist/development/src/debug-context/Constants.js.map +1 -0
- package/dist/development/{debug-context → src/debug-context}/Context.cjs +8 -8
- package/dist/development/src/debug-context/Context.cjs.map +1 -0
- package/dist/development/{debug-context → src/debug-context}/Context.js +1 -1
- package/dist/development/src/debug-context/Context.js.map +1 -0
- package/dist/development/src/hooks/unwrapRefValue.cjs.map +1 -0
- package/dist/development/src/hooks/unwrapRefValue.js.map +1 -0
- package/dist/development/{hooks → src/hooks}/useAbortController.cjs +4 -4
- package/dist/development/src/hooks/useAbortController.cjs.map +1 -0
- package/dist/development/src/hooks/useAbortController.js.map +1 -0
- package/dist/development/{hooks → src/hooks}/useArrayMapMemo.cjs +3 -3
- package/dist/development/src/hooks/useArrayMapMemo.cjs.map +1 -0
- package/dist/development/src/hooks/useArrayMapMemo.js.map +1 -0
- package/dist/development/{hooks → src/hooks}/useAutoHeightTextArea.cjs +3 -3
- package/dist/development/src/hooks/useAutoHeightTextArea.cjs.map +1 -0
- package/dist/development/src/hooks/useAutoHeightTextArea.js.map +1 -0
- package/dist/development/{hooks → src/hooks}/useChildrenAsLabel.cjs +4 -5
- package/dist/development/src/hooks/useChildrenAsLabel.cjs.map +1 -0
- package/dist/development/{hooks → src/hooks}/useChildrenAsLabel.js +1 -2
- package/dist/development/src/hooks/useChildrenAsLabel.js.map +1 -0
- package/dist/development/{hooks → src/hooks}/useComposeRef.cjs +3 -3
- package/dist/development/src/hooks/useComposeRef.cjs.map +1 -0
- package/dist/development/src/hooks/useComposeRef.js.map +1 -0
- package/dist/development/src/hooks/useConstantLengthInvariant.cjs.map +1 -0
- package/dist/development/src/hooks/useConstantLengthInvariant.js.map +1 -0
- package/dist/development/src/hooks/useConstantValueInvariant.cjs.map +1 -0
- package/dist/development/src/hooks/useConstantValueInvariant.js.map +1 -0
- package/dist/development/{hooks → src/hooks}/useDebounce.cjs +3 -3
- package/dist/development/src/hooks/useDebounce.cjs.map +1 -0
- package/dist/development/src/hooks/useDebounce.js.map +1 -0
- package/dist/development/{hooks → src/hooks}/useDebounceCallback.cjs +5 -5
- package/dist/development/src/hooks/useDebounceCallback.cjs.map +1 -0
- package/dist/development/src/hooks/useDebounceCallback.js.map +1 -0
- package/dist/development/{hooks → src/hooks}/useDocumentTitle.cjs +3 -3
- package/dist/development/src/hooks/useDocumentTitle.cjs.map +1 -0
- package/dist/development/src/hooks/useDocumentTitle.js.map +1 -0
- package/dist/development/{hooks → src/hooks}/useExpectSameValueReference.cjs +4 -4
- package/dist/development/src/hooks/useExpectSameValueReference.cjs.map +1 -0
- package/dist/development/{hooks → src/hooks}/useExpectSameValueReference.js +2 -2
- package/dist/development/src/hooks/useExpectSameValueReference.js.map +1 -0
- package/dist/development/{hooks → src/hooks}/useForceRender.cjs +2 -2
- package/dist/development/src/hooks/useForceRender.cjs.map +1 -0
- package/dist/development/src/hooks/useForceRender.js.map +1 -0
- package/dist/{production → development/src}/hooks/useId.cjs +2 -2
- package/dist/development/src/hooks/useId.cjs.map +1 -0
- package/dist/development/src/hooks/useId.js.map +1 -0
- package/dist/development/{hooks → src/hooks}/useIsMounted.cjs +3 -3
- package/dist/development/src/hooks/useIsMounted.cjs.map +1 -0
- package/dist/development/src/hooks/useIsMounted.js.map +1 -0
- package/dist/{production → development/src}/hooks/useObjectMemo.cjs +2 -2
- package/dist/development/src/hooks/useObjectMemo.cjs.map +1 -0
- package/dist/development/src/hooks/useObjectMemo.js.map +1 -0
- package/dist/{production → development/src}/hooks/useOnElementClickOutsideCallback.cjs +2 -2
- package/dist/development/src/hooks/useOnElementClickOutsideCallback.cjs.map +1 -0
- package/dist/development/src/hooks/useOnElementClickOutsideCallback.js.map +1 -0
- package/dist/development/{hooks → src/hooks}/useOnElementMouseEnterDelayedCallback.cjs +2 -2
- package/dist/development/src/hooks/useOnElementMouseEnterDelayedCallback.cjs.map +1 -0
- package/dist/development/src/hooks/useOnElementMouseEnterDelayedCallback.js.map +1 -0
- package/dist/{production → development/src}/hooks/useOnElementResize.cjs +5 -5
- package/dist/development/src/hooks/useOnElementResize.cjs.map +1 -0
- package/dist/development/{hooks → src/hooks}/useOnElementResize.js +1 -1
- package/dist/development/src/hooks/useOnElementResize.js.map +1 -0
- package/dist/{production → development/src}/hooks/useOnWindowResize.cjs +5 -5
- package/dist/development/src/hooks/useOnWindowResize.cjs.map +1 -0
- package/dist/development/{hooks → src/hooks}/useOnWindowResize.js +1 -1
- package/dist/development/src/hooks/useOnWindowResize.js.map +1 -0
- package/dist/development/{hooks → src/hooks}/usePreviousValue.cjs +3 -3
- package/dist/development/src/hooks/usePreviousValue.cjs.map +1 -0
- package/dist/development/src/hooks/usePreviousValue.js.map +1 -0
- package/dist/{production → development/src}/hooks/useStoredState.cjs +4 -4
- package/dist/development/src/hooks/useStoredState.cjs.map +1 -0
- package/dist/development/src/hooks/useStoredState.js.map +1 -0
- package/dist/development/{hooks → src/hooks}/useUpdatedRef.cjs +2 -2
- package/dist/development/src/hooks/useUpdatedRef.cjs.map +1 -0
- package/dist/development/src/hooks/useUpdatedRef.js.map +1 -0
- package/dist/development/{hooks → src/hooks}/useWindowSize.cjs +4 -4
- package/dist/development/src/hooks/useWindowSize.cjs.map +1 -0
- package/dist/development/src/hooks/useWindowSize.js.map +1 -0
- package/dist/development/src/referentiallyStable/emptyArray.cjs.map +1 -0
- package/dist/development/src/referentiallyStable/emptyArray.js.map +1 -0
- package/dist/development/src/referentiallyStable/emptyObject.cjs.map +1 -0
- package/dist/development/src/referentiallyStable/emptyObject.js.map +1 -0
- package/dist/development/src/referentiallyStable/identityFunction.cjs.map +1 -0
- package/dist/development/src/referentiallyStable/identityFunction.js.map +1 -0
- package/dist/development/src/referentiallyStable/noop.cjs.map +1 -0
- package/dist/development/src/referentiallyStable/noop.js.map +1 -0
- package/dist/development/src/referentiallyStable/returnFalse.cjs.map +1 -0
- package/dist/development/src/referentiallyStable/returnFalse.js.map +1 -0
- package/dist/development/src/referentiallyStable/returnTrue.cjs.map +1 -0
- package/dist/development/src/referentiallyStable/returnTrue.js.map +1 -0
- package/dist/{production → development/src}/referentiallyStable/useReferentiallyStableCallback.cjs +3 -3
- package/dist/development/src/referentiallyStable/useReferentiallyStableCallback.cjs.map +1 -0
- package/dist/development/src/referentiallyStable/useReferentiallyStableCallback.js.map +1 -0
- package/dist/production/index.cjs +35 -72
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.js +35 -72
- package/dist/production/index.js.map +1 -1
- package/dist/production/{context → src/context}/createContext.cjs +3 -3
- package/dist/production/src/context/createContext.cjs.map +1 -0
- package/dist/production/src/context/createContext.js.map +1 -0
- package/dist/{development → production/src}/context/createRequiredContext.cjs +3 -3
- package/dist/production/src/context/createRequiredContext.cjs.map +1 -0
- package/dist/production/src/context/createRequiredContext.js.map +1 -0
- package/dist/production/src/debug-context/Constants.cjs.map +1 -0
- package/dist/production/src/debug-context/Constants.js.map +1 -0
- package/dist/production/{debug-context → src/debug-context}/Context.cjs +7 -7
- package/dist/production/src/debug-context/Context.cjs.map +1 -0
- package/dist/production/src/debug-context/Context.js.map +1 -0
- package/dist/production/src/hooks/unwrapRefValue.cjs.map +1 -0
- package/dist/production/src/hooks/unwrapRefValue.js.map +1 -0
- package/dist/production/{hooks → src/hooks}/useAbortController.cjs +4 -4
- package/dist/production/src/hooks/useAbortController.cjs.map +1 -0
- package/dist/production/src/hooks/useAbortController.js.map +1 -0
- package/dist/production/{hooks → src/hooks}/useArrayMapMemo.cjs +3 -3
- package/dist/production/src/hooks/useArrayMapMemo.cjs.map +1 -0
- package/dist/production/src/hooks/useArrayMapMemo.js.map +1 -0
- package/dist/production/{hooks → src/hooks}/useAutoHeightTextArea.cjs +3 -3
- package/dist/production/src/hooks/useAutoHeightTextArea.cjs.map +1 -0
- package/dist/production/src/hooks/useAutoHeightTextArea.js.map +1 -0
- package/dist/production/{hooks → src/hooks}/useChildrenAsLabel.cjs +5 -7
- package/dist/production/src/hooks/useChildrenAsLabel.cjs.map +1 -0
- package/dist/production/{hooks → src/hooks}/useChildrenAsLabel.js +2 -4
- package/dist/production/src/hooks/useChildrenAsLabel.js.map +1 -0
- package/dist/production/{hooks → src/hooks}/useComposeRef.cjs +3 -3
- package/dist/production/src/hooks/useComposeRef.cjs.map +1 -0
- package/dist/production/src/hooks/useComposeRef.js.map +1 -0
- package/dist/production/src/hooks/useConstantLengthInvariant.cjs.map +1 -0
- package/dist/production/src/hooks/useConstantLengthInvariant.js.map +1 -0
- package/dist/production/src/hooks/useConstantValueInvariant.cjs.map +1 -0
- package/dist/production/src/hooks/useConstantValueInvariant.js.map +1 -0
- package/dist/production/{hooks → src/hooks}/useDebounce.cjs +3 -3
- package/dist/production/src/hooks/useDebounce.cjs.map +1 -0
- package/dist/production/src/hooks/useDebounce.js.map +1 -0
- package/dist/production/{hooks → src/hooks}/useDebounceCallback.cjs +5 -5
- package/dist/production/src/hooks/useDebounceCallback.cjs.map +1 -0
- package/dist/production/src/hooks/useDebounceCallback.js.map +1 -0
- package/dist/production/{hooks → src/hooks}/useDocumentTitle.cjs +3 -3
- package/dist/production/src/hooks/useDocumentTitle.cjs.map +1 -0
- package/dist/production/src/hooks/useDocumentTitle.js.map +1 -0
- package/dist/production/{hooks → src/hooks}/useExpectSameValueReference.cjs +4 -4
- package/dist/production/src/hooks/useExpectSameValueReference.cjs.map +1 -0
- package/dist/production/{hooks → src/hooks}/useExpectSameValueReference.js +2 -2
- package/dist/production/src/hooks/useExpectSameValueReference.js.map +1 -0
- package/dist/production/{hooks → src/hooks}/useForceRender.cjs +2 -2
- package/dist/production/src/hooks/useForceRender.cjs.map +1 -0
- package/dist/production/src/hooks/useForceRender.js.map +1 -0
- package/dist/{development → production/src}/hooks/useId.cjs +2 -2
- package/dist/production/src/hooks/useId.cjs.map +1 -0
- package/dist/production/src/hooks/useId.js.map +1 -0
- package/dist/production/{hooks → src/hooks}/useIsMounted.cjs +3 -3
- package/dist/production/src/hooks/useIsMounted.cjs.map +1 -0
- package/dist/production/src/hooks/useIsMounted.js.map +1 -0
- package/dist/{development → production/src}/hooks/useObjectMemo.cjs +2 -2
- package/dist/production/src/hooks/useObjectMemo.cjs.map +1 -0
- package/dist/production/src/hooks/useObjectMemo.js.map +1 -0
- package/dist/{development → production/src}/hooks/useOnElementClickOutsideCallback.cjs +2 -2
- package/dist/production/src/hooks/useOnElementClickOutsideCallback.cjs.map +1 -0
- package/dist/production/src/hooks/useOnElementClickOutsideCallback.js.map +1 -0
- package/dist/production/{hooks → src/hooks}/useOnElementMouseEnterDelayedCallback.cjs +2 -2
- package/dist/production/src/hooks/useOnElementMouseEnterDelayedCallback.cjs.map +1 -0
- package/dist/production/src/hooks/useOnElementMouseEnterDelayedCallback.js.map +1 -0
- package/dist/{development → production/src}/hooks/useOnElementResize.cjs +5 -5
- package/dist/production/src/hooks/useOnElementResize.cjs.map +1 -0
- package/dist/production/{hooks → src/hooks}/useOnElementResize.js +1 -1
- package/dist/production/src/hooks/useOnElementResize.js.map +1 -0
- package/dist/{development → production/src}/hooks/useOnWindowResize.cjs +5 -5
- package/dist/production/src/hooks/useOnWindowResize.cjs.map +1 -0
- package/dist/production/{hooks → src/hooks}/useOnWindowResize.js +1 -1
- package/dist/production/src/hooks/useOnWindowResize.js.map +1 -0
- package/dist/production/{hooks → src/hooks}/usePreviousValue.cjs +3 -3
- package/dist/production/src/hooks/usePreviousValue.cjs.map +1 -0
- package/dist/production/src/hooks/usePreviousValue.js.map +1 -0
- package/dist/{development → production/src}/hooks/useStoredState.cjs +4 -4
- package/dist/production/src/hooks/useStoredState.cjs.map +1 -0
- package/dist/production/src/hooks/useStoredState.js.map +1 -0
- package/dist/production/{hooks → src/hooks}/useUpdatedRef.cjs +2 -2
- package/dist/production/src/hooks/useUpdatedRef.cjs.map +1 -0
- package/dist/production/src/hooks/useUpdatedRef.js.map +1 -0
- package/dist/production/{hooks → src/hooks}/useWindowSize.cjs +4 -4
- package/dist/production/src/hooks/useWindowSize.cjs.map +1 -0
- package/dist/production/src/hooks/useWindowSize.js.map +1 -0
- package/dist/production/src/referentiallyStable/emptyArray.cjs.map +1 -0
- package/dist/production/src/referentiallyStable/emptyArray.js.map +1 -0
- package/dist/production/src/referentiallyStable/emptyObject.cjs.map +1 -0
- package/dist/production/src/referentiallyStable/emptyObject.js.map +1 -0
- package/dist/production/src/referentiallyStable/identityFunction.cjs.map +1 -0
- package/dist/production/src/referentiallyStable/identityFunction.js.map +1 -0
- package/dist/production/src/referentiallyStable/noop.cjs.map +1 -0
- package/dist/production/src/referentiallyStable/noop.js.map +1 -0
- package/dist/production/src/referentiallyStable/returnFalse.cjs.map +1 -0
- package/dist/production/src/referentiallyStable/returnFalse.js.map +1 -0
- package/dist/production/src/referentiallyStable/returnTrue.cjs.map +1 -0
- package/dist/production/src/referentiallyStable/returnTrue.js.map +1 -0
- package/dist/{development → production/src}/referentiallyStable/useReferentiallyStableCallback.cjs +3 -3
- package/dist/production/src/referentiallyStable/useReferentiallyStableCallback.cjs.map +1 -0
- package/dist/production/src/referentiallyStable/useReferentiallyStableCallback.js.map +1 -0
- package/dist/types/debug-context/Types.d.ts.map +1 -1
- package/dist/types/hooks/index.d.ts +0 -10
- package/dist/types/hooks/index.d.ts.map +1 -1
- package/dist/types/hooks/useArrayMapMemo.d.ts.map +1 -1
- package/dist/types/hooks/useAutoHeightTextArea.d.ts.map +1 -1
- package/dist/types/hooks/useComposeRef.d.ts.map +1 -1
- package/dist/types/hooks/useConstantLengthInvariant.d.ts.map +1 -1
- package/dist/types/hooks/useConstantValueInvariant.d.ts.map +1 -1
- package/dist/types/hooks/useDebounce.d.ts.map +1 -1
- package/dist/types/hooks/useObjectMemo.d.ts.map +1 -1
- package/dist/types/hooks/usePreviousValue.d.ts.map +1 -1
- package/dist/types/hooks/useStoredState.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/referentiallyStable/emptyArray.d.ts.map +1 -1
- package/dist/types/referentiallyStable/identityFunction.d.ts.map +1 -1
- package/dist/types/referentiallyStable/useReferentiallyStableCallback.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/types/types/PropsWithRequiredChildren.d.ts.map +1 -1
- package/package.json +5 -13
- package/src/context/createContext.ts +3 -3
- package/src/context/createRequiredContext.ts +10 -10
- package/src/debug-context/Types.ts +8 -8
- package/src/hooks/index.ts +0 -10
- package/src/hooks/useComposeRef.ts +1 -1
- package/src/hooks/useExpectSameValueReference.ts +3 -3
- package/src/hooks/useOnElementResize.ts +1 -1
- package/src/hooks/useOnWindowResize.ts +1 -1
- package/src/hooks/useStoredState.ts +2 -2
- package/src/hooks/useWindowSize.ts +12 -12
- package/src/index.ts +0 -1
- package/src/tsconfig.json +5 -2
- package/src/types/PropsWithRequiredChildren.ts +1 -1
- package/tests/hooks/useChildrenAsLabel.test.tsx +96 -0
- package/tests/hooks/useId.test.ts +13 -0
- package/tests/tsconfig.json +10 -0
- package/tsconfig.json +8 -0
- package/tsdoc.json +6 -0
- package/dist/development/context/createContext.cjs.map +0 -1
- package/dist/development/context/createContext.js.map +0 -1
- package/dist/development/context/createRequiredContext.cjs.map +0 -1
- package/dist/development/context/createRequiredContext.js.map +0 -1
- package/dist/development/debug-context/Constants.cjs.map +0 -1
- package/dist/development/debug-context/Constants.js.map +0 -1
- package/dist/development/debug-context/Context.cjs.map +0 -1
- package/dist/development/debug-context/Context.js.map +0 -1
- package/dist/development/hooks/unwrapRefValue.cjs.map +0 -1
- package/dist/development/hooks/unwrapRefValue.js.map +0 -1
- package/dist/development/hooks/useAbortController.cjs.map +0 -1
- package/dist/development/hooks/useAbortController.js.map +0 -1
- package/dist/development/hooks/useAddClassNameDuringResize.cjs +0 -32
- package/dist/development/hooks/useAddClassNameDuringResize.cjs.map +0 -1
- package/dist/development/hooks/useAddClassNameDuringResize.js +0 -32
- package/dist/development/hooks/useAddClassNameDuringResize.js.map +0 -1
- package/dist/development/hooks/useArrayMapMemo.cjs.map +0 -1
- package/dist/development/hooks/useArrayMapMemo.js.map +0 -1
- package/dist/development/hooks/useAutoHeightTextArea.cjs.map +0 -1
- package/dist/development/hooks/useAutoHeightTextArea.js.map +0 -1
- package/dist/development/hooks/useChildrenAsLabel.cjs.map +0 -1
- package/dist/development/hooks/useChildrenAsLabel.js.map +0 -1
- package/dist/development/hooks/useCloseOnClickOutside.cjs +0 -25
- package/dist/development/hooks/useCloseOnClickOutside.cjs.map +0 -1
- package/dist/development/hooks/useCloseOnClickOutside.js +0 -25
- package/dist/development/hooks/useCloseOnClickOutside.js.map +0 -1
- package/dist/development/hooks/useCloseOnEscape.cjs +0 -20
- package/dist/development/hooks/useCloseOnEscape.cjs.map +0 -1
- package/dist/development/hooks/useCloseOnEscape.js +0 -20
- package/dist/development/hooks/useCloseOnEscape.js.map +0 -1
- package/dist/development/hooks/useComposeRef.cjs.map +0 -1
- package/dist/development/hooks/useComposeRef.js.map +0 -1
- package/dist/development/hooks/useConstantLengthInvariant.cjs.map +0 -1
- package/dist/development/hooks/useConstantLengthInvariant.js.map +0 -1
- package/dist/development/hooks/useConstantValueInvariant.cjs.map +0 -1
- package/dist/development/hooks/useConstantValueInvariant.js.map +0 -1
- package/dist/development/hooks/useContainerWidth.cjs +0 -14
- package/dist/development/hooks/useContainerWidth.cjs.map +0 -1
- package/dist/development/hooks/useContainerWidth.js +0 -14
- package/dist/development/hooks/useContainerWidth.js.map +0 -1
- package/dist/development/hooks/useDebounce.cjs.map +0 -1
- package/dist/development/hooks/useDebounce.js.map +0 -1
- package/dist/development/hooks/useDebounceCallback.cjs.map +0 -1
- package/dist/development/hooks/useDebounceCallback.js.map +0 -1
- package/dist/development/hooks/useDocumentTitle.cjs.map +0 -1
- package/dist/development/hooks/useDocumentTitle.js.map +0 -1
- package/dist/development/hooks/useElementSize.cjs +0 -37
- package/dist/development/hooks/useElementSize.cjs.map +0 -1
- package/dist/development/hooks/useElementSize.js +0 -37
- package/dist/development/hooks/useElementSize.js.map +0 -1
- package/dist/development/hooks/useElementTopOffset.cjs +0 -29
- package/dist/development/hooks/useElementTopOffset.cjs.map +0 -1
- package/dist/development/hooks/useElementTopOffset.js +0 -29
- package/dist/development/hooks/useElementTopOffset.js.map +0 -1
- package/dist/development/hooks/useEventHandler.cjs +0 -19
- package/dist/development/hooks/useEventHandler.cjs.map +0 -1
- package/dist/development/hooks/useEventHandler.js +0 -19
- package/dist/development/hooks/useEventHandler.js.map +0 -1
- package/dist/development/hooks/useExpectSameValueReference.cjs.map +0 -1
- package/dist/development/hooks/useExpectSameValueReference.js.map +0 -1
- package/dist/development/hooks/useForceRender.cjs.map +0 -1
- package/dist/development/hooks/useForceRender.js.map +0 -1
- package/dist/development/hooks/useId.cjs.map +0 -1
- package/dist/development/hooks/useId.js.map +0 -1
- package/dist/development/hooks/useIsMounted.cjs.map +0 -1
- package/dist/development/hooks/useIsMounted.js.map +0 -1
- package/dist/development/hooks/useObjectMemo.cjs.map +0 -1
- package/dist/development/hooks/useObjectMemo.js.map +0 -1
- package/dist/development/hooks/useOnElementClickOutsideCallback.cjs.map +0 -1
- package/dist/development/hooks/useOnElementClickOutsideCallback.js.map +0 -1
- package/dist/development/hooks/useOnElementMouseEnterDelayedCallback.cjs.map +0 -1
- package/dist/development/hooks/useOnElementMouseEnterDelayedCallback.js.map +0 -1
- package/dist/development/hooks/useOnElementMutation.cjs +0 -35
- package/dist/development/hooks/useOnElementMutation.cjs.map +0 -1
- package/dist/development/hooks/useOnElementMutation.js +0 -35
- package/dist/development/hooks/useOnElementMutation.js.map +0 -1
- package/dist/development/hooks/useOnElementResize.cjs.map +0 -1
- package/dist/development/hooks/useOnElementResize.js.map +0 -1
- package/dist/development/hooks/useOnScrollWithin.cjs +0 -52
- package/dist/development/hooks/useOnScrollWithin.cjs.map +0 -1
- package/dist/development/hooks/useOnScrollWithin.js +0 -52
- package/dist/development/hooks/useOnScrollWithin.js.map +0 -1
- package/dist/development/hooks/useOnWindowResize.cjs.map +0 -1
- package/dist/development/hooks/useOnWindowResize.js.map +0 -1
- package/dist/development/hooks/usePreviousValue.cjs.map +0 -1
- package/dist/development/hooks/usePreviousValue.js.map +0 -1
- package/dist/development/hooks/useScrollOffsets.cjs +0 -67
- package/dist/development/hooks/useScrollOffsets.cjs.map +0 -1
- package/dist/development/hooks/useScrollOffsets.js +0 -67
- package/dist/development/hooks/useScrollOffsets.js.map +0 -1
- package/dist/development/hooks/useStoredState.cjs.map +0 -1
- package/dist/development/hooks/useStoredState.js.map +0 -1
- package/dist/development/hooks/useUpdatedRef.cjs.map +0 -1
- package/dist/development/hooks/useUpdatedRef.js.map +0 -1
- package/dist/development/hooks/useWindowSize.cjs.map +0 -1
- package/dist/development/hooks/useWindowSize.js.map +0 -1
- package/dist/development/referentiallyStable/emptyArray.cjs.map +0 -1
- package/dist/development/referentiallyStable/emptyArray.js.map +0 -1
- package/dist/development/referentiallyStable/emptyObject.cjs.map +0 -1
- package/dist/development/referentiallyStable/emptyObject.js.map +0 -1
- package/dist/development/referentiallyStable/identityFunction.cjs.map +0 -1
- package/dist/development/referentiallyStable/identityFunction.js.map +0 -1
- package/dist/development/referentiallyStable/noop.cjs.map +0 -1
- package/dist/development/referentiallyStable/noop.js.map +0 -1
- package/dist/development/referentiallyStable/returnFalse.cjs.map +0 -1
- package/dist/development/referentiallyStable/returnFalse.js.map +0 -1
- package/dist/development/referentiallyStable/returnTrue.cjs.map +0 -1
- package/dist/development/referentiallyStable/returnTrue.js.map +0 -1
- package/dist/development/referentiallyStable/useReferentiallyStableCallback.cjs.map +0 -1
- package/dist/development/referentiallyStable/useReferentiallyStableCallback.js.map +0 -1
- package/dist/development/theming/ColorSchemeProvider.cjs +0 -16
- package/dist/development/theming/ColorSchemeProvider.cjs.map +0 -1
- package/dist/development/theming/ColorSchemeProvider.js +0 -16
- package/dist/development/theming/ColorSchemeProvider.js.map +0 -1
- package/dist/development/theming/GlobalClassNamePrefixContext.cjs +0 -6
- package/dist/development/theming/GlobalClassNamePrefixContext.cjs.map +0 -1
- package/dist/development/theming/GlobalClassNamePrefixContext.js +0 -6
- package/dist/development/theming/GlobalClassNamePrefixContext.js.map +0 -1
- package/dist/development/theming/contexts.cjs +0 -12
- package/dist/development/theming/contexts.cjs.map +0 -1
- package/dist/development/theming/contexts.js +0 -12
- package/dist/development/theming/contexts.js.map +0 -1
- package/dist/development/theming/useClassName.cjs +0 -17
- package/dist/development/theming/useClassName.cjs.map +0 -1
- package/dist/development/theming/useClassName.js +0 -17
- package/dist/development/theming/useClassName.js.map +0 -1
- package/dist/development/theming/useClassNameFactory.cjs +0 -22
- package/dist/development/theming/useClassNameFactory.cjs.map +0 -1
- package/dist/development/theming/useClassNameFactory.js +0 -22
- package/dist/development/theming/useClassNameFactory.js.map +0 -1
- package/dist/development/theming/useThemedClassName.cjs +0 -17
- package/dist/development/theming/useThemedClassName.cjs.map +0 -1
- package/dist/development/theming/useThemedClassName.js +0 -17
- package/dist/development/theming/useThemedClassName.js.map +0 -1
- package/dist/development/theming/useThemedClassNameFactory.cjs +0 -29
- package/dist/development/theming/useThemedClassNameFactory.cjs.map +0 -1
- package/dist/development/theming/useThemedClassNameFactory.js +0 -29
- package/dist/development/theming/useThemedClassNameFactory.js.map +0 -1
- package/dist/production/context/createContext.cjs.map +0 -1
- package/dist/production/context/createContext.js.map +0 -1
- package/dist/production/context/createRequiredContext.cjs.map +0 -1
- package/dist/production/context/createRequiredContext.js.map +0 -1
- package/dist/production/debug-context/Constants.cjs.map +0 -1
- package/dist/production/debug-context/Constants.js.map +0 -1
- package/dist/production/debug-context/Context.cjs.map +0 -1
- package/dist/production/debug-context/Context.js.map +0 -1
- package/dist/production/hooks/unwrapRefValue.cjs.map +0 -1
- package/dist/production/hooks/unwrapRefValue.js.map +0 -1
- package/dist/production/hooks/useAbortController.cjs.map +0 -1
- package/dist/production/hooks/useAbortController.js.map +0 -1
- package/dist/production/hooks/useAddClassNameDuringResize.cjs +0 -32
- package/dist/production/hooks/useAddClassNameDuringResize.cjs.map +0 -1
- package/dist/production/hooks/useAddClassNameDuringResize.js +0 -32
- package/dist/production/hooks/useAddClassNameDuringResize.js.map +0 -1
- package/dist/production/hooks/useArrayMapMemo.cjs.map +0 -1
- package/dist/production/hooks/useArrayMapMemo.js.map +0 -1
- package/dist/production/hooks/useAutoHeightTextArea.cjs.map +0 -1
- package/dist/production/hooks/useAutoHeightTextArea.js.map +0 -1
- package/dist/production/hooks/useChildrenAsLabel.cjs.map +0 -1
- package/dist/production/hooks/useChildrenAsLabel.js.map +0 -1
- package/dist/production/hooks/useCloseOnClickOutside.cjs +0 -25
- package/dist/production/hooks/useCloseOnClickOutside.cjs.map +0 -1
- package/dist/production/hooks/useCloseOnClickOutside.js +0 -25
- package/dist/production/hooks/useCloseOnClickOutside.js.map +0 -1
- package/dist/production/hooks/useCloseOnEscape.cjs +0 -20
- package/dist/production/hooks/useCloseOnEscape.cjs.map +0 -1
- package/dist/production/hooks/useCloseOnEscape.js +0 -20
- package/dist/production/hooks/useCloseOnEscape.js.map +0 -1
- package/dist/production/hooks/useComposeRef.cjs.map +0 -1
- package/dist/production/hooks/useComposeRef.js.map +0 -1
- package/dist/production/hooks/useConstantLengthInvariant.cjs.map +0 -1
- package/dist/production/hooks/useConstantLengthInvariant.js.map +0 -1
- package/dist/production/hooks/useConstantValueInvariant.cjs.map +0 -1
- package/dist/production/hooks/useConstantValueInvariant.js.map +0 -1
- package/dist/production/hooks/useContainerWidth.cjs +0 -14
- package/dist/production/hooks/useContainerWidth.cjs.map +0 -1
- package/dist/production/hooks/useContainerWidth.js +0 -14
- package/dist/production/hooks/useContainerWidth.js.map +0 -1
- package/dist/production/hooks/useDebounce.cjs.map +0 -1
- package/dist/production/hooks/useDebounce.js.map +0 -1
- package/dist/production/hooks/useDebounceCallback.cjs.map +0 -1
- package/dist/production/hooks/useDebounceCallback.js.map +0 -1
- package/dist/production/hooks/useDocumentTitle.cjs.map +0 -1
- package/dist/production/hooks/useDocumentTitle.js.map +0 -1
- package/dist/production/hooks/useElementSize.cjs +0 -37
- package/dist/production/hooks/useElementSize.cjs.map +0 -1
- package/dist/production/hooks/useElementSize.js +0 -37
- package/dist/production/hooks/useElementSize.js.map +0 -1
- package/dist/production/hooks/useElementTopOffset.cjs +0 -29
- package/dist/production/hooks/useElementTopOffset.cjs.map +0 -1
- package/dist/production/hooks/useElementTopOffset.js +0 -29
- package/dist/production/hooks/useElementTopOffset.js.map +0 -1
- package/dist/production/hooks/useEventHandler.cjs +0 -19
- package/dist/production/hooks/useEventHandler.cjs.map +0 -1
- package/dist/production/hooks/useEventHandler.js +0 -19
- package/dist/production/hooks/useEventHandler.js.map +0 -1
- package/dist/production/hooks/useExpectSameValueReference.cjs.map +0 -1
- package/dist/production/hooks/useExpectSameValueReference.js.map +0 -1
- package/dist/production/hooks/useForceRender.cjs.map +0 -1
- package/dist/production/hooks/useForceRender.js.map +0 -1
- package/dist/production/hooks/useId.cjs.map +0 -1
- package/dist/production/hooks/useId.js.map +0 -1
- package/dist/production/hooks/useIsMounted.cjs.map +0 -1
- package/dist/production/hooks/useIsMounted.js.map +0 -1
- package/dist/production/hooks/useObjectMemo.cjs.map +0 -1
- package/dist/production/hooks/useObjectMemo.js.map +0 -1
- package/dist/production/hooks/useOnElementClickOutsideCallback.cjs.map +0 -1
- package/dist/production/hooks/useOnElementClickOutsideCallback.js.map +0 -1
- package/dist/production/hooks/useOnElementMouseEnterDelayedCallback.cjs.map +0 -1
- package/dist/production/hooks/useOnElementMouseEnterDelayedCallback.js.map +0 -1
- package/dist/production/hooks/useOnElementMutation.cjs +0 -35
- package/dist/production/hooks/useOnElementMutation.cjs.map +0 -1
- package/dist/production/hooks/useOnElementMutation.js +0 -35
- package/dist/production/hooks/useOnElementMutation.js.map +0 -1
- package/dist/production/hooks/useOnElementResize.cjs.map +0 -1
- package/dist/production/hooks/useOnElementResize.js.map +0 -1
- package/dist/production/hooks/useOnScrollWithin.cjs +0 -52
- package/dist/production/hooks/useOnScrollWithin.cjs.map +0 -1
- package/dist/production/hooks/useOnScrollWithin.js +0 -52
- package/dist/production/hooks/useOnScrollWithin.js.map +0 -1
- package/dist/production/hooks/useOnWindowResize.cjs.map +0 -1
- package/dist/production/hooks/useOnWindowResize.js.map +0 -1
- package/dist/production/hooks/usePreviousValue.cjs.map +0 -1
- package/dist/production/hooks/usePreviousValue.js.map +0 -1
- package/dist/production/hooks/useScrollOffsets.cjs +0 -67
- package/dist/production/hooks/useScrollOffsets.cjs.map +0 -1
- package/dist/production/hooks/useScrollOffsets.js +0 -67
- package/dist/production/hooks/useScrollOffsets.js.map +0 -1
- package/dist/production/hooks/useStoredState.cjs.map +0 -1
- package/dist/production/hooks/useStoredState.js.map +0 -1
- package/dist/production/hooks/useUpdatedRef.cjs.map +0 -1
- package/dist/production/hooks/useUpdatedRef.js.map +0 -1
- package/dist/production/hooks/useWindowSize.cjs.map +0 -1
- package/dist/production/hooks/useWindowSize.js.map +0 -1
- package/dist/production/referentiallyStable/emptyArray.cjs.map +0 -1
- package/dist/production/referentiallyStable/emptyArray.js.map +0 -1
- package/dist/production/referentiallyStable/emptyObject.cjs.map +0 -1
- package/dist/production/referentiallyStable/emptyObject.js.map +0 -1
- package/dist/production/referentiallyStable/identityFunction.cjs.map +0 -1
- package/dist/production/referentiallyStable/identityFunction.js.map +0 -1
- package/dist/production/referentiallyStable/noop.cjs.map +0 -1
- package/dist/production/referentiallyStable/noop.js.map +0 -1
- package/dist/production/referentiallyStable/returnFalse.cjs.map +0 -1
- package/dist/production/referentiallyStable/returnFalse.js.map +0 -1
- package/dist/production/referentiallyStable/returnTrue.cjs.map +0 -1
- package/dist/production/referentiallyStable/returnTrue.js.map +0 -1
- package/dist/production/referentiallyStable/useReferentiallyStableCallback.cjs.map +0 -1
- package/dist/production/referentiallyStable/useReferentiallyStableCallback.js.map +0 -1
- package/dist/production/theming/ColorSchemeProvider.cjs +0 -12
- package/dist/production/theming/ColorSchemeProvider.cjs.map +0 -1
- package/dist/production/theming/ColorSchemeProvider.js +0 -12
- package/dist/production/theming/ColorSchemeProvider.js.map +0 -1
- package/dist/production/theming/GlobalClassNamePrefixContext.cjs +0 -6
- package/dist/production/theming/GlobalClassNamePrefixContext.cjs.map +0 -1
- package/dist/production/theming/GlobalClassNamePrefixContext.js +0 -6
- package/dist/production/theming/GlobalClassNamePrefixContext.js.map +0 -1
- package/dist/production/theming/contexts.cjs +0 -12
- package/dist/production/theming/contexts.cjs.map +0 -1
- package/dist/production/theming/contexts.js +0 -12
- package/dist/production/theming/contexts.js.map +0 -1
- package/dist/production/theming/useClassName.cjs +0 -17
- package/dist/production/theming/useClassName.cjs.map +0 -1
- package/dist/production/theming/useClassName.js +0 -17
- package/dist/production/theming/useClassName.js.map +0 -1
- package/dist/production/theming/useClassNameFactory.cjs +0 -22
- package/dist/production/theming/useClassNameFactory.cjs.map +0 -1
- package/dist/production/theming/useClassNameFactory.js +0 -22
- package/dist/production/theming/useClassNameFactory.js.map +0 -1
- package/dist/production/theming/useThemedClassName.cjs +0 -17
- package/dist/production/theming/useThemedClassName.cjs.map +0 -1
- package/dist/production/theming/useThemedClassName.js +0 -17
- package/dist/production/theming/useThemedClassName.js.map +0 -1
- package/dist/production/theming/useThemedClassNameFactory.cjs +0 -29
- package/dist/production/theming/useThemedClassNameFactory.cjs.map +0 -1
- package/dist/production/theming/useThemedClassNameFactory.js +0 -29
- package/dist/production/theming/useThemedClassNameFactory.js.map +0 -1
- package/dist/types/hooks/useAddClassNameDuringResize.d.ts +0 -13
- package/dist/types/hooks/useAddClassNameDuringResize.d.ts.map +0 -1
- package/dist/types/hooks/useCloseOnClickOutside.d.ts +0 -7
- package/dist/types/hooks/useCloseOnClickOutside.d.ts.map +0 -1
- package/dist/types/hooks/useCloseOnEscape.d.ts +0 -5
- package/dist/types/hooks/useCloseOnEscape.d.ts.map +0 -1
- package/dist/types/hooks/useContainerWidth.d.ts +0 -4
- package/dist/types/hooks/useContainerWidth.d.ts.map +0 -1
- package/dist/types/hooks/useElementSize.d.ts +0 -16
- package/dist/types/hooks/useElementSize.d.ts.map +0 -1
- package/dist/types/hooks/useElementTopOffset.d.ts +0 -3
- package/dist/types/hooks/useElementTopOffset.d.ts.map +0 -1
- package/dist/types/hooks/useEventHandler.d.ts +0 -10
- package/dist/types/hooks/useEventHandler.d.ts.map +0 -1
- package/dist/types/hooks/useOnElementMutation.d.ts +0 -3
- package/dist/types/hooks/useOnElementMutation.d.ts.map +0 -1
- package/dist/types/hooks/useOnScrollWithin.d.ts +0 -10
- package/dist/types/hooks/useOnScrollWithin.d.ts.map +0 -1
- package/dist/types/hooks/useScrollOffsets.d.ts +0 -14
- package/dist/types/hooks/useScrollOffsets.d.ts.map +0 -1
- package/dist/types/theming/ColorSchemeProvider.d.ts +0 -6
- package/dist/types/theming/ColorSchemeProvider.d.ts.map +0 -1
- package/dist/types/theming/GlobalClassNamePrefixContext.d.ts +0 -2
- package/dist/types/theming/GlobalClassNamePrefixContext.d.ts.map +0 -1
- package/dist/types/theming/contexts.d.ts +0 -12
- package/dist/types/theming/contexts.d.ts.map +0 -1
- package/dist/types/theming/index.d.ts +0 -8
- package/dist/types/theming/index.d.ts.map +0 -1
- package/dist/types/theming/useClassName.d.ts +0 -11
- package/dist/types/theming/useClassName.d.ts.map +0 -1
- package/dist/types/theming/useClassNameFactory.d.ts +0 -17
- package/dist/types/theming/useClassNameFactory.d.ts.map +0 -1
- package/dist/types/theming/useThemedClassName.d.ts +0 -39
- package/dist/types/theming/useThemedClassName.d.ts.map +0 -1
- package/dist/types/theming/useThemedClassNameFactory.d.ts +0 -3
- package/dist/types/theming/useThemedClassNameFactory.d.ts.map +0 -1
- package/src/hooks/useAddClassNameDuringResize.ts +0 -56
- package/src/hooks/useCloseOnClickOutside.ts +0 -27
- package/src/hooks/useCloseOnEscape.ts +0 -18
- package/src/hooks/useContainerWidth.ts +0 -13
- package/src/hooks/useElementSize.ts +0 -56
- package/src/hooks/useElementTopOffset.ts +0 -35
- package/src/hooks/useEventHandler.ts +0 -24
- package/src/hooks/useOnElementMutation.ts +0 -42
- package/src/hooks/useOnScrollWithin.ts +0 -68
- package/src/hooks/useScrollOffsets.ts +0 -87
- package/src/theming/ColorSchemeProvider.tsx +0 -16
- package/src/theming/GlobalClassNamePrefixContext.ts +0 -3
- package/src/theming/contexts.ts +0 -18
- package/src/theming/index.ts +0 -7
- package/src/theming/useClassName.ts +0 -28
- package/src/theming/useClassNameFactory.ts +0 -50
- package/src/theming/useThemedClassName.ts +0 -54
- package/src/theming/useThemedClassNameFactory.ts +0 -44
- /package/dist/development/{context → src/context}/createContext.js +0 -0
- /package/dist/development/{context → src/context}/createRequiredContext.js +0 -0
- /package/dist/development/{debug-context → src/debug-context}/Constants.cjs +0 -0
- /package/dist/development/{debug-context → src/debug-context}/Constants.js +0 -0
- /package/dist/development/{hooks → src/hooks}/unwrapRefValue.cjs +0 -0
- /package/dist/development/{hooks → src/hooks}/unwrapRefValue.js +0 -0
- /package/dist/development/{hooks → src/hooks}/useAbortController.js +0 -0
- /package/dist/development/{hooks → src/hooks}/useArrayMapMemo.js +0 -0
- /package/dist/development/{hooks → src/hooks}/useAutoHeightTextArea.js +0 -0
- /package/dist/development/{hooks → src/hooks}/useComposeRef.js +0 -0
- /package/dist/development/{hooks → src/hooks}/useConstantLengthInvariant.cjs +0 -0
- /package/dist/development/{hooks → src/hooks}/useConstantLengthInvariant.js +0 -0
- /package/dist/development/{hooks → src/hooks}/useConstantValueInvariant.cjs +0 -0
- /package/dist/development/{hooks → src/hooks}/useConstantValueInvariant.js +0 -0
- /package/dist/development/{hooks → src/hooks}/useDebounce.js +0 -0
- /package/dist/development/{hooks → src/hooks}/useDebounceCallback.js +0 -0
- /package/dist/development/{hooks → src/hooks}/useDocumentTitle.js +0 -0
- /package/dist/development/{hooks → src/hooks}/useForceRender.js +0 -0
- /package/dist/development/{hooks → src/hooks}/useId.js +0 -0
- /package/dist/development/{hooks → src/hooks}/useIsMounted.js +0 -0
- /package/dist/development/{hooks → src/hooks}/useObjectMemo.js +0 -0
- /package/dist/development/{hooks → src/hooks}/useOnElementClickOutsideCallback.js +0 -0
- /package/dist/development/{hooks → src/hooks}/useOnElementMouseEnterDelayedCallback.js +0 -0
- /package/dist/development/{hooks → src/hooks}/usePreviousValue.js +0 -0
- /package/dist/development/{hooks → src/hooks}/useStoredState.js +0 -0
- /package/dist/development/{hooks → src/hooks}/useUpdatedRef.js +0 -0
- /package/dist/development/{hooks → src/hooks}/useWindowSize.js +0 -0
- /package/dist/development/{referentiallyStable → src/referentiallyStable}/emptyArray.cjs +0 -0
- /package/dist/development/{referentiallyStable → src/referentiallyStable}/emptyArray.js +0 -0
- /package/dist/development/{referentiallyStable → src/referentiallyStable}/emptyObject.cjs +0 -0
- /package/dist/development/{referentiallyStable → src/referentiallyStable}/emptyObject.js +0 -0
- /package/dist/development/{referentiallyStable → src/referentiallyStable}/identityFunction.cjs +0 -0
- /package/dist/development/{referentiallyStable → src/referentiallyStable}/identityFunction.js +0 -0
- /package/dist/development/{referentiallyStable → src/referentiallyStable}/noop.cjs +0 -0
- /package/dist/development/{referentiallyStable → src/referentiallyStable}/noop.js +0 -0
- /package/dist/development/{referentiallyStable → src/referentiallyStable}/returnFalse.cjs +0 -0
- /package/dist/development/{referentiallyStable → src/referentiallyStable}/returnFalse.js +0 -0
- /package/dist/development/{referentiallyStable → src/referentiallyStable}/returnTrue.cjs +0 -0
- /package/dist/development/{referentiallyStable → src/referentiallyStable}/returnTrue.js +0 -0
- /package/dist/development/{referentiallyStable → src/referentiallyStable}/useReferentiallyStableCallback.js +0 -0
- /package/dist/production/{context → src/context}/createContext.js +0 -0
- /package/dist/production/{context → src/context}/createRequiredContext.js +0 -0
- /package/dist/production/{debug-context → src/debug-context}/Constants.cjs +0 -0
- /package/dist/production/{debug-context → src/debug-context}/Constants.js +0 -0
- /package/dist/production/{debug-context → src/debug-context}/Context.js +0 -0
- /package/dist/production/{hooks → src/hooks}/unwrapRefValue.cjs +0 -0
- /package/dist/production/{hooks → src/hooks}/unwrapRefValue.js +0 -0
- /package/dist/production/{hooks → src/hooks}/useAbortController.js +0 -0
- /package/dist/production/{hooks → src/hooks}/useArrayMapMemo.js +0 -0
- /package/dist/production/{hooks → src/hooks}/useAutoHeightTextArea.js +0 -0
- /package/dist/production/{hooks → src/hooks}/useComposeRef.js +0 -0
- /package/dist/production/{hooks → src/hooks}/useConstantLengthInvariant.cjs +0 -0
- /package/dist/production/{hooks → src/hooks}/useConstantLengthInvariant.js +0 -0
- /package/dist/production/{hooks → src/hooks}/useConstantValueInvariant.cjs +0 -0
- /package/dist/production/{hooks → src/hooks}/useConstantValueInvariant.js +0 -0
- /package/dist/production/{hooks → src/hooks}/useDebounce.js +0 -0
- /package/dist/production/{hooks → src/hooks}/useDebounceCallback.js +0 -0
- /package/dist/production/{hooks → src/hooks}/useDocumentTitle.js +0 -0
- /package/dist/production/{hooks → src/hooks}/useForceRender.js +0 -0
- /package/dist/production/{hooks → src/hooks}/useId.js +0 -0
- /package/dist/production/{hooks → src/hooks}/useIsMounted.js +0 -0
- /package/dist/production/{hooks → src/hooks}/useObjectMemo.js +0 -0
- /package/dist/production/{hooks → src/hooks}/useOnElementClickOutsideCallback.js +0 -0
- /package/dist/production/{hooks → src/hooks}/useOnElementMouseEnterDelayedCallback.js +0 -0
- /package/dist/production/{hooks → src/hooks}/usePreviousValue.js +0 -0
- /package/dist/production/{hooks → src/hooks}/useStoredState.js +0 -0
- /package/dist/production/{hooks → src/hooks}/useUpdatedRef.js +0 -0
- /package/dist/production/{hooks → src/hooks}/useWindowSize.js +0 -0
- /package/dist/production/{referentiallyStable → src/referentiallyStable}/emptyArray.cjs +0 -0
- /package/dist/production/{referentiallyStable → src/referentiallyStable}/emptyArray.js +0 -0
- /package/dist/production/{referentiallyStable → src/referentiallyStable}/emptyObject.cjs +0 -0
- /package/dist/production/{referentiallyStable → src/referentiallyStable}/emptyObject.js +0 -0
- /package/dist/production/{referentiallyStable → src/referentiallyStable}/identityFunction.cjs +0 -0
- /package/dist/production/{referentiallyStable → src/referentiallyStable}/identityFunction.js +0 -0
- /package/dist/production/{referentiallyStable → src/referentiallyStable}/noop.cjs +0 -0
- /package/dist/production/{referentiallyStable → src/referentiallyStable}/noop.js +0 -0
- /package/dist/production/{referentiallyStable → src/referentiallyStable}/returnFalse.cjs +0 -0
- /package/dist/production/{referentiallyStable → src/referentiallyStable}/returnFalse.js +0 -0
- /package/dist/production/{referentiallyStable → src/referentiallyStable}/returnTrue.cjs +0 -0
- /package/dist/production/{referentiallyStable → src/referentiallyStable}/returnTrue.js +0 -0
- /package/dist/production/{referentiallyStable → src/referentiallyStable}/useReferentiallyStableCallback.js +0 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contember/react-utils",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0-alpha.10",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "./dist/production/index.js",
|
|
@@ -17,29 +17,21 @@
|
|
|
17
17
|
"types": "./dist/types/index.d.ts",
|
|
18
18
|
"development": "./dist/development/index.cjs",
|
|
19
19
|
"production": "./dist/production/index.cjs",
|
|
20
|
+
"typescript": "./src/index.ts",
|
|
20
21
|
"default": "./dist/production/index.cjs"
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
},
|
|
24
|
-
"files": [
|
|
25
|
-
"dist/",
|
|
26
|
-
"src/"
|
|
27
|
-
],
|
|
28
25
|
"typings": "./dist/types/index.d.ts",
|
|
29
26
|
"scripts": {
|
|
30
|
-
"build": "yarn build:js:dev && yarn build:js:prod",
|
|
31
|
-
"build:js:dev": "NODE_ENV=development vite build --mode development",
|
|
32
|
-
"build:js:prod": "vite build --mode production",
|
|
33
27
|
"ae:build": "api-extractor run --local",
|
|
34
|
-
"ae:test": "api-extractor run"
|
|
35
|
-
"test": "vitest --environment jsdom"
|
|
28
|
+
"ae:test": "api-extractor run"
|
|
36
29
|
},
|
|
37
30
|
"peerDependencies": {
|
|
38
31
|
"react": "^18 || ^19"
|
|
39
32
|
},
|
|
40
33
|
"dependencies": {
|
|
41
|
-
"@contember/utilities": "
|
|
34
|
+
"@contember/utilities": "2.0.0-alpha.10",
|
|
42
35
|
"fast-deep-equal": "^3.1.3"
|
|
43
|
-
}
|
|
44
|
-
"stableVersion": "0.0.0"
|
|
36
|
+
}
|
|
45
37
|
}
|
|
@@ -2,8 +2,8 @@ import type { Context } from 'react'
|
|
|
2
2
|
import { createContext as baseCreateContext, useContext } from 'react'
|
|
3
3
|
|
|
4
4
|
export function createContext<T>(name: string, initialValue: T): [Context<T>, () => T] {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
const OptionalContext = baseCreateContext<T>(initialValue)
|
|
6
|
+
OptionalContext.displayName = name
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
return [OptionalContext, () => useContext(OptionalContext)]
|
|
9
9
|
}
|
|
@@ -4,18 +4,18 @@ import { createContext, useContext } from 'react'
|
|
|
4
4
|
const EmptyContextSymbol = Symbol('EmptyContextSymbol')
|
|
5
5
|
|
|
6
6
|
export function createRequiredContext<T>(displayName: string): [Context<T>, () => T] {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const RequiredContext = createContext<T>(EmptyContextSymbol as T)
|
|
8
|
+
RequiredContext.displayName = displayName
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const useRequiredContext = (): T => {
|
|
11
|
+
const context = useContext(RequiredContext)
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
if (context === EmptyContextSymbol) {
|
|
14
|
+
throw new Error(`use${displayName} must be used within a ${displayName} provider`)
|
|
15
|
+
}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
return context
|
|
18
|
+
}
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
return [RequiredContext, useRequiredContext]
|
|
21
21
|
}
|
|
@@ -2,12 +2,12 @@ export type DebugMethod = (...parameters: any[]) => void
|
|
|
2
2
|
export type ResultDebuggedMethod = <T>(message: string, value: T) => T
|
|
3
3
|
|
|
4
4
|
export type ScopedConsoleContextType = {
|
|
5
|
-
log: DebugMethod
|
|
6
|
-
logged: ResultDebuggedMethod
|
|
7
|
-
warn: DebugMethod
|
|
8
|
-
warned: ResultDebuggedMethod
|
|
9
|
-
error: DebugMethod
|
|
10
|
-
errored: ResultDebuggedMethod
|
|
11
|
-
trace: DebugMethod
|
|
12
|
-
traced: ResultDebuggedMethod
|
|
5
|
+
log: DebugMethod
|
|
6
|
+
logged: ResultDebuggedMethod
|
|
7
|
+
warn: DebugMethod
|
|
8
|
+
warned: ResultDebuggedMethod
|
|
9
|
+
error: DebugMethod
|
|
10
|
+
errored: ResultDebuggedMethod
|
|
11
|
+
trace: DebugMethod
|
|
12
|
+
traced: ResultDebuggedMethod
|
|
13
13
|
}
|
package/src/hooks/index.ts
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
export * from './unwrapRefValue'
|
|
2
2
|
export * from './useAbortController'
|
|
3
|
-
export * from './useAddClassNameDuringResize'
|
|
4
3
|
export * from './useArrayMapMemo'
|
|
5
4
|
export * from './useAutoHeightTextArea'
|
|
6
5
|
export * from './useChildrenAsLabel'
|
|
7
|
-
export * from './useCloseOnClickOutside'
|
|
8
|
-
export * from './useCloseOnEscape'
|
|
9
6
|
export * from './useComposeRef'
|
|
10
7
|
export * from './useConstantLengthInvariant'
|
|
11
8
|
export * from './useConstantValueInvariant'
|
|
12
|
-
export * from './useContainerWidth'
|
|
13
9
|
export * from './useDebounce'
|
|
14
10
|
export * from './useDebounceCallback'
|
|
15
11
|
export * from './useDocumentTitle'
|
|
16
|
-
export * from './useElementSize'
|
|
17
|
-
export * from './useElementTopOffset'
|
|
18
|
-
export * from './useEventHandler'
|
|
19
12
|
export * from './useExpectSameValueReference'
|
|
20
13
|
export * from './useForceRender'
|
|
21
14
|
export * from './useId'
|
|
@@ -23,12 +16,9 @@ export * from './useIsMounted'
|
|
|
23
16
|
export * from './useObjectMemo'
|
|
24
17
|
export * from './useOnElementClickOutsideCallback'
|
|
25
18
|
export * from './useOnElementMouseEnterDelayedCallback'
|
|
26
|
-
export * from './useOnElementMutation'
|
|
27
19
|
export * from './useOnElementResize'
|
|
28
|
-
export * from './useOnScrollWithin'
|
|
29
20
|
export * from './useOnWindowResize'
|
|
30
21
|
export * from './usePreviousValue'
|
|
31
|
-
export * from './useScrollOffsets'
|
|
32
22
|
export * from './useStoredState'
|
|
33
23
|
export * from './useUpdatedRef'
|
|
34
24
|
export * from './useWindowSize'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MutableRefObject, RefCallback, useMemo, useRef } from 'react'
|
|
2
2
|
|
|
3
3
|
export type MaybeRef<T> = ((instance: T | null) => void) | MutableRefObject<T | null> | null | undefined
|
|
4
|
-
export type ComposedRefCallback<T> = RefCallback<T> & { current: T | null }
|
|
4
|
+
export type ComposedRefCallback<T> = RefCallback<T> & { current: T | null }
|
|
5
5
|
|
|
6
6
|
function setRef<T>(ref: MaybeRef<T>, instance: T | null): void {
|
|
7
7
|
if (ref) {
|
|
@@ -37,9 +37,9 @@ export function useExpectSameValueReference<T>(next: T, shouldThrow: boolean = f
|
|
|
37
37
|
'Try declaring constants outside of the component scope. ' +
|
|
38
38
|
'Otherwise try to memoize callbacks with useCallback, ' +
|
|
39
39
|
'useReferentiallyStableCallback useEvent, useRef or useMemo.', {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
previous: previous.current,
|
|
41
|
+
next,
|
|
42
|
+
})
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
if (shouldThrow) {
|
|
@@ -23,7 +23,7 @@ export function useOnElementResize(
|
|
|
23
23
|
throw new Error('Exhaustive error: Expecting element to be instance of HTMLElement')
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
let timeoutID:
|
|
26
|
+
let timeoutID: ReturnType<typeof setTimeout>
|
|
27
27
|
|
|
28
28
|
function debouncedOnChange([entry]: ResizeObserverEntry[]) {
|
|
29
29
|
const timeStamp = Date.now()
|
|
@@ -11,7 +11,7 @@ export function useOnWindowResize(
|
|
|
11
11
|
const lastTimeStamp = useRef<number>(0)
|
|
12
12
|
|
|
13
13
|
useLayoutEffect(() => {
|
|
14
|
-
let timeoutID:
|
|
14
|
+
let timeoutID: ReturnType<typeof setTimeout>
|
|
15
15
|
|
|
16
16
|
function debouncedHandler(event: Event) {
|
|
17
17
|
clearTimeout(timeoutID)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useCallback, useMemo, useState } from 'react'
|
|
2
2
|
import { Serializable } from '../types'
|
|
3
3
|
|
|
4
|
-
export type SetState<V extends Serializable> = (value: V | ((current: V) => V)) => void
|
|
4
|
+
export type SetState<V extends Serializable> = (value: V | ((current: V) => V)) => void
|
|
5
5
|
export type StateStorageKey = [uniquePrefix: string, key: string]
|
|
6
6
|
|
|
7
|
-
export type ValueInitializer<V extends Serializable> = (storedValue: V | undefined) => V
|
|
7
|
+
export type ValueInitializer<V extends Serializable> = (storedValue: V | undefined) => V
|
|
8
8
|
|
|
9
9
|
export interface StateStorage {
|
|
10
10
|
getItem(key: StateStorageKey): Serializable
|
|
@@ -2,19 +2,19 @@ import { useMemo, useState } from 'react'
|
|
|
2
2
|
import { useOnWindowResize } from './useOnWindowResize'
|
|
3
3
|
|
|
4
4
|
export function useWindowSize() {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
const [width, setWidth] = useState(window.innerWidth)
|
|
6
|
+
const [height, setHeight] = useState(window.innerHeight)
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
useOnWindowResize(() => {
|
|
9
|
+
const { innerHeight, innerWidth } = window
|
|
10
|
+
if (innerHeight !== height) {
|
|
11
|
+
setHeight(innerHeight)
|
|
12
|
+
}
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
if (innerWidth !== width) {
|
|
15
|
+
setWidth(innerWidth)
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
return useMemo(() => ({ height, width }), [height, width])
|
|
20
20
|
}
|
package/src/index.ts
CHANGED
package/src/tsconfig.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "../../../tsconfig.settings.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"outDir": "../dist/types"
|
|
4
|
+
"outDir": "../dist/types",
|
|
5
|
+
"types": [
|
|
6
|
+
"vite/client"
|
|
7
|
+
]
|
|
5
8
|
},
|
|
6
9
|
"references": [
|
|
7
|
-
{ "path": "../../utilities/src" }
|
|
10
|
+
{ "path": "../../utilities/src" }
|
|
8
11
|
]
|
|
9
12
|
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import jsdom from 'jsdom'
|
|
2
|
+
import { createPortal } from 'react-dom'
|
|
3
|
+
import { describe, expect, it } from 'vitest'
|
|
4
|
+
import { getChildrenAsLabel } from '../../src'
|
|
5
|
+
|
|
6
|
+
const { JSDOM } = jsdom
|
|
7
|
+
const { window } = new JSDOM('<!doctype html><html><body></body></html>')
|
|
8
|
+
global.document = window.document
|
|
9
|
+
|
|
10
|
+
describe('@contember/utilities.getChildrenAsLabel', () => {
|
|
11
|
+
it('should return undefined for null or undefined children', () => {
|
|
12
|
+
expect(getChildrenAsLabel(null)).toBeUndefined()
|
|
13
|
+
expect(getChildrenAsLabel(undefined)).toBeUndefined()
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
it('should return undefined for boolean children', () => {
|
|
17
|
+
expect(getChildrenAsLabel(true)).toBeUndefined()
|
|
18
|
+
expect(getChildrenAsLabel(false)).toBeUndefined()
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
it('should return the string representation of a string or number child', () => {
|
|
22
|
+
expect(getChildrenAsLabel('Hello')).toBe('Hello')
|
|
23
|
+
expect(getChildrenAsLabel(42)).toBe('42')
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
it('should concatenate the string representation of multiple string or number children', () => {
|
|
27
|
+
expect(getChildrenAsLabel(['Hello', 'world'])).toBe('Helloworld')
|
|
28
|
+
expect(getChildrenAsLabel([42, ' is ', ' the ', ' answer '])).toBe('42 is the answer')
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
it('should ignore whitespace-only string children', () => {
|
|
32
|
+
expect(getChildrenAsLabel(['Hello', ' ', 'world'])).toBe('Hello world')
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
it('should concatenate the labels of nested children', () => {
|
|
36
|
+
const nested = (
|
|
37
|
+
<div>
|
|
38
|
+
<span>Hello </span>
|
|
39
|
+
<span> world </span>
|
|
40
|
+
</div>
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
expect(getChildrenAsLabel(nested)).toBe('Hello world')
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
it('should ignore null, undefined, or boolean nested children', () => {
|
|
47
|
+
const nested = (
|
|
48
|
+
<div>
|
|
49
|
+
<span>Hello</span>
|
|
50
|
+
{null}
|
|
51
|
+
{undefined}
|
|
52
|
+
<span>world</span>
|
|
53
|
+
{true}
|
|
54
|
+
{false}
|
|
55
|
+
</div>
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
expect(getChildrenAsLabel(nested)).toBe('Helloworld')
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
it('should concatenate the labels of nested arrays of children', () => {
|
|
62
|
+
const nested = [
|
|
63
|
+
<span key="0.1">Hello </span>,
|
|
64
|
+
[<span key="1.1">world </span>, '!', null],
|
|
65
|
+
<span key="1.2">How are you?</span>,
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
expect(getChildrenAsLabel(nested)).toBe('Hello world !How are you?')
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
it('should concatenate the createPortal children', () => {
|
|
72
|
+
const nested = (
|
|
73
|
+
<>
|
|
74
|
+
{createPortal('Hello world', document.body)}
|
|
75
|
+
{createPortal(<span>!</span>, document.body)}
|
|
76
|
+
</>
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
expect(getChildrenAsLabel(nested)).toBe('Hello world!')
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
it('should ignore unsupported child types', () => {
|
|
83
|
+
const unsupported = (
|
|
84
|
+
<div>
|
|
85
|
+
<span>Hello </span>
|
|
86
|
+
{42}
|
|
87
|
+
{(() => { }) as any}
|
|
88
|
+
<>
|
|
89
|
+
<span>world </span>
|
|
90
|
+
</>
|
|
91
|
+
</div>
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
expect(getChildrenAsLabel(unsupported)).toBe('Hello 42world')
|
|
95
|
+
})
|
|
96
|
+
})
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { renderHook } from '@testing-library/react-hooks'
|
|
2
|
+
import { describe, expect, test } from 'vitest'
|
|
3
|
+
import { useId } from '../../src'
|
|
4
|
+
|
|
5
|
+
describe('@contember/utilities', () => {
|
|
6
|
+
test('useClassName', () => {
|
|
7
|
+
expect(renderHook(() => useId()).result.current).toBe(':a1:')
|
|
8
|
+
expect(renderHook(() => useId()).result.current).toBe(':a2:')
|
|
9
|
+
expect(renderHook(() => useId()).result.current).toBe(':a3:')
|
|
10
|
+
expect(renderHook(() => useId()).result.current).toBe(':a4:')
|
|
11
|
+
expect(renderHook(() => useId()).result.current).toBe(':a5:')
|
|
12
|
+
})
|
|
13
|
+
})
|
package/tsconfig.json
ADDED
package/tsdoc.json
ADDED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createContext.cjs","sources":["../../../src/context/createContext.ts"],"sourcesContent":["import type { Context } from 'react'\nimport { createContext as baseCreateContext, useContext } from 'react'\n\nexport function createContext<T>(name: string, initialValue: T): [Context<T>, () => T] {\n const OptionalContext = baseCreateContext<T>(initialValue)\n OptionalContext.displayName = name\n\n return [OptionalContext, () => useContext(OptionalContext)]\n}\n"],"names":["baseCreateContext","useContext"],"mappings":";;;AAGgB,SAAA,cAAiB,MAAc,cAAwC;AAC/E,QAAA,kBAAkBA,oBAAqB,YAAY;AACzD,kBAAgB,cAAc;AAE9B,SAAO,CAAC,iBAAiB,MAAMC,iBAAW,eAAe,CAAC;AAC5D;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createContext.js","sources":["../../../src/context/createContext.ts"],"sourcesContent":["import type { Context } from 'react'\nimport { createContext as baseCreateContext, useContext } from 'react'\n\nexport function createContext<T>(name: string, initialValue: T): [Context<T>, () => T] {\n const OptionalContext = baseCreateContext<T>(initialValue)\n OptionalContext.displayName = name\n\n return [OptionalContext, () => useContext(OptionalContext)]\n}\n"],"names":["baseCreateContext"],"mappings":";AAGgB,SAAA,cAAiB,MAAc,cAAwC;AAC/E,QAAA,kBAAkBA,gBAAqB,YAAY;AACzD,kBAAgB,cAAc;AAE9B,SAAO,CAAC,iBAAiB,MAAM,WAAW,eAAe,CAAC;AAC5D;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createRequiredContext.cjs","sources":["../../../src/context/createRequiredContext.ts"],"sourcesContent":["import type { Context } from 'react'\nimport { createContext, useContext } from 'react'\n\nconst EmptyContextSymbol = Symbol('EmptyContextSymbol')\n\nexport function createRequiredContext<T>(displayName: string): [Context<T>, () => T] {\n const RequiredContext = createContext<T>(EmptyContextSymbol as T)\n RequiredContext.displayName = displayName\n\n const useRequiredContext = (): T => {\n const context = useContext(RequiredContext)\n\n if (context === EmptyContextSymbol) {\n throw new Error(`use${displayName} must be used within a ${displayName} provider`)\n }\n\n return context\n }\n\n return [RequiredContext, useRequiredContext]\n}\n"],"names":["createContext","useContext"],"mappings":";;;AAGA,MAAM,qBAAqB,OAAO,oBAAoB;AAE/C,SAAS,sBAAyB,aAA4C;AAC7E,QAAA,kBAAkBA,oBAAiB,kBAAuB;AAChE,kBAAgB,cAAc;AAE9B,QAAM,qBAAqB,MAAS;AAC5B,UAAA,UAAUC,iBAAW,eAAe;AAE1C,QAAI,YAAY,oBAAoB;AAClC,YAAM,IAAI,MAAM,MAAM,WAAW,0BAA0B,WAAW,WAAW;AAAA,IACnF;AAEO,WAAA;AAAA,EAAA;AAGF,SAAA,CAAC,iBAAiB,kBAAkB;AAC7C;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createRequiredContext.js","sources":["../../../src/context/createRequiredContext.ts"],"sourcesContent":["import type { Context } from 'react'\nimport { createContext, useContext } from 'react'\n\nconst EmptyContextSymbol = Symbol('EmptyContextSymbol')\n\nexport function createRequiredContext<T>(displayName: string): [Context<T>, () => T] {\n const RequiredContext = createContext<T>(EmptyContextSymbol as T)\n RequiredContext.displayName = displayName\n\n const useRequiredContext = (): T => {\n const context = useContext(RequiredContext)\n\n if (context === EmptyContextSymbol) {\n throw new Error(`use${displayName} must be used within a ${displayName} provider`)\n }\n\n return context\n }\n\n return [RequiredContext, useRequiredContext]\n}\n"],"names":[],"mappings":";AAGA,MAAM,qBAAqB,OAAO,oBAAoB;AAE/C,SAAS,sBAAyB,aAA4C;AAC7E,QAAA,kBAAkB,cAAiB,kBAAuB;AAChE,kBAAgB,cAAc;AAE9B,QAAM,qBAAqB,MAAS;AAC5B,UAAA,UAAU,WAAW,eAAe;AAE1C,QAAI,YAAY,oBAAoB;AAClC,YAAM,IAAI,MAAM,MAAM,WAAW,0BAA0B,WAAW,WAAW;AAAA,IACnF;AAEO,WAAA;AAAA,EAAA;AAGF,SAAA,CAAC,iBAAiB,kBAAkB;AAC7C;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Constants.cjs","sources":["../../../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;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Constants.js","sources":["../../../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;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Context.cjs","sources":["../../../src/debug-context/Context.tsx"],"sourcesContent":["import { ReactNode, createContext, memo, useContext, useMemo, useRef } from 'react'\nimport { isNoopScopedConsole, noopScopedConsole } from './Constants'\nimport { ScopedConsoleContextType } from './Types'\n\nfunction createPrefixedConsole(message: string, prefixedConsole?: ScopedConsoleContextType): ScopedConsoleContextType {\n\treturn {\n\t\terror: function error(...parameters: any[]) {\n\t\t\t(prefixedConsole ?? console).error(message, ...parameters)\n\t\t},\n\t\terrored: function errored<T>(message: string, value: T): T {\n\t\t\t(prefixedConsole ?? console).error(message, value)\n\t\t\treturn value\n\t\t},\n\t\tlog: function log(...parameters: any[]) {\n\t\t\t(prefixedConsole ?? console).log(message, ...parameters)\n\t\t},\n\t\tlogged: function logged<T>(message: string, value: T): T {\n\t\t\t(prefixedConsole ?? console).log(message, value)\n\t\t\treturn value\n\t\t},\n\t\ttrace: function trace(...parameters: any[]) {\n\t\t\t(prefixedConsole ?? console).trace(message, ...parameters)\n\t\t},\n\t\ttraced: function traced<T>(message: string, value: T): T {\n\t\t\t(prefixedConsole ?? console).trace(message, value)\n\t\t\treturn value\n\t\t},\n\t\twarn: function warn(...parameters: any[]) {\n\t\t\t(prefixedConsole ?? console).warn(message, ...parameters)\n\t\t},\n\t\twarned: function warned<T>(message: string, value: T): T {\n\t\t\t(prefixedConsole ?? console).warn(message, value)\n\t\t\treturn value\n\t\t},\n\t}\n}\n\nexport const ScopedConsoleContext = createContext<ScopedConsoleContextType>(null!)\nScopedConsoleContext.displayName = 'ScopedConsoleContext'\n\nfunction parentScopedConsoleOrNone(parentConsole: ScopedConsoleContextType): ScopedConsoleContextType | undefined {\n\treturn isNoopScopedConsole(parentConsole) ? undefined : parentConsole\n}\n\nexport const useScopedConsoleRef = (prefix: string, override?: boolean) => {\n\tif (prefix.length === 0) {\n\t\tthrow new Error('Prefix must be non-empty string')\n\t}\n\tconst parentConsole = parentScopedConsoleOrNone(useContext(ScopedConsoleContext))\n\n\tconst scopedConsole = useMemo(() => {\n\t\tif (override !== false && (parentConsole || override)) {\n\t\t\treturn createPrefixedConsole(prefix, parentConsole)\n\t\t} else {\n\t\t\treturn noopScopedConsole\n\t\t}\n\t}, [override, parentConsole, prefix])\n\n\tconst ref = useRef(scopedConsole)\n\tref.current = scopedConsole\n\n\treturn ref\n}\n\nexport type DebugChildrenProps =\n\t| { active?: true; children: ReactNode; id: string }\n\t| { active?: false; children: ReactNode; id?: string }\n\nexport const DebugChildren = memo<DebugChildrenProps>(({ active = true, children, id }) => {\n\tconst parentScopedConsole = parentScopedConsoleOrNone(useContext(ScopedConsoleContext))\n\n\tconst console = active && id\n\t\t? createPrefixedConsole(id, parentScopedConsole)\n\t\t: noopScopedConsole\n\n\treturn (\n\t\t<ScopedConsoleContext.Provider value={active ? console : noopScopedConsole}>\n\t\t\t{children}\n\t\t</ScopedConsoleContext.Provider>\n\t)\n})\nDebugChildren.displayName = 'DebugChildren'\n"],"names":["message","createContext","isNoopScopedConsole","useContext","useMemo","noopScopedConsole","useRef","memo","console","jsxDEV","this"],"mappings":";;;;;AAIA,SAAS,sBAAsB,SAAiB,iBAAsE;AAC9G,SAAA;AAAA,IACN,OAAO,SAAS,SAAS,YAAmB;AAC3C,OAAC,mBAAmB,SAAS,MAAM,SAAS,GAAG,UAAU;AAAA,IAC1D;AAAA,IACA,SAAS,SAAS,QAAWA,UAAiB,OAAa;AAC1D,OAAC,mBAAmB,SAAS,MAAMA,UAAS,KAAK;AAC1C,aAAA;AAAA,IACR;AAAA,IACA,KAAK,SAAS,OAAO,YAAmB;AACvC,OAAC,mBAAmB,SAAS,IAAI,SAAS,GAAG,UAAU;AAAA,IACxD;AAAA,IACA,QAAQ,SAAS,OAAUA,UAAiB,OAAa;AACxD,OAAC,mBAAmB,SAAS,IAAIA,UAAS,KAAK;AACxC,aAAA;AAAA,IACR;AAAA,IACA,OAAO,SAAS,SAAS,YAAmB;AAC3C,OAAC,mBAAmB,SAAS,MAAM,SAAS,GAAG,UAAU;AAAA,IAC1D;AAAA,IACA,QAAQ,SAAS,OAAUA,UAAiB,OAAa;AACxD,OAAC,mBAAmB,SAAS,MAAMA,UAAS,KAAK;AAC1C,aAAA;AAAA,IACR;AAAA,IACA,MAAM,SAAS,QAAQ,YAAmB;AACzC,OAAC,mBAAmB,SAAS,KAAK,SAAS,GAAG,UAAU;AAAA,IACzD;AAAA,IACA,QAAQ,SAAS,OAAUA,UAAiB,OAAa;AACxD,OAAC,mBAAmB,SAAS,KAAKA,UAAS,KAAK;AACzC,aAAA;AAAA,IACR;AAAA,EAAA;AAEF;AAEa,MAAA,uBAAuBC,oBAAwC,IAAK;AACjF,qBAAqB,cAAc;AAEnC,SAAS,0BAA0B,eAA+E;AAC1G,SAAAC,UAAA,oBAAoB,aAAa,IAAI,SAAY;AACzD;AAEa,MAAA,sBAAsB,CAAC,QAAgB,aAAuB;AACtE,MAAA,OAAO,WAAW,GAAG;AAClB,UAAA,IAAI,MAAM,iCAAiC;AAAA,EAClD;AACA,QAAM,gBAAgB,0BAA0BC,iBAAW,oBAAoB,CAAC;AAE1E,QAAA,gBAAgBC,MAAAA,QAAQ,MAAM;AAC/B,QAAA,aAAa,UAAU,iBAAiB,WAAW;AAC/C,aAAA,sBAAsB,QAAQ,aAAa;AAAA,IAAA,OAC5C;AACC,aAAAC;IACR;AAAA,EACE,GAAA,CAAC,UAAU,eAAe,MAAM,CAAC;AAE9B,QAAA,MAAMC,aAAO,aAAa;AAChC,MAAI,UAAU;AAEP,SAAA;AACR;AAMa,MAAA,gBAAgBC,WAAyB,CAAC,EAAE,SAAS,MAAM,UAAU,SAAS;AAC1F,QAAM,sBAAsB,0BAA0BJ,iBAAW,oBAAoB,CAAC;AAEtF,QAAMK,WAAU,UAAU,KACvB,sBAAsB,IAAI,mBAAmB,IAC7CH;AAGF,SAAAI,qCAAC,qBAAqB,UAArB,EAA8B,OAAO,SAASD,WAAUH,6BACvD,SADF,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAEA,GAAAK,MAAA;AAEF,CAAC;AACD,cAAc,cAAc;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Context.js","sources":["../../../src/debug-context/Context.tsx"],"sourcesContent":["import { ReactNode, createContext, memo, useContext, useMemo, useRef } from 'react'\nimport { isNoopScopedConsole, noopScopedConsole } from './Constants'\nimport { ScopedConsoleContextType } from './Types'\n\nfunction createPrefixedConsole(message: string, prefixedConsole?: ScopedConsoleContextType): ScopedConsoleContextType {\n\treturn {\n\t\terror: function error(...parameters: any[]) {\n\t\t\t(prefixedConsole ?? console).error(message, ...parameters)\n\t\t},\n\t\terrored: function errored<T>(message: string, value: T): T {\n\t\t\t(prefixedConsole ?? console).error(message, value)\n\t\t\treturn value\n\t\t},\n\t\tlog: function log(...parameters: any[]) {\n\t\t\t(prefixedConsole ?? console).log(message, ...parameters)\n\t\t},\n\t\tlogged: function logged<T>(message: string, value: T): T {\n\t\t\t(prefixedConsole ?? console).log(message, value)\n\t\t\treturn value\n\t\t},\n\t\ttrace: function trace(...parameters: any[]) {\n\t\t\t(prefixedConsole ?? console).trace(message, ...parameters)\n\t\t},\n\t\ttraced: function traced<T>(message: string, value: T): T {\n\t\t\t(prefixedConsole ?? console).trace(message, value)\n\t\t\treturn value\n\t\t},\n\t\twarn: function warn(...parameters: any[]) {\n\t\t\t(prefixedConsole ?? console).warn(message, ...parameters)\n\t\t},\n\t\twarned: function warned<T>(message: string, value: T): T {\n\t\t\t(prefixedConsole ?? console).warn(message, value)\n\t\t\treturn value\n\t\t},\n\t}\n}\n\nexport const ScopedConsoleContext = createContext<ScopedConsoleContextType>(null!)\nScopedConsoleContext.displayName = 'ScopedConsoleContext'\n\nfunction parentScopedConsoleOrNone(parentConsole: ScopedConsoleContextType): ScopedConsoleContextType | undefined {\n\treturn isNoopScopedConsole(parentConsole) ? undefined : parentConsole\n}\n\nexport const useScopedConsoleRef = (prefix: string, override?: boolean) => {\n\tif (prefix.length === 0) {\n\t\tthrow new Error('Prefix must be non-empty string')\n\t}\n\tconst parentConsole = parentScopedConsoleOrNone(useContext(ScopedConsoleContext))\n\n\tconst scopedConsole = useMemo(() => {\n\t\tif (override !== false && (parentConsole || override)) {\n\t\t\treturn createPrefixedConsole(prefix, parentConsole)\n\t\t} else {\n\t\t\treturn noopScopedConsole\n\t\t}\n\t}, [override, parentConsole, prefix])\n\n\tconst ref = useRef(scopedConsole)\n\tref.current = scopedConsole\n\n\treturn ref\n}\n\nexport type DebugChildrenProps =\n\t| { active?: true; children: ReactNode; id: string }\n\t| { active?: false; children: ReactNode; id?: string }\n\nexport const DebugChildren = memo<DebugChildrenProps>(({ active = true, children, id }) => {\n\tconst parentScopedConsole = parentScopedConsoleOrNone(useContext(ScopedConsoleContext))\n\n\tconst console = active && id\n\t\t? createPrefixedConsole(id, parentScopedConsole)\n\t\t: noopScopedConsole\n\n\treturn (\n\t\t<ScopedConsoleContext.Provider value={active ? console : noopScopedConsole}>\n\t\t\t{children}\n\t\t</ScopedConsoleContext.Provider>\n\t)\n})\nDebugChildren.displayName = 'DebugChildren'\n"],"names":["message","console","this"],"mappings":";;;AAIA,SAAS,sBAAsB,SAAiB,iBAAsE;AAC9G,SAAA;AAAA,IACN,OAAO,SAAS,SAAS,YAAmB;AAC3C,OAAC,mBAAmB,SAAS,MAAM,SAAS,GAAG,UAAU;AAAA,IAC1D;AAAA,IACA,SAAS,SAAS,QAAWA,UAAiB,OAAa;AAC1D,OAAC,mBAAmB,SAAS,MAAMA,UAAS,KAAK;AAC1C,aAAA;AAAA,IACR;AAAA,IACA,KAAK,SAAS,OAAO,YAAmB;AACvC,OAAC,mBAAmB,SAAS,IAAI,SAAS,GAAG,UAAU;AAAA,IACxD;AAAA,IACA,QAAQ,SAAS,OAAUA,UAAiB,OAAa;AACxD,OAAC,mBAAmB,SAAS,IAAIA,UAAS,KAAK;AACxC,aAAA;AAAA,IACR;AAAA,IACA,OAAO,SAAS,SAAS,YAAmB;AAC3C,OAAC,mBAAmB,SAAS,MAAM,SAAS,GAAG,UAAU;AAAA,IAC1D;AAAA,IACA,QAAQ,SAAS,OAAUA,UAAiB,OAAa;AACxD,OAAC,mBAAmB,SAAS,MAAMA,UAAS,KAAK;AAC1C,aAAA;AAAA,IACR;AAAA,IACA,MAAM,SAAS,QAAQ,YAAmB;AACzC,OAAC,mBAAmB,SAAS,KAAK,SAAS,GAAG,UAAU;AAAA,IACzD;AAAA,IACA,QAAQ,SAAS,OAAUA,UAAiB,OAAa;AACxD,OAAC,mBAAmB,SAAS,KAAKA,UAAS,KAAK;AACzC,aAAA;AAAA,IACR;AAAA,EAAA;AAEF;AAEa,MAAA,uBAAuB,cAAwC,IAAK;AACjF,qBAAqB,cAAc;AAEnC,SAAS,0BAA0B,eAA+E;AAC1G,SAAA,oBAAoB,aAAa,IAAI,SAAY;AACzD;AAEa,MAAA,sBAAsB,CAAC,QAAgB,aAAuB;AACtE,MAAA,OAAO,WAAW,GAAG;AAClB,UAAA,IAAI,MAAM,iCAAiC;AAAA,EAClD;AACA,QAAM,gBAAgB,0BAA0B,WAAW,oBAAoB,CAAC;AAE1E,QAAA,gBAAgB,QAAQ,MAAM;AAC/B,QAAA,aAAa,UAAU,iBAAiB,WAAW;AAC/C,aAAA,sBAAsB,QAAQ,aAAa;AAAA,IAAA,OAC5C;AACC,aAAA;AAAA,IACR;AAAA,EACE,GAAA,CAAC,UAAU,eAAe,MAAM,CAAC;AAE9B,QAAA,MAAM,OAAO,aAAa;AAChC,MAAI,UAAU;AAEP,SAAA;AACR;AAMa,MAAA,gBAAgB,KAAyB,CAAC,EAAE,SAAS,MAAM,UAAU,SAAS;AAC1F,QAAM,sBAAsB,0BAA0B,WAAW,oBAAoB,CAAC;AAEtF,QAAMC,WAAU,UAAU,KACvB,sBAAsB,IAAI,mBAAmB,IAC7C;AAGF,SAAA,uBAAC,qBAAqB,UAArB,EAA8B,OAAO,SAASA,WAAU,mBACvD,SADF,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAEA,GAAAC,MAAA;AAEF,CAAC;AACD,cAAc,cAAc;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unwrapRefValue.cjs","sources":["../../../src/hooks/unwrapRefValue.ts"],"sourcesContent":["import { RefObject } from 'react'\n\nexport type RefObjectOrElement<T> = T | RefObject<T>\n\n/**\n * Unwraps a ref object or returns the value if it is not a ref object.\n * @param value - Value to unwrap\n * @returns Unwrapped value\n */\nexport function unwrapRefValue<T>(value: RefObjectOrElement<T>): T | null {\n\tif (value && typeof value === 'object' && 'current' in value) {\n\t\treturn value.current\n\t} else {\n\t\treturn value\n\t}\n}\n"],"names":[],"mappings":";;AASO,SAAS,eAAkB,OAAwC;AACzE,MAAI,SAAS,OAAO,UAAU,YAAY,aAAa,OAAO;AAC7D,WAAO,MAAM;AAAA,EAAA,OACP;AACC,WAAA;AAAA,EACR;AACD;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unwrapRefValue.js","sources":["../../../src/hooks/unwrapRefValue.ts"],"sourcesContent":["import { RefObject } from 'react'\n\nexport type RefObjectOrElement<T> = T | RefObject<T>\n\n/**\n * Unwraps a ref object or returns the value if it is not a ref object.\n * @param value - Value to unwrap\n * @returns Unwrapped value\n */\nexport function unwrapRefValue<T>(value: RefObjectOrElement<T>): T | null {\n\tif (value && typeof value === 'object' && 'current' in value) {\n\t\treturn value.current\n\t} else {\n\t\treturn value\n\t}\n}\n"],"names":[],"mappings":"AASO,SAAS,eAAkB,OAAwC;AACzE,MAAI,SAAS,OAAO,UAAU,YAAY,aAAa,OAAO;AAC7D,WAAO,MAAM;AAAA,EAAA,OACP;AACC,WAAA;AAAA,EACR;AACD;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAbortController.cjs","sources":["../../../src/hooks/useAbortController.ts"],"sourcesContent":["import { useCallback, useEffect, useRef } from 'react'\n\nexport const useAbortController = () => {\n\tconst lastAbortControllerRef = useRef<AbortController | undefined>(undefined)\n\tuseEffect(() => () => {\n\t\tlastAbortControllerRef.current?.abort()\n\t}, [])\n\treturn useCallback((): AbortSignal => {\n\t\tlastAbortControllerRef.current?.abort()\n\n\t\tconst newController = new AbortController()\n\t\tlastAbortControllerRef.current = newController\n\t\treturn newController.signal\n\t}, [])\n}\n"],"names":["useRef","useEffect","useCallback"],"mappings":";;;AAEO,MAAM,qBAAqB,MAAM;AACjC,QAAA,yBAAyBA,MAAAA,OAAoC,MAAS;AAC5EC,QAAAA,UAAU,MAAM,MAAM;AACrB,2BAAuB,SAAS;EACjC,GAAG,CAAE,CAAA;AACL,SAAOC,kBAAY,MAAmB;AACrC,2BAAuB,SAAS;AAE1B,UAAA,gBAAgB,IAAI;AAC1B,2BAAuB,UAAU;AACjC,WAAO,cAAc;AAAA,EACtB,GAAG,CAAE,CAAA;AACN;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAbortController.js","sources":["../../../src/hooks/useAbortController.ts"],"sourcesContent":["import { useCallback, useEffect, useRef } from 'react'\n\nexport const useAbortController = () => {\n\tconst lastAbortControllerRef = useRef<AbortController | undefined>(undefined)\n\tuseEffect(() => () => {\n\t\tlastAbortControllerRef.current?.abort()\n\t}, [])\n\treturn useCallback((): AbortSignal => {\n\t\tlastAbortControllerRef.current?.abort()\n\n\t\tconst newController = new AbortController()\n\t\tlastAbortControllerRef.current = newController\n\t\treturn newController.signal\n\t}, [])\n}\n"],"names":[],"mappings":";AAEO,MAAM,qBAAqB,MAAM;AACjC,QAAA,yBAAyB,OAAoC,MAAS;AAC5E,YAAU,MAAM,MAAM;AACrB,2BAAuB,SAAS;EACjC,GAAG,CAAE,CAAA;AACL,SAAO,YAAY,MAAmB;AACrC,2BAAuB,SAAS;AAE1B,UAAA,gBAAgB,IAAI;AAC1B,2BAAuB,UAAU;AACjC,WAAO,cAAc;AAAA,EACtB,GAAG,CAAE,CAAA;AACN;"}
|
|
@@ -1,32 +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
|
-
const useReferentiallyStableCallback = require("../referentiallyStable/useReferentiallyStableCallback.cjs");
|
|
6
|
-
function addClassName(className, element) {
|
|
7
|
-
if (element.classList.contains(className)) {
|
|
8
|
-
element.classList.remove(className);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
function removeClassName(className, element) {
|
|
12
|
-
if (!element.classList.contains(className)) {
|
|
13
|
-
element.classList.add(className);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
function useAddClassNameDuringResize(className, timeoutToRestore = 300, element) {
|
|
17
|
-
const timeoutID = react.useRef();
|
|
18
|
-
const addTemporaryClassName = useReferentiallyStableCallback.useReferentiallyStableCallback(() => {
|
|
19
|
-
clearTimeout(timeoutID.current);
|
|
20
|
-
removeClassName(className, element ?? document.body);
|
|
21
|
-
timeoutID.current = setTimeout(() => {
|
|
22
|
-
addClassName(className, element ?? document.body);
|
|
23
|
-
}, timeoutToRestore);
|
|
24
|
-
return () => {
|
|
25
|
-
clearTimeout(timeoutID.current);
|
|
26
|
-
};
|
|
27
|
-
});
|
|
28
|
-
react.useLayoutEffect(addTemporaryClassName, [addTemporaryClassName]);
|
|
29
|
-
useOnWindowResize.useOnWindowResize(addTemporaryClassName);
|
|
30
|
-
}
|
|
31
|
-
exports.useAddClassNameDuringResize = useAddClassNameDuringResize;
|
|
32
|
-
//# sourceMappingURL=useAddClassNameDuringResize.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAddClassNameDuringResize.cjs","sources":["../../../src/hooks/useAddClassNameDuringResize.ts"],"sourcesContent":["import { useLayoutEffect, useRef } from 'react'\nimport { useReferentiallyStableCallback } from '../referentiallyStable'\nimport { useOnWindowResize } from './useOnWindowResize'\n\nfunction addClassName(\n\tclassName: string,\n\telement: HTMLElement,\n) {\n\tif (element.classList.contains(className)) {\n\t\telement.classList.remove(className)\n\t}\n}\n\nfunction removeClassName(\n\tclassName: string,\n\telement: HTMLElement,\n) {\n\tif (!element.classList.contains(className)) {\n\t\telement.classList.add(className)\n\t}\n}\n\n/**\n * Adds CSS class during resize event to element\n *\n * - Falls back to document.body when no element is specified\n * - Adds CSS class to element also on the initial load\n * - Uses element.classList directly\n *\n * @param className - CSS class to apply during the resize event\n * @param timeoutToRestore - Timeout in milliseconds to wait before finally removing the CSS class\n * @param element - Optional HTML element to apply CSS class to\n */\nexport function useAddClassNameDuringResize(\n\tclassName: string,\n\ttimeoutToRestore: number = 300,\n\telement?: HTMLElement,\n) {\n\tconst timeoutID = useRef<number>()\n\n\tconst addTemporaryClassName = useReferentiallyStableCallback(() => {\n\t\tclearTimeout(timeoutID.current)\n\t\tremoveClassName(className, element ?? document.body)\n\n\t\ttimeoutID.current = setTimeout(() => {\n\t\t\taddClassName(className, element ?? document.body)\n\t\t}, timeoutToRestore)\n\n\t\treturn () => {\n\t\t\tclearTimeout(timeoutID.current)\n\t\t}\n\t})\n\n\tuseLayoutEffect(addTemporaryClassName, [addTemporaryClassName])\n\tuseOnWindowResize(addTemporaryClassName)\n}\n"],"names":["useRef","useReferentiallyStableCallback","useLayoutEffect","useOnWindowResize"],"mappings":";;;;;AAIA,SAAS,aACR,WACA,SACC;AACD,MAAI,QAAQ,UAAU,SAAS,SAAS,GAAG;AAClC,YAAA,UAAU,OAAO,SAAS;AAAA,EACnC;AACD;AAEA,SAAS,gBACR,WACA,SACC;AACD,MAAI,CAAC,QAAQ,UAAU,SAAS,SAAS,GAAG;AACnC,YAAA,UAAU,IAAI,SAAS;AAAA,EAChC;AACD;AAaO,SAAS,4BACf,WACA,mBAA2B,KAC3B,SACC;AACD,QAAM,YAAYA,MAAAA;AAEZ,QAAA,wBAAwBC,+BAAAA,+BAA+B,MAAM;AAClE,iBAAa,UAAU,OAAO;AACd,oBAAA,WAAW,WAAW,SAAS,IAAI;AAEzC,cAAA,UAAU,WAAW,MAAM;AACvB,mBAAA,WAAW,WAAW,SAAS,IAAI;AAAA,OAC9C,gBAAgB;AAEnB,WAAO,MAAM;AACZ,mBAAa,UAAU,OAAO;AAAA,IAAA;AAAA,EAC/B,CACA;AAEeC,QAAAA,gBAAA,uBAAuB,CAAC,qBAAqB,CAAC;AAC9DC,oBAAA,kBAAkB,qBAAqB;AACxC;;"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { useRef, useLayoutEffect } from "react";
|
|
2
|
-
import { useOnWindowResize } from "./useOnWindowResize.js";
|
|
3
|
-
import { useReferentiallyStableCallback } from "../referentiallyStable/useReferentiallyStableCallback.js";
|
|
4
|
-
function addClassName(className, element) {
|
|
5
|
-
if (element.classList.contains(className)) {
|
|
6
|
-
element.classList.remove(className);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
function removeClassName(className, element) {
|
|
10
|
-
if (!element.classList.contains(className)) {
|
|
11
|
-
element.classList.add(className);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
function useAddClassNameDuringResize(className, timeoutToRestore = 300, element) {
|
|
15
|
-
const timeoutID = useRef();
|
|
16
|
-
const addTemporaryClassName = useReferentiallyStableCallback(() => {
|
|
17
|
-
clearTimeout(timeoutID.current);
|
|
18
|
-
removeClassName(className, element ?? document.body);
|
|
19
|
-
timeoutID.current = setTimeout(() => {
|
|
20
|
-
addClassName(className, element ?? document.body);
|
|
21
|
-
}, timeoutToRestore);
|
|
22
|
-
return () => {
|
|
23
|
-
clearTimeout(timeoutID.current);
|
|
24
|
-
};
|
|
25
|
-
});
|
|
26
|
-
useLayoutEffect(addTemporaryClassName, [addTemporaryClassName]);
|
|
27
|
-
useOnWindowResize(addTemporaryClassName);
|
|
28
|
-
}
|
|
29
|
-
export {
|
|
30
|
-
useAddClassNameDuringResize
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=useAddClassNameDuringResize.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAddClassNameDuringResize.js","sources":["../../../src/hooks/useAddClassNameDuringResize.ts"],"sourcesContent":["import { useLayoutEffect, useRef } from 'react'\nimport { useReferentiallyStableCallback } from '../referentiallyStable'\nimport { useOnWindowResize } from './useOnWindowResize'\n\nfunction addClassName(\n\tclassName: string,\n\telement: HTMLElement,\n) {\n\tif (element.classList.contains(className)) {\n\t\telement.classList.remove(className)\n\t}\n}\n\nfunction removeClassName(\n\tclassName: string,\n\telement: HTMLElement,\n) {\n\tif (!element.classList.contains(className)) {\n\t\telement.classList.add(className)\n\t}\n}\n\n/**\n * Adds CSS class during resize event to element\n *\n * - Falls back to document.body when no element is specified\n * - Adds CSS class to element also on the initial load\n * - Uses element.classList directly\n *\n * @param className - CSS class to apply during the resize event\n * @param timeoutToRestore - Timeout in milliseconds to wait before finally removing the CSS class\n * @param element - Optional HTML element to apply CSS class to\n */\nexport function useAddClassNameDuringResize(\n\tclassName: string,\n\ttimeoutToRestore: number = 300,\n\telement?: HTMLElement,\n) {\n\tconst timeoutID = useRef<number>()\n\n\tconst addTemporaryClassName = useReferentiallyStableCallback(() => {\n\t\tclearTimeout(timeoutID.current)\n\t\tremoveClassName(className, element ?? document.body)\n\n\t\ttimeoutID.current = setTimeout(() => {\n\t\t\taddClassName(className, element ?? document.body)\n\t\t}, timeoutToRestore)\n\n\t\treturn () => {\n\t\t\tclearTimeout(timeoutID.current)\n\t\t}\n\t})\n\n\tuseLayoutEffect(addTemporaryClassName, [addTemporaryClassName])\n\tuseOnWindowResize(addTemporaryClassName)\n}\n"],"names":[],"mappings":";;;AAIA,SAAS,aACR,WACA,SACC;AACD,MAAI,QAAQ,UAAU,SAAS,SAAS,GAAG;AAClC,YAAA,UAAU,OAAO,SAAS;AAAA,EACnC;AACD;AAEA,SAAS,gBACR,WACA,SACC;AACD,MAAI,CAAC,QAAQ,UAAU,SAAS,SAAS,GAAG;AACnC,YAAA,UAAU,IAAI,SAAS;AAAA,EAChC;AACD;AAaO,SAAS,4BACf,WACA,mBAA2B,KAC3B,SACC;AACD,QAAM,YAAY;AAEZ,QAAA,wBAAwB,+BAA+B,MAAM;AAClE,iBAAa,UAAU,OAAO;AACd,oBAAA,WAAW,WAAW,SAAS,IAAI;AAEzC,cAAA,UAAU,WAAW,MAAM;AACvB,mBAAA,WAAW,WAAW,SAAS,IAAI;AAAA,OAC9C,gBAAgB;AAEnB,WAAO,MAAM;AACZ,mBAAa,UAAU,OAAO;AAAA,IAAA;AAAA,EAC/B,CACA;AAEe,kBAAA,uBAAuB,CAAC,qBAAqB,CAAC;AAC9D,oBAAkB,qBAAqB;AACxC;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useArrayMapMemo.cjs","sources":["../../../src/hooks/useArrayMapMemo.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport { useConstantLengthInvariant } from './useConstantLengthInvariant'\n\n/**\n * ⚠️ ONLY USE THIS IF YOU *REALLY* KNOW WHAT YOU'RE DOING! ⚠️\n * ⚠ HERE BE DRAGONS THAT KNOW WHERE YOU LIVE! ⚠\n *\n * This is a bit of React naughtiness that allows us to memoize outputs of Array.prototype.map() based on the contents\n * of the original array, and not its referential equality. That way, if we create a new array with identical items,\n * we get an array that is referentially equal to the previous one.\n */\nexport const useArrayMapMemo = <Item, OutputItem>(\n\titems: Item[],\n\tmap: (value: Item, index: number, array: Item[]) => OutputItem,\n): OutputItem[] => {\n\tuseConstantLengthInvariant(items)\n\n\t// This is tricky. We don't want to exclude the map function from the dependency list because if it changes but the\n\t// items array remains the same, we still want to re-compute the new array. However, if that yields the same array,\n\t// in the sense that the items are identical, albeit computed via a different map function, we still want to\n\t// preserve the referential equality of the original. Hence the second memo.\n\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\tconst mapped = useMemo(() => items.map(map), [map, ...items])\n\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\treturn useMemo(() => mapped, mapped) // This is deliberately not `[mapped]`\n}\n"],"names":["useConstantLengthInvariant","useMemo"],"mappings":";;;;AAWa,MAAA,kBAAkB,CAC9B,OACA,QACkB;AAClBA,6BAAA,2BAA2B,KAAK;AAQ1B,QAAA,SAASC,MAAAA,QAAQ,MAAM,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;AAGrD,SAAAA,cAAQ,MAAM,QAAQ,MAAM;AACpC;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useArrayMapMemo.js","sources":["../../../src/hooks/useArrayMapMemo.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport { useConstantLengthInvariant } from './useConstantLengthInvariant'\n\n/**\n * ⚠️ ONLY USE THIS IF YOU *REALLY* KNOW WHAT YOU'RE DOING! ⚠️\n * ⚠ HERE BE DRAGONS THAT KNOW WHERE YOU LIVE! ⚠\n *\n * This is a bit of React naughtiness that allows us to memoize outputs of Array.prototype.map() based on the contents\n * of the original array, and not its referential equality. That way, if we create a new array with identical items,\n * we get an array that is referentially equal to the previous one.\n */\nexport const useArrayMapMemo = <Item, OutputItem>(\n\titems: Item[],\n\tmap: (value: Item, index: number, array: Item[]) => OutputItem,\n): OutputItem[] => {\n\tuseConstantLengthInvariant(items)\n\n\t// This is tricky. We don't want to exclude the map function from the dependency list because if it changes but the\n\t// items array remains the same, we still want to re-compute the new array. However, if that yields the same array,\n\t// in the sense that the items are identical, albeit computed via a different map function, we still want to\n\t// preserve the referential equality of the original. Hence the second memo.\n\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\tconst mapped = useMemo(() => items.map(map), [map, ...items])\n\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\treturn useMemo(() => mapped, mapped) // This is deliberately not `[mapped]`\n}\n"],"names":[],"mappings":";;AAWa,MAAA,kBAAkB,CAC9B,OACA,QACkB;AAClB,6BAA2B,KAAK;AAQ1B,QAAA,SAAS,QAAQ,MAAM,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;AAGrD,SAAA,QAAQ,MAAM,QAAQ,MAAM;AACpC;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAutoHeightTextArea.cjs","sources":["../../../src/hooks/useAutoHeightTextArea.ts"],"sourcesContent":["import { px } from '@contember/utilities'\nimport { useCallback, useLayoutEffect } from 'react'\nimport { RefObjectOrElement, unwrapRefValue } from './unwrapRefValue'\nimport { useOnElementResize } from './useOnElementResize'\n\nexport const useAutoHeightTextArea = (\n\ttextAreaRef: RefObjectOrElement<HTMLTextAreaElement>,\n\tvalue: string,\n\tminRows: number,\n\tmaxRows: number,\n) => {\n\tconst measure = useCallback(async (ref: HTMLTextAreaElement | null, minRows: number, maxRows: number) => {\n\t\tif (ref) {\n\t\t\tconst rowsAttribute = ref.rows\n\n\t\t\tref.style.height = ''\n\t\t\tref.style.minHeight = ''\n\t\t\tref.style.maxHeight = ''\n\n\t\t\tif (minRows !== maxRows) {\n\t\t\t\tconst height = ref.scrollHeight - ref.clientHeight + ref.offsetHeight\n\t\t\t\tlet minHeight: number\n\t\t\t\tlet maxHeight: number\n\n\t\t\t\tref.rows = minRows\n\t\t\t\tminHeight = await ref.getBoundingClientRect().height\n\n\t\t\t\tif (maxRows === Infinity) {\n\t\t\t\t\tmaxHeight = Infinity\n\t\t\t\t} else {\n\t\t\t\t\tref.rows = maxRows\n\t\t\t\t\tmaxHeight = await ref.getBoundingClientRect().height\n\t\t\t\t}\n\n\t\t\t\tref.style.height = px(height)\n\t\t\t\tref.style.minHeight = px(minHeight)\n\t\t\t\tref.style.maxHeight = px(maxHeight)\n\t\t\t}\n\n\t\t\tref.rows = rowsAttribute\n\t\t}\n\t}, [])\n\n\tuseOnElementResize(textAreaRef, () => {\n\t\tmeasure(unwrapRefValue(textAreaRef), minRows, maxRows)\n\t})\n\n\tuseLayoutEffect(() => {\n\t\tmeasure(unwrapRefValue(textAreaRef), minRows, maxRows)\n\t}, [maxRows, measure, minRows, textAreaRef, value])\n}\n"],"names":["useCallback","minRows","maxRows","px","useOnElementResize","unwrapRefValue","useLayoutEffect"],"mappings":";;;;;;AAKO,MAAM,wBAAwB,CACpC,aACA,OACA,SACA,YACI;AACJ,QAAM,UAAUA,MAAA,YAAY,OAAO,KAAiCC,UAAiBC,aAAoB;AACxG,QAAI,KAAK;AACR,YAAM,gBAAgB,IAAI;AAE1B,UAAI,MAAM,SAAS;AACnB,UAAI,MAAM,YAAY;AACtB,UAAI,MAAM,YAAY;AAEtB,UAAID,aAAYC,UAAS;AACxB,cAAM,SAAS,IAAI,eAAe,IAAI,eAAe,IAAI;AACrD,YAAA;AACA,YAAA;AAEJ,YAAI,OAAOD;AACC,oBAAA,MAAM,IAAI,sBAAA,EAAwB;AAE9C,YAAIC,aAAY,UAAU;AACb,sBAAA;AAAA,QAAA,OACN;AACN,cAAI,OAAOA;AACC,sBAAA,MAAM,IAAI,sBAAA,EAAwB;AAAA,QAC/C;AAEI,YAAA,MAAM,SAASC,UAAA,GAAG,MAAM;AACxB,YAAA,MAAM,YAAYA,UAAA,GAAG,SAAS;AAC9B,YAAA,MAAM,YAAYA,UAAA,GAAG,SAAS;AAAA,MACnC;AAEA,UAAI,OAAO;AAAA,IACZ;AAAA,EACD,GAAG,CAAE,CAAA;AAELC,qBAAA,mBAAmB,aAAa,MAAM;AACrC,YAAQC,eAAAA,eAAe,WAAW,GAAG,SAAS,OAAO;AAAA,EAAA,CACrD;AAEDC,QAAAA,gBAAgB,MAAM;AACrB,YAAQD,eAAAA,eAAe,WAAW,GAAG,SAAS,OAAO;AAAA,EAAA,GACnD,CAAC,SAAS,SAAS,SAAS,aAAa,KAAK,CAAC;AACnD;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAutoHeightTextArea.js","sources":["../../../src/hooks/useAutoHeightTextArea.ts"],"sourcesContent":["import { px } from '@contember/utilities'\nimport { useCallback, useLayoutEffect } from 'react'\nimport { RefObjectOrElement, unwrapRefValue } from './unwrapRefValue'\nimport { useOnElementResize } from './useOnElementResize'\n\nexport const useAutoHeightTextArea = (\n\ttextAreaRef: RefObjectOrElement<HTMLTextAreaElement>,\n\tvalue: string,\n\tminRows: number,\n\tmaxRows: number,\n) => {\n\tconst measure = useCallback(async (ref: HTMLTextAreaElement | null, minRows: number, maxRows: number) => {\n\t\tif (ref) {\n\t\t\tconst rowsAttribute = ref.rows\n\n\t\t\tref.style.height = ''\n\t\t\tref.style.minHeight = ''\n\t\t\tref.style.maxHeight = ''\n\n\t\t\tif (minRows !== maxRows) {\n\t\t\t\tconst height = ref.scrollHeight - ref.clientHeight + ref.offsetHeight\n\t\t\t\tlet minHeight: number\n\t\t\t\tlet maxHeight: number\n\n\t\t\t\tref.rows = minRows\n\t\t\t\tminHeight = await ref.getBoundingClientRect().height\n\n\t\t\t\tif (maxRows === Infinity) {\n\t\t\t\t\tmaxHeight = Infinity\n\t\t\t\t} else {\n\t\t\t\t\tref.rows = maxRows\n\t\t\t\t\tmaxHeight = await ref.getBoundingClientRect().height\n\t\t\t\t}\n\n\t\t\t\tref.style.height = px(height)\n\t\t\t\tref.style.minHeight = px(minHeight)\n\t\t\t\tref.style.maxHeight = px(maxHeight)\n\t\t\t}\n\n\t\t\tref.rows = rowsAttribute\n\t\t}\n\t}, [])\n\n\tuseOnElementResize(textAreaRef, () => {\n\t\tmeasure(unwrapRefValue(textAreaRef), minRows, maxRows)\n\t})\n\n\tuseLayoutEffect(() => {\n\t\tmeasure(unwrapRefValue(textAreaRef), minRows, maxRows)\n\t}, [maxRows, measure, minRows, textAreaRef, value])\n}\n"],"names":["minRows","maxRows"],"mappings":";;;;AAKO,MAAM,wBAAwB,CACpC,aACA,OACA,SACA,YACI;AACJ,QAAM,UAAU,YAAY,OAAO,KAAiCA,UAAiBC,aAAoB;AACxG,QAAI,KAAK;AACR,YAAM,gBAAgB,IAAI;AAE1B,UAAI,MAAM,SAAS;AACnB,UAAI,MAAM,YAAY;AACtB,UAAI,MAAM,YAAY;AAEtB,UAAID,aAAYC,UAAS;AACxB,cAAM,SAAS,IAAI,eAAe,IAAI,eAAe,IAAI;AACrD,YAAA;AACA,YAAA;AAEJ,YAAI,OAAOD;AACC,oBAAA,MAAM,IAAI,sBAAA,EAAwB;AAE9C,YAAIC,aAAY,UAAU;AACb,sBAAA;AAAA,QAAA,OACN;AACN,cAAI,OAAOA;AACC,sBAAA,MAAM,IAAI,sBAAA,EAAwB;AAAA,QAC/C;AAEI,YAAA,MAAM,SAAS,GAAG,MAAM;AACxB,YAAA,MAAM,YAAY,GAAG,SAAS;AAC9B,YAAA,MAAM,YAAY,GAAG,SAAS;AAAA,MACnC;AAEA,UAAI,OAAO;AAAA,IACZ;AAAA,EACD,GAAG,CAAE,CAAA;AAEL,qBAAmB,aAAa,MAAM;AACrC,YAAQ,eAAe,WAAW,GAAG,SAAS,OAAO;AAAA,EAAA,CACrD;AAED,kBAAgB,MAAM;AACrB,YAAQ,eAAe,WAAW,GAAG,SAAS,OAAO;AAAA,EAAA,GACnD,CAAC,SAAS,SAAS,SAAS,aAAa,KAAK,CAAC;AACnD;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useChildrenAsLabel.cjs","sources":["../../../src/hooks/useChildrenAsLabel.ts"],"sourcesContent":["import { Children, ReactNode, useMemo } from 'react'\n\nconst MULTIPLE_SPACES_REG_EXP = / +/g\n\nfunction normalize(text: string): string {\n\treturn text.replace(MULTIPLE_SPACES_REG_EXP, ' ').trim()\n}\n\n/**\n * Walks through the children and returns a string representation of the text content.\n *\n * @param node - The children to walk through.\n * @returns String representation of the text content or undefined if there is no text content.\n *\n */\nexport function getChildrenAsLabel(node: ReactNode): string | undefined {\n\tif (typeof node === 'string' || typeof node === 'number') {\n\t\treturn String(node)\n\t} else if (node === null || node === undefined || typeof node === 'boolean') {\n\t\treturn undefined\n\t} else if (Array.isArray(node)) {\n\t\treturn normalize(node.map(getChildrenAsLabel).join(''))\n\t} else {\n\t\tlet label: (string | number)[] = []\n\n\t\tChildren.map(node, child => {\n\t\t\tif (child === null || child === undefined || typeof child === 'boolean') {\n\t\t\t} else if (typeof child === 'string') {\n\t\t\t\tlabel.push(child)\n\t\t\t} else if (typeof child === 'number') {\n\t\t\t\tlabel.push(child)\n\t\t\t} else if (Array.isArray(child)) {\n\t\t\t\tconst childLabel = getChildrenAsLabel(child)\n\n\t\t\t\tif (childLabel) {\n\t\t\t\t\tlabel.push(childLabel)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// ReactElement | JSXElementConstructor | ReactPortal\n\t\t\t\tif ('props' in child && 'children' in child.props) {\n\t\t\t\t\tconst childLabel = getChildrenAsLabel(child.props.children)\n\n\t\t\t\t\tif (childLabel) {\n\t\t\t\t\t\tlabel.push(childLabel)\n\t\t\t\t\t}\n\t\t\t\t} else if ('children' in child) {\n\t\t\t\t\t// ReactPortal\n\t\t\t\t\tconst childLabel = getChildrenAsLabel(child.children)\n\n\t\t\t\t\tif (childLabel) {\n\t\t\t\t\t\tlabel.push(childLabel)\n\t\t\t\t\t}\n\t\t\t\t} else if (import.meta.env.DEV) {\n\t\t\t\t\tconsole.warn('Unsupported child:', child)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\n\t\treturn label.length > 0 ? label.join('') : undefined\n\t}\n}\n\n/**\n * Walks through the children and returns a string representation of the text content.\n *\n * @param node - The children to walk through.\n * @returns String representation of the text content or undefined if there is no text content.\n *\n */\nexport function useChildrenAsLabel(node: ReactNode): string | undefined {\n\treturn useMemo(() => getChildrenAsLabel(node), [node])\n}\n"],"names":["Children","useMemo"],"mappings":";;;AAEA,MAAM,0BAA0B;AAEhC,SAAS,UAAU,MAAsB;AACxC,SAAO,KAAK,QAAQ,yBAAyB,GAAG,EAAE,KAAK;AACxD;AASO,SAAS,mBAAmB,MAAqC;AACvE,MAAI,OAAO,SAAS,YAAY,OAAO,SAAS,UAAU;AACzD,WAAO,OAAO,IAAI;AAAA,EAAA,WACR,SAAS,QAAQ,SAAS,UAAa,OAAO,SAAS,WAAW;AACrE,WAAA;AAAA,EACG,WAAA,MAAM,QAAQ,IAAI,GAAG;AAC/B,WAAO,UAAU,KAAK,IAAI,kBAAkB,EAAE,KAAK,EAAE,CAAC;AAAA,EAAA,OAChD;AACN,QAAI,QAA6B,CAAA;AAExBA,UAAAA,SAAA,IAAI,MAAM,CAAS,UAAA;AAC3B,UAAI,UAAU,QAAQ,UAAU,UAAa,OAAO,UAAU;AAAW;AAAA,eAC9D,OAAO,UAAU,UAAU;AACrC,cAAM,KAAK,KAAK;AAAA,MAAA,WACN,OAAO,UAAU,UAAU;AACrC,cAAM,KAAK,KAAK;AAAA,MACN,WAAA,MAAM,QAAQ,KAAK,GAAG;AAC1B,cAAA,aAAa,mBAAmB,KAAK;AAE3C,YAAI,YAAY;AACf,gBAAM,KAAK,UAAU;AAAA,QACtB;AAAA,MAAA,OACM;AAEN,YAAI,WAAW,SAAS,cAAc,MAAM,OAAO;AAClD,gBAAM,aAAa,mBAAmB,MAAM,MAAM,QAAQ;AAE1D,cAAI,YAAY;AACf,kBAAM,KAAK,UAAU;AAAA,UACtB;AAAA,QAAA,WACU,cAAc,OAAO;AAEzB,gBAAA,aAAa,mBAAmB,MAAM,QAAQ;AAEpD,cAAI,YAAY;AACf,kBAAM,KAAK,UAAU;AAAA,UACtB;AAAA,QAAA,OAC+B;AACvB,kBAAA,KAAK,sBAAsB,KAAK;AAAA,QACzC;AAAA,MACD;AAAA,IAAA,CACA;AAED,WAAO,MAAM,SAAS,IAAI,MAAM,KAAK,EAAE,IAAI;AAAA,EAC5C;AACD;AASO,SAAS,mBAAmB,MAAqC;AACvE,SAAOC,MAAAA,QAAQ,MAAM,mBAAmB,IAAI,GAAG,CAAC,IAAI,CAAC;AACtD;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useChildrenAsLabel.js","sources":["../../../src/hooks/useChildrenAsLabel.ts"],"sourcesContent":["import { Children, ReactNode, useMemo } from 'react'\n\nconst MULTIPLE_SPACES_REG_EXP = / +/g\n\nfunction normalize(text: string): string {\n\treturn text.replace(MULTIPLE_SPACES_REG_EXP, ' ').trim()\n}\n\n/**\n * Walks through the children and returns a string representation of the text content.\n *\n * @param node - The children to walk through.\n * @returns String representation of the text content or undefined if there is no text content.\n *\n */\nexport function getChildrenAsLabel(node: ReactNode): string | undefined {\n\tif (typeof node === 'string' || typeof node === 'number') {\n\t\treturn String(node)\n\t} else if (node === null || node === undefined || typeof node === 'boolean') {\n\t\treturn undefined\n\t} else if (Array.isArray(node)) {\n\t\treturn normalize(node.map(getChildrenAsLabel).join(''))\n\t} else {\n\t\tlet label: (string | number)[] = []\n\n\t\tChildren.map(node, child => {\n\t\t\tif (child === null || child === undefined || typeof child === 'boolean') {\n\t\t\t} else if (typeof child === 'string') {\n\t\t\t\tlabel.push(child)\n\t\t\t} else if (typeof child === 'number') {\n\t\t\t\tlabel.push(child)\n\t\t\t} else if (Array.isArray(child)) {\n\t\t\t\tconst childLabel = getChildrenAsLabel(child)\n\n\t\t\t\tif (childLabel) {\n\t\t\t\t\tlabel.push(childLabel)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// ReactElement | JSXElementConstructor | ReactPortal\n\t\t\t\tif ('props' in child && 'children' in child.props) {\n\t\t\t\t\tconst childLabel = getChildrenAsLabel(child.props.children)\n\n\t\t\t\t\tif (childLabel) {\n\t\t\t\t\t\tlabel.push(childLabel)\n\t\t\t\t\t}\n\t\t\t\t} else if ('children' in child) {\n\t\t\t\t\t// ReactPortal\n\t\t\t\t\tconst childLabel = getChildrenAsLabel(child.children)\n\n\t\t\t\t\tif (childLabel) {\n\t\t\t\t\t\tlabel.push(childLabel)\n\t\t\t\t\t}\n\t\t\t\t} else if (import.meta.env.DEV) {\n\t\t\t\t\tconsole.warn('Unsupported child:', child)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\n\t\treturn label.length > 0 ? label.join('') : undefined\n\t}\n}\n\n/**\n * Walks through the children and returns a string representation of the text content.\n *\n * @param node - The children to walk through.\n * @returns String representation of the text content or undefined if there is no text content.\n *\n */\nexport function useChildrenAsLabel(node: ReactNode): string | undefined {\n\treturn useMemo(() => getChildrenAsLabel(node), [node])\n}\n"],"names":[],"mappings":";AAEA,MAAM,0BAA0B;AAEhC,SAAS,UAAU,MAAsB;AACxC,SAAO,KAAK,QAAQ,yBAAyB,GAAG,EAAE,KAAK;AACxD;AASO,SAAS,mBAAmB,MAAqC;AACvE,MAAI,OAAO,SAAS,YAAY,OAAO,SAAS,UAAU;AACzD,WAAO,OAAO,IAAI;AAAA,EAAA,WACR,SAAS,QAAQ,SAAS,UAAa,OAAO,SAAS,WAAW;AACrE,WAAA;AAAA,EACG,WAAA,MAAM,QAAQ,IAAI,GAAG;AAC/B,WAAO,UAAU,KAAK,IAAI,kBAAkB,EAAE,KAAK,EAAE,CAAC;AAAA,EAAA,OAChD;AACN,QAAI,QAA6B,CAAA;AAExB,aAAA,IAAI,MAAM,CAAS,UAAA;AAC3B,UAAI,UAAU,QAAQ,UAAU,UAAa,OAAO,UAAU;AAAW;AAAA,eAC9D,OAAO,UAAU,UAAU;AACrC,cAAM,KAAK,KAAK;AAAA,MAAA,WACN,OAAO,UAAU,UAAU;AACrC,cAAM,KAAK,KAAK;AAAA,MACN,WAAA,MAAM,QAAQ,KAAK,GAAG;AAC1B,cAAA,aAAa,mBAAmB,KAAK;AAE3C,YAAI,YAAY;AACf,gBAAM,KAAK,UAAU;AAAA,QACtB;AAAA,MAAA,OACM;AAEN,YAAI,WAAW,SAAS,cAAc,MAAM,OAAO;AAClD,gBAAM,aAAa,mBAAmB,MAAM,MAAM,QAAQ;AAE1D,cAAI,YAAY;AACf,kBAAM,KAAK,UAAU;AAAA,UACtB;AAAA,QAAA,WACU,cAAc,OAAO;AAEzB,gBAAA,aAAa,mBAAmB,MAAM,QAAQ;AAEpD,cAAI,YAAY;AACf,kBAAM,KAAK,UAAU;AAAA,UACtB;AAAA,QAAA,OAC+B;AACvB,kBAAA,KAAK,sBAAsB,KAAK;AAAA,QACzC;AAAA,MACD;AAAA,IAAA,CACA;AAED,WAAO,MAAM,SAAS,IAAI,MAAM,KAAK,EAAE,IAAI;AAAA,EAC5C;AACD;AASO,SAAS,mBAAmB,MAAqC;AACvE,SAAO,QAAQ,MAAM,mBAAmB,IAAI,GAAG,CAAC,IAAI,CAAC;AACtD;"}
|