You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ANALYZE.md
+18-38Lines changed: 18 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
# Overview of what this library can analyze
4
4
5
-
This library is designed to analyze components no matter where they are found. This means it needs to find and analyze components in both javascript, typescript and in typescript definition (when consumed from a library).
5
+
This library is designed to analyze components no matter where they are found. This means it needs to find and analyze components in both javascript, typescript and in typescript definition files (when consumed from a library).
6
6
7
7
As you can see we loose a lot of information when the element is defined in a typescript definition file.
8
8
@@ -27,9 +27,9 @@ export class MyElement extends HTMLElement {
Copy file name to clipboardExpand all lines: README.md
+42-30Lines changed: 42 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,14 +12,13 @@
12
12
13
13
</p>
14
14
15
-
`web-component-analyzer` is a CLI that makes it possible to easily analyze web components. It analyzes your code and jsdoc in order to extract `properties`, `attributes`, `methods`, `events`, `slots` and `css custom properties`. Works with both javascript and typescript.
15
+
`web-component-analyzer` is a CLI that makes it possible to easily analyze web components. It analyzes your code and jsdoc in order to extract `properties`, `attributes`, `methods`, `events`, `slots`, `css shadow parts` and `css custom properties`. Works with both javascript and typescript.
16
16
17
-
In addition to [custom elements](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) this tool supports web components built with the following libraries:
17
+
In addition to [vanilla web components](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) this tool supports web components built with the following libraries:
The analyze command analyses an optional `input glob` and emits the output to the console as default. When the `input glob` is omitted it will find all components excluding `node_modules`. The default format is `markdown`.
41
38
@@ -46,36 +43,51 @@ The analyze command analyses an optional `input glob` and emits the output to th
The diagnose command analyses components and emits diagnostics. Right now it only emits diagnostics for LitElement's. When the optional `input glob` is omitted it analyzes all components excluding `node_modules`. If any diagnostics are emitted this command exits with a non zero exit code.
This json format is for experimental and demo purposes, and is still being actively discussed. You can expect changes to this format. Please follow and contribute to the discussion at:
Web Component Analyzer can output markdown documentation of your web components. This can either be output into a single file using `--outFile` or into multiple files using `--outDir`.
VSCode supports a JSON format called [vscode custom data](https://github.com/microsoft/vscode-custom-data) for the built in html editor which is set using `html.customData` vscode setting. Web Component Analyzer can output this format.
75
87
76
88
## ➤ API
77
89
78
-
You can also use the underlying functionality of this tool if you don't want to use the CLI. More documentation coming soon.
90
+
You can also use the underlying functionality of this tool if you don't want to use the CLI. Documentation will be added as soon as the API is considered stable.
This tool extract information about your components by looking at your code directly and by looking at your JSDoc comments.
92
104
93
-
**Code**: In addition to `custom elements` this tool supports `lit-element`, `stencil`, `polymer` and `skatejs` web components. [Click here](https://github.com/runem/web-component-analyzer/blob/master/ANALYZE.md) for an overview of how each web component type is analyzed.
105
+
**Code**: Web Component Analyzer supports multiple libraries. [Click here](https://github.com/runem/web-component-analyzer/blob/master/ANALYZE.md) for an overview of how each library is analyzed.
94
106
95
107
**JSDoc**: Read next section to learn more about how JSDoc is analyzed.
In addition to analyzing properties on your components this library also use JSDoc to construct the documentation. It's especially a good idea to use JSDoc for documenting `slots`, `events`and `cssprops` as these are under no circumstances analyzed statically by this tool as of now.
113
+
In addition to analyzing the code of your components, this library also use JSDoc to construct the documentation. It's especially a good idea to use JSDoc for documenting `slots`, `events`, `css custom properties`and `css shadow parts` as these not analyzed statically by this tool as of now (except when constructing a CustomEvent within your component).
102
114
103
-
Here's an example including all supported JSDoc tags. All tags are on the the form `@tag {type} name - comment`.
115
+
Here's an example including all supported JSDoc tags. All JSDoc tags are on the the form `@tag {type} name - comment`.
104
116
105
117
<!-- prettier-ignore -->
106
118
```javascript
@@ -150,15 +162,15 @@ class MyElement extends HTMLElement {
|`@element`| Gives your component a tag name. This JSDoc tag is especially useful if your 'customElements.define` is called dynamically eg. using a custom function. |
156
-
|`@fires`| Documents events. |
157
-
|`@slot`| Documents slots. Using an empty name here documents the unnamed (default) slot. |
158
-
|`@attr` or `@attribute`| Documents an attribute on your component. |
159
-
|`@prop` or `@property`| Documents a property on your component. |
160
-
|`@cssprop` or `@cssproperty`| Documents a css custom property on your component. |
161
-
|`@csspart`| Documents a css shadow part on your component. |
|`@element`| Gives your component a tag name. This JSDoc tag is useful if your 'customElements.define` is called dynamically eg. using a custom function. |
168
+
|`@fires`| Documents events. |
169
+
|`@slot`| Documents slots. Using an empty name here documents the unnamed (default) slot. |
170
+
|`@attr` or `@attribute`| Documents an attribute on your component. |
171
+
|`@prop` or `@property`| Documents a property on your component. |
172
+
|`@cssprop` or `@cssproperty`| Documents a css custom property on your component. |
173
+
|`@csspart`| Documents a css shadow part on your component. |
0 commit comments