vnode.d.ts 2.4 KB

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