ranui
Version:
A framework-agnostic Web Components UI library built on native custom elements, with TypeScript types, light/dark theming, SSR and PWA support.
88 lines (87 loc) • 2.92 kB
JavaScript
import { a as s, n as r, o as a, t as n } from "./utils-D1iZnChu.js";
import { t as h } from "./events-C59wGdni.js";
import { p as o } from "./factory-ZNhcQ4tf.js";
import { a as b, n as c } from "./ssr-DSGwPtEd.js";
var u = ".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}", d = class extends c {
static get observedAttributes() {
return [
"label",
"key",
"disabled",
"icon",
"effect",
"iconSize",
"sheet"
];
}
_events = new h();
_div;
parent;
_shadowDom;
constructor() {
super(), this._shadowDom = r(this, u);
const t = n(this._shadowDom, "slot", () => o().part("content").build());
this._div = t;
}
get label() {
return this.getAttribute("label") || "";
}
set label(t) {
this.setAttribute("label", t);
}
get icon() {
return this.getAttribute("icon");
}
set icon(t) {
!t || t === "false" ? this.removeAttribute("icon") : this.setAttribute("icon", t);
}
get iconSize() {
return this.getAttribute("iconSize");
}
set iconSize(t) {
!t || t === "false" ? this.removeAttribute("iconSize") : this.setAttribute("iconSize", t);
}
get key() {
return this.getAttribute("r-key");
}
set key(t) {
t ? this.setAttribute("r-key", t) : this.removeAttribute("r-key");
}
get disabled() {
return this.getAttribute("disabled");
}
set disabled(t) {
!t || t === "false" ? this.removeAttribute("disabled") : this.setAttribute("disabled", t);
}
get effect() {
return this.getAttribute("effect");
}
set effect(t) {
!t || t === "false" ? this.removeAttribute("effect") : this.setAttribute("effect", t);
}
get sheet() {
return this.getAttribute("sheet");
}
set sheet(t) {
s(this, "sheet", t);
}
handlerExternalCss = () => {
a(this, this._shadowDom, "sheet", null, this.sheet);
};
initAttribute = () => {
this.parent = this.parentNode, this.key && (this.parent?.updateAttribute(this.key, "icon", this.icon), this.parent?.updateAttribute(this.key, "iconSize", this.iconSize), this.parent?.updateAttribute(this.key, "effect", this.effect));
};
connectedCallback() {
this.handlerExternalCss(), this._events.on(document, "DOMContentLoaded", this.initAttribute);
}
disconnectedCallback() {
this._events.abort();
}
attributeChangedCallback(t, i, e) {
i !== e && (this.key && this.parent?.updateAttribute && (t === "icon" && this.parent?.updateAttribute(this.key, "icon", e), t === "iconSize" && this.parent?.updateAttribute(this.key, "iconSize", e), t === "effect" && this.parent?.updateAttribute(this.key, "effect", e), t === "disabled" && this.parent?.updateAttribute(this.key, "disabled", e)), t === "sheet" && this.handlerExternalCss());
}
};
b("r-tab", d);
export {
d as t
};