Something went wrong. Try again.
Mirror of https://github.com/improsocial/improAn extensible Bluesky client for web
Something went wrong. Try again.
989 B · 42 lines
JavaScript
12345678910111213141516171819202122232425262728293031323334353637383940414243import { Component, getChildrenFragment } from "/js/components/component.js";import { html, render } from "/js/lib/lit-html.js";
class ContextMenuItem extends Component { static get observedAttributes() { return ["disabled"]; }
connectedCallback() { if (this._initialized) { return; } this._children = getChildrenFragment(this); this.innerHTML = ""; this.disabled = this.getAttribute("disabled") !== null; this.render(); this._initialized = true; }
attributeChangedCallback(name) { if (!this._initialized) { return; } if (name === "disabled") { this.disabled = this.getAttribute("disabled") !== null; this.render(); } }
render() { render( html`<div class="context-menu-item"> <button ?disabled=${this.disabled}></button> </div> `, this, ); const button = this.querySelector("button"); button.appendChild(this._children); }}
ContextMenuItem.register();