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