2016-05-14 06:30:04 +08:00
|
|
|
import type { Config } from '../src/core/config'
|
|
|
|
import type VNode from '../src/core/vdom/vnode'
|
|
|
|
import type Watcher from '../src/core/observer/watcher'
|
|
|
|
|
|
|
|
declare interface Component {
|
|
|
|
// constructor information
|
|
|
|
static cid: number;
|
|
|
|
static options: Object;
|
|
|
|
// extend
|
|
|
|
static extend: (options: Object) => Function;
|
2016-06-25 22:43:19 +08:00
|
|
|
static superOptions: Object;
|
|
|
|
static extendOptions: Object;
|
|
|
|
static super: Class<Component>;
|
2016-05-14 06:30:04 +08:00
|
|
|
// assets
|
|
|
|
static directive: (id: string, def?: Function | Object) => Function | Object | void;
|
|
|
|
static component: (id: string, def?: Class<Component> | Object) => Class<Component>;
|
|
|
|
static filter: (id: string, def?: Function) => Function | void;
|
|
|
|
|
|
|
|
// public properties
|
2016-06-23 02:18:56 +08:00
|
|
|
$el: any; // so that we can attach __vue__ to it
|
2016-05-14 06:30:04 +08:00
|
|
|
$data: Object;
|
2016-05-14 16:10:48 +08:00
|
|
|
$options: ComponentOptions;
|
2016-05-14 06:30:04 +08:00
|
|
|
$parent: Component | void;
|
|
|
|
$root: Component;
|
|
|
|
$children: Array<Component>;
|
|
|
|
$refs: { [key: string]: Component | Element | Array<Component | Element> | void };
|
|
|
|
$slots: { [key: string]: Array<VNode> };
|
2016-11-24 07:04:35 +08:00
|
|
|
$scopedSlots: { [key: string]: () => VNodeChildren };
|
2016-07-07 00:50:08 +08:00
|
|
|
$vnode: VNode;
|
2016-05-14 06:30:04 +08:00
|
|
|
$isServer: boolean;
|
|
|
|
|
|
|
|
// public methods
|
2016-06-02 06:20:13 +08:00
|
|
|
$mount: (el?: Element | string, hydrating?: boolean) => Component;
|
2016-05-14 06:30:04 +08:00
|
|
|
$forceUpdate: () => void;
|
|
|
|
$destroy: () => void;
|
2016-12-13 09:27:18 +08:00
|
|
|
$set: (obj: Array<mixed> | Object, key: mixed, val: mixed) => void;
|
2016-08-18 01:53:50 +08:00
|
|
|
$delete: (obj: Object, key: string) => void;
|
2016-05-14 06:30:04 +08:00
|
|
|
$watch: (expOrFn: string | Function, cb: Function, options?: Object) => Function;
|
|
|
|
$on: (event: string, fn: Function) => Component;
|
|
|
|
$once: (event: string, fn: Function) => Component;
|
|
|
|
$off: (event?: string, fn?: Function) => Component;
|
2016-12-13 09:27:18 +08:00
|
|
|
$emit: (event: string, ...args: Array<mixed>) => Component;
|
2016-05-14 06:30:04 +08:00
|
|
|
$nextTick: (fn: Function) => void;
|
2016-12-22 05:18:04 +08:00
|
|
|
$createElement: (tag?: string | Component, data?: Object, children?: VNodeChildren) => VNode;
|
2016-05-14 06:30:04 +08:00
|
|
|
|
|
|
|
// private properties
|
|
|
|
_uid: number;
|
|
|
|
_isVue: true;
|
2016-05-27 00:57:45 +08:00
|
|
|
_self: Component;
|
2016-05-14 06:30:04 +08:00
|
|
|
_renderProxy: Component;
|
2016-10-01 02:15:10 +08:00
|
|
|
_renderContext: ?Component;
|
2016-05-14 06:30:04 +08:00
|
|
|
_watcher: Watcher;
|
|
|
|
_watchers: Array<Watcher>;
|
|
|
|
_data: Object;
|
|
|
|
_events: Object;
|
2016-06-28 16:00:32 +08:00
|
|
|
_inactive: boolean;
|
2016-05-14 06:30:04 +08:00
|
|
|
_isMounted: boolean;
|
|
|
|
_isDestroyed: boolean;
|
|
|
|
_isBeingDestroyed: boolean;
|
|
|
|
_vnode: ?VNode;
|
|
|
|
_staticTrees: ?Array<VNode>;
|
2016-12-14 10:01:12 +08:00
|
|
|
_hasHookEvent: boolean;
|
2016-05-14 06:30:04 +08:00
|
|
|
|
|
|
|
// private methods
|
|
|
|
// lifecycle
|
2016-05-17 21:58:24 +08:00
|
|
|
_init: Function;
|
2016-06-02 06:20:13 +08:00
|
|
|
_mount: (el?: Element | void, hydrating?: boolean) => Component;
|
|
|
|
_update: (vnode: VNode, hydrating?: boolean) => void;
|
2016-05-14 06:30:04 +08:00
|
|
|
_updateFromParent: (
|
2016-05-14 15:08:21 +08:00
|
|
|
propsData: ?Object,
|
|
|
|
listeners: ?{ [key: string]: Function | Array<Function> },
|
2016-05-14 06:30:04 +08:00
|
|
|
parentVnode: VNode,
|
2016-12-05 00:34:53 +08:00
|
|
|
renderChildren: ?Array<VNode>
|
2016-05-14 06:30:04 +08:00
|
|
|
) => void;
|
|
|
|
// rendering
|
|
|
|
_render: () => VNode;
|
2016-06-23 02:18:56 +08:00
|
|
|
__patch__: (a: Element | VNode | void, b: VNode) => any;
|
2016-08-09 07:03:00 +08:00
|
|
|
// createElement
|
2016-12-22 05:18:04 +08:00
|
|
|
// _c is internal that accepts `normalizationType` optimization hint
|
|
|
|
_c: (vnode?: VNode, data?: VNodeData, children?: VNodeChildren, normalizationType?: number) => VNode | void;
|
2016-08-09 07:03:00 +08:00
|
|
|
// renderStatic
|
|
|
|
_m: (index: number, isInFor?: boolean) => VNode | VNodeChildren;
|
2016-11-03 10:34:36 +08:00
|
|
|
// markOnce
|
|
|
|
_o: (vnode: VNode | Array<VNode>, index: number, key: string) => VNode | VNodeChildren;
|
2016-05-19 08:57:51 +08:00
|
|
|
// toString
|
2016-12-13 09:27:18 +08:00
|
|
|
_s: (value: mixed) => string;
|
2016-12-03 20:10:45 +08:00
|
|
|
// text to VNode
|
|
|
|
_v: (value: string | number) => VNode;
|
2016-06-23 09:43:52 +08:00
|
|
|
// toNumber
|
|
|
|
_n: (value: string) => number | string;
|
2016-08-28 05:01:57 +08:00
|
|
|
// empty vnode
|
|
|
|
_e: () => VNode;
|
2016-09-14 23:35:30 +08:00
|
|
|
// loose equal
|
|
|
|
_q: (a: mixed, b: mixed) => boolean;
|
|
|
|
// loose indexOf
|
|
|
|
_i: (arr: Array<mixed>, val: mixed) => number;
|
2016-05-19 08:57:51 +08:00
|
|
|
// resolveFilter
|
|
|
|
_f: (id: string) => Function;
|
|
|
|
// renderList
|
2016-12-13 09:27:18 +08:00
|
|
|
_l: (val: mixed, render: Function) => ?Array<VNode>;
|
2016-09-08 17:47:22 +08:00
|
|
|
// renderSlot
|
2016-11-17 11:05:04 +08:00
|
|
|
_t: (name: string, fallback: ?Array<VNode>, props: ?Object) => ?Array<VNode>;
|
2016-05-25 08:41:06 +08:00
|
|
|
// apply v-bind object
|
2016-09-14 22:14:14 +08:00
|
|
|
_b: (data: any, value: any, asProp?: boolean) => VNodeData;
|
2016-12-01 01:16:10 +08:00
|
|
|
// check custom keyCode
|
2016-12-02 03:31:55 +08:00
|
|
|
_k: (eventKeyCode: number, key: string, builtInAlias: number | Array<number> | void) => boolean;
|
2016-05-14 06:30:04 +08:00
|
|
|
|
|
|
|
// allow dynamic method registration
|
|
|
|
[key: string]: any
|
|
|
|
}
|