@next-core/brick-kit 2.119.1 → 2.121.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 +35 -0
- package/dist/index.bundle.js +139 -18
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +139 -18
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/LocationContext.d.ts +5 -0
- package/dist/types/core/LocationContext.d.ts.map +1 -1
- package/dist/types/core/MessageDispatcher.d.ts +3 -0
- package/dist/types/core/MessageDispatcher.d.ts.map +1 -1
- package/dist/types/core/Router.d.ts.map +1 -1
- package/dist/types/internal/bindListeners.d.ts.map +1 -1
- package/dist/types/internal/proxyFactories.d.ts +1 -1
- package/dist/types/internal/proxyFactories.d.ts.map +1 -1
- package/dist/types/websocket/WebSocketService.d.ts +4 -2
- package/dist/types/websocket/WebSocketService.d.ts.map +1 -1
- package/package.json +6 -6
package/dist/index.esm.js
CHANGED
|
@@ -4072,8 +4072,16 @@ class WebsocketMessageResponse {
|
|
|
4072
4072
|
}
|
|
4073
4073
|
|
|
4074
4074
|
class WebSocketService {
|
|
4075
|
+
get retryCount() {
|
|
4076
|
+
return this._retryCount;
|
|
4077
|
+
}
|
|
4078
|
+
|
|
4079
|
+
set retryCount(value) {
|
|
4080
|
+
this._retryCount = value;
|
|
4081
|
+
}
|
|
4082
|
+
|
|
4075
4083
|
constructor(options) {
|
|
4076
|
-
_defineProperty$1(this, "
|
|
4084
|
+
_defineProperty$1(this, "_retryCount", 0);
|
|
4077
4085
|
|
|
4078
4086
|
_defineProperty$1(this, "ws", null);
|
|
4079
4087
|
|
|
@@ -4142,7 +4150,18 @@ class WebSocketService {
|
|
|
4142
4150
|
};
|
|
4143
4151
|
|
|
4144
4152
|
this.ws.onerror = event => {
|
|
4145
|
-
|
|
4153
|
+
var {
|
|
4154
|
+
options,
|
|
4155
|
+
retryCount,
|
|
4156
|
+
state,
|
|
4157
|
+
readyState
|
|
4158
|
+
} = this;
|
|
4159
|
+
this.onError(event, {
|
|
4160
|
+
options: getReadOnlyProxy(options),
|
|
4161
|
+
retryCount,
|
|
4162
|
+
state,
|
|
4163
|
+
readyState
|
|
4164
|
+
}); // eslint-disable-next-line no-console
|
|
4146
4165
|
|
|
4147
4166
|
console.log("WebSocket encountered error: ", event);
|
|
4148
4167
|
this.reconnect();
|
|
@@ -4202,7 +4221,7 @@ class WebSocketService {
|
|
|
4202
4221
|
|
|
4203
4222
|
onClose(event) {}
|
|
4204
4223
|
|
|
4205
|
-
onError(event) {}
|
|
4224
|
+
onError(event, data) {}
|
|
4206
4225
|
|
|
4207
4226
|
onMessage(message) {}
|
|
4208
4227
|
|
|
@@ -5472,8 +5491,27 @@ class MessageDispatcher {
|
|
|
5472
5491
|
}
|
|
5473
5492
|
|
|
5474
5493
|
subscribe(channel, topic, callback) {
|
|
5494
|
+
var _this$ws;
|
|
5495
|
+
|
|
5475
5496
|
var req = new WebsocketMessageRequest(PluginWebSocketMessageEvent.SUB, topic);
|
|
5476
|
-
this.setMessageCallbackHandlers(req.identity, callback);
|
|
5497
|
+
this.setMessageCallbackHandlers(req.identity, callback);
|
|
5498
|
+
|
|
5499
|
+
if (((_this$ws = this.ws) === null || _this$ws === void 0 ? void 0 : _this$ws.state) === "finished") {
|
|
5500
|
+
var {
|
|
5501
|
+
options,
|
|
5502
|
+
retryCount,
|
|
5503
|
+
state,
|
|
5504
|
+
readyState
|
|
5505
|
+
} = this.ws;
|
|
5506
|
+
this.handleError({
|
|
5507
|
+
options: getReadOnlyProxy(options),
|
|
5508
|
+
retryCount,
|
|
5509
|
+
state,
|
|
5510
|
+
readyState
|
|
5511
|
+
});
|
|
5512
|
+
return;
|
|
5513
|
+
} // Prevent repeated subscriptions to the same topic.
|
|
5514
|
+
|
|
5477
5515
|
|
|
5478
5516
|
if (!this.channels.has(req.topic)) {
|
|
5479
5517
|
this.channels.set(req.topic, channel);
|
|
@@ -5486,7 +5524,7 @@ class MessageDispatcher {
|
|
|
5486
5524
|
|
|
5487
5525
|
if (!t) {
|
|
5488
5526
|
// eslint-disable-next-line no-console
|
|
5489
|
-
console.error("Message channel\
|
|
5527
|
+
console.error("Message channel: \"".concat(channel, "\" not found. "));
|
|
5490
5528
|
return;
|
|
5491
5529
|
}
|
|
5492
5530
|
|
|
@@ -5517,6 +5555,10 @@ class MessageDispatcher {
|
|
|
5517
5555
|
createWebsocketService() {
|
|
5518
5556
|
this.ws = createWebSocket();
|
|
5519
5557
|
|
|
5558
|
+
this.ws.onError = (_event, data) => {
|
|
5559
|
+
this.handleError(data);
|
|
5560
|
+
};
|
|
5561
|
+
|
|
5520
5562
|
this.ws.onMessage = message => {
|
|
5521
5563
|
this.reducer(message);
|
|
5522
5564
|
};
|
|
@@ -5526,6 +5568,19 @@ class MessageDispatcher {
|
|
|
5526
5568
|
};
|
|
5527
5569
|
}
|
|
5528
5570
|
|
|
5571
|
+
handleError(data) {
|
|
5572
|
+
var event = new CustomEvent("callback.error", {
|
|
5573
|
+
detail: _objectSpread({
|
|
5574
|
+
payload: {
|
|
5575
|
+
message: {}
|
|
5576
|
+
}
|
|
5577
|
+
}, data)
|
|
5578
|
+
});
|
|
5579
|
+
this.messageCallbackHandlers.forEach(callbacks => {
|
|
5580
|
+
this.messageSubscribeCallbacksHandler(callbacks, "error", event);
|
|
5581
|
+
});
|
|
5582
|
+
}
|
|
5583
|
+
|
|
5529
5584
|
onClose(event) {
|
|
5530
5585
|
_internalApiMessageCloseHandler(event);
|
|
5531
5586
|
}
|
|
@@ -5612,19 +5667,22 @@ class MessageDispatcher {
|
|
|
5612
5667
|
}
|
|
5613
5668
|
}
|
|
5614
5669
|
|
|
5615
|
-
|
|
5616
|
-
var callbacks = this.messageCallbackHandlers.get(response.identity);
|
|
5617
|
-
|
|
5670
|
+
messageSubscribeCallbacksHandler(callbacks, method, event) {
|
|
5618
5671
|
if (Array.isArray(callbacks)) {
|
|
5619
5672
|
for (var handler of callbacks) {
|
|
5620
|
-
|
|
5621
|
-
detail: response.message
|
|
5622
|
-
});
|
|
5623
|
-
this.dispatch(e, handler.runtimeBrick, handler.context, [].concat(handler === null || handler === void 0 ? void 0 : handler[method]).filter(Boolean));
|
|
5673
|
+
this.dispatch(event, handler.runtimeBrick, handler.context, [].concat(handler === null || handler === void 0 ? void 0 : handler[method]).filter(Boolean));
|
|
5624
5674
|
}
|
|
5625
5675
|
}
|
|
5626
5676
|
}
|
|
5627
5677
|
|
|
5678
|
+
messageSubscribeResponseEventHandler(response, method, event) {
|
|
5679
|
+
var callbacks = this.messageCallbackHandlers.get(response.identity);
|
|
5680
|
+
var e = new CustomEvent(event, {
|
|
5681
|
+
detail: response.message
|
|
5682
|
+
});
|
|
5683
|
+
this.messageSubscribeCallbacksHandler(callbacks, method, e);
|
|
5684
|
+
}
|
|
5685
|
+
|
|
5628
5686
|
}
|
|
5629
5687
|
|
|
5630
5688
|
var timeoutIdList = new Set();
|
|
@@ -6668,7 +6726,14 @@ function builtinMessageListenerFactory(method, args, ifContainer, context) {
|
|
|
6668
6726
|
return;
|
|
6669
6727
|
}
|
|
6670
6728
|
|
|
6671
|
-
|
|
6729
|
+
var processArg = argsFactory(args, context, event);
|
|
6730
|
+
var contentNode = /*#__PURE__*/React.createElement("span", null, "".concat(processArg[0]));
|
|
6731
|
+
var argProp = {
|
|
6732
|
+
content: contentNode,
|
|
6733
|
+
className: "ant-message-notice-".concat(method)
|
|
6734
|
+
};
|
|
6735
|
+
processArg[0] = argProp;
|
|
6736
|
+
message[method](...processArg);
|
|
6672
6737
|
};
|
|
6673
6738
|
}
|
|
6674
6739
|
|
|
@@ -9077,12 +9142,16 @@ class LocationContext {
|
|
|
9077
9142
|
|
|
9078
9143
|
_defineProperty$1(this, "messageHandlers", []);
|
|
9079
9144
|
|
|
9145
|
+
_defineProperty$1(this, "scrollIntoViewHandlersMap", new Map());
|
|
9146
|
+
|
|
9080
9147
|
_defineProperty$1(this, "segues", {});
|
|
9081
9148
|
|
|
9082
9149
|
_defineProperty$1(this, "currentMatch", void 0);
|
|
9083
9150
|
|
|
9084
9151
|
_defineProperty$1(this, "storyboardContextWrapper", new StoryboardContextWrapper());
|
|
9085
9152
|
|
|
9153
|
+
_defineProperty$1(this, "observersList", []);
|
|
9154
|
+
|
|
9086
9155
|
this.kernel = kernel;
|
|
9087
9156
|
this.location = location;
|
|
9088
9157
|
this.resolver = new Resolver(kernel);
|
|
@@ -9449,7 +9518,7 @@ class LocationContext {
|
|
|
9449
9518
|
_this6 = this;
|
|
9450
9519
|
|
|
9451
9520
|
return _asyncToGenerator$4(function* () {
|
|
9452
|
-
var _this6$kernel$nextApp;
|
|
9521
|
+
var _this6$kernel$nextApp, _brickConf$lifeCycle, _brick$lifeCycle;
|
|
9453
9522
|
|
|
9454
9523
|
var tplStack = _arguments.length > 4 && _arguments[4] !== undefined ? _arguments[4] : [];
|
|
9455
9524
|
var tplContextId = brickConf[symbolForTplContextId];
|
|
@@ -9490,7 +9559,7 @@ class LocationContext {
|
|
|
9490
9559
|
yield _this6.storyboardContextWrapper.define(brickConf.context, context, brick);
|
|
9491
9560
|
yield _this6.preCheckPermissions(brickConf, context);
|
|
9492
9561
|
var trackingContextList = [];
|
|
9493
|
-
Object.assign(brick, {
|
|
9562
|
+
Object.assign(brick, _objectSpread({
|
|
9494
9563
|
type: tplTagName || brickConf.brick,
|
|
9495
9564
|
properties: computeRealProperties(brickConf.properties, context, brickConf.injectDeep !== false, trackingContextList),
|
|
9496
9565
|
events: isObject(brickConf.events) ? brickConf.events : {},
|
|
@@ -9500,7 +9569,11 @@ class LocationContext {
|
|
|
9500
9569
|
refForProxy: brickConf[symbolForRefForProxy],
|
|
9501
9570
|
tplContextId,
|
|
9502
9571
|
iid: brickConf.iid
|
|
9503
|
-
})
|
|
9572
|
+
}, (_brickConf$lifeCycle = brickConf.lifeCycle) !== null && _brickConf$lifeCycle !== void 0 && _brickConf$lifeCycle.onScrollIntoView ? {
|
|
9573
|
+
lifeCycle: {
|
|
9574
|
+
onScrollIntoView: brickConf.lifeCycle.onScrollIntoView
|
|
9575
|
+
}
|
|
9576
|
+
} : {}));
|
|
9504
9577
|
|
|
9505
9578
|
if (brickConf[symbolForComputedPropsFromProxy]) {
|
|
9506
9579
|
Object.entries(brickConf[symbolForComputedPropsFromProxy]).forEach(_ref2 => {
|
|
@@ -9515,7 +9588,11 @@ class LocationContext {
|
|
|
9515
9588
|
brick.refForProxy.brick = brick;
|
|
9516
9589
|
}
|
|
9517
9590
|
|
|
9518
|
-
_this6.registerHandlersFromLifeCycle(brickConf.lifeCycle, brick, match, tplContextId);
|
|
9591
|
+
_this6.registerHandlersFromLifeCycle(brickConf.lifeCycle, brick, match, tplContextId);
|
|
9592
|
+
|
|
9593
|
+
if ((_brick$lifeCycle = brick.lifeCycle) !== null && _brick$lifeCycle !== void 0 && _brick$lifeCycle.onScrollIntoView) {
|
|
9594
|
+
_this6.brickBindObserver(brick);
|
|
9595
|
+
} // Then, resolve the brick.
|
|
9519
9596
|
|
|
9520
9597
|
|
|
9521
9598
|
yield _this6.resolver.resolve(brickConf, brick, context);
|
|
@@ -9590,7 +9667,8 @@ class LocationContext {
|
|
|
9590
9667
|
onAnchorUnload,
|
|
9591
9668
|
onMediaChange,
|
|
9592
9669
|
onMessage,
|
|
9593
|
-
onMessageClose
|
|
9670
|
+
onMessageClose,
|
|
9671
|
+
onScrollIntoView
|
|
9594
9672
|
} = lifeCycle !== null && lifeCycle !== void 0 ? lifeCycle : {};
|
|
9595
9673
|
|
|
9596
9674
|
if (onBeforePageLoad) {
|
|
@@ -9673,6 +9751,15 @@ class LocationContext {
|
|
|
9673
9751
|
handler: onMessageClose
|
|
9674
9752
|
});
|
|
9675
9753
|
}
|
|
9754
|
+
|
|
9755
|
+
if (onScrollIntoView) {
|
|
9756
|
+
this.scrollIntoViewHandlersMap.set(brick.iid, {
|
|
9757
|
+
brick,
|
|
9758
|
+
match,
|
|
9759
|
+
tplContextId,
|
|
9760
|
+
handler: onScrollIntoView.handlers
|
|
9761
|
+
});
|
|
9762
|
+
}
|
|
9676
9763
|
}
|
|
9677
9764
|
|
|
9678
9765
|
handleBeforePageLoad() {
|
|
@@ -9727,6 +9814,17 @@ class LocationContext {
|
|
|
9727
9814
|
}), this.messageCloseHandlers);
|
|
9728
9815
|
}
|
|
9729
9816
|
|
|
9817
|
+
handleScrollIntoView(id) {
|
|
9818
|
+
var currentHandlers = this.scrollIntoViewHandlersMap.get(id);
|
|
9819
|
+
this.dispatchLifeCycleEvent(new CustomEvent("scroll.into.view"), [currentHandlers]);
|
|
9820
|
+
}
|
|
9821
|
+
|
|
9822
|
+
handleBrickBindObserver() {
|
|
9823
|
+
this.observersList.forEach(value => {
|
|
9824
|
+
value.$$observe();
|
|
9825
|
+
});
|
|
9826
|
+
}
|
|
9827
|
+
|
|
9730
9828
|
getCurrentMatch() {
|
|
9731
9829
|
return this.currentMatch;
|
|
9732
9830
|
}
|
|
@@ -9759,6 +9857,27 @@ class LocationContext {
|
|
|
9759
9857
|
})();
|
|
9760
9858
|
}
|
|
9761
9859
|
|
|
9860
|
+
brickBindObserver(brick) {
|
|
9861
|
+
var _brick$lifeCycle$onSc;
|
|
9862
|
+
|
|
9863
|
+
var threshold = (_brick$lifeCycle$onSc = brick.lifeCycle.onScrollIntoView.threshold) !== null && _brick$lifeCycle$onSc !== void 0 ? _brick$lifeCycle$onSc : 0.1;
|
|
9864
|
+
var observer = new IntersectionObserver((entries, observer) => {
|
|
9865
|
+
entries.forEach(entry => {
|
|
9866
|
+
if (entry.isIntersecting) {
|
|
9867
|
+
if (entry.intersectionRatio >= threshold) {
|
|
9868
|
+
this.handleScrollIntoView(brick.iid);
|
|
9869
|
+
observer.disconnect();
|
|
9870
|
+
}
|
|
9871
|
+
}
|
|
9872
|
+
});
|
|
9873
|
+
}, {
|
|
9874
|
+
threshold
|
|
9875
|
+
});
|
|
9876
|
+
this.observersList.push({
|
|
9877
|
+
$$observe: () => observer.observe(brick.element)
|
|
9878
|
+
});
|
|
9879
|
+
}
|
|
9880
|
+
|
|
9762
9881
|
}
|
|
9763
9882
|
|
|
9764
9883
|
function unmountTree(mountPoint) {
|
|
@@ -10638,6 +10757,8 @@ class Router {
|
|
|
10638
10757
|
window.scrollTo(0, 0);
|
|
10639
10758
|
|
|
10640
10759
|
if (!failed) {
|
|
10760
|
+
_this3.locationContext.handleBrickBindObserver();
|
|
10761
|
+
|
|
10641
10762
|
_this3.locationContext.handlePageLoad();
|
|
10642
10763
|
|
|
10643
10764
|
_this3.locationContext.handleAnchorLoad();
|