@burdenoff/fe-libs 2026.1117.1 → 2026.1117.2

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,15 +1,15 @@
1
1
  import { desktopSetTheme as e } from "../../native/desktop.js";
2
2
  import { brandAttribute as t } from "./brandAttribute.js";
3
3
  import { createContext as n, use as r, useCallback as i, useEffect as a, useMemo as o, useState as s } from "react";
4
- import { jsx as c } from "react/jsx-runtime";
4
+ import { jsx as ee } from "react/jsx-runtime";
5
5
  // src/shared/providers/shell/ThemeProvider.tsx
6
- var l = /* @__PURE__ */ new Set([
6
+ var c = /* @__PURE__ */ new Set([
7
7
  "dark",
8
8
  "forest",
9
9
  "ocean",
10
10
  "sunset",
11
11
  "high-contrast"
12
- ]), u = [
12
+ ]), l = [
13
13
  {
14
14
  value: "light",
15
15
  label: "Light",
@@ -40,10 +40,10 @@ var l = /* @__PURE__ */ new Set([
40
40
  label: "High Contrast",
41
41
  family: "dark"
42
42
  }
43
- ], d = (e) => l.has(e) ? "dark" : "light";
44
- function f(e) {
43
+ ], u = (e) => c.has(e) ? "dark" : "light";
44
+ function d(e) {
45
45
  let t = /^#?([0-9a-f]{6})$/i.exec(e.trim());
46
- if (!t) return 0;
46
+ if (!t) return null;
47
47
  let n = parseInt(t[1], 16), r = [
48
48
  n >> 16 & 255,
49
49
  n >> 8 & 255,
@@ -54,7 +54,7 @@ function f(e) {
54
54
  });
55
55
  return .2126 * r[0] + .7152 * r[1] + .0722 * r[2];
56
56
  }
57
- var p = (e) => f(e) > .45;
57
+ var f = (e) => d(e) ?? 0, p = (e) => f(e) > .45;
58
58
  function m(e, t) {
59
59
  if (typeof window > "u") return t;
60
60
  try {
@@ -65,10 +65,10 @@ function m(e, t) {
65
65
  }
66
66
  }
67
67
  var h = n(null);
68
- function g({ children: n, defaultMode: r = "system", defaultBrand: l = "default", defaultDensity: u = "comfortable", defaultTypography: f = "default", defaultGlass: g = "full", storageKey: _ = "burdenoff-theme" }) {
69
- let v = (e, t) => typeof window > "u" ? t : localStorage.getItem(`${_}-${e}`) || t, [y, b] = s(() => v("mode", r)), [x, S] = s(() => v("brand", l)), [ee, te] = s(() => v("density", u)), [C, w] = s(() => v("typography", f)), [T, E] = s(() => v("glass", g)), [D, O] = s(() => v("reduce-motion", "") === "1"), [k, A] = s(() => m(`${_}-custom-list`, [])), [j, M] = s(() => v("active-custom", "") || null), N = o(() => y === "custom" ? k.find((e) => e.id === j) ?? null : null, [
68
+ function g({ children: n, defaultMode: r = "system", defaultBrand: c = "default", defaultDensity: l = "comfortable", defaultTypography: f = "default", defaultGlass: g = "full", storageKey: _ = "burdenoff-theme" }) {
69
+ let v = (e, t) => typeof window > "u" ? t : localStorage.getItem(`${_}-${e}`) || t, [y, b] = s(() => v("mode", r)), [x, S] = s(() => v("brand", c)), [C, te] = s(() => v("density", l)), [w, T] = s(() => v("typography", f)), [E, D] = s(() => v("glass", g)), [O, k] = s(() => v("reduce-motion", "") === "1"), [A, ne] = s(() => m(`${_}-custom-list`, [])), [j, M] = s(() => v("active-custom", "") || null), N = o(() => y === "custom" ? A.find((e) => e.id === j) ?? null : null, [
70
70
  y,
71
- k,
71
+ A,
72
72
  j
73
73
  ]), [P, F] = s(() => y === "custom" ? "light" : y === "system" ? typeof window > "u" ? "light" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : y);
74
74
  a(() => {
@@ -78,13 +78,15 @@ function g({ children: n, defaultMode: r = "system", defaultBrand: l = "default"
78
78
  }
79
79
  F(y === "custom" ? N?.base ?? "light" : y);
80
80
  }, [y, N]);
81
- let I = d(P), L = N?.density ?? ee, R = N?.typography ?? C, z = N?.glass ?? T, B = N?.reduceMotion ?? D;
81
+ let I = u(P), L = N?.density ?? C, R = N?.typography ?? w, z = N?.glass ?? E, B = N?.reduceMotion ?? O;
82
82
  a(() => {
83
83
  let n = document.documentElement;
84
84
  if (n.setAttribute("data-theme", P), n.setAttribute("data-brand", t(x)), n.setAttribute("data-density", L), n.setAttribute("data-typography", R), n.setAttribute("data-glass", z), n.toggleAttribute("data-reduce-motion", B), I === "dark" ? n.classList.add("dark") : n.classList.remove("dark"), N) {
85
85
  let e = N.accent;
86
- n.setAttribute("data-accent", "custom"), p(e) ? n.setAttribute("data-accent-label", "dark") : n.removeAttribute("data-accent-label"), n.style.setProperty("--color-action-primary-bg", e), n.style.setProperty("--color-action-primary-bgHover", `color-mix(in oklab, ${e} 84%, black)`), n.style.setProperty("--color-action-primary-bgActive", `color-mix(in oklab, ${e} 70%, black)`), n.style.setProperty("--color-action-primary-text", p(e) ? "#0a0a0a" : "#ffffff");
87
- } else n.removeAttribute("data-accent"), n.removeAttribute("data-accent-label"), n.style.removeProperty("--color-action-primary-bg"), n.style.removeProperty("--color-action-primary-bgHover"), n.style.removeProperty("--color-action-primary-bgActive"), n.style.removeProperty("--color-action-primary-text");
86
+ n.setAttribute("data-accent", "custom"), p(e) ? n.setAttribute("data-accent-label", "dark") : n.removeAttribute("data-accent-label");
87
+ let t = d(e);
88
+ t === null ? n.style.removeProperty("--custom-accent-luminance") : n.style.setProperty("--custom-accent-luminance", t.toFixed(4)), n.style.setProperty("--color-action-primary-bg", e), n.style.setProperty("--color-action-primary-bgHover", `color-mix(in oklab, ${e} 84%, black)`), n.style.setProperty("--color-action-primary-bgActive", `color-mix(in oklab, ${e} 70%, black)`), n.style.setProperty("--color-action-primary-text", p(e) ? "#0a0a0a" : "#ffffff");
89
+ } else n.removeAttribute("data-accent"), n.removeAttribute("data-accent-label"), n.style.removeProperty("--custom-accent-luminance"), n.style.removeProperty("--color-action-primary-bg"), n.style.removeProperty("--color-action-primary-bgHover"), n.style.removeProperty("--color-action-primary-bgActive"), n.style.removeProperty("--color-action-primary-text");
88
90
  let r = () => {
89
91
  let t = getComputedStyle(n).getPropertyValue("--color-bg-canvas").trim();
90
92
  e({
@@ -114,28 +116,28 @@ function g({ children: n, defaultMode: r = "system", defaultBrand: l = "default"
114
116
  }, [V]), W = i((e) => {
115
117
  te(e), V("density", e);
116
118
  }, [V]), G = i((e) => {
117
- w(e), V("typography", e);
119
+ T(e), V("typography", e);
118
120
  }, [V]), K = i((e) => {
119
- E(e), V("glass", e);
121
+ D(e), V("glass", e);
120
122
  }, [V]), q = i((e) => {
121
- O(e), V("reduce-motion", e ? "1" : "0");
123
+ k(e), V("reduce-motion", e ? "1" : "0");
122
124
  }, [V]), J = i((e) => {
123
- A(e), localStorage.setItem(`${_}-custom-list`, JSON.stringify(e));
125
+ ne(e), localStorage.setItem(`${_}-custom-list`, JSON.stringify(e));
124
126
  }, [_]), Y = i((e) => {
125
127
  let t = typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `ct-${Date.now()}-${Math.floor(performance.now())}`, n = {
126
128
  ...e,
127
129
  id: t
128
130
  };
129
- return J([...k, n]), n;
130
- }, [k, J]), X = i((e, t) => {
131
- J(k.map((n) => n.id === e ? {
131
+ return J([...A, n]), n;
132
+ }, [A, J]), X = i((e, t) => {
133
+ J(A.map((n) => n.id === e ? {
132
134
  ...n,
133
135
  ...t
134
136
  } : n));
135
- }, [k, J]), Z = i((e) => {
136
- J(k.filter((t) => t.id !== e)), j === e && (M(null), V("active-custom", ""), H("system"));
137
+ }, [A, J]), Z = i((e) => {
138
+ J(A.filter((t) => t.id !== e)), j === e && (M(null), V("active-custom", ""), H("system"));
137
139
  }, [
138
- k,
140
+ A,
139
141
  J,
140
142
  j,
141
143
  V,
@@ -144,7 +146,7 @@ function g({ children: n, defaultMode: r = "system", defaultBrand: l = "default"
144
146
  M(e), V("active-custom", e), H("custom");
145
147
  }, [V, H]), $ = i(() => {
146
148
  H(I === "light" ? "dark" : "light");
147
- }, [I, H]), ne = o(() => ({
149
+ }, [I, H]), re = o(() => ({
148
150
  mode: y,
149
151
  brand: x,
150
152
  density: L,
@@ -159,7 +161,7 @@ function g({ children: n, defaultMode: r = "system", defaultBrand: l = "default"
159
161
  setTypography: G,
160
162
  setGlass: K,
161
163
  setReduceMotion: q,
162
- customThemes: k,
164
+ customThemes: A,
163
165
  activeCustomId: j,
164
166
  createCustomTheme: Y,
165
167
  updateCustomTheme: X,
@@ -182,7 +184,7 @@ function g({ children: n, defaultMode: r = "system", defaultBrand: l = "default"
182
184
  G,
183
185
  K,
184
186
  q,
185
- k,
187
+ A,
186
188
  j,
187
189
  Y,
188
190
  X,
@@ -190,8 +192,8 @@ function g({ children: n, defaultMode: r = "system", defaultBrand: l = "default"
190
192
  Q,
191
193
  $
192
194
  ]);
193
- return /* @__PURE__ */ c(h.Provider, {
194
- value: ne,
195
+ return /* @__PURE__ */ ee(h.Provider, {
196
+ value: re,
195
197
  children: n
196
198
  });
197
199
  }
@@ -203,4 +205,4 @@ function _() {
203
205
  function v() {
204
206
  return r(h);
205
207
  }
206
- export { u as THEME_OPTIONS, g as ThemeProvider, _ as useTheme, v as useThemeOrNull };
208
+ export { l as THEME_OPTIONS, g as ThemeProvider, _ as useTheme, v as useThemeOrNull };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/fe-libs",
3
- "version": "2026.1117.1",
3
+ "version": "2026.1117.2",
4
4
  "description": "Burdenoff frontend primitives and domain libraries",
5
5
  "repository": {
6
6
  "type": "git",
@@ -40,8 +40,9 @@
40
40
  *
41
41
  * Rules of this file:
42
42
  * - Colours only from tokens (the two accent glows, the gloss tokens, the pop and elevation
43
- * shadows, --boff-on-glow, the text, border and canvas tokens, and the action tokens of the
44
- * button fills) and `transparent`; motion only from the --motion-* tokens and the existing
43
+ * shadows, --boff-on-glow, the text, border and canvas tokens, the action tokens of the
44
+ * button fills, and the palette's white and black that a custom accent's glow is mixed
45
+ * with) and `transparent`; motion only from the --motion-* tokens and the existing
45
46
  * boff-rise keyframes.
46
47
  * - Unlayered like the rest of tokens.css, so it wins over the layered Tailwind utilities it
47
48
  * decorates without !important. That is also why it never sets a border colour at rest and
@@ -91,7 +92,8 @@
91
92
  * deeper fills on a page, fe-libs Button's white-label fills (the destructive one,
92
93
  * and the primary one in forest, ocean and sunset) a step deeper.
93
94
  * The first two hold app-wide (they fix pairs that fail without the glow); the last two only
94
- * where the glow is. */
95
+ * where the glow is. Under a custom accent the glow tokens themselves become the person's
96
+ * colour, also app-wide, and the glow's strength follows that colour (BOFF-15067, below). */
95
97
 
96
98
  @media screen and (forced-colors: none) {
97
99
  @supports (color: color-mix(in oklab, red 50%, transparent)) {
@@ -125,6 +127,14 @@
125
127
  /* A custom accent's white-label primary button on a page: this share of the accent, the
126
128
  * rest the darkest token of the base, under the base's light label. */
127
129
  --depth-custom-fill: 58%;
130
+ /* A custom accent's glows (BOFF-15067; the custom rule below): the person's accent at
131
+ * these luminances (the theme's are #0E7490 and #4F46E5, 0.15 and 0.12), and the accent
132
+ * luminances between which the D1 glow goes from all of its strength (at
133
+ * --depth-custom-full) to none (at --depth-custom-off). A light base takes deep accents. */
134
+ --depth-custom-glow-y: 0.15;
135
+ --depth-custom-glow-alt-y: 0.18;
136
+ --depth-custom-full: 0.26;
137
+ --depth-custom-off: 0.28;
128
138
  }
129
139
  /* ThemeProvider sets .dark for the dark, forest, ocean and sunset themes. */
130
140
  :root[data-depth='rich']:not([data-theme='high-contrast']).dark {
@@ -139,6 +149,12 @@
139
149
  /* A white label's fill on a page: this share of the resting fill, the rest the pressed
140
150
  * fill. */
141
151
  --depth-label-fill: 50%;
152
+ /* A custom accent on a dark base: bright glows (the theme's are #22D3EE and #8AA8FF, 0.53
153
+ * and 0.41), all of the D1 glow from a bright accent, none under a dark one. */
154
+ --depth-custom-glow-y: 0.4;
155
+ --depth-custom-glow-alt-y: 0.28;
156
+ --depth-custom-full: 0.25;
157
+ --depth-custom-off: 0.155;
142
158
  }
143
159
  /* White labels on a mid-tone accent: any sheen takes them under 4.5:1. The glows are the
144
160
  * dark theme's 26% and 20% scaled alike, to the most each theme allows. */
@@ -166,27 +182,70 @@
166
182
  --color-accent-text: var(--color-accent-glow);
167
183
  }
168
184
  /* A custom accent (Appearance › Custom accent): ThemeProvider puts the person's accent inline
169
- * as the action fill, with the label its luminance picks, and marks <html data-accent="custom">
170
- * (and data-accent-label="dark" when that label is the dark one); the theme's glow tokens stay
171
- * the theme's. The editor takes any colour, so what follows holds for any accent, on either
172
- * base (depthContrast.test.ts checks 216 colours across the range, white and black, and the
173
- * accents Appearance names):
185
+ * as the action fill, with the label its luminance picks and that luminance itself
186
+ * (--custom-accent-luminance, a plain number: CSS cannot read a colour's luminance), and marks
187
+ * <html data-accent="custom"> (and data-accent-label="dark" when the label is the dark one).
188
+ * The editor takes any colour, so what follows holds for any accent, on either base
189
+ * (depthContrast.test.ts checks 216 colours across the range, white and black, the accents
190
+ * Appearance names, and a finer sweep around the thresholds below):
174
191
  * - the ink is --depth-custom-ink of the person's accent, the rest the text colour (lighter
175
192
  * on a dark base, darker on a light one): it retints the text, at 4.5:1 or more;
176
- * - no glow (D1), no button sheen (D4) and no sidebar wash (D6, both of its stops). All
177
- * three are the theme's colour, not the person's, and the person's accent has no contrast
178
- * to give under them: as a ring, a border or a checked box Blue #2563EB reads 3.04:1 on an
179
- * elevated surface without the glow and 2.46:1 with it. The rest of the layer stays, in
180
- * the theme's accent glow as before (lines, rings, bars and tiles, at 3:1 on their own);
193
+ * - the two glow tokens are the person's accent at the luminances --depth-custom-glow-y and
194
+ * --depth-custom-glow-alt-y (BOFF-15067), close to the theme's own glows: the accent mixed
195
+ * with white, or a bright one with black (which keeps its hue), in xyz. xyz is linear
196
+ * light, so the share that lands on a luminance is a plain ratio of luminances. Every
197
+ * decoration that paints the glow takes the person's colour (tab underlines, row bars,
198
+ * the field halo, card hover rings, icon tiles, the sidebar's bar, and in tokens.css the
199
+ * /assistant page's box, orbs, tiles, caret and voice button). The glow reads at 4.5:1 as
200
+ * text on the page, and an icon on it (--boff-on-glow) at 3:1 or more;
201
+ * - the D1 glow follows the accent's own luminance (--depth-custom-scale). A ring, a border
202
+ * or a checked box paints the raw accent, and the glow takes such a control under 3:1
203
+ * where the accent is close to 3:1 already (Blue #2563EB reads 3.04:1 on a dark elevated
204
+ * surface, 2.49:1 under its full glow). So the glow is all there up to
205
+ * --depth-custom-full, gone from --depth-custom-off on, and in between it fades along a
206
+ * straight line: a dark base takes it from bright accents, a light base from deep ones.
207
+ * A light base also caps it at 70% of the approved 8% and 6%: under a saturated red glow
208
+ * the destructive button's label reads 4.50:1 at 71%;
209
+ * - the sidebar wash is the person's colour at the approved strengths, and the current
210
+ * item's subtitle takes more of the primary text (20% on a light base, 65% on a dark one),
211
+ * so it keeps 4.5:1 on a light accent's tint under the wash;
212
+ * - the button sheen is the person's colour at the approved 22% on a light base, under a
213
+ * white label. On a dark base it stays off, as in forest, ocean and sunset: the glow
214
+ * lightens a white label's fill, and the full glow alone takes the label on #529's deeper
215
+ * fill to 3.93:1, so that fill deepens with the glow too (--depth-custom-fill: 58% of the
216
+ * accent with no glow, 50% under the full glow), and a sheen would take it under 4.5:1
217
+ * again. Under the dark label (a light accent) it stays off on either base: the glow is
218
+ * darker than such a fill, so it would shade the button instead of lighting it;
219
+ * - without the luminance (an accent that is not #rrggbb) the glow tokens are the ink, and
220
+ * the D1 glow, the sheen and the wash are off: every value that reads the luminance is then
221
+ * invalid, so each var() that reads one of them takes its fallback;
181
222
  * - a white-label primary button on a page takes a deeper fill (below).
182
- * Same specificity as the `.dark` strengths above, so it comes after them. */
223
+ * Same specificity as the `.dark` strengths above, so it comes after them; the `.dark` one
224
+ * below is one class more specific. */
183
225
  :root[data-depth='rich']:not([data-theme='high-contrast'])[data-accent='custom'] {
184
226
  --color-accent-text: color-mix(in oklab, var(--color-action-primary-bg) var(--depth-custom-ink), var(--color-text-primary));
185
- --depth-mesh-a: 0%;
186
- --depth-mesh-b: 0%;
227
+ --depth-custom-known: calc(var(--custom-accent-luminance) * 0 + 1);
228
+ --depth-custom-scale: clamp(0, (var(--custom-accent-luminance) - var(--depth-custom-off)) / (var(--depth-custom-full) - var(--depth-custom-off)), 1);
229
+ --depth-custom-glow: color-mix(in xyz, color-mix(in xyz, var(--color-action-primary-bg) calc(min(1, (1 - var(--depth-custom-glow-y)) / max(1 - var(--custom-accent-luminance), 0.001)) * 100%), var(--palette-white)) calc(min(1, var(--depth-custom-glow-y) / max(var(--custom-accent-luminance), 0.001)) * 100%), var(--palette-black));
230
+ --depth-custom-glow-alt: color-mix(in xyz, color-mix(in xyz, var(--color-action-primary-bg) calc(min(1, (1 - var(--depth-custom-glow-alt-y)) / max(1 - var(--custom-accent-luminance), 0.001)) * 100%), var(--palette-white)) calc(min(1, var(--depth-custom-glow-alt-y) / max(var(--custom-accent-luminance), 0.001)) * 100%), var(--palette-black));
231
+ --color-accent-glow: var(--depth-custom-glow, var(--color-accent-text));
232
+ --color-accent-glow-alt: var(--depth-custom-glow-alt, var(--color-accent-text));
233
+ --depth-mesh-a: calc(5.6% * var(--depth-custom-scale, 0));
234
+ --depth-mesh-b: calc(4.2% * var(--depth-custom-scale, 0));
235
+ --depth-button-sheen: calc(22% * var(--depth-custom-known, 0));
236
+ --depth-nav-wash: calc(24% * var(--depth-custom-known, 0));
237
+ --depth-nav-wash-end: calc(8% * var(--depth-custom-known, 0));
238
+ --depth-nav-subtitle: 20%;
239
+ }
240
+ :root[data-depth='rich']:not([data-theme='high-contrast'])[data-accent='custom'].dark {
241
+ --depth-mesh-a: calc(26% * var(--depth-custom-scale, 0));
242
+ --depth-mesh-b: calc(20% * var(--depth-custom-scale, 0));
243
+ --depth-button-sheen: 0%;
244
+ --depth-nav-subtitle: 65%;
245
+ --depth-custom-fill: calc(58% - 8% * var(--depth-custom-scale, 0));
246
+ }
247
+ :root[data-depth='rich']:not([data-theme='high-contrast'])[data-accent='custom'][data-accent-label='dark'] {
187
248
  --depth-button-sheen: 0%;
188
- --depth-nav-wash: 0%;
189
- --depth-nav-wash-end: 0%;
190
249
  }
191
250
  :root[data-depth='rich']:not([data-theme='high-contrast'])[data-theme='forest'],
192
251
  :root[data-depth='rich']:not([data-theme='high-contrast'])[data-theme='ocean'],