@next-core/runtime 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/internal/Runtime.js +2 -2
- package/dist/cjs/internal/Runtime.js.map +1 -1
- package/dist/cjs/internal/secret_internals.js +2 -1
- package/dist/cjs/internal/secret_internals.js.map +1 -1
- package/dist/esm/internal/Runtime.js +1 -1
- package/dist/esm/internal/Runtime.js.map +1 -1
- package/dist/esm/internal/secret_internals.js +3 -2
- package/dist/esm/internal/secret_internals.js.map +1 -1
- package/dist/types/internal/Runtime.d.ts +1 -1
- package/dist/types/internal/secret_internals.d.ts +2 -2
- package/package.json +2 -2
|
@@ -11,7 +11,7 @@ exports._internalApiGetRuntimeContext = _internalApiGetRuntimeContext;
|
|
|
11
11
|
exports._internalApiGetStoryboardInBootstrapData = _internalApiGetStoryboardInBootstrapData;
|
|
12
12
|
exports._internalApiLoadBricks = _internalApiLoadBricks;
|
|
13
13
|
exports._internalApiMatchStoryboard = _internalApiMatchStoryboard;
|
|
14
|
-
exports.
|
|
14
|
+
exports._internalApiSetBootstrapData = _internalApiSetBootstrapData;
|
|
15
15
|
exports.createRuntime = createRuntime;
|
|
16
16
|
exports.getBrickPackages = getBrickPackages;
|
|
17
17
|
exports.getRuntime = getRuntime;
|
|
@@ -122,7 +122,7 @@ class Runtime {
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
exports.Runtime = Runtime;
|
|
125
|
-
function
|
|
125
|
+
function _internalApiSetBootstrapData(data) {
|
|
126
126
|
bootstrapData = data;
|
|
127
127
|
}
|
|
128
128
|
function getBrickPackages() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Runtime.js","names":["_i18n","require","_loader","_moment","_interopRequireDefault","_history","_matchStoryboard","_Router","_loadCheckLogin","_loadBootstrapData","_i18n2","_Notification","_Dialog","_bootstrapData11","runtime","bootstrapData","injectedBootstrapData","router","createRuntime","Error","initializeI18n","NS","locales","moment","locale","i18n","language","on","createHistory","Runtime","getRuntime","bootstrap","_bootstrapData","Promise","all","loadCheckLogin","loadBootstrapData","loadNotificationService","loadDialogService","Router","storyboards","getRecentApps","_router$getRecentApps","_router","getCurrentApp","_router2","currentApp","getFeatureFlags","_bootstrapData2","_bootstrapData2$setti","_router3","_router3$getRecentApp","_router3$getRecentApp2","_router3$getRecentApp3","settings","featureFlags","config","getMiscSettings","_bootstrapData3","_bootstrapData3$setti","_router4","_router4$getRecentApp","_router4$getRecentApp2","_router4$getRecentApp3","misc","getBrandSettings","_bootstrapData4","_bootstrapData4$setti","base_title","brand","getLaunchpadSettings","_bootstrapData5","_bootstrapData5$setti","columns","rows","launchpad","getDesktops","_bootstrapData$deskto","_bootstrapData6","desktops","getLaunchpadSiteMap","_bootstrapData$siteSo","_bootstrapData7","siteSort","toggleLaunchpadEffect","open","document","body","classList","toggle","applyPageTitle","pageTitle","baseTitle","title","getNavConfig","_router5","exports","_test_only_setBootstrapData","data","getBrickPackages","_bootstrapData$brickP","_bootstrapData8","brickPackages","_internalApiLoadBricks","bricks","loadBricksImperatively","_internalApiGetRenderId","_router6","getRenderId","_internalApiMatchStoryboard","pathname","_bootstrapData$storyb","_bootstrapData9","matchStoryboard","_internalApiGetRuntimeContext","_router7","getRuntimeContext","_internalApiGetStoryboardInBootstrapData","appId","_bootstrapData10","_bootstrapData10$stor","find","storyboard","app","id","_internalApiGetAppInBootstrapData","_internalApiGetStoryb"],"sources":["../../../src/internal/Runtime.ts"],"sourcesContent":["import type {\n RuntimeStoryboard,\n BootstrapSettings,\n FeatureFlags,\n BootstrapData,\n} from \"@next-core/types\";\nimport { i18n, initializeI18n } from \"@next-core/i18n\";\nimport { loadBricksImperatively } from \"@next-core/loader\";\nimport moment from \"moment\";\nimport \"moment/locale/zh-cn.js\";\nimport { createHistory } from \"../history.js\";\nimport { matchStoryboard } from \"./matchStoryboard.js\";\nimport { Router } from \"./Router.js\";\nimport { loadCheckLogin } from \"./loadCheckLogin.js\";\nimport { loadBootstrapData } from \"./loadBootstrapData.js\";\nimport { NS, locales } from \"./i18n.js\";\nimport { loadNotificationService } from \"../Notification.js\";\nimport { loadDialogService } from \"../Dialog.js\";\nimport { injectedBootstrapData } from \"./bootstrapData.js\";\n\nlet runtime: Runtime;\n\n// Allow inject bootstrap data in a runtime other than Brick Next.\nlet bootstrapData = injectedBootstrapData;\nlet router: Router | undefined;\n\nexport function createRuntime() {\n if (runtime) {\n throw new Error(\"Cannot create multiple runtimes\");\n }\n initializeI18n(NS, locales);\n moment.locale(i18n.language);\n i18n.on(\"languageChanged\", () => {\n moment.locale(i18n.language);\n });\n createHistory();\n runtime = new Runtime();\n return runtime;\n}\n\nexport function getRuntime() {\n return runtime;\n}\n\nexport class Runtime {\n async bootstrap() {\n const [, _bootstrapData] = await Promise.all([\n loadCheckLogin(),\n loadBootstrapData(),\n ]);\n bootstrapData = _bootstrapData;\n // Todo: allow configuration of notification bricks.\n loadNotificationService(\"shoelace.show-notification\");\n loadDialogService(\"shoelace.show-dialog\");\n router = new Router(_bootstrapData.storyboards);\n await router.bootstrap();\n }\n\n getRecentApps() {\n return router?.getRecentApps() ?? {};\n }\n\n getCurrentApp() {\n return router?.getRecentApps().currentApp;\n }\n\n getFeatureFlags(): FeatureFlags {\n return {\n ...bootstrapData?.settings?.featureFlags,\n ...(\n router?.getRecentApps().currentApp?.config\n ?.settings as BootstrapSettings\n )?.featureFlags,\n \"migrate-to-brick-next-v3\": true,\n };\n }\n\n getMiscSettings() {\n return {\n ...bootstrapData?.settings?.misc,\n ...(\n router?.getRecentApps().currentApp?.config\n ?.settings as BootstrapSettings\n )?.misc,\n };\n }\n\n getBrandSettings(): Record<string, string> {\n return {\n base_title: \"DevOps 管理专家\",\n ...(bootstrapData?.settings?.brand as Record<string, string>),\n // ...(kernel.getOriginFaviconHref()\n // ? { favicon: kernel.getOriginFaviconHref() }\n // : {})\n };\n }\n\n getLaunchpadSettings() {\n return {\n columns: 7,\n rows: 4,\n ...bootstrapData?.settings?.launchpad,\n };\n }\n\n getDesktops(): unknown[] {\n return bootstrapData?.desktops ?? [];\n }\n\n getLaunchpadSiteMap(): unknown[] {\n return bootstrapData?.siteSort ?? [];\n }\n\n toggleLaunchpadEffect(open: boolean): void {\n document.body.classList.toggle(\"launchpad-open\", open);\n }\n\n applyPageTitle(pageTitle: string): void {\n const baseTitle = this.getBrandSettings().base_title;\n document.title = pageTitle ? `${pageTitle} - ${baseTitle}` : baseTitle;\n }\n\n getNavConfig() {\n return router?.getNavConfig();\n }\n}\n\nexport function _test_only_setBootstrapData(data: Partial<BootstrapData>) {\n bootstrapData = data;\n}\n\nexport function getBrickPackages() {\n return bootstrapData?.brickPackages ?? [];\n}\n\nexport function _internalApiLoadBricks(bricks: string[] | Set<string>) {\n return loadBricksImperatively(bricks, getBrickPackages());\n}\n\nexport function _internalApiGetRenderId(): string | undefined {\n return router?.getRenderId();\n}\n\nexport function _internalApiMatchStoryboard(\n pathname: string\n): RuntimeStoryboard | undefined {\n return matchStoryboard(bootstrapData?.storyboards ?? [], pathname);\n}\n\nexport function _internalApiGetRuntimeContext() {\n return router?.getRuntimeContext();\n}\n\nexport function _internalApiGetStoryboardInBootstrapData(appId: string) {\n return bootstrapData?.storyboards?.find(\n (storyboard) => storyboard.app.id === appId\n );\n}\n\nexport function _internalApiGetAppInBootstrapData(appId: string) {\n return _internalApiGetStoryboardInBootstrapData(appId)?.app;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAMA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AACAA,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAP,OAAA;AACA,IAAAQ,kBAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT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AAA,uBAANA,QAAA,CAAQC,iBAAiB,EAAE;AACpC;AAEO,SAASC,wCAAwCA,CAACC,KAAa,EAAE;EAAA,IAAAC,gBAAA,EAAAC,qBAAA;EACtE,QAAAD,gBAAA,GAAOxG,aAAa,cAAAwG,gBAAA,wBAAAC,qBAAA,GAAbD,gBAAA,CAAe/E,WAAW,cAAAgF,qBAAA,uBAA1BA,qBAAA,CAA4BC,IAAI,CACpCC,UAAU,IAAKA,UAAU,CAACC,GAAG,CAACC,EAAE,KAAKN,KAAK,CAC5C;AACH;AAEO,SAASO,iCAAiCA,CAACP,KAAa,EAAE;EAAA,IAAAQ,qBAAA;EAC/D,QAAAA,qBAAA,GAAOT,wCAAwC,CAACC,KAAK,CAAC,cAAAQ,qBAAA,uBAA/CA,qBAAA,CAAiDH,GAAG;AAC7D"}
|
|
1
|
+
{"version":3,"file":"Runtime.js","names":["_i18n","require","_loader","_moment","_interopRequireDefault","_history","_matchStoryboard","_Router","_loadCheckLogin","_loadBootstrapData","_i18n2","_Notification","_Dialog","_bootstrapData11","runtime","bootstrapData","injectedBootstrapData","router","createRuntime","Error","initializeI18n","NS","locales","moment","locale","i18n","language","on","createHistory","Runtime","getRuntime","bootstrap","_bootstrapData","Promise","all","loadCheckLogin","loadBootstrapData","loadNotificationService","loadDialogService","Router","storyboards","getRecentApps","_router$getRecentApps","_router","getCurrentApp","_router2","currentApp","getFeatureFlags","_bootstrapData2","_bootstrapData2$setti","_router3","_router3$getRecentApp","_router3$getRecentApp2","_router3$getRecentApp3","settings","featureFlags","config","getMiscSettings","_bootstrapData3","_bootstrapData3$setti","_router4","_router4$getRecentApp","_router4$getRecentApp2","_router4$getRecentApp3","misc","getBrandSettings","_bootstrapData4","_bootstrapData4$setti","base_title","brand","getLaunchpadSettings","_bootstrapData5","_bootstrapData5$setti","columns","rows","launchpad","getDesktops","_bootstrapData$deskto","_bootstrapData6","desktops","getLaunchpadSiteMap","_bootstrapData$siteSo","_bootstrapData7","siteSort","toggleLaunchpadEffect","open","document","body","classList","toggle","applyPageTitle","pageTitle","baseTitle","title","getNavConfig","_router5","exports","_internalApiSetBootstrapData","data","getBrickPackages","_bootstrapData$brickP","_bootstrapData8","brickPackages","_internalApiLoadBricks","bricks","loadBricksImperatively","_internalApiGetRenderId","_router6","getRenderId","_internalApiMatchStoryboard","pathname","_bootstrapData$storyb","_bootstrapData9","matchStoryboard","_internalApiGetRuntimeContext","_router7","getRuntimeContext","_internalApiGetStoryboardInBootstrapData","appId","_bootstrapData10","_bootstrapData10$stor","find","storyboard","app","id","_internalApiGetAppInBootstrapData","_internalApiGetStoryb"],"sources":["../../../src/internal/Runtime.ts"],"sourcesContent":["import type {\n RuntimeStoryboard,\n BootstrapSettings,\n FeatureFlags,\n BootstrapData,\n} from \"@next-core/types\";\nimport { i18n, initializeI18n } from \"@next-core/i18n\";\nimport { loadBricksImperatively } from \"@next-core/loader\";\nimport moment from \"moment\";\nimport \"moment/locale/zh-cn.js\";\nimport { createHistory } from \"../history.js\";\nimport { matchStoryboard } from \"./matchStoryboard.js\";\nimport { Router } from \"./Router.js\";\nimport { loadCheckLogin } from \"./loadCheckLogin.js\";\nimport { loadBootstrapData } from \"./loadBootstrapData.js\";\nimport { NS, locales } from \"./i18n.js\";\nimport { loadNotificationService } from \"../Notification.js\";\nimport { loadDialogService } from \"../Dialog.js\";\nimport { injectedBootstrapData } from \"./bootstrapData.js\";\n\nlet runtime: Runtime;\n\n// Allow inject bootstrap data in a runtime other than Brick Next.\nlet bootstrapData = injectedBootstrapData;\nlet router: Router | undefined;\n\nexport function createRuntime() {\n if (runtime) {\n throw new Error(\"Cannot create multiple runtimes\");\n }\n initializeI18n(NS, locales);\n moment.locale(i18n.language);\n i18n.on(\"languageChanged\", () => {\n moment.locale(i18n.language);\n });\n createHistory();\n runtime = new Runtime();\n return runtime;\n}\n\nexport function getRuntime() {\n return runtime;\n}\n\nexport class Runtime {\n async bootstrap() {\n const [, _bootstrapData] = await Promise.all([\n loadCheckLogin(),\n loadBootstrapData(),\n ]);\n bootstrapData = _bootstrapData;\n // Todo: allow configuration of notification bricks.\n loadNotificationService(\"shoelace.show-notification\");\n loadDialogService(\"shoelace.show-dialog\");\n router = new Router(_bootstrapData.storyboards);\n await router.bootstrap();\n }\n\n getRecentApps() {\n return router?.getRecentApps() ?? {};\n }\n\n getCurrentApp() {\n return router?.getRecentApps().currentApp;\n }\n\n getFeatureFlags(): FeatureFlags {\n return {\n ...bootstrapData?.settings?.featureFlags,\n ...(\n router?.getRecentApps().currentApp?.config\n ?.settings as BootstrapSettings\n )?.featureFlags,\n \"migrate-to-brick-next-v3\": true,\n };\n }\n\n getMiscSettings() {\n return {\n ...bootstrapData?.settings?.misc,\n ...(\n router?.getRecentApps().currentApp?.config\n ?.settings as BootstrapSettings\n )?.misc,\n };\n }\n\n getBrandSettings(): Record<string, string> {\n return {\n base_title: \"DevOps 管理专家\",\n ...(bootstrapData?.settings?.brand as Record<string, string>),\n // ...(kernel.getOriginFaviconHref()\n // ? { favicon: kernel.getOriginFaviconHref() }\n // : {})\n };\n }\n\n getLaunchpadSettings() {\n return {\n columns: 7,\n rows: 4,\n ...bootstrapData?.settings?.launchpad,\n };\n }\n\n getDesktops(): unknown[] {\n return bootstrapData?.desktops ?? [];\n }\n\n getLaunchpadSiteMap(): unknown[] {\n return bootstrapData?.siteSort ?? [];\n }\n\n toggleLaunchpadEffect(open: boolean): void {\n document.body.classList.toggle(\"launchpad-open\", open);\n }\n\n applyPageTitle(pageTitle: string): void {\n const baseTitle = this.getBrandSettings().base_title;\n document.title = pageTitle ? `${pageTitle} - ${baseTitle}` : baseTitle;\n }\n\n getNavConfig() {\n return router?.getNavConfig();\n }\n}\n\nexport function _internalApiSetBootstrapData(data: Partial<BootstrapData>) {\n bootstrapData = data;\n}\n\nexport function getBrickPackages() {\n return bootstrapData?.brickPackages ?? [];\n}\n\nexport function _internalApiLoadBricks(bricks: string[] | Set<string>) {\n return loadBricksImperatively(bricks, getBrickPackages());\n}\n\nexport function _internalApiGetRenderId(): string | undefined {\n return router?.getRenderId();\n}\n\nexport function _internalApiMatchStoryboard(\n pathname: string\n): RuntimeStoryboard | undefined {\n return matchStoryboard(bootstrapData?.storyboards ?? [], pathname);\n}\n\nexport function _internalApiGetRuntimeContext() {\n return router?.getRuntimeContext();\n}\n\nexport function _internalApiGetStoryboardInBootstrapData(appId: string) {\n return bootstrapData?.storyboards?.find(\n (storyboard) => storyboard.app.id === appId\n );\n}\n\nexport function _internalApiGetAppInBootstrapData(appId: string) {\n return _internalApiGetStoryboardInBootstrapData(appId)?.app;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAMA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AACAA,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAP,OAAA;AACA,IAAAQ,kBAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,aAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AACA,IAAAY,gBAAA,GAAAZ,OAAA;AAEA,IAAIa,OAAgB;;AAEpB;AACA,IAAIC,aAAa,GAAGC,sCAAqB;AACzC,IAAIC,MAA0B;AAEvB,SAASC,aAAaA,CAAA,EAAG;EAC9B,IAAIJ,OAAO,EAAE;IACX,MAAM,IAAIK,KAAK,CAAC,iCAAiC,CAAC;EACpD;EACA,IAAAC,oBAAc,EAACC,SAAE,EAAEC,cAAO,CAAC;EAC3BC,eAAM,CAACC,MAAM,CAACC,UAAI,CAACC,QAAQ,CAAC;EAC5BD,UAAI,CAACE,EAAE,CAAC,iBAAiB,EAAE,MAAM;IAC/BJ,eAAM,CAACC,MAAM,CAACC,UAAI,CAACC,QAAQ,CAAC;EAC9B,CAAC,CAAC;EAC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ountUseBrick({
|
|
|
103
103
|
rendererContext.dispatchOnUnmount();
|
|
104
104
|
rendererContext.dispose();
|
|
105
105
|
}
|
|
106
|
-
function initializePlayground() {
|
|
106
|
+
function initializePlayground(data) {
|
|
107
|
+
(0, _Runtime._internalApiSetBootstrapData)(data);
|
|
107
108
|
// Todo: allow configuration of notification bricks.
|
|
108
109
|
(0, _Notification.loadNotificationService)("shoelace.show-notification");
|
|
109
110
|
(0, _Dialog.loadDialogService)("shoelace.show-dialog");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secret_internals.js","names":["_loader","require","_lodash","_Runtime","_Renderer","_RendererContext","_mount","_enums","_computeRealValue","_isStrictMode","_CustomTemplates","_registerAppI18n","_Notification","_Dialog","renderUseBrick","useBrick","data","_runtimeContext$tplSt","_output$node","tplStateStoreScope","runtimeContext","_internalApiGetRuntimeContext","pendingPermissionsPreCheck","tplStateStoreMap","Map","rendererContext","RendererContext","renderRoot","tag","RenderTag","ROOT","createPortal","transform","strict","isStrictMode","warnAboutStrictMode","output","renderBrick","properties","flushStableLoadBricks","Promise","all","blockingList","map","store","waitForAll","node","portal","Error","child","tagName","type","mountUseBrick","element","portalRoot","document","querySelector","createElement","appendChild","mountTree","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","unmountUseBrick","mountResult","unmountTree","remove","dispatchOnUnmount","dispose","initializePlayground","loadNotificationService","loadDialogService","legacyDoTransform","to","options","computeRealValue","noInject","loadBricks","_internalApiLoadBricks","exports","updateStoryboard","appId","storyboardPatch","storyboard","_internalApiGetStoryboardInBootstrapData","Object","assign","$$fulfilling","$$fulfilled","$$registerCustomTemplateProcessed","registerAppI18n","updateStoryboardByRoute","newRoute","match","getKey","route","path","exact","replaceRoute","routes","key","routeKey","unshift","updateStoryboardByTemplate","newTemplate","settings","tplName","name","customTemplates","define","bricks","proxy","state","updateTemplatePreviewSettings","templateId","_updatePreviewSettings","brick","pick","updateStoryboardBySnippet","snippetData","_snippetData$bricks","snippetId","length","updateSnippetPreviewSettings","previewRouteIndex","findIndex","newPreviewRoute","menu","splice"],"sources":["../../../src/internal/secret_internals.ts"],"sourcesContent":["import type {\n BrickConf,\n CustomTemplate,\n RouteConf,\n Storyboard,\n UseSingleBrickConf,\n} from \"@next-core/types\";\nimport { flushStableLoadBricks } from \"@next-core/loader\";\nimport { pick } from \"lodash\";\nimport {\n _internalApiGetRuntimeContext,\n _internalApiGetStoryboardInBootstrapData,\n _internalApiLoadBricks,\n} from \"./Runtime.js\";\nimport { renderBrick } from \"./Renderer.js\";\nimport { RendererContext } from \"./RendererContext.js\";\nimport type { DataStore } from \"./data/DataStore.js\";\nimport type { RenderRoot, RuntimeContext } from \"./interfaces.js\";\nimport { mountTree, unmountTree } from \"./mount.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { computeRealValue } from \"./compute/computeRealValue.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"../isStrictMode.js\";\nimport { customTemplates } from \"../CustomTemplates.js\";\nimport { registerAppI18n } from \"./registerAppI18n.js\";\nimport { loadNotificationService } from \"../Notification.js\";\nimport { loadDialogService } from \"../Dialog.js\";\n\nexport interface RenderUseBrickResult {\n tagName: string | null;\n renderRoot: RenderRoot;\n rendererContext: RendererContext;\n}\n\nexport async function renderUseBrick(\n useBrick: UseSingleBrickConf,\n data: unknown\n): Promise<RenderUseBrickResult> {\n const tplStateStoreScope: DataStore<\"STATE\">[] = [];\n const runtimeContext: RuntimeContext = {\n ..._internalApiGetRuntimeContext()!,\n data,\n pendingPermissionsPreCheck: [],\n tplStateStoreScope,\n };\n\n runtimeContext.tplStateStoreMap ??= new Map();\n\n const rendererContext = new RendererContext(\"fragment\");\n\n const renderRoot: RenderRoot = {\n tag: RenderTag.ROOT,\n // Will set during `mountUseBrick`\n createPortal: null!,\n };\n\n const transform = (useBrick as { transform?: Record<string, unknown> })\n .transform;\n const strict = isStrictMode();\n if (transform) {\n warnAboutStrictMode(\n strict,\n \"`useBrick.transform`\",\n 'please use \"properties\" instead, check your useBrick:',\n useBrick\n );\n }\n\n const output = await renderBrick(\n renderRoot,\n strict\n ? useBrick\n : {\n ...useBrick,\n properties: {\n ...useBrick.properties,\n ...transform,\n },\n },\n runtimeContext,\n rendererContext\n );\n\n flushStableLoadBricks();\n\n await Promise.all([\n ...output.blockingList,\n // Wait for local tpl state stores belong to current `useBrick` only.\n ...tplStateStoreScope.map((store) => store.waitForAll()),\n ...runtimeContext.pendingPermissionsPreCheck,\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 };\n}\n\nexport interface MountUseBrickResult {\n portal?: HTMLElement;\n}\n\nexport function mountUseBrick(\n { renderRoot, rendererContext }: 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\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 initializePlayground() {\n // Todo: allow configuration of notification bricks.\n loadNotificationService(\"shoelace.show-notification\");\n loadDialogService(\"shoelace.show-dialog\");\n}\n\nexport function legacyDoTransform(\n data: unknown,\n to: unknown,\n options?: unknown\n) {\n if (options) {\n throw new Error(\"Legacy doTransform does not support options in v3\");\n }\n return computeRealValue(\n to,\n {\n ..._internalApiGetRuntimeContext()!,\n data,\n },\n {\n noInject: true,\n }\n );\n}\n\nexport const loadBricks = _internalApiLoadBricks;\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 $$fulfilling: null,\n $$fulfilled: true,\n $$registerCustomTemplateProcessed: false,\n });\n registerAppI18n(storyboard);\n}\n\nexport function updateStoryboardByRoute(appId: string, newRoute: RouteConf) {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId)!;\n let match = false;\n const getKey = (route: RouteConf): string => `${route.path}.${route.exact}`;\n const replaceRoute = (routes: RouteConf[], key: string): RouteConf[] => {\n return routes.map((route) => {\n const routeKey = getKey(route);\n if (route.type === \"routes\") {\n route.routes = replaceRoute(route.routes, key);\n return route;\n } else if (routeKey === key) {\n match = true;\n return newRoute;\n } else {\n return route;\n }\n });\n };\n storyboard.routes = replaceRoute(storyboard.routes, getKey(newRoute));\n if (!match) {\n storyboard.routes.unshift(newRoute);\n }\n}\n\nexport function updateStoryboardByTemplate(\n appId: string,\n newTemplate: CustomTemplate,\n settings: unknown\n): void {\n const tplName = `${appId}.${newTemplate.name}`;\n // customTemplateRegistry.delete(tplName);\n customTemplates.define(tplName, {\n bricks: newTemplate.bricks,\n proxy: newTemplate.proxy,\n state: newTemplate.state,\n });\n updateTemplatePreviewSettings(appId, newTemplate.name, settings);\n}\n\nexport function updateTemplatePreviewSettings(\n appId: string,\n templateId: string,\n settings?: unknown\n): void {\n _updatePreviewSettings(\n appId,\n `\\${APP.homepage}/_dev_only_/template-preview/${templateId}`,\n [\n {\n brick: templateId,\n ...pick(settings, \"properties\", \"events\", \"lifeCycle\", \"context\"),\n },\n ]\n );\n}\n\nexport function updateStoryboardBySnippet(\n appId: string,\n snippetData: {\n snippetId: string;\n bricks?: BrickConf[];\n }\n): void {\n _updatePreviewSettings(\n appId,\n `\\${APP.homepage}/_dev_only_/snippet-preview/${snippetData.snippetId}`,\n snippetData.bricks?.length ? snippetData.bricks : [{ brick: \"span\" }]\n );\n}\n\nexport const updateSnippetPreviewSettings = updateStoryboardBySnippet;\n\nfunction _updatePreviewSettings(\n appId: string,\n path: string,\n bricks: BrickConf[]\n) {\n const { routes } = _internalApiGetStoryboardInBootstrapData(appId)!;\n const previewRouteIndex = routes.findIndex((route) => route.path === path);\n const newPreviewRoute: RouteConf = {\n path,\n bricks,\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"],"mappings":";;;;;;;;;;;;;;;;;AAOA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AAGA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,iBAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAR,OAAA;AACA,IAAAS,gBAAA,GAAAT,OAAA;AACA,IAAAU,gBAAA,GAAAV,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;AACA,IAAAY,OAAA,GAAAZ,OAAA;AAQO,eAAea,cAAcA,CAClCC,QAA4B,EAC5BC,IAAa,EACkB;EAAA,IAAAC,qBAAA,EAAAC,YAAA;EAC/B,MAAMC,kBAAwC,GAAG,EAAE;EACnD,MAAMC,cAA8B,GAAG;IACrC,GAAG,IAAAC,sCAA6B,GAAG;IACnCL,IAAI;IACJM,0BAA0B,EAAE,EAAE;IAC9BH;EACF,CAAC;EAED,CAAAF,qBAAA,GAAAG,cAAc,CAACG,gBAAgB,cAAAN,qBAAA,cAAAA,qBAAA,GAA/BG,cAAc,CAACG,gBAAgB,GAAK,IAAIC,GAAG,EAAE;EAE7C,MAAMC,eA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MAAM;IAAEX;EAAO,CAAC,GAAG,IAAAf,iDAAwC,EAACH,KAAK,CAAE;EACnE,MAAM2C,iBAAiB,GAAGzB,MAAM,CAAC0B,SAAS,CAAE9B,KAAK,IAAKA,KAAK,CAACC,IAAI,KAAKA,IAAI,CAAC;EAC1E,MAAM8B,eAA0B,GAAG;IACjC9B,IAAI;IACJc,MAAM;IACNiB,IAAI,EAAE,KAAK;IACX9B,KAAK,EAAE;EACT,CAAC;EACD,IAAI2B,iBAAiB,KAAK,CAAC,CAAC,EAAE;IAC5BzB,MAAM,CAACG,OAAO,CAACwB,eAAe,CAAC;EACjC,CAAC,MAAM;IACL3B,MAAM,CAAC6B,MAAM,CAACJ,iBAAiB,EAAE,CAAC,EAAEE,eAAe,CAAC;EACtD;AACF"}
|
|
1
|
+
{"version":3,"file":"secret_internals.js","names":["_loader","require","_lodash","_Runtime","_Renderer","_RendererContext","_mount","_enums","_computeRealValue","_isStrictMode","_CustomTemplates","_registerAppI18n","_Notification","_Dialog","renderUseBrick","useBrick","data","_runtimeContext$tplSt","_output$node","tplStateStoreScope","runtimeContext","_internalApiGetRuntimeContext","pendingPermissionsPreCheck","tplStateStoreMap","Map","rendererContext","RendererContext","renderRoot","tag","RenderTag","ROOT","createPortal","transform","strict","isStrictMode","warnAboutStrictMode","output","renderBrick","properties","flushStableLoadBricks","Promise","all","blockingList","map","store","waitForAll","node","portal","Error","child","tagName","type","mountUseBrick","element","portalRoot","document","querySelector","createElement","appendChild","mountTree","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","unmountUseBrick","mountResult","unmountTree","remove","dispatchOnUnmount","dispose","initializePlayground","_internalApiSetBootstrapData","loadNotificationService","loadDialogService","legacyDoTransform","to","options","computeRealValue","noInject","loadBricks","_internalApiLoadBricks","exports","updateStoryboard","appId","storyboardPatch","storyboard","_internalApiGetStoryboardInBootstrapData","Object","assign","$$fulfilling","$$fulfilled","$$registerCustomTemplateProcessed","registerAppI18n","updateStoryboardByRoute","newRoute","match","getKey","route","path","exact","replaceRoute","routes","key","routeKey","unshift","updateStoryboardByTemplate","newTemplate","settings","tplName","name","customTemplates","define","bricks","proxy","state","updateTemplatePreviewSettings","templateId","_updatePreviewSettings","brick","pick","updateStoryboardBySnippet","snippetData","_snippetData$bricks","snippetId","length","updateSnippetPreviewSettings","previewRouteIndex","findIndex","newPreviewRoute","menu","splice"],"sources":["../../../src/internal/secret_internals.ts"],"sourcesContent":["import type {\n BootstrapData,\n BrickConf,\n CustomTemplate,\n RouteConf,\n Storyboard,\n UseSingleBrickConf,\n} from \"@next-core/types\";\nimport { flushStableLoadBricks } from \"@next-core/loader\";\nimport { pick } from \"lodash\";\nimport {\n _internalApiGetRuntimeContext,\n _internalApiGetStoryboardInBootstrapData,\n _internalApiLoadBricks,\n _internalApiSetBootstrapData,\n} from \"./Runtime.js\";\nimport { renderBrick } from \"./Renderer.js\";\nimport { RendererContext } from \"./RendererContext.js\";\nimport type { DataStore } from \"./data/DataStore.js\";\nimport type { RenderRoot, RuntimeContext } from \"./interfaces.js\";\nimport { mountTree, unmountTree } from \"./mount.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { computeRealValue } from \"./compute/computeRealValue.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"../isStrictMode.js\";\nimport { customTemplates } from \"../CustomTemplates.js\";\nimport { registerAppI18n } from \"./registerAppI18n.js\";\nimport { loadNotificationService } from \"../Notification.js\";\nimport { loadDialogService } from \"../Dialog.js\";\n\nexport interface RenderUseBrickResult {\n tagName: string | null;\n renderRoot: RenderRoot;\n rendererContext: RendererContext;\n}\n\nexport async function renderUseBrick(\n useBrick: UseSingleBrickConf,\n data: unknown\n): Promise<RenderUseBrickResult> {\n const tplStateStoreScope: DataStore<\"STATE\">[] = [];\n const runtimeContext: RuntimeContext = {\n ..._internalApiGetRuntimeContext()!,\n data,\n pendingPermissionsPreCheck: [],\n tplStateStoreScope,\n };\n\n runtimeContext.tplStateStoreMap ??= new Map();\n\n const rendererContext = new RendererContext(\"fragment\");\n\n const renderRoot: RenderRoot = {\n tag: RenderTag.ROOT,\n // Will set during `mountUseBrick`\n createPortal: null!,\n };\n\n const transform = (useBrick as { transform?: Record<string, unknown> })\n .transform;\n const strict = isStrictMode();\n if (transform) {\n warnAboutStrictMode(\n strict,\n \"`useBrick.transform`\",\n 'please use \"properties\" instead, check your useBrick:',\n useBrick\n );\n }\n\n const output = await renderBrick(\n renderRoot,\n strict\n ? useBrick\n : {\n ...useBrick,\n properties: {\n ...useBrick.properties,\n ...transform,\n },\n },\n runtimeContext,\n rendererContext\n );\n\n flushStableLoadBricks();\n\n await Promise.all([\n ...output.blockingList,\n // Wait for local tpl state stores belong to current `useBrick` only.\n ...tplStateStoreScope.map((store) => store.waitForAll()),\n ...runtimeContext.pendingPermissionsPreCheck,\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 };\n}\n\nexport interface MountUseBrickResult {\n portal?: HTMLElement;\n}\n\nexport function mountUseBrick(\n { renderRoot, rendererContext }: 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\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 initializePlayground(data: BootstrapData) {\n _internalApiSetBootstrapData(data);\n // Todo: allow configuration of notification bricks.\n loadNotificationService(\"shoelace.show-notification\");\n loadDialogService(\"shoelace.show-dialog\");\n}\n\nexport function legacyDoTransform(\n data: unknown,\n to: unknown,\n options?: unknown\n) {\n if (options) {\n throw new Error(\"Legacy doTransform does not support options in v3\");\n }\n return computeRealValue(\n to,\n {\n ..._internalApiGetRuntimeContext()!,\n data,\n },\n {\n noInject: true,\n }\n );\n}\n\nexport const loadBricks = _internalApiLoadBricks;\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 $$fulfilling: null,\n $$fulfilled: true,\n $$registerCustomTemplateProcessed: false,\n });\n registerAppI18n(storyboard);\n}\n\nexport function updateStoryboardByRoute(appId: string, newRoute: RouteConf) {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId)!;\n let match = false;\n const getKey = (route: RouteConf): string => `${route.path}.${route.exact}`;\n const replaceRoute = (routes: RouteConf[], key: string): RouteConf[] => {\n return routes.map((route) => {\n const routeKey = getKey(route);\n if (route.type === \"routes\") {\n route.routes = replaceRoute(route.routes, key);\n return route;\n } else if (routeKey === key) {\n match = true;\n return newRoute;\n } else {\n return route;\n }\n });\n };\n storyboard.routes = replaceRoute(storyboard.routes, getKey(newRoute));\n if (!match) {\n storyboard.routes.unshift(newRoute);\n }\n}\n\nexport function updateStoryboardByTemplate(\n appId: string,\n newTemplate: CustomTemplate,\n settings: unknown\n): void {\n const tplName = `${appId}.${newTemplate.name}`;\n // customTemplateRegistry.delete(tplName);\n customTemplates.define(tplName, {\n bricks: newTemplate.bricks,\n proxy: newTemplate.proxy,\n state: newTemplate.state,\n });\n updateTemplatePreviewSettings(appId, newTemplate.name, settings);\n}\n\nexport function updateTemplatePreviewSettings(\n appId: string,\n templateId: string,\n settings?: unknown\n): void {\n _updatePreviewSettings(\n appId,\n `\\${APP.homepage}/_dev_only_/template-preview/${templateId}`,\n [\n {\n brick: templateId,\n ...pick(settings, \"properties\", \"events\", \"lifeCycle\", \"context\"),\n },\n ]\n );\n}\n\nexport function updateStoryboardBySnippet(\n appId: string,\n snippetData: {\n snippetId: string;\n bricks?: BrickConf[];\n }\n): void {\n _updatePreviewSettings(\n appId,\n `\\${APP.homepage}/_dev_only_/snippet-preview/${snippetData.snippetId}`,\n snippetData.bricks?.length ? snippetData.bricks : [{ brick: \"span\" }]\n );\n}\n\nexport const updateSnippetPreviewSettings = updateStoryboardBySnippet;\n\nfunction _updatePreviewSettings(\n appId: string,\n path: string,\n bricks: BrickConf[]\n) {\n const { routes } = _internalApiGetStoryboardInBootstrapData(appId)!;\n const previewRouteIndex = routes.findIndex((route) => route.path === path);\n const newPreviewRoute: RouteConf = {\n path,\n bricks,\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"],"mappings":";;;;;;;;;;;;;;;;;AAQA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAMA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AAGA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,iBAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAR,OAAA;AACA,IAAAS,gBAAA,GAAAT,OAAA;AACA,IAAAU,gBAAA,GAAAV,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;AACA,IAAAY,OAAA,GAAAZ,OAAA;AAQO,eAAea,cAAcA,CAClCC,QAA4B,EAC5BC,IAAa,EACkB;EAAA,IAAAC,qBAAA,EAAAC,YAAA;EAC/B,MAAMC,kBAAwC,GAAG,EAAE;EACnD,MAAMC,cAA8B,GAAG;IAC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AM,cAAAU,mBAAA,eAAlBA,mBAAA,CAAoBE,MAAM,GAAGH,WAAW,CAACT,MAAM,GAAG,CAAC;IAAEM,KAAK,EAAE;EAAO,CAAC,CAAC,CACtE;AACH;AAEO,MAAMO,4BAA4B,GAAGL,yBAAyB;AAACvC,OAAA,CAAA4C,4BAAA,GAAAA,4BAAA;AAEtE,SAASR,sBAAsBA,CAC7BlC,KAAa,EACbe,IAAY,EACZc,MAAmB,EACnB;EACA,MAAM;IAAEX;EAAO,CAAC,GAAG,IAAAf,iDAAwC,EAACH,KAAK,CAAE;EACnE,MAAM2C,iBAAiB,GAAGzB,MAAM,CAAC0B,SAAS,CAAE9B,KAAK,IAAKA,KAAK,CAACC,IAAI,KAAKA,IAAI,CAAC;EAC1E,MAAM8B,eAA0B,GAAG;IACjC9B,IAAI;IACJc,MAAM;IACNiB,IAAI,EAAE,KAAK;IACX9B,KAAK,EAAE;EACT,CAAC;EACD,IAAI2B,iBAAiB,KAAK,CAAC,CAAC,EAAE;IAC5BzB,MAAM,CAACG,OAAO,CAACwB,eAAe,CAAC;EACjC,CAAC,MAAM;IACL3B,MAAM,CAAC6B,MAAM,CAACJ,iBAAiB,EAAE,CAAC,EAAEE,eAAe,CAAC;EACtD;AACF"}
|
|
@@ -97,7 +97,7 @@ export class Runtime {
|
|
|
97
97
|
return (_router5 = router) === null || _router5 === void 0 ? void 0 : _router5.getNavConfig();
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
export function
|
|
100
|
+
export function _internalApiSetBootstrapData(data) {
|
|
101
101
|
bootstrapData = data;
|
|
102
102
|
}
|
|
103
103
|
export function getBrickPackages() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Runtime.js","names":["i18n","initializeI18n","loadBricksImperatively","moment","createHistory","matchStoryboard","Router","loadCheckLogin","loadBootstrapData","NS","locales","loadNotificationService","loadDialogService","injectedBootstrapData","runtime","bootstrapData","router","createRuntime","Error","locale","language","on","Runtime","getRuntime","bootstrap","_asyncToGenerator","_bootstrapData","Promise","all","storyboards","getRecentApps","_router$getRecentApps","_router","getCurrentApp","_router2","currentApp","getFeatureFlags","_bootstrapData2","_bootstrapData2$setti","_router3","_router3$getRecentApp","_router3$getRecentApp2","_router3$getRecentApp3","_objectSpread","settings","featureFlags","config","getMiscSettings","_bootstrapData3","_bootstrapData3$setti","_router4","_router4$getRecentApp","_router4$getRecentApp2","_router4$getRecentApp3","misc","getBrandSettings","_bootstrapData4","_bootstrapData4$setti","base_title","brand","getLaunchpadSettings","_bootstrapData5","_bootstrapData5$setti","columns","rows","launchpad","getDesktops","_bootstrapData$deskto","_bootstrapData6","desktops","getLaunchpadSiteMap","_bootstrapData$siteSo","_bootstrapData7","siteSort","toggleLaunchpadEffect","open","document","body","classList","toggle","applyPageTitle","pageTitle","baseTitle","title","concat","getNavConfig","_router5","_test_only_setBootstrapData","data","getBrickPackages","_bootstrapData$brickP","_bootstrapData8","brickPackages","_internalApiLoadBricks","bricks","_internalApiGetRenderId","_router6","getRenderId","_internalApiMatchStoryboard","pathname","_bootstrapData$storyb","_bootstrapData9","_internalApiGetRuntimeContext","_router7","getRuntimeContext","_internalApiGetStoryboardInBootstrapData","appId","_bootstrapData10","_bootstrapData10$stor","find","storyboard","app","id","_internalApiGetAppInBootstrapData","_internalApiGetStoryb"],"sources":["../../../src/internal/Runtime.ts"],"sourcesContent":["import type {\n RuntimeStoryboard,\n BootstrapSettings,\n FeatureFlags,\n BootstrapData,\n} from \"@next-core/types\";\nimport { i18n, initializeI18n } from \"@next-core/i18n\";\nimport { loadBricksImperatively } from \"@next-core/loader\";\nimport moment from \"moment\";\nimport \"moment/locale/zh-cn.js\";\nimport { createHistory } from \"../history.js\";\nimport { matchStoryboard } from \"./matchStoryboard.js\";\nimport { Router } from \"./Router.js\";\nimport { loadCheckLogin } from \"./loadCheckLogin.js\";\nimport { loadBootstrapData } from \"./loadBootstrapData.js\";\nimport { NS, locales } from \"./i18n.js\";\nimport { loadNotificationService } from \"../Notification.js\";\nimport { loadDialogService } from \"../Dialog.js\";\nimport { injectedBootstrapData } from \"./bootstrapData.js\";\n\nlet runtime: Runtime;\n\n// Allow inject bootstrap data in a runtime other than Brick Next.\nlet bootstrapData = injectedBootstrapData;\nlet router: Router | undefined;\n\nexport function createRuntime() {\n if (runtime) {\n throw new Error(\"Cannot create multiple runtimes\");\n }\n initializeI18n(NS, locales);\n moment.locale(i18n.language);\n i18n.on(\"languageChanged\", () => {\n moment.locale(i18n.language);\n });\n createHistory();\n runtime = new Runtime();\n return runtime;\n}\n\nexport function getRuntime() {\n return runtime;\n}\n\nexport class Runtime {\n async bootstrap() {\n const [, _bootstrapData] = await Promise.all([\n loadCheckLogin(),\n loadBootstrapData(),\n ]);\n bootstrapData = _bootstrapData;\n // Todo: allow configuration of notification bricks.\n loadNotificationService(\"shoelace.show-notification\");\n loadDialogService(\"shoelace.show-dialog\");\n router = new Router(_bootstrapData.storyboards);\n await router.bootstrap();\n }\n\n getRecentApps() {\n return router?.getRecentApps() ?? {};\n }\n\n getCurrentApp() {\n return router?.getRecentApps().currentApp;\n }\n\n getFeatureFlags(): FeatureFlags {\n return {\n ...bootstrapData?.settings?.featureFlags,\n ...(\n router?.getRecentApps().currentApp?.config\n ?.settings as BootstrapSettings\n )?.featureFlags,\n \"migrate-to-brick-next-v3\": true,\n };\n }\n\n getMiscSettings() {\n return {\n ...bootstrapData?.settings?.misc,\n ...(\n router?.getRecentApps().currentApp?.config\n ?.settings as BootstrapSettings\n )?.misc,\n };\n }\n\n getBrandSettings(): Record<string, string> {\n return {\n base_title: \"DevOps 管理专家\",\n ...(bootstrapData?.settings?.brand as Record<string, string>),\n // ...(kernel.getOriginFaviconHref()\n // ? { favicon: kernel.getOriginFaviconHref() }\n // : {})\n };\n }\n\n getLaunchpadSettings() {\n return {\n columns: 7,\n rows: 4,\n ...bootstrapData?.settings?.launchpad,\n };\n }\n\n getDesktops(): unknown[] {\n return bootstrapData?.desktops ?? [];\n }\n\n getLaunchpadSiteMap(): unknown[] {\n return bootstrapData?.siteSort ?? [];\n }\n\n toggleLaunchpadEffect(open: boolean): void {\n document.body.classList.toggle(\"launchpad-open\", open);\n }\n\n applyPageTitle(pageTitle: string): void {\n const baseTitle = this.getBrandSettings().base_title;\n document.title = pageTitle ? `${pageTitle} - ${baseTitle}` : baseTitle;\n }\n\n getNavConfig() {\n return router?.getNavConfig();\n }\n}\n\nexport function _test_only_setBootstrapData(data: Partial<BootstrapData>) {\n bootstrapData = data;\n}\n\nexport function getBrickPackages() {\n return bootstrapData?.brickPackages ?? [];\n}\n\nexport function _internalApiLoadBricks(bricks: string[] | Set<string>) {\n return loadBricksImperatively(bricks, getBrickPackages());\n}\n\nexport function _internalApiGetRenderId(): string | undefined {\n return router?.getRenderId();\n}\n\nexport function _internalApiMatchStoryboard(\n pathname: string\n): RuntimeStoryboard | undefined {\n return matchStoryboard(bootstrapData?.storyboards ?? [], pathname);\n}\n\nexport function _internalApiGetRuntimeContext() {\n return router?.getRuntimeContext();\n}\n\nexport function _internalApiGetStoryboardInBootstrapData(appId: string) {\n return bootstrapData?.storyboards?.find(\n (storyboard) => storyboard.app.id === appId\n );\n}\n\nexport function _internalApiGetAppInBootstrapData(appId: string) {\n return _internalApiGetStoryboardInBootstrapData(appId)?.app;\n}\n"],"mappings":";;AAMA,SAASA,IAAI,EAAEC,cAAc,QAAQ,iBAAiB;AACtD,SAASC,sBAAsB,QAAQ,mBAAmB;AAC1D,OAAOC,MAAM,MAAM,QAAQ;AAC3B,OAAO,wBAAwB;AAC/B,SAASC,aAAa,QAAQ,eAAe;AAC7C,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,MAAM,QAAQ,aAAa;AACpC,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,EAAE,EAAEC,OAAO,QAAQ,WAAW;AACvC,SAASC,uBAAuB,QAAQ,oBAAoB;AAC5D,SAASC,iBAAiB,QAAQ,cAAc;A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CAACC,KAAa,EAAE;EAAA,IAAAC,gBAAA,EAAAC,qBAAA;EACtE,QAAAD,gBAAA,GAAO5F,aAAa,cAAA4F,gBAAA,wBAAAC,qBAAA,GAAbD,gBAAA,CAAe9E,WAAW,cAAA+E,qBAAA,uBAA1BA,qBAAA,CAA4BC,IAAI,CACpCC,UAAU,IAAKA,UAAU,CAACC,GAAG,CAACC,EAAE,KAAKN,KAAK,CAC5C;AACH;AAEA,OAAO,SAASO,iCAAiCA,CAACP,KAAa,EAAE;EAAA,IAAAQ,qBAAA;EAC/D,QAAAA,qBAAA,GAAOT,wCAAwC,CAACC,KAAK,CAAC,cAAAQ,qBAAA,uBAA/CA,qBAAA,CAAiDH,GAAG;AAC7D"}
|
|
1
|
+
{"version":3,"file":"Runtime.js","names":["i18n","initializeI18n","loadBricksImperatively","moment","createHistory","matchStoryboard","Router","loadCheckLogin","loadBootstrapData","NS","locales","loadNotificationService","loadDialogService","injectedBootstrapData","runtime","bootstrapData","router","createRuntime","Error","locale","language","on","Runtime","getRuntime","bootstrap","_asyncToGenerator","_bootstrapData","Promise","all","storyboards","getRecentApps","_router$getRecentApps","_router","getCurrentApp","_router2","currentApp","getFeatureFlags","_bootstrapData2","_bootstrapData2$setti","_router3","_router3$getRecentApp","_router3$getRecentApp2","_router3$getRecentApp3","_objectSpread","settings","featureFlags","config","getMiscSettings","_bootstrapData3","_bootstrapData3$setti","_router4","_router4$getRecentApp","_router4$getRecentApp2","_router4$getRecentApp3","misc","getBrandSettings","_bootstrapData4","_bootstrapData4$setti","base_title","brand","getLaunchpadSettings","_bootstrapData5","_bootstrapData5$setti","columns","rows","launchpad","getDesktops","_bootstrapData$deskto","_bootstrapData6","desktops","getLaunchpadSiteMap","_bootstrapData$siteSo","_bootstrapData7","siteSort","toggleLaunchpadEffect","open","document","body","classList","toggle","applyPageTitle","pageTitle","baseTitle","title","concat","getNavConfig","_router5","_internalApiSetBootstrapData","data","getBrickPackages","_bootstrapData$brickP","_bootstrapData8","brickPackages","_internalApiLoadBricks","bricks","_internalApiGetRenderId","_router6","getRenderId","_internalApiMatchStoryboard","pathname","_bootstrapData$storyb","_bootstrapData9","_internalApiGetRuntimeContext","_router7","getRuntimeContext","_internalApiGetStoryboardInBootstrapData","appId","_bootstrapData10","_bootstrapData10$stor","find","storyboard","app","id","_internalApiGetAppInBootstrapData","_internalApiGetStoryb"],"sources":["../../../src/internal/Runtime.ts"],"sourcesContent":["import type {\n RuntimeStoryboard,\n BootstrapSettings,\n FeatureFlags,\n BootstrapData,\n} from \"@next-core/types\";\nimport { i18n, initializeI18n } from \"@next-core/i18n\";\nimport { loadBricksImperatively } from \"@next-core/loader\";\nimport moment from \"moment\";\nimport \"moment/locale/zh-cn.js\";\nimport { createHistory } from \"../history.js\";\nimport { matchStoryboard } from \"./matchStoryboard.js\";\nimport { Router } from \"./Router.js\";\nimport { loadCheckLogin } from \"./loadCheckLogin.js\";\nimport { loadBootstrapData } from \"./loadBootstrapData.js\";\nimport { NS, locales } from \"./i18n.js\";\nimport { loadNotificationService } from \"../Notification.js\";\nimport { loadDialogService } from \"../Dialog.js\";\nimport { injectedBootstrapData } from \"./bootstrapData.js\";\n\nlet runtime: Runtime;\n\n// Allow inject bootstrap data in a runtime other than Brick Next.\nlet bootstrapData = injectedBootstrapData;\nlet router: Router | undefined;\n\nexport function createRuntime() {\n if (runtime) {\n throw new Error(\"Cannot create multiple runtimes\");\n }\n initializeI18n(NS, locales);\n moment.locale(i18n.language);\n i18n.on(\"languageChanged\", () => {\n moment.locale(i18n.language);\n });\n createHistory();\n runtime = new Runtime();\n return runtime;\n}\n\nexport function getRuntime() {\n return runtime;\n}\n\nexport class Runtime {\n async bootstrap() {\n const [, _bootstrapData] = await Promise.all([\n loadCheckLogin(),\n loadBootstrapData(),\n ]);\n bootstrapData = _bootstrapData;\n // Todo: allow configuration of notification bricks.\n loadNotificationService(\"shoelace.show-notification\");\n loadDialogService(\"shoelace.show-dialog\");\n router = new Router(_bootstrapData.storyboards);\n await router.bootstrap();\n }\n\n getRecentApps() {\n return router?.getRecentApps() ?? {};\n }\n\n getCurrentApp() {\n return router?.getRecentApps().currentApp;\n }\n\n getFeatureFlags(): FeatureFlags {\n return {\n ...bootstrapData?.settings?.featureFlags,\n ...(\n router?.getRecentApps().currentApp?.config\n ?.settings as BootstrapSettings\n )?.featureFlags,\n \"migrate-to-brick-next-v3\": true,\n };\n }\n\n getMiscSettings() {\n return {\n ...bootstrapData?.settings?.misc,\n ...(\n router?.getRecentApps().currentApp?.config\n ?.settings as BootstrapSettings\n )?.misc,\n };\n }\n\n getBrandSettings(): Record<string, string> {\n return {\n base_title: \"DevOps 管理专家\",\n ...(bootstrapData?.settings?.brand as Record<string, string>),\n // ...(kernel.getOriginFaviconHref()\n // ? { favicon: kernel.getOriginFaviconHref() }\n // : {})\n };\n }\n\n getLaunchpadSettings() {\n return {\n columns: 7,\n rows: 4,\n ...bootstrapData?.settings?.launchpad,\n };\n }\n\n getDesktops(): unknown[] {\n return bootstrapData?.desktops ?? [];\n }\n\n getLaunchpadSiteMap(): unknown[] {\n return bootstrapData?.siteSort ?? [];\n }\n\n toggleLaunchpadEffect(open: boolean): void {\n document.body.classList.toggle(\"launchpad-open\", open);\n }\n\n applyPageTitle(pageTitle: string): void {\n const baseTitle = this.getBrandSettings().base_title;\n document.title = pageTitle ? `${pageTitle} - ${baseTitle}` : baseTitle;\n }\n\n getNavConfig() {\n return router?.getNavConfig();\n }\n}\n\nexport function _internalApiSetBootstrapData(data: Partial<BootstrapData>) {\n bootstrapData = data;\n}\n\nexport function getBrickPackages() {\n return bootstrapData?.brickPackages ?? [];\n}\n\nexport function _internalApiLoadBricks(bricks: string[] | Set<string>) {\n return loadBricksImperatively(bricks, getBrickPackages());\n}\n\nexport function _internalApiGetRenderId(): string | undefined {\n return router?.getRenderId();\n}\n\nexport function _internalApiMatchStoryboard(\n pathname: string\n): RuntimeStoryboard | undefined {\n return matchStoryboard(bootstrapData?.storyboards ?? [], pathname);\n}\n\nexport function _internalApiGetRuntimeContext() {\n return router?.getRuntimeContext();\n}\n\nexport function _internalApiGetStoryboardInBootstrapData(appId: string) {\n return bootstrapData?.storyboards?.find(\n (storyboard) => storyboard.app.id === appId\n );\n}\n\nexport function _internalApiGetAppInBootstrapData(appId: string) {\n return _internalApiGetStoryboardInBootstrapData(appId)?.app;\n}\n"],"mappings":";;AAMA,SAASA,IAAI,EAAEC,cAAc,QAAQ,iBAAiB;AACtD,SAASC,sBAAsB,QAAQ,mBAAmB;AAC1D,OAAOC,MAAM,MAAM,QAAQ;AAC3B,OAAO,wBAAwB;AAC/B,SAASC,aAAa,QAAQ,eAAe;AAC7C,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,MAAM,QAAQ,aAAa;AACpC,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,EAAE,EAAEC,OAAO,QAAQ,WAAW;AACvC,SAASC,uBAAuB,QAAQ,oBAAoB;AAC5D,SAASC,iBAAiB,QAAQ,cAAc;AAChD,SAASC,qBAAqB,QAAQ,oBAAoB;AAE1D,IAAIC,OAAgB;;AAEpB;AACA,IAAIC,aAAa,GAAGF,qBAAqB;AACzC,IAAIG,MAA0B;AAE9B,OAAO,SAASC,aAAaA,CAAA,EAAG;EAC9B,IAAIH,OAAO,EAAE;IACX,MAAM,IAAII,KAAK,CAAC,iCAAiC,CAAC;EACpD;EACAjB,cAAc,CAACQ,EAAE,EAAEC,OAAO,CAAC;EAC3BP,MAAM,CAACgB,MAAM,CAACnB,IAAI,CAACoB,QAAQ,CAAC;EAC5BpB,IAAI,CAACqB,EAAE,CAAC,iBAAiB,EAAE,MAAM;IAC/BlB,MAAM,CAACgB,MAAM,CAACnB,IAAI,CAACoB,QAAQ,CAAC;EAC9B,CAAC,CAAC;EACFhB,aAAa,EAAE;EACfU,OAAO,GAAG,IAAIQ,OAAO,EAAE;EACvB,OAAOR,OAAO;AAChB;AAEA,OAAO,SAASS,UAAUA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,OAAO5F,sBAAsB,CAAC4F,MAAM,EAAEL,gBAAgB,EAAE,CAAC;AAC3D;AAEA,OAAO,SAASM,uBAAuBA,CAAA,EAAuB;EAAA,IAAAC,QAAA;EAC5D,QAAAA,QAAA,GAAOhF,MAAM,cAAAgF,QAAA,uBAANA,QAAA,CAAQC,WAAW,EAAE;AAC9B;AAEA,OAAO,SAASC,2BAA2BA,CACzCC,QAAgB,EACe;EAAA,IAAAC,qBAAA,EAAAC,eAAA;EAC/B,OAAOhG,eAAe,EAAA+F,qBAAA,IAAAC,eAAA,GAACtF,aAAa,cAAAsF,eAAA,uBAAbA,eAAA,CAAexE,WAAW,cAAAuE,qBAAA,cAAAA,qBAAA,GAAI,EAAE,EAAED,QAAQ,CAAC;AACpE;AAEA,OAAO,SAASG,6BAA6BA,CAAA,EAAG;EAAA,IAAAC,QAAA;EAC9C,QAAAA,QAAA,GAAOvF,MAAM,cAAAuF,QAAA,uBAANA,QAAA,CAAQC,iBAAiB,EAAE;AACpC;AAEA,OAAO,SAASC,wCAAwCA,CAACC,KAAa,EAAE;EAAA,IAAAC,gBAAA,EAAAC,qBAAA;EACtE,QAAAD,gBAAA,GAAO5F,aAAa,cAAA4F,gBAAA,wBAAAC,qBAAA,GAAbD,gBAAA,CAAe9E,WAAW,cAAA+E,qBAAA,uBAA1BA,qBAAA,CAA4BC,IAAI,CACpCC,UAAU,IAAKA,UAAU,CAACC,GAAG,CAACC,EAAE,KAAKN,KAAK,CAC5C;AACH;AAEA,OAAO,SAASO,iCAAiCA,CAACP,KAAa,EAAE;EAAA,IAAAQ,qBAAA;EAC/D,QAAAA,qBAAA,GAAOT,wCAAwC,CAACC,KAAK,CAAC,cAAAQ,qBAAA,uBAA/CA,qBAAA,CAAiDH,GAAG;AAC7D"}
|
|
@@ -2,7 +2,7 @@ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
3
|
import { flushStableLoadBricks } from "@next-core/loader";
|
|
4
4
|
import { pick } from "lodash";
|
|
5
|
-
import { _internalApiGetRuntimeContext, _internalApiGetStoryboardInBootstrapData, _internalApiLoadBricks } from "./Runtime.js";
|
|
5
|
+
import { _internalApiGetRuntimeContext, _internalApiGetStoryboardInBootstrapData, _internalApiLoadBricks, _internalApiSetBootstrapData } from "./Runtime.js";
|
|
6
6
|
import { renderBrick } from "./Renderer.js";
|
|
7
7
|
import { RendererContext } from "./RendererContext.js";
|
|
8
8
|
import { mountTree, unmountTree } from "./mount.js";
|
|
@@ -91,7 +91,8 @@ export function unmountUseBrick(_ref2, mountResult) {
|
|
|
91
91
|
rendererContext.dispatchOnUnmount();
|
|
92
92
|
rendererContext.dispose();
|
|
93
93
|
}
|
|
94
|
-
export function initializePlayground() {
|
|
94
|
+
export function initializePlayground(data) {
|
|
95
|
+
_internalApiSetBootstrapData(data);
|
|
95
96
|
// Todo: allow configuration of notification bricks.
|
|
96
97
|
loadNotificationService("shoelace.show-notification");
|
|
97
98
|
loadDialogService("shoelace.show-dialog");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secret_internals.js","names":["flushStableLoadBricks","pick","_internalApiGetRuntimeContext","_internalApiGetStoryboardInBootstrapData","_internalApiLoadBricks","renderBrick","RendererContext","mountTree","unmountTree","RenderTag","computeRealValue","isStrictMode","warnAboutStrictMode","customTemplates","registerAppI18n","loadNotificationService","loadDialogService","renderUseBrick","_x","_x2","_renderUseBrick","apply","arguments","_asyncToGenerator","useBrick","data","_runtimeContext$tplSt","_output$node","tplStateStoreScope","runtimeContext","_objectSpread","pendingPermissionsPreCheck","tplStateStoreMap","Map","rendererContext","renderRoot","tag","ROOT","createPortal","transform","strict","output","properties","Promise","all","blockingList","map","store","waitForAll","node","portal","Error","child","tagName","type","mountUseBrick","_ref","element","portalRoot","document","querySelector","createElement","appendChild","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","unmountUseBrick","_ref2","mountResult","remove","dispatchOnUnmount","dispose","initializePlayground","legacyDoTransform","to","options","noInject","loadBricks","updateStoryboard","appId","storyboardPatch","storyboard","Object","assign","$$fulfilling","$$fulfilled","$$registerCustomTemplateProcessed","updateStoryboardByRoute","newRoute","match","getKey","route","concat","path","exact","replaceRoute","routes","key","routeKey","unshift","updateStoryboardByTemplate","newTemplate","settings","tplName","name","define","bricks","proxy","state","updateTemplatePreviewSettings","templateId","_updatePreviewSettings","brick","updateStoryboardBySnippet","snippetData","_snippetData$bricks","snippetId","length","updateSnippetPreviewSettings","previewRouteIndex","findIndex","newPreviewRoute","menu","splice"],"sources":["../../../src/internal/secret_internals.ts"],"sourcesContent":["import type {\n BrickConf,\n CustomTemplate,\n RouteConf,\n Storyboard,\n UseSingleBrickConf,\n} from \"@next-core/types\";\nimport { flushStableLoadBricks } from \"@next-core/loader\";\nimport { pick } from \"lodash\";\nimport {\n _internalApiGetRuntimeContext,\n _internalApiGetStoryboardInBootstrapData,\n _internalApiLoadBricks,\n} from \"./Runtime.js\";\nimport { renderBrick } from \"./Renderer.js\";\nimport { RendererContext } from \"./RendererContext.js\";\nimport type { DataStore } from \"./data/DataStore.js\";\nimport type { RenderRoot, RuntimeContext } from \"./interfaces.js\";\nimport { mountTree, unmountTree } from \"./mount.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { computeRealValue } from \"./compute/computeRealValue.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"../isStrictMode.js\";\nimport { customTemplates } from \"../CustomTemplates.js\";\nimport { registerAppI18n } from \"./registerAppI18n.js\";\nimport { loadNotificationService } from \"../Notification.js\";\nimport { loadDialogService } from \"../Dialog.js\";\n\nexport interface RenderUseBrickResult {\n tagName: string | null;\n renderRoot: RenderRoot;\n rendererContext: RendererContext;\n}\n\nexport async function renderUseBrick(\n useBrick: UseSingleBrickConf,\n data: unknown\n): Promise<RenderUseBrickResult> {\n const tplStateStoreScope: DataStore<\"STATE\">[] = [];\n const runtimeContext: RuntimeContext = {\n ..._internalApiGetRuntimeContext()!,\n data,\n pendingPermissionsPreCheck: [],\n tplStateStoreScope,\n };\n\n runtimeContext.tplStateStoreMap ??= new Map();\n\n const rendererContext = new RendererContext(\"fragment\");\n\n const renderRoot: RenderRoot = {\n tag: RenderTag.ROOT,\n // Will set during `mountUseBrick`\n createPortal: null!,\n };\n\n const transform = (useBrick as { transform?: Record<string, unknown> })\n .transform;\n const strict = isStrictMode();\n if (transform) {\n warnAboutStrictMode(\n strict,\n \"`useBrick.transform`\",\n 'please use \"properties\" instead, check your useBrick:',\n useBrick\n );\n }\n\n const output = await renderBrick(\n renderRoot,\n strict\n ? useBrick\n : {\n ...useBrick,\n properties: {\n ...useBrick.properties,\n ...transform,\n },\n },\n runtimeContext,\n rendererContext\n );\n\n flushStableLoadBricks();\n\n await Promise.all([\n ...output.blockingList,\n // Wait for local tpl state stores belong to current `useBrick` only.\n ...tplStateStoreScope.map((store) => store.waitForAll()),\n ...runtimeContext.pendingPermissionsPreCheck,\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 };\n}\n\nexport interface MountUseBrickResult {\n portal?: HTMLElement;\n}\n\nexport function mountUseBrick(\n { renderRoot, rendererContext }: 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\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 initializePlayground() {\n // Todo: allow configuration of notification bricks.\n loadNotificationService(\"shoelace.show-notification\");\n loadDialogService(\"shoelace.show-dialog\");\n}\n\nexport function legacyDoTransform(\n data: unknown,\n to: unknown,\n options?: unknown\n) {\n if (options) {\n throw new Error(\"Legacy doTransform does not support options in v3\");\n }\n return computeRealValue(\n to,\n {\n ..._internalApiGetRuntimeContext()!,\n data,\n },\n {\n noInject: true,\n }\n );\n}\n\nexport const loadBricks = _internalApiLoadBricks;\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 $$fulfilling: null,\n $$fulfilled: true,\n $$registerCustomTemplateProcessed: false,\n });\n registerAppI18n(storyboard);\n}\n\nexport function updateStoryboardByRoute(appId: string, newRoute: RouteConf) {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId)!;\n let match = false;\n const getKey = (route: RouteConf): string => `${route.path}.${route.exact}`;\n const replaceRoute = (routes: RouteConf[], key: string): RouteConf[] => {\n return routes.map((route) => {\n const routeKey = getKey(route);\n if (route.type === \"routes\") {\n route.routes = replaceRoute(route.routes, key);\n return route;\n } else if (routeKey === key) {\n match = true;\n return newRoute;\n } else {\n return route;\n }\n });\n };\n storyboard.routes = replaceRoute(storyboard.routes, getKey(newRoute));\n if (!match) {\n storyboard.routes.unshift(newRoute);\n }\n}\n\nexport function updateStoryboardByTemplate(\n appId: string,\n newTemplate: CustomTemplate,\n settings: unknown\n): void {\n const tplName = `${appId}.${newTemplate.name}`;\n // customTemplateRegistry.delete(tplName);\n customTemplates.define(tplName, {\n bricks: newTemplate.bricks,\n proxy: newTemplate.proxy,\n state: newTemplate.state,\n });\n updateTemplatePreviewSettings(appId, newTemplate.name, settings);\n}\n\nexport function updateTemplatePreviewSettings(\n appId: string,\n templateId: string,\n settings?: unknown\n): void {\n _updatePreviewSettings(\n appId,\n `\\${APP.homepage}/_dev_only_/template-preview/${templateId}`,\n [\n {\n brick: templateId,\n ...pick(settings, \"properties\", \"events\", \"lifeCycle\", \"context\"),\n },\n ]\n );\n}\n\nexport function updateStoryboardBySnippet(\n appId: string,\n snippetData: {\n snippetId: string;\n bricks?: BrickConf[];\n }\n): void {\n _updatePreviewSettings(\n appId,\n `\\${APP.homepage}/_dev_only_/snippet-preview/${snippetData.snippetId}`,\n snippetData.bricks?.length ? snippetData.bricks : [{ brick: \"span\" }]\n );\n}\n\nexport const updateSnippetPreviewSettings = updateStoryboardBySnippet;\n\nfunction _updatePreviewSettings(\n appId: string,\n path: string,\n bricks: BrickConf[]\n) {\n const { routes } = _internalApiGetStoryboardInBootstrapData(appId)!;\n const previewRouteIndex = routes.findIndex((route) => route.path === path);\n const newPreviewRoute: RouteConf = {\n path,\n bricks,\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"],"mappings":";;AAOA,SAASA,qBAAqB,QAAQ,mBAAmB;AACzD,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SACEC,6BAA6B,EAC7BC,wCAAwC,EACxCC,sBAAsB,QACjB,cAAc;AACrB,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,eAAe,QAAQ,sBAAsB;AAGtD,SAASC,SAAS,EAAEC,WAAW,QAAQ,YAAY;AACnD,SAASC,SAAS,QAAQ,YAAY;AACtC,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SAASC,YAAY,EAAEC,mBAAmB,QAAQ,oBAAoB;AACtE,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,uBAAuB,QAAQ,oBAAoB;AAC5D,SAASC,iBAAiB,QAAQ,cAAc;AAQhD,gBAA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QAAkB,EACZ;EACNS,sBAAsB,CACpBhC,KAAK,iDAAAa,MAAA,CAC2CkB,UAAU,GAC1D,CAAAhF,aAAA;IAEIkF,KAAK,EAAEF;EAAU,GACd7G,IAAI,CAACqG,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,CAAC,EAEpE,CACF;AACH;AAEA,OAAO,SAASW,yBAAyBA,CACvClC,KAAa,EACbmC,WAGC,EACK;EAAA,IAAAC,mBAAA;EACNJ,sBAAsB,CACpBhC,KAAK,gDAAAa,MAAA,CAC0CsB,WAAW,CAACE,SAAS,GACpE,CAAAD,mBAAA,GAAAD,WAAW,CAACR,MAAM,cAAAS,mBAAA,eAAlBA,mBAAA,CAAoBE,MAAM,GAAGH,WAAW,CAACR,MAAM,GAAG,CAAC;IAAEM,KAAK,EAAE;EAAO,CAAC,CAAC,CACtE;AACH;AAEA,OAAO,IAAMM,4BAA4B,GAAGL,yBAAyB;AAErE,SAASF,sBAAsBA,CAC7BhC,KAAa,EACbc,IAAY,EACZa,MAAmB,EACnB;EACA,IAAM;IAAEV;EAAO,CAAC,GAAG7F,wCAAwC,CAAC4E,KAAK,CAAE;EACnE,IAAMwC,iBAAiB,GAAGvB,MAAM,CAACwB,SAAS,CAAE7B,KAAK,IAAKA,KAAK,CAACE,IAAI,KAAKA,IAAI,CAAC;EAC1E,IAAM4B,eAA0B,GAAG;IACjC5B,IAAI;IACJa,MAAM;IACNgB,IAAI,EAAE,KAAK;IACX5B,KAAK,EAAE;EACT,CAAC;EACD,IAAIyB,iBAAiB,KAAK,CAAC,CAAC,EAAE;IAC5BvB,MAAM,CAACG,OAAO,CAACsB,eAAe,CAAC;EACjC,CAAC,MAAM;IACLzB,MAAM,CAAC2B,MAAM,CAACJ,iBAAiB,EAAE,CAAC,EAAEE,eAAe,CAAC;EACtD;AACF"}
|
|
1
|
+
{"version":3,"file":"secret_internals.js","names":["flushStableLoadBricks","pick","_internalApiGetRuntimeContext","_internalApiGetStoryboardInBootstrapData","_internalApiLoadBricks","_internalApiSetBootstrapData","renderBrick","RendererContext","mountTree","unmountTree","RenderTag","computeRealValue","isStrictMode","warnAboutStrictMode","customTemplates","registerAppI18n","loadNotificationService","loadDialogService","renderUseBrick","_x","_x2","_renderUseBrick","apply","arguments","_asyncToGenerator","useBrick","data","_runtimeContext$tplSt","_output$node","tplStateStoreScope","runtimeContext","_objectSpread","pendingPermissionsPreCheck","tplStateStoreMap","Map","rendererContext","renderRoot","tag","ROOT","createPortal","transform","strict","output","properties","Promise","all","blockingList","map","store","waitForAll","node","portal","Error","child","tagName","type","mountUseBrick","_ref","element","portalRoot","document","querySelector","createElement","appendChild","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","unmountUseBrick","_ref2","mountResult","remove","dispatchOnUnmount","dispose","initializePlayground","legacyDoTransform","to","options","noInject","loadBricks","updateStoryboard","appId","storyboardPatch","storyboard","Object","assign","$$fulfilling","$$fulfilled","$$registerCustomTemplateProcessed","updateStoryboardByRoute","newRoute","match","getKey","route","concat","path","exact","replaceRoute","routes","key","routeKey","unshift","updateStoryboardByTemplate","newTemplate","settings","tplName","name","define","bricks","proxy","state","updateTemplatePreviewSettings","templateId","_updatePreviewSettings","brick","updateStoryboardBySnippet","snippetData","_snippetData$bricks","snippetId","length","updateSnippetPreviewSettings","previewRouteIndex","findIndex","newPreviewRoute","menu","splice"],"sources":["../../../src/internal/secret_internals.ts"],"sourcesContent":["import type {\n BootstrapData,\n BrickConf,\n CustomTemplate,\n RouteConf,\n Storyboard,\n UseSingleBrickConf,\n} from \"@next-core/types\";\nimport { flushStableLoadBricks } from \"@next-core/loader\";\nimport { pick } from \"lodash\";\nimport {\n _internalApiGetRuntimeContext,\n _internalApiGetStoryboardInBootstrapData,\n _internalApiLoadBricks,\n _internalApiSetBootstrapData,\n} from \"./Runtime.js\";\nimport { renderBrick } from \"./Renderer.js\";\nimport { RendererContext } from \"./RendererContext.js\";\nimport type { DataStore } from \"./data/DataStore.js\";\nimport type { RenderRoot, RuntimeContext } from \"./interfaces.js\";\nimport { mountTree, unmountTree } from \"./mount.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { computeRealValue } from \"./compute/computeRealValue.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"../isStrictMode.js\";\nimport { customTemplates } from \"../CustomTemplates.js\";\nimport { registerAppI18n } from \"./registerAppI18n.js\";\nimport { loadNotificationService } from \"../Notification.js\";\nimport { loadDialogService } from \"../Dialog.js\";\n\nexport interface RenderUseBrickResult {\n tagName: string | null;\n renderRoot: RenderRoot;\n rendererContext: RendererContext;\n}\n\nexport async function renderUseBrick(\n useBrick: UseSingleBrickConf,\n data: unknown\n): Promise<RenderUseBrickResult> {\n const tplStateStoreScope: DataStore<\"STATE\">[] = [];\n const runtimeContext: RuntimeContext = {\n ..._internalApiGetRuntimeContext()!,\n data,\n pendingPermissionsPreCheck: [],\n tplStateStoreScope,\n };\n\n runtimeContext.tplStateStoreMap ??= new Map();\n\n const rendererContext = new RendererContext(\"fragment\");\n\n const renderRoot: RenderRoot = {\n tag: RenderTag.ROOT,\n // Will set during `mountUseBrick`\n createPortal: null!,\n };\n\n const transform = (useBrick as { transform?: Record<string, unknown> })\n .transform;\n const strict = isStrictMode();\n if (transform) {\n warnAboutStrictMode(\n strict,\n \"`useBrick.transform`\",\n 'please use \"properties\" instead, check your useBrick:',\n useBrick\n );\n }\n\n const output = await renderBrick(\n renderRoot,\n strict\n ? useBrick\n : {\n ...useBrick,\n properties: {\n ...useBrick.properties,\n ...transform,\n },\n },\n runtimeContext,\n rendererContext\n );\n\n flushStableLoadBricks();\n\n await Promise.all([\n ...output.blockingList,\n // Wait for local tpl state stores belong to current `useBrick` only.\n ...tplStateStoreScope.map((store) => store.waitForAll()),\n ...runtimeContext.pendingPermissionsPreCheck,\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 };\n}\n\nexport interface MountUseBrickResult {\n portal?: HTMLElement;\n}\n\nexport function mountUseBrick(\n { renderRoot, rendererContext }: 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\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 initializePlayground(data: BootstrapData) {\n _internalApiSetBootstrapData(data);\n // Todo: allow configuration of notification bricks.\n loadNotificationService(\"shoelace.show-notification\");\n loadDialogService(\"shoelace.show-dialog\");\n}\n\nexport function legacyDoTransform(\n data: unknown,\n to: unknown,\n options?: unknown\n) {\n if (options) {\n throw new Error(\"Legacy doTransform does not support options in v3\");\n }\n return computeRealValue(\n to,\n {\n ..._internalApiGetRuntimeContext()!,\n data,\n },\n {\n noInject: true,\n }\n );\n}\n\nexport const loadBricks = _internalApiLoadBricks;\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 $$fulfilling: null,\n $$fulfilled: true,\n $$registerCustomTemplateProcessed: false,\n });\n registerAppI18n(storyboard);\n}\n\nexport function updateStoryboardByRoute(appId: string, newRoute: RouteConf) {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId)!;\n let match = false;\n const getKey = (route: RouteConf): string => `${route.path}.${route.exact}`;\n const replaceRoute = (routes: RouteConf[], key: string): RouteConf[] => {\n return routes.map((route) => {\n const routeKey = getKey(route);\n if (route.type === \"routes\") {\n route.routes = replaceRoute(route.routes, key);\n return route;\n } else if (routeKey === key) {\n match = true;\n return newRoute;\n } else {\n return route;\n }\n });\n };\n storyboard.routes = replaceRoute(storyboard.routes, getKey(newRoute));\n if (!match) {\n storyboard.routes.unshift(newRoute);\n }\n}\n\nexport function updateStoryboardByTemplate(\n appId: string,\n newTemplate: CustomTemplate,\n settings: unknown\n): void {\n const tplName = `${appId}.${newTemplate.name}`;\n // customTemplateRegistry.delete(tplName);\n customTemplates.define(tplName, {\n bricks: newTemplate.bricks,\n proxy: newTemplate.proxy,\n state: newTemplate.state,\n });\n updateTemplatePreviewSettings(appId, newTemplate.name, settings);\n}\n\nexport function updateTemplatePreviewSettings(\n appId: string,\n templateId: string,\n settings?: unknown\n): void {\n _updatePreviewSettings(\n appId,\n `\\${APP.homepage}/_dev_only_/template-preview/${templateId}`,\n [\n {\n brick: templateId,\n ...pick(settings, \"properties\", \"events\", \"lifeCycle\", \"context\"),\n },\n ]\n );\n}\n\nexport function updateStoryboardBySnippet(\n appId: string,\n snippetData: {\n snippetId: string;\n bricks?: BrickConf[];\n }\n): void {\n _updatePreviewSettings(\n appId,\n `\\${APP.homepage}/_dev_only_/snippet-preview/${snippetData.snippetId}`,\n snippetData.bricks?.length ? snippetData.bricks : [{ brick: \"span\" }]\n );\n}\n\nexport const updateSnippetPreviewSettings = updateStoryboardBySnippet;\n\nfunction _updatePreviewSettings(\n appId: string,\n path: string,\n bricks: BrickConf[]\n) {\n const { routes } = _internalApiGetStoryboardInBootstrapData(appId)!;\n const previewRouteIndex = routes.findIndex((route) => route.path === path);\n const newPreviewRoute: RouteConf = {\n path,\n bricks,\n menu: false,\n exact: true,\n };\n if (previewRouteIndex === -1) {\n routes.unshift(newPreviewRoute);\n } else {\n routes.splice(previewRouteIndex, 1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Aa,EACbc,IAAY,EACZa,MAAmB,EACnB;EACA,IAAM;IAAEV;EAAO,CAAC,GAAG9F,wCAAwC,CAAC6E,KAAK,CAAE;EACnE,IAAMwC,iBAAiB,GAAGvB,MAAM,CAACwB,SAAS,CAAE7B,KAAK,IAAKA,KAAK,CAACE,IAAI,KAAKA,IAAI,CAAC;EAC1E,IAAM4B,eAA0B,GAAG;IACjC5B,IAAI;IACJa,MAAM;IACNgB,IAAI,EAAE,KAAK;IACX5B,KAAK,EAAE;EACT,CAAC;EACD,IAAIyB,iBAAiB,KAAK,CAAC,CAAC,EAAE;IAC5BvB,MAAM,CAACG,OAAO,CAACsB,eAAe,CAAC;EACjC,CAAC,MAAM;IACLzB,MAAM,CAAC2B,MAAM,CAACJ,iBAAiB,EAAE,CAAC,EAAEE,eAAe,CAAC;EACtD;AACF"}
|
|
@@ -23,7 +23,7 @@ export declare class Runtime {
|
|
|
23
23
|
breadcrumb?: import("@next-core/types").BreadcrumbItemConf[] | undefined;
|
|
24
24
|
} | undefined;
|
|
25
25
|
}
|
|
26
|
-
export declare function
|
|
26
|
+
export declare function _internalApiSetBootstrapData(data: Partial<BootstrapData>): void;
|
|
27
27
|
export declare function getBrickPackages(): import("@next-core/types").BrickPackage[];
|
|
28
28
|
export declare function _internalApiLoadBricks(bricks: string[] | Set<string>): Promise<void>;
|
|
29
29
|
export declare function _internalApiGetRenderId(): string | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BrickConf, CustomTemplate, RouteConf, Storyboard, UseSingleBrickConf } from "@next-core/types";
|
|
1
|
+
import type { BootstrapData, BrickConf, CustomTemplate, RouteConf, Storyboard, UseSingleBrickConf } from "@next-core/types";
|
|
2
2
|
import { _internalApiLoadBricks } from "./Runtime.js";
|
|
3
3
|
import { RendererContext } from "./RendererContext.js";
|
|
4
4
|
import type { RenderRoot } from "./interfaces.js";
|
|
@@ -13,7 +13,7 @@ export interface MountUseBrickResult {
|
|
|
13
13
|
}
|
|
14
14
|
export declare function mountUseBrick({ renderRoot, rendererContext }: RenderUseBrickResult, element: HTMLElement): MountUseBrickResult;
|
|
15
15
|
export declare function unmountUseBrick({ rendererContext }: RenderUseBrickResult, mountResult: MountUseBrickResult): void;
|
|
16
|
-
export declare function initializePlayground(): void;
|
|
16
|
+
export declare function initializePlayground(data: BootstrapData): void;
|
|
17
17
|
export declare function legacyDoTransform(data: unknown, to: unknown, options?: unknown): unknown;
|
|
18
18
|
export declare const loadBricks: typeof _internalApiLoadBricks;
|
|
19
19
|
export declare function updateStoryboard(appId: string, storyboardPatch: Partial<Storyboard>): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-core/runtime",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"homepage": "https://github.com/easyops-cn/next-core/tree/master/packages/runtime",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"repository": {
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"@next-core/build-next-libs": "^1.0.3",
|
|
68
68
|
"@next-core/test-next": "^1.0.4"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "81a5501a47f3bd1da0b68dd8b486a17a095bb1a2"
|
|
71
71
|
}
|