@next-core/runtime 1.31.1 → 1.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/internal/RendererContext.js +92 -123
- package/dist/cjs/internal/RendererContext.js.map +1 -1
- package/dist/cjs/internal/Router.js +70 -110
- package/dist/cjs/internal/Router.js.map +1 -1
- package/dist/cjs/internal/Runtime.js +13 -19
- package/dist/cjs/internal/Runtime.js.map +1 -1
- package/dist/cjs/setWatermark.js +47 -0
- package/dist/cjs/setWatermark.js.map +1 -0
- package/dist/esm/CustomProcessors.js +6 -8
- package/dist/esm/CustomProcessors.js.map +1 -1
- package/dist/esm/CustomTemplates.js +6 -8
- package/dist/esm/CustomTemplates.js.map +1 -1
- package/dist/esm/internal/RendererContext.js +92 -123
- package/dist/esm/internal/RendererContext.js.map +1 -1
- package/dist/esm/internal/Router.js +78 -118
- package/dist/esm/internal/Router.js.map +1 -1
- package/dist/esm/internal/Runtime.js +13 -19
- package/dist/esm/internal/Runtime.js.map +1 -1
- package/dist/esm/setWatermark.js +40 -0
- package/dist/esm/setWatermark.js.map +1 -0
- package/dist/types/setWatermark.d.ts +2 -0
- package/dist/types/tsdoc-metadata.json +1 -1
- package/package.json +13 -13
|
@@ -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","_storyboards","WeakMap","_rendering","_prevLocation","_nextLocation","_runtimeContext","_rendererContext","_rendererContextTrashCan","_redirectCount","_renderId","_currentApp","_previousApp","_navConfig","_getBlockMessageBeforePageLave","WeakSet","_safeRedirect","_queuedRender","_render","Router","constructor","storyboards","_classPrivateMethodInitSpec2","default","_classPrivateFieldInitSpec2","writable","value","Set","_classPrivateFieldSet2","history","getHistory","window","addEventListener","event","message","_classPrivateMethodGet2","_getBlockMessageBeforePageLave2","call","preventDefault","returnValue","block","location","action","getRenderId","_classPrivateFieldGet7","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","_queuedRender2","catch","handleHttpError","exports","detail","_classPrivateFieldGet5","previousMessage","getBlockMessage","dispatchBeforePageLeave","unblock","_safeRedirect2","to","from","_this$redirectCount","_this$redirectCount2","search","process","env","NODE_ENV","console","error","Error","replace","_render2","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","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\";\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 // 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,GAAArB,OAAA;AACA,IAAAsB,SAAA,GAAAtB,OAAA;AACA,IAAAuB,aAAA,GAAAvB,OAAA;AACA,IAAAwB,eAAA,GAAAxB,OAAA;AAAsD,IAAAyB,YAAA,oBAAAC,OAAA;AAAA,IAAAC,UAAA,oBAAAD,OAAA;AAAA,IAAAE,aAAA,oBAAAF,OAAA;AAAA,IAAAG,aAAA,oBAAAH,OAAA;AAAA,IAAAI,eAAA,oBA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BAAU,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;EACA5G,MAAM,CAAC+M,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;EACrB7H,cAAc,aAAdA,cAAc,eAAdA,cAAc,CAAG;IAAEkB,MAAM,EAAE;EAAY,CAAC,CAAC;EACzC,IAAAtD,0BAAgB,EAAC,UAAU,CAAC;AAC9B;AAGF,SAASuG,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
|
+
{"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,GAAArB,OAAA;AACA,IAAAsB,SAAA,GAAAtB,OAAA;AACA,IAAAuB,aAAA,GA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AAMC,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"}
|
|
@@ -17,9 +17,6 @@ exports.hooks = exports.getRuntime = void 0;
|
|
|
17
17
|
var _classPrivateMethodInitSpec2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateMethodInitSpec"));
|
|
18
18
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
19
19
|
var _classPrivateFieldInitSpec2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldInitSpec"));
|
|
20
|
-
var _classPrivateMethodGet2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateMethodGet"));
|
|
21
|
-
var _classPrivateFieldSet2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldSet"));
|
|
22
|
-
var _classPrivateFieldGet2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldGet"));
|
|
23
20
|
var _i18n = require("@next-core/i18n");
|
|
24
21
|
var _loader = require("@next-core/loader");
|
|
25
22
|
var _general = require("@next-core/utils/general");
|
|
@@ -36,6 +33,9 @@ var _hasInstalledApp = require("./hasInstalledApp.js");
|
|
|
36
33
|
var _devtools = require("./devtools.js");
|
|
37
34
|
var _getV2RuntimeFromDll = require("../getV2RuntimeFromDll.js");
|
|
38
35
|
var _customizeColorTheme = require("./customizeColorTheme.js");
|
|
36
|
+
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
|
37
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
38
|
+
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
39
39
|
let runtime;
|
|
40
40
|
|
|
41
41
|
// Allow inject bootstrap data in a runtime other than Brick Next.
|
|
@@ -94,32 +94,26 @@ function getRuntimeV2Factory() {
|
|
|
94
94
|
const getRuntime = exports.getRuntime = getRuntimeV2Factory() || getRuntimeV3;
|
|
95
95
|
var _initialized = /*#__PURE__*/new WeakMap();
|
|
96
96
|
var _bootstrapped = /*#__PURE__*/new WeakMap();
|
|
97
|
-
var
|
|
97
|
+
var _Runtime_brand = /*#__PURE__*/new WeakSet();
|
|
98
98
|
class Runtime {
|
|
99
99
|
constructor() {
|
|
100
|
-
(0, _classPrivateMethodInitSpec2.default)(this,
|
|
101
|
-
(0, _classPrivateFieldInitSpec2.default)(this, _initialized,
|
|
102
|
-
|
|
103
|
-
value: false
|
|
104
|
-
});
|
|
105
|
-
(0, _classPrivateFieldInitSpec2.default)(this, _bootstrapped, {
|
|
106
|
-
writable: true,
|
|
107
|
-
value: false
|
|
108
|
-
});
|
|
100
|
+
(0, _classPrivateMethodInitSpec2.default)(this, _Runtime_brand);
|
|
101
|
+
(0, _classPrivateFieldInitSpec2.default)(this, _initialized, false);
|
|
102
|
+
(0, _classPrivateFieldInitSpec2.default)(this, _bootstrapped, false);
|
|
109
103
|
(0, _defineProperty2.default)(this, "version", 3);
|
|
110
104
|
}
|
|
111
105
|
initialize(data) {
|
|
112
106
|
var _data$settings;
|
|
113
|
-
if ((
|
|
107
|
+
if (_classPrivateFieldGet(_initialized, this)) {
|
|
114
108
|
throw new Error("The runtime cannot be initialized more than once");
|
|
115
109
|
}
|
|
116
|
-
(
|
|
110
|
+
_classPrivateFieldSet(_initialized, this, true);
|
|
117
111
|
normalizeBootstrapData(data);
|
|
118
112
|
bootstrapData = data;
|
|
119
113
|
const {
|
|
120
114
|
notification,
|
|
121
115
|
dialog
|
|
122
|
-
} = (
|
|
116
|
+
} = _assertClassBrand(_Runtime_brand, this, _getPresetBricks).call(this);
|
|
123
117
|
if (notification !== false) {
|
|
124
118
|
(0, _Notification.loadNotificationService)(notification !== null && notification !== void 0 ? notification : "basic.show-notification", this.loadBricks);
|
|
125
119
|
}
|
|
@@ -132,10 +126,10 @@ class Runtime {
|
|
|
132
126
|
if (data) {
|
|
133
127
|
this.initialize(data);
|
|
134
128
|
}
|
|
135
|
-
if ((
|
|
129
|
+
if (_classPrivateFieldGet(_bootstrapped, this)) {
|
|
136
130
|
throw new Error("The runtime cannot be bootstrapped more than once");
|
|
137
131
|
}
|
|
138
|
-
(
|
|
132
|
+
_classPrivateFieldSet(_bootstrapped, this, true);
|
|
139
133
|
router = new _Router.Router(bootstrapData.storyboards);
|
|
140
134
|
await router.bootstrap();
|
|
141
135
|
}
|
|
@@ -204,7 +198,7 @@ class Runtime {
|
|
|
204
198
|
}
|
|
205
199
|
}
|
|
206
200
|
exports.Runtime = Runtime;
|
|
207
|
-
function
|
|
201
|
+
function _getPresetBricks() {
|
|
208
202
|
var _bootstrapData$settin, _bootstrapData10;
|
|
209
203
|
return (_bootstrapData$settin = (_bootstrapData10 = bootstrapData) === null || _bootstrapData10 === void 0 || (_bootstrapData10 = _bootstrapData10.settings) === null || _bootstrapData10 === void 0 ? void 0 : _bootstrapData10.presetBricks) !== null && _bootstrapData$settin !== void 0 ? _bootstrapData$settin : {};
|
|
210
204
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Runtime.js","names":["_i18n","require","_loader","_general","_moment","_interopRequireDefault","_history","_matchStoryboard","_Router","_i18n2","_Notification","_Dialog","_injected","_hasInstalledApp","_devtools","_getV2RuntimeFromDll","_customizeColorTheme","runtime","bootstrapData","router","hooks","exports","createRuntime","options","Error","listenDevtoolsEagerly","initializeI18n","NS","locales","moment","locale","i18n","language","on","createHistory","Runtime","getRuntimeV3","getRuntimeV2Factory","v2Kit","getV2RuntimeFromDll","getRuntimeV2","Proxy","getRuntime","get","args","key","Reflect","_initialized","WeakMap","_bootstrapped","_getPresetBricks","WeakSet","constructor","_classPrivateMethodInitSpec2","default","_classPrivateFieldInitSpec2","writable","value","_defineProperty2","initialize","data","_data$settings","_classPrivateFieldGet2","_classPrivateFieldSet2","normalizeBootstrapData","notification","dialog","_classPrivateMethodGet2","_getPresetBricks2","call","loadNotificationService","loadBricks","loadDialogService","customizeColorTheme","settings","misc","theme","bootstrap","Router","storyboards","getRecentApps","_router$getRecentApps","_router","getCurrentApp","_router2","currentApp","hasInstalledApp","appId","matchVersion","getFeatureFlags","_bootstrapData","_router3","featureFlags","config","getMiscSettings","_bootstrapData2","_router4","getBrandSettings","_bootstrapData3","base_title","brand","getLaunchpadSettings","_bootstrapData4","columns","rows","launchpad","getDesktops","_bootstrapData$deskto","_bootstrapData5","desktops","getLaunchpadSiteMap","_bootstrapData$siteSo","_bootstrapData6","siteSort","toggleLaunchpadEffect","open","document","body","classList","toggle","applyPageTitle","pageTitle","baseTitle","title","getNavConfig","_router5","bricks","loadBricksImperatively","getBrickPackages","_bootstrapData$settin","_bootstrapData10","presetBricks","Array","isArray","app","ns","id","Object","entries","forEach","lang","resources","addResourceBundle","localeName","getFixedT","name","keys","removeResourceBundle","isObject","deepFreeze","brickPackages","_ref","_ref2","_bootstrapData$brickP","_bootstrapData7","injectedBrickPackages","window","STANDALONE_BRICK_PACKAGES","_internalApiGetRenderId","_router6","getRenderId","_internalApiMatchStoryboard","pathname","_bootstrapData$storyb","_bootstrapData8","matchStoryboard","_internalApiGetRuntimeContext","_router7","getRuntimeContext","_internalApiGetStoryboardInBootstrapData","_bootstrapData9","find","storyboard","_internalApiGetAppInBootstrapData","_internalApiGetStoryb","_test_only_setBootstrapData","process","env","NODE_ENV"],"sources":["../../../src/internal/Runtime.ts"],"sourcesContent":["import type {\n RuntimeStoryboard,\n BootstrapSettings,\n FeatureFlags,\n BootstrapData,\n Contract,\n Storyboard,\n BrickConf,\n RouteConf,\n ResolveConf,\n BrickPackage,\n} from \"@next-core/types\";\nimport { i18n, initializeI18n } from \"@next-core/i18n\";\nimport { loadBricksImperatively } from \"@next-core/loader\";\nimport { deepFreeze, isObject } from \"@next-core/utils/general\";\nimport type { PermissionApi_validatePermissions } from \"@next-api-sdk/micro-app-sdk\";\nimport moment from \"moment\";\nimport \"moment/locale/zh-cn.js\";\nimport { createHistory } from \"../history.js\";\nimport { matchStoryboard } from \"./matchStoryboard.js\";\nimport { Router } from \"./Router.js\";\nimport { NS, locales } from \"./i18n.js\";\nimport { loadNotificationService } from \"../Notification.js\";\nimport { loadDialogService } from \"../Dialog.js\";\nimport { injectedBrickPackages } from \"./injected.js\";\nimport { type AppForCheck, hasInstalledApp } from \"./hasInstalledApp.js\";\nimport type { RuntimeContext } from \"./interfaces.js\";\nimport { listenDevtoolsEagerly } from \"./devtools.js\";\nimport { getV2RuntimeFromDll } from \"../getV2RuntimeFromDll.js\";\nimport { ThemeSettings, customizeColorTheme } from \"./customizeColorTheme.js\";\n\nlet runtime: Runtime;\n\n// Allow inject bootstrap data in a runtime other than Brick Next.\nlet bootstrapData: BootstrapData | undefined;\nlet router: Router | undefined;\n\nexport interface RuntimeOptions {\n hooks?: RuntimeHooks;\n}\n\nexport interface ImagesFactory {\n get(name: string): string;\n}\n\nexport interface PageViewInfo {\n status: \"ok\" | \"failed\" | \"redirected\" | \"not-found\";\n path?: string;\n pageTitle?: string;\n}\n\nexport interface RuntimeHooks {\n auth?: {\n getAuth(): object;\n isLoggedIn(): boolean;\n authenticate?(...args: unknown[]): unknown;\n logout?(...args: unknown[]): unknown;\n };\n fulfilStoryboard?: (storyboard: RuntimeStoryboard) => Promise<void>;\n validatePermissions?: typeof PermissionApi_validatePermissions;\n checkPermissions?: {\n checkPermissions(...actions: string[]): boolean;\n preCheckPermissions(storyboard: Storyboard): Promise<void> | undefined;\n preCheckPermissionsForBrickOrRoute(\n container: BrickConf | RouteConf,\n asyncComputeRealValue: (value: unknown) => Promise<unknown>\n ): Promise<void> | undefined;\n };\n checkInstalledApps?: {\n preCheckInstalledApps(\n storyboard: Storyboard,\n hasAppInBootstrap: (appId: string) => boolean\n ): void;\n waitForCheckingApps(appIds: string[]): Promise<void>;\n getCheckedApp(appId: string): AppForCheck | undefined;\n };\n flowApi?: {\n FLOW_API_PROVIDER: string;\n registerFlowApiProvider(): void;\n isFlowApiProvider(provider: string): boolean;\n getArgsOfFlowApi(\n provider: string,\n originalArgs: unknown[],\n method?: string\n ): Promise<unknown[]>;\n collectContract(contracts: Contract[] | undefined): void;\n collectWidgetContract(contracts: Contract[] | undefined): void;\n clearCollectWidgetContract(): void;\n };\n menu?: {\n getMenuById(menuId: string): unknown;\n fetchMenuById(\n menuId: string,\n runtimeContext: RuntimeContext,\n runtimeHelpers: RuntimeHooksMenuHelpers\n ): Promise<unknown>;\n };\n images?: {\n imagesFactory(\n appId: string,\n isBuildPush?: boolean,\n version?: string\n ): ImagesFactory;\n widgetImagesFactory(\n widgetId: string,\n widgetVersion?: string\n ): ImagesFactory;\n };\n messageDispatcher?: {\n subscribe(...args: unknown[]): Promise<unknown>;\n unsubscribe(...args: unknown[]): Promise<unknown>;\n onMessage(channel: string, listener: (data: unknown) => void): void;\n onClose(listener: () => void): void;\n reset(): void;\n };\n pageView?: {\n create(): (info: PageViewInfo) => void;\n };\n}\n\nexport interface RuntimeHooksMenuHelpers {\n getStoryboardByAppId(appId: string): Storyboard | undefined;\n resolveData(\n resolveConf: ResolveConf,\n runtimeContext: RuntimeContext\n ): Promise<unknown>;\n asyncComputeRealValue(\n value: unknown,\n runtimeContext: RuntimeContext,\n options?: { ignoreSymbols?: boolean; noInject?: boolean }\n ): Promise<unknown>;\n}\n\nexport let hooks: RuntimeHooks | undefined;\n\nexport function createRuntime(options?: RuntimeOptions) {\n if (runtime) {\n throw new Error(\"Cannot create multiple runtimes\");\n }\n listenDevtoolsEagerly();\n hooks = options?.hooks;\n initializeI18n(NS, locales);\n moment.locale(i18n.language);\n i18n.on(\"languageChanged\", () => {\n moment.locale(i18n.language);\n });\n createHistory();\n runtime = new Runtime();\n return runtime;\n}\n\nfunction getRuntimeV3() {\n return runtime;\n}\n\n// istanbul ignore next\nfunction getRuntimeV2Factory() {\n const v2Kit = getV2RuntimeFromDll();\n if (v2Kit) {\n return function getRuntimeV2() {\n return new Proxy(v2Kit.getRuntime(), {\n get(...args) {\n const key = args[1];\n switch (key) {\n case \"getCurrentApp\":\n case \"getRecentApps\":\n case \"hasInstalledApp\":\n case \"getDesktops\":\n case \"getLaunchpadSettings\":\n case \"getLaunchpadSiteMap\":\n case \"toggleLaunchpadEffect\":\n case \"applyPageTitle\":\n case \"getNavConfig\":\n case \"getFeatureFlags\":\n case \"getMiscSettings\":\n case \"getBrandSettings\":\n return Reflect.get(...args);\n }\n },\n }) as unknown as Runtime;\n };\n }\n}\n\n// istanbul ignore next\nexport const getRuntime = getRuntimeV2Factory() || getRuntimeV3;\n\nexport class Runtime {\n #initialized = false;\n #bootstrapped = false;\n\n readonly version: number | undefined = 3;\n\n initialize(data: BootstrapData) {\n if (this.#initialized) {\n throw new Error(\"The runtime cannot be initialized more than once\");\n }\n this.#initialized = true;\n normalizeBootstrapData(data);\n bootstrapData = data;\n const { notification, dialog } = this.#getPresetBricks();\n if (notification !== false) {\n loadNotificationService(\n notification ?? \"basic.show-notification\",\n this.loadBricks\n );\n }\n if (dialog !== false) {\n loadDialogService(dialog ?? \"basic.show-dialog\", this.loadBricks);\n }\n customizeColorTheme(data.settings?.misc?.theme as ThemeSettings);\n }\n\n async bootstrap(data?: BootstrapData) {\n if (data) {\n this.initialize(data);\n }\n if (this.#bootstrapped) {\n throw new Error(\"The runtime cannot be bootstrapped more than once\");\n }\n this.#bootstrapped = true;\n router = new Router(bootstrapData!.storyboards!);\n await router.bootstrap();\n }\n\n getRecentApps() {\n return router?.getRecentApps() ?? {};\n }\n\n getCurrentApp() {\n return router?.getRecentApps().currentApp;\n }\n\n hasInstalledApp(appId: string, matchVersion?: string): boolean {\n return hasInstalledApp(appId, matchVersion);\n }\n\n getFeatureFlags(): FeatureFlags {\n return {\n ...bootstrapData?.settings?.featureFlags,\n ...(\n router?.getRecentApps().currentApp?.config\n ?.settings as BootstrapSettings\n )?.featureFlags,\n \"migrate-to-brick-next-v3\": true,\n };\n }\n\n getMiscSettings() {\n return {\n ...bootstrapData?.settings?.misc,\n ...(\n router?.getRecentApps().currentApp?.config\n ?.settings as BootstrapSettings\n )?.misc,\n };\n }\n\n getBrandSettings(): Record<string, string> {\n return {\n base_title: \"DevOps 管理专家\",\n ...(bootstrapData?.settings?.brand as Record<string, string>),\n };\n }\n\n getLaunchpadSettings() {\n return {\n columns: 7,\n rows: 4,\n ...bootstrapData?.settings?.launchpad,\n };\n }\n\n getDesktops(): unknown[] {\n return bootstrapData?.desktops ?? [];\n }\n\n getLaunchpadSiteMap(): unknown[] {\n return bootstrapData?.siteSort ?? [];\n }\n\n toggleLaunchpadEffect(open: boolean): void {\n document.body.classList.toggle(\"launchpad-open\", open);\n }\n\n applyPageTitle(pageTitle: string): void {\n const baseTitle = this.getBrandSettings().base_title;\n document.title = pageTitle ? `${pageTitle} - ${baseTitle}` : baseTitle;\n }\n\n getNavConfig() {\n return router?.getNavConfig();\n }\n\n loadBricks(bricks: string[] | Set<string>) {\n return loadBricksImperatively(bricks, getBrickPackages());\n }\n\n #getPresetBricks() {\n return (bootstrapData?.settings?.presetBricks ?? {}) as {\n notification?: string | false;\n dialog?: string | false;\n };\n }\n}\n\nfunction normalizeBootstrapData(data: BootstrapData) {\n if (Array.isArray(data.storyboards)) {\n for (const { app } of data.storyboards) {\n if (app.locales) {\n // Prefix to avoid conflict between brick package's i18n namespace.\n const ns = `tmp/${app.id}`;\n // Support any languages in `app.locales`.\n Object.entries(app.locales).forEach(([lang, resources]) => {\n i18n.addResourceBundle(lang, ns, resources);\n });\n // Use `app.name` as the fallback `app.localeName`.\n app.localeName = i18n.getFixedT(null, ns)(\"name\", app.name) as string;\n // Remove the temporary i18n resource bundles.\n Object.keys(app.locales).forEach((lang) => {\n i18n.removeResourceBundle(lang, ns);\n });\n } else {\n app.localeName = app.name;\n }\n }\n }\n if (isObject(data.settings)) {\n deepFreeze(data.settings);\n }\n if (data.brickPackages) {\n deepFreeze(data.brickPackages);\n }\n}\n\nexport function getBrickPackages() {\n return (\n bootstrapData?.brickPackages ??\n injectedBrickPackages ??\n (window.STANDALONE_BRICK_PACKAGES as BrickPackage[]) ??\n []\n );\n}\n\nexport function _internalApiGetRenderId(): string | undefined {\n return router?.getRenderId();\n}\n\nexport function _internalApiMatchStoryboard(\n pathname: string\n): RuntimeStoryboard | undefined {\n return matchStoryboard(bootstrapData?.storyboards ?? [], pathname);\n}\n\nexport function _internalApiGetRuntimeContext() {\n return router?.getRuntimeContext();\n}\n\nexport function _internalApiGetStoryboardInBootstrapData(appId: string) {\n return bootstrapData?.storyboards?.find(\n (storyboard) => storyboard.app.id === appId\n );\n}\n\nexport function _internalApiGetAppInBootstrapData(appId: string) {\n return _internalApiGetStoryboardInBootstrapData(appId)?.app;\n}\n\nexport let _test_only_setBootstrapData: (data: BootstrapData) => void;\n\n// istanbul ignore next\nif (process.env.NODE_ENV === \"test\") {\n _test_only_setBootstrapData = (data) => {\n bootstrapData = data as BootstrapData;\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAYA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACAA,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,gBAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,aAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,SAAA,GAAAX,OAAA;AACA,IAAAY,gBAAA,GAAAZ,OAAA;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QAAAA,QAAA,GAAOpJ,MAAM,cAAAoJ,QAAA,uBAANA,QAAA,CAAQC,iBAAiB,CAAC,CAAC;AACpC;AAEO,SAASC,wCAAwCA,CAAClF,KAAa,EAAE;EAAA,IAAAmF,eAAA;EACtE,QAAAA,eAAA,GAAOxJ,aAAa,cAAAwJ,eAAA,gBAAAA,eAAA,GAAbA,eAAA,CAAe3F,WAAW,cAAA2F,eAAA,uBAA1BA,eAAA,CAA4BC,IAAI,CACpCC,UAAU,IAAKA,UAAU,CAACtC,GAAG,CAACE,EAAE,KAAKjD,KACxC,CAAC;AACH;AAEO,SAASsF,iCAAiCA,CAACtF,KAAa,EAAE;EAAA,IAAAuF,qBAAA;EAC/D,QAAAA,qBAAA,GAAOL,wCAAwC,CAAClF,KAAK,CAAC,cAAAuF,qBAAA,uBAA/CA,qBAAA,CAAiDxC,GAAG;AAC7D;AAEO,IAAIyC,2BAA0D,GAAA1J,OAAA,CAAA0J,2BAAA;;AAErE;AACA,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,MAAM,EAAE;EACnC7J,OAAA,CAAA0J,2BAAA,GAAAA,2BAA2B,GAAInH,IAAI,IAAK;IACtC1C,aAAa,GAAG0C,IAAqB;EACvC,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"Runtime.js","names":["_i18n","require","_loader","_general","_moment","_interopRequireDefault","_history","_matchStoryboard","_Router","_i18n2","_Notification","_Dialog","_injected","_hasInstalledApp","_devtools","_getV2RuntimeFromDll","_customizeColorTheme","_classPrivateFieldSet","s","a","r","set","_assertClassBrand","_classPrivateFieldGet","get","e","t","n","has","arguments","length","TypeError","runtime","bootstrapData","router","hooks","exports","createRuntime","options","Error","listenDevtoolsEagerly","initializeI18n","NS","locales","moment","locale","i18n","language","on","createHistory","Runtime","getRuntimeV3","getRuntimeV2Factory","v2Kit","getV2RuntimeFromDll","getRuntimeV2","Proxy","getRuntime","args","key","Reflect","_initialized","WeakMap","_bootstrapped","_Runtime_brand","WeakSet","constructor","_classPrivateMethodInitSpec2","default","_classPrivateFieldInitSpec2","_defineProperty2","initialize","data","_data$settings","normalizeBootstrapData","notification","dialog","_getPresetBricks","call","loadNotificationService","loadBricks","loadDialogService","customizeColorTheme","settings","misc","theme","bootstrap","Router","storyboards","getRecentApps","_router$getRecentApps","_router","getCurrentApp","_router2","currentApp","hasInstalledApp","appId","matchVersion","getFeatureFlags","_bootstrapData","_router3","featureFlags","config","getMiscSettings","_bootstrapData2","_router4","getBrandSettings","_bootstrapData3","base_title","brand","getLaunchpadSettings","_bootstrapData4","columns","rows","launchpad","getDesktops","_bootstrapData$deskto","_bootstrapData5","desktops","getLaunchpadSiteMap","_bootstrapData$siteSo","_bootstrapData6","siteSort","toggleLaunchpadEffect","open","document","body","classList","toggle","applyPageTitle","pageTitle","baseTitle","title","getNavConfig","_router5","bricks","loadBricksImperatively","getBrickPackages","_bootstrapData$settin","_bootstrapData10","presetBricks","Array","isArray","app","ns","id","Object","entries","forEach","lang","resources","addResourceBundle","localeName","getFixedT","name","keys","removeResourceBundle","isObject","deepFreeze","brickPackages","_ref","_ref2","_bootstrapData$brickP","_bootstrapData7","injectedBrickPackages","window","STANDALONE_BRICK_PACKAGES","_internalApiGetRenderId","_router6","getRenderId","_internalApiMatchStoryboard","pathname","_bootstrapData$storyb","_bootstrapData8","matchStoryboard","_internalApiGetRuntimeContext","_router7","getRuntimeContext","_internalApiGetStoryboardInBootstrapData","_bootstrapData9","find","storyboard","_internalApiGetAppInBootstrapData","_internalApiGetStoryb","_test_only_setBootstrapData","process","env","NODE_ENV"],"sources":["../../../src/internal/Runtime.ts"],"sourcesContent":["import type {\n RuntimeStoryboard,\n BootstrapSettings,\n FeatureFlags,\n BootstrapData,\n Contract,\n Storyboard,\n BrickConf,\n RouteConf,\n ResolveConf,\n BrickPackage,\n} from \"@next-core/types\";\nimport { i18n, initializeI18n } from \"@next-core/i18n\";\nimport { loadBricksImperatively } from \"@next-core/loader\";\nimport { deepFreeze, isObject } from \"@next-core/utils/general\";\nimport type { PermissionApi_validatePermissions } from \"@next-api-sdk/micro-app-sdk\";\nimport moment from \"moment\";\nimport \"moment/locale/zh-cn.js\";\nimport { createHistory } from \"../history.js\";\nimport { matchStoryboard } from \"./matchStoryboard.js\";\nimport { Router } from \"./Router.js\";\nimport { NS, locales } from \"./i18n.js\";\nimport { loadNotificationService } from \"../Notification.js\";\nimport { loadDialogService } from \"../Dialog.js\";\nimport { injectedBrickPackages } from \"./injected.js\";\nimport { type AppForCheck, hasInstalledApp } from \"./hasInstalledApp.js\";\nimport type { RuntimeContext } from \"./interfaces.js\";\nimport { listenDevtoolsEagerly } from \"./devtools.js\";\nimport { getV2RuntimeFromDll } from \"../getV2RuntimeFromDll.js\";\nimport { ThemeSettings, customizeColorTheme } from \"./customizeColorTheme.js\";\n\nlet runtime: Runtime;\n\n// Allow inject bootstrap data in a runtime other than Brick Next.\nlet bootstrapData: BootstrapData | undefined;\nlet router: Router | undefined;\n\nexport interface RuntimeOptions {\n hooks?: RuntimeHooks;\n}\n\nexport interface ImagesFactory {\n get(name: string): string;\n}\n\nexport interface PageViewInfo {\n status: \"ok\" | \"failed\" | \"redirected\" | \"not-found\";\n path?: string;\n pageTitle?: string;\n}\n\nexport interface RuntimeHooks {\n auth?: {\n getAuth(): object;\n isLoggedIn(): boolean;\n authenticate?(...args: unknown[]): unknown;\n logout?(...args: unknown[]): unknown;\n };\n fulfilStoryboard?: (storyboard: RuntimeStoryboard) => Promise<void>;\n validatePermissions?: typeof PermissionApi_validatePermissions;\n checkPermissions?: {\n checkPermissions(...actions: string[]): boolean;\n preCheckPermissions(storyboard: Storyboard): Promise<void> | undefined;\n preCheckPermissionsForBrickOrRoute(\n container: BrickConf | RouteConf,\n asyncComputeRealValue: (value: unknown) => Promise<unknown>\n ): Promise<void> | undefined;\n };\n checkInstalledApps?: {\n preCheckInstalledApps(\n storyboard: Storyboard,\n hasAppInBootstrap: (appId: string) => boolean\n ): void;\n waitForCheckingApps(appIds: string[]): Promise<void>;\n getCheckedApp(appId: string): AppForCheck | undefined;\n };\n flowApi?: {\n FLOW_API_PROVIDER: string;\n registerFlowApiProvider(): void;\n isFlowApiProvider(provider: string): boolean;\n getArgsOfFlowApi(\n provider: string,\n originalArgs: unknown[],\n method?: string\n ): Promise<unknown[]>;\n collectContract(contracts: Contract[] | undefined): void;\n collectWidgetContract(contracts: Contract[] | undefined): void;\n clearCollectWidgetContract(): void;\n };\n menu?: {\n getMenuById(menuId: string): unknown;\n fetchMenuById(\n menuId: string,\n runtimeContext: RuntimeContext,\n runtimeHelpers: RuntimeHooksMenuHelpers\n ): Promise<unknown>;\n };\n images?: {\n imagesFactory(\n appId: string,\n isBuildPush?: boolean,\n version?: string\n ): ImagesFactory;\n widgetImagesFactory(\n widgetId: string,\n widgetVersion?: string\n ): ImagesFactory;\n };\n messageDispatcher?: {\n subscribe(...args: unknown[]): Promise<unknown>;\n unsubscribe(...args: unknown[]): Promise<unknown>;\n onMessage(channel: string, listener: (data: unknown) => void): void;\n onClose(listener: () => void): void;\n reset(): void;\n };\n pageView?: {\n create(): (info: PageViewInfo) => void;\n };\n}\n\nexport interface RuntimeHooksMenuHelpers {\n getStoryboardByAppId(appId: string): Storyboard | undefined;\n resolveData(\n resolveConf: ResolveConf,\n runtimeContext: RuntimeContext\n ): Promise<unknown>;\n asyncComputeRealValue(\n value: unknown,\n runtimeContext: RuntimeContext,\n options?: { ignoreSymbols?: boolean; noInject?: boolean }\n ): Promise<unknown>;\n}\n\nexport let hooks: RuntimeHooks | undefined;\n\nexport function createRuntime(options?: RuntimeOptions) {\n if (runtime) {\n throw new Error(\"Cannot create multiple runtimes\");\n }\n listenDevtoolsEagerly();\n hooks = options?.hooks;\n initializeI18n(NS, locales);\n moment.locale(i18n.language);\n i18n.on(\"languageChanged\", () => {\n moment.locale(i18n.language);\n });\n createHistory();\n runtime = new Runtime();\n return runtime;\n}\n\nfunction getRuntimeV3() {\n return runtime;\n}\n\n// istanbul ignore next\nfunction getRuntimeV2Factory() {\n const v2Kit = getV2RuntimeFromDll();\n if (v2Kit) {\n return function getRuntimeV2() {\n return new Proxy(v2Kit.getRuntime(), {\n get(...args) {\n const key = args[1];\n switch (key) {\n case \"getCurrentApp\":\n case \"getRecentApps\":\n case \"hasInstalledApp\":\n case \"getDesktops\":\n case \"getLaunchpadSettings\":\n case \"getLaunchpadSiteMap\":\n case \"toggleLaunchpadEffect\":\n case \"applyPageTitle\":\n case \"getNavConfig\":\n case \"getFeatureFlags\":\n case \"getMiscSettings\":\n case \"getBrandSettings\":\n return Reflect.get(...args);\n }\n },\n }) as unknown as Runtime;\n };\n }\n}\n\n// istanbul ignore next\nexport const getRuntime = getRuntimeV2Factory() || getRuntimeV3;\n\nexport class Runtime {\n #initialized = false;\n #bootstrapped = false;\n\n readonly version: number | undefined = 3;\n\n initialize(data: BootstrapData) {\n if (this.#initialized) {\n throw new Error(\"The runtime cannot be initialized more than once\");\n }\n this.#initialized = true;\n normalizeBootstrapData(data);\n bootstrapData = data;\n const { notification, dialog } = this.#getPresetBricks();\n if (notification !== false) {\n loadNotificationService(\n notification ?? \"basic.show-notification\",\n this.loadBricks\n );\n }\n if (dialog !== false) {\n loadDialogService(dialog ?? \"basic.show-dialog\", this.loadBricks);\n }\n customizeColorTheme(data.settings?.misc?.theme as ThemeSettings);\n }\n\n async bootstrap(data?: BootstrapData) {\n if (data) {\n this.initialize(data);\n }\n if (this.#bootstrapped) {\n throw new Error(\"The runtime cannot be bootstrapped more than once\");\n }\n this.#bootstrapped = true;\n router = new Router(bootstrapData!.storyboards!);\n await router.bootstrap();\n }\n\n getRecentApps() {\n return router?.getRecentApps() ?? {};\n }\n\n getCurrentApp() {\n return router?.getRecentApps().currentApp;\n }\n\n hasInstalledApp(appId: string, matchVersion?: string): boolean {\n return hasInstalledApp(appId, matchVersion);\n }\n\n getFeatureFlags(): FeatureFlags {\n return {\n ...bootstrapData?.settings?.featureFlags,\n ...(\n router?.getRecentApps().currentApp?.config\n ?.settings as BootstrapSettings\n )?.featureFlags,\n \"migrate-to-brick-next-v3\": true,\n };\n }\n\n getMiscSettings() {\n return {\n ...bootstrapData?.settings?.misc,\n ...(\n router?.getRecentApps().currentApp?.config\n ?.settings as BootstrapSettings\n )?.misc,\n };\n }\n\n getBrandSettings(): Record<string, string> {\n return {\n base_title: \"DevOps 管理专家\",\n ...(bootstrapData?.settings?.brand as Record<string, string>),\n };\n }\n\n getLaunchpadSettings() {\n return {\n columns: 7,\n rows: 4,\n ...bootstrapData?.settings?.launchpad,\n };\n }\n\n getDesktops(): unknown[] {\n return bootstrapData?.desktops ?? [];\n }\n\n getLaunchpadSiteMap(): unknown[] {\n return bootstrapData?.siteSort ?? [];\n }\n\n toggleLaunchpadEffect(open: boolean): void {\n document.body.classList.toggle(\"launchpad-open\", open);\n }\n\n applyPageTitle(pageTitle: string): void {\n const baseTitle = this.getBrandSettings().base_title;\n document.title = pageTitle ? `${pageTitle} - ${baseTitle}` : baseTitle;\n }\n\n getNavConfig() {\n return router?.getNavConfig();\n }\n\n loadBricks(bricks: string[] | Set<string>) {\n return loadBricksImperatively(bricks, getBrickPackages());\n }\n\n #getPresetBricks() {\n return (bootstrapData?.settings?.presetBricks ?? {}) as {\n notification?: string | false;\n dialog?: string | false;\n };\n }\n}\n\nfunction normalizeBootstrapData(data: BootstrapData) {\n if (Array.isArray(data.storyboards)) {\n for (const { app } of data.storyboards) {\n if (app.locales) {\n // Prefix to avoid conflict between brick package's i18n namespace.\n const ns = `tmp/${app.id}`;\n // Support any languages in `app.locales`.\n Object.entries(app.locales).forEach(([lang, resources]) => {\n i18n.addResourceBundle(lang, ns, resources);\n });\n // Use `app.name` as the fallback `app.localeName`.\n app.localeName = i18n.getFixedT(null, ns)(\"name\", app.name) as string;\n // Remove the temporary i18n resource bundles.\n Object.keys(app.locales).forEach((lang) => {\n i18n.removeResourceBundle(lang, ns);\n });\n } else {\n app.localeName = app.name;\n }\n }\n }\n if (isObject(data.settings)) {\n deepFreeze(data.settings);\n }\n if (data.brickPackages) {\n deepFreeze(data.brickPackages);\n }\n}\n\nexport function getBrickPackages() {\n return (\n bootstrapData?.brickPackages ??\n injectedBrickPackages ??\n (window.STANDALONE_BRICK_PACKAGES as BrickPackage[]) ??\n []\n );\n}\n\nexport function _internalApiGetRenderId(): string | undefined {\n return router?.getRenderId();\n}\n\nexport function _internalApiMatchStoryboard(\n pathname: string\n): RuntimeStoryboard | undefined {\n return matchStoryboard(bootstrapData?.storyboards ?? [], pathname);\n}\n\nexport function _internalApiGetRuntimeContext() {\n return router?.getRuntimeContext();\n}\n\nexport function _internalApiGetStoryboardInBootstrapData(appId: string) {\n return bootstrapData?.storyboards?.find(\n (storyboard) => storyboard.app.id === appId\n );\n}\n\nexport function _internalApiGetAppInBootstrapData(appId: string) {\n return _internalApiGetStoryboardInBootstrapData(appId)?.app;\n}\n\nexport let _test_only_setBootstrapData: (data: BootstrapData) => void;\n\n// istanbul ignore next\nif (process.env.NODE_ENV === \"test\") {\n _test_only_setBootstrapData = (data) => {\n bootstrapData = data as BootstrapData;\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAYA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACAA,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,gBAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,aAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,SAAA,GAAAX,OAAA;AACA,IAAAY,gBAAA,GAAAZ,OAAA;AAEA,IAAAa,SAAA,GAAAb,OAAA;AACA,IAAAc,oBAAA,GAAAd,OAAA;AACA,IAAAe,oBAAA,GAAAf,OAAA;AAA8E,SAAAgB,sBAAAC,CAAA,EAAAC,C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AAA,GAAC5I,aAAa,cAAA4I,eAAA,uBAAbA,eAAA,CAAerF,WAAW,cAAAoF,qBAAA,cAAAA,qBAAA,GAAI,EAAE,EAAED,QAAQ,CAAC;AACpE;AAEO,SAASI,6BAA6BA,CAAA,EAAG;EAAA,IAAAC,QAAA;EAC9C,QAAAA,QAAA,GAAO9I,MAAM,cAAA8I,QAAA,uBAANA,QAAA,CAAQC,iBAAiB,CAAC,CAAC;AACpC;AAEO,SAASC,wCAAwCA,CAAClF,KAAa,EAAE;EAAA,IAAAmF,eAAA;EACtE,QAAAA,eAAA,GAAOlJ,aAAa,cAAAkJ,eAAA,gBAAAA,eAAA,GAAbA,eAAA,CAAe3F,WAAW,cAAA2F,eAAA,uBAA1BA,eAAA,CAA4BC,IAAI,CACpCC,UAAU,IAAKA,UAAU,CAACtC,GAAG,CAACE,EAAE,KAAKjD,KACxC,CAAC;AACH;AAEO,SAASsF,iCAAiCA,CAACtF,KAAa,EAAE;EAAA,IAAAuF,qBAAA;EAC/D,QAAAA,qBAAA,GAAOL,wCAAwC,CAAClF,KAAK,CAAC,cAAAuF,qBAAA,uBAA/CA,qBAAA,CAAiDxC,GAAG;AAC7D;AAEO,IAAIyC,2BAA0D,GAAApJ,OAAA,CAAAoJ,2BAAA;;AAErE;AACA,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,MAAM,EAAE;EACnCvJ,OAAA,CAAAoJ,2BAAA,GAAAA,2BAA2B,GAAIhH,IAAI,IAAK;IACtCvC,aAAa,GAAGuC,IAAqB;EACvC,CAAC;AACH"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.WATEMARK_BRICKNAME = void 0;
|
|
7
|
+
exports.setWatermark = setWatermark;
|
|
8
|
+
var _loader = require("@next-core/loader");
|
|
9
|
+
var _Runtime = require("./internal/Runtime.js");
|
|
10
|
+
var _lodash = require("lodash");
|
|
11
|
+
let brick;
|
|
12
|
+
const WATEMARK_BRICKNAME = exports.WATEMARK_BRICKNAME = "basic.show-watermark";
|
|
13
|
+
function setWatermark() {
|
|
14
|
+
var _window$APP_ROOT, _username, _hooks$auth, _settings$watermarkCo, _watermarkConfig$cont, _watermarkConfig$flag, _watermarkConfig$flag2;
|
|
15
|
+
const flags = (0, _Runtime.getRuntime)().getFeatureFlags();
|
|
16
|
+
const settings = (0, _Runtime.getRuntime)().getMiscSettings();
|
|
17
|
+
if (!flags["show-watermark"]) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const isDeveloper = ((_window$APP_ROOT = window.APP_ROOT) === null || _window$APP_ROOT === void 0 || (_window$APP_ROOT = _window$APP_ROOT.match(/versions\/([^/]+)\//)) === null || _window$APP_ROOT === void 0 ? void 0 : _window$APP_ROOT[1]) === "0.0.0";
|
|
21
|
+
const username = (_username = _Runtime.hooks === null || _Runtime.hooks === void 0 || (_hooks$auth = _Runtime.hooks.auth) === null || _hooks$auth === void 0 || (_hooks$auth = _hooks$auth.getAuth()) === null || _hooks$auth === void 0 ? void 0 : _hooks$auth.username) !== null && _username !== void 0 ? _username : "";
|
|
22
|
+
const watermarkConfig = (_settings$watermarkCo = settings.watermarkConfig) !== null && _settings$watermarkCo !== void 0 ? _settings$watermarkCo : {
|
|
23
|
+
flags: {}
|
|
24
|
+
};
|
|
25
|
+
const defaultProps = {
|
|
26
|
+
content: [...(typeof watermarkConfig.content === "string" ? [watermarkConfig.content] : (_watermarkConfig$cont = watermarkConfig.content) !== null && _watermarkConfig$cont !== void 0 ? _watermarkConfig$cont : []), (_watermarkConfig$flag = watermarkConfig.flags) !== null && _watermarkConfig$flag !== void 0 && _watermarkConfig$flag["show-development"] && isDeveloper ? "Development" : "", (_watermarkConfig$flag2 = watermarkConfig.flags) !== null && _watermarkConfig$flag2 !== void 0 && _watermarkConfig$flag2["show-user"] ? username : ""].filter(Boolean),
|
|
27
|
+
zIndex: 1001,
|
|
28
|
+
width: 200,
|
|
29
|
+
font: {
|
|
30
|
+
fontSize: 28
|
|
31
|
+
},
|
|
32
|
+
gap: [190, 190],
|
|
33
|
+
...(0, _lodash.omit)(watermarkConfig, ["content", "flags"])
|
|
34
|
+
};
|
|
35
|
+
if (brick) {
|
|
36
|
+
brick.resolve(defaultProps);
|
|
37
|
+
} else {
|
|
38
|
+
(0, _loader.loadBricksImperatively)([WATEMARK_BRICKNAME], (0, _Runtime.getBrickPackages)()).then(() => {
|
|
39
|
+
brick = document.createElement(WATEMARK_BRICKNAME);
|
|
40
|
+
brick.resolve(defaultProps);
|
|
41
|
+
}, error => {
|
|
42
|
+
// eslint-disable-next-line no-console
|
|
43
|
+
console.error("Load watermark service failed:", error);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=setWatermark.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setWatermark.js","names":["_loader","require","_Runtime","_lodash","brick","WATEMARK_BRICKNAME","exports","setWatermark","_window$APP_ROOT","_username","_hooks$auth","_settings$watermarkCo","_watermarkConfig$cont","_watermarkConfig$flag","_watermarkConfig$flag2","flags","getRuntime","getFeatureFlags","settings","getMiscSettings","isDeveloper","window","APP_ROOT","match","username","hooks","auth","getAuth","watermarkConfig","defaultProps","content","filter","Boolean","zIndex","width","font","fontSize","gap","omit","resolve","loadBricksImperatively","getBrickPackages","then","document","createElement","error","console"],"sources":["../../src/setWatermark.ts"],"sourcesContent":["import { loadBricksImperatively } from \"@next-core/loader\";\nimport { getBrickPackages, getRuntime, hooks } from \"./internal/Runtime.js\";\nimport { omit } from \"lodash\";\n\ninterface WaterMarkProps {\n container?: HTMLElement;\n content?: string | string[];\n zIndex?: number;\n rotate?: number;\n width?: number;\n height?: number;\n image?: string;\n font?: {\n color?: CanvasFillStrokeStyles[\"fillStyle\"];\n fontSize?: number | string;\n fontWeight?: \"normal\" | \"light\" | \"weight\" | number;\n fontStyle?: \"none\" | \"normal\" | \"italic\" | \"oblique\";\n fontFamily?: string;\n textAlign?: CanvasTextAlign;\n };\n style?: React.CSSProperties;\n gap?: [number, number];\n offset?: [number, number];\n}\n\nlet brick: {\n resolve(options: WaterMarkProps): void;\n};\n\nexport const WATEMARK_BRICKNAME = \"basic.show-watermark\";\n\nexport function setWatermark() {\n const flags = getRuntime().getFeatureFlags();\n const settings = getRuntime().getMiscSettings();\n if (!flags[\"show-watermark\"]) {\n return;\n }\n const isDeveloper =\n window.APP_ROOT?.match(/versions\\/([^/]+)\\//)?.[1] === \"0.0.0\";\n const username =\n (hooks?.auth?.getAuth() as Record<string, any>)?.username ?? \"\";\n const watermarkConfig = (settings.watermarkConfig ?? {\n flags: {},\n }) as WaterMarkProps & {\n flags: {\n \"show-development\"?: boolean;\n \"show-user\"?: boolean;\n };\n };\n\n const defaultProps: WaterMarkProps = {\n content: [\n ...(typeof watermarkConfig.content === \"string\"\n ? [watermarkConfig.content]\n : watermarkConfig.content ?? []),\n watermarkConfig.flags?.[\"show-development\"] && isDeveloper\n ? \"Development\"\n : \"\",\n watermarkConfig.flags?.[\"show-user\"] ? username : \"\",\n ].filter(Boolean),\n zIndex: 1001,\n width: 200,\n font: {\n fontSize: 28,\n },\n gap: [190, 190],\n ...omit(watermarkConfig, [\"content\", \"flags\"]),\n };\n if (brick) {\n brick.resolve(defaultProps);\n } else {\n loadBricksImperatively([WATEMARK_BRICKNAME], getBrickPackages()).then(\n () => {\n brick = document.createElement(WATEMARK_BRICKNAME) as any;\n\n brick.resolve(defaultProps);\n },\n (error: unknown) => {\n // eslint-disable-next-line no-console\n console.error(\"Load watermark service failed:\", error);\n }\n );\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAuBA,IAAIG,KAEH;AAEM,MAAMC,kBAAkB,GAAAC,OAA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eAAe,CAACb,KAAK,cAAAF,qBAAA,eAArBA,qBAAA,CAAwB,kBAAkB,CAAC,IAAIO,WAAW,GACtD,aAAa,GACb,EAAE,EACN,CAAAN,sBAAA,GAAAc,eAAe,CAACb,KAAK,cAAAD,sBAAA,eAArBA,sBAAA,CAAwB,WAAW,CAAC,GAAGU,QAAQ,GAAG,EAAE,CACrD,CAACO,MAAM,CAACC,OAAO,CAAC;IACjBC,MAAM,EAAE,IAAI;IACZC,KAAK,EAAE,GAAG;IACVC,IAAI,EAAE;MACJC,QAAQ,EAAE;IACZ,CAAC;IACDC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;IACf,GAAG,IAAAC,YAAI,EAACV,eAAe,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC;EAC/C,CAAC;EACD,IAAIxB,KAAK,EAAE;IACTA,KAAK,CAACmC,OAAO,CAACV,YAAY,CAAC;EAC7B,CAAC,MAAM;IACL,IAAAW,8BAAsB,EAAC,CAACnC,kBAAkB,CAAC,EAAE,IAAAoC,yBAAgB,EAAC,CAAC,CAAC,CAACC,IAAI,CACnE,MAAM;MACJtC,KAAK,GAAGuC,QAAQ,CAACC,aAAa,CAACvC,kBAAkB,CAAQ;MAEzDD,KAAK,CAACmC,OAAO,CAACV,YAAY,CAAC;IAC7B,CAAC,EACAgB,KAAc,IAAK;MAClB;MACAC,OAAO,CAACD,KAAK,CAAC,gCAAgC,EAAEA,KAAK,CAAC;IACxD,CACF,CAAC;EACH;AACF"}
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
import _classPrivateFieldInitSpec from "@babel/runtime/helpers/classPrivateFieldInitSpec";
|
|
2
|
-
|
|
2
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
3
|
+
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
3
4
|
import { getV2RuntimeFromDll } from "./getV2RuntimeFromDll.js";
|
|
4
5
|
var _registry = /*#__PURE__*/new WeakMap();
|
|
5
6
|
class CustomProcessorRegistry {
|
|
6
7
|
constructor() {
|
|
7
|
-
_classPrivateFieldInitSpec(this, _registry,
|
|
8
|
-
writable: true,
|
|
9
|
-
value: new Map()
|
|
10
|
-
});
|
|
8
|
+
_classPrivateFieldInitSpec(this, _registry, new Map());
|
|
11
9
|
}
|
|
12
10
|
define(processorFullName, processorFunc) {
|
|
13
11
|
// `namespace` should be the camelCase of the package name.
|
|
14
12
|
var [namespace, processorName] = processorFullName.split(".");
|
|
15
|
-
var pkg = _classPrivateFieldGet(
|
|
13
|
+
var pkg = _classPrivateFieldGet(_registry, this).get(namespace);
|
|
16
14
|
if (!pkg) {
|
|
17
15
|
pkg = new Map();
|
|
18
|
-
_classPrivateFieldGet(
|
|
16
|
+
_classPrivateFieldGet(_registry, this).set(namespace, pkg);
|
|
19
17
|
}
|
|
20
18
|
if (pkg.has(processorName)) {
|
|
21
19
|
// eslint-disable-next-line no-console
|
|
@@ -24,7 +22,7 @@ class CustomProcessorRegistry {
|
|
|
24
22
|
pkg.set(processorName, processorFunc);
|
|
25
23
|
}
|
|
26
24
|
get(namespace) {
|
|
27
|
-
return _classPrivateFieldGet(
|
|
25
|
+
return _classPrivateFieldGet(_registry, this).get(namespace);
|
|
28
26
|
}
|
|
29
27
|
}
|
|
30
28
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomProcessors.js","names":["getV2RuntimeFromDll","_registry","WeakMap","CustomProcessorRegistry","constructor","_classPrivateFieldInitSpec","
|
|
1
|
+
{"version":3,"file":"CustomProcessors.js","names":["getV2RuntimeFromDll","_registry","WeakMap","CustomProcessorRegistry","constructor","_classPrivateFieldInitSpec","Map","define","processorFullName","processorFunc","namespace","processorName","split","pkg","_classPrivateFieldGet","get","set","has","Error","concat","getCustomProcessorsV2","v2Kit","Object","freeze","getRuntime","registerCustomProcessor","customProcessors"],"sources":["../../src/CustomProcessors.ts"],"sourcesContent":["import { getV2RuntimeFromDll } from \"./getV2RuntimeFromDll.js\";\n\nclass CustomProcessorRegistry {\n readonly #registry = new Map<string, Map<string, Function>>();\n\n define(processorFullName: string, processorFunc: Function) {\n // `namespace` should be the camelCase of the package name.\n const [namespace, processorName] = processorFullName.split(\".\");\n let pkg = this.#registry.get(namespace);\n if (!pkg) {\n pkg = new Map();\n this.#registry.set(namespace, pkg);\n }\n if (pkg.has(processorName)) {\n // eslint-disable-next-line no-console\n throw new Error(\n `Custom processor of \"${processorFullName}\" already registered`\n );\n }\n pkg.set(processorName, processorFunc);\n }\n\n get(namespace: string) {\n return this.#registry.get(namespace);\n }\n}\n\n// istanbul ignore next\nfunction getCustomProcessorsV2() {\n const v2Kit = getV2RuntimeFromDll();\n if (v2Kit) {\n return Object.freeze({\n define(processorFullName: string, processorFunc: Function) {\n return v2Kit\n .getRuntime()\n .registerCustomProcessor(processorFullName, processorFunc);\n },\n }) as CustomProcessorRegistry;\n }\n}\n\n// istanbul ignore next\nexport const customProcessors =\n getCustomProcessorsV2() || new CustomProcessorRegistry();\n"],"mappings":";;;AAAA,SAASA,mBAAmB,QAAQ,0BAA0B;AAAC,IAAAC,SAAA,oBAAAC,OAAA;AAE/D,MAAMC,uBAAuB,CAAC;EAAAC,YAAA;IAAAC,0BAAA,OAAAJ,SAAA,EACP,IAAIK,GAAG,CAAgC,CAAC;EAAA;EAE7DC,MAAMA,CAACC,iBAAyB,EAAEC,aAAuB,EAAE;IACzD;IACA,IAAM,CAACC,SAAS,EAAEC,aAAa,CAAC,GAAGH,iBAAiB,CAACI,KAAK,CAAC,GAAG,CAAC;IAC/D,IAAIC,GAAG,GAAGC,qBAAA,CAAAb,SAAA,MAAI,EAAWc,GAAG,CAACL,SAAS,CAAC;IACvC,IAAI,CAACG,GAAG,EAAE;MACRA,GAAG,GAAG,IAAIP,GAAG,CAAC,CAAC;MACfQ,qBAAA,CAAAb,SAAA,MAAI,EAAWe,GAAG,CAACN,SAAS,EAAEG,GAAG,CAAC;IACpC;IACA,IAAIA,GAAG,CAACI,GAAG,CAACN,aAAa,CAAC,EAAE;MAC1B;MACA,MAAM,IAAIO,KAAK,0BAAAC,MAAA,CACWX,iBAAiB,0BAC3C,CAAC;IACH;IACAK,GAAG,CAACG,GAAG,CAACL,aAAa,EAAEF,aAAa,CAAC;EACvC;EAEAM,GAAGA,CAACL,SAAiB,EAAE;IACrB,OAAOI,qBAAA,CAAAb,SAAA,MAAI,EAAWc,GAAG,CAACL,SAAS,CAAC;EACtC;AACF;;AAEA;AACA,SAASU,qBAAqBA,CAAA,EAAG;EAC/B,IAAMC,KAAK,GAAGrB,mBAAmB,CAAC,CAAC;EACnC,IAAIqB,KAAK,EAAE;IACT,OAAOC,MAAM,CAACC,MAAM,CAAC;MACnBhB,MAAMA,CAACC,iBAAyB,EAAEC,aAAuB,EAAE;QACzD,OAAOY,KAAK,CACTG,UAAU,CAAC,CAAC,CACZC,uBAAuB,CAACjB,iBAAiB,EAAEC,aAAa,CAAC;MAC9D;IACF,CAAC,CAAC;EACJ;AACF;;AAEA;AACA,OAAO,IAAMiB,gBAAgB,GAC3BN,qBAAqB,CAAC,CAAC,IAAI,IAAIjB,uBAAuB,CAAC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
2
|
import _classPrivateFieldInitSpec from "@babel/runtime/helpers/classPrivateFieldInitSpec";
|
|
3
|
-
|
|
3
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
4
|
+
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
4
5
|
import { uniq } from "lodash";
|
|
5
6
|
import { isStrictMode, warnAboutStrictMode } from "./isStrictMode.js";
|
|
6
7
|
import { getV2RuntimeFromDll } from "./getV2RuntimeFromDll.js";
|
|
@@ -10,14 +11,11 @@ var allowedNativeProps = new Set(["prefix"]);
|
|
|
10
11
|
var _registry = /*#__PURE__*/new WeakMap();
|
|
11
12
|
class CustomTemplateRegistry {
|
|
12
13
|
constructor() {
|
|
13
|
-
_classPrivateFieldInitSpec(this, _registry,
|
|
14
|
-
writable: true,
|
|
15
|
-
value: new Map()
|
|
16
|
-
});
|
|
14
|
+
_classPrivateFieldInitSpec(this, _registry, new Map());
|
|
17
15
|
}
|
|
18
16
|
define(tagName, constructor) {
|
|
19
17
|
var _constructor$proxy$pr, _constructor$proxy, _compatibleConstructo, _compatibleConstructo2;
|
|
20
|
-
var registered = _classPrivateFieldGet(
|
|
18
|
+
var registered = _classPrivateFieldGet(_registry, this).has(tagName);
|
|
21
19
|
if (registered) {
|
|
22
20
|
// When open launchpad, the storyboard will be updated.
|
|
23
21
|
// However, we can't *undefine* a custom element.
|
|
@@ -67,7 +65,7 @@ class CustomTemplateRegistry {
|
|
|
67
65
|
});
|
|
68
66
|
|
|
69
67
|
// Now we allow re-register custom template
|
|
70
|
-
_classPrivateFieldGet(
|
|
68
|
+
_classPrivateFieldGet(_registry, this).set(tagName, _objectSpread(_objectSpread({}, compatibleConstructor), {}, {
|
|
71
69
|
name: tagName
|
|
72
70
|
}));
|
|
73
71
|
var exposedStates = getExposedStates(compatibleConstructor.state);
|
|
@@ -183,7 +181,7 @@ class CustomTemplateRegistry {
|
|
|
183
181
|
customElements.define(tagName, TplElement);
|
|
184
182
|
}
|
|
185
183
|
get(tagName) {
|
|
186
|
-
return _classPrivateFieldGet(
|
|
184
|
+
return _classPrivateFieldGet(_registry, this).get(tagName);
|
|
187
185
|
}
|
|
188
186
|
}
|
|
189
187
|
function getExposedStates(state) {
|