@semcore/core 2.39.4 → 2.40.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 +6 -0
- package/lib/LastInteractionType.d.ts +11 -0
- package/lib/LastInteractionType.js +55 -0
- package/lib/LastInteractionType.js.map +1 -0
- package/lib/LastInteractionType.mjs +50 -0
- package/lib/LastInteractionType.mjs.map +1 -0
- package/lib/core-types/Component.d.ts +142 -0
- package/lib/core-types/Component.js +53 -0
- package/lib/core-types/Component.js.map +1 -0
- package/lib/core-types/Component.mjs +47 -0
- package/lib/core-types/Component.mjs.map +1 -0
- package/lib/core-types/UnknownProperties.d.ts +3 -0
- package/lib/core-types/UnknownProperties.js +2 -0
- package/lib/core-types/UnknownProperties.js.map +1 -0
- package/lib/core-types/UnknownProperties.mjs +2 -0
- package/lib/core-types/UnknownProperties.mjs.map +1 -0
- package/lib/core-types/reshadow.d.js +2 -0
- package/lib/core-types/reshadow.d.js.map +1 -0
- package/lib/core-types/reshadow.d.mjs +2 -0
- package/lib/core-types/reshadow.d.mjs.map +1 -0
- package/lib/core-types/symbols.d.ts +9 -0
- package/lib/core-types/symbols.js +16 -0
- package/lib/core-types/symbols.js.map +1 -0
- package/lib/core-types/symbols.mjs +20 -0
- package/lib/core-types/symbols.mjs.map +1 -0
- package/lib/coreFactory.d.ts +10 -0
- package/lib/coreFactory.js +384 -0
- package/lib/coreFactory.js.map +1 -0
- package/lib/coreFactory.mjs +343 -0
- package/lib/coreFactory.mjs.map +1 -0
- package/lib/decorators/propsObserver.d.ts +11 -0
- package/lib/decorators/propsObserver.js +77 -0
- package/lib/decorators/propsObserver.js.map +1 -0
- package/lib/decorators/propsObserver.mjs +70 -0
- package/lib/decorators/propsObserver.mjs.map +1 -0
- package/lib/decorators/reactive.d.ts +11 -0
- package/lib/decorators/reactive.js +51 -0
- package/lib/decorators/reactive.js.map +1 -0
- package/lib/decorators/reactive.mjs +45 -0
- package/lib/decorators/reactive.mjs.map +1 -0
- package/lib/enhancement/Children.d.ts +5 -0
- package/lib/enhancement/Children.js +118 -0
- package/lib/enhancement/Children.js.map +1 -0
- package/lib/enhancement/Children.mjs +96 -0
- package/lib/enhancement/Children.mjs.map +1 -0
- package/lib/enhancement/Root.d.ts +6 -0
- package/lib/enhancement/Root.js +77 -0
- package/lib/enhancement/Root.js.map +1 -0
- package/lib/enhancement/Root.mjs +56 -0
- package/lib/enhancement/Root.mjs.map +1 -0
- package/lib/enhancement/dataName.d.ts +4 -0
- package/lib/enhancement/dataName.js +19 -0
- package/lib/enhancement/dataName.js.map +1 -0
- package/lib/enhancement/dataName.mjs +13 -0
- package/lib/enhancement/dataName.mjs.map +1 -0
- package/lib/enhancement/enhance.d.ts +5 -0
- package/lib/enhancement/enhance.js +21 -0
- package/lib/enhancement/enhance.js.map +1 -0
- package/lib/enhancement/enhance.mjs +16 -0
- package/lib/enhancement/enhance.mjs.map +1 -0
- package/lib/enhancement/functionDefaultProps.d.ts +8 -0
- package/lib/enhancement/functionDefaultProps.js +35 -0
- package/lib/enhancement/functionDefaultProps.js.map +1 -0
- package/lib/enhancement/functionDefaultProps.mjs +29 -0
- package/lib/enhancement/functionDefaultProps.mjs.map +1 -0
- package/lib/enhancement/i18n.d.ts +4 -0
- package/lib/enhancement/i18n.js +27 -0
- package/lib/enhancement/i18n.js.map +1 -0
- package/lib/enhancement/i18n.mjs +20 -0
- package/lib/enhancement/i18n.mjs.map +1 -0
- package/lib/enhancement/inheritedName.d.ts +8 -0
- package/lib/enhancement/inheritedName.js +22 -0
- package/lib/enhancement/inheritedName.js.map +1 -0
- package/lib/enhancement/inheritedName.mjs +16 -0
- package/lib/enhancement/inheritedName.mjs.map +1 -0
- package/lib/enhancement/staticChildren.d.ts +13 -0
- package/lib/enhancement/staticChildren.js +132 -0
- package/lib/enhancement/staticChildren.js.map +1 -0
- package/lib/enhancement/staticChildren.mjs +120 -0
- package/lib/enhancement/staticChildren.mjs.map +1 -0
- package/lib/enhancement/style.d.ts +9 -0
- package/lib/enhancement/style.js +58 -0
- package/lib/enhancement/style.js.map +1 -0
- package/lib/enhancement/style.mjs +49 -0
- package/lib/enhancement/style.mjs.map +1 -0
- package/lib/enhancement/uncontrolledProps.d.ts +7 -0
- package/lib/enhancement/uncontrolledProps.js +131 -0
- package/lib/enhancement/uncontrolledProps.js.map +1 -0
- package/lib/enhancement/uncontrolledProps.mjs +107 -0
- package/lib/enhancement/uncontrolledProps.mjs.map +1 -0
- package/lib/esm/LastInteractionType.mjs +50 -0
- package/lib/esm/core-types/Component.mjs +47 -0
- package/lib/esm/core-types/symbols.mjs +20 -0
- package/lib/esm/coreFactory.mjs +343 -0
- package/lib/esm/enhancement/Children.mjs +96 -0
- package/lib/esm/enhancement/Root.mjs +56 -0
- package/lib/esm/enhancement/dataName.mjs +13 -0
- package/lib/esm/enhancement/enhance.mjs +16 -0
- package/lib/esm/enhancement/functionDefaultProps.mjs +29 -0
- package/lib/esm/enhancement/i18n.mjs +20 -0
- package/lib/esm/enhancement/inheritedName.mjs +16 -0
- package/lib/esm/enhancement/staticChildren.mjs +120 -0
- package/lib/esm/enhancement/style.mjs +49 -0
- package/lib/esm/enhancement/uncontrolledProps.mjs +107 -0
- package/lib/esm/index.mjs +22 -4
- package/lib/esm/register.mjs +30 -0
- package/lib/esm/styled/index.mjs +8 -0
- package/lib/esm/styled/reshadow-core.mjs +234 -0
- package/lib/esm/styled/sstyled.mjs +125 -0
- package/lib/esm/utils/assignProps.mjs +86 -0
- package/lib/esm/utils/canUseDOM.mjs +6 -0
- package/lib/esm/utils/capitalizeFirstLetter.mjs +6 -0
- package/lib/esm/utils/enhances/WithI18n.mjs +30 -0
- package/lib/esm/utils/enhances/i18nEnhance.mjs +90 -0
- package/lib/esm/utils/logger.mjs +34 -0
- package/lib/esm/utils/pick.mjs +15 -0
- package/lib/esm/utils/ref.mjs +73 -0
- package/lib/esm/utils/use/useEnhancedEffect.mjs +6 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.js +103 -0
- package/lib/index.js.map +1 -0
- package/lib/index.mjs +24 -0
- package/lib/index.mjs.map +1 -0
- package/lib/register.d.ts +8 -0
- package/lib/register.js +34 -0
- package/lib/register.js.map +1 -0
- package/lib/register.mjs +30 -0
- package/lib/register.mjs.map +1 -0
- package/lib/styled/index.d.ts +6 -0
- package/lib/styled/index.js +32 -0
- package/lib/styled/index.js.map +1 -0
- package/lib/styled/index.mjs +8 -0
- package/lib/styled/index.mjs.map +1 -0
- package/lib/styled/reshadow-core.d.ts +37 -0
- package/lib/styled/reshadow-core.js +233 -0
- package/lib/styled/reshadow-core.js.map +1 -0
- package/lib/styled/reshadow-core.mjs +234 -0
- package/lib/styled/reshadow-core.mjs.map +1 -0
- package/lib/styled/sstyled.d.ts +17 -0
- package/lib/styled/sstyled.js +151 -0
- package/lib/styled/sstyled.js.map +1 -0
- package/lib/styled/sstyled.mjs +125 -0
- package/lib/styled/sstyled.mjs.map +1 -0
- package/lib/theme/themes/auto.css +1748 -0
- package/lib/theme/themes/dark.css +871 -0
- package/lib/theme/themes/dark.d.ts +487 -0
- package/lib/theme/themes/dark.js +493 -0
- package/lib/theme/themes/dark.js.map +1 -0
- package/lib/theme/themes/dark.mjs +487 -0
- package/lib/theme/themes/dark.mjs.map +1 -0
- package/lib/theme/themes/default.css +877 -0
- package/lib/theme/themes/default.d.ts +490 -0
- package/lib/theme/themes/default.js +496 -0
- package/lib/theme/themes/default.js.map +1 -0
- package/lib/theme/themes/default.mjs +490 -0
- package/lib/theme/themes/default.mjs.map +1 -0
- package/lib/theme/themes/highlights-dark.css +36 -0
- package/lib/theme/themes/highlights-dark.d.ts +20 -0
- package/lib/theme/themes/highlights-dark.js +26 -0
- package/lib/theme/themes/highlights-dark.js.map +1 -0
- package/lib/theme/themes/highlights-dark.mjs +20 -0
- package/lib/theme/themes/highlights-dark.mjs.map +1 -0
- package/lib/theme/themes/highlights-light.css +36 -0
- package/lib/theme/themes/highlights-light.d.ts +20 -0
- package/lib/theme/themes/highlights-light.js +26 -0
- package/lib/theme/themes/highlights-light.js.map +1 -0
- package/lib/theme/themes/highlights-light.mjs +20 -0
- package/lib/theme/themes/highlights-light.mjs.map +1 -0
- package/lib/theme/themes/light.css +877 -0
- package/lib/theme/themes/light.d.ts +490 -0
- package/lib/theme/themes/light.js +496 -0
- package/lib/theme/themes/light.js.map +1 -0
- package/lib/theme/themes/light.mjs +490 -0
- package/lib/theme/themes/light.mjs.map +1 -0
- package/lib/utils/CSSinJS.d.ts +5 -0
- package/lib/utils/CSSinJS.js +35 -0
- package/lib/utils/CSSinJS.js.map +1 -0
- package/lib/utils/CSSinJS.mjs +28 -0
- package/lib/utils/CSSinJS.mjs.map +1 -0
- package/lib/utils/ThemeProvider.d.ts +15 -0
- package/lib/utils/ThemeProvider.js +78 -0
- package/lib/utils/ThemeProvider.js.map +1 -0
- package/lib/utils/ThemeProvider.mjs +71 -0
- package/lib/utils/ThemeProvider.mjs.map +1 -0
- package/lib/utils/addonText.d.ts +2 -0
- package/lib/utils/addonText.js +18 -0
- package/lib/utils/addonText.js.map +1 -0
- package/lib/utils/addonText.mjs +11 -0
- package/lib/utils/addonText.mjs.map +1 -0
- package/lib/utils/addonTextChildren.d.ts +3 -0
- package/lib/utils/addonTextChildren.js +44 -0
- package/lib/utils/addonTextChildren.js.map +1 -0
- package/lib/utils/addonTextChildren.mjs +37 -0
- package/lib/utils/addonTextChildren.mjs.map +1 -0
- package/lib/utils/ariaProps.d.ts +12 -0
- package/lib/utils/ariaProps.js +22 -0
- package/lib/utils/ariaProps.js.map +1 -0
- package/lib/utils/ariaProps.mjs +16 -0
- package/lib/utils/ariaProps.mjs.map +1 -0
- package/lib/utils/assignProps.d.ts +11 -0
- package/lib/utils/assignProps.js +93 -0
- package/lib/utils/assignProps.js.map +1 -0
- package/lib/utils/assignProps.mjs +86 -0
- package/lib/utils/assignProps.mjs.map +1 -0
- package/lib/utils/canUseDOM.d.ts +1 -0
- package/lib/utils/canUseDOM.js +10 -0
- package/lib/utils/canUseDOM.js.map +1 -0
- package/lib/utils/canUseDOM.mjs +6 -0
- package/lib/utils/canUseDOM.mjs.map +1 -0
- package/lib/utils/capitalizeFirstLetter.d.ts +1 -0
- package/lib/utils/capitalizeFirstLetter.js +10 -0
- package/lib/utils/capitalizeFirstLetter.js.map +1 -0
- package/lib/utils/capitalizeFirstLetter.mjs +6 -0
- package/lib/utils/capitalizeFirstLetter.mjs.map +1 -0
- package/lib/utils/color.d.ts +5 -0
- package/lib/utils/color.js +208 -0
- package/lib/utils/color.js.map +1 -0
- package/lib/utils/color.mjs +197 -0
- package/lib/utils/color.mjs.map +1 -0
- package/lib/utils/compose.d.ts +1 -0
- package/lib/utils/compose.js +21 -0
- package/lib/utils/compose.js.map +1 -0
- package/lib/utils/compose.mjs +15 -0
- package/lib/utils/compose.mjs.map +1 -0
- package/lib/utils/createUUID.d.ts +1 -0
- package/lib/utils/createUUID.js +15 -0
- package/lib/utils/createUUID.js.map +1 -0
- package/lib/utils/createUUID.mjs +9 -0
- package/lib/utils/createUUID.mjs.map +1 -0
- package/lib/utils/cssToIntDefault.d.ts +8 -0
- package/lib/utils/cssToIntDefault.js +22 -0
- package/lib/utils/cssToIntDefault.js.map +1 -0
- package/lib/utils/cssToIntDefault.mjs +16 -0
- package/lib/utils/cssToIntDefault.mjs.map +1 -0
- package/lib/utils/enhances/WithCSS.d.ts +13 -0
- package/lib/utils/enhances/WithCSS.js +32 -0
- package/lib/utils/enhances/WithCSS.js.map +1 -0
- package/lib/utils/enhances/WithCSS.mjs +25 -0
- package/lib/utils/enhances/WithCSS.mjs.map +1 -0
- package/lib/utils/enhances/WithI18n.d.ts +14 -0
- package/lib/utils/enhances/WithI18n.js +33 -0
- package/lib/utils/enhances/WithI18n.js.map +1 -0
- package/lib/utils/enhances/WithI18n.mjs +30 -0
- package/lib/utils/enhances/WithI18n.mjs.map +1 -0
- package/lib/utils/enhances/a11yEnhance.d.ts +10 -0
- package/lib/utils/enhances/a11yEnhance.js +73 -0
- package/lib/utils/enhances/a11yEnhance.js.map +1 -0
- package/lib/utils/enhances/a11yEnhance.mjs +66 -0
- package/lib/utils/enhances/a11yEnhance.mjs.map +1 -0
- package/lib/utils/enhances/animatedSizeEnhance.d.ts +8 -0
- package/lib/utils/enhances/animatedSizeEnhance.js +98 -0
- package/lib/utils/enhances/animatedSizeEnhance.js.map +1 -0
- package/lib/utils/enhances/animatedSizeEnhance.mjs +91 -0
- package/lib/utils/enhances/animatedSizeEnhance.mjs.map +1 -0
- package/lib/utils/enhances/contextEnhance.d.ts +3 -0
- package/lib/utils/enhances/contextEnhance.js +21 -0
- package/lib/utils/enhances/contextEnhance.js.map +1 -0
- package/lib/utils/enhances/contextEnhance.mjs +14 -0
- package/lib/utils/enhances/contextEnhance.mjs.map +1 -0
- package/lib/utils/enhances/i18nEnhance.d.ts +21 -0
- package/lib/utils/enhances/i18nEnhance.js +99 -0
- package/lib/utils/enhances/i18nEnhance.js.map +1 -0
- package/lib/utils/enhances/i18nEnhance.mjs +90 -0
- package/lib/utils/enhances/i18nEnhance.mjs.map +1 -0
- package/lib/utils/enhances/resolveColorEnhance.d.ts +2 -0
- package/lib/utils/enhances/resolveColorEnhance.js +24 -0
- package/lib/utils/enhances/resolveColorEnhance.js.map +1 -0
- package/lib/utils/enhances/resolveColorEnhance.mjs +17 -0
- package/lib/utils/enhances/resolveColorEnhance.mjs.map +1 -0
- package/lib/utils/eventEmitter.d.ts +13 -0
- package/lib/utils/eventEmitter.js +68 -0
- package/lib/utils/eventEmitter.js.map +1 -0
- package/lib/utils/eventEmitter.mjs +62 -0
- package/lib/utils/eventEmitter.mjs.map +1 -0
- package/lib/utils/findComponent.d.ts +12 -0
- package/lib/utils/findComponent.js +105 -0
- package/lib/utils/findComponent.js.map +1 -0
- package/lib/utils/findComponent.mjs +95 -0
- package/lib/utils/findComponent.mjs.map +1 -0
- package/lib/utils/fire.d.ts +2 -0
- package/lib/utils/fire.js +23 -0
- package/lib/utils/fire.js.map +1 -0
- package/lib/utils/fire.mjs +15 -0
- package/lib/utils/fire.mjs.map +1 -0
- package/lib/utils/focus-lock/focusBorders.d.ts +4 -0
- package/lib/utils/focus-lock/focusBorders.js +68 -0
- package/lib/utils/focus-lock/focusBorders.js.map +1 -0
- package/lib/utils/focus-lock/focusBorders.mjs +62 -0
- package/lib/utils/focus-lock/focusBorders.mjs.map +1 -0
- package/lib/utils/focus-lock/getFocusableIn.d.ts +1 -0
- package/lib/utils/focus-lock/getFocusableIn.js +25 -0
- package/lib/utils/focus-lock/getFocusableIn.js.map +1 -0
- package/lib/utils/focus-lock/getFocusableIn.mjs +19 -0
- package/lib/utils/focus-lock/getFocusableIn.mjs.map +1 -0
- package/lib/utils/focus-lock/isFocusInside.d.ts +1 -0
- package/lib/utils/focus-lock/isFocusInside.js +15 -0
- package/lib/utils/focus-lock/isFocusInside.js.map +1 -0
- package/lib/utils/focus-lock/isFocusInside.mjs +9 -0
- package/lib/utils/focus-lock/isFocusInside.mjs.map +1 -0
- package/lib/utils/focus-lock/isFocusable.d.ts +1 -0
- package/lib/utils/focus-lock/isFocusable.js +50 -0
- package/lib/utils/focus-lock/isFocusable.js.map +1 -0
- package/lib/utils/focus-lock/isFocusable.mjs +43 -0
- package/lib/utils/focus-lock/isFocusable.mjs.map +1 -0
- package/lib/utils/focus-lock/setFocus.d.ts +1 -0
- package/lib/utils/focus-lock/setFocus.js +70 -0
- package/lib/utils/focus-lock/setFocus.js.map +1 -0
- package/lib/utils/focus-lock/setFocus.mjs +63 -0
- package/lib/utils/focus-lock/setFocus.mjs.map +1 -0
- package/lib/utils/getAccessibleName.d.ts +1 -0
- package/lib/utils/getAccessibleName.js +56 -0
- package/lib/utils/getAccessibleName.js.map +1 -0
- package/lib/utils/getAccessibleName.mjs +49 -0
- package/lib/utils/getAccessibleName.mjs.map +1 -0
- package/lib/utils/getDisplayName.d.ts +2 -0
- package/lib/utils/getDisplayName.js +10 -0
- package/lib/utils/getDisplayName.js.map +1 -0
- package/lib/utils/getDisplayName.mjs +4 -0
- package/lib/utils/getDisplayName.mjs.map +1 -0
- package/lib/utils/getEventTarget.d.ts +1 -0
- package/lib/utils/getEventTarget.js +52 -0
- package/lib/utils/getEventTarget.js.map +1 -0
- package/lib/utils/getEventTarget.mjs +45 -0
- package/lib/utils/getEventTarget.mjs.map +1 -0
- package/lib/utils/getOriginChildren.d.ts +2 -0
- package/lib/utils/getOriginChildren.js +17 -0
- package/lib/utils/getOriginChildren.js.map +1 -0
- package/lib/utils/getOriginChildren.mjs +10 -0
- package/lib/utils/getOriginChildren.mjs.map +1 -0
- package/lib/utils/getRandomInt.d.ts +1 -0
- package/lib/utils/getRandomInt.js +11 -0
- package/lib/utils/getRandomInt.js.map +1 -0
- package/lib/utils/getRandomInt.mjs +5 -0
- package/lib/utils/getRandomInt.mjs.map +1 -0
- package/lib/utils/getValue.d.ts +1 -0
- package/lib/utils/getValue.js +14 -0
- package/lib/utils/getValue.js.map +1 -0
- package/lib/utils/getValue.mjs +8 -0
- package/lib/utils/getValue.mjs.map +1 -0
- package/lib/utils/hasLabels.d.ts +7 -0
- package/lib/utils/hasLabels.js +46 -0
- package/lib/utils/hasLabels.js.map +1 -0
- package/lib/utils/hasLabels.mjs +39 -0
- package/lib/utils/hasLabels.mjs.map +1 -0
- package/lib/utils/hasParent.d.ts +1 -0
- package/lib/utils/hasParent.js +13 -0
- package/lib/utils/hasParent.js.map +1 -0
- package/lib/utils/hasParent.mjs +8 -0
- package/lib/utils/hasParent.mjs.map +1 -0
- package/lib/utils/ifChildren.d.ts +8 -0
- package/lib/utils/ifChildren.js +16 -0
- package/lib/utils/ifChildren.js.map +1 -0
- package/lib/utils/ifChildren.mjs +10 -0
- package/lib/utils/ifChildren.mjs.map +1 -0
- package/lib/utils/indentStyles.d.ts +3 -0
- package/lib/utils/indentStyles.js +45 -0
- package/lib/utils/indentStyles.js.map +1 -0
- package/lib/utils/indentStyles.mjs +36 -0
- package/lib/utils/indentStyles.mjs.map +1 -0
- package/lib/utils/injectStyle.d.ts +2 -0
- package/lib/utils/injectStyle.js +47 -0
- package/lib/utils/injectStyle.js.map +1 -0
- package/lib/utils/injectStyle.mjs +40 -0
- package/lib/utils/injectStyle.mjs.map +1 -0
- package/lib/utils/inputProps.d.ts +2 -0
- package/lib/utils/inputProps.js +21 -0
- package/lib/utils/inputProps.js.map +1 -0
- package/lib/utils/inputProps.mjs +14 -0
- package/lib/utils/inputProps.mjs.map +1 -0
- package/lib/utils/isInteractiveElement.d.ts +1 -0
- package/lib/utils/isInteractiveElement.js +34 -0
- package/lib/utils/isInteractiveElement.js.map +1 -0
- package/lib/utils/isInteractiveElement.mjs +28 -0
- package/lib/utils/isInteractiveElement.mjs.map +1 -0
- package/lib/utils/isNode.d.ts +1 -0
- package/lib/utils/isNode.js +28 -0
- package/lib/utils/isNode.js.map +1 -0
- package/lib/utils/isNode.mjs +21 -0
- package/lib/utils/isNode.mjs.map +1 -0
- package/lib/utils/isPromise.d.ts +1 -0
- package/lib/utils/isPromise.js +10 -0
- package/lib/utils/isPromise.js.map +1 -0
- package/lib/utils/isPromise.mjs +4 -0
- package/lib/utils/isPromise.mjs.map +1 -0
- package/lib/utils/isRetina.d.ts +1 -0
- package/lib/utils/isRetina.js +15 -0
- package/lib/utils/isRetina.js.map +1 -0
- package/lib/utils/isRetina.mjs +9 -0
- package/lib/utils/isRetina.mjs.map +1 -0
- package/lib/utils/logger.d.ts +9 -0
- package/lib/utils/logger.js +37 -0
- package/lib/utils/logger.js.map +1 -0
- package/lib/utils/logger.mjs +34 -0
- package/lib/utils/logger.mjs.map +1 -0
- package/lib/utils/numericChecker.d.ts +5 -0
- package/lib/utils/numericChecker.js +33 -0
- package/lib/utils/numericChecker.js.map +1 -0
- package/lib/utils/numericChecker.mjs +27 -0
- package/lib/utils/numericChecker.mjs.map +1 -0
- package/lib/utils/ownerDocument.d.ts +1 -0
- package/lib/utils/ownerDocument.js +10 -0
- package/lib/utils/ownerDocument.js.map +1 -0
- package/lib/utils/ownerDocument.mjs +4 -0
- package/lib/utils/ownerDocument.mjs.map +1 -0
- package/lib/utils/pick.d.ts +1 -0
- package/lib/utils/pick.js +19 -0
- package/lib/utils/pick.js.map +1 -0
- package/lib/utils/pick.mjs +15 -0
- package/lib/utils/pick.mjs.map +1 -0
- package/lib/utils/propsForElement.d.ts +3 -0
- package/lib/utils/propsForElement.js +58 -0
- package/lib/utils/propsForElement.js.map +1 -0
- package/lib/utils/propsForElement.mjs +50 -0
- package/lib/utils/propsForElement.mjs.map +1 -0
- package/lib/utils/rafTrottle.d.ts +2 -0
- package/lib/utils/rafTrottle.js +32 -0
- package/lib/utils/rafTrottle.js.map +1 -0
- package/lib/utils/rafTrottle.mjs +26 -0
- package/lib/utils/rafTrottle.mjs.map +1 -0
- package/lib/utils/reactToText.d.ts +3 -0
- package/lib/utils/reactToText.js +32 -0
- package/lib/utils/reactToText.js.map +1 -0
- package/lib/utils/reactToText.mjs +26 -0
- package/lib/utils/reactToText.mjs.map +1 -0
- package/lib/utils/ref.d.ts +8 -0
- package/lib/utils/ref.js +82 -0
- package/lib/utils/ref.js.map +1 -0
- package/lib/utils/ref.mjs +73 -0
- package/lib/utils/ref.mjs.map +1 -0
- package/lib/utils/setRef.d.ts +2 -0
- package/lib/utils/setRef.js +9 -0
- package/lib/utils/setRef.js.map +1 -0
- package/lib/utils/setRef.mjs +3 -0
- package/lib/utils/setRef.mjs.map +1 -0
- package/lib/utils/syncScroll.d.ts +1 -0
- package/lib/utils/syncScroll.js +61 -0
- package/lib/utils/syncScroll.js.map +1 -0
- package/lib/utils/syncScroll.mjs +54 -0
- package/lib/utils/syncScroll.mjs.map +1 -0
- package/lib/utils/uncontroll.d.ts +4 -0
- package/lib/utils/uncontroll.js +47 -0
- package/lib/utils/uncontroll.js.map +1 -0
- package/lib/utils/uncontroll.mjs +38 -0
- package/lib/utils/uncontroll.mjs.map +1 -0
- package/lib/utils/uniqueID.d.ts +8 -0
- package/lib/utils/uniqueID.js +40 -0
- package/lib/utils/uniqueID.js.map +1 -0
- package/lib/utils/uniqueID.mjs +33 -0
- package/lib/utils/uniqueID.mjs.map +1 -0
- package/lib/utils/use/useColorResolver.d.ts +1 -0
- package/lib/utils/use/useColorResolver.js +109 -0
- package/lib/utils/use/useColorResolver.js.map +1 -0
- package/lib/utils/use/useColorResolver.mjs +102 -0
- package/lib/utils/use/useColorResolver.mjs.map +1 -0
- package/lib/utils/use/useEnhancedEffect.d.ts +3 -0
- package/lib/utils/use/useEnhancedEffect.js +12 -0
- package/lib/utils/use/useEnhancedEffect.js.map +1 -0
- package/lib/utils/use/useEnhancedEffect.mjs +6 -0
- package/lib/utils/use/useEnhancedEffect.mjs.map +1 -0
- package/lib/utils/use/useEventCallback.d.ts +4 -0
- package/lib/utils/use/useEventCallback.js +25 -0
- package/lib/utils/use/useEventCallback.js.map +1 -0
- package/lib/utils/use/useEventCallback.mjs +19 -0
- package/lib/utils/use/useEventCallback.mjs.map +1 -0
- package/lib/utils/use/useEventListener.d.ts +2 -0
- package/lib/utils/use/useEventListener.js +32 -0
- package/lib/utils/use/useEventListener.js.map +1 -0
- package/lib/utils/use/useEventListener.mjs +25 -0
- package/lib/utils/use/useEventListener.mjs.map +1 -0
- package/lib/utils/use/useFocusLock.d.ts +10 -0
- package/lib/utils/use/useFocusLock.js +292 -0
- package/lib/utils/use/useFocusLock.js.map +1 -0
- package/lib/utils/use/useFocusLock.mjs +272 -0
- package/lib/utils/use/useFocusLock.mjs.map +1 -0
- package/lib/utils/use/usePreventScroll.d.ts +2 -0
- package/lib/utils/use/usePreventScroll.js +76 -0
- package/lib/utils/use/usePreventScroll.js.map +1 -0
- package/lib/utils/use/usePreventScroll.mjs +68 -0
- package/lib/utils/use/usePreventScroll.mjs.map +1 -0
- package/lib/utils/use/useScrollBarWidth.d.ts +1 -0
- package/lib/utils/use/useScrollBarWidth.js +43 -0
- package/lib/utils/use/useScrollBarWidth.js.map +1 -0
- package/lib/utils/use/useScrollBarWidth.mjs +36 -0
- package/lib/utils/use/useScrollBarWidth.mjs.map +1 -0
- package/lib/utils/useCssVariable.d.ts +8 -0
- package/lib/utils/useCssVariable.js +53 -0
- package/lib/utils/useCssVariable.js.map +1 -0
- package/lib/utils/useCssVariable.mjs +46 -0
- package/lib/utils/useCssVariable.mjs.map +1 -0
- package/lib/utils/zIndexStacking.d.ts +10 -0
- package/lib/utils/zIndexStacking.js +45 -0
- package/lib/utils/zIndexStacking.js.map +1 -0
- package/lib/utils/zIndexStacking.mjs +38 -0
- package/lib/utils/zIndexStacking.mjs.map +1 -0
- package/package.json +2 -2
- package/lib/cjs/index.js +0 -23
- package/lib/cjs/index.js.map +0 -1
- package/lib/es6/index.js +0 -4
- package/lib/es6/index.js.map +0 -1
- package/lib/types/index.d.ts +0 -3
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.createStyle = createStyle;
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
|
+
var _nanoCss = require("@phytonmk/nano-css");
|
|
11
|
+
var _cache = require("@phytonmk/nano-css/addon/cache");
|
|
12
|
+
var _hydrate = require("@phytonmk/nano-css/addon/hydrate");
|
|
13
|
+
var _prefixer = require("@phytonmk/nano-css/addon/prefixer");
|
|
14
|
+
var _rule = require("@phytonmk/nano-css/addon/rule");
|
|
15
|
+
var _nano = null;
|
|
16
|
+
function style(opt) {
|
|
17
|
+
if (!_nano) {
|
|
18
|
+
_nano = createStyle(opt);
|
|
19
|
+
}
|
|
20
|
+
return _nano;
|
|
21
|
+
}
|
|
22
|
+
function createStyle() {
|
|
23
|
+
var opt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
24
|
+
var nano = (0, _nanoCss.create)((0, _objectSpread2["default"])({
|
|
25
|
+
pfx: 'css',
|
|
26
|
+
verbose: true
|
|
27
|
+
}, opt));
|
|
28
|
+
(0, _cache.addon)(nano);
|
|
29
|
+
(0, _rule.addon)(nano);
|
|
30
|
+
(0, _prefixer.addon)(nano);
|
|
31
|
+
(0, _hydrate.addon)(nano);
|
|
32
|
+
return nano;
|
|
33
|
+
}
|
|
34
|
+
var _default = exports["default"] = style;
|
|
35
|
+
//# sourceMappingURL=CSSinJS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CSSinJS.js","names":["_nanoCss","require","_cache","_hydrate","_prefixer","_rule","_nano","style","opt","createStyle","arguments","length","undefined","nano","create","_objectSpread2","pfx","verbose","addonCache","addonRule","addonPrefixer","addonHydrate","_default","exports"],"sources":["../../src/utils/CSSinJS.ts"],"sourcesContent":["import { create, type NanoOptions, type NanoRenderer } from '@phytonmk/nano-css';\nimport { addon as addonCache } from '@phytonmk/nano-css/addon/cache';\nimport { addon as addonHydrate } from '@phytonmk/nano-css/addon/hydrate';\nimport { addon as addonPrefixer } from '@phytonmk/nano-css/addon/prefixer';\nimport { addon as addonRule } from '@phytonmk/nano-css/addon/rule';\n\nlet _nano: any = null;\n\nfunction style(opt?: NanoOptions): NanoRenderer {\n if (!_nano) {\n _nano = createStyle(opt);\n }\n return _nano;\n}\n\nfunction createStyle(opt: NanoOptions = {}): NanoRenderer {\n const nano = create({ pfx: 'css', verbose: true, ...opt });\n\n addonCache(nano);\n addonRule(nano);\n addonPrefixer(nano);\n addonHydrate(nano);\n\n return nano;\n}\n\nexport { createStyle };\n\nexport default style;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAEA,IAAIK,KAAU,GAAG,IAAI;AAErB,SAASC,KAAKA,CAACC,GAAiB,EAAgB;EAC9C,IAAI,CAACF,KAAK,EAAE;IACVA,KAAK,GAAGG,WAAW,CAACD,GAAG,CAAC;EAC1B;EACA,OAAOF,KAAK;AACd;AAEA,SAASG,WAAWA,CAAA,EAAsC;EAAA,IAArCD,GAAgB,GAAAE,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EACxC,IAAMG,IAAI,GAAG,IAAAC,eAAM,MAAAC,cAAA;IAAGC,GAAG,EAAE,KAAK;IAAEC,OAAO,EAAE;EAAI,GAAKT,GAAG,CAAE,CAAC;EAE1D,IAAAU,YAAU,EAACL,IAAI,CAAC;EAChB,IAAAM,WAAS,EAACN,IAAI,CAAC;EACf,IAAAO,eAAa,EAACP,IAAI,CAAC;EACnB,IAAAQ,cAAY,EAACR,IAAI,CAAC;EAElB,OAAOA,IAAI;AACb;AAAC,IAAAS,QAAA,GAAAC,OAAA,cAIchB,KAAK","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import { create } from '@phytonmk/nano-css';
|
|
3
|
+
import { addon as addonCache } from '@phytonmk/nano-css/addon/cache';
|
|
4
|
+
import { addon as addonHydrate } from '@phytonmk/nano-css/addon/hydrate';
|
|
5
|
+
import { addon as addonPrefixer } from '@phytonmk/nano-css/addon/prefixer';
|
|
6
|
+
import { addon as addonRule } from '@phytonmk/nano-css/addon/rule';
|
|
7
|
+
var _nano = null;
|
|
8
|
+
function style(opt) {
|
|
9
|
+
if (!_nano) {
|
|
10
|
+
_nano = createStyle(opt);
|
|
11
|
+
}
|
|
12
|
+
return _nano;
|
|
13
|
+
}
|
|
14
|
+
function createStyle() {
|
|
15
|
+
var opt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
16
|
+
var nano = create(_objectSpread({
|
|
17
|
+
pfx: 'css',
|
|
18
|
+
verbose: true
|
|
19
|
+
}, opt));
|
|
20
|
+
addonCache(nano);
|
|
21
|
+
addonRule(nano);
|
|
22
|
+
addonPrefixer(nano);
|
|
23
|
+
addonHydrate(nano);
|
|
24
|
+
return nano;
|
|
25
|
+
}
|
|
26
|
+
export { createStyle };
|
|
27
|
+
export default style;
|
|
28
|
+
//# sourceMappingURL=CSSinJS.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CSSinJS.mjs","names":["create","addon","addonCache","addonHydrate","addonPrefixer","addonRule","_nano","style","opt","createStyle","arguments","length","undefined","nano","_objectSpread","pfx","verbose"],"sources":["../../src/utils/CSSinJS.ts"],"sourcesContent":["import { create, type NanoOptions, type NanoRenderer } from '@phytonmk/nano-css';\nimport { addon as addonCache } from '@phytonmk/nano-css/addon/cache';\nimport { addon as addonHydrate } from '@phytonmk/nano-css/addon/hydrate';\nimport { addon as addonPrefixer } from '@phytonmk/nano-css/addon/prefixer';\nimport { addon as addonRule } from '@phytonmk/nano-css/addon/rule';\n\nlet _nano: any = null;\n\nfunction style(opt?: NanoOptions): NanoRenderer {\n if (!_nano) {\n _nano = createStyle(opt);\n }\n return _nano;\n}\n\nfunction createStyle(opt: NanoOptions = {}): NanoRenderer {\n const nano = create({ pfx: 'css', verbose: true, ...opt });\n\n addonCache(nano);\n addonRule(nano);\n addonPrefixer(nano);\n addonHydrate(nano);\n\n return nano;\n}\n\nexport { createStyle };\n\nexport default style;\n"],"mappings":";AAAA,SAASA,MAAM,QAA6C,oBAAoB;AAChF,SAASC,KAAK,IAAIC,UAAU,QAAQ,gCAAgC;AACpE,SAASD,KAAK,IAAIE,YAAY,QAAQ,kCAAkC;AACxE,SAASF,KAAK,IAAIG,aAAa,QAAQ,mCAAmC;AAC1E,SAASH,KAAK,IAAII,SAAS,QAAQ,+BAA+B;AAElE,IAAIC,KAAU,GAAG,IAAI;AAErB,SAASC,KAAKA,CAACC,GAAiB,EAAgB;EAC9C,IAAI,CAACF,KAAK,EAAE;IACVA,KAAK,GAAGG,WAAW,CAACD,GAAG,CAAC;EAC1B;EACA,OAAOF,KAAK;AACd;AAEA,SAASG,WAAWA,CAAA,EAAsC;EAAA,IAArCD,GAAgB,GAAAE,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EACxC,IAAMG,IAAI,GAAGb,MAAM,CAAAc,aAAA;IAAGC,GAAG,EAAE,KAAK;IAAEC,OAAO,EAAE;EAAI,GAAKR,GAAG,CAAE,CAAC;EAE1DN,UAAU,CAACW,IAAI,CAAC;EAChBR,SAAS,CAACQ,IAAI,CAAC;EACfT,aAAa,CAACS,IAAI,CAAC;EACnBV,YAAY,CAACU,IAAI,CAAC;EAElB,OAAOA,IAAI;AACb;AAEA,SAASJ,WAAW;AAEpB,eAAeF,KAAK","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type Tokens = {
|
|
3
|
+
[tokenName: string]: string;
|
|
4
|
+
};
|
|
5
|
+
export type ThemeProviderProps = JSX.IntrinsicElements['div'] & {
|
|
6
|
+
tokens: Tokens;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
export declare const useContextTokens: () => Tokens | null;
|
|
10
|
+
export declare const useContextTheme: (ref: React.RefObject<HTMLElement>, available?: boolean) => void;
|
|
11
|
+
export declare const contextThemeEnhance: <T extends Record<string, any> = {}>(getAvailable?: (props: T) => boolean | undefined) => (props: T) => T & {
|
|
12
|
+
ref: React.Ref<unknown>;
|
|
13
|
+
};
|
|
14
|
+
export declare const ThemeProvider: (props: ThemeProviderProps) => React.ReactElement;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useContextTokens = exports.useContextTheme = exports.contextThemeEnhance = exports.ThemeProvider = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
var _ref3 = require("./ref");
|
|
14
|
+
var _useEnhancedEffect = _interopRequireDefault(require("./use/useEnhancedEffect"));
|
|
15
|
+
var _excluded = ["tokens", "children", "style"];
|
|
16
|
+
var useContextTokens = exports.useContextTokens = function useContextTokens() {
|
|
17
|
+
return _react["default"].useContext(themeContext);
|
|
18
|
+
};
|
|
19
|
+
var useContextTheme = exports.useContextTheme = function useContextTheme(ref, available) {
|
|
20
|
+
var tokens = useContextTokens();
|
|
21
|
+
var tokensKey = _react["default"].useMemo(function () {
|
|
22
|
+
if (!tokens) return '';
|
|
23
|
+
return Object.entries(tokens).map(function (_ref) {
|
|
24
|
+
var _ref2 = (0, _slicedToArray2["default"])(_ref, 2),
|
|
25
|
+
key = _ref2[0],
|
|
26
|
+
value = _ref2[1];
|
|
27
|
+
return "".concat(key, "-").concat(value);
|
|
28
|
+
}).join('/');
|
|
29
|
+
}, [tokens]);
|
|
30
|
+
(0, _useEnhancedEffect["default"])(function () {
|
|
31
|
+
if (available !== undefined && !available) return;
|
|
32
|
+
if (!ref.current || !ref.current.style || !ref.current.style.setProperty) return;
|
|
33
|
+
for (var token in tokens) {
|
|
34
|
+
ref.current.style.setProperty(token, tokens[token]);
|
|
35
|
+
}
|
|
36
|
+
}, [tokensKey, available]);
|
|
37
|
+
};
|
|
38
|
+
var contextThemeEnhance = exports.contextThemeEnhance = function contextThemeEnhance(getAvailable) {
|
|
39
|
+
return function (props) {
|
|
40
|
+
var existingRef = props.ref;
|
|
41
|
+
var available = _react["default"].useMemo(function () {
|
|
42
|
+
return getAvailable === null || getAvailable === void 0 ? void 0 : getAvailable(props);
|
|
43
|
+
}, Object.values(props));
|
|
44
|
+
var enhanceRef = _react["default"].useRef();
|
|
45
|
+
var refArr = _react["default"].useMemo(function () {
|
|
46
|
+
return existingRef ? [existingRef, enhanceRef] : [enhanceRef];
|
|
47
|
+
}, [existingRef, enhanceRef]);
|
|
48
|
+
var ref = (0, _ref3.useForkRef)(refArr);
|
|
49
|
+
useContextTheme(enhanceRef, available);
|
|
50
|
+
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), {}, {
|
|
51
|
+
ref: ref
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
var themeContext = /*#__PURE__*/_react["default"].createContext(null);
|
|
56
|
+
var ThemeProvider = exports.ThemeProvider = function ThemeProvider(props) {
|
|
57
|
+
var _props$tokens = props.tokens,
|
|
58
|
+
providedTokens = _props$tokens === void 0 ? {} : _props$tokens,
|
|
59
|
+
children = props.children,
|
|
60
|
+
_props$style = props.style,
|
|
61
|
+
providedStyle = _props$style === void 0 ? {} : _props$style,
|
|
62
|
+
restProps = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
63
|
+
var contextTokens = _react["default"].useContext(themeContext);
|
|
64
|
+
var tokens = _react["default"].useMemo(function () {
|
|
65
|
+
return contextTokens === null ? providedTokens : (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, contextTokens), providedTokens);
|
|
66
|
+
}, [contextTokens, providedTokens]);
|
|
67
|
+
var style = _react["default"].useMemo(function () {
|
|
68
|
+
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({
|
|
69
|
+
display: 'contents'
|
|
70
|
+
}, tokens), providedStyle);
|
|
71
|
+
}, [tokens, providedStyle]);
|
|
72
|
+
return /*#__PURE__*/_react["default"].createElement(themeContext.Provider, {
|
|
73
|
+
value: tokens
|
|
74
|
+
}, /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({}, restProps, {
|
|
75
|
+
style: style
|
|
76
|
+
}), children));
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=ThemeProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeProvider.js","names":["_react","_interopRequireDefault","require","_ref3","_useEnhancedEffect","_excluded","useContextTokens","exports","React","useContext","themeContext","useContextTheme","ref","available","tokens","tokensKey","useMemo","Object","entries","map","_ref","_ref2","_slicedToArray2","key","value","concat","join","useEnhancedEffect","undefined","current","style","setProperty","token","contextThemeEnhance","getAvailable","props","existingRef","values","enhanceRef","useRef","refArr","useForkRef","_objectSpread2","createContext","ThemeProvider","_props$tokens","providedTokens","children","_props$style","providedStyle","restProps","_objectWithoutProperties2","contextTokens","display","createElement","Provider","_extends2"],"sources":["../../src/utils/ThemeProvider.tsx"],"sourcesContent":["import React from 'react';\n\nimport { useForkRef } from './ref';\nimport useEnhancedEffect from './use/useEnhancedEffect';\n\ntype Tokens = { [tokenName: string]: string };\nexport type ThemeProviderProps = JSX.IntrinsicElements['div'] & {\n tokens: Tokens;\n children: React.ReactNode;\n};\n\nexport const useContextTokens = () => React.useContext(themeContext);\n\nexport const useContextTheme = (ref: React.RefObject<HTMLElement>, available?: boolean) => {\n const tokens = useContextTokens();\n const tokensKey = React.useMemo(() => {\n if (!tokens) return '';\n return Object.entries(tokens)\n .map(([key, value]) => `${key}-${value}`)\n .join('/');\n }, [tokens]);\n useEnhancedEffect(() => {\n if (available !== undefined && !available) return;\n if (!ref.current || !ref.current.style || !ref.current.style.setProperty) return;\n for (const token in tokens) {\n ref.current.style.setProperty(token, tokens[token]);\n }\n }, [tokensKey, available]);\n};\nexport const contextThemeEnhance = <T extends Record<string, any> = {}>(\n getAvailable?: (props: T) => boolean | undefined,\n) => {\n return (props: T) => {\n const existingRef = props.ref;\n const available = React.useMemo(() => getAvailable?.(props), Object.values(props));\n const enhanceRef: any = React.useRef();\n const refArr: any = React.useMemo(\n () => (existingRef ? [existingRef, enhanceRef] : [enhanceRef]),\n [existingRef, enhanceRef],\n );\n const ref = useForkRef(refArr);\n useContextTheme(enhanceRef, available);\n\n return { ...props, ref };\n };\n};\n\nconst themeContext = React.createContext<Tokens | null>(null);\n\nexport const ThemeProvider = (props: ThemeProviderProps): React.ReactElement => {\n const { tokens: providedTokens = {}, children, style: providedStyle = {}, ...restProps } = props;\n const contextTokens = React.useContext(themeContext);\n const tokens = React.useMemo(\n () => (contextTokens === null ? providedTokens : { ...contextTokens, ...providedTokens }),\n [contextTokens, providedTokens],\n );\n const style: React.CSSProperties = React.useMemo(() => {\n return {\n display: 'contents',\n ...tokens,\n ...providedStyle,\n };\n }, [tokens, providedStyle]);\n\n return (\n <themeContext.Provider value={tokens}>\n <div {...restProps} style={style}>\n {children}\n </div>\n </themeContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAH,sBAAA,CAAAC,OAAA;AAAwD,IAAAG,SAAA;AAQjD,IAAMC,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,SAAnBA,gBAAgBA,CAAA;EAAA,OAASE,iBAAK,CAACC,UAAU,CAACC,YAAY,CAAC;AAAA;AAE7D,IAAMC,eAAe,GAAAJ,OAAA,CAAAI,eAAA,GAAG,SAAlBA,eAAeA,CAAIC,GAAiC,EAAEC,SAAmB,EAAK;EACzF,IAAMC,MAAM,GAAGR,gBAAgB,CAAC,CAAC;EACjC,IAAMS,SAAS,GAAGP,iBAAK,CAACQ,OAAO,CAAC,YAAM;IACpC,IAAI,CAACF,MAAM,EAAE,OAAO,EAAE;IACtB,OAAOG,MAAM,CAACC,OAAO,CAACJ,MAAM,CAAC,CA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B,CAAC,EAAE,CAACnC,MAAM,EAAEmC,aAAa,CAAC,CAAC;EAE3B,oBACEjD,MAAA,YAAAsD,aAAA,CAAC5C,YAAY,CAAC6C,QAAQ;IAAC/B,KAAK,EAAEV;EAAO,gBACnCd,MAAA,YAAAsD,aAAA,YAAAE,SAAA,iBAASN,SAAS;IAAEpB,KAAK,EAAEA;EAAM,IAC9BiB,QACE,CACgB,CAAC;AAE5B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
|
+
var _excluded = ["tokens", "children", "style"];
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { useForkRef } from "./ref.mjs";
|
|
8
|
+
import useEnhancedEffect from "./use/useEnhancedEffect.mjs";
|
|
9
|
+
export var useContextTokens = function useContextTokens() {
|
|
10
|
+
return React.useContext(themeContext);
|
|
11
|
+
};
|
|
12
|
+
export var useContextTheme = function useContextTheme(ref, available) {
|
|
13
|
+
var tokens = useContextTokens();
|
|
14
|
+
var tokensKey = React.useMemo(function () {
|
|
15
|
+
if (!tokens) return '';
|
|
16
|
+
return Object.entries(tokens).map(function (_ref) {
|
|
17
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
18
|
+
key = _ref2[0],
|
|
19
|
+
value = _ref2[1];
|
|
20
|
+
return "".concat(key, "-").concat(value);
|
|
21
|
+
}).join('/');
|
|
22
|
+
}, [tokens]);
|
|
23
|
+
useEnhancedEffect(function () {
|
|
24
|
+
if (available !== undefined && !available) return;
|
|
25
|
+
if (!ref.current || !ref.current.style || !ref.current.style.setProperty) return;
|
|
26
|
+
for (var token in tokens) {
|
|
27
|
+
ref.current.style.setProperty(token, tokens[token]);
|
|
28
|
+
}
|
|
29
|
+
}, [tokensKey, available]);
|
|
30
|
+
};
|
|
31
|
+
export var contextThemeEnhance = function contextThemeEnhance(getAvailable) {
|
|
32
|
+
return function (props) {
|
|
33
|
+
var existingRef = props.ref;
|
|
34
|
+
var available = React.useMemo(function () {
|
|
35
|
+
return getAvailable === null || getAvailable === void 0 ? void 0 : getAvailable(props);
|
|
36
|
+
}, Object.values(props));
|
|
37
|
+
var enhanceRef = React.useRef();
|
|
38
|
+
var refArr = React.useMemo(function () {
|
|
39
|
+
return existingRef ? [existingRef, enhanceRef] : [enhanceRef];
|
|
40
|
+
}, [existingRef, enhanceRef]);
|
|
41
|
+
var ref = useForkRef(refArr);
|
|
42
|
+
useContextTheme(enhanceRef, available);
|
|
43
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
|
44
|
+
ref: ref
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
var themeContext = /*#__PURE__*/React.createContext(null);
|
|
49
|
+
export var ThemeProvider = function ThemeProvider(props) {
|
|
50
|
+
var _props$tokens = props.tokens,
|
|
51
|
+
providedTokens = _props$tokens === void 0 ? {} : _props$tokens,
|
|
52
|
+
children = props.children,
|
|
53
|
+
_props$style = props.style,
|
|
54
|
+
providedStyle = _props$style === void 0 ? {} : _props$style,
|
|
55
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
56
|
+
var contextTokens = React.useContext(themeContext);
|
|
57
|
+
var tokens = React.useMemo(function () {
|
|
58
|
+
return contextTokens === null ? providedTokens : _objectSpread(_objectSpread({}, contextTokens), providedTokens);
|
|
59
|
+
}, [contextTokens, providedTokens]);
|
|
60
|
+
var style = React.useMemo(function () {
|
|
61
|
+
return _objectSpread(_objectSpread({
|
|
62
|
+
display: 'contents'
|
|
63
|
+
}, tokens), providedStyle);
|
|
64
|
+
}, [tokens, providedStyle]);
|
|
65
|
+
return /*#__PURE__*/React.createElement(themeContext.Provider, {
|
|
66
|
+
value: tokens
|
|
67
|
+
}, /*#__PURE__*/React.createElement("div", _extends({}, restProps, {
|
|
68
|
+
style: style
|
|
69
|
+
}), children));
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=ThemeProvider.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeProvider.mjs","names":["React","useForkRef","useEnhancedEffect","useContextTokens","useContext","themeContext","useContextTheme","ref","available","tokens","tokensKey","useMemo","Object","entries","map","_ref","_ref2","_slicedToArray","key","value","concat","join","undefined","current","style","setProperty","token","contextThemeEnhance","getAvailable","props","existingRef","values","enhanceRef","useRef","refArr","_objectSpread","createContext","ThemeProvider","_props$tokens","providedTokens","children","_props$style","providedStyle","restProps","_objectWithoutProperties","_excluded","contextTokens","display","createElement","Provider","_extends"],"sources":["../../src/utils/ThemeProvider.tsx"],"sourcesContent":["import React from 'react';\n\nimport { useForkRef } from './ref';\nimport useEnhancedEffect from './use/useEnhancedEffect';\n\ntype Tokens = { [tokenName: string]: string };\nexport type ThemeProviderProps = JSX.IntrinsicElements['div'] & {\n tokens: Tokens;\n children: React.ReactNode;\n};\n\nexport const useContextTokens = () => React.useContext(themeContext);\n\nexport const useContextTheme = (ref: React.RefObject<HTMLElement>, available?: boolean) => {\n const tokens = useContextTokens();\n const tokensKey = React.useMemo(() => {\n if (!tokens) return '';\n return Object.entries(tokens)\n .map(([key, value]) => `${key}-${value}`)\n .join('/');\n }, [tokens]);\n useEnhancedEffect(() => {\n if (available !== undefined && !available) return;\n if (!ref.current || !ref.current.style || !ref.current.style.setProperty) return;\n for (const token in tokens) {\n ref.current.style.setProperty(token, tokens[token]);\n }\n }, [tokensKey, available]);\n};\nexport const contextThemeEnhance = <T extends Record<string, any> = {}>(\n getAvailable?: (props: T) => boolean | undefined,\n) => {\n return (props: T) => {\n const existingRef = props.ref;\n const available = React.useMemo(() => getAvailable?.(props), Object.values(props));\n const enhanceRef: any = React.useRef();\n const refArr: any = React.useMemo(\n () => (existingRef ? [existingRef, enhanceRef] : [enhanceRef]),\n [existingRef, enhanceRef],\n );\n const ref = useForkRef(refArr);\n useContextTheme(enhanceRef, available);\n\n return { ...props, ref };\n };\n};\n\nconst themeContext = React.createContext<Tokens | null>(null);\n\nexport const ThemeProvider = (props: ThemeProviderProps): React.ReactElement => {\n const { tokens: providedTokens = {}, children, style: providedStyle = {}, ...restProps } = props;\n const contextTokens = React.useContext(themeContext);\n const tokens = React.useMemo(\n () => (contextTokens === null ? providedTokens : { ...contextTokens, ...providedTokens }),\n [contextTokens, providedTokens],\n );\n const style: React.CSSProperties = React.useMemo(() => {\n return {\n display: 'contents',\n ...tokens,\n ...providedStyle,\n };\n }, [tokens, providedStyle]);\n\n return (\n <themeContext.Provider value={tokens}>\n <div {...restProps} style={style}>\n {children}\n </div>\n </themeContext.Provider>\n );\n};\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,UAAU,QAAQ,WAAO;AAClC,OAAOC,iBAAiB,MAAM,6BAAyB;AAQvD,OAAO,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAA;EAAA,OAASH,KAAK,CAACI,UAAU,CAACC,YAAY,CAAC;AAAA;AAEpE,OAAO,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,GAAiC,EAAEC,SAAmB,EAAK;EACzF,IAAMC,MAAM,GAAGN,gBAAgB,CAAC,CAAC;EACjC,IAAMO,SAAS,GAAGV,KAAK,CAACW,OAAO,CAAC,YAAM;IACpC,IAAI,CAACF,MAAM,EAAE,OAAO,EAAE;IACtB,OAAOG,MAAM,CAACC,OAAO,CAACJ,MAAM,CAAC,CAC1BK,GAAG,CAAC,UAAAC,IAAA;MAAA,IAAAC,KAAA,GAAAC,cAAA,CAAAF,IAAA;QAAEG,GAAG,GAAAF,KAAA;QAAEG,KAAK,GAAAH,KAAA;MAAA,UAAAI,MAAA,CAASF,GAAG,OAAAE,MAAA,CAAID,KAAK;IAAA,CAAE,CAAC,CACxCE,IAAI,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 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export default function addonText(children: React.ReactNode, Text: React.ComponentType<any>, Addon: React.ComponentType, isTextWrapIfEmptyChildren?: boolean): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = addonText;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
function addonText(children, Text, Addon) {
|
|
10
|
+
var isTextWrapIfEmptyChildren = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
11
|
+
if (!isTextWrapIfEmptyChildren && !children) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
return _react["default"].Children.toArray(children).some(function (element) {
|
|
15
|
+
return /*#__PURE__*/_react["default"].isValidElement(element) && (element.type === _react["default"].Fragment || element.type['displayName'] === Text.displayName || element.type['displayName'] === Addon.displayName);
|
|
16
|
+
}) ? children : /*#__PURE__*/_react["default"].createElement(Text, null, children);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=addonText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addonText.js","names":["_react","_interopRequireDefault","require","addonText","children","Text","Addon","isTextWrapIfEmptyChildren","arguments","length","undefined","React","Children","toArray","some","element","isValidElement","type","Fragment","displayName","createElement"],"sources":["../../src/utils/addonText.tsx"],"sourcesContent":["import React from 'react';\n\nexport default function addonText(\n children: React.ReactNode,\n Text: React.ComponentType<any>,\n Addon: React.ComponentType,\n isTextWrapIfEmptyChildren = false,\n) {\n if (!isTextWrapIfEmptyChildren && !children) {\n return false;\n }\n return React.Children.toArray(children).some(\n (element) =>\n React.isValidElement(element) &&\n (element.type === React.Fragment ||\n (element.type as any)['displayName'] === Text.displayName ||\n (element.type as any)['displayName'] === Addon.displayName),\n )\n ? (\n children\n )\n : (\n <Text>{children}</Text>\n );\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEe,SAASC,SAASA,CAC/BC,QAAyB,EACzBC,IAA8B,EAC9BC,KAA0B,EAE1B;EAAA,IADAC,yBAAyB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,KAAK;EAEjC,IAAI,CAACD,yBAAyB,IAAI,CAACH,QAAQ,EAAE;IAC3C,OAAO,KAAK;EACd;EACA,OAAOO,iBAAK,CAACC,QAAQ,CAACC,OAAO,CAACT,QAAQ,CAAC,CAACU,IAAI,CAC1C,UAACC,OAAO;IAAA,OACN,aAAAJ,iBAAK,CAACK,cAAc,CAACD,OAAO,CAAC,KAC5BA,OAAO,CAACE,IAAI,KAAKN,iBAAK,CAACO,QAAQ,IAC7BH,OAAO,CAACE,IAAI,CAAS,aAAa,CAAC,KAAKZ,IAAI,CAACc,WAAW,IACxDJ,OAAO,CAACE,IAAI,CAAS,aAAa,CAAC,KAAKX,KAAK,CAACa,WAAW,CAAC;EAAA,CACjE,CAAC,GAEKf,QAAQ,gBAGRJ,MAAA,YAAAoB,aAAA,CAACf,IAAI,QAAED,QAAe,CACvB;AACP","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export default function addonText(children, Text, Addon) {
|
|
3
|
+
var isTextWrapIfEmptyChildren = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
4
|
+
if (!isTextWrapIfEmptyChildren && !children) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
return React.Children.toArray(children).some(function (element) {
|
|
8
|
+
return /*#__PURE__*/React.isValidElement(element) && (element.type === React.Fragment || element.type['displayName'] === Text.displayName || element.type['displayName'] === Addon.displayName);
|
|
9
|
+
}) ? children : /*#__PURE__*/React.createElement(Text, null, children);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=addonText.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addonText.mjs","names":["React","addonText","children","Text","Addon","isTextWrapIfEmptyChildren","arguments","length","undefined","Children","toArray","some","element","isValidElement","type","Fragment","displayName","createElement"],"sources":["../../src/utils/addonText.tsx"],"sourcesContent":["import React from 'react';\n\nexport default function addonText(\n children: React.ReactNode,\n Text: React.ComponentType<any>,\n Addon: React.ComponentType,\n isTextWrapIfEmptyChildren = false,\n) {\n if (!isTextWrapIfEmptyChildren && !children) {\n return false;\n }\n return React.Children.toArray(children).some(\n (element) =>\n React.isValidElement(element) &&\n (element.type === React.Fragment ||\n (element.type as any)['displayName'] === Text.displayName ||\n (element.type as any)['displayName'] === Addon.displayName),\n )\n ? (\n children\n )\n : (\n <Text>{children}</Text>\n );\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,eAAe,SAASC,SAASA,CAC/BC,QAAyB,EACzBC,IAA8B,EAC9BC,KAA0B,EAE1B;EAAA,IADAC,yBAAyB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,KAAK;EAEjC,IAAI,CAACD,yBAAyB,IAAI,CAACH,QAAQ,EAAE;IAC3C,OAAO,KAAK;EACd;EACA,OAAOF,KAAK,CAACS,QAAQ,CAACC,OAAO,CAACR,QAAQ,CAAC,CAACS,IAAI,CAC1C,UAACC,OAAO;IAAA,OACN,aAAAZ,KAAK,CAACa,cAAc,CAACD,OAAO,CAAC,KAC5BA,OAAO,CAACE,IAAI,KAAKd,KAAK,CAACe,QAAQ,IAC7BH,OAAO,CAACE,IAAI,CAAS,aAAa,CAAC,KAAKX,IAAI,CAACa,WAAW,IACxDJ,OAAO,CAACE,IAAI,CAAS,aAAa,CAAC,KAAKV,KAAK,CAACY,WAAW,CAAC;EAAA,CACjE,CAAC,GAEKd,QAAQ,gBAGRF,KAAA,CAAAiB,aAAA,CAACd,IAAI,QAAED,QAAe,CACvB;AACP","ignoreList":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _getOriginChildren = _interopRequireDefault(require("./getOriginChildren"));
|
|
11
|
+
var _isNode = _interopRequireDefault(require("./isNode"));
|
|
12
|
+
var _symbols = require("../core-types/symbols");
|
|
13
|
+
function addonTextChildren(Children, Text, Addon) {
|
|
14
|
+
var isTextWrapIfEmptyChildren = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
15
|
+
var children = (0, _getOriginChildren["default"])(Children);
|
|
16
|
+
if (typeof children === 'function') {
|
|
17
|
+
return /*#__PURE__*/_react["default"].createElement(Children, null);
|
|
18
|
+
}
|
|
19
|
+
if (!isTextWrapIfEmptyChildren && !(0, _isNode["default"])(children)) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return _react["default"].Children.toArray(children).some(function (element) {
|
|
23
|
+
if (! /*#__PURE__*/_react["default"].isValidElement(element)) return false;
|
|
24
|
+
if (element.type === _react["default"].Fragment) return true;
|
|
25
|
+
if (element.type[_symbols.CHILDREN_COMPONENT]) {
|
|
26
|
+
var wrapChildren = addonTextChildren(element.type, Text, Addon);
|
|
27
|
+
if (wrapChildren.type[_symbols.CHILDREN_COMPONENT]) {
|
|
28
|
+
return true;
|
|
29
|
+
} else {
|
|
30
|
+
element = wrapChildren;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
var inheritedNames = element.type[_symbols.INHERITED_NAME] || [element.type.displayName];
|
|
35
|
+
var addonNames = Array.isArray(Addon) ? Addon.map(function (Component) {
|
|
36
|
+
return Component.displayName;
|
|
37
|
+
}) : [Addon.displayName];
|
|
38
|
+
return [Text.displayName].concat((0, _toConsumableArray2["default"])(addonNames)).find(function (name) {
|
|
39
|
+
return inheritedNames.includes(name);
|
|
40
|
+
});
|
|
41
|
+
}) ? /*#__PURE__*/_react["default"].createElement(Children, null) : /*#__PURE__*/_react["default"].createElement(Text, null, /*#__PURE__*/_react["default"].createElement(Children, null));
|
|
42
|
+
}
|
|
43
|
+
var _default = exports["default"] = addonTextChildren;
|
|
44
|
+
//# sourceMappingURL=addonTextChildren.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addonTextChildren.js","names":["_react","_interopRequireDefault","require","_getOriginChildren","_isNode","_symbols","addonTextChildren","Children","Text","Addon","isTextWrapIfEmptyChildren","arguments","length","undefined","children","getOriginChildren","createElement","isNode","React","toArray","some","element","isValidElement","type","Fragment","CHILDREN_COMPONENT","wrapChildren","inheritedNames","INHERITED_NAME","displayName","addonNames","Array","isArray","map","Component","concat","_toConsumableArray2","find","name","includes","_default","exports"],"sources":["../../src/utils/addonTextChildren.tsx"],"sourcesContent":["import React from 'react';\n\nimport getOriginChildren from './getOriginChildren';\nimport isNode from './isNode';\nimport { CHILDREN_COMPONENT, INHERITED_NAME } from '../core-types/symbols';\n\nfunction addonTextChildren(\n Children: any,\n Text: React.ComponentType<any>,\n Addon: React.ComponentType | React.ComponentType[],\n isTextWrapIfEmptyChildren = false,\n) {\n const children = getOriginChildren(Children);\n if (typeof children === 'function') {\n return <Children />;\n }\n\n if (!isTextWrapIfEmptyChildren && !isNode(children)) {\n return null;\n }\n return React.Children.toArray(children).some((element: any) => {\n if (!React.isValidElement(element)) return false;\n if (element.type === React.Fragment) return true;\n if ((element.type as any)[CHILDREN_COMPONENT]) {\n const wrapChildren: any = addonTextChildren(element.type, Text, Addon);\n if (wrapChildren.type[CHILDREN_COMPONENT]) {\n return true;\n } else {\n element = wrapChildren;\n }\n }\n // @ts-ignore\n const inheritedNames = element.type[INHERITED_NAME] || [element.type.displayName];\n const addonNames = Array.isArray(Addon)\n ? Addon.map((Component) => Component.displayName)\n : [Addon.displayName];\n return [Text.displayName, ...addonNames].find((name) => inheritedNames.includes(name));\n })\n ? (<Children />)\n : (\n <Text>\n <Children />\n </Text>\n );\n}\n\nexport default addonTextChildren;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,kBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAEA,SAASI,iBAAiBA,CACxBC,QAAa,EACbC,IAA8B,EAC9BC,KAAkD,EAElD;EAAA,IADAC,yBAAyB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,KAAK;EAEjC,IAAMG,QAAQ,GAAG,IAAAC,6BAAiB,EAACR,QAAQ,CAAC;EAC5C,IAAI,OAAOO,QAAQ,KAAK,UAAU,EAAE;IAClC,oBAAOd,MAAA,YAAAgB,aAAA,CAACT,QAAQ,MAAE,CAAC;EACrB;EAEA,IAAI,CAACG,yBAAyB,IAAI,CAAC,IAAAO,kBAAM,EAACH,QAAQ,CAAC,EAAE;IACnD,OAAO,IAAI;EACb;EACA,OAAOI,iBAAK,CAACX,QAAQ,CAACY,OAAO,CAACL,QAAQ,CAAC,CAACM,IAAI,CAAC,UAACC,OAAY,EAAK;IAC7D,IAAI,eAACH,iBAAK,CAACI,cAAc,CAACD,OAAO,CAAC,EAAE,OAAO,KAAK;IAChD,IAAIA,OAAO,CAACE,IAAI,KAAKL,iBAAK,CAACM,QAAQ,EAAE,OAAO,IAAI;IAChD,IAAKH,OAAO,CAACE,IAAI,CAASE,2BAAkB,CAAC,EAAE;MAC7C,IAAMC,YAAiB,GAAGpB,iBAAiB,CAACe,OAAO,CAACE,IAAI,EAAEf,IAAI,EAAEC,KAAK,CAAC;MACtE,IAAIiB,YAAY,CAACH,IAAI,CAACE,2BAAkB,CAAC,EAAE;QACzC,OAAO,IAAI;MACb,CAAC,MAAM;QACLJ,OAAO,GAAGK,YAAY;MACxB;IACF;IACA;IACA,IAAMC,cAAc,GAAGN,OAAO,CAACE,IAAI,CAACK,uBAAc,CAAC,IAAI,CAACP,OAAO,CAACE,IAAI,CAACM,WAAW,CAAC;IACjF,IAAMC,UAAU,GAAGC,KAAK,CAACC,OAAO,CAACvB,KAAK,CAAC,GACnCA,KAAK,CAACwB,GAAG,CAAC,UAACC,SAAS;MAAA,OAAKA,SAAS,CAACL,WAAW;IAAA,EAAC,GAC/C,CAACpB,KAAK,CAACoB,WAAW,CAAC;IACvB,OAAO,CAACrB,IAAI,CAACqB,WAAW,EAAAM,MAAA,KAAAC,mBAAA,aAAKN,UAAU,GAAEO,IAAI,CAAC,UAACC,IAAI;MAAA,OAAKX,cAAc,CAACY,QAAQ,CAACD,IAAI,CAAC;IAAA,EAAC;EACxF,CAAC,CAAC,gBACGtC,MAAA,YAAAgB,aAAA,CAACT,QAAQ,MAAE,CAAC,gBAEXP,MAAA,YAAAgB,aAAA,CAACR,IAAI,qBACHR,MAAA,YAAAgB,aAAA,CAACT,QAAQ,MAAE,CACP,CACP;AACP;AAAC,IAAAiC,QAAA,GAAAC,OAAA,cAEcnC,iBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import getOriginChildren from "./getOriginChildren.mjs";
|
|
4
|
+
import isNode from "./isNode.mjs";
|
|
5
|
+
import { CHILDREN_COMPONENT, INHERITED_NAME } from "../core-types/symbols.mjs";
|
|
6
|
+
function addonTextChildren(Children, Text, Addon) {
|
|
7
|
+
var isTextWrapIfEmptyChildren = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
8
|
+
var children = getOriginChildren(Children);
|
|
9
|
+
if (typeof children === 'function') {
|
|
10
|
+
return /*#__PURE__*/React.createElement(Children, null);
|
|
11
|
+
}
|
|
12
|
+
if (!isTextWrapIfEmptyChildren && !isNode(children)) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return React.Children.toArray(children).some(function (element) {
|
|
16
|
+
if (! /*#__PURE__*/React.isValidElement(element)) return false;
|
|
17
|
+
if (element.type === React.Fragment) return true;
|
|
18
|
+
if (element.type[CHILDREN_COMPONENT]) {
|
|
19
|
+
var wrapChildren = addonTextChildren(element.type, Text, Addon);
|
|
20
|
+
if (wrapChildren.type[CHILDREN_COMPONENT]) {
|
|
21
|
+
return true;
|
|
22
|
+
} else {
|
|
23
|
+
element = wrapChildren;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
var inheritedNames = element.type[INHERITED_NAME] || [element.type.displayName];
|
|
28
|
+
var addonNames = Array.isArray(Addon) ? Addon.map(function (Component) {
|
|
29
|
+
return Component.displayName;
|
|
30
|
+
}) : [Addon.displayName];
|
|
31
|
+
return [Text.displayName].concat(_toConsumableArray(addonNames)).find(function (name) {
|
|
32
|
+
return inheritedNames.includes(name);
|
|
33
|
+
});
|
|
34
|
+
}) ? /*#__PURE__*/React.createElement(Children, null) : /*#__PURE__*/React.createElement(Text, null, /*#__PURE__*/React.createElement(Children, null));
|
|
35
|
+
}
|
|
36
|
+
export default addonTextChildren;
|
|
37
|
+
//# sourceMappingURL=addonTextChildren.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addonTextChildren.mjs","names":["React","getOriginChildren","isNode","CHILDREN_COMPONENT","INHERITED_NAME","addonTextChildren","Children","Text","Addon","isTextWrapIfEmptyChildren","arguments","length","undefined","children","createElement","toArray","some","element","isValidElement","type","Fragment","wrapChildren","inheritedNames","displayName","addonNames","Array","isArray","map","Component","concat","_toConsumableArray","find","name","includes"],"sources":["../../src/utils/addonTextChildren.tsx"],"sourcesContent":["import React from 'react';\n\nimport getOriginChildren from './getOriginChildren';\nimport isNode from './isNode';\nimport { CHILDREN_COMPONENT, INHERITED_NAME } from '../core-types/symbols';\n\nfunction addonTextChildren(\n Children: any,\n Text: React.ComponentType<any>,\n Addon: React.ComponentType | React.ComponentType[],\n isTextWrapIfEmptyChildren = false,\n) {\n const children = getOriginChildren(Children);\n if (typeof children === 'function') {\n return <Children />;\n }\n\n if (!isTextWrapIfEmptyChildren && !isNode(children)) {\n return null;\n }\n return React.Children.toArray(children).some((element: any) => {\n if (!React.isValidElement(element)) return false;\n if (element.type === React.Fragment) return true;\n if ((element.type as any)[CHILDREN_COMPONENT]) {\n const wrapChildren: any = addonTextChildren(element.type, Text, Addon);\n if (wrapChildren.type[CHILDREN_COMPONENT]) {\n return true;\n } else {\n element = wrapChildren;\n }\n }\n // @ts-ignore\n const inheritedNames = element.type[INHERITED_NAME] || [element.type.displayName];\n const addonNames = Array.isArray(Addon)\n ? Addon.map((Component) => Component.displayName)\n : [Addon.displayName];\n return [Text.displayName, ...addonNames].find((name) => inheritedNames.includes(name));\n })\n ? (<Children />)\n : (\n <Text>\n <Children />\n </Text>\n );\n}\n\nexport default addonTextChildren;\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAOC,iBAAiB,MAAM,yBAAqB;AACnD,OAAOC,MAAM,MAAM,cAAU;AAC7B,SAASC,kBAAkB,EAAEC,cAAc,QAAQ,2BAAuB;AAE1E,SAASC,iBAAiBA,CACxBC,QAAa,EACbC,IAA8B,EAC9BC,KAAkD,EAElD;EAAA,IADAC,yBAAyB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MA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AKV,cAAc,CAACW,QAAQ,CAACD,IAAI,CAAC;IAAA,EAAC;EACxF,CAAC,CAAC,gBACGhC,KAAA,CAAAc,aAAA,CAACR,QAAQ,MAAE,CAAC,gBAEXN,KAAA,CAAAc,aAAA,CAACP,IAAI,qBACHP,KAAA,CAAAc,aAAA,CAACR,QAAQ,MAAE,CACP,CACP;AACP;AAEA,eAAeD,iBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type AriaProps = {
|
|
2
|
+
'title'?: string;
|
|
3
|
+
'aria-label'?: string;
|
|
4
|
+
'aria-labelledby'?: string;
|
|
5
|
+
'aria-describedby'?: string;
|
|
6
|
+
};
|
|
7
|
+
type ExtractorAriaPropsReturn = {
|
|
8
|
+
__excludeProps: ['title', 'aria-label', 'aria-labelledby', 'aria-describedby'];
|
|
9
|
+
extractedAriaProps: AriaProps;
|
|
10
|
+
};
|
|
11
|
+
export declare function extractAriaProps(props: any): ExtractorAriaPropsReturn;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.extractAriaProps = extractAriaProps;
|
|
7
|
+
function extractAriaProps(props) {
|
|
8
|
+
var title = props.title,
|
|
9
|
+
ariaLabel = props['aria-label'],
|
|
10
|
+
ariaLabelledby = props['aria-labelledby'],
|
|
11
|
+
ariaDescribedby = props['aria-describedby'];
|
|
12
|
+
return {
|
|
13
|
+
__excludeProps: ['title', 'aria-label', 'aria-labelledby', 'aria-describedby'],
|
|
14
|
+
extractedAriaProps: {
|
|
15
|
+
title: title,
|
|
16
|
+
'aria-label': ariaLabel,
|
|
17
|
+
'aria-labelledby': ariaLabelledby,
|
|
18
|
+
'aria-describedby': ariaDescribedby
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=ariaProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ariaProps.js","names":["extractAriaProps","props","title","ariaLabel","ariaLabelledby","ariaDescribedby","__excludeProps","extractedAriaProps"],"sources":["../../src/utils/ariaProps.ts"],"sourcesContent":["type AriaProps = {\n 'title'?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'aria-describedby'?: string;\n};\ntype ExtractorAriaPropsReturn = {\n __excludeProps: ['title', 'aria-label', 'aria-labelledby', 'aria-describedby'];\n extractedAriaProps: AriaProps;\n};\n\nexport function extractAriaProps(props: any): ExtractorAriaPropsReturn {\n const {\n title,\n ['aria-label']: ariaLabel,\n ['aria-labelledby']: ariaLabelledby,\n ['aria-describedby']: ariaDescribedby,\n } = props;\n\n return {\n __excludeProps: ['title', 'aria-label', 'aria-labelledby', 'aria-describedby'],\n extractedAriaProps: {\n title,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n },\n };\n}\n"],"mappings":";;;;;;AAWO,SAASA,gBAAgBA,CAACC,KAAU,EAA4B;EACrE,IACEC,KAAK,GAIHD,KAAK,CAJPC,KAAK;IACWC,SAAS,GAGvBF,KAAK,CAHN,YAAY;IACQG,cAAc,GAEjCH,KAAK,CAFN,iBAAiB;IACII,eAAe,GACnCJ,KAAK,CADN,kBAAkB;EAGrB,OAAO;IACLK,cAAc,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,CAAC;IAC9EC,kBAAkB,EAAE;MAClBL,KAAK,EAALA,KAAK;MACL,YAAY,EAAEC,SAAS;MACvB,iBAAiB,EAAEC,cAAc;MACjC,kBAAkB,EAAEC;IACtB;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function extractAriaProps(props) {
|
|
2
|
+
var title = props.title,
|
|
3
|
+
ariaLabel = props['aria-label'],
|
|
4
|
+
ariaLabelledby = props['aria-labelledby'],
|
|
5
|
+
ariaDescribedby = props['aria-describedby'];
|
|
6
|
+
return {
|
|
7
|
+
__excludeProps: ['title', 'aria-label', 'aria-labelledby', 'aria-describedby'],
|
|
8
|
+
extractedAriaProps: {
|
|
9
|
+
title: title,
|
|
10
|
+
'aria-label': ariaLabel,
|
|
11
|
+
'aria-labelledby': ariaLabelledby,
|
|
12
|
+
'aria-describedby': ariaDescribedby
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=ariaProps.mjs.map
|
|
@@ -0,0 +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,IACEC,KAAK,GAIHD,KAAK,CAJPC,KAAK;IACWC,SAAS,GAGvBF,KAAK,CAHN,YAAY;IACQG,cAAc,GAEjCH,KAAK,CAFN,iBAAiB;IACII,eAAe,GACnCJ,KAAK,CADN,kBAAkB;EAGrB,OAAO;IACLK,cAAc,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,CAAC;IAC9EC,kBAAkB,EAAE;MAClBL,KAAK,EAALA,KAAK;MACL,YAAY,EAAEC,SAAS;MACvB,iBAAiB,EAAEC,cAAc;MACjC,kBAAkB,EAAEC;IACtB;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CSSProperties, DetailedHTMLProps, Ref, StyleHTMLAttributes } from 'react';
|
|
2
|
+
export declare function callAllEventHandlers(...fns: Array<Function | undefined>): (...args: any[]) => boolean;
|
|
3
|
+
export declare function assignHandlers(props: any, source: any): any;
|
|
4
|
+
export interface AssignableProps {
|
|
5
|
+
ref?: Ref<any>;
|
|
6
|
+
style?: CSSProperties;
|
|
7
|
+
className?: string;
|
|
8
|
+
styles?: DetailedHTMLProps<StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement>;
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}
|
|
11
|
+
export default function assignProps<P extends AssignableProps, S extends AssignableProps>(props?: P, source?: S): any;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.assignHandlers = assignHandlers;
|
|
8
|
+
exports.callAllEventHandlers = callAllEventHandlers;
|
|
9
|
+
exports["default"] = assignProps;
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
|
+
var _ref = require("./ref");
|
|
13
|
+
var _index = require("../styled/index");
|
|
14
|
+
function callAllEventHandlers() {
|
|
15
|
+
for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
16
|
+
fns[_key] = arguments[_key];
|
|
17
|
+
}
|
|
18
|
+
return function () {
|
|
19
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
20
|
+
args[_key2] = arguments[_key2];
|
|
21
|
+
}
|
|
22
|
+
return !fns.some(function (fn) {
|
|
23
|
+
var result;
|
|
24
|
+
if (fn) {
|
|
25
|
+
result = fn.apply(void 0, args);
|
|
26
|
+
}
|
|
27
|
+
return typeof result === 'boolean' && !result;
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function assignHandlers(props, source) {
|
|
32
|
+
return Object.keys(source).reduce(function (proxySource, propName) {
|
|
33
|
+
if (typeof source[propName] === 'function' && propName.startsWith('on')) {
|
|
34
|
+
proxySource[propName] = callAllEventHandlers(props[propName], source[propName]);
|
|
35
|
+
}
|
|
36
|
+
return proxySource;
|
|
37
|
+
}, {});
|
|
38
|
+
}
|
|
39
|
+
function assignHandlersInner(props, source) {
|
|
40
|
+
return Object.keys(source).reduce(function (proxySource, propName) {
|
|
41
|
+
if (propName !== 'ref' && propName.startsWith('on')) {
|
|
42
|
+
if (typeof source[propName] === 'function' && typeof props[propName] === 'function') {
|
|
43
|
+
proxySource[propName] = callAllEventHandlers(props[propName], source[propName]);
|
|
44
|
+
} else if (typeof source[propName] === 'function') {
|
|
45
|
+
proxySource[propName] = source[propName];
|
|
46
|
+
} else if (typeof props[propName] === 'function') {
|
|
47
|
+
proxySource[propName] = props[propName];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return proxySource;
|
|
51
|
+
}, {});
|
|
52
|
+
}
|
|
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] : {};
|
|
56
|
+
// @ts-ignore
|
|
57
|
+
if (props === source) return props;
|
|
58
|
+
var newProps = (0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, source), props), assignHandlersInner(props, source));
|
|
59
|
+
for (var _key3 in source) {
|
|
60
|
+
if (_key3.startsWith('use:')) {
|
|
61
|
+
var originalKey = _key3.slice('use:'.length);
|
|
62
|
+
newProps[originalKey] = source[_key3];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
for (var _key4 in props) {
|
|
66
|
+
if (_key4.startsWith('use:')) {
|
|
67
|
+
var _originalKey = _key4.slice('use:'.length);
|
|
68
|
+
newProps[_originalKey] = props[_key4];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// because react set getter for ref
|
|
73
|
+
var sourceDescriptorRef = Object.getOwnPropertyDescriptor(source, 'ref');
|
|
74
|
+
var propsDescriptorRef = Object.getOwnPropertyDescriptor(props, 'ref');
|
|
75
|
+
if (sourceDescriptorRef !== null && sourceDescriptorRef !== void 0 && sourceDescriptorRef.configurable && propsDescriptorRef !== null && propsDescriptorRef !== void 0 && propsDescriptorRef.configurable) {
|
|
76
|
+
newProps.ref = (0, _ref.forkRef)(source.ref, props.ref);
|
|
77
|
+
}
|
|
78
|
+
if (props.forwardRef) {
|
|
79
|
+
newProps.ref = (0, _ref.forkRef)(newProps.ref, props.forwardRef);
|
|
80
|
+
newProps.forwardRef = newProps.ref;
|
|
81
|
+
}
|
|
82
|
+
if (source.style && props.style) {
|
|
83
|
+
newProps.style = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, source.style), props.style);
|
|
84
|
+
}
|
|
85
|
+
if (source.className) {
|
|
86
|
+
newProps.className = (0, _classnames["default"])(props.className, source.className);
|
|
87
|
+
}
|
|
88
|
+
if (source.styles && props.styles) {
|
|
89
|
+
newProps.styles = _index.sstyled.merge(source.styles, props.styles);
|
|
90
|
+
}
|
|
91
|
+
return newProps;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=assignProps.js.map
|