wevu 6.25.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev/index.mjs +1 -1
- package/dist/dev/internal-runtime.mjs +1 -1
- package/dist/dev/package.mjs +1 -1
- package/dist/dev/router/backNavigation.mjs +1 -1
- package/dist/dev/router/createRouter.mjs +28 -1
- package/dist/dev/router/createRouter.mjs.map +1 -1
- package/dist/dev/router/initialNavigation.mjs +15 -0
- package/dist/dev/router/initialNavigation.mjs.map +1 -0
- package/dist/dev/router/navigationApi.mjs +1 -1
- package/dist/dev/router/navigationResult.mjs +1 -1
- package/dist/dev/router/navigationTarget.mjs +5 -4
- package/dist/dev/router/navigationTarget.mjs.map +1 -1
- package/dist/dev/router/navigationTargetHelpers.mjs +1 -1
- package/dist/dev/router/useRoute.mjs +1 -1
- package/dist/dev/router.mjs +1 -1
- package/dist/dev/runtime/register/component/lifecycle.mjs +72 -14
- package/dist/dev/runtime/register/component/lifecycle.mjs.map +1 -1
- package/dist/dev/runtime/register/component/registerDefinition.mjs +71 -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/backNavigation.mjs +1 -1
- package/dist/router/createRouter.mjs +1 -1
- package/dist/router/initialNavigation.mjs +1 -0
- package/dist/router/navigationApi.mjs +1 -1
- package/dist/router/navigationResult.mjs +1 -1
- package/dist/router/navigationTarget.mjs +1 -1
- package/dist/router/navigationTargetHelpers.mjs +1 -1
- package/dist/router/useRoute.mjs +1 -1
- package/dist/router.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
|
@@ -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, getInitialNavigationPromise } from "./lifecycle.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,20 @@ 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
|
+
const initialNavigationPromise = ensureInitialNavigation(instance, void 0, { start: false });
|
|
75
|
+
if (!initialNavigationPromise) {
|
|
76
|
+
task();
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
initialNavigationPromise.then((shouldMount) => {
|
|
80
|
+
if (shouldMount) task();
|
|
81
|
+
}, () => {});
|
|
82
|
+
};
|
|
68
83
|
const ensureReadyRuntime = (instance) => {
|
|
69
84
|
if (resolveRuntime(instance) || typeof vueLifecycles.mounted !== "function") return;
|
|
70
85
|
if (mountMissingRuntime(instance).mounted) {
|
|
@@ -112,7 +127,6 @@ function registerComponentDefinition(options) {
|
|
|
112
127
|
lifetimes: {
|
|
113
128
|
...userLifetimes,
|
|
114
129
|
created: function created(...args) {
|
|
115
|
-
callVueLifecycle(this, "beforeCreate", args);
|
|
116
130
|
applyExtraInstanceFields(this);
|
|
117
131
|
if (Array.isArray(templateRefs) && templateRefs.length) Object.defineProperty(this, WEVU_TEMPLATE_REFS_KEY, {
|
|
118
132
|
value: templateRefs,
|
|
@@ -121,20 +135,24 @@ function registerComponentDefinition(options) {
|
|
|
121
135
|
writable: false
|
|
122
136
|
});
|
|
123
137
|
attachWevuPropKeys(this);
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
138
|
+
const runCreated = () => {
|
|
139
|
+
callVueLifecycle(this, "beforeCreate", args);
|
|
140
|
+
if (setupLifecycle === "created") {
|
|
141
|
+
try {
|
|
142
|
+
mountRuntimeInstance(this, runtimeApp, watch, setup, {
|
|
143
|
+
deferSetData: true,
|
|
144
|
+
snapshotOmitKeys: directPropsDerivedKeys
|
|
145
|
+
});
|
|
146
|
+
} catch (error) {
|
|
147
|
+
const label = getRuntimeOwnerLabel(this);
|
|
148
|
+
throw new Error(`[wevu] mount runtime failed in created (${label}): ${error instanceof Error ? error.message : String(error)}`);
|
|
149
|
+
}
|
|
150
|
+
syncWevuPropsFromInstance(this);
|
|
151
|
+
attachPageLayoutSetter(this);
|
|
133
152
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
if (typeof userLifetimes.created === "function") userLifetimes.created.apply(this, args);
|
|
153
|
+
if (typeof userLifetimes.created === "function") userLifetimes.created.apply(this, args);
|
|
154
|
+
};
|
|
155
|
+
deferPageUntilNavigation(this, runCreated);
|
|
138
156
|
},
|
|
139
157
|
moved: function moved(...args) {
|
|
140
158
|
callHookList(this, "onMoved", args);
|
|
@@ -149,30 +167,51 @@ function registerComponentDefinition(options) {
|
|
|
149
167
|
writable: false
|
|
150
168
|
});
|
|
151
169
|
attachWevuPropKeys(this);
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
170
|
+
deferPageUntilNavigation(this, () => {
|
|
171
|
+
if (setupLifecycle !== "created" || !this.__wevu) try {
|
|
172
|
+
mountRuntimeInstance(this, runtimeApp, watch, setup, {
|
|
173
|
+
deferSetData: true,
|
|
174
|
+
snapshotOmitKeys: directPropsDerivedKeys
|
|
175
|
+
});
|
|
176
|
+
} catch (error) {
|
|
177
|
+
const label = getRuntimeOwnerLabel(this);
|
|
178
|
+
throw new Error(`[wevu] mount runtime failed in attached (${label}): ${error instanceof Error ? error.message : String(error)}`);
|
|
179
|
+
}
|
|
180
|
+
syncWevuPropsFromInstance(this);
|
|
181
|
+
callVueLifecycle(this, "created", args);
|
|
182
|
+
callVueLifecycle(this, "beforeMount", args);
|
|
183
|
+
attachPageLayoutSetter(this);
|
|
184
|
+
attachRuntimeLayoutHosts(this);
|
|
185
|
+
enableDeferredSetData(this);
|
|
186
|
+
callHookList(this, "onAttached", args);
|
|
187
|
+
if (typeof userLifetimes.attached === "function") userLifetimes.attached.apply(this, args);
|
|
188
|
+
});
|
|
169
189
|
},
|
|
170
190
|
ready: function ready(...args) {
|
|
191
|
+
if (isPage && !this[WEVU_READY_CALLED_KEY]) {
|
|
192
|
+
const initialNavigationPromise = ensureInitialNavigation(this, void 0, { start: true });
|
|
193
|
+
if (initialNavigationPromise && !this.__wevuInitialNavigationReady) {
|
|
194
|
+
initialNavigationPromise.then((shouldMount) => {
|
|
195
|
+
if (shouldMount) {
|
|
196
|
+
this.__wevuInitialNavigationReady = true;
|
|
197
|
+
componentDefinition.lifetimes.ready.call(this, ...args);
|
|
198
|
+
}
|
|
199
|
+
}, () => {});
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
171
203
|
ensureReadyRuntime(this);
|
|
172
204
|
if (isPage && typeof pageLifecycleHooks.onReady === "function") {
|
|
173
205
|
const wasReadyCalled = Boolean(this[WEVU_READY_CALLED_KEY]);
|
|
174
206
|
pageLifecycleHooks.onReady.call(this, ...args);
|
|
175
|
-
if (!wasReadyCalled)
|
|
207
|
+
if (!wasReadyCalled) {
|
|
208
|
+
const callMounted = () => callVueLifecycle(this, "mounted", args);
|
|
209
|
+
const initialNavigationPromise = getInitialNavigationPromise(this);
|
|
210
|
+
if (initialNavigationPromise) initialNavigationPromise.then((shouldMount) => {
|
|
211
|
+
if (shouldMount) callMounted();
|
|
212
|
+
}, () => {});
|
|
213
|
+
else callMounted();
|
|
214
|
+
}
|
|
176
215
|
if (typeof userLifetimes.ready === "function") userLifetimes.ready.apply(this, args);
|
|
177
216
|
return;
|
|
178
217
|
}
|
|
@@ -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,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;;GAC1C,yBAAO,cAAc,OAAO,4DAAK;EACnC;EACA,OAAO;CACT;CAEA,MAAM,uBAAuB,aAAmC;EAC9D,MAAM,W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AS;GACP,GAAG;GACH,GAAG;GACH,CAAC,sCAAsC,SAAS,wBAAkD;;IAChG,MAAM,SAAS,oBAAoB,IAAI;IACvC,IAAI,OAAO,SAAS;KAClB,iBAAiB,MAAM,WAAW,CAAC,CAAC;KACpC,iBAAiB,MAAM,eAAe,CAAC,CAAC;IAC1C;IACA,0BAAO,OAAO,2EAAS;GACzB;EACF;EACA,SAAS;CACX;CACA,IAAI,CAAC,gBACH,OAAO;CAGT,MAAM,6CAAoB,kCAAkC,iFAAI;CAChE,IAAI,8EAAO,kBAAmB,wBAAuB,YAAY;EAC/D,MAAM,aAAa,kBAAkB,mBAAmB,sBACtD,UACA,kBACG;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"}
|
|
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 { ensureInitialNavigation, getInitialNavigationPromise } from './lifecycle'\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, undefined, { start: false })\n if (!initialNavigationPromise) {\n task()\n return\n }\n void initialNavigationPromise.then((shouldMount) => {\n if (shouldMount) {\n task()\n }\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, undefined, { start: true })\n if (initialNavigationPromise && !(this as any).__wevuInitialNavigationReady) {\n void initialNavigationPromise.then((shouldMount) => {\n if (shouldMount) {\n ;(this as any).__wevuInitialNavigationReady = true\n componentDefinition.lifetimes.ready.call(this, ...args)\n }\n }, () => {})\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 = getInitialNavigationPromise(this)\n if (initialNavigationPromise) {\n void initialNavigationPromise.then((shouldMount) => {\n if (shouldMount) {\n callMounted()\n }\n }, () => {})\n }\n else {\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":";;;;;;;;;;;;AAmCA,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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AM,GAAG,IAAI;KAC3D,IAAI,OAAQ,kBAA0B,cAAc,YACjD,AAAC,kBAA0B,UAAU,MAAM,MAAM,IAAI;KAExD;IACF;IACA,aAAa,MAAM,eAAe,IAAI;IACtC,IAAI,OAAQ,kBAA0B,cAAc,YACjD,AAAC,kBAA0B,UAAU,MAAM,MAAM,IAAI;GAE1D;EACF;EACA,SAAS;GACP,GAAG;GACH,GAAG;GACH,CAAC,sCAAsC,SAAS,wBAAkD;;IAChG,MAAM,SAAS,oBAAoB,IAAI;IACvC,IAAI,OAAO,SAAS;KAClB,iBAAiB,MAAM,WAAW,CAAC,CAAC;KACpC,iBAAiB,MAAM,eAAe,CAAC,CAAC;IAC1C;IACA,0BAAO,OAAO,2EAAS;GACzB;EACF;EACA,SAAS;CACX;CACA,IAAI,CAAC,gBACH,OAAO;CAGT,MAAM,6CAAoB,kCAAkC,iFAAI;CAChE,IAAI,8EAAO,kBAAmB,wBAAuB,YAAY;EAC/D,MAAM,aAAa,kBAAkB,mBAAmB,sBACtD,UACA,kBACG;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};
|
package/dist/package.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=`
|
|
1
|
+
var e=`7.0.0`;export{e as version};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getCurrentMiniProgramPages as e}from"../runtime/platform.mjs";import{
|
|
1
|
+
import{getCurrentMiniProgramPages as e}from"../runtime/platform.mjs";import{NavigationFailureType as t}from"./types.mjs";import{createNavigationFailure as n,runNavigationGuards as r}from"./navigationCore.mjs";import{resolvePageRoute as i}from"../routerInternal/location.mjs";import{createNavigationRunResult as a}from"./navigationResult.mjs";function o(t,n,r){let a=e(),o=a[a.length-1-t];if(o)return r(i(o).fullPath,n.path)}async function s(e){let{target:i,from:o,nativeRouter:s,beforeEachGuards:c,beforeResolveGuards:l,resolveWithCodec:u}=e,d={mode:`back`,to:i,from:o,nativeRouter:s};for(let e of[c,l]){let s=await r(e,d,u);if(s.status===`failure`)return a(`back`,o,i,s.failure);if(s.status===`redirect`)return a(`back`,o,i,n(t.aborted,i,o,`Redirect is not supported in back navigation guards`))}return a(`back`,o,i)}export{o as resolveBackNavigationTarget,s as runBackNavigationGuards};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getMiniProgramGlobalObject as e}from"../runtime/platform.mjs";import{
|
|
1
|
+
import{getMiniProgramGlobalObject as e}from"../runtime/platform.mjs";import{setActiveRouter as t}from"./instance.mjs";import{registerInitialNavigationRunner as n}from"./initialNavigation.mjs";import{installRouteStateSyncOnNativeRouter as r}from"./routeSync.mjs";import{resolvePath as i}from"../routerInternal/path.mjs";import{parseQuery as a,stringifyQuery as o}from"../routerInternal/query.mjs";import{resolveCurrentRoute as ee}from"../routerInternal/location.mjs";import{resolveNamedRouteLocation as te}from"../routerInternal/params.mjs";import{mergeMatchedRouteMeta as s,resolveMatchedRouteRecord as c}from"../routerInternal/matching.mjs";import{warnDuplicateRouteEntries as l}from"../routerInternal/recordsWarnings.mjs";import{createNamedRouteLookup as u,resolveRouteOptionEntries as d}from"../routerInternal/records.mjs";import{cloneRouteMeta as f,cloneRouteParams as ne,createRouterOptionsSnapshot as re,normalizeRouteRecordMatched as ie,snapshotRouteLocation as p}from"../routerInternal/snapshots.mjs";import{createNavigationResultController as m}from"./navigationResult.mjs";import{runBackNavigationGuards as h}from"./backNavigation.mjs";import{navigateWithTarget as g}from"./navigationTarget.mjs";import{createNavigationApi as _}from"./navigationApi.mjs";import{resolveRouteLocation as v}from"./resolve.mjs";import{createRouteRegistry as y}from"./routeRegistry.mjs";import{createRouteStateController as b,useNativeRouter as x}from"./useRoute.mjs";function S(S={}){var C,w,T,E,D,O;let k=x();r(e());let A=new Set,j=new Set,M=new Set,N=new Set,P=(C=S.maxRedirects)==null?10:C,F=(w=S.paramsMode)==null?`loose`:w,I=(T=S.rejectOnError)==null||T,L={parseQuery:(E=S.parseQuery)==null?a:E,stringifyQuery:(D=S.stringifyQuery)==null?o:D},R=Promise.resolve(),z=d(S);l(z);let B=u(z),V=((O=S.tabBarEntries)==null?[]:O).map(e=>i(e,``)).filter(Boolean),H=new Set(V),U=y(B),W=0,G=re(V,U.getRoutes(),F,P,L,I);function K(e){let t={...e};t.href=t.fullPath;let n=c(t,B);if(n){let e=n.record;t.name===void 0&&(t.name=e.name);let r=s(n.matchedRecords);r!==void 0&&(t.meta=f(r)),n.params&&Object.keys(t.params).length===0&&(t.params=ne(n.params)),t.matched=n.matchedRecords.map((e,t,r)=>{let i=t===r.length-1?n.matchedPath:void 0;return ie(e,i)})}else t.matched=[];return t}function q(e,t){let n=typeof e==`string`?e:te(e,B,F);return K(v(n,t,L))}let J,Y;function ae(e){return e.source===`page`||e.source===`native`&&e.method===`navigateBack`}function oe(e,t){if(W>0||!ae(t)||e.fullPath===J.fullPath)return;let n=p(J);h({target:e,from:n,nativeRouter:k,beforeEachGuards:A,beforeResolveGuards:j,resolveWithCodec:q}).then(e=>Y==null?void 0:Y(e))}J=b({beforeRouteStateSync:oe,resolveRoute:K}).route;function se(e){return q(e,J.path)}let X=m({afterEachHooks:M,errorHandlers:N,nativeRouter:k,rejectOnError:I});Y=X.emitNavigationAfterEach;let Z=_({nativeRouter:k,route:J,routeResolveCodec:L,namedRouteLookup:B,beforeEachGuards:A,beforeResolveGuards:j,maxRedirects:P,tabBarPathSet:H,resolveWithCodec:q,settleNavigationResult:X.settleNavigationResult});async function Q(e){W+=1;try{return await e()}finally{--W}}async function ce(e,t){return Q(async()=>{let n=p(J),r=K(ee(t,e));if(!r.path)return;let i=await g({mode:`push`,target:r,from:n,nativeRouter:k,routeResolveCodec:L,namedRouteLookup:B,beforeEachGuards:A,beforeResolveGuards:j,maxRedirects:P,tabBarPathSet:H,resolveWithCodec:q,executeNative:!1,allowSameLocation:!0});return X.settleNavigationResult(i)})}function le(e){return A.add(e),()=>{A.delete(e)}}function ue(e){return j.add(e),()=>{j.delete(e)}}function de(e){return M.add(e),()=>{M.delete(e)}}function fe(e){return N.add(e),()=>{N.delete(e)}}let $={nativeRouter:k,options:G,currentRoute:J,install(e){var n;t($);let r=e==null||(n=e.config)==null?void 0:n.globalProperties;r&&(r.$router=$)},resolve:se,isReady(){return R},push:e=>Q(()=>Z.push(e)),replace:e=>Q(()=>Z.replace(e)),back:e=>Q(()=>Z.back(e)),go:e=>Q(()=>Z.go(e)),forward:()=>Q(()=>Z.forward()),hasRoute:U.hasRoute,getRoutes:U.getRoutes,addRoute:U.addRoute,removeRoute:U.removeRoute,clearRoutes:U.clearRoutes,beforeEach:le,beforeResolve:ue,afterEach:de,onError:fe};return t($),n($,ce),$}export{S as createRouter};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getActiveRouter as e}from"./instance.mjs";const t=new WeakMap;function n(e,n){t.set(e,n)}function r(){let n=e();return n?t.get(n):void 0}export{r as getInitialNavigationRunner,n as registerInitialNavigationRunner};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{NavigationFailureType as e}from"./types.mjs";import{createNavigationFailure as t,executeNavigationMethod as n,isNavigationFailure as r}from"./navigationCore.mjs";import{snapshotRouteLocation as i}from"../routerInternal/snapshots.mjs";import{createNavigationRunResult as a}from"./navigationResult.mjs";import{resolveBackNavigationTarget as o,runBackNavigationGuards as s}from"./backNavigation.mjs";import{createForwardNotSupportedFailure as c}from"./navigationTargetHelpers.mjs";import{navigateWithTarget as l}from"./navigationTarget.mjs";function u(u){let{nativeRouter:d,route:f,routeResolveCodec:p,namedRouteLookup:m,beforeEachGuards:h,beforeResolveGuards:g,maxRedirects:_,tabBarPathSet:v,resolveWithCodec:y,settleNavigationResult:b}=u;async function x(n){let r=i(f),o;try{o=y(n,r.path)}catch(n){return b(a(`push`,r,void 0,t(e.unknown,void 0,r,n)))}let s=await l({mode:`push`,target:o,from:r,nativeRouter:d,routeResolveCodec:p,namedRouteLookup:m,beforeEachGuards:h,beforeResolveGuards:g,maxRedirects:_,tabBarPathSet:v,resolveWithCodec:y});return b(s)}async function S(n){let r=i(f),o;try{o=y(n,r.path)}catch(n){return b(a(`replace`,r,void 0,t(e.unknown,void 0,r,n)))}let s=await l({mode:`replace`,target:o,from:r,nativeRouter:d,routeResolveCodec:p,namedRouteLookup:m,beforeEachGuards:h,beforeResolveGuards:g,maxRedirects:_,tabBarPathSet:v,resolveWithCodec:y});return b(s)}async function C(e=1){let t=i(f),c=o(e,t,y),l=await s({target:c,from:t,nativeRouter:d,beforeEachGuards:h,beforeResolveGuards:g,resolveWithCodec:y});if(l.failure)return b(l);let u=await n(d.navigateBack,{delta:e},c,t),p=r(u)?a(`back`,t,c,u):l;return b(p)}async function w(e){if(e<0)return C(Math.abs(e));if(e===0)return;let t=i(f);return b(a(`back`,t,void 0,c(t)))}async function T(){return w(1)}return{push:x,replace:S,back:C,go:w,forward:T}}export{u as createNavigationApi};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{runAfterEachHooks as e,runNavigationErrorHooks as t,shouldEmitNavigationError as n}from"./navigationCore.mjs";import{notifyRouteStateSync as r}from"./routeSync.mjs";function i(e,t,n,r){return{mode:e,from:t,to:n,failure:r}}function a(i){let{afterEachHooks:a,errorHandlers:o,nativeRouter:s,rejectOnError:c}=i;async function l(r){if(await e(a,{mode:r.mode,to:r.to,from:r.from,nativeRouter:s,failure:r.failure}),r.failure&&n(r.failure)){var i;await t(o,(i=r.failure.cause)==null?r.failure:i,{mode:r.mode,to:r.to,from:r.from,nativeRouter:s,failure:r.failure})}}function u(e){return c&&n(e)}async function d(e){if(e.failure||r(e.to?{route:e.to,source:`router`}:void 0),await l(e),e.failure&&u(e.failure))throw e.failure;return e.failure}return{emitNavigationAfterEach:l,settleNavigationResult:d}}export{a as createNavigationResultController,i as createNavigationRunResult};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{NavigationFailureType as e}from"./types.mjs";import{createNavigationFailure as t,executeNavigationMethod as n,isNavigationFailure as r,runNavigationGuards as i}from"./navigationCore.mjs";import{createAbsoluteRoutePath as a}from"../routerInternal/path.mjs";import{resolveMatchedRouteRecord as o}from"../routerInternal/matching.mjs";import{createNativeRouteUrl as s,hasLocationQuery as c}from"../routerInternal/snapshots.mjs";import{createNavigationRunResult as l}from"./navigationResult.mjs";import{applyRedirectedFrom as u,createDuplicatedFailure as d,createHashOnlyNavigationFailure as f,createTabBarQueryFailure as p,createTooManyRedirectsFailure as m,resolveRouteRecordRedirect as h}from"./navigationTargetHelpers.mjs";async function g(g){let{mode:_,target:v,from:y,nativeRouter:b,routeResolveCodec:x,namedRouteLookup:S,beforeEachGuards:C,beforeResolveGuards:w,maxRedirects:T,tabBarPathSet:E,resolveWithCodec:D,executeNative:O=!0,allowSameLocation:k=!1}=g,A=v,j=_,M=0;for(;;){var N;let g=E.has(A.path);if(s(A,x.stringifyQuery)===s(y,x.stringifyQuery)&&A.hash!==y.hash)return l(j,y,A,f(A,y));if(!k&&(g?A.path===y.path:A.fullPath===y.fullPath))return l(j,y,A,d(A,y));if(g&&c(A.query))return l(j,y,A,p(A,y));let _=await i(C,{mode:j,to:A,from:y,nativeRouter:b},D);if(_.status===`failure`)return l(j,y,A,_.failure);if(_.status===`redirect`){let e=_.target,t=_.replace===!0?`replace`:_.replace===!1?`push`:j;if(e.fullPath!==A.fullPath||t!==j){if(u(e,A),A=e,j=t,M+=1,M>T)return l(j,y,A,m(A,y,T));continue}}let v=o(A,S),P=(N=v==null?void 0:v.matchedRecords)==null?[]:N,F=!1;for(let n of P){if(n.redirect===void 0)continue;let r;try{r=await h(n.redirect,A,y,D)}catch(n){return l(j,y,A,t(e.aborted,A,y,n))}let i=r.replace===!1?`push`:`replace`,a=r.target;if(a.fullPath!==A.fullPath||i!==j){if(u(a,A),A=a,j=i,M+=1,M>T)return l(j,y,A,m(A,y,T));F=!0;break}}if(F)continue;let I=!1;for(let e of P){if(e.beforeEnterGuards.length===0)continue;let t=await i(new Set(e.beforeEnterGuards),{mode:j,to:A,from:y,nativeRouter:b},D);if(t.status===`failure`)return l(j,y,A,t.failure);if(t.status===`redirect`){let e=t.target,n=t.replace===!0?`replace`:t.replace===!1?`push`:j;if(e.fullPath!==A.fullPath||n!==j){if(u(e,A),A=e,j=n,M+=1,M>T)return l(j,y,A,m(A,y,T));I=!0;break}}}if(I)continue;let L=await i(w,{mode:j,to:A,from:y,nativeRouter:b},D);if(L.status===`failure`)return l(j,y,A,L.failure);if(L.status===`redirect`){let e=L.target,t=L.replace===!0?`replace`:L.replace===!1?`push`:j;if(e.fullPath!==A.fullPath||t!==j){if(u(e,A),A=e,j=t,M+=1,M>T)return l(j,y,A,m(A,y,T));continue}}if(!O)return l(j,y,A);if(g){let e=await n(b.switchTab,{url:a(A.path)},A,y);return r(e)?l(j,y,A,e):l(j,y,A)}let R=j===`push`?b.navigateTo:b.redirectTo,z=await n(R,{url:s(A,x.stringifyQuery)},A,y);return r(z)?l(j,y,A,z):l(j,y,A)}}export{g as navigateWithTarget};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{NavigationFailureType as e}from"./types.mjs";import{createNavigationFailure as t,isNavigationRedirectCandidate as n}from"./navigationCore.mjs";import{cloneRouteLocationRedirectedFrom as r,createRedirectedFromSnapshot as i}from"../routerInternal/snapshots.mjs";function a(n,r){return t(e.duplicated,n,r,`Avoided redundant navigation to current location`)}function o(n,r){return t(e.aborted,n,r,`switchTab does not support query parameters`)}function s(n,r,i){return t(e.aborted,n,r,`Navigation redirected more than ${i} times`)}function c(n,r){return t(e.aborted,n,r,`Hash-only navigation is not supported in mini-program router`)}function l(n){return t(e.aborted,void 0,n,`Forward navigation is not supported in mini-program router`)}function u(e,t){e.redirectedFrom=t.redirectedFrom?r(t.redirectedFrom):i(t)}async function d(e,t,r,i){let a=typeof e==`function`?await e(t,r):e;return n(a)?{target:i(a.to,t.path),replace:a.replace}:{target:i(a,t.path),replace:!0}}export{u as applyRedirectedFrom,a as createDuplicatedFailure,l as createForwardNotSupportedFailure,c as createHashOnlyNavigationFailure,o as createTabBarQueryFailure,s as createTooManyRedirectsFailure,d as resolveRouteRecordRedirect};
|
package/dist/router/useRoute.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{reactive as e}from"../reactivity/reactive.mjs";import{readonly as t}from"../reactivity/readonly.mjs";import{getCurrentSetupContext as n}from"../runtime/hooks/base.mjs";import{onLoad as r,onReady as i,onRouteDone as a,onShow as o,onUnload as s}from"../runtime/hooks/register.mjs";import{
|
|
1
|
+
import{reactive as e}from"../reactivity/reactive.mjs";import{readonly as t}from"../reactivity/readonly.mjs";import{getCurrentSetupContext as n}from"../runtime/hooks/base.mjs";import{onLoad as r,onReady as i,onRouteDone as a,onShow as o,onUnload as s}from"../runtime/hooks/register.mjs";import{getActiveRouter as c}from"./instance.mjs";import{registerRouteStateSyncHandler as l}from"./routeSync.mjs";import{resolveCurrentRoute as u,resolvePageRoute as d}from"../routerInternal/location.mjs";import{cloneLocationQuery as f,cloneRouteLocationRedirectedFrom as p,cloneRouteMeta as m,cloneRouteParams as h,cloneRouteRecordMatchedList as g}from"../routerInternal/snapshots.mjs";import{useNativePageRouter as _,useNativeRouter as v}from"../runtime/vueCompat/router.mjs";import{resolveRouteLocation as y}from"./resolve.mjs";function b(e,t){e.path=t.path,e.fullPath=t.fullPath,e.query=f(t.query),e.hash=t.hash,e.params=h(t.params),t.name===void 0?delete e.name:e.name=t.name,t.meta===void 0?delete e.meta:e.meta=m(t.meta),t.href===void 0?delete e.href:e.href=t.href,t.matched===void 0?delete e.matched:e.matched=g(t.matched),t.redirectedFrom===void 0?delete e.redirectedFrom:e.redirectedFrom=p(t.redirectedFrom)}function x(p={}){var m;let g=n();if(!g)throw Error(`useRoute() 必须在 setup() 的同步阶段调用`);let _=g.instance,v=(m=p.resolveRoute)==null?(e=>{var t,n;return(t=(n=c())==null?void 0:n.resolve(e))==null?e:t}):m,x=v(u(void 0,_)),S=e({path:x.path,fullPath:x.fullPath,query:f(x.query),hash:x.hash,params:h(x.params)});b(S,x);function C(e,t,n){let r=v(t||u(e,_));if(n){var i;(i=p.beforeRouteStateSync)==null||i.call(p,r,n)}b(S,r)}r(e=>{C(e)}),i(()=>{C()}),o(()=>{C()}),a(()=>{C()});let w=l(e=>{if(e!=null&&e.route){C(void 0,e.route,e);return}if(e!=null&&e.page){C(void 0,d(e.page),e);return}if(e!=null&&e.url){C(void 0,y(e.url,S.path),e);return}C(void 0,void 0,e)});return s(()=>{w()}),{route:t(S)}}function S(e={}){return x(e).route}function C(){return v()}function w(){return _()}export{x as createRouteStateController,w as useNativePageRouter,C as useNativeRouter,S as useRoute};
|
package/dist/router.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{NavigationFailureType as e}from"./router/types.mjs";import{createNavigationFailure as t,isNavigationFailure as n}from"./router/navigationCore.mjs";import{parseQuery as r,stringifyQuery as i}from"./routerInternal/query.mjs";import{resolveRouteLocation as a}from"./router/resolve.mjs";import{useNativePageRouter as o,useNativeRouter as s,useRoute as c}from"./router/useRoute.mjs";import{createRouter as l}from"./router/createRouter.mjs";import{useRouter as u}from"./router/useRouter.mjs";export{e as NavigationFailureType,t as createNavigationFailure,l as createRouter,n as isNavigationFailure,r as parseQuery,a as resolveRouteLocation,i as stringifyQuery,o as useNativePageRouter,s as useNativeRouter,c as useRoute,u as useRouter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{callHookList as e}from"../../hooks/base.mjs";import{bindCurrentPageInstance as t,ensureMiniProgramGlobalPatched as n,ensurePageShareMenus as r,releaseCurrentPageInstance as i,resolvePageOptions as a}from"./lifecycle/platform.mjs";import{scheduleTemplateRefUpdate as o}from"../../templateRefs.mjs";import{enableDeferredSetData as s,mountRuntimeInstance as c,setRuntimeSetDataVisibility as l,teardownRuntimeInstance as u}from"../runtimeInstance.mjs";import{
|
|
1
|
+
import{callHookList as e}from"../../hooks/base.mjs";import{bindCurrentPageInstance as t,ensureMiniProgramGlobalPatched as n,ensurePageShareMenus as r,releaseCurrentPageInstance as i,resolvePageOptions as a}from"./lifecycle/platform.mjs";import{scheduleTemplateRefUpdate as o}from"../../templateRefs.mjs";import{enableDeferredSetData as s,mountRuntimeInstance as c,setRuntimeSetDataVisibility as l,teardownRuntimeInstance as u}from"../runtimeInstance.mjs";import{getInitialNavigationRunner as d}from"../../../router/initialNavigation.mjs";import{isNavigationFailure as f}from"../../../router/navigationCore.mjs";import{notifyRouteStateSync as p}from"../../../router/routeSync.mjs";import{attachOptionalPageLifecycleHooks as m}from"./lifecycle/optionalHooks.mjs";import{WEVU_ON_LOAD_CALLED_KEY as h,WEVU_READY_CALLED_KEY as g,WEVU_ROUTE_DONE_CALLED_KEY as _}from"@weapp-core/constants";const v=Symbol(`wevu.initialNavigationPromise`),y=Symbol(`wevu.startInitialNavigation`);function b(e){return e[v]}function x(e,t,n={}){let r=b(e);if(r){if(n.start!==!1){var i;(i=e[y])==null||i.call(e,t)}return r}let a=d();if(!a)return;let o,s,c=new Promise((e,t)=>{o=e,s=t});e[v]=c;let l=!1;return e[y]=n=>{l||(l=!0,a(e,n==null?t:n).then(e=>{let t=!f(e);o(t)},s))},n.start!==!1&&e[y](t),c}function S(d){let{runtimeApp:f,watch:v,setup:y,userOnLoad:S,userOnUnload:C,userOnShow:w,userOnHide:T,userOnReady:E,isPage:D,enableOnSaveExitState:O,enableOnPullDownRefresh:k,enableOnReachBottom:A,enableOnPageScroll:j,enableOnRouteDone:M,enableOnRouteDoneFallback:N,enableOnTabItemTap:P,enableOnResize:F,enableOnShareAppMessage:I,enableOnShareTimeline:L,enableOnAddToFavorites:R,syncWevuPropsFromValues:z,effectiveOnSaveExitState:B,effectiveOnPullDownRefresh:V,effectiveOnReachBottom:H,effectiveOnPageScroll:U,effectiveOnRouteDone:W,effectiveOnTabItemTap:G,effectiveOnResize:K,effectiveOnShareAppMessage:q,effectiveOnShareTimeline:J,effectiveOnAddToFavorites:Y,hasHook:X}=d,Z=e=>{var t,n;(t=e.__wevu)==null||(n=t.__wevu_flushSetupSnapshotSync)==null||n.call(t)},Q={onLoad(...t){if(this[h])return;this[h]=!0;let n=()=>{c(this,f,v,y);let n=t[0]&&typeof t[0]==`object`?t[0]:a(this);if(z==null||z(this,n),Z(this),s(this),D&&r({enableOnShareAppMessage:I,enableOnShareTimeline:L}),e(this,`onLoad`,t),typeof S==`function`)return S.apply(this,t.length?t:[n])},i=D?x(this,t[0]):void 0;return i?(i.then(e=>{e&&n()},()=>{}),i):n()},onUnload(...e){if(D&&i(this),u(this),typeof C==`function`)return C.apply(this,e)},onShow(...i){if(D&&(n(),t(this),this[h]||Q.onLoad.call(this,a(this)),z==null||z(this,a(this)),Z(this),r({enableOnShareAppMessage:I,enableOnShareTimeline:L}),this[_]=!1),l(this,!0),D&&p({page:this,source:`page`}),e(this,`onShow`,i),typeof w==`function`)return w.apply(this,i)},onHide(...t){if(D&&i(this),l(this,!1),e(this,`onHide`,t),typeof T==`function`)return T.apply(this,t)},onReady(...t){if(D&&(this[h]||Q.onLoad.call(this,a(this)),z==null||z(this,a(this)),Z(this),r({enableOnShareAppMessage:I,enableOnShareTimeline:L})),!this[g]){if(this[g]=!0,D&&M&&N){let e=this;setTimeout(()=>{if(!e[_]){var t;(t=Q.onRouteDone)==null||t.call(e)}},0)}let n=()=>{e(this,`onReady`,t),typeof E==`function`&&E.apply(this,t)},r=b(this);o(this,()=>{if(r){r.then(e=>{e&&n()},()=>{});return}n()});return}if(typeof E==`function`)return E.apply(this,t)}};return m(Q,{enableOnSaveExitState:O,enableOnPullDownRefresh:k,enableOnReachBottom:A,enableOnPageScroll:j,enableOnRouteDone:M,enableOnTabItemTap:P,enableOnResize:F,enableOnShareAppMessage:I,enableOnShareTimeline:L,enableOnAddToFavorites:R,effectiveOnSaveExitState:B,effectiveOnPullDownRefresh:V,effectiveOnReachBottom:H,effectiveOnPageScroll:U,effectiveOnRouteDone:W,effectiveOnTabItemTap:G,effectiveOnResize:K,effectiveOnShareAppMessage:q,effectiveOnShareTimeline:J,effectiveOnAddToFavorites:Y,hasHook:X}),Q}export{S as createPageLifecycleHooks,x as ensureInitialNavigation,b as getInitialNavigationPromise};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getMiniProgramRuntimeGlobalObject as e}from"../../platform.mjs";import{callHookList as t}from"../../hooks/base.mjs";import{resolveRuntimePageLayoutName as n,syncRuntimePageLayoutState as r}from"../../pageLayout.mjs";import{getOwnerProxy as i}from"../../scopedSlots.mjs";import{clearTemplateRefs as a,scheduleTemplateRefUpdate as o}from"../../templateRefs.mjs";import{enableDeferredSetData as s,mountRuntimeInstance as c,refreshRuntimeInstance as l,setRuntimeSetDataVisibility as u,teardownRuntimeInstance as ee}from"../runtimeInstance.mjs";import{registerRuntimeLayoutHosts as
|
|
1
|
+
import{getMiniProgramRuntimeGlobalObject as e}from"../../platform.mjs";import{callHookList as t}from"../../hooks/base.mjs";import{resolveRuntimePageLayoutName as n,syncRuntimePageLayoutState as r}from"../../pageLayout.mjs";import{getOwnerProxy as i}from"../../scopedSlots.mjs";import{clearTemplateRefs as a,scheduleTemplateRefUpdate as o}from"../../templateRefs.mjs";import{enableDeferredSetData as s,mountRuntimeInstance as c,refreshRuntimeInstance as l,setRuntimeSetDataVisibility as u,teardownRuntimeInstance as ee}from"../runtimeInstance.mjs";import{ensureInitialNavigation as d,getInitialNavigationPromise as te}from"./lifecycle.mjs";import{registerRuntimeLayoutHosts as ne,unregisterRuntimeLayoutHosts as f}from"../../layoutBridge.mjs";import{registerNativeComponentDefinition as p}from"./registerNativeDefinition.mjs";import{WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY as re,WEVU_LAYOUT_HOST_BRIDGE_KEY as m,WEVU_PAGE_LAYOUT_NAME_KEY as h,WEVU_PAGE_LAYOUT_PROPS_KEY as ie,WEVU_PAGE_LAYOUT_SETTER_KEY as g,WEVU_PUBLIC_RUNTIME_KEY as _,WEVU_READY_CALLED_KEY as v,WEVU_RESOLVE_PUBLIC_INSTANCE_METHOD as y,WEVU_RUNTIME_KEY as ae,WEVU_RUNTIME_OWNER_ID_KEY as oe,WEVU_SLOT_OWNER_ID_KEY as b,WEVU_TEMPLATE_REFS_KEY as x}from"@weapp-core/constants";function S(e){let t=e.selectOwnerComponent;if(typeof t==`function`)try{let n=t.call(e);n&&n!==e&&o(n)}catch(e){}}function C(C){var w;let{runtimeApp:T,watch:E,setup:D,restOptions:se,pageLifecycleHooks:O,finalObservers:k,userLifetimes:A,userPageLifetimes:j,finalMethods:M,finalOptions:N,applyExtraInstanceFields:P,templateRefs:F,layoutHosts:I,attachWevuPropKeys:L,setupLifecycle:R,syncWevuPropsFromInstance:z,directPropsDerivedKeys:B,isPage:V,vueLifecycles:H,getRuntimeOwnerLabel:U,registerNative:W=!0}=C,G=e=>{var t;let n=(t=e.__wevu)==null?e[_]:t;if(n)return n;let r=e.$state;if(r&&typeof r==`object`)return r[ae]},ce=e=>{var t,n,r,i,a;return(t=(n=(r=e[oe])==null?e[b]:r)==null?(i=e.data)==null?void 0:i[b]:n)==null?(a=e.properties)==null?void 0:a[b]:t},le=e=>{var t;let n=(t=G(e))==null?void 0:t.proxy;if(n)return n;let r=ce(e);if(typeof r==`string`&&r){var a;return(a=i(r))==null?e:a}return e},K=e=>{let t=G(e);return t?{runtime:t,mounted:!1}:(P(e),L(e),c(e,T,E,D,{deferSetData:!0,snapshotOmitKeys:B}),z(e),s(e),{runtime:G(e),mounted:!0})},q=(e,t,n)=>{let r=H[t];if(typeof r==`function`)return r.apply(le(e),n)},J=(e,t)=>{if(!V){t();return}let n=d(e,void 0,{start:!1});if(!n){t();return}n.then(e=>{e&&t()},()=>{})},ue=e=>{G(e)||typeof H.mounted!=`function`||K(e).mounted&&(q(e,`created`,[]),q(e,`beforeMount`,[]))},Y={},X=e=>{if(!Array.isArray(I)||!I.length||e[m])return;let t=ne(I,e);t&&(e[m]=t)},Z=e=>{V&&(e[g]=(t,i)=>{var a;let o=(a=e.__wevu)==null?void 0:a.state;if(!o||typeof o!=`object`)return;o[h]=n(t);let s=t===!1||i==null?{}:i;o[ie]=s,r(e,t,s)})};if(V)for(let e of[`onPullDownRefresh`,`onReachBottom`,`onShareAppMessage`,`onShareTimeline`,`onAddToFavorites`]){let t=O[e];typeof t==`function`&&typeof M[e]!=`function`&&(Y[e]=function(...e){return t.apply(this,e)})}let Q={...se,...V?O:{},observers:k,lifetimes:{...A,created:function(...e){P(this),Array.isArray(F)&&F.length&&Object.defineProperty(this,x,{value:F,configurable:!0,enumerable:!1,writable:!1}),L(this),J(this,()=>{if(q(this,`beforeCreate`,e),R===`created`){try{c(this,T,E,D,{deferSetData:!0,snapshotOmitKeys:B})}catch(e){let t=U(this);throw Error(`[wevu] mount runtime failed in created (${t}): ${e instanceof Error?e.message:String(e)}`)}z(this),Z(this)}typeof A.created==`function`&&A.created.apply(this,e)})},moved:function(...e){t(this,`onMoved`,e),typeof A.moved==`function`&&A.moved.apply(this,e)},attached:function(...e){P(this),Array.isArray(F)&&F.length&&!this[x]&&Object.defineProperty(this,x,{value:F,configurable:!0,enumerable:!1,writable:!1}),L(this),J(this,()=>{if(R!==`created`||!this.__wevu)try{c(this,T,E,D,{deferSetData:!0,snapshotOmitKeys:B})}catch(e){let t=U(this);throw Error(`[wevu] mount runtime failed in attached (${t}): ${e instanceof Error?e.message:String(e)}`)}z(this),q(this,`created`,e),q(this,`beforeMount`,e),Z(this),X(this),s(this),t(this,`onAttached`,e),typeof A.attached==`function`&&A.attached.apply(this,e)})},ready:function(...e){if(V&&!this[v]){let t=d(this,void 0,{start:!0});if(t&&!this.__wevuInitialNavigationReady){t.then(t=>{t&&(this.__wevuInitialNavigationReady=!0,Q.lifetimes.ready.call(this,...e))},()=>{});return}}if(ue(this),V&&typeof O.onReady==`function`){let t=!!this[v];if(O.onReady.call(this,...e),!t){let t=()=>q(this,`mounted`,e),n=te(this);n?n.then(e=>{e&&t()},()=>{}):t()}typeof A.ready==`function`&&A.ready.apply(this,e);return}if(!this[v]){this[v]=!0,z(this),S(this),o(this,()=>{t(this,`onReady`,e),q(this,`mounted`,e),typeof A.ready==`function`&&A.ready.apply(this,e)});return}typeof A.ready==`function`&&A.ready.apply(this,e)},detached:function(...e){if(q(this,`beforeUnmount`,e),q(this,`beforeDestroy`,e),S(this),t(this,`onDetached`,e),V&&typeof O.onUnload==`function`){O.onUnload.call(this,...e),typeof A.detached==`function`&&A.detached.apply(this,e),q(this,`unmounted`,e),q(this,`destroyed`,e);return}a(this),Array.isArray(I)&&I.length&&this[m]&&(f(I,this[m]),delete this[m]),ee(this),q(this,`unmounted`,e),q(this,`destroyed`,e),typeof A.detached==`function`&&A.detached.apply(this,e)},error:function(...e){t(this,`onError`,e),typeof A.error==`function`&&A.error.apply(this,e)}},pageLifetimes:{...j,show:function(...e){if(V&&typeof O.onShow==`function`){O.onShow.call(this,...e),typeof j.show==`function`&&j.show.apply(this,e);return}u(this,!0),t(this,`onShow`,e),typeof j.show==`function`&&j.show.apply(this,e)},hide:function(...e){if(V&&typeof O.onHide==`function`){O.onHide.call(this,...e),typeof j.hide==`function`&&j.hide.apply(this,e);return}u(this,!1),t(this,`onHide`,e),typeof j.hide==`function`&&j.hide.apply(this,e)},resize:function(...e){if(V&&typeof O.onResize==`function`){O.onResize.call(this,...e),typeof j.resize==`function`&&j.resize.apply(this,e);return}t(this,`onResize`,e),typeof j.resize==`function`&&j.resize.apply(this,e)},routeDone:function(...e){if(V&&typeof O.onRouteDone==`function`){O.onRouteDone.call(this,...e),typeof j.routeDone==`function`&&j.routeDone.apply(this,e);return}t(this,`onRouteDone`,e),typeof j.routeDone==`function`&&j.routeDone.apply(this,e)}},methods:{...Y,...M,[y]:function(){var e;let t=K(this);return t.mounted&&(q(this,`created`,[]),q(this,`beforeMount`,[])),(e=t.runtime)==null?void 0:e.proxy}},options:N};if(!W)return Q;let $=(w=e())==null?void 0:w[re];if(typeof($==null?void 0:$.trackWevuComponent)==`function`){let e=$.trackWevuComponent(Q,(e,t)=>{l(e,T,E,D,{snapshotOmitKeys:B,stateSnapshot:t}),z(e),Z(e),X(e),s(e,{rehydrateSetupState:!0})});return $.isApplying()||p(e,V),e}return p(Q,V),Q}export{C as registerComponentDefinition};
|