@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
|
@@ -49,10 +49,18 @@ export function mountTree(root, initializedElement) {
|
|
|
49
49
|
if (current.portal) {
|
|
50
50
|
portalElements.push(element);
|
|
51
51
|
} else if (current.return) {
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
let currentReturn = current.return;
|
|
53
|
+
while (currentReturn) {
|
|
54
|
+
if (currentReturn.tag === RenderTag.ABSTRACT) {
|
|
55
|
+
currentReturn = currentReturn.return;
|
|
56
|
+
} else {
|
|
57
|
+
if (!currentReturn.childElements) {
|
|
58
|
+
currentReturn.childElements = [];
|
|
59
|
+
}
|
|
60
|
+
currentReturn.childElements.push(element);
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
54
63
|
}
|
|
55
|
-
current.return.childElements.push(element);
|
|
56
64
|
}
|
|
57
65
|
}
|
|
58
66
|
if (current.child) {
|
|
@@ -64,12 +72,11 @@ export function mountTree(root, initializedElement) {
|
|
|
64
72
|
let currentReturn = current.return;
|
|
65
73
|
while (currentReturn) {
|
|
66
74
|
// Append elements inside out
|
|
67
|
-
if (currentReturn.childElements) {
|
|
75
|
+
if (currentReturn.tag !== RenderTag.ABSTRACT && currentReturn.childElements) {
|
|
68
76
|
if (currentReturn.tag === RenderTag.ROOT) {
|
|
69
77
|
var _currentReturn$contai;
|
|
70
78
|
(_currentReturn$contai = currentReturn.container) === null || _currentReturn$contai === void 0 || _currentReturn$contai.append(...currentReturn.childElements);
|
|
71
79
|
} else {
|
|
72
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
73
80
|
currentReturn.element.append(...currentReturn.childElements);
|
|
74
81
|
}
|
|
75
82
|
currentReturn.childElements = undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.js","names":["bindTemplateProxy","getTplStateStore","bindListeners","setRealProperties","RenderTag","unmountTree","mountPoint","replaceChildren","mountTree","root","initializedElement","window","DISABLE_REACT_FLUSH_SYNC","current","child","portalElements","tag","BRICK","_current$tplHostMetad","tagName","type","includes","customElements","get","console","error","warn","element","document","createElement","slotId","setAttribute","iid","dataset","tplHostMetadata","tplStateStoreId","properties","events","runtimeContext","$$tplStateStore","tplStateStoreMap","portal","push","return","childElements","sibling","_currentReturn","
|
|
1
|
+
{"version":3,"file":"mount.js","names":["bindTemplateProxy","getTplStateStore","bindListeners","setRealProperties","RenderTag","unmountTree","mountPoint","replaceChildren","mountTree","root","initializedElement","window","DISABLE_REACT_FLUSH_SYNC","current","child","portalElements","tag","BRICK","_current$tplHostMetad","tagName","type","includes","customElements","get","console","error","warn","element","document","createElement","slotId","setAttribute","iid","dataset","tplHostMetadata","tplStateStoreId","properties","events","runtimeContext","$$tplStateStore","tplStateStoreMap","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,SAASA,iBAAiB,QAAQ,wCAAwC;AAC1E,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,SAAS,QAAQ,YAAY;AAOtC,OAAO,SAASC,WAAWA,CAACC,UAA0C,EAAE;EACtEA,UAAU,CAACC,eAAe,CAAC,CAAC;AAC9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xCD,aAAa,CAACE,aAAa,EAC3B;UACA,IAAIF,aAAa,CAAC5B,GAAG,KAAKZ,SAAS,CAAC6C,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,CAACjB,OAAO,CAAEyB,MAAM,CAAC,GAAGR,aAAa,CAACE,aAAa,CAAC;UAC/D;UACAF,aAAa,CAACE,aAAa,GAAGO,SAAS;QACzC;QAEA,IAAIT,aAAa,CAAC5B,GAAG,KAAKZ,SAAS,CAAC6C,IAAI,IAAIlC,cAAc,CAACuC,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,GAAGrC,cAAc,CAAC;QAClC;QAEA,IAAI6B,aAAa,CAACG,OAAO,EAAE;UACzB;QACF;QACAH,aAAa,GAAGA,aAAa,CAACD,MAAM;MACtC;MACA9B,OAAO,IAAAmC,cAAA,GAAGJ,aAAa,cAAAI,cAAA,uBAAbA,cAAA,CAAeD,OAAO;IAClC;EACF;EACAS,UAAU,CAAC,MAAM;IACf7C,MAAM,CAACC,wBAAwB,GAAG,IAAI;EACxC,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -14,7 +14,7 @@ import { loadBricksImperatively, loadEditorsImperatively } from "@next-core/load
|
|
|
14
14
|
import { getMatchedRoute } from "./routeMatchedMap.js";
|
|
15
15
|
export const symbolForRootRuntimeContext = Symbol.for("root.runtimeContext");
|
|
16
16
|
export async function renderUseBrick(useBrick, data, errorBoundary) {
|
|
17
|
-
var _useBrick$symbolForRo, _scopedRuntimeContext, _scopedRuntimeContext2,
|
|
17
|
+
var _useBrick$symbolForRo, _scopedRuntimeContext, _scopedRuntimeContext2, _brickNode;
|
|
18
18
|
const [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope] = createScopedRuntimeContext({
|
|
19
19
|
...((_useBrick$symbolForRo = useBrick[symbolForRootRuntimeContext]) !== null && _useBrick$symbolForRo !== void 0 ? _useBrick$symbolForRo : _internalApiGetRuntimeContext()),
|
|
20
20
|
data,
|
|
@@ -36,17 +36,20 @@ export async function renderUseBrick(useBrick, data, errorBoundary) {
|
|
|
36
36
|
}, scopedRuntimeContext, rendererContext, [], {});
|
|
37
37
|
const scopedStores = [...tplStateStoreScope, ...formStateStoreScope];
|
|
38
38
|
await postAsyncRender(output, scopedRuntimeContext, scopedStores);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
let brickNode;
|
|
40
|
+
let currentNode = output.node;
|
|
41
|
+
while (currentNode) {
|
|
42
|
+
if (currentNode.tag === RenderTag.BRICK) {
|
|
43
|
+
brickNode = currentNode;
|
|
44
|
+
break;
|
|
42
45
|
}
|
|
43
|
-
|
|
46
|
+
currentNode = currentNode.child;
|
|
44
47
|
}
|
|
45
|
-
if ((
|
|
48
|
+
if ((_brickNode = brickNode) !== null && _brickNode !== void 0 && _brickNode.portal) {
|
|
46
49
|
throw new Error("The root brick of useBrick cannot be a portal brick");
|
|
47
50
|
}
|
|
48
51
|
renderRoot.child = output.node;
|
|
49
|
-
const tagName =
|
|
52
|
+
const tagName = brickNode ? brickNode.type : null;
|
|
50
53
|
return {
|
|
51
54
|
tagName,
|
|
52
55
|
renderRoot,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secret_internals.js","names":["pick","_internalApiGetRenderId","_internalApiGetRuntimeContext","_internalApiGetStoryboardInBootstrapData","getBrickPackages","createScopedRuntimeContext","postAsyncRender","renderBrick","RendererContext","resolveData","asyncComputeRealValue","mountTree","unmountTree","RenderTag","isStrictMode","customTemplates","registerAppI18n","getTplStateStore","loadBricksImperatively","loadEditorsImperatively","getMatchedRoute","symbolForRootRuntimeContext","Symbol","for","renderUseBrick","useBrick","data","errorBoundary","_useBrick$symbolForRo","_scopedRuntimeContext","_scopedRuntimeContext2","_output$node","_output$node2","scopedRuntimeContext","tplStateStoreScope","formStateStoreScope","pendingPermissionsPreCheck","inUseBrick","tplStateStoreMap","Map","formStateStoreMap","rendererContext","renderRoot","tag","ROOT","createPortal","strict","output","scopedStores","node","PLACEHOLDER","tracking","Error","undefined","portal","child","tagName","type","mountUseBrick","_ref","element","portalRoot","document","querySelector","createElement","appendChild","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","initializeMessageDispatcher","store","mountAsyncData","unmountUseBrick","_ref2","mountResult","remove","dispatchOnUnmount","dispose","updateStoryboard","appId","storyboardPatch","storyboard","Object","assign","meta","$$fulfilling","$$fulfilled","$$registerCustomTemplateProcessed","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","define","proxy","state","updateTemplatePreviewSettings","templateId","_updatePreviewSettings","getSnippetPreviewPath","snippetId","updateStoryboardBySnippet","snippetData","_snippetData$bricks","length","context","updateSnippetPreviewSettings","previewRouteIndex","findIndex","newPreviewRoute","menu","splice","getContextValue","_ref3","tplStateStoreId","runtimeContext","tplStateStore","getValue","ctxStore","getAllContextValues","_ref4","getAllValues","getBrickPackagesById","id","find","pkg","filePath","startsWith","loadBricks","loadEditors","editors","brickPackages","getRenderId","getAddedContracts","_ref5","updateStoryboardType","collectUsedContracts","updatedStoryboard","_storyboard$routes","snippetPreviewPath","currentRoute","addedContracts","contractApis","api","_storyboard$meta","_","namespaceId","match","contracts","some","contract","push","debugDataValue","debugData","_ref6","routeId","resolve","cache","value","getLegalRuntimeValue","options","_runtimeContext$overr","app","overrideApp","location","setRealTimeDataInspectRoot","addRealTimeDataInspectHook","legacyDoTransform","legacyTransformProperties","legacyTransformIntermediateData"],"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,SAASA,IAAI,QAAQ,QAAQ;AAC7B,SACEC,uBAAuB,EACvBC,6BAA6B,EAC7BC,wCAAwC,EACxCC,gBAAgB,QACX,cAAc;AACrB,SACEC,0BAA0B,EAC1BC,eAAe,EACfC,WAAW,QACN,eAAe;AACtB,SAASC,eAAe,QAAQ,sBAAsB;AAEtD,SAASC,WAAW,QAAQ,uBAAuB;AACnD,SAASC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APA,OAAO,CAAEL,OAAiB;EACnD,CAAC;AACH;AAEA,SACEU,0BAA0B,EAC1BC,0BAA0B,QACrB,+BAA+B;AAEtC,SACEC,iBAAiB,EACjBC,yBAAyB,EACzBC,+BAA+B,QAC1B,uBAAuB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"secret_internals.js","names":["pick","_internalApiGetRenderId","_internalApiGetRuntimeContext","_internalApiGetStoryboardInBootstrapData","getBrickPackages","createScopedRuntimeContext","postAsyncRender","renderBrick","RendererContext","resolveData","asyncComputeRealValue","mountTree","unmountTree","RenderTag","isStrictMode","customTemplates","registerAppI18n","getTplStateStore","loadBricksImperatively","loadEditorsImperatively","getMatchedRoute","symbolForRootRuntimeContext","Symbol","for","renderUseBrick","useBrick","data","errorBoundary","_useBrick$symbolForRo","_scopedRuntimeContext","_scopedRuntimeContext2","_brickNode","scopedRuntimeContext","tplStateStoreScope","formStateStoreScope","pendingPermissionsPreCheck","inUseBrick","tplStateStoreMap","Map","formStateStoreMap","rendererContext","renderRoot","tag","ROOT","createPortal","strict","output","scopedStores","brickNode","currentNode","node","BRICK","child","portal","Error","tagName","type","mountUseBrick","_ref","element","portalRoot","document","querySelector","createElement","appendChild","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","initializeMessageDispatcher","store","mountAsyncData","unmountUseBrick","_ref2","mountResult","remove","dispatchOnUnmount","dispose","updateStoryboard","appId","storyboardPatch","storyboard","Object","assign","meta","$$fulfilling","$$fulfilled","$$registerCustomTemplateProcessed","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","define","proxy","state","updateTemplatePreviewSettings","templateId","_updatePreviewSettings","getSnippetPreviewPath","snippetId","updateStoryboardBySnippet","snippetData","_snippetData$bricks","length","context","updateSnippetPreviewSettings","previewRouteIndex","findIndex","newPreviewRoute","menu","splice","getContextValue","_ref3","tplStateStoreId","runtimeContext","tplStateStore","getValue","ctxStore","getAllContextValues","_ref4","getAllValues","getBrickPackagesById","id","find","pkg","filePath","startsWith","loadBricks","loadEditors","editors","brickPackages","getRenderId","getAddedContracts","_ref5","updateStoryboardType","collectUsedContracts","updatedStoryboard","_storyboard$routes","snippetPreviewPath","currentRoute","addedContracts","contractApis","api","_storyboard$meta","_","namespaceId","match","contracts","some","contract","push","debugDataValue","debugData","_ref6","routeId","resolve","cache","value","getLegalRuntimeValue","options","_runtimeContext$overr","app","overrideApp","location","setRealTimeDataInspectRoot","addRealTimeDataInspectHook","legacyDoTransform","legacyTransformProperties","legacyTransformIntermediateData"],"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,SAASA,IAAI,QAAQ,QAAQ;AAC7B,SACEC,uBAAuB,EACvBC,6BAA6B,EAC7BC,wCAAwC,EACxCC,gBAAgB,QACX,cAAc;AACrB,SACEC,0BAA0B,EAC1BC,eAAe,EACfC,WAAW,QACN,eAAe;AACtB,SAASC,eAAe,QAAQ,sBAAsB;AAEtD,SAASC,WAAW,QAAQ,uBAAuB;AACnD,SAASC,qBAAqB,QAAQ,+BAA+B;AAarE,SAASC,SAAS,EAAEC,WAAW,QAAQ,YAAY;AACnD,SAASC,SAAS,QAAQ,YAAY;AACtC,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SACEC,sBAAsB,EACtBC,uBAAuB,QAClB,mBAAmB;AAC1B,SAASC,eAAe,QAAQ,sBAAsB;AAItD,OAAO,MAAMC,2BAA2B,GAAGC,MAAM,CAACC,GAAG,CAAC,qBAAqB,CAAC;AAa5E,OAAO,eAAeC,cAAcA,CAClCC,QAA4C,EAC5CC,IAAa,EACbC,aAAuB,EACQ;EAAA,IAAAC,qBAAA,EAAAC,qBAAA,EAAAC,sBAAA,EAAAC,UAAA;EAC/B,MAAM,CAACC,oBAAoB,EAAEC,kBAAkB,EAAEC,mBAAmB,CAAC,GACnE7B,0BAA0B,CAAC;IACzB,KAAAuB,qBAAA,GAAIH,QAAQ,CAACJ,2BAA2B,CAAC,cAAAO,qBAAA,cAAAA,qBAAA,GACvC1B,6BAA6B,CAAC,CAAC,CAAE;IACnCwB,IAAI;IACJS,0BAA0B,EAAE;EAC9B,CAAC,CAAC;EAEJH,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EgD,WAAW,cAAAF,qBAAA,cAAAA,qBAAA,GAAI9C,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAE+C,GAAG;IACvDE,QAAQ,EAAEvL,IAAI,CAACuL,QAAQ,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IAChE,GAAGvL,IAAI,CAACsI,cAAc,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACzCgC,KAAK,EAAElJ,eAAe,CAAC+J,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEL,OAAiB;EACnD,CAAC;AACH;AAEA,SACEU,0BAA0B,EAC1BC,0BAA0B,QACrB,+BAA+B;AAEtC,SACEC,iBAAiB,EACjBC,yBAAyB,EACzBC,+BAA+B,QAC1B,uBAAuB","ignoreList":[]}
|
|
@@ -15,11 +15,10 @@ export interface RenderOutput {
|
|
|
15
15
|
path?: string;
|
|
16
16
|
blockingList: (Promise<unknown> | undefined)[];
|
|
17
17
|
menuRequestNode?: MenuRequestNode;
|
|
18
|
-
hasTrackingControls?: boolean;
|
|
19
18
|
}
|
|
20
19
|
export declare function renderRoutes(returnNode: RenderReturnNode, routes: RouteConf[], _runtimeContext: RuntimeContext, rendererContext: RendererContext, parentRoutes: RouteConf[], menuRequestReturnNode: MenuRequestNode, slotId?: string, isIncremental?: boolean, initialTracker?: InitialTracker): Promise<RenderOutput>;
|
|
21
|
-
export declare function renderBricks(returnNode: RenderReturnNode, bricks: BrickConf[], runtimeContext: RuntimeContext, rendererContext: RendererContext, parentRoutes: RouteConf[], menuRequestReturnNode: MenuRequestNode, slotId?: string, tplStack?: Map<string, number>,
|
|
22
|
-
export declare function renderBrick(returnNode: RenderReturnNode, brickConf: RuntimeBrickConfWithSymbols, _runtimeContext: RuntimeContext, rendererContext: RendererContext, parentRoutes: RouteConf[], menuRequestReturnNode: MenuRequestNode, slotId?: string,
|
|
20
|
+
export declare function renderBricks(returnNode: RenderReturnNode, bricks: BrickConf[], runtimeContext: RuntimeContext, rendererContext: RendererContext, parentRoutes: RouteConf[], menuRequestReturnNode: MenuRequestNode, slotId?: string, tplStack?: Map<string, number>, initialTracker?: InitialTracker): Promise<RenderOutput>;
|
|
21
|
+
export declare function renderBrick(returnNode: RenderReturnNode, brickConf: RuntimeBrickConfWithSymbols, _runtimeContext: RuntimeContext, rendererContext: RendererContext, parentRoutes: RouteConf[], menuRequestReturnNode: MenuRequestNode, slotId?: string, tplStack?: Map<string, number>, initialTracker?: InitialTracker): Promise<RenderOutput>;
|
|
23
22
|
export declare function getDataStores(runtimeContext: RuntimeContext): (DataStore<"STATE"> | DataStore<"CTX"> | DataStore<"FORM_STATE">)[];
|
|
24
23
|
export declare function postAsyncRender(output: RenderOutput, runtimeContext: RuntimeContext, stores: DataStore<DataStoreType>[]): Promise<unknown[]>;
|
|
25
24
|
export declare function createScopedRuntimeContext(runtimeContext: RuntimeContext): [
|
|
@@ -56,8 +56,7 @@ export declare class RendererContext {
|
|
|
56
56
|
performIncrementalRender(slotConf: SlotConfOfRoutes, parentRoutes: RouteConf[], callback: LocationChangeCallback): void;
|
|
57
57
|
registerBrickLifeCycle(brick: RenderBrick, lifeCycle: BrickLifeCycle | undefined): void;
|
|
58
58
|
registerArbitraryLifeCycle(lifeCycle: string, fn: () => void): void;
|
|
59
|
-
|
|
60
|
-
reRender(slotId: string | undefined, keyPath: number[], node: RenderChildNode | undefined, returnNode: RenderReturnNode): void;
|
|
59
|
+
reRender(returnNode: RenderReturnNode, node: RenderChildNode, oldNode: RenderChildNode): void;
|
|
61
60
|
dispose(): void;
|
|
62
61
|
dispatchBeforePageLoad(): void;
|
|
63
62
|
dispatchPageLoad(): void;
|
|
@@ -36,12 +36,10 @@ export interface RenderRoot extends BaseRenderNode {
|
|
|
36
36
|
export interface RenderBrick extends BaseRenderNode, RuntimeBrick {
|
|
37
37
|
tag: RenderTag.BRICK;
|
|
38
38
|
return: RenderReturnNode;
|
|
39
|
-
hasTrackingControls?: boolean;
|
|
40
39
|
}
|
|
41
|
-
export interface
|
|
42
|
-
tag: RenderTag.
|
|
40
|
+
export interface RenderAbstract extends BaseRenderNode {
|
|
41
|
+
tag: RenderTag.ABSTRACT;
|
|
43
42
|
return: RenderReturnNode;
|
|
44
|
-
tracking?: boolean;
|
|
45
43
|
}
|
|
46
44
|
export interface BaseRenderNode {
|
|
47
45
|
tag: RenderTag;
|
|
@@ -50,9 +48,9 @@ export interface BaseRenderNode {
|
|
|
50
48
|
return?: RenderReturnNode | null;
|
|
51
49
|
childElements?: HTMLElement[];
|
|
52
50
|
}
|
|
53
|
-
export type RenderNode = RenderRoot | RenderBrick |
|
|
54
|
-
export type RenderChildNode = RenderBrick |
|
|
55
|
-
export type RenderReturnNode =
|
|
51
|
+
export type RenderNode = RenderRoot | RenderBrick | RenderAbstract;
|
|
52
|
+
export type RenderChildNode = RenderBrick | RenderAbstract;
|
|
53
|
+
export type RenderReturnNode = RenderNode;
|
|
56
54
|
export interface RuntimeBrick {
|
|
57
55
|
type: string;
|
|
58
56
|
properties?: Record<string, unknown>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-core/runtime",
|
|
3
|
-
"version": "1.62.
|
|
3
|
+
"version": "1.62.2",
|
|
4
4
|
"homepage": "https://github.com/easyops-cn/next-core/tree/v3/packages/runtime",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"repository": {
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"@next-core/build-next-libs": "^1.0.25",
|
|
68
68
|
"@next-core/test-next": "^2.0.0"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "b78dbdde43120921958a42f13bbbdea2578a8786"
|
|
71
71
|
}
|