radh-ui
Version:
Stencil Component Starter
98 lines (97 loc) • 2.7 kB
JavaScript
import { Component, Element, Event, h, Listen, Method, Prop, State } from "@stencil/core";
import { getLocaleComponentStrings } from "../../utils/locale";
export class RadhHello {
async loadStrings() {
this.strings = await getLocaleComponentStrings(this.myComponent);
}
componentWillLoad() {
return this.loadStrings();
}
async loadLocale() {
this.loadStrings();
}
onListenClick() {
this.selected.emit(this.name);
this.addClass();
}
addClass() {
this.myComponent.classList.add("active");
}
render() {
return (h("div", { id: "hello" },
this.strings.hello,
" ",
this.name));
}
static get is() { return "radh-hello"; }
static get originalStyleUrls() { return {
"$": ["radh-hello.css"]
}; }
static get styleUrls() { return {
"$": ["radh-hello.css"]
}; }
static get properties() { return {
"name": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"attribute": "name",
"reflect": false
}
}; }
static get states() { return {
"strings": {}
}; }
static get events() { return [{
"method": "selected",
"name": "selected",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "any",
"resolved": "any",
"references": {}
}
}]; }
static get methods() { return {
"loadLocale": {
"complexType": {
"signature": "() => Promise<void>",
"parameters": [],
"references": {
"Promise": {
"location": "global"
}
},
"return": "Promise<void>"
},
"docs": {
"text": "",
"tags": []
}
}
}; }
static get elementRef() { return "myComponent"; }
static get listeners() { return [{
"name": "click",
"method": "onListenClick",
"target": undefined,
"capture": false,
"passive": false
}]; }
}