@semcore/core 16.0.0-prerelease.9 → 16.0.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 +23 -1
- package/lib/{LastInteractionType.cjs → LastInteractionType.js} +1 -1
- package/lib/LastInteractionType.js.map +1 -0
- package/lib/core-types/Component.d.ts +2 -2
- package/lib/core-types/{Component.cjs → Component.js} +1 -1
- package/lib/core-types/Component.js.map +1 -0
- package/lib/core-types/Component.mjs.map +1 -1
- package/lib/core-types/UnknownProperties.js +2 -0
- package/lib/core-types/UnknownProperties.js.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/{symbols.cjs → symbols.js} +1 -1
- package/lib/core-types/symbols.js.map +1 -0
- package/lib/{coreFactory.cjs → coreFactory.js} +1 -1
- package/lib/coreFactory.js.map +1 -0
- package/lib/coreFactory.mjs +1 -1
- package/lib/enhancement/{Children.cjs → Children.js} +1 -1
- package/lib/enhancement/Children.js.map +1 -0
- package/lib/enhancement/Children.mjs +1 -1
- package/lib/enhancement/{Root.cjs → Root.js} +1 -1
- package/lib/enhancement/Root.js.map +1 -0
- package/lib/enhancement/Root.mjs +1 -5
- package/lib/enhancement/{bindHandler.cjs → bindHandler.js} +1 -1
- package/lib/enhancement/bindHandler.js.map +1 -0
- package/lib/enhancement/{dataName.cjs → dataName.js} +1 -1
- package/lib/enhancement/dataName.js.map +1 -0
- package/lib/enhancement/{enhance.cjs → enhance.js} +1 -1
- package/lib/enhancement/enhance.js.map +1 -0
- package/lib/enhancement/{functionDefaultProps.cjs → functionDefaultProps.js} +1 -1
- package/lib/enhancement/functionDefaultProps.js.map +1 -0
- package/lib/enhancement/{hoistProps.cjs → hoistProps.js} +1 -1
- package/lib/enhancement/hoistProps.js.map +1 -0
- package/lib/enhancement/{i18n.cjs → i18n.js} +1 -1
- package/lib/enhancement/i18n.js.map +1 -0
- package/lib/enhancement/{inheritedName.cjs → inheritedName.js} +1 -1
- package/lib/enhancement/inheritedName.js.map +1 -0
- package/lib/enhancement/{staticChildren.cjs → staticChildren.js} +1 -1
- package/lib/enhancement/staticChildren.js.map +1 -0
- package/lib/enhancement/{style.cjs → style.js} +1 -1
- package/lib/enhancement/style.js.map +1 -0
- package/lib/enhancement/style.mjs +2 -3
- package/lib/enhancement/{uncontrolledProps.cjs → uncontrolledProps.js} +1 -1
- package/lib/enhancement/uncontrolledProps.js.map +1 -0
- package/lib/esm/coreFactory.mjs +1 -1
- package/lib/esm/enhancement/Children.mjs +1 -1
- package/lib/esm/enhancement/Root.mjs +1 -5
- package/lib/esm/enhancement/style.mjs +2 -3
- package/lib/esm/index.mjs +1 -0
- package/lib/esm/styled/index.mjs +8 -0
- package/lib/esm/styled/reshadow-core.mjs +219 -3
- package/lib/esm/utils/assignProps.mjs +10 -0
- package/lib/esm/utils/createHoc.mjs +44 -0
- package/lib/esm/utils/enhances/WithI18n.mjs +30 -6
- package/lib/esm/utils/enhances/i18nEnhance.mjs +91 -0
- package/lib/esm/utils/getDisplayName.mjs +6 -0
- package/lib/esm/utils/ref.mjs +46 -2
- package/lib/{index.cjs → index.js} +1 -1
- package/lib/index.js.map +1 -0
- package/lib/index.mjs +1 -0
- package/lib/{register.cjs → register.js} +1 -1
- package/lib/register.js.map +1 -0
- package/lib/styled/{index.cjs → index.js} +1 -1
- package/lib/styled/index.js.map +1 -0
- package/lib/styled/index.mjs +8 -6
- package/lib/styled/{reshadow-core.cjs → reshadow-core.js} +1 -1
- package/lib/styled/reshadow-core.js.map +1 -0
- package/lib/styled/reshadow-core.mjs +219 -3
- package/lib/styled/{sstyled.cjs → sstyled.js} +1 -1
- package/lib/styled/sstyled.js.map +1 -0
- package/lib/theme/dark.json +2 -2
- package/lib/theme/light.json +2 -2
- package/lib/theme/{processor.cjs → processor.js} +1 -1
- package/lib/theme/processor.js.map +1 -0
- package/lib/theme/themes/auto.css +4 -4
- package/lib/theme/themes/dark.css +2 -2
- package/lib/theme/themes/dark.d.ts +1 -1
- package/lib/theme/themes/{dark.cjs → dark.js} +2 -2
- package/lib/theme/themes/dark.js.map +1 -0
- package/lib/theme/themes/dark.mjs +1 -1
- package/lib/theme/themes/dark.mjs.map +1 -1
- package/lib/theme/themes/default.css +2 -2
- package/lib/theme/themes/default.d.ts +1 -1
- package/lib/theme/themes/{light.cjs → default.js} +2 -2
- package/lib/theme/themes/default.js.map +1 -0
- package/lib/theme/themes/default.mjs +1 -1
- package/lib/theme/themes/default.mjs.map +1 -1
- package/lib/theme/themes/light.css +2 -2
- package/lib/theme/themes/light.d.ts +1 -1
- package/lib/theme/themes/{default.cjs → light.js} +2 -2
- package/lib/theme/themes/light.js.map +1 -0
- package/lib/theme/themes/light.mjs +1 -1
- package/lib/theme/themes/light.mjs.map +1 -1
- package/lib/theme/{utils.cjs → utils.js} +1 -1
- package/lib/theme/utils.js.map +1 -0
- package/lib/utils/{CSSinJS.cjs → CSSinJS.js} +1 -1
- package/lib/utils/CSSinJS.js.map +1 -0
- package/lib/utils/{ScreenReaderOnly.cjs → ScreenReaderOnly.js} +1 -1
- package/lib/utils/ScreenReaderOnly.js.map +1 -0
- package/lib/utils/{ThemeProvider.cjs → ThemeProvider.js} +1 -1
- package/lib/utils/ThemeProvider.js.map +1 -0
- package/lib/utils/{addonText.cjs → addonText.js} +1 -1
- package/lib/utils/addonText.js.map +1 -0
- package/lib/utils/{addonTextChildren.cjs → addonTextChildren.js} +1 -1
- package/lib/utils/addonTextChildren.js.map +1 -0
- package/lib/utils/{ariaProps.cjs → ariaProps.js} +1 -1
- package/lib/utils/ariaProps.js.map +1 -0
- package/lib/utils/{assignProps.cjs → assignProps.js} +1 -1
- package/lib/utils/assignProps.js.map +1 -0
- package/lib/utils/assignProps.mjs +10 -0
- package/lib/utils/{canUseDOM.cjs → canUseDOM.js} +1 -1
- package/lib/utils/canUseDOM.js.map +1 -0
- package/lib/utils/{capitalizeFirstLetter.cjs → capitalizeFirstLetter.js} +1 -1
- package/lib/utils/capitalizeFirstLetter.js.map +1 -0
- package/lib/utils/{color.cjs → color.js} +1 -1
- package/lib/utils/color.js.map +1 -0
- package/lib/utils/{compose.cjs → compose.js} +1 -1
- package/lib/utils/compose.js.map +1 -0
- package/lib/utils/{createHoc.cjs → createHoc.js} +1 -1
- package/lib/utils/createHoc.js.map +1 -0
- package/lib/utils/createHoc.mjs +19 -21
- package/lib/utils/{createUUID.cjs → createUUID.js} +1 -1
- package/lib/utils/createUUID.js.map +1 -0
- package/lib/utils/{cssToIntDefault.cjs → cssToIntDefault.js} +1 -1
- package/lib/utils/cssToIntDefault.js.map +1 -0
- package/lib/utils/enhances/{WithAutoFocus.cjs → WithAutoFocus.js} +1 -1
- package/lib/utils/enhances/WithAutoFocus.js.map +1 -0
- package/lib/utils/enhances/{WithCSS.cjs → WithCSS.js} +1 -1
- package/lib/utils/enhances/WithCSS.js.map +1 -0
- package/lib/utils/enhances/{WithI18n.cjs → WithI18n.js} +1 -1
- package/lib/utils/enhances/WithI18n.js.map +1 -0
- package/lib/utils/enhances/WithI18n.mjs +30 -6
- package/lib/utils/enhances/{WithKeyboardFocus.cjs → WithKeyboardFocus.js} +1 -1
- package/lib/utils/enhances/WithKeyboardFocus.js.map +1 -0
- package/lib/utils/enhances/{WithRef.cjs → WithRef.js} +1 -1
- package/lib/utils/enhances/WithRef.js.map +1 -0
- package/lib/utils/enhances/{a11yEnhance.cjs → a11yEnhance.js} +1 -1
- package/lib/utils/enhances/a11yEnhance.js.map +1 -0
- package/lib/utils/enhances/{animatedSizeEnhance.cjs → animatedSizeEnhance.js} +1 -1
- package/lib/utils/enhances/animatedSizeEnhance.js.map +1 -0
- package/lib/utils/enhances/{autoFocusEnhance.cjs → autoFocusEnhance.js} +1 -1
- package/lib/utils/enhances/autoFocusEnhance.js.map +1 -0
- package/lib/utils/enhances/{contextEnhance.cjs → contextEnhance.js} +1 -1
- package/lib/utils/enhances/contextEnhance.js.map +1 -0
- package/lib/utils/enhances/{i18nEnhance.cjs → i18nEnhance.js} +1 -1
- package/lib/utils/enhances/i18nEnhance.js.map +1 -0
- package/lib/utils/enhances/i18nEnhance.mjs +32 -33
- package/lib/utils/enhances/{keyboardFocusEnhance.cjs → keyboardFocusEnhance.js} +1 -1
- package/lib/utils/enhances/keyboardFocusEnhance.js.map +1 -0
- package/lib/utils/enhances/{resolveColorEnhance.cjs → resolveColorEnhance.js} +1 -1
- package/lib/utils/enhances/resolveColorEnhance.js.map +1 -0
- package/lib/utils/{eventEmitter.cjs → eventEmitter.js} +1 -1
- package/lib/utils/eventEmitter.js.map +1 -0
- package/lib/utils/findComponent.d.ts +2 -2
- package/lib/utils/{findComponent.cjs → findComponent.js} +1 -1
- package/lib/utils/findComponent.js.map +1 -0
- package/lib/utils/findComponent.mjs.map +1 -1
- package/lib/utils/{fire.cjs → fire.js} +1 -1
- package/lib/utils/fire.js.map +1 -0
- package/lib/utils/focus-lock/{focusBorders.cjs → focusBorders.js} +1 -1
- package/lib/utils/focus-lock/focusBorders.js.map +1 -0
- package/lib/utils/focus-lock/{getFocusableIn.cjs → getFocusableIn.js} +1 -1
- package/lib/utils/focus-lock/getFocusableIn.js.map +1 -0
- package/lib/utils/focus-lock/{isFocusInside.cjs → isFocusInside.js} +1 -1
- package/lib/utils/focus-lock/isFocusInside.js.map +1 -0
- package/lib/utils/focus-lock/{isFocusable.cjs → isFocusable.js} +1 -1
- package/lib/utils/focus-lock/isFocusable.js.map +1 -0
- package/lib/utils/focus-lock/{setFocus.cjs → setFocus.js} +1 -1
- package/lib/utils/focus-lock/setFocus.js.map +1 -0
- package/lib/utils/{getAccessibleName.cjs → getAccessibleName.js} +1 -1
- package/lib/utils/getAccessibleName.js.map +1 -0
- package/lib/utils/{getDisplayName.cjs → getDisplayName.js} +1 -1
- package/lib/utils/getDisplayName.js.map +1 -0
- package/lib/utils/getDisplayName.mjs +5 -3
- package/lib/utils/{getEventTarget.cjs → getEventTarget.js} +1 -1
- package/lib/utils/getEventTarget.js.map +1 -0
- package/lib/utils/{getOriginChildren.cjs → getOriginChildren.js} +1 -1
- package/lib/utils/getOriginChildren.js.map +1 -0
- package/lib/utils/{getRandomInt.cjs → getRandomInt.js} +1 -1
- package/lib/utils/getRandomInt.js.map +1 -0
- package/lib/utils/{getValue.cjs → getValue.js} +1 -1
- package/lib/utils/getValue.js.map +1 -0
- package/lib/utils/{hasLabels.cjs → hasLabels.js} +1 -1
- package/lib/utils/hasLabels.js.map +1 -0
- package/lib/utils/{hasParent.cjs → hasParent.js} +1 -1
- package/lib/utils/hasParent.js.map +1 -0
- package/lib/utils/{if.cjs → if.js} +1 -1
- package/lib/utils/if.js.map +1 -0
- package/lib/utils/{ifChildren.cjs → ifChildren.js} +1 -1
- package/lib/utils/ifChildren.js.map +1 -0
- package/lib/utils/{injectStyle.cjs → injectStyle.js} +1 -1
- package/lib/utils/injectStyle.js.map +1 -0
- package/lib/utils/{inputProps.cjs → inputProps.js} +1 -1
- package/lib/utils/inputProps.js.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.cjs → isNode.js} +1 -1
- package/lib/utils/isNode.js.map +1 -0
- package/lib/utils/{isPromise.cjs → isPromise.js} +1 -1
- package/lib/utils/isPromise.js.map +1 -0
- package/lib/utils/{isRetina.cjs → isRetina.js} +1 -1
- package/lib/utils/isRetina.js.map +1 -0
- package/lib/utils/{logger.cjs → logger.js} +1 -1
- package/lib/utils/logger.js.map +1 -0
- package/lib/utils/{numericChecker.cjs → numericChecker.js} +1 -1
- package/lib/utils/numericChecker.js.map +1 -0
- package/lib/utils/{ownerDocument.cjs → ownerDocument.js} +1 -1
- package/lib/utils/ownerDocument.js.map +1 -0
- package/lib/utils/{pick.cjs → pick.js} +1 -1
- package/lib/utils/pick.js.map +1 -0
- package/lib/utils/{propsForElement.cjs → propsForElement.js} +1 -1
- package/lib/utils/propsForElement.js.map +1 -0
- package/lib/utils/{rafTrottle.cjs → rafTrottle.js} +1 -1
- package/lib/utils/rafTrottle.js.map +1 -0
- package/lib/utils/{reactToText.cjs → reactToText.js} +1 -1
- package/lib/utils/reactToText.js.map +1 -0
- package/lib/utils/ref.d.ts +4 -2
- package/lib/utils/{ref.cjs → ref.js} +3 -2
- package/lib/utils/ref.js.map +1 -0
- package/lib/utils/ref.mjs +46 -2
- package/lib/utils/ref.mjs.map +1 -1
- package/lib/utils/{setRef.cjs → setRef.js} +1 -1
- package/lib/utils/setRef.js.map +1 -0
- package/lib/utils/{syncScroll.cjs → syncScroll.js} +1 -1
- package/lib/utils/syncScroll.js.map +1 -0
- package/lib/utils/{uncontroll.cjs → uncontroll.js} +1 -1
- package/lib/utils/uncontroll.js.map +1 -0
- package/lib/utils/{uniqueID.cjs → uniqueID.js} +1 -1
- package/lib/utils/uniqueID.js.map +1 -0
- package/lib/utils/use/{useColorResolver.cjs → useColorResolver.js} +1 -1
- package/lib/utils/use/useColorResolver.js.map +1 -0
- package/lib/utils/use/{useCss.cjs → useCss.js} +1 -1
- package/lib/utils/use/useCss.js.map +1 -0
- package/lib/utils/use/{useEnhancedEffect.cjs → useEnhancedEffect.js} +1 -1
- package/lib/utils/use/useEnhancedEffect.js.map +1 -0
- package/lib/utils/use/{useEventCallback.cjs → useEventCallback.js} +1 -1
- package/lib/utils/use/useEventCallback.js.map +1 -0
- package/lib/utils/use/{useEventListener.cjs → useEventListener.js} +2 -2
- package/lib/utils/use/useEventListener.js.map +1 -0
- package/lib/utils/use/useEventListener.mjs +1 -1
- package/lib/utils/use/useEventListener.mjs.map +1 -1
- package/lib/utils/use/{useFocusLock.cjs → useFocusLock.js} +1 -1
- package/lib/utils/use/useFocusLock.js.map +1 -0
- package/lib/utils/use/{usePreventScroll.cjs → usePreventScroll.js} +1 -1
- package/lib/utils/use/usePreventScroll.js.map +1 -0
- package/lib/utils/{useCssVariable.cjs → useCssVariable.js} +1 -1
- package/lib/utils/useCssVariable.js.map +1 -0
- package/lib/utils/{zIndexStacking.cjs → zIndexStacking.js} +1 -1
- package/lib/utils/zIndexStacking.js.map +1 -0
- package/package.json +40 -15
- package/vite.config.ts +1 -0
- package/lib/LastInteractionType.cjs.map +0 -1
- package/lib/core-types/Component.cjs.map +0 -1
- package/lib/core-types/UnknownProperties.cjs +0 -2
- package/lib/core-types/UnknownProperties.cjs.map +0 -1
- package/lib/core-types/reshadow.d.cjs +0 -2
- package/lib/core-types/reshadow.d.cjs.map +0 -1
- package/lib/core-types/symbols.cjs.map +0 -1
- package/lib/coreFactory.cjs.map +0 -1
- package/lib/enhancement/Children.cjs.map +0 -1
- package/lib/enhancement/Root.cjs.map +0 -1
- package/lib/enhancement/bindHandler.cjs.map +0 -1
- package/lib/enhancement/dataName.cjs.map +0 -1
- package/lib/enhancement/enhance.cjs.map +0 -1
- package/lib/enhancement/functionDefaultProps.cjs.map +0 -1
- package/lib/enhancement/hoistProps.cjs.map +0 -1
- package/lib/enhancement/i18n.cjs.map +0 -1
- package/lib/enhancement/inheritedName.cjs.map +0 -1
- package/lib/enhancement/staticChildren.cjs.map +0 -1
- package/lib/enhancement/style.cjs.map +0 -1
- package/lib/enhancement/uncontrolledProps.cjs.map +0 -1
- package/lib/index.cjs.map +0 -1
- package/lib/register.cjs.map +0 -1
- package/lib/styled/index.cjs.map +0 -1
- package/lib/styled/reshadow-core.cjs.map +0 -1
- package/lib/styled/sstyled.cjs.map +0 -1
- package/lib/theme/processor.cjs.map +0 -1
- package/lib/theme/themes/dark.cjs.map +0 -1
- package/lib/theme/themes/default.cjs.map +0 -1
- package/lib/theme/themes/light.cjs.map +0 -1
- package/lib/theme/utils.cjs.map +0 -1
- package/lib/utils/CSSinJS.cjs.map +0 -1
- package/lib/utils/ScreenReaderOnly.cjs.map +0 -1
- package/lib/utils/ThemeProvider.cjs.map +0 -1
- package/lib/utils/addonText.cjs.map +0 -1
- package/lib/utils/addonTextChildren.cjs.map +0 -1
- package/lib/utils/ariaProps.cjs.map +0 -1
- package/lib/utils/assignProps.cjs.map +0 -1
- package/lib/utils/canUseDOM.cjs.map +0 -1
- package/lib/utils/capitalizeFirstLetter.cjs.map +0 -1
- package/lib/utils/color.cjs.map +0 -1
- package/lib/utils/compose.cjs.map +0 -1
- package/lib/utils/createHoc.cjs.map +0 -1
- package/lib/utils/createUUID.cjs.map +0 -1
- package/lib/utils/cssToIntDefault.cjs.map +0 -1
- package/lib/utils/enhances/WithAutoFocus.cjs.map +0 -1
- package/lib/utils/enhances/WithCSS.cjs.map +0 -1
- package/lib/utils/enhances/WithI18n.cjs.map +0 -1
- package/lib/utils/enhances/WithKeyboardFocus.cjs.map +0 -1
- package/lib/utils/enhances/WithRef.cjs.map +0 -1
- package/lib/utils/enhances/a11yEnhance.cjs.map +0 -1
- package/lib/utils/enhances/animatedSizeEnhance.cjs.map +0 -1
- package/lib/utils/enhances/autoFocusEnhance.cjs.map +0 -1
- package/lib/utils/enhances/contextEnhance.cjs.map +0 -1
- package/lib/utils/enhances/i18nEnhance.cjs.map +0 -1
- package/lib/utils/enhances/keyboardFocusEnhance.cjs.map +0 -1
- package/lib/utils/enhances/resolveColorEnhance.cjs.map +0 -1
- package/lib/utils/eventEmitter.cjs.map +0 -1
- package/lib/utils/findComponent.cjs.map +0 -1
- package/lib/utils/fire.cjs.map +0 -1
- package/lib/utils/focus-lock/focusBorders.cjs.map +0 -1
- package/lib/utils/focus-lock/getFocusableIn.cjs.map +0 -1
- package/lib/utils/focus-lock/isFocusInside.cjs.map +0 -1
- package/lib/utils/focus-lock/isFocusable.cjs.map +0 -1
- package/lib/utils/focus-lock/setFocus.cjs.map +0 -1
- package/lib/utils/getAccessibleName.cjs.map +0 -1
- package/lib/utils/getDisplayName.cjs.map +0 -1
- package/lib/utils/getEventTarget.cjs.map +0 -1
- package/lib/utils/getOriginChildren.cjs.map +0 -1
- package/lib/utils/getRandomInt.cjs.map +0 -1
- package/lib/utils/getValue.cjs.map +0 -1
- package/lib/utils/hasLabels.cjs.map +0 -1
- package/lib/utils/hasParent.cjs.map +0 -1
- package/lib/utils/if.cjs.map +0 -1
- package/lib/utils/ifChildren.cjs.map +0 -1
- package/lib/utils/injectStyle.cjs.map +0 -1
- package/lib/utils/inputProps.cjs.map +0 -1
- package/lib/utils/isNode.cjs.map +0 -1
- package/lib/utils/isPromise.cjs.map +0 -1
- package/lib/utils/isRetina.cjs.map +0 -1
- package/lib/utils/logger.cjs.map +0 -1
- package/lib/utils/numericChecker.cjs.map +0 -1
- package/lib/utils/ownerDocument.cjs.map +0 -1
- package/lib/utils/pick.cjs.map +0 -1
- package/lib/utils/propsForElement.cjs.map +0 -1
- package/lib/utils/rafTrottle.cjs.map +0 -1
- package/lib/utils/reactToText.cjs.map +0 -1
- package/lib/utils/ref.cjs.map +0 -1
- package/lib/utils/setRef.cjs.map +0 -1
- package/lib/utils/syncScroll.cjs.map +0 -1
- package/lib/utils/uncontroll.cjs.map +0 -1
- package/lib/utils/uniqueID.cjs.map +0 -1
- package/lib/utils/use/useColorResolver.cjs.map +0 -1
- package/lib/utils/use/useCss.cjs.map +0 -1
- package/lib/utils/use/useEnhancedEffect.cjs.map +0 -1
- package/lib/utils/use/useEventCallback.cjs.map +0 -1
- package/lib/utils/use/useEventListener.cjs.map +0 -1
- package/lib/utils/use/useFocusLock.cjs.map +0 -1
- package/lib/utils/use/usePreventScroll.cjs.map +0 -1
- package/lib/utils/useCssVariable.cjs.map +0 -1
- package/lib/utils/zIndexStacking.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uncontrolledProps.js","names":["_assignProps","require","_capitalizeFirstLetter","_interopRequireDefault","assign","target","source","Object","defineProperties","keys","reduce","descriptors","key","getOwnPropertyDescriptor","defaultProp","prop","concat","capitalizeFirstLetter","handlerProp","isControlled","propValue","undefined","uncontrolledProp","self","propName","propDefaultValue","propHandler","chainHandler","getValue","state","value","oldValue","setState","_defineProperty2","_len","arguments","length","args","Array","_key","callAllEventHandlers","apply","_toConsumableArray2","uncontrolledUniversal","props","config","handlerProps","uncontrolledProps","result","_objectSpread2","handlerName","defaultPropName","other","_objectWithoutProperties2","map","_toPropertyKey2","console","warn","setter","isArray","_setter","_setter2","_toArray2","slice","v","_uncontrolledProp","_uncontrolledProp2","_slicedToArray2","handler","_objectSpread3","eventOrValue","_len2","_key2","push","uncontrolled","bind","Enhancement","condition","Component","Boolean","prototype","init","handlers","_uncontrolled","_uncontrolled2","uncontrolledHandlers","context","asProps","_uncontrolled3","_uncontrolled4","_default","exports"],"sources":["../../src/enhancement/uncontrolledProps.tsx"],"sourcesContent":["import { callAllEventHandlers } from '../utils/assignProps';\nimport capitalizeFirstLetter from '../utils/capitalizeFirstLetter';\n\nfunction assign(target: any, source: any) {\n return Object.defineProperties(\n target,\n Object.keys(source).reduce((descriptors: any, key) => {\n descriptors[key] = Object.getOwnPropertyDescriptor(source, key);\n return descriptors;\n }, {}),\n );\n}\n\nfunction defaultProp(prop: any) {\n return `default${capitalizeFirstLetter(prop)}`;\n}\n\nfunction handlerProp(prop: any) {\n if (prop === 'value') prop = '';\n if (prop === 'checked') prop = '';\n return `on${capitalizeFirstLetter(prop)}Change`;\n}\n\nfunction isControlled(propValue: any) {\n return propValue !== undefined;\n}\n\nfunction uncontrolledProp(\n self: any,\n propName: any,\n propValue: any,\n propDefaultValue: any,\n propHandler: any,\n chainHandler: any,\n) {\n function getValue() {\n return isControlled(propValue)\n ? propValue\n : propName in self.state\n ? self.state[propName]\n : propDefaultValue;\n }\n\n return [\n getValue(),\n (value: any, ...args: any[]) => {\n const oldValue = getValue();\n if (oldValue === value) return false;\n if (!isControlled(propValue)) self.setState({ [propName]: value });\n return callAllEventHandlers(propHandler, ...chainHandler)(value, ...args);\n },\n ];\n}\n\nfunction uncontrolledUniversal(props: any, config: any, uncontrolledProp: any) {\n const handlerProps = {};\n const uncontrolledProps = Object.keys(config).reduce((result, propName) => {\n const handlerName = handlerProp(propName);\n const defaultPropName = defaultProp(propName);\n const {\n [defaultPropName]: propDefaultValue,\n [propName]: propValue,\n [handlerName]: propHandler,\n ...other\n } = result;\n\n if (propDefaultValue === undefined) {\n console.warn(defaultPropName, 'must be installed in \"defaultProps\"');\n }\n\n // if (typeof propDefaultValue === 'function' && propDefaultValue.defaultInit) {\n // propDefaultValue = propDefaultValue(result);\n // }\n\n let setter = config[propName];\n let chainHandler = [];\n\n if (Array.isArray(setter)) [setter, ...chainHandler] = setter;\n setter = setter || ((v: any) => v);\n\n const [value, handler] = uncontrolledProp(\n propName,\n propValue,\n propDefaultValue,\n propHandler,\n chainHandler,\n );\n // TODO: need to warn about recursion (by lsroman)\n (handlerProps as any)[propName] = handler;\n\n return {\n ...other,\n [propName]: value,\n [handlerName]: (eventOrValue: any, ...args: any[]) => {\n const result = [setter(eventOrValue, ...args), ...args];\n if (eventOrValue?.target) {\n result.push(eventOrValue);\n }\n return handler(...result);\n },\n };\n }, props);\n return [uncontrolledProps, handlerProps];\n}\n\nfunction uncontrolled(self: any, props: any, config: any) {\n return uncontrolledUniversal(props, config, uncontrolledProp.bind(undefined, self));\n}\n\nfunction Enhancement() {\n return {\n condition: function (Component: any) {\n return Boolean(Component.prototype.uncontrolledProps);\n },\n init: function (this: any) {\n this.state = this.state || {};\n assign(this, {\n get handlers() {\n const [, uncontrolledHandlers] = uncontrolled(this, this.props, this.uncontrolledProps());\n return uncontrolledHandlers;\n },\n });\n },\n context: function (this: any, context: any) {\n return {\n ...context,\n handlers: this.handlers,\n };\n },\n asProps: function (this: any, props: any) {\n // TODO: need to omit unneccessary props (by lsroman)\n const [uncontrolledProps] = uncontrolled(this, props, this.uncontrolledProps());\n return uncontrolledProps;\n },\n };\n}\n\nexport default Enhancement;\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,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IAAI,CAACG,iBAAiB,EAAE,CAAC;QAAA0C,cAAA,OAAAtB,eAAA,aAAAqB,cAAA;QAAxEzC,iBAAiB,GAAA0C,cAAA;MACxB,OAAO1C,iBAAiB;IAC1B;EACF,CAAC;AACH;AAAC,IAAA2C,QAAA,GAEcd,WAAW;AAAAe,OAAA,cAAAD,QAAA"}
|
package/lib/esm/coreFactory.mjs
CHANGED
|
@@ -28,7 +28,7 @@ import Enhancement$8 from "./enhancement/enhance.mjs";
|
|
|
28
28
|
import Enhancement$9 from "./enhancement/style.mjs";
|
|
29
29
|
import Enhancement from "./enhancement/bindHandler.mjs";
|
|
30
30
|
import i18nAppLocaleEnhance from "./enhancement/i18n.mjs";
|
|
31
|
-
import {
|
|
31
|
+
import { CORE_AS_PROPS, CORE_INSTANCE, CORE_INIT, CORE_COMPONENT, PARENT_COMPONENTS, CONTEXT_COMPONENT, CREATE_COMPONENT } from "./core-types/symbols.mjs";
|
|
32
32
|
var _excluded = ["forwardRef"], _excluded2 = ["forwardRef", "__WRAPPER_PROPS_BIND__"], _excluded3 = ["ref"];
|
|
33
33
|
function isEmptyObject(obj) {
|
|
34
34
|
return Object.getOwnPropertyNames(obj).length === 0 && Object.getOwnPropertySymbols && // For IE 11
|
|
@@ -3,7 +3,7 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
5
|
import React from "react";
|
|
6
|
-
import {
|
|
6
|
+
import { CHILDREN_COMPONENT, CONTEXT_COMPONENT } from "../core-types/symbols.mjs";
|
|
7
7
|
var _excluded = ["handlers", "getters"], _excluded2 = ["handlers"];
|
|
8
8
|
var CHILDREN_SELF = Symbol("CHILDREN_SELF");
|
|
9
9
|
var GETTER_REG = /^get[\w]+Props$/;
|
|
@@ -8,11 +8,7 @@ var _excluded = ["render"], _excluded2 = ["Root", "styles", "children", "Childre
|
|
|
8
8
|
function createRootRender() {
|
|
9
9
|
var Root = /* @__PURE__ */ React.forwardRef(function(_ref, ref) {
|
|
10
10
|
var Tag = _ref.render, source = _objectWithoutProperties(_ref, _excluded);
|
|
11
|
-
var _Root$props = Root.props;
|
|
12
|
-
_Root$props.Root;
|
|
13
|
-
_Root$props.styles;
|
|
14
|
-
_Root$props.children;
|
|
15
|
-
var Children = _Root$props.Children, _Root$props$forwardRe = _Root$props.forwardRef, forwardRef = _Root$props$forwardRe === void 0 ? null : _Root$props$forwardRe, props = _objectWithoutProperties(_Root$props, _excluded2);
|
|
11
|
+
var _Root$props = Root.props, _Root = _Root$props.Root, styles = _Root$props.styles, children = _Root$props.children, Children = _Root$props.Children, _Root$props$forwardRe = _Root$props.forwardRef, forwardRef = _Root$props$forwardRe === void 0 ? null : _Root$props$forwardRe, props = _objectWithoutProperties(_Root$props, _excluded2);
|
|
16
12
|
var clearProps = Object.entries(props).reduce(function(props2, _ref2) {
|
|
17
13
|
var _ref3 = _slicedToArray(_ref2, 2), name = _ref3[0], value = _ref3[1];
|
|
18
14
|
if (value !== void 0) {
|
|
@@ -2,6 +2,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
4
|
import React from "react";
|
|
5
|
+
import "../styled/index.mjs";
|
|
5
6
|
import { STATIC_COMPONENT } from "./staticChildren.mjs";
|
|
6
7
|
import { sstyled } from "../styled/sstyled.mjs";
|
|
7
8
|
var _excluded = ["_styles", "styles"], _excluded2 = ["styles"];
|
|
@@ -27,9 +28,7 @@ function Enhancement(childComponents, Context) {
|
|
|
27
28
|
return _objectSpread(_objectSpread({}, _context), {}, _defineProperty({}, STYLES_CONTEXT, this[STYLES_SELF]));
|
|
28
29
|
},
|
|
29
30
|
asProps: function asProps(_ref) {
|
|
30
|
-
_ref._styles;
|
|
31
|
-
_ref.styles;
|
|
32
|
-
var props = _objectWithoutProperties(_ref, _excluded);
|
|
31
|
+
var _styles = _ref._styles, styles = _ref.styles, props = _objectWithoutProperties(_ref, _excluded);
|
|
33
32
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
34
33
|
styles: this[STYLES_SELF]
|
|
35
34
|
});
|
package/lib/esm/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { assignProps, createBaseComponent, createComponent } from "./coreFactory.mjs";
|
|
2
|
+
import "./styled/index.mjs";
|
|
2
3
|
import { Component, Intergalactic, Root, wrapIntergalacticComponent } from "./core-types/Component.mjs";
|
|
3
4
|
import { CHILDREN_COMPONENT, CONTEXT_COMPONENT, CORE_INSTANCE, CREATE_COMPONENT, INHERITED_NAME } from "./core-types/symbols.mjs";
|
|
4
5
|
import { default as default2 } from "./register.mjs";
|
|
@@ -1,5 +1,70 @@
|
|
|
1
|
-
import "@babel/runtime/helpers/esm/typeof";
|
|
2
|
-
import "@babel/runtime/helpers/esm/defineProperty";
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
+
var _Symbol = function _Symbol2(key) {
|
|
4
|
+
return typeof Symbol !== "undefined" ? Symbol(key) : key;
|
|
5
|
+
};
|
|
6
|
+
var KEYS = {
|
|
7
|
+
__id__: _Symbol("__id__"),
|
|
8
|
+
__store__: _Symbol("__store__"),
|
|
9
|
+
__prev__: _Symbol("__prev__"),
|
|
10
|
+
__use__: _Symbol("__use__"),
|
|
11
|
+
__elements__: "__elements__",
|
|
12
|
+
__style__: "$$style",
|
|
13
|
+
__styles__: "styles",
|
|
14
|
+
__css__: "__css__",
|
|
15
|
+
__hash__: "__hash__",
|
|
16
|
+
/**
|
|
17
|
+
* This prop is needed for the interop between different component frameworks
|
|
18
|
+
*/
|
|
19
|
+
__classProp__: "className"
|
|
20
|
+
};
|
|
21
|
+
var index = 0;
|
|
22
|
+
var use = function use2(obj) {
|
|
23
|
+
var result = {};
|
|
24
|
+
result[KEYS.__use__] = obj;
|
|
25
|
+
return result;
|
|
26
|
+
};
|
|
27
|
+
var create = function create2(args) {
|
|
28
|
+
var len = args.length;
|
|
29
|
+
var newStyle = {};
|
|
30
|
+
var id = "";
|
|
31
|
+
var vars = null;
|
|
32
|
+
var uses = null;
|
|
33
|
+
for (var i = 0; i < len; i++) {
|
|
34
|
+
var _style = args[i];
|
|
35
|
+
if (!_style) continue;
|
|
36
|
+
if (!_style[KEYS.__id__]) {
|
|
37
|
+
_style[KEYS.__id__] = ++index;
|
|
38
|
+
_style[KEYS.__store__] = _defineProperty({}, "_" + _style[KEYS.__id__], _style);
|
|
39
|
+
}
|
|
40
|
+
id += "_" + _style[KEYS.__id__];
|
|
41
|
+
if (_style[KEYS.__style__]) {
|
|
42
|
+
vars = Object.assign(vars || {}, _style[KEYS.__style__]);
|
|
43
|
+
}
|
|
44
|
+
if (_style[KEYS.__use__]) {
|
|
45
|
+
uses = Object.assign(uses || {}, _style[KEYS.__use__]);
|
|
46
|
+
}
|
|
47
|
+
if (_style[KEYS.__store__][id]) {
|
|
48
|
+
newStyle = _style[KEYS.__store__][id];
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
newStyle = Object.create(newStyle);
|
|
52
|
+
for (var key in _style) {
|
|
53
|
+
if (key in KEYS) continue;
|
|
54
|
+
newStyle[key] = appendClassName(_style[key], newStyle[key]);
|
|
55
|
+
}
|
|
56
|
+
_style[KEYS.__store__][id] = newStyle;
|
|
57
|
+
newStyle[KEYS.__id__] = index;
|
|
58
|
+
newStyle[KEYS.__store__] = _defineProperty({}, "_" + _style[KEYS.__id__], newStyle);
|
|
59
|
+
}
|
|
60
|
+
if (vars || use) {
|
|
61
|
+
newStyle = Object.create(newStyle);
|
|
62
|
+
newStyle[KEYS.__style__] = vars;
|
|
63
|
+
newStyle[KEYS.__use__] = uses;
|
|
64
|
+
}
|
|
65
|
+
return newStyle;
|
|
66
|
+
};
|
|
67
|
+
var isSSR = !(typeof window !== "undefined" && window.document && window.document.createElement);
|
|
3
68
|
var serverMap = {};
|
|
4
69
|
var getStyles = function getStyles2() {
|
|
5
70
|
return {
|
|
@@ -13,6 +78,157 @@ var getStyles = function getStyles2() {
|
|
|
13
78
|
}
|
|
14
79
|
};
|
|
15
80
|
};
|
|
81
|
+
var clearStyles = function clearStyles2() {
|
|
82
|
+
serverStyles = "";
|
|
83
|
+
};
|
|
84
|
+
var RESHADOW_ID = "__reshadow__";
|
|
85
|
+
var appendChildToDocumentHead = function appendChildToDocumentHead2(element) {
|
|
86
|
+
return document.head.appendChild(element);
|
|
87
|
+
};
|
|
88
|
+
var css = function css2(code, hash) {
|
|
89
|
+
var id = "reshadow-".concat(hash);
|
|
90
|
+
if (isSSR) {
|
|
91
|
+
serverMap[id] = code;
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
var container = document.getElementById(RESHADOW_ID);
|
|
95
|
+
if (!container) {
|
|
96
|
+
container = document.createElement("object");
|
|
97
|
+
container.id = RESHADOW_ID;
|
|
98
|
+
if (document.head) {
|
|
99
|
+
appendChildToDocumentHead(container);
|
|
100
|
+
} else {
|
|
101
|
+
document.addEventListener("DOMContentLoaded", function() {
|
|
102
|
+
appendChildToDocumentHead(container);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
var css3 = document.getElementById(id);
|
|
107
|
+
if (!css3) {
|
|
108
|
+
css3 = document.createElement("style");
|
|
109
|
+
css3.id = id;
|
|
110
|
+
css3.type = "text/css";
|
|
111
|
+
container.appendChild(css3);
|
|
112
|
+
}
|
|
113
|
+
css3.innerHTML = code;
|
|
114
|
+
};
|
|
115
|
+
var styles = {};
|
|
116
|
+
var style;
|
|
117
|
+
var stack = [];
|
|
118
|
+
var styled = function styled2(elem) {
|
|
119
|
+
var curr = stack.pop() || [];
|
|
120
|
+
styles = curr[0] || styles;
|
|
121
|
+
style = curr[1] || style;
|
|
122
|
+
styled2[KEYS.__styles__] = styles;
|
|
123
|
+
styled2[KEYS.__style__] = style;
|
|
124
|
+
return elem;
|
|
125
|
+
};
|
|
126
|
+
styled[KEYS.__styles__] = styles;
|
|
127
|
+
var set = function set2(args, newStyle) {
|
|
128
|
+
var newStyles = create(args);
|
|
129
|
+
stack.push([styles, style]);
|
|
130
|
+
styles = newStyles;
|
|
131
|
+
style = newStyle;
|
|
132
|
+
if (styles[KEYS.__style__]) {
|
|
133
|
+
style = style ? Object.assign({}, style, styles[KEYS.__style__]) : styles[KEYS.__style__];
|
|
134
|
+
}
|
|
135
|
+
styled[KEYS.__styles__] = styles;
|
|
136
|
+
styled[KEYS.__style__] = style;
|
|
137
|
+
};
|
|
138
|
+
var USE_PREFIX = "use--";
|
|
139
|
+
var ELEMENT_PREFIX = "__";
|
|
140
|
+
var MOD_PREFIX = "_";
|
|
141
|
+
var MOD_SEPARATOR = "_";
|
|
142
|
+
var parseElement = function parseElement2(name) {
|
|
143
|
+
return name.replace(ELEMENT_PREFIX, "");
|
|
144
|
+
};
|
|
145
|
+
var parseAttribute = function parseAttribute2(name) {
|
|
146
|
+
return name.replace(MOD_PREFIX, "").split(MOD_SEPARATOR);
|
|
147
|
+
};
|
|
148
|
+
var appendClassName = function appendClassName2(className) {
|
|
149
|
+
var cn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
|
|
150
|
+
if (className) {
|
|
151
|
+
cn += (cn ? " " : "") + className;
|
|
152
|
+
}
|
|
153
|
+
return cn;
|
|
154
|
+
};
|
|
155
|
+
var appendElement = function appendElement2(styles2, key) {
|
|
156
|
+
var cn = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
|
|
157
|
+
return appendClassName(styles2[ELEMENT_PREFIX + key], cn);
|
|
158
|
+
};
|
|
159
|
+
var appendModifier = function appendModifier2(styles2, key, value) {
|
|
160
|
+
var cn = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "";
|
|
161
|
+
if (value === void 0 || value === null || value === false || value === "") return cn;
|
|
162
|
+
cn = appendClassName(styles2[MOD_PREFIX + key], cn);
|
|
163
|
+
if (typeof value === "boolean" || _typeof(value) === "object" || typeof value === "function") return cn;
|
|
164
|
+
cn = appendClassName(styles2[MOD_SEPARATOR + key + MOD_SEPARATOR + value], cn);
|
|
165
|
+
return cn;
|
|
166
|
+
};
|
|
167
|
+
function map(element) {
|
|
168
|
+
var currStyles = styled[KEYS.__styles__];
|
|
169
|
+
var nextProps = {};
|
|
170
|
+
var cn = appendElement(currStyles, element);
|
|
171
|
+
var vars = null;
|
|
172
|
+
var uses = currStyles[KEYS.__use__] || {};
|
|
173
|
+
var len = arguments.length;
|
|
174
|
+
var useProps;
|
|
175
|
+
for (var i = len - 1; i > 0; i--) {
|
|
176
|
+
var currProps = arguments[i];
|
|
177
|
+
if (!currProps) continue;
|
|
178
|
+
useProps = useProps || currProps[KEYS.__use__];
|
|
179
|
+
if (!vars && KEYS.__style__ in currProps) {
|
|
180
|
+
vars = styled[KEYS.__style__];
|
|
181
|
+
}
|
|
182
|
+
for (var key in currProps) {
|
|
183
|
+
if (key === KEYS.__use__ || key === KEYS.__style__ || key in nextProps) {
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
var value = currProps[key];
|
|
187
|
+
cn = appendModifier(currStyles, key, value, cn);
|
|
188
|
+
var valueType = _typeof(value);
|
|
189
|
+
if (valueType === "string" || valueType === "boolean" || valueType === "number") {
|
|
190
|
+
var useKey = key + "_" + value;
|
|
191
|
+
if (key + "_true" in uses || useKey in uses) {
|
|
192
|
+
cn = appendModifier(currStyles, USE_PREFIX + key, value, cn);
|
|
193
|
+
if (uses[useKey]) {
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
nextProps[key] = value;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
if (useProps) {
|
|
202
|
+
for (var _key in useProps) {
|
|
203
|
+
var _value = useProps[_key];
|
|
204
|
+
cn = appendModifier(currStyles, USE_PREFIX + _key, _value, cn);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
cn = appendClassName(nextProps[KEYS.__classProp__], cn);
|
|
208
|
+
if (cn) nextProps[KEYS.__classProp__] = cn;
|
|
209
|
+
if (vars) {
|
|
210
|
+
nextProps.style = typeof style === "string" ? vars + (nextProps.style || "") : Object.assign({}, vars, nextProps.style || {});
|
|
211
|
+
}
|
|
212
|
+
return nextProps;
|
|
213
|
+
}
|
|
16
214
|
export {
|
|
17
|
-
|
|
215
|
+
ELEMENT_PREFIX,
|
|
216
|
+
KEYS,
|
|
217
|
+
MOD_PREFIX,
|
|
218
|
+
MOD_SEPARATOR,
|
|
219
|
+
RESHADOW_ID,
|
|
220
|
+
USE_PREFIX,
|
|
221
|
+
appendClassName,
|
|
222
|
+
appendElement,
|
|
223
|
+
appendModifier,
|
|
224
|
+
clearStyles,
|
|
225
|
+
create,
|
|
226
|
+
css,
|
|
227
|
+
getStyles,
|
|
228
|
+
map,
|
|
229
|
+
parseAttribute,
|
|
230
|
+
parseElement,
|
|
231
|
+
set,
|
|
232
|
+
styled,
|
|
233
|
+
use
|
|
18
234
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _cn from "classnames";
|
|
3
|
+
import "../styled/index.mjs";
|
|
3
4
|
import { forkRef } from "./ref.mjs";
|
|
4
5
|
import { sstyled } from "../styled/sstyled.mjs";
|
|
5
6
|
function callAllEventHandlers() {
|
|
@@ -19,6 +20,14 @@ function callAllEventHandlers() {
|
|
|
19
20
|
});
|
|
20
21
|
};
|
|
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
|
+
}
|
|
22
31
|
function assignHandlersInner(props, source) {
|
|
23
32
|
return Object.keys(source).reduce(function(proxySource, propName) {
|
|
24
33
|
if (propName !== "ref" && propName.startsWith("on")) {
|
|
@@ -71,6 +80,7 @@ function assignProps() {
|
|
|
71
80
|
return newProps;
|
|
72
81
|
}
|
|
73
82
|
export {
|
|
83
|
+
assignHandlers,
|
|
74
84
|
callAllEventHandlers,
|
|
75
85
|
assignProps as default
|
|
76
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
|
+
};
|
|
@@ -4,12 +4,13 @@ import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitial
|
|
|
4
4
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
5
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
6
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
7
|
-
import { createContext, Component } from "react";
|
|
8
|
-
import
|
|
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";
|
|
9
11
|
var Context = /* @__PURE__ */ createContext(void 0);
|
|
10
|
-
Context.Provider;
|
|
11
|
-
|
|
12
|
-
createIntlCache();
|
|
12
|
+
var I18nProvider = Context.Provider, I18nConsumer = Context.Consumer;
|
|
13
|
+
var messagesCache = createIntlCache();
|
|
13
14
|
function getText(dictionaries, locale) {
|
|
14
15
|
return function(key) {
|
|
15
16
|
var dictionary = dictionaries[locale];
|
|
@@ -49,6 +50,29 @@ _defineProperty(WithI18n, "contextType", Context);
|
|
|
49
50
|
_defineProperty(WithI18n, "defaultProps", {
|
|
50
51
|
getText
|
|
51
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);
|
|
52
72
|
export {
|
|
53
|
-
Context
|
|
73
|
+
Context,
|
|
74
|
+
I18nConsumer,
|
|
75
|
+
I18nProvider,
|
|
76
|
+
WithI18n$1 as default,
|
|
77
|
+
useI18n
|
|
54
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
|
+
};
|
package/lib/esm/utils/ref.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
-
import "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import "react-dom";
|
|
4
|
+
import { findDOMNode } from "react-dom";
|
|
5
5
|
function setRef(ref, value) {
|
|
6
6
|
if (typeof ref === "function") {
|
|
7
7
|
ref(value);
|
|
@@ -9,6 +9,35 @@ function setRef(ref, value) {
|
|
|
9
9
|
ref["current"] = value;
|
|
10
10
|
}
|
|
11
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
|
+
}
|
|
12
41
|
function useForkRef() {
|
|
13
42
|
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
14
43
|
refs[_key] = arguments[_key];
|
|
@@ -36,8 +65,23 @@ function forkRef() {
|
|
|
36
65
|
});
|
|
37
66
|
};
|
|
38
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
|
+
}
|
|
39
80
|
export {
|
|
40
81
|
forkRef,
|
|
82
|
+
getNodeByRef,
|
|
83
|
+
getRef,
|
|
41
84
|
setRef,
|
|
85
|
+
useCallbackRef,
|
|
42
86
|
useForkRef
|
|
43
87
|
};
|
|
@@ -100,4 +100,4 @@ var _Component = require("./core-types/Component");
|
|
|
100
100
|
var _symbols = require("./core-types/symbols");
|
|
101
101
|
var _register = _interopRequireDefault(require("./register"));
|
|
102
102
|
var _LastInteractionType = require("./LastInteractionType");
|
|
103
|
-
//# sourceMappingURL=index.
|
|
103
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_coreFactory","require","_styled","_Component","_symbols","_register","_interopRequireDefault","_LastInteractionType"],"sources":["../src/index.ts"],"sourcesContent":["/** ============================== core ============================== */\nimport { createComponent, createBaseComponent, assignProps } from './coreFactory';\nimport { sstyled } from './styled';\nimport type { StyledProps } from './styled';\nimport { Root, Component, Intergalactic, wrapIntergalacticComponent } from './core-types/Component';\nimport type {\n PropGetterFn,\n IRootComponentProps,\n ComponentType,\n IRootComponentHandlers,\n IComponentProps,\n ReturnEl,\n IFunctionProps,\n} from './core-types/Component';\nimport {\n CORE_INSTANCE,\n CREATE_COMPONENT,\n CONTEXT_COMPONENT,\n CHILDREN_COMPONENT,\n INHERITED_NAME,\n} from './core-types/symbols';\nimport type { UnknownProperties } from './core-types/UnknownProperties';\nimport register from './register';\nimport { lastInteraction } from './LastInteractionType';\n\nexport {\n sstyled,\n createComponent,\n createBaseComponent,\n Root,\n Component,\n UnknownProperties,\n Intergalactic,\n PropGetterFn,\n IRootComponentProps,\n ComponentType,\n IRootComponentHandlers,\n IComponentProps,\n IFunctionProps,\n CORE_INSTANCE,\n CREATE_COMPONENT,\n CONTEXT_COMPONENT,\n CHILDREN_COMPONENT,\n INHERITED_NAME,\n ReturnEl,\n StyledProps,\n wrapIntergalacticComponent,\n assignProps,\n register,\n lastInteraction,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,UAAA,GAAAF,OAAA;AAUA,IAAAG,QAAA,GAAAH,OAAA;AAQA,IAAAI,SAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,oBAAA,GAAAN,OAAA"}
|
package/lib/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { assignProps, createBaseComponent, createComponent } from "./coreFactory.mjs";
|
|
2
|
+
import "./styled/index.mjs";
|
|
2
3
|
import { Component, Intergalactic, Root, wrapIntergalacticComponent } from "./core-types/Component.mjs";
|
|
3
4
|
import { CHILDREN_COMPONENT, CONTEXT_COMPONENT, CORE_INSTANCE, CREATE_COMPONENT, INHERITED_NAME } from "./core-types/symbols.mjs";
|
|
4
5
|
import { default as default2 } from "./register.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.js","names":["Register","_classCallCheck2","_defineProperty2","_createClass2","key","value","get","name","defaultValue","data","set","exports","_default"],"sources":["../src/register.tsx"],"sourcesContent":["class Register {\n data: any = {};\n\n get<D>(name: string, defaultValue?: D): D {\n if (name in this.data) {\n return this.data[name];\n } else {\n return this.set(name, defaultValue) as any;\n }\n }\n\n set<D>(name: string, value: D): D {\n this.data[name] = value;\n return this.data[name];\n }\n}\n\nexport { Register };\nexport default new Register();\n"],"mappings":";;;;;;;;;;IAAMA,QAAQ;EAAA,SAAAA,SAAA;IAAA,IAAAC,gBAAA,mBAAAD,QAAA;IAAA,IAAAE,gBAAA,2BACA,CAAC,CAAC;EAAA;EAAA,IAAAC,aAAA,aAAAH,QAAA;IAAAI,GAAA;IAAAC,KAAA,EAEd,SAAAC,IAAOC,IAAY,EAAEC,YAAgB,EAAK;MACxC,IAAID,IAAI,IAAI,IAAI,CAACE,IAAI,EAAE;QACrB,OAAO,IAAI,CAACA,IAAI,CAACF,IAAI,CAAC;MACxB,CAAC,MAAM;QACL,OAAO,IAAI,CAACG,GAAG,CAACH,IAAI,EAAEC,YAAY,CAAC;MACrC;IACF;EAAC;IAAAJ,GAAA;IAAAC,KAAA,EAED,SAAAK,IAAOH,IAAY,EAAEF,KAAQ,EAAK;MAChC,IAAI,CAACI,IAAI,CAACF,IAAI,CAAC,GAAGF,KAAK;MACvB,OAAO,IAAI,CAACI,IAAI,CAACF,IAAI,CAAC;IACxB;EAAC;EAAA,OAAAP,QAAA;AAAA;AAAAW,OAAA,CAAAX,QAAA,GAAAA,QAAA;AAAA,IAAAY,QAAA,GAIY,IAAIZ,QAAQ,EAAE;AAAAW,OAAA,cAAAC,QAAA"}
|