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