Toast tiene el ancho para cada uno
All checks were successful
Deploy Docs to Synology / deploy (push) Successful in 4s

This commit is contained in:
2026-04-27 18:20:10 +02:00
parent 670e9fd8fe
commit 627bfd78ad
10 changed files with 41 additions and 71 deletions

9
dist/sigpro-ui.css vendored
View File

@@ -4110,6 +4110,9 @@
.w-96 { .w-96 {
width: calc(var(--spacing) * 96); width: calc(var(--spacing) * 96);
} }
.w-auto {
width: auto;
}
.w-full { .w-full {
width: 100%; width: 100%;
} }
@@ -4230,6 +4233,9 @@
.items-center { .items-center {
align-items: center; align-items: center;
} }
.items-end {
align-items: flex-end;
}
.items-start { .items-start {
align-items: flex-start; align-items: flex-start;
} }
@@ -4682,6 +4688,9 @@
.text-balance { .text-balance {
text-wrap: balance; text-wrap: balance;
} }
.whitespace-nowrap {
white-space: nowrap;
}
.alert-error { .alert-error {
@layer daisyui.l1.l2 { @layer daisyui.l1.l2 {
color: var(--color-error-content); color: var(--color-error-content);

17
dist/sigpro-ui.esm.js vendored
View File

@@ -100,7 +100,7 @@ var x = false;
var A = 0; var A = 0;
var C = new Set; var C = new Set;
var D = new WeakMap; var D = new WeakMap;
var $2 = Symbol("iter"); var $ = Symbol("iter");
var B = new WeakMap; var B = new WeakMap;
var E = (e) => { var E = (e) => {
if (!e || e._disposed) if (!e || e._disposed)
@@ -247,16 +247,16 @@ var I = (e) => {
let u = Reflect.has(c, t), a = Reflect.get(c, t, l), f = Reflect.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 (f && !Object.is(a, r)) {
if (w(i(t), true), !u) if (w(i(t), true), !u)
w(i($2), true); w(i($), true);
} }
return f; return f;
}, deleteProperty(c, t) { }, deleteProperty(c, t) {
let r = Reflect.deleteProperty(c, t); let r = Reflect.deleteProperty(c, t);
if (r) if (r)
w(i(t), true), w(i($2), true); w(i(t), true), w(i($), true);
return r; return r;
}, ownKeys(c) { }, ownKeys(c) {
return w(i($2)), Reflect.ownKeys(c); return w(i($)), Reflect.ownKeys(c);
} }); } });
return D.set(e, s), s; return D.set(e, s), s;
}; };
@@ -1110,7 +1110,7 @@ var Toast = (message, type = "alert-success", duration = 3500) => {
if (!container) { if (!container) {
container = O("div", { container = O("div", {
id: "sigpro-toast-container", id: "sigpro-toast-container",
class: "fixed top-0 right-0 z-[9999] p-4 flex flex-col gap-2 pointer-events-none" class: "fixed top-0 right-0 z-[9999] p-4 flex flex-col items-end gap-2 pointer-events-none"
}); });
document.body.appendChild(container); document.body.appendChild(container);
} }
@@ -1138,11 +1138,12 @@ var Toast = (message, type = "alert-success", duration = 3500) => {
const msgNode = typeof content === "string" ? O("span", {}, content) : content; const msgNode = typeof content === "string" ? O("span", {}, content) : content;
return O("div", { return O("div", {
class: () => { class: () => {
const base = `alert alert-soft ${type} shadow-lg transition-all duration-300 inline-flex w-auto whitespace-nowrap pointer-events-auto`;
if (leaving()) if (leaving())
return `alert alert-soft ${type} shadow-lg transition-all duration-300 translate-x-full opacity-0 pointer-events-auto`; return `${base} translate-x-full opacity-0`;
if (visible()) if (visible())
return `alert alert-soft ${type} shadow-lg transition-all duration-300 translate-x-0 opacity-100 pointer-events-auto`; return `${base} translate-x-0 opacity-100`;
return `alert alert-soft ${type} shadow-lg transition-all duration-300 translate-x-10 opacity-0 pointer-events-auto`; return `${base} translate-x-10 opacity-0`;
} }
}, [ }, [
msgNode, msgNode,

File diff suppressed because one or more lines are too long

17
dist/sigpro-ui.js vendored
View File

@@ -131,7 +131,7 @@
var A = 0; var A = 0;
var C = new Set; var C = new Set;
var D = new WeakMap; var D = new WeakMap;
var $2 = Symbol("iter"); var $ = Symbol("iter");
var B = new WeakMap; var B = new WeakMap;
var E = (e) => { var E = (e) => {
if (!e || e._disposed) if (!e || e._disposed)
@@ -278,16 +278,16 @@
let u = Reflect.has(c, t), a = Reflect.get(c, t, l), f = Reflect.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 (f && !Object.is(a, r)) {
if (w(i(t), true), !u) if (w(i(t), true), !u)
w(i($2), true); w(i($), true);
} }
return f; return f;
}, deleteProperty(c, t) { }, deleteProperty(c, t) {
let r = Reflect.deleteProperty(c, t); let r = Reflect.deleteProperty(c, t);
if (r) if (r)
w(i(t), true), w(i($2), true); w(i(t), true), w(i($), true);
return r; return r;
}, ownKeys(c) { }, ownKeys(c) {
return w(i($2)), Reflect.ownKeys(c); return w(i($)), Reflect.ownKeys(c);
} }); } });
return D.set(e, s), s; return D.set(e, s), s;
}; };
@@ -1141,7 +1141,7 @@
if (!container) { if (!container) {
container = O("div", { container = O("div", {
id: "sigpro-toast-container", id: "sigpro-toast-container",
class: "fixed top-0 right-0 z-[9999] p-4 flex flex-col gap-2 pointer-events-none" class: "fixed top-0 right-0 z-[9999] p-4 flex flex-col items-end gap-2 pointer-events-none"
}); });
document.body.appendChild(container); document.body.appendChild(container);
} }
@@ -1169,11 +1169,12 @@
const msgNode = typeof content === "string" ? O("span", {}, content) : content; const msgNode = typeof content === "string" ? O("span", {}, content) : content;
return O("div", { return O("div", {
class: () => { class: () => {
const base = `alert alert-soft ${type} shadow-lg transition-all duration-300 inline-flex w-auto whitespace-nowrap pointer-events-auto`;
if (leaving()) if (leaving())
return `alert alert-soft ${type} shadow-lg transition-all duration-300 translate-x-full opacity-0 pointer-events-auto`; return `${base} translate-x-full opacity-0`;
if (visible()) if (visible())
return `alert alert-soft ${type} shadow-lg transition-all duration-300 translate-x-0 opacity-100 pointer-events-auto`; return `${base} translate-x-0 opacity-100`;
return `alert alert-soft ${type} shadow-lg transition-all duration-300 translate-x-10 opacity-0 pointer-events-auto`; return `${base} translate-x-10 opacity-0`;
} }
}, [ }, [
msgNode, msgNode,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -5,46 +5,4 @@ export const cls = (...classes) => classes.filter(Boolean).join(' ').trim();
export const isFn = f => typeof f === "function"; export const isFn = f => typeof f === "function";
export const filterBy = (items, query, field = 'label', q = String(query).toLowerCase()) => !query ? get(items) : get(items).filter(item => String(item && typeof item === 'object' ? item[field] : item).toLowerCase().includes(q)); export const filterBy = (items, query, field = 'label', q = String(query).toLowerCase()) => !query ? get(items) : get(items).filter(item => String(item && typeof item === 'object' ? item[field] : item).toLowerCase().includes(q));
export const rand = (r) => `${r}-${Math.random().toString(36).slice(2, 9)}` export const rand = (r) => `${r}-${Math.random().toString(36).slice(2, 9)}`
export const close = () => document.activeElement?.blur() export const close = () => document.activeElement?.blur()
export const req = ({ url, method = 'GET', headers = {} }) => {
const loading = $(false);
const error = $(null);
const data = $(null);
let controller = null;
let timeoutId = null;
const run = async (body = null) => {
controller?.abort();
clearTimeout(timeoutId);
controller = new AbortController();
timeoutId = setTimeout(() => controller.abort(), 10000);
loading(true);
error(null);
try {
const isFormData = body instanceof FormData;
const res = await fetch(url, {
method,
headers: isFormData ? headers : { 'Content-Type': 'application/json', ...headers },
body: isFormData ? body : (body ? JSON.stringify(body) : undefined),
signal: controller.signal
});
const text = await res.text();
const json = text ? JSON.parse(text) : null;
if (!res.ok) throw new Error(json?.message || res.statusText);
data(json);
return json;
} catch (e) {
if (e.name !== 'AbortError') error(e.message);
throw e;
} finally {
loading(false);
clearTimeout(timeoutId);
controller = null;
timeoutId = null;
}
};
const abort = () => controller?.abort();
return { run, abort, loading, error, data };
};

View File

@@ -520,7 +520,7 @@ export const Toast = (message, type = "alert-success", duration = 3500) => {
if (!container) { if (!container) {
container = h("div", { container = h("div", {
id: "sigpro-toast-container", id: "sigpro-toast-container",
class: "fixed top-0 right-0 z-[9999] p-4 flex flex-col gap-2 pointer-events-none" class: "fixed top-0 right-0 z-[9999] p-4 flex flex-col items-end gap-2 pointer-events-none"
}); });
document.body.appendChild(container); document.body.appendChild(container);
} }
@@ -546,9 +546,10 @@ export const Toast = (message, type = "alert-success", duration = 3500) => {
const msgNode = typeof content === 'string' ? h("span", {}, content) : content; const msgNode = typeof content === 'string' ? h("span", {}, content) : content;
return h("div", { return h("div", {
class: () => { class: () => {
if (leaving()) return `alert alert-soft ${type} shadow-lg transition-all duration-300 translate-x-full opacity-0 pointer-events-auto`; const base = `alert alert-soft ${type} shadow-lg transition-all duration-300 inline-flex w-auto whitespace-nowrap pointer-events-auto`;
if (visible()) return `alert alert-soft ${type} shadow-lg transition-all duration-300 translate-x-0 opacity-100 pointer-events-auto`; if (leaving()) return `${base} translate-x-full opacity-0`;
return `alert alert-soft ${type} shadow-lg transition-all duration-300 translate-x-10 opacity-0 pointer-events-auto`; if (visible()) return `${base} translate-x-0 opacity-100`;
return `${base} translate-x-10 opacity-0`;
} }
}, [ }, [
msgNode, msgNode,