@next-core/runtime 1.29.1 → 1.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/internal/Renderer.js +9 -3
- package/dist/cjs/internal/Renderer.js.map +1 -1
- package/dist/cjs/internal/RendererContext.js +41 -37
- package/dist/cjs/internal/RendererContext.js.map +1 -1
- package/dist/cjs/internal/Router.js +2 -2
- package/dist/cjs/internal/Router.js.map +1 -1
- package/dist/cjs/internal/bindListeners.js +3 -0
- package/dist/cjs/internal/bindListeners.js.map +1 -1
- package/dist/cjs/internal/historyExtended.js +3 -1
- package/dist/cjs/internal/historyExtended.js.map +1 -1
- package/dist/esm/internal/Renderer.js +10 -4
- package/dist/esm/internal/Renderer.js.map +1 -1
- package/dist/esm/internal/RendererContext.js +6 -2
- package/dist/esm/internal/RendererContext.js.map +1 -1
- package/dist/esm/internal/Router.js +2 -2
- package/dist/esm/internal/Router.js.map +1 -1
- package/dist/esm/internal/bindListeners.js +3 -0
- package/dist/esm/internal/bindListeners.js.map +1 -1
- package/dist/esm/internal/historyExtended.js +3 -1
- package/dist/esm/internal/historyExtended.js.map +1 -1
- package/dist/types/internal/historyExtended.d.ts +1 -0
- package/package.json +6 -6
|
@@ -427,21 +427,27 @@ async function renderBrick(returnNode, brickConf, _runtimeContext, rendererConte
|
|
|
427
427
|
}
|
|
428
428
|
const routeSlotIndexes = new Set();
|
|
429
429
|
const rendered = await Promise.all(Object.entries(slots).map(([childSlotId, slotConf], index) => {
|
|
430
|
-
var _parentRoutes;
|
|
431
430
|
if (slotConf.type !== "routes") {
|
|
432
431
|
return renderBricks(brick, slotConf.bricks, childRuntimeContext, rendererContext, parentRoutes, childSlotId, tplStack);
|
|
433
432
|
}
|
|
434
|
-
|
|
433
|
+
const parentRoute = parentRoutes[parentRoutes.length - 1];
|
|
434
|
+
if (parentRoute !== null && parentRoute !== void 0 && parentRoute.incrementalSubRoutes) {
|
|
435
435
|
routeSlotIndexes.add(index);
|
|
436
436
|
rendererContext.performIncrementalRender(async location => {
|
|
437
|
+
var _childRuntimeContext$;
|
|
437
438
|
const {
|
|
438
439
|
homepage
|
|
439
440
|
} = childRuntimeContext.app;
|
|
440
441
|
const {
|
|
441
442
|
pathname
|
|
442
443
|
} = location;
|
|
444
|
+
const previousParams = (_childRuntimeContext$ = childRuntimeContext.match) === null || _childRuntimeContext$ === void 0 ? void 0 : _childRuntimeContext$.params;
|
|
443
445
|
// Ignore if any one of homepage and parent routes not matched.
|
|
444
|
-
if (!(0, _matchStoryboard.matchHomepage)(homepage, pathname) || !parentRoutes.every(route =>
|
|
446
|
+
if (!(0, _matchStoryboard.matchHomepage)(homepage, pathname) || !parentRoutes.every(route => {
|
|
447
|
+
const newMatch = (0, _matchRoutes.matchRoute)(route, homepage, pathname);
|
|
448
|
+
// Ignore if the direct parent route params changed
|
|
449
|
+
return newMatch && (route !== parentRoute || (0, _lodash.isEqual)(previousParams, newMatch.params));
|
|
450
|
+
})) {
|
|
445
451
|
return false;
|
|
446
452
|
}
|
|
447
453
|
const [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope] = createScopedRuntimeContext({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Renderer.js","names":["_loader","require","_cook","_general","_storyboard","_lodash","_checkIf","_computeRealProperties","_resolveData","_computeRealValue","_listenOnTrackingContext","_matchRoutes","_constants","_expandCustomTemplate","_utils","_CustomTemplates","_Runtime","_enums","_getTracks","_isStrictMode","_constants2","_expandFormRenderer","_evaluate","_matchStoryboard","_bindListeners","renderRoutes","returnNode","routes","_runtimeContext","rendererContext","parentRoutes","slotId","isIncremental","matched","matchRoutes","output","getEmptyRenderOutput","unauthenticated","_hooks$checkPermissio","route","path","match","runtimeContext","ctxStore","disposeDataInRoutes","routePath","concat","define","context","undefined","pendingPermissionsPreCheck","push","hooks","checkPermissions","preCheckPermissionsForBrickOrRoute","value","asyncComputeRealValue","preLoadBricks","Array","isArray","blockingList","loadBricksImperatively","getBrickPackages","type","redirectTo","redirect","resolved","resolveData","transform","console","error","Error","menuRequest","loadMenu","menu","menuRequests","newOutput","mergeRenderOutput","renderBricks","bricks","tag","RenderTag","BRICK","memoizeMenuRequests","tplStack","keyPath","kPath","rendered","Promise","all","map","brickConf","index","renderBrick","Map","forEach","item","hasTrackingControls","memoize","node","_hooks$checkPermissio2","_runtimeContext$app","brick","template","if","brickIf","permissionsPreCheck","restBrickConf","isGeneralizedTrackAll","dataSource","slots","Object","getOwnPropertySymbols","reduce","acc","symbol","tplStateStoreId","symbolForTplStateStoreId","formStateStoreId","symbolForFormStateStoreId","hasOwnProperty","symbolForTPlExternalForEachItem","forEachItem","forEachIndex","symbolForTPlExternalForEachIndex","length","strict","isStrictMode","warnAboutStrictMode","asyncCheckBrickIf","brickName","startsWith","_brickConf$lifeCycle","ensureValidControlBrick","lowerLevelRenderControlNode","_slots$slot","computedDataSource","slot","String","childrenToSlots","children","renderForEach","renderControlNode","_rawOutput$node","rawOutput","PLACEHOLDER","return","controlledOutput","onMount","onUnmount","lifeCycle","contextNames","stateNames","getTracks","renderId","listener","currentRenderId","scopedRuntimeContext","tplStateStoreScope","formStateStoreScope","createScopedRuntimeContext","reControlledOutput","scopedStores","postAsyncRender","listenerFactory","CustomEvent","detail","rerender","reRender","store","mountAsyncData","debouncedListener","debounce","contextName","onChange","tplStateStore","getTplStateStore","registerArbitraryLifeCycle","test","customTemplates","get","catchLoad","unknownBricks","tplTagName","getTagNameOfCustomTemplate","app","id","_tplStack$get","tplCount","set","includes","customElements","FORM_RENDERER","FormRendererElement","HTMLElement","$$typeof","enqueueStableLoadBricks","formData","confProps","_brickConf$properties","properties","trackingContextList","asyncPropertyEntries","asyncComputeRealPropertyEntries","computedPropsFromHost","symbolForAsyncComputedPropsFromHost","isScript","props","constructAsyncProperties","src","rel","href","_window$PUBLIC_ROOT","prefix","window","PUBLIC_ROOT","attrs","loadScript","loadStyle","events","portal","iid","ref","usedProcessors","strictCollectMemberUsage","size","loadProcessorsImperatively","join","loadProperties","listenOnTrackingContext","registerBrickLifeCycle","expandedBrickConf","expandCustomTemplate","expandFormRenderer","childRuntimeContext","loadChildren","routeSlotIndexes","Set","entries","childSlotId","slotConf","_parentRoutes","incrementalSubRoutes","add","performIncrementalRender","location","homepage","pathname","matchHomepage","every","matchRoute","query","URLSearchParams","search","failed","incrementalOutput","reBailout","reMergeMenuRequests","result","reCatch","childrenOutput","has","child","isTrackAll","isPreEvaluated","getPreEvaluatedRaw","rows","i","j","flat","getDataStores","tplStateStoreMap","values","formStateStoreMap","stores","flushStableLoadBricks","waitForAll","menuConf","warn","rest","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 RouteConfOfBricks,\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 path?: string;\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 output.path = matched.match.path;\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 (\n (parentRoutes[parentRoutes.length - 1] as RouteConfOfBricks)\n ?.incrementalSubRoutes\n ) {\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 // Do not ignore incremental rendering even if all sub-routes are missed.\n // Since parent route is matched.\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 %s \"%s\" failed:`, type, name, e);\n })\n : promise;\n}\n"],"mappings":";;;;;;;;;;;;AAWA,IAAAA,OAAA,GAAAC,OAAA;AAQA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,sBAAA,GAAAN,OAAA;AAIA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,iBAAA,GAAAR,OAAA;AACA,IAAAS,wBAAA,GAAAT,OAAA;AAKA,IAAAU,YAAA,GAAAV,OAAA;AACA,IAAAW,UAAA,GAAAX,OAAA;AAMA,IAAAY,qBAAA,GAAAZ,OAAA;AAQA,IAAAa,MAAA,GAAAb,OAAA;AAIA,IAAAc,gBAAA,GAAAd,OAAA;AAEA,IAAAe,QAAA,GAAAf,OAAA;AACA,IAAAgB,MAAA,GAAAhB,OAAA;AACA,IAAAiB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EAAE;MAC7B,IAAI,CAAC,IAAAxK,uBAAc,EAACoK,QAAQ,EAAEnJ,IAAI,CAAC,EAAE;QACnCmJ,QAAQ,CAACnJ,IAAI,CAAC,GAAG;UACf1E,IAAI,EAAE,QAAQ;UACdgB,MAAM,EAAE;QACV,CAAC;MACH;MACC6M,QAAQ,CAACnJ,IAAI,CAAC,CAAsB1D,MAAM,CAAC5B,IAAI,CAACmN,KAAK,CAAC;IACzD;EACF;EACA,OAAOsB,QAAQ;AACjB;AAEA,SAASvG,SAASA,CAChB4G,OAAyB,EACzBlO,IAAsD,EACtDmO,IAAY,EACZC,aAA+C,EAC/C;EACA,OAAOA,aAAa,KAAK,QAAQ,GAC7BF,OAAO,CAACG,KAAK,CAAEC,CAAC,IAAK;IACnB;IACAhO,OAAO,CAACC,KAAK,CAAE,sBAAqB,EAAEP,IAAI,EAAEmO,IAAI,EAAEG,CAAC,CAAC;EACtD,CAAC,CAAC,GACFJ,OAAO;AACb"}
|
|
1
|
+
{"version":3,"file":"Renderer.js","names":["_loader","require","_cook","_general","_storyboard","_lodash","_checkIf","_computeRealProperties","_resolveData","_computeRealValue","_listenOnTrackingContext","_matchRoutes","_constants","_expandCustomTemplate","_utils","_CustomTemplates","_Runtime","_enums","_getTracks","_isStrictMode","_constants2","_expandFormRenderer","_evaluate","_matchStoryboard","_bindListeners","renderRoutes","returnNode","routes","_runtimeContext","rendererContext","parentRoutes","slotId","isIncremental","matched","matchRoutes","output","getEmptyRenderOutput","unauthenticated","_hooks$checkPermissio","route","path","match","runtimeContext","ctxStore","disposeDataInRoutes","routePath","concat","define","context","undefined","pendingPermissionsPreCheck","push","hooks","checkPermissions","preCheckPermissionsForBrickOrRoute","value","asyncComputeRealValue","preLoadBricks","Array","isArray","blockingList","loadBricksImperatively","getBrickPackages","type","redirectTo","redirect","resolved","resolveData","transform","console","error","Error","menuRequest","loadMenu","menu","menuRequests","newOutput","mergeRenderOutput","renderBricks","bricks","tag","RenderTag","BRICK","memoizeMenuRequests","tplStack","keyPath","kPath","rendered","Promise","all","map","brickConf","index","renderBrick","Map","forEach","item","hasTrackingControls","memoize","node","_hooks$checkPermissio2","_runtimeContext$app","brick","template","if","brickIf","permissionsPreCheck","restBrickConf","isGeneralizedTrackAll","dataSource","slots","Object","getOwnPropertySymbols","reduce","acc","symbol","tplStateStoreId","symbolForTplStateStoreId","formStateStoreId","symbolForFormStateStoreId","hasOwnProperty","symbolForTPlExternalForEachItem","forEachItem","forEachIndex","symbolForTPlExternalForEachIndex","length","strict","isStrictMode","warnAboutStrictMode","asyncCheckBrickIf","brickName","startsWith","_brickConf$lifeCycle","ensureValidControlBrick","lowerLevelRenderControlNode","_slots$slot","computedDataSource","slot","String","childrenToSlots","children","renderForEach","renderControlNode","_rawOutput$node","rawOutput","PLACEHOLDER","return","controlledOutput","onMount","onUnmount","lifeCycle","contextNames","stateNames","getTracks","renderId","listener","currentRenderId","scopedRuntimeContext","tplStateStoreScope","formStateStoreScope","createScopedRuntimeContext","reControlledOutput","scopedStores","postAsyncRender","listenerFactory","CustomEvent","detail","rerender","reRender","store","mountAsyncData","debouncedListener","debounce","contextName","onChange","tplStateStore","getTplStateStore","registerArbitraryLifeCycle","test","customTemplates","get","catchLoad","unknownBricks","tplTagName","getTagNameOfCustomTemplate","app","id","_tplStack$get","tplCount","set","includes","customElements","FORM_RENDERER","FormRendererElement","HTMLElement","$$typeof","enqueueStableLoadBricks","formData","confProps","_brickConf$properties","properties","trackingContextList","asyncPropertyEntries","asyncComputeRealPropertyEntries","computedPropsFromHost","symbolForAsyncComputedPropsFromHost","isScript","props","constructAsyncProperties","src","rel","href","_window$PUBLIC_ROOT","prefix","window","PUBLIC_ROOT","attrs","loadScript","loadStyle","events","portal","iid","ref","usedProcessors","strictCollectMemberUsage","size","loadProcessorsImperatively","join","loadProperties","listenOnTrackingContext","registerBrickLifeCycle","expandedBrickConf","expandCustomTemplate","expandFormRenderer","childRuntimeContext","loadChildren","routeSlotIndexes","Set","entries","childSlotId","slotConf","parentRoute","incrementalSubRoutes","add","performIncrementalRender","location","_childRuntimeContext$","homepage","pathname","previousParams","params","matchHomepage","every","newMatch","matchRoute","isEqual","query","URLSearchParams","search","failed","incrementalOutput","reBailout","reMergeMenuRequests","result","reCatch","childrenOutput","has","child","isTrackAll","isPreEvaluated","getPreEvaluatedRaw","rows","i","j","flat","getDataStores","tplStateStoreMap","values","formStateStoreMap","stores","flushStableLoadBricks","waitForAll","menuConf","warn","rest","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 RouteConfOfBricks,\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, isEqual } 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 path?: string;\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 output.path = matched.match.path;\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 const parentRoute = parentRoutes[parentRoutes.length - 1] as\n | RouteConfOfBricks\n | undefined;\n if (parentRoute?.incrementalSubRoutes) {\n routeSlotIndexes.add(index);\n rendererContext.performIncrementalRender(async (location) => {\n const { homepage } = childRuntimeContext.app;\n const { pathname } = location;\n const previousParams = childRuntimeContext.match?.params;\n // Ignore if any one of homepage and parent routes not matched.\n if (\n !matchHomepage(homepage, pathname) ||\n !parentRoutes.every((route) => {\n const newMatch = matchRoute(route, homepage, pathname);\n // Ignore if the direct parent route params changed\n return (\n newMatch &&\n (route !== parentRoute ||\n isEqual(previousParams, newMatch.params))\n );\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 // Do not ignore incremental rendering even if all sub-routes are missed.\n // Since parent route is matched.\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 %s \"%s\" failed:`, type, name, e);\n })\n : promise;\n}\n"],"mappings":";;;;;;;;;;;;AAWA,IAAAA,OAAA,GAAAC,OAAA;AAQA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,sBAAA,GAAAN,OAAA;AAIA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,iBAAA,GAAAR,OAAA;AACA,IAAAS,wBAAA,GAAAT,OAAA;AAKA,IAAAU,YAAA,GAAAV,OAAA;AACA,IAAAW,UAAA,GAAAX,OAAA;AAMA,IAAAY,qBAAA,GAAAZ,OAAA;AAQA,IAAAa,MAAA,GAAAb,OAAA;AAIA,IAAAc,gBAAA,GAAAd,OAAA;AAEA,IAAAe,QAAA,GAAAf,OAAA;AACA,IAAAgB,MAA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,OAAO/I,QAAS,GAAE,EACtBA,QACF,CAAC;EACH;EACA,IAAIlF,KAAK,CAACC,OAAO,CAACiF,QAAQ,CAAC,IAAI,CAACqJ,QAAQ,EAAE;IACxCA,QAAQ,GAAG,CAAC,CAAC;IACb,KAAK,MAAMtB,KAAK,IAAI/H,QAAQ,EAAE;MAAA,IAAAyJ,WAAA;MAC5B,MAAM5J,IAAI,IAAA4J,WAAA,GAAG1B,KAAK,CAAClI,IAAI,cAAA4J,WAAA,cAAAA,WAAA,GAAI,EAAE;MAC7B,IAAI,CAAC,IAAA7K,uBAAc,EAACyK,QAAQ,EAAExJ,IAAI,CAAC,EAAE;QACnCwJ,QAAQ,CAACxJ,IAAI,CAAC,GAAG;UACf1E,IAAI,EAAE,QAAQ;UACdgB,MAAM,EAAE;QACV,CAAC;MACH;MACCkN,QAAQ,CAACxJ,IAAI,CAAC,CAAsB1D,MAAM,CAAC5B,IAAI,CAACwN,KAAK,CAAC;IACzD;EACF;EACA,OAAOsB,QAAQ;AACjB;AAEA,SAAS5G,SAASA,CAChBiH,OAAyB,EACzBvO,IAAsD,EACtDwO,IAAY,EACZC,aAA+C,EAC/C;EACA,OAAOA,aAAa,KAAK,QAAQ,GAC7BF,OAAO,CAACG,KAAK,CAAEC,CAAC,IAAK;IACnB;IACArO,OAAO,CAACC,KAAK,CAAE,sBAAqB,EAAEP,IAAI,EAAEwO,IAAI,EAAEG,CAAC,CAAC;EACtD,CAAC,CAAC,GACFJ,OAAO;AACb"}
|
|
@@ -9,7 +9,7 @@ var _classPrivateMethodInitSpec2 = _interopRequireDefault(require("@babel/runtim
|
|
|
9
9
|
var _classPrivateFieldInitSpec2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldInitSpec"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _classPrivateMethodGet2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateMethodGet"));
|
|
12
|
-
var
|
|
12
|
+
var _classPrivateFieldGet4 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldGet"));
|
|
13
13
|
var _classPrivateFieldSet2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldSet"));
|
|
14
14
|
var _lodash = require("lodash");
|
|
15
15
|
var _bindListeners = require("./bindListeners.js");
|
|
@@ -108,22 +108,25 @@ class RendererContext {
|
|
|
108
108
|
(0, _classPrivateFieldSet2.default)(this, _allMenuRequests, menuRequests);
|
|
109
109
|
}
|
|
110
110
|
memoizeMenuRequests(route, menuRequests) {
|
|
111
|
-
if (!(0,
|
|
111
|
+
if (!(0, _classPrivateFieldGet4.default)(this, _memoizedMenuRequestMap)) {
|
|
112
112
|
(0, _classPrivateFieldSet2.default)(this, _memoizedMenuRequestMap, new WeakMap());
|
|
113
113
|
}
|
|
114
|
-
(0,
|
|
114
|
+
(0, _classPrivateFieldGet4.default)(this, _memoizedMenuRequestMap).set(route, menuRequests[0]);
|
|
115
115
|
}
|
|
116
116
|
async reMergeMenuRequests(routes, currentRoute, menuRequests) {
|
|
117
117
|
let previousMenuRequest;
|
|
118
118
|
let previousRoute;
|
|
119
119
|
for (const route of routes) {
|
|
120
|
-
|
|
120
|
+
var _classPrivateFieldGet2;
|
|
121
|
+
// If the sub-routes doesn't match, then `this.memoizeMenuRequests` will
|
|
122
|
+
// not be called, thus `this.#memoizedMenuRequestMap` is not set.
|
|
123
|
+
previousMenuRequest = (_classPrivateFieldGet2 = (0, _classPrivateFieldGet4.default)(this, _memoizedMenuRequestMap)) === null || _classPrivateFieldGet2 === void 0 ? void 0 : _classPrivateFieldGet2.get(route);
|
|
121
124
|
if (previousMenuRequest) {
|
|
122
125
|
previousRoute = route;
|
|
123
126
|
break;
|
|
124
127
|
}
|
|
125
128
|
}
|
|
126
|
-
const mergedMenuRequests = (0,
|
|
129
|
+
const mergedMenuRequests = (0, _classPrivateFieldGet4.default)(this, _allMenuRequests);
|
|
127
130
|
const previousIndex = previousMenuRequest ? mergedMenuRequests.indexOf(previousMenuRequest) : -1;
|
|
128
131
|
if (previousIndex === -1) {
|
|
129
132
|
if (!menuRequests.length) {
|
|
@@ -134,18 +137,19 @@ class RendererContext {
|
|
|
134
137
|
mergedMenuRequests.splice(previousIndex, mergedMenuRequests.length - previousIndex, ...menuRequests);
|
|
135
138
|
}
|
|
136
139
|
if (previousRoute && previousRoute !== currentRoute) {
|
|
137
|
-
|
|
140
|
+
var _classPrivateFieldGet3;
|
|
141
|
+
(_classPrivateFieldGet3 = (0, _classPrivateFieldGet4.default)(this, _memoizedMenuRequestMap)) === null || _classPrivateFieldGet3 === void 0 || _classPrivateFieldGet3.delete(previousRoute);
|
|
138
142
|
}
|
|
139
|
-
await (0,
|
|
143
|
+
await (0, _classPrivateFieldGet4.default)(this, _routeHelper).mergeMenus(mergedMenuRequests);
|
|
140
144
|
}
|
|
141
145
|
reBailout(output) {
|
|
142
|
-
return (0,
|
|
146
|
+
return (0, _classPrivateFieldGet4.default)(this, _routeHelper).bailout(output);
|
|
143
147
|
}
|
|
144
148
|
reCatch(error, returnNode) {
|
|
145
|
-
return (0,
|
|
149
|
+
return (0, _classPrivateFieldGet4.default)(this, _routeHelper).catch(error, returnNode);
|
|
146
150
|
}
|
|
147
151
|
async didPerformIncrementalRender(location) {
|
|
148
|
-
const results = await Promise.all((0,
|
|
152
|
+
const results = await Promise.all((0, _classPrivateFieldGet4.default)(this, _locationChangeCallbacks).map(callback => callback(location)));
|
|
149
153
|
return results.some(result => result);
|
|
150
154
|
}
|
|
151
155
|
|
|
@@ -154,7 +158,7 @@ class RendererContext {
|
|
|
154
158
|
* ignore normal rendering.
|
|
155
159
|
*/
|
|
156
160
|
performIncrementalRender(callback) {
|
|
157
|
-
(0,
|
|
161
|
+
(0, _classPrivateFieldGet4.default)(this, _locationChangeCallbacks).push(callback);
|
|
158
162
|
}
|
|
159
163
|
registerBrickLifeCycle(brick, lifeCycle) {
|
|
160
164
|
if (!lifeCycle) {
|
|
@@ -164,7 +168,7 @@ class RendererContext {
|
|
|
164
168
|
for (const key of lifeCycleTypes) {
|
|
165
169
|
const handlers = lifeCycle[key];
|
|
166
170
|
if (handlers) {
|
|
167
|
-
(0,
|
|
171
|
+
(0, _classPrivateFieldGet4.default)(this, _memoizedLifeCycle)[key].push({
|
|
168
172
|
brick,
|
|
169
173
|
handlers: handlers
|
|
170
174
|
});
|
|
@@ -177,22 +181,22 @@ class RendererContext {
|
|
|
177
181
|
}
|
|
178
182
|
}
|
|
179
183
|
registerArbitraryLifeCycle(lifeCycle, fn) {
|
|
180
|
-
const arbitraryCallbacks = (0,
|
|
184
|
+
const arbitraryCallbacks = (0, _classPrivateFieldGet4.default)(this, _arbitraryLifeCycle).get(lifeCycle);
|
|
181
185
|
if (arbitraryCallbacks) {
|
|
182
186
|
arbitraryCallbacks.add(fn);
|
|
183
187
|
} else {
|
|
184
|
-
(0,
|
|
188
|
+
(0, _classPrivateFieldGet4.default)(this, _arbitraryLifeCycle).set(lifeCycle, new Set([fn]));
|
|
185
189
|
}
|
|
186
190
|
}
|
|
187
191
|
memoize(slotId, keyPath, node, returnNode) {
|
|
188
|
-
if (!(0,
|
|
192
|
+
if (!(0, _classPrivateFieldGet4.default)(this, _memoized)) {
|
|
189
193
|
(0, _classPrivateFieldSet2.default)(this, _memoized, new WeakMap());
|
|
190
194
|
}
|
|
191
195
|
const memKey = [slotId !== null && slotId !== void 0 ? slotId : "", ...keyPath].join(".");
|
|
192
|
-
let mem = (0,
|
|
196
|
+
let mem = (0, _classPrivateFieldGet4.default)(this, _memoized).get(returnNode);
|
|
193
197
|
if (!mem) {
|
|
194
198
|
mem = new Map();
|
|
195
|
-
(0,
|
|
199
|
+
(0, _classPrivateFieldGet4.default)(this, _memoized).set(returnNode, mem);
|
|
196
200
|
}
|
|
197
201
|
mem.set(memKey, {
|
|
198
202
|
node,
|
|
@@ -204,7 +208,7 @@ class RendererContext {
|
|
|
204
208
|
reRender(slotId, keyPath, node, returnNode) {
|
|
205
209
|
const memKey = [slotId !== null && slotId !== void 0 ? slotId : "", ...keyPath].join(".");
|
|
206
210
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
207
|
-
const memoized = (0,
|
|
211
|
+
const memoized = (0, _classPrivateFieldGet4.default)(this, _memoized).get(returnNode).get(memKey);
|
|
208
212
|
const {
|
|
209
213
|
node: prevNode,
|
|
210
214
|
last: prevLast,
|
|
@@ -299,25 +303,25 @@ class RendererContext {
|
|
|
299
303
|
(0, _classPrivateMethodGet2.default)(this, _initializeRerenderBricks, _initializeRerenderBricks2).call(this, newBricks);
|
|
300
304
|
}
|
|
301
305
|
dispose() {
|
|
302
|
-
for (const list of Object.values((0,
|
|
306
|
+
for (const list of Object.values((0, _classPrivateFieldGet4.default)(this, _memoizedLifeCycle))) {
|
|
303
307
|
list.length = 0;
|
|
304
308
|
}
|
|
305
|
-
for (const list of (0,
|
|
309
|
+
for (const list of (0, _classPrivateFieldGet4.default)(this, _observers).values()) {
|
|
306
310
|
for (const observer of list) {
|
|
307
311
|
observer.disconnect();
|
|
308
312
|
}
|
|
309
313
|
list.length = 0;
|
|
310
314
|
}
|
|
311
|
-
(0,
|
|
312
|
-
if ((0,
|
|
313
|
-
_mediaQuery.mediaEventTarget.removeEventListener("change", (0,
|
|
315
|
+
(0, _classPrivateFieldGet4.default)(this, _observers).clear();
|
|
316
|
+
if ((0, _classPrivateFieldGet4.default)(this, _mediaListener)) {
|
|
317
|
+
_mediaQuery.mediaEventTarget.removeEventListener("change", (0, _classPrivateFieldGet4.default)(this, _mediaListener));
|
|
314
318
|
(0, _classPrivateFieldSet2.default)(this, _mediaListener, undefined);
|
|
315
319
|
}
|
|
316
320
|
(0, _classPrivateFieldSet2.default)(this, _memoized, undefined);
|
|
317
321
|
(0, _classPrivateFieldSet2.default)(this, _allMenuRequests, undefined);
|
|
318
322
|
(0, _classPrivateFieldSet2.default)(this, _memoizedMenuRequestMap, undefined);
|
|
319
|
-
(0,
|
|
320
|
-
(0,
|
|
323
|
+
(0, _classPrivateFieldGet4.default)(this, _arbitraryLifeCycle).clear();
|
|
324
|
+
(0, _classPrivateFieldGet4.default)(this, _locationChangeCallbacks).length = 0;
|
|
321
325
|
}
|
|
322
326
|
dispatchBeforePageLoad() {
|
|
323
327
|
(0, _classPrivateMethodGet2.default)(this, _dispatchGeneralLifeCycle, _dispatchGeneralLifeCycle2).call(this, "onBeforePageLoad", new CustomEvent("page.beforeLoad"));
|
|
@@ -355,7 +359,7 @@ class RendererContext {
|
|
|
355
359
|
for (const {
|
|
356
360
|
brick,
|
|
357
361
|
handlers: conf
|
|
358
|
-
} of (0,
|
|
362
|
+
} of (0, _classPrivateFieldGet4.default)(this, _memoizedLifeCycle).onScrollIntoView) {
|
|
359
363
|
(0, _classPrivateMethodGet2.default)(this, _addObserver, _addObserver2).call(this, brick, conf);
|
|
360
364
|
}
|
|
361
365
|
}
|
|
@@ -365,14 +369,14 @@ class RendererContext {
|
|
|
365
369
|
detail: (0, _proxyFactories.getReadOnlyProxy)(event.detail)
|
|
366
370
|
}));
|
|
367
371
|
});
|
|
368
|
-
_mediaQuery.mediaEventTarget.addEventListener("change", (0,
|
|
372
|
+
_mediaQuery.mediaEventTarget.addEventListener("change", (0, _classPrivateFieldGet4.default)(this, _mediaListener));
|
|
369
373
|
}
|
|
370
374
|
initializeMessageDispatcher() {
|
|
371
375
|
var _hooks$messageDispatc2;
|
|
372
376
|
for (const {
|
|
373
377
|
brick,
|
|
374
378
|
handlers: confList
|
|
375
|
-
} of (0,
|
|
379
|
+
} of (0, _classPrivateFieldGet4.default)(this, _memoizedLifeCycle).onMessage) {
|
|
376
380
|
for (const conf of [].concat(confList)) {
|
|
377
381
|
var _hooks$messageDispatc;
|
|
378
382
|
_Runtime.hooks === null || _Runtime.hooks === void 0 || (_hooks$messageDispatc = _Runtime.hooks.messageDispatcher) === null || _hooks$messageDispatc === void 0 || _hooks$messageDispatc.onMessage(conf.channel, detail => {
|
|
@@ -400,7 +404,7 @@ function _unmountBricks2(bricks) {
|
|
|
400
404
|
|
|
401
405
|
// Clear life cycle handlers, record `onUnmount` at the same time
|
|
402
406
|
for (const key of lifeCycleTypes) {
|
|
403
|
-
const removed = (0, _lodash.remove)((0,
|
|
407
|
+
const removed = (0, _lodash.remove)((0, _classPrivateFieldGet4.default)(this, _memoizedLifeCycle)[key], item => bricks.has(item.brick));
|
|
404
408
|
if (key === "onUnmount") {
|
|
405
409
|
unmountList.push(...removed);
|
|
406
410
|
}
|
|
@@ -409,13 +413,13 @@ function _unmountBricks2(bricks) {
|
|
|
409
413
|
// Clear intersection observers
|
|
410
414
|
for (const brick of bricks) {
|
|
411
415
|
var _brick$element, _brick$element2;
|
|
412
|
-
const observers = (0,
|
|
416
|
+
const observers = (0, _classPrivateFieldGet4.default)(this, _observers).get(brick);
|
|
413
417
|
if (observers !== null && observers !== void 0 && observers.length) {
|
|
414
418
|
for (const observer of observers) {
|
|
415
419
|
observer.disconnect();
|
|
416
420
|
}
|
|
417
421
|
observers.length = 0;
|
|
418
|
-
(0,
|
|
422
|
+
(0, _classPrivateFieldGet4.default)(this, _observers).delete(brick);
|
|
419
423
|
}
|
|
420
424
|
(0, _bindTemplateProxy.unbindTemplateProxy)(brick);
|
|
421
425
|
(_brick$element = brick.element) === null || _brick$element === void 0 || delete _brick$element.$$tplStateStore;
|
|
@@ -438,7 +442,7 @@ function _initializeRerenderBricks2(bricks) {
|
|
|
438
442
|
for (const {
|
|
439
443
|
brick,
|
|
440
444
|
handlers
|
|
441
|
-
} of (0,
|
|
445
|
+
} of (0, _classPrivateFieldGet4.default)(this, _memoizedLifeCycle).onMount) {
|
|
442
446
|
if (bricks.has(brick)) {
|
|
443
447
|
(0, _bindListeners.listenerFactory)(handlers, brick.runtimeContext, brick)(mountEvent);
|
|
444
448
|
}
|
|
@@ -446,7 +450,7 @@ function _initializeRerenderBricks2(bricks) {
|
|
|
446
450
|
for (const {
|
|
447
451
|
brick,
|
|
448
452
|
handlers: conf
|
|
449
|
-
} of (0,
|
|
453
|
+
} of (0, _classPrivateFieldGet4.default)(this, _memoizedLifeCycle).onScrollIntoView) {
|
|
450
454
|
if (bricks.has(brick)) {
|
|
451
455
|
(0, _classPrivateMethodGet2.default)(this, _addObserver, _addObserver2).call(this, brick, conf);
|
|
452
456
|
}
|
|
@@ -460,10 +464,10 @@ function _dispatchGeneralLifeCycle2(type, event) {
|
|
|
460
464
|
for (const {
|
|
461
465
|
brick,
|
|
462
466
|
handlers
|
|
463
|
-
} of (0,
|
|
467
|
+
} of (0, _classPrivateFieldGet4.default)(this, _memoizedLifeCycle)[type]) {
|
|
464
468
|
(0, _bindListeners.listenerFactory)(handlers, brick.runtimeContext, brick)(event);
|
|
465
469
|
}
|
|
466
|
-
const arbitraryCallbacks = (0,
|
|
470
|
+
const arbitraryCallbacks = (0, _classPrivateFieldGet4.default)(this, _arbitraryLifeCycle).get(type);
|
|
467
471
|
if (arbitraryCallbacks) {
|
|
468
472
|
for (const fn of arbitraryCallbacks) {
|
|
469
473
|
fn();
|
|
@@ -486,10 +490,10 @@ function _addObserver2(brick, conf) {
|
|
|
486
490
|
threshold
|
|
487
491
|
});
|
|
488
492
|
observer.observe(brick.element);
|
|
489
|
-
let list = (0,
|
|
493
|
+
let list = (0, _classPrivateFieldGet4.default)(this, _observers).get(brick);
|
|
490
494
|
if (!list) {
|
|
491
495
|
list = [];
|
|
492
|
-
(0,
|
|
496
|
+
(0, _classPrivateFieldGet4.default)(this, _observers).set(brick, list);
|
|
493
497
|
}
|
|
494
498
|
list.push(observer);
|
|
495
499
|
}
|