@next-core/runtime 1.36.1 → 1.38.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.
@@ -101,7 +101,7 @@ function unstable_createRoot(container, {
101
101
  let output;
102
102
  let stores = [];
103
103
  try {
104
- output = await (0, _Renderer.renderBricks)(renderRoot, bricks, runtimeContext, rendererContext, []);
104
+ output = await (0, _Renderer.renderBricks)(renderRoot, bricks, runtimeContext, rendererContext, [], {});
105
105
  stores = (0, _Renderer.getDataStores)(runtimeContext);
106
106
  await (0, _Renderer.postAsyncRender)(output, runtimeContext, stores);
107
107
  } catch (error) {
@@ -116,8 +116,7 @@ function unstable_createRoot(container, {
116
116
  return: renderRoot,
117
117
  runtimeContext: null
118
118
  },
119
- blockingList: [],
120
- menuRequests: []
119
+ blockingList: []
121
120
  };
122
121
  }
123
122
  renderRoot.child = output.node;
@@ -1 +1 @@
1
- {"version":3,"file":"createRoot.js","names":["_lodash","require","_Renderer","_RendererContext","_DataStore","_mount","_handleHttpError","_themeAndMode","_enums","_StoryboardFunctions","_registerAppI18n","_registerCustomTemplates","_setUIVersion","unstable_createRoot","container","portal","_portal","scope","unknownBricks","createPortal","document","createElement","style","position","width","height","body","append","unmounted","rendererContext","clearI18nBundles","render","brick","theme","uiVersion","context","functions","templates","i18n","i18nData","Error","bricks","concat","previousRendererContext","renderId","uniqueId","RendererContext","runtimeContext","ctxStore","DataStore","undefined","pendingPermissionsPreCheck","tplStateStoreMap","Map","formStateStoreMap","renderRoot","tag","RenderTag","ROOT","_clearI18nBundles","setTheme","setMode","setUIVersion","demoApp","id","homepage","app","demoStoryboard","meta","customTemplates","registerAppI18n","registerCustomTemplates","registerStoryboardFunctions","define","failed","output","stores","renderBricks","getDataStores","postAsyncRender","error","node","BRICK","type","properties","textContent","httpErrorToString","return","blockingList","menuRequests","child","dispatchOnUnmount","dispose","unmountTree","dispatchBeforePageLoad","applyTheme","applyMode","mountTree","window","scrollTo","store","mountAsyncData","dispatchPageLoad","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","initializeMessageDispatcher","unmount","remove"],"sources":["../../src/createRoot.ts"],"sourcesContent":["import type {\n BrickConf,\n ContextConf,\n CustomTemplate,\n MetaI18n,\n MicroApp,\n SiteTheme,\n Storyboard,\n StoryboardFunction,\n} from \"@next-core/types\";\nimport { uniqueId } from \"lodash\";\nimport {\n RenderOutput,\n getDataStores,\n postAsyncRender,\n renderBricks,\n} from \"./internal/Renderer.js\";\nimport { RendererContext } from \"./internal/RendererContext.js\";\nimport { DataStore } from \"./internal/data/DataStore.js\";\nimport type { RenderRoot, RuntimeContext } from \"./internal/interfaces.js\";\nimport { mountTree, unmountTree } from \"./internal/mount.js\";\nimport { httpErrorToString } from \"./handleHttpError.js\";\nimport { applyMode, applyTheme, setMode, setTheme } from \"./themeAndMode.js\";\nimport { RenderTag } from \"./internal/enums.js\";\nimport { registerStoryboardFunctions } from \"./internal/compute/StoryboardFunctions.js\";\nimport { registerAppI18n } from \"./internal/registerAppI18n.js\";\nimport { registerCustomTemplates } from \"./internal/registerCustomTemplates.js\";\nimport { setUIVersion } from \"./setUIVersion.js\";\n\nexport interface CreateRootOptions {\n portal?: HTMLElement;\n /**\n * Defaults to \"fragment\", only set it to \"page\" when the root is in a standalone iframe.\n * - page: render as whole page, triggering page life cycles, and enable register of functions/templates/i18n.\n * - fragment: render as fragment, not triggering page life cycles, and disable register of functions/templates/i18n.\n */\n scope?: \"page\" | \"fragment\";\n\n /**\n * Whether to throw error when encountering unknown bricks.\n *\n * Defaults to \"throw\".\n */\n unknownBricks?: \"silent\" | \"throw\";\n}\n\nexport interface RenderOptions {\n theme?: SiteTheme;\n uiVersion?: string;\n context?: ContextConf[];\n functions?: StoryboardFunction[];\n templates?: CustomTemplate[];\n i18n?: MetaI18n;\n}\n\nexport function unstable_createRoot(\n container: HTMLElement | DocumentFragment,\n { portal: _portal, scope = \"fragment\", unknownBricks }: CreateRootOptions = {}\n) {\n let portal = _portal;\n let createPortal: RenderRoot[\"createPortal\"];\n if (_portal) {\n createPortal = _portal;\n } else {\n // Create portal container when necessary.\n createPortal = () => {\n portal = document.createElement(\"div\");\n portal.style.position = \"absolute\";\n portal.style.width = portal.style.height = \"0\";\n document.body.append(portal);\n return portal;\n };\n }\n let unmounted = false;\n let rendererContext: RendererContext | undefined;\n let clearI18nBundles: Function | undefined;\n\n return {\n async render(\n brick: BrickConf | BrickConf[],\n {\n theme,\n uiVersion,\n context,\n functions,\n templates,\n i18n: i18nData,\n }: RenderOptions = {}\n ) {\n if (unmounted) {\n throw new Error(\n \"The root is unmounted and cannot be rendered any more\"\n );\n }\n const bricks = ([] as BrickConf[]).concat(brick);\n\n const previousRendererContext = rendererContext;\n const renderId = uniqueId(\"render-id-\");\n rendererContext = new RendererContext(scope, { unknownBricks, renderId });\n\n const runtimeContext = {\n ctxStore: new DataStore(\"CTX\", undefined, rendererContext),\n pendingPermissionsPreCheck: [],\n tplStateStoreMap: new Map<string, DataStore<\"STATE\">>(),\n formStateStoreMap: new Map<string, DataStore<\"FORM_STATE\">>(),\n } as Partial<RuntimeContext> as RuntimeContext;\n\n const renderRoot: RenderRoot = {\n tag: RenderTag.ROOT,\n container,\n createPortal,\n };\n\n if (scope === \"page\") {\n setTheme(theme ?? \"light\");\n setMode(\"default\");\n setUIVersion(uiVersion);\n\n const demoApp = {\n id: \"demo\",\n homepage: \"/demo\",\n } as MicroApp;\n runtimeContext.app = demoApp;\n const demoStoryboard = {\n app: demoApp,\n meta: {\n i18n: i18nData,\n customTemplates: templates,\n },\n } as Storyboard;\n\n // Register i18n.\n clearI18nBundles?.();\n clearI18nBundles = registerAppI18n(demoStoryboard);\n\n // Register custom templates.\n registerCustomTemplates(demoStoryboard);\n\n // Register functions.\n registerStoryboardFunctions(functions, demoApp);\n }\n\n runtimeContext.ctxStore.define(context, runtimeContext);\n\n let failed = false;\n let output: RenderOutput;\n let stores: DataStore<\"CTX\" | \"STATE\" | \"FORM_STATE\">[] = [];\n\n try {\n output = await renderBricks(\n renderRoot,\n bricks,\n runtimeContext,\n rendererContext,\n []\n );\n\n stores = getDataStores(runtimeContext);\n await postAsyncRender(output, runtimeContext, stores);\n } catch (error) {\n failed = true;\n output = {\n node: {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: httpErrorToString(error),\n },\n return: renderRoot,\n runtimeContext: null!,\n },\n blockingList: [],\n menuRequests: [],\n };\n }\n\n renderRoot.child = output.node;\n\n previousRendererContext?.dispatchOnUnmount();\n previousRendererContext?.dispose();\n unmountTree(container);\n if (portal) {\n unmountTree(portal);\n }\n\n if (scope === \"page\") {\n if (!failed) {\n rendererContext.dispatchBeforePageLoad();\n }\n\n applyTheme();\n applyMode();\n }\n\n mountTree(renderRoot);\n\n if (scope === \"page\") {\n window.scrollTo(0, 0);\n }\n\n if (!failed) {\n for (const store of stores) {\n store.mountAsyncData();\n }\n\n if (scope === \"page\") {\n rendererContext.dispatchPageLoad();\n // rendererContext.dispatchAnchorLoad();\n }\n rendererContext.dispatchOnMount();\n rendererContext.initializeScrollIntoView();\n rendererContext.initializeMediaChange();\n rendererContext.initializeMessageDispatcher();\n }\n },\n unmount() {\n if (unmounted) {\n return;\n }\n unmounted = true;\n unmountTree(container);\n if (portal) {\n unmountTree(portal);\n // Only remove the portal from its parent when it's dynamic created.\n if (!_portal) {\n portal.remove();\n }\n }\n },\n };\n}\n"],"mappings":";;;;;;AAUA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAMA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAEA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,oBAAA,GAAAR,OAAA;AACA,IAAAS,gBAAA,GAAAT,OAAA;AACA,IAAAU,wBAAA,GAAAV,OAAA;A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AACzB,MAAM,EAAE;QACX,KAAK,MAAM0B,KAAK,IAAIxB,MAAM,EAAE;UAC1BwB,KAAK,CAACC,cAAc,CAAC,CAAC;QACxB;QAEA,IAAIpF,KAAK,KAAK,MAAM,EAAE;UACpBY,eAAe,CAACyE,gBAAgB,CAAC,CAAC;UAClC;QACF;QACAzE,eAAe,CAAC0E,eAAe,CAAC,CAAC;QACjC1E,eAAe,CAAC2E,wBAAwB,CAAC,CAAC;QAC1C3E,eAAe,CAAC4E,qBAAqB,CAAC,CAAC;QACvC5E,eAAe,CAAC6E,2BAA2B,CAAC,CAAC;MAC/C;IACF,CAAC;IACDC,OAAOA,CAAA,EAAG;MACR,IAAI/E,SAAS,EAAE;QACb;MACF;MACAA,SAAS,GAAG,IAAI;MAChB,IAAAiE,kBAAW,EAAC/E,SAAS,CAAC;MACtB,IAAIC,MAAM,EAAE;QACV,IAAA8E,kBAAW,EAAC9E,MAAM,CAAC;QACnB;QACA,IAAI,CAACC,OAAO,EAAE;UACZD,MAAM,CAAC6F,MAAM,CAAC,CAAC;QACjB;MACF;IACF;EACF,CAAC;AACH"}
1
+ {"version":3,"file":"createRoot.js","names":["_lodash","require","_Renderer","_RendererContext","_DataStore","_mount","_handleHttpError","_themeAndMode","_enums","_StoryboardFunctions","_registerAppI18n","_registerCustomTemplates","_setUIVersion","unstable_createRoot","container","portal","_portal","scope","unknownBricks","createPortal","document","createElement","style","position","width","height","body","append","unmounted","rendererContext","clearI18nBundles","render","brick","theme","uiVersion","context","functions","templates","i18n","i18nData","Error","bricks","concat","previousRendererContext","renderId","uniqueId","RendererContext","runtimeContext","ctxStore","DataStore","undefined","pendingPermissionsPreCheck","tplStateStoreMap","Map","formStateStoreMap","renderRoot","tag","RenderTag","ROOT","_clearI18nBundles","setTheme","setMode","setUIVersion","demoApp","id","homepage","app","demoStoryboard","meta","customTemplates","registerAppI18n","registerCustomTemplates","registerStoryboardFunctions","define","failed","output","stores","renderBricks","getDataStores","postAsyncRender","error","node","BRICK","type","properties","textContent","httpErrorToString","return","blockingList","child","dispatchOnUnmount","dispose","unmountTree","dispatchBeforePageLoad","applyTheme","applyMode","mountTree","window","scrollTo","store","mountAsyncData","dispatchPageLoad","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","initializeMessageDispatcher","unmount","remove"],"sources":["../../src/createRoot.ts"],"sourcesContent":["import type {\n BrickConf,\n ContextConf,\n CustomTemplate,\n MetaI18n,\n MicroApp,\n SiteTheme,\n Storyboard,\n StoryboardFunction,\n} from \"@next-core/types\";\nimport { uniqueId } from \"lodash\";\nimport {\n RenderOutput,\n getDataStores,\n postAsyncRender,\n renderBricks,\n} from \"./internal/Renderer.js\";\nimport { RendererContext } from \"./internal/RendererContext.js\";\nimport { DataStore } from \"./internal/data/DataStore.js\";\nimport type { RenderRoot, RuntimeContext } from \"./internal/interfaces.js\";\nimport { mountTree, unmountTree } from \"./internal/mount.js\";\nimport { httpErrorToString } from \"./handleHttpError.js\";\nimport { applyMode, applyTheme, setMode, setTheme } from \"./themeAndMode.js\";\nimport { RenderTag } from \"./internal/enums.js\";\nimport { registerStoryboardFunctions } from \"./internal/compute/StoryboardFunctions.js\";\nimport { registerAppI18n } from \"./internal/registerAppI18n.js\";\nimport { registerCustomTemplates } from \"./internal/registerCustomTemplates.js\";\nimport { setUIVersion } from \"./setUIVersion.js\";\n\nexport interface CreateRootOptions {\n portal?: HTMLElement;\n /**\n * Defaults to \"fragment\", only set it to \"page\" when the root is in a standalone iframe.\n * - page: render as whole page, triggering page life cycles, and enable register of functions/templates/i18n.\n * - fragment: render as fragment, not triggering page life cycles, and disable register of functions/templates/i18n.\n */\n scope?: \"page\" | \"fragment\";\n\n /**\n * Whether to throw error when encountering unknown bricks.\n *\n * Defaults to \"throw\".\n */\n unknownBricks?: \"silent\" | \"throw\";\n}\n\nexport interface RenderOptions {\n theme?: SiteTheme;\n uiVersion?: string;\n context?: ContextConf[];\n functions?: StoryboardFunction[];\n templates?: CustomTemplate[];\n i18n?: MetaI18n;\n}\n\nexport function unstable_createRoot(\n container: HTMLElement | DocumentFragment,\n { portal: _portal, scope = \"fragment\", unknownBricks }: CreateRootOptions = {}\n) {\n let portal = _portal;\n let createPortal: RenderRoot[\"createPortal\"];\n if (_portal) {\n createPortal = _portal;\n } else {\n // Create portal container when necessary.\n createPortal = () => {\n portal = document.createElement(\"div\");\n portal.style.position = \"absolute\";\n portal.style.width = portal.style.height = \"0\";\n document.body.append(portal);\n return portal;\n };\n }\n let unmounted = false;\n let rendererContext: RendererContext | undefined;\n let clearI18nBundles: Function | undefined;\n\n return {\n async render(\n brick: BrickConf | BrickConf[],\n {\n theme,\n uiVersion,\n context,\n functions,\n templates,\n i18n: i18nData,\n }: RenderOptions = {}\n ) {\n if (unmounted) {\n throw new Error(\n \"The root is unmounted and cannot be rendered any more\"\n );\n }\n const bricks = ([] as BrickConf[]).concat(brick);\n\n const previousRendererContext = rendererContext;\n const renderId = uniqueId(\"render-id-\");\n rendererContext = new RendererContext(scope, { unknownBricks, renderId });\n\n const runtimeContext = {\n ctxStore: new DataStore(\"CTX\", undefined, rendererContext),\n pendingPermissionsPreCheck: [],\n tplStateStoreMap: new Map<string, DataStore<\"STATE\">>(),\n formStateStoreMap: new Map<string, DataStore<\"FORM_STATE\">>(),\n } as Partial<RuntimeContext> as RuntimeContext;\n\n const renderRoot: RenderRoot = {\n tag: RenderTag.ROOT,\n container,\n createPortal,\n };\n\n if (scope === \"page\") {\n setTheme(theme ?? \"light\");\n setMode(\"default\");\n setUIVersion(uiVersion);\n\n const demoApp = {\n id: \"demo\",\n homepage: \"/demo\",\n } as MicroApp;\n runtimeContext.app = demoApp;\n const demoStoryboard = {\n app: demoApp,\n meta: {\n i18n: i18nData,\n customTemplates: templates,\n },\n } as Storyboard;\n\n // Register i18n.\n clearI18nBundles?.();\n clearI18nBundles = registerAppI18n(demoStoryboard);\n\n // Register custom templates.\n registerCustomTemplates(demoStoryboard);\n\n // Register functions.\n registerStoryboardFunctions(functions, demoApp);\n }\n\n runtimeContext.ctxStore.define(context, runtimeContext);\n\n let failed = false;\n let output: RenderOutput;\n let stores: DataStore<\"CTX\" | \"STATE\" | \"FORM_STATE\">[] = [];\n\n try {\n output = await renderBricks(\n renderRoot,\n bricks,\n runtimeContext,\n rendererContext,\n [],\n {}\n );\n\n stores = getDataStores(runtimeContext);\n await postAsyncRender(output, runtimeContext, stores);\n } catch (error) {\n failed = true;\n output = {\n node: {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: httpErrorToString(error),\n },\n return: renderRoot,\n runtimeContext: null!,\n },\n blockingList: [],\n };\n }\n\n renderRoot.child = output.node;\n\n previousRendererContext?.dispatchOnUnmount();\n previousRendererContext?.dispose();\n unmountTree(container);\n if (portal) {\n unmountTree(portal);\n }\n\n if (scope === \"page\") {\n if (!failed) {\n rendererContext.dispatchBeforePageLoad();\n }\n\n applyTheme();\n applyMode();\n }\n\n mountTree(renderRoot);\n\n if (scope === \"page\") {\n window.scrollTo(0, 0);\n }\n\n if (!failed) {\n for (const store of stores) {\n store.mountAsyncData();\n }\n\n if (scope === \"page\") {\n rendererContext.dispatchPageLoad();\n // rendererContext.dispatchAnchorLoad();\n }\n rendererContext.dispatchOnMount();\n rendererContext.initializeScrollIntoView();\n rendererContext.initializeMediaChange();\n rendererContext.initializeMessageDispatcher();\n }\n },\n unmount() {\n if (unmounted) {\n return;\n }\n unmounted = true;\n unmountTree(container);\n if (portal) {\n unmountTree(portal);\n // Only remove the portal from its parent when it's dynamic created.\n if (!_portal) {\n portal.remove();\n }\n }\n },\n };\n}\n"],"mappings":";;;;;;AAUA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAMA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAEA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,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,KAAK,MAAM,EAAE;QACpBgF,MAAM,CAACC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;MACvB;MAEA,IAAI,CAACxB,MAAM,EAAE;QACX,KAAK,MAAMyB,KAAK,IAAIvB,MAAM,EAAE;UAC1BuB,KAAK,CAACC,cAAc,CAAC,CAAC;QACxB;QAEA,IAAInF,KAAK,KAAK,MAAM,EAAE;UACpBY,eAAe,CAACwE,gBAAgB,CAAC,CAAC;UAClC;QACF;QACAxE,eAAe,CAACyE,eAAe,CAAC,CAAC;QACjCzE,eAAe,CAAC0E,wBAAwB,CAAC,CAAC;QAC1C1E,eAAe,CAAC2E,qBAAqB,CAAC,CAAC;QACvC3E,eAAe,CAAC4E,2BAA2B,CAAC,CAAC;MAC/C;IACF,CAAC;IACDC,OAAOA,CAAA,EAAG;MACR,IAAI9E,SAAS,EAAE;QACb;MACF;MACAA,SAAS,GAAG,IAAI;MAChB,IAAAgE,kBAAW,EAAC9E,SAAS,CAAC;MACtB,IAAIC,MAAM,EAAE;QACV,IAAA6E,kBAAW,EAAC7E,MAAM,CAAC;QACnB;QACA,IAAI,CAACC,OAAO,EAAE;UACZD,MAAM,CAAC4F,MAAM,CAAC,CAAC;QACjB;MACF;IACF;EACF,CAAC;AACH"}
@@ -35,9 +35,13 @@ var _evaluate = require("./compute/evaluate.js");
35
35
  var _matchStoryboard = require("./matchStoryboard.js");
36
36
  var _bindListeners = require("./bindListeners.js");
37
37
  var _setupRootRuntimeContext = require("./setupRootRuntimeContext.js");
38
- async function renderRoutes(returnNode, routes, _runtimeContext, rendererContext, parentRoutes, slotId, isIncremental) {
38
+ async function renderRoutes(returnNode, routes, _runtimeContext, rendererContext, parentRoutes, menuRequestReturnNode, slotId, isIncremental) {
39
39
  const matched = await (0, _matchRoutes.matchRoutes)(routes, _runtimeContext);
40
40
  const output = getEmptyRenderOutput();
41
+ const menuRequestNode = {
42
+ return: menuRequestReturnNode
43
+ };
44
+ output.menuRequestNode = menuRequestNode;
41
45
  switch (matched) {
42
46
  case "missed":
43
47
  break;
@@ -90,29 +94,30 @@ async function renderRoutes(returnNode, routes, _runtimeContext, rendererContext
90
94
  } else {
91
95
  const menuRequest = loadMenu(route.menu, runtimeContext);
92
96
  if (menuRequest) {
93
- output.menuRequests.push(menuRequest);
97
+ menuRequestNode.request = menuRequest;
98
+ }
99
+ if (!isIncremental) {
100
+ rendererContext.memoizeMenuRequestNode(routes, menuRequestNode);
94
101
  }
102
+ let newOutput;
95
103
  if (route.type === "routes") {
96
- const newOutput = await renderRoutes(returnNode, route.routes, runtimeContext, rendererContext, routePath, slotId);
97
- mergeRenderOutput(output, newOutput);
104
+ newOutput = await renderRoutes(returnNode, route.routes, runtimeContext, rendererContext, routePath, menuRequestNode, slotId);
98
105
  } else {
99
- const newOutput = await renderBricks(returnNode, route.bricks, runtimeContext, rendererContext, routePath, slotId);
100
- mergeRenderOutput(output, newOutput);
101
- }
102
- if (returnNode.tag === _enums.RenderTag.BRICK) {
103
- rendererContext.memoizeMenuRequests(route, output.menuRequests);
106
+ newOutput = await renderBricks(returnNode, route.bricks, runtimeContext, rendererContext, routePath, menuRequestNode, slotId);
104
107
  }
108
+ mergeRenderOutput(output, newOutput);
109
+ appendMenuRequestNode(menuRequestReturnNode, newOutput.menuRequestNode);
105
110
  }
106
111
  }
107
112
  }
108
113
  return output;
109
114
  }
110
- async function renderBricks(returnNode, bricks, runtimeContext, rendererContext, parentRoutes, slotId, tplStack, keyPath) {
115
+ async function renderBricks(returnNode, bricks, runtimeContext, rendererContext, parentRoutes, menuRequestReturnNode, slotId, tplStack, keyPath) {
111
116
  (0, _setupRootRuntimeContext.setupRootRuntimeContext)(bricks, runtimeContext, true);
112
117
  const output = getEmptyRenderOutput();
113
118
  const kPath = keyPath !== null && keyPath !== void 0 ? keyPath : [];
114
119
  // 多个构件并行异步转换,但转换的结果按原顺序串行合并。
115
- const rendered = await Promise.all(bricks.map((brickConf, index) => renderBrick(returnNode, brickConf, runtimeContext, rendererContext, parentRoutes, slotId, kPath.concat(index), tplStack && new Map(tplStack))));
120
+ const rendered = await Promise.all(bricks.map((brickConf, index) => renderBrick(returnNode, brickConf, runtimeContext, rendererContext, parentRoutes, menuRequestReturnNode, slotId, kPath.concat(index), tplStack && new Map(tplStack))));
116
121
  rendered.forEach((item, index) => {
117
122
  if (item.hasTrackingControls) {
118
123
  // Memoize a render node before it's been merged.
@@ -122,7 +127,7 @@ async function renderBricks(returnNode, bricks, runtimeContext, rendererContext,
122
127
  });
123
128
  return output;
124
129
  }
125
- async function renderBrick(returnNode, brickConf, _runtimeContext, rendererContext, parentRoutes, slotId, keyPath = [], tplStack = new Map()) {
130
+ async function renderBrick(returnNode, brickConf, _runtimeContext, rendererContext, parentRoutes, menuRequestReturnNode, slotId, keyPath = [], tplStack = new Map()) {
126
131
  var _hooks$checkPermissio2, _runtimeContext$app;
127
132
  const output = getEmptyRenderOutput();
128
133
  if (!brickConf.brick) {
@@ -160,7 +165,7 @@ async function renderBrick(returnNode, brickConf, _runtimeContext, rendererConte
160
165
  ...acc,
161
166
  [symbol]: brickConf[symbol]
162
167
  }), {})
163
- }, _runtimeContext, rendererContext, parentRoutes, slotId, keyPath, tplStack);
168
+ }, _runtimeContext, rendererContext, parentRoutes, menuRequestReturnNode, slotId, keyPath, tplStack);
164
169
  }
165
170
  const tplStateStoreId = brickConf[_constants.symbolForTplStateStoreId];
166
171
  const formStateStoreId = brickConf[_constants2.symbolForFormStateStoreId];
@@ -222,12 +227,12 @@ async function renderBrick(returnNode, brickConf, _runtimeContext, rendererConte
222
227
  if (!Array.isArray(computedDataSource)) {
223
228
  return getEmptyRenderOutput();
224
229
  }
225
- return renderForEach(returnNode, computedDataSource, bricks, runtimeContext, rendererContext, parentRoutes, slotId, tplStack, keyPath);
230
+ return renderForEach(returnNode, computedDataSource, bricks, runtimeContext, rendererContext, parentRoutes, menuRequestReturnNode, slotId, tplStack, keyPath);
226
231
  }
227
232
  case ":if":
228
233
  case ":switch":
229
234
  {
230
- return renderBricks(returnNode, bricks, runtimeContext, rendererContext, parentRoutes, slotId, tplStack, keyPath);
235
+ return renderBricks(returnNode, bricks, runtimeContext, rendererContext, parentRoutes, menuRequestReturnNode, slotId, tplStack, keyPath);
231
236
  }
232
237
  }
233
238
  };
@@ -433,12 +438,12 @@ async function renderBrick(returnNode, brickConf, _runtimeContext, rendererConte
433
438
  const routeSlotFromIndexToSlotId = new Map();
434
439
  const rendered = await Promise.all(Object.entries(slots).map(([childSlotId, slotConf], index) => {
435
440
  if (slotConf.type !== "routes") {
436
- return renderBricks(brick, slotConf.bricks, childRuntimeContext, rendererContext, parentRoutes, childSlotId, tplStack);
441
+ return renderBricks(brick, slotConf.bricks, childRuntimeContext, rendererContext, parentRoutes, menuRequestReturnNode, childSlotId, tplStack);
437
442
  }
438
443
  const parentRoute = parentRoutes[parentRoutes.length - 1];
439
444
  if (parentRoute !== null && parentRoute !== void 0 && parentRoute.incrementalSubRoutes) {
440
445
  routeSlotFromIndexToSlotId.set(index, childSlotId);
441
- rendererContext.performIncrementalRender(async (location, prevLocation) => {
446
+ rendererContext.performIncrementalRender(slotConf, parentRoutes, async (location, prevLocation) => {
442
447
  const {
443
448
  homepage
444
449
  } = childRuntimeContext.app;
@@ -462,18 +467,19 @@ async function renderBrick(returnNode, brickConf, _runtimeContext, rendererConte
462
467
  let incrementalOutput;
463
468
  let scopedStores = [];
464
469
  try {
465
- incrementalOutput = await renderRoutes(brick, slotConf.routes, scopedRuntimeContext, rendererContext, parentRoutes, childSlotId, true);
470
+ incrementalOutput = await renderRoutes(brick, slotConf.routes, scopedRuntimeContext, rendererContext, parentRoutes, menuRequestReturnNode, childSlotId, true);
466
471
 
467
472
  // Do not ignore incremental rendering even if all sub-routes are missed.
468
473
  // Since parent route is matched.
469
-
470
- // Bailout if redirect or unauthenticated is set
471
- if (rendererContext.reBailout(incrementalOutput)) {
472
- return true;
474
+ if (incrementalOutput.route) {
475
+ // Bailout if redirect or unauthenticated is set
476
+ if (rendererContext.reBailout(incrementalOutput)) {
477
+ return true;
478
+ }
479
+ scopedStores = [...tplStateStoreScope, ...formStateStoreScope];
480
+ await postAsyncRender(incrementalOutput, scopedRuntimeContext, [scopedRuntimeContext.ctxStore, ...scopedStores]);
473
481
  }
474
- scopedStores = [...tplStateStoreScope, ...formStateStoreScope];
475
- await postAsyncRender(incrementalOutput, scopedRuntimeContext, [scopedRuntimeContext.ctxStore, ...scopedStores]);
476
- await rendererContext.reMergeMenuRequests(slotConf.routes, incrementalOutput.route, incrementalOutput.menuRequests);
482
+ await rendererContext.reMergeMenuRequestNodes(menuRequestReturnNode, slotConf.routes, incrementalOutput.menuRequestNode);
477
483
  } catch (error) {
478
484
  // eslint-disable-next-line no-console
479
485
  console.error("Incremental sub-router failed:", error);
@@ -487,7 +493,7 @@ async function renderBrick(returnNode, brickConf, _runtimeContext, rendererConte
487
493
  } = result);
488
494
 
489
495
  // Assert: no errors will be throw
490
- await rendererContext.reMergeMenuRequests(slotConf.routes, incrementalOutput.route, incrementalOutput.menuRequests);
496
+ await rendererContext.reMergeMenuRequestNodes(menuRequestReturnNode, slotConf.routes, incrementalOutput.menuRequestNode);
491
497
  }
492
498
  rendererContext.reRender(childSlotId, [], incrementalOutput.node, brick);
493
499
  if (!failed) {
@@ -496,16 +502,19 @@ async function renderBrick(returnNode, brickConf, _runtimeContext, rendererConte
496
502
  store.mountAsyncData();
497
503
  }
498
504
  }
499
- return true;
505
+
506
+ // When result is null, it means the incremental rendering is tried but routes missed.
507
+ // In this case, we should continue to re-render the parent routes.
508
+ return incrementalOutput.route ? true : null;
500
509
  });
501
510
  }
502
- return renderRoutes(brick, slotConf.routes, childRuntimeContext, rendererContext, parentRoutes, childSlotId);
511
+ return renderRoutes(brick, slotConf.routes, childRuntimeContext, rendererContext, parentRoutes, menuRequestReturnNode, childSlotId);
503
512
  }));
504
513
  const childrenOutput = {
505
514
  ...output,
506
515
  node: undefined,
507
516
  blockingList: [],
508
- menuRequests: []
517
+ menuRequestNode: undefined
509
518
  };
510
519
  rendered.forEach((item, index) => {
511
520
  if (routeSlotFromIndexToSlotId.has(index)) {
@@ -513,6 +522,7 @@ async function renderBrick(returnNode, brickConf, _runtimeContext, rendererConte
513
522
  rendererContext.memoize(routeSlotFromIndexToSlotId.get(index), [], item.node, brick);
514
523
  }
515
524
  mergeRenderOutput(childrenOutput, item);
525
+ mergeSiblingRenderMenuRequest(childrenOutput, item);
516
526
  });
517
527
  if (childrenOutput.node) {
518
528
  brick.child = childrenOutput.node;
@@ -521,6 +531,7 @@ async function renderBrick(returnNode, brickConf, _runtimeContext, rendererConte
521
531
  ...childrenOutput,
522
532
  node: undefined
523
533
  });
534
+ appendMenuRequestNode(menuRequestReturnNode, output.menuRequestNode = childrenOutput.menuRequestNode);
524
535
  };
525
536
  blockingList.push(loadChildren());
526
537
  await Promise.all(blockingList);
@@ -536,14 +547,14 @@ function ensureValidControlBrick(brick) {
536
547
  throw new Error(`Unknown storyboard control node: "${brick}"`);
537
548
  }
538
549
  }
539
- async function renderForEach(returnNode, dataSource, bricks, runtimeContext, rendererContext, parentRoutes, slotId, tplStack, keyPath) {
550
+ async function renderForEach(returnNode, dataSource, bricks, runtimeContext, rendererContext, parentRoutes, menuRequestReturnNode, slotId, tplStack, keyPath) {
540
551
  const output = getEmptyRenderOutput();
541
552
  const rows = dataSource.length;
542
553
  const rendered = await Promise.all(dataSource.map((item, i) => Promise.all(bricks.map((brickConf, j) => renderBrick(returnNode, brickConf, {
543
554
  ...runtimeContext,
544
555
  forEachItem: item,
545
556
  forEachIndex: i
546
- }, rendererContext, parentRoutes, slotId, keyPath.concat(i * rows + j), tplStack && new Map(tplStack))))));
557
+ }, rendererContext, parentRoutes, menuRequestReturnNode, slotId, keyPath.concat(i * rows + j), tplStack && new Map(tplStack))))));
547
558
 
548
559
  // 多层构件并行异步转换,但转换的结果按原顺序串行合并。
549
560
  rendered.flat().forEach((item, index) => {
@@ -597,12 +608,11 @@ function mergeRenderOutput(output, newOutput) {
597
608
  const {
598
609
  blockingList,
599
610
  node,
600
- menuRequests,
611
+ menuRequestNode,
601
612
  hasTrackingControls,
602
613
  ...rest
603
614
  } = newOutput;
604
615
  output.blockingList.push(...blockingList);
605
- output.menuRequests.push(...menuRequests);
606
616
  if (node) {
607
617
  if (output.node) {
608
618
  let last = output.node;
@@ -616,10 +626,37 @@ function mergeRenderOutput(output, newOutput) {
616
626
  }
617
627
  Object.assign(output, rest);
618
628
  }
629
+ function mergeSiblingRenderMenuRequest(output, newOutput) {
630
+ const menuRequestNode = newOutput.menuRequestNode;
631
+ if (menuRequestNode) {
632
+ if (output.menuRequestNode) {
633
+ let last = output.menuRequestNode;
634
+ while (last.sibling) {
635
+ last = last.sibling;
636
+ }
637
+ last.sibling = menuRequestNode;
638
+ } else {
639
+ output.menuRequestNode = menuRequestNode;
640
+ }
641
+ }
642
+ }
643
+ function appendMenuRequestNode(menuRequestReturnNode, menuRequestNode) {
644
+ if (!menuRequestNode) {
645
+ return;
646
+ }
647
+ if (menuRequestReturnNode.child) {
648
+ let last = menuRequestReturnNode.child;
649
+ while (last.sibling) {
650
+ last = last.sibling;
651
+ }
652
+ last.sibling = menuRequestNode;
653
+ } else {
654
+ menuRequestReturnNode.child = menuRequestNode;
655
+ }
656
+ }
619
657
  function getEmptyRenderOutput() {
620
658
  return {
621
- blockingList: [],
622
- menuRequests: []
659
+ blockingList: []
623
660
  };
624
661
  }
625
662
  function childrenToSlots(children, originalSlots) {