@next-core/runtime 1.43.2 → 1.44.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"secret_internals.js","names":["_lodash","require","_Runtime","_Renderer","_RendererContext","_resolveData","_computeRealValue","_mount","_enums","_isStrictMode","_CustomTemplates","_registerAppI18n","_utils","_loader","_realTimeDataInspect","symbolForRootRuntimeContext","exports","Symbol","for","renderUseBrick","useBrick","data","_useBrick$symbolForRo","_scopedRuntimeContext","_scopedRuntimeContext2","_output$node","_output$node2","scopedRuntimeContext","tplStateStoreScope","formStateStoreScope","createScopedRuntimeContext","_internalApiGetRuntimeContext","pendingPermissionsPreCheck","tplStateStoreMap","Map","formStateStoreMap","rendererContext","RendererContext","renderRoot","tag","RenderTag","ROOT","createPortal","transform","strict","isStrictMode","warnAboutStrictMode","output","renderBrick","properties","scopedStores","postAsyncRender","node","PLACEHOLDER","Error","portal","child","tagName","type","mountUseBrick","element","portalRoot","document","querySelector","createElement","appendChild","mountTree","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","initializeMessageDispatcher","store","mountAsyncData","unmountUseBrick","mountResult","unmountTree","remove","dispatchOnUnmount","dispose","legacyDoTransform","to","options","computeRealValue","noInject","updateStoryboard","appId","storyboardPatch","storyboard","_internalApiGetStoryboardInBootstrapData","Object","assign","meta","$$fulfilling","$$fulfilled","$$registerCustomTemplateProcessed","registerAppI18n","updateStoryboardByRoute","newRoute","match","getKey","route","path","exact","replaceRoute","routes","key","map","routeKey","unshift","updateStoryboardByTemplate","newTemplate","settings","tplName","name","customTemplates","define","bricks","proxy","state","updateTemplatePreviewSettings","templateId","_updatePreviewSettings","brick","pick","getSnippetPreviewPath","snippetId","updateStoryboardBySnippet","snippetData","_snippetData$bricks","length","context","updateSnippetPreviewSettings","previewRouteIndex","findIndex","newPreviewRoute","menu","splice","getContextValue","tplStateStoreId","runtimeContext","tplStateStore","getTplStateStore","getValue","ctxStore","getAllContextValues","getAllValues","getBrickPackagesById","id","getBrickPackages","find","pkg","filePath","startsWith","loadBricks","loadBricksImperatively","getRenderId","_internalApiGetRenderId","getAddedContracts","updateStoryboardType","collectUsedContracts","updatedStoryboard","_storyboard$routes","snippetPreviewPath","currentRoute","addedContracts","contractApis","forEach","api","_storyboard$meta","_","namespaceId","contracts","some","contract","push","debugDataValue","debugData","resolve","resolveData","cache","asyncComputeRealValue","value"],"sources":["../../../src/internal/secret_internals.ts"],"sourcesContent":["import type {\n BrickConf,\n CustomTemplate,\n RouteConf,\n Storyboard,\n UseSingleBrickConf,\n RuntimeSnippet,\n ContextConf,\n} from \"@next-core/types\";\nimport { pick } from \"lodash\";\nimport {\n _internalApiGetRenderId,\n _internalApiGetRuntimeContext,\n _internalApiGetStoryboardInBootstrapData,\n getBrickPackages,\n} from \"./Runtime.js\";\nimport {\n createScopedRuntimeContext,\n postAsyncRender,\n renderBrick,\n} from \"./Renderer.js\";\nimport { RendererContext } from \"./RendererContext.js\";\nimport type { DataStore } from \"./data/DataStore.js\";\nimport { resolveData } from \"./data/resolveData.js\";\nimport { asyncComputeRealValue } from \"./compute/computeRealValue.js\";\nimport type {\n DataValueOption,\n PreviewOption,\n PreviewStoryboardPatch,\n RenderRoot,\n RuntimeContext,\n DebugDataValue,\n} from \"./interfaces.js\";\nimport { mountTree, unmountTree } from \"./mount.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { computeRealValue } from \"./compute/computeRealValue.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"../isStrictMode.js\";\nimport { customTemplates } from \"../CustomTemplates.js\";\nimport { registerAppI18n } from \"./registerAppI18n.js\";\nimport { getTplStateStore } from \"./CustomTemplates/utils.js\";\nimport { loadBricksImperatively } from \"@next-core/loader\";\n\nexport type { DataValueOption, RuntimeContext };\n\nexport const symbolForRootRuntimeContext = Symbol.for(\"root.runtimeContext\");\n\nexport interface RuntimeUseBrickConfWithRootSymbols extends UseSingleBrickConf {\n [symbolForRootRuntimeContext]?: RuntimeContext;\n}\n\nexport interface RenderUseBrickResult {\n tagName: string | null;\n renderRoot: RenderRoot;\n rendererContext: RendererContext;\n scopedStores: DataStore<\"STATE\" | \"FORM_STATE\">[];\n}\n\nexport async function renderUseBrick(\n useBrick: RuntimeUseBrickConfWithRootSymbols,\n data: unknown\n): Promise<RenderUseBrickResult> {\n const [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope] =\n createScopedRuntimeContext({\n ...(useBrick[symbolForRootRuntimeContext] ??\n _internalApiGetRuntimeContext()!),\n data,\n pendingPermissionsPreCheck: [],\n });\n\n scopedRuntimeContext.tplStateStoreMap ??= new Map();\n scopedRuntimeContext.formStateStoreMap ??= new Map();\n\n const rendererContext = new RendererContext(\"fragment\");\n\n const renderRoot: RenderRoot = {\n tag: RenderTag.ROOT,\n // Will set during `mountUseBrick`\n createPortal: null!,\n };\n\n const transform = (useBrick as { transform?: Record<string, unknown> })\n .transform;\n const strict = isStrictMode();\n if (transform) {\n warnAboutStrictMode(\n strict,\n \"`useBrick.transform`\",\n 'please use \"properties\" instead, check your useBrick:',\n useBrick\n );\n }\n\n const output = await renderBrick(\n renderRoot,\n strict\n ? useBrick\n : {\n ...useBrick,\n properties: {\n ...useBrick.properties,\n ...transform,\n },\n },\n scopedRuntimeContext,\n rendererContext,\n [],\n {}\n );\n\n const scopedStores = [...tplStateStoreScope, ...formStateStoreScope];\n\n await postAsyncRender(output, scopedRuntimeContext, scopedStores);\n\n if (output.node?.tag === RenderTag.PLACEHOLDER) {\n throw new Error(\n \"The root brick of useBrick cannot be an ignored control node\"\n );\n }\n\n if (output.node?.portal) {\n throw new Error(\"The root brick of useBrick cannot be a portal brick\");\n }\n\n renderRoot.child = output.node;\n\n const tagName = output.node ? output.node.type : null;\n\n return { tagName, renderRoot, rendererContext, scopedStores };\n}\n\nexport interface MountUseBrickResult {\n portal?: HTMLElement;\n}\n\nexport function mountUseBrick(\n { renderRoot, rendererContext, scopedStores }: RenderUseBrickResult,\n element: HTMLElement\n): MountUseBrickResult {\n let portal: HTMLElement | undefined;\n renderRoot.createPortal = () => {\n const portalRoot = document.querySelector(\n \"#portal-mount-point\"\n ) as HTMLElement;\n portal = document.createElement(\"div\");\n portalRoot.appendChild(portal);\n return portal;\n };\n\n mountTree(renderRoot, element);\n\n rendererContext.dispatchOnMount();\n rendererContext.initializeScrollIntoView();\n rendererContext.initializeMediaChange();\n rendererContext.initializeMessageDispatcher();\n\n for (const store of scopedStores) {\n store.mountAsyncData();\n }\n\n return {\n portal,\n };\n}\n\nexport function unmountUseBrick(\n { rendererContext }: RenderUseBrickResult,\n mountResult: MountUseBrickResult\n): void {\n // if (mountResult.mainBrick) {\n // mountResult.mainBrick.unmount();\n // }\n if (mountResult.portal) {\n unmountTree(mountResult.portal);\n mountResult.portal.remove();\n }\n rendererContext.dispatchOnUnmount();\n rendererContext.dispose();\n}\n\n/** For v2 compatibility of `doTransform` from brick-kit. */\nexport function legacyDoTransform(\n data: unknown,\n to: unknown,\n options?: unknown\n) {\n if (options) {\n throw new Error(\"Legacy doTransform does not support options in v3\");\n }\n return computeRealValue(\n to,\n {\n ..._internalApiGetRuntimeContext()!,\n data,\n },\n {\n noInject: true,\n }\n );\n}\n\nexport function updateStoryboard(\n appId: string,\n storyboardPatch: Partial<Storyboard>\n): void {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId)!;\n Object.assign(storyboard, {\n ...storyboardPatch,\n meta: {\n // Keep runtime fields such as `injectMenus`\n ...storyboard.meta,\n ...storyboardPatch.meta,\n },\n $$fulfilling: null,\n $$fulfilled: true,\n $$registerCustomTemplateProcessed: false,\n });\n registerAppI18n(storyboard);\n}\n\nexport function updateStoryboardByRoute(appId: string, newRoute: RouteConf) {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId)!;\n let match = false;\n const getKey = (route: RouteConf): string => `${route.path}.${route.exact}`;\n const replaceRoute = (routes: RouteConf[], key: string): RouteConf[] => {\n return routes.map((route) => {\n const routeKey = getKey(route);\n if (route.type === \"routes\") {\n route.routes = replaceRoute(route.routes, key);\n return route;\n } else if (routeKey === key) {\n match = true;\n return newRoute;\n } else {\n return route;\n }\n });\n };\n storyboard.routes = replaceRoute(storyboard.routes, getKey(newRoute));\n if (!match) {\n storyboard.routes.unshift(newRoute);\n }\n}\n\nexport function updateStoryboardByTemplate(\n appId: string,\n newTemplate: CustomTemplate,\n settings: unknown\n): void {\n const tplName = `${appId}.${newTemplate.name}`;\n // customTemplateRegistry.delete(tplName);\n customTemplates.define(tplName, {\n bricks: newTemplate.bricks,\n proxy: newTemplate.proxy,\n state: newTemplate.state,\n });\n updateTemplatePreviewSettings(appId, newTemplate.name, settings);\n}\n\nexport function updateTemplatePreviewSettings(\n appId: string,\n templateId: string,\n settings?: unknown\n): void {\n _updatePreviewSettings(\n appId,\n `\\${APP.homepage}/_dev_only_/template-preview/${templateId}`,\n [\n {\n brick: templateId,\n ...pick(\n settings,\n \"properties\",\n \"events\",\n \"lifeCycle\",\n \"context\",\n \"slots\",\n \"children\"\n ),\n },\n ]\n );\n}\n\nfunction getSnippetPreviewPath(snippetId: string): string {\n return `\\${APP.homepage}/_dev_only_/snippet-preview/${snippetId}`;\n}\n\nexport function updateStoryboardBySnippet(\n appId: string,\n snippetData: {\n snippetId: string;\n bricks?: BrickConf[];\n context?: ContextConf[];\n }\n): void {\n _updatePreviewSettings(\n appId,\n getSnippetPreviewPath(snippetData.snippetId),\n snippetData.bricks?.length ? snippetData.bricks : [{ brick: \"span\" }],\n snippetData.context\n );\n}\n\nexport const updateSnippetPreviewSettings = updateStoryboardBySnippet;\n\nfunction _updatePreviewSettings(\n appId: string,\n path: string,\n bricks: BrickConf[],\n context?: ContextConf[]\n) {\n const { routes } = _internalApiGetStoryboardInBootstrapData(appId)!;\n const previewRouteIndex = routes.findIndex((route) => route.path === path);\n const newPreviewRoute: RouteConf = {\n path,\n bricks,\n context,\n menu: false,\n exact: true,\n };\n if (previewRouteIndex === -1) {\n routes.unshift(newPreviewRoute);\n } else {\n routes.splice(previewRouteIndex, 1, newPreviewRoute);\n }\n}\n\nexport function getContextValue(\n name: string,\n { tplStateStoreId }: DataValueOption\n): unknown {\n const runtimeContext = _internalApiGetRuntimeContext()!;\n\n if (tplStateStoreId) {\n const tplStateStore = getTplStateStore(\n {\n ...runtimeContext,\n tplStateStoreId,\n },\n \"STATE\"\n );\n return tplStateStore.getValue(name);\n }\n\n return runtimeContext.ctxStore.getValue(name);\n}\n\nexport function getAllContextValues({\n tplStateStoreId,\n}: DataValueOption): Record<string, unknown> {\n const runtimeContext = _internalApiGetRuntimeContext()!;\n\n if (tplStateStoreId) {\n const tplStateStore = getTplStateStore(\n {\n ...runtimeContext,\n tplStateStoreId,\n },\n \"STATE\"\n );\n return tplStateStore.getAllValues();\n }\n\n return runtimeContext.ctxStore.getAllValues();\n}\n\nexport function getBrickPackagesById(id: string) {\n return getBrickPackages().find((pkg) =>\n pkg.id ? pkg.id === id : pkg.filePath.startsWith(id)\n );\n}\n\n/**\n * Support loading v3 bricks only.\n */\nexport function loadBricks(bricks: string[]) {\n return loadBricksImperatively(bricks, getBrickPackages());\n}\n\nexport function getRenderId() {\n return _internalApiGetRenderId();\n}\n\nexport async function getAddedContracts(\n storyboardPatch: PreviewStoryboardPatch,\n { appId, updateStoryboardType, collectUsedContracts }: PreviewOption\n): Promise<string[]> {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId);\n let updatedStoryboard;\n\n // 拿到更新部分的 storyboard 配置,然后扫描一遍,找到新增的 contracts\n if (updateStoryboardType === \"route\") {\n updatedStoryboard = {\n routes: [storyboardPatch as RouteConf],\n } as Storyboard;\n } else if (updateStoryboardType === \"template\") {\n updatedStoryboard = {\n meta: {\n customTemplates: [storyboardPatch as CustomTemplate],\n },\n } as Storyboard;\n } else if (updateStoryboardType === \"snippet\") {\n // snippet 是放在挂载 route 里预览,通过 previewPath 拿到当前修改 route\n const snippetPreviewPath = getSnippetPreviewPath(\n (storyboardPatch as RuntimeSnippet).snippetId\n );\n const currentRoute = storyboard?.routes?.find(\n (route) => route.path === snippetPreviewPath\n );\n\n updatedStoryboard = {\n routes: [currentRoute],\n } as Storyboard;\n }\n\n const addedContracts: string[] = [];\n\n if (updatedStoryboard && collectUsedContracts) {\n const contractApis = await collectUsedContracts(updatedStoryboard);\n\n contractApis.forEach((api: string) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [_, namespaceId, name] = api.match(\n /(.*)@(.*):\\d\\.\\d\\.\\d/\n ) as string[];\n\n if (\n !storyboard?.meta?.contracts?.some(\n (contract) =>\n contract.namespaceId === namespaceId && contract.name === name\n )\n ) {\n addedContracts.push(api);\n }\n });\n }\n\n return addedContracts;\n}\n\nexport async function debugDataValue(\n debugData: DebugDataValue,\n { tplStateStoreId }: DataValueOption\n): Promise<any> {\n const runtimeContext = {\n ..._internalApiGetRuntimeContext()!,\n tplStateStoreId,\n };\n\n if (debugData.resolve) {\n return resolveData(debugData.resolve!, runtimeContext, { cache: \"reload\" });\n }\n\n return asyncComputeRealValue(debugData.value, runtimeContext);\n}\n\nexport {\n setRealTimeDataInspectRoot,\n addRealTimeDataInspectHook,\n} from \"./data/realTimeDataInspect.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAMA,IAAAE,SAAA,GAAAF,OAAA;AAKA,IAAAG,gBAAA,GAAAH,OAAA;AAEA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AASA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAEA,IAAAQ,aAAA,GAAAR,OAAA;AACA,IAAAS,gBAAA,GAAAT,OAAA;AACA,IAAAU,gBAAA,GAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,OAAA,GAAAZ,OAAA;AAgaA,IAAAa,oBAAA,GAAAb,O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;IACvB,CAAe;EACjB;EAEA,MAAMC,cAAwB,GAAG,EAAE;EAEnC,IAAIJ,iBAAiB,IAAID,oBAAoB,EAAE;IAC7C,MAAMM,YAAY,GAAG,MAAMN,oBAAoB,CAACC,iBAAiB,CAAC;IAElEK,YAAY,CAACC,OAAO,CAAEC,GAAW,IAAK;MAAA,IAAAC,gBAAA;MACpC;MACA,MAAM,CAACC,CAAC,EAAEC,WAAW,EAAEzD,IAAI,CAAC,GAAGsD,GAAG,CAACrE,KAAK,CACtC,sBACF,CAAa;MAEb,IACE,EAACX,UAAU,aAAVA,UAAU,gBAAAiF,gBAAA,GAAVjF,UAAU,CAAEI,IAAI,cAAA6E,gBAAA,gBAAAA,gBAAA,GAAhBA,gBAAA,CAAkBG,SAAS,cAAAH,gBAAA,eAA3BA,gBAAA,CAA6BI,IAAI,CAC/BC,QAAQ,IACPA,QAAQ,CAACH,WAAW,KAAKA,WAAW,IAAIG,QAAQ,CAAC5D,IAAI,KAAKA,IAC9D,CAAC,GACD;QACAmD,cAAc,CAACU,IAAI,CAACP,GAAG,CAAC;MAC1B;IACF,CAAC,CAAC;EACJ;EAEA,OAAOH,cAAc;AACvB;AAEO,eAAeW,cAAcA,CAClCC,SAAyB,EACzB;EAAEtC;AAAiC,CAAC,EACtB;EACd,MAAMC,cAAc,GAAG;IACrB,GAAG,IAAA5G,sCAA6B,EAAC,CAAE;IACnC2G;EACF,CAAC;EAED,IAAIsC,SAAS,CAACC,OAAO,EAAE;IACrB,OAAO,IAAAC,wBAAW,EAACF,SAAS,CAACC,OAAO,EAAGtC,cAAc,EAAE;MAAEwC,KAAK,EAAE;IAAS,CAAC,CAAC;EAC7E;EAEA,OAAO,IAAAC,uCAAqB,EAACJ,SAAS,CAACK,KAAK,EAAE1C,cAAc,CAAC;AAC/D","ignoreList":[]}
1
+ {"version":3,"file":"secret_internals.js","names":["_lodash","require","_Runtime","_Renderer","_RendererContext","_resolveData","_computeRealValue","_mount","_enums","_isStrictMode","_CustomTemplates","_registerAppI18n","_utils","_loader","_realTimeDataInspect","symbolForRootRuntimeContext","exports","Symbol","for","renderUseBrick","useBrick","data","errorBoundary","_useBrick$symbolForRo","_scopedRuntimeContext","_scopedRuntimeContext2","_output$node","_output$node2","scopedRuntimeContext","tplStateStoreScope","formStateStoreScope","createScopedRuntimeContext","_internalApiGetRuntimeContext","pendingPermissionsPreCheck","tplStateStoreMap","Map","formStateStoreMap","rendererContext","RendererContext","renderRoot","tag","RenderTag","ROOT","createPortal","transform","strict","isStrictMode","warnAboutStrictMode","output","renderBrick","properties","scopedStores","postAsyncRender","node","PLACEHOLDER","Error","portal","child","tagName","type","mountUseBrick","element","portalRoot","document","querySelector","createElement","appendChild","mountTree","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","initializeMessageDispatcher","store","mountAsyncData","unmountUseBrick","mountResult","unmountTree","remove","dispatchOnUnmount","dispose","legacyDoTransform","to","options","computeRealValue","noInject","updateStoryboard","appId","storyboardPatch","storyboard","_internalApiGetStoryboardInBootstrapData","Object","assign","meta","$$fulfilling","$$fulfilled","$$registerCustomTemplateProcessed","registerAppI18n","updateStoryboardByRoute","newRoute","match","getKey","route","path","exact","replaceRoute","routes","key","map","routeKey","unshift","updateStoryboardByTemplate","newTemplate","settings","tplName","name","customTemplates","define","bricks","proxy","state","updateTemplatePreviewSettings","templateId","_updatePreviewSettings","brick","pick","getSnippetPreviewPath","snippetId","updateStoryboardBySnippet","snippetData","_snippetData$bricks","length","context","updateSnippetPreviewSettings","previewRouteIndex","findIndex","newPreviewRoute","menu","splice","getContextValue","tplStateStoreId","runtimeContext","tplStateStore","getTplStateStore","getValue","ctxStore","getAllContextValues","getAllValues","getBrickPackagesById","id","getBrickPackages","find","pkg","filePath","startsWith","loadBricks","loadBricksImperatively","getRenderId","_internalApiGetRenderId","getAddedContracts","updateStoryboardType","collectUsedContracts","updatedStoryboard","_storyboard$routes","snippetPreviewPath","currentRoute","addedContracts","contractApis","forEach","api","_storyboard$meta","_","namespaceId","contracts","some","contract","push","debugDataValue","debugData","resolve","resolveData","cache","asyncComputeRealValue","value"],"sources":["../../../src/internal/secret_internals.ts"],"sourcesContent":["import type {\n BrickConf,\n CustomTemplate,\n RouteConf,\n Storyboard,\n UseSingleBrickConf,\n RuntimeSnippet,\n ContextConf,\n} from \"@next-core/types\";\nimport { pick } from \"lodash\";\nimport {\n _internalApiGetRenderId,\n _internalApiGetRuntimeContext,\n _internalApiGetStoryboardInBootstrapData,\n getBrickPackages,\n} from \"./Runtime.js\";\nimport {\n createScopedRuntimeContext,\n postAsyncRender,\n renderBrick,\n} from \"./Renderer.js\";\nimport { RendererContext } from \"./RendererContext.js\";\nimport type { DataStore } from \"./data/DataStore.js\";\nimport { resolveData } from \"./data/resolveData.js\";\nimport { asyncComputeRealValue } from \"./compute/computeRealValue.js\";\nimport type {\n DataValueOption,\n PreviewOption,\n PreviewStoryboardPatch,\n RenderRoot,\n RuntimeContext,\n DebugDataValue,\n} from \"./interfaces.js\";\nimport { mountTree, unmountTree } from \"./mount.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { computeRealValue } from \"./compute/computeRealValue.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"../isStrictMode.js\";\nimport { customTemplates } from \"../CustomTemplates.js\";\nimport { registerAppI18n } from \"./registerAppI18n.js\";\nimport { getTplStateStore } from \"./CustomTemplates/utils.js\";\nimport { loadBricksImperatively } from \"@next-core/loader\";\n\nexport type { DataValueOption, RuntimeContext };\n\nexport const symbolForRootRuntimeContext = Symbol.for(\"root.runtimeContext\");\n\nexport interface RuntimeUseBrickConfWithRootSymbols extends UseSingleBrickConf {\n [symbolForRootRuntimeContext]?: RuntimeContext;\n}\n\nexport interface RenderUseBrickResult {\n tagName: string | null;\n renderRoot: RenderRoot;\n rendererContext: RendererContext;\n scopedStores: DataStore<\"STATE\" | \"FORM_STATE\">[];\n}\n\nexport async function renderUseBrick(\n useBrick: RuntimeUseBrickConfWithRootSymbols,\n data: unknown,\n errorBoundary?: boolean\n): Promise<RenderUseBrickResult> {\n const [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope] =\n createScopedRuntimeContext({\n ...(useBrick[symbolForRootRuntimeContext] ??\n _internalApiGetRuntimeContext()!),\n data,\n pendingPermissionsPreCheck: [],\n });\n\n scopedRuntimeContext.tplStateStoreMap ??= new Map();\n scopedRuntimeContext.formStateStoreMap ??= new Map();\n\n const rendererContext = new RendererContext(\"fragment\");\n\n const renderRoot: RenderRoot = {\n tag: RenderTag.ROOT,\n // Will set during `mountUseBrick`\n createPortal: null!,\n };\n\n const transform = (useBrick as { transform?: Record<string, unknown> })\n .transform;\n const strict = isStrictMode();\n if (transform) {\n warnAboutStrictMode(\n strict,\n \"`useBrick.transform`\",\n 'please use \"properties\" instead, check your useBrick:',\n useBrick\n );\n }\n\n const output = await renderBrick(\n renderRoot,\n strict && !errorBoundary\n ? useBrick\n : {\n errorBoundary,\n ...useBrick,\n properties: {\n ...useBrick.properties,\n ...transform,\n },\n },\n scopedRuntimeContext,\n rendererContext,\n [],\n {}\n );\n\n const scopedStores = [...tplStateStoreScope, ...formStateStoreScope];\n\n await postAsyncRender(output, scopedRuntimeContext, scopedStores);\n\n if (output.node?.tag === RenderTag.PLACEHOLDER) {\n throw new Error(\n \"The root brick of useBrick cannot be an ignored control node\"\n );\n }\n\n if (output.node?.portal) {\n throw new Error(\"The root brick of useBrick cannot be a portal brick\");\n }\n\n renderRoot.child = output.node;\n\n const tagName = output.node ? output.node.type : null;\n\n return { tagName, renderRoot, rendererContext, scopedStores };\n}\n\nexport interface MountUseBrickResult {\n portal?: HTMLElement;\n}\n\nexport function mountUseBrick(\n { renderRoot, rendererContext, scopedStores }: RenderUseBrickResult,\n element: HTMLElement\n): MountUseBrickResult {\n let portal: HTMLElement | undefined;\n renderRoot.createPortal = () => {\n const portalRoot = document.querySelector(\n \"#portal-mount-point\"\n ) as HTMLElement;\n portal = document.createElement(\"div\");\n portalRoot.appendChild(portal);\n return portal;\n };\n\n mountTree(renderRoot, element);\n\n rendererContext.dispatchOnMount();\n rendererContext.initializeScrollIntoView();\n rendererContext.initializeMediaChange();\n rendererContext.initializeMessageDispatcher();\n\n for (const store of scopedStores) {\n store.mountAsyncData();\n }\n\n return {\n portal,\n };\n}\n\nexport function unmountUseBrick(\n { rendererContext }: RenderUseBrickResult,\n mountResult: MountUseBrickResult\n): void {\n // if (mountResult.mainBrick) {\n // mountResult.mainBrick.unmount();\n // }\n if (mountResult.portal) {\n unmountTree(mountResult.portal);\n mountResult.portal.remove();\n }\n rendererContext.dispatchOnUnmount();\n rendererContext.dispose();\n}\n\n/** For v2 compatibility of `doTransform` from brick-kit. */\nexport function legacyDoTransform(\n data: unknown,\n to: unknown,\n options?: unknown\n) {\n if (options) {\n throw new Error(\"Legacy doTransform does not support options in v3\");\n }\n return computeRealValue(\n to,\n {\n ..._internalApiGetRuntimeContext()!,\n data,\n },\n {\n noInject: true,\n }\n );\n}\n\nexport function updateStoryboard(\n appId: string,\n storyboardPatch: Partial<Storyboard>\n): void {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId)!;\n Object.assign(storyboard, {\n ...storyboardPatch,\n meta: {\n // Keep runtime fields such as `injectMenus`\n ...storyboard.meta,\n ...storyboardPatch.meta,\n },\n $$fulfilling: null,\n $$fulfilled: true,\n $$registerCustomTemplateProcessed: false,\n });\n registerAppI18n(storyboard);\n}\n\nexport function updateStoryboardByRoute(appId: string, newRoute: RouteConf) {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId)!;\n let match = false;\n const getKey = (route: RouteConf): string => `${route.path}.${route.exact}`;\n const replaceRoute = (routes: RouteConf[], key: string): RouteConf[] => {\n return routes.map((route) => {\n const routeKey = getKey(route);\n if (route.type === \"routes\") {\n route.routes = replaceRoute(route.routes, key);\n return route;\n } else if (routeKey === key) {\n match = true;\n return newRoute;\n } else {\n return route;\n }\n });\n };\n storyboard.routes = replaceRoute(storyboard.routes, getKey(newRoute));\n if (!match) {\n storyboard.routes.unshift(newRoute);\n }\n}\n\nexport function updateStoryboardByTemplate(\n appId: string,\n newTemplate: CustomTemplate,\n settings: unknown\n): void {\n const tplName = `${appId}.${newTemplate.name}`;\n // customTemplateRegistry.delete(tplName);\n customTemplates.define(tplName, {\n bricks: newTemplate.bricks,\n proxy: newTemplate.proxy,\n state: newTemplate.state,\n });\n updateTemplatePreviewSettings(appId, newTemplate.name, settings);\n}\n\nexport function updateTemplatePreviewSettings(\n appId: string,\n templateId: string,\n settings?: unknown\n): void {\n _updatePreviewSettings(\n appId,\n `\\${APP.homepage}/_dev_only_/template-preview/${templateId}`,\n [\n {\n brick: templateId,\n ...pick(\n settings,\n \"properties\",\n \"events\",\n \"lifeCycle\",\n \"context\",\n \"slots\",\n \"children\"\n ),\n },\n ]\n );\n}\n\nfunction getSnippetPreviewPath(snippetId: string): string {\n return `\\${APP.homepage}/_dev_only_/snippet-preview/${snippetId}`;\n}\n\nexport function updateStoryboardBySnippet(\n appId: string,\n snippetData: {\n snippetId: string;\n bricks?: BrickConf[];\n context?: ContextConf[];\n }\n): void {\n _updatePreviewSettings(\n appId,\n getSnippetPreviewPath(snippetData.snippetId),\n snippetData.bricks?.length ? snippetData.bricks : [{ brick: \"span\" }],\n snippetData.context\n );\n}\n\nexport const updateSnippetPreviewSettings = updateStoryboardBySnippet;\n\nfunction _updatePreviewSettings(\n appId: string,\n path: string,\n bricks: BrickConf[],\n context?: ContextConf[]\n) {\n const { routes } = _internalApiGetStoryboardInBootstrapData(appId)!;\n const previewRouteIndex = routes.findIndex((route) => route.path === path);\n const newPreviewRoute: RouteConf = {\n path,\n bricks,\n context,\n menu: false,\n exact: true,\n };\n if (previewRouteIndex === -1) {\n routes.unshift(newPreviewRoute);\n } else {\n routes.splice(previewRouteIndex, 1, newPreviewRoute);\n }\n}\n\nexport function getContextValue(\n name: string,\n { tplStateStoreId }: DataValueOption\n): unknown {\n const runtimeContext = _internalApiGetRuntimeContext()!;\n\n if (tplStateStoreId) {\n const tplStateStore = getTplStateStore(\n {\n ...runtimeContext,\n tplStateStoreId,\n },\n \"STATE\"\n );\n return tplStateStore.getValue(name);\n }\n\n return runtimeContext.ctxStore.getValue(name);\n}\n\nexport function getAllContextValues({\n tplStateStoreId,\n}: DataValueOption): Record<string, unknown> {\n const runtimeContext = _internalApiGetRuntimeContext()!;\n\n if (tplStateStoreId) {\n const tplStateStore = getTplStateStore(\n {\n ...runtimeContext,\n tplStateStoreId,\n },\n \"STATE\"\n );\n return tplStateStore.getAllValues();\n }\n\n return runtimeContext.ctxStore.getAllValues();\n}\n\nexport function getBrickPackagesById(id: string) {\n return getBrickPackages().find((pkg) =>\n pkg.id ? pkg.id === id : pkg.filePath.startsWith(id)\n );\n}\n\n/**\n * Support loading v3 bricks only.\n */\nexport function loadBricks(bricks: string[]) {\n return loadBricksImperatively(bricks, getBrickPackages());\n}\n\nexport function getRenderId() {\n return _internalApiGetRenderId();\n}\n\nexport async function getAddedContracts(\n storyboardPatch: PreviewStoryboardPatch,\n { appId, updateStoryboardType, collectUsedContracts }: PreviewOption\n): Promise<string[]> {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId);\n let updatedStoryboard;\n\n // 拿到更新部分的 storyboard 配置,然后扫描一遍,找到新增的 contracts\n if (updateStoryboardType === \"route\") {\n updatedStoryboard = {\n routes: [storyboardPatch as RouteConf],\n } as Storyboard;\n } else if (updateStoryboardType === \"template\") {\n updatedStoryboard = {\n meta: {\n customTemplates: [storyboardPatch as CustomTemplate],\n },\n } as Storyboard;\n } else if (updateStoryboardType === \"snippet\") {\n // snippet 是放在挂载 route 里预览,通过 previewPath 拿到当前修改 route\n const snippetPreviewPath = getSnippetPreviewPath(\n (storyboardPatch as RuntimeSnippet).snippetId\n );\n const currentRoute = storyboard?.routes?.find(\n (route) => route.path === snippetPreviewPath\n );\n\n updatedStoryboard = {\n routes: [currentRoute],\n } as Storyboard;\n }\n\n const addedContracts: string[] = [];\n\n if (updatedStoryboard && collectUsedContracts) {\n const contractApis = await collectUsedContracts(updatedStoryboard);\n\n contractApis.forEach((api: string) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [_, namespaceId, name] = api.match(\n /(.*)@(.*):\\d\\.\\d\\.\\d/\n ) as string[];\n\n if (\n !storyboard?.meta?.contracts?.some(\n (contract) =>\n contract.namespaceId === namespaceId && contract.name === name\n )\n ) {\n addedContracts.push(api);\n }\n });\n }\n\n return addedContracts;\n}\n\nexport async function debugDataValue(\n debugData: DebugDataValue,\n { tplStateStoreId }: DataValueOption\n): Promise<any> {\n const runtimeContext = {\n ..._internalApiGetRuntimeContext()!,\n tplStateStoreId,\n };\n\n if (debugData.resolve) {\n return resolveData(debugData.resolve!, runtimeContext, { cache: \"reload\" });\n }\n\n return asyncComputeRealValue(debugData.value, runtimeContext);\n}\n\nexport {\n setRealTimeDataInspectRoot,\n addRealTimeDataInspectHook,\n} from \"./data/realTimeDataInspect.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAMA,IAAAE,SAAA,GAAAF,OAAA;AAKA,IAAAG,gBAAA,GAAAH,OAAA;AAEA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AASA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAEA,IAAAQ,aAAA,GAAAR,OAAA;AACA,IAAAS,gBAAA,GAAAT,OAAA;AACA,IAAAU,gBAAA,GAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,OAAA,GAAAZ,OAAA;AAkaA,IAAAa,oBAAA,GAAAb,OAAA;AA9ZO,MAAMc,2BAA2B,GAAAC,OAAA,CAAAD,2BAAA,GAAGE,MAAM,CAACC,GAAG,CAAC,qBAAqB,CAAC;AAarE,eAAeC,cAAcA,CAClCC,QAA4C,EAC5CC,IAAa,EACbC,aAAuB,EACQ;EAAA,IAAAC,q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ACC,iBAAiB,CAAC;IAElEK,YAAY,CAACC,OAAO,CAAEC,GAAW,IAAK;MAAA,IAAAC,gBAAA;MACpC;MACA,MAAM,CAACC,CAAC,EAAEC,WAAW,EAAEzD,IAAI,CAAC,GAAGsD,GAAG,CAACrE,KAAK,CACtC,sBACF,CAAa;MAEb,IACE,EAACX,UAAU,aAAVA,UAAU,gBAAAiF,gBAAA,GAAVjF,UAAU,CAAEI,IAAI,cAAA6E,gBAAA,gBAAAA,gBAAA,GAAhBA,gBAAA,CAAkBG,SAAS,cAAAH,gBAAA,eAA3BA,gBAAA,CAA6BI,IAAI,CAC/BC,QAAQ,IACPA,QAAQ,CAACH,WAAW,KAAKA,WAAW,IAAIG,QAAQ,CAAC5D,IAAI,KAAKA,IAC9D,CAAC,GACD;QACAmD,cAAc,CAACU,IAAI,CAACP,GAAG,CAAC;MAC1B;IACF,CAAC,CAAC;EACJ;EAEA,OAAOH,cAAc;AACvB;AAEO,eAAeW,cAAcA,CAClCC,SAAyB,EACzB;EAAEtC;AAAiC,CAAC,EACtB;EACd,MAAMC,cAAc,GAAG;IACrB,GAAG,IAAA5G,sCAA6B,EAAC,CAAE;IACnC2G;EACF,CAAC;EAED,IAAIsC,SAAS,CAACC,OAAO,EAAE;IACrB,OAAO,IAAAC,wBAAW,EAACF,SAAS,CAACC,OAAO,EAAGtC,cAAc,EAAE;MAAEwC,KAAK,EAAE;IAAS,CAAC,CAAC;EAC7E;EAEA,OAAO,IAAAC,uCAAqB,EAACJ,SAAS,CAACK,KAAK,EAAE1C,cAAc,CAAC;AAC/D","ignoreList":[]}
@@ -32,6 +32,7 @@ import { getPreEvaluatedRaw } from "./compute/evaluate.js";
32
32
  import { matchHomepage } from "./matchStoryboard.js";
33
33
  import { listenerFactory } from "./bindListeners.js";
34
34
  import { setupRootRuntimeContext } from "./setupRootRuntimeContext.js";
35
+ import { httpErrorToString } from "../handleHttpError.js";
35
36
  export function renderRoutes(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8) {
36
37
  return _renderRoutes.apply(this, arguments);
37
38
  }
@@ -138,9 +139,42 @@ export function renderBrick(_x18, _x19, _x20, _x21, _x22, _x23, _x24) {
138
139
  }
139
140
  function _renderBrick() {
140
141
  _renderBrick = _asyncToGenerator(function* (returnNode, brickConf, _runtimeContext, rendererContext, parentRoutes, menuRequestReturnNode, slotId) {
141
- var _hooks$checkPermissio2, _runtimeContext$app;
142
142
  var keyPath = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : [];
143
143
  var tplStack = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : new Map();
144
+ try {
145
+ return yield legacyRenderBrick(returnNode, brickConf, _runtimeContext, rendererContext, parentRoutes, menuRequestReturnNode, slotId, keyPath, tplStack);
146
+ } catch (error) {
147
+ if (brickConf.errorBoundary) {
148
+ // eslint-disable-next-line no-console
149
+ console.error("Error caught by error boundary:", error);
150
+ return {
151
+ node: {
152
+ tag: RenderTag.BRICK,
153
+ type: "div",
154
+ properties: {
155
+ textContent: httpErrorToString(error),
156
+ style: {
157
+ color: "var(--color-error)"
158
+ }
159
+ },
160
+ runtimeContext: null,
161
+ return: returnNode
162
+ },
163
+ blockingList: []
164
+ };
165
+ } else {
166
+ throw error;
167
+ }
168
+ }
169
+ });
170
+ return _renderBrick.apply(this, arguments);
171
+ }
172
+ function legacyRenderBrick(_x25, _x26, _x27, _x28, _x29, _x30, _x31, _x32, _x33) {
173
+ return _legacyRenderBrick.apply(this, arguments);
174
+ }
175
+ function _legacyRenderBrick() {
176
+ _legacyRenderBrick = _asyncToGenerator(function* (returnNode, brickConf, _runtimeContext, rendererContext, parentRoutes, menuRequestReturnNode, slotId, keyPath, tplStack) {
177
+ var _hooks$checkPermissio2, _runtimeContext$app;
144
178
  var output = getEmptyRenderOutput();
145
179
  if (!brickConf.brick) {
146
180
  if (brickConf.template) {
@@ -245,7 +279,7 @@ function _renderBrick() {
245
279
  }
246
280
  }
247
281
  });
248
- return function lowerLevelRenderControlNode(_x35) {
282
+ return function lowerLevelRenderControlNode(_x44) {
249
283
  return _ref.apply(this, arguments);
250
284
  };
251
285
  }();
@@ -259,7 +293,7 @@ function _renderBrick() {
259
293
  };
260
294
  return rawOutput;
261
295
  });
262
- return function renderControlNode(_x36) {
296
+ return function renderControlNode(_x45) {
263
297
  return _ref2.apply(this, arguments);
264
298
  };
265
299
  }();
@@ -537,7 +571,7 @@ function _renderBrick() {
537
571
  // In this case, we should continue to re-render the parent routes.
538
572
  return incrementalOutput.route ? true : null;
539
573
  });
540
- return function (_x37, _x38) {
574
+ return function (_x46, _x47) {
541
575
  return _ref8.apply(this, arguments);
542
576
  };
543
577
  }());
@@ -573,7 +607,7 @@ function _renderBrick() {
573
607
  yield Promise.all(blockingList);
574
608
  return output;
575
609
  });
576
- return _renderBrick.apply(this, arguments);
610
+ return _legacyRenderBrick.apply(this, arguments);
577
611
  }
578
612
  function isGeneralizedTrackAll(brickIf) {
579
613
  return typeof brickIf === "string" ? isTrackAll(brickIf) : isPreEvaluated(brickIf) &&
@@ -585,7 +619,7 @@ function ensureValidControlBrick(brick) {
585
619
  throw new Error("Unknown storyboard control node: \"".concat(brick, "\""));
586
620
  }
587
621
  }
588
- function renderForEach(_x25, _x26, _x27, _x28, _x29, _x30, _x31, _x32, _x33, _x34) {
622
+ function renderForEach(_x34, _x35, _x36, _x37, _x38, _x39, _x40, _x41, _x42, _x43) {
589
623
  return _renderForEach.apply(this, arguments);
590
624
  }
591
625
  function _renderForEach() {
@@ -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","renderRoutes","_x","_x2","_x3","_x4","_x5","_x6","_x7","_x8","_renderRoutes","apply","arguments","_asyncToGenerator","returnNode","routes","_runtimeContext","rendererContext","parentRoutes","menuRequestReturnNode","slotId","isIncremental","matched","output","getEmptyRenderOutput","menuRequestNode","return","unauthenticated","_hooks$checkPermissio","route","path","match","runtimeContext","_objectSpread","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","_x9","_x10","_x11","_x12","_x13","_x14","_x15","_x16","_x17","_renderBricks","tplStack","keyPath","kPath","rendered","Promise","all","map","brickConf","index","renderBrick","Map","forEach","item","hasTrackingControls","memoize","node","_x18","_x19","_x20","_x21","_x22","_x23","_x24","_renderBrick","_hooks$checkPermissio2","_runtimeContext$app","length","brick","template","if","brickIf","permissionsPreCheck","restBrickConf","_objectWithoutProperties","_excluded2","isGeneralizedTrackAll","dataSource","slots","Object","getOwnPropertySymbols","reduce","acc","symbol","tplStateStoreId","formStateStoreId","forEachItem","forEachIndex","strict","brickName","startsWith","_brickConf$lifeCycle","ensureValidControlBrick","lowerLevelRenderControlNode","_ref","_slots$slot","computedDataSource","slot","String","childrenToSlots","children","renderForEach","_x35","renderControlNode","_ref2","_rawOutput$node","rawOutput","tag","PLACEHOLDER","_x36","controlledOutput","onMount","onUnmount","lifeCycle","contextNames","stateNames","renderId","listener","_ref3","currentRenderId","scopedRuntimeContext","tplStateStoreScope","formStateStoreScope","createScopedRuntimeContext","reControlledOutput","scopedStores","postAsyncRender","CustomEvent","detail","rerender","reRender","store","mountAsyncData","debouncedListener","contextName","onChange","tplStateStore","registerArbitraryLifeCycle","test","get","catchLoad","unknownBricks","tplTagName","app","id","_tplStack$get","tplCount","set","includes","customElements","FormRendererElement","HTMLElement","$$typeof","formData","confProps","_brickConf$properties","_ref4","properties","_excluded3","trackingContextList","asyncPropertyEntries","computedPropsFromHost","isScript","props","src","rel","href","_window$PUBLIC_ROOT","prefix","window","PUBLIC_ROOT","attrs","_excluded4","_excluded5","BRICK","events","portal","iid","ref","usedProcessors","size","join","loadProperties","_ref5","registerBrickLifeCycle","expandedBrickConf","childRuntimeContext","loadChildren","_ref6","routeSlotFromIndexToSlotId","entries","_ref7","childSlotId","slotConf","parentRoute","incrementalSubRoutes","performIncrementalRender","_ref8","location","prevLocation","homepage","pathname","every","prevMatch","newMatch","params","query","URLSearchParams","search","failed","incrementalOutput","reBailout","reMergeMenuRequestNodes","result","reCatch","_x37","_x38","childrenOutput","has","mergeSiblingRenderMenuRequest","child","_x25","_x26","_x27","_x28","_x29","_x30","_x31","_x32","_x33","_x34","_renderForEach","rows","i","j","flat","getDataStores","tplStateStoreMap","values","formStateStoreMap","stores","waitForAll","menuConf","warn","rest","_excluded","last","sibling","assign","originalSlots","newSlots","process","env","NODE_ENV","_child$slot","promise","name","unknownPolicy","catch","e"],"sources":["../../../src/internal/Renderer.ts"],"sourcesContent":["import type {\n BrickConf,\n BrickConfInTemplate,\n ContextConf,\n MenuConf,\n RouteConf,\n 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\";\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 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,QAAQ,oBAAoB;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AC;IACb,KAAK,IAAM9B,KAAK,IAAIxH,QAAQ,EAAE;MAAA,IAAA0J,WAAA;MAC5B,IAAM7J,IAAI,IAAA6J,WAAA,GAAGlC,KAAK,CAAC3H,IAAI,cAAA6J,WAAA,cAAAA,WAAA,GAAI,EAAE;MAC7B,IAAI,CAACrU,cAAc,CAACiU,QAAQ,EAAEzJ,IAAI,CAAC,EAAE;QACnCyJ,QAAQ,CAACzJ,IAAI,CAAC,GAAG;UACfpF,IAAI,EAAE,QAAQ;UACde,MAAM,EAAE;QACV,CAAC;MACH;MACC8N,QAAQ,CAACzJ,IAAI,CAAC,CAAsBrE,MAAM,CAACvB,IAAI,CAACuN,KAAK,CAAC;IACzD;EACF;EACA,OAAO8B,QAAQ;AACjB;AAEA,SAAS9G,SAASA,CAChBmH,OAAyB,EACzBlP,IAAsD,EACtDmP,IAAY,EACZC,aAA+C,EAC/C;EACA,OAAOA,aAAa,KAAK,QAAQ,GAC7BF,OAAO,CAACG,KAAK,CAAEC,CAAC,IAAK;IACnB;IACAjP,OAAO,CAACC,KAAK,2BAAyBN,IAAI,EAAEmP,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","renderRoutes","_x","_x2","_x3","_x4","_x5","_x6","_x7","_x8","_renderRoutes","apply","arguments","_asyncToGenerator","returnNode","routes","_runtimeContext","rendererContext","parentRoutes","menuRequestReturnNode","slotId","isIncremental","matched","output","getEmptyRenderOutput","menuRequestNode","return","unauthenticated","_hooks$checkPermissio","route","path","match","runtimeContext","_objectSpread","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","_x9","_x10","_x11","_x12","_x13","_x14","_x15","_x16","_x17","_renderBricks","tplStack","keyPath","kPath","rendered","Promise","all","map","brickConf","index","renderBrick","Map","forEach","item","hasTrackingControls","memoize","node","_x18","_x19","_x20","_x21","_x22","_x23","_x24","_renderBrick","length","legacyRenderBrick","errorBoundary","tag","BRICK","properties","textContent","style","color","_x25","_x26","_x27","_x28","_x29","_x30","_x31","_x32","_x33","_legacyRenderBrick","_hooks$checkPermissio2","_runtimeContext$app","brick","template","if","brickIf","permissionsPreCheck","restBrickConf","_objectWithoutProperties","_excluded2","isGeneralizedTrackAll","dataSource","slots","Object","getOwnPropertySymbols","reduce","acc","symbol","tplStateStoreId","formStateStoreId","forEachItem","forEachIndex","strict","brickName","startsWith","_brickConf$lifeCycle","ensureValidControlBrick","lowerLevelRenderControlNode","_ref","_slots$slot","computedDataSource","slot","String","childrenToSlots","children","renderForEach","_x44","renderControlNode","_ref2","_rawOutput$node","rawOutput","PLACEHOLDER","_x45","controlledOutput","onMount","onUnmount","lifeCycle","contextNames","stateNames","renderId","listener","_ref3","currentRenderId","scopedRuntimeContext","tplStateStoreScope","formStateStoreScope","createScopedRuntimeContext","reControlledOutput","scopedStores","postAsyncRender","CustomEvent","detail","rerender","reRender","store","mountAsyncData","debouncedListener","contextName","onChange","tplStateStore","registerArbitraryLifeCycle","test","get","catchLoad","unknownBricks","tplTagName","app","id","_tplStack$get","tplCount","set","includes","customElements","FormRendererElement","HTMLElement","$$typeof","formData","confProps","_brickConf$properties","_ref4","_excluded3","trackingContextList","asyncPropertyEntries","computedPropsFromHost","isScript","props","src","rel","href","_window$PUBLIC_ROOT","prefix","window","PUBLIC_ROOT","attrs","_excluded4","_excluded5","events","portal","iid","ref","usedProcessors","size","join","loadProperties","_ref5","registerBrickLifeCycle","expandedBrickConf","childRuntimeContext","loadChildren","_ref6","routeSlotFromIndexToSlotId","entries","_ref7","childSlotId","slotConf","parentRoute","incrementalSubRoutes","performIncrementalRender","_ref8","location","prevLocation","homepage","pathname","every","prevMatch","newMatch","params","query","URLSearchParams","search","failed","incrementalOutput","reBailout","reMergeMenuRequestNodes","result","reCatch","_x46","_x47","childrenOutput","has","mergeSiblingRenderMenuRequest","child","_x34","_x35","_x36","_x37","_x38","_x39","_x40","_x41","_x42","_x43","_renderForEach","rows","i","j","flat","getDataStores","tplStateStoreMap","values","formStateStoreMap","stores","waitForAll","menuConf","warn","rest","_excluded","last","sibling","assign","originalSlots","newSlots","process","env","NODE_ENV","_child$slot","promise","name","unknownPolicy","catch","e"],"sources":["../../../src/internal/Renderer.ts"],"sourcesContent":["import type {\n BrickConf,\n BrickConfInTemplate,\n ContextConf,\n MenuConf,\n RouteConf,\n 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 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,E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]}
@@ -354,13 +354,15 @@ function _render2() {
354
354
  tag: RenderTag.BRICK,
355
355
  type: "div",
356
356
  properties: {
357
- textContent: httpErrorToString(error)
357
+ textContent: httpErrorToString(error),
358
+ style: {
359
+ color: "var(--color-error)"
360
+ }
358
361
  },
359
362
  runtimeContext: null,
360
363
  return: returnNode
361
364
  },
362
- blockingList: [],
363
- menuRequests: []
365
+ blockingList: []
364
366
  }
365
367
  };
366
368
  }