]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: Merge branch 'main' into minor
authorEvan You <yyx990803@gmail.com>
Fri, 14 Jun 2024 16:15:20 +0000 (18:15 +0200)
committerEvan You <yyx990803@gmail.com>
Fri, 14 Jun 2024 16:15:20 +0000 (18:15 +0200)
1  2 
CHANGELOG.md
packages/reactivity/src/constants.ts
packages/runtime-dom/__tests__/customElement.spec.ts
packages/runtime-dom/src/apiCustomElement.ts

diff --cc CHANGELOG.md
Simple merge
index 8320de287f204b24db0bb3a7686594789e6b362b,4898d691703a3ec443cad1f6d199aae72acefe4b..ea10f6aee3ec6b2c5dd797ba1de1e07e907238bc
@@@ -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,
- }
index fa1b7170288d546ddd1f6e496c74f4b8c4f15adb,2a96cafa0eaa63422d6e642aad4a0d2e7bc7e00c..97a84ee918d5ac2569cc1529b1f18885b2a5670a
@@@ -38,85 -36,110 +38,91 @@@ export type VueElementConstructor<P = {
  
  // overload 1: direct setup function
  export function defineCustomElement<Props, RawBindings = object>(
-   setup: (
-     props: Readonly<Props>,
-     ctx: SetupContext,
-   ) => RawBindings | RenderFunction,
+   setup: (props: Props, ctx: SetupContext) => RawBindings | RenderFunction,
+   options?: Pick<ComponentOptions, 'name' | 'inheritAttrs' | 'emits'> & {
+     props?: (keyof Props)[]
+   },
+ ): VueElementConstructor<Props>
+ export function defineCustomElement<Props, RawBindings = object>(
+   setup: (props: Props, ctx: SetupContext) => RawBindings | RenderFunction,
+   options?: Pick<ComponentOptions, 'name' | 'inheritAttrs' | 'emits'> & {
+     props?: ComponentObjectPropsOptions<Props>
+   },
  ): VueElementConstructor<Props>
  
 -// 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<string, Component> = {},
 +  Directives extends Record<string, Directive> = {},
 +  Exposed extends string = string,
 +  Provide extends ComponentProvideOptions = ComponentProvideOptions,
 +  // resolved types
 +  InferredProps = string extends PropsKeys
 +    ? ComponentObjectPropsOptions extends RuntimePropsOptions
 +      ? {}
 +      : ExtractPropTypes<RuntimePropsOptions>
 +    : { [key in PropsKeys]?: any },
 +  ResolvedProps = InferredProps & EmitsToProps<RuntimeEmitsOptions>,
  >(
 -  options: ComponentOptionsWithoutProps<
 -    Props,
 -    RawBindings,
 -    D,
 -    C,
 -    M,
 +  options: {
 +    props?: (RuntimePropsOptions & ThisType<void>) | PropsKeys[]
 +  } & ComponentOptionsBase<
 +    ResolvedProps,
 +    SetupBindings,
 +    Data,
 +    Computed,
 +    Methods,
      Mixin,
      Extends,
 -    E,
 -    EE,
 -    I,
 -    II,
 -    S
 -  > & { styles?: string[] },
 -): VueElementConstructor<Props>
 -
 -// 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<string, any>,
 -  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<ComponentPropsOptions>,
 -  RawBindings,
 -  D,
 -  C extends ComputedOptions = {},
 -  M extends MethodOptions = {},
 -  Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,
 -  Extends extends ComponentOptionsMixin = ComponentOptionsMixin,
 -  E extends EmitsOptions = Record<string, any>,
 -  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<ExtractPropTypes<PropsOptions>>
 +    RuntimeEmitsOptions,
 +    EmitsKeys,
 +    {}, // Defaults
 +    InjectOptions,
 +    InjectKeys,
 +    Slots,
 +    LocalComponents,
 +    Directives,
 +    Exposed,
 +    Provide
 +  > &
 +    ThisType<
 +      CreateComponentPublicInstanceWithMixins<
 +        Readonly<ResolvedProps>,
 +        SetupBindings,
 +        Data,
 +        Computed,
 +        Methods,
 +        Mixin,
 +        Extends,
 +        RuntimeEmitsOptions,
 +        EmitsKeys,
 +        {},
 +        false,
 +        InjectOptions,
 +        Slots,
 +        LocalComponents,
 +        Directives,
 +        Exposed
 +      >
 +    >,
 +): VueElementConstructor<ResolvedProps>
  
  // overload 5: defining a custom element from the returned value of
  // `defineComponent`