@next-core/brick-kit 2.203.2 → 2.203.3

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.
@@ -12028,6 +12028,41 @@
12028
12028
  }
12029
12029
  }
12030
12030
 
12031
+ var initialize;
12032
+ var origin;
12033
+ var cachedUrl;
12034
+ var LOCAL_HOST = /^https?:\/\/localhost(?:$|:)/;
12035
+ function start(_origin) {
12036
+ if (location.origin !== _origin && !LOCAL_HOST.test(location.origin) && !LOCAL_HOST.test(_origin)) {
12037
+ // 禁止除 localhost 之外的跨域消息
12038
+ return;
12039
+ }
12040
+ initialize = true;
12041
+ origin = _origin;
12042
+ if (cachedUrl) {
12043
+ sendMessage({
12044
+ sender: "next-core",
12045
+ type: "url-change",
12046
+ url: cachedUrl
12047
+ });
12048
+ }
12049
+ }
12050
+ function sendMessage(data) {
12051
+ window.parent.postMessage(data, origin);
12052
+ }
12053
+ function sendUrlChange(data) {
12054
+ if (window.self !== window.parent && (data === null || data === void 0 ? void 0 : data.url) !== cachedUrl) {
12055
+ cachedUrl = data.url;
12056
+ if (initialize) {
12057
+ sendMessage({
12058
+ sender: "next-core",
12059
+ type: "url-change",
12060
+ url: data.url
12061
+ });
12062
+ }
12063
+ }
12064
+ }
12065
+
12031
12066
  class Router {
12032
12067
  constructor(kernel) {
12033
12068
  _defineProperty__default["default"](this, "defaultCollapsed", false);
@@ -12094,6 +12129,9 @@
12094
12129
  history.listen( /*#__PURE__*/function () {
12095
12130
  var _ref = _asyncToGenerator__default["default"](function* (location, action) {
12096
12131
  var _this$prevLocation$st, _location$state;
12132
+ sendUrlChange({
12133
+ url: window.location.origin + history.createHref(location)
12134
+ });
12097
12135
  var ignoreRendering = false;
12098
12136
  var omittedLocationProps = {
12099
12137
  hash: null,
@@ -12149,6 +12187,9 @@
12149
12187
  return _ref.apply(this, arguments);
12150
12188
  };
12151
12189
  }());
12190
+ sendUrlChange({
12191
+ url: window.location.href
12192
+ });
12152
12193
  yield _this.queuedRender(history.location);
12153
12194
  _this.kernel.firstRendered();
12154
12195
  })();
@@ -14673,7 +14714,8 @@
14673
14714
  getLegalRuntimeValue: _dev_only_getLegalRuntimeValue,
14674
14715
  render: _dev_only_render,
14675
14716
  setRealTimeDataInspectRoot,
14676
- addRealTimeDataInspectHook
14717
+ addRealTimeDataInspectHook,
14718
+ iframePreviewInitialize: start
14677
14719
  };
14678
14720
 
14679
14721
  var _excluded$2 = ["type"];