@next-core/runtime 1.33.0 → 1.33.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/CustomTemplates/constants.js +2 -1
- package/dist/cjs/internal/CustomTemplates/constants.js.map +1 -1
- package/dist/cjs/internal/CustomTemplates/expandCustomTemplate.js +2 -1
- package/dist/cjs/internal/CustomTemplates/expandCustomTemplate.js.map +1 -1
- package/dist/cjs/internal/CustomTemplates/setupTemplateProxy.js +26 -11
- package/dist/cjs/internal/CustomTemplates/setupTemplateProxy.js.map +1 -1
- package/dist/cjs/internal/Renderer.js +3 -0
- package/dist/cjs/internal/Renderer.js.map +1 -1
- package/dist/cjs/internal/Router.js +1 -1
- package/dist/cjs/internal/Router.js.map +1 -1
- package/dist/cjs/internal/interfaces.js.map +1 -1
- package/dist/esm/internal/CustomTemplates/constants.js +1 -0
- package/dist/esm/internal/CustomTemplates/constants.js.map +1 -1
- package/dist/esm/internal/CustomTemplates/expandCustomTemplate.js +2 -1
- package/dist/esm/internal/CustomTemplates/expandCustomTemplate.js.map +1 -1
- package/dist/esm/internal/CustomTemplates/setupTemplateProxy.js +30 -13
- package/dist/esm/internal/CustomTemplates/setupTemplateProxy.js.map +1 -1
- package/dist/esm/internal/Renderer.js +4 -1
- package/dist/esm/internal/Renderer.js.map +1 -1
- package/dist/esm/internal/Router.js +1 -1
- package/dist/esm/internal/Router.js.map +1 -1
- package/dist/esm/internal/interfaces.js.map +1 -1
- package/dist/types/internal/CustomTemplates/constants.d.ts +2 -0
- package/dist/types/internal/interfaces.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Router.js","names":["_history2","require","_http","_lodash","_history3","_Renderer","_DataStore","_resolveData","_mount","_matchStoryboard","_StoryboardFunctions","_RendererContext","_themeAndMode","_Runtime","_getPageInfo","_markAsComputed","_handleHttpError","_abortController","_setLoginStateCookie","_registerCustomTemplates","_fulfilStoryboard","_enums","_insertPreviewRoutes","_devtools","_setUIVersion","_setAppVariable","_setWatermark","_classPrivateFieldGet","s","a","get","_assertClassBrand","_classPrivateFieldSet","r","set","e","t","n","has","arguments","length","TypeError","_storyboards","WeakMap","_rendering","_prevLocation","_nextLocation","_runtimeContext","_rendererContext","_rendererContextTrashCan","_redirectCount","_renderId","_currentApp","_previousApp","_navConfig","_Router_brand","WeakSet","Router","constructor","storyboards","_classPrivateMethodInitSpec2","default","_classPrivateFieldInitSpec2","Set","history","getHistory","window","addEventListener","event","message","_getBlockMessageBeforePageLave","call","preventDefault","returnValue","block","location","action","getRenderId","getRuntimeContext","getRecentApps","currentApp","previousApp","getNavConfig","bootstrap","initAbortController","renderId","listen","_classPrivateFieldGet2","_location$state","_location$state2","_classPrivateFieldGet4","currentRenderId","ignoreRendering","omittedLocationProps","hash","undefined","state","key","notify","locationsAreEqual","noIncremental","_classPrivateFieldGet3","didPerformIncrementalRender","abortPendingRequest","dispatchPageLeave","storyboard","matchStoryboard","pathname","isOutsideApp","reload","devtoolsHookEmit","_queuedRender","catch","handleHttpError","exports","detail","_classPrivateFieldGet5","previousMessage","getBlockMessage","dispatchBeforePageLeave","unblock","_safeRedirect","to","from","_this$redirectCount","_this$redirectCount2","search","process","env","NODE_ENV","console","error","Error","replace","_render","nextLocation","_hooks$flowApi","_hooks$pageView","_classPrivateFieldGet6","_storyboard$app","uniqueId","resetAllComputedMarks","clearResolveCache","hooks","flowApi","clearCollectWidgetContract","finishPageView","pageView","create","app","currentAppId","id","BOOTSTRAP_UNION_FILE","setAppVariable","appId","version","currentVersion","setWatermark","fulfilStoryboard","appChanged","flags","getRuntime","getFeatureFlags","prevRendererContext","redirectTo","status","add","redirectToLogin","setLoginStateCookie","main","document","querySelector","portal","renderRoot","tag","RenderTag","ROOT","container","createPortal","cleanUpPreviousRender","_hooks$messageDispatc","unmountTree","item","dispatchOnUnmount","dispose","clear","messageDispatcher","reset","dispatchEvent","CustomEvent","setTheme","getLocalAppsTheme","theme","setMode","_hooks$checkInstalled","_hooks$auth","_hooks$checkPermissio","_storyboard$meta","_hooks$flowApi2","_storyboard$meta2","checkInstalledApps","preCheckInstalledApps","_internalApiGetAppInBootstrapData","routeHelper","bailout","output","unauthenticated","redirect","path","mergeMenus","menuRequests","menuConfs","Promise","all","mergeMenuConfs","returnNode","isUnauthenticatedError","NO_AUTH_GUARD","HttpAbortError","noAuthGuardLoginPath","getMiscSettings","failed","node","BRICK","type","properties","textContent","httpErrorToString","runtimeContext","return","blockingList","rendererContext","RendererContext","query","URLSearchParams","sys","auth","getAuth","getPageInfo","settings","brand","getBrandSettings","ctxStore","DataStore","pendingPermissionsPreCheck","checkPermissions","preCheckPermissions","tplStateStoreMap","Map","formStateStoreMap","registerCustomTemplates","registerStoryboardFunctions","meta","functions","collectContract","contracts","stores","renderRoutes","insertPreviewRoutes","routes","getDataStores","postAsyncRender","setInitialMenuRequests","result","child","route","dispatchBeforePageLoad","applyTheme","applyMode","setUIVersion","uiVersion","mountTree","scrollTo","dispatchPageLoad","dispatchAnchorLoad","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","initializeMessageDispatcher","store","mountAsyncData","pageTitle","title","isLoggedIn","navConfig","breadcrumb","menuConf","overwrite","items","push"],"sources":["../../../src/internal/Router.ts"],"sourcesContent":["import { Action, locationsAreEqual } from \"history\";\nimport type {\n BreadcrumbItemConf,\n MicroApp,\n StaticMenuConf,\n Storyboard,\n} from \"@next-core/types\";\nimport { HttpAbortError } from \"@next-core/http\";\nimport { uniqueId } from \"lodash\";\nimport { NextHistoryState, NextLocation, getHistory } from \"../history.js\";\nimport {\n RenderOutput,\n getDataStores,\n postAsyncRender,\n renderRoutes,\n} from \"./Renderer.js\";\nimport { DataStore } from \"./data/DataStore.js\";\nimport { clearResolveCache } from \"./data/resolveData.js\";\nimport { mountTree, unmountTree } from \"./mount.js\";\nimport { isOutsideApp, matchStoryboard } from \"./matchStoryboard.js\";\nimport { registerStoryboardFunctions } from \"./compute/StoryboardFunctions.js\";\nimport { RendererContext, RouteHelper } from \"./RendererContext.js\";\nimport {\n applyMode,\n applyTheme,\n getLocalAppsTheme,\n setMode,\n setTheme,\n} from \"../themeAndMode.js\";\nimport {\n _internalApiGetAppInBootstrapData,\n getRuntime,\n hooks,\n} from \"./Runtime.js\";\nimport { getPageInfo } from \"../getPageInfo.js\";\nimport type { RenderBrick, RenderRoot, RuntimeContext } from \"./interfaces.js\";\nimport { resetAllComputedMarks } from \"./compute/markAsComputed.js\";\nimport {\n handleHttpError,\n httpErrorToString,\n isUnauthenticatedError,\n} from \"../handleHttpError.js\";\nimport { abortPendingRequest, initAbortController } from \"./abortController.js\";\nimport { setLoginStateCookie } from \"../setLoginStateCookie.js\";\nimport { registerCustomTemplates } from \"./registerCustomTemplates.js\";\nimport { fulfilStoryboard } from \"./fulfilStoryboard.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { insertPreviewRoutes } from \"./insertPreviewRoutes.js\";\nimport { devtoolsHookEmit } from \"./devtools.js\";\nimport { setUIVersion } from \"../setUIVersion.js\";\nimport { setAppVariable } from \"../setAppVariable.js\";\nimport { setWatermark } from \"../setWatermark.js\";\n\nexport class Router {\n readonly #storyboards: Storyboard[];\n #rendering = false;\n #prevLocation!: NextLocation;\n #nextLocation?: NextLocation;\n #runtimeContext?: RuntimeContext;\n #rendererContext?: RendererContext;\n #rendererContextTrashCan = new Set<RendererContext | undefined>();\n #redirectCount = 0;\n #renderId?: string;\n #currentApp?: MicroApp;\n #previousApp?: MicroApp;\n #navConfig?: {\n breadcrumb?: BreadcrumbItemConf[];\n };\n\n constructor(storyboards: Storyboard[]) {\n this.#storyboards = storyboards;\n\n const history = getHistory();\n window.addEventListener(\"beforeunload\", (event) => {\n const message = this.#getBlockMessageBeforePageLave({});\n // See examples in https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload\n if (message) {\n // Cancel the event\n // If you prevent default behavior in Mozilla Firefox prompt will always be shown\n event.preventDefault();\n // Chrome requires returnValue to be set\n event.returnValue = \"\";\n } else {\n // the absence of a returnValue property on the event will guarantee the browser unload happens\n delete event.returnValue;\n }\n });\n\n history.block((location, action) =>\n this.#getBlockMessageBeforePageLave({ location, action })\n );\n }\n\n getRenderId() {\n return this.#renderId;\n }\n\n getRuntimeContext() {\n return this.#runtimeContext;\n }\n\n getRecentApps() {\n return {\n currentApp: this.#currentApp,\n previousApp: this.#previousApp,\n };\n }\n\n getNavConfig() {\n return this.#navConfig;\n }\n\n #getBlockMessageBeforePageLave(detail: {\n location?: NextLocation;\n action?: Action;\n }): string | undefined {\n const history = getHistory();\n const previousMessage = history.getBlockMessage();\n this.#rendererContext?.dispatchBeforePageLeave(detail);\n const message = history.getBlockMessage();\n if (!previousMessage && message) {\n // Auto unblock only if new block was introduced by `onBeforePageLeave`.\n history.unblock();\n }\n return message;\n }\n\n #safeRedirect(\n to: string,\n state: NextHistoryState | undefined,\n from: NextLocation\n ): void {\n if (this.#redirectCount++ > 10) {\n const message = `Infinite redirect detected: from \"${from.pathname}${from.search}${from.hash}\" to \"${to}\"`;\n // istanbul ignore else: error cannot be caught in test\n if (process.env.NODE_ENV === \"test\") {\n // eslint-disable-next-line no-console\n console.error(message);\n return;\n } else {\n throw new Error(message);\n }\n }\n getHistory().replace(to, state);\n }\n\n bootstrap() {\n initAbortController();\n const history = getHistory();\n this.#prevLocation = history.location;\n let renderId = 0;\n history.listen(async (location, action) => {\n const currentRenderId = ++renderId;\n let ignoreRendering: boolean | undefined;\n const omittedLocationProps: Partial<NextLocation> = {\n hash: undefined,\n state: undefined,\n };\n // Omit the \"key\" when checking whether locations are equal in certain situations.\n if (\n // When current location is triggered by browser action of hash link.\n location.key === undefined ||\n // When current location is triggered by browser action of non-push-or-replace,\n // such as goBack or goForward,\n (action === \"POP\" &&\n // and the previous location was triggered by hash link,\n (this.#prevLocation.key === undefined ||\n // or the previous location specified notify false.\n this.#prevLocation.state?.notify === false))\n ) {\n omittedLocationProps.key = undefined;\n }\n if (\n locationsAreEqual(\n { ...this.#prevLocation, ...omittedLocationProps },\n { ...location, ...omittedLocationProps }\n ) ||\n (action !== \"POP\" && location.state?.notify === false)\n ) {\n // Ignore rendering if location not changed except hash, state and optional key.\n // Ignore rendering if notify is `false`.\n ignoreRendering = true;\n }\n\n if (!ignoreRendering && !location.state?.noIncremental) {\n ignoreRendering =\n await this.#rendererContext?.didPerformIncrementalRender(\n location,\n this.#prevLocation\n );\n }\n\n // Ignore stale renders\n if (renderId !== currentRenderId) {\n return;\n }\n\n if (ignoreRendering) {\n this.#prevLocation = location;\n return;\n }\n\n abortPendingRequest();\n this.#prevLocation = location;\n this.#rendererContext?.dispatchPageLeave();\n\n if (action === \"POP\") {\n const storyboard = matchStoryboard(\n this.#storyboards,\n location.pathname\n );\n // When a browser action of goBack or goForward is performing,\n // force reload when the target page is a page of an outside app.\n if (isOutsideApp(storyboard)) {\n window.location.reload();\n return;\n }\n }\n\n if (this.#rendering) {\n this.#nextLocation = location;\n } else {\n devtoolsHookEmit(\"locationChange\");\n this.#queuedRender(location).catch(handleHttpError);\n }\n });\n return this.#queuedRender(history.location);\n }\n\n async #queuedRender(location: NextLocation): Promise<void> {\n this.#rendering = true;\n try {\n await this.#render(location);\n } finally {\n this.#rendering = false;\n if (this.#nextLocation) {\n const nextLocation = this.#nextLocation;\n this.#nextLocation = undefined;\n await this.#queuedRender(nextLocation);\n }\n }\n }\n\n async #render(location: NextLocation): Promise<void> {\n const renderId = (this.#renderId = uniqueId(\"render-id-\"));\n\n resetAllComputedMarks();\n clearResolveCache();\n hooks?.flowApi?.clearCollectWidgetContract();\n\n const history = getHistory();\n history.unblock();\n\n // const renderStartTime = performance.now();\n const finishPageView = hooks?.pageView?.create();\n\n const storyboard = matchStoryboard(this.#storyboards, location.pathname);\n\n const previousApp = this.#runtimeContext?.app;\n const currentAppId = storyboard?.app?.id;\n // dynamically change the value of the APP variable, if it's union app\n if (\n window.BOOTSTRAP_UNION_FILE &&\n currentAppId &&\n currentAppId !== previousApp?.id\n ) {\n setAppVariable({\n appId: currentAppId,\n version: storyboard.app.currentVersion!,\n });\n }\n\n setWatermark();\n\n if (storyboard?.app) {\n await fulfilStoryboard(storyboard);\n }\n\n const currentApp = (this.#currentApp = storyboard?.app);\n\n // Storyboard maybe re-assigned, e.g. when open launchpad.\n const appChanged =\n previousApp && currentApp\n ? previousApp.id !== currentApp.id\n : previousApp !== currentApp;\n\n // TODO: handle favicon\n\n // Set `Router::#currentApp` before calling `getFeatureFlags()`\n const flags = getRuntime().getFeatureFlags();\n const prevRendererContext = this.#rendererContext;\n\n const redirectTo = (to: string, state?: NextHistoryState): void => {\n finishPageView?.({\n status: \"redirected\",\n });\n this.#rendererContextTrashCan.add(prevRendererContext);\n this.#safeRedirect(to, state, location);\n };\n\n const redirectToLogin = (): void => {\n const to = flags[\"sso-enabled\"] ? \"/sso-auth/login\" : \"/auth/login\";\n setLoginStateCookie(location);\n redirectTo(to, { from: location });\n };\n\n const main = document.querySelector(\"#main-mount-point\") as HTMLElement;\n const portal = document.querySelector(\"#portal-mount-point\") as HTMLElement;\n\n const renderRoot: RenderRoot = {\n tag: RenderTag.ROOT,\n container: main,\n createPortal: portal,\n };\n\n const cleanUpPreviousRender = (): void => {\n unmountTree(main);\n unmountTree(portal);\n\n // Note: redirects can lead to multiple trash renderer contexts.\n this.#rendererContextTrashCan.add(prevRendererContext);\n for (const item of this.#rendererContextTrashCan) {\n if (item) {\n item.dispatchOnUnmount();\n item.dispose();\n }\n }\n this.#rendererContextTrashCan.clear();\n hooks?.messageDispatcher?.reset();\n\n if (appChanged) {\n this.#previousApp = previousApp;\n window.dispatchEvent(\n new CustomEvent(\"app.change\", {\n detail: {\n previousApp,\n currentApp,\n },\n })\n );\n }\n };\n\n setTheme(\n (currentApp &&\n (getLocalAppsTheme()[currentApp.id] || currentApp.theme)) ||\n \"light\"\n );\n setMode(\"default\");\n\n if (currentApp) {\n hooks?.checkInstalledApps?.preCheckInstalledApps(\n storyboard,\n (appId) => !!_internalApiGetAppInBootstrapData(appId)\n );\n\n const routeHelper: RouteHelper = {\n bailout: (output) => {\n if (output.unauthenticated) {\n redirectToLogin();\n return true;\n }\n if (output.redirect) {\n redirectTo(output.redirect.path, output.redirect.state);\n return true;\n }\n // Reset redirect count if no redirect is set.\n this.#redirectCount = 0;\n },\n mergeMenus: async (menuRequests) => {\n const menuConfs = await Promise.all(menuRequests);\n this.#navConfig = mergeMenuConfs(menuConfs);\n },\n catch: (error, returnNode) => {\n if (isUnauthenticatedError(error) && !window.NO_AUTH_GUARD) {\n redirectToLogin();\n return;\n } else if (error instanceof HttpAbortError) {\n this.#rendererContextTrashCan.add(prevRendererContext);\n return;\n } else {\n const noAuthGuardLoginPath =\n getRuntime().getMiscSettings().noAuthGuardLoginPath;\n if (isUnauthenticatedError(error) && noAuthGuardLoginPath) {\n redirectTo(noAuthGuardLoginPath as string, { from: location });\n return;\n }\n return {\n failed: true,\n output: {\n node: {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: httpErrorToString(error),\n },\n runtimeContext: null!,\n return: returnNode,\n },\n blockingList: [],\n menuRequests: [],\n },\n };\n }\n },\n };\n\n const rendererContext = (this.#rendererContext = new RendererContext(\n \"page\",\n { routeHelper, renderId }\n ));\n\n const runtimeContext: RuntimeContext = (this.#runtimeContext = {\n app: currentApp,\n location,\n query: new URLSearchParams(location.search),\n flags,\n sys: {\n ...hooks?.auth?.getAuth(),\n ...getPageInfo(),\n settings: {\n brand: getRuntime().getBrandSettings(),\n },\n },\n ctxStore: new DataStore(\"CTX\", undefined, rendererContext),\n pendingPermissionsPreCheck: [\n hooks?.checkPermissions?.preCheckPermissions(storyboard),\n ],\n tplStateStoreMap: new Map<string, DataStore<\"STATE\">>(),\n formStateStoreMap: new Map<string, DataStore<\"FORM_STATE\">>(),\n });\n\n this.#navConfig = undefined;\n\n registerCustomTemplates(storyboard);\n registerStoryboardFunctions(storyboard.meta?.functions, currentApp);\n hooks?.flowApi?.collectContract(storyboard.meta?.contracts);\n\n let failed = false;\n let output: RenderOutput;\n let stores: DataStore<\"CTX\" | \"STATE\" | \"FORM_STATE\">[] = [];\n\n try {\n output = await renderRoutes(\n renderRoot,\n insertPreviewRoutes(storyboard.routes),\n runtimeContext,\n rendererContext,\n []\n );\n if (routeHelper.bailout(output)) {\n return;\n }\n\n stores = getDataStores(runtimeContext);\n\n await postAsyncRender(output, runtimeContext, stores);\n\n await routeHelper.mergeMenus(output.menuRequests);\n rendererContext.setInitialMenuRequests(output.menuRequests);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Router failed:\", error);\n\n const result = routeHelper.catch(error, renderRoot);\n if (!result) {\n return;\n }\n ({ failed, output } = result);\n }\n renderRoot.child = output.node;\n\n cleanUpPreviousRender();\n\n if ((output.route && output.route.type !== \"routes\") || failed) {\n if (!failed) {\n // There is a window to set theme and mode by `lifeCycle.onBeforePageLoad`.\n rendererContext.dispatchBeforePageLoad();\n }\n applyTheme();\n applyMode();\n\n setUIVersion(currentApp?.uiVersion);\n mountTree(renderRoot);\n\n // Scroll to top after each rendering.\n // See https://github.com/ReactTraining/react-router/blob/master/packages/react-router-dom/docs/guides/scroll-restoration.md\n window.scrollTo(0, 0);\n\n if (!failed) {\n rendererContext.dispatchPageLoad();\n rendererContext.dispatchAnchorLoad();\n rendererContext.dispatchOnMount();\n rendererContext.initializeScrollIntoView();\n rendererContext.initializeMediaChange();\n rendererContext.initializeMessageDispatcher();\n\n for (const store of stores) {\n store.mountAsyncData();\n }\n\n finishPageView?.({\n status: \"ok\",\n path: output.path,\n pageTitle: document.title,\n });\n } else {\n finishPageView?.({ status: \"failed\" });\n }\n devtoolsHookEmit(\"rendered\");\n\n return;\n }\n } else if (\n !window.NO_AUTH_GUARD &&\n hooks?.auth &&\n !hooks.auth.isLoggedIn()\n ) {\n // Todo(steve): refine after api-gateway supports fetching storyboards before logged in.\n // Redirect to login if no storyboard is matched.\n redirectToLogin();\n return;\n } else {\n cleanUpPreviousRender();\n }\n\n applyTheme();\n applyMode();\n\n const node: RenderBrick = {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: \"Page not found\",\n },\n runtimeContext: null!,\n return: renderRoot,\n };\n renderRoot.child = node;\n\n mountTree(renderRoot);\n\n // Scroll to top after each rendering.\n window.scrollTo(0, 0);\n finishPageView?.({ status: \"not-found\" });\n devtoolsHookEmit(\"rendered\");\n }\n}\n\nfunction mergeMenuConfs(menuConfs: StaticMenuConf[]) {\n const navConfig = {\n breadcrumb: [] as BreadcrumbItemConf[],\n };\n for (const menuConf of menuConfs) {\n const { breadcrumb } = menuConf;\n if (breadcrumb) {\n if (breadcrumb.overwrite) {\n navConfig.breadcrumb = breadcrumb.items;\n } else {\n navConfig.breadcrumb.push(...breadcrumb.items);\n }\n }\n }\n return navConfig;\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAMA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,gBAAA,GAAAR,OAAA;AACA,IAAAS,oBAAA,GAAAT,OAAA;AACA,IAAAU,gBAAA,GAAAV,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;AAOA,IAAAY,QAAA,GAAAZ,OAAA;AAKA,IAAAa,YAAA,GAAAb,OAAA;AAEA,IAAAc,eAAA,GAAAd,OAAA;AACA,IAAAe,gBAAA,GAAAf,OAAA;AAKA,IAAAgB,gBAAA,GAAAhB,OAAA;AACA,IAAAiB,oBAAA,GAAAjB,OAAA;AACA,IAAAkB,wBAAA,GAAAlB,OAAA;AACA,IAAAmB,iBAAA,GAAAnB,OAAA;AACA,IAAAoB,MAAA,GAAApB,OAAA;AACA,IAAAqB,oBAAA,G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ACnD,MAAMyE,SAAS,GAAG;IAChBC,UAAU,EAAE;EACd,CAAC;EACD,KAAK,MAAMC,QAAQ,IAAI3E,SAAS,EAAE;IAChC,MAAM;MAAE0E;IAAW,CAAC,GAAGC,QAAQ;IAC/B,IAAID,UAAU,EAAE;MACd,IAAIA,UAAU,CAACE,SAAS,EAAE;QACxBH,SAAS,CAACC,UAAU,GAAGA,UAAU,CAACG,KAAK;MACzC,CAAC,MAAM;QACLJ,SAAS,CAACC,UAAU,CAACI,IAAI,CAAC,GAAGJ,UAAU,CAACG,KAAK,CAAC;MAChD;IACF;EACF;EACA,OAAOJ,SAAS;AAClB"}
|
|
1
|
+
{"version":3,"file":"Router.js","names":["_history2","require","_http","_lodash","_history3","_Renderer","_DataStore","_resolveData","_mount","_matchStoryboard","_StoryboardFunctions","_RendererContext","_themeAndMode","_Runtime","_getPageInfo","_markAsComputed","_handleHttpError","_abortController","_setLoginStateCookie","_registerCustomTemplates","_fulfilStoryboard","_enums","_insertPreviewRoutes","_devtools","_setUIVersion","_setAppVariable","_setWatermark","_classPrivateFieldGet","s","a","get","_assertClassBrand","_classPrivateFieldSet","r","set","e","t","n","has","arguments","length","TypeError","_storyboards","WeakMap","_rendering","_prevLocation","_nextLocation","_runtimeContext","_rendererContext","_rendererContextTrashCan","_redirectCount","_renderId","_currentApp","_previousApp","_navConfig","_Router_brand","WeakSet","Router","constructor","storyboards","_classPrivateMethodInitSpec2","default","_classPrivateFieldInitSpec2","Set","history","getHistory","window","addEventListener","event","message","_getBlockMessageBeforePageLave","call","preventDefault","returnValue","block","location","action","getRenderId","getRuntimeContext","getRecentApps","currentApp","previousApp","getNavConfig","bootstrap","initAbortController","renderId","listen","_classPrivateFieldGet2","_location$state","_location$state2","_classPrivateFieldGet4","currentRenderId","ignoreRendering","omittedLocationProps","hash","undefined","state","key","notify","locationsAreEqual","noIncremental","_classPrivateFieldGet3","didPerformIncrementalRender","abortPendingRequest","dispatchPageLeave","storyboard","matchStoryboard","pathname","isOutsideApp","reload","devtoolsHookEmit","_queuedRender","catch","handleHttpError","exports","detail","_classPrivateFieldGet5","previousMessage","getBlockMessage","dispatchBeforePageLeave","unblock","_safeRedirect","to","from","_this$redirectCount","_this$redirectCount2","search","process","env","NODE_ENV","console","error","Error","replace","_render","nextLocation","_hooks$flowApi","_hooks$pageView","_classPrivateFieldGet6","_storyboard$app","uniqueId","resetAllComputedMarks","clearResolveCache","hooks","flowApi","clearCollectWidgetContract","finishPageView","pageView","create","app","currentAppId","id","BOOTSTRAP_UNION_FILE","setAppVariable","appId","version","currentVersion","fulfilStoryboard","setWatermark","appChanged","flags","getRuntime","getFeatureFlags","prevRendererContext","redirectTo","status","add","redirectToLogin","setLoginStateCookie","main","document","querySelector","portal","renderRoot","tag","RenderTag","ROOT","container","createPortal","cleanUpPreviousRender","_hooks$messageDispatc","unmountTree","item","dispatchOnUnmount","dispose","clear","messageDispatcher","reset","dispatchEvent","CustomEvent","setTheme","getLocalAppsTheme","theme","setMode","_hooks$checkInstalled","_hooks$auth","_hooks$checkPermissio","_storyboard$meta","_hooks$flowApi2","_storyboard$meta2","checkInstalledApps","preCheckInstalledApps","_internalApiGetAppInBootstrapData","routeHelper","bailout","output","unauthenticated","redirect","path","mergeMenus","menuRequests","menuConfs","Promise","all","mergeMenuConfs","returnNode","isUnauthenticatedError","NO_AUTH_GUARD","HttpAbortError","noAuthGuardLoginPath","getMiscSettings","failed","node","BRICK","type","properties","textContent","httpErrorToString","runtimeContext","return","blockingList","rendererContext","RendererContext","query","URLSearchParams","sys","auth","getAuth","getPageInfo","settings","brand","getBrandSettings","ctxStore","DataStore","pendingPermissionsPreCheck","checkPermissions","preCheckPermissions","tplStateStoreMap","Map","formStateStoreMap","registerCustomTemplates","registerStoryboardFunctions","meta","functions","collectContract","contracts","stores","renderRoutes","insertPreviewRoutes","routes","getDataStores","postAsyncRender","setInitialMenuRequests","result","child","route","dispatchBeforePageLoad","applyTheme","applyMode","setUIVersion","uiVersion","mountTree","scrollTo","dispatchPageLoad","dispatchAnchorLoad","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","initializeMessageDispatcher","store","mountAsyncData","pageTitle","title","isLoggedIn","navConfig","breadcrumb","menuConf","overwrite","items","push"],"sources":["../../../src/internal/Router.ts"],"sourcesContent":["import { Action, locationsAreEqual } from \"history\";\nimport type {\n BreadcrumbItemConf,\n MicroApp,\n StaticMenuConf,\n Storyboard,\n} from \"@next-core/types\";\nimport { HttpAbortError } from \"@next-core/http\";\nimport { uniqueId } from \"lodash\";\nimport { NextHistoryState, NextLocation, getHistory } from \"../history.js\";\nimport {\n RenderOutput,\n getDataStores,\n postAsyncRender,\n renderRoutes,\n} from \"./Renderer.js\";\nimport { DataStore } from \"./data/DataStore.js\";\nimport { clearResolveCache } from \"./data/resolveData.js\";\nimport { mountTree, unmountTree } from \"./mount.js\";\nimport { isOutsideApp, matchStoryboard } from \"./matchStoryboard.js\";\nimport { registerStoryboardFunctions } from \"./compute/StoryboardFunctions.js\";\nimport { RendererContext, RouteHelper } from \"./RendererContext.js\";\nimport {\n applyMode,\n applyTheme,\n getLocalAppsTheme,\n setMode,\n setTheme,\n} from \"../themeAndMode.js\";\nimport {\n _internalApiGetAppInBootstrapData,\n getRuntime,\n hooks,\n} from \"./Runtime.js\";\nimport { getPageInfo } from \"../getPageInfo.js\";\nimport type { RenderBrick, RenderRoot, RuntimeContext } from \"./interfaces.js\";\nimport { resetAllComputedMarks } from \"./compute/markAsComputed.js\";\nimport {\n handleHttpError,\n httpErrorToString,\n isUnauthenticatedError,\n} from \"../handleHttpError.js\";\nimport { abortPendingRequest, initAbortController } from \"./abortController.js\";\nimport { setLoginStateCookie } from \"../setLoginStateCookie.js\";\nimport { registerCustomTemplates } from \"./registerCustomTemplates.js\";\nimport { fulfilStoryboard } from \"./fulfilStoryboard.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { insertPreviewRoutes } from \"./insertPreviewRoutes.js\";\nimport { devtoolsHookEmit } from \"./devtools.js\";\nimport { setUIVersion } from \"../setUIVersion.js\";\nimport { setAppVariable } from \"../setAppVariable.js\";\nimport { setWatermark } from \"../setWatermark.js\";\n\nexport class Router {\n readonly #storyboards: Storyboard[];\n #rendering = false;\n #prevLocation!: NextLocation;\n #nextLocation?: NextLocation;\n #runtimeContext?: RuntimeContext;\n #rendererContext?: RendererContext;\n #rendererContextTrashCan = new Set<RendererContext | undefined>();\n #redirectCount = 0;\n #renderId?: string;\n #currentApp?: MicroApp;\n #previousApp?: MicroApp;\n #navConfig?: {\n breadcrumb?: BreadcrumbItemConf[];\n };\n\n constructor(storyboards: Storyboard[]) {\n this.#storyboards = storyboards;\n\n const history = getHistory();\n window.addEventListener(\"beforeunload\", (event) => {\n const message = this.#getBlockMessageBeforePageLave({});\n // See examples in https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload\n if (message) {\n // Cancel the event\n // If you prevent default behavior in Mozilla Firefox prompt will always be shown\n event.preventDefault();\n // Chrome requires returnValue to be set\n event.returnValue = \"\";\n } else {\n // the absence of a returnValue property on the event will guarantee the browser unload happens\n delete event.returnValue;\n }\n });\n\n history.block((location, action) =>\n this.#getBlockMessageBeforePageLave({ location, action })\n );\n }\n\n getRenderId() {\n return this.#renderId;\n }\n\n getRuntimeContext() {\n return this.#runtimeContext;\n }\n\n getRecentApps() {\n return {\n currentApp: this.#currentApp,\n previousApp: this.#previousApp,\n };\n }\n\n getNavConfig() {\n return this.#navConfig;\n }\n\n #getBlockMessageBeforePageLave(detail: {\n location?: NextLocation;\n action?: Action;\n }): string | undefined {\n const history = getHistory();\n const previousMessage = history.getBlockMessage();\n this.#rendererContext?.dispatchBeforePageLeave(detail);\n const message = history.getBlockMessage();\n if (!previousMessage && message) {\n // Auto unblock only if new block was introduced by `onBeforePageLeave`.\n history.unblock();\n }\n return message;\n }\n\n #safeRedirect(\n to: string,\n state: NextHistoryState | undefined,\n from: NextLocation\n ): void {\n if (this.#redirectCount++ > 10) {\n const message = `Infinite redirect detected: from \"${from.pathname}${from.search}${from.hash}\" to \"${to}\"`;\n // istanbul ignore else: error cannot be caught in test\n if (process.env.NODE_ENV === \"test\") {\n // eslint-disable-next-line no-console\n console.error(message);\n return;\n } else {\n throw new Error(message);\n }\n }\n getHistory().replace(to, state);\n }\n\n bootstrap() {\n initAbortController();\n const history = getHistory();\n this.#prevLocation = history.location;\n let renderId = 0;\n history.listen(async (location, action) => {\n const currentRenderId = ++renderId;\n let ignoreRendering: boolean | undefined;\n const omittedLocationProps: Partial<NextLocation> = {\n hash: undefined,\n state: undefined,\n };\n // Omit the \"key\" when checking whether locations are equal in certain situations.\n if (\n // When current location is triggered by browser action of hash link.\n location.key === undefined ||\n // When current location is triggered by browser action of non-push-or-replace,\n // such as goBack or goForward,\n (action === \"POP\" &&\n // and the previous location was triggered by hash link,\n (this.#prevLocation.key === undefined ||\n // or the previous location specified notify false.\n this.#prevLocation.state?.notify === false))\n ) {\n omittedLocationProps.key = undefined;\n }\n if (\n locationsAreEqual(\n { ...this.#prevLocation, ...omittedLocationProps },\n { ...location, ...omittedLocationProps }\n ) ||\n (action !== \"POP\" && location.state?.notify === false)\n ) {\n // Ignore rendering if location not changed except hash, state and optional key.\n // Ignore rendering if notify is `false`.\n ignoreRendering = true;\n }\n\n if (!ignoreRendering && !location.state?.noIncremental) {\n ignoreRendering =\n await this.#rendererContext?.didPerformIncrementalRender(\n location,\n this.#prevLocation\n );\n }\n\n // Ignore stale renders\n if (renderId !== currentRenderId) {\n return;\n }\n\n if (ignoreRendering) {\n this.#prevLocation = location;\n return;\n }\n\n abortPendingRequest();\n this.#prevLocation = location;\n this.#rendererContext?.dispatchPageLeave();\n\n if (action === \"POP\") {\n const storyboard = matchStoryboard(\n this.#storyboards,\n location.pathname\n );\n // When a browser action of goBack or goForward is performing,\n // force reload when the target page is a page of an outside app.\n if (isOutsideApp(storyboard)) {\n window.location.reload();\n return;\n }\n }\n\n if (this.#rendering) {\n this.#nextLocation = location;\n } else {\n devtoolsHookEmit(\"locationChange\");\n this.#queuedRender(location).catch(handleHttpError);\n }\n });\n return this.#queuedRender(history.location);\n }\n\n async #queuedRender(location: NextLocation): Promise<void> {\n this.#rendering = true;\n try {\n await this.#render(location);\n } finally {\n this.#rendering = false;\n if (this.#nextLocation) {\n const nextLocation = this.#nextLocation;\n this.#nextLocation = undefined;\n await this.#queuedRender(nextLocation);\n }\n }\n }\n\n async #render(location: NextLocation): Promise<void> {\n const renderId = (this.#renderId = uniqueId(\"render-id-\"));\n\n resetAllComputedMarks();\n clearResolveCache();\n hooks?.flowApi?.clearCollectWidgetContract();\n\n const history = getHistory();\n history.unblock();\n\n // const renderStartTime = performance.now();\n const finishPageView = hooks?.pageView?.create();\n\n const storyboard = matchStoryboard(this.#storyboards, location.pathname);\n\n const previousApp = this.#runtimeContext?.app;\n const currentAppId = storyboard?.app?.id;\n // dynamically change the value of the APP variable, if it's union app\n if (\n window.BOOTSTRAP_UNION_FILE &&\n currentAppId &&\n currentAppId !== previousApp?.id\n ) {\n setAppVariable({\n appId: currentAppId,\n version: storyboard.app.currentVersion!,\n });\n }\n\n if (storyboard?.app) {\n await fulfilStoryboard(storyboard);\n }\n\n const currentApp = (this.#currentApp = storyboard?.app);\n\n setWatermark();\n\n // Storyboard maybe re-assigned, e.g. when open launchpad.\n const appChanged =\n previousApp && currentApp\n ? previousApp.id !== currentApp.id\n : previousApp !== currentApp;\n\n // TODO: handle favicon\n\n // Set `Router::#currentApp` before calling `getFeatureFlags()`\n const flags = getRuntime().getFeatureFlags();\n const prevRendererContext = this.#rendererContext;\n\n const redirectTo = (to: string, state?: NextHistoryState): void => {\n finishPageView?.({\n status: \"redirected\",\n });\n this.#rendererContextTrashCan.add(prevRendererContext);\n this.#safeRedirect(to, state, location);\n };\n\n const redirectToLogin = (): void => {\n const to = flags[\"sso-enabled\"] ? \"/sso-auth/login\" : \"/auth/login\";\n setLoginStateCookie(location);\n redirectTo(to, { from: location });\n };\n\n const main = document.querySelector(\"#main-mount-point\") as HTMLElement;\n const portal = document.querySelector(\"#portal-mount-point\") as HTMLElement;\n\n const renderRoot: RenderRoot = {\n tag: RenderTag.ROOT,\n container: main,\n createPortal: portal,\n };\n\n const cleanUpPreviousRender = (): void => {\n unmountTree(main);\n unmountTree(portal);\n\n // Note: redirects can lead to multiple trash renderer contexts.\n this.#rendererContextTrashCan.add(prevRendererContext);\n for (const item of this.#rendererContextTrashCan) {\n if (item) {\n item.dispatchOnUnmount();\n item.dispose();\n }\n }\n this.#rendererContextTrashCan.clear();\n hooks?.messageDispatcher?.reset();\n\n if (appChanged) {\n this.#previousApp = previousApp;\n window.dispatchEvent(\n new CustomEvent(\"app.change\", {\n detail: {\n previousApp,\n currentApp,\n },\n })\n );\n }\n };\n\n setTheme(\n (currentApp &&\n (getLocalAppsTheme()[currentApp.id] || currentApp.theme)) ||\n \"light\"\n );\n setMode(\"default\");\n\n if (currentApp) {\n hooks?.checkInstalledApps?.preCheckInstalledApps(\n storyboard,\n (appId) => !!_internalApiGetAppInBootstrapData(appId)\n );\n\n const routeHelper: RouteHelper = {\n bailout: (output) => {\n if (output.unauthenticated) {\n redirectToLogin();\n return true;\n }\n if (output.redirect) {\n redirectTo(output.redirect.path, output.redirect.state);\n return true;\n }\n // Reset redirect count if no redirect is set.\n this.#redirectCount = 0;\n },\n mergeMenus: async (menuRequests) => {\n const menuConfs = await Promise.all(menuRequests);\n this.#navConfig = mergeMenuConfs(menuConfs);\n },\n catch: (error, returnNode) => {\n if (isUnauthenticatedError(error) && !window.NO_AUTH_GUARD) {\n redirectToLogin();\n return;\n } else if (error instanceof HttpAbortError) {\n this.#rendererContextTrashCan.add(prevRendererContext);\n return;\n } else {\n const noAuthGuardLoginPath =\n getRuntime().getMiscSettings().noAuthGuardLoginPath;\n if (isUnauthenticatedError(error) && noAuthGuardLoginPath) {\n redirectTo(noAuthGuardLoginPath as string, { from: location });\n return;\n }\n return {\n failed: true,\n output: {\n node: {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: httpErrorToString(error),\n },\n runtimeContext: null!,\n return: returnNode,\n },\n blockingList: [],\n menuRequests: [],\n },\n };\n }\n },\n };\n\n const rendererContext = (this.#rendererContext = new RendererContext(\n \"page\",\n { routeHelper, renderId }\n ));\n\n const runtimeContext: RuntimeContext = (this.#runtimeContext = {\n app: currentApp,\n location,\n query: new URLSearchParams(location.search),\n flags,\n sys: {\n ...hooks?.auth?.getAuth(),\n ...getPageInfo(),\n settings: {\n brand: getRuntime().getBrandSettings(),\n },\n },\n ctxStore: new DataStore(\"CTX\", undefined, rendererContext),\n pendingPermissionsPreCheck: [\n hooks?.checkPermissions?.preCheckPermissions(storyboard),\n ],\n tplStateStoreMap: new Map<string, DataStore<\"STATE\">>(),\n formStateStoreMap: new Map<string, DataStore<\"FORM_STATE\">>(),\n });\n\n this.#navConfig = undefined;\n\n registerCustomTemplates(storyboard);\n registerStoryboardFunctions(storyboard.meta?.functions, currentApp);\n hooks?.flowApi?.collectContract(storyboard.meta?.contracts);\n\n let failed = false;\n let output: RenderOutput;\n let stores: DataStore<\"CTX\" | \"STATE\" | \"FORM_STATE\">[] = [];\n\n try {\n output = await renderRoutes(\n renderRoot,\n insertPreviewRoutes(storyboard.routes),\n runtimeContext,\n rendererContext,\n []\n );\n if (routeHelper.bailout(output)) {\n return;\n }\n\n stores = getDataStores(runtimeContext);\n\n await postAsyncRender(output, runtimeContext, stores);\n\n await routeHelper.mergeMenus(output.menuRequests);\n rendererContext.setInitialMenuRequests(output.menuRequests);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Router failed:\", error);\n\n const result = routeHelper.catch(error, renderRoot);\n if (!result) {\n return;\n }\n ({ failed, output } = result);\n }\n renderRoot.child = output.node;\n\n cleanUpPreviousRender();\n\n if ((output.route && output.route.type !== \"routes\") || failed) {\n if (!failed) {\n // There is a window to set theme and mode by `lifeCycle.onBeforePageLoad`.\n rendererContext.dispatchBeforePageLoad();\n }\n applyTheme();\n applyMode();\n\n setUIVersion(currentApp?.uiVersion);\n mountTree(renderRoot);\n\n // Scroll to top after each rendering.\n // See https://github.com/ReactTraining/react-router/blob/master/packages/react-router-dom/docs/guides/scroll-restoration.md\n window.scrollTo(0, 0);\n\n if (!failed) {\n rendererContext.dispatchPageLoad();\n rendererContext.dispatchAnchorLoad();\n rendererContext.dispatchOnMount();\n rendererContext.initializeScrollIntoView();\n rendererContext.initializeMediaChange();\n rendererContext.initializeMessageDispatcher();\n\n for (const store of stores) {\n store.mountAsyncData();\n }\n\n finishPageView?.({\n status: \"ok\",\n path: output.path,\n pageTitle: document.title,\n });\n } else {\n finishPageView?.({ status: \"failed\" });\n }\n devtoolsHookEmit(\"rendered\");\n\n return;\n }\n } else if (\n !window.NO_AUTH_GUARD &&\n hooks?.auth &&\n !hooks.auth.isLoggedIn()\n ) {\n // Todo(steve): refine after api-gateway supports fetching storyboards before logged in.\n // Redirect to login if no storyboard is matched.\n redirectToLogin();\n return;\n } else {\n cleanUpPreviousRender();\n }\n\n applyTheme();\n applyMode();\n\n const node: RenderBrick = {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: \"Page not found\",\n },\n runtimeContext: null!,\n return: renderRoot,\n };\n renderRoot.child = node;\n\n mountTree(renderRoot);\n\n // Scroll to top after each rendering.\n window.scrollTo(0, 0);\n finishPageView?.({ status: \"not-found\" });\n devtoolsHookEmit(\"rendered\");\n }\n}\n\nfunction mergeMenuConfs(menuConfs: StaticMenuConf[]) {\n const navConfig = {\n breadcrumb: [] as BreadcrumbItemConf[],\n };\n for (const menuConf of menuConfs) {\n const { breadcrumb } = menuConf;\n if (breadcrumb) {\n if (breadcrumb.overwrite) {\n navConfig.breadcrumb = breadcrumb.items;\n } else {\n navConfig.breadcrumb.push(...breadcrumb.items);\n }\n }\n }\n return navConfig;\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAA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EACzB;EAEA,IAAAwF,wBAAU,EAAC,CAAC;EACZ,IAAAC,uBAAS,EAAC,CAAC;EAEX,MAAM9C,IAAiB,GAAG;IACxBhD,GAAG,EAAEC,gBAAS,CAACgD,KAAK;IACpBC,IAAI,EAAE,KAAK;IACXC,UAAU,EAAE;MACVC,WAAW,EAAE;IACf,CAAC;IACDE,cAAc,EAAE,IAAK;IACrBC,MAAM,EAAExD;EACV,CAAC;EACDA,UAAU,CAAC2F,KAAK,GAAG1C,IAAI;EAEvB,IAAAiD,gBAAS,EAAClG,UAAU,CAAC;;EAErB;EACA3G,MAAM,CAAC8M,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;EACrB9H,cAAc,aAAdA,cAAc,eAAdA,cAAc,CAAG;IAAEmB,MAAM,EAAE;EAAY,CAAC,CAAC;EACzC,IAAAvD,0BAAgB,EAAC,UAAU,CAAC;AAC9B;AAGF,SAASwG,cAAcA,CAACH,SAA2B,EAAE;EACnD,MAAMyE,SAAS,GAAG;IAChBC,UAAU,EAAE;EACd,CAAC;EACD,KAAK,MAAMC,QAAQ,IAAI3E,SAAS,EAAE;IAChC,MAAM;MAAE0E;IAAW,CAAC,GAAGC,QAAQ;IAC/B,IAAID,UAAU,EAAE;MACd,IAAIA,UAAU,CAACE,SAAS,EAAE;QACxBH,SAAS,CAACC,UAAU,GAAGA,UAAU,CAACG,KAAK;MACzC,CAAC,MAAM;QACLJ,SAAS,CAACC,UAAU,CAACI,IAAI,CAAC,GAAGJ,UAAU,CAACG,KAAK,CAAC;MAChD;IACF;EACF;EACA,OAAOJ,SAAS;AAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","names":[],"sources":["../../../src/internal/interfaces.ts"],"sourcesContent":["import type { LegacyCompatibleRuntimeContext } from \"@next-core/inject\";\nimport type {\n BrickEventHandler,\n BrickEventsMap,\n CustomTemplate,\n RouteConf,\n RuntimeSnippet,\n CustomTemplateProxy,\n CustomTemplateProxyBasicProperty,\n CustomTemplateProxySlot,\n SlotsConfOfBricks,\n Storyboard,\n} from \"@next-core/types\";\nimport type { DataStore } from \"./data/DataStore.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { RuntimeBrickConfWithTplSymbols } from \"./CustomTemplates/constants.js\";\nimport { RuntimeBrickConfOfFormSymbols } from \"./FormRenderer/constants.js\";\n\nexport interface RuntimeContext extends LegacyCompatibleRuntimeContext {\n ctxStore: DataStore<\"CTX\">;\n tplStateStoreMap: Map<string, DataStore<\"STATE\">>;\n pendingPermissionsPreCheck: (Promise<unknown> | undefined)[];\n tplStateStoreId?: string;\n // `useBrick` has a local tpl state store scope\n tplStateStoreScope?: DataStore<\"STATE\">[];\n forEachItem?: unknown;\n forEachIndex?: number;\n appendI18nNamespace?: string;\n\n formStateStoreMap: Map<string, DataStore<\"FORM_STATE\">>;\n formStateStoreId?: string;\n formStateStoreScope?: DataStore<\"FORM_STATE\">[];\n}\n\nexport type AsyncPropertyEntry = [\n name: string,\n value: Promise<unknown>,\n ignoreUndefined?: boolean,\n];\n\nexport interface ElementHolder {\n element?: HTMLElement | null;\n}\n\nexport interface RenderRoot extends BaseRenderNode {\n tag: RenderTag.ROOT;\n container?: HTMLElement | DocumentFragment;\n createPortal:\n | HTMLElement\n | DocumentFragment\n | (() => HTMLElement | DocumentFragment);\n}\n\nexport interface RenderBrick extends BaseRenderNode, RuntimeBrick {\n tag: RenderTag.BRICK;\n return: RenderReturnNode;\n hasTrackingControls?: boolean;\n}\n\nexport interface RenderPlaceholder extends BaseRenderNode {\n tag: RenderTag.PLACEHOLDER;\n return: RenderReturnNode;\n}\n\nexport interface BaseRenderNode {\n tag: RenderTag;\n child?: RenderChildNode;\n sibling?: RenderChildNode;\n return?: RenderReturnNode | null;\n childElements?: HTMLElement[];\n}\n\nexport type RenderNode = RenderRoot | RenderBrick | RenderPlaceholder;\n\nexport type RenderChildNode = RenderBrick | RenderPlaceholder;\nexport type RenderReturnNode = RenderRoot | RenderBrick;\n\nexport interface RuntimeBrick {\n type: string;\n properties?: Record<string, unknown>;\n events?: BrickEventsMap;\n slotId?: string;\n element?: RuntimeBrickElement | null;\n iid?: string;\n runtimeContext: RuntimeContext;\n tplHostMetadata?: TemplateHostMetadata;\n portal?: boolean;\n ref?: string;\n}\n\nexport type MetaInfoOfEventListener = [\n string,\n // For compatibility of devtools, leave the second argument there.\n null | undefined,\n BrickEventHandler,\n];\n\nexport type RememberedEventListener = [string, EventListener];\n\nexport interface RuntimeBrickElement extends HTMLElement {\n $$typeof?: \"brick\" | \"provider\" | \"custom-template\" | \"native\" | \"invalid\";\n /** Meta info of listeners, for devtools only */\n $$eventListeners?: MetaInfoOfEventListener[];\n /** Remembered listeners for unbinding */\n $$listeners?: RememberedEventListener[];\n /** Remembered proxy listeners for unbinding */\n $$proxyListeners?: RememberedEventListener[];\n /** Find element by ref in a custom template */\n $$getElementByRef?: (ref: string) => HTMLElement | null | undefined;\n $$tplStateStore?: DataStore<\"STATE\">;\n}\n\nexport interface TemplateHostMetadata {\n internalBricksByRef: Map<string, RuntimeBrick>;\n tplStateStoreId: string;\n proxy?: CustomTemplateProxy;\n}\n\nexport type TemplateHostBrick = RuntimeBrick & {\n tplHostMetadata: TemplateHostMetadata;\n};\n\nexport interface TemplateHostContext {\n reversedProxies: ReversedProxies;\n asyncHostPropertyEntries: AsyncPropertyEntry[];\n externalSlots?: SlotsConfOfBricks;\n tplStateStoreId: string;\n hostBrick: TemplateHostBrick;\n}\n\ninterface ReversedProxies {\n properties: Map<string, ReversedPropertyProxy[]>;\n slots: Map<string, ReversedSlotProxy[]>;\n}\n\ninterface ReversedPropertyProxy {\n from: string;\n to: CustomTemplateProxyBasicProperty;\n}\n\ninterface ReversedSlotProxy {\n from: string;\n to: CustomTemplateProxySlot;\n}\n\nexport type RuntimeBrickConfWithSymbols = RuntimeBrickConfWithTplSymbols &\n RuntimeBrickConfOfFormSymbols;\n\nexport interface DataValueOption {\n tplStateStoreId?: string;\n}\n\nexport type PreviewStoryboardPatch =\n | CustomTemplate\n | RouteConf\n | RuntimeSnippet;\n\nexport interface PreviewOption {\n appId: string;\n formId?: string;\n updateStoryboardType?: \"route\" | \"template\" | \"snippet\";\n collectUsedContracts?(storyboard: Storyboard): string[] | Promise<string[]>;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"interfaces.js","names":[],"sources":["../../../src/internal/interfaces.ts"],"sourcesContent":["import type { LegacyCompatibleRuntimeContext } from \"@next-core/inject\";\nimport type {\n BrickEventHandler,\n BrickEventsMap,\n CustomTemplate,\n RouteConf,\n RuntimeSnippet,\n CustomTemplateProxy,\n CustomTemplateProxyBasicProperty,\n CustomTemplateProxySlot,\n SlotsConfOfBricks,\n Storyboard,\n} from \"@next-core/types\";\nimport type { DataStore } from \"./data/DataStore.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { RuntimeBrickConfWithTplSymbols } from \"./CustomTemplates/constants.js\";\nimport { RuntimeBrickConfOfFormSymbols } from \"./FormRenderer/constants.js\";\n\nexport interface RuntimeContext extends LegacyCompatibleRuntimeContext {\n ctxStore: DataStore<\"CTX\">;\n tplStateStoreMap: Map<string, DataStore<\"STATE\">>;\n pendingPermissionsPreCheck: (Promise<unknown> | undefined)[];\n tplStateStoreId?: string;\n // `useBrick` has a local tpl state store scope\n tplStateStoreScope?: DataStore<\"STATE\">[];\n forEachItem?: unknown;\n forEachIndex?: number;\n appendI18nNamespace?: string;\n\n formStateStoreMap: Map<string, DataStore<\"FORM_STATE\">>;\n formStateStoreId?: string;\n formStateStoreScope?: DataStore<\"FORM_STATE\">[];\n}\n\nexport type AsyncPropertyEntry = [\n name: string,\n value: Promise<unknown>,\n ignoreUndefined?: boolean,\n];\n\nexport interface ElementHolder {\n element?: HTMLElement | null;\n}\n\nexport interface RenderRoot extends BaseRenderNode {\n tag: RenderTag.ROOT;\n container?: HTMLElement | DocumentFragment;\n createPortal:\n | HTMLElement\n | DocumentFragment\n | (() => HTMLElement | DocumentFragment);\n}\n\nexport interface RenderBrick extends BaseRenderNode, RuntimeBrick {\n tag: RenderTag.BRICK;\n return: RenderReturnNode;\n hasTrackingControls?: boolean;\n}\n\nexport interface RenderPlaceholder extends BaseRenderNode {\n tag: RenderTag.PLACEHOLDER;\n return: RenderReturnNode;\n}\n\nexport interface BaseRenderNode {\n tag: RenderTag;\n child?: RenderChildNode;\n sibling?: RenderChildNode;\n return?: RenderReturnNode | null;\n childElements?: HTMLElement[];\n}\n\nexport type RenderNode = RenderRoot | RenderBrick | RenderPlaceholder;\n\nexport type RenderChildNode = RenderBrick | RenderPlaceholder;\nexport type RenderReturnNode = RenderRoot | RenderBrick;\n\nexport interface RuntimeBrick {\n type: string;\n properties?: Record<string, unknown>;\n events?: BrickEventsMap;\n slotId?: string;\n element?: RuntimeBrickElement | null;\n iid?: string;\n runtimeContext: RuntimeContext;\n tplHostMetadata?: TemplateHostMetadata;\n portal?: boolean;\n ref?: string;\n}\n\nexport type MetaInfoOfEventListener = [\n string,\n // For compatibility of devtools, leave the second argument there.\n null | undefined,\n BrickEventHandler,\n];\n\nexport type RememberedEventListener = [string, EventListener];\n\nexport interface RuntimeBrickElement extends HTMLElement {\n $$typeof?: \"brick\" | \"provider\" | \"custom-template\" | \"native\" | \"invalid\";\n /** Meta info of listeners, for devtools only */\n $$eventListeners?: MetaInfoOfEventListener[];\n /** Remembered listeners for unbinding */\n $$listeners?: RememberedEventListener[];\n /** Remembered proxy listeners for unbinding */\n $$proxyListeners?: RememberedEventListener[];\n /** Find element by ref in a custom template */\n $$getElementByRef?: (ref: string) => HTMLElement | null | undefined;\n $$tplStateStore?: DataStore<\"STATE\">;\n}\n\nexport interface TemplateHostMetadata {\n internalBricksByRef: Map<string, RuntimeBrick>;\n tplStateStoreId: string;\n proxy?: CustomTemplateProxy;\n}\n\nexport type TemplateHostBrick = RuntimeBrick & {\n tplHostMetadata: TemplateHostMetadata;\n};\n\nexport interface TemplateHostContext {\n reversedProxies: ReversedProxies;\n asyncHostPropertyEntries: AsyncPropertyEntry[];\n externalSlots?: SlotsConfOfBricks;\n tplStateStoreId: string;\n hostBrick: TemplateHostBrick;\n __temporary_tpl_tag_name?: string;\n}\n\ninterface ReversedProxies {\n properties: Map<string, ReversedPropertyProxy[]>;\n slots: Map<string, ReversedSlotProxy[]>;\n}\n\ninterface ReversedPropertyProxy {\n from: string;\n to: CustomTemplateProxyBasicProperty;\n}\n\ninterface ReversedSlotProxy {\n from: string;\n to: CustomTemplateProxySlot;\n}\n\nexport type RuntimeBrickConfWithSymbols = RuntimeBrickConfWithTplSymbols &\n RuntimeBrickConfOfFormSymbols;\n\nexport interface DataValueOption {\n tplStateStoreId?: string;\n}\n\nexport type PreviewStoryboardPatch =\n | CustomTemplate\n | RouteConf\n | RuntimeSnippet;\n\nexport interface PreviewOption {\n appId: string;\n formId?: string;\n updateStoryboardType?: \"route\" | \"template\" | \"snippet\";\n collectUsedContracts?(storyboard: Storyboard): string[] | Promise<string[]>;\n}\n"],"mappings":""}
|
|
@@ -2,4 +2,5 @@ export var symbolForAsyncComputedPropsFromHost = Symbol.for("tpl.asyncComputedPr
|
|
|
2
2
|
export var symbolForTplStateStoreId = Symbol.for("tpl.stateStoreId");
|
|
3
3
|
export var symbolForTPlExternalForEachItem = Symbol.for("tpl.externalForEachItem");
|
|
4
4
|
export var symbolForTPlExternalForEachIndex = Symbol.for("tpl.externalForEachIndex");
|
|
5
|
+
export var symbolForTPlExternalNoForEach = Symbol.for("tpl.externalNoForEach");
|
|
5
6
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":["symbolForAsyncComputedPropsFromHost","Symbol","for","symbolForTplStateStoreId","symbolForTPlExternalForEachItem","symbolForTPlExternalForEachIndex"],"sources":["../../../../src/internal/CustomTemplates/constants.ts"],"sourcesContent":["import type { BrickConf } from \"@next-core/types\";\nimport type { AsyncPropertyEntry } from \"../interfaces.js\";\n\nexport const symbolForAsyncComputedPropsFromHost = Symbol.for(\n \"tpl.asyncComputedPropsFromHost\"\n);\nexport const symbolForTplStateStoreId = Symbol.for(\"tpl.stateStoreId\");\nexport const symbolForTPlExternalForEachItem = Symbol.for(\n \"tpl.externalForEachItem\"\n);\nexport const symbolForTPlExternalForEachIndex = Symbol.for(\n \"tpl.externalForEachIndex\"\n);\n\nexport type RuntimeBrickConfWithTplSymbols = BrickConf &\n RuntimeBrickConfOfTplSymbols;\n\nexport interface RuntimeBrickConfOfTplSymbols {\n [symbolForAsyncComputedPropsFromHost]?: AsyncPropertyEntry[];\n [symbolForTplStateStoreId]?: string;\n [symbolForTPlExternalForEachItem]?: unknown;\n [symbolForTPlExternalForEachIndex]?: number;\n}\n"],"mappings":"AAGA,OAAO,IAAMA,mCAAmC,GAAGC,MAAM,CAACC,GAAG,CAC3D,gCACF,CAAC;AACD,OAAO,IAAMC,wBAAwB,GAAGF,MAAM,CAACC,GAAG,CAAC,kBAAkB,CAAC;AACtE,OAAO,IAAME,+BAA+B,GAAGH,MAAM,CAACC,GAAG,CACvD,yBACF,CAAC;AACD,OAAO,IAAMG,gCAAgC,GAAGJ,MAAM,CAACC,GAAG,CACxD,0BACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.js","names":["symbolForAsyncComputedPropsFromHost","Symbol","for","symbolForTplStateStoreId","symbolForTPlExternalForEachItem","symbolForTPlExternalForEachIndex","symbolForTPlExternalNoForEach"],"sources":["../../../../src/internal/CustomTemplates/constants.ts"],"sourcesContent":["import type { BrickConf } from \"@next-core/types\";\nimport type { AsyncPropertyEntry } from \"../interfaces.js\";\n\nexport const symbolForAsyncComputedPropsFromHost = Symbol.for(\n \"tpl.asyncComputedPropsFromHost\"\n);\nexport const symbolForTplStateStoreId = Symbol.for(\"tpl.stateStoreId\");\nexport const symbolForTPlExternalForEachItem = Symbol.for(\n \"tpl.externalForEachItem\"\n);\nexport const symbolForTPlExternalForEachIndex = Symbol.for(\n \"tpl.externalForEachIndex\"\n);\nexport const symbolForTPlExternalNoForEach = Symbol.for(\n \"tpl.externalNoForEach\"\n);\n\nexport type RuntimeBrickConfWithTplSymbols = BrickConf &\n RuntimeBrickConfOfTplSymbols;\n\nexport interface RuntimeBrickConfOfTplSymbols {\n [symbolForAsyncComputedPropsFromHost]?: AsyncPropertyEntry[];\n [symbolForTplStateStoreId]?: string;\n [symbolForTPlExternalForEachItem]?: unknown;\n [symbolForTPlExternalForEachIndex]?: number;\n [symbolForTPlExternalNoForEach]?: boolean;\n}\n"],"mappings":"AAGA,OAAO,IAAMA,mCAAmC,GAAGC,MAAM,CAACC,GAAG,CAC3D,gCACF,CAAC;AACD,OAAO,IAAMC,wBAAwB,GAAGF,MAAM,CAACC,GAAG,CAAC,kBAAkB,CAAC;AACtE,OAAO,IAAME,+BAA+B,GAAGH,MAAM,CAACC,GAAG,CACvD,yBACF,CAAC;AACD,OAAO,IAAMG,gCAAgC,GAAGJ,MAAM,CAACC,GAAG,CACxD,0BACF,CAAC;AACD,OAAO,IAAMI,6BAA6B,GAAGL,MAAM,CAACC,GAAG,CACrD,uBACF,CAAC"}
|
|
@@ -84,7 +84,8 @@ export function expandCustomTemplate(tplTagName, brickConf, hostBrick, asyncHost
|
|
|
84
84
|
asyncHostPropertyEntries,
|
|
85
85
|
externalSlots: childrenToSlots(externalChildren, originalExternalSlots),
|
|
86
86
|
tplStateStoreId,
|
|
87
|
-
hostBrick: hostBrick
|
|
87
|
+
hostBrick: hostBrick,
|
|
88
|
+
__temporary_tpl_tag_name: tplTagName
|
|
88
89
|
};
|
|
89
90
|
newBrickConf.slots = {
|
|
90
91
|
"": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expandCustomTemplate.js","names":["uniqueId","customTemplates","DataStore","setupTemplateProxy","setupUseBrickInTemplate","childrenToSlots","hooks","expandCustomTemplate","tplTagName","brickConf","hostBrick","asyncHostPropertyEntries","rendererContext","_hooks$flowApi","tplStateStoreId","runtimeContext","_objectSpread","forEachItem","forEachIndex","formStateStoreId","tplStateStore","tplStateStoreMap","set","tplStateStoreScope","push","bricks","proxy","state","contracts","get","flowApi","collectWidgetContract","define","slots","originalExternalSlots","children","externalChildren","restBrickConf","_objectWithoutProperties","_excluded","newBrickConf","brick","tplHostMetadata","internalBricksByRef","Map","reversedProxies","properties","from","to","Object","entries","proxies","ref","hostContext","externalSlots","type","map","item","expandBrickInTemplate","brickConfInTemplate","if","slotsInTemplate","childrenInTemplate","restBrickConfInTemplate","_excluded2","transpiledSlots","fromEntries","_ref","_slotConf$bricks","slotName","slotConf"],"sources":["../../../../src/internal/CustomTemplates/expandCustomTemplate.ts"],"sourcesContent":["import type {\n BrickConf,\n BrickConfInTemplate,\n SlotsConfInTemplate,\n SlotsConfOfBricks,\n UseSingleBrickConf,\n} from \"@next-core/types\";\nimport { uniqueId } from \"lodash\";\nimport { customTemplates } from \"../../CustomTemplates.js\";\nimport { DataStore } from \"../data/DataStore.js\";\nimport { RuntimeBrickConfWithTplSymbols } from \"./constants.js\";\nimport { setupTemplateProxy } from \"./setupTemplateProxy.js\";\nimport type {\n AsyncPropertyEntry,\n RuntimeBrick,\n TemplateHostBrick,\n TemplateHostContext,\n} from \"../interfaces.js\";\nimport { setupUseBrickInTemplate } from \"./setupUseBrickInTemplate.js\";\nimport { childrenToSlots } from \"../Renderer.js\";\nimport { hooks } from \"../Runtime.js\";\nimport type { RendererContext } from \"../RendererContext.js\";\n\nexport function expandCustomTemplate<T extends BrickConf | UseSingleBrickConf>(\n tplTagName: string,\n brickConf: T,\n hostBrick: RuntimeBrick,\n asyncHostPropertyEntries: AsyncPropertyEntry[],\n rendererContext: RendererContext\n): T {\n const tplStateStoreId = uniqueId(\"tpl-state-\");\n const runtimeContext = {\n ...hostBrick.runtimeContext,\n tplStateStoreId,\n };\n\n // There is a boundary for `forEachItem` and `FORM_STATE` between template internals and externals.\n delete runtimeContext.forEachItem;\n delete runtimeContext.forEachIndex;\n delete runtimeContext.formStateStoreId;\n\n const tplStateStore = new DataStore(\n \"STATE\",\n hostBrick,\n rendererContext,\n tplStateStoreId\n );\n runtimeContext.tplStateStoreMap.set(tplStateStoreId, tplStateStore);\n if (runtimeContext.tplStateStoreScope) {\n runtimeContext.tplStateStoreScope.push(tplStateStore);\n }\n\n const { bricks, proxy, state, contracts } = customTemplates.get(tplTagName)!;\n hooks?.flowApi?.collectWidgetContract(contracts);\n tplStateStore.define(state, runtimeContext, asyncHostPropertyEntries);\n\n const {\n slots: originalExternalSlots,\n children: externalChildren,\n ...restBrickConf\n } = brickConf;\n\n const newBrickConf = {\n ...restBrickConf,\n brick: tplTagName,\n } as T;\n\n hostBrick.tplHostMetadata = {\n internalBricksByRef: new Map(),\n tplStateStoreId,\n proxy,\n };\n\n // Reversed proxies are used for expand storyboard before rendering page.\n const reversedProxies: TemplateHostContext[\"reversedProxies\"] = {\n properties: new Map(),\n slots: new Map(),\n // mergeBases: new Map(),\n };\n\n if (proxy?.properties) {\n for (const [from, to] of Object.entries(proxy.properties)) {\n let proxies = reversedProxies.properties.get(to.ref);\n if (!proxies) {\n proxies = [];\n reversedProxies.properties.set(to.ref, proxies);\n }\n proxies.push({\n from,\n to,\n });\n }\n }\n\n if (proxy?.slots) {\n for (const [from, to] of Object.entries(proxy.slots)) {\n let proxies = reversedProxies.slots.get(to.ref);\n if (!proxies) {\n proxies = [];\n reversedProxies.slots.set(to.ref, proxies);\n }\n proxies.push({\n from,\n to,\n });\n }\n }\n\n const hostContext: TemplateHostContext = {\n reversedProxies,\n asyncHostPropertyEntries,\n externalSlots: childrenToSlots(externalChildren, originalExternalSlots) as\n | SlotsConfOfBricks\n | undefined,\n tplStateStoreId,\n hostBrick: hostBrick as TemplateHostBrick,\n };\n\n newBrickConf.slots = {\n \"\": {\n type: \"bricks\",\n bricks: bricks.map((item) => expandBrickInTemplate(item, hostContext)),\n },\n };\n\n return newBrickConf;\n}\n\nfunction expandBrickInTemplate(\n brickConfInTemplate: BrickConfInTemplate,\n hostContext: TemplateHostContext\n): RuntimeBrickConfWithTplSymbols {\n // Ignore `if: null` to make `looseCheckIf` working.\n if (brickConfInTemplate.if === null) {\n delete brickConfInTemplate.if;\n }\n const {\n properties,\n slots: slotsInTemplate,\n children: childrenInTemplate,\n ...restBrickConfInTemplate\n } = brickConfInTemplate;\n\n const transpiledSlots = childrenToSlots(\n childrenInTemplate,\n slotsInTemplate\n ) as SlotsConfInTemplate | undefined;\n\n const slots: SlotsConfOfBricks = Object.fromEntries(\n Object.entries(transpiledSlots ?? {}).map(([slotName, slotConf]) => [\n slotName,\n {\n type: \"bricks\",\n bricks: (slotConf.bricks ?? []).map((item) =>\n expandBrickInTemplate(item, hostContext)\n ),\n },\n ])\n );\n\n return {\n ...restBrickConfInTemplate,\n properties: setupUseBrickInTemplate(properties, hostContext),\n slots,\n ...setupTemplateProxy(hostContext, restBrickConfInTemplate.ref, slots),\n };\n}\n"],"mappings":";;;;AAOA,SAASA,QAAQ,QAAQ,QAAQ;AACjC,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,SAASC,SAAS,QAAQ,sBAAsB;AAEhD,SAASC,kBAAkB,QAAQ,yBAAyB;AAO5D,SAASC,uBAAuB,QAAQ,8BAA8B;AACtE,SAASC,eAAe,QAAQ,gBAAgB;AAChD,SAASC,KAAK,QAAQ,eAAe;AAGrC,OAAO,SAASC,oBAAoBA,CAClCC,UAAkB,EAClBC,SAAY,EACZC,SAAuB,EACvBC,wBAA8C,EAC9CC,eAAgC,EAC7B;EAAA,IAAAC,cAAA;EACH,IAAMC,eAAe,GAAGd,QAAQ,CAAC,YAAY,CAAC;EAC9C,IAAMe,cAAc,GAAAC,aAAA,CAAAA,aAAA,KACfN,SAAS,CAACK,cAAc;IAC3BD;EAAe,EAChB;;EAED;EACA,OAAOC,cAAc,CAACE,WAAW;EACjC,OAAOF,cAAc,CAACG,YAAY;EAClC,OAAOH,cAAc,CAACI,gBAAgB;EAEtC,IAAMC,aAAa,GAAG,IAAIlB,SAAS,CACjC,OAAO,EACPQ,SAAS,EACTE,eAAe,EACfE,eACF,CAAC;EACDC,c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GAAG,CAAC;MACpD,IAAI,CAACD,OAAO,EAAE;QACZA,OAAO,GAAG,EAAE;QACZN,eAAe,CAACC,UAAU,CAACxB,GAAG,CAAC0B,EAAE,CAACI,GAAG,EAAED,OAAO,CAAC;MACjD;MACAA,OAAO,CAAC3B,IAAI,CAAC;QACXuB,IAAI;QACJC;MACF,CAAC,CAAC;IACJ;EACF;EAEA,IAAItB,KAAK,aAALA,KAAK,eAALA,KAAK,CAAEO,KAAK,EAAE;IAChB,KAAK,IAAM,CAACc,KAAI,EAAEC,GAAE,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACxB,KAAK,CAACO,KAAK,CAAC,EAAE;MACpD,IAAIkB,QAAO,GAAGN,eAAe,CAACZ,KAAK,CAACJ,GAAG,CAACmB,GAAE,CAACI,GAAG,CAAC;MAC/C,IAAI,CAACD,QAAO,EAAE;QACZA,QAAO,GAAG,EAAE;QACZN,eAAe,CAACZ,KAAK,CAACX,GAAG,CAAC0B,GAAE,CAACI,GAAG,EAAED,QAAO,CAAC;MAC5C;MACAA,QAAO,CAAC3B,IAAI,CAAC;QACXuB,IAAI,EAAJA,KAAI;QACJC,EAAE,EAAFA;MACF,CAAC,CAAC;IACJ;EACF;EAEA,IAAMK,WAAgC,GAAG;IACvCR,eAAe;IACflC,wBAAwB;IACxB2C,aAAa,EAAEjD,eAAe,CAAC+B,gBAAgB,EAAEF,qBAAqB,CAEzD;IACbpB,eAAe;IACfJ,SAAS,EAAEA;
|
|
1
|
+
{"version":3,"file":"expandCustomTemplate.js","names":["uniqueId","customTemplates","DataStore","setupTemplateProxy","setupUseBrickInTemplate","childrenToSlots","hooks","expandCustomTemplate","tplTagName","brickConf","hostBrick","asyncHostPropertyEntries","rendererContext","_hooks$flowApi","tplStateStoreId","runtimeContext","_objectSpread","forEachItem","forEachIndex","formStateStoreId","tplStateStore","tplStateStoreMap","set","tplStateStoreScope","push","bricks","proxy","state","contracts","get","flowApi","collectWidgetContract","define","slots","originalExternalSlots","children","externalChildren","restBrickConf","_objectWithoutProperties","_excluded","newBrickConf","brick","tplHostMetadata","internalBricksByRef","Map","reversedProxies","properties","from","to","Object","entries","proxies","ref","hostContext","externalSlots","__temporary_tpl_tag_name","type","map","item","expandBrickInTemplate","brickConfInTemplate","if","slotsInTemplate","childrenInTemplate","restBrickConfInTemplate","_excluded2","transpiledSlots","fromEntries","_ref","_slotConf$bricks","slotName","slotConf"],"sources":["../../../../src/internal/CustomTemplates/expandCustomTemplate.ts"],"sourcesContent":["import type {\n BrickConf,\n BrickConfInTemplate,\n SlotsConfInTemplate,\n SlotsConfOfBricks,\n UseSingleBrickConf,\n} from \"@next-core/types\";\nimport { uniqueId } from \"lodash\";\nimport { customTemplates } from \"../../CustomTemplates.js\";\nimport { DataStore } from \"../data/DataStore.js\";\nimport { RuntimeBrickConfWithTplSymbols } from \"./constants.js\";\nimport { setupTemplateProxy } from \"./setupTemplateProxy.js\";\nimport type {\n AsyncPropertyEntry,\n RuntimeBrick,\n TemplateHostBrick,\n TemplateHostContext,\n} from \"../interfaces.js\";\nimport { setupUseBrickInTemplate } from \"./setupUseBrickInTemplate.js\";\nimport { childrenToSlots } from \"../Renderer.js\";\nimport { hooks } from \"../Runtime.js\";\nimport type { RendererContext } from \"../RendererContext.js\";\n\nexport function expandCustomTemplate<T extends BrickConf | UseSingleBrickConf>(\n tplTagName: string,\n brickConf: T,\n hostBrick: RuntimeBrick,\n asyncHostPropertyEntries: AsyncPropertyEntry[],\n rendererContext: RendererContext\n): T {\n const tplStateStoreId = uniqueId(\"tpl-state-\");\n const runtimeContext = {\n ...hostBrick.runtimeContext,\n tplStateStoreId,\n };\n\n // There is a boundary for `forEachItem` and `FORM_STATE` between template internals and externals.\n delete runtimeContext.forEachItem;\n delete runtimeContext.forEachIndex;\n delete runtimeContext.formStateStoreId;\n\n const tplStateStore = new DataStore(\n \"STATE\",\n hostBrick,\n rendererContext,\n tplStateStoreId\n );\n runtimeContext.tplStateStoreMap.set(tplStateStoreId, tplStateStore);\n if (runtimeContext.tplStateStoreScope) {\n runtimeContext.tplStateStoreScope.push(tplStateStore);\n }\n\n const { bricks, proxy, state, contracts } = customTemplates.get(tplTagName)!;\n hooks?.flowApi?.collectWidgetContract(contracts);\n tplStateStore.define(state, runtimeContext, asyncHostPropertyEntries);\n\n const {\n slots: originalExternalSlots,\n children: externalChildren,\n ...restBrickConf\n } = brickConf;\n\n const newBrickConf = {\n ...restBrickConf,\n brick: tplTagName,\n } as T;\n\n hostBrick.tplHostMetadata = {\n internalBricksByRef: new Map(),\n tplStateStoreId,\n proxy,\n };\n\n // Reversed proxies are used for expand storyboard before rendering page.\n const reversedProxies: TemplateHostContext[\"reversedProxies\"] = {\n properties: new Map(),\n slots: new Map(),\n // mergeBases: new Map(),\n };\n\n if (proxy?.properties) {\n for (const [from, to] of Object.entries(proxy.properties)) {\n let proxies = reversedProxies.properties.get(to.ref);\n if (!proxies) {\n proxies = [];\n reversedProxies.properties.set(to.ref, proxies);\n }\n proxies.push({\n from,\n to,\n });\n }\n }\n\n if (proxy?.slots) {\n for (const [from, to] of Object.entries(proxy.slots)) {\n let proxies = reversedProxies.slots.get(to.ref);\n if (!proxies) {\n proxies = [];\n reversedProxies.slots.set(to.ref, proxies);\n }\n proxies.push({\n from,\n to,\n });\n }\n }\n\n const hostContext: TemplateHostContext = {\n reversedProxies,\n asyncHostPropertyEntries,\n externalSlots: childrenToSlots(externalChildren, originalExternalSlots) as\n | SlotsConfOfBricks\n | undefined,\n tplStateStoreId,\n hostBrick: hostBrick as TemplateHostBrick,\n __temporary_tpl_tag_name: tplTagName,\n };\n\n newBrickConf.slots = {\n \"\": {\n type: \"bricks\",\n bricks: bricks.map((item) => expandBrickInTemplate(item, hostContext)),\n },\n };\n\n return newBrickConf;\n}\n\nfunction expandBrickInTemplate(\n brickConfInTemplate: BrickConfInTemplate,\n hostContext: TemplateHostContext\n): RuntimeBrickConfWithTplSymbols {\n // Ignore `if: null` to make `looseCheckIf` working.\n if (brickConfInTemplate.if === null) {\n delete brickConfInTemplate.if;\n }\n const {\n properties,\n slots: slotsInTemplate,\n children: childrenInTemplate,\n ...restBrickConfInTemplate\n } = brickConfInTemplate;\n\n const transpiledSlots = childrenToSlots(\n childrenInTemplate,\n slotsInTemplate\n ) as SlotsConfInTemplate | undefined;\n\n const slots: SlotsConfOfBricks = Object.fromEntries(\n Object.entries(transpiledSlots ?? {}).map(([slotName, slotConf]) => [\n slotName,\n {\n type: \"bricks\",\n bricks: (slotConf.bricks ?? []).map((item) =>\n expandBrickInTemplate(item, hostContext)\n ),\n },\n ])\n );\n\n return {\n ...restBrickConfInTemplate,\n properties: setupUseBrickInTemplate(properties, hostContext),\n slots,\n ...setupTemplateProxy(hostContext, restBrickConfInTemplate.ref, slots),\n };\n}\n"],"mappings":";;;;AAOA,SAASA,QAAQ,QAAQ,QAAQ;AACjC,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,SAASC,SAAS,QAAQ,sBAAsB;AAEhD,SAASC,kBAAkB,QAAQ,yBAAyB;AAO5D,SAASC,uBAAuB,QAAQ,8BAA8B;AACtE,SAASC,eAAe,QAAQ,gBAAgB;AAChD,SAASC,KAAK,QAAQ,eAAe;AAGrC,OAAO,SAASC,oBAAoBA,CAClCC,UAAkB,EAClBC,SAAY,EACZC,SAAuB,EACvBC,wBAA8C,EAC9CC,eAAgC,EAC7B;EAAA,IAAAC,cAAA;EACH,IAAMC,eAAe,GAAGd,QAAQ,CAAC,YAAY,CAAC;EAC9C,IAAMe,cAAc,GAAAC,aAAA,CAAAA,aAAA,KACfN,SAAS,CAACK,cAAc;IAC3BD;EAAe,EAChB;;EAED;EACA,OAAOC,cAAc,CAACE,WAAW;EACjC,OAAOF,cAAc,CAACG,YAAY;EAClC,OAAOH,cAAc,CAACI,gBAAgB;EAEtC,IAAMC,aAAa,GAAG,IAAIlB,SAAS,CACjC,OAAO,EACPQ,SAAS,EACTE,eAAe,EACfE,eACF,CAAC;EACDC,cAAc,CAACM,gBAAgB,CAACC,GAAG,CAACR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AAK,IAAI,EAAE;IACnC,OAAOD,mBAAmB,CAACC,EAAE;EAC/B;EACA,IAAM;MACJf,UAAU;MACVb,KAAK,EAAE6B,eAAe;MACtB3B,QAAQ,EAAE4B;IAEZ,CAAC,GAAGH,mBAAmB;IADlBI,uBAAuB,GAAA1B,wBAAA,CACxBsB,mBAAmB,EAAAK,UAAA;EAEvB,IAAMC,eAAe,GAAG7D,eAAe,CACrC0D,kBAAkB,EAClBD,eACF,CAAoC;EAEpC,IAAM7B,KAAwB,GAAGgB,MAAM,CAACkB,WAAW,CACjDlB,MAAM,CAACC,OAAO,CAACgB,eAAe,aAAfA,eAAe,cAAfA,eAAe,GAAI,CAAC,CAAC,CAAC,CAACT,GAAG,CAACW,IAAA;IAAA,IAAAC,gBAAA;IAAA,IAAC,CAACC,QAAQ,EAAEC,QAAQ,CAAC,GAAAH,IAAA;IAAA,OAAK,CAClEE,QAAQ,EACR;MACEd,IAAI,EAAE,QAAQ;MACd/B,MAAM,EAAE,EAAA4C,gBAAA,GAACE,QAAQ,CAAC9C,MAAM,cAAA4C,gBAAA,cAAAA,gBAAA,GAAI,EAAE,EAAEZ,GAAG,CAAEC,IAAI,IACvCC,qBAAqB,CAACD,IAAI,EAAEL,WAAW,CACzC;IACF,CAAC,CACF;EAAA,EACH,CAAC;EAED,OAAArC,aAAA,CAAAA,aAAA,KACKgD,uBAAuB;IAC1BlB,UAAU,EAAE1C,uBAAuB,CAAC0C,UAAU,EAAEO,WAAW,CAAC;IAC5DpB;EAAK,GACF9B,kBAAkB,CAACkD,WAAW,EAAEW,uBAAuB,CAACZ,GAAG,EAAEnB,KAAK,CAAC;AAE1E"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
import _toPropertyKey from "@babel/runtime/helpers/toPropertyKey";
|
|
2
4
|
import { hasOwnProperty } from "@next-core/utils/general";
|
|
3
5
|
import { clamp } from "lodash";
|
|
4
|
-
import { symbolForAsyncComputedPropsFromHost, symbolForTPlExternalForEachIndex, symbolForTPlExternalForEachItem, symbolForTplStateStoreId } from "./constants.js";
|
|
6
|
+
import { symbolForAsyncComputedPropsFromHost, symbolForTPlExternalForEachIndex, symbolForTPlExternalForEachItem, symbolForTPlExternalNoForEach, symbolForTplStateStoreId } from "./constants.js";
|
|
5
7
|
import { computePropertyValue } from "../compute/computeRealProperties.js";
|
|
8
|
+
import { childrenToSlots } from "../Renderer.js";
|
|
6
9
|
export function setupTemplateProxy(hostContext, ref, slots) {
|
|
7
10
|
var {
|
|
8
11
|
reversedProxies,
|
|
@@ -56,7 +59,10 @@ export function setupTemplateProxy(hostContext, ref, slots) {
|
|
|
56
59
|
quasisMap.set(refToSlot, expandableSlot);
|
|
57
60
|
}
|
|
58
61
|
var refPosition = (_to$refPosition = to.refPosition) !== null && _to$refPosition !== void 0 ? _to$refPosition : -1;
|
|
59
|
-
|
|
62
|
+
// External bricks of a template, should not access the template internal forEach `ITEM`.
|
|
63
|
+
// For some existing templates who is *USING* this bug, we keep the old behavior.
|
|
64
|
+
var hostHasForEach = hasOwnProperty(hostBrick.runtimeContext, "forEachItem");
|
|
65
|
+
expandableSlot[clamp(refPosition < 0 ? expandableSlot.length + refPosition : refPosition, 0, expandableSlot.length - 1)].push(...((hostContext.__temporary_tpl_tag_name === "base-layout-v3.tpl-scroll-load-list" || hostContext.__temporary_tpl_tag_name === "shrcb-homepage.tpl-custom-scroll-load-list") && !hostHasForEach ? insertBricks : setupTemplateExternalBricks(insertBricks, hostHasForEach, hostBrick.runtimeContext.forEachItem, hostBrick.runtimeContext.forEachIndex)));
|
|
60
66
|
}
|
|
61
67
|
var _loop = function () {
|
|
62
68
|
if (!hasOwnProperty(slots, slotName)) {
|
|
@@ -83,29 +89,40 @@ export function setupTemplateProxy(hostContext, ref, slots) {
|
|
|
83
89
|
}
|
|
84
90
|
|
|
85
91
|
// External bricks of a template, have the same forEachItem context as their host.
|
|
86
|
-
function setupTemplateExternalBricks(bricks, forEachItem, forEachIndex) {
|
|
87
|
-
return bricks.map(
|
|
88
|
-
var
|
|
89
|
-
|
|
92
|
+
function setupTemplateExternalBricks(bricks, hasForEach, forEachItem, forEachIndex) {
|
|
93
|
+
return bricks.map(_ref2 => {
|
|
94
|
+
var _childrenToSlots;
|
|
95
|
+
var {
|
|
96
|
+
children,
|
|
97
|
+
slots,
|
|
98
|
+
[symbolForTPlExternalForEachItem]: a,
|
|
99
|
+
[symbolForTPlExternalForEachIndex]: b,
|
|
100
|
+
[symbolForTPlExternalNoForEach]: c
|
|
101
|
+
} = _ref2,
|
|
102
|
+
brick = _objectWithoutProperties(_ref2, ["children", "slots", symbolForTPlExternalForEachItem, symbolForTPlExternalForEachIndex, symbolForTPlExternalNoForEach].map(_toPropertyKey));
|
|
103
|
+
return _objectSpread(_objectSpread(_objectSpread({}, brick), hasForEach ? {
|
|
90
104
|
[symbolForTPlExternalForEachItem]: forEachItem,
|
|
91
|
-
[symbolForTPlExternalForEachIndex]: forEachIndex
|
|
92
|
-
|
|
105
|
+
[symbolForTPlExternalForEachIndex]: forEachIndex
|
|
106
|
+
} : {
|
|
107
|
+
[symbolForTPlExternalNoForEach]: true
|
|
108
|
+
}), {}, {
|
|
109
|
+
slots: Object.fromEntries(Object.entries((_childrenToSlots = childrenToSlots(children, slots)) !== null && _childrenToSlots !== void 0 ? _childrenToSlots : {}).map(_ref3 => {
|
|
93
110
|
var _slotConf$bricks;
|
|
94
|
-
var [slotName, slotConf] =
|
|
111
|
+
var [slotName, slotConf] = _ref3;
|
|
95
112
|
return [slotName, slotConf.type === "routes" ? {
|
|
96
113
|
type: "routes",
|
|
97
|
-
routes: setupTemplateExternalRoutes(slotConf.routes, forEachItem, forEachIndex)
|
|
114
|
+
routes: setupTemplateExternalRoutes(slotConf.routes, hasForEach, forEachItem, forEachIndex)
|
|
98
115
|
} : {
|
|
99
116
|
type: "bricks",
|
|
100
|
-
bricks: setupTemplateExternalBricks((_slotConf$bricks = slotConf.bricks) !== null && _slotConf$bricks !== void 0 ? _slotConf$bricks : [], forEachItem, forEachIndex)
|
|
117
|
+
bricks: setupTemplateExternalBricks((_slotConf$bricks = slotConf.bricks) !== null && _slotConf$bricks !== void 0 ? _slotConf$bricks : [], hasForEach, forEachItem, forEachIndex)
|
|
101
118
|
}];
|
|
102
119
|
}))
|
|
103
120
|
});
|
|
104
121
|
});
|
|
105
122
|
}
|
|
106
|
-
function setupTemplateExternalRoutes(routes, forEachItem, forEachIndex) {
|
|
123
|
+
function setupTemplateExternalRoutes(routes, hasForEach, forEachItem, forEachIndex) {
|
|
107
124
|
return routes.map(route => route.type && route.type !== "bricks" ? route : _objectSpread(_objectSpread({}, route), {}, {
|
|
108
|
-
bricks: setupTemplateExternalBricks(route.bricks, forEachItem, forEachIndex)
|
|
125
|
+
bricks: setupTemplateExternalBricks(route.bricks, hasForEach, forEachItem, forEachIndex)
|
|
109
126
|
}));
|
|
110
127
|
}
|
|
111
128
|
//# sourceMappingURL=setupTemplateProxy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupTemplateProxy.js","names":["hasOwnProperty","clamp","symbolForAsyncComputedPropsFromHost","symbolForTPlExternalForEachIndex","symbolForTPlExternalForEachItem","symbolForTplStateStoreId","computePropertyValue","setupTemplateProxy","hostContext","ref","slots","reversedProxies","asyncHostPropertyEntries","externalSlots","tplStateStoreId","hostBrick","asyncComputedProps","propertyProxies","properties","get","getComputedProps","asyncHostProps","map","_ref","from","to","filtered","filter","entry","length","refProperty","Boolean","slotProxies","quasisMap","Map","_externalSlots$from$b","_externalSlots$from","_to$refSlot","_to$refPosition","insertBricks","bricks","refToSlot","refSlot","expandableSlot","size","i","push","set","refPosition","runtimeContext","setupTemplateExternalBricks","forEachItem","forEachIndex","_loop","slotName","type","slotConf","quasis","flatMap","index","concat","entries","brick","_brick$slots","_objectSpread","Object","fromEntries","_ref2","_slotConf$bricks","routes","setupTemplateExternalRoutes","route"],"sources":["../../../../src/internal/CustomTemplates/setupTemplateProxy.ts"],"sourcesContent":["import type { BrickConf, RouteConf, SlotsConfOfBricks } from \"@next-core/types\";\nimport { hasOwnProperty } from \"@next-core/utils/general\";\nimport { clamp } from \"lodash\";\nimport {\n symbolForAsyncComputedPropsFromHost,\n symbolForTPlExternalForEachIndex,\n symbolForTPlExternalForEachItem,\n symbolForTplStateStoreId,\n} from \"./constants.js\";\nimport type { AsyncPropertyEntry, TemplateHostContext } from \"../interfaces.js\";\nimport { computePropertyValue } from \"../compute/computeRealProperties.js\";\n\nexport function setupTemplateProxy(\n hostContext: TemplateHostContext,\n ref: string | undefined,\n slots: SlotsConfOfBricks\n) {\n const {\n reversedProxies,\n asyncHostPropertyEntries,\n externalSlots,\n tplStateStoreId,\n hostBrick,\n } = hostContext;\n\n let asyncComputedProps: AsyncPropertyEntry[] | undefined;\n\n if (ref && reversedProxies) {\n const propertyProxies = reversedProxies.properties.get(ref);\n if (propertyProxies) {\n const getComputedProps = (\n asyncHostProps: AsyncPropertyEntry[]\n ): AsyncPropertyEntry[] => {\n return propertyProxies!\n .map(({ from, to }) => {\n const filtered = asyncHostProps.filter(\n (entry) => entry[0] === from\n );\n if (filtered.length > 0 && to.refProperty) {\n return [\n to.refProperty,\n computePropertyValue(filtered, from),\n true,\n ];\n }\n })\n .filter(Boolean) as [string, Promise<unknown>][];\n };\n\n asyncComputedProps = getComputedProps(asyncHostPropertyEntries);\n }\n\n const slotProxies = reversedProxies.slots.get(ref);\n if (slotProxies && externalSlots) {\n // Use an approach like template-literal's quasis:\n // `quasi0${0}quais1${1}quasi2...`\n // Every quasi (indexed by `refPosition`) can be slotted with multiple bricks.\n const quasisMap = new Map<string, BrickConf[][]>();\n\n for (const { from, to } of slotProxies) {\n const insertBricks = externalSlots[from]?.bricks ?? [];\n if (!insertBricks.length) {\n continue;\n }\n const refToSlot = to.refSlot ?? from;\n let expandableSlot = quasisMap.get(refToSlot);\n if (!expandableSlot) {\n expandableSlot = [];\n // The size of quasis should be the existed slotted bricks' size plus one.\n const size = hasOwnProperty(slots, refToSlot)\n ? slots[refToSlot].bricks.length + 1\n : 1;\n for (let i = 0; i < size; i += 1) {\n expandableSlot.push([]);\n }\n quasisMap.set(refToSlot, expandableSlot);\n }\n const refPosition = to.refPosition ?? -1;\n expandableSlot[\n clamp(\n refPosition < 0 ? expandableSlot.length + refPosition : refPosition,\n 0,\n expandableSlot.length - 1\n )\n ].push(\n ...(hasOwnProperty(hostBrick.runtimeContext, \"forEachItem\")\n ? setupTemplateExternalBricks(\n insertBricks,\n hostBrick.runtimeContext.forEachItem,\n hostBrick.runtimeContext.forEachIndex!\n )\n : insertBricks)\n );\n }\n\n for (const [slotName, quasis] of quasisMap.entries()) {\n if (!hasOwnProperty(slots, slotName)) {\n slots[slotName] = {\n type: \"bricks\",\n bricks: [],\n };\n }\n const slotConf = slots[slotName];\n slotConf.bricks = quasis.flatMap((bricks, index) =>\n index < slotConf.bricks.length\n ? bricks.concat(slotConf.bricks[index])\n : bricks\n );\n\n if (slotConf.bricks.length === 0) {\n delete slots[slotName];\n }\n }\n }\n }\n\n return {\n [symbolForAsyncComputedPropsFromHost]: asyncComputedProps,\n [symbolForTplStateStoreId]: tplStateStoreId,\n };\n}\n\n// External bricks of a template, have the same forEachItem context as their host.\nfunction setupTemplateExternalBricks(\n bricks: BrickConf[],\n forEachItem: unknown,\n forEachIndex: number\n): BrickConf[] {\n return bricks.map((brick) => ({\n ...brick,\n [symbolForTPlExternalForEachItem]: forEachItem,\n [symbolForTPlExternalForEachIndex]: forEachIndex,\n slots: Object.fromEntries(\n Object.entries(brick.slots ?? {}).map(([slotName, slotConf]) => [\n slotName,\n slotConf.type === \"routes\"\n ? {\n type: \"routes\",\n routes: setupTemplateExternalRoutes(\n slotConf.routes,\n forEachItem,\n forEachIndex\n ),\n }\n : {\n type: \"bricks\",\n bricks: setupTemplateExternalBricks(\n slotConf.bricks ?? [],\n forEachItem,\n forEachIndex\n ),\n },\n ])\n ),\n }));\n}\n\nfunction setupTemplateExternalRoutes(\n routes: RouteConf[],\n forEachItem: unknown,\n forEachIndex: number\n): RouteConf[] {\n return routes.map((route) =>\n route.type && route.type !== \"bricks\"\n ? route\n : {\n ...route,\n bricks: setupTemplateExternalBricks(\n route.bricks,\n forEachItem,\n forEachIndex\n ),\n }\n );\n}\n"],"mappings":";AACA,SAASA,cAAc,QAAQ,0BAA0B;AACzD,SAASC,KAAK,QAAQ,QAAQ;AAC9B,SACEC,mCAAmC,EACnCC,gCAAgC,EAChCC,+BAA+B,EAC/BC,wBAAwB,QACnB,gBAAgB;AAEvB,SAASC,oBAAoB,QAAQ,qCAAqC;AAE1E,OAAO,SAASC,kBAAkBA,CAChCC,WAAgC,EAChCC,GAAuB,EACvBC,KAAwB,EACxB;EACA,IAAM;IACJC,eAAe;IACfC,wBAAwB;IACxBC,aAAa;IACbC,eAAe;IACfC;EACF,CAAC,GAAGP,WAAW;EAEf,IAAIQ,kBAAoD;EAExD,IAAIP,GAAG,IAAIE,eAAe,EAAE;IAC1B,IAAMM,eAAe,GAAGN,eAAe,CAACO,UAAU,CAACC,GAAG,CAACV,GAAG,CAAC;IAC3D,IAAIQ,eAAe,EAAE;MACnB,IAAMG,gBAAgB,GACpBC,cAAoC,IACX;QACzB,OAAOJ,eAAe,CACnBK,GAAG,CAACC,IAAA,IAAkB;UAAA,IAAjB;YAAEC,IAAI;YAAEC;UAAG,CAAC,GAAAF,IAAA;UAChB,IAAMG,QAAQ,GAAGL,cAAc,CAACM,MAAM,CACnCC,KAAK,IAAKA,KAAK,CAAC,CAAC,CAAC,KAAKJ,IAC1B,CAAC;UACD,IAAIE,QAAQ,CAACG,MAAM,GAAG,CAAC,IAAIJ,EAAE,CAACK,WAAW,EAAE;YACzC,OAAO,CACLL,EAAE,CAACK,WAAW,EACdxB,oBAAoB,CAACoB,QAAQ,EAAEF,IAAI,CAAC,EACpC,IAAI,CACL;UACH;QACF,CAAC,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,GAAAP,aAAA,CAAAA,aAAA,KAEAO,KAAK;IACR/B,MAAM,EAAEU,2BAA2B,CACjCqB,KAAK,CAAC/B,MAAM,EACZW,WAAW,EACXC,YACF;EAAC,EAET,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"setupTemplateProxy.js","names":["hasOwnProperty","clamp","symbolForAsyncComputedPropsFromHost","symbolForTPlExternalForEachIndex","symbolForTPlExternalForEachItem","symbolForTPlExternalNoForEach","symbolForTplStateStoreId","computePropertyValue","childrenToSlots","setupTemplateProxy","hostContext","ref","slots","reversedProxies","asyncHostPropertyEntries","externalSlots","tplStateStoreId","hostBrick","asyncComputedProps","propertyProxies","properties","get","getComputedProps","asyncHostProps","map","_ref","from","to","filtered","filter","entry","length","refProperty","Boolean","slotProxies","quasisMap","Map","_externalSlots$from$b","_externalSlots$from","_to$refSlot","_to$refPosition","insertBricks","bricks","refToSlot","refSlot","expandableSlot","size","i","push","set","refPosition","hostHasForEach","runtimeContext","__temporary_tpl_tag_name","setupTemplateExternalBricks","forEachItem","forEachIndex","_loop","slotName","type","slotConf","quasis","flatMap","index","concat","entries","hasForEach","_ref2","_childrenToSlots","children","a","b","c","brick","_objectWithoutProperties","_toPropertyKey","_objectSpread","Object","fromEntries","_ref3","_slotConf$bricks","routes","setupTemplateExternalRoutes","route"],"sources":["../../../../src/internal/CustomTemplates/setupTemplateProxy.ts"],"sourcesContent":["import type { BrickConf, RouteConf, SlotsConfOfBricks } from \"@next-core/types\";\nimport { hasOwnProperty } from \"@next-core/utils/general\";\nimport { clamp } from \"lodash\";\nimport {\n symbolForAsyncComputedPropsFromHost,\n symbolForTPlExternalForEachIndex,\n symbolForTPlExternalForEachItem,\n symbolForTPlExternalNoForEach,\n symbolForTplStateStoreId,\n type RuntimeBrickConfWithTplSymbols,\n} from \"./constants.js\";\nimport type { AsyncPropertyEntry, TemplateHostContext } from \"../interfaces.js\";\nimport { computePropertyValue } from \"../compute/computeRealProperties.js\";\nimport { childrenToSlots } from \"../Renderer.js\";\n\nexport function setupTemplateProxy(\n hostContext: TemplateHostContext,\n ref: string | undefined,\n slots: SlotsConfOfBricks\n) {\n const {\n reversedProxies,\n asyncHostPropertyEntries,\n externalSlots,\n tplStateStoreId,\n hostBrick,\n } = hostContext;\n\n let asyncComputedProps: AsyncPropertyEntry[] | undefined;\n\n if (ref && reversedProxies) {\n const propertyProxies = reversedProxies.properties.get(ref);\n if (propertyProxies) {\n const getComputedProps = (\n asyncHostProps: AsyncPropertyEntry[]\n ): AsyncPropertyEntry[] => {\n return propertyProxies!\n .map(({ from, to }) => {\n const filtered = asyncHostProps.filter(\n (entry) => entry[0] === from\n );\n if (filtered.length > 0 && to.refProperty) {\n return [\n to.refProperty,\n computePropertyValue(filtered, from),\n true,\n ];\n }\n })\n .filter(Boolean) as [string, Promise<unknown>][];\n };\n\n asyncComputedProps = getComputedProps(asyncHostPropertyEntries);\n }\n\n const slotProxies = reversedProxies.slots.get(ref);\n if (slotProxies && externalSlots) {\n // Use an approach like template-literal's quasis:\n // `quasi0${0}quais1${1}quasi2...`\n // Every quasi (indexed by `refPosition`) can be slotted with multiple bricks.\n const quasisMap = new Map<string, BrickConf[][]>();\n\n for (const { from, to } of slotProxies) {\n const insertBricks = externalSlots[from]?.bricks ?? [];\n if (!insertBricks.length) {\n continue;\n }\n const refToSlot = to.refSlot ?? from;\n let expandableSlot = quasisMap.get(refToSlot);\n if (!expandableSlot) {\n expandableSlot = [];\n // The size of quasis should be the existed slotted bricks' size plus one.\n const size = hasOwnProperty(slots, refToSlot)\n ? slots[refToSlot].bricks.length + 1\n : 1;\n for (let i = 0; i < size; i += 1) {\n expandableSlot.push([]);\n }\n quasisMap.set(refToSlot, expandableSlot);\n }\n const refPosition = to.refPosition ?? -1;\n // External bricks of a template, should not access the template internal forEach `ITEM`.\n // For some existing templates who is *USING* this bug, we keep the old behavior.\n const hostHasForEach = hasOwnProperty(\n hostBrick.runtimeContext,\n \"forEachItem\"\n );\n expandableSlot[\n clamp(\n refPosition < 0 ? expandableSlot.length + refPosition : refPosition,\n 0,\n expandableSlot.length - 1\n )\n ].push(\n ...((hostContext.__temporary_tpl_tag_name ===\n \"base-layout-v3.tpl-scroll-load-list\" ||\n hostContext.__temporary_tpl_tag_name ===\n \"shrcb-homepage.tpl-custom-scroll-load-list\") &&\n !hostHasForEach\n ? insertBricks\n : setupTemplateExternalBricks(\n insertBricks,\n hostHasForEach,\n hostBrick.runtimeContext.forEachItem,\n hostBrick.runtimeContext.forEachIndex!\n ))\n );\n }\n\n for (const [slotName, quasis] of quasisMap.entries()) {\n if (!hasOwnProperty(slots, slotName)) {\n slots[slotName] = {\n type: \"bricks\",\n bricks: [],\n };\n }\n const slotConf = slots[slotName];\n slotConf.bricks = quasis.flatMap((bricks, index) =>\n index < slotConf.bricks.length\n ? bricks.concat(slotConf.bricks[index])\n : bricks\n );\n\n if (slotConf.bricks.length === 0) {\n delete slots[slotName];\n }\n }\n }\n }\n\n return {\n [symbolForAsyncComputedPropsFromHost]: asyncComputedProps,\n [symbolForTplStateStoreId]: tplStateStoreId,\n };\n}\n\n// External bricks of a template, have the same forEachItem context as their host.\nfunction setupTemplateExternalBricks(\n bricks: BrickConf[],\n hasForEach: boolean,\n forEachItem: unknown,\n forEachIndex: number\n): BrickConf[] {\n return (bricks as RuntimeBrickConfWithTplSymbols[]).map(\n ({\n children,\n slots,\n [symbolForTPlExternalForEachItem]: a,\n [symbolForTPlExternalForEachIndex]: b,\n [symbolForTPlExternalNoForEach]: c,\n ...brick\n }) => ({\n ...brick,\n ...(hasForEach\n ? {\n [symbolForTPlExternalForEachItem]: forEachItem,\n [symbolForTPlExternalForEachIndex]: forEachIndex,\n }\n : {\n [symbolForTPlExternalNoForEach]: true,\n }),\n slots: Object.fromEntries(\n Object.entries(childrenToSlots(children, slots) ?? {}).map(\n ([slotName, slotConf]) => [\n slotName,\n slotConf.type === \"routes\"\n ? {\n type: \"routes\",\n routes: setupTemplateExternalRoutes(\n slotConf.routes,\n hasForEach,\n forEachItem,\n forEachIndex\n ),\n }\n : {\n type: \"bricks\",\n bricks: setupTemplateExternalBricks(\n slotConf.bricks ?? [],\n hasForEach,\n forEachItem,\n forEachIndex\n ),\n },\n ]\n )\n ),\n })\n );\n}\n\nfunction setupTemplateExternalRoutes(\n routes: RouteConf[],\n hasForEach: boolean,\n forEachItem: unknown,\n forEachIndex: number\n): RouteConf[] {\n return routes.map((route) =>\n route.type && route.type !== \"bricks\"\n ? route\n : {\n ...route,\n bricks: setupTemplateExternalBricks(\n route.bricks,\n hasForEach,\n forEachItem,\n forEachIndex\n ),\n }\n );\n}\n"],"mappings":";;;AACA,SAASA,cAAc,QAAQ,0BAA0B;AACzD,SAASC,KAAK,QAAQ,QAAQ;AAC9B,SACEC,mCAAmC,EACnCC,gCAAgC,EAChCC,+BAA+B,EAC/BC,6BAA6B,EAC7BC,wBAAwB,QAEnB,gBAAgB;AAEvB,SAASC,oBAAoB,QAAQ,qCAAqC;AAC1E,SAASC,eAAe,QAAQ,gBAAgB;AAEhD,OAAO,SAASC,kBAAkBA,CAChCC,WAAgC,EAChCC,GAAuB,EACvBC,KAAwB,EACxB;EACA,IAAM;IACJC,eAAe;IACfC,wBAAwB;IACxBC,aAAa;IACbC,eAAe;IACfC;EACF,CAAC,GAAGP,WAAW;EAEf,IAAIQ,kBAAoD;EAExD,IAAIP,GAAG,IAAIE,eAAe,EAAE;IAC1B,IAAMM,eAAe,GAAGN,eAAe,CAACO,UAAU,CAACC,GAAG,CAACV,GAAG,CAAC;IAC3D,IAAIQ,eAAe,EAAE;MACnB,IAAMG,gBAAgB,GACpBC,cAAoC,IACX;QACzB,OAAOJ,eAAe,CACnBK,GAAG,CAACC,IAAA,IAAkB;UAAA,IAAjB;YAAEC,IAAI;YAAEC;UAAG,CAAC,GAAAF,IAAA;UAChB,IAAMG,QAAQ,GAAGL,cAAc,CAACM,MAAM,CACnCC,KAAK,IAAKA,KAAK,CAAC,CAAC,CAAC,KAAKJ,IAC1B,CAAC;UACD,IAAI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,gBAAA,GAAI,CAAC,CAAC,CAAC,CAAC5C,GAAG,CACxDuD,KAAA;QAAA,IAAAC,gBAAA;QAAA,IAAC,CAACtB,QAAQ,EAAEE,QAAQ,CAAC,GAAAmB,KAAA;QAAA,OAAK,CACxBrB,QAAQ,EACRE,QAAQ,CAACD,IAAI,KAAK,QAAQ,GACtB;UACEA,IAAI,EAAE,QAAQ;UACdsB,MAAM,EAAEC,2BAA2B,CACjCtB,QAAQ,CAACqB,MAAM,EACff,UAAU,EACVX,WAAW,EACXC,YACF;QACF,CAAC,GACD;UACEG,IAAI,EAAE,QAAQ;UACdjB,MAAM,EAAEY,2BAA2B,EAAA0B,gBAAA,GACjCpB,QAAQ,CAAClB,MAAM,cAAAsC,gBAAA,cAAAA,gBAAA,GAAI,EAAE,EACrBd,UAAU,EACVX,WAAW,EACXC,YACF;QACF,CAAC,CACN;MAAA,CACH,CACF;IAAC;EAAA,CAEL,CAAC;AACH;AAEA,SAAS0B,2BAA2BA,CAClCD,MAAmB,EACnBf,UAAmB,EACnBX,WAAoB,EACpBC,YAAoB,EACP;EACb,OAAOyB,MAAM,CAACzD,GAAG,CAAE2D,KAAK,IACtBA,KAAK,CAACxB,IAAI,IAAIwB,KAAK,CAACxB,IAAI,KAAK,QAAQ,GACjCwB,KAAK,GAAAP,aAAA,CAAAA,aAAA,KAEAO,KAAK;IACRzC,MAAM,EAAEY,2BAA2B,CACjC6B,KAAK,CAACzC,MAAM,EACZwB,UAAU,EACVX,WAAW,EACXC,YACF;EAAC,EAET,CAAC;AACH"}
|
|
@@ -17,7 +17,7 @@ import { resolveData } from "./data/resolveData.js";
|
|
|
17
17
|
import { asyncComputeRealValue } from "./compute/computeRealValue.js";
|
|
18
18
|
import { listenOnTrackingContext } from "./compute/listenOnTrackingContext.js";
|
|
19
19
|
import { matchRoute, matchRoutes } from "./matchRoutes.js";
|
|
20
|
-
import { symbolForAsyncComputedPropsFromHost, symbolForTPlExternalForEachIndex, symbolForTPlExternalForEachItem, symbolForTplStateStoreId } from "./CustomTemplates/constants.js";
|
|
20
|
+
import { symbolForAsyncComputedPropsFromHost, symbolForTPlExternalForEachIndex, symbolForTPlExternalForEachItem, symbolForTPlExternalNoForEach, symbolForTplStateStoreId } from "./CustomTemplates/constants.js";
|
|
21
21
|
import { expandCustomTemplate } from "./CustomTemplates/expandCustomTemplate.js";
|
|
22
22
|
import { getTagNameOfCustomTemplate, getTplStateStore } from "./CustomTemplates/utils.js";
|
|
23
23
|
import { customTemplates } from "../CustomTemplates.js";
|
|
@@ -181,6 +181,9 @@ function _renderBrick() {
|
|
|
181
181
|
// `forEachIndex` from their host.
|
|
182
182
|
runtimeContext.forEachItem = brickConf[symbolForTPlExternalForEachItem];
|
|
183
183
|
runtimeContext.forEachIndex = brickConf[symbolForTPlExternalForEachIndex];
|
|
184
|
+
} else if (brickConf[symbolForTPlExternalNoForEach]) {
|
|
185
|
+
delete runtimeContext.forEachItem;
|
|
186
|
+
delete runtimeContext.forEachIndex;
|
|
184
187
|
}
|
|
185
188
|
var {
|
|
186
189
|
context
|