@variousjs/various 5.0.2 → 5.1.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 +64 -41
- package/dist/index.dev.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/standalone-dev.js +1807 -0
- package/dist/standalone-dev.js.map +1 -0
- package/dist/standalone.js +2 -0
- package/dist/standalone.js.map +1 -0
- package/index.d.ts +9 -7
- package/package.json +31 -8
package/dist/index.dev.js
CHANGED
|
@@ -79,8 +79,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
79
79
|
|
|
80
80
|
class Connector {
|
|
81
81
|
constructor() {
|
|
82
|
-
this.
|
|
83
|
-
this.
|
|
82
|
+
this.fallbackComponent = _default_component__WEBPACK_IMPORTED_MODULE_0__.Fallback;
|
|
83
|
+
this.errorFallbackComponent = _default_component__WEBPACK_IMPORTED_MODULE_0__.ErrorFallback;
|
|
84
84
|
this.storeActions = {};
|
|
85
85
|
this.componentActions = {};
|
|
86
86
|
this.i18nConfigs = {};
|
|
@@ -130,17 +130,17 @@ class Connector {
|
|
|
130
130
|
getStoreActions() {
|
|
131
131
|
return this.storeActions;
|
|
132
132
|
}
|
|
133
|
-
|
|
134
|
-
this.
|
|
133
|
+
setFallbackComponent(fallbackComponent) {
|
|
134
|
+
this.fallbackComponent = fallbackComponent;
|
|
135
135
|
}
|
|
136
|
-
|
|
137
|
-
return this.
|
|
136
|
+
getFallbackComponent() {
|
|
137
|
+
return this.fallbackComponent;
|
|
138
138
|
}
|
|
139
|
-
|
|
140
|
-
this.
|
|
139
|
+
setErrorFallbackComponent(errorFallbackComponent) {
|
|
140
|
+
this.errorFallbackComponent = errorFallbackComponent;
|
|
141
141
|
}
|
|
142
|
-
|
|
143
|
-
return this.
|
|
142
|
+
getErrorFallbackComponent() {
|
|
143
|
+
return this.errorFallbackComponent;
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
/* harmony default export */ __webpack_exports__["default"] = (new Connector());
|
|
@@ -235,7 +235,7 @@ const createModule = (config, logError = true) => {
|
|
|
235
235
|
(0,_helper__WEBPACK_IMPORTED_MODULE_3__.resetDependencyConfig)(name, url);
|
|
236
236
|
}
|
|
237
237
|
return new Promise((resolve, reject) => {
|
|
238
|
-
if (!url && !dependencies[name]) {
|
|
238
|
+
if (!url && !dependencies[name] && !(0,_helper__WEBPACK_IMPORTED_MODULE_3__.isModuleSpecified)(name)) {
|
|
239
239
|
const error = new _helper__WEBPACK_IMPORTED_MODULE_3__.VariousError({
|
|
240
240
|
name,
|
|
241
241
|
module,
|
|
@@ -317,22 +317,35 @@ const createModule = (config, logError = true) => {
|
|
|
317
317
|
"use strict";
|
|
318
318
|
__webpack_require__.r(__webpack_exports__);
|
|
319
319
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
320
|
-
/* harmony export */
|
|
321
|
-
/* harmony export */
|
|
322
|
-
/* harmony export */
|
|
320
|
+
/* harmony export */ ErrorFallback: function() { return /* binding */ ErrorFallback; },
|
|
321
|
+
/* harmony export */ Fallback: function() { return /* binding */ Fallback; },
|
|
322
|
+
/* harmony export */ Root: function() { return /* binding */ Root; }
|
|
323
323
|
/* harmony export */ });
|
|
324
324
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
325
325
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
326
|
+
/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./helper */ "./src/core/helper.ts");
|
|
327
|
+
|
|
326
328
|
|
|
327
|
-
const
|
|
328
|
-
const
|
|
329
|
+
const Fallback = props => {
|
|
330
|
+
const className = (0,_helper__WEBPACK_IMPORTED_MODULE_1__.getClassNameWithModule)(props.$self, 'various-component-fallback');
|
|
331
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
332
|
+
className: className
|
|
333
|
+
}, "Loading");
|
|
334
|
+
};
|
|
335
|
+
const ErrorFallback = ({
|
|
329
336
|
$error,
|
|
330
|
-
$reload
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
337
|
+
$reload,
|
|
338
|
+
$self
|
|
339
|
+
}) => {
|
|
340
|
+
const className = (0,_helper__WEBPACK_IMPORTED_MODULE_1__.getClassNameWithModule)($self, 'various-component-error_fallback');
|
|
341
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
342
|
+
className: className
|
|
343
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("h3", null, $error.type), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("p", null, $error.message), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("button", {
|
|
344
|
+
type: "button",
|
|
345
|
+
onClick: $reload
|
|
346
|
+
}, "Reload"));
|
|
347
|
+
};
|
|
348
|
+
const Root = () => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", null, "App Container is not defined");
|
|
336
349
|
|
|
337
350
|
/***/ }),
|
|
338
351
|
|
|
@@ -480,10 +493,10 @@ class ErrorBoundary extends react__WEBPACK_IMPORTED_MODULE_0__.Component {
|
|
|
480
493
|
});
|
|
481
494
|
};
|
|
482
495
|
render() {
|
|
483
|
-
const
|
|
496
|
+
const ErrorFallbackNode = _connector__WEBPACK_IMPORTED_MODULE_2__["default"].getErrorFallbackComponent();
|
|
484
497
|
const store = (0,_store__WEBPACK_IMPORTED_MODULE_3__.getUserStore)();
|
|
485
498
|
if (this.state.hasError) {
|
|
486
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(
|
|
499
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(ErrorFallbackNode, {
|
|
487
500
|
$self: this.$self,
|
|
488
501
|
$reload: this.reload,
|
|
489
502
|
$store: store,
|
|
@@ -510,11 +523,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
510
523
|
/* harmony export */ checkReactComponent: function() { return /* binding */ checkReactComponent; },
|
|
511
524
|
/* harmony export */ checkVueComponent: function() { return /* binding */ checkVueComponent; },
|
|
512
525
|
/* harmony export */ defineDependencies: function() { return /* binding */ defineDependencies; },
|
|
526
|
+
/* harmony export */ getClassNameWithModule: function() { return /* binding */ getClassNameWithModule; },
|
|
513
527
|
/* harmony export */ getConfig: function() { return /* binding */ getConfig; },
|
|
514
528
|
/* harmony export */ getMountedComponents: function() { return /* binding */ getMountedComponents; },
|
|
515
529
|
/* harmony export */ getNameWithModule: function() { return /* binding */ getNameWithModule; },
|
|
516
530
|
/* harmony export */ getSelfInfo: function() { return /* binding */ getSelfInfo; },
|
|
517
531
|
/* harmony export */ isModuleLoaded: function() { return /* binding */ isModuleLoaded; },
|
|
532
|
+
/* harmony export */ isModuleSpecified: function() { return /* binding */ isModuleSpecified; },
|
|
518
533
|
/* harmony export */ isPromiseLike: function() { return /* binding */ isPromiseLike; },
|
|
519
534
|
/* harmony export */ onComponentMounted: function() { return /* binding */ onComponentMounted; },
|
|
520
535
|
/* harmony export */ onError: function() { return /* binding */ onError; },
|
|
@@ -568,7 +583,8 @@ const defineDependencies = deps => {
|
|
|
568
583
|
}
|
|
569
584
|
}, true);
|
|
570
585
|
};
|
|
571
|
-
const isModuleLoaded = name => window.requirejs.
|
|
586
|
+
const isModuleLoaded = name => window.requirejs.defined(name);
|
|
587
|
+
const isModuleSpecified = name => window.requirejs.specified(name);
|
|
572
588
|
const getMountedComponents = () => (0,_store__WEBPACK_IMPORTED_MODULE_0__.getStore)(_config__WEBPACK_IMPORTED_MODULE_2__.MOUNTED_COMPONENTS_KEY);
|
|
573
589
|
const onComponentMounted = (module, callback) => {
|
|
574
590
|
const modules = Array.isArray(module) ? module : [module];
|
|
@@ -765,6 +781,13 @@ function getSelfInfo(params) {
|
|
|
765
781
|
url: url || dependencies[name]
|
|
766
782
|
};
|
|
767
783
|
}
|
|
784
|
+
function getClassNameWithModule(self, prefix) {
|
|
785
|
+
const {
|
|
786
|
+
name,
|
|
787
|
+
module
|
|
788
|
+
} = self;
|
|
789
|
+
return `${prefix} ${[name, module].filter(Boolean).join('-')}`;
|
|
790
|
+
}
|
|
768
791
|
|
|
769
792
|
/***/ }),
|
|
770
793
|
|
|
@@ -1184,7 +1207,7 @@ function reactComponent(config) {
|
|
|
1184
1207
|
url
|
|
1185
1208
|
});
|
|
1186
1209
|
render() {
|
|
1187
|
-
const
|
|
1210
|
+
const Fallback = _connector__WEBPACK_IMPORTED_MODULE_4__["default"].getFallbackComponent();
|
|
1188
1211
|
const {
|
|
1189
1212
|
$silent,
|
|
1190
1213
|
$componentProps,
|
|
@@ -1203,7 +1226,7 @@ function reactComponent(config) {
|
|
|
1203
1226
|
if ($silent || (0,_helper__WEBPACK_IMPORTED_MODULE_2__.isModuleLoaded)(name)) {
|
|
1204
1227
|
return null;
|
|
1205
1228
|
}
|
|
1206
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
|
|
1229
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(Fallback, {
|
|
1207
1230
|
$self: this.$self,
|
|
1208
1231
|
$store: store
|
|
1209
1232
|
});
|
|
@@ -1401,7 +1424,7 @@ function vueComponent(config) {
|
|
|
1401
1424
|
const updateVueComponentRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
|
|
1402
1425
|
const [componentReady, setComponentReady] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
|
|
1403
1426
|
const [isError, setIsError] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
|
|
1404
|
-
const
|
|
1427
|
+
const Fallback = _connector__WEBPACK_IMPORTED_MODULE_1__["default"].getFallbackComponent();
|
|
1405
1428
|
const {
|
|
1406
1429
|
$silent,
|
|
1407
1430
|
$componentProps
|
|
@@ -1550,14 +1573,14 @@ function vueComponent(config) {
|
|
|
1550
1573
|
if (isError) {
|
|
1551
1574
|
throw errorRef.current;
|
|
1552
1575
|
}
|
|
1553
|
-
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)(name) ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(
|
|
1576
|
+
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)(name) ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(Fallback, {
|
|
1554
1577
|
$self: selfRef.current,
|
|
1555
1578
|
$store: store
|
|
1556
1579
|
}) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
1557
|
-
className:
|
|
1580
|
+
className: (0,_helper__WEBPACK_IMPORTED_MODULE_4__.getClassNameWithModule)({
|
|
1558
1581
|
name,
|
|
1559
1582
|
module
|
|
1560
|
-
})
|
|
1583
|
+
}, 'various-vue-component'),
|
|
1561
1584
|
ref: containerDivRef
|
|
1562
1585
|
}));
|
|
1563
1586
|
};
|
|
@@ -1727,16 +1750,16 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1727
1750
|
|
|
1728
1751
|
|
|
1729
1752
|
// eslint-disable-next-line no-undef
|
|
1730
|
-
const version = "5.0
|
|
1753
|
+
const version = "5.1.0";
|
|
1731
1754
|
/* harmony default export */ __webpack_exports__["default"] = (config => {
|
|
1732
1755
|
const {
|
|
1733
1756
|
dependencies,
|
|
1734
1757
|
root,
|
|
1735
1758
|
store = {},
|
|
1736
1759
|
actions = {},
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1760
|
+
Fallback,
|
|
1761
|
+
ErrorFallback,
|
|
1762
|
+
Root = _default_component__WEBPACK_IMPORTED_MODULE_6__.Root,
|
|
1740
1763
|
middlewares,
|
|
1741
1764
|
i18n,
|
|
1742
1765
|
...rest
|
|
@@ -1745,11 +1768,11 @@ const version = "5.0.2";
|
|
|
1745
1768
|
_connector__WEBPACK_IMPORTED_MODULE_4__["default"].setMiddlewares(middlewares);
|
|
1746
1769
|
}
|
|
1747
1770
|
_connector__WEBPACK_IMPORTED_MODULE_4__["default"].setStoreActions(actions);
|
|
1748
|
-
if (
|
|
1749
|
-
_connector__WEBPACK_IMPORTED_MODULE_4__["default"].
|
|
1771
|
+
if (Fallback) {
|
|
1772
|
+
_connector__WEBPACK_IMPORTED_MODULE_4__["default"].setFallbackComponent(Fallback);
|
|
1750
1773
|
}
|
|
1751
|
-
if (
|
|
1752
|
-
_connector__WEBPACK_IMPORTED_MODULE_4__["default"].
|
|
1774
|
+
if (ErrorFallback) {
|
|
1775
|
+
_connector__WEBPACK_IMPORTED_MODULE_4__["default"].setErrorFallbackComponent(ErrorFallback);
|
|
1753
1776
|
}
|
|
1754
1777
|
(0,_store__WEBPACK_IMPORTED_MODULE_2__.createStore)({
|
|
1755
1778
|
...store,
|
|
@@ -1758,7 +1781,7 @@ const version = "5.0.2";
|
|
|
1758
1781
|
[_config__WEBPACK_IMPORTED_MODULE_3__.DEPENDENCIES_KEY]: dependencies,
|
|
1759
1782
|
[_config__WEBPACK_IMPORTED_MODULE_3__.MESSAGE_KEY]: null
|
|
1760
1783
|
});
|
|
1761
|
-
|
|
1784
|
+
Root.displayName = 'various-app-root';
|
|
1762
1785
|
class R extends react__WEBPACK_IMPORTED_MODULE_0__.Component {
|
|
1763
1786
|
static displayName = 'various-app';
|
|
1764
1787
|
componentDidMount() {
|
|
@@ -1768,7 +1791,7 @@ const version = "5.0.2";
|
|
|
1768
1791
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_error_boundary__WEBPACK_IMPORTED_MODULE_7__["default"], {
|
|
1769
1792
|
name: "app",
|
|
1770
1793
|
url: dependencies.app
|
|
1771
|
-
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(
|
|
1794
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(Root, null));
|
|
1772
1795
|
}
|
|
1773
1796
|
}
|
|
1774
1797
|
(0,react_dom_client__WEBPACK_IMPORTED_MODULE_1__.createRoot)(document.querySelector(root || _config__WEBPACK_IMPORTED_MODULE_3__.ROOT)).render( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(R, null));
|