vnode.d.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import VNode from "../src/core/vdom/vnode";
  2. import { Component } from "./component";
  3. declare type VNodeChildren =
  4. | Array<null | VNode | string | VNodeChildren>
  5. | string;
  6. declare type VNodeComponentOptions = {
  7. Ctor: Component;
  8. propsData?: Object;
  9. listeners?: Object;
  10. children?: Array<VNode>;
  11. tag?: string;
  12. };
  13. declare type MountedComponentVNode = {
  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 = {
  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. declare interface VNodeData {
  36. key?: string | number;
  37. slot?: string;
  38. ref?: string;
  39. is?: string;
  40. pre?: boolean;
  41. tag?: string;
  42. staticClass?: string;
  43. class?: any;
  44. staticStyle?: { [key: string]: any };
  45. style?: string | Array<Object> | Object;
  46. normalizedStyle?: Object;
  47. props?: { [key: string]: any };
  48. attrs?: { [key: string]: string };
  49. domProps?: { [key: string]: any };
  50. hook?: { [key: string]: Function };
  51. on?: { [key: string]: Function | Array<Function> };
  52. nativeOn?: { [key: string]: Function | Array<Function> };
  53. transition?: Object;
  54. show?: boolean; // marker for v-show
  55. inlineTemplate?: {
  56. render: Function;
  57. staticRenderFns: Array<Function>;
  58. };
  59. directives?: Array<VNodeDirective>;
  60. keepAlive?: boolean;
  61. scopedSlots?: { [key: string]: Function };
  62. model?: {
  63. value: any;
  64. callback: Function;
  65. };
  66. }
  67. declare type VNodeDirective = {
  68. name: string;
  69. rawName: string;
  70. value?: any;
  71. oldValue?: any;
  72. arg?: string;
  73. oldArg?: string;
  74. modifiers?: ASTModifiers;
  75. def?: Object;
  76. };
  77. declare type ScopedSlotsData = Array<
  78. { key: string; fn: Function } | ScopedSlotsData
  79. >;