@semcore/core 2.39.4 → 16.0.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 +11 -0
- package/README.md +2 -2
- package/lib/LastInteractionType.d.ts +11 -0
- package/lib/LastInteractionType.js +57 -0
- package/lib/LastInteractionType.js.map +1 -0
- package/lib/LastInteractionType.mjs +51 -0
- package/lib/LastInteractionType.mjs.map +1 -0
- package/lib/core-types/Component.d.ts +189 -0
- package/lib/core-types/Component.js +59 -0
- package/lib/core-types/Component.js.map +1 -0
- package/lib/core-types/Component.mjs +51 -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 +25 -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 +27 -0
- package/lib/coreFactory.js +352 -0
- package/lib/coreFactory.js.map +1 -0
- package/lib/coreFactory.mjs +324 -0
- package/lib/coreFactory.mjs.map +1 -0
- package/lib/enhancement/Children.d.ts +5 -0
- package/lib/enhancement/Children.js +119 -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 +78 -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/bindHandler.d.ts +5 -0
- package/lib/enhancement/bindHandler.js +54 -0
- package/lib/enhancement/bindHandler.js.map +1 -0
- package/lib/enhancement/bindHandler.mjs +48 -0
- package/lib/enhancement/bindHandler.mjs.map +1 -0
- package/lib/enhancement/dataName.d.ts +4 -0
- package/lib/enhancement/dataName.js +20 -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 +22 -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 +36 -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/hoistProps.d.ts +10 -0
- package/lib/enhancement/hoistProps.js +97 -0
- package/lib/enhancement/hoistProps.js.map +1 -0
- package/lib/enhancement/hoistProps.mjs +78 -0
- package/lib/enhancement/hoistProps.mjs.map +1 -0
- package/lib/enhancement/i18n.d.ts +4 -0
- package/lib/enhancement/i18n.js +28 -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 +23 -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 +135 -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 +60 -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 +51 -0
- package/lib/esm/core-types/Component.mjs +51 -0
- package/lib/esm/core-types/symbols.mjs +20 -0
- package/lib/esm/coreFactory.mjs +324 -0
- package/lib/esm/enhancement/Children.mjs +96 -0
- package/lib/esm/enhancement/Root.mjs +56 -0
- package/lib/esm/enhancement/bindHandler.mjs +48 -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/hoistProps.mjs +78 -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 +31 -0
- package/lib/esm/styled/index.mjs +8 -0
- package/lib/esm/styled/reshadow-core.mjs +234 -0
- package/lib/esm/styled/sstyled.mjs +121 -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/createHoc.mjs +44 -0
- package/lib/esm/utils/enhances/WithI18n.mjs +78 -0
- package/lib/esm/utils/enhances/i18nEnhance.mjs +91 -0
- package/lib/esm/utils/getDisplayName.mjs +6 -0
- package/lib/esm/utils/logger.mjs +35 -0
- package/lib/esm/utils/pick.mjs +15 -0
- package/lib/esm/utils/ref.mjs +87 -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 +37 -0
- package/lib/register.js.map +1 -0
- package/lib/register.mjs +31 -0
- package/lib/register.mjs.map +1 -0
- package/lib/styled/index.d.ts +11 -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 +256 -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 +149 -0
- package/lib/styled/sstyled.js.map +1 -0
- package/lib/styled/sstyled.mjs +121 -0
- package/lib/styled/sstyled.mjs.map +1 -0
- package/lib/theme/dark.json +2506 -0
- package/lib/theme/exclude-tokens.json +10 -0
- package/lib/theme/light.json +2584 -0
- package/lib/theme/processor.d.ts +1 -0
- package/lib/theme/processor.js +315 -0
- package/lib/theme/processor.js.map +1 -0
- package/lib/theme/processor.mjs +307 -0
- package/lib/theme/processor.mjs.map +1 -0
- package/lib/theme/themes/auto.css +1465 -0
- package/lib/theme/themes/dark.css +723 -0
- package/lib/theme/themes/dark.d.ts +378 -0
- package/lib/theme/themes/dark.js +385 -0
- package/lib/theme/themes/dark.js.map +1 -0
- package/lib/theme/themes/dark.mjs +378 -0
- package/lib/theme/themes/dark.mjs.map +1 -0
- package/lib/theme/themes/default.css +742 -0
- package/lib/theme/themes/default.d.ts +387 -0
- package/lib/theme/themes/default.js +394 -0
- package/lib/theme/themes/default.js.map +1 -0
- package/lib/theme/themes/default.mjs +387 -0
- package/lib/theme/themes/default.mjs.map +1 -0
- package/lib/theme/themes/light.css +742 -0
- package/lib/theme/themes/light.d.ts +387 -0
- package/lib/theme/themes/light.js +394 -0
- package/lib/theme/themes/light.js.map +1 -0
- package/lib/theme/themes/light.mjs +387 -0
- package/lib/theme/themes/light.mjs.map +1 -0
- package/lib/theme/utils.d.ts +52 -0
- package/lib/theme/utils.js +297 -0
- package/lib/theme/utils.js.map +1 -0
- package/lib/theme/utils.mjs +286 -0
- package/lib/theme/utils.mjs.map +1 -0
- package/lib/utils/CSSinJS.d.ts +5 -0
- package/lib/utils/CSSinJS.js +36 -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/ScreenReaderOnly.d.ts +8 -0
- package/lib/utils/ScreenReaderOnly.js +31 -0
- package/lib/utils/ScreenReaderOnly.js.map +1 -0
- package/lib/utils/ScreenReaderOnly.mjs +24 -0
- package/lib/utils/ScreenReaderOnly.mjs.map +1 -0
- package/lib/utils/ThemeProvider.d.ts +15 -0
- package/lib/utils/ThemeProvider.js +82 -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 +45 -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 +196 -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/createHoc.d.ts +3 -0
- package/lib/utils/createHoc.js +55 -0
- package/lib/utils/createHoc.js.map +1 -0
- package/lib/utils/createHoc.mjs +44 -0
- package/lib/utils/createHoc.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/WithAutoFocus.d.ts +14 -0
- package/lib/utils/enhances/WithAutoFocus.js +75 -0
- package/lib/utils/enhances/WithAutoFocus.js.map +1 -0
- package/lib/utils/enhances/WithAutoFocus.mjs +67 -0
- package/lib/utils/enhances/WithAutoFocus.mjs.map +1 -0
- package/lib/utils/enhances/WithCSS.d.ts +41 -0
- package/lib/utils/enhances/WithCSS.js +93 -0
- package/lib/utils/enhances/WithCSS.js.map +1 -0
- package/lib/utils/enhances/WithCSS.mjs +79 -0
- package/lib/utils/enhances/WithCSS.mjs.map +1 -0
- package/lib/utils/enhances/WithI18n.d.ts +43 -0
- package/lib/utils/enhances/WithI18n.js +95 -0
- package/lib/utils/enhances/WithI18n.js.map +1 -0
- package/lib/utils/enhances/WithI18n.mjs +78 -0
- package/lib/utils/enhances/WithI18n.mjs.map +1 -0
- package/lib/utils/enhances/WithKeyboardFocus.d.ts +45 -0
- package/lib/utils/enhances/WithKeyboardFocus.js +93 -0
- package/lib/utils/enhances/WithKeyboardFocus.js.map +1 -0
- package/lib/utils/enhances/WithKeyboardFocus.mjs +84 -0
- package/lib/utils/enhances/WithKeyboardFocus.mjs.map +1 -0
- package/lib/utils/enhances/WithRef.d.ts +3 -0
- package/lib/utils/enhances/WithRef.js +26 -0
- package/lib/utils/enhances/WithRef.js.map +1 -0
- package/lib/utils/enhances/WithRef.mjs +18 -0
- package/lib/utils/enhances/WithRef.mjs.map +1 -0
- package/lib/utils/enhances/a11yEnhance.d.ts +10 -0
- package/lib/utils/enhances/a11yEnhance.js +74 -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 +12 -0
- package/lib/utils/enhances/animatedSizeEnhance.js +98 -0
- package/lib/utils/enhances/animatedSizeEnhance.js.map +1 -0
- package/lib/utils/enhances/animatedSizeEnhance.mjs +90 -0
- package/lib/utils/enhances/animatedSizeEnhance.mjs.map +1 -0
- package/lib/utils/enhances/autoFocusEnhance.d.ts +10 -0
- package/lib/utils/enhances/autoFocusEnhance.js +46 -0
- package/lib/utils/enhances/autoFocusEnhance.js.map +1 -0
- package/lib/utils/enhances/autoFocusEnhance.mjs +38 -0
- package/lib/utils/enhances/autoFocusEnhance.mjs.map +1 -0
- package/lib/utils/enhances/contextEnhance.d.ts +3 -0
- package/lib/utils/enhances/contextEnhance.js +22 -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 +25 -0
- package/lib/utils/enhances/i18nEnhance.js +101 -0
- package/lib/utils/enhances/i18nEnhance.js.map +1 -0
- package/lib/utils/enhances/i18nEnhance.mjs +91 -0
- package/lib/utils/enhances/i18nEnhance.mjs.map +1 -0
- package/lib/utils/enhances/keyboardFocusEnhance.d.ts +27 -0
- package/lib/utils/enhances/keyboardFocusEnhance.js +63 -0
- package/lib/utils/enhances/keyboardFocusEnhance.js.map +1 -0
- package/lib/utils/enhances/keyboardFocusEnhance.mjs +57 -0
- package/lib/utils/enhances/keyboardFocusEnhance.mjs.map +1 -0
- package/lib/utils/enhances/resolveColorEnhance.d.ts +2 -0
- package/lib/utils/enhances/resolveColorEnhance.js +25 -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 +9 -0
- package/lib/utils/eventEmitter.js +41 -0
- package/lib/utils/eventEmitter.js.map +1 -0
- package/lib/utils/eventEmitter.mjs +34 -0
- package/lib/utils/eventEmitter.mjs.map +1 -0
- package/lib/utils/findComponent.d.ts +12 -0
- package/lib/utils/findComponent.js +106 -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 +72 -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 +26 -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 +16 -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 +51 -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 +63 -0
- package/lib/utils/focus-lock/setFocus.js.map +1 -0
- package/lib/utils/focus-lock/setFocus.mjs +55 -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 +6 -0
- package/lib/utils/getDisplayName.mjs.map +1 -0
- package/lib/utils/getEventTarget.d.ts +1 -0
- package/lib/utils/getEventTarget.js +53 -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 +18 -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 +16 -0
- package/lib/utils/getValue.js.map +1 -0
- package/lib/utils/getValue.mjs +10 -0
- package/lib/utils/getValue.mjs.map +1 -0
- package/lib/utils/hasLabels.d.ts +7 -0
- package/lib/utils/hasLabels.js +47 -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 +14 -0
- package/lib/utils/hasParent.js.map +1 -0
- package/lib/utils/hasParent.mjs +7 -0
- package/lib/utils/hasParent.mjs.map +1 -0
- package/lib/utils/if.d.ts +11 -0
- package/lib/utils/if.js +16 -0
- package/lib/utils/if.js.map +1 -0
- package/lib/utils/if.mjs +9 -0
- package/lib/utils/if.mjs.map +1 -0
- package/lib/utils/ifChildren.d.ts +8 -0
- package/lib/utils/ifChildren.js +17 -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/injectStyle.d.ts +2 -0
- package/lib/utils/injectStyle.js +49 -0
- package/lib/utils/injectStyle.js.map +1 -0
- package/lib/utils/injectStyle.mjs +41 -0
- package/lib/utils/injectStyle.mjs.map +1 -0
- package/lib/utils/inputProps.d.ts +2 -0
- package/lib/utils/inputProps.js +22 -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 +40 -0
- package/lib/utils/logger.js.map +1 -0
- package/lib/utils/logger.mjs +35 -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 +59 -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 +33 -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 +33 -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 +10 -0
- package/lib/utils/ref.js +96 -0
- package/lib/utils/ref.js.map +1 -0
- package/lib/utils/ref.mjs +87 -0
- package/lib/utils/ref.mjs.map +1 -0
- package/lib/utils/setRef.d.ts +2 -0
- package/lib/utils/setRef.js +10 -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 +12 -0
- package/lib/utils/uniqueID.js +42 -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 +208 -0
- package/lib/utils/use/useColorResolver.js.map +1 -0
- package/lib/utils/use/useColorResolver.mjs +200 -0
- package/lib/utils/use/useColorResolver.mjs.map +1 -0
- package/lib/utils/use/useCss.d.ts +4 -0
- package/lib/utils/use/useCss.js +20 -0
- package/lib/utils/use/useCss.js.map +1 -0
- package/lib/utils/use/useCss.mjs +12 -0
- package/lib/utils/use/useCss.mjs.map +1 -0
- package/lib/utils/use/useEnhancedEffect.d.ts +3 -0
- package/lib/utils/use/useEnhancedEffect.js +13 -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 +33 -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 +289 -0
- package/lib/utils/use/useFocusLock.js.map +1 -0
- package/lib/utils/use/useFocusLock.mjs +266 -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 +78 -0
- package/lib/utils/use/usePreventScroll.js.map +1 -0
- package/lib/utils/use/usePreventScroll.mjs +70 -0
- package/lib/utils/use/usePreventScroll.mjs.map +1 -0
- package/lib/utils/useCssVariable.d.ts +8 -0
- package/lib/utils/useCssVariable.js +55 -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 +8 -0
- package/lib/utils/zIndexStacking.js +48 -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 +297 -10
- package/tsconfig-utils.json +4 -0
- package/vite.config.ts +24 -0
- 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,121 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _cn from "classnames";
|
|
4
|
+
import { getStyles as getStyles$1 } from "./reshadow-core.mjs";
|
|
5
|
+
var RESHADOW_ID = "__reshadow__";
|
|
6
|
+
var isSSR = !(typeof window !== "undefined" && window.document && window.document.createElement);
|
|
7
|
+
var serverMap = getStyles$1().map;
|
|
8
|
+
var getStyles = function getStyles2() {
|
|
9
|
+
return {
|
|
10
|
+
map: serverMap,
|
|
11
|
+
get css() {
|
|
12
|
+
var serverStyles = "";
|
|
13
|
+
for (var id in serverMap) {
|
|
14
|
+
serverStyles += "<style type='text/css' id='".concat(id, "'>").concat(serverMap[id], "</style>");
|
|
15
|
+
}
|
|
16
|
+
return serverStyles;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
function insert(code, hash) {
|
|
21
|
+
var id = "reshadow-".concat(hash);
|
|
22
|
+
if (isSSR) {
|
|
23
|
+
serverMap[id] = code;
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
var container = document.getElementById(RESHADOW_ID);
|
|
27
|
+
if (!container) {
|
|
28
|
+
container = document.createElement("object");
|
|
29
|
+
container.id = RESHADOW_ID;
|
|
30
|
+
if (document.head) {
|
|
31
|
+
document.head.appendChild(container);
|
|
32
|
+
} else {
|
|
33
|
+
document.addEventListener("DOMContentLoaded", function() {
|
|
34
|
+
document.head.appendChild(container);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
var css = document.getElementById(id);
|
|
39
|
+
if (!css) {
|
|
40
|
+
css = document.createElement("style");
|
|
41
|
+
css.id = id;
|
|
42
|
+
css.type = "text/css";
|
|
43
|
+
container.appendChild(css);
|
|
44
|
+
}
|
|
45
|
+
css.innerHTML = code;
|
|
46
|
+
}
|
|
47
|
+
function merge() {
|
|
48
|
+
var s1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
49
|
+
var s2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
50
|
+
return Object.entries(s2).reduce(function(acc, _ref) {
|
|
51
|
+
var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], value = _ref2[1];
|
|
52
|
+
if (key.startsWith("@") || key.startsWith("--")) {
|
|
53
|
+
acc[key] = value;
|
|
54
|
+
} else {
|
|
55
|
+
acc[key] = _cn(acc[key], value);
|
|
56
|
+
}
|
|
57
|
+
return acc;
|
|
58
|
+
}, Object.assign({}, s1));
|
|
59
|
+
}
|
|
60
|
+
function getClassAndVars(styles, name, props) {
|
|
61
|
+
function getPropValue(key, props2) {
|
|
62
|
+
var _props;
|
|
63
|
+
return (_props = props2["use:".concat(key)]) !== null && _props !== void 0 ? _props : props2[key];
|
|
64
|
+
}
|
|
65
|
+
return Object.entries(styles).reduce(function(acc, _ref3) {
|
|
66
|
+
var _ref4 = _slicedToArray(_ref3, 2), key = _ref4[0], value = _ref4[1];
|
|
67
|
+
if (key.startsWith("--")) {
|
|
68
|
+
acc[1][value] = getPropValue(key.substring(2), props);
|
|
69
|
+
} else if (name === key) {
|
|
70
|
+
acc[0][value] = true;
|
|
71
|
+
} else {
|
|
72
|
+
var _key$split = key.split("="), _key$split2 = _slicedToArray(_key$split, 2), mod = _key$split2[0], modValue = _key$split2[1];
|
|
73
|
+
var propValue = getPropValue(mod, props);
|
|
74
|
+
if (modValue === void 0) {
|
|
75
|
+
acc[0][value] = Boolean(propValue !== null && propValue !== void 0 ? propValue : false);
|
|
76
|
+
} else {
|
|
77
|
+
acc[0][value] = propValue == modValue;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return acc;
|
|
81
|
+
}, [{}, {}]);
|
|
82
|
+
}
|
|
83
|
+
function reshadowToShadow(obj) {
|
|
84
|
+
return Object.entries(obj).reduce(function(style, _ref5) {
|
|
85
|
+
var _ref6 = _slicedToArray(_ref5, 2), name = _ref6[0], value = _ref6[1];
|
|
86
|
+
var n = name;
|
|
87
|
+
if (name.startsWith("__")) {
|
|
88
|
+
n = name.replace(/^__/, "");
|
|
89
|
+
} else if (name.startsWith("_")) {
|
|
90
|
+
n = name.replace(/^_/, "").replace("_", "=");
|
|
91
|
+
}
|
|
92
|
+
style[n] = value;
|
|
93
|
+
return style;
|
|
94
|
+
}, {});
|
|
95
|
+
}
|
|
96
|
+
function sstyled() {
|
|
97
|
+
var styles = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
98
|
+
return {
|
|
99
|
+
cn: function cn(name, props) {
|
|
100
|
+
var _getClassAndVars = getClassAndVars(reshadowToShadow(styles), name, props), _getClassAndVars2 = _slicedToArray(_getClassAndVars, 2), classes = _getClassAndVars2[0], style = _getClassAndVars2[1];
|
|
101
|
+
var extraProps = {};
|
|
102
|
+
if (Object.keys(classes).length) {
|
|
103
|
+
extraProps.className = _cn(props.className, classes);
|
|
104
|
+
}
|
|
105
|
+
if (Object.keys(style).length) {
|
|
106
|
+
extraProps.style = Object.assign(style, props.style);
|
|
107
|
+
}
|
|
108
|
+
return _objectSpread(_objectSpread({}, props), extraProps);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
sstyled.css = function(css) {
|
|
113
|
+
throw new Error("Enable babel plugin");
|
|
114
|
+
};
|
|
115
|
+
sstyled.insert = insert;
|
|
116
|
+
sstyled.merge = merge;
|
|
117
|
+
sstyled.getStyles = getStyles;
|
|
118
|
+
sstyled.SHADOW_STYLES = Symbol("SHADOW_STYLES");
|
|
119
|
+
export {
|
|
120
|
+
sstyled
|
|
121
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _cn from "classnames";
|
|
3
|
+
import "../styled/index.mjs";
|
|
4
|
+
import { forkRef } from "./ref.mjs";
|
|
5
|
+
import { sstyled } from "../styled/sstyled.mjs";
|
|
6
|
+
function callAllEventHandlers() {
|
|
7
|
+
for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
8
|
+
fns[_key] = arguments[_key];
|
|
9
|
+
}
|
|
10
|
+
return function() {
|
|
11
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
12
|
+
args[_key2] = arguments[_key2];
|
|
13
|
+
}
|
|
14
|
+
return !fns.some(function(fn) {
|
|
15
|
+
var result;
|
|
16
|
+
if (fn) {
|
|
17
|
+
result = fn.apply(void 0, args);
|
|
18
|
+
}
|
|
19
|
+
return typeof result === "boolean" && !result;
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function assignHandlers(props, source) {
|
|
24
|
+
return Object.keys(source).reduce(function(proxySource, propName) {
|
|
25
|
+
if (typeof source[propName] === "function" && propName.startsWith("on")) {
|
|
26
|
+
proxySource[propName] = callAllEventHandlers(props[propName], source[propName]);
|
|
27
|
+
}
|
|
28
|
+
return proxySource;
|
|
29
|
+
}, {});
|
|
30
|
+
}
|
|
31
|
+
function assignHandlersInner(props, source) {
|
|
32
|
+
return Object.keys(source).reduce(function(proxySource, propName) {
|
|
33
|
+
if (propName !== "ref" && propName.startsWith("on")) {
|
|
34
|
+
if (typeof source[propName] === "function" && typeof props[propName] === "function") {
|
|
35
|
+
proxySource[propName] = callAllEventHandlers(props[propName], source[propName]);
|
|
36
|
+
} else if (typeof source[propName] === "function") {
|
|
37
|
+
proxySource[propName] = source[propName];
|
|
38
|
+
} else if (typeof props[propName] === "function") {
|
|
39
|
+
proxySource[propName] = props[propName];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return proxySource;
|
|
43
|
+
}, {});
|
|
44
|
+
}
|
|
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] : {};
|
|
48
|
+
if (props === source) return props;
|
|
49
|
+
var newProps = _objectSpread(_objectSpread(_objectSpread({}, source), props), assignHandlersInner(props, source));
|
|
50
|
+
for (var _key3 in source) {
|
|
51
|
+
if (_key3.startsWith("use:")) {
|
|
52
|
+
var originalKey = _key3.slice("use:".length);
|
|
53
|
+
newProps[originalKey] = source[_key3];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
for (var _key4 in props) {
|
|
57
|
+
if (_key4.startsWith("use:")) {
|
|
58
|
+
var _originalKey = _key4.slice("use:".length);
|
|
59
|
+
newProps[_originalKey] = props[_key4];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
var sourceDescriptorRef = Object.getOwnPropertyDescriptor(source, "ref");
|
|
63
|
+
var propsDescriptorRef = Object.getOwnPropertyDescriptor(props, "ref");
|
|
64
|
+
if (sourceDescriptorRef !== null && sourceDescriptorRef !== void 0 && sourceDescriptorRef.configurable && propsDescriptorRef !== null && propsDescriptorRef !== void 0 && propsDescriptorRef.configurable) {
|
|
65
|
+
newProps.ref = forkRef(source.ref, props.ref);
|
|
66
|
+
}
|
|
67
|
+
if (props.forwardRef) {
|
|
68
|
+
newProps.ref = forkRef(newProps.ref, props.forwardRef);
|
|
69
|
+
newProps.forwardRef = newProps.ref;
|
|
70
|
+
}
|
|
71
|
+
if (source.style && props.style) {
|
|
72
|
+
newProps.style = _objectSpread(_objectSpread({}, source.style), props.style);
|
|
73
|
+
}
|
|
74
|
+
if (source.className) {
|
|
75
|
+
newProps.className = _cn(props.className, source.className);
|
|
76
|
+
}
|
|
77
|
+
if (source.styles && props.styles) {
|
|
78
|
+
newProps.styles = sstyled.merge(source.styles, props.styles);
|
|
79
|
+
}
|
|
80
|
+
return newProps;
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
assignHandlers,
|
|
84
|
+
callAllEventHandlers,
|
|
85
|
+
assignProps as default
|
|
86
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
5
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
6
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
7
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
8
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
|
+
import React, { PureComponent } from "react";
|
|
10
|
+
import hoistNonReactStatics from "hoist-non-react-statics";
|
|
11
|
+
import getDisplayName from "./getDisplayName.mjs";
|
|
12
|
+
var _excluded = ["forwardedRef"];
|
|
13
|
+
function createHoc(EnhancedComponent) {
|
|
14
|
+
return function createWrapper() {
|
|
15
|
+
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
16
|
+
return function(WrappedComponent) {
|
|
17
|
+
var Component = /* @__PURE__ */ function(_PureComponent) {
|
|
18
|
+
_inherits(Component2, _PureComponent);
|
|
19
|
+
var _super = _createSuper(Component2);
|
|
20
|
+
function Component2() {
|
|
21
|
+
_classCallCheck(this, Component2);
|
|
22
|
+
return _super.apply(this, arguments);
|
|
23
|
+
}
|
|
24
|
+
_createClass(Component2, [{
|
|
25
|
+
key: "render",
|
|
26
|
+
value: function render() {
|
|
27
|
+
var _WrappedComponent$def = _objectSpread(_objectSpread({}, WrappedComponent.defaultProps), this.props), forwardedRef = _WrappedComponent$def.forwardedRef, others = _objectWithoutProperties(_WrappedComponent$def, _excluded);
|
|
28
|
+
return /* @__PURE__ */ React.createElement(EnhancedComponent, _extends({}, options, this.props), function(enhancedComponentProps) {
|
|
29
|
+
return /* @__PURE__ */ React.createElement(WrappedComponent, _extends({
|
|
30
|
+
forwardedRef
|
|
31
|
+
}, others, enhancedComponentProps));
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}]);
|
|
35
|
+
return Component2;
|
|
36
|
+
}(PureComponent);
|
|
37
|
+
_defineProperty(Component, "displayName", getDisplayName(WrappedComponent));
|
|
38
|
+
return hoistNonReactStatics(Component, WrappedComponent);
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
createHoc as default
|
|
44
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
7
|
+
import React, { createContext, Component } from "react";
|
|
8
|
+
import createHoc from "../createHoc.mjs";
|
|
9
|
+
import { useAsyncI18nMessages } from "./i18nEnhance.mjs";
|
|
10
|
+
import { createIntlCache, createIntl } from "@formatjs/intl";
|
|
11
|
+
var Context = /* @__PURE__ */ createContext(void 0);
|
|
12
|
+
var I18nProvider = Context.Provider, I18nConsumer = Context.Consumer;
|
|
13
|
+
var messagesCache = createIntlCache();
|
|
14
|
+
function getText(dictionaries, locale) {
|
|
15
|
+
return function(key) {
|
|
16
|
+
var dictionary = dictionaries[locale];
|
|
17
|
+
return dictionary ? dictionary[key] : dictionaries["en"][key];
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
var WithI18n = /* @__PURE__ */ function(_Component) {
|
|
21
|
+
_inherits(WithI18n2, _Component);
|
|
22
|
+
var _super = _createSuper(WithI18n2);
|
|
23
|
+
function WithI18n2() {
|
|
24
|
+
var _this;
|
|
25
|
+
_classCallCheck(this, WithI18n2);
|
|
26
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
27
|
+
args[_key] = arguments[_key];
|
|
28
|
+
}
|
|
29
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
30
|
+
_defineProperty(_assertThisInitialized(_this), "context", void 0);
|
|
31
|
+
_defineProperty(_assertThisInitialized(_this), "getText", function(dictionary, selfLocale) {
|
|
32
|
+
var _this$props = _this.props, locale = _this$props.locale, getText2 = _this$props.getText;
|
|
33
|
+
var contextLocale = _this.context;
|
|
34
|
+
return getText2(dictionary, selfLocale || locale || contextLocale);
|
|
35
|
+
});
|
|
36
|
+
return _this;
|
|
37
|
+
}
|
|
38
|
+
_createClass(WithI18n2, [{
|
|
39
|
+
key: "render",
|
|
40
|
+
value: function render() {
|
|
41
|
+
var _ref = this.props, children = _ref.children;
|
|
42
|
+
return children({
|
|
43
|
+
getText: this.getText
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}]);
|
|
47
|
+
return WithI18n2;
|
|
48
|
+
}(Component);
|
|
49
|
+
_defineProperty(WithI18n, "contextType", Context);
|
|
50
|
+
_defineProperty(WithI18n, "defaultProps", {
|
|
51
|
+
getText
|
|
52
|
+
});
|
|
53
|
+
var useI18n = function useI18n2(dictionary) {
|
|
54
|
+
var _React$useContext;
|
|
55
|
+
var locale = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "en";
|
|
56
|
+
var fallbackDictionary = arguments.length > 2 ? arguments[2] : void 0;
|
|
57
|
+
var lang = (_React$useContext = React.useContext(Context)) !== null && _React$useContext !== void 0 ? _React$useContext : locale;
|
|
58
|
+
var resolvedDictionary = useAsyncI18nMessages(dictionary, lang, fallbackDictionary);
|
|
59
|
+
var intl = React.useMemo(function() {
|
|
60
|
+
return createIntl({
|
|
61
|
+
locale: lang,
|
|
62
|
+
messages: resolvedDictionary
|
|
63
|
+
}, messagesCache);
|
|
64
|
+
}, [resolvedDictionary, lang]);
|
|
65
|
+
return React.useCallback(function(messageId, variables) {
|
|
66
|
+
return intl.formatMessage({
|
|
67
|
+
id: messageId !== null && messageId !== void 0 ? messageId : ""
|
|
68
|
+
}, variables);
|
|
69
|
+
}, [intl]);
|
|
70
|
+
};
|
|
71
|
+
const WithI18n$1 = createHoc(WithI18n);
|
|
72
|
+
export {
|
|
73
|
+
Context,
|
|
74
|
+
I18nConsumer,
|
|
75
|
+
I18nProvider,
|
|
76
|
+
WithI18n$1 as default,
|
|
77
|
+
useI18n
|
|
78
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
4
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
5
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
6
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
7
|
+
import React from "react";
|
|
8
|
+
import { useI18n } from "./WithI18n.mjs";
|
|
9
|
+
var useAsyncI18nMessages = function useAsyncI18nMessages2(primaryContainer, locale, fallbackContainer) {
|
|
10
|
+
var _store$locale;
|
|
11
|
+
var container = React.useMemo(function() {
|
|
12
|
+
if (!fallbackContainer) return primaryContainer;
|
|
13
|
+
if (!primaryContainer) return fallbackContainer;
|
|
14
|
+
if (primaryContainer === fallbackContainer) return primaryContainer;
|
|
15
|
+
var container2 = {};
|
|
16
|
+
var _loop = function _loop2(_locale2) {
|
|
17
|
+
if (typeof primaryContainer[_locale2] === "function" || typeof fallbackContainer[_locale2] === "function") {
|
|
18
|
+
container2[_locale2] = /* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee() {
|
|
19
|
+
var _yield$Promise$all, _yield$Promise$all2, primary, fallback;
|
|
20
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
21
|
+
while (1) switch (_context.prev = _context.next) {
|
|
22
|
+
case 0:
|
|
23
|
+
_context.next = 2;
|
|
24
|
+
return Promise.all([primaryContainer[_locale2], fallbackContainer[_locale2]]);
|
|
25
|
+
case 2:
|
|
26
|
+
_yield$Promise$all = _context.sent;
|
|
27
|
+
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
28
|
+
primary = _yield$Promise$all2[0];
|
|
29
|
+
fallback = _yield$Promise$all2[1];
|
|
30
|
+
return _context.abrupt("return", _objectSpread(_objectSpread({}, primary), fallback));
|
|
31
|
+
case 7:
|
|
32
|
+
case "end":
|
|
33
|
+
return _context.stop();
|
|
34
|
+
}
|
|
35
|
+
}, _callee);
|
|
36
|
+
}));
|
|
37
|
+
} else {
|
|
38
|
+
var _primaryContainer$_lo, _fallbackContainer$_l;
|
|
39
|
+
container2[_locale2] = _objectSpread(_objectSpread({}, (_primaryContainer$_lo = primaryContainer[_locale2]) !== null && _primaryContainer$_lo !== void 0 ? _primaryContainer$_lo : {}), (_fallbackContainer$_l = fallbackContainer[_locale2]) !== null && _fallbackContainer$_l !== void 0 ? _fallbackContainer$_l : {});
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
for (var _locale in primaryContainer) {
|
|
43
|
+
_loop(_locale);
|
|
44
|
+
}
|
|
45
|
+
return container2;
|
|
46
|
+
}, [primaryContainer, fallbackContainer]);
|
|
47
|
+
var initStore = React.useMemo(function() {
|
|
48
|
+
var store2 = {};
|
|
49
|
+
for (var _locale2 in container) {
|
|
50
|
+
if (_typeof(container[_locale2]) === "object") {
|
|
51
|
+
store2[_locale2] = container[_locale2];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return store2;
|
|
55
|
+
}, [container]);
|
|
56
|
+
var _React$useState = React.useState(initStore), _React$useState2 = _slicedToArray(_React$useState, 2), store = _React$useState2[0], setStore = _React$useState2[1];
|
|
57
|
+
var lastLoadedLocaleRef = React.useRef(null);
|
|
58
|
+
if (store[locale]) lastLoadedLocaleRef.current = locale;
|
|
59
|
+
var fallbackMessages = React.useMemo(function() {
|
|
60
|
+
return Object.values(store)[0];
|
|
61
|
+
}, [store]);
|
|
62
|
+
var loadingLocaleRef = React.useRef(null);
|
|
63
|
+
React.useEffect(function() {
|
|
64
|
+
loadingLocaleRef.current = locale;
|
|
65
|
+
var asyncMessages = container[locale];
|
|
66
|
+
if (typeof asyncMessages === "function") {
|
|
67
|
+
asyncMessages().then(function(module) {
|
|
68
|
+
if (loadingLocaleRef.current !== locale) return;
|
|
69
|
+
var messages = module;
|
|
70
|
+
if ("default" in module && _typeof(module["default"]) === "object") messages = module["default"];
|
|
71
|
+
setStore(function(store2) {
|
|
72
|
+
return _objectSpread(_objectSpread({}, store2), {}, _defineProperty({}, locale, messages));
|
|
73
|
+
});
|
|
74
|
+
})["catch"](console.error);
|
|
75
|
+
}
|
|
76
|
+
}, [container, locale]);
|
|
77
|
+
return (_store$locale = store[locale]) !== null && _store$locale !== void 0 ? _store$locale : fallbackMessages;
|
|
78
|
+
};
|
|
79
|
+
const i18nEnhance = function(container) {
|
|
80
|
+
return function(props) {
|
|
81
|
+
var i18n = props.i18n, locale = props.locale;
|
|
82
|
+
var getI18nText = useI18n(i18n, locale, container);
|
|
83
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
|
84
|
+
getI18nText
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
export {
|
|
89
|
+
i18nEnhance as default,
|
|
90
|
+
useAsyncI18nMessages
|
|
91
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
+
var DEV = process.env.NODE_ENV !== "production";
|
|
5
|
+
var Logger = /* @__PURE__ */ function() {
|
|
6
|
+
function Logger2(logger2) {
|
|
7
|
+
_classCallCheck(this, Logger2);
|
|
8
|
+
_defineProperty(this, "logger", void 0);
|
|
9
|
+
this.logger = logger2 || {
|
|
10
|
+
warn: function warn() {
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
_createClass(Logger2, [{
|
|
15
|
+
key: "console",
|
|
16
|
+
value: function console2(level, msg, component) {
|
|
17
|
+
this.logger[level](component ? "[".concat(component, "]: ").concat(msg) : msg);
|
|
18
|
+
}
|
|
19
|
+
}, {
|
|
20
|
+
key: "warn",
|
|
21
|
+
value: function warn(condition, msg, component) {
|
|
22
|
+
if (DEV) {
|
|
23
|
+
if (condition) {
|
|
24
|
+
this.console("warn", msg, component);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}]);
|
|
29
|
+
return Logger2;
|
|
30
|
+
}();
|
|
31
|
+
const logger = new Logger(console);
|
|
32
|
+
export {
|
|
33
|
+
Logger,
|
|
34
|
+
logger as default
|
|
35
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { findDOMNode } from "react-dom";
|
|
5
|
+
function setRef(ref, value) {
|
|
6
|
+
if (typeof ref === "function") {
|
|
7
|
+
ref(value);
|
|
8
|
+
} else if (ref !== null && ref !== void 0 && ref.hasOwnProperty("current")) {
|
|
9
|
+
ref["current"] = value;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function getRef(ref) {
|
|
13
|
+
if (!ref) return null;
|
|
14
|
+
return "current" in ref ? ref.current : ref;
|
|
15
|
+
}
|
|
16
|
+
function useCallbackRef(initialValue, callback) {
|
|
17
|
+
var _React$useState = React.useState(function() {
|
|
18
|
+
return {
|
|
19
|
+
// value
|
|
20
|
+
value: initialValue,
|
|
21
|
+
// last callback
|
|
22
|
+
callback,
|
|
23
|
+
// "memoized" public interface
|
|
24
|
+
facade: {
|
|
25
|
+
get current() {
|
|
26
|
+
return ref.value;
|
|
27
|
+
},
|
|
28
|
+
set current(value) {
|
|
29
|
+
var last = ref.value;
|
|
30
|
+
if (last !== value) {
|
|
31
|
+
ref.value = value;
|
|
32
|
+
ref.callback(value, last);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}), _React$useState2 = _slicedToArray(_React$useState, 1), ref = _React$useState2[0];
|
|
38
|
+
ref.callback = callback;
|
|
39
|
+
return ref.facade;
|
|
40
|
+
}
|
|
41
|
+
function useForkRef() {
|
|
42
|
+
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
43
|
+
refs[_key] = arguments[_key];
|
|
44
|
+
}
|
|
45
|
+
return React.useCallback(function(refValue) {
|
|
46
|
+
var uniqueRefs = _toConsumableArray(new Set(refs));
|
|
47
|
+
uniqueRefs.forEach(function(ref) {
|
|
48
|
+
return setRef(ref, refValue);
|
|
49
|
+
});
|
|
50
|
+
}, refs);
|
|
51
|
+
}
|
|
52
|
+
function forkRef() {
|
|
53
|
+
for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
54
|
+
refs[_key2] = arguments[_key2];
|
|
55
|
+
}
|
|
56
|
+
if (refs.every(function(ref) {
|
|
57
|
+
return ref == null;
|
|
58
|
+
})) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
return function(refValue) {
|
|
62
|
+
var uniqueRefs = _toConsumableArray(new Set(refs));
|
|
63
|
+
uniqueRefs.forEach(function(ref) {
|
|
64
|
+
return setRef(ref, refValue);
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function getNodeByRef(ref) {
|
|
69
|
+
if (typeof ref === "function") {
|
|
70
|
+
ref = ref();
|
|
71
|
+
}
|
|
72
|
+
if (!ref) return null;
|
|
73
|
+
var node = getRef(ref);
|
|
74
|
+
if (!node) return null;
|
|
75
|
+
if ("nodeType" in node && node.nodeType === 1) return node;
|
|
76
|
+
if (Object.keys(node).length === 1 && "getBoundingClientRect" in node) return null;
|
|
77
|
+
if (!/* @__PURE__ */ React.isValidElement(node) && !(node instanceof React.Component)) return null;
|
|
78
|
+
return findDOMNode(node);
|
|
79
|
+
}
|
|
80
|
+
export {
|
|
81
|
+
forkRef,
|
|
82
|
+
getNodeByRef,
|
|
83
|
+
getRef,
|
|
84
|
+
setRef,
|
|
85
|
+
useCallbackRef,
|
|
86
|
+
useForkRef
|
|
87
|
+
};
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** ============================== core ============================== */
|
|
2
|
+
import { createComponent, createBaseComponent, assignProps } from './coreFactory';
|
|
3
|
+
import { sstyled } from './styled';
|
|
4
|
+
import type { StyledProps } from './styled';
|
|
5
|
+
import { Root, Component, Intergalactic, wrapIntergalacticComponent } from './core-types/Component';
|
|
6
|
+
import type { PropGetterFn, IRootComponentProps, ComponentType, IRootComponentHandlers, IComponentProps, ReturnEl, IFunctionProps } from './core-types/Component';
|
|
7
|
+
import { CORE_INSTANCE, CREATE_COMPONENT, CONTEXT_COMPONENT, CHILDREN_COMPONENT, INHERITED_NAME } from './core-types/symbols';
|
|
8
|
+
import type { UnknownProperties } from './core-types/UnknownProperties';
|
|
9
|
+
import register from './register';
|
|
10
|
+
import { lastInteraction } from './LastInteractionType';
|
|
11
|
+
export { sstyled, createComponent, createBaseComponent, Root, Component, UnknownProperties, Intergalactic, PropGetterFn, IRootComponentProps, ComponentType, IRootComponentHandlers, IComponentProps, IFunctionProps, CORE_INSTANCE, CREATE_COMPONENT, CONTEXT_COMPONENT, CHILDREN_COMPONENT, INHERITED_NAME, ReturnEl, StyledProps, wrapIntergalacticComponent, assignProps, register, lastInteraction, };
|