Files
webawesome/scripts/plop/templates/component/component.hbs

49 lines
1.2 KiB
Handlebars
Raw Normal View History

2022-08-17 11:37:37 -04:00
import { html } from 'lit';
2021-06-18 10:07:17 -04:00
import { customElement, property } from 'lit/decorators.js';
2022-08-17 11:37:37 -04:00
import ShoelaceElement from '../../internal/shoelace-element';
2022-03-24 08:01:09 -04:00
import { watch } from '../../internal/watch';
2022-08-17 11:37:37 -04:00
import { LocalizeController } from '../../utilities/localize';
2022-03-09 09:18:43 -05:00
import styles from './{{ tagWithoutPrefix tag }}.styles';
import type { CSSResultGroup } from 'lit';
2021-06-18 10:07:17 -04:00
/**
* @since 2.0
* @status experimental
*
* @dependency sl-example
*
2021-06-25 16:25:46 -04:00
* @event sl-event-name - Emitted as an example.
2021-06-18 10:07:17 -04:00
*
2021-06-25 16:25:46 -04:00
* @slot - The default slot.
* @slot example - An example slot.
*
2022-03-09 15:54:18 -05:00
* @csspart base - The component's internal wrapper.
*
2021-06-25 16:25:46 -04:00
* @cssproperty --example - An example CSS custom property.
2021-06-18 10:07:17 -04:00
*/
@customElement('{{ tag }}')
2022-08-17 11:37:37 -04:00
export default class {{ properCase tag }} extends ShoelaceElement {
static styles: CSSResultGroup = styles;
2021-06-18 10:07:17 -04:00
2022-08-17 11:37:37 -04:00
private readonly localize = new LocalizeController(this);
2021-06-18 10:07:17 -04:00
/** An example property. */
@property() prop = 'example';
@watch('someProp')
doSomething() {
// Example event
2022-09-16 16:21:40 -04:00
this.emit('sl-event-name');
}
2021-06-18 10:07:17 -04:00
render() {
return html` <slot></slot> `;
}
}
declare global {
interface HTMLElementTagNameMap {
'{{ tag }}': {{ properCase tag }};
}
}