@next-core/runtime 1.22.4 → 1.22.5
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/internal/Renderer.js +25 -22
- package/dist/cjs/internal/Renderer.js.map +1 -1
- package/dist/cjs/internal/RendererContext.js +36 -7
- package/dist/cjs/internal/RendererContext.js.map +1 -1
- package/dist/cjs/internal/enums.js +1 -0
- package/dist/cjs/internal/enums.js.map +1 -1
- package/dist/cjs/internal/interfaces.js.map +1 -1
- package/dist/cjs/internal/mount.js +41 -39
- package/dist/cjs/internal/mount.js.map +1 -1
- package/dist/cjs/internal/secret_internals.js +5 -2
- package/dist/cjs/internal/secret_internals.js.map +1 -1
- package/dist/esm/internal/Renderer.js +46 -38
- package/dist/esm/internal/Renderer.js.map +1 -1
- package/dist/esm/internal/RendererContext.js +36 -7
- package/dist/esm/internal/RendererContext.js.map +1 -1
- package/dist/esm/internal/enums.js +1 -0
- package/dist/esm/internal/enums.js.map +1 -1
- package/dist/esm/internal/interfaces.js.map +1 -1
- package/dist/esm/internal/mount.js +41 -39
- package/dist/esm/internal/mount.js.map +1 -1
- package/dist/esm/internal/secret_internals.js +5 -2
- package/dist/esm/internal/secret_internals.js.map +1 -1
- package/dist/types/internal/Renderer.d.ts +5 -5
- package/dist/types/internal/RendererContext.d.ts +5 -5
- package/dist/types/internal/enums.d.ts +2 -1
- package/dist/types/internal/interfaces.d.ts +11 -5
- package/package.json +2 -2
|
@@ -37,10 +37,7 @@ export function renderRoutes(_x, _x2, _x3, _x4, _x5, _x6, _x7) {
|
|
|
37
37
|
function _renderRoutes() {
|
|
38
38
|
_renderRoutes = _asyncToGenerator(function* (returnNode, routes, _runtimeContext, rendererContext, parentRoutes, slotId, isIncremental) {
|
|
39
39
|
var matched = yield matchRoutes(routes, _runtimeContext);
|
|
40
|
-
var output =
|
|
41
|
-
blockingList: [],
|
|
42
|
-
menuRequests: []
|
|
43
|
-
};
|
|
40
|
+
var output = getEmptyRenderOutput();
|
|
44
41
|
switch (matched) {
|
|
45
42
|
case "missed":
|
|
46
43
|
break;
|
|
@@ -114,10 +111,7 @@ export function renderBricks(_x8, _x9, _x10, _x11, _x12, _x13, _x14, _x15) {
|
|
|
114
111
|
}
|
|
115
112
|
function _renderBricks() {
|
|
116
113
|
_renderBricks = _asyncToGenerator(function* (returnNode, bricks, runtimeContext, rendererContext, parentRoutes, slotId, tplStack, keyPath) {
|
|
117
|
-
var output =
|
|
118
|
-
blockingList: [],
|
|
119
|
-
menuRequests: []
|
|
120
|
-
};
|
|
114
|
+
var output = getEmptyRenderOutput();
|
|
121
115
|
var kPath = keyPath !== null && keyPath !== void 0 ? keyPath : [];
|
|
122
116
|
// 多个构件并行异步转换,但转换的结果按原顺序串行合并。
|
|
123
117
|
var rendered = yield Promise.all(bricks.map((brickConf, index) => renderBrick(returnNode, brickConf, runtimeContext, rendererContext, parentRoutes, slotId, kPath.concat(index), tplStack && new Map(tplStack))));
|
|
@@ -140,10 +134,7 @@ function _renderBrick() {
|
|
|
140
134
|
var _hooks$checkPermissio2, _runtimeContext$app;
|
|
141
135
|
var keyPath = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [];
|
|
142
136
|
var tplStack = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : new Map();
|
|
143
|
-
var output =
|
|
144
|
-
blockingList: [],
|
|
145
|
-
menuRequests: []
|
|
146
|
-
};
|
|
137
|
+
var output = getEmptyRenderOutput();
|
|
147
138
|
if (!brickConf.brick) {
|
|
148
139
|
if (brickConf.template) {
|
|
149
140
|
// eslint-disable-next-line no-console
|
|
@@ -212,7 +203,7 @@ function _renderBrick() {
|
|
|
212
203
|
var {
|
|
213
204
|
dataSource
|
|
214
205
|
} = brickConf;
|
|
215
|
-
var
|
|
206
|
+
var lowerLevelRenderControlNode = /*#__PURE__*/function () {
|
|
216
207
|
var _ref = _asyncToGenerator(function* (runtimeContext) {
|
|
217
208
|
var _slots$slot;
|
|
218
209
|
// First, compute the `dataSource`
|
|
@@ -227,13 +218,13 @@ function _renderBrick() {
|
|
|
227
218
|
// Then, get the bricks in that matched slot.
|
|
228
219
|
var bricks = slots && hasOwnProperty(slots, slot) && ((_slots$slot = slots[slot]) === null || _slots$slot === void 0 ? void 0 : _slots$slot.bricks);
|
|
229
220
|
if (!Array.isArray(bricks)) {
|
|
230
|
-
return
|
|
221
|
+
return getEmptyRenderOutput();
|
|
231
222
|
}
|
|
232
223
|
switch (brickName) {
|
|
233
224
|
case ":forEach":
|
|
234
225
|
{
|
|
235
226
|
if (!Array.isArray(computedDataSource)) {
|
|
236
|
-
return
|
|
227
|
+
return getEmptyRenderOutput();
|
|
237
228
|
}
|
|
238
229
|
return renderForEach(returnNode, computedDataSource, bricks, runtimeContext, rendererContext, parentRoutes, slotId, tplStack, keyPath);
|
|
239
230
|
}
|
|
@@ -244,10 +235,24 @@ function _renderBrick() {
|
|
|
244
235
|
}
|
|
245
236
|
}
|
|
246
237
|
});
|
|
247
|
-
return function
|
|
238
|
+
return function lowerLevelRenderControlNode(_x31) {
|
|
248
239
|
return _ref.apply(this, arguments);
|
|
249
240
|
};
|
|
250
241
|
}();
|
|
242
|
+
var renderControlNode = /*#__PURE__*/function () {
|
|
243
|
+
var _ref2 = _asyncToGenerator(function* (runtimeContext) {
|
|
244
|
+
var _rawOutput$node;
|
|
245
|
+
var rawOutput = yield lowerLevelRenderControlNode(runtimeContext);
|
|
246
|
+
(_rawOutput$node = rawOutput.node) !== null && _rawOutput$node !== void 0 ? _rawOutput$node : rawOutput.node = {
|
|
247
|
+
tag: RenderTag.PLACEHOLDER,
|
|
248
|
+
return: returnNode
|
|
249
|
+
};
|
|
250
|
+
return rawOutput;
|
|
251
|
+
});
|
|
252
|
+
return function renderControlNode(_x32) {
|
|
253
|
+
return _ref2.apply(this, arguments);
|
|
254
|
+
};
|
|
255
|
+
}();
|
|
251
256
|
var controlledOutput = yield renderControlNode(runtimeContext);
|
|
252
257
|
var {
|
|
253
258
|
onMount,
|
|
@@ -261,12 +266,12 @@ function _renderBrick() {
|
|
|
261
266
|
controlledOutput.hasTrackingControls = true;
|
|
262
267
|
var renderId = 0;
|
|
263
268
|
var listener = /*#__PURE__*/function () {
|
|
264
|
-
var
|
|
269
|
+
var _ref3 = _asyncToGenerator(function* () {
|
|
265
270
|
var currentRenderId = ++renderId;
|
|
266
271
|
var [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope] = createScopedRuntimeContext(runtimeContext);
|
|
267
|
-
var
|
|
272
|
+
var reControlledOutput = yield renderControlNode(scopedRuntimeContext);
|
|
268
273
|
var scopedStores = [...tplStateStoreScope, ...formStateStoreScope];
|
|
269
|
-
yield postAsyncRender(
|
|
274
|
+
yield postAsyncRender(reControlledOutput, scopedRuntimeContext, scopedStores);
|
|
270
275
|
|
|
271
276
|
// Ignore stale renders
|
|
272
277
|
if (renderId === currentRenderId) {
|
|
@@ -277,7 +282,7 @@ function _renderBrick() {
|
|
|
277
282
|
}
|
|
278
283
|
}));
|
|
279
284
|
}
|
|
280
|
-
rendererContext.reRender(slotId, keyPath,
|
|
285
|
+
rendererContext.reRender(slotId, keyPath, reControlledOutput.node, returnNode);
|
|
281
286
|
if (onMount) {
|
|
282
287
|
listenerFactory(onMount, scopedRuntimeContext)(new CustomEvent("mount", {
|
|
283
288
|
detail: {
|
|
@@ -291,7 +296,7 @@ function _renderBrick() {
|
|
|
291
296
|
}
|
|
292
297
|
});
|
|
293
298
|
return function listener() {
|
|
294
|
-
return
|
|
299
|
+
return _ref3.apply(this, arguments);
|
|
295
300
|
};
|
|
296
301
|
}();
|
|
297
302
|
var debouncedListener = debounce(listener);
|
|
@@ -355,12 +360,12 @@ function _renderBrick() {
|
|
|
355
360
|
var confProps;
|
|
356
361
|
if (brickName === FORM_RENDERER) {
|
|
357
362
|
var _brickConf$properties;
|
|
358
|
-
var
|
|
363
|
+
var _ref4 = (_brickConf$properties = brickConf.properties) !== null && _brickConf$properties !== void 0 ? _brickConf$properties : {};
|
|
359
364
|
({
|
|
360
365
|
formData
|
|
361
|
-
} =
|
|
362
|
-
confProps = _objectWithoutProperties(
|
|
363
|
-
|
|
366
|
+
} = _ref4);
|
|
367
|
+
confProps = _objectWithoutProperties(_ref4, _excluded3);
|
|
368
|
+
_ref4;
|
|
364
369
|
} else {
|
|
365
370
|
confProps = brickConf.properties;
|
|
366
371
|
}
|
|
@@ -414,12 +419,12 @@ function _renderBrick() {
|
|
|
414
419
|
// 加载构件属性和加载子构件等任务,可以并行。
|
|
415
420
|
var blockingList = [];
|
|
416
421
|
var loadProperties = /*#__PURE__*/function () {
|
|
417
|
-
var
|
|
422
|
+
var _ref5 = _asyncToGenerator(function* () {
|
|
418
423
|
brick.properties = yield constructAsyncProperties(asyncPropertyEntries);
|
|
419
424
|
listenOnTrackingContext(brick, trackingContextList);
|
|
420
425
|
});
|
|
421
426
|
return function loadProperties() {
|
|
422
|
-
return
|
|
427
|
+
return _ref5.apply(this, arguments);
|
|
423
428
|
};
|
|
424
429
|
}();
|
|
425
430
|
blockingList.push(loadProperties());
|
|
@@ -444,21 +449,21 @@ function _renderBrick() {
|
|
|
444
449
|
childRuntimeContext = runtimeContext;
|
|
445
450
|
}
|
|
446
451
|
var loadChildren = /*#__PURE__*/function () {
|
|
447
|
-
var
|
|
452
|
+
var _ref6 = _asyncToGenerator(function* () {
|
|
448
453
|
var slots = childrenToSlots(expandedBrickConf.children, expandedBrickConf.slots);
|
|
449
454
|
if (!slots) {
|
|
450
455
|
return;
|
|
451
456
|
}
|
|
452
457
|
var routeSlotIndexes = new Set();
|
|
453
|
-
var rendered = yield Promise.all(Object.entries(slots).map((
|
|
454
|
-
var [childSlotId, slotConf] =
|
|
458
|
+
var rendered = yield Promise.all(Object.entries(slots).map((_ref7, index) => {
|
|
459
|
+
var [childSlotId, slotConf] = _ref7;
|
|
455
460
|
if (slotConf.type !== "routes") {
|
|
456
461
|
return renderBricks(brick, slotConf.bricks, childRuntimeContext, rendererContext, parentRoutes, childSlotId, tplStack);
|
|
457
462
|
}
|
|
458
463
|
if (runtimeContext.flags["incremental-sub-route-rendering"]) {
|
|
459
464
|
routeSlotIndexes.add(index);
|
|
460
465
|
rendererContext.performIncrementalRender( /*#__PURE__*/function () {
|
|
461
|
-
var
|
|
466
|
+
var _ref8 = _asyncToGenerator(function* (location) {
|
|
462
467
|
var {
|
|
463
468
|
homepage
|
|
464
469
|
} = childRuntimeContext.app;
|
|
@@ -515,8 +520,8 @@ function _renderBrick() {
|
|
|
515
520
|
}
|
|
516
521
|
return true;
|
|
517
522
|
});
|
|
518
|
-
return function (
|
|
519
|
-
return
|
|
523
|
+
return function (_x33) {
|
|
524
|
+
return _ref8.apply(this, arguments);
|
|
520
525
|
};
|
|
521
526
|
}());
|
|
522
527
|
}
|
|
@@ -542,7 +547,7 @@ function _renderBrick() {
|
|
|
542
547
|
}));
|
|
543
548
|
});
|
|
544
549
|
return function loadChildren() {
|
|
545
|
-
return
|
|
550
|
+
return _ref6.apply(this, arguments);
|
|
546
551
|
};
|
|
547
552
|
}();
|
|
548
553
|
blockingList.push(loadChildren());
|
|
@@ -566,10 +571,7 @@ function renderForEach(_x22, _x23, _x24, _x25, _x26, _x27, _x28, _x29, _x30) {
|
|
|
566
571
|
}
|
|
567
572
|
function _renderForEach() {
|
|
568
573
|
_renderForEach = _asyncToGenerator(function* (returnNode, dataSource, bricks, runtimeContext, rendererContext, parentRoutes, slotId, tplStack, keyPath) {
|
|
569
|
-
var output =
|
|
570
|
-
blockingList: [],
|
|
571
|
-
menuRequests: []
|
|
572
|
-
};
|
|
574
|
+
var output = getEmptyRenderOutput();
|
|
573
575
|
var rows = dataSource.length;
|
|
574
576
|
var rendered = yield Promise.all(dataSource.map((item, i) => Promise.all(bricks.map((brickConf, j) => renderBrick(returnNode, brickConf, _objectSpread(_objectSpread({}, runtimeContext), {}, {
|
|
575
577
|
forEachItem: item,
|
|
@@ -648,6 +650,12 @@ function mergeRenderOutput(output, newOutput) {
|
|
|
648
650
|
}
|
|
649
651
|
Object.assign(output, rest);
|
|
650
652
|
}
|
|
653
|
+
function getEmptyRenderOutput() {
|
|
654
|
+
return {
|
|
655
|
+
blockingList: [],
|
|
656
|
+
menuRequests: []
|
|
657
|
+
};
|
|
658
|
+
}
|
|
651
659
|
export function childrenToSlots(children, originalSlots) {
|
|
652
660
|
var newSlots = originalSlots;
|
|
653
661
|
// istanbul ignore next
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Renderer.js","names":["enqueueStableLoadBricks","flushStableLoadBricks","loadBricksImperatively","loadProcessorsImperatively","loadScript","loadStyle","isTrackAll","hasOwnProperty","strictCollectMemberUsage","debounce","asyncCheckBrickIf","asyncComputeRealPropertyEntries","constructAsyncProperties","resolveData","asyncComputeRealValue","listenOnTrackingContext","matchRoute","matchRoutes","symbolForAsyncComputedPropsFromHost","symbolForTPlExternalForEachIndex","symbolForTPlExternalForEachItem","symbolForTplStateStoreId","expandCustomTemplate","getTagNameOfCustomTemplate","getTplStateStore","customTemplates","getBrickPackages","hooks","RenderTag","getTracks","isStrictMode","warnAboutStrictMode","FORM_RENDERER","symbolForFormStateStoreId","expandFormRenderer","isPreEvaluated","getPreEvaluatedRaw","matchHomepage","listenerFactory","renderRoutes","_x","_x2","_x3","_x4","_x5","_x6","_x7","_renderRoutes","apply","arguments","_asyncToGenerator","returnNode","routes","_runtimeContext","rendererContext","parentRoutes","slotId","isIncremental","matched","output","blockingList","menuRequests","unauthenticated","_hooks$checkPermissio","route","runtimeContext","_objectSpread","match","ctxStore","disposeDataInRoutes","routePath","concat","define","context","undefined","pendingPermissionsPreCheck","push","checkPermissions","preCheckPermissionsForBrickOrRoute","value","preLoadBricks","Array","isArray","type","redirectTo","redirect","resolved","transform","console","error","Error","path","menuRequest","loadMenu","menu","newOutput","mergeRenderOutput","renderBricks","bricks","tag","BRICK","memoizeMenuRequests","_x8","_x9","_x10","_x11","_x12","_x13","_x14","_x15","_renderBricks","tplStack","keyPath","kPath","rendered","Promise","all","map","brickConf","index","renderBrick","Map","forEach","item","hasTrackingControls","memoize","node","_x16","_x17","_x18","_x19","_x20","_x21","_renderBrick","_hooks$checkPermissio2","_runtimeContext$app","length","brick","template","if","brickIf","permissionsPreCheck","restBrickConf","_objectWithoutProperties","_excluded2","isGeneralizedTrackAll","dataSource","slots","Object","getOwnPropertySymbols","reduce","acc","symbol","tplStateStoreId","formStateStoreId","forEachItem","forEachIndex","strict","brickName","startsWith","_brickConf$lifeCycle","ensureValidControlBrick","renderControlNode","_ref","_slots$slot","computedDataSource","slot","String","childrenToSlots","children","renderForEach","_x31","controlledOutput","onMount","onUnmount","lifeCycle","contextNames","stateNames","renderId","listener","_ref2","currentRenderId","scopedRuntimeContext","tplStateStoreScope","formStateStoreScope","createScopedRuntimeContext","controlOutput","scopedStores","postAsyncRender","CustomEvent","detail","rerender","reRender","store","mountAsyncData","debouncedListener","contextName","onChange","tplStateStore","registerArbitraryLifeCycle","test","get","catchLoad","unknownBricks","tplTagName","app","id","_tplStack$get","tplCount","set","includes","customElements","FormRendererElement","HTMLElement","$$typeof","formData","confProps","_brickConf$properties","_ref3","properties","_excluded3","trackingContextList","asyncPropertyEntries","computedPropsFromHost","isScript","props","src","rel","href","_window$PUBLIC_ROOT","prefix","window","PUBLIC_ROOT","attrs","_excluded4","_excluded5","return","events","portal","iid","ref","usedProcessors","size","join","loadProperties","_ref4","registerBrickLifeCycle","expandedBrickConf","childRuntimeContext","loadChildren","_ref5","routeSlotIndexes","Set","entries","_ref6","childSlotId","slotConf","flags","add","performIncrementalRender","_ref7","location","homepage","pathname","every","query","URLSearchParams","search","failed","incrementalOutput","reBailout","reMergeMenuRequests","result","reCatch","_x32","childrenOutput","has","child","_x22","_x23","_x24","_x25","_x26","_x27","_x28","_x29","_x30","_renderForEach","rows","i","j","flat","getDataStores","tplStateStoreMap","values","formStateStoreMap","stores","waitForAll","menuConf","warn","rest","_excluded","last","sibling","assign","originalSlots","newSlots","process","env","NODE_ENV","_child$slot","promise","name","unknownPolicy","catch","e"],"sources":["../../../src/internal/Renderer.ts"],"sourcesContent":["import type {\n BrickConf,\n BrickConfInTemplate,\n ContextConf,\n MenuConf,\n RouteConf,\n SlotConfOfBricks,\n SlotsConf,\n StaticMenuConf,\n} from \"@next-core/types\";\nimport {\n enqueueStableLoadBricks,\n flushStableLoadBricks,\n loadBricksImperatively,\n loadProcessorsImperatively,\n loadScript,\n loadStyle,\n} from \"@next-core/loader\";\nimport { isTrackAll } from \"@next-core/cook\";\nimport { hasOwnProperty } from \"@next-core/utils/general\";\nimport { strictCollectMemberUsage } from \"@next-core/utils/storyboard\";\nimport { debounce } from \"lodash\";\nimport { asyncCheckBrickIf } from \"./compute/checkIf.js\";\nimport {\n asyncComputeRealPropertyEntries,\n constructAsyncProperties,\n} from \"./compute/computeRealProperties.js\";\nimport { resolveData } from \"./data/resolveData.js\";\nimport { asyncComputeRealValue } from \"./compute/computeRealValue.js\";\nimport {\n TrackingContextItem,\n listenOnTrackingContext,\n} from \"./compute/listenOnTrackingContext.js\";\nimport { RendererContext } from \"./RendererContext.js\";\nimport { matchRoute, matchRoutes } from \"./matchRoutes.js\";\nimport {\n symbolForAsyncComputedPropsFromHost,\n symbolForTPlExternalForEachIndex,\n symbolForTPlExternalForEachItem,\n symbolForTplStateStoreId,\n} from \"./CustomTemplates/constants.js\";\nimport { expandCustomTemplate } from \"./CustomTemplates/expandCustomTemplate.js\";\nimport type {\n RenderBrick,\n RenderNode,\n RuntimeBrickConfWithSymbols,\n RuntimeContext,\n} from \"./interfaces.js\";\nimport {\n getTagNameOfCustomTemplate,\n getTplStateStore,\n} from \"./CustomTemplates/utils.js\";\nimport { customTemplates } from \"../CustomTemplates.js\";\nimport type { NextHistoryState } from \"./historyExtended.js\";\nimport { getBrickPackages, hooks } from \"./Runtime.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { getTracks } from \"./compute/getTracks.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"../isStrictMode.js\";\nimport {\n FORM_RENDERER,\n RuntimeBrickConfOfFormSymbols,\n symbolForFormStateStoreId,\n} from \"./FormRenderer/constants.js\";\nimport { expandFormRenderer } from \"./FormRenderer/expandFormRenderer.js\";\nimport { isPreEvaluated } from \"./compute/evaluate.js\";\nimport { getPreEvaluatedRaw } from \"./compute/evaluate.js\";\nimport { RuntimeBrickConfOfTplSymbols } from \"./CustomTemplates/constants.js\";\nimport { matchHomepage } from \"./matchStoryboard.js\";\nimport type { DataStore, DataStoreType } from \"./data/DataStore.js\";\nimport { listenerFactory } from \"./bindListeners.js\";\n\nexport interface RenderOutput {\n node?: RenderBrick;\n unauthenticated?: boolean;\n redirect?: {\n path: string;\n state?: NextHistoryState;\n };\n route?: RouteConf;\n blockingList: (Promise<unknown> | undefined)[];\n menuRequests: Promise<StaticMenuConf>[];\n hasTrackingControls?: boolean;\n}\n\nexport async function renderRoutes(\n returnNode: RenderNode,\n routes: RouteConf[],\n _runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n slotId?: string,\n isIncremental?: boolean\n): Promise<RenderOutput> {\n const matched = await matchRoutes(routes, _runtimeContext);\n const output: RenderOutput = {\n blockingList: [],\n menuRequests: [],\n };\n switch (matched) {\n case \"missed\":\n break;\n case \"unauthenticated\":\n output.unauthenticated = true;\n break;\n default: {\n const route = (output.route = matched.route);\n const runtimeContext = {\n ..._runtimeContext,\n match: matched.match,\n };\n if (isIncremental) {\n runtimeContext.ctxStore.disposeDataInRoutes(routes);\n }\n const routePath = parentRoutes.concat(route);\n runtimeContext.ctxStore.define(\n route.context,\n runtimeContext,\n undefined,\n routePath\n );\n runtimeContext.pendingPermissionsPreCheck.push(\n hooks?.checkPermissions?.preCheckPermissionsForBrickOrRoute(\n route,\n (value) => asyncComputeRealValue(value, runtimeContext)\n )\n );\n\n // Currently, this is only used for brick size-checking: these bricks\n // will be loaded before page rendering, but they will NOT be rendered.\n const { preLoadBricks } = route as { preLoadBricks?: string[] };\n if (Array.isArray(preLoadBricks)) {\n output.blockingList.push(\n loadBricksImperatively(preLoadBricks, getBrickPackages())\n );\n }\n\n if (route.type === \"redirect\") {\n let redirectTo: unknown;\n if (typeof route.redirect === \"string\") {\n redirectTo = await asyncComputeRealValue(\n route.redirect,\n runtimeContext\n );\n } else {\n const resolved = (await resolveData(\n {\n transform: \"redirect\",\n ...route.redirect,\n },\n runtimeContext\n )) as { redirect?: unknown };\n redirectTo = resolved.redirect;\n }\n if (typeof redirectTo !== \"string\") {\n // eslint-disable-next-line no-console\n console.error(\"Unexpected redirect result:\", redirectTo);\n throw new Error(\n `Unexpected type of redirect result: ${typeof redirectTo}`\n );\n }\n output.redirect = { path: redirectTo };\n } else {\n const menuRequest = loadMenu(route.menu, runtimeContext);\n if (menuRequest) {\n output.menuRequests.push(menuRequest);\n }\n\n if (route.type === \"routes\") {\n const newOutput = await renderRoutes(\n returnNode,\n route.routes,\n runtimeContext,\n rendererContext,\n routePath,\n slotId\n );\n mergeRenderOutput(output, newOutput);\n } else {\n const newOutput = await renderBricks(\n returnNode,\n route.bricks,\n runtimeContext,\n rendererContext,\n routePath,\n slotId\n );\n mergeRenderOutput(output, newOutput);\n }\n\n if (returnNode.tag === RenderTag.BRICK) {\n rendererContext.memoizeMenuRequests(route, output.menuRequests);\n }\n }\n }\n }\n\n return output;\n}\n\nexport async function renderBricks(\n returnNode: RenderNode,\n bricks: BrickConf[],\n runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n slotId?: string,\n tplStack?: Map<string, number>,\n keyPath?: number[]\n): Promise<RenderOutput> {\n const output: RenderOutput = {\n blockingList: [],\n menuRequests: [],\n };\n const kPath = keyPath ?? [];\n // 多个构件并行异步转换,但转换的结果按原顺序串行合并。\n const rendered = await Promise.all(\n bricks.map((brickConf, index) =>\n renderBrick(\n returnNode,\n brickConf,\n runtimeContext,\n rendererContext,\n parentRoutes,\n slotId,\n kPath.concat(index),\n tplStack && new Map(tplStack)\n )\n )\n );\n\n rendered.forEach((item, index) => {\n if (item.hasTrackingControls) {\n // Memoize a render node before it's been merged.\n rendererContext.memoize(\n slotId,\n kPath.concat(index),\n item.node,\n returnNode\n );\n }\n mergeRenderOutput(output, item);\n });\n\n return output;\n}\n\nexport async function renderBrick(\n returnNode: RenderNode,\n brickConf: RuntimeBrickConfWithSymbols,\n _runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n slotId?: string,\n keyPath: number[] = [],\n tplStack = new Map<string, number>()\n): Promise<RenderOutput> {\n const output: RenderOutput = {\n blockingList: [],\n menuRequests: [],\n };\n\n if (!brickConf.brick) {\n if ((brickConf as { template?: string }).template) {\n // eslint-disable-next-line no-console\n console.error(\"Legacy templates are dropped in v3:\", brickConf);\n } else {\n // eslint-disable-next-line no-console\n console.error(\"Invalid brick:\", brickConf);\n }\n return output;\n }\n\n // Translate `if: \"<%= ... %>\"` to `brick: \":if\", dataSource: \"<%= ... %>\"`.\n // In other words, translate tracking if expressions to tracking control nodes of `:if`.\n const { if: brickIf, permissionsPreCheck, ...restBrickConf } = brickConf;\n if (isGeneralizedTrackAll(brickIf)) {\n return renderBrick(\n returnNode,\n {\n brick: \":if\",\n dataSource: brickIf,\n // `permissionsPreCheck` maybe required before computing `if`.\n permissionsPreCheck,\n slots: {\n \"\": {\n type: \"bricks\",\n bricks: [restBrickConf],\n },\n },\n // These symbols have to be copied to the new brick conf.\n ...Object.getOwnPropertySymbols(brickConf).reduce(\n (acc, symbol) => ({\n ...acc,\n [symbol]: (brickConf as any)[symbol],\n }),\n {} as RuntimeBrickConfOfTplSymbols & RuntimeBrickConfOfFormSymbols\n ),\n },\n _runtimeContext,\n rendererContext,\n parentRoutes,\n slotId,\n keyPath,\n tplStack\n );\n }\n\n const tplStateStoreId = brickConf[symbolForTplStateStoreId];\n const formStateStoreId = brickConf[symbolForFormStateStoreId];\n const runtimeContext = {\n ..._runtimeContext,\n tplStateStoreId,\n formStateStoreId,\n };\n\n if (hasOwnProperty(brickConf, symbolForTPlExternalForEachItem)) {\n // The external bricks of a template should restore their `forEachItem` and\n // `forEachIndex` from their host.\n runtimeContext.forEachItem = brickConf[symbolForTPlExternalForEachItem];\n runtimeContext.forEachIndex = brickConf[symbolForTPlExternalForEachIndex];\n }\n\n const { context } = brickConf as { context?: ContextConf[] };\n // istanbul ignore next\n if (Array.isArray(context) && context.length > 0) {\n const strict = isStrictMode(runtimeContext);\n warnAboutStrictMode(\n strict,\n \"Defining context on bricks\",\n \"check your brick:\",\n brickConf\n );\n if (!strict) {\n runtimeContext.ctxStore.define(context, runtimeContext);\n }\n }\n\n runtimeContext.pendingPermissionsPreCheck.push(\n hooks?.checkPermissions?.preCheckPermissionsForBrickOrRoute(\n brickConf,\n (value) => asyncComputeRealValue(value, runtimeContext)\n )\n );\n\n if (!(await asyncCheckBrickIf(brickConf, runtimeContext))) {\n return output;\n }\n\n const brickName = brickConf.brick;\n if (brickName.startsWith(\":\")) {\n ensureValidControlBrick(brickName);\n\n const { dataSource } = brickConf;\n\n const renderControlNode = async (runtimeContext: RuntimeContext) => {\n // First, compute the `dataSource`\n const computedDataSource = await asyncComputeRealValue(\n dataSource,\n runtimeContext\n );\n\n // Then, get the matched slot.\n const slot =\n brickName === \":forEach\"\n ? \"\"\n : brickName === \":switch\"\n ? String(computedDataSource)\n : computedDataSource\n ? \"\"\n : \"else\";\n\n // Don't forget to transpile children to slots.\n const slots = childrenToSlots(brickConf.children, brickConf.slots);\n\n // Then, get the bricks in that matched slot.\n const bricks =\n slots &&\n hasOwnProperty(slots, slot) &&\n (slots[slot] as SlotConfOfBricks)?.bricks;\n\n if (!Array.isArray(bricks)) {\n return output;\n }\n\n switch (brickName) {\n case \":forEach\": {\n if (!Array.isArray(computedDataSource)) {\n return output;\n }\n return renderForEach(\n returnNode,\n computedDataSource,\n bricks,\n runtimeContext,\n rendererContext,\n parentRoutes,\n slotId,\n tplStack,\n keyPath\n );\n }\n case \":if\":\n case \":switch\": {\n return renderBricks(\n returnNode,\n bricks,\n runtimeContext,\n rendererContext,\n parentRoutes,\n slotId,\n tplStack,\n keyPath\n );\n }\n }\n };\n\n const controlledOutput = await renderControlNode(runtimeContext);\n const { onMount, onUnmount } = brickConf.lifeCycle ?? {};\n\n const { contextNames, stateNames } = getTracks(dataSource);\n if (contextNames || stateNames) {\n controlledOutput.hasTrackingControls = true;\n let renderId = 0;\n const listener = async () => {\n const currentRenderId = ++renderId;\n const [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope] =\n createScopedRuntimeContext(runtimeContext);\n\n const controlOutput = await renderControlNode(scopedRuntimeContext);\n\n const scopedStores = [...tplStateStoreScope, ...formStateStoreScope];\n await postAsyncRender(\n controlOutput,\n scopedRuntimeContext,\n scopedStores\n );\n\n // Ignore stale renders\n if (renderId === currentRenderId) {\n if (onUnmount) {\n listenerFactory(\n onUnmount,\n runtimeContext\n )(new CustomEvent(\"unmount\", { detail: { rerender: true } }));\n }\n\n rendererContext.reRender(\n slotId,\n keyPath,\n controlOutput.node,\n returnNode\n );\n\n if (onMount) {\n listenerFactory(\n onMount,\n scopedRuntimeContext\n )(new CustomEvent(\"mount\", { detail: { rerender: true } }));\n }\n\n for (const store of scopedStores) {\n store.mountAsyncData();\n }\n }\n };\n const debouncedListener = debounce(listener);\n if (contextNames) {\n for (const contextName of contextNames) {\n runtimeContext.ctxStore.onChange(contextName, debouncedListener);\n }\n }\n if (stateNames) {\n for (const contextName of stateNames) {\n const tplStateStore = getTplStateStore(\n runtimeContext,\n \"STATE\",\n `: \"${dataSource}\"`\n );\n tplStateStore.onChange(contextName, debouncedListener);\n }\n }\n }\n\n if (onMount) {\n rendererContext.registerArbitraryLifeCycle(\"onMount\", () => {\n listenerFactory(\n onMount,\n runtimeContext\n )(new CustomEvent(\"mount\", { detail: { rerender: false } }));\n });\n }\n\n if (onUnmount) {\n rendererContext.registerArbitraryLifeCycle(\"onUnmount\", () => {\n listenerFactory(\n onUnmount,\n runtimeContext\n )(new CustomEvent(\"unmount\", { detail: { rerender: false } }));\n });\n }\n\n return controlledOutput;\n }\n\n // Widgets need to be defined before rendering.\n if (/\\.tpl-/.test(brickName) && !customTemplates.get(brickName)) {\n await catchLoad(\n loadBricksImperatively([brickName], getBrickPackages()),\n \"brick\",\n brickName,\n rendererContext.unknownBricks\n );\n }\n\n const tplTagName = getTagNameOfCustomTemplate(\n brickName,\n runtimeContext.app?.id\n );\n\n if (tplTagName) {\n const tplCount = tplStack.get(tplTagName) ?? 0;\n if (tplCount >= 10) {\n throw new Error(\n `Maximum custom template stack overflowed: \"${tplTagName}\"`\n );\n }\n tplStack.set(tplTagName, tplCount + 1);\n } else if (brickName.includes(\"-\") && !customElements.get(brickName)) {\n if (brickName === FORM_RENDERER) {\n customElements.define(\n FORM_RENDERER,\n class FormRendererElement extends HTMLElement {\n get $$typeof(): string {\n return \"form-renderer\";\n }\n }\n );\n } else {\n output.blockingList.push(\n catchLoad(\n enqueueStableLoadBricks([brickName], getBrickPackages()),\n \"brick\",\n brickName,\n rendererContext.unknownBricks\n )\n );\n }\n }\n\n let formData: unknown;\n let confProps: Record<string, unknown> | undefined;\n if (brickName === FORM_RENDERER) {\n ({ formData, ...confProps } = brickConf.properties ?? {});\n } else {\n confProps = brickConf.properties;\n }\n\n const trackingContextList: TrackingContextItem[] = [];\n const asyncPropertyEntries = asyncComputeRealPropertyEntries(\n confProps,\n runtimeContext,\n trackingContextList\n );\n\n const computedPropsFromHost = brickConf[symbolForAsyncComputedPropsFromHost];\n if (computedPropsFromHost) {\n asyncPropertyEntries.push(...computedPropsFromHost);\n }\n\n const isScript = brickName === \"script\";\n if (isScript || brickName === \"link\") {\n const props = await constructAsyncProperties(asyncPropertyEntries);\n if (isScript ? props.src : props.rel === \"stylesheet\" && props.href) {\n const prefix = window.PUBLIC_ROOT ?? \"\";\n if (isScript) {\n const { src, ...attrs } = props;\n await catchLoad(\n loadScript(src as string, prefix, attrs),\n \"script\",\n src as string,\n \"silent\"\n );\n } else {\n const { href, ...attrs } = props;\n await catchLoad(\n loadStyle(href as string, prefix, attrs),\n \"stylesheet\",\n href as string,\n \"silent\"\n );\n }\n return output;\n }\n }\n\n const brick: RenderBrick = {\n tag: RenderTag.BRICK,\n type: tplTagName || brickName,\n return: returnNode,\n slotId,\n events: brickConf.events,\n runtimeContext,\n portal: brickConf.portal,\n iid: brickConf.iid,\n ref: (brickConf as BrickConfInTemplate).ref,\n };\n\n output.node = brick;\n\n // 在最终挂载前,先加载所有可能用到的 processors。\n const usedProcessors = strictCollectMemberUsage(\n [brickConf.events, brickConf.lifeCycle],\n \"PROCESSORS\",\n 2\n );\n if (usedProcessors.size > 0) {\n output.blockingList.push(\n catchLoad(\n loadProcessorsImperatively(usedProcessors, getBrickPackages()),\n \"processors\",\n [...usedProcessors].join(\", \"),\n rendererContext.unknownBricks\n )\n );\n }\n\n // 加载构件属性和加载子构件等任务,可以并行。\n const blockingList: Promise<unknown>[] = [];\n\n const loadProperties = async () => {\n brick.properties = await constructAsyncProperties(asyncPropertyEntries);\n listenOnTrackingContext(brick, trackingContextList);\n };\n blockingList.push(loadProperties());\n\n rendererContext.registerBrickLifeCycle(brick, brickConf.lifeCycle);\n\n let expandedBrickConf = brickConf;\n if (tplTagName) {\n expandedBrickConf = expandCustomTemplate(\n tplTagName,\n brickConf,\n brick,\n asyncPropertyEntries,\n rendererContext\n );\n } else if (brickName === FORM_RENDERER) {\n expandedBrickConf = expandFormRenderer(\n formData,\n brickConf,\n brick,\n asyncPropertyEntries,\n rendererContext\n );\n }\n\n if (expandedBrickConf.portal) {\n // A portal brick has no slotId.\n brick.slotId = undefined;\n }\n\n let childRuntimeContext: RuntimeContext;\n if (tplTagName) {\n // There is a boundary for `forEachItem` between template internals and externals.\n childRuntimeContext = {\n ...runtimeContext,\n };\n delete childRuntimeContext.forEachItem;\n delete childRuntimeContext.forEachIndex;\n } else {\n childRuntimeContext = runtimeContext;\n }\n\n const loadChildren = async () => {\n const slots = childrenToSlots(\n expandedBrickConf.children,\n expandedBrickConf.slots\n );\n if (!slots) {\n return;\n }\n const routeSlotIndexes = new Set<number>();\n const rendered = await Promise.all(\n Object.entries(slots).map(([childSlotId, slotConf], index) => {\n if (slotConf.type !== \"routes\") {\n return renderBricks(\n brick,\n (slotConf as SlotConfOfBricks).bricks,\n childRuntimeContext,\n rendererContext,\n parentRoutes,\n childSlotId,\n tplStack\n );\n }\n\n if (runtimeContext.flags[\"incremental-sub-route-rendering\"]) {\n routeSlotIndexes.add(index);\n rendererContext.performIncrementalRender(async (location) => {\n const { homepage } = childRuntimeContext.app;\n const { pathname } = location;\n // Ignore if any one of homepage and parent routes not matched.\n if (\n !matchHomepage(homepage, pathname) ||\n !parentRoutes.every((route) =>\n matchRoute(route, homepage, pathname)\n )\n ) {\n return false;\n }\n\n const [\n scopedRuntimeContext,\n tplStateStoreScope,\n formStateStoreScope,\n ] = createScopedRuntimeContext({\n ...childRuntimeContext,\n location,\n query: new URLSearchParams(location.search),\n });\n\n let failed = false;\n let incrementalOutput: RenderOutput;\n let scopedStores: DataStore<\"STATE\" | \"FORM_STATE\">[] = [];\n\n try {\n incrementalOutput = await renderRoutes(\n brick,\n slotConf.routes,\n scopedRuntimeContext,\n rendererContext,\n parentRoutes,\n childSlotId,\n true\n );\n\n // If all sub-routes are missed, ignore incremental rendering\n if (!incrementalOutput.route) {\n return false;\n }\n\n // Bailout if redirect or unauthenticated is set\n if (rendererContext.reBailout(incrementalOutput)) {\n return true;\n }\n\n scopedStores = [...tplStateStoreScope, ...formStateStoreScope];\n await postAsyncRender(incrementalOutput, scopedRuntimeContext, [\n scopedRuntimeContext.ctxStore,\n ...scopedStores,\n ]);\n\n await rendererContext.reMergeMenuRequests(\n slotConf.routes,\n incrementalOutput.route,\n incrementalOutput.menuRequests\n );\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Incremental sub-router failed:\", error);\n\n const result = rendererContext.reCatch(error, brick);\n if (!result) {\n return true;\n }\n ({ failed, output: incrementalOutput } = result);\n\n // Assert: no errors will be throw\n await rendererContext.reMergeMenuRequests(\n slotConf.routes,\n incrementalOutput.route,\n incrementalOutput.menuRequests\n );\n }\n\n rendererContext.reRender(\n childSlotId,\n [],\n incrementalOutput.node,\n brick\n );\n\n if (!failed) {\n scopedRuntimeContext.ctxStore.mountAsyncData(\n incrementalOutput.route\n );\n for (const store of scopedStores) {\n store.mountAsyncData();\n }\n }\n\n return true;\n });\n }\n\n return renderRoutes(\n brick,\n slotConf.routes,\n childRuntimeContext,\n rendererContext,\n parentRoutes,\n childSlotId\n );\n })\n );\n\n const childrenOutput: RenderOutput = {\n ...output,\n node: undefined,\n blockingList: [],\n menuRequests: [],\n };\n rendered.forEach((item, index) => {\n if (routeSlotIndexes.has(index)) {\n // Memoize a render node before it's been merged.\n rendererContext.memoize(slotId, [], item.node, brick);\n }\n mergeRenderOutput(childrenOutput, item);\n });\n if (childrenOutput.node) {\n brick.child = childrenOutput.node;\n }\n mergeRenderOutput(output, {\n ...childrenOutput,\n node: undefined,\n });\n };\n blockingList.push(loadChildren());\n\n await Promise.all(blockingList);\n\n return output;\n}\n\nfunction isGeneralizedTrackAll(brickIf: unknown): boolean {\n return typeof brickIf === \"string\"\n ? isTrackAll(brickIf)\n : isPreEvaluated(brickIf) &&\n // istanbul ignore next: covered by e2e tests\n isTrackAll(getPreEvaluatedRaw(brickIf));\n}\n\ntype ValidControlBrick = \":forEach\" | \":if\" | \":switch\";\n\nfunction ensureValidControlBrick(\n brick: string\n): asserts brick is ValidControlBrick {\n if (brick !== \":forEach\" && brick !== \":if\" && brick !== \":switch\") {\n throw new Error(`Unknown storyboard control node: \"${brick}\"`);\n }\n}\n\nasync function renderForEach(\n returnNode: RenderNode,\n dataSource: unknown[],\n bricks: BrickConf[],\n runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n slotId: string | undefined,\n tplStack: Map<string, number>,\n keyPath: number[]\n): Promise<RenderOutput> {\n const output: RenderOutput = {\n blockingList: [],\n menuRequests: [],\n };\n\n const rows = dataSource.length;\n const rendered = await Promise.all(\n dataSource.map((item, i) =>\n Promise.all(\n bricks.map((brickConf, j) =>\n renderBrick(\n returnNode,\n brickConf,\n {\n ...runtimeContext,\n forEachItem: item,\n forEachIndex: i,\n },\n rendererContext,\n parentRoutes,\n slotId,\n keyPath.concat(i * rows + j),\n tplStack && new Map(tplStack)\n )\n )\n )\n )\n );\n\n // 多层构件并行异步转换,但转换的结果按原顺序串行合并。\n rendered.flat().forEach((item, index) => {\n if (item.hasTrackingControls) {\n // Memoize a render node before it's been merged.\n rendererContext.memoize(\n slotId,\n keyPath.concat(index),\n item.node,\n returnNode\n );\n }\n mergeRenderOutput(output, item);\n });\n\n return output;\n}\n\nexport function getDataStores(runtimeContext: RuntimeContext) {\n return [\n runtimeContext.ctxStore,\n ...runtimeContext.tplStateStoreMap.values(),\n ...runtimeContext.formStateStoreMap.values(),\n ];\n}\n\nexport function postAsyncRender(\n output: RenderOutput,\n runtimeContext: RuntimeContext,\n stores: DataStore<DataStoreType>[]\n) {\n flushStableLoadBricks();\n\n return Promise.all([\n ...output.blockingList,\n ...stores.map((store) => store.waitForAll()),\n ...runtimeContext.pendingPermissionsPreCheck,\n ]);\n}\n\nexport function createScopedRuntimeContext(\n runtimeContext: RuntimeContext\n): [\n scopedRuntimeContext: RuntimeContext,\n tplStateStoreScope: DataStore<\"STATE\">[],\n formStateStoreScope: DataStore<\"FORM_STATE\">[],\n] {\n const tplStateStoreScope: DataStore<\"STATE\">[] = [];\n const formStateStoreScope: DataStore<\"FORM_STATE\">[] = [];\n const scopedRuntimeContext: RuntimeContext = {\n ...runtimeContext,\n tplStateStoreScope,\n formStateStoreScope,\n };\n return [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope];\n}\n\nfunction loadMenu(\n menuConf: MenuConf | undefined,\n runtimeContext: RuntimeContext\n) {\n if (!menuConf) {\n return;\n }\n\n // istanbul ignore next\n if ((menuConf as { type?: \"brick\" }).type === \"brick\") {\n // eslint-disable-next-line no-console\n console.error(\"Set menu with brick is dropped in v3:\", menuConf);\n throw new Error(\"Set menu with brick is dropped in v3\");\n }\n\n // istanbul ignore next\n if (menuConf.type === \"resolve\") {\n // eslint-disable-next-line no-console\n console.warn(\"Set menu with resolve is not supported in v3 yet:\", menuConf);\n return;\n }\n\n return asyncComputeRealValue(\n menuConf,\n runtimeContext\n ) as Promise<StaticMenuConf>;\n}\n\nfunction mergeRenderOutput(\n output: RenderOutput,\n newOutput: RenderOutput\n): void {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { blockingList, node, menuRequests, hasTrackingControls, ...rest } =\n newOutput;\n output.blockingList.push(...blockingList);\n output.menuRequests.push(...menuRequests);\n\n if (node) {\n if (output.node) {\n let last = output.node;\n while (last.sibling) {\n last = last.sibling;\n }\n last.sibling = node;\n } else {\n output.node = node;\n }\n }\n\n Object.assign(output, rest);\n}\n\nexport function childrenToSlots(\n children: BrickConf[] | undefined,\n originalSlots: SlotsConf | undefined\n) {\n let newSlots = originalSlots;\n // istanbul ignore next\n if (\n process.env.NODE_ENV === \"development\" &&\n children &&\n !Array.isArray(children)\n ) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Specified brick children but not array:\",\n `<${typeof children}>`,\n children\n );\n }\n if (Array.isArray(children) && !newSlots) {\n newSlots = {};\n for (const child of children) {\n const slot = child.slot ?? \"\";\n if (!hasOwnProperty(newSlots, slot)) {\n newSlots[slot] = {\n type: \"bricks\",\n bricks: [],\n };\n }\n (newSlots[slot] as SlotConfOfBricks).bricks.push(child);\n }\n }\n return newSlots;\n}\n\nfunction catchLoad(\n promise: Promise<unknown>,\n type: \"brick\" | \"processors\" | \"script\" | \"stylesheet\",\n name: string,\n unknownPolicy: RendererContext[\"unknownBricks\"]\n) {\n return unknownPolicy === \"silent\"\n ? promise.catch((e) => {\n // eslint-disable-next-line no-console\n console.error(`Load ${type} \"${name}\" failed:`, e);\n })\n : promise;\n}\n"],"mappings":";;;;;;;;AAUA,SACEA,uBAAuB,EACvBC,qBAAqB,EACrBC,sBAAsB,EACtBC,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Q,CAAC5I,IAAI,CAAC,GAAG;UACfnF,IAAI,EAAE,QAAQ;UACde,MAAM,EAAE;QACV,CAAC;MACH;MACCgN,QAAQ,CAAC5I,IAAI,CAAC,CAAsBpE,MAAM,CAACtB,IAAI,CAACyM,KAAK,CAAC;IACzD;EACF;EACA,OAAO6B,QAAQ;AACjB;AAEA,SAASxG,SAASA,CAChB6G,OAAyB,EACzBpO,IAAsD,EACtDqO,IAAY,EACZC,aAA+C,EAC/C;EACA,OAAOA,aAAa,KAAK,QAAQ,GAC7BF,OAAO,CAACG,KAAK,CAAEC,CAAC,IAAK;IACnB;IACAnO,OAAO,CAACC,KAAK,SAAAlB,MAAA,CAASY,IAAI,SAAAZ,MAAA,CAAKiP,IAAI,iBAAaG,CAAC,CAAC;EACpD,CAAC,CAAC,GACFJ,OAAO;AACb"}
|
|
1
|
+
{"version":3,"file":"Renderer.js","names":["enqueueStableLoadBricks","flushStableLoadBricks","loadBricksImperatively","loadProcessorsImperatively","loadScript","loadStyle","isTrackAll","hasOwnProperty","strictCollectMemberUsage","debounce","asyncCheckBrickIf","asyncComputeRealPropertyEntries","constructAsyncProperties","resolveData","asyncComputeRealValue","listenOnTrackingContext","matchRoute","matchRoutes","symbolForAsyncComputedPropsFromHost","symbolForTPlExternalForEachIndex","symbolForTPlExternalForEachItem","symbolForTplStateStoreId","expandCustomTemplate","getTagNameOfCustomTemplate","getTplStateStore","customTemplates","getBrickPackages","hooks","RenderTag","getTracks","isStrictMode","warnAboutStrictMode","FORM_RENDERER","symbolForFormStateStoreId","expandFormRenderer","isPreEvaluated","getPreEvaluatedRaw","matchHomepage","listenerFactory","renderRoutes","_x","_x2","_x3","_x4","_x5","_x6","_x7","_renderRoutes","apply","arguments","_asyncToGenerator","returnNode","routes","_runtimeContext","rendererContext","parentRoutes","slotId","isIncremental","matched","output","getEmptyRenderOutput","unauthenticated","_hooks$checkPermissio","route","runtimeContext","_objectSpread","match","ctxStore","disposeDataInRoutes","routePath","concat","define","context","undefined","pendingPermissionsPreCheck","push","checkPermissions","preCheckPermissionsForBrickOrRoute","value","preLoadBricks","Array","isArray","blockingList","type","redirectTo","redirect","resolved","transform","console","error","Error","path","menuRequest","loadMenu","menu","menuRequests","newOutput","mergeRenderOutput","renderBricks","bricks","tag","BRICK","memoizeMenuRequests","_x8","_x9","_x10","_x11","_x12","_x13","_x14","_x15","_renderBricks","tplStack","keyPath","kPath","rendered","Promise","all","map","brickConf","index","renderBrick","Map","forEach","item","hasTrackingControls","memoize","node","_x16","_x17","_x18","_x19","_x20","_x21","_renderBrick","_hooks$checkPermissio2","_runtimeContext$app","length","brick","template","if","brickIf","permissionsPreCheck","restBrickConf","_objectWithoutProperties","_excluded2","isGeneralizedTrackAll","dataSource","slots","Object","getOwnPropertySymbols","reduce","acc","symbol","tplStateStoreId","formStateStoreId","forEachItem","forEachIndex","strict","brickName","startsWith","_brickConf$lifeCycle","ensureValidControlBrick","lowerLevelRenderControlNode","_ref","_slots$slot","computedDataSource","slot","String","childrenToSlots","children","renderForEach","_x31","renderControlNode","_ref2","_rawOutput$node","rawOutput","PLACEHOLDER","return","_x32","controlledOutput","onMount","onUnmount","lifeCycle","contextNames","stateNames","renderId","listener","_ref3","currentRenderId","scopedRuntimeContext","tplStateStoreScope","formStateStoreScope","createScopedRuntimeContext","reControlledOutput","scopedStores","postAsyncRender","CustomEvent","detail","rerender","reRender","store","mountAsyncData","debouncedListener","contextName","onChange","tplStateStore","registerArbitraryLifeCycle","test","get","catchLoad","unknownBricks","tplTagName","app","id","_tplStack$get","tplCount","set","includes","customElements","FormRendererElement","HTMLElement","$$typeof","formData","confProps","_brickConf$properties","_ref4","properties","_excluded3","trackingContextList","asyncPropertyEntries","computedPropsFromHost","isScript","props","src","rel","href","_window$PUBLIC_ROOT","prefix","window","PUBLIC_ROOT","attrs","_excluded4","_excluded5","events","portal","iid","ref","usedProcessors","size","join","loadProperties","_ref5","registerBrickLifeCycle","expandedBrickConf","childRuntimeContext","loadChildren","_ref6","routeSlotIndexes","Set","entries","_ref7","childSlotId","slotConf","flags","add","performIncrementalRender","_ref8","location","homepage","pathname","every","query","URLSearchParams","search","failed","incrementalOutput","reBailout","reMergeMenuRequests","result","reCatch","_x33","childrenOutput","has","child","_x22","_x23","_x24","_x25","_x26","_x27","_x28","_x29","_x30","_renderForEach","rows","i","j","flat","getDataStores","tplStateStoreMap","values","formStateStoreMap","stores","waitForAll","menuConf","warn","rest","_excluded","last","sibling","assign","originalSlots","newSlots","process","env","NODE_ENV","_child$slot","promise","name","unknownPolicy","catch","e"],"sources":["../../../src/internal/Renderer.ts"],"sourcesContent":["import type {\n BrickConf,\n BrickConfInTemplate,\n ContextConf,\n MenuConf,\n RouteConf,\n SlotConfOfBricks,\n SlotsConf,\n StaticMenuConf,\n} from \"@next-core/types\";\nimport {\n enqueueStableLoadBricks,\n flushStableLoadBricks,\n loadBricksImperatively,\n loadProcessorsImperatively,\n loadScript,\n loadStyle,\n} from \"@next-core/loader\";\nimport { isTrackAll } from \"@next-core/cook\";\nimport { hasOwnProperty } from \"@next-core/utils/general\";\nimport { strictCollectMemberUsage } from \"@next-core/utils/storyboard\";\nimport { debounce } from \"lodash\";\nimport { asyncCheckBrickIf } from \"./compute/checkIf.js\";\nimport {\n asyncComputeRealPropertyEntries,\n constructAsyncProperties,\n} from \"./compute/computeRealProperties.js\";\nimport { resolveData } from \"./data/resolveData.js\";\nimport { asyncComputeRealValue } from \"./compute/computeRealValue.js\";\nimport {\n TrackingContextItem,\n listenOnTrackingContext,\n} from \"./compute/listenOnTrackingContext.js\";\nimport { RendererContext } from \"./RendererContext.js\";\nimport { matchRoute, matchRoutes } from \"./matchRoutes.js\";\nimport {\n symbolForAsyncComputedPropsFromHost,\n symbolForTPlExternalForEachIndex,\n symbolForTPlExternalForEachItem,\n symbolForTplStateStoreId,\n} from \"./CustomTemplates/constants.js\";\nimport { expandCustomTemplate } from \"./CustomTemplates/expandCustomTemplate.js\";\nimport type {\n RenderBrick,\n RenderChildNode,\n RenderReturnNode,\n RuntimeBrickConfWithSymbols,\n RuntimeContext,\n} from \"./interfaces.js\";\nimport {\n getTagNameOfCustomTemplate,\n getTplStateStore,\n} from \"./CustomTemplates/utils.js\";\nimport { customTemplates } from \"../CustomTemplates.js\";\nimport type { NextHistoryState } from \"./historyExtended.js\";\nimport { getBrickPackages, hooks } from \"./Runtime.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { getTracks } from \"./compute/getTracks.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"../isStrictMode.js\";\nimport {\n FORM_RENDERER,\n RuntimeBrickConfOfFormSymbols,\n symbolForFormStateStoreId,\n} from \"./FormRenderer/constants.js\";\nimport { expandFormRenderer } from \"./FormRenderer/expandFormRenderer.js\";\nimport { isPreEvaluated } from \"./compute/evaluate.js\";\nimport { getPreEvaluatedRaw } from \"./compute/evaluate.js\";\nimport { RuntimeBrickConfOfTplSymbols } from \"./CustomTemplates/constants.js\";\nimport { matchHomepage } from \"./matchStoryboard.js\";\nimport type { DataStore, DataStoreType } from \"./data/DataStore.js\";\nimport { listenerFactory } from \"./bindListeners.js\";\n\nexport interface RenderOutput {\n node?: RenderChildNode;\n unauthenticated?: boolean;\n redirect?: {\n path: string;\n state?: NextHistoryState;\n };\n route?: RouteConf;\n blockingList: (Promise<unknown> | undefined)[];\n menuRequests: Promise<StaticMenuConf>[];\n hasTrackingControls?: boolean;\n}\n\nexport async function renderRoutes(\n returnNode: RenderReturnNode,\n routes: RouteConf[],\n _runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n slotId?: string,\n isIncremental?: boolean\n): Promise<RenderOutput> {\n const matched = await matchRoutes(routes, _runtimeContext);\n const output = getEmptyRenderOutput();\n switch (matched) {\n case \"missed\":\n break;\n case \"unauthenticated\":\n output.unauthenticated = true;\n break;\n default: {\n const route = (output.route = matched.route);\n const runtimeContext = {\n ..._runtimeContext,\n match: matched.match,\n };\n if (isIncremental) {\n runtimeContext.ctxStore.disposeDataInRoutes(routes);\n }\n const routePath = parentRoutes.concat(route);\n runtimeContext.ctxStore.define(\n route.context,\n runtimeContext,\n undefined,\n routePath\n );\n runtimeContext.pendingPermissionsPreCheck.push(\n hooks?.checkPermissions?.preCheckPermissionsForBrickOrRoute(\n route,\n (value) => asyncComputeRealValue(value, runtimeContext)\n )\n );\n\n // Currently, this is only used for brick size-checking: these bricks\n // will be loaded before page rendering, but they will NOT be rendered.\n const { preLoadBricks } = route as { preLoadBricks?: string[] };\n if (Array.isArray(preLoadBricks)) {\n output.blockingList.push(\n loadBricksImperatively(preLoadBricks, getBrickPackages())\n );\n }\n\n if (route.type === \"redirect\") {\n let redirectTo: unknown;\n if (typeof route.redirect === \"string\") {\n redirectTo = await asyncComputeRealValue(\n route.redirect,\n runtimeContext\n );\n } else {\n const resolved = (await resolveData(\n {\n transform: \"redirect\",\n ...route.redirect,\n },\n runtimeContext\n )) as { redirect?: unknown };\n redirectTo = resolved.redirect;\n }\n if (typeof redirectTo !== \"string\") {\n // eslint-disable-next-line no-console\n console.error(\"Unexpected redirect result:\", redirectTo);\n throw new Error(\n `Unexpected type of redirect result: ${typeof redirectTo}`\n );\n }\n output.redirect = { path: redirectTo };\n } else {\n const menuRequest = loadMenu(route.menu, runtimeContext);\n if (menuRequest) {\n output.menuRequests.push(menuRequest);\n }\n\n if (route.type === \"routes\") {\n const newOutput = await renderRoutes(\n returnNode,\n route.routes,\n runtimeContext,\n rendererContext,\n routePath,\n slotId\n );\n mergeRenderOutput(output, newOutput);\n } else {\n const newOutput = await renderBricks(\n returnNode,\n route.bricks,\n runtimeContext,\n rendererContext,\n routePath,\n slotId\n );\n mergeRenderOutput(output, newOutput);\n }\n\n if (returnNode.tag === RenderTag.BRICK) {\n rendererContext.memoizeMenuRequests(route, output.menuRequests);\n }\n }\n }\n }\n\n return output;\n}\n\nexport async function renderBricks(\n returnNode: RenderReturnNode,\n bricks: BrickConf[],\n runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n slotId?: string,\n tplStack?: Map<string, number>,\n keyPath?: number[]\n): Promise<RenderOutput> {\n const output = getEmptyRenderOutput();\n const kPath = keyPath ?? [];\n // 多个构件并行异步转换,但转换的结果按原顺序串行合并。\n const rendered = await Promise.all(\n bricks.map((brickConf, index) =>\n renderBrick(\n returnNode,\n brickConf,\n runtimeContext,\n rendererContext,\n parentRoutes,\n slotId,\n kPath.concat(index),\n tplStack && new Map(tplStack)\n )\n )\n );\n\n rendered.forEach((item, index) => {\n if (item.hasTrackingControls) {\n // Memoize a render node before it's been merged.\n rendererContext.memoize(\n slotId,\n kPath.concat(index),\n item.node,\n returnNode\n );\n }\n mergeRenderOutput(output, item);\n });\n\n return output;\n}\n\nexport async function renderBrick(\n returnNode: RenderReturnNode,\n brickConf: RuntimeBrickConfWithSymbols,\n _runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n slotId?: string,\n keyPath: number[] = [],\n tplStack = new Map<string, number>()\n): Promise<RenderOutput> {\n const output = getEmptyRenderOutput();\n\n if (!brickConf.brick) {\n if ((brickConf as { template?: string }).template) {\n // eslint-disable-next-line no-console\n console.error(\"Legacy templates are dropped in v3:\", brickConf);\n } else {\n // eslint-disable-next-line no-console\n console.error(\"Invalid brick:\", brickConf);\n }\n return output;\n }\n\n // Translate `if: \"<%= ... %>\"` to `brick: \":if\", dataSource: \"<%= ... %>\"`.\n // In other words, translate tracking if expressions to tracking control nodes of `:if`.\n const { if: brickIf, permissionsPreCheck, ...restBrickConf } = brickConf;\n if (isGeneralizedTrackAll(brickIf)) {\n return renderBrick(\n returnNode,\n {\n brick: \":if\",\n dataSource: brickIf,\n // `permissionsPreCheck` maybe required before computing `if`.\n permissionsPreCheck,\n slots: {\n \"\": {\n type: \"bricks\",\n bricks: [restBrickConf],\n },\n },\n // These symbols have to be copied to the new brick conf.\n ...Object.getOwnPropertySymbols(brickConf).reduce(\n (acc, symbol) => ({\n ...acc,\n [symbol]: (brickConf as any)[symbol],\n }),\n {} as RuntimeBrickConfOfTplSymbols & RuntimeBrickConfOfFormSymbols\n ),\n },\n _runtimeContext,\n rendererContext,\n parentRoutes,\n slotId,\n keyPath,\n tplStack\n );\n }\n\n const tplStateStoreId = brickConf[symbolForTplStateStoreId];\n const formStateStoreId = brickConf[symbolForFormStateStoreId];\n const runtimeContext = {\n ..._runtimeContext,\n tplStateStoreId,\n formStateStoreId,\n };\n\n if (hasOwnProperty(brickConf, symbolForTPlExternalForEachItem)) {\n // The external bricks of a template should restore their `forEachItem` and\n // `forEachIndex` from their host.\n runtimeContext.forEachItem = brickConf[symbolForTPlExternalForEachItem];\n runtimeContext.forEachIndex = brickConf[symbolForTPlExternalForEachIndex];\n }\n\n const { context } = brickConf as { context?: ContextConf[] };\n // istanbul ignore next\n if (Array.isArray(context) && context.length > 0) {\n const strict = isStrictMode(runtimeContext);\n warnAboutStrictMode(\n strict,\n \"Defining context on bricks\",\n \"check your brick:\",\n brickConf\n );\n if (!strict) {\n runtimeContext.ctxStore.define(context, runtimeContext);\n }\n }\n\n runtimeContext.pendingPermissionsPreCheck.push(\n hooks?.checkPermissions?.preCheckPermissionsForBrickOrRoute(\n brickConf,\n (value) => asyncComputeRealValue(value, runtimeContext)\n )\n );\n\n if (!(await asyncCheckBrickIf(brickConf, runtimeContext))) {\n return output;\n }\n\n const brickName = brickConf.brick;\n if (brickName.startsWith(\":\")) {\n ensureValidControlBrick(brickName);\n\n const { dataSource } = brickConf;\n\n const lowerLevelRenderControlNode = async (\n runtimeContext: RuntimeContext\n ) => {\n // First, compute the `dataSource`\n const computedDataSource = await asyncComputeRealValue(\n dataSource,\n runtimeContext\n );\n\n // Then, get the matched slot.\n const slot =\n brickName === \":forEach\"\n ? \"\"\n : brickName === \":switch\"\n ? String(computedDataSource)\n : computedDataSource\n ? \"\"\n : \"else\";\n\n // Don't forget to transpile children to slots.\n const slots = childrenToSlots(brickConf.children, brickConf.slots);\n\n // Then, get the bricks in that matched slot.\n const bricks =\n slots &&\n hasOwnProperty(slots, slot) &&\n (slots[slot] as SlotConfOfBricks)?.bricks;\n\n if (!Array.isArray(bricks)) {\n return getEmptyRenderOutput();\n }\n\n switch (brickName) {\n case \":forEach\": {\n if (!Array.isArray(computedDataSource)) {\n return getEmptyRenderOutput();\n }\n return renderForEach(\n returnNode,\n computedDataSource,\n bricks,\n runtimeContext,\n rendererContext,\n parentRoutes,\n slotId,\n tplStack,\n keyPath\n );\n }\n case \":if\":\n case \":switch\": {\n return renderBricks(\n returnNode,\n bricks,\n runtimeContext,\n rendererContext,\n parentRoutes,\n slotId,\n tplStack,\n keyPath\n );\n }\n }\n };\n\n const renderControlNode = async (runtimeContext: RuntimeContext) => {\n const rawOutput = await lowerLevelRenderControlNode(runtimeContext);\n rawOutput.node ??= {\n tag: RenderTag.PLACEHOLDER,\n return: returnNode,\n };\n return rawOutput;\n };\n\n const controlledOutput = await renderControlNode(runtimeContext);\n const { onMount, onUnmount } = brickConf.lifeCycle ?? {};\n\n const { contextNames, stateNames } = getTracks(dataSource);\n if (contextNames || stateNames) {\n controlledOutput.hasTrackingControls = true;\n let renderId = 0;\n const listener = async () => {\n const currentRenderId = ++renderId;\n const [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope] =\n createScopedRuntimeContext(runtimeContext);\n\n const reControlledOutput =\n await renderControlNode(scopedRuntimeContext);\n\n const scopedStores = [...tplStateStoreScope, ...formStateStoreScope];\n await postAsyncRender(\n reControlledOutput,\n scopedRuntimeContext,\n scopedStores\n );\n\n // Ignore stale renders\n if (renderId === currentRenderId) {\n if (onUnmount) {\n listenerFactory(\n onUnmount,\n runtimeContext\n )(new CustomEvent(\"unmount\", { detail: { rerender: true } }));\n }\n\n rendererContext.reRender(\n slotId,\n keyPath,\n reControlledOutput.node,\n returnNode\n );\n\n if (onMount) {\n listenerFactory(\n onMount,\n scopedRuntimeContext\n )(new CustomEvent(\"mount\", { detail: { rerender: true } }));\n }\n\n for (const store of scopedStores) {\n store.mountAsyncData();\n }\n }\n };\n const debouncedListener = debounce(listener);\n if (contextNames) {\n for (const contextName of contextNames) {\n runtimeContext.ctxStore.onChange(contextName, debouncedListener);\n }\n }\n if (stateNames) {\n for (const contextName of stateNames) {\n const tplStateStore = getTplStateStore(\n runtimeContext,\n \"STATE\",\n `: \"${dataSource}\"`\n );\n tplStateStore.onChange(contextName, debouncedListener);\n }\n }\n }\n\n if (onMount) {\n rendererContext.registerArbitraryLifeCycle(\"onMount\", () => {\n listenerFactory(\n onMount,\n runtimeContext\n )(new CustomEvent(\"mount\", { detail: { rerender: false } }));\n });\n }\n\n if (onUnmount) {\n rendererContext.registerArbitraryLifeCycle(\"onUnmount\", () => {\n listenerFactory(\n onUnmount,\n runtimeContext\n )(new CustomEvent(\"unmount\", { detail: { rerender: false } }));\n });\n }\n\n return controlledOutput;\n }\n\n // Widgets need to be defined before rendering.\n if (/\\.tpl-/.test(brickName) && !customTemplates.get(brickName)) {\n await catchLoad(\n loadBricksImperatively([brickName], getBrickPackages()),\n \"brick\",\n brickName,\n rendererContext.unknownBricks\n );\n }\n\n const tplTagName = getTagNameOfCustomTemplate(\n brickName,\n runtimeContext.app?.id\n );\n\n if (tplTagName) {\n const tplCount = tplStack.get(tplTagName) ?? 0;\n if (tplCount >= 10) {\n throw new Error(\n `Maximum custom template stack overflowed: \"${tplTagName}\"`\n );\n }\n tplStack.set(tplTagName, tplCount + 1);\n } else if (brickName.includes(\"-\") && !customElements.get(brickName)) {\n if (brickName === FORM_RENDERER) {\n customElements.define(\n FORM_RENDERER,\n class FormRendererElement extends HTMLElement {\n get $$typeof(): string {\n return \"form-renderer\";\n }\n }\n );\n } else {\n output.blockingList.push(\n catchLoad(\n enqueueStableLoadBricks([brickName], getBrickPackages()),\n \"brick\",\n brickName,\n rendererContext.unknownBricks\n )\n );\n }\n }\n\n let formData: unknown;\n let confProps: Record<string, unknown> | undefined;\n if (brickName === FORM_RENDERER) {\n ({ formData, ...confProps } = brickConf.properties ?? {});\n } else {\n confProps = brickConf.properties;\n }\n\n const trackingContextList: TrackingContextItem[] = [];\n const asyncPropertyEntries = asyncComputeRealPropertyEntries(\n confProps,\n runtimeContext,\n trackingContextList\n );\n\n const computedPropsFromHost = brickConf[symbolForAsyncComputedPropsFromHost];\n if (computedPropsFromHost) {\n asyncPropertyEntries.push(...computedPropsFromHost);\n }\n\n const isScript = brickName === \"script\";\n if (isScript || brickName === \"link\") {\n const props = await constructAsyncProperties(asyncPropertyEntries);\n if (isScript ? props.src : props.rel === \"stylesheet\" && props.href) {\n const prefix = window.PUBLIC_ROOT ?? \"\";\n if (isScript) {\n const { src, ...attrs } = props;\n await catchLoad(\n loadScript(src as string, prefix, attrs),\n \"script\",\n src as string,\n \"silent\"\n );\n } else {\n const { href, ...attrs } = props;\n await catchLoad(\n loadStyle(href as string, prefix, attrs),\n \"stylesheet\",\n href as string,\n \"silent\"\n );\n }\n return output;\n }\n }\n\n const brick: RenderBrick = {\n tag: RenderTag.BRICK,\n type: tplTagName || brickName,\n return: returnNode,\n slotId,\n events: brickConf.events,\n runtimeContext,\n portal: brickConf.portal,\n iid: brickConf.iid,\n ref: (brickConf as BrickConfInTemplate).ref,\n };\n\n output.node = brick;\n\n // 在最终挂载前,先加载所有可能用到的 processors。\n const usedProcessors = strictCollectMemberUsage(\n [brickConf.events, brickConf.lifeCycle],\n \"PROCESSORS\",\n 2\n );\n if (usedProcessors.size > 0) {\n output.blockingList.push(\n catchLoad(\n loadProcessorsImperatively(usedProcessors, getBrickPackages()),\n \"processors\",\n [...usedProcessors].join(\", \"),\n rendererContext.unknownBricks\n )\n );\n }\n\n // 加载构件属性和加载子构件等任务,可以并行。\n const blockingList: Promise<unknown>[] = [];\n\n const loadProperties = async () => {\n brick.properties = await constructAsyncProperties(asyncPropertyEntries);\n listenOnTrackingContext(brick, trackingContextList);\n };\n blockingList.push(loadProperties());\n\n rendererContext.registerBrickLifeCycle(brick, brickConf.lifeCycle);\n\n let expandedBrickConf = brickConf;\n if (tplTagName) {\n expandedBrickConf = expandCustomTemplate(\n tplTagName,\n brickConf,\n brick,\n asyncPropertyEntries,\n rendererContext\n );\n } else if (brickName === FORM_RENDERER) {\n expandedBrickConf = expandFormRenderer(\n formData,\n brickConf,\n brick,\n asyncPropertyEntries,\n rendererContext\n );\n }\n\n if (expandedBrickConf.portal) {\n // A portal brick has no slotId.\n brick.slotId = undefined;\n }\n\n let childRuntimeContext: RuntimeContext;\n if (tplTagName) {\n // There is a boundary for `forEachItem` between template internals and externals.\n childRuntimeContext = {\n ...runtimeContext,\n };\n delete childRuntimeContext.forEachItem;\n delete childRuntimeContext.forEachIndex;\n } else {\n childRuntimeContext = runtimeContext;\n }\n\n const loadChildren = async () => {\n const slots = childrenToSlots(\n expandedBrickConf.children,\n expandedBrickConf.slots\n );\n if (!slots) {\n return;\n }\n const routeSlotIndexes = new Set<number>();\n const rendered = await Promise.all(\n Object.entries(slots).map(([childSlotId, slotConf], index) => {\n if (slotConf.type !== \"routes\") {\n return renderBricks(\n brick,\n (slotConf as SlotConfOfBricks).bricks,\n childRuntimeContext,\n rendererContext,\n parentRoutes,\n childSlotId,\n tplStack\n );\n }\n\n if (runtimeContext.flags[\"incremental-sub-route-rendering\"]) {\n routeSlotIndexes.add(index);\n rendererContext.performIncrementalRender(async (location) => {\n const { homepage } = childRuntimeContext.app;\n const { pathname } = location;\n // Ignore if any one of homepage and parent routes not matched.\n if (\n !matchHomepage(homepage, pathname) ||\n !parentRoutes.every((route) =>\n matchRoute(route, homepage, pathname)\n )\n ) {\n return false;\n }\n\n const [\n scopedRuntimeContext,\n tplStateStoreScope,\n formStateStoreScope,\n ] = createScopedRuntimeContext({\n ...childRuntimeContext,\n location,\n query: new URLSearchParams(location.search),\n });\n\n let failed = false;\n let incrementalOutput: RenderOutput;\n let scopedStores: DataStore<\"STATE\" | \"FORM_STATE\">[] = [];\n\n try {\n incrementalOutput = await renderRoutes(\n brick,\n slotConf.routes,\n scopedRuntimeContext,\n rendererContext,\n parentRoutes,\n childSlotId,\n true\n );\n\n // If all sub-routes are missed, ignore incremental rendering\n if (!incrementalOutput.route) {\n return false;\n }\n\n // Bailout if redirect or unauthenticated is set\n if (rendererContext.reBailout(incrementalOutput)) {\n return true;\n }\n\n scopedStores = [...tplStateStoreScope, ...formStateStoreScope];\n await postAsyncRender(incrementalOutput, scopedRuntimeContext, [\n scopedRuntimeContext.ctxStore,\n ...scopedStores,\n ]);\n\n await rendererContext.reMergeMenuRequests(\n slotConf.routes,\n incrementalOutput.route,\n incrementalOutput.menuRequests\n );\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Incremental sub-router failed:\", error);\n\n const result = rendererContext.reCatch(error, brick);\n if (!result) {\n return true;\n }\n ({ failed, output: incrementalOutput } = result);\n\n // Assert: no errors will be throw\n await rendererContext.reMergeMenuRequests(\n slotConf.routes,\n incrementalOutput.route,\n incrementalOutput.menuRequests\n );\n }\n\n rendererContext.reRender(\n childSlotId,\n [],\n incrementalOutput.node,\n brick\n );\n\n if (!failed) {\n scopedRuntimeContext.ctxStore.mountAsyncData(\n incrementalOutput.route\n );\n for (const store of scopedStores) {\n store.mountAsyncData();\n }\n }\n\n return true;\n });\n }\n\n return renderRoutes(\n brick,\n slotConf.routes,\n childRuntimeContext,\n rendererContext,\n parentRoutes,\n childSlotId\n );\n })\n );\n\n const childrenOutput: RenderOutput = {\n ...output,\n node: undefined,\n blockingList: [],\n menuRequests: [],\n };\n rendered.forEach((item, index) => {\n if (routeSlotIndexes.has(index)) {\n // Memoize a render node before it's been merged.\n rendererContext.memoize(slotId, [], item.node, brick);\n }\n mergeRenderOutput(childrenOutput, item);\n });\n if (childrenOutput.node) {\n brick.child = childrenOutput.node;\n }\n mergeRenderOutput(output, {\n ...childrenOutput,\n node: undefined,\n });\n };\n blockingList.push(loadChildren());\n\n await Promise.all(blockingList);\n\n return output;\n}\n\nfunction isGeneralizedTrackAll(brickIf: unknown): boolean {\n return typeof brickIf === \"string\"\n ? isTrackAll(brickIf)\n : isPreEvaluated(brickIf) &&\n // istanbul ignore next: covered by e2e tests\n isTrackAll(getPreEvaluatedRaw(brickIf));\n}\n\ntype ValidControlBrick = \":forEach\" | \":if\" | \":switch\";\n\nfunction ensureValidControlBrick(\n brick: string\n): asserts brick is ValidControlBrick {\n if (brick !== \":forEach\" && brick !== \":if\" && brick !== \":switch\") {\n throw new Error(`Unknown storyboard control node: \"${brick}\"`);\n }\n}\n\nasync function renderForEach(\n returnNode: RenderReturnNode,\n dataSource: unknown[],\n bricks: BrickConf[],\n runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n slotId: string | undefined,\n tplStack: Map<string, number>,\n keyPath: number[]\n): Promise<RenderOutput> {\n const output = getEmptyRenderOutput();\n\n const rows = dataSource.length;\n const rendered = await Promise.all(\n dataSource.map((item, i) =>\n Promise.all(\n bricks.map((brickConf, j) =>\n renderBrick(\n returnNode,\n brickConf,\n {\n ...runtimeContext,\n forEachItem: item,\n forEachIndex: i,\n },\n rendererContext,\n parentRoutes,\n slotId,\n keyPath.concat(i * rows + j),\n tplStack && new Map(tplStack)\n )\n )\n )\n )\n );\n\n // 多层构件并行异步转换,但转换的结果按原顺序串行合并。\n rendered.flat().forEach((item, index) => {\n if (item.hasTrackingControls) {\n // Memoize a render node before it's been merged.\n rendererContext.memoize(\n slotId,\n keyPath.concat(index),\n item.node,\n returnNode\n );\n }\n mergeRenderOutput(output, item);\n });\n\n return output;\n}\n\nexport function getDataStores(runtimeContext: RuntimeContext) {\n return [\n runtimeContext.ctxStore,\n ...runtimeContext.tplStateStoreMap.values(),\n ...runtimeContext.formStateStoreMap.values(),\n ];\n}\n\nexport function postAsyncRender(\n output: RenderOutput,\n runtimeContext: RuntimeContext,\n stores: DataStore<DataStoreType>[]\n) {\n flushStableLoadBricks();\n\n return Promise.all([\n ...output.blockingList,\n ...stores.map((store) => store.waitForAll()),\n ...runtimeContext.pendingPermissionsPreCheck,\n ]);\n}\n\nexport function createScopedRuntimeContext(\n runtimeContext: RuntimeContext\n): [\n scopedRuntimeContext: RuntimeContext,\n tplStateStoreScope: DataStore<\"STATE\">[],\n formStateStoreScope: DataStore<\"FORM_STATE\">[],\n] {\n const tplStateStoreScope: DataStore<\"STATE\">[] = [];\n const formStateStoreScope: DataStore<\"FORM_STATE\">[] = [];\n const scopedRuntimeContext: RuntimeContext = {\n ...runtimeContext,\n tplStateStoreScope,\n formStateStoreScope,\n };\n return [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope];\n}\n\nfunction loadMenu(\n menuConf: MenuConf | undefined,\n runtimeContext: RuntimeContext\n) {\n if (!menuConf) {\n return;\n }\n\n // istanbul ignore next\n if ((menuConf as { type?: \"brick\" }).type === \"brick\") {\n // eslint-disable-next-line no-console\n console.error(\"Set menu with brick is dropped in v3:\", menuConf);\n throw new Error(\"Set menu with brick is dropped in v3\");\n }\n\n // istanbul ignore next\n if (menuConf.type === \"resolve\") {\n // eslint-disable-next-line no-console\n console.warn(\"Set menu with resolve is not supported in v3 yet:\", menuConf);\n return;\n }\n\n return asyncComputeRealValue(\n menuConf,\n runtimeContext\n ) as Promise<StaticMenuConf>;\n}\n\nfunction mergeRenderOutput(\n output: RenderOutput,\n newOutput: RenderOutput\n): void {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { blockingList, node, menuRequests, hasTrackingControls, ...rest } =\n newOutput;\n output.blockingList.push(...blockingList);\n output.menuRequests.push(...menuRequests);\n\n if (node) {\n if (output.node) {\n let last = output.node;\n while (last.sibling) {\n last = last.sibling;\n }\n last.sibling = node;\n } else {\n output.node = node;\n }\n }\n\n Object.assign(output, rest);\n}\n\nfunction getEmptyRenderOutput(): RenderOutput {\n return {\n blockingList: [],\n menuRequests: [],\n };\n}\n\nexport function childrenToSlots(\n children: BrickConf[] | undefined,\n originalSlots: SlotsConf | undefined\n) {\n let newSlots = originalSlots;\n // istanbul ignore next\n if (\n process.env.NODE_ENV === \"development\" &&\n children &&\n !Array.isArray(children)\n ) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Specified brick children but not array:\",\n `<${typeof children}>`,\n children\n );\n }\n if (Array.isArray(children) && !newSlots) {\n newSlots = {};\n for (const child of children) {\n const slot = child.slot ?? \"\";\n if (!hasOwnProperty(newSlots, slot)) {\n newSlots[slot] = {\n type: \"bricks\",\n bricks: [],\n };\n }\n (newSlots[slot] as SlotConfOfBricks).bricks.push(child);\n }\n }\n return newSlots;\n}\n\nfunction catchLoad(\n promise: Promise<unknown>,\n type: \"brick\" | \"processors\" | \"script\" | \"stylesheet\",\n name: string,\n unknownPolicy: RendererContext[\"unknownBricks\"]\n) {\n return unknownPolicy === \"silent\"\n ? promise.catch((e) => {\n // eslint-disable-next-line no-console\n console.error(`Load ${type} \"${name}\" failed:`, e);\n })\n : promise;\n}\n"],"mappings":";;;;;;;;AAUA,SACEA,uBAAuB,EACvBC,qBAAqB,EACrBC,sBAAsB,EACtBC,0BAA0B,EAC1BC,UAAU,EACVC,SAAS,QACJ,mBAAmB;AAC1B,SAASC,UAAU,QAAQ,iBAAiB;AAC5C,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,wBAAwB,QAAQ,6BAA6B;AACtE,SAASC,QAAQ,QAAQ,QAAQ;AACjC,SAASC,iBAAiB,QAAQ,sBAAsB;AACxD,SACEC,+BAA+B,EAC/BC,wBAAwB,QACnB,oCAAoC;AAC3C,SAASC,WAAW,QAAQ,uBAAuB;AACnD,SAASC,qBAAqB,QAAQ,+BAA+B;AACrE,SAEEC,uBAAuB,QAClB,sCAAsC;AAE7C,SAASC,UAAU,EAAEC,WAAW,QAAQ,kBAAkB;AAC1D,SACEC,mCAAmC,EACnCC,gCAAgC,EAChCC,+BAA+B,EAC/BC,wBAAwB,QACnB,gCAAgC;AACvC,SAASC,oBAAoB,QAAQ,2CAA2C;AAQhF,SACEC,0BAA0B,EAC1BC,gBAAgB,QACX,4BAA4B;AACnC,SAASC,eAAe,QAAQ,uBAAuB;AAEvD,SAASC,gBAAgB,EAAEC,KAAK,QAAQ,cAAc;AACtD,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,OAAO6B,QAAQ;AACjB;AAEA,SAASvG,SAASA,CAChB4G,OAAyB,EACzB3O,IAAsD,EACtD4O,IAAY,EACZC,aAA+C,EAC/C;EACA,OAAOA,aAAa,KAAK,QAAQ,GAC7BF,OAAO,CAACG,KAAK,CAAEC,CAAC,IAAK;IACnB;IACA1O,OAAO,CAACC,KAAK,SAAAnB,MAAA,CAASa,IAAI,SAAAb,MAAA,CAAKyP,IAAI,iBAAaG,CAAC,CAAC;EACpD,CAAC,CAAC,GACFJ,OAAO;AACb"}
|
|
@@ -200,7 +200,6 @@ export class RendererContext {
|
|
|
200
200
|
});
|
|
201
201
|
}
|
|
202
202
|
reRender(slotId, keyPath, node, returnNode) {
|
|
203
|
-
var _prevLastNormal$eleme, _prevLastNormal$eleme2, _prevLastPortal$eleme, _prevLastPortal$eleme2;
|
|
204
203
|
var memKey = [slotId !== null && slotId !== void 0 ? slotId : "", ...keyPath].join(".");
|
|
205
204
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
206
205
|
var memoized = _classPrivateFieldGet(this, _memoized).get(returnNode).get(memKey);
|
|
@@ -210,8 +209,17 @@ export class RendererContext {
|
|
|
210
209
|
lastNormal: prevLastNormal,
|
|
211
210
|
lastPortal: prevLastPortal
|
|
212
211
|
} = memoized;
|
|
213
|
-
var insertBeforeChild
|
|
214
|
-
var insertPortalBeforeChild
|
|
212
|
+
var insertBeforeChild;
|
|
213
|
+
var insertPortalBeforeChild;
|
|
214
|
+
if ((prevNode === null || prevNode === void 0 ? void 0 : prevNode.tag) === RenderTag.PLACEHOLDER) {
|
|
215
|
+
var _getNextNormalNode$el, _getNextNormalNode, _getNextPortalNode$el, _getNextPortalNode;
|
|
216
|
+
insertBeforeChild = (_getNextNormalNode$el = (_getNextNormalNode = getNextNormalNode(prevNode)) === null || _getNextNormalNode === void 0 ? void 0 : _getNextNormalNode.element) !== null && _getNextNormalNode$el !== void 0 ? _getNextNormalNode$el : null;
|
|
217
|
+
insertPortalBeforeChild = (_getNextPortalNode$el = (_getNextPortalNode = getNextPortalNode(prevNode)) === null || _getNextPortalNode === void 0 ? void 0 : _getNextPortalNode.element) !== null && _getNextPortalNode$el !== void 0 ? _getNextPortalNode$el : null;
|
|
218
|
+
} else {
|
|
219
|
+
var _prevLastNormal$eleme, _prevLastNormal$eleme2, _prevLastPortal$eleme, _prevLastPortal$eleme2;
|
|
220
|
+
insertBeforeChild = (_prevLastNormal$eleme = prevLastNormal === null || prevLastNormal === void 0 || (_prevLastNormal$eleme2 = prevLastNormal.element) === null || _prevLastNormal$eleme2 === void 0 ? void 0 : _prevLastNormal$eleme2.nextSibling) !== null && _prevLastNormal$eleme !== void 0 ? _prevLastNormal$eleme : null;
|
|
221
|
+
insertPortalBeforeChild = (_prevLastPortal$eleme = prevLastPortal === null || prevLastPortal === void 0 || (_prevLastPortal$eleme2 = prevLastPortal.element) === null || _prevLastPortal$eleme2 === void 0 ? void 0 : _prevLastPortal$eleme2.nextSibling) !== null && _prevLastPortal$eleme !== void 0 ? _prevLastPortal$eleme : null;
|
|
222
|
+
}
|
|
215
223
|
var last = getLastNode(node);
|
|
216
224
|
memoized.node = node;
|
|
217
225
|
memoized.last = last;
|
|
@@ -278,8 +286,9 @@ export class RendererContext {
|
|
|
278
286
|
while (root && root.return) {
|
|
279
287
|
root = root.return;
|
|
280
288
|
}
|
|
289
|
+
// istanbul ignore next
|
|
281
290
|
if (((_root = root) === null || _root === void 0 ? void 0 : _root.tag) !== RenderTag.ROOT) {
|
|
282
|
-
throw new Error("Cannot find render root node");
|
|
291
|
+
throw new Error("Cannot find render root node. This is a bug of Brick Next, please report it.");
|
|
283
292
|
}
|
|
284
293
|
var portal = typeof root.createPortal === "function" ? root.createPortal() : root.createPortal;
|
|
285
294
|
portal.insertBefore(portalFragment, insertPortalBeforeChild);
|
|
@@ -496,10 +505,19 @@ function getLastNode(node) {
|
|
|
496
505
|
return last;
|
|
497
506
|
}
|
|
498
507
|
function getLastNormalNode(node) {
|
|
508
|
+
return getSpecifiedNormalNode(node, false);
|
|
509
|
+
}
|
|
510
|
+
function getNextNormalNode(node) {
|
|
511
|
+
return getSpecifiedNormalNode(node, true);
|
|
512
|
+
}
|
|
513
|
+
function getSpecifiedNormalNode(node, next) {
|
|
499
514
|
var last;
|
|
500
515
|
var current = node;
|
|
501
516
|
while (current) {
|
|
502
|
-
if (!current.portal) {
|
|
517
|
+
if (current.tag === RenderTag.BRICK && !current.portal) {
|
|
518
|
+
if (next) {
|
|
519
|
+
return current;
|
|
520
|
+
}
|
|
503
521
|
last = current;
|
|
504
522
|
}
|
|
505
523
|
current = current.sibling;
|
|
@@ -507,10 +525,19 @@ function getLastNormalNode(node) {
|
|
|
507
525
|
return last;
|
|
508
526
|
}
|
|
509
527
|
function getLastPortalNode(node) {
|
|
528
|
+
return getSpecifiedPortalNode(node, false);
|
|
529
|
+
}
|
|
530
|
+
function getNextPortalNode(node) {
|
|
531
|
+
return getSpecifiedPortalNode(node, true);
|
|
532
|
+
}
|
|
533
|
+
function getSpecifiedPortalNode(node, next) {
|
|
510
534
|
var last;
|
|
511
535
|
var current = node;
|
|
512
536
|
while (current) {
|
|
513
|
-
if (current.portal) {
|
|
537
|
+
if (current.tag === RenderTag.BRICK && current.portal) {
|
|
538
|
+
if (next) {
|
|
539
|
+
return current;
|
|
540
|
+
}
|
|
514
541
|
last = current;
|
|
515
542
|
}
|
|
516
543
|
if (current.child) {
|
|
@@ -535,7 +562,9 @@ function getBrickRange(from, to) {
|
|
|
535
562
|
var range = new Set();
|
|
536
563
|
var current = from;
|
|
537
564
|
while (current) {
|
|
538
|
-
|
|
565
|
+
if (current.tag === RenderTag.BRICK) {
|
|
566
|
+
range.add(current);
|
|
567
|
+
}
|
|
539
568
|
if (current.child) {
|
|
540
569
|
current = current.child;
|
|
541
570
|
} else if (current === to) {
|