shoelace/scripts/plop/templates/component/component.hbs

45 wiersze
1017 B
Handlebars
Czysty Zwykły widok Historia

2021-06-18 14:07:17 +00:00
import { LitElement, html, unsafeCSS } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { emit } from '../../internal/event';
import { watch } from '../../internal/watch';
2021-06-18 14:07:17 +00:00
import styles from 'sass:./{{ tagWithoutPrefix tag }}.scss';
/**
* @since 2.0
* @status experimental
*
* @dependency sl-example
*
2021-06-25 20:25:46 +00:00
* @event sl-event-name - Emitted as an example.
2021-06-18 14:07:17 +00:00
*
2021-06-25 20:25:46 +00:00
* @slot - The default slot.
* @slot example - An example slot.
*
2021-06-25 20:25:46 +00:00
* @csspart base - The component's base wrapper.
*
2021-06-25 20:25:46 +00:00
* @cssproperty --example - An example CSS custom property.
2021-06-18 14:07:17 +00:00
*/
@customElement('{{ tag }}')
export default class {{ properCase tag }} extends LitElement {
static styles = unsafeCSS(styles);
/** An example property. */
@property() prop = 'example';
@watch('someProp')
doSomething() {
// Example event
emit(this, 'sl-event-name');
}
2021-06-18 14:07:17 +00:00
render() {
return html` <slot></slot> `;
}
}
declare global {
interface HTMLElementTagNameMap {
'{{ tag }}': {{ properCase tag }};
}
}