vnode.d.ts 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import VNode from '../src/core/vdom/vnode'
  2. import { Ref } from '../src/v3'
  3. import { Component } from './component'
  4. declare type VNodeChildren =
  5. | Array<null | VNode | string | number | VNodeChildren>
  6. | string
  7. declare type VNodeComponentOptions = {
  8. Ctor: typeof Component
  9. propsData?: Object
  10. listeners?: Record<string, Function | Function[]>
  11. children?: Array<VNode>
  12. tag?: string
  13. }
  14. declare type MountedComponentVNode = VNode & {
  15. context: Component
  16. componentOptions: VNodeComponentOptions
  17. componentInstance: Component
  18. parent: VNode
  19. data: VNodeData
  20. }
  21. // interface for vnodes in update modules
  22. declare type VNodeWithData = VNode & {
  23. tag: string
  24. data: VNodeData
  25. children: Array<VNode>
  26. text: void
  27. elm: any
  28. ns: string | void
  29. context: Component
  30. key: string | number | undefined
  31. parent?: VNodeWithData
  32. componentOptions?: VNodeComponentOptions
  33. componentInstance?: Component
  34. isRootInsert: boolean
  35. }
  36. // // interface for vnodes in update modules
  37. // declare type VNodeWithData = {
  38. // tag: string;
  39. // data: VNodeData;
  40. // children: Array<VNode>;
  41. // text: void;
  42. // elm: any;
  43. // ns: string | void;
  44. // context: Component;
  45. // key: string | number | undefined;
  46. // parent?: VNodeWithData;
  47. // componentOptions?: VNodeComponentOptions;
  48. // componentInstance?: Component;
  49. // isRootInsert: boolean;
  50. // };
  51. declare interface VNodeData {
  52. key?: string | number
  53. slot?: string
  54. ref?: string | Ref | ((el: any) => void)
  55. is?: string
  56. pre?: boolean
  57. tag?: string
  58. staticClass?: string
  59. class?: any
  60. staticStyle?: { [key: string]: any }
  61. style?: string | Array<Object> | Object
  62. normalizedStyle?: Object
  63. props?: { [key: string]: any }
  64. attrs?: { [key: string]: string }
  65. domProps?: { [key: string]: any }
  66. hook?: { [key: string]: Function }
  67. on?: { [key: string]: Function | Array<Function> }
  68. nativeOn?: { [key: string]: Function | Array<Function> }
  69. transition?: Object
  70. show?: boolean // marker for v-show
  71. inlineTemplate?: {
  72. render: Function
  73. staticRenderFns: Array<Function>
  74. }
  75. directives?: Array<VNodeDirective>
  76. keepAlive?: boolean
  77. scopedSlots?: { [key: string]: Function }
  78. model?: {
  79. value: any
  80. callback: Function
  81. }
  82. [key: string]: any
  83. }
  84. declare type VNodeDirective = {
  85. name: string
  86. rawName: string
  87. value?: any
  88. oldValue?: any
  89. arg?: string
  90. oldArg?: string
  91. modifiers?: ASTModifiers
  92. def?: Object
  93. }
  94. declare type ScopedSlotsData = Array<
  95. { key: string; fn: Function } | ScopedSlotsData
  96. >