1import { TypeDocKind } from '~/components/plugins/api/APISectionUtils';
2
3// Generic data type
4
5export type GeneratedData = EnumDefinitionData &
6  MethodDefinitionData &
7  PropsDefinitionData &
8  DefaultPropsDefinitionData &
9  TypeGeneralData &
10  InterfaceDefinitionData &
11  ConstantDefinitionData &
12  ClassDefinitionData;
13
14// Shared data types
15
16export type CommentData = {
17  summary: CommentContentData[];
18  returns?: string;
19  blockTags?: CommentTagData[];
20};
21
22export type CommentTagData = {
23  tag: string;
24  content: CommentContentData[];
25};
26
27export type CommentContentData = {
28  kind: string;
29  text: string;
30};
31
32export type TypeDefinitionData = {
33  name?: string;
34  type: string;
35  types?: TypeDefinitionData[];
36  elements?: TypeDefinitionData[];
37  elementType?: {
38    name?: string;
39    type: string;
40    types?: TypeDefinitionData[];
41    declaration?: TypeDeclarationContentData;
42  };
43  queryType?: {
44    name: string;
45    type: string;
46  };
47  typeArguments?: TypeDefinitionData[];
48  checkType?: TypeDefinitionData;
49  falseType?: TypeDefinitionData;
50  trueType?: TypeDefinitionData;
51  extendsType?: {
52    type: string;
53    declaration?: TypeDeclarationContentData;
54  };
55  declaration?: TypeDeclarationContentData;
56  value?: string | number | boolean | null;
57  operator?: string;
58  objectType?: {
59    name: string;
60    type: string;
61  };
62  indexType?: {
63    type: string;
64    value: string;
65  };
66  qualifiedName?: string;
67};
68
69export type MethodParamData = {
70  name: string;
71  type: TypeDefinitionData;
72  comment?: CommentData;
73  flags?: TypePropertyDataFlags;
74  defaultValue?: string;
75};
76
77export type TypePropertyDataFlags = {
78  isExternal?: boolean;
79  isOptional?: boolean;
80  isStatic?: boolean;
81};
82
83// Constants section
84
85export type ConstantDefinitionData = {
86  name: string;
87  flags?: {
88    isConst: boolean;
89  };
90  comment?: CommentData;
91  kind: TypeDocKind;
92  type?: TypeDefinitionData;
93};
94
95// Enums section
96
97export type EnumDefinitionData = {
98  name: string;
99  children: EnumValueData[];
100  comment?: CommentData;
101  kind: TypeDocKind;
102};
103
104export type EnumValueData = {
105  name: string;
106  comment?: CommentData;
107  kind: TypeDocKind;
108  defaultValue?: string;
109  type: TypeDefinitionData;
110};
111
112// Interfaces section
113
114export type InterfaceDefinitionData = {
115  name: string;
116  children: PropData[];
117  comment?: CommentData;
118  kind: TypeDocKind;
119  extendedTypes?: TypeDefinitionData[];
120  implementedTypes?: TypeDefinitionData[];
121};
122
123// Classes section
124
125export type ClassDefinitionData = InterfaceDefinitionData & {
126  type?: TypeDefinitionData;
127  isSensor: boolean;
128};
129
130// Methods section
131
132export type MethodDefinitionData = {
133  name: string;
134  signatures: MethodSignatureData[];
135  getSignature?: MethodSignatureData[];
136  setSignatures?: MethodSignatureData[];
137  kind: TypeDocKind;
138};
139
140export type AccessorDefinitionData = {
141  name: string;
142  getSignature?: MethodSignatureData[];
143  kind: TypeDocKind;
144};
145
146export type MethodSignatureData = {
147  name: string;
148  parameters: MethodParamData[];
149  comment: CommentData;
150  type: TypeDefinitionData;
151};
152
153// Properties section
154
155export type PropsDefinitionData = {
156  name: string;
157  type?: TypeDefinitionData;
158  kind: TypeDocKind;
159  comment?: CommentData;
160  children?: PropData[];
161  extendedTypes?: TypeDefinitionData[];
162};
163
164export type PropData = {
165  name: string;
166  kind?: TypeDocKind;
167  comment?: CommentData;
168  type: TypeDefinitionData;
169  flags?: TypePropertyDataFlags;
170  defaultValue?: string;
171  signatures?: MethodSignatureData[];
172  overwrites?: TypeDefinitionData;
173  implementationOf?: TypeDefinitionData;
174  inheritedFrom?: TypeGeneralData;
175};
176
177export type DefaultPropsDefinitionData = {
178  name: string;
179  type: TypeDefinitionData;
180  kind: TypeDocKind;
181};
182
183// Types section
184
185export type TypeGeneralData = {
186  name: string;
187  comment: CommentData;
188  type: TypeDefinitionData;
189  typeParameter?: TypeGeneralData[];
190  kind: TypeDocKind;
191};
192
193export type TypeDeclarationContentData = {
194  name?: string;
195  kind?: TypeDocKind;
196  indexSignature?: TypeSignaturesData;
197  signatures?: TypeSignaturesData[];
198  parameters?: PropData[];
199  children?: PropData[];
200  comment?: CommentData;
201};
202
203export type TypeSignaturesData = {
204  name?: string;
205  comment?: CommentData;
206  parameters?: MethodParamData[];
207  type: TypeDefinitionData;
208  kind?: TypeDocKind;
209};
210