UNPKG

ranui

Version:

A framework-agnostic Web Components UI library built on native custom elements, with TypeScript types, light/dark theming, SSR and PWA support.

41 lines (40 loc) 1.06 kB
import { p as s } from "./factory-WDxu11V0.js"; import "./builder-EH76YCFS.js"; import { t as o } from "./utils-U-9uH7EX.js"; import { a as i, n } from "./ssr-BzykYefm.js"; var a = ":host{visibility:hidden;position:absolute}", r = class extends n { observer; _shadowDom; _slot; constructor() { super(), this._shadowDom = o(this, a); const t = s().class("slot").build(); this._shadowDom.appendChild(t), this._slot = t, this.observer = new MutationObserver(this.callback); } callback = (t) => { for (const e of t) e.type === "childList" ? this.onChange(e) : e.type === "attributes" && this.onChange(e); }; onChange = (t) => { this.dispatchEvent(new CustomEvent("change", { detail: { type: t.type, value: { content: this.children, mutation: t } } })); }; connectedCallback() { this.observer.observe(this, { attributes: !0, childList: !0, subtree: !0 }); } disconnectedCallback() { this.observer.disconnect(); } }; i("r-content", r); export { r as t };