@next-core/runtime 1.62.1 → 1.62.2
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 +69 -50
- package/dist/cjs/internal/Renderer.js.map +1 -1
- package/dist/cjs/internal/RendererContext.js +99 -117
- package/dist/cjs/internal/RendererContext.js.map +1 -1
- package/dist/cjs/internal/enums.js +1 -1
- package/dist/cjs/internal/enums.js.map +1 -1
- package/dist/cjs/internal/interfaces.js.map +1 -1
- package/dist/cjs/internal/mount.js +12 -5
- package/dist/cjs/internal/mount.js.map +1 -1
- package/dist/cjs/internal/secret_internals.js +10 -7
- package/dist/cjs/internal/secret_internals.js.map +1 -1
- package/dist/esm/internal/Renderer.js +71 -53
- package/dist/esm/internal/Renderer.js.map +1 -1
- package/dist/esm/internal/RendererContext.js +99 -117
- package/dist/esm/internal/RendererContext.js.map +1 -1
- package/dist/esm/internal/enums.js +1 -1
- package/dist/esm/internal/enums.js.map +1 -1
- package/dist/esm/internal/interfaces.js.map +1 -1
- package/dist/esm/internal/mount.js +12 -5
- package/dist/esm/internal/mount.js.map +1 -1
- package/dist/esm/internal/secret_internals.js +10 -7
- package/dist/esm/internal/secret_internals.js.map +1 -1
- package/dist/types/internal/Renderer.d.ts +2 -3
- package/dist/types/internal/RendererContext.d.ts +1 -2
- package/dist/types/internal/enums.d.ts +1 -1
- package/dist/types/internal/interfaces.d.ts +5 -7
- package/package.json +2 -2
|
@@ -56,10 +56,18 @@ function mountTree(root, initializedElement) {
|
|
|
56
56
|
if (current.portal) {
|
|
57
57
|
portalElements.push(element);
|
|
58
58
|
} else if (current.return) {
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
let currentReturn = current.return;
|
|
60
|
+
while (currentReturn) {
|
|
61
|
+
if (currentReturn.tag === _enums.RenderTag.ABSTRACT) {
|
|
62
|
+
currentReturn = currentReturn.return;
|
|
63
|
+
} else {
|
|
64
|
+
if (!currentReturn.childElements) {
|
|
65
|
+
currentReturn.childElements = [];
|
|
66
|
+
}
|
|
67
|
+
currentReturn.childElements.push(element);
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
61
70
|
}
|
|
62
|
-
current.return.childElements.push(element);
|
|
63
71
|
}
|
|
64
72
|
}
|
|
65
73
|
if (current.child) {
|
|
@@ -71,12 +79,11 @@ function mountTree(root, initializedElement) {
|
|
|
71
79
|
let currentReturn = current.return;
|
|
72
80
|
while (currentReturn) {
|
|
73
81
|
// Append elements inside out
|
|
74
|
-
if (currentReturn.childElements) {
|
|
82
|
+
if (currentReturn.tag !== _enums.RenderTag.ABSTRACT && currentReturn.childElements) {
|
|
75
83
|
if (currentReturn.tag === _enums.RenderTag.ROOT) {
|
|
76
84
|
var _currentReturn$contai;
|
|
77
85
|
(_currentReturn$contai = currentReturn.container) === null || _currentReturn$contai === void 0 || _currentReturn$contai.append(...currentReturn.childElements);
|
|
78
86
|
} else {
|
|
79
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
80
87
|
currentReturn.element.append(...currentReturn.childElements);
|
|
81
88
|
}
|
|
82
89
|
currentReturn.childElements = undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.js","names":["_bindTemplateProxy","require","_utils","_bindListeners","_setRealProperties","_enums","unmountTree","mountPoint","replaceChildren","mountTree","root","initializedElement","window","DISABLE_REACT_FLUSH_SYNC","current","child","portalElements","tag","RenderTag","BRICK","_current$tplHostMetad","tagName","type","includes","customElements","get","console","error","warn","element","document","createElement","slotId","setAttribute","iid","dataset","tplHostMetadata","tplStateStoreId","setRealProperties","properties","bindListeners","events","runtimeContext","$$tplStateStore","getTplStateStore","tplStateStoreMap","bindTemplateProxy","portal","push","return","childElements","sibling","_currentReturn","
|
|
1
|
+
{"version":3,"file":"mount.js","names":["_bindTemplateProxy","require","_utils","_bindListeners","_setRealProperties","_enums","unmountTree","mountPoint","replaceChildren","mountTree","root","initializedElement","window","DISABLE_REACT_FLUSH_SYNC","current","child","portalElements","tag","RenderTag","BRICK","_current$tplHostMetad","tagName","type","includes","customElements","get","console","error","warn","element","document","createElement","slotId","setAttribute","iid","dataset","tplHostMetadata","tplStateStoreId","setRealProperties","properties","bindListeners","events","runtimeContext","$$tplStateStore","getTplStateStore","tplStateStoreMap","bindTemplateProxy","portal","push","return","currentReturn","ABSTRACT","childElements","sibling","_currentReturn","ROOT","_currentReturn$contai","container","append","undefined","length","createPortal","setTimeout"],"sources":["../../../src/internal/mount.ts"],"sourcesContent":["import { bindTemplateProxy } from \"./CustomTemplates/bindTemplateProxy.js\";\nimport { getTplStateStore } from \"./CustomTemplates/utils.js\";\nimport { bindListeners } from \"./bindListeners.js\";\nimport { setRealProperties } from \"./compute/setRealProperties.js\";\nimport { RenderTag } from \"./enums.js\";\nimport type {\n RenderReturnNode,\n RenderRoot,\n RuntimeBrickElement,\n} from \"./interfaces.js\";\n\nexport function unmountTree(mountPoint: HTMLElement | DocumentFragment) {\n mountPoint.replaceChildren();\n}\n\nexport function mountTree(\n root: RenderRoot,\n initializedElement?: RuntimeBrickElement\n): void {\n window.DISABLE_REACT_FLUSH_SYNC = false;\n let current = root.child;\n const portalElements: RuntimeBrickElement[] = [];\n while (current) {\n if (current.tag === RenderTag.BRICK) {\n const tagName = current.type;\n\n if (tagName.includes(\"-\") && !customElements.get(tagName)) {\n // eslint-disable-next-line no-console\n console.error(`Undefined custom element: ${tagName}`);\n }\n\n // istanbul ignore if\n if (tagName === \"basic-bricks.script-brick\") {\n // eslint-disable-next-line no-console\n console.warn(\n \"`basic-bricks.script-brick` is deprecated, please take caution when using it\"\n );\n }\n\n const element: RuntimeBrickElement =\n initializedElement && current === root.child\n ? initializedElement\n : document.createElement(tagName);\n current.element = element;\n\n if (current.slotId) {\n element.setAttribute(\"slot\", current.slotId);\n }\n if (current.iid) {\n element.dataset.iid = current.iid;\n }\n if (current.tplHostMetadata?.tplStateStoreId) {\n element.dataset.tplStateStoreId =\n current.tplHostMetadata.tplStateStoreId;\n }\n setRealProperties(element, current.properties);\n bindListeners(element, current.events, current.runtimeContext);\n if (current.tplHostMetadata) {\n // 先设置属性,再设置 `$$tplStateStore`,这样,当触发属性设置时,\n // 避免初始化的一次 state update 操作及其 onChange 事件。\n element.$$tplStateStore = getTplStateStore(\n {\n tplStateStoreId: current.tplHostMetadata.tplStateStoreId,\n tplStateStoreMap: current.runtimeContext.tplStateStoreMap,\n },\n \"mount\"\n );\n }\n bindTemplateProxy(current);\n\n if (current.portal) {\n portalElements.push(element);\n } else if (current.return) {\n let currentReturn = current.return;\n while (currentReturn) {\n if (currentReturn.tag === RenderTag.ABSTRACT) {\n currentReturn = currentReturn.return;\n } else {\n if (!currentReturn.childElements) {\n currentReturn.childElements = [];\n }\n currentReturn.childElements.push(element);\n break;\n }\n }\n }\n }\n\n if (current.child) {\n current = current.child;\n } else if (current.sibling) {\n current = current.sibling;\n } else {\n let currentReturn: RenderReturnNode | null | undefined = current.return;\n while (currentReturn) {\n // Append elements inside out\n if (\n currentReturn.tag !== RenderTag.ABSTRACT &&\n currentReturn.childElements\n ) {\n if (currentReturn.tag === RenderTag.ROOT) {\n currentReturn.container?.append(...currentReturn.childElements);\n } else {\n currentReturn.element!.append(...currentReturn.childElements);\n }\n currentReturn.childElements = undefined;\n }\n\n if (currentReturn.tag === RenderTag.ROOT && portalElements.length > 0) {\n const portal =\n typeof currentReturn.createPortal === \"function\"\n ? currentReturn.createPortal()\n : currentReturn.createPortal;\n portal.append(...portalElements);\n }\n\n if (currentReturn.sibling) {\n break;\n }\n currentReturn = currentReturn.return;\n }\n current = currentReturn?.sibling;\n }\n }\n setTimeout(() => {\n window.DISABLE_REACT_FLUSH_SYNC = true;\n });\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OA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C,MAAM;MACvE,OAAOC,aAAa,EAAE;QACpB;QACA,IACEA,aAAa,CAACjC,GAAG,KAAKC,gBAAS,CAACiC,QAAQ,IACxCD,aAAa,CAACE,aAAa,EAC3B;UACA,IAAIF,aAAa,CAACjC,GAAG,KAAKC,gBAAS,CAACqC,IAAI,EAAE;YAAA,IAAAC,qBAAA;YACxC,CAAAA,qBAAA,GAAAN,aAAa,CAACO,SAAS,cAAAD,qBAAA,eAAvBA,qBAAA,CAAyBE,MAAM,CAAC,GAAGR,aAAa,CAACE,aAAa,CAAC;UACjE,CAAC,MAAM;YACLF,aAAa,CAACrB,OAAO,CAAE6B,MAAM,CAAC,GAAGR,aAAa,CAACE,aAAa,CAAC;UAC/D;UACAF,aAAa,CAACE,aAAa,GAAGO,SAAS;QACzC;QAEA,IAAIT,aAAa,CAACjC,GAAG,KAAKC,gBAAS,CAACqC,IAAI,IAAIvC,cAAc,CAAC4C,MAAM,GAAG,CAAC,EAAE;UACrE,MAAMb,MAAM,GACV,OAAOG,aAAa,CAACW,YAAY,KAAK,UAAU,GAC5CX,aAAa,CAACW,YAAY,CAAC,CAAC,GAC5BX,aAAa,CAACW,YAAY;UAChCd,MAAM,CAACW,MAAM,CAAC,GAAG1C,cAAc,CAAC;QAClC;QAEA,IAAIkC,aAAa,CAACG,OAAO,EAAE;UACzB;QACF;QACAH,aAAa,GAAGA,aAAa,CAACD,MAAM;MACtC;MACAnC,OAAO,IAAAwC,cAAA,GAAGJ,aAAa,cAAAI,cAAA,uBAAbA,cAAA,CAAeD,OAAO;IAClC;EACF;EACAS,UAAU,CAAC,MAAM;IACflD,MAAM,CAACC,wBAAwB,GAAG,IAAI;EACxC,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -70,7 +70,7 @@ var _realTimeDataInspect = require("./data/realTimeDataInspect.js");
|
|
|
70
70
|
var _legacy_transform = require("./legacy_transform.js");
|
|
71
71
|
const symbolForRootRuntimeContext = exports.symbolForRootRuntimeContext = Symbol.for("root.runtimeContext");
|
|
72
72
|
async function renderUseBrick(useBrick, data, errorBoundary) {
|
|
73
|
-
var
|
|
73
|
+
var _brickNode;
|
|
74
74
|
const [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope] = (0, _Renderer.createScopedRuntimeContext)({
|
|
75
75
|
...(useBrick[symbolForRootRuntimeContext] ?? (0, _Runtime._internalApiGetRuntimeContext)()),
|
|
76
76
|
data,
|
|
@@ -92,17 +92,20 @@ async function renderUseBrick(useBrick, data, errorBoundary) {
|
|
|
92
92
|
}, scopedRuntimeContext, rendererContext, [], {});
|
|
93
93
|
const scopedStores = [...tplStateStoreScope, ...formStateStoreScope];
|
|
94
94
|
await (0, _Renderer.postAsyncRender)(output, scopedRuntimeContext, scopedStores);
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
let brickNode;
|
|
96
|
+
let currentNode = output.node;
|
|
97
|
+
while (currentNode) {
|
|
98
|
+
if (currentNode.tag === _enums.RenderTag.BRICK) {
|
|
99
|
+
brickNode = currentNode;
|
|
100
|
+
break;
|
|
98
101
|
}
|
|
99
|
-
|
|
102
|
+
currentNode = currentNode.child;
|
|
100
103
|
}
|
|
101
|
-
if ((
|
|
104
|
+
if ((_brickNode = brickNode) !== null && _brickNode !== void 0 && _brickNode.portal) {
|
|
102
105
|
throw new Error("The root brick of useBrick cannot be a portal brick");
|
|
103
106
|
}
|
|
104
107
|
renderRoot.child = output.node;
|
|
105
|
-
const tagName =
|
|
108
|
+
const tagName = brickNode ? brickNode.type : null;
|
|
106
109
|
return {
|
|
107
110
|
tagName,
|
|
108
111
|
renderRoot,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secret_internals.js","names":["_lodash","require","_Runtime","_Renderer","_RendererContext","_resolveData","_computeRealValue","_mount","_enums","_isStrictMode","_CustomTemplates","_registerAppI18n","_utils","_loader","_routeMatchedMap","_realTimeDataInspect","_legacy_transform","symbolForRootRuntimeContext","exports","Symbol","for","renderUseBrick","useBrick","data","errorBoundary","_output$node","_output$node2","scopedRuntimeContext","tplStateStoreScope","formStateStoreScope","createScopedRuntimeContext","_internalApiGetRuntimeContext","pendingPermissionsPreCheck","inUseBrick","tplStateStoreMap","Map","formStateStoreMap","rendererContext","RendererContext","renderRoot","tag","RenderTag","ROOT","createPortal","strict","isStrictMode","output","renderBrick","scopedStores","postAsyncRender","node","PLACEHOLDER","tracking","Error","undefined","portal","child","tagName","type","mountUseBrick","element","portalRoot","document","querySelector","createElement","appendChild","mountTree","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","initializeMessageDispatcher","store","mountAsyncData","unmountUseBrick","mountResult","unmountTree","remove","dispatchOnUnmount","dispose","updateStoryboard","appId","storyboardPatch","storyboard","_internalApiGetStoryboardInBootstrapData","Object","assign","meta","$$fulfilling","$$fulfilled","$$registerCustomTemplateProcessed","registerAppI18n","updateStoryboardByRoute","newRoute","matched","matchRoute","route","path","exact","replaceRoutes","routes","forEach","index","Array","isArray","bricks","replaceBricks","brick","slots","slotConf","values","unshift","updateStoryboardByTemplate","newTemplate","settings","tplName","name","customTemplates","define","proxy","state","updateTemplatePreviewSettings","templateId","_updatePreviewSettings","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","brickPackages","loadEditorsImperatively","getRenderId","_internalApiGetRenderId","getAddedContracts","updateStoryboardType","collectUsedContracts","updatedStoryboard","_storyboard$routes","snippetPreviewPath","currentRoute","addedContracts","contractApis","api","_storyboard$meta","_","namespaceId","match","contracts","some","contract","push","debugDataValue","debugData","routeId","getMatchedRoute","resolve","resolveData","cache","asyncComputeRealValue","value","getLegalRuntimeValue","options","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 BrickPackage,\n RouteConfOfBricks,\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 { isStrictMode } 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.inUseBrick = true;\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 strict = isStrictMode();\n\n const output = await renderBrick(\n renderRoot,\n strict && !errorBoundary\n ? useBrick\n : {\n errorBoundary,\n ...useBrick,\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 if (output.node.tracking) {\n throw new Error(\n \"The root brick of useBrick cannot be an ignored tracking control node\"\n );\n }\n output.node = undefined;\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\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 matched = false;\n\n function matchRoute(route: RouteConf) {\n return route.path === newRoute.path && !route.exact === !newRoute.exact;\n }\n\n function replaceRoutes(routes: RouteConf[]) {\n routes.forEach((route, index) => {\n if (route.type === \"routes\") {\n replaceRoutes(route.routes);\n } else {\n if (matchRoute(route)) {\n matched = true;\n routes[index] = newRoute;\n } else if (Array.isArray((route as RouteConfOfBricks).bricks)) {\n replaceBricks((route as RouteConfOfBricks).bricks);\n }\n }\n });\n }\n\n function replaceBricks(bricks: BrickConf[]) {\n bricks.forEach((brick) => {\n if (brick.slots) {\n for (const slotConf of Object.values(brick.slots)) {\n if (slotConf.type === \"routes\") {\n replaceRoutes(slotConf.routes);\n } else {\n replaceBricks(slotConf.bricks);\n }\n }\n }\n });\n }\n\n replaceRoutes(storyboard.routes);\n\n if (!matched) {\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\n/**\n * Try the brick packages passed in, before using from bootstrap.\n */\nexport function loadEditors(\n editors: string[] | Set<string>,\n brickPackages?: BrickPackage[]\n) {\n return loadEditorsImperatively(editors, brickPackages ?? 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 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\nexport {\n legacyDoTransform,\n legacyTransformProperties,\n legacyTransformIntermediateData,\n} from \"./legacy_transform.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,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;AAWA,IAAAM,MAAA,GAAA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AC,CAAE;IACnC2G,eAAe;IACfoC,KAAK,EAAE,IAAAQ,gCAAe,EAACD,OAAiB;EAC1C,CAAC;EAED,IAAID,SAAS,CAACG,OAAO,EAAE;IACrB,OAAO,IAAAC,wBAAW,EAACJ,SAAS,CAACG,OAAO,EAAG5C,cAAc,EAAE;MAAE8C,KAAK,EAAE;IAAS,CAAC,CAAC;EAC7E;EAEA,OAAO,IAAAC,uCAAqB,EAACN,SAAS,CAACO,KAAK,EAAEhD,cAAc,CAAC;AAC/D;AAEO,SAASiD,oBAAoBA,CAClCC,OAAgC,EACf;EACjB,MAAMlD,cAAc,GAAG,IAAA5G,sCAA6B,EAAC,CAAC;EAEtD,OAAO;IACL+J,GAAG,EAAE,CAAAnD,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAEoD,WAAW,MAAIpD,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAEmD,GAAG;IACvDE,QAAQ,EAAE,IAAArE,YAAI,EAACqE,QAAQ,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IAChE,GAAG,IAAArE,YAAI,EAACgB,cAAc,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACzCmC,KAAK,EAAE,IAAAQ,gCAAe,EAACO,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAER,OAAiB;EACnD,CAAC;AACH","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","_legacy_transform","symbolForRootRuntimeContext","exports","Symbol","for","renderUseBrick","useBrick","data","errorBoundary","_brickNode","scopedRuntimeContext","tplStateStoreScope","formStateStoreScope","createScopedRuntimeContext","_internalApiGetRuntimeContext","pendingPermissionsPreCheck","inUseBrick","tplStateStoreMap","Map","formStateStoreMap","rendererContext","RendererContext","renderRoot","tag","RenderTag","ROOT","createPortal","strict","isStrictMode","output","renderBrick","scopedStores","postAsyncRender","brickNode","currentNode","node","BRICK","child","portal","Error","tagName","type","mountUseBrick","element","portalRoot","document","querySelector","createElement","appendChild","mountTree","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","initializeMessageDispatcher","store","mountAsyncData","unmountUseBrick","mountResult","unmountTree","remove","dispatchOnUnmount","dispose","updateStoryboard","appId","storyboardPatch","storyboard","_internalApiGetStoryboardInBootstrapData","Object","assign","meta","$$fulfilling","$$fulfilled","$$registerCustomTemplateProcessed","registerAppI18n","updateStoryboardByRoute","newRoute","matched","matchRoute","route","path","exact","replaceRoutes","routes","forEach","index","Array","isArray","bricks","replaceBricks","brick","slots","slotConf","values","unshift","updateStoryboardByTemplate","newTemplate","settings","tplName","name","customTemplates","define","proxy","state","updateTemplatePreviewSettings","templateId","_updatePreviewSettings","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","brickPackages","loadEditorsImperatively","getRenderId","_internalApiGetRenderId","getAddedContracts","updateStoryboardType","collectUsedContracts","updatedStoryboard","_storyboard$routes","snippetPreviewPath","currentRoute","addedContracts","contractApis","api","_storyboard$meta","_","namespaceId","match","contracts","some","contract","push","debugDataValue","debugData","routeId","getMatchedRoute","resolve","resolveData","cache","asyncComputeRealValue","value","getLegalRuntimeValue","options","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 BrickPackage,\n RouteConfOfBricks,\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 RenderBrick,\n RenderChildNode,\n} from \"./interfaces.js\";\nimport { mountTree, unmountTree } from \"./mount.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { isStrictMode } 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.inUseBrick = true;\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 strict = isStrictMode();\n\n const output = await renderBrick(\n renderRoot,\n strict && !errorBoundary\n ? useBrick\n : {\n errorBoundary,\n ...useBrick,\n },\n scopedRuntimeContext,\n rendererContext,\n [],\n {}\n );\n\n const scopedStores = [...tplStateStoreScope, ...formStateStoreScope];\n\n await postAsyncRender(output, scopedRuntimeContext, scopedStores);\n\n let brickNode: RenderBrick | undefined;\n let currentNode: RenderChildNode | undefined = output.node;\n while (currentNode) {\n if (currentNode.tag === RenderTag.BRICK) {\n brickNode = currentNode;\n break;\n }\n currentNode = currentNode.child;\n }\n\n if (brickNode?.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 = brickNode ? brickNode.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\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 matched = false;\n\n function matchRoute(route: RouteConf) {\n return route.path === newRoute.path && !route.exact === !newRoute.exact;\n }\n\n function replaceRoutes(routes: RouteConf[]) {\n routes.forEach((route, index) => {\n if (route.type === \"routes\") {\n replaceRoutes(route.routes);\n } else {\n if (matchRoute(route)) {\n matched = true;\n routes[index] = newRoute;\n } else if (Array.isArray((route as RouteConfOfBricks).bricks)) {\n replaceBricks((route as RouteConfOfBricks).bricks);\n }\n }\n });\n }\n\n function replaceBricks(bricks: BrickConf[]) {\n bricks.forEach((brick) => {\n if (brick.slots) {\n for (const slotConf of Object.values(brick.slots)) {\n if (slotConf.type === \"routes\") {\n replaceRoutes(slotConf.routes);\n } else {\n replaceBricks(slotConf.bricks);\n }\n }\n }\n });\n }\n\n replaceRoutes(storyboard.routes);\n\n if (!matched) {\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\n/**\n * Try the brick packages passed in, before using from bootstrap.\n */\nexport function loadEditors(\n editors: string[] | Set<string>,\n brickPackages?: BrickPackage[]\n) {\n return loadEditorsImperatively(editors, brickPackages ?? 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 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\nexport {\n legacyDoTransform,\n legacyTransformProperties,\n legacyTransformIntermediateData,\n} from \"./legacy_transform.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,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;AAaA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAR,OAAA;AACA,IAAAS,gBAAA,GAAAT,OAAA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c,EAAE;MAAE8C,KAAK,EAAE;IAAS,CAAC,CAAC;EAC7E;EAEA,OAAO,IAAAC,uCAAqB,EAACN,SAAS,CAACO,KAAK,EAAEhD,cAAc,CAAC;AAC/D;AAEO,SAASiD,oBAAoBA,CAClCC,OAAgC,EACf;EACjB,MAAMlD,cAAc,GAAG,IAAA5G,sCAA6B,EAAC,CAAC;EAEtD,OAAO;IACL+J,GAAG,EAAE,CAAAnD,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAEoD,WAAW,MAAIpD,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAEmD,GAAG;IACvDE,QAAQ,EAAE,IAAArE,YAAI,EAACqE,QAAQ,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IAChE,GAAG,IAAArE,YAAI,EAACgB,cAAc,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACzCmC,KAAK,EAAE,IAAAQ,gCAAe,EAACO,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAER,OAAiB;EACnD,CAAC;AACH","ignoreList":[]}
|
|
@@ -101,7 +101,7 @@ export async function renderRoutes(returnNode, routes, _runtimeContext, renderer
|
|
|
101
101
|
if (route.type === "routes") {
|
|
102
102
|
newOutput = await renderRoutes(returnNode, route.routes, runtimeContext, rendererContext, routePath, menuRequestNode, slotId, undefined, initialTracker);
|
|
103
103
|
} else {
|
|
104
|
-
newOutput = await renderBricks(returnNode, route.bricks, runtimeContext, rendererContext, routePath, menuRequestNode, slotId, undefined,
|
|
104
|
+
newOutput = await renderBricks(returnNode, route.bricks, runtimeContext, rendererContext, routePath, menuRequestNode, slotId, undefined, initialTracker);
|
|
105
105
|
}
|
|
106
106
|
mergeRenderOutput(output, newOutput);
|
|
107
107
|
appendMenuRequestNode(menuRequestNode, newOutput.menuRequestNode);
|
|
@@ -110,27 +110,21 @@ export async function renderRoutes(returnNode, routes, _runtimeContext, renderer
|
|
|
110
110
|
}
|
|
111
111
|
return output;
|
|
112
112
|
}
|
|
113
|
-
export async function renderBricks(returnNode, bricks, runtimeContext, rendererContext, parentRoutes, menuRequestReturnNode, slotId, tplStack,
|
|
113
|
+
export async function renderBricks(returnNode, bricks, runtimeContext, rendererContext, parentRoutes, menuRequestReturnNode, slotId, tplStack, initialTracker) {
|
|
114
114
|
setupRootRuntimeContext(bricks, runtimeContext, true);
|
|
115
115
|
const output = getEmptyRenderOutput();
|
|
116
|
-
const kPath = keyPath !== null && keyPath !== void 0 ? keyPath : [];
|
|
117
116
|
// 多个构件并行异步转换,但转换的结果按原顺序串行合并。
|
|
118
|
-
const rendered = await Promise.all(bricks.map(
|
|
119
|
-
rendered.forEach(
|
|
120
|
-
if (item.hasTrackingControls) {
|
|
121
|
-
// Memoize a render node before it's been merged.
|
|
122
|
-
rendererContext.memoize(slotId, kPath.concat(index), item.node, returnNode);
|
|
123
|
-
}
|
|
117
|
+
const rendered = await Promise.all(bricks.map(brickConf => renderBrick(returnNode, brickConf, runtimeContext, rendererContext, parentRoutes, menuRequestReturnNode, slotId, tplStack && new Map(tplStack), initialTracker)));
|
|
118
|
+
rendered.forEach(item => {
|
|
124
119
|
mergeRenderOutput(output, item);
|
|
125
120
|
});
|
|
126
121
|
return output;
|
|
127
122
|
}
|
|
128
123
|
export async function renderBrick(returnNode, brickConf, _runtimeContext, rendererContext, parentRoutes, menuRequestReturnNode, slotId) {
|
|
129
|
-
let
|
|
130
|
-
let
|
|
131
|
-
let initialTracker = arguments.length > 9 ? arguments[9] : undefined;
|
|
124
|
+
let tplStack = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : new Map();
|
|
125
|
+
let initialTracker = arguments.length > 8 ? arguments[8] : undefined;
|
|
132
126
|
try {
|
|
133
|
-
return await legacyRenderBrick(returnNode, brickConf, _runtimeContext, rendererContext, parentRoutes, menuRequestReturnNode, slotId,
|
|
127
|
+
return await legacyRenderBrick(returnNode, brickConf, _runtimeContext, rendererContext, parentRoutes, menuRequestReturnNode, slotId, tplStack, initialTracker);
|
|
134
128
|
} catch (error) {
|
|
135
129
|
if (brickConf.errorBoundary) {
|
|
136
130
|
// eslint-disable-next-line no-console
|
|
@@ -144,7 +138,7 @@ export async function renderBrick(returnNode, brickConf, _runtimeContext, render
|
|
|
144
138
|
}
|
|
145
139
|
}
|
|
146
140
|
}
|
|
147
|
-
async function legacyRenderBrick(returnNode, brickConf, _runtimeContext, rendererContext, parentRoutes, menuRequestReturnNode, slotId,
|
|
141
|
+
async function legacyRenderBrick(returnNode, brickConf, _runtimeContext, rendererContext, parentRoutes, menuRequestReturnNode, slotId, tplStack, initialTracker) {
|
|
148
142
|
var _hooks$checkPermissio2, _runtimeContext$app;
|
|
149
143
|
const output = getEmptyRenderOutput();
|
|
150
144
|
if (!brickConf.brick) {
|
|
@@ -182,7 +176,7 @@ async function legacyRenderBrick(returnNode, brickConf, _runtimeContext, rendere
|
|
|
182
176
|
...acc,
|
|
183
177
|
[symbol]: brickConf[symbol]
|
|
184
178
|
}), {})
|
|
185
|
-
}, _runtimeContext, rendererContext, parentRoutes, menuRequestReturnNode, slotId,
|
|
179
|
+
}, _runtimeContext, rendererContext, parentRoutes, menuRequestReturnNode, slotId, tplStack, initialTracker);
|
|
186
180
|
}
|
|
187
181
|
const tplStateStoreId = brickConf[symbolForTplStateStoreId];
|
|
188
182
|
const formStateStoreId = brickConf[symbolForFormStateStoreId];
|
|
@@ -244,26 +238,41 @@ async function legacyRenderBrick(returnNode, brickConf, _runtimeContext, rendere
|
|
|
244
238
|
|
|
245
239
|
// Then, get the bricks in that matched slot.
|
|
246
240
|
const bricks = slots && hasOwnProperty(slots, slot) && ((_slots$slot = slots[slot]) === null || _slots$slot === void 0 ? void 0 : _slots$slot.bricks);
|
|
241
|
+
const output = getEmptyRenderOutput();
|
|
242
|
+
const controlNode = {
|
|
243
|
+
tag: RenderTag.ABSTRACT,
|
|
244
|
+
return: returnNode
|
|
245
|
+
};
|
|
246
|
+
output.node = controlNode;
|
|
247
247
|
if (!Array.isArray(bricks)) {
|
|
248
|
-
return
|
|
248
|
+
return output;
|
|
249
249
|
}
|
|
250
|
+
let childrenOutput;
|
|
250
251
|
switch (brickName) {
|
|
251
252
|
case ":forEach":
|
|
252
253
|
{
|
|
253
254
|
if (!Array.isArray(computedDataSource)) {
|
|
254
|
-
|
|
255
|
+
break;
|
|
255
256
|
}
|
|
256
|
-
|
|
257
|
+
childrenOutput = await renderForEach(controlNode, computedDataSource, bricks, runtimeContext, rendererContext, parentRoutes, menuRequestReturnNode, slotId, tplStack, tracker);
|
|
258
|
+
break;
|
|
257
259
|
}
|
|
258
260
|
case ":if":
|
|
259
261
|
case ":switch":
|
|
260
262
|
{
|
|
261
|
-
|
|
263
|
+
childrenOutput = await renderBricks(controlNode, bricks, runtimeContext, rendererContext, parentRoutes, menuRequestReturnNode, slotId, tplStack, tracker);
|
|
262
264
|
}
|
|
263
265
|
}
|
|
266
|
+
if (childrenOutput) {
|
|
267
|
+
controlNode.child = childrenOutput.node;
|
|
268
|
+
mergeRenderOutput(output, {
|
|
269
|
+
...childrenOutput,
|
|
270
|
+
node: undefined
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
return output;
|
|
264
274
|
};
|
|
265
275
|
const renderControlNode = async _ref => {
|
|
266
|
-
var _ref2, _ref2$node;
|
|
267
276
|
let {
|
|
268
277
|
type,
|
|
269
278
|
runtimeContext,
|
|
@@ -304,14 +313,9 @@ async function legacyRenderBrick(returnNode, brickConf, _runtimeContext, rendere
|
|
|
304
313
|
throw new Error(`Maximum rerender stack overflowed (iid: ${brickConf.iid})`);
|
|
305
314
|
}
|
|
306
315
|
}
|
|
307
|
-
(_ref2$node = (_ref2 = rawOutput).node) !== null && _ref2$node !== void 0 ? _ref2$node : _ref2.node = {
|
|
308
|
-
tag: RenderTag.PLACEHOLDER,
|
|
309
|
-
return: returnNode,
|
|
310
|
-
tracking
|
|
311
|
-
};
|
|
312
316
|
return rawOutput;
|
|
313
317
|
};
|
|
314
|
-
|
|
318
|
+
let controlledOutput = await renderControlNode({
|
|
315
319
|
type: "initial",
|
|
316
320
|
runtimeContext
|
|
317
321
|
});
|
|
@@ -321,7 +325,6 @@ async function legacyRenderBrick(returnNode, brickConf, _runtimeContext, rendere
|
|
|
321
325
|
} = (_brickConf$lifeCycle = brickConf.lifeCycle) !== null && _brickConf$lifeCycle !== void 0 ? _brickConf$lifeCycle : {};
|
|
322
326
|
if (tracking) {
|
|
323
327
|
var _runtimeBrick$dispose;
|
|
324
|
-
controlledOutput.hasTrackingControls = true;
|
|
325
328
|
let renderId = 0;
|
|
326
329
|
const listener = async () => {
|
|
327
330
|
const currentRenderId = ++renderId;
|
|
@@ -342,7 +345,8 @@ async function legacyRenderBrick(returnNode, brickConf, _runtimeContext, rendere
|
|
|
342
345
|
}
|
|
343
346
|
}));
|
|
344
347
|
}
|
|
345
|
-
rendererContext.reRender(
|
|
348
|
+
rendererContext.reRender(returnNode, reControlledOutput.node, controlledOutput.node);
|
|
349
|
+
controlledOutput = reControlledOutput;
|
|
346
350
|
if (onMount) {
|
|
347
351
|
listenerFactory(onMount, scopedRuntimeContext)(new CustomEvent("mount", {
|
|
348
352
|
detail: {
|
|
@@ -527,11 +531,17 @@ async function legacyRenderBrick(returnNode, brickConf, _runtimeContext, rendere
|
|
|
527
531
|
return;
|
|
528
532
|
}
|
|
529
533
|
const routeSlotFromIndexToSlotId = new Map();
|
|
530
|
-
const rendered = await Promise.all(Object.entries(slots).map((
|
|
531
|
-
let [childSlotId, slotConf] =
|
|
534
|
+
const rendered = await Promise.all(Object.entries(slots).map(async (_ref2, index) => {
|
|
535
|
+
let [childSlotId, slotConf] = _ref2;
|
|
532
536
|
if (slotConf.type !== "routes") {
|
|
533
|
-
return renderBricks(brick, slotConf.bricks, childRuntimeContext, rendererContext, parentRoutes, menuRequestReturnNode, childSlotId, tplStack,
|
|
537
|
+
return renderBricks(brick, slotConf.bricks, childRuntimeContext, rendererContext, parentRoutes, menuRequestReturnNode, childSlotId, tplStack, initialTracker);
|
|
534
538
|
}
|
|
539
|
+
let lastOutput = getEmptyRenderOutput();
|
|
540
|
+
const controlNode = {
|
|
541
|
+
tag: RenderTag.ABSTRACT,
|
|
542
|
+
return: brick
|
|
543
|
+
};
|
|
544
|
+
lastOutput.node = controlNode;
|
|
535
545
|
const parentRoute = parentRoutes[parentRoutes.length - 1];
|
|
536
546
|
if (parentRoute !== null && parentRoute !== void 0 && parentRoute.incrementalSubRoutes) {
|
|
537
547
|
routeSlotFromIndexToSlotId.set(index, childSlotId);
|
|
@@ -558,8 +568,14 @@ async function legacyRenderBrick(returnNode, brickConf, _runtimeContext, rendere
|
|
|
558
568
|
let failed = false;
|
|
559
569
|
let incrementalOutput;
|
|
560
570
|
let scopedStores = [];
|
|
571
|
+
const newOutput = getEmptyRenderOutput();
|
|
572
|
+
const newControlNode = {
|
|
573
|
+
tag: RenderTag.ABSTRACT,
|
|
574
|
+
return: brick
|
|
575
|
+
};
|
|
576
|
+
newOutput.node = newControlNode;
|
|
561
577
|
try {
|
|
562
|
-
incrementalOutput = await renderRoutes(
|
|
578
|
+
incrementalOutput = await renderRoutes(newControlNode, slotConf.routes, scopedRuntimeContext, rendererContext, parentRoutes, menuRequestReturnNode, childSlotId, true);
|
|
563
579
|
|
|
564
580
|
// Do not ignore incremental rendering even if all sub-routes are missed.
|
|
565
581
|
// Since parent route is matched.
|
|
@@ -571,11 +587,10 @@ async function legacyRenderBrick(returnNode, brickConf, _runtimeContext, rendere
|
|
|
571
587
|
scopedStores = [...tplStateStoreScope, ...formStateStoreScope];
|
|
572
588
|
await postAsyncRender(incrementalOutput, scopedRuntimeContext, [scopedRuntimeContext.ctxStore, ...scopedStores]);
|
|
573
589
|
}
|
|
574
|
-
await rendererContext.reMergeMenuRequestNodes(menuRequestReturnNode, slotConf.routes, incrementalOutput.menuRequestNode);
|
|
575
590
|
} catch (error) {
|
|
576
591
|
// eslint-disable-next-line no-console
|
|
577
592
|
console.error("Incremental sub-router failed:", error);
|
|
578
|
-
const result = await rendererContext.reCatch(error,
|
|
593
|
+
const result = await rendererContext.reCatch(error, newControlNode);
|
|
579
594
|
if (!result) {
|
|
580
595
|
return true;
|
|
581
596
|
}
|
|
@@ -583,11 +598,16 @@ async function legacyRenderBrick(returnNode, brickConf, _runtimeContext, rendere
|
|
|
583
598
|
failed,
|
|
584
599
|
output: incrementalOutput
|
|
585
600
|
} = result);
|
|
586
|
-
|
|
587
|
-
// Assert: no errors will be throw
|
|
588
|
-
await rendererContext.reMergeMenuRequestNodes(menuRequestReturnNode, slotConf.routes, incrementalOutput.menuRequestNode);
|
|
589
601
|
}
|
|
590
|
-
|
|
602
|
+
newControlNode.child = incrementalOutput.node;
|
|
603
|
+
mergeRenderOutput(newOutput, {
|
|
604
|
+
...incrementalOutput,
|
|
605
|
+
node: undefined
|
|
606
|
+
});
|
|
607
|
+
// Assert: no errors will be throw
|
|
608
|
+
await rendererContext.reMergeMenuRequestNodes(menuRequestReturnNode, slotConf.routes, incrementalOutput.menuRequestNode);
|
|
609
|
+
rendererContext.reRender(brick, newControlNode, lastOutput.node);
|
|
610
|
+
lastOutput = newOutput;
|
|
591
611
|
if (!failed) {
|
|
592
612
|
scopedRuntimeContext.ctxStore.mountAsyncData(incrementalOutput.route);
|
|
593
613
|
for (const store of scopedStores) {
|
|
@@ -599,7 +619,14 @@ async function legacyRenderBrick(returnNode, brickConf, _runtimeContext, rendere
|
|
|
599
619
|
return true;
|
|
600
620
|
});
|
|
601
621
|
}
|
|
602
|
-
|
|
622
|
+
const routesOutput = await renderRoutes(controlNode, slotConf.routes, childRuntimeContext, rendererContext, parentRoutes, menuRequestReturnNode, childSlotId, undefined, initialTracker);
|
|
623
|
+
controlNode.child = routesOutput.node;
|
|
624
|
+
mergeRenderOutput(output, {
|
|
625
|
+
...routesOutput,
|
|
626
|
+
node: undefined
|
|
627
|
+
});
|
|
628
|
+
appendMenuRequestNode(menuRequestReturnNode, output.menuRequestNode = routesOutput.menuRequestNode);
|
|
629
|
+
return lastOutput;
|
|
603
630
|
}));
|
|
604
631
|
const childrenOutput = {
|
|
605
632
|
...output,
|
|
@@ -607,11 +634,7 @@ async function legacyRenderBrick(returnNode, brickConf, _runtimeContext, rendere
|
|
|
607
634
|
blockingList: [],
|
|
608
635
|
menuRequestNode: undefined
|
|
609
636
|
};
|
|
610
|
-
rendered.forEach(
|
|
611
|
-
if (routeSlotFromIndexToSlotId.has(index)) {
|
|
612
|
-
// Memoize a render node before it's been merged.
|
|
613
|
-
rendererContext.memoize(routeSlotFromIndexToSlotId.get(index), [], item.node, brick);
|
|
614
|
-
}
|
|
637
|
+
rendered.forEach(item => {
|
|
615
638
|
mergeRenderOutput(childrenOutput, item);
|
|
616
639
|
mergeSiblingRenderMenuRequest(childrenOutput, item);
|
|
617
640
|
});
|
|
@@ -638,22 +661,18 @@ function ensureValidControlBrick(brick) {
|
|
|
638
661
|
throw new Error(`Unknown storyboard control node: "${brick}"`);
|
|
639
662
|
}
|
|
640
663
|
}
|
|
641
|
-
async function renderForEach(returnNode, dataSource, bricks, runtimeContext, rendererContext, parentRoutes, menuRequestReturnNode, slotId, tplStack,
|
|
664
|
+
async function renderForEach(returnNode, dataSource, bricks, runtimeContext, rendererContext, parentRoutes, menuRequestReturnNode, slotId, tplStack, initialTracker) {
|
|
642
665
|
const output = getEmptyRenderOutput();
|
|
643
666
|
const size = dataSource.length;
|
|
644
|
-
const rendered = await Promise.all(dataSource.map((item, i) => Promise.all(bricks.map(
|
|
667
|
+
const rendered = await Promise.all(dataSource.map((item, i) => Promise.all(bricks.map(brickConf => renderBrick(returnNode, brickConf, {
|
|
645
668
|
...runtimeContext,
|
|
646
669
|
forEachItem: item,
|
|
647
670
|
forEachIndex: i,
|
|
648
671
|
forEachSize: size
|
|
649
|
-
}, rendererContext, parentRoutes, menuRequestReturnNode, slotId,
|
|
672
|
+
}, rendererContext, parentRoutes, menuRequestReturnNode, slotId, tplStack && new Map(tplStack), initialTracker)))));
|
|
650
673
|
|
|
651
674
|
// 多层构件并行异步转换,但转换的结果按原顺序串行合并。
|
|
652
|
-
rendered.flat().forEach(
|
|
653
|
-
if (item.hasTrackingControls) {
|
|
654
|
-
// Memoize a render node before it's been merged.
|
|
655
|
-
rendererContext.memoize(slotId, keyPath.concat(index), item.node, returnNode);
|
|
656
|
-
}
|
|
675
|
+
rendered.flat().forEach(item => {
|
|
657
676
|
mergeRenderOutput(output, item);
|
|
658
677
|
});
|
|
659
678
|
return output;
|
|
@@ -700,7 +719,6 @@ function mergeRenderOutput(output, newOutput) {
|
|
|
700
719
|
blockingList,
|
|
701
720
|
node,
|
|
702
721
|
menuRequestNode,
|
|
703
|
-
hasTrackingControls,
|
|
704
722
|
...rest
|
|
705
723
|
} = newOutput;
|
|
706
724
|
output.blockingList.push(...blockingList);
|