You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
2.1 KiB

1 month ago
  1. import type { InspectorNodeTag } from './api.js';
  2. import type { ID } from './util.js';
  3. export type ComponentInstance = any;
  4. export interface ComponentTreeNode {
  5. uid: ID;
  6. id: string;
  7. name: string;
  8. renderKey: string | number;
  9. inactive: boolean;
  10. isFragment: boolean;
  11. hasChildren: boolean;
  12. children: ComponentTreeNode[];
  13. domOrder?: number[];
  14. consoleId?: string;
  15. isRouterView?: boolean;
  16. macthedRouteSegment?: string;
  17. tags: InspectorNodeTag[];
  18. autoOpen: boolean;
  19. meta?: any;
  20. }
  21. export interface InspectedComponentData {
  22. id: string;
  23. name: string;
  24. file: string;
  25. state: ComponentState[];
  26. functional?: boolean;
  27. }
  28. export interface StateBase {
  29. key: string;
  30. value: any;
  31. editable?: boolean;
  32. objectType?: 'ref' | 'reactive' | 'computed' | 'other';
  33. raw?: string;
  34. }
  35. export interface ComponentStateBase extends StateBase {
  36. type: string;
  37. }
  38. export interface ComponentPropState extends ComponentStateBase {
  39. meta?: {
  40. type: string;
  41. required: boolean;
  42. /** Vue 1 only */
  43. mode?: 'default' | 'sync' | 'once';
  44. };
  45. }
  46. export type ComponentBuiltinCustomStateTypes = 'function' | 'map' | 'set' | 'reference' | 'component' | 'component-definition' | 'router' | 'store';
  47. export interface ComponentCustomState extends ComponentStateBase {
  48. value: CustomState;
  49. }
  50. export interface CustomState {
  51. _custom: {
  52. type: ComponentBuiltinCustomStateTypes | string;
  53. objectType?: string;
  54. display?: string;
  55. tooltip?: string;
  56. value?: any;
  57. abstract?: boolean;
  58. file?: string;
  59. uid?: number;
  60. readOnly?: boolean;
  61. /** Configure immediate child fields */
  62. fields?: {
  63. abstract?: boolean;
  64. };
  65. id?: any;
  66. actions?: {
  67. icon: string;
  68. tooltip?: string;
  69. action: () => void | Promise<void>;
  70. }[];
  71. /** internal */
  72. _reviveId?: number;
  73. };
  74. }
  75. export type ComponentState = ComponentStateBase | ComponentPropState | ComponentCustomState;
  76. export interface ComponentDevtoolsOptions {
  77. hide?: boolean;
  78. }