wevu 6.25.1 → 7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev/index.mjs +1 -1
- package/dist/dev/internal-runtime.mjs +1 -1
- package/dist/dev/package.mjs +1 -1
- package/dist/dev/router/createRouter.mjs +80 -12
- package/dist/dev/router/createRouter.mjs.map +1 -1
- package/dist/dev/router/initialNavigation.mjs +141 -0
- package/dist/dev/router/initialNavigation.mjs.map +1 -0
- package/dist/dev/router/navigationTarget.mjs +3 -2
- package/dist/dev/router/navigationTarget.mjs.map +1 -1
- package/dist/dev/router/types.mjs.map +1 -1
- package/dist/dev/router/useRoute.mjs +14 -1
- package/dist/dev/router/useRoute.mjs.map +1 -1
- package/dist/dev/routerInternal/snapshots.mjs +3 -1
- package/dist/dev/routerInternal/snapshots.mjs.map +1 -1
- package/dist/dev/runtime/register/component/lifecycle.mjs +29 -13
- package/dist/dev/runtime/register/component/lifecycle.mjs.map +1 -1
- package/dist/dev/runtime/register/component/registerDefinition.mjs +69 -32
- package/dist/dev/runtime/register/component/registerDefinition.mjs.map +1 -1
- package/dist/dev/vue-demi.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/internal-runtime.mjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/router/createRouter.mjs +1 -1
- package/dist/router/initialNavigation.mjs +1 -0
- package/dist/router/navigationTarget.mjs +1 -1
- package/dist/router/types.d.mts +10 -1
- package/dist/router/useRoute.mjs +1 -1
- package/dist/router.d.mts +2 -2
- package/dist/routerInternal/snapshots.mjs +1 -1
- package/dist/runtime/register/component/lifecycle.mjs +1 -1
- package/dist/runtime/register/component/registerDefinition.mjs +1 -1
- package/dist/vue-demi.mjs +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRoute.mjs","names":["useNativeRouterInternal","useNativePageRouterInternal"],"sources":["../../../src/router/useRoute.ts"],"sourcesContent":["import type { MiniProgramPageLifetime } from '../runtime/types'\nimport type { SetupContextRouter } from '../runtime/types/props'\nimport type { RouteStateSyncPayload } from './routeSync'\nimport type { LocationQueryRaw, RouteLocationNormalizedLoaded } from './types'\nimport { reactive, readonly } from '../reactivity'\nimport { cloneLocationQuery, cloneRouteLocationRedirectedFrom, cloneRouteMeta, cloneRouteParams, cloneRouteRecordMatchedList, resolveCurrentRoute, resolvePageRoute } from '../routerInternal/shared'\nimport { getCurrentSetupContext, onLoad, onReady, onRouteDone, onShow, onUnload } from '../runtime/hooks'\nimport {\n useNativePageRouter as useNativePageRouterInternal,\n useNativeRouter as useNativeRouterInternal,\n} from '../runtime/vueCompat'\nimport { getActiveRouter } from './instance'\nimport { resolveRouteLocation } from './resolve'\nimport { registerRouteStateSyncHandler } from './routeSync'\n\nexport interface UseRouteOptions {\n resolveRoute?: (route: RouteLocationNormalizedLoaded) => RouteLocationNormalizedLoaded\n}\n\ninterface RouteStateControllerOptions extends UseRouteOptions {\n beforeRouteStateSync?: (\n nextRoute: RouteLocationNormalizedLoaded,\n payload: RouteStateSyncPayload,\n ) => void\n}\n\nexport interface RouteStateController {\n route: Readonly<RouteLocationNormalizedLoaded>\n}\n\nfunction applyRouteState(\n routeState: RouteLocationNormalizedLoaded,\n nextRoute: RouteLocationNormalizedLoaded,\n) {\n routeState.path = nextRoute.path\n routeState.fullPath = nextRoute.fullPath\n routeState.query = cloneLocationQuery(nextRoute.query)\n routeState.hash = nextRoute.hash\n routeState.params = cloneRouteParams(nextRoute.params)\n if (nextRoute.name === undefined) {\n delete (routeState as Partial<RouteLocationNormalizedLoaded>).name\n }\n else {\n routeState.name = nextRoute.name\n }\n if (nextRoute.meta === undefined) {\n delete (routeState as Partial<RouteLocationNormalizedLoaded>).meta\n }\n else {\n routeState.meta = cloneRouteMeta(nextRoute.meta)\n }\n if (nextRoute.href === undefined) {\n delete (routeState as Partial<RouteLocationNormalizedLoaded>).href\n }\n else {\n routeState.href = nextRoute.href\n }\n if (nextRoute.matched === undefined) {\n delete (routeState as Partial<RouteLocationNormalizedLoaded>).matched\n }\n else {\n routeState.matched = cloneRouteRecordMatchedList(nextRoute.matched)\n }\n if (nextRoute.redirectedFrom === undefined) {\n delete (routeState as Partial<RouteLocationNormalizedLoaded>).redirectedFrom\n }\n else {\n routeState.redirectedFrom = cloneRouteLocationRedirectedFrom(nextRoute.redirectedFrom)\n }\n}\n\nexport function createRouteStateController(options: RouteStateControllerOptions = {}): RouteStateController {\n const setupContext = getCurrentSetupContext()\n if (!setupContext) {\n throw new Error('useRoute() 必须在 setup() 的同步阶段调用')\n }\n\n const fallbackPage = setupContext.instance\n const resolveRoute = options.resolveRoute\n ?? ((route: RouteLocationNormalizedLoaded) => getActiveRouter()?.resolve(route) ?? route)\n const currentRoute = resolveRoute(resolveCurrentRoute(undefined, fallbackPage))\n const routeState = reactive<RouteLocationNormalizedLoaded>({\n path: currentRoute.path,\n fullPath: currentRoute.fullPath,\n query: cloneLocationQuery(currentRoute.query),\n hash: currentRoute.hash,\n params: cloneRouteParams(currentRoute.params),\n })\n applyRouteState(routeState, currentRoute)\n\n function syncRoute(\n queryOverride?: LocationQueryRaw,\n routeOverride?: RouteLocationNormalizedLoaded,\n payload?: RouteStateSyncPayload,\n ) {\n const nextRoute = routeOverride\n ? resolveRoute(routeOverride)\n : resolveRoute(resolveCurrentRoute(queryOverride, fallbackPage))\n if (payload) {\n options.beforeRouteStateSync?.(nextRoute, payload)\n }\n applyRouteState(routeState, nextRoute)\n }\n\n onLoad((query: Parameters<NonNullable<MiniProgramPageLifetime['onLoad']>>[0]) => {\n syncRoute(query as unknown as LocationQueryRaw)\n })\n onReady(() => {\n syncRoute()\n })\n onShow(() => {\n syncRoute()\n })\n onRouteDone(() => {\n syncRoute()\n })\n const unregisterRouteStateSync = registerRouteStateSyncHandler((payload) => {\n if (payload?.route) {\n syncRoute(undefined, payload.route, payload)\n return\n }\n if (payload?.page) {\n syncRoute(undefined, resolvePageRoute(payload.page), payload)\n return\n }\n if (payload?.url) {\n syncRoute(undefined, resolveRouteLocation(payload.url, routeState.path), payload)\n return\n }\n syncRoute(undefined, undefined, payload)\n })\n onUnload(() => {\n unregisterRouteStateSync()\n })\n\n return {\n route: readonly(routeState) as Readonly<RouteLocationNormalizedLoaded>,\n }\n}\n\nexport function useRoute(options: UseRouteOptions = {}): Readonly<RouteLocationNormalizedLoaded> {\n return createRouteStateController(options).route\n}\n\n/**\n * @description 获取当前组件路径语义的原生 Router\n */\nexport function useNativeRouter(): SetupContextRouter {\n return useNativeRouterInternal()\n}\n\n/**\n * @description 获取当前页面路径语义的原生 Page Router\n */\nexport function useNativePageRouter(): SetupContextRouter {\n return useNativePageRouterInternal()\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useRoute.mjs","names":["useNativeRouterInternal","useNativePageRouterInternal"],"sources":["../../../src/router/useRoute.ts"],"sourcesContent":["import type { MiniProgramPageLifetime } from '../runtime/types'\nimport type { SetupContextRouter } from '../runtime/types/props'\nimport type { RouteStateSyncPayload } from './routeSync'\nimport type { LocationQueryRaw, RouteLocationNormalizedLoaded } from './types'\nimport { reactive, readonly } from '../reactivity'\nimport { cloneLocationQuery, cloneRouteLocationRedirectedFrom, cloneRouteMeta, cloneRouteParams, cloneRouteRecordMatchedList, resolveCurrentRoute, resolvePageRoute } from '../routerInternal/shared'\nimport { getCurrentSetupContext, onLoad, onReady, onRouteDone, onShow, onUnload } from '../runtime/hooks'\nimport { getCurrentMiniProgramPages } from '../runtime/platform'\nimport {\n useNativePageRouter as useNativePageRouterInternal,\n useNativeRouter as useNativeRouterInternal,\n} from '../runtime/vueCompat'\nimport { getActiveRouter } from './instance'\nimport { resolveRouteLocation } from './resolve'\nimport { registerRouteStateSyncHandler } from './routeSync'\n\nexport interface UseRouteOptions {\n resolveRoute?: (route: RouteLocationNormalizedLoaded) => RouteLocationNormalizedLoaded\n}\n\ninterface RouteStateControllerOptions extends UseRouteOptions {\n beforeRouteStateSync?: (\n nextRoute: RouteLocationNormalizedLoaded,\n payload: RouteStateSyncPayload,\n ) => void\n}\n\nexport interface RouteStateController {\n route: Readonly<RouteLocationNormalizedLoaded>\n}\n\nfunction isPageLikeInstance(instance: Record<string, any>): boolean {\n return typeof instance.route === 'string' || typeof instance.__route__ === 'string'\n}\n\nfunction shouldSyncRouteStateForInstance(\n instance: Record<string, any>,\n isPageController: boolean,\n payload: RouteStateSyncPayload | undefined,\n): boolean {\n if (payload?.source === 'router') {\n return true\n }\n\n // 页面级 route controller 只处理当前页面的广播,避免 DevTools 在 onUnload/onShow\n // 交错时让隐藏页面重复执行导航守卫。组件级 controller 仍接收全局同步。\n if (!isPageController) {\n return true\n }\n\n if (payload?.page) {\n return payload.page === instance\n }\n\n const pages = getCurrentMiniProgramPages()\n return pages[pages.length - 1] === instance\n}\n\nfunction applyRouteState(\n routeState: RouteLocationNormalizedLoaded,\n nextRoute: RouteLocationNormalizedLoaded,\n) {\n routeState.path = nextRoute.path\n routeState.fullPath = nextRoute.fullPath\n routeState.query = cloneLocationQuery(nextRoute.query)\n routeState.hash = nextRoute.hash\n routeState.params = cloneRouteParams(nextRoute.params)\n if (nextRoute.name === undefined) {\n delete (routeState as Partial<RouteLocationNormalizedLoaded>).name\n }\n else {\n routeState.name = nextRoute.name\n }\n if (nextRoute.meta === undefined) {\n delete (routeState as Partial<RouteLocationNormalizedLoaded>).meta\n }\n else {\n routeState.meta = cloneRouteMeta(nextRoute.meta)\n }\n if (nextRoute.href === undefined) {\n delete (routeState as Partial<RouteLocationNormalizedLoaded>).href\n }\n else {\n routeState.href = nextRoute.href\n }\n if (nextRoute.matched === undefined) {\n delete (routeState as Partial<RouteLocationNormalizedLoaded>).matched\n }\n else {\n routeState.matched = cloneRouteRecordMatchedList(nextRoute.matched)\n }\n if (nextRoute.redirectedFrom === undefined) {\n delete (routeState as Partial<RouteLocationNormalizedLoaded>).redirectedFrom\n }\n else {\n routeState.redirectedFrom = cloneRouteLocationRedirectedFrom(nextRoute.redirectedFrom)\n }\n}\n\nexport function createRouteStateController(options: RouteStateControllerOptions = {}): RouteStateController {\n const setupContext = getCurrentSetupContext()\n if (!setupContext) {\n throw new Error('useRoute() 必须在 setup() 的同步阶段调用')\n }\n\n const fallbackPage = setupContext.instance\n const resolveRoute = options.resolveRoute\n ?? ((route: RouteLocationNormalizedLoaded) => getActiveRouter()?.resolve(route) ?? route)\n const currentRoute = resolveRoute(resolveCurrentRoute(undefined, fallbackPage))\n const isPageController = isPageLikeInstance(fallbackPage)\n || getCurrentMiniProgramPages().includes(fallbackPage)\n const routeState = reactive<RouteLocationNormalizedLoaded>({\n path: currentRoute.path,\n fullPath: currentRoute.fullPath,\n query: cloneLocationQuery(currentRoute.query),\n hash: currentRoute.hash,\n params: cloneRouteParams(currentRoute.params),\n })\n applyRouteState(routeState, currentRoute)\n\n function syncRoute(\n queryOverride?: LocationQueryRaw,\n routeOverride?: RouteLocationNormalizedLoaded,\n payload?: RouteStateSyncPayload,\n ) {\n const nextRoute = routeOverride\n ? resolveRoute(routeOverride)\n : resolveRoute(resolveCurrentRoute(queryOverride, fallbackPage))\n if (payload) {\n options.beforeRouteStateSync?.(nextRoute, payload)\n }\n applyRouteState(routeState, nextRoute)\n }\n\n onLoad((query: Parameters<NonNullable<MiniProgramPageLifetime['onLoad']>>[0]) => {\n syncRoute(query as unknown as LocationQueryRaw)\n })\n onReady(() => {\n syncRoute()\n })\n onShow(() => {\n syncRoute()\n })\n onRouteDone(() => {\n syncRoute()\n })\n const unregisterRouteStateSync = registerRouteStateSyncHandler((payload) => {\n if (!shouldSyncRouteStateForInstance(fallbackPage, isPageController, payload)) {\n return\n }\n if (payload?.route) {\n syncRoute(undefined, payload.route, payload)\n return\n }\n if (payload?.page) {\n syncRoute(undefined, resolvePageRoute(payload.page), payload)\n return\n }\n if (payload?.url) {\n syncRoute(undefined, resolveRouteLocation(payload.url, routeState.path), payload)\n return\n }\n syncRoute(undefined, undefined, payload)\n })\n onUnload(() => {\n unregisterRouteStateSync()\n })\n\n return {\n route: readonly(routeState) as Readonly<RouteLocationNormalizedLoaded>,\n }\n}\n\nexport function useRoute(options: UseRouteOptions = {}): Readonly<RouteLocationNormalizedLoaded> {\n return createRouteStateController(options).route\n}\n\n/**\n * @description 获取当前组件路径语义的原生 Router\n */\nexport function useNativeRouter(): SetupContextRouter {\n return useNativeRouterInternal()\n}\n\n/**\n * @description 获取当前页面路径语义的原生 Page Router\n */\nexport function useNativePageRouter(): SetupContextRouter {\n return useNativePageRouterInternal()\n}\n"],"mappings":";;;;;;;;;;;;;AA+BA,SAAS,mBAAmB,UAAwC;CAClE,OAAO,OAAO,SAAS,UAAU,YAAY,OAAO,SAAS,cAAc;AAC7E;AAEA,SAAS,gCACP,UACA,kBACA,SACS;CACT,uDAAI,QAAS,YAAW,UACtB,OAAO;CAKT,IAAI,CAAC,kBACH,OAAO;CAGT,sDAAI,QAAS,MACX,OAAO,QAAQ,SAAS;CAG1B,MAAM,QAAQ,2BAA2B;CACzC,OAAO,MAAM,MAAM,SAAS,OAAO;AACrC;AAEA,SAAS,gBACP,YACA,WACA;CACA,WAAW,OAAO,UAAU;CAC5B,WAAW,WAAW,UAAU;CAChC,WAAW,QAAQ,mBAAmB,UAAU,KAAK;CACrD,WAAW,OAAO,UAAU;CAC5B,WAAW,SAAS,iBAAiB,UAAU,MAAM;CACrD,IAAI,UAAU,SAAS,QACrB,OAAQ,WAAsD;MAG9D,WAAW,OAAO,UAAU;CAE9B,IAAI,UAAU,SAAS,QACrB,OAAQ,WAAsD;MAG9D,WAAW,OAAO,eAAe,UAAU,IAAI;CAEjD,IAAI,UAAU,SAAS,QACrB,OAAQ,WAAsD;MAG9D,WAAW,OAAO,UAAU;CAE9B,IAAI,UAAU,YAAY,QACxB,OAAQ,WAAsD;MAG9D,WAAW,UAAU,4BAA4B,UAAU,OAAO;CAEpE,IAAI,UAAU,mBAAmB,QAC/B,OAAQ,WAAsD;MAG9D,WAAW,iBAAiB,iCAAiC,UAAU,cAAc;AAEzF;AAEA,SAAgB,2BAA2B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AAU,QAAW,QAAW,OAAO;CACzC,CAAC;CACD,eAAe;EACb,yBAAyB;CAC3B,CAAC;CAED,OAAO,EACL,OAAO,SAAS,UAAU,EAC5B;AACF;AAEA,SAAgB,SAAS,UAA2B,CAAC,GAA4C;CAC/F,OAAO,2BAA2B,OAAO,CAAC,CAAC;AAC7C;;;;AAKA,SAAgB,kBAAsC;CACpD,OAAOA,kBAAwB;AACjC;;;;AAKA,SAAgB,sBAA0C;CACxD,OAAOC,sBAA4B;AACrC"}
|
|
@@ -19,7 +19,7 @@ function freezeRouteRecordRawSnapshot(routeRecord) {
|
|
|
19
19
|
if (routeRecord.redirect !== void 0) snapshot.redirect = routeRecord.redirect;
|
|
20
20
|
return Object.freeze(snapshot);
|
|
21
21
|
}
|
|
22
|
-
function createRouterOptionsSnapshot(normalizedTabBarEntries, normalizedNamedRoutes, paramsMode, maxRedirects, routeResolveCodec, rejectOnError) {
|
|
22
|
+
function createRouterOptionsSnapshot(normalizedTabBarEntries, normalizedNamedRoutes, paramsMode, maxRedirects, initialNavigationMode, initialNavigationTimeout, routeResolveCodec, rejectOnError) {
|
|
23
23
|
const tabBarEntriesSnapshot = Object.freeze(normalizedTabBarEntries.map((path) => createAbsoluteRoutePath(path)));
|
|
24
24
|
const routesSnapshot = Object.freeze(normalizedNamedRoutes.map(freezeRouteRecordRawSnapshot));
|
|
25
25
|
return Object.freeze({
|
|
@@ -28,6 +28,8 @@ function createRouterOptionsSnapshot(normalizedTabBarEntries, normalizedNamedRou
|
|
|
28
28
|
namedRoutes: routesSnapshot,
|
|
29
29
|
paramsMode,
|
|
30
30
|
maxRedirects,
|
|
31
|
+
initialNavigationMode,
|
|
32
|
+
initialNavigationTimeout,
|
|
31
33
|
parseQuery: routeResolveCodec.parseQuery,
|
|
32
34
|
stringifyQuery: routeResolveCodec.stringifyQuery,
|
|
33
35
|
rejectOnError
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshots.mjs","names":[],"sources":["../../../src/routerInternal/snapshots.ts"],"sourcesContent":["import type {\n LocationQuery,\n RouteLocationNormalizedLoaded,\n RouteLocationRedirectedFrom,\n RouteMeta,\n RouteParams,\n RouteParamsMode,\n RouteQueryStringifier,\n RouteRecordMatched,\n RouteRecordRaw,\n UseRouterOptions,\n} from '../router'\nimport type { RouteRecordNormalized, RouteResolveCodec } from './types'\nimport { createAbsoluteRoutePath, resolvePath } from './path'\nimport { stringifyQuery } from './query'\n\nexport function cloneRouteMeta(meta?: RouteMeta): RouteMeta | undefined {\n if (!meta) {\n return undefined\n }\n return {\n ...meta,\n }\n}\n\nfunction freezeRouteRecordRawSnapshot(routeRecord: RouteRecordRaw): Readonly<RouteRecordRaw> {\n const snapshot: RouteRecordRaw = {\n name: routeRecord.name,\n path: routeRecord.path,\n }\n\n if (routeRecord.meta !== undefined) {\n snapshot.meta = cloneRouteMeta(routeRecord.meta)\n }\n if (Array.isArray(routeRecord.alias)) {\n snapshot.alias = Object.freeze(routeRecord.alias.slice())\n }\n else if (routeRecord.alias !== undefined) {\n snapshot.alias = routeRecord.alias\n }\n if (Array.isArray(routeRecord.beforeEnter)) {\n snapshot.beforeEnter = Object.freeze(routeRecord.beforeEnter.slice())\n }\n else if (routeRecord.beforeEnter !== undefined) {\n snapshot.beforeEnter = routeRecord.beforeEnter\n }\n if (routeRecord.redirect !== undefined) {\n snapshot.redirect = routeRecord.redirect\n }\n\n return Object.freeze(snapshot)\n}\n\nexport function createRouterOptionsSnapshot(\n normalizedTabBarEntries: readonly string[],\n normalizedNamedRoutes: readonly RouteRecordRaw[],\n paramsMode: RouteParamsMode,\n maxRedirects: number,\n routeResolveCodec: RouteResolveCodec,\n rejectOnError: boolean,\n): Readonly<UseRouterOptions> {\n const tabBarEntriesSnapshot = Object.freeze(\n normalizedTabBarEntries.map(path => createAbsoluteRoutePath(path)),\n )\n const routesSnapshot = Object.freeze(\n normalizedNamedRoutes.map(freezeRouteRecordRawSnapshot),\n ) as readonly RouteRecordRaw[]\n\n return Object.freeze({\n tabBarEntries: tabBarEntriesSnapshot,\n routes: routesSnapshot,\n namedRoutes: routesSnapshot,\n paramsMode,\n maxRedirects,\n parseQuery: routeResolveCodec.parseQuery,\n stringifyQuery: routeResolveCodec.stringifyQuery,\n rejectOnError,\n })\n}\n\nexport function normalizeRouteRecordMatched(\n record: RouteRecordNormalized,\n matchedPath?: string,\n): RouteRecordMatched {\n const matchedRecord: RouteRecordMatched = {\n name: record.name,\n path: createAbsoluteRoutePath(record.path),\n }\n const normalizedMatchedPath = typeof matchedPath === 'string' && matchedPath\n ? createAbsoluteRoutePath(resolvePath(matchedPath, ''))\n : undefined\n if (normalizedMatchedPath && normalizedMatchedPath !== matchedRecord.path) {\n matchedRecord.aliasPath = normalizedMatchedPath\n }\n if (record.meta !== undefined) {\n matchedRecord.meta = cloneRouteMeta(record.meta)\n }\n return matchedRecord\n}\n\nexport function cloneRouteRecordMatchedList(matched?: readonly RouteRecordMatched[]): RouteRecordMatched[] | undefined {\n if (!matched) {\n return undefined\n }\n return matched.map(record => ({\n name: record.name,\n path: record.path,\n aliasPath: record.aliasPath,\n meta: cloneRouteMeta(record.meta),\n }))\n}\n\nexport function cloneLocationQuery(query: LocationQuery): LocationQuery {\n const cloned: LocationQuery = {}\n for (const key of Object.keys(query)) {\n const value = query[key]\n cloned[key] = Array.isArray(value) ? value.slice() : value\n }\n return cloned\n}\n\nexport function cloneRouteParams(params: RouteParams): RouteParams {\n const cloned: RouteParams = {}\n for (const key of Object.keys(params)) {\n const value = params[key]\n cloned[key] = Array.isArray(value) ? value.slice() : value\n }\n return cloned\n}\n\nexport function cloneRouteLocationRedirectedFrom(\n redirectedFrom?: RouteLocationRedirectedFrom,\n): RouteLocationRedirectedFrom | undefined {\n if (!redirectedFrom) {\n return undefined\n }\n\n const cloned: RouteLocationRedirectedFrom = {\n path: redirectedFrom.path,\n fullPath: redirectedFrom.fullPath,\n query: cloneLocationQuery(redirectedFrom.query),\n hash: redirectedFrom.hash,\n params: cloneRouteParams(redirectedFrom.params),\n }\n if (redirectedFrom.name !== undefined) {\n cloned.name = redirectedFrom.name\n }\n if (redirectedFrom.meta !== undefined) {\n cloned.meta = cloneRouteMeta(redirectedFrom.meta)\n }\n if (redirectedFrom.href !== undefined) {\n cloned.href = redirectedFrom.href\n }\n if (redirectedFrom.matched !== undefined) {\n cloned.matched = cloneRouteRecordMatchedList(redirectedFrom.matched)\n }\n return cloned\n}\n\nexport function createRedirectedFromSnapshot(route: RouteLocationNormalizedLoaded): RouteLocationRedirectedFrom {\n const snapshot: RouteLocationRedirectedFrom = {\n path: route.path,\n fullPath: route.fullPath,\n query: cloneLocationQuery(route.query),\n hash: route.hash,\n params: cloneRouteParams(route.params),\n }\n if (route.name !== undefined) {\n snapshot.name = route.name\n }\n if (route.meta !== undefined) {\n snapshot.meta = cloneRouteMeta(route.meta)\n }\n if (route.href !== undefined) {\n snapshot.href = route.href\n }\n if (route.matched !== undefined) {\n snapshot.matched = cloneRouteRecordMatchedList(route.matched)\n }\n return snapshot\n}\n\nexport function snapshotRouteLocation(route: RouteLocationNormalizedLoaded): RouteLocationNormalizedLoaded {\n const snapshot: RouteLocationNormalizedLoaded = {\n path: route.path,\n fullPath: route.fullPath,\n query: cloneLocationQuery(route.query),\n hash: route.hash,\n params: cloneRouteParams(route.params),\n }\n if (route.meta !== undefined) {\n snapshot.meta = cloneRouteMeta(route.meta)\n }\n if (route.href !== undefined) {\n snapshot.href = route.href\n }\n if (route.matched !== undefined) {\n snapshot.matched = cloneRouteRecordMatchedList(route.matched)\n }\n if (route.redirectedFrom !== undefined) {\n snapshot.redirectedFrom = cloneRouteLocationRedirectedFrom(route.redirectedFrom)\n }\n if (route.name !== undefined) {\n snapshot.name = route.name\n }\n return snapshot\n}\n\nexport function createNativeRouteUrl(\n target: RouteLocationNormalizedLoaded,\n queryStringifier: RouteQueryStringifier = stringifyQuery,\n): string {\n const basePath = createAbsoluteRoutePath(target.path)\n const queryString = queryStringifier(target.query)\n return queryString ? `${basePath}?${queryString}` : basePath\n}\n\nexport function hasLocationQuery(query: LocationQuery): boolean {\n return Object.keys(query).length > 0\n}\n"],"mappings":";;;;AAgBA,SAAgB,eAAe,MAAyC;CACtE,IAAI,CAAC,MACH;CAEF,OAAO,EACL,GAAG,KACL;AACF;AAEA,SAAS,6BAA6B,aAAuD;CAC3F,MAAM,WAA2B;EAC/B,MAAM,YAAY;EAClB,MAAM,YAAY;CACpB;CAEA,IAAI,YAAY,SAAS,QACvB,SAAS,OAAO,eAAe,YAAY,IAAI;CAEjD,IAAI,MAAM,QAAQ,YAAY,KAAK,GACjC,SAAS,QAAQ,OAAO,OAAO,YAAY,MAAM,MAAM,CAAC;MAErD,IAAI,YAAY,UAAU,QAC7B,SAAS,QAAQ,YAAY;CAE/B,IAAI,MAAM,QAAQ,YAAY,WAAW,GACvC,SAAS,cAAc,OAAO,OAAO,YAAY,YAAY,MAAM,CAAC;MAEjE,IAAI,YAAY,gBAAgB,QACnC,SAAS,cAAc,YAAY;CAErC,IAAI,YAAY,aAAa,QAC3B,SAAS,WAAW,YAAY;CAGlC,OAAO,OAAO,OAAO,QAAQ;AAC/B;AAEA,SAAgB,4BACd,yBACA,uBACA,YACA,cACA,mBACA,eAC4B;CAC5B,MAAM,wBAAwB,OAAO,OACnC,wBAAwB,KAAI,SAAQ,wBAAwB,IAAI,CAAC,CACnE;CACA,MAAM,iBAAiB,OAAO,OAC5B,sBAAsB,IAAI,4BAA4B,CACxD;CAEA,OAAO,OAAO,OAAO;EACnB,eAAe;EACf,QAAQ;EACR,aAAa;EACb;EACA;EACA,YAAY,kBAAkB;EAC9B,gBAAgB,kBAAkB;EAClC;CACF,CAAC;AACH;AAEA,SAAgB,4BACd,QACA,aACoB;CACpB,MAAM,gBAAoC;EACxC,MAAM,OAAO;EACb,MAAM,wBAAwB,OAAO,IAAI;CAC3C;CACA,MAAM,wBAAwB,OAAO,gBAAgB,YAAY,cAC7D,wBAAwB,YAAY,aAAa,EAAE,CAAC,IACpD;CACJ,IAAI,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AAM;EACZ,UAAU,MAAM;EAChB,OAAO,mBAAmB,MAAM,KAAK;EACrC,MAAM,MAAM;EACZ,QAAQ,iBAAiB,MAAM,MAAM;CACvC;CACA,IAAI,MAAM,SAAS,QACjB,SAAS,OAAO,MAAM;CAExB,IAAI,MAAM,SAAS,QACjB,SAAS,OAAO,eAAe,MAAM,IAAI;CAE3C,IAAI,MAAM,SAAS,QACjB,SAAS,OAAO,MAAM;CAExB,IAAI,MAAM,YAAY,QACpB,SAAS,UAAU,4BAA4B,MAAM,OAAO;CAE9D,OAAO;AACT;AAEA,SAAgB,sBAAsB,OAAqE;CACzG,MAAM,WAA0C;EAC9C,MAAM,MAAM;EACZ,UAAU,MAAM;EAChB,OAAO,mBAAmB,MAAM,KAAK;EACrC,MAAM,MAAM;EACZ,QAAQ,iBAAiB,MAAM,MAAM;CACvC;CACA,IAAI,MAAM,SAAS,QACjB,SAAS,OAAO,eAAe,MAAM,IAAI;CAE3C,IAAI,MAAM,SAAS,QACjB,SAAS,OAAO,MAAM;CAExB,IAAI,MAAM,YAAY,QACpB,SAAS,UAAU,4BAA4B,MAAM,OAAO;CAE9D,IAAI,MAAM,mBAAmB,QAC3B,SAAS,iBAAiB,iCAAiC,MAAM,cAAc;CAEjF,IAAI,MAAM,SAAS,QACjB,SAAS,OAAO,MAAM;CAExB,OAAO;AACT;AAEA,SAAgB,qBACd,QACA,mBAA0C,gBAClC;CACR,MAAM,WAAW,wBAAwB,OAAO,IAAI;CACpD,MAAM,cAAc,iBAAiB,OAAO,KAAK;CACjD,OAAO,cAAc,GAAG,SAAS,GAAG,gBAAgB;AACtD;AAEA,SAAgB,iBAAiB,OAA+B;CAC9D,OAAO,OAAO,KAAK,KAAK,CAAC,CAAC,SAAS;AACrC"}
|
|
1
|
+
{"version":3,"file":"snapshots.mjs","names":[],"sources":["../../../src/routerInternal/snapshots.ts"],"sourcesContent":["import type {\n InitialNavigationMode,\n LocationQuery,\n RouteLocationNormalizedLoaded,\n RouteLocationRedirectedFrom,\n RouteMeta,\n RouteParams,\n RouteParamsMode,\n RouteQueryStringifier,\n RouteRecordMatched,\n RouteRecordRaw,\n UseRouterOptions,\n} from '../router'\nimport type { RouteRecordNormalized, RouteResolveCodec } from './types'\nimport { createAbsoluteRoutePath, resolvePath } from './path'\nimport { stringifyQuery } from './query'\n\nexport function cloneRouteMeta(meta?: RouteMeta): RouteMeta | undefined {\n if (!meta) {\n return undefined\n }\n return {\n ...meta,\n }\n}\n\nfunction freezeRouteRecordRawSnapshot(routeRecord: RouteRecordRaw): Readonly<RouteRecordRaw> {\n const snapshot: RouteRecordRaw = {\n name: routeRecord.name,\n path: routeRecord.path,\n }\n\n if (routeRecord.meta !== undefined) {\n snapshot.meta = cloneRouteMeta(routeRecord.meta)\n }\n if (Array.isArray(routeRecord.alias)) {\n snapshot.alias = Object.freeze(routeRecord.alias.slice())\n }\n else if (routeRecord.alias !== undefined) {\n snapshot.alias = routeRecord.alias\n }\n if (Array.isArray(routeRecord.beforeEnter)) {\n snapshot.beforeEnter = Object.freeze(routeRecord.beforeEnter.slice())\n }\n else if (routeRecord.beforeEnter !== undefined) {\n snapshot.beforeEnter = routeRecord.beforeEnter\n }\n if (routeRecord.redirect !== undefined) {\n snapshot.redirect = routeRecord.redirect\n }\n\n return Object.freeze(snapshot)\n}\n\nexport function createRouterOptionsSnapshot(\n normalizedTabBarEntries: readonly string[],\n normalizedNamedRoutes: readonly RouteRecordRaw[],\n paramsMode: RouteParamsMode,\n maxRedirects: number,\n initialNavigationMode: InitialNavigationMode,\n initialNavigationTimeout: number,\n routeResolveCodec: RouteResolveCodec,\n rejectOnError: boolean,\n): Readonly<UseRouterOptions> {\n const tabBarEntriesSnapshot = Object.freeze(\n normalizedTabBarEntries.map(path => createAbsoluteRoutePath(path)),\n )\n const routesSnapshot = Object.freeze(\n normalizedNamedRoutes.map(freezeRouteRecordRawSnapshot),\n ) as readonly RouteRecordRaw[]\n\n return Object.freeze({\n tabBarEntries: tabBarEntriesSnapshot,\n routes: routesSnapshot,\n namedRoutes: routesSnapshot,\n paramsMode,\n maxRedirects,\n initialNavigationMode,\n initialNavigationTimeout,\n parseQuery: routeResolveCodec.parseQuery,\n stringifyQuery: routeResolveCodec.stringifyQuery,\n rejectOnError,\n })\n}\n\nexport function normalizeRouteRecordMatched(\n record: RouteRecordNormalized,\n matchedPath?: string,\n): RouteRecordMatched {\n const matchedRecord: RouteRecordMatched = {\n name: record.name,\n path: createAbsoluteRoutePath(record.path),\n }\n const normalizedMatchedPath = typeof matchedPath === 'string' && matchedPath\n ? createAbsoluteRoutePath(resolvePath(matchedPath, ''))\n : undefined\n if (normalizedMatchedPath && normalizedMatchedPath !== matchedRecord.path) {\n matchedRecord.aliasPath = normalizedMatchedPath\n }\n if (record.meta !== undefined) {\n matchedRecord.meta = cloneRouteMeta(record.meta)\n }\n return matchedRecord\n}\n\nexport function cloneRouteRecordMatchedList(matched?: readonly RouteRecordMatched[]): RouteRecordMatched[] | undefined {\n if (!matched) {\n return undefined\n }\n return matched.map(record => ({\n name: record.name,\n path: record.path,\n aliasPath: record.aliasPath,\n meta: cloneRouteMeta(record.meta),\n }))\n}\n\nexport function cloneLocationQuery(query: LocationQuery): LocationQuery {\n const cloned: LocationQuery = {}\n for (const key of Object.keys(query)) {\n const value = query[key]\n cloned[key] = Array.isArray(value) ? value.slice() : value\n }\n return cloned\n}\n\nexport function cloneRouteParams(params: RouteParams): RouteParams {\n const cloned: RouteParams = {}\n for (const key of Object.keys(params)) {\n const value = params[key]\n cloned[key] = Array.isArray(value) ? value.slice() : value\n }\n return cloned\n}\n\nexport function cloneRouteLocationRedirectedFrom(\n redirectedFrom?: RouteLocationRedirectedFrom,\n): RouteLocationRedirectedFrom | undefined {\n if (!redirectedFrom) {\n return undefined\n }\n\n const cloned: RouteLocationRedirectedFrom = {\n path: redirectedFrom.path,\n fullPath: redirectedFrom.fullPath,\n query: cloneLocationQuery(redirectedFrom.query),\n hash: redirectedFrom.hash,\n params: cloneRouteParams(redirectedFrom.params),\n }\n if (redirectedFrom.name !== undefined) {\n cloned.name = redirectedFrom.name\n }\n if (redirectedFrom.meta !== undefined) {\n cloned.meta = cloneRouteMeta(redirectedFrom.meta)\n }\n if (redirectedFrom.href !== undefined) {\n cloned.href = redirectedFrom.href\n }\n if (redirectedFrom.matched !== undefined) {\n cloned.matched = cloneRouteRecordMatchedList(redirectedFrom.matched)\n }\n return cloned\n}\n\nexport function createRedirectedFromSnapshot(route: RouteLocationNormalizedLoaded): RouteLocationRedirectedFrom {\n const snapshot: RouteLocationRedirectedFrom = {\n path: route.path,\n fullPath: route.fullPath,\n query: cloneLocationQuery(route.query),\n hash: route.hash,\n params: cloneRouteParams(route.params),\n }\n if (route.name !== undefined) {\n snapshot.name = route.name\n }\n if (route.meta !== undefined) {\n snapshot.meta = cloneRouteMeta(route.meta)\n }\n if (route.href !== undefined) {\n snapshot.href = route.href\n }\n if (route.matched !== undefined) {\n snapshot.matched = cloneRouteRecordMatchedList(route.matched)\n }\n return snapshot\n}\n\nexport function snapshotRouteLocation(route: RouteLocationNormalizedLoaded): RouteLocationNormalizedLoaded {\n const snapshot: RouteLocationNormalizedLoaded = {\n path: route.path,\n fullPath: route.fullPath,\n query: cloneLocationQuery(route.query),\n hash: route.hash,\n params: cloneRouteParams(route.params),\n }\n if (route.meta !== undefined) {\n snapshot.meta = cloneRouteMeta(route.meta)\n }\n if (route.href !== undefined) {\n snapshot.href = route.href\n }\n if (route.matched !== undefined) {\n snapshot.matched = cloneRouteRecordMatchedList(route.matched)\n }\n if (route.redirectedFrom !== undefined) {\n snapshot.redirectedFrom = cloneRouteLocationRedirectedFrom(route.redirectedFrom)\n }\n if (route.name !== undefined) {\n snapshot.name = route.name\n }\n return snapshot\n}\n\nexport function createNativeRouteUrl(\n target: RouteLocationNormalizedLoaded,\n queryStringifier: RouteQueryStringifier = stringifyQuery,\n): string {\n const basePath = createAbsoluteRoutePath(target.path)\n const queryString = queryStringifier(target.query)\n return queryString ? `${basePath}?${queryString}` : basePath\n}\n\nexport function hasLocationQuery(query: LocationQuery): boolean {\n return Object.keys(query).length > 0\n}\n"],"mappings":";;;;AAiBA,SAAgB,eAAe,MAAyC;CACtE,IAAI,CAAC,MACH;CAEF,OAAO,EACL,GAAG,KACL;AACF;AAEA,SAAS,6BAA6B,aAAuD;CAC3F,MAAM,WAA2B;EAC/B,MAAM,YAAY;EAClB,MAAM,YAAY;CACpB;CAEA,IAAI,YAAY,SAAS,QACvB,SAAS,OAAO,eAAe,YAAY,IAAI;CAEjD,IAAI,MAAM,QAAQ,YAAY,KAAK,GACjC,SAAS,QAAQ,OAAO,OAAO,YAAY,MAAM,MAAM,CAAC;MAErD,IAAI,YAAY,UAAU,QAC7B,SAAS,QAAQ,YAAY;CAE/B,IAAI,MAAM,QAAQ,YAAY,WAAW,GACvC,SAAS,cAAc,OAAO,OAAO,YAAY,YAAY,MAAM,CAAC;MAEjE,IAAI,YAAY,gBAAgB,QACnC,SAAS,cAAc,YAAY;CAErC,IAAI,YAAY,aAAa,QAC3B,SAAS,WAAW,YAAY;CAGlC,OAAO,OAAO,OAAO,QAAQ;AAC/B;AAEA,SAAgB,4BACd,yBACA,uBACA,YACA,cACA,uBACA,0BACA,mBACA,eAC4B;CAC5B,MAAM,wBAAwB,OAAO,OACnC,wBAAwB,KAAI,SAAQ,wBAAwB,IAAI,CAAC,CACnE;CACA,MAAM,iBAAiB,OAAO,OAC5B,sBAAsB,IAAI,4BAA4B,CACxD;CAEA,OAAO,OAAO,OAAO;EACnB,eAAe;EACf,QAAQ;EACR,aAAa;EACb;EACA;EACA;EACA;EACA,YAAY,kBAAkB;EAC9B,gBAAgB,kBAAkB;EAClC;CACF,CAAC;AACH;AAEA,SAAgB,4BACd,QACA,aACoB;CACpB,MAAM,gBAAoC;EACxC,MAAM,OAAO;EACb,MAAM,wBAAwB,OAAO,IAAI;CAC3C;CACA,MAAM,wBAAwB,OAAO,gBAAgB,YAAY,cAC7D,wBAAwB,YAAY,aAAa,EAAE,CAAC,IAC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;EAC5C,MAAM,MAAM;EACZ,UAAU,MAAM;EAChB,OAAO,mBAAmB,MAAM,KAAK;EACrC,MAAM,MAAM;EACZ,QAAQ,iBAAiB,MAAM,MAAM;CACvC;CACA,IAAI,MAAM,SAAS,QACjB,SAAS,OAAO,MAAM;CAExB,IAAI,MAAM,SAAS,QACjB,SAAS,OAAO,eAAe,MAAM,IAAI;CAE3C,IAAI,MAAM,SAAS,QACjB,SAAS,OAAO,MAAM;CAExB,IAAI,MAAM,YAAY,QACpB,SAAS,UAAU,4BAA4B,MAAM,OAAO;CAE9D,OAAO;AACT;AAEA,SAAgB,sBAAsB,OAAqE;CACzG,MAAM,WAA0C;EAC9C,MAAM,MAAM;EACZ,UAAU,MAAM;EAChB,OAAO,mBAAmB,MAAM,KAAK;EACrC,MAAM,MAAM;EACZ,QAAQ,iBAAiB,MAAM,MAAM;CACvC;CACA,IAAI,MAAM,SAAS,QACjB,SAAS,OAAO,eAAe,MAAM,IAAI;CAE3C,IAAI,MAAM,SAAS,QACjB,SAAS,OAAO,MAAM;CAExB,IAAI,MAAM,YAAY,QACpB,SAAS,UAAU,4BAA4B,MAAM,OAAO;CAE9D,IAAI,MAAM,mBAAmB,QAC3B,SAAS,iBAAiB,iCAAiC,MAAM,cAAc;CAEjF,IAAI,MAAM,SAAS,QACjB,SAAS,OAAO,MAAM;CAExB,OAAO;AACT;AAEA,SAAgB,qBACd,QACA,mBAA0C,gBAClC;CACR,MAAM,WAAW,wBAAwB,OAAO,IAAI;CACpD,MAAM,cAAc,iBAAiB,OAAO,KAAK;CACjD,OAAO,cAAc,GAAG,SAAS,GAAG,gBAAgB;AACtD;AAEA,SAAgB,iBAAiB,OAA+B;CAC9D,OAAO,OAAO,KAAK,KAAK,CAAC,CAAC,SAAS;AACrC"}
|
|
@@ -2,6 +2,7 @@ import { callHookList } from "../../hooks/base.mjs";
|
|
|
2
2
|
import { bindCurrentPageInstance, ensureMiniProgramGlobalPatched, ensurePageShareMenus, releaseCurrentPageInstance, resolvePageOptions } from "./lifecycle/platform.mjs";
|
|
3
3
|
import { scheduleTemplateRefUpdate } from "../../templateRefs.mjs";
|
|
4
4
|
import { enableDeferredSetData, mountRuntimeInstance, setRuntimeSetDataVisibility, teardownRuntimeInstance } from "../runtimeInstance.mjs";
|
|
5
|
+
import { cancelInitialNavigation, ensureInitialNavigation } from "../../../router/initialNavigation.mjs";
|
|
5
6
|
import { notifyRouteStateSync } from "../../../router/routeSync.mjs";
|
|
6
7
|
import { attachOptionalPageLifecycleHooks } from "./lifecycle/optionalHooks.mjs";
|
|
7
8
|
import { WEVU_ON_LOAD_CALLED_KEY, WEVU_READY_CALLED_KEY, WEVU_ROUTE_DONE_CALLED_KEY } from "@weapp-core/constants";
|
|
@@ -17,19 +18,27 @@ function createPageLifecycleHooks(options) {
|
|
|
17
18
|
onLoad(...args) {
|
|
18
19
|
if (this[WEVU_ON_LOAD_CALLED_KEY]) return;
|
|
19
20
|
this[WEVU_ON_LOAD_CALLED_KEY] = true;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
const mountPage = () => {
|
|
22
|
+
mountRuntimeInstance(this, runtimeApp, watch, setup);
|
|
23
|
+
const pageOptions = args[0] && typeof args[0] === "object" ? args[0] : resolvePageOptions(this);
|
|
24
|
+
syncWevuPropsFromValues === null || syncWevuPropsFromValues === void 0 || syncWevuPropsFromValues(this, pageOptions);
|
|
25
|
+
flushPageSnapshotIfPossible(this);
|
|
26
|
+
enableDeferredSetData(this);
|
|
27
|
+
if (isPage) ensurePageShareMenus({
|
|
28
|
+
enableOnShareAppMessage,
|
|
29
|
+
enableOnShareTimeline
|
|
30
|
+
});
|
|
31
|
+
callHookList(this, "onLoad", args);
|
|
32
|
+
if (typeof userOnLoad === "function") return userOnLoad.apply(this, args.length ? args : [pageOptions]);
|
|
33
|
+
};
|
|
34
|
+
const initialNavigationPromise = isPage ? ensureInitialNavigation(this, args[0], { onComplete: (shouldMount) => {
|
|
35
|
+
if (shouldMount) mountPage();
|
|
36
|
+
} }) : void 0;
|
|
37
|
+
if (initialNavigationPromise) return initialNavigationPromise;
|
|
38
|
+
return mountPage();
|
|
31
39
|
},
|
|
32
40
|
onUnload(...args) {
|
|
41
|
+
cancelInitialNavigation(this);
|
|
33
42
|
if (isPage) releaseCurrentPageInstance(this);
|
|
34
43
|
teardownRuntimeInstance(this);
|
|
35
44
|
if (typeof userOnUnload === "function") return userOnUnload.apply(this, args);
|
|
@@ -82,10 +91,17 @@ function createPageLifecycleHooks(options) {
|
|
|
82
91
|
}
|
|
83
92
|
}, 0);
|
|
84
93
|
}
|
|
85
|
-
|
|
94
|
+
const callReadyHooks = () => {
|
|
86
95
|
callHookList(this, "onReady", args);
|
|
87
96
|
if (typeof userOnReady === "function") userOnReady.apply(this, args);
|
|
88
|
-
}
|
|
97
|
+
};
|
|
98
|
+
const scheduleReadyHooks = () => scheduleTemplateRefUpdate(this, callReadyHooks);
|
|
99
|
+
if (!(isPage ? ensureInitialNavigation(this, void 0, {
|
|
100
|
+
start: false,
|
|
101
|
+
onComplete: (shouldMount) => {
|
|
102
|
+
if (shouldMount) scheduleReadyHooks();
|
|
103
|
+
}
|
|
104
|
+
}) : void 0)) scheduleReadyHooks();
|
|
89
105
|
return;
|
|
90
106
|
}
|
|
91
107
|
if (typeof userOnReady === "function") return userOnReady.apply(this, args);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle.mjs","names":[],"sources":["../../../../../src/runtime/register/component/lifecycle.ts"],"sourcesContent":["import type { MiniProgramPageLike } from '../../../routerInternal/shared'\nimport type { ComponentPropsOptions, ComputedDefinitions, DefineComponentOptions, InternalRuntimeState, MethodDefinitions, RuntimeApp } from '../../types'\nimport type { WatchMap } from '../watch'\nimport {\n WEVU_ON_LOAD_CALLED_KEY,\n WEVU_READY_CALLED_KEY,\n WEVU_ROUTE_DONE_CALLED_KEY,\n} from '@weapp-core/constants'\nimport { notifyRouteStateSync } from '../../../router/routeSync'\nimport { callHookList } from '../../hooks'\nimport { scheduleTemplateRefUpdate } from '../../templateRefs'\nimport { enableDeferredSetData, mountRuntimeInstance, setRuntimeSetDataVisibility, teardownRuntimeInstance } from '../runtimeInstance'\nimport { attachOptionalPageLifecycleHooks } from './lifecycle/optionalHooks'\nimport { bindCurrentPageInstance, ensureMiniProgramGlobalPatched, ensurePageShareMenus, releaseCurrentPageInstance, resolvePageOptions } from './lifecycle/platform'\n\nexport function createPageLifecycleHooks<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(options: {\n runtimeApp: RuntimeApp<D, C, M>\n watch: WatchMap | undefined\n setup: DefineComponentOptions<ComponentPropsOptions, D, C, M>['setup']\n userOnLoad?: any\n userOnUnload?: any\n userOnShow?: any\n userOnHide?: any\n userOnReady?: any\n isPage: boolean\n enableOnSaveExitState: boolean\n enableOnPullDownRefresh: boolean\n enableOnReachBottom: boolean\n enableOnPageScroll: boolean\n enableOnRouteDone: boolean\n enableOnRouteDoneFallback: boolean\n enableOnTabItemTap: boolean\n enableOnResize: boolean\n enableOnShareAppMessage: boolean\n enableOnShareTimeline: boolean\n enableOnAddToFavorites: boolean\n syncWevuPropsFromValues?: (instance: InternalRuntimeState, values: Record<string, unknown> | undefined) => void\n effectiveOnSaveExitState: (...args: any[]) => any\n effectiveOnPullDownRefresh: (...args: any[]) => any\n effectiveOnReachBottom: (...args: any[]) => any\n effectiveOnPageScroll: (...args: any[]) => any\n effectiveOnRouteDone: (...args: any[]) => any\n effectiveOnTabItemTap: (...args: any[]) => any\n effectiveOnResize: (...args: any[]) => any\n effectiveOnShareAppMessage: (...args: any[]) => any\n effectiveOnShareTimeline: (...args: any[]) => any\n effectiveOnAddToFavorites: (...args: any[]) => any\n hasHook: (target: InternalRuntimeState, name: string) => boolean\n}) {\n const {\n runtimeApp,\n watch,\n setup,\n userOnLoad,\n userOnUnload,\n userOnShow,\n userOnHide,\n userOnReady,\n isPage,\n enableOnSaveExitState,\n enableOnPullDownRefresh,\n enableOnReachBottom,\n enableOnPageScroll,\n enableOnRouteDone,\n enableOnRouteDoneFallback,\n enableOnTabItemTap,\n enableOnResize,\n enableOnShareAppMessage,\n enableOnShareTimeline,\n enableOnAddToFavorites,\n syncWevuPropsFromValues,\n effectiveOnSaveExitState,\n effectiveOnPullDownRefresh,\n effectiveOnReachBottom,\n effectiveOnPageScroll,\n effectiveOnRouteDone,\n effectiveOnTabItemTap,\n effectiveOnResize,\n effectiveOnShareAppMessage,\n effectiveOnShareTimeline,\n effectiveOnAddToFavorites,\n hasHook,\n } = options\n const flushPageSnapshotIfPossible = (target: InternalRuntimeState) => {\n ;(target as any).__wevu?.__wevu_flushSetupSnapshotSync?.()\n }\n\n const pageLifecycleHooks: Record<string, any> = {\n onLoad(this: InternalRuntimeState, ...args: any[]) {\n if ((this as any)[WEVU_ON_LOAD_CALLED_KEY]) {\n return\n }\n ;(this as any)[WEVU_ON_LOAD_CALLED_KEY] = true\n mountRuntimeInstance(this, runtimeApp, watch, setup)\n const pageOptions = args[0] && typeof args[0] === 'object'\n ? args[0]\n : resolvePageOptions(this)\n syncWevuPropsFromValues?.(this, pageOptions)\n flushPageSnapshotIfPossible(this)\n enableDeferredSetData(this)\n if (isPage) {\n ensurePageShareMenus({\n enableOnShareAppMessage,\n enableOnShareTimeline,\n })\n }\n callHookList(this, 'onLoad', args)\n if (typeof userOnLoad === 'function') {\n return userOnLoad.apply(this, args.length ? args : [pageOptions])\n }\n },\n onUnload(this: InternalRuntimeState, ...args: any[]) {\n if (isPage) {\n releaseCurrentPageInstance(this)\n }\n teardownRuntimeInstance(this)\n if (typeof userOnUnload === 'function') {\n return userOnUnload.apply(this, args)\n }\n },\n onShow(this: InternalRuntimeState, ...args: any[]) {\n if (isPage) {\n ensureMiniProgramGlobalPatched()\n bindCurrentPageInstance(this)\n if (!(this as any)[WEVU_ON_LOAD_CALLED_KEY]) {\n pageLifecycleHooks.onLoad.call(this, resolvePageOptions(this))\n }\n syncWevuPropsFromValues?.(this, resolvePageOptions(this))\n flushPageSnapshotIfPossible(this)\n ensurePageShareMenus({\n enableOnShareAppMessage,\n enableOnShareTimeline,\n })\n ;(this as any)[WEVU_ROUTE_DONE_CALLED_KEY] = false\n }\n setRuntimeSetDataVisibility(this, true)\n if (isPage) {\n notifyRouteStateSync({\n page: this as MiniProgramPageLike,\n source: 'page',\n })\n }\n callHookList(this, 'onShow', args)\n if (typeof userOnShow === 'function') {\n return userOnShow.apply(this, args)\n }\n },\n onHide(this: InternalRuntimeState, ...args: any[]) {\n if (isPage) {\n releaseCurrentPageInstance(this)\n }\n setRuntimeSetDataVisibility(this, false)\n callHookList(this, 'onHide', args)\n if (typeof userOnHide === 'function') {\n return userOnHide.apply(this, args)\n }\n },\n onReady(this: InternalRuntimeState, ...args: any[]) {\n if (isPage) {\n if (!(this as any)[WEVU_ON_LOAD_CALLED_KEY]) {\n pageLifecycleHooks.onLoad.call(this, resolvePageOptions(this))\n }\n syncWevuPropsFromValues?.(this, resolvePageOptions(this))\n flushPageSnapshotIfPossible(this)\n ensurePageShareMenus({\n enableOnShareAppMessage,\n enableOnShareTimeline,\n })\n }\n // 兼容:部分平台/模式可能触发 Page.onReady,而非 Component lifetimes.ready\n if (!(this as any)[WEVU_READY_CALLED_KEY]) {\n ;(this as any)[WEVU_READY_CALLED_KEY] = true\n // 部分 IDE/基础库在首屏场景可能不派发 routeDone,这里做一次延迟兜底。\n // 若平台随后派发了真实 routeDone,会因为 __wevuRouteDoneCalled 判定而跳过补发。\n if (isPage && enableOnRouteDone && enableOnRouteDoneFallback) {\n // eslint-disable-next-line ts/no-this-alias\n const current = this\n setTimeout(() => {\n if (!(current as any)[WEVU_ROUTE_DONE_CALLED_KEY]) {\n pageLifecycleHooks.onRouteDone?.call(current)\n }\n }, 0)\n }\n scheduleTemplateRefUpdate(this, () => {\n callHookList(this, 'onReady', args)\n if (typeof userOnReady === 'function') {\n userOnReady.apply(this, args)\n }\n })\n return\n }\n if (typeof userOnReady === 'function') {\n return userOnReady.apply(this, args)\n }\n },\n }\n\n attachOptionalPageLifecycleHooks(pageLifecycleHooks, {\n enableOnSaveExitState,\n enableOnPullDownRefresh,\n enableOnReachBottom,\n enableOnPageScroll,\n enableOnRouteDone,\n enableOnTabItemTap,\n enableOnResize,\n enableOnShareAppMessage,\n enableOnShareTimeline,\n enableOnAddToFavorites,\n effectiveOnSaveExitState,\n effectiveOnPullDownRefresh,\n effectiveOnReachBottom,\n effectiveOnPageScroll,\n effectiveOnRouteDone,\n effectiveOnTabItemTap,\n effectiveOnResize,\n effectiveOnShareAppMessage,\n effectiveOnShareTimeline,\n effectiveOnAddToFavorites,\n hasHook,\n })\n\n return pageLifecycleHooks\n}\n"],"mappings":";;;;;;;;;AAeA,SAAgB,yBAAuG,SAiCpH;CACD,MAAM,EACJ,YACA,OACA,OACA,YACA,cACA,YACA,YACA,aACA,QACA,uBACA,yBACA,qBACA,oBACA,mBACA,2BACA,oBACA,gBACA,yBACA,uBACA,wBACA,yBACA,0BACA,4BACA,wBACA,uBACA,sBACA,uBACA,mBACA,4BACA,0BACA,2BACA,YACE;CACJ,MAAM,+BAA+B,WAAiC;;EACnE,SAAC,OAAe,uEAAQ,+GAAgC;CAC3D;CAEA,MAAM,qBAA0C;EAC9C,OAAmC,GAAG,MAAa;GACjD,IAAK,KAAa,0BAChB;GAED,AAAC,KAAa,2BAA2B;GAC1C,qBAAqB,MAAM,YAAY,OAAO,KAAK;GACnD,MAAM,cAAc,KAAK,MAAM,OAAO,KAAK,OAAO,WAC9C,KAAK,KACL,mBAAmB,IAAI;GAC3B,kGAA0B,MAAM,WAAW;GAC3C,4BAA4B,IAAI;GAChC,sBAAsB,IAAI;GAC1B,IAAI,QACF,qBAAqB;IACnB;IACA;GACF,CAAC;GAEH,aAAa,MAAM,UAAU,IAAI;GACjC,IAAI,OAAO,eAAe,YACxB,OAAO,WAAW,MAAM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6B;;OACjD,4CAAmB,mFAAa,KAAK,OAAO;MAC9C;KACF,GAAG,CAAC;IACN;IACA,0BAA0B,YAAY;KACpC,aAAa,MAAM,WAAW,IAAI;KAClC,IAAI,OAAO,gBAAgB,YACzB,YAAY,MAAM,MAAM,IAAI;IAEhC,CAAC;IACD;GACF;GACA,IAAI,OAAO,gBAAgB,YACzB,OAAO,YAAY,MAAM,MAAM,IAAI;EAEvC;CACF;CAEA,iCAAiC,oBAAoB;EACnD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"lifecycle.mjs","names":[],"sources":["../../../../../src/runtime/register/component/lifecycle.ts"],"sourcesContent":["import type { MiniProgramPageLike } from '../../../routerInternal/shared'\nimport type { ComponentPropsOptions, ComputedDefinitions, DefineComponentOptions, InternalRuntimeState, MethodDefinitions, RuntimeApp } from '../../types'\nimport type { WatchMap } from '../watch'\nimport {\n WEVU_ON_LOAD_CALLED_KEY,\n WEVU_READY_CALLED_KEY,\n WEVU_ROUTE_DONE_CALLED_KEY,\n} from '@weapp-core/constants'\nimport {\n cancelInitialNavigation,\n ensureInitialNavigation,\n} from '../../../router/initialNavigation'\nimport { notifyRouteStateSync } from '../../../router/routeSync'\nimport { callHookList } from '../../hooks'\nimport { scheduleTemplateRefUpdate } from '../../templateRefs'\nimport { enableDeferredSetData, mountRuntimeInstance, setRuntimeSetDataVisibility, teardownRuntimeInstance } from '../runtimeInstance'\nimport { attachOptionalPageLifecycleHooks } from './lifecycle/optionalHooks'\nimport { bindCurrentPageInstance, ensureMiniProgramGlobalPatched, ensurePageShareMenus, releaseCurrentPageInstance, resolvePageOptions } from './lifecycle/platform'\n\nexport function createPageLifecycleHooks<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(options: {\n runtimeApp: RuntimeApp<D, C, M>\n watch: WatchMap | undefined\n setup: DefineComponentOptions<ComponentPropsOptions, D, C, M>['setup']\n userOnLoad?: any\n userOnUnload?: any\n userOnShow?: any\n userOnHide?: any\n userOnReady?: any\n isPage: boolean\n enableOnSaveExitState: boolean\n enableOnPullDownRefresh: boolean\n enableOnReachBottom: boolean\n enableOnPageScroll: boolean\n enableOnRouteDone: boolean\n enableOnRouteDoneFallback: boolean\n enableOnTabItemTap: boolean\n enableOnResize: boolean\n enableOnShareAppMessage: boolean\n enableOnShareTimeline: boolean\n enableOnAddToFavorites: boolean\n syncWevuPropsFromValues?: (instance: InternalRuntimeState, values: Record<string, unknown> | undefined) => void\n effectiveOnSaveExitState: (...args: any[]) => any\n effectiveOnPullDownRefresh: (...args: any[]) => any\n effectiveOnReachBottom: (...args: any[]) => any\n effectiveOnPageScroll: (...args: any[]) => any\n effectiveOnRouteDone: (...args: any[]) => any\n effectiveOnTabItemTap: (...args: any[]) => any\n effectiveOnResize: (...args: any[]) => any\n effectiveOnShareAppMessage: (...args: any[]) => any\n effectiveOnShareTimeline: (...args: any[]) => any\n effectiveOnAddToFavorites: (...args: any[]) => any\n hasHook: (target: InternalRuntimeState, name: string) => boolean\n}) {\n const {\n runtimeApp,\n watch,\n setup,\n userOnLoad,\n userOnUnload,\n userOnShow,\n userOnHide,\n userOnReady,\n isPage,\n enableOnSaveExitState,\n enableOnPullDownRefresh,\n enableOnReachBottom,\n enableOnPageScroll,\n enableOnRouteDone,\n enableOnRouteDoneFallback,\n enableOnTabItemTap,\n enableOnResize,\n enableOnShareAppMessage,\n enableOnShareTimeline,\n enableOnAddToFavorites,\n syncWevuPropsFromValues,\n effectiveOnSaveExitState,\n effectiveOnPullDownRefresh,\n effectiveOnReachBottom,\n effectiveOnPageScroll,\n effectiveOnRouteDone,\n effectiveOnTabItemTap,\n effectiveOnResize,\n effectiveOnShareAppMessage,\n effectiveOnShareTimeline,\n effectiveOnAddToFavorites,\n hasHook,\n } = options\n const flushPageSnapshotIfPossible = (target: InternalRuntimeState) => {\n ;(target as any).__wevu?.__wevu_flushSetupSnapshotSync?.()\n }\n\n const pageLifecycleHooks: Record<string, any> = {\n onLoad(this: InternalRuntimeState, ...args: any[]) {\n if ((this as any)[WEVU_ON_LOAD_CALLED_KEY]) {\n return\n }\n ;(this as any)[WEVU_ON_LOAD_CALLED_KEY] = true\n const mountPage = () => {\n mountRuntimeInstance(this, runtimeApp, watch, setup)\n const pageOptions = args[0] && typeof args[0] === 'object'\n ? args[0]\n : resolvePageOptions(this)\n syncWevuPropsFromValues?.(this, pageOptions)\n flushPageSnapshotIfPossible(this)\n enableDeferredSetData(this)\n if (isPage) {\n ensurePageShareMenus({\n enableOnShareAppMessage,\n enableOnShareTimeline,\n })\n }\n callHookList(this, 'onLoad', args)\n if (typeof userOnLoad === 'function') {\n return userOnLoad.apply(this, args.length ? args : [pageOptions])\n }\n }\n\n const initialNavigationPromise = isPage\n ? ensureInitialNavigation(this as MiniProgramPageLike, args[0], {\n onComplete: (shouldMount) => {\n if (shouldMount) {\n mountPage()\n }\n },\n })\n : undefined\n if (initialNavigationPromise) {\n return initialNavigationPromise\n }\n return mountPage()\n },\n onUnload(this: InternalRuntimeState, ...args: any[]) {\n cancelInitialNavigation(this as MiniProgramPageLike)\n if (isPage) {\n releaseCurrentPageInstance(this)\n }\n teardownRuntimeInstance(this)\n if (typeof userOnUnload === 'function') {\n return userOnUnload.apply(this, args)\n }\n },\n onShow(this: InternalRuntimeState, ...args: any[]) {\n if (isPage) {\n ensureMiniProgramGlobalPatched()\n bindCurrentPageInstance(this)\n if (!(this as any)[WEVU_ON_LOAD_CALLED_KEY]) {\n pageLifecycleHooks.onLoad.call(this, resolvePageOptions(this))\n }\n syncWevuPropsFromValues?.(this, resolvePageOptions(this))\n flushPageSnapshotIfPossible(this)\n ensurePageShareMenus({\n enableOnShareAppMessage,\n enableOnShareTimeline,\n })\n ;(this as any)[WEVU_ROUTE_DONE_CALLED_KEY] = false\n }\n setRuntimeSetDataVisibility(this, true)\n if (isPage) {\n notifyRouteStateSync({\n page: this as MiniProgramPageLike,\n source: 'page',\n })\n }\n callHookList(this, 'onShow', args)\n if (typeof userOnShow === 'function') {\n return userOnShow.apply(this, args)\n }\n },\n onHide(this: InternalRuntimeState, ...args: any[]) {\n if (isPage) {\n releaseCurrentPageInstance(this)\n }\n setRuntimeSetDataVisibility(this, false)\n callHookList(this, 'onHide', args)\n if (typeof userOnHide === 'function') {\n return userOnHide.apply(this, args)\n }\n },\n onReady(this: InternalRuntimeState, ...args: any[]) {\n if (isPage) {\n if (!(this as any)[WEVU_ON_LOAD_CALLED_KEY]) {\n pageLifecycleHooks.onLoad.call(this, resolvePageOptions(this))\n }\n syncWevuPropsFromValues?.(this, resolvePageOptions(this))\n flushPageSnapshotIfPossible(this)\n ensurePageShareMenus({\n enableOnShareAppMessage,\n enableOnShareTimeline,\n })\n }\n // 兼容:部分平台/模式可能触发 Page.onReady,而非 Component lifetimes.ready\n if (!(this as any)[WEVU_READY_CALLED_KEY]) {\n ;(this as any)[WEVU_READY_CALLED_KEY] = true\n // 部分 IDE/基础库在首屏场景可能不派发 routeDone,这里做一次延迟兜底。\n // 若平台随后派发了真实 routeDone,会因为 __wevuRouteDoneCalled 判定而跳过补发。\n if (isPage && enableOnRouteDone && enableOnRouteDoneFallback) {\n // eslint-disable-next-line ts/no-this-alias\n const current = this\n setTimeout(() => {\n if (!(current as any)[WEVU_ROUTE_DONE_CALLED_KEY]) {\n pageLifecycleHooks.onRouteDone?.call(current)\n }\n }, 0)\n }\n const callReadyHooks = () => {\n callHookList(this, 'onReady', args)\n if (typeof userOnReady === 'function') {\n userOnReady.apply(this, args)\n }\n }\n const scheduleReadyHooks = () => scheduleTemplateRefUpdate(this, callReadyHooks)\n const initialNavigationPromise = isPage\n ? ensureInitialNavigation(this as MiniProgramPageLike, undefined, {\n start: false,\n onComplete: (shouldMount) => {\n if (shouldMount) {\n scheduleReadyHooks()\n }\n },\n })\n : undefined\n if (!initialNavigationPromise) {\n scheduleReadyHooks()\n }\n return\n }\n if (typeof userOnReady === 'function') {\n return userOnReady.apply(this, args)\n }\n },\n }\n\n attachOptionalPageLifecycleHooks(pageLifecycleHooks, {\n enableOnSaveExitState,\n enableOnPullDownRefresh,\n enableOnReachBottom,\n enableOnPageScroll,\n enableOnRouteDone,\n enableOnTabItemTap,\n enableOnResize,\n enableOnShareAppMessage,\n enableOnShareTimeline,\n enableOnAddToFavorites,\n effectiveOnSaveExitState,\n effectiveOnPullDownRefresh,\n effectiveOnReachBottom,\n effectiveOnPageScroll,\n effectiveOnRouteDone,\n effectiveOnTabItemTap,\n effectiveOnResize,\n effectiveOnShareAppMessage,\n effectiveOnShareTimeline,\n effectiveOnAddToFavorites,\n hasHook,\n })\n\n return pageLifecycleHooks\n}\n"],"mappings":";;;;;;;;;;AAmBA,SAAgB,yBAAuG,SAiCpH;CACD,MAAM,EACJ,YACA,OACA,OACA,YACA,cACA,YACA,YACA,aACA,QACA,uBACA,yBACA,qBACA,oBACA,mBACA,2BACA,oBACA,gBACA,yBACA,uBACA,wBACA,yBACA,0BACA,4BACA,wBACA,uBACA,sBACA,uBACA,mBACA,4BACA,0BACA,2BACA,YACE;CACJ,MAAM,+BAA+B,WAAiC;;EACnE,SAAC,OAAe,uEAAQ,+GAAgC;CAC3D;CAEA,MAAM,qBAA0C;EAC9C,OAAmC,GAAG,MAAa;GACjD,IAAK,KAAa,0BAChB;GAED,AAAC,KAAa,2BAA2B;GAC1C,MAAM,kBAAkB;IACtB,qBAAqB,MAAM,YAAY,OAAO,KAAK;IACnD,MAAM,cAAc,KAAK,MAAM,OAAO,KAAK,OAAO,WAC9C,KAAK,KACL,mBAAmB,IAAI;IAC3B,kGAA0B,MAAM,WAAW;IAC3C,4BAA4B,IAAI;IAChC,sBAAsB,IAAI;IAC1B,IAAI,QACF,qBAAqB;KACnB;KACA;IACF,CAAC;IAEH,aAAa,MAAM,UAAU,IAAI;IACjC,IAAI,OAAO,eAAe,YACxB,OAAO,WAAW,MAAM,MAAM,KAAK,SAAS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IACF,CAAC;GACH;GAEA,IAAI,CAAE,KAAa,wBAAwB;IACxC,AAAC,KAAa,yBAAyB;IAGxC,IAAI,UAAU,qBAAqB,2BAA2B;KAE5D,MAAM,UAAU;KAChB,iBAAiB;MACf,IAAI,CAAE,QAAgB,6BAA6B;;OACjD,4CAAmB,mFAAa,KAAK,OAAO;MAC9C;KACF,GAAG,CAAC;IACN;IACA,MAAM,uBAAuB;KAC3B,aAAa,MAAM,WAAW,IAAI;KAClC,IAAI,OAAO,gBAAgB,YACzB,YAAY,MAAM,MAAM,IAAI;IAEhC;IACA,MAAM,2BAA2B,0BAA0B,MAAM,cAAc;IAW/E,IAAI,EAV6B,SAC7B,wBAAwB,MAA6B,QAAW;KAC9D,OAAO;KACP,aAAa,gBAAgB;MAC3B,IAAI,aACF,mBAAmB;KAEvB;IACF,CAAC,IACD,SAEF,mBAAmB;IAErB;GACF;GACA,IAAI,OAAO,gBAAgB,YACzB,OAAO,YAAY,MAAM,MAAM,IAAI;EAEvC;CACF;CAEA,iCAAiC,oBAAoB;EACnD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,OAAO;AACT"}
|
|
@@ -4,6 +4,7 @@ import { resolveRuntimePageLayoutName, syncRuntimePageLayoutState } from "../../
|
|
|
4
4
|
import { getOwnerProxy } from "../../scopedSlots.mjs";
|
|
5
5
|
import { clearTemplateRefs, scheduleTemplateRefUpdate } from "../../templateRefs.mjs";
|
|
6
6
|
import { enableDeferredSetData, mountRuntimeInstance, refreshRuntimeInstance, setRuntimeSetDataVisibility, teardownRuntimeInstance } from "../runtimeInstance.mjs";
|
|
7
|
+
import { ensureInitialNavigation } from "../../../router/initialNavigation.mjs";
|
|
7
8
|
import { registerRuntimeLayoutHosts, unregisterRuntimeLayoutHosts } from "../../layoutBridge.mjs";
|
|
8
9
|
import { registerNativeComponentDefinition } from "./registerNativeDefinition.mjs";
|
|
9
10
|
import { WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY, WEVU_LAYOUT_HOST_BRIDGE_KEY, WEVU_PAGE_LAYOUT_NAME_KEY, WEVU_PAGE_LAYOUT_PROPS_KEY, WEVU_PAGE_LAYOUT_SETTER_KEY, WEVU_PUBLIC_RUNTIME_KEY, WEVU_READY_CALLED_KEY, WEVU_RESOLVE_PUBLIC_INSTANCE_METHOD, WEVU_RUNTIME_KEY, WEVU_RUNTIME_OWNER_ID_KEY, WEVU_SLOT_OWNER_ID_KEY, WEVU_TEMPLATE_REFS_KEY } from "@weapp-core/constants";
|
|
@@ -65,6 +66,18 @@ function registerComponentDefinition(options) {
|
|
|
65
66
|
const hook = vueLifecycles[name];
|
|
66
67
|
if (typeof hook === "function") return hook.apply(resolveLifecycleContext(instance), args);
|
|
67
68
|
};
|
|
69
|
+
const deferPageUntilNavigation = (instance, task) => {
|
|
70
|
+
if (!isPage) {
|
|
71
|
+
task();
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (!ensureInitialNavigation(instance, void 0, {
|
|
75
|
+
start: false,
|
|
76
|
+
onComplete: (shouldMount) => {
|
|
77
|
+
if (shouldMount) task();
|
|
78
|
+
}
|
|
79
|
+
})) task();
|
|
80
|
+
};
|
|
68
81
|
const ensureReadyRuntime = (instance) => {
|
|
69
82
|
if (resolveRuntime(instance) || typeof vueLifecycles.mounted !== "function") return;
|
|
70
83
|
if (mountMissingRuntime(instance).mounted) {
|
|
@@ -112,7 +125,6 @@ function registerComponentDefinition(options) {
|
|
|
112
125
|
lifetimes: {
|
|
113
126
|
...userLifetimes,
|
|
114
127
|
created: function created(...args) {
|
|
115
|
-
callVueLifecycle(this, "beforeCreate", args);
|
|
116
128
|
applyExtraInstanceFields(this);
|
|
117
129
|
if (Array.isArray(templateRefs) && templateRefs.length) Object.defineProperty(this, WEVU_TEMPLATE_REFS_KEY, {
|
|
118
130
|
value: templateRefs,
|
|
@@ -121,20 +133,24 @@ function registerComponentDefinition(options) {
|
|
|
121
133
|
writable: false
|
|
122
134
|
});
|
|
123
135
|
attachWevuPropKeys(this);
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
136
|
+
const runCreated = () => {
|
|
137
|
+
callVueLifecycle(this, "beforeCreate", args);
|
|
138
|
+
if (setupLifecycle === "created") {
|
|
139
|
+
try {
|
|
140
|
+
mountRuntimeInstance(this, runtimeApp, watch, setup, {
|
|
141
|
+
deferSetData: true,
|
|
142
|
+
snapshotOmitKeys: directPropsDerivedKeys
|
|
143
|
+
});
|
|
144
|
+
} catch (error) {
|
|
145
|
+
const label = getRuntimeOwnerLabel(this);
|
|
146
|
+
throw new Error(`[wevu] mount runtime failed in created (${label}): ${error instanceof Error ? error.message : String(error)}`);
|
|
147
|
+
}
|
|
148
|
+
syncWevuPropsFromInstance(this);
|
|
149
|
+
attachPageLayoutSetter(this);
|
|
133
150
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
if (typeof userLifetimes.created === "function") userLifetimes.created.apply(this, args);
|
|
151
|
+
if (typeof userLifetimes.created === "function") userLifetimes.created.apply(this, args);
|
|
152
|
+
};
|
|
153
|
+
deferPageUntilNavigation(this, runCreated);
|
|
138
154
|
},
|
|
139
155
|
moved: function moved(...args) {
|
|
140
156
|
callHookList(this, "onMoved", args);
|
|
@@ -149,30 +165,51 @@ function registerComponentDefinition(options) {
|
|
|
149
165
|
writable: false
|
|
150
166
|
});
|
|
151
167
|
attachWevuPropKeys(this);
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
168
|
+
deferPageUntilNavigation(this, () => {
|
|
169
|
+
if (setupLifecycle !== "created" || !this.__wevu) try {
|
|
170
|
+
mountRuntimeInstance(this, runtimeApp, watch, setup, {
|
|
171
|
+
deferSetData: true,
|
|
172
|
+
snapshotOmitKeys: directPropsDerivedKeys
|
|
173
|
+
});
|
|
174
|
+
} catch (error) {
|
|
175
|
+
const label = getRuntimeOwnerLabel(this);
|
|
176
|
+
throw new Error(`[wevu] mount runtime failed in attached (${label}): ${error instanceof Error ? error.message : String(error)}`);
|
|
177
|
+
}
|
|
178
|
+
syncWevuPropsFromInstance(this);
|
|
179
|
+
callVueLifecycle(this, "created", args);
|
|
180
|
+
callVueLifecycle(this, "beforeMount", args);
|
|
181
|
+
attachPageLayoutSetter(this);
|
|
182
|
+
attachRuntimeLayoutHosts(this);
|
|
183
|
+
enableDeferredSetData(this);
|
|
184
|
+
callHookList(this, "onAttached", args);
|
|
185
|
+
if (typeof userLifetimes.attached === "function") userLifetimes.attached.apply(this, args);
|
|
186
|
+
});
|
|
169
187
|
},
|
|
170
188
|
ready: function ready(...args) {
|
|
189
|
+
if (isPage && !this[WEVU_READY_CALLED_KEY]) {
|
|
190
|
+
if (ensureInitialNavigation(this, void 0, {
|
|
191
|
+
start: true,
|
|
192
|
+
onComplete: (shouldMount) => {
|
|
193
|
+
if (shouldMount && !this.__wevuInitialNavigationReady) {
|
|
194
|
+
this.__wevuInitialNavigationReady = true;
|
|
195
|
+
componentDefinition.lifetimes.ready.call(this, ...args);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}) && !this.__wevuInitialNavigationReady) return;
|
|
199
|
+
}
|
|
171
200
|
ensureReadyRuntime(this);
|
|
172
201
|
if (isPage && typeof pageLifecycleHooks.onReady === "function") {
|
|
173
202
|
const wasReadyCalled = Boolean(this[WEVU_READY_CALLED_KEY]);
|
|
174
203
|
pageLifecycleHooks.onReady.call(this, ...args);
|
|
175
|
-
if (!wasReadyCalled)
|
|
204
|
+
if (!wasReadyCalled) {
|
|
205
|
+
const callMounted = () => callVueLifecycle(this, "mounted", args);
|
|
206
|
+
if (!ensureInitialNavigation(this, void 0, {
|
|
207
|
+
start: false,
|
|
208
|
+
onComplete: (shouldMount) => {
|
|
209
|
+
if (shouldMount) callMounted();
|
|
210
|
+
}
|
|
211
|
+
})) callMounted();
|
|
212
|
+
}
|
|
176
213
|
if (typeof userLifetimes.ready === "function") userLifetimes.ready.apply(this, args);
|
|
177
214
|
return;
|
|
178
215
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerDefinition.mjs","names":[],"sources":["../../../../../src/runtime/register/component/registerDefinition.ts"],"sourcesContent":["import type { LayoutHostBinding } from '../../layoutBridge'\nimport type { TemplateRefBinding } from '../../templateRefs'\nimport type {\n ComponentPropsOptions,\n ComputedDefinitions,\n DefineComponentOptions,\n InternalRuntimeState,\n MethodDefinitions,\n RuntimeApp,\n} from '../../types'\nimport type { WatchMap } from '../watch'\nimport {\n WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY,\n WEVU_LAYOUT_HOST_BRIDGE_KEY,\n WEVU_PAGE_LAYOUT_NAME_KEY,\n WEVU_PAGE_LAYOUT_PROPS_KEY,\n WEVU_PAGE_LAYOUT_SETTER_KEY,\n WEVU_PUBLIC_RUNTIME_KEY,\n WEVU_READY_CALLED_KEY,\n WEVU_RESOLVE_PUBLIC_INSTANCE_METHOD,\n WEVU_RUNTIME_KEY,\n WEVU_RUNTIME_OWNER_ID_KEY,\n WEVU_SLOT_OWNER_ID_KEY,\n WEVU_TEMPLATE_REFS_KEY,\n} from '@weapp-core/constants'\nimport { callHookList } from '../../hooks'\nimport { registerRuntimeLayoutHosts, unregisterRuntimeLayoutHosts } from '../../layoutBridge'\nimport { resolveRuntimePageLayoutName, syncRuntimePageLayoutState } from '../../pageLayout'\nimport { getMiniProgramRuntimeGlobalObject } from '../../platform'\nimport { getOwnerProxy } from '../../scopedSlots'\nimport { clearTemplateRefs, scheduleTemplateRefUpdate } from '../../templateRefs'\nimport { enableDeferredSetData, mountRuntimeInstance, refreshRuntimeInstance, setRuntimeSetDataVisibility, teardownRuntimeInstance } from '../runtimeInstance'\nimport { registerNativeComponentDefinition } from './registerNativeDefinition'\n\nfunction scheduleOwnerTemplateRefUpdate(target: InternalRuntimeState) {\n const selectOwnerComponent = (target as any).selectOwnerComponent\n if (typeof selectOwnerComponent !== 'function') {\n return\n }\n try {\n const owner = selectOwnerComponent.call(target) as InternalRuntimeState | null | undefined\n if (owner && owner !== target) {\n scheduleTemplateRefUpdate(owner)\n }\n }\n catch {\n // 宿主不支持 owner 查询时保持当前组件生命周期正常执行。\n }\n}\n\nexport function registerComponentDefinition<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(options: {\n runtimeApp: RuntimeApp<D, C, M>\n watch: WatchMap | undefined\n setup: DefineComponentOptions<ComponentPropsOptions, D, C, M>['setup']\n restOptions: Record<string, any>\n pageLifecycleHooks: Record<string, any>\n finalObservers: Record<string, any>\n userLifetimes: Record<string, any>\n userPageLifetimes: Record<string, any>\n finalMethods: Record<string, (...args: any[]) => any>\n finalOptions: Record<string, any>\n applyExtraInstanceFields: (instance: InternalRuntimeState) => void\n templateRefs: TemplateRefBinding[] | undefined\n layoutHosts: LayoutHostBinding[] | undefined\n attachWevuPropKeys: (instance: InternalRuntimeState) => void\n setupLifecycle: 'created' | 'attached'\n syncWevuPropsFromInstance: (instance: InternalRuntimeState) => void\n syncWevuPropsFromValues: (instance: InternalRuntimeState, values: Record<string, unknown> | undefined) => void\n directPropsDerivedKeys: string[]\n isPage: boolean\n vueLifecycles: Record<string, unknown>\n getRuntimeOwnerLabel: (instance: InternalRuntimeState) => string\n registerNative?: boolean\n}) {\n const {\n runtimeApp,\n watch,\n setup,\n restOptions,\n pageLifecycleHooks,\n finalObservers,\n userLifetimes,\n userPageLifetimes,\n finalMethods,\n finalOptions,\n applyExtraInstanceFields,\n templateRefs,\n layoutHosts,\n attachWevuPropKeys,\n setupLifecycle,\n syncWevuPropsFromInstance,\n directPropsDerivedKeys,\n isPage,\n vueLifecycles,\n getRuntimeOwnerLabel,\n registerNative = true,\n } = options\n\n const resolveRuntime = (instance: InternalRuntimeState) => {\n const directRuntime = (instance as any).__wevu ?? (instance as any)[WEVU_PUBLIC_RUNTIME_KEY]\n if (directRuntime) {\n return directRuntime\n }\n const runtimeState = (instance as any).$state\n if (runtimeState && typeof runtimeState === 'object') {\n return (runtimeState as any)[WEVU_RUNTIME_KEY]\n }\n return undefined\n }\n\n const resolveLifecycleOwnerId = (instance: InternalRuntimeState) => (instance as any)[WEVU_RUNTIME_OWNER_ID_KEY]\n ?? (instance as any)[WEVU_SLOT_OWNER_ID_KEY]\n ?? (instance as any).data?.[WEVU_SLOT_OWNER_ID_KEY]\n ?? (instance as any).properties?.[WEVU_SLOT_OWNER_ID_KEY]\n\n const resolveLifecycleContext = (instance: InternalRuntimeState) => {\n const runtimeProxy = resolveRuntime(instance)?.proxy\n if (runtimeProxy) {\n return runtimeProxy\n }\n const ownerId = resolveLifecycleOwnerId(instance)\n if (typeof ownerId === 'string' && ownerId) {\n return getOwnerProxy(ownerId) ?? instance\n }\n return instance\n }\n\n const mountMissingRuntime = (instance: InternalRuntimeState) => {\n const existing = resolveRuntime(instance)\n if (existing) {\n return { runtime: existing, mounted: false }\n }\n applyExtraInstanceFields(instance)\n attachWevuPropKeys(instance)\n mountRuntimeInstance(instance, runtimeApp, watch, setup, {\n deferSetData: true,\n snapshotOmitKeys: directPropsDerivedKeys,\n })\n syncWevuPropsFromInstance(instance)\n enableDeferredSetData(instance)\n return { runtime: resolveRuntime(instance), mounted: true }\n }\n\n const callVueLifecycle = (instance: InternalRuntimeState, name: string, args: any[]) => {\n const hook = vueLifecycles[name]\n if (typeof hook === 'function') {\n return hook.apply(resolveLifecycleContext(instance), args)\n }\n return undefined\n }\n\n const ensureReadyRuntime = (instance: InternalRuntimeState) => {\n if (resolveRuntime(instance) || typeof vueLifecycles.mounted !== 'function') {\n return\n }\n const result = mountMissingRuntime(instance)\n if (result.mounted) {\n callVueLifecycle(instance, 'created', [])\n callVueLifecycle(instance, 'beforeMount', [])\n }\n }\n\n const pageMethodBridges: Record<string, (...args: any[]) => any> = {}\n const attachRuntimeLayoutHosts = (instance: InternalRuntimeState) => {\n if (!Array.isArray(layoutHosts) || !layoutHosts.length) {\n return\n }\n if ((instance as any)[WEVU_LAYOUT_HOST_BRIDGE_KEY]) {\n return\n }\n const bridge = registerRuntimeLayoutHosts(layoutHosts, instance)\n if (bridge) {\n instance[WEVU_LAYOUT_HOST_BRIDGE_KEY] = bridge\n }\n }\n const attachPageLayoutSetter = (instance: InternalRuntimeState) => {\n if (!isPage) {\n return\n }\n instance[WEVU_PAGE_LAYOUT_SETTER_KEY] = (layout: string | false, props?: Record<string, any>) => {\n const runtimeState = instance.__wevu?.state as Record<string, any> | undefined\n if (!runtimeState || typeof runtimeState !== 'object') {\n return\n }\n runtimeState[WEVU_PAGE_LAYOUT_NAME_KEY] = resolveRuntimePageLayoutName(layout)\n const nextProps = layout === false ? {} : (props ?? {})\n runtimeState[WEVU_PAGE_LAYOUT_PROPS_KEY] = nextProps\n syncRuntimePageLayoutState(instance as Record<string, any>, layout, nextProps)\n }\n }\n if (isPage) {\n const methodBridgeHookNames = ['onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onShareTimeline', 'onAddToFavorites']\n for (const hookName of methodBridgeHookNames) {\n const pageHook = (pageLifecycleHooks as any)[hookName]\n if (typeof pageHook !== 'function') {\n continue\n }\n if (typeof (finalMethods as any)[hookName] === 'function') {\n continue\n }\n pageMethodBridges[hookName] = function pageMethodBridge(this: InternalRuntimeState, ...args: any[]) {\n return pageHook.apply(this, args)\n }\n }\n }\n\n const componentDefinition = {\n ...restOptions,\n ...(isPage ? pageLifecycleHooks : {}),\n observers: finalObservers,\n lifetimes: {\n ...userLifetimes,\n created: function created(this: InternalRuntimeState, ...args: any[]) {\n callVueLifecycle(this, 'beforeCreate', args)\n applyExtraInstanceFields(this)\n if (Array.isArray(templateRefs) && templateRefs.length) {\n Object.defineProperty(this, WEVU_TEMPLATE_REFS_KEY, {\n value: templateRefs,\n configurable: true,\n enumerable: false,\n writable: false,\n })\n }\n attachWevuPropKeys(this)\n if (setupLifecycle === 'created') {\n try {\n mountRuntimeInstance(this, runtimeApp, watch, setup, {\n deferSetData: true,\n snapshotOmitKeys: directPropsDerivedKeys,\n })\n }\n catch (error) {\n const label = getRuntimeOwnerLabel(this)\n throw new Error(`[wevu] mount runtime failed in created (${label}): ${error instanceof Error ? error.message : String(error)}`)\n }\n syncWevuPropsFromInstance(this)\n attachPageLayoutSetter(this)\n }\n if (typeof (userLifetimes as any).created === 'function') {\n ;(userLifetimes as any).created.apply(this, args)\n }\n },\n moved: function moved(this: InternalRuntimeState, ...args: any[]) {\n callHookList(this, 'onMoved', args)\n if (typeof (userLifetimes as any).moved === 'function') {\n ;(userLifetimes as any).moved.apply(this, args)\n }\n },\n attached: function attached(this: InternalRuntimeState, ...args: any[]) {\n applyExtraInstanceFields(this)\n if (Array.isArray(templateRefs) && templateRefs.length && !(this as any)[WEVU_TEMPLATE_REFS_KEY]) {\n Object.defineProperty(this, WEVU_TEMPLATE_REFS_KEY, {\n value: templateRefs,\n configurable: true,\n enumerable: false,\n writable: false,\n })\n }\n attachWevuPropKeys(this)\n if (setupLifecycle !== 'created' || !(this as any).__wevu) {\n try {\n mountRuntimeInstance(this, runtimeApp, watch, setup, {\n deferSetData: true,\n snapshotOmitKeys: directPropsDerivedKeys,\n })\n }\n catch (error) {\n const label = getRuntimeOwnerLabel(this)\n throw new Error(`[wevu] mount runtime failed in attached (${label}): ${error instanceof Error ? error.message : String(error)}`)\n }\n }\n syncWevuPropsFromInstance(this)\n callVueLifecycle(this, 'created', args)\n callVueLifecycle(this, 'beforeMount', args)\n attachPageLayoutSetter(this)\n attachRuntimeLayoutHosts(this)\n enableDeferredSetData(this)\n callHookList(this, 'onAttached', args)\n if (typeof (userLifetimes as any).attached === 'function') {\n ;(userLifetimes as any).attached.apply(this, args)\n }\n },\n ready: function ready(this: InternalRuntimeState, ...args: any[]) {\n ensureReadyRuntime(this)\n if (isPage && typeof (pageLifecycleHooks as any).onReady === 'function') {\n const wasReadyCalled = Boolean((this as any)[WEVU_READY_CALLED_KEY])\n ;(pageLifecycleHooks as any).onReady.call(this, ...args)\n if (!wasReadyCalled) {\n callVueLifecycle(this, 'mounted', args)\n }\n if (typeof (userLifetimes as any).ready === 'function') {\n ;(userLifetimes as any).ready.apply(this, args)\n }\n return\n }\n if (!(this as any)[WEVU_READY_CALLED_KEY]) {\n ;(this as any)[WEVU_READY_CALLED_KEY] = true\n syncWevuPropsFromInstance(this)\n scheduleOwnerTemplateRefUpdate(this)\n scheduleTemplateRefUpdate(this, () => {\n callHookList(this, 'onReady', args)\n callVueLifecycle(this, 'mounted', args)\n if (typeof (userLifetimes as any).ready === 'function') {\n ;(userLifetimes as any).ready.apply(this, args)\n }\n })\n return\n }\n if (typeof (userLifetimes as any).ready === 'function') {\n ;(userLifetimes as any).ready.apply(this, args)\n }\n },\n detached: function detached(this: InternalRuntimeState, ...args: any[]) {\n callVueLifecycle(this, 'beforeUnmount', args)\n callVueLifecycle(this, 'beforeDestroy', args)\n scheduleOwnerTemplateRefUpdate(this)\n callHookList(this, 'onDetached', args)\n if (isPage && typeof (pageLifecycleHooks as any).onUnload === 'function') {\n ;(pageLifecycleHooks as any).onUnload.call(this, ...args)\n if (typeof (userLifetimes as any).detached === 'function') {\n ;(userLifetimes as any).detached.apply(this, args)\n }\n callVueLifecycle(this, 'unmounted', args)\n callVueLifecycle(this, 'destroyed', args)\n return\n }\n clearTemplateRefs(this)\n if (Array.isArray(layoutHosts) && layoutHosts.length && (this as any)[WEVU_LAYOUT_HOST_BRIDGE_KEY]) {\n unregisterRuntimeLayoutHosts(layoutHosts, (this as any)[WEVU_LAYOUT_HOST_BRIDGE_KEY])\n delete (this as any)[WEVU_LAYOUT_HOST_BRIDGE_KEY]\n }\n teardownRuntimeInstance(this)\n callVueLifecycle(this, 'unmounted', args)\n callVueLifecycle(this, 'destroyed', args)\n if (typeof (userLifetimes as any).detached === 'function') {\n ;(userLifetimes as any).detached.apply(this, args)\n }\n },\n error: function error(this: InternalRuntimeState, ...args: any[]) {\n callHookList(this, 'onError', args)\n if (typeof (userLifetimes as any).error === 'function') {\n ;(userLifetimes as any).error.apply(this, args)\n }\n },\n },\n pageLifetimes: {\n ...userPageLifetimes,\n show: function show(this: InternalRuntimeState, ...args: any[]) {\n if (isPage && typeof (pageLifecycleHooks as any).onShow === 'function') {\n ;(pageLifecycleHooks as any).onShow.call(this, ...args)\n if (typeof (userPageLifetimes as any).show === 'function') {\n ;(userPageLifetimes as any).show.apply(this, args)\n }\n return\n }\n setRuntimeSetDataVisibility(this, true)\n callHookList(this, 'onShow', args)\n if (typeof (userPageLifetimes as any).show === 'function') {\n ;(userPageLifetimes as any).show.apply(this, args)\n }\n },\n hide: function hide(this: InternalRuntimeState, ...args: any[]) {\n if (isPage && typeof (pageLifecycleHooks as any).onHide === 'function') {\n ;(pageLifecycleHooks as any).onHide.call(this, ...args)\n if (typeof (userPageLifetimes as any).hide === 'function') {\n ;(userPageLifetimes as any).hide.apply(this, args)\n }\n return\n }\n setRuntimeSetDataVisibility(this, false)\n callHookList(this, 'onHide', args)\n if (typeof (userPageLifetimes as any).hide === 'function') {\n ;(userPageLifetimes as any).hide.apply(this, args)\n }\n },\n resize: function resize(this: InternalRuntimeState, ...args: any[]) {\n if (isPage && typeof (pageLifecycleHooks as any).onResize === 'function') {\n ;(pageLifecycleHooks as any).onResize.call(this, ...args)\n if (typeof (userPageLifetimes as any).resize === 'function') {\n ;(userPageLifetimes as any).resize.apply(this, args)\n }\n return\n }\n callHookList(this, 'onResize', args)\n if (typeof (userPageLifetimes as any).resize === 'function') {\n ;(userPageLifetimes as any).resize.apply(this, args)\n }\n },\n routeDone: function routeDone(this: InternalRuntimeState, ...args: any[]) {\n if (isPage && typeof (pageLifecycleHooks as any).onRouteDone === 'function') {\n ;(pageLifecycleHooks as any).onRouteDone.call(this, ...args)\n if (typeof (userPageLifetimes as any).routeDone === 'function') {\n ;(userPageLifetimes as any).routeDone.apply(this, args)\n }\n return\n }\n callHookList(this, 'onRouteDone', args)\n if (typeof (userPageLifetimes as any).routeDone === 'function') {\n ;(userPageLifetimes as any).routeDone.apply(this, args)\n }\n },\n },\n methods: {\n ...pageMethodBridges,\n ...finalMethods,\n [WEVU_RESOLVE_PUBLIC_INSTANCE_METHOD]: function resolvePublicInstance(this: InternalRuntimeState) {\n const result = mountMissingRuntime(this)\n if (result.mounted) {\n callVueLifecycle(this, 'created', [])\n callVueLifecycle(this, 'beforeMount', [])\n }\n return result.runtime?.proxy\n },\n },\n options: finalOptions,\n }\n if (!registerNative) {\n return componentDefinition\n }\n\n const statefulHmrBridge = getMiniProgramRuntimeGlobalObject()?.[WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY]\n if (typeof statefulHmrBridge?.trackWevuComponent === 'function') {\n const definition = statefulHmrBridge.trackWevuComponent(componentDefinition, (\n instance: InternalRuntimeState,\n stateSnapshot?: Record<string, any>,\n ) => {\n refreshRuntimeInstance(instance, runtimeApp, watch, setup, {\n snapshotOmitKeys: directPropsDerivedKeys,\n stateSnapshot,\n })\n syncWevuPropsFromInstance(instance)\n attachPageLayoutSetter(instance)\n attachRuntimeLayoutHosts(instance)\n enableDeferredSetData(instance, { rehydrateSetupState: true })\n })\n if (!statefulHmrBridge.isApplying()) {\n registerNativeComponentDefinition(definition, isPage)\n }\n return definition\n }\n registerNativeComponentDefinition(componentDefinition, isPage)\n return componentDefinition\n}\n"],"mappings":";;;;;;;;;;;AAkCA,SAAS,+BAA+B,QAA8B;CACpE,MAAM,uBAAwB,OAAe;CAC7C,IAAI,OAAO,yBAAyB,YAClC;CAEF,IAAI;EACF,MAAM,QAAQ,qBAAqB,KAAK,MAAM;EAC9C,IAAI,SAAS,UAAU,QACrB,0BAA0B,KAAK;CAEnC,kBACM,CAEN;AACF;AAEA,SAA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AQ;GAC/B,yBAAyB,QAAQ;GACjC,sBAAsB,UAAU,EAAE,qBAAqB,KAAK,CAAC;EAC/D,CAAC;EACD,IAAI,CAAC,kBAAkB,WAAW,GAChC,kCAAkC,YAAY,MAAM;EAEtD,OAAO;CACT;CACA,kCAAkC,qBAAqB,MAAM;CAC7D,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"registerDefinition.mjs","names":[],"sources":["../../../../../src/runtime/register/component/registerDefinition.ts"],"sourcesContent":["import type { LayoutHostBinding } from '../../layoutBridge'\nimport type { TemplateRefBinding } from '../../templateRefs'\nimport type {\n ComponentPropsOptions,\n ComputedDefinitions,\n DefineComponentOptions,\n InternalRuntimeState,\n MethodDefinitions,\n RuntimeApp,\n} from '../../types'\nimport type { WatchMap } from '../watch'\nimport {\n WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY,\n WEVU_LAYOUT_HOST_BRIDGE_KEY,\n WEVU_PAGE_LAYOUT_NAME_KEY,\n WEVU_PAGE_LAYOUT_PROPS_KEY,\n WEVU_PAGE_LAYOUT_SETTER_KEY,\n WEVU_PUBLIC_RUNTIME_KEY,\n WEVU_READY_CALLED_KEY,\n WEVU_RESOLVE_PUBLIC_INSTANCE_METHOD,\n WEVU_RUNTIME_KEY,\n WEVU_RUNTIME_OWNER_ID_KEY,\n WEVU_SLOT_OWNER_ID_KEY,\n WEVU_TEMPLATE_REFS_KEY,\n} from '@weapp-core/constants'\nimport {\n ensureInitialNavigation,\n} from '../../../router/initialNavigation'\nimport { callHookList } from '../../hooks'\nimport { registerRuntimeLayoutHosts, unregisterRuntimeLayoutHosts } from '../../layoutBridge'\nimport { resolveRuntimePageLayoutName, syncRuntimePageLayoutState } from '../../pageLayout'\nimport { getMiniProgramRuntimeGlobalObject } from '../../platform'\nimport { getOwnerProxy } from '../../scopedSlots'\nimport { clearTemplateRefs, scheduleTemplateRefUpdate } from '../../templateRefs'\nimport { enableDeferredSetData, mountRuntimeInstance, refreshRuntimeInstance, setRuntimeSetDataVisibility, teardownRuntimeInstance } from '../runtimeInstance'\nimport { registerNativeComponentDefinition } from './registerNativeDefinition'\n\nfunction scheduleOwnerTemplateRefUpdate(target: InternalRuntimeState) {\n const selectOwnerComponent = (target as any).selectOwnerComponent\n if (typeof selectOwnerComponent !== 'function') {\n return\n }\n try {\n const owner = selectOwnerComponent.call(target) as InternalRuntimeState | null | undefined\n if (owner && owner !== target) {\n scheduleTemplateRefUpdate(owner)\n }\n }\n catch {\n // 宿主不支持 owner 查询时保持当前组件生命周期正常执行。\n }\n}\n\nexport function registerComponentDefinition<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(options: {\n runtimeApp: RuntimeApp<D, C, M>\n watch: WatchMap | undefined\n setup: DefineComponentOptions<ComponentPropsOptions, D, C, M>['setup']\n restOptions: Record<string, any>\n pageLifecycleHooks: Record<string, any>\n finalObservers: Record<string, any>\n userLifetimes: Record<string, any>\n userPageLifetimes: Record<string, any>\n finalMethods: Record<string, (...args: any[]) => any>\n finalOptions: Record<string, any>\n applyExtraInstanceFields: (instance: InternalRuntimeState) => void\n templateRefs: TemplateRefBinding[] | undefined\n layoutHosts: LayoutHostBinding[] | undefined\n attachWevuPropKeys: (instance: InternalRuntimeState) => void\n setupLifecycle: 'created' | 'attached'\n syncWevuPropsFromInstance: (instance: InternalRuntimeState) => void\n syncWevuPropsFromValues: (instance: InternalRuntimeState, values: Record<string, unknown> | undefined) => void\n directPropsDerivedKeys: string[]\n isPage: boolean\n vueLifecycles: Record<string, unknown>\n getRuntimeOwnerLabel: (instance: InternalRuntimeState) => string\n registerNative?: boolean\n}) {\n const {\n runtimeApp,\n watch,\n setup,\n restOptions,\n pageLifecycleHooks,\n finalObservers,\n userLifetimes,\n userPageLifetimes,\n finalMethods,\n finalOptions,\n applyExtraInstanceFields,\n templateRefs,\n layoutHosts,\n attachWevuPropKeys,\n setupLifecycle,\n syncWevuPropsFromInstance,\n directPropsDerivedKeys,\n isPage,\n vueLifecycles,\n getRuntimeOwnerLabel,\n registerNative = true,\n } = options\n\n const resolveRuntime = (instance: InternalRuntimeState) => {\n const directRuntime = (instance as any).__wevu ?? (instance as any)[WEVU_PUBLIC_RUNTIME_KEY]\n if (directRuntime) {\n return directRuntime\n }\n const runtimeState = (instance as any).$state\n if (runtimeState && typeof runtimeState === 'object') {\n return (runtimeState as any)[WEVU_RUNTIME_KEY]\n }\n return undefined\n }\n\n const resolveLifecycleOwnerId = (instance: InternalRuntimeState) => (instance as any)[WEVU_RUNTIME_OWNER_ID_KEY]\n ?? (instance as any)[WEVU_SLOT_OWNER_ID_KEY]\n ?? (instance as any).data?.[WEVU_SLOT_OWNER_ID_KEY]\n ?? (instance as any).properties?.[WEVU_SLOT_OWNER_ID_KEY]\n\n const resolveLifecycleContext = (instance: InternalRuntimeState) => {\n const runtimeProxy = resolveRuntime(instance)?.proxy\n if (runtimeProxy) {\n return runtimeProxy\n }\n const ownerId = resolveLifecycleOwnerId(instance)\n if (typeof ownerId === 'string' && ownerId) {\n return getOwnerProxy(ownerId) ?? instance\n }\n return instance\n }\n\n const mountMissingRuntime = (instance: InternalRuntimeState) => {\n const existing = resolveRuntime(instance)\n if (existing) {\n return { runtime: existing, mounted: false }\n }\n applyExtraInstanceFields(instance)\n attachWevuPropKeys(instance)\n mountRuntimeInstance(instance, runtimeApp, watch, setup, {\n deferSetData: true,\n snapshotOmitKeys: directPropsDerivedKeys,\n })\n syncWevuPropsFromInstance(instance)\n enableDeferredSetData(instance)\n return { runtime: resolveRuntime(instance), mounted: true }\n }\n\n const callVueLifecycle = (instance: InternalRuntimeState, name: string, args: any[]) => {\n const hook = vueLifecycles[name]\n if (typeof hook === 'function') {\n return hook.apply(resolveLifecycleContext(instance), args)\n }\n return undefined\n }\n\n const deferPageUntilNavigation = (instance: InternalRuntimeState, task: () => void) => {\n if (!isPage) {\n task()\n return\n }\n const initialNavigationPromise = ensureInitialNavigation(instance as any, undefined, {\n start: false,\n onComplete: (shouldMount) => {\n if (shouldMount) {\n task()\n }\n },\n })\n if (!initialNavigationPromise) {\n task()\n }\n }\n\n const ensureReadyRuntime = (instance: InternalRuntimeState) => {\n if (resolveRuntime(instance) || typeof vueLifecycles.mounted !== 'function') {\n return\n }\n const result = mountMissingRuntime(instance)\n if (result.mounted) {\n callVueLifecycle(instance, 'created', [])\n callVueLifecycle(instance, 'beforeMount', [])\n }\n }\n\n const pageMethodBridges: Record<string, (...args: any[]) => any> = {}\n const attachRuntimeLayoutHosts = (instance: InternalRuntimeState) => {\n if (!Array.isArray(layoutHosts) || !layoutHosts.length) {\n return\n }\n if ((instance as any)[WEVU_LAYOUT_HOST_BRIDGE_KEY]) {\n return\n }\n const bridge = registerRuntimeLayoutHosts(layoutHosts, instance)\n if (bridge) {\n instance[WEVU_LAYOUT_HOST_BRIDGE_KEY] = bridge\n }\n }\n const attachPageLayoutSetter = (instance: InternalRuntimeState) => {\n if (!isPage) {\n return\n }\n instance[WEVU_PAGE_LAYOUT_SETTER_KEY] = (layout: string | false, props?: Record<string, any>) => {\n const runtimeState = instance.__wevu?.state as Record<string, any> | undefined\n if (!runtimeState || typeof runtimeState !== 'object') {\n return\n }\n runtimeState[WEVU_PAGE_LAYOUT_NAME_KEY] = resolveRuntimePageLayoutName(layout)\n const nextProps = layout === false ? {} : (props ?? {})\n runtimeState[WEVU_PAGE_LAYOUT_PROPS_KEY] = nextProps\n syncRuntimePageLayoutState(instance as Record<string, any>, layout, nextProps)\n }\n }\n if (isPage) {\n const methodBridgeHookNames = ['onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onShareTimeline', 'onAddToFavorites']\n for (const hookName of methodBridgeHookNames) {\n const pageHook = (pageLifecycleHooks as any)[hookName]\n if (typeof pageHook !== 'function') {\n continue\n }\n if (typeof (finalMethods as any)[hookName] === 'function') {\n continue\n }\n pageMethodBridges[hookName] = function pageMethodBridge(this: InternalRuntimeState, ...args: any[]) {\n return pageHook.apply(this, args)\n }\n }\n }\n\n const componentDefinition = {\n ...restOptions,\n ...(isPage ? pageLifecycleHooks : {}),\n observers: finalObservers,\n lifetimes: {\n ...userLifetimes,\n created: function created(this: InternalRuntimeState, ...args: any[]) {\n applyExtraInstanceFields(this)\n if (Array.isArray(templateRefs) && templateRefs.length) {\n Object.defineProperty(this, WEVU_TEMPLATE_REFS_KEY, {\n value: templateRefs,\n configurable: true,\n enumerable: false,\n writable: false,\n })\n }\n attachWevuPropKeys(this)\n const runCreated = () => {\n callVueLifecycle(this, 'beforeCreate', args)\n if (setupLifecycle === 'created') {\n try {\n mountRuntimeInstance(this, runtimeApp, watch, setup, {\n deferSetData: true,\n snapshotOmitKeys: directPropsDerivedKeys,\n })\n }\n catch (error) {\n const label = getRuntimeOwnerLabel(this)\n throw new Error(`[wevu] mount runtime failed in created (${label}): ${error instanceof Error ? error.message : String(error)}`)\n }\n syncWevuPropsFromInstance(this)\n attachPageLayoutSetter(this)\n }\n if (typeof (userLifetimes as any).created === 'function') {\n ;(userLifetimes as any).created.apply(this, args)\n }\n }\n deferPageUntilNavigation(this, runCreated)\n },\n moved: function moved(this: InternalRuntimeState, ...args: any[]) {\n callHookList(this, 'onMoved', args)\n if (typeof (userLifetimes as any).moved === 'function') {\n ;(userLifetimes as any).moved.apply(this, args)\n }\n },\n attached: function attached(this: InternalRuntimeState, ...args: any[]) {\n applyExtraInstanceFields(this)\n if (Array.isArray(templateRefs) && templateRefs.length && !(this as any)[WEVU_TEMPLATE_REFS_KEY]) {\n Object.defineProperty(this, WEVU_TEMPLATE_REFS_KEY, {\n value: templateRefs,\n configurable: true,\n enumerable: false,\n writable: false,\n })\n }\n attachWevuPropKeys(this)\n deferPageUntilNavigation(this, () => {\n if (setupLifecycle !== 'created' || !(this as any).__wevu) {\n try {\n mountRuntimeInstance(this, runtimeApp, watch, setup, {\n deferSetData: true,\n snapshotOmitKeys: directPropsDerivedKeys,\n })\n }\n catch (error) {\n const label = getRuntimeOwnerLabel(this)\n throw new Error(`[wevu] mount runtime failed in attached (${label}): ${error instanceof Error ? error.message : String(error)}`)\n }\n }\n syncWevuPropsFromInstance(this)\n callVueLifecycle(this, 'created', args)\n callVueLifecycle(this, 'beforeMount', args)\n attachPageLayoutSetter(this)\n attachRuntimeLayoutHosts(this)\n enableDeferredSetData(this)\n callHookList(this, 'onAttached', args)\n if (typeof (userLifetimes as any).attached === 'function') {\n ;(userLifetimes as any).attached.apply(this, args)\n }\n })\n },\n ready: function ready(this: InternalRuntimeState, ...args: any[]) {\n if (isPage && !(this as any)[WEVU_READY_CALLED_KEY]) {\n const initialNavigationPromise = ensureInitialNavigation(this as any, undefined, {\n start: true,\n onComplete: (shouldMount) => {\n if (shouldMount && !(this as any).__wevuInitialNavigationReady) {\n ;(this as any).__wevuInitialNavigationReady = true\n componentDefinition.lifetimes.ready.call(this, ...args)\n }\n },\n })\n if (initialNavigationPromise && !(this as any).__wevuInitialNavigationReady) {\n return\n }\n }\n ensureReadyRuntime(this)\n if (isPage && typeof (pageLifecycleHooks as any).onReady === 'function') {\n const wasReadyCalled = Boolean((this as any)[WEVU_READY_CALLED_KEY])\n ;(pageLifecycleHooks as any).onReady.call(this, ...args)\n if (!wasReadyCalled) {\n const callMounted = () => callVueLifecycle(this, 'mounted', args)\n const initialNavigationPromise = ensureInitialNavigation(this as any, undefined, {\n start: false,\n onComplete: (shouldMount) => {\n if (shouldMount) {\n callMounted()\n }\n },\n })\n if (!initialNavigationPromise) {\n callMounted()\n }\n }\n if (typeof (userLifetimes as any).ready === 'function') {\n ;(userLifetimes as any).ready.apply(this, args)\n }\n return\n }\n if (!(this as any)[WEVU_READY_CALLED_KEY]) {\n ;(this as any)[WEVU_READY_CALLED_KEY] = true\n syncWevuPropsFromInstance(this)\n scheduleOwnerTemplateRefUpdate(this)\n scheduleTemplateRefUpdate(this, () => {\n callHookList(this, 'onReady', args)\n callVueLifecycle(this, 'mounted', args)\n if (typeof (userLifetimes as any).ready === 'function') {\n ;(userLifetimes as any).ready.apply(this, args)\n }\n })\n return\n }\n if (typeof (userLifetimes as any).ready === 'function') {\n ;(userLifetimes as any).ready.apply(this, args)\n }\n },\n detached: function detached(this: InternalRuntimeState, ...args: any[]) {\n callVueLifecycle(this, 'beforeUnmount', args)\n callVueLifecycle(this, 'beforeDestroy', args)\n scheduleOwnerTemplateRefUpdate(this)\n callHookList(this, 'onDetached', args)\n if (isPage && typeof (pageLifecycleHooks as any).onUnload === 'function') {\n ;(pageLifecycleHooks as any).onUnload.call(this, ...args)\n if (typeof (userLifetimes as any).detached === 'function') {\n ;(userLifetimes as any).detached.apply(this, args)\n }\n callVueLifecycle(this, 'unmounted', args)\n callVueLifecycle(this, 'destroyed', args)\n return\n }\n clearTemplateRefs(this)\n if (Array.isArray(layoutHosts) && layoutHosts.length && (this as any)[WEVU_LAYOUT_HOST_BRIDGE_KEY]) {\n unregisterRuntimeLayoutHosts(layoutHosts, (this as any)[WEVU_LAYOUT_HOST_BRIDGE_KEY])\n delete (this as any)[WEVU_LAYOUT_HOST_BRIDGE_KEY]\n }\n teardownRuntimeInstance(this)\n callVueLifecycle(this, 'unmounted', args)\n callVueLifecycle(this, 'destroyed', args)\n if (typeof (userLifetimes as any).detached === 'function') {\n ;(userLifetimes as any).detached.apply(this, args)\n }\n },\n error: function error(this: InternalRuntimeState, ...args: any[]) {\n callHookList(this, 'onError', args)\n if (typeof (userLifetimes as any).error === 'function') {\n ;(userLifetimes as any).error.apply(this, args)\n }\n },\n },\n pageLifetimes: {\n ...userPageLifetimes,\n show: function show(this: InternalRuntimeState, ...args: any[]) {\n if (isPage && typeof (pageLifecycleHooks as any).onShow === 'function') {\n ;(pageLifecycleHooks as any).onShow.call(this, ...args)\n if (typeof (userPageLifetimes as any).show === 'function') {\n ;(userPageLifetimes as any).show.apply(this, args)\n }\n return\n }\n setRuntimeSetDataVisibility(this, true)\n callHookList(this, 'onShow', args)\n if (typeof (userPageLifetimes as any).show === 'function') {\n ;(userPageLifetimes as any).show.apply(this, args)\n }\n },\n hide: function hide(this: InternalRuntimeState, ...args: any[]) {\n if (isPage && typeof (pageLifecycleHooks as any).onHide === 'function') {\n ;(pageLifecycleHooks as any).onHide.call(this, ...args)\n if (typeof (userPageLifetimes as any).hide === 'function') {\n ;(userPageLifetimes as any).hide.apply(this, args)\n }\n return\n }\n setRuntimeSetDataVisibility(this, false)\n callHookList(this, 'onHide', args)\n if (typeof (userPageLifetimes as any).hide === 'function') {\n ;(userPageLifetimes as any).hide.apply(this, args)\n }\n },\n resize: function resize(this: InternalRuntimeState, ...args: any[]) {\n if (isPage && typeof (pageLifecycleHooks as any).onResize === 'function') {\n ;(pageLifecycleHooks as any).onResize.call(this, ...args)\n if (typeof (userPageLifetimes as any).resize === 'function') {\n ;(userPageLifetimes as any).resize.apply(this, args)\n }\n return\n }\n callHookList(this, 'onResize', args)\n if (typeof (userPageLifetimes as any).resize === 'function') {\n ;(userPageLifetimes as any).resize.apply(this, args)\n }\n },\n routeDone: function routeDone(this: InternalRuntimeState, ...args: any[]) {\n if (isPage && typeof (pageLifecycleHooks as any).onRouteDone === 'function') {\n ;(pageLifecycleHooks as any).onRouteDone.call(this, ...args)\n if (typeof (userPageLifetimes as any).routeDone === 'function') {\n ;(userPageLifetimes as any).routeDone.apply(this, args)\n }\n return\n }\n callHookList(this, 'onRouteDone', args)\n if (typeof (userPageLifetimes as any).routeDone === 'function') {\n ;(userPageLifetimes as any).routeDone.apply(this, args)\n }\n },\n },\n methods: {\n ...pageMethodBridges,\n ...finalMethods,\n [WEVU_RESOLVE_PUBLIC_INSTANCE_METHOD]: function resolvePublicInstance(this: InternalRuntimeState) {\n const result = mountMissingRuntime(this)\n if (result.mounted) {\n callVueLifecycle(this, 'created', [])\n callVueLifecycle(this, 'beforeMount', [])\n }\n return result.runtime?.proxy\n },\n },\n options: finalOptions,\n }\n if (!registerNative) {\n return componentDefinition\n }\n\n const statefulHmrBridge = getMiniProgramRuntimeGlobalObject()?.[WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY]\n if (typeof statefulHmrBridge?.trackWevuComponent === 'function') {\n const definition = statefulHmrBridge.trackWevuComponent(componentDefinition, (\n instance: InternalRuntimeState,\n stateSnapshot?: Record<string, any>,\n ) => {\n refreshRuntimeInstance(instance, runtimeApp, watch, setup, {\n snapshotOmitKeys: directPropsDerivedKeys,\n stateSnapshot,\n })\n syncWevuPropsFromInstance(instance)\n attachPageLayoutSetter(instance)\n attachRuntimeLayoutHosts(instance)\n enableDeferredSetData(instance, { rehydrateSetupState: true })\n })\n if (!statefulHmrBridge.isApplying()) {\n registerNativeComponentDefinition(definition, isPage)\n }\n return definition\n }\n registerNativeComponentDefinition(componentDefinition, isPage)\n return componentDefinition\n}\n"],"mappings":";;;;;;;;;;;;AAqCA,SAAS,+BAA+B,QAA8B;CACpE,MAAM,uBAAwB,OAAe;CAC7C,IAAI,OAAO,yBAAyB,YAClC;CAEF,IAAI;EACF,MAAM,QAAQ,qBAAqB,KAAK,MAAM;EAC9C,IAAI,SAAS,UAAU,QACrB,0BAA0B,KAAK;CAEnC,kBACM,CAEN;AACF;AAEA,SAAgB,4BAA0G,SAuBvH;;CACD,MAAM,EACJ,YACA,OACA,OACA,aACA,oBACA,gBACA,eACA,mBACA,cACA,cACA,0BACA,cACA,aACA,oBACA,gBACA,2BACA,wBACA,QACA,eACA,sBACA,iBAAiB,SACf;CAEJ,MAAM,kBAAkB,aAAmC;;EACzD,MAAM,yBAAiB,SAAiB,+CAAW,SAAiB;EACpE,IAAI,eACF,OAAO;EAET,MAAM,eAAgB,SAAiB;EACvC,IAAI,gBAAgB,OAAO,iBAAiB,UAC1C,OAAQ,aAAqB;CAGjC;CAEA,MAAM,2BAA2B,aAAmC;;mDAAC,SAAiB,mGAChF,SAAiB,yEACjB,SAAiB,oDAAO,6EACxB,SAAiB,sEAAa;CAAsB;CAE1D,MAAM,2BAA2B,aAAmC;;EAClE,MAAM,kCAAe,eAAe,QAAQ,qEAAG;EAC/C,IAAI,cACF,OAAO;EAET,MAAM,UAAU,wBAAwB,QAAQ;EAChD,IAAI,OAAO,YAAY,YAAY,SAAS;;G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;GACH,uBAAuB,UAAU,YAAY,OAAO,OAAO;IACzD,kBAAkB;IAClB;GACF,CAAC;GACD,0BAA0B,QAAQ;GAClC,uBAAuB,QAAQ;GAC/B,yBAAyB,QAAQ;GACjC,sBAAsB,UAAU,EAAE,qBAAqB,KAAK,CAAC;EAC/D,CAAC;EACD,IAAI,CAAC,kBAAkB,WAAW,GAChC,kCAAkC,YAAY,MAAM;EAEtD,OAAO;CACT;CACA,kCAAkC,qBAAqB,MAAM;CAC7D,OAAO;AACT"}
|
package/dist/dev/vue-demi.mjs
CHANGED
|
@@ -24,11 +24,11 @@ import { resolveRuntimePageLayoutName, setPageLayout, syncRuntimePageLayoutState
|
|
|
24
24
|
import { runSetupFunction } from "./runtime/register/setup.mjs";
|
|
25
25
|
import { mountRuntimeInstance, setRuntimeSetDataVisibility, teardownRuntimeInstance } from "./runtime/register/runtimeInstance.mjs";
|
|
26
26
|
import { registerApp } from "./runtime/register/app.mjs";
|
|
27
|
+
import { hasInjectionContext, inject, injectGlobal, provide, provideGlobal } from "./runtime/provide.mjs";
|
|
27
28
|
import { registerPageLayoutBridge, registerRuntimeLayoutHosts, resolveLayoutBridge, resolveLayoutHost, unregisterPageLayoutBridge, unregisterRuntimeLayoutHosts, useLayoutBridge, useLayoutHosts, waitForLayoutHost } from "./runtime/layoutBridge.mjs";
|
|
28
29
|
import { registerComponent } from "./runtime/register/component.mjs";
|
|
29
30
|
import { createApp } from "./runtime/app.mjs";
|
|
30
31
|
import { useCssModule } from "./runtime/css.mjs";
|
|
31
|
-
import { hasInjectionContext, inject, injectGlobal, provide, provideGlobal } from "./runtime/provide.mjs";
|
|
32
32
|
import { createWevuComponent, createWevuScopedSlotComponent, defineComponent } from "./runtime/define.mjs";
|
|
33
33
|
import { useDisposables } from "./runtime/disposables.mjs";
|
|
34
34
|
import { useElementIntersectionObserver } from "./runtime/elementIntersectionObserver.mjs";
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{nextTick as e}from"./scheduler.mjs";import{batch as t,effect as n,effectScope as r,endBatch as i,getCurrentScope as a,onScopeDispose as o,startBatch as s,stop as c}from"./reactivity/core.mjs";import{addMutationRecorder as l,removeMutationRecorder as u}from"./reactivity/reactive/mutation.mjs";import{toRaw as d}from"./reactivity/reactive/shared.mjs";import{prelinkReactiveTree as f,touchReactive as p}from"./reactivity/reactive/patch.mjs";import{isShallowReactive as m,shallowReactive as h}from"./reactivity/reactive/shallow.mjs";import{getReactiveVersion as g,isRaw as _,isReactive as v,markRaw as y,reactive as b}from"./reactivity/reactive.mjs";import{customRef as x,isRef as S,ref as C,toValue as w,unref as T}from"./reactivity/ref.mjs";import{computed as E}from"./reactivity/computed.mjs";import{isProxy as D,isReadonly as O,readonly as k,shallowReadonly as A}from"./reactivity/readonly.mjs";import{isShallowRef as j,shallowRef as M,triggerRef as N}from"./reactivity/shallowRef.mjs";import{toRef as P,toRefs as F}from"./reactivity/toRefs.mjs";import{traverse as I}from"./reactivity/traverse.mjs";import{callHookList as L,callHookReturn as R,getCurrentInstance as z,getCurrentSetupContext as B,setCurrentInstance as V,setCurrentSetupContext as H}from"./runtime/hooks/base.mjs";import{onAddToFavorites as U,onAttached as W,onDetached as G,onError as K,onHide as q,onLaunch as J,onLoad as Y,onMemoryWarning as X,onMoved as Z,onPageNotFound as Q,onPageScroll as $,onPullDownRefresh as ee,onReachBottom as te,onReady as ne,onResize as re,onRouteDone as ie,onSaveExitState as ae,onShareAppMessage as oe,onShareTimeline as se,onShow as ce,onTabItemTap as le,onThemeChange as ue,onUnhandledRejection as de,onUnload as fe}from"./runtime/hooks/register.mjs";import{callUpdateHooks as pe,onActivated as me,onBeforeMount as he,onBeforeUnmount as ge,onBeforeUpdate as _e,onDeactivated as ve,onErrorCaptured as ye,onMounted as be,onServerPrefetch as xe,onUnmounted as Se,onUpdated as Ce}from"./runtime/hooks/vue.mjs";import{getDeepWatchStrategy as we,setDeepWatchStrategy as Te}from"./reactivity/watch/types.mjs";import{watch as Ee,watchEffect as De,watchPostEffect as Oe,watchSyncEffect as ke}from"./reactivity/watch.mjs";import{version as Ae}from"./version.mjs";import{isNoSetData as je,markNoSetData as Me}from"./runtime/noSetData.mjs";import{resetWevuDefaults as Ne,setWevuDefaults as Pe}from"./runtime/defaults.mjs";import{setGlobalProvidedValue as Fe}from"./runtime/provideStore.mjs";import{resolveRuntimePageLayoutName as Ie,setPageLayout as Le,syncRuntimePageLayoutState as Re,syncRuntimePageLayoutStateFromRuntime as ze,usePageLayout as Be}from"./runtime/pageLayout.mjs";import{runSetupFunction as Ve}from"./runtime/register/setup.mjs";import{mountRuntimeInstance as He,setRuntimeSetDataVisibility as Ue,teardownRuntimeInstance as We}from"./runtime/register/runtimeInstance.mjs";import{registerApp as Ge}from"./runtime/register/app.mjs";import{
|
|
1
|
+
import{nextTick as e}from"./scheduler.mjs";import{batch as t,effect as n,effectScope as r,endBatch as i,getCurrentScope as a,onScopeDispose as o,startBatch as s,stop as c}from"./reactivity/core.mjs";import{addMutationRecorder as l,removeMutationRecorder as u}from"./reactivity/reactive/mutation.mjs";import{toRaw as d}from"./reactivity/reactive/shared.mjs";import{prelinkReactiveTree as f,touchReactive as p}from"./reactivity/reactive/patch.mjs";import{isShallowReactive as m,shallowReactive as h}from"./reactivity/reactive/shallow.mjs";import{getReactiveVersion as g,isRaw as _,isReactive as v,markRaw as y,reactive as b}from"./reactivity/reactive.mjs";import{customRef as x,isRef as S,ref as C,toValue as w,unref as T}from"./reactivity/ref.mjs";import{computed as E}from"./reactivity/computed.mjs";import{isProxy as D,isReadonly as O,readonly as k,shallowReadonly as A}from"./reactivity/readonly.mjs";import{isShallowRef as j,shallowRef as M,triggerRef as N}from"./reactivity/shallowRef.mjs";import{toRef as P,toRefs as F}from"./reactivity/toRefs.mjs";import{traverse as I}from"./reactivity/traverse.mjs";import{callHookList as L,callHookReturn as R,getCurrentInstance as z,getCurrentSetupContext as B,setCurrentInstance as V,setCurrentSetupContext as H}from"./runtime/hooks/base.mjs";import{onAddToFavorites as U,onAttached as W,onDetached as G,onError as K,onHide as q,onLaunch as J,onLoad as Y,onMemoryWarning as X,onMoved as Z,onPageNotFound as Q,onPageScroll as $,onPullDownRefresh as ee,onReachBottom as te,onReady as ne,onResize as re,onRouteDone as ie,onSaveExitState as ae,onShareAppMessage as oe,onShareTimeline as se,onShow as ce,onTabItemTap as le,onThemeChange as ue,onUnhandledRejection as de,onUnload as fe}from"./runtime/hooks/register.mjs";import{callUpdateHooks as pe,onActivated as me,onBeforeMount as he,onBeforeUnmount as ge,onBeforeUpdate as _e,onDeactivated as ve,onErrorCaptured as ye,onMounted as be,onServerPrefetch as xe,onUnmounted as Se,onUpdated as Ce}from"./runtime/hooks/vue.mjs";import{getDeepWatchStrategy as we,setDeepWatchStrategy as Te}from"./reactivity/watch/types.mjs";import{watch as Ee,watchEffect as De,watchPostEffect as Oe,watchSyncEffect as ke}from"./reactivity/watch.mjs";import{version as Ae}from"./version.mjs";import{isNoSetData as je,markNoSetData as Me}from"./runtime/noSetData.mjs";import{resetWevuDefaults as Ne,setWevuDefaults as Pe}from"./runtime/defaults.mjs";import{setGlobalProvidedValue as Fe}from"./runtime/provideStore.mjs";import{resolveRuntimePageLayoutName as Ie,setPageLayout as Le,syncRuntimePageLayoutState as Re,syncRuntimePageLayoutStateFromRuntime as ze,usePageLayout as Be}from"./runtime/pageLayout.mjs";import{runSetupFunction as Ve}from"./runtime/register/setup.mjs";import{mountRuntimeInstance as He,setRuntimeSetDataVisibility as Ue,teardownRuntimeInstance as We}from"./runtime/register/runtimeInstance.mjs";import{registerApp as Ge}from"./runtime/register/app.mjs";import{hasInjectionContext as Ke,inject as qe,injectGlobal as Je,provide as Ye,provideGlobal as Xe}from"./runtime/provide.mjs";import{registerPageLayoutBridge as Ze,registerRuntimeLayoutHosts as Qe,resolveLayoutBridge as $e,resolveLayoutHost as et,unregisterPageLayoutBridge as tt,unregisterRuntimeLayoutHosts as nt,useLayoutBridge as rt,useLayoutHosts as it,waitForLayoutHost as at}from"./runtime/layoutBridge.mjs";import{registerComponent as ot}from"./runtime/register/component.mjs";import{createApp as st}from"./runtime/app.mjs";import{useCssModule as ct}from"./runtime/css.mjs";import{createWevuComponent as lt,createWevuScopedSlotComponent as ut,defineComponent as dt}from"./runtime/define.mjs";import{useDisposables as ft}from"./runtime/disposables.mjs";import{useElementIntersectionObserver as pt}from"./runtime/elementIntersectionObserver.mjs";import{useIntersectionObserver as mt}from"./runtime/intersectionObserver.mjs";import{getCurrentPageStackSnapshot as ht,getNavigationBarMetrics as gt,useNavigationBarMetrics as _t,usePageStack as vt}from"./runtime/pageEnvironment.mjs";import{usePageScrollThrottle as yt}from"./runtime/pageScroll.mjs";import{useAsyncPullDownRefresh as bt}from"./runtime/pullDownRefresh.mjs";import{useBoundingClientRect as xt,useScrollOffset as St,useSelectorFields as Ct,useSelectorQuery as wt}from"./runtime/selectorQuery.mjs";import{normalizeClass as Tt,normalizeStyle as Et,resolvePropValue as Dt}from"./runtime/template.mjs";import{useUpdatePerformanceListener as Ot}from"./runtime/updatePerformance.mjs";import{defineAppSetup as kt,use as At}from"./runtime/use.mjs";import{useAttrs as jt,useNativeInstance as Mt,useSlots as Nt}from"./runtime/vueCompat/context.mjs";import{mergeModels as Pt,useBindModel as Ft,useChangeModel as It,useModel as Lt}from"./runtime/vueCompat/model.mjs";import{useNativePageRouter as Rt,useNativeRouter as zt}from"./runtime/vueCompat/router.mjs";import{useTemplateRef as Bt}from"./runtime/vueCompat/templateRef.mjs";import{createStore as Vt}from"./store/manager.mjs";import{defineStore as Ht}from"./store/define.mjs";import{storeToRefs as Ut}from"./store/storeToRefs.mjs";export*from"@wevu/web-apis";export{l as addMutationRecorder,t as batch,L as callHookList,R as callHookReturn,pe as callUpdateHooks,E as computed,st as createApp,Vt as createStore,lt as createWevuComponent,ut as createWevuScopedSlotComponent,x as customRef,kt as defineAppSetup,dt as defineComponent,Ht as defineStore,n as effect,r as effectScope,i as endBatch,z as getCurrentInstance,ht as getCurrentPageStackSnapshot,a as getCurrentScope,B as getCurrentSetupContext,we as getDeepWatchStrategy,gt as getNavigationBarMetrics,g as getReactiveVersion,Ke as hasInjectionContext,qe as inject,Je as injectGlobal,je as isNoSetData,D as isProxy,_ as isRaw,v as isReactive,O as isReadonly,S as isRef,m as isShallowReactive,j as isShallowRef,Me as markNoSetData,y as markRaw,Pt as mergeModels,He as mountRuntimeInstance,e as nextTick,Tt as normalizeClass,Et as normalizeStyle,me as onActivated,U as onAddToFavorites,W as onAttached,he as onBeforeMount,ge as onBeforeUnmount,_e as onBeforeUpdate,ve as onDeactivated,G as onDetached,K as onError,ye as onErrorCaptured,q as onHide,J as onLaunch,Y as onLoad,X as onMemoryWarning,be as onMounted,Z as onMoved,Q as onPageNotFound,$ as onPageScroll,ee as onPullDownRefresh,te as onReachBottom,ne as onReady,re as onResize,ie as onRouteDone,ae as onSaveExitState,o as onScopeDispose,xe as onServerPrefetch,oe as onShareAppMessage,se as onShareTimeline,ce as onShow,le as onTabItemTap,ue as onThemeChange,de as onUnhandledRejection,fe as onUnload,Se as onUnmounted,Ce as onUpdated,f as prelinkReactiveTree,Ye as provide,Xe as provideGlobal,b as reactive,k as readonly,C as ref,Ge as registerApp,ot as registerComponent,Ze as registerPageLayoutBridge,Qe as registerRuntimeLayoutHosts,u as removeMutationRecorder,Ne as resetWevuDefaults,$e as resolveLayoutBridge,et as resolveLayoutHost,Dt as resolvePropValue,Ie as resolveRuntimePageLayoutName,Ve as runSetupFunction,V as setCurrentInstance,H as setCurrentSetupContext,Te as setDeepWatchStrategy,Fe as setGlobalProvidedValue,Le as setPageLayout,Ue as setRuntimeSetDataVisibility,Pe as setWevuDefaults,h as shallowReactive,A as shallowReadonly,M as shallowRef,s as startBatch,c as stop,Ut as storeToRefs,Re as syncRuntimePageLayoutState,ze as syncRuntimePageLayoutStateFromRuntime,We as teardownRuntimeInstance,d as toRaw,P as toRef,F as toRefs,w as toValue,p as touchReactive,I as traverse,N as triggerRef,T as unref,tt as unregisterPageLayoutBridge,nt as unregisterRuntimeLayoutHosts,At as use,bt as useAsyncPullDownRefresh,jt as useAttrs,Ft as useBindModel,xt as useBoundingClientRect,It as useChangeModel,ct as useCssModule,ft as useDisposables,pt as useElementIntersectionObserver,mt as useIntersectionObserver,rt as useLayoutBridge,it as useLayoutHosts,Lt as useModel,Mt as useNativeInstance,Rt as useNativePageRouter,zt as useNativeRouter,_t as useNavigationBarMetrics,Be as usePageLayout,yt as usePageScrollThrottle,vt as usePageStack,St as useScrollOffset,Ct as useSelectorFields,wt as useSelectorQuery,Nt as useSlots,Bt as useTemplateRef,Ot as useUpdatePerformanceListener,Ae as version,at as waitForLayoutHost,Ee as watch,De as watchEffect,Oe as watchPostEffect,ke as watchSyncEffect};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{callHookList as e,callHookReturn as t,getCurrentInstance as n,getCurrentSetupContext as r,setCurrentInstance as i,setCurrentSetupContext as a}from"./runtime/hooks/base.mjs";import{onAddToFavorites as o,onAttached as s,onDetached as c,onError as l,onHide as u,onLaunch as d,onLoad as f,onMemoryWarning as p,onMoved as m,onPageNotFound as h,onPageScroll as g,onPullDownRefresh as _,onReachBottom as v,onReady as y,onResize as b,onRouteDone as x,onSaveExitState as S,onShareAppMessage as C,onShareTimeline as w,onShow as T,onTabItemTap as E,onThemeChange as D,onUnhandledRejection as O,onUnload as k}from"./runtime/hooks/register.mjs";import{onActivated as A,onBeforeMount as j,onBeforeUnmount as M,onBeforeUpdate as N,onDeactivated as P,onErrorCaptured as F,onMounted as I,onServerPrefetch as L,onUnmounted as R,onUpdated as z}from"./runtime/hooks/vue.mjs";import{version as B}from"./version.mjs";import{isNoSetData as V,markNoSetData as H}from"./runtime/noSetData.mjs";import{takePendingRuntimeAppRegistration as U}from"./runtime/app/pending.mjs";import{INTERNAL_DEFAULTS_SCOPE_KEY as W,resetWevuDefaults as G,setWevuDefaults as K}from"./runtime/defaults.mjs";import{setGlobalProvidedValue as q}from"./runtime/provideStore.mjs";import{resolveRuntimePageLayoutName as J,setPageLayout as Y,syncRuntimePageLayoutState as X,syncRuntimePageLayoutStateFromRuntime as Z,usePageLayout as Q}from"./runtime/pageLayout.mjs";import{runSetupFunction as $}from"./runtime/register/setup.mjs";import{mountRuntimeInstance as ee,setRuntimeSetDataVisibility as te,teardownRuntimeInstance as ne}from"./runtime/register/runtimeInstance.mjs";import{registerApp as re}from"./runtime/register/app.mjs";import{
|
|
1
|
+
import{callHookList as e,callHookReturn as t,getCurrentInstance as n,getCurrentSetupContext as r,setCurrentInstance as i,setCurrentSetupContext as a}from"./runtime/hooks/base.mjs";import{onAddToFavorites as o,onAttached as s,onDetached as c,onError as l,onHide as u,onLaunch as d,onLoad as f,onMemoryWarning as p,onMoved as m,onPageNotFound as h,onPageScroll as g,onPullDownRefresh as _,onReachBottom as v,onReady as y,onResize as b,onRouteDone as x,onSaveExitState as S,onShareAppMessage as C,onShareTimeline as w,onShow as T,onTabItemTap as E,onThemeChange as D,onUnhandledRejection as O,onUnload as k}from"./runtime/hooks/register.mjs";import{onActivated as A,onBeforeMount as j,onBeforeUnmount as M,onBeforeUpdate as N,onDeactivated as P,onErrorCaptured as F,onMounted as I,onServerPrefetch as L,onUnmounted as R,onUpdated as z}from"./runtime/hooks/vue.mjs";import{version as B}from"./version.mjs";import{isNoSetData as V,markNoSetData as H}from"./runtime/noSetData.mjs";import{takePendingRuntimeAppRegistration as U}from"./runtime/app/pending.mjs";import{INTERNAL_DEFAULTS_SCOPE_KEY as W,resetWevuDefaults as G,setWevuDefaults as K}from"./runtime/defaults.mjs";import{setGlobalProvidedValue as q}from"./runtime/provideStore.mjs";import{resolveRuntimePageLayoutName as J,setPageLayout as Y,syncRuntimePageLayoutState as X,syncRuntimePageLayoutStateFromRuntime as Z,usePageLayout as Q}from"./runtime/pageLayout.mjs";import{runSetupFunction as $}from"./runtime/register/setup.mjs";import{mountRuntimeInstance as ee,setRuntimeSetDataVisibility as te,teardownRuntimeInstance as ne}from"./runtime/register/runtimeInstance.mjs";import{registerApp as re}from"./runtime/register/app.mjs";import{hasInjectionContext as ie,inject as ae,injectGlobal as oe,provide as se,provideGlobal as ce}from"./runtime/provide.mjs";import{Fragment as le,createTextVNode as ue,createVNode as de,isVNode as fe,mergeProps as pe,normalizeJsxIsland as me,resolveComponent as he,resolveDirective as ge,transformOn as _e,vModelCheckbox as ve,vModelRadio as ye,vModelSelect as be,vModelText as xe,vShow as Se,withDirectives as Ce}from"./runtime/jsxIsland.mjs";import{resolveLayoutBridge as we,resolveLayoutHost as Te,useLayoutBridge as Ee,useLayoutHosts as De,waitForLayoutHost as Oe}from"./runtime/layoutBridge.mjs";import{registerComponent as ke}from"./runtime/register/component.mjs";import{createApp as Ae}from"./runtime/app.mjs";import{useCssModule as je,useCssVars as Me}from"./runtime/css.mjs";import{createIsolatedWevuComponentDefinition as Ne,createWevuComponent as Pe,createWevuComponentDefinition as Fe,createWevuScopedSlotComponent as Ie,defineComponent as Le,getWevuComponentLifecycleDefinition as Re}from"./runtime/define.mjs";import{useDisposables as ze}from"./runtime/disposables.mjs";import{useElementIntersectionObserver as Be}from"./runtime/elementIntersectionObserver.mjs";import{useIntersectionObserver as Ve}from"./runtime/intersectionObserver.mjs";import{getCurrentPageStackSnapshot as He,getNavigationBarMetrics as Ue,useNavigationBarMetrics as We,usePageStack as Ge}from"./runtime/pageEnvironment.mjs";import{usePageScrollThrottle as Ke}from"./runtime/pageScroll.mjs";import{useAsyncPullDownRefresh as qe}from"./runtime/pullDownRefresh.mjs";import{useBoundingClientRect as Je,useScrollOffset as Ye,useSelectorFields as Xe,useSelectorQuery as Ze}from"./runtime/selectorQuery.mjs";import{useUpdatePerformanceListener as Qe}from"./runtime/updatePerformance.mjs";import{defineAppSetup as $e,use as et}from"./runtime/use.mjs";import{useAttrs as tt,useNativeInstance as nt,useSlots as rt}from"./runtime/vueCompat/context.mjs";import{mergeModels as it,useBindModel as at,useChangeModel as ot,useModel as st}from"./runtime/vueCompat/model.mjs";import{useNativePageRouter as ct,useNativeRouter as lt}from"./runtime/vueCompat/router.mjs";import{useTemplateRef as ut}from"./runtime/vueCompat/templateRef.mjs";import{createUniAppHost as dt}from"./runtime/uniAppHost.mjs";export{le as Fragment,W as INTERNAL_DEFAULTS_SCOPE_KEY,e as callHookList,t as callHookReturn,Ae as createApp,Ne as createIsolatedWevuComponentDefinition,ue as createTextVNode,dt as createUniAppHost,de as createVNode,Pe as createWevuComponent,Fe as createWevuComponentDefinition,Ie as createWevuScopedSlotComponent,$e as defineAppSetup,Le as defineComponent,n as getCurrentInstance,He as getCurrentPageStackSnapshot,r as getCurrentSetupContext,Ue as getNavigationBarMetrics,Re as getWevuComponentLifecycleDefinition,ie as hasInjectionContext,ae as inject,oe as injectGlobal,V as isNoSetData,fe as isVNode,H as markNoSetData,it as mergeModels,pe as mergeProps,ee as mountRuntimeInstance,me as normalizeJsxIsland,A as onActivated,o as onAddToFavorites,s as onAttached,j as onBeforeMount,M as onBeforeUnmount,N as onBeforeUpdate,P as onDeactivated,c as onDetached,l as onError,F as onErrorCaptured,u as onHide,d as onLaunch,f as onLoad,p as onMemoryWarning,I as onMounted,m as onMoved,h as onPageNotFound,g as onPageScroll,_ as onPullDownRefresh,v as onReachBottom,y as onReady,b as onResize,x as onRouteDone,S as onSaveExitState,L as onServerPrefetch,C as onShareAppMessage,w as onShareTimeline,T as onShow,E as onTabItemTap,D as onThemeChange,O as onUnhandledRejection,k as onUnload,R as onUnmounted,z as onUpdated,se as provide,ce as provideGlobal,re as registerApp,ke as registerComponent,G as resetWevuDefaults,he as resolveComponent,ge as resolveDirective,we as resolveLayoutBridge,Te as resolveLayoutHost,J as resolveRuntimePageLayoutName,$ as runSetupFunction,i as setCurrentInstance,a as setCurrentSetupContext,q as setGlobalProvidedValue,Y as setPageLayout,te as setRuntimeSetDataVisibility,K as setWevuDefaults,X as syncRuntimePageLayoutState,Z as syncRuntimePageLayoutStateFromRuntime,U as takePendingRuntimeAppRegistration,ne as teardownRuntimeInstance,_e as transformOn,et as use,qe as useAsyncPullDownRefresh,tt as useAttrs,at as useBindModel,Je as useBoundingClientRect,ot as useChangeModel,je as useCssModule,Me as useCssVars,ze as useDisposables,Be as useElementIntersectionObserver,Ve as useIntersectionObserver,Ee as useLayoutBridge,De as useLayoutHosts,st as useModel,nt as useNativeInstance,ct as useNativePageRouter,lt as useNativeRouter,We as useNavigationBarMetrics,Q as usePageLayout,Ke as usePageScrollThrottle,Ge as usePageStack,Ye as useScrollOffset,Xe as useSelectorFields,Ze as useSelectorQuery,rt as useSlots,ut as useTemplateRef,Qe as useUpdatePerformanceListener,ve as vModelCheckbox,ye as vModelRadio,be as vModelSelect,xe as vModelText,Se as vShow,B as version,Oe as waitForLayoutHost,Ce as withDirectives};
|