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