@next-core/brick-kit 2.111.3 → 2.112.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.esm.js CHANGED
@@ -3115,6 +3115,11 @@ function _dev_only_getFakeKernel(overrides) {
3115
3115
  getProviderBrick: kernel.getProviderBrick.bind(kernel)
3116
3116
  }, overrides);
3117
3117
  }
3118
+ /* istanbul ignore next */
3119
+
3120
+ function _dev_only_updateStoryboard(appId, storyboardPatch) {
3121
+ kernel._dev_only_updateStoryboard(appId, storyboardPatch);
3122
+ }
3118
3123
  class Runtime {
3119
3124
  constructor() {
3120
3125
  _defineProperty$1(this, "registerBrickTemplate", registerBrickTemplate);
@@ -7798,9 +7803,9 @@ class Kernel {
7798
7803
  }
7799
7804
 
7800
7805
  doFulfilStoryboard(storyboard) {
7801
- return _asyncToGenerator$4(function* () {
7802
- var _storyboard$meta;
7806
+ var _this5 = this;
7803
7807
 
7808
+ return _asyncToGenerator$4(function* () {
7804
7809
  if (window.STANDALONE_MICRO_APPS) {
7805
7810
  Object.assign(storyboard, {
7806
7811
  $$fulfilled: true
@@ -7819,28 +7824,43 @@ class Kernel {
7819
7824
  });
7820
7825
  }
7821
7826
 
7822
- storyboard.app.$$routeAliasMap = scanRouteAliasInStoryboard(storyboard);
7827
+ _this5.postProcessStoryboard(storyboard);
7828
+ })();
7829
+ }
7823
7830
 
7824
- if ((_storyboard$meta = storyboard.meta) !== null && _storyboard$meta !== void 0 && _storyboard$meta.i18n) {
7825
- // Prefix to avoid conflict between brick package's i18n namespace.
7826
- var i18nNamespace = getI18nNamespace("app", storyboard.app.id); // Support any language in `meta.i18n`.
7831
+ postProcessStoryboard(storyboard) {
7832
+ var _storyboard$meta;
7827
7833
 
7828
- Object.entries(storyboard.meta.i18n).forEach(_ref => {
7829
- var [lang, resources] = _ref;
7830
- i18next.addResourceBundle(lang, i18nNamespace, resources);
7831
- });
7832
- }
7833
- })();
7834
+ storyboard.app.$$routeAliasMap = scanRouteAliasInStoryboard(storyboard);
7835
+
7836
+ if ((_storyboard$meta = storyboard.meta) !== null && _storyboard$meta !== void 0 && _storyboard$meta.i18n) {
7837
+ // Prefix to avoid conflict between brick package's i18n namespace.
7838
+ var i18nNamespace = getI18nNamespace("app", storyboard.app.id); // Support any language in `meta.i18n`.
7839
+
7840
+ Object.entries(storyboard.meta.i18n).forEach(_ref => {
7841
+ var [lang, resources] = _ref;
7842
+ i18next.addResourceBundle(lang, i18nNamespace, resources);
7843
+ });
7844
+ }
7845
+ }
7846
+
7847
+ _dev_only_updateStoryboard(appId, storyboardPatch) {
7848
+ var storyboard = this.bootstrapData.storyboards.find(item => item.app.id === appId);
7849
+ Object.assign(storyboard, _objectSpread(_objectSpread({}, storyboardPatch), {}, {
7850
+ $$fulfilling: Promise.resolve(),
7851
+ $$fulfilled: true
7852
+ }));
7853
+ this.postProcessStoryboard(storyboard);
7834
7854
  }
7835
7855
 
7836
7856
  loadDepsOfStoryboard(storyboard) {
7837
- var _this5 = this;
7857
+ var _this6 = this;
7838
7858
 
7839
7859
  return _asyncToGenerator$4(function* () {
7840
7860
  var {
7841
7861
  brickPackages,
7842
7862
  templatePackages
7843
- } = _this5.bootstrapData;
7863
+ } = _this6.bootstrapData;
7844
7864
 
7845
7865
  if (storyboard.dependsAll) {
7846
7866
  var dllPath = window.DLL_PATH || {};
@@ -7906,7 +7926,7 @@ class Kernel {
7906
7926
  }
7907
7927
 
7908
7928
  loadDynamicBricksInBrickConf(brickConf) {
7909
- var _this6 = this;
7929
+ var _this7 = this;
7910
7930
 
7911
7931
  return _asyncToGenerator$4(function* () {
7912
7932
  // Notice: `brickConf` contains runtime data,
@@ -7914,12 +7934,12 @@ class Kernel {
7914
7934
  // which could cause stack overflow while traversing.
7915
7935
  var bricks = scanBricksInBrickConf(brickConf);
7916
7936
  var processors = scanProcessorsInAny(brickConf);
7917
- yield _this6.loadDynamicBricks(bricks, processors);
7937
+ yield _this7.loadDynamicBricks(bricks, processors);
7918
7938
  })();
7919
7939
  }
7920
7940
 
7921
7941
  loadDynamicBricks(bricks, processors) {
7922
- var _this7 = this;
7942
+ var _this8 = this;
7923
7943
 
7924
7944
  return _asyncToGenerator$4(function* () {
7925
7945
  var filteredBricks = bricks.filter( // Only try to load undefined custom elements.
@@ -7931,7 +7951,7 @@ class Kernel {
7931
7951
  } = getDllAndDepsByResource({
7932
7952
  bricks: filteredBricks,
7933
7953
  processors
7934
- }, _this7.bootstrapData.brickPackages);
7954
+ }, _this8.bootstrapData.brickPackages);
7935
7955
  yield loadScriptOfDll(dll);
7936
7956
  yield loadScriptOfBricksOrTemplates(deps);
7937
7957
  yield loadLazyBricks(filteredBricks);
@@ -7939,7 +7959,7 @@ class Kernel {
7939
7959
  }
7940
7960
 
7941
7961
  loadEditorBricks(editorBricks) {
7942
- var _this8 = this;
7962
+ var _this9 = this;
7943
7963
 
7944
7964
  return _asyncToGenerator$4(function* () {
7945
7965
  var {
@@ -7948,7 +7968,7 @@ class Kernel {
7948
7968
  } = getDllAndDepsByResource({
7949
7969
  editorBricks: editorBricks.filter( // Only try to load undefined custom elements.
7950
7970
  item => !customElements.get(item))
7951
- }, _this8.bootstrapData.brickPackages);
7971
+ }, _this9.bootstrapData.brickPackages);
7952
7972
  yield loadScriptOfDll(dll);
7953
7973
  yield loadScriptOfBricksOrTemplates(deps);
7954
7974
  })();
@@ -8052,10 +8072,10 @@ class Kernel {
8052
8072
  }
8053
8073
 
8054
8074
  getMicroAppApiOrchestrationMapAsync() {
8055
- var _this9 = this;
8075
+ var _this10 = this;
8056
8076
 
8057
8077
  return _asyncToGenerator$4(function* () {
8058
- return yield _this9.allMicroAppApiOrchestrationPromise;
8078
+ return yield _this10.allMicroAppApiOrchestrationPromise;
8059
8079
  })();
8060
8080
  }
8061
8081
 
@@ -8147,14 +8167,14 @@ class Kernel {
8147
8167
  }
8148
8168
 
8149
8169
  getRelatedAppsAsync(appId) {
8150
- var _this10 = this;
8170
+ var _this11 = this;
8151
8171
 
8152
8172
  return _asyncToGenerator$4(function* () {
8153
8173
  if (!appId) {
8154
8174
  return [];
8155
8175
  }
8156
8176
 
8157
- var allRelatedApps = yield _this10.allRelatedAppsPromise;
8177
+ var allRelatedApps = yield _this11.allRelatedAppsPromise;
8158
8178
  var thisApp = allRelatedApps.find(item => item.microAppId === appId);
8159
8179
 
8160
8180
  if (!thisApp) {
@@ -8166,38 +8186,38 @@ class Kernel {
8166
8186
  }
8167
8187
 
8168
8188
  updateWorkspaceStack() {
8169
- var _this11 = this;
8189
+ var _this12 = this;
8170
8190
 
8171
8191
  return _asyncToGenerator$4(function* () {
8172
- if (_this11.currentApp && _this11.currentApp.id) {
8192
+ if (_this12.currentApp && _this12.currentApp.id) {
8173
8193
  var workspace = {
8174
- appId: _this11.currentApp.id,
8175
- appName: _this11.currentApp.name,
8176
- appLocaleName: _this11.currentApp.localeName,
8177
- url: _this11.currentUrl
8194
+ appId: _this12.currentApp.id,
8195
+ appName: _this12.currentApp.name,
8196
+ appLocaleName: _this12.currentApp.localeName,
8197
+ url: _this12.currentUrl
8178
8198
  };
8179
8199
 
8180
- if (_this11.workspaceStack.length > 0) {
8181
- var previousWorkspace = _this11.workspaceStack[_this11.workspaceStack.length - 1];
8200
+ if (_this12.workspaceStack.length > 0) {
8201
+ var previousWorkspace = _this12.workspaceStack[_this12.workspaceStack.length - 1];
8182
8202
 
8183
- var _relatedApps = yield _this11.getRelatedAppsAsync(previousWorkspace.appId);
8203
+ var _relatedApps = yield _this12.getRelatedAppsAsync(previousWorkspace.appId);
8184
8204
 
8185
- if (_relatedApps.some(item => item.microAppId === _this11.currentApp.id)) {
8205
+ if (_relatedApps.some(item => item.microAppId === _this12.currentApp.id)) {
8186
8206
  Object.assign(previousWorkspace, workspace);
8187
8207
  return;
8188
8208
  }
8189
8209
  }
8190
8210
 
8191
- var relatedApps = yield _this11.getRelatedAppsAsync(_this11.currentApp.id);
8211
+ var relatedApps = yield _this12.getRelatedAppsAsync(_this12.currentApp.id);
8192
8212
 
8193
8213
  if (relatedApps.length > 0) {
8194
- _this11.workspaceStack.push(workspace);
8214
+ _this12.workspaceStack.push(workspace);
8195
8215
 
8196
8216
  return;
8197
8217
  }
8198
8218
  }
8199
8219
 
8200
- _this11.workspaceStack = [];
8220
+ _this12.workspaceStack = [];
8201
8221
  })();
8202
8222
  }
8203
8223
 
@@ -8238,22 +8258,22 @@ class Kernel {
8238
8258
  }
8239
8259
 
8240
8260
  getProviderBrick(provider) {
8241
- var _this12 = this;
8261
+ var _this13 = this;
8242
8262
 
8243
8263
  return _asyncToGenerator$4(function* () {
8244
8264
  if (isCustomApiProvider(provider)) {
8245
8265
  provider = CUSTOM_API_PROVIDER;
8246
8266
  }
8247
8267
 
8248
- if (_this12.providerRepository.has(provider)) {
8249
- return _this12.providerRepository.get(provider);
8268
+ if (_this13.providerRepository.has(provider)) {
8269
+ return _this13.providerRepository.get(provider);
8250
8270
  }
8251
8271
 
8252
8272
  if (provider === CUSTOM_API_PROVIDER && !customElements.get(provider)) {
8253
8273
  registerCustomApi();
8254
8274
  }
8255
8275
 
8256
- yield _this12.loadDynamicBricks([provider]);
8276
+ yield _this13.loadDynamicBricks([provider]);
8257
8277
 
8258
8278
  if (!customElements.get(provider)) {
8259
8279
  throw new Error("Provider not defined: \"".concat(provider, "\"."));
@@ -8261,7 +8281,7 @@ class Kernel {
8261
8281
 
8262
8282
  var brick = document.createElement(provider);
8263
8283
 
8264
- _this12.providerRepository.set(provider, brick);
8284
+ _this13.providerRepository.set(provider, brick);
8265
8285
 
8266
8286
  return brick;
8267
8287
  })();
@@ -12837,7 +12857,8 @@ var developHelper = {
12837
12857
  getFakeKernel: _dev_only_getFakeKernel,
12838
12858
 
12839
12859
  /** @deprecated Keep it for backward-compatibility. */
12840
- checkoutTplContext: noop
12860
+ checkoutTplContext: noop,
12861
+ updateStoryboard: _dev_only_updateStoryboard
12841
12862
  };
12842
12863
 
12843
12864
  var _excluded$2 = ["type"];