refactor(types): mark internal API exports and exclude from d.ts
BREAKING CHANGE: Internal APIs are now excluded from type decalrations.
This commit is contained in:
parent
a5bb1d02b7
commit
c9bf7ded2e
@ -2,6 +2,6 @@
|
|||||||
"extends": "../../api-extractor.json",
|
"extends": "../../api-extractor.json",
|
||||||
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
|
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
|
||||||
"dtsRollup": {
|
"dtsRollup": {
|
||||||
"untrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
|
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
"extends": "../../api-extractor.json",
|
"extends": "../../api-extractor.json",
|
||||||
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
|
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
|
||||||
"dtsRollup": {
|
"dtsRollup": {
|
||||||
"untrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
|
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
"extends": "../../api-extractor.json",
|
"extends": "../../api-extractor.json",
|
||||||
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
|
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
|
||||||
"dtsRollup": {
|
"dtsRollup": {
|
||||||
"untrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
|
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
"extends": "../../api-extractor.json",
|
"extends": "../../api-extractor.json",
|
||||||
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
|
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
|
||||||
"dtsRollup": {
|
"dtsRollup": {
|
||||||
"untrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
|
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
"extends": "../../api-extractor.json",
|
"extends": "../../api-extractor.json",
|
||||||
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
|
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
|
||||||
"dtsRollup": {
|
"dtsRollup": {
|
||||||
"untrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
|
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
"extends": "../../api-extractor.json",
|
"extends": "../../api-extractor.json",
|
||||||
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
|
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
|
||||||
"dtsRollup": {
|
"dtsRollup": {
|
||||||
"untrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
|
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -417,7 +417,11 @@ type CompileFunction = (
|
|||||||
|
|
||||||
let compile: CompileFunction | undefined
|
let compile: CompileFunction | undefined
|
||||||
|
|
||||||
// exported method uses any to avoid d.ts relying on the compiler types.
|
/**
|
||||||
|
* For runtime-dom to register the compiler.
|
||||||
|
* Note the exported method uses any to avoid d.ts relying on the compiler types.
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export function registerRuntimeCompiler(_compile: any) {
|
export function registerRuntimeCompiler(_compile: any) {
|
||||||
compile = _compile
|
compile = _compile
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,10 @@ export type DirectiveArguments = Array<
|
|||||||
| [Directive, any, string, DirectiveModifiers]
|
| [Directive, any, string, DirectiveModifiers]
|
||||||
>
|
>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds directives to a VNode.
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export function withDirectives<T extends VNode>(
|
export function withDirectives<T extends VNode>(
|
||||||
vnode: T,
|
vnode: T,
|
||||||
directives: DirectiveArguments
|
directives: DirectiveArguments
|
||||||
|
@ -6,6 +6,10 @@ interface CompiledSlotDescriptor {
|
|||||||
fn: Slot
|
fn: Slot
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compiler runtime helper for creating dynamic slots object
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export function createSlots(
|
export function createSlots(
|
||||||
slots: Record<string, Slot>,
|
slots: Record<string, Slot>,
|
||||||
dynamicSlots: (
|
dynamicSlots: (
|
||||||
|
@ -1,31 +1,46 @@
|
|||||||
import { VNodeChild } from '../vnode'
|
import { VNodeChild } from '../vnode'
|
||||||
import { isArray, isString, isObject } from '@vue/shared'
|
import { isArray, isString, isObject } from '@vue/shared'
|
||||||
|
|
||||||
// v-for string
|
/**
|
||||||
|
* v-for string
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export function renderList(
|
export function renderList(
|
||||||
source: string,
|
source: string,
|
||||||
renderItem: (value: string, index: number) => VNodeChild
|
renderItem: (value: string, index: number) => VNodeChild
|
||||||
): VNodeChild[]
|
): VNodeChild[]
|
||||||
|
|
||||||
// v-for number
|
/**
|
||||||
|
* v-for number
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export function renderList(
|
export function renderList(
|
||||||
source: number,
|
source: number,
|
||||||
renderItem: (value: number, index: number) => VNodeChild
|
renderItem: (value: number, index: number) => VNodeChild
|
||||||
): VNodeChild[]
|
): VNodeChild[]
|
||||||
|
|
||||||
// v-for array
|
/**
|
||||||
|
* v-for array
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export function renderList<T>(
|
export function renderList<T>(
|
||||||
source: T[],
|
source: T[],
|
||||||
renderItem: (value: T, index: number) => VNodeChild
|
renderItem: (value: T, index: number) => VNodeChild
|
||||||
): VNodeChild[]
|
): VNodeChild[]
|
||||||
|
|
||||||
// v-for iterable
|
/**
|
||||||
|
* v-for iterable
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export function renderList<T>(
|
export function renderList<T>(
|
||||||
source: Iterable<T>,
|
source: Iterable<T>,
|
||||||
renderItem: (value: T, index: number) => VNodeChild
|
renderItem: (value: T, index: number) => VNodeChild
|
||||||
): VNodeChild[]
|
): VNodeChild[]
|
||||||
|
|
||||||
// v-for object
|
/**
|
||||||
|
* v-for object
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export function renderList<T>(
|
export function renderList<T>(
|
||||||
source: T,
|
source: T,
|
||||||
renderItem: <K extends keyof T>(
|
renderItem: <K extends keyof T>(
|
||||||
|
@ -10,6 +10,10 @@ import {
|
|||||||
import { PatchFlags } from '@vue/shared'
|
import { PatchFlags } from '@vue/shared'
|
||||||
import { warn } from '../warning'
|
import { warn } from '../warning'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compiler runtime helper for rendering <slot/>
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export function renderSlot(
|
export function renderSlot(
|
||||||
slots: Slots,
|
slots: Slots,
|
||||||
name: string,
|
name: string,
|
||||||
|
@ -12,12 +12,18 @@ import { warn } from '../warning'
|
|||||||
const COMPONENTS = 'components'
|
const COMPONENTS = 'components'
|
||||||
const DIRECTIVES = 'directives'
|
const DIRECTIVES = 'directives'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export function resolveComponent(name: string): Component | string | undefined {
|
export function resolveComponent(name: string): Component | string | undefined {
|
||||||
return resolveAsset(COMPONENTS, name) || name
|
return resolveAsset(COMPONENTS, name) || name
|
||||||
}
|
}
|
||||||
|
|
||||||
export const NULL_DYNAMIC_COMPONENT = Symbol()
|
export const NULL_DYNAMIC_COMPONENT = Symbol()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export function resolveDynamicComponent(
|
export function resolveDynamicComponent(
|
||||||
component: unknown
|
component: unknown
|
||||||
): Component | string | typeof NULL_DYNAMIC_COMPONENT {
|
): Component | string | typeof NULL_DYNAMIC_COMPONENT {
|
||||||
@ -29,6 +35,9 @@ export function resolveDynamicComponent(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export function resolveDirective(name: string): Directive | undefined {
|
export function resolveDirective(name: string): Directive | undefined {
|
||||||
return resolveAsset(DIRECTIVES, name)
|
return resolveAsset(DIRECTIVES, name)
|
||||||
}
|
}
|
||||||
|
@ -7,15 +7,24 @@ import { withCtx } from './withRenderContext'
|
|||||||
export let currentScopeId: string | null = null
|
export let currentScopeId: string | null = null
|
||||||
const scopeIdStack: string[] = []
|
const scopeIdStack: string[] = []
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export function pushScopeId(id: string) {
|
export function pushScopeId(id: string) {
|
||||||
scopeIdStack.push((currentScopeId = id))
|
scopeIdStack.push((currentScopeId = id))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export function popScopeId() {
|
export function popScopeId() {
|
||||||
scopeIdStack.pop()
|
scopeIdStack.pop()
|
||||||
currentScopeId = scopeIdStack[scopeIdStack.length - 1] || null
|
currentScopeId = scopeIdStack[scopeIdStack.length - 1] || null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export function withScopeId(id: string): <T extends Function>(fn: T) => T {
|
export function withScopeId(id: string): <T extends Function>(fn: T) => T {
|
||||||
return ((fn: Function) =>
|
return ((fn: Function) =>
|
||||||
withCtx(function(this: any) {
|
withCtx(function(this: any) {
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
import { isObject } from '@vue/shared'
|
import { isObject } from '@vue/shared'
|
||||||
import { warn } from '../warning'
|
import { warn } from '../warning'
|
||||||
|
|
||||||
// For prefixing keys in v-on="obj" with "on"
|
/**
|
||||||
|
* For prefixing keys in v-on="obj" with "on"
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export function toHandlers(obj: Record<string, any>): Record<string, any> {
|
export function toHandlers(obj: Record<string, any>): Record<string, any> {
|
||||||
const ret: Record<string, any> = {}
|
const ret: Record<string, any> = {}
|
||||||
if (__DEV__ && !isObject(obj)) {
|
if (__DEV__ && !isObject(obj)) {
|
||||||
|
@ -5,6 +5,10 @@ import {
|
|||||||
} from '../componentRenderUtils'
|
} from '../componentRenderUtils'
|
||||||
import { ComponentInternalInstance } from '../component'
|
import { ComponentInternalInstance } from '../component'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrap a slot function to memoize current rendering instance
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export function withCtx(
|
export function withCtx(
|
||||||
fn: Slot,
|
fn: Slot,
|
||||||
ctx: ComponentInternalInstance | null = currentRenderingInstance
|
ctx: ComponentInternalInstance | null = currentRenderingInstance
|
||||||
|
@ -74,9 +74,8 @@ export { useCSSModule } from './helpers/useCssModule'
|
|||||||
// SSR context
|
// SSR context
|
||||||
export { useSSRContext, ssrContextKey } from './helpers/useSsrContext'
|
export { useSSRContext, ssrContextKey } from './helpers/useSsrContext'
|
||||||
|
|
||||||
// Internal API ----------------------------------------------------------------
|
// Custom Renderer API ---------------------------------------------------------
|
||||||
|
|
||||||
// For custom renderers
|
|
||||||
export { createRenderer, createHydrationRenderer } from './renderer'
|
export { createRenderer, createHydrationRenderer } from './renderer'
|
||||||
export { queuePostFlushCb } from './scheduler'
|
export { queuePostFlushCb } from './scheduler'
|
||||||
export { warn } from './warning'
|
export { warn } from './warning'
|
||||||
@ -92,57 +91,6 @@ export {
|
|||||||
setTransitionHooks
|
setTransitionHooks
|
||||||
} from './components/BaseTransition'
|
} from './components/BaseTransition'
|
||||||
|
|
||||||
// For compiler generated code
|
|
||||||
// should sync with '@vue/compiler-core/src/runtimeConstants.ts'
|
|
||||||
export { withCtx } from './helpers/withRenderContext'
|
|
||||||
export { withDirectives } from './directives'
|
|
||||||
export {
|
|
||||||
resolveComponent,
|
|
||||||
resolveDirective,
|
|
||||||
resolveDynamicComponent
|
|
||||||
} from './helpers/resolveAssets'
|
|
||||||
export { renderList } from './helpers/renderList'
|
|
||||||
export { toHandlers } from './helpers/toHandlers'
|
|
||||||
export { renderSlot } from './helpers/renderSlot'
|
|
||||||
export { createSlots } from './helpers/createSlots'
|
|
||||||
export { pushScopeId, popScopeId, withScopeId } from './helpers/scopeId'
|
|
||||||
export {
|
|
||||||
setBlockTracking,
|
|
||||||
createTextVNode,
|
|
||||||
createCommentVNode,
|
|
||||||
createStaticVNode
|
|
||||||
} from './vnode'
|
|
||||||
export { toDisplayString, camelize } from '@vue/shared'
|
|
||||||
|
|
||||||
// For integration with runtime compiler
|
|
||||||
export { registerRuntimeCompiler } from './component'
|
|
||||||
|
|
||||||
// For test-utils
|
|
||||||
export { transformVNodeArgs } from './vnode'
|
|
||||||
|
|
||||||
// SSR -------------------------------------------------------------------------
|
|
||||||
|
|
||||||
import { createComponentInstance, setupComponent } from './component'
|
|
||||||
import {
|
|
||||||
renderComponentRoot,
|
|
||||||
setCurrentRenderingInstance
|
|
||||||
} from './componentRenderUtils'
|
|
||||||
import { isVNode, normalizeVNode } from './vnode'
|
|
||||||
import { normalizeSuspenseChildren } from './components/Suspense'
|
|
||||||
|
|
||||||
// SSR utils are only exposed in cjs builds.
|
|
||||||
const _ssrUtils = {
|
|
||||||
createComponentInstance,
|
|
||||||
setupComponent,
|
|
||||||
renderComponentRoot,
|
|
||||||
setCurrentRenderingInstance,
|
|
||||||
isVNode,
|
|
||||||
normalizeVNode,
|
|
||||||
normalizeSuspenseChildren
|
|
||||||
}
|
|
||||||
|
|
||||||
export const ssrUtils = (__NODE_JS__ ? _ssrUtils : null) as typeof _ssrUtils
|
|
||||||
|
|
||||||
// Types -----------------------------------------------------------------------
|
// Types -----------------------------------------------------------------------
|
||||||
|
|
||||||
export {
|
export {
|
||||||
@ -233,3 +181,63 @@ export {
|
|||||||
AsyncComponentLoader
|
AsyncComponentLoader
|
||||||
} from './apiAsyncComponent'
|
} from './apiAsyncComponent'
|
||||||
export { HMRRuntime } from './hmr'
|
export { HMRRuntime } from './hmr'
|
||||||
|
|
||||||
|
// Internal API ----------------------------------------------------------------
|
||||||
|
|
||||||
|
// **IMPORTANT** Internal APIs may change without notice between versions and
|
||||||
|
// user code should avoid relying on them.
|
||||||
|
|
||||||
|
// For compiler generated code
|
||||||
|
// should sync with '@vue/compiler-core/src/runtimeConstants.ts'
|
||||||
|
export { withCtx } from './helpers/withRenderContext'
|
||||||
|
export { withDirectives } from './directives'
|
||||||
|
export {
|
||||||
|
resolveComponent,
|
||||||
|
resolveDirective,
|
||||||
|
resolveDynamicComponent
|
||||||
|
} from './helpers/resolveAssets'
|
||||||
|
export { renderList } from './helpers/renderList'
|
||||||
|
export { toHandlers } from './helpers/toHandlers'
|
||||||
|
export { renderSlot } from './helpers/renderSlot'
|
||||||
|
export { createSlots } from './helpers/createSlots'
|
||||||
|
export { pushScopeId, popScopeId, withScopeId } from './helpers/scopeId'
|
||||||
|
export {
|
||||||
|
setBlockTracking,
|
||||||
|
createTextVNode,
|
||||||
|
createCommentVNode,
|
||||||
|
createStaticVNode
|
||||||
|
} from './vnode'
|
||||||
|
export { toDisplayString, camelize } from '@vue/shared'
|
||||||
|
// For integration with runtime compiler
|
||||||
|
export { registerRuntimeCompiler } from './component'
|
||||||
|
// For test-utils
|
||||||
|
export { transformVNodeArgs } from './vnode'
|
||||||
|
|
||||||
|
// SSR -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// **IMPORTANT** These APIs are exposed solely for @vue/server-renderer and may
|
||||||
|
// change without notice between versions. User code should never rely on them.
|
||||||
|
|
||||||
|
import { createComponentInstance, setupComponent } from './component'
|
||||||
|
import {
|
||||||
|
renderComponentRoot,
|
||||||
|
setCurrentRenderingInstance
|
||||||
|
} from './componentRenderUtils'
|
||||||
|
import { isVNode, normalizeVNode } from './vnode'
|
||||||
|
import { normalizeSuspenseChildren } from './components/Suspense'
|
||||||
|
|
||||||
|
const _ssrUtils = {
|
||||||
|
createComponentInstance,
|
||||||
|
setupComponent,
|
||||||
|
renderComponentRoot,
|
||||||
|
setCurrentRenderingInstance,
|
||||||
|
isVNode,
|
||||||
|
normalizeVNode,
|
||||||
|
normalizeSuspenseChildren
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export const ssrUtils = (__NODE_JS__ ? _ssrUtils : null) as typeof _ssrUtils
|
||||||
|
@ -155,15 +155,21 @@ export function openBlock(disableTracking = false) {
|
|||||||
// incremented/decremented by nested usage of v-once (see below)
|
// incremented/decremented by nested usage of v-once (see below)
|
||||||
let shouldTrack = 1
|
let shouldTrack = 1
|
||||||
|
|
||||||
// Block tracking sometimes needs to be disabled, for example during the
|
/**
|
||||||
// creation of a tree that needs to be cached by v-once. The compiler generates
|
* Block tracking sometimes needs to be disabled, for example during the
|
||||||
// code like this:
|
* creation of a tree that needs to be cached by v-once. The compiler generates
|
||||||
// _cache[1] || (
|
* code like this:
|
||||||
// setBlockTracking(-1),
|
*
|
||||||
// _cache[1] = createVNode(...),
|
* ``` js
|
||||||
// setBlockTracking(1),
|
* _cache[1] || (
|
||||||
// _cache[1]
|
* setBlockTracking(-1),
|
||||||
// )
|
* _cache[1] = createVNode(...),
|
||||||
|
* setBlockTracking(1),
|
||||||
|
* _cache[1]
|
||||||
|
* )
|
||||||
|
* ```
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export function setBlockTracking(value: number) {
|
export function setBlockTracking(value: number) {
|
||||||
shouldTrack += value
|
shouldTrack += value
|
||||||
}
|
}
|
||||||
@ -222,8 +228,11 @@ let vnodeArgsTransformer:
|
|||||||
) => Parameters<typeof _createVNode>)
|
) => Parameters<typeof _createVNode>)
|
||||||
| undefined
|
| undefined
|
||||||
|
|
||||||
// Internal API for registering an arguments transform for createVNode
|
/**
|
||||||
// used for creating stubs in the test-utils
|
* Internal API for registering an arguments transform for createVNode
|
||||||
|
* used for creating stubs in the test-utils
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export function transformVNodeArgs(transformer?: typeof vnodeArgsTransformer) {
|
export function transformVNodeArgs(transformer?: typeof vnodeArgsTransformer) {
|
||||||
vnodeArgsTransformer = transformer
|
vnodeArgsTransformer = transformer
|
||||||
}
|
}
|
||||||
@ -406,14 +415,23 @@ export function cloneVNode<T, U>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export function createTextVNode(text: string = ' ', flag: number = 0): VNode {
|
export function createTextVNode(text: string = ' ', flag: number = 0): VNode {
|
||||||
return createVNode(Text, null, text, flag)
|
return createVNode(Text, null, text, flag)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export function createStaticVNode(content: string): VNode {
|
export function createStaticVNode(content: string): VNode {
|
||||||
return createVNode(Static, null, content)
|
return createVNode(Static, null, content)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export function createCommentVNode(
|
export function createCommentVNode(
|
||||||
text: string = '',
|
text: string = '',
|
||||||
// when used as the v-else branch, the comment node must be created as a
|
// when used as the v-else branch, the comment node must be created as a
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
"extends": "../../api-extractor.json",
|
"extends": "../../api-extractor.json",
|
||||||
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
|
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
|
||||||
"dtsRollup": {
|
"dtsRollup": {
|
||||||
"untrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
|
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,11 @@ function toNumber(val: string): number | string {
|
|||||||
type ModelDirective<T> = ObjectDirective<T & { _assign: AssignerFn }>
|
type ModelDirective<T> = ObjectDirective<T & { _assign: AssignerFn }>
|
||||||
|
|
||||||
// We are exporting the v-model runtime directly as vnode hooks so that it can
|
// We are exporting the v-model runtime directly as vnode hooks so that it can
|
||||||
// be tree-shaken in case v-model is never used.
|
// be tree-shaken in case v-model is never used. These are used by compilers
|
||||||
|
// only and userland code should avoid relying on them.
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export const vModelText: ModelDirective<
|
export const vModelText: ModelDirective<
|
||||||
HTMLInputElement | HTMLTextAreaElement
|
HTMLInputElement | HTMLTextAreaElement
|
||||||
> = {
|
> = {
|
||||||
@ -90,6 +94,9 @@ export const vModelText: ModelDirective<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export const vModelCheckbox: ModelDirective<HTMLInputElement> = {
|
export const vModelCheckbox: ModelDirective<HTMLInputElement> = {
|
||||||
beforeMount(el, binding, vnode) {
|
beforeMount(el, binding, vnode) {
|
||||||
setChecked(el, binding, vnode)
|
setChecked(el, binding, vnode)
|
||||||
@ -135,6 +142,9 @@ function setChecked(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export const vModelRadio: ModelDirective<HTMLInputElement> = {
|
export const vModelRadio: ModelDirective<HTMLInputElement> = {
|
||||||
beforeMount(el, { value }, vnode) {
|
beforeMount(el, { value }, vnode) {
|
||||||
el.checked = looseEqual(value, vnode.props!.value)
|
el.checked = looseEqual(value, vnode.props!.value)
|
||||||
@ -151,6 +161,9 @@ export const vModelRadio: ModelDirective<HTMLInputElement> = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export const vModelSelect: ModelDirective<HTMLSelectElement> = {
|
export const vModelSelect: ModelDirective<HTMLSelectElement> = {
|
||||||
// use mounted & updated because <select> relies on its children <option>s.
|
// use mounted & updated because <select> relies on its children <option>s.
|
||||||
mounted(el, { value }, vnode) {
|
mounted(el, { value }, vnode) {
|
||||||
@ -212,6 +225,9 @@ function getCheckboxValue(
|
|||||||
return key in el ? el[key] : checked
|
return key in el ? el[key] : checked
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export const vModelDynamic: ObjectDirective<
|
export const vModelDynamic: ObjectDirective<
|
||||||
HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
|
HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
|
||||||
> = {
|
> = {
|
||||||
|
@ -22,6 +22,9 @@ const modifierGuards: Record<
|
|||||||
systemModifiers.some(m => (e as any)[`${m}Key`] && !modifiers.includes(m))
|
systemModifiers.some(m => (e as any)[`${m}Key`] && !modifiers.includes(m))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export const withModifiers = (fn: Function, modifiers: string[]) => {
|
export const withModifiers = (fn: Function, modifiers: string[]) => {
|
||||||
return (event: Event) => {
|
return (event: Event) => {
|
||||||
for (let i = 0; i < modifiers.length; i++) {
|
for (let i = 0; i < modifiers.length; i++) {
|
||||||
@ -44,6 +47,9 @@ const keyNames: Record<string, string | string[]> = {
|
|||||||
delete: 'backspace'
|
delete: 'backspace'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export const withKeys = (fn: Function, modifiers: string[]) => {
|
export const withKeys = (fn: Function, modifiers: string[]) => {
|
||||||
return (event: KeyboardEvent) => {
|
return (event: KeyboardEvent) => {
|
||||||
if (!('key' in event)) return
|
if (!('key' in event)) return
|
||||||
|
@ -5,6 +5,9 @@ interface VShowElement extends HTMLElement {
|
|||||||
_vod: string
|
_vod: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export const vShow: ObjectDirective<VShowElement> = {
|
export const vShow: ObjectDirective<VShowElement> = {
|
||||||
beforeMount(el, { value }, { transition }) {
|
beforeMount(el, { value }, { transition }) {
|
||||||
el._vod = el.style.display === 'none' ? '' : el.style.display
|
el._vod = el.style.display === 'none' ? '' : el.style.display
|
||||||
|
@ -109,7 +109,14 @@ function normalizeContainer(container: Element | string): Element | null {
|
|||||||
return container
|
return container
|
||||||
}
|
}
|
||||||
|
|
||||||
// DOM-only runtime directive helpers
|
// DOM-only components
|
||||||
|
export { Transition, TransitionProps } from './components/Transition'
|
||||||
|
export {
|
||||||
|
TransitionGroup,
|
||||||
|
TransitionGroupProps
|
||||||
|
} from './components/TransitionGroup'
|
||||||
|
|
||||||
|
// **Internal** DOM-only runtime directive helpers
|
||||||
export {
|
export {
|
||||||
vModelText,
|
vModelText,
|
||||||
vModelCheckbox,
|
vModelCheckbox,
|
||||||
@ -120,13 +127,6 @@ export {
|
|||||||
export { withModifiers, withKeys } from './directives/vOn'
|
export { withModifiers, withKeys } from './directives/vOn'
|
||||||
export { vShow } from './directives/vShow'
|
export { vShow } from './directives/vShow'
|
||||||
|
|
||||||
// DOM-only components
|
|
||||||
export { Transition, TransitionProps } from './components/Transition'
|
|
||||||
export {
|
|
||||||
TransitionGroup,
|
|
||||||
TransitionGroupProps
|
|
||||||
} from './components/TransitionGroup'
|
|
||||||
|
|
||||||
// re-export everything from core
|
// re-export everything from core
|
||||||
// h, Component, reactivity API, nextTick, flags & types
|
// h, Component, reactivity API, nextTick, flags & types
|
||||||
export * from '@vue/runtime-core'
|
export * from '@vue/runtime-core'
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
"extends": "../../api-extractor.json",
|
"extends": "../../api-extractor.json",
|
||||||
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
|
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
|
||||||
"dtsRollup": {
|
"dtsRollup": {
|
||||||
"untrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
|
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
"extends": "../../api-extractor.json",
|
"extends": "../../api-extractor.json",
|
||||||
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
|
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
|
||||||
"dtsRollup": {
|
"dtsRollup": {
|
||||||
"untrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
|
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
"extends": "../../api-extractor.json",
|
"extends": "../../api-extractor.json",
|
||||||
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
|
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
|
||||||
"dtsRollup": {
|
"dtsRollup": {
|
||||||
"untrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
|
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,6 +89,9 @@ const cacheStringFunction = <T extends (str: string) => string>(fn: T): T => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const camelizeRE = /-(\w)/g
|
const camelizeRE = /-(\w)/g
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export const camelize = cacheStringFunction(
|
export const camelize = cacheStringFunction(
|
||||||
(str: string): string => {
|
(str: string): string => {
|
||||||
return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''))
|
return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''))
|
||||||
@ -112,7 +115,10 @@ export const capitalize = cacheStringFunction(
|
|||||||
export const hasChanged = (value: any, oldValue: any): boolean =>
|
export const hasChanged = (value: any, oldValue: any): boolean =>
|
||||||
value !== oldValue && (value === value || oldValue === oldValue)
|
value !== oldValue && (value === value || oldValue === oldValue)
|
||||||
|
|
||||||
// for converting {{ interpolation }} values to displayed strings.
|
/**
|
||||||
|
* For converting {{ interpolation }} values to displayed strings.
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export const toDisplayString = (val: unknown): string => {
|
export const toDisplayString = (val: unknown): string => {
|
||||||
return val == null
|
return val == null
|
||||||
? ''
|
? ''
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
"extends": "../../api-extractor.json",
|
"extends": "../../api-extractor.json",
|
||||||
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
|
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
|
||||||
"dtsRollup": {
|
"dtsRollup": {
|
||||||
"untrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
|
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
scripts/bootstrap.js
vendored
2
scripts/bootstrap.js
vendored
@ -65,7 +65,7 @@ files.forEach(shortName => {
|
|||||||
"extends": "../../api-extractor.json",
|
"extends": "../../api-extractor.json",
|
||||||
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
|
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
|
||||||
"dtsRollup": {
|
"dtsRollup": {
|
||||||
"untrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
|
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`.trim()
|
`.trim()
|
||||||
|
Loading…
Reference in New Issue
Block a user