@next-core/brick-kit 2.131.0 → 2.132.1
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 +38 -0
- package/dist/index.bundle.js +62 -57
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +62 -58
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/Kernel.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/internal/getGeneralGlobals.d.ts.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,44 @@
|
|
|
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.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)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* preview route render error ([ebd1041](https://github.com/easyops-cn/next-core/commit/ebd1041acbb69f3b323a118bfb140fc5ff0248b0))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [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)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* the next site in iframe and loading bar is triggered by outerside ([8bfc755](https://github.com/easyops-cn/next-core/commit/8bfc755ec0c73c8b2290a2b1d588e462c3c9d551))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Reverts
|
|
26
|
+
|
|
27
|
+
* Revert "feat(): support MISC variable" ([a03e603](https://github.com/easyops-cn/next-core/commit/a03e60340c77b68e2cb11d2d4963b20110d1a845))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## [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)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Bug Fixes
|
|
37
|
+
|
|
38
|
+
* preview error when legacy was iframe ([f79e45f](https://github.com/easyops-cn/next-core/commit/f79e45f5e09afa70a02912e6086f02947563312a))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
6
44
|
# [2.131.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.130.0...@next-core/brick-kit@2.131.0) (2022-08-25)
|
|
7
45
|
|
|
8
46
|
|
package/dist/index.bundle.js
CHANGED
|
@@ -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) {
|
|
@@ -9230,7 +9222,8 @@
|
|
|
9230
9222
|
|
|
9231
9223
|
_dev_only_updateTemplatePreviewSettings(appId, templateId, settings) {
|
|
9232
9224
|
var {
|
|
9233
|
-
routes
|
|
9225
|
+
routes,
|
|
9226
|
+
app
|
|
9234
9227
|
} = this.bootstrapData.storyboards.find(item => item.app.id === appId);
|
|
9235
9228
|
var previewPath = "${APP.homepage}/_dev_only_/template-preview/".concat(templateId);
|
|
9236
9229
|
var previewRouteIndex = routes.findIndex(route => route.path === previewPath);
|
|
@@ -9240,7 +9233,8 @@
|
|
|
9240
9233
|
brick: templateId
|
|
9241
9234
|
}, _.pick(settings, "properties", "events", "lifeCycle", "context"))],
|
|
9242
9235
|
menu: false,
|
|
9243
|
-
exact: true
|
|
9236
|
+
exact: true,
|
|
9237
|
+
hybrid: app.legacy === "iframe"
|
|
9244
9238
|
};
|
|
9245
9239
|
|
|
9246
9240
|
if (previewRouteIndex === -1) {
|
|
@@ -9254,7 +9248,8 @@
|
|
|
9254
9248
|
var _snippetData$bricks;
|
|
9255
9249
|
|
|
9256
9250
|
var {
|
|
9257
|
-
routes
|
|
9251
|
+
routes,
|
|
9252
|
+
app
|
|
9258
9253
|
} = this.bootstrapData.storyboards.find(item => item.app.id === appId);
|
|
9259
9254
|
var previewPath = "${APP.homepage}/_dev_only_/snippet-preview/".concat(snippetData.snippetId);
|
|
9260
9255
|
var previewRouteIndex = routes.findIndex(route => route.path === previewPath);
|
|
@@ -9264,7 +9259,8 @@
|
|
|
9264
9259
|
brick: "span"
|
|
9265
9260
|
}],
|
|
9266
9261
|
menu: false,
|
|
9267
|
-
exact: true
|
|
9262
|
+
exact: true,
|
|
9263
|
+
hybrid: app.legacy === "iframe"
|
|
9268
9264
|
};
|
|
9269
9265
|
|
|
9270
9266
|
if (previewRouteIndex === -1) {
|
|
@@ -9276,15 +9272,19 @@
|
|
|
9276
9272
|
|
|
9277
9273
|
_dev_only_updateStoryboardByRoute(appId, newRoute) {
|
|
9278
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);
|
|
9279
9278
|
|
|
9280
9279
|
var replaceRoute = (routes, key) => {
|
|
9281
9280
|
return routes.map(route => {
|
|
9282
|
-
var routeKey = route
|
|
9281
|
+
var routeKey = getKey(route);
|
|
9283
9282
|
|
|
9284
9283
|
if (route.type === "routes") {
|
|
9285
9284
|
route.routes = replaceRoute(route.routes, key);
|
|
9286
9285
|
return route;
|
|
9287
9286
|
} else if (routeKey === key) {
|
|
9287
|
+
match = true;
|
|
9288
9288
|
return newRoute;
|
|
9289
9289
|
} else {
|
|
9290
9290
|
return route;
|
|
@@ -9292,7 +9292,11 @@
|
|
|
9292
9292
|
});
|
|
9293
9293
|
};
|
|
9294
9294
|
|
|
9295
|
-
storyboard.routes = replaceRoute(storyboard.routes, newRoute
|
|
9295
|
+
storyboard.routes = replaceRoute(storyboard.routes, getKey(newRoute));
|
|
9296
|
+
|
|
9297
|
+
if (!match) {
|
|
9298
|
+
storyboard.routes.unshift(newRoute);
|
|
9299
|
+
}
|
|
9296
9300
|
}
|
|
9297
9301
|
|
|
9298
9302
|
_dev_only_updateStoryboardByTemplate(appId, newTemplate, settings) {
|
|
@@ -14797,6 +14801,7 @@
|
|
|
14797
14801
|
exports.getHistory = getHistory;
|
|
14798
14802
|
exports.getMockInfo = getMockInfo;
|
|
14799
14803
|
exports.getRuntime = getRuntime;
|
|
14804
|
+
exports.getRuntimeMisc = getRuntimeMisc;
|
|
14800
14805
|
exports.handleHttpError = handleHttpError;
|
|
14801
14806
|
exports.httpErrorToString = httpErrorToString;
|
|
14802
14807
|
exports.i18nText = i18nText;
|