Skip to content

Commit 704fbe6

Browse files
committed
wip
1 parent ef1fd2f commit 704fbe6

File tree

1 file changed

+22
-39
lines changed

1 file changed

+22
-39
lines changed

packages/runtime-dom/src/apiCustomElement.ts

Lines changed: 22 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
type CreateAppFunction,
1414
type CreateComponentPublicInstanceWithMixins,
1515
type Directive,
16-
type EmitsOptions,
1716
type EmitsToProps,
1817
type ExtractMixinProps,
1918
type ExtractPropTypes,
@@ -64,21 +63,15 @@ export interface CustomElementOptions {
6463
// overload 1: direct setup function
6564
export function defineCustomElement<Props, RawBindings = object>(
6665
setup: (props: Props, ctx: SetupContext) => RawBindings | RenderFunction,
67-
options?: {
68-
name?: string
69-
inheritAttrs?: boolean
70-
emits?: EmitsOptions
71-
} & CustomElementOptions & {
66+
options?: Pick<ComponentOptions, 'name' | 'inheritAttrs' | 'emits'> &
67+
CustomElementOptions & {
7268
props?: (keyof Props)[]
7369
},
7470
): VueElementConstructor<Props>
7571
export function defineCustomElement<Props, RawBindings = object>(
7672
setup: (props: Props, ctx: SetupContext) => RawBindings | RenderFunction,
77-
options?: {
78-
name?: string
79-
inheritAttrs?: boolean
80-
emits?: EmitsOptions
81-
} & CustomElementOptions & {
73+
options?: Pick<ComponentOptions, 'name' | 'inheritAttrs' | 'emits'> &
74+
CustomElementOptions & {
8275
props?: ComponentObjectPropsOptions<Props>
8376
},
8477
): VueElementConstructor<Props>
@@ -113,14 +106,23 @@ export function defineCustomElement<
113106
ResolvedProps = InferredProps & EmitsToProps<RuntimeEmitsOptions>,
114107
PublicP = ResolvedProps &
115108
Prettify<ExtractMixinProps<Mixin> & ExtractMixinProps<Extends>>,
116-
DataVM = CreateComponentPublicInstanceWithMixins<
117-
PublicP,
118-
{},
119-
{},
120-
{},
121-
MethodOptions,
109+
InternalInstance = CreateComponentPublicInstanceWithMixins<
110+
Readonly<ResolvedProps>,
111+
SetupBindings,
112+
Data,
113+
Computed,
114+
Methods,
122115
Mixin,
123-
Extends
116+
Extends,
117+
RuntimeEmitsOptions,
118+
_EmitsKeys,
119+
{},
120+
false,
121+
InjectOptions,
122+
Slots,
123+
LocalComponents,
124+
Directives,
125+
Exposed
124126
>,
125127
>(
126128
options: CustomElementOptions & {
@@ -147,31 +149,12 @@ export function defineCustomElement<
147149
props: NoInfer<LooseRequired<PublicP>>,
148150
ctx: NoInfer<SetupContext<RuntimeEmitsOptions, Slots>>,
149151
) => Promise<SetupBindings> | SetupBindings | RenderFunction | void
150-
data?: (this: DataVM, vm: DataVM) => Data
152+
data?: (vm: NoInfer<InternalInstance>) => Data
151153

152154
// allow any custom options
153155
[key: string]: any
154156
} & ConcreteComponentOptions &
155-
ThisType<
156-
CreateComponentPublicInstanceWithMixins<
157-
Readonly<ResolvedProps>,
158-
SetupBindings,
159-
Data,
160-
Computed,
161-
Methods,
162-
Mixin,
163-
Extends,
164-
RuntimeEmitsOptions,
165-
_EmitsKeys,
166-
{},
167-
false,
168-
InjectOptions,
169-
Slots,
170-
LocalComponents,
171-
Directives,
172-
Exposed
173-
>
174-
>,
157+
ThisType<NoInfer<InternalInstance>>,
175158
extraOptions?: CustomElementOptions,
176159
): VueElementConstructor<ResolvedProps>
177160

0 commit comments

Comments
 (0)