From 08bea406b2fa1bc8fe8e2bd8df67ce3ea470a565 Mon Sep 17 00:00:00 2001 From: Anthony Johnson Date: Thu, 21 Mar 2024 16:41:47 -0700 Subject: [PATCH] Add missing file --- src/js/application/elements.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/js/application/elements.js diff --git a/src/js/application/elements.js b/src/js/application/elements.js new file mode 100644 index 00000000..385aafd8 --- /dev/null +++ b/src/js/application/elements.js @@ -0,0 +1,33 @@ +import { LitElement } from "lit"; + +/** + * LightDOMElement + * + * This is a helper class for using a light DOM with LitElement + * instead of a shadow DOM. Light DOM is what allows FUI styles + * to be used inside the element. + * + * Also adds some debugger helpers. + **/ +export class LightDOMElement extends LitElement { + // Use light DOM with inherited styles instead of shadow DOM + createRenderRoot() { + return this; + } + + // And some debugging calls + connectedCallback() { + super.connectedCallback(); + + console.debug("Setting up web component instance:", this.constructor.name); + } + + disconnectedCallback() { + super.disconnectedCallback(); + + console.debug( + "Disconnecting web component instance:", + this.constructor.name, + ); + } +}