@next-core/brick-kit 2.131.1 → 2.132.2

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,41 @@
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.132.2](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.132.1...@next-core/brick-kit@2.132.2) (2022-08-26)
7
+
8
+ **Note:** Version bump only for package @next-core/brick-kit
9
+
10
+
11
+
12
+
13
+
14
+ ## [2.132.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.132.0...@next-core/brick-kit@2.132.1) (2022-08-25)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * preview route render error ([ebd1041](https://github.com/easyops-cn/next-core/commit/ebd1041acbb69f3b323a118bfb140fc5ff0248b0))
20
+
21
+
22
+
23
+
24
+
25
+ # [2.132.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.131.1...@next-core/brick-kit@2.132.0) (2022-08-25)
26
+
27
+
28
+ ### Features
29
+
30
+ * the next site in iframe and loading bar is triggered by outerside ([8bfc755](https://github.com/easyops-cn/next-core/commit/8bfc755ec0c73c8b2290a2b1d588e462c3c9d551))
31
+
32
+
33
+ ### Reverts
34
+
35
+ * Revert "feat(): support MISC variable" ([a03e603](https://github.com/easyops-cn/next-core/commit/a03e60340c77b68e2cb11d2d4963b20110d1a845))
36
+
37
+
38
+
39
+
40
+
6
41
  ## [2.131.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.131.0...@next-core/brick-kit@2.131.1) (2022-08-25)
7
42
 
8
43
 
@@ -1564,44 +1564,6 @@
1564
1564
  });
1565
1565
  }
1566
1566
 
1567
- var misc;
1568
- function getRuntimeMisc() {
1569
- if (!misc) {
1570
- misc = {
1571
- isInIframe: false,
1572
- isInIframeOfSameSite: false,
1573
- isInIframeOfNext: false,
1574
- isInIframeOfVisualBuilder: false,
1575
- isInIframeOfLegacyConsole: false
1576
- };
1577
-
1578
- if (window !== window.parent) {
1579
- misc.isInIframe = true;
1580
-
1581
- try {
1582
- // Handle:
1583
- // - Previewing in visual builder by iframe.
1584
- // - Nesting next in next.
1585
- // - Nesting console in next.
1586
- if (window.origin === window.parent.origin) {
1587
- misc.isInIframeOfSameSite = true;
1588
- var selfIsNext = getBasePath() === "/next/";
1589
- var parentPathname = window.parent.location.pathname;
1590
- var parentIsNext = parentPathname.startsWith("/next/");
1591
- misc.isInIframeOfNext = (Number(selfIsNext) ^ Number(parentIsNext)) === 0;
1592
- misc.isInIframeOfVisualBuilder = parentPathname.startsWith("".concat(parentIsNext ? "/next" : "", "/visual-builder/"));
1593
- misc.isInIframeOfLegacyConsole = selfIsNext && !parentIsNext;
1594
- }
1595
- } catch (e) {// do nothing
1596
- }
1597
- }
1598
-
1599
- Object.freeze(misc);
1600
- }
1601
-
1602
- return misc;
1603
- }
1604
-
1605
1567
  // `GeneralGlobals` are globals which are page-state-agnostic,
1606
1568
  // thus they can be used both in storyboard expressions and functions.
1607
1569
  function getGeneralGlobals(attemptToVisitGlobals, options) {
@@ -1654,9 +1616,6 @@
1654
1616
  getCssPropertyValue: collectCoverage ? () => "" : getCssPropertyValue
1655
1617
  };
1656
1618
 
1657
- case "RUNTIME_MISC":
1658
- return collectCoverage ? fakeRuntimeMisc() : getRuntimeMisc();
1659
-
1660
1619
  case "console":
1661
1620
  return isStoryboardFunction ? getReadOnlyProxy(console) : undefined;
1662
1621
 
@@ -1692,16 +1651,6 @@
1692
1651
  return true;
1693
1652
  }
1694
1653
 
1695
- function fakeRuntimeMisc() {
1696
- return {
1697
- isInIframe: false,
1698
- isInIframeOfSameSite: false,
1699
- isInIframeOfNext: false,
1700
- isInIframeOfVisualBuilder: false,
1701
- isInIframeOfLegacyConsole: false
1702
- };
1703
- }
1704
-
1705
1654
  /** @internal */
1706
1655
 
1707
1656
  /** @internal */
@@ -8819,6 +8768,44 @@
8819
8768
  return ((_state$map = state === null || state === void 0 ? void 0 : state.map(item => item.name)) !== null && _state$map !== void 0 ? _state$map : []).concat(Object.keys((_proxy$properties = proxy === null || proxy === void 0 ? void 0 : proxy.properties) !== null && _proxy$properties !== void 0 ? _proxy$properties : {}));
8820
8769
  }
8821
8770
 
8771
+ var misc;
8772
+ function getRuntimeMisc() {
8773
+ if (!misc) {
8774
+ misc = {
8775
+ isInIframe: false,
8776
+ isInIframeOfSameSite: false,
8777
+ isInIframeOfNext: false,
8778
+ isInIframeOfVisualBuilder: false,
8779
+ isInIframeOfLegacyConsole: false
8780
+ };
8781
+
8782
+ if (window !== window.parent) {
8783
+ misc.isInIframe = true;
8784
+
8785
+ try {
8786
+ // Handle:
8787
+ // - Previewing in visual builder by iframe.
8788
+ // - Nesting next in next.
8789
+ // - Nesting console in next.
8790
+ if (window.origin === window.parent.origin) {
8791
+ misc.isInIframeOfSameSite = true;
8792
+ var selfIsNext = getBasePath() === "/next/";
8793
+ var parentPathname = window.parent.location.pathname;
8794
+ var parentIsNext = parentPathname.startsWith("/next/");
8795
+ misc.isInIframeOfNext = (Number(selfIsNext) ^ Number(parentIsNext)) === 0;
8796
+ misc.isInIframeOfVisualBuilder = parentPathname.startsWith("".concat(parentIsNext ? "/next" : "", "/visual-builder/"));
8797
+ misc.isInIframeOfLegacyConsole = selfIsNext && !parentIsNext;
8798
+ }
8799
+ } catch (e) {// do nothing
8800
+ }
8801
+ }
8802
+
8803
+ Object.freeze(misc);
8804
+ }
8805
+
8806
+ return misc;
8807
+ }
8808
+
8822
8809
  class Kernel {
8823
8810
  constructor() {
8824
8811
  var _this = this;
@@ -8949,6 +8936,11 @@
8949
8936
 
8950
8937
  listenDevtoolsEagerly();
8951
8938
  _this2.mountPoints = mountPoints;
8939
+
8940
+ if (getRuntimeMisc().isInIframeOfSameSite && !getRuntimeMisc().isInIframeOfVisualBuilder) {
8941
+ document.body.classList.add("bars-hidden-in-iframe");
8942
+ }
8943
+
8952
8944
  yield Promise.all([_this2.loadCheckLogin(), _this2.loadMicroApps()]);
8953
8945
 
8954
8946
  if (_this2.bootstrapData.storyboards.length === 0) {
@@ -9280,15 +9272,19 @@
9280
9272
 
9281
9273
  _dev_only_updateStoryboardByRoute(appId, newRoute) {
9282
9274
  var storyboard = this.bootstrapData.storyboards.find(item => item.app.id === appId);
9275
+ var match = false;
9276
+
9277
+ var getKey = route => "".concat(route.path, ".").concat(route.exact);
9283
9278
 
9284
9279
  var replaceRoute = (routes, key) => {
9285
9280
  return routes.map(route => {
9286
- var routeKey = route.path;
9281
+ var routeKey = getKey(route);
9287
9282
 
9288
9283
  if (route.type === "routes") {
9289
9284
  route.routes = replaceRoute(route.routes, key);
9290
9285
  return route;
9291
9286
  } else if (routeKey === key) {
9287
+ match = true;
9292
9288
  return newRoute;
9293
9289
  } else {
9294
9290
  return route;
@@ -9296,7 +9292,11 @@
9296
9292
  });
9297
9293
  };
9298
9294
 
9299
- storyboard.routes = replaceRoute(storyboard.routes, newRoute.path);
9295
+ storyboard.routes = replaceRoute(storyboard.routes, getKey(newRoute));
9296
+
9297
+ if (!match) {
9298
+ storyboard.routes.unshift(newRoute);
9299
+ }
9300
9300
  }
9301
9301
 
9302
9302
  _dev_only_updateStoryboardByTemplate(appId, newTemplate, settings) {
@@ -14801,6 +14801,7 @@
14801
14801
  exports.getHistory = getHistory;
14802
14802
  exports.getMockInfo = getMockInfo;
14803
14803
  exports.getRuntime = getRuntime;
14804
+ exports.getRuntimeMisc = getRuntimeMisc;
14804
14805
  exports.handleHttpError = handleHttpError;
14805
14806
  exports.httpErrorToString = httpErrorToString;
14806
14807
  exports.i18nText = i18nText;