@next-core/brick-kit 2.117.12 → 2.117.15

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,36 @@
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.117.15](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.117.14...@next-core/brick-kit@2.117.15) (2022-04-22)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * mock _.uniqueId in storyboard functions ([f6d5eb2](https://github.com/easyops-cn/next-core/commit/f6d5eb2a6e00d7c5bd32e60a238b67c14641b840))
12
+
13
+
14
+
15
+
16
+
17
+ ## [2.117.14](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.117.13...@next-core/brick-kit@2.117.14) (2022-04-21)
18
+
19
+ **Note:** Version bump only for package @next-core/brick-kit
20
+
21
+
22
+
23
+
24
+
25
+ ## [2.117.13](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.117.12...@next-core/brick-kit@2.117.13) (2022-04-19)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * fix menu in iframe ([4a6f83d](https://github.com/easyops-cn/next-core/commit/4a6f83dda1c00665453cf2df2742cb8d27aff7c0))
31
+
32
+
33
+
34
+
35
+
6
36
  ## [2.117.12](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.117.11...@next-core/brick-kit@2.117.12) (2022-04-19)
7
37
 
8
38
 
@@ -582,7 +582,7 @@
582
582
  };
583
583
  }();
584
584
 
585
- function supply(attemptToVisitGlobals, providedGlobalVariables) {
585
+ function supply(attemptToVisitGlobals, providedGlobalVariables, mock) {
586
586
  var globalVariables = _objectSpread__default["default"]({}, providedGlobalVariables); // Allow limited browser builtin values.
587
587
 
588
588
 
@@ -590,7 +590,7 @@
590
590
 
591
591
  for (var variableName of attemptToVisitGlobals) {
592
592
  if (!Object.prototype.hasOwnProperty.call(globalVariables, variableName)) {
593
- var variable = supplyIndividual(variableName);
593
+ var variable = supplyIndividual(variableName, mock);
594
594
 
595
595
  if (variable !== undefined) {
596
596
  globalVariables[variableName] = variable;
@@ -618,14 +618,14 @@
618
618
  var shouldOmitInMoment = new Set(["lang", "langData", "locale", "localeData", "defineLocale", "updateLocale", "updateOffset"]);
619
619
  var allowedGlobalObjects = new Set(["Array", "Boolean", "Date", "Infinity", "JSON", "Math", "NaN", "Number", "String", "decodeURI", "decodeURIComponent", "encodeURI", "encodeURIComponent", "isFinite", "isNaN", "parseFloat", "parseInt", "Map", "Set", "URLSearchParams", "WeakMap", "WeakSet", "atob", "btoa"]);
620
620
 
621
- function supplyIndividual(variableName) {
621
+ function supplyIndividual(variableName, mock) {
622
622
  switch (variableName) {
623
623
  case "Object":
624
624
  // Do not allow mutable methods like `Object.assign`.
625
625
  return delegateMethods(Object, ["entries", "fromEntries", "keys", "values"]);
626
626
 
627
627
  case "_":
628
- return Object.fromEntries(Object.entries(lodash__default["default"]).filter(entry => !shouldOmitInLodash.has(entry[0])));
628
+ return Object.fromEntries(Object.entries(lodash__default["default"]).filter(entry => !shouldOmitInLodash.has(entry[0])).concat(mock ? [["uniqueId", prefix => "".concat(prefix !== null && prefix !== void 0 ? prefix : "", "42")]] : []));
629
629
 
630
630
  case "moment":
631
631
  return Object.assign(function () {
@@ -1687,7 +1687,7 @@
1687
1687
  app: currentApp,
1688
1688
  storyboardFunctions,
1689
1689
  isStoryboardFunction: true
1690
- })),
1690
+ }), !!collectCoverage),
1691
1691
  hooks: collector && {
1692
1692
  beforeEvaluate: collector.beforeEvaluate,
1693
1693
  beforeCall: collector.beforeCall,
@@ -8664,6 +8664,9 @@
8664
8664
  if (!misc) {
8665
8665
  misc = {
8666
8666
  isInIframe: false,
8667
+ isInIframeOfSameSite: false,
8668
+ isInIframeOfNext: false,
8669
+ isInIframeOfVisualBuilder: false,
8667
8670
  isInIframeOfLegacyConsole: false
8668
8671
  };
8669
8672
 
@@ -8671,8 +8674,19 @@
8671
8674
  misc.isInIframe = true;
8672
8675
 
8673
8676
  try {
8674
- // Handle when previewing in visual builder by iframe.
8675
- misc.isInIframeOfLegacyConsole = window.origin === window.parent.origin && getBasePath() === "/next/" && !window.parent.location.pathname.startsWith("/next/");
8677
+ // Handle:
8678
+ // - Previewing in visual builder by iframe.
8679
+ // - Nesting next in next.
8680
+ // - Nesting console in next.
8681
+ if (window.origin === window.parent.origin) {
8682
+ misc.isInIframeOfSameSite = true;
8683
+ var selfIsNext = getBasePath() === "/next/";
8684
+ var parentPathname = window.parent.location.pathname;
8685
+ var parentIsNext = parentPathname.startsWith("/next/");
8686
+ misc.isInIframeOfNext = (Number(selfIsNext) ^ Number(parentIsNext)) === 0;
8687
+ misc.isInIframeOfVisualBuilder = parentPathname.startsWith("".concat(parentIsNext ? "/next" : "", "/visual-builder/"));
8688
+ misc.isInIframeOfLegacyConsole = selfIsNext && !parentIsNext;
8689
+ }
8676
8690
  } catch (e) {// do nothing
8677
8691
  }
8678
8692
  }
@@ -10305,7 +10319,9 @@
10305
10319
  }));
10306
10320
  }
10307
10321
 
10308
- if (barsHidden || getRuntimeMisc().isInIframeOfLegacyConsole) {
10322
+ var misc;
10323
+
10324
+ if (barsHidden || (misc = getRuntimeMisc(), misc.isInIframeOfSameSite && !misc.isInIframeOfVisualBuilder)) {
10309
10325
  _this3.kernel.toggleBars(false);
10310
10326
  } else {
10311
10327
  yield constructMenu(menuBar, _this3.locationContext.getCurrentContext(), _this3.kernel);