vnode.d.ts 2.4 KB

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