vnode.d.ts 2.1 KB

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