@semcore/core 17.0.1-prerelease.0 → 17.1.0-prerelease.0
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 +123 -3
- package/README.md +5 -35
- 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.js +25 -41
- package/lib/core-types/Component.js.map +1 -1
- package/lib/core-types/Component.mjs +18 -38
- 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.js +158 -238
- package/lib/coreFactory.js.map +1 -1
- package/lib/coreFactory.mjs +133 -189
- package/lib/coreFactory.mjs.map +1 -1
- package/lib/decorators/propsObserver.js +36 -64
- package/lib/decorators/propsObserver.js.map +1 -1
- package/lib/decorators/propsObserver.mjs +33 -61
- package/lib/decorators/propsObserver.mjs.map +1 -1
- package/lib/decorators/reactive.js +17 -17
- package/lib/decorators/reactive.js.map +1 -1
- package/lib/decorators/reactive.mjs +15 -15
- package/lib/decorators/reactive.mjs.map +1 -1
- 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 +4 -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 -65
- package/lib/enhancement/uncontrolledProps.js.map +1 -1
- package/lib/enhancement/uncontrolledProps.mjs +43 -52
- package/lib/enhancement/uncontrolledProps.mjs.map +1 -1
- package/lib/esm/LastInteractionType.mjs +19 -33
- package/lib/esm/core-types/Component.mjs +18 -38
- package/lib/esm/core-types/symbols.mjs +9 -9
- package/lib/esm/coreFactory.mjs +133 -189
- 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 +4 -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 -52
- 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 +15 -17
- 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 -43
- package/lib/esm/utils/use/useEnhancedEffect.mjs +1 -1
- package/lib/index.js +17 -17
- 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.js +4 -4
- 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/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/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.js +10 -8
- package/lib/utils/enhances/WithCSS.js.map +1 -1
- package/lib/utils/enhances/WithCSS.mjs +7 -6
- package/lib/utils/enhances/WithCSS.mjs.map +1 -1
- package/lib/utils/enhances/WithI18n.js +19 -19
- package/lib/utils/enhances/WithI18n.js.map +1 -1
- package/lib/utils/enhances/WithI18n.mjs +15 -17
- 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.js +55 -63
- package/lib/utils/enhances/animatedSizeEnhance.js.map +1 -1
- package/lib/utils/enhances/animatedSizeEnhance.mjs +50 -58
- 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.js +51 -67
- 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.js +30 -57
- package/lib/utils/eventEmitter.js.map +1 -1
- package/lib/utils/eventEmitter.mjs +26 -55
- 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/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/indentStyles.js +5 -10
- package/lib/utils/indentStyles.js.map +1 -1
- package/lib/utils/indentStyles.mjs +5 -9
- package/lib/utils/indentStyles.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.js +29 -47
- package/lib/utils/ref.js.map +1 -1
- package/lib/utils/ref.mjs +27 -43
- 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.js +22 -27
- package/lib/utils/uniqueID.js.map +1 -1
- package/lib/utils/uniqueID.mjs +18 -25
- 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.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 +24 -26
- package/lib/utils/use/usePreventScroll.js.map +1 -1
- package/lib/utils/use/usePreventScroll.mjs +19 -21
- 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.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 +316 -13
- package/tsconfig-utils.json +4 -0
- package/vite.config.ts +22 -0
|
@@ -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,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;AAC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5D;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?.configurable && 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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AAM,EAAE,KAAK,CAAC;EAC1E,MAAMgB,kBAAkB,GAAGf,MAAM,CAACc,wBAAwB,CAAChB,KAAK,EAAE,KAAK,CAAC;EACxE,IAAIe,mBAAmB,EAAEG,YAAY,IAAID,kBAAkB,EAAEC,YAAY,EAAE;IACzER,QAAQ,CAACS,GAAG,GAAG5B,OAAO,CAACU,MAAM,CAACkB,GAAG,EAASnB,KAAK,CAACmB,GAAU,CAAC;EAC7D;EAEA,IAAInB,KAAK,CAACoB,UAAU,EAAE;IACpBV,QAAQ,CAACS,GAAG,GAAG5B,OAAO,CAACmB,QAAQ,CAACS,GAAG,EAASnB,KAAK,CAACoB,UAAiB,CAAC;IACpEV,QAAQ,CAACU,UAAU,GAAGV,QAAQ,CAACS,GAAG;EACpC;EAEA,IAAIlB,MAAM,CAACoB,KAAK,IAAIrB,KAAK,CAACqB,KAAK,EAAE;IAC/BX,QAAQ,CAACW,KAAK,GAAG;MACf,GAAGpB,MAAM,CAACoB,KAAK;MACf,GAAGrB,KAAK,CAACqB;IACX,CAAC;EACH;EAEA,IAAIpB,MAAM,CAACqB,SAAS,EAAE;IACpBZ,QAAQ,CAACY,SAAS,GAAGhC,EAAE,CAACU,KAAK,CAACsB,SAAS,EAAErB,MAAM,CAACqB,SAAS,CAAC;EAC5D;EAEA,IAAIrB,MAAM,CAACsB,MAAM,IAAIvB,KAAK,CAACuB,MAAM,EAAE;IACjCb,QAAQ,CAACa,MAAM,GAAG/B,OAAO,CAACgC,KAAK,CAACvB,MAAM,CAACsB,MAAM,EAAEvB,KAAK,CAACuB,MAAM,CAAC;EAC9D;EAEA,OAAOb,QAAQ;AACjB","ignoreList":[]}
|
package/lib/utils/canUseDOM.js
CHANGED
package/lib/utils/color.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -9,91 +8,73 @@ exports.brightness = brightness;
|
|
|
9
8
|
exports.light = void 0;
|
|
10
9
|
exports.opacity = opacity;
|
|
11
10
|
exports.shade = shade;
|
|
12
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
14
11
|
function shadeHexColor(color, percent) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return
|
|
12
|
+
const f = Number.parseInt(color.slice(1), 16);
|
|
13
|
+
const t = percent < 0 ? 0 : 255;
|
|
14
|
+
const p = percent < 0 ? percent * -1 : percent;
|
|
15
|
+
const R = f >> 16;
|
|
16
|
+
const G = f >> 8 & 0x00ff;
|
|
17
|
+
const B = f & 0x0000ff;
|
|
18
|
+
return `#${(0x1000000 + (Math.round((t - R) * p) + R) * 0x10000 + (Math.round((t - G) * p) + G) * 0x100 + (Math.round((t - B) * p) + B)).toString(16).slice(1)}`;
|
|
22
19
|
}
|
|
23
20
|
function shadeRGBColor(color, percent) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
B = _colorRGB2[2];
|
|
29
|
-
var t = percent < 0 ? 0 : 255;
|
|
30
|
-
var p = percent < 0 ? percent * -1 : percent;
|
|
31
|
-
return "rgb(".concat(Math.round((t - R) * p) + R, ",").concat(Math.round((t - G) * p) + G, ",").concat(Math.round((t - B) * p) + B, ")");
|
|
21
|
+
const [R, G, B] = colorRGB(color);
|
|
22
|
+
const t = percent < 0 ? 0 : 255;
|
|
23
|
+
const p = percent < 0 ? percent * -1 : percent;
|
|
24
|
+
return `rgb(${Math.round((t - R) * p) + R},${Math.round((t - G) * p) + G},${Math.round((t - B) * p) + B})`;
|
|
32
25
|
}
|
|
33
|
-
function shade(color) {
|
|
34
|
-
var percent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
26
|
+
function shade(color, percent = 1) {
|
|
35
27
|
if (!color) return;
|
|
36
28
|
// TODO error for color name, example 'aqua'
|
|
37
29
|
if (color.length > 7) return shadeRGBColor(color, percent);
|
|
38
30
|
return shadeHexColor(color, percent);
|
|
39
31
|
}
|
|
40
32
|
function blendHexColors(colorOne, colorTwo, percent) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return
|
|
33
|
+
const f = Number.parseInt(colorOne.slice(1), 16);
|
|
34
|
+
const t = Number.parseInt(colorTwo.slice(1), 16);
|
|
35
|
+
const R1 = f >> 16;
|
|
36
|
+
const G1 = f >> 8 & 0x00ff;
|
|
37
|
+
const B1 = f & 0x0000ff;
|
|
38
|
+
const R2 = t >> 16;
|
|
39
|
+
const G2 = t >> 8 & 0x00ff;
|
|
40
|
+
const B2 = t & 0x0000ff;
|
|
41
|
+
return `#${(0x1000000 + (Math.round((R2 - R1) * percent) + R1) * 0x10000 + (Math.round((G2 - G1) * percent) + G1) * 0x100 + (Math.round((B2 - B1) * percent) + B1)).toString(16).slice(1)}`;
|
|
50
42
|
}
|
|
51
43
|
function blendRGBColors(colorOne, colorTwo, percent) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
G = _colorRGB4[1],
|
|
56
|
-
B = _colorRGB4[2];
|
|
57
|
-
var t = colorTwo.split(',');
|
|
58
|
-
return "rgb(".concat(Math.round((Number.parseInt(t[0].slice(4)) - R) * percent) + R, ",").concat(Math.round((Number.parseInt(t[1]) - G) * percent) + G, ",").concat(Math.round((Number.parseInt(t[2]) - B) * percent) + B, ")");
|
|
44
|
+
const [R, G, B] = colorRGB(colorOne);
|
|
45
|
+
const t = colorTwo.split(',');
|
|
46
|
+
return `rgb(${Math.round((Number.parseInt(t[0].slice(4)) - R) * percent) + R},${Math.round((Number.parseInt(t[1]) - G) * percent) + G},${Math.round((Number.parseInt(t[2]) - B) * percent) + B})`;
|
|
59
47
|
}
|
|
60
|
-
function blend(colorOne, colorTwo) {
|
|
61
|
-
var percent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
48
|
+
function blend(colorOne, colorTwo, percent = 1) {
|
|
62
49
|
if (!colorOne || !colorTwo) return;
|
|
63
50
|
if (colorOne.length > 7) {
|
|
64
51
|
if (colorTwo.length > 7) {
|
|
65
52
|
return blendRGBColors(colorOne, colorTwo, percent);
|
|
66
53
|
}
|
|
67
|
-
return blendRGBColors(colorOne,
|
|
54
|
+
return blendRGBColors(colorOne, `rgb(${hex2rgb(colorTwo)})`, percent);
|
|
68
55
|
}
|
|
69
56
|
if (colorTwo.length > 7) {
|
|
70
|
-
return blendRGBColors(
|
|
57
|
+
return blendRGBColors(`rgb(${hex2rgb(colorOne).join(',')})`, colorTwo, percent);
|
|
71
58
|
}
|
|
72
59
|
return blendHexColors(colorOne, colorTwo, percent);
|
|
73
60
|
}
|
|
74
61
|
function colorRGB(color) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
62
|
+
const f = color.split(',');
|
|
63
|
+
const R = Number.parseInt(f[0].slice(4));
|
|
64
|
+
const G = Number.parseInt(f[1]);
|
|
65
|
+
const B = Number.parseInt(f[2]);
|
|
79
66
|
return [R, G, B];
|
|
80
67
|
}
|
|
81
68
|
function hex2rgb(hex) {
|
|
82
|
-
var _hex$replace$substrin;
|
|
83
69
|
// eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
|
|
84
|
-
return
|
|
85
|
-
return "#".concat(r).concat(r).concat(g).concat(g).concat(b).concat(b);
|
|
86
|
-
}).substring(1).match(/.{2}/g)) === null || _hex$replace$substrin === void 0 ? void 0 : _hex$replace$substrin.map(function (x) {
|
|
87
|
-
return Number.parseInt(x, 16);
|
|
88
|
-
});
|
|
70
|
+
return hex.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, (_m, r, g, b) => `#${r}${r}${g}${g}${b}${b}`).substring(1).match(/.{2}/g)?.map(x => Number.parseInt(x, 16));
|
|
89
71
|
}
|
|
90
|
-
function opacity(color) {
|
|
91
|
-
var percent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
72
|
+
function opacity(color, percent = 1) {
|
|
92
73
|
if (!color) return;
|
|
93
74
|
if (color.includes('#') && color.match(/^#?[a-fA-F\d]{6}$/)) {
|
|
94
|
-
color =
|
|
75
|
+
color = `rgba(${hex2rgb(color).join(', ')}, ${percent})`;
|
|
95
76
|
} else if (color.includes('rgb')) {
|
|
96
|
-
color =
|
|
77
|
+
color = `rgba(${colorRGB(color).join(', ')}, ${percent})`;
|
|
97
78
|
} else {
|
|
98
79
|
return;
|
|
99
80
|
}
|
|
@@ -108,64 +89,60 @@ function brightness(color) {
|
|
|
108
89
|
}
|
|
109
90
|
return Math.round((Number.parseInt(color[0]) * 299 + Number.parseInt(color[1]) * 587 + Number.parseInt(color[2]) * 114) / 1000);
|
|
110
91
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
var factor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
92
|
+
const lightMemo = {};
|
|
93
|
+
const light = (color, factor = 1) => {
|
|
114
94
|
if (!color) return;
|
|
115
|
-
|
|
95
|
+
const inputKey = `${color}_${factor}`;
|
|
116
96
|
if (lightMemo[inputKey]) return lightMemo[inputKey];
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
97
|
+
let r = 0;
|
|
98
|
+
let g = 0;
|
|
99
|
+
let b = 0;
|
|
100
|
+
let a = 1;
|
|
121
101
|
if (color.startsWith('#')) {
|
|
122
102
|
if (color.length !== 4 && color.length !== 7) {
|
|
123
|
-
throw new Error(
|
|
103
|
+
throw new Error(`Got invalid color ${color}`);
|
|
124
104
|
}
|
|
125
|
-
|
|
105
|
+
const partSize = color.length === 4 ? 1 : 2;
|
|
126
106
|
r = Number.parseInt(color.substring(1, 1 + partSize), 16);
|
|
127
107
|
g = Number.parseInt(color.substring(1 + partSize, 1 + partSize * 2), 16);
|
|
128
108
|
b = Number.parseInt(color.substring(1 + partSize * 2, 1 + partSize * 3), 16);
|
|
129
109
|
a = 1; // not handled for now
|
|
130
110
|
} else if (color.startsWith('rgb(')) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
return Number.parseInt(part.trim(), 10);
|
|
134
|
-
});
|
|
111
|
+
const trimmed = color.substring('rgb('.length, color.length - ')'.length);
|
|
112
|
+
const parts = trimmed.split(',').map(part => Number.parseInt(part.trim(), 10));
|
|
135
113
|
r = parts[0];
|
|
136
114
|
g = parts[1];
|
|
137
115
|
b = parts[2];
|
|
138
116
|
a = 1;
|
|
139
117
|
} else if (color.startsWith('rgba(')) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
b = _parts[2];
|
|
147
|
-
a = _parts[2];
|
|
118
|
+
const trimmed = color.substring('rgba('.length, color.length - ')'.length);
|
|
119
|
+
const parts = trimmed.split(',').map(part => Number.parseInt(part.trim(), 10));
|
|
120
|
+
r = parts[0];
|
|
121
|
+
g = parts[1];
|
|
122
|
+
b = parts[2];
|
|
123
|
+
a = parts[2];
|
|
148
124
|
} else {
|
|
149
|
-
throw new Error(
|
|
125
|
+
throw new Error(`Got invalid color ${color}`);
|
|
150
126
|
}
|
|
151
|
-
|
|
127
|
+
const hsl = rgbToHsl(r, g, b);
|
|
152
128
|
hsl[2] += (1 - hsl[2]) * factor;
|
|
153
|
-
|
|
154
|
-
return lightMemo[inputKey] ===
|
|
129
|
+
const rgb = hslToRgb(...hsl);
|
|
130
|
+
return lightMemo[inputKey] === `rgba(${rgb[0]}, ${rgb[1]}, ${rgb[2]}, ${a})`;
|
|
155
131
|
};
|
|
156
|
-
|
|
132
|
+
exports.light = light;
|
|
133
|
+
const rgbToHsl = (r, g, b) => {
|
|
157
134
|
r /= 255;
|
|
158
135
|
g /= 255;
|
|
159
136
|
b /= 255;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
137
|
+
const max = Math.max(r, g, b);
|
|
138
|
+
const min = Math.min(r, g, b);
|
|
139
|
+
let h = 0;
|
|
140
|
+
let s = 0;
|
|
141
|
+
const l = (max + min) / 2;
|
|
165
142
|
if (max === min) {
|
|
166
143
|
h = s = 0;
|
|
167
144
|
} else {
|
|
168
|
-
|
|
145
|
+
const d = max - min;
|
|
169
146
|
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
170
147
|
switch (max) {
|
|
171
148
|
case r:
|
|
@@ -182,23 +159,23 @@ var rgbToHsl = function rgbToHsl(r, g, b) {
|
|
|
182
159
|
}
|
|
183
160
|
return [h, s, l];
|
|
184
161
|
};
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
162
|
+
const hslToRgb = (h, s, l) => {
|
|
163
|
+
let r = 0;
|
|
164
|
+
let g = 0;
|
|
165
|
+
let b = 0;
|
|
189
166
|
if (s === 0) {
|
|
190
167
|
r = g = b = l;
|
|
191
168
|
} else {
|
|
192
|
-
|
|
169
|
+
function hue2rgb(p, q, t) {
|
|
193
170
|
if (t < 0) t += 1;
|
|
194
171
|
if (t > 1) t -= 1;
|
|
195
172
|
if (t < 1 / 6) return p + (q - p) * 6 * t;
|
|
196
173
|
if (t < 1 / 2) return q;
|
|
197
174
|
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
|
|
198
175
|
return p;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
176
|
+
}
|
|
177
|
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
178
|
+
const p = 2 * l - q;
|
|
202
179
|
r = hue2rgb(p, q, h + 1 / 3);
|
|
203
180
|
g = hue2rgb(p, q, h);
|
|
204
181
|
b = hue2rgb(p, q, h - 1 / 3);
|