@next-core/runtime 1.21.0 → 1.21.2
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/cjs/createRoot.js +4 -6
- package/dist/cjs/createRoot.js.map +1 -1
- package/dist/cjs/internal/CustomTemplates/bindTemplateProxy.js +1 -1
- package/dist/cjs/internal/CustomTemplates/bindTemplateProxy.js.map +1 -1
- package/dist/cjs/internal/Renderer.js +159 -59
- package/dist/cjs/internal/Renderer.js.map +1 -1
- package/dist/cjs/internal/RendererContext.js +87 -11
- package/dist/cjs/internal/RendererContext.js.map +1 -1
- package/dist/cjs/internal/Router.js +109 -77
- package/dist/cjs/internal/Router.js.map +1 -1
- package/dist/cjs/internal/data/DataStore.js +53 -7
- package/dist/cjs/internal/data/DataStore.js.map +1 -1
- package/dist/cjs/internal/matchRoutes.js +9 -5
- package/dist/cjs/internal/matchRoutes.js.map +1 -1
- package/dist/cjs/internal/matchStoryboard.js +8 -3
- package/dist/cjs/internal/matchStoryboard.js.map +1 -1
- package/dist/cjs/internal/secret_internals.js +11 -18
- package/dist/cjs/internal/secret_internals.js.map +1 -1
- package/dist/esm/createRoot.js +5 -7
- package/dist/esm/createRoot.js.map +1 -1
- package/dist/esm/internal/CustomTemplates/bindTemplateProxy.js +1 -1
- package/dist/esm/internal/CustomTemplates/bindTemplateProxy.js.map +1 -1
- package/dist/esm/internal/Renderer.js +167 -69
- package/dist/esm/internal/Renderer.js.map +1 -1
- package/dist/esm/internal/RendererContext.js +94 -11
- package/dist/esm/internal/RendererContext.js.map +1 -1
- package/dist/esm/internal/Router.js +148 -103
- package/dist/esm/internal/Router.js.map +1 -1
- package/dist/esm/internal/data/DataStore.js +51 -6
- package/dist/esm/internal/data/DataStore.js.map +1 -1
- package/dist/esm/internal/matchRoutes.js +8 -5
- package/dist/esm/internal/matchRoutes.js.map +1 -1
- package/dist/esm/internal/matchStoryboard.js +7 -3
- package/dist/esm/internal/matchStoryboard.js.map +1 -1
- package/dist/esm/internal/secret_internals.js +13 -20
- package/dist/esm/internal/secret_internals.js.map +1 -1
- package/dist/types/internal/Renderer.d.ts +12 -4
- package/dist/types/internal/RendererContext.d.ts +31 -5
- package/dist/types/internal/data/DataStore.d.ts +13 -4
- package/dist/types/internal/matchRoutes.d.ts +6 -0
- package/dist/types/internal/matchStoryboard.d.ts +1 -0
- package/package.json +3 -3
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
3
3
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
4
|
var _excluded = ["blockingList", "node", "menuRequests", "hasTrackingControls"],
|
|
5
5
|
_excluded2 = ["if", "permissionsPreCheck"],
|
|
6
6
|
_excluded3 = ["formData"],
|
|
7
7
|
_excluded4 = ["src"],
|
|
8
8
|
_excluded5 = ["href"];
|
|
9
|
-
import { enqueueStableLoadBricks, loadBricksImperatively, loadProcessorsImperatively, loadScript, loadStyle } from "@next-core/loader";
|
|
9
|
+
import { enqueueStableLoadBricks, flushStableLoadBricks, loadBricksImperatively, loadProcessorsImperatively, loadScript, loadStyle } from "@next-core/loader";
|
|
10
10
|
import { isTrackAll } from "@next-core/cook";
|
|
11
11
|
import { hasOwnProperty } from "@next-core/utils/general";
|
|
12
|
+
import { strictCollectMemberUsage } from "@next-core/utils/storyboard";
|
|
12
13
|
import { debounce } from "lodash";
|
|
13
14
|
import { asyncCheckBrickIf } from "./compute/checkIf.js";
|
|
14
15
|
import { asyncComputeRealPropertyEntries, constructAsyncProperties } from "./compute/computeRealProperties.js";
|
|
15
16
|
import { resolveData } from "./data/resolveData.js";
|
|
16
17
|
import { asyncComputeRealValue } from "./compute/computeRealValue.js";
|
|
17
18
|
import { listenOnTrackingContext } from "./compute/listenOnTrackingContext.js";
|
|
18
|
-
import { matchRoutes } from "./matchRoutes.js";
|
|
19
|
+
import { matchRoute, matchRoutes } from "./matchRoutes.js";
|
|
19
20
|
import { symbolForAsyncComputedPropsFromHost, symbolForTPlExternalForEachItem, symbolForTplStateStoreId } from "./CustomTemplates/constants.js";
|
|
20
21
|
import { expandCustomTemplate } from "./CustomTemplates/expandCustomTemplate.js";
|
|
21
22
|
import { getTagNameOfCustomTemplate, getTplStateStore } from "./CustomTemplates/utils.js";
|
|
@@ -28,12 +29,12 @@ import { FORM_RENDERER, symbolForFormStateStoreId } from "./FormRenderer/constan
|
|
|
28
29
|
import { expandFormRenderer } from "./FormRenderer/expandFormRenderer.js";
|
|
29
30
|
import { isPreEvaluated } from "./compute/evaluate.js";
|
|
30
31
|
import { getPreEvaluatedRaw } from "./compute/evaluate.js";
|
|
31
|
-
import {
|
|
32
|
-
export function renderRoutes(_x, _x2, _x3, _x4, _x5) {
|
|
32
|
+
import { matchHomepage } from "./matchStoryboard.js";
|
|
33
|
+
export function renderRoutes(_x, _x2, _x3, _x4, _x5, _x6, _x7) {
|
|
33
34
|
return _renderRoutes.apply(this, arguments);
|
|
34
35
|
}
|
|
35
36
|
function _renderRoutes() {
|
|
36
|
-
_renderRoutes = _asyncToGenerator(function* (returnNode, routes, _runtimeContext, rendererContext, slotId) {
|
|
37
|
+
_renderRoutes = _asyncToGenerator(function* (returnNode, routes, _runtimeContext, rendererContext, parentRoutes, slotId, isIncremental) {
|
|
37
38
|
var matched = yield matchRoutes(routes, _runtimeContext);
|
|
38
39
|
var output = {
|
|
39
40
|
blockingList: [],
|
|
@@ -52,7 +53,11 @@ function _renderRoutes() {
|
|
|
52
53
|
var runtimeContext = _objectSpread(_objectSpread({}, _runtimeContext), {}, {
|
|
53
54
|
match: matched.match
|
|
54
55
|
});
|
|
55
|
-
|
|
56
|
+
if (isIncremental) {
|
|
57
|
+
runtimeContext.ctxStore.disposeDataInRoutes(routes);
|
|
58
|
+
}
|
|
59
|
+
var routePath = parentRoutes.concat(route);
|
|
60
|
+
runtimeContext.ctxStore.define(route.context, runtimeContext, undefined, routePath);
|
|
56
61
|
runtimeContext.pendingPermissionsPreCheck.push(hooks === null || hooks === void 0 || (_hooks$checkPermissio = hooks.checkPermissions) === null || _hooks$checkPermissio === void 0 ? void 0 : _hooks$checkPermissio.preCheckPermissionsForBrickOrRoute(route, value => asyncComputeRealValue(value, runtimeContext)));
|
|
57
62
|
|
|
58
63
|
// Currently, this is only used for brick size-checking: these bricks
|
|
@@ -63,41 +68,39 @@ function _renderRoutes() {
|
|
|
63
68
|
if (Array.isArray(preLoadBricks)) {
|
|
64
69
|
output.blockingList.push(loadBricksImperatively(preLoadBricks, getBrickPackages()));
|
|
65
70
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
mergeRenderOutput(output, _newOutput);
|
|
100
|
-
}
|
|
71
|
+
if (route.type === "redirect") {
|
|
72
|
+
var redirectTo;
|
|
73
|
+
if (typeof route.redirect === "string") {
|
|
74
|
+
redirectTo = yield asyncComputeRealValue(route.redirect, runtimeContext);
|
|
75
|
+
} else {
|
|
76
|
+
var resolved = yield resolveData(_objectSpread({
|
|
77
|
+
transform: "redirect"
|
|
78
|
+
}, route.redirect), runtimeContext);
|
|
79
|
+
redirectTo = resolved.redirect;
|
|
80
|
+
}
|
|
81
|
+
if (typeof redirectTo !== "string") {
|
|
82
|
+
// eslint-disable-next-line no-console
|
|
83
|
+
console.error("Unexpected redirect result:", redirectTo);
|
|
84
|
+
throw new Error("Unexpected type of redirect result: ".concat(typeof redirectTo));
|
|
85
|
+
}
|
|
86
|
+
output.redirect = {
|
|
87
|
+
path: redirectTo
|
|
88
|
+
};
|
|
89
|
+
} else {
|
|
90
|
+
var menuRequest = loadMenu(route.menu, runtimeContext);
|
|
91
|
+
if (menuRequest) {
|
|
92
|
+
output.menuRequests.push(menuRequest);
|
|
93
|
+
}
|
|
94
|
+
if (route.type === "routes") {
|
|
95
|
+
var newOutput = yield renderRoutes(returnNode, route.routes, runtimeContext, rendererContext, routePath, slotId);
|
|
96
|
+
mergeRenderOutput(output, newOutput);
|
|
97
|
+
} else {
|
|
98
|
+
var _newOutput = yield renderBricks(returnNode, route.bricks, runtimeContext, rendererContext, routePath, slotId);
|
|
99
|
+
mergeRenderOutput(output, _newOutput);
|
|
100
|
+
}
|
|
101
|
+
if (returnNode.tag === RenderTag.BRICK) {
|
|
102
|
+
rendererContext.memoizeMenuRequests(route, output.menuRequests);
|
|
103
|
+
}
|
|
101
104
|
}
|
|
102
105
|
}
|
|
103
106
|
}
|
|
@@ -105,22 +108,22 @@ function _renderRoutes() {
|
|
|
105
108
|
});
|
|
106
109
|
return _renderRoutes.apply(this, arguments);
|
|
107
110
|
}
|
|
108
|
-
export function renderBricks(
|
|
111
|
+
export function renderBricks(_x8, _x9, _x10, _x11, _x12, _x13, _x14, _x15) {
|
|
109
112
|
return _renderBricks.apply(this, arguments);
|
|
110
113
|
}
|
|
111
114
|
function _renderBricks() {
|
|
112
|
-
_renderBricks = _asyncToGenerator(function* (returnNode, bricks, runtimeContext, rendererContext, slotId, tplStack, keyPath) {
|
|
115
|
+
_renderBricks = _asyncToGenerator(function* (returnNode, bricks, runtimeContext, rendererContext, parentRoutes, slotId, tplStack, keyPath) {
|
|
113
116
|
var output = {
|
|
114
117
|
blockingList: [],
|
|
115
118
|
menuRequests: []
|
|
116
119
|
};
|
|
117
120
|
var kPath = keyPath !== null && keyPath !== void 0 ? keyPath : [];
|
|
118
121
|
// 多个构件并行异步转换,但转换的结果按原顺序串行合并。
|
|
119
|
-
var rendered = yield Promise.all(bricks.map((brickConf, index) => renderBrick(returnNode, brickConf, runtimeContext, rendererContext, slotId, kPath.concat(index), tplStack && new Map(tplStack))));
|
|
122
|
+
var rendered = yield Promise.all(bricks.map((brickConf, index) => renderBrick(returnNode, brickConf, runtimeContext, rendererContext, parentRoutes, slotId, kPath.concat(index), tplStack && new Map(tplStack))));
|
|
120
123
|
rendered.forEach((item, index) => {
|
|
121
124
|
if (item.hasTrackingControls) {
|
|
122
125
|
// Memoize a render node before it's been merged.
|
|
123
|
-
rendererContext.
|
|
126
|
+
rendererContext.memoize(slotId, kPath.concat(index), item.node, returnNode);
|
|
124
127
|
}
|
|
125
128
|
mergeRenderOutput(output, item);
|
|
126
129
|
});
|
|
@@ -128,14 +131,14 @@ function _renderBricks() {
|
|
|
128
131
|
});
|
|
129
132
|
return _renderBricks.apply(this, arguments);
|
|
130
133
|
}
|
|
131
|
-
export function renderBrick(
|
|
134
|
+
export function renderBrick(_x16, _x17, _x18, _x19, _x20, _x21) {
|
|
132
135
|
return _renderBrick.apply(this, arguments);
|
|
133
136
|
}
|
|
134
137
|
function _renderBrick() {
|
|
135
|
-
_renderBrick = _asyncToGenerator(function* (returnNode, brickConf, _runtimeContext, rendererContext, slotId) {
|
|
138
|
+
_renderBrick = _asyncToGenerator(function* (returnNode, brickConf, _runtimeContext, rendererContext, parentRoutes, slotId) {
|
|
136
139
|
var _hooks$checkPermissio2, _runtimeContext$app;
|
|
137
|
-
var keyPath = arguments.length >
|
|
138
|
-
var tplStack = arguments.length >
|
|
140
|
+
var keyPath = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [];
|
|
141
|
+
var tplStack = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : new Map();
|
|
139
142
|
var output = {
|
|
140
143
|
blockingList: [],
|
|
141
144
|
menuRequests: []
|
|
@@ -172,7 +175,7 @@ function _renderBrick() {
|
|
|
172
175
|
}
|
|
173
176
|
}, Object.getOwnPropertySymbols(brickConf).reduce((acc, symbol) => _objectSpread(_objectSpread({}, acc), {}, {
|
|
174
177
|
[symbol]: brickConf[symbol]
|
|
175
|
-
}), {})), _runtimeContext, rendererContext, slotId, keyPath, tplStack);
|
|
178
|
+
}), {})), _runtimeContext, rendererContext, parentRoutes, slotId, keyPath, tplStack);
|
|
176
179
|
}
|
|
177
180
|
var tplStateStoreId = brickConf[symbolForTplStateStoreId];
|
|
178
181
|
var formStateStoreId = brickConf[symbolForFormStateStoreId];
|
|
@@ -207,7 +210,7 @@ function _renderBrick() {
|
|
|
207
210
|
dataSource
|
|
208
211
|
} = brickConf;
|
|
209
212
|
var renderControlNode = /*#__PURE__*/function () {
|
|
210
|
-
var _ref = _asyncToGenerator(function* () {
|
|
213
|
+
var _ref = _asyncToGenerator(function* (runtimeContext) {
|
|
211
214
|
var _slots$slot;
|
|
212
215
|
// First, compute the `dataSource`
|
|
213
216
|
var computedDataSource = yield asyncComputeRealValue(dataSource, runtimeContext);
|
|
@@ -229,20 +232,20 @@ function _renderBrick() {
|
|
|
229
232
|
if (!Array.isArray(computedDataSource)) {
|
|
230
233
|
return output;
|
|
231
234
|
}
|
|
232
|
-
return renderForEach(returnNode, computedDataSource, bricks, runtimeContext, rendererContext, slotId, tplStack, keyPath);
|
|
235
|
+
return renderForEach(returnNode, computedDataSource, bricks, runtimeContext, rendererContext, parentRoutes, slotId, tplStack, keyPath);
|
|
233
236
|
}
|
|
234
237
|
case ":if":
|
|
235
238
|
case ":switch":
|
|
236
239
|
{
|
|
237
|
-
return renderBricks(returnNode, bricks, runtimeContext, rendererContext, slotId, tplStack, keyPath);
|
|
240
|
+
return renderBricks(returnNode, bricks, runtimeContext, rendererContext, parentRoutes, slotId, tplStack, keyPath);
|
|
238
241
|
}
|
|
239
242
|
}
|
|
240
243
|
});
|
|
241
|
-
return function renderControlNode() {
|
|
244
|
+
return function renderControlNode(_x31) {
|
|
242
245
|
return _ref.apply(this, arguments);
|
|
243
246
|
};
|
|
244
247
|
}();
|
|
245
|
-
var controlledOutput = yield renderControlNode();
|
|
248
|
+
var controlledOutput = yield renderControlNode(runtimeContext);
|
|
246
249
|
var {
|
|
247
250
|
contextNames,
|
|
248
251
|
stateNames
|
|
@@ -253,12 +256,17 @@ function _renderBrick() {
|
|
|
253
256
|
var listener = /*#__PURE__*/function () {
|
|
254
257
|
var _ref2 = _asyncToGenerator(function* () {
|
|
255
258
|
var currentRenderId = ++renderId;
|
|
256
|
-
var
|
|
257
|
-
controlOutput
|
|
258
|
-
|
|
259
|
+
var [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope] = createScopedRuntimeContext(runtimeContext);
|
|
260
|
+
var controlOutput = yield renderControlNode(scopedRuntimeContext);
|
|
261
|
+
var scopedStores = [...tplStateStoreScope, ...formStateStoreScope];
|
|
262
|
+
yield postAsyncRender(controlOutput, scopedRuntimeContext, scopedStores);
|
|
263
|
+
|
|
259
264
|
// Ignore stale renders
|
|
260
265
|
if (renderId === currentRenderId) {
|
|
261
|
-
rendererContext.
|
|
266
|
+
rendererContext.reRender(slotId, keyPath, controlOutput.node, returnNode);
|
|
267
|
+
for (var store of scopedStores) {
|
|
268
|
+
store.mountAsyncData();
|
|
269
|
+
}
|
|
262
270
|
}
|
|
263
271
|
});
|
|
264
272
|
return function listener() {
|
|
@@ -401,17 +409,91 @@ function _renderBrick() {
|
|
|
401
409
|
if (!slots) {
|
|
402
410
|
return;
|
|
403
411
|
}
|
|
404
|
-
var
|
|
412
|
+
var routeSlotIndexes = new Set();
|
|
413
|
+
var rendered = yield Promise.all(Object.entries(slots).map((_ref6, index) => {
|
|
405
414
|
var [childSlotId, slotConf] = _ref6;
|
|
406
|
-
|
|
415
|
+
if (slotConf.type !== "routes") {
|
|
416
|
+
return renderBricks(brick, slotConf.bricks, childRuntimeContext, rendererContext, parentRoutes, childSlotId, tplStack);
|
|
417
|
+
}
|
|
418
|
+
if (runtimeContext.flags["incremental-sub-route-rendering"]) {
|
|
419
|
+
routeSlotIndexes.add(index);
|
|
420
|
+
rendererContext.performIncrementalRender( /*#__PURE__*/function () {
|
|
421
|
+
var _ref7 = _asyncToGenerator(function* (location) {
|
|
422
|
+
var {
|
|
423
|
+
homepage
|
|
424
|
+
} = childRuntimeContext.app;
|
|
425
|
+
var {
|
|
426
|
+
pathname
|
|
427
|
+
} = location;
|
|
428
|
+
// Ignore if any one of homepage and parent routes not matched.
|
|
429
|
+
if (!matchHomepage(homepage, pathname) || !parentRoutes.every(route => matchRoute(route, homepage, pathname))) {
|
|
430
|
+
return false;
|
|
431
|
+
}
|
|
432
|
+
var [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope] = createScopedRuntimeContext(_objectSpread(_objectSpread({}, childRuntimeContext), {}, {
|
|
433
|
+
location,
|
|
434
|
+
query: new URLSearchParams(location.search)
|
|
435
|
+
}));
|
|
436
|
+
var failed = false;
|
|
437
|
+
var incrementalOutput;
|
|
438
|
+
var scopedStores = [];
|
|
439
|
+
try {
|
|
440
|
+
incrementalOutput = yield renderRoutes(brick, slotConf.routes, scopedRuntimeContext, rendererContext, parentRoutes, childSlotId, true);
|
|
441
|
+
|
|
442
|
+
// If all sub-routes are missed, ignore incremental rendering
|
|
443
|
+
if (!incrementalOutput.route) {
|
|
444
|
+
return false;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
// Bailout if redirect or unauthenticated is set
|
|
448
|
+
if (rendererContext.reBailout(incrementalOutput)) {
|
|
449
|
+
return true;
|
|
450
|
+
}
|
|
451
|
+
scopedStores = [...tplStateStoreScope, ...formStateStoreScope];
|
|
452
|
+
yield postAsyncRender(incrementalOutput, scopedRuntimeContext, [scopedRuntimeContext.ctxStore, ...scopedStores]);
|
|
453
|
+
yield rendererContext.reMergeMenuRequests(slotConf.routes, incrementalOutput.route, incrementalOutput.menuRequests);
|
|
454
|
+
} catch (error) {
|
|
455
|
+
// eslint-disable-next-line no-console
|
|
456
|
+
console.error("Incremental sub-router failed:", error);
|
|
457
|
+
var result = rendererContext.reCatch(error, brick);
|
|
458
|
+
if (!result) {
|
|
459
|
+
return true;
|
|
460
|
+
}
|
|
461
|
+
({
|
|
462
|
+
failed,
|
|
463
|
+
output: incrementalOutput
|
|
464
|
+
} = result);
|
|
465
|
+
|
|
466
|
+
// Assert: no errors will be throw
|
|
467
|
+
yield rendererContext.reMergeMenuRequests(slotConf.routes, incrementalOutput.route, incrementalOutput.menuRequests);
|
|
468
|
+
}
|
|
469
|
+
rendererContext.reRender(childSlotId, [], incrementalOutput.node, brick);
|
|
470
|
+
if (!failed) {
|
|
471
|
+
scopedRuntimeContext.ctxStore.mountAsyncData(incrementalOutput.route);
|
|
472
|
+
for (var store of scopedStores) {
|
|
473
|
+
store.mountAsyncData();
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
return true;
|
|
477
|
+
});
|
|
478
|
+
return function (_x32) {
|
|
479
|
+
return _ref7.apply(this, arguments);
|
|
480
|
+
};
|
|
481
|
+
}());
|
|
482
|
+
}
|
|
483
|
+
return renderRoutes(brick, slotConf.routes, childRuntimeContext, rendererContext, parentRoutes, childSlotId);
|
|
407
484
|
}));
|
|
408
485
|
var childrenOutput = _objectSpread(_objectSpread({}, output), {}, {
|
|
409
486
|
node: undefined,
|
|
410
|
-
blockingList: []
|
|
487
|
+
blockingList: [],
|
|
488
|
+
menuRequests: []
|
|
411
489
|
});
|
|
412
|
-
|
|
490
|
+
rendered.forEach((item, index) => {
|
|
491
|
+
if (routeSlotIndexes.has(index)) {
|
|
492
|
+
// Memoize a render node before it's been merged.
|
|
493
|
+
rendererContext.memoize(slotId, [], item.node, brick);
|
|
494
|
+
}
|
|
413
495
|
mergeRenderOutput(childrenOutput, item);
|
|
414
|
-
}
|
|
496
|
+
});
|
|
415
497
|
if (childrenOutput.node) {
|
|
416
498
|
brick.child = childrenOutput.node;
|
|
417
499
|
}
|
|
@@ -439,11 +521,11 @@ function ensureValidControlBrick(brick) {
|
|
|
439
521
|
throw new Error("Unknown storyboard control node: \"".concat(brick, "\""));
|
|
440
522
|
}
|
|
441
523
|
}
|
|
442
|
-
function renderForEach(
|
|
524
|
+
function renderForEach(_x22, _x23, _x24, _x25, _x26, _x27, _x28, _x29, _x30) {
|
|
443
525
|
return _renderForEach.apply(this, arguments);
|
|
444
526
|
}
|
|
445
527
|
function _renderForEach() {
|
|
446
|
-
_renderForEach = _asyncToGenerator(function* (returnNode, dataSource, bricks, runtimeContext, rendererContext, slotId, tplStack, keyPath) {
|
|
528
|
+
_renderForEach = _asyncToGenerator(function* (returnNode, dataSource, bricks, runtimeContext, rendererContext, parentRoutes, slotId, tplStack, keyPath) {
|
|
447
529
|
var output = {
|
|
448
530
|
blockingList: [],
|
|
449
531
|
menuRequests: []
|
|
@@ -451,13 +533,13 @@ function _renderForEach() {
|
|
|
451
533
|
var rows = dataSource.length;
|
|
452
534
|
var rendered = yield Promise.all(dataSource.map((item, i) => Promise.all(bricks.map((brickConf, j) => renderBrick(returnNode, brickConf, _objectSpread(_objectSpread({}, runtimeContext), {}, {
|
|
453
535
|
forEachItem: item
|
|
454
|
-
}), rendererContext, slotId, keyPath.concat(i * rows + j), tplStack && new Map(tplStack))))));
|
|
536
|
+
}), rendererContext, parentRoutes, slotId, keyPath.concat(i * rows + j), tplStack && new Map(tplStack))))));
|
|
455
537
|
|
|
456
538
|
// 多层构件并行异步转换,但转换的结果按原顺序串行合并。
|
|
457
539
|
rendered.flat().forEach((item, index) => {
|
|
458
540
|
if (item.hasTrackingControls) {
|
|
459
541
|
// Memoize a render node before it's been merged.
|
|
460
|
-
rendererContext.
|
|
542
|
+
rendererContext.memoize(slotId, keyPath.concat(index), item.node, returnNode);
|
|
461
543
|
}
|
|
462
544
|
mergeRenderOutput(output, item);
|
|
463
545
|
});
|
|
@@ -465,6 +547,22 @@ function _renderForEach() {
|
|
|
465
547
|
});
|
|
466
548
|
return _renderForEach.apply(this, arguments);
|
|
467
549
|
}
|
|
550
|
+
export function getDataStores(runtimeContext) {
|
|
551
|
+
return [runtimeContext.ctxStore, ...runtimeContext.tplStateStoreMap.values(), ...runtimeContext.formStateStoreMap.values()];
|
|
552
|
+
}
|
|
553
|
+
export function postAsyncRender(output, runtimeContext, stores) {
|
|
554
|
+
flushStableLoadBricks();
|
|
555
|
+
return Promise.all([...output.blockingList, ...stores.map(store => store.waitForAll()), ...runtimeContext.pendingPermissionsPreCheck]);
|
|
556
|
+
}
|
|
557
|
+
export function createScopedRuntimeContext(runtimeContext) {
|
|
558
|
+
var tplStateStoreScope = [];
|
|
559
|
+
var formStateStoreScope = [];
|
|
560
|
+
var scopedRuntimeContext = _objectSpread(_objectSpread({}, runtimeContext), {}, {
|
|
561
|
+
tplStateStoreScope,
|
|
562
|
+
formStateStoreScope
|
|
563
|
+
});
|
|
564
|
+
return [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope];
|
|
565
|
+
}
|
|
468
566
|
function loadMenu(menuConf, runtimeContext) {
|
|
469
567
|
if (!menuConf) {
|
|
470
568
|
return;
|