@salla.sa/twilight-components
Version:
Salla Web Component
80 lines (79 loc) • 2.75 kB
JavaScript
/*!
* Crafted with ❤ by Salla
*/
import { Host, h } from "@stencil/core";
export class SallaHook {
/**
* Mounts a given HTML element into the hook position.
* @param element The element to inject.
*/
async mount(element) {
this.host.before(element);
}
render() {
return h(Host, { key: 'a887790b6c3fa466e88b0b1c90fda502f3aca812' });
}
async componentDidLoad() {
// Register this component for hooks system, already on it logic to run componentDidLoad trigger
await Salla.hooks.registerComponent('salla-hook', this);
}
static get is() { return "salla-hook"; }
static get encapsulation() { return "shadow"; }
static get styles() { return ":host {\n all: unset;\n display: none; /* marker only */\n }"; }
static get properties() {
return {
"name": {
"type": "string",
"attribute": "name",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "The unique name to identify the hook position."
},
"getter": false,
"setter": false,
"reflect": false
}
};
}
static get methods() {
return {
"mount": {
"complexType": {
"signature": "(element: HTMLElement) => Promise<void>",
"parameters": [{
"name": "element",
"type": "HTMLElement",
"docs": "The element to inject."
}],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
},
"HTMLElement": {
"location": "global",
"id": "global::HTMLElement"
}
},
"return": "Promise<void>"
},
"docs": {
"text": "Mounts a given HTML element into the hook position.",
"tags": [{
"name": "param",
"text": "element The element to inject."
}]
}
}
};
}
static get elementRef() { return "host"; }
}