Files
sigpro-ui/dist/sigpro-ui.js
natxocc 910c6ab3c7
All checks were successful
Deploy Docs to Synology / deploy (push) Successful in 4s
Before repair nav components
2026-04-25 11:24:39 +02:00

1432 lines
54 KiB
JavaScript

(() => {
var __defProp = Object.defineProperty;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __hasOwnProp = Object.prototype.hasOwnProperty;
function __accessProp(key) {
return this[key];
}
var __toCommonJS = (from) => {
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
if (entry)
return entry;
entry = __defProp({}, "__esModule", { value: true });
if (from && typeof from === "object" || typeof from === "function") {
for (var key of __getOwnPropNames(from))
if (!__hasOwnProp.call(entry, key))
__defProp(entry, key, {
get: __accessProp.bind(from, key),
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
}
__moduleCache.set(from, entry);
return entry;
};
var __moduleCache;
var __returnValue = (v) => v;
function __exportSetter(name, newValue) {
this[name] = __returnValue.bind(null, newValue);
}
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, {
get: all[name],
enumerable: true,
configurable: true,
set: __exportSetter.bind(all, name)
});
};
// index.js
var exports_sigpro_ui = {};
__export(exports_sigpro_ui, {
Utils: () => Utils,
Components: () => Components
});
// components/All.js
var exports_All = {};
__export(exports_All, {
listKey: () => listKey,
isFn: () => isFn,
getBy: () => getBy,
get: () => get,
filterBy: () => filterBy,
cls: () => cls,
Tooltip: () => Tooltip,
Toggle: () => Toggle,
Toast: () => Toast,
Timeline: () => Timeline,
Textarea: () => Textarea,
TextRotate: () => TextRotate,
Tabs: () => Tabs,
Table: () => Table,
Swap: () => Swap,
Steps: () => Steps,
Step: () => Step,
Stack: () => Stack,
SkeletonText: () => SkeletonText,
Skeleton: () => Skeleton,
Select: () => Select,
Rating: () => Rating,
Range: () => Range,
Radio: () => Radio,
Radial: () => Radial,
Progress: () => Progress,
Navbar: () => Navbar,
Modal: () => Modal,
Menu: () => Menu,
Loading: () => Loading,
Kbd: () => Kbd,
Input: () => Input,
Indicator: () => Indicator,
Icon: () => Icon,
Fileinput: () => Fileinput,
Fieldset: () => Fieldset,
Fab: () => Fab,
Dropdown: () => Dropdown,
Drawer: () => Drawer,
Divider: () => Divider,
Datepicker: () => Datepicker,
Colorpicker: () => Colorpicker,
Checkbox: () => Checkbox,
ChatImage: () => ChatImage,
ChatHeader: () => ChatHeader,
ChatFooter: () => ChatFooter,
ChatBubble: () => ChatBubble,
Chat: () => Chat,
CarouselItem: () => CarouselItem,
Carousel: () => Carousel,
CardTitle: () => CardTitle,
CardBody: () => CardBody,
CardActions: () => CardActions,
Card: () => Card,
Calendar: () => Calendar,
Button: () => Button,
Badge: () => Badge,
Autocomplete: () => Autocomplete,
Alert: () => Alert,
Accordion: () => Accordion
});
// node_modules/sigpro/dist/sigpro.esm.min.js
var y = (e) => typeof e === "function";
var P = (e) => e && typeof e === "object";
var b = Array.isArray;
var g = typeof document < "u" ? document : null;
var k = (e) => e?._isRuntime ? e.container : e instanceof Node ? e : g.createTextNode(e == null ? "" : String(e));
var p = null;
var _ = null;
var x = false;
var A = 0;
var C = new Set;
var D = new WeakMap;
var $ = Symbol("iter");
var B = new WeakMap;
var E = (e) => {
if (!e || e._disposed)
return;
e._disposed = true;
let o = [e];
while (o.length) {
let n = o.pop();
if (n._cleanups)
n._cleanups.forEach((i) => i()), n._cleanups.clear();
if (n._children)
n._children.forEach((i) => o.push(i)), n._children.clear();
if (n._deps)
n._deps.forEach((i) => i.delete(n)), n._deps.clear();
}
};
var N = (e) => {
if (_)
(_._cleanups ||= new Set).add(e);
};
var V = (e) => {
let o = p;
p = null;
try {
return e();
} finally {
p = o;
}
};
var T = (e, o = false) => {
let n = () => {
if (n._disposed)
return;
if (n._deps)
n._deps.forEach((c) => c.delete(n));
if (n._cleanups)
n._cleanups.forEach((c) => c()), n._cleanups.clear();
let i = p, s = _;
p = _ = n;
try {
return n._result = e();
} catch (c) {
console.error("[SigPro]", c);
} finally {
p = i, _ = s;
}
};
if (n._deps = n._cleanups = n._children = null, n._disposed = false, n._isComputed = o, n._depth = p ? p._depth + 1 : 0, n._mounts = [], n._parent = _, _)
(_._children ||= new Set).add(n);
return n;
};
var q = () => {
if (x)
return;
x = true;
let e = Array.from(C).sort((o, n) => o._depth - n._depth);
C.clear();
for (let o of e)
if (!o._disposed)
o();
x = false;
};
var W = (e) => {
A++;
try {
return e();
} finally {
if (A--, A === 0 && C.size > 0 && !x)
q();
}
};
var w = (e, o = false) => {
if (!o && p && !p._disposed)
e.add(p), (p._deps ||= new Set).add(e);
else if (o && e.size > 0) {
let n = false;
for (let i of e) {
if (i === p || i._disposed)
continue;
if (i._isComputed) {
if (i._dirty = true, i._subs)
w(i._subs, true);
} else
C.add(i), n = true;
}
if (n && !x && A === 0)
queueMicrotask(q);
}
};
var S = (e, o = null) => {
let n = new Set;
if (y(e)) {
let i, s = () => {
if (s._dirty) {
let c = p;
p = s;
try {
let t = e();
if (!Object.is(i, t))
i = t, w(n, true);
} finally {
p = c;
}
s._dirty = false;
}
return w(n), i;
};
if (s._isComputed = true, s._subs = n, s._dirty = true, s._deps = null, s._disposed = false, s.stop = () => {}, _)
N(s.stop);
return s;
}
if (o)
try {
e = JSON.parse(localStorage.getItem(o)) ?? e;
} catch (i) {}
return (...i) => {
if (i.length) {
let s = y(i[0]) ? i[0](e) : i[0];
if (!Object.is(e, s)) {
if (e = s, o)
localStorage.setItem(o, JSON.stringify(e));
w(n, true);
}
}
return w(n), e;
};
};
var I = (e) => {
if (!P(e))
return e;
let o = D.get(e);
if (o)
return o;
let n = new Map, i = (c) => {
let t = n.get(c);
if (!t)
n.set(c, t = new Set);
return t;
}, s = new Proxy(e, { get(c, t, r) {
if (typeof t !== "symbol")
w(i(t));
return I(Reflect.get(c, t, r));
}, set(c, t, r, l) {
let u = Reflect.has(c, t), a = Reflect.get(c, t, l), f = Reflect.set(c, t, r, l);
if (f && !Object.is(a, r)) {
if (w(i(t), true), !u)
w(i($), true);
}
return f;
}, deleteProperty(c, t) {
let r = Reflect.deleteProperty(c, t);
if (r)
w(i(t), true), w(i($), true);
return r;
}, ownKeys(c) {
return w(i($)), Reflect.ownKeys(c);
} });
return D.set(e, s), s;
};
var R = (e, o) => {
if (o === undefined) {
let i = T(e);
return i(), () => E(i);
}
let n = T(() => {
let i = Array.isArray(e) ? e.map((s) => s()) : e();
V(() => o(i));
});
return n(), () => E(n);
};
var L = (e) => {
if (!e)
return;
if (e._cleanups)
e._cleanups.forEach((o) => o()), e._cleanups.clear();
if (e._ownerEffect)
E(e._ownerEffect);
if (e.childNodes)
e.childNodes.forEach((o) => L(o));
};
var F = /^\s*(javascript|data|vbscript):/i;
var J = (e) => e === "src" || e === "href" || e.startsWith("on");
var M = (e, o) => {
if (o == null || o === false)
return null;
if (J(e)) {
let n = String(o);
if (F.test(n))
return console.warn(`[SigPro] Bloqueado protocolo peligroso en ${e}`), "#";
}
return o;
};
var O = (e, o = {}, n = []) => {
if (o instanceof Node || b(o) || !P(o))
n = o, o = {};
if (y(e)) {
let t = T(() => {
let a = e(o, { children: n, emit: (f, ...h) => o[`on${f[0].toUpperCase()}${f.slice(1)}`]?.(...h) });
return t._result = a, a;
});
t();
let r = t._result;
if (r == null)
return null;
let l = r instanceof Node || b(r) && r.every((a) => a instanceof Node) ? r : g.createTextNode(String(r)), u = (a) => {
if (P(a) && !a._isRuntime)
a._mounts = t._mounts || [], a._cleanups = t._cleanups || new Set, a._ownerEffect = t;
};
return b(l) ? l.forEach(u) : u(l), l;
}
let i = /^(svg|path|circle|rect|line|poly(line|gon)|g|defs|text(path)?|tspan|use|symbol|image|marker|ellipse)$/i.test(e), s = i ? g.createElementNS("http://www.w3.org/2000/svg", e) : g.createElement(e);
s._cleanups = new Set;
for (let t in o) {
if (!o.hasOwnProperty(t))
continue;
let r = o[t];
if (t === "ref") {
y(r) ? r(s) : r.current = s;
continue;
}
if (i && t.startsWith("xlink:")) {
r == null ? s.removeAttributeNS("http://www.w3.org/1999/xlink", t.slice(6)) : s.setAttributeNS("http://www.w3.org/1999/xlink", t.slice(6), r);
continue;
}
if (t.startsWith("on")) {
let l = t.slice(2).toLowerCase();
s.addEventListener(l, r);
let u = () => s.removeEventListener(l, r);
s._cleanups.add(u), N(u);
} else if (y(r)) {
let l = T(() => {
let u = M(t, r());
if (t === "class")
s.className = u || "";
else if (u == null)
s.removeAttribute(t);
else if (t in s && !i)
s[t] = u;
else
s.setAttribute(t, u === true ? "" : u);
});
if (l(), s._cleanups.add(() => E(l)), N(() => E(l)), /^(INPUT|TEXTAREA|SELECT)$/.test(s.tagName) && (t === "value" || t === "checked")) {
let u = t === "checked" ? "change" : "input";
s.addEventListener(u, (a) => r(a.target[t]));
}
} else {
let l = M(t, r);
if (l != null)
if (t in s && !i)
s[t] = l;
else
s.setAttribute(t, l === true ? "" : l);
}
}
let c = (t) => {
if (b(t))
return t.forEach(c);
if (y(t)) {
let r = g.createTextNode("");
s.appendChild(r);
let l = [], u = T(() => {
let a = t(), f = (b(a) ? a : [a]).map(k);
l.forEach((d) => {
if (d._isRuntime)
d.destroy();
else
L(d);
if (d.parentNode)
d.remove();
});
let h = r;
for (let d = f.length - 1;d >= 0; d--) {
let m = f[d];
if (m.parentNode !== h.parentNode)
h.parentNode?.insertBefore(m, h);
if (m._mounts)
m._mounts.forEach((U) => U());
h = m;
}
l = f;
});
u(), s._cleanups.add(() => E(u)), N(() => E(u));
} else {
let r = k(t);
if (s.appendChild(r), r._mounts)
r._mounts.forEach((l) => l());
}
};
return c(n), s;
};
var j = (e) => {
let o = new Set, n = _, i = p, s = g.createElement("div");
s.style.display = "contents", s.setAttribute("role", "presentation"), _ = { _cleanups: o }, p = null;
let c = (t) => {
if (!t)
return;
if (t._isRuntime)
o.add(t.destroy), s.appendChild(t.container);
else if (b(t))
t.forEach(c);
else
s.appendChild(t instanceof Node ? t : g.createTextNode(String(t == null ? "" : t)));
};
try {
c(e({ onCleanup: (t) => o.add(t) }));
} finally {
_ = n, p = i;
}
return { _isRuntime: true, container: s, destroy: () => {
o.forEach((t) => t()), L(s), s.remove();
} };
};
var z = (e, o, n = null) => {
let i = g.createTextNode(""), s = O("div", { style: "display:contents" }, [i]), c = null;
return R(() => !!(y(e) ? e() : e), (t) => {
if (c)
c.destroy(), c = null;
let r = t ? o : n;
if (r)
c = j(() => y(r) ? r() : r), s.insertBefore(c.container, i);
}), N(() => c?.destroy()), s;
};
var G = ({ name: e, duration: o = 200, scale: n, slide: i, rotate: s, blur: c }, t) => {
let r = typeof t === "function" ? t() : t;
if (!(r instanceof Node))
return r;
if (e)
return r.style.animation = `${e}-in ${o}ms`, r;
let l = n || i || s || c, u = [n ? "scale(0.95)" : "", i ? "translateY(-10px)" : "", s ? "rotate(-2deg)" : ""].filter(Boolean).join(" ");
if (r.style.transition = `all ${o}ms ease`, r.style.opacity = "0", l)
r.style.transform = u;
if (c)
r.style.filter = "blur(4px)";
return requestAnimationFrame(() => {
if (r.style.opacity = "1", l)
r.style.transform = "none";
if (c)
r.style.filter = "none";
}), r;
};
var K = (e, o, n) => {
let i = g.createTextNode(""), s = O("div", { style: "display:contents" }, [i]), c = new Map;
return R(() => (y(e) ? e() : e) || [], (t) => {
let r = new Map, l = [], u = t || [];
for (let f = 0;f < u.length; f++) {
let h = u[f], d = n ? n(h, f) : h?.id ?? f, m = c.get(d);
if (!m)
m = j(() => o(h, f));
else
c.delete(d);
r.set(d, m), l.push(m);
}
c.forEach((f) => f.destroy());
let a = i;
for (let f = l.length - 1;f >= 0; f--) {
let d = l[f].container;
if (d.nextSibling !== a)
s.insertBefore(d, a);
a = d;
}
c = r;
}), s;
};
var v = (e) => {
let o = () => window.location.hash.slice(1) || "/", n = S(o()), i = () => n(o());
window.addEventListener("hashchange", i), N(() => window.removeEventListener("hashchange", i));
let s = O("div", { class: "router-hook" }), c = null;
return R([n], () => {
let t = n(), r = e.find((l) => {
let u = l.path.split("/").filter(Boolean), a = t.split("/").filter(Boolean);
return u.length === a.length && u.every((f, h) => f[0] === ":" || f === a[h]);
}) || e.find((l) => l.path === "*");
if (r) {
c?.destroy();
let l = {};
r.path.split("/").filter(Boolean).forEach((u, a) => {
if (u[0] === ":")
l[u.slice(1)] = t.split("/").filter(Boolean)[a];
}), v.params(l), c = j(() => y(r.component) ? r.component(l) : r.component), s.replaceChildren(c.container);
}
}), s;
};
v.params = S({});
v.to = (e) => window.location.hash = e.replace(/^#?\/?/, "#/");
v.back = () => window.history.back();
v.path = () => window.location.hash.replace(/^#/, "") || "/";
var Q = ({ url: e, method: o = "GET", headers: n = {} }) => {
let i = S(false), s = S(null), c = S(null), t = null, r = null;
return { run: async (a = null) => {
t?.abort(), clearTimeout(r), t = new AbortController, r = setTimeout(() => t.abort(), 1e4), i(true), s(null);
try {
let f = a instanceof FormData, h = await fetch(e, { method: o, headers: f ? n : { "Content-Type": "application/json", ...n }, body: f ? a : a ? JSON.stringify(a) : undefined, signal: t.signal }), d = await h.text(), m = d ? JSON.parse(d) : null;
if (!h.ok)
throw Error(m?.message || h.statusText);
return c(m), m;
} catch (f) {
if (f.name !== "AbortError")
s(f.message);
throw f;
} finally {
i(false), clearTimeout(r), t = null, r = null;
}
}, abort: () => t?.abort(), loading: i, error: s, data: c };
};
var H = (e, o) => {
let n = typeof o === "string" ? g.querySelector(o) : o;
if (!n)
return;
if (B.has(n))
B.get(n).destroy();
let i = j(y(e) ? e : () => e);
return n.replaceChildren(i.container), B.set(n, i), i;
};
var X = Object.freeze({ $: S, $$: I, watch: R, h: O, when: z, each: K, fx: G, router: v, req: Q, mount: H, batch: W });
if (typeof window < "u")
Object.assign(window, X), "a abbr article aside audio b blockquote br button canvas caption cite code col colgroup datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 header hr i iframe img input ins kbd label legend li main mark meter nav object ol optgroup option output p picture pre progress section select slot small source span strong sub summary sup svg table tbody td template textarea tfoot th thead time tr u ul video".split(" ").forEach((e) => {
window[e] = (o, n) => O(e, o, n);
});
// components/All.js
var get = (val) => typeof val === "function" ? val() : val;
var getBy = (item, field = "label") => item && typeof item === "object" ? item[field] : item;
var cls = (...classes) => classes.filter(Boolean).join(" ").trim();
var isFn = (f) => typeof f === "function";
var filterBy = (items, query, field = "label") => {
const searchTerm = String(query).toLowerCase();
const list = get(items);
return !searchTerm ? list : list.filter((item) => {
const text = item && typeof item === "object" ? item[field] : item;
return String(text).toLowerCase().includes(searchTerm);
});
};
var listKey = (items, isOpen) => {
const cursor = S(-1);
R(() => {
if (!get(isOpen))
cursor(-1);
});
const onKey = (e, select) => {
const list = get(items), i = cursor(), len = list.length;
if (!len)
return;
const k2 = e.key;
k2 === "ArrowDown" ? (e.preventDefault(), isOpen(true), cursor(Math.min(i + 1, len - 1))) : k2 === "ArrowUp" ? (e.preventDefault(), cursor(Math.max(i - 1, 0))) : k2 === "Enter" ? i >= 0 && (e.preventDefault(), select(list[i])) : k2 === "Escape" && isOpen(false);
};
return { cursor, onKey };
};
var Alert = (p2, c) => O("div", { ...p2, class: cls("alert", p2.class) }, c);
var Badge = (p2, c) => O("span", { ...p2, class: cls("badge", p2.class) }, c);
var Button = (p2, c) => O("button", { ...p2, class: cls("btn", p2.class) }, c);
var Card = (p2, c) => O("div", { ...p2, class: cls("card", p2.class) }, c);
var CardTitle = (p2, c) => O("div", { ...p2, class: cls("card-title", p2.class) }, c);
var CardBody = (p2, c) => O("div", { ...p2, class: cls("card-body", p2.class) }, c);
var CardActions = (p2, c) => O("div", { ...p2, class: cls("card-actions", p2.class) }, c);
var Carousel = (p2, c) => O("div", { ...p2, class: cls("carousel", p2.class) }, c);
var CarouselItem = (p2, c) => O("div", { ...p2, class: cls("carousel-item", p2.class) }, c);
var Chat = (p2, c) => O("div", { ...p2, class: cls("chat", p2.class) }, c);
var ChatBubble = (p2, c) => O("div", { ...p2, class: cls("chat-bubble", p2.class) }, c);
var ChatFooter = (p2, c) => O("div", { ...p2, class: cls("chat-footer", p2.class) }, c);
var ChatHeader = (p2, c) => O("div", { ...p2, class: cls("chat-header", p2.class) }, c);
var ChatImage = (p2, c) => O("div", { ...p2, class: cls("chat-image avatar", p2.class) }, O("div", { class: "w-10 rounded-full" }, typeof c === "string" ? O("img", { src: c, alt: "avatar" }) : c));
var Checkbox = (p2) => O("input", { ...p2, type: "checkbox", class: cls("checkbox", p2.class) });
var Divider = (p2) => O("div", { ...p2, class: cls("divider", p2.class) });
var Fab = (p2, c) => O("div", { ...p2, class: cls("fab", p2.class) }, c);
var Fieldset = (p2, c) => O("fieldset", { ...p2, class: cls("fieldset", p2.class) }, [p2.legend && O("legend", { class: "fieldset-legend" }, p2.legend), c]);
var Icon = (p2) => O("span", { class: p2.startsWith("icon-") ? p2 : "" }, p2.startsWith("icon-") ? null : p2);
var Indicator = (p2, c) => O("div", { ...p2, class: cls("indicator", p2.class) }, [p2.value && O("span", { class: cls("indicator-item badge", p2.class) }, p2.value), c]);
var Kbd = (p2, c) => O("kbd", { ...p2, class: cls("kbd", p2.class) }, c);
var Loading = (p2, c) => O("span", { ...p2, class: cls("loading loading-spinner", p2.class) }, c);
var Navbar = (p2, c) => O("div", { ...p2, class: cls("navbar", p2.class) }, c);
var Progress = (p2) => O("progress", { ...p2, class: cls("progress", p2.class) });
var Radial = (p2, c) => O("div", { ...p2, class: cls("radial-progress", p2.class), style: `--value:${p2.value ?? 0};${p2.style ?? ""}`, role: "progressbar", "aria-valuenow": p2.value ?? 0 }, c ?? `${p2.value ?? 0}%`);
var Radio = (p2) => O("input", { ...p2, type: "radio", class: cls("radio", p2.class) });
var Range = (p2) => O("input", { ...p2, type: "range", class: cls("range", p2.class) });
var Skeleton = (p2) => O("div", { ...p2, class: cls("skeleton", p2.class) });
var SkeletonText = (p2) => O("span", { ...p2, class: cls("skeleton skeleton-text", p2.class) });
var Stack = (p2, c) => O("div", { ...p2, class: cls("stack", p2.class) }, c);
var Steps = (p2, c) => O("ul", { ...p2, class: cls("steps", p2.class) }, c);
var Step = (p2, c) => O("li", { ...p2, class: cls("step", p2.class), "data-content": p2.dataContent }, c);
var Swap = (p2) => O("label", { ...p2, class: cls("swap", p2.class) }, [
O("input", { type: "checkbox", checked: () => get(p2.value), onchange: (e) => isFn(p2.value) && p2.value(e.target.checked) }),
O("div", { class: "swap-on" }, p2.on),
O("div", { class: "swap-off" }, p2.off)
]);
var Textarea = (p2) => O("textarea", { ...p2, class: cls("textarea", p2.class) });
var TextRotate = (p2) => {
const words = Array.isArray(p2.words) ? p2.words : typeof p2.words === "string" ? p2.words.split(",") : [];
return O("span", { ...p2, class: cls("text-rotate", p2.class) }, O("span", {}, words.map((w2) => O("span", {}, w2))));
};
var Timeline = (p2, c) => O("ul", {
...p2,
class: cls("timeline", p2.vertical !== false ? "timeline-vertical" : "timeline-horizontal", p2.compact ? "timeline-compact" : "", p2.class)
}, c);
var Toggle = (p2) => O("input", { ...p2, type: "checkbox", class: cls("toggle", p2.class) });
var Tooltip = (p2, c) => O("div", { ...p2, class: cls("tooltip", p2.class), "data-tip": p2.tip }, c);
var Accordion = (p2) => {
const name = p2.name || `acc-${Math.random().toString(36).slice(2)}`;
const base = cls("collapse", p2.variant && `collapse-${p2.variant}`, p2.class);
const itemFn = (it) => {
const t = getBy(it, "title");
const c = it.content;
return p2.type === "details" ? O("details", { class: base, name, open: it.open || undefined }, O("summary", { class: "collapse-title font-semibold" }, t), c ? O("div", { class: "collapse-content text-sm" }, c) : null) : O("div", { class: base }, O("input", { type: "radio", name, checked: it.open || undefined }), O("div", { class: "collapse-title font-semibold" }, t), c ? O("div", { class: "collapse-content text-sm" }, c) : null);
};
return isFn(p2.items) ? K(p2.items, itemFn, (it, i) => it?.id ?? i) : (p2.items || []).map(itemFn);
};
var Table = (p2) => {
if (p2.children !== undefined)
return O("table", { class: cls("table", p2.class), ...p2 }, p2.children);
const { items, columns = [], header = true, keyFn, ...rest } = p2;
const hd = header !== false && columns.some((c) => c.label) ? O("thead", {}, O("tr", {}, columns.map((c) => O("th", { class: c.class }, c.label)))) : null;
const bd = O("tbody", {}, K(() => get(items) || [], (it, idx) => O("tr", {}, columns.map((c) => {
const v2 = c.render ? c.render(it, idx) : it[c.key];
return O("td", { class: c.class }, v2);
})), keyFn || ((it, idx) => it?.id ?? idx)));
return O("table", { class: cls("table", rest.class), ...rest }, [hd, bd]);
};
var Tabs = (p2) => {
if (p2.children !== undefined)
return O("div", { class: cls("tabs", p2.class), ...p2 }, p2.children);
const { items, activeIndex, onClose, ...rest } = p2;
const closeHandler = onClose || (isFn(items) ? (idx) => {
const arr = get(items);
const newArr = arr.filter((_2, i) => i !== idx);
items(newArr);
if (activeIndex() >= newArr.length)
activeIndex(Math.max(0, newArr.length - 1));
} : null);
return O("div", { class: cls("tabs", p2.class), ...rest }, K(() => get(items) || [], (it, idx) => {
const act = () => activeIndex() === idx;
return [
O("a", {
role: "tab",
class: () => `tab ${act() ? "tab-active" : ""} ${it.class || ""}`,
onclick: (e) => {
e.preventDefault();
activeIndex(idx);
it.onclick?.(e);
}
}, getBy(it), it.closable ? O("span", {
class: "icon-[lucide--x] w-3.5 h-3.5 ml-2 cursor-pointer hover:opacity-70",
onclick: (e) => {
e.stopPropagation();
closeHandler?.(idx);
}
}) : null),
O("div", {
class: `tab-content ${it.contentClass || ""}`,
style: () => `display: ${act() ? "block" : "none"};`
}, isFn(it.content) ? it.content() : it.content)
];
}, (it, idx) => it.id ?? idx));
};
var Rating = (p2) => {
const name = `rating-${Math.random().toString(36).slice(2, 7)}`;
const stars = p2.children ?? Array.from({ length: p2.count || 5 }, (_2, i) => {
const v2 = i + 1;
return O("input", {
type: "radio",
name,
class: cls("mask", p2.mask || "mask-star"),
checked: () => get(p2.value) === v2,
onchange: () => isFn(p2.value) ? p2.value(v2) : p2.onchange?.(v2)
});
});
return O("div", { class: cls("rating", p2.class), ...p2 }, stars);
};
var Menu = (p2) => {
if (p2.children !== undefined)
return O("ul", { class: cls("menu", p2.class), ...p2 }, p2.children);
const { items, keyFn = (it, idx) => it?.id ?? idx, ...rest } = p2;
const render = (item) => item.children ? O("li", {}, O("details", {}, O("summary", {}, getBy(item)), O("ul", {}, Menu({ items: item.children })))) : O("li", {}, O("a", {
href: item.href,
onclick: item.onclick ? (e) => {
if (!item.href)
e.preventDefault();
item.onclick(e);
} : null
}, getBy(item)));
return O("ul", { class: cls("menu", rest.class), ...rest }, K(() => get(items) || [], render, keyFn));
};
var Drawer = (p2, c) => {
const id = p2.id || `drawer-${Math.random().toString(36).slice(2, 9)}`;
return O("div", { class: cls("drawer", p2.class) }, [
O("input", {
id,
type: "checkbox",
class: "drawer-toggle",
checked: () => get(p2.open),
onchange: (e) => isFn(p2.open) && p2.open(e.target.checked)
}),
O("div", { class: "drawer-content" }, c),
O("div", { class: "drawer-side" }, [
O("label", {
for: id,
class: "drawer-overlay",
onclick: () => isFn(p2.open) && p2.open(false)
}),
O("div", { class: "min-h-full bg-base-200 w-80 p-4" }, () => get(p2.side))
])
]);
};
var Dropdown = (p2, c) => {
const { trigger, items, ...rest } = p2;
const content = c || (items ? O("ul", {
class: "menu dropdown-content bg-base-100 rounded-box z-[1] w-52 p-2 shadow"
}, K(() => get(items) || [], (item) => O("li", {}, O("a", {
onclick: (e) => {
item.onclick?.(e);
e.currentTarget.closest("details").open = false;
}
}, getBy(item))), (it, idx) => it.id ?? idx)) : null);
return O("details", { class: cls("dropdown", rest.class), ...rest }, [
O("summary", { class: "btn m-1" }, trigger || "Dropdown"),
content
]);
};
var Select = (p2, c) => {
if (c !== undefined)
return O("select", { class: cls("select", p2.class), ...p2 }, c);
const { label, float, placeholder, placeholderDisabled = true, value, left, right, hint, items, keyFn, ...rest } = p2;
const opts = () => {
const raw = get(items) || [];
const ph = placeholder ? [{ disabled: placeholderDisabled, label: placeholder, value: "" }] : [];
return [...ph, ...raw];
};
return O("label", { class: float ? "floating-label" : "" }, [
float && O("span", {}, label),
O("label", { class: cls("select", rest.class) }, [
label && !float && O("span", { class: "label" }, label),
left ?? null,
O("select", {
value: () => get(value),
onchange: (e) => isFn(value) ? value(e.target.value) : rest.onchange?.(e)
}, K(opts, (item) => {
const val = getBy(item, item.value !== undefined ? "value" : undefined);
const lab = getBy(item, "label");
return O("option", { value: val, disabled: item.disabled || undefined }, lab);
}, (it, i) => it?.id ?? (typeof it === "string" ? it : it.value) ?? i)),
right ?? null
]),
hint && O("div", { class: "validator-hint" }, hint)
]);
};
var Autocomplete = ({ items, value, onselect, placeholder = "Buscar...", ...props }) => {
const query = S(get(value) || "");
const isOpen = S(false);
const filtered = S(() => filterBy(items, query()));
const { cursor, onKey } = listKey(filtered, isOpen);
const pick = (item) => {
const display = getBy(item);
const actual = typeof item === "string" ? item : item.value;
query(display);
if (isFn(value))
value(actual);
onselect?.(item);
isOpen(false);
};
return O("div", { class: "relative w-full" }, [
Input({
...props,
type: "text",
placeholder,
value: query,
left: O("span", { class: "icon-[lucide--search]" }),
oninput: (e) => {
query(e.target.value);
if (isFn(value))
value(e.target.value);
isOpen(true);
},
onfocus: () => isOpen(true),
onblur: () => setTimeout(() => isOpen(false), 150),
onkeydown: (e) => onKey(e, pick)
}),
z(isOpen, () => G({ duration: 200, slide: true }, O("ul", {
class: "absolute left-0 w-full menu bg-base-100 rounded-box mt-1 p-2 shadow-xl max-h-60 overflow-y-auto border border-base-300 z-50 flex-col flex-nowrap"
}, [
K(filtered, (item, idx) => O("li", {}, [
O("a", {
class: () => cursor() === idx ? "active bg-primary text-primary-content" : "",
onmousedown: (e) => e.preventDefault(),
onclick: () => pick(item),
onmouseenter: () => cursor(idx)
}, getBy(item))
]), (item, idx) => getBy(item) + idx),
() => filtered().length === 0 ? O("li", { class: "p-4 opacity-50 text-center" }, "Sin resultados") : null
])))
]);
};
var Input = (p2) => {
const { label, icon, float, placeholder, value, left, right, rule, hint, content, ...rest } = p2;
const showPassword = S(false);
const isFocused = S(false);
const isPassword = p2.type === "password";
const pattern = rule ?? null;
const inputType = () => isPassword ? get(showPassword) ? "text" : "password" : p2.type || "text";
return O("div", {
class: "input-container",
onfocusin: () => isFocused(true),
onfocusout: (e) => {
if (!e.currentTarget.contains(e.relatedTarget)) {
isFocused(false);
}
}
}, [
O("label", { class: float ? "floating-label" : "" }, [
float ? O("span", {}, label) : null,
O("label", { pattern, class: () => cls("input validator", p2.class) }, [
label && !float ? O("span", { class: "label" }, label) : null,
left ?? null,
O("input", { ...rest, type: inputType, class: "grow", pattern, placeholder: placeholder || label || " ", value }),
right ?? null,
isPassword ? O("label", { class: "swap swap-rotate ml-2" }, [
O("input", { type: "checkbox", onchange: (e) => showPassword(e.target.checked) }),
O("span", { class: "swap-on icon-[lucide--eye]" }),
O("span", { class: "swap-off icon-[lucide--eye-off]" })
]) : null
]),
hint ? O("div", { class: "validator-hint" }, hint) : null,
z(isFocused, () => G({ duration: 300, slide: true }, O("div", { class: "input-content", onmousedown: (e) => e.preventDefault() }, [
isFn(content) ? content(isFocused) : content
])))
])
]);
};
var Colorpicker = (p2) => {
const isOpen = S(false);
const current = () => get(p2.value) || "#000000";
const palette = [
"#000",
"#1A1A1A",
"#333",
"#4D4D4D",
"#666",
"#808080",
"#B3B3B3",
"#FFF",
"#450a0a",
"#7f1d1d",
"#991b1b",
"#b91c1c",
"#dc2626",
"#ef4444",
"#f87171",
"#fca5a5",
"#431407",
"#7c2d12",
"#9a3412",
"#c2410c",
"#ea580c",
"#f97316",
"#fb923c",
"#ffedd5",
"#713f12",
"#a16207",
"#ca8a04",
"#eab308",
"#facc15",
"#fde047",
"#fef08a",
"#fff9c4",
"#064e3b",
"#065f46",
"#059669",
"#10b981",
"#34d399",
"#4ade80",
"#84cc16",
"#d9f99d",
"#082f49",
"#075985",
"#0284c7",
"#0ea5e9",
"#38bdf8",
"#7dd3fc",
"#22d3ee",
"#cffafe",
"#1e1b4b",
"#312e81",
"#4338ca",
"#4f46e5",
"#6366f1",
"#818cf8",
"#a5b4fc",
"#e0e7ff",
"#2e1065",
"#4c1d95",
"#6d28d9",
"#7c3aed",
"#8b5cf6",
"#a855f7",
"#d946ef",
"#fae8ff"
];
const pick = (c) => {
isFn(p2.value) ? p2.value(c) : p2.onchange?.(c);
isOpen(false);
};
return O("div", { class: cls("relative w-fit", p2.class) }, [
O("button", {
type: "button",
class: "btn px-3 bg-base-100 border-base-300 hover:border-primary/50 flex items-center gap-2 shadow-sm font-normal normal-case",
onclick: (e) => {
e.stopPropagation();
isOpen(!isOpen());
}
}, [
O("div", { class: "size-5 rounded-sm shadow-inner border border-black/10 shrink-0", style: () => `background-color: ${current()}` }),
p2.label && O("span", { class: "opacity-80" }, p2.label)
]),
z(isOpen, () => [
O("div", {
class: "fixed inset-0 z-[100]",
onclick: () => isOpen(false)
}),
O("div", { class: "absolute left-0 mt-2 p-3 bg-base-100 border border-base-300 shadow-2xl rounded-box z-[110] w-64 select-none" }, O("div", { class: "grid grid-cols-8 gap-1" }, palette.map((c) => O("button", {
type: "button",
style: `background-color: ${c}`,
class: () => {
const act = current().toLowerCase() === c.toLowerCase();
return `size-6 rounded-sm cursor-pointer transition-all hover:scale-125 hover:z-10 active:scale-95 outline-none border border-black/5 p-0 min-h-0 ${act ? "ring-2 ring-offset-1 ring-primary z-10 scale-110" : ""}`;
},
onclick: () => pick(c)
}))))
])
]);
};
var Calendar = (p2) => {
const internalDate = S(new Date);
const hoverDate = S(null);
const startHour = S(0);
const endHour = S(0);
const now = new Date;
const todayStr = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(2, "0")}`;
const fmt = (d) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
const rangeMode = () => get(p2.range) === true;
const current = () => get(p2.value);
const selectDate = (date) => {
const s = fmt(date);
const v2 = current();
if (rangeMode()) {
if (!v2?.start || v2.start && v2.end) {
p2.onChange?.({ start: s, end: null, ...p2.hour && { startHour: startHour() } });
} else {
const start = v2.start;
const nv = s < start ? { start: s, end: start } : { start, end: s };
if (p2.hour) {
nv.startHour = v2.startHour ?? startHour();
nv.endHour = endHour();
}
p2.onChange?.(nv);
}
} else {
p2.onChange?.(p2.hour ? `${s}T${String(startHour()).padStart(2, "0")}:00:00` : s);
}
};
const move = (m) => {
const d = internalDate();
internalDate(new Date(d.getFullYear(), d.getMonth() + m, 1));
};
const moveYear = (y2) => {
const d = internalDate();
internalDate(new Date(d.getFullYear() + y2, d.getMonth(), 1));
};
const HourSlider = ({ value: hVal, onChange: onH }) => O("div", { class: "flex-1" }, [
O("div", { class: "flex gap-2 items-center" }, [
O("input", { type: "range", min: 0, max: 23, value: hVal, class: "range range-xs flex-1", oninput: (e) => onH(+e.target.value) }),
O("span", { class: "text-sm font-mono min-w-[48px] text-center" }, () => String(get(hVal)).padStart(2, "0") + ":00")
])
]);
return O("div", { class: cls("p-4 bg-base-100 border border-base-300 shadow-2xl rounded-box w-80 select-none", p2.class) }, [
O("div", { class: "flex justify-between items-center mb-4 gap-1" }, [
O("div", { class: "flex gap-0.5" }, [
O("button", { type: "button", class: "btn btn-ghost btn-xs px-1", onclick: () => moveYear(-1) }, O("span", { class: "icon-[lucide--chevrons-left]" })),
O("button", { type: "button", class: "btn btn-ghost btn-xs px-1", onclick: () => move(-1) }, O("span", { class: "icon-[lucide--chevron-left]" }))
]),
O("span", { class: "font-bold uppercase flex-1 text-center" }, () => internalDate().toLocaleString("es-ES", { month: "short", year: "numeric" })),
O("div", { class: "flex gap-0.5" }, [
O("button", { type: "button", class: "btn btn-ghost btn-xs px-1", onclick: () => move(1) }, O("span", { class: "icon-[lucide--chevron-right]" })),
O("button", { type: "button", class: "btn btn-ghost btn-xs px-1", onclick: () => moveYear(1) }, O("span", { class: "icon-[lucide--chevrons-right]" }))
])
]),
O("div", { class: "grid grid-cols-7 gap-1", onmouseleave: () => hoverDate(null) }, [
...["L", "M", "X", "J", "V", "S", "D"].map((d) => O("div", { class: "text-[10px] opacity-40 font-bold text-center" }, d)),
() => {
const d = internalDate(), y2 = d.getFullYear(), m = d.getMonth();
const firstDay = new Date(y2, m, 1).getDay();
const offset = firstDay === 0 ? 6 : firstDay - 1;
const dim = new Date(y2, m + 1, 0).getDate();
const cells = [];
for (let i = 0;i < offset; i++)
cells.push(O("div"));
for (let i = 1;i <= dim; i++) {
const date = new Date(y2, m, i), ds = fmt(date);
cells.push(O("button", {
type: "button",
class: () => {
const v2 = current(), h = hoverDate();
const isStart = typeof v2 === "string" ? v2.split("T")[0] === ds : v2?.start === ds;
const isEnd = v2?.end === ds;
let inRange = false;
if (rangeMode() && v2?.start) {
const start = v2.start;
if (!v2.end && h)
inRange = ds > start && ds <= h || ds < start && ds >= h;
else if (v2.end)
inRange = ds > start && ds < v2.end;
}
const base = "btn btn-xs p-0 aspect-square min-h-0 h-auto font-normal relative";
const st = isStart || isEnd ? "btn-primary z-10" : inRange ? "bg-primary/20 border-none rounded-none" : "btn-ghost";
const today = ds === todayStr ? "ring-1 ring-primary ring-inset font-black text-primary" : "";
return cls(base, st, today);
},
onmouseenter: () => rangeMode() && hoverDate(ds),
onclick: () => selectDate(date)
}, i.toString()));
}
return cells;
}
]),
p2.hour ? O("div", { class: "mt-3 pt-2 border-t border-base-300" }, rangeMode() ? O("div", { class: "flex gap-4" }, [HourSlider({ value: startHour, onChange: (h) => startHour(h) }), HourSlider({ value: endHour, onChange: (h) => endHour(h) })]) : HourSlider({ value: startHour, onChange: (h) => startHour(h) })) : null
]);
};
var Datepicker = (p2) => {
const isOpen = S(false);
const displayValue = S("");
const rangeMode = () => get(p2.range) === true;
R(() => {
const v2 = get(p2.value);
if (!v2)
return displayValue("");
let text = "";
if (typeof v2 === "string") {
text = p2.hour && v2.includes("T") ? v2.replace("T", " ") : v2;
} else if (v2.start && v2.end) {
const startStr = p2.hour && v2.startHour != null ? `${v2.start} ${String(v2.startHour).padStart(2, "0")}:00` : v2.start;
const endStr = p2.hour && v2.endHour != null ? `${v2.end} ${String(v2.endHour).padStart(2, "0")}:00` : v2.end;
text = `${startStr} - ${endStr}`;
} else if (v2.start) {
const startStr = p2.hour && v2.startHour != null ? `${v2.start} ${String(v2.startHour).padStart(2, "0")}:00` : v2.start;
text = `${startStr}...`;
}
displayValue(text);
});
const handleChange = (val) => {
if (isFn(p2.value))
p2.value(val);
else
p2.onChange?.(val);
if (!rangeMode() || val?.end != null)
isOpen(false);
};
return O("div", { class: cls("relative w-full", p2.class) }, [
O("label", { class: "input input-bordered w-full", onclick: (e) => {
e.stopPropagation();
isOpen(!isOpen());
} }, [
O("span", { class: "icon-[lucide--calendar]" }),
O("input", {
...p2,
type: "text",
class: "grow",
value: displayValue,
readonly: true,
placeholder: p2.placeholder || (rangeMode() ? "Seleccionar rango..." : "Seleccionar fecha...")
})
]),
z(isOpen, () => [
O("div", { class: "fixed inset-0 z-[90]", onclick: () => isOpen(false) }),
O("div", { class: "absolute left-0 mt-2 z-[100]", onclick: (e) => e.stopPropagation() }, Calendar({ value: p2.value, range: rangeMode(), hour: p2.hour, onChange: handleChange }))
])
]);
};
var Fileinput = (p2) => {
const files = S([]);
const drag = S(false);
const error = S(null);
const maxBytes = (p2.max || 2) * 1024 * 1024;
const process = (fileList) => {
const arr = Array.from(fileList);
error(null);
if (arr.some((f) => f.size > maxBytes)) {
error(`Máx ${p2.max || 2}MB`);
return;
}
const updated = [...files(), ...arr];
files(updated);
if (isFn(p2.onselect))
p2.onselect(updated);
else if (isFn(p2.value))
p2.value(updated);
};
const remove = (idx) => {
const updated = files().filter((_2, i) => i !== idx);
files(updated);
if (isFn(p2.onselect))
p2.onselect(updated);
else if (isFn(p2.value))
p2.value(updated);
};
return O("div", { class: cls("fieldset w-full p-0", p2.class) }, [
O("label", {
class: () => `relative flex items-center justify-between w-full h-12 px-4 border-2 border-dashed rounded-lg cursor-pointer transition-all duration-200 ${drag() ? "border-primary bg-primary/10" : "border-base-content/20 bg-base-100 hover:bg-base-200"}`,
ondragover: (e) => {
e.preventDefault();
drag(true);
},
ondragleave: () => drag(false),
ondrop: (e) => {
e.preventDefault();
drag(false);
process(e.dataTransfer.files);
}
}, [
O("div", { class: "flex items-center gap-3 w-full" }, [
O("span", { class: "icon-[lucide--upload]" }),
O("span", { class: "text-sm opacity-70 truncate grow text-left" }, "Arrastra o selecciona archivos..."),
O("span", { class: "text-[10px] opacity-40 shrink-0" }, `Máx ${p2.max || 2}MB`)
]),
O("input", {
type: "file",
multiple: true,
accept: p2.accept || "*",
class: "hidden",
onchange: (e) => process(e.target.files)
})
]),
() => error() && O("span", { class: "text-[10px] text-error mt-1 px-1 font-medium" }, error()),
z(() => files().length > 0, () => O("ul", { class: "mt-2 space-y-1" }, K(files, (file, idx) => O("li", { class: "flex items-center justify-between p-1.5 pl-3 text-xs bg-base-200/50 rounded-md border border-base-300" }, [
O("div", { class: "flex items-center gap-2 truncate" }, [
O("span", { class: "opacity-50" }, "\uD83D\uDCC4"),
O("span", { class: "truncate font-medium max-w-[200px]" }, file.name),
O("span", { class: "text-[9px] opacity-40" }, `(${(file.size / 1024).toFixed(0)} KB)`)
]),
O("button", {
type: "button",
class: "btn btn-ghost btn-xs btn-circle",
onclick: (e) => {
e.preventDefault();
remove(idx);
}
}, O("span", { class: "icon-[lucide--x]" }))
]), (file) => file.name + file.lastModified)))
]);
};
var Toast = (message, type = "alert-success", duration = 3500) => {
let container = document.getElementById("sigpro-toast-container");
if (!container) {
container = O("div", {
id: "sigpro-toast-container",
class: "fixed top-0 right-0 z-[9999] p-4 flex flex-col gap-2 pointer-events-none"
});
document.body.appendChild(container);
}
const host = O("div", { style: "display: contents" });
container.appendChild(host);
let closeFn, timer, enterTimer;
const ToastComponent = () => {
const visible = S(false);
const leaving = S(false);
closeFn = () => {
if (leaving())
return;
clearTimeout(timer);
clearTimeout(enterTimer);
leaving(true);
setTimeout(() => {
instance.destroy();
host.remove();
if (!container.hasChildNodes())
container.remove();
}, 300);
};
enterTimer = setTimeout(() => visible(true), 0);
const content = typeof message === "function" ? get(message) : message;
const msgNode = typeof content === "string" ? O("span", {}, content) : content;
return O("div", {
class: () => {
if (leaving())
return `alert alert-soft ${type} shadow-lg transition-all duration-300 translate-x-full opacity-0 pointer-events-auto`;
if (visible())
return `alert alert-soft ${type} shadow-lg transition-all duration-300 translate-x-0 opacity-100 pointer-events-auto`;
return `alert alert-soft ${type} shadow-lg transition-all duration-300 translate-x-10 opacity-0 pointer-events-auto`;
}
}, [
msgNode,
O("button", {
class: "btn btn-xs btn-circle btn-ghost",
onclick: closeFn
}, O("span", { class: "icon-[lucide--x]" }))
]);
};
const instance = H(ToastComponent, host);
if (duration > 0)
timer = setTimeout(closeFn, duration);
return closeFn;
};
var Modal = (p2) => {
let dialogRef = null;
R(() => {
const isOpen = get(p2.open);
if (!dialogRef)
return;
isOpen ? dialogRef.showModal() : dialogRef.close();
});
const close = () => isFn(p2.open) && p2.open(false);
return O("dialog", {
...p2,
ref: (el) => dialogRef = el,
class: cls("modal", p2.class),
onclose: close,
oncancel: close
}, [
O("div", { class: "modal-box" }, [
p2.title && O("h3", { class: "text-lg font-bold" }, p2.title),
p2.children,
O("div", { class: "modal-action" }, [
p2.actions || Button({ class: "btn", onclick: close }, "Cerrar")
])
]),
O("form", { method: "dialog", class: "modal-backdrop" }, [
O("button", {}, "close")
])
]);
};
// components/Editor.js
var exports_Editor = {};
__export(exports_Editor, {
Editor: () => Editor
});
var Editor = (p2) => {
const { value, class: extraClass } = p2;
let editorRef = null;
const isSource = S(false);
const source = S("");
const notify = () => {
if (!editorRef)
return;
const html = editorRef.innerHTML;
if (isFn(value))
value(html);
else
p2.onchange?.(html);
};
const exec = (cmd, val = null) => {
if (!editorRef)
return;
editorRef.focus();
document.execCommand(cmd, false, val);
notify();
};
const queryState = (cmd, val = null) => {
if (!editorRef)
return false;
try {
if (cmd === "formatBlock") {
const sel = window.getSelection();
if (!sel.rangeCount)
return false;
let node = sel.getRangeAt(0).commonAncestorContainer;
while (node && node !== editorRef) {
if (node.nodeType === 1 && node.tagName === val)
return true;
node = node.parentNode;
}
return false;
}
return document.queryCommandState(cmd);
} catch (e) {
return false;
}
};
const toolbar = O("div", { class: "flex flex-wrap items-center gap-1 p-2 border-b border-base-300 bg-base-200" }, [
O("div", { class: "flex flex-wrap gap-1 flex-1" }, [
O("button", {
type: "button",
class: () => `btn btn-ghost btn-xs ${queryState("bold") ? "btn-active" : ""}`,
onclick: () => exec("bold")
}, O("span", { class: "icon-[lucide--bold]" })),
O("button", {
type: "button",
class: () => `btn btn-ghost btn-xs ${queryState("italic") ? "btn-active" : ""}`,
onclick: () => exec("italic")
}, O("span", { class: "icon-[lucide--italic]" })),
O("button", {
type: "button",
class: () => `btn btn-ghost btn-xs ${queryState("underline") ? "btn-active" : ""}`,
onclick: () => exec("underline")
}, O("span", { class: "icon-[lucide--underline]" })),
O("button", {
type: "button",
class: () => `btn btn-ghost btn-xs ${queryState("strikeThrough") ? "btn-active" : ""}`,
onclick: () => exec("strikeThrough")
}, O("span", { class: "icon-[lucide--strikethrough]" })),
O("span", { class: "w-px h-5 bg-base-300 mx-1" }),
O("button", { type: "button", class: "btn btn-ghost btn-xs", onclick: () => exec("insertUnorderedList") }, O("span", { class: "icon-[lucide--list]" })),
O("button", { type: "button", class: "btn btn-ghost btn-xs", onclick: () => exec("insertOrderedList") }, O("span", { class: "icon-[lucide--list-ordered]" })),
O("span", { class: "w-px h-5 bg-base-300 mx-1" }),
O("button", {
type: "button",
class: () => `btn btn-ghost btn-xs ${queryState("formatBlock", "BLOCKQUOTE") ? "btn-active" : ""}`,
onclick: () => exec("formatBlock", queryState("formatBlock", "BLOCKQUOTE") ? "P" : "BLOCKQUOTE")
}, O("span", { class: "icon-[lucide--quote]" })),
O("span", { class: "w-px h-5 bg-base-300 mx-1" }),
O("select", { class: "select select-xs w-16", onchange: (e) => exec("fontSize", e.target.value), value: "3" }, [
O("option", { value: "1" }, "1"),
O("option", { value: "2" }, "2"),
O("option", { value: "3" }, "3"),
O("option", { value: "4" }, "4"),
O("option", { value: "5" }, "5"),
O("option", { value: "6" }, "6"),
O("option", { value: "7" }, "7")
]),
O("span", { class: "w-px h-5 bg-base-300 mx-1" }),
O("button", { type: "button", class: "btn btn-ghost btn-xs", onclick: () => exec("undo") }, O("span", { class: "icon-[lucide--undo-2]" })),
O("button", { type: "button", class: "btn btn-ghost btn-xs", onclick: () => exec("redo") }, O("span", { class: "icon-[lucide--redo-2]" }))
]),
O("div", { class: "flex" }, [
O("button", {
type: "button",
class: () => `btn btn-ghost btn-xs ${isSource() ? "btn-active" : ""}`,
onclick: () => {
const wasSource = isSource();
if (!wasSource) {
source(editorRef?.innerHTML || "");
} else {
if (editorRef) {
editorRef.innerHTML = source();
notify();
}
}
isSource(!wasSource);
}
}, O("span", { class: "icon-[lucide--code-2]" }))
])
]);
return O("div", { class: cls("border border-base-300 rounded-box bg-base-100 overflow-hidden", extraClass) }, [
toolbar,
O("div", { class: "relative" }, [
O("div", {
ref: (el) => {
if (!editorRef && el) {
editorRef = el;
el.innerHTML = get(value) || "";
}
},
style: () => `min-height:10rem;${isSource() ? "display:none" : ""}`,
class: "p-3 outline-none text-base-content [&_ul]:list-disc [&_ul]:pl-6 [&_ol]:list-decimal [&_ol]:pl-6 [&_li]:list-item [&_p]:m-0 [&_div]:m-0 [&_br]:content-[''] [&_br]:block [&_br]:h-[1em]",
contenteditable: "true",
oninput: notify,
onpaste: () => setTimeout(notify, 0)
}),
O("textarea", {
class: "w-full min-h-[10rem] p-3 outline-none font-mono text-sm bg-base-200 border-0",
style: () => isSource() ? "" : "display:none",
value: source,
oninput: (e) => source(e.target.value)
})
])
]);
};
// utils.js
var i18n = {
es: {
close: "Cerrar",
confirm: "Confirmar",
cancel: "Cancelar",
search: "Buscar...",
loading: "Cargando...",
nodata: "Sin datos"
},
en: {
close: "Close",
confirm: "Confirm",
cancel: "Cancel",
search: "Search...",
loading: "Loading...",
nodata: "No data"
}
};
var currentLocale = S("es");
var Locale = (t) => currentLocale(t);
var tt = (t) => () => i18n[currentLocale()][t] || t;
// index.js
var Components = {
...exports_All,
...exports_Editor
};
var Utils = {
Locale,
tt
};
if (typeof window !== "undefined") {
Object.entries({ ...Components, ...Utils }).forEach(([name, value]) => {
Object.defineProperty(window, name, {
value,
writable: false,
configurable: true,
enumerable: true
});
});
console.log("SigProUI installed");
}
})();