@variousjs/various 5.2.0 → 5.3.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/dist/index.dev.js +75 -33
- package/dist/index.dev.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/standalone.js +83 -37
- package/dist/standalone.js.map +1 -1
- package/index.d.ts +31 -7
- package/package.json +1 -1
- package/standalone.d.ts +5 -2
package/dist/standalone.js
CHANGED
|
@@ -2205,7 +2205,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2205
2205
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2206
2206
|
/* harmony export */ BASE_DEPENDENCIES: function() { return /* binding */ BASE_DEPENDENCIES; },
|
|
2207
2207
|
/* harmony export */ CONFIG_KEY: function() { return /* binding */ CONFIG_KEY; },
|
|
2208
|
+
/* harmony export */ DEFAULT_LOCALE: function() { return /* binding */ DEFAULT_LOCALE; },
|
|
2208
2209
|
/* harmony export */ DEPENDENCIES_KEY: function() { return /* binding */ DEPENDENCIES_KEY; },
|
|
2210
|
+
/* harmony export */ I18NActions: function() { return /* binding */ I18NActions; },
|
|
2211
|
+
/* harmony export */ LOCALE_KEY: function() { return /* binding */ LOCALE_KEY; },
|
|
2209
2212
|
/* harmony export */ MESSAGE_KEY: function() { return /* binding */ MESSAGE_KEY; },
|
|
2210
2213
|
/* harmony export */ MOUNTED_COMPONENTS_KEY: function() { return /* binding */ MOUNTED_COMPONENTS_KEY; },
|
|
2211
2214
|
/* harmony export */ STANDALONE_CONFIG_READY: function() { return /* binding */ STANDALONE_CONFIG_READY; },
|
|
@@ -2216,7 +2219,15 @@ const MOUNTED_COMPONENTS_KEY = Symbol('MOUNTED_COMPONENTS');
|
|
|
2216
2219
|
const MESSAGE_KEY = Symbol('MESSAGE');
|
|
2217
2220
|
const CONFIG_KEY = Symbol('CONFIG');
|
|
2218
2221
|
const DEPENDENCIES_KEY = Symbol('DEPENDENCIES');
|
|
2222
|
+
const LOCALE_KEY = Symbol('LOCALE');
|
|
2219
2223
|
const STANDALONE_CONFIG_READY = Symbol('STANDALONE_CONFIG_READY');
|
|
2224
|
+
const DEFAULT_LOCALE = 'en';
|
|
2225
|
+
let I18NActions = /*#__PURE__*/function (I18NActions) {
|
|
2226
|
+
I18NActions["SetLocale"] = "setLocale";
|
|
2227
|
+
I18NActions["GetLocale"] = "getLocale";
|
|
2228
|
+
I18NActions["UpdateI18nConfig"] = "updateI18nConfig";
|
|
2229
|
+
return I18NActions;
|
|
2230
|
+
}({});
|
|
2220
2231
|
const VUE_FUNCTION_OPTIONS = ['beforeCreate', 'created', 'beforeMount', 'mounted', 'beforeUpdate', 'updated', 'beforeUnmount', 'unmounted', 'errorCaptured', 'renderTracked', 'renderTriggered', 'activated', 'deactivated', 'setup', 'data', 'render'];
|
|
2221
2232
|
const VUE_VERSION = 3;
|
|
2222
2233
|
const BASE_DEPENDENCIES = ['react', 'react-dom', '@variousjs/various', 'app'];
|
|
@@ -2507,6 +2518,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2507
2518
|
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./store */ "./src/core/store.ts");
|
|
2508
2519
|
/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./helper */ "./src/core/helper.ts");
|
|
2509
2520
|
/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./logger */ "./src/core/logger.ts");
|
|
2521
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./config */ "./src/core/config.ts");
|
|
2522
|
+
|
|
2510
2523
|
|
|
2511
2524
|
|
|
2512
2525
|
|
|
@@ -2539,6 +2552,26 @@ const createDispatch = module => async function (params) {
|
|
|
2539
2552
|
if (target === 'app') {
|
|
2540
2553
|
const storeActions = _connector__WEBPACK_IMPORTED_MODULE_0__["default"].getStoreActions();
|
|
2541
2554
|
const storeAction = storeActions[action];
|
|
2555
|
+
if (action === _config__WEBPACK_IMPORTED_MODULE_4__.I18NActions.SetLocale) {
|
|
2556
|
+
(0,_store__WEBPACK_IMPORTED_MODULE_1__.emit)({
|
|
2557
|
+
[_config__WEBPACK_IMPORTED_MODULE_4__.LOCALE_KEY]: payload
|
|
2558
|
+
}, true);
|
|
2559
|
+
return payload;
|
|
2560
|
+
}
|
|
2561
|
+
if (action === _config__WEBPACK_IMPORTED_MODULE_4__.I18NActions.GetLocale) {
|
|
2562
|
+
return (0,_store__WEBPACK_IMPORTED_MODULE_1__.getStore)(_config__WEBPACK_IMPORTED_MODULE_4__.LOCALE_KEY);
|
|
2563
|
+
}
|
|
2564
|
+
if (action === _config__WEBPACK_IMPORTED_MODULE_4__.I18NActions.UpdateI18nConfig) {
|
|
2565
|
+
const locale = (0,_store__WEBPACK_IMPORTED_MODULE_1__.getStore)(_config__WEBPACK_IMPORTED_MODULE_4__.LOCALE_KEY);
|
|
2566
|
+
_connector__WEBPACK_IMPORTED_MODULE_0__["default"].setGlobalI18nConfig(payload);
|
|
2567
|
+
(0,_store__WEBPACK_IMPORTED_MODULE_1__.emit)({
|
|
2568
|
+
[_config__WEBPACK_IMPORTED_MODULE_4__.LOCALE_KEY]: undefined
|
|
2569
|
+
}, true);
|
|
2570
|
+
(0,_store__WEBPACK_IMPORTED_MODULE_1__.emit)({
|
|
2571
|
+
[_config__WEBPACK_IMPORTED_MODULE_4__.LOCALE_KEY]: locale
|
|
2572
|
+
}, true);
|
|
2573
|
+
return locale;
|
|
2574
|
+
}
|
|
2542
2575
|
if (!storeAction) {
|
|
2543
2576
|
const errorMessage = `action "${action}" is not present`;
|
|
2544
2577
|
const error = new _helper__WEBPACK_IMPORTED_MODULE_2__.VariousError({
|
|
@@ -2595,6 +2628,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2595
2628
|
/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./helper */ "./src/core/helper.ts");
|
|
2596
2629
|
/* harmony import */ var _connector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./connector */ "./src/core/connector.ts");
|
|
2597
2630
|
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./store */ "./src/core/store.ts");
|
|
2631
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./config */ "./src/core/config.ts");
|
|
2632
|
+
|
|
2598
2633
|
|
|
2599
2634
|
|
|
2600
2635
|
|
|
@@ -2631,12 +2666,14 @@ class ErrorBoundary extends react__WEBPACK_IMPORTED_MODULE_0__.Component {
|
|
|
2631
2666
|
render() {
|
|
2632
2667
|
const ErrorFallbackNode = _connector__WEBPACK_IMPORTED_MODULE_2__["default"].getErrorFallbackComponent();
|
|
2633
2668
|
const store = (0,_store__WEBPACK_IMPORTED_MODULE_3__.getUserStore)();
|
|
2669
|
+
const locale = (0,_store__WEBPACK_IMPORTED_MODULE_3__.getStore)(_config__WEBPACK_IMPORTED_MODULE_4__.LOCALE_KEY);
|
|
2634
2670
|
if (this.state.hasError) {
|
|
2635
2671
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(ErrorFallbackNode, {
|
|
2636
2672
|
$self: this.$self,
|
|
2637
2673
|
$reload: this.reload,
|
|
2638
2674
|
$store: store,
|
|
2639
|
-
$error: this.error
|
|
2675
|
+
$error: this.error,
|
|
2676
|
+
$locale: locale
|
|
2640
2677
|
});
|
|
2641
2678
|
}
|
|
2642
2679
|
return this.props.children;
|
|
@@ -2932,6 +2969,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2932
2969
|
/* harmony import */ var _connector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./connector */ "./src/core/connector.ts");
|
|
2933
2970
|
/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./helper */ "./src/core/helper.ts");
|
|
2934
2971
|
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./store */ "./src/core/store.ts");
|
|
2972
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./config */ "./src/core/config.ts");
|
|
2973
|
+
|
|
2935
2974
|
|
|
2936
2975
|
|
|
2937
2976
|
|
|
@@ -2951,13 +2990,11 @@ function createI18nConfig(method, module, callback) {
|
|
|
2951
2990
|
if (module) {
|
|
2952
2991
|
_connector__WEBPACK_IMPORTED_MODULE_0__["default"].setI18nConfig(module, {
|
|
2953
2992
|
loading: true,
|
|
2954
|
-
lngStoreKey: '',
|
|
2955
2993
|
resources: {}
|
|
2956
2994
|
});
|
|
2957
2995
|
} else {
|
|
2958
2996
|
_connector__WEBPACK_IMPORTED_MODULE_0__["default"].setGlobalI18nConfig({
|
|
2959
2997
|
loading: true,
|
|
2960
|
-
lngStoreKey: '',
|
|
2961
2998
|
resources: {}
|
|
2962
2999
|
});
|
|
2963
3000
|
}
|
|
@@ -2970,12 +3007,12 @@ function createI18nConfig(method, module, callback) {
|
|
|
2970
3007
|
callback?.();
|
|
2971
3008
|
return;
|
|
2972
3009
|
}
|
|
2973
|
-
const locale = (0,_store__WEBPACK_IMPORTED_MODULE_2__.getStore)(
|
|
3010
|
+
const locale = (0,_store__WEBPACK_IMPORTED_MODULE_2__.getStore)(_config__WEBPACK_IMPORTED_MODULE_3__.LOCALE_KEY);
|
|
2974
3011
|
(0,_store__WEBPACK_IMPORTED_MODULE_2__.emit)({
|
|
2975
|
-
[
|
|
3012
|
+
[_config__WEBPACK_IMPORTED_MODULE_3__.LOCALE_KEY]: undefined
|
|
2976
3013
|
}, true);
|
|
2977
3014
|
(0,_store__WEBPACK_IMPORTED_MODULE_2__.emit)({
|
|
2978
|
-
[
|
|
3015
|
+
[_config__WEBPACK_IMPORTED_MODULE_3__.LOCALE_KEY]: locale
|
|
2979
3016
|
}, true);
|
|
2980
3017
|
_connector__WEBPACK_IMPORTED_MODULE_0__["default"].setGlobalI18nConfig({
|
|
2981
3018
|
...res,
|
|
@@ -3008,18 +3045,9 @@ function createI18n(module, updater) {
|
|
|
3008
3045
|
return defaultText;
|
|
3009
3046
|
}
|
|
3010
3047
|
const {
|
|
3011
|
-
lngStoreKey,
|
|
3012
3048
|
resources
|
|
3013
3049
|
} = i18nConfig;
|
|
3014
|
-
const locale = (0,_store__WEBPACK_IMPORTED_MODULE_2__.getStore)(
|
|
3015
|
-
if (lngStoreKey === undefined || locale === undefined) {
|
|
3016
|
-
(0,_helper__WEBPACK_IMPORTED_MODULE_1__.onError)(new _helper__WEBPACK_IMPORTED_MODULE_1__.VariousError({
|
|
3017
|
-
module,
|
|
3018
|
-
type: 'I18N',
|
|
3019
|
-
originalError: new Error('locale key not defined')
|
|
3020
|
-
}));
|
|
3021
|
-
return defaultText;
|
|
3022
|
-
}
|
|
3050
|
+
const locale = (0,_store__WEBPACK_IMPORTED_MODULE_2__.getStore)(_config__WEBPACK_IMPORTED_MODULE_3__.LOCALE_KEY);
|
|
3023
3051
|
const resource = resources?.[locale];
|
|
3024
3052
|
if (!resource) {
|
|
3025
3053
|
(0,_helper__WEBPACK_IMPORTED_MODULE_1__.onError)(new _helper__WEBPACK_IMPORTED_MODULE_1__.VariousError({
|
|
@@ -3050,17 +3078,13 @@ function createI18n(module, updater) {
|
|
|
3050
3078
|
return next.replace(regex, params[arg].toString());
|
|
3051
3079
|
}, text);
|
|
3052
3080
|
};
|
|
3053
|
-
ctx.update =
|
|
3054
|
-
const i18nConfig =
|
|
3081
|
+
ctx.update = config => {
|
|
3082
|
+
const i18nConfig = _connector__WEBPACK_IMPORTED_MODULE_0__["default"].getI18nConfig(module);
|
|
3055
3083
|
const next = {
|
|
3056
3084
|
...i18nConfig,
|
|
3057
3085
|
...config
|
|
3058
3086
|
};
|
|
3059
|
-
|
|
3060
|
-
_connector__WEBPACK_IMPORTED_MODULE_0__["default"].setGlobalI18nConfig(next);
|
|
3061
|
-
} else {
|
|
3062
|
-
_connector__WEBPACK_IMPORTED_MODULE_0__["default"].setI18nConfig(module, next);
|
|
3063
|
-
}
|
|
3087
|
+
_connector__WEBPACK_IMPORTED_MODULE_0__["default"].setI18nConfig(module, next);
|
|
3064
3088
|
updater();
|
|
3065
3089
|
};
|
|
3066
3090
|
return ctx;
|
|
@@ -3131,7 +3155,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3131
3155
|
|
|
3132
3156
|
|
|
3133
3157
|
// eslint-disable-next-line no-undef
|
|
3134
|
-
const version = "5.
|
|
3158
|
+
const version = "5.3.0";
|
|
3135
3159
|
const getApp = config => {
|
|
3136
3160
|
const {
|
|
3137
3161
|
dependencies,
|
|
@@ -3159,13 +3183,14 @@ const getApp = config => {
|
|
|
3159
3183
|
[_config__WEBPACK_IMPORTED_MODULE_2__.MOUNTED_COMPONENTS_KEY]: [],
|
|
3160
3184
|
[_config__WEBPACK_IMPORTED_MODULE_2__.CONFIG_KEY]: rest,
|
|
3161
3185
|
[_config__WEBPACK_IMPORTED_MODULE_2__.DEPENDENCIES_KEY]: dependencies,
|
|
3162
|
-
[_config__WEBPACK_IMPORTED_MODULE_2__.MESSAGE_KEY]: null
|
|
3186
|
+
[_config__WEBPACK_IMPORTED_MODULE_2__.MESSAGE_KEY]: null,
|
|
3187
|
+
[_config__WEBPACK_IMPORTED_MODULE_2__.LOCALE_KEY]: i18n?.defaultLocale || _config__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_LOCALE
|
|
3163
3188
|
});
|
|
3164
3189
|
Root.displayName = 'various-app-root';
|
|
3165
3190
|
return class extends react__WEBPACK_IMPORTED_MODULE_0__.Component {
|
|
3166
3191
|
static displayName = 'various-app';
|
|
3167
3192
|
componentDidMount() {
|
|
3168
|
-
(0,_i18n__WEBPACK_IMPORTED_MODULE_4__.createI18nConfig)(i18n);
|
|
3193
|
+
(0,_i18n__WEBPACK_IMPORTED_MODULE_4__.createI18nConfig)(i18n?.getResources);
|
|
3169
3194
|
}
|
|
3170
3195
|
render() {
|
|
3171
3196
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_error_boundary__WEBPACK_IMPORTED_MODULE_6__["default"], {
|
|
@@ -3340,6 +3365,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3340
3365
|
/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./logger */ "./src/core/logger.ts");
|
|
3341
3366
|
/* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./i18n */ "./src/core/i18n.ts");
|
|
3342
3367
|
/* harmony import */ var _create_module__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./create-module */ "./src/core/create-module.ts");
|
|
3368
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./config */ "./src/core/config.ts");
|
|
3369
|
+
|
|
3343
3370
|
|
|
3344
3371
|
|
|
3345
3372
|
|
|
@@ -3429,6 +3456,7 @@ function reactComponent(config) {
|
|
|
3429
3456
|
isError
|
|
3430
3457
|
} = this.state;
|
|
3431
3458
|
const store = (0,_store__WEBPACK_IMPORTED_MODULE_3__.getUserStore)();
|
|
3459
|
+
const locale = (0,_store__WEBPACK_IMPORTED_MODULE_3__.getStore)(_config__WEBPACK_IMPORTED_MODULE_10__.LOCALE_KEY);
|
|
3432
3460
|
const ComponentNode = this.ComponentNode;
|
|
3433
3461
|
if (isError) {
|
|
3434
3462
|
throw this.error;
|
|
@@ -3439,7 +3467,8 @@ function reactComponent(config) {
|
|
|
3439
3467
|
}
|
|
3440
3468
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(Fallback, {
|
|
3441
3469
|
$self: this.$self,
|
|
3442
|
-
$store: store
|
|
3470
|
+
$store: store,
|
|
3471
|
+
$locale: locale
|
|
3443
3472
|
});
|
|
3444
3473
|
}
|
|
3445
3474
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(ComponentNode, (0,_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, $componentProps, {
|
|
@@ -3449,11 +3478,12 @@ function reactComponent(config) {
|
|
|
3449
3478
|
$postMessage: this.$postMessage,
|
|
3450
3479
|
$t: this.$t,
|
|
3451
3480
|
$logger: this.$logger,
|
|
3452
|
-
ref: $ref
|
|
3481
|
+
ref: $ref,
|
|
3482
|
+
$locale: locale
|
|
3453
3483
|
}));
|
|
3454
3484
|
}
|
|
3455
3485
|
}
|
|
3456
|
-
const Connected = (0,_store__WEBPACK_IMPORTED_MODULE_3__.connect)(...storeKeys)(R);
|
|
3486
|
+
const Connected = (0,_store__WEBPACK_IMPORTED_MODULE_3__.connect)(...storeKeys, _config__WEBPACK_IMPORTED_MODULE_10__.LOCALE_KEY)(R);
|
|
3457
3487
|
Connected.displayName = 'various-connector';
|
|
3458
3488
|
return Connected;
|
|
3459
3489
|
}
|
|
@@ -3596,6 +3626,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3596
3626
|
/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./logger */ "./src/core/logger.ts");
|
|
3597
3627
|
/* harmony import */ var _message__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./message */ "./src/core/message.ts");
|
|
3598
3628
|
/* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./i18n */ "./src/core/i18n.ts");
|
|
3629
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./config */ "./src/core/config.ts");
|
|
3630
|
+
|
|
3599
3631
|
|
|
3600
3632
|
|
|
3601
3633
|
|
|
@@ -3614,7 +3646,8 @@ function vueComponent(config) {
|
|
|
3614
3646
|
} = config;
|
|
3615
3647
|
const storeKeys = watchKeys || Object.keys((0,_store__WEBPACK_IMPORTED_MODULE_3__.getStore)());
|
|
3616
3648
|
const V = props => {
|
|
3617
|
-
const store = (0,_store__WEBPACK_IMPORTED_MODULE_3__.useStore)(...storeKeys);
|
|
3649
|
+
const store = (0,_store__WEBPACK_IMPORTED_MODULE_3__.useStore)(...storeKeys, _config__WEBPACK_IMPORTED_MODULE_9__.LOCALE_KEY);
|
|
3650
|
+
const locale = store[_config__WEBPACK_IMPORTED_MODULE_9__.LOCALE_KEY];
|
|
3618
3651
|
const vueRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
|
|
3619
3652
|
const vmRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
|
|
3620
3653
|
const isVueMounted = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(false);
|
|
@@ -3628,6 +3661,7 @@ function vueComponent(config) {
|
|
|
3628
3661
|
const containerDivRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
3629
3662
|
const propsReactiveRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
|
|
3630
3663
|
const storeReactiveRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
|
|
3664
|
+
const localeReactiveRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
|
|
3631
3665
|
const unMountVue = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
|
|
3632
3666
|
const unSubscribeMessageRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
|
|
3633
3667
|
const updateVueComponentRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
|
|
@@ -3651,6 +3685,7 @@ function vueComponent(config) {
|
|
|
3651
3685
|
storeReactiveRef.current = vueRef.current.ref({
|
|
3652
3686
|
...store
|
|
3653
3687
|
});
|
|
3688
|
+
localeReactiveRef.current = vueRef.current.ref(locale);
|
|
3654
3689
|
const vueApp = vueRef.current.createApp({
|
|
3655
3690
|
setup() {
|
|
3656
3691
|
const renderKey = vueRef.current.ref(0);
|
|
@@ -3679,7 +3714,8 @@ function vueComponent(config) {
|
|
|
3679
3714
|
$postMessage,
|
|
3680
3715
|
$t,
|
|
3681
3716
|
$store: storeReactiveRef.current.value,
|
|
3682
|
-
$self: selfRef.current
|
|
3717
|
+
$self: selfRef.current,
|
|
3718
|
+
$locale: localeReactiveRef.current.value
|
|
3683
3719
|
},
|
|
3684
3720
|
// eslint-disable-next-line react/no-this-in-sfc
|
|
3685
3721
|
key: this.key
|
|
@@ -3693,7 +3729,7 @@ function vueComponent(config) {
|
|
|
3693
3729
|
}
|
|
3694
3730
|
isVueMounted.current = true;
|
|
3695
3731
|
unMountVue.current = () => vueApp.unmount();
|
|
3696
|
-
}, [$componentProps, store]);
|
|
3732
|
+
}, [$componentProps, store, locale]);
|
|
3697
3733
|
const mountComponent = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(async () => {
|
|
3698
3734
|
try {
|
|
3699
3735
|
const vue = await (0,_create_module__WEBPACK_IMPORTED_MODULE_2__["default"])({
|
|
@@ -3763,12 +3799,18 @@ function vueComponent(config) {
|
|
|
3763
3799
|
};
|
|
3764
3800
|
}
|
|
3765
3801
|
}, [store]);
|
|
3802
|
+
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
3803
|
+
if (localeReactiveRef.current) {
|
|
3804
|
+
localeReactiveRef.current.value = locale;
|
|
3805
|
+
}
|
|
3806
|
+
}, [locale]);
|
|
3766
3807
|
if (isError) {
|
|
3767
3808
|
throw errorRef.current;
|
|
3768
3809
|
}
|
|
3769
3810
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, !componentReady && !$silent && !(0,_helper__WEBPACK_IMPORTED_MODULE_4__.isModuleLoaded)(module) ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(Fallback, {
|
|
3770
3811
|
$self: selfRef.current,
|
|
3771
|
-
$store: store
|
|
3812
|
+
$store: store,
|
|
3813
|
+
$locale: locale
|
|
3772
3814
|
}) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
3773
3815
|
className: (0,_helper__WEBPACK_IMPORTED_MODULE_4__.getClassNameWithModule)(module, 'various-vue-component'),
|
|
3774
3816
|
ref: containerDivRef
|
|
@@ -3841,10 +3883,12 @@ const createAppConfig = config => {
|
|
|
3841
3883
|
ErrorFallback,
|
|
3842
3884
|
Fallback,
|
|
3843
3885
|
store,
|
|
3844
|
-
actions
|
|
3886
|
+
actions,
|
|
3887
|
+
i18n
|
|
3845
3888
|
} = config;
|
|
3846
3889
|
(0,_core_store__WEBPACK_IMPORTED_MODULE_1__.emit)({
|
|
3847
|
-
[_core_config__WEBPACK_IMPORTED_MODULE_2__.STANDALONE_CONFIG_READY]: false
|
|
3890
|
+
[_core_config__WEBPACK_IMPORTED_MODULE_2__.STANDALONE_CONFIG_READY]: false,
|
|
3891
|
+
[_core_config__WEBPACK_IMPORTED_MODULE_2__.LOCALE_KEY]: i18n?.defaultLocale || _core_config__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_LOCALE
|
|
3848
3892
|
}, true);
|
|
3849
3893
|
if (ErrorFallback) {
|
|
3850
3894
|
_core_connector__WEBPACK_IMPORTED_MODULE_3__["default"].setErrorFallbackComponent(ErrorFallback);
|
|
@@ -3995,7 +4039,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3995
4039
|
[_core_config__WEBPACK_IMPORTED_MODULE_8__.MESSAGE_KEY]: null,
|
|
3996
4040
|
[_core_config__WEBPACK_IMPORTED_MODULE_8__.CONFIG_KEY]: {},
|
|
3997
4041
|
[_core_config__WEBPACK_IMPORTED_MODULE_8__.DEPENDENCIES_KEY]: {},
|
|
3998
|
-
[_core_config__WEBPACK_IMPORTED_MODULE_8__.STANDALONE_CONFIG_READY]: undefined
|
|
4042
|
+
[_core_config__WEBPACK_IMPORTED_MODULE_8__.STANDALONE_CONFIG_READY]: undefined,
|
|
4043
|
+
[_core_config__WEBPACK_IMPORTED_MODULE_8__.LOCALE_KEY]: _core_config__WEBPACK_IMPORTED_MODULE_8__.DEFAULT_LOCALE
|
|
3999
4044
|
});
|
|
4000
4045
|
window.define('react', [], () => (react__WEBPACK_IMPORTED_MODULE_2___default()));
|
|
4001
4046
|
const Standalone = props => {
|
|
@@ -4028,7 +4073,8 @@ const Standalone = props => {
|
|
|
4028
4073
|
module,
|
|
4029
4074
|
url
|
|
4030
4075
|
},
|
|
4031
|
-
$store: (0,_core_store__WEBPACK_IMPORTED_MODULE_7__.getUserStore)()
|
|
4076
|
+
$store: (0,_core_store__WEBPACK_IMPORTED_MODULE_7__.getUserStore)(),
|
|
4077
|
+
$locale: store[_core_config__WEBPACK_IMPORTED_MODULE_8__.LOCALE_KEY]
|
|
4032
4078
|
});
|
|
4033
4079
|
}
|
|
4034
4080
|
const C = componentNode.current;
|