@semcore/core 2.39.1 → 16.0.0-prerelease.4
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 +7 -0
- package/README.md +2 -2
- package/lib/LastInteractionType.d.ts +11 -0
- package/lib/cjs/LastInteractionType.js +57 -0
- package/lib/cjs/LastInteractionType.js.map +1 -0
- package/lib/cjs/core-types/Component.js +59 -0
- package/lib/cjs/core-types/Component.js.map +1 -0
- package/lib/cjs/core-types/UnknownProperties.js +2 -0
- package/lib/cjs/core-types/UnknownProperties.js.map +1 -0
- package/lib/cjs/core-types/reshadow.d.js +2 -0
- package/lib/cjs/core-types/reshadow.d.js.map +1 -0
- package/lib/cjs/core-types/symbols.js +25 -0
- package/lib/cjs/core-types/symbols.js.map +1 -0
- package/lib/cjs/coreFactory.js +352 -0
- package/lib/cjs/coreFactory.js.map +1 -0
- package/lib/cjs/enhancement/Children.js +119 -0
- package/lib/cjs/enhancement/Children.js.map +1 -0
- package/lib/cjs/enhancement/Root.js +78 -0
- package/lib/cjs/enhancement/Root.js.map +1 -0
- package/lib/cjs/enhancement/bindHandler.js +54 -0
- package/lib/cjs/enhancement/bindHandler.js.map +1 -0
- package/lib/cjs/enhancement/dataName.js +20 -0
- package/lib/cjs/enhancement/dataName.js.map +1 -0
- package/lib/cjs/enhancement/enhance.js +22 -0
- package/lib/cjs/enhancement/enhance.js.map +1 -0
- package/lib/cjs/enhancement/functionDefaultProps.js +36 -0
- package/lib/cjs/enhancement/functionDefaultProps.js.map +1 -0
- package/lib/cjs/enhancement/hoistProps.js +97 -0
- package/lib/cjs/enhancement/hoistProps.js.map +1 -0
- package/lib/cjs/enhancement/i18n.js +28 -0
- package/lib/cjs/enhancement/i18n.js.map +1 -0
- package/lib/cjs/enhancement/inheritedName.js +23 -0
- package/lib/cjs/enhancement/inheritedName.js.map +1 -0
- package/lib/cjs/enhancement/staticChildren.js +135 -0
- package/lib/cjs/enhancement/staticChildren.js.map +1 -0
- package/lib/cjs/enhancement/style.js +60 -0
- package/lib/cjs/enhancement/style.js.map +1 -0
- package/lib/cjs/enhancement/uncontrolledProps.js +131 -0
- package/lib/cjs/enhancement/uncontrolledProps.js.map +1 -0
- package/lib/cjs/index.js +97 -17
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/register.js +37 -0
- package/lib/cjs/register.js.map +1 -0
- package/lib/cjs/styled/index.js +32 -0
- package/lib/cjs/styled/index.js.map +1 -0
- package/lib/cjs/styled/reshadow-core.js +256 -0
- package/lib/cjs/styled/reshadow-core.js.map +1 -0
- package/lib/cjs/styled/sstyled.js +149 -0
- package/lib/cjs/styled/sstyled.js.map +1 -0
- package/lib/cjs/theme/dark.json +2506 -0
- package/lib/cjs/theme/exclude-tokens.json +10 -0
- package/lib/cjs/theme/light.json +2584 -0
- package/lib/cjs/theme/processor.js +315 -0
- package/lib/cjs/theme/processor.js.map +1 -0
- package/lib/cjs/theme/themes/auto.css +1465 -0
- package/lib/cjs/theme/themes/dark.css +723 -0
- package/lib/cjs/theme/themes/dark.js +385 -0
- package/lib/cjs/theme/themes/dark.js.map +1 -0
- package/lib/cjs/theme/themes/default.css +742 -0
- package/lib/cjs/theme/themes/default.js +394 -0
- package/lib/cjs/theme/themes/default.js.map +1 -0
- package/lib/cjs/theme/themes/light.css +742 -0
- package/lib/cjs/theme/themes/light.js +394 -0
- package/lib/cjs/theme/themes/light.js.map +1 -0
- package/lib/cjs/theme/utils.js +297 -0
- package/lib/cjs/theme/utils.js.map +1 -0
- package/lib/cjs/utils/CSSinJS.js +36 -0
- package/lib/cjs/utils/CSSinJS.js.map +1 -0
- package/lib/cjs/utils/ScreenReaderOnly.js +31 -0
- package/lib/cjs/utils/ScreenReaderOnly.js.map +1 -0
- package/lib/cjs/utils/ThemeProvider.js +82 -0
- package/lib/cjs/utils/ThemeProvider.js.map +1 -0
- package/lib/cjs/utils/addonText.js +18 -0
- package/lib/cjs/utils/addonText.js.map +1 -0
- package/lib/cjs/utils/addonTextChildren.js +45 -0
- package/lib/cjs/utils/addonTextChildren.js.map +1 -0
- package/lib/cjs/utils/ariaProps.js +22 -0
- package/lib/cjs/utils/ariaProps.js.map +1 -0
- package/lib/cjs/utils/assignProps.js +93 -0
- package/lib/cjs/utils/assignProps.js.map +1 -0
- package/lib/cjs/utils/canUseDOM.js +10 -0
- package/lib/cjs/utils/canUseDOM.js.map +1 -0
- package/lib/cjs/utils/capitalizeFirstLetter.js +10 -0
- package/lib/cjs/utils/capitalizeFirstLetter.js.map +1 -0
- package/lib/cjs/utils/color.js +208 -0
- package/lib/cjs/utils/color.js.map +1 -0
- package/lib/cjs/utils/compose.js +21 -0
- package/lib/cjs/utils/compose.js.map +1 -0
- package/lib/cjs/utils/createHoc.js +55 -0
- package/lib/cjs/utils/createHoc.js.map +1 -0
- package/lib/cjs/utils/createUUID.js +15 -0
- package/lib/cjs/utils/createUUID.js.map +1 -0
- package/lib/cjs/utils/cssToIntDefault.js +22 -0
- package/lib/cjs/utils/cssToIntDefault.js.map +1 -0
- package/lib/cjs/utils/enhances/WithAutoFocus.js +75 -0
- package/lib/cjs/utils/enhances/WithAutoFocus.js.map +1 -0
- package/lib/cjs/utils/enhances/WithCSS.js +93 -0
- package/lib/cjs/utils/enhances/WithCSS.js.map +1 -0
- package/lib/cjs/utils/enhances/WithI18n.js +95 -0
- package/lib/cjs/utils/enhances/WithI18n.js.map +1 -0
- package/lib/cjs/utils/enhances/WithKeyboardFocus.js +93 -0
- package/lib/cjs/utils/enhances/WithKeyboardFocus.js.map +1 -0
- package/lib/cjs/utils/enhances/WithRef.js +26 -0
- package/lib/cjs/utils/enhances/WithRef.js.map +1 -0
- package/lib/cjs/utils/enhances/a11yEnhance.js +74 -0
- package/lib/cjs/utils/enhances/a11yEnhance.js.map +1 -0
- package/lib/cjs/utils/enhances/animatedSizeEnhance.js +98 -0
- package/lib/cjs/utils/enhances/animatedSizeEnhance.js.map +1 -0
- package/lib/cjs/utils/enhances/autoFocusEnhance.js +46 -0
- package/lib/cjs/utils/enhances/autoFocusEnhance.js.map +1 -0
- package/lib/cjs/utils/enhances/contextEnhance.js +22 -0
- package/lib/cjs/utils/enhances/contextEnhance.js.map +1 -0
- package/lib/cjs/utils/enhances/i18nEnhance.js +101 -0
- package/lib/cjs/utils/enhances/i18nEnhance.js.map +1 -0
- package/lib/cjs/utils/enhances/keyboardFocusEnhance.js +63 -0
- package/lib/cjs/utils/enhances/keyboardFocusEnhance.js.map +1 -0
- package/lib/cjs/utils/enhances/resolveColorEnhance.js +25 -0
- package/lib/cjs/utils/enhances/resolveColorEnhance.js.map +1 -0
- package/lib/cjs/utils/eventEmitter.js +41 -0
- package/lib/cjs/utils/eventEmitter.js.map +1 -0
- package/lib/cjs/utils/findComponent.js +106 -0
- package/lib/cjs/utils/findComponent.js.map +1 -0
- package/lib/cjs/utils/fire.js +23 -0
- package/lib/cjs/utils/fire.js.map +1 -0
- package/lib/cjs/utils/focus-lock/focusBorders.js +72 -0
- package/lib/cjs/utils/focus-lock/focusBorders.js.map +1 -0
- package/lib/cjs/utils/focus-lock/getFocusableIn.js +26 -0
- package/lib/cjs/utils/focus-lock/getFocusableIn.js.map +1 -0
- package/lib/cjs/utils/focus-lock/isFocusInside.js +16 -0
- package/lib/cjs/utils/focus-lock/isFocusInside.js.map +1 -0
- package/lib/cjs/utils/focus-lock/isFocusable.js +51 -0
- package/lib/cjs/utils/focus-lock/isFocusable.js.map +1 -0
- package/lib/cjs/utils/focus-lock/setFocus.js +63 -0
- package/lib/cjs/utils/focus-lock/setFocus.js.map +1 -0
- package/lib/cjs/utils/getAccessibleName.js +56 -0
- package/lib/cjs/utils/getAccessibleName.js.map +1 -0
- package/lib/cjs/utils/getDisplayName.js +10 -0
- package/lib/cjs/utils/getDisplayName.js.map +1 -0
- package/lib/cjs/utils/getEventTarget.js +53 -0
- package/lib/cjs/utils/getEventTarget.js.map +1 -0
- package/lib/cjs/utils/getOriginChildren.js +18 -0
- package/lib/cjs/utils/getOriginChildren.js.map +1 -0
- package/lib/cjs/utils/getRandomInt.js +11 -0
- package/lib/cjs/utils/getRandomInt.js.map +1 -0
- package/lib/cjs/utils/getValue.js +16 -0
- package/lib/cjs/utils/getValue.js.map +1 -0
- package/lib/cjs/utils/hasLabels.js +47 -0
- package/lib/cjs/utils/hasLabels.js.map +1 -0
- package/lib/cjs/utils/hasParent.js +14 -0
- package/lib/cjs/utils/hasParent.js.map +1 -0
- package/lib/cjs/utils/if.js +16 -0
- package/lib/cjs/utils/if.js.map +1 -0
- package/lib/cjs/utils/ifChildren.js +17 -0
- package/lib/cjs/utils/ifChildren.js.map +1 -0
- package/lib/cjs/utils/injectStyle.js +49 -0
- package/lib/cjs/utils/injectStyle.js.map +1 -0
- package/lib/cjs/utils/inputProps.js +22 -0
- package/lib/cjs/utils/inputProps.js.map +1 -0
- package/lib/cjs/utils/isNode.js +28 -0
- package/lib/cjs/utils/isNode.js.map +1 -0
- package/lib/cjs/utils/isPromise.js +10 -0
- package/lib/cjs/utils/isPromise.js.map +1 -0
- package/lib/cjs/utils/isRetina.js +15 -0
- package/lib/cjs/utils/isRetina.js.map +1 -0
- package/lib/cjs/utils/logger.js +40 -0
- package/lib/cjs/utils/logger.js.map +1 -0
- package/lib/cjs/utils/numericChecker.js +33 -0
- package/lib/cjs/utils/numericChecker.js.map +1 -0
- package/lib/cjs/utils/ownerDocument.js +10 -0
- package/lib/cjs/utils/ownerDocument.js.map +1 -0
- package/lib/cjs/utils/pick.js +19 -0
- package/lib/cjs/utils/pick.js.map +1 -0
- package/lib/cjs/utils/propsForElement.js +59 -0
- package/lib/cjs/utils/propsForElement.js.map +1 -0
- package/lib/cjs/utils/rafTrottle.js +33 -0
- package/lib/cjs/utils/rafTrottle.js.map +1 -0
- package/lib/cjs/utils/reactToText.js +33 -0
- package/lib/cjs/utils/reactToText.js.map +1 -0
- package/lib/cjs/utils/ref.js +95 -0
- package/lib/cjs/utils/ref.js.map +1 -0
- package/lib/cjs/utils/setRef.js +10 -0
- package/lib/cjs/utils/setRef.js.map +1 -0
- package/lib/cjs/utils/syncScroll.js +61 -0
- package/lib/cjs/utils/syncScroll.js.map +1 -0
- package/lib/cjs/utils/uncontroll.js +47 -0
- package/lib/cjs/utils/uncontroll.js.map +1 -0
- package/lib/cjs/utils/uniqueID.js +42 -0
- package/lib/cjs/utils/uniqueID.js.map +1 -0
- package/lib/cjs/utils/use/useColorResolver.js +208 -0
- package/lib/cjs/utils/use/useColorResolver.js.map +1 -0
- package/lib/cjs/utils/use/useCss.js +20 -0
- package/lib/cjs/utils/use/useCss.js.map +1 -0
- package/lib/cjs/utils/use/useEnhancedEffect.js +13 -0
- package/lib/cjs/utils/use/useEnhancedEffect.js.map +1 -0
- package/lib/cjs/utils/use/useEventCallback.js +25 -0
- package/lib/cjs/utils/use/useEventCallback.js.map +1 -0
- package/lib/cjs/utils/use/useEventListener.js +33 -0
- package/lib/cjs/utils/use/useEventListener.js.map +1 -0
- package/lib/cjs/utils/use/useFocusLock.js +289 -0
- package/lib/cjs/utils/use/useFocusLock.js.map +1 -0
- package/lib/cjs/utils/use/usePreventScroll.js +78 -0
- package/lib/cjs/utils/use/usePreventScroll.js.map +1 -0
- package/lib/cjs/utils/useCssVariable.js +55 -0
- package/lib/cjs/utils/useCssVariable.js.map +1 -0
- package/lib/cjs/utils/zIndexStacking.js +48 -0
- package/lib/cjs/utils/zIndexStacking.js.map +1 -0
- package/lib/core-types/Component.js +59 -0
- package/lib/core-types/Component.js.map +1 -0
- package/lib/core-types/Component.mjs +54 -0
- package/lib/core-types/Component.mjs.map +1 -0
- package/lib/core-types/UnknownProperties.d.ts +3 -0
- package/lib/core-types/UnknownProperties.js +2 -0
- package/lib/core-types/UnknownProperties.js.map +1 -0
- package/lib/core-types/UnknownProperties.mjs +3 -0
- package/lib/core-types/UnknownProperties.mjs.map +1 -0
- package/lib/core-types/reshadow.d.js +2 -0
- package/lib/core-types/reshadow.d.js.map +1 -0
- package/lib/core-types/reshadow.d.mjs +2 -0
- package/lib/core-types/reshadow.d.mjs.map +1 -0
- package/lib/core-types/symbols.d.ts +9 -0
- package/lib/core-types/symbols.js +25 -0
- package/lib/core-types/symbols.js.map +1 -0
- package/lib/core-types/symbols.mjs +10 -0
- package/lib/core-types/symbols.mjs.map +1 -0
- package/lib/enhancement/Children.js +119 -0
- package/lib/enhancement/Children.js.map +1 -0
- package/lib/enhancement/Children.mjs +111 -0
- package/lib/enhancement/Children.mjs.map +1 -0
- package/lib/enhancement/Root.js +78 -0
- package/lib/enhancement/Root.js.map +1 -0
- package/lib/enhancement/Root.mjs +70 -0
- package/lib/enhancement/Root.mjs.map +1 -0
- package/lib/enhancement/bindHandler.js +54 -0
- package/lib/enhancement/bindHandler.js.map +1 -0
- package/lib/enhancement/bindHandler.mjs +47 -0
- package/lib/enhancement/bindHandler.mjs.map +1 -0
- package/lib/enhancement/dataName.js +20 -0
- package/lib/enhancement/dataName.js.map +1 -0
- package/lib/enhancement/dataName.mjs +12 -0
- package/lib/enhancement/dataName.mjs.map +1 -0
- package/lib/enhancement/enhance.js +22 -0
- package/lib/enhancement/enhance.js.map +1 -0
- package/lib/enhancement/enhance.mjs +15 -0
- package/lib/enhancement/enhance.mjs.map +1 -0
- package/lib/enhancement/functionDefaultProps.js +36 -0
- package/lib/enhancement/functionDefaultProps.js.map +1 -0
- package/lib/enhancement/functionDefaultProps.mjs +29 -0
- package/lib/enhancement/functionDefaultProps.mjs.map +1 -0
- package/lib/enhancement/hoistProps.js +97 -0
- package/lib/enhancement/hoistProps.js.map +1 -0
- package/lib/enhancement/hoistProps.mjs +88 -0
- package/lib/enhancement/hoistProps.mjs.map +1 -0
- package/lib/enhancement/i18n.js +28 -0
- package/lib/enhancement/i18n.js.map +1 -0
- package/lib/enhancement/i18n.mjs +20 -0
- package/lib/enhancement/i18n.mjs.map +1 -0
- package/lib/enhancement/inheritedName.js +23 -0
- package/lib/enhancement/inheritedName.js.map +1 -0
- package/lib/enhancement/inheritedName.mjs +15 -0
- package/lib/enhancement/inheritedName.mjs.map +1 -0
- package/lib/enhancement/staticChildren.js +135 -0
- package/lib/enhancement/staticChildren.js.map +1 -0
- package/lib/enhancement/staticChildren.mjs +123 -0
- package/lib/enhancement/staticChildren.mjs.map +1 -0
- package/lib/enhancement/style.js +60 -0
- package/lib/enhancement/style.js.map +1 -0
- package/lib/enhancement/style.mjs +51 -0
- package/lib/enhancement/style.mjs.map +1 -0
- package/lib/enhancement/uncontrolledProps.js +131 -0
- package/lib/enhancement/uncontrolledProps.js.map +1 -0
- package/lib/enhancement/uncontrolledProps.mjs +123 -0
- package/lib/enhancement/uncontrolledProps.mjs.map +1 -0
- package/lib/es6/LastInteractionType.js +49 -0
- package/lib/es6/LastInteractionType.js.map +1 -0
- package/lib/es6/core-types/Component.js +54 -0
- package/lib/es6/core-types/Component.js.map +1 -0
- package/lib/es6/core-types/UnknownProperties.js +2 -0
- package/lib/es6/core-types/UnknownProperties.js.map +1 -0
- package/lib/es6/core-types/reshadow.d.js +2 -0
- package/lib/es6/core-types/reshadow.d.js.map +1 -0
- package/lib/es6/core-types/symbols.js +10 -0
- package/lib/es6/core-types/symbols.js.map +1 -0
- package/lib/es6/coreFactory.js +343 -0
- package/lib/es6/coreFactory.js.map +1 -0
- package/lib/es6/enhancement/Children.js +111 -0
- package/lib/es6/enhancement/Children.js.map +1 -0
- package/lib/es6/enhancement/Root.js +70 -0
- package/lib/es6/enhancement/Root.js.map +1 -0
- package/lib/es6/enhancement/bindHandler.js +47 -0
- package/lib/es6/enhancement/bindHandler.js.map +1 -0
- package/lib/es6/enhancement/dataName.js +12 -0
- package/lib/es6/enhancement/dataName.js.map +1 -0
- package/lib/es6/enhancement/enhance.js +15 -0
- package/lib/es6/enhancement/enhance.js.map +1 -0
- package/lib/es6/enhancement/functionDefaultProps.js +29 -0
- package/lib/es6/enhancement/functionDefaultProps.js.map +1 -0
- package/lib/es6/enhancement/hoistProps.js +88 -0
- package/lib/es6/enhancement/hoistProps.js.map +1 -0
- package/lib/es6/enhancement/i18n.js +20 -0
- package/lib/es6/enhancement/i18n.js.map +1 -0
- package/lib/es6/enhancement/inheritedName.js +15 -0
- package/lib/es6/enhancement/inheritedName.js.map +1 -0
- package/lib/es6/enhancement/staticChildren.js +123 -0
- package/lib/es6/enhancement/staticChildren.js.map +1 -0
- package/lib/es6/enhancement/style.js +51 -0
- package/lib/es6/enhancement/style.js.map +1 -0
- package/lib/es6/enhancement/uncontrolledProps.js +123 -0
- package/lib/es6/enhancement/uncontrolledProps.js.map +1 -0
- package/lib/es6/index.js +8 -3
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/register.js +29 -0
- package/lib/es6/register.js.map +1 -0
- package/lib/es6/styled/index.js +6 -0
- package/lib/es6/styled/index.js.map +1 -0
- package/lib/es6/styled/reshadow-core.js +243 -0
- package/lib/es6/styled/reshadow-core.js.map +1 -0
- package/lib/es6/styled/sstyled.js +142 -0
- package/lib/es6/styled/sstyled.js.map +1 -0
- package/lib/es6/theme/dark.json +2506 -0
- package/lib/es6/theme/exclude-tokens.json +10 -0
- package/lib/es6/theme/light.json +2584 -0
- package/lib/es6/theme/processor.js +307 -0
- package/lib/es6/theme/processor.js.map +1 -0
- package/lib/es6/theme/themes/auto.css +1465 -0
- package/lib/es6/theme/themes/dark.css +723 -0
- package/lib/es6/theme/themes/dark.js +378 -0
- package/lib/es6/theme/themes/dark.js.map +1 -0
- package/lib/es6/theme/themes/default.css +742 -0
- package/lib/es6/theme/themes/default.js +387 -0
- package/lib/es6/theme/themes/default.js.map +1 -0
- package/lib/es6/theme/themes/light.css +742 -0
- package/lib/es6/theme/themes/light.js +387 -0
- package/lib/es6/theme/themes/light.js.map +1 -0
- package/lib/es6/theme/utils.js +286 -0
- package/lib/es6/theme/utils.js.map +1 -0
- package/lib/es6/utils/CSSinJS.js +28 -0
- package/lib/es6/utils/CSSinJS.js.map +1 -0
- package/lib/es6/utils/ScreenReaderOnly.js +24 -0
- package/lib/es6/utils/ScreenReaderOnly.js.map +1 -0
- package/lib/es6/utils/ThemeProvider.js +71 -0
- package/lib/es6/utils/ThemeProvider.js.map +1 -0
- package/lib/es6/utils/addonText.js +11 -0
- package/lib/es6/utils/addonText.js.map +1 -0
- package/lib/es6/utils/addonTextChildren.js +37 -0
- package/lib/es6/utils/addonTextChildren.js.map +1 -0
- package/lib/es6/utils/ariaProps.js +16 -0
- package/lib/es6/utils/ariaProps.js.map +1 -0
- package/lib/es6/utils/assignProps.js +84 -0
- package/lib/es6/utils/assignProps.js.map +1 -0
- package/lib/es6/utils/canUseDOM.js +4 -0
- package/lib/es6/utils/canUseDOM.js.map +1 -0
- package/lib/es6/utils/capitalizeFirstLetter.js +4 -0
- package/lib/es6/utils/capitalizeFirstLetter.js.map +1 -0
- package/lib/es6/utils/color.js +196 -0
- package/lib/es6/utils/color.js.map +1 -0
- package/lib/es6/utils/compose.js +15 -0
- package/lib/es6/utils/compose.js.map +1 -0
- package/lib/es6/utils/createHoc.js +46 -0
- package/lib/es6/utils/createHoc.js.map +1 -0
- package/lib/es6/utils/createUUID.js +9 -0
- package/lib/es6/utils/createUUID.js.map +1 -0
- package/lib/es6/utils/cssToIntDefault.js +16 -0
- package/lib/es6/utils/cssToIntDefault.js.map +1 -0
- package/lib/es6/utils/enhances/WithAutoFocus.js +67 -0
- package/lib/es6/utils/enhances/WithAutoFocus.js.map +1 -0
- package/lib/es6/utils/enhances/WithCSS.js +79 -0
- package/lib/es6/utils/enhances/WithCSS.js.map +1 -0
- package/lib/es6/utils/enhances/WithI18n.js +83 -0
- package/lib/es6/utils/enhances/WithI18n.js.map +1 -0
- package/lib/es6/utils/enhances/WithKeyboardFocus.js +84 -0
- package/lib/es6/utils/enhances/WithKeyboardFocus.js.map +1 -0
- package/lib/es6/utils/enhances/WithRef.js +18 -0
- package/lib/es6/utils/enhances/WithRef.js.map +1 -0
- package/lib/es6/utils/enhances/a11yEnhance.js +66 -0
- package/lib/es6/utils/enhances/a11yEnhance.js.map +1 -0
- package/lib/es6/utils/enhances/animatedSizeEnhance.js +90 -0
- package/lib/es6/utils/enhances/animatedSizeEnhance.js.map +1 -0
- package/lib/es6/utils/enhances/autoFocusEnhance.js +38 -0
- package/lib/es6/utils/enhances/autoFocusEnhance.js.map +1 -0
- package/lib/es6/utils/enhances/contextEnhance.js +14 -0
- package/lib/es6/utils/enhances/contextEnhance.js.map +1 -0
- package/lib/es6/utils/enhances/i18nEnhance.js +92 -0
- package/lib/es6/utils/enhances/i18nEnhance.js.map +1 -0
- package/lib/es6/utils/enhances/keyboardFocusEnhance.js +57 -0
- package/lib/es6/utils/enhances/keyboardFocusEnhance.js.map +1 -0
- package/lib/es6/utils/enhances/resolveColorEnhance.js +17 -0
- package/lib/es6/utils/enhances/resolveColorEnhance.js.map +1 -0
- package/lib/es6/utils/eventEmitter.js +34 -0
- package/lib/es6/utils/eventEmitter.js.map +1 -0
- package/lib/es6/utils/findComponent.js +95 -0
- package/lib/es6/utils/findComponent.js.map +1 -0
- package/lib/es6/utils/fire.js +15 -0
- package/lib/es6/utils/fire.js.map +1 -0
- package/lib/es6/utils/focus-lock/focusBorders.js +62 -0
- package/lib/es6/utils/focus-lock/focusBorders.js.map +1 -0
- package/lib/es6/utils/focus-lock/getFocusableIn.js +19 -0
- package/lib/es6/utils/focus-lock/getFocusableIn.js.map +1 -0
- package/lib/es6/utils/focus-lock/isFocusInside.js +9 -0
- package/lib/es6/utils/focus-lock/isFocusInside.js.map +1 -0
- package/lib/es6/utils/focus-lock/isFocusable.js +43 -0
- package/lib/es6/utils/focus-lock/isFocusable.js.map +1 -0
- package/lib/es6/utils/focus-lock/setFocus.js +55 -0
- package/lib/es6/utils/focus-lock/setFocus.js.map +1 -0
- package/lib/es6/utils/getAccessibleName.js +49 -0
- package/lib/es6/utils/getAccessibleName.js.map +1 -0
- package/lib/es6/utils/getDisplayName.js +4 -0
- package/lib/es6/utils/getDisplayName.js.map +1 -0
- package/lib/es6/utils/getEventTarget.js +45 -0
- package/lib/es6/utils/getEventTarget.js.map +1 -0
- package/lib/es6/utils/getOriginChildren.js +10 -0
- package/lib/es6/utils/getOriginChildren.js.map +1 -0
- package/lib/es6/utils/getRandomInt.js +5 -0
- package/lib/es6/utils/getRandomInt.js.map +1 -0
- package/lib/es6/utils/getValue.js +10 -0
- package/lib/es6/utils/getValue.js.map +1 -0
- package/lib/es6/utils/hasLabels.js +39 -0
- package/lib/es6/utils/hasLabels.js.map +1 -0
- package/lib/es6/utils/hasParent.js +7 -0
- package/lib/es6/utils/hasParent.js.map +1 -0
- package/lib/es6/utils/if.js +9 -0
- package/lib/es6/utils/if.js.map +1 -0
- package/lib/es6/utils/ifChildren.js +10 -0
- package/lib/es6/utils/ifChildren.js.map +1 -0
- package/lib/es6/utils/injectStyle.js +41 -0
- package/lib/es6/utils/injectStyle.js.map +1 -0
- package/lib/es6/utils/inputProps.js +14 -0
- package/lib/es6/utils/inputProps.js.map +1 -0
- package/lib/es6/utils/isNode.js +21 -0
- package/lib/es6/utils/isNode.js.map +1 -0
- package/lib/es6/utils/isPromise.js +4 -0
- package/lib/es6/utils/isPromise.js.map +1 -0
- package/lib/es6/utils/isRetina.js +9 -0
- package/lib/es6/utils/isRetina.js.map +1 -0
- package/lib/es6/utils/logger.js +32 -0
- package/lib/es6/utils/logger.js.map +1 -0
- package/lib/es6/utils/numericChecker.js +27 -0
- package/lib/es6/utils/numericChecker.js.map +1 -0
- package/lib/es6/utils/ownerDocument.js +4 -0
- package/lib/es6/utils/ownerDocument.js.map +1 -0
- package/lib/es6/utils/pick.js +13 -0
- package/lib/es6/utils/pick.js.map +1 -0
- package/lib/es6/utils/propsForElement.js +50 -0
- package/lib/es6/utils/propsForElement.js.map +1 -0
- package/lib/es6/utils/rafTrottle.js +26 -0
- package/lib/es6/utils/rafTrottle.js.map +1 -0
- package/lib/es6/utils/reactToText.js +26 -0
- package/lib/es6/utils/reactToText.js.map +1 -0
- package/lib/es6/utils/ref.js +83 -0
- package/lib/es6/utils/ref.js.map +1 -0
- package/lib/es6/utils/setRef.js +3 -0
- package/lib/es6/utils/setRef.js.map +1 -0
- package/lib/es6/utils/syncScroll.js +54 -0
- package/lib/es6/utils/syncScroll.js.map +1 -0
- package/lib/es6/utils/uncontroll.js +38 -0
- package/lib/es6/utils/uncontroll.js.map +1 -0
- package/lib/es6/utils/uniqueID.js +33 -0
- package/lib/es6/utils/uniqueID.js.map +1 -0
- package/lib/es6/utils/use/useColorResolver.js +200 -0
- package/lib/es6/utils/use/useColorResolver.js.map +1 -0
- package/lib/es6/utils/use/useCss.js +12 -0
- package/lib/es6/utils/use/useCss.js.map +1 -0
- package/lib/es6/utils/use/useEnhancedEffect.js +5 -0
- package/lib/es6/utils/use/useEnhancedEffect.js.map +1 -0
- package/lib/es6/utils/use/useEventCallback.js +19 -0
- package/lib/es6/utils/use/useEventCallback.js.map +1 -0
- package/lib/es6/utils/use/useEventListener.js +25 -0
- package/lib/es6/utils/use/useEventListener.js.map +1 -0
- package/lib/es6/utils/use/useFocusLock.js +266 -0
- package/lib/es6/utils/use/useFocusLock.js.map +1 -0
- package/lib/es6/utils/use/usePreventScroll.js +70 -0
- package/lib/es6/utils/use/usePreventScroll.js.map +1 -0
- package/lib/es6/utils/useCssVariable.js +46 -0
- package/lib/es6/utils/useCssVariable.js.map +1 -0
- package/lib/es6/utils/zIndexStacking.js +38 -0
- package/lib/es6/utils/zIndexStacking.js.map +1 -0
- package/lib/esm/LastInteractionType.mjs +42 -0
- package/lib/esm/core-types/Component.mjs +40 -0
- package/lib/esm/core-types/symbols.mjs +12 -0
- package/lib/esm/coreFactory.mjs +235 -0
- package/lib/esm/enhancement/Children.mjs +72 -0
- package/lib/esm/enhancement/Root.mjs +43 -0
- package/lib/esm/enhancement/bindHandler.mjs +44 -0
- package/lib/esm/enhancement/dataName.mjs +13 -0
- package/lib/esm/enhancement/enhance.mjs +16 -0
- package/lib/esm/enhancement/functionDefaultProps.mjs +19 -0
- package/lib/esm/enhancement/hoistProps.mjs +58 -0
- package/lib/esm/enhancement/i18n.mjs +18 -0
- package/lib/esm/enhancement/inheritedName.mjs +16 -0
- package/lib/esm/enhancement/staticChildren.mjs +78 -0
- package/lib/esm/enhancement/style.mjs +38 -0
- package/lib/esm/enhancement/uncontrolledProps.mjs +88 -0
- package/lib/esm/index.mjs +21 -4
- package/lib/esm/register.mjs +24 -0
- package/lib/esm/styled/reshadow-core.mjs +16 -0
- package/lib/esm/styled/sstyled.mjs +78 -0
- package/lib/esm/utils/assignProps.mjs +42 -0
- package/lib/esm/utils/canUseDOM.mjs +6 -0
- package/lib/esm/utils/capitalizeFirstLetter.mjs +6 -0
- package/lib/esm/utils/enhances/WithI18n.mjs +48 -0
- package/lib/esm/utils/logger.mjs +27 -0
- package/lib/esm/utils/pick.mjs +10 -0
- package/lib/esm/utils/ref.mjs +34 -0
- package/lib/esm/utils/use/useEnhancedEffect.mjs +6 -0
- package/lib/register.d.ts +8 -0
- package/lib/register.js +37 -0
- package/lib/register.js.map +1 -0
- package/lib/register.mjs +29 -0
- package/lib/register.mjs.map +1 -0
- package/lib/styled/index.d.ts +11 -0
- package/lib/styled/index.js +32 -0
- package/lib/styled/index.js.map +1 -0
- package/lib/styled/index.mjs +6 -0
- package/lib/styled/index.mjs.map +1 -0
- package/lib/styled/reshadow-core.d.ts +37 -0
- package/lib/styled/reshadow-core.js +256 -0
- package/lib/styled/reshadow-core.js.map +1 -0
- package/lib/styled/reshadow-core.mjs +243 -0
- package/lib/styled/reshadow-core.mjs.map +1 -0
- package/lib/styled/sstyled.d.ts +17 -0
- package/lib/styled/sstyled.js +149 -0
- package/lib/styled/sstyled.js.map +1 -0
- package/lib/styled/sstyled.mjs +142 -0
- package/lib/styled/sstyled.mjs.map +1 -0
- package/lib/theme/dark.json +2506 -0
- package/lib/theme/exclude-tokens.json +10 -0
- package/lib/theme/light.json +2584 -0
- package/lib/theme/processor.js +315 -0
- package/lib/theme/processor.js.map +1 -0
- package/lib/theme/processor.mjs +307 -0
- package/lib/theme/processor.mjs.map +1 -0
- package/lib/theme/themes/auto.css +1465 -0
- package/lib/theme/themes/dark.css +723 -0
- package/lib/theme/themes/dark.js +385 -0
- package/lib/theme/themes/dark.js.map +1 -0
- package/lib/theme/themes/dark.mjs +378 -0
- package/lib/theme/themes/dark.mjs.map +1 -0
- package/lib/theme/themes/default.css +742 -0
- package/lib/theme/themes/default.d.ts +387 -0
- package/lib/theme/themes/default.js +394 -0
- package/lib/theme/themes/default.js.map +1 -0
- package/lib/theme/themes/default.mjs +387 -0
- package/lib/theme/themes/default.mjs.map +1 -0
- package/lib/theme/themes/light.css +742 -0
- package/lib/theme/themes/light.js +394 -0
- package/lib/theme/themes/light.js.map +1 -0
- package/lib/theme/themes/light.mjs +387 -0
- package/lib/theme/themes/light.mjs.map +1 -0
- package/lib/theme/utils.js +297 -0
- package/lib/theme/utils.js.map +1 -0
- package/lib/theme/utils.mjs +286 -0
- package/lib/theme/utils.mjs.map +1 -0
- package/lib/types/LastInteractionType.d.ts +11 -0
- package/lib/types/core-types/Component.d.ts +189 -0
- package/lib/types/core-types/UnknownProperties.d.ts +3 -0
- package/lib/types/core-types/symbols.d.ts +9 -0
- package/lib/types/coreFactory.d.ts +27 -0
- package/lib/types/enhancement/Children.d.ts +5 -0
- package/lib/types/enhancement/Root.d.ts +6 -0
- package/lib/types/enhancement/bindHandler.d.ts +5 -0
- package/lib/types/enhancement/dataName.d.ts +4 -0
- package/lib/types/enhancement/enhance.d.ts +5 -0
- package/lib/types/enhancement/functionDefaultProps.d.ts +8 -0
- package/lib/types/enhancement/hoistProps.d.ts +10 -0
- package/lib/types/enhancement/i18n.d.ts +4 -0
- package/lib/types/enhancement/inheritedName.d.ts +8 -0
- package/lib/types/enhancement/staticChildren.d.ts +13 -0
- package/lib/types/enhancement/style.d.ts +9 -0
- package/lib/types/enhancement/uncontrolledProps.d.ts +7 -0
- package/lib/types/index.d.ts +11 -3
- package/lib/types/register.d.ts +8 -0
- package/lib/types/styled/index.d.ts +11 -0
- package/lib/types/styled/reshadow-core.d.ts +37 -0
- package/lib/types/styled/sstyled.d.ts +17 -0
- package/lib/types/theme/processor.d.ts +1 -0
- package/lib/types/theme/themes/dark.d.ts +378 -0
- package/lib/types/theme/themes/default.d.ts +387 -0
- package/lib/types/theme/themes/light.d.ts +387 -0
- package/lib/types/theme/utils.d.ts +52 -0
- package/lib/types/utils/CSSinJS.d.ts +5 -0
- package/lib/types/utils/ScreenReaderOnly.d.ts +8 -0
- package/lib/types/utils/ThemeProvider.d.ts +15 -0
- package/lib/types/utils/addonText.d.ts +2 -0
- package/lib/types/utils/addonTextChildren.d.ts +3 -0
- package/lib/types/utils/ariaProps.d.ts +12 -0
- package/lib/types/utils/assignProps.d.ts +11 -0
- package/lib/types/utils/canUseDOM.d.ts +1 -0
- package/lib/types/utils/capitalizeFirstLetter.d.ts +1 -0
- package/lib/types/utils/color.d.ts +5 -0
- package/lib/types/utils/compose.d.ts +1 -0
- package/lib/types/utils/createHoc.d.ts +3 -0
- package/lib/types/utils/createUUID.d.ts +1 -0
- package/lib/types/utils/cssToIntDefault.d.ts +8 -0
- package/lib/types/utils/enhances/WithAutoFocus.d.ts +14 -0
- package/lib/types/utils/enhances/WithCSS.d.ts +41 -0
- package/lib/types/utils/enhances/WithI18n.d.ts +43 -0
- package/lib/types/utils/enhances/WithKeyboardFocus.d.ts +45 -0
- package/lib/types/utils/enhances/WithRef.d.ts +3 -0
- package/lib/types/utils/enhances/a11yEnhance.d.ts +10 -0
- package/lib/types/utils/enhances/animatedSizeEnhance.d.ts +12 -0
- package/lib/types/utils/enhances/autoFocusEnhance.d.ts +10 -0
- package/lib/types/utils/enhances/contextEnhance.d.ts +3 -0
- package/lib/types/utils/enhances/i18nEnhance.d.ts +25 -0
- package/lib/types/utils/enhances/keyboardFocusEnhance.d.ts +27 -0
- package/lib/types/utils/enhances/resolveColorEnhance.d.ts +2 -0
- package/lib/types/utils/eventEmitter.d.ts +9 -0
- package/lib/types/utils/findComponent.d.ts +12 -0
- package/lib/types/utils/fire.d.ts +2 -0
- package/lib/types/utils/focus-lock/focusBorders.d.ts +4 -0
- package/lib/types/utils/focus-lock/getFocusableIn.d.ts +1 -0
- package/lib/types/utils/focus-lock/isFocusInside.d.ts +1 -0
- package/lib/types/utils/focus-lock/isFocusable.d.ts +1 -0
- package/lib/types/utils/focus-lock/setFocus.d.ts +1 -0
- package/lib/types/utils/getAccessibleName.d.ts +1 -0
- package/lib/types/utils/getDisplayName.d.ts +2 -0
- package/lib/types/utils/getEventTarget.d.ts +1 -0
- package/lib/types/utils/getOriginChildren.d.ts +2 -0
- package/lib/types/utils/getRandomInt.d.ts +1 -0
- package/lib/types/utils/getValue.d.ts +1 -0
- package/lib/types/utils/hasLabels.d.ts +7 -0
- package/lib/types/utils/hasParent.d.ts +1 -0
- package/lib/types/utils/if.d.ts +11 -0
- package/lib/types/utils/ifChildren.d.ts +8 -0
- package/lib/types/utils/injectStyle.d.ts +2 -0
- package/lib/types/utils/inputProps.d.ts +2 -0
- package/lib/types/utils/isNode.d.ts +1 -0
- package/lib/types/utils/isPromise.d.ts +1 -0
- package/lib/types/utils/isRetina.d.ts +1 -0
- package/lib/types/utils/logger.d.ts +9 -0
- package/lib/types/utils/numericChecker.d.ts +5 -0
- package/lib/types/utils/ownerDocument.d.ts +1 -0
- package/lib/types/utils/pick.d.ts +1 -0
- package/lib/types/utils/propsForElement.d.ts +3 -0
- package/lib/types/utils/rafTrottle.d.ts +2 -0
- package/lib/types/utils/reactToText.d.ts +3 -0
- package/lib/types/utils/ref.d.ts +8 -0
- package/lib/types/utils/setRef.d.ts +2 -0
- package/lib/types/utils/syncScroll.d.ts +1 -0
- package/lib/types/utils/uncontroll.d.ts +4 -0
- package/lib/types/utils/uniqueID.d.ts +12 -0
- package/lib/types/utils/use/useColorResolver.d.ts +1 -0
- package/lib/types/utils/use/useCss.d.ts +4 -0
- package/lib/types/utils/use/useEnhancedEffect.d.ts +3 -0
- package/lib/types/utils/use/useEventCallback.d.ts +4 -0
- package/lib/types/utils/use/useEventListener.d.ts +2 -0
- package/lib/types/utils/use/useFocusLock.d.ts +10 -0
- package/lib/types/utils/use/usePreventScroll.d.ts +2 -0
- package/lib/types/utils/useCssVariable.d.ts +8 -0
- package/lib/types/utils/zIndexStacking.d.ts +8 -0
- package/lib/utils/CSSinJS.d.ts +5 -0
- package/lib/utils/CSSinJS.js +36 -0
- package/lib/utils/CSSinJS.js.map +1 -0
- package/lib/utils/CSSinJS.mjs +28 -0
- package/lib/utils/CSSinJS.mjs.map +1 -0
- package/lib/utils/ScreenReaderOnly.d.ts +8 -0
- package/lib/utils/ScreenReaderOnly.js +31 -0
- package/lib/utils/ScreenReaderOnly.js.map +1 -0
- package/lib/utils/ScreenReaderOnly.mjs +24 -0
- package/lib/utils/ScreenReaderOnly.mjs.map +1 -0
- package/lib/utils/ThemeProvider.d.ts +15 -0
- package/lib/utils/ThemeProvider.js +82 -0
- package/lib/utils/ThemeProvider.js.map +1 -0
- package/lib/utils/ThemeProvider.mjs +71 -0
- package/lib/utils/ThemeProvider.mjs.map +1 -0
- package/lib/utils/addonText.d.ts +2 -0
- package/lib/utils/addonText.js +18 -0
- package/lib/utils/addonText.js.map +1 -0
- package/lib/utils/addonText.mjs +11 -0
- package/lib/utils/addonText.mjs.map +1 -0
- package/lib/utils/addonTextChildren.d.ts +3 -0
- package/lib/utils/addonTextChildren.js +45 -0
- package/lib/utils/addonTextChildren.js.map +1 -0
- package/lib/utils/addonTextChildren.mjs +37 -0
- package/lib/utils/addonTextChildren.mjs.map +1 -0
- package/lib/utils/ariaProps.d.ts +12 -0
- package/lib/utils/ariaProps.js +22 -0
- package/lib/utils/ariaProps.js.map +1 -0
- package/lib/utils/ariaProps.mjs +16 -0
- package/lib/utils/ariaProps.mjs.map +1 -0
- package/lib/utils/assignProps.d.ts +11 -0
- package/lib/utils/assignProps.js +93 -0
- package/lib/utils/assignProps.js.map +1 -0
- package/lib/utils/assignProps.mjs +84 -0
- package/lib/utils/assignProps.mjs.map +1 -0
- package/lib/utils/canUseDOM.d.ts +1 -0
- package/lib/utils/canUseDOM.js +10 -0
- package/lib/utils/canUseDOM.js.map +1 -0
- package/lib/utils/canUseDOM.mjs +4 -0
- package/lib/utils/canUseDOM.mjs.map +1 -0
- package/lib/utils/capitalizeFirstLetter.d.ts +1 -0
- package/lib/utils/capitalizeFirstLetter.js +10 -0
- package/lib/utils/capitalizeFirstLetter.js.map +1 -0
- package/lib/utils/capitalizeFirstLetter.mjs +4 -0
- package/lib/utils/capitalizeFirstLetter.mjs.map +1 -0
- package/lib/utils/color.d.ts +5 -0
- package/lib/utils/color.js +208 -0
- package/lib/utils/color.js.map +1 -0
- package/lib/utils/color.mjs +196 -0
- package/lib/utils/color.mjs.map +1 -0
- package/lib/utils/compose.d.ts +1 -0
- package/lib/utils/compose.js +21 -0
- package/lib/utils/compose.js.map +1 -0
- package/lib/utils/compose.mjs +15 -0
- package/lib/utils/compose.mjs.map +1 -0
- package/lib/utils/createHoc.d.ts +3 -0
- package/lib/utils/createHoc.js +55 -0
- package/lib/utils/createHoc.js.map +1 -0
- package/lib/utils/createHoc.mjs +46 -0
- package/lib/utils/createHoc.mjs.map +1 -0
- package/lib/utils/createUUID.d.ts +1 -0
- package/lib/utils/createUUID.js +15 -0
- package/lib/utils/createUUID.js.map +1 -0
- package/lib/utils/createUUID.mjs +9 -0
- package/lib/utils/createUUID.mjs.map +1 -0
- package/lib/utils/cssToIntDefault.d.ts +8 -0
- package/lib/utils/cssToIntDefault.js +22 -0
- package/lib/utils/cssToIntDefault.js.map +1 -0
- package/lib/utils/cssToIntDefault.mjs +16 -0
- package/lib/utils/cssToIntDefault.mjs.map +1 -0
- package/lib/utils/enhances/WithAutoFocus.d.ts +14 -0
- package/lib/utils/enhances/WithAutoFocus.js +75 -0
- package/lib/utils/enhances/WithAutoFocus.js.map +1 -0
- package/lib/utils/enhances/WithAutoFocus.mjs +67 -0
- package/lib/utils/enhances/WithAutoFocus.mjs.map +1 -0
- package/lib/utils/enhances/WithCSS.d.ts +41 -0
- package/lib/utils/enhances/WithCSS.js +93 -0
- package/lib/utils/enhances/WithCSS.js.map +1 -0
- package/lib/utils/enhances/WithCSS.mjs +79 -0
- package/lib/utils/enhances/WithCSS.mjs.map +1 -0
- package/lib/utils/enhances/WithI18n.d.ts +43 -0
- package/lib/utils/enhances/WithI18n.js +95 -0
- package/lib/utils/enhances/WithI18n.js.map +1 -0
- package/lib/utils/enhances/WithI18n.mjs +83 -0
- package/lib/utils/enhances/WithI18n.mjs.map +1 -0
- package/lib/utils/enhances/WithKeyboardFocus.d.ts +45 -0
- package/lib/utils/enhances/WithKeyboardFocus.js +93 -0
- package/lib/utils/enhances/WithKeyboardFocus.js.map +1 -0
- package/lib/utils/enhances/WithKeyboardFocus.mjs +84 -0
- package/lib/utils/enhances/WithKeyboardFocus.mjs.map +1 -0
- package/lib/utils/enhances/WithRef.d.ts +3 -0
- package/lib/utils/enhances/WithRef.js +26 -0
- package/lib/utils/enhances/WithRef.js.map +1 -0
- package/lib/utils/enhances/WithRef.mjs +18 -0
- package/lib/utils/enhances/WithRef.mjs.map +1 -0
- package/lib/utils/enhances/a11yEnhance.d.ts +10 -0
- package/lib/utils/enhances/a11yEnhance.js +74 -0
- package/lib/utils/enhances/a11yEnhance.js.map +1 -0
- package/lib/utils/enhances/a11yEnhance.mjs +66 -0
- package/lib/utils/enhances/a11yEnhance.mjs.map +1 -0
- package/lib/utils/enhances/animatedSizeEnhance.d.ts +12 -0
- package/lib/utils/enhances/animatedSizeEnhance.js +98 -0
- package/lib/utils/enhances/animatedSizeEnhance.js.map +1 -0
- package/lib/utils/enhances/animatedSizeEnhance.mjs +90 -0
- package/lib/utils/enhances/animatedSizeEnhance.mjs.map +1 -0
- package/lib/utils/enhances/autoFocusEnhance.d.ts +10 -0
- package/lib/utils/enhances/autoFocusEnhance.js +46 -0
- package/lib/utils/enhances/autoFocusEnhance.js.map +1 -0
- package/lib/utils/enhances/autoFocusEnhance.mjs +38 -0
- package/lib/utils/enhances/autoFocusEnhance.mjs.map +1 -0
- package/lib/utils/enhances/contextEnhance.d.ts +3 -0
- package/lib/utils/enhances/contextEnhance.js +22 -0
- package/lib/utils/enhances/contextEnhance.js.map +1 -0
- package/lib/utils/enhances/contextEnhance.mjs +14 -0
- package/lib/utils/enhances/contextEnhance.mjs.map +1 -0
- package/lib/utils/enhances/i18nEnhance.d.ts +25 -0
- package/lib/utils/enhances/i18nEnhance.js +101 -0
- package/lib/utils/enhances/i18nEnhance.js.map +1 -0
- package/lib/utils/enhances/i18nEnhance.mjs +92 -0
- package/lib/utils/enhances/i18nEnhance.mjs.map +1 -0
- package/lib/utils/enhances/keyboardFocusEnhance.d.ts +27 -0
- package/lib/utils/enhances/keyboardFocusEnhance.js +63 -0
- package/lib/utils/enhances/keyboardFocusEnhance.js.map +1 -0
- package/lib/utils/enhances/keyboardFocusEnhance.mjs +57 -0
- package/lib/utils/enhances/keyboardFocusEnhance.mjs.map +1 -0
- package/lib/utils/enhances/resolveColorEnhance.d.ts +2 -0
- package/lib/utils/enhances/resolveColorEnhance.js +25 -0
- package/lib/utils/enhances/resolveColorEnhance.js.map +1 -0
- package/lib/utils/enhances/resolveColorEnhance.mjs +17 -0
- package/lib/utils/enhances/resolveColorEnhance.mjs.map +1 -0
- package/lib/utils/eventEmitter.d.ts +9 -0
- package/lib/utils/eventEmitter.js +41 -0
- package/lib/utils/eventEmitter.js.map +1 -0
- package/lib/utils/eventEmitter.mjs +34 -0
- package/lib/utils/eventEmitter.mjs.map +1 -0
- package/lib/utils/findComponent.d.ts +12 -0
- package/lib/utils/findComponent.js +106 -0
- package/lib/utils/findComponent.js.map +1 -0
- package/lib/utils/findComponent.mjs +95 -0
- package/lib/utils/findComponent.mjs.map +1 -0
- package/lib/utils/fire.d.ts +2 -0
- package/lib/utils/fire.js +23 -0
- package/lib/utils/fire.js.map +1 -0
- package/lib/utils/fire.mjs +15 -0
- package/lib/utils/fire.mjs.map +1 -0
- package/lib/utils/focus-lock/focusBorders.d.ts +4 -0
- package/lib/utils/focus-lock/focusBorders.js +72 -0
- package/lib/utils/focus-lock/focusBorders.js.map +1 -0
- package/lib/utils/focus-lock/focusBorders.mjs +62 -0
- package/lib/utils/focus-lock/focusBorders.mjs.map +1 -0
- package/lib/utils/focus-lock/getFocusableIn.d.ts +1 -0
- package/lib/utils/focus-lock/getFocusableIn.js +26 -0
- package/lib/utils/focus-lock/getFocusableIn.js.map +1 -0
- package/lib/utils/focus-lock/getFocusableIn.mjs +19 -0
- package/lib/utils/focus-lock/getFocusableIn.mjs.map +1 -0
- package/lib/utils/focus-lock/isFocusInside.d.ts +1 -0
- package/lib/utils/focus-lock/isFocusInside.js +16 -0
- package/lib/utils/focus-lock/isFocusInside.js.map +1 -0
- package/lib/utils/focus-lock/isFocusInside.mjs +9 -0
- package/lib/utils/focus-lock/isFocusInside.mjs.map +1 -0
- package/lib/utils/focus-lock/isFocusable.d.ts +1 -0
- package/lib/utils/focus-lock/isFocusable.js +51 -0
- package/lib/utils/focus-lock/isFocusable.js.map +1 -0
- package/lib/utils/focus-lock/isFocusable.mjs +43 -0
- package/lib/utils/focus-lock/isFocusable.mjs.map +1 -0
- package/lib/utils/focus-lock/setFocus.d.ts +1 -0
- package/lib/utils/focus-lock/setFocus.js +63 -0
- package/lib/utils/focus-lock/setFocus.js.map +1 -0
- package/lib/utils/focus-lock/setFocus.mjs +55 -0
- package/lib/utils/focus-lock/setFocus.mjs.map +1 -0
- package/lib/utils/getAccessibleName.d.ts +1 -0
- package/lib/utils/getAccessibleName.js +56 -0
- package/lib/utils/getAccessibleName.js.map +1 -0
- package/lib/utils/getAccessibleName.mjs +49 -0
- package/lib/utils/getAccessibleName.mjs.map +1 -0
- package/lib/utils/getDisplayName.d.ts +2 -0
- package/lib/utils/getDisplayName.js +10 -0
- package/lib/utils/getDisplayName.js.map +1 -0
- package/lib/utils/getDisplayName.mjs +4 -0
- package/lib/utils/getDisplayName.mjs.map +1 -0
- package/lib/utils/getEventTarget.d.ts +1 -0
- package/lib/utils/getEventTarget.js +53 -0
- package/lib/utils/getEventTarget.js.map +1 -0
- package/lib/utils/getEventTarget.mjs +45 -0
- package/lib/utils/getEventTarget.mjs.map +1 -0
- package/lib/utils/getOriginChildren.d.ts +2 -0
- package/lib/utils/getOriginChildren.js +18 -0
- package/lib/utils/getOriginChildren.js.map +1 -0
- package/lib/utils/getOriginChildren.mjs +10 -0
- package/lib/utils/getOriginChildren.mjs.map +1 -0
- package/lib/utils/getRandomInt.d.ts +1 -0
- package/lib/utils/getRandomInt.js +11 -0
- package/lib/utils/getRandomInt.js.map +1 -0
- package/lib/utils/getRandomInt.mjs +5 -0
- package/lib/utils/getRandomInt.mjs.map +1 -0
- package/lib/utils/getValue.d.ts +1 -0
- package/lib/utils/getValue.js +16 -0
- package/lib/utils/getValue.js.map +1 -0
- package/lib/utils/getValue.mjs +10 -0
- package/lib/utils/getValue.mjs.map +1 -0
- package/lib/utils/hasLabels.d.ts +7 -0
- package/lib/utils/hasLabels.js +47 -0
- package/lib/utils/hasLabels.js.map +1 -0
- package/lib/utils/hasLabels.mjs +39 -0
- package/lib/utils/hasLabels.mjs.map +1 -0
- package/lib/utils/hasParent.d.ts +1 -0
- package/lib/utils/hasParent.js +14 -0
- package/lib/utils/hasParent.js.map +1 -0
- package/lib/utils/hasParent.mjs +7 -0
- package/lib/utils/hasParent.mjs.map +1 -0
- package/lib/utils/if.d.ts +11 -0
- package/lib/utils/if.js +16 -0
- package/lib/utils/if.js.map +1 -0
- package/lib/utils/if.mjs +9 -0
- package/lib/utils/if.mjs.map +1 -0
- package/lib/utils/ifChildren.d.ts +8 -0
- package/lib/utils/ifChildren.js +17 -0
- package/lib/utils/ifChildren.js.map +1 -0
- package/lib/utils/ifChildren.mjs +10 -0
- package/lib/utils/ifChildren.mjs.map +1 -0
- package/lib/utils/injectStyle.d.ts +2 -0
- package/lib/utils/injectStyle.js +49 -0
- package/lib/utils/injectStyle.js.map +1 -0
- package/lib/utils/injectStyle.mjs +41 -0
- package/lib/utils/injectStyle.mjs.map +1 -0
- package/lib/utils/inputProps.d.ts +2 -0
- package/lib/utils/inputProps.js +22 -0
- package/lib/utils/inputProps.js.map +1 -0
- package/lib/utils/inputProps.mjs +14 -0
- package/lib/utils/inputProps.mjs.map +1 -0
- package/lib/utils/isNode.d.ts +1 -0
- package/lib/utils/isNode.js +28 -0
- package/lib/utils/isNode.js.map +1 -0
- package/lib/utils/isNode.mjs +21 -0
- package/lib/utils/isNode.mjs.map +1 -0
- package/lib/utils/isPromise.d.ts +1 -0
- package/lib/utils/isPromise.js +10 -0
- package/lib/utils/isPromise.js.map +1 -0
- package/lib/utils/isPromise.mjs +4 -0
- package/lib/utils/isPromise.mjs.map +1 -0
- package/lib/utils/isRetina.d.ts +1 -0
- package/lib/utils/isRetina.js +15 -0
- package/lib/utils/isRetina.js.map +1 -0
- package/lib/utils/isRetina.mjs +9 -0
- package/lib/utils/isRetina.mjs.map +1 -0
- package/lib/utils/logger.d.ts +9 -0
- package/lib/utils/logger.js +40 -0
- package/lib/utils/logger.js.map +1 -0
- package/lib/utils/logger.mjs +32 -0
- package/lib/utils/logger.mjs.map +1 -0
- package/lib/utils/numericChecker.d.ts +5 -0
- package/lib/utils/numericChecker.js +33 -0
- package/lib/utils/numericChecker.js.map +1 -0
- package/lib/utils/numericChecker.mjs +27 -0
- package/lib/utils/numericChecker.mjs.map +1 -0
- package/lib/utils/ownerDocument.d.ts +1 -0
- package/lib/utils/ownerDocument.js +10 -0
- package/lib/utils/ownerDocument.js.map +1 -0
- package/lib/utils/ownerDocument.mjs +4 -0
- package/lib/utils/ownerDocument.mjs.map +1 -0
- package/lib/utils/pick.d.ts +1 -0
- package/lib/utils/pick.js +19 -0
- package/lib/utils/pick.js.map +1 -0
- package/lib/utils/pick.mjs +13 -0
- package/lib/utils/pick.mjs.map +1 -0
- package/lib/utils/propsForElement.d.ts +3 -0
- package/lib/utils/propsForElement.js +59 -0
- package/lib/utils/propsForElement.js.map +1 -0
- package/lib/utils/propsForElement.mjs +50 -0
- package/lib/utils/propsForElement.mjs.map +1 -0
- package/lib/utils/rafTrottle.d.ts +2 -0
- package/lib/utils/rafTrottle.js +33 -0
- package/lib/utils/rafTrottle.js.map +1 -0
- package/lib/utils/rafTrottle.mjs +26 -0
- package/lib/utils/rafTrottle.mjs.map +1 -0
- package/lib/utils/reactToText.d.ts +3 -0
- package/lib/utils/reactToText.js +33 -0
- package/lib/utils/reactToText.js.map +1 -0
- package/lib/utils/reactToText.mjs +26 -0
- package/lib/utils/reactToText.mjs.map +1 -0
- package/lib/utils/ref.d.ts +8 -0
- package/lib/utils/ref.js +95 -0
- package/lib/utils/ref.js.map +1 -0
- package/lib/utils/ref.mjs +83 -0
- package/lib/utils/ref.mjs.map +1 -0
- package/lib/utils/setRef.d.ts +2 -0
- package/lib/utils/setRef.js +10 -0
- package/lib/utils/setRef.js.map +1 -0
- package/lib/utils/setRef.mjs +3 -0
- package/lib/utils/setRef.mjs.map +1 -0
- package/lib/utils/syncScroll.d.ts +1 -0
- package/lib/utils/syncScroll.js +61 -0
- package/lib/utils/syncScroll.js.map +1 -0
- package/lib/utils/syncScroll.mjs +54 -0
- package/lib/utils/syncScroll.mjs.map +1 -0
- package/lib/utils/uncontroll.d.ts +4 -0
- package/lib/utils/uncontroll.js +47 -0
- package/lib/utils/uncontroll.js.map +1 -0
- package/lib/utils/uncontroll.mjs +38 -0
- package/lib/utils/uncontroll.mjs.map +1 -0
- package/lib/utils/uniqueID.d.ts +12 -0
- package/lib/utils/uniqueID.js +42 -0
- package/lib/utils/uniqueID.js.map +1 -0
- package/lib/utils/uniqueID.mjs +33 -0
- package/lib/utils/uniqueID.mjs.map +1 -0
- package/lib/utils/use/useColorResolver.d.ts +1 -0
- package/lib/utils/use/useColorResolver.js +208 -0
- package/lib/utils/use/useColorResolver.js.map +1 -0
- package/lib/utils/use/useColorResolver.mjs +200 -0
- package/lib/utils/use/useColorResolver.mjs.map +1 -0
- package/lib/utils/use/useCss.d.ts +4 -0
- package/lib/utils/use/useCss.js +20 -0
- package/lib/utils/use/useCss.js.map +1 -0
- package/lib/utils/use/useCss.mjs +12 -0
- package/lib/utils/use/useCss.mjs.map +1 -0
- package/lib/utils/use/useEnhancedEffect.d.ts +3 -0
- package/lib/utils/use/useEnhancedEffect.js +13 -0
- package/lib/utils/use/useEnhancedEffect.js.map +1 -0
- package/lib/utils/use/useEnhancedEffect.mjs +5 -0
- package/lib/utils/use/useEnhancedEffect.mjs.map +1 -0
- package/lib/utils/use/useEventCallback.d.ts +4 -0
- package/lib/utils/use/useEventCallback.js +25 -0
- package/lib/utils/use/useEventCallback.js.map +1 -0
- package/lib/utils/use/useEventCallback.mjs +19 -0
- package/lib/utils/use/useEventCallback.mjs.map +1 -0
- package/lib/utils/use/useEventListener.d.ts +2 -0
- package/lib/utils/use/useEventListener.js +33 -0
- package/lib/utils/use/useEventListener.js.map +1 -0
- package/lib/utils/use/useEventListener.mjs +25 -0
- package/lib/utils/use/useEventListener.mjs.map +1 -0
- package/lib/utils/use/useFocusLock.d.ts +10 -0
- package/lib/utils/use/useFocusLock.js +289 -0
- package/lib/utils/use/useFocusLock.js.map +1 -0
- package/lib/utils/use/useFocusLock.mjs +266 -0
- package/lib/utils/use/useFocusLock.mjs.map +1 -0
- package/lib/utils/use/usePreventScroll.d.ts +2 -0
- package/lib/utils/use/usePreventScroll.js +78 -0
- package/lib/utils/use/usePreventScroll.js.map +1 -0
- package/lib/utils/use/usePreventScroll.mjs +70 -0
- package/lib/utils/use/usePreventScroll.mjs.map +1 -0
- package/lib/utils/useCssVariable.d.ts +8 -0
- package/lib/utils/useCssVariable.js +55 -0
- package/lib/utils/useCssVariable.js.map +1 -0
- package/lib/utils/useCssVariable.mjs +46 -0
- package/lib/utils/useCssVariable.mjs.map +1 -0
- package/lib/utils/zIndexStacking.d.ts +8 -0
- package/lib/utils/zIndexStacking.js +48 -0
- package/lib/utils/zIndexStacking.js.map +1 -0
- package/lib/utils/zIndexStacking.mjs +38 -0
- package/lib/utils/zIndexStacking.mjs.map +1 -0
- package/package.json +269 -7
- package/tsconfig-utils.json +4 -0
- package/vite.config.ts +15 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useAsyncI18nMessages = exports["default"] = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
10
|
+
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
|
11
|
+
var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
var _WithI18n = require("./WithI18n");
|
|
16
|
+
var useAsyncI18nMessages = function useAsyncI18nMessages(primaryContainer, locale, fallbackContainer) {
|
|
17
|
+
var _store$locale;
|
|
18
|
+
var container = _react["default"].useMemo(function () {
|
|
19
|
+
if (!fallbackContainer) return primaryContainer;
|
|
20
|
+
if (!primaryContainer) return fallbackContainer;
|
|
21
|
+
if (primaryContainer === fallbackContainer) return primaryContainer;
|
|
22
|
+
var container = {};
|
|
23
|
+
var _loop = function _loop(_locale) {
|
|
24
|
+
if (typeof primaryContainer[_locale] === 'function' || typeof fallbackContainer[_locale] === 'function') {
|
|
25
|
+
container[_locale] = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee() {
|
|
26
|
+
var _yield$Promise$all, _yield$Promise$all2, primary, fallback;
|
|
27
|
+
return (0, _regeneratorRuntime2["default"])().wrap(function _callee$(_context) {
|
|
28
|
+
while (1) switch (_context.prev = _context.next) {
|
|
29
|
+
case 0:
|
|
30
|
+
_context.next = 2;
|
|
31
|
+
return Promise.all([primaryContainer[_locale], fallbackContainer[_locale]]);
|
|
32
|
+
case 2:
|
|
33
|
+
_yield$Promise$all = _context.sent;
|
|
34
|
+
_yield$Promise$all2 = (0, _slicedToArray2["default"])(_yield$Promise$all, 2);
|
|
35
|
+
primary = _yield$Promise$all2[0];
|
|
36
|
+
fallback = _yield$Promise$all2[1];
|
|
37
|
+
return _context.abrupt("return", (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, primary), fallback));
|
|
38
|
+
case 7:
|
|
39
|
+
case "end":
|
|
40
|
+
return _context.stop();
|
|
41
|
+
}
|
|
42
|
+
}, _callee);
|
|
43
|
+
}));
|
|
44
|
+
} else {
|
|
45
|
+
var _primaryContainer$_lo, _fallbackContainer$_l;
|
|
46
|
+
container[_locale] = (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, (_primaryContainer$_lo = primaryContainer[_locale]) !== null && _primaryContainer$_lo !== void 0 ? _primaryContainer$_lo : {}), (_fallbackContainer$_l = fallbackContainer[_locale]) !== null && _fallbackContainer$_l !== void 0 ? _fallbackContainer$_l : {});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
for (var _locale in primaryContainer) {
|
|
50
|
+
_loop(_locale);
|
|
51
|
+
}
|
|
52
|
+
return container;
|
|
53
|
+
}, [primaryContainer, fallbackContainer]);
|
|
54
|
+
var initStore = _react["default"].useMemo(function () {
|
|
55
|
+
var store = {};
|
|
56
|
+
for (var _locale2 in container) {
|
|
57
|
+
if ((0, _typeof2["default"])(container[_locale2]) === 'object') {
|
|
58
|
+
store[_locale2] = container[_locale2];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return store;
|
|
62
|
+
}, [container]);
|
|
63
|
+
var _React$useState = _react["default"].useState(initStore),
|
|
64
|
+
_React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
|
|
65
|
+
store = _React$useState2[0],
|
|
66
|
+
setStore = _React$useState2[1];
|
|
67
|
+
var lastLoadedLocaleRef = _react["default"].useRef(null);
|
|
68
|
+
if (store[locale]) lastLoadedLocaleRef.current = locale;
|
|
69
|
+
var fallbackMessages = _react["default"].useMemo(function () {
|
|
70
|
+
return Object.values(store)[0];
|
|
71
|
+
}, [store]);
|
|
72
|
+
var loadingLocaleRef = _react["default"].useRef(null);
|
|
73
|
+
_react["default"].useEffect(function () {
|
|
74
|
+
loadingLocaleRef.current = locale;
|
|
75
|
+
var asyncMessages = container[locale];
|
|
76
|
+
if (typeof asyncMessages === 'function') {
|
|
77
|
+
asyncMessages().then(function (module) {
|
|
78
|
+
if (loadingLocaleRef.current !== locale) return;
|
|
79
|
+
var messages = module;
|
|
80
|
+
if ('default' in module && (0, _typeof2["default"])(module["default"]) === 'object') messages = module["default"];
|
|
81
|
+
setStore(function (store) {
|
|
82
|
+
return (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, store), {}, (0, _defineProperty2["default"])({}, locale, messages));
|
|
83
|
+
});
|
|
84
|
+
})["catch"](console.error);
|
|
85
|
+
}
|
|
86
|
+
}, [container, locale]);
|
|
87
|
+
return (_store$locale = store[locale]) !== null && _store$locale !== void 0 ? _store$locale : fallbackMessages;
|
|
88
|
+
};
|
|
89
|
+
exports.useAsyncI18nMessages = useAsyncI18nMessages;
|
|
90
|
+
var _default = function _default(container) {
|
|
91
|
+
return function (props) {
|
|
92
|
+
var i18n = props.i18n,
|
|
93
|
+
locale = props.locale;
|
|
94
|
+
var getI18nText = (0, _WithI18n.useI18n)(i18n, locale, container);
|
|
95
|
+
return (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, props), {}, {
|
|
96
|
+
getI18nText: getI18nText
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
exports["default"] = _default;
|
|
101
|
+
//# sourceMappingURL=i18nEnhance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18nEnhance.js","names":["_react","_interopRequireDefault","require","_WithI18n","useAsyncI18nMessages","primaryContainer","locale","fallbackContainer","_store$locale","container","React","useMemo","_loop","_locale","_asyncToGenerator2","_regeneratorRuntime2","mark","_callee","_yield$Promise$all","_yield$Promise$all2","primary","fallback","wrap","_callee$","_context","prev","next","Promise","all","sent","_slicedToArray2","abrupt","_objectSpread3","stop","_primaryContainer$_lo","_fallbackContainer$_l","initStore","store","_typeof2","_React$useState","useState","_React$useState2","setStore","lastLoadedLocaleRef","useRef","current","fallbackMessages","Object","values","loadingLocaleRef","useEffect","asyncMessages","then","module","messages","_defineProperty2","console","error","exports","_default","props","i18n","getI18nText","useI18n"],"sources":["../../../src/utils/enhances/i18nEnhance.tsx"],"sourcesContent":["import React from 'react';\nimport { LocaleKeys, useI18n } from './WithI18n';\nimport { UnknownProperties } from '../../core-types/UnknownProperties';\n\n/** @deprecated */\nexport interface IWithI18nEnhanceProps extends WithI18nEnhanceProps, UnknownProperties {}\nexport type WithI18nEnhanceProps = {\n /* Function for getting the required field from the translation dictionary */\n getI18nText?: (key?: string, variables?: {}) => any;\n /* Object with translations */\n i18n?: {\n [locale: string]: {\n [key: string]: string;\n };\n };\n /* Locale for translations */\n locale?: LocaleKeys;\n};\n\ntype Messages = { [messageId: string]: string };\ntype MessagesContainer = { [locale: string]: Messages | (() => Promise<Messages>) };\ntype MessagesStore = { [locale: string]: Messages };\nexport const useAsyncI18nMessages = (\n primaryContainer: MessagesContainer,\n locale: string,\n fallbackContainer?: MessagesContainer,\n) => {\n const container = React.useMemo(() => {\n if (!fallbackContainer) return primaryContainer;\n if (!primaryContainer) return fallbackContainer;\n if (primaryContainer === fallbackContainer) return primaryContainer;\n const container: MessagesContainer = {};\n for (const locale in primaryContainer) {\n if (\n typeof primaryContainer[locale] === 'function' ||\n typeof fallbackContainer[locale] === 'function'\n ) {\n container[locale] = async () => {\n const [primary, fallback] = await Promise.all([\n primaryContainer[locale],\n fallbackContainer[locale],\n ]);\n return { ...primary, ...fallback };\n };\n } else {\n container[locale] = {\n ...(primaryContainer[locale] ?? {}),\n ...(fallbackContainer[locale] ?? {}),\n };\n }\n }\n return container;\n }, [primaryContainer, fallbackContainer]);\n const initStore = React.useMemo(() => {\n const store: MessagesStore = {};\n for (const locale in container) {\n if (typeof container[locale] === 'object') {\n store[locale] = container[locale] as Messages;\n }\n }\n return store;\n }, [container]);\n const [store, setStore] = React.useState(initStore);\n const lastLoadedLocaleRef = React.useRef<string | null>(null);\n if (store[locale]) lastLoadedLocaleRef.current = locale;\n const fallbackMessages = React.useMemo(() => Object.values(store)[0], [store]);\n\n const loadingLocaleRef = React.useRef<string | null>(null);\n React.useEffect(() => {\n loadingLocaleRef.current = locale;\n const asyncMessages = container[locale];\n if (typeof asyncMessages === 'function') {\n asyncMessages()\n .then((module) => {\n if (loadingLocaleRef.current !== locale) return;\n let messages = module;\n if ('default' in module && typeof module.default === 'object') messages = module.default;\n setStore((store) => ({\n ...store,\n [locale]: messages,\n }));\n })\n\n .catch(console.error);\n }\n }, [container, locale]);\n\n return store[locale] ?? fallbackMessages;\n};\nexport default (container?: MessagesContainer) => {\n return (props: any): { getI18nText: ReturnType<typeof useI18n> } => {\n const { i18n, locale } = props;\n const getI18nText = useI18n(i18n, locale, container);\n\n return { ...props, getI18nText };\n };\n};\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAqBO,IAAME,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAC/BC,gBAAmC,EACnCC,MAAc,EACdC,iBAAqC,EAClC;EAAA,IAAAC,aAAA;EACH,IAAMC,SAAS,GAAGC,iBAAK,CAACC,OAAO,CAAC,YAAM;IACpC,IAAI,CAACJ,iBAAiB,EAAE,OAAOF,gBAAgB;IAC/C,IAAI,CAACA,gBAAgB,E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"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/regeneratorRuntime";
|
|
4
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
5
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
6
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { useI18n } from "./WithI18n.mjs";
|
|
9
|
+
export var useAsyncI18nMessages = function useAsyncI18nMessages(primaryContainer, locale, fallbackContainer) {
|
|
10
|
+
var _store$locale;
|
|
11
|
+
var container = React.useMemo(function () {
|
|
12
|
+
if (!fallbackContainer) return primaryContainer;
|
|
13
|
+
if (!primaryContainer) return fallbackContainer;
|
|
14
|
+
if (primaryContainer === fallbackContainer) return primaryContainer;
|
|
15
|
+
var container = {};
|
|
16
|
+
var _loop = function _loop(_locale) {
|
|
17
|
+
if (typeof primaryContainer[_locale] === 'function' || typeof fallbackContainer[_locale] === 'function') {
|
|
18
|
+
container[_locale] = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
19
|
+
var _yield$Promise$all, _yield$Promise$all2, primary, fallback;
|
|
20
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
21
|
+
while (1) switch (_context.prev = _context.next) {
|
|
22
|
+
case 0:
|
|
23
|
+
_context.next = 2;
|
|
24
|
+
return Promise.all([primaryContainer[_locale], fallbackContainer[_locale]]);
|
|
25
|
+
case 2:
|
|
26
|
+
_yield$Promise$all = _context.sent;
|
|
27
|
+
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
28
|
+
primary = _yield$Promise$all2[0];
|
|
29
|
+
fallback = _yield$Promise$all2[1];
|
|
30
|
+
return _context.abrupt("return", _objectSpread(_objectSpread({}, primary), fallback));
|
|
31
|
+
case 7:
|
|
32
|
+
case "end":
|
|
33
|
+
return _context.stop();
|
|
34
|
+
}
|
|
35
|
+
}, _callee);
|
|
36
|
+
}));
|
|
37
|
+
} else {
|
|
38
|
+
var _primaryContainer$_lo, _fallbackContainer$_l;
|
|
39
|
+
container[_locale] = _objectSpread(_objectSpread({}, (_primaryContainer$_lo = primaryContainer[_locale]) !== null && _primaryContainer$_lo !== void 0 ? _primaryContainer$_lo : {}), (_fallbackContainer$_l = fallbackContainer[_locale]) !== null && _fallbackContainer$_l !== void 0 ? _fallbackContainer$_l : {});
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
for (var _locale in primaryContainer) {
|
|
43
|
+
_loop(_locale);
|
|
44
|
+
}
|
|
45
|
+
return container;
|
|
46
|
+
}, [primaryContainer, fallbackContainer]);
|
|
47
|
+
var initStore = React.useMemo(function () {
|
|
48
|
+
var store = {};
|
|
49
|
+
for (var _locale3 in container) {
|
|
50
|
+
if (_typeof(container[_locale3]) === 'object') {
|
|
51
|
+
store[_locale3] = container[_locale3];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return store;
|
|
55
|
+
}, [container]);
|
|
56
|
+
var _React$useState = React.useState(initStore),
|
|
57
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
58
|
+
store = _React$useState2[0],
|
|
59
|
+
setStore = _React$useState2[1];
|
|
60
|
+
var lastLoadedLocaleRef = React.useRef(null);
|
|
61
|
+
if (store[locale]) lastLoadedLocaleRef.current = locale;
|
|
62
|
+
var fallbackMessages = React.useMemo(function () {
|
|
63
|
+
return Object.values(store)[0];
|
|
64
|
+
}, [store]);
|
|
65
|
+
var loadingLocaleRef = React.useRef(null);
|
|
66
|
+
React.useEffect(function () {
|
|
67
|
+
loadingLocaleRef.current = locale;
|
|
68
|
+
var asyncMessages = container[locale];
|
|
69
|
+
if (typeof asyncMessages === 'function') {
|
|
70
|
+
asyncMessages().then(function (module) {
|
|
71
|
+
if (loadingLocaleRef.current !== locale) return;
|
|
72
|
+
var messages = module;
|
|
73
|
+
if ('default' in module && _typeof(module["default"]) === 'object') messages = module["default"];
|
|
74
|
+
setStore(function (store) {
|
|
75
|
+
return _objectSpread(_objectSpread({}, store), {}, _defineProperty({}, locale, messages));
|
|
76
|
+
});
|
|
77
|
+
})["catch"](console.error);
|
|
78
|
+
}
|
|
79
|
+
}, [container, locale]);
|
|
80
|
+
return (_store$locale = store[locale]) !== null && _store$locale !== void 0 ? _store$locale : fallbackMessages;
|
|
81
|
+
};
|
|
82
|
+
export default (function (container) {
|
|
83
|
+
return function (props) {
|
|
84
|
+
var i18n = props.i18n,
|
|
85
|
+
locale = props.locale;
|
|
86
|
+
var getI18nText = useI18n(i18n, locale, container);
|
|
87
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
|
88
|
+
getI18nText: getI18nText
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
//# sourceMappingURL=i18nEnhance.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18nEnhance.mjs","names":["React","useI18n","useAsyncI18nMessages","primaryContainer","locale","fallbackContainer","_store$locale","container","useMemo","_loop","_locale","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_yield$Promise$all","_yield$Promise$all2","primary","fallback","wrap","_callee$","_context","prev","next","Promise","all","sent","_slicedToArray","abrupt","_objectSpread","stop","_primaryContainer$_lo","_fallbackContainer$_l","initStore","store","_typeof","_React$useState","useState","_React$useState2","setStore","lastLoadedLocaleRef","useRef","current","fallbackMessages","Object","values","loadingLocaleRef","useEffect","asyncMessages","then","module","messages","_defineProperty","console","error","props","i18n","getI18nText"],"sources":["../../../src/utils/enhances/i18nEnhance.tsx"],"sourcesContent":["import React from 'react';\nimport { LocaleKeys, useI18n } from './WithI18n';\nimport { UnknownProperties } from '../../core-types/UnknownProperties';\n\n/** @deprecated */\nexport interface IWithI18nEnhanceProps extends WithI18nEnhanceProps, UnknownProperties {}\nexport type WithI18nEnhanceProps = {\n /* Function for getting the required field from the translation dictionary */\n getI18nText?: (key?: string, variables?: {}) => any;\n /* Object with translations */\n i18n?: {\n [locale: string]: {\n [key: string]: string;\n };\n };\n /* Locale for translations */\n locale?: LocaleKeys;\n};\n\ntype Messages = { [messageId: string]: string };\ntype MessagesContainer = { [locale: string]: Messages | (() => Promise<Messages>) };\ntype MessagesStore = { [locale: string]: Messages };\nexport const useAsyncI18nMessages = (\n primaryContainer: MessagesContainer,\n locale: string,\n fallbackContainer?: MessagesContainer,\n) => {\n const container = React.useMemo(() => {\n if (!fallbackContainer) return primaryContainer;\n if (!primaryContainer) return fallbackContainer;\n if (primaryContainer === fallbackContainer) return primaryContainer;\n const container: MessagesContainer = {};\n for (const locale in primaryContainer) {\n if (\n typeof primaryContainer[locale] === 'function' ||\n typeof fallbackContainer[locale] === 'function'\n ) {\n container[locale] = async () => {\n const [primary, fallback] = await Promise.all([\n primaryContainer[locale],\n fallbackContainer[locale],\n ]);\n return { ...primary, ...fallback };\n };\n } else {\n container[locale] = {\n ...(primaryContainer[locale] ?? {}),\n ...(fallbackContainer[locale] ?? {}),\n };\n }\n }\n return container;\n }, [primaryContainer, fallbackContainer]);\n const initStore = React.useMemo(() => {\n const store: MessagesStore = {};\n for (const locale in container) {\n if (typeof container[locale] === 'object') {\n store[locale] = container[locale] as Messages;\n }\n }\n return store;\n }, [container]);\n const [store, setStore] = React.useState(initStore);\n const lastLoadedLocaleRef = React.useRef<string | null>(null);\n if (store[locale]) lastLoadedLocaleRef.current = locale;\n const fallbackMessages = React.useMemo(() => Object.values(store)[0], [store]);\n\n const loadingLocaleRef = React.useRef<string | null>(null);\n React.useEffect(() => {\n loadingLocaleRef.current = locale;\n const asyncMessages = container[locale];\n if (typeof asyncMessages === 'function') {\n asyncMessages()\n .then((module) => {\n if (loadingLocaleRef.current !== locale) return;\n let messages = module;\n if ('default' in module && typeof module.default === 'object') messages = module.default;\n setStore((store) => ({\n ...store,\n [locale]: messages,\n }));\n })\n\n .catch(console.error);\n }\n }, [container, locale]);\n\n return store[locale] ?? fallbackMessages;\n};\nexport default (container?: MessagesContainer) => {\n return (props: any): { getI18nText: ReturnType<typeof useI18n> } => {\n const { i18n, locale } = props;\n const getI18nText = useI18n(i18n, locale, container);\n\n return { ...props, getI18nText };\n };\n};\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAqBC,OAAO,QAAQ,gBAAY;AAqBhD,OAAO,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAC/BC,gBAAmC,EACnCC,MAAc,EACdC,iBAAqC,EAClC;EAAA,IAAAC,aAAA;EACH,IAAMC,SAAS,GAAGP,KAAK,CAACQ,OAAO,CAAC,YAAM;IACpC,IAAI,CAACH,iBAAiB,EAAE,OAAOF,gBAAgB;IAC/C,IAAI,CAACA,gBAAgB,EAAE,OAAOE,iBAAiB;IAC/C,IAAIF,gBAAgB,KAAKE,iBAAiB,EAAE,OAAOF,gBAAgB;IACnE,IAAMI,SAA4B,GAAG,CAAC,CAAC;IAAC,IAAAE,KAAA,YAAAA,MAAAC,OAAA,EACD;MACrC,IACE,OAAOP,gBAAgB,CAACC,OAAM,CAAC,KAAK,UAAU,IAC9C,OAAOC,iBAAiB,CAACD,OAAM,CAAC,KAAK,UAAU,EAC/C;QACAG,SAAS,CAACH,OAAM,CAAC,gBAAAO,iBAAA,eAAAC,mBAAA,GAAAC,IAAA,CAAG,SAAAC,QAAA;UAAA,IAAAC,kBAAA,EAAAC,mBAAA,EAAAC,OAAA,EAAAC,QAAA;UAAA,OAAAN,mBAAA,GAAAO,IAAA,UAAAC,SAAAC,QAAA;YAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;cAAA;gBAAAF,QAAA,CAAAE,IAAA;gBAAA,OACgBC,OAAO,CAACC,GAAG,CAAC,CAC5CtB,gBAAgB,CAACC,OAAM,CAAC,EACxBC,iB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AAAE,aAAA,GAAO4B,KAAK,CAAC9B,MAAM,CAAC,cAAAE,aAAA,cAAAA,aAAA,GAAIqC,gBAAgB;AAC1C,CAAC;AACD,gBAAe,UAACpC,SAA6B,EAAK;EAChD,OAAO,UAACgD,KAAU,EAAkD;IAClE,IAAQC,IAAI,GAAaD,KAAK,CAAtBC,IAAI;MAAEpD,MAAM,GAAKmD,KAAK,CAAhBnD,MAAM;IACpB,IAAMqD,WAAW,GAAGxD,OAAO,CAACuD,IAAI,EAAEpD,MAAM,EAAEG,SAAS,CAAC;IAEpD,OAAAsB,aAAA,CAAAA,aAAA,KAAY0B,KAAK;MAAEE,WAAW,EAAXA;IAAW;EAChC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { UnknownProperties } from '../../core-types/UnknownProperties';
|
|
3
|
+
/** @deprecated */
|
|
4
|
+
export interface IKeyboardFocusProps extends KeyboardFocusProps, UnknownProperties {
|
|
5
|
+
}
|
|
6
|
+
export type KeyboardFocusProps = {
|
|
7
|
+
keyboardFocused?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Makes component to catch browser focus on component mount
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
autoFocus?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare const enforcedKeyboardFocusEnhanceContext: React.Context<boolean>;
|
|
15
|
+
export type KeyboardFocusEnhanceHook = (props: {
|
|
16
|
+
tabIndex?: number;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
loading?: boolean;
|
|
19
|
+
autoFocus?: boolean;
|
|
20
|
+
}) => {
|
|
21
|
+
tabIndex: number;
|
|
22
|
+
keyboardFocused: boolean;
|
|
23
|
+
onFocus: (e: React.FocusEvent) => void;
|
|
24
|
+
onBlur: () => void;
|
|
25
|
+
};
|
|
26
|
+
declare const keyboardFocusEnhance: (makeFocusable?: boolean) => KeyboardFocusEnhanceHook;
|
|
27
|
+
export default keyboardFocusEnhance;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.enforcedKeyboardFocusEnhanceContext = exports["default"] = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _assignProps = _interopRequireDefault(require("../assignProps"));
|
|
11
|
+
var _LastInteractionType = require("../../LastInteractionType");
|
|
12
|
+
var enforcedKeyboardFocusEnhanceContext = /*#__PURE__*/_react["default"].createContext(false);
|
|
13
|
+
exports.enforcedKeyboardFocusEnhanceContext = enforcedKeyboardFocusEnhanceContext;
|
|
14
|
+
var keyboardFocusEnhance = function keyboardFocusEnhance() {
|
|
15
|
+
var makeFocusable = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
16
|
+
return function (props) {
|
|
17
|
+
var _props$tabIndex;
|
|
18
|
+
var autoFocus = props.autoFocus;
|
|
19
|
+
var disabled = props.disabled || props.loading;
|
|
20
|
+
var tabIndex = (_props$tabIndex = props.tabIndex) !== null && _props$tabIndex !== void 0 ? _props$tabIndex : makeFocusable ? 0 : undefined;
|
|
21
|
+
var _React$useState = _react["default"].useState(false),
|
|
22
|
+
_React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
|
|
23
|
+
keyboardFocused = _React$useState2[0],
|
|
24
|
+
setKeyboardFocused = _React$useState2[1];
|
|
25
|
+
var ref = _react["default"].useRef(null);
|
|
26
|
+
var handleFocus = _react["default"].useCallback(function (event) {
|
|
27
|
+
if (event.isTrusted === true) {
|
|
28
|
+
if (!_LastInteractionType.lastInteraction.isKeyboard()) return;
|
|
29
|
+
}
|
|
30
|
+
setKeyboardFocused(true);
|
|
31
|
+
}, []);
|
|
32
|
+
var handlerBlur = _react["default"].useCallback(function () {
|
|
33
|
+
return setKeyboardFocused(false);
|
|
34
|
+
}, []);
|
|
35
|
+
_react["default"].useEffect(function () {
|
|
36
|
+
if (typeof autoFocus !== 'number' && !autoFocus) return;
|
|
37
|
+
var timer = setTimeout(function () {
|
|
38
|
+
var _ref$current;
|
|
39
|
+
(_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
|
|
40
|
+
setKeyboardFocused(true);
|
|
41
|
+
}, 0);
|
|
42
|
+
return function () {
|
|
43
|
+
clearTimeout(timer);
|
|
44
|
+
};
|
|
45
|
+
}, [autoFocus]);
|
|
46
|
+
_react["default"].useEffect(function () {
|
|
47
|
+
if (disabled) {
|
|
48
|
+
setKeyboardFocused(false);
|
|
49
|
+
}
|
|
50
|
+
}, [disabled]);
|
|
51
|
+
var enforcedKeyboardFocus = _react["default"].useContext(enforcedKeyboardFocusEnhanceContext);
|
|
52
|
+
return (0, _assignProps["default"])(props, {
|
|
53
|
+
tabIndex: disabled ? -1 : tabIndex,
|
|
54
|
+
keyboardFocused: (keyboardFocused || enforcedKeyboardFocus) && !disabled,
|
|
55
|
+
onFocus: handleFocus,
|
|
56
|
+
onBlur: handlerBlur,
|
|
57
|
+
ref: ref
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
var _default = keyboardFocusEnhance;
|
|
62
|
+
exports["default"] = _default;
|
|
63
|
+
//# sourceMappingURL=keyboardFocusEnhance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyboardFocusEnhance.js","names":["_react","_interopRequireDefault","require","_assignProps","_LastInteractionType","enforcedKeyboardFocusEnhanceContext","React","createContext","exports","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';\nimport assignProps from '../assignProps';\nimport { UnknownProperties } from '../../core-types/UnknownProperties';\nimport { lastInteraction } from '../../LastInteractionType';\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;AACA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,oBAAA,GAAAF,OAAA;AAcO,IAAMG,mCAAmC,gBAAGC,iBAAK,CAACC,aAAa,CAAC,KAAK,CAAC;AAACC,OAAA,CAAAH,mCAAA,GAAAA,mCAAA;AAc9E,IAAMI,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,GAA8Cd,iBAAK,CAACe,QAAQ,CAAC,KAAK,CAAC;MAAAC,gBAAA,OAAAC,eAAA,aAAAH,eAAA;MAA5DI,eAAe,GAAAF,gBAAA;MAAEG,kBAAkB,GAAAH,gBAAA;IAC1C,IAAMI,GAAG,GAAGpB,iBAAK,CAACqB,MAAM,CAAc,IAAI,CAAC;IAE3C,IAAMC,WAAW,GAAGtB,iBAAK,CAACuB,WAAW,CAAC,UAACC,KAAuB,EAAK;MACjE,IAAIA,KAAK,CAAC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,QAAA,GAEatC,oBAAoB;AAAAD,OAAA,cAAAuC,QAAA"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import assignProps from "../assignProps.mjs";
|
|
4
|
+
import { lastInteraction } from "../../LastInteractionType.mjs";
|
|
5
|
+
|
|
6
|
+
/** @deprecated */
|
|
7
|
+
|
|
8
|
+
export var enforcedKeyboardFocusEnhanceContext = /*#__PURE__*/React.createContext(false);
|
|
9
|
+
var keyboardFocusEnhance = function keyboardFocusEnhance() {
|
|
10
|
+
var makeFocusable = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
11
|
+
return function (props) {
|
|
12
|
+
var _props$tabIndex;
|
|
13
|
+
var autoFocus = props.autoFocus;
|
|
14
|
+
var disabled = props.disabled || props.loading;
|
|
15
|
+
var tabIndex = (_props$tabIndex = props.tabIndex) !== null && _props$tabIndex !== void 0 ? _props$tabIndex : makeFocusable ? 0 : undefined;
|
|
16
|
+
var _React$useState = React.useState(false),
|
|
17
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
18
|
+
keyboardFocused = _React$useState2[0],
|
|
19
|
+
setKeyboardFocused = _React$useState2[1];
|
|
20
|
+
var ref = React.useRef(null);
|
|
21
|
+
var handleFocus = React.useCallback(function (event) {
|
|
22
|
+
if (event.isTrusted === true) {
|
|
23
|
+
if (!lastInteraction.isKeyboard()) return;
|
|
24
|
+
}
|
|
25
|
+
setKeyboardFocused(true);
|
|
26
|
+
}, []);
|
|
27
|
+
var handlerBlur = React.useCallback(function () {
|
|
28
|
+
return setKeyboardFocused(false);
|
|
29
|
+
}, []);
|
|
30
|
+
React.useEffect(function () {
|
|
31
|
+
if (typeof autoFocus !== 'number' && !autoFocus) return;
|
|
32
|
+
var timer = setTimeout(function () {
|
|
33
|
+
var _ref$current;
|
|
34
|
+
(_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
|
|
35
|
+
setKeyboardFocused(true);
|
|
36
|
+
}, 0);
|
|
37
|
+
return function () {
|
|
38
|
+
clearTimeout(timer);
|
|
39
|
+
};
|
|
40
|
+
}, [autoFocus]);
|
|
41
|
+
React.useEffect(function () {
|
|
42
|
+
if (disabled) {
|
|
43
|
+
setKeyboardFocused(false);
|
|
44
|
+
}
|
|
45
|
+
}, [disabled]);
|
|
46
|
+
var enforcedKeyboardFocus = React.useContext(enforcedKeyboardFocusEnhanceContext);
|
|
47
|
+
return assignProps(props, {
|
|
48
|
+
tabIndex: disabled ? -1 : tabIndex,
|
|
49
|
+
keyboardFocused: (keyboardFocused || enforcedKeyboardFocus) && !disabled,
|
|
50
|
+
onFocus: handleFocus,
|
|
51
|
+
onBlur: handlerBlur,
|
|
52
|
+
ref: ref
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
export default keyboardFocusEnhance;
|
|
57
|
+
//# sourceMappingURL=keyboardFocusEnhance.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyboardFocusEnhance.mjs","names":["React","assignProps","lastInteraction","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';\nimport assignProps from '../assignProps';\nimport { UnknownProperties } from '../../core-types/UnknownProperties';\nimport { lastInteraction } from '../../LastInteractionType';\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;AACzB,OAAOC,WAAW,MAAM,oBAAgB;AAExC,SAASC,eAAe,QAAQ,+BAA2B;;AAE3D;;AAYA,OAAO,IAAMC,mCAAmC,gBAAGH,KAAK,CAAC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AA,IAAAC,YAAA;QAC7B,CAAAA,YAAA,GAAAX,GAAG,CAACY,OAAO,cAAAD,YAAA,uBAAXA,YAAA,CAAaE,KAAK,EAAE;QACpBd,kBAAkB,CAAC,IAAI,CAAC;MAC1B,CAAC,EAAE,CAAC,CAAC;MACL,OAAO,YAAM;QACXe,YAAY,CAACL,KAAK,CAAC;MACrB,CAAC;IACH,CAAC,EAAE,CAACnB,SAAS,CAAC,CAAC;IACfZ,KAAK,CAAC8B,SAAS,CAAC,YAAM;MACpB,IAAIjB,QAAQ,EAAE;QACZQ,kBAAkB,CAAC,KAAK,CAAC;MAC3B;IACF,CAAC,EAAE,CAACR,QAAQ,CAAC,CAAC;IAEd,IAAMwB,qBAAqB,GAAGrC,KAAK,CAACsC,UAAU,CAACnC,mCAAmC,CAAC;IAEnF,OAAOF,WAAW,CAACS,KAAK,EAAE;MACxBK,QAAQ,EAAEF,QAAQ,GAAG,CAAC,CAAC,GAAGE,QAAQ;MAClCK,eAAe,EAAE,CAACA,eAAe,IAAIiB,qBAAqB,KAAK,CAACxB,QAAQ;MACxE0B,OAAO,EAAEf,WAAW;MACpBgB,MAAM,EAAEX,WAAW;MACnBP,GAAG,EAAHA;IACF,CAAC,CAAC;EACJ,CAAC;AACH,CAAC;AAED,eAAejB,oBAAoB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _useColorResolver = require("../use/useColorResolver");
|
|
10
|
+
var _ref = require("../ref");
|
|
11
|
+
var _assignProps = _interopRequireDefault(require("../assignProps"));
|
|
12
|
+
var resolveColorEnhance = function resolveColorEnhance() {
|
|
13
|
+
return function (props) {
|
|
14
|
+
var ref = props.ref;
|
|
15
|
+
var internalRef = _react["default"].useRef();
|
|
16
|
+
var resolveColor = (0, _useColorResolver.useColorResolver)();
|
|
17
|
+
return (0, _assignProps["default"])(props, {
|
|
18
|
+
ref: (0, _ref.useForkRef)(ref, internalRef),
|
|
19
|
+
resolveColor: resolveColor
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
var _default = resolveColorEnhance;
|
|
24
|
+
exports["default"] = _default;
|
|
25
|
+
//# sourceMappingURL=resolveColorEnhance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveColorEnhance.js","names":["_react","_interopRequireDefault","require","_useColorResolver","_ref","_assignProps","resolveColorEnhance","props","ref","internalRef","React","useRef","resolveColor","useColorResolver","assignProps","useForkRef","_default","exports"],"sources":["../../../src/utils/enhances/resolveColorEnhance.tsx"],"sourcesContent":["import React from 'react';\nimport { useColorResolver } from '../use/useColorResolver';\nimport { useForkRef } from '../ref';\nimport assignProps from '../assignProps';\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;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAJ,sBAAA,CAAAC,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,EAAe;IAC/C,IAAMC,YAAY,GAAG,IAAAC,kCAAgB,GAAE;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,GAEaV,mBAAmB;AAAAW,OAAA,cAAAD,QAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useColorResolver } from "../use/useColorResolver.mjs";
|
|
3
|
+
import { useForkRef } from "../ref.mjs";
|
|
4
|
+
import assignProps from "../assignProps.mjs";
|
|
5
|
+
var resolveColorEnhance = function resolveColorEnhance() {
|
|
6
|
+
return function (props) {
|
|
7
|
+
var ref = props.ref;
|
|
8
|
+
var internalRef = React.useRef();
|
|
9
|
+
var resolveColor = useColorResolver();
|
|
10
|
+
return assignProps(props, {
|
|
11
|
+
ref: useForkRef(ref, internalRef),
|
|
12
|
+
resolveColor: resolveColor
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export default resolveColorEnhance;
|
|
17
|
+
//# sourceMappingURL=resolveColorEnhance.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveColorEnhance.mjs","names":["React","useColorResolver","useForkRef","assignProps","resolveColorEnhance","props","ref","internalRef","useRef","resolveColor"],"sources":["../../../src/utils/enhances/resolveColorEnhance.tsx"],"sourcesContent":["import React from 'react';\nimport { useColorResolver } from '../use/useColorResolver';\nimport { useForkRef } from '../ref';\nimport assignProps from '../assignProps';\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;AACzB,SAASC,gBAAgB,QAAQ,6BAAyB;AAC1D,SAASC,UAAU,QAAQ,YAAQ;AACnC,OAAOC,WAAW,MAAM,oBAAgB;AAExC,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,EAAe;IAC/C,IAAMC,YAAY,GAAGR,gBAAgB,EAAE;IAEvC,OAAOE,WAAW,CAACE,KAAK,EAAE;MACxBC,GAAG,EAAEJ,UAAU,CAACI,GAAG,EAAEC,WAAW,CAAC;MACjCE,YAAY,EAAZA;IACF,CAAC,CAAC;EACJ,CAAC;AACH,CAAC;AAED,eAAeL,mBAAmB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type DefaultEmit = (eventName: string, ...args: any[]) => void;
|
|
2
|
+
type DefaultSubscribe = (eventName: string, fn: any) => () => void;
|
|
3
|
+
export default class EventEmitter<Emit = DefaultEmit, Subscribe = DefaultSubscribe> {
|
|
4
|
+
private events;
|
|
5
|
+
constructor();
|
|
6
|
+
emit: Emit;
|
|
7
|
+
subscribe: Subscribe;
|
|
8
|
+
}
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
9
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var EventEmitter = /*#__PURE__*/(0, _createClass2["default"])(function EventEmitter() {
|
|
12
|
+
var _this = this;
|
|
13
|
+
(0, _classCallCheck2["default"])(this, EventEmitter);
|
|
14
|
+
(0, _defineProperty2["default"])(this, "events", {});
|
|
15
|
+
(0, _defineProperty2["default"])(this, "emit", void 0);
|
|
16
|
+
(0, _defineProperty2["default"])(this, "subscribe", void 0);
|
|
17
|
+
this.emit = function (eventName) {
|
|
18
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
19
|
+
args[_key - 1] = arguments[_key];
|
|
20
|
+
}
|
|
21
|
+
var event = _this.events[eventName];
|
|
22
|
+
if (event) {
|
|
23
|
+
event.forEach(function (fn) {
|
|
24
|
+
fn.call.apply(fn, [null].concat(args));
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
this.subscribe = function (eventName, fn) {
|
|
29
|
+
if (!_this.events[eventName]) {
|
|
30
|
+
_this.events[eventName] = [];
|
|
31
|
+
}
|
|
32
|
+
_this.events[eventName].push(fn);
|
|
33
|
+
return function () {
|
|
34
|
+
_this.events[eventName] = _this.events[eventName].filter(function (eventFn) {
|
|
35
|
+
return fn !== eventFn;
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
exports["default"] = EventEmitter;
|
|
41
|
+
//# sourceMappingURL=eventEmitter.js.map
|
|
@@ -0,0 +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","exports"],"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,oBAAAC,aAAA,aAE/B,SAAAD,aAAA,EAAc;EAAA,IAAAE,KAAA;EAAA,IAAAC,gBAAA,mBAAAH,YAAA;EAAA,IAAAI,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;AAAAC,OAAA,cAAAxB,YAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
var EventEmitter = /*#__PURE__*/_createClass(function EventEmitter() {
|
|
5
|
+
var _this = this;
|
|
6
|
+
_classCallCheck(this, EventEmitter);
|
|
7
|
+
_defineProperty(this, "events", {});
|
|
8
|
+
_defineProperty(this, "emit", void 0);
|
|
9
|
+
_defineProperty(this, "subscribe", void 0);
|
|
10
|
+
this.emit = function (eventName) {
|
|
11
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
12
|
+
args[_key - 1] = arguments[_key];
|
|
13
|
+
}
|
|
14
|
+
var event = _this.events[eventName];
|
|
15
|
+
if (event) {
|
|
16
|
+
event.forEach(function (fn) {
|
|
17
|
+
fn.call.apply(fn, [null].concat(args));
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
this.subscribe = function (eventName, fn) {
|
|
22
|
+
if (!_this.events[eventName]) {
|
|
23
|
+
_this.events[eventName] = [];
|
|
24
|
+
}
|
|
25
|
+
_this.events[eventName].push(fn);
|
|
26
|
+
return function () {
|
|
27
|
+
_this.events[eventName] = _this.events[eventName].filter(function (eventFn) {
|
|
28
|
+
return fn !== eventFn;
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
export { EventEmitter as default };
|
|
34
|
+
//# sourceMappingURL=eventEmitter.mjs.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactElement, ReactNode, MutableRefObject } from 'react';
|
|
2
|
+
declare function findComponent(Children: any, names: string[], recursively?: boolean, limit?: number): Exclude<ReactNode, boolean | null | undefined> | undefined;
|
|
3
|
+
export declare function isAdvanceMode(Children: any, name: string[], recursively?: boolean): boolean;
|
|
4
|
+
type IntergalacticComponent = ReactElement & {
|
|
5
|
+
ref?: MutableRefObject<HTMLElement>;
|
|
6
|
+
};
|
|
7
|
+
export declare function findAllComponents(Children: any, names: string[]): IntergalacticComponent[];
|
|
8
|
+
/**
|
|
9
|
+
* Extract some components from Children and return them and rest of components as tuple.
|
|
10
|
+
*/
|
|
11
|
+
export declare function extractFrom(Children: any, names: string[]): IntergalacticComponent[][];
|
|
12
|
+
export default findComponent;
|