diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index aeb14ca5..5718252c 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -15,13 +15,13 @@ export { createComponentInstance } from './componentUtils' // 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' diff --git a/packages/core/src/optional/asyncComponent.ts b/packages/core/src/optional/asyncComponent.ts index f84bbdb9..1a60b49e 100644 --- a/packages/core/src/optional/asyncComponent.ts +++ b/packages/core/src/optional/asyncComponent.ts @@ -3,12 +3,12 @@ import { createComponentVNode, Slots } from '../vdom' import { Component, ComponentType, ComponentClass } from '../component' import { unwrap } from '@vue/observer' -export interface AsyncComponentFactory { +interface AsyncComponentFactory { (): Promise resolved?: ComponentType } -export interface AsyncComponentFullOptions { +interface AsyncComponentFullOptions { factory: AsyncComponentFactory loading?: ComponentType error?: ComponentType @@ -16,9 +16,7 @@ export interface AsyncComponentFullOptions { timeout?: number } -export type AsyncComponentOptions = - | AsyncComponentFactory - | AsyncComponentFullOptions +type AsyncComponentOptions = AsyncComponentFactory | AsyncComponentFullOptions interface AsyncContainerData { comp: ComponentType | null diff --git a/packages/core/src/optional/context.ts b/packages/core/src/optional/context.ts index 72093caf..f8d688d5 100644 --- a/packages/core/src/optional/context.ts +++ b/packages/core/src/optional/context.ts @@ -1,6 +1,5 @@ import { observable } from '@vue/observer' import { Component } from '../component' -import { Slots } from '../vdom' const contextStore = observable() as Record @@ -39,7 +38,7 @@ export class Provide extends Component<{}, ProviderProps> { beforeUpdate() { this.updateValue() } - render(props: ProviderProps, slots: Slots) { + render(props: any, slots: any) { return slots.default && slots.default() } } @@ -57,7 +56,7 @@ Provide.options = { } export class Inject extends Component { - render(props: any, slots: Slots) { + render(props: any, slots: any) { return slots.default && slots.default(contextStore[props.id]) } } diff --git a/packages/core/src/optional/directive.ts b/packages/core/src/optional/directive.ts index 8867e446..9d076b1b 100644 --- a/packages/core/src/optional/directive.ts +++ b/packages/core/src/optional/directive.ts @@ -1,7 +1,7 @@ import { VNode } from '../vdom' import { MountedComponent } from '../component' -export interface DirectiveBinding { +interface DirectiveBinding { instance: MountedComponent value?: any oldValue?: any @@ -9,14 +9,14 @@ export interface DirectiveBinding { 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 @@ -25,7 +25,7 @@ export interface Directive { unmounted: DirectiveHook } -export type DirectiveModifiers = Record +type DirectiveModifiers = Record const valueCache = new WeakMap>()