feat(types): adjust type exports for manual render function and tooling usage
- v-model and v-show directives are now exposed as public - compiler-used runtime helpers are now exposed for TS tooling, but marked as @private close #1329
This commit is contained in:
@@ -8,7 +8,7 @@ interface CompiledSlotDescriptor {
|
||||
|
||||
/**
|
||||
* Compiler runtime helper for creating dynamic slots object
|
||||
* @internal
|
||||
* @private
|
||||
*/
|
||||
export function createSlots(
|
||||
slots: Record<string, Slot>,
|
||||
|
||||
@@ -3,7 +3,7 @@ import { isArray, isString, isObject } from '@vue/shared'
|
||||
|
||||
/**
|
||||
* v-for string
|
||||
* @internal
|
||||
* @private
|
||||
*/
|
||||
export function renderList(
|
||||
source: string,
|
||||
@@ -12,7 +12,6 @@ export function renderList(
|
||||
|
||||
/**
|
||||
* v-for number
|
||||
* @internal
|
||||
*/
|
||||
export function renderList(
|
||||
source: number,
|
||||
@@ -21,7 +20,6 @@ export function renderList(
|
||||
|
||||
/**
|
||||
* v-for array
|
||||
* @internal
|
||||
*/
|
||||
export function renderList<T>(
|
||||
source: T[],
|
||||
@@ -30,7 +28,6 @@ export function renderList<T>(
|
||||
|
||||
/**
|
||||
* v-for iterable
|
||||
* @internal
|
||||
*/
|
||||
export function renderList<T>(
|
||||
source: Iterable<T>,
|
||||
@@ -39,7 +36,6 @@ export function renderList<T>(
|
||||
|
||||
/**
|
||||
* v-for object
|
||||
* @internal
|
||||
*/
|
||||
export function renderList<T>(
|
||||
source: T,
|
||||
@@ -50,7 +46,9 @@ export function renderList<T>(
|
||||
) => VNodeChild
|
||||
): VNodeChild[]
|
||||
|
||||
// actual implementation
|
||||
/**
|
||||
* Actual implementation
|
||||
*/
|
||||
export function renderList(
|
||||
source: any,
|
||||
renderItem: (...args: any[]) => VNodeChild
|
||||
|
||||
@@ -12,7 +12,7 @@ import { warn } from '../warning'
|
||||
|
||||
/**
|
||||
* Compiler runtime helper for rendering <slot/>
|
||||
* @internal
|
||||
* @private
|
||||
*/
|
||||
export function renderSlot(
|
||||
slots: Slots,
|
||||
|
||||
@@ -12,12 +12,18 @@ import { warn } from '../warning'
|
||||
const COMPONENTS = 'components'
|
||||
const DIRECTIVES = 'directives'
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export function resolveComponent(name: string): Component | string | undefined {
|
||||
return resolveAsset(COMPONENTS, name) || name
|
||||
}
|
||||
|
||||
export const NULL_DYNAMIC_COMPONENT = Symbol()
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export function resolveDynamicComponent(
|
||||
component: unknown
|
||||
): Component | string | typeof NULL_DYNAMIC_COMPONENT {
|
||||
@@ -29,11 +35,17 @@ export function resolveDynamicComponent(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export function resolveDirective(name: string): Directive | undefined {
|
||||
return resolveAsset(DIRECTIVES, name)
|
||||
}
|
||||
|
||||
// overload 1: components
|
||||
/**
|
||||
* @private
|
||||
* overload 1: components
|
||||
*/
|
||||
function resolveAsset(
|
||||
type: typeof COMPONENTS,
|
||||
name: string,
|
||||
@@ -44,7 +56,7 @@ function resolveAsset(
|
||||
type: typeof DIRECTIVES,
|
||||
name: string
|
||||
): Directive | undefined
|
||||
|
||||
// implementation
|
||||
function resolveAsset(
|
||||
type: typeof COMPONENTS | typeof DIRECTIVES,
|
||||
name: string,
|
||||
|
||||
@@ -8,14 +8,14 @@ export let currentScopeId: string | null = null
|
||||
const scopeIdStack: string[] = []
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @private
|
||||
*/
|
||||
export function pushScopeId(id: string) {
|
||||
scopeIdStack.push((currentScopeId = id))
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @private
|
||||
*/
|
||||
export function popScopeId() {
|
||||
scopeIdStack.pop()
|
||||
@@ -23,7 +23,7 @@ export function popScopeId() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @private
|
||||
*/
|
||||
export function withScopeId(id: string): <T extends Function>(fn: T) => T {
|
||||
return ((fn: Function) =>
|
||||
|
||||
@@ -3,7 +3,7 @@ import { warn } from '../warning'
|
||||
|
||||
/**
|
||||
* For prefixing keys in v-on="obj" with "on"
|
||||
* @internal
|
||||
* @private
|
||||
*/
|
||||
export function toHandlers(obj: Record<string, any>): Record<string, any> {
|
||||
const ret: Record<string, any> = {}
|
||||
|
||||
@@ -7,7 +7,7 @@ import { ComponentInternalInstance } from '../component'
|
||||
|
||||
/**
|
||||
* Wrap a slot function to memoize current rendering instance
|
||||
* @internal
|
||||
* @private
|
||||
*/
|
||||
export function withCtx(
|
||||
fn: Slot,
|
||||
|
||||
Reference in New Issue
Block a user