// Optional APIs
// these are imported on-demand and can be tree-shaken
-export * from './optional/directive'
-export * from './optional/context'
-export * from './optional/asyncComponent'
-export * from './optional/keepAlive'
+export { applyDirective } from './optional/directive'
+export { Provide, Inject } from './optional/context'
+export { createAsyncComponent } from './optional/asyncComponent'
+export { KeepAlive } from './optional/keepAlive'
// flags & types
export { ComponentType, ComponentClass, FunctionalComponent } from './component'
export { ComponentOptions, PropType } from './componentOptions'
export { VNodeFlags, ChildrenFlags } from './flags'
-export { VNode, VNodeData, VNodeChildren, Key, Ref, Slots, Slot } from './vdom'
+export { VNode, Slots } from './vdom'
import { Component, ComponentType, ComponentClass } from '../component'
import { unwrap } from '@vue/observer'
-export interface AsyncComponentFactory {
+interface AsyncComponentFactory {
(): Promise<ComponentType>
resolved?: ComponentType
}
-export interface AsyncComponentFullOptions {
+interface AsyncComponentFullOptions {
factory: AsyncComponentFactory
loading?: ComponentType
error?: ComponentType
timeout?: number
}
-export type AsyncComponentOptions =
- | AsyncComponentFactory
- | AsyncComponentFullOptions
+type AsyncComponentOptions = AsyncComponentFactory | AsyncComponentFullOptions
interface AsyncContainerData {
comp: ComponentType | null
import { observable } from '@vue/observer'
import { Component } from '../component'
-import { Slots } from '../vdom'
const contextStore = observable() as Record<string | symbol, any>
beforeUpdate() {
this.updateValue()
}
- render(props: ProviderProps, slots: Slots) {
+ render(props: any, slots: any) {
return slots.default && slots.default()
}
}
}
export class Inject extends Component {
- render(props: any, slots: Slots) {
+ render(props: any, slots: any) {
return slots.default && slots.default(contextStore[props.id])
}
}
import { VNode } from '../vdom'
import { MountedComponent } from '../component'
-export interface DirectiveBinding {
+interface DirectiveBinding {
instance: MountedComponent
value?: any
oldValue?: any
modifiers?: DirectiveModifiers
}
-export type DirectiveHook = (
+type DirectiveHook = (
el: any,
binding: DirectiveBinding,
vnode: VNode,
prevVNode: VNode | void
) => void
-export interface Directive {
+interface Directive {
beforeMount: DirectiveHook
mounted: DirectiveHook
beforeUpdate: DirectiveHook
unmounted: DirectiveHook
}
-export type DirectiveModifiers = Record<string, boolean>
+type DirectiveModifiers = Record<string, boolean>
const valueCache = new WeakMap<Directive, WeakMap<any, any>>()