vue/typescript/vnode.d.ts

105 lines
2.4 KiB
TypeScript
Raw Normal View History

2021-04-03 22:06:56 +08:00
import VNode from "../src/core/vdom/vnode";
import { Component } from "./component";
declare type VNodeChildren =
| Array<null | VNode | string | VNodeChildren>
| string;
declare type VNodeComponentOptions = {
Ctor: Component;
propsData?: Object;
listeners?: Record<string, Function | Function[]>;
2021-04-03 22:06:56 +08:00
children?: Array<VNode>;
tag?: string;
};
declare type MountedComponentVNode = VNode & {
2021-04-03 22:06:56 +08:00
context: Component;
componentOptions: VNodeComponentOptions;
componentInstance: Component;
parent: VNode;
data: VNodeData;
};
// interface for vnodes in update modules
declare type VNodeWithData = VNode & {
2021-04-03 22:06:56 +08:00
tag: string;
data: VNodeData;
children: Array<VNode>;
text: void;
elm: any;
ns: string | void;
context: Component;
key: string | number | undefined;
parent?: VNodeWithData;
componentOptions?: VNodeComponentOptions;
componentInstance?: Component;
isRootInsert: boolean;
};
// // interface for vnodes in update modules
// declare type VNodeWithData = {
// tag: string;
// data: VNodeData;
// children: Array<VNode>;
// text: void;
// elm: any;
// ns: string | void;
// context: Component;
// key: string | number | undefined;
// parent?: VNodeWithData;
// componentOptions?: VNodeComponentOptions;
// componentInstance?: Component;
// isRootInsert: boolean;
// };
2021-04-03 22:06:56 +08:00
declare interface VNodeData {
key?: string | number;
slot?: string;
ref?: string;
is?: string;
pre?: boolean;
tag?: string;
staticClass?: string;
class?: any;
staticStyle?: { [key: string]: any };
style?: string | Array<Object> | Object;
normalizedStyle?: Object;
props?: { [key: string]: any };
attrs?: { [key: string]: string };
domProps?: { [key: string]: any };
hook?: { [key: string]: Function };
on?: { [key: string]: Function | Array<Function> };
nativeOn?: { [key: string]: Function | Array<Function> };
transition?: Object;
show?: boolean; // marker for v-show
inlineTemplate?: {
render: Function;
staticRenderFns: Array<Function>;
};
directives?: Array<VNodeDirective>;
keepAlive?: boolean;
scopedSlots?: { [key: string]: Function };
model?: {
value: any;
callback: Function;
};
[key: string]: any;
2021-04-03 22:06:56 +08:00
}
declare type VNodeDirective = {
name: string;
rawName: string;
value?: any;
oldValue?: any;
arg?: string;
oldArg?: string;
modifiers?: ASTModifiers;
def?: Object;
};
declare type ScopedSlotsData = Array<
{ key: string; fn: Function } | ScopedSlotsData
>;