@next-core/runtime 1.47.0 → 1.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/internal/Renderer.js +4 -0
- package/dist/cjs/internal/Renderer.js.map +1 -1
- package/dist/cjs/internal/Router.js +2 -0
- package/dist/cjs/internal/Router.js.map +1 -1
- package/dist/cjs/internal/interfaces.js.map +1 -1
- package/dist/cjs/internal/routeMatchedMap.js +19 -0
- package/dist/cjs/internal/routeMatchedMap.js.map +1 -0
- package/dist/cjs/internal/secret_internals.js +15 -2
- package/dist/cjs/internal/secret_internals.js.map +1 -1
- package/dist/esm/internal/Renderer.js +4 -0
- package/dist/esm/internal/Renderer.js.map +1 -1
- package/dist/esm/internal/Router.js +2 -0
- package/dist/esm/internal/Router.js.map +1 -1
- package/dist/esm/internal/interfaces.js.map +1 -1
- package/dist/esm/internal/routeMatchedMap.js +11 -0
- package/dist/esm/internal/routeMatchedMap.js.map +1 -0
- package/dist/esm/internal/secret_internals.js +14 -2
- package/dist/esm/internal/secret_internals.js.map +1 -1
- package/dist/types/internal/interfaces.d.ts +14 -1
- package/dist/types/internal/routeMatchedMap.d.ts +6 -0
- package/dist/types/internal/secret_internals.d.ts +3 -2
- package/package.json +2 -2
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.clearMatchedRoutes = clearMatchedRoutes;
|
|
7
|
+
exports.getMatchedRoute = getMatchedRoute;
|
|
8
|
+
exports.setMatchedRoute = setMatchedRoute;
|
|
9
|
+
const routeMatchedMap = new Map();
|
|
10
|
+
function setMatchedRoute(id, match) {
|
|
11
|
+
routeMatchedMap.set(id, match);
|
|
12
|
+
}
|
|
13
|
+
function getMatchedRoute(id) {
|
|
14
|
+
return routeMatchedMap.get(id);
|
|
15
|
+
}
|
|
16
|
+
function clearMatchedRoutes() {
|
|
17
|
+
return routeMatchedMap.clear();
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=routeMatchedMap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routeMatchedMap.js","names":["routeMatchedMap","Map","setMatchedRoute","id","match","set","getMatchedRoute","get","clearMatchedRoutes","clear"],"sources":["../../../src/internal/routeMatchedMap.ts"],"sourcesContent":["import type { LegacyCompatibleRuntimeContext } from \"@next-core/inject\";\n\ntype RouteMatched = LegacyCompatibleRuntimeContext[\"match\"];\n\nconst routeMatchedMap = new Map<string, RouteMatched>();\n\nexport function setMatchedRoute(id: string, match: RouteMatched): void {\n routeMatchedMap.set(id, match);\n}\n\nexport function getMatchedRoute(id: string): RouteMatched {\n return routeMatchedMap.get(id);\n}\n\nexport function clearMatchedRoutes(): void {\n return routeMatchedMap.clear();\n}\n"],"mappings":";;;;;;;;AAIA,MAAMA,eAAe,GAAG,IAAIC,GAAG,CAAuB,CAAC;AAEhD,SAASC,eAAeA,CAACC,EAAU,EAAEC,KAAmB,EAAQ;EACrEJ,eAAe,CAACK,GAAG,CAACF,EAAE,EAAEC,KAAK,CAAC;AAChC;AAEO,SAASE,eAAeA,CAACH,EAAU,EAAgB;EACxD,OAAOH,eAAe,CAACO,GAAG,CAACJ,EAAE,CAAC;AAChC;AAEO,SAASK,kBAAkBA,CAAA,EAAS;EACzC,OAAOR,eAAe,CAACS,KAAK,CAAC,CAAC;AAChC","ignoreList":[]}
|
|
@@ -14,6 +14,7 @@ exports.getAddedContracts = getAddedContracts;
|
|
|
14
14
|
exports.getAllContextValues = getAllContextValues;
|
|
15
15
|
exports.getBrickPackagesById = getBrickPackagesById;
|
|
16
16
|
exports.getContextValue = getContextValue;
|
|
17
|
+
exports.getLegalRuntimeValue = getLegalRuntimeValue;
|
|
17
18
|
exports.getRenderId = getRenderId;
|
|
18
19
|
exports.legacyDoTransform = legacyDoTransform;
|
|
19
20
|
exports.loadBricks = loadBricks;
|
|
@@ -47,6 +48,7 @@ var _CustomTemplates = require("../CustomTemplates.js");
|
|
|
47
48
|
var _registerAppI18n = require("./registerAppI18n.js");
|
|
48
49
|
var _utils = require("./CustomTemplates/utils.js");
|
|
49
50
|
var _loader = require("@next-core/loader");
|
|
51
|
+
var _routeMatchedMap = require("./routeMatchedMap.js");
|
|
50
52
|
var _realTimeDataInspect = require("./data/realTimeDataInspect.js");
|
|
51
53
|
const symbolForRootRuntimeContext = exports.symbolForRootRuntimeContext = Symbol.for("root.runtimeContext");
|
|
52
54
|
async function renderUseBrick(useBrick, data, errorBoundary) {
|
|
@@ -311,11 +313,13 @@ async function getAddedContracts(storyboardPatch, {
|
|
|
311
313
|
return addedContracts;
|
|
312
314
|
}
|
|
313
315
|
async function debugDataValue(debugData, {
|
|
314
|
-
tplStateStoreId
|
|
316
|
+
tplStateStoreId,
|
|
317
|
+
routeId
|
|
315
318
|
}) {
|
|
316
319
|
const runtimeContext = {
|
|
317
320
|
...(0, _Runtime._internalApiGetRuntimeContext)(),
|
|
318
|
-
tplStateStoreId
|
|
321
|
+
tplStateStoreId,
|
|
322
|
+
match: (0, _routeMatchedMap.getMatchedRoute)(routeId)
|
|
319
323
|
};
|
|
320
324
|
if (debugData.resolve) {
|
|
321
325
|
return (0, _resolveData.resolveData)(debugData.resolve, runtimeContext, {
|
|
@@ -324,4 +328,13 @@ async function debugDataValue(debugData, {
|
|
|
324
328
|
}
|
|
325
329
|
return (0, _computeRealValue.asyncComputeRealValue)(debugData.value, runtimeContext);
|
|
326
330
|
}
|
|
331
|
+
function getLegalRuntimeValue(options) {
|
|
332
|
+
const runtimeContext = (0, _Runtime._internalApiGetRuntimeContext)();
|
|
333
|
+
return {
|
|
334
|
+
app: (runtimeContext === null || runtimeContext === void 0 ? void 0 : runtimeContext.overrideApp) ?? (runtimeContext === null || runtimeContext === void 0 ? void 0 : runtimeContext.app),
|
|
335
|
+
location: (0, _lodash.pick)(location, ["href", "origin", "hostname", "host"]),
|
|
336
|
+
...(0, _lodash.pick)(runtimeContext, ["query", "sys"]),
|
|
337
|
+
match: (0, _routeMatchedMap.getMatchedRoute)(options === null || options === void 0 ? void 0 : options.routeId)
|
|
338
|
+
};
|
|
339
|
+
}
|
|
327
340
|
//# sourceMappingURL=secret_internals.js.map
|
|
@@ -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","errorBoundary","_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","loadEditors","editors","loadEditorsImperatively","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 {\n loadBricksImperatively,\n loadEditorsImperatively,\n} 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 loadEditors(editors: string[] | Set<string>) {\n return loadEditorsImperatively(editors, 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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AAqB,EAACJ,SAAS,CAACK,KAAK,EAAE7C,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","_routeMatchedMap","_realTimeDataInspect","symbolForRootRuntimeContext","exports","Symbol","for","renderUseBrick","useBrick","data","errorBoundary","_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","loadEditors","editors","loadEditorsImperatively","getRenderId","_internalApiGetRenderId","getAddedContracts","updateStoryboardType","collectUsedContracts","updatedStoryboard","_storyboard$routes","snippetPreviewPath","currentRoute","addedContracts","contractApis","forEach","api","_storyboard$meta","_","namespaceId","contracts","some","contract","push","debugDataValue","debugData","routeId","getMatchedRoute","resolve","resolveData","cache","asyncComputeRealValue","value","getLegalRuntimeValue","app","overrideApp","location"],"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 RuntimeDataVale,\n RuntimeDataValueOption,\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 {\n loadBricksImperatively,\n loadEditorsImperatively,\n} from \"@next-core/loader\";\nimport { getMatchedRoute } from \"./routeMatchedMap.js\";\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 loadEditors(editors: string[] | Set<string>) {\n return loadEditorsImperatively(editors, 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, routeId }: DataValueOption\n): Promise<any> {\n const runtimeContext = {\n ..._internalApiGetRuntimeContext()!,\n tplStateStoreId,\n match: getMatchedRoute(routeId as string),\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 function getLegalRuntimeValue(\n options?: RuntimeDataValueOption\n): RuntimeDataVale {\n const runtimeContext = _internalApiGetRuntimeContext();\n\n return {\n app: runtimeContext?.overrideApp ?? runtimeContext?.app,\n location: pick(location, [\"href\", \"origin\", \"hostname\", \"host\"]),\n ...pick(runtimeContext, [\"query\", \"sys\"]),\n match: getMatchedRoute(options?.routeId as string),\n } as RuntimeDataVale;\n}\n\nexport {\n setRealTimeDataInspectRoot,\n addRealTimeDataInspectHook,\n} from \"./data/realTimeDataInspect.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;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ClCC,SAAyB,EACzB;EAAEzC,eAAe;EAAE0C;AAAyB,CAAC,EAC/B;EACd,MAAMzC,cAAc,GAAG;IACrB,GAAG,IAAA5G,sCAA6B,EAAC,CAAE;IACnC2G,eAAe;IACfxC,KAAK,EAAE,IAAAmF,gCAAe,EAACD,OAAiB;EAC1C,CAAC;EAED,IAAID,SAAS,CAACG,OAAO,EAAE;IACrB,OAAO,IAAAC,wBAAW,EAACJ,SAAS,CAACG,OAAO,EAAG3C,cAAc,EAAE;MAAE6C,KAAK,EAAE;IAAS,CAAC,CAAC;EAC7E;EAEA,OAAO,IAAAC,uCAAqB,EAACN,SAAS,CAACO,KAAK,EAAE/C,cAAc,CAAC;AAC/D;AAEO,SAASgD,oBAAoBA,CAClC1G,OAAgC,EACf;EACjB,MAAM0D,cAAc,GAAG,IAAA5G,sCAA6B,EAAC,CAAC;EAEtD,OAAO;IACL6J,GAAG,EAAE,CAAAjD,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAEkD,WAAW,MAAIlD,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAEiD,GAAG;IACvDE,QAAQ,EAAE,IAAAnE,YAAI,EAACmE,QAAQ,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IAChE,GAAG,IAAAnE,YAAI,EAACgB,cAAc,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACzCzC,KAAK,EAAE,IAAAmF,gCAAe,EAACpG,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEmG,OAAiB;EACnD,CAAC;AACH","ignoreList":[]}
|
|
@@ -25,6 +25,7 @@ import { matchHomepage } from "./matchStoryboard.js";
|
|
|
25
25
|
import { listenerFactory } from "./bindListeners.js";
|
|
26
26
|
import { setupRootRuntimeContext } from "./setupRootRuntimeContext.js";
|
|
27
27
|
import { httpErrorToString } from "../handleHttpError.js";
|
|
28
|
+
import { setMatchedRoute } from "./routeMatchedMap.js";
|
|
28
29
|
export async function renderRoutes(returnNode, routes, _runtimeContext, rendererContext, parentRoutes, menuRequestReturnNode, slotId, isIncremental) {
|
|
29
30
|
const matched = await matchRoutes(routes, _runtimeContext);
|
|
30
31
|
const output = getEmptyRenderOutput();
|
|
@@ -46,6 +47,9 @@ export async function renderRoutes(returnNode, routes, _runtimeContext, renderer
|
|
|
46
47
|
..._runtimeContext,
|
|
47
48
|
match: matched.match
|
|
48
49
|
};
|
|
50
|
+
if (route.iid) {
|
|
51
|
+
setMatchedRoute(route.iid, matched.match);
|
|
52
|
+
}
|
|
49
53
|
if (isIncremental) {
|
|
50
54
|
runtimeContext.ctxStore.disposeDataInRoutes(routes);
|
|
51
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Renderer.js","names":["enqueueStableLoadBricks","flushStableLoadBricks","loadBricksImperatively","loadProcessorsImperatively","loadScript","loadStyle","isTrackAll","hasOwnProperty","strictCollectMemberUsage","debounce","isEqual","asyncCheckBrickIf","asyncComputeRealPropertyEntries","constructAsyncProperties","resolveData","asyncComputeRealValue","listenOnTrackingContext","matchRoute","matchRoutes","symbolForAsyncComputedPropsFromHost","symbolForTPlExternalForEachIndex","symbolForTPlExternalForEachItem","symbolForTPlExternalNoForEach","symbolForTplStateStoreId","expandCustomTemplate","getTagNameOfCustomTemplate","getTplStateStore","customTemplates","getBrickPackages","hooks","RenderTag","getTracks","isStrictMode","warnAboutStrictMode","FORM_RENDERER","symbolForFormStateStoreId","expandFormRenderer","isPreEvaluated","getPreEvaluatedRaw","matchHomepage","listenerFactory","setupRootRuntimeContext","httpErrorToString","renderRoutes","returnNode","routes","_runtimeContext","rendererContext","parentRoutes","menuRequestReturnNode","slotId","isIncremental","matched","output","getEmptyRenderOutput","menuRequestNode","return","unauthenticated","_hooks$checkPermissio","route","path","match","runtimeContext","ctxStore","disposeDataInRoutes","routePath","concat","define","context","undefined","pendingPermissionsPreCheck","push","checkPermissions","preCheckPermissionsForBrickOrRoute","value","preLoadBricks","Array","isArray","blockingList","type","redirectTo","redirect","resolved","transform","console","error","Error","menuRequest","loadMenu","menu","request","memoizeMenuRequestNode","newOutput","renderBricks","bricks","mergeRenderOutput","appendMenuRequestNode","tplStack","keyPath","kPath","rendered","Promise","all","map","brickConf","index","renderBrick","Map","forEach","item","hasTrackingControls","memoize","node","arguments","length","legacyRenderBrick","errorBoundary","tag","BRICK","properties","textContent","dataset","style","color","_hooks$checkPermissio2","_runtimeContext$app","brick","template","if","brickIf","permissionsPreCheck","restBrickConf","isGeneralizedTrackAll","dataSource","slots","Object","getOwnPropertySymbols","reduce","acc","symbol","tplStateStoreId","formStateStoreId","forEachItem","forEachIndex","strict","brickName","startsWith","ensureValidControlBrick","lowerLevelRenderControlNode","_slots$slot","computedDataSource","slot","String","childrenToSlots","children","renderForEach","renderControlNode","rawOutput","PLACEHOLDER","controlledOutput","onMount","onUnmount","lifeCycle","contextNames","stateNames","renderId","listener","currentRenderId","scopedRuntimeContext","tplStateStoreScope","formStateStoreScope","createScopedRuntimeContext","reControlledOutput","scopedStores","postAsyncRender","CustomEvent","detail","rerender","reRender","store","mountAsyncData","debouncedListener","contextName","onChange","tplStateStore","registerArbitraryLifeCycle","test","get","catchLoad","unknownBricks","tplTagName","app","id","tplCount","set","includes","customElements","FormRendererElement","HTMLElement","$$typeof","formData","confProps","trackingContextList","asyncPropertyEntries","computedPropsFromHost","isScript","props","src","rel","href","prefix","window","PUBLIC_ROOT","attrs","events","portal","iid","ref","usedProcessors","size","join","loadProperties","registerBrickLifeCycle","expandedBrickConf","childRuntimeContext","loadChildren","routeSlotFromIndexToSlotId","entries","_ref","childSlotId","slotConf","parentRoute","incrementalSubRoutes","performIncrementalRender","location","prevLocation","homepage","pathname","every","prevMatch","newMatch","params","query","URLSearchParams","search","failed","incrementalOutput","reBailout","reMergeMenuRequestNodes","result","reCatch","childrenOutput","has","mergeSiblingRenderMenuRequest","child","rows","i","j","flat","getDataStores","tplStateStoreMap","values","formStateStoreMap","stores","waitForAll","menuConf","warn","rest","last","sibling","assign","originalSlots","newSlots","process","env","NODE_ENV","promise","name","unknownPolicy","catch","e"],"sources":["../../../src/internal/Renderer.ts"],"sourcesContent":["import type {\n BrickConf,\n BrickConfInTemplate,\n ContextConf,\n MenuConf,\n RouteConf,\n RouteConfOfBricks,\n SlotConfOfBricks,\n SlotsConf,\n StaticMenuConf,\n} from \"@next-core/types\";\nimport {\n enqueueStableLoadBricks,\n flushStableLoadBricks,\n loadBricksImperatively,\n loadProcessorsImperatively,\n loadScript,\n loadStyle,\n} from \"@next-core/loader\";\nimport { isTrackAll } from \"@next-core/cook\";\nimport { hasOwnProperty } from \"@next-core/utils/general\";\nimport { strictCollectMemberUsage } from \"@next-core/utils/storyboard\";\nimport { debounce, isEqual } from \"lodash\";\nimport { asyncCheckBrickIf } from \"./compute/checkIf.js\";\nimport {\n asyncComputeRealPropertyEntries,\n constructAsyncProperties,\n} from \"./compute/computeRealProperties.js\";\nimport { resolveData } from \"./data/resolveData.js\";\nimport { asyncComputeRealValue } from \"./compute/computeRealValue.js\";\nimport {\n TrackingContextItem,\n listenOnTrackingContext,\n} from \"./compute/listenOnTrackingContext.js\";\nimport { RendererContext } from \"./RendererContext.js\";\nimport { matchRoute, matchRoutes } from \"./matchRoutes.js\";\nimport {\n symbolForAsyncComputedPropsFromHost,\n symbolForTPlExternalForEachIndex,\n symbolForTPlExternalForEachItem,\n symbolForTPlExternalNoForEach,\n symbolForTplStateStoreId,\n} from \"./CustomTemplates/constants.js\";\nimport { expandCustomTemplate } from \"./CustomTemplates/expandCustomTemplate.js\";\nimport type {\n MenuRequestNode,\n RenderBrick,\n RenderChildNode,\n RenderReturnNode,\n RuntimeBrickConfWithSymbols,\n RuntimeContext,\n} from \"./interfaces.js\";\nimport {\n getTagNameOfCustomTemplate,\n getTplStateStore,\n} from \"./CustomTemplates/utils.js\";\nimport { customTemplates } from \"../CustomTemplates.js\";\nimport type { NextHistoryState } from \"./historyExtended.js\";\nimport { getBrickPackages, hooks } from \"./Runtime.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { getTracks } from \"./compute/getTracks.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"../isStrictMode.js\";\nimport {\n FORM_RENDERER,\n RuntimeBrickConfOfFormSymbols,\n symbolForFormStateStoreId,\n} from \"./FormRenderer/constants.js\";\nimport { expandFormRenderer } from \"./FormRenderer/expandFormRenderer.js\";\nimport { isPreEvaluated } from \"./compute/evaluate.js\";\nimport { getPreEvaluatedRaw } from \"./compute/evaluate.js\";\nimport { RuntimeBrickConfOfTplSymbols } from \"./CustomTemplates/constants.js\";\nimport { matchHomepage } from \"./matchStoryboard.js\";\nimport type { DataStore, DataStoreType } from \"./data/DataStore.js\";\nimport { listenerFactory } from \"./bindListeners.js\";\nimport type { MatchResult } from \"./matchPath.js\";\nimport { setupRootRuntimeContext } from \"./setupRootRuntimeContext.js\";\nimport { httpErrorToString } from \"../handleHttpError.js\";\n\nexport interface RenderOutput {\n node?: RenderChildNode;\n unauthenticated?: boolean;\n redirect?: {\n path: string;\n state?: NextHistoryState;\n };\n route?: RouteConf;\n path?: string;\n blockingList: (Promise<unknown> | undefined)[];\n menuRequestNode?: MenuRequestNode;\n hasTrackingControls?: boolean;\n}\n\nexport async function renderRoutes(\n returnNode: RenderReturnNode,\n routes: RouteConf[],\n _runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n menuRequestReturnNode: MenuRequestNode,\n slotId?: string,\n isIncremental?: boolean\n): Promise<RenderOutput> {\n const matched = await matchRoutes(routes, _runtimeContext);\n const output = getEmptyRenderOutput();\n const menuRequestNode: MenuRequestNode = (output.menuRequestNode = {\n return: menuRequestReturnNode,\n });\n switch (matched) {\n case \"missed\":\n break;\n case \"unauthenticated\":\n output.unauthenticated = true;\n break;\n default: {\n const route = (output.route = matched.route);\n output.path = matched.match.path;\n const runtimeContext = {\n ..._runtimeContext,\n match: matched.match,\n };\n if (isIncremental) {\n runtimeContext.ctxStore.disposeDataInRoutes(routes);\n }\n const routePath = parentRoutes.concat(route);\n runtimeContext.ctxStore.define(\n route.context,\n runtimeContext,\n undefined,\n routePath\n );\n runtimeContext.pendingPermissionsPreCheck.push(\n hooks?.checkPermissions?.preCheckPermissionsForBrickOrRoute(\n route,\n (value) => asyncComputeRealValue(value, runtimeContext)\n )\n );\n\n // Currently, this is only used for brick size-checking: these bricks\n // will be loaded before page rendering, but they will NOT be rendered.\n const { preLoadBricks } = route as { preLoadBricks?: string[] };\n if (Array.isArray(preLoadBricks)) {\n output.blockingList.push(\n loadBricksImperatively(preLoadBricks, getBrickPackages())\n );\n }\n\n if (route.type === \"redirect\") {\n let redirectTo: unknown;\n if (typeof route.redirect === \"string\") {\n redirectTo = await asyncComputeRealValue(\n route.redirect,\n runtimeContext\n );\n } else {\n const resolved = (await resolveData(\n {\n transform: \"redirect\",\n ...route.redirect,\n },\n runtimeContext\n )) as { redirect?: unknown };\n redirectTo = resolved.redirect;\n }\n if (typeof redirectTo !== \"string\") {\n // eslint-disable-next-line no-console\n console.error(\"Unexpected redirect result:\", redirectTo);\n throw new Error(\n `Unexpected type of redirect result: ${typeof redirectTo}`\n );\n }\n output.redirect = { path: redirectTo };\n } else {\n const menuRequest = loadMenu(route.menu, runtimeContext);\n if (menuRequest) {\n menuRequestNode.request = menuRequest;\n }\n\n if (!isIncremental) {\n rendererContext.memoizeMenuRequestNode(routes, menuRequestNode);\n }\n\n let newOutput: RenderOutput;\n if (route.type === \"routes\") {\n newOutput = await renderRoutes(\n returnNode,\n route.routes,\n runtimeContext,\n rendererContext,\n routePath,\n menuRequestNode,\n slotId\n );\n } else {\n newOutput = await renderBricks(\n returnNode,\n route.bricks,\n runtimeContext,\n rendererContext,\n routePath,\n menuRequestNode,\n slotId\n );\n }\n\n mergeRenderOutput(output, newOutput);\n appendMenuRequestNode(menuRequestNode, newOutput.menuRequestNode);\n }\n }\n }\n\n return output;\n}\n\nexport async function renderBricks(\n returnNode: RenderReturnNode,\n bricks: BrickConf[],\n runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n menuRequestReturnNode: MenuRequestNode,\n slotId?: string,\n tplStack?: Map<string, number>,\n keyPath?: number[]\n): Promise<RenderOutput> {\n setupRootRuntimeContext(bricks, runtimeContext, true);\n const output = getEmptyRenderOutput();\n const kPath = keyPath ?? [];\n // 多个构件并行异步转换,但转换的结果按原顺序串行合并。\n const rendered = await Promise.all(\n bricks.map((brickConf, index) =>\n renderBrick(\n returnNode,\n brickConf,\n runtimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n slotId,\n kPath.concat(index),\n tplStack && new Map(tplStack)\n )\n )\n );\n\n rendered.forEach((item, index) => {\n if (item.hasTrackingControls) {\n // Memoize a render node before it's been merged.\n rendererContext.memoize(\n slotId,\n kPath.concat(index),\n item.node,\n returnNode\n );\n }\n mergeRenderOutput(output, item);\n });\n\n return output;\n}\n\nexport async function renderBrick(\n returnNode: RenderReturnNode,\n brickConf: RuntimeBrickConfWithSymbols,\n _runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n menuRequestReturnNode: MenuRequestNode,\n slotId?: string,\n keyPath: number[] = [],\n tplStack = new Map<string, number>()\n): Promise<RenderOutput> {\n try {\n return await legacyRenderBrick(\n returnNode,\n brickConf,\n _runtimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n slotId,\n keyPath,\n tplStack\n );\n } catch (error) {\n if (brickConf.errorBoundary) {\n // eslint-disable-next-line no-console\n console.error(\"Error caught by error boundary:\", error);\n return {\n node: {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: httpErrorToString(error),\n dataset: {\n errorBoundary: \"\",\n },\n style: {\n color: \"var(--color-error)\",\n },\n },\n runtimeContext: null!,\n return: returnNode,\n },\n blockingList: [],\n };\n } else {\n throw error;\n }\n }\n}\n\nasync function legacyRenderBrick(\n returnNode: RenderReturnNode,\n brickConf: RuntimeBrickConfWithSymbols,\n _runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n menuRequestReturnNode: MenuRequestNode,\n slotId: string | undefined,\n keyPath: number[],\n tplStack: Map<string, number>\n): Promise<RenderOutput> {\n const output = getEmptyRenderOutput();\n\n if (!brickConf.brick) {\n if ((brickConf as { template?: string }).template) {\n // eslint-disable-next-line no-console\n console.error(\"Legacy templates are dropped in v3:\", brickConf);\n } else {\n // eslint-disable-next-line no-console\n console.error(\"Invalid brick:\", brickConf);\n }\n return output;\n }\n\n // Translate `if: \"<%= ... %>\"` to `brick: \":if\", dataSource: \"<%= ... %>\"`.\n // In other words, translate tracking if expressions to tracking control nodes of `:if`.\n const { if: brickIf, permissionsPreCheck, ...restBrickConf } = brickConf;\n if (isGeneralizedTrackAll(brickIf)) {\n return renderBrick(\n returnNode,\n {\n brick: \":if\",\n dataSource: brickIf,\n // `permissionsPreCheck` maybe required before computing `if`.\n permissionsPreCheck,\n slots: {\n \"\": {\n type: \"bricks\",\n bricks: [restBrickConf],\n },\n },\n // These symbols have to be copied to the new brick conf.\n ...Object.getOwnPropertySymbols(brickConf).reduce(\n (acc, symbol) => ({\n ...acc,\n [symbol]: (brickConf as any)[symbol],\n }),\n {} as RuntimeBrickConfOfTplSymbols & RuntimeBrickConfOfFormSymbols\n ),\n },\n _runtimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n slotId,\n keyPath,\n tplStack\n );\n }\n\n const tplStateStoreId = brickConf[symbolForTplStateStoreId];\n const formStateStoreId = brickConf[symbolForFormStateStoreId];\n const runtimeContext = {\n ..._runtimeContext,\n tplStateStoreId,\n formStateStoreId,\n };\n\n if (hasOwnProperty(brickConf, symbolForTPlExternalForEachItem)) {\n // The external bricks of a template should restore their `forEachItem` and\n // `forEachIndex` from their host.\n runtimeContext.forEachItem = brickConf[symbolForTPlExternalForEachItem];\n runtimeContext.forEachIndex = brickConf[symbolForTPlExternalForEachIndex];\n } else if (brickConf[symbolForTPlExternalNoForEach]) {\n delete runtimeContext.forEachItem;\n delete runtimeContext.forEachIndex;\n }\n\n const { context } = brickConf as { context?: ContextConf[] };\n // istanbul ignore next\n if (Array.isArray(context) && context.length > 0) {\n const strict = isStrictMode(runtimeContext);\n warnAboutStrictMode(\n strict,\n \"Defining context on bricks\",\n \"check your brick:\",\n brickConf\n );\n if (!strict) {\n runtimeContext.ctxStore.define(context, runtimeContext);\n }\n }\n\n runtimeContext.pendingPermissionsPreCheck.push(\n hooks?.checkPermissions?.preCheckPermissionsForBrickOrRoute(\n brickConf,\n (value) => asyncComputeRealValue(value, runtimeContext)\n )\n );\n\n if (!(await asyncCheckBrickIf(brickConf, runtimeContext))) {\n return output;\n }\n\n const brickName = brickConf.brick;\n if (brickName.startsWith(\":\")) {\n ensureValidControlBrick(brickName);\n\n const { dataSource } = brickConf;\n\n const lowerLevelRenderControlNode = async (\n runtimeContext: RuntimeContext\n ) => {\n // First, compute the `dataSource`\n const computedDataSource = await asyncComputeRealValue(\n dataSource,\n runtimeContext\n );\n\n // Then, get the matched slot.\n const slot =\n brickName === \":forEach\"\n ? \"\"\n : brickName === \":switch\"\n ? String(computedDataSource)\n : computedDataSource\n ? \"\"\n : \"else\";\n\n // Don't forget to transpile children to slots.\n const slots = childrenToSlots(brickConf.children, brickConf.slots);\n\n // Then, get the bricks in that matched slot.\n const bricks =\n slots &&\n hasOwnProperty(slots, slot) &&\n (slots[slot] as SlotConfOfBricks)?.bricks;\n\n if (!Array.isArray(bricks)) {\n return getEmptyRenderOutput();\n }\n\n switch (brickName) {\n case \":forEach\": {\n if (!Array.isArray(computedDataSource)) {\n return getEmptyRenderOutput();\n }\n return renderForEach(\n returnNode,\n computedDataSource,\n bricks,\n runtimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n slotId,\n tplStack,\n keyPath\n );\n }\n case \":if\":\n case \":switch\": {\n return renderBricks(\n returnNode,\n bricks,\n runtimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n slotId,\n tplStack,\n keyPath\n );\n }\n }\n };\n\n const renderControlNode = async (runtimeContext: RuntimeContext) => {\n const rawOutput = await lowerLevelRenderControlNode(runtimeContext);\n rawOutput.node ??= {\n tag: RenderTag.PLACEHOLDER,\n return: returnNode,\n };\n return rawOutput;\n };\n\n const controlledOutput = await renderControlNode(runtimeContext);\n const { onMount, onUnmount } = brickConf.lifeCycle ?? {};\n\n const { contextNames, stateNames } = getTracks(dataSource);\n if (contextNames || stateNames) {\n controlledOutput.hasTrackingControls = true;\n let renderId = 0;\n const listener = async () => {\n const currentRenderId = ++renderId;\n const [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope] =\n createScopedRuntimeContext(runtimeContext);\n\n const reControlledOutput =\n await renderControlNode(scopedRuntimeContext);\n\n const scopedStores = [...tplStateStoreScope, ...formStateStoreScope];\n await postAsyncRender(\n reControlledOutput,\n scopedRuntimeContext,\n scopedStores\n );\n\n // Ignore stale renders\n if (renderId === currentRenderId) {\n if (onUnmount) {\n listenerFactory(\n onUnmount,\n runtimeContext\n )(new CustomEvent(\"unmount\", { detail: { rerender: true } }));\n }\n\n rendererContext.reRender(\n slotId,\n keyPath,\n reControlledOutput.node,\n returnNode\n );\n\n if (onMount) {\n listenerFactory(\n onMount,\n scopedRuntimeContext\n )(new CustomEvent(\"mount\", { detail: { rerender: true } }));\n }\n\n for (const store of scopedStores) {\n store.mountAsyncData();\n }\n }\n };\n const debouncedListener = debounce(listener);\n if (contextNames) {\n for (const contextName of contextNames) {\n runtimeContext.ctxStore.onChange(contextName, debouncedListener);\n }\n }\n if (stateNames) {\n for (const contextName of stateNames) {\n const tplStateStore = getTplStateStore(\n runtimeContext,\n \"STATE\",\n `: \"${dataSource}\"`\n );\n tplStateStore.onChange(contextName, debouncedListener);\n }\n }\n }\n\n if (onMount) {\n rendererContext.registerArbitraryLifeCycle(\"onMount\", () => {\n listenerFactory(\n onMount,\n runtimeContext\n )(new CustomEvent(\"mount\", { detail: { rerender: false } }));\n });\n }\n\n if (onUnmount) {\n rendererContext.registerArbitraryLifeCycle(\"onUnmount\", () => {\n listenerFactory(\n onUnmount,\n runtimeContext\n )(new CustomEvent(\"unmount\", { detail: { rerender: false } }));\n });\n }\n\n return controlledOutput;\n }\n\n // Widgets need to be defined before rendering.\n if (/\\.tpl-/.test(brickName) && !customTemplates.get(brickName)) {\n await catchLoad(\n loadBricksImperatively([brickName], getBrickPackages()),\n \"brick\",\n brickName,\n rendererContext.unknownBricks\n );\n }\n\n const tplTagName = getTagNameOfCustomTemplate(\n brickName,\n runtimeContext.app?.id\n );\n\n if (tplTagName) {\n const tplCount = tplStack.get(tplTagName) ?? 0;\n if (tplCount >= 10) {\n throw new Error(\n `Maximum custom template stack overflowed: \"${tplTagName}\"`\n );\n }\n tplStack.set(tplTagName, tplCount + 1);\n } else if (brickName.includes(\"-\") && !customElements.get(brickName)) {\n if (brickName === FORM_RENDERER) {\n customElements.define(\n FORM_RENDERER,\n class FormRendererElement extends HTMLElement {\n get $$typeof(): string {\n return \"form-renderer\";\n }\n }\n );\n } else {\n output.blockingList.push(\n catchLoad(\n enqueueStableLoadBricks([brickName], getBrickPackages()),\n \"brick\",\n brickName,\n rendererContext.unknownBricks\n )\n );\n }\n }\n\n let formData: unknown;\n let confProps: Record<string, unknown> | undefined;\n if (brickName === FORM_RENDERER) {\n ({ formData, ...confProps } = brickConf.properties ?? {});\n } else {\n confProps = brickConf.properties;\n }\n\n const trackingContextList: TrackingContextItem[] = [];\n const asyncPropertyEntries = asyncComputeRealPropertyEntries(\n confProps,\n runtimeContext,\n trackingContextList\n );\n\n const computedPropsFromHost = brickConf[symbolForAsyncComputedPropsFromHost];\n if (computedPropsFromHost) {\n asyncPropertyEntries.push(...computedPropsFromHost);\n }\n\n const isScript = brickName === \"script\";\n if (isScript || brickName === \"link\") {\n const props = await constructAsyncProperties(asyncPropertyEntries);\n if (isScript ? props.src : props.rel === \"stylesheet\" && props.href) {\n const prefix = window.PUBLIC_ROOT ?? \"\";\n if (isScript) {\n const { src, ...attrs } = props;\n await catchLoad(\n loadScript(src as string, prefix, attrs),\n \"script\",\n src as string,\n \"silent\"\n );\n } else {\n const { href, ...attrs } = props;\n await catchLoad(\n loadStyle(href as string, prefix, attrs),\n \"stylesheet\",\n href as string,\n \"silent\"\n );\n }\n return output;\n }\n }\n\n const brick: RenderBrick = {\n tag: RenderTag.BRICK,\n type: tplTagName || brickName,\n return: returnNode,\n slotId,\n events: brickConf.events,\n runtimeContext,\n portal: brickConf.portal,\n iid: brickConf.iid,\n ref: (brickConf as BrickConfInTemplate).ref,\n };\n\n output.node = brick;\n\n // 在最终挂载前,先加载所有可能用到的 processors。\n const usedProcessors = strictCollectMemberUsage(\n [brickConf.events, brickConf.lifeCycle],\n \"PROCESSORS\",\n 2\n );\n if (usedProcessors.size > 0) {\n output.blockingList.push(\n catchLoad(\n loadProcessorsImperatively(usedProcessors, getBrickPackages()),\n \"processors\",\n [...usedProcessors].join(\", \"),\n rendererContext.unknownBricks\n )\n );\n }\n\n // 加载构件属性和加载子构件等任务,可以并行。\n const blockingList: Promise<unknown>[] = [];\n\n const loadProperties = async () => {\n brick.properties = await constructAsyncProperties(asyncPropertyEntries);\n listenOnTrackingContext(brick, trackingContextList);\n };\n blockingList.push(loadProperties());\n\n rendererContext.registerBrickLifeCycle(brick, brickConf.lifeCycle);\n\n let expandedBrickConf = brickConf;\n if (tplTagName) {\n expandedBrickConf = expandCustomTemplate(\n tplTagName,\n brickConf,\n brick,\n asyncPropertyEntries,\n rendererContext\n );\n } else if (brickName === FORM_RENDERER) {\n expandedBrickConf = expandFormRenderer(\n formData,\n brickConf,\n brick,\n asyncPropertyEntries,\n rendererContext\n );\n }\n\n if (expandedBrickConf.portal) {\n // A portal brick has no slotId.\n brick.slotId = undefined;\n }\n\n let childRuntimeContext: RuntimeContext;\n if (tplTagName) {\n // There is a boundary for `forEachItem` between template internals and externals.\n childRuntimeContext = {\n ...runtimeContext,\n };\n delete childRuntimeContext.forEachItem;\n delete childRuntimeContext.forEachIndex;\n } else {\n childRuntimeContext = runtimeContext;\n }\n\n const loadChildren = async () => {\n const slots = childrenToSlots(\n expandedBrickConf.children,\n expandedBrickConf.slots\n );\n if (!slots) {\n return;\n }\n const routeSlotFromIndexToSlotId = new Map<number, string>();\n const rendered = await Promise.all(\n Object.entries(slots).map(([childSlotId, slotConf], index) => {\n if (slotConf.type !== \"routes\") {\n return renderBricks(\n brick,\n (slotConf as SlotConfOfBricks).bricks,\n childRuntimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n childSlotId,\n tplStack\n );\n }\n\n const parentRoute = parentRoutes[parentRoutes.length - 1] as\n | RouteConfOfBricks\n | undefined;\n if (parentRoute?.incrementalSubRoutes) {\n routeSlotFromIndexToSlotId.set(index, childSlotId);\n rendererContext.performIncrementalRender(\n slotConf,\n parentRoutes,\n async (location, prevLocation) => {\n const { homepage } = childRuntimeContext.app;\n const { pathname } = location;\n // Ignore if any one of homepage and parent routes not matched.\n if (\n !matchHomepage(homepage, pathname) ||\n !parentRoutes.every((route) => {\n let prevMatch: MatchResult | null;\n let newMatch: MatchResult | null;\n return (\n (prevMatch = matchRoute(\n route,\n homepage,\n prevLocation.pathname\n )) &&\n (newMatch = matchRoute(route, homepage, pathname)) &&\n (route !== parentRoute ||\n isEqual(prevMatch.params, newMatch.params))\n );\n })\n ) {\n return false;\n }\n\n const [\n scopedRuntimeContext,\n tplStateStoreScope,\n formStateStoreScope,\n ] = createScopedRuntimeContext({\n ...childRuntimeContext,\n location,\n query: new URLSearchParams(location.search),\n });\n\n let failed = false;\n let incrementalOutput: RenderOutput;\n let scopedStores: DataStore<\"STATE\" | \"FORM_STATE\">[] = [];\n\n try {\n incrementalOutput = await renderRoutes(\n brick,\n slotConf.routes,\n scopedRuntimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n childSlotId,\n true\n );\n\n // Do not ignore incremental rendering even if all sub-routes are missed.\n // Since parent route is matched.\n if (incrementalOutput.route) {\n // Bailout if redirect or unauthenticated is set\n if (rendererContext.reBailout(incrementalOutput)) {\n return true;\n }\n\n scopedStores = [\n ...tplStateStoreScope,\n ...formStateStoreScope,\n ];\n await postAsyncRender(\n incrementalOutput,\n scopedRuntimeContext,\n [scopedRuntimeContext.ctxStore, ...scopedStores]\n );\n }\n\n await rendererContext.reMergeMenuRequestNodes(\n menuRequestReturnNode,\n slotConf.routes,\n incrementalOutput.menuRequestNode\n );\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Incremental sub-router failed:\", error);\n\n const result = rendererContext.reCatch(error, brick);\n if (!result) {\n return true;\n }\n ({ failed, output: incrementalOutput } = result);\n\n // Assert: no errors will be throw\n await rendererContext.reMergeMenuRequestNodes(\n menuRequestReturnNode,\n slotConf.routes,\n incrementalOutput.menuRequestNode\n );\n }\n\n rendererContext.reRender(\n childSlotId,\n [],\n incrementalOutput.node,\n brick\n );\n\n if (!failed) {\n scopedRuntimeContext.ctxStore.mountAsyncData(\n incrementalOutput.route\n );\n for (const store of scopedStores) {\n store.mountAsyncData();\n }\n }\n\n // When result is null, it means the incremental rendering is tried but routes missed.\n // In this case, we should continue to re-render the parent routes.\n return incrementalOutput.route ? true : null;\n }\n );\n }\n\n return renderRoutes(\n brick,\n slotConf.routes,\n childRuntimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n childSlotId\n );\n })\n );\n\n const childrenOutput: RenderOutput = {\n ...output,\n node: undefined,\n blockingList: [],\n menuRequestNode: undefined,\n };\n rendered.forEach((item, index) => {\n if (routeSlotFromIndexToSlotId.has(index)) {\n // Memoize a render node before it's been merged.\n rendererContext.memoize(\n routeSlotFromIndexToSlotId.get(index),\n [],\n item.node,\n brick\n );\n }\n mergeRenderOutput(childrenOutput, item);\n mergeSiblingRenderMenuRequest(childrenOutput, item);\n });\n if (childrenOutput.node) {\n brick.child = childrenOutput.node;\n }\n mergeRenderOutput(output, {\n ...childrenOutput,\n node: undefined,\n });\n\n appendMenuRequestNode(\n menuRequestReturnNode,\n (output.menuRequestNode = childrenOutput.menuRequestNode)\n );\n };\n blockingList.push(loadChildren());\n\n await Promise.all(blockingList);\n\n return output;\n}\n\nfunction isGeneralizedTrackAll(brickIf: unknown): boolean {\n return typeof brickIf === \"string\"\n ? isTrackAll(brickIf)\n : isPreEvaluated(brickIf) &&\n // istanbul ignore next: covered by e2e tests\n isTrackAll(getPreEvaluatedRaw(brickIf));\n}\n\ntype ValidControlBrick = \":forEach\" | \":if\" | \":switch\";\n\nfunction ensureValidControlBrick(\n brick: string\n): asserts brick is ValidControlBrick {\n if (brick !== \":forEach\" && brick !== \":if\" && brick !== \":switch\") {\n throw new Error(`Unknown storyboard control node: \"${brick}\"`);\n }\n}\n\nasync function renderForEach(\n returnNode: RenderReturnNode,\n dataSource: unknown[],\n bricks: BrickConf[],\n runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n menuRequestReturnNode: MenuRequestNode,\n slotId: string | undefined,\n tplStack: Map<string, number>,\n keyPath: number[]\n): Promise<RenderOutput> {\n const output = getEmptyRenderOutput();\n\n const rows = dataSource.length;\n const rendered = await Promise.all(\n dataSource.map((item, i) =>\n Promise.all(\n bricks.map((brickConf, j) =>\n renderBrick(\n returnNode,\n brickConf,\n {\n ...runtimeContext,\n forEachItem: item,\n forEachIndex: i,\n },\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n slotId,\n keyPath.concat(i * rows + j),\n tplStack && new Map(tplStack)\n )\n )\n )\n )\n );\n\n // 多层构件并行异步转换,但转换的结果按原顺序串行合并。\n rendered.flat().forEach((item, index) => {\n if (item.hasTrackingControls) {\n // Memoize a render node before it's been merged.\n rendererContext.memoize(\n slotId,\n keyPath.concat(index),\n item.node,\n returnNode\n );\n }\n mergeRenderOutput(output, item);\n });\n\n return output;\n}\n\nexport function getDataStores(runtimeContext: RuntimeContext) {\n return [\n runtimeContext.ctxStore,\n ...runtimeContext.tplStateStoreMap.values(),\n ...runtimeContext.formStateStoreMap.values(),\n ];\n}\n\nexport function postAsyncRender(\n output: RenderOutput,\n runtimeContext: RuntimeContext,\n stores: DataStore<DataStoreType>[]\n) {\n flushStableLoadBricks();\n\n return Promise.all([\n ...output.blockingList,\n ...stores.map((store) => store.waitForAll()),\n ...runtimeContext.pendingPermissionsPreCheck,\n ]);\n}\n\nexport function createScopedRuntimeContext(\n runtimeContext: RuntimeContext\n): [\n scopedRuntimeContext: RuntimeContext,\n tplStateStoreScope: DataStore<\"STATE\">[],\n formStateStoreScope: DataStore<\"FORM_STATE\">[],\n] {\n const tplStateStoreScope: DataStore<\"STATE\">[] = [];\n const formStateStoreScope: DataStore<\"FORM_STATE\">[] = [];\n const scopedRuntimeContext: RuntimeContext = {\n ...runtimeContext,\n tplStateStoreScope,\n formStateStoreScope,\n };\n return [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope];\n}\n\nfunction loadMenu(\n menuConf: MenuConf | undefined,\n runtimeContext: RuntimeContext\n) {\n if (!menuConf) {\n return;\n }\n\n // istanbul ignore next\n if ((menuConf as { type?: \"brick\" }).type === \"brick\") {\n // eslint-disable-next-line no-console\n console.error(\"Set menu with brick is dropped in v3:\", menuConf);\n throw new Error(\"Set menu with brick is dropped in v3\");\n }\n\n // istanbul ignore next\n if (menuConf.type === \"resolve\") {\n // eslint-disable-next-line no-console\n console.warn(\"Set menu with resolve is not supported in v3 yet:\", menuConf);\n return;\n }\n\n return asyncComputeRealValue(\n menuConf,\n runtimeContext\n ) as Promise<StaticMenuConf>;\n}\n\nfunction mergeRenderOutput(\n output: RenderOutput,\n newOutput: RenderOutput\n): void {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { blockingList, node, menuRequestNode, hasTrackingControls, ...rest } =\n newOutput;\n output.blockingList.push(...blockingList);\n\n if (node) {\n if (output.node) {\n let last = output.node;\n while (last.sibling) {\n last = last.sibling;\n }\n last.sibling = node;\n } else {\n output.node = node;\n }\n }\n\n Object.assign(output, rest);\n}\n\nfunction mergeSiblingRenderMenuRequest(\n output: RenderOutput,\n newOutput: RenderOutput\n) {\n const menuRequestNode = newOutput.menuRequestNode;\n if (menuRequestNode) {\n if (output.menuRequestNode) {\n let last = output.menuRequestNode;\n while (last.sibling) {\n last = last.sibling;\n }\n last.sibling = menuRequestNode;\n } else {\n output.menuRequestNode = menuRequestNode;\n }\n }\n}\n\nfunction appendMenuRequestNode(\n menuRequestReturnNode: MenuRequestNode,\n menuRequestNode: MenuRequestNode | undefined\n) {\n if (!menuRequestNode) {\n return;\n }\n if (menuRequestReturnNode.child) {\n let last = menuRequestReturnNode.child;\n while (last.sibling) {\n last = last.sibling;\n }\n last.sibling = menuRequestNode;\n } else {\n menuRequestReturnNode.child = menuRequestNode;\n }\n}\n\nfunction getEmptyRenderOutput(): RenderOutput {\n return { blockingList: [] };\n}\n\nexport function childrenToSlots(\n children: BrickConf[] | undefined,\n originalSlots: SlotsConf | undefined\n) {\n let newSlots = originalSlots;\n // istanbul ignore next\n if (\n process.env.NODE_ENV === \"development\" &&\n children &&\n !Array.isArray(children)\n ) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Specified brick children but not array:\",\n `<${typeof children}>`,\n children\n );\n }\n if (Array.isArray(children) && !newSlots) {\n newSlots = {};\n for (const child of children) {\n const slot = child.slot ?? \"\";\n if (!hasOwnProperty(newSlots, slot)) {\n newSlots[slot] = {\n type: \"bricks\",\n bricks: [],\n };\n }\n (newSlots[slot] as SlotConfOfBricks).bricks.push(child);\n }\n }\n return newSlots;\n}\n\nfunction catchLoad(\n promise: Promise<unknown>,\n type: \"brick\" | \"processors\" | \"script\" | \"stylesheet\",\n name: string,\n unknownPolicy: RendererContext[\"unknownBricks\"]\n) {\n return unknownPolicy === \"silent\"\n ? promise.catch((e) => {\n // eslint-disable-next-line no-console\n console.error(`Load %s \"%s\" failed:`, type, name, e);\n })\n : promise;\n}\n"],"mappings":"AAWA,SACEA,uBAAuB,EACvBC,qBAAqB,EACrBC,sBAAsB,EACtBC,0BAA0B,EAC1BC,UAA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AAO;AACb","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Renderer.js","names":["enqueueStableLoadBricks","flushStableLoadBricks","loadBricksImperatively","loadProcessorsImperatively","loadScript","loadStyle","isTrackAll","hasOwnProperty","strictCollectMemberUsage","debounce","isEqual","asyncCheckBrickIf","asyncComputeRealPropertyEntries","constructAsyncProperties","resolveData","asyncComputeRealValue","listenOnTrackingContext","matchRoute","matchRoutes","symbolForAsyncComputedPropsFromHost","symbolForTPlExternalForEachIndex","symbolForTPlExternalForEachItem","symbolForTPlExternalNoForEach","symbolForTplStateStoreId","expandCustomTemplate","getTagNameOfCustomTemplate","getTplStateStore","customTemplates","getBrickPackages","hooks","RenderTag","getTracks","isStrictMode","warnAboutStrictMode","FORM_RENDERER","symbolForFormStateStoreId","expandFormRenderer","isPreEvaluated","getPreEvaluatedRaw","matchHomepage","listenerFactory","setupRootRuntimeContext","httpErrorToString","setMatchedRoute","renderRoutes","returnNode","routes","_runtimeContext","rendererContext","parentRoutes","menuRequestReturnNode","slotId","isIncremental","matched","output","getEmptyRenderOutput","menuRequestNode","return","unauthenticated","_hooks$checkPermissio","route","path","match","runtimeContext","iid","ctxStore","disposeDataInRoutes","routePath","concat","define","context","undefined","pendingPermissionsPreCheck","push","checkPermissions","preCheckPermissionsForBrickOrRoute","value","preLoadBricks","Array","isArray","blockingList","type","redirectTo","redirect","resolved","transform","console","error","Error","menuRequest","loadMenu","menu","request","memoizeMenuRequestNode","newOutput","renderBricks","bricks","mergeRenderOutput","appendMenuRequestNode","tplStack","keyPath","kPath","rendered","Promise","all","map","brickConf","index","renderBrick","Map","forEach","item","hasTrackingControls","memoize","node","arguments","length","legacyRenderBrick","errorBoundary","tag","BRICK","properties","textContent","dataset","style","color","_hooks$checkPermissio2","_runtimeContext$app","brick","template","if","brickIf","permissionsPreCheck","restBrickConf","isGeneralizedTrackAll","dataSource","slots","Object","getOwnPropertySymbols","reduce","acc","symbol","tplStateStoreId","formStateStoreId","forEachItem","forEachIndex","strict","brickName","startsWith","ensureValidControlBrick","lowerLevelRenderControlNode","_slots$slot","computedDataSource","slot","String","childrenToSlots","children","renderForEach","renderControlNode","rawOutput","PLACEHOLDER","controlledOutput","onMount","onUnmount","lifeCycle","contextNames","stateNames","renderId","listener","currentRenderId","scopedRuntimeContext","tplStateStoreScope","formStateStoreScope","createScopedRuntimeContext","reControlledOutput","scopedStores","postAsyncRender","CustomEvent","detail","rerender","reRender","store","mountAsyncData","debouncedListener","contextName","onChange","tplStateStore","registerArbitraryLifeCycle","test","get","catchLoad","unknownBricks","tplTagName","app","id","tplCount","set","includes","customElements","FormRendererElement","HTMLElement","$$typeof","formData","confProps","trackingContextList","asyncPropertyEntries","computedPropsFromHost","isScript","props","src","rel","href","prefix","window","PUBLIC_ROOT","attrs","events","portal","ref","usedProcessors","size","join","loadProperties","registerBrickLifeCycle","expandedBrickConf","childRuntimeContext","loadChildren","routeSlotFromIndexToSlotId","entries","_ref","childSlotId","slotConf","parentRoute","incrementalSubRoutes","performIncrementalRender","location","prevLocation","homepage","pathname","every","prevMatch","newMatch","params","query","URLSearchParams","search","failed","incrementalOutput","reBailout","reMergeMenuRequestNodes","result","reCatch","childrenOutput","has","mergeSiblingRenderMenuRequest","child","rows","i","j","flat","getDataStores","tplStateStoreMap","values","formStateStoreMap","stores","waitForAll","menuConf","warn","rest","last","sibling","assign","originalSlots","newSlots","process","env","NODE_ENV","promise","name","unknownPolicy","catch","e"],"sources":["../../../src/internal/Renderer.ts"],"sourcesContent":["import type {\n BrickConf,\n BrickConfInTemplate,\n ContextConf,\n MenuConf,\n RouteConf,\n RouteConfOfBricks,\n SlotConfOfBricks,\n SlotsConf,\n StaticMenuConf,\n} from \"@next-core/types\";\nimport {\n enqueueStableLoadBricks,\n flushStableLoadBricks,\n loadBricksImperatively,\n loadProcessorsImperatively,\n loadScript,\n loadStyle,\n} from \"@next-core/loader\";\nimport { isTrackAll } from \"@next-core/cook\";\nimport { hasOwnProperty } from \"@next-core/utils/general\";\nimport { strictCollectMemberUsage } from \"@next-core/utils/storyboard\";\nimport { debounce, isEqual } from \"lodash\";\nimport { asyncCheckBrickIf } from \"./compute/checkIf.js\";\nimport {\n asyncComputeRealPropertyEntries,\n constructAsyncProperties,\n} from \"./compute/computeRealProperties.js\";\nimport { resolveData } from \"./data/resolveData.js\";\nimport { asyncComputeRealValue } from \"./compute/computeRealValue.js\";\nimport {\n TrackingContextItem,\n listenOnTrackingContext,\n} from \"./compute/listenOnTrackingContext.js\";\nimport { RendererContext } from \"./RendererContext.js\";\nimport { matchRoute, matchRoutes } from \"./matchRoutes.js\";\nimport {\n symbolForAsyncComputedPropsFromHost,\n symbolForTPlExternalForEachIndex,\n symbolForTPlExternalForEachItem,\n symbolForTPlExternalNoForEach,\n symbolForTplStateStoreId,\n} from \"./CustomTemplates/constants.js\";\nimport { expandCustomTemplate } from \"./CustomTemplates/expandCustomTemplate.js\";\nimport type {\n MenuRequestNode,\n RenderBrick,\n RenderChildNode,\n RenderReturnNode,\n RuntimeBrickConfWithSymbols,\n RuntimeContext,\n} from \"./interfaces.js\";\nimport {\n getTagNameOfCustomTemplate,\n getTplStateStore,\n} from \"./CustomTemplates/utils.js\";\nimport { customTemplates } from \"../CustomTemplates.js\";\nimport type { NextHistoryState } from \"./historyExtended.js\";\nimport { getBrickPackages, hooks } from \"./Runtime.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { getTracks } from \"./compute/getTracks.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"../isStrictMode.js\";\nimport {\n FORM_RENDERER,\n RuntimeBrickConfOfFormSymbols,\n symbolForFormStateStoreId,\n} from \"./FormRenderer/constants.js\";\nimport { expandFormRenderer } from \"./FormRenderer/expandFormRenderer.js\";\nimport { isPreEvaluated } from \"./compute/evaluate.js\";\nimport { getPreEvaluatedRaw } from \"./compute/evaluate.js\";\nimport { RuntimeBrickConfOfTplSymbols } from \"./CustomTemplates/constants.js\";\nimport { matchHomepage } from \"./matchStoryboard.js\";\nimport type { DataStore, DataStoreType } from \"./data/DataStore.js\";\nimport { listenerFactory } from \"./bindListeners.js\";\nimport type { MatchResult } from \"./matchPath.js\";\nimport { setupRootRuntimeContext } from \"./setupRootRuntimeContext.js\";\nimport { httpErrorToString } from \"../handleHttpError.js\";\nimport { setMatchedRoute } from \"./routeMatchedMap.js\";\n\nexport interface RenderOutput {\n node?: RenderChildNode;\n unauthenticated?: boolean;\n redirect?: {\n path: string;\n state?: NextHistoryState;\n };\n route?: RouteConf;\n path?: string;\n blockingList: (Promise<unknown> | undefined)[];\n menuRequestNode?: MenuRequestNode;\n hasTrackingControls?: boolean;\n}\n\nexport async function renderRoutes(\n returnNode: RenderReturnNode,\n routes: RouteConf[],\n _runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n menuRequestReturnNode: MenuRequestNode,\n slotId?: string,\n isIncremental?: boolean\n): Promise<RenderOutput> {\n const matched = await matchRoutes(routes, _runtimeContext);\n const output = getEmptyRenderOutput();\n const menuRequestNode: MenuRequestNode = (output.menuRequestNode = {\n return: menuRequestReturnNode,\n });\n switch (matched) {\n case \"missed\":\n break;\n case \"unauthenticated\":\n output.unauthenticated = true;\n break;\n default: {\n const route = (output.route = matched.route);\n output.path = matched.match.path;\n const runtimeContext = {\n ..._runtimeContext,\n match: matched.match,\n };\n\n if (route.iid) {\n setMatchedRoute(route.iid, matched.match);\n }\n\n if (isIncremental) {\n runtimeContext.ctxStore.disposeDataInRoutes(routes);\n }\n const routePath = parentRoutes.concat(route);\n runtimeContext.ctxStore.define(\n route.context,\n runtimeContext,\n undefined,\n routePath\n );\n runtimeContext.pendingPermissionsPreCheck.push(\n hooks?.checkPermissions?.preCheckPermissionsForBrickOrRoute(\n route,\n (value) => asyncComputeRealValue(value, runtimeContext)\n )\n );\n\n // Currently, this is only used for brick size-checking: these bricks\n // will be loaded before page rendering, but they will NOT be rendered.\n const { preLoadBricks } = route as { preLoadBricks?: string[] };\n if (Array.isArray(preLoadBricks)) {\n output.blockingList.push(\n loadBricksImperatively(preLoadBricks, getBrickPackages())\n );\n }\n\n if (route.type === \"redirect\") {\n let redirectTo: unknown;\n if (typeof route.redirect === \"string\") {\n redirectTo = await asyncComputeRealValue(\n route.redirect,\n runtimeContext\n );\n } else {\n const resolved = (await resolveData(\n {\n transform: \"redirect\",\n ...route.redirect,\n },\n runtimeContext\n )) as { redirect?: unknown };\n redirectTo = resolved.redirect;\n }\n if (typeof redirectTo !== \"string\") {\n // eslint-disable-next-line no-console\n console.error(\"Unexpected redirect result:\", redirectTo);\n throw new Error(\n `Unexpected type of redirect result: ${typeof redirectTo}`\n );\n }\n output.redirect = { path: redirectTo };\n } else {\n const menuRequest = loadMenu(route.menu, runtimeContext);\n if (menuRequest) {\n menuRequestNode.request = menuRequest;\n }\n\n if (!isIncremental) {\n rendererContext.memoizeMenuRequestNode(routes, menuRequestNode);\n }\n\n let newOutput: RenderOutput;\n if (route.type === \"routes\") {\n newOutput = await renderRoutes(\n returnNode,\n route.routes,\n runtimeContext,\n rendererContext,\n routePath,\n menuRequestNode,\n slotId\n );\n } else {\n newOutput = await renderBricks(\n returnNode,\n route.bricks,\n runtimeContext,\n rendererContext,\n routePath,\n menuRequestNode,\n slotId\n );\n }\n\n mergeRenderOutput(output, newOutput);\n appendMenuRequestNode(menuRequestNode, newOutput.menuRequestNode);\n }\n }\n }\n\n return output;\n}\n\nexport async function renderBricks(\n returnNode: RenderReturnNode,\n bricks: BrickConf[],\n runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n menuRequestReturnNode: MenuRequestNode,\n slotId?: string,\n tplStack?: Map<string, number>,\n keyPath?: number[]\n): Promise<RenderOutput> {\n setupRootRuntimeContext(bricks, runtimeContext, true);\n const output = getEmptyRenderOutput();\n const kPath = keyPath ?? [];\n // 多个构件并行异步转换,但转换的结果按原顺序串行合并。\n const rendered = await Promise.all(\n bricks.map((brickConf, index) =>\n renderBrick(\n returnNode,\n brickConf,\n runtimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n slotId,\n kPath.concat(index),\n tplStack && new Map(tplStack)\n )\n )\n );\n\n rendered.forEach((item, index) => {\n if (item.hasTrackingControls) {\n // Memoize a render node before it's been merged.\n rendererContext.memoize(\n slotId,\n kPath.concat(index),\n item.node,\n returnNode\n );\n }\n mergeRenderOutput(output, item);\n });\n\n return output;\n}\n\nexport async function renderBrick(\n returnNode: RenderReturnNode,\n brickConf: RuntimeBrickConfWithSymbols,\n _runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n menuRequestReturnNode: MenuRequestNode,\n slotId?: string,\n keyPath: number[] = [],\n tplStack = new Map<string, number>()\n): Promise<RenderOutput> {\n try {\n return await legacyRenderBrick(\n returnNode,\n brickConf,\n _runtimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n slotId,\n keyPath,\n tplStack\n );\n } catch (error) {\n if (brickConf.errorBoundary) {\n // eslint-disable-next-line no-console\n console.error(\"Error caught by error boundary:\", error);\n return {\n node: {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: httpErrorToString(error),\n dataset: {\n errorBoundary: \"\",\n },\n style: {\n color: \"var(--color-error)\",\n },\n },\n runtimeContext: null!,\n return: returnNode,\n },\n blockingList: [],\n };\n } else {\n throw error;\n }\n }\n}\n\nasync function legacyRenderBrick(\n returnNode: RenderReturnNode,\n brickConf: RuntimeBrickConfWithSymbols,\n _runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n menuRequestReturnNode: MenuRequestNode,\n slotId: string | undefined,\n keyPath: number[],\n tplStack: Map<string, number>\n): Promise<RenderOutput> {\n const output = getEmptyRenderOutput();\n\n if (!brickConf.brick) {\n if ((brickConf as { template?: string }).template) {\n // eslint-disable-next-line no-console\n console.error(\"Legacy templates are dropped in v3:\", brickConf);\n } else {\n // eslint-disable-next-line no-console\n console.error(\"Invalid brick:\", brickConf);\n }\n return output;\n }\n\n // Translate `if: \"<%= ... %>\"` to `brick: \":if\", dataSource: \"<%= ... %>\"`.\n // In other words, translate tracking if expressions to tracking control nodes of `:if`.\n const { if: brickIf, permissionsPreCheck, ...restBrickConf } = brickConf;\n if (isGeneralizedTrackAll(brickIf)) {\n return renderBrick(\n returnNode,\n {\n brick: \":if\",\n dataSource: brickIf,\n // `permissionsPreCheck` maybe required before computing `if`.\n permissionsPreCheck,\n slots: {\n \"\": {\n type: \"bricks\",\n bricks: [restBrickConf],\n },\n },\n // These symbols have to be copied to the new brick conf.\n ...Object.getOwnPropertySymbols(brickConf).reduce(\n (acc, symbol) => ({\n ...acc,\n [symbol]: (brickConf as any)[symbol],\n }),\n {} as RuntimeBrickConfOfTplSymbols & RuntimeBrickConfOfFormSymbols\n ),\n },\n _runtimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n slotId,\n keyPath,\n tplStack\n );\n }\n\n const tplStateStoreId = brickConf[symbolForTplStateStoreId];\n const formStateStoreId = brickConf[symbolForFormStateStoreId];\n const runtimeContext = {\n ..._runtimeContext,\n tplStateStoreId,\n formStateStoreId,\n };\n\n if (hasOwnProperty(brickConf, symbolForTPlExternalForEachItem)) {\n // The external bricks of a template should restore their `forEachItem` and\n // `forEachIndex` from their host.\n runtimeContext.forEachItem = brickConf[symbolForTPlExternalForEachItem];\n runtimeContext.forEachIndex = brickConf[symbolForTPlExternalForEachIndex];\n } else if (brickConf[symbolForTPlExternalNoForEach]) {\n delete runtimeContext.forEachItem;\n delete runtimeContext.forEachIndex;\n }\n\n const { context } = brickConf as { context?: ContextConf[] };\n // istanbul ignore next\n if (Array.isArray(context) && context.length > 0) {\n const strict = isStrictMode(runtimeContext);\n warnAboutStrictMode(\n strict,\n \"Defining context on bricks\",\n \"check your brick:\",\n brickConf\n );\n if (!strict) {\n runtimeContext.ctxStore.define(context, runtimeContext);\n }\n }\n\n runtimeContext.pendingPermissionsPreCheck.push(\n hooks?.checkPermissions?.preCheckPermissionsForBrickOrRoute(\n brickConf,\n (value) => asyncComputeRealValue(value, runtimeContext)\n )\n );\n\n if (!(await asyncCheckBrickIf(brickConf, runtimeContext))) {\n return output;\n }\n\n const brickName = brickConf.brick;\n if (brickName.startsWith(\":\")) {\n ensureValidControlBrick(brickName);\n\n const { dataSource } = brickConf;\n\n const lowerLevelRenderControlNode = async (\n runtimeContext: RuntimeContext\n ) => {\n // First, compute the `dataSource`\n const computedDataSource = await asyncComputeRealValue(\n dataSource,\n runtimeContext\n );\n\n // Then, get the matched slot.\n const slot =\n brickName === \":forEach\"\n ? \"\"\n : brickName === \":switch\"\n ? String(computedDataSource)\n : computedDataSource\n ? \"\"\n : \"else\";\n\n // Don't forget to transpile children to slots.\n const slots = childrenToSlots(brickConf.children, brickConf.slots);\n\n // Then, get the bricks in that matched slot.\n const bricks =\n slots &&\n hasOwnProperty(slots, slot) &&\n (slots[slot] as SlotConfOfBricks)?.bricks;\n\n if (!Array.isArray(bricks)) {\n return getEmptyRenderOutput();\n }\n\n switch (brickName) {\n case \":forEach\": {\n if (!Array.isArray(computedDataSource)) {\n return getEmptyRenderOutput();\n }\n return renderForEach(\n returnNode,\n computedDataSource,\n bricks,\n runtimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n slotId,\n tplStack,\n keyPath\n );\n }\n case \":if\":\n case \":switch\": {\n return renderBricks(\n returnNode,\n bricks,\n runtimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n slotId,\n tplStack,\n keyPath\n );\n }\n }\n };\n\n const renderControlNode = async (runtimeContext: RuntimeContext) => {\n const rawOutput = await lowerLevelRenderControlNode(runtimeContext);\n rawOutput.node ??= {\n tag: RenderTag.PLACEHOLDER,\n return: returnNode,\n };\n return rawOutput;\n };\n\n const controlledOutput = await renderControlNode(runtimeContext);\n const { onMount, onUnmount } = brickConf.lifeCycle ?? {};\n\n const { contextNames, stateNames } = getTracks(dataSource);\n if (contextNames || stateNames) {\n controlledOutput.hasTrackingControls = true;\n let renderId = 0;\n const listener = async () => {\n const currentRenderId = ++renderId;\n const [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope] =\n createScopedRuntimeContext(runtimeContext);\n\n const reControlledOutput =\n await renderControlNode(scopedRuntimeContext);\n\n const scopedStores = [...tplStateStoreScope, ...formStateStoreScope];\n await postAsyncRender(\n reControlledOutput,\n scopedRuntimeContext,\n scopedStores\n );\n\n // Ignore stale renders\n if (renderId === currentRenderId) {\n if (onUnmount) {\n listenerFactory(\n onUnmount,\n runtimeContext\n )(new CustomEvent(\"unmount\", { detail: { rerender: true } }));\n }\n\n rendererContext.reRender(\n slotId,\n keyPath,\n reControlledOutput.node,\n returnNode\n );\n\n if (onMount) {\n listenerFactory(\n onMount,\n scopedRuntimeContext\n )(new CustomEvent(\"mount\", { detail: { rerender: true } }));\n }\n\n for (const store of scopedStores) {\n store.mountAsyncData();\n }\n }\n };\n const debouncedListener = debounce(listener);\n if (contextNames) {\n for (const contextName of contextNames) {\n runtimeContext.ctxStore.onChange(contextName, debouncedListener);\n }\n }\n if (stateNames) {\n for (const contextName of stateNames) {\n const tplStateStore = getTplStateStore(\n runtimeContext,\n \"STATE\",\n `: \"${dataSource}\"`\n );\n tplStateStore.onChange(contextName, debouncedListener);\n }\n }\n }\n\n if (onMount) {\n rendererContext.registerArbitraryLifeCycle(\"onMount\", () => {\n listenerFactory(\n onMount,\n runtimeContext\n )(new CustomEvent(\"mount\", { detail: { rerender: false } }));\n });\n }\n\n if (onUnmount) {\n rendererContext.registerArbitraryLifeCycle(\"onUnmount\", () => {\n listenerFactory(\n onUnmount,\n runtimeContext\n )(new CustomEvent(\"unmount\", { detail: { rerender: false } }));\n });\n }\n\n return controlledOutput;\n }\n\n // Widgets need to be defined before rendering.\n if (/\\.tpl-/.test(brickName) && !customTemplates.get(brickName)) {\n await catchLoad(\n loadBricksImperatively([brickName], getBrickPackages()),\n \"brick\",\n brickName,\n rendererContext.unknownBricks\n );\n }\n\n const tplTagName = getTagNameOfCustomTemplate(\n brickName,\n runtimeContext.app?.id\n );\n\n if (tplTagName) {\n const tplCount = tplStack.get(tplTagName) ?? 0;\n if (tplCount >= 10) {\n throw new Error(\n `Maximum custom template stack overflowed: \"${tplTagName}\"`\n );\n }\n tplStack.set(tplTagName, tplCount + 1);\n } else if (brickName.includes(\"-\") && !customElements.get(brickName)) {\n if (brickName === FORM_RENDERER) {\n customElements.define(\n FORM_RENDERER,\n class FormRendererElement extends HTMLElement {\n get $$typeof(): string {\n return \"form-renderer\";\n }\n }\n );\n } else {\n output.blockingList.push(\n catchLoad(\n enqueueStableLoadBricks([brickName], getBrickPackages()),\n \"brick\",\n brickName,\n rendererContext.unknownBricks\n )\n );\n }\n }\n\n let formData: unknown;\n let confProps: Record<string, unknown> | undefined;\n if (brickName === FORM_RENDERER) {\n ({ formData, ...confProps } = brickConf.properties ?? {});\n } else {\n confProps = brickConf.properties;\n }\n\n const trackingContextList: TrackingContextItem[] = [];\n const asyncPropertyEntries = asyncComputeRealPropertyEntries(\n confProps,\n runtimeContext,\n trackingContextList\n );\n\n const computedPropsFromHost = brickConf[symbolForAsyncComputedPropsFromHost];\n if (computedPropsFromHost) {\n asyncPropertyEntries.push(...computedPropsFromHost);\n }\n\n const isScript = brickName === \"script\";\n if (isScript || brickName === \"link\") {\n const props = await constructAsyncProperties(asyncPropertyEntries);\n if (isScript ? props.src : props.rel === \"stylesheet\" && props.href) {\n const prefix = window.PUBLIC_ROOT ?? \"\";\n if (isScript) {\n const { src, ...attrs } = props;\n await catchLoad(\n loadScript(src as string, prefix, attrs),\n \"script\",\n src as string,\n \"silent\"\n );\n } else {\n const { href, ...attrs } = props;\n await catchLoad(\n loadStyle(href as string, prefix, attrs),\n \"stylesheet\",\n href as string,\n \"silent\"\n );\n }\n return output;\n }\n }\n\n const brick: RenderBrick = {\n tag: RenderTag.BRICK,\n type: tplTagName || brickName,\n return: returnNode,\n slotId,\n events: brickConf.events,\n runtimeContext,\n portal: brickConf.portal,\n iid: brickConf.iid,\n ref: (brickConf as BrickConfInTemplate).ref,\n };\n\n output.node = brick;\n\n // 在最终挂载前,先加载所有可能用到的 processors。\n const usedProcessors = strictCollectMemberUsage(\n [brickConf.events, brickConf.lifeCycle],\n \"PROCESSORS\",\n 2\n );\n if (usedProcessors.size > 0) {\n output.blockingList.push(\n catchLoad(\n loadProcessorsImperatively(usedProcessors, getBrickPackages()),\n \"processors\",\n [...usedProcessors].join(\", \"),\n rendererContext.unknownBricks\n )\n );\n }\n\n // 加载构件属性和加载子构件等任务,可以并行。\n const blockingList: Promise<unknown>[] = [];\n\n const loadProperties = async () => {\n brick.properties = await constructAsyncProperties(asyncPropertyEntries);\n listenOnTrackingContext(brick, trackingContextList);\n };\n blockingList.push(loadProperties());\n\n rendererContext.registerBrickLifeCycle(brick, brickConf.lifeCycle);\n\n let expandedBrickConf = brickConf;\n if (tplTagName) {\n expandedBrickConf = expandCustomTemplate(\n tplTagName,\n brickConf,\n brick,\n asyncPropertyEntries,\n rendererContext\n );\n } else if (brickName === FORM_RENDERER) {\n expandedBrickConf = expandFormRenderer(\n formData,\n brickConf,\n brick,\n asyncPropertyEntries,\n rendererContext\n );\n }\n\n if (expandedBrickConf.portal) {\n // A portal brick has no slotId.\n brick.slotId = undefined;\n }\n\n let childRuntimeContext: RuntimeContext;\n if (tplTagName) {\n // There is a boundary for `forEachItem` between template internals and externals.\n childRuntimeContext = {\n ...runtimeContext,\n };\n delete childRuntimeContext.forEachItem;\n delete childRuntimeContext.forEachIndex;\n } else {\n childRuntimeContext = runtimeContext;\n }\n\n const loadChildren = async () => {\n const slots = childrenToSlots(\n expandedBrickConf.children,\n expandedBrickConf.slots\n );\n if (!slots) {\n return;\n }\n const routeSlotFromIndexToSlotId = new Map<number, string>();\n const rendered = await Promise.all(\n Object.entries(slots).map(([childSlotId, slotConf], index) => {\n if (slotConf.type !== \"routes\") {\n return renderBricks(\n brick,\n (slotConf as SlotConfOfBricks).bricks,\n childRuntimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n childSlotId,\n tplStack\n );\n }\n\n const parentRoute = parentRoutes[parentRoutes.length - 1] as\n | RouteConfOfBricks\n | undefined;\n if (parentRoute?.incrementalSubRoutes) {\n routeSlotFromIndexToSlotId.set(index, childSlotId);\n rendererContext.performIncrementalRender(\n slotConf,\n parentRoutes,\n async (location, prevLocation) => {\n const { homepage } = childRuntimeContext.app;\n const { pathname } = location;\n // Ignore if any one of homepage and parent routes not matched.\n if (\n !matchHomepage(homepage, pathname) ||\n !parentRoutes.every((route) => {\n let prevMatch: MatchResult | null;\n let newMatch: MatchResult | null;\n return (\n (prevMatch = matchRoute(\n route,\n homepage,\n prevLocation.pathname\n )) &&\n (newMatch = matchRoute(route, homepage, pathname)) &&\n (route !== parentRoute ||\n isEqual(prevMatch.params, newMatch.params))\n );\n })\n ) {\n return false;\n }\n\n const [\n scopedRuntimeContext,\n tplStateStoreScope,\n formStateStoreScope,\n ] = createScopedRuntimeContext({\n ...childRuntimeContext,\n location,\n query: new URLSearchParams(location.search),\n });\n\n let failed = false;\n let incrementalOutput: RenderOutput;\n let scopedStores: DataStore<\"STATE\" | \"FORM_STATE\">[] = [];\n\n try {\n incrementalOutput = await renderRoutes(\n brick,\n slotConf.routes,\n scopedRuntimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n childSlotId,\n true\n );\n\n // Do not ignore incremental rendering even if all sub-routes are missed.\n // Since parent route is matched.\n if (incrementalOutput.route) {\n // Bailout if redirect or unauthenticated is set\n if (rendererContext.reBailout(incrementalOutput)) {\n return true;\n }\n\n scopedStores = [\n ...tplStateStoreScope,\n ...formStateStoreScope,\n ];\n await postAsyncRender(\n incrementalOutput,\n scopedRuntimeContext,\n [scopedRuntimeContext.ctxStore, ...scopedStores]\n );\n }\n\n await rendererContext.reMergeMenuRequestNodes(\n menuRequestReturnNode,\n slotConf.routes,\n incrementalOutput.menuRequestNode\n );\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Incremental sub-router failed:\", error);\n\n const result = rendererContext.reCatch(error, brick);\n if (!result) {\n return true;\n }\n ({ failed, output: incrementalOutput } = result);\n\n // Assert: no errors will be throw\n await rendererContext.reMergeMenuRequestNodes(\n menuRequestReturnNode,\n slotConf.routes,\n incrementalOutput.menuRequestNode\n );\n }\n\n rendererContext.reRender(\n childSlotId,\n [],\n incrementalOutput.node,\n brick\n );\n\n if (!failed) {\n scopedRuntimeContext.ctxStore.mountAsyncData(\n incrementalOutput.route\n );\n for (const store of scopedStores) {\n store.mountAsyncData();\n }\n }\n\n // When result is null, it means the incremental rendering is tried but routes missed.\n // In this case, we should continue to re-render the parent routes.\n return incrementalOutput.route ? true : null;\n }\n );\n }\n\n return renderRoutes(\n brick,\n slotConf.routes,\n childRuntimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n childSlotId\n );\n })\n );\n\n const childrenOutput: RenderOutput = {\n ...output,\n node: undefined,\n blockingList: [],\n menuRequestNode: undefined,\n };\n rendered.forEach((item, index) => {\n if (routeSlotFromIndexToSlotId.has(index)) {\n // Memoize a render node before it's been merged.\n rendererContext.memoize(\n routeSlotFromIndexToSlotId.get(index),\n [],\n item.node,\n brick\n );\n }\n mergeRenderOutput(childrenOutput, item);\n mergeSiblingRenderMenuRequest(childrenOutput, item);\n });\n if (childrenOutput.node) {\n brick.child = childrenOutput.node;\n }\n mergeRenderOutput(output, {\n ...childrenOutput,\n node: undefined,\n });\n\n appendMenuRequestNode(\n menuRequestReturnNode,\n (output.menuRequestNode = childrenOutput.menuRequestNode)\n );\n };\n blockingList.push(loadChildren());\n\n await Promise.all(blockingList);\n\n return output;\n}\n\nfunction isGeneralizedTrackAll(brickIf: unknown): boolean {\n return typeof brickIf === \"string\"\n ? isTrackAll(brickIf)\n : isPreEvaluated(brickIf) &&\n // istanbul ignore next: covered by e2e tests\n isTrackAll(getPreEvaluatedRaw(brickIf));\n}\n\ntype ValidControlBrick = \":forEach\" | \":if\" | \":switch\";\n\nfunction ensureValidControlBrick(\n brick: string\n): asserts brick is ValidControlBrick {\n if (brick !== \":forEach\" && brick !== \":if\" && brick !== \":switch\") {\n throw new Error(`Unknown storyboard control node: \"${brick}\"`);\n }\n}\n\nasync function renderForEach(\n returnNode: RenderReturnNode,\n dataSource: unknown[],\n bricks: BrickConf[],\n runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n menuRequestReturnNode: MenuRequestNode,\n slotId: string | undefined,\n tplStack: Map<string, number>,\n keyPath: number[]\n): Promise<RenderOutput> {\n const output = getEmptyRenderOutput();\n\n const rows = dataSource.length;\n const rendered = await Promise.all(\n dataSource.map((item, i) =>\n Promise.all(\n bricks.map((brickConf, j) =>\n renderBrick(\n returnNode,\n brickConf,\n {\n ...runtimeContext,\n forEachItem: item,\n forEachIndex: i,\n },\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n slotId,\n keyPath.concat(i * rows + j),\n tplStack && new Map(tplStack)\n )\n )\n )\n )\n );\n\n // 多层构件并行异步转换,但转换的结果按原顺序串行合并。\n rendered.flat().forEach((item, index) => {\n if (item.hasTrackingControls) {\n // Memoize a render node before it's been merged.\n rendererContext.memoize(\n slotId,\n keyPath.concat(index),\n item.node,\n returnNode\n );\n }\n mergeRenderOutput(output, item);\n });\n\n return output;\n}\n\nexport function getDataStores(runtimeContext: RuntimeContext) {\n return [\n runtimeContext.ctxStore,\n ...runtimeContext.tplStateStoreMap.values(),\n ...runtimeContext.formStateStoreMap.values(),\n ];\n}\n\nexport function postAsyncRender(\n output: RenderOutput,\n runtimeContext: RuntimeContext,\n stores: DataStore<DataStoreType>[]\n) {\n flushStableLoadBricks();\n\n return Promise.all([\n ...output.blockingList,\n ...stores.map((store) => store.waitForAll()),\n ...runtimeContext.pendingPermissionsPreCheck,\n ]);\n}\n\nexport function createScopedRuntimeContext(\n runtimeContext: RuntimeContext\n): [\n scopedRuntimeContext: RuntimeContext,\n tplStateStoreScope: DataStore<\"STATE\">[],\n formStateStoreScope: DataStore<\"FORM_STATE\">[],\n] {\n const tplStateStoreScope: DataStore<\"STATE\">[] = [];\n const formStateStoreScope: DataStore<\"FORM_STATE\">[] = [];\n const scopedRuntimeContext: RuntimeContext = {\n ...runtimeContext,\n tplStateStoreScope,\n formStateStoreScope,\n };\n return [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope];\n}\n\nfunction loadMenu(\n menuConf: MenuConf | undefined,\n runtimeContext: RuntimeContext\n) {\n if (!menuConf) {\n return;\n }\n\n // istanbul ignore next\n if ((menuConf as { type?: \"brick\" }).type === \"brick\") {\n // eslint-disable-next-line no-console\n console.error(\"Set menu with brick is dropped in v3:\", menuConf);\n throw new Error(\"Set menu with brick is dropped in v3\");\n }\n\n // istanbul ignore next\n if (menuConf.type === \"resolve\") {\n // eslint-disable-next-line no-console\n console.warn(\"Set menu with resolve is not supported in v3 yet:\", menuConf);\n return;\n }\n\n return asyncComputeRealValue(\n menuConf,\n runtimeContext\n ) as Promise<StaticMenuConf>;\n}\n\nfunction mergeRenderOutput(\n output: RenderOutput,\n newOutput: RenderOutput\n): void {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { blockingList, node, menuRequestNode, hasTrackingControls, ...rest } =\n newOutput;\n output.blockingList.push(...blockingList);\n\n if (node) {\n if (output.node) {\n let last = output.node;\n while (last.sibling) {\n last = last.sibling;\n }\n last.sibling = node;\n } else {\n output.node = node;\n }\n }\n\n Object.assign(output, rest);\n}\n\nfunction mergeSiblingRenderMenuRequest(\n output: RenderOutput,\n newOutput: RenderOutput\n) {\n const menuRequestNode = newOutput.menuRequestNode;\n if (menuRequestNode) {\n if (output.menuRequestNode) {\n let last = output.menuRequestNode;\n while (last.sibling) {\n last = last.sibling;\n }\n last.sibling = menuRequestNode;\n } else {\n output.menuRequestNode = menuRequestNode;\n }\n }\n}\n\nfunction appendMenuRequestNode(\n menuRequestReturnNode: MenuRequestNode,\n menuRequestNode: MenuRequestNode | undefined\n) {\n if (!menuRequestNode) {\n return;\n }\n if (menuRequestReturnNode.child) {\n let last = menuRequestReturnNode.child;\n while (last.sibling) {\n last = last.sibling;\n }\n last.sibling = menuRequestNode;\n } else {\n menuRequestReturnNode.child = menuRequestNode;\n }\n}\n\nfunction getEmptyRenderOutput(): RenderOutput {\n return { blockingList: [] };\n}\n\nexport function childrenToSlots(\n children: BrickConf[] | undefined,\n originalSlots: SlotsConf | undefined\n) {\n let newSlots = originalSlots;\n // istanbul ignore next\n if (\n process.env.NODE_ENV === \"development\" &&\n children &&\n !Array.isArray(children)\n ) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Specified brick children but not array:\",\n `<${typeof children}>`,\n children\n );\n }\n if (Array.isArray(children) && !newSlots) {\n newSlots = {};\n for (const child of children) {\n const slot = child.slot ?? \"\";\n if (!hasOwnProperty(newSlots, slot)) {\n newSlots[slot] = {\n type: \"bricks\",\n bricks: [],\n };\n }\n (newSlots[slot] as SlotConfOfBricks).bricks.push(child);\n }\n }\n return newSlots;\n}\n\nfunction catchLoad(\n promise: Promise<unknown>,\n type: \"brick\" | \"processors\" | \"script\" | \"stylesheet\",\n name: string,\n unknownPolicy: RendererContext[\"unknownBricks\"]\n) {\n return unknownPolicy === \"silent\"\n ? promise.catch((e) => {\n // eslint-disable-next-line no-console\n console.error(`Load %s \"%s\" failed:`, type, name, e);\n })\n : promise;\n}\n"],"mappings":"AAWA,SACEA,uBAAuB,EACvBC,qBAAqB,EACrBC,sBAAsB,EACtBC,0BAA0B,EAC1BC,UAAU,EACVC,SAAS,QACJ,mBAAmB;AAC1B,SAASC,UAAU,QAAQ,iBAAiB;AAC5C,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,wBAAwB,QAAQ,6BAA6B;AACtE,SAASC,QAAQ,EAAEC,OAAO,QAAQ,QAAQ;AAC1C,SAASC,iBAAiB,QAAQ,sBAAsB;AACxD,SACEC,+BAA+B,EAC/BC,wBAAwB,QACnB,oCAAoC;AAC3C,SAASC,WAAW,QAAQ,uBAAuB;AACnD,SAASC,qBAAqB,QAAQ,+BAA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,IAAIC,QAAQ,GAAGD,aAAa;EAC5B;EACA,IACEE,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,IACtCxH,QAAQ,IACR,CAAC9E,KAAK,CAACC,OAAO,CAAC6E,QAAQ,CAAC,EACxB;IACA;IACAtE,OAAO,CAACqL,IAAI,CACV,yCAAyC,EACzC,IAAI,OAAO/G,QAAQ,GAAG,EACtBA,QACF,CAAC;EACH;EACA,IAAI9E,KAAK,CAACC,OAAO,CAAC6E,QAAQ,CAAC,IAAI,CAACqH,QAAQ,EAAE;IACxCA,QAAQ,GAAG,CAAC,CAAC;IACb,KAAK,MAAMlB,KAAK,IAAInG,QAAQ,EAAE;MAC5B,MAAMH,IAAI,GAAGsG,KAAK,CAACtG,IAAI,IAAI,EAAE;MAC7B,IAAI,CAAClJ,cAAc,CAAC0Q,QAAQ,EAAExH,IAAI,CAAC,EAAE;QACnCwH,QAAQ,CAACxH,IAAI,CAAC,GAAG;UACfxE,IAAI,EAAE,QAAQ;UACde,MAAM,EAAE;QACV,CAAC;MACH;MACCiL,QAAQ,CAACxH,IAAI,CAAC,CAAsBzD,MAAM,CAACvB,IAAI,CAACsL,KAAK,CAAC;IACzD;EACF;EACA,OAAOkB,QAAQ;AACjB;AAEA,SAASnF,SAASA,CAChBuF,OAAyB,EACzBpM,IAAsD,EACtDqM,IAAY,EACZC,aAA+C,EAC/C;EACA,OAAOA,aAAa,KAAK,QAAQ,GAC7BF,OAAO,CAACG,KAAK,CAAEC,CAAC,IAAK;IACnB;IACAnM,OAAO,CAACC,KAAK,CAAC,sBAAsB,EAAEN,IAAI,EAAEqM,IAAI,EAAEG,CAAC,CAAC;EACtD,CAAC,CAAC,GACFJ,OAAO;AACb","ignoreList":[]}
|
|
@@ -29,6 +29,7 @@ import { devtoolsHookEmit } from "./devtools.js";
|
|
|
29
29
|
import { setUIVersion } from "../setUIVersion.js";
|
|
30
30
|
import { setAppVariable } from "../setAppVariable.js";
|
|
31
31
|
import { setWatermark } from "../setWatermark.js";
|
|
32
|
+
import { clearMatchedRoutes } from "./routeMatchedMap.js";
|
|
32
33
|
var _storyboards = /*#__PURE__*/new WeakMap();
|
|
33
34
|
var _rendering = /*#__PURE__*/new WeakMap();
|
|
34
35
|
var _prevLocation = /*#__PURE__*/new WeakMap();
|
|
@@ -379,6 +380,7 @@ async function _render(location) {
|
|
|
379
380
|
let output;
|
|
380
381
|
let stores = [];
|
|
381
382
|
try {
|
|
383
|
+
clearMatchedRoutes();
|
|
382
384
|
const rootMenuRequestNode = {};
|
|
383
385
|
output = await renderRoutes(renderRoot, insertPreviewRoutes(storyboard.routes), runtimeContext, rendererContext, [], rootMenuRequestNode);
|
|
384
386
|
if (routeHelper.bailout(output)) {
|