@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
|
@@ -1,25 +1,18 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
-
import _toArray from "@babel/runtime/helpers/esm/toArray";
|
|
4
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
import _toPropertyKey from "@babel/runtime/helpers/esm/toPropertyKey";
|
|
6
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
7
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
1
|
import { callAllEventHandlers } from "../utils/assignProps.mjs";
|
|
9
2
|
import capitalizeFirstLetter from "../utils/capitalizeFirstLetter.mjs";
|
|
10
3
|
function assign(target, source) {
|
|
11
|
-
return Object.defineProperties(target, Object.keys(source).reduce(
|
|
4
|
+
return Object.defineProperties(target, Object.keys(source).reduce((descriptors, key) => {
|
|
12
5
|
descriptors[key] = Object.getOwnPropertyDescriptor(source, key);
|
|
13
6
|
return descriptors;
|
|
14
7
|
}, {}));
|
|
15
8
|
}
|
|
16
9
|
function defaultProp(prop) {
|
|
17
|
-
return
|
|
10
|
+
return `default${capitalizeFirstLetter(prop)}`;
|
|
18
11
|
}
|
|
19
12
|
function handlerProp(prop) {
|
|
20
13
|
if (prop === "value") prop = "";
|
|
21
14
|
if (prop === "checked") prop = "";
|
|
22
|
-
return
|
|
15
|
+
return `on${capitalizeFirstLetter(prop)}Change`;
|
|
23
16
|
}
|
|
24
17
|
function isControlled(propValue) {
|
|
25
18
|
return propValue !== void 0;
|
|
@@ -28,48 +21,46 @@ function uncontrolledProp(self, propName, propValue, propDefaultValue, propHandl
|
|
|
28
21
|
function getValue() {
|
|
29
22
|
return isControlled(propValue) ? propValue : propName in self.state ? self.state[propName] : propDefaultValue;
|
|
30
23
|
}
|
|
31
|
-
return [getValue(),
|
|
32
|
-
|
|
24
|
+
return [getValue(), (value, ...args) => {
|
|
25
|
+
const oldValue = getValue();
|
|
33
26
|
if (oldValue === value) return false;
|
|
34
|
-
if (!isControlled(propValue)) self.setState(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return callAllEventHandlers.apply(void 0, [propHandler].concat(_toConsumableArray(chainHandler))).apply(void 0, [value].concat(args));
|
|
27
|
+
if (!isControlled(propValue)) self.setState({
|
|
28
|
+
[propName]: value
|
|
29
|
+
});
|
|
30
|
+
return callAllEventHandlers(propHandler, ...chainHandler)(value, ...args);
|
|
39
31
|
}];
|
|
40
32
|
}
|
|
41
33
|
function uncontrolledUniversal(props, config, uncontrolledProp2) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
34
|
+
const handlerProps = {};
|
|
35
|
+
const uncontrolledProps = Object.keys(config).reduce((result, propName) => {
|
|
36
|
+
const handlerName = handlerProp(propName);
|
|
37
|
+
const defaultPropName = defaultProp(propName);
|
|
38
|
+
const {
|
|
39
|
+
[defaultPropName]: propDefaultValue,
|
|
40
|
+
[propName]: propValue,
|
|
41
|
+
[handlerName]: propHandler,
|
|
42
|
+
...other
|
|
43
|
+
} = result;
|
|
47
44
|
if (propDefaultValue === void 0) {
|
|
48
45
|
console.warn(defaultPropName, 'must be installed in "defaultProps"');
|
|
49
46
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (Array.isArray(setter))
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
setter = _setter2[0];
|
|
56
|
-
chainHandler = _setter2.slice(1);
|
|
57
|
-
}
|
|
58
|
-
setter = setter || function(v) {
|
|
59
|
-
return v;
|
|
60
|
-
};
|
|
61
|
-
var _uncontrolledProp = uncontrolledProp2(propName, propValue, propDefaultValue, propHandler, chainHandler), _uncontrolledProp2 = _slicedToArray(_uncontrolledProp, 2), value = _uncontrolledProp2[0], handler = _uncontrolledProp2[1];
|
|
47
|
+
let setter = config[propName];
|
|
48
|
+
let chainHandler = [];
|
|
49
|
+
if (Array.isArray(setter)) [setter, ...chainHandler] = setter;
|
|
50
|
+
setter = setter || ((v) => v);
|
|
51
|
+
const [value, handler] = uncontrolledProp2(propName, propValue, propDefaultValue, propHandler, chainHandler);
|
|
62
52
|
handlerProps[propName] = handler;
|
|
63
|
-
return
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
53
|
+
return {
|
|
54
|
+
...other,
|
|
55
|
+
[propName]: value,
|
|
56
|
+
[handlerName]: (eventOrValue, ...args) => {
|
|
57
|
+
const result2 = [setter(eventOrValue, ...args), ...args];
|
|
58
|
+
if (eventOrValue == null ? void 0 : eventOrValue.target) {
|
|
59
|
+
result2.push(eventOrValue);
|
|
60
|
+
}
|
|
61
|
+
return handler(...result2);
|
|
70
62
|
}
|
|
71
|
-
|
|
72
|
-
}));
|
|
63
|
+
};
|
|
73
64
|
}, props);
|
|
74
65
|
return [uncontrolledProps, handlerProps];
|
|
75
66
|
}
|
|
@@ -78,25 +69,26 @@ function uncontrolled(self, props, config) {
|
|
|
78
69
|
}
|
|
79
70
|
function Enhancement() {
|
|
80
71
|
return {
|
|
81
|
-
condition: function
|
|
72
|
+
condition: function(Component) {
|
|
82
73
|
return Boolean(Component.prototype.uncontrolledProps);
|
|
83
74
|
},
|
|
84
|
-
init: function
|
|
75
|
+
init: function() {
|
|
85
76
|
this.state = this.state || {};
|
|
86
77
|
assign(this, {
|
|
87
78
|
get handlers() {
|
|
88
|
-
|
|
79
|
+
const [, uncontrolledHandlers] = uncontrolled(this, this.props, this.uncontrolledProps());
|
|
89
80
|
return uncontrolledHandlers;
|
|
90
81
|
}
|
|
91
82
|
});
|
|
92
83
|
},
|
|
93
|
-
context: function
|
|
94
|
-
return
|
|
84
|
+
context: function(context) {
|
|
85
|
+
return {
|
|
86
|
+
...context,
|
|
95
87
|
handlers: this.handlers
|
|
96
|
-
}
|
|
88
|
+
};
|
|
97
89
|
},
|
|
98
|
-
asProps: function
|
|
99
|
-
|
|
90
|
+
asProps: function(props) {
|
|
91
|
+
const [uncontrolledProps] = uncontrolled(this, props, this.uncontrolledProps());
|
|
100
92
|
return uncontrolledProps;
|
|
101
93
|
}
|
|
102
94
|
};
|
package/lib/esm/register.mjs
CHANGED
|
@@ -1,28 +1,20 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
_classCallCheck(this, Register2);
|
|
2
|
+
class Register {
|
|
3
|
+
constructor() {
|
|
7
4
|
_defineProperty(this, "data", {});
|
|
8
5
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
value: function get(name, defaultValue) {
|
|
12
|
-
if (name in this.data) {
|
|
13
|
-
return this.data[name];
|
|
14
|
-
} else {
|
|
15
|
-
return this.set(name, defaultValue);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}, {
|
|
19
|
-
key: "set",
|
|
20
|
-
value: function set(name, value) {
|
|
21
|
-
this.data[name] = value;
|
|
6
|
+
get(name, defaultValue) {
|
|
7
|
+
if (name in this.data) {
|
|
22
8
|
return this.data[name];
|
|
9
|
+
} else {
|
|
10
|
+
return this.set(name, defaultValue);
|
|
23
11
|
}
|
|
24
|
-
}
|
|
25
|
-
|
|
12
|
+
}
|
|
13
|
+
set(name, value) {
|
|
14
|
+
this.data[name] = value;
|
|
15
|
+
return this.data[name];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
26
18
|
const register = new Register();
|
|
27
19
|
export {
|
|
28
20
|
Register,
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _Symbol = function _Symbol2(key) {
|
|
4
|
-
return typeof Symbol !== "undefined" ? Symbol(key) : key;
|
|
5
|
-
};
|
|
6
|
-
var KEYS = {
|
|
1
|
+
const _Symbol = (key) => typeof Symbol !== "undefined" ? Symbol(key) : key;
|
|
2
|
+
const KEYS = {
|
|
7
3
|
__id__: _Symbol("__id__"),
|
|
8
4
|
__store__: _Symbol("__store__"),
|
|
9
5
|
__prev__: _Symbol("__prev__"),
|
|
@@ -18,44 +14,48 @@ var KEYS = {
|
|
|
18
14
|
*/
|
|
19
15
|
__classProp__: "className"
|
|
20
16
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
let index = 0;
|
|
18
|
+
const use = (obj) => {
|
|
19
|
+
const result = {};
|
|
24
20
|
result[KEYS.__use__] = obj;
|
|
25
21
|
return result;
|
|
26
22
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
for (
|
|
34
|
-
|
|
35
|
-
if (!
|
|
36
|
-
if (!
|
|
37
|
-
|
|
38
|
-
|
|
23
|
+
const create = (args) => {
|
|
24
|
+
const len = args.length;
|
|
25
|
+
let newStyle = {};
|
|
26
|
+
let id = "";
|
|
27
|
+
let vars = null;
|
|
28
|
+
let uses = null;
|
|
29
|
+
for (let i = 0; i < len; i++) {
|
|
30
|
+
const style2 = args[i];
|
|
31
|
+
if (!style2) continue;
|
|
32
|
+
if (!style2[KEYS.__id__]) {
|
|
33
|
+
style2[KEYS.__id__] = ++index;
|
|
34
|
+
style2[KEYS.__store__] = {
|
|
35
|
+
["_" + style2[KEYS.__id__]]: style2
|
|
36
|
+
};
|
|
39
37
|
}
|
|
40
|
-
id += "_" +
|
|
41
|
-
if (
|
|
42
|
-
vars = Object.assign(vars || {},
|
|
38
|
+
id += "_" + style2[KEYS.__id__];
|
|
39
|
+
if (style2[KEYS.__style__]) {
|
|
40
|
+
vars = Object.assign(vars || {}, style2[KEYS.__style__]);
|
|
43
41
|
}
|
|
44
|
-
if (
|
|
45
|
-
uses = Object.assign(uses || {},
|
|
42
|
+
if (style2[KEYS.__use__]) {
|
|
43
|
+
uses = Object.assign(uses || {}, style2[KEYS.__use__]);
|
|
46
44
|
}
|
|
47
|
-
if (
|
|
48
|
-
newStyle =
|
|
45
|
+
if (style2[KEYS.__store__][id]) {
|
|
46
|
+
newStyle = style2[KEYS.__store__][id];
|
|
49
47
|
continue;
|
|
50
48
|
}
|
|
51
49
|
newStyle = Object.create(newStyle);
|
|
52
|
-
for (
|
|
50
|
+
for (const key in style2) {
|
|
53
51
|
if (key in KEYS) continue;
|
|
54
|
-
newStyle[key] = appendClassName(
|
|
52
|
+
newStyle[key] = appendClassName(style2[key], newStyle[key]);
|
|
55
53
|
}
|
|
56
|
-
|
|
54
|
+
style2[KEYS.__store__][id] = newStyle;
|
|
57
55
|
newStyle[KEYS.__id__] = index;
|
|
58
|
-
newStyle[KEYS.__store__] =
|
|
56
|
+
newStyle[KEYS.__store__] = {
|
|
57
|
+
["_" + style2[KEYS.__id__]]: newStyle
|
|
58
|
+
};
|
|
59
59
|
}
|
|
60
60
|
if (vars || use) {
|
|
61
61
|
newStyle = Object.create(newStyle);
|
|
@@ -64,130 +64,117 @@ var create = function create2(args) {
|
|
|
64
64
|
}
|
|
65
65
|
return newStyle;
|
|
66
66
|
};
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
serverStyles2 += '<style type="text/css" id="'.concat(id, '">').concat(serverMap[id], "</style>");
|
|
76
|
-
}
|
|
77
|
-
return serverStyles2;
|
|
67
|
+
const isSSR = !(typeof window !== "undefined" && window.document && window.document.createElement);
|
|
68
|
+
const serverMap = {};
|
|
69
|
+
const getStyles = () => ({
|
|
70
|
+
map: serverMap,
|
|
71
|
+
get css() {
|
|
72
|
+
let serverStyles2 = "";
|
|
73
|
+
for (const id in serverMap) {
|
|
74
|
+
serverStyles2 += `<style type="text/css" id="${id}">${serverMap[id]}</style>`;
|
|
78
75
|
}
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
76
|
+
return serverStyles2;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
const clearStyles = () => {
|
|
82
80
|
serverStyles = "";
|
|
83
81
|
};
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
var css = function css2(code, hash) {
|
|
89
|
-
var id = "reshadow-".concat(hash);
|
|
82
|
+
const RESHADOW_ID = "__reshadow__";
|
|
83
|
+
const appendChildToDocumentHead = (element) => document.head.appendChild(element);
|
|
84
|
+
const css = (code, hash) => {
|
|
85
|
+
const id = `reshadow-${hash}`;
|
|
90
86
|
if (isSSR) {
|
|
91
87
|
serverMap[id] = code;
|
|
92
88
|
return;
|
|
93
89
|
}
|
|
94
|
-
|
|
90
|
+
let container = document.getElementById(RESHADOW_ID);
|
|
95
91
|
if (!container) {
|
|
96
92
|
container = document.createElement("object");
|
|
97
93
|
container.id = RESHADOW_ID;
|
|
98
94
|
if (document.head) {
|
|
99
95
|
appendChildToDocumentHead(container);
|
|
100
96
|
} else {
|
|
101
|
-
document.addEventListener("DOMContentLoaded",
|
|
97
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
102
98
|
appendChildToDocumentHead(container);
|
|
103
99
|
});
|
|
104
100
|
}
|
|
105
101
|
}
|
|
106
|
-
|
|
107
|
-
if (!
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
container.appendChild(
|
|
102
|
+
let css2 = document.getElementById(id);
|
|
103
|
+
if (!css2) {
|
|
104
|
+
css2 = document.createElement("style");
|
|
105
|
+
css2.id = id;
|
|
106
|
+
css2.type = "text/css";
|
|
107
|
+
container.appendChild(css2);
|
|
112
108
|
}
|
|
113
|
-
|
|
109
|
+
css2.innerHTML = code;
|
|
114
110
|
};
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
111
|
+
let styles = {};
|
|
112
|
+
let style;
|
|
113
|
+
const stack = [];
|
|
114
|
+
const styled = (elem) => {
|
|
115
|
+
const curr = stack.pop() || [];
|
|
120
116
|
styles = curr[0] || styles;
|
|
121
117
|
style = curr[1] || style;
|
|
122
|
-
|
|
123
|
-
|
|
118
|
+
styled[KEYS.__styles__] = styles;
|
|
119
|
+
styled[KEYS.__style__] = style;
|
|
124
120
|
return elem;
|
|
125
121
|
};
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
122
|
+
styled[KEYS.__styles__] = styles;
|
|
123
|
+
const set = (args, newStyle) => {
|
|
124
|
+
const newStyles = create(args);
|
|
129
125
|
stack.push([styles, style]);
|
|
130
126
|
styles = newStyles;
|
|
131
127
|
style = newStyle;
|
|
132
128
|
if (styles[KEYS.__style__]) {
|
|
133
129
|
style = style ? Object.assign({}, style, styles[KEYS.__style__]) : styles[KEYS.__style__];
|
|
134
130
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
var parseAttribute = function parseAttribute2(name) {
|
|
146
|
-
return name.replace(MOD_PREFIX, "").split(MOD_SEPARATOR);
|
|
147
|
-
};
|
|
148
|
-
var appendClassName = function appendClassName2(className) {
|
|
149
|
-
var cn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
|
|
131
|
+
styled[KEYS.__styles__] = styles;
|
|
132
|
+
styled[KEYS.__style__] = style;
|
|
133
|
+
};
|
|
134
|
+
const USE_PREFIX = "use--";
|
|
135
|
+
const ELEMENT_PREFIX = "__";
|
|
136
|
+
const MOD_PREFIX = "_";
|
|
137
|
+
const MOD_SEPARATOR = "_";
|
|
138
|
+
const parseElement = (name) => name.replace(ELEMENT_PREFIX, "");
|
|
139
|
+
const parseAttribute = (name) => name.replace(MOD_PREFIX, "").split(MOD_SEPARATOR);
|
|
140
|
+
const appendClassName = (className, cn = "") => {
|
|
150
141
|
if (className) {
|
|
151
142
|
cn += (cn ? " " : "") + className;
|
|
152
143
|
}
|
|
153
144
|
return cn;
|
|
154
145
|
};
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
return appendClassName(styles2[ELEMENT_PREFIX + key], cn);
|
|
158
|
-
};
|
|
159
|
-
var appendModifier = function appendModifier2(styles2, key, value) {
|
|
160
|
-
var cn = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "";
|
|
146
|
+
const appendElement = (styles2, key, cn = "") => appendClassName(styles2[ELEMENT_PREFIX + key], cn);
|
|
147
|
+
const appendModifier = (styles2, key, value, cn = "") => {
|
|
161
148
|
if (value === void 0 || value === null || value === false || value === "") return cn;
|
|
162
149
|
cn = appendClassName(styles2[MOD_PREFIX + key], cn);
|
|
163
|
-
if (typeof value === "boolean" ||
|
|
150
|
+
if (typeof value === "boolean" || typeof value === "object" || typeof value === "function") return cn;
|
|
164
151
|
cn = appendClassName(styles2[MOD_SEPARATOR + key + MOD_SEPARATOR + value], cn);
|
|
165
152
|
return cn;
|
|
166
153
|
};
|
|
167
154
|
function map(element) {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
for (
|
|
176
|
-
|
|
155
|
+
const currStyles = styled[KEYS.__styles__];
|
|
156
|
+
const nextProps = {};
|
|
157
|
+
let cn = appendElement(currStyles, element);
|
|
158
|
+
let vars = null;
|
|
159
|
+
const uses = currStyles[KEYS.__use__] || {};
|
|
160
|
+
const len = arguments.length;
|
|
161
|
+
let useProps;
|
|
162
|
+
for (let i = len - 1; i > 0; i--) {
|
|
163
|
+
const currProps = arguments[i];
|
|
177
164
|
if (!currProps) continue;
|
|
178
165
|
useProps = useProps || currProps[KEYS.__use__];
|
|
179
166
|
if (!vars && KEYS.__style__ in currProps) {
|
|
180
|
-
vars =
|
|
167
|
+
vars = styled[KEYS.__style__];
|
|
181
168
|
}
|
|
182
|
-
for (
|
|
169
|
+
for (const key in currProps) {
|
|
183
170
|
if (key === KEYS.__use__ || key === KEYS.__style__ || key in nextProps) {
|
|
184
171
|
continue;
|
|
185
172
|
}
|
|
186
|
-
|
|
173
|
+
const value = currProps[key];
|
|
187
174
|
cn = appendModifier(currStyles, key, value, cn);
|
|
188
|
-
|
|
175
|
+
const valueType = typeof value;
|
|
189
176
|
if (valueType === "string" || valueType === "boolean" || valueType === "number") {
|
|
190
|
-
|
|
177
|
+
const useKey = key + "_" + value;
|
|
191
178
|
if (key + "_true" in uses || useKey in uses) {
|
|
192
179
|
cn = appendModifier(currStyles, USE_PREFIX + key, value, cn);
|
|
193
180
|
if (uses[useKey]) {
|
|
@@ -199,9 +186,9 @@ function map(element) {
|
|
|
199
186
|
}
|
|
200
187
|
}
|
|
201
188
|
if (useProps) {
|
|
202
|
-
for (
|
|
203
|
-
|
|
204
|
-
cn = appendModifier(currStyles, USE_PREFIX +
|
|
189
|
+
for (const key in useProps) {
|
|
190
|
+
const value = useProps[key];
|
|
191
|
+
cn = appendModifier(currStyles, USE_PREFIX + key, value, cn);
|
|
205
192
|
}
|
|
206
193
|
}
|
|
207
194
|
cn = appendClassName(nextProps[KEYS.__classProp__], cn);
|
|
@@ -229,6 +216,6 @@ export {
|
|
|
229
216
|
parseAttribute,
|
|
230
217
|
parseElement,
|
|
231
218
|
set,
|
|
232
|
-
|
|
219
|
+
styled,
|
|
233
220
|
use
|
|
234
221
|
};
|
|
@@ -1,28 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _cn from "classnames";
|
|
1
|
+
import cn from "classnames";
|
|
3
2
|
import { getStyles as getStyles$1 } from "./reshadow-core.mjs";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
serverStyles += "<style type='text/css' id='".concat(id, "'>").concat(serverMap[id], "</style>");
|
|
14
|
-
}
|
|
15
|
-
return serverStyles;
|
|
3
|
+
const RESHADOW_ID = "__reshadow__";
|
|
4
|
+
const isSSR = !(typeof window !== "undefined" && window.document && window.document.createElement);
|
|
5
|
+
const serverMap = getStyles$1().map;
|
|
6
|
+
const getStyles = () => ({
|
|
7
|
+
map: serverMap,
|
|
8
|
+
get css() {
|
|
9
|
+
let serverStyles = "";
|
|
10
|
+
for (const id in serverMap) {
|
|
11
|
+
serverStyles += `<style type='text/css' id='${id}'>${serverMap[id]}</style>`;
|
|
16
12
|
}
|
|
17
|
-
|
|
18
|
-
}
|
|
13
|
+
return serverStyles;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
19
16
|
function insert(code, hash) {
|
|
20
|
-
|
|
17
|
+
const id = "reshadow-".concat(hash);
|
|
21
18
|
if (isSSR) {
|
|
22
19
|
serverMap[id] = code;
|
|
23
20
|
return;
|
|
24
21
|
}
|
|
25
|
-
|
|
22
|
+
let container = document.getElementById(RESHADOW_ID);
|
|
26
23
|
if (!container) {
|
|
27
24
|
container = document.createElement("object");
|
|
28
25
|
container.id = RESHADOW_ID;
|
|
@@ -34,7 +31,7 @@ function insert(code, hash) {
|
|
|
34
31
|
});
|
|
35
32
|
}
|
|
36
33
|
}
|
|
37
|
-
|
|
34
|
+
let css = document.getElementById(id);
|
|
38
35
|
if (!css) {
|
|
39
36
|
css = document.createElement("style");
|
|
40
37
|
css.id = id;
|
|
@@ -43,35 +40,30 @@ function insert(code, hash) {
|
|
|
43
40
|
}
|
|
44
41
|
css.innerHTML = code;
|
|
45
42
|
}
|
|
46
|
-
function merge() {
|
|
47
|
-
|
|
48
|
-
var s2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
49
|
-
return Object.entries(s2).reduce(function(acc, _ref) {
|
|
50
|
-
var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], value = _ref2[1];
|
|
43
|
+
function merge(s1 = {}, s2 = {}) {
|
|
44
|
+
return Object.entries(s2).reduce((acc, [key, value]) => {
|
|
51
45
|
if (key.startsWith("@") || key.startsWith("--")) {
|
|
52
46
|
acc[key] = value;
|
|
53
47
|
} else {
|
|
54
|
-
acc[key] =
|
|
48
|
+
acc[key] = cn(acc[key], value);
|
|
55
49
|
}
|
|
56
50
|
return acc;
|
|
57
51
|
}, Object.assign({}, s1));
|
|
58
52
|
}
|
|
59
53
|
function getClassAndVars(styles, name, props) {
|
|
60
54
|
function getPropValue(key, props2) {
|
|
61
|
-
|
|
62
|
-
return (_props = props2["use:".concat(key)]) !== null && _props !== void 0 ? _props : props2[key];
|
|
55
|
+
return props2[`use:${key}`] ?? props2[key];
|
|
63
56
|
}
|
|
64
|
-
return Object.entries(styles).reduce(
|
|
65
|
-
var _ref4 = _slicedToArray(_ref3, 2), key = _ref4[0], value = _ref4[1];
|
|
57
|
+
return Object.entries(styles).reduce((acc, [key, value]) => {
|
|
66
58
|
if (key.startsWith("--")) {
|
|
67
59
|
acc[1][value] = getPropValue(key.substring(2), props);
|
|
68
60
|
} else if (name === key) {
|
|
69
61
|
acc[0][value] = true;
|
|
70
62
|
} else {
|
|
71
|
-
|
|
72
|
-
|
|
63
|
+
const [mod, modValue] = key.split("=");
|
|
64
|
+
const propValue = getPropValue(mod, props);
|
|
73
65
|
if (modValue === void 0) {
|
|
74
|
-
acc[0][value] = Boolean(propValue
|
|
66
|
+
acc[0][value] = Boolean(propValue ?? false);
|
|
75
67
|
} else {
|
|
76
68
|
acc[0][value] = propValue == modValue;
|
|
77
69
|
}
|
|
@@ -79,14 +71,13 @@ function getClassAndVars(styles, name, props) {
|
|
|
79
71
|
return acc;
|
|
80
72
|
}, [{}, {}]);
|
|
81
73
|
}
|
|
82
|
-
|
|
74
|
+
const reshadowMap = /* @__PURE__ */ new WeakMap();
|
|
83
75
|
function reshadowToShadow(obj) {
|
|
84
76
|
if (reshadowMap.has(obj)) {
|
|
85
77
|
return reshadowMap.get(obj);
|
|
86
78
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
var n = name;
|
|
79
|
+
const shadowStyle = Object.entries(obj).reduce((style, [name, value]) => {
|
|
80
|
+
let n = name;
|
|
90
81
|
if (name.startsWith("__")) {
|
|
91
82
|
n = name.replace(/^__/, "");
|
|
92
83
|
} else if (name.startsWith("_")) {
|
|
@@ -98,13 +89,12 @@ function reshadowToShadow(obj) {
|
|
|
98
89
|
reshadowMap.set(obj, shadowStyle);
|
|
99
90
|
return shadowStyle;
|
|
100
91
|
}
|
|
101
|
-
function sstyled() {
|
|
102
|
-
var styles = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
92
|
+
function sstyled(styles = {}) {
|
|
103
93
|
return {
|
|
104
|
-
cn
|
|
105
|
-
|
|
94
|
+
cn(name, props) {
|
|
95
|
+
const [classes, style] = getClassAndVars(reshadowToShadow(styles), name, props);
|
|
106
96
|
if (Object.keys(classes).length) {
|
|
107
|
-
props.className =
|
|
97
|
+
props.className = cn(props.className, classes);
|
|
108
98
|
}
|
|
109
99
|
if (Object.keys(style).length) {
|
|
110
100
|
props.style = Object.assign(style, props.style);
|