@custom-elements-manifest/analyzer
Version:
<!-- [=> See Source <=](../../docs/analyzer/index.md) -->
70 lines (59 loc) • 1.66 kB
JavaScript
import { LitElement, property, customElement } from 'lit-element';
/**
* @attr my-attr
* @prop {string} prop1 this is the description
*/
('my-element')
class MyElement extends LitElement {
static get properties() {
return {
...super.properties,
prop1: { type: String }, // has default "'foo'"
prop2: { type: Boolean },
attr: { type: String, attribute: 'my-attr' }, // attr output as 'my-attr'
noAttr: { type: String, attribute: false }, // no attr output
/**
* @private
* @type {Boolean}
*/
_privateProp: { type: String },
reflect: {type: Boolean, reflect: true},
reflect2: {type: Boolean, reflect: true, attribute: 'reflect-2'},
}
}
// also attr
({})
decoratedProperty = [];
// attr output with name 'my-attr'
({attribute: 'my-attr2'})
decoratedPropertyAlsoAttr = [];
// no attr output
({attribute: false})
decoratedPropertyNoAttr = [];
/**
* @internal
*/
({reflect: true})
decoratedInternal;
({reflect: true})
decoratedReflect;
({reflect: true, attribute: 'decorated-reflect'})
decoratedReflect2;
constructor() {
super();
this.prop1 = 'foo';
}
}
/**
* Picks up property decorator on mixins as well
*/
export function InputMixin(superClass) {
class InputElement extends superClass {
/**
* this description never gets picked up by the analyzer.
* so we lose some info about default values and the fact it is both property and attribute
*/
({ type: Boolean }) disabled = false
}
return InputElement;
}