ranui
Version:
A framework-agnostic Web Components UI library built on native custom elements, with TypeScript types, light/dark theming, SSR and PWA support.
40 lines (39 loc) • 1.23 kB
JavaScript
import { n as s, t as o } from "./utils-D1iZnChu.js";
import { p as i } from "./factory-ZNhcQ4tf.js";
import { a, n } from "./ssr-DSGwPtEd.js";
var r = ".remove-wap-active-focus{outline:0;-webkit-tap-highlight-color:transparent}.remove-wap-active-focus:active,.remove-wap-active-focus:focus{outline:0;-webkit-tap-highlight-color:transparent}:host{visibility:hidden;position:absolute}", c = class extends n {
observer;
_shadowDom;
_slot;
constructor() {
super(), this._shadowDom = s(this, r);
const t = o(this._shadowDom, ".slot", () => i().class("slot").build());
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();
}
};
a("r-content", c);
export {
c as t
};