@semcore/core 17.0.0-prerelease.20 → 17.0.0-prerelease.20-prerelease.20
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/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 +205 -143
- package/lib/coreFactory.js.map +1 -1
- package/lib/coreFactory.mjs +164 -118
- 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 -5
- 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 +164 -118
- 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 -5
- 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/processor.js +222 -150
- package/lib/theme/processor.js.map +1 -1
- package/lib/theme/processor.mjs +221 -148
- package/lib/theme/processor.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/theme/utils.js +215 -140
- package/lib/theme/utils.js.map +1 -1
- package/lib/theme/utils.mjs +214 -135
- package/lib/theme/utils.mjs.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/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 +21 -20
- package/lib/utils/use/useColorResolver.js.map +1 -1
- package/lib/utils/use/useColorResolver.mjs +18 -16
- 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 +28 -26
- package/lib/utils/use/usePreventScroll.js.map +1 -1
- package/lib/utils/use/usePreventScroll.mjs +23 -21
- 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 +1 -1
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
|
+
var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime/helpers/objectDestructuringEmpty"));
|
|
11
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
8
12
|
var _react = _interopRequireDefault(require("react"));
|
|
9
13
|
function contextEnhance(context, setOnProp) {
|
|
10
|
-
return props
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
const value = _react.default.useContext(context);
|
|
15
|
-
return {
|
|
16
|
-
...other,
|
|
17
|
-
[setOnProp]: value
|
|
18
|
-
};
|
|
14
|
+
return function (props) {
|
|
15
|
+
var other = (0, _extends2["default"])({}, ((0, _objectDestructuringEmpty2["default"])(props), props));
|
|
16
|
+
var value = _react["default"].useContext(context);
|
|
17
|
+
return (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, other), {}, (0, _defineProperty2["default"])({}, setOnProp, value));
|
|
19
18
|
};
|
|
20
19
|
}
|
|
21
|
-
var _default = exports
|
|
20
|
+
var _default = exports["default"] = contextEnhance;
|
|
22
21
|
//# sourceMappingURL=contextEnhance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contextEnhance.js","names":["_react","_interopRequireDefault","require","contextEnhance","context","setOnProp","props","other","value","React","useContext","
|
|
1
|
+
{"version":3,"file":"contextEnhance.js","names":["_react","_interopRequireDefault","require","contextEnhance","context","setOnProp","props","other","_extends2","_objectDestructuringEmpty2","value","React","useContext","_objectSpread3","_defineProperty2","_default","exports"],"sources":["../../../src/utils/enhances/contextEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nfunction contextEnhance(context: React.Context<any>, setOnProp: string) {\n return (props: any) => {\n const { ...other } = props;\n const value = React.useContext(context);\n return {\n ...other,\n [setOnProp]: value,\n };\n };\n}\n\nexport default contextEnhance;\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,SAASC,cAAcA,CAACC,OAA2B,EAAEC,SAAiB,EAAE;EACtE,OAAO,UAACC,KAAU,EAAK;IACrB,IAAWC,KAAK,OAAAC,SAAA,sBAAAC,0BAAA,aAAKH,KAAK,GAALA,KAAK;IAC1B,IAAMI,KAAK,GAAGC,iBAAK,CAACC,UAAU,CAACR,OAAO,CAAC;IACvC,WAAAS,cAAA,iBAAAA,cAAA,iBACKN,KAAK,WAAAO,gBAAA,iBACPT,SAAS,EAAGK,KAAK;EAEtB,CAAC;AACH;AAAC,IAAAK,QAAA,GAAAC,OAAA,cAEcb,cAAc","ignoreList":[]}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import _objectDestructuringEmpty from "@babel/runtime/helpers/esm/objectDestructuringEmpty";
|
|
4
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
5
|
import React from 'react';
|
|
2
6
|
function contextEnhance(context, setOnProp) {
|
|
3
|
-
return props
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
const value = React.useContext(context);
|
|
8
|
-
return {
|
|
9
|
-
...other,
|
|
10
|
-
[setOnProp]: value
|
|
11
|
-
};
|
|
7
|
+
return function (props) {
|
|
8
|
+
var other = _extends({}, (_objectDestructuringEmpty(props), props));
|
|
9
|
+
var value = React.useContext(context);
|
|
10
|
+
return _objectSpread(_objectSpread({}, other), {}, _defineProperty({}, setOnProp, value));
|
|
12
11
|
};
|
|
13
12
|
}
|
|
14
13
|
export default contextEnhance;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contextEnhance.mjs","names":["React","contextEnhance","context","setOnProp","props","other","value","useContext"],"sources":["../../../src/utils/enhances/contextEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nfunction contextEnhance(context: React.Context<any>, setOnProp: string) {\n return (props: any) => {\n const { ...other } = props;\n const value = React.useContext(context);\n return {\n ...other,\n [setOnProp]: value,\n };\n };\n}\n\nexport default contextEnhance;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,cAAcA,CAACC,OAA2B,EAAEC,SAAiB,EAAE;EACtE,
|
|
1
|
+
{"version":3,"file":"contextEnhance.mjs","names":["React","contextEnhance","context","setOnProp","props","other","_extends","_objectDestructuringEmpty","value","useContext","_objectSpread","_defineProperty"],"sources":["../../../src/utils/enhances/contextEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nfunction contextEnhance(context: React.Context<any>, setOnProp: string) {\n return (props: any) => {\n const { ...other } = props;\n const value = React.useContext(context);\n return {\n ...other,\n [setOnProp]: value,\n };\n };\n}\n\nexport default contextEnhance;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,cAAcA,CAACC,OAA2B,EAAEC,SAAiB,EAAE;EACtE,OAAO,UAACC,KAAU,EAAK;IACrB,IAAWC,KAAK,GAAAC,QAAA,MAAAC,yBAAA,CAAKH,KAAK,GAALA,KAAK;IAC1B,IAAMI,KAAK,GAAGR,KAAK,CAACS,UAAU,CAACP,OAAO,CAAC;IACvC,OAAAQ,aAAA,CAAAA,aAAA,KACKL,KAAK,OAAAM,eAAA,KACPR,SAAS,EAAGK,KAAK;EAEtB,CAAC;AACH;AAEA,eAAeP,cAAc","ignoreList":[]}
|
|
@@ -1,83 +1,99 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.useAsyncI18nMessages = exports
|
|
7
|
+
exports.useAsyncI18nMessages = exports["default"] = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
10
|
+
var _regenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/regenerator"));
|
|
11
|
+
var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
8
14
|
var _react = _interopRequireDefault(require("react"));
|
|
9
15
|
var _WithI18n = require("./WithI18n");
|
|
10
|
-
|
|
11
|
-
|
|
16
|
+
var useAsyncI18nMessages = exports.useAsyncI18nMessages = function useAsyncI18nMessages(primaryContainer, locale, fallbackContainer) {
|
|
17
|
+
var _store$locale;
|
|
18
|
+
var container = _react["default"].useMemo(function () {
|
|
12
19
|
if (!fallbackContainer) return primaryContainer;
|
|
13
20
|
if (!primaryContainer) return fallbackContainer;
|
|
14
21
|
if (primaryContainer === fallbackContainer) return primaryContainer;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (typeof primaryContainer[
|
|
18
|
-
container[
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
var container = {};
|
|
23
|
+
var _loop = function _loop(_locale) {
|
|
24
|
+
if (typeof primaryContainer[_locale] === 'function' || typeof fallbackContainer[_locale] === 'function') {
|
|
25
|
+
container[_locale] = /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/(0, _regenerator2["default"])().m(function _callee() {
|
|
26
|
+
var _yield$Promise$all, _yield$Promise$all2, primary, fallback;
|
|
27
|
+
return (0, _regenerator2["default"])().w(function (_context) {
|
|
28
|
+
while (1) switch (_context.n) {
|
|
29
|
+
case 0:
|
|
30
|
+
_context.n = 1;
|
|
31
|
+
return Promise.all([primaryContainer[_locale], fallbackContainer[_locale]]);
|
|
32
|
+
case 1:
|
|
33
|
+
_yield$Promise$all = _context.v;
|
|
34
|
+
_yield$Promise$all2 = (0, _slicedToArray2["default"])(_yield$Promise$all, 2);
|
|
35
|
+
primary = _yield$Promise$all2[0];
|
|
36
|
+
fallback = _yield$Promise$all2[1];
|
|
37
|
+
return _context.a(2, (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, primary), fallback));
|
|
38
|
+
}
|
|
39
|
+
}, _callee);
|
|
40
|
+
}));
|
|
25
41
|
} else {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
...(fallbackContainer[locale] ?? {})
|
|
29
|
-
};
|
|
42
|
+
var _primaryContainer$_lo, _fallbackContainer$_l;
|
|
43
|
+
container[_locale] = (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, (_primaryContainer$_lo = primaryContainer[_locale]) !== null && _primaryContainer$_lo !== void 0 ? _primaryContainer$_lo : {}), (_fallbackContainer$_l = fallbackContainer[_locale]) !== null && _fallbackContainer$_l !== void 0 ? _fallbackContainer$_l : {});
|
|
30
44
|
}
|
|
45
|
+
};
|
|
46
|
+
for (var _locale in primaryContainer) {
|
|
47
|
+
_loop(_locale);
|
|
31
48
|
}
|
|
32
49
|
return container;
|
|
33
50
|
}, [primaryContainer, fallbackContainer]);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
for (
|
|
37
|
-
if (
|
|
38
|
-
store[
|
|
51
|
+
var initStore = _react["default"].useMemo(function () {
|
|
52
|
+
var store = {};
|
|
53
|
+
for (var _locale2 in container) {
|
|
54
|
+
if ((0, _typeof2["default"])(container[_locale2]) === 'object') {
|
|
55
|
+
store[_locale2] = container[_locale2];
|
|
39
56
|
}
|
|
40
57
|
}
|
|
41
58
|
return store;
|
|
42
59
|
}, [container]);
|
|
43
|
-
|
|
44
|
-
|
|
60
|
+
var _React$useState = _react["default"].useState(initStore),
|
|
61
|
+
_React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
|
|
62
|
+
store = _React$useState2[0],
|
|
63
|
+
setStore = _React$useState2[1];
|
|
64
|
+
var lastLoadedLocaleRef = _react["default"].useRef(null);
|
|
45
65
|
if (store[locale]) lastLoadedLocaleRef.current = locale;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
66
|
+
var fallbackMessages = _react["default"].useMemo(function () {
|
|
67
|
+
return Object.values(store)[0];
|
|
68
|
+
}, [store]);
|
|
69
|
+
var loadingLocaleRef = _react["default"].useRef(null);
|
|
70
|
+
_react["default"].useEffect(function () {
|
|
49
71
|
loadingLocaleRef.current = locale;
|
|
50
|
-
|
|
72
|
+
var asyncMessages = container[locale];
|
|
51
73
|
if (typeof asyncMessages === 'function') {
|
|
52
|
-
asyncMessages().then(module
|
|
74
|
+
asyncMessages().then(function (module) {
|
|
53
75
|
if (loadingLocaleRef.current !== locale) return;
|
|
54
|
-
|
|
55
|
-
if ('default' in module &&
|
|
56
|
-
setStore(store
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}).catch(err => {
|
|
76
|
+
var messages = module;
|
|
77
|
+
if ('default' in module && (0, _typeof2["default"])(module["default"]) === 'object') messages = module["default"];
|
|
78
|
+
setStore(function (store) {
|
|
79
|
+
return (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, store), {}, (0, _defineProperty2["default"])({}, locale, messages));
|
|
80
|
+
});
|
|
81
|
+
})["catch"](function (err) {
|
|
61
82
|
// eslint-disable-next-line no-console
|
|
62
83
|
console.error(err);
|
|
63
84
|
});
|
|
64
85
|
}
|
|
65
86
|
}, [container, locale]);
|
|
66
|
-
return store[locale]
|
|
87
|
+
return (_store$locale = store[locale]) !== null && _store$locale !== void 0 ? _store$locale : fallbackMessages;
|
|
67
88
|
};
|
|
68
|
-
exports
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return {
|
|
77
|
-
...props,
|
|
78
|
-
getI18nText
|
|
79
|
-
};
|
|
89
|
+
var _default = exports["default"] = function _default(container) {
|
|
90
|
+
return function (props) {
|
|
91
|
+
var i18n = props.i18n,
|
|
92
|
+
locale = props.locale;
|
|
93
|
+
var getI18nText = (0, _WithI18n.useI18n)(i18n, locale, container);
|
|
94
|
+
return (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, props), {}, {
|
|
95
|
+
getI18nText: getI18nText
|
|
96
|
+
});
|
|
80
97
|
};
|
|
81
98
|
};
|
|
82
|
-
exports.default = _default;
|
|
83
99
|
//# sourceMappingURL=i18nEnhance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18nEnhance.js","names":["_react","_interopRequireDefault","require","_WithI18n","useAsyncI18nMessages","primaryContainer","locale","fallbackContainer","container","React","useMemo","primary","fallback","Promise","all","initStore","store","
|
|
1
|
+
{"version":3,"file":"i18nEnhance.js","names":["_react","_interopRequireDefault","require","_WithI18n","useAsyncI18nMessages","exports","primaryContainer","locale","fallbackContainer","_store$locale","container","React","useMemo","_loop","_locale","_asyncToGenerator2","_regenerator2","m","_callee","_yield$Promise$all","_yield$Promise$all2","primary","fallback","w","_context","n","Promise","all","v","_slicedToArray2","a","_objectSpread3","_primaryContainer$_lo","_fallbackContainer$_l","initStore","store","_typeof2","_React$useState","useState","_React$useState2","setStore","lastLoadedLocaleRef","useRef","current","fallbackMessages","Object","values","loadingLocaleRef","useEffect","asyncMessages","then","module","messages","_defineProperty2","err","console","error","_default","props","i18n","getI18nText","useI18n"],"sources":["../../../src/utils/enhances/i18nEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nimport { type LocaleKeys, useI18n } from './WithI18n';\n\nexport type WithI18nEnhanceProps = {\n /* Function for getting the required field from the translation dictionary */\n getI18nText?: (key?: string, variables?: {}) => any;\n /* Object with translations */\n i18n?: {\n [locale: string]: {\n [key: string]: string;\n };\n };\n /* Locale for translations */\n locale?: LocaleKeys;\n};\n\ntype Messages = { [messageId: string]: string };\ntype MessagesContainer = { [locale: string]: Messages | (() => Promise<Messages>) };\ntype MessagesStore = { [locale: string]: Messages };\nexport const useAsyncI18nMessages = (\n primaryContainer: MessagesContainer,\n locale: string,\n fallbackContainer?: MessagesContainer,\n) => {\n const container = React.useMemo(() => {\n if (!fallbackContainer) return primaryContainer;\n if (!primaryContainer) return fallbackContainer;\n if (primaryContainer === fallbackContainer) return primaryContainer;\n const container: MessagesContainer = {};\n for (const locale in primaryContainer) {\n if (\n typeof primaryContainer[locale] === 'function' ||\n typeof fallbackContainer[locale] === 'function'\n ) {\n container[locale] = async () => {\n const [primary, fallback] = await Promise.all([\n primaryContainer[locale],\n fallbackContainer[locale],\n ]);\n return { ...primary, ...fallback };\n };\n } else {\n container[locale] = {\n ...(primaryContainer[locale] ?? {}),\n ...(fallbackContainer[locale] ?? {}),\n };\n }\n }\n return container;\n }, [primaryContainer, fallbackContainer]);\n const initStore = React.useMemo(() => {\n const store: MessagesStore = {};\n for (const locale in container) {\n if (typeof container[locale] === 'object') {\n store[locale] = container[locale] as Messages;\n }\n }\n return store;\n }, [container]);\n const [store, setStore] = React.useState(initStore);\n const lastLoadedLocaleRef = React.useRef<string | null>(null);\n if (store[locale]) lastLoadedLocaleRef.current = locale;\n const fallbackMessages = React.useMemo(() => Object.values(store)[0], [store]);\n\n const loadingLocaleRef = React.useRef<string | null>(null);\n React.useEffect(() => {\n loadingLocaleRef.current = locale;\n const asyncMessages = container[locale];\n if (typeof asyncMessages === 'function') {\n asyncMessages()\n .then((module) => {\n if (loadingLocaleRef.current !== locale) return;\n let messages = module;\n if ('default' in module && typeof module.default === 'object') messages = module.default;\n setStore((store) => ({\n ...store,\n [locale]: messages,\n }));\n })\n\n .catch((err) => {\n // eslint-disable-next-line no-console\n console.error(err);\n });\n }\n }, [container, locale]);\n\n return store[locale] ?? fallbackMessages;\n};\nexport default (container?: MessagesContainer) => {\n return (props: any): { getI18nText: ReturnType<typeof useI18n> } => {\n const { i18n, locale } = props;\n const getI18nText = useI18n(i18n, locale, container);\n\n return { ...props, getI18nText };\n };\n};\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAkBO,IAAME,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAG,SAAvBA,oBAAoBA,CAC/BE,gBAAmC,EACnCC,MAAc,EACdC,iBAAqC,EAClC;EAAA,IAAAC,aAAA;EACH,IAAMC,SAAS,GAAGC,iBAAK,CAACC,OAAO,CAAC,YAAM;IACpC,IAAI,CAACJ,iBAAiB,EAAE,OAAOF,gBAAgB;IAC/C,IAAI,CAACA,gBAAgB,EAAE,OAAOE,iBAAiB;IAC/C,IAAIF,gBAAgB,KAAKE,iBAAiB,EAAE,OAAOF,gBAAgB;IACnE,IAAMI,SAA4B,GAAG,CAAC,CAAC;IAAC,IAAAG,KAAA,YAAAA,MAAAC,OAAA,EACD;MACrC,IACE,OAAOR,gBAAgB,CAACC,OAAM,CAAC,KAAK,UAAU,IAC9C,OAAOC,iBAAiB,CAACD,OAAM,CAAC,KAAK,UAAU,EAC/C;QACAG,SAAS,CAACH,OAAM,CAAC,oBAAAQ,kBAAA,8BAAAC,aAAA,eAAAC,CAAA,CAAG,SAAAC,QAAA;UAAA,IAAAC,kBAAA,EAAAC,mBAAA,EAAAC,OAAA,EAAAC,QAAA;UAAA,WAAAN,aAAA,eAAAO,CAAA,WAAAC,QAAA;YAAA,kBAAAA,QAAA,CAAAC,CAAA;cAAA;gBAAAD,QAAA,CAAAC,CAAA;gBAAA,OACgBC,OAAO,CAACC,GAAG,CAAC,CAC5CrB,gBAAgB,CAACC,OAAM,CAAC,EACxBC,iBAAiB,CAACD,OAAM,CAAC,CAC1B,CAAC;cAAA;gBAAAY,kBAAA,GAAAK,QAAA,CAAAI,CAAA;gBAAAR,mBAA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,aAAA,cAAAA,aAAA,GAAImC,gBAAgB;AAC1C,CAAC;AAAC,IAAAa,QAAA,GAAApD,OAAA,cACa,SAAAoD,SAAC/C,SAA6B,EAAK;EAChD,OAAO,UAACgD,KAAU,EAAkD;IAClE,IAAQC,IAAI,GAAaD,KAAK,CAAtBC,IAAI;MAAEpD,MAAM,GAAKmD,KAAK,CAAhBnD,MAAM;IACpB,IAAMqD,WAAW,GAAG,IAAAC,iBAAO,EAACF,IAAI,EAAEpD,MAAM,EAAEG,SAAS,CAAC;IAEpD,WAAAqB,cAAA,iBAAAA,cAAA,iBAAY2B,KAAK;MAAEE,WAAW,EAAXA;IAAW;EAChC,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1,75 +1,89 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
3
|
+
import _regenerator from "@babel/runtime/helpers/esm/regenerator";
|
|
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";
|
|
1
7
|
import React from "react";
|
|
2
8
|
import { useI18n } from "./WithI18n.mjs";
|
|
3
|
-
|
|
4
|
-
|
|
9
|
+
var useAsyncI18nMessages = function useAsyncI18nMessages2(primaryContainer, locale, fallbackContainer) {
|
|
10
|
+
var _store$locale;
|
|
11
|
+
var container = React.useMemo(function() {
|
|
5
12
|
if (!fallbackContainer) return primaryContainer;
|
|
6
13
|
if (!primaryContainer) return fallbackContainer;
|
|
7
14
|
if (primaryContainer === fallbackContainer) return primaryContainer;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (typeof primaryContainer[
|
|
11
|
-
container2[
|
|
12
|
-
|
|
13
|
-
return {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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__ */ _regenerator().m(function _callee() {
|
|
19
|
+
var _yield$Promise$all, _yield$Promise$all2, primary, fallback;
|
|
20
|
+
return _regenerator().w(function(_context) {
|
|
21
|
+
while (1) switch (_context.n) {
|
|
22
|
+
case 0:
|
|
23
|
+
_context.n = 1;
|
|
24
|
+
return Promise.all([primaryContainer[_locale2], fallbackContainer[_locale2]]);
|
|
25
|
+
case 1:
|
|
26
|
+
_yield$Promise$all = _context.v;
|
|
27
|
+
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
28
|
+
primary = _yield$Promise$all2[0];
|
|
29
|
+
fallback = _yield$Promise$all2[1];
|
|
30
|
+
return _context.a(2, _objectSpread(_objectSpread({}, primary), fallback));
|
|
31
|
+
}
|
|
32
|
+
}, _callee);
|
|
33
|
+
}));
|
|
18
34
|
} else {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
...fallbackContainer[locale2] ?? {}
|
|
22
|
-
};
|
|
35
|
+
var _primaryContainer$_lo, _fallbackContainer$_l;
|
|
36
|
+
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 : {});
|
|
23
37
|
}
|
|
38
|
+
};
|
|
39
|
+
for (var _locale in primaryContainer) {
|
|
40
|
+
_loop(_locale);
|
|
24
41
|
}
|
|
25
42
|
return container2;
|
|
26
43
|
}, [primaryContainer, fallbackContainer]);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
for (
|
|
30
|
-
if (
|
|
31
|
-
store2[
|
|
44
|
+
var initStore = React.useMemo(function() {
|
|
45
|
+
var store2 = {};
|
|
46
|
+
for (var _locale2 in container) {
|
|
47
|
+
if (_typeof(container[_locale2]) === "object") {
|
|
48
|
+
store2[_locale2] = container[_locale2];
|
|
32
49
|
}
|
|
33
50
|
}
|
|
34
51
|
return store2;
|
|
35
52
|
}, [container]);
|
|
36
|
-
|
|
37
|
-
|
|
53
|
+
var _React$useState = React.useState(initStore), _React$useState2 = _slicedToArray(_React$useState, 2), store = _React$useState2[0], setStore = _React$useState2[1];
|
|
54
|
+
var lastLoadedLocaleRef = React.useRef(null);
|
|
38
55
|
if (store[locale]) lastLoadedLocaleRef.current = locale;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
56
|
+
var fallbackMessages = React.useMemo(function() {
|
|
57
|
+
return Object.values(store)[0];
|
|
58
|
+
}, [store]);
|
|
59
|
+
var loadingLocaleRef = React.useRef(null);
|
|
60
|
+
React.useEffect(function() {
|
|
42
61
|
loadingLocaleRef.current = locale;
|
|
43
|
-
|
|
62
|
+
var asyncMessages = container[locale];
|
|
44
63
|
if (typeof asyncMessages === "function") {
|
|
45
|
-
asyncMessages().then((module)
|
|
64
|
+
asyncMessages().then(function(module) {
|
|
46
65
|
if (loadingLocaleRef.current !== locale) return;
|
|
47
|
-
|
|
48
|
-
if ("default" in module &&
|
|
49
|
-
setStore((store2)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}).catch((err) => {
|
|
66
|
+
var messages = module;
|
|
67
|
+
if ("default" in module && _typeof(module["default"]) === "object") messages = module["default"];
|
|
68
|
+
setStore(function(store2) {
|
|
69
|
+
return _objectSpread(_objectSpread({}, store2), {}, _defineProperty({}, locale, messages));
|
|
70
|
+
});
|
|
71
|
+
})["catch"](function(err) {
|
|
54
72
|
console.error(err);
|
|
55
73
|
});
|
|
56
74
|
}
|
|
57
75
|
}, [container, locale]);
|
|
58
|
-
return store[locale]
|
|
76
|
+
return (_store$locale = store[locale]) !== null && _store$locale !== void 0 ? _store$locale : fallbackMessages;
|
|
59
77
|
};
|
|
60
|
-
const i18nEnhance = (container)
|
|
61
|
-
return (props)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
} = props;
|
|
66
|
-
const getI18nText = useI18n(i18n, locale, container);
|
|
67
|
-
return {
|
|
68
|
-
...props,
|
|
78
|
+
const i18nEnhance = (function(container) {
|
|
79
|
+
return function(props) {
|
|
80
|
+
var i18n = props.i18n, locale = props.locale;
|
|
81
|
+
var getI18nText = useI18n(i18n, locale, container);
|
|
82
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
|
69
83
|
getI18nText
|
|
70
|
-
};
|
|
84
|
+
});
|
|
71
85
|
};
|
|
72
|
-
};
|
|
86
|
+
});
|
|
73
87
|
export {
|
|
74
88
|
i18nEnhance as default,
|
|
75
89
|
useAsyncI18nMessages
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18nEnhance.mjs","names":["React","useI18n","useAsyncI18nMessages","primaryContainer","locale","fallbackContainer","container","useMemo","primary","fallback","Promise","all","initStore","store","
|
|
1
|
+
{"version":3,"file":"i18nEnhance.mjs","names":["React","useI18n","useAsyncI18nMessages","primaryContainer","locale","fallbackContainer","_store$locale","container","useMemo","_loop","_locale","_asyncToGenerator","_regenerator","m","_callee","_yield$Promise$all","_yield$Promise$all2","primary","fallback","w","_context","n","Promise","all","v","_slicedToArray","a","_objectSpread","_primaryContainer$_lo","_fallbackContainer$_l","initStore","store","_typeof","_React$useState","useState","_React$useState2","setStore","lastLoadedLocaleRef","useRef","current","fallbackMessages","Object","values","loadingLocaleRef","useEffect","asyncMessages","then","module","messages","_defineProperty","err","console","error","props","i18n","getI18nText"],"sources":["../../../src/utils/enhances/i18nEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nimport { type LocaleKeys, useI18n } from './WithI18n';\n\nexport type WithI18nEnhanceProps = {\n /* Function for getting the required field from the translation dictionary */\n getI18nText?: (key?: string, variables?: {}) => any;\n /* Object with translations */\n i18n?: {\n [locale: string]: {\n [key: string]: string;\n };\n };\n /* Locale for translations */\n locale?: LocaleKeys;\n};\n\ntype Messages = { [messageId: string]: string };\ntype MessagesContainer = { [locale: string]: Messages | (() => Promise<Messages>) };\ntype MessagesStore = { [locale: string]: Messages };\nexport const useAsyncI18nMessages = (\n primaryContainer: MessagesContainer,\n locale: string,\n fallbackContainer?: MessagesContainer,\n) => {\n const container = React.useMemo(() => {\n if (!fallbackContainer) return primaryContainer;\n if (!primaryContainer) return fallbackContainer;\n if (primaryContainer === fallbackContainer) return primaryContainer;\n const container: MessagesContainer = {};\n for (const locale in primaryContainer) {\n if (\n typeof primaryContainer[locale] === 'function' ||\n typeof fallbackContainer[locale] === 'function'\n ) {\n container[locale] = async () => {\n const [primary, fallback] = await Promise.all([\n primaryContainer[locale],\n fallbackContainer[locale],\n ]);\n return { ...primary, ...fallback };\n };\n } else {\n container[locale] = {\n ...(primaryContainer[locale] ?? {}),\n ...(fallbackContainer[locale] ?? {}),\n };\n }\n }\n return container;\n }, [primaryContainer, fallbackContainer]);\n const initStore = React.useMemo(() => {\n const store: MessagesStore = {};\n for (const locale in container) {\n if (typeof container[locale] === 'object') {\n store[locale] = container[locale] as Messages;\n }\n }\n return store;\n }, [container]);\n const [store, setStore] = React.useState(initStore);\n const lastLoadedLocaleRef = React.useRef<string | null>(null);\n if (store[locale]) lastLoadedLocaleRef.current = locale;\n const fallbackMessages = React.useMemo(() => Object.values(store)[0], [store]);\n\n const loadingLocaleRef = React.useRef<string | null>(null);\n React.useEffect(() => {\n loadingLocaleRef.current = locale;\n const asyncMessages = container[locale];\n if (typeof asyncMessages === 'function') {\n asyncMessages()\n .then((module) => {\n if (loadingLocaleRef.current !== locale) return;\n let messages = module;\n if ('default' in module && typeof module.default === 'object') messages = module.default;\n setStore((store) => ({\n ...store,\n [locale]: messages,\n }));\n })\n\n .catch((err) => {\n // eslint-disable-next-line no-console\n console.error(err);\n });\n }\n }, [container, locale]);\n\n return store[locale] ?? fallbackMessages;\n};\nexport default (container?: MessagesContainer) => {\n return (props: any): { getI18nText: ReturnType<typeof useI18n> } => {\n const { i18n, locale } = props;\n const getI18nText = useI18n(i18n, locale, container);\n\n return { ...props, getI18nText };\n };\n};\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAA0BC,OAAO,QAAQ,gBAAY;AAkBrD,OAAO,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAC/BC,gBAAmC,EACnCC,MAAc,EACdC,iBAAqC,EAClC;EAAA,IAAAC,aAAA;EACH,IAAMC,SAAS,GAAGP,KAAK,CAACQ,OAAO,CAAC,YAAM;IACpC,IAAI,CAACH,iBAAiB,EAAE,OAAOF,gBAAgB;IAC/C,IAAI,CAACA,gBAAgB,EAAE,OAAOE,iBAAiB;IAC/C,IAAIF,gBAAgB,KAAKE,iBAAiB,EAAE,OAAOF,gBAAgB;IACnE,IAAMI,SAA4B,GAAG,CAAC,CAAC;IAAC,IAAAE,KAAA,YAAAA,MAAAC,OAAA,EACD;MACrC,IACE,OAAOP,gBAAgB,CAACC,OAAM,CAAC,KAAK,UAAU,IAC9C,OAAOC,iBAAiB,CAACD,OAAM,CAAC,KAAK,UAAU,EAC/C;QACAG,SAAS,CAACH,OAAM,CAAC,gBAAAO,iBAAA,cAAAC,YAAA,GAAAC,CAAA,CAAG,SAAAC,QAAA;UAAA,IAAAC,kBAAA,EAAAC,mBAAA,EAAAC,OAAA,EAAAC,QAAA;UAAA,OAAAN,YAAA,GAAAO,CAAA,WAAAC,QAAA;YAAA,kBAAAA,QAAA,CAAAC,CAAA;cAAA;gBAAAD,QAAA,CAAAC,CAAA;gBAAA,OACgBC,OAAO,CAACC,GAAG,CAAC,CAC5CpB,gBAAgB,CAACC,OAAM,CAAC,EACxBC,iBAAiB,CAACD,OAAM,CAAC,CAC1B,CAAC;cAAA;gBAAAW,kBAAA,GAAAK,QAAA,CAAAI,CAAA;gBAAAR,mBAAA,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AgB;AAC1C,CAAC;AACD,gBAAe,UAACjC,SAA6B,EAAK;EAChD,OAAO,UAAC8C,KAAU,EAAkD;IAClE,IAAQC,IAAI,GAAaD,KAAK,CAAtBC,IAAI;MAAElD,MAAM,GAAKiD,KAAK,CAAhBjD,MAAM;IACpB,IAAMmD,WAAW,GAAGtD,OAAO,CAACqD,IAAI,EAAElD,MAAM,EAAEG,SAAS,CAAC;IAEpD,OAAAoB,aAAA,CAAAA,aAAA,KAAY0B,KAAK;MAAEE,WAAW,EAAXA;IAAW;EAChC,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports
|
|
7
|
+
exports["default"] = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _assignProps = _interopRequireDefault(require("../assignProps"));
|
|
10
10
|
var _ref = require("../ref");
|
|
11
11
|
var _useColorResolver = require("../use/useColorResolver");
|
|
12
|
-
|
|
13
|
-
return props
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const resolveColor = (0, _useColorResolver.useColorResolver)();
|
|
19
|
-
return (0, _assignProps.default)(props, {
|
|
12
|
+
var resolveColorEnhance = function resolveColorEnhance() {
|
|
13
|
+
return function (props) {
|
|
14
|
+
var ref = props.ref;
|
|
15
|
+
var internalRef = _react["default"].useRef();
|
|
16
|
+
var resolveColor = (0, _useColorResolver.useColorResolver)();
|
|
17
|
+
return (0, _assignProps["default"])(props, {
|
|
20
18
|
ref: (0, _ref.useForkRef)(ref, internalRef),
|
|
21
|
-
resolveColor
|
|
19
|
+
resolveColor: resolveColor
|
|
22
20
|
});
|
|
23
21
|
};
|
|
24
22
|
};
|
|
25
|
-
var _default = exports
|
|
23
|
+
var _default = exports["default"] = resolveColorEnhance;
|
|
26
24
|
//# sourceMappingURL=resolveColorEnhance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveColorEnhance.js","names":["_react","_interopRequireDefault","require","_assignProps","_ref","_useColorResolver","resolveColorEnhance","props","ref","internalRef","React","useRef","resolveColor","useColorResolver","assignProps","useForkRef","_default","exports"
|
|
1
|
+
{"version":3,"file":"resolveColorEnhance.js","names":["_react","_interopRequireDefault","require","_assignProps","_ref","_useColorResolver","resolveColorEnhance","props","ref","internalRef","React","useRef","resolveColor","useColorResolver","assignProps","useForkRef","_default","exports"],"sources":["../../../src/utils/enhances/resolveColorEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nimport assignProps from '../assignProps';\nimport { useForkRef } from '../ref';\nimport { useColorResolver } from '../use/useColorResolver';\n\nconst resolveColorEnhance = () => {\n return (props: any) => {\n const { ref } = props;\n const internalRef = React.useRef<HTMLElement>();\n const resolveColor = useColorResolver();\n\n return assignProps(props, {\n ref: useForkRef(ref, internalRef),\n resolveColor,\n });\n };\n};\n\nexport default resolveColorEnhance;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AAEA,IAAMI,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAA,EAAS;EAChC,OAAO,UAACC,KAAU,EAAK;IACrB,IAAQC,GAAG,GAAKD,KAAK,CAAbC,GAAG;IACX,IAAMC,WAAW,GAAGC,iBAAK,CAACC,MAAM,CAAc,CAAC;IAC/C,IAAMC,YAAY,GAAG,IAAAC,kCAAgB,EAAC,CAAC;IAEvC,OAAO,IAAAC,uBAAW,EAACP,KAAK,EAAE;MACxBC,GAAG,EAAE,IAAAO,eAAU,EAACP,GAAG,EAAEC,WAAW,CAAC;MACjCG,YAAY,EAAZA;IACF,CAAC,CAAC;EACJ,CAAC;AACH,CAAC;AAAC,IAAAI,QAAA,GAAAC,OAAA,cAEaX,mBAAmB","ignoreList":[]}
|
|
@@ -2,16 +2,14 @@ import React from 'react';
|
|
|
2
2
|
import assignProps from "../assignProps.mjs";
|
|
3
3
|
import { useForkRef } from "../ref.mjs";
|
|
4
4
|
import { useColorResolver } from "../use/useColorResolver.mjs";
|
|
5
|
-
|
|
6
|
-
return props
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const internalRef = React.useRef();
|
|
11
|
-
const resolveColor = useColorResolver();
|
|
5
|
+
var resolveColorEnhance = function resolveColorEnhance() {
|
|
6
|
+
return function (props) {
|
|
7
|
+
var ref = props.ref;
|
|
8
|
+
var internalRef = React.useRef();
|
|
9
|
+
var resolveColor = useColorResolver();
|
|
12
10
|
return assignProps(props, {
|
|
13
11
|
ref: useForkRef(ref, internalRef),
|
|
14
|
-
resolveColor
|
|
12
|
+
resolveColor: resolveColor
|
|
15
13
|
});
|
|
16
14
|
};
|
|
17
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveColorEnhance.mjs","names":["React","assignProps","useForkRef","useColorResolver","resolveColorEnhance","props","ref","internalRef","useRef","resolveColor"],"sources":["../../../src/utils/enhances/resolveColorEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nimport assignProps from '../assignProps';\nimport { useForkRef } from '../ref';\nimport { useColorResolver } from '../use/useColorResolver';\n\nconst resolveColorEnhance = () => {\n return (props: any) => {\n const { ref } = props;\n const internalRef = React.useRef<HTMLElement>();\n const resolveColor = useColorResolver();\n\n return assignProps(props, {\n ref: useForkRef(ref, internalRef),\n resolveColor,\n });\n };\n};\n\nexport default resolveColorEnhance;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAOC,WAAW,MAAM,oBAAgB;AACxC,SAASC,UAAU,QAAQ,YAAQ;AACnC,SAASC,gBAAgB,QAAQ,6BAAyB;AAE1D,
|
|
1
|
+
{"version":3,"file":"resolveColorEnhance.mjs","names":["React","assignProps","useForkRef","useColorResolver","resolveColorEnhance","props","ref","internalRef","useRef","resolveColor"],"sources":["../../../src/utils/enhances/resolveColorEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nimport assignProps from '../assignProps';\nimport { useForkRef } from '../ref';\nimport { useColorResolver } from '../use/useColorResolver';\n\nconst resolveColorEnhance = () => {\n return (props: any) => {\n const { ref } = props;\n const internalRef = React.useRef<HTMLElement>();\n const resolveColor = useColorResolver();\n\n return assignProps(props, {\n ref: useForkRef(ref, internalRef),\n resolveColor,\n });\n };\n};\n\nexport default resolveColorEnhance;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAOC,WAAW,MAAM,oBAAgB;AACxC,SAASC,UAAU,QAAQ,YAAQ;AACnC,SAASC,gBAAgB,QAAQ,6BAAyB;AAE1D,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAA,EAAS;EAChC,OAAO,UAACC,KAAU,EAAK;IACrB,IAAQC,GAAG,GAAKD,KAAK,CAAbC,GAAG;IACX,IAAMC,WAAW,GAAGP,KAAK,CAACQ,MAAM,CAAc,CAAC;IAC/C,IAAMC,YAAY,GAAGN,gBAAgB,CAAC,CAAC;IAEvC,OAAOF,WAAW,CAACI,KAAK,EAAE;MACxBC,GAAG,EAAEJ,UAAU,CAACI,GAAG,EAAEC,WAAW,CAAC;MACjCE,YAAY,EAAZA;IACF,CAAC,CAAC;EACJ,CAAC;AACH,CAAC;AAED,eAAeL,mBAAmB","ignoreList":[]}
|