runem / web-component-analyzer

CLI that analyzes web components and emits documentation
https://runem.github.io/web-component-analyzer
MIT License
504 stars 64 forks source link

[request] support @protected properties #105

Closed bennypowers closed 4 years ago

bennypowers commented 5 years ago

This input

import { LitElement, html, query } from 'lit-element';

/** @element */
class LeakyDocs extends LitElement {

  /**
   * Value
   * @attr
   */
  @property({ type: String }) value;

  /**
   * Internal input
   * @protected
   */
  @query('#input') input

  render() {
    return html`<input id="input" .value="${this.value}"/>`;
  }
}

produces this current output:


## Properties

| Property | Attribute | Type    | Default | Description    |
|----------|-----------|---------|---------|----------------|
| `input`  |           | `any`   |         | Internal input |
| `value`  | `value`   | `string`|         | value          |

WCA should produce instead an expected output without the protected property


## Properties

| Property | Attribute | Type    | Default | Description    |
|----------|-----------|---------|---------|----------------|
| `value`  | `value`   | `string`|         | value          |
daKmoR commented 5 years ago

imho protected properties can still be interesting for people extending your components...

only @private properties should be fully excluded.

I would like to see a protected: true in the custom-elements.json 🤗

for the readme any doc generator can then choose if to show protected properties or not

bennypowers commented 5 years ago

That works for me

lufego commented 5 years ago

@daKmoR apparently @private tag is not working as it should. I've opened https://github.com/runem/web-component-analyzer/issues/106

runem commented 5 years ago

I have now implemented support for @private and @protected jsdoc annotations on the visibility branch. The analyzer defaults to only emitting public properties, but it's possible to give minimum visibility to the config, when running the analyzer, in order to emit protected or private properties as well :-)

I'll close this issue when the feature has been published :tada:

runem commented 4 years ago

Version 1.0.0 is live with support for @private and @protected :tada: