@semcore/core 16.5.1 → 17.0.0-prerelease.17
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/styled/sstyled.mjs
CHANGED
|
@@ -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);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sstyled.mjs","names":["cn","getStyles","reshadowGetStyles","RESHADOW_ID","isSSR","window","document","createElement","serverMap","map","css","serverStyles","id","
|
|
1
|
+
{"version":3,"file":"sstyled.mjs","names":["cn","getStyles","reshadowGetStyles","RESHADOW_ID","isSSR","window","document","createElement","serverMap","map","css","serverStyles","id","insert","code","hash","concat","container","getElementById","head","appendChild","addEventListener","type","innerHTML","merge","s1","s2","Object","entries","reduce","acc","key","value","startsWith","assign","getClassAndVars","styles","name","props","getPropValue","substring","mod","modValue","split","propValue","undefined","Boolean","reshadowMap","WeakMap","reshadowToShadow","obj","has","get","shadowStyle","style","n","replace","set","sstyled","classes","keys","length","className","_css","Error","SHADOW_STYLES","Symbol"],"sources":["../../src/styled/sstyled.tsx"],"sourcesContent":["import cn from 'classnames';\nimport type React from 'react';\n\n/** @ts-ignore */\nimport { getStyles as reshadowGetStyles } from './reshadow-core';\n\nconst RESHADOW_ID = '__reshadow__';\n\nconst isSSR = !(typeof window !== 'undefined' && window.document && window.document.createElement);\n\nconst serverMap = reshadowGetStyles().map as any;\n\nconst getStyles = () => ({\n map: serverMap,\n get css() {\n let serverStyles = '';\n for (const id in serverMap) {\n serverStyles += `<style type='text/css' id='${id}'>${serverMap[id]}</style>`;\n }\n return serverStyles;\n },\n});\n\nfunction insert(code: any, hash: any) {\n const id = 'reshadow-'.concat(hash);\n\n if (isSSR) {\n serverMap[id] = code;\n return;\n }\n\n let container = document.getElementById(RESHADOW_ID);\n\n if (!container) {\n container = document.createElement('object');\n container.id = RESHADOW_ID;\n\n if (document.head) {\n document.head.appendChild(container);\n } else {\n document.addEventListener('DOMContentLoaded', function () {\n document.head.appendChild(container as any);\n });\n }\n }\n\n let css = document.getElementById(id);\n\n if (!css) {\n css = document.createElement('style');\n css.id = id;\n // @ts-ignore\n css.type = 'text/css';\n container.appendChild(css);\n }\n\n css.innerHTML = code;\n}\n\nfunction merge(s1 = {}, s2 = {}) {\n return Object.entries(s2).reduce((acc: any, [key, value]: any) => {\n if (key.startsWith('@') || key.startsWith('--')) {\n acc[key] = value;\n } else {\n acc[key] = cn(acc[key], value);\n }\n return acc;\n }, Object.assign({}, s1));\n}\n\nfunction getClassAndVars(styles: any, name: any, props: any) {\n function getPropValue(key: any, props: any) {\n return props[`use:${key}`] ?? props[key];\n }\n\n return Object.entries(styles).reduce(\n (acc, [key, value]) => {\n if (key.startsWith('--')) {\n // @ts-ignore\n acc[1][value] = getPropValue(key.substring(2), props);\n } else if (name === key) {\n // @ts-ignore\n acc[0][value] = true;\n } else {\n const [mod, modValue] = key.split('=');\n const propValue = getPropValue(mod, props);\n if (modValue === undefined) {\n // @ts-ignore\n acc[0][value] = Boolean(propValue ?? false);\n } else {\n // @ts-ignore\n\n acc[0][value] = propValue == modValue;\n }\n }\n return acc;\n },\n [{}, {}],\n );\n}\n\nconst reshadowMap = new WeakMap();\n\nfunction reshadowToShadow(obj: any) {\n if (reshadowMap.has(obj)) {\n return reshadowMap.get(obj);\n }\n\n const shadowStyle = Object.entries(obj).reduce((style: any, [name, value]) => {\n let n = name;\n if (name.startsWith('__')) {\n n = name.replace(/^__/, '');\n } else if (name.startsWith('_')) {\n n = name.replace(/^_/, '').replace('_', '=');\n }\n style[n] = value;\n return style;\n }, {});\n\n reshadowMap.set(obj, shadowStyle);\n\n return shadowStyle;\n}\n\nfunction sstyled(styles = {}): ((ReactNode: any) => React.ReactNode) & {\n cn(name: string, props: any): any;\n} {\n // @ts-ignore\n return {\n cn(name, props) {\n const [classes, style] = getClassAndVars(reshadowToShadow(styles), name, props);\n\n if (Object.keys(classes).length) {\n props.className = cn(props.className, classes);\n }\n\n if (Object.keys(style).length) {\n props.style = Object.assign(style, props.style);\n }\n\n return props;\n },\n };\n}\n\nsstyled.css = function (_css: any): { [key: string]: string } {\n throw new Error('Enable babel plugin');\n};\nsstyled.insert = insert;\nsstyled.merge = merge;\nsstyled.getStyles = getStyles;\nsstyled.SHADOW_STYLES = Symbol('SHADOW_STYLES');\n\nexport { sstyled };\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,YAAY;AAG3B;AACA,SAASC,SAAS,IAAIC,iBAAiB,QAAQ,qBAAiB;AAEhE,MAAMC,WAAW,GAAG,cAAc;AAElC,MAAMC,KAAK,GAAG,EAAE,OAAOC,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,QAAQ,IAAID,MAAM,CAACC,QAAQ,CAACC,aAAa,CAAC;AAElG,MAAMC,SAAS,GAAGN,iBAAiB,CAAC,CAAC,CAACO,GAAU;AAEhD,MAAMR,SAAS,GAAGA,CAAA,MAAO;EACvBQ,GAAG,EAAED,SAAS;EACd,IAAIE,GAAGA,CAAA,EAAG;IACR,IAAIC,YAAY,GAAG,EAAE;IACrB,KAAK,MAAMC,EAAE,IAAIJ,SAAS,EAAE;MAC1BG,YAAY,IAAI,8BAA8BC,EAAE,KAAKJ,SAAS,CAACI,EAAE,CAAC,UAAU;IAC9E;IACA,OAAOD,YAAY;EACr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AEC,KAAK,EAAE;MACd,MAAM,CAACqB,OAAO,EAAEL,KAAK,CAAC,GAAGnB,eAAe,CAACc,gBAAgB,CAACb,MAAM,CAAC,EAAEC,IAAI,EAAEC,KAAK,CAAC;MAE/E,IAAIX,MAAM,CAACiC,IAAI,CAACD,OAAO,CAAC,CAACE,MAAM,EAAE;QAC/BvB,KAAK,CAACwB,SAAS,GAAG9D,EAAE,CAACsC,KAAK,CAACwB,SAAS,EAAEH,OAAO,CAAC;MAChD;MAEA,IAAIhC,MAAM,CAACiC,IAAI,CAACN,KAAK,CAAC,CAACO,MAAM,EAAE;QAC7BvB,KAAK,CAACgB,KAAK,GAAG3B,MAAM,CAACO,MAAM,CAACoB,KAAK,EAAEhB,KAAK,CAACgB,KAAK,CAAC;MACjD;MAEA,OAAOhB,KAAK;IACd;EACF,CAAC;AACH;AAEAoB,OAAO,CAAChD,GAAG,GAAG,UAAUqD,IAAS,EAA6B;EAC5D,MAAM,IAAIC,KAAK,CAAC,qBAAqB,CAAC;AACxC,CAAC;AACDN,OAAO,CAAC7C,MAAM,GAAGA,MAAM;AACvB6C,OAAO,CAAClC,KAAK,GAAGA,KAAK;AACrBkC,OAAO,CAACzD,SAAS,GAAGA,SAAS;AAC7ByD,OAAO,CAACO,aAAa,GAAGC,MAAM,CAAC,eAAe,CAAC;AAE/C,SAASR,OAAO","ignoreList":[]}
|
package/lib/theme/processor.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
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.writeIfChanged = void 0;
|
|
8
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
-
var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
|
|
10
|
-
var _regenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/regenerator"));
|
|
11
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
12
8
|
var _nodeChild_process = require("node:child_process");
|
|
13
9
|
var _promises = _interopRequireDefault(require("node:fs/promises"));
|
|
14
10
|
var _nodePath = require("node:path");
|
|
@@ -17,197 +13,147 @@ var _fastGlob = _interopRequireDefault(require("fast-glob"));
|
|
|
17
13
|
var _postcss = _interopRequireDefault(require("postcss"));
|
|
18
14
|
var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
|
|
19
15
|
var _utils = require("./utils");
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
var warning = !process.argv.includes('--no-warning');
|
|
57
|
-
var dirname = (0, _nodePath.resolve)((0, _nodeUrl.fileURLToPath)(import.meta.url), '..');
|
|
58
|
-
var autoTheme = {};
|
|
59
|
-
var _loop = function _loop() {
|
|
60
|
-
var theme = _themes[_i];
|
|
61
|
-
var prefix = 'intergalactic';
|
|
62
|
-
var _JSON$parse = JSON.parse(await _promises["default"].readFile((0, _nodePath.resolve)(dirname, "./".concat(theme, ".json")), 'utf-8')),
|
|
63
|
-
base = _JSON$parse.base,
|
|
64
|
-
tokens = _JSON$parse.tokens,
|
|
65
|
-
featureHighlight = _JSON$parse.featureHighlight;
|
|
66
|
-
var processed = (0, _utils.processTokens)(base, tokens, featureHighlight, prefix);
|
|
67
|
-
var values = processed.values,
|
|
68
|
-
types = processed.types,
|
|
69
|
-
rawValues = processed.rawValues,
|
|
70
|
-
descriptions = processed.descriptions,
|
|
71
|
-
basicTokens = processed.basicTokens,
|
|
72
|
-
highlightsTokens = processed.highlightsTokens;
|
|
73
|
-
var processedTokens = processed.processedTokens;
|
|
74
|
-
await writeIfChanged("./semcore/core/src/theme/themes/".concat(theme, ".css"), (0, _utils.tokensToCss)(processedTokens));
|
|
75
|
-
await writeIfChanged("./semcore/core/src/theme/themes/".concat(theme, ".ts"), (0, _utils.tokensToJs)(processedTokens));
|
|
16
|
+
const writeIfChanged = async (path, content) => {
|
|
17
|
+
try {
|
|
18
|
+
const originalContent = await _promises.default.readFile(path, 'utf-8');
|
|
19
|
+
if (originalContent.replace(/[\s\n]/g, '') === content.replace(/[\s\n]/g, '')) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
} catch {}
|
|
23
|
+
await _promises.default.writeFile(path, content);
|
|
24
|
+
};
|
|
25
|
+
exports.writeIfChanged = writeIfChanged;
|
|
26
|
+
const defaultTheme = 'light';
|
|
27
|
+
const themes = ['light', 'dark'];
|
|
28
|
+
const warning = !process.argv.includes('--no-warning');
|
|
29
|
+
const dirname = (0, _nodePath.resolve)((0, _nodeUrl.fileURLToPath)(import.meta.url), '..');
|
|
30
|
+
const autoTheme = {};
|
|
31
|
+
for (const theme of themes) {
|
|
32
|
+
const prefix = 'intergalactic';
|
|
33
|
+
const {
|
|
34
|
+
base,
|
|
35
|
+
tokens,
|
|
36
|
+
featureHighlight
|
|
37
|
+
} = JSON.parse(await _promises.default.readFile((0, _nodePath.resolve)(dirname, `./${theme}.json`), 'utf-8'));
|
|
38
|
+
const processed = (0, _utils.processTokens)(base, tokens, featureHighlight, prefix);
|
|
39
|
+
const {
|
|
40
|
+
values,
|
|
41
|
+
types,
|
|
42
|
+
rawValues,
|
|
43
|
+
descriptions,
|
|
44
|
+
basicTokens,
|
|
45
|
+
highlightsTokens
|
|
46
|
+
} = processed;
|
|
47
|
+
const {
|
|
48
|
+
processedTokens
|
|
49
|
+
} = processed;
|
|
50
|
+
await writeIfChanged(`./semcore/core/src/theme/themes/${theme}.css`, (0, _utils.tokensToCss)(processedTokens));
|
|
51
|
+
await writeIfChanged(`./semcore/core/src/theme/themes/${theme}.ts`, (0, _utils.tokensToJs)(processedTokens));
|
|
76
52
|
if (highlightsTokens.length > 0) {
|
|
77
|
-
await writeIfChanged(
|
|
78
|
-
await writeIfChanged(
|
|
53
|
+
await writeIfChanged(`./semcore/core/src/theme/themes/highlights-${theme}.css`, (0, _utils.tokensToCss)(highlightsTokens));
|
|
54
|
+
await writeIfChanged(`./semcore/core/src/theme/themes/highlights-${theme}.ts`, (0, _utils.tokensToJs)(highlightsTokens));
|
|
79
55
|
}
|
|
80
56
|
autoTheme[theme] = processedTokens;
|
|
81
|
-
|
|
57
|
+
const usages = {};
|
|
82
58
|
if (theme === defaultTheme) {
|
|
83
59
|
await writeIfChanged('./semcore/core/src/theme/themes/default.css', (0, _utils.tokensToCss)(processedTokens));
|
|
84
60
|
await writeIfChanged('./semcore/core/src/theme/themes/default.ts', (0, _utils.tokensToJs)(processedTokens));
|
|
85
|
-
|
|
61
|
+
const projectCssPaths = (await (0, _fastGlob.default)('./semcore/*/src/**/*.shadow.css', {
|
|
86
62
|
ignore: ['node_modules', 'lib']
|
|
87
|
-
})).filter(
|
|
88
|
-
if (path.split('/').some(
|
|
89
|
-
return ['chart', 'email', 'table'].includes(pathPart);
|
|
90
|
-
})) {
|
|
63
|
+
})).filter(path => {
|
|
64
|
+
if (path.split('/').some(pathPart => ['chart', 'email', 'table'].includes(pathPart))) {
|
|
91
65
|
return false;
|
|
92
66
|
}
|
|
93
67
|
return true;
|
|
94
68
|
});
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
var location = "".concat(node.source.start.line, ":").concat(node.source.start.offset);
|
|
133
|
-
colorLiterals.push({
|
|
134
|
-
path: "".concat(projectCssPaths[fileIndex], ":").concat(location),
|
|
135
|
-
name: valueNode.value
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
if (valueNode.type === 'word' && valueNode.value.endsWith('px') && (node.prop.includes('padding') || node.prop.includes('margin') || node.prop.includes('radius') || node.prop.includes('font-size'))) {
|
|
139
|
-
var _location = "".concat(node.source.start.line, ":").concat(node.source.start.offset);
|
|
140
|
-
colorLiterals.push({
|
|
141
|
-
path: "".concat(projectCssPaths[fileIndex], ":").concat(_location),
|
|
142
|
-
name: valueNode.value
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
if (valueNode.type !== 'function' || valueNode.value !== 'var') continue;
|
|
147
|
-
var variableName = valueNode.nodes[0].value;
|
|
148
|
-
if (!variableName.startsWith("--".concat(prefix))) {
|
|
149
|
-
// if (legacyCssVariables[variableName] !== undefined) {
|
|
150
|
-
// legacyCssVariables[variableName]++;
|
|
151
|
-
// }
|
|
152
|
-
continue;
|
|
153
|
-
}
|
|
154
|
-
var hasDefault = valueNode.nodes.length === 3;
|
|
155
|
-
if (!hasDefault) {
|
|
156
|
-
valueNode.nodes.push({
|
|
157
|
-
type: 'div',
|
|
158
|
-
sourceIndex: -1,
|
|
159
|
-
value: ',',
|
|
160
|
-
before: '',
|
|
161
|
-
after: ' '
|
|
162
|
-
}, {
|
|
163
|
-
type: 'word',
|
|
164
|
-
sourceIndex: -1,
|
|
165
|
-
value: ''
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
var withoutPrefix = variableName.substring("--".concat(prefix, "-").length);
|
|
169
|
-
usedVariables[withoutPrefix] = true;
|
|
170
|
-
if (!values[withoutPrefix]) {
|
|
171
|
-
throw new Error("Variable ".concat(variableName, " is used in project but not presented in design tokens list"));
|
|
172
|
-
}
|
|
173
|
-
valueNode.nodes[2].type = 'word';
|
|
174
|
-
valueNode.nodes[2].value = values[withoutPrefix];
|
|
175
|
-
valueNode.nodes[2].nodes = [];
|
|
176
|
-
valueNode.nodes.length = 3;
|
|
177
|
-
usages[withoutPrefix] = (_usages$withoutPrefix = usages[withoutPrefix]) !== null && _usages$withoutPrefix !== void 0 ? _usages$withoutPrefix : [];
|
|
178
|
-
usages[withoutPrefix].push(projectCssPaths[fileIndex]);
|
|
179
|
-
}
|
|
180
|
-
} catch (err) {
|
|
181
|
-
_iterator2.e(err);
|
|
182
|
-
} finally {
|
|
183
|
-
_iterator2.f();
|
|
69
|
+
const projectCssContents = await Promise.all(projectCssPaths.map(path => _promises.default.readFile(path, 'utf-8')));
|
|
70
|
+
const usedVariables = {};
|
|
71
|
+
const colorLiterals = [];
|
|
72
|
+
const processedCss = await Promise.all(projectCssContents.map((cssContent, fileIndex) => (0, _postcss.default)([{
|
|
73
|
+
postcssPlugin: 'variables-explored',
|
|
74
|
+
prepare: result => {
|
|
75
|
+
const traverseAst = nodes => {
|
|
76
|
+
for (const node of nodes) {
|
|
77
|
+
if (node.nodes) {
|
|
78
|
+
traverseAst(node.nodes);
|
|
79
|
+
}
|
|
80
|
+
if (node.value) {
|
|
81
|
+
const valueAst = (0, _postcssValueParser.default)(node.value);
|
|
82
|
+
const traverseValueAst = (nodes, parent) => {
|
|
83
|
+
for (const valueNode of nodes) {
|
|
84
|
+
if (valueNode.nodes) traverseValueAst(valueNode.nodes, valueNode);
|
|
85
|
+
if (valueNode.type === 'function' && valueNode.value === 'color-mod') {
|
|
86
|
+
throw new Error(`Found restricted function color-mod in ${projectCssPaths[fileIndex]}`);
|
|
87
|
+
}
|
|
88
|
+
const parentIsVariable = parent?.type === 'function' && parent?.value === 'var';
|
|
89
|
+
if (!parentIsVariable) {
|
|
90
|
+
const prevNode = node.parent.nodes[node.parent.nodes.indexOf(node) - 1];
|
|
91
|
+
const skipNode = prevNode?.type === 'comment' && prevNode.text.trim() === 'disable-tokens-validator';
|
|
92
|
+
if (skipNode) continue;
|
|
93
|
+
if (valueNode.type === 'word' && (valueNode.value.startsWith('#') || valueNode.value.startsWith('rgb'))) {
|
|
94
|
+
const location = `${node.source.start.line}:${node.source.start.offset}`;
|
|
95
|
+
colorLiterals.push({
|
|
96
|
+
path: `${projectCssPaths[fileIndex]}:${location}`,
|
|
97
|
+
name: valueNode.value
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
if (valueNode.type === 'word' && valueNode.value.endsWith('px') && (node.prop.includes('padding') || node.prop.includes('margin') || node.prop.includes('radius') || node.prop.includes('font-size'))) {
|
|
101
|
+
const location = `${node.source.start.line}:${node.source.start.offset}`;
|
|
102
|
+
colorLiterals.push({
|
|
103
|
+
path: `${projectCssPaths[fileIndex]}:${location}`,
|
|
104
|
+
name: valueNode.value
|
|
105
|
+
});
|
|
184
106
|
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
|
|
107
|
+
}
|
|
108
|
+
if (valueNode.type !== 'function' || valueNode.value !== 'var') continue;
|
|
109
|
+
const variableName = valueNode.nodes[0].value;
|
|
110
|
+
if (!variableName.startsWith(`--${prefix}`)) {
|
|
111
|
+
// if (legacyCssVariables[variableName] !== undefined) {
|
|
112
|
+
// legacyCssVariables[variableName]++;
|
|
113
|
+
// }
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
const hasDefault = valueNode.nodes.length === 3;
|
|
117
|
+
if (!hasDefault) {
|
|
118
|
+
valueNode.nodes.push({
|
|
119
|
+
type: 'div',
|
|
120
|
+
sourceIndex: -1,
|
|
121
|
+
value: ',',
|
|
122
|
+
before: '',
|
|
123
|
+
after: ' '
|
|
124
|
+
}, {
|
|
125
|
+
type: 'word',
|
|
126
|
+
sourceIndex: -1,
|
|
127
|
+
value: ''
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
const withoutPrefix = variableName.substring(`--${prefix}-`.length);
|
|
131
|
+
usedVariables[withoutPrefix] = true;
|
|
132
|
+
if (!values[withoutPrefix]) {
|
|
133
|
+
throw new Error(`Variable ${variableName} is used in project but not presented in design tokens list`);
|
|
134
|
+
}
|
|
135
|
+
valueNode.nodes[2].type = 'word';
|
|
136
|
+
valueNode.nodes[2].value = values[withoutPrefix];
|
|
137
|
+
valueNode.nodes[2].nodes = [];
|
|
138
|
+
valueNode.nodes.length = 3;
|
|
139
|
+
usages[withoutPrefix] = usages[withoutPrefix] ?? [];
|
|
140
|
+
usages[withoutPrefix].push(projectCssPaths[fileIndex]);
|
|
188
141
|
}
|
|
189
142
|
};
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
} catch (err) {
|
|
194
|
-
_iterator.e(err);
|
|
195
|
-
} finally {
|
|
196
|
-
_iterator.f();
|
|
143
|
+
traverseValueAst(valueAst.nodes, null);
|
|
144
|
+
node.value = valueAst.toString();
|
|
197
145
|
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}));
|
|
206
|
-
await Promise.all(projectCssPaths.map(
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
var unusedVariables = [];
|
|
210
|
-
for (var variable in values) {
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
traverseAst(result.root.nodes);
|
|
149
|
+
return {};
|
|
150
|
+
}
|
|
151
|
+
}]).process(cssContent, {
|
|
152
|
+
from: undefined
|
|
153
|
+
})));
|
|
154
|
+
await Promise.all(projectCssPaths.map((path, index) => writeIfChanged(path, processedCss[index].css)));
|
|
155
|
+
const unusedVariables = [];
|
|
156
|
+
for (const variable in values) {
|
|
211
157
|
if (!usedVariables[variable]) {
|
|
212
158
|
unusedVariables.push(variable);
|
|
213
159
|
}
|
|
@@ -222,72 +168,54 @@ var _loop = function _loop() {
|
|
|
222
168
|
if (colorLiterals.length > 0) {
|
|
223
169
|
// eslint-disable-next-line no-console
|
|
224
170
|
console.log('Unexpected color literals:');
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
229
|
-
var literal = _step3.value;
|
|
230
|
-
// eslint-disable-next-line no-console
|
|
231
|
-
console.log("".concat(literal.name, " in ").concat(literal.path));
|
|
232
|
-
}
|
|
233
|
-
} catch (err) {
|
|
234
|
-
_iterator3.e(err);
|
|
235
|
-
} finally {
|
|
236
|
-
_iterator3.f();
|
|
171
|
+
for (const literal of colorLiterals) {
|
|
172
|
+
// eslint-disable-next-line no-console
|
|
173
|
+
console.log(`${literal.name} in ${literal.path}`);
|
|
237
174
|
}
|
|
238
175
|
}
|
|
239
176
|
}
|
|
240
|
-
|
|
241
|
-
for (
|
|
177
|
+
const designTokensDocumentation = [];
|
|
178
|
+
for (const token in values) {
|
|
242
179
|
if (!basicTokens.has(token)) {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
return cssPath.split('/')[2];
|
|
246
|
-
})));
|
|
247
|
-
components.sort(function (a, b) {
|
|
248
|
-
return a.localeCompare(b);
|
|
249
|
-
});
|
|
180
|
+
const components = [...new Set((usages[token] ?? []).map(cssPath => cssPath.split('/')[2]))];
|
|
181
|
+
components.sort((a, b) => a.localeCompare(b));
|
|
250
182
|
designTokensDocumentation.push({
|
|
251
|
-
name:
|
|
183
|
+
name: `--${prefix}-${token}`,
|
|
252
184
|
type: types[token],
|
|
253
185
|
rawValue: rawValues[token],
|
|
254
186
|
computedValue: values[token],
|
|
255
187
|
description: descriptions[token],
|
|
256
|
-
components
|
|
188
|
+
components
|
|
257
189
|
});
|
|
258
190
|
}
|
|
259
191
|
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
for (
|
|
192
|
+
const baseTokensDocumentation = [];
|
|
193
|
+
const processGroup = (group, data) => {
|
|
194
|
+
for (const key in data) {
|
|
263
195
|
if (data[key].value) {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
name: "--".concat(group, "-").concat(key),
|
|
196
|
+
const token = {
|
|
197
|
+
name: `--${group}-${key}`,
|
|
267
198
|
value: data[key].value
|
|
268
199
|
};
|
|
269
|
-
if (
|
|
270
|
-
|
|
200
|
+
if (data[key].description?.trim()) {
|
|
201
|
+
token.description = data[key].description;
|
|
271
202
|
}
|
|
272
|
-
baseTokensDocumentation.push(
|
|
203
|
+
baseTokensDocumentation.push(token);
|
|
273
204
|
} else {
|
|
274
|
-
|
|
205
|
+
processGroup(`${group}-${key}`, data[key]);
|
|
275
206
|
}
|
|
276
207
|
}
|
|
277
208
|
};
|
|
278
|
-
for (
|
|
279
|
-
|
|
209
|
+
for (const group in base) {
|
|
210
|
+
processGroup(group, base[group]);
|
|
280
211
|
}
|
|
281
212
|
await writeIfChanged((0, _nodePath.resolve)(dirname, '../../../../website/docs/style/design-tokens/design-tokens.json'), JSON.stringify(designTokensDocumentation, null, 2) + '\n');
|
|
282
213
|
await writeIfChanged((0, _nodePath.resolve)(dirname, '../../../../website/docs/style/design-tokens/base-tokens.json'), JSON.stringify(baseTokensDocumentation, null, 2) + '\n');
|
|
283
214
|
}
|
|
284
|
-
};
|
|
285
|
-
for (var _i = 0, _themes = themes; _i < _themes.length; _i++) {
|
|
286
|
-
_loop();
|
|
287
215
|
}
|
|
288
|
-
|
|
289
|
-
for (
|
|
290
|
-
|
|
216
|
+
const autoThemeLines = [];
|
|
217
|
+
for (const theme in autoTheme) {
|
|
218
|
+
const selector = theme === defaultTheme ? ':root' : `.${theme}`;
|
|
291
219
|
autoThemeLines.push((0, _utils.tokensToCss)(autoTheme[theme], selector));
|
|
292
220
|
}
|
|
293
221
|
await writeIfChanged('./semcore/core/src/theme/themes/auto.css', autoThemeLines.join('\n'));
|