@contember/react-utils 2.0.0-alpha.4 → 2.0.0-alpha.40
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 -35
- package/dist/development/index.js +35 -35
- package/dist/development/{context → src/context}/createContext.cjs +3 -3
- package/dist/development/src/context/createContext.cjs.map +1 -0
- package/dist/{production → development/src}/context/createContext.js +1 -1
- package/dist/development/src/context/createContext.js.map +1 -0
- package/dist/{production → development/src}/context/createRequiredContext.cjs +4 -4
- package/dist/development/src/context/createRequiredContext.cjs.map +1 -0
- package/dist/{production → development/src}/context/createRequiredContext.js +1 -1
- 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/{production → development/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/{production → development/src}/hooks/useAutoHeightTextArea.cjs +9 -7
- package/dist/development/src/hooks/useAutoHeightTextArea.cjs.map +1 -0
- package/dist/{production → development/src}/hooks/useAutoHeightTextArea.js +3 -1
- 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/{production → development/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/{production → development/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/{production → development/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 -35
- package/dist/production/index.js +35 -35
- package/dist/production/{context → src/context}/createContext.cjs +3 -3
- package/dist/production/src/context/createContext.cjs.map +1 -0
- package/dist/{development → production/src}/context/createContext.js +1 -1
- package/dist/production/src/context/createContext.js.map +1 -0
- package/dist/{development → production/src}/context/createRequiredContext.cjs +4 -4
- package/dist/production/src/context/createRequiredContext.cjs.map +1 -0
- package/dist/{development → production/src}/context/createRequiredContext.js +1 -1
- 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/{development → production/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/{development → production/src}/hooks/useAutoHeightTextArea.cjs +9 -7
- package/dist/production/src/hooks/useAutoHeightTextArea.cjs.map +1 -0
- package/dist/{development → production/src}/hooks/useAutoHeightTextArea.js +3 -1
- 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/{development → production/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/{development → production/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/{development → production/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/context/createContext.d.ts +2 -2
- package/dist/types/context/createContext.d.ts.map +1 -1
- package/dist/types/context/createRequiredContext.d.ts +2 -2
- package/dist/types/context/createRequiredContext.d.ts.map +1 -1
- package/dist/types/debug-context/Types.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/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 +6 -14
- package/src/context/createContext.ts +5 -5
- package/src/context/createRequiredContext.ts +12 -12
- package/src/debug-context/Types.ts +8 -8
- package/src/hooks/useAutoHeightTextArea.ts +4 -1
- 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/tsconfig.json +4 -2
- package/src/types/PropsWithRequiredChildren.ts +1 -1
- package/tests/hooks/useChildrenAsLabel.test.tsx +92 -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/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/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/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/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/useOnElementResize.cjs.map +0 -1
- package/dist/development/hooks/useOnElementResize.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/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/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/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/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/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/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/useOnElementResize.cjs.map +0 -1
- package/dist/production/hooks/useOnElementResize.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/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/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}/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/{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}/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
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const createRequiredContext = require("./context/createRequiredContext.cjs");
|
|
4
|
-
const createContext = require("./context/createContext.cjs");
|
|
5
|
-
const Constants = require("./debug-context/Constants.cjs");
|
|
6
|
-
const Context = require("./debug-context/Context.cjs");
|
|
7
|
-
const unwrapRefValue = require("./hooks/unwrapRefValue.cjs");
|
|
8
|
-
const useAbortController = require("./hooks/useAbortController.cjs");
|
|
9
|
-
const useArrayMapMemo = require("./hooks/useArrayMapMemo.cjs");
|
|
10
|
-
const useAutoHeightTextArea = require("./hooks/useAutoHeightTextArea.cjs");
|
|
11
|
-
const useChildrenAsLabel = require("./hooks/useChildrenAsLabel.cjs");
|
|
12
|
-
const useComposeRef = require("./hooks/useComposeRef.cjs");
|
|
13
|
-
const useConstantLengthInvariant = require("./hooks/useConstantLengthInvariant.cjs");
|
|
14
|
-
const useConstantValueInvariant = require("./hooks/useConstantValueInvariant.cjs");
|
|
15
|
-
const useDebounce = require("./hooks/useDebounce.cjs");
|
|
16
|
-
const useDebounceCallback = require("./hooks/useDebounceCallback.cjs");
|
|
17
|
-
const useDocumentTitle = require("./hooks/useDocumentTitle.cjs");
|
|
18
|
-
const useExpectSameValueReference = require("./hooks/useExpectSameValueReference.cjs");
|
|
19
|
-
const useForceRender = require("./hooks/useForceRender.cjs");
|
|
20
|
-
const useId = require("./hooks/useId.cjs");
|
|
21
|
-
const useIsMounted = require("./hooks/useIsMounted.cjs");
|
|
22
|
-
const useObjectMemo = require("./hooks/useObjectMemo.cjs");
|
|
23
|
-
const useOnElementClickOutsideCallback = require("./hooks/useOnElementClickOutsideCallback.cjs");
|
|
24
|
-
const useOnElementMouseEnterDelayedCallback = require("./hooks/useOnElementMouseEnterDelayedCallback.cjs");
|
|
25
|
-
const useOnElementResize = require("./hooks/useOnElementResize.cjs");
|
|
26
|
-
const useOnWindowResize = require("./hooks/useOnWindowResize.cjs");
|
|
27
|
-
const usePreviousValue = require("./hooks/usePreviousValue.cjs");
|
|
28
|
-
const useStoredState = require("./hooks/useStoredState.cjs");
|
|
29
|
-
const useUpdatedRef = require("./hooks/useUpdatedRef.cjs");
|
|
30
|
-
const useWindowSize = require("./hooks/useWindowSize.cjs");
|
|
31
|
-
const emptyArray = require("./referentiallyStable/emptyArray.cjs");
|
|
32
|
-
const emptyObject = require("./referentiallyStable/emptyObject.cjs");
|
|
33
|
-
const identityFunction = require("./referentiallyStable/identityFunction.cjs");
|
|
34
|
-
const noop = require("./referentiallyStable/noop.cjs");
|
|
35
|
-
const returnFalse = require("./referentiallyStable/returnFalse.cjs");
|
|
36
|
-
const returnTrue = require("./referentiallyStable/returnTrue.cjs");
|
|
37
|
-
const useReferentiallyStableCallback = require("./referentiallyStable/useReferentiallyStableCallback.cjs");
|
|
3
|
+
const createRequiredContext = require("./src/context/createRequiredContext.cjs");
|
|
4
|
+
const createContext = require("./src/context/createContext.cjs");
|
|
5
|
+
const Constants = require("./src/debug-context/Constants.cjs");
|
|
6
|
+
const Context = require("./src/debug-context/Context.cjs");
|
|
7
|
+
const unwrapRefValue = require("./src/hooks/unwrapRefValue.cjs");
|
|
8
|
+
const useAbortController = require("./src/hooks/useAbortController.cjs");
|
|
9
|
+
const useArrayMapMemo = require("./src/hooks/useArrayMapMemo.cjs");
|
|
10
|
+
const useAutoHeightTextArea = require("./src/hooks/useAutoHeightTextArea.cjs");
|
|
11
|
+
const useChildrenAsLabel = require("./src/hooks/useChildrenAsLabel.cjs");
|
|
12
|
+
const useComposeRef = require("./src/hooks/useComposeRef.cjs");
|
|
13
|
+
const useConstantLengthInvariant = require("./src/hooks/useConstantLengthInvariant.cjs");
|
|
14
|
+
const useConstantValueInvariant = require("./src/hooks/useConstantValueInvariant.cjs");
|
|
15
|
+
const useDebounce = require("./src/hooks/useDebounce.cjs");
|
|
16
|
+
const useDebounceCallback = require("./src/hooks/useDebounceCallback.cjs");
|
|
17
|
+
const useDocumentTitle = require("./src/hooks/useDocumentTitle.cjs");
|
|
18
|
+
const useExpectSameValueReference = require("./src/hooks/useExpectSameValueReference.cjs");
|
|
19
|
+
const useForceRender = require("./src/hooks/useForceRender.cjs");
|
|
20
|
+
const useId = require("./src/hooks/useId.cjs");
|
|
21
|
+
const useIsMounted = require("./src/hooks/useIsMounted.cjs");
|
|
22
|
+
const useObjectMemo = require("./src/hooks/useObjectMemo.cjs");
|
|
23
|
+
const useOnElementClickOutsideCallback = require("./src/hooks/useOnElementClickOutsideCallback.cjs");
|
|
24
|
+
const useOnElementMouseEnterDelayedCallback = require("./src/hooks/useOnElementMouseEnterDelayedCallback.cjs");
|
|
25
|
+
const useOnElementResize = require("./src/hooks/useOnElementResize.cjs");
|
|
26
|
+
const useOnWindowResize = require("./src/hooks/useOnWindowResize.cjs");
|
|
27
|
+
const usePreviousValue = require("./src/hooks/usePreviousValue.cjs");
|
|
28
|
+
const useStoredState = require("./src/hooks/useStoredState.cjs");
|
|
29
|
+
const useUpdatedRef = require("./src/hooks/useUpdatedRef.cjs");
|
|
30
|
+
const useWindowSize = require("./src/hooks/useWindowSize.cjs");
|
|
31
|
+
const emptyArray = require("./src/referentiallyStable/emptyArray.cjs");
|
|
32
|
+
const emptyObject = require("./src/referentiallyStable/emptyObject.cjs");
|
|
33
|
+
const identityFunction = require("./src/referentiallyStable/identityFunction.cjs");
|
|
34
|
+
const noop = require("./src/referentiallyStable/noop.cjs");
|
|
35
|
+
const returnFalse = require("./src/referentiallyStable/returnFalse.cjs");
|
|
36
|
+
const returnTrue = require("./src/referentiallyStable/returnTrue.cjs");
|
|
37
|
+
const useReferentiallyStableCallback = require("./src/referentiallyStable/useReferentiallyStableCallback.cjs");
|
|
38
38
|
exports.createRequiredContext = createRequiredContext.createRequiredContext;
|
|
39
39
|
exports.createContext = createContext.createContext;
|
|
40
40
|
exports.isNoopScopedConsole = Constants.isNoopScopedConsole;
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { createRequiredContext } from "./context/createRequiredContext.js";
|
|
2
|
-
import { createContext } from "./context/createContext.js";
|
|
3
|
-
import { isNoopScopedConsole, noopLog, noopLogged, noopScopedConsole } from "./debug-context/Constants.js";
|
|
4
|
-
import { DebugChildren, ScopedConsoleContext, useScopedConsoleRef } from "./debug-context/Context.js";
|
|
5
|
-
import { unwrapRefValue } from "./hooks/unwrapRefValue.js";
|
|
6
|
-
import { useAbortController } from "./hooks/useAbortController.js";
|
|
7
|
-
import { useArrayMapMemo } from "./hooks/useArrayMapMemo.js";
|
|
8
|
-
import { useAutoHeightTextArea } from "./hooks/useAutoHeightTextArea.js";
|
|
9
|
-
import { getChildrenAsLabel, useChildrenAsLabel } from "./hooks/useChildrenAsLabel.js";
|
|
10
|
-
import { useComposeRef } from "./hooks/useComposeRef.js";
|
|
11
|
-
import { useConstantLengthInvariant } from "./hooks/useConstantLengthInvariant.js";
|
|
12
|
-
import { useConstantValueInvariant } from "./hooks/useConstantValueInvariant.js";
|
|
13
|
-
import { useDebounce } from "./hooks/useDebounce.js";
|
|
14
|
-
import { useDebounceCallback } from "./hooks/useDebounceCallback.js";
|
|
15
|
-
import { useDocumentTitle } from "./hooks/useDocumentTitle.js";
|
|
16
|
-
import { useExpectSameValueReference } from "./hooks/useExpectSameValueReference.js";
|
|
17
|
-
import { useForceRender } from "./hooks/useForceRender.js";
|
|
18
|
-
import { useId } from "./hooks/useId.js";
|
|
19
|
-
import { useIsMounted } from "./hooks/useIsMounted.js";
|
|
20
|
-
import { useObjectMemo } from "./hooks/useObjectMemo.js";
|
|
21
|
-
import { useOnElementClickOutsideCallback } from "./hooks/useOnElementClickOutsideCallback.js";
|
|
22
|
-
import { useOnElementMouseEnterDelayedCallback } from "./hooks/useOnElementMouseEnterDelayedCallback.js";
|
|
23
|
-
import { useOnElementResize } from "./hooks/useOnElementResize.js";
|
|
24
|
-
import { useOnWindowResize } from "./hooks/useOnWindowResize.js";
|
|
25
|
-
import { usePreviousValue } from "./hooks/usePreviousValue.js";
|
|
26
|
-
import { getStateStorage, localStateStorage, nullStorage, sessionStateStorage, urlStateStorage, useLocalStorageState, useSessionStorageState, useStoredState } from "./hooks/useStoredState.js";
|
|
27
|
-
import { useUpdatedRef } from "./hooks/useUpdatedRef.js";
|
|
28
|
-
import { useWindowSize } from "./hooks/useWindowSize.js";
|
|
29
|
-
import { emptyArray } from "./referentiallyStable/emptyArray.js";
|
|
30
|
-
import { emptyObject } from "./referentiallyStable/emptyObject.js";
|
|
31
|
-
import { identityFunction } from "./referentiallyStable/identityFunction.js";
|
|
32
|
-
import { noop } from "./referentiallyStable/noop.js";
|
|
33
|
-
import { returnFalse } from "./referentiallyStable/returnFalse.js";
|
|
34
|
-
import { returnTrue } from "./referentiallyStable/returnTrue.js";
|
|
35
|
-
import { useReferentiallyStableCallback } from "./referentiallyStable/useReferentiallyStableCallback.js";
|
|
1
|
+
import { createRequiredContext } from "./src/context/createRequiredContext.js";
|
|
2
|
+
import { createContext } from "./src/context/createContext.js";
|
|
3
|
+
import { isNoopScopedConsole, noopLog, noopLogged, noopScopedConsole } from "./src/debug-context/Constants.js";
|
|
4
|
+
import { DebugChildren, ScopedConsoleContext, useScopedConsoleRef } from "./src/debug-context/Context.js";
|
|
5
|
+
import { unwrapRefValue } from "./src/hooks/unwrapRefValue.js";
|
|
6
|
+
import { useAbortController } from "./src/hooks/useAbortController.js";
|
|
7
|
+
import { useArrayMapMemo } from "./src/hooks/useArrayMapMemo.js";
|
|
8
|
+
import { useAutoHeightTextArea } from "./src/hooks/useAutoHeightTextArea.js";
|
|
9
|
+
import { getChildrenAsLabel, useChildrenAsLabel } from "./src/hooks/useChildrenAsLabel.js";
|
|
10
|
+
import { useComposeRef } from "./src/hooks/useComposeRef.js";
|
|
11
|
+
import { useConstantLengthInvariant } from "./src/hooks/useConstantLengthInvariant.js";
|
|
12
|
+
import { useConstantValueInvariant } from "./src/hooks/useConstantValueInvariant.js";
|
|
13
|
+
import { useDebounce } from "./src/hooks/useDebounce.js";
|
|
14
|
+
import { useDebounceCallback } from "./src/hooks/useDebounceCallback.js";
|
|
15
|
+
import { useDocumentTitle } from "./src/hooks/useDocumentTitle.js";
|
|
16
|
+
import { useExpectSameValueReference } from "./src/hooks/useExpectSameValueReference.js";
|
|
17
|
+
import { useForceRender } from "./src/hooks/useForceRender.js";
|
|
18
|
+
import { useId } from "./src/hooks/useId.js";
|
|
19
|
+
import { useIsMounted } from "./src/hooks/useIsMounted.js";
|
|
20
|
+
import { useObjectMemo } from "./src/hooks/useObjectMemo.js";
|
|
21
|
+
import { useOnElementClickOutsideCallback } from "./src/hooks/useOnElementClickOutsideCallback.js";
|
|
22
|
+
import { useOnElementMouseEnterDelayedCallback } from "./src/hooks/useOnElementMouseEnterDelayedCallback.js";
|
|
23
|
+
import { useOnElementResize } from "./src/hooks/useOnElementResize.js";
|
|
24
|
+
import { useOnWindowResize } from "./src/hooks/useOnWindowResize.js";
|
|
25
|
+
import { usePreviousValue } from "./src/hooks/usePreviousValue.js";
|
|
26
|
+
import { getStateStorage, localStateStorage, nullStorage, sessionStateStorage, urlStateStorage, useLocalStorageState, useSessionStorageState, useStoredState } from "./src/hooks/useStoredState.js";
|
|
27
|
+
import { useUpdatedRef } from "./src/hooks/useUpdatedRef.js";
|
|
28
|
+
import { useWindowSize } from "./src/hooks/useWindowSize.js";
|
|
29
|
+
import { emptyArray } from "./src/referentiallyStable/emptyArray.js";
|
|
30
|
+
import { emptyObject } from "./src/referentiallyStable/emptyObject.js";
|
|
31
|
+
import { identityFunction } from "./src/referentiallyStable/identityFunction.js";
|
|
32
|
+
import { noop } from "./src/referentiallyStable/noop.js";
|
|
33
|
+
import { returnFalse } from "./src/referentiallyStable/returnFalse.js";
|
|
34
|
+
import { returnTrue } from "./src/referentiallyStable/returnTrue.js";
|
|
35
|
+
import { useReferentiallyStableCallback } from "./src/referentiallyStable/useReferentiallyStableCallback.js";
|
|
36
36
|
export {
|
|
37
37
|
DebugChildren,
|
|
38
38
|
ScopedConsoleContext,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const React = require("react");
|
|
4
4
|
function createContext(name, initialValue) {
|
|
5
|
-
const OptionalContext =
|
|
5
|
+
const OptionalContext = React.createContext(initialValue);
|
|
6
6
|
OptionalContext.displayName = name;
|
|
7
|
-
return [OptionalContext, () =>
|
|
7
|
+
return [OptionalContext, () => React.useContext(OptionalContext), OptionalContext.Provider];
|
|
8
8
|
}
|
|
9
9
|
exports.createContext = createContext;
|
|
10
10
|
//# sourceMappingURL=createContext.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createContext.cjs","sources":["../../../../../packages/react-utils/src/context/createContext.ts"],"sourcesContent":["import type { Context, Provider } from 'react'\nimport { createContext as baseCreateContext, useContext } from 'react'\n\nexport function createContext<T>(name: string, initialValue: T): [Context<T>, () => T, Provider<T>] {\n\tconst OptionalContext = baseCreateContext<T>(initialValue)\n\tOptionalContext.displayName = name\n\n\treturn [OptionalContext, () => useContext(OptionalContext), OptionalContext.Provider]\n}\n"],"names":["baseCreateContext","useContext"],"mappings":";;;AAGgB,SAAA,cAAiB,MAAc,cAAqD;AAC7F,QAAA,kBAAkBA,oBAAqB,YAAY;AACzD,kBAAgB,cAAc;AAE9B,SAAO,CAAC,iBAAiB,MAAMC,MAAAA,WAAW,eAAe,GAAG,gBAAgB,QAAQ;AACrF;;"}
|
|
@@ -2,7 +2,7 @@ import { createContext as createContext$1, useContext } from "react";
|
|
|
2
2
|
function createContext(name, initialValue) {
|
|
3
3
|
const OptionalContext = createContext$1(initialValue);
|
|
4
4
|
OptionalContext.displayName = name;
|
|
5
|
-
return [OptionalContext, () => useContext(OptionalContext)];
|
|
5
|
+
return [OptionalContext, () => useContext(OptionalContext), OptionalContext.Provider];
|
|
6
6
|
}
|
|
7
7
|
export {
|
|
8
8
|
createContext
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createContext.js","sources":["../../../../../packages/react-utils/src/context/createContext.ts"],"sourcesContent":["import type { Context, Provider } from 'react'\nimport { createContext as baseCreateContext, useContext } from 'react'\n\nexport function createContext<T>(name: string, initialValue: T): [Context<T>, () => T, Provider<T>] {\n\tconst OptionalContext = baseCreateContext<T>(initialValue)\n\tOptionalContext.displayName = name\n\n\treturn [OptionalContext, () => useContext(OptionalContext), OptionalContext.Provider]\n}\n"],"names":["baseCreateContext"],"mappings":";AAGgB,SAAA,cAAiB,MAAc,cAAqD;AAC7F,QAAA,kBAAkBA,gBAAqB,YAAY;AACzD,kBAAgB,cAAc;AAE9B,SAAO,CAAC,iBAAiB,MAAM,WAAW,eAAe,GAAG,gBAAgB,QAAQ;AACrF;"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const React = require("react");
|
|
4
4
|
const EmptyContextSymbol = Symbol("EmptyContextSymbol");
|
|
5
5
|
function createRequiredContext(displayName) {
|
|
6
|
-
const RequiredContext =
|
|
6
|
+
const RequiredContext = React.createContext(EmptyContextSymbol);
|
|
7
7
|
RequiredContext.displayName = displayName;
|
|
8
8
|
const useRequiredContext = () => {
|
|
9
|
-
const context =
|
|
9
|
+
const context = React.useContext(RequiredContext);
|
|
10
10
|
if (context === EmptyContextSymbol) {
|
|
11
11
|
throw new Error(`use${displayName} must be used within a ${displayName} provider`);
|
|
12
12
|
}
|
|
13
13
|
return context;
|
|
14
14
|
};
|
|
15
|
-
return [RequiredContext, useRequiredContext];
|
|
15
|
+
return [RequiredContext, useRequiredContext, RequiredContext.Provider];
|
|
16
16
|
}
|
|
17
17
|
exports.createRequiredContext = createRequiredContext;
|
|
18
18
|
//# sourceMappingURL=createRequiredContext.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRequiredContext.cjs","sources":["../../../../../packages/react-utils/src/context/createRequiredContext.ts"],"sourcesContent":["import type { Context, Provider } from 'react'\nimport { createContext, useContext } from 'react'\n\nconst EmptyContextSymbol = Symbol('EmptyContextSymbol')\n\nexport function createRequiredContext<T>(displayName: string): [Context<T>, () => T, Provider<T>] {\n\tconst RequiredContext = createContext<T>(EmptyContextSymbol as T)\n\tRequiredContext.displayName = displayName\n\n\tconst useRequiredContext = (): T => {\n\t\tconst context = useContext(RequiredContext)\n\n\t\tif (context === EmptyContextSymbol) {\n\t\t\tthrow new Error(`use${displayName} must be used within a ${displayName} provider`)\n\t\t}\n\n\t\treturn context\n\t}\n\n\treturn [RequiredContext, useRequiredContext, RequiredContext.Provider]\n}\n"],"names":["createContext","useContext"],"mappings":";;;AAGA,MAAM,qBAAqB,OAAO,oBAAoB;AAE/C,SAAS,sBAAyB,aAAyD;AAC3F,QAAA,kBAAkBA,oBAAiB,kBAAuB;AAChE,kBAAgB,cAAc;AAE9B,QAAM,qBAAqB,MAAS;AAC7B,UAAA,UAAUC,iBAAW,eAAe;AAE1C,QAAI,YAAY,oBAAoB;AACnC,YAAM,IAAI,MAAM,MAAM,WAAW,0BAA0B,WAAW,WAAW;AAAA,IAAA;AAG3E,WAAA;AAAA,EACR;AAEA,SAAO,CAAC,iBAAiB,oBAAoB,gBAAgB,QAAQ;AACtE;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRequiredContext.js","sources":["../../../../../packages/react-utils/src/context/createRequiredContext.ts"],"sourcesContent":["import type { Context, Provider } from 'react'\nimport { createContext, useContext } from 'react'\n\nconst EmptyContextSymbol = Symbol('EmptyContextSymbol')\n\nexport function createRequiredContext<T>(displayName: string): [Context<T>, () => T, Provider<T>] {\n\tconst RequiredContext = createContext<T>(EmptyContextSymbol as T)\n\tRequiredContext.displayName = displayName\n\n\tconst useRequiredContext = (): T => {\n\t\tconst context = useContext(RequiredContext)\n\n\t\tif (context === EmptyContextSymbol) {\n\t\t\tthrow new Error(`use${displayName} must be used within a ${displayName} provider`)\n\t\t}\n\n\t\treturn context\n\t}\n\n\treturn [RequiredContext, useRequiredContext, RequiredContext.Provider]\n}\n"],"names":[],"mappings":";AAGA,MAAM,qBAAqB,OAAO,oBAAoB;AAE/C,SAAS,sBAAyB,aAAyD;AAC3F,QAAA,kBAAkB,cAAiB,kBAAuB;AAChE,kBAAgB,cAAc;AAE9B,QAAM,qBAAqB,MAAS;AAC7B,UAAA,UAAU,WAAW,eAAe;AAE1C,QAAI,YAAY,oBAAoB;AACnC,YAAM,IAAI,MAAM,MAAM,WAAW,0BAA0B,WAAW,WAAW;AAAA,IAAA;AAG3E,WAAA;AAAA,EACR;AAEA,SAAO,CAAC,iBAAiB,oBAAoB,gBAAgB,QAAQ;AACtE;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Constants.cjs","sources":["../../../../../packages/react-utils/src/debug-context/Constants.ts"],"sourcesContent":["import type { ScopedConsoleContextType } from './Types'\n\nexport function noopLog(...parameters: any[]) { }\n\nexport function noopLogged<T>(message: string, value: T): T {\n\treturn value\n}\n\nexport const noopScopedConsole: ScopedConsoleContextType = Object.freeze({\n\tlog: noopLog,\n\tlogged: noopLogged,\n\twarn: noopLog,\n\twarned: noopLogged,\n\terror: noopLog,\n\terrored: noopLogged,\n\ttrace: noopLog,\n\ttraced: noopLogged,\n})\n\nexport function isNoopScopedConsole(value: unknown): boolean {\n\treturn value === noopScopedConsole\n}\n"],"names":[],"mappings":";;AAEO,SAAS,WAAW,YAAmB;AAAE;AAEhC,SAAA,WAAc,SAAiB,OAAa;AACpD,SAAA;AACR;AAEa,MAAA,oBAA8C,OAAO,OAAO;AAAA,EACxE,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AACT,CAAC;AAEM,SAAS,oBAAoB,OAAyB;AAC5D,SAAO,UAAU;AAClB;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Constants.js","sources":["../../../../../packages/react-utils/src/debug-context/Constants.ts"],"sourcesContent":["import type { ScopedConsoleContextType } from './Types'\n\nexport function noopLog(...parameters: any[]) { }\n\nexport function noopLogged<T>(message: string, value: T): T {\n\treturn value\n}\n\nexport const noopScopedConsole: ScopedConsoleContextType = Object.freeze({\n\tlog: noopLog,\n\tlogged: noopLogged,\n\twarn: noopLog,\n\twarned: noopLogged,\n\terror: noopLog,\n\terrored: noopLogged,\n\ttrace: noopLog,\n\ttraced: noopLogged,\n})\n\nexport function isNoopScopedConsole(value: unknown): boolean {\n\treturn value === noopScopedConsole\n}\n"],"names":[],"mappings":"AAEO,SAAS,WAAW,YAAmB;AAAE;AAEhC,SAAA,WAAc,SAAiB,OAAa;AACpD,SAAA;AACR;AAEa,MAAA,oBAA8C,OAAO,OAAO;AAAA,EACxE,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AACT,CAAC;AAEM,SAAS,oBAAoB,OAAyB;AAC5D,SAAO,UAAU;AAClB;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
|
-
const
|
|
4
|
+
const React = require("react");
|
|
5
5
|
const Constants = require("./Constants.cjs");
|
|
6
6
|
function createPrefixedConsole(message, prefixedConsole) {
|
|
7
7
|
return {
|
|
@@ -35,7 +35,7 @@ function createPrefixedConsole(message, prefixedConsole) {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
const ScopedConsoleContext =
|
|
38
|
+
const ScopedConsoleContext = React.createContext(null);
|
|
39
39
|
ScopedConsoleContext.displayName = "ScopedConsoleContext";
|
|
40
40
|
function parentScopedConsoleOrNone(parentConsole) {
|
|
41
41
|
return Constants.isNoopScopedConsole(parentConsole) ? void 0 : parentConsole;
|
|
@@ -44,23 +44,23 @@ const useScopedConsoleRef = (prefix, override) => {
|
|
|
44
44
|
if (prefix.length === 0) {
|
|
45
45
|
throw new Error("Prefix must be non-empty string");
|
|
46
46
|
}
|
|
47
|
-
const parentConsole = parentScopedConsoleOrNone(
|
|
48
|
-
const scopedConsole =
|
|
47
|
+
const parentConsole = parentScopedConsoleOrNone(React.useContext(ScopedConsoleContext));
|
|
48
|
+
const scopedConsole = React.useMemo(() => {
|
|
49
49
|
if (override !== false && (parentConsole || override)) {
|
|
50
50
|
return createPrefixedConsole(prefix, parentConsole);
|
|
51
51
|
} else {
|
|
52
52
|
return Constants.noopScopedConsole;
|
|
53
53
|
}
|
|
54
54
|
}, [override, parentConsole, prefix]);
|
|
55
|
-
const ref =
|
|
55
|
+
const ref = React.useRef(scopedConsole);
|
|
56
56
|
ref.current = scopedConsole;
|
|
57
57
|
return ref;
|
|
58
58
|
};
|
|
59
|
-
const DebugChildren =
|
|
60
|
-
const parentScopedConsole = parentScopedConsoleOrNone(
|
|
59
|
+
const DebugChildren = React.memo(({ active = true, children, id }) => {
|
|
60
|
+
const parentScopedConsole = parentScopedConsoleOrNone(React.useContext(ScopedConsoleContext));
|
|
61
61
|
const console2 = active && id ? createPrefixedConsole(id, parentScopedConsole) : Constants.noopScopedConsole;
|
|
62
62
|
return /* @__PURE__ */ jsxDevRuntime.jsxDEV(ScopedConsoleContext.Provider, { value: active ? console2 : Constants.noopScopedConsole, children }, void 0, false, {
|
|
63
|
-
fileName: "/
|
|
63
|
+
fileName: "/home/runner/work/contember/contember/packages/react-utils/src/debug-context/Context.tsx",
|
|
64
64
|
lineNumber: 77,
|
|
65
65
|
columnNumber: 3
|
|
66
66
|
}, void 0);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Context.cjs","sources":["../../../../../packages/react-utils/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,IAAA;AAAA,EAET;AACD;AAEa,MAAA,uBAAuBC,oBAAwC,IAAK;AACjF,qBAAqB,cAAc;AAEnC,SAAS,0BAA0B,eAA+E;AAC1G,SAAAC,8BAAoB,aAAa,IAAI,SAAY;AACzD;AAEa,MAAA,sBAAsB,CAAC,QAAgB,aAAuB;AACtE,MAAA,OAAO,WAAW,GAAG;AAClB,UAAA,IAAI,MAAM,iCAAiC;AAAA,EAAA;AAElD,QAAM,gBAAgB,0BAA0BC,MAAW,WAAA,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,UAAA;AAAA,IAAA;AAAA,EAEN,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,MAAW,WAAA,oBAAoB,CAAC;AAEtF,QAAMK,WAAU,UAAU,KACvB,sBAAsB,IAAI,mBAAmB,IAC7CH,UAAA;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;;;;"}
|
|
@@ -58,7 +58,7 @@ const DebugChildren = memo(({ active = true, children, id }) => {
|
|
|
58
58
|
const parentScopedConsole = parentScopedConsoleOrNone(useContext(ScopedConsoleContext));
|
|
59
59
|
const console2 = active && id ? createPrefixedConsole(id, parentScopedConsole) : noopScopedConsole;
|
|
60
60
|
return /* @__PURE__ */ jsxDEV(ScopedConsoleContext.Provider, { value: active ? console2 : noopScopedConsole, children }, void 0, false, {
|
|
61
|
-
fileName: "/
|
|
61
|
+
fileName: "/home/runner/work/contember/contember/packages/react-utils/src/debug-context/Context.tsx",
|
|
62
62
|
lineNumber: 77,
|
|
63
63
|
columnNumber: 3
|
|
64
64
|
}, void 0);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Context.js","sources":["../../../../../packages/react-utils/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,IAAA;AAAA,EAET;AACD;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,EAAA;AAElD,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,IAAA;AAAA,EAEN,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;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unwrapRefValue.cjs","sources":["../../../../../packages/react-utils/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,EAAA;AAET;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unwrapRefValue.js","sources":["../../../../../packages/react-utils/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,EAAA;AAET;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const React = require("react");
|
|
4
4
|
const useAbortController = () => {
|
|
5
|
-
const lastAbortControllerRef =
|
|
6
|
-
|
|
5
|
+
const lastAbortControllerRef = React.useRef(void 0);
|
|
6
|
+
React.useEffect(() => () => {
|
|
7
7
|
lastAbortControllerRef.current?.abort();
|
|
8
8
|
}, []);
|
|
9
|
-
return
|
|
9
|
+
return React.useCallback(() => {
|
|
10
10
|
lastAbortControllerRef.current?.abort();
|
|
11
11
|
const newController = new AbortController();
|
|
12
12
|
lastAbortControllerRef.current = newController;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAbortController.cjs","sources":["../../../../../packages/react-utils/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,aAAoC,MAAS;AAC5EC,QAAAA,UAAU,MAAM,MAAM;AACrB,2BAAuB,SAAS,MAAM;AAAA,EACvC,GAAG,EAAE;AACL,SAAOC,kBAAY,MAAmB;AACrC,2BAAuB,SAAS,MAAM;AAEhC,UAAA,gBAAgB,IAAI,gBAAgB;AAC1C,2BAAuB,UAAU;AACjC,WAAO,cAAc;AAAA,EACtB,GAAG,EAAE;AACN;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAbortController.js","sources":["../../../../../packages/react-utils/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,MAAM;AAAA,EACvC,GAAG,EAAE;AACL,SAAO,YAAY,MAAmB;AACrC,2BAAuB,SAAS,MAAM;AAEhC,UAAA,gBAAgB,IAAI,gBAAgB;AAC1C,2BAAuB,UAAU;AACjC,WAAO,cAAc;AAAA,EACtB,GAAG,EAAE;AACN;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const React = require("react");
|
|
4
4
|
const useConstantLengthInvariant = require("./useConstantLengthInvariant.cjs");
|
|
5
5
|
const useArrayMapMemo = (items, map) => {
|
|
6
6
|
useConstantLengthInvariant.useConstantLengthInvariant(items);
|
|
7
|
-
const mapped =
|
|
8
|
-
return
|
|
7
|
+
const mapped = React.useMemo(() => items.map(map), [map, ...items]);
|
|
8
|
+
return React.useMemo(() => mapped, mapped);
|
|
9
9
|
};
|
|
10
10
|
exports.useArrayMapMemo = useArrayMapMemo;
|
|
11
11
|
//# sourceMappingURL=useArrayMapMemo.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useArrayMapMemo.cjs","sources":["../../../../../packages/react-utils/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,6BAAAA,2BAA2B,KAAK;AAQ1B,QAAA,SAASC,cAAQ,MAAM,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;AAGrD,SAAAA,MAAA,QAAQ,MAAM,QAAQ,MAAM;AACpC;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useArrayMapMemo.js","sources":["../../../../../packages/react-utils/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,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
const react = require("react");
|
|
3
|
+
const React = require("react");
|
|
5
4
|
const unwrapRefValue = require("./unwrapRefValue.cjs");
|
|
6
5
|
const useOnElementResize = require("./useOnElementResize.cjs");
|
|
6
|
+
function px(value) {
|
|
7
|
+
return typeof value === "number" && !(isNaN(value) || value === Infinity || value === -Infinity) ? value + "px" : "";
|
|
8
|
+
}
|
|
7
9
|
const useAutoHeightTextArea = (textAreaRef, value, minRows, maxRows) => {
|
|
8
|
-
const measure =
|
|
10
|
+
const measure = React.useCallback(async (ref, minRows2, maxRows2) => {
|
|
9
11
|
if (ref) {
|
|
10
12
|
const rowsAttribute = ref.rows;
|
|
11
13
|
ref.style.height = "";
|
|
@@ -23,9 +25,9 @@ const useAutoHeightTextArea = (textAreaRef, value, minRows, maxRows) => {
|
|
|
23
25
|
ref.rows = maxRows2;
|
|
24
26
|
maxHeight = await ref.getBoundingClientRect().height;
|
|
25
27
|
}
|
|
26
|
-
ref.style.height =
|
|
27
|
-
ref.style.minHeight =
|
|
28
|
-
ref.style.maxHeight =
|
|
28
|
+
ref.style.height = px(height);
|
|
29
|
+
ref.style.minHeight = px(minHeight);
|
|
30
|
+
ref.style.maxHeight = px(maxHeight);
|
|
29
31
|
}
|
|
30
32
|
ref.rows = rowsAttribute;
|
|
31
33
|
}
|
|
@@ -33,7 +35,7 @@ const useAutoHeightTextArea = (textAreaRef, value, minRows, maxRows) => {
|
|
|
33
35
|
useOnElementResize.useOnElementResize(textAreaRef, () => {
|
|
34
36
|
measure(unwrapRefValue.unwrapRefValue(textAreaRef), minRows, maxRows);
|
|
35
37
|
});
|
|
36
|
-
|
|
38
|
+
React.useLayoutEffect(() => {
|
|
37
39
|
measure(unwrapRefValue.unwrapRefValue(textAreaRef), minRows, maxRows);
|
|
38
40
|
}, [maxRows, measure, minRows, textAreaRef, value]);
|
|
39
41
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAutoHeightTextArea.cjs","sources":["../../../../../packages/react-utils/src/hooks/useAutoHeightTextArea.ts"],"sourcesContent":["import { useCallback, useLayoutEffect } from 'react'\nimport { RefObjectOrElement, unwrapRefValue } from './unwrapRefValue'\nimport { useOnElementResize } from './useOnElementResize'\n\nfunction px<V extends number | false | null | undefined>(value?: V): string {\n\treturn typeof value === 'number' && !(isNaN(value) || value === Infinity || value === -Infinity) ? value + 'px' : ''\n}\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","useOnElementResize","unwrapRefValue","useLayoutEffect"],"mappings":";;;;;AAIA,SAAS,GAAgD,OAAmB;AAC3E,SAAO,OAAO,UAAU,YAAY,EAAE,MAAM,KAAK,KAAK,UAAU,YAAY,UAAU,aAAa,QAAQ,OAAO;AACnH;AAEO,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,QAAA;AAG3C,YAAA,MAAM,SAAS,GAAG,MAAM;AACxB,YAAA,MAAM,YAAY,GAAG,SAAS;AAC9B,YAAA,MAAM,YAAY,GAAG,SAAS;AAAA,MAAA;AAGnC,UAAI,OAAO;AAAA,IAAA;AAAA,EAEb,GAAG,EAAE;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,7 +1,9 @@
|
|
|
1
|
-
import { px } from "@contember/utilities";
|
|
2
1
|
import { useCallback, useLayoutEffect } from "react";
|
|
3
2
|
import { unwrapRefValue } from "./unwrapRefValue.js";
|
|
4
3
|
import { useOnElementResize } from "./useOnElementResize.js";
|
|
4
|
+
function px(value) {
|
|
5
|
+
return typeof value === "number" && !(isNaN(value) || value === Infinity || value === -Infinity) ? value + "px" : "";
|
|
6
|
+
}
|
|
5
7
|
const useAutoHeightTextArea = (textAreaRef, value, minRows, maxRows) => {
|
|
6
8
|
const measure = useCallback(async (ref, minRows2, maxRows2) => {
|
|
7
9
|
if (ref) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAutoHeightTextArea.js","sources":["../../../../../packages/react-utils/src/hooks/useAutoHeightTextArea.ts"],"sourcesContent":["import { useCallback, useLayoutEffect } from 'react'\nimport { RefObjectOrElement, unwrapRefValue } from './unwrapRefValue'\nimport { useOnElementResize } from './useOnElementResize'\n\nfunction px<V extends number | false | null | undefined>(value?: V): string {\n\treturn typeof value === 'number' && !(isNaN(value) || value === Infinity || value === -Infinity) ? value + 'px' : ''\n}\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":";;;AAIA,SAAS,GAAgD,OAAmB;AAC3E,SAAO,OAAO,UAAU,YAAY,EAAE,MAAM,KAAK,KAAK,UAAU,YAAY,UAAU,aAAa,QAAQ,OAAO;AACnH;AAEO,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,QAAA;AAG3C,YAAA,MAAM,SAAS,GAAG,MAAM;AACxB,YAAA,MAAM,YAAY,GAAG,SAAS;AAC9B,YAAA,MAAM,YAAY,GAAG,SAAS;AAAA,MAAA;AAGnC,UAAI,OAAO;AAAA,IAAA;AAAA,EAEb,GAAG,EAAE;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,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const React = require("react");
|
|
4
4
|
const MULTIPLE_SPACES_REG_EXP = / +/g;
|
|
5
5
|
function normalize(text) {
|
|
6
6
|
return text.replace(MULTIPLE_SPACES_REG_EXP, " ").trim();
|
|
@@ -14,9 +14,8 @@ function getChildrenAsLabel(node) {
|
|
|
14
14
|
return normalize(node.map(getChildrenAsLabel).join(""));
|
|
15
15
|
} else {
|
|
16
16
|
let label = [];
|
|
17
|
-
|
|
18
|
-
if (child === null || child === void 0 || typeof child === "boolean")
|
|
19
|
-
;
|
|
17
|
+
React.Children.map(node, (child) => {
|
|
18
|
+
if (child === null || child === void 0 || typeof child === "boolean") ;
|
|
20
19
|
else if (typeof child === "string") {
|
|
21
20
|
label.push(child);
|
|
22
21
|
} else if (typeof child === "number") {
|
|
@@ -46,7 +45,7 @@ function getChildrenAsLabel(node) {
|
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
function useChildrenAsLabel(node) {
|
|
49
|
-
return
|
|
48
|
+
return React.useMemo(() => getChildrenAsLabel(node), [node]);
|
|
50
49
|
}
|
|
51
50
|
exports.getChildrenAsLabel = getChildrenAsLabel;
|
|
52
51
|
exports.useChildrenAsLabel = useChildrenAsLabel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChildrenAsLabel.cjs","sources":["../../../../../packages/react-utils/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,CAAC;AAEzBA,UAAAA,SAAA,IAAI,MAAM,CAAS,UAAA;AAC3B,UAAI,UAAU,QAAQ,UAAU,UAAa,OAAO,UAAU,UAAW;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,QAAA;AAAA,MACtB,OACM;AAEN,YAAI,WAAW,SAAS,cAAc,MAAM,OAAO;AAClD,gBAAM,aAAa,mBAAmB,MAAM,MAAM,QAAQ;AAE1D,cAAI,YAAY;AACf,kBAAM,KAAK,UAAU;AAAA,UAAA;AAAA,QACtB,WACU,cAAc,OAAO;AAEzB,gBAAA,aAAa,mBAAmB,MAAM,QAAQ;AAEpD,cAAI,YAAY;AACf,kBAAM,KAAK,UAAU;AAAA,UAAA;AAAA,QACtB,OAC+B;AACvB,kBAAA,KAAK,sBAAsB,KAAK;AAAA,QAAA;AAAA,MACzC;AAAA,IACD,CACA;AAED,WAAO,MAAM,SAAS,IAAI,MAAM,KAAK,EAAE,IAAI;AAAA,EAAA;AAE7C;AASO,SAAS,mBAAmB,MAAqC;AACvE,SAAOC,MAAAA,QAAQ,MAAM,mBAAmB,IAAI,GAAG,CAAC,IAAI,CAAC;AACtD;;;"}
|
|
@@ -13,8 +13,7 @@ function getChildrenAsLabel(node) {
|
|
|
13
13
|
} else {
|
|
14
14
|
let label = [];
|
|
15
15
|
Children.map(node, (child) => {
|
|
16
|
-
if (child === null || child === void 0 || typeof child === "boolean")
|
|
17
|
-
;
|
|
16
|
+
if (child === null || child === void 0 || typeof child === "boolean") ;
|
|
18
17
|
else if (typeof child === "string") {
|
|
19
18
|
label.push(child);
|
|
20
19
|
} else if (typeof child === "number") {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChildrenAsLabel.js","sources":["../../../../../packages/react-utils/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,CAAC;AAEzB,aAAA,IAAI,MAAM,CAAS,UAAA;AAC3B,UAAI,UAAU,QAAQ,UAAU,UAAa,OAAO,UAAU,UAAW;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,QAAA;AAAA,MACtB,OACM;AAEN,YAAI,WAAW,SAAS,cAAc,MAAM,OAAO;AAClD,gBAAM,aAAa,mBAAmB,MAAM,MAAM,QAAQ;AAE1D,cAAI,YAAY;AACf,kBAAM,KAAK,UAAU;AAAA,UAAA;AAAA,QACtB,WACU,cAAc,OAAO;AAEzB,gBAAA,aAAa,mBAAmB,MAAM,QAAQ;AAEpD,cAAI,YAAY;AACf,kBAAM,KAAK,UAAU;AAAA,UAAA;AAAA,QACtB,OAC+B;AACvB,kBAAA,KAAK,sBAAsB,KAAK;AAAA,QAAA;AAAA,MACzC;AAAA,IACD,CACA;AAED,WAAO,MAAM,SAAS,IAAI,MAAM,KAAK,EAAE,IAAI;AAAA,EAAA;AAE7C;AASO,SAAS,mBAAmB,MAAqC;AACvE,SAAO,QAAQ,MAAM,mBAAmB,IAAI,GAAG,CAAC,IAAI,CAAC;AACtD;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const React = require("react");
|
|
4
4
|
function setRef(ref, instance) {
|
|
5
5
|
if (ref) {
|
|
6
6
|
if (typeof ref === "function") {
|
|
@@ -11,8 +11,8 @@ function setRef(ref, instance) {
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
function useComposeRef(...refs) {
|
|
14
|
-
const initialRefs =
|
|
15
|
-
const composeRef =
|
|
14
|
+
const initialRefs = React.useRef(refs);
|
|
15
|
+
const composeRef = React.useMemo(() => {
|
|
16
16
|
function composedRefCallback(instance) {
|
|
17
17
|
initialRefs.current.forEach((ref) => setRef(ref, instance));
|
|
18
18
|
setCurrent(instance);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useComposeRef.cjs","sources":["../../../../../packages/react-utils/src/hooks/useComposeRef.ts"],"sourcesContent":["import { MutableRefObject, RefCallback, useMemo, useRef } from 'react'\n\nexport type MaybeRef<T> = ((instance: T | null) => void) | MutableRefObject<T | null> | null | undefined\nexport type ComposedRefCallback<T> = RefCallback<T> & { current: T | null }\n\nfunction setRef<T>(ref: MaybeRef<T>, instance: T | null): void {\n\tif (ref) {\n\t\tif (typeof ref === 'function') {\n\t\t\tref(instance)\n\t\t} else if (instance) {\n\t\t\tref.current = instance\n\t\t}\n\t}\n}\n\n/**\n * Fills any number of refs with an instance\n *\n * Useful when you need to use outer ref and inner in the same time, e.g. passing element\n * back to forwardedRef an also using the same value within the component locally.\n *\n * @param refs - Rest parameter of refs to fill with instance\n * @returns Returns a function similar to a RefCallback\n */\nexport function useComposeRef<T>(...refs: MaybeRef<T>[]): ComposedRefCallback<T> {\n\tconst initialRefs = useRef(refs)\n\n\tconst composeRef: ComposedRefCallback<T> = useMemo(() => {\n\t\tfunction composedRefCallback(instance: T | null) {\n\t\t\tinitialRefs.current.forEach(ref => setRef(ref, instance))\n\t\t\tsetCurrent(instance)\n\t\t}\n\n\t\tfunction setCurrent(instance: T | null) {\n\t\t\tif (instance) {\n\t\t\t\tcomposedRefCallback.current = instance\n\t\t\t}\n\t\t}\n\n\t\tcomposedRefCallback.current = null as T | null\n\n\t\treturn composedRefCallback\n\t}, [])\n\n\treturn composeRef\n}\n"],"names":["useRef","useMemo"],"mappings":";;;AAKA,SAAS,OAAU,KAAkB,UAA0B;AAC9D,MAAI,KAAK;AACJ,QAAA,OAAO,QAAQ,YAAY;AAC9B,UAAI,QAAQ;AAAA,eACF,UAAU;AACpB,UAAI,UAAU;AAAA,IAAA;AAAA,EACf;AAEF;AAWO,SAAS,iBAAoB,MAA6C;AAC1E,QAAA,cAAcA,aAAO,IAAI;AAEzB,QAAA,aAAqCC,MAAAA,QAAQ,MAAM;AACxD,aAAS,oBAAoB,UAAoB;AAChD,kBAAY,QAAQ,QAAQ,CAAA,QAAO,OAAO,KAAK,QAAQ,CAAC;AACxD,iBAAW,QAAQ;AAAA,IAAA;AAGpB,aAAS,WAAW,UAAoB;AACvC,UAAI,UAAU;AACb,4BAAoB,UAAU;AAAA,MAAA;AAAA,IAC/B;AAGD,wBAAoB,UAAU;AAEvB,WAAA;AAAA,EACR,GAAG,EAAE;AAEE,SAAA;AACR;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useComposeRef.js","sources":["../../../../../packages/react-utils/src/hooks/useComposeRef.ts"],"sourcesContent":["import { MutableRefObject, RefCallback, useMemo, useRef } from 'react'\n\nexport type MaybeRef<T> = ((instance: T | null) => void) | MutableRefObject<T | null> | null | undefined\nexport type ComposedRefCallback<T> = RefCallback<T> & { current: T | null }\n\nfunction setRef<T>(ref: MaybeRef<T>, instance: T | null): void {\n\tif (ref) {\n\t\tif (typeof ref === 'function') {\n\t\t\tref(instance)\n\t\t} else if (instance) {\n\t\t\tref.current = instance\n\t\t}\n\t}\n}\n\n/**\n * Fills any number of refs with an instance\n *\n * Useful when you need to use outer ref and inner in the same time, e.g. passing element\n * back to forwardedRef an also using the same value within the component locally.\n *\n * @param refs - Rest parameter of refs to fill with instance\n * @returns Returns a function similar to a RefCallback\n */\nexport function useComposeRef<T>(...refs: MaybeRef<T>[]): ComposedRefCallback<T> {\n\tconst initialRefs = useRef(refs)\n\n\tconst composeRef: ComposedRefCallback<T> = useMemo(() => {\n\t\tfunction composedRefCallback(instance: T | null) {\n\t\t\tinitialRefs.current.forEach(ref => setRef(ref, instance))\n\t\t\tsetCurrent(instance)\n\t\t}\n\n\t\tfunction setCurrent(instance: T | null) {\n\t\t\tif (instance) {\n\t\t\t\tcomposedRefCallback.current = instance\n\t\t\t}\n\t\t}\n\n\t\tcomposedRefCallback.current = null as T | null\n\n\t\treturn composedRefCallback\n\t}, [])\n\n\treturn composeRef\n}\n"],"names":[],"mappings":";AAKA,SAAS,OAAU,KAAkB,UAA0B;AAC9D,MAAI,KAAK;AACJ,QAAA,OAAO,QAAQ,YAAY;AAC9B,UAAI,QAAQ;AAAA,eACF,UAAU;AACpB,UAAI,UAAU;AAAA,IAAA;AAAA,EACf;AAEF;AAWO,SAAS,iBAAoB,MAA6C;AAC1E,QAAA,cAAc,OAAO,IAAI;AAEzB,QAAA,aAAqC,QAAQ,MAAM;AACxD,aAAS,oBAAoB,UAAoB;AAChD,kBAAY,QAAQ,QAAQ,CAAA,QAAO,OAAO,KAAK,QAAQ,CAAC;AACxD,iBAAW,QAAQ;AAAA,IAAA;AAGpB,aAAS,WAAW,UAAoB;AACvC,UAAI,UAAU;AACb,4BAAoB,UAAU;AAAA,MAAA;AAAA,IAC/B;AAGD,wBAAoB,UAAU;AAEvB,WAAA;AAAA,EACR,GAAG,EAAE;AAEE,SAAA;AACR;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConstantLengthInvariant.cjs","sources":["../../../../../packages/react-utils/src/hooks/useConstantLengthInvariant.ts"],"sourcesContent":["import { usePreviousValue } from './usePreviousValue'\n\n// This entire hook should get optimized away for prod\nexport const useConstantLengthInvariant = <Item>(items: Item[], message?: string) => {\n\tif (import.meta.env.DEV) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst previous = usePreviousValue(items)\n\t\tif (previous.length !== items.length) {\n\t\t\tthrow new Error(\n\t\t\t\t`Invariant violation: ${message || 'Changing the length of an array whose length must remain constant between renders.'\n\t\t\t\t}`,\n\t\t\t)\n\t\t}\n\t}\n}\n"],"names":["usePreviousValue"],"mappings":";;;AAGa,MAAA,6BAA6B,CAAO,OAAe,YAAqB;AAC3D;AAElB,UAAA,WAAWA,kCAAiB,KAAK;AACnC,QAAA,SAAS,WAAW,MAAM,QAAQ;AACrC,YAAM,IAAI;AAAA,QACT,wBAAwB,WAAW,oFACnC;AAAA,MACD;AAAA,IAAA;AAAA,EACD;AAEF;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConstantLengthInvariant.js","sources":["../../../../../packages/react-utils/src/hooks/useConstantLengthInvariant.ts"],"sourcesContent":["import { usePreviousValue } from './usePreviousValue'\n\n// This entire hook should get optimized away for prod\nexport const useConstantLengthInvariant = <Item>(items: Item[], message?: string) => {\n\tif (import.meta.env.DEV) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst previous = usePreviousValue(items)\n\t\tif (previous.length !== items.length) {\n\t\t\tthrow new Error(\n\t\t\t\t`Invariant violation: ${message || 'Changing the length of an array whose length must remain constant between renders.'\n\t\t\t\t}`,\n\t\t\t)\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";AAGa,MAAA,6BAA6B,CAAO,OAAe,YAAqB;AAC3D;AAElB,UAAA,WAAW,iBAAiB,KAAK;AACnC,QAAA,SAAS,WAAW,MAAM,QAAQ;AACrC,YAAM,IAAI;AAAA,QACT,wBAAwB,WAAW,oFACnC;AAAA,MACD;AAAA,IAAA;AAAA,EACD;AAEF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConstantValueInvariant.cjs","sources":["../../../../../packages/react-utils/src/hooks/useConstantValueInvariant.ts"],"sourcesContent":["import { usePreviousValue } from './usePreviousValue'\n\n// This entire hook should get optimized away for prod\nexport const useConstantValueInvariant = <Value>(value: Value, message?: string) => {\n\tif (import.meta.env.DEV) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst previous = usePreviousValue(value)\n\t\tif (previous !== value) {\n\t\t\tthrow new Error(\n\t\t\t\t`Invariant violation: ${message || 'Changing a value which must remain constant between renders.'}`,\n\t\t\t)\n\t\t}\n\t}\n}\n"],"names":["usePreviousValue"],"mappings":";;;AAGa,MAAA,4BAA4B,CAAQ,OAAc,YAAqB;AAC1D;AAElB,UAAA,WAAWA,kCAAiB,KAAK;AACvC,QAAI,aAAa,OAAO;AACvB,YAAM,IAAI;AAAA,QACT,wBAAwB,WAAW,8DAA8D;AAAA,MAClG;AAAA,IAAA;AAAA,EACD;AAEF;;"}
|