@semcore/core 16.5.1-prerelease.5 → 17.0.0-prerelease.14
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 +12 -1
- package/README.md +4 -4
- package/lib/LastInteractionType.js +22 -36
- package/lib/LastInteractionType.js.map +1 -1
- package/lib/LastInteractionType.mjs +19 -33
- package/lib/LastInteractionType.mjs.map +1 -1
- package/lib/core-types/Component.d.ts +26 -79
- package/lib/core-types/Component.js +24 -72
- package/lib/core-types/Component.js.map +1 -1
- package/lib/core-types/Component.mjs +18 -34
- package/lib/core-types/Component.mjs.map +1 -1
- package/lib/core-types/symbols.js +9 -9
- package/lib/core-types/symbols.js.map +1 -1
- package/lib/core-types/symbols.mjs +9 -9
- package/lib/core-types/symbols.mjs.map +1 -1
- package/lib/coreFactory.d.ts +6 -23
- package/lib/coreFactory.js +150 -217
- package/lib/coreFactory.js.map +1 -1
- package/lib/coreFactory.mjs +139 -194
- package/lib/coreFactory.mjs.map +1 -1
- package/lib/decorators/propsObserver.d.ts +11 -0
- package/lib/decorators/reactive.d.ts +11 -0
- package/lib/enhancement/Children.js +51 -59
- package/lib/enhancement/Children.js.map +1 -1
- package/lib/enhancement/Children.mjs +47 -41
- package/lib/enhancement/Children.mjs.map +1 -1
- package/lib/enhancement/Root.js +36 -37
- package/lib/enhancement/Root.js.map +1 -1
- package/lib/enhancement/Root.mjs +28 -18
- package/lib/enhancement/Root.mjs.map +1 -1
- package/lib/enhancement/dataName.js +7 -8
- package/lib/enhancement/dataName.js.map +1 -1
- package/lib/enhancement/dataName.mjs +5 -5
- package/lib/enhancement/dataName.mjs.map +1 -1
- package/lib/enhancement/enhance.js +6 -9
- package/lib/enhancement/enhance.js.map +1 -1
- package/lib/enhancement/enhance.mjs +5 -7
- package/lib/enhancement/enhance.mjs.map +1 -1
- package/lib/enhancement/functionDefaultProps.js +6 -6
- package/lib/enhancement/functionDefaultProps.js.map +1 -1
- package/lib/enhancement/functionDefaultProps.mjs +4 -4
- package/lib/enhancement/functionDefaultProps.mjs.map +1 -1
- package/lib/enhancement/i18n.js +13 -13
- package/lib/enhancement/i18n.js.map +1 -1
- package/lib/enhancement/i18n.mjs +10 -9
- package/lib/enhancement/i18n.mjs.map +1 -1
- package/lib/enhancement/inheritedName.js +7 -8
- package/lib/enhancement/inheritedName.js.map +1 -1
- package/lib/enhancement/inheritedName.mjs +5 -5
- package/lib/enhancement/inheritedName.mjs.map +1 -1
- package/lib/enhancement/staticChildren.js +47 -56
- package/lib/enhancement/staticChildren.js.map +1 -1
- package/lib/enhancement/staticChildren.mjs +43 -48
- package/lib/enhancement/staticChildren.mjs.map +1 -1
- package/lib/enhancement/style.js +29 -27
- package/lib/enhancement/style.js.map +1 -1
- package/lib/enhancement/style.mjs +26 -20
- package/lib/enhancement/style.mjs.map +1 -1
- package/lib/enhancement/uncontrolledProps.js +46 -64
- package/lib/enhancement/uncontrolledProps.js.map +1 -1
- package/lib/enhancement/uncontrolledProps.mjs +43 -51
- package/lib/enhancement/uncontrolledProps.mjs.map +1 -1
- package/lib/esm/LastInteractionType.mjs +19 -33
- package/lib/esm/core-types/Component.mjs +18 -34
- package/lib/esm/core-types/symbols.mjs +9 -9
- package/lib/esm/coreFactory.mjs +139 -194
- package/lib/esm/enhancement/Children.mjs +47 -41
- package/lib/esm/enhancement/Root.mjs +28 -18
- package/lib/esm/enhancement/dataName.mjs +5 -5
- package/lib/esm/enhancement/enhance.mjs +5 -7
- package/lib/esm/enhancement/functionDefaultProps.mjs +4 -4
- package/lib/esm/enhancement/i18n.mjs +10 -9
- package/lib/esm/enhancement/inheritedName.mjs +5 -5
- package/lib/esm/enhancement/staticChildren.mjs +43 -48
- package/lib/esm/enhancement/style.mjs +26 -20
- package/lib/esm/enhancement/uncontrolledProps.mjs +43 -51
- package/lib/esm/register.mjs +12 -20
- package/lib/esm/styled/reshadow-core.mjs +98 -111
- package/lib/esm/styled/sstyled.mjs +31 -41
- package/lib/esm/utils/assignProps.mjs +32 -36
- package/lib/esm/utils/enhances/WithI18n.mjs +16 -63
- package/lib/esm/utils/enhances/i18nEnhance.mjs +47 -61
- package/lib/esm/utils/logger.mjs +13 -21
- package/lib/esm/utils/pick.mjs +4 -4
- package/lib/esm/utils/ref.mjs +27 -57
- package/lib/esm/utils/use/useEnhancedEffect.mjs +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.js +17 -17
- package/lib/index.js.map +1 -1
- package/lib/index.mjs.map +1 -1
- package/lib/register.js +17 -24
- package/lib/register.js.map +1 -1
- package/lib/register.mjs +12 -20
- package/lib/register.mjs.map +1 -1
- package/lib/styled/index.d.ts +1 -5
- package/lib/styled/index.js +4 -4
- package/lib/styled/index.js.map +1 -1
- package/lib/styled/index.mjs.map +1 -1
- package/lib/styled/reshadow-core.js +102 -104
- package/lib/styled/reshadow-core.js.map +1 -1
- package/lib/styled/reshadow-core.mjs +98 -111
- package/lib/styled/reshadow-core.mjs.map +1 -1
- package/lib/styled/sstyled.js +31 -53
- package/lib/styled/sstyled.js.map +1 -1
- package/lib/styled/sstyled.mjs +31 -41
- package/lib/styled/sstyled.mjs.map +1 -1
- package/lib/theme/processor.js +150 -222
- package/lib/theme/processor.js.map +1 -1
- package/lib/theme/processor.mjs +148 -221
- package/lib/theme/processor.mjs.map +1 -1
- package/lib/theme/themes/dark.js +2 -2
- package/lib/theme/themes/dark.js.map +1 -1
- package/lib/theme/themes/default.js +2 -2
- package/lib/theme/themes/default.js.map +1 -1
- package/lib/theme/themes/highlights-dark.js +2 -2
- package/lib/theme/themes/highlights-dark.js.map +1 -1
- package/lib/theme/themes/highlights-light.js +2 -2
- package/lib/theme/themes/highlights-light.js.map +1 -1
- package/lib/theme/themes/light.js +2 -2
- package/lib/theme/themes/light.js.map +1 -1
- package/lib/theme/utils.js +140 -215
- package/lib/theme/utils.js.map +1 -1
- package/lib/theme/utils.mjs +135 -214
- package/lib/theme/utils.mjs.map +1 -1
- package/lib/utils/CSSinJS.js +8 -10
- package/lib/utils/CSSinJS.js.map +1 -1
- package/lib/utils/CSSinJS.mjs +6 -7
- package/lib/utils/CSSinJS.mjs.map +1 -1
- package/lib/utils/ThemeProvider.js +44 -51
- package/lib/utils/ThemeProvider.js.map +1 -1
- package/lib/utils/ThemeProvider.mjs +36 -47
- package/lib/utils/ThemeProvider.mjs.map +1 -1
- package/lib/utils/addonText.js +4 -7
- package/lib/utils/addonText.js.map +1 -1
- package/lib/utils/addonText.mjs +2 -5
- package/lib/utils/addonText.mjs.map +1 -1
- package/lib/utils/addonTextChildren.js +15 -21
- package/lib/utils/addonTextChildren.js.map +1 -1
- package/lib/utils/addonTextChildren.mjs +7 -13
- package/lib/utils/addonTextChildren.mjs.map +1 -1
- package/lib/utils/ariaProps.js +7 -5
- package/lib/utils/ariaProps.js.map +1 -1
- package/lib/utils/ariaProps.mjs +7 -5
- package/lib/utils/ariaProps.mjs.map +1 -1
- package/lib/utils/assignProps.js +33 -37
- package/lib/utils/assignProps.js.map +1 -1
- package/lib/utils/assignProps.mjs +32 -36
- package/lib/utils/assignProps.mjs.map +1 -1
- package/lib/utils/canUseDOM.js +1 -1
- package/lib/utils/capitalizeFirstLetter.js +1 -1
- package/lib/utils/color.js +72 -95
- package/lib/utils/color.js.map +1 -1
- package/lib/utils/color.mjs +71 -94
- package/lib/utils/color.mjs.map +1 -1
- package/lib/utils/compose.js +3 -12
- package/lib/utils/compose.js.map +1 -1
- package/lib/utils/compose.mjs +2 -11
- package/lib/utils/compose.mjs.map +1 -1
- package/lib/utils/createUUID.js +5 -5
- package/lib/utils/createUUID.js.map +1 -1
- package/lib/utils/createUUID.mjs +4 -4
- package/lib/utils/createUUID.mjs.map +1 -1
- package/lib/utils/cssToIntDefault.js +3 -4
- package/lib/utils/cssToIntDefault.js.map +1 -1
- package/lib/utils/cssToIntDefault.mjs +2 -3
- package/lib/utils/cssToIntDefault.mjs.map +1 -1
- package/lib/utils/enhances/WithCSS.d.ts +2 -30
- package/lib/utils/enhances/WithCSS.js +13 -64
- package/lib/utils/enhances/WithCSS.js.map +1 -1
- package/lib/utils/enhances/WithCSS.mjs +9 -59
- package/lib/utils/enhances/WithCSS.mjs.map +1 -1
- package/lib/utils/enhances/WithI18n.d.ts +1 -30
- package/lib/utils/enhances/WithI18n.js +20 -76
- package/lib/utils/enhances/WithI18n.js.map +1 -1
- package/lib/utils/enhances/WithI18n.mjs +16 -63
- package/lib/utils/enhances/WithI18n.mjs.map +1 -1
- package/lib/utils/enhances/a11yEnhance.js +34 -39
- package/lib/utils/enhances/a11yEnhance.js.map +1 -1
- package/lib/utils/enhances/a11yEnhance.mjs +32 -36
- package/lib/utils/enhances/a11yEnhance.mjs.map +1 -1
- package/lib/utils/enhances/animatedSizeEnhance.d.ts +0 -4
- package/lib/utils/enhances/animatedSizeEnhance.js +55 -65
- package/lib/utils/enhances/animatedSizeEnhance.js.map +1 -1
- package/lib/utils/enhances/animatedSizeEnhance.mjs +50 -61
- package/lib/utils/enhances/animatedSizeEnhance.mjs.map +1 -1
- package/lib/utils/enhances/contextEnhance.js +12 -11
- package/lib/utils/enhances/contextEnhance.js.map +1 -1
- package/lib/utils/enhances/contextEnhance.mjs +9 -8
- package/lib/utils/enhances/contextEnhance.mjs.map +1 -1
- package/lib/utils/enhances/i18nEnhance.d.ts +0 -4
- package/lib/utils/enhances/i18nEnhance.js +51 -69
- package/lib/utils/enhances/i18nEnhance.js.map +1 -1
- package/lib/utils/enhances/i18nEnhance.mjs +47 -61
- package/lib/utils/enhances/i18nEnhance.mjs.map +1 -1
- package/lib/utils/enhances/resolveColorEnhance.js +12 -10
- package/lib/utils/enhances/resolveColorEnhance.js.map +1 -1
- package/lib/utils/enhances/resolveColorEnhance.mjs +8 -6
- package/lib/utils/enhances/resolveColorEnhance.mjs.map +1 -1
- package/lib/utils/eventEmitter.d.ts +10 -6
- package/lib/utils/eventEmitter.js +33 -32
- package/lib/utils/eventEmitter.js.map +1 -1
- package/lib/utils/eventEmitter.mjs +30 -31
- package/lib/utils/eventEmitter.mjs.map +1 -1
- package/lib/utils/findComponent.js +35 -42
- package/lib/utils/findComponent.js.map +1 -1
- package/lib/utils/findComponent.mjs +26 -33
- package/lib/utils/findComponent.mjs.map +1 -1
- package/lib/utils/fire.js +7 -13
- package/lib/utils/fire.js.map +1 -1
- package/lib/utils/fire.mjs +5 -11
- package/lib/utils/fire.mjs.map +1 -1
- package/lib/utils/focus-lock/focusBorders.js +28 -32
- package/lib/utils/focus-lock/focusBorders.js.map +1 -1
- package/lib/utils/focus-lock/focusBorders.mjs +26 -32
- package/lib/utils/focus-lock/focusBorders.mjs.map +1 -1
- package/lib/utils/focus-lock/getFocusableIn.js +4 -6
- package/lib/utils/focus-lock/getFocusableIn.js.map +1 -1
- package/lib/utils/focus-lock/getFocusableIn.mjs +3 -6
- package/lib/utils/focus-lock/getFocusableIn.mjs.map +1 -1
- package/lib/utils/focus-lock/isFocusInside.js +5 -6
- package/lib/utils/focus-lock/isFocusInside.js.map +1 -1
- package/lib/utils/focus-lock/isFocusInside.mjs +4 -6
- package/lib/utils/focus-lock/isFocusInside.mjs.map +1 -1
- package/lib/utils/focus-lock/isFocusable.js +9 -12
- package/lib/utils/focus-lock/isFocusable.js.map +1 -1
- package/lib/utils/focus-lock/isFocusable.mjs +8 -11
- package/lib/utils/focus-lock/isFocusable.mjs.map +1 -1
- package/lib/utils/focus-lock/setFocus.js +21 -27
- package/lib/utils/focus-lock/setFocus.js.map +1 -1
- package/lib/utils/focus-lock/setFocus.mjs +19 -25
- package/lib/utils/focus-lock/setFocus.mjs.map +1 -1
- package/lib/utils/getAccessibleName.js +10 -22
- package/lib/utils/getAccessibleName.js.map +1 -1
- package/lib/utils/getAccessibleName.mjs +10 -21
- package/lib/utils/getAccessibleName.mjs.map +1 -1
- package/lib/utils/getDisplayName.js +1 -1
- package/lib/utils/getDisplayName.mjs +3 -5
- package/lib/utils/getEventTarget.js +13 -32
- package/lib/utils/getEventTarget.js.map +1 -1
- package/lib/utils/getEventTarget.mjs +12 -31
- package/lib/utils/getEventTarget.mjs.map +1 -1
- package/lib/utils/getOriginChildren.js +4 -4
- package/lib/utils/getOriginChildren.js.map +1 -1
- package/lib/utils/getRandomInt.js +1 -1
- package/lib/utils/getValue.js +4 -6
- package/lib/utils/getValue.js.map +1 -1
- package/lib/utils/getValue.mjs +3 -5
- package/lib/utils/getValue.mjs.map +1 -1
- package/lib/utils/hasLabels.js +16 -27
- package/lib/utils/hasLabels.js.map +1 -1
- package/lib/utils/hasLabels.mjs +14 -24
- package/lib/utils/hasLabels.mjs.map +1 -1
- package/lib/utils/hasParent.js +3 -2
- package/lib/utils/hasParent.js.map +1 -1
- package/lib/utils/hasParent.mjs +2 -3
- package/lib/utils/hasParent.mjs.map +1 -1
- package/lib/utils/ifChildren.js +6 -4
- package/lib/utils/ifChildren.js.map +1 -1
- package/lib/utils/ifChildren.mjs +4 -2
- package/lib/utils/ifChildren.mjs.map +1 -1
- package/lib/utils/injectStyle.js +11 -13
- package/lib/utils/injectStyle.js.map +1 -1
- package/lib/utils/injectStyle.mjs +9 -10
- package/lib/utils/injectStyle.mjs.map +1 -1
- package/lib/utils/inputProps.js +5 -5
- package/lib/utils/inputProps.js.map +1 -1
- package/lib/utils/inputProps.mjs +4 -4
- package/lib/utils/inputProps.mjs.map +1 -1
- package/lib/utils/isInteractiveElement.js +7 -9
- package/lib/utils/isInteractiveElement.js.map +1 -1
- package/lib/utils/isInteractiveElement.mjs +7 -9
- package/lib/utils/isInteractiveElement.mjs.map +1 -1
- package/lib/utils/isNode.js +4 -5
- package/lib/utils/isNode.js.map +1 -1
- package/lib/utils/isNode.mjs +1 -2
- package/lib/utils/isNode.mjs.map +1 -1
- package/lib/utils/isPromise.js +1 -1
- package/lib/utils/isRetina.js +7 -2
- package/lib/utils/isRetina.js.map +1 -1
- package/lib/utils/isRetina.mjs +6 -1
- package/lib/utils/isRetina.mjs.map +1 -1
- package/lib/utils/logger.js +18 -25
- package/lib/utils/logger.js.map +1 -1
- package/lib/utils/logger.mjs +13 -21
- package/lib/utils/logger.mjs.map +1 -1
- package/lib/utils/numericChecker.js +11 -18
- package/lib/utils/numericChecker.js.map +1 -1
- package/lib/utils/numericChecker.mjs +10 -17
- package/lib/utils/numericChecker.mjs.map +1 -1
- package/lib/utils/ownerDocument.js +2 -2
- package/lib/utils/ownerDocument.js.map +1 -1
- package/lib/utils/ownerDocument.mjs +1 -1
- package/lib/utils/ownerDocument.mjs.map +1 -1
- package/lib/utils/pick.js +5 -5
- package/lib/utils/pick.js.map +1 -1
- package/lib/utils/pick.mjs +4 -4
- package/lib/utils/pick.mjs.map +1 -1
- package/lib/utils/propsForElement.js +10 -12
- package/lib/utils/propsForElement.js.map +1 -1
- package/lib/utils/propsForElement.mjs +8 -10
- package/lib/utils/propsForElement.mjs.map +1 -1
- package/lib/utils/rafTrottle.js +9 -14
- package/lib/utils/rafTrottle.js.map +1 -1
- package/lib/utils/rafTrottle.mjs +7 -12
- package/lib/utils/rafTrottle.mjs.map +1 -1
- package/lib/utils/reactToText.js +5 -8
- package/lib/utils/reactToText.js.map +1 -1
- package/lib/utils/reactToText.mjs +3 -6
- package/lib/utils/reactToText.mjs.map +1 -1
- package/lib/utils/ref.d.ts +1 -3
- package/lib/utils/ref.js +29 -61
- package/lib/utils/ref.js.map +1 -1
- package/lib/utils/ref.mjs +27 -57
- package/lib/utils/ref.mjs.map +1 -1
- package/lib/utils/setRef.js +2 -2
- package/lib/utils/setRef.js.map +1 -1
- package/lib/utils/syncScroll.js +24 -24
- package/lib/utils/syncScroll.js.map +1 -1
- package/lib/utils/syncScroll.mjs +21 -21
- package/lib/utils/syncScroll.mjs.map +1 -1
- package/lib/utils/uncontroll.js +8 -18
- package/lib/utils/uncontroll.js.map +1 -1
- package/lib/utils/uncontroll.mjs +8 -17
- package/lib/utils/uncontroll.mjs.map +1 -1
- package/lib/utils/uniqueID.d.ts +0 -4
- package/lib/utils/uniqueID.js +23 -30
- package/lib/utils/uniqueID.js.map +1 -1
- package/lib/utils/uniqueID.mjs +19 -29
- package/lib/utils/uniqueID.mjs.map +1 -1
- package/lib/utils/use/useColorResolver.js +20 -21
- package/lib/utils/use/useColorResolver.js.map +1 -1
- package/lib/utils/use/useColorResolver.mjs +16 -18
- package/lib/utils/use/useColorResolver.mjs.map +1 -1
- package/lib/utils/use/useEnhancedEffect.d.ts +1 -1
- package/lib/utils/use/useEnhancedEffect.js +4 -4
- package/lib/utils/use/useEnhancedEffect.js.map +1 -1
- package/lib/utils/use/useEnhancedEffect.mjs +1 -1
- package/lib/utils/use/useEnhancedEffect.mjs.map +1 -1
- package/lib/utils/use/useEventCallback.js +5 -10
- package/lib/utils/use/useEventCallback.js.map +1 -1
- package/lib/utils/use/useEventCallback.mjs +3 -8
- package/lib/utils/use/useEventCallback.mjs.map +1 -1
- package/lib/utils/use/useEventListener.js +11 -15
- package/lib/utils/use/useEventListener.js.map +1 -1
- package/lib/utils/use/useEventListener.mjs +7 -11
- package/lib/utils/use/useEventListener.mjs.map +1 -1
- package/lib/utils/use/useFocusLock.js +80 -94
- package/lib/utils/use/useFocusLock.js.map +1 -1
- package/lib/utils/use/useFocusLock.mjs +71 -88
- package/lib/utils/use/useFocusLock.mjs.map +1 -1
- package/lib/utils/use/usePreventScroll.js +26 -28
- package/lib/utils/use/usePreventScroll.js.map +1 -1
- package/lib/utils/use/usePreventScroll.mjs +21 -23
- package/lib/utils/use/usePreventScroll.mjs.map +1 -1
- package/lib/utils/use/useScrollBarWidth.js +8 -14
- package/lib/utils/use/useScrollBarWidth.js.map +1 -1
- package/lib/utils/use/useScrollBarWidth.mjs +8 -13
- package/lib/utils/use/useScrollBarWidth.mjs.map +1 -1
- package/lib/utils/useCssVariable.js +32 -37
- package/lib/utils/useCssVariable.js.map +1 -1
- package/lib/utils/useCssVariable.mjs +27 -34
- package/lib/utils/useCssVariable.mjs.map +1 -1
- package/lib/utils/zIndexStacking.d.ts +3 -1
- package/lib/utils/zIndexStacking.js +28 -24
- package/lib/utils/zIndexStacking.js.map +1 -1
- package/lib/utils/zIndexStacking.mjs +23 -22
- package/lib/utils/zIndexStacking.mjs.map +1 -1
- package/package.json +129 -129
- package/lib/enhancement/bindHandler.d.ts +0 -5
- package/lib/enhancement/bindHandler.js +0 -53
- package/lib/enhancement/bindHandler.js.map +0 -1
- package/lib/enhancement/bindHandler.mjs +0 -48
- package/lib/enhancement/bindHandler.mjs.map +0 -1
- package/lib/enhancement/hoistProps.d.ts +0 -10
- package/lib/enhancement/hoistProps.js +0 -95
- package/lib/enhancement/hoistProps.js.map +0 -1
- package/lib/enhancement/hoistProps.mjs +0 -78
- package/lib/enhancement/hoistProps.mjs.map +0 -1
- package/lib/esm/enhancement/bindHandler.mjs +0 -48
- package/lib/esm/enhancement/hoistProps.mjs +0 -78
- package/lib/esm/utils/createHoc.mjs +0 -42
- package/lib/esm/utils/getDisplayName.mjs +0 -6
- package/lib/utils/ScreenReaderOnly.d.ts +0 -8
- package/lib/utils/ScreenReaderOnly.js +0 -30
- package/lib/utils/ScreenReaderOnly.js.map +0 -1
- package/lib/utils/ScreenReaderOnly.mjs +0 -24
- package/lib/utils/ScreenReaderOnly.mjs.map +0 -1
- package/lib/utils/createHoc.d.ts +0 -3
- package/lib/utils/createHoc.js +0 -52
- package/lib/utils/createHoc.js.map +0 -1
- package/lib/utils/createHoc.mjs +0 -42
- package/lib/utils/createHoc.mjs.map +0 -1
- package/lib/utils/enhances/WithAutoFocus.d.ts +0 -14
- package/lib/utils/enhances/WithAutoFocus.js +0 -72
- package/lib/utils/enhances/WithAutoFocus.js.map +0 -1
- package/lib/utils/enhances/WithAutoFocus.mjs +0 -66
- package/lib/utils/enhances/WithAutoFocus.mjs.map +0 -1
- package/lib/utils/enhances/WithKeyboardFocus.d.ts +0 -46
- package/lib/utils/enhances/WithKeyboardFocus.js +0 -94
- package/lib/utils/enhances/WithKeyboardFocus.js.map +0 -1
- package/lib/utils/enhances/WithKeyboardFocus.mjs +0 -88
- package/lib/utils/enhances/WithKeyboardFocus.mjs.map +0 -1
- package/lib/utils/enhances/WithRef.d.ts +0 -3
- package/lib/utils/enhances/WithRef.js +0 -25
- package/lib/utils/enhances/WithRef.js.map +0 -1
- package/lib/utils/enhances/WithRef.mjs +0 -18
- package/lib/utils/enhances/WithRef.mjs.map +0 -1
- package/lib/utils/enhances/autoFocusEnhance.d.ts +0 -10
- package/lib/utils/enhances/autoFocusEnhance.js +0 -45
- package/lib/utils/enhances/autoFocusEnhance.js.map +0 -1
- package/lib/utils/enhances/autoFocusEnhance.mjs +0 -38
- package/lib/utils/enhances/autoFocusEnhance.mjs.map +0 -1
- package/lib/utils/enhances/keyboardFocusEnhance.d.ts +0 -27
- package/lib/utils/enhances/keyboardFocusEnhance.js +0 -63
- package/lib/utils/enhances/keyboardFocusEnhance.js.map +0 -1
- package/lib/utils/enhances/keyboardFocusEnhance.mjs +0 -57
- package/lib/utils/enhances/keyboardFocusEnhance.mjs.map +0 -1
- package/lib/utils/if.d.ts +0 -11
- package/lib/utils/if.js +0 -15
- package/lib/utils/if.js.map +0 -1
- package/lib/utils/if.mjs +0 -9
- package/lib/utils/if.mjs.map +0 -1
- package/lib/utils/use/useCss.d.ts +0 -4
- package/lib/utils/use/useCss.js +0 -19
- package/lib/utils/use/useCss.js.map +0 -1
- package/lib/utils/use/useCss.mjs +0 -12
- package/lib/utils/use/useCss.mjs.map +0 -1
package/lib/coreFactory.js
CHANGED
|
@@ -1,34 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.assignProps = assignProps;
|
|
9
9
|
exports.createBaseComponent = createBaseComponent;
|
|
10
10
|
exports.createComponent = createComponent;
|
|
11
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
12
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
13
|
-
var _readOnlyError2 = _interopRequireDefault(require("@babel/runtime/helpers/readOnlyError"));
|
|
14
|
-
var _superPropGet2 = _interopRequireDefault(require("@babel/runtime/helpers/superPropGet"));
|
|
15
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
16
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
-
var _callSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/callSuper"));
|
|
18
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
20
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
21
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
22
13
|
var _hoistNonReactStatics = _interopRequireDefault(require("hoist-non-react-statics"));
|
|
23
14
|
var _react = _interopRequireDefault(require("react"));
|
|
24
15
|
var _Component2 = require("./core-types/Component");
|
|
25
16
|
var _symbols = require("./core-types/symbols");
|
|
26
|
-
var _bindHandler = _interopRequireDefault(require("./enhancement/bindHandler"));
|
|
27
17
|
var _Children = _interopRequireDefault(require("./enhancement/Children"));
|
|
28
18
|
var _dataName = _interopRequireDefault(require("./enhancement/dataName"));
|
|
29
19
|
var _enhance = _interopRequireDefault(require("./enhancement/enhance"));
|
|
30
20
|
var _functionDefaultProps = _interopRequireDefault(require("./enhancement/functionDefaultProps"));
|
|
31
|
-
var _hoistProps = _interopRequireDefault(require("./enhancement/hoistProps"));
|
|
32
21
|
var _i18n = _interopRequireDefault(require("./enhancement/i18n"));
|
|
33
22
|
var _inheritedName = _interopRequireDefault(require("./enhancement/inheritedName"));
|
|
34
23
|
var _Root = _interopRequireDefault(require("./enhancement/Root"));
|
|
@@ -36,11 +25,8 @@ var _staticChildren = _interopRequireWildcard(require("./enhancement/staticChild
|
|
|
36
25
|
var _style = _interopRequireDefault(require("./enhancement/style"));
|
|
37
26
|
var _uncontrolledProps = _interopRequireDefault(require("./enhancement/uncontrolledProps"));
|
|
38
27
|
var _assignProps2 = _interopRequireDefault(require("./utils/assignProps"));
|
|
39
|
-
var
|
|
28
|
+
var _ref = require("./utils/ref");
|
|
40
29
|
var _useEnhancedEffect = _interopRequireDefault(require("./utils/use/useEnhancedEffect"));
|
|
41
|
-
var _excluded = ["forwardRef"],
|
|
42
|
-
_excluded2 = ["forwardRef", "__WRAPPER_PROPS_BIND__"],
|
|
43
|
-
_excluded3 = ["ref"];
|
|
44
30
|
function isEmptyObject(obj) {
|
|
45
31
|
return Object.getOwnPropertyNames(obj).length === 0 && Object.getOwnPropertySymbols &&
|
|
46
32
|
// For IE 11
|
|
@@ -48,12 +34,12 @@ function isEmptyObject(obj) {
|
|
|
48
34
|
}
|
|
49
35
|
function createGetField(enhancements, Component, isFunction) {
|
|
50
36
|
return function getField(key) {
|
|
51
|
-
return enhancements.filter(
|
|
37
|
+
return enhancements.filter(enhancement => {
|
|
52
38
|
if (!enhancement.condition) {
|
|
53
39
|
return true;
|
|
54
40
|
}
|
|
55
41
|
return enhancement.condition(Component, isFunction);
|
|
56
|
-
}).reduce(
|
|
42
|
+
}).reduce((acc, item) => {
|
|
57
43
|
if (item[key]) {
|
|
58
44
|
acc.push(item[key]);
|
|
59
45
|
}
|
|
@@ -62,205 +48,165 @@ function createGetField(enhancements, Component, isFunction) {
|
|
|
62
48
|
};
|
|
63
49
|
}
|
|
64
50
|
function createForwardWrapper(Component, wrapperProps, statics, isFunction) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
function WrapperForwardRefWithBind(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return /*#__PURE__*/_react
|
|
74
|
-
forwardRef: (0,
|
|
51
|
+
const RootComponent = Component[_staticChildren.ROOT_COMPONENT];
|
|
52
|
+
const getterMethodName = (0, _staticChildren.getterMethodNameByDisplayName)(Component?.displayName);
|
|
53
|
+
const getterMethod = RootComponent?.prototype ? RootComponent.prototype[getterMethodName] : undefined;
|
|
54
|
+
const useGetterIndex = getterMethod?.length >= 2;
|
|
55
|
+
function WrapperForwardRefWithBind({
|
|
56
|
+
forwardRef = null,
|
|
57
|
+
...other
|
|
58
|
+
}, ref) {
|
|
59
|
+
return /*#__PURE__*/_react.default.createElement(BindingWrapper, (0, _extends2.default)({}, other, {
|
|
60
|
+
forwardRef: (0, _ref.useForkRef)(ref, forwardRef)
|
|
75
61
|
}));
|
|
76
62
|
}
|
|
77
|
-
function WrapperForwardRef(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
return /*#__PURE__*/_react["default"].createElement(Component, (0, _extends2["default"])({}, props, {
|
|
89
|
-
forwardRef: (0, _ref4.useForkRef)(enhancementRef, ref, forwardRef)
|
|
63
|
+
function WrapperForwardRef({
|
|
64
|
+
forwardRef = null,
|
|
65
|
+
__WRAPPER_PROPS_BIND__,
|
|
66
|
+
...other
|
|
67
|
+
}, ref) {
|
|
68
|
+
const {
|
|
69
|
+
ref: enhancementRef = null,
|
|
70
|
+
...props
|
|
71
|
+
} = (__WRAPPER_PROPS_BIND__ || wrapperProps).reduce((acc, enhancement) => enhancement(acc, WrapperComponent, isFunction), other);
|
|
72
|
+
return /*#__PURE__*/_react.default.createElement(Component, (0, _extends2.default)({}, props, {
|
|
73
|
+
forwardRef: (0, _ref.useForkRef)(enhancementRef, ref, forwardRef)
|
|
90
74
|
}));
|
|
91
75
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
(0,
|
|
96
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
97
|
-
args[_key] = arguments[_key];
|
|
98
|
-
}
|
|
99
|
-
_this = (0, _callSuper2["default"])(this, BindingWrapper, [].concat(args));
|
|
100
|
-
(0, _defineProperty2["default"])(_this, "index", -1);
|
|
101
|
-
return _this;
|
|
76
|
+
class BindingWrapper extends _react.default.Component {
|
|
77
|
+
constructor(...args) {
|
|
78
|
+
super(...args);
|
|
79
|
+
(0, _defineProperty2.default)(this, "index", -1);
|
|
102
80
|
}
|
|
103
|
-
(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
})
|
|
112
|
-
}));
|
|
113
|
-
}
|
|
114
|
-
}]);
|
|
115
|
-
}(_react["default"].Component);
|
|
116
|
-
var WrapperComponent = /*#__PURE__*/_react["default"].forwardRef(useGetterIndex ? WrapperForwardRefWithBind : WrapperForwardRef);
|
|
117
|
-
(0, _hoistNonReactStatics["default"])(WrapperComponent, Component);
|
|
81
|
+
render() {
|
|
82
|
+
return /*#__PURE__*/_react.default.createElement(WrapperForwardRef, (0, _extends2.default)({}, this.props, {
|
|
83
|
+
__WRAPPER_PROPS_BIND__: wrapperProps.map(fn => fn.bind(this))
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const WrapperComponent = /*#__PURE__*/_react.default.forwardRef(useGetterIndex ? WrapperForwardRefWithBind : WrapperForwardRef);
|
|
88
|
+
(0, _hoistNonReactStatics.default)(WrapperComponent, Component);
|
|
118
89
|
WrapperComponent.displayName = Component.displayName;
|
|
119
90
|
// TODO: defaultProps is only empty
|
|
120
91
|
WrapperComponent.defaultProps = Component.defaultProps;
|
|
121
92
|
// STATIC
|
|
122
|
-
statics.forEach(
|
|
123
|
-
return Object.assign(WrapperComponent, enhancement(WrapperComponent, Component, isFunction));
|
|
124
|
-
});
|
|
93
|
+
statics.forEach(enhancement => Object.assign(WrapperComponent, enhancement(WrapperComponent, Component, isFunction)));
|
|
125
94
|
return WrapperComponent;
|
|
126
95
|
}
|
|
127
96
|
function wrapClass(OriginComponent, enhancements, Context) {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
(0, _classCallCheck2["default"])(this, Component);
|
|
139
|
-
_this3 = (0, _callSuper2["default"])(this, Component, [props, context]);
|
|
97
|
+
const getField = createGetField(enhancements, OriginComponent, false);
|
|
98
|
+
const inits = getField('init');
|
|
99
|
+
const props = getField('asProps');
|
|
100
|
+
const renders = getField('render');
|
|
101
|
+
const statics = getField('static');
|
|
102
|
+
const wrapperProps = getField('wrapperProps');
|
|
103
|
+
const contexts = getField('context');
|
|
104
|
+
class Component extends OriginComponent {
|
|
105
|
+
constructor(props, context) {
|
|
106
|
+
super(props, context);
|
|
140
107
|
// INITS
|
|
141
|
-
(0, _defineProperty2
|
|
142
|
-
(0, _defineProperty2
|
|
143
|
-
(0, _defineProperty2
|
|
144
|
-
inits.forEach(
|
|
145
|
-
|
|
146
|
-
});
|
|
147
|
-
_this3[_symbols.CORE_INIT] = true;
|
|
148
|
-
return _this3;
|
|
108
|
+
(0, _defineProperty2.default)(this, _symbols.CORE_AS_PROPS, null);
|
|
109
|
+
(0, _defineProperty2.default)(this, _symbols.CORE_INSTANCE, WrapperComponent);
|
|
110
|
+
(0, _defineProperty2.default)(this, _symbols.CORE_INIT, false);
|
|
111
|
+
inits.forEach(enhancement => enhancement.call(this, props, WrapperComponent, false));
|
|
112
|
+
this[_symbols.CORE_INIT] = true;
|
|
149
113
|
}
|
|
150
|
-
(
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
var _this4 = this;
|
|
155
|
-
// TODO if not production
|
|
156
|
-
if (!this[_symbols.CORE_INIT]) {
|
|
157
|
-
throw new Error('Can not call asProps in constructor');
|
|
158
|
-
}
|
|
159
|
-
if (!this[_symbols.CORE_AS_PROPS]) {
|
|
160
|
-
// PROPS
|
|
161
|
-
this[_symbols.CORE_AS_PROPS] = props.reduce(function (acc, enhancement) {
|
|
162
|
-
return enhancement.call(_this4, acc, WrapperComponent, false);
|
|
163
|
-
}, this.props);
|
|
164
|
-
}
|
|
165
|
-
return this[_symbols.CORE_AS_PROPS];
|
|
114
|
+
get asProps() {
|
|
115
|
+
// TODO if not production
|
|
116
|
+
if (!this[_symbols.CORE_INIT]) {
|
|
117
|
+
throw new Error('Can not call asProps in constructor');
|
|
166
118
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
var _this5 = this;
|
|
171
|
-
var contextProps = (0, _superPropGet2["default"])(Component, "setContext", this, 1) ? (0, _superPropGet2["default"])(Component, "setContext", this, 3)([]) : {};
|
|
172
|
-
// CONTEXT
|
|
173
|
-
return contexts.reduce(function (acc, enhancement) {
|
|
174
|
-
return enhancement.call(_this5, acc, WrapperComponent, false);
|
|
175
|
-
}, contextProps);
|
|
119
|
+
if (!this[_symbols.CORE_AS_PROPS]) {
|
|
120
|
+
// PROPS
|
|
121
|
+
this[_symbols.CORE_AS_PROPS] = props.reduce((acc, enhancement) => enhancement.call(this, acc, WrapperComponent, false), this.props);
|
|
176
122
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
123
|
+
return this[_symbols.CORE_AS_PROPS];
|
|
124
|
+
}
|
|
125
|
+
setContext() {
|
|
126
|
+
const contextProps = super.setContext ? super.setContext() : {};
|
|
127
|
+
// CONTEXT
|
|
128
|
+
return contexts.reduce((acc, enhancement) => enhancement.call(this, acc, WrapperComponent, false), contextProps);
|
|
129
|
+
}
|
|
130
|
+
render() {
|
|
131
|
+
this[_symbols.CORE_AS_PROPS] = null;
|
|
132
|
+
// TODO if not production
|
|
133
|
+
if (!super.render) {
|
|
134
|
+
throw new Error('Component `render` method is not defined');
|
|
135
|
+
}
|
|
136
|
+
const asProps = this.asProps;
|
|
137
|
+
const ctx = this.setContext();
|
|
138
|
+
// RENDER
|
|
139
|
+
const render = renders.reduce((acc, enhancement) => enhancement.call(this, acc, asProps, WrapperComponent, false), super.render());
|
|
140
|
+
if (!WrapperComponent[_staticChildren.STATIC_COMPONENT] && !isEmptyObject(ctx)) {
|
|
141
|
+
return /*#__PURE__*/_react.default.createElement(Context.Provider, {
|
|
142
|
+
value: {
|
|
143
|
+
...asProps,
|
|
144
|
+
...ctx
|
|
145
|
+
}
|
|
146
|
+
}, render);
|
|
147
|
+
} else {
|
|
148
|
+
return render;
|
|
199
149
|
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
const WrapperComponent = createForwardWrapper(Component, wrapperProps, statics, false);
|
|
203
153
|
return WrapperComponent;
|
|
204
154
|
}
|
|
205
155
|
function wrapFunction(OriginComponent, enhancements, Context) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
(0, _useEnhancedEffect
|
|
156
|
+
const getField = createGetField(enhancements, OriginComponent, true);
|
|
157
|
+
const inits = getField('init');
|
|
158
|
+
const props = getField('asProps');
|
|
159
|
+
const renders = getField('render');
|
|
160
|
+
const statics = getField('static');
|
|
161
|
+
const wrapperProps = getField('wrapperProps');
|
|
162
|
+
const contexts = getField('context');
|
|
163
|
+
const Component = /*#__PURE__*/_react.default.memo(function FunctionMemoComponent(other) {
|
|
164
|
+
const selfRef = _react.default.useRef({});
|
|
165
|
+
const firstRender = _react.default.useRef(true);
|
|
166
|
+
(0, _useEnhancedEffect.default)(() => {
|
|
217
167
|
firstRender.current = false;
|
|
218
168
|
}, []);
|
|
219
169
|
if (firstRender.current) {
|
|
220
170
|
// INITS
|
|
221
|
-
inits.forEach(
|
|
222
|
-
return enhancement.call(selfRef.current, other, WrapperComponent, true);
|
|
223
|
-
});
|
|
171
|
+
inits.forEach(enhancement => enhancement.call(selfRef.current, other, WrapperComponent, true));
|
|
224
172
|
}
|
|
225
173
|
// PROPS
|
|
226
|
-
|
|
227
|
-
return enhancement.call(selfRef.current, acc, WrapperComponent, true);
|
|
228
|
-
}, other);
|
|
174
|
+
const asProps = props.reduce((acc, enhancement) => enhancement.call(selfRef.current, acc, WrapperComponent, true), other);
|
|
229
175
|
// CONTEXT
|
|
230
|
-
|
|
231
|
-
return enhancement.call(selfRef.current, acc, WrapperComponent, true);
|
|
232
|
-
}, {});
|
|
176
|
+
const ctx = contexts.reduce((acc, enhancement) => enhancement.call(selfRef.current, acc, WrapperComponent, true), {});
|
|
233
177
|
|
|
234
178
|
// RENDER
|
|
235
|
-
|
|
236
|
-
return enhancement.call(selfRef.current, acc, asProps, WrapperComponent, true);
|
|
237
|
-
}, /*#__PURE__*/_react["default"].createElement(OriginComponent, asProps));
|
|
179
|
+
const render = renders.reduce((acc, enhancement) => enhancement.call(selfRef.current, acc, asProps, WrapperComponent, true), /*#__PURE__*/_react.default.createElement(OriginComponent, asProps));
|
|
238
180
|
if (!WrapperComponent[_staticChildren.STATIC_COMPONENT] && !isEmptyObject(ctx)) {
|
|
239
|
-
return /*#__PURE__*/_react
|
|
240
|
-
value:
|
|
181
|
+
return /*#__PURE__*/_react.default.createElement(Context.Provider, {
|
|
182
|
+
value: {
|
|
183
|
+
...asProps,
|
|
184
|
+
...ctx
|
|
185
|
+
}
|
|
241
186
|
}, render);
|
|
242
187
|
} else {
|
|
243
188
|
return render;
|
|
244
189
|
}
|
|
245
190
|
});
|
|
246
191
|
Object.assign(Component, OriginComponent);
|
|
247
|
-
|
|
192
|
+
const WrapperComponent = createForwardWrapper(Component, wrapperProps, statics, true);
|
|
248
193
|
return WrapperComponent;
|
|
249
194
|
}
|
|
250
195
|
function wrapCore(OriginComponent, enhancements, Context) {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
196
|
+
const Component = function ({
|
|
197
|
+
Root
|
|
198
|
+
}) {
|
|
199
|
+
const defaultProps = OriginComponent.defaultProps || {};
|
|
200
|
+
return /*#__PURE__*/_react.default.createElement(Root, (0, _extends2.default)({}, defaultProps, {
|
|
255
201
|
render: OriginComponent
|
|
256
202
|
}));
|
|
257
203
|
};
|
|
258
|
-
(0, _hoistNonReactStatics
|
|
204
|
+
(0, _hoistNonReactStatics.default)(Component, OriginComponent);
|
|
259
205
|
Component.displayName = OriginComponent.displayName;
|
|
260
206
|
return wrapFunction(Component, enhancements, Context);
|
|
261
207
|
}
|
|
262
208
|
function createComposeComponent(OriginComponent, Context, enhancements) {
|
|
263
|
-
if (_react
|
|
209
|
+
if (_react.default.PureComponent.isPrototypeOf(OriginComponent) || _react.default.Component.isPrototypeOf(OriginComponent)) {
|
|
264
210
|
if (OriginComponent.prototype instanceof _Component2.Component) {
|
|
265
211
|
return wrapClass(OriginComponent, enhancements, Context);
|
|
266
212
|
} else {
|
|
@@ -275,79 +221,66 @@ function createComposeComponent(OriginComponent, Context, enhancements) {
|
|
|
275
221
|
}
|
|
276
222
|
}
|
|
277
223
|
function assignProps(p1, p2) {
|
|
278
|
-
return (0, _assignProps2
|
|
224
|
+
return (0, _assignProps2.default)(p2, p1);
|
|
279
225
|
}
|
|
280
|
-
function createComponent(OriginComponent) {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
_options$enhancements = options.enhancements,
|
|
288
|
-
enhancements = _options$enhancements === void 0 ? [] : _options$enhancements;
|
|
289
|
-
var parents = Array.isArray(parent) ? parent : [parent];
|
|
226
|
+
function createComponent(OriginComponent, childComponents = {}, options = {}) {
|
|
227
|
+
const {
|
|
228
|
+
context = /*#__PURE__*/_react.default.createContext({}),
|
|
229
|
+
parent = [],
|
|
230
|
+
enhancements = []
|
|
231
|
+
} = options;
|
|
232
|
+
let parents = Array.isArray(parent) ? parent : [parent];
|
|
290
233
|
if (parents.length) {
|
|
291
|
-
|
|
234
|
+
const wholeFamily = parents.reduce((acc, parent) => {
|
|
292
235
|
if (parent[_symbols.PARENT_COMPONENTS]) {
|
|
293
|
-
acc = [
|
|
236
|
+
acc = [...parent[_symbols.PARENT_COMPONENTS], ...acc];
|
|
294
237
|
}
|
|
295
238
|
return acc;
|
|
296
239
|
}, parents);
|
|
240
|
+
// @ts-ignore
|
|
297
241
|
OriginComponent[_symbols.PARENT_COMPONENTS] = wholeFamily;
|
|
298
242
|
parents = wholeFamily;
|
|
299
243
|
}
|
|
244
|
+
// @ts-ignore
|
|
300
245
|
if (OriginComponent[_symbols.CORE_COMPONENT]) {
|
|
301
246
|
parents.push(OriginComponent);
|
|
302
247
|
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
248
|
+
const Component = createComposeComponent(OriginComponent, context, [
|
|
249
|
+
// @ts-ignore
|
|
250
|
+
...enhancements.map(f => f(context, parents, createComponent, childComponents)), (0, _i18n.default)(), (0, _Children.default)(context, parents),
|
|
306
251
|
// root must be under the children
|
|
307
|
-
(0, _Root
|
|
308
|
-
context
|
|
309
|
-
parent
|
|
310
|
-
enhancements
|
|
252
|
+
(0, _Root.default)(), (0, _uncontrolledProps.default)(), (0, _staticChildren.default)(childComponents, createComponent, {
|
|
253
|
+
context,
|
|
254
|
+
parent,
|
|
255
|
+
enhancements
|
|
311
256
|
}),
|
|
312
257
|
// functionDefaultProps must be under the staticChild
|
|
313
|
-
(0, _functionDefaultProps
|
|
258
|
+
(0, _functionDefaultProps.default)(),
|
|
314
259
|
// inheritedName must be under the staticChild
|
|
315
|
-
(0, _inheritedName
|
|
260
|
+
(0, _inheritedName.default)(),
|
|
316
261
|
// dataName must be under the staticChild
|
|
317
|
-
(0, _dataName
|
|
262
|
+
(0, _dataName.default)(),
|
|
318
263
|
// enhanceEnhancement must be under the functionDefaultPropsEnhancement
|
|
319
|
-
(0, _enhance
|
|
320
|
-
// must be the last one so any properties can be raised
|
|
321
|
-
(0, _hoistProps["default"])(childComponents, context)]));
|
|
264
|
+
(0, _enhance.default)(), (0, _style.default)(childComponents, context)]);
|
|
322
265
|
Component[_symbols.CONTEXT_COMPONENT] = context;
|
|
323
266
|
Component._______childrenComponents = childComponents;
|
|
324
|
-
Component[_symbols.CREATE_COMPONENT] = function () {
|
|
325
|
-
var _OriginComponent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : OriginComponent;
|
|
326
|
-
var _childComponents = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : childComponents;
|
|
327
|
-
var _options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : options;
|
|
267
|
+
Component[_symbols.CREATE_COMPONENT] = function (_OriginComponent = OriginComponent, _childComponents = childComponents, _options = options) {
|
|
328
268
|
return createComponent(_OriginComponent, _childComponents, _options);
|
|
329
269
|
};
|
|
330
|
-
Component.newInstance = function () {
|
|
331
|
-
var _OriginComponent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : OriginComponent;
|
|
332
|
-
var _childComponents = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : childComponents;
|
|
333
|
-
var _options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : options;
|
|
270
|
+
Component.newInstance = function (_OriginComponent = OriginComponent, _childComponents = childComponents, _options = options) {
|
|
334
271
|
return createComponent(_OriginComponent, _childComponents, _options);
|
|
335
272
|
};
|
|
336
273
|
Component[_symbols.CORE_COMPONENT] = true;
|
|
337
274
|
return Component;
|
|
338
275
|
}
|
|
339
276
|
function createBaseComponent(OriginComponent) {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
Component[_symbols.CORE_COMPONENT] = true;
|
|
348
|
-
} else {
|
|
349
|
-
throw new Error('createBaseComponent accepts only functional component');
|
|
350
|
-
}
|
|
277
|
+
const Component = /*#__PURE__*/_react.default.forwardRef(OriginComponent);
|
|
278
|
+
Component.displayName = OriginComponent.displayName ?? '';
|
|
279
|
+
// @ts-ignore
|
|
280
|
+
Component.defaultProps = {
|
|
281
|
+
'data-ui-name': OriginComponent.displayName
|
|
282
|
+
};
|
|
283
|
+
Component[_symbols.CORE_COMPONENT] = true;
|
|
351
284
|
return Component;
|
|
352
285
|
}
|
|
353
286
|
//# sourceMappingURL=coreFactory.js.map
|