@next-core/brick-kit 2.131.1 → 2.132.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,22 @@
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.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)
7
+
8
+
9
+ ### Features
10
+
11
+ * the next site in iframe and loading bar is triggered by outerside ([8bfc755](https://github.com/easyops-cn/next-core/commit/8bfc755ec0c73c8b2290a2b1d588e462c3c9d551))
12
+
13
+
14
+ ### Reverts
15
+
16
+ * Revert "feat(): support MISC variable" ([a03e603](https://github.com/easyops-cn/next-core/commit/a03e60340c77b68e2cb11d2d4963b20110d1a845))
17
+
18
+
19
+
20
+
21
+
6
22
  ## [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
23
 
8
24
 
@@ -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) {
@@ -14801,6 +14793,7 @@
14801
14793
  exports.getHistory = getHistory;
14802
14794
  exports.getMockInfo = getMockInfo;
14803
14795
  exports.getRuntime = getRuntime;
14796
+ exports.getRuntimeMisc = getRuntimeMisc;
14804
14797
  exports.handleHttpError = handleHttpError;
14805
14798
  exports.httpErrorToString = httpErrorToString;
14806
14799
  exports.i18nText = i18nText;