vnode.d.ts 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. import { Vue } from './vue'
  2. import { DirectiveFunction, DirectiveOptions } from './options'
  3. export type ScopedSlot = (props: any) => ScopedSlotReturnValue
  4. type ScopedSlotReturnValue =
  5. | VNode
  6. | string
  7. | boolean
  8. | null
  9. | undefined
  10. | ScopedSlotReturnArray
  11. interface ScopedSlotReturnArray extends Array<ScopedSlotReturnValue> {}
  12. // Scoped slots are guaranteed to return Array of VNodes starting in 2.6
  13. export type NormalizedScopedSlot = (props: any) => ScopedSlotChildren
  14. export type ScopedSlotChildren = VNode[] | undefined
  15. // Relaxed type compatible with $createElement
  16. export type VNodeChildren =
  17. | VNodeChildrenArrayContents
  18. | [ScopedSlot]
  19. | string
  20. | boolean
  21. | null
  22. | undefined
  23. export interface VNodeChildrenArrayContents
  24. extends Array<VNodeChildren | VNode> {}
  25. export interface VNode {
  26. tag?: string
  27. data?: VNodeData
  28. children?: VNode[]
  29. text?: string
  30. elm?: Node
  31. ns?: string
  32. context?: Vue
  33. key?: string | number | symbol | boolean
  34. componentOptions?: VNodeComponentOptions
  35. componentInstance?: Vue
  36. parent?: VNode
  37. raw?: boolean
  38. isStatic?: boolean
  39. isRootInsert: boolean
  40. isComment: boolean
  41. }
  42. export interface VNodeComponentOptions {
  43. Ctor: typeof Vue
  44. propsData?: object
  45. listeners?: object
  46. children?: VNode[]
  47. tag?: string
  48. }
  49. export interface VNodeData {
  50. key?: string | number
  51. slot?: string
  52. scopedSlots?: { [key: string]: ScopedSlot | undefined }
  53. ref?: string
  54. refInFor?: boolean
  55. tag?: string
  56. staticClass?: string
  57. class?: any
  58. staticStyle?: { [key: string]: any }
  59. style?: string | object[] | object
  60. props?: { [key: string]: any }
  61. attrs?: { [key: string]: any }
  62. domProps?: { [key: string]: any }
  63. hook?: { [key: string]: Function }
  64. on?: { [key: string]: Function | Function[] }
  65. nativeOn?: { [key: string]: Function | Function[] }
  66. transition?: object
  67. show?: boolean
  68. inlineTemplate?: {
  69. render: Function
  70. staticRenderFns: Function[]
  71. }
  72. directives?: VNodeDirective[]
  73. keepAlive?: boolean
  74. }
  75. export interface VNodeDirective {
  76. name: string
  77. value?: any
  78. oldValue?: any
  79. expression?: string
  80. arg?: string
  81. oldArg?: string
  82. modifiers?: { [key: string]: boolean }
  83. def?: DirectiveFunction | DirectiveOptions
  84. }