@yuebai008/cli
Version:
Command line interface for rapid qg-minigame development
3 lines • 1.12 kB
JavaScript
import*as LitHtml from"../../../ui/lit-html/lit-html.js";import*as ComponentHelpers from"../helpers/helpers.js";import nodeTextStyles from"./nodeText.css.js";const{render:render,html:html}=LitHtml;export class NodeText extends HTMLElement{static litTagName=LitHtml.literal`devtools-node-text`;#e=this.attachShadow({mode:"open"});#s="";#t="";#o=[];connectedCallback(){this.#e.adoptedStyleSheets=[nodeTextStyles]}set data(e){this.#s=e.nodeTitle,this.#t=e.nodeId,this.#o=e.nodeClasses,this.#l()}#l(){const e=Boolean(this.#t),s=Boolean(this.#o&&this.#o.length>0),t=[html`<span class="node-label-name">${this.#s}</span>`];if(this.#t){const e=LitHtml.Directives.classMap({"node-label-id":!0,"node-multiple-descriptors":s});t.push(html`<span class=${e}>#${CSS.escape(this.#t)}</span>`)}if(this.#o&&this.#o.length>0){const s=this.#o.map((e=>`.${CSS.escape(e)}`)).join(""),o=LitHtml.Directives.classMap({"node-label-class":!0,"node-multiple-descriptors":e});t.push(html`<span class=${o}>${s}</span>`)}render(html`
${t}
`,this.#e,{host:this})}}ComponentHelpers.CustomElements.defineComponent("devtools-node-text",NodeText);