@alea-design/ui 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,13 @@
1
1
  "use client";
2
- import { jsxs as V, Fragment as H, jsx as p } from "react/jsx-runtime";
3
- import { useState as q, useSyncExternalStore as W, useEffect as u, useMemo as k, useId as K, useCallback as ee, useContext as te, createContext as ne } from "react";
4
- import { warnDeprecated as ae } from "../../utils/vocabulary.js";
5
- import { RouterProvider as re, I18nProvider as oe } from "react-aria-components";
6
- import { motionVariables as ce, motionAttributes as ie, motionComponentCss as se } from "@alea-design/motion";
7
- import { cx as le } from "../../utils/cx.js";
8
- import { StringsContext as de } from "../../i18n/strings.js";
9
- import { refractionLevel as me, startGlassLens as ue } from "./lens.js";
10
- const fe = {
2
+ import { jsxs as R, Fragment as ee, jsx as v } from "react/jsx-runtime";
3
+ import { useState as te, useSyncExternalStore as V, useEffect as w, useMemo as M, useId as ne, useCallback as ae, useContext as re, createContext as oe } from "react";
4
+ import { warnDeprecated as ce } from "../../utils/vocabulary.js";
5
+ import { RouterProvider as ie, I18nProvider as se } from "react-aria-components";
6
+ import { motionVariables as le, motionAttributes as me, motionComponentCss as de } from "@alea-design/motion";
7
+ import { cx as ue } from "../../utils/cx.js";
8
+ import { StringsContext as fe } from "../../i18n/strings.js";
9
+ import { refractionLevel as pe, startGlassLens as he } from "./lens.js";
10
+ const ye = {
11
11
  "--alea-spacing-base": "0.125rem",
12
12
  "--alea-space-0": "0rem",
13
13
  "--alea-space-0-25": "0.0625rem",
@@ -29,61 +29,104 @@ const fe = {
29
29
  "--alea-space-20": "2.5rem",
30
30
  "--alea-space-22": "2.75rem",
31
31
  "--alea-space-24": "3rem"
32
- }, B = [["3xs", 1], ["2xs", 2], ["xs", 4], ["sm", 6], ["field", 8], ["md", 10], ["lg", 12], ["xl", 16], ["2xl", 20], ["3xl", 24], ["4xl", 32]], pe = B.map(([e, n]) => [e, e === "3xs" || e === "2xs" ? n : n * 2]);
33
- function he(e = {}, n = "default") {
34
- var r, s, i;
32
+ }, H = [["3xs", 1], ["2xs", 2], ["xs", 4], ["sm", 6], ["field", 8], ["md", 10], ["lg", 12], ["xl", 16], ["2xl", 20], ["3xl", 24], ["4xl", 32]], xe = H.map(([e, n]) => [e, e === "3xs" || e === "2xs" ? n : n * 2]);
33
+ function D(e) {
34
+ const n = e.trim().toLowerCase(), t = /^#([0-9a-f]{3,8})$/.exec(n);
35
+ if (t) {
36
+ let s = t[1];
37
+ return (s.length === 3 || s.length === 4) && (s = s.split("").map((l) => l + l).join("")), s.length !== 6 && s.length !== 8 ? null : [0, 2, 4].map((l) => parseInt(s.slice(l, l + 2), 16));
38
+ }
39
+ const a = /^(rgba?|hsla?)\(([^)]+)\)$/.exec(n);
40
+ if (!a) return null;
41
+ const r = a[2].split(/[\s,/]+/).filter(Boolean).slice(0, 3).map((s) => s.endsWith("%") ? parseFloat(s) / 100 : parseFloat(s));
42
+ if (r.length < 3 || r.some(Number.isNaN)) return null;
43
+ if (a[1].startsWith("rgb")) {
44
+ const s = a[2].split(/[\s,/]+/).filter(Boolean).slice(0, 3).map((l) => l.endsWith("%"));
45
+ return r.map((l, u) => Math.max(0, Math.min(255, Math.round(s[u] ? l * 255 : l))));
46
+ }
47
+ const [c, i, y] = [(r[0] % 360 + 360) % 360, r[1] > 1 ? r[1] / 100 : r[1], r[2] > 1 ? r[2] / 100 : r[2]], f = i * Math.min(y, 1 - y), x = (s) => {
48
+ const l = (s + c / 30) % 12;
49
+ return Math.round(255 * (y - f * Math.max(-1, Math.min(l - 3, 9 - l, 1))));
50
+ };
51
+ return [x(0), x(8), x(4)];
52
+ }
53
+ const F = ([e, n, t]) => {
54
+ const a = [e, n, t].map((r) => {
55
+ const c = r / 255;
56
+ return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
57
+ });
58
+ return 0.2126 * a[0] + 0.7152 * a[1] + 0.0722 * a[2];
59
+ }, ge = (e, n) => {
60
+ const t = F(e), a = F(n);
61
+ return (Math.max(t, a) + 0.05) / (Math.min(t, a) + 0.05);
62
+ }, J = (e) => `#${e.map((n) => n.toString(16).padStart(2, "0")).join("")}`, we = (e, n) => e.map((t) => Math.round(t * n));
63
+ function ve(e, n) {
64
+ const t = {}, a = D(e);
65
+ let r = e, c = `color-mix(in srgb, ${e} 88%, black)`, i = "var(--alea-accent-on)";
66
+ if (a) {
67
+ const y = [a, we(a, 0.88)], f = [n, "#0a0a0a", "#000000", "#ffffff"].filter((m) => !!m).map((m) => ({ css: m, rgb: D(m) })).filter((m) => !!m.rgb), x = (m, h) => Math.min(...h.map((p) => ge(m, p))), s = (m) => {
68
+ const h = f.map((p) => ({ css: p.css, ratio: x(p.rgb, m) }));
69
+ return h.find((p) => p.ratio >= 7) ?? h.find((p) => p.ratio >= 4.5) ?? h.slice().sort((p, k) => k.ratio - p.ratio)[0];
70
+ };
71
+ let l = s(y), u = y;
72
+ l.ratio < 4.5 && (u = [a, a], l = s(u)), r = J(u[0]), c = J(u[1]), i = l.css;
73
+ }
74
+ return t["--alea-button-top"] = r, t["--alea-button-bottom"] = c, t["--alea-button-text"] = i, t["--alea-button-ring"] = `color-mix(in srgb, ${e} 25%, transparent)`, t["--alea-gradient-button"] = `linear-gradient(180deg, ${r} 0%, ${c} 100%)`, t["--alea-accent-second"] = `color-mix(in oklch, ${e} 55%, white)`, t["--alea-accent-third"] = `color-mix(in oklch, ${e} 45%, var(--alea-text))`, t;
75
+ }
76
+ function ke(e = {}, n = "default") {
77
+ var a, r, c;
35
78
  const t = {};
36
79
  if (e.accent) {
37
80
  t["--alea-accent"] = e.accent, t["--alea-accent-strong"] = `color-mix(in oklch, ${e.accent} 62%, var(--alea-text))`, t["--alea-accent-subtle"] = `color-mix(in oklch, ${e.accent} 16%, transparent)`, t["--alea-focus"] = e.accent, t["--alea-focus-halo"] = `color-mix(in oklch, ${e.accent} 30%, transparent)`, t["--alea-accent-solid"] = e.accent;
38
- const o = `color-mix(in oklch, ${e.accent} 55%, white)`;
39
- t["--alea-gradient-accent"] = `radial-gradient(100% 100% at 25% 100%, ${e.accent} 0%, ${o} 100%)`, t["--alea-gradient-accent-linear"] = `linear-gradient(120deg, ${e.accent} 0%, ${o} 100%)`, t["--alea-gradient-text"] = t["--alea-gradient-accent"], t["--alea-gradient-text-linear"] = t["--alea-gradient-accent-linear"], t["--alea-shadow-glow"] = `0 10px 30px -10px color-mix(in srgb, ${e.accent} 55%, transparent)`;
81
+ const i = `color-mix(in oklch, ${e.accent} 55%, white)`;
82
+ t["--alea-gradient-accent"] = `radial-gradient(100% 100% at 25% 100%, ${e.accent} 0%, ${i} 100%)`, t["--alea-gradient-accent-linear"] = `linear-gradient(120deg, ${e.accent} 0%, ${i} 100%)`, t["--alea-gradient-text"] = t["--alea-gradient-accent"], t["--alea-gradient-text-linear"] = t["--alea-gradient-accent-linear"], t["--alea-shadow-glow"] = `0 10px 30px -10px color-mix(in srgb, ${e.accent} 55%, transparent)`, Object.assign(t, ve(e.accent, e.accentOn));
40
83
  }
41
84
  if (e.accentOn && (t["--alea-accent-on"] = e.accentOn), e.radius != null) {
42
- for (const [o, A] of n === "glass" ? pe : B) t[`--alea-radius-${o}`] = `${Math.round(A * e.radius)}px`;
85
+ for (const [i, y] of n === "glass" ? xe : H) t[`--alea-radius-${i}`] = `${Math.round(y * e.radius)}px`;
43
86
  t["--alea-radius-full"] = e.radius >= 1 ? "9999px" : `${Math.round(18 * e.radius)}px`;
44
87
  }
45
- return e.density === "compact" && Object.assign(t, fe, {
88
+ return e.density === "compact" && Object.assign(t, ye, {
46
89
  "--alea-size-control-sm": "24px",
47
90
  "--alea-size-control-md": "32px",
48
91
  "--alea-size-control-lg": "40px",
49
92
  "--alea-size-field": "36px"
50
- }), (r = e.fonts) != null && r.body && (t["--alea-font-family-body"] = e.fonts.body), (s = e.fonts) != null && s.display && (t["--alea-font-family-display"] = e.fonts.display), (i = e.fonts) != null && i.mono && (t["--alea-font-family-mono"] = e.fonts.mono), t;
93
+ }), (a = e.fonts) != null && a.body && (t["--alea-font-family-body"] = e.fonts.body), (r = e.fonts) != null && r.display && (t["--alea-font-family-display"] = e.fonts.display), (c = e.fonts) != null && c.mono && (t["--alea-font-family-mono"] = e.fonts.mono), t;
51
94
  }
52
- const F = ne(null), ye = /* @__PURE__ */ new Set(["ar", "arc", "ckb", "dv", "fa", "he", "ks", "ku", "ps", "sd", "ug", "ur", "yi"]);
95
+ const Q = oe(null), $e = /* @__PURE__ */ new Set(["ar", "arc", "ckb", "dv", "fa", "he", "ks", "ku", "ps", "sd", "ug", "ur", "yi"]);
53
96
  function P(e) {
54
- var t, r;
97
+ var t, a;
55
98
  if (!e) return "ltr";
56
99
  try {
57
- const s = new Intl.Locale(e), i = ((t = s.getTextInfo) == null ? void 0 : t.call(s).direction) ?? ((r = s.textInfo) == null ? void 0 : r.direction);
58
- if (i === "rtl" || i === "ltr") return i;
100
+ const r = new Intl.Locale(e), c = ((t = r.getTextInfo) == null ? void 0 : t.call(r).direction) ?? ((a = r.textInfo) == null ? void 0 : a.direction);
101
+ if (c === "rtl" || c === "ltr") return c;
59
102
  } catch {
60
103
  }
61
104
  const n = e.toLowerCase().split(/[-_]/)[0];
62
- return ye.has(n) ? "rtl" : "ltr";
105
+ return $e.has(n) ? "rtl" : "ltr";
63
106
  }
64
107
  function T() {
65
108
  return typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark";
66
109
  }
67
- function xe(e) {
110
+ function Ae(e) {
68
111
  var t;
69
112
  if (typeof window > "u" || !window.matchMedia) return () => {
70
113
  };
71
114
  const n = window.matchMedia("(prefers-color-scheme: light)");
72
115
  return (t = n.addEventListener) == null || t.call(n, "change", e), () => {
73
- var r;
74
- return (r = n.removeEventListener) == null ? void 0 : r.call(n, "change", e);
116
+ var a;
117
+ return (a = n.removeEventListener) == null ? void 0 : a.call(n, "change", e);
75
118
  };
76
119
  }
77
- const we = () => () => {
120
+ const Ee = () => () => {
78
121
  };
79
- function ve(e = "alea-theme", n = "dark") {
80
- const t = (r) => JSON.stringify(r).replace(/</g, "\\u003c").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
122
+ function Se(e = "alea-theme", n = "dark") {
123
+ const t = (a) => JSON.stringify(a).replace(/</g, "\\u003c").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
81
124
  return `(function(){try{var k=${t(e)},t=k&&localStorage.getItem(k);if(t!=='dark'&&t!=='light'&&t!=='system')t=${t(n)};if(t==='system')t=matchMedia('(prefers-color-scheme: light)').matches?'light':'dark';document.documentElement.setAttribute('data-theme',t)}catch(e){}})()`;
82
125
  }
83
- function Pe({ storageKey: e = "alea-theme", defaultTheme: n = "dark" }) {
84
- return /* @__PURE__ */ p("script", { dangerouslySetInnerHTML: { __html: ve(e, n) } });
126
+ function _e({ storageKey: e = "alea-theme", defaultTheme: n = "dark" }) {
127
+ return /* @__PURE__ */ v("script", { dangerouslySetInnerHTML: { __html: Se(e, n) } });
85
128
  }
86
- function J(e) {
129
+ function U(e) {
87
130
  if (!e || typeof window > "u") return null;
88
131
  try {
89
132
  const n = window.localStorage.getItem(e);
@@ -92,81 +135,81 @@ function J(e) {
92
135
  return null;
93
136
  }
94
137
  }
95
- const ge = /^([a-z][a-z0-9+.-]*:|\/\/|#)/i, U = /* @__PURE__ */ new WeakMap();
96
- function ke(e) {
97
- let n = U.get(e);
138
+ const be = /^([a-z][a-z0-9+.-]*:|\/\/|#)/i, Z = /* @__PURE__ */ new WeakMap();
139
+ function Me(e) {
140
+ let n = Z.get(e);
98
141
  return n || (n = (t) => {
99
- const r = e(t);
100
- return ge.test(t) ? t : r;
101
- }, U.set(e, n)), n;
142
+ const a = e(t);
143
+ return be.test(t) ? t : a;
144
+ }, Z.set(e, n)), n;
102
145
  }
103
- function Ae(e, n, t = !0) {
104
- u(() => {
105
- typeof document > "u" || (document.documentElement.setAttribute("data-alea-refraction", String(e)), t ? document.documentElement.removeAttribute("data-alea-lens-pause") : document.documentElement.setAttribute("data-alea-lens-pause", "off"), ue(n).refresh());
146
+ function Le(e, n, t = !0) {
147
+ w(() => {
148
+ typeof document > "u" || (document.documentElement.setAttribute("data-alea-refraction", String(e)), t ? document.documentElement.removeAttribute("data-alea-lens-pause") : document.documentElement.setAttribute("data-alea-lens-pause", "off"), he(n).refresh());
106
149
  }, [e, n, t]);
107
150
  }
108
- function Te({ children: e, dir: n, defaultTheme: t = "dark", theme: r, onThemeChange: s, storageKey: i = "alea-theme", scope: o = "document", className: A, brand: l, density: E, navigate: j, useHref: _, locale: d, motion: f, preset: h = "default", surface: S = "solid", contrast: $ = "system", background: C = "decorated", strings: b, glass: m }) {
109
- Ae(me(m == null ? void 0 : m.refraction), m == null ? void 0 : m.lensSelector, (m == null ? void 0 : m.pauseOnScroll) !== !1);
110
- const [L, Z] = q(null), Q = W(we, () => J(i), () => null), y = r ?? L ?? Q ?? t, X = W(xe, T, () => "dark"), x = y === "system" ? X : y;
111
- u(() => {
112
- if (o !== "document" || typeof document > "u") return;
113
- const a = r ?? L ?? J(i) ?? t;
114
- document.documentElement.setAttribute("data-theme", a === "system" ? T() : a), document.documentElement.classList.add("alea-root");
115
- }, [x, o, r, L, i, t]), u(() => {
116
- if (o !== "document" || typeof window > "u") return;
117
- const a = document.documentElement, c = () => a.style.setProperty("--alea-scrollbar", `${Math.max(0, window.innerWidth - a.clientWidth)}px`);
118
- return c(), window.addEventListener("resize", c), () => {
119
- window.removeEventListener("resize", c), a.style.removeProperty("--alea-scrollbar");
151
+ function We({ children: e, dir: n, defaultTheme: t = "dark", theme: a, onThemeChange: r, storageKey: c = "alea-theme", scope: i = "document", className: y, brand: f, density: x, navigate: s, useHref: l, locale: u, motion: m, preset: h = "default", surface: p = "solid", contrast: k = "system", background: C = "decorated", strings: N, glass: g }) {
152
+ Le(pe(g == null ? void 0 : g.refraction), g == null ? void 0 : g.lensSelector, (g == null ? void 0 : g.pauseOnScroll) !== !1);
153
+ const [L, X] = te(null), Y = V(Ee, () => U(c), () => null), $ = a ?? L ?? Y ?? t, q = V(Ae, T, () => "dark"), A = $ === "system" ? q : $;
154
+ w(() => {
155
+ if (i !== "document" || typeof document > "u") return;
156
+ const o = a ?? L ?? U(c) ?? t;
157
+ document.documentElement.setAttribute("data-theme", o === "system" ? T() : o), document.documentElement.classList.add("alea-root");
158
+ }, [A, i, a, L, c, t]), w(() => {
159
+ if (i !== "document" || typeof window > "u") return;
160
+ const o = document.documentElement, d = () => o.style.setProperty("--alea-scrollbar", `${Math.max(0, window.innerWidth - o.clientWidth)}px`);
161
+ return d(), window.addEventListener("resize", d), () => {
162
+ window.removeEventListener("resize", d), o.style.removeProperty("--alea-scrollbar");
120
163
  };
121
- }, [o]);
122
- const w = n ?? (d ? P(d) : void 0);
123
- u(() => {
124
- if (o !== "document" || typeof document > "u" || !w) return;
125
- const a = document.documentElement, c = a.getAttribute("dir");
126
- return a.setAttribute("dir", w), () => {
127
- c == null ? a.removeAttribute("dir") : a.setAttribute("dir", c);
164
+ }, [i]);
165
+ const E = n ?? (u ? P(u) : void 0);
166
+ w(() => {
167
+ if (i !== "document" || typeof document > "u" || !E) return;
168
+ const o = document.documentElement, d = o.getAttribute("dir");
169
+ return o.setAttribute("dir", E), () => {
170
+ d == null ? o.removeAttribute("dir") : o.setAttribute("dir", d);
128
171
  };
129
- }, [w, o]), u(() => {
130
- !n || !d || P(d) === n || console.warn(`[alea] dir="${n}" does not match locale "${d}" (${P(d)}): the styles mirror, but the arrow keys, sliders and calendars follow the locale. Pass a ${n === "rtl" ? "right to left" : "left to right"} locale as well.`);
131
- }, [n, d]);
132
- const I = JSON.stringify(f || {}), v = k(() => ({ ...he(l, h), ...ce(f) }), [l, I, h]);
133
- u(() => {
134
- (E === "comfortable" || (l == null ? void 0 : l.density) === "comfortable") && ae("ThemeProvider", 'density="comfortable"', 'density="comfy"');
135
- }, [E, l == null ? void 0 : l.density]);
136
- const G = (E ?? ((l == null ? void 0 : l.density) === "compact" ? "compact" : "comfy")) === "compact", g = k(() => ({ ...ie(f), ...G ? { "data-density": "compact" } : {}, ...h !== "default" ? { "data-preset": h } : {}, ...S !== "solid" ? { "data-surface": S } : {}, ...$ !== "system" ? { "data-contrast": $ } : {}, ...C === "plain" ? { "data-background": "plain" } : {} }), [I, h, S, $, C, G]), O = K().replace(/[^a-zA-Z0-9_-]/g, ""), M = k(() => se(f == null ? void 0 : f.components, o === "document" ? ":root" : `[data-alea-scope="${O}"]`), [I, o, O]);
137
- u(() => {
138
- if (o !== "document" || typeof document > "u") return;
139
- const a = document.documentElement;
140
- return Object.entries(g).forEach(([c, z]) => a.setAttribute(c, z)), () => {
141
- Object.keys(g).forEach((c) => a.removeAttribute(c));
172
+ }, [E, i]), w(() => {
173
+ !n || !u || P(u) === n || console.warn(`[alea] dir="${n}" does not match locale "${u}" (${P(u)}): the styles mirror, but the arrow keys, sliders and calendars follow the locale. Pass a ${n === "rtl" ? "right to left" : "left to right"} locale as well.`);
174
+ }, [n, u]);
175
+ const O = JSON.stringify(m || {}), S = M(() => ({ ...ke(f, h), ...le(m) }), [f, O, h]);
176
+ w(() => {
177
+ (x === "comfortable" || (f == null ? void 0 : f.density) === "comfortable") && ce("ThemeProvider", 'density="comfortable"', 'density="comfy"');
178
+ }, [x, f == null ? void 0 : f.density]);
179
+ const _ = (x ?? ((f == null ? void 0 : f.density) === "compact" ? "compact" : "comfy")) === "compact", b = M(() => ({ ...me(m), ..._ ? { "data-density": "compact" } : {}, ...h !== "default" ? { "data-preset": h } : {}, ...p !== "solid" ? { "data-surface": p } : {}, ...k !== "system" ? { "data-contrast": k } : {}, ...C === "plain" ? { "data-background": "plain" } : {} }), [O, h, p, k, C, _]), I = ne().replace(/[^a-zA-Z0-9_-]/g, ""), j = M(() => de(m == null ? void 0 : m.components, i === "document" ? ":root" : `[data-alea-scope="${I}"]`), [O, i, I]);
180
+ w(() => {
181
+ if (i !== "document" || typeof document > "u") return;
182
+ const o = document.documentElement;
183
+ return Object.entries(b).forEach(([d, z]) => o.setAttribute(d, z)), () => {
184
+ Object.keys(b).forEach((d) => o.removeAttribute(d));
142
185
  };
143
- }, [g, o]), u(() => {
144
- if (o !== "document" || typeof document > "u") return;
145
- const a = document.documentElement;
146
- return Object.entries(v).forEach(([c, z]) => a.style.setProperty(c, z)), () => {
147
- Object.keys(v).forEach((c) => a.style.removeProperty(c));
186
+ }, [b, i]), w(() => {
187
+ if (i !== "document" || typeof document > "u") return;
188
+ const o = document.documentElement;
189
+ return Object.entries(S).forEach(([d, z]) => o.style.setProperty(d, z)), () => {
190
+ Object.keys(S).forEach((d) => o.style.removeProperty(d));
148
191
  };
149
- }, [v, o]);
150
- const N = ee((a) => {
151
- if (r === void 0 && Z(a), s == null || s(a), i)
192
+ }, [S, i]);
193
+ const W = ae((o) => {
194
+ if (a === void 0 && X(o), r == null || r(o), c)
152
195
  try {
153
- window.localStorage.setItem(i, a);
196
+ window.localStorage.setItem(c, o);
154
197
  } catch {
155
198
  }
156
- }, [r, s, i]), Y = k(() => ({ theme: y, resolvedTheme: x, setTheme: N }), [y, x, N]), R = M ? /* @__PURE__ */ p("style", { children: M }) : null, D = o === "element" ? /* @__PURE__ */ V("div", { className: le("alea-root", A), dir: w, "data-theme": x, "data-alea-scope": M ? O : void 0, ...g, style: v, children: [
157
- R,
199
+ }, [a, r, c]), K = M(() => ({ theme: $, resolvedTheme: A, setTheme: W }), [$, A, W]), G = j ? /* @__PURE__ */ v("style", { children: j }) : null, B = i === "element" ? /* @__PURE__ */ R("div", { className: ue("alea-root", y), dir: E, "data-theme": A, "data-alea-scope": j ? I : void 0, ...b, style: S, children: [
200
+ G,
158
201
  e
159
- ] }) : /* @__PURE__ */ V(H, { children: [
160
- R,
202
+ ] }) : /* @__PURE__ */ R(ee, { children: [
203
+ G,
161
204
  e
162
205
  ] });
163
- return /* @__PURE__ */ p(F.Provider, { value: Y, children: (() => {
164
- const a = b ? /* @__PURE__ */ p(de.Provider, { value: b, children: D }) : D, c = j ? /* @__PURE__ */ p(re, { navigate: j, useHref: _ ? ke(_) : void 0, children: a }) : a;
165
- return d ? /* @__PURE__ */ p(oe, { locale: d, children: c }) : c;
206
+ return /* @__PURE__ */ v(Q.Provider, { value: K, children: (() => {
207
+ const o = N ? /* @__PURE__ */ v(fe.Provider, { value: N, children: B }) : B, d = s ? /* @__PURE__ */ v(ie, { navigate: s, useHref: l ? Me(l) : void 0, children: o }) : o;
208
+ return u ? /* @__PURE__ */ v(se, { locale: u, children: d }) : d;
166
209
  })() });
167
210
  }
168
- function je() {
169
- const e = te(F);
211
+ function Ge() {
212
+ const e = re(Q);
170
213
  if (e) return e;
171
214
  const n = typeof document < "u" && document.documentElement.getAttribute("data-theme") === "light" ? "light" : "dark";
172
215
  return { theme: n, resolvedTheme: n, setTheme: (t) => {
@@ -174,13 +217,13 @@ function je() {
174
217
  } };
175
218
  }
176
219
  export {
177
- fe as COMPACT_SPACE,
178
- pe as GLASS_RADII,
179
- Te as ThemeProvider,
180
- Pe as ThemeScript,
181
- he as brandVariables,
220
+ ye as COMPACT_SPACE,
221
+ xe as GLASS_RADII,
222
+ We as ThemeProvider,
223
+ _e as ThemeScript,
224
+ ke as brandVariables,
182
225
  P as directionOf,
183
- ke as keepAbsolute,
184
- ve as themeScript,
185
- je as useTheme
226
+ Me as keepAbsolute,
227
+ Se as themeScript,
228
+ Ge as useTheme
186
229
  };
@@ -1 +1 @@
1
- .alea-command-overlay{align-items:start;padding-top:min(12vh,calc(var(--alea-space-24) + var(--alea-space-6)))}.alea-command{padding:0;gap:0}.alea-command-search{display:flex;align-items:center;gap:var(--alea-space-3);height:56px;padding:0 var(--alea-space-4);border-bottom:1px solid var(--alea-border);color:var(--alea-text-muted)}.alea-command-input{flex:1;min-width:0;height:100%;border:0;background:transparent;color:var(--alea-text);font:var(--alea-font-weight-regular) var(--alea-font-size-base)/1 var(--alea-font-family-body);outline:none}.alea-command-input::placeholder{color:var(--alea-text-faint)}.alea-command-input::-webkit-search-cancel-button{display:none}.alea-command-list{max-height:min(56vh,480px);overflow-y:auto;padding:var(--alea-space-2);outline:none;display:flex;flex-direction:column;gap:var(--alea-space-0-25)}.alea-command-item[data-focused]{background:var(--alea-accent-subtle)}.alea-command-empty{margin:0;padding:var(--alea-space-7) var(--alea-space-4);text-align:center;color:var(--alea-text-muted)}@media(forced-colors:active){.alea-button:not([data-variant=link],[data-variant=text],[data-variant=ghost],[data-variant=dashed]),.alea-icon-button:not([data-variant=link],[data-variant=text],[data-variant=ghost],[data-variant=dashed]){outline:1px solid ButtonBorder;outline-offset:calc(var(--alea-space-0-25) * -1)}}
1
+ .alea-command-overlay{align-items:start;padding-top:min(12vh,calc(var(--alea-space-24) + var(--alea-space-6)))}.alea-command{padding:0;gap:0}.alea-command-search{display:flex;align-items:center;gap:var(--alea-space-3);height:56px;padding:0 var(--alea-space-4);border-bottom:1px solid var(--alea-border);color:var(--alea-text-muted)}.alea-command-input{flex:1;min-width:0;height:100%;border:0;background:transparent;color:var(--alea-text);font:var(--alea-font-weight-regular) var(--alea-font-size-base)/1 var(--alea-font-family-body);outline:none}.alea-command-input::placeholder{color:var(--alea-text-faint)}.alea-command-input::-webkit-search-cancel-button{display:none}.alea-command-scroll{max-height:min(56vh,480px);overflow-y:auto}.alea-command-scroll:focus-visible{outline-offset:calc(var(--alea-space-1) * -1)}.alea-command-list{padding:var(--alea-space-2);outline:none;display:flex;flex-direction:column;gap:var(--alea-space-0-25)}.alea-command-item[data-focused]{background:var(--alea-accent-subtle)}.alea-command-empty{margin:0;padding:var(--alea-space-7) var(--alea-space-4);text-align:center;color:var(--alea-text-muted)}@media(forced-colors:active){.alea-button:not([data-variant=link],[data-variant=text],[data-variant=ghost],[data-variant=dashed]),.alea-icon-button:not([data-variant=link],[data-variant=text],[data-variant=ghost],[data-variant=dashed]){outline:1px solid ButtonBorder;outline-offset:calc(var(--alea-space-0-25) * -1)}}
@@ -78,7 +78,7 @@
78
78
  ]
79
79
  },
80
80
  "command": {
81
- "bytes": 1348,
81
+ "bytes": 1450,
82
82
  "requires": [
83
83
  "base",
84
84
  "overlay",
@@ -224,6 +224,16 @@
224
224
  "overlay"
225
225
  ]
226
226
  },
227
+ "notification": {
228
+ "bytes": 4201,
229
+ "requires": [
230
+ "base",
231
+ "button",
232
+ "data",
233
+ "display",
234
+ "overlay"
235
+ ]
236
+ },
227
237
  "overlay": {
228
238
  "bytes": 12628,
229
239
  "requires": [
@@ -0,0 +1 @@
1
+ .alea-notifs-root{display:inline-flex}.alea-notifs-bell{position:relative;display:inline-flex}.alea-notifs-count{position:absolute;inset-block-start:calc(var(--alea-space-1) * -1);inset-inline-end:calc(var(--alea-space-1) * -1);pointer-events:none;font-variant-numeric:tabular-nums}.alea-notifs-popover{padding:0;overflow:hidden}.alea-notifs{display:flex;flex-direction:column;max-height:min(560px,80dvh);outline:none}.alea-notifs-head{display:flex;align-items:center;gap:var(--alea-space-2);padding:var(--alea-space-3) var(--alea-space-4);border-bottom:1px solid var(--alea-border)}.alea-notifs-title{display:flex;align-items:center;gap:var(--alea-space-2);flex:1;min-width:0;margin:0;font:var(--alea-font-weight-semibold) var(--alea-font-size-md) / 1.4 var(--alea-font-family-body);color:var(--alea-text)}.alea-notifs-list{display:flex;flex-direction:column;flex:1;min-height:0;margin:0;padding:0;list-style:none;overflow-y:auto;overscroll-behavior:contain}.alea-notifs-empty{padding:var(--alea-space-6) var(--alea-space-4);outline:none}.alea-notifs-empty:focus-visible{box-shadow:inset 0 0 0 2px var(--alea-focus-ring, var(--alea-accent))}.alea-notif{--tone: var(--alea-status-info);--tone-bg: var(--alea-status-info-bg);border-bottom:1px solid var(--alea-border);outline:none}.alea-notif:last-child{border-bottom:0}.alea-notif[data-tone=success]{--tone: var(--alea-status-success);--tone-bg: var(--alea-status-success-bg)}.alea-notif[data-tone=warning]{--tone: var(--alea-status-warning);--tone-bg: var(--alea-status-warning-bg)}.alea-notif[data-tone=danger]{--tone: var(--alea-status-danger);--tone-bg: var(--alea-status-danger-bg)}.alea-notif-inner{display:flex;align-items:flex-start;gap:var(--alea-space-3);padding:var(--alea-space-3) var(--alea-space-4);transition:background-color var(--alea-motion-duration-base) var(--alea-motion-ease-out)}.alea-notif[data-unread] .alea-notif-inner{background:var(--alea-accent-subtle)}.alea-notif:hover .alea-notif-inner{background:var(--alea-surface-hover)}.alea-notif:focus-visible .alea-notif-inner{box-shadow:inset 0 0 0 2px var(--alea-focus-ring, var(--alea-accent))}.alea-notif-icon{display:inline-flex;align-items:center;justify-content:center;flex:none;width:var(--alea-space-8);height:var(--alea-space-8);border-radius:var(--alea-radius-full);background:var(--tone-bg);color:var(--tone)}.alea-notif-icon svg{width:var(--alea-space-4);height:var(--alea-space-4)}.alea-notif-body{display:flex;flex-direction:column;gap:var(--alea-space-1);flex:1;min-width:0}.alea-notif-body>p{margin:0}.alea-notif-title{color:var(--alea-text-soft);font:var(--alea-font-weight-medium) var(--alea-font-size-sm) / 1.4 var(--alea-font-family-body);overflow-wrap:anywhere}.alea-notif[data-unread] .alea-notif-title{color:var(--alea-text);font-weight:var(--alea-font-weight-semibold)}.alea-notif-text{color:var(--alea-text-muted);font-size:var(--alea-font-size-sm);line-height:1.4;overflow-wrap:anywhere}.alea-notif[data-unread] .alea-notif-text{color:var(--alea-text-soft)}.alea-notif-meta{display:flex;align-items:center;flex-wrap:wrap;gap:var(--alea-space-1) var(--alea-space-3);color:var(--alea-text-muted);font-size:var(--alea-font-size-xs)}.alea-notif[data-unread] .alea-notif-meta{color:var(--alea-text-soft)}.alea-notif-tools{display:flex;align-items:center;gap:var(--alea-space-1);flex:none}.alea-notif-out{animation:alea-notif-out var(--alea-motion-duration-base) var(--alea-motion-ease-in) forwards;pointer-events:none}@keyframes alea-notif-out{to{opacity:.01;transform:translate(var(--alea-space-4))}}@media(pointer:coarse){.alea-notif-tools{gap:var(--alea-space-2)}}@media(prefers-reduced-motion:reduce){.alea-notif-inner{transition:none}.alea-notif-out{animation-duration:.01ms}}@media(forced-colors:active){.alea-button:not([data-variant=link],[data-variant=text],[data-variant=ghost],[data-variant=dashed]),.alea-icon-button:not([data-variant=link],[data-variant=text],[data-variant=ghost],[data-variant=dashed]){outline:1px solid ButtonBorder;outline-offset:calc(var(--alea-space-0-25) * -1)}.alea-notif:focus-visible .alea-notif-inner,.alea-notifs-empty:focus-visible{box-shadow:none;outline:2px solid Highlight;outline-offset:var(--alea-space-0-5)}}
@@ -421,6 +421,20 @@ export interface AleaStrings {
421
421
  preview: string;
422
422
  formatting: string;
423
423
  nothingToPreview: string;
424
+ notificationBell: (unread: number) => string;
425
+ markRead: string;
426
+ markAllRead: string;
427
+ dismissNotification: string;
428
+ notificationsEmpty: string;
429
+ notificationsEmptyHint: string;
430
+ newNotification: (title: string) => string;
431
+ unreadNotification: string;
432
+ notificationTones: {
433
+ info: string;
434
+ success: string;
435
+ warning: string;
436
+ danger: string;
437
+ };
424
438
  }
425
439
  export declare const en: AleaStrings;
426
440
  export declare const es: AleaStrings;
@@ -414,7 +414,16 @@ const s = {
414
414
  write: "Write",
415
415
  preview: "Preview",
416
416
  formatting: "Formatting",
417
- nothingToPreview: "Nothing to preview yet."
417
+ nothingToPreview: "Nothing to preview yet.",
418
+ notificationBell: (e) => e > 0 ? `Notifications, ${e} unread` : "Notifications",
419
+ markRead: "Mark as read",
420
+ markAllRead: "Mark all as read",
421
+ dismissNotification: "Dismiss notification",
422
+ notificationsEmpty: "You are all caught up",
423
+ notificationsEmptyHint: "New notifications will show up here.",
424
+ newNotification: (e) => `New notification: ${e}`,
425
+ unreadNotification: "Unread",
426
+ notificationTones: { info: "Information", success: "Success", warning: "Warning", danger: "Problem" }
418
427
  }, p = {
419
428
  loading: "Cargando",
420
429
  close: "Cerrar",
@@ -828,7 +837,16 @@ const s = {
828
837
  write: "Escribir",
829
838
  preview: "Vista previa",
830
839
  formatting: "Formato",
831
- nothingToPreview: "Aún no hay nada que mostrar."
840
+ nothingToPreview: "Aún no hay nada que mostrar.",
841
+ notificationBell: (e) => e > 0 ? `Notificaciones, ${e} sin leer` : "Notificaciones",
842
+ markRead: "Marcar como leída",
843
+ markAllRead: "Marcar todas como leídas",
844
+ dismissNotification: "Descartar notificación",
845
+ notificationsEmpty: "Estás al día",
846
+ notificationsEmptyHint: "Las notificaciones nuevas aparecerán aquí.",
847
+ newNotification: (e) => `Notificación nueva: ${e}`,
848
+ unreadNotification: "Sin leer",
849
+ notificationTones: { info: "Información", success: "Éxito", warning: "Advertencia", danger: "Problema" }
832
850
  }, n = { en: s, es: p }, u = d(null);
833
851
  function h() {
834
852
  const { locale: e } = c(), a = l(u), o = n[(e || "en").split("-")[0]] || s;
package/dist/index.d.ts CHANGED
@@ -70,4 +70,5 @@ export { EMOJI, EMOJI_CATEGORIES, type EmojiEntry, type EmojiCategory } from './
70
70
  export * from './components/chat/Chat.js';
71
71
  export * from './components/ai/AI.js';
72
72
  export * from './components/work/Work.js';
73
+ export * from './components/notification/NotificationCenter.js';
73
74
  export * from './components/app/AppParts.js';