@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,47 @@
|
|
|
1
|
+
function arraysEqual(a, b) {
|
|
2
|
+
if (a.length !== b.length) return false;
|
|
3
|
+
for (var i = 0; i < a.length; i++) {
|
|
4
|
+
if (a[i] !== b[i]) return false;
|
|
5
|
+
}
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
function handlerBinder(fn) {
|
|
9
|
+
return function () {
|
|
10
|
+
for (var _len = arguments.length, depsArgs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
11
|
+
depsArgs[_key] = arguments[_key];
|
|
12
|
+
}
|
|
13
|
+
var memoizeds = [];
|
|
14
|
+
if (handlerBinder.hasher.has(fn)) {
|
|
15
|
+
memoizeds = handlerBinder.hasher.get(fn);
|
|
16
|
+
var memoized = memoizeds.find(function (memoized) {
|
|
17
|
+
return arraysEqual(memoized.deps, depsArgs);
|
|
18
|
+
});
|
|
19
|
+
if (memoized) return memoized.fn;
|
|
20
|
+
}
|
|
21
|
+
var bindFn = fn.apply(void 0, depsArgs).bind(fn);
|
|
22
|
+
memoizeds.push({
|
|
23
|
+
deps: depsArgs,
|
|
24
|
+
fn: bindFn
|
|
25
|
+
});
|
|
26
|
+
handlerBinder.hasher.set(fn, memoizeds);
|
|
27
|
+
return bindFn;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
handlerBinder.hasher = new WeakMap();
|
|
31
|
+
function Enhancement() {
|
|
32
|
+
return {
|
|
33
|
+
condition: function condition(Component, isFunction) {
|
|
34
|
+
return !isFunction;
|
|
35
|
+
},
|
|
36
|
+
init: function init() {
|
|
37
|
+
var _this = this;
|
|
38
|
+
Object.keys(this).filter(function (field) {
|
|
39
|
+
return field.startsWith('bindHandler');
|
|
40
|
+
}).forEach(function (name) {
|
|
41
|
+
_this[name] = handlerBinder(_this[name].bind(_this));
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export default Enhancement;
|
|
47
|
+
//# sourceMappingURL=bindHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bindHandler.js","names":["arraysEqual","a","b","length","i","handlerBinder","fn","_len","arguments","depsArgs","Array","_key","memoizeds","hasher","has","get","memoized","find","deps","bindFn","apply","bind","push","set","WeakMap","Enhancement","condition","Component","isFunction","init","_this","Object","keys","filter","field","startsWith","forEach","name"],"sources":["../../../src/enhancement/bindHandler.tsx"],"sourcesContent":["function arraysEqual(a: any, b: any) {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n}\n\nfunction handlerBinder(fn: any) {\n return function (...depsArgs: any[]) {\n let memoizeds = [];\n if (handlerBinder.hasher.has(fn)) {\n memoizeds = handlerBinder.hasher.get(fn);\n const memoized = memoizeds.find((memoized: any) => arraysEqual(memoized.deps, depsArgs));\n if (memoized) return memoized.fn;\n }\n\n const bindFn = fn(...depsArgs).bind(fn);\n memoizeds.push({\n deps: depsArgs,\n fn: bindFn,\n });\n handlerBinder.hasher.set(fn, memoizeds);\n return bindFn;\n };\n}\n\nhandlerBinder.hasher = new WeakMap();\n\nfunction Enhancement() {\n return {\n condition: function (Component: any, isFunction: boolean) {\n return !isFunction;\n },\n init: function (this: any) {\n Object.keys(this)\n .filter((field) => field.startsWith('bindHandler'))\n .forEach((name) => {\n this[name] = handlerBinder(this[name].bind(this));\n });\n },\n };\n}\n\nexport default Enhancement;\n"],"mappings":"AAAA,SAASA,WAAWA,CAACC,CAAM,EAAEC,CAAM,EAAE;EACnC,IAAID,CAAC,CAACE,MAAM,KAAKD,CAAC,CAACC,MAAM,EAAE,OAAO,KAAK;EACvC,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,CAAC,CAACE,MAAM,EAAEC,CAAC,EAAE,EAAE;IACjC,IAAIH,CAAC,CAACG,CAAC,CAAC,KAAKF,CAAC,CAACE,CAAC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BC,MAAM,CAACC,IAAI,CAAC,IAAI,CAAC,CACdC,MAAM,CAAC,UAACC,KAAK;QAAA,OAAKA,KAAK,CAACC,UAAU,CAAC,aAAa,CAAC;MAAA,EAAC,CAClDC,OAAO,CAAC,UAACC,IAAI,EAAK;QACjBP,KAAI,CAACO,IAAI,CAAC,GAAGhC,aAAa,CAACyB,KAAI,CAACO,IAAI,CAAC,CAAChB,IAAI,CAACS,KAAI,CAAC,CAAC;MACnD,CAAC,CAAC;IACN;EACF,CAAC;AACH;AAEA,eAAeL,WAAW"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
+
function Enhancement() {
|
|
3
|
+
return {
|
|
4
|
+
wrapperProps: function wrapperProps(props, WrapperComponent) {
|
|
5
|
+
return _objectSpread({
|
|
6
|
+
'data-ui-name': WrapperComponent.displayName
|
|
7
|
+
}, props);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export default Enhancement;
|
|
12
|
+
//# sourceMappingURL=dataName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataName.js","names":["Enhancement","wrapperProps","props","WrapperComponent","_objectSpread","displayName"],"sources":["../../../src/enhancement/dataName.tsx"],"sourcesContent":["function Enhancement() {\n return {\n wrapperProps: function (props: any, WrapperComponent: any) {\n return {\n 'data-ui-name': WrapperComponent.displayName,\n ...props,\n };\n },\n };\n}\n\nexport default Enhancement;\n"],"mappings":";AAAA,SAASA,WAAWA,CAAA,EAAG;EACrB,OAAO;IACLC,YAAY,EAAE,SAAAA,aAAUC,KAAU,EAAEC,gBAAqB,EAAE;MACzD,OAAAC,aAAA;QACE,cAAc,EAAED,gBAAgB,CAACE;MAAW,GACzCH,KAAK;IAEZ;EACF,CAAC;AACH;AAEA,eAAeF,WAAW"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
function Enhancement() {
|
|
2
|
+
return {
|
|
3
|
+
condition: function condition(Component) {
|
|
4
|
+
var _Component$enhance;
|
|
5
|
+
return Boolean((_Component$enhance = Component.enhance) === null || _Component$enhance === void 0 ? void 0 : _Component$enhance.length);
|
|
6
|
+
},
|
|
7
|
+
wrapperProps: function wrapperProps(props, WrapperComponent) {
|
|
8
|
+
return WrapperComponent.enhance.reduce(function (acc, enhance) {
|
|
9
|
+
return enhance(acc);
|
|
10
|
+
}, props);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export default Enhancement;
|
|
15
|
+
//# sourceMappingURL=enhance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enhance.js","names":["Enhancement","condition","Component","_Component$enhance","Boolean","enhance","length","wrapperProps","props","WrapperComponent","reduce","acc"],"sources":["../../../src/enhancement/enhance.tsx"],"sourcesContent":["function Enhancement() {\n return {\n condition: function (Component: any) {\n return Boolean(Component.enhance?.length);\n },\n wrapperProps: function (props: any, WrapperComponent: any) {\n return WrapperComponent.enhance.reduce((acc: any, enhance: any) => enhance(acc), props);\n },\n };\n}\n\nexport default Enhancement;\n"],"mappings":"AAAA,SAASA,WAAWA,CAAA,EAAG;EACrB,OAAO;IACLC,SAAS,EAAE,SAAAA,UAAUC,SAAc,EAAE;MAAA,IAAAC,kBAAA;MACnC,OAAOC,OAAO,EAAAD,kBAAA,GAACD,SAAS,CAACG,OAAO,cAAAF,kBAAA,uBAAjBA,kBAAA,CAAmBG,MAAM,CAAC;IAC3C,CAAC;IACDC,YAAY,EAAE,SAAAA,aAAUC,KAAU,EAAEC,gBAAqB,EAAE;MACzD,OAAOA,gBAAgB,CAACJ,OAAO,CAACK,MAAM,CAAC,UAACC,GAAQ,EAAEN,OAAY;QAAA,OAAKA,OAAO,CAACM,GAAG,CAAC;MAAA,GAAEH,KAAK,CAAC;IACzF;EACF,CAAC;AACH;AAEA,eAAeR,WAAW"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
function Enhancement() {
|
|
2
|
+
var defaultProps = {};
|
|
3
|
+
return {
|
|
4
|
+
condition: function condition(Component) {
|
|
5
|
+
if (!Component.defaultProps) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
if (typeof Component.defaultProps === 'function') {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
return Boolean(Object.keys(Component.defaultProps).length);
|
|
12
|
+
},
|
|
13
|
+
"static": function _static(WrapperComponent) {
|
|
14
|
+
defaultProps = WrapperComponent.defaultProps;
|
|
15
|
+
return {
|
|
16
|
+
defaultProps: {}
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
wrapperProps: function wrapperProps(props) {
|
|
20
|
+
if (typeof defaultProps === 'function') {
|
|
21
|
+
// TODO: optimization
|
|
22
|
+
return Object.assign({}, defaultProps(props), props);
|
|
23
|
+
}
|
|
24
|
+
return Object.assign({}, defaultProps, props);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export default Enhancement;
|
|
29
|
+
//# sourceMappingURL=functionDefaultProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functionDefaultProps.js","names":["Enhancement","defaultProps","condition","Component","Boolean","Object","keys","length","_static","WrapperComponent","wrapperProps","props","assign"],"sources":["../../../src/enhancement/functionDefaultProps.tsx"],"sourcesContent":["function Enhancement() {\n let defaultProps = {};\n return {\n condition: function (Component: any) {\n if (!Component.defaultProps) {\n return false;\n }\n if (typeof Component.defaultProps === 'function') {\n return true;\n }\n return Boolean(Object.keys(Component.defaultProps).length);\n },\n static: function (WrapperComponent: any) {\n defaultProps = WrapperComponent.defaultProps;\n return {\n defaultProps: {},\n };\n },\n wrapperProps: function (props: any) {\n if (typeof defaultProps === 'function') {\n // TODO: optimization\n return Object.assign({}, defaultProps(props), props);\n }\n return Object.assign({}, defaultProps, props);\n },\n };\n}\n\nexport default Enhancement;\n"],"mappings":"AAAA,SAASA,WAAWA,CAAA,EAAG;EACrB,IAAIC,YAAY,GAAG,CAAC,CAAC;EACrB,OAAO;IACLC,SAAS,EAAE,SAAAA,UAAUC,SAAc,EAAE;MACnC,IAAI,CAACA,SAAS,CAACF,YAAY,EAAE;QAC3B,OAAO,KAAK;MACd;MACA,IAAI,OAAOE,SAAS,CAACF,YAAY,KAAK,UAAU,EAAE;QAChD,OAAO,IAAI;MACb;MACA,OAAOG,OAAO,CAACC,MAAM,CAACC,IAAI,CAACH,SAAS,CAACF,YAAY,CAAC,CAACM,MAAM,CAAC;IAC5D,CAAC;IACD,UAAQ,SAAAC,QAAUC,gBAAqB,EAAE;MACvCR,YAAY,GAAGQ,gBAAgB,CAACR,YAAY;MAC5C,OAAO;QACLA,YAAY,EAAE,CAAC;MACjB,CAAC;IACH,CAAC;IACDS,YAAY,EAAE,SAAAA,aAAUC,KAAU,EAAE;MAClC,IAAI,OAAOV,YAAY,KAAK,UAAU,EAAE;QACtC;QACA,OAAOI,MAAM,CAACO,MAAM,CAAC,CAAC,CAAC,EAAEX,YAAY,CAACU,KAAK,CAAC,EAAEA,KAAK,CAAC;MACtD;MACA,OAAON,MAAM,CAACO,MAAM,CAAC,CAAC,CAAC,EAAEX,YAAY,EAAEU,KAAK,CAAC;IAC/C;EACF,CAAC;AACH;AAEA,eAAeX,WAAW"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
4
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import assignProps from '../utils/assignProps';
|
|
7
|
+
import useEnhancedEffect from '../utils/use/useEnhancedEffect';
|
|
8
|
+
import pick from '../utils/pick';
|
|
9
|
+
export var HOIST_CONTEXT = Symbol('HOIST_CONTEXT');
|
|
10
|
+
var HOIST_SELF = Symbol('HOIST_SELF');
|
|
11
|
+
var HOIST_SET = Symbol('HOIST_SET');
|
|
12
|
+
function flatChildComponent(childComponents) {
|
|
13
|
+
return Object.values(childComponents).reduce(function (acc, Component) {
|
|
14
|
+
if (Array.isArray(Component)) {
|
|
15
|
+
acc.push(Component[0]);
|
|
16
|
+
acc.push.apply(acc, _toConsumableArray(flatChildComponent(Component[1])));
|
|
17
|
+
} else {
|
|
18
|
+
acc.push(Component);
|
|
19
|
+
}
|
|
20
|
+
return acc;
|
|
21
|
+
}, []);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** @deprecated Doesn't work in ssr and sometimes breakes rulles of hooks. We should never use it. */
|
|
25
|
+
function Enhancement(childComponents, Context) {
|
|
26
|
+
return {
|
|
27
|
+
condition: function condition(Component) {
|
|
28
|
+
return [Component].concat(_toConsumableArray(flatChildComponent(childComponents))).some(function (Component) {
|
|
29
|
+
var _Component$hoistProps;
|
|
30
|
+
return Boolean((_Component$hoistProps = Component.hoistProps) === null || _Component$hoistProps === void 0 ? void 0 : _Component$hoistProps.length);
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
init: function init(props, WrapperComponent, isFunction) {
|
|
34
|
+
var _this = this;
|
|
35
|
+
if (isFunction) {
|
|
36
|
+
// TODO: might breake rules of hooks (by lsroman)
|
|
37
|
+
this[HOIST_SELF] = React.useState({});
|
|
38
|
+
} else {
|
|
39
|
+
this[HOIST_SELF] = [{}, function (obj) {
|
|
40
|
+
_this[HOIST_SELF][0] = obj;
|
|
41
|
+
_this.forceUpdate();
|
|
42
|
+
}];
|
|
43
|
+
}
|
|
44
|
+
// For optimization render
|
|
45
|
+
this[HOIST_SET] = function (obj) {
|
|
46
|
+
_this[HOIST_SELF][1](obj);
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
context: function context(_context) {
|
|
50
|
+
// TODO: need to optimizte container initialization (by lsroman)
|
|
51
|
+
// WrapperComponent.hoistProps
|
|
52
|
+
return _objectSpread(_objectSpread({}, _context), {}, _defineProperty({}, HOIST_CONTEXT, this[HOIST_SET]));
|
|
53
|
+
},
|
|
54
|
+
asProps: function asProps(props) {
|
|
55
|
+
// TODO: need to check for no props overwriting (by lsroman)
|
|
56
|
+
return assignProps(this[HOIST_SELF][0], props);
|
|
57
|
+
},
|
|
58
|
+
wrapperProps: function wrapperProps(props, WrapperComponent) {
|
|
59
|
+
var _WrapperComponent$hoi;
|
|
60
|
+
if ((_WrapperComponent$hoi = WrapperComponent.hoistProps) !== null && _WrapperComponent$hoi !== void 0 && _WrapperComponent$hoi.length) {
|
|
61
|
+
var context = React.useContext(Context);
|
|
62
|
+
var renameProps = WrapperComponent.hoistProps.reduce(function (acc, propName) {
|
|
63
|
+
var _propName$split = propName.split(':'),
|
|
64
|
+
_propName$split2 = _slicedToArray(_propName$split, 2),
|
|
65
|
+
name = _propName$split2[0],
|
|
66
|
+
rename = _propName$split2[1];
|
|
67
|
+
acc[name] = rename || name;
|
|
68
|
+
return acc;
|
|
69
|
+
}, {});
|
|
70
|
+
var hoistProps = Object.entries(pick(props, Object.keys(renameProps))).reduce(function (acc, _ref) {
|
|
71
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
72
|
+
name = _ref2[0],
|
|
73
|
+
value = _ref2[1];
|
|
74
|
+
acc[renameProps[name]] = value;
|
|
75
|
+
return acc;
|
|
76
|
+
}, {});
|
|
77
|
+
useEnhancedEffect(function () {
|
|
78
|
+
if (context[HOIST_CONTEXT]) {
|
|
79
|
+
context[HOIST_CONTEXT](hoistProps);
|
|
80
|
+
}
|
|
81
|
+
}, Object.values(hoistProps));
|
|
82
|
+
}
|
|
83
|
+
return props;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export default Enhancement;
|
|
88
|
+
//# sourceMappingURL=hoistProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hoistProps.js","names":["React","assignProps","useEnhancedEffect","pick","HOIST_CONTEXT","Symbol","HOIST_SELF","HOIST_SET","flatChildComponent","childComponents","Object","values","reduce","acc","Component","Array","isArray","push","apply","_toConsumableArray","Enhancement","Context","condition","concat","some","_Component$hoistProps","Boolean","hoistProps","length","init","props","WrapperComponent","isFunction","_this","useState","obj","forceUpdate","context","_objectSpread","_defineProperty","asProps","wrapperProps","_WrapperComponent$hoi","useContext","renameProps","propName","_propName$split","split","_propName$split2","_slicedToArray","name","rename","entries","keys","_ref","_ref2","value"],"sources":["../../../src/enhancement/hoistProps.tsx"],"sourcesContent":["import React from 'react';\nimport assignProps from '../utils/assignProps';\nimport useEnhancedEffect from '../utils/use/useEnhancedEffect';\nimport pick from '../utils/pick';\n\nexport const HOIST_CONTEXT = Symbol('HOIST_CONTEXT');\nconst HOIST_SELF = Symbol('HOIST_SELF');\nconst HOIST_SET = Symbol('HOIST_SET');\n\nfunction flatChildComponent(childComponents: any) {\n return Object.values(childComponents).reduce<unknown[]>((acc, Component) => {\n if (Array.isArray(Component)) {\n acc.push(Component[0]);\n acc.push(...flatChildComponent(Component[1]));\n } else {\n acc.push(Component);\n }\n return acc;\n }, []);\n}\n\n/** @deprecated Doesn't work in ssr and sometimes breakes rulles of hooks. We should never use it. */\nfunction Enhancement(childComponents: any, Context: any) {\n return {\n condition: function (Component: any) {\n return [Component, ...flatChildComponent(childComponents)].some((Component) =>\n Boolean(Component.hoistProps?.length),\n );\n },\n init: function (this: any, props: any, WrapperComponent: any, isFunction: boolean) {\n if (isFunction) {\n // TODO: might breake rules of hooks (by lsroman)\n this[HOIST_SELF] = React.useState({});\n } else {\n this[HOIST_SELF] = [\n {},\n (obj: any) => {\n this[HOIST_SELF][0] = obj;\n this.forceUpdate();\n },\n ];\n }\n // For optimization render\n this[HOIST_SET] = (obj: any) => {\n this[HOIST_SELF][1](obj);\n };\n },\n context: function (this: any, context: any) {\n // TODO: need to optimizte container initialization (by lsroman)\n // WrapperComponent.hoistProps\n return {\n ...context,\n [HOIST_CONTEXT]: this[HOIST_SET],\n };\n },\n asProps: function (this: any, props: any) {\n // TODO: need to check for no props overwriting (by lsroman)\n return assignProps(this[HOIST_SELF][0], props);\n },\n wrapperProps: function (props: any, WrapperComponent: any) {\n if (WrapperComponent.hoistProps?.length) {\n const context: any = React.useContext(Context);\n const renameProps: any = WrapperComponent.hoistProps.reduce((acc: any, propName: any) => {\n const [name, rename] = propName.split(':');\n acc[name] = rename || name;\n return acc;\n }, {});\n const hoistProps = Object.entries(pick(props, Object.keys(renameProps))).reduce(\n (acc: any, [name, value]) => {\n acc[renameProps[name]] = value;\n return acc;\n },\n {},\n );\n\n useEnhancedEffect(() => {\n if (context[HOIST_CONTEXT]) {\n context[HOIST_CONTEXT](hoistProps);\n }\n }, Object.values(hoistProps));\n }\n return props;\n },\n };\n}\n\nexport default Enhancement;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,WAAW,MAAM,sBAAsB;AAC9C,OAAOC,iBAAiB,MAAM,gCAAgC;AAC9D,OAAOC,IAAI,MAAM,eAAe;AAEhC,OAAO,IAAMC,aAAa,GAAGC,MAAM,CAAC,eAAe,CAAC;AACpD,IAAMC,UAAU,GAAGD,MAAM,CAAC,YAAY,CAAC;AACvC,IAAME,SAAS,GAAGF,MAAM,CAAC,WAAW,CAAC;AAErC,SAASG,kBAAkBA,CAACC,eAAoB,EAAE;EAChD,OAAOC,MAAM,CAACC,MAAM,CAACF,eAAe,CAAC,CAACG,MAAM,CAAY,UAACC,GAAG,EAAEC,SAAS,EAAK;IAC1E,IAAIC,KAAK,CAACC,OAAO,CAACF,SAAS,CAAC,EAAE;MAC5BD,GAAG,CAACI,IAAI,CAACH,SAAS,CAAC,CAAC,CAAC,CAAC;MACtBD,GAAG,CAACI,IAAI,CAAAC,KAAA,CAARL,GAAG,EAAAM,kBAAA,CAASX,kBAAkB,CAACM,SAAS,CAAC,CAAC,CAAC,CAAC,EAAC;IAC/C,CAAC,MAAM;MACLD,GAAG,CAACI,IAAI,CAACH,SAAS,C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C,EAAE;YAC1BiC,OAAO,CAACjC,aAAa,CAAC,CAACuB,UAAU,CAAC;UACpC;QACF,CAAC,EAAEjB,MAAM,CAACC,MAAM,CAACgB,UAAU,CAAC,CAAC;MAC/B;MACA,OAAOG,KAAK;IACd;EACF,CAAC;AACH;AAEA,eAAeV,WAAW"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["locale"];
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { Context } from '../utils/enhances/WithI18n';
|
|
6
|
+
function i18nAppLocaleEnhance() {
|
|
7
|
+
return {
|
|
8
|
+
wrapperProps: function wrapperProps(props) {
|
|
9
|
+
var locale = props.locale,
|
|
10
|
+
other = _objectWithoutProperties(props, _excluded);
|
|
11
|
+
var contextLocale = React.useContext(Context);
|
|
12
|
+
if (!locale && !contextLocale) return props;
|
|
13
|
+
return _objectSpread(_objectSpread({}, other), {}, {
|
|
14
|
+
locale: locale !== null && locale !== void 0 ? locale : contextLocale
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export default i18nAppLocaleEnhance;
|
|
20
|
+
//# sourceMappingURL=i18n.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.js","names":["React","Context","i18nAppLocaleEnhance","wrapperProps","props","locale","other","_objectWithoutProperties","_excluded","contextLocale","useContext","_objectSpread"],"sources":["../../../src/enhancement/i18n.tsx"],"sourcesContent":["import React from 'react';\nimport { Context } from '../utils/enhances/WithI18n';\n\nfunction i18nAppLocaleEnhance() {\n return {\n wrapperProps: (props: any) => {\n const { locale, ...other } = props;\n const contextLocale = React.useContext(Context);\n if (!locale && !contextLocale) return props;\n return {\n ...other,\n locale: locale ?? contextLocale,\n };\n },\n };\n}\n\nexport default i18nAppLocaleEnhance;\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,OAAO,QAAQ,4BAA4B;AAEpD,SAASC,oBAAoBA,CAAA,EAAG;EAC9B,OAAO;IACLC,YAAY,EAAE,SAAAA,aAACC,KAAU,EAAK;MAC5B,IAAQC,MAAM,GAAeD,KAAK,CAA1BC,MAAM;QAAKC,KAAK,GAAAC,wBAAA,CAAKH,KAAK,EAAAI,SAAA;MAClC,IAAMC,aAAa,GAAGT,KAAK,CAACU,UAAU,CAACT,OAAO,CAAC;MAC/C,IAAI,CAACI,MAAM,IAAI,CAACI,aAAa,EAAE,OAAOL,KAAK;MAC3C,OAAAO,aAAA,CAAAA,aAAA,KACKL,KAAK;QACRD,MAAM,EAAEA,MAAM,aAANA,MAAM,cAANA,MAAM,GAAII;MAAa;IAEnC;EACF,CAAC;AACH;AAEA,eAAeP,oBAAoB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
+
import { INHERITED_NAME } from '../core-types/symbols';
|
|
4
|
+
function Enhancement() {
|
|
5
|
+
return {
|
|
6
|
+
condition: function condition(Component) {
|
|
7
|
+
return Boolean(Component.displayName);
|
|
8
|
+
},
|
|
9
|
+
"static": function _static(WrapperComponent) {
|
|
10
|
+
return _defineProperty({}, INHERITED_NAME, _toConsumableArray(new Set([].concat(_toConsumableArray(WrapperComponent[INHERITED_NAME] || []), [WrapperComponent.displayName]))));
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export default Enhancement;
|
|
15
|
+
//# sourceMappingURL=inheritedName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inheritedName.js","names":["INHERITED_NAME","Enhancement","condition","Component","Boolean","displayName","_static","WrapperComponent","_defineProperty","_toConsumableArray","Set","concat"],"sources":["../../../src/enhancement/inheritedName.tsx"],"sourcesContent":["import { INHERITED_NAME } from '../core-types/symbols';\n\nfunction Enhancement() {\n return {\n condition: function (Component: any) {\n return Boolean(Component.displayName);\n },\n static: function (WrapperComponent: any) {\n return {\n [INHERITED_NAME]: [\n ...new Set([...(WrapperComponent[INHERITED_NAME] || []), WrapperComponent.displayName]),\n ],\n };\n },\n };\n}\n\nexport default Enhancement;\n"],"mappings":";;AAAA,SAASA,cAAc,QAAQ,uBAAuB;AAEtD,SAASC,WAAWA,CAAA,EAAG;EACrB,OAAO;IACLC,SAAS,EAAE,SAAAA,UAAUC,SAAc,EAAE;MACnC,OAAOC,OAAO,CAACD,SAAS,CAACE,WAAW,CAAC;IACvC,CAAC;IACD,UAAQ,SAAAC,QAAUC,gBAAqB,EAAE;MACvC,OAAAC,eAAA,KACGR,cAAc,EAAAS,kBAAA,CACV,IAAIC,GAAG,IAAAC,MAAA,CAAAF,kBAAA,CAAMF,gBAAgB,CAACP,cAAc,CAAC,IAAI,EAAE,IAAGO,gBAAgB,CAACF,WAAW,GAAE;IAG7F;EACF,CAAC;AACH;AAEA,eAAeJ,WAAW"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import assignProps from '../utils/assignProps';
|
|
6
|
+
import pick from '../utils/pick';
|
|
7
|
+
import logger from '../utils/logger';
|
|
8
|
+
function assign(target, source) {
|
|
9
|
+
return Object.defineProperties(target, Object.keys(source).reduce(function (descriptors, key) {
|
|
10
|
+
descriptors[key] = Object.getOwnPropertyDescriptor(source, key);
|
|
11
|
+
return descriptors;
|
|
12
|
+
}, {}));
|
|
13
|
+
}
|
|
14
|
+
export function getterMethodName(name) {
|
|
15
|
+
return "get".concat(name, "Props");
|
|
16
|
+
}
|
|
17
|
+
export function getterMethodNameByDisplayName() {
|
|
18
|
+
var displayName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
19
|
+
var displayNames = displayName.split('.');
|
|
20
|
+
var name = displayNames.slice(-(displayNames.length - 1)).join('');
|
|
21
|
+
return getterMethodName(name);
|
|
22
|
+
}
|
|
23
|
+
function flatGetterMethodNames(childComponents, parentName) {
|
|
24
|
+
return Object.entries(childComponents).reduce(function (acc, _ref) {
|
|
25
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
26
|
+
name = _ref2[0],
|
|
27
|
+
value = _ref2[1];
|
|
28
|
+
if (Array.isArray(value)) {
|
|
29
|
+
acc.push.apply(acc, _toConsumableArray(flatGetterMethodNames(value[1], name)));
|
|
30
|
+
}
|
|
31
|
+
name = parentName ? "".concat(parentName).concat(name) : name;
|
|
32
|
+
acc.push(getterMethodName(name));
|
|
33
|
+
return acc;
|
|
34
|
+
}, []);
|
|
35
|
+
}
|
|
36
|
+
export var STATIC_COMPONENT = Symbol('STATIC_COMPONENT');
|
|
37
|
+
export var ROOT_COMPONENT = Symbol('ROOT_COMPONENT');
|
|
38
|
+
var SELF_GETTER_METHOD = Symbol('SELF_GETTER_METHOD');
|
|
39
|
+
function Enhancement(childComponents, createComponent, options) {
|
|
40
|
+
var getterMethodNames = flatGetterMethodNames(childComponents);
|
|
41
|
+
return {
|
|
42
|
+
condition: function condition(Component) {
|
|
43
|
+
return Boolean(Component[STATIC_COMPONENT] || Object.keys(childComponents).length);
|
|
44
|
+
},
|
|
45
|
+
init: function init(props, WrapperComponent) {
|
|
46
|
+
var _this = this;
|
|
47
|
+
var getterMethods = pick(this, getterMethodNames);
|
|
48
|
+
this[SELF_GETTER_METHOD] = function () {
|
|
49
|
+
var selfGetterMethod = getterMethodNameByDisplayName(WrapperComponent.displayName);
|
|
50
|
+
logger.warn(true, "Getter `".concat(selfGetterMethod, "` can't be fired as it is a getter of static component"), props['data-ui-name'] || WrapperComponent.displayName);
|
|
51
|
+
};
|
|
52
|
+
assign(this, getterMethodNames.reduce(function (acc, name) {
|
|
53
|
+
var getterMethod = getterMethods[name];
|
|
54
|
+
if (!getterMethod) return acc;
|
|
55
|
+
acc[name] = function () {
|
|
56
|
+
var childrenProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
57
|
+
var getterProps = getterMethod.call(_this, childrenProps, acc[name].index);
|
|
58
|
+
return assignProps(childrenProps, getterProps);
|
|
59
|
+
};
|
|
60
|
+
acc[name].index = -1;
|
|
61
|
+
acc[name].cache = new Set();
|
|
62
|
+
return acc;
|
|
63
|
+
}, {}));
|
|
64
|
+
},
|
|
65
|
+
"static": function _static(WrapperComponent, Component) {
|
|
66
|
+
if (Object.keys(childComponents).length && !WrapperComponent.displayName) {
|
|
67
|
+
throw new Error('"displayName" is not defined');
|
|
68
|
+
}
|
|
69
|
+
return Object.entries(childComponents).reduce(function (acc, _ref3) {
|
|
70
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
71
|
+
name = _ref4[0],
|
|
72
|
+
value = _ref4[1];
|
|
73
|
+
var childComponents = {};
|
|
74
|
+
if (Array.isArray(value)) {
|
|
75
|
+
childComponents = value[1];
|
|
76
|
+
value = value[0];
|
|
77
|
+
}
|
|
78
|
+
var prevStaticComponent = value[STATIC_COMPONENT];
|
|
79
|
+
// @ts-ignore
|
|
80
|
+
var prevDisplayName = value.displayName;
|
|
81
|
+
// @ts-ignore
|
|
82
|
+
value.displayName = "".concat(WrapperComponent.displayName, ".").concat(name);
|
|
83
|
+
value[STATIC_COMPONENT] = true;
|
|
84
|
+
value[ROOT_COMPONENT] = Component[ROOT_COMPONENT] || Component;
|
|
85
|
+
acc[name] = createComponent(value, childComponents, options);
|
|
86
|
+
// @ts-ignore
|
|
87
|
+
value.displayName = prevDisplayName;
|
|
88
|
+
value[STATIC_COMPONENT] = prevStaticComponent;
|
|
89
|
+
return acc;
|
|
90
|
+
}, {});
|
|
91
|
+
},
|
|
92
|
+
context: function context(_context) {
|
|
93
|
+
// const getterMethod = getterMethodNameByDisplayName(WrapperComponent.displayName);
|
|
94
|
+
return _objectSpread(_objectSpread({}, _context), pick(this, getterMethodNames));
|
|
95
|
+
},
|
|
96
|
+
wrapperProps: function wrapperProps(props, WrapperComponent) {
|
|
97
|
+
if (!WrapperComponent[STATIC_COMPONENT]) return props;
|
|
98
|
+
var context = React.useContext(options.context);
|
|
99
|
+
var getterMethod = context[getterMethodNameByDisplayName(WrapperComponent.displayName)];
|
|
100
|
+
if (getterMethod) {
|
|
101
|
+
if (!getterMethod.cache.has(this)) {
|
|
102
|
+
getterMethod.cache.add(this);
|
|
103
|
+
getterMethod.index++;
|
|
104
|
+
if (this) this.index = getterMethod.index;
|
|
105
|
+
}
|
|
106
|
+
if (this) getterMethod.index = this.index;
|
|
107
|
+
return getterMethod(props);
|
|
108
|
+
}
|
|
109
|
+
return props;
|
|
110
|
+
},
|
|
111
|
+
render: function render(_render) {
|
|
112
|
+
var _this2 = this;
|
|
113
|
+
getterMethodNames.forEach(function (name) {
|
|
114
|
+
if (_this2[name] === undefined) return;
|
|
115
|
+
_this2[name].index = -1;
|
|
116
|
+
_this2[name].cache.clear();
|
|
117
|
+
});
|
|
118
|
+
return _render;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
export default Enhancement;
|
|
123
|
+
//# sourceMappingURL=staticChildren.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"staticChildren.js","names":["React","assignProps","pick","logger","assign","target","source","Object","defineProperties","keys","reduce","descriptors","key","getOwnPropertyDescriptor","getterMethodName","name","concat","getterMethodNameByDisplayName","displayName","arguments","length","undefined","displayNames","split","slice","join","flatGetterMethodNames","childComponents","parentName","entries","acc","_ref","_ref2","_slicedToArray","value","Array","isArray","push","apply","_toConsumableArray","STATIC_COMPONENT","Symbol","ROOT_COMPONENT","SELF_GETTER_METHOD","Enhancement","createComponent","options","getterMethodNames","condition","Component","Boolean","init","props","WrapperComponent","_this","getterMethods","selfGetterMethod","warn","getterMethod","childrenProps","getterProps","call","index","cache","Set","_static","Error","_ref3","_ref4","prevStaticComponent","prevDisplayName","context","_objectSpread","wrapperProps","useContext","has","add","render","_this2","forEach","clear"],"sources":["../../../src/enhancement/staticChildren.tsx"],"sourcesContent":["import React from 'react';\nimport assignProps from '../utils/assignProps';\nimport pick from '../utils/pick';\nimport logger from '../utils/logger';\n\nfunction assign(target: any, source: any) {\n return Object.defineProperties(\n target,\n Object.keys(source).reduce((descriptors: any, key) => {\n descriptors[key] = Object.getOwnPropertyDescriptor(source, key);\n return descriptors;\n }, {}),\n );\n}\n\nexport function getterMethodName(name: string) {\n return `get${name}Props`;\n}\n\nexport function getterMethodNameByDisplayName(displayName = '') {\n const displayNames = displayName.split('.');\n const name = displayNames.slice(-(displayNames.length - 1)).join('');\n return getterMethodName(name);\n}\n\nfunction flatGetterMethodNames(childComponents: any, parentName?: string) {\n return Object.entries(childComponents).reduce<string[]>((acc, [name, value]) => {\n if (Array.isArray(value)) {\n acc.push(...flatGetterMethodNames(value[1], name));\n }\n name = parentName ? `${parentName}${name}` : name;\n acc.push(getterMethodName(name));\n return acc;\n }, []);\n}\n\nexport const STATIC_COMPONENT = Symbol('STATIC_COMPONENT');\nexport const ROOT_COMPONENT = Symbol('ROOT_COMPONENT');\nconst SELF_GETTER_METHOD = Symbol('SELF_GETTER_METHOD');\n\nfunction Enhancement(childComponents: any, createComponent: any, options: any) {\n const getterMethodNames = flatGetterMethodNames(childComponents);\n return {\n condition: function (Component: any) {\n return Boolean(Component[STATIC_COMPONENT] || Object.keys(childComponents).length);\n },\n init: function (this: any, props: any, WrapperComponent: any) {\n const getterMethods: any = pick(this, getterMethodNames);\n this[SELF_GETTER_METHOD] = () => {\n const selfGetterMethod = getterMethodNameByDisplayName(WrapperComponent.displayName);\n logger.warn(\n true,\n `Getter \\`${selfGetterMethod}\\` can't be fired as it is a getter of static component`,\n props['data-ui-name'] || WrapperComponent.displayName,\n );\n };\n assign(\n this,\n getterMethodNames.reduce((acc: any, name) => {\n const getterMethod = getterMethods[name];\n if (!getterMethod) return acc;\n acc[name] = (childrenProps = {}) => {\n const getterProps = getterMethod.call(this, childrenProps, acc[name].index);\n return assignProps(childrenProps, getterProps);\n };\n acc[name].index = -1;\n acc[name].cache = new Set();\n return acc;\n }, {}),\n );\n },\n static: function (WrapperComponent: any, Component: any) {\n if (Object.keys(childComponents).length && !WrapperComponent.displayName) {\n throw new Error('\"displayName\" is not defined');\n }\n return Object.entries(childComponents).reduce((acc: any, [name, value]: any) => {\n let childComponents = {};\n\n if (Array.isArray(value)) {\n childComponents = value[1];\n value = value[0];\n }\n\n const prevStaticComponent = value[STATIC_COMPONENT];\n // @ts-ignore\n const prevDisplayName = value.displayName;\n // @ts-ignore\n value.displayName = `${WrapperComponent.displayName}.${name}`;\n value[STATIC_COMPONENT] = true;\n value[ROOT_COMPONENT] = Component[ROOT_COMPONENT] || Component;\n acc[name] = createComponent(value, childComponents, options);\n // @ts-ignore\n value.displayName = prevDisplayName;\n value[STATIC_COMPONENT] = prevStaticComponent;\n return acc;\n }, {});\n },\n context: function (context: any /*, WrapperComponent*/) {\n // const getterMethod = getterMethodNameByDisplayName(WrapperComponent.displayName);\n return {\n ...context,\n // [getterMethod]: this[SELF_GETTER_METHOD],\n ...pick(this, getterMethodNames as any),\n };\n },\n wrapperProps: function (this: any, props: any, WrapperComponent: any) {\n if (!WrapperComponent[STATIC_COMPONENT]) return props;\n const context: any = React.useContext(options.context);\n const getterMethod = context[getterMethodNameByDisplayName(WrapperComponent.displayName)];\n if (getterMethod) {\n if (!getterMethod.cache.has(this)) {\n getterMethod.cache.add(this);\n getterMethod.index++;\n if (this) this.index = getterMethod.index;\n }\n if (this) getterMethod.index = this.index;\n return getterMethod(props);\n }\n return props;\n },\n render: function (this: any, render: any) {\n getterMethodNames.forEach((name) => {\n if (this[name] === undefined) return;\n this[name].index = -1;\n this[name].cache.clear();\n });\n return render;\n },\n };\n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,GAAGa,OAAO,CAACtD,6BAA6B,CAACoC,gBAAgB,CAACnC,WAAW,CAAC,CAAC;MACzF,IAAIwC,YAAY,EAAE;QAChB,IAAI,CAACA,YAAY,CAACK,KAAK,CAACY,GAAG,CAAC,IAAI,CAAC,EAAE;UACjCjB,YAAY,CAACK,KAAK,CAACa,GAAG,CAAC,IAAI,CAAC;UAC5BlB,YAAY,CAACI,KAAK,EAAE;UACpB,IAAI,IAAI,EAAE,IAAI,CAACA,KAAK,GAAGJ,YAAY,CAACI,KAAK;QAC3C;QACA,IAAI,IAAI,EAAEJ,YAAY,CAACI,KAAK,GAAG,IAAI,CAACA,KAAK;QACzC,OAAOJ,YAAY,CAACN,KAAK,CAAC;MAC5B;MACA,OAAOA,KAAK;IACd,CAAC;IACDyB,MAAM,EAAE,SAAAA,OAAqBA,OAAW,EAAE;MAAA,IAAAC,MAAA;MACxC/B,iBAAiB,CAACgC,OAAO,CAAC,UAAChE,IAAI,EAAK;QAClC,IAAI+D,MAAI,CAAC/D,IAAI,CAAC,KAAKM,SAAS,EAAE;QAC9ByD,MAAI,CAAC/D,IAAI,CAAC,CAAC+C,KAAK,GAAG,CAAC,CAAC;QACrBgB,MAAI,CAAC/D,IAAI,CAAC,CAACgD,KAAK,CAACiB,KAAK,EAAE;MAC1B,CAAC,CAAC;MACF,OAAOH,OAAM;IACf;EACF,CAAC;AACH;AAEA,eAAejC,WAAW"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
4
|
+
var _excluded = ["_styles", "styles"],
|
|
5
|
+
_excluded2 = ["styles"];
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { sstyled } from '../styled/index';
|
|
8
|
+
import { STATIC_COMPONENT } from './staticChildren';
|
|
9
|
+
export var STYLES_CONTEXT = Symbol('STYLES_CONTEXT');
|
|
10
|
+
var STYLES_SELF = Symbol('STYLES_SELF');
|
|
11
|
+
function Enhancement(childComponents, Context) {
|
|
12
|
+
return {
|
|
13
|
+
condition: function condition(Component) {
|
|
14
|
+
return Boolean(Component.style || Component[STATIC_COMPONENT]);
|
|
15
|
+
},
|
|
16
|
+
init: function init(props, WrapperComponent) {
|
|
17
|
+
if (props.styles) {
|
|
18
|
+
this[STYLES_SELF] = props.styles;
|
|
19
|
+
}
|
|
20
|
+
if (WrapperComponent.style) {
|
|
21
|
+
this[STYLES_SELF] = sstyled.merge(WrapperComponent.style, props._styles);
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
context: function context(_context) {
|
|
25
|
+
// Optimization: if has no children there is no need to create new context (by lsroman)
|
|
26
|
+
if (!this[STYLES_SELF] || !Object.keys(childComponents).length) {
|
|
27
|
+
return _context;
|
|
28
|
+
}
|
|
29
|
+
return _objectSpread(_objectSpread({}, _context), {}, _defineProperty({}, STYLES_CONTEXT, this[STYLES_SELF]));
|
|
30
|
+
},
|
|
31
|
+
asProps: function asProps(_ref) {
|
|
32
|
+
var _styles = _ref._styles,
|
|
33
|
+
styles = _ref.styles,
|
|
34
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
35
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
|
36
|
+
styles: this[STYLES_SELF]
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
wrapperProps: function wrapperProps(_ref2) {
|
|
40
|
+
var styles = _ref2.styles,
|
|
41
|
+
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
42
|
+
var context = React.useContext(Context);
|
|
43
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
|
44
|
+
_styles: styles,
|
|
45
|
+
styles: context[STYLES_CONTEXT]
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export default Enhancement;
|
|
51
|
+
//# sourceMappingURL=style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.js","names":["React","sstyled","STATIC_COMPONENT","STYLES_CONTEXT","Symbol","STYLES_SELF","Enhancement","childComponents","Context","condition","Component","Boolean","style","init","props","WrapperComponent","styles","merge","_styles","context","Object","keys","length","_objectSpread","_defineProperty","asProps","_ref","_objectWithoutProperties","_excluded","wrapperProps","_ref2","_excluded2","useContext"],"sources":["../../../src/enhancement/style.tsx"],"sourcesContent":["import React from 'react';\nimport { sstyled } from '../styled/index';\nimport { STATIC_COMPONENT } from './staticChildren';\n\nexport const STYLES_CONTEXT = Symbol('STYLES_CONTEXT');\nconst STYLES_SELF = Symbol('STYLES_SELF');\n\nfunction Enhancement(childComponents: any, Context: any) {\n return {\n condition: function (Component: any) {\n return Boolean(Component.style || Component[STATIC_COMPONENT]);\n },\n init: function (this: any, props: any, WrapperComponent: any) {\n if (props.styles) {\n this[STYLES_SELF] = props.styles;\n }\n if (WrapperComponent.style) {\n this[STYLES_SELF] = sstyled.merge(WrapperComponent.style, props._styles);\n }\n },\n context: function (this: any, context: any): any {\n // Optimization: if has no children there is no need to create new context (by lsroman)\n if (!this[STYLES_SELF] || !Object.keys(childComponents).length) {\n return context;\n }\n return {\n ...context,\n [STYLES_CONTEXT]: this[STYLES_SELF],\n };\n },\n\n asProps: function (this: any, { _styles, styles, ...props }: any) {\n return {\n ...props,\n styles: this[STYLES_SELF],\n };\n },\n wrapperProps: function (this: any, { styles, ...props }: any) {\n const context: any = React.useContext(Context);\n return {\n ...props,\n _styles: styles,\n styles: context[STYLES_CONTEXT],\n };\n },\n };\n}\n\nexport default Enhancement;\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,OAAO,QAAQ,iBAAiB;AACzC,SAASC,gBAAgB,QAAQ,kBAAkB;AAEnD,OAAO,IAAMC,cAAc,GAAGC,MAAM,CAAC,gBAAgB,CAAC;AACtD,IAAMC,WAAW,GAAGD,MAAM,CAAC,aAAa,CA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AK,GAAAa,wBAAA,CAAAG,KAAA,EAAAC,UAAA;MACnD,IAAMZ,OAAY,GAAGnB,KAAK,CAACgC,UAAU,CAACxB,OAAO,CAAC;MAC9C,OAAAe,aAAA,CAAAA,aAAA,KACKT,KAAK;QACRI,OAAO,EAAEF,MAAM;QACfA,MAAM,EAAEG,OAAO,CAAChB,cAAc;MAAC;IAEnC;EACF,CAAC;AACH;AAEA,eAAeG,WAAW"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _toArray from "@babel/runtime/helpers/toArray";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
+
import _toPropertyKey from "@babel/runtime/helpers/toPropertyKey";
|
|
6
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
+
import { callAllEventHandlers } from '../utils/assignProps';
|
|
9
|
+
import capitalizeFirstLetter from '../utils/capitalizeFirstLetter';
|
|
10
|
+
function assign(target, source) {
|
|
11
|
+
return Object.defineProperties(target, Object.keys(source).reduce(function (descriptors, key) {
|
|
12
|
+
descriptors[key] = Object.getOwnPropertyDescriptor(source, key);
|
|
13
|
+
return descriptors;
|
|
14
|
+
}, {}));
|
|
15
|
+
}
|
|
16
|
+
function defaultProp(prop) {
|
|
17
|
+
return "default".concat(capitalizeFirstLetter(prop));
|
|
18
|
+
}
|
|
19
|
+
function handlerProp(prop) {
|
|
20
|
+
if (prop === 'value') prop = '';
|
|
21
|
+
if (prop === 'checked') prop = '';
|
|
22
|
+
return "on".concat(capitalizeFirstLetter(prop), "Change");
|
|
23
|
+
}
|
|
24
|
+
function isControlled(propValue) {
|
|
25
|
+
return propValue !== undefined;
|
|
26
|
+
}
|
|
27
|
+
function uncontrolledProp(self, propName, propValue, propDefaultValue, propHandler, chainHandler) {
|
|
28
|
+
function getValue() {
|
|
29
|
+
return isControlled(propValue) ? propValue : propName in self.state ? self.state[propName] : propDefaultValue;
|
|
30
|
+
}
|
|
31
|
+
return [getValue(), function (value) {
|
|
32
|
+
var oldValue = getValue();
|
|
33
|
+
if (oldValue === value) return false;
|
|
34
|
+
if (!isControlled(propValue)) self.setState(_defineProperty({}, propName, value));
|
|
35
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
36
|
+
args[_key - 1] = arguments[_key];
|
|
37
|
+
}
|
|
38
|
+
return callAllEventHandlers.apply(void 0, [propHandler].concat(_toConsumableArray(chainHandler))).apply(void 0, [value].concat(args));
|
|
39
|
+
}];
|
|
40
|
+
}
|
|
41
|
+
function uncontrolledUniversal(props, config, uncontrolledProp) {
|
|
42
|
+
var handlerProps = {};
|
|
43
|
+
var uncontrolledProps = Object.keys(config).reduce(function (result, propName) {
|
|
44
|
+
var _objectSpread2;
|
|
45
|
+
var handlerName = handlerProp(propName);
|
|
46
|
+
var defaultPropName = defaultProp(propName);
|
|
47
|
+
var propDefaultValue = result[defaultPropName],
|
|
48
|
+
propValue = result[propName],
|
|
49
|
+
propHandler = result[handlerName],
|
|
50
|
+
other = _objectWithoutProperties(result, [defaultPropName, propName, handlerName].map(_toPropertyKey));
|
|
51
|
+
if (propDefaultValue === undefined) {
|
|
52
|
+
console.warn(defaultPropName, 'must be installed in "defaultProps"');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// if (typeof propDefaultValue === 'function' && propDefaultValue.defaultInit) {
|
|
56
|
+
// propDefaultValue = propDefaultValue(result);
|
|
57
|
+
// }
|
|
58
|
+
|
|
59
|
+
var setter = config[propName];
|
|
60
|
+
var chainHandler = [];
|
|
61
|
+
if (Array.isArray(setter)) {
|
|
62
|
+
var _setter = setter;
|
|
63
|
+
var _setter2 = _toArray(_setter);
|
|
64
|
+
setter = _setter2[0];
|
|
65
|
+
chainHandler = _setter2.slice(1);
|
|
66
|
+
}
|
|
67
|
+
setter = setter || function (v) {
|
|
68
|
+
return v;
|
|
69
|
+
};
|
|
70
|
+
var _uncontrolledProp = uncontrolledProp(propName, propValue, propDefaultValue, propHandler, chainHandler),
|
|
71
|
+
_uncontrolledProp2 = _slicedToArray(_uncontrolledProp, 2),
|
|
72
|
+
value = _uncontrolledProp2[0],
|
|
73
|
+
handler = _uncontrolledProp2[1];
|
|
74
|
+
// TODO: need to warn about recursion (by lsroman)
|
|
75
|
+
handlerProps[propName] = handler;
|
|
76
|
+
return _objectSpread(_objectSpread({}, other), {}, (_objectSpread2 = {}, _defineProperty(_objectSpread2, propName, value), _defineProperty(_objectSpread2, handlerName, function (eventOrValue) {
|
|
77
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
78
|
+
args[_key2 - 1] = arguments[_key2];
|
|
79
|
+
}
|
|
80
|
+
var result = [setter.apply(void 0, [eventOrValue].concat(args))].concat(args);
|
|
81
|
+
if (eventOrValue !== null && eventOrValue !== void 0 && eventOrValue.target) {
|
|
82
|
+
result.push(eventOrValue);
|
|
83
|
+
}
|
|
84
|
+
return handler.apply(void 0, _toConsumableArray(result));
|
|
85
|
+
}), _objectSpread2));
|
|
86
|
+
}, props);
|
|
87
|
+
return [uncontrolledProps, handlerProps];
|
|
88
|
+
}
|
|
89
|
+
function uncontrolled(self, props, config) {
|
|
90
|
+
return uncontrolledUniversal(props, config, uncontrolledProp.bind(undefined, self));
|
|
91
|
+
}
|
|
92
|
+
function Enhancement() {
|
|
93
|
+
return {
|
|
94
|
+
condition: function condition(Component) {
|
|
95
|
+
return Boolean(Component.prototype.uncontrolledProps);
|
|
96
|
+
},
|
|
97
|
+
init: function init() {
|
|
98
|
+
this.state = this.state || {};
|
|
99
|
+
assign(this, {
|
|
100
|
+
get handlers() {
|
|
101
|
+
var _uncontrolled = uncontrolled(this, this.props, this.uncontrolledProps()),
|
|
102
|
+
_uncontrolled2 = _slicedToArray(_uncontrolled, 2),
|
|
103
|
+
uncontrolledHandlers = _uncontrolled2[1];
|
|
104
|
+
return uncontrolledHandlers;
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
context: function context(_context) {
|
|
109
|
+
return _objectSpread(_objectSpread({}, _context), {}, {
|
|
110
|
+
handlers: this.handlers
|
|
111
|
+
});
|
|
112
|
+
},
|
|
113
|
+
asProps: function asProps(props) {
|
|
114
|
+
// TODO: need to omit unneccessary props (by lsroman)
|
|
115
|
+
var _uncontrolled3 = uncontrolled(this, props, this.uncontrolledProps()),
|
|
116
|
+
_uncontrolled4 = _slicedToArray(_uncontrolled3, 1),
|
|
117
|
+
uncontrolledProps = _uncontrolled4[0];
|
|
118
|
+
return uncontrolledProps;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
export default Enhancement;
|
|
123
|
+
//# sourceMappingURL=uncontrolledProps.js.map
|