]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
feat(types): adjust type exports for manual render function and tooling usage
authorEvan You <yyx990803@gmail.com>
Wed, 10 Jun 2020 18:57:21 +0000 (14:57 -0400)
committerEvan You <yyx990803@gmail.com>
Wed, 10 Jun 2020 18:57:21 +0000 (14:57 -0400)
- 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

13 files changed:
api-extractor.json
packages/runtime-core/src/helpers/createSlots.ts
packages/runtime-core/src/helpers/renderList.ts
packages/runtime-core/src/helpers/renderSlot.ts
packages/runtime-core/src/helpers/resolveAssets.ts
packages/runtime-core/src/helpers/scopeId.ts
packages/runtime-core/src/helpers/toHandlers.ts
packages/runtime-core/src/helpers/withRenderContext.ts
packages/runtime-core/src/index.ts
packages/runtime-core/src/vnode.ts
packages/runtime-dom/src/directives/vModel.ts
packages/runtime-dom/src/directives/vOn.ts
packages/runtime-dom/src/directives/vShow.ts

index 5d26120d66a6991086c11ce9e7ae15e573baaa73..883bf47a3ae59e23db0a1d2673653159e79a3837 100644 (file)
     "tsdocMessageReporting": {
       "default": {
         "logLevel": "warning"
+      },
+
+      "tsdoc-undefined-tag": {
+        "logLevel": "none"
       }
     }
   }
index f6c9c9929f402197194bc0783614460a75cfa49c..ed92b2cb4cd077b83d4749be5ef10132925414f1 100644 (file)
@@ -8,7 +8,7 @@ interface CompiledSlotDescriptor {
 
 /**
  * Compiler runtime helper for creating dynamic slots object
- * @internal
+ * @private
  */
 export function createSlots(
   slots: Record<string, Slot>,
index 810ec1edc5c5bcde5c89a9d1790c671c97e609d7..f8238a46a16d8a30c8c3def56190b46beea75791 100644 (file)
@@ -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
index 41d942b2949a36b703fb2602b80e7dfee3a1ebfa..75d8c5111952f4792d6c92d35284ced9369e0257 100644 (file)
@@ -12,7 +12,7 @@ import { warn } from '../warning'
 
 /**
  * Compiler runtime helper for rendering <slot/>
- * @internal
+ * @private
  */
 export function renderSlot(
   slots: Slots,
index f7118a88fc786c8137ed52fc349178ecd7cdd9e0..3f11cc9aa71ef453e1b078058840880ca3eeb559 100644 (file)
@@ -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,
index 6c30ca100741a623d062cb7b129ec74ada5a7ee2..fbefe04a49956a6334d1af0f4f654f7fe25de28a 100644 (file)
@@ -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) =>
index a87b9e6858f487cb04fa756b36f04eb6b866e750..a7beede7ee9b4c866d7e630ba1fd8793275732ed 100644 (file)
@@ -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> = {}
index f8aeb397162e64e20d4ed536589d09565724bf27..a8f326d081e524b1b2f57005c25416d6b3c02bf1 100644 (file)
@@ -7,7 +7,7 @@ import { ComponentInternalInstance } from '../component'
 
 /**
  * Wrap a slot function to memoize current rendering instance
- * @internal
+ * @private
  */
 export function withCtx(
   fn: Slot,
index 5f8055520e8c9fc1f0447912b64ea872d8f9c385..ed929a027c2c0b9af401537f31dba0f761da2056 100644 (file)
@@ -229,11 +229,11 @@ export {
 // them in @vue/shared's typings
 import { toDisplayString, camelize } from '@vue/shared'
 /**
- * @internal
+ * @private
  */
 const _toDisplayString = toDisplayString
 /**
- * @internal
+ * @private
  */
 const _camelize = camelize
 export { _toDisplayString as toDisplayString, _camelize as camelize }
index 235c097c15c55c7e141fdd3bbdb75171ec744c58..b1d02603dc545681e0965e18879f8c9be92ab232 100644 (file)
@@ -161,7 +161,7 @@ let currentBlock: VNode[] | null = null
  * disableTracking is true when creating a v-for fragment block, since a v-for
  * fragment always diffs its children.
  *
- * @internal
+ * @private
  */
 export function openBlock(disableTracking = false) {
   blockStack.push((currentBlock = disableTracking ? null : []))
@@ -187,7 +187,7 @@ let shouldTrack = 1
  * )
  * ```
  *
- * @internal
+ * @private
  */
 export function setBlockTracking(value: number) {
   shouldTrack += value
@@ -198,7 +198,7 @@ export function setBlockTracking(value: number) {
  * A block root keeps track of dynamic nodes within the block in the
  * `dynamicChildren` array.
  *
- * @internal
+ * @private
  */
 export function createBlock(
   type: VNodeTypes | ClassComponent,
@@ -453,14 +453,14 @@ export function cloneVNode<T, U>(
 }
 
 /**
- * @internal
+ * @private
  */
 export function createTextVNode(text: string = ' ', flag: number = 0): VNode {
   return createVNode(Text, null, text, flag)
 }
 
 /**
- * @internal
+ * @private
  */
 export function createStaticVNode(
   content: string,
@@ -474,7 +474,7 @@ export function createStaticVNode(
 }
 
 /**
- * @internal
+ * @private
  */
 export function createCommentVNode(
   text: string = '',
index a0ae5ff60f5768d19dcfe9ad9d97c2102c375661..2caab0a78a156bbba4e8d5af78b0a0225d88c368 100644 (file)
@@ -42,11 +42,7 @@ function trigger(el: HTMLElement, type: string) {
 type ModelDirective<T> = ObjectDirective<T & { _assign: AssignerFn }>
 
 // 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. These are used by compilers
-// only and userland code should avoid relying on them.
-/**
- * @internal
- */
+// be tree-shaken in case v-model is never used.
 export const vModelText: ModelDirective<
   HTMLInputElement | HTMLTextAreaElement
 > = {
@@ -96,9 +92,6 @@ export const vModelText: ModelDirective<
   }
 }
 
-/**
- * @internal
- */
 export const vModelCheckbox: ModelDirective<HTMLInputElement> = {
   beforeMount(el, binding, vnode) {
     setChecked(el, binding, vnode)
@@ -144,9 +137,6 @@ function setChecked(
   }
 }
 
-/**
- * @internal
- */
 export const vModelRadio: ModelDirective<HTMLInputElement> = {
   beforeMount(el, { value }, vnode) {
     el.checked = looseEqual(value, vnode.props!.value)
@@ -163,9 +153,6 @@ export const vModelRadio: ModelDirective<HTMLInputElement> = {
   }
 }
 
-/**
- * @internal
- */
 export const vModelSelect: ModelDirective<HTMLSelectElement> = {
   // use mounted & updated because <select> relies on its children <option>s.
   mounted(el, { value }, vnode) {
@@ -227,9 +214,6 @@ function getCheckboxValue(
   return key in el ? el[key] : checked
 }
 
-/**
- * @internal
- */
 export const vModelDynamic: ObjectDirective<
   HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement
 > = {
index 155ee8e2579a0f1f8f1fc251b1a3c406bfe4f4f2..ce4a4d0c293764a823a3cb264e0f83a68ee00995 100644 (file)
@@ -23,7 +23,7 @@ const modifierGuards: Record<
 }
 
 /**
- * @internal
+ * @private
  */
 export const withModifiers = (fn: Function, modifiers: string[]) => {
   return (event: Event, ...args: unknown[]) => {
@@ -48,7 +48,7 @@ const keyNames: Record<string, string | string[]> = {
 }
 
 /**
- * @internal
+ * @private
  */
 export const withKeys = (fn: Function, modifiers: string[]) => {
   return (event: KeyboardEvent) => {
index 27a642454b6b2c43c82b00b89af05a64a9493fdd..2b1d9caef041e9ca18e2ecf5ef4f389e355bfd2b 100644 (file)
@@ -5,9 +5,6 @@ interface VShowElement extends HTMLElement {
   _vod: string
 }
 
-/**
- * @internal
- */
 export const vShow: ObjectDirective<VShowElement> = {
   beforeMount(el, { value }, { transition }) {
     el._vod = el.style.display === 'none' ? '' : el.style.display