ranui
Version:
A framework-agnostic Web Components UI library built on native custom elements, with TypeScript types, light/dark theming, SSR and PWA support.
53 lines (52 loc) • 1.72 kB
JavaScript
import "./builder-EH76YCFS.js";
import "./ssr-BzykYefm.js";
import "./theme-DKH_E9Cp.js";
import { adoptSheetText as d, adoptStyles as v } from "ranuts/utils";
var b = [
!1,
"false",
null,
void 0
], g = (t) => {
const r = t.hasAttribute("disabled"), a = t.getAttribute("disabled");
return !!(r && !b.includes(a));
}, c = "data-ranui", h = "data-ranui-sheet", A = (t, r) => v(t, r, c), f = (t, r) => d(t, r, h), o = /* @__PURE__ */ new WeakMap(), s = "@media (prefers-reduced-motion: reduce){*,*::before,*::after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important;scroll-behavior:auto !important}}", n = /* @__PURE__ */ new Map(), l = (t) => {
const r = n.get(t);
if (r !== void 0) return r;
const a = t ? `${t}
${s}` : s;
return n.set(t, a), a;
}, E = (t, r = "", a = { mode: "closed" }) => {
const e = t.shadowRoot || o.get(t) || t.attachShadow(a);
return o.set(t, e), A(e, l(r)), e;
}, M = (t, r) => {
if (t.current === null) throw new Error(`ranui: ${r} is missing its .ref() on the builder`);
return t.current;
}, $ = (t, r, a = "") => t.getAttribute(r) ?? a, _ = (t, r, a, e = {}) => {
if (e.removeEmpty && !a) {
t.removeAttribute(r);
return;
}
t.setAttribute(r, a ?? "");
}, y = (t, r, a, e = {}) => {
if (a) {
t.setAttribute(r, ""), e.aria && t.setAttribute(`aria-${e.aria}`, "true");
return;
}
t.removeAttribute(r), e.aria && t.removeAttribute(`aria-${e.aria}`);
}, C = (t, r, a, e, u) => {
if (a !== "sheet" || e === u) return;
const i = t.getAttribute("sheet") || "";
i && f(r, i);
};
export {
M as a,
b as c,
_ as i,
g as l,
$ as n,
C as o,
y as r,
A as s,
E as t
};