@semcore/core 17.0.1-prerelease.0 → 17.1.0-prerelease.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +123 -3
- package/README.md +5 -35
- package/lib/LastInteractionType.js +22 -36
- package/lib/LastInteractionType.js.map +1 -1
- package/lib/LastInteractionType.mjs +19 -33
- package/lib/LastInteractionType.mjs.map +1 -1
- package/lib/core-types/Component.js +25 -41
- package/lib/core-types/Component.js.map +1 -1
- package/lib/core-types/Component.mjs +18 -38
- package/lib/core-types/Component.mjs.map +1 -1
- package/lib/core-types/symbols.js +9 -9
- package/lib/core-types/symbols.js.map +1 -1
- package/lib/core-types/symbols.mjs +9 -9
- package/lib/core-types/symbols.mjs.map +1 -1
- package/lib/coreFactory.js +158 -238
- package/lib/coreFactory.js.map +1 -1
- package/lib/coreFactory.mjs +133 -189
- package/lib/coreFactory.mjs.map +1 -1
- package/lib/decorators/propsObserver.js +36 -64
- package/lib/decorators/propsObserver.js.map +1 -1
- package/lib/decorators/propsObserver.mjs +33 -61
- package/lib/decorators/propsObserver.mjs.map +1 -1
- package/lib/decorators/reactive.js +17 -17
- package/lib/decorators/reactive.js.map +1 -1
- package/lib/decorators/reactive.mjs +15 -15
- package/lib/decorators/reactive.mjs.map +1 -1
- package/lib/enhancement/Children.js +51 -59
- package/lib/enhancement/Children.js.map +1 -1
- package/lib/enhancement/Children.mjs +47 -41
- package/lib/enhancement/Children.mjs.map +1 -1
- package/lib/enhancement/Root.js +36 -37
- package/lib/enhancement/Root.js.map +1 -1
- package/lib/enhancement/Root.mjs +28 -18
- package/lib/enhancement/Root.mjs.map +1 -1
- package/lib/enhancement/dataName.js +7 -8
- package/lib/enhancement/dataName.js.map +1 -1
- package/lib/enhancement/dataName.mjs +5 -5
- package/lib/enhancement/dataName.mjs.map +1 -1
- package/lib/enhancement/enhance.js +6 -9
- package/lib/enhancement/enhance.js.map +1 -1
- package/lib/enhancement/enhance.mjs +4 -7
- package/lib/enhancement/enhance.mjs.map +1 -1
- package/lib/enhancement/functionDefaultProps.js +6 -6
- package/lib/enhancement/functionDefaultProps.js.map +1 -1
- package/lib/enhancement/functionDefaultProps.mjs +4 -4
- package/lib/enhancement/functionDefaultProps.mjs.map +1 -1
- package/lib/enhancement/i18n.js +13 -13
- package/lib/enhancement/i18n.js.map +1 -1
- package/lib/enhancement/i18n.mjs +10 -9
- package/lib/enhancement/i18n.mjs.map +1 -1
- package/lib/enhancement/inheritedName.js +7 -8
- package/lib/enhancement/inheritedName.js.map +1 -1
- package/lib/enhancement/inheritedName.mjs +5 -5
- package/lib/enhancement/inheritedName.mjs.map +1 -1
- package/lib/enhancement/staticChildren.js +47 -56
- package/lib/enhancement/staticChildren.js.map +1 -1
- package/lib/enhancement/staticChildren.mjs +43 -48
- package/lib/enhancement/staticChildren.mjs.map +1 -1
- package/lib/enhancement/style.js +29 -27
- package/lib/enhancement/style.js.map +1 -1
- package/lib/enhancement/style.mjs +26 -20
- package/lib/enhancement/style.mjs.map +1 -1
- package/lib/enhancement/uncontrolledProps.js +46 -65
- package/lib/enhancement/uncontrolledProps.js.map +1 -1
- package/lib/enhancement/uncontrolledProps.mjs +43 -52
- package/lib/enhancement/uncontrolledProps.mjs.map +1 -1
- package/lib/esm/LastInteractionType.mjs +19 -33
- package/lib/esm/core-types/Component.mjs +18 -38
- package/lib/esm/core-types/symbols.mjs +9 -9
- package/lib/esm/coreFactory.mjs +133 -189
- package/lib/esm/enhancement/Children.mjs +47 -41
- package/lib/esm/enhancement/Root.mjs +28 -18
- package/lib/esm/enhancement/dataName.mjs +5 -5
- package/lib/esm/enhancement/enhance.mjs +4 -7
- package/lib/esm/enhancement/functionDefaultProps.mjs +4 -4
- package/lib/esm/enhancement/i18n.mjs +10 -9
- package/lib/esm/enhancement/inheritedName.mjs +5 -5
- package/lib/esm/enhancement/staticChildren.mjs +43 -48
- package/lib/esm/enhancement/style.mjs +26 -20
- package/lib/esm/enhancement/uncontrolledProps.mjs +43 -52
- package/lib/esm/register.mjs +12 -20
- package/lib/esm/styled/reshadow-core.mjs +98 -111
- package/lib/esm/styled/sstyled.mjs +31 -41
- package/lib/esm/utils/assignProps.mjs +32 -36
- package/lib/esm/utils/enhances/WithI18n.mjs +15 -17
- package/lib/esm/utils/enhances/i18nEnhance.mjs +47 -61
- package/lib/esm/utils/logger.mjs +13 -21
- package/lib/esm/utils/pick.mjs +4 -4
- package/lib/esm/utils/ref.mjs +27 -43
- package/lib/esm/utils/use/useEnhancedEffect.mjs +1 -1
- package/lib/index.js +17 -17
- package/lib/register.js +17 -24
- package/lib/register.js.map +1 -1
- package/lib/register.mjs +12 -20
- package/lib/register.mjs.map +1 -1
- package/lib/styled/index.js +4 -4
- package/lib/styled/reshadow-core.js +102 -104
- package/lib/styled/reshadow-core.js.map +1 -1
- package/lib/styled/reshadow-core.mjs +98 -111
- package/lib/styled/reshadow-core.mjs.map +1 -1
- package/lib/styled/sstyled.js +31 -53
- package/lib/styled/sstyled.js.map +1 -1
- package/lib/styled/sstyled.mjs +31 -41
- package/lib/styled/sstyled.mjs.map +1 -1
- package/lib/theme/themes/dark.js +2 -2
- package/lib/theme/themes/dark.js.map +1 -1
- package/lib/theme/themes/default.js +2 -2
- package/lib/theme/themes/default.js.map +1 -1
- package/lib/theme/themes/highlights-dark.js +2 -2
- package/lib/theme/themes/highlights-dark.js.map +1 -1
- package/lib/theme/themes/highlights-light.js +2 -2
- package/lib/theme/themes/highlights-light.js.map +1 -1
- package/lib/theme/themes/light.js +2 -2
- package/lib/theme/themes/light.js.map +1 -1
- package/lib/utils/CSSinJS.js +8 -10
- package/lib/utils/CSSinJS.js.map +1 -1
- package/lib/utils/CSSinJS.mjs +6 -7
- package/lib/utils/CSSinJS.mjs.map +1 -1
- package/lib/utils/ThemeProvider.js +44 -51
- package/lib/utils/ThemeProvider.js.map +1 -1
- package/lib/utils/ThemeProvider.mjs +36 -47
- package/lib/utils/ThemeProvider.mjs.map +1 -1
- package/lib/utils/addonText.js +4 -7
- package/lib/utils/addonText.js.map +1 -1
- package/lib/utils/addonText.mjs +2 -5
- package/lib/utils/addonText.mjs.map +1 -1
- package/lib/utils/addonTextChildren.js +15 -21
- package/lib/utils/addonTextChildren.js.map +1 -1
- package/lib/utils/addonTextChildren.mjs +7 -13
- package/lib/utils/addonTextChildren.mjs.map +1 -1
- package/lib/utils/ariaProps.js +7 -5
- package/lib/utils/ariaProps.js.map +1 -1
- package/lib/utils/ariaProps.mjs +7 -5
- package/lib/utils/ariaProps.mjs.map +1 -1
- package/lib/utils/assignProps.js +33 -37
- package/lib/utils/assignProps.js.map +1 -1
- package/lib/utils/assignProps.mjs +32 -36
- package/lib/utils/assignProps.mjs.map +1 -1
- package/lib/utils/canUseDOM.js +1 -1
- package/lib/utils/capitalizeFirstLetter.js +1 -1
- package/lib/utils/color.js +72 -95
- package/lib/utils/color.js.map +1 -1
- package/lib/utils/color.mjs +71 -94
- package/lib/utils/color.mjs.map +1 -1
- package/lib/utils/compose.js +3 -12
- package/lib/utils/compose.js.map +1 -1
- package/lib/utils/compose.mjs +2 -11
- package/lib/utils/compose.mjs.map +1 -1
- package/lib/utils/createUUID.js +5 -5
- package/lib/utils/createUUID.js.map +1 -1
- package/lib/utils/createUUID.mjs +4 -4
- package/lib/utils/createUUID.mjs.map +1 -1
- package/lib/utils/cssToIntDefault.js +3 -4
- package/lib/utils/cssToIntDefault.js.map +1 -1
- package/lib/utils/cssToIntDefault.mjs +2 -3
- package/lib/utils/cssToIntDefault.mjs.map +1 -1
- package/lib/utils/enhances/WithCSS.js +10 -8
- package/lib/utils/enhances/WithCSS.js.map +1 -1
- package/lib/utils/enhances/WithCSS.mjs +7 -6
- package/lib/utils/enhances/WithCSS.mjs.map +1 -1
- package/lib/utils/enhances/WithI18n.js +19 -19
- package/lib/utils/enhances/WithI18n.js.map +1 -1
- package/lib/utils/enhances/WithI18n.mjs +15 -17
- package/lib/utils/enhances/WithI18n.mjs.map +1 -1
- package/lib/utils/enhances/a11yEnhance.js +34 -39
- package/lib/utils/enhances/a11yEnhance.js.map +1 -1
- package/lib/utils/enhances/a11yEnhance.mjs +32 -36
- package/lib/utils/enhances/a11yEnhance.mjs.map +1 -1
- package/lib/utils/enhances/animatedSizeEnhance.js +55 -63
- package/lib/utils/enhances/animatedSizeEnhance.js.map +1 -1
- package/lib/utils/enhances/animatedSizeEnhance.mjs +50 -58
- package/lib/utils/enhances/animatedSizeEnhance.mjs.map +1 -1
- package/lib/utils/enhances/contextEnhance.js +12 -11
- package/lib/utils/enhances/contextEnhance.js.map +1 -1
- package/lib/utils/enhances/contextEnhance.mjs +9 -8
- package/lib/utils/enhances/contextEnhance.mjs.map +1 -1
- package/lib/utils/enhances/i18nEnhance.js +51 -67
- package/lib/utils/enhances/i18nEnhance.js.map +1 -1
- package/lib/utils/enhances/i18nEnhance.mjs +47 -61
- package/lib/utils/enhances/i18nEnhance.mjs.map +1 -1
- package/lib/utils/enhances/resolveColorEnhance.js +12 -10
- package/lib/utils/enhances/resolveColorEnhance.js.map +1 -1
- package/lib/utils/enhances/resolveColorEnhance.mjs +8 -6
- package/lib/utils/enhances/resolveColorEnhance.mjs.map +1 -1
- package/lib/utils/eventEmitter.js +30 -57
- package/lib/utils/eventEmitter.js.map +1 -1
- package/lib/utils/eventEmitter.mjs +26 -55
- package/lib/utils/eventEmitter.mjs.map +1 -1
- package/lib/utils/findComponent.js +35 -42
- package/lib/utils/findComponent.js.map +1 -1
- package/lib/utils/findComponent.mjs +26 -33
- package/lib/utils/findComponent.mjs.map +1 -1
- package/lib/utils/fire.js +7 -13
- package/lib/utils/fire.js.map +1 -1
- package/lib/utils/fire.mjs +5 -11
- package/lib/utils/fire.mjs.map +1 -1
- package/lib/utils/focus-lock/focusBorders.js +28 -32
- package/lib/utils/focus-lock/focusBorders.js.map +1 -1
- package/lib/utils/focus-lock/focusBorders.mjs +26 -32
- package/lib/utils/focus-lock/focusBorders.mjs.map +1 -1
- package/lib/utils/focus-lock/getFocusableIn.js +4 -6
- package/lib/utils/focus-lock/getFocusableIn.js.map +1 -1
- package/lib/utils/focus-lock/getFocusableIn.mjs +3 -6
- package/lib/utils/focus-lock/getFocusableIn.mjs.map +1 -1
- package/lib/utils/focus-lock/isFocusInside.js +5 -6
- package/lib/utils/focus-lock/isFocusInside.js.map +1 -1
- package/lib/utils/focus-lock/isFocusInside.mjs +4 -6
- package/lib/utils/focus-lock/isFocusInside.mjs.map +1 -1
- package/lib/utils/focus-lock/isFocusable.js +9 -12
- package/lib/utils/focus-lock/isFocusable.js.map +1 -1
- package/lib/utils/focus-lock/isFocusable.mjs +8 -11
- package/lib/utils/focus-lock/isFocusable.mjs.map +1 -1
- package/lib/utils/focus-lock/setFocus.js +21 -27
- package/lib/utils/focus-lock/setFocus.js.map +1 -1
- package/lib/utils/focus-lock/setFocus.mjs +19 -25
- package/lib/utils/focus-lock/setFocus.mjs.map +1 -1
- package/lib/utils/getAccessibleName.js +10 -22
- package/lib/utils/getAccessibleName.js.map +1 -1
- package/lib/utils/getAccessibleName.mjs +10 -21
- package/lib/utils/getAccessibleName.mjs.map +1 -1
- package/lib/utils/getDisplayName.js +1 -1
- package/lib/utils/getEventTarget.js +13 -32
- package/lib/utils/getEventTarget.js.map +1 -1
- package/lib/utils/getEventTarget.mjs +12 -31
- package/lib/utils/getEventTarget.mjs.map +1 -1
- package/lib/utils/getOriginChildren.js +4 -4
- package/lib/utils/getOriginChildren.js.map +1 -1
- package/lib/utils/getRandomInt.js +1 -1
- package/lib/utils/getValue.js +4 -6
- package/lib/utils/getValue.js.map +1 -1
- package/lib/utils/getValue.mjs +3 -5
- package/lib/utils/getValue.mjs.map +1 -1
- package/lib/utils/hasLabels.js +16 -27
- package/lib/utils/hasLabels.js.map +1 -1
- package/lib/utils/hasLabels.mjs +14 -24
- package/lib/utils/hasLabels.mjs.map +1 -1
- package/lib/utils/hasParent.js +3 -2
- package/lib/utils/hasParent.js.map +1 -1
- package/lib/utils/hasParent.mjs +2 -3
- package/lib/utils/hasParent.mjs.map +1 -1
- package/lib/utils/ifChildren.js +6 -4
- package/lib/utils/ifChildren.js.map +1 -1
- package/lib/utils/ifChildren.mjs +4 -2
- package/lib/utils/ifChildren.mjs.map +1 -1
- package/lib/utils/indentStyles.js +5 -10
- package/lib/utils/indentStyles.js.map +1 -1
- package/lib/utils/indentStyles.mjs +5 -9
- package/lib/utils/indentStyles.mjs.map +1 -1
- package/lib/utils/injectStyle.js +11 -13
- package/lib/utils/injectStyle.js.map +1 -1
- package/lib/utils/injectStyle.mjs +9 -10
- package/lib/utils/injectStyle.mjs.map +1 -1
- package/lib/utils/inputProps.js +5 -5
- package/lib/utils/inputProps.js.map +1 -1
- package/lib/utils/inputProps.mjs +4 -4
- package/lib/utils/inputProps.mjs.map +1 -1
- package/lib/utils/isInteractiveElement.js +7 -9
- package/lib/utils/isInteractiveElement.js.map +1 -1
- package/lib/utils/isInteractiveElement.mjs +7 -9
- package/lib/utils/isInteractiveElement.mjs.map +1 -1
- package/lib/utils/isNode.js +4 -5
- package/lib/utils/isNode.js.map +1 -1
- package/lib/utils/isNode.mjs +1 -2
- package/lib/utils/isNode.mjs.map +1 -1
- package/lib/utils/isPromise.js +1 -1
- package/lib/utils/isRetina.js +7 -2
- package/lib/utils/isRetina.js.map +1 -1
- package/lib/utils/isRetina.mjs +6 -1
- package/lib/utils/isRetina.mjs.map +1 -1
- package/lib/utils/logger.js +18 -25
- package/lib/utils/logger.js.map +1 -1
- package/lib/utils/logger.mjs +13 -21
- package/lib/utils/logger.mjs.map +1 -1
- package/lib/utils/numericChecker.js +11 -18
- package/lib/utils/numericChecker.js.map +1 -1
- package/lib/utils/numericChecker.mjs +10 -17
- package/lib/utils/numericChecker.mjs.map +1 -1
- package/lib/utils/ownerDocument.js +2 -2
- package/lib/utils/ownerDocument.js.map +1 -1
- package/lib/utils/ownerDocument.mjs +1 -1
- package/lib/utils/ownerDocument.mjs.map +1 -1
- package/lib/utils/pick.js +5 -5
- package/lib/utils/pick.js.map +1 -1
- package/lib/utils/pick.mjs +4 -4
- package/lib/utils/pick.mjs.map +1 -1
- package/lib/utils/propsForElement.js +10 -12
- package/lib/utils/propsForElement.js.map +1 -1
- package/lib/utils/propsForElement.mjs +8 -10
- package/lib/utils/propsForElement.mjs.map +1 -1
- package/lib/utils/rafTrottle.js +9 -14
- package/lib/utils/rafTrottle.js.map +1 -1
- package/lib/utils/rafTrottle.mjs +7 -12
- package/lib/utils/rafTrottle.mjs.map +1 -1
- package/lib/utils/reactToText.js +5 -8
- package/lib/utils/reactToText.js.map +1 -1
- package/lib/utils/reactToText.mjs +3 -6
- package/lib/utils/reactToText.mjs.map +1 -1
- package/lib/utils/ref.js +29 -47
- package/lib/utils/ref.js.map +1 -1
- package/lib/utils/ref.mjs +27 -43
- package/lib/utils/ref.mjs.map +1 -1
- package/lib/utils/setRef.js +2 -2
- package/lib/utils/setRef.js.map +1 -1
- package/lib/utils/syncScroll.js +24 -24
- package/lib/utils/syncScroll.js.map +1 -1
- package/lib/utils/syncScroll.mjs +21 -21
- package/lib/utils/syncScroll.mjs.map +1 -1
- package/lib/utils/uncontroll.js +8 -18
- package/lib/utils/uncontroll.js.map +1 -1
- package/lib/utils/uncontroll.mjs +8 -17
- package/lib/utils/uncontroll.mjs.map +1 -1
- package/lib/utils/uniqueID.js +22 -27
- package/lib/utils/uniqueID.js.map +1 -1
- package/lib/utils/uniqueID.mjs +18 -25
- package/lib/utils/uniqueID.mjs.map +1 -1
- package/lib/utils/use/useColorResolver.js +20 -21
- package/lib/utils/use/useColorResolver.js.map +1 -1
- package/lib/utils/use/useColorResolver.mjs +16 -18
- package/lib/utils/use/useColorResolver.mjs.map +1 -1
- package/lib/utils/use/useEnhancedEffect.js +4 -4
- package/lib/utils/use/useEnhancedEffect.js.map +1 -1
- package/lib/utils/use/useEnhancedEffect.mjs +1 -1
- package/lib/utils/use/useEnhancedEffect.mjs.map +1 -1
- package/lib/utils/use/useEventCallback.js +5 -10
- package/lib/utils/use/useEventCallback.js.map +1 -1
- package/lib/utils/use/useEventCallback.mjs +3 -8
- package/lib/utils/use/useEventCallback.mjs.map +1 -1
- package/lib/utils/use/useEventListener.js +11 -15
- package/lib/utils/use/useEventListener.js.map +1 -1
- package/lib/utils/use/useEventListener.mjs +7 -11
- package/lib/utils/use/useEventListener.mjs.map +1 -1
- package/lib/utils/use/useFocusLock.js +80 -94
- package/lib/utils/use/useFocusLock.js.map +1 -1
- package/lib/utils/use/useFocusLock.mjs +71 -88
- package/lib/utils/use/useFocusLock.mjs.map +1 -1
- package/lib/utils/use/usePreventScroll.js +24 -26
- package/lib/utils/use/usePreventScroll.js.map +1 -1
- package/lib/utils/use/usePreventScroll.mjs +19 -21
- package/lib/utils/use/usePreventScroll.mjs.map +1 -1
- package/lib/utils/use/useScrollBarWidth.js +8 -14
- package/lib/utils/use/useScrollBarWidth.js.map +1 -1
- package/lib/utils/use/useScrollBarWidth.mjs +8 -13
- package/lib/utils/use/useScrollBarWidth.mjs.map +1 -1
- package/lib/utils/useCssVariable.js +32 -37
- package/lib/utils/useCssVariable.js.map +1 -1
- package/lib/utils/useCssVariable.mjs +27 -34
- package/lib/utils/useCssVariable.mjs.map +1 -1
- package/lib/utils/zIndexStacking.js +28 -24
- package/lib/utils/zIndexStacking.js.map +1 -1
- package/lib/utils/zIndexStacking.mjs +23 -22
- package/lib/utils/zIndexStacking.mjs.map +1 -1
- package/package.json +316 -13
- package/tsconfig-utils.json +4 -0
- package/vite.config.ts +22 -0
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
function Enhancement() {
|
|
2
2
|
return {
|
|
3
|
-
condition: function
|
|
4
|
-
|
|
5
|
-
return Boolean((_Component$enhance = Component.enhance) === null || _Component$enhance === void 0 ? void 0 : _Component$enhance.length);
|
|
3
|
+
condition: function(Component) {
|
|
4
|
+
return Boolean(Component.enhance?.length);
|
|
6
5
|
},
|
|
7
|
-
wrapperProps: function
|
|
8
|
-
return WrapperComponent.enhance.reduce(
|
|
9
|
-
return enhance(acc);
|
|
10
|
-
}, props);
|
|
6
|
+
wrapperProps: function(props, WrapperComponent) {
|
|
7
|
+
return WrapperComponent.enhance.reduce((acc, enhance) => enhance(acc), props);
|
|
11
8
|
}
|
|
12
9
|
};
|
|
13
10
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function Enhancement() {
|
|
2
|
-
|
|
2
|
+
let defaultProps = {};
|
|
3
3
|
return {
|
|
4
|
-
condition: function
|
|
4
|
+
condition: function(Component) {
|
|
5
5
|
if (!Component.defaultProps) {
|
|
6
6
|
return false;
|
|
7
7
|
}
|
|
@@ -10,13 +10,13 @@ function Enhancement() {
|
|
|
10
10
|
}
|
|
11
11
|
return Boolean(Object.keys(Component.defaultProps).length);
|
|
12
12
|
},
|
|
13
|
-
|
|
13
|
+
static: function(WrapperComponent) {
|
|
14
14
|
defaultProps = WrapperComponent.defaultProps;
|
|
15
15
|
return {
|
|
16
16
|
defaultProps: {}
|
|
17
17
|
};
|
|
18
18
|
},
|
|
19
|
-
wrapperProps: function
|
|
19
|
+
wrapperProps: function(props) {
|
|
20
20
|
if (typeof defaultProps === "function") {
|
|
21
21
|
return Object.assign({}, defaultProps(props), props);
|
|
22
22
|
}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
1
|
import React from "react";
|
|
4
2
|
import { Context } from "../utils/enhances/WithI18n.mjs";
|
|
5
|
-
var _excluded = ["locale"];
|
|
6
3
|
function i18nAppLocaleEnhance() {
|
|
7
4
|
return {
|
|
8
|
-
wrapperProps:
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
wrapperProps: (props) => {
|
|
6
|
+
const {
|
|
7
|
+
locale,
|
|
8
|
+
...other
|
|
9
|
+
} = props;
|
|
10
|
+
const contextLocale = React.useContext(Context);
|
|
11
11
|
if (!locale && !contextLocale) return props;
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
return {
|
|
13
|
+
...other,
|
|
14
|
+
locale: locale ?? contextLocale
|
|
15
|
+
};
|
|
15
16
|
}
|
|
16
17
|
};
|
|
17
18
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
1
|
import { INHERITED_NAME } from "../core-types/symbols.mjs";
|
|
4
2
|
function Enhancement() {
|
|
5
3
|
return {
|
|
6
|
-
condition: function
|
|
4
|
+
condition: function(Component) {
|
|
7
5
|
return Boolean(Component.displayName);
|
|
8
6
|
},
|
|
9
|
-
|
|
10
|
-
return
|
|
7
|
+
static: function(WrapperComponent) {
|
|
8
|
+
return {
|
|
9
|
+
[INHERITED_NAME]: [.../* @__PURE__ */ new Set([...WrapperComponent[INHERITED_NAME] || [], WrapperComponent.displayName])]
|
|
10
|
+
};
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
13
|
}
|
|
@@ -1,58 +1,51 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
1
|
import React from "react";
|
|
5
2
|
import assignProps from "../utils/assignProps.mjs";
|
|
6
3
|
import logger from "../utils/logger.mjs";
|
|
7
4
|
import pick from "../utils/pick.mjs";
|
|
8
5
|
function assign(target, source) {
|
|
9
|
-
return Object.defineProperties(target, Object.keys(source).reduce(
|
|
6
|
+
return Object.defineProperties(target, Object.keys(source).reduce((descriptors, key) => {
|
|
10
7
|
descriptors[key] = Object.getOwnPropertyDescriptor(source, key);
|
|
11
8
|
return descriptors;
|
|
12
9
|
}, {}));
|
|
13
10
|
}
|
|
14
11
|
function getterMethodName(name) {
|
|
15
|
-
return
|
|
12
|
+
return `get${name}Props`;
|
|
16
13
|
}
|
|
17
|
-
function getterMethodNameByDisplayName() {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var name = displayNames.slice(-(displayNames.length - 1)).join("");
|
|
14
|
+
function getterMethodNameByDisplayName(displayName = "") {
|
|
15
|
+
const displayNames = displayName.split(".");
|
|
16
|
+
const name = displayNames.slice(-(displayNames.length - 1)).join("");
|
|
21
17
|
return getterMethodName(name);
|
|
22
18
|
}
|
|
23
19
|
function flatGetterMethodNames(childComponents, parentName) {
|
|
24
|
-
return Object.entries(childComponents).reduce(
|
|
25
|
-
var _ref2 = _slicedToArray(_ref, 2), name = _ref2[0], value = _ref2[1];
|
|
20
|
+
return Object.entries(childComponents).reduce((acc, [name, value]) => {
|
|
26
21
|
if (Array.isArray(value)) {
|
|
27
|
-
acc.push
|
|
22
|
+
acc.push(...flatGetterMethodNames(value[1], name));
|
|
28
23
|
}
|
|
29
|
-
name = parentName ?
|
|
24
|
+
name = parentName ? `${parentName}${name}` : name;
|
|
30
25
|
acc.push(getterMethodName(name));
|
|
31
26
|
return acc;
|
|
32
27
|
}, []);
|
|
33
28
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
const STATIC_COMPONENT = /* @__PURE__ */ Symbol("STATIC_COMPONENT");
|
|
30
|
+
const ROOT_COMPONENT = /* @__PURE__ */ Symbol("ROOT_COMPONENT");
|
|
31
|
+
const SELF_GETTER_METHOD = /* @__PURE__ */ Symbol("SELF_GETTER_METHOD");
|
|
37
32
|
function Enhancement(childComponents, createComponent, options) {
|
|
38
|
-
|
|
33
|
+
const getterMethodNames = flatGetterMethodNames(childComponents);
|
|
39
34
|
return {
|
|
40
|
-
condition: function
|
|
35
|
+
condition: function(Component) {
|
|
41
36
|
return Boolean(Component[STATIC_COMPONENT] || Object.keys(childComponents).length);
|
|
42
37
|
},
|
|
43
|
-
init: function
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
logger.warn(true, "Getter `".concat(selfGetterMethod, "` can't be fired as it is a getter of static component"), props["data-ui-name"] || WrapperComponent.displayName);
|
|
38
|
+
init: function(props, WrapperComponent) {
|
|
39
|
+
const getterMethods = pick(this, getterMethodNames);
|
|
40
|
+
this[SELF_GETTER_METHOD] = () => {
|
|
41
|
+
const selfGetterMethod = getterMethodNameByDisplayName(WrapperComponent.displayName);
|
|
42
|
+
logger.warn(true, `Getter \`${selfGetterMethod}\` can't be fired as it is a getter of static component`, props["data-ui-name"] || WrapperComponent.displayName);
|
|
49
43
|
};
|
|
50
|
-
assign(this, getterMethodNames.reduce(
|
|
51
|
-
|
|
44
|
+
assign(this, getterMethodNames.reduce((acc, name) => {
|
|
45
|
+
const getterMethod = getterMethods[name];
|
|
52
46
|
if (!getterMethod) return acc;
|
|
53
|
-
acc[name] =
|
|
54
|
-
|
|
55
|
-
var getterProps = getterMethod.call(_this, childrenProps, acc[name].index);
|
|
47
|
+
acc[name] = (childrenProps = {}) => {
|
|
48
|
+
const getterProps = getterMethod.call(this, childrenProps, acc[name].index);
|
|
56
49
|
return assignProps(childrenProps, getterProps);
|
|
57
50
|
};
|
|
58
51
|
acc[name].index = -1;
|
|
@@ -60,20 +53,19 @@ function Enhancement(childComponents, createComponent, options) {
|
|
|
60
53
|
return acc;
|
|
61
54
|
}, {}));
|
|
62
55
|
},
|
|
63
|
-
|
|
56
|
+
static: function(WrapperComponent, Component) {
|
|
64
57
|
if (Object.keys(childComponents).length && !WrapperComponent.displayName) {
|
|
65
58
|
throw new Error('"displayName" is not defined');
|
|
66
59
|
}
|
|
67
|
-
return Object.entries(childComponents).reduce(
|
|
68
|
-
|
|
69
|
-
var childComponents2 = {};
|
|
60
|
+
return Object.entries(childComponents).reduce((acc, [name, value]) => {
|
|
61
|
+
let childComponents2 = {};
|
|
70
62
|
if (Array.isArray(value)) {
|
|
71
63
|
childComponents2 = value[1];
|
|
72
64
|
value = value[0];
|
|
73
65
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
value.displayName =
|
|
66
|
+
const prevStaticComponent = value[STATIC_COMPONENT];
|
|
67
|
+
const prevDisplayName = value.displayName;
|
|
68
|
+
value.displayName = `${WrapperComponent.displayName}.${name}`;
|
|
77
69
|
value[STATIC_COMPONENT] = true;
|
|
78
70
|
value[ROOT_COMPONENT] = Component[ROOT_COMPONENT] || Component;
|
|
79
71
|
acc[name] = createComponent(value, childComponents2, options);
|
|
@@ -82,13 +74,17 @@ function Enhancement(childComponents, createComponent, options) {
|
|
|
82
74
|
return acc;
|
|
83
75
|
}, {});
|
|
84
76
|
},
|
|
85
|
-
context: function
|
|
86
|
-
return
|
|
77
|
+
context: function(context) {
|
|
78
|
+
return {
|
|
79
|
+
...context,
|
|
80
|
+
// [getterMethod]: this[SELF_GETTER_METHOD],
|
|
81
|
+
...pick(this, getterMethodNames)
|
|
82
|
+
};
|
|
87
83
|
},
|
|
88
|
-
wrapperProps: function
|
|
84
|
+
wrapperProps: function(props, WrapperComponent) {
|
|
89
85
|
if (!WrapperComponent[STATIC_COMPONENT]) return props;
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
const context = React.useContext(options.context);
|
|
87
|
+
const getterMethod = context[getterMethodNameByDisplayName(WrapperComponent.displayName)];
|
|
92
88
|
if (getterMethod) {
|
|
93
89
|
if (!getterMethod.cache.has(this)) {
|
|
94
90
|
getterMethod.cache.add(this);
|
|
@@ -100,14 +96,13 @@ function Enhancement(childComponents, createComponent, options) {
|
|
|
100
96
|
}
|
|
101
97
|
return props;
|
|
102
98
|
},
|
|
103
|
-
render: function
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
_this2[name].cache.clear();
|
|
99
|
+
render: function(render) {
|
|
100
|
+
getterMethodNames.forEach((name) => {
|
|
101
|
+
if (this[name] === void 0) return;
|
|
102
|
+
this[name].index = -1;
|
|
103
|
+
this[name].cache.clear();
|
|
109
104
|
});
|
|
110
|
-
return
|
|
105
|
+
return render;
|
|
111
106
|
}
|
|
112
107
|
};
|
|
113
108
|
}
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
1
|
import React from "react";
|
|
5
2
|
import { STATIC_COMPONENT } from "./staticChildren.mjs";
|
|
6
3
|
import "../styled/index.mjs";
|
|
7
4
|
import { sstyled } from "../styled/sstyled.mjs";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var STYLES_SELF = /* @__PURE__ */ Symbol("STYLES_SELF");
|
|
5
|
+
const STYLES_CONTEXT = /* @__PURE__ */ Symbol("STYLES_CONTEXT");
|
|
6
|
+
const STYLES_SELF = /* @__PURE__ */ Symbol("STYLES_SELF");
|
|
11
7
|
function Enhancement(childComponents, Context) {
|
|
12
8
|
return {
|
|
13
|
-
condition: function
|
|
9
|
+
condition: function(Component) {
|
|
14
10
|
return Boolean(Component.style || Component[STATIC_COMPONENT]);
|
|
15
11
|
},
|
|
16
|
-
init: function
|
|
12
|
+
init: function(props, WrapperComponent) {
|
|
17
13
|
if (props.styles) {
|
|
18
14
|
this[STYLES_SELF] = props.styles;
|
|
19
15
|
}
|
|
@@ -21,25 +17,35 @@ function Enhancement(childComponents, Context) {
|
|
|
21
17
|
this[STYLES_SELF] = sstyled.merge(WrapperComponent.style, props._styles);
|
|
22
18
|
}
|
|
23
19
|
},
|
|
24
|
-
context: function
|
|
20
|
+
context: function(context) {
|
|
25
21
|
if (!this[STYLES_SELF] || !Object.keys(childComponents).length) {
|
|
26
|
-
return
|
|
22
|
+
return context;
|
|
27
23
|
}
|
|
28
|
-
return
|
|
24
|
+
return {
|
|
25
|
+
...context,
|
|
26
|
+
[STYLES_CONTEXT]: this[STYLES_SELF]
|
|
27
|
+
};
|
|
29
28
|
},
|
|
30
|
-
asProps: function
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
asProps: function({
|
|
30
|
+
_styles,
|
|
31
|
+
styles,
|
|
32
|
+
...props
|
|
33
|
+
}) {
|
|
34
|
+
return {
|
|
35
|
+
...props,
|
|
33
36
|
styles: this[STYLES_SELF]
|
|
34
|
-
}
|
|
37
|
+
};
|
|
35
38
|
},
|
|
36
|
-
wrapperProps: function
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
wrapperProps: function({
|
|
40
|
+
styles,
|
|
41
|
+
...props
|
|
42
|
+
}) {
|
|
43
|
+
const context = React.useContext(Context);
|
|
44
|
+
return {
|
|
45
|
+
...props,
|
|
40
46
|
_styles: styles,
|
|
41
47
|
styles: context[STYLES_CONTEXT]
|
|
42
|
-
}
|
|
48
|
+
};
|
|
43
49
|
}
|
|
44
50
|
};
|
|
45
51
|
}
|
|
@@ -1,26 +1,18 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
-
import _arrayLikeToArray from "@babel/runtime/helpers/esm/arrayLikeToArray";
|
|
4
|
-
import _toArray from "@babel/runtime/helpers/esm/toArray";
|
|
5
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
6
|
-
import _toPropertyKey from "@babel/runtime/helpers/esm/toPropertyKey";
|
|
7
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
8
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
1
|
import { callAllEventHandlers } from "../utils/assignProps.mjs";
|
|
10
2
|
import capitalizeFirstLetter from "../utils/capitalizeFirstLetter.mjs";
|
|
11
3
|
function assign(target, source) {
|
|
12
|
-
return Object.defineProperties(target, Object.keys(source).reduce(
|
|
4
|
+
return Object.defineProperties(target, Object.keys(source).reduce((descriptors, key) => {
|
|
13
5
|
descriptors[key] = Object.getOwnPropertyDescriptor(source, key);
|
|
14
6
|
return descriptors;
|
|
15
7
|
}, {}));
|
|
16
8
|
}
|
|
17
9
|
function defaultProp(prop) {
|
|
18
|
-
return
|
|
10
|
+
return `default${capitalizeFirstLetter(prop)}`;
|
|
19
11
|
}
|
|
20
12
|
function handlerProp(prop) {
|
|
21
13
|
if (prop === "value") prop = "";
|
|
22
14
|
if (prop === "checked") prop = "";
|
|
23
|
-
return
|
|
15
|
+
return `on${capitalizeFirstLetter(prop)}Change`;
|
|
24
16
|
}
|
|
25
17
|
function isControlled(propValue) {
|
|
26
18
|
return propValue !== void 0;
|
|
@@ -29,48 +21,46 @@ function uncontrolledProp(self, propName, propValue, propDefaultValue, propHandl
|
|
|
29
21
|
function getValue() {
|
|
30
22
|
return isControlled(propValue) ? propValue : propName in self.state ? self.state[propName] : propDefaultValue;
|
|
31
23
|
}
|
|
32
|
-
return [getValue(),
|
|
33
|
-
|
|
24
|
+
return [getValue(), (value, ...args) => {
|
|
25
|
+
const oldValue = getValue();
|
|
34
26
|
if (oldValue === value) return false;
|
|
35
|
-
if (!isControlled(propValue)) self.setState(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return callAllEventHandlers.apply(void 0, [propHandler].concat(_toConsumableArray(chainHandler))).apply(void 0, [value].concat(args));
|
|
27
|
+
if (!isControlled(propValue)) self.setState({
|
|
28
|
+
[propName]: value
|
|
29
|
+
});
|
|
30
|
+
return callAllEventHandlers(propHandler, ...chainHandler)(value, ...args);
|
|
40
31
|
}];
|
|
41
32
|
}
|
|
42
33
|
function uncontrolledUniversal(props, config, uncontrolledProp2) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
34
|
+
const handlerProps = {};
|
|
35
|
+
const uncontrolledProps = Object.keys(config).reduce((result, propName) => {
|
|
36
|
+
const handlerName = handlerProp(propName);
|
|
37
|
+
const defaultPropName = defaultProp(propName);
|
|
38
|
+
const {
|
|
39
|
+
[defaultPropName]: propDefaultValue,
|
|
40
|
+
[propName]: propValue,
|
|
41
|
+
[handlerName]: propHandler,
|
|
42
|
+
...other
|
|
43
|
+
} = result;
|
|
48
44
|
if (propDefaultValue === void 0) {
|
|
49
45
|
console.warn(defaultPropName, 'must be installed in "defaultProps"');
|
|
50
46
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (Array.isArray(setter))
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
setter = _setter2[0];
|
|
57
|
-
chainHandler = _arrayLikeToArray(_setter2).slice(1);
|
|
58
|
-
}
|
|
59
|
-
setter = setter || function(v) {
|
|
60
|
-
return v;
|
|
61
|
-
};
|
|
62
|
-
var _uncontrolledProp = uncontrolledProp2(propName, propValue, propDefaultValue, propHandler, chainHandler), _uncontrolledProp2 = _slicedToArray(_uncontrolledProp, 2), value = _uncontrolledProp2[0], handler = _uncontrolledProp2[1];
|
|
47
|
+
let setter = config[propName];
|
|
48
|
+
let chainHandler = [];
|
|
49
|
+
if (Array.isArray(setter)) [setter, ...chainHandler] = setter;
|
|
50
|
+
setter = setter || ((v) => v);
|
|
51
|
+
const [value, handler] = uncontrolledProp2(propName, propValue, propDefaultValue, propHandler, chainHandler);
|
|
63
52
|
handlerProps[propName] = handler;
|
|
64
|
-
return
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
53
|
+
return {
|
|
54
|
+
...other,
|
|
55
|
+
[propName]: value,
|
|
56
|
+
[handlerName]: (eventOrValue, ...args) => {
|
|
57
|
+
const result2 = [setter(eventOrValue, ...args), ...args];
|
|
58
|
+
if (eventOrValue?.target) {
|
|
59
|
+
result2.push(eventOrValue);
|
|
60
|
+
}
|
|
61
|
+
return handler(...result2);
|
|
71
62
|
}
|
|
72
|
-
|
|
73
|
-
}));
|
|
63
|
+
};
|
|
74
64
|
}, props);
|
|
75
65
|
return [uncontrolledProps, handlerProps];
|
|
76
66
|
}
|
|
@@ -79,25 +69,26 @@ function uncontrolled(self, props, config) {
|
|
|
79
69
|
}
|
|
80
70
|
function Enhancement() {
|
|
81
71
|
return {
|
|
82
|
-
condition: function
|
|
72
|
+
condition: function(Component) {
|
|
83
73
|
return Boolean(Component.prototype.uncontrolledProps);
|
|
84
74
|
},
|
|
85
|
-
init: function
|
|
75
|
+
init: function() {
|
|
86
76
|
this.state = this.state || {};
|
|
87
77
|
assign(this, {
|
|
88
78
|
get handlers() {
|
|
89
|
-
|
|
79
|
+
const [, uncontrolledHandlers] = uncontrolled(this, this.props, this.uncontrolledProps());
|
|
90
80
|
return uncontrolledHandlers;
|
|
91
81
|
}
|
|
92
82
|
});
|
|
93
83
|
},
|
|
94
|
-
context: function
|
|
95
|
-
return
|
|
84
|
+
context: function(context) {
|
|
85
|
+
return {
|
|
86
|
+
...context,
|
|
96
87
|
handlers: this.handlers
|
|
97
|
-
}
|
|
88
|
+
};
|
|
98
89
|
},
|
|
99
|
-
asProps: function
|
|
100
|
-
|
|
90
|
+
asProps: function(props) {
|
|
91
|
+
const [uncontrolledProps] = uncontrolled(this, props, this.uncontrolledProps());
|
|
101
92
|
return uncontrolledProps;
|
|
102
93
|
}
|
|
103
94
|
};
|
package/lib/esm/register.mjs
CHANGED
|
@@ -1,28 +1,20 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
_classCallCheck(this, Register2);
|
|
2
|
+
class Register {
|
|
3
|
+
constructor() {
|
|
7
4
|
_defineProperty(this, "data", {});
|
|
8
5
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
value: function get(name, defaultValue) {
|
|
12
|
-
if (name in this.data) {
|
|
13
|
-
return this.data[name];
|
|
14
|
-
} else {
|
|
15
|
-
return this.set(name, defaultValue);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}, {
|
|
19
|
-
key: "set",
|
|
20
|
-
value: function set(name, value) {
|
|
21
|
-
this.data[name] = value;
|
|
6
|
+
get(name, defaultValue) {
|
|
7
|
+
if (name in this.data) {
|
|
22
8
|
return this.data[name];
|
|
9
|
+
} else {
|
|
10
|
+
return this.set(name, defaultValue);
|
|
23
11
|
}
|
|
24
|
-
}
|
|
25
|
-
|
|
12
|
+
}
|
|
13
|
+
set(name, value) {
|
|
14
|
+
this.data[name] = value;
|
|
15
|
+
return this.data[name];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
26
18
|
const register = new Register();
|
|
27
19
|
export {
|
|
28
20
|
Register,
|