Rewild Your Web
web browser dweb
at main 41 lines 724 B view raw
1// SPDX-License-Identifier: AGPL-3.0-or-later 2 3import { 4 LitElement, 5 html, 6 css, 7} from "//shared.localhost:8888/third_party/lit/lit-all.min.js"; 8 9export { html, css }; 10 11export class MenuBase extends LitElement { 12 static properties = { 13 open: { type: Boolean, reflect: true }, 14 }; 15 16 constructor() { 17 super(); 18 this.open = false; 19 } 20 21 handleItemClick(action) { 22 this.dispatchEvent( 23 new CustomEvent("menu-action", { 24 bubbles: true, 25 composed: true, 26 detail: { action }, 27 }), 28 ); 29 this.close(); 30 } 31 32 close() { 33 this.open = false; 34 this.dispatchEvent( 35 new CustomEvent("menu-closed", { 36 bubbles: true, 37 composed: true, 38 }), 39 ); 40 } 41}