@semcore/core 16.0.0 → 16.0.1
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/CHANGELOG.md +10 -0
- package/README.md +1 -31
- package/lib/LastInteractionType.js +3 -5
- package/lib/LastInteractionType.js.map +1 -1
- package/lib/LastInteractionType.mjs +1 -2
- package/lib/LastInteractionType.mjs.map +1 -1
- package/lib/core-types/Component.d.ts +10 -12
- package/lib/core-types/Component.js +51 -22
- package/lib/core-types/Component.js.map +1 -1
- package/lib/core-types/Component.mjs +11 -14
- package/lib/core-types/Component.mjs.map +1 -1
- package/lib/core-types/UnknownProperties.js.map +1 -1
- package/lib/core-types/UnknownProperties.mjs.map +1 -1
- package/lib/core-types/reshadow.d.js.map +1 -1
- package/lib/core-types/reshadow.d.mjs.map +1 -1
- package/lib/core-types/symbols.js +9 -18
- package/lib/core-types/symbols.js.map +1 -1
- package/lib/core-types/symbols.mjs.map +1 -1
- package/lib/coreFactory.d.ts +4 -4
- package/lib/coreFactory.js +37 -38
- package/lib/coreFactory.js.map +1 -1
- package/lib/coreFactory.mjs +39 -34
- package/lib/coreFactory.mjs.map +1 -1
- package/lib/enhancement/Children.js +9 -10
- package/lib/enhancement/Children.js.map +1 -1
- package/lib/enhancement/Children.mjs +7 -7
- package/lib/enhancement/Children.mjs.map +1 -1
- package/lib/enhancement/Root.d.ts +1 -1
- package/lib/enhancement/Root.js +5 -6
- package/lib/enhancement/Root.js.map +1 -1
- package/lib/enhancement/Root.mjs +2 -2
- package/lib/enhancement/Root.mjs.map +1 -1
- package/lib/enhancement/bindHandler.d.ts +1 -1
- package/lib/enhancement/bindHandler.js +2 -3
- package/lib/enhancement/bindHandler.js.map +1 -1
- package/lib/enhancement/bindHandler.mjs +1 -1
- package/lib/enhancement/bindHandler.mjs.map +1 -1
- package/lib/enhancement/dataName.js +2 -3
- package/lib/enhancement/dataName.js.map +1 -1
- package/lib/enhancement/dataName.mjs.map +1 -1
- package/lib/enhancement/enhance.js +1 -2
- package/lib/enhancement/enhance.js.map +1 -1
- package/lib/enhancement/enhance.mjs.map +1 -1
- package/lib/enhancement/functionDefaultProps.js +1 -2
- package/lib/enhancement/functionDefaultProps.js.map +1 -1
- package/lib/enhancement/functionDefaultProps.mjs.map +1 -1
- package/lib/enhancement/hoistProps.d.ts +1 -1
- package/lib/enhancement/hoistProps.js +5 -7
- package/lib/enhancement/hoistProps.js.map +1 -1
- package/lib/enhancement/hoistProps.mjs +2 -2
- package/lib/enhancement/hoistProps.mjs.map +1 -1
- package/lib/enhancement/i18n.js +2 -3
- package/lib/enhancement/i18n.js.map +1 -1
- package/lib/enhancement/i18n.mjs.map +1 -1
- package/lib/enhancement/inheritedName.js +2 -3
- package/lib/enhancement/inheritedName.js.map +1 -1
- package/lib/enhancement/inheritedName.mjs.map +1 -1
- package/lib/enhancement/staticChildren.js +5 -8
- package/lib/enhancement/staticChildren.js.map +1 -1
- package/lib/enhancement/staticChildren.mjs +1 -1
- package/lib/enhancement/staticChildren.mjs.map +1 -1
- package/lib/enhancement/style.js +4 -6
- package/lib/enhancement/style.js.map +1 -1
- package/lib/enhancement/style.mjs +1 -1
- package/lib/enhancement/style.mjs.map +1 -1
- package/lib/enhancement/uncontrolledProps.js +4 -6
- package/lib/enhancement/uncontrolledProps.js.map +1 -1
- package/lib/enhancement/uncontrolledProps.mjs +2 -3
- package/lib/enhancement/uncontrolledProps.mjs.map +1 -1
- package/lib/esm/LastInteractionType.mjs +1 -2
- package/lib/esm/core-types/Component.mjs +11 -14
- package/lib/esm/coreFactory.mjs +39 -34
- package/lib/esm/enhancement/Children.mjs +7 -7
- package/lib/esm/enhancement/Root.mjs +2 -2
- package/lib/esm/enhancement/bindHandler.mjs +1 -1
- package/lib/esm/enhancement/hoistProps.mjs +2 -2
- package/lib/esm/enhancement/staticChildren.mjs +1 -1
- package/lib/esm/enhancement/style.mjs +1 -1
- package/lib/esm/enhancement/uncontrolledProps.mjs +2 -3
- package/lib/esm/index.mjs +3 -3
- package/lib/esm/register.mjs +1 -2
- package/lib/esm/styled/reshadow-core.mjs +9 -9
- package/lib/esm/styled/sstyled.mjs +1 -1
- package/lib/esm/utils/assignProps.mjs +1 -1
- package/lib/esm/utils/createHoc.mjs +10 -7
- package/lib/esm/utils/enhances/WithI18n.mjs +12 -10
- package/lib/esm/utils/enhances/i18nEnhance.mjs +4 -4
- package/lib/esm/utils/logger.mjs +1 -2
- package/lib/index.d.ts +5 -5
- package/lib/index.js +4 -4
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +3 -3
- package/lib/index.mjs.map +1 -1
- package/lib/register.js +4 -7
- package/lib/register.js.map +1 -1
- package/lib/register.mjs +1 -2
- package/lib/register.mjs.map +1 -1
- package/lib/styled/index.d.ts +1 -2
- package/lib/styled/index.js.map +1 -1
- package/lib/styled/index.mjs.map +1 -1
- package/lib/styled/reshadow-core.js +27 -50
- package/lib/styled/reshadow-core.js.map +1 -1
- package/lib/styled/reshadow-core.mjs +9 -9
- package/lib/styled/reshadow-core.mjs.map +1 -1
- package/lib/styled/sstyled.d.ts +2 -2
- package/lib/styled/sstyled.js +3 -3
- package/lib/styled/sstyled.js.map +1 -1
- package/lib/styled/sstyled.mjs +1 -1
- package/lib/styled/sstyled.mjs.map +1 -1
- package/lib/theme/dark.json +2 -2
- package/lib/theme/light.json +2 -42
- package/lib/theme/processor.js +61 -63
- package/lib/theme/processor.js.map +1 -1
- package/lib/theme/processor.mjs +52 -53
- package/lib/theme/processor.mjs.map +1 -1
- package/lib/theme/themes/auto.css +224 -2
- package/lib/theme/themes/dark.css +112 -1
- package/lib/theme/themes/dark.d.ts +91 -0
- package/lib/theme/themes/dark.js +93 -3
- package/lib/theme/themes/dark.js.map +1 -1
- package/lib/theme/themes/dark.mjs +92 -1
- package/lib/theme/themes/dark.mjs.map +1 -1
- package/lib/theme/themes/default.css +112 -1
- package/lib/theme/themes/default.d.ts +91 -0
- package/lib/theme/themes/default.js +93 -3
- package/lib/theme/themes/default.js.map +1 -1
- package/lib/theme/themes/default.mjs +92 -1
- package/lib/theme/themes/default.mjs.map +1 -1
- package/lib/theme/themes/light.css +112 -1
- package/lib/theme/themes/light.d.ts +91 -0
- package/lib/theme/themes/light.js +93 -3
- package/lib/theme/themes/light.js.map +1 -1
- package/lib/theme/themes/light.mjs +92 -1
- package/lib/theme/themes/light.mjs.map +1 -1
- package/lib/theme/utils.d.ts +2 -1
- package/lib/theme/utils.js +36 -32
- package/lib/theme/utils.js.map +1 -1
- package/lib/theme/utils.mjs +31 -23
- package/lib/theme/utils.mjs.map +1 -1
- package/lib/utils/CSSinJS.d.ts +1 -1
- package/lib/utils/CSSinJS.js +4 -5
- package/lib/utils/CSSinJS.js.map +1 -1
- package/lib/utils/CSSinJS.mjs +2 -2
- package/lib/utils/CSSinJS.mjs.map +1 -1
- package/lib/utils/ScreenReaderOnly.d.ts +1 -1
- package/lib/utils/ScreenReaderOnly.js +2 -3
- package/lib/utils/ScreenReaderOnly.js.map +1 -1
- package/lib/utils/ScreenReaderOnly.mjs.map +1 -1
- package/lib/utils/ThemeProvider.d.ts +1 -1
- package/lib/utils/ThemeProvider.js +5 -9
- package/lib/utils/ThemeProvider.js.map +1 -1
- package/lib/utils/ThemeProvider.mjs.map +1 -1
- package/lib/utils/addonText.d.ts +1 -1
- package/lib/utils/addonText.js +1 -1
- package/lib/utils/addonText.js.map +1 -1
- package/lib/utils/addonText.mjs.map +1 -1
- package/lib/utils/addonTextChildren.d.ts +1 -1
- package/lib/utils/addonTextChildren.js +3 -4
- package/lib/utils/addonTextChildren.js.map +1 -1
- package/lib/utils/addonTextChildren.mjs +1 -1
- package/lib/utils/addonTextChildren.mjs.map +1 -1
- package/lib/utils/ariaProps.d.ts +1 -1
- package/lib/utils/ariaProps.js.map +1 -1
- package/lib/utils/ariaProps.mjs.map +1 -1
- package/lib/utils/assignProps.d.ts +1 -1
- package/lib/utils/assignProps.js +2 -2
- package/lib/utils/assignProps.js.map +1 -1
- package/lib/utils/assignProps.mjs +1 -1
- package/lib/utils/assignProps.mjs.map +1 -1
- package/lib/utils/canUseDOM.js.map +1 -1
- package/lib/utils/canUseDOM.mjs.map +1 -1
- package/lib/utils/capitalizeFirstLetter.js.map +1 -1
- package/lib/utils/capitalizeFirstLetter.mjs.map +1 -1
- package/lib/utils/color.js +18 -18
- package/lib/utils/color.js.map +1 -1
- package/lib/utils/color.mjs +16 -15
- package/lib/utils/color.mjs.map +1 -1
- package/lib/utils/compose.js.map +1 -1
- package/lib/utils/compose.mjs.map +1 -1
- package/lib/utils/createHoc.d.ts +1 -1
- package/lib/utils/createHoc.js +11 -11
- package/lib/utils/createHoc.js.map +1 -1
- package/lib/utils/createHoc.mjs +10 -7
- package/lib/utils/createHoc.mjs.map +1 -1
- package/lib/utils/createUUID.js.map +1 -1
- package/lib/utils/createUUID.mjs.map +1 -1
- package/lib/utils/cssToIntDefault.d.ts +1 -1
- package/lib/utils/cssToIntDefault.js +2 -2
- package/lib/utils/cssToIntDefault.js.map +1 -1
- package/lib/utils/cssToIntDefault.mjs +2 -2
- package/lib/utils/cssToIntDefault.mjs.map +1 -1
- package/lib/utils/enhances/WithAutoFocus.d.ts +3 -3
- package/lib/utils/enhances/WithAutoFocus.js +12 -12
- package/lib/utils/enhances/WithAutoFocus.js.map +1 -1
- package/lib/utils/enhances/WithAutoFocus.mjs +11 -9
- package/lib/utils/enhances/WithAutoFocus.mjs.map +1 -1
- package/lib/utils/enhances/WithCSS.d.ts +4 -4
- package/lib/utils/enhances/WithCSS.js +15 -20
- package/lib/utils/enhances/WithCSS.js.map +1 -1
- package/lib/utils/enhances/WithCSS.mjs +8 -8
- package/lib/utils/enhances/WithCSS.mjs.map +1 -1
- package/lib/utils/enhances/WithI18n.d.ts +3 -3
- package/lib/utils/enhances/WithI18n.js +19 -22
- package/lib/utils/enhances/WithI18n.js.map +1 -1
- package/lib/utils/enhances/WithI18n.mjs +12 -10
- package/lib/utils/enhances/WithI18n.mjs.map +1 -1
- package/lib/utils/enhances/WithKeyboardFocus.d.ts +4 -3
- package/lib/utils/enhances/WithKeyboardFocus.js +28 -24
- package/lib/utils/enhances/WithKeyboardFocus.js.map +1 -1
- package/lib/utils/enhances/WithKeyboardFocus.mjs +26 -19
- package/lib/utils/enhances/WithKeyboardFocus.mjs.map +1 -1
- package/lib/utils/enhances/WithRef.d.ts +1 -1
- package/lib/utils/enhances/WithRef.js +3 -4
- package/lib/utils/enhances/WithRef.js.map +1 -1
- package/lib/utils/enhances/WithRef.mjs +1 -1
- package/lib/utils/enhances/WithRef.mjs.map +1 -1
- package/lib/utils/enhances/a11yEnhance.js +9 -10
- package/lib/utils/enhances/a11yEnhance.js.map +1 -1
- package/lib/utils/enhances/a11yEnhance.mjs +7 -7
- package/lib/utils/enhances/a11yEnhance.mjs.map +1 -1
- package/lib/utils/enhances/animatedSizeEnhance.d.ts +1 -1
- package/lib/utils/enhances/animatedSizeEnhance.js +12 -10
- package/lib/utils/enhances/animatedSizeEnhance.js.map +1 -1
- package/lib/utils/enhances/animatedSizeEnhance.mjs +11 -7
- package/lib/utils/enhances/animatedSizeEnhance.mjs.map +1 -1
- package/lib/utils/enhances/autoFocusEnhance.d.ts +1 -1
- package/lib/utils/enhances/autoFocusEnhance.js +2 -3
- package/lib/utils/enhances/autoFocusEnhance.js.map +1 -1
- package/lib/utils/enhances/autoFocusEnhance.mjs.map +1 -1
- package/lib/utils/enhances/contextEnhance.js +2 -3
- package/lib/utils/enhances/contextEnhance.js.map +1 -1
- package/lib/utils/enhances/contextEnhance.mjs.map +1 -1
- package/lib/utils/enhances/i18nEnhance.d.ts +2 -2
- package/lib/utils/enhances/i18nEnhance.js +10 -10
- package/lib/utils/enhances/i18nEnhance.js.map +1 -1
- package/lib/utils/enhances/i18nEnhance.mjs +4 -4
- package/lib/utils/enhances/i18nEnhance.mjs.map +1 -1
- package/lib/utils/enhances/keyboardFocusEnhance.d.ts +1 -1
- package/lib/utils/enhances/keyboardFocusEnhance.js +7 -7
- package/lib/utils/enhances/keyboardFocusEnhance.js.map +1 -1
- package/lib/utils/enhances/keyboardFocusEnhance.mjs +2 -2
- package/lib/utils/enhances/keyboardFocusEnhance.mjs.map +1 -1
- package/lib/utils/enhances/resolveColorEnhance.js +4 -5
- package/lib/utils/enhances/resolveColorEnhance.js.map +1 -1
- package/lib/utils/enhances/resolveColorEnhance.mjs +2 -2
- package/lib/utils/enhances/resolveColorEnhance.mjs.map +1 -1
- package/lib/utils/eventEmitter.js +2 -3
- package/lib/utils/eventEmitter.js.map +1 -1
- package/lib/utils/eventEmitter.mjs.map +1 -1
- package/lib/utils/findComponent.d.ts +1 -1
- package/lib/utils/findComponent.js +14 -15
- package/lib/utils/findComponent.js.map +1 -1
- package/lib/utils/findComponent.mjs +12 -12
- package/lib/utils/findComponent.mjs.map +1 -1
- package/lib/utils/fire.js +1 -1
- package/lib/utils/fire.js.map +1 -1
- package/lib/utils/fire.mjs.map +1 -1
- package/lib/utils/focus-lock/focusBorders.js +12 -16
- package/lib/utils/focus-lock/focusBorders.js.map +1 -1
- package/lib/utils/focus-lock/focusBorders.mjs +8 -8
- package/lib/utils/focus-lock/focusBorders.mjs.map +1 -1
- package/lib/utils/focus-lock/getFocusableIn.js +2 -3
- package/lib/utils/focus-lock/getFocusableIn.js.map +1 -1
- package/lib/utils/focus-lock/getFocusableIn.mjs +1 -1
- package/lib/utils/focus-lock/getFocusableIn.mjs.map +1 -1
- package/lib/utils/focus-lock/isFocusInside.js +1 -2
- package/lib/utils/focus-lock/isFocusInside.js.map +1 -1
- package/lib/utils/focus-lock/isFocusInside.mjs.map +1 -1
- package/lib/utils/focus-lock/isFocusable.js +2 -3
- package/lib/utils/focus-lock/isFocusable.js.map +1 -1
- package/lib/utils/focus-lock/isFocusable.mjs.map +1 -1
- package/lib/utils/focus-lock/setFocus.js +4 -5
- package/lib/utils/focus-lock/setFocus.js.map +1 -1
- package/lib/utils/focus-lock/setFocus.mjs +2 -2
- package/lib/utils/focus-lock/setFocus.mjs.map +1 -1
- package/lib/utils/getAccessibleName.js +1 -1
- package/lib/utils/getAccessibleName.js.map +1 -1
- package/lib/utils/getAccessibleName.mjs.map +1 -1
- package/lib/utils/getDisplayName.d.ts +1 -1
- package/lib/utils/getDisplayName.js.map +1 -1
- package/lib/utils/getDisplayName.mjs.map +1 -1
- package/lib/utils/getEventTarget.js +2 -3
- package/lib/utils/getEventTarget.js.map +1 -1
- package/lib/utils/getEventTarget.mjs.map +1 -1
- package/lib/utils/getOriginChildren.js +3 -4
- package/lib/utils/getOriginChildren.js.map +1 -1
- package/lib/utils/getOriginChildren.mjs +1 -1
- package/lib/utils/getOriginChildren.mjs.map +1 -1
- package/lib/utils/getRandomInt.js.map +1 -1
- package/lib/utils/getRandomInt.mjs.map +1 -1
- package/lib/utils/getValue.js +1 -3
- package/lib/utils/getValue.js.map +1 -1
- package/lib/utils/getValue.mjs +1 -3
- package/lib/utils/getValue.mjs.map +1 -1
- package/lib/utils/hasLabels.js +5 -6
- package/lib/utils/hasLabels.js.map +1 -1
- package/lib/utils/hasLabels.mjs +3 -3
- package/lib/utils/hasLabels.mjs.map +1 -1
- package/lib/utils/hasParent.js +2 -3
- package/lib/utils/hasParent.js.map +1 -1
- package/lib/utils/hasParent.mjs +3 -2
- package/lib/utils/hasParent.mjs.map +1 -1
- package/lib/utils/if.d.ts +2 -2
- package/lib/utils/if.js +1 -2
- package/lib/utils/if.js.map +1 -1
- package/lib/utils/if.mjs.map +1 -1
- package/lib/utils/ifChildren.d.ts +1 -1
- package/lib/utils/ifChildren.js +1 -2
- package/lib/utils/ifChildren.js.map +1 -1
- package/lib/utils/ifChildren.mjs.map +1 -1
- package/lib/utils/injectStyle.js +3 -5
- package/lib/utils/injectStyle.js.map +1 -1
- package/lib/utils/injectStyle.mjs +1 -2
- package/lib/utils/injectStyle.mjs.map +1 -1
- package/lib/utils/inputProps.js +1 -2
- package/lib/utils/inputProps.js.map +1 -1
- package/lib/utils/inputProps.mjs.map +1 -1
- package/lib/utils/isInteractiveElement.js.map +1 -1
- package/lib/utils/isInteractiveElement.mjs.map +1 -1
- package/lib/utils/isNode.js +1 -1
- package/lib/utils/isNode.js.map +1 -1
- package/lib/utils/isNode.mjs.map +1 -1
- package/lib/utils/isPromise.js.map +1 -1
- package/lib/utils/isPromise.mjs.map +1 -1
- package/lib/utils/isRetina.js.map +1 -1
- package/lib/utils/isRetina.mjs.map +1 -1
- package/lib/utils/logger.js +4 -7
- package/lib/utils/logger.js.map +1 -1
- package/lib/utils/logger.mjs +1 -2
- package/lib/utils/logger.mjs.map +1 -1
- package/lib/utils/numericChecker.js.map +1 -1
- package/lib/utils/numericChecker.mjs.map +1 -1
- package/lib/utils/ownerDocument.js.map +1 -1
- package/lib/utils/ownerDocument.mjs.map +1 -1
- package/lib/utils/pick.js.map +1 -1
- package/lib/utils/pick.mjs.map +1 -1
- package/lib/utils/propsForElement.d.ts +1 -1
- package/lib/utils/propsForElement.js +2 -3
- package/lib/utils/propsForElement.js.map +1 -1
- package/lib/utils/propsForElement.mjs.map +1 -1
- package/lib/utils/rafTrottle.js +1 -2
- package/lib/utils/rafTrottle.js.map +1 -1
- package/lib/utils/rafTrottle.mjs.map +1 -1
- package/lib/utils/reactToText.d.ts +1 -1
- package/lib/utils/reactToText.js +1 -2
- package/lib/utils/reactToText.js.map +1 -1
- package/lib/utils/reactToText.mjs.map +1 -1
- package/lib/utils/ref.d.ts +1 -1
- package/lib/utils/ref.js +1 -1
- package/lib/utils/ref.js.map +1 -1
- package/lib/utils/ref.mjs.map +1 -1
- package/lib/utils/setRef.js +1 -2
- package/lib/utils/setRef.js.map +1 -1
- package/lib/utils/setRef.mjs.map +1 -1
- package/lib/utils/syncScroll.js +2 -2
- package/lib/utils/syncScroll.js.map +1 -1
- package/lib/utils/syncScroll.mjs +1 -1
- package/lib/utils/syncScroll.mjs.map +1 -1
- package/lib/utils/uncontroll.d.ts +1 -1
- package/lib/utils/uncontroll.js +1 -1
- package/lib/utils/uncontroll.js.map +1 -1
- package/lib/utils/uncontroll.mjs.map +1 -1
- package/lib/utils/uniqueID.d.ts +1 -1
- package/lib/utils/uniqueID.js +5 -5
- package/lib/utils/uniqueID.js.map +1 -1
- package/lib/utils/uniqueID.mjs +3 -0
- package/lib/utils/uniqueID.mjs.map +1 -1
- package/lib/utils/use/useColorResolver.js +7 -106
- package/lib/utils/use/useColorResolver.js.map +1 -1
- package/lib/utils/use/useColorResolver.mjs +5 -103
- package/lib/utils/use/useColorResolver.mjs.map +1 -1
- package/lib/utils/use/useCss.d.ts +1 -1
- package/lib/utils/use/useCss.js +2 -3
- package/lib/utils/use/useCss.js.map +1 -1
- package/lib/utils/use/useCss.mjs.map +1 -1
- package/lib/utils/use/useEnhancedEffect.js +2 -3
- package/lib/utils/use/useEnhancedEffect.js.map +1 -1
- package/lib/utils/use/useEnhancedEffect.mjs.map +1 -1
- package/lib/utils/use/useEventCallback.js +1 -1
- package/lib/utils/use/useEventCallback.js.map +1 -1
- package/lib/utils/use/useEventCallback.mjs.map +1 -1
- package/lib/utils/use/useEventListener.js +2 -3
- package/lib/utils/use/useEventListener.js.map +1 -1
- package/lib/utils/use/useEventListener.mjs.map +1 -1
- package/lib/utils/use/useFocusLock.d.ts +1 -1
- package/lib/utils/use/useFocusLock.js +8 -11
- package/lib/utils/use/useFocusLock.js.map +1 -1
- package/lib/utils/use/useFocusLock.mjs +4 -4
- package/lib/utils/use/useFocusLock.mjs.map +1 -1
- package/lib/utils/use/usePreventScroll.js +2 -2
- package/lib/utils/use/usePreventScroll.js.map +1 -1
- package/lib/utils/use/usePreventScroll.mjs +1 -1
- package/lib/utils/use/usePreventScroll.mjs.map +1 -1
- package/lib/utils/useCssVariable.d.ts +2 -2
- package/lib/utils/useCssVariable.js +3 -5
- package/lib/utils/useCssVariable.js.map +1 -1
- package/lib/utils/useCssVariable.mjs.map +1 -1
- package/lib/utils/zIndexStacking.js +6 -9
- package/lib/utils/zIndexStacking.js.map +1 -1
- package/lib/utils/zIndexStacking.mjs +2 -2
- package/lib/utils/zIndexStacking.mjs.map +1 -1
- package/package.json +6 -9
- package/vite.config.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboardFocusEnhance.js","names":["_react","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"file":"keyboardFocusEnhance.js","names":["_react","_interopRequireDefault","require","_LastInteractionType","_assignProps","enforcedKeyboardFocusEnhanceContext","exports","React","createContext","keyboardFocusEnhance","makeFocusable","arguments","length","undefined","props","_props$tabIndex","autoFocus","disabled","loading","tabIndex","_React$useState","useState","_React$useState2","_slicedToArray2","keyboardFocused","setKeyboardFocused","ref","useRef","handleFocus","useCallback","event","isTrusted","lastInteraction","isKeyboard","handlerBlur","useEffect","timer","setTimeout","_ref$current","current","focus","clearTimeout","enforcedKeyboardFocus","useContext","assignProps","onFocus","onBlur","_default"],"sources":["../../../src/utils/enhances/keyboardFocusEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nimport type { UnknownProperties } from '../../core-types/UnknownProperties';\nimport { lastInteraction } from '../../LastInteractionType';\nimport assignProps from '../assignProps';\n\n/** @deprecated */\nexport interface IKeyboardFocusProps extends KeyboardFocusProps, UnknownProperties {}\nexport type KeyboardFocusProps = {\n /* Property responsible for displaying \"keyboard\" focus */\n keyboardFocused?: boolean;\n /**\n * Makes component to catch browser focus on component mount\n * @default false\n */\n autoFocus?: boolean;\n};\n\nexport const enforcedKeyboardFocusEnhanceContext = React.createContext(false);\n\nexport type KeyboardFocusEnhanceHook = (props: {\n tabIndex?: number;\n disabled?: boolean;\n loading?: boolean;\n autoFocus?: boolean;\n}) => {\n tabIndex: number;\n keyboardFocused: boolean;\n onFocus: (e: React.FocusEvent) => void;\n onBlur: () => void;\n};\n\nconst keyboardFocusEnhance = (makeFocusable = true): KeyboardFocusEnhanceHook => {\n return (props) => {\n const { autoFocus } = props;\n const disabled = props.disabled || props.loading;\n const tabIndex = props.tabIndex ?? (makeFocusable ? 0 : undefined);\n const [keyboardFocused, setKeyboardFocused] = React.useState(false);\n const ref = React.useRef<HTMLElement>(null);\n\n const handleFocus = React.useCallback((event: React.FocusEvent) => {\n if (event.isTrusted === true) {\n if (!lastInteraction.isKeyboard()) return;\n }\n setKeyboardFocused(true);\n }, []);\n const handlerBlur = React.useCallback(() => setKeyboardFocused(false), []);\n React.useEffect(() => {\n if (typeof autoFocus !== 'number' && !autoFocus) return;\n const timer = setTimeout(() => {\n ref.current?.focus();\n setKeyboardFocused(true);\n }, 0);\n return () => {\n clearTimeout(timer);\n };\n }, [autoFocus]);\n React.useEffect(() => {\n if (disabled) {\n setKeyboardFocused(false);\n }\n }, [disabled]);\n\n const enforcedKeyboardFocus = React.useContext(enforcedKeyboardFocusEnhanceContext);\n\n return assignProps(props, {\n tabIndex: disabled ? -1 : tabIndex,\n keyboardFocused: (keyboardFocused || enforcedKeyboardFocus) && !disabled,\n onFocus: handleFocus,\n onBlur: handlerBlur,\n ref,\n });\n };\n};\n\nexport default keyboardFocusEnhance;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,oBAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA;;AAYO,IAAMG,mCAAmC,GAAAC,OAAA,CAAAD,mCAAA,gBAAGE,iBAAK,CAACC,aAAa,CAAC,KAAK,CAAC;AAc7E,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAA,EAAuD;EAAA,IAAnDC,aAAa,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;EAChD,OAAO,UAACG,KAAK,EAAK;IAAA,IAAAC,eAAA;IAChB,IAAQC,SAAS,GAAKF,KAAK,CAAnBE,SAAS;IACjB,IAAMC,QAAQ,GAAGH,KAAK,CAACG,QAAQ,IAAIH,KAAK,CAACI,OAAO;IAChD,IAAMC,QAAQ,IAAAJ,eAAA,GAAGD,KAAK,CAACK,QAAQ,cAAAJ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QAAQ,CAAC,CAAC;IAEd,IAAMyB,qBAAqB,GAAGnC,iBAAK,CAACoC,UAAU,CAACtC,mCAAmC,CAAC;IAEnF,OAAO,IAAAuC,uBAAW,EAAC9B,KAAK,EAAE;MACxBK,QAAQ,EAAEF,QAAQ,GAAG,CAAC,CAAC,GAAGE,QAAQ;MAClCK,eAAe,EAAE,CAACA,eAAe,IAAIkB,qBAAqB,KAAK,CAACzB,QAAQ;MACxE4B,OAAO,EAAEjB,WAAW;MACpBkB,MAAM,EAAEZ,WAAW;MACnBR,GAAG,EAAHA;IACF,CAAC,CAAC;EACJ,CAAC;AACH,CAAC;AAAC,IAAAqB,QAAA,GAAAzC,OAAA,cAEaG,oBAAoB","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import assignProps from "../assignProps.mjs";
|
|
4
3
|
import { lastInteraction } from "../../LastInteractionType.mjs";
|
|
4
|
+
import assignProps from "../assignProps.mjs";
|
|
5
5
|
|
|
6
6
|
/** @deprecated */
|
|
7
7
|
|
|
@@ -31,7 +31,7 @@ var keyboardFocusEnhance = function keyboardFocusEnhance() {
|
|
|
31
31
|
if (typeof autoFocus !== 'number' && !autoFocus) return;
|
|
32
32
|
var timer = setTimeout(function () {
|
|
33
33
|
var _ref$current;
|
|
34
|
-
(_ref$current = ref.current) === null || _ref$current === void 0
|
|
34
|
+
(_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.focus();
|
|
35
35
|
setKeyboardFocused(true);
|
|
36
36
|
}, 0);
|
|
37
37
|
return function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboardFocusEnhance.mjs","names":["React","
|
|
1
|
+
{"version":3,"file":"keyboardFocusEnhance.mjs","names":["React","lastInteraction","assignProps","enforcedKeyboardFocusEnhanceContext","createContext","keyboardFocusEnhance","makeFocusable","arguments","length","undefined","props","_props$tabIndex","autoFocus","disabled","loading","tabIndex","_React$useState","useState","_React$useState2","_slicedToArray","keyboardFocused","setKeyboardFocused","ref","useRef","handleFocus","useCallback","event","isTrusted","isKeyboard","handlerBlur","useEffect","timer","setTimeout","_ref$current","current","focus","clearTimeout","enforcedKeyboardFocus","useContext","onFocus","onBlur"],"sources":["../../../src/utils/enhances/keyboardFocusEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nimport type { UnknownProperties } from '../../core-types/UnknownProperties';\nimport { lastInteraction } from '../../LastInteractionType';\nimport assignProps from '../assignProps';\n\n/** @deprecated */\nexport interface IKeyboardFocusProps extends KeyboardFocusProps, UnknownProperties {}\nexport type KeyboardFocusProps = {\n /* Property responsible for displaying \"keyboard\" focus */\n keyboardFocused?: boolean;\n /**\n * Makes component to catch browser focus on component mount\n * @default false\n */\n autoFocus?: boolean;\n};\n\nexport const enforcedKeyboardFocusEnhanceContext = React.createContext(false);\n\nexport type KeyboardFocusEnhanceHook = (props: {\n tabIndex?: number;\n disabled?: boolean;\n loading?: boolean;\n autoFocus?: boolean;\n}) => {\n tabIndex: number;\n keyboardFocused: boolean;\n onFocus: (e: React.FocusEvent) => void;\n onBlur: () => void;\n};\n\nconst keyboardFocusEnhance = (makeFocusable = true): KeyboardFocusEnhanceHook => {\n return (props) => {\n const { autoFocus } = props;\n const disabled = props.disabled || props.loading;\n const tabIndex = props.tabIndex ?? (makeFocusable ? 0 : undefined);\n const [keyboardFocused, setKeyboardFocused] = React.useState(false);\n const ref = React.useRef<HTMLElement>(null);\n\n const handleFocus = React.useCallback((event: React.FocusEvent) => {\n if (event.isTrusted === true) {\n if (!lastInteraction.isKeyboard()) return;\n }\n setKeyboardFocused(true);\n }, []);\n const handlerBlur = React.useCallback(() => setKeyboardFocused(false), []);\n React.useEffect(() => {\n if (typeof autoFocus !== 'number' && !autoFocus) return;\n const timer = setTimeout(() => {\n ref.current?.focus();\n setKeyboardFocused(true);\n }, 0);\n return () => {\n clearTimeout(timer);\n };\n }, [autoFocus]);\n React.useEffect(() => {\n if (disabled) {\n setKeyboardFocused(false);\n }\n }, [disabled]);\n\n const enforcedKeyboardFocus = React.useContext(enforcedKeyboardFocusEnhanceContext);\n\n return assignProps(props, {\n tabIndex: disabled ? -1 : tabIndex,\n keyboardFocused: (keyboardFocused || enforcedKeyboardFocus) && !disabled,\n onFocus: handleFocus,\n onBlur: handlerBlur,\n ref,\n });\n };\n};\n\nexport default keyboardFocusEnhance;\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AAGzB,SAASC,eAAe,QAAQ,+BAA2B;AAC3D,OAAOC,WAAW,MAAM,oBAAgB;;AAExC;;AAYA,OAAO,IAAMC,mCAAmC,gBAAGH,KAAK,CAACI,aAAa,CAAC,KAAK,CAAC;AAc7E,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAA,EAAuD;EAAA,IAAnDC,aAAa,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;EAChD,OAAO,UAACG,KAAK,EAAK;IAAA,IAAAC,eAAA;IAChB,IAAQC,SAAS,GAAKF,KAAK,CAAnBE,SAAS;IACjB,IAAMC,QAAQ,GAAGH,KAAK,CAACG,QAAQ,IAAIH,KAAK,CAACI,OAAO;IAChD,IAAMC,QAAQ,IAAAJ,eAAA,GAAGD,KAAK,CAACK,QAAQ,cAAAJ,eAAA,cAAAA,eAAA,GAAKL,aAAa,GAAG,CAAC,GAAGG,SAAU;IAClE,IAAAO,eAAA,GAA8ChB,KAAK,CAACiB,QAAQ,CAAC,KAAK,CAAC;MAAAC,gBAAA,GAAAC,cAAA,CAAAH,eAAA;MAA5DI,eAAe,GAAAF,gBAAA;MAAEG,kBAAkB,GAAAH,gBAAA;IAC1C,IAAMI,GAAG,GAAGtB,KAAK,CAACuB,MAAM,CAAc,IAAI,CAAC;IAE3C,IAAMC,WAAW,GAAGxB,KAAK,CAACyB,WAAW,CAAC,UAACC,KAAuB,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C;AACH,CAAC;AAED,eAAejB,oBAAoB","ignoreList":[]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _useColorResolver = require("../use/useColorResolver");
|
|
10
|
-
var _ref = require("../ref");
|
|
11
9
|
var _assignProps = _interopRequireDefault(require("../assignProps"));
|
|
10
|
+
var _ref = require("../ref");
|
|
11
|
+
var _useColorResolver = require("../use/useColorResolver");
|
|
12
12
|
var resolveColorEnhance = function resolveColorEnhance() {
|
|
13
13
|
return function (props) {
|
|
14
14
|
var ref = props.ref;
|
|
@@ -20,6 +20,5 @@ var resolveColorEnhance = function resolveColorEnhance() {
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
|
-
var _default = resolveColorEnhance;
|
|
24
|
-
exports["default"] = _default;
|
|
23
|
+
var _default = exports["default"] = resolveColorEnhance;
|
|
25
24
|
//# sourceMappingURL=resolveColorEnhance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveColorEnhance.js","names":["_react","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"file":"resolveColorEnhance.js","names":["_react","_interopRequireDefault","require","_assignProps","_ref","_useColorResolver","resolveColorEnhance","props","ref","internalRef","React","useRef","resolveColor","useColorResolver","assignProps","useForkRef","_default","exports"],"sources":["../../../src/utils/enhances/resolveColorEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nimport assignProps from '../assignProps';\nimport { useForkRef } from '../ref';\nimport { useColorResolver } from '../use/useColorResolver';\n\nconst resolveColorEnhance = () => {\n return (props: any) => {\n const { ref } = props;\n const internalRef = React.useRef<HTMLElement>();\n const resolveColor = useColorResolver();\n\n return assignProps(props, {\n ref: useForkRef(ref, internalRef),\n resolveColor,\n });\n };\n};\n\nexport default resolveColorEnhance;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AAEA,IAAMI,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAA,EAAS;EAChC,OAAO,UAACC,KAAU,EAAK;IACrB,IAAQC,GAAG,GAAKD,KAAK,CAAbC,GAAG;IACX,IAAMC,WAAW,GAAGC,iBAAK,CAACC,MAAM,CAAc,CAAC;IAC/C,IAAMC,YAAY,GAAG,IAAAC,kCAAgB,EAAC,CAAC;IAEvC,OAAO,IAAAC,uBAAW,EAACP,KAAK,EAAE;MACxBC,GAAG,EAAE,IAAAO,eAAU,EAACP,GAAG,EAAEC,WAAW,CAAC;MACjCG,YAAY,EAAZA;IACF,CAAC,CAAC;EACJ,CAAC;AACH,CAAC;AAAC,IAAAI,QAAA,GAAAC,OAAA,cAEaX,mBAAmB","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { useColorResolver } from "../use/useColorResolver.mjs";
|
|
3
|
-
import { useForkRef } from "../ref.mjs";
|
|
4
2
|
import assignProps from "../assignProps.mjs";
|
|
3
|
+
import { useForkRef } from "../ref.mjs";
|
|
4
|
+
import { useColorResolver } from "../use/useColorResolver.mjs";
|
|
5
5
|
var resolveColorEnhance = function resolveColorEnhance() {
|
|
6
6
|
return function (props) {
|
|
7
7
|
var ref = props.ref;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveColorEnhance.mjs","names":["React","
|
|
1
|
+
{"version":3,"file":"resolveColorEnhance.mjs","names":["React","assignProps","useForkRef","useColorResolver","resolveColorEnhance","props","ref","internalRef","useRef","resolveColor"],"sources":["../../../src/utils/enhances/resolveColorEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nimport assignProps from '../assignProps';\nimport { useForkRef } from '../ref';\nimport { useColorResolver } from '../use/useColorResolver';\n\nconst resolveColorEnhance = () => {\n return (props: any) => {\n const { ref } = props;\n const internalRef = React.useRef<HTMLElement>();\n const resolveColor = useColorResolver();\n\n return assignProps(props, {\n ref: useForkRef(ref, internalRef),\n resolveColor,\n });\n };\n};\n\nexport default resolveColorEnhance;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAOC,WAAW,MAAM,oBAAgB;AACxC,SAASC,UAAU,QAAQ,YAAQ;AACnC,SAASC,gBAAgB,QAAQ,6BAAyB;AAE1D,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAA,EAAS;EAChC,OAAO,UAACC,KAAU,EAAK;IACrB,IAAQC,GAAG,GAAKD,KAAK,CAAbC,GAAG;IACX,IAAMC,WAAW,GAAGP,KAAK,CAACQ,MAAM,CAAc,CAAC;IAC/C,IAAMC,YAAY,GAAGN,gBAAgB,CAAC,CAAC;IAEvC,OAAOF,WAAW,CAACI,KAAK,EAAE;MACxBC,GAAG,EAAEJ,UAAU,CAACI,GAAG,EAAEC,WAAW,CAAC;MACjCE,YAAY,EAAZA;IACF,CAAC,CAAC;EACJ,CAAC;AACH,CAAC;AAED,eAAeL,mBAAmB","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
@@ -8,7 +8,7 @@ exports["default"] = void 0;
|
|
|
8
8
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
9
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
var EventEmitter = /*#__PURE__*/(0, _createClass2["default"])(function EventEmitter() {
|
|
11
|
+
var EventEmitter = exports["default"] = /*#__PURE__*/(0, _createClass2["default"])(function EventEmitter() {
|
|
12
12
|
var _this = this;
|
|
13
13
|
(0, _classCallCheck2["default"])(this, EventEmitter);
|
|
14
14
|
(0, _defineProperty2["default"])(this, "events", {});
|
|
@@ -37,5 +37,4 @@ var EventEmitter = /*#__PURE__*/(0, _createClass2["default"])(function EventEmit
|
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
39
|
});
|
|
40
|
-
exports["default"] = EventEmitter;
|
|
41
40
|
//# sourceMappingURL=eventEmitter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventEmitter.js","names":["EventEmitter","_createClass2","_this","_classCallCheck2","_defineProperty2","emit","eventName","_len","arguments","length","args","Array","_key","event","events","forEach","fn","call","apply","concat","subscribe","push","filter","eventFn"
|
|
1
|
+
{"version":3,"file":"eventEmitter.js","names":["EventEmitter","exports","_createClass2","_this","_classCallCheck2","_defineProperty2","emit","eventName","_len","arguments","length","args","Array","_key","event","events","forEach","fn","call","apply","concat","subscribe","push","filter","eventFn"],"sources":["../../src/utils/eventEmitter.ts"],"sourcesContent":["type DefaultEmit = (eventName: string, ...args: any[]) => void;\ntype DefaultSubscribe = (eventName: string, fn: any) => () => void;\n\nexport default class EventEmitter<Emit = DefaultEmit, Subscribe = DefaultSubscribe> {\n private events: any = {};\n constructor() {\n this.emit = ((eventName: string, ...args: any[]) => {\n const event = this.events[eventName];\n if (event) {\n event.forEach((fn: any) => {\n fn.call(null, ...args);\n });\n }\n }) as any;\n this.subscribe = ((eventName: string, fn: any) => {\n if (!this.events[eventName]) {\n this.events[eventName] = [];\n }\n\n this.events[eventName].push(fn);\n return () => {\n this.events[eventName] = this.events[eventName].filter((eventFn: any) => fn !== eventFn);\n };\n }) as any;\n }\n\n emit: Emit;\n\n subscribe: Subscribe;\n}\n"],"mappings":";;;;;;;;;;IAGqBA,YAAY,GAAAC,OAAA,+BAAAC,aAAA,aAE/B,SAAAF,aAAA,EAAc;EAAA,IAAAG,KAAA;EAAA,IAAAC,gBAAA,mBAAAJ,YAAA;EAAA,IAAAK,gBAAA,6BADQ,CAAC,CAAC;EAAA,IAAAA,gBAAA;EAAA,IAAAA,gBAAA;EAEtB,IAAI,CAACC,IAAI,GAAI,UAACC,SAAiB,EAAqB;IAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAhBC,IAAI,OAAAC,KAAA,CAAAJ,IAAA,OAAAA,IAAA,WAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAJF,IAAI,CAAAE,IAAA,QAAAJ,SAAA,CAAAI,IAAA;IAAA;IACtC,IAAMC,KAAK,GAAGX,KAAI,CAACY,MAAM,CAACR,SAAS,CAAC;IACpC,IAAIO,KAAK,EAAE;MACTA,KAAK,CAACE,OAAO,CAAC,UAACC,EAAO,EAAK;QACzBA,EAAE,CAACC,IAAI,CAAAC,KAAA,CAAPF,EAAE,GAAM,IAAI,EAAAG,MAAA,CAAKT,IAAI,EAAC;MACxB,CAAC,CAAC;IACJ;EACF,CAAS;EACT,IAAI,CAACU,SAAS,GAAI,UAACd,SAAiB,EAAEU,EAAO,EAAK;IAChD,IAAI,CAACd,KAAI,CAACY,MAAM,CAACR,SAAS,CAAC,EAAE;MAC3BJ,KAAI,CAACY,MAAM,CAACR,SAAS,CAAC,GAAG,EAAE;IAC7B;IAEAJ,KAAI,CAACY,MAAM,CAACR,SAAS,CAAC,CAACe,IAAI,CAACL,EAAE,CAAC;IAC/B,OAAO,YAAM;MACXd,KAAI,CAACY,MAAM,CAACR,SAAS,CAAC,GAAGJ,KAAI,CAACY,MAAM,CAACR,SAAS,CAAC,CAACgB,MAAM,CAAC,UAACC,OAAY;QAAA,OAAKP,EAAE,KAAKO,OAAO;MAAA,EAAC;IAC1F,CAAC;EACH,CAAS;AACX,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventEmitter.mjs","names":["EventEmitter","_createClass","_this","_classCallCheck","_defineProperty","emit","eventName","_len","arguments","length","args","Array","_key","event","events","forEach","fn","call","apply","concat","subscribe","push","filter","eventFn","default"],"sources":["../../src/utils/eventEmitter.ts"],"sourcesContent":["type DefaultEmit = (eventName: string, ...args: any[]) => void;\ntype DefaultSubscribe = (eventName: string, fn: any) => () => void;\n\nexport default class EventEmitter<Emit = DefaultEmit, Subscribe = DefaultSubscribe> {\n private events: any = {};\n constructor() {\n this.emit = ((eventName: string, ...args: any[]) => {\n const event = this.events[eventName];\n if (event) {\n event.forEach((fn: any) => {\n fn.call(null, ...args);\n });\n }\n }) as any;\n this.subscribe = ((eventName: string, fn: any) => {\n if (!this.events[eventName]) {\n this.events[eventName] = [];\n }\n\n this.events[eventName].push(fn);\n return () => {\n this.events[eventName] = this.events[eventName].filter((eventFn: any) => fn !== eventFn);\n };\n }) as any;\n }\n\n emit: Emit;\n\n subscribe: Subscribe;\n}\n"],"mappings":";;;IAGqBA,YAAY,gBAAAC,YAAA,CAE/B,SAAAD,aAAA,EAAc;EAAA,IAAAE,KAAA;EAAAC,eAAA,OAAAH,YAAA;EAAAI,eAAA,iBADQ,CAAC,CAAC;EAAAA,eAAA;EAAAA,eAAA;EAEtB,IAAI,CAACC,IAAI,GAAI,UAACC,SAAiB,EAAqB;IAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAhBC,IAAI,OAAAC,KAAA,CAAAJ,IAAA,OAAAA,IAAA,WAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAJF,IAAI,CAAAE,IAAA,QAAAJ,SAAA,CAAAI,IAAA;IAAA;IACtC,IAAMC,KAAK,GAAGX,KAAI,CAACY,MAAM,CAACR,SAAS,CAAC;IACpC,IAAIO,KAAK,EAAE;MACTA,KAAK,CAACE,OAAO,CAAC,UAACC,EAAO,EAAK;QACzBA,EAAE,CAACC,IAAI,CAAAC,KAAA,CAAPF,EAAE,GAAM,IAAI,EAAAG,MAAA,CAAKT,IAAI,EAAC;MACxB,CAAC,CAAC;IACJ;EACF,CAAS;EACT,IAAI,CAACU,SAAS,GAAI,UAACd,SAAiB,EAAEU,EAAO,EAAK;IAChD,IAAI,CAACd,KAAI,CAACY,MAAM,CAACR,SAAS,CAAC,EAAE;MAC3BJ,KAAI,CAACY,MAAM,CAACR,SAAS,CAAC,GAAG,EAAE;IAC7B;IAEAJ,KAAI,CAACY,MAAM,CAACR,SAAS,CAAC,CAACe,IAAI,CAACL,EAAE,CAAC;IAC/B,OAAO,YAAM;MACXd,KAAI,CAACY,MAAM,CAACR,SAAS,CAAC,GAAGJ,KAAI,CAACY,MAAM,CAACR,SAAS,CAAC,CAACgB,MAAM,CAAC,UAACC,OAAY;QAAA,OAAKP,EAAE,KAAKO,OAAO;MAAA,EAAC;IAC1F,CAAC;EACH,CAAS;AACX,CAAC;AAAA,SArBkBvB,YAAY,IAAAwB,OAAA"}
|
|
1
|
+
{"version":3,"file":"eventEmitter.mjs","names":["EventEmitter","_createClass","_this","_classCallCheck","_defineProperty","emit","eventName","_len","arguments","length","args","Array","_key","event","events","forEach","fn","call","apply","concat","subscribe","push","filter","eventFn","default"],"sources":["../../src/utils/eventEmitter.ts"],"sourcesContent":["type DefaultEmit = (eventName: string, ...args: any[]) => void;\ntype DefaultSubscribe = (eventName: string, fn: any) => () => void;\n\nexport default class EventEmitter<Emit = DefaultEmit, Subscribe = DefaultSubscribe> {\n private events: any = {};\n constructor() {\n this.emit = ((eventName: string, ...args: any[]) => {\n const event = this.events[eventName];\n if (event) {\n event.forEach((fn: any) => {\n fn.call(null, ...args);\n });\n }\n }) as any;\n this.subscribe = ((eventName: string, fn: any) => {\n if (!this.events[eventName]) {\n this.events[eventName] = [];\n }\n\n this.events[eventName].push(fn);\n return () => {\n this.events[eventName] = this.events[eventName].filter((eventFn: any) => fn !== eventFn);\n };\n }) as any;\n }\n\n emit: Emit;\n\n subscribe: Subscribe;\n}\n"],"mappings":";;;IAGqBA,YAAY,gBAAAC,YAAA,CAE/B,SAAAD,aAAA,EAAc;EAAA,IAAAE,KAAA;EAAAC,eAAA,OAAAH,YAAA;EAAAI,eAAA,iBADQ,CAAC,CAAC;EAAAA,eAAA;EAAAA,eAAA;EAEtB,IAAI,CAACC,IAAI,GAAI,UAACC,SAAiB,EAAqB;IAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAhBC,IAAI,OAAAC,KAAA,CAAAJ,IAAA,OAAAA,IAAA,WAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAJF,IAAI,CAAAE,IAAA,QAAAJ,SAAA,CAAAI,IAAA;IAAA;IACtC,IAAMC,KAAK,GAAGX,KAAI,CAACY,MAAM,CAACR,SAAS,CAAC;IACpC,IAAIO,KAAK,EAAE;MACTA,KAAK,CAACE,OAAO,CAAC,UAACC,EAAO,EAAK;QACzBA,EAAE,CAACC,IAAI,CAAAC,KAAA,CAAPF,EAAE,GAAM,IAAI,EAAAG,MAAA,CAAKT,IAAI,EAAC;MACxB,CAAC,CAAC;IACJ;EACF,CAAS;EACT,IAAI,CAACU,SAAS,GAAI,UAACd,SAAiB,EAAEU,EAAO,EAAK;IAChD,IAAI,CAACd,KAAI,CAACY,MAAM,CAACR,SAAS,CAAC,EAAE;MAC3BJ,KAAI,CAACY,MAAM,CAACR,SAAS,CAAC,GAAG,EAAE;IAC7B;IAEAJ,KAAI,CAACY,MAAM,CAACR,SAAS,CAAC,CAACe,IAAI,CAACL,EAAE,CAAC;IAC/B,OAAO,YAAM;MACXd,KAAI,CAACY,MAAM,CAACR,SAAS,CAAC,GAAGJ,KAAI,CAACY,MAAM,CAACR,SAAS,CAAC,CAACgB,MAAM,CAAC,UAACC,OAAY;QAAA,OAAKP,EAAE,KAAKO,OAAO;MAAA,EAAC;IAC1F,CAAC;EACH,CAAS;AACX,CAAC;AAAA,SArBkBvB,YAAY,IAAAwB,OAAA","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactElement, MutableRefObject } from 'react';
|
|
1
|
+
import { type ReactElement, type MutableRefObject } from 'react';
|
|
2
2
|
declare function findComponent<P = any>(Children: any, names: string[], recursively?: boolean, limit?: number): ReactElement<P> | undefined;
|
|
3
3
|
export declare function isAdvanceMode(Children: any, name: string[], recursively?: boolean): boolean;
|
|
4
4
|
type IntergalacticComponent = ReactElement & {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
@@ -15,7 +15,7 @@ function findComponent(Children, names, recursively) {
|
|
|
15
15
|
var limit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 100;
|
|
16
16
|
var children = Children[_symbols.CHILDREN_COMPONENT] ? (0, _getOriginChildren["default"])(Children) : Children;
|
|
17
17
|
return _react["default"].Children.toArray(children).find(function (child) {
|
|
18
|
-
if (
|
|
18
|
+
if (/*#__PURE__*/_react["default"].isValidElement(child)) {
|
|
19
19
|
if (child.type === _react["default"].Fragment) {
|
|
20
20
|
return findComponent(child.props.children, names, recursively, limit);
|
|
21
21
|
}
|
|
@@ -41,14 +41,14 @@ function isAdvanceMode(Children, name, recursively) {
|
|
|
41
41
|
}
|
|
42
42
|
function findAllComponents(Children, names) {
|
|
43
43
|
var result = [];
|
|
44
|
-
var
|
|
44
|
+
var _findAllAndAdd = function findAllAndAdd(Children) {
|
|
45
45
|
var children = Children[_symbols.CHILDREN_COMPONENT] ? (0, _getOriginChildren["default"])(Children) : Children;
|
|
46
46
|
_react["default"].Children.toArray(children).forEach(function (child) {
|
|
47
|
-
if (
|
|
47
|
+
if (/*#__PURE__*/_react["default"].isValidElement(child)) {
|
|
48
48
|
if (child.type === _react["default"].Fragment) {
|
|
49
|
-
|
|
49
|
+
_findAllAndAdd(child.props.children);
|
|
50
50
|
} else if (typeof child.type === 'function' && _symbols.CHILDREN_COMPONENT in child.type && child.type[_symbols.CHILDREN_COMPONENT]) {
|
|
51
|
-
|
|
51
|
+
_findAllAndAdd(child.type);
|
|
52
52
|
} else {
|
|
53
53
|
// @ts-ignore
|
|
54
54
|
var inheritedNames = child.type[_symbols.INHERITED_NAME] || [child.type.displayName];
|
|
@@ -59,13 +59,13 @@ function findAllComponents(Children, names) {
|
|
|
59
59
|
result.push(child);
|
|
60
60
|
}
|
|
61
61
|
if (child.props.children) {
|
|
62
|
-
return
|
|
62
|
+
return _findAllAndAdd(child.props.children);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
67
|
};
|
|
68
|
-
|
|
68
|
+
_findAllAndAdd(Children);
|
|
69
69
|
return result;
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -75,14 +75,14 @@ function findAllComponents(Children, names) {
|
|
|
75
75
|
function extractFrom(Children, names) {
|
|
76
76
|
var extracted = [];
|
|
77
77
|
var rest = [];
|
|
78
|
-
var
|
|
78
|
+
var _extractor = function extractor(Children) {
|
|
79
79
|
var children = Children[_symbols.CHILDREN_COMPONENT] ? (0, _getOriginChildren["default"])(Children) : Children;
|
|
80
80
|
_react["default"].Children.toArray(children).forEach(function (child) {
|
|
81
|
-
if (
|
|
81
|
+
if (/*#__PURE__*/_react["default"].isValidElement(child)) {
|
|
82
82
|
if (child.type === _react["default"].Fragment) {
|
|
83
|
-
|
|
83
|
+
_extractor(child.props.children);
|
|
84
84
|
} else if (typeof child.type === 'function' && _symbols.CHILDREN_COMPONENT in child.type && child.type[_symbols.CHILDREN_COMPONENT]) {
|
|
85
|
-
|
|
85
|
+
_extractor(child.type);
|
|
86
86
|
} else {
|
|
87
87
|
// @ts-ignore
|
|
88
88
|
var inheritedNames = child.type[_symbols.INHERITED_NAME] || [child.type.displayName];
|
|
@@ -98,9 +98,8 @@ function extractFrom(Children, names) {
|
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
};
|
|
101
|
-
|
|
101
|
+
_extractor(Children);
|
|
102
102
|
return [extracted, rest];
|
|
103
103
|
}
|
|
104
|
-
var _default = findComponent;
|
|
105
|
-
exports["default"] = _default;
|
|
104
|
+
var _default = exports["default"] = findComponent;
|
|
106
105
|
//# sourceMappingURL=findComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findComponent.js","names":["_react","_interopRequireDefault","require","_getOriginChildren","_symbols","findComponent","Children","names","recursively","limit","arguments","length","undefined","children","CHILDREN_COMPONENT","getOriginChildren","React","toArray","find","child","isValidElement","type","Fragment","props","inheritedNames","INHERITED_NAME","displayName","result","name","includes","isAdvanceMode","findAllComponents","findAllAndAdd","forEach","component","push","extractFrom","extracted","rest","extractor","_default","exports"],"sources":["../../src/utils/findComponent.ts"],"sourcesContent":["import React, { ReactElement, MutableRefObject } from 'react';\nimport getOriginChildren from './getOriginChildren';\nimport { CHILDREN_COMPONENT, INHERITED_NAME } from '../core-types/symbols';\n\nfunction findComponent<P = any>(\n Children: any,\n names: string[],\n recursively?: boolean,\n limit = 100,\n): ReactElement<P> | undefined {\n const children = Children[CHILDREN_COMPONENT] ? getOriginChildren(Children) : Children;\n return React.Children.toArray(children).find((child) => {\n if (React.isValidElement(child)) {\n if (child.type === React.Fragment) {\n return findComponent(child.props.children, names, recursively, limit);\n }\n // @ts-ignore\n const inheritedNames = child.type[INHERITED_NAME] || [child.type.displayName];\n const result = !!inheritedNames.find((name: string) => names.includes(name));\n\n if (!result && child.props.children && recursively && limit > 0) {\n return findComponent(child.props.children, names, recursively, limit - 1);\n }\n\n return result;\n }\n }) as ReactElement<P> | undefined;\n}\n\nexport function isAdvanceMode(Children: any, name: string[], recursively?: boolean) {\n const children = Children[CHILDREN_COMPONENT] ? getOriginChildren(Children) : Children;\n if (!children) return false;\n if (typeof children === 'function') {\n return true;\n }\n return !!findComponent(children, name, recursively);\n}\n\ntype IntergalacticComponent = ReactElement & {\n ref?: MutableRefObject<HTMLElement>;\n};\n\nexport function findAllComponents(Children: any, names: string[]): IntergalacticComponent[] {\n const result: IntergalacticComponent[] = [];\n\n const findAllAndAdd = (Children: any) => {\n const children = Children[CHILDREN_COMPONENT] ? getOriginChildren(Children) : Children;\n React.Children.toArray(children).forEach((child) => {\n if (React.isValidElement(child)) {\n if (child.type === React.Fragment) {\n findAllAndAdd(child.props.children);\n } else if (\n typeof child.type === 'function' &&\n CHILDREN_COMPONENT in child.type &&\n child.type[CHILDREN_COMPONENT]\n ) {\n findAllAndAdd(child.type);\n } else {\n // @ts-ignore\n const inheritedNames = child.type[INHERITED_NAME] || [child.type.displayName];\n const component = !!inheritedNames.find((name: string) => names.includes(name));\n\n if (component) {\n result.push(child);\n }\n\n if (child.props.children) {\n return findAllAndAdd(child.props.children);\n }\n }\n }\n });\n };\n\n findAllAndAdd(Children);\n\n return result;\n}\n\n/**\n * Extract some components from Children and return them and rest of components as tuple.\n */\nexport function extractFrom(Children: any, names: string[]): IntergalacticComponent[][] {\n const extracted: IntergalacticComponent[] = [];\n const rest: IntergalacticComponent[] = [];\n\n const extractor = (Children: any) => {\n const children = Children[CHILDREN_COMPONENT] ? getOriginChildren(Children) : Children;\n React.Children.toArray(children).forEach((child) => {\n if (React.isValidElement(child)) {\n if (child.type === React.Fragment) {\n extractor(child.props.children);\n } else if (\n typeof child.type === 'function' &&\n CHILDREN_COMPONENT in child.type &&\n child.type[CHILDREN_COMPONENT]\n ) {\n extractor(child.type);\n } else {\n // @ts-ignore\n const inheritedNames = child.type[INHERITED_NAME] || [child.type.displayName];\n const component = !!inheritedNames.find((name: string) => names.includes(name));\n\n if (component) {\n extracted.push(child);\n } else {\n rest.push(child);\n }\n }\n }\n });\n };\n\n extractor(Children);\n\n return [extracted, rest];\n}\n\nexport default findComponent;\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;
|
|
1
|
+
{"version":3,"file":"findComponent.js","names":["_react","_interopRequireDefault","require","_getOriginChildren","_symbols","findComponent","Children","names","recursively","limit","arguments","length","undefined","children","CHILDREN_COMPONENT","getOriginChildren","React","toArray","find","child","isValidElement","type","Fragment","props","inheritedNames","INHERITED_NAME","displayName","result","name","includes","isAdvanceMode","findAllComponents","findAllAndAdd","forEach","component","push","extractFrom","extracted","rest","extractor","_default","exports"],"sources":["../../src/utils/findComponent.ts"],"sourcesContent":["import React, { type ReactElement, type MutableRefObject } from 'react';\n\nimport getOriginChildren from './getOriginChildren';\nimport { CHILDREN_COMPONENT, INHERITED_NAME } from '../core-types/symbols';\n\nfunction findComponent<P = any>(\n Children: any,\n names: string[],\n recursively?: boolean,\n limit = 100,\n): ReactElement<P> | undefined {\n const children = Children[CHILDREN_COMPONENT] ? getOriginChildren(Children) : Children;\n return React.Children.toArray(children).find((child) => {\n if (React.isValidElement(child)) {\n if (child.type === React.Fragment) {\n return findComponent(child.props.children, names, recursively, limit);\n }\n // @ts-ignore\n const inheritedNames = child.type[INHERITED_NAME] || [child.type.displayName];\n const result = !!inheritedNames.find((name: string) => names.includes(name));\n\n if (!result && child.props.children && recursively && limit > 0) {\n return findComponent(child.props.children, names, recursively, limit - 1);\n }\n\n return result;\n }\n }) as ReactElement<P> | undefined;\n}\n\nexport function isAdvanceMode(Children: any, name: string[], recursively?: boolean) {\n const children = Children[CHILDREN_COMPONENT] ? getOriginChildren(Children) : Children;\n if (!children) return false;\n if (typeof children === 'function') {\n return true;\n }\n return !!findComponent(children, name, recursively);\n}\n\ntype IntergalacticComponent = ReactElement & {\n ref?: MutableRefObject<HTMLElement>;\n};\n\nexport function findAllComponents(Children: any, names: string[]): IntergalacticComponent[] {\n const result: IntergalacticComponent[] = [];\n\n const findAllAndAdd = (Children: any) => {\n const children = Children[CHILDREN_COMPONENT] ? getOriginChildren(Children) : Children;\n React.Children.toArray(children).forEach((child) => {\n if (React.isValidElement(child)) {\n if (child.type === React.Fragment) {\n findAllAndAdd(child.props.children);\n } else if (\n typeof child.type === 'function' &&\n CHILDREN_COMPONENT in child.type &&\n child.type[CHILDREN_COMPONENT]\n ) {\n findAllAndAdd(child.type);\n } else {\n // @ts-ignore\n const inheritedNames = child.type[INHERITED_NAME] || [child.type.displayName];\n const component = !!inheritedNames.find((name: string) => names.includes(name));\n\n if (component) {\n result.push(child);\n }\n\n if (child.props.children) {\n return findAllAndAdd(child.props.children);\n }\n }\n }\n });\n };\n\n findAllAndAdd(Children);\n\n return result;\n}\n\n/**\n * Extract some components from Children and return them and rest of components as tuple.\n */\nexport function extractFrom(Children: any, names: string[]): IntergalacticComponent[][] {\n const extracted: IntergalacticComponent[] = [];\n const rest: IntergalacticComponent[] = [];\n\n const extractor = (Children: any) => {\n const children = Children[CHILDREN_COMPONENT] ? getOriginChildren(Children) : Children;\n React.Children.toArray(children).forEach((child) => {\n if (React.isValidElement(child)) {\n if (child.type === React.Fragment) {\n extractor(child.props.children);\n } else if (\n typeof child.type === 'function' &&\n CHILDREN_COMPONENT in child.type &&\n child.type[CHILDREN_COMPONENT]\n ) {\n extractor(child.type);\n } else {\n // @ts-ignore\n const inheritedNames = child.type[INHERITED_NAME] || [child.type.displayName];\n const component = !!inheritedNames.find((name: string) => names.includes(name));\n\n if (component) {\n extracted.push(child);\n } else {\n rest.push(child);\n }\n }\n }\n });\n };\n\n extractor(Children);\n\n return [extracted, rest];\n}\n\nexport default findComponent;\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,kBAAA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C,MAAM;UACL;UACA,IAAMG,cAAc,GAAGL,KAAK,CAACE,IAAI,CAACI,uBAAc,CAAC,IAAI,CAACN,KAAK,CAACE,IAAI,CAACK,WAAW,CAAC;UAC7E,IAAMQ,SAAS,GAAG,CAAC,CAACV,cAAc,CAACN,IAAI,CAAC,UAACU,IAAY;YAAA,OAAKrB,KAAK,CAACsB,QAAQ,CAACD,IAAI,CAAC;UAAA,EAAC;UAE/E,IAAIM,SAAS,EAAE;YACbG,SAAS,CAACF,IAAI,CAAChB,KAAK,CAAC;UACvB,CAAC,MAAM;YACLmB,IAAI,CAACH,IAAI,CAAChB,KAAK,CAAC;UAClB;QACF;MACF;IACF,CAAC,CAAC;EACJ,CAAC;EAEDoB,UAAS,CAACjC,QAAQ,CAAC;EAEnB,OAAO,CAAC+B,SAAS,EAAEC,IAAI,CAAC;AAC1B;AAAC,IAAAE,QAAA,GAAAC,OAAA,cAEcpC,aAAa","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ function findComponent(Children, names, recursively) {
|
|
|
5
5
|
var limit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 100;
|
|
6
6
|
var children = Children[CHILDREN_COMPONENT] ? getOriginChildren(Children) : Children;
|
|
7
7
|
return React.Children.toArray(children).find(function (child) {
|
|
8
|
-
if (
|
|
8
|
+
if (/*#__PURE__*/React.isValidElement(child)) {
|
|
9
9
|
if (child.type === React.Fragment) {
|
|
10
10
|
return findComponent(child.props.children, names, recursively, limit);
|
|
11
11
|
}
|
|
@@ -31,14 +31,14 @@ export function isAdvanceMode(Children, name, recursively) {
|
|
|
31
31
|
}
|
|
32
32
|
export function findAllComponents(Children, names) {
|
|
33
33
|
var result = [];
|
|
34
|
-
var
|
|
34
|
+
var _findAllAndAdd = function findAllAndAdd(Children) {
|
|
35
35
|
var children = Children[CHILDREN_COMPONENT] ? getOriginChildren(Children) : Children;
|
|
36
36
|
React.Children.toArray(children).forEach(function (child) {
|
|
37
|
-
if (
|
|
37
|
+
if (/*#__PURE__*/React.isValidElement(child)) {
|
|
38
38
|
if (child.type === React.Fragment) {
|
|
39
|
-
|
|
39
|
+
_findAllAndAdd(child.props.children);
|
|
40
40
|
} else if (typeof child.type === 'function' && CHILDREN_COMPONENT in child.type && child.type[CHILDREN_COMPONENT]) {
|
|
41
|
-
|
|
41
|
+
_findAllAndAdd(child.type);
|
|
42
42
|
} else {
|
|
43
43
|
// @ts-ignore
|
|
44
44
|
var inheritedNames = child.type[INHERITED_NAME] || [child.type.displayName];
|
|
@@ -49,13 +49,13 @@ export function findAllComponents(Children, names) {
|
|
|
49
49
|
result.push(child);
|
|
50
50
|
}
|
|
51
51
|
if (child.props.children) {
|
|
52
|
-
return
|
|
52
|
+
return _findAllAndAdd(child.props.children);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
57
|
};
|
|
58
|
-
|
|
58
|
+
_findAllAndAdd(Children);
|
|
59
59
|
return result;
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -65,14 +65,14 @@ export function findAllComponents(Children, names) {
|
|
|
65
65
|
export function extractFrom(Children, names) {
|
|
66
66
|
var extracted = [];
|
|
67
67
|
var rest = [];
|
|
68
|
-
var
|
|
68
|
+
var _extractor = function extractor(Children) {
|
|
69
69
|
var children = Children[CHILDREN_COMPONENT] ? getOriginChildren(Children) : Children;
|
|
70
70
|
React.Children.toArray(children).forEach(function (child) {
|
|
71
|
-
if (
|
|
71
|
+
if (/*#__PURE__*/React.isValidElement(child)) {
|
|
72
72
|
if (child.type === React.Fragment) {
|
|
73
|
-
|
|
73
|
+
_extractor(child.props.children);
|
|
74
74
|
} else if (typeof child.type === 'function' && CHILDREN_COMPONENT in child.type && child.type[CHILDREN_COMPONENT]) {
|
|
75
|
-
|
|
75
|
+
_extractor(child.type);
|
|
76
76
|
} else {
|
|
77
77
|
// @ts-ignore
|
|
78
78
|
var inheritedNames = child.type[INHERITED_NAME] || [child.type.displayName];
|
|
@@ -88,7 +88,7 @@ export function extractFrom(Children, names) {
|
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
90
|
};
|
|
91
|
-
|
|
91
|
+
_extractor(Children);
|
|
92
92
|
return [extracted, rest];
|
|
93
93
|
}
|
|
94
94
|
export default findComponent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findComponent.mjs","names":["React","getOriginChildren","CHILDREN_COMPONENT","INHERITED_NAME","findComponent","Children","names","recursively","limit","arguments","length","undefined","children","toArray","find","child","isValidElement","type","Fragment","props","inheritedNames","displayName","result","name","includes","isAdvanceMode","findAllComponents","findAllAndAdd","forEach","component","push","extractFrom","extracted","rest","extractor"],"sources":["../../src/utils/findComponent.ts"],"sourcesContent":["import React, { ReactElement, MutableRefObject } from 'react';\nimport getOriginChildren from './getOriginChildren';\nimport { CHILDREN_COMPONENT, INHERITED_NAME } from '../core-types/symbols';\n\nfunction findComponent<P = any>(\n Children: any,\n names: string[],\n recursively?: boolean,\n limit = 100,\n): ReactElement<P> | undefined {\n const children = Children[CHILDREN_COMPONENT] ? getOriginChildren(Children) : Children;\n return React.Children.toArray(children).find((child) => {\n if (React.isValidElement(child)) {\n if (child.type === React.Fragment) {\n return findComponent(child.props.children, names, recursively, limit);\n }\n // @ts-ignore\n const inheritedNames = child.type[INHERITED_NAME] || [child.type.displayName];\n const result = !!inheritedNames.find((name: string) => names.includes(name));\n\n if (!result && child.props.children && recursively && limit > 0) {\n return findComponent(child.props.children, names, recursively, limit - 1);\n }\n\n return result;\n }\n }) as ReactElement<P> | undefined;\n}\n\nexport function isAdvanceMode(Children: any, name: string[], recursively?: boolean) {\n const children = Children[CHILDREN_COMPONENT] ? getOriginChildren(Children) : Children;\n if (!children) return false;\n if (typeof children === 'function') {\n return true;\n }\n return !!findComponent(children, name, recursively);\n}\n\ntype IntergalacticComponent = ReactElement & {\n ref?: MutableRefObject<HTMLElement>;\n};\n\nexport function findAllComponents(Children: any, names: string[]): IntergalacticComponent[] {\n const result: IntergalacticComponent[] = [];\n\n const findAllAndAdd = (Children: any) => {\n const children = Children[CHILDREN_COMPONENT] ? getOriginChildren(Children) : Children;\n React.Children.toArray(children).forEach((child) => {\n if (React.isValidElement(child)) {\n if (child.type === React.Fragment) {\n findAllAndAdd(child.props.children);\n } else if (\n typeof child.type === 'function' &&\n CHILDREN_COMPONENT in child.type &&\n child.type[CHILDREN_COMPONENT]\n ) {\n findAllAndAdd(child.type);\n } else {\n // @ts-ignore\n const inheritedNames = child.type[INHERITED_NAME] || [child.type.displayName];\n const component = !!inheritedNames.find((name: string) => names.includes(name));\n\n if (component) {\n result.push(child);\n }\n\n if (child.props.children) {\n return findAllAndAdd(child.props.children);\n }\n }\n }\n });\n };\n\n findAllAndAdd(Children);\n\n return result;\n}\n\n/**\n * Extract some components from Children and return them and rest of components as tuple.\n */\nexport function extractFrom(Children: any, names: string[]): IntergalacticComponent[][] {\n const extracted: IntergalacticComponent[] = [];\n const rest: IntergalacticComponent[] = [];\n\n const extractor = (Children: any) => {\n const children = Children[CHILDREN_COMPONENT] ? getOriginChildren(Children) : Children;\n React.Children.toArray(children).forEach((child) => {\n if (React.isValidElement(child)) {\n if (child.type === React.Fragment) {\n extractor(child.props.children);\n } else if (\n typeof child.type === 'function' &&\n CHILDREN_COMPONENT in child.type &&\n child.type[CHILDREN_COMPONENT]\n ) {\n extractor(child.type);\n } else {\n // @ts-ignore\n const inheritedNames = child.type[INHERITED_NAME] || [child.type.displayName];\n const component = !!inheritedNames.find((name: string) => names.includes(name));\n\n if (component) {\n extracted.push(child);\n } else {\n rest.push(child);\n }\n }\n }\n });\n };\n\n extractor(Children);\n\n return [extracted, rest];\n}\n\nexport default findComponent;\n"],"mappings":"AAAA,OAAOA,KAAK,
|
|
1
|
+
{"version":3,"file":"findComponent.mjs","names":["React","getOriginChildren","CHILDREN_COMPONENT","INHERITED_NAME","findComponent","Children","names","recursively","limit","arguments","length","undefined","children","toArray","find","child","isValidElement","type","Fragment","props","inheritedNames","displayName","result","name","includes","isAdvanceMode","findAllComponents","findAllAndAdd","forEach","component","push","extractFrom","extracted","rest","extractor"],"sources":["../../src/utils/findComponent.ts"],"sourcesContent":["import React, { type ReactElement, type MutableRefObject } from 'react';\n\nimport getOriginChildren from './getOriginChildren';\nimport { CHILDREN_COMPONENT, INHERITED_NAME } from '../core-types/symbols';\n\nfunction findComponent<P = any>(\n Children: any,\n names: string[],\n recursively?: boolean,\n limit = 100,\n): ReactElement<P> | undefined {\n const children = Children[CHILDREN_COMPONENT] ? getOriginChildren(Children) : Children;\n return React.Children.toArray(children).find((child) => {\n if (React.isValidElement(child)) {\n if (child.type === React.Fragment) {\n return findComponent(child.props.children, names, recursively, limit);\n }\n // @ts-ignore\n const inheritedNames = child.type[INHERITED_NAME] || [child.type.displayName];\n const result = !!inheritedNames.find((name: string) => names.includes(name));\n\n if (!result && child.props.children && recursively && limit > 0) {\n return findComponent(child.props.children, names, recursively, limit - 1);\n }\n\n return result;\n }\n }) as ReactElement<P> | undefined;\n}\n\nexport function isAdvanceMode(Children: any, name: string[], recursively?: boolean) {\n const children = Children[CHILDREN_COMPONENT] ? getOriginChildren(Children) : Children;\n if (!children) return false;\n if (typeof children === 'function') {\n return true;\n }\n return !!findComponent(children, name, recursively);\n}\n\ntype IntergalacticComponent = ReactElement & {\n ref?: MutableRefObject<HTMLElement>;\n};\n\nexport function findAllComponents(Children: any, names: string[]): IntergalacticComponent[] {\n const result: IntergalacticComponent[] = [];\n\n const findAllAndAdd = (Children: any) => {\n const children = Children[CHILDREN_COMPONENT] ? getOriginChildren(Children) : Children;\n React.Children.toArray(children).forEach((child) => {\n if (React.isValidElement(child)) {\n if (child.type === React.Fragment) {\n findAllAndAdd(child.props.children);\n } else if (\n typeof child.type === 'function' &&\n CHILDREN_COMPONENT in child.type &&\n child.type[CHILDREN_COMPONENT]\n ) {\n findAllAndAdd(child.type);\n } else {\n // @ts-ignore\n const inheritedNames = child.type[INHERITED_NAME] || [child.type.displayName];\n const component = !!inheritedNames.find((name: string) => names.includes(name));\n\n if (component) {\n result.push(child);\n }\n\n if (child.props.children) {\n return findAllAndAdd(child.props.children);\n }\n }\n }\n });\n };\n\n findAllAndAdd(Children);\n\n return result;\n}\n\n/**\n * Extract some components from Children and return them and rest of components as tuple.\n */\nexport function extractFrom(Children: any, names: string[]): IntergalacticComponent[][] {\n const extracted: IntergalacticComponent[] = [];\n const rest: IntergalacticComponent[] = [];\n\n const extractor = (Children: any) => {\n const children = Children[CHILDREN_COMPONENT] ? getOriginChildren(Children) : Children;\n React.Children.toArray(children).forEach((child) => {\n if (React.isValidElement(child)) {\n if (child.type === React.Fragment) {\n extractor(child.props.children);\n } else if (\n typeof child.type === 'function' &&\n CHILDREN_COMPONENT in child.type &&\n child.type[CHILDREN_COMPONENT]\n ) {\n extractor(child.type);\n } else {\n // @ts-ignore\n const inheritedNames = child.type[INHERITED_NAME] || [child.type.displayName];\n const component = !!inheritedNames.find((name: string) => names.includes(name));\n\n if (component) {\n extracted.push(child);\n } else {\n rest.push(child);\n }\n }\n }\n });\n };\n\n extractor(Children);\n\n return [extracted, rest];\n}\n\nexport default findComponent;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAoD,OAAO;AAEvE,OAAOC,iBAAiB,MAAM,yBAAqB;AACnD,SAASC,kBAAkB,EAAEC,cAAc,QAAQ,2BAAuB;AAE1E,SAASC,aAAaA,CACpBC,QAAa,EACbC,KAAe,EACfC,WAAqB,EAEQ;EAAA,IAD7BC,KAAK,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,GAAG;EAEX,IAAMG,QAAQ,GAAGP,QAAQ,CAACH,kBAAkB,CAAC,GAAGD,iBAAiB,CAACI,QAAQ,CAAC,GAAGA,QAAQ;EACtF,OAAOL,KAAK,CAACK,QAAQ,CAACQ,OAAO,CAACD,QAAQ,CAAC,CAACE,IAAI,CAAC,UAACC,KAAK,EAAK;IACtD,iBAAIf,KAAK,CAACgB,cAAc,CAACD,KAAK,CAA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AAS,EAAEC,IAAI,CAAC;AAC1B;AAEA,eAAe7B,aAAa","ignoreList":[]}
|
package/lib/utils/fire.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
package/lib/utils/fire.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fire.js","names":["_getValue","_interopRequireDefault","require","fire","context","eventName","fn","getValue","concat","_len","arguments","length","args","Array","_key","call","apply","fireFn","_len2","_key2"],"sources":["../../src/utils/fire.ts"],"sourcesContent":["import getValue from './getValue';\n\nexport default function fire<T extends {}>(context: T, eventName: string, ...args: any) {\n const fn = getValue(context, `props.${eventName}`);\n if (fn) return fn.call(context, ...args);\n}\n\nexport function fireFn(fn: (...args: any) => void, ...args: any[]) {\n if (typeof fn === 'function') return fn(...args);\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEe,SAASC,IAAIA,CAAeC,OAAU,EAAEC,SAAiB,EAAgB;EACtF,IAAMC,EAAE,GAAG,IAAAC,oBAAQ,EAACH,OAAO,WAAAI,MAAA,CAAWH,SAAS,
|
|
1
|
+
{"version":3,"file":"fire.js","names":["_getValue","_interopRequireDefault","require","fire","context","eventName","fn","getValue","concat","_len","arguments","length","args","Array","_key","call","apply","fireFn","_len2","_key2"],"sources":["../../src/utils/fire.ts"],"sourcesContent":["import getValue from './getValue';\n\nexport default function fire<T extends {}>(context: T, eventName: string, ...args: any) {\n const fn = getValue(context, `props.${eventName}`);\n if (fn) return fn.call(context, ...args);\n}\n\nexport function fireFn(fn: (...args: any) => void, ...args: any[]) {\n if (typeof fn === 'function') return fn(...args);\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEe,SAASC,IAAIA,CAAeC,OAAU,EAAEC,SAAiB,EAAgB;EACtF,IAAMC,EAAE,GAAG,IAAAC,oBAAQ,EAACH,OAAO,WAAAI,MAAA,CAAWH,SAAS,CAAE,CAAC;EAAC,SAAAI,IAAA,GAAAC,SAAA,CAAAC,MAAA,EADwBC,IAAI,OAAAC,KAAA,CAAAJ,IAAA,OAAAA,IAAA,WAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;IAAJF,IAAI,CAAAE,IAAA,QAAAJ,SAAA,CAAAI,IAAA;EAAA;EAE/E,IAAIR,EAAE,EAAE,OAAOA,EAAE,CAACS,IAAI,CAAAC,KAAA,CAAPV,EAAE,GAAMF,OAAO,EAAAI,MAAA,CAAKI,IAAI,EAAC;AAC1C;AAEO,SAASK,MAAMA,CAACX,EAA0B,EAAkB;EAAA,SAAAY,KAAA,GAAAR,SAAA,CAAAC,MAAA,EAAbC,IAAI,OAAAC,KAAA,CAAAK,KAAA,OAAAA,KAAA,WAAAC,KAAA,MAAAA,KAAA,GAAAD,KAAA,EAAAC,KAAA;IAAJP,IAAI,CAAAO,KAAA,QAAAT,SAAA,CAAAS,KAAA;EAAA;EACxD,IAAI,OAAOb,EAAE,KAAK,UAAU,EAAE,OAAOA,EAAE,CAAAU,KAAA,SAAIJ,IAAI,CAAC;AAClD","ignoreList":[]}
|
package/lib/utils/fire.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fire.mjs","names":["getValue","fire","context","eventName","fn","concat","_len","arguments","length","args","Array","_key","call","apply","fireFn","_len2","_key2"],"sources":["../../src/utils/fire.ts"],"sourcesContent":["import getValue from './getValue';\n\nexport default function fire<T extends {}>(context: T, eventName: string, ...args: any) {\n const fn = getValue(context, `props.${eventName}`);\n if (fn) return fn.call(context, ...args);\n}\n\nexport function fireFn(fn: (...args: any) => void, ...args: any[]) {\n if (typeof fn === 'function') return fn(...args);\n}\n"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,gBAAY;AAEjC,eAAe,SAASC,IAAIA,CAAeC,OAAU,EAAEC,SAAiB,EAAgB;EACtF,IAAMC,EAAE,GAAGJ,QAAQ,CAACE,OAAO,WAAAG,MAAA,CAAWF,SAAS,
|
|
1
|
+
{"version":3,"file":"fire.mjs","names":["getValue","fire","context","eventName","fn","concat","_len","arguments","length","args","Array","_key","call","apply","fireFn","_len2","_key2"],"sources":["../../src/utils/fire.ts"],"sourcesContent":["import getValue from './getValue';\n\nexport default function fire<T extends {}>(context: T, eventName: string, ...args: any) {\n const fn = getValue(context, `props.${eventName}`);\n if (fn) return fn.call(context, ...args);\n}\n\nexport function fireFn(fn: (...args: any) => void, ...args: any[]) {\n if (typeof fn === 'function') return fn(...args);\n}\n"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,gBAAY;AAEjC,eAAe,SAASC,IAAIA,CAAeC,OAAU,EAAEC,SAAiB,EAAgB;EACtF,IAAMC,EAAE,GAAGJ,QAAQ,CAACE,OAAO,WAAAG,MAAA,CAAWF,SAAS,CAAE,CAAC;EAAC,SAAAG,IAAA,GAAAC,SAAA,CAAAC,MAAA,EADwBC,IAAI,OAAAC,KAAA,CAAAJ,IAAA,OAAAA,IAAA,WAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;IAAJF,IAAI,CAAAE,IAAA,QAAAJ,SAAA,CAAAI,IAAA;EAAA;EAE/E,IAAIP,EAAE,EAAE,OAAOA,EAAE,CAACQ,IAAI,CAAAC,KAAA,CAAPT,EAAE,GAAMF,OAAO,EAAAG,MAAA,CAAKI,IAAI,EAAC;AAC1C;AAEA,OAAO,SAASK,MAAMA,CAACV,EAA0B,EAAkB;EAAA,SAAAW,KAAA,GAAAR,SAAA,CAAAC,MAAA,EAAbC,IAAI,OAAAC,KAAA,CAAAK,KAAA,OAAAA,KAAA,WAAAC,KAAA,MAAAA,KAAA,GAAAD,KAAA,EAAAC,KAAA;IAAJP,IAAI,CAAAO,KAAA,QAAAT,SAAA,CAAAS,KAAA;EAAA;EACxD,IAAI,OAAOZ,EAAE,KAAK,UAAU,EAAE,OAAOA,EAAE,CAAAS,KAAA,SAAIJ,IAAI,CAAC;AAClD","ignoreList":[]}
|
|
@@ -6,11 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.removeFocusBorders = exports.addFocusBorders = exports.BEFORE_BORDER_ID = exports.AFTER_BORDER_ID = void 0;
|
|
7
7
|
var _getFocusableIn = require("./getFocusableIn");
|
|
8
8
|
var focusBordersRefs = new Map();
|
|
9
|
-
var BEFORE_BORDER_ID = '__intergalactic-focus-border-before';
|
|
10
|
-
exports.
|
|
11
|
-
var
|
|
12
|
-
exports.AFTER_BORDER_ID = AFTER_BORDER_ID;
|
|
13
|
-
var addFocusBorders = function addFocusBorders(element) {
|
|
9
|
+
var BEFORE_BORDER_ID = exports.BEFORE_BORDER_ID = '__intergalactic-focus-border-before';
|
|
10
|
+
var AFTER_BORDER_ID = exports.AFTER_BORDER_ID = '__intergalactic-focus-border-after';
|
|
11
|
+
var addFocusBorders = exports.addFocusBorders = function addFocusBorders(element) {
|
|
14
12
|
if (!focusBordersRefs.has(element) && !(element.previousSibling instanceof HTMLElement && element.previousSibling.dataset.id === BEFORE_BORDER_ID)) {
|
|
15
13
|
var before = document.createElement('div');
|
|
16
14
|
var after = document.createElement('div');
|
|
@@ -30,10 +28,10 @@ var addFocusBorders = function addFocusBorders(element) {
|
|
|
30
28
|
var focusable = (0, _getFocusableIn.getFocusableIn)(element);
|
|
31
29
|
if (event.relatedTarget === focusable[0]) {
|
|
32
30
|
var _focusable;
|
|
33
|
-
(_focusable = focusable[focusable.length - 1]) === null || _focusable === void 0
|
|
31
|
+
(_focusable = focusable[focusable.length - 1]) === null || _focusable === void 0 || _focusable.focus();
|
|
34
32
|
} else {
|
|
35
33
|
var _focusable$;
|
|
36
|
-
(_focusable$ = focusable[0]) === null || _focusable$ === void 0
|
|
34
|
+
(_focusable$ = focusable[0]) === null || _focusable$ === void 0 || _focusable$.focus();
|
|
37
35
|
}
|
|
38
36
|
}
|
|
39
37
|
});
|
|
@@ -49,24 +47,22 @@ var addFocusBorders = function addFocusBorders(element) {
|
|
|
49
47
|
var focusable = (0, _getFocusableIn.getFocusableIn)(element);
|
|
50
48
|
if (event.relatedTarget === focusable[focusable.length - 1]) {
|
|
51
49
|
var _focusable$2;
|
|
52
|
-
(_focusable$2 = focusable[0]) === null || _focusable$2 === void 0
|
|
50
|
+
(_focusable$2 = focusable[0]) === null || _focusable$2 === void 0 || _focusable$2.focus();
|
|
53
51
|
} else {
|
|
54
52
|
var _focusable2;
|
|
55
|
-
(_focusable2 = focusable[focusable.length - 1]) === null || _focusable2 === void 0
|
|
53
|
+
(_focusable2 = focusable[focusable.length - 1]) === null || _focusable2 === void 0 || _focusable2.focus();
|
|
56
54
|
}
|
|
57
55
|
}
|
|
58
56
|
});
|
|
59
57
|
var elementParent = element.parentElement;
|
|
60
|
-
elementParent === null || elementParent === void 0
|
|
61
|
-
elementParent === null || elementParent === void 0
|
|
58
|
+
elementParent === null || elementParent === void 0 || elementParent.insertBefore(before, element);
|
|
59
|
+
elementParent === null || elementParent === void 0 || elementParent.append(after);
|
|
62
60
|
}
|
|
63
61
|
};
|
|
64
|
-
exports.
|
|
65
|
-
var removeFocusBorders = function removeFocusBorders(element) {
|
|
62
|
+
var removeFocusBorders = exports.removeFocusBorders = function removeFocusBorders(element) {
|
|
66
63
|
var focusRefs = focusBordersRefs.get(element);
|
|
67
|
-
focusRefs === null || focusRefs === void 0
|
|
68
|
-
focusRefs === null || focusRefs === void 0
|
|
64
|
+
focusRefs === null || focusRefs === void 0 || focusRefs.before.remove();
|
|
65
|
+
focusRefs === null || focusRefs === void 0 || focusRefs.after.remove();
|
|
69
66
|
focusBordersRefs["delete"](element);
|
|
70
67
|
};
|
|
71
|
-
exports.removeFocusBorders = removeFocusBorders;
|
|
72
68
|
//# sourceMappingURL=focusBorders.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"focusBorders.js","names":["_getFocusableIn","require","focusBordersRefs","Map","BEFORE_BORDER_ID","exports","AFTER_BORDER_ID","addFocusBorders","element","has","previousSibling","HTMLElement","dataset","id","before","document","createElement","after","set","setAttribute","style","position","addEventListener","event","_focusBordersRefs$get","_focusBordersRefs$get2","activeElement","get","relatedTarget","focusable","getFocusableIn","_focusable","length","focus","_focusable$","_focusBordersRefs$get3","_focusBordersRefs$get4","_focusable$2","_focusable2","elementParent","parentElement","insertBefore","append","removeFocusBorders","focusRefs","remove"],"sources":["../../../src/utils/focus-lock/focusBorders.ts"],"sourcesContent":["import { getFocusableIn } from './getFocusableIn';\n\nconst focusBordersRefs = new Map<HTMLElement, { before: HTMLElement; after: HTMLElement }>();\n\nexport const BEFORE_BORDER_ID = '__intergalactic-focus-border-before';\nexport const AFTER_BORDER_ID = '__intergalactic-focus-border-after';\n\nexport const addFocusBorders = (element: HTMLElement) => {\n if (\n !focusBordersRefs.has(element) &&\n !(\n element.previousSibling instanceof HTMLElement &&\n element.previousSibling.dataset.id === BEFORE_BORDER_ID\n )\n ) {\n const before = document.createElement('div');\n const after = document.createElement('div');\n\n focusBordersRefs.set(element, { before, after });\n\n before.setAttribute('tabindex', '0');\n before.style.position = 'fixed';\n before.dataset.id = BEFORE_BORDER_ID;\n before.addEventListener('focus', (event) => {\n if (\n document.activeElement === focusBordersRefs.get(element)?.before &&\n event.relatedTarget !== focusBordersRefs.get(element)?.after && // prevent loop\n event.relatedTarget // prevent initial focus\n ) {\n const focusable = getFocusableIn(element);\n\n if (event.relatedTarget === focusable[0]) {\n focusable[focusable.length - 1]?.focus();\n } else {\n focusable[0]?.focus();\n }\n }\n });\n\n after.setAttribute('tabindex', '0');\n after.style.position = 'fixed';\n after.dataset.id = AFTER_BORDER_ID;\n after.addEventListener('focus', (event) => {\n if (\n document.activeElement === focusBordersRefs.get(element)?.after &&\n event.relatedTarget !== focusBordersRefs.get(element)?.before && // prevent loop\n event.relatedTarget // prevent initial focus\n ) {\n const focusable = getFocusableIn(element);\n\n if (event.relatedTarget === focusable[focusable.length - 1]) {\n focusable[0]?.focus();\n } else {\n focusable[focusable.length - 1]?.focus();\n }\n }\n });\n\n const elementParent = element.parentElement;\n\n elementParent?.insertBefore(before, element);\n elementParent?.append(after);\n }\n};\nexport const removeFocusBorders = (element: HTMLElement) => {\n const focusRefs = focusBordersRefs.get(element);\n focusRefs?.before.remove();\n focusRefs?.after.remove();\n focusBordersRefs.delete(element);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAEA,IAAMC,gBAAgB,GAAG,IAAIC,GAAG,
|
|
1
|
+
{"version":3,"file":"focusBorders.js","names":["_getFocusableIn","require","focusBordersRefs","Map","BEFORE_BORDER_ID","exports","AFTER_BORDER_ID","addFocusBorders","element","has","previousSibling","HTMLElement","dataset","id","before","document","createElement","after","set","setAttribute","style","position","addEventListener","event","_focusBordersRefs$get","_focusBordersRefs$get2","activeElement","get","relatedTarget","focusable","getFocusableIn","_focusable","length","focus","_focusable$","_focusBordersRefs$get3","_focusBordersRefs$get4","_focusable$2","_focusable2","elementParent","parentElement","insertBefore","append","removeFocusBorders","focusRefs","remove"],"sources":["../../../src/utils/focus-lock/focusBorders.ts"],"sourcesContent":["import { getFocusableIn } from './getFocusableIn';\n\nconst focusBordersRefs = new Map<HTMLElement, { before: HTMLElement; after: HTMLElement }>();\n\nexport const BEFORE_BORDER_ID = '__intergalactic-focus-border-before';\nexport const AFTER_BORDER_ID = '__intergalactic-focus-border-after';\n\nexport const addFocusBorders = (element: HTMLElement) => {\n if (\n !focusBordersRefs.has(element) &&\n !(\n element.previousSibling instanceof HTMLElement &&\n element.previousSibling.dataset.id === BEFORE_BORDER_ID\n )\n ) {\n const before = document.createElement('div');\n const after = document.createElement('div');\n\n focusBordersRefs.set(element, { before, after });\n\n before.setAttribute('tabindex', '0');\n before.style.position = 'fixed';\n before.dataset.id = BEFORE_BORDER_ID;\n before.addEventListener('focus', (event) => {\n if (\n document.activeElement === focusBordersRefs.get(element)?.before &&\n event.relatedTarget !== focusBordersRefs.get(element)?.after && // prevent loop\n event.relatedTarget // prevent initial focus\n ) {\n const focusable = getFocusableIn(element);\n\n if (event.relatedTarget === focusable[0]) {\n focusable[focusable.length - 1]?.focus();\n } else {\n focusable[0]?.focus();\n }\n }\n });\n\n after.setAttribute('tabindex', '0');\n after.style.position = 'fixed';\n after.dataset.id = AFTER_BORDER_ID;\n after.addEventListener('focus', (event) => {\n if (\n document.activeElement === focusBordersRefs.get(element)?.after &&\n event.relatedTarget !== focusBordersRefs.get(element)?.before && // prevent loop\n event.relatedTarget // prevent initial focus\n ) {\n const focusable = getFocusableIn(element);\n\n if (event.relatedTarget === focusable[focusable.length - 1]) {\n focusable[0]?.focus();\n } else {\n focusable[focusable.length - 1]?.focus();\n }\n }\n });\n\n const elementParent = element.parentElement;\n\n elementParent?.insertBefore(before, element);\n elementParent?.append(after);\n }\n};\nexport const removeFocusBorders = (element: HTMLElement) => {\n const focusRefs = focusBordersRefs.get(element);\n focusRefs?.before.remove();\n focusRefs?.after.remove();\n focusBordersRefs.delete(element);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAEA,IAAMC,gBAAgB,GAAG,IAAIC,GAAG,CAA2D,CAAC;AAErF,IAAMC,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,qCAAqC;AAC9D,IAAME,eAAe,GAAAD,OAAA,CAAAC,eAAA,GAAG,oCAAoC;AAE5D,IAAMC,eAAe,GAAAF,OAAA,CAAAE,eAAA,GAAG,SAAlBA,eAAeA,CAAIC,OAAoB,EAAK;EACvD,IACE,CAACN,gBAAgB,CAACO,GAAG,CAACD,OAAO,CAAC,IAC9B,EACEA,OAAO,CAACE,eAAe,YAAYC,WAAW,IAC9CH,OAAO,CAACE,eAAe,CA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