vnode.d.ts 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import { Vue } from "./vue";
  2. // Scoped slots can technically return anything if used from
  3. // a render function, but this is "good enough" for templates
  4. export type ScopedSlot = (props: any) => ScopedSlotChildren;
  5. export type ScopedSlotChildren = ScopedSlotArrayContents | VNode | string | undefined;
  6. export interface ScopedSlotArrayContents extends Array<ScopedSlotChildren> {}
  7. // Relaxed type compatible with $createElement
  8. export type VNodeChildren = VNodeChildrenArrayContents | [ScopedSlot] | string | boolean | null | undefined;
  9. export interface VNodeChildrenArrayContents extends Array<VNodeChildren | VNode> {}
  10. export interface VNode {
  11. tag?: string;
  12. data?: VNodeData;
  13. children?: VNode[];
  14. text?: string;
  15. elm?: Node;
  16. ns?: string;
  17. context?: Vue;
  18. key?: string | number;
  19. componentOptions?: VNodeComponentOptions;
  20. componentInstance?: Vue;
  21. parent?: VNode;
  22. raw?: boolean;
  23. isStatic?: boolean;
  24. isRootInsert: boolean;
  25. isComment: boolean;
  26. }
  27. export interface VNodeComponentOptions {
  28. Ctor: typeof Vue;
  29. propsData?: object;
  30. listeners?: object;
  31. children?: VNode[];
  32. tag?: string;
  33. }
  34. export interface VNodeData {
  35. key?: string | number;
  36. slot?: string;
  37. scopedSlots?: { [key: string]: ScopedSlot | undefined };
  38. ref?: string;
  39. refInFor?: boolean;
  40. tag?: string;
  41. staticClass?: string;
  42. class?: any;
  43. staticStyle?: { [key: string]: any };
  44. style?: object[] | object;
  45. props?: { [key: string]: any };
  46. attrs?: { [key: string]: any };
  47. domProps?: { [key: string]: any };
  48. hook?: { [key: string]: Function };
  49. on?: { [key: string]: Function | Function[] };
  50. nativeOn?: { [key: string]: Function | Function[] };
  51. transition?: object;
  52. show?: boolean;
  53. inlineTemplate?: {
  54. render: Function;
  55. staticRenderFns: Function[];
  56. };
  57. directives?: VNodeDirective[];
  58. keepAlive?: boolean;
  59. }
  60. export interface VNodeDirective {
  61. name: string;
  62. value?: any;
  63. oldValue?: any;
  64. expression?: any;
  65. arg?: string;
  66. modifiers?: { [key: string]: boolean };
  67. }