@variousjs/various 5.2.1 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.dev.js +1354 -1671
- package/dist/index.dev.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/loader-dev.js +198 -2322
- package/dist/loader-dev.js.map +1 -1
- package/dist/loader.js +7 -2
- package/dist/loader.js.map +1 -1
- package/dist/standalone.js +1332 -4010
- package/dist/standalone.js.map +1 -1
- package/dist/standalone.mjs +1402 -0
- package/dist/standalone.mjs.map +1 -0
- package/index.d.ts +25 -5
- package/package.json +45 -54
- package/standalone.d.ts +2 -2
- package/dist/loader.js.LICENSE.txt +0 -4
package/dist/index.dev.js
CHANGED
|
@@ -1,1715 +1,1398 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"use strict";
|
|
11
|
-
__webpack_require__.r(__webpack_exports__);
|
|
12
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
13
|
-
/* harmony export */ "default": function() { return /* binding */ _extends; }
|
|
14
|
-
/* harmony export */ });
|
|
15
|
-
function _extends() {
|
|
16
|
-
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
17
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
18
|
-
var t = arguments[e];
|
|
19
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
20
|
-
}
|
|
21
|
-
return n;
|
|
22
|
-
}, _extends.apply(null, arguments);
|
|
1
|
+
import e, { Component, useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
2
|
+
//#region \0@oxc-project+runtime@0.142.0/helpers/esm/typeof.js
|
|
3
|
+
function _typeof(o) {
|
|
4
|
+
"@babel/helpers - typeof";
|
|
5
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
6
|
+
return typeof o;
|
|
7
|
+
} : function(o) {
|
|
8
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
9
|
+
}, _typeof(o);
|
|
23
10
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
//# sourceMappingURL=index.js.map
|
|
36
|
-
|
|
37
|
-
/***/ }),
|
|
38
|
-
|
|
39
|
-
/***/ "./src/core/config.ts":
|
|
40
|
-
/*!****************************!*\
|
|
41
|
-
!*** ./src/core/config.ts ***!
|
|
42
|
-
\****************************/
|
|
43
|
-
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
44
|
-
|
|
45
|
-
"use strict";
|
|
46
|
-
__webpack_require__.r(__webpack_exports__);
|
|
47
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
48
|
-
/* harmony export */ BASE_DEPENDENCIES: function() { return /* binding */ BASE_DEPENDENCIES; },
|
|
49
|
-
/* harmony export */ CONFIG_KEY: function() { return /* binding */ CONFIG_KEY; },
|
|
50
|
-
/* harmony export */ DEPENDENCIES_KEY: function() { return /* binding */ DEPENDENCIES_KEY; },
|
|
51
|
-
/* harmony export */ MESSAGE_KEY: function() { return /* binding */ MESSAGE_KEY; },
|
|
52
|
-
/* harmony export */ MOUNTED_COMPONENTS_KEY: function() { return /* binding */ MOUNTED_COMPONENTS_KEY; },
|
|
53
|
-
/* harmony export */ STANDALONE_CONFIG_READY: function() { return /* binding */ STANDALONE_CONFIG_READY; },
|
|
54
|
-
/* harmony export */ VUE_FUNCTION_OPTIONS: function() { return /* binding */ VUE_FUNCTION_OPTIONS; },
|
|
55
|
-
/* harmony export */ VUE_VERSION: function() { return /* binding */ VUE_VERSION; }
|
|
56
|
-
/* harmony export */ });
|
|
57
|
-
const MOUNTED_COMPONENTS_KEY = Symbol('MOUNTED_COMPONENTS');
|
|
58
|
-
const MESSAGE_KEY = Symbol('MESSAGE');
|
|
59
|
-
const CONFIG_KEY = Symbol('CONFIG');
|
|
60
|
-
const DEPENDENCIES_KEY = Symbol('DEPENDENCIES');
|
|
61
|
-
const STANDALONE_CONFIG_READY = Symbol('STANDALONE_CONFIG_READY');
|
|
62
|
-
const VUE_FUNCTION_OPTIONS = ['beforeCreate', 'created', 'beforeMount', 'mounted', 'beforeUpdate', 'updated', 'beforeUnmount', 'unmounted', 'errorCaptured', 'renderTracked', 'renderTriggered', 'activated', 'deactivated', 'setup', 'data', 'render'];
|
|
63
|
-
const VUE_VERSION = 3;
|
|
64
|
-
const BASE_DEPENDENCIES = ['react', 'react-dom', '@variousjs/various', 'app'];
|
|
65
|
-
|
|
66
|
-
/***/ }),
|
|
67
|
-
|
|
68
|
-
/***/ "./src/core/connector.ts":
|
|
69
|
-
/*!*******************************!*\
|
|
70
|
-
!*** ./src/core/connector.ts ***!
|
|
71
|
-
\*******************************/
|
|
72
|
-
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
73
|
-
|
|
74
|
-
"use strict";
|
|
75
|
-
__webpack_require__.r(__webpack_exports__);
|
|
76
|
-
/* harmony import */ var _default_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./default-component */ "./src/core/default-component.tsx");
|
|
77
|
-
|
|
78
|
-
class Connector {
|
|
79
|
-
constructor() {
|
|
80
|
-
this.fallbackComponent = _default_component__WEBPACK_IMPORTED_MODULE_0__.Fallback;
|
|
81
|
-
this.errorFallbackComponent = _default_component__WEBPACK_IMPORTED_MODULE_0__.ErrorFallback;
|
|
82
|
-
this.storeActions = {};
|
|
83
|
-
this.componentActions = {};
|
|
84
|
-
this.i18nConfigs = {};
|
|
85
|
-
this.middlewares = {};
|
|
86
|
-
}
|
|
87
|
-
setMiddlewares(m) {
|
|
88
|
-
this.middlewares = m;
|
|
89
|
-
}
|
|
90
|
-
getMiddlewares() {
|
|
91
|
-
return this.middlewares;
|
|
92
|
-
}
|
|
93
|
-
setI18nConfig(module, config) {
|
|
94
|
-
this.i18nConfigs[module] = {
|
|
95
|
-
...this.i18nConfigs[module],
|
|
96
|
-
...config
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
getI18nConfig(module) {
|
|
100
|
-
return this.i18nConfigs[module];
|
|
101
|
-
}
|
|
102
|
-
setGlobalI18nConfig(config) {
|
|
103
|
-
this.globalI18nConfig = {
|
|
104
|
-
...this.globalI18nConfig,
|
|
105
|
-
...config
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
getGlobalI18nConfig() {
|
|
109
|
-
return this.globalI18nConfig;
|
|
110
|
-
}
|
|
111
|
-
setComponentActions(module, actions) {
|
|
112
|
-
this.componentActions[module] = actions;
|
|
113
|
-
}
|
|
114
|
-
deleteComponentActions(module) {
|
|
115
|
-
delete this.componentActions[module];
|
|
116
|
-
}
|
|
117
|
-
getComponentActions(module) {
|
|
118
|
-
return this.componentActions[module];
|
|
119
|
-
}
|
|
120
|
-
setStoreActions(actions) {
|
|
121
|
-
this.storeActions = actions;
|
|
122
|
-
}
|
|
123
|
-
getStoreActions() {
|
|
124
|
-
return this.storeActions;
|
|
125
|
-
}
|
|
126
|
-
setFallbackComponent(fallbackComponent) {
|
|
127
|
-
this.fallbackComponent = fallbackComponent;
|
|
128
|
-
}
|
|
129
|
-
getFallbackComponent() {
|
|
130
|
-
return this.fallbackComponent;
|
|
131
|
-
}
|
|
132
|
-
setErrorFallbackComponent(errorFallbackComponent) {
|
|
133
|
-
this.errorFallbackComponent = errorFallbackComponent;
|
|
134
|
-
}
|
|
135
|
-
getErrorFallbackComponent() {
|
|
136
|
-
return this.errorFallbackComponent;
|
|
137
|
-
}
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region \0@oxc-project+runtime@0.142.0/helpers/esm/toPrimitive.js
|
|
13
|
+
function toPrimitive(t, r) {
|
|
14
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
15
|
+
var e = t[Symbol.toPrimitive];
|
|
16
|
+
if (void 0 !== e) {
|
|
17
|
+
var i = e.call(t, r || "default");
|
|
18
|
+
if ("object" != _typeof(i)) return i;
|
|
19
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
20
|
+
}
|
|
21
|
+
return ("string" === r ? String : Number)(t);
|
|
138
22
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region \0@oxc-project+runtime@0.142.0/helpers/esm/toPropertyKey.js
|
|
25
|
+
function toPropertyKey(t) {
|
|
26
|
+
var i = toPrimitive(t, "string");
|
|
27
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region \0@oxc-project+runtime@0.142.0/helpers/esm/defineProperty.js
|
|
31
|
+
function _defineProperty(e, r, t) {
|
|
32
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
33
|
+
value: t,
|
|
34
|
+
enumerable: !0,
|
|
35
|
+
configurable: !0,
|
|
36
|
+
writable: !0
|
|
37
|
+
}) : e[r] = t, e;
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region \0@oxc-project+runtime@0.142.0/helpers/esm/objectSpread2.js
|
|
41
|
+
function ownKeys(e, r) {
|
|
42
|
+
var t = Object.keys(e);
|
|
43
|
+
if (Object.getOwnPropertySymbols) {
|
|
44
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
45
|
+
r && (o = o.filter(function(r) {
|
|
46
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
47
|
+
})), t.push.apply(t, o);
|
|
48
|
+
}
|
|
49
|
+
return t;
|
|
50
|
+
}
|
|
51
|
+
function _objectSpread2(e) {
|
|
52
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
53
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
54
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
|
|
55
|
+
_defineProperty(e, r, t[r]);
|
|
56
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
57
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return e;
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region node_modules/nycticorax/dist/esm/index.js
|
|
64
|
+
var o = {
|
|
65
|
+
17(t) {
|
|
66
|
+
t.exports = function t(e, r) {
|
|
67
|
+
if (e === r) return !0;
|
|
68
|
+
if (e && r && "object" == typeof e && "object" == typeof r) {
|
|
69
|
+
if (e.constructor !== r.constructor) return !1;
|
|
70
|
+
var s, o, n;
|
|
71
|
+
if (Array.isArray(e)) {
|
|
72
|
+
if ((s = e.length) != r.length) return !1;
|
|
73
|
+
for (o = s; 0 !== o--;) if (!t(e[o], r[o])) return !1;
|
|
74
|
+
return !0;
|
|
75
|
+
}
|
|
76
|
+
if (e.constructor === RegExp) return e.source === r.source && e.flags === r.flags;
|
|
77
|
+
if (e.valueOf !== Object.prototype.valueOf) return e.valueOf() === r.valueOf();
|
|
78
|
+
if (e.toString !== Object.prototype.toString) return e.toString() === r.toString();
|
|
79
|
+
if ((s = (n = Object.keys(e)).length) !== Object.keys(r).length) return !1;
|
|
80
|
+
for (o = s; 0 !== o--;) if (!Object.prototype.hasOwnProperty.call(r, n[o])) return !1;
|
|
81
|
+
for (o = s; 0 !== o--;) {
|
|
82
|
+
var i = n[o];
|
|
83
|
+
if (!t(e[i], r[i])) return !1;
|
|
84
|
+
}
|
|
85
|
+
return !0;
|
|
86
|
+
}
|
|
87
|
+
return e != e && r != r;
|
|
88
|
+
};
|
|
89
|
+
},
|
|
90
|
+
232(t, e, r) {
|
|
91
|
+
r.d(e, { A: () => u });
|
|
92
|
+
var s = r(705), o = r(17), n = r.n(o);
|
|
93
|
+
function i(t, e = /* @__PURE__ */ new WeakMap()) {
|
|
94
|
+
if ("object" != typeof t || null === t) return t;
|
|
95
|
+
if (e.has(t)) return e.get(t);
|
|
96
|
+
const r = Array.isArray(t) ? [] : {};
|
|
97
|
+
e.set(t, r);
|
|
98
|
+
const s = Reflect.ownKeys(t);
|
|
99
|
+
for (const o of s) r[o] = i(t[o], e);
|
|
100
|
+
return r;
|
|
101
|
+
}
|
|
102
|
+
class u {
|
|
103
|
+
constructor() {
|
|
104
|
+
var t;
|
|
105
|
+
(0, s.A)(this, "state", void 0), (0, s.A)(this, "listeners", void 0), (0, s.A)(this, "emits", void 0), (0, s.A)(this, "timer", void 0), (0, s.A)(this, "onStateChange", void 0), (0, s.A)(this, "getStore", void 0), (0, s.A)(this, "createStore", (t) => {
|
|
106
|
+
this.listeners = Reflect.ownKeys(t).reduce((e, r) => {
|
|
107
|
+
const s = r;
|
|
108
|
+
return this.state[s] = t[s], _objectSpread2(_objectSpread2({}, e), {}, { [r]: [] });
|
|
109
|
+
}, {});
|
|
110
|
+
}), (0, s.A)(this, "subscribe", (t) => {
|
|
111
|
+
const e = {};
|
|
112
|
+
return Reflect.ownKeys(t).forEach((r) => {
|
|
113
|
+
const s = r;
|
|
114
|
+
this.listeners[s] || (this.listeners[s] = []), this.listeners[s].push(t[s]), e[s] = t[s];
|
|
115
|
+
}), () => {
|
|
116
|
+
Reflect.ownKeys(e).forEach((t) => {
|
|
117
|
+
const r = t;
|
|
118
|
+
this.listeners[r] = this.listeners[r].filter((t) => t !== e[r]);
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
}), (0, s.A)(this, "emit", (t, e) => {
|
|
122
|
+
this.emits = _objectSpread2(_objectSpread2({}, this.emits), t), e ? this.trigger() : (clearTimeout(this.timer), this.timer = setTimeout(this.trigger));
|
|
123
|
+
}), (0, s.A)(this, "dispatch", (t, ...e) => t({
|
|
124
|
+
getStore: this.getStore,
|
|
125
|
+
emit: (t) => this.emit(t, !0)
|
|
126
|
+
}, ...e)), (0, s.A)(this, "trigger", () => {
|
|
127
|
+
const t = this.emits, e = [], r = Reflect.ownKeys(t);
|
|
128
|
+
for (let s = 0; s < r.length; s += 1) {
|
|
129
|
+
const o = r[s];
|
|
130
|
+
if (n()(this.state[o], t[o])) continue;
|
|
131
|
+
const u = t[o], c = this.state[o];
|
|
132
|
+
this.state[o] = i(t[o]), e.push({
|
|
133
|
+
key: o,
|
|
134
|
+
newValue: u,
|
|
135
|
+
oldValue: c
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
const s = {};
|
|
139
|
+
e.forEach((t) => {
|
|
140
|
+
s[t.key] = [t.newValue, t.oldValue], this.listeners[t.key] && this.listeners[t.key].forEach((e) => e(t.newValue, t.oldValue));
|
|
141
|
+
}), e.length && this.onStateChange(s), this.emits = {}, this.timer = void 0;
|
|
142
|
+
}), this.state = {}, this.listeners = {}, this.emits = {}, this.timer = void 0, this.onStateChange = () => null, this.getStore = (t = this.state, function(e) {
|
|
143
|
+
return e ? i(t[e]) : t;
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
set onChange(t) {
|
|
147
|
+
this.onStateChange = t;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
705(t, e, r) {
|
|
152
|
+
function s(t) {
|
|
153
|
+
return s = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
|
154
|
+
return typeof t;
|
|
155
|
+
} : function(t) {
|
|
156
|
+
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
157
|
+
}, s(t);
|
|
158
|
+
}
|
|
159
|
+
function o(t, e, r) {
|
|
160
|
+
return (e = function(t) {
|
|
161
|
+
var e = function(t) {
|
|
162
|
+
if ("object" != s(t) || !t) return t;
|
|
163
|
+
var e = t[Symbol.toPrimitive];
|
|
164
|
+
if (void 0 !== e) {
|
|
165
|
+
var r = e.call(t, "string");
|
|
166
|
+
if ("object" != s(r)) return r;
|
|
167
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
168
|
+
}
|
|
169
|
+
return String(t);
|
|
170
|
+
}(t);
|
|
171
|
+
return "symbol" == s(e) ? e : e + "";
|
|
172
|
+
}(e)) in t ? Object.defineProperty(t, e, {
|
|
173
|
+
value: r,
|
|
174
|
+
enumerable: !0,
|
|
175
|
+
configurable: !0,
|
|
176
|
+
writable: !0
|
|
177
|
+
}) : t[e] = r, t;
|
|
178
|
+
}
|
|
179
|
+
r.d(e, { A: () => o });
|
|
180
|
+
}
|
|
189
181
|
};
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
});
|
|
255
|
-
(0,_helper__WEBPACK_IMPORTED_MODULE_3__.resetDependencyConfig)(module);
|
|
256
|
-
logOnError(error);
|
|
257
|
-
reject(error);
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
const defaultModule = 'default' in C ? C.default : C;
|
|
261
|
-
const actualModule = !entry ? defaultModule : C[entry];
|
|
262
|
-
if (actualModule === undefined && entry) {
|
|
263
|
-
const error = new _helper__WEBPACK_IMPORTED_MODULE_3__.VariousError({
|
|
264
|
-
module,
|
|
265
|
-
type: 'SUBMODULE_NOT_DEFINED',
|
|
266
|
-
originalError: new Error(`submodule "${entry}" not defined`)
|
|
267
|
-
});
|
|
268
|
-
(0,_helper__WEBPACK_IMPORTED_MODULE_3__.resetDependencyConfig)(module);
|
|
269
|
-
logOnError(error);
|
|
270
|
-
reject(error);
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
resolve(actualModule);
|
|
274
|
-
}, e => {
|
|
275
|
-
const [requireModule] = e.requireModules;
|
|
276
|
-
(0,_helper__WEBPACK_IMPORTED_MODULE_3__.resetDependencyConfig)(module, url);
|
|
277
|
-
(0,_helper__WEBPACK_IMPORTED_MODULE_3__.resetDependencyConfig)(requireModule);
|
|
278
|
-
let errorType = 'LOADING_ERROR';
|
|
279
|
-
if (requireModule !== name) {
|
|
280
|
-
errorType = 'SUBMODULE_LOADING_ERROR';
|
|
281
|
-
}
|
|
282
|
-
if (!e.message.includes('https://requirejs.org/docs/errors.html')) {
|
|
283
|
-
errorType = requireModule === name ? 'SCRIPT_ERROR' : 'SUBMODULE_SCRIPT_ERROR';
|
|
284
|
-
}
|
|
285
|
-
const error = new _helper__WEBPACK_IMPORTED_MODULE_3__.VariousError({
|
|
286
|
-
module: requireModule,
|
|
287
|
-
type: errorType,
|
|
288
|
-
originalError: e
|
|
289
|
-
});
|
|
290
|
-
logOnError(error);
|
|
291
|
-
reject(error);
|
|
292
|
-
});
|
|
293
|
-
});
|
|
182
|
+
var n = {};
|
|
183
|
+
function i(t) {
|
|
184
|
+
var e = n[t];
|
|
185
|
+
if (void 0 !== e) return e.exports;
|
|
186
|
+
var r = n[t] = { exports: {} };
|
|
187
|
+
return o[t](r, r.exports, i), r.exports;
|
|
188
|
+
}
|
|
189
|
+
i.n = (t) => {
|
|
190
|
+
var e = t && t.__esModule ? () => t.default : () => t;
|
|
191
|
+
return i.d(e, { a: e }), e;
|
|
192
|
+
}, i.d = (t, e) => {
|
|
193
|
+
for (var r in e) i.o(e, r) && !i.o(t, r) && Object.defineProperty(t, r, {
|
|
194
|
+
enumerable: !0,
|
|
195
|
+
get: e[r]
|
|
196
|
+
});
|
|
197
|
+
}, i.o = (t, e) => Object.prototype.hasOwnProperty.call(t, e);
|
|
198
|
+
var u = i(705);
|
|
199
|
+
var c = i(232);
|
|
200
|
+
var a = [
|
|
201
|
+
"name",
|
|
202
|
+
"prototype",
|
|
203
|
+
"length",
|
|
204
|
+
"getDerivedStateFromProps",
|
|
205
|
+
"getDerivedStateFromError"
|
|
206
|
+
];
|
|
207
|
+
var f = class extends c.A {
|
|
208
|
+
constructor(...o) {
|
|
209
|
+
super(...o), (0, u.A)(this, "connect", function(r) {
|
|
210
|
+
const { getStore: s, subscribe: o } = r;
|
|
211
|
+
return function(...r) {
|
|
212
|
+
return function(n) {
|
|
213
|
+
class i extends Component {
|
|
214
|
+
constructor(t) {
|
|
215
|
+
super(t), (0, u.A)(this, "unsubscribe", void 0), (0, u.A)(this, "state", { props: s() }), this.unsubscribe = o(r.reduce((t, e) => _objectSpread2(_objectSpread2({}, t), {}, { [e]: () => {
|
|
216
|
+
this.setState({ props: s() });
|
|
217
|
+
} }), {}));
|
|
218
|
+
}
|
|
219
|
+
componentWillUnmount() {
|
|
220
|
+
this.unsubscribe();
|
|
221
|
+
}
|
|
222
|
+
render() {
|
|
223
|
+
const { props: t } = this.state, r = _objectSpread2(_objectSpread2({}, t), this.props);
|
|
224
|
+
return e.createElement(n, r);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return Reflect.ownKeys(n).forEach((t) => {
|
|
228
|
+
const e = String(t);
|
|
229
|
+
if (!a.includes(e)) {
|
|
230
|
+
const e = Object.getOwnPropertyDescriptor(n, t);
|
|
231
|
+
e && Object.defineProperty(i, t, e);
|
|
232
|
+
}
|
|
233
|
+
}), i;
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
}(this)), (0, u.A)(this, "useStore", function(t) {
|
|
237
|
+
const { getStore: e, subscribe: o } = t;
|
|
238
|
+
return function(...t) {
|
|
239
|
+
const [n, i] = useState(e());
|
|
240
|
+
return useLayoutEffect(() => o(t.reduce((t, r) => _objectSpread2(_objectSpread2({}, t), {}, { [r]: () => {
|
|
241
|
+
i((t) => _objectSpread2(_objectSpread2({}, t), {}, { [r]: e()[r] }));
|
|
242
|
+
} }), {}))), n;
|
|
243
|
+
};
|
|
244
|
+
}(this));
|
|
245
|
+
}
|
|
294
246
|
};
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
247
|
+
var h = f;
|
|
248
|
+
//#endregion
|
|
249
|
+
//#region src/core/store.ts
|
|
250
|
+
var { createStore, getStore, connect, emit, subscribe, dispatch, useStore } = new h();
|
|
251
|
+
function getUserStore() {
|
|
252
|
+
const globalStore = getStore();
|
|
253
|
+
const keys = Object.keys(globalStore);
|
|
254
|
+
const store = {};
|
|
255
|
+
keys.forEach((key) => {
|
|
256
|
+
store[key] = globalStore[key];
|
|
257
|
+
});
|
|
258
|
+
return store;
|
|
259
|
+
}
|
|
260
|
+
//#endregion
|
|
261
|
+
//#region src/core/config.ts
|
|
262
|
+
var MOUNTED_COMPONENTS_KEY = Symbol("MOUNTED_COMPONENTS");
|
|
263
|
+
var MESSAGE_KEY = Symbol("MESSAGE");
|
|
264
|
+
var CONFIG_KEY = Symbol("CONFIG");
|
|
265
|
+
var DEPENDENCIES_KEY = Symbol("DEPENDENCIES");
|
|
266
|
+
var LOCALE_KEY = Symbol("LOCALE");
|
|
267
|
+
var I18NActions = /* @__PURE__ */ function(I18NActions) {
|
|
268
|
+
I18NActions["SetLocale"] = "setLocale";
|
|
269
|
+
I18NActions["GetLocale"] = "getLocale";
|
|
270
|
+
I18NActions["UpdateI18nConfig"] = "updateI18nConfig";
|
|
271
|
+
return I18NActions;
|
|
272
|
+
}({});
|
|
273
|
+
var VUE_FUNCTION_OPTIONS = [
|
|
274
|
+
"beforeCreate",
|
|
275
|
+
"created",
|
|
276
|
+
"beforeMount",
|
|
277
|
+
"mounted",
|
|
278
|
+
"beforeUpdate",
|
|
279
|
+
"updated",
|
|
280
|
+
"beforeUnmount",
|
|
281
|
+
"unmounted",
|
|
282
|
+
"errorCaptured",
|
|
283
|
+
"renderTracked",
|
|
284
|
+
"renderTriggered",
|
|
285
|
+
"activated",
|
|
286
|
+
"deactivated",
|
|
287
|
+
"setup",
|
|
288
|
+
"data",
|
|
289
|
+
"render"
|
|
290
|
+
];
|
|
291
|
+
var BASE_DEPENDENCIES = [
|
|
292
|
+
"react",
|
|
293
|
+
"react-dom",
|
|
294
|
+
"@variousjs/various",
|
|
295
|
+
"app"
|
|
296
|
+
];
|
|
297
|
+
//#endregion
|
|
298
|
+
//#region src/core/logger.ts
|
|
299
|
+
var logger = (args) => {
|
|
300
|
+
var _middlewares$onLog;
|
|
301
|
+
const middlewares = connector_default.getMiddlewares();
|
|
302
|
+
if ((middlewares === null || middlewares === void 0 || (_middlewares$onLog = middlewares.onLog) === null || _middlewares$onLog === void 0 ? void 0 : _middlewares$onLog.call(middlewares, args)) === false) return;
|
|
303
|
+
const color = {
|
|
304
|
+
info: "blue",
|
|
305
|
+
warn: "orange",
|
|
306
|
+
error: "red"
|
|
307
|
+
}[args.level];
|
|
308
|
+
const params = [`%c ${args.module} `, `background:${color};border:1px solid ${color};padding:1px;border-radius:2px 0 0 2px;color: #fff;`];
|
|
309
|
+
if (args.type) {
|
|
310
|
+
params[0] = `${params[0]}%c ${args.type} %c`;
|
|
311
|
+
params.push(`border:1px solid ${color};padding:1px;border-radius:0 2px 2px 0;color:${color};`, "background:transparent");
|
|
312
|
+
}
|
|
313
|
+
if (args.level !== "info") params[0] = ` ${params[0]}`;
|
|
314
|
+
window.console[args.level](...params, args.message);
|
|
322
315
|
};
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
316
|
+
var createLogger = (module) => ({
|
|
317
|
+
info(message, type) {
|
|
318
|
+
logger({
|
|
319
|
+
module,
|
|
320
|
+
level: "info",
|
|
321
|
+
type,
|
|
322
|
+
message
|
|
323
|
+
});
|
|
324
|
+
},
|
|
325
|
+
warn(message, type) {
|
|
326
|
+
logger({
|
|
327
|
+
module,
|
|
328
|
+
level: "warn",
|
|
329
|
+
type,
|
|
330
|
+
message
|
|
331
|
+
});
|
|
332
|
+
},
|
|
333
|
+
error(message, type) {
|
|
334
|
+
var _middlewares$onError;
|
|
335
|
+
const middlewares = connector_default.getMiddlewares();
|
|
336
|
+
const error = message instanceof VariousError ? message : new VariousError({
|
|
337
|
+
module,
|
|
338
|
+
type: type || "unknow",
|
|
339
|
+
originalError: message instanceof Error ? message : new Error(message)
|
|
340
|
+
});
|
|
341
|
+
middlewares === null || middlewares === void 0 || (_middlewares$onError = middlewares.onError) === null || _middlewares$onError === void 0 || _middlewares$onError.call(middlewares, error);
|
|
342
|
+
logger({
|
|
343
|
+
module,
|
|
344
|
+
level: "error",
|
|
345
|
+
type,
|
|
346
|
+
message
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
//#endregion
|
|
351
|
+
//#region src/core/message.ts
|
|
352
|
+
var createPostMessage = (module) => async ({ event, payload }) => {
|
|
353
|
+
const middlewares = connector_default.getMiddlewares();
|
|
354
|
+
const logger = createLogger(module);
|
|
355
|
+
let next = {
|
|
356
|
+
trigger: module,
|
|
357
|
+
event,
|
|
358
|
+
payload
|
|
359
|
+
};
|
|
360
|
+
if (middlewares === null || middlewares === void 0 ? void 0 : middlewares.onMessage) {
|
|
361
|
+
const check = await middlewares.onMessage(next);
|
|
362
|
+
if (check === false) {
|
|
363
|
+
logger.warn("blocked by middleware", "POST_MESSAGE");
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
if (check !== true) next = _objectSpread2(_objectSpread2({}, next), check);
|
|
367
|
+
}
|
|
368
|
+
emit({ [MESSAGE_KEY]: {
|
|
369
|
+
timestamp: +/* @__PURE__ */ new Date(),
|
|
370
|
+
event: next.event,
|
|
371
|
+
trigger: module,
|
|
372
|
+
payload: next.payload
|
|
373
|
+
} });
|
|
335
374
|
};
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
375
|
+
var createOnMessage = (module, onMessage) => subscribe({ [MESSAGE_KEY](v) {
|
|
376
|
+
const { trigger, payload, event } = v;
|
|
377
|
+
if (module !== trigger) onMessage({
|
|
378
|
+
event,
|
|
379
|
+
payload,
|
|
380
|
+
trigger
|
|
381
|
+
});
|
|
382
|
+
} });
|
|
383
|
+
//#endregion
|
|
384
|
+
//#region src/core/i18n.ts
|
|
385
|
+
function createI18nConfig(method, module, callback) {
|
|
386
|
+
if (!method) return;
|
|
387
|
+
const i18nConfig = method();
|
|
388
|
+
if (!isPromiseLike(i18nConfig)) {
|
|
389
|
+
if (module) connector_default.setI18nConfig(module, i18nConfig);
|
|
390
|
+
else connector_default.setGlobalI18nConfig(i18nConfig);
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
if (module) connector_default.setI18nConfig(module, {
|
|
394
|
+
loading: true,
|
|
395
|
+
resources: {}
|
|
396
|
+
});
|
|
397
|
+
else connector_default.setGlobalI18nConfig({
|
|
398
|
+
loading: true,
|
|
399
|
+
resources: {}
|
|
400
|
+
});
|
|
401
|
+
i18nConfig.then((res) => {
|
|
402
|
+
if (module) {
|
|
403
|
+
connector_default.setI18nConfig(module, _objectSpread2(_objectSpread2({}, res), {}, { loading: false }));
|
|
404
|
+
callback === null || callback === void 0 || callback();
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
const locale = getStore(LOCALE_KEY);
|
|
408
|
+
emit({ [LOCALE_KEY]: void 0 }, true);
|
|
409
|
+
emit({ [LOCALE_KEY]: locale }, true);
|
|
410
|
+
connector_default.setGlobalI18nConfig(_objectSpread2(_objectSpread2({}, res), {}, { loading: false }));
|
|
411
|
+
}).catch((e) => {
|
|
412
|
+
onError(new VariousError({
|
|
413
|
+
module: module || "app",
|
|
414
|
+
type: "I18N",
|
|
415
|
+
originalError: e
|
|
416
|
+
}));
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
function createI18n(module, updater) {
|
|
420
|
+
const ctx = (key, params, defaultString) => {
|
|
421
|
+
const i18nConfig = connector_default.getI18nConfig(module) || connector_default.getGlobalI18nConfig();
|
|
422
|
+
let defaultText = defaultString;
|
|
423
|
+
if (defaultText === void 0) defaultText = typeof params === "string" ? params : key;
|
|
424
|
+
if (!i18nConfig) {
|
|
425
|
+
onError(new VariousError({
|
|
426
|
+
module,
|
|
427
|
+
type: "I18N",
|
|
428
|
+
originalError: /* @__PURE__ */ new Error("config not exist")
|
|
429
|
+
}));
|
|
430
|
+
return defaultText;
|
|
431
|
+
}
|
|
432
|
+
if (i18nConfig.loading) return defaultText;
|
|
433
|
+
const { resources } = i18nConfig;
|
|
434
|
+
const locale = getStore(LOCALE_KEY);
|
|
435
|
+
const resource = resources === null || resources === void 0 ? void 0 : resources[locale];
|
|
436
|
+
if (!resource) {
|
|
437
|
+
onError(new VariousError({
|
|
438
|
+
module,
|
|
439
|
+
type: "I18N",
|
|
440
|
+
originalError: /* @__PURE__ */ new Error(`locale resource \`${locale}\` not exist`)
|
|
441
|
+
}));
|
|
442
|
+
return defaultText;
|
|
443
|
+
}
|
|
444
|
+
if (!resource[key]) {
|
|
445
|
+
onError(new VariousError({
|
|
446
|
+
module,
|
|
447
|
+
type: "I18N",
|
|
448
|
+
originalError: /* @__PURE__ */ new Error(`locale key \`${key}\` not exist`)
|
|
449
|
+
}));
|
|
450
|
+
return defaultText;
|
|
451
|
+
}
|
|
452
|
+
const text = resource[key];
|
|
453
|
+
if (!params || typeof params === "string" || Object.prototype.toString.call(params) !== "[object Object]") return text;
|
|
454
|
+
const args = Object.keys(params);
|
|
455
|
+
if (!args.length) return text;
|
|
456
|
+
return args.reduce((next, arg) => {
|
|
457
|
+
const regex = new RegExp(`{\\s*${arg}\\s*}`, "g");
|
|
458
|
+
return next.replace(regex, params[arg].toString());
|
|
459
|
+
}, text);
|
|
460
|
+
};
|
|
461
|
+
ctx.update = (config) => {
|
|
462
|
+
const next = _objectSpread2(_objectSpread2({}, connector_default.getI18nConfig(module)), config);
|
|
463
|
+
connector_default.setI18nConfig(module, next);
|
|
464
|
+
updater();
|
|
465
|
+
};
|
|
466
|
+
return ctx;
|
|
467
|
+
}
|
|
468
|
+
//#endregion
|
|
469
|
+
//#region \0vite/preload-helper.js
|
|
470
|
+
var scriptRel = "modulepreload";
|
|
471
|
+
var assetsURL = function(dep) {
|
|
472
|
+
return "/" + dep;
|
|
422
473
|
};
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
474
|
+
var seen = {};
|
|
475
|
+
var __vitePreload = function preload(baseModule, deps, importerUrl) {
|
|
476
|
+
let promise = Promise.resolve();
|
|
477
|
+
if (deps && deps.length > 0) {
|
|
478
|
+
const links = document.getElementsByTagName("link");
|
|
479
|
+
const cspNonceMeta = document.querySelector("meta[property=csp-nonce]");
|
|
480
|
+
const cspNonce = (cspNonceMeta === null || cspNonceMeta === void 0 ? void 0 : cspNonceMeta.nonce) || (cspNonceMeta === null || cspNonceMeta === void 0 ? void 0 : cspNonceMeta.getAttribute("nonce"));
|
|
481
|
+
function allSettled(promises) {
|
|
482
|
+
return Promise.all(promises.map((p) => Promise.resolve(p).then((value) => ({
|
|
483
|
+
status: "fulfilled",
|
|
484
|
+
value
|
|
485
|
+
}), (reason) => ({
|
|
486
|
+
status: "rejected",
|
|
487
|
+
reason
|
|
488
|
+
}))));
|
|
489
|
+
}
|
|
490
|
+
function importMetaResolve(specifier) {
|
|
491
|
+
if (import.meta.resolve) return import.meta.resolve(specifier);
|
|
492
|
+
return new URL(
|
|
493
|
+
specifier,
|
|
494
|
+
/** #__KEEP__ */
|
|
495
|
+
import.meta.url
|
|
496
|
+
).href;
|
|
497
|
+
}
|
|
498
|
+
promise = allSettled(deps.map((dep) => {
|
|
499
|
+
dep = assetsURL(dep, importerUrl);
|
|
500
|
+
dep = importMetaResolve(dep);
|
|
501
|
+
if (dep in seen) return;
|
|
502
|
+
seen[dep] = true;
|
|
503
|
+
const isCss = dep.endsWith(".css");
|
|
504
|
+
for (let i = links.length - 1; i >= 0; i--) {
|
|
505
|
+
const link = links[i];
|
|
506
|
+
if (link.href === dep && (!isCss || link.rel === "stylesheet")) return;
|
|
507
|
+
}
|
|
508
|
+
const link = document.createElement("link");
|
|
509
|
+
link.rel = isCss ? "stylesheet" : scriptRel;
|
|
510
|
+
if (!isCss) link.as = "script";
|
|
511
|
+
link.crossOrigin = "";
|
|
512
|
+
link.href = dep;
|
|
513
|
+
if (cspNonce) link.setAttribute("nonce", cspNonce);
|
|
514
|
+
document.head.appendChild(link);
|
|
515
|
+
if (isCss) return new Promise((res, rej) => {
|
|
516
|
+
link.addEventListener("load", res);
|
|
517
|
+
link.addEventListener("error", () => rej(/* @__PURE__ */ new Error(`Unable to preload CSS for ${dep}`)));
|
|
518
|
+
});
|
|
519
|
+
}));
|
|
520
|
+
}
|
|
521
|
+
function handlePreloadError(err) {
|
|
522
|
+
const e = new Event("vite:preloadError", { cancelable: true });
|
|
523
|
+
e.payload = err;
|
|
524
|
+
window.dispatchEvent(e);
|
|
525
|
+
if (!e.defaultPrevented) throw err;
|
|
526
|
+
}
|
|
527
|
+
return promise.then((res) => {
|
|
528
|
+
for (const item of res || []) {
|
|
529
|
+
if (item.status !== "rejected") continue;
|
|
530
|
+
handlePreloadError(item.reason);
|
|
531
|
+
}
|
|
532
|
+
return baseModule().catch(handlePreloadError);
|
|
533
|
+
});
|
|
534
|
+
};
|
|
535
|
+
//#endregion
|
|
536
|
+
//#region src/core/system.ts
|
|
537
|
+
function getRegistry() {
|
|
538
|
+
if (!window.__various) window.__various = {
|
|
539
|
+
modules: /* @__PURE__ */ new Map(),
|
|
540
|
+
urls: /* @__PURE__ */ new Map(),
|
|
541
|
+
loaded: /* @__PURE__ */ new Map()
|
|
542
|
+
};
|
|
543
|
+
return window.__various;
|
|
486
544
|
}
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
/*
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
return {
|
|
537
|
-
name,
|
|
538
|
-
entry
|
|
539
|
-
};
|
|
545
|
+
var { modules: moduleRegistry, urls: moduleUrls, loaded: loadedModules } = getRegistry();
|
|
546
|
+
function resolveUrl(url) {
|
|
547
|
+
if (url.startsWith("http") || url.startsWith("/") || url.startsWith("blob:")) return url;
|
|
548
|
+
return new URL(url, document.baseURI).href;
|
|
549
|
+
}
|
|
550
|
+
function setModuleUrl(name, url) {
|
|
551
|
+
moduleUrls.set(name, url);
|
|
552
|
+
}
|
|
553
|
+
function getModuleUrl(name) {
|
|
554
|
+
return moduleUrls.get(name);
|
|
555
|
+
}
|
|
556
|
+
async function importModule(name) {
|
|
557
|
+
const url = moduleUrls.get(name);
|
|
558
|
+
if (url) {
|
|
559
|
+
const absoluteUrl = resolveUrl(url);
|
|
560
|
+
if (loadedModules.has(absoluteUrl)) return loadedModules.get(absoluteUrl);
|
|
561
|
+
const mod = await __vitePreload(() => import(
|
|
562
|
+
/* @vite-ignore */
|
|
563
|
+
absoluteUrl
|
|
564
|
+
), []);
|
|
565
|
+
loadedModules.set(absoluteUrl, mod);
|
|
566
|
+
return mod;
|
|
567
|
+
}
|
|
568
|
+
if (moduleRegistry.has(name)) return moduleRegistry.get(name);
|
|
569
|
+
throw new Error(`module "${name}" not defined`);
|
|
570
|
+
}
|
|
571
|
+
function isModuleDefined(name) {
|
|
572
|
+
if (moduleRegistry.has(name)) return true;
|
|
573
|
+
const url = moduleUrls.get(name);
|
|
574
|
+
if (url && loadedModules.has(resolveUrl(url))) return true;
|
|
575
|
+
return false;
|
|
576
|
+
}
|
|
577
|
+
function isModuleSpecified$1(name) {
|
|
578
|
+
return moduleUrls.has(name) || isModuleDefined(name);
|
|
579
|
+
}
|
|
580
|
+
function deleteModule(name) {
|
|
581
|
+
moduleRegistry.delete(name);
|
|
582
|
+
const url = moduleUrls.get(name);
|
|
583
|
+
if (url) loadedModules.delete(resolveUrl(url));
|
|
584
|
+
}
|
|
585
|
+
//#endregion
|
|
586
|
+
//#region src/core/helper.ts
|
|
587
|
+
var getUrlHash = (url) => `${url}?${+/* @__PURE__ */ new Date()}`;
|
|
588
|
+
var getModuleInfo = (module) => {
|
|
589
|
+
const [name, entry] = module.split(".");
|
|
590
|
+
return {
|
|
591
|
+
name,
|
|
592
|
+
entry
|
|
593
|
+
};
|
|
540
594
|
};
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
});
|
|
545
|
-
const removeLoadedModules = modules => {
|
|
546
|
-
modules.forEach(module => {
|
|
547
|
-
const {
|
|
548
|
-
name
|
|
549
|
-
} = getModuleInfo(module);
|
|
550
|
-
if (!_config__WEBPACK_IMPORTED_MODULE_2__.BASE_DEPENDENCIES.includes(name)) {
|
|
551
|
-
window.requirejs.undef(name);
|
|
552
|
-
}
|
|
553
|
-
});
|
|
595
|
+
var preloadModules = (modules) => {
|
|
596
|
+
const names = modules.map((m) => getModuleInfo(m).name);
|
|
597
|
+
return Promise.all(names.map((n) => importModule(n))).then(() => void 0);
|
|
554
598
|
};
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
next[name] = `${deps[name]}#${name}`;
|
|
561
|
-
window.requirejs.undef(name);
|
|
562
|
-
}
|
|
563
|
-
});
|
|
564
|
-
window.requirejs.config({
|
|
565
|
-
paths: next
|
|
566
|
-
});
|
|
567
|
-
(0,_store__WEBPACK_IMPORTED_MODULE_0__.emit)({
|
|
568
|
-
[_config__WEBPACK_IMPORTED_MODULE_2__.DEPENDENCIES_KEY]: {
|
|
569
|
-
...dependencies,
|
|
570
|
-
...next
|
|
571
|
-
}
|
|
572
|
-
}, true);
|
|
599
|
+
var removeLoadedModules = (modules) => {
|
|
600
|
+
modules.forEach((module) => {
|
|
601
|
+
const { name } = getModuleInfo(module);
|
|
602
|
+
if (!BASE_DEPENDENCIES.includes(name)) deleteModule(name);
|
|
603
|
+
});
|
|
573
604
|
};
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
605
|
+
var defineDependencies = (deps) => {
|
|
606
|
+
const dependencies = getStore(DEPENDENCIES_KEY);
|
|
607
|
+
const next = {};
|
|
608
|
+
Object.keys(deps).forEach((name) => {
|
|
609
|
+
if (!BASE_DEPENDENCIES.includes(name)) {
|
|
610
|
+
next[name] = deps[name];
|
|
611
|
+
if (getModuleUrl(name) !== deps[name]) deleteModule(name);
|
|
612
|
+
setModuleUrl(name, deps[name]);
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
emit({ [DEPENDENCIES_KEY]: _objectSpread2(_objectSpread2({}, dependencies), next) }, true);
|
|
579
616
|
};
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
} = getModuleInfo(module);
|
|
584
|
-
return window.requirejs.specified(name);
|
|
617
|
+
var isModuleLoaded = (module) => {
|
|
618
|
+
const { name } = getModuleInfo(module);
|
|
619
|
+
return isModuleDefined(name);
|
|
585
620
|
};
|
|
586
|
-
|
|
587
|
-
const
|
|
588
|
-
|
|
589
|
-
if (modules.every(m => getMountedComponents().includes(m))) {
|
|
590
|
-
callback();
|
|
591
|
-
}
|
|
592
|
-
const unSubscribe = (0,_store__WEBPACK_IMPORTED_MODULE_0__.subscribe)({
|
|
593
|
-
[_config__WEBPACK_IMPORTED_MODULE_2__.MOUNTED_COMPONENTS_KEY](value) {
|
|
594
|
-
if (modules.every(n => value.includes(n))) {
|
|
595
|
-
unSubscribe();
|
|
596
|
-
callback();
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
});
|
|
600
|
-
return unSubscribe;
|
|
621
|
+
var isModuleSpecified = (module) => {
|
|
622
|
+
const { name } = getModuleInfo(module);
|
|
623
|
+
return isModuleSpecified$1(name);
|
|
601
624
|
};
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
paths: {
|
|
627
|
-
[name]: path
|
|
628
|
-
}
|
|
629
|
-
});
|
|
625
|
+
var getMountedComponents = () => getStore(MOUNTED_COMPONENTS_KEY);
|
|
626
|
+
var onComponentMounted = (module, callback) => {
|
|
627
|
+
const modules = Array.isArray(module) ? module : [module];
|
|
628
|
+
if (modules.every((m) => getMountedComponents().includes(m))) callback();
|
|
629
|
+
const unSubscribe = subscribe({ [MOUNTED_COMPONENTS_KEY](value) {
|
|
630
|
+
if (modules.every((n) => value.includes(n))) {
|
|
631
|
+
unSubscribe();
|
|
632
|
+
callback();
|
|
633
|
+
}
|
|
634
|
+
} });
|
|
635
|
+
return unSubscribe;
|
|
636
|
+
};
|
|
637
|
+
var resetDependencyConfig = (module, url) => {
|
|
638
|
+
const { name } = getModuleInfo(module);
|
|
639
|
+
const dependencies = getStore(DEPENDENCIES_KEY);
|
|
640
|
+
if (url && isModuleDefined(name)) return;
|
|
641
|
+
if (!dependencies[name] && url) {
|
|
642
|
+
setModuleUrl(name, url);
|
|
643
|
+
return;
|
|
644
|
+
}
|
|
645
|
+
let moduleUrl = getUrlHash(dependencies[name]);
|
|
646
|
+
if (url) moduleUrl = getUrlHash(url);
|
|
647
|
+
deleteModule(name);
|
|
648
|
+
setModuleUrl(name, moduleUrl);
|
|
630
649
|
};
|
|
631
650
|
function getConfig() {
|
|
632
|
-
|
|
651
|
+
return getStore(CONFIG_KEY);
|
|
633
652
|
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
653
|
+
var onError = (e) => {
|
|
654
|
+
const { module, type } = e;
|
|
655
|
+
createLogger(module).error(e, type);
|
|
656
|
+
};
|
|
657
|
+
var VariousError = class extends Error {
|
|
658
|
+
constructor(data) {
|
|
659
|
+
super(data.originalError.message);
|
|
660
|
+
_defineProperty(this, "type", void 0);
|
|
661
|
+
_defineProperty(this, "originalError", void 0);
|
|
662
|
+
_defineProperty(this, "module", void 0);
|
|
663
|
+
this.type = data.type;
|
|
664
|
+
this.originalError = data.originalError;
|
|
665
|
+
this.module = data.module;
|
|
666
|
+
}
|
|
641
667
|
};
|
|
642
|
-
class VariousError extends Error {
|
|
643
|
-
constructor(data) {
|
|
644
|
-
super(data.originalError.message);
|
|
645
|
-
this.type = data.type;
|
|
646
|
-
this.originalError = data.originalError;
|
|
647
|
-
this.module = data.module;
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
668
|
function checkReactComponent(component, module) {
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
669
|
+
return new Promise((reslove, reject) => {
|
|
670
|
+
var _component$prototype;
|
|
671
|
+
if (component.$$typeof || ((_component$prototype = component.prototype) === null || _component$prototype === void 0 ? void 0 : _component$prototype.isReactComponent) || typeof component === "function") {
|
|
672
|
+
reslove();
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
reject(new VariousError({
|
|
676
|
+
module,
|
|
677
|
+
originalError: /* @__PURE__ */ new Error("not a valid React component"),
|
|
678
|
+
type: "INVALID_COMPONENT"
|
|
679
|
+
}));
|
|
680
|
+
});
|
|
662
681
|
}
|
|
663
682
|
function isPromiseLike(value) {
|
|
664
|
-
|
|
683
|
+
return value != null && typeof value.then === "function";
|
|
665
684
|
}
|
|
666
685
|
function checkVueComponent(component, module) {
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
686
|
+
const versionRegex = new RegExp(`^3\\.`);
|
|
687
|
+
return new Promise((resolve, reject) => {
|
|
688
|
+
importModule("vue").then((Vue) => {
|
|
689
|
+
const vueObj = Vue.default || Vue;
|
|
690
|
+
if (!versionRegex.test(vueObj.version)) {
|
|
691
|
+
reject(/* @__PURE__ */ new Error(`Vue 3+ required, detected an incompatible version`));
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
if (typeof (component === null || component === void 0 ? void 0 : component.render) === "function" || typeof (component === null || component === void 0 ? void 0 : component.setup) === "function") {
|
|
695
|
+
resolve();
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
698
|
+
reject(new VariousError({
|
|
699
|
+
module,
|
|
700
|
+
originalError: /* @__PURE__ */ new Error("not a valid Vue component"),
|
|
701
|
+
type: "INVALID_COMPONENT"
|
|
702
|
+
}));
|
|
703
|
+
}).catch(reject);
|
|
704
|
+
});
|
|
684
705
|
}
|
|
685
706
|
function parseComponentActions(params) {
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
if (type === 'vue3' && _config__WEBPACK_IMPORTED_MODULE_2__.VUE_FUNCTION_OPTIONS.includes(method)) {
|
|
708
|
-
return;
|
|
709
|
-
}
|
|
710
|
-
actions[method] = componentNode[method];
|
|
711
|
-
});
|
|
712
|
-
if (i18nAction) {
|
|
713
|
-
(0,_i18n__WEBPACK_IMPORTED_MODULE_5__.createI18nConfig)(i18nAction, module, i18nUpdate);
|
|
714
|
-
}
|
|
715
|
-
_connector__WEBPACK_IMPORTED_MODULE_3__["default"].setComponentActions(module, actions);
|
|
716
|
-
if (onMessageAction) {
|
|
717
|
-
return (0,_message__WEBPACK_IMPORTED_MODULE_4__.createOnMessage)(module, onMessageAction);
|
|
718
|
-
}
|
|
719
|
-
return () => null;
|
|
707
|
+
const { componentNode, module, type, i18nUpdate } = params;
|
|
708
|
+
const actions = {};
|
|
709
|
+
let onMessageAction;
|
|
710
|
+
let i18nAction;
|
|
711
|
+
Object.getOwnPropertyNames(componentNode).forEach((method) => {
|
|
712
|
+
if (typeof componentNode[method] !== "function") return;
|
|
713
|
+
if (method === "$onMessage") {
|
|
714
|
+
onMessageAction = componentNode[method];
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
if (method === "$i18n") {
|
|
718
|
+
i18nAction = componentNode[method];
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
if (type === "vue3" && VUE_FUNCTION_OPTIONS.includes(method)) return;
|
|
722
|
+
actions[method] = componentNode[method];
|
|
723
|
+
});
|
|
724
|
+
if (i18nAction) createI18nConfig(i18nAction, module, i18nUpdate);
|
|
725
|
+
connector_default.setComponentActions(module, actions);
|
|
726
|
+
if (onMessageAction) return createOnMessage(module, onMessageAction);
|
|
727
|
+
return () => null;
|
|
720
728
|
}
|
|
721
729
|
function updateMountedComponent(module) {
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
}
|
|
726
|
-
(0,_store__WEBPACK_IMPORTED_MODULE_0__.emit)({
|
|
727
|
-
[_config__WEBPACK_IMPORTED_MODULE_2__.MOUNTED_COMPONENTS_KEY]: mountedComponents
|
|
728
|
-
}, true);
|
|
730
|
+
const mountedComponents = getMountedComponents();
|
|
731
|
+
if (!mountedComponents.includes(module)) mountedComponents.push(module);
|
|
732
|
+
emit({ [MOUNTED_COMPONENTS_KEY]: mountedComponents }, true);
|
|
729
733
|
}
|
|
730
734
|
function updateUnMountComponent(module) {
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
}, true);
|
|
736
|
-
_connector__WEBPACK_IMPORTED_MODULE_3__["default"].deleteComponentActions(module);
|
|
735
|
+
let mountedComponents = getMountedComponents();
|
|
736
|
+
mountedComponents = mountedComponents.filter((item) => item !== module);
|
|
737
|
+
emit({ [MOUNTED_COMPONENTS_KEY]: mountedComponents }, true);
|
|
738
|
+
connector_default.deleteComponentActions(module);
|
|
737
739
|
}
|
|
738
740
|
function getSelfInfo(params) {
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
} = getModuleInfo(module);
|
|
747
|
-
return {
|
|
748
|
-
module,
|
|
749
|
-
url: url || dependencies[name]
|
|
750
|
-
};
|
|
741
|
+
const { module, url } = params;
|
|
742
|
+
const dependencies = getStore(DEPENDENCIES_KEY);
|
|
743
|
+
const { name } = getModuleInfo(module);
|
|
744
|
+
return {
|
|
745
|
+
module,
|
|
746
|
+
url: url || dependencies[name] || getModuleUrl(name) || ""
|
|
747
|
+
};
|
|
751
748
|
}
|
|
752
749
|
function getClassNameWithModule(module, prefix) {
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
entry
|
|
756
|
-
} = getModuleInfo(module);
|
|
757
|
-
return `${prefix} ${[name, entry].filter(Boolean).join('-')}`;
|
|
750
|
+
const { name, entry } = getModuleInfo(module);
|
|
751
|
+
return `${prefix} ${[name, entry].filter(Boolean).join("-")}`;
|
|
758
752
|
}
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
753
|
+
//#endregion
|
|
754
|
+
//#region src/core/default-component.tsx
|
|
755
|
+
var Fallback = (props) => {
|
|
756
|
+
const className = getClassNameWithModule(props.$self.module, "various-component-fallback");
|
|
757
|
+
return /* @__PURE__ */ e.createElement("div", { className }, "Loading");
|
|
758
|
+
};
|
|
759
|
+
var ErrorFallback = ({ $error, $reload, $self }) => {
|
|
760
|
+
const className = getClassNameWithModule($self.module, "various-component-error_fallback");
|
|
761
|
+
return /* @__PURE__ */ e.createElement("div", { className }, /* @__PURE__ */ e.createElement("h3", null, $error.type), /* @__PURE__ */ e.createElement("p", null, $error.message), /* @__PURE__ */ e.createElement("button", {
|
|
762
|
+
type: "button",
|
|
763
|
+
onClick: $reload
|
|
764
|
+
}, "Reload"));
|
|
765
|
+
};
|
|
766
|
+
var Root = () => /* @__PURE__ */ e.createElement("div", null, "App Container is not defined");
|
|
767
|
+
//#endregion
|
|
768
|
+
//#region src/core/connector.ts
|
|
769
|
+
var Connector = class {
|
|
770
|
+
constructor() {
|
|
771
|
+
_defineProperty(this, "fallbackComponent", void 0);
|
|
772
|
+
_defineProperty(this, "errorFallbackComponent", void 0);
|
|
773
|
+
_defineProperty(this, "storeActions", void 0);
|
|
774
|
+
_defineProperty(this, "componentActions", void 0);
|
|
775
|
+
_defineProperty(this, "i18nConfigs", void 0);
|
|
776
|
+
_defineProperty(this, "globalI18nConfig", void 0);
|
|
777
|
+
_defineProperty(this, "middlewares", void 0);
|
|
778
|
+
this.fallbackComponent = Fallback;
|
|
779
|
+
this.errorFallbackComponent = ErrorFallback;
|
|
780
|
+
this.storeActions = {};
|
|
781
|
+
this.componentActions = {};
|
|
782
|
+
this.i18nConfigs = {};
|
|
783
|
+
this.middlewares = {};
|
|
784
|
+
}
|
|
785
|
+
setMiddlewares(m) {
|
|
786
|
+
this.middlewares = m;
|
|
787
|
+
}
|
|
788
|
+
getMiddlewares() {
|
|
789
|
+
return this.middlewares;
|
|
790
|
+
}
|
|
791
|
+
setI18nConfig(module, config) {
|
|
792
|
+
this.i18nConfigs[module] = _objectSpread2(_objectSpread2({}, this.i18nConfigs[module]), config);
|
|
793
|
+
}
|
|
794
|
+
getI18nConfig(module) {
|
|
795
|
+
return this.i18nConfigs[module];
|
|
796
|
+
}
|
|
797
|
+
setGlobalI18nConfig(config) {
|
|
798
|
+
this.globalI18nConfig = _objectSpread2(_objectSpread2({}, this.globalI18nConfig), config);
|
|
799
|
+
}
|
|
800
|
+
getGlobalI18nConfig() {
|
|
801
|
+
return this.globalI18nConfig;
|
|
802
|
+
}
|
|
803
|
+
setComponentActions(module, actions) {
|
|
804
|
+
this.componentActions[module] = actions;
|
|
805
|
+
}
|
|
806
|
+
deleteComponentActions(module) {
|
|
807
|
+
delete this.componentActions[module];
|
|
808
|
+
}
|
|
809
|
+
getComponentActions(module) {
|
|
810
|
+
return this.componentActions[module];
|
|
811
|
+
}
|
|
812
|
+
setStoreActions(actions) {
|
|
813
|
+
this.storeActions = actions;
|
|
814
|
+
}
|
|
815
|
+
getStoreActions() {
|
|
816
|
+
return this.storeActions;
|
|
817
|
+
}
|
|
818
|
+
setFallbackComponent(fallbackComponent) {
|
|
819
|
+
this.fallbackComponent = fallbackComponent;
|
|
820
|
+
}
|
|
821
|
+
getFallbackComponent() {
|
|
822
|
+
return this.fallbackComponent;
|
|
823
|
+
}
|
|
824
|
+
setErrorFallbackComponent(errorFallbackComponent) {
|
|
825
|
+
this.errorFallbackComponent = errorFallbackComponent;
|
|
826
|
+
}
|
|
827
|
+
getErrorFallbackComponent() {
|
|
828
|
+
return this.errorFallbackComponent;
|
|
829
|
+
}
|
|
830
|
+
};
|
|
831
|
+
var connector_default = new Connector();
|
|
832
|
+
//#endregion
|
|
833
|
+
//#region src/core/error-boundary.tsx
|
|
834
|
+
var ErrorBoundary = class extends Component {
|
|
835
|
+
constructor(..._args) {
|
|
836
|
+
super(..._args);
|
|
837
|
+
_defineProperty(this, "state", { hasError: false });
|
|
838
|
+
_defineProperty(this, "error", void 0);
|
|
839
|
+
_defineProperty(this, "$self", getSelfInfo(this.props));
|
|
840
|
+
_defineProperty(this, "reload", () => {
|
|
841
|
+
this.error = void 0;
|
|
842
|
+
this.setState({ hasError: false });
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
componentDidCatch(e) {
|
|
846
|
+
const { module } = this.props;
|
|
847
|
+
const error = e instanceof VariousError ? e : new VariousError({
|
|
848
|
+
module,
|
|
849
|
+
type: module === "app" ? "APP_ERROR" : "SCRIPT_ERROR",
|
|
850
|
+
originalError: e
|
|
851
|
+
});
|
|
852
|
+
this.setState({ hasError: true });
|
|
853
|
+
this.error = error;
|
|
854
|
+
onError(error);
|
|
855
|
+
resetDependencyConfig(module);
|
|
856
|
+
updateUnMountComponent(module);
|
|
857
|
+
}
|
|
858
|
+
render() {
|
|
859
|
+
const ErrorFallbackNode = connector_default.getErrorFallbackComponent();
|
|
860
|
+
const store = getUserStore();
|
|
861
|
+
const locale = getStore(LOCALE_KEY);
|
|
862
|
+
if (this.state.hasError) return /* @__PURE__ */ e.createElement(ErrorFallbackNode, {
|
|
863
|
+
$self: this.$self,
|
|
864
|
+
$reload: this.reload,
|
|
865
|
+
$store: store,
|
|
866
|
+
$error: this.error,
|
|
867
|
+
$locale: locale
|
|
868
|
+
});
|
|
869
|
+
return this.props.children;
|
|
870
|
+
}
|
|
871
|
+
};
|
|
872
|
+
_defineProperty(ErrorBoundary, "displayName", "various-error-boundary");
|
|
873
|
+
//#endregion
|
|
874
|
+
//#region \0@oxc-project+runtime@0.142.0/helpers/esm/objectWithoutPropertiesLoose.js
|
|
875
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
876
|
+
if (null == r) return {};
|
|
877
|
+
var t = {};
|
|
878
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
879
|
+
if (e.includes(n)) continue;
|
|
880
|
+
t[n] = r[n];
|
|
881
|
+
}
|
|
882
|
+
return t;
|
|
833
883
|
}
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
type: 'I18N',
|
|
845
|
-
originalError: new Error('config not exist')
|
|
846
|
-
}));
|
|
847
|
-
return defaultText;
|
|
848
|
-
}
|
|
849
|
-
if (i18nConfig.loading) {
|
|
850
|
-
return defaultText;
|
|
851
|
-
}
|
|
852
|
-
const {
|
|
853
|
-
lngStoreKey,
|
|
854
|
-
resources
|
|
855
|
-
} = i18nConfig;
|
|
856
|
-
const locale = (0,_store__WEBPACK_IMPORTED_MODULE_2__.getStore)(lngStoreKey);
|
|
857
|
-
if (lngStoreKey === undefined || locale === undefined) {
|
|
858
|
-
(0,_helper__WEBPACK_IMPORTED_MODULE_1__.onError)(new _helper__WEBPACK_IMPORTED_MODULE_1__.VariousError({
|
|
859
|
-
module,
|
|
860
|
-
type: 'I18N',
|
|
861
|
-
originalError: new Error('locale key not defined')
|
|
862
|
-
}));
|
|
863
|
-
return defaultText;
|
|
864
|
-
}
|
|
865
|
-
const resource = resources?.[locale];
|
|
866
|
-
if (!resource) {
|
|
867
|
-
(0,_helper__WEBPACK_IMPORTED_MODULE_1__.onError)(new _helper__WEBPACK_IMPORTED_MODULE_1__.VariousError({
|
|
868
|
-
module,
|
|
869
|
-
type: 'I18N',
|
|
870
|
-
originalError: new Error(`locale resource \`${locale}\` not exist`)
|
|
871
|
-
}));
|
|
872
|
-
return defaultText;
|
|
873
|
-
}
|
|
874
|
-
if (!resource[key]) {
|
|
875
|
-
(0,_helper__WEBPACK_IMPORTED_MODULE_1__.onError)(new _helper__WEBPACK_IMPORTED_MODULE_1__.VariousError({
|
|
876
|
-
module,
|
|
877
|
-
type: 'I18N',
|
|
878
|
-
originalError: new Error(`locale key \`${key}\` not exist`)
|
|
879
|
-
}));
|
|
880
|
-
return defaultText;
|
|
881
|
-
}
|
|
882
|
-
const text = resource[key];
|
|
883
|
-
if (!params || typeof params === 'string' || Object.prototype.toString.call(params) !== '[object Object]') {
|
|
884
|
-
return text;
|
|
885
|
-
}
|
|
886
|
-
const args = Object.keys(params);
|
|
887
|
-
if (!args.length) {
|
|
888
|
-
return text;
|
|
889
|
-
}
|
|
890
|
-
return args.reduce((next, arg) => {
|
|
891
|
-
const regex = new RegExp(`{\\s*${arg}\\s*}`, 'g');
|
|
892
|
-
return next.replace(regex, params[arg].toString());
|
|
893
|
-
}, text);
|
|
894
|
-
};
|
|
895
|
-
ctx.update = (config, type) => {
|
|
896
|
-
const i18nConfig = type === 'app' ? _connector__WEBPACK_IMPORTED_MODULE_0__["default"].getGlobalI18nConfig() : _connector__WEBPACK_IMPORTED_MODULE_0__["default"].getI18nConfig(module);
|
|
897
|
-
const next = {
|
|
898
|
-
...i18nConfig,
|
|
899
|
-
...config
|
|
900
|
-
};
|
|
901
|
-
if (type === 'app') {
|
|
902
|
-
_connector__WEBPACK_IMPORTED_MODULE_0__["default"].setGlobalI18nConfig(next);
|
|
903
|
-
} else {
|
|
904
|
-
_connector__WEBPACK_IMPORTED_MODULE_0__["default"].setI18nConfig(module, next);
|
|
905
|
-
}
|
|
906
|
-
updater();
|
|
907
|
-
};
|
|
908
|
-
return ctx;
|
|
884
|
+
//#endregion
|
|
885
|
+
//#region \0@oxc-project+runtime@0.142.0/helpers/esm/objectWithoutProperties.js
|
|
886
|
+
function _objectWithoutProperties(e, t) {
|
|
887
|
+
if (null == e) return {};
|
|
888
|
+
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
889
|
+
if (Object.getOwnPropertySymbols) {
|
|
890
|
+
var s = Object.getOwnPropertySymbols(e);
|
|
891
|
+
for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
892
|
+
}
|
|
893
|
+
return i;
|
|
909
894
|
}
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
895
|
+
//#endregion
|
|
896
|
+
//#region src/core/dispatch.ts
|
|
897
|
+
var createDispatch = (module) => async function(params) {
|
|
898
|
+
const middlewares = connector_default.getMiddlewares();
|
|
899
|
+
const logger = createLogger(module);
|
|
900
|
+
let { action, payload, target } = params;
|
|
901
|
+
if (middlewares === null || middlewares === void 0 ? void 0 : middlewares.onDispatch) {
|
|
902
|
+
const check = await middlewares.onDispatch({
|
|
903
|
+
target,
|
|
904
|
+
action,
|
|
905
|
+
payload,
|
|
906
|
+
trigger: module
|
|
907
|
+
});
|
|
908
|
+
if (check === false) {
|
|
909
|
+
logger.warn("blocked by middleware", "DISPATCH");
|
|
910
|
+
return Promise.resolve();
|
|
911
|
+
}
|
|
912
|
+
if (check !== true) {
|
|
913
|
+
target = check.target;
|
|
914
|
+
action = check.action;
|
|
915
|
+
payload = check.payload;
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
if (target === "app") {
|
|
919
|
+
const storeAction = connector_default.getStoreActions()[action];
|
|
920
|
+
if (action === I18NActions.SetLocale) {
|
|
921
|
+
emit({ [LOCALE_KEY]: payload }, true);
|
|
922
|
+
return payload;
|
|
923
|
+
}
|
|
924
|
+
if (action === I18NActions.GetLocale) return getStore(LOCALE_KEY);
|
|
925
|
+
if (action === I18NActions.UpdateI18nConfig) {
|
|
926
|
+
const locale = getStore(LOCALE_KEY);
|
|
927
|
+
connector_default.setGlobalI18nConfig(payload);
|
|
928
|
+
emit({ [LOCALE_KEY]: void 0 }, true);
|
|
929
|
+
emit({ [LOCALE_KEY]: locale }, true);
|
|
930
|
+
return locale;
|
|
931
|
+
}
|
|
932
|
+
if (!storeAction) {
|
|
933
|
+
const errorMessage = `action "${action}" is not present`;
|
|
934
|
+
const error = new VariousError({
|
|
935
|
+
module,
|
|
936
|
+
type: "DISPATCH",
|
|
937
|
+
originalError: new Error(errorMessage)
|
|
938
|
+
});
|
|
939
|
+
onError(error);
|
|
940
|
+
throw error;
|
|
941
|
+
}
|
|
942
|
+
return dispatch(storeAction, payload, module);
|
|
943
|
+
}
|
|
944
|
+
const componentActions = connector_default.getComponentActions(target);
|
|
945
|
+
if (!componentActions) {
|
|
946
|
+
const error = new VariousError({
|
|
947
|
+
module,
|
|
948
|
+
type: "DISPATCH",
|
|
949
|
+
originalError: /* @__PURE__ */ new Error("component is not ready")
|
|
950
|
+
});
|
|
951
|
+
onError(error);
|
|
952
|
+
throw error;
|
|
953
|
+
}
|
|
954
|
+
const componentAction = componentActions[action];
|
|
955
|
+
if (!componentAction) {
|
|
956
|
+
const errorMessage = `action "${action}" is not present`;
|
|
957
|
+
const error = new VariousError({
|
|
958
|
+
module,
|
|
959
|
+
type: "DISPATCH",
|
|
960
|
+
originalError: new Error(errorMessage)
|
|
961
|
+
});
|
|
962
|
+
onError(error);
|
|
963
|
+
throw error;
|
|
964
|
+
}
|
|
965
|
+
return Promise.resolve(componentAction({
|
|
966
|
+
payload,
|
|
967
|
+
trigger: module
|
|
968
|
+
}));
|
|
946
969
|
};
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
"
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
/*
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
if (check === false) {
|
|
1018
|
-
logger.warn('blocked by middleware', 'POST_MESSAGE');
|
|
1019
|
-
return;
|
|
1020
|
-
}
|
|
1021
|
-
if (check !== true) {
|
|
1022
|
-
next = {
|
|
1023
|
-
...next,
|
|
1024
|
-
...check
|
|
1025
|
-
};
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
(0,_store__WEBPACK_IMPORTED_MODULE_2__.emit)({
|
|
1029
|
-
[_config__WEBPACK_IMPORTED_MODULE_3__.MESSAGE_KEY]: {
|
|
1030
|
-
timestamp: +new Date(),
|
|
1031
|
-
event: next.event,
|
|
1032
|
-
trigger: module,
|
|
1033
|
-
payload: next.payload
|
|
1034
|
-
}
|
|
1035
|
-
});
|
|
970
|
+
//#endregion
|
|
971
|
+
//#region src/core/create-module.ts
|
|
972
|
+
var createModule = (config, logError = true) => {
|
|
973
|
+
const dependencies = getStore(DEPENDENCIES_KEY);
|
|
974
|
+
const middlewares = connector_default.getMiddlewares();
|
|
975
|
+
const { url, module } = config;
|
|
976
|
+
const { name, entry } = getModuleInfo(module);
|
|
977
|
+
const loadStart = +/* @__PURE__ */ new Date();
|
|
978
|
+
const logOnError = (e) => {
|
|
979
|
+
if (logError) onError(e);
|
|
980
|
+
};
|
|
981
|
+
if (url) resetDependencyConfig(module, url);
|
|
982
|
+
return new Promise((resolve, reject) => {
|
|
983
|
+
if (!url && !dependencies[name] && !isModuleSpecified(module)) {
|
|
984
|
+
const error = new VariousError({
|
|
985
|
+
module,
|
|
986
|
+
type: "NOT_DEFINED",
|
|
987
|
+
originalError: /* @__PURE__ */ new Error(`module "${name}" not defined`)
|
|
988
|
+
});
|
|
989
|
+
logOnError(error);
|
|
990
|
+
reject(error);
|
|
991
|
+
return;
|
|
992
|
+
}
|
|
993
|
+
importModule(name).then((C) => {
|
|
994
|
+
var _middlewares$onLoad;
|
|
995
|
+
const loadEnd = +/* @__PURE__ */ new Date();
|
|
996
|
+
middlewares === null || middlewares === void 0 || (_middlewares$onLoad = middlewares.onLoad) === null || _middlewares$onLoad === void 0 || _middlewares$onLoad.call(middlewares, {
|
|
997
|
+
module,
|
|
998
|
+
loadStart,
|
|
999
|
+
loadEnd,
|
|
1000
|
+
beenLoaded: isModuleLoaded(module)
|
|
1001
|
+
});
|
|
1002
|
+
if (!C || typeof C === "object" && Object.keys(C).length === 0) {
|
|
1003
|
+
const error = new VariousError({
|
|
1004
|
+
module,
|
|
1005
|
+
type: "INVALID_MODULE",
|
|
1006
|
+
originalError: /* @__PURE__ */ new Error(`module "${name}" invalid`)
|
|
1007
|
+
});
|
|
1008
|
+
resetDependencyConfig(module);
|
|
1009
|
+
logOnError(error);
|
|
1010
|
+
reject(error);
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1013
|
+
const defaultModule = "default" in C ? C.default : C;
|
|
1014
|
+
const actualModule = !entry ? defaultModule : C[entry];
|
|
1015
|
+
if (actualModule === void 0 && entry) {
|
|
1016
|
+
const error = new VariousError({
|
|
1017
|
+
module,
|
|
1018
|
+
type: "SUBMODULE_NOT_DEFINED",
|
|
1019
|
+
originalError: /* @__PURE__ */ new Error(`submodule "${entry}" not defined`)
|
|
1020
|
+
});
|
|
1021
|
+
resetDependencyConfig(module);
|
|
1022
|
+
logOnError(error);
|
|
1023
|
+
reject(error);
|
|
1024
|
+
return;
|
|
1025
|
+
}
|
|
1026
|
+
resolve(actualModule);
|
|
1027
|
+
}).catch((e) => {
|
|
1028
|
+
resetDependencyConfig(module, url);
|
|
1029
|
+
let errorType = "LOADING_ERROR";
|
|
1030
|
+
if (!url && e.message && !e.message.includes(name)) errorType = "SUBMODULE_LOADING_ERROR";
|
|
1031
|
+
const error = new VariousError({
|
|
1032
|
+
module: name,
|
|
1033
|
+
type: errorType,
|
|
1034
|
+
originalError: e
|
|
1035
|
+
});
|
|
1036
|
+
logOnError(error);
|
|
1037
|
+
reject(error);
|
|
1038
|
+
});
|
|
1039
|
+
});
|
|
1036
1040
|
};
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
const {
|
|
1040
|
-
trigger,
|
|
1041
|
-
payload,
|
|
1042
|
-
event
|
|
1043
|
-
} = v;
|
|
1044
|
-
if (module !== trigger) {
|
|
1045
|
-
onMessage({
|
|
1046
|
-
event,
|
|
1047
|
-
payload,
|
|
1048
|
-
trigger
|
|
1049
|
-
});
|
|
1050
|
-
}
|
|
1051
|
-
}
|
|
1052
|
-
});
|
|
1053
|
-
|
|
1054
|
-
/***/ }),
|
|
1055
|
-
|
|
1056
|
-
/***/ "./src/core/react-component.tsx":
|
|
1057
|
-
/*!**************************************!*\
|
|
1058
|
-
!*** ./src/core/react-component.tsx ***!
|
|
1059
|
-
\**************************************/
|
|
1060
|
-
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1061
|
-
|
|
1062
|
-
"use strict";
|
|
1063
|
-
__webpack_require__.r(__webpack_exports__);
|
|
1064
|
-
/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/extends */ "./node_modules/@babel/runtime/helpers/esm/extends.js");
|
|
1065
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
|
|
1066
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
|
|
1067
|
-
/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./helper */ "./src/core/helper.ts");
|
|
1068
|
-
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./store */ "./src/core/store.ts");
|
|
1069
|
-
/* harmony import */ var _connector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./connector */ "./src/core/connector.ts");
|
|
1070
|
-
/* harmony import */ var _message__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./message */ "./src/core/message.ts");
|
|
1071
|
-
/* harmony import */ var _dispatch__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./dispatch */ "./src/core/dispatch.ts");
|
|
1072
|
-
/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./logger */ "./src/core/logger.ts");
|
|
1073
|
-
/* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./i18n */ "./src/core/i18n.ts");
|
|
1074
|
-
/* harmony import */ var _create_module__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./create-module */ "./src/core/create-module.ts");
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1041
|
+
//#endregion
|
|
1042
|
+
//#region src/core/react-component.tsx
|
|
1085
1043
|
function reactComponent(config) {
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
$store: store,
|
|
1181
|
-
$postMessage: this.$postMessage,
|
|
1182
|
-
$t: this.$t,
|
|
1183
|
-
$logger: this.$logger,
|
|
1184
|
-
ref: $ref
|
|
1185
|
-
}));
|
|
1186
|
-
}
|
|
1187
|
-
}
|
|
1188
|
-
const Connected = (0,_store__WEBPACK_IMPORTED_MODULE_3__.connect)(...storeKeys)(R);
|
|
1189
|
-
Connected.displayName = 'various-connector';
|
|
1190
|
-
return Connected;
|
|
1191
|
-
}
|
|
1192
|
-
/* harmony default export */ __webpack_exports__["default"] = (reactComponent);
|
|
1193
|
-
|
|
1194
|
-
/***/ }),
|
|
1195
|
-
|
|
1196
|
-
/***/ "./src/core/render-component.tsx":
|
|
1197
|
-
/*!***************************************!*\
|
|
1198
|
-
!*** ./src/core/render-component.tsx ***!
|
|
1199
|
-
\***************************************/
|
|
1200
|
-
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1201
|
-
|
|
1202
|
-
"use strict";
|
|
1203
|
-
__webpack_require__.r(__webpack_exports__);
|
|
1204
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
1205
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
1206
|
-
/* harmony import */ var _react_component__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./react-component */ "./src/core/react-component.tsx");
|
|
1207
|
-
/* harmony import */ var _vue_component__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./vue-component */ "./src/core/vue-component.tsx");
|
|
1208
|
-
/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helper */ "./src/core/helper.ts");
|
|
1209
|
-
/* harmony import */ var _error_boundary__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./error-boundary */ "./src/core/error-boundary.tsx");
|
|
1210
|
-
/* harmony import */ var _create_module__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./create-module */ "./src/core/create-module.ts");
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
const renderComponent = async ({
|
|
1218
|
-
module,
|
|
1219
|
-
url,
|
|
1220
|
-
target,
|
|
1221
|
-
props,
|
|
1222
|
-
type = 'react',
|
|
1223
|
-
renderNode,
|
|
1224
|
-
onMounted
|
|
1225
|
-
}) => {
|
|
1226
|
-
try {
|
|
1227
|
-
const ReactDOM = await (0,_create_module__WEBPACK_IMPORTED_MODULE_5__["default"])({
|
|
1228
|
-
module: 'react-dom'
|
|
1229
|
-
});
|
|
1230
|
-
const C = (type === 'vue3' ? _vue_component__WEBPACK_IMPORTED_MODULE_2__["default"] : _react_component__WEBPACK_IMPORTED_MODULE_1__["default"])({
|
|
1231
|
-
module,
|
|
1232
|
-
url,
|
|
1233
|
-
onMounted
|
|
1234
|
-
});
|
|
1235
|
-
const root = ReactDOM.createRoot(target);
|
|
1236
|
-
const {
|
|
1237
|
-
$silent,
|
|
1238
|
-
$ref,
|
|
1239
|
-
...rest
|
|
1240
|
-
} = props || {};
|
|
1241
|
-
const nextProps = {
|
|
1242
|
-
$componentProps: rest,
|
|
1243
|
-
$silent,
|
|
1244
|
-
$ref
|
|
1245
|
-
};
|
|
1246
|
-
const node = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_error_boundary__WEBPACK_IMPORTED_MODULE_4__["default"], {
|
|
1247
|
-
module: module,
|
|
1248
|
-
url: url
|
|
1249
|
-
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(C, nextProps));
|
|
1250
|
-
root.render(renderNode ? renderNode(node) : node);
|
|
1251
|
-
return () => new Promise(resolve => {
|
|
1252
|
-
setTimeout(() => {
|
|
1253
|
-
root.unmount();
|
|
1254
|
-
resolve();
|
|
1255
|
-
});
|
|
1256
|
-
});
|
|
1257
|
-
} catch (e) {
|
|
1258
|
-
const error = new _helper__WEBPACK_IMPORTED_MODULE_3__.VariousError({
|
|
1259
|
-
module,
|
|
1260
|
-
type: 'SCRIPT_ERROR',
|
|
1261
|
-
originalError: e
|
|
1262
|
-
});
|
|
1263
|
-
(0,_helper__WEBPACK_IMPORTED_MODULE_3__.onError)(error);
|
|
1264
|
-
return () => Promise.resolve();
|
|
1265
|
-
}
|
|
1266
|
-
};
|
|
1267
|
-
/* harmony default export */ __webpack_exports__["default"] = (renderComponent);
|
|
1268
|
-
|
|
1269
|
-
/***/ }),
|
|
1270
|
-
|
|
1271
|
-
/***/ "./src/core/store.ts":
|
|
1272
|
-
/*!***************************!*\
|
|
1273
|
-
!*** ./src/core/store.ts ***!
|
|
1274
|
-
\***************************/
|
|
1275
|
-
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1276
|
-
|
|
1277
|
-
"use strict";
|
|
1278
|
-
__webpack_require__.r(__webpack_exports__);
|
|
1279
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1280
|
-
/* harmony export */ connect: function() { return /* binding */ connect; },
|
|
1281
|
-
/* harmony export */ createStore: function() { return /* binding */ createStore; },
|
|
1282
|
-
/* harmony export */ dispatch: function() { return /* binding */ dispatch; },
|
|
1283
|
-
/* harmony export */ emit: function() { return /* binding */ emit; },
|
|
1284
|
-
/* harmony export */ getStore: function() { return /* binding */ getStore; },
|
|
1285
|
-
/* harmony export */ getUserStore: function() { return /* binding */ getUserStore; },
|
|
1286
|
-
/* harmony export */ subscribe: function() { return /* binding */ subscribe; },
|
|
1287
|
-
/* harmony export */ useStore: function() { return /* binding */ useStore; }
|
|
1288
|
-
/* harmony export */ });
|
|
1289
|
-
/* harmony import */ var nycticorax__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! nycticorax */ "./node_modules/nycticorax/dist/index.js");
|
|
1290
|
-
/* harmony import */ var nycticorax__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(nycticorax__WEBPACK_IMPORTED_MODULE_0__);
|
|
1291
|
-
|
|
1292
|
-
const {
|
|
1293
|
-
createStore,
|
|
1294
|
-
getStore,
|
|
1295
|
-
connect,
|
|
1296
|
-
emit,
|
|
1297
|
-
subscribe,
|
|
1298
|
-
dispatch,
|
|
1299
|
-
useStore
|
|
1300
|
-
} = new (nycticorax__WEBPACK_IMPORTED_MODULE_0___default())();
|
|
1301
|
-
function getUserStore() {
|
|
1302
|
-
const globalStore = getStore();
|
|
1303
|
-
const keys = Object.keys(globalStore);
|
|
1304
|
-
const store = {};
|
|
1305
|
-
keys.forEach(key => {
|
|
1306
|
-
store[key] = globalStore[key];
|
|
1307
|
-
});
|
|
1308
|
-
return store;
|
|
1044
|
+
const { module, url, watchKeys, onMounted } = config;
|
|
1045
|
+
const storeKeys = watchKeys || Object.keys(getStore());
|
|
1046
|
+
class R extends Component {
|
|
1047
|
+
constructor(..._args) {
|
|
1048
|
+
var _this;
|
|
1049
|
+
super(..._args);
|
|
1050
|
+
_this = this;
|
|
1051
|
+
_defineProperty(this, "state", {
|
|
1052
|
+
componentReady: false,
|
|
1053
|
+
isError: false
|
|
1054
|
+
});
|
|
1055
|
+
_defineProperty(this, "error", void 0);
|
|
1056
|
+
_defineProperty(this, "ComponentNode", void 0);
|
|
1057
|
+
_defineProperty(this, "isUnMounted", void 0);
|
|
1058
|
+
_defineProperty(this, "unSubscribeMessage", () => null);
|
|
1059
|
+
_defineProperty(this, "mountComponent", async () => {
|
|
1060
|
+
try {
|
|
1061
|
+
const componentNode = await createModule({
|
|
1062
|
+
module,
|
|
1063
|
+
url
|
|
1064
|
+
}, false);
|
|
1065
|
+
if (_this.isUnMounted) return;
|
|
1066
|
+
await checkReactComponent(componentNode, module);
|
|
1067
|
+
componentNode.displayName = module;
|
|
1068
|
+
updateMountedComponent(module);
|
|
1069
|
+
_this.unSubscribeMessage = parseComponentActions({
|
|
1070
|
+
componentNode,
|
|
1071
|
+
module,
|
|
1072
|
+
i18nUpdate: () => _this.forceUpdate()
|
|
1073
|
+
});
|
|
1074
|
+
_this.ComponentNode = componentNode;
|
|
1075
|
+
_this.setState({ componentReady: true });
|
|
1076
|
+
onMounted === null || onMounted === void 0 || onMounted();
|
|
1077
|
+
} catch (e) {
|
|
1078
|
+
if (_this.isUnMounted) return;
|
|
1079
|
+
_this.error = e;
|
|
1080
|
+
_this.setState({
|
|
1081
|
+
componentReady: true,
|
|
1082
|
+
isError: true
|
|
1083
|
+
});
|
|
1084
|
+
}
|
|
1085
|
+
});
|
|
1086
|
+
_defineProperty(this, "$postMessage", createPostMessage(module));
|
|
1087
|
+
_defineProperty(this, "$dispatch", createDispatch(module));
|
|
1088
|
+
_defineProperty(this, "$t", createI18n(module, () => this.forceUpdate()));
|
|
1089
|
+
_defineProperty(this, "$logger", createLogger(module));
|
|
1090
|
+
_defineProperty(this, "$self", getSelfInfo({
|
|
1091
|
+
module,
|
|
1092
|
+
url
|
|
1093
|
+
}));
|
|
1094
|
+
}
|
|
1095
|
+
componentDidMount() {
|
|
1096
|
+
this.isUnMounted = false;
|
|
1097
|
+
this.mountComponent();
|
|
1098
|
+
}
|
|
1099
|
+
componentWillUnmount() {
|
|
1100
|
+
this.error = void 0;
|
|
1101
|
+
this.ComponentNode = null;
|
|
1102
|
+
this.isUnMounted = true;
|
|
1103
|
+
this.unSubscribeMessage();
|
|
1104
|
+
updateUnMountComponent(module);
|
|
1105
|
+
}
|
|
1106
|
+
render() {
|
|
1107
|
+
const Fallback = connector_default.getFallbackComponent();
|
|
1108
|
+
const { $silent, $componentProps, $ref } = this.props;
|
|
1109
|
+
const { componentReady, isError } = this.state;
|
|
1110
|
+
const store = getUserStore();
|
|
1111
|
+
const locale = getStore(LOCALE_KEY);
|
|
1112
|
+
const ComponentNode = this.ComponentNode;
|
|
1113
|
+
if (isError) throw this.error;
|
|
1114
|
+
if (!componentReady) {
|
|
1115
|
+
if ($silent || isModuleLoaded(module)) return null;
|
|
1116
|
+
return /* @__PURE__ */ e.createElement(Fallback, {
|
|
1117
|
+
$self: this.$self,
|
|
1118
|
+
$store: store,
|
|
1119
|
+
$locale: locale
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
return /* @__PURE__ */ e.createElement(ComponentNode, _objectSpread2(_objectSpread2({}, $componentProps), {}, {
|
|
1123
|
+
$self: this.$self,
|
|
1124
|
+
$dispatch: this.$dispatch,
|
|
1125
|
+
$store: store,
|
|
1126
|
+
$postMessage: this.$postMessage,
|
|
1127
|
+
$t: this.$t,
|
|
1128
|
+
$logger: this.$logger,
|
|
1129
|
+
ref: $ref,
|
|
1130
|
+
$locale: locale
|
|
1131
|
+
}));
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
_defineProperty(R, "displayName", "various-react-component");
|
|
1135
|
+
const Connected = connect(...storeKeys, LOCALE_KEY)(R);
|
|
1136
|
+
Connected.displayName = "various-connector";
|
|
1137
|
+
return Connected;
|
|
1309
1138
|
}
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
/***/ "./src/core/vue-component.tsx":
|
|
1314
|
-
/*!************************************!*\
|
|
1315
|
-
!*** ./src/core/vue-component.tsx ***!
|
|
1316
|
-
\************************************/
|
|
1317
|
-
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1318
|
-
|
|
1319
|
-
"use strict";
|
|
1320
|
-
__webpack_require__.r(__webpack_exports__);
|
|
1321
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
1322
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
1323
|
-
/* harmony import */ var _connector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./connector */ "./src/core/connector.ts");
|
|
1324
|
-
/* harmony import */ var _create_module__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./create-module */ "./src/core/create-module.ts");
|
|
1325
|
-
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./store */ "./src/core/store.ts");
|
|
1326
|
-
/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./helper */ "./src/core/helper.ts");
|
|
1327
|
-
/* harmony import */ var _dispatch__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./dispatch */ "./src/core/dispatch.ts");
|
|
1328
|
-
/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./logger */ "./src/core/logger.ts");
|
|
1329
|
-
/* harmony import */ var _message__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./message */ "./src/core/message.ts");
|
|
1330
|
-
/* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./i18n */ "./src/core/i18n.ts");
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1139
|
+
//#endregion
|
|
1140
|
+
//#region src/core/vue-component.tsx
|
|
1340
1141
|
function vueComponent(config) {
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
}, [$componentProps]);
|
|
1491
|
-
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
1492
|
-
if (storeReactiveRef.current) {
|
|
1493
|
-
storeReactiveRef.current.value = {
|
|
1494
|
-
...store
|
|
1495
|
-
};
|
|
1496
|
-
}
|
|
1497
|
-
}, [store]);
|
|
1498
|
-
if (isError) {
|
|
1499
|
-
throw errorRef.current;
|
|
1500
|
-
}
|
|
1501
|
-
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, {
|
|
1502
|
-
$self: selfRef.current,
|
|
1503
|
-
$store: store
|
|
1504
|
-
}) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
1505
|
-
className: (0,_helper__WEBPACK_IMPORTED_MODULE_4__.getClassNameWithModule)(module, 'various-vue-component'),
|
|
1506
|
-
ref: containerDivRef
|
|
1507
|
-
}));
|
|
1508
|
-
};
|
|
1509
|
-
V.displayName = module;
|
|
1510
|
-
const VueComponent = props => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(V, props);
|
|
1511
|
-
VueComponent.displayName = 'various-vue-component';
|
|
1512
|
-
return VueComponent;
|
|
1142
|
+
const { module, url, watchKeys, onMounted } = config;
|
|
1143
|
+
const storeKeys = watchKeys || Object.keys(getStore());
|
|
1144
|
+
const V = (props) => {
|
|
1145
|
+
const store = useStore(...storeKeys, LOCALE_KEY);
|
|
1146
|
+
const locale = store[LOCALE_KEY];
|
|
1147
|
+
const vueRef = useRef();
|
|
1148
|
+
const vmRef = useRef();
|
|
1149
|
+
const isVueMounted = useRef(false);
|
|
1150
|
+
const errorRef = useRef();
|
|
1151
|
+
const isUnMountedRef = useRef(false);
|
|
1152
|
+
const ComponentNodeRef = useRef();
|
|
1153
|
+
const selfRef = useRef(getSelfInfo({
|
|
1154
|
+
module,
|
|
1155
|
+
url
|
|
1156
|
+
}));
|
|
1157
|
+
const containerDivRef = useRef(null);
|
|
1158
|
+
const propsReactiveRef = useRef();
|
|
1159
|
+
const storeReactiveRef = useRef();
|
|
1160
|
+
const localeReactiveRef = useRef();
|
|
1161
|
+
const unMountVue = useRef();
|
|
1162
|
+
const unSubscribeMessageRef = useRef();
|
|
1163
|
+
const updateVueComponentRef = useRef();
|
|
1164
|
+
const [componentReady, setComponentReady] = useState(false);
|
|
1165
|
+
const [isError, setIsError] = useState(false);
|
|
1166
|
+
const Fallback = connector_default.getFallbackComponent();
|
|
1167
|
+
const { $silent, $componentProps } = props;
|
|
1168
|
+
const mountVue = useCallback(() => {
|
|
1169
|
+
const $logger = createLogger(module);
|
|
1170
|
+
const $dispatch = createDispatch(module);
|
|
1171
|
+
const $postMessage = createPostMessage(module);
|
|
1172
|
+
const $t = createI18n(module, () => {
|
|
1173
|
+
var _updateVueComponentRe;
|
|
1174
|
+
(_updateVueComponentRe = updateVueComponentRef.current) === null || _updateVueComponentRe === void 0 || _updateVueComponentRe.call(updateVueComponentRef);
|
|
1175
|
+
});
|
|
1176
|
+
propsReactiveRef.current = vueRef.current.ref(_objectSpread2({}, $componentProps));
|
|
1177
|
+
storeReactiveRef.current = vueRef.current.ref(_objectSpread2({}, store));
|
|
1178
|
+
localeReactiveRef.current = vueRef.current.ref(locale);
|
|
1179
|
+
const vueApp = vueRef.current.createApp({
|
|
1180
|
+
setup() {
|
|
1181
|
+
const renderKey = vueRef.current.ref(0);
|
|
1182
|
+
updateVueComponentRef.current = () => {
|
|
1183
|
+
renderKey.value += 1;
|
|
1184
|
+
};
|
|
1185
|
+
return { key: renderKey };
|
|
1186
|
+
},
|
|
1187
|
+
errorCaptured(e) {
|
|
1188
|
+
var _error$message;
|
|
1189
|
+
const error = e;
|
|
1190
|
+
errorRef.current = ((_error$message = error.message) === null || _error$message === void 0 ? void 0 : _error$message.includes("https://react")) ? new VariousError({
|
|
1191
|
+
originalError: /* @__PURE__ */ new Error("not a valid Vue component"),
|
|
1192
|
+
module,
|
|
1193
|
+
type: "INVALID_COMPONENT"
|
|
1194
|
+
}) : error;
|
|
1195
|
+
setIsError(true);
|
|
1196
|
+
},
|
|
1197
|
+
render() {
|
|
1198
|
+
return vueRef.current.h(ComponentNodeRef.current, _objectSpread2(_objectSpread2({}, propsReactiveRef.current.value), {}, {
|
|
1199
|
+
various: {
|
|
1200
|
+
$dispatch,
|
|
1201
|
+
$logger,
|
|
1202
|
+
$postMessage,
|
|
1203
|
+
$t,
|
|
1204
|
+
$store: storeReactiveRef.current.value,
|
|
1205
|
+
$self: selfRef.current,
|
|
1206
|
+
$locale: localeReactiveRef.current.value
|
|
1207
|
+
},
|
|
1208
|
+
key: this.key
|
|
1209
|
+
}));
|
|
1210
|
+
}
|
|
1211
|
+
});
|
|
1212
|
+
if (!vmRef.current) vmRef.current = vueApp.mount(containerDivRef.current);
|
|
1213
|
+
isVueMounted.current = true;
|
|
1214
|
+
unMountVue.current = () => vueApp.unmount();
|
|
1215
|
+
}, [
|
|
1216
|
+
$componentProps,
|
|
1217
|
+
store,
|
|
1218
|
+
locale
|
|
1219
|
+
]);
|
|
1220
|
+
const mountComponent = useCallback(async () => {
|
|
1221
|
+
try {
|
|
1222
|
+
const vue = await createModule({ module: "vue" });
|
|
1223
|
+
vueRef.current = vue;
|
|
1224
|
+
const componentNode = await createModule({
|
|
1225
|
+
module,
|
|
1226
|
+
url
|
|
1227
|
+
}, false);
|
|
1228
|
+
if (isUnMountedRef.current) return;
|
|
1229
|
+
await checkVueComponent(componentNode, module);
|
|
1230
|
+
updateMountedComponent(module);
|
|
1231
|
+
unSubscribeMessageRef.current = parseComponentActions({
|
|
1232
|
+
componentNode,
|
|
1233
|
+
module,
|
|
1234
|
+
type: "vue3",
|
|
1235
|
+
i18nUpdate() {
|
|
1236
|
+
var _updateVueComponentRe2;
|
|
1237
|
+
(_updateVueComponentRe2 = updateVueComponentRef.current) === null || _updateVueComponentRe2 === void 0 || _updateVueComponentRe2.call(updateVueComponentRef);
|
|
1238
|
+
}
|
|
1239
|
+
});
|
|
1240
|
+
ComponentNodeRef.current = componentNode;
|
|
1241
|
+
setTimeout(mountVue);
|
|
1242
|
+
setComponentReady(true);
|
|
1243
|
+
onMounted === null || onMounted === void 0 || onMounted();
|
|
1244
|
+
} catch (e) {
|
|
1245
|
+
if (isUnMountedRef.current) return;
|
|
1246
|
+
errorRef.current = e;
|
|
1247
|
+
setComponentReady(true);
|
|
1248
|
+
setIsError(true);
|
|
1249
|
+
}
|
|
1250
|
+
}, [mountVue]);
|
|
1251
|
+
useEffect(() => {
|
|
1252
|
+
isUnMountedRef.current = false;
|
|
1253
|
+
return () => {
|
|
1254
|
+
var _unMountVue$current, _unSubscribeMessageRe;
|
|
1255
|
+
errorRef.current = void 0;
|
|
1256
|
+
ComponentNodeRef.current = void 0;
|
|
1257
|
+
isUnMountedRef.current = true;
|
|
1258
|
+
updateUnMountComponent(module);
|
|
1259
|
+
(_unMountVue$current = unMountVue.current) === null || _unMountVue$current === void 0 || _unMountVue$current.call(unMountVue);
|
|
1260
|
+
(_unSubscribeMessageRe = unSubscribeMessageRef.current) === null || _unSubscribeMessageRe === void 0 || _unSubscribeMessageRe.call(unSubscribeMessageRef);
|
|
1261
|
+
isVueMounted.current = false;
|
|
1262
|
+
};
|
|
1263
|
+
}, []);
|
|
1264
|
+
useEffect(() => {
|
|
1265
|
+
if (isVueMounted.current) return;
|
|
1266
|
+
mountComponent();
|
|
1267
|
+
}, [mountComponent]);
|
|
1268
|
+
useEffect(() => {
|
|
1269
|
+
if (propsReactiveRef.current) propsReactiveRef.current.value = _objectSpread2({}, $componentProps);
|
|
1270
|
+
}, [$componentProps]);
|
|
1271
|
+
useEffect(() => {
|
|
1272
|
+
if (storeReactiveRef.current) storeReactiveRef.current.value = _objectSpread2({}, store);
|
|
1273
|
+
}, [store]);
|
|
1274
|
+
useEffect(() => {
|
|
1275
|
+
if (localeReactiveRef.current) localeReactiveRef.current.value = locale;
|
|
1276
|
+
}, [locale]);
|
|
1277
|
+
if (isError) throw errorRef.current;
|
|
1278
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, !componentReady && !$silent && !isModuleLoaded(module) ? /* @__PURE__ */ e.createElement(Fallback, {
|
|
1279
|
+
$self: selfRef.current,
|
|
1280
|
+
$store: store,
|
|
1281
|
+
$locale: locale
|
|
1282
|
+
}) : null, /* @__PURE__ */ e.createElement("div", {
|
|
1283
|
+
className: getClassNameWithModule(module, "various-vue-component"),
|
|
1284
|
+
ref: containerDivRef
|
|
1285
|
+
}));
|
|
1286
|
+
};
|
|
1287
|
+
V.displayName = module;
|
|
1288
|
+
const VueComponent = (props) => /* @__PURE__ */ e.createElement(V, props);
|
|
1289
|
+
VueComponent.displayName = "various-vue-component";
|
|
1290
|
+
return VueComponent;
|
|
1513
1291
|
}
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
/******/ // define getter functions for harmony exports
|
|
1577
|
-
/******/ __webpack_require__.d = function(exports, definition) {
|
|
1578
|
-
/******/ for(var key in definition) {
|
|
1579
|
-
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
1580
|
-
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
1581
|
-
/******/ }
|
|
1582
|
-
/******/ }
|
|
1583
|
-
/******/ };
|
|
1584
|
-
/******/ }();
|
|
1585
|
-
/******/
|
|
1586
|
-
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
1587
|
-
/******/ !function() {
|
|
1588
|
-
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
|
|
1589
|
-
/******/ }();
|
|
1590
|
-
/******/
|
|
1591
|
-
/******/ /* webpack/runtime/make namespace object */
|
|
1592
|
-
/******/ !function() {
|
|
1593
|
-
/******/ // define __esModule on exports
|
|
1594
|
-
/******/ __webpack_require__.r = function(exports) {
|
|
1595
|
-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
1596
|
-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
1597
|
-
/******/ }
|
|
1598
|
-
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
1599
|
-
/******/ };
|
|
1600
|
-
/******/ }();
|
|
1601
|
-
/******/
|
|
1602
|
-
/************************************************************************/
|
|
1603
|
-
var __webpack_exports__ = {};
|
|
1604
|
-
// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
|
|
1605
|
-
!function() {
|
|
1606
|
-
"use strict";
|
|
1607
|
-
/*!****************************!*\
|
|
1608
|
-
!*** ./src/core/index.tsx ***!
|
|
1609
|
-
\****************************/
|
|
1610
|
-
__webpack_require__.r(__webpack_exports__);
|
|
1611
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1612
|
-
/* harmony export */ Nycticorax: function() { return /* reexport default from dynamic */ nycticorax__WEBPACK_IMPORTED_MODULE_7___default.a; },
|
|
1613
|
-
/* harmony export */ createComponent: function() { return /* reexport safe */ _create_component__WEBPACK_IMPORTED_MODULE_13__["default"]; },
|
|
1614
|
-
/* harmony export */ createDispatch: function() { return /* reexport safe */ _dispatch__WEBPACK_IMPORTED_MODULE_8__["default"]; },
|
|
1615
|
-
/* harmony export */ createLogger: function() { return /* reexport safe */ _logger__WEBPACK_IMPORTED_MODULE_10__["default"]; },
|
|
1616
|
-
/* harmony export */ createModule: function() { return /* reexport safe */ _create_module__WEBPACK_IMPORTED_MODULE_12__["default"]; },
|
|
1617
|
-
/* harmony export */ createPostMessage: function() { return /* reexport safe */ _message__WEBPACK_IMPORTED_MODULE_9__.createPostMessage; },
|
|
1618
|
-
/* harmony export */ defineDependencies: function() { return /* reexport safe */ _helper__WEBPACK_IMPORTED_MODULE_11__.defineDependencies; },
|
|
1619
|
-
/* harmony export */ getApp: function() { return /* binding */ getApp; },
|
|
1620
|
-
/* harmony export */ getConfig: function() { return /* reexport safe */ _helper__WEBPACK_IMPORTED_MODULE_11__.getConfig; },
|
|
1621
|
-
/* harmony export */ getModuleInfo: function() { return /* reexport safe */ _helper__WEBPACK_IMPORTED_MODULE_11__.getModuleInfo; },
|
|
1622
|
-
/* harmony export */ getMountedComponents: function() { return /* reexport safe */ _helper__WEBPACK_IMPORTED_MODULE_11__.getMountedComponents; },
|
|
1623
|
-
/* harmony export */ getStore: function() { return /* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_1__.getUserStore; },
|
|
1624
|
-
/* harmony export */ isModuleLoaded: function() { return /* reexport safe */ _helper__WEBPACK_IMPORTED_MODULE_11__.isModuleLoaded; },
|
|
1625
|
-
/* harmony export */ onComponentMounted: function() { return /* reexport safe */ _helper__WEBPACK_IMPORTED_MODULE_11__.onComponentMounted; },
|
|
1626
|
-
/* harmony export */ preloadModules: function() { return /* reexport safe */ _helper__WEBPACK_IMPORTED_MODULE_11__.preloadModules; },
|
|
1627
|
-
/* harmony export */ removeLoadedModules: function() { return /* reexport safe */ _helper__WEBPACK_IMPORTED_MODULE_11__.removeLoadedModules; },
|
|
1628
|
-
/* harmony export */ renderComponent: function() { return /* reexport safe */ _render_component__WEBPACK_IMPORTED_MODULE_14__["default"]; },
|
|
1629
|
-
/* harmony export */ version: function() { return /* binding */ version; }
|
|
1630
|
-
/* harmony export */ });
|
|
1631
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
1632
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
1633
|
-
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./store */ "./src/core/store.ts");
|
|
1634
|
-
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./config */ "./src/core/config.ts");
|
|
1635
|
-
/* harmony import */ var _connector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./connector */ "./src/core/connector.ts");
|
|
1636
|
-
/* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./i18n */ "./src/core/i18n.ts");
|
|
1637
|
-
/* harmony import */ var _default_component__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./default-component */ "./src/core/default-component.tsx");
|
|
1638
|
-
/* harmony import */ var _error_boundary__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./error-boundary */ "./src/core/error-boundary.tsx");
|
|
1639
|
-
/* harmony import */ var nycticorax__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! nycticorax */ "./node_modules/nycticorax/dist/index.js");
|
|
1640
|
-
/* harmony import */ var nycticorax__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(nycticorax__WEBPACK_IMPORTED_MODULE_7__);
|
|
1641
|
-
/* harmony import */ var _dispatch__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./dispatch */ "./src/core/dispatch.ts");
|
|
1642
|
-
/* harmony import */ var _message__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./message */ "./src/core/message.ts");
|
|
1643
|
-
/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./logger */ "./src/core/logger.ts");
|
|
1644
|
-
/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./helper */ "./src/core/helper.ts");
|
|
1645
|
-
/* harmony import */ var _create_module__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./create-module */ "./src/core/create-module.ts");
|
|
1646
|
-
/* harmony import */ var _create_component__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./create-component */ "./src/core/create-component.tsx");
|
|
1647
|
-
/* harmony import */ var _render_component__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./render-component */ "./src/core/render-component.tsx");
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
// eslint-disable-next-line no-undef
|
|
1666
|
-
const version = "5.2.1";
|
|
1667
|
-
const getApp = config => {
|
|
1668
|
-
const {
|
|
1669
|
-
dependencies,
|
|
1670
|
-
store = {},
|
|
1671
|
-
actions = {},
|
|
1672
|
-
Fallback,
|
|
1673
|
-
ErrorFallback,
|
|
1674
|
-
Root = _default_component__WEBPACK_IMPORTED_MODULE_5__.Root,
|
|
1675
|
-
middlewares,
|
|
1676
|
-
i18n,
|
|
1677
|
-
...rest
|
|
1678
|
-
} = config;
|
|
1679
|
-
if (middlewares) {
|
|
1680
|
-
_connector__WEBPACK_IMPORTED_MODULE_3__["default"].setMiddlewares(middlewares);
|
|
1681
|
-
}
|
|
1682
|
-
_connector__WEBPACK_IMPORTED_MODULE_3__["default"].setStoreActions(actions);
|
|
1683
|
-
if (Fallback) {
|
|
1684
|
-
_connector__WEBPACK_IMPORTED_MODULE_3__["default"].setFallbackComponent(Fallback);
|
|
1685
|
-
}
|
|
1686
|
-
if (ErrorFallback) {
|
|
1687
|
-
_connector__WEBPACK_IMPORTED_MODULE_3__["default"].setErrorFallbackComponent(ErrorFallback);
|
|
1688
|
-
}
|
|
1689
|
-
(0,_store__WEBPACK_IMPORTED_MODULE_1__.createStore)({
|
|
1690
|
-
...store,
|
|
1691
|
-
[_config__WEBPACK_IMPORTED_MODULE_2__.MOUNTED_COMPONENTS_KEY]: [],
|
|
1692
|
-
[_config__WEBPACK_IMPORTED_MODULE_2__.CONFIG_KEY]: rest,
|
|
1693
|
-
[_config__WEBPACK_IMPORTED_MODULE_2__.DEPENDENCIES_KEY]: dependencies,
|
|
1694
|
-
[_config__WEBPACK_IMPORTED_MODULE_2__.MESSAGE_KEY]: null
|
|
1695
|
-
});
|
|
1696
|
-
Root.displayName = 'various-app-root';
|
|
1697
|
-
return class extends react__WEBPACK_IMPORTED_MODULE_0__.Component {
|
|
1698
|
-
static displayName = 'various-app';
|
|
1699
|
-
componentDidMount() {
|
|
1700
|
-
(0,_i18n__WEBPACK_IMPORTED_MODULE_4__.createI18nConfig)(i18n);
|
|
1701
|
-
}
|
|
1702
|
-
render() {
|
|
1703
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_error_boundary__WEBPACK_IMPORTED_MODULE_6__["default"], {
|
|
1704
|
-
module: "app",
|
|
1705
|
-
url: dependencies.app
|
|
1706
|
-
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(Root, null));
|
|
1707
|
-
}
|
|
1708
|
-
};
|
|
1292
|
+
//#endregion
|
|
1293
|
+
//#region src/core/create-component.tsx
|
|
1294
|
+
var _excluded$2 = ["$silent", "$ref"];
|
|
1295
|
+
var createComponent = (config, storeKeys) => {
|
|
1296
|
+
const { module, url, type = "react" } = config;
|
|
1297
|
+
const C = (type === "vue3" ? vueComponent : reactComponent)({
|
|
1298
|
+
module,
|
|
1299
|
+
url,
|
|
1300
|
+
watchKeys: storeKeys
|
|
1301
|
+
});
|
|
1302
|
+
const component = (props) => {
|
|
1303
|
+
const _ref = props || {}, { $silent, $ref } = _ref;
|
|
1304
|
+
const nextProps = {
|
|
1305
|
+
$componentProps: _objectWithoutProperties(_ref, _excluded$2),
|
|
1306
|
+
$silent,
|
|
1307
|
+
$ref
|
|
1308
|
+
};
|
|
1309
|
+
return /* @__PURE__ */ e.createElement(ErrorBoundary, {
|
|
1310
|
+
module,
|
|
1311
|
+
url
|
|
1312
|
+
}, /* @__PURE__ */ e.createElement(C, nextProps));
|
|
1313
|
+
};
|
|
1314
|
+
component.displayName = "various-creator";
|
|
1315
|
+
return component;
|
|
1316
|
+
};
|
|
1317
|
+
//#endregion
|
|
1318
|
+
//#region src/core/render-component.tsx
|
|
1319
|
+
var _excluded$1 = ["$silent", "$ref"];
|
|
1320
|
+
var renderComponent = async ({ module, url, target, props, type = "react", renderNode, onMounted }) => {
|
|
1321
|
+
try {
|
|
1322
|
+
const ReactDOM = await createModule({ module: "react-dom/client" });
|
|
1323
|
+
const C = (type === "vue3" ? vueComponent : reactComponent)({
|
|
1324
|
+
module,
|
|
1325
|
+
url,
|
|
1326
|
+
onMounted
|
|
1327
|
+
});
|
|
1328
|
+
const root = ReactDOM.createRoot(target);
|
|
1329
|
+
const _ref = props || {}, { $silent, $ref } = _ref;
|
|
1330
|
+
const nextProps = {
|
|
1331
|
+
$componentProps: _objectWithoutProperties(_ref, _excluded$1),
|
|
1332
|
+
$silent,
|
|
1333
|
+
$ref
|
|
1334
|
+
};
|
|
1335
|
+
const node = /* @__PURE__ */ e.createElement(ErrorBoundary, {
|
|
1336
|
+
module,
|
|
1337
|
+
url
|
|
1338
|
+
}, /* @__PURE__ */ e.createElement(C, nextProps));
|
|
1339
|
+
root.render(renderNode ? renderNode(node) : node);
|
|
1340
|
+
return () => new Promise((resolve) => {
|
|
1341
|
+
setTimeout(() => {
|
|
1342
|
+
root.unmount();
|
|
1343
|
+
resolve();
|
|
1344
|
+
});
|
|
1345
|
+
});
|
|
1346
|
+
} catch (e) {
|
|
1347
|
+
onError(new VariousError({
|
|
1348
|
+
module,
|
|
1349
|
+
type: "SCRIPT_ERROR",
|
|
1350
|
+
originalError: e
|
|
1351
|
+
}));
|
|
1352
|
+
return () => Promise.resolve();
|
|
1353
|
+
}
|
|
1709
1354
|
};
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1355
|
+
//#endregion
|
|
1356
|
+
//#region src/core/index.tsx
|
|
1357
|
+
var _excluded = [
|
|
1358
|
+
"dependencies",
|
|
1359
|
+
"store",
|
|
1360
|
+
"actions",
|
|
1361
|
+
"Fallback",
|
|
1362
|
+
"ErrorFallback",
|
|
1363
|
+
"Root",
|
|
1364
|
+
"middlewares",
|
|
1365
|
+
"i18n"
|
|
1366
|
+
];
|
|
1367
|
+
var version = "6.0.0";
|
|
1368
|
+
var getApp = (config) => {
|
|
1369
|
+
var _Class;
|
|
1370
|
+
const { dependencies, store = {}, actions = {}, Fallback, ErrorFallback, Root: Root$1 = Root, middlewares, i18n } = config, rest = _objectWithoutProperties(config, _excluded);
|
|
1371
|
+
if (middlewares) connector_default.setMiddlewares(middlewares);
|
|
1372
|
+
connector_default.setStoreActions(actions);
|
|
1373
|
+
if (Fallback) connector_default.setFallbackComponent(Fallback);
|
|
1374
|
+
if (ErrorFallback) connector_default.setErrorFallbackComponent(ErrorFallback);
|
|
1375
|
+
createStore(_objectSpread2(_objectSpread2({}, store), {}, {
|
|
1376
|
+
[MOUNTED_COMPONENTS_KEY]: [],
|
|
1377
|
+
[CONFIG_KEY]: rest,
|
|
1378
|
+
[DEPENDENCIES_KEY]: dependencies,
|
|
1379
|
+
[MESSAGE_KEY]: null,
|
|
1380
|
+
[LOCALE_KEY]: (i18n === null || i18n === void 0 ? void 0 : i18n.defaultLocale) || "en"
|
|
1381
|
+
}));
|
|
1382
|
+
Root$1.displayName = "various-app-root";
|
|
1383
|
+
return _Class = class extends Component {
|
|
1384
|
+
componentDidMount() {
|
|
1385
|
+
createI18nConfig(i18n === null || i18n === void 0 ? void 0 : i18n.getResources);
|
|
1386
|
+
}
|
|
1387
|
+
render() {
|
|
1388
|
+
return /* @__PURE__ */ e.createElement(ErrorBoundary, {
|
|
1389
|
+
module: "app",
|
|
1390
|
+
url: dependencies.app
|
|
1391
|
+
}, /* @__PURE__ */ e.createElement(Root$1, null));
|
|
1392
|
+
}
|
|
1393
|
+
}, _defineProperty(_Class, "displayName", "various-app"), _Class;
|
|
1394
|
+
};
|
|
1395
|
+
//#endregion
|
|
1396
|
+
export { h as Nycticorax, createComponent, createDispatch, createLogger, createModule, createPostMessage, defineDependencies, getApp, getConfig, getModuleInfo, getMountedComponents, getUserStore as getStore, isModuleLoaded, onComponentMounted, preloadModules, removeLoadedModules, renderComponent, version };
|
|
1397
|
+
|
|
1715
1398
|
//# sourceMappingURL=index.dev.js.map
|