1 | interface ComponentCompilerPropertyComplexType {
|
2 | /**
|
3 | * The string of the original type annotation in the Stencil source code
|
4 | */
|
5 | original: string;
|
6 | /**
|
7 | * A 'resolved' type, where e.g. imported types have been resolved and inlined
|
8 | *
|
9 | * For instance, an annotation like `(foo: Foo) => string;` will be
|
10 | * converted to `(foo: { foo: string }) => string;`.
|
11 | */
|
12 | resolved: string;
|
13 | /**
|
14 | * A record of the types which were referenced in the assorted type
|
15 | * annotation in the original source file.
|
16 | */
|
17 | references: ComponentCompilerTypeReferences;
|
18 | }
|
19 | type ComponentCompilerTypeReferences = Record<string, ComponentCompilerTypeReference>;
|
20 | interface ComponentCompilerTypeReference {
|
21 | /**
|
22 | * A type may be defined:
|
23 | * - locally (in the same file as the component that uses it)
|
24 | * - globally
|
25 | * - by importing it into a file (and is defined elsewhere)
|
26 | */
|
27 | location: "local" | "global" | "import";
|
28 | /**
|
29 | * The path to the type reference, if applicable (global types should not need a path associated with them)
|
30 | */
|
31 | path?: string;
|
32 | /**
|
33 | * An ID for this type which is unique within a Stencil project.
|
34 | */
|
35 | id: string;
|
36 | }
|
37 | interface ComponentCompilerReferencedType {
|
38 | /**
|
39 | * The path to the module where the type is declared.
|
40 | */
|
41 | path: string;
|
42 | /**
|
43 | * The string of the original type annotation in the Stencil source code
|
44 | */
|
45 | declaration: string;
|
46 | /**
|
47 | * An extracted docstring
|
48 | */
|
49 | docstring: string;
|
50 | }
|
51 | interface ComponentCompilerEventComplexType {
|
52 | original: string;
|
53 | resolved: string;
|
54 | references: ComponentCompilerTypeReferences;
|
55 | }
|
56 | interface ComponentCompilerMethodComplexType {
|
57 | signature: string;
|
58 | parameters: CompilerJsDoc[];
|
59 | references: ComponentCompilerTypeReferences;
|
60 | return: string;
|
61 | }
|
62 | interface CompilerJsDoc {
|
63 | /**
|
64 | * The text associated with the JSDoc
|
65 | */
|
66 | text: string;
|
67 | /**
|
68 | * Tags included in the JSDoc
|
69 | */
|
70 | tags: CompilerJsDocTagInfo[];
|
71 | }
|
72 | interface CompilerJsDocTagInfo {
|
73 | /**
|
74 | * The name of the tag - e.g. `@deprecated`
|
75 | */
|
76 | name: string;
|
77 | /**
|
78 | * Additional text that is associated with the tag - e.g. `@deprecated use v2 of this API`
|
79 | */
|
80 | text?: string;
|
81 | }
|
82 | /**
|
83 | * The Type Library holds information about the types which are used in a
|
84 | * Stencil project. During compilation, Stencil gathers information about the
|
85 | * types which form part of a component's public API, such as properties
|
86 | * decorated with `@Prop`, `@Event`, `@Watch`, etc. This type information is
|
87 | * then added to the Type Library, where it can be accessed later on for
|
88 | * generating documentation.
|
89 | *
|
90 | * This information is included in the file written by the `docs-json` output
|
91 | * target (see {@link JsonDocs.typeLibrary}).
|
92 | */
|
93 | export type JsonDocsTypeLibrary = Record<string, ComponentCompilerReferencedType>;
|
94 | /**
|
95 | * A container for JSDoc metadata for a project
|
96 | */
|
97 | export interface JsonDocs {
|
98 | /**
|
99 | * The metadata for the JSDocs for each component in a Stencil project
|
100 | */
|
101 | components: JsonDocsComponent[];
|
102 | /**
|
103 | * The timestamp at which the metadata was generated, in the format YYYY-MM-DDThh:mm:ss
|
104 | */
|
105 | timestamp: string;
|
106 | compiler: {
|
107 | /**
|
108 | * The name of the compiler that generated the metadata
|
109 | */
|
110 | name: string;
|
111 | /**
|
112 | * The version of the Stencil compiler that generated the metadata
|
113 | */
|
114 | version: string;
|
115 | /**
|
116 | * The version of TypeScript that was used to generate the metadata
|
117 | */
|
118 | typescriptVersion: string;
|
119 | };
|
120 | typeLibrary: JsonDocsTypeLibrary;
|
121 | }
|
122 | /**
|
123 | * Container for JSDoc metadata for a single Stencil component
|
124 | */
|
125 | export interface JsonDocsComponent {
|
126 | /**
|
127 | * The directory containing the Stencil component, minus the file name.
|
128 | *
|
129 | * @example /workspaces/stencil-project/src/components/my-component
|
130 | */
|
131 | dirPath?: string;
|
132 | /**
|
133 | * The name of the file containing the Stencil component, with no path
|
134 | *
|
135 | * @example my-component.tsx
|
136 | */
|
137 | fileName?: string;
|
138 | /**
|
139 | * The full path of the file containing the Stencil component
|
140 | *
|
141 | * @example /workspaces/stencil-project/src/components/my-component/my-component.tsx
|
142 | */
|
143 | filePath?: string;
|
144 | /**
|
145 | * The path to the component's `readme.md` file, including the filename
|
146 | *
|
147 | * @example /workspaces/stencil-project/src/components/my-component/readme.md
|
148 | */
|
149 | readmePath?: string;
|
150 | /**
|
151 | * The path to the component's `usage` directory
|
152 | *
|
153 | * @example /workspaces/stencil-project/src/components/my-component/usage/
|
154 | */
|
155 | usagesDir?: string;
|
156 | /**
|
157 | * The encapsulation strategy for a component
|
158 | */
|
159 | encapsulation: "shadow" | "scoped" | "none";
|
160 | /**
|
161 | * The tag name for the component, for use in HTML
|
162 | */
|
163 | tag: string;
|
164 | /**
|
165 | * The contents of a component's `readme.md` that are user generated.
|
166 | *
|
167 | * Auto-generated contents are not stored in this reference.
|
168 | */
|
169 | readme: string;
|
170 | /**
|
171 | * The description of a Stencil component, found in the JSDoc that sits above the component's declaration
|
172 | */
|
173 | docs: string;
|
174 | /**
|
175 | * JSDoc tags found in the JSDoc comment written atop a component's declaration
|
176 | */
|
177 | docsTags: JsonDocsTag[];
|
178 | /**
|
179 | * The text from the class-level JSDoc for a Stencil component, if present.
|
180 | */
|
181 | overview?: string;
|
182 | /**
|
183 | * A mapping of usage example file names to their contents for the component.
|
184 | */
|
185 | usage: JsonDocsUsage;
|
186 | /**
|
187 | * Array of metadata for a component's `@Prop`s
|
188 | */
|
189 | props: JsonDocsProp[];
|
190 | /**
|
191 | * Array of metadata for a component's `@Method`s
|
192 | */
|
193 | methods: JsonDocsMethod[];
|
194 | /**
|
195 | * Array of metadata for a component's `@Event`s
|
196 | */
|
197 | events: JsonDocsEvent[];
|
198 | /**
|
199 | * Array of metadata for a component's `@Listen` handlers
|
200 | */
|
201 | listeners: JsonDocsListener[];
|
202 | /**
|
203 | * Array of metadata for a component's CSS styling information
|
204 | */
|
205 | styles: JsonDocsStyle[];
|
206 | /**
|
207 | * Array of component Slot information, generated from `@slot` tags
|
208 | */
|
209 | slots: JsonDocsSlot[];
|
210 | /**
|
211 | * Array of component Parts information, generate from `@part` tags
|
212 | */
|
213 | parts: JsonDocsPart[];
|
214 | /**
|
215 | * Array of metadata describing where the current component is used
|
216 | */
|
217 | dependents: string[];
|
218 | /**
|
219 | * Array of metadata listing the components which are used in current component
|
220 | */
|
221 | dependencies: string[];
|
222 | /**
|
223 | * Describes a tree of components coupling
|
224 | */
|
225 | dependencyGraph: JsonDocsDependencyGraph;
|
226 | /**
|
227 | * A deprecation reason/description found following a `@deprecated` tag
|
228 | */
|
229 | deprecation?: string;
|
230 | }
|
231 | export interface JsonDocsDependencyGraph {
|
232 | [tagName: string]: string[];
|
233 | }
|
234 | /**
|
235 | * A descriptor for a single JSDoc tag found in a block comment
|
236 | */
|
237 | export interface JsonDocsTag {
|
238 | /**
|
239 | * The tag name (immediately following the '@')
|
240 | */
|
241 | name: string;
|
242 | /**
|
243 | * The description that immediately follows the tag name
|
244 | */
|
245 | text?: string;
|
246 | }
|
247 | export interface JsonDocsValue {
|
248 | value?: string;
|
249 | type: string;
|
250 | }
|
251 | /**
|
252 | * A mapping of file names to their contents.
|
253 | *
|
254 | * This type is meant to be used when reading one or more usage markdown files associated with a component. For the
|
255 | * given directory structure:
|
256 | * ```
|
257 | * src/components/my-component
|
258 | * ├── my-component.tsx
|
259 | * └── usage
|
260 | * ├── bar.md
|
261 | * └── foo.md
|
262 | * ```
|
263 | * an instance of this type would include the name of the markdown file, mapped to its contents:
|
264 | * ```ts
|
265 | * {
|
266 | * 'bar': STRING_CONTENTS_OF_BAR.MD
|
267 | * 'foo': STRING_CONTENTS_OF_FOO.MD
|
268 | * }
|
269 | * ```
|
270 | */
|
271 | export interface JsonDocsUsage {
|
272 | [key: string]: string;
|
273 | }
|
274 | /**
|
275 | * An intermediate representation of a `@Prop` decorated member's JSDoc
|
276 | */
|
277 | export interface JsonDocsProp {
|
278 | /**
|
279 | * the name of the prop
|
280 | */
|
281 | name: string;
|
282 | complexType?: ComponentCompilerPropertyComplexType;
|
283 | /**
|
284 | * the type of the prop, in terms of the TypeScript type system (as opposed to JavaScript's or HTML's)
|
285 | */
|
286 | type: string;
|
287 | /**
|
288 | * `true` if the prop was configured as "mutable" where it was declared, `false` otherwise
|
289 | */
|
290 | mutable: boolean;
|
291 | /**
|
292 | * The name of the attribute that is exposed to configure a compiled web component
|
293 | */
|
294 | attr?: string;
|
295 | /**
|
296 | * `true` if the prop was configured to "reflect" back to HTML where it (the prop) was declared, `false` otherwise
|
297 | */
|
298 | reflectToAttr: boolean;
|
299 | /**
|
300 | * the JSDoc description text associated with the prop
|
301 | */
|
302 | docs: string;
|
303 | /**
|
304 | * JSDoc tags associated with the prop
|
305 | */
|
306 | docsTags: JsonDocsTag[];
|
307 | /**
|
308 | * The default value of the prop
|
309 | */
|
310 | default?: string;
|
311 | /**
|
312 | * Deprecation text associated with the prop. This is the text that immediately follows a `@deprecated` tag
|
313 | */
|
314 | deprecation?: string;
|
315 | values: JsonDocsValue[];
|
316 | /**
|
317 | * `true` if a component is declared with a '?', `false` otherwise
|
318 | *
|
319 | * @example
|
320 | * ```tsx
|
321 | * @Prop() componentProps?: any;
|
322 | * ```
|
323 | */
|
324 | optional: boolean;
|
325 | /**
|
326 | * `true` if a component is declared with a '!', `false` otherwise
|
327 | *
|
328 | * @example
|
329 | * ```tsx
|
330 | * @Prop() componentProps!: any;
|
331 | * ```
|
332 | */
|
333 | required: boolean;
|
334 | }
|
335 | export interface JsonDocsMethod {
|
336 | name: string;
|
337 | docs: string;
|
338 | docsTags: JsonDocsTag[];
|
339 | deprecation?: string;
|
340 | signature: string;
|
341 | returns: JsonDocsMethodReturn;
|
342 | parameters: JsonDocMethodParameter[];
|
343 | complexType: ComponentCompilerMethodComplexType;
|
344 | }
|
345 | export interface JsonDocsMethodReturn {
|
346 | type: string;
|
347 | docs: string;
|
348 | }
|
349 | export interface JsonDocMethodParameter {
|
350 | name: string;
|
351 | type: string;
|
352 | docs: string;
|
353 | }
|
354 | export interface JsonDocsEvent {
|
355 | event: string;
|
356 | bubbles: boolean;
|
357 | cancelable: boolean;
|
358 | composed: boolean;
|
359 | complexType: ComponentCompilerEventComplexType;
|
360 | docs: string;
|
361 | docsTags: JsonDocsTag[];
|
362 | deprecation?: string;
|
363 | detail: string;
|
364 | }
|
365 | export interface JsonDocsStyle {
|
366 | name: string;
|
367 | docs: string;
|
368 | annotation: string;
|
369 | }
|
370 | export interface JsonDocsListener {
|
371 | event: string;
|
372 | target?: string;
|
373 | capture: boolean;
|
374 | passive: boolean;
|
375 | }
|
376 | /**
|
377 | * A descriptor for a slot
|
378 | *
|
379 | * Objects of this type are translated from the JSDoc tag, `@slot`
|
380 | */
|
381 | export interface JsonDocsSlot {
|
382 | /**
|
383 | * The name of the slot. Defaults to an empty string for an unnamed slot.
|
384 | */
|
385 | name: string;
|
386 | /**
|
387 | * A textual description of the slot.
|
388 | */
|
389 | docs: string;
|
390 | }
|
391 | /**
|
392 | * A descriptor of a CSS Shadow Part
|
393 | *
|
394 | * Objects of this type are translated from the JSDoc tag, `@part`, or the 'part'
|
395 | * attribute on a component in TSX
|
396 | */
|
397 | export interface JsonDocsPart {
|
398 | /**
|
399 | * The name of the Shadow part
|
400 | */
|
401 | name: string;
|
402 | /**
|
403 | * A textual description of the Shadow part.
|
404 | */
|
405 | docs: string;
|
406 | }
|
407 | export interface StyleDoc {
|
408 | name: string;
|
409 | docs: string;
|
410 | annotation: "prop";
|
411 | }
|
412 |
|
413 | export {};
|