@next-core/runtime 1.47.0 → 1.49.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/StoryboardFunctionRegistry.js +34 -9
- package/dist/cjs/StoryboardFunctionRegistry.js.map +1 -1
- package/dist/cjs/internal/Renderer.js +4 -0
- package/dist/cjs/internal/Renderer.js.map +1 -1
- package/dist/cjs/internal/Router.js +2 -0
- package/dist/cjs/internal/Router.js.map +1 -1
- package/dist/cjs/internal/interfaces.js.map +1 -1
- package/dist/cjs/internal/routeMatchedMap.js +19 -0
- package/dist/cjs/internal/routeMatchedMap.js.map +1 -0
- package/dist/cjs/internal/secret_internals.js +15 -2
- package/dist/cjs/internal/secret_internals.js.map +1 -1
- package/dist/esm/StoryboardFunctionRegistry.js +34 -9
- package/dist/esm/StoryboardFunctionRegistry.js.map +1 -1
- package/dist/esm/internal/Renderer.js +4 -0
- package/dist/esm/internal/Renderer.js.map +1 -1
- package/dist/esm/internal/Router.js +2 -0
- package/dist/esm/internal/Router.js.map +1 -1
- package/dist/esm/internal/interfaces.js.map +1 -1
- package/dist/esm/internal/routeMatchedMap.js +11 -0
- package/dist/esm/internal/routeMatchedMap.js.map +1 -0
- package/dist/esm/internal/secret_internals.js +14 -2
- package/dist/esm/internal/secret_internals.js.map +1 -1
- package/dist/types/StoryboardFunctionRegistry.d.ts +13 -2
- package/dist/types/internal/interfaces.d.ts +14 -1
- package/dist/types/internal/routeMatchedMap.d.ts +6 -0
- package/dist/types/internal/secret_internals.d.ts +3 -2
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Renderer.js","names":["enqueueStableLoadBricks","flushStableLoadBricks","loadBricksImperatively","loadProcessorsImperatively","loadScript","loadStyle","isTrackAll","hasOwnProperty","strictCollectMemberUsage","debounce","isEqual","asyncCheckBrickIf","asyncComputeRealPropertyEntries","constructAsyncProperties","resolveData","asyncComputeRealValue","listenOnTrackingContext","matchRoute","matchRoutes","symbolForAsyncComputedPropsFromHost","symbolForTPlExternalForEachIndex","symbolForTPlExternalForEachItem","symbolForTPlExternalNoForEach","symbolForTplStateStoreId","expandCustomTemplate","getTagNameOfCustomTemplate","getTplStateStore","customTemplates","getBrickPackages","hooks","RenderTag","getTracks","isStrictMode","warnAboutStrictMode","FORM_RENDERER","symbolForFormStateStoreId","expandFormRenderer","isPreEvaluated","getPreEvaluatedRaw","matchHomepage","listenerFactory","setupRootRuntimeContext","httpErrorToString","renderRoutes","returnNode","routes","_runtimeContext","rendererContext","parentRoutes","menuRequestReturnNode","slotId","isIncremental","matched","output","getEmptyRenderOutput","menuRequestNode","return","unauthenticated","_hooks$checkPermissio","route","path","match","runtimeContext","ctxStore","disposeDataInRoutes","routePath","concat","define","context","undefined","pendingPermissionsPreCheck","push","checkPermissions","preCheckPermissionsForBrickOrRoute","value","preLoadBricks","Array","isArray","blockingList","type","redirectTo","redirect","resolved","transform","console","error","Error","menuRequest","loadMenu","menu","request","memoizeMenuRequestNode","newOutput","renderBricks","bricks","mergeRenderOutput","appendMenuRequestNode","tplStack","keyPath","kPath","rendered","Promise","all","map","brickConf","index","renderBrick","Map","forEach","item","hasTrackingControls","memoize","node","arguments","length","legacyRenderBrick","errorBoundary","tag","BRICK","properties","textContent","dataset","style","color","_hooks$checkPermissio2","_runtimeContext$app","brick","template","if","brickIf","permissionsPreCheck","restBrickConf","isGeneralizedTrackAll","dataSource","slots","Object","getOwnPropertySymbols","reduce","acc","symbol","tplStateStoreId","formStateStoreId","forEachItem","forEachIndex","strict","brickName","startsWith","ensureValidControlBrick","lowerLevelRenderControlNode","_slots$slot","computedDataSource","slot","String","childrenToSlots","children","renderForEach","renderControlNode","rawOutput","PLACEHOLDER","controlledOutput","onMount","onUnmount","lifeCycle","contextNames","stateNames","renderId","listener","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","tplCount","set","includes","customElements","FormRendererElement","HTMLElement","$$typeof","formData","confProps","trackingContextList","asyncPropertyEntries","computedPropsFromHost","isScript","props","src","rel","href","prefix","window","PUBLIC_ROOT","attrs","events","portal","iid","ref","usedProcessors","size","join","loadProperties","registerBrickLifeCycle","expandedBrickConf","childRuntimeContext","loadChildren","routeSlotFromIndexToSlotId","entries","_ref","childSlotId","slotConf","parentRoute","incrementalSubRoutes","performIncrementalRender","location","prevLocation","homepage","pathname","every","prevMatch","newMatch","params","query","URLSearchParams","search","failed","incrementalOutput","reBailout","reMergeMenuRequestNodes","result","reCatch","childrenOutput","has","mergeSiblingRenderMenuRequest","child","rows","i","j","flat","getDataStores","tplStateStoreMap","values","formStateStoreMap","stores","waitForAll","menuConf","warn","rest","last","sibling","assign","originalSlots","newSlots","process","env","NODE_ENV","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 symbolForTPlExternalNoForEach,\n symbolForTplStateStoreId,\n} from \"./CustomTemplates/constants.js\";\nimport { expandCustomTemplate } from \"./CustomTemplates/expandCustomTemplate.js\";\nimport type {\n MenuRequestNode,\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\";\nimport type { MatchResult } from \"./matchPath.js\";\nimport { setupRootRuntimeContext } from \"./setupRootRuntimeContext.js\";\nimport { httpErrorToString } from \"../handleHttpError.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 menuRequestNode?: MenuRequestNode;\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 menuRequestReturnNode: MenuRequestNode,\n slotId?: string,\n isIncremental?: boolean\n): Promise<RenderOutput> {\n const matched = await matchRoutes(routes, _runtimeContext);\n const output = getEmptyRenderOutput();\n const menuRequestNode: MenuRequestNode = (output.menuRequestNode = {\n return: menuRequestReturnNode,\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 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 menuRequestNode.request = menuRequest;\n }\n\n if (!isIncremental) {\n rendererContext.memoizeMenuRequestNode(routes, menuRequestNode);\n }\n\n let newOutput: RenderOutput;\n if (route.type === \"routes\") {\n newOutput = await renderRoutes(\n returnNode,\n route.routes,\n runtimeContext,\n rendererContext,\n routePath,\n menuRequestNode,\n slotId\n );\n } else {\n newOutput = await renderBricks(\n returnNode,\n route.bricks,\n runtimeContext,\n rendererContext,\n routePath,\n menuRequestNode,\n slotId\n );\n }\n\n mergeRenderOutput(output, newOutput);\n appendMenuRequestNode(menuRequestNode, newOutput.menuRequestNode);\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 menuRequestReturnNode: MenuRequestNode,\n slotId?: string,\n tplStack?: Map<string, number>,\n keyPath?: number[]\n): Promise<RenderOutput> {\n setupRootRuntimeContext(bricks, runtimeContext, true);\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 menuRequestReturnNode,\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 menuRequestReturnNode: MenuRequestNode,\n slotId?: string,\n keyPath: number[] = [],\n tplStack = new Map<string, number>()\n): Promise<RenderOutput> {\n try {\n return await legacyRenderBrick(\n returnNode,\n brickConf,\n _runtimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n slotId,\n keyPath,\n tplStack\n );\n } catch (error) {\n if (brickConf.errorBoundary) {\n // eslint-disable-next-line no-console\n console.error(\"Error caught by error boundary:\", error);\n return {\n node: {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: httpErrorToString(error),\n dataset: {\n errorBoundary: \"\",\n },\n style: {\n color: \"var(--color-error)\",\n },\n },\n runtimeContext: null!,\n return: returnNode,\n },\n blockingList: [],\n };\n } else {\n throw error;\n }\n }\n}\n\nasync function legacyRenderBrick(\n returnNode: RenderReturnNode,\n brickConf: RuntimeBrickConfWithSymbols,\n _runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n menuRequestReturnNode: MenuRequestNode,\n slotId: string | undefined,\n keyPath: number[],\n tplStack: 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 menuRequestReturnNode,\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 } else if (brickConf[symbolForTPlExternalNoForEach]) {\n delete runtimeContext.forEachItem;\n delete runtimeContext.forEachIndex;\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 menuRequestReturnNode,\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 menuRequestReturnNode,\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 routeSlotFromIndexToSlotId = new Map<number, string>();\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 menuRequestReturnNode,\n childSlotId,\n tplStack\n );\n }\n\n const parentRoute = parentRoutes[parentRoutes.length - 1] as\n | RouteConfOfBricks\n | undefined;\n if (parentRoute?.incrementalSubRoutes) {\n routeSlotFromIndexToSlotId.set(index, childSlotId);\n rendererContext.performIncrementalRender(\n slotConf,\n parentRoutes,\n async (location, prevLocation) => {\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 let prevMatch: MatchResult | null;\n let newMatch: MatchResult | null;\n return (\n (prevMatch = matchRoute(\n route,\n homepage,\n prevLocation.pathname\n )) &&\n (newMatch = matchRoute(route, homepage, pathname)) &&\n (route !== parentRoute ||\n isEqual(prevMatch.params, 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 menuRequestReturnNode,\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 if (incrementalOutput.route) {\n // Bailout if redirect or unauthenticated is set\n if (rendererContext.reBailout(incrementalOutput)) {\n return true;\n }\n\n scopedStores = [\n ...tplStateStoreScope,\n ...formStateStoreScope,\n ];\n await postAsyncRender(\n incrementalOutput,\n scopedRuntimeContext,\n [scopedRuntimeContext.ctxStore, ...scopedStores]\n );\n }\n\n await rendererContext.reMergeMenuRequestNodes(\n menuRequestReturnNode,\n slotConf.routes,\n incrementalOutput.menuRequestNode\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.reMergeMenuRequestNodes(\n menuRequestReturnNode,\n slotConf.routes,\n incrementalOutput.menuRequestNode\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 // When result is null, it means the incremental rendering is tried but routes missed.\n // In this case, we should continue to re-render the parent routes.\n return incrementalOutput.route ? true : null;\n }\n );\n }\n\n return renderRoutes(\n brick,\n slotConf.routes,\n childRuntimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n childSlotId\n );\n })\n );\n\n const childrenOutput: RenderOutput = {\n ...output,\n node: undefined,\n blockingList: [],\n menuRequestNode: undefined,\n };\n rendered.forEach((item, index) => {\n if (routeSlotFromIndexToSlotId.has(index)) {\n // Memoize a render node before it's been merged.\n rendererContext.memoize(\n routeSlotFromIndexToSlotId.get(index),\n [],\n item.node,\n brick\n );\n }\n mergeRenderOutput(childrenOutput, item);\n mergeSiblingRenderMenuRequest(childrenOutput, item);\n });\n if (childrenOutput.node) {\n brick.child = childrenOutput.node;\n }\n mergeRenderOutput(output, {\n ...childrenOutput,\n node: undefined,\n });\n\n appendMenuRequestNode(\n menuRequestReturnNode,\n (output.menuRequestNode = childrenOutput.menuRequestNode)\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 menuRequestReturnNode: MenuRequestNode,\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 menuRequestReturnNode,\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, menuRequestNode, hasTrackingControls, ...rest } =\n newOutput;\n output.blockingList.push(...blockingList);\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 mergeSiblingRenderMenuRequest(\n output: RenderOutput,\n newOutput: RenderOutput\n) {\n const menuRequestNode = newOutput.menuRequestNode;\n if (menuRequestNode) {\n if (output.menuRequestNode) {\n let last = output.menuRequestNode;\n while (last.sibling) {\n last = last.sibling;\n }\n last.sibling = menuRequestNode;\n } else {\n output.menuRequestNode = menuRequestNode;\n }\n }\n}\n\nfunction appendMenuRequestNode(\n menuRequestReturnNode: MenuRequestNode,\n menuRequestNode: MenuRequestNode | undefined\n) {\n if (!menuRequestNode) {\n return;\n }\n if (menuRequestReturnNode.child) {\n let last = menuRequestReturnNode.child;\n while (last.sibling) {\n last = last.sibling;\n }\n last.sibling = menuRequestNode;\n } else {\n menuRequestReturnNode.child = menuRequestNode;\n }\n}\n\nfunction getEmptyRenderOutput(): RenderOutput {\n return { blockingList: [] };\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,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,EAAEC,OAAO,QAAQ,QAAQ;AAC1C,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,6BAA6B,EAC7BC,wBAAwB,QACnB,gCAAgC;AACvC,SAASC,oBAAoB,QAAQ,2CAA2C;AAShF,SACEC,0BAA0B,EAC1BC,gBAAgB,QACX,4BAA4B;AACnC,SAASC,eAAe,QAAQ,uBAAuB;AAEvD,SAASC,gBAAgB,EAAEC,KAAK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J,cAAc,CAACyQ,QAAQ,EAAEzH,IAAI,CAAC,EAAE;QACnCyH,QAAQ,CAACzH,IAAI,CAAC,GAAG;UACfxE,IAAI,EAAE,QAAQ;UACde,MAAM,EAAE;QACV,CAAC;MACH;MACCkL,QAAQ,CAACzH,IAAI,CAAC,CAAsBzD,MAAM,CAACvB,IAAI,CAACuL,KAAK,CAAC;IACzD;EACF;EACA,OAAOkB,QAAQ;AACjB;AAEA,SAASpF,SAASA,CAChBwF,OAAyB,EACzBrM,IAAsD,EACtDsM,IAAY,EACZC,aAA+C,EAC/C;EACA,OAAOA,aAAa,KAAK,QAAQ,GAC7BF,OAAO,CAACG,KAAK,CAAEC,CAAC,IAAK;IACnB;IACApM,OAAO,CAACC,KAAK,CAAC,sBAAsB,EAAEN,IAAI,EAAEsM,IAAI,EAAEG,CAAC,CAAC;EACtD,CAAC,CAAC,GACFJ,OAAO;AACb","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Renderer.js","names":["enqueueStableLoadBricks","flushStableLoadBricks","loadBricksImperatively","loadProcessorsImperatively","loadScript","loadStyle","isTrackAll","hasOwnProperty","strictCollectMemberUsage","debounce","isEqual","asyncCheckBrickIf","asyncComputeRealPropertyEntries","constructAsyncProperties","resolveData","asyncComputeRealValue","listenOnTrackingContext","matchRoute","matchRoutes","symbolForAsyncComputedPropsFromHost","symbolForTPlExternalForEachIndex","symbolForTPlExternalForEachItem","symbolForTPlExternalNoForEach","symbolForTplStateStoreId","expandCustomTemplate","getTagNameOfCustomTemplate","getTplStateStore","customTemplates","getBrickPackages","hooks","RenderTag","getTracks","isStrictMode","warnAboutStrictMode","FORM_RENDERER","symbolForFormStateStoreId","expandFormRenderer","isPreEvaluated","getPreEvaluatedRaw","matchHomepage","listenerFactory","setupRootRuntimeContext","httpErrorToString","setMatchedRoute","renderRoutes","returnNode","routes","_runtimeContext","rendererContext","parentRoutes","menuRequestReturnNode","slotId","isIncremental","matched","output","getEmptyRenderOutput","menuRequestNode","return","unauthenticated","_hooks$checkPermissio","route","path","match","runtimeContext","iid","ctxStore","disposeDataInRoutes","routePath","concat","define","context","undefined","pendingPermissionsPreCheck","push","checkPermissions","preCheckPermissionsForBrickOrRoute","value","preLoadBricks","Array","isArray","blockingList","type","redirectTo","redirect","resolved","transform","console","error","Error","menuRequest","loadMenu","menu","request","memoizeMenuRequestNode","newOutput","renderBricks","bricks","mergeRenderOutput","appendMenuRequestNode","tplStack","keyPath","kPath","rendered","Promise","all","map","brickConf","index","renderBrick","Map","forEach","item","hasTrackingControls","memoize","node","arguments","length","legacyRenderBrick","errorBoundary","tag","BRICK","properties","textContent","dataset","style","color","_hooks$checkPermissio2","_runtimeContext$app","brick","template","if","brickIf","permissionsPreCheck","restBrickConf","isGeneralizedTrackAll","dataSource","slots","Object","getOwnPropertySymbols","reduce","acc","symbol","tplStateStoreId","formStateStoreId","forEachItem","forEachIndex","strict","brickName","startsWith","ensureValidControlBrick","lowerLevelRenderControlNode","_slots$slot","computedDataSource","slot","String","childrenToSlots","children","renderForEach","renderControlNode","rawOutput","PLACEHOLDER","controlledOutput","onMount","onUnmount","lifeCycle","contextNames","stateNames","renderId","listener","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","tplCount","set","includes","customElements","FormRendererElement","HTMLElement","$$typeof","formData","confProps","trackingContextList","asyncPropertyEntries","computedPropsFromHost","isScript","props","src","rel","href","prefix","window","PUBLIC_ROOT","attrs","events","portal","ref","usedProcessors","size","join","loadProperties","registerBrickLifeCycle","expandedBrickConf","childRuntimeContext","loadChildren","routeSlotFromIndexToSlotId","entries","_ref","childSlotId","slotConf","parentRoute","incrementalSubRoutes","performIncrementalRender","location","prevLocation","homepage","pathname","every","prevMatch","newMatch","params","query","URLSearchParams","search","failed","incrementalOutput","reBailout","reMergeMenuRequestNodes","result","reCatch","childrenOutput","has","mergeSiblingRenderMenuRequest","child","rows","i","j","flat","getDataStores","tplStateStoreMap","values","formStateStoreMap","stores","waitForAll","menuConf","warn","rest","last","sibling","assign","originalSlots","newSlots","process","env","NODE_ENV","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 symbolForTPlExternalNoForEach,\n symbolForTplStateStoreId,\n} from \"./CustomTemplates/constants.js\";\nimport { expandCustomTemplate } from \"./CustomTemplates/expandCustomTemplate.js\";\nimport type {\n MenuRequestNode,\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\";\nimport type { MatchResult } from \"./matchPath.js\";\nimport { setupRootRuntimeContext } from \"./setupRootRuntimeContext.js\";\nimport { httpErrorToString } from \"../handleHttpError.js\";\nimport { setMatchedRoute } from \"./routeMatchedMap.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 menuRequestNode?: MenuRequestNode;\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 menuRequestReturnNode: MenuRequestNode,\n slotId?: string,\n isIncremental?: boolean\n): Promise<RenderOutput> {\n const matched = await matchRoutes(routes, _runtimeContext);\n const output = getEmptyRenderOutput();\n const menuRequestNode: MenuRequestNode = (output.menuRequestNode = {\n return: menuRequestReturnNode,\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 output.path = matched.match.path;\n const runtimeContext = {\n ..._runtimeContext,\n match: matched.match,\n };\n\n if (route.iid) {\n setMatchedRoute(route.iid, matched.match);\n }\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 menuRequestNode.request = menuRequest;\n }\n\n if (!isIncremental) {\n rendererContext.memoizeMenuRequestNode(routes, menuRequestNode);\n }\n\n let newOutput: RenderOutput;\n if (route.type === \"routes\") {\n newOutput = await renderRoutes(\n returnNode,\n route.routes,\n runtimeContext,\n rendererContext,\n routePath,\n menuRequestNode,\n slotId\n );\n } else {\n newOutput = await renderBricks(\n returnNode,\n route.bricks,\n runtimeContext,\n rendererContext,\n routePath,\n menuRequestNode,\n slotId\n );\n }\n\n mergeRenderOutput(output, newOutput);\n appendMenuRequestNode(menuRequestNode, newOutput.menuRequestNode);\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 menuRequestReturnNode: MenuRequestNode,\n slotId?: string,\n tplStack?: Map<string, number>,\n keyPath?: number[]\n): Promise<RenderOutput> {\n setupRootRuntimeContext(bricks, runtimeContext, true);\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 menuRequestReturnNode,\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 menuRequestReturnNode: MenuRequestNode,\n slotId?: string,\n keyPath: number[] = [],\n tplStack = new Map<string, number>()\n): Promise<RenderOutput> {\n try {\n return await legacyRenderBrick(\n returnNode,\n brickConf,\n _runtimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n slotId,\n keyPath,\n tplStack\n );\n } catch (error) {\n if (brickConf.errorBoundary) {\n // eslint-disable-next-line no-console\n console.error(\"Error caught by error boundary:\", error);\n return {\n node: {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: httpErrorToString(error),\n dataset: {\n errorBoundary: \"\",\n },\n style: {\n color: \"var(--color-error)\",\n },\n },\n runtimeContext: null!,\n return: returnNode,\n },\n blockingList: [],\n };\n } else {\n throw error;\n }\n }\n}\n\nasync function legacyRenderBrick(\n returnNode: RenderReturnNode,\n brickConf: RuntimeBrickConfWithSymbols,\n _runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n menuRequestReturnNode: MenuRequestNode,\n slotId: string | undefined,\n keyPath: number[],\n tplStack: 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 menuRequestReturnNode,\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 } else if (brickConf[symbolForTPlExternalNoForEach]) {\n delete runtimeContext.forEachItem;\n delete runtimeContext.forEachIndex;\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 menuRequestReturnNode,\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 menuRequestReturnNode,\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 routeSlotFromIndexToSlotId = new Map<number, string>();\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 menuRequestReturnNode,\n childSlotId,\n tplStack\n );\n }\n\n const parentRoute = parentRoutes[parentRoutes.length - 1] as\n | RouteConfOfBricks\n | undefined;\n if (parentRoute?.incrementalSubRoutes) {\n routeSlotFromIndexToSlotId.set(index, childSlotId);\n rendererContext.performIncrementalRender(\n slotConf,\n parentRoutes,\n async (location, prevLocation) => {\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 let prevMatch: MatchResult | null;\n let newMatch: MatchResult | null;\n return (\n (prevMatch = matchRoute(\n route,\n homepage,\n prevLocation.pathname\n )) &&\n (newMatch = matchRoute(route, homepage, pathname)) &&\n (route !== parentRoute ||\n isEqual(prevMatch.params, 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 menuRequestReturnNode,\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 if (incrementalOutput.route) {\n // Bailout if redirect or unauthenticated is set\n if (rendererContext.reBailout(incrementalOutput)) {\n return true;\n }\n\n scopedStores = [\n ...tplStateStoreScope,\n ...formStateStoreScope,\n ];\n await postAsyncRender(\n incrementalOutput,\n scopedRuntimeContext,\n [scopedRuntimeContext.ctxStore, ...scopedStores]\n );\n }\n\n await rendererContext.reMergeMenuRequestNodes(\n menuRequestReturnNode,\n slotConf.routes,\n incrementalOutput.menuRequestNode\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.reMergeMenuRequestNodes(\n menuRequestReturnNode,\n slotConf.routes,\n incrementalOutput.menuRequestNode\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 // When result is null, it means the incremental rendering is tried but routes missed.\n // In this case, we should continue to re-render the parent routes.\n return incrementalOutput.route ? true : null;\n }\n );\n }\n\n return renderRoutes(\n brick,\n slotConf.routes,\n childRuntimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n childSlotId\n );\n })\n );\n\n const childrenOutput: RenderOutput = {\n ...output,\n node: undefined,\n blockingList: [],\n menuRequestNode: undefined,\n };\n rendered.forEach((item, index) => {\n if (routeSlotFromIndexToSlotId.has(index)) {\n // Memoize a render node before it's been merged.\n rendererContext.memoize(\n routeSlotFromIndexToSlotId.get(index),\n [],\n item.node,\n brick\n );\n }\n mergeRenderOutput(childrenOutput, item);\n mergeSiblingRenderMenuRequest(childrenOutput, item);\n });\n if (childrenOutput.node) {\n brick.child = childrenOutput.node;\n }\n mergeRenderOutput(output, {\n ...childrenOutput,\n node: undefined,\n });\n\n appendMenuRequestNode(\n menuRequestReturnNode,\n (output.menuRequestNode = childrenOutput.menuRequestNode)\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 menuRequestReturnNode: MenuRequestNode,\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 menuRequestReturnNode,\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, menuRequestNode, hasTrackingControls, ...rest } =\n newOutput;\n output.blockingList.push(...blockingList);\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 mergeSiblingRenderMenuRequest(\n output: RenderOutput,\n newOutput: RenderOutput\n) {\n const menuRequestNode = newOutput.menuRequestNode;\n if (menuRequestNode) {\n if (output.menuRequestNode) {\n let last = output.menuRequestNode;\n while (last.sibling) {\n last = last.sibling;\n }\n last.sibling = menuRequestNode;\n } else {\n output.menuRequestNode = menuRequestNode;\n }\n }\n}\n\nfunction appendMenuRequestNode(\n menuRequestReturnNode: MenuRequestNode,\n menuRequestNode: MenuRequestNode | undefined\n) {\n if (!menuRequestNode) {\n return;\n }\n if (menuRequestReturnNode.child) {\n let last = menuRequestReturnNode.child;\n while (last.sibling) {\n last = last.sibling;\n }\n last.sibling = menuRequestNode;\n } else {\n menuRequestReturnNode.child = menuRequestNode;\n }\n}\n\nfunction getEmptyRenderOutput(): RenderOutput {\n return { blockingList: [] };\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,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,EAAEC,OAAO,QAAQ,QAAQ;AAC1C,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,6BAA6B,EAC7BC,wBAAwB,QACnB,gCAAgC;AACvC,SAASC,oBAAoB,QAAQ,2CAA2C;AAShF,SACEC,0BAA0B,EAC1BC,gBAAgB,QACX,4BAA4B;AACnC,SAASC,eAAe,QAAQ,uBAAuB;AAEvD,SAASC,gBAAgB,EAAEC,KAAK,QAAQ,cAAc;AACtD,SAASC,SAAS,QAAQ,YAAY;AACtC,SAASC,SAAS,QAAQ,wBAAwB;AAClD,SAASC,YAAY,EAAEC,mBAAmB,QAAQ,oBAAoB;AACtE,SACEC,aAAa,EAEbC,yBAAyB,QACpB,6BAA6B;AACpC,SAASC,kBAAkB,QAAQ,sCAAsC;AACzE,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SAASC,kBAAkB,QAAQ,uBAAuB;AAE1D,SAASC,aAAa,QAAQ,sBAAsB;AAEpD,SAASC,eAAe,Q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CAAC,CAAsBzD,MAAM,CAACvB,IAAI,CAACsL,KAAK,CAAC;IACzD;EACF;EACA,OAAOkB,QAAQ;AACjB;AAEA,SAASnF,SAASA,CAChBuF,OAAyB,EACzBpM,IAAsD,EACtDqM,IAAY,EACZC,aAA+C,EAC/C;EACA,OAAOA,aAAa,KAAK,QAAQ,GAC7BF,OAAO,CAACG,KAAK,CAAEC,CAAC,IAAK;IACnB;IACAnM,OAAO,CAACC,KAAK,CAAC,sBAAsB,EAAEN,IAAI,EAAEqM,IAAI,EAAEG,CAAC,CAAC;EACtD,CAAC,CAAC,GACFJ,OAAO;AACb","ignoreList":[]}
|
|
@@ -29,6 +29,7 @@ import { devtoolsHookEmit } from "./devtools.js";
|
|
|
29
29
|
import { setUIVersion } from "../setUIVersion.js";
|
|
30
30
|
import { setAppVariable } from "../setAppVariable.js";
|
|
31
31
|
import { setWatermark } from "../setWatermark.js";
|
|
32
|
+
import { clearMatchedRoutes } from "./routeMatchedMap.js";
|
|
32
33
|
var _storyboards = /*#__PURE__*/new WeakMap();
|
|
33
34
|
var _rendering = /*#__PURE__*/new WeakMap();
|
|
34
35
|
var _prevLocation = /*#__PURE__*/new WeakMap();
|
|
@@ -379,6 +380,7 @@ async function _render(location) {
|
|
|
379
380
|
let output;
|
|
380
381
|
let stores = [];
|
|
381
382
|
try {
|
|
383
|
+
clearMatchedRoutes();
|
|
382
384
|
const rootMenuRequestNode = {};
|
|
383
385
|
output = await renderRoutes(renderRoot, insertPreviewRoutes(storyboard.routes), runtimeContext, rendererContext, [], rootMenuRequestNode);
|
|
384
386
|
if (routeHelper.bailout(output)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Router.js","names":["locationsAreEqual","HttpAbortError","uniqueId","getHistory","getDataStores","postAsyncRender","renderRoutes","DataStore","clearResolveCache","mountTree","unmountTree","isOutsideApp","matchStoryboard","registerStoryboardFunctions","RendererContext","applyMode","applyTheme","getLocalAppsTheme","setMode","setTheme","_internalApiGetAppInBootstrapData","getRuntime","hooks","getPageInfo","resetAllComputedMarks","handleHttpError","httpErrorToString","isUnauthenticatedError","abortPendingRequest","initAbortController","setLoginStateCookie","registerCustomTemplates","fulfilStoryboard","RenderTag","insertPreviewRoutes","devtoolsHookEmit","setUIVersion","setAppVariable","setWatermark","_storyboards","WeakMap","_rendering","_prevLocation","_nextLocation","_runtimeContext","_rendererContext","_rendererContextTrashCan","_redirectCount","_renderId","_currentApp","_previousApp","_navConfig","_Router_brand","WeakSet","Router","constructor","storyboards","_classPrivateMethodInitSpec","_classPrivateFieldInitSpec","Set","_classPrivateFieldSet","history","window","addEventListener","event","message","_assertClassBrand","_getBlockMessageBeforePageLave","call","preventDefault","returnValue","block","location","action","getRenderId","_classPrivateFieldGet","getRuntimeContext","getRecentApps","currentApp","previousApp","getNavConfig","bootstrap","renderId","listen","_classPrivateFieldGet2","_location$state","_location$state2","_classPrivateFieldGet4","currentRenderId","ignoreRendering","omittedLocationProps","hash","undefined","state","key","notify","noIncremental","_classPrivateFieldGet3","didPerformIncrementalRender","dispatchPageLeave","storyboard","pathname","reload","_queuedRender","catch","detail","_classPrivateFieldGet5","previousMessage","getBlockMessage","dispatchBeforePageLeave","unblock","_safeRedirect","to","from","_this$redirectCount","_this$redirectCount2","search","process","env","NODE_ENV","console","error","Error","replace","_render","nextLocation","_hooks$flowApi","_hooks$pageView","_classPrivateFieldGet6","_storyboard$app","flowApi","clearCollectWidgetContract","finishPageView","pageView","create","app","currentAppId","id","BOOTSTRAP_UNION_FILE","appId","version","currentVersion","appChanged","flags","getFeatureFlags","prevRendererContext","redirectTo","status","add","redirectToLogin","main","document","querySelector","portal","renderRoot","tag","ROOT","container","createPortal","cleanUpPreviousRender","_hooks$messageDispatc","item","dispatchOnUnmount","dispose","clear","messageDispatcher","reset","dispatchEvent","CustomEvent","theme","_hooks$checkInstalled","_hooks$auth","_hooks$checkPermissio","_storyboard$meta","_hooks$flowApi2","_storyboard$meta2","checkInstalledApps","preCheckInstalledApps","routeHelper","bailout","output","unauthenticated","redirect","path","mergeMenus","menuRequests","menuConfs","Promise","all","mergeMenuConfs","returnNode","NO_AUTH_GUARD","noAuthGuardLoginPath","getMiscSettings","failed","node","BRICK","type","properties","textContent","dataset","errorBoundary","style","color","runtimeContext","return","blockingList","rendererContext","query","URLSearchParams","sys","auth","getAuth","settings","brand","getBrandSettings","ctxStore","pendingPermissionsPreCheck","checkPermissions","preCheckPermissions","tplStateStoreMap","Map","formStateStoreMap","meta","functions","collectContract","contracts","stores","rootMenuRequestNode","routes","child","menuRequestNode","setInitialMenuRequestNode","getMenuRequests","result","route","dispatchBeforePageLoad","uiVersion","scrollTo","dispatchPageLoad","dispatchAnchorLoad","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","initializeMessageDispatcher","store","mountAsyncData","pageTitle","title","isLoggedIn","navConfig","breadcrumb","menuConf","overwrite","items","push"],"sources":["../../../src/internal/Router.ts"],"sourcesContent":["import { Action, locationsAreEqual } from \"history\";\nimport type {\n BreadcrumbItemConf,\n MicroApp,\n StaticMenuConf,\n Storyboard,\n} from \"@next-core/types\";\nimport { HttpAbortError } from \"@next-core/http\";\nimport { uniqueId } from \"lodash\";\nimport { NextHistoryState, NextLocation, getHistory } from \"../history.js\";\nimport {\n RenderOutput,\n getDataStores,\n postAsyncRender,\n renderRoutes,\n} from \"./Renderer.js\";\nimport { DataStore } from \"./data/DataStore.js\";\nimport { clearResolveCache } from \"./data/resolveData.js\";\nimport { mountTree, unmountTree } from \"./mount.js\";\nimport { isOutsideApp, matchStoryboard } from \"./matchStoryboard.js\";\nimport { registerStoryboardFunctions } from \"./compute/StoryboardFunctions.js\";\nimport { RendererContext, RouteHelper } from \"./RendererContext.js\";\nimport {\n applyMode,\n applyTheme,\n getLocalAppsTheme,\n setMode,\n setTheme,\n} from \"../themeAndMode.js\";\nimport {\n _internalApiGetAppInBootstrapData,\n getRuntime,\n hooks,\n} from \"./Runtime.js\";\nimport { getPageInfo } from \"../getPageInfo.js\";\nimport type {\n MenuRequestNode,\n RenderBrick,\n RenderRoot,\n RuntimeContext,\n} from \"./interfaces.js\";\nimport { resetAllComputedMarks } from \"./compute/markAsComputed.js\";\nimport {\n handleHttpError,\n httpErrorToString,\n isUnauthenticatedError,\n} from \"../handleHttpError.js\";\nimport { abortPendingRequest, initAbortController } from \"./abortController.js\";\nimport { setLoginStateCookie } from \"../setLoginStateCookie.js\";\nimport { registerCustomTemplates } from \"./registerCustomTemplates.js\";\nimport { fulfilStoryboard } from \"./fulfilStoryboard.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { insertPreviewRoutes } from \"./insertPreviewRoutes.js\";\nimport { devtoolsHookEmit } from \"./devtools.js\";\nimport { setUIVersion } from \"../setUIVersion.js\";\nimport { setAppVariable } from \"../setAppVariable.js\";\nimport { setWatermark } from \"../setWatermark.js\";\n\nexport class Router {\n readonly #storyboards: Storyboard[];\n #rendering = false;\n #prevLocation!: NextLocation;\n #nextLocation?: NextLocation;\n #runtimeContext?: RuntimeContext;\n #rendererContext?: RendererContext;\n #rendererContextTrashCan = new Set<RendererContext | undefined>();\n #redirectCount = 0;\n #renderId?: string;\n #currentApp?: MicroApp;\n #previousApp?: MicroApp;\n #navConfig?: {\n breadcrumb?: BreadcrumbItemConf[];\n };\n\n constructor(storyboards: Storyboard[]) {\n this.#storyboards = storyboards;\n\n const history = getHistory();\n window.addEventListener(\"beforeunload\", (event) => {\n const message = this.#getBlockMessageBeforePageLave({});\n // See examples in https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload\n if (message) {\n // Cancel the event\n // If you prevent default behavior in Mozilla Firefox prompt will always be shown\n event.preventDefault();\n // Chrome requires returnValue to be set\n event.returnValue = \"\";\n } else {\n // the absence of a returnValue property on the event will guarantee the browser unload happens\n delete event.returnValue;\n }\n });\n\n history.block((location, action) =>\n this.#getBlockMessageBeforePageLave({ location, action })\n );\n }\n\n getRenderId() {\n return this.#renderId;\n }\n\n getRuntimeContext() {\n return this.#runtimeContext;\n }\n\n getRecentApps() {\n return {\n currentApp: this.#currentApp,\n previousApp: this.#previousApp,\n };\n }\n\n getNavConfig() {\n return this.#navConfig;\n }\n\n #getBlockMessageBeforePageLave(detail: {\n location?: NextLocation;\n action?: Action;\n }): string | undefined {\n const history = getHistory();\n const previousMessage = history.getBlockMessage();\n this.#rendererContext?.dispatchBeforePageLeave(detail);\n const message = history.getBlockMessage();\n if (!previousMessage && message) {\n // Auto unblock only if new block was introduced by `onBeforePageLeave`.\n history.unblock();\n }\n return message;\n }\n\n #safeRedirect(\n to: string,\n state: NextHistoryState | undefined,\n from: NextLocation\n ): void {\n if (this.#redirectCount++ > 10) {\n const message = `Infinite redirect detected: from \"${from.pathname}${from.search}${from.hash}\" to \"${to}\"`;\n // istanbul ignore else: error cannot be caught in test\n if (process.env.NODE_ENV === \"test\") {\n // eslint-disable-next-line no-console\n console.error(message);\n return;\n } else {\n throw new Error(message);\n }\n }\n getHistory().replace(to, state);\n }\n\n bootstrap() {\n initAbortController();\n const history = getHistory();\n this.#prevLocation = history.location;\n let renderId = 0;\n history.listen(async (location, action) => {\n const currentRenderId = ++renderId;\n let ignoreRendering: boolean | undefined;\n const omittedLocationProps: Partial<NextLocation> = {\n hash: undefined,\n state: undefined,\n };\n // Omit the \"key\" when checking whether locations are equal in certain situations.\n if (\n // When current location is triggered by browser action of hash link.\n location.key === undefined ||\n // When current location is triggered by browser action of non-push-or-replace,\n // such as goBack or goForward,\n (action === \"POP\" &&\n // and the previous location was triggered by hash link,\n (this.#prevLocation.key === undefined ||\n // or the previous location specified notify false.\n this.#prevLocation.state?.notify === false))\n ) {\n omittedLocationProps.key = undefined;\n }\n if (\n locationsAreEqual(\n { ...this.#prevLocation, ...omittedLocationProps },\n { ...location, ...omittedLocationProps }\n ) ||\n (action !== \"POP\" && location.state?.notify === false)\n ) {\n // Ignore rendering if location not changed except hash, state and optional key.\n // Ignore rendering if notify is `false`.\n ignoreRendering = true;\n }\n\n if (!ignoreRendering && !location.state?.noIncremental) {\n ignoreRendering =\n await this.#rendererContext?.didPerformIncrementalRender(\n location,\n this.#prevLocation\n );\n }\n\n // Ignore stale renders\n if (renderId !== currentRenderId) {\n return;\n }\n\n if (ignoreRendering) {\n this.#prevLocation = location;\n return;\n }\n\n abortPendingRequest();\n this.#prevLocation = location;\n this.#rendererContext?.dispatchPageLeave();\n\n if (action === \"POP\") {\n const storyboard = matchStoryboard(\n this.#storyboards,\n location.pathname\n );\n // When a browser action of goBack or goForward is performing,\n // force reload when the target page is a page of an outside app.\n if (isOutsideApp(storyboard)) {\n window.location.reload();\n return;\n }\n }\n\n if (this.#rendering) {\n this.#nextLocation = location;\n } else {\n devtoolsHookEmit(\"locationChange\");\n this.#queuedRender(location).catch(handleHttpError);\n }\n });\n return this.#queuedRender(history.location);\n }\n\n async #queuedRender(location: NextLocation): Promise<void> {\n this.#rendering = true;\n try {\n await this.#render(location);\n } finally {\n this.#rendering = false;\n if (this.#nextLocation) {\n const nextLocation = this.#nextLocation;\n this.#nextLocation = undefined;\n await this.#queuedRender(nextLocation);\n }\n }\n }\n\n async #render(location: NextLocation): Promise<void> {\n const renderId = (this.#renderId = uniqueId(\"render-id-\"));\n\n resetAllComputedMarks();\n clearResolveCache();\n hooks?.flowApi?.clearCollectWidgetContract();\n\n const history = getHistory();\n history.unblock();\n\n // const renderStartTime = performance.now();\n const finishPageView = hooks?.pageView?.create();\n\n const storyboard = matchStoryboard(this.#storyboards, location.pathname);\n\n const previousApp = this.#runtimeContext?.app;\n const currentAppId = storyboard?.app?.id;\n // dynamically change the value of the APP variable, if it's union app\n if (\n window.BOOTSTRAP_UNION_FILE &&\n currentAppId &&\n currentAppId !== previousApp?.id\n ) {\n setAppVariable({\n appId: currentAppId,\n version: storyboard.app.currentVersion!,\n });\n }\n\n if (storyboard?.app) {\n await fulfilStoryboard(storyboard);\n }\n\n const currentApp = (this.#currentApp = storyboard?.app);\n\n setWatermark();\n\n // Storyboard maybe re-assigned, e.g. when open launchpad.\n const appChanged =\n previousApp && currentApp\n ? previousApp.id !== currentApp.id\n : previousApp !== currentApp;\n\n // TODO: handle favicon\n\n // Set `Router::#currentApp` before calling `getFeatureFlags()`\n const flags = getRuntime().getFeatureFlags();\n const prevRendererContext = this.#rendererContext;\n\n const redirectTo = (to: string, state?: NextHistoryState): void => {\n finishPageView?.({\n status: \"redirected\",\n });\n this.#rendererContextTrashCan.add(prevRendererContext);\n this.#safeRedirect(to, state, location);\n };\n\n const redirectToLogin = (): void => {\n const to = flags[\"sso-enabled\"] ? \"/sso-auth/login\" : \"/auth/login\";\n setLoginStateCookie(location);\n redirectTo(to, { from: location });\n };\n\n const main = document.querySelector(\"#main-mount-point\") as HTMLElement;\n const portal = document.querySelector(\"#portal-mount-point\") as HTMLElement;\n\n const renderRoot: RenderRoot = {\n tag: RenderTag.ROOT,\n container: main,\n createPortal: portal,\n };\n\n const cleanUpPreviousRender = (): void => {\n unmountTree(main);\n unmountTree(portal);\n\n // Note: redirects can lead to multiple trash renderer contexts.\n this.#rendererContextTrashCan.add(prevRendererContext);\n for (const item of this.#rendererContextTrashCan) {\n if (item) {\n item.dispatchOnUnmount();\n item.dispose();\n }\n }\n this.#rendererContextTrashCan.clear();\n hooks?.messageDispatcher?.reset();\n\n if (appChanged) {\n this.#previousApp = previousApp;\n window.dispatchEvent(\n new CustomEvent(\"app.change\", {\n detail: {\n previousApp,\n currentApp,\n },\n })\n );\n }\n };\n\n setTheme(\n (currentApp &&\n (getLocalAppsTheme()[currentApp.id] || currentApp.theme)) ||\n \"light\"\n );\n setMode(\"default\");\n\n if (currentApp) {\n hooks?.checkInstalledApps?.preCheckInstalledApps(\n storyboard,\n (appId) => !!_internalApiGetAppInBootstrapData(appId)\n );\n\n const routeHelper: RouteHelper = {\n bailout: (output) => {\n if (output.unauthenticated) {\n redirectToLogin();\n return true;\n }\n if (output.redirect) {\n redirectTo(output.redirect.path, output.redirect.state);\n return true;\n }\n // Reset redirect count if no redirect is set.\n this.#redirectCount = 0;\n },\n mergeMenus: async (menuRequests) => {\n const menuConfs = await Promise.all(menuRequests);\n this.#navConfig = mergeMenuConfs(menuConfs);\n window.dispatchEvent(\n new CustomEvent(\"navConfig.change\", { detail: this.#navConfig })\n );\n },\n catch: (error, returnNode) => {\n if (isUnauthenticatedError(error) && !window.NO_AUTH_GUARD) {\n redirectToLogin();\n return;\n } else if (error instanceof HttpAbortError) {\n this.#rendererContextTrashCan.add(prevRendererContext);\n return;\n } else {\n const noAuthGuardLoginPath =\n getRuntime().getMiscSettings().noAuthGuardLoginPath;\n if (isUnauthenticatedError(error) && noAuthGuardLoginPath) {\n redirectTo(noAuthGuardLoginPath as string, { from: location });\n return;\n }\n return {\n failed: true,\n output: {\n node: {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: httpErrorToString(error),\n dataset: {\n errorBoundary: \"\",\n },\n style: {\n color: \"var(--color-error)\",\n },\n },\n runtimeContext: null!,\n return: returnNode,\n },\n blockingList: [],\n },\n };\n }\n },\n };\n\n const rendererContext = (this.#rendererContext = new RendererContext(\n \"page\",\n { routeHelper, renderId }\n ));\n\n const runtimeContext: RuntimeContext = (this.#runtimeContext = {\n app: currentApp,\n location,\n query: new URLSearchParams(location.search),\n flags,\n sys: {\n ...hooks?.auth?.getAuth(),\n ...getPageInfo(),\n settings: {\n brand: getRuntime().getBrandSettings(),\n },\n },\n ctxStore: new DataStore(\"CTX\", undefined, rendererContext),\n pendingPermissionsPreCheck: [\n hooks?.checkPermissions?.preCheckPermissions(storyboard),\n ],\n tplStateStoreMap: new Map<string, DataStore<\"STATE\">>(),\n formStateStoreMap: new Map<string, DataStore<\"FORM_STATE\">>(),\n });\n\n this.#navConfig = undefined;\n\n registerCustomTemplates(storyboard);\n registerStoryboardFunctions(storyboard.meta?.functions, currentApp);\n hooks?.flowApi?.collectContract(storyboard.meta?.contracts);\n\n let failed = false;\n let output: RenderOutput;\n let stores: DataStore<\"CTX\" | \"STATE\" | \"FORM_STATE\">[] = [];\n\n try {\n const rootMenuRequestNode: MenuRequestNode = {};\n output = await renderRoutes(\n renderRoot,\n insertPreviewRoutes(storyboard.routes),\n runtimeContext,\n rendererContext,\n [],\n rootMenuRequestNode\n );\n if (routeHelper.bailout(output)) {\n return;\n }\n\n stores = getDataStores(runtimeContext);\n\n await postAsyncRender(output, runtimeContext, stores);\n\n rootMenuRequestNode.child = output.menuRequestNode;\n rendererContext.setInitialMenuRequestNode(rootMenuRequestNode);\n await routeHelper.mergeMenus(rendererContext.getMenuRequests());\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Router failed:\", error);\n\n const result = routeHelper.catch(error, renderRoot);\n if (!result) {\n return;\n }\n ({ failed, output } = result);\n }\n renderRoot.child = output.node;\n\n cleanUpPreviousRender();\n\n if ((output.route && output.route.type !== \"routes\") || failed) {\n if (!failed) {\n // There is a window to set theme and mode by `lifeCycle.onBeforePageLoad`.\n rendererContext.dispatchBeforePageLoad();\n }\n applyTheme();\n applyMode();\n\n setUIVersion(currentApp?.uiVersion);\n mountTree(renderRoot);\n\n // Scroll to top after each rendering.\n // See https://github.com/ReactTraining/react-router/blob/master/packages/react-router-dom/docs/guides/scroll-restoration.md\n window.scrollTo(0, 0);\n\n if (!failed) {\n rendererContext.dispatchPageLoad();\n rendererContext.dispatchAnchorLoad();\n rendererContext.dispatchOnMount();\n rendererContext.initializeScrollIntoView();\n rendererContext.initializeMediaChange();\n rendererContext.initializeMessageDispatcher();\n\n for (const store of stores) {\n store.mountAsyncData();\n }\n\n finishPageView?.({\n status: \"ok\",\n path: output.path,\n pageTitle: document.title,\n });\n } else {\n finishPageView?.({ status: \"failed\" });\n }\n devtoolsHookEmit(\"rendered\");\n\n return;\n }\n } else if (\n !window.NO_AUTH_GUARD &&\n hooks?.auth &&\n !hooks.auth.isLoggedIn()\n ) {\n // Todo(steve): refine after api-gateway supports fetching storyboards before logged in.\n // Redirect to login if no storyboard is matched.\n redirectToLogin();\n return;\n } else {\n cleanUpPreviousRender();\n }\n\n applyTheme();\n applyMode();\n\n const node: RenderBrick = {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: \"Page not found\",\n },\n runtimeContext: null!,\n return: renderRoot,\n };\n renderRoot.child = node;\n\n mountTree(renderRoot);\n\n // Scroll to top after each rendering.\n window.scrollTo(0, 0);\n finishPageView?.({ status: \"not-found\" });\n devtoolsHookEmit(\"rendered\");\n }\n}\n\nfunction mergeMenuConfs(menuConfs: StaticMenuConf[]) {\n const navConfig = {\n breadcrumb: [] as BreadcrumbItemConf[],\n };\n for (const menuConf of menuConfs) {\n const { breadcrumb } = menuConf;\n if (breadcrumb) {\n if (breadcrumb.overwrite) {\n navConfig.breadcrumb = breadcrumb.items;\n } else {\n navConfig.breadcrumb.push(...breadcrumb.items);\n }\n }\n }\n return navConfig;\n}\n"],"mappings":";;;;;AAAA,SAAiBA,iBAAiB,QAAQ,SAAS;AAOnD,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,QAAQ,QAAQ,QAAQ;AACjC,SAAyCC,UAAU,QAAQ,eAAe;AAC1E,SAEEC,aAAa,EACbC,eAAe,EACfC,YAAY,QACP,eAAe;AACtB,SAASC,SAAS,QAAQ,qBAAqB;AAC/C,SAASC,iBAAiB,QAAQ,uBAAuB;AACzD,SAASC,SAAS,EAAEC,WAAW,QAAQ,YAAY;AACnD,SAASC,YAAY,EAAEC,eAAe,QAAQ,sBAAsB;AACpE,SAASC,2BAA2B,QAAQ,kCAAkC;AAC9E,SAASC,eAAe,QAAqB,sBAAsB;AACnE,SACEC,SAAS,EACTC,UAAU,EACVC,iBAAiB,EACjBC,OAAO,EACPC,QAAQ,QACH,oBAAoB;AAC3B,SACEC,iCAAiC,EACjCC,UAAU,EACVC,KAAK,QACA,cAAc;AACrB,SAASC,WAAW,QAAQ,mBAAmB;AAO/C,SAASC,qBAAqB,QAAQ,6BAA6B;AACnE,SACEC,eAAe,EACfC,iBAAiB,EACjBC,sBAAsB,QACjB,uBAAuB;AAC9B,SAASC,mBAAmB,EAAEC,m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AAEiE;IAAW,CAAC,GAAGC,QAAQ;IAC/B,IAAID,UAAU,EAAE;MACd,IAAIA,UAAU,CAACE,SAAS,EAAE;QACxBH,SAAS,CAACC,UAAU,GAAGA,UAAU,CAACG,KAAK;MACzC,CAAC,MAAM;QACLJ,SAAS,CAACC,UAAU,CAACI,IAAI,CAAC,GAAGJ,UAAU,CAACG,KAAK,CAAC;MAChD;IACF;EACF;EACA,OAAOJ,SAAS;AAClB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Router.js","names":["locationsAreEqual","HttpAbortError","uniqueId","getHistory","getDataStores","postAsyncRender","renderRoutes","DataStore","clearResolveCache","mountTree","unmountTree","isOutsideApp","matchStoryboard","registerStoryboardFunctions","RendererContext","applyMode","applyTheme","getLocalAppsTheme","setMode","setTheme","_internalApiGetAppInBootstrapData","getRuntime","hooks","getPageInfo","resetAllComputedMarks","handleHttpError","httpErrorToString","isUnauthenticatedError","abortPendingRequest","initAbortController","setLoginStateCookie","registerCustomTemplates","fulfilStoryboard","RenderTag","insertPreviewRoutes","devtoolsHookEmit","setUIVersion","setAppVariable","setWatermark","clearMatchedRoutes","_storyboards","WeakMap","_rendering","_prevLocation","_nextLocation","_runtimeContext","_rendererContext","_rendererContextTrashCan","_redirectCount","_renderId","_currentApp","_previousApp","_navConfig","_Router_brand","WeakSet","Router","constructor","storyboards","_classPrivateMethodInitSpec","_classPrivateFieldInitSpec","Set","_classPrivateFieldSet","history","window","addEventListener","event","message","_assertClassBrand","_getBlockMessageBeforePageLave","call","preventDefault","returnValue","block","location","action","getRenderId","_classPrivateFieldGet","getRuntimeContext","getRecentApps","currentApp","previousApp","getNavConfig","bootstrap","renderId","listen","_classPrivateFieldGet2","_location$state","_location$state2","_classPrivateFieldGet4","currentRenderId","ignoreRendering","omittedLocationProps","hash","undefined","state","key","notify","noIncremental","_classPrivateFieldGet3","didPerformIncrementalRender","dispatchPageLeave","storyboard","pathname","reload","_queuedRender","catch","detail","_classPrivateFieldGet5","previousMessage","getBlockMessage","dispatchBeforePageLeave","unblock","_safeRedirect","to","from","_this$redirectCount","_this$redirectCount2","search","process","env","NODE_ENV","console","error","Error","replace","_render","nextLocation","_hooks$flowApi","_hooks$pageView","_classPrivateFieldGet6","_storyboard$app","flowApi","clearCollectWidgetContract","finishPageView","pageView","create","app","currentAppId","id","BOOTSTRAP_UNION_FILE","appId","version","currentVersion","appChanged","flags","getFeatureFlags","prevRendererContext","redirectTo","status","add","redirectToLogin","main","document","querySelector","portal","renderRoot","tag","ROOT","container","createPortal","cleanUpPreviousRender","_hooks$messageDispatc","item","dispatchOnUnmount","dispose","clear","messageDispatcher","reset","dispatchEvent","CustomEvent","theme","_hooks$checkInstalled","_hooks$auth","_hooks$checkPermissio","_storyboard$meta","_hooks$flowApi2","_storyboard$meta2","checkInstalledApps","preCheckInstalledApps","routeHelper","bailout","output","unauthenticated","redirect","path","mergeMenus","menuRequests","menuConfs","Promise","all","mergeMenuConfs","returnNode","NO_AUTH_GUARD","noAuthGuardLoginPath","getMiscSettings","failed","node","BRICK","type","properties","textContent","dataset","errorBoundary","style","color","runtimeContext","return","blockingList","rendererContext","query","URLSearchParams","sys","auth","getAuth","settings","brand","getBrandSettings","ctxStore","pendingPermissionsPreCheck","checkPermissions","preCheckPermissions","tplStateStoreMap","Map","formStateStoreMap","meta","functions","collectContract","contracts","stores","rootMenuRequestNode","routes","child","menuRequestNode","setInitialMenuRequestNode","getMenuRequests","result","route","dispatchBeforePageLoad","uiVersion","scrollTo","dispatchPageLoad","dispatchAnchorLoad","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","initializeMessageDispatcher","store","mountAsyncData","pageTitle","title","isLoggedIn","navConfig","breadcrumb","menuConf","overwrite","items","push"],"sources":["../../../src/internal/Router.ts"],"sourcesContent":["import { Action, locationsAreEqual } from \"history\";\nimport type {\n BreadcrumbItemConf,\n MicroApp,\n StaticMenuConf,\n Storyboard,\n} from \"@next-core/types\";\nimport { HttpAbortError } from \"@next-core/http\";\nimport { uniqueId } from \"lodash\";\nimport { NextHistoryState, NextLocation, getHistory } from \"../history.js\";\nimport {\n RenderOutput,\n getDataStores,\n postAsyncRender,\n renderRoutes,\n} from \"./Renderer.js\";\nimport { DataStore } from \"./data/DataStore.js\";\nimport { clearResolveCache } from \"./data/resolveData.js\";\nimport { mountTree, unmountTree } from \"./mount.js\";\nimport { isOutsideApp, matchStoryboard } from \"./matchStoryboard.js\";\nimport { registerStoryboardFunctions } from \"./compute/StoryboardFunctions.js\";\nimport { RendererContext, RouteHelper } from \"./RendererContext.js\";\nimport {\n applyMode,\n applyTheme,\n getLocalAppsTheme,\n setMode,\n setTheme,\n} from \"../themeAndMode.js\";\nimport {\n _internalApiGetAppInBootstrapData,\n getRuntime,\n hooks,\n} from \"./Runtime.js\";\nimport { getPageInfo } from \"../getPageInfo.js\";\nimport type {\n MenuRequestNode,\n RenderBrick,\n RenderRoot,\n RuntimeContext,\n} from \"./interfaces.js\";\nimport { resetAllComputedMarks } from \"./compute/markAsComputed.js\";\nimport {\n handleHttpError,\n httpErrorToString,\n isUnauthenticatedError,\n} from \"../handleHttpError.js\";\nimport { abortPendingRequest, initAbortController } from \"./abortController.js\";\nimport { setLoginStateCookie } from \"../setLoginStateCookie.js\";\nimport { registerCustomTemplates } from \"./registerCustomTemplates.js\";\nimport { fulfilStoryboard } from \"./fulfilStoryboard.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { insertPreviewRoutes } from \"./insertPreviewRoutes.js\";\nimport { devtoolsHookEmit } from \"./devtools.js\";\nimport { setUIVersion } from \"../setUIVersion.js\";\nimport { setAppVariable } from \"../setAppVariable.js\";\nimport { setWatermark } from \"../setWatermark.js\";\nimport { clearMatchedRoutes } from \"./routeMatchedMap.js\";\n\nexport class Router {\n readonly #storyboards: Storyboard[];\n #rendering = false;\n #prevLocation!: NextLocation;\n #nextLocation?: NextLocation;\n #runtimeContext?: RuntimeContext;\n #rendererContext?: RendererContext;\n #rendererContextTrashCan = new Set<RendererContext | undefined>();\n #redirectCount = 0;\n #renderId?: string;\n #currentApp?: MicroApp;\n #previousApp?: MicroApp;\n #navConfig?: {\n breadcrumb?: BreadcrumbItemConf[];\n };\n\n constructor(storyboards: Storyboard[]) {\n this.#storyboards = storyboards;\n\n const history = getHistory();\n window.addEventListener(\"beforeunload\", (event) => {\n const message = this.#getBlockMessageBeforePageLave({});\n // See examples in https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload\n if (message) {\n // Cancel the event\n // If you prevent default behavior in Mozilla Firefox prompt will always be shown\n event.preventDefault();\n // Chrome requires returnValue to be set\n event.returnValue = \"\";\n } else {\n // the absence of a returnValue property on the event will guarantee the browser unload happens\n delete event.returnValue;\n }\n });\n\n history.block((location, action) =>\n this.#getBlockMessageBeforePageLave({ location, action })\n );\n }\n\n getRenderId() {\n return this.#renderId;\n }\n\n getRuntimeContext() {\n return this.#runtimeContext;\n }\n\n getRecentApps() {\n return {\n currentApp: this.#currentApp,\n previousApp: this.#previousApp,\n };\n }\n\n getNavConfig() {\n return this.#navConfig;\n }\n\n #getBlockMessageBeforePageLave(detail: {\n location?: NextLocation;\n action?: Action;\n }): string | undefined {\n const history = getHistory();\n const previousMessage = history.getBlockMessage();\n this.#rendererContext?.dispatchBeforePageLeave(detail);\n const message = history.getBlockMessage();\n if (!previousMessage && message) {\n // Auto unblock only if new block was introduced by `onBeforePageLeave`.\n history.unblock();\n }\n return message;\n }\n\n #safeRedirect(\n to: string,\n state: NextHistoryState | undefined,\n from: NextLocation\n ): void {\n if (this.#redirectCount++ > 10) {\n const message = `Infinite redirect detected: from \"${from.pathname}${from.search}${from.hash}\" to \"${to}\"`;\n // istanbul ignore else: error cannot be caught in test\n if (process.env.NODE_ENV === \"test\") {\n // eslint-disable-next-line no-console\n console.error(message);\n return;\n } else {\n throw new Error(message);\n }\n }\n getHistory().replace(to, state);\n }\n\n bootstrap() {\n initAbortController();\n const history = getHistory();\n this.#prevLocation = history.location;\n let renderId = 0;\n history.listen(async (location, action) => {\n const currentRenderId = ++renderId;\n let ignoreRendering: boolean | undefined;\n const omittedLocationProps: Partial<NextLocation> = {\n hash: undefined,\n state: undefined,\n };\n // Omit the \"key\" when checking whether locations are equal in certain situations.\n if (\n // When current location is triggered by browser action of hash link.\n location.key === undefined ||\n // When current location is triggered by browser action of non-push-or-replace,\n // such as goBack or goForward,\n (action === \"POP\" &&\n // and the previous location was triggered by hash link,\n (this.#prevLocation.key === undefined ||\n // or the previous location specified notify false.\n this.#prevLocation.state?.notify === false))\n ) {\n omittedLocationProps.key = undefined;\n }\n if (\n locationsAreEqual(\n { ...this.#prevLocation, ...omittedLocationProps },\n { ...location, ...omittedLocationProps }\n ) ||\n (action !== \"POP\" && location.state?.notify === false)\n ) {\n // Ignore rendering if location not changed except hash, state and optional key.\n // Ignore rendering if notify is `false`.\n ignoreRendering = true;\n }\n\n if (!ignoreRendering && !location.state?.noIncremental) {\n ignoreRendering =\n await this.#rendererContext?.didPerformIncrementalRender(\n location,\n this.#prevLocation\n );\n }\n\n // Ignore stale renders\n if (renderId !== currentRenderId) {\n return;\n }\n\n if (ignoreRendering) {\n this.#prevLocation = location;\n return;\n }\n\n abortPendingRequest();\n this.#prevLocation = location;\n this.#rendererContext?.dispatchPageLeave();\n\n if (action === \"POP\") {\n const storyboard = matchStoryboard(\n this.#storyboards,\n location.pathname\n );\n // When a browser action of goBack or goForward is performing,\n // force reload when the target page is a page of an outside app.\n if (isOutsideApp(storyboard)) {\n window.location.reload();\n return;\n }\n }\n\n if (this.#rendering) {\n this.#nextLocation = location;\n } else {\n devtoolsHookEmit(\"locationChange\");\n this.#queuedRender(location).catch(handleHttpError);\n }\n });\n return this.#queuedRender(history.location);\n }\n\n async #queuedRender(location: NextLocation): Promise<void> {\n this.#rendering = true;\n try {\n await this.#render(location);\n } finally {\n this.#rendering = false;\n if (this.#nextLocation) {\n const nextLocation = this.#nextLocation;\n this.#nextLocation = undefined;\n await this.#queuedRender(nextLocation);\n }\n }\n }\n\n async #render(location: NextLocation): Promise<void> {\n const renderId = (this.#renderId = uniqueId(\"render-id-\"));\n\n resetAllComputedMarks();\n clearResolveCache();\n hooks?.flowApi?.clearCollectWidgetContract();\n\n const history = getHistory();\n history.unblock();\n\n // const renderStartTime = performance.now();\n const finishPageView = hooks?.pageView?.create();\n\n const storyboard = matchStoryboard(this.#storyboards, location.pathname);\n\n const previousApp = this.#runtimeContext?.app;\n const currentAppId = storyboard?.app?.id;\n // dynamically change the value of the APP variable, if it's union app\n if (\n window.BOOTSTRAP_UNION_FILE &&\n currentAppId &&\n currentAppId !== previousApp?.id\n ) {\n setAppVariable({\n appId: currentAppId,\n version: storyboard.app.currentVersion!,\n });\n }\n\n if (storyboard?.app) {\n await fulfilStoryboard(storyboard);\n }\n\n const currentApp = (this.#currentApp = storyboard?.app);\n\n setWatermark();\n\n // Storyboard maybe re-assigned, e.g. when open launchpad.\n const appChanged =\n previousApp && currentApp\n ? previousApp.id !== currentApp.id\n : previousApp !== currentApp;\n\n // TODO: handle favicon\n\n // Set `Router::#currentApp` before calling `getFeatureFlags()`\n const flags = getRuntime().getFeatureFlags();\n const prevRendererContext = this.#rendererContext;\n\n const redirectTo = (to: string, state?: NextHistoryState): void => {\n finishPageView?.({\n status: \"redirected\",\n });\n this.#rendererContextTrashCan.add(prevRendererContext);\n this.#safeRedirect(to, state, location);\n };\n\n const redirectToLogin = (): void => {\n const to = flags[\"sso-enabled\"] ? \"/sso-auth/login\" : \"/auth/login\";\n setLoginStateCookie(location);\n redirectTo(to, { from: location });\n };\n\n const main = document.querySelector(\"#main-mount-point\") as HTMLElement;\n const portal = document.querySelector(\"#portal-mount-point\") as HTMLElement;\n\n const renderRoot: RenderRoot = {\n tag: RenderTag.ROOT,\n container: main,\n createPortal: portal,\n };\n\n const cleanUpPreviousRender = (): void => {\n unmountTree(main);\n unmountTree(portal);\n\n // Note: redirects can lead to multiple trash renderer contexts.\n this.#rendererContextTrashCan.add(prevRendererContext);\n for (const item of this.#rendererContextTrashCan) {\n if (item) {\n item.dispatchOnUnmount();\n item.dispose();\n }\n }\n this.#rendererContextTrashCan.clear();\n hooks?.messageDispatcher?.reset();\n\n if (appChanged) {\n this.#previousApp = previousApp;\n window.dispatchEvent(\n new CustomEvent(\"app.change\", {\n detail: {\n previousApp,\n currentApp,\n },\n })\n );\n }\n };\n\n setTheme(\n (currentApp &&\n (getLocalAppsTheme()[currentApp.id] || currentApp.theme)) ||\n \"light\"\n );\n setMode(\"default\");\n\n if (currentApp) {\n hooks?.checkInstalledApps?.preCheckInstalledApps(\n storyboard,\n (appId) => !!_internalApiGetAppInBootstrapData(appId)\n );\n\n const routeHelper: RouteHelper = {\n bailout: (output) => {\n if (output.unauthenticated) {\n redirectToLogin();\n return true;\n }\n if (output.redirect) {\n redirectTo(output.redirect.path, output.redirect.state);\n return true;\n }\n // Reset redirect count if no redirect is set.\n this.#redirectCount = 0;\n },\n mergeMenus: async (menuRequests) => {\n const menuConfs = await Promise.all(menuRequests);\n this.#navConfig = mergeMenuConfs(menuConfs);\n window.dispatchEvent(\n new CustomEvent(\"navConfig.change\", { detail: this.#navConfig })\n );\n },\n catch: (error, returnNode) => {\n if (isUnauthenticatedError(error) && !window.NO_AUTH_GUARD) {\n redirectToLogin();\n return;\n } else if (error instanceof HttpAbortError) {\n this.#rendererContextTrashCan.add(prevRendererContext);\n return;\n } else {\n const noAuthGuardLoginPath =\n getRuntime().getMiscSettings().noAuthGuardLoginPath;\n if (isUnauthenticatedError(error) && noAuthGuardLoginPath) {\n redirectTo(noAuthGuardLoginPath as string, { from: location });\n return;\n }\n return {\n failed: true,\n output: {\n node: {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: httpErrorToString(error),\n dataset: {\n errorBoundary: \"\",\n },\n style: {\n color: \"var(--color-error)\",\n },\n },\n runtimeContext: null!,\n return: returnNode,\n },\n blockingList: [],\n },\n };\n }\n },\n };\n\n const rendererContext = (this.#rendererContext = new RendererContext(\n \"page\",\n { routeHelper, renderId }\n ));\n\n const runtimeContext: RuntimeContext = (this.#runtimeContext = {\n app: currentApp,\n location,\n query: new URLSearchParams(location.search),\n flags,\n sys: {\n ...hooks?.auth?.getAuth(),\n ...getPageInfo(),\n settings: {\n brand: getRuntime().getBrandSettings(),\n },\n },\n ctxStore: new DataStore(\"CTX\", undefined, rendererContext),\n pendingPermissionsPreCheck: [\n hooks?.checkPermissions?.preCheckPermissions(storyboard),\n ],\n tplStateStoreMap: new Map<string, DataStore<\"STATE\">>(),\n formStateStoreMap: new Map<string, DataStore<\"FORM_STATE\">>(),\n });\n\n this.#navConfig = undefined;\n\n registerCustomTemplates(storyboard);\n registerStoryboardFunctions(storyboard.meta?.functions, currentApp);\n hooks?.flowApi?.collectContract(storyboard.meta?.contracts);\n\n let failed = false;\n let output: RenderOutput;\n let stores: DataStore<\"CTX\" | \"STATE\" | \"FORM_STATE\">[] = [];\n\n try {\n clearMatchedRoutes();\n const rootMenuRequestNode: MenuRequestNode = {};\n output = await renderRoutes(\n renderRoot,\n insertPreviewRoutes(storyboard.routes),\n runtimeContext,\n rendererContext,\n [],\n rootMenuRequestNode\n );\n if (routeHelper.bailout(output)) {\n return;\n }\n\n stores = getDataStores(runtimeContext);\n\n await postAsyncRender(output, runtimeContext, stores);\n\n rootMenuRequestNode.child = output.menuRequestNode;\n rendererContext.setInitialMenuRequestNode(rootMenuRequestNode);\n await routeHelper.mergeMenus(rendererContext.getMenuRequests());\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Router failed:\", error);\n\n const result = routeHelper.catch(error, renderRoot);\n if (!result) {\n return;\n }\n ({ failed, output } = result);\n }\n renderRoot.child = output.node;\n\n cleanUpPreviousRender();\n\n if ((output.route && output.route.type !== \"routes\") || failed) {\n if (!failed) {\n // There is a window to set theme and mode by `lifeCycle.onBeforePageLoad`.\n rendererContext.dispatchBeforePageLoad();\n }\n applyTheme();\n applyMode();\n\n setUIVersion(currentApp?.uiVersion);\n mountTree(renderRoot);\n\n // Scroll to top after each rendering.\n // See https://github.com/ReactTraining/react-router/blob/master/packages/react-router-dom/docs/guides/scroll-restoration.md\n window.scrollTo(0, 0);\n\n if (!failed) {\n rendererContext.dispatchPageLoad();\n rendererContext.dispatchAnchorLoad();\n rendererContext.dispatchOnMount();\n rendererContext.initializeScrollIntoView();\n rendererContext.initializeMediaChange();\n rendererContext.initializeMessageDispatcher();\n\n for (const store of stores) {\n store.mountAsyncData();\n }\n\n finishPageView?.({\n status: \"ok\",\n path: output.path,\n pageTitle: document.title,\n });\n } else {\n finishPageView?.({ status: \"failed\" });\n }\n devtoolsHookEmit(\"rendered\");\n\n return;\n }\n } else if (\n !window.NO_AUTH_GUARD &&\n hooks?.auth &&\n !hooks.auth.isLoggedIn()\n ) {\n // Todo(steve): refine after api-gateway supports fetching storyboards before logged in.\n // Redirect to login if no storyboard is matched.\n redirectToLogin();\n return;\n } else {\n cleanUpPreviousRender();\n }\n\n applyTheme();\n applyMode();\n\n const node: RenderBrick = {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: \"Page not found\",\n },\n runtimeContext: null!,\n return: renderRoot,\n };\n renderRoot.child = node;\n\n mountTree(renderRoot);\n\n // Scroll to top after each rendering.\n window.scrollTo(0, 0);\n finishPageView?.({ status: \"not-found\" });\n devtoolsHookEmit(\"rendered\");\n }\n}\n\nfunction mergeMenuConfs(menuConfs: StaticMenuConf[]) {\n const navConfig = {\n breadcrumb: [] as BreadcrumbItemConf[],\n };\n for (const menuConf of menuConfs) {\n const { breadcrumb } = menuConf;\n if (breadcrumb) {\n if (breadcrumb.overwrite) {\n navConfig.breadcrumb = breadcrumb.items;\n } else {\n navConfig.breadcrumb.push(...breadcrumb.items);\n }\n }\n }\n return navConfig;\n}\n"],"mappings":";;;;;AAAA,SAAiBA,iBAAiB,QAAQ,SAAS;AAOnD,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,QAAQ,QAAQ,QAAQ;AACjC,SAAyCC,UAAU,QAAQ,eAAe;AAC1E,SAEEC,aAAa,EACb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,CAAC,CAAC;EAEX,MAAMqL,IAAiB,GAAG;IACxBxC,GAAG,EAAE3H,SAAS,CAACoK,KAAK;IACpBC,IAAI,EAAE,KAAK;IACXC,UAAU,EAAE;MACVC,WAAW,EAAE;IACf,CAAC;IACDK,cAAc,EAAE,IAAK;IACrBC,MAAM,EAAEnD;EACV,CAAC;EACDA,UAAU,CAAC4E,KAAK,GAAGnC,IAAI;EAEvB3L,SAAS,CAACkJ,UAAU,CAAC;;EAErB;EACA5F,MAAM,CAACgL,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;EACrB1G,cAAc,aAAdA,cAAc,eAAdA,cAAc,CAAG;IAAEe,MAAM,EAAE;EAAY,CAAC,CAAC;EACzCjH,gBAAgB,CAAC,UAAU,CAAC;AAC9B;AAGF,SAAS2J,cAAcA,CAACH,SAA2B,EAAE;EACnD,MAAMgE,SAAS,GAAG;IAChBC,UAAU,EAAE;EACd,CAAC;EACD,KAAK,MAAMC,QAAQ,IAAIlE,SAAS,EAAE;IAChC,MAAM;MAAEiE;IAAW,CAAC,GAAGC,QAAQ;IAC/B,IAAID,UAAU,EAAE;MACd,IAAIA,UAAU,CAACE,SAAS,EAAE;QACxBH,SAAS,CAACC,UAAU,GAAGA,UAAU,CAACG,KAAK;MACzC,CAAC,MAAM;QACLJ,SAAS,CAACC,UAAU,CAACI,IAAI,CAAC,GAAGJ,UAAU,CAACG,KAAK,CAAC;MAChD;IACF;EACF;EACA,OAAOJ,SAAS;AAClB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","names":[],"sources":["../../../src/internal/interfaces.ts"],"sourcesContent":["import type { LegacyCompatibleRuntimeContext } from \"@next-core/inject\";\nimport type {\n BrickEventHandler,\n BrickEventsMap,\n CustomTemplate,\n RouteConf,\n RuntimeSnippet,\n CustomTemplateProxy,\n CustomTemplateProxyBasicProperty,\n CustomTemplateProxySlot,\n SlotsConfOfBricks,\n Storyboard,\n StaticMenuConf,\n UseProviderResolveConf,\n} from \"@next-core/types\";\nimport type { DataStore } from \"./data/DataStore.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { RuntimeBrickConfWithTplSymbols } from \"./CustomTemplates/constants.js\";\nimport { RuntimeBrickConfOfFormSymbols } from \"./FormRenderer/constants.js\";\n\nexport interface RuntimeContext extends LegacyCompatibleRuntimeContext {\n ctxStore: DataStore<\"CTX\">;\n tplStateStoreMap: Map<string, DataStore<\"STATE\">>;\n pendingPermissionsPreCheck: (Promise<unknown> | undefined)[];\n tplStateStoreId?: string;\n // `useBrick` has a local tpl state store scope\n tplStateStoreScope?: DataStore<\"STATE\">[];\n forEachItem?: unknown;\n forEachIndex?: number;\n appendI18nNamespace?: string;\n\n formStateStoreMap: Map<string, DataStore<\"FORM_STATE\">>;\n formStateStoreId?: string;\n formStateStoreScope?: DataStore<\"FORM_STATE\">[];\n}\n\nexport type AsyncPropertyEntry = [\n name: string,\n value: Promise<unknown>,\n ignoreUndefined?: boolean,\n];\n\nexport interface ElementHolder {\n element?: HTMLElement | null;\n}\n\nexport interface RenderRoot extends BaseRenderNode {\n tag: RenderTag.ROOT;\n container?: HTMLElement | DocumentFragment;\n createPortal:\n | HTMLElement\n | DocumentFragment\n | (() => HTMLElement | DocumentFragment);\n}\n\nexport interface RenderBrick extends BaseRenderNode, RuntimeBrick {\n tag: RenderTag.BRICK;\n return: RenderReturnNode;\n hasTrackingControls?: boolean;\n}\n\nexport interface RenderPlaceholder extends BaseRenderNode {\n tag: RenderTag.PLACEHOLDER;\n return: RenderReturnNode;\n}\n\nexport interface BaseRenderNode {\n tag: RenderTag;\n child?: RenderChildNode;\n sibling?: RenderChildNode;\n return?: RenderReturnNode | null;\n childElements?: HTMLElement[];\n}\n\nexport type RenderNode = RenderRoot | RenderBrick | RenderPlaceholder;\n\nexport type RenderChildNode = RenderBrick | RenderPlaceholder;\nexport type RenderReturnNode = RenderRoot | RenderBrick;\n\nexport interface RuntimeBrick {\n type: string;\n properties?: Record<string, unknown>;\n events?: BrickEventsMap;\n slotId?: string;\n element?: RuntimeBrickElement | null;\n iid?: string;\n runtimeContext: RuntimeContext;\n tplHostMetadata?: TemplateHostMetadata;\n portal?: boolean;\n ref?: string;\n}\n\nexport type MetaInfoOfEventListener = [\n string,\n // For compatibility of devtools, leave the second argument there.\n null | undefined,\n BrickEventHandler,\n];\n\nexport type RememberedEventListener = [string, EventListener];\n\nexport interface RuntimeBrickElement extends HTMLElement {\n $$typeof?: \"brick\" | \"provider\" | \"custom-template\" | \"native\" | \"invalid\";\n /** Meta info of listeners, for devtools only */\n $$eventListeners?: MetaInfoOfEventListener[];\n /** Remembered listeners for unbinding */\n $$listeners?: RememberedEventListener[];\n /** Remembered proxy listeners for unbinding */\n $$proxyListeners?: RememberedEventListener[];\n /** Find element by ref in a custom template */\n $$getElementByRef?: (ref: string) => HTMLElement | null | undefined;\n $$tplStateStore?: DataStore<\"STATE\">;\n}\n\nexport interface TemplateHostMetadata {\n internalBricksByRef: Map<string, RuntimeBrick>;\n tplStateStoreId: string;\n proxy?: CustomTemplateProxy;\n}\n\nexport type TemplateHostBrick = RuntimeBrick & {\n tplHostMetadata: TemplateHostMetadata;\n};\n\nexport interface TemplateHostContext {\n reversedProxies: ReversedProxies;\n asyncHostPropertyEntries: AsyncPropertyEntry[];\n externalSlots?: SlotsConfOfBricks;\n tplStateStoreId: string;\n hostBrick: TemplateHostBrick;\n __temporary_tpl_tag_name?: string;\n}\n\ninterface ReversedProxies {\n properties: Map<string, ReversedPropertyProxy[]>;\n slots: Map<string, ReversedSlotProxy[]>;\n}\n\ninterface ReversedPropertyProxy {\n from: string;\n to: CustomTemplateProxyBasicProperty;\n}\n\ninterface ReversedSlotProxy {\n from: string;\n to: CustomTemplateProxySlot;\n}\n\nexport type RuntimeBrickConfWithSymbols = RuntimeBrickConfWithTplSymbols &\n RuntimeBrickConfOfFormSymbols;\n\nexport interface DataValueOption {\n tplStateStoreId?: string;\n}\n\nexport type PreviewStoryboardPatch =\n | CustomTemplate\n | RouteConf\n | RuntimeSnippet;\n\nexport interface PreviewOption {\n appId: string;\n formId?: string;\n updateStoryboardType?: \"route\" | \"template\" | \"snippet\";\n collectUsedContracts?(storyboard: Storyboard): string[] | Promise<string[]>;\n}\n\nexport interface MenuRequestNode {\n child?: MenuRequestNode;\n sibling?: MenuRequestNode;\n return?: MenuRequestNode;\n request?: Promise<StaticMenuConf>;\n}\n\nexport interface DebugDataValue {\n resolve?: UseProviderResolveConf;\n value?: unknown;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","names":[],"sources":["../../../src/internal/interfaces.ts"],"sourcesContent":["import type { LegacyCompatibleRuntimeContext } from \"@next-core/inject\";\nimport type {\n BrickEventHandler,\n BrickEventsMap,\n CustomTemplate,\n RouteConf,\n RuntimeSnippet,\n CustomTemplateProxy,\n CustomTemplateProxyBasicProperty,\n CustomTemplateProxySlot,\n SlotsConfOfBricks,\n Storyboard,\n StaticMenuConf,\n UseProviderResolveConf,\n MicroApp,\n} from \"@next-core/types\";\nimport type { DataStore } from \"./data/DataStore.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { RuntimeBrickConfWithTplSymbols } from \"./CustomTemplates/constants.js\";\nimport { RuntimeBrickConfOfFormSymbols } from \"./FormRenderer/constants.js\";\n\nexport interface RuntimeContext extends LegacyCompatibleRuntimeContext {\n ctxStore: DataStore<\"CTX\">;\n tplStateStoreMap: Map<string, DataStore<\"STATE\">>;\n pendingPermissionsPreCheck: (Promise<unknown> | undefined)[];\n tplStateStoreId?: string;\n // `useBrick` has a local tpl state store scope\n tplStateStoreScope?: DataStore<\"STATE\">[];\n forEachItem?: unknown;\n forEachIndex?: number;\n appendI18nNamespace?: string;\n\n formStateStoreMap: Map<string, DataStore<\"FORM_STATE\">>;\n formStateStoreId?: string;\n formStateStoreScope?: DataStore<\"FORM_STATE\">[];\n}\n\nexport type AsyncPropertyEntry = [\n name: string,\n value: Promise<unknown>,\n ignoreUndefined?: boolean,\n];\n\nexport interface ElementHolder {\n element?: HTMLElement | null;\n}\n\nexport interface RenderRoot extends BaseRenderNode {\n tag: RenderTag.ROOT;\n container?: HTMLElement | DocumentFragment;\n createPortal:\n | HTMLElement\n | DocumentFragment\n | (() => HTMLElement | DocumentFragment);\n}\n\nexport interface RenderBrick extends BaseRenderNode, RuntimeBrick {\n tag: RenderTag.BRICK;\n return: RenderReturnNode;\n hasTrackingControls?: boolean;\n}\n\nexport interface RenderPlaceholder extends BaseRenderNode {\n tag: RenderTag.PLACEHOLDER;\n return: RenderReturnNode;\n}\n\nexport interface BaseRenderNode {\n tag: RenderTag;\n child?: RenderChildNode;\n sibling?: RenderChildNode;\n return?: RenderReturnNode | null;\n childElements?: HTMLElement[];\n}\n\nexport type RenderNode = RenderRoot | RenderBrick | RenderPlaceholder;\n\nexport type RenderChildNode = RenderBrick | RenderPlaceholder;\nexport type RenderReturnNode = RenderRoot | RenderBrick;\n\nexport interface RuntimeBrick {\n type: string;\n properties?: Record<string, unknown>;\n events?: BrickEventsMap;\n slotId?: string;\n element?: RuntimeBrickElement | null;\n iid?: string;\n runtimeContext: RuntimeContext;\n tplHostMetadata?: TemplateHostMetadata;\n portal?: boolean;\n ref?: string;\n}\n\nexport type MetaInfoOfEventListener = [\n string,\n // For compatibility of devtools, leave the second argument there.\n null | undefined,\n BrickEventHandler,\n];\n\nexport type RememberedEventListener = [string, EventListener];\n\nexport interface RuntimeBrickElement extends HTMLElement {\n $$typeof?: \"brick\" | \"provider\" | \"custom-template\" | \"native\" | \"invalid\";\n /** Meta info of listeners, for devtools only */\n $$eventListeners?: MetaInfoOfEventListener[];\n /** Remembered listeners for unbinding */\n $$listeners?: RememberedEventListener[];\n /** Remembered proxy listeners for unbinding */\n $$proxyListeners?: RememberedEventListener[];\n /** Find element by ref in a custom template */\n $$getElementByRef?: (ref: string) => HTMLElement | null | undefined;\n $$tplStateStore?: DataStore<\"STATE\">;\n}\n\nexport interface TemplateHostMetadata {\n internalBricksByRef: Map<string, RuntimeBrick>;\n tplStateStoreId: string;\n proxy?: CustomTemplateProxy;\n}\n\nexport type TemplateHostBrick = RuntimeBrick & {\n tplHostMetadata: TemplateHostMetadata;\n};\n\nexport interface TemplateHostContext {\n reversedProxies: ReversedProxies;\n asyncHostPropertyEntries: AsyncPropertyEntry[];\n externalSlots?: SlotsConfOfBricks;\n tplStateStoreId: string;\n hostBrick: TemplateHostBrick;\n __temporary_tpl_tag_name?: string;\n}\n\ninterface ReversedProxies {\n properties: Map<string, ReversedPropertyProxy[]>;\n slots: Map<string, ReversedSlotProxy[]>;\n}\n\ninterface ReversedPropertyProxy {\n from: string;\n to: CustomTemplateProxyBasicProperty;\n}\n\ninterface ReversedSlotProxy {\n from: string;\n to: CustomTemplateProxySlot;\n}\n\nexport type RuntimeBrickConfWithSymbols = RuntimeBrickConfWithTplSymbols &\n RuntimeBrickConfOfFormSymbols;\n\nexport interface DataValueOption {\n tplStateStoreId?: string;\n routeId?: string;\n}\n\nexport type PreviewStoryboardPatch =\n | CustomTemplate\n | RouteConf\n | RuntimeSnippet;\n\nexport interface PreviewOption {\n appId: string;\n formId?: string;\n updateStoryboardType?: \"route\" | \"template\" | \"snippet\";\n collectUsedContracts?(storyboard: Storyboard): string[] | Promise<string[]>;\n}\n\nexport interface MenuRequestNode {\n child?: MenuRequestNode;\n sibling?: MenuRequestNode;\n return?: MenuRequestNode;\n request?: Promise<StaticMenuConf>;\n}\n\nexport interface DebugDataValue {\n resolve?: UseProviderResolveConf;\n value?: unknown;\n}\n\nexport interface RuntimeDataVale\n extends Pick<LegacyCompatibleRuntimeContext, \"match\" | \"sys\" | \"query\"> {\n location: {\n href: string;\n origin: string;\n hostname: string;\n host: string;\n };\n app?: MicroApp;\n}\n\nexport interface RuntimeDataValueOption {\n routeId?: string;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const routeMatchedMap = new Map();
|
|
2
|
+
export function setMatchedRoute(id, match) {
|
|
3
|
+
routeMatchedMap.set(id, match);
|
|
4
|
+
}
|
|
5
|
+
export function getMatchedRoute(id) {
|
|
6
|
+
return routeMatchedMap.get(id);
|
|
7
|
+
}
|
|
8
|
+
export function clearMatchedRoutes() {
|
|
9
|
+
return routeMatchedMap.clear();
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=routeMatchedMap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routeMatchedMap.js","names":["routeMatchedMap","Map","setMatchedRoute","id","match","set","getMatchedRoute","get","clearMatchedRoutes","clear"],"sources":["../../../src/internal/routeMatchedMap.ts"],"sourcesContent":["import type { LegacyCompatibleRuntimeContext } from \"@next-core/inject\";\n\ntype RouteMatched = LegacyCompatibleRuntimeContext[\"match\"];\n\nconst routeMatchedMap = new Map<string, RouteMatched>();\n\nexport function setMatchedRoute(id: string, match: RouteMatched): void {\n routeMatchedMap.set(id, match);\n}\n\nexport function getMatchedRoute(id: string): RouteMatched {\n return routeMatchedMap.get(id);\n}\n\nexport function clearMatchedRoutes(): void {\n return routeMatchedMap.clear();\n}\n"],"mappings":"AAIA,MAAMA,eAAe,GAAG,IAAIC,GAAG,CAAuB,CAAC;AAEvD,OAAO,SAASC,eAAeA,CAACC,EAAU,EAAEC,KAAmB,EAAQ;EACrEJ,eAAe,CAACK,GAAG,CAACF,EAAE,EAAEC,KAAK,CAAC;AAChC;AAEA,OAAO,SAASE,eAAeA,CAACH,EAAU,EAAgB;EACxD,OAAOH,eAAe,CAACO,GAAG,CAACJ,EAAE,CAAC;AAChC;AAEA,OAAO,SAASK,kBAAkBA,CAAA,EAAS;EACzC,OAAOR,eAAe,CAACS,KAAK,CAAC,CAAC;AAChC","ignoreList":[]}
|