zova-module-a-router 5.1.8 → 5.1.10
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/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/monkeySys.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/monkeySys.ts +3 -3
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BeanBase, BeanControllerBase, BeanControllerPageBase, BeanInfo, BeanScopeBase, BeanSimple, Use, Virtual, cast, deepExtend, prepareComponentOptions, useComputed, useController } from "zova";
|
|
1
|
+
import { BeanBase, BeanControllerBase, BeanControllerPageBase, BeanInfo, BeanScopeBase, BeanSimple, Use, Virtual, cast, deepExtend, isHttpUrl, prepareComponentOptions, useComputed, useController } from "zova";
|
|
2
2
|
import { BeanModelBase, Model } from "zova-module-a-model";
|
|
3
3
|
import * as ModuleInfo from "@cabloy/module-info";
|
|
4
4
|
import { combineParamsAndQuery, combineQueries } from "@cabloy/utils";
|
|
@@ -714,7 +714,7 @@ var MonkeySys = class extends BeanSimple {
|
|
|
714
714
|
app.$redirect = (pagePath, status) => {
|
|
715
715
|
const error = /* @__PURE__ */ new Error();
|
|
716
716
|
error.code = status ?? 302;
|
|
717
|
-
if (
|
|
717
|
+
if (isHttpUrl(pagePath)) {
|
|
718
718
|
error.pagePath = pagePath;
|
|
719
719
|
error.url = pagePath;
|
|
720
720
|
} else {
|
|
@@ -732,7 +732,7 @@ var MonkeySys = class extends BeanSimple {
|
|
|
732
732
|
}
|
|
733
733
|
pagePath = combineQueries(pagePath, query);
|
|
734
734
|
if (process.env.SERVER || options?.forceRedirect) return app.$redirect(pagePath);
|
|
735
|
-
if (
|
|
735
|
+
if (isHttpUrl(pagePath)) window.location[options?.replace ? "replace" : "assign"](pagePath);
|
|
736
736
|
else return app.meta.$router[options?.replace ? "replace" : "push"](pagePath);
|
|
737
737
|
};
|
|
738
738
|
app.$gotoHome = () => {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["RouterView","h","KeepAlive","Transition","BeanControllerBase","cast","pageRouteKey","routerViewKey","BeanRouterViewBase","__init__","bean","_setBean","$router","addRouterView","__dispose__","removeRouterView","backRoute","_route","forwardRoute","setPageMeta","_pageMeta","prepareRouteMeta","Error","getKeepAliveInclude","render","slots","default","component","routeMeta","route","vnode","Component","key","componentKey","zovaHostProviders","include","_createVNode","RouterView","h","cast","Controller","pageRouteKey","BeanRouterViewBase","ControllerRouterViewEmpty","_dec","_dec2","__z_BeanInfo","module","_class","__init__","render","slots","default","component","vnode","Component","zovaHostProviders","route","_createVNode"],"sources":["../src/model/pageData.ts","../src/lib/const.ts","../src/lib/utils.ts","../src/types/utils.ts","../src/bean/sys.router.ts","../src/bean/bean.router.ts","../src/bean/bean.routerGuardsBase.ts","../src/types/router.ts","../src/service/routerGuards.ts","../src/lib/routerViewBase.tsx","../src/component/routerViewEmpty/controller.tsx","../src/.metadata/component/routerViewEmpty.ts","../src/config/config.ts","../src/monkey.ts","../src/monkeySys.ts","../src/.metadata/index.ts"],"sourcesContent":["import type { IDecoratorModelOptions } from 'zova-module-a-model';\n\nimport { BeanModelBase, Model } from 'zova-module-a-model';\n\nexport interface IModelOptionsPageData extends IDecoratorModelOptions {}\n\n@Model<IModelOptionsPageData>()\nexport class ModelPageData<PAGEDATA = unknown> extends BeanModelBase {\n protected _pageDataInner: any;\n public current: PAGEDATA | undefined;\n\n protected async __init__() {\n if (process.env.SERVER) {\n const pagePath = this.$ssr.state.pagePath;\n if (pagePath) {\n this._pageDataInner = this.getPageData(pagePath);\n this._pageDataInner = this.$ssr.state.pageData;\n this.current = this._pageDataInner;\n }\n } else {\n if (this.$ssr.isRuntimeSsrPreHydration) {\n this.current = this.$ssr.state.pageData as PAGEDATA;\n } else {\n const route = this.$pageRoute;\n this.current = route ? this.getPageData(route.path) : undefined;\n }\n }\n }\n\n getPageData(pagePath: string): PAGEDATA {\n return this.$useStateMem({ queryKey: ['pageData', pagePath] });\n }\n}\n","export const pageRouteKey = '$$pageRoute';\nexport const routerViewKey = '$$routerView';\n","import type {\n RouteLocationMatched,\n RouteLocationNormalizedLoaded,\n RouteLocationNormalizedLoadedGeneric,\n RouterScrollBehavior,\n} from '@cabloy/vue-router';\nimport type { Ref } from 'vue';\nimport type { ZovaContext } from 'zova';\n\nimport { routerViewLocationKey } from '@cabloy/vue-router';\nimport { inject } from 'vue';\n\nimport { pageRouteKey } from './const.js';\n\nexport function getRouteMatched(route: RouteLocationNormalizedLoaded): RouteLocationMatched | undefined {\n let match = route.matched.find(item => item.aliasOf);\n if (match) {\n match = match.aliasOf;\n } else {\n match = route.matched[route.matched.length - 1];\n }\n return match;\n}\n\nexport function getRealRouteName(name?: string | symbol | null): string | undefined {\n if (!name) return undefined;\n name = String(name);\n if (name.startsWith('$:')) return undefined;\n return name;\n}\n\nexport function isRouterName(name?: string | null | undefined): boolean {\n return !!name && name.includes(':') && !name.includes('/');\n}\n\nexport function getPageRoute(ctx: ZovaContext): RouteLocationNormalizedLoadedGeneric | undefined {\n const route = ctx.bean._getBeanFromHost({ name: pageRouteKey });\n return route as RouteLocationNormalizedLoadedGeneric | undefined;\n}\n\nexport function getCurrentRoute(ctx: ZovaContext): Ref<RouteLocationNormalizedLoadedGeneric> | undefined {\n const route = ctx.util.instanceScope(() => {\n return inject(routerViewLocationKey);\n });\n return route;\n}\n\nexport const scrollBehavior: RouterScrollBehavior = (to, _from, savedPosition) => {\n if (savedPosition) {\n return new Promise(resolve => {\n setTimeout(() => {\n // savedPosition = Object.assign({}, savedPosition, { behavior: 'smooth' });\n resolve(savedPosition);\n }, 100);\n });\n } else if (to.hash) {\n return new Promise(resolve => {\n setTimeout(() => {\n // resolve({ el: to.hash, behavior: 'smooth' });\n resolve({ el: to.hash });\n }, 200);\n });\n } else {\n return { left: 0, top: 0 };\n }\n};\n","export const SymbolRouterHistory = Symbol('SymbolRouterHistory');\n\nexport interface IGotoPageOptions {\n query?: object;\n returnTo?: string | boolean;\n forceRedirect?: boolean;\n replace?: boolean;\n}\n","import type { RouteLocationMatched, RouteLocationNormalizedLoaded, RouteLocationResolvedGeneric, Router, RouterOptions } from '@cabloy/vue-router';\n\nimport { IModule } from '@cabloy/module-info';\nimport * as ModuleInfo from '@cabloy/module-info';\nimport { combineParamsAndQuery } from '@cabloy/utils';\nimport { createMemoryHistory, createRouter, createWebHashHistory, createWebHistory } from '@cabloy/vue-router';\nimport { BeanBase, cast, deepExtend } from 'zova';\nimport { Sys } from 'zova-module-a-bean';\n\nimport { getRealRouteName, getRouteMatched, isRouterName } from '../lib/utils.js';\nimport { IModuleRoute, IModuleRouteComponent, IPageNameRecord, IPagePathRecord } from '../types/router.js';\nimport { SymbolRouterHistory } from '../types/utils.js';\n\nexport interface SysRouter extends Router {}\n\n@Sys()\nexport class SysRouter extends BeanBase {\n private _vueRouterSys: Router;\n\n get router(): Router {\n return this._vueRouterSys;\n }\n\n protected __get__(prop: string) {\n return this._vueRouterSys && this._vueRouterSys[prop];\n }\n\n protected async __init__() {\n // create router\n this._vueRouterSys = this.createRouter();\n // config.routes\n this._loadConfigRoutes();\n // legacy routes\n this._loadLegacyRoutes();\n }\n\n public createRouter(options?: RouterOptions) {\n options = Object.assign({}, options);\n // matcher\n if (!options.matcher) {\n options.matcher = this._vueRouterSys?.matcher;\n }\n // routes\n if (!options.routes) {\n if (!this._vueRouterSys) {\n options.routes = [];\n }\n }\n // scrollBehavior\n if (!options.scrollBehavior) {\n options.scrollBehavior = this.scope.config.scrollBehavior;\n }\n // history\n if (!options.history) {\n const createHistory = process.env.SERVER\n ? createMemoryHistory\n : this.sys.env.ROUTER_MODE === 'history'\n ? createWebHistory\n : createWebHashHistory;\n const routeBase = process.env.SERVER || this.sys.env.ROUTER_MODE === 'history' ? this.sys.env.APP_PUBLIC_PATH : undefined;\n options.history = createHistory(routeBase);\n }\n // create\n const router = createRouter(options);\n cast(router).__hasDevtools = true;\n router[SymbolRouterHistory] = options.history;\n return router;\n }\n\n public createAsyncComponent(component: string | IModuleRouteComponent) {\n if (typeof component !== 'string') return component;\n return this.sys.meta.component.createAsyncComponent(component);\n }\n\n public getPagePath<K extends keyof IPagePathRecord>(path: K, options?: IPagePathRecord[K], absolute?: boolean) {\n const pagePath = combineParamsAndQuery(path, { params: options?.params, query: options?.query });\n return absolute ? this.sys.util.getAbsoluteUrlFromPagePath(pagePath) : pagePath;\n }\n\n public async resolveRoute(url: string, check404?: boolean, checkAliasOf?: boolean): Promise<RouteLocationResolvedGeneric | undefined> {\n const pagePath = this.sys.util.getPagePathFromAbsoluteUrl(url);\n let route = await this.ensureRoute(pagePath);\n if (check404 && route.name === '$:/:catchAll(.*)*') return;\n // aliasOf\n if (checkAliasOf) {\n const matchItem = route.matched.find(item => item.aliasOf);\n if (matchItem) {\n route = matchItem.aliasOf as unknown as RouteLocationResolvedGeneric;\n }\n // 404\n if (check404 && route.name === '$:/:catchAll(.*)*') return;\n }\n // ok\n return route;\n }\n\n public checkPathValid(to?: { name?: string; path?: string | null | undefined } | string | null | undefined): boolean {\n const _name = to && typeof to === 'object' ? to.name : undefined;\n const _path = to && typeof to === 'object' ? (to.name ?? to.path) : to;\n // legacy\n if (this._findLegacyRoute(_name, _path)) return true;\n // general check\n if (!_path) return true;\n const moduleName = ModuleInfo.parseName(_path);\n if (!moduleName) return true;\n return this.sys.meta.module.exists(moduleName);\n }\n\n public async ensureRoute(pagePath: string) {\n // try to resolve, support alias route\n let route = this._vueRouterSys.resolve(pagePath);\n if (route && route.name !== '$:/:catchAll(.*)*') return route;\n // try to load module\n const moduleName = ModuleInfo.parseName(pagePath);\n if (moduleName) {\n if (this.sys.meta.module.exists(moduleName)) {\n const module = this.sys.meta.module.get(moduleName);\n if (!module) {\n await this.sys.meta.module.use(moduleName);\n // try to resolve again\n route = this._vueRouterSys.resolve(pagePath);\n }\n }\n }\n return route;\n }\n\n /** @internal */\n public _registerRoutes(module: IModule) {\n if (!module.resource.routes) return;\n for (const route of module.resource.routes) {\n this._registerRoute(route, module);\n }\n }\n\n /** @internal */\n public _findConfigRoute(name: string | symbol | null | undefined, path: string | undefined): IModuleRoute | undefined {\n name = this.getRealRouteName(name);\n return name ? this.sys.config.routes.name[name] : this.sys.config.routes.path[path!];\n }\n\n /** @internal */\n public _findLegacyRoute(name: string | symbol | null | undefined, path: string | null | undefined): IModuleRoute | undefined {\n const legacyRoutes = cast(this.sys.meta).legacyRoutes;\n if (!legacyRoutes) return;\n name = this.getRealRouteName(name);\n return legacyRoutes.find(item => {\n return name ? item.name === name : item.path === path;\n });\n }\n\n getRouteMatched(route: RouteLocationNormalizedLoaded): RouteLocationMatched | undefined {\n return getRouteMatched(route);\n }\n\n getRealRouteName(name?: string | symbol | null): string | undefined {\n return getRealRouteName(name);\n }\n\n isRouterName(name?: string | null | undefined): boolean {\n return isRouterName(name);\n }\n\n resolveName<K extends keyof IPageNameRecord>(name: K, options?: IPageNameRecord[K]): string {\n const params = cast(options)?.params;\n const query = cast(options)?.query;\n return this._resolveNameOrPath(query, query => {\n const route = this.router.resolve({ name, params, query });\n return route.fullPath;\n });\n }\n\n resolvePath<K extends keyof IPagePathRecord>(path: K, query?: IPagePathRecord[K]): string {\n return this._resolveNameOrPath(query, query => {\n const route = this.router.resolve({ path, query });\n return route.fullPath;\n });\n }\n\n private _resolveNameOrPath(query, fn) {\n const query1 = {};\n const query2: any = [];\n if (query) {\n for (const key in query) {\n const value = query[key];\n if (value && typeof value === 'object') {\n query2.push([key, value]);\n } else {\n query1[key] = value;\n }\n }\n }\n // resolve\n const fullPath = fn(query1);\n // query2\n const query2str = query2\n .map(([key, value]) => {\n return `${encodeURIComponent(key)}=${encodeURIComponent(JSON.stringify(value))}`;\n })\n .join('&');\n // join\n if (!query2str) return fullPath;\n const join = Object.keys(query1).length > 0 ? '&' : '?';\n return `${fullPath}${join}${query2str}`;\n }\n\n private _loadConfigRoutes() {\n const routesPath = this.sys.config.routes.path;\n for (const key in routesPath) {\n const route = routesPath[key];\n if (!route) continue;\n this._loadConfigRoute({ ...route, path: key, name: `$:${key}` });\n }\n const routesName = this.sys.config.routes.name;\n for (const key in routesName) {\n const route = routesName[key];\n if (!route) continue;\n this._loadConfigRoute({ ...route, path: route.path || (route.alias as string), name: key });\n }\n }\n\n private _loadLegacyRoutes() {\n const legacyRoutes = cast(this.sys.meta).legacyRoutes;\n if (!legacyRoutes) return;\n for (const route of legacyRoutes) {\n this._registerRoute(route);\n }\n }\n\n private _loadConfigRoute(route: IModuleRoute) {\n this.router.addRoute(route);\n }\n\n private _registerRoute(route: IModuleRoute, module?: IModule) {\n // path\n let path: string | undefined;\n if (route.path !== undefined) {\n if (!module || route.meta?.absolute === true) {\n path = route.path;\n } else {\n path = route.path ? `/${module.info.pid}/${module.info.name}/${route.path}` : `/${module.info.pid}/${module.info.name}`;\n }\n }\n // name\n let name: string | undefined;\n if (route.name) {\n if (!module || route.meta?.absolute === true) {\n name = String(route.name);\n } else {\n name = `${module.info.relativeName}:${String(route.name)}`;\n }\n }\n // config route\n const configRoute = name ? this.sys.config.routes.name[name] : this.sys.config.routes.path[path!];\n if (configRoute) {\n route = deepExtend({}, route, configRoute);\n }\n // name alias\n if (name && configRoute?.alias) {\n // add extra route\n this.router.addRoute({ name: `$alias:${name}`, path: `/__alias__${configRoute?.alias}`, redirect: '' });\n }\n // name\n if (!name) {\n name = `$:${path}`;\n }\n // meta\n const meta = route.meta;\n // component\n const component = route.component;\n // layout / routeData\n let layout = meta?.layout;\n let routeData;\n let routeNameParent;\n if (layout === false) {\n routeData = { ...route, name, path, component, meta };\n } else {\n if (layout === undefined || layout === 'default') {\n layout = this.sys.config.layout.component.default;\n } else if (layout === 'empty') {\n layout = this.sys.config.layout.component.empty;\n }\n routeNameParent = `$:${name}`;\n routeData = {\n name: routeNameParent,\n path,\n component: this.createAsyncComponent(layout as any),\n children: [{ ...route, name, path: '', component, meta }],\n };\n }\n // force delete\n if (this.router.hasRoute(routeNameParent)) {\n this.router.removeRoute(routeNameParent);\n }\n if (this.router.hasRoute(name)) {\n this.router.removeRoute(name);\n }\n // add\n this.router.addRoute(routeData);\n }\n}\n","import type { NavigationGuardWithThis, NavigationHookAfter, RouteLocationNormalizedLoadedGeneric, Router } from '@cabloy/vue-router';\n\nimport { BeanBase, TypeEventOff, Use } from 'zova';\nimport { Bean } from 'zova-module-a-bean';\n\nimport { BeanRouterViewBase } from '../lib/routerViewBase.js';\nimport { ModelPageData } from '../model/pageData.js';\nimport { IPageMeta } from '../types/pageMeta.js';\nimport { TypeErrorListener } from '../types/router.js';\nimport { SysRouter } from './sys.router.js';\n\nexport interface BeanRouter extends Omit<SysRouter, '$beanFullName' | '$onionName' | '$onionOptions'> {}\n\n@Bean()\nexport class BeanRouter extends BeanBase {\n private _vueRouterApp: Router;\n private _eventRouterGuards: TypeEventOff[] = [];\n private _routerViews: BeanRouterViewBase[] = [];\n\n @Use()\n $$sysRouter: SysRouter;\n\n @Use()\n $$modelPageData: ModelPageData; // for prepare pageData on server\n\n get router(): Router {\n return this._vueRouterApp;\n }\n\n protected __dispose__() {\n for (const fn of this._eventRouterGuards) {\n fn();\n }\n }\n\n protected __get__(prop: string) {\n // SymbolRouter first\n const value = this._vueRouterApp?.[prop];\n if (value !== undefined) return value;\n return this.$$sysRouter?.[prop];\n }\n\n protected async __init__(mainRouter?: boolean) {\n // create router\n this._vueRouterApp = this.$$sysRouter.createRouter();\n if (!mainRouter) {\n // emit event\n await this.app.meta.event.emit('a-router:routerGuards', this);\n }\n }\n\n addRouterView(routerView: BeanRouterViewBase) {\n this._routerViews.push(routerView);\n }\n\n removeRouterView(routerView: BeanRouterViewBase) {\n const index = this._routerViews.findIndex(item => item === routerView);\n if (index > -1) {\n this._routerViews.splice(index, 1);\n }\n }\n\n afterEachBackRoute(route: RouteLocationNormalizedLoadedGeneric) {\n for (const routerView of this._routerViews) {\n const res = routerView.backRoute(route);\n if (res) break;\n }\n }\n\n afterEachForwardRoute(route: RouteLocationNormalizedLoadedGeneric) {\n for (const routerView of this._routerViews) {\n const res = routerView.forwardRoute(route);\n if (res) break;\n }\n }\n\n beforeEach(guard: NavigationGuardWithThis<undefined>): () => void {\n const fn = this._vueRouterApp.beforeEach(guard);\n this._eventRouterGuards.push(fn);\n return fn;\n }\n\n beforeResolve(guard: NavigationGuardWithThis<undefined>): () => void {\n const fn = this._vueRouterApp.beforeResolve(guard);\n this._eventRouterGuards.push(fn);\n return fn;\n }\n\n afterEach(guard: NavigationHookAfter): () => void {\n const fn = this._vueRouterApp.afterEach(guard);\n this._eventRouterGuards.push(fn);\n return fn;\n }\n\n onError(handler: TypeErrorListener): () => void {\n const fn = this._vueRouterApp.onError(handler);\n this._eventRouterGuards.push(fn);\n return fn;\n }\n\n setPageMeta(route: RouteLocationNormalizedLoadedGeneric, pageMeta: IPageMeta) {\n for (const routerView of this._routerViews) {\n routerView.setPageMeta(route, pageMeta);\n }\n }\n}\n","import type { TypeEventOff } from 'zova';\n\nimport { BeanBase, Virtual } from 'zova';\nimport { Bean } from 'zova-module-a-bean';\n\nimport type { BeanRouter } from './bean.router.js';\n\n@Bean()\n@Virtual()\nexport class BeanRouterGuardsBase extends BeanBase {\n private _eventRouterGuards: TypeEventOff;\n\n protected async __init__() {\n this._eventRouterGuards = this.app.meta.event.on('a-router:routerGuards', async (router, next) => {\n this.onRouterGuards(router);\n return await next();\n });\n }\n\n protected __dispose__() {\n this.dispose();\n }\n\n dispose() {\n if (this._eventRouterGuards) {\n this._eventRouterGuards();\n }\n }\n\n protected onRouterGuards(_router: BeanRouter) {}\n}\n","import type {\n NavigationFailure,\n RouteComponent,\n RouteLocationMatched,\n RouteLocationNormalized,\n RouteLocationNormalizedLoaded,\n RouteLocationNormalizedLoadedGeneric,\n RouteRecordRaw,\n} from '@cabloy/vue-router';\nimport type { z } from 'zod';\nimport type { ILayoutRecord, ILocaleRecord, TypeComponentLayoutRecord, ZovaApplication } from 'zova';\n\nimport type { BeanRouter } from '../bean/bean.router.js';\nimport type { BeanRouterViewBase } from '../lib/routerViewBase.js';\nimport type { IGotoPageOptions } from './utils.js';\nimport 'vue-router';\n\nexport type Lazy<T> = () => Promise<T>;\nexport type IModuleRouteComponent = RouteComponent | Lazy<RouteComponent>;\nexport type IModuleRoute = RouteRecordRaw;\n\nexport type TypeComponentKeyMode = 'nameOnly' | 'withParams';\n\nexport type TypeGotoPageResult = void | Promise<NavigationFailure | void | undefined>;\n\ndeclare module '@cabloy/vue-router' {\n interface RouteMeta {\n absolute?: boolean;\n layout?: keyof TypeComponentLayoutRecord | keyof ILayoutRecord | false | IModuleRouteComponent;\n requiresAuth?: boolean;\n locale?: boolean;\n locales?: Record<keyof ILocaleRecord, string>;\n componentKeyMode?: TypeComponentKeyMode;\n componentKey?: ((this: ZovaApplication, route: RouteLocationNormalizedLoaded) => string) | string;\n tabKey?: ((this: ZovaApplication, route: RouteLocationNormalizedLoaded) => string) | string;\n keepAlive?: ((this: ZovaApplication, route: RouteLocationNormalizedLoaded) => boolean) | boolean;\n }\n}\n\ndeclare module 'zova' {\n export interface ZovaApplication {\n $redirect(pagePath: string, status?: 301 | 302): never;\n $gotoPage(pagePath: string, options?: IGotoPageOptions): TypeGotoPageResult;\n $gotoHome(): TypeGotoPageResult;\n $gotoLogin(returnTo?: string, cause?: string): TypeGotoPageResult;\n $gotoReturnTo(returnTo?: string): TypeGotoPageResult;\n $getReturnTo(returnTo?: string): string;\n $getCurrentPagePath(): string | undefined;\n }\n\n export interface AppMeta {\n $router: BeanRouter;\n }\n export interface BeanBase {\n $router: BeanRouter;\n $routerView: BeanRouterViewBase;\n $pageRoute: RouteLocationNormalizedLoadedGeneric | undefined;\n $currentRoute: RouteLocationNormalizedLoadedGeneric | undefined;\n }\n\n export interface IModuleResource {\n routes: IModuleRoute[];\n }\n\n export interface IControllerDataContext {\n route?: RouteLocationNormalizedLoaded;\n }\n\n export interface IModuleResource {\n pagePathSchemas?: TypePageSchemas;\n pageNameSchemas?: TypePageSchemas;\n }\n\n export interface ZovaConfigRoutes {\n path: Record<keyof IPagePathRecord, IModuleRoute>;\n name: Record<keyof IPageNameRecord, IModuleRoute>;\n }\n\n export interface IEventRecord {\n 'a-router:routerGuards': { data: BeanRouter; result: void };\n }\n\n export interface ZovaConfigEnv {\n ROUTER_MODE: 'hash' | 'history' | 'abstract' | undefined;\n ROUTER_PAGE_HOME: string;\n ROUTER_PAGE_LOGIN: string;\n ROUTER_KEY_RETURNTO: string;\n }\n\n export interface BeanControllerPageBase {\n $route: RouteLocationNormalizedLoaded;\n $routeMatched: RouteLocationMatched;\n }\n\n // export interface IEventRecord {\n // 'a-router:routerGuards': BeanRouter;\n // }\n\n // export interface IEventResultRecord {\n // 'a-router:routerGuards': void;\n // }\n}\n\nexport interface IPageNameRecord {}\nexport interface IPagePathRecord {}\nexport interface IPagePathSchemaRecord {}\n\nexport interface TypePageSchema {\n params?: z.ZodTypeAny;\n query: z.ZodTypeAny;\n}\nexport type TypePageSchemas = Record<string, TypePageSchema>;\n\nexport interface TypePagePathSchema<PARAMS = unknown, QUERY = unknown> {\n params?: PARAMS;\n query?: QUERY;\n}\n\nexport interface TypeErrorListener {\n (error: any, to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded): any;\n}\n\nexport enum NavigationType {\n pop = 'pop',\n push = 'push',\n}\n\nexport enum NavigationDirection {\n back = 'back',\n forward = 'forward',\n unknown = '',\n}\n\nexport interface NavigationInformation {\n type: NavigationType;\n direction: NavigationDirection;\n delta: number;\n replace?: boolean;\n}\n","import * as ModuleInfo from '@cabloy/module-info';\nimport { RouteLocationNormalizedLoadedGeneric } from '@cabloy/vue-router';\nimport { Service } from 'zova-module-a-bean';\n\nimport { BeanRouter } from '../bean/bean.router.js';\nimport { BeanRouterGuardsBase } from '../bean/bean.routerGuardsBase.js';\nimport { NavigationDirection, NavigationInformation, NavigationType } from '../types/router.js';\n\n@Service()\nexport class ServiceRouterGuards extends BeanRouterGuardsBase {\n protected onRouterGuards(router: BeanRouter) {\n const self = this;\n router.beforeEach(async to => {\n // match path\n let match = to.matched.find(item => item.aliasOf);\n if (match) {\n match = match.aliasOf;\n } else {\n match = to.matched[to.matched.length - 1];\n // prepareCheck\n if (!(await this._prepareCheck(match?.path, to.path))) {\n // redirect again\n return to.fullPath;\n }\n // legacy\n const legacyRoute = router._findLegacyRoute(match?.name, match?.path);\n if (legacyRoute) return;\n // alias\n const configRoute = router._findConfigRoute(match?.name, match?.path);\n const alias = configRoute?.alias;\n if (alias) {\n // force load module\n const resLoadModule = await this._forceLoadModule(router, match?.name, match?.path);\n if (resLoadModule && resLoadModule !== true) return resLoadModule;\n if (resLoadModule === false) return to.fullPath;\n if (router.getRealRouteName(match?.name)) {\n const routeAlias = router.resolveName(\n `$alias:${match?.name as string}` as never,\n {\n params: to.params,\n query: to.query,\n } as any,\n );\n const fullPath = routeAlias.startsWith('/__alias__') ? routeAlias.substring('/__alias__'.length) : routeAlias;\n return fullPath || '/';\n } else {\n return {\n path: Array.isArray(alias) ? alias[0] : alias,\n params: to.params,\n query: to.query,\n };\n }\n }\n }\n // force load module\n const resLoadModule = await this._forceLoadModule(router, match?.name, match?.path);\n if (resLoadModule === true) return;\n if (resLoadModule) return resLoadModule;\n // redirect again\n return to.fullPath;\n });\n router.afterEach(function (to, from, error) {\n if (error) return;\n const info: NavigationInformation | undefined = arguments[3];\n // from\n if (from.fullPath !== to.fullPath) {\n self._afterEachFrom(router, from, info);\n }\n // to\n router.afterEachForwardRoute(to);\n });\n }\n\n private _afterEachFrom(router: BeanRouter, from: RouteLocationNormalizedLoadedGeneric, info: NavigationInformation | undefined) {\n if (!info) return;\n const needBack =\n (info.type === NavigationType.pop && info.direction === NavigationDirection.back) || (info.type === NavigationType.push && info.replace);\n if (!needBack) return;\n router.afterEachBackRoute(from);\n }\n\n // if 404 then check if module loaded\n private async _prepareCheck(pathMatched: string | undefined, pathTo: string): Promise<boolean> {\n if (pathMatched === '/:catchAll(.*)*') {\n const moduleInfo = ModuleInfo.parseInfo(ModuleInfo.parseName(pathTo));\n if (moduleInfo && this.app.meta.module.exists(moduleInfo.relativeName) && !this.app.meta.module.get(moduleInfo.relativeName, false)) {\n // use module\n await this.app.meta.module.use(moduleInfo.relativeName);\n // redirect again\n return false;\n }\n }\n return true;\n }\n\n private async _forceLoadModule(\n router: BeanRouter,\n name: string | symbol | null | undefined,\n path: string | undefined,\n ): Promise<string | boolean | undefined> {\n const nameOrPath = router.getRealRouteName(name) || path;\n // module info\n const moduleInfo = ModuleInfo.parseInfo(ModuleInfo.parseName(nameOrPath));\n if (!moduleInfo) {\n // donothing\n return true;\n }\n const moduleName = moduleInfo.relativeName;\n // check if exists\n if (!this.app.meta.module.exists(moduleName)) return '/404';\n // check if loaded\n const module = this.app.meta.module.get(moduleName, false);\n if (module) return true;\n // use module\n await this.app.meta.module.use(moduleName);\n // means need load\n return false;\n }\n}\n","import type { RouteLocationNormalizedLoadedGeneric } from '@cabloy/vue-router';\n\nimport { RouterView } from '@cabloy/vue-router';\nimport { h, KeepAlive, Transition } from 'vue';\nimport { BeanControllerBase, cast } from 'zova';\n\nimport type { IPageMeta } from '../types/pageMeta.js';\nimport type { IRouterViewSlotParams, IRouteViewRouteMeta } from '../types/routerView.js';\n\nimport { pageRouteKey, routerViewKey } from './const.js';\n\nexport interface IRouterViewPropsBase {}\n\nexport class BeanRouterViewBase extends BeanControllerBase implements IRouterViewPropsBase {\n protected async __init__() {\n this.bean._setBean(routerViewKey, this);\n this.$router.addRouterView(this);\n }\n\n protected __dispose__() {\n this.$router.removeRouterView(this);\n }\n\n public backRoute(_route: RouteLocationNormalizedLoadedGeneric) {\n return false;\n }\n\n public forwardRoute(_route: RouteLocationNormalizedLoadedGeneric) {\n return false;\n }\n\n public setPageMeta(_route: RouteLocationNormalizedLoadedGeneric, _pageMeta: IPageMeta) {}\n\n protected prepareRouteMeta(_route: RouteLocationNormalizedLoadedGeneric): IRouteViewRouteMeta {\n throw new Error('Not Implemented');\n }\n\n protected getKeepAliveInclude(): string[] | undefined {\n throw new Error('Not Implemented');\n }\n\n protected render() {\n const slots = {\n default: (component: IRouterViewSlotParams) => {\n const routeMeta = this.prepareRouteMeta(component.route);\n return h(Transition, null, {\n default: () => {\n const vnode = h(component.Component as any, {\n key: routeMeta.componentKey,\n });\n cast(vnode).zovaHostProviders = { [pageRouteKey]: component.route };\n return [\n h(\n KeepAlive,\n {\n include: this.getKeepAliveInclude(),\n },\n [vnode],\n ),\n ];\n },\n });\n },\n };\n return <RouterView v-slots={slots}></RouterView>;\n }\n}\n","import { RouterView } from '@cabloy/vue-router';\nimport { h } from 'vue';\nimport { cast } from 'zova';\nimport { Controller } from 'zova-module-a-bean';\n\nimport { pageRouteKey } from '../../lib/const.js';\nimport { BeanRouterViewBase } from '../../lib/routerViewBase.js';\n\n@Controller()\nexport class ControllerRouterViewEmpty extends BeanRouterViewBase {\n protected async __init__() {}\n\n protected render() {\n const slots = {\n default: component => {\n const vnode = h(component.Component);\n cast(vnode).zovaHostProviders = { [pageRouteKey]: component.route };\n return vnode;\n },\n };\n return <RouterView v-slots={slots}></RouterView>;\n }\n}\n","import { defineComponent } from 'vue';\nimport { prepareComponentOptions, useController } from 'zova';\n\nimport { ControllerRouterViewEmpty } from '../../component/routerViewEmpty/controller.jsx';\nexport type TypeControllerRouterViewEmptyPublicProps = {\n controllerRef?: (ref: ControllerRouterViewEmpty) => void;\n};\n\nexport const ZRouterViewEmpty = defineComponent((_props: TypeControllerRouterViewEmptyPublicProps) => {\n useController(ControllerRouterViewEmpty, undefined, undefined);\n return () => {};\n}, prepareComponentOptions());\n","import type { ZovaSys } from 'zova';\n\nimport { scrollBehavior } from '../lib/utils.js';\n\nexport const config = (_sys: ZovaSys) => {\n return {\n scrollBehavior,\n };\n};\n","import type { RouteLocationMatched, RouteLocationNormalizedLoadedGeneric } from '@cabloy/vue-router';\nimport type {\n BeanBase,\n BeanContainer,\n IControllerData,\n IErrorHandlerEventData,\n IMonkeyAppClose,\n IMonkeyAppInitialize,\n IMonkeyAppInitialized,\n IMonkeyAppReady,\n IMonkeyBeanInit,\n IMonkeyController,\n ZovaContext,\n} from 'zova';\nimport type { ErrorSSR } from 'zova-module-a-ssr';\n\nimport * as ModuleInfo from '@cabloy/module-info';\nimport { shallowReactive } from 'vue';\nimport { BeanControllerPageBase, BeanSimple, cast, useComputed } from 'zova';\n\nimport type { BeanRouter } from './bean/bean.router.js';\nimport type { TypePageSchema } from './types/router.js';\n\nimport { routerViewKey } from './lib/const.js';\nimport { getCurrentRoute, getPageRoute, getRealRouteName, getRouteMatched } from './lib/utils.js';\nimport { ServiceRouterGuards } from './service/routerGuards.js';\nimport { SymbolRouterHistory } from './types/utils.js';\n\nexport class Monkey\n extends BeanSimple\n implements IMonkeyAppInitialize, IMonkeyAppInitialized, IMonkeyAppReady, IMonkeyAppClose, IMonkeyBeanInit, IMonkeyController\n{\n private _beanRouter: BeanRouter;\n serviceRouterGuards: ServiceRouterGuards;\n\n async getBeanRouter() {\n if (!this._beanRouter) {\n // markReactive: true\n this._beanRouter = this.app.meta.$router = (await this.bean._getBean('a-router.bean.router', true, true)) as BeanRouter;\n }\n return this._beanRouter;\n }\n\n async appInitialize() {\n // router\n this.serviceRouterGuards = await this.bean._newBean(ServiceRouterGuards, false);\n // ssr errorHandler\n if (process.env.CLIENT) {\n this._ssrErrorHandler();\n }\n }\n\n async appInitialized() {\n const beanRouter = await this.getBeanRouter();\n // emit event\n await this.app.meta.event.emit('a-router:routerGuards', beanRouter);\n }\n\n appClose(): void {\n if (this.serviceRouterGuards) {\n this.serviceRouterGuards.dispose();\n }\n }\n\n async appReady() {\n const beanRouter = await this.getBeanRouter();\n // pagePath\n if (process.env.CLIENT && this.ctx.meta.$ssr.isRuntimeSsrPreHydration) {\n const pagePathFull = this.ctx.meta.$ssr.state.pagePathFull;\n if (pagePathFull) {\n const routerHistory = beanRouter.router[SymbolRouterHistory];\n routerHistory.push(pagePathFull);\n }\n }\n // use router\n this.app.vue.use(beanRouter);\n // ssr\n if (process.env.SERVER) {\n // push\n const pagePath = this.app.$getCurrentPagePath()!;\n beanRouter.push(pagePath);\n await beanRouter.isReady();\n } else if (process.env.CLIENT && this.ctx.meta.$ssr.isRuntimeSsrPreHydration) {\n await beanRouter.isReady();\n }\n }\n\n async beanInit(bean: BeanContainer, beanInstance: BeanBase) {\n bean.defineProperty(beanInstance, '$router', {\n enumerable: false,\n configurable: true,\n get() {\n return bean._getBeanFromHost('a-router.bean.router');\n },\n });\n bean.defineProperty(beanInstance, '$routerView', {\n enumerable: false,\n configurable: true,\n get() {\n return bean._getBeanFromHost({ name: routerViewKey });\n },\n });\n bean.defineProperty(beanInstance, '$pageRoute', {\n enumerable: false,\n configurable: true,\n get() {\n return useComputed(() => {\n return getPageRoute(cast(bean).ctx);\n });\n },\n });\n bean.defineProperty(beanInstance, '$currentRoute', {\n enumerable: false,\n configurable: true,\n get() {\n return useComputed(() => {\n return getCurrentRoute(cast(bean).ctx);\n });\n },\n });\n }\n\n controllerDataPrepare(controllerData: IControllerData, ctx: ZovaContext) {\n controllerData.context.route = getPageRoute(ctx);\n }\n\n controllerDataInit(controllerData: IControllerData, controller: BeanBase) {\n // only for controller page\n if (!(controller instanceof BeanControllerPageBase)) return;\n const route = controllerData.context.route;\n this._initControllerRoute(route, controller);\n }\n\n controllerDataUpdate(controller: BeanBase) {\n // only for controller page\n if (!(controller instanceof BeanControllerPageBase)) return;\n const route = getPageRoute(cast<ZovaContext>(cast(controller).ctx));\n this._initControllerRoute(route, controller);\n }\n\n private _initControllerRoute(route: RouteLocationNormalizedLoadedGeneric | undefined, controller: BeanControllerPageBase) {\n if (!route) return;\n const routeMatched = getRouteMatched(route);\n if (!routeMatched) return;\n // check if the same\n if (controller.$routeMatched && !this._checkIfRouteSame(routeMatched, controller.$routeMatched)) return;\n // check if changed\n const changed = !controller.$route || controller.$route.fullPath !== route.fullPath;\n if (!changed) return;\n controller.$route = route;\n controller.$routeMatched = routeMatched;\n // update $params/$query\n const routeName = getRealRouteName(routeMatched.name);\n const schemaKey = routeName || String(routeMatched.path);\n let schemas: TypePageSchema | undefined;\n const moduleInfo = ModuleInfo.parseInfo(ModuleInfo.parseName(schemaKey));\n if (!moduleInfo) {\n // do nothing\n return;\n }\n if (!this.app.meta.module.exists(moduleInfo.relativeName)) {\n // do nothing\n return;\n }\n const module = this.app.meta.module.get(moduleInfo.relativeName)!;\n if (routeName) {\n schemas = module.resource.pageNameSchemas?.[schemaKey];\n } else {\n schemas = module.resource.pagePathSchemas?.[schemaKey];\n }\n if (schemas?.params) {\n const params = schemas.params.parse(route.params);\n if (!controller.$params) {\n controller.$params = process.env.SERVER ? params : shallowReactive(params as any);\n } else {\n // hold the same $params ref\n Object.assign(controller.$params as any, params);\n }\n }\n if (schemas?.query) {\n const query = schemas.query.parse(route.query);\n if (!controller.$query) {\n controller.$query = process.env.SERVER ? query : shallowReactive(query as any);\n } else {\n // hold the same $query ref\n Object.assign(controller.$query as any, query);\n }\n }\n }\n\n private _checkIfRouteSame(route1: RouteLocationMatched, route2: RouteLocationMatched) {\n return (route1.name && route1.name === route2.name) || route1.path === route2.path;\n }\n\n private _ssrErrorHandler() {\n if (!process.env.CLIENT) return;\n this.app.meta.event.on('app:errorHandler', (data, next) => {\n const err = next();\n if (!err || !(err instanceof Error)) return err;\n return this._errorHandlerDefaultClient(err, data);\n });\n }\n\n private _errorHandlerDefaultClient(err: ErrorSSR, _data: IErrorHandlerEventData) {\n if (!process.env.CLIENT) return err;\n // client\n if ([301, 302].includes(Number(err.code))) {\n this.app.$gotoPage(err.pagePath!);\n return undefined;\n }\n // COMPONENT_UNMOUNTED\n if (err.code === 600) {\n // do nothing\n return undefined;\n }\n // 401\n if (err.code === 401) {\n this.app.$gotoLogin();\n return undefined;\n }\n // not handled\n return err;\n }\n}\n","import type { IModule } from '@cabloy/module-info';\nimport type { IMonkeyModuleSys, IMonkeySysApplicationInitialize, ZovaApplication } from 'zova';\nimport type { ErrorSSR } from 'zova-module-a-ssr';\n\nimport { combineQueries } from '@cabloy/utils';\nimport { BeanSimple, cast } from 'zova';\n\nimport type { SysRouter } from './bean/sys.router.js';\nimport type { TypeGotoPageResult } from './types/router.js';\nimport type { IGotoPageOptions } from './types/utils.js';\n\nexport class MonkeySys extends BeanSimple implements IMonkeyModuleSys, IMonkeySysApplicationInitialize {\n private _moduleSelf: IModule;\n private _sysRouter: SysRouter;\n\n constructor(moduleSelf: IModule) {\n super();\n this._moduleSelf = moduleSelf;\n }\n\n async getSysRouter() {\n if (!this._sysRouter) {\n this._sysRouter = (await this.bean._getBean('a-router.sys.router', false)) as SysRouter;\n }\n return this._sysRouter;\n }\n\n async moduleLoading(module: IModule) {\n if (this._moduleSelf === module) return;\n if (!module.resource.routes) return;\n const sysRouter = await this.getSysRouter();\n sysRouter._registerRoutes(module);\n }\n\n async moduleLoaded(_module: IModule) {}\n async configLoaded(_module: IModule, _config) {}\n\n sysApplicationInitialize(app: ZovaApplication): void {\n app.$redirect = (pagePath: string, status?: 301 | 302): never => {\n const error = new Error() as ErrorSSR;\n error.code = status ?? 302;\n if (pagePath.startsWith('http://') || pagePath.startsWith('https://')) {\n error.pagePath = pagePath;\n error.url = pagePath;\n } else {\n error.pagePath = pagePath;\n error.url = app.sys.util.getAbsoluteUrlFromPagePath(pagePath, true);\n }\n error.message = process.env.SERVER ? error.url : error.pagePath;\n throw error;\n };\n app.$gotoPage = (pagePath: string, options?: IGotoPageOptions): TypeGotoPageResult => {\n const query = options?.query ?? {};\n // returnTo\n if (options?.returnTo) {\n const returnTo = typeof options?.returnTo === 'string' ? options?.returnTo : app.$getCurrentPagePath();\n if (returnTo !== app.sys.env.ROUTER_PAGE_HOME) {\n query[app.sys.env.ROUTER_KEY_RETURNTO] = returnTo;\n }\n }\n // combineQueries\n pagePath = combineQueries(pagePath, query);\n // redirect\n if (process.env.SERVER || options?.forceRedirect) {\n return app.$redirect(pagePath);\n }\n // replace\n if (pagePath.startsWith('http://') || pagePath.startsWith('https://')) {\n window.location[options?.replace ? 'replace' : 'assign'](pagePath);\n } else {\n return app.meta.$router[options?.replace ? 'replace' : 'push'](pagePath);\n }\n };\n app.$gotoHome = () => {\n return app.$gotoPage(app.sys.env.ROUTER_PAGE_HOME);\n };\n app.$gotoLogin = (returnTo?: string, cause?: string) => {\n if (!returnTo && cast(app.meta.$router.currentRoute)?.path === app.sys.env.ROUTER_PAGE_LOGIN) return;\n const query: any = {};\n if (cause) {\n query.cause = cause;\n }\n const returnTo2 = returnTo === app.sys.env.ROUTER_PAGE_LOGIN ? undefined : (returnTo ?? true);\n return app.$gotoPage(app.sys.env.ROUTER_PAGE_LOGIN, { query, returnTo: returnTo2 });\n };\n app.$gotoReturnTo = (returnTo?: string) => {\n const pagePath = app.$getReturnTo(returnTo);\n return app.$gotoPage(pagePath, { replace: true });\n };\n app.$getReturnTo = (returnTo?: string) => {\n // not use ??\n const pagePath = returnTo || cast(app.meta.$router.currentRoute)?.query?.[app.sys.env.ROUTER_KEY_RETURNTO] || app.sys.env.ROUTER_PAGE_HOME;\n return pagePath;\n };\n app.$getCurrentPagePath = (): string | undefined => {\n if (process.env.SERVER) {\n return app.ctx.meta.$ssr.state.pagePathFull ?? app.sys.util.getPagePathFromAbsoluteUrl(app.ctx.meta.$ssr.context.req.url);\n }\n return cast(app.meta.$router.currentRoute)?.fullPath;\n };\n }\n}\n","// eslint-disable\n/** model: begin */\nexport * from '../model/pageData.js';\nimport { IModelOptionsPageData } from '../model/pageData.js';\nimport 'zova-module-a-model';\ndeclare module 'zova-module-a-model' {\n \n export interface IModelRecord {\n 'a-router:pageData': IModelOptionsPageData;\n }\n\n \n}\ndeclare module 'zova-module-a-router' {\n \n export interface ModelPageData {\n /** @internal */\n get scope(): ScopeModuleARouter;\n }\n\n export interface ModelPageData {\n get $beanFullName(): 'a-router.model.pageData';\n get $onionName(): 'a-router:pageData';\n get $onionOptions(): IModelOptionsPageData;\n } \n}\n/** model: end */\n/** model: begin */\nimport { ModelPageData } from '../model/pageData.js';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordGeneral {\n 'a-router.model.pageData': ModelPageData;\n }\n}\n/** model: end */\n/** sys: begin */\nexport * from '../bean/sys.router.js';\n\nimport 'zova';\ndeclare module 'zova' {\n \n \n}\ndeclare module 'zova-module-a-router' {\n \n export interface SysRouter {\n /** @internal */\n get scope(): ScopeModuleARouter;\n }\n\n export interface SysRouter {\n get $beanFullName(): 'a-router.sys.router';\n get $onionName(): 'a-router:router';\n \n } \n}\n/** sys: end */\n/** sys: begin */\nimport { SysRouter } from '../bean/sys.router.js';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordGeneral {\n 'a-router.sys.router': SysRouter;\n }\n}\n/** sys: end */\n/** bean: begin */\nexport * from '../bean/bean.router.js';\nexport * from '../bean/bean.routerGuardsBase.js';\n\nimport 'zova';\ndeclare module 'zova' {\n \n \n}\ndeclare module 'zova-module-a-router' {\n \n export interface BeanRouter {\n /** @internal */\n get scope(): ScopeModuleARouter;\n }\n\n export interface BeanRouter {\n get $beanFullName(): 'a-router.bean.router';\n get $onionName(): 'a-router:router';\n \n } \n}\n/** bean: end */\n/** bean: begin */\nimport { BeanRouter } from '../bean/bean.router.js';\nimport { BeanRouterGuardsBase } from '../bean/bean.routerGuardsBase.js';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordGeneral {\n 'a-router.bean.router': BeanRouter;\n'a-router.bean.routerGuardsBase': BeanRouterGuardsBase;\n }\n}\n/** bean: end */\n/** service: begin */\nexport * from '../service/routerGuards.js';\n\nimport 'zova-module-a-bean';\ndeclare module 'zova-module-a-bean' {\n \n export interface IServiceRecord {\n 'a-router:routerGuards': never;\n }\n\n \n}\ndeclare module 'zova-module-a-router' {\n \n export interface ServiceRouterGuards {\n /** @internal */\n get scope(): ScopeModuleARouter;\n }\n\n export interface ServiceRouterGuards {\n get $beanFullName(): 'a-router.service.routerGuards';\n get $onionName(): 'a-router:routerGuards';\n \n } \n}\n/** service: end */\n/** service: begin */\nimport { ServiceRouterGuards } from '../service/routerGuards.js';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordGeneral {\n 'a-router.service.routerGuards': ServiceRouterGuards;\n }\n}\n/** service: end */\n/** controller: begin */\nexport * from '../component/routerViewEmpty/controller.jsx';\n\nimport 'zova';\ndeclare module 'zova' {\n \n \n}\ndeclare module 'zova-module-a-router' {\n \n export interface ControllerRouterViewEmpty {\n /** @internal */\n get scope(): ScopeModuleARouter;\n } \n}\n/** controller: end */\n/** controller: begin */\nimport { ControllerRouterViewEmpty } from '../component/routerViewEmpty/controller.jsx';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordLocal {\n 'a-router.controller.routerViewEmpty': ControllerRouterViewEmpty;\n }\n}\n/** controller: end */\n\n/** components: begin */\nexport * from './component/routerViewEmpty.js';\nimport { ZRouterViewEmpty } from './component/routerViewEmpty.js';\nexport const components = {\n 'routerViewEmpty': ZRouterViewEmpty,\n};\nimport 'zova';\ndeclare module 'zova' {\nexport interface IComponentRecord {\n 'a-router:routerViewEmpty': ControllerRouterViewEmpty;\n}\nexport interface IZovaComponentRecord {\n 'a-router:routerViewEmpty': typeof ZRouterViewEmpty;\n}\n}\n/** components: end */\n/** config: begin */\nexport * from '../config/config.js';\nimport { config } from '../config/config.js';\n/** config: end */\n/** monkey: begin */\nexport * from '../monkey.js';\n/** monkey: end */\n/** monkeySys: begin */\nexport * from '../monkeySys.js';\n/** monkeySys: end */\n/** scope: begin */\nimport { BeanScopeBase, type BeanScopeUtil, TypeModuleConfig } from 'zova';\nimport { Scope } from 'zova-module-a-bean';\n\n@Scope()\nexport class ScopeModuleARouter extends BeanScopeBase {}\n\nexport interface ScopeModuleARouter {\n util: BeanScopeUtil;\nconfig: TypeModuleConfig<typeof config>;\n}\n\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanScopeRecord {\n 'a-router': ScopeModuleARouter;\n }\n \n export interface IBeanScopeConfig {\n 'a-router': ReturnType<typeof config>;\n }\n\n \n\n \n}\n \n/** scope: end */\n"],"mappings":";;;;;;;;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MAAE,iBAAY,aAAiB;GAC9B,MAAA,WAAA,IAAA,aAAA,SAAA;AACD,UAAK,IAAA,UAAa,UAAW,EACzB,SAAG,MACL,CAAA;;AAEF,MAAI,gBAAc,aAAK;AAGrB,UADiB,YAAY,KAAK,IAAI,KAAK,QAAA,aAAoB,EAAA,QAAW,IAAE,IAAA,IAAU,wBAAO,IAAA,IAAA,IAAA;;AAG/F,MAAI,4BAA4B;AAC9B,OAAA,QAAM,IAAU,OAChB,QAAO,IAAK,IAAA,KAAS,KAAA,MAAY,gBAAgB,IAAA,IAAA,KAAA,2BAAA,IAAA,IAAA,KAAA,KAAA,QAAA,IAAA,IAAA;AAEnD,UAAK,KAAA,IAAa,KAAE,QAAW,aAAW,EAAA;;;;;;;;ACzF9C,IAAG,MAAO,OAAA;AAgDV,IAAa,aAAU,EACrB,mBAAM,kBAAA;AAgBR,IAAA,sBAAA,OAAA,OAAA,EAAA,QAAA,SAAA,EACE,QAAO,YACR,CAAC,EAAE,KAAK,SAAQ,MAAA,SAAA,MAAA,2BAAA,cAAA,GAAA,IAAA,OAAA,IAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["RouterView","h","KeepAlive","Transition","BeanControllerBase","cast","pageRouteKey","routerViewKey","BeanRouterViewBase","__init__","bean","_setBean","$router","addRouterView","__dispose__","removeRouterView","backRoute","_route","forwardRoute","setPageMeta","_pageMeta","prepareRouteMeta","Error","getKeepAliveInclude","render","slots","default","component","routeMeta","route","vnode","Component","key","componentKey","zovaHostProviders","include","_createVNode","RouterView","h","cast","Controller","pageRouteKey","BeanRouterViewBase","ControllerRouterViewEmpty","_dec","_dec2","__z_BeanInfo","module","_class","__init__","render","slots","default","component","vnode","Component","zovaHostProviders","route","_createVNode"],"sources":["../src/model/pageData.ts","../src/lib/const.ts","../src/lib/utils.ts","../src/types/utils.ts","../src/bean/sys.router.ts","../src/bean/bean.router.ts","../src/bean/bean.routerGuardsBase.ts","../src/types/router.ts","../src/service/routerGuards.ts","../src/lib/routerViewBase.tsx","../src/component/routerViewEmpty/controller.tsx","../src/.metadata/component/routerViewEmpty.ts","../src/config/config.ts","../src/monkey.ts","../src/monkeySys.ts","../src/.metadata/index.ts"],"sourcesContent":["import type { IDecoratorModelOptions } from 'zova-module-a-model';\n\nimport { BeanModelBase, Model } from 'zova-module-a-model';\n\nexport interface IModelOptionsPageData extends IDecoratorModelOptions {}\n\n@Model<IModelOptionsPageData>()\nexport class ModelPageData<PAGEDATA = unknown> extends BeanModelBase {\n protected _pageDataInner: any;\n public current: PAGEDATA | undefined;\n\n protected async __init__() {\n if (process.env.SERVER) {\n const pagePath = this.$ssr.state.pagePath;\n if (pagePath) {\n this._pageDataInner = this.getPageData(pagePath);\n this._pageDataInner = this.$ssr.state.pageData;\n this.current = this._pageDataInner;\n }\n } else {\n if (this.$ssr.isRuntimeSsrPreHydration) {\n this.current = this.$ssr.state.pageData as PAGEDATA;\n } else {\n const route = this.$pageRoute;\n this.current = route ? this.getPageData(route.path) : undefined;\n }\n }\n }\n\n getPageData(pagePath: string): PAGEDATA {\n return this.$useStateMem({ queryKey: ['pageData', pagePath] });\n }\n}\n","export const pageRouteKey = '$$pageRoute';\nexport const routerViewKey = '$$routerView';\n","import type {\n RouteLocationMatched,\n RouteLocationNormalizedLoaded,\n RouteLocationNormalizedLoadedGeneric,\n RouterScrollBehavior,\n} from '@cabloy/vue-router';\nimport type { Ref } from 'vue';\nimport type { ZovaContext } from 'zova';\n\nimport { routerViewLocationKey } from '@cabloy/vue-router';\nimport { inject } from 'vue';\n\nimport { pageRouteKey } from './const.js';\n\nexport function getRouteMatched(route: RouteLocationNormalizedLoaded): RouteLocationMatched | undefined {\n let match = route.matched.find(item => item.aliasOf);\n if (match) {\n match = match.aliasOf;\n } else {\n match = route.matched[route.matched.length - 1];\n }\n return match;\n}\n\nexport function getRealRouteName(name?: string | symbol | null): string | undefined {\n if (!name) return undefined;\n name = String(name);\n if (name.startsWith('$:')) return undefined;\n return name;\n}\n\nexport function isRouterName(name?: string | null | undefined): boolean {\n return !!name && name.includes(':') && !name.includes('/');\n}\n\nexport function getPageRoute(ctx: ZovaContext): RouteLocationNormalizedLoadedGeneric | undefined {\n const route = ctx.bean._getBeanFromHost({ name: pageRouteKey });\n return route as RouteLocationNormalizedLoadedGeneric | undefined;\n}\n\nexport function getCurrentRoute(ctx: ZovaContext): Ref<RouteLocationNormalizedLoadedGeneric> | undefined {\n const route = ctx.util.instanceScope(() => {\n return inject(routerViewLocationKey);\n });\n return route;\n}\n\nexport const scrollBehavior: RouterScrollBehavior = (to, _from, savedPosition) => {\n if (savedPosition) {\n return new Promise(resolve => {\n setTimeout(() => {\n // savedPosition = Object.assign({}, savedPosition, { behavior: 'smooth' });\n resolve(savedPosition);\n }, 100);\n });\n } else if (to.hash) {\n return new Promise(resolve => {\n setTimeout(() => {\n // resolve({ el: to.hash, behavior: 'smooth' });\n resolve({ el: to.hash });\n }, 200);\n });\n } else {\n return { left: 0, top: 0 };\n }\n};\n","export const SymbolRouterHistory = Symbol('SymbolRouterHistory');\n\nexport interface IGotoPageOptions {\n query?: object;\n returnTo?: string | boolean;\n forceRedirect?: boolean;\n replace?: boolean;\n}\n","import type { RouteLocationMatched, RouteLocationNormalizedLoaded, RouteLocationResolvedGeneric, Router, RouterOptions } from '@cabloy/vue-router';\n\nimport { IModule } from '@cabloy/module-info';\nimport * as ModuleInfo from '@cabloy/module-info';\nimport { combineParamsAndQuery } from '@cabloy/utils';\nimport { createMemoryHistory, createRouter, createWebHashHistory, createWebHistory } from '@cabloy/vue-router';\nimport { BeanBase, cast, deepExtend } from 'zova';\nimport { Sys } from 'zova-module-a-bean';\n\nimport { getRealRouteName, getRouteMatched, isRouterName } from '../lib/utils.js';\nimport { IModuleRoute, IModuleRouteComponent, IPageNameRecord, IPagePathRecord } from '../types/router.js';\nimport { SymbolRouterHistory } from '../types/utils.js';\n\nexport interface SysRouter extends Router {}\n\n@Sys()\nexport class SysRouter extends BeanBase {\n private _vueRouterSys: Router;\n\n get router(): Router {\n return this._vueRouterSys;\n }\n\n protected __get__(prop: string) {\n return this._vueRouterSys && this._vueRouterSys[prop];\n }\n\n protected async __init__() {\n // create router\n this._vueRouterSys = this.createRouter();\n // config.routes\n this._loadConfigRoutes();\n // legacy routes\n this._loadLegacyRoutes();\n }\n\n public createRouter(options?: RouterOptions) {\n options = Object.assign({}, options);\n // matcher\n if (!options.matcher) {\n options.matcher = this._vueRouterSys?.matcher;\n }\n // routes\n if (!options.routes) {\n if (!this._vueRouterSys) {\n options.routes = [];\n }\n }\n // scrollBehavior\n if (!options.scrollBehavior) {\n options.scrollBehavior = this.scope.config.scrollBehavior;\n }\n // history\n if (!options.history) {\n const createHistory = process.env.SERVER\n ? createMemoryHistory\n : this.sys.env.ROUTER_MODE === 'history'\n ? createWebHistory\n : createWebHashHistory;\n const routeBase = process.env.SERVER || this.sys.env.ROUTER_MODE === 'history' ? this.sys.env.APP_PUBLIC_PATH : undefined;\n options.history = createHistory(routeBase);\n }\n // create\n const router = createRouter(options);\n cast(router).__hasDevtools = true;\n router[SymbolRouterHistory] = options.history;\n return router;\n }\n\n public createAsyncComponent(component: string | IModuleRouteComponent) {\n if (typeof component !== 'string') return component;\n return this.sys.meta.component.createAsyncComponent(component);\n }\n\n public getPagePath<K extends keyof IPagePathRecord>(path: K, options?: IPagePathRecord[K], absolute?: boolean) {\n const pagePath = combineParamsAndQuery(path, { params: options?.params, query: options?.query });\n return absolute ? this.sys.util.getAbsoluteUrlFromPagePath(pagePath) : pagePath;\n }\n\n public async resolveRoute(url: string, check404?: boolean, checkAliasOf?: boolean): Promise<RouteLocationResolvedGeneric | undefined> {\n const pagePath = this.sys.util.getPagePathFromAbsoluteUrl(url);\n let route = await this.ensureRoute(pagePath);\n if (check404 && route.name === '$:/:catchAll(.*)*') return;\n // aliasOf\n if (checkAliasOf) {\n const matchItem = route.matched.find(item => item.aliasOf);\n if (matchItem) {\n route = matchItem.aliasOf as unknown as RouteLocationResolvedGeneric;\n }\n // 404\n if (check404 && route.name === '$:/:catchAll(.*)*') return;\n }\n // ok\n return route;\n }\n\n public checkPathValid(to?: { name?: string; path?: string | null | undefined } | string | null | undefined): boolean {\n const _name = to && typeof to === 'object' ? to.name : undefined;\n const _path = to && typeof to === 'object' ? (to.name ?? to.path) : to;\n // legacy\n if (this._findLegacyRoute(_name, _path)) return true;\n // general check\n if (!_path) return true;\n const moduleName = ModuleInfo.parseName(_path);\n if (!moduleName) return true;\n return this.sys.meta.module.exists(moduleName);\n }\n\n public async ensureRoute(pagePath: string) {\n // try to resolve, support alias route\n let route = this._vueRouterSys.resolve(pagePath);\n if (route && route.name !== '$:/:catchAll(.*)*') return route;\n // try to load module\n const moduleName = ModuleInfo.parseName(pagePath);\n if (moduleName) {\n if (this.sys.meta.module.exists(moduleName)) {\n const module = this.sys.meta.module.get(moduleName);\n if (!module) {\n await this.sys.meta.module.use(moduleName);\n // try to resolve again\n route = this._vueRouterSys.resolve(pagePath);\n }\n }\n }\n return route;\n }\n\n /** @internal */\n public _registerRoutes(module: IModule) {\n if (!module.resource.routes) return;\n for (const route of module.resource.routes) {\n this._registerRoute(route, module);\n }\n }\n\n /** @internal */\n public _findConfigRoute(name: string | symbol | null | undefined, path: string | undefined): IModuleRoute | undefined {\n name = this.getRealRouteName(name);\n return name ? this.sys.config.routes.name[name] : this.sys.config.routes.path[path!];\n }\n\n /** @internal */\n public _findLegacyRoute(name: string | symbol | null | undefined, path: string | null | undefined): IModuleRoute | undefined {\n const legacyRoutes = cast(this.sys.meta).legacyRoutes;\n if (!legacyRoutes) return;\n name = this.getRealRouteName(name);\n return legacyRoutes.find(item => {\n return name ? item.name === name : item.path === path;\n });\n }\n\n getRouteMatched(route: RouteLocationNormalizedLoaded): RouteLocationMatched | undefined {\n return getRouteMatched(route);\n }\n\n getRealRouteName(name?: string | symbol | null): string | undefined {\n return getRealRouteName(name);\n }\n\n isRouterName(name?: string | null | undefined): boolean {\n return isRouterName(name);\n }\n\n resolveName<K extends keyof IPageNameRecord>(name: K, options?: IPageNameRecord[K]): string {\n const params = cast(options)?.params;\n const query = cast(options)?.query;\n return this._resolveNameOrPath(query, query => {\n const route = this.router.resolve({ name, params, query });\n return route.fullPath;\n });\n }\n\n resolvePath<K extends keyof IPagePathRecord>(path: K, query?: IPagePathRecord[K]): string {\n return this._resolveNameOrPath(query, query => {\n const route = this.router.resolve({ path, query });\n return route.fullPath;\n });\n }\n\n private _resolveNameOrPath(query, fn) {\n const query1 = {};\n const query2: any = [];\n if (query) {\n for (const key in query) {\n const value = query[key];\n if (value && typeof value === 'object') {\n query2.push([key, value]);\n } else {\n query1[key] = value;\n }\n }\n }\n // resolve\n const fullPath = fn(query1);\n // query2\n const query2str = query2\n .map(([key, value]) => {\n return `${encodeURIComponent(key)}=${encodeURIComponent(JSON.stringify(value))}`;\n })\n .join('&');\n // join\n if (!query2str) return fullPath;\n const join = Object.keys(query1).length > 0 ? '&' : '?';\n return `${fullPath}${join}${query2str}`;\n }\n\n private _loadConfigRoutes() {\n const routesPath = this.sys.config.routes.path;\n for (const key in routesPath) {\n const route = routesPath[key];\n if (!route) continue;\n this._loadConfigRoute({ ...route, path: key, name: `$:${key}` });\n }\n const routesName = this.sys.config.routes.name;\n for (const key in routesName) {\n const route = routesName[key];\n if (!route) continue;\n this._loadConfigRoute({ ...route, path: route.path || (route.alias as string), name: key });\n }\n }\n\n private _loadLegacyRoutes() {\n const legacyRoutes = cast(this.sys.meta).legacyRoutes;\n if (!legacyRoutes) return;\n for (const route of legacyRoutes) {\n this._registerRoute(route);\n }\n }\n\n private _loadConfigRoute(route: IModuleRoute) {\n this.router.addRoute(route);\n }\n\n private _registerRoute(route: IModuleRoute, module?: IModule) {\n // path\n let path: string | undefined;\n if (route.path !== undefined) {\n if (!module || route.meta?.absolute === true) {\n path = route.path;\n } else {\n path = route.path ? `/${module.info.pid}/${module.info.name}/${route.path}` : `/${module.info.pid}/${module.info.name}`;\n }\n }\n // name\n let name: string | undefined;\n if (route.name) {\n if (!module || route.meta?.absolute === true) {\n name = String(route.name);\n } else {\n name = `${module.info.relativeName}:${String(route.name)}`;\n }\n }\n // config route\n const configRoute = name ? this.sys.config.routes.name[name] : this.sys.config.routes.path[path!];\n if (configRoute) {\n route = deepExtend({}, route, configRoute);\n }\n // name alias\n if (name && configRoute?.alias) {\n // add extra route\n this.router.addRoute({ name: `$alias:${name}`, path: `/__alias__${configRoute?.alias}`, redirect: '' });\n }\n // name\n if (!name) {\n name = `$:${path}`;\n }\n // meta\n const meta = route.meta;\n // component\n const component = route.component;\n // layout / routeData\n let layout = meta?.layout;\n let routeData;\n let routeNameParent;\n if (layout === false) {\n routeData = { ...route, name, path, component, meta };\n } else {\n if (layout === undefined || layout === 'default') {\n layout = this.sys.config.layout.component.default;\n } else if (layout === 'empty') {\n layout = this.sys.config.layout.component.empty;\n }\n routeNameParent = `$:${name}`;\n routeData = {\n name: routeNameParent,\n path,\n component: this.createAsyncComponent(layout as any),\n children: [{ ...route, name, path: '', component, meta }],\n };\n }\n // force delete\n if (this.router.hasRoute(routeNameParent)) {\n this.router.removeRoute(routeNameParent);\n }\n if (this.router.hasRoute(name)) {\n this.router.removeRoute(name);\n }\n // add\n this.router.addRoute(routeData);\n }\n}\n","import type { NavigationGuardWithThis, NavigationHookAfter, RouteLocationNormalizedLoadedGeneric, Router } from '@cabloy/vue-router';\n\nimport { BeanBase, TypeEventOff, Use } from 'zova';\nimport { Bean } from 'zova-module-a-bean';\n\nimport { BeanRouterViewBase } from '../lib/routerViewBase.js';\nimport { ModelPageData } from '../model/pageData.js';\nimport { IPageMeta } from '../types/pageMeta.js';\nimport { TypeErrorListener } from '../types/router.js';\nimport { SysRouter } from './sys.router.js';\n\nexport interface BeanRouter extends Omit<SysRouter, '$beanFullName' | '$onionName' | '$onionOptions'> {}\n\n@Bean()\nexport class BeanRouter extends BeanBase {\n private _vueRouterApp: Router;\n private _eventRouterGuards: TypeEventOff[] = [];\n private _routerViews: BeanRouterViewBase[] = [];\n\n @Use()\n $$sysRouter: SysRouter;\n\n @Use()\n $$modelPageData: ModelPageData; // for prepare pageData on server\n\n get router(): Router {\n return this._vueRouterApp;\n }\n\n protected __dispose__() {\n for (const fn of this._eventRouterGuards) {\n fn();\n }\n }\n\n protected __get__(prop: string) {\n // SymbolRouter first\n const value = this._vueRouterApp?.[prop];\n if (value !== undefined) return value;\n return this.$$sysRouter?.[prop];\n }\n\n protected async __init__(mainRouter?: boolean) {\n // create router\n this._vueRouterApp = this.$$sysRouter.createRouter();\n if (!mainRouter) {\n // emit event\n await this.app.meta.event.emit('a-router:routerGuards', this);\n }\n }\n\n addRouterView(routerView: BeanRouterViewBase) {\n this._routerViews.push(routerView);\n }\n\n removeRouterView(routerView: BeanRouterViewBase) {\n const index = this._routerViews.findIndex(item => item === routerView);\n if (index > -1) {\n this._routerViews.splice(index, 1);\n }\n }\n\n afterEachBackRoute(route: RouteLocationNormalizedLoadedGeneric) {\n for (const routerView of this._routerViews) {\n const res = routerView.backRoute(route);\n if (res) break;\n }\n }\n\n afterEachForwardRoute(route: RouteLocationNormalizedLoadedGeneric) {\n for (const routerView of this._routerViews) {\n const res = routerView.forwardRoute(route);\n if (res) break;\n }\n }\n\n beforeEach(guard: NavigationGuardWithThis<undefined>): () => void {\n const fn = this._vueRouterApp.beforeEach(guard);\n this._eventRouterGuards.push(fn);\n return fn;\n }\n\n beforeResolve(guard: NavigationGuardWithThis<undefined>): () => void {\n const fn = this._vueRouterApp.beforeResolve(guard);\n this._eventRouterGuards.push(fn);\n return fn;\n }\n\n afterEach(guard: NavigationHookAfter): () => void {\n const fn = this._vueRouterApp.afterEach(guard);\n this._eventRouterGuards.push(fn);\n return fn;\n }\n\n onError(handler: TypeErrorListener): () => void {\n const fn = this._vueRouterApp.onError(handler);\n this._eventRouterGuards.push(fn);\n return fn;\n }\n\n setPageMeta(route: RouteLocationNormalizedLoadedGeneric, pageMeta: IPageMeta) {\n for (const routerView of this._routerViews) {\n routerView.setPageMeta(route, pageMeta);\n }\n }\n}\n","import type { TypeEventOff } from 'zova';\n\nimport { BeanBase, Virtual } from 'zova';\nimport { Bean } from 'zova-module-a-bean';\n\nimport type { BeanRouter } from './bean.router.js';\n\n@Bean()\n@Virtual()\nexport class BeanRouterGuardsBase extends BeanBase {\n private _eventRouterGuards: TypeEventOff;\n\n protected async __init__() {\n this._eventRouterGuards = this.app.meta.event.on('a-router:routerGuards', async (router, next) => {\n this.onRouterGuards(router);\n return await next();\n });\n }\n\n protected __dispose__() {\n this.dispose();\n }\n\n dispose() {\n if (this._eventRouterGuards) {\n this._eventRouterGuards();\n }\n }\n\n protected onRouterGuards(_router: BeanRouter) {}\n}\n","import type {\n NavigationFailure,\n RouteComponent,\n RouteLocationMatched,\n RouteLocationNormalized,\n RouteLocationNormalizedLoaded,\n RouteLocationNormalizedLoadedGeneric,\n RouteRecordRaw,\n} from '@cabloy/vue-router';\nimport type { z } from 'zod';\nimport type { ILayoutRecord, ILocaleRecord, TypeComponentLayoutRecord, ZovaApplication } from 'zova';\n\nimport type { BeanRouter } from '../bean/bean.router.js';\nimport type { BeanRouterViewBase } from '../lib/routerViewBase.js';\nimport type { IGotoPageOptions } from './utils.js';\nimport 'vue-router';\n\nexport type Lazy<T> = () => Promise<T>;\nexport type IModuleRouteComponent = RouteComponent | Lazy<RouteComponent>;\nexport type IModuleRoute = RouteRecordRaw;\n\nexport type TypeComponentKeyMode = 'nameOnly' | 'withParams';\n\nexport type TypeGotoPageResult = void | Promise<NavigationFailure | void | undefined>;\n\ndeclare module '@cabloy/vue-router' {\n interface RouteMeta {\n absolute?: boolean;\n layout?: keyof TypeComponentLayoutRecord | keyof ILayoutRecord | false | IModuleRouteComponent;\n requiresAuth?: boolean;\n locale?: boolean;\n locales?: Record<keyof ILocaleRecord, string>;\n componentKeyMode?: TypeComponentKeyMode;\n componentKey?: ((this: ZovaApplication, route: RouteLocationNormalizedLoaded) => string) | string;\n tabKey?: ((this: ZovaApplication, route: RouteLocationNormalizedLoaded) => string) | string;\n keepAlive?: ((this: ZovaApplication, route: RouteLocationNormalizedLoaded) => boolean) | boolean;\n }\n}\n\ndeclare module 'zova' {\n export interface ZovaApplication {\n $redirect(pagePath: string, status?: 301 | 302): never;\n $gotoPage(pagePath: string, options?: IGotoPageOptions): TypeGotoPageResult;\n $gotoHome(): TypeGotoPageResult;\n $gotoLogin(returnTo?: string, cause?: string): TypeGotoPageResult;\n $gotoReturnTo(returnTo?: string): TypeGotoPageResult;\n $getReturnTo(returnTo?: string): string;\n $getCurrentPagePath(): string | undefined;\n }\n\n export interface AppMeta {\n $router: BeanRouter;\n }\n export interface BeanBase {\n $router: BeanRouter;\n $routerView: BeanRouterViewBase;\n $pageRoute: RouteLocationNormalizedLoadedGeneric | undefined;\n $currentRoute: RouteLocationNormalizedLoadedGeneric | undefined;\n }\n\n export interface IModuleResource {\n routes: IModuleRoute[];\n }\n\n export interface IControllerDataContext {\n route?: RouteLocationNormalizedLoaded;\n }\n\n export interface IModuleResource {\n pagePathSchemas?: TypePageSchemas;\n pageNameSchemas?: TypePageSchemas;\n }\n\n export interface ZovaConfigRoutes {\n path: Record<keyof IPagePathRecord, IModuleRoute>;\n name: Record<keyof IPageNameRecord, IModuleRoute>;\n }\n\n export interface IEventRecord {\n 'a-router:routerGuards': { data: BeanRouter; result: void };\n }\n\n export interface ZovaConfigEnv {\n ROUTER_MODE: 'hash' | 'history' | 'abstract' | undefined;\n ROUTER_PAGE_HOME: string;\n ROUTER_PAGE_LOGIN: string;\n ROUTER_KEY_RETURNTO: string;\n }\n\n export interface BeanControllerPageBase {\n $route: RouteLocationNormalizedLoaded;\n $routeMatched: RouteLocationMatched;\n }\n\n // export interface IEventRecord {\n // 'a-router:routerGuards': BeanRouter;\n // }\n\n // export interface IEventResultRecord {\n // 'a-router:routerGuards': void;\n // }\n}\n\nexport interface IPageNameRecord {}\nexport interface IPagePathRecord {}\nexport interface IPagePathSchemaRecord {}\n\nexport interface TypePageSchema {\n params?: z.ZodTypeAny;\n query: z.ZodTypeAny;\n}\nexport type TypePageSchemas = Record<string, TypePageSchema>;\n\nexport interface TypePagePathSchema<PARAMS = unknown, QUERY = unknown> {\n params?: PARAMS;\n query?: QUERY;\n}\n\nexport interface TypeErrorListener {\n (error: any, to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded): any;\n}\n\nexport enum NavigationType {\n pop = 'pop',\n push = 'push',\n}\n\nexport enum NavigationDirection {\n back = 'back',\n forward = 'forward',\n unknown = '',\n}\n\nexport interface NavigationInformation {\n type: NavigationType;\n direction: NavigationDirection;\n delta: number;\n replace?: boolean;\n}\n","import * as ModuleInfo from '@cabloy/module-info';\nimport { RouteLocationNormalizedLoadedGeneric } from '@cabloy/vue-router';\nimport { Service } from 'zova-module-a-bean';\n\nimport { BeanRouter } from '../bean/bean.router.js';\nimport { BeanRouterGuardsBase } from '../bean/bean.routerGuardsBase.js';\nimport { NavigationDirection, NavigationInformation, NavigationType } from '../types/router.js';\n\n@Service()\nexport class ServiceRouterGuards extends BeanRouterGuardsBase {\n protected onRouterGuards(router: BeanRouter) {\n const self = this;\n router.beforeEach(async to => {\n // match path\n let match = to.matched.find(item => item.aliasOf);\n if (match) {\n match = match.aliasOf;\n } else {\n match = to.matched[to.matched.length - 1];\n // prepareCheck\n if (!(await this._prepareCheck(match?.path, to.path))) {\n // redirect again\n return to.fullPath;\n }\n // legacy\n const legacyRoute = router._findLegacyRoute(match?.name, match?.path);\n if (legacyRoute) return;\n // alias\n const configRoute = router._findConfigRoute(match?.name, match?.path);\n const alias = configRoute?.alias;\n if (alias) {\n // force load module\n const resLoadModule = await this._forceLoadModule(router, match?.name, match?.path);\n if (resLoadModule && resLoadModule !== true) return resLoadModule;\n if (resLoadModule === false) return to.fullPath;\n if (router.getRealRouteName(match?.name)) {\n const routeAlias = router.resolveName(\n `$alias:${match?.name as string}` as never,\n {\n params: to.params,\n query: to.query,\n } as any,\n );\n const fullPath = routeAlias.startsWith('/__alias__') ? routeAlias.substring('/__alias__'.length) : routeAlias;\n return fullPath || '/';\n } else {\n return {\n path: Array.isArray(alias) ? alias[0] : alias,\n params: to.params,\n query: to.query,\n };\n }\n }\n }\n // force load module\n const resLoadModule = await this._forceLoadModule(router, match?.name, match?.path);\n if (resLoadModule === true) return;\n if (resLoadModule) return resLoadModule;\n // redirect again\n return to.fullPath;\n });\n router.afterEach(function (to, from, error) {\n if (error) return;\n const info: NavigationInformation | undefined = arguments[3];\n // from\n if (from.fullPath !== to.fullPath) {\n self._afterEachFrom(router, from, info);\n }\n // to\n router.afterEachForwardRoute(to);\n });\n }\n\n private _afterEachFrom(router: BeanRouter, from: RouteLocationNormalizedLoadedGeneric, info: NavigationInformation | undefined) {\n if (!info) return;\n const needBack =\n (info.type === NavigationType.pop && info.direction === NavigationDirection.back) || (info.type === NavigationType.push && info.replace);\n if (!needBack) return;\n router.afterEachBackRoute(from);\n }\n\n // if 404 then check if module loaded\n private async _prepareCheck(pathMatched: string | undefined, pathTo: string): Promise<boolean> {\n if (pathMatched === '/:catchAll(.*)*') {\n const moduleInfo = ModuleInfo.parseInfo(ModuleInfo.parseName(pathTo));\n if (moduleInfo && this.app.meta.module.exists(moduleInfo.relativeName) && !this.app.meta.module.get(moduleInfo.relativeName, false)) {\n // use module\n await this.app.meta.module.use(moduleInfo.relativeName);\n // redirect again\n return false;\n }\n }\n return true;\n }\n\n private async _forceLoadModule(\n router: BeanRouter,\n name: string | symbol | null | undefined,\n path: string | undefined,\n ): Promise<string | boolean | undefined> {\n const nameOrPath = router.getRealRouteName(name) || path;\n // module info\n const moduleInfo = ModuleInfo.parseInfo(ModuleInfo.parseName(nameOrPath));\n if (!moduleInfo) {\n // donothing\n return true;\n }\n const moduleName = moduleInfo.relativeName;\n // check if exists\n if (!this.app.meta.module.exists(moduleName)) return '/404';\n // check if loaded\n const module = this.app.meta.module.get(moduleName, false);\n if (module) return true;\n // use module\n await this.app.meta.module.use(moduleName);\n // means need load\n return false;\n }\n}\n","import type { RouteLocationNormalizedLoadedGeneric } from '@cabloy/vue-router';\n\nimport { RouterView } from '@cabloy/vue-router';\nimport { h, KeepAlive, Transition } from 'vue';\nimport { BeanControllerBase, cast } from 'zova';\n\nimport type { IPageMeta } from '../types/pageMeta.js';\nimport type { IRouterViewSlotParams, IRouteViewRouteMeta } from '../types/routerView.js';\n\nimport { pageRouteKey, routerViewKey } from './const.js';\n\nexport interface IRouterViewPropsBase {}\n\nexport class BeanRouterViewBase extends BeanControllerBase implements IRouterViewPropsBase {\n protected async __init__() {\n this.bean._setBean(routerViewKey, this);\n this.$router.addRouterView(this);\n }\n\n protected __dispose__() {\n this.$router.removeRouterView(this);\n }\n\n public backRoute(_route: RouteLocationNormalizedLoadedGeneric) {\n return false;\n }\n\n public forwardRoute(_route: RouteLocationNormalizedLoadedGeneric) {\n return false;\n }\n\n public setPageMeta(_route: RouteLocationNormalizedLoadedGeneric, _pageMeta: IPageMeta) {}\n\n protected prepareRouteMeta(_route: RouteLocationNormalizedLoadedGeneric): IRouteViewRouteMeta {\n throw new Error('Not Implemented');\n }\n\n protected getKeepAliveInclude(): string[] | undefined {\n throw new Error('Not Implemented');\n }\n\n protected render() {\n const slots = {\n default: (component: IRouterViewSlotParams) => {\n const routeMeta = this.prepareRouteMeta(component.route);\n return h(Transition, null, {\n default: () => {\n const vnode = h(component.Component as any, {\n key: routeMeta.componentKey,\n });\n cast(vnode).zovaHostProviders = { [pageRouteKey]: component.route };\n return [\n h(\n KeepAlive,\n {\n include: this.getKeepAliveInclude(),\n },\n [vnode],\n ),\n ];\n },\n });\n },\n };\n return <RouterView v-slots={slots}></RouterView>;\n }\n}\n","import { RouterView } from '@cabloy/vue-router';\nimport { h } from 'vue';\nimport { cast } from 'zova';\nimport { Controller } from 'zova-module-a-bean';\n\nimport { pageRouteKey } from '../../lib/const.js';\nimport { BeanRouterViewBase } from '../../lib/routerViewBase.js';\n\n@Controller()\nexport class ControllerRouterViewEmpty extends BeanRouterViewBase {\n protected async __init__() {}\n\n protected render() {\n const slots = {\n default: component => {\n const vnode = h(component.Component);\n cast(vnode).zovaHostProviders = { [pageRouteKey]: component.route };\n return vnode;\n },\n };\n return <RouterView v-slots={slots}></RouterView>;\n }\n}\n","import { defineComponent } from 'vue';\nimport { prepareComponentOptions, useController } from 'zova';\n\nimport { ControllerRouterViewEmpty } from '../../component/routerViewEmpty/controller.jsx';\nexport type TypeControllerRouterViewEmptyPublicProps = {\n controllerRef?: (ref: ControllerRouterViewEmpty) => void;\n};\n\nexport const ZRouterViewEmpty = defineComponent((_props: TypeControllerRouterViewEmptyPublicProps) => {\n useController(ControllerRouterViewEmpty, undefined, undefined);\n return () => {};\n}, prepareComponentOptions());\n","import type { ZovaSys } from 'zova';\n\nimport { scrollBehavior } from '../lib/utils.js';\n\nexport const config = (_sys: ZovaSys) => {\n return {\n scrollBehavior,\n };\n};\n","import type { RouteLocationMatched, RouteLocationNormalizedLoadedGeneric } from '@cabloy/vue-router';\nimport type {\n BeanBase,\n BeanContainer,\n IControllerData,\n IErrorHandlerEventData,\n IMonkeyAppClose,\n IMonkeyAppInitialize,\n IMonkeyAppInitialized,\n IMonkeyAppReady,\n IMonkeyBeanInit,\n IMonkeyController,\n ZovaContext,\n} from 'zova';\nimport type { ErrorSSR } from 'zova-module-a-ssr';\n\nimport * as ModuleInfo from '@cabloy/module-info';\nimport { shallowReactive } from 'vue';\nimport { BeanControllerPageBase, BeanSimple, cast, useComputed } from 'zova';\n\nimport type { BeanRouter } from './bean/bean.router.js';\nimport type { TypePageSchema } from './types/router.js';\n\nimport { routerViewKey } from './lib/const.js';\nimport { getCurrentRoute, getPageRoute, getRealRouteName, getRouteMatched } from './lib/utils.js';\nimport { ServiceRouterGuards } from './service/routerGuards.js';\nimport { SymbolRouterHistory } from './types/utils.js';\n\nexport class Monkey\n extends BeanSimple\n implements IMonkeyAppInitialize, IMonkeyAppInitialized, IMonkeyAppReady, IMonkeyAppClose, IMonkeyBeanInit, IMonkeyController\n{\n private _beanRouter: BeanRouter;\n serviceRouterGuards: ServiceRouterGuards;\n\n async getBeanRouter() {\n if (!this._beanRouter) {\n // markReactive: true\n this._beanRouter = this.app.meta.$router = (await this.bean._getBean('a-router.bean.router', true, true)) as BeanRouter;\n }\n return this._beanRouter;\n }\n\n async appInitialize() {\n // router\n this.serviceRouterGuards = await this.bean._newBean(ServiceRouterGuards, false);\n // ssr errorHandler\n if (process.env.CLIENT) {\n this._ssrErrorHandler();\n }\n }\n\n async appInitialized() {\n const beanRouter = await this.getBeanRouter();\n // emit event\n await this.app.meta.event.emit('a-router:routerGuards', beanRouter);\n }\n\n appClose(): void {\n if (this.serviceRouterGuards) {\n this.serviceRouterGuards.dispose();\n }\n }\n\n async appReady() {\n const beanRouter = await this.getBeanRouter();\n // pagePath\n if (process.env.CLIENT && this.ctx.meta.$ssr.isRuntimeSsrPreHydration) {\n const pagePathFull = this.ctx.meta.$ssr.state.pagePathFull;\n if (pagePathFull) {\n const routerHistory = beanRouter.router[SymbolRouterHistory];\n routerHistory.push(pagePathFull);\n }\n }\n // use router\n this.app.vue.use(beanRouter);\n // ssr\n if (process.env.SERVER) {\n // push\n const pagePath = this.app.$getCurrentPagePath()!;\n beanRouter.push(pagePath);\n await beanRouter.isReady();\n } else if (process.env.CLIENT && this.ctx.meta.$ssr.isRuntimeSsrPreHydration) {\n await beanRouter.isReady();\n }\n }\n\n async beanInit(bean: BeanContainer, beanInstance: BeanBase) {\n bean.defineProperty(beanInstance, '$router', {\n enumerable: false,\n configurable: true,\n get() {\n return bean._getBeanFromHost('a-router.bean.router');\n },\n });\n bean.defineProperty(beanInstance, '$routerView', {\n enumerable: false,\n configurable: true,\n get() {\n return bean._getBeanFromHost({ name: routerViewKey });\n },\n });\n bean.defineProperty(beanInstance, '$pageRoute', {\n enumerable: false,\n configurable: true,\n get() {\n return useComputed(() => {\n return getPageRoute(cast(bean).ctx);\n });\n },\n });\n bean.defineProperty(beanInstance, '$currentRoute', {\n enumerable: false,\n configurable: true,\n get() {\n return useComputed(() => {\n return getCurrentRoute(cast(bean).ctx);\n });\n },\n });\n }\n\n controllerDataPrepare(controllerData: IControllerData, ctx: ZovaContext) {\n controllerData.context.route = getPageRoute(ctx);\n }\n\n controllerDataInit(controllerData: IControllerData, controller: BeanBase) {\n // only for controller page\n if (!(controller instanceof BeanControllerPageBase)) return;\n const route = controllerData.context.route;\n this._initControllerRoute(route, controller);\n }\n\n controllerDataUpdate(controller: BeanBase) {\n // only for controller page\n if (!(controller instanceof BeanControllerPageBase)) return;\n const route = getPageRoute(cast<ZovaContext>(cast(controller).ctx));\n this._initControllerRoute(route, controller);\n }\n\n private _initControllerRoute(route: RouteLocationNormalizedLoadedGeneric | undefined, controller: BeanControllerPageBase) {\n if (!route) return;\n const routeMatched = getRouteMatched(route);\n if (!routeMatched) return;\n // check if the same\n if (controller.$routeMatched && !this._checkIfRouteSame(routeMatched, controller.$routeMatched)) return;\n // check if changed\n const changed = !controller.$route || controller.$route.fullPath !== route.fullPath;\n if (!changed) return;\n controller.$route = route;\n controller.$routeMatched = routeMatched;\n // update $params/$query\n const routeName = getRealRouteName(routeMatched.name);\n const schemaKey = routeName || String(routeMatched.path);\n let schemas: TypePageSchema | undefined;\n const moduleInfo = ModuleInfo.parseInfo(ModuleInfo.parseName(schemaKey));\n if (!moduleInfo) {\n // do nothing\n return;\n }\n if (!this.app.meta.module.exists(moduleInfo.relativeName)) {\n // do nothing\n return;\n }\n const module = this.app.meta.module.get(moduleInfo.relativeName)!;\n if (routeName) {\n schemas = module.resource.pageNameSchemas?.[schemaKey];\n } else {\n schemas = module.resource.pagePathSchemas?.[schemaKey];\n }\n if (schemas?.params) {\n const params = schemas.params.parse(route.params);\n if (!controller.$params) {\n controller.$params = process.env.SERVER ? params : shallowReactive(params as any);\n } else {\n // hold the same $params ref\n Object.assign(controller.$params as any, params);\n }\n }\n if (schemas?.query) {\n const query = schemas.query.parse(route.query);\n if (!controller.$query) {\n controller.$query = process.env.SERVER ? query : shallowReactive(query as any);\n } else {\n // hold the same $query ref\n Object.assign(controller.$query as any, query);\n }\n }\n }\n\n private _checkIfRouteSame(route1: RouteLocationMatched, route2: RouteLocationMatched) {\n return (route1.name && route1.name === route2.name) || route1.path === route2.path;\n }\n\n private _ssrErrorHandler() {\n if (!process.env.CLIENT) return;\n this.app.meta.event.on('app:errorHandler', (data, next) => {\n const err = next();\n if (!err || !(err instanceof Error)) return err;\n return this._errorHandlerDefaultClient(err, data);\n });\n }\n\n private _errorHandlerDefaultClient(err: ErrorSSR, _data: IErrorHandlerEventData) {\n if (!process.env.CLIENT) return err;\n // client\n if ([301, 302].includes(Number(err.code))) {\n this.app.$gotoPage(err.pagePath!);\n return undefined;\n }\n // COMPONENT_UNMOUNTED\n if (err.code === 600) {\n // do nothing\n return undefined;\n }\n // 401\n if (err.code === 401) {\n this.app.$gotoLogin();\n return undefined;\n }\n // not handled\n return err;\n }\n}\n","import type { IModule } from '@cabloy/module-info';\nimport type { IMonkeyModuleSys, IMonkeySysApplicationInitialize, ZovaApplication } from 'zova';\nimport type { ErrorSSR } from 'zova-module-a-ssr';\n\nimport { combineQueries } from '@cabloy/utils';\nimport { BeanSimple, cast, isHttpUrl } from 'zova';\n\nimport type { SysRouter } from './bean/sys.router.js';\nimport type { TypeGotoPageResult } from './types/router.js';\nimport type { IGotoPageOptions } from './types/utils.js';\n\nexport class MonkeySys extends BeanSimple implements IMonkeyModuleSys, IMonkeySysApplicationInitialize {\n private _moduleSelf: IModule;\n private _sysRouter: SysRouter;\n\n constructor(moduleSelf: IModule) {\n super();\n this._moduleSelf = moduleSelf;\n }\n\n async getSysRouter() {\n if (!this._sysRouter) {\n this._sysRouter = (await this.bean._getBean('a-router.sys.router', false)) as SysRouter;\n }\n return this._sysRouter;\n }\n\n async moduleLoading(module: IModule) {\n if (this._moduleSelf === module) return;\n if (!module.resource.routes) return;\n const sysRouter = await this.getSysRouter();\n sysRouter._registerRoutes(module);\n }\n\n async moduleLoaded(_module: IModule) {}\n async configLoaded(_module: IModule, _config) {}\n\n sysApplicationInitialize(app: ZovaApplication): void {\n app.$redirect = (pagePath: string, status?: 301 | 302): never => {\n const error = new Error() as ErrorSSR;\n error.code = status ?? 302;\n if (isHttpUrl(pagePath)) {\n error.pagePath = pagePath;\n error.url = pagePath;\n } else {\n error.pagePath = pagePath;\n error.url = app.sys.util.getAbsoluteUrlFromPagePath(pagePath, true);\n }\n error.message = process.env.SERVER ? error.url : error.pagePath;\n throw error;\n };\n app.$gotoPage = (pagePath: string, options?: IGotoPageOptions): TypeGotoPageResult => {\n const query = options?.query ?? {};\n // returnTo\n if (options?.returnTo) {\n const returnTo = typeof options?.returnTo === 'string' ? options?.returnTo : app.$getCurrentPagePath();\n if (returnTo !== app.sys.env.ROUTER_PAGE_HOME) {\n query[app.sys.env.ROUTER_KEY_RETURNTO] = returnTo;\n }\n }\n // combineQueries\n pagePath = combineQueries(pagePath, query);\n // redirect\n if (process.env.SERVER || options?.forceRedirect) {\n return app.$redirect(pagePath);\n }\n // replace\n if (isHttpUrl(pagePath)) {\n window.location[options?.replace ? 'replace' : 'assign'](pagePath);\n } else {\n return app.meta.$router[options?.replace ? 'replace' : 'push'](pagePath);\n }\n };\n app.$gotoHome = () => {\n return app.$gotoPage(app.sys.env.ROUTER_PAGE_HOME);\n };\n app.$gotoLogin = (returnTo?: string, cause?: string) => {\n if (!returnTo && cast(app.meta.$router.currentRoute)?.path === app.sys.env.ROUTER_PAGE_LOGIN) return;\n const query: any = {};\n if (cause) {\n query.cause = cause;\n }\n const returnTo2 = returnTo === app.sys.env.ROUTER_PAGE_LOGIN ? undefined : (returnTo ?? true);\n return app.$gotoPage(app.sys.env.ROUTER_PAGE_LOGIN, { query, returnTo: returnTo2 });\n };\n app.$gotoReturnTo = (returnTo?: string) => {\n const pagePath = app.$getReturnTo(returnTo);\n return app.$gotoPage(pagePath, { replace: true });\n };\n app.$getReturnTo = (returnTo?: string) => {\n // not use ??\n const pagePath = returnTo || cast(app.meta.$router.currentRoute)?.query?.[app.sys.env.ROUTER_KEY_RETURNTO] || app.sys.env.ROUTER_PAGE_HOME;\n return pagePath;\n };\n app.$getCurrentPagePath = (): string | undefined => {\n if (process.env.SERVER) {\n return app.ctx.meta.$ssr.state.pagePathFull ?? app.sys.util.getPagePathFromAbsoluteUrl(app.ctx.meta.$ssr.context.req.url);\n }\n return cast(app.meta.$router.currentRoute)?.fullPath;\n };\n }\n}\n","// eslint-disable\n/** model: begin */\nexport * from '../model/pageData.js';\nimport { IModelOptionsPageData } from '../model/pageData.js';\nimport 'zova-module-a-model';\ndeclare module 'zova-module-a-model' {\n \n export interface IModelRecord {\n 'a-router:pageData': IModelOptionsPageData;\n }\n\n \n}\ndeclare module 'zova-module-a-router' {\n \n export interface ModelPageData {\n /** @internal */\n get scope(): ScopeModuleARouter;\n }\n\n export interface ModelPageData {\n get $beanFullName(): 'a-router.model.pageData';\n get $onionName(): 'a-router:pageData';\n get $onionOptions(): IModelOptionsPageData;\n } \n}\n/** model: end */\n/** model: begin */\nimport { ModelPageData } from '../model/pageData.js';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordGeneral {\n 'a-router.model.pageData': ModelPageData;\n }\n}\n/** model: end */\n/** sys: begin */\nexport * from '../bean/sys.router.js';\n\nimport 'zova';\ndeclare module 'zova' {\n \n \n}\ndeclare module 'zova-module-a-router' {\n \n export interface SysRouter {\n /** @internal */\n get scope(): ScopeModuleARouter;\n }\n\n export interface SysRouter {\n get $beanFullName(): 'a-router.sys.router';\n get $onionName(): 'a-router:router';\n \n } \n}\n/** sys: end */\n/** sys: begin */\nimport { SysRouter } from '../bean/sys.router.js';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordGeneral {\n 'a-router.sys.router': SysRouter;\n }\n}\n/** sys: end */\n/** bean: begin */\nexport * from '../bean/bean.router.js';\nexport * from '../bean/bean.routerGuardsBase.js';\n\nimport 'zova';\ndeclare module 'zova' {\n \n \n}\ndeclare module 'zova-module-a-router' {\n \n export interface BeanRouter {\n /** @internal */\n get scope(): ScopeModuleARouter;\n }\n\n export interface BeanRouter {\n get $beanFullName(): 'a-router.bean.router';\n get $onionName(): 'a-router:router';\n \n } \n}\n/** bean: end */\n/** bean: begin */\nimport { BeanRouter } from '../bean/bean.router.js';\nimport { BeanRouterGuardsBase } from '../bean/bean.routerGuardsBase.js';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordGeneral {\n 'a-router.bean.router': BeanRouter;\n'a-router.bean.routerGuardsBase': BeanRouterGuardsBase;\n }\n}\n/** bean: end */\n/** service: begin */\nexport * from '../service/routerGuards.js';\n\nimport 'zova-module-a-bean';\ndeclare module 'zova-module-a-bean' {\n \n export interface IServiceRecord {\n 'a-router:routerGuards': never;\n }\n\n \n}\ndeclare module 'zova-module-a-router' {\n \n export interface ServiceRouterGuards {\n /** @internal */\n get scope(): ScopeModuleARouter;\n }\n\n export interface ServiceRouterGuards {\n get $beanFullName(): 'a-router.service.routerGuards';\n get $onionName(): 'a-router:routerGuards';\n \n } \n}\n/** service: end */\n/** service: begin */\nimport { ServiceRouterGuards } from '../service/routerGuards.js';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordGeneral {\n 'a-router.service.routerGuards': ServiceRouterGuards;\n }\n}\n/** service: end */\n/** controller: begin */\nexport * from '../component/routerViewEmpty/controller.jsx';\n\nimport 'zova';\ndeclare module 'zova' {\n \n \n}\ndeclare module 'zova-module-a-router' {\n \n export interface ControllerRouterViewEmpty {\n /** @internal */\n get scope(): ScopeModuleARouter;\n } \n}\n/** controller: end */\n/** controller: begin */\nimport { ControllerRouterViewEmpty } from '../component/routerViewEmpty/controller.jsx';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordLocal {\n 'a-router.controller.routerViewEmpty': ControllerRouterViewEmpty;\n }\n}\n/** controller: end */\n\n/** components: begin */\nexport * from './component/routerViewEmpty.js';\nimport { ZRouterViewEmpty } from './component/routerViewEmpty.js';\nexport const components = {\n 'routerViewEmpty': ZRouterViewEmpty,\n};\nimport 'zova';\ndeclare module 'zova' {\nexport interface IComponentRecord {\n 'a-router:routerViewEmpty': ControllerRouterViewEmpty;\n}\nexport interface IZovaComponentRecord {\n 'a-router:routerViewEmpty': typeof ZRouterViewEmpty;\n}\n}\n/** components: end */\n/** config: begin */\nexport * from '../config/config.js';\nimport { config } from '../config/config.js';\n/** config: end */\n/** monkey: begin */\nexport * from '../monkey.js';\n/** monkey: end */\n/** monkeySys: begin */\nexport * from '../monkeySys.js';\n/** monkeySys: end */\n/** scope: begin */\nimport { BeanScopeBase, type BeanScopeUtil, TypeModuleConfig } from 'zova';\nimport { Scope } from 'zova-module-a-bean';\n\n@Scope()\nexport class ScopeModuleARouter extends BeanScopeBase {}\n\nexport interface ScopeModuleARouter {\n util: BeanScopeUtil;\nconfig: TypeModuleConfig<typeof config>;\n}\n\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanScopeRecord {\n 'a-router': ScopeModuleARouter;\n }\n \n export interface IBeanScopeConfig {\n 'a-router': ReturnType<typeof config>;\n }\n\n \n\n \n}\n \n/** scope: end */\n"],"mappings":";;;;;;;;;AAAA,IAAA,QAAO,SAAO;4DAId,QAAO,YAAA,CAAA,EAAA,OAAA,WAAA,QAAA,WAAA,MAAA,sBAAA,cAAA;CAEN,YAAM,GAAA,MAAA;AACP,QAAO,GAAM,KAAA;AACX,OAAA,iBAAwB,KAAK;AAC7B,OAAO,UAAS,KAAA;;CAEhB,MAAA,WAAgB;AACd,MAAI,QAAQ,IAAI,QAAQ;GACtB,MAAM,WAAW,KAAK,KAAK,MAAM;AACjC,OAAI,UAAU;AACZ,SAAK,iBAAiB,KAAK,YAAY,SAAS;AAChD,SAAK,iBAAiB,KAAK,KAAK,MAAM;AACtC,SAAK,UAAU,KAAK;;aAGlB,KAAK,KAAK,yBACZ,MAAK,UAAU,KAAK,KAAK,MAAM;OAC1B;GACL,MAAM,QAAQ,KAAK;AACnB,QAAK,UAAU,QAAQ,KAAK,YAAY,MAAM,KAAK,GAAG,KAAA;;;;AAK5D,SAAA,KAAY,aAAU,EACpB,UAAY,CAAC,YAAY,SAAE,EA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"}
|
package/dist/monkeySys.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monkeySys.d.ts","sourceRoot":"","sources":["../src/monkeySys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,+BAA+B,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAI/F,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"monkeySys.d.ts","sourceRoot":"","sources":["../src/monkeySys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,+BAA+B,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAI/F,OAAO,EAAE,UAAU,EAAmB,MAAM,MAAM,CAAC;AAEnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAItD,qBAAa,SAAU,SAAQ,UAAW,YAAW,gBAAgB,EAAE,+BAA+B;IACpG,OAAO,CAAC,WAAW,CAAU;IAC7B,OAAO,CAAC,UAAU,CAAY;gBAElB,UAAU,EAAE,OAAO;IAKzB,YAAY;IAOZ,aAAa,CAAC,MAAM,EAAE,OAAO;IAO7B,YAAY,CAAC,OAAO,EAAE,OAAO;IAC7B,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,KAAA;IAE5C,wBAAwB,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI;CAgErD"}
|
package/package.json
CHANGED
package/src/monkeySys.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { IMonkeyModuleSys, IMonkeySysApplicationInitialize, ZovaApplication
|
|
|
3
3
|
import type { ErrorSSR } from 'zova-module-a-ssr';
|
|
4
4
|
|
|
5
5
|
import { combineQueries } from '@cabloy/utils';
|
|
6
|
-
import { BeanSimple, cast } from 'zova';
|
|
6
|
+
import { BeanSimple, cast, isHttpUrl } from 'zova';
|
|
7
7
|
|
|
8
8
|
import type { SysRouter } from './bean/sys.router.js';
|
|
9
9
|
import type { TypeGotoPageResult } from './types/router.js';
|
|
@@ -39,7 +39,7 @@ export class MonkeySys extends BeanSimple implements IMonkeyModuleSys, IMonkeySy
|
|
|
39
39
|
app.$redirect = (pagePath: string, status?: 301 | 302): never => {
|
|
40
40
|
const error = new Error() as ErrorSSR;
|
|
41
41
|
error.code = status ?? 302;
|
|
42
|
-
if (
|
|
42
|
+
if (isHttpUrl(pagePath)) {
|
|
43
43
|
error.pagePath = pagePath;
|
|
44
44
|
error.url = pagePath;
|
|
45
45
|
} else {
|
|
@@ -65,7 +65,7 @@ export class MonkeySys extends BeanSimple implements IMonkeyModuleSys, IMonkeySy
|
|
|
65
65
|
return app.$redirect(pagePath);
|
|
66
66
|
}
|
|
67
67
|
// replace
|
|
68
|
-
if (
|
|
68
|
+
if (isHttpUrl(pagePath)) {
|
|
69
69
|
window.location[options?.replace ? 'replace' : 'assign'](pagePath);
|
|
70
70
|
} else {
|
|
71
71
|
return app.meta.$router[options?.replace ? 'replace' : 'push'](pagePath);
|