@variousjs/various 5.1.3 → 5.1.5
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 +13 -15
- 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 +3 -3
- package/dist/loader-dev.js.map +1 -1
- package/dist/loader.js +1 -1
- package/dist/loader.js.map +1 -1
- package/dist/standalone.js +247 -51
- package/dist/standalone.js.map +1 -1
- package/package.json +1 -1
- package/standalone.d.ts +14 -8
package/dist/standalone.js
CHANGED
|
@@ -2208,6 +2208,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2208
2208
|
/* harmony export */ DEPENDENCIES_KEY: function() { return /* binding */ DEPENDENCIES_KEY; },
|
|
2209
2209
|
/* harmony export */ MESSAGE_KEY: function() { return /* binding */ MESSAGE_KEY; },
|
|
2210
2210
|
/* harmony export */ MOUNTED_COMPONENTS_KEY: function() { return /* binding */ MOUNTED_COMPONENTS_KEY; },
|
|
2211
|
+
/* harmony export */ STANDALONE_CONFIG_READY: function() { return /* binding */ STANDALONE_CONFIG_READY; },
|
|
2211
2212
|
/* harmony export */ VUE_FUNCTION_OPTIONS: function() { return /* binding */ VUE_FUNCTION_OPTIONS; },
|
|
2212
2213
|
/* harmony export */ VUE_VERSION: function() { return /* binding */ VUE_VERSION; }
|
|
2213
2214
|
/* harmony export */ });
|
|
@@ -2215,6 +2216,7 @@ const MOUNTED_COMPONENTS_KEY = Symbol('MOUNTED_COMPONENTS');
|
|
|
2215
2216
|
const MESSAGE_KEY = Symbol('MESSAGE');
|
|
2216
2217
|
const CONFIG_KEY = Symbol('CONFIG');
|
|
2217
2218
|
const DEPENDENCIES_KEY = Symbol('DEPENDENCIES');
|
|
2219
|
+
const STANDALONE_CONFIG_READY = Symbol('STANDALONE_CONFIG_READY');
|
|
2218
2220
|
const VUE_FUNCTION_OPTIONS = ['beforeCreate', 'created', 'beforeMount', 'mounted', 'beforeUpdate', 'updated', 'beforeUnmount', 'unmounted', 'errorCaptured', 'renderTracked', 'renderTriggered', 'activated', 'deactivated', 'setup', 'data', 'render'];
|
|
2219
2221
|
const VUE_VERSION = 3;
|
|
2220
2222
|
const BASE_DEPENDENCIES = ['react', 'react-dom', '@variousjs/various', 'app'];
|
|
@@ -2762,24 +2764,20 @@ const resetDependencyConfig = (name, url) => {
|
|
|
2762
2764
|
const dependencies = (0,_store__WEBPACK_IMPORTED_MODULE_0__.getStore)(_config__WEBPACK_IMPORTED_MODULE_2__.DEPENDENCIES_KEY);
|
|
2763
2765
|
|
|
2764
2766
|
// ignore multiple custom module url
|
|
2765
|
-
if (url &&
|
|
2767
|
+
if (url && isModuleLoaded(name)) {
|
|
2768
|
+
return;
|
|
2769
|
+
}
|
|
2770
|
+
if (!dependencies[name] && url) {
|
|
2771
|
+
window.requirejs.config({
|
|
2772
|
+
paths: {
|
|
2773
|
+
[name]: `${url}#${name}`
|
|
2774
|
+
}
|
|
2775
|
+
});
|
|
2766
2776
|
return;
|
|
2767
2777
|
}
|
|
2768
2778
|
let path = getUrlHash(dependencies[name]);
|
|
2769
|
-
|
|
2770
|
-
// custom module url, but module loaded error
|
|
2771
2779
|
if (url) {
|
|
2772
|
-
path = `${url}#${name}
|
|
2773
|
-
try {
|
|
2774
|
-
const {
|
|
2775
|
-
registry
|
|
2776
|
-
} = window.requirejs.s.contexts._;
|
|
2777
|
-
if (registry?.[name].error) {
|
|
2778
|
-
path = getUrlHash(url);
|
|
2779
|
-
}
|
|
2780
|
-
} catch (e) {
|
|
2781
|
-
// ignore
|
|
2782
|
-
}
|
|
2780
|
+
path = getUrlHash(`${url}#${name}`);
|
|
2783
2781
|
}
|
|
2784
2782
|
window.requirejs.undef(name);
|
|
2785
2783
|
window.requirejs.config({
|
|
@@ -3099,6 +3097,115 @@ function createI18n(moduleDefined, updater) {
|
|
|
3099
3097
|
|
|
3100
3098
|
/***/ }),
|
|
3101
3099
|
|
|
3100
|
+
/***/ "./src/core/index.tsx":
|
|
3101
|
+
/*!****************************!*\
|
|
3102
|
+
!*** ./src/core/index.tsx ***!
|
|
3103
|
+
\****************************/
|
|
3104
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
3105
|
+
|
|
3106
|
+
"use strict";
|
|
3107
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3108
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3109
|
+
/* harmony export */ Nycticorax: function() { return /* reexport default from dynamic */ nycticorax__WEBPACK_IMPORTED_MODULE_7___default.a; },
|
|
3110
|
+
/* harmony export */ createComponent: function() { return /* reexport safe */ _create_component__WEBPACK_IMPORTED_MODULE_13__["default"]; },
|
|
3111
|
+
/* harmony export */ createDispatch: function() { return /* reexport safe */ _dispatch__WEBPACK_IMPORTED_MODULE_8__["default"]; },
|
|
3112
|
+
/* harmony export */ createLogger: function() { return /* reexport safe */ _logger__WEBPACK_IMPORTED_MODULE_10__["default"]; },
|
|
3113
|
+
/* harmony export */ createModule: function() { return /* reexport safe */ _create_module__WEBPACK_IMPORTED_MODULE_12__["default"]; },
|
|
3114
|
+
/* harmony export */ createPostMessage: function() { return /* reexport safe */ _message__WEBPACK_IMPORTED_MODULE_9__.createPostMessage; },
|
|
3115
|
+
/* harmony export */ defineDependencies: function() { return /* reexport safe */ _helper__WEBPACK_IMPORTED_MODULE_11__.defineDependencies; },
|
|
3116
|
+
/* harmony export */ getApp: function() { return /* binding */ getApp; },
|
|
3117
|
+
/* harmony export */ getConfig: function() { return /* reexport safe */ _helper__WEBPACK_IMPORTED_MODULE_11__.getConfig; },
|
|
3118
|
+
/* harmony export */ getMountedComponents: function() { return /* reexport safe */ _helper__WEBPACK_IMPORTED_MODULE_11__.getMountedComponents; },
|
|
3119
|
+
/* harmony export */ getStore: function() { return /* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_1__.getUserStore; },
|
|
3120
|
+
/* harmony export */ isModuleLoaded: function() { return /* reexport safe */ _helper__WEBPACK_IMPORTED_MODULE_11__.isModuleLoaded; },
|
|
3121
|
+
/* harmony export */ onComponentMounted: function() { return /* reexport safe */ _helper__WEBPACK_IMPORTED_MODULE_11__.onComponentMounted; },
|
|
3122
|
+
/* harmony export */ preloadModules: function() { return /* reexport safe */ _helper__WEBPACK_IMPORTED_MODULE_11__.preloadModules; },
|
|
3123
|
+
/* harmony export */ removeLoadedModules: function() { return /* reexport safe */ _helper__WEBPACK_IMPORTED_MODULE_11__.removeLoadedModules; },
|
|
3124
|
+
/* harmony export */ renderComponent: function() { return /* reexport safe */ _render_component__WEBPACK_IMPORTED_MODULE_14__["default"]; },
|
|
3125
|
+
/* harmony export */ version: function() { return /* binding */ version; }
|
|
3126
|
+
/* harmony export */ });
|
|
3127
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
3128
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
3129
|
+
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./store */ "./src/core/store.ts");
|
|
3130
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./config */ "./src/core/config.ts");
|
|
3131
|
+
/* harmony import */ var _connector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./connector */ "./src/core/connector.ts");
|
|
3132
|
+
/* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./i18n */ "./src/core/i18n.ts");
|
|
3133
|
+
/* harmony import */ var _default_component__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./default-component */ "./src/core/default-component.tsx");
|
|
3134
|
+
/* harmony import */ var _error_boundary__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./error-boundary */ "./src/core/error-boundary.tsx");
|
|
3135
|
+
/* harmony import */ var nycticorax__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! nycticorax */ "./node_modules/nycticorax/dist/index.js");
|
|
3136
|
+
/* harmony import */ var nycticorax__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(nycticorax__WEBPACK_IMPORTED_MODULE_7__);
|
|
3137
|
+
/* harmony import */ var _dispatch__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./dispatch */ "./src/core/dispatch.ts");
|
|
3138
|
+
/* harmony import */ var _message__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./message */ "./src/core/message.ts");
|
|
3139
|
+
/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./logger */ "./src/core/logger.ts");
|
|
3140
|
+
/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./helper */ "./src/core/helper.ts");
|
|
3141
|
+
/* harmony import */ var _create_module__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./create-module */ "./src/core/create-module.ts");
|
|
3142
|
+
/* harmony import */ var _create_component__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./create-component */ "./src/core/create-component.tsx");
|
|
3143
|
+
/* harmony import */ var _render_component__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./render-component */ "./src/core/render-component.tsx");
|
|
3144
|
+
|
|
3145
|
+
|
|
3146
|
+
|
|
3147
|
+
|
|
3148
|
+
|
|
3149
|
+
|
|
3150
|
+
|
|
3151
|
+
|
|
3152
|
+
|
|
3153
|
+
|
|
3154
|
+
|
|
3155
|
+
|
|
3156
|
+
|
|
3157
|
+
|
|
3158
|
+
|
|
3159
|
+
|
|
3160
|
+
|
|
3161
|
+
// eslint-disable-next-line no-undef
|
|
3162
|
+
const version = "5.1.5";
|
|
3163
|
+
const getApp = config => {
|
|
3164
|
+
const {
|
|
3165
|
+
dependencies,
|
|
3166
|
+
store = {},
|
|
3167
|
+
actions = {},
|
|
3168
|
+
Fallback,
|
|
3169
|
+
ErrorFallback,
|
|
3170
|
+
Root = _default_component__WEBPACK_IMPORTED_MODULE_5__.Root,
|
|
3171
|
+
middlewares,
|
|
3172
|
+
i18n,
|
|
3173
|
+
...rest
|
|
3174
|
+
} = config;
|
|
3175
|
+
if (middlewares) {
|
|
3176
|
+
_connector__WEBPACK_IMPORTED_MODULE_3__["default"].setMiddlewares(middlewares);
|
|
3177
|
+
}
|
|
3178
|
+
_connector__WEBPACK_IMPORTED_MODULE_3__["default"].setStoreActions(actions);
|
|
3179
|
+
if (Fallback) {
|
|
3180
|
+
_connector__WEBPACK_IMPORTED_MODULE_3__["default"].setFallbackComponent(Fallback);
|
|
3181
|
+
}
|
|
3182
|
+
if (ErrorFallback) {
|
|
3183
|
+
_connector__WEBPACK_IMPORTED_MODULE_3__["default"].setErrorFallbackComponent(ErrorFallback);
|
|
3184
|
+
}
|
|
3185
|
+
(0,_store__WEBPACK_IMPORTED_MODULE_1__.createStore)({
|
|
3186
|
+
...store,
|
|
3187
|
+
[_config__WEBPACK_IMPORTED_MODULE_2__.MOUNTED_COMPONENTS_KEY]: [],
|
|
3188
|
+
[_config__WEBPACK_IMPORTED_MODULE_2__.CONFIG_KEY]: rest,
|
|
3189
|
+
[_config__WEBPACK_IMPORTED_MODULE_2__.DEPENDENCIES_KEY]: dependencies,
|
|
3190
|
+
[_config__WEBPACK_IMPORTED_MODULE_2__.MESSAGE_KEY]: null
|
|
3191
|
+
});
|
|
3192
|
+
Root.displayName = 'various-app-root';
|
|
3193
|
+
return class extends react__WEBPACK_IMPORTED_MODULE_0__.Component {
|
|
3194
|
+
static displayName = 'various-app';
|
|
3195
|
+
componentDidMount() {
|
|
3196
|
+
(0,_i18n__WEBPACK_IMPORTED_MODULE_4__.createI18nConfig)(i18n);
|
|
3197
|
+
}
|
|
3198
|
+
render() {
|
|
3199
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_error_boundary__WEBPACK_IMPORTED_MODULE_6__["default"], {
|
|
3200
|
+
name: "app",
|
|
3201
|
+
url: dependencies.app
|
|
3202
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(Root, null));
|
|
3203
|
+
}
|
|
3204
|
+
};
|
|
3205
|
+
};
|
|
3206
|
+
|
|
3207
|
+
/***/ }),
|
|
3208
|
+
|
|
3102
3209
|
/***/ "./src/core/logger.ts":
|
|
3103
3210
|
/*!****************************!*\
|
|
3104
3211
|
!*** ./src/core/logger.ts ***!
|
|
@@ -3407,6 +3514,85 @@ function reactComponent(config) {
|
|
|
3407
3514
|
|
|
3408
3515
|
/***/ }),
|
|
3409
3516
|
|
|
3517
|
+
/***/ "./src/core/render-component.tsx":
|
|
3518
|
+
/*!***************************************!*\
|
|
3519
|
+
!*** ./src/core/render-component.tsx ***!
|
|
3520
|
+
\***************************************/
|
|
3521
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
3522
|
+
|
|
3523
|
+
"use strict";
|
|
3524
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3525
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
3526
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
3527
|
+
/* harmony import */ var _react_component__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./react-component */ "./src/core/react-component.tsx");
|
|
3528
|
+
/* harmony import */ var _vue_component__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./vue-component */ "./src/core/vue-component.tsx");
|
|
3529
|
+
/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helper */ "./src/core/helper.ts");
|
|
3530
|
+
/* harmony import */ var _error_boundary__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./error-boundary */ "./src/core/error-boundary.tsx");
|
|
3531
|
+
/* harmony import */ var _create_module__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./create-module */ "./src/core/create-module.ts");
|
|
3532
|
+
|
|
3533
|
+
|
|
3534
|
+
|
|
3535
|
+
|
|
3536
|
+
|
|
3537
|
+
|
|
3538
|
+
const renderComponent = async ({
|
|
3539
|
+
name,
|
|
3540
|
+
module,
|
|
3541
|
+
url,
|
|
3542
|
+
target,
|
|
3543
|
+
props,
|
|
3544
|
+
type = 'react',
|
|
3545
|
+
renderNode,
|
|
3546
|
+
onMounted
|
|
3547
|
+
}) => {
|
|
3548
|
+
try {
|
|
3549
|
+
const ReactDOM = await (0,_create_module__WEBPACK_IMPORTED_MODULE_5__["default"])({
|
|
3550
|
+
name: 'react-dom'
|
|
3551
|
+
});
|
|
3552
|
+
const C = (type === 'vue3' ? _vue_component__WEBPACK_IMPORTED_MODULE_2__["default"] : _react_component__WEBPACK_IMPORTED_MODULE_1__["default"])({
|
|
3553
|
+
name,
|
|
3554
|
+
module,
|
|
3555
|
+
url,
|
|
3556
|
+
onMounted
|
|
3557
|
+
});
|
|
3558
|
+
const root = ReactDOM.createRoot(target);
|
|
3559
|
+
const {
|
|
3560
|
+
$silent,
|
|
3561
|
+
$ref,
|
|
3562
|
+
...rest
|
|
3563
|
+
} = props || {};
|
|
3564
|
+
const nextProps = {
|
|
3565
|
+
$componentProps: rest,
|
|
3566
|
+
$silent,
|
|
3567
|
+
$ref
|
|
3568
|
+
};
|
|
3569
|
+
const node = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_error_boundary__WEBPACK_IMPORTED_MODULE_4__["default"], {
|
|
3570
|
+
name: name,
|
|
3571
|
+
module: module,
|
|
3572
|
+
url: url
|
|
3573
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(C, nextProps));
|
|
3574
|
+
root.render(renderNode ? renderNode(node) : node);
|
|
3575
|
+
return () => new Promise(resolve => {
|
|
3576
|
+
setTimeout(() => {
|
|
3577
|
+
root.unmount();
|
|
3578
|
+
resolve();
|
|
3579
|
+
});
|
|
3580
|
+
});
|
|
3581
|
+
} catch (e) {
|
|
3582
|
+
const error = new _helper__WEBPACK_IMPORTED_MODULE_3__.VariousError({
|
|
3583
|
+
name,
|
|
3584
|
+
module,
|
|
3585
|
+
type: 'SCRIPT_ERROR',
|
|
3586
|
+
originalError: e
|
|
3587
|
+
});
|
|
3588
|
+
(0,_helper__WEBPACK_IMPORTED_MODULE_3__.onError)(error);
|
|
3589
|
+
return () => Promise.resolve();
|
|
3590
|
+
}
|
|
3591
|
+
};
|
|
3592
|
+
/* harmony default export */ __webpack_exports__["default"] = (renderComponent);
|
|
3593
|
+
|
|
3594
|
+
/***/ }),
|
|
3595
|
+
|
|
3410
3596
|
/***/ "./src/core/store.ts":
|
|
3411
3597
|
/*!***************************!*\
|
|
3412
3598
|
!*** ./src/core/store.ts ***!
|
|
@@ -3695,9 +3881,16 @@ function vueComponent(config) {
|
|
|
3695
3881
|
"use strict";
|
|
3696
3882
|
__webpack_require__.r(__webpack_exports__);
|
|
3697
3883
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3884
|
+
/* harmony export */ createAppConfig: function() { return /* binding */ createAppConfig; },
|
|
3698
3885
|
/* harmony export */ defineModules: function() { return /* binding */ defineModules; }
|
|
3699
3886
|
/* harmony export */ });
|
|
3700
3887
|
/* harmony import */ var _core_helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/helper */ "./src/core/helper.ts");
|
|
3888
|
+
/* harmony import */ var _core_store__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/store */ "./src/core/store.ts");
|
|
3889
|
+
/* harmony import */ var _core_config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/config */ "./src/core/config.ts");
|
|
3890
|
+
/* harmony import */ var _core_connector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../core/connector */ "./src/core/connector.ts");
|
|
3891
|
+
|
|
3892
|
+
|
|
3893
|
+
|
|
3701
3894
|
|
|
3702
3895
|
const defineAsync = (name, dep) => new Promise(resolve => {
|
|
3703
3896
|
window.define(name, [], () => dep);
|
|
@@ -3731,6 +3924,35 @@ function defineModules(deps) {
|
|
|
3731
3924
|
});
|
|
3732
3925
|
return Promise.all(defines.map(item => defineAsync(item.key, item.value)));
|
|
3733
3926
|
}
|
|
3927
|
+
const createAppConfig = config => {
|
|
3928
|
+
const {
|
|
3929
|
+
dependencies,
|
|
3930
|
+
errorFallback,
|
|
3931
|
+
fallback,
|
|
3932
|
+
store,
|
|
3933
|
+
actions
|
|
3934
|
+
} = config;
|
|
3935
|
+
(0,_core_store__WEBPACK_IMPORTED_MODULE_1__.emit)({
|
|
3936
|
+
[_core_config__WEBPACK_IMPORTED_MODULE_2__.STANDALONE_CONFIG_READY]: false
|
|
3937
|
+
}, true);
|
|
3938
|
+
if (errorFallback) {
|
|
3939
|
+
_core_connector__WEBPACK_IMPORTED_MODULE_3__["default"].setErrorFallbackComponent(errorFallback);
|
|
3940
|
+
}
|
|
3941
|
+
if (fallback) {
|
|
3942
|
+
_core_connector__WEBPACK_IMPORTED_MODULE_3__["default"].setFallbackComponent(fallback);
|
|
3943
|
+
}
|
|
3944
|
+
if (actions) {
|
|
3945
|
+
_core_connector__WEBPACK_IMPORTED_MODULE_3__["default"].setStoreActions(actions);
|
|
3946
|
+
}
|
|
3947
|
+
if (store) {
|
|
3948
|
+
(0,_core_store__WEBPACK_IMPORTED_MODULE_1__.emit)(store);
|
|
3949
|
+
}
|
|
3950
|
+
defineModules(dependencies).then(() => {
|
|
3951
|
+
(0,_core_store__WEBPACK_IMPORTED_MODULE_1__.emit)({
|
|
3952
|
+
[_core_config__WEBPACK_IMPORTED_MODULE_2__.STANDALONE_CONFIG_READY]: true
|
|
3953
|
+
}, true);
|
|
3954
|
+
});
|
|
3955
|
+
};
|
|
3734
3956
|
|
|
3735
3957
|
/***/ }),
|
|
3736
3958
|
|
|
@@ -3822,8 +4044,11 @@ var __webpack_exports__ = {};
|
|
|
3822
4044
|
\**********************************/
|
|
3823
4045
|
__webpack_require__.r(__webpack_exports__);
|
|
3824
4046
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4047
|
+
/* harmony export */ createAppConfig: function() { return /* reexport safe */ _helper__WEBPACK_IMPORTED_MODULE_6__.createAppConfig; },
|
|
3825
4048
|
/* harmony export */ createComponent: function() { return /* binding */ createComponent; },
|
|
3826
|
-
/* harmony export */
|
|
4049
|
+
/* harmony export */ createDispatch: function() { return /* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_9__.createDispatch; },
|
|
4050
|
+
/* harmony export */ createLogger: function() { return /* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_9__.createLogger; },
|
|
4051
|
+
/* harmony export */ createPostMessage: function() { return /* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_9__.createPostMessage; }
|
|
3827
4052
|
/* harmony export */ });
|
|
3828
4053
|
/* 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");
|
|
3829
4054
|
/* harmony import */ var _variousjs_requirejs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @variousjs/requirejs */ "./node_modules/@variousjs/requirejs/require.js");
|
|
@@ -3836,6 +4061,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3836
4061
|
/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./helper */ "./src/standalone/helper.ts");
|
|
3837
4062
|
/* harmony import */ var _core_store__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../core/store */ "./src/core/store.ts");
|
|
3838
4063
|
/* harmony import */ var _core_config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../core/config */ "./src/core/config.ts");
|
|
4064
|
+
/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../core */ "./src/core/index.tsx");
|
|
4065
|
+
|
|
4066
|
+
|
|
3839
4067
|
|
|
3840
4068
|
|
|
3841
4069
|
|
|
@@ -3850,7 +4078,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3850
4078
|
[_core_config__WEBPACK_IMPORTED_MODULE_8__.MESSAGE_KEY]: null,
|
|
3851
4079
|
[_core_config__WEBPACK_IMPORTED_MODULE_8__.CONFIG_KEY]: {},
|
|
3852
4080
|
[_core_config__WEBPACK_IMPORTED_MODULE_8__.DEPENDENCIES_KEY]: {},
|
|
3853
|
-
|
|
4081
|
+
[_core_config__WEBPACK_IMPORTED_MODULE_8__.STANDALONE_CONFIG_READY]: undefined
|
|
3854
4082
|
});
|
|
3855
4083
|
window.define('react', [], () => (react__WEBPACK_IMPORTED_MODULE_2___default()));
|
|
3856
4084
|
const Standalone = props => {
|
|
@@ -3864,9 +4092,7 @@ const Standalone = props => {
|
|
|
3864
4092
|
$ref,
|
|
3865
4093
|
storeKeys
|
|
3866
4094
|
} = props;
|
|
3867
|
-
const
|
|
3868
|
-
configReady
|
|
3869
|
-
} = (0,_core_store__WEBPACK_IMPORTED_MODULE_7__.useStore)('configReady');
|
|
4095
|
+
const store = (0,_core_store__WEBPACK_IMPORTED_MODULE_7__.useStore)(_core_config__WEBPACK_IMPORTED_MODULE_8__.STANDALONE_CONFIG_READY);
|
|
3870
4096
|
const [componentReady, setComponentReady] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(false);
|
|
3871
4097
|
const componentNode = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)();
|
|
3872
4098
|
(0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(() => {
|
|
@@ -3880,7 +4106,7 @@ const Standalone = props => {
|
|
|
3880
4106
|
setComponentReady(true);
|
|
3881
4107
|
});
|
|
3882
4108
|
}, [name, url, module, dependencies, type, storeKeys]);
|
|
3883
|
-
if (!componentReady ||
|
|
4109
|
+
if (!componentReady || store[_core_config__WEBPACK_IMPORTED_MODULE_8__.STANDALONE_CONFIG_READY] === false) {
|
|
3884
4110
|
const FallBack = _core_connector__WEBPACK_IMPORTED_MODULE_5__["default"].getFallbackComponent();
|
|
3885
4111
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(FallBack, {
|
|
3886
4112
|
$self: {
|
|
@@ -3905,38 +4131,8 @@ const createComponent = args => {
|
|
|
3905
4131
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(Standalone, (0,_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({
|
|
3906
4132
|
$componentProps: props
|
|
3907
4133
|
}, args)));
|
|
3908
|
-
const dispatch = next => {
|
|
3909
|
-
(0,_core_store__WEBPACK_IMPORTED_MODULE_7__.emit)(next, true);
|
|
3910
|
-
};
|
|
3911
4134
|
component.displayName = 'various-standalone-creator';
|
|
3912
|
-
return
|
|
3913
|
-
dispatch
|
|
3914
|
-
});
|
|
3915
|
-
};
|
|
3916
|
-
const createConfig = config => {
|
|
3917
|
-
const {
|
|
3918
|
-
baseDependencies,
|
|
3919
|
-
errorFallback,
|
|
3920
|
-
fallback,
|
|
3921
|
-
store
|
|
3922
|
-
} = config;
|
|
3923
|
-
(0,_core_store__WEBPACK_IMPORTED_MODULE_7__.emit)({
|
|
3924
|
-
configReady: false
|
|
3925
|
-
}, true);
|
|
3926
|
-
if (errorFallback) {
|
|
3927
|
-
_core_connector__WEBPACK_IMPORTED_MODULE_5__["default"].setErrorFallbackComponent(errorFallback);
|
|
3928
|
-
}
|
|
3929
|
-
if (fallback) {
|
|
3930
|
-
_core_connector__WEBPACK_IMPORTED_MODULE_5__["default"].setFallbackComponent(fallback);
|
|
3931
|
-
}
|
|
3932
|
-
if (store) {
|
|
3933
|
-
(0,_core_store__WEBPACK_IMPORTED_MODULE_7__.emit)(store);
|
|
3934
|
-
}
|
|
3935
|
-
(0,_helper__WEBPACK_IMPORTED_MODULE_6__.defineModules)(baseDependencies).then(() => {
|
|
3936
|
-
(0,_core_store__WEBPACK_IMPORTED_MODULE_7__.emit)({
|
|
3937
|
-
configReady: true
|
|
3938
|
-
});
|
|
3939
|
-
});
|
|
4135
|
+
return component;
|
|
3940
4136
|
};
|
|
3941
4137
|
}();
|
|
3942
4138
|
module.exports = __webpack_exports__;
|