@semcore/core 16.5.1 → 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/utils/ariaProps.js
CHANGED
|
@@ -5,14 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.extractAriaProps = extractAriaProps;
|
|
7
7
|
function extractAriaProps(props) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const {
|
|
9
|
+
title,
|
|
10
|
+
['aria-label']: ariaLabel,
|
|
11
|
+
['aria-labelledby']: ariaLabelledby,
|
|
12
|
+
['aria-describedby']: ariaDescribedby
|
|
13
|
+
} = props;
|
|
12
14
|
return {
|
|
13
15
|
__excludeProps: ['title', 'aria-label', 'aria-labelledby', 'aria-describedby'],
|
|
14
16
|
extractedAriaProps: {
|
|
15
|
-
title
|
|
17
|
+
title,
|
|
16
18
|
'aria-label': ariaLabel,
|
|
17
19
|
'aria-labelledby': ariaLabelledby,
|
|
18
20
|
'aria-describedby': ariaDescribedby
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ariaProps.js","names":["extractAriaProps","props","title","ariaLabel","ariaLabelledby","ariaDescribedby","__excludeProps","extractedAriaProps"],"sources":["../../src/utils/ariaProps.ts"],"sourcesContent":["type AriaProps = {\n 'title'?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'aria-describedby'?: string;\n};\ntype ExtractorAriaPropsReturn = {\n __excludeProps: ['title', 'aria-label', 'aria-labelledby', 'aria-describedby'];\n extractedAriaProps: AriaProps;\n};\n\nexport function extractAriaProps(props: any): ExtractorAriaPropsReturn {\n const {\n title,\n ['aria-label']: ariaLabel,\n ['aria-labelledby']: ariaLabelledby,\n ['aria-describedby']: ariaDescribedby,\n } = props;\n\n return {\n __excludeProps: ['title', 'aria-label', 'aria-labelledby', 'aria-describedby'],\n extractedAriaProps: {\n title,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n },\n };\n}\n"],"mappings":";;;;;;AAWO,SAASA,gBAAgBA,CAACC,KAAU,EAA4B;EACrE,
|
|
1
|
+
{"version":3,"file":"ariaProps.js","names":["extractAriaProps","props","title","ariaLabel","ariaLabelledby","ariaDescribedby","__excludeProps","extractedAriaProps"],"sources":["../../src/utils/ariaProps.ts"],"sourcesContent":["type AriaProps = {\n 'title'?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'aria-describedby'?: string;\n};\ntype ExtractorAriaPropsReturn = {\n __excludeProps: ['title', 'aria-label', 'aria-labelledby', 'aria-describedby'];\n extractedAriaProps: AriaProps;\n};\n\nexport function extractAriaProps(props: any): ExtractorAriaPropsReturn {\n const {\n title,\n ['aria-label']: ariaLabel,\n ['aria-labelledby']: ariaLabelledby,\n ['aria-describedby']: ariaDescribedby,\n } = props;\n\n return {\n __excludeProps: ['title', 'aria-label', 'aria-labelledby', 'aria-describedby'],\n extractedAriaProps: {\n title,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n },\n };\n}\n"],"mappings":";;;;;;AAWO,SAASA,gBAAgBA,CAACC,KAAU,EAA4B;EACrE,MAAM;IACJC,KAAK;IACL,CAAC,YAAY,GAAGC,SAAS;IACzB,CAAC,iBAAiB,GAAGC,cAAc;IACnC,CAAC,kBAAkB,GAAGC;EACxB,CAAC,GAAGJ,KAAK;EAET,OAAO;IACLK,cAAc,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,CAAC;IAC9EC,kBAAkB,EAAE;MAClBL,KAAK;MACL,YAAY,EAAEC,SAAS;MACvB,iBAAiB,EAAEC,cAAc;MACjC,kBAAkB,EAAEC;IACtB;EACF,CAAC;AACH","ignoreList":[]}
|
package/lib/utils/ariaProps.mjs
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
export function extractAriaProps(props) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
const {
|
|
3
|
+
title,
|
|
4
|
+
['aria-label']: ariaLabel,
|
|
5
|
+
['aria-labelledby']: ariaLabelledby,
|
|
6
|
+
['aria-describedby']: ariaDescribedby
|
|
7
|
+
} = props;
|
|
6
8
|
return {
|
|
7
9
|
__excludeProps: ['title', 'aria-label', 'aria-labelledby', 'aria-describedby'],
|
|
8
10
|
extractedAriaProps: {
|
|
9
|
-
title
|
|
11
|
+
title,
|
|
10
12
|
'aria-label': ariaLabel,
|
|
11
13
|
'aria-labelledby': ariaLabelledby,
|
|
12
14
|
'aria-describedby': ariaDescribedby
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ariaProps.mjs","names":["extractAriaProps","props","title","ariaLabel","ariaLabelledby","ariaDescribedby","__excludeProps","extractedAriaProps"],"sources":["../../src/utils/ariaProps.ts"],"sourcesContent":["type AriaProps = {\n 'title'?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'aria-describedby'?: string;\n};\ntype ExtractorAriaPropsReturn = {\n __excludeProps: ['title', 'aria-label', 'aria-labelledby', 'aria-describedby'];\n extractedAriaProps: AriaProps;\n};\n\nexport function extractAriaProps(props: any): ExtractorAriaPropsReturn {\n const {\n title,\n ['aria-label']: ariaLabel,\n ['aria-labelledby']: ariaLabelledby,\n ['aria-describedby']: ariaDescribedby,\n } = props;\n\n return {\n __excludeProps: ['title', 'aria-label', 'aria-labelledby', 'aria-describedby'],\n extractedAriaProps: {\n title,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n },\n };\n}\n"],"mappings":"AAWA,OAAO,SAASA,gBAAgBA,CAACC,KAAU,EAA4B;EACrE,
|
|
1
|
+
{"version":3,"file":"ariaProps.mjs","names":["extractAriaProps","props","title","ariaLabel","ariaLabelledby","ariaDescribedby","__excludeProps","extractedAriaProps"],"sources":["../../src/utils/ariaProps.ts"],"sourcesContent":["type AriaProps = {\n 'title'?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'aria-describedby'?: string;\n};\ntype ExtractorAriaPropsReturn = {\n __excludeProps: ['title', 'aria-label', 'aria-labelledby', 'aria-describedby'];\n extractedAriaProps: AriaProps;\n};\n\nexport function extractAriaProps(props: any): ExtractorAriaPropsReturn {\n const {\n title,\n ['aria-label']: ariaLabel,\n ['aria-labelledby']: ariaLabelledby,\n ['aria-describedby']: ariaDescribedby,\n } = props;\n\n return {\n __excludeProps: ['title', 'aria-label', 'aria-labelledby', 'aria-describedby'],\n extractedAriaProps: {\n title,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n },\n };\n}\n"],"mappings":"AAWA,OAAO,SAASA,gBAAgBA,CAACC,KAAU,EAA4B;EACrE,MAAM;IACJC,KAAK;IACL,CAAC,YAAY,GAAGC,SAAS;IACzB,CAAC,iBAAiB,GAAGC,cAAc;IACnC,CAAC,kBAAkB,GAAGC;EACxB,CAAC,GAAGJ,KAAK;EAET,OAAO;IACLK,cAAc,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,CAAC;IAC9EC,kBAAkB,EAAE;MAClBL,KAAK;MACL,YAAY,EAAEC,SAAS;MACvB,iBAAiB,EAAEC,cAAc;MACjC,kBAAkB,EAAEC;IACtB;EACF,CAAC;AACH","ignoreList":[]}
|
package/lib/utils/assignProps.js
CHANGED
|
@@ -1,35 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.assignHandlers = assignHandlers;
|
|
8
8
|
exports.callAllEventHandlers = callAllEventHandlers;
|
|
9
|
-
exports
|
|
10
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
+
exports.default = assignProps;
|
|
11
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
11
|
var _ref = require("./ref");
|
|
13
12
|
var _index = require("../styled/index");
|
|
14
|
-
function callAllEventHandlers() {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
20
|
-
args[_key2] = arguments[_key2];
|
|
13
|
+
function callAllEventHandlers(...fns) {
|
|
14
|
+
return (...args) => !fns.some(fn => {
|
|
15
|
+
let result;
|
|
16
|
+
if (fn) {
|
|
17
|
+
result = fn(...args);
|
|
21
18
|
}
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
if (fn) {
|
|
25
|
-
result = fn.apply(void 0, args);
|
|
26
|
-
}
|
|
27
|
-
return typeof result === 'boolean' && !result;
|
|
28
|
-
});
|
|
29
|
-
};
|
|
19
|
+
return typeof result === 'boolean' && !result;
|
|
20
|
+
});
|
|
30
21
|
}
|
|
31
22
|
function assignHandlers(props, source) {
|
|
32
|
-
return Object.keys(source).reduce(
|
|
23
|
+
return Object.keys(source).reduce((proxySource, propName) => {
|
|
33
24
|
if (typeof source[propName] === 'function' && propName.startsWith('on')) {
|
|
34
25
|
proxySource[propName] = callAllEventHandlers(props[propName], source[propName]);
|
|
35
26
|
}
|
|
@@ -37,7 +28,7 @@ function assignHandlers(props, source) {
|
|
|
37
28
|
}, {});
|
|
38
29
|
}
|
|
39
30
|
function assignHandlersInner(props, source) {
|
|
40
|
-
return Object.keys(source).reduce(
|
|
31
|
+
return Object.keys(source).reduce((proxySource, propName) => {
|
|
41
32
|
if (propName !== 'ref' && propName.startsWith('on')) {
|
|
42
33
|
if (typeof source[propName] === 'function' && typeof props[propName] === 'function') {
|
|
43
34
|
proxySource[propName] = callAllEventHandlers(props[propName], source[propName]);
|
|
@@ -50,29 +41,31 @@ function assignHandlersInner(props, source) {
|
|
|
50
41
|
return proxySource;
|
|
51
42
|
}, {});
|
|
52
43
|
}
|
|
53
|
-
function assignProps() {
|
|
54
|
-
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
55
|
-
var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
44
|
+
function assignProps(props = {}, source = {}) {
|
|
56
45
|
// @ts-ignore
|
|
57
46
|
if (props === source) return props;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
47
|
+
const newProps = {
|
|
48
|
+
...source,
|
|
49
|
+
...props,
|
|
50
|
+
...assignHandlersInner(props, source)
|
|
51
|
+
};
|
|
52
|
+
for (const key in source) {
|
|
53
|
+
if (key.startsWith('use:')) {
|
|
54
|
+
const originalKey = key.slice('use:'.length);
|
|
55
|
+
newProps[originalKey] = source[key];
|
|
63
56
|
}
|
|
64
57
|
}
|
|
65
|
-
for (
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
newProps[
|
|
58
|
+
for (const key in props) {
|
|
59
|
+
if (key.startsWith('use:')) {
|
|
60
|
+
const originalKey = key.slice('use:'.length);
|
|
61
|
+
newProps[originalKey] = props[key];
|
|
69
62
|
}
|
|
70
63
|
}
|
|
71
64
|
|
|
72
65
|
// because react set getter for ref
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (sourceDescriptorRef
|
|
66
|
+
const sourceDescriptorRef = Object.getOwnPropertyDescriptor(source, 'ref');
|
|
67
|
+
const propsDescriptorRef = Object.getOwnPropertyDescriptor(props, 'ref');
|
|
68
|
+
if (sourceDescriptorRef?.configurable && propsDescriptorRef?.configurable) {
|
|
76
69
|
newProps.ref = (0, _ref.forkRef)(source.ref, props.ref);
|
|
77
70
|
}
|
|
78
71
|
if (props.forwardRef) {
|
|
@@ -80,10 +73,13 @@ function assignProps() {
|
|
|
80
73
|
newProps.forwardRef = newProps.ref;
|
|
81
74
|
}
|
|
82
75
|
if (source.style && props.style) {
|
|
83
|
-
newProps.style =
|
|
76
|
+
newProps.style = {
|
|
77
|
+
...source.style,
|
|
78
|
+
...props.style
|
|
79
|
+
};
|
|
84
80
|
}
|
|
85
81
|
if (source.className) {
|
|
86
|
-
newProps.className = (0, _classnames
|
|
82
|
+
newProps.className = (0, _classnames.default)(props.className, source.className);
|
|
87
83
|
}
|
|
88
84
|
if (source.styles && props.styles) {
|
|
89
85
|
newProps.styles = _index.sstyled.merge(source.styles, props.styles);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assignProps.js","names":["_classnames","_interopRequireDefault","require","_ref","_index","callAllEventHandlers","
|
|
1
|
+
{"version":3,"file":"assignProps.js","names":["_classnames","_interopRequireDefault","require","_ref","_index","callAllEventHandlers","fns","args","some","fn","result","assignHandlers","props","source","Object","keys","reduce","proxySource","propName","startsWith","assignHandlersInner","assignProps","newProps","key","originalKey","slice","length","sourceDescriptorRef","getOwnPropertyDescriptor","propsDescriptorRef","configurable","ref","forkRef","forwardRef","style","className","cn","styles","sstyled","merge"],"sources":["../../src/utils/assignProps.ts"],"sourcesContent":["import cn from 'classnames';\nimport type { CSSProperties, DetailedHTMLProps, Ref, StyleHTMLAttributes } from 'react';\n\nimport { forkRef } from './ref';\nimport { sstyled } from '../styled/index';\n\nexport function callAllEventHandlers(...fns: Array<Function | undefined>) {\n return (...args: any[]) =>\n !fns.some((fn) => {\n let result;\n if (fn) {\n result = fn(...args);\n }\n return typeof result === 'boolean' && !result;\n });\n}\n\nexport function assignHandlers(props: any, source: any) {\n return Object.keys(source).reduce((proxySource: any, propName) => {\n if (typeof source[propName] === 'function' && propName.startsWith('on')) {\n proxySource[propName] = callAllEventHandlers(props[propName], source[propName]);\n }\n return proxySource;\n }, {});\n}\n\nfunction assignHandlersInner(props: any, source: any) {\n return Object.keys(source).reduce((proxySource: any, propName) => {\n if (propName !== 'ref' && propName.startsWith('on')) {\n if (typeof source[propName] === 'function' && typeof props[propName] === 'function') {\n proxySource[propName] = callAllEventHandlers(props[propName], source[propName]);\n } else if (typeof source[propName] === 'function') {\n proxySource[propName] = source[propName];\n } else if (typeof props[propName] === 'function') {\n proxySource[propName] = props[propName];\n }\n }\n return proxySource;\n }, {});\n}\n\nexport interface AssignableProps {\n ref?: Ref<any>;\n style?: CSSProperties;\n className?: string;\n styles?: DetailedHTMLProps<StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement>;\n\n [key: string]: any;\n}\n\nexport default function assignProps<P extends AssignableProps, S extends AssignableProps>(\n props: P = {} as P,\n source: S = {} as S,\n) {\n // @ts-ignore\n if (props === source) return props;\n const newProps = {\n ...source,\n ...props,\n ...assignHandlersInner(props, source),\n };\n for (const key in source) {\n if (key.startsWith('use:')) {\n const originalKey = key.slice('use:'.length);\n newProps[originalKey] = source[key];\n }\n }\n for (const key in props) {\n if (key.startsWith('use:')) {\n const originalKey = key.slice('use:'.length);\n newProps[originalKey] = props[key];\n }\n }\n\n // because react set getter for ref\n const sourceDescriptorRef = Object.getOwnPropertyDescriptor(source, 'ref');\n const propsDescriptorRef = Object.getOwnPropertyDescriptor(props, 'ref');\n if (sourceDescriptorRef?.configurable && propsDescriptorRef?.configurable) {\n newProps.ref = forkRef(source.ref as any, props.ref as any);\n }\n\n if (props.forwardRef) {\n newProps.ref = forkRef(newProps.ref as any, props.forwardRef as any);\n newProps.forwardRef = newProps.ref;\n }\n\n if (source.style && props.style) {\n newProps.style = {\n ...source.style,\n ...props.style,\n };\n }\n\n if (source.className) {\n newProps.className = cn(props.className, source.className);\n }\n\n if (source.styles && props.styles) {\n newProps.styles = sstyled.merge(source.styles, props.styles);\n }\n\n return newProps;\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,SAASG,oBAAoBA,CAAC,GAAGC,GAAgC,EAAE;EACxE,OAAO,CAAC,GAAGC,IAAW,KACpB,CAACD,GAAG,CAACE,IAAI,CAAEC,EAAE,IAAK;IAChB,IAAIC,MAAM;IACV,IAAID,EAAE,EAAE;MACNC,MAAM,GAAGD,EAAE,CAAC,GAAGF,IAAI,CAAC;IACtB;IACA,OAAO,OAAOG,MAAM,KAAK,SAAS,IAAI,CAACA,MAAM;EAC/C,CAAC,CAAC;AACN;AAEO,SAASC,cAAcA,CAACC,KAAU,EAAEC,MAAW,EAAE;EACtD,OAAOC,MAAM,CAACC,IAAI,CAACF,MAAM,CAAC,CAACG,MAAM,CAAC,CAACC,WAAgB,EAAEC,QAAQ,KAAK;IAChE,IAAI,OAAOL,MAAM,CAACK,QAA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,QAAQ,CAACY,KAAK,GAAG;MACf,GAAGrB,MAAM,CAACqB,KAAK;MACf,GAAGtB,KAAK,CAACsB;IACX,CAAC;EACH;EAEA,IAAIrB,MAAM,CAACsB,SAAS,EAAE;IACpBb,QAAQ,CAACa,SAAS,GAAG,IAAAC,mBAAE,EAACxB,KAAK,CAACuB,SAAS,EAAEtB,MAAM,CAACsB,SAAS,CAAC;EAC5D;EAEA,IAAItB,MAAM,CAACwB,MAAM,IAAIzB,KAAK,CAACyB,MAAM,EAAE;IACjCf,QAAQ,CAACe,MAAM,GAAGC,cAAO,CAACC,KAAK,CAAC1B,MAAM,CAACwB,MAAM,EAAEzB,KAAK,CAACyB,MAAM,CAAC;EAC9D;EAEA,OAAOf,QAAQ;AACjB","ignoreList":[]}
|
|
@@ -1,27 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _cn from "classnames";
|
|
1
|
+
import cn from "classnames";
|
|
3
2
|
import { forkRef } from "./ref.mjs";
|
|
4
3
|
import "../styled/index.mjs";
|
|
5
4
|
import { sstyled } from "../styled/sstyled.mjs";
|
|
6
|
-
function callAllEventHandlers() {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
12
|
-
args[_key2] = arguments[_key2];
|
|
5
|
+
function callAllEventHandlers(...fns) {
|
|
6
|
+
return (...args) => !fns.some((fn) => {
|
|
7
|
+
let result;
|
|
8
|
+
if (fn) {
|
|
9
|
+
result = fn(...args);
|
|
13
10
|
}
|
|
14
|
-
return !
|
|
15
|
-
|
|
16
|
-
if (fn) {
|
|
17
|
-
result = fn.apply(void 0, args);
|
|
18
|
-
}
|
|
19
|
-
return typeof result === "boolean" && !result;
|
|
20
|
-
});
|
|
21
|
-
};
|
|
11
|
+
return typeof result === "boolean" && !result;
|
|
12
|
+
});
|
|
22
13
|
}
|
|
23
14
|
function assignHandlers(props, source) {
|
|
24
|
-
return Object.keys(source).reduce(
|
|
15
|
+
return Object.keys(source).reduce((proxySource, propName) => {
|
|
25
16
|
if (typeof source[propName] === "function" && propName.startsWith("on")) {
|
|
26
17
|
proxySource[propName] = callAllEventHandlers(props[propName], source[propName]);
|
|
27
18
|
}
|
|
@@ -29,7 +20,7 @@ function assignHandlers(props, source) {
|
|
|
29
20
|
}, {});
|
|
30
21
|
}
|
|
31
22
|
function assignHandlersInner(props, source) {
|
|
32
|
-
return Object.keys(source).reduce(
|
|
23
|
+
return Object.keys(source).reduce((proxySource, propName) => {
|
|
33
24
|
if (propName !== "ref" && propName.startsWith("on")) {
|
|
34
25
|
if (typeof source[propName] === "function" && typeof props[propName] === "function") {
|
|
35
26
|
proxySource[propName] = callAllEventHandlers(props[propName], source[propName]);
|
|
@@ -42,26 +33,28 @@ function assignHandlersInner(props, source) {
|
|
|
42
33
|
return proxySource;
|
|
43
34
|
}, {});
|
|
44
35
|
}
|
|
45
|
-
function assignProps() {
|
|
46
|
-
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
47
|
-
var source = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
36
|
+
function assignProps(props = {}, source = {}) {
|
|
48
37
|
if (props === source) return props;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
38
|
+
const newProps = {
|
|
39
|
+
...source,
|
|
40
|
+
...props,
|
|
41
|
+
...assignHandlersInner(props, source)
|
|
42
|
+
};
|
|
43
|
+
for (const key in source) {
|
|
44
|
+
if (key.startsWith("use:")) {
|
|
45
|
+
const originalKey = key.slice("use:".length);
|
|
46
|
+
newProps[originalKey] = source[key];
|
|
54
47
|
}
|
|
55
48
|
}
|
|
56
|
-
for (
|
|
57
|
-
if (
|
|
58
|
-
|
|
59
|
-
newProps[
|
|
49
|
+
for (const key in props) {
|
|
50
|
+
if (key.startsWith("use:")) {
|
|
51
|
+
const originalKey = key.slice("use:".length);
|
|
52
|
+
newProps[originalKey] = props[key];
|
|
60
53
|
}
|
|
61
54
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (sourceDescriptorRef
|
|
55
|
+
const sourceDescriptorRef = Object.getOwnPropertyDescriptor(source, "ref");
|
|
56
|
+
const propsDescriptorRef = Object.getOwnPropertyDescriptor(props, "ref");
|
|
57
|
+
if ((sourceDescriptorRef == null ? void 0 : sourceDescriptorRef.configurable) && (propsDescriptorRef == null ? void 0 : propsDescriptorRef.configurable)) {
|
|
65
58
|
newProps.ref = forkRef(source.ref, props.ref);
|
|
66
59
|
}
|
|
67
60
|
if (props.forwardRef) {
|
|
@@ -69,10 +62,13 @@ function assignProps() {
|
|
|
69
62
|
newProps.forwardRef = newProps.ref;
|
|
70
63
|
}
|
|
71
64
|
if (source.style && props.style) {
|
|
72
|
-
newProps.style =
|
|
65
|
+
newProps.style = {
|
|
66
|
+
...source.style,
|
|
67
|
+
...props.style
|
|
68
|
+
};
|
|
73
69
|
}
|
|
74
70
|
if (source.className) {
|
|
75
|
-
newProps.className =
|
|
71
|
+
newProps.className = cn(props.className, source.className);
|
|
76
72
|
}
|
|
77
73
|
if (source.styles && props.styles) {
|
|
78
74
|
newProps.styles = sstyled.merge(source.styles, props.styles);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assignProps.mjs","names":["cn","forkRef","sstyled","callAllEventHandlers","
|
|
1
|
+
{"version":3,"file":"assignProps.mjs","names":["cn","forkRef","sstyled","callAllEventHandlers","fns","args","some","fn","result","assignHandlers","props","source","Object","keys","reduce","proxySource","propName","startsWith","assignHandlersInner","assignProps","newProps","key","originalKey","slice","length","sourceDescriptorRef","getOwnPropertyDescriptor","propsDescriptorRef","configurable","ref","forwardRef","style","className","styles","merge"],"sources":["../../src/utils/assignProps.ts"],"sourcesContent":["import cn from 'classnames';\nimport type { CSSProperties, DetailedHTMLProps, Ref, StyleHTMLAttributes } from 'react';\n\nimport { forkRef } from './ref';\nimport { sstyled } from '../styled/index';\n\nexport function callAllEventHandlers(...fns: Array<Function | undefined>) {\n return (...args: any[]) =>\n !fns.some((fn) => {\n let result;\n if (fn) {\n result = fn(...args);\n }\n return typeof result === 'boolean' && !result;\n });\n}\n\nexport function assignHandlers(props: any, source: any) {\n return Object.keys(source).reduce((proxySource: any, propName) => {\n if (typeof source[propName] === 'function' && propName.startsWith('on')) {\n proxySource[propName] = callAllEventHandlers(props[propName], source[propName]);\n }\n return proxySource;\n }, {});\n}\n\nfunction assignHandlersInner(props: any, source: any) {\n return Object.keys(source).reduce((proxySource: any, propName) => {\n if (propName !== 'ref' && propName.startsWith('on')) {\n if (typeof source[propName] === 'function' && typeof props[propName] === 'function') {\n proxySource[propName] = callAllEventHandlers(props[propName], source[propName]);\n } else if (typeof source[propName] === 'function') {\n proxySource[propName] = source[propName];\n } else if (typeof props[propName] === 'function') {\n proxySource[propName] = props[propName];\n }\n }\n return proxySource;\n }, {});\n}\n\nexport interface AssignableProps {\n ref?: Ref<any>;\n style?: CSSProperties;\n className?: string;\n styles?: DetailedHTMLProps<StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement>;\n\n [key: string]: any;\n}\n\nexport default function assignProps<P extends AssignableProps, S extends AssignableProps>(\n props: P = {} as P,\n source: S = {} as S,\n) {\n // @ts-ignore\n if (props === source) return props;\n const newProps = {\n ...source,\n ...props,\n ...assignHandlersInner(props, source),\n };\n for (const key in source) {\n if (key.startsWith('use:')) {\n const originalKey = key.slice('use:'.length);\n newProps[originalKey] = source[key];\n }\n }\n for (const key in props) {\n if (key.startsWith('use:')) {\n const originalKey = key.slice('use:'.length);\n newProps[originalKey] = props[key];\n }\n }\n\n // because react set getter for ref\n const sourceDescriptorRef = Object.getOwnPropertyDescriptor(source, 'ref');\n const propsDescriptorRef = Object.getOwnPropertyDescriptor(props, 'ref');\n if (sourceDescriptorRef?.configurable && propsDescriptorRef?.configurable) {\n newProps.ref = forkRef(source.ref as any, props.ref as any);\n }\n\n if (props.forwardRef) {\n newProps.ref = forkRef(newProps.ref as any, props.forwardRef as any);\n newProps.forwardRef = newProps.ref;\n }\n\n if (source.style && props.style) {\n newProps.style = {\n ...source.style,\n ...props.style,\n };\n }\n\n if (source.className) {\n newProps.className = cn(props.className, source.className);\n }\n\n if (source.styles && props.styles) {\n newProps.styles = sstyled.merge(source.styles, props.styles);\n }\n\n return newProps;\n}\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,YAAY;AAG3B,SAASC,OAAO,QAAQ,WAAO;AAC/B,SAASC,OAAO,QAAQ,qBAAiB;AAEzC,OAAO,SAASC,oBAAoBA,CAAC,GAAGC,GAAgC,EAAE;EACxE,OAAO,CAAC,GAAGC,IAAW,KACpB,CAACD,GAAG,CAACE,IAAI,CAAEC,EAAE,IAAK;IAChB,IAAIC,MAAM;IACV,IAAID,EAAE,EAAE;MACNC,MAAM,GAAGD,EAAE,CAAC,GAAGF,IAAI,CAAC;IACtB;IACA,OAAO,OAAOG,MAAM,KAAK,SAAS,IAAI,CAACA,MAAM;EAC/C,CAAC,CAAC;AACN;AAEA,OAAO,SAASC,cAAcA,CAACC,KAAU,EAAEC,MAAW,EAAE;EACtD,OAAOC,MAAM,CAACC,IAAI,CAACF,MAAM,CAAC,CAACG,MAAM,CAAC,CAACC,WAAgB,EAAEC,QAAQ,KAAK;IAChE,IAAI,OAAOL,MAAM,CAACK,QAAQ,CAAC,KAAK,UAAU,IAAIA,QAAQ,CAACC,UAAU,CAAC,IAAI,CAAC,EAAE;MACvEF,WAAW,CAACC,QAAQ,CAAC,GAAGb,oBAAoB,CAACO,KAAK,CAACM,QAAQ,CAAC,EAAEL,MAAM,CAACK,QAAQ,CAAC,CAAC;IACjF;IACA,OAAOD,WAAW;EACpB,CAAC,EAAE,CAAC,CAAC,CAAC;AACR;AAEA,SAASG,mBAAmBA,CAACR,KAAU,EAAEC,MAAW,EAAE;EACpD,OAAOC,MAAM,CAACC,IAAI,CAACF,MAAM,CAAC,CAACG,MAAM,CAAC,CA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