From: Evan You Date: Fri, 14 Jun 2024 16:15:20 +0000 (+0200) Subject: chore: Merge branch 'main' into minor X-Git-Tag: v3.5.0-alpha.3~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=524e660e35fc36de1135c3628da9a479658441c7;p=thirdparty%2Fvuejs%2Fcore.git chore: Merge branch 'main' into minor --- 524e660e35fc36de1135c3628da9a479658441c7 diff --cc packages/reactivity/src/constants.ts index 8320de287f,4898d69170..ea10f6aee3 --- a/packages/reactivity/src/constants.ts +++ b/packages/reactivity/src/constants.ts @@@ -20,13 -20,13 +20,5 @@@ export enum ReactiveFlags IS_READONLY = '__v_isReadonly', IS_SHALLOW = '__v_isShallow', RAW = '__v_raw', -} - -export enum DirtyLevels { - NotDirty, - QueryingDirty, - MaybeDirty_ComputedSideEffect_Origin, - MaybeDirty_ComputedSideEffect, - MaybeDirty, - Dirty, + IS_REF = '__v_isRef', } - - export enum DirtyLevels { - NotDirty = 0, - QueryingDirty = 1, - MaybeDirty_ComputedSideEffect = 2, - MaybeDirty = 3, - Dirty = 4, - } diff --cc packages/runtime-dom/src/apiCustomElement.ts index fa1b717028,2a96cafa0e..97a84ee918 --- a/packages/runtime-dom/src/apiCustomElement.ts +++ b/packages/runtime-dom/src/apiCustomElement.ts @@@ -38,85 -36,110 +38,91 @@@ export type VueElementConstructor

( - setup: ( - props: Readonly, - ctx: SetupContext, - ) => RawBindings | RenderFunction, + setup: (props: Props, ctx: SetupContext) => RawBindings | RenderFunction, + options?: Pick & { + props?: (keyof Props)[] + }, + ): VueElementConstructor + export function defineCustomElement( + setup: (props: Props, ctx: SetupContext) => RawBindings | RenderFunction, + options?: Pick & { + props?: ComponentObjectPropsOptions + }, ): VueElementConstructor -// overload 2: object format with no props +// overload 2: defineCustomElement with options object, infer props from options export function defineCustomElement< - Props = {}, - RawBindings = {}, - D = {}, - C extends ComputedOptions = {}, - M extends MethodOptions = {}, + // props + RuntimePropsOptions extends + ComponentObjectPropsOptions = ComponentObjectPropsOptions, + PropsKeys extends string = string, + // emits + RuntimeEmitsOptions extends EmitsOptions = {}, + EmitsKeys extends string = string, + // other options + Data = {}, + SetupBindings = {}, + Computed extends ComputedOptions = {}, + Methods extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, - E extends EmitsOptions = EmitsOptions, - EE extends string = string, - I extends ComponentInjectOptions = {}, - II extends string = string, - S extends SlotsType = {}, + InjectOptions extends ComponentInjectOptions = {}, + InjectKeys extends string = string, + Slots extends SlotsType = {}, + LocalComponents extends Record = {}, + Directives extends Record = {}, + Exposed extends string = string, + Provide extends ComponentProvideOptions = ComponentProvideOptions, + // resolved types + InferredProps = string extends PropsKeys + ? ComponentObjectPropsOptions extends RuntimePropsOptions + ? {} + : ExtractPropTypes + : { [key in PropsKeys]?: any }, + ResolvedProps = InferredProps & EmitsToProps, >( - options: ComponentOptionsWithoutProps< - Props, - RawBindings, - D, - C, - M, + options: { + props?: (RuntimePropsOptions & ThisType) | PropsKeys[] + } & ComponentOptionsBase< + ResolvedProps, + SetupBindings, + Data, + Computed, + Methods, Mixin, Extends, - E, - EE, - I, - II, - S - > & { styles?: string[] }, -): VueElementConstructor - -// overload 3: object format with array props declaration -export function defineCustomElement< - PropNames extends string, - RawBindings, - D, - C extends ComputedOptions = {}, - M extends MethodOptions = {}, - Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, - Extends extends ComponentOptionsMixin = ComponentOptionsMixin, - E extends EmitsOptions = Record, - EE extends string = string, - I extends ComponentInjectOptions = {}, - II extends string = string, - S extends SlotsType = {}, ->( - options: ComponentOptionsWithArrayProps< - PropNames, - RawBindings, - D, - C, - M, - Mixin, - Extends, - E, - EE, - I, - II, - S - > & { styles?: string[] }, -): VueElementConstructor<{ [K in PropNames]: any }> - -// overload 4: object format with object props declaration -export function defineCustomElement< - PropsOptions extends Readonly, - RawBindings, - D, - C extends ComputedOptions = {}, - M extends MethodOptions = {}, - Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, - Extends extends ComponentOptionsMixin = ComponentOptionsMixin, - E extends EmitsOptions = Record, - EE extends string = string, - I extends ComponentInjectOptions = {}, - II extends string = string, - S extends SlotsType = {}, ->( - options: ComponentOptionsWithObjectProps< - PropsOptions, - RawBindings, - D, - C, - M, - Mixin, - Extends, - E, - EE, - I, - II, - S - > & { styles?: string[] }, -): VueElementConstructor> + RuntimeEmitsOptions, + EmitsKeys, + {}, // Defaults + InjectOptions, + InjectKeys, + Slots, + LocalComponents, + Directives, + Exposed, + Provide + > & + ThisType< + CreateComponentPublicInstanceWithMixins< + Readonly, + SetupBindings, + Data, + Computed, + Methods, + Mixin, + Extends, + RuntimeEmitsOptions, + EmitsKeys, + {}, + false, + InjectOptions, + Slots, + LocalComponents, + Directives, + Exposed + > + >, +): VueElementConstructor // overload 5: defining a custom element from the returned value of // `defineComponent`