wevu 6.20.4 → 6.21.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.
Files changed (48) hide show
  1. package/dist/dev/_virtual/{_@oxc-project_runtime@0.144.0 → _@oxc-project_runtime@0.146.0}/helpers/esm/defineProperty.mjs +1 -1
  2. package/dist/dev/_virtual/{_@oxc-project_runtime@0.144.0 → _@oxc-project_runtime@0.146.0}/helpers/esm/toPrimitive.mjs +1 -1
  3. package/dist/dev/_virtual/{_@oxc-project_runtime@0.144.0 → _@oxc-project_runtime@0.146.0}/helpers/esm/toPropertyKey.mjs +1 -1
  4. package/dist/dev/_virtual/{_@oxc-project_runtime@0.144.0 → _@oxc-project_runtime@0.146.0}/helpers/esm/typeof.mjs +1 -1
  5. package/dist/dev/internal-runtime.mjs +3 -3
  6. package/dist/dev/package.mjs +1 -1
  7. package/dist/dev/reactivity/core.mjs +1 -1
  8. package/dist/dev/reactivity/ref.mjs +1 -1
  9. package/dist/dev/runtime/app/context.mjs +4 -0
  10. package/dist/dev/runtime/app/context.mjs.map +1 -1
  11. package/dist/dev/runtime/app.mjs +1 -1
  12. package/dist/dev/runtime/app.mjs.map +1 -1
  13. package/dist/dev/runtime/define/componentDefinition.mjs +25 -0
  14. package/dist/dev/runtime/define/componentDefinition.mjs.map +1 -0
  15. package/dist/dev/runtime/define/scopedSlotOptions.mjs +40 -1
  16. package/dist/dev/runtime/define/scopedSlotOptions.mjs.map +1 -1
  17. package/dist/dev/runtime/define.mjs +52 -24
  18. package/dist/dev/runtime/define.mjs.map +1 -1
  19. package/dist/dev/runtime/provideContext.mjs +2 -2
  20. package/dist/dev/runtime/provideContext.mjs.map +1 -1
  21. package/dist/dev/runtime/register/component/registerDefinition.mjs +6 -2
  22. package/dist/dev/runtime/register/component/registerDefinition.mjs.map +1 -1
  23. package/dist/dev/runtime/register/component.mjs +4 -3
  24. package/dist/dev/runtime/register/component.mjs.map +1 -1
  25. package/dist/index.d.mts +1 -1
  26. package/dist/internal-runtime.d.mts +3 -3
  27. package/dist/internal-runtime.mjs +1 -1
  28. package/dist/package.mjs +1 -1
  29. package/dist/reactivity/core.mjs +1 -1
  30. package/dist/reactivity/ref.mjs +1 -1
  31. package/dist/runtime/app/context.mjs +1 -1
  32. package/dist/runtime/app.mjs +1 -1
  33. package/dist/runtime/defaults.d.mts +2 -1
  34. package/dist/runtime/define/componentDefinition.mjs +1 -0
  35. package/dist/runtime/define/scopedSlotOptions.mjs +1 -1
  36. package/dist/runtime/define.d.mts +22 -1
  37. package/dist/runtime/define.mjs +1 -1
  38. package/dist/runtime/index.d.mts +1 -1
  39. package/dist/runtime/provideContext.mjs +1 -1
  40. package/dist/runtime/register/component/registerDefinition.mjs +1 -1
  41. package/dist/runtime/register/component.d.mts +3 -1
  42. package/dist/runtime/register/component.mjs +1 -1
  43. package/dist/vue-demi.d.mts +1 -1
  44. package/package.json +4 -4
  45. /package/dist/_virtual/{_@oxc-project_runtime@0.144.0 → _@oxc-project_runtime@0.146.0}/helpers/esm/defineProperty.mjs +0 -0
  46. /package/dist/_virtual/{_@oxc-project_runtime@0.144.0 → _@oxc-project_runtime@0.146.0}/helpers/esm/toPrimitive.mjs +0 -0
  47. /package/dist/_virtual/{_@oxc-project_runtime@0.144.0 → _@oxc-project_runtime@0.146.0}/helpers/esm/toPropertyKey.mjs +0 -0
  48. /package/dist/_virtual/{_@oxc-project_runtime@0.144.0 → _@oxc-project_runtime@0.146.0}/helpers/esm/typeof.mjs +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"define.mjs","names":[],"sources":["../../../src/runtime/define.ts"],"sourcesContent":["import type { InlineExpressionMap } from './register/inline'\nimport type { TemplateRefBinding } from './templateRefs'\nimport type {\n ComponentPropsOptions,\n ComponentPublicInstance,\n ComputedDefinitions,\n DefineComponent,\n DefineComponentOptions,\n InferProps,\n MethodDefinitions,\n MiniProgramComponentPropertyOption,\n MiniProgramComponentRawOptions,\n ShallowUnwrapRef,\n} from './types'\nimport {\n WEVU_FUNCTION_PROP_PATHS_KEY,\n WEVU_SCOPED_SLOT_CREATOR_KEY,\n WEVU_SLOT_OWNER_ID_KEY,\n WEVU_SLOT_OWNER_ID_PROP,\n WEVU_SLOT_SCOPE_KEY,\n} from '@weapp-core/constants'\nimport { hasOwn } from '../utils'\nimport { createApp } from './app'\nimport { applyWevuComponentDefaults, INTERNAL_DEFAULTS_SCOPE_KEY } from './defaults'\nimport { resolveNativeInitialData } from './define/initialComputed'\nimport { resolveVueComponentOptions } from './define/options'\nimport { applyOptionsApiProvide, resolveOptionsApiInjections } from './define/optionsApi'\nimport { normalizeProps } from './define/props'\nimport { createScopedSlotOptions } from './define/scopedSlotOptions'\nimport { applySetupResult } from './define/setupResult'\nimport { getScopedSlotHostGlobalObject } from './platform'\nimport { registerComponent, runSetupFunction } from './register'\nimport { allocateOwnerId } from './scopedSlots'\n\nlet scopedSlotCreator: (() => void) | undefined\n\nfunction ensureScopedSlotComponentGlobal() {\n const globalObject = getScopedSlotHostGlobalObject()\n if (!globalObject) {\n return\n }\n const globalRecord = globalObject as Record<string, any>\n if (scopedSlotCreator && globalRecord[WEVU_SCOPED_SLOT_CREATOR_KEY] !== scopedSlotCreator) {\n globalRecord[WEVU_SCOPED_SLOT_CREATOR_KEY] = scopedSlotCreator\n }\n}\n\nfunction resolveInitialDataContext(properties: unknown, methods: MethodDefinitions | undefined) {\n const context: Record<string, unknown> = { ...(methods ?? {}) }\n if (!properties || typeof properties !== 'object') {\n return context\n }\n for (const [name, definition] of Object.entries(properties)) {\n if (definition && typeof definition === 'object' && hasOwn(definition, 'value')) {\n context[name] = (definition as Record<string, unknown>).value\n }\n }\n return context\n}\n\nfunction shouldSeedNativeSlotOwnerId(\n mpOptions: Record<string, any>,\n setData: DefineComponentOptions<any, any, any, any, any>['setData'],\n) {\n return Boolean((mpOptions as any).__wevu_isPage)\n && Array.isArray(setData?.pick)\n && setData.pick.includes(WEVU_SLOT_OWNER_ID_KEY)\n}\n\nfunction shouldDeclareNativeSlotOwnerId(\n setData: DefineComponentOptions<any, any, any, any, any>['setData'],\n) {\n return Array.isArray(setData?.pick)\n && setData.pick.includes(WEVU_SLOT_OWNER_ID_KEY)\n}\n\nfunction hasScopedSlotHostProperties(mpOptions: Record<string, any>) {\n const properties = mpOptions.properties\n return Boolean(\n properties\n && typeof properties === 'object'\n && (\n WEVU_SLOT_OWNER_ID_PROP in properties\n || WEVU_SLOT_SCOPE_KEY in properties\n ),\n )\n}\n\nfunction resolveScopedSlotHostSetData(\n mpOptions: Record<string, any>,\n setData: DefineComponentOptions<any, any, any, any, any>['setData'],\n) {\n if (setData?.strategy !== 'patch' || !hasScopedSlotHostProperties(mpOptions)) {\n return setData\n }\n return {\n ...setData,\n strategy: 'diff' as const,\n }\n}\n\n/**\n * defineComponent 返回的组件定义描述,用于手动注册或高级用法。\n */\nexport interface ComponentDefinition<\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> {\n /**\n * 内部 runtime app(高级能力使用),不对外暴露正式 API。\n * @internal\n */\n __wevu_runtime: import('./types').RuntimeApp<D, C, M>\n\n /**\n * 内部选项快照(高级能力使用),包含 data/computed/methods 等。\n * @internal\n */\n __wevu_options: {\n data: () => D\n computed: C\n methods: M\n setData: import('./types').SetDataSnapshotOptions | undefined\n watch: Record<string, any> | undefined\n setup: ((props: any, ctx: any) => any) | undefined\n mpOptions: MiniProgramComponentRawOptions\n }\n}\n\ntype SetupBindings<S> = Exclude<S, void> extends never ? Record<string, never> : Exclude<S, void>\ntype ResolveProps<P> = P extends ComponentPropsOptions ? InferProps<P> : P\n\nexport interface WevuComponentConstructor<\n Props,\n RawBindings,\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> {\n new (): ComponentPublicInstance<D, C, M, Props> & ShallowUnwrapRef<RawBindings>\n}\n\nexport type WevuDefinedComponent<\n PropsOrPropOptions,\n RawBindings,\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> = DefineComponent<PropsOrPropOptions, RawBindings, D, C, M> & ComponentDefinition<D, C, M>\nexport interface SetupContextWithTypeProps<TypeProps> {\n props: TypeProps\n [key: string]: any\n}\nexport type SetupFunctionWithTypeProps<\n TypeProps,\n> = (\n props: TypeProps,\n ctx: SetupContextWithTypeProps<TypeProps>,\n) => Record<string, any> | void\nexport interface DefineComponentTypePropsOptions<TypeProps> {\n __typeProps: TypeProps\n setup?: SetupFunctionWithTypeProps<TypeProps>\n [key: string]: any\n}\nexport interface DefineComponentWithTypeProps<TypeProps> {\n new (): { $props: TypeProps } & Record<string, any>\n}\n\n/**\n * 按 Vue 3 风格定义一个小程序组件/页面。\n *\n * - 统一注册为 `Component()`\n *\n * @param options 组件定义项\n * @returns 可手动注册的组件定义\n *\n * @example\n * ```ts\n * defineComponent({\n * data: () => ({ count: 0 }),\n * setup() {\n * onMounted(() => console.log('已挂载'))\n * }\n * })\n * ```\n *\n * @example\n * ```ts\n * defineComponent({\n * setup() {\n * onPageScroll(() => {})\n * }\n * })\n * ```\n */\n// @ts-expect-error -- TS2589:__typeProps 签名的重载实例化深度过高。\nexport function defineComponent<\n TypeProps = any,\n>(\n options: DefineComponentTypePropsOptions<TypeProps>,\n): DefineComponentWithTypeProps<TypeProps>\nexport function defineComponent<\n P extends ComponentPropsOptions = ComponentPropsOptions,\n D extends object = Record<string, any>,\n C extends ComputedDefinitions = ComputedDefinitions,\n M extends MethodDefinitions = MethodDefinitions,\n S extends Record<string, any> | void = Record<string, any> | void,\n>(\n options: DefineComponentOptions<P, D, C, M, S>,\n): WevuComponentConstructor<ResolveProps<P>, SetupBindings<S>, D, C, M> & ComponentDefinition<D, C, M>\nexport function defineComponent(\n options: DefineComponentOptions<any, any, any, any, any>,\n): WevuComponentConstructor<Record<string, any>, Record<string, any>, Record<string, any>, ComputedDefinitions, MethodDefinitions>\n & ComponentDefinition<any, any, any> {\n ensureScopedSlotComponentGlobal()\n const resolvedOptions = resolveVueComponentOptions(applyWevuComponentDefaults(options))\n const {\n __typeProps: _typeProps,\n data,\n computed,\n methods,\n setData,\n watch,\n setup,\n props,\n inject: injectOptions,\n provide: provideOptions,\n allowFunctionProps,\n ...mpOptions\n } = resolvedOptions\n\n const rawFunctionPropPaths = (mpOptions as any)[WEVU_FUNCTION_PROP_PATHS_KEY]\n const functionPropPaths: string[] = Array.isArray(rawFunctionPropPaths)\n ? [...new Set(rawFunctionPropPaths.filter((path: unknown): path is string => typeof path === 'string' && path.length > 0))]\n : []\n delete (mpOptions as any)[WEVU_FUNCTION_PROP_PATHS_KEY]\n\n const rawResolvedSetData = allowFunctionProps === true\n ? {\n ...(setData ?? {}),\n includeFunctions: true,\n functionPaths: functionPropPaths,\n }\n : allowFunctionProps === false\n ? setData\n : functionPropPaths.length\n ? {\n ...(setData ?? {}),\n functionPaths: functionPropPaths,\n }\n : setData\n const resolvedSetData = resolveScopedSlotHostSetData(mpOptions, rawResolvedSetData)\n const setupFunctionPropKeys = new Set(\n functionPropPaths\n .filter(path => !path.includes('.')),\n )\n\n const normalizedMpOptions = normalizeProps(mpOptions, props)\n const initialDataContext = resolveInitialDataContext(normalizedMpOptions.properties, methods)\n const resolvedData = typeof data === 'function'\n ? () => data.call(initialDataContext)\n : data\n\n const runtimeApp = createApp({\n data: resolvedData,\n computed,\n methods,\n setData: resolvedSetData,\n [INTERNAL_DEFAULTS_SCOPE_KEY]: 'component',\n } as any)\n\n const hasOptionsApiContext = injectOptions != null || provideOptions != null\n const setupWrapper = typeof setup === 'function' || hasOptionsApiContext\n ? ((props, ctx) => {\n const publicInstance = (ctx as any)?.proxy ?? (ctx as any)?.instance ?? Object.create(null)\n const injected = resolveOptionsApiInjections(injectOptions, publicInstance)\n if (provideOptions != null) {\n applyOptionsApiProvide(provideOptions, publicInstance)\n }\n const setupResult = typeof setup === 'function'\n ? runSetupFunction(setup as any, props as Record<string, any>, ctx as any) as Record<string, any> | void\n : undefined\n const result = {\n ...injected,\n ...(setupResult ?? {}),\n }\n if (ctx && Object.keys(result).length) {\n applySetupResult((ctx as any).runtime, (ctx as any).instance, result, {\n includeFunctionsInState: allowFunctionProps === true,\n functionPropPaths: allowFunctionProps === false ? undefined : setupFunctionPropKeys,\n })\n }\n return result\n }) satisfies DefineComponentOptions<ComponentPropsOptions, any, any, any, any>['setup']\n : undefined\n\n const nativeData = typeof resolvedData === 'function'\n ? resolvedData()\n : resolvedData\n const shouldDeclareOwnerId = shouldDeclareNativeSlotOwnerId(resolvedSetData)\n const seededNativeData = shouldDeclareOwnerId\n ? {\n ...(nativeData && typeof nativeData === 'object' ? nativeData : {}),\n [WEVU_SLOT_OWNER_ID_KEY]: shouldSeedNativeSlotOwnerId(mpOptions, resolvedSetData)\n ? (nativeData as any)?.[WEVU_SLOT_OWNER_ID_KEY] || allocateOwnerId()\n : (nativeData as any)?.[WEVU_SLOT_OWNER_ID_KEY] || '',\n }\n : nativeData\n const nativeInitialData = resolveNativeInitialData(seededNativeData, computed as ComputedDefinitions, resolvedSetData, methods as Record<string, any> | undefined)\n const mpOptionsWithProps = nativeInitialData !== undefined\n ? {\n ...normalizedMpOptions,\n data: nativeInitialData,\n }\n : normalizedMpOptions\n\n const componentOptions = {\n data: resolvedData as () => Record<string, any>,\n computed: computed as ComputedDefinitions,\n methods: methods as MethodDefinitions,\n setData: resolvedSetData,\n watch,\n setup: setupWrapper,\n mpOptions: mpOptionsWithProps,\n }\n\n registerComponent(runtimeApp as any, methods ?? {}, watch as any, setupWrapper as any, mpOptionsWithProps as any)\n\n // 返回组件定义,便于外部自行注册\n const definition: ComponentDefinition<any, any, any> = {\n __wevu_runtime: runtimeApp as any,\n __wevu_options: componentOptions as ComponentDefinition<any, any, any>['__wevu_options'],\n }\n\n return definition as unknown as WevuComponentConstructor<\n ResolveProps<ComponentPropsOptions>,\n Record<string, any>,\n Record<string, any>,\n ComputedDefinitions,\n MethodDefinitions\n > & ComponentDefinition<any, any, any>\n}\n\n/**\n * 从 Vue SFC 选项创建 wevu 组件,供 weapp-vite 编译产物直接调用的兼容入口。\n *\n * @param options 组件选项,可能包含小程序特有的 properties\n * @internal\n */\nexport function createWevuComponent<\n P extends ComponentPropsOptions = ComponentPropsOptions,\n D extends object = Record<string, any>,\n C extends ComputedDefinitions = ComputedDefinitions,\n M extends MethodDefinitions = MethodDefinitions,\n>(\n options: DefineComponentOptions<P, D, C, M> & { properties?: MiniProgramComponentPropertyOption },\n): void {\n ensureScopedSlotComponentGlobal()\n const {\n properties,\n props,\n ...restOptions\n } = options\n\n const baseOptions = {\n ...restOptions,\n allowNullPropInput: (restOptions as any).allowNullPropInput ?? true,\n __wevu_allowNullPropInput: true,\n }\n\n // 将 properties 合并到 mpOptions,保持小程序属性定义\n const finalOptions = normalizeProps(baseOptions, props, properties)\n\n defineComponent(finalOptions)\n}\n\n/**\n * scoped slot 兼容组件入口(编译产物内部使用)。\n * @internal\n */\nexport function createWevuScopedSlotComponent(\n overrides?: {\n computed?: ComputedDefinitions\n inlineMap?: InlineExpressionMap\n templateRefs?: TemplateRefBinding[]\n },\n): void {\n const baseOptions = createScopedSlotOptions(overrides)\n createWevuComponent(baseOptions as any)\n}\n\nscopedSlotCreator = createWevuScopedSlotComponent\nensureScopedSlotComponentGlobal()\n"],"mappings":";;;;;;;;;;;;;;;;AAkCA,IAAI;AAEJ,SAAS,kCAAkC;CACzC,MAAM,eAAe,8BAA8B;CACnD,IAAI,CAAC,cACH;CAEF,MAAM,eAAe;CACrB,IAAI,qBAAqB,aAAa,kCAAkC,mBACtE,aAAa,gCAAgC;AAEjD;AAEA,SAAS,0BAA0B,YAAqB,SAAwC;CAC9F,MAAM,UAAmC,EAAE,GAAI,mDAAW,CAAC,EAAG;CAC9D,IAAI,CAAC,cAAc,OAAO,eAAe,UACvC,OAAO;CAET,KAAK,MAAM,CAAC,MAAM,eAAe,OAAO,QAAQ,UAAU,GACxD,IAAI,cAAc,OAAO,eAAe,YAAY,OAAO,YAAY,OAAO,GAC5E,QAAQ,QAAS,WAAuC;CAG5D,OAAO;AACT;AAEA,SAAS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CAQhH,OAAO;EAJL,gBAAgB;EAChB,gBAAgB;CAGF;AAOlB;;;;;;;AAQA,SAAgB,oBAMd,SACM;;CACN,gCAAgC;CAChC,MAAM,EACJ,YACA,OACA,GAAG,gBACD;CAEJ,MAAM,cAAc;EAClB,GAAG;EACH,2CAAqB,YAAoB,uFAAsB;EAC/D,2BAA2B;CAC7B;CAKA,gBAFqB,eAAe,aAAa,OAAO,UAE7B,CAAC;AAC9B;;;;;AAMA,SAAgB,8BACd,WAKM;CAEN,oBADoB,wBAAwB,SACd,CAAQ;AACxC;AAEA,oBAAoB;AACpB,gCAAgC"}
1
+ {"version":3,"file":"define.mjs","names":[],"sources":["../../../src/runtime/define.ts"],"sourcesContent":["import type { RuntimeComponentDefinitionOptions } from './define/componentDefinition'\nimport type { InlineExpressionMap } from './register/inline'\nimport type { TemplateRefBinding } from './templateRefs'\nimport type {\n ComponentPropsOptions,\n ComponentPublicInstance,\n ComputedDefinitions,\n DefineComponent,\n DefineComponentOptions,\n InferProps,\n MethodDefinitions,\n MiniProgramComponentPropertyOption,\n MiniProgramComponentRawOptions,\n ShallowUnwrapRef,\n} from './types'\nimport {\n WEVU_FUNCTION_PROP_PATHS_KEY,\n WEVU_SCOPED_SLOT_CREATOR_KEY,\n WEVU_SLOT_OWNER_ID_KEY,\n WEVU_SLOT_OWNER_ID_PROP,\n WEVU_SLOT_SCOPE_KEY,\n} from '@weapp-core/constants'\nimport { hasOwn } from '../utils'\nimport { applyWevuComponentDefaults } from './defaults'\nimport {\n createRuntimeComponentDefinition,\n} from './define/componentDefinition'\nimport { resolveNativeInitialData } from './define/initialComputed'\nimport { resolveVueComponentOptions } from './define/options'\nimport { applyOptionsApiProvide, resolveOptionsApiInjections } from './define/optionsApi'\nimport { normalizeProps } from './define/props'\nimport { createScopedSlotOptions } from './define/scopedSlotOptions'\nimport { applySetupResult } from './define/setupResult'\nimport { getScopedSlotHostGlobalObject } from './platform'\nimport { runSetupFunction } from './register'\nimport { allocateOwnerId } from './scopedSlots'\n\nlet scopedSlotCreator: (() => void) | undefined\nconst componentLifecycleDefinitions = new WeakMap<object, Record<string, any>>()\n\nfunction ensureScopedSlotComponentGlobal() {\n const globalObject = getScopedSlotHostGlobalObject()\n if (!globalObject) {\n return\n }\n const globalRecord = globalObject as Record<string, any>\n if (scopedSlotCreator && globalRecord[WEVU_SCOPED_SLOT_CREATOR_KEY] !== scopedSlotCreator) {\n globalRecord[WEVU_SCOPED_SLOT_CREATOR_KEY] = scopedSlotCreator\n }\n}\n\nfunction resolveInitialDataContext(properties: unknown, methods: MethodDefinitions | undefined) {\n const context: Record<string, unknown> = { ...(methods ?? {}) }\n if (!properties || typeof properties !== 'object') {\n return context\n }\n for (const [name, definition] of Object.entries(properties)) {\n if (definition && typeof definition === 'object' && hasOwn(definition, 'value')) {\n context[name] = (definition as Record<string, unknown>).value\n }\n }\n return context\n}\n\nfunction shouldSeedNativeSlotOwnerId(\n mpOptions: Record<string, any>,\n setData: DefineComponentOptions<any, any, any, any, any>['setData'],\n) {\n return Boolean((mpOptions as any).__wevu_isPage)\n && Array.isArray(setData?.pick)\n && setData.pick.includes(WEVU_SLOT_OWNER_ID_KEY)\n}\n\nfunction shouldDeclareNativeSlotOwnerId(\n setData: DefineComponentOptions<any, any, any, any, any>['setData'],\n) {\n return Array.isArray(setData?.pick)\n && setData.pick.includes(WEVU_SLOT_OWNER_ID_KEY)\n}\n\nfunction hasScopedSlotHostProperties(mpOptions: Record<string, any>) {\n const properties = mpOptions.properties\n return Boolean(\n properties\n && typeof properties === 'object'\n && (\n WEVU_SLOT_OWNER_ID_PROP in properties\n || WEVU_SLOT_SCOPE_KEY in properties\n ),\n )\n}\n\nfunction resolveScopedSlotHostSetData(\n mpOptions: Record<string, any>,\n setData: DefineComponentOptions<any, any, any, any, any>['setData'],\n) {\n if (setData?.strategy !== 'patch' || !hasScopedSlotHostProperties(mpOptions)) {\n return setData\n }\n return {\n ...setData,\n strategy: 'diff' as const,\n }\n}\n\n/**\n * defineComponent 返回的组件定义描述,用于手动注册或高级用法。\n */\nexport interface ComponentDefinition<\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> {\n /**\n * 内部 runtime app(高级能力使用),不对外暴露正式 API。\n * @internal\n */\n __wevu_runtime: import('./types').RuntimeApp<D, C, M>\n\n /**\n * 内部选项快照(高级能力使用),包含 data/computed/methods 等。\n * @internal\n */\n __wevu_options: {\n data: () => D\n computed: C\n methods: M\n setData: import('./types').SetDataSnapshotOptions | undefined\n watch: Record<string, any> | undefined\n setup: ((props: any, ctx: any) => any) | undefined\n mpOptions: MiniProgramComponentRawOptions\n }\n}\n\nfunction materializeComponentDefinition(\n componentOptions: RuntimeComponentDefinitionOptions,\n registerNative = false,\n) {\n const { lifecycleDefinition, runtimeApp } = createRuntimeComponentDefinition(componentOptions, registerNative)\n const definition: ComponentDefinition<any, any, any> = {\n __wevu_runtime: runtimeApp as any,\n __wevu_options: componentOptions as ComponentDefinition<any, any, any>['__wevu_options'],\n }\n componentLifecycleDefinitions.set(definition, lifecycleDefinition)\n return definition\n}\n\ntype SetupBindings<S> = Exclude<S, void> extends never ? Record<string, never> : Exclude<S, void>\ntype ResolveProps<P> = P extends ComponentPropsOptions ? InferProps<P> : P\n\nexport interface WevuComponentConstructor<\n Props,\n RawBindings,\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> {\n new (): ComponentPublicInstance<D, C, M, Props> & ShallowUnwrapRef<RawBindings>\n}\n\nexport type WevuDefinedComponent<\n PropsOrPropOptions,\n RawBindings,\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> = DefineComponent<PropsOrPropOptions, RawBindings, D, C, M> & ComponentDefinition<D, C, M>\nexport interface SetupContextWithTypeProps<TypeProps> {\n props: TypeProps\n [key: string]: any\n}\nexport type SetupFunctionWithTypeProps<\n TypeProps,\n> = (\n props: TypeProps,\n ctx: SetupContextWithTypeProps<TypeProps>,\n) => Record<string, any> | void\nexport interface DefineComponentTypePropsOptions<TypeProps> {\n __typeProps: TypeProps\n setup?: SetupFunctionWithTypeProps<TypeProps>\n [key: string]: any\n}\nexport interface DefineComponentWithTypeProps<TypeProps> {\n new (): { $props: TypeProps } & Record<string, any>\n}\n\n/**\n * 按 Vue 3 风格定义一个小程序组件/页面。\n *\n * - 统一注册为 `Component()`\n *\n * @param options 组件定义项\n * @returns 可手动注册的组件定义\n *\n * @example\n * ```ts\n * defineComponent({\n * data: () => ({ count: 0 }),\n * setup() {\n * onMounted(() => console.log('已挂载'))\n * }\n * })\n * ```\n *\n * @example\n * ```ts\n * defineComponent({\n * setup() {\n * onPageScroll(() => {})\n * }\n * })\n * ```\n */\n// @ts-expect-error -- TS2589:__typeProps 签名的重载实例化深度过高。\nexport function defineComponent<\n TypeProps = any,\n>(\n options: DefineComponentTypePropsOptions<TypeProps>,\n): DefineComponentWithTypeProps<TypeProps>\nexport function defineComponent<\n P extends ComponentPropsOptions = ComponentPropsOptions,\n D extends object = Record<string, any>,\n C extends ComputedDefinitions = ComputedDefinitions,\n M extends MethodDefinitions = MethodDefinitions,\n S extends Record<string, any> | void = Record<string, any> | void,\n>(\n options: DefineComponentOptions<P, D, C, M, S>,\n): WevuComponentConstructor<ResolveProps<P>, SetupBindings<S>, D, C, M> & ComponentDefinition<D, C, M>\nexport function defineComponent(\n options: DefineComponentOptions<any, any, any, any, any>,\n): WevuComponentConstructor<Record<string, any>, Record<string, any>, Record<string, any>, ComputedDefinitions, MethodDefinitions>\n & ComponentDefinition<any, any, any> {\n // eslint-disable-next-line ts/no-use-before-define -- 重载实现需保持在内部共享工厂之前。\n return createComponentDefinition(options, true) as any\n}\n\nfunction createComponentDefinition(\n options: DefineComponentOptions<any, any, any, any, any>,\n registerNative: boolean,\n) {\n if (registerNative) {\n ensureScopedSlotComponentGlobal()\n }\n const resolvedOptions = resolveVueComponentOptions(applyWevuComponentDefaults(options))\n const {\n __typeProps: _typeProps,\n data,\n computed,\n methods,\n setData,\n watch,\n setup,\n props,\n inject: injectOptions,\n provide: provideOptions,\n allowFunctionProps,\n ...mpOptions\n } = resolvedOptions\n\n const rawFunctionPropPaths = (mpOptions as any)[WEVU_FUNCTION_PROP_PATHS_KEY]\n const functionPropPaths: string[] = Array.isArray(rawFunctionPropPaths)\n ? [...new Set(rawFunctionPropPaths.filter((path: unknown): path is string => typeof path === 'string' && path.length > 0))]\n : []\n delete (mpOptions as any)[WEVU_FUNCTION_PROP_PATHS_KEY]\n\n const rawResolvedSetData = allowFunctionProps === true\n ? {\n ...(setData ?? {}),\n includeFunctions: true,\n functionPaths: functionPropPaths,\n }\n : allowFunctionProps === false\n ? setData\n : functionPropPaths.length\n ? {\n ...(setData ?? {}),\n functionPaths: functionPropPaths,\n }\n : setData\n const resolvedSetData = resolveScopedSlotHostSetData(mpOptions, rawResolvedSetData)\n const setupFunctionPropKeys = new Set(\n functionPropPaths\n .filter(path => !path.includes('.')),\n )\n\n const normalizedMpOptions = normalizeProps(mpOptions, props)\n const initialDataContext = resolveInitialDataContext(normalizedMpOptions.properties, methods)\n const resolvedData = typeof data === 'function'\n ? () => data.call(initialDataContext)\n : data\n\n const hasOptionsApiContext = injectOptions != null || provideOptions != null\n const setupWrapper = typeof setup === 'function' || hasOptionsApiContext\n ? ((props, ctx) => {\n const publicInstance = (ctx as any)?.proxy ?? (ctx as any)?.instance ?? Object.create(null)\n const injected = resolveOptionsApiInjections(injectOptions, publicInstance)\n if (provideOptions != null) {\n applyOptionsApiProvide(provideOptions, publicInstance)\n }\n const setupResult = typeof setup === 'function'\n ? runSetupFunction(setup as any, props as Record<string, any>, ctx as any) as Record<string, any> | void\n : undefined\n const result = {\n ...injected,\n ...(setupResult ?? {}),\n }\n if (ctx && Object.keys(result).length) {\n applySetupResult((ctx as any).runtime, (ctx as any).instance, result, {\n includeFunctionsInState: allowFunctionProps === true,\n functionPropPaths: allowFunctionProps === false ? undefined : setupFunctionPropKeys,\n })\n }\n return result\n }) satisfies DefineComponentOptions<ComponentPropsOptions, any, any, any, any>['setup']\n : undefined\n\n const nativeData = typeof resolvedData === 'function'\n ? resolvedData()\n : resolvedData\n const shouldDeclareOwnerId = shouldDeclareNativeSlotOwnerId(resolvedSetData)\n const seededNativeData = shouldDeclareOwnerId\n ? {\n ...(nativeData && typeof nativeData === 'object' ? nativeData : {}),\n [WEVU_SLOT_OWNER_ID_KEY]: shouldSeedNativeSlotOwnerId(mpOptions, resolvedSetData)\n ? (nativeData as any)?.[WEVU_SLOT_OWNER_ID_KEY] || allocateOwnerId()\n : (nativeData as any)?.[WEVU_SLOT_OWNER_ID_KEY] || '',\n }\n : nativeData\n const nativeInitialData = resolveNativeInitialData(seededNativeData, computed as ComputedDefinitions, resolvedSetData, methods as Record<string, any> | undefined)\n const mpOptionsWithProps = nativeInitialData !== undefined\n ? {\n ...normalizedMpOptions,\n data: nativeInitialData,\n }\n : normalizedMpOptions\n\n const componentOptions: RuntimeComponentDefinitionOptions = {\n data: resolvedData as () => Record<string, any>,\n computed: computed as ComputedDefinitions,\n methods: methods as MethodDefinitions,\n setData: resolvedSetData,\n watch,\n setup: setupWrapper,\n mpOptions: mpOptionsWithProps as MiniProgramComponentRawOptions,\n }\n\n const definition = materializeComponentDefinition(componentOptions, registerNative)\n\n return definition as unknown as WevuComponentConstructor<\n ResolveProps<ComponentPropsOptions>,\n Record<string, any>,\n Record<string, any>,\n ComputedDefinitions,\n MethodDefinitions\n > & ComponentDefinition<any, any, any>\n}\n\n/**\n * 创建不触发宿主全局注册的 Wevu 组件定义。\n *\n * @param options 组件选项\n * @internal\n */\nexport function createWevuComponentDefinition(\n options: DefineComponentOptions<any, any, any, any, any>,\n) {\n return createComponentDefinition(options, false)\n}\n\n/**\n * 从现有组件定义派生拥有独立应用上下文的组件定义。\n *\n * @param definition 已解析的 Wevu 组件定义\n * @internal\n */\nexport function createIsolatedWevuComponentDefinition(definition: object) {\n const componentOptions = (definition as ComponentDefinition<any, any, any>).__wevu_options\n if (!componentOptions) {\n throw new TypeError('无法从非 Wevu 组件定义创建独立运行时')\n }\n return materializeComponentDefinition(componentOptions)\n}\n\n/**\n * 获取组件定义对应的宿主生命周期定义。\n *\n * @param definition Wevu 组件定义\n * @internal\n */\nexport function getWevuComponentLifecycleDefinition(definition: object) {\n return componentLifecycleDefinitions.get(definition)\n}\n\n/**\n * 从 Vue SFC 选项创建 wevu 组件,供 weapp-vite 编译产物直接调用的兼容入口。\n *\n * @param options 组件选项,可能包含小程序特有的 properties\n * @internal\n */\nexport function createWevuComponent<\n P extends ComponentPropsOptions = ComponentPropsOptions,\n D extends object = Record<string, any>,\n C extends ComputedDefinitions = ComputedDefinitions,\n M extends MethodDefinitions = MethodDefinitions,\n>(\n options: DefineComponentOptions<P, D, C, M> & { properties?: MiniProgramComponentPropertyOption },\n): void {\n ensureScopedSlotComponentGlobal()\n const {\n properties,\n props,\n ...restOptions\n } = options\n\n const baseOptions = {\n ...restOptions,\n allowNullPropInput: (restOptions as any).allowNullPropInput ?? true,\n __wevu_allowNullPropInput: true,\n }\n\n // 将 properties 合并到 mpOptions,保持小程序属性定义\n const finalOptions = normalizeProps(baseOptions, props, properties)\n\n defineComponent(finalOptions)\n}\n\n/**\n * scoped slot 兼容组件入口(编译产物内部使用)。\n * @internal\n */\nexport function createWevuScopedSlotComponent(\n overrides?: {\n computed?: ComputedDefinitions\n inlineMap?: InlineExpressionMap\n templateRefs?: TemplateRefBinding[]\n },\n): void {\n const baseOptions = createScopedSlotOptions(overrides)\n createWevuComponent(baseOptions as any)\n}\n\nscopedSlotCreator = createWevuScopedSlotComponent\nensureScopedSlotComponentGlobal()\n"],"mappings":";;;;;;;;;;;;;;;AAqCA,IAAI;AACJ,MAAM,gDAAgC,IAAI,QAAqC;AAE/E,SAAS,kCAAkC;CACzC,MAAM,eAAe,8BAA8B;CACnD,IAAI,CAAC,cACH;CAEF,MAAM,eAAe;CACrB,IAAI,qBAAqB,aAAa,kCAAkC,mBACtE,aAAa,gCAAgC;AAEjD;AAEA,SAAS,0BAA0B,YAAqB,SAAwC;C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,MAAM,mBADuB,+BAA+B,eAChB,IACxC;EACE,GAAI,cAAc,OAAO,eAAe,WAAW,aAAa,CAAC;GAChE,yBAAyB,4BAA4B,WAAW,eAAe,6DAC3E,WAAqB,4BAA2B,gBAAgB,6DAChE,WAAqB,4BAA2B;CACvD,IACA;CACJ,MAAM,oBAAoB,yBAAyB,kBAAkB,UAAiC,iBAAiB,OAA0C;CAoBjK,OAFmB,+BAA+B;EAThD,MAAM;EACI;EACD;EACT,SAAS;EACT;EACA,OAAO;EACP,WAdyB,sBAAsB,SAC7C;GACE,GAAG;GACH,MAAM;EACR,IACA;CAY6D,GAAG,cAEpD;AAOlB;;;;;;;AAQA,SAAgB,8BACd,SACA;CACA,OAAO,0BAA0B,SAAS,KAAK;AACjD;;;;;;;AAQA,SAAgB,sCAAsC,YAAoB;CACxE,MAAM,mBAAoB,WAAkD;CAC5E,IAAI,CAAC,kBACH,MAAM,IAAI,UAAU,uBAAuB;CAE7C,OAAO,+BAA+B,gBAAgB;AACxD;;;;;;;AAQA,SAAgB,oCAAoC,YAAoB;CACtE,OAAO,8BAA8B,IAAI,UAAU;AACrD;;;;;;;AAQA,SAAgB,oBAMd,SACM;;CACN,gCAAgC;CAChC,MAAM,EACJ,YACA,OACA,GAAG,gBACD;CAEJ,MAAM,cAAc;EAClB,GAAG;EACH,2CAAqB,YAAoB,uFAAsB;EAC/D,2BAA2B;CAC7B;CAKA,gBAFqB,eAAe,aAAa,OAAO,UAE7B,CAAC;AAC9B;;;;;AAMA,SAAgB,8BACd,WAKM;CAEN,oBADoB,wBAAwB,SACd,CAAQ;AACxC;AAEA,oBAAoB;AACpB,gCAAgC"}
@@ -50,9 +50,9 @@ function getInstanceProvides(instance) {
50
50
  function ensureRuntimeAppProvides(runtimeApp) {
51
51
  return getRuntimeAppProvides(runtimeApp);
52
52
  }
53
- function setRuntimeAppProvidedValue(runtimeApp, key, value) {
53
+ function setRuntimeAppProvidedValue(runtimeApp, key, value, options = {}) {
54
54
  getRuntimeAppProvides(runtimeApp)[key] = value;
55
- setGlobalProvidedValue(key, value);
55
+ if (options.syncGlobal !== false) setGlobalProvidedValue(key, value);
56
56
  }
57
57
  function attachRuntimeProvideContext(instance, runtimeApp, parentInstance) {
58
58
  var _parentInstance$WEVU_;
@@ -1 +1 @@
1
- {"version":3,"file":"provideContext.mjs","names":[],"sources":["../../../src/runtime/provideContext.ts"],"sourcesContent":["import type { InternalRuntimeState, RuntimeApp } from './types'\nimport {\n WEVU_APP_PROVIDES_KEY,\n WEVU_IS_APP_INSTANCE_KEY,\n WEVU_PARENT_INSTANCE_KEY,\n WEVU_PROVIDES_KEY,\n WEVU_RUNTIME_APP_KEY,\n} from '@weapp-core/constants'\nimport { setGlobalProvidedValue } from './provideStore'\n\nexport function isRuntimeAppInstance(instance: unknown): boolean {\n return Boolean(\n instance\n && typeof instance === 'object'\n && (instance as { [WEVU_IS_APP_INSTANCE_KEY]?: boolean })[WEVU_IS_APP_INSTANCE_KEY] === true,\n )\n}\n\nfunction createProvides(parent?: Record<PropertyKey, any>) {\n return Object.create(parent ?? null) as Record<PropertyKey, any>\n}\n\nfunction getRuntimeAppProvides(runtimeApp: RuntimeApp<any, any, any> | undefined): Record<PropertyKey, any> {\n if (!runtimeApp) {\n return createProvides()\n }\n const existing = runtimeApp[WEVU_APP_PROVIDES_KEY]\n if (existing && typeof existing === 'object') {\n return existing\n }\n const provides = createProvides()\n try {\n Object.defineProperty(runtimeApp, WEVU_APP_PROVIDES_KEY, {\n value: provides,\n configurable: true,\n enumerable: false,\n writable: false,\n })\n }\n catch {\n ;(runtimeApp as any)[WEVU_APP_PROVIDES_KEY] = provides\n }\n return provides\n}\n\nexport function attachInstanceProvides(\n instance: InternalRuntimeState,\n provides: Record<PropertyKey, any>,\n): void {\n try {\n Object.defineProperty(instance, WEVU_PROVIDES_KEY, {\n value: provides,\n configurable: true,\n enumerable: false,\n writable: true,\n })\n }\n catch {\n ;(instance as any)[WEVU_PROVIDES_KEY] = provides\n }\n}\n\nexport function getInstanceProvides(instance: InternalRuntimeState): Record<PropertyKey, any> {\n const existing = instance[WEVU_PROVIDES_KEY]\n if (existing && typeof existing === 'object') {\n return existing\n }\n\n const runtimeApp = instance[WEVU_RUNTIME_APP_KEY]\n const parentProvides = instance[WEVU_PARENT_INSTANCE_KEY]?.[WEVU_PROVIDES_KEY]\n ?? getRuntimeAppProvides(runtimeApp)\n const provides = isRuntimeAppInstance(instance)\n ? getRuntimeAppProvides(runtimeApp)\n : createProvides(parentProvides)\n attachInstanceProvides(instance, provides)\n return provides\n}\n\nexport function ensureRuntimeAppProvides(runtimeApp: RuntimeApp<any, any, any>): Record<PropertyKey, any> {\n return getRuntimeAppProvides(runtimeApp)\n}\n\nexport function setRuntimeAppProvidedValue<T>(runtimeApp: RuntimeApp<any, any, any>, key: any, value: T): void {\n getRuntimeAppProvides(runtimeApp)[key as PropertyKey] = value\n setGlobalProvidedValue(key, value)\n}\n\nexport function attachRuntimeProvideContext(\n instance: InternalRuntimeState,\n runtimeApp: RuntimeApp<any, any, any>,\n parentInstance?: InternalRuntimeState,\n): void {\n const appProvides = getRuntimeAppProvides(runtimeApp)\n const parentProvides = parentInstance?.[WEVU_PROVIDES_KEY] ?? appProvides\n const provides = isRuntimeAppInstance(instance)\n ? appProvides\n : createProvides(parentProvides)\n\n if (parentInstance) {\n try {\n Object.defineProperty(instance, WEVU_PARENT_INSTANCE_KEY, {\n value: parentInstance,\n configurable: true,\n enumerable: false,\n writable: true,\n })\n }\n catch {\n ;(instance as any)[WEVU_PARENT_INSTANCE_KEY] = parentInstance\n }\n }\n\n attachInstanceProvides(instance, provides)\n}\n\nfunction isPrototypeInChain(target: Record<PropertyKey, any>, candidate: Record<PropertyKey, any>) {\n let current = Object.getPrototypeOf(target)\n while (current) {\n if (current === candidate) {\n return true\n }\n current = Object.getPrototypeOf(current)\n }\n return false\n}\n\nexport function attachRuntimeLayoutProvideContext(\n layoutInstance: InternalRuntimeState,\n pageInstance: InternalRuntimeState,\n): void {\n const layoutProvides = getInstanceProvides(layoutInstance)\n const pageProvides = getInstanceProvides(pageInstance)\n if (\n layoutProvides === pageProvides\n || isPrototypeInChain(layoutProvides, pageProvides)\n || isPrototypeInChain(pageProvides, layoutProvides)\n ) {\n return\n }\n\n Object.setPrototypeOf(pageProvides, layoutProvides)\n\n try {\n Object.defineProperty(pageInstance, WEVU_PARENT_INSTANCE_KEY, {\n value: layoutInstance,\n configurable: true,\n enumerable: false,\n writable: true,\n })\n }\n catch {\n ;(pageInstance as any)[WEVU_PARENT_INSTANCE_KEY] = layoutInstance\n }\n}\n"],"mappings":";;;;AAUA,SAAgB,qBAAqB,UAA4B;CAC/D,OAAO,QACL,YACG,OAAO,aAAa,YACnB,SAAsD,8BAA8B,IAC1F;AACF;AAEA,SAAS,eAAe,QAAmC;CACzD,OAAO,OAAO,OAAO,gDAAU,IAAI;AACrC;AAEA,SAAS,sBAAsB,YAA6E;CAC1G,IAAI,CAAC,YACH,OAAO,eAAe;CAExB,MAAM,WAAW,WAAW;CAC5B,IAAI,YAAY,OAAO,aAAa,UAClC,OAAO;CAET,MAAM,WAAW,eAAe;CAChC,IAAI;EACF,OAAO,eAAe,YAAY,uBAAuB;GACvD,OAAO;GACP,cAAc;GACd,YAAY;GACZ,UAAU;EACZ,CAAC;CACH,kBACM;EACH,AAAC,WAAmB,yBAAyB;CAChD;CACA,OAAO;AACT;AAEA,SAAgB,uBACd,UACA,UACM;CACN,IAAI;EACF,OAAO,eAAe,UAAU,mBAAmB;GACjD,OAAO;GACP,cAAc;GACd,YAAY;GACZ,UAAU;EACZ,CAAC;CACH,mBACM;EACH,AAAC,SAAiB,qBAAqB;CAC1C;AACF;AAEA,SAAgB,oBAAoB,UAA0D;;CAC5F,MAAM,WAAW,SAAS;CAC1B,IAAI,YAAY,OAAO,aAAa,UAClC,OAAO;CAGT,MAAM,aAAa,SAAS;CAC5B,MAAM,oEAAiB,SAAS,2GAA4B,2FACvD,sBAAsB,UAAU;CACrC,MAAM,WAAW,qBAAqB,QAAQ,IAC1C,sBAAsB,UAAU,IAChC,eAAe,cAAc;CACjC,uBAAuB,UAAU,QAAQ;CACzC,OAAO;AACT;AAEA,SAAgB,yBAAyB,YAAiE;CACxG,OAAO,sBAAsB,UAAU;AACzC;AAEA,SAAgB,2BAA8B,YAAuC,KAAU,OAAgB;CAC7G,sBAAsB,UAAU,CAAC,CAAC,OAAsB;CACxD,uBAAuB,KAAK,KAAK;AACnC;AAEA,SAAgB,4BACd,UACA,YACA,gBACM;;CACN,MAAM,cAAc,sBAAsB,UAAU;CACpD,MAAM,0GAAiB,eAAiB,2FAAsB;CAC9D,MAAM,WAAW,qBAAqB,QAAQ,IAC1C,cACA,eAAe,cAAc;CAEjC,IAAI,gBACF,IAAI;EACF,OAAO,eAAe,UAAU,0BAA0B;GACxD,OAAO;GACP,cAAc;GACd,YAAY;GACZ,UAAU;EACZ,CAAC;CACH,mBACM;EACH,AAAC,SAAiB,4BAA4B;CACjD;CAGF,uBAAuB,UAAU,QAAQ;AAC3C;AAEA,SAAS,mBAAmB,QAAkC,WAAqC;CACjG,IAAI,UAAU,OAAO,eAAe,MAAM;CAC1C,OAAO,SAAS;EACd,IAAI,YAAY,WACd,OAAO;EAET,UAAU,OAAO,eAAe,OAAO;CACzC;CACA,OAAO;AACT;AAEA,SAAgB,kCACd,gBACA,cACM;CACN,MAAM,iBAAiB,oBAAoB,cAAc;CACzD,MAAM,eAAe,oBAAoB,YAAY;CACrD,IACE,mBAAmB,gBAChB,mBAAmB,gBAAgB,YAAY,KAC/C,mBAAmB,cAAc,cAAc,GAElD;CAGF,OAAO,eAAe,cAAc,cAAc;CAElD,IAAI;EACF,OAAO,eAAe,cAAc,0BAA0B;GAC5D,OAAO;GACP,cAAc;GACd,YAAY;GACZ,UAAU;EACZ,CAAC;CACH,mBACM;EACH,AAAC,aAAqB,4BAA4B;CACrD;AACF"}
1
+ {"version":3,"file":"provideContext.mjs","names":[],"sources":["../../../src/runtime/provideContext.ts"],"sourcesContent":["import type { InternalRuntimeState, RuntimeApp } from './types'\nimport {\n WEVU_APP_PROVIDES_KEY,\n WEVU_IS_APP_INSTANCE_KEY,\n WEVU_PARENT_INSTANCE_KEY,\n WEVU_PROVIDES_KEY,\n WEVU_RUNTIME_APP_KEY,\n} from '@weapp-core/constants'\nimport { setGlobalProvidedValue } from './provideStore'\n\nexport function isRuntimeAppInstance(instance: unknown): boolean {\n return Boolean(\n instance\n && typeof instance === 'object'\n && (instance as { [WEVU_IS_APP_INSTANCE_KEY]?: boolean })[WEVU_IS_APP_INSTANCE_KEY] === true,\n )\n}\n\nfunction createProvides(parent?: Record<PropertyKey, any>) {\n return Object.create(parent ?? null) as Record<PropertyKey, any>\n}\n\nfunction getRuntimeAppProvides(runtimeApp: RuntimeApp<any, any, any> | undefined): Record<PropertyKey, any> {\n if (!runtimeApp) {\n return createProvides()\n }\n const existing = runtimeApp[WEVU_APP_PROVIDES_KEY]\n if (existing && typeof existing === 'object') {\n return existing\n }\n const provides = createProvides()\n try {\n Object.defineProperty(runtimeApp, WEVU_APP_PROVIDES_KEY, {\n value: provides,\n configurable: true,\n enumerable: false,\n writable: false,\n })\n }\n catch {\n ;(runtimeApp as any)[WEVU_APP_PROVIDES_KEY] = provides\n }\n return provides\n}\n\nexport function attachInstanceProvides(\n instance: InternalRuntimeState,\n provides: Record<PropertyKey, any>,\n): void {\n try {\n Object.defineProperty(instance, WEVU_PROVIDES_KEY, {\n value: provides,\n configurable: true,\n enumerable: false,\n writable: true,\n })\n }\n catch {\n ;(instance as any)[WEVU_PROVIDES_KEY] = provides\n }\n}\n\nexport function getInstanceProvides(instance: InternalRuntimeState): Record<PropertyKey, any> {\n const existing = instance[WEVU_PROVIDES_KEY]\n if (existing && typeof existing === 'object') {\n return existing\n }\n\n const runtimeApp = instance[WEVU_RUNTIME_APP_KEY]\n const parentProvides = instance[WEVU_PARENT_INSTANCE_KEY]?.[WEVU_PROVIDES_KEY]\n ?? getRuntimeAppProvides(runtimeApp)\n const provides = isRuntimeAppInstance(instance)\n ? getRuntimeAppProvides(runtimeApp)\n : createProvides(parentProvides)\n attachInstanceProvides(instance, provides)\n return provides\n}\n\nexport function ensureRuntimeAppProvides(runtimeApp: RuntimeApp<any, any, any>): Record<PropertyKey, any> {\n return getRuntimeAppProvides(runtimeApp)\n}\n\nexport function setRuntimeAppProvidedValue<T>(\n runtimeApp: RuntimeApp<any, any, any>,\n key: any,\n value: T,\n options: { syncGlobal?: boolean } = {},\n): void {\n getRuntimeAppProvides(runtimeApp)[key as PropertyKey] = value\n if (options.syncGlobal !== false) {\n setGlobalProvidedValue(key, value)\n }\n}\n\nexport function attachRuntimeProvideContext(\n instance: InternalRuntimeState,\n runtimeApp: RuntimeApp<any, any, any>,\n parentInstance?: InternalRuntimeState,\n): void {\n const appProvides = getRuntimeAppProvides(runtimeApp)\n const parentProvides = parentInstance?.[WEVU_PROVIDES_KEY] ?? appProvides\n const provides = isRuntimeAppInstance(instance)\n ? appProvides\n : createProvides(parentProvides)\n\n if (parentInstance) {\n try {\n Object.defineProperty(instance, WEVU_PARENT_INSTANCE_KEY, {\n value: parentInstance,\n configurable: true,\n enumerable: false,\n writable: true,\n })\n }\n catch {\n ;(instance as any)[WEVU_PARENT_INSTANCE_KEY] = parentInstance\n }\n }\n\n attachInstanceProvides(instance, provides)\n}\n\nfunction isPrototypeInChain(target: Record<PropertyKey, any>, candidate: Record<PropertyKey, any>) {\n let current = Object.getPrototypeOf(target)\n while (current) {\n if (current === candidate) {\n return true\n }\n current = Object.getPrototypeOf(current)\n }\n return false\n}\n\nexport function attachRuntimeLayoutProvideContext(\n layoutInstance: InternalRuntimeState,\n pageInstance: InternalRuntimeState,\n): void {\n const layoutProvides = getInstanceProvides(layoutInstance)\n const pageProvides = getInstanceProvides(pageInstance)\n if (\n layoutProvides === pageProvides\n || isPrototypeInChain(layoutProvides, pageProvides)\n || isPrototypeInChain(pageProvides, layoutProvides)\n ) {\n return\n }\n\n Object.setPrototypeOf(pageProvides, layoutProvides)\n\n try {\n Object.defineProperty(pageInstance, WEVU_PARENT_INSTANCE_KEY, {\n value: layoutInstance,\n configurable: true,\n enumerable: false,\n writable: true,\n })\n }\n catch {\n ;(pageInstance as any)[WEVU_PARENT_INSTANCE_KEY] = layoutInstance\n }\n}\n"],"mappings":";;;;AAUA,SAAgB,qBAAqB,UAA4B;CAC/D,OAAO,QACL,YACG,OAAO,aAAa,YACnB,SAAsD,8BAA8B,IAC1F;AACF;AAEA,SAAS,eAAe,QAAmC;CACzD,OAAO,OAAO,OAAO,gDAAU,IAAI;AACrC;AAEA,SAAS,sBAAsB,YAA6E;CAC1G,IAAI,CAAC,YACH,OAAO,eAAe;CAExB,MAAM,WAAW,WAAW;CAC5B,IAAI,YAAY,OAAO,aAAa,UAClC,OAAO;CAET,MAAM,WAAW,eAAe;CAChC,IAAI;EACF,OAAO,eAAe,YAAY,uBAAuB;GACvD,OAAO;GACP,cAAc;GACd,YAAY;GACZ,UAAU;EACZ,CAAC;CACH,kBACM;EACH,AAAC,WAAmB,yBAAyB;CAChD;CACA,OAAO;AACT;AAEA,SAAgB,uBACd,UACA,UACM;CACN,IAAI;EACF,OAAO,eAAe,UAAU,mBAAmB;GACjD,OAAO;GACP,cAAc;GACd,YAAY;GACZ,UAAU;EACZ,CAAC;CACH,mBACM;EACH,AAAC,SAAiB,qBAAqB;CAC1C;AACF;AAEA,SAAgB,oBAAoB,UAA0D;;CAC5F,MAAM,WAAW,SAAS;CAC1B,IAAI,YAAY,OAAO,aAAa,UAClC,OAAO;CAGT,MAAM,aAAa,SAAS;CAC5B,MAAM,oEAAiB,SAAS,2GAA4B,2FACvD,sBAAsB,UAAU;CACrC,MAAM,WAAW,qBAAqB,QAAQ,IAC1C,sBAAsB,UAAU,IAChC,eAAe,cAAc;CACjC,uBAAuB,UAAU,QAAQ;CACzC,OAAO;AACT;AAEA,SAAgB,yBAAyB,YAAiE;CACxG,OAAO,sBAAsB,UAAU;AACzC;AAEA,SAAgB,2BACd,YACA,KACA,OACA,UAAoC,CAAC,GAC/B;CACN,sBAAsB,UAAU,CAAC,CAAC,OAAsB;CACxD,IAAI,QAAQ,eAAe,OACzB,uBAAuB,KAAK,KAAK;AAErC;AAEA,SAAgB,4BACd,UACA,YACA,gBACM;;CACN,MAAM,cAAc,sBAAsB,UAAU;CACpD,MAAM,0GAAiB,eAAiB,2FAAsB;CAC9D,MAAM,WAAW,qBAAqB,QAAQ,IAC1C,cACA,eAAe,cAAc;CAEjC,IAAI,gBACF,IAAI;EACF,OAAO,eAAe,UAAU,0BAA0B;GACxD,OAAO;GACP,cAAc;GACd,YAAY;GACZ,UAAU;EACZ,CAAC;CACH,mBACM;EACH,AAAC,SAAiB,4BAA4B;CACjD;CAGF,uBAAuB,UAAU,QAAQ;AAC3C;AAEA,SAAS,mBAAmB,QAAkC,WAAqC;CACjG,IAAI,UAAU,OAAO,eAAe,MAAM;CAC1C,OAAO,SAAS;EACd,IAAI,YAAY,WACd,OAAO;EAET,UAAU,OAAO,eAAe,OAAO;CACzC;CACA,OAAO;AACT;AAEA,SAAgB,kCACd,gBACA,cACM;CACN,MAAM,iBAAiB,oBAAoB,cAAc;CACzD,MAAM,eAAe,oBAAoB,YAAY;CACrD,IACE,mBAAmB,gBAChB,mBAAmB,gBAAgB,YAAY,KAC/C,mBAAmB,cAAc,cAAc,GAElD;CAGF,OAAO,eAAe,cAAc,cAAc;CAElD,IAAI;EACF,OAAO,eAAe,cAAc,0BAA0B;GAC5D,OAAO;GACP,cAAc;GACd,YAAY;GACZ,UAAU;EACZ,CAAC;CACH,mBACM;EACH,AAAC,aAAqB,4BAA4B;CACrD;AACF"}
@@ -19,7 +19,7 @@ function scheduleOwnerTemplateRefUpdate(target) {
19
19
  }
20
20
  function registerComponentDefinition(options) {
21
21
  var _getMiniProgramRuntim;
22
- const { runtimeApp, watch, setup, restOptions, pageLifecycleHooks, finalObservers, userLifetimes, userPageLifetimes, finalMethods, finalOptions, applyExtraInstanceFields, templateRefs, layoutHosts, attachWevuPropKeys, setupLifecycle, syncWevuPropsFromInstance, directPropsDerivedKeys, isPage, vueLifecycles, getRuntimeOwnerLabel } = options;
22
+ const { runtimeApp, watch, setup, restOptions, pageLifecycleHooks, finalObservers, userLifetimes, userPageLifetimes, finalMethods, finalOptions, applyExtraInstanceFields, templateRefs, layoutHosts, attachWevuPropKeys, setupLifecycle, syncWevuPropsFromInstance, directPropsDerivedKeys, isPage, vueLifecycles, getRuntimeOwnerLabel, registerNative = true } = options;
23
23
  const resolveRuntime = (instance) => {
24
24
  var _wevu;
25
25
  const directRuntime = (_wevu = instance.__wevu) !== null && _wevu !== void 0 ? _wevu : instance[WEVU_PUBLIC_RUNTIME_KEY];
@@ -272,6 +272,7 @@ function registerComponentDefinition(options) {
272
272
  },
273
273
  options: finalOptions
274
274
  };
275
+ if (!registerNative) return componentDefinition;
275
276
  const statefulHmrBridge = (_getMiniProgramRuntim = getMiniProgramRuntimeGlobalObject()) === null || _getMiniProgramRuntim === void 0 ? void 0 : _getMiniProgramRuntim[WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY];
276
277
  if (typeof (statefulHmrBridge === null || statefulHmrBridge === void 0 ? void 0 : statefulHmrBridge.trackWevuComponent) === "function") {
277
278
  const definition = statefulHmrBridge.trackWevuComponent(componentDefinition, (instance, stateSnapshot) => {
@@ -285,7 +286,10 @@ function registerComponentDefinition(options) {
285
286
  enableDeferredSetData(instance, { rehydrateSetupState: true });
286
287
  });
287
288
  if (!statefulHmrBridge.isApplying()) registerNativeComponentDefinition(definition, isPage);
288
- } else registerNativeComponentDefinition(componentDefinition, isPage);
289
+ return definition;
290
+ }
291
+ registerNativeComponentDefinition(componentDefinition, isPage);
292
+ return componentDefinition;
289
293
  }
290
294
 
291
295
  //#endregion
@@ -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}) {\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 } = 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 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 }\n else {\n registerNativeComponentDefinition(componentDefinition, isPage)\n }\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,SAsBvH;;CACD,MAAM,EACJ,YACA,OACA,OACA,aACA,oBACA,gBACA,eACA,mBACA,cACA,cACA,0BACA,cACA,aACA,oBACA,gBACA,2BACA,wBACA,QACA,eACA,yBACE;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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BAA0B,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,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;CAExD,OAEE,kCAAkC,qBAAqB,MAAM;AAEjE"}
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,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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"}
@@ -11,7 +11,7 @@ import { WEVU_EXPOSED_KEY, WEVU_HOOKS_KEY } from "@weapp-core/constants";
11
11
  * 注册组件入口(框架内部使用)。
12
12
  * @internal
13
13
  */
14
- function registerComponent(runtimeApp, methods, watch, setup, mpOptions) {
14
+ function registerComponent(runtimeApp, methods, watch, setup, mpOptions, options = {}) {
15
15
  var _multipleSlots;
16
16
  const { userMethods, userLifetimes, userPageLifetimes, userOptions, restOptions, topLevelMethods, templateRefs, layoutHosts, propsAliases, propsDerivedKeys, userObservers, setupLifecycle, vueLifecycles, isPage, features, userOnLoad, userOnUnload, userOnShow, userOnHide, userOnReady, userOnSaveExitState, userOnPullDownRefresh, userOnReachBottom, userOnPageScroll, userOnRouteDone, userOnTabItemTap, userOnResize, userOnShareAppMessage, userOnShareTimeline, userOnAddToFavorites, applyExtraInstanceFields } = prepareComponentOptions(mpOptions);
17
17
  const { enableOnPullDownRefresh, enableOnReachBottom, enableOnPageScroll, enableOnRouteDone, enableOnRouteDoneFallback, enableOnTabItemTap, enableOnResize, enableOnShareAppMessage, enableOnShareTimeline, enableOnAddToFavorites, enableOnSaveExitState, effectiveOnSaveExitState, effectiveOnPullDownRefresh, effectiveOnReachBottom, effectiveOnPageScroll, effectiveOnRouteDone, effectiveOnTabItemTap, effectiveOnResize, effectiveOnShareAppMessage, effectiveOnShareTimeline, effectiveOnAddToFavorites } = resolveComponentFeatures({
@@ -99,7 +99,7 @@ function registerComponent(runtimeApp, methods, watch, setup, mpOptions) {
99
99
  effectiveOnAddToFavorites,
100
100
  hasHook
101
101
  });
102
- registerComponentDefinition({
102
+ return registerComponentDefinition({
103
103
  runtimeApp,
104
104
  watch,
105
105
  setup,
@@ -120,7 +120,8 @@ function registerComponent(runtimeApp, methods, watch, setup, mpOptions) {
120
120
  directPropsDerivedKeys,
121
121
  isPage,
122
122
  vueLifecycles,
123
- getRuntimeOwnerLabel
123
+ getRuntimeOwnerLabel,
124
+ registerNative: options.registerNative
124
125
  });
125
126
  }
126
127
 
@@ -1 +1 @@
1
- {"version":3,"file":"component.mjs","names":[],"sources":["../../../../src/runtime/register/component.ts"],"sourcesContent":["import type { ComponentPropsOptions, ComputedDefinitions, DefineComponentOptions, InternalRuntimeState, MethodDefinitions, MiniProgramComponentRawOptions, RuntimeApp } from '../types'\nimport type { WatchMap } from './watch'\nimport { WEVU_EXPOSED_KEY, WEVU_HOOKS_KEY } from '@weapp-core/constants'\nimport { resolveComponentFeatures } from './component/features'\nimport { createPageLifecycleHooks } from './component/lifecycle'\nimport { createComponentMethods } from './component/methods'\nimport { getRuntimeOwnerLabel, prepareComponentOptions } from './component/options'\nimport { createPropsSync } from './component/props'\nimport { registerComponentDefinition } from './component/registerDefinition'\n\n/**\n * 注册组件入口(框架内部使用)。\n * @internal\n */\nexport function registerComponent<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(\n runtimeApp: RuntimeApp<D, C, M>,\n methods: MethodDefinitions,\n watch: WatchMap | undefined,\n setup: DefineComponentOptions<ComponentPropsOptions, D, C, M>['setup'],\n mpOptions: MiniProgramComponentRawOptions,\n) {\n const {\n userMethods,\n userLifetimes,\n userPageLifetimes,\n userOptions,\n restOptions,\n topLevelMethods,\n templateRefs,\n layoutHosts,\n propsAliases,\n propsDerivedKeys,\n userObservers,\n setupLifecycle,\n vueLifecycles,\n isPage,\n features,\n userOnLoad,\n userOnUnload,\n userOnShow,\n userOnHide,\n userOnReady,\n userOnSaveExitState,\n userOnPullDownRefresh,\n userOnReachBottom,\n userOnPageScroll,\n userOnRouteDone,\n userOnTabItemTap,\n userOnResize,\n userOnShareAppMessage,\n userOnShareTimeline,\n userOnAddToFavorites,\n applyExtraInstanceFields,\n } = prepareComponentOptions(mpOptions)\n\n const {\n enableOnPullDownRefresh,\n enableOnReachBottom,\n enableOnPageScroll,\n enableOnRouteDone,\n enableOnRouteDoneFallback,\n enableOnTabItemTap,\n enableOnResize,\n enableOnShareAppMessage,\n enableOnShareTimeline,\n enableOnAddToFavorites,\n enableOnSaveExitState,\n effectiveOnSaveExitState,\n effectiveOnPullDownRefresh,\n effectiveOnReachBottom,\n effectiveOnPageScroll,\n effectiveOnRouteDone,\n effectiveOnTabItemTap,\n effectiveOnResize,\n effectiveOnShareAppMessage,\n effectiveOnShareTimeline,\n effectiveOnAddToFavorites,\n } = resolveComponentFeatures({\n features,\n userOnSaveExitState,\n userOnPullDownRefresh,\n userOnReachBottom,\n userOnPageScroll,\n userOnRouteDone,\n userOnTabItemTap,\n userOnResize,\n userOnShareAppMessage,\n userOnShareTimeline,\n userOnAddToFavorites,\n })\n\n const hasHook = (target: InternalRuntimeState, name: string) => {\n const hooks = target[WEVU_HOOKS_KEY]\n if (!hooks) {\n return false\n }\n const entry = (hooks as any)[name]\n if (!entry) {\n return false\n }\n if (Array.isArray(entry)) {\n return entry.length > 0\n }\n return typeof entry === 'function'\n }\n\n // 自动对齐 Vue 3 的 expose:\n // - 若用户未提供 component-export 的 export(),默认返回 setup() 中 expose() 写入的 __wevuExposed\n // - 若用户同时提供 export() 与 expose(),则自动浅合并(export() 优先级更高)\n {\n const userExport = (restOptions as any).export\n ;(restOptions as any).export = function __wevu_export(this: InternalRuntimeState) {\n const exposed = (this as any)[WEVU_EXPOSED_KEY] ?? {}\n const base = typeof userExport === 'function' ? userExport.call(this) : {}\n\n if (base && typeof base === 'object' && !Array.isArray(base)) {\n return {\n ...exposed,\n ...base,\n }\n }\n\n // 若用户 export() 返回非对象(理论上不应发生),则保持原返回值;否则回退 exposed\n return base ?? exposed\n }\n }\n\n // 默认启用多 slot 以兼容微信小程序具名插槽写法;用户显式配置时保持原值\n const finalOptions = {\n multipleSlots: (userOptions as any).multipleSlots ?? true,\n ...(userOptions as any),\n }\n\n const { attachWevuPropKeys, directPropsDerivedKeys, syncWevuPropsFromInstance, syncWevuPropsFromValues, finalObservers } = createPropsSync({\n restOptions,\n propsAliases,\n propsDerivedKeys,\n userObservers,\n })\n\n const { finalMethods } = createComponentMethods({\n userMethods: {\n ...topLevelMethods,\n ...userMethods,\n },\n runtimeMethods: methods,\n })\n\n const pageLifecycleHooks = createPageLifecycleHooks({\n runtimeApp,\n watch,\n setup,\n userOnLoad,\n userOnUnload,\n userOnShow,\n userOnHide,\n userOnReady,\n isPage,\n enableOnSaveExitState,\n enableOnPullDownRefresh,\n enableOnReachBottom,\n enableOnPageScroll,\n enableOnRouteDone,\n enableOnRouteDoneFallback,\n enableOnTabItemTap,\n enableOnResize,\n enableOnShareAppMessage,\n enableOnShareTimeline,\n enableOnAddToFavorites,\n syncWevuPropsFromValues,\n effectiveOnSaveExitState,\n effectiveOnPullDownRefresh,\n effectiveOnReachBottom,\n effectiveOnPageScroll,\n effectiveOnRouteDone,\n effectiveOnTabItemTap,\n effectiveOnResize,\n effectiveOnShareAppMessage,\n effectiveOnShareTimeline,\n effectiveOnAddToFavorites,\n hasHook,\n })\n\n registerComponentDefinition({\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 syncWevuPropsFromValues,\n directPropsDerivedKeys,\n isPage,\n vueLifecycles,\n getRuntimeOwnerLabel,\n })\n}\n"],"mappings":";;;;;;;;;;;;;AAcA,SAAgB,kBACd,YACA,SACA,OACA,OACA,WACA;;CACA,MAAM,EACJ,aACA,eACA,mBACA,aACA,aACA,iBACA,cACA,aACA,cACA,kBACA,eACA,gBACA,eACA,QACA,UACA,YACA,cACA,YACA,YACA,aACA,qBACA,uBACA,mBACA,kBACA,iBACA,kBACA,cACA,uBACA,qBACA,sBACA,6BACE,wBAAwB,SAAS;CAErC,MAAM,EACJ,yBACA,qBACA,oBACA,mBACA,2BACA,oBACA,gBACA,yBACA,uBACA,wBACA,uBACA,0BACA,4BACA,wBACA,uBACA,sBACA,uBACA,mBACA,4BACA,0BACA,8BACE,yBAAyB;EAC3B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,WAAW,QAA8B,SAAiB;EAC9D,MAAM,QAAQ,OAAO;EACrB,IAAI,CAAC,OACH,OAAO;EAET,MAAM,QAAS,MAAc;EAC7B,IAAI,CAAC,OACH,OAAO;EAET,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,MAAM,SAAS;EAExB,OAAO,OAAO,UAAU;CAC1B;CAKA;EACE,MAAM,aAAc,YAAoB;EACvC,AAAC,YAAoB,SAAS,SAAS,gBAA0C;;GAChF,MAAM,+BAAW,KAAa,kFAAqB,CAAC;GACpD,MAAM,OAAO,OAAO,eAAe,aAAa,WAAW,KAAK,IAAI,IAAI,CAAC;GAEzE,IAAI,QAAQ,OAAO,SAAS,YAAY,CAAC,MAAM,QAAQ,IAAI,GACzD,OAAO;IACL,GAAG;IACH,GAAG;GACL;GAIF,OAAO,0CAAQ;EACjB;CACF;CAGA,MAAM,eAAe;EACnB,iCAAgB,YAAoB,wEAAiB;EACrD,GAAI;CACN;CAEA,MAAM,EAAE,oBAAoB,wBAAwB,2BAA2B,yBAAyB,mBAAmB,gBAAgB;EACzI;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,EAAE,iBAAiB,uBAAuB;EAC9C,aAAa;GACX,GAAG;GACH,GAAG;EACL;EACA,gBAAgB;CAClB,CAAC;CAED,MAAM,qBAAqB,yBAAyB;EAClD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,4BAA4B;EAC1B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"component.mjs","names":[],"sources":["../../../../src/runtime/register/component.ts"],"sourcesContent":["import type { ComponentPropsOptions, ComputedDefinitions, DefineComponentOptions, InternalRuntimeState, MethodDefinitions, MiniProgramComponentRawOptions, RuntimeApp } from '../types'\nimport type { WatchMap } from './watch'\nimport { WEVU_EXPOSED_KEY, WEVU_HOOKS_KEY } from '@weapp-core/constants'\nimport { resolveComponentFeatures } from './component/features'\nimport { createPageLifecycleHooks } from './component/lifecycle'\nimport { createComponentMethods } from './component/methods'\nimport { getRuntimeOwnerLabel, prepareComponentOptions } from './component/options'\nimport { createPropsSync } from './component/props'\nimport { registerComponentDefinition } from './component/registerDefinition'\n\n/**\n * 注册组件入口(框架内部使用)。\n * @internal\n */\nexport function registerComponent<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(\n runtimeApp: RuntimeApp<D, C, M>,\n methods: MethodDefinitions,\n watch: WatchMap | undefined,\n setup: DefineComponentOptions<ComponentPropsOptions, D, C, M>['setup'],\n mpOptions: MiniProgramComponentRawOptions,\n options: { registerNative?: boolean } = {},\n) {\n const {\n userMethods,\n userLifetimes,\n userPageLifetimes,\n userOptions,\n restOptions,\n topLevelMethods,\n templateRefs,\n layoutHosts,\n propsAliases,\n propsDerivedKeys,\n userObservers,\n setupLifecycle,\n vueLifecycles,\n isPage,\n features,\n userOnLoad,\n userOnUnload,\n userOnShow,\n userOnHide,\n userOnReady,\n userOnSaveExitState,\n userOnPullDownRefresh,\n userOnReachBottom,\n userOnPageScroll,\n userOnRouteDone,\n userOnTabItemTap,\n userOnResize,\n userOnShareAppMessage,\n userOnShareTimeline,\n userOnAddToFavorites,\n applyExtraInstanceFields,\n } = prepareComponentOptions(mpOptions)\n\n const {\n enableOnPullDownRefresh,\n enableOnReachBottom,\n enableOnPageScroll,\n enableOnRouteDone,\n enableOnRouteDoneFallback,\n enableOnTabItemTap,\n enableOnResize,\n enableOnShareAppMessage,\n enableOnShareTimeline,\n enableOnAddToFavorites,\n enableOnSaveExitState,\n effectiveOnSaveExitState,\n effectiveOnPullDownRefresh,\n effectiveOnReachBottom,\n effectiveOnPageScroll,\n effectiveOnRouteDone,\n effectiveOnTabItemTap,\n effectiveOnResize,\n effectiveOnShareAppMessage,\n effectiveOnShareTimeline,\n effectiveOnAddToFavorites,\n } = resolveComponentFeatures({\n features,\n userOnSaveExitState,\n userOnPullDownRefresh,\n userOnReachBottom,\n userOnPageScroll,\n userOnRouteDone,\n userOnTabItemTap,\n userOnResize,\n userOnShareAppMessage,\n userOnShareTimeline,\n userOnAddToFavorites,\n })\n\n const hasHook = (target: InternalRuntimeState, name: string) => {\n const hooks = target[WEVU_HOOKS_KEY]\n if (!hooks) {\n return false\n }\n const entry = (hooks as any)[name]\n if (!entry) {\n return false\n }\n if (Array.isArray(entry)) {\n return entry.length > 0\n }\n return typeof entry === 'function'\n }\n\n // 自动对齐 Vue 3 的 expose:\n // - 若用户未提供 component-export 的 export(),默认返回 setup() 中 expose() 写入的 __wevuExposed\n // - 若用户同时提供 export() 与 expose(),则自动浅合并(export() 优先级更高)\n {\n const userExport = (restOptions as any).export\n ;(restOptions as any).export = function __wevu_export(this: InternalRuntimeState) {\n const exposed = (this as any)[WEVU_EXPOSED_KEY] ?? {}\n const base = typeof userExport === 'function' ? userExport.call(this) : {}\n\n if (base && typeof base === 'object' && !Array.isArray(base)) {\n return {\n ...exposed,\n ...base,\n }\n }\n\n // 若用户 export() 返回非对象(理论上不应发生),则保持原返回值;否则回退 exposed\n return base ?? exposed\n }\n }\n\n // 默认启用多 slot 以兼容微信小程序具名插槽写法;用户显式配置时保持原值\n const finalOptions = {\n multipleSlots: (userOptions as any).multipleSlots ?? true,\n ...(userOptions as any),\n }\n\n const { attachWevuPropKeys, directPropsDerivedKeys, syncWevuPropsFromInstance, syncWevuPropsFromValues, finalObservers } = createPropsSync({\n restOptions,\n propsAliases,\n propsDerivedKeys,\n userObservers,\n })\n\n const { finalMethods } = createComponentMethods({\n userMethods: {\n ...topLevelMethods,\n ...userMethods,\n },\n runtimeMethods: methods,\n })\n\n const pageLifecycleHooks = createPageLifecycleHooks({\n runtimeApp,\n watch,\n setup,\n userOnLoad,\n userOnUnload,\n userOnShow,\n userOnHide,\n userOnReady,\n isPage,\n enableOnSaveExitState,\n enableOnPullDownRefresh,\n enableOnReachBottom,\n enableOnPageScroll,\n enableOnRouteDone,\n enableOnRouteDoneFallback,\n enableOnTabItemTap,\n enableOnResize,\n enableOnShareAppMessage,\n enableOnShareTimeline,\n enableOnAddToFavorites,\n syncWevuPropsFromValues,\n effectiveOnSaveExitState,\n effectiveOnPullDownRefresh,\n effectiveOnReachBottom,\n effectiveOnPageScroll,\n effectiveOnRouteDone,\n effectiveOnTabItemTap,\n effectiveOnResize,\n effectiveOnShareAppMessage,\n effectiveOnShareTimeline,\n effectiveOnAddToFavorites,\n hasHook,\n })\n\n return registerComponentDefinition({\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 syncWevuPropsFromValues,\n directPropsDerivedKeys,\n isPage,\n vueLifecycles,\n getRuntimeOwnerLabel,\n registerNative: options.registerNative,\n })\n}\n"],"mappings":";;;;;;;;;;;;;AAcA,SAAgB,kBACd,YACA,SACA,OACA,OACA,WACA,UAAwC,CAAC,GACzC;;CACA,MAAM,EACJ,aACA,eACA,mBACA,aACA,aACA,iBACA,cACA,aACA,cACA,kBACA,eACA,gBACA,eACA,QACA,UACA,YACA,cACA,YACA,YACA,aACA,qBACA,uBACA,mBACA,kBACA,iBACA,kBACA,cACA,uBACA,qBACA,sBACA,6BACE,wBAAwB,SAAS;CAErC,MAAM,EACJ,yBACA,qBACA,oBACA,mBACA,2BACA,oBACA,gBACA,yBACA,uBACA,wBACA,uBACA,0BACA,4BACA,wBACA,uBACA,sBACA,uBACA,mBACA,4BACA,0BACA,8BACE,yBAAyB;EAC3B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,WAAW,QAA8B,SAAiB;EAC9D,MAAM,QAAQ,OAAO;EACrB,IAAI,CAAC,OACH,OAAO;EAET,MAAM,QAAS,MAAc;EAC7B,IAAI,CAAC,OACH,OAAO;EAET,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,MAAM,SAAS;EAExB,OAAO,OAAO,UAAU;CAC1B;CAKA;EACE,MAAM,aAAc,YAAoB;EACvC,AAAC,YAAoB,SAAS,SAAS,gBAA0C;;GAChF,MAAM,+BAAW,KAAa,kFAAqB,CAAC;GACpD,MAAM,OAAO,OAAO,eAAe,aAAa,WAAW,KAAK,IAAI,IAAI,CAAC;GAEzE,IAAI,QAAQ,OAAO,SAAS,YAAY,CAAC,MAAM,QAAQ,IAAI,GACzD,OAAO;IACL,GAAG;IACH,GAAG;GACL;GAIF,OAAO,0CAAQ;EACjB;CACF;CAGA,MAAM,eAAe;EACnB,iCAAgB,YAAoB,wEAAiB;EACrD,GAAI;CACN;CAEA,MAAM,EAAE,oBAAoB,wBAAwB,2BAA2B,yBAAyB,mBAAmB,gBAAgB;EACzI;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,EAAE,iBAAiB,uBAAuB;EAC9C,aAAa;GACX,GAAG;GACH,GAAG;EACL;EACA,gBAAgB;CAClB,CAAC;CAED,MAAM,qBAAqB,yBAAyB;EAClD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,OAAO,4BAA4B;EACjC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,gBAAgB,QAAQ;CAC1B,CAAC;AACH"}
package/dist/index.d.mts CHANGED
@@ -69,4 +69,4 @@ import { StoreToRefsResult, storeToRefs } from "./store/storeToRefs.mjs";
69
69
  import "./store.mjs";
70
70
  import { version } from "./version.mjs";
71
71
  export * from "@wevu/web-apis";
72
- export { type ActionContext, type ActionSubscriber, type AlipayMiniProgramHostNamespace, type AlipayMiniProgramHostSourceContract, type AllowedComponentProps, type AppConfig, type ComponentCustomProps, ComponentDefinition, type ComponentOptionsMixin, type ComponentPropsOptions, type ComponentPublicInstance, type ComponentTypeEmits, type ComputedDefinitions, type ComputedGetter, type ComputedRef, type ComputedSetter, type CreateAppOptions, type CustomRefFactory, type CustomRefOptions, type CustomRefSource, type DataOption, type DefaultMiniProgramHostNamespace, type DefaultMiniProgramHostSourceContract, type DefineAppOptions, type DefineComponent, type DefineComponentOptions, DefineComponentTypePropsOptions, DefineComponentWithTypeProps, DefineModelModifiers, DefineModelTransformOptions, type DefineStoreOptions, DisposableBag, DisposableLike, DisposableMethodName, DisposableObject, type DouyinMiniProgramHostNamespace, type DouyinMiniProgramHostSourceContract, type EffectScope, ElementIntersectionObserverCallback, type EmitFn, type EmitsOptions, type ExtractComputed, type ExtractDefaultPropTypes, type ExtractMethods, type ExtractPropTypes, type ExtractPublicPropTypes, GlobalComponents, GlobalDirectives, type HostMiniProgramAddToFavoritesOption, type HostMiniProgramAppOptions, type HostMiniProgramAppTrivialInstance, type HostMiniProgramBehaviorIdentifier, type HostMiniProgramBoundingClientRectResult, type HostMiniProgramComponentAllFullProperty, type HostMiniProgramComponentAllProperty, type HostMiniProgramComponentBehaviorOptions, type HostMiniProgramComponentEmptyArray, type HostMiniProgramComponentInstance, type HostMiniProgramComponentMethodOption, type HostMiniProgramComponentPropertyOption, type HostMiniProgramComponentPropertyValue, type HostMiniProgramComponentShortProperty, type HostMiniProgramComponentTrivialInstance, type HostMiniProgramComponentTrivialOption, type HostMiniProgramIntersectionObserver, type HostMiniProgramIntersectionObserverOptions, type HostMiniProgramLaunchOptions, type HostMiniProgramMemoryWarningResult, type HostMiniProgramNavigateToOption, type HostMiniProgramNodesRef, type HostMiniProgramNodesRefFields, type HostMiniProgramPageLifetime, type HostMiniProgramPageNotFoundOptions, type HostMiniProgramPageResizeOption, type HostMiniProgramPageScrollOption, type HostMiniProgramPageTrivialInstance, type HostMiniProgramReLaunchOption, type HostMiniProgramRedirectToOption, type HostMiniProgramRouter, type HostMiniProgramSaveExitState, type HostMiniProgramScrollOffsetResult, type HostMiniProgramSelectorQuery, type HostMiniProgramShareAppMessageOption, type HostMiniProgramSwitchTabOption, type HostMiniProgramTabItemTapOption, type HostMiniProgramThemeChangeResult, type HostMiniProgramTriggerEventOptions, type HostMiniProgramUnhandledRejectionResult, type InferNativePropType, type InferNativeProps, type InferPropType, type InferProps, type InternalRuntimeState, type InternalRuntimeStateFields, LayoutBridgeInstance, LayoutHostBinding, type MapSources, type MaybeRef, type MaybeRefOrGetter, type MaybeUndefined, type MethodDefinitions, type MiniProgramAdapter, type HostMiniProgramAddToFavoritesOption as MiniProgramAddToFavoritesOption, type MiniProgramAppOptions, type MiniProgramBehaviorIdentifier, type HostMiniProgramBoundingClientRectResult as MiniProgramBoundingClientRectResult, type MiniProgramCSSProperties, type HostMiniProgramComponentAllFullProperty as MiniProgramComponentAllFullProperty, type HostMiniProgramComponentAllProperty as MiniProgramComponentAllProperty, type HostMiniProgramComponentBehaviorOptions as MiniProgramComponentBehaviorOptions, type HostMiniProgramComponentEmptyArray as MiniProgramComponentEmptyArray, type MiniProgramComponentInstance, type HostMiniProgramComponentMethodOption as MiniProgramComponentMethodOption, type MiniProgramComponentOptions, type HostMiniProgramComponentPropertyOption as MiniProgramComponentPropertyOption, type MiniProgramComponentPropertyValue, type MiniProgramComponentRawOptions, type HostMiniProgramComponentShortProperty as MiniProgramComponentShortProperty, type MiniProgramDatasetAttributes, type MiniProgramHostNamespace, type MiniProgramHostNamespaceBySource, type MiniProgramHostSourceName, type MiniProgramHostSourceRegistry, type MiniProgramHtmlAliasIntrinsicElements, type MiniProgramInstance, type HostMiniProgramIntersectionObserver as MiniProgramIntersectionObserver, type HostMiniProgramIntersectionObserverOptions as MiniProgramIntersectionObserverOptions, type MiniProgramIntrinsicElementBaseAttributes, type MiniProgramIntrinsicElements, type MiniProgramIntrinsicEventHandler, type HostMiniProgramLaunchOptions as MiniProgramLaunchOptions, type HostMiniProgramMemoryWarningResult as MiniProgramMemoryWarningResult, type HostMiniProgramNavigateToOption as MiniProgramNavigateToOption, type HostMiniProgramNodesRef as MiniProgramNodesRef, type HostMiniProgramNodesRefFields as MiniProgramNodesRefFields, type HostMiniProgramPageLifetime as MiniProgramPageLifetime, type MiniProgramPageLifetimes, type HostMiniProgramPageNotFoundOptions as MiniProgramPageNotFoundOptions, type HostMiniProgramPageResizeOption as MiniProgramPageResizeOption, type HostMiniProgramPageScrollOption as MiniProgramPageScrollOption, type MiniProgramPlatformHostNamespaceBySource, type MiniProgramPlatformHostSourceName, type MiniProgramPlatformHostSourceRegistry, type HostMiniProgramReLaunchOption as MiniProgramReLaunchOption, type HostMiniProgramRedirectToOption as MiniProgramRedirectToOption, type HostMiniProgramRouter as MiniProgramRouter, type MiniProgramRouterNavigateToOption, type MiniProgramRouterReLaunchOption, type MiniProgramRouterRedirectToOption, type MiniProgramRouterSwitchTabOption, type MiniProgramRuntimeHostNamespaceBySource, type MiniProgramRuntimeHostSourceName, type MiniProgramRuntimeHostSourceRegistry, type HostMiniProgramSaveExitState as MiniProgramSaveExitState, type HostMiniProgramScrollOffsetResult as MiniProgramScrollOffsetResult, type HostMiniProgramSelectorQuery as MiniProgramSelectorQuery, type HostMiniProgramShareAppMessageOption as MiniProgramShareAppMessageOption, type HostMiniProgramSwitchTabOption as MiniProgramSwitchTabOption, type HostMiniProgramTabItemTapOption as MiniProgramTabItemTapOption, MiniProgramTemplateRefValue, type HostMiniProgramThemeChangeResult as MiniProgramThemeChangeResult, type HostMiniProgramUnhandledRejectionResult as MiniProgramUnhandledRejectionResult, type ModelBinding, type ModelBindingOptions, type ModelBindingPayload, type ModelModifiers, ModelRef, type MultiWatchSources, type MutationKind, type MutationOp, type MutationRecord, type MutationType, type NativeComponent, type NativePropType, type NativePropsOptions, type NativeTypeHint, type NativeTypedProperty, NavigationBarMetrics, type ObjectDirective, type OnCleanup, type PageFeatures, PageLayoutMeta, PageLayoutState, PageMeta, PageStackSnapshot, type PrelinkReactiveTreeOptions, type PropConstructor, type PropOptions, type PropType, type PublicProps, PullDownRefreshHandler, type Ref, type RuntimeApp, type RuntimeInstance, type SetDataDebugInfo, type SetDataSnapshotOptions, type SetupContext, type SetupContextNativeInstance, type SetupContextRouter, SetupContextWithTypeProps, type SetupFunction, SetupFunctionWithTypeProps, type ShallowRef, type ShallowUnwrapRef, type StoreManager, type StoreSubscribeOptions, type StoreToRefsResult, type SubscriptionCallback, type TemplateRef, TemplateRefValue, TemplateRefs, type ToRefs, type HostMiniProgramTriggerEventOptions as TriggerEventOptions, type TtMiniProgramHostNamespace, type TtMiniProgramHostSourceContract, UpdatePerformanceListener, UpdatePerformanceListenerResult, UseAllBoundingClientRectOptions, UseAllScrollOffsetOptions, UseAllSelectorFieldsOptions, UseAsyncPullDownRefreshOptions, UseBoundingClientRectOptions, UseElementIntersectionObserverOptions, UseElementIntersectionObserverReturn, UseIntersectionObserverOptions, UseIntersectionObserverResult, type UseModelOptions, UseNavigationBarMetricsOptions, UsePageScrollThrottleOptions, UsePageScrollThrottleStopHandle, UsePageStackOptions, UseScrollOffsetOptions, UseSelectorFieldsOptions, UseSelectorQueryOptions, UseUpdatePerformanceListenerStopHandle, type VNode, type VNodeProps, type WatchCallback, type WatchEffect, type WatchEffectOptions, type WatchMultiSources, type WatchOptions, type WatchScheduler, type WatchSource, type WatchSourceValue, type WatchSources, type WatchStopHandle, type WeappCSSProperties, type WeappDatasetAttributes, type WeappHtmlAliasIntrinsicElements, type WeappIntrinsicElementBaseAttributes, type WeappIntrinsicElements, type WeappIntrinsicEventHandler, type WechatMiniProgramHostNamespace, type WechatMiniProgramHostSourceContract, WevuComponentConstructor, type WevuDefaults, WevuDefinedComponent, WevuGlobalComponents, WevuGlobalDirectives, WevuPageLayoutMap, type WevuPlugin, type WevuTypedRouterRouteMap, type WritableComputedOptions, type WritableComputedRef, addMutationRecorder, batch, callHookList, callHookReturn, callUpdateHooks, computed, createApp, createStore, createWevuComponent, createWevuScopedSlotComponent, customRef, defineAppSetup, defineComponent, defineEmits, defineExpose, defineModel, defineOptions, definePageMeta, defineProps, defineSlots, defineStore, effect, effectScope, endBatch, getCurrentInstance, getCurrentPageStackSnapshot, getCurrentScope, getCurrentSetupContext, getDeepWatchStrategy, getNavigationBarMetrics, getReactiveVersion, hasInjectionContext, inject, injectGlobal, isNoSetData, isProxy, isRaw, isReactive, isReadonly, isRef, isShallowReactive, isShallowRef, markNoSetData, markRaw, mergeModels, mountRuntimeInstance, nextTick, normalizeClass, normalizeStyle, onActivated, onAddToFavorites, onAttached, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onDetached, onError, onErrorCaptured, onHide, onLaunch, onLoad, onMemoryWarning, onMounted, onMoved, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onResize, onRouteDone, onSaveExitState, onScopeDispose, onServerPrefetch, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, onUnmounted, onUpdated, prelinkReactiveTree, provide, provideGlobal, reactive, readonly, ref, registerApp, registerComponent, registerPageLayoutBridge, registerRuntimeLayoutHosts, removeMutationRecorder, resetWevuDefaults, resolveLayoutBridge, resolveLayoutHost, resolvePropValue, resolveRuntimePageLayoutName, runSetupFunction, setCurrentInstance, setCurrentSetupContext, setDeepWatchStrategy, setGlobalProvidedValue, setPageLayout, setRuntimeSetDataVisibility, setWevuDefaults, shallowReactive, shallowReadonly, shallowRef, startBatch, stop, storeToRefs, syncRuntimePageLayoutState, syncRuntimePageLayoutStateFromRuntime, teardownRuntimeInstance, toRaw, toRef, toRefs, toValue, touchReactive, traverse, triggerRef, unref, unregisterPageLayoutBridge, unregisterRuntimeLayoutHosts, use, useAsyncPullDownRefresh, useAttrs, useBindModel, useBoundingClientRect, useChangeModel, useDisposables, useElementIntersectionObserver, useIntersectionObserver, useLayoutBridge, useLayoutHosts, useModel, useNativeInstance, useNativePageRouter, useNativeRouter, useNavigationBarMetrics, usePageLayout, usePageScrollThrottle, usePageStack, useScrollOffset, useSelectorFields, useSelectorQuery, useSlots, useTemplateRef, useUpdatePerformanceListener, version, waitForLayoutHost, watch, watchEffect, watchPostEffect, watchSyncEffect, withDefaults };
72
+ export { type ActionContext, type ActionSubscriber, type AlipayMiniProgramHostNamespace, type AlipayMiniProgramHostSourceContract, type AllowedComponentProps, type AppConfig, type ComponentCustomProps, type ComponentDefinition, type ComponentOptionsMixin, type ComponentPropsOptions, type ComponentPublicInstance, type ComponentTypeEmits, type ComputedDefinitions, type ComputedGetter, type ComputedRef, type ComputedSetter, type CreateAppOptions, type CustomRefFactory, type CustomRefOptions, type CustomRefSource, type DataOption, type DefaultMiniProgramHostNamespace, type DefaultMiniProgramHostSourceContract, type DefineAppOptions, type DefineComponent, type DefineComponentOptions, type DefineComponentTypePropsOptions, type DefineComponentWithTypeProps, DefineModelModifiers, DefineModelTransformOptions, type DefineStoreOptions, DisposableBag, DisposableLike, DisposableMethodName, DisposableObject, type DouyinMiniProgramHostNamespace, type DouyinMiniProgramHostSourceContract, type EffectScope, ElementIntersectionObserverCallback, type EmitFn, type EmitsOptions, type ExtractComputed, type ExtractDefaultPropTypes, type ExtractMethods, type ExtractPropTypes, type ExtractPublicPropTypes, GlobalComponents, GlobalDirectives, type HostMiniProgramAddToFavoritesOption, type HostMiniProgramAppOptions, type HostMiniProgramAppTrivialInstance, type HostMiniProgramBehaviorIdentifier, type HostMiniProgramBoundingClientRectResult, type HostMiniProgramComponentAllFullProperty, type HostMiniProgramComponentAllProperty, type HostMiniProgramComponentBehaviorOptions, type HostMiniProgramComponentEmptyArray, type HostMiniProgramComponentInstance, type HostMiniProgramComponentMethodOption, type HostMiniProgramComponentPropertyOption, type HostMiniProgramComponentPropertyValue, type HostMiniProgramComponentShortProperty, type HostMiniProgramComponentTrivialInstance, type HostMiniProgramComponentTrivialOption, type HostMiniProgramIntersectionObserver, type HostMiniProgramIntersectionObserverOptions, type HostMiniProgramLaunchOptions, type HostMiniProgramMemoryWarningResult, type HostMiniProgramNavigateToOption, type HostMiniProgramNodesRef, type HostMiniProgramNodesRefFields, type HostMiniProgramPageLifetime, type HostMiniProgramPageNotFoundOptions, type HostMiniProgramPageResizeOption, type HostMiniProgramPageScrollOption, type HostMiniProgramPageTrivialInstance, type HostMiniProgramReLaunchOption, type HostMiniProgramRedirectToOption, type HostMiniProgramRouter, type HostMiniProgramSaveExitState, type HostMiniProgramScrollOffsetResult, type HostMiniProgramSelectorQuery, type HostMiniProgramShareAppMessageOption, type HostMiniProgramSwitchTabOption, type HostMiniProgramTabItemTapOption, type HostMiniProgramThemeChangeResult, type HostMiniProgramTriggerEventOptions, type HostMiniProgramUnhandledRejectionResult, type InferNativePropType, type InferNativeProps, type InferPropType, type InferProps, type InternalRuntimeState, type InternalRuntimeStateFields, LayoutBridgeInstance, LayoutHostBinding, type MapSources, type MaybeRef, type MaybeRefOrGetter, type MaybeUndefined, type MethodDefinitions, type MiniProgramAdapter, type HostMiniProgramAddToFavoritesOption as MiniProgramAddToFavoritesOption, type MiniProgramAppOptions, type MiniProgramBehaviorIdentifier, type HostMiniProgramBoundingClientRectResult as MiniProgramBoundingClientRectResult, type MiniProgramCSSProperties, type HostMiniProgramComponentAllFullProperty as MiniProgramComponentAllFullProperty, type HostMiniProgramComponentAllProperty as MiniProgramComponentAllProperty, type HostMiniProgramComponentBehaviorOptions as MiniProgramComponentBehaviorOptions, type HostMiniProgramComponentEmptyArray as MiniProgramComponentEmptyArray, type MiniProgramComponentInstance, type HostMiniProgramComponentMethodOption as MiniProgramComponentMethodOption, type MiniProgramComponentOptions, type HostMiniProgramComponentPropertyOption as MiniProgramComponentPropertyOption, type MiniProgramComponentPropertyValue, type MiniProgramComponentRawOptions, type HostMiniProgramComponentShortProperty as MiniProgramComponentShortProperty, type MiniProgramDatasetAttributes, type MiniProgramHostNamespace, type MiniProgramHostNamespaceBySource, type MiniProgramHostSourceName, type MiniProgramHostSourceRegistry, type MiniProgramHtmlAliasIntrinsicElements, type MiniProgramInstance, type HostMiniProgramIntersectionObserver as MiniProgramIntersectionObserver, type HostMiniProgramIntersectionObserverOptions as MiniProgramIntersectionObserverOptions, type MiniProgramIntrinsicElementBaseAttributes, type MiniProgramIntrinsicElements, type MiniProgramIntrinsicEventHandler, type HostMiniProgramLaunchOptions as MiniProgramLaunchOptions, type HostMiniProgramMemoryWarningResult as MiniProgramMemoryWarningResult, type HostMiniProgramNavigateToOption as MiniProgramNavigateToOption, type HostMiniProgramNodesRef as MiniProgramNodesRef, type HostMiniProgramNodesRefFields as MiniProgramNodesRefFields, type HostMiniProgramPageLifetime as MiniProgramPageLifetime, type MiniProgramPageLifetimes, type HostMiniProgramPageNotFoundOptions as MiniProgramPageNotFoundOptions, type HostMiniProgramPageResizeOption as MiniProgramPageResizeOption, type HostMiniProgramPageScrollOption as MiniProgramPageScrollOption, type MiniProgramPlatformHostNamespaceBySource, type MiniProgramPlatformHostSourceName, type MiniProgramPlatformHostSourceRegistry, type HostMiniProgramReLaunchOption as MiniProgramReLaunchOption, type HostMiniProgramRedirectToOption as MiniProgramRedirectToOption, type HostMiniProgramRouter as MiniProgramRouter, type MiniProgramRouterNavigateToOption, type MiniProgramRouterReLaunchOption, type MiniProgramRouterRedirectToOption, type MiniProgramRouterSwitchTabOption, type MiniProgramRuntimeHostNamespaceBySource, type MiniProgramRuntimeHostSourceName, type MiniProgramRuntimeHostSourceRegistry, type HostMiniProgramSaveExitState as MiniProgramSaveExitState, type HostMiniProgramScrollOffsetResult as MiniProgramScrollOffsetResult, type HostMiniProgramSelectorQuery as MiniProgramSelectorQuery, type HostMiniProgramShareAppMessageOption as MiniProgramShareAppMessageOption, type HostMiniProgramSwitchTabOption as MiniProgramSwitchTabOption, type HostMiniProgramTabItemTapOption as MiniProgramTabItemTapOption, MiniProgramTemplateRefValue, type HostMiniProgramThemeChangeResult as MiniProgramThemeChangeResult, type HostMiniProgramUnhandledRejectionResult as MiniProgramUnhandledRejectionResult, type ModelBinding, type ModelBindingOptions, type ModelBindingPayload, type ModelModifiers, ModelRef, type MultiWatchSources, type MutationKind, type MutationOp, type MutationRecord, type MutationType, type NativeComponent, type NativePropType, type NativePropsOptions, type NativeTypeHint, type NativeTypedProperty, NavigationBarMetrics, type ObjectDirective, type OnCleanup, type PageFeatures, PageLayoutMeta, PageLayoutState, PageMeta, PageStackSnapshot, type PrelinkReactiveTreeOptions, type PropConstructor, type PropOptions, type PropType, type PublicProps, PullDownRefreshHandler, type Ref, type RuntimeApp, type RuntimeInstance, type SetDataDebugInfo, type SetDataSnapshotOptions, type SetupContext, type SetupContextNativeInstance, type SetupContextRouter, type SetupContextWithTypeProps, type SetupFunction, type SetupFunctionWithTypeProps, type ShallowRef, type ShallowUnwrapRef, type StoreManager, type StoreSubscribeOptions, type StoreToRefsResult, type SubscriptionCallback, type TemplateRef, TemplateRefValue, TemplateRefs, type ToRefs, type HostMiniProgramTriggerEventOptions as TriggerEventOptions, type TtMiniProgramHostNamespace, type TtMiniProgramHostSourceContract, UpdatePerformanceListener, UpdatePerformanceListenerResult, UseAllBoundingClientRectOptions, UseAllScrollOffsetOptions, UseAllSelectorFieldsOptions, UseAsyncPullDownRefreshOptions, UseBoundingClientRectOptions, UseElementIntersectionObserverOptions, UseElementIntersectionObserverReturn, UseIntersectionObserverOptions, UseIntersectionObserverResult, type UseModelOptions, UseNavigationBarMetricsOptions, UsePageScrollThrottleOptions, UsePageScrollThrottleStopHandle, UsePageStackOptions, UseScrollOffsetOptions, UseSelectorFieldsOptions, UseSelectorQueryOptions, UseUpdatePerformanceListenerStopHandle, type VNode, type VNodeProps, type WatchCallback, type WatchEffect, type WatchEffectOptions, type WatchMultiSources, type WatchOptions, type WatchScheduler, type WatchSource, type WatchSourceValue, type WatchSources, type WatchStopHandle, type WeappCSSProperties, type WeappDatasetAttributes, type WeappHtmlAliasIntrinsicElements, type WeappIntrinsicElementBaseAttributes, type WeappIntrinsicElements, type WeappIntrinsicEventHandler, type WechatMiniProgramHostNamespace, type WechatMiniProgramHostSourceContract, type WevuComponentConstructor, type WevuDefaults, type WevuDefinedComponent, WevuGlobalComponents, WevuGlobalDirectives, WevuPageLayoutMap, type WevuPlugin, type WevuTypedRouterRouteMap, type WritableComputedOptions, type WritableComputedRef, addMutationRecorder, batch, callHookList, callHookReturn, callUpdateHooks, computed, createApp, createStore, createWevuComponent, createWevuScopedSlotComponent, customRef, defineAppSetup, defineComponent, defineEmits, defineExpose, defineModel, defineOptions, definePageMeta, defineProps, defineSlots, defineStore, effect, effectScope, endBatch, getCurrentInstance, getCurrentPageStackSnapshot, getCurrentScope, getCurrentSetupContext, getDeepWatchStrategy, getNavigationBarMetrics, getReactiveVersion, hasInjectionContext, inject, injectGlobal, isNoSetData, isProxy, isRaw, isReactive, isReadonly, isRef, isShallowReactive, isShallowRef, markNoSetData, markRaw, mergeModels, mountRuntimeInstance, nextTick, normalizeClass, normalizeStyle, onActivated, onAddToFavorites, onAttached, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onDetached, onError, onErrorCaptured, onHide, onLaunch, onLoad, onMemoryWarning, onMounted, onMoved, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onResize, onRouteDone, onSaveExitState, onScopeDispose, onServerPrefetch, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, onUnmounted, onUpdated, prelinkReactiveTree, provide, provideGlobal, reactive, readonly, ref, registerApp, registerComponent, registerPageLayoutBridge, registerRuntimeLayoutHosts, removeMutationRecorder, resetWevuDefaults, resolveLayoutBridge, resolveLayoutHost, resolvePropValue, resolveRuntimePageLayoutName, runSetupFunction, setCurrentInstance, setCurrentSetupContext, setDeepWatchStrategy, setGlobalProvidedValue, setPageLayout, setRuntimeSetDataVisibility, setWevuDefaults, shallowReactive, shallowReadonly, shallowRef, startBatch, stop, storeToRefs, syncRuntimePageLayoutState, syncRuntimePageLayoutStateFromRuntime, teardownRuntimeInstance, toRaw, toRef, toRefs, toValue, touchReactive, traverse, triggerRef, unref, unregisterPageLayoutBridge, unregisterRuntimeLayoutHosts, use, useAsyncPullDownRefresh, useAttrs, useBindModel, useBoundingClientRect, useChangeModel, useDisposables, useElementIntersectionObserver, useIntersectionObserver, useLayoutBridge, useLayoutHosts, useModel, useNativeInstance, useNativePageRouter, useNativeRouter, useNavigationBarMetrics, usePageLayout, usePageScrollThrottle, usePageStack, useScrollOffset, useSelectorFields, useSelectorQuery, useSlots, useTemplateRef, useUpdatePerformanceListener, version, waitForLayoutHost, watch, watchEffect, watchPostEffect, watchSyncEffect, withDefaults };
@@ -1,6 +1,6 @@
1
1
  import { createApp } from "./runtime/app.mjs";
2
- import { resetWevuDefaults, setWevuDefaults } from "./runtime/defaults.mjs";
3
- import { createWevuComponent, createWevuScopedSlotComponent, defineComponent } from "./runtime/define.mjs";
2
+ import { INTERNAL_DEFAULTS_SCOPE_KEY, resetWevuDefaults, setWevuDefaults } from "./runtime/defaults.mjs";
3
+ import { createIsolatedWevuComponentDefinition, createWevuComponent, createWevuComponentDefinition, createWevuScopedSlotComponent, defineComponent, getWevuComponentLifecycleDefinition } from "./runtime/define.mjs";
4
4
  import { useDisposables } from "./runtime/disposables.mjs";
5
5
  import { useElementIntersectionObserver } from "./runtime/elementIntersectionObserver.mjs";
6
6
  import { callHookList, callHookReturn, getCurrentInstance, getCurrentSetupContext, setCurrentInstance, setCurrentSetupContext } from "./runtime/hooks/base.mjs";
@@ -33,4 +33,4 @@ import { version } from "./version.mjs";
33
33
  import { takePendingRuntimeAppRegistration } from "./runtime/app/pending.mjs";
34
34
  import { Fragment, createTextVNode, createVNode, isVNode, mergeProps, normalizeJsxIsland, resolveComponent, resolveDirective, transformOn, vModelCheckbox, vModelRadio, vModelSelect, vModelText, vShow, withDirectives } from "./runtime/jsxIsland.mjs";
35
35
  import { createUniAppHost } from "./runtime/uniAppHost.mjs";
36
- export { Fragment, callHookList, callHookReturn, createApp, createTextVNode, createUniAppHost, createVNode, createWevuComponent, createWevuScopedSlotComponent, defineAppSetup, defineComponent, getCurrentInstance, getCurrentPageStackSnapshot, getCurrentSetupContext, getNavigationBarMetrics, hasInjectionContext, inject, injectGlobal, isNoSetData, isVNode, markNoSetData, mergeModels, mergeProps, mountRuntimeInstance, normalizeJsxIsland, onActivated, onAddToFavorites, onAttached, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onDetached, onError, onErrorCaptured, onHide, onLaunch, onLoad, onMemoryWarning, onMounted, onMoved, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onResize, onRouteDone, onSaveExitState, onServerPrefetch, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, onUnmounted, onUpdated, provide, provideGlobal, registerApp, registerComponent, resetWevuDefaults, resolveComponent, resolveDirective, resolveLayoutBridge, resolveLayoutHost, resolveRuntimePageLayoutName, runSetupFunction, setCurrentInstance, setCurrentSetupContext, setGlobalProvidedValue, setPageLayout, setRuntimeSetDataVisibility, setWevuDefaults, syncRuntimePageLayoutState, syncRuntimePageLayoutStateFromRuntime, takePendingRuntimeAppRegistration, teardownRuntimeInstance, transformOn, use, useAsyncPullDownRefresh, useAttrs, useBindModel, useBoundingClientRect, useChangeModel, useDisposables, useElementIntersectionObserver, useIntersectionObserver, useLayoutBridge, useLayoutHosts, useModel, useNativeInstance, useNativePageRouter, useNativeRouter, useNavigationBarMetrics, usePageLayout, usePageScrollThrottle, usePageStack, useScrollOffset, useSelectorFields, useSelectorQuery, useSlots, useTemplateRef, useUpdatePerformanceListener, vModelCheckbox, vModelRadio, vModelSelect, vModelText, vShow, version, waitForLayoutHost, withDirectives };
36
+ export { Fragment, INTERNAL_DEFAULTS_SCOPE_KEY, callHookList, callHookReturn, createApp, createIsolatedWevuComponentDefinition, createTextVNode, createUniAppHost, createVNode, createWevuComponent, createWevuComponentDefinition, createWevuScopedSlotComponent, defineAppSetup, defineComponent, getCurrentInstance, getCurrentPageStackSnapshot, getCurrentSetupContext, getNavigationBarMetrics, getWevuComponentLifecycleDefinition, hasInjectionContext, inject, injectGlobal, isNoSetData, isVNode, markNoSetData, mergeModels, mergeProps, mountRuntimeInstance, normalizeJsxIsland, onActivated, onAddToFavorites, onAttached, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onDetached, onError, onErrorCaptured, onHide, onLaunch, onLoad, onMemoryWarning, onMounted, onMoved, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onResize, onRouteDone, onSaveExitState, onServerPrefetch, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, onUnmounted, onUpdated, provide, provideGlobal, registerApp, registerComponent, resetWevuDefaults, resolveComponent, resolveDirective, resolveLayoutBridge, resolveLayoutHost, resolveRuntimePageLayoutName, runSetupFunction, setCurrentInstance, setCurrentSetupContext, setGlobalProvidedValue, setPageLayout, setRuntimeSetDataVisibility, setWevuDefaults, syncRuntimePageLayoutState, syncRuntimePageLayoutStateFromRuntime, takePendingRuntimeAppRegistration, teardownRuntimeInstance, transformOn, use, useAsyncPullDownRefresh, useAttrs, useBindModel, useBoundingClientRect, useChangeModel, useDisposables, useElementIntersectionObserver, useIntersectionObserver, useLayoutBridge, useLayoutHosts, useModel, useNativeInstance, useNativePageRouter, useNativeRouter, useNavigationBarMetrics, usePageLayout, usePageScrollThrottle, usePageStack, useScrollOffset, useSelectorFields, useSelectorQuery, useSlots, useTemplateRef, useUpdatePerformanceListener, vModelCheckbox, vModelRadio, vModelSelect, vModelText, vShow, version, waitForLayoutHost, withDirectives };
@@ -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{resetWevuDefaults as W,setWevuDefaults as G}from"./runtime/defaults.mjs";import{setGlobalProvidedValue as K}from"./runtime/provideStore.mjs";import{resolveRuntimePageLayoutName as q,setPageLayout as J,syncRuntimePageLayoutState as Y,syncRuntimePageLayoutStateFromRuntime as X,usePageLayout as Z}from"./runtime/pageLayout.mjs";import{runSetupFunction as Q}from"./runtime/register/setup.mjs";import{mountRuntimeInstance as $,setRuntimeSetDataVisibility as ee,teardownRuntimeInstance as te}from"./runtime/register/runtimeInstance.mjs";import{registerApp as ne}from"./runtime/register/app.mjs";import{Fragment as re,createTextVNode as ie,createVNode as ae,isVNode as oe,mergeProps as se,normalizeJsxIsland as ce,resolveComponent as le,resolveDirective as ue,transformOn as de,vModelCheckbox as fe,vModelRadio as pe,vModelSelect as me,vModelText as he,vShow as ge,withDirectives as _e}from"./runtime/jsxIsland.mjs";import{resolveLayoutBridge as ve,resolveLayoutHost as ye,useLayoutBridge as be,useLayoutHosts as xe,waitForLayoutHost as Se}from"./runtime/layoutBridge.mjs";import{registerComponent as Ce}from"./runtime/register/component.mjs";import{createApp as we}from"./runtime/app.mjs";import{hasInjectionContext as Te,inject as Ee,injectGlobal as De,provide as Oe,provideGlobal as ke}from"./runtime/provide.mjs";import{createWevuComponent as Ae,createWevuScopedSlotComponent as je,defineComponent as Me}from"./runtime/define.mjs";import{useDisposables as Ne}from"./runtime/disposables.mjs";import{useElementIntersectionObserver as Pe}from"./runtime/elementIntersectionObserver.mjs";import{useIntersectionObserver as Fe}from"./runtime/intersectionObserver.mjs";import{getCurrentPageStackSnapshot as Ie,getNavigationBarMetrics as Le,useNavigationBarMetrics as Re,usePageStack as ze}from"./runtime/pageEnvironment.mjs";import{usePageScrollThrottle as Be}from"./runtime/pageScroll.mjs";import{useAsyncPullDownRefresh as Ve}from"./runtime/pullDownRefresh.mjs";import{useBoundingClientRect as He,useScrollOffset as Ue,useSelectorFields as We,useSelectorQuery as Ge}from"./runtime/selectorQuery.mjs";import{useUpdatePerformanceListener as Ke}from"./runtime/updatePerformance.mjs";import{defineAppSetup as qe,use as Je}from"./runtime/use.mjs";import{useAttrs as Ye,useNativeInstance as Xe,useSlots as Ze}from"./runtime/vueCompat/context.mjs";import{mergeModels as Qe,useBindModel as $e,useChangeModel as et,useModel as tt}from"./runtime/vueCompat/model.mjs";import{useNativePageRouter as nt,useNativeRouter as rt}from"./runtime/vueCompat/router.mjs";import{useTemplateRef as it}from"./runtime/vueCompat/templateRef.mjs";import{createUniAppHost as at}from"./runtime/uniAppHost.mjs";export{re as Fragment,e as callHookList,t as callHookReturn,we as createApp,ie as createTextVNode,at as createUniAppHost,ae as createVNode,Ae as createWevuComponent,je as createWevuScopedSlotComponent,qe as defineAppSetup,Me as defineComponent,n as getCurrentInstance,Ie as getCurrentPageStackSnapshot,r as getCurrentSetupContext,Le as getNavigationBarMetrics,Te as hasInjectionContext,Ee as inject,De as injectGlobal,V as isNoSetData,oe as isVNode,H as markNoSetData,Qe as mergeModels,se as mergeProps,$ as mountRuntimeInstance,ce 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,Oe as provide,ke as provideGlobal,ne as registerApp,Ce as registerComponent,W as resetWevuDefaults,le as resolveComponent,ue as resolveDirective,ve as resolveLayoutBridge,ye as resolveLayoutHost,q as resolveRuntimePageLayoutName,Q as runSetupFunction,i as setCurrentInstance,a as setCurrentSetupContext,K as setGlobalProvidedValue,J as setPageLayout,ee as setRuntimeSetDataVisibility,G as setWevuDefaults,Y as syncRuntimePageLayoutState,X as syncRuntimePageLayoutStateFromRuntime,U as takePendingRuntimeAppRegistration,te as teardownRuntimeInstance,de as transformOn,Je as use,Ve as useAsyncPullDownRefresh,Ye as useAttrs,$e as useBindModel,He as useBoundingClientRect,et as useChangeModel,Ne as useDisposables,Pe as useElementIntersectionObserver,Fe as useIntersectionObserver,be as useLayoutBridge,xe as useLayoutHosts,tt as useModel,Xe as useNativeInstance,nt as useNativePageRouter,rt as useNativeRouter,Re as useNavigationBarMetrics,Z as usePageLayout,Be as usePageScrollThrottle,ze as usePageStack,Ue as useScrollOffset,We as useSelectorFields,Ge as useSelectorQuery,Ze as useSlots,it as useTemplateRef,Ke as useUpdatePerformanceListener,fe as vModelCheckbox,pe as vModelRadio,me as vModelSelect,he as vModelText,ge as vShow,B as version,Se as waitForLayoutHost,_e as withDirectives};
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{Fragment as ie,createTextVNode as ae,createVNode as oe,isVNode as se,mergeProps as ce,normalizeJsxIsland as le,resolveComponent as ue,resolveDirective as de,transformOn as fe,vModelCheckbox as pe,vModelRadio as me,vModelSelect as he,vModelText as ge,vShow as _e,withDirectives as ve}from"./runtime/jsxIsland.mjs";import{resolveLayoutBridge as ye,resolveLayoutHost as be,useLayoutBridge as xe,useLayoutHosts as Se,waitForLayoutHost as Ce}from"./runtime/layoutBridge.mjs";import{registerComponent as we}from"./runtime/register/component.mjs";import{createApp as Te}from"./runtime/app.mjs";import{hasInjectionContext as Ee,inject as De,injectGlobal as Oe,provide as ke,provideGlobal as Ae}from"./runtime/provide.mjs";import{createIsolatedWevuComponentDefinition as je,createWevuComponent as Me,createWevuComponentDefinition as Ne,createWevuScopedSlotComponent as Pe,defineComponent as Fe,getWevuComponentLifecycleDefinition as Ie}from"./runtime/define.mjs";import{useDisposables as Le}from"./runtime/disposables.mjs";import{useElementIntersectionObserver as Re}from"./runtime/elementIntersectionObserver.mjs";import{useIntersectionObserver as ze}from"./runtime/intersectionObserver.mjs";import{getCurrentPageStackSnapshot as Be,getNavigationBarMetrics as Ve,useNavigationBarMetrics as He,usePageStack as Ue}from"./runtime/pageEnvironment.mjs";import{usePageScrollThrottle as We}from"./runtime/pageScroll.mjs";import{useAsyncPullDownRefresh as Ge}from"./runtime/pullDownRefresh.mjs";import{useBoundingClientRect as Ke,useScrollOffset as qe,useSelectorFields as Je,useSelectorQuery as Ye}from"./runtime/selectorQuery.mjs";import{useUpdatePerformanceListener as Xe}from"./runtime/updatePerformance.mjs";import{defineAppSetup as Ze,use as Qe}from"./runtime/use.mjs";import{useAttrs as $e,useNativeInstance as et,useSlots as tt}from"./runtime/vueCompat/context.mjs";import{mergeModels as nt,useBindModel as rt,useChangeModel as it,useModel as at}from"./runtime/vueCompat/model.mjs";import{useNativePageRouter as ot,useNativeRouter as st}from"./runtime/vueCompat/router.mjs";import{useTemplateRef as ct}from"./runtime/vueCompat/templateRef.mjs";import{createUniAppHost as lt}from"./runtime/uniAppHost.mjs";export{ie as Fragment,W as INTERNAL_DEFAULTS_SCOPE_KEY,e as callHookList,t as callHookReturn,Te as createApp,je as createIsolatedWevuComponentDefinition,ae as createTextVNode,lt as createUniAppHost,oe as createVNode,Me as createWevuComponent,Ne as createWevuComponentDefinition,Pe as createWevuScopedSlotComponent,Ze as defineAppSetup,Fe as defineComponent,n as getCurrentInstance,Be as getCurrentPageStackSnapshot,r as getCurrentSetupContext,Ve as getNavigationBarMetrics,Ie as getWevuComponentLifecycleDefinition,Ee as hasInjectionContext,De as inject,Oe as injectGlobal,V as isNoSetData,se as isVNode,H as markNoSetData,nt as mergeModels,ce as mergeProps,ee as mountRuntimeInstance,le 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,ke as provide,Ae as provideGlobal,re as registerApp,we as registerComponent,G as resetWevuDefaults,ue as resolveComponent,de as resolveDirective,ye as resolveLayoutBridge,be 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,fe as transformOn,Qe as use,Ge as useAsyncPullDownRefresh,$e as useAttrs,rt as useBindModel,Ke as useBoundingClientRect,it as useChangeModel,Le as useDisposables,Re as useElementIntersectionObserver,ze as useIntersectionObserver,xe as useLayoutBridge,Se as useLayoutHosts,at as useModel,et as useNativeInstance,ot as useNativePageRouter,st as useNativeRouter,He as useNavigationBarMetrics,Q as usePageLayout,We as usePageScrollThrottle,Ue as usePageStack,qe as useScrollOffset,Je as useSelectorFields,Ye as useSelectorQuery,tt as useSlots,ct as useTemplateRef,Xe as useUpdatePerformanceListener,pe as vModelCheckbox,me as vModelRadio,he as vModelSelect,ge as vModelText,_e as vShow,B as version,Ce as waitForLayoutHost,ve as withDirectives};
package/dist/package.mjs CHANGED
@@ -1 +1 @@
1
- var e=`6.20.4`;export{e as version};
1
+ var e=`6.21.0`;export{e as version};
@@ -1 +1 @@
1
- import{queueJob as e}from"../scheduler.mjs";import t from"../_virtual/_@oxc-project_runtime@0.144.0/helpers/esm/defineProperty.mjs";const n=new WeakMap;let r=null;const i=[];let a=0;const o=new Set;function s(){a++}function c(){for(;o.size;){let e=[...o];o.clear();for(let t of e)t()}}function l(){a!==0&&(a--,a===0&&c())}function u(e){s();try{return e()}finally{l()}}function d(e){let{deps:t}=e;for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}function f(e){var t;e.active&&(e.active=!1,d(e),(t=e.onStop)==null||t.call(e))}let p;var m=class{constructor(e=!1){if(this.detached=e,t(this,`active`,!0),t(this,`effects`,[]),t(this,`cleanups`,[]),t(this,`parent`,void 0),t(this,`scopes`,void 0),!e&&p){var n;this.parent=p,((n=p).scopes||(n.scopes=[])).push(this)}}run(e){if(!this.active)return;let t=p;p=this;try{return e()}finally{p=t}}stop(){var e;if(this.active){this.active=!1;for(let e of this.effects)f(e);this.effects.length=0;for(let e of this.cleanups)e();if(this.cleanups.length=0,this.scopes){for(let e of this.scopes)e.stop();this.scopes.length=0}if((e=this.parent)!=null&&e.scopes){let e=this.parent.scopes.indexOf(this);e>=0&&this.parent.scopes.splice(e,1)}this.parent=void 0}}};function h(e=!1){return new m(e)}function g(){return p}function _(e){p!=null&&p.active&&p.cleanups.push(e)}function v(e){p!=null&&p.active&&p.effects.push(e)}function y(e,t={}){let n=function(){if(!n.active||n._running)return e();d(n);try{return n._running=!0,i.push(n),r=n,e()}finally{var t;i.pop(),r=(t=i[i.length-1])==null?null:t,n._running=!1}};return n.deps=[],n.scheduler=t.scheduler,n.onStop=t.onStop,n.active=!0,n._running=!1,n._fn=e,n}function b(e,t={}){let n=y(e,t);return v(n),t.lazy||n(),n}function x(e,t){if(!r)return;let i=n.get(e);i||(i=new Map,n.set(e,i));let a=i.get(t);a||(a=new Set,i.set(t,a)),a.has(r)||(a.add(r),r.deps.push(a))}function S(e){if(e.scheduler){e.scheduler();return}if(a>0){o.add(e);return}e()}function C(e,t){let i=n.get(e);if(!i)return;let a=i.get(t);if(!a)return;let o=new Set;a.forEach(e=>{e!==r&&o.add(e)}),o.forEach(S)}function w(e){r&&(e.has(r)||(e.add(r),r.deps.push(e)))}function T(e){new Set(e).forEach(S)}export{u as batch,y as createReactiveEffect,b as effect,h as effectScope,l as endBatch,g as getCurrentScope,_ as onScopeDispose,e as queueJob,s as startBatch,f as stop,x as track,w as trackEffects,C as trigger,T as triggerEffects};
1
+ import{queueJob as e}from"../scheduler.mjs";import t from"../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/defineProperty.mjs";const n=new WeakMap;let r=null;const i=[];let a=0;const o=new Set;function s(){a++}function c(){for(;o.size;){let e=[...o];o.clear();for(let t of e)t()}}function l(){a!==0&&(a--,a===0&&c())}function u(e){s();try{return e()}finally{l()}}function d(e){let{deps:t}=e;for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}function f(e){var t;e.active&&(e.active=!1,d(e),(t=e.onStop)==null||t.call(e))}let p;var m=class{constructor(e=!1){if(this.detached=e,t(this,`active`,!0),t(this,`effects`,[]),t(this,`cleanups`,[]),t(this,`parent`,void 0),t(this,`scopes`,void 0),!e&&p){var n;this.parent=p,((n=p).scopes||(n.scopes=[])).push(this)}}run(e){if(!this.active)return;let t=p;p=this;try{return e()}finally{p=t}}stop(){var e;if(this.active){this.active=!1;for(let e of this.effects)f(e);this.effects.length=0;for(let e of this.cleanups)e();if(this.cleanups.length=0,this.scopes){for(let e of this.scopes)e.stop();this.scopes.length=0}if((e=this.parent)!=null&&e.scopes){let e=this.parent.scopes.indexOf(this);e>=0&&this.parent.scopes.splice(e,1)}this.parent=void 0}}};function h(e=!1){return new m(e)}function g(){return p}function _(e){p!=null&&p.active&&p.cleanups.push(e)}function v(e){p!=null&&p.active&&p.effects.push(e)}function y(e,t={}){let n=function(){if(!n.active||n._running)return e();d(n);try{return n._running=!0,i.push(n),r=n,e()}finally{var t;i.pop(),r=(t=i[i.length-1])==null?null:t,n._running=!1}};return n.deps=[],n.scheduler=t.scheduler,n.onStop=t.onStop,n.active=!0,n._running=!1,n._fn=e,n}function b(e,t={}){let n=y(e,t);return v(n),t.lazy||n(),n}function x(e,t){if(!r)return;let i=n.get(e);i||(i=new Map,n.set(e,i));let a=i.get(t);a||(a=new Set,i.set(t,a)),a.has(r)||(a.add(r),r.deps.push(a))}function S(e){if(e.scheduler){e.scheduler();return}if(a>0){o.add(e);return}e()}function C(e,t){let i=n.get(e);if(!i)return;let a=i.get(t);if(!a)return;let o=new Set;a.forEach(e=>{e!==r&&o.add(e)}),o.forEach(S)}function w(e){r&&(e.has(r)||(e.add(r),r.deps.push(e)))}function T(e){new Set(e).forEach(S)}export{u as batch,y as createReactiveEffect,b as effect,h as effectScope,l as endBatch,g as getCurrentScope,_ as onScopeDispose,e as queueJob,s as startBatch,f as stop,x as track,w as trackEffects,C as trigger,T as triggerEffects};
@@ -1 +1 @@
1
- import e from"../_virtual/_@oxc-project_runtime@0.144.0/helpers/esm/defineProperty.mjs";import{trackEffects as t,triggerEffects as n}from"./core.mjs";import{convertToReactive as r,markRaw as i}from"./reactive.mjs";const a=`__v_isRef`;function o(e){try{Object.defineProperty(e,a,{value:!0,configurable:!0})}catch(t){e[a]=!0}return e}function s(e){return!!(e&&typeof e==`object`&&e.__v_isRef===!0)}var c=class{constructor(t){e(this,`_value`,void 0),e(this,`_rawValue`,void 0),e(this,`dep`,void 0),o(this),this._rawValue=t,this._value=r(t)}get value(){return this.dep||(this.dep=new Set),t(this.dep),this._value}set value(e){Object.is(e,this._rawValue)||(this._rawValue=e,this._value=r(e),this.dep&&n(this.dep))}};function l(e){return s(e)?e:i(new c(e))}function u(e){return s(e)?e.value:e}function d(e){return typeof e==`function`?e():u(e)}var f=class{constructor(r,i){e(this,`_getValue`,void 0),e(this,`_setValue`,void 0),e(this,`dep`,void 0),o(this);let a=i,s=()=>{this.dep||(this.dep=new Set),t(this.dep)},c=()=>{this.dep&&n(this.dep)},l=e=>e===void 0&&a!==void 0?a:e;if(typeof r==`function`){let e=r(s,c);this._getValue=()=>l(e.get()),this._setValue=t=>e.set(t);return}let u=r;this._getValue=()=>(s(),l(u.get())),this._setValue=e=>{u.set(e),c()}}get value(){return this._getValue()}set value(e){this._setValue(e)}};function p(e,t){return i(new f(e,t))}export{a as RefFlag,p as customRef,s as isRef,o as markAsRef,l as ref,d as toValue,u as unref};
1
+ import e from"../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/defineProperty.mjs";import{trackEffects as t,triggerEffects as n}from"./core.mjs";import{convertToReactive as r,markRaw as i}from"./reactive.mjs";const a=`__v_isRef`;function o(e){try{Object.defineProperty(e,a,{value:!0,configurable:!0})}catch(t){e[a]=!0}return e}function s(e){return!!(e&&typeof e==`object`&&e.__v_isRef===!0)}var c=class{constructor(t){e(this,`_value`,void 0),e(this,`_rawValue`,void 0),e(this,`dep`,void 0),o(this),this._rawValue=t,this._value=r(t)}get value(){return this.dep||(this.dep=new Set),t(this.dep),this._value}set value(e){Object.is(e,this._rawValue)||(this._rawValue=e,this._value=r(e),this.dep&&n(this.dep))}};function l(e){return s(e)?e:i(new c(e))}function u(e){return s(e)?e.value:e}function d(e){return typeof e==`function`?e():u(e)}var f=class{constructor(r,i){e(this,`_getValue`,void 0),e(this,`_setValue`,void 0),e(this,`dep`,void 0),o(this);let a=i,s=()=>{this.dep||(this.dep=new Set),t(this.dep)},c=()=>{this.dep&&n(this.dep)},l=e=>e===void 0&&a!==void 0?a:e;if(typeof r==`function`){let e=r(s,c);this._getValue=()=>l(e.get()),this._setValue=t=>e.set(t);return}let u=r;this._getValue=()=>(s(),l(u.get())),this._setValue=e=>{u.set(e),c()}}get value(){return this._getValue()}set value(e){this._setValue(e)}};function p(e,t){return i(new f(e,t))}export{a as RefFlag,p as customRef,s as isRef,o as markAsRef,l as ref,d as toValue,u as unref};
@@ -1 +1 @@
1
- import{nextTick as e}from"../../scheduler.mjs";import{toRaw as t}from"../../reactivity/reactive/shared.mjs";import{isRef as n,ref as r}from"../../reactivity/ref.mjs";import{hasOwn as i}from"../../utils.mjs";import{setComputedValue as a}from"../internal.mjs";import{normalizeEmitEventName as o,normalizeEmitPayload as s}from"../emit.mjs";import{isNativeBridgeMethod as c,markNativeBridgeMethod as l}from"../nativeBridge.mjs";import{createComputedAccessors as u}from"./computed.mjs";import{WEVU_COMPONENT_NAME_KEY as d,WEVU_INLINE_MAP_KEY as f,WEVU_NATIVE_INSTANCE_KEY as p,WEVU_PARENT_INSTANCE_KEY as m,WEVU_PROPS_KEY as h,WEVU_RESOLVE_PUBLIC_INSTANCE_METHOD as g,WEVU_RUNTIME_APP_KEY as _,WEVU_RUNTIME_KEY as v}from"@weapp-core/constants";function y(y){let{state:b,setupState:x,computedDefs:S,methodDefs:C,appConfig:w,includeComputed:T,setDataStrategy:E}=y,D={},{computedRefs:O,computedSetters:k,dirtyComputedKeys:A,createTrackedComputed:j,computedProxy:M}=u({includeComputed:T,setDataStrategy:E}),N=r(0),P=Object.create(null),F=(e,n)=>{let r=t(e),i=r[v],a=i==null?void 0:i.proxy,o=(e,t)=>{let n=e[t];return c(n)},s=t=>!(!t||typeof t!=`object`||t===e||t===n||t===a||o(t,`triggerEvent`)||o(t,`createSelectorQuery`)||o(t,`createIntersectionObserver`)||o(t,`setData`)),l=r[p];if(s(l))return l;let u=i==null?void 0:i.instance;if(s(u))return u},I=e=>{if(i(D,e))return;let t=(...t)=>{let n=F(b,b);if(!n)return;let r=Reflect.get(n,e);if(typeof r==`function`)return r.apply(n,t)};l(t),D[e]=t},L=(e,t)=>{let n=new Set,r=e;for(;r&&!n.has(r);){var a;n.add(r);let e=(a=r[_])==null||(a=a.config)==null?void 0:a.globalProperties;if(e&&i(e,t))return{found:!0,value:e[t]};r=r[m]}let o=typeof globalThis<`u`?globalThis.getApp:void 0;if(typeof o==`function`)try{var s;let e=o(),n=e==null||(s=e[_])==null||(s=s.config)==null?void 0:s.globalProperties;if(n&&i(n,t))return{found:!0,value:n[t]}}catch(e){}return{found:!1,value:void 0}},R=e=>{let t=e&&Reflect.get(e,`selectOwnerComponent`);if(typeof t==`function`)try{var n,r,i,a;let o=t.call(e);if(!o||typeof o!=`object`)return;let s=Reflect.get(o,g);if(typeof s==`function`){let e=s.call(o);if(e)return e}return(n=(r=(i=o[v])==null?void 0:i.proxy)==null?(a=o.__wevu)==null?void 0:a.proxy:r)==null?o:n}catch(e){return}},z=new Proxy(b,{get(n,r,a){if(typeof r==`string`){if(N.value,i(x,r))return Reflect.get(x,r,a);if(r===`props`){let e=n[h];if(e&&typeof e==`object`)return e}let p=n[h];if(p&&typeof p==`object`&&i(p,r))return Reflect.get(p,r);if(r===`data`||r===`$state`)return b;if(r===`$computed`)return M;if(r===`$emit`)return(e,...t)=>{let r=F(n,a),i=r&&Reflect.get(r,`triggerEvent`);if(typeof i!=`function`)return;let{detail:c,options:l}=s(t);return i.call(r,o(e),c,l)};if(r===`$nextTick`)return t=>t?e(()=>t.call(z)):e();if(r===`$set`)return(e,t,n)=>(Reflect.set(e,t,n),n);if(r===`$delete`)return(e,t)=>Reflect.deleteProperty(e,t);if(r===`$slots`){var c;return(c=t(n).$slots)==null?Object.freeze(Object.create(null)):c}if(r===`$refs`){var l;return(l=t(n).$refs)==null?Object.create(null):l}if(r===`$parent`)return R(F(n,a));if(r===`$options`){var u,f;let e=F(n,a);return{name:(u=(f=e==null?void 0:e[d])==null?e==null?void 0:e.name:f)==null?e==null?void 0:e.is:u}}if(i(P,r))return Reflect.get(P,r);if(i(D,r))return D[r];if(O[r])return O[r].value;if(i(w.globalProperties,r))return w.globalProperties[r];let m=L(F(n,a),r);if(m.found)return m.value}if(!Reflect.has(n,r)){let e=F(n,a);if(e&&Reflect.has(e,r)){let t=Reflect.get(e,r);return typeof t==`function`?t.bind(e):t}}let p=Reflect.get(n,r,a);return typeof r==`string`&&i(x,r)?Reflect.get(x,r,a):p},set(e,t,r,o){if(typeof t==`string`&&O[t])return a(k,t,r),!0;if(i(x,t)){let e=Reflect.get(x,t,o);return n(e)&&!n(r)?(e.value=r,!0):Reflect.set(x,t,r,o)}if(i(P,t))return Reflect.set(P,t,r);if(Reflect.has(e,t)){var s;let a=Reflect.get(e,t,o);return n(a)&&!n(r)?(a.value=r,!0):i((s=e[h])==null?{}:s,t)?Reflect.set(x,t,r,o):Reflect.set(e,t,r,o)}return Reflect.set(P,t,r)},has(e,t){if(t===`data`||t===`$emit`||t===`$nextTick`||t===`$set`||t===`$delete`||t===`$slots`||t===`$refs`||t===`$parent`||t===`$options`||typeof t==`string`&&(i(x,t)||O[t]||i(D,t))||i(P,t))return!0;let n=F(e,e);return typeof t==`string`&&L(n,t).found||n&&Reflect.has(n,t)?!0:Reflect.has(e,t)},ownKeys(e){let t=new Set;return Reflect.ownKeys(e).forEach(e=>{t.add(e)}),Reflect.ownKeys(x).forEach(e=>{t.add(e)}),Reflect.ownKeys(P).forEach(e=>t.add(e)),Object.keys(D).forEach(e=>t.add(e)),Object.keys(O).forEach(e=>t.add(e)),[...t]},getOwnPropertyDescriptor(e,t){if(typeof t==`string`&&i(x,t))return Object.getOwnPropertyDescriptor(x,t);if(i(P,t))return Object.getOwnPropertyDescriptor(P,t);if(Reflect.has(e,t))return Object.getOwnPropertyDescriptor(e,t);if(typeof t==`string`){if(t===`data`)return{configurable:!0,enumerable:!1,get(){return b}};if(O[t])return{configurable:!0,enumerable:!0,get(){return O[t].value},set(e){a(k,t,e)}};if(i(D,t))return{configurable:!0,enumerable:!1,value:D[t]}}}});return Object.keys(C).forEach(e=>{let t=C[e];if(typeof t==`function`){D[e]=(...e)=>t.apply(z,e);return}e===f&&t&&typeof t==`object`&&(D[e]=t)}),I(`triggerEvent`),I(`createSelectorQuery`),I(`createIntersectionObserver`),I(`setData`),Object.keys(S).forEach(e=>{let t=S[e];if(typeof t==`function`)O[e]=j(e,()=>t.call(z));else{var n,r;let i=(n=t.get)==null?void 0:n.bind(z);if(!i)throw Error(`计算属性 "${e}" 需要提供 getter`);let a=(r=t.set)==null?void 0:r.bind(z);a?(k[e]=a,O[e]=j(e,i,a)):O[e]=j(e,i)}}),{boundMethods:D,computedRefs:O,computedSetters:k,dirtyComputedKeys:A,computedProxy:M,publicInstance:z,touchSetupMethodsVersion(){N.value+=1}}}export{y as createRuntimeContext};
1
+ import{nextTick as e}from"../../scheduler.mjs";import{toRaw as t}from"../../reactivity/reactive/shared.mjs";import{isRef as n,ref as r}from"../../reactivity/ref.mjs";import{hasOwn as i}from"../../utils.mjs";import{setComputedValue as a}from"../internal.mjs";import{normalizeEmitEventName as o,normalizeEmitPayload as s}from"../emit.mjs";import{isNativeBridgeMethod as c,markNativeBridgeMethod as l}from"../nativeBridge.mjs";import{createComputedAccessors as u}from"./computed.mjs";import{WEVU_COMPONENT_NAME_KEY as d,WEVU_INLINE_MAP_KEY as f,WEVU_NATIVE_INSTANCE_KEY as p,WEVU_PARENT_INSTANCE_KEY as m,WEVU_PROPS_KEY as h,WEVU_RESOLVE_PUBLIC_INSTANCE_METHOD as g,WEVU_RUNTIME_APP_KEY as _,WEVU_RUNTIME_KEY as v}from"@weapp-core/constants";function y(y){let{state:b,setupState:x,computedDefs:S,methodDefs:C,appConfig:w,includeComputed:T,setDataStrategy:E}=y,D={},{computedRefs:O,computedSetters:k,dirtyComputedKeys:A,createTrackedComputed:j,computedProxy:M}=u({includeComputed:T,setDataStrategy:E}),N=r(0),P=Object.create(null),F=(e,n)=>{let r=t(e),i=r[v],a=i==null?void 0:i.proxy,o=(e,t)=>{let n=e[t];return c(n)},s=t=>!(!t||typeof t!=`object`||t===e||t===n||t===a||o(t,`triggerEvent`)||o(t,`createSelectorQuery`)||o(t,`createIntersectionObserver`)||o(t,`setData`)),l=r[p];if(s(l))return l;let u=i==null?void 0:i.instance;if(s(u))return u},I=e=>{if(i(D,e))return;let t=(...t)=>{let n=F(b,b);if(!n)return;let r=Reflect.get(n,e);if(typeof r==`function`)return r.apply(n,t)};l(t),D[e]=t},L=(e,t)=>{let n=new Set,r=e;for(;r&&!n.has(r);){var a;n.add(r);let e=(a=r[_])==null||(a=a.config)==null?void 0:a.globalProperties;if(e&&i(e,t))return{found:!0,value:e[t]};r=r[m]}let o=typeof globalThis<`u`?globalThis.getApp:void 0;if(typeof o==`function`)try{var s;let e=o(),n=e==null||(s=e[_])==null||(s=s.config)==null?void 0:s.globalProperties;if(n&&i(n,t))return{found:!0,value:n[t]}}catch(e){}return{found:!1,value:void 0}},R=e=>{let t=e&&Reflect.get(e,`selectOwnerComponent`);if(typeof t==`function`)try{var n,r,i,a;let o=t.call(e);if(!o||typeof o!=`object`)return;let s=Reflect.get(o,g);if(typeof s==`function`){let e=s.call(o);if(e)return e}return(n=(r=(i=o[v])==null?void 0:i.proxy)==null?(a=o.__wevu)==null?void 0:a.proxy:r)==null?o:n}catch(e){return}},z=new Proxy(b,{get(n,r,a){if(typeof r==`string`){if(N.value,i(x,r))return Reflect.get(x,r,a);if(r===`props`){let e=n[h];if(e&&typeof e==`object`)return e}if(r===`$props`){let e=n[h];if(e&&typeof e==`object`)return e}let p=n[h];if(p&&typeof p==`object`&&i(p,r))return Reflect.get(p,r);if(r===`data`||r===`$state`)return b;if(r===`$computed`)return M;if(r===`$emit`)return(e,...t)=>{let r=F(n,a),i=r&&Reflect.get(r,`triggerEvent`);if(typeof i!=`function`)return;let{detail:c,options:l}=s(t);return i.call(r,o(e),c,l)};if(r===`$nextTick`)return t=>t?e(()=>t.call(z)):e();if(r===`$set`)return(e,t,n)=>(Reflect.set(e,t,n),n);if(r===`$delete`)return(e,t)=>Reflect.deleteProperty(e,t);if(r===`$slots`){var c;return(c=t(n).$slots)==null?Object.freeze(Object.create(null)):c}if(r===`$refs`){var l;return(l=t(n).$refs)==null?Object.create(null):l}if(r===`$parent`)return R(F(n,a));if(r===`$options`){var u,f;let e=F(n,a);return{name:(u=(f=e==null?void 0:e[d])==null?e==null?void 0:e.name:f)==null?e==null?void 0:e.is:u}}if(i(P,r))return Reflect.get(P,r);if(i(D,r))return D[r];if(O[r])return O[r].value;if(i(w.globalProperties,r))return w.globalProperties[r];let m=L(F(n,a),r);if(m.found)return m.value}if(!Reflect.has(n,r)){let e=F(n,a);if(e&&Reflect.has(e,r)){let t=Reflect.get(e,r);return typeof t==`function`?t.bind(e):t}}let p=Reflect.get(n,r,a);return typeof r==`string`&&i(x,r)?Reflect.get(x,r,a):p},set(e,t,r,o){if(typeof t==`string`&&O[t])return a(k,t,r),!0;if(i(x,t)){let e=Reflect.get(x,t,o);return n(e)&&!n(r)?(e.value=r,!0):Reflect.set(x,t,r,o)}if(i(P,t))return Reflect.set(P,t,r);if(Reflect.has(e,t)){var s;let a=Reflect.get(e,t,o);return n(a)&&!n(r)?(a.value=r,!0):i((s=e[h])==null?{}:s,t)?Reflect.set(x,t,r,o):Reflect.set(e,t,r,o)}return Reflect.set(P,t,r)},has(e,t){if(t===`data`||t===`$emit`||t===`$nextTick`||t===`$set`||t===`$delete`||t===`$slots`||t===`$refs`||t===`$parent`||t===`$options`||typeof t==`string`&&(i(x,t)||O[t]||i(D,t))||i(P,t))return!0;let n=F(e,e);return typeof t==`string`&&L(n,t).found||n&&Reflect.has(n,t)?!0:Reflect.has(e,t)},ownKeys(e){let t=new Set;return Reflect.ownKeys(e).forEach(e=>{t.add(e)}),Reflect.ownKeys(x).forEach(e=>{t.add(e)}),Reflect.ownKeys(P).forEach(e=>t.add(e)),Object.keys(D).forEach(e=>t.add(e)),Object.keys(O).forEach(e=>t.add(e)),[...t]},getOwnPropertyDescriptor(e,t){if(typeof t==`string`&&i(x,t))return Object.getOwnPropertyDescriptor(x,t);if(i(P,t))return Object.getOwnPropertyDescriptor(P,t);if(Reflect.has(e,t))return Object.getOwnPropertyDescriptor(e,t);if(typeof t==`string`){if(t===`data`)return{configurable:!0,enumerable:!1,get(){return b}};if(O[t])return{configurable:!0,enumerable:!0,get(){return O[t].value},set(e){a(k,t,e)}};if(i(D,t))return{configurable:!0,enumerable:!1,value:D[t]}}}});return Object.keys(C).forEach(e=>{let t=C[e];if(typeof t==`function`){D[e]=(...e)=>t.apply(z,e);return}e===f&&t&&typeof t==`object`&&(D[e]=t)}),I(`triggerEvent`),I(`createSelectorQuery`),I(`createIntersectionObserver`),I(`setData`),Object.keys(S).forEach(e=>{let t=S[e];if(typeof t==`function`)O[e]=j(e,()=>t.call(z));else{var n,r;let i=(n=t.get)==null?void 0:n.bind(z);if(!i)throw Error(`计算属性 "${e}" 需要提供 getter`);let a=(r=t.set)==null?void 0:r.bind(z);a?(k[e]=a,O[e]=j(e,i,a)):O[e]=j(e,i)}}),{boundMethods:D,computedRefs:O,computedSetters:k,dirtyComputedKeys:A,computedProxy:M,publicInstance:z,touchSetupMethodsVersion(){N.value+=1}}}export{y as createRuntimeContext};
@@ -1 +1 @@
1
- import{getMiniProgramGlobalObject as e}from"./platform.mjs";import{version as t}from"../version.mjs";import{createRuntimeMount as n}from"./app/mount.mjs";import{setPendingRuntimeAppRegistration as r}from"./app/pending.mjs";import{INTERNAL_DEFAULTS_SCOPE_KEY as i,applyWevuAppDefaults as a}from"./defaults.mjs";import{ensureRuntimeAppProvides as o,setRuntimeAppProvidedValue as s}from"./provideContext.mjs";import{registerApp as c}from"./register/app.mjs";function l(l){let u=l[i],{[i]:d,data:f,computed:p,methods:m,setData:h,watch:g,setup:_,...v}=u===`component`?l:a(l),y=m==null?{}:m,b=p==null?{}:p,x=new Set,S=new Set,C=!1,w={globalProperties:{}},T={mount:n({data:f,resolvedComputed:b,resolvedMethods:y,appConfig:w,setDataOptions:h}),use(e,...t){if(!e||x.has(e))return T;if(x.add(e),typeof e==`function`)e(T,...t);else if(typeof e.install==`function`)e.install(T,...t);else throw TypeError(`插件必须是函数,或包含 install 方法的对象`);return T},provide(e,t){return s(T,e,t),T},onUnmount(e){if(typeof e!=`function`)throw TypeError(`onUnmount 只接受函数`);return C?(e(),T):(S.add(e),T)},unmount(){if(!C){C=!0;for(let e of S)e();S.clear()}},config:w,version:t};try{o(T),Object.defineProperty(T,"__wevuSetDataOptions",{value:h,configurable:!0,enumerable:!1,writable:!1}),Object.defineProperty(T,"__wevuHasTemplateRuntimeBindings",{value:Object.keys(b).some(e=>e.startsWith(`__wv_bind_`)),configurable:!0,enumerable:!1,writable:!1})}catch(e){T.__wevuSetDataOptions=h,T.__wevuHasTemplateRuntimeBindings=Object.keys(b).some(e=>e.startsWith(`__wv_bind_`))}let E=()=>{let t=e(),n=`__wevuAppRegistered`;t&&t[n]||(t&&(t[n]=!0),c(T,m==null?{}:m,g,_,v))};return u!==`component`&&typeof App==`function`?E():u!==`component`&&r({app:T,register:E}),T}export{l as createApp};
1
+ import{getMiniProgramGlobalObject as e}from"./platform.mjs";import{version as t}from"../version.mjs";import{createRuntimeMount as n}from"./app/mount.mjs";import{setPendingRuntimeAppRegistration as r}from"./app/pending.mjs";import{INTERNAL_DEFAULTS_SCOPE_KEY as i,applyWevuAppDefaults as a}from"./defaults.mjs";import{ensureRuntimeAppProvides as o,setRuntimeAppProvidedValue as s}from"./provideContext.mjs";import{registerApp as c}from"./register/app.mjs";function l(l){let u=l[i],{[i]:d,data:f,computed:p,methods:m,setData:h,watch:g,setup:_,...v}=u===`component`?l:a(l),y=m==null?{}:m,b=p==null?{}:p,x=new Set,S=new Set,C=!1,w={globalProperties:{}},T={mount:n({data:f,resolvedComputed:b,resolvedMethods:y,appConfig:w,setDataOptions:h}),use(e,...t){if(!e||x.has(e))return T;if(x.add(e),typeof e==`function`)e(T,...t);else if(typeof e.install==`function`)e.install(T,...t);else throw TypeError(`插件必须是函数,或包含 install 方法的对象`);return T},provide(e,t){return s(T,e,t,{syncGlobal:u!==`component`}),T},onUnmount(e){if(typeof e!=`function`)throw TypeError(`onUnmount 只接受函数`);return C?(e(),T):(S.add(e),T)},unmount(){if(!C){C=!0;for(let e of S)e();S.clear()}},config:w,version:t};try{o(T),Object.defineProperty(T,"__wevuSetDataOptions",{value:h,configurable:!0,enumerable:!1,writable:!1}),Object.defineProperty(T,"__wevuHasTemplateRuntimeBindings",{value:Object.keys(b).some(e=>e.startsWith(`__wv_bind_`)),configurable:!0,enumerable:!1,writable:!1})}catch(e){T.__wevuSetDataOptions=h,T.__wevuHasTemplateRuntimeBindings=Object.keys(b).some(e=>e.startsWith(`__wv_bind_`))}let E=()=>{let t=e(),n=`__wevuAppRegistered`;t&&t[n]||(t&&(t[n]=!0),c(T,m==null?{}:m,g,_,v))};return u!==`component`&&typeof App==`function`?E():u!==`component`&&r({app:T,register:E}),T}export{l as createApp};
@@ -1,6 +1,7 @@
1
1
  import { CreateAppOptions, DefineComponentOptions } from "./types/options.mjs";
2
2
  import "./types.mjs";
3
3
  //#region src/runtime/defaults.d.ts
4
+ declare const INTERNAL_DEFAULTS_SCOPE_KEY = "__wevuDefaultsScope";
4
5
  interface WevuDefaults {
5
6
  app?: Partial<CreateAppOptions<any, any, any>>;
6
7
  component?: Partial<DefineComponentOptions<any, any, any, any>>;
@@ -8,4 +9,4 @@ interface WevuDefaults {
8
9
  declare function setWevuDefaults(next: WevuDefaults): void;
9
10
  declare function resetWevuDefaults(): void;
10
11
  //#endregion
11
- export { WevuDefaults, resetWevuDefaults, setWevuDefaults };
12
+ export { INTERNAL_DEFAULTS_SCOPE_KEY, WevuDefaults, resetWevuDefaults, setWevuDefaults };
@@ -0,0 +1 @@
1
+ import{INTERNAL_DEFAULTS_SCOPE_KEY as e}from"../defaults.mjs";import{registerComponent as t}from"../register/component.mjs";import{createApp as n}from"../app.mjs";function r(r,i=!1){let a=n({data:r.data,computed:r.computed,methods:r.methods,setData:r.setData,[e]:`component`});return{lifecycleDefinition:t(a,r.methods,r.watch,r.setup,r.mpOptions,{registerNative:i}),runtimeApp:a}}export{r as createRuntimeComponentDefinition};