@burdenoff/fe-libs 2026.1118.3 → 2026.1118.5

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.
Files changed (57) hide show
  1. package/dist/platform-pages/AppearanceSettingsPage.d.ts +9 -13
  2. package/dist/platform-pages/AppearanceSettingsPage.js +7 -4
  3. package/dist/platform-pages/index.d.ts +5 -1
  4. package/dist/platform-pages/oauth/AuthorizedAppsPage.d.ts +13 -0
  5. package/dist/platform-pages/oauth/AuthorizedAppsPage.js +154 -0
  6. package/dist/platform-pages/oauth/ConnectAuthorizePage.d.ts +23 -0
  7. package/dist/platform-pages/oauth/ConnectAuthorizePage.js +196 -0
  8. package/dist/platform-pages/oauth/operations.d.ts +49 -0
  9. package/dist/platform-pages/oauth/operations.js +55 -0
  10. package/dist/platform-pages.js +3 -1
  11. package/dist/shared/assistant/home/AssistantHomePage.d.ts +29 -1
  12. package/dist/shared/assistant/home/AssistantHomePage.js +63 -36
  13. package/dist/shared/assistant/home/AssistantHomeStart.d.ts +12 -0
  14. package/dist/shared/assistant/home/AssistantHomeStart.js +24 -15
  15. package/dist/shared/assistant/home.js +5 -5
  16. package/dist/shared/backgrounds/BackgroundEffect.d.ts +7 -0
  17. package/dist/shared/backgrounds/BackgroundEffect.js +24 -0
  18. package/dist/shared/backgrounds/BackgroundPicker.d.ts +49 -0
  19. package/dist/shared/backgrounds/BackgroundPicker.js +133 -0
  20. package/dist/shared/backgrounds/BackgroundRoot.d.ts +13 -0
  21. package/dist/shared/backgrounds/BackgroundRoot.js +44 -0
  22. package/dist/shared/backgrounds/CursorWave.d.ts +19 -0
  23. package/dist/shared/backgrounds/CursorWave.js +40 -0
  24. package/dist/shared/backgrounds/DottedWaves.d.ts +20 -0
  25. package/dist/shared/backgrounds/DottedWaves.js +36 -0
  26. package/dist/shared/backgrounds/Glimmer.d.ts +18 -0
  27. package/dist/shared/backgrounds/Glimmer.js +38 -0
  28. package/dist/shared/backgrounds/backgroundGround.d.ts +5 -0
  29. package/dist/shared/backgrounds/backgroundGround.js +16 -0
  30. package/dist/shared/backgrounds/backgroundTypes.d.ts +38 -0
  31. package/dist/shared/backgrounds/backgroundTypes.js +20 -0
  32. package/dist/shared/backgrounds/canvasEffect.d.ts +51 -0
  33. package/dist/shared/backgrounds/canvasEffect.js +97 -0
  34. package/dist/shared/backgrounds/color.d.ts +56 -0
  35. package/dist/shared/backgrounds/color.js +153 -0
  36. package/dist/shared/backgrounds/cursorWavePool.d.ts +7 -0
  37. package/dist/shared/backgrounds/cursorWavePool.js +14 -0
  38. package/dist/shared/backgrounds/cursorWaveRenderer.d.ts +43 -0
  39. package/dist/shared/backgrounds/cursorWaveRenderer.js +146 -0
  40. package/dist/shared/backgrounds/dottedWavesRenderer.d.ts +72 -0
  41. package/dist/shared/backgrounds/dottedWavesRenderer.js +176 -0
  42. package/dist/shared/backgrounds/glimmerRenderer.d.ts +65 -0
  43. package/dist/shared/backgrounds/glimmerRenderer.js +254 -0
  44. package/dist/shared/backgrounds/index.d.ts +31 -0
  45. package/dist/shared/backgrounds/noise.d.ts +19 -0
  46. package/dist/shared/backgrounds/noise.js +143 -0
  47. package/dist/shared/backgrounds/originalPalettes.d.ts +36 -0
  48. package/dist/shared/backgrounds/originalPalettes.js +24 -0
  49. package/dist/shared/backgrounds/useBackgroundColors.d.ts +40 -0
  50. package/dist/shared/backgrounds/useBackgroundColors.js +165 -0
  51. package/dist/shared/backgrounds/useBackgroundPreference.d.ts +26 -0
  52. package/dist/shared/backgrounds/useBackgroundPreference.js +109 -0
  53. package/dist/shared/config/shellRoutes.js +7 -0
  54. package/dist/shared-assistant.js +79 -79
  55. package/dist/shared-backgrounds.d.ts +2 -0
  56. package/dist/shared-backgrounds.js +16 -0
  57. package/package.json +9 -1
@@ -0,0 +1,20 @@
1
+ import { Ref } from 'react';
2
+ import { BackgroundColorMode, BackgroundCommonProps } from './backgroundTypes';
3
+ import { DottedWavesParams } from './dottedWavesRenderer';
4
+ /** What a ref to `DottedWaves` can do. */
5
+ export interface DottedWavesHandle {
6
+ /** Rolls out a wave from (x, y), fractions of the frame (the centre by default). */
7
+ splash(x?: number, y?: number): void;
8
+ }
9
+ export interface DottedWavesProps extends Partial<DottedWavesParams>, BackgroundCommonProps {
10
+ /** A colour mode (`original` by default), or back and front colours. */
11
+ colors?: BackgroundColorMode | readonly [string, string];
12
+ /** Respond to the pointer and to touch (default true). */
13
+ interactive?: boolean;
14
+ /** Render resolution, 0.25–1 (default 1). */
15
+ quality?: number;
16
+ ref?: Ref<DottedWavesHandle>;
17
+ }
18
+ /** The still frame's moment (a frame with crests and troughs both in view). */
19
+ export declare const DOTTED_WAVES_STILL_TIME = 2;
20
+ export declare function DottedWaves({ colors, strength, backgroundColor, paused, interactive, quality, dpr, className, style, children, ref, ...params }: DottedWavesProps): import('react').JSX.Element;
@@ -0,0 +1,36 @@
1
+ import { usePrefersReducedMotion as e } from "../assistant/ui/usePrefersReducedMotion.js";
2
+ import { BackgroundRoot as t } from "./BackgroundRoot.js";
3
+ import "./backgroundTypes.js";
4
+ import { useCanvasEffect as n, useHostPointer as r } from "./canvasEffect.js";
5
+ import { readColorPair as i } from "./color.js";
6
+ import { DOTTED_WAVES_DEFAULTS as a, createDottedWavesRenderer as o } from "./dottedWavesRenderer.js";
7
+ import { useBackgroundColors as s } from "./useBackgroundColors.js";
8
+ import { useEffect as c, useImperativeHandle as l, useMemo as u, useRef as d, useState as f } from "react";
9
+ import { jsx as p } from "react/jsx-runtime";
10
+ // src/shared/backgrounds/DottedWaves.tsx
11
+ var m = 2;
12
+ function h({ colors: m = "original", strength: h = "bold", backgroundColor: g = "transparent", paused: _ = !1, interactive: v = !0, quality: y = 1, dpr: b = 2, className: x, style: S, children: C, ref: w, ...T }) {
13
+ let E = s(typeof m == "string" ? m : "original", g), D = typeof m == "string" ? null : m[0], O = typeof m == "string" ? null : m[1], k = u(() => D !== null && O !== null ? i(D, O) : null, [D, O]) ?? E.dottedWaves, A = JSON.stringify(T), j = u(() => ({
14
+ ...a,
15
+ ...JSON.parse(A),
16
+ colors: k
17
+ }), [A, k]), [M] = f(() => o(j));
18
+ c(() => M.update(j), [M, j]);
19
+ let N = e() || _, P = d(null);
20
+ return n(P, M, {
21
+ maxPixelRatio: b,
22
+ quality: y,
23
+ still: N,
24
+ stillTime: 2,
25
+ revision: N ? j : null
26
+ }), r(P, M, v && !N), l(w, () => ({ splash: (e, t) => M.splash(e, t) }), [M]), /* @__PURE__ */ p(t, {
27
+ effect: "dotted-waves",
28
+ canvasRef: P,
29
+ strength: h,
30
+ backgroundColor: g,
31
+ className: x,
32
+ style: S,
33
+ children: C
34
+ });
35
+ }
36
+ export { m as DOTTED_WAVES_STILL_TIME, h as DottedWaves };
@@ -0,0 +1,18 @@
1
+ import { Ref } from 'react';
2
+ import { BackgroundColorMode, BackgroundCommonProps } from './backgroundTypes';
3
+ import { GlimmerParams } from './glimmerRenderer';
4
+ /** What a ref to `Glimmer` can do. */
5
+ export interface GlimmerHandle {
6
+ /** Sends a wave of light from (x, y), fractions of the size (the centre by default). */
7
+ wave(x?: number, y?: number): void;
8
+ /** Boosts the field to warp for `seconds`. */
9
+ warp(seconds?: number): void;
10
+ /** Plays the arrival out of warp again. */
11
+ replay(): void;
12
+ }
13
+ export interface GlimmerProps extends Partial<GlimmerParams>, BackgroundCommonProps {
14
+ /** A colour mode (`original` by default), or colours A and B. */
15
+ colors?: BackgroundColorMode | readonly [string, string];
16
+ ref?: Ref<GlimmerHandle>;
17
+ }
18
+ export declare function Glimmer({ colors, strength, backgroundColor, paused, dpr, className, style, children, ref, ...params }: GlimmerProps): import('react').JSX.Element;
@@ -0,0 +1,38 @@
1
+ import { usePrefersReducedMotion as e } from "../assistant/ui/usePrefersReducedMotion.js";
2
+ import { BackgroundRoot as t } from "./BackgroundRoot.js";
3
+ import "./backgroundTypes.js";
4
+ import { useCanvasEffect as n, useHostPointer as r } from "./canvasEffect.js";
5
+ import { readColorPair as i } from "./color.js";
6
+ import { GLIMMER_DEFAULTS as a, createGlimmerRenderer as o } from "./glimmerRenderer.js";
7
+ import { useBackgroundColors as s } from "./useBackgroundColors.js";
8
+ import { useEffect as c, useImperativeHandle as l, useMemo as u, useRef as d, useState as f } from "react";
9
+ import { jsx as p } from "react/jsx-runtime";
10
+ // src/shared/backgrounds/Glimmer.tsx
11
+ function m({ colors: m = "original", strength: h = "bold", backgroundColor: g = "transparent", paused: _ = !1, dpr: v = 2, className: y, style: b, children: x, ref: S, ...C }) {
12
+ let w = s(typeof m == "string" ? m : "original", g), T = typeof m == "string" ? null : m[0], E = typeof m == "string" ? null : m[1], D = u(() => T !== null && E !== null ? i(T, E) : null, [T, E]) ?? w.glimmer, O = JSON.stringify(C), k = u(() => ({
13
+ ...a,
14
+ ...JSON.parse(O),
15
+ colors: D
16
+ }), [O, D]), [A] = f(() => o(k));
17
+ c(() => A.update(k), [A, k]);
18
+ let j = e() || _, M = d(null);
19
+ return n(M, A, {
20
+ maxPixelRatio: v,
21
+ still: j,
22
+ stillTime: 0,
23
+ revision: j ? k : null
24
+ }), r(M, A, !j), l(S, () => ({
25
+ wave: (e, t) => A.wave(e, t),
26
+ warp: (e) => A.warp(e),
27
+ replay: () => A.replay()
28
+ }), [A]), /* @__PURE__ */ p(t, {
29
+ effect: "glimmer",
30
+ canvasRef: M,
31
+ strength: h,
32
+ backgroundColor: g,
33
+ className: y,
34
+ style: b,
35
+ children: x
36
+ });
37
+ }
38
+ export { m as Glimmer };
@@ -0,0 +1,5 @@
1
+ import { BackgroundColorMode, BackgroundEffectName } from './backgroundTypes';
2
+ /** The opaque ground for `effect` in `colors` on a light or dark page; null: none. */
3
+ export declare function backgroundGround(effect: BackgroundEffectName, colors: BackgroundColorMode, light: boolean): string | null;
4
+ /** `backgroundGround` for the page's theme, kept current as the theme changes. */
5
+ export declare function useBackgroundGround(effect: BackgroundEffectName, colors: BackgroundColorMode): string | null;
@@ -0,0 +1,16 @@
1
+ import { CURSOR_WAVE_BACKGROUND as e, DOTTED_WAVES_BACKGROUND as t, GLIMMER_BACKGROUND as n, ORIGINAL_LIGHT_BACKGROUND as r } from "./originalPalettes.js";
2
+ import { useBackgroundTheme as i } from "./useBackgroundColors.js";
3
+ // src/shared/backgrounds/backgroundGround.ts
4
+ var a = {
5
+ "dotted-waves": t,
6
+ glimmer: n,
7
+ "cursor-wave": e
8
+ };
9
+ function o(e, t, n) {
10
+ return t !== "original" || e === "none" ? null : n ? r : a[e];
11
+ }
12
+ function s(e, t) {
13
+ let { light: n } = i();
14
+ return o(e, t, n);
15
+ }
16
+ export { o as backgroundGround, s as useBackgroundGround };
@@ -0,0 +1,38 @@
1
+ import { CSSProperties, ReactNode } from 'react';
2
+ /** The effects a person can pick, and none. */
3
+ export type BackgroundEffectName = 'none' | 'dotted-waves' | 'glimmer' | 'cursor-wave';
4
+ /** Every effect name, in the order a picker lists them. */
5
+ export declare const BACKGROUND_EFFECTS: readonly BackgroundEffectName[];
6
+ /**
7
+ * Where an effect's colours come from: the theme's accent (a custom accent too), the
8
+ * originals' own colours, or greys.
9
+ */
10
+ export type BackgroundColorMode = 'accent' | 'original' | 'mono';
11
+ export declare const BACKGROUND_COLOR_MODES: readonly BackgroundColorMode[];
12
+ /** How strongly an effect shows. `bold` is the original's full strength. */
13
+ export type BackgroundStrength = 'subtle' | 'medium' | 'bold';
14
+ export declare const BACKGROUND_STRENGTHS: readonly BackgroundStrength[];
15
+ /** The canvas's opacity for a strength (the effect itself is drawn at full strength). */
16
+ export declare const BACKGROUND_STRENGTH_OPACITY: Readonly<Record<BackgroundStrength, number>>;
17
+ /** Upper bound for devicePixelRatio, as the originals cap it. */
18
+ export declare const BACKGROUND_MAX_PIXEL_RATIO = 2;
19
+ /** The props every effect component takes besides its own parameters. */
20
+ export interface BackgroundCommonProps {
21
+ /** How strongly the effect shows (default `bold`, the original's full strength). */
22
+ strength?: BackgroundStrength;
23
+ /**
24
+ * The root's background. Default `transparent`: the effect draws over whatever is behind
25
+ * it (the page's canvas), so it suits light and dark themes alike.
26
+ */
27
+ backgroundColor?: string;
28
+ /** Freeze the motion (a still frame). Reduced motion always gets a still frame. */
29
+ paused?: boolean;
30
+ /** Maximum device pixel ratio for the canvas (default 2). */
31
+ dpr?: number;
32
+ /** Classes for the root (it fills its parent). */
33
+ className?: string;
34
+ /** Inline styles for the root. */
35
+ style?: CSSProperties;
36
+ /** Content laid over the effect. */
37
+ children?: ReactNode;
38
+ }
@@ -0,0 +1,20 @@
1
+ // src/shared/backgrounds/backgroundTypes.ts
2
+ var e = [
3
+ "none",
4
+ "dotted-waves",
5
+ "glimmer",
6
+ "cursor-wave"
7
+ ], t = [
8
+ "accent",
9
+ "original",
10
+ "mono"
11
+ ], n = [
12
+ "subtle",
13
+ "medium",
14
+ "bold"
15
+ ], r = {
16
+ subtle: .45,
17
+ medium: .7,
18
+ bold: 1
19
+ }, i = 2;
20
+ export { t as BACKGROUND_COLOR_MODES, e as BACKGROUND_EFFECTS, i as BACKGROUND_MAX_PIXEL_RATIO, n as BACKGROUND_STRENGTHS, r as BACKGROUND_STRENGTH_OPACITY };
@@ -0,0 +1,51 @@
1
+ import { RefObject } from 'react';
2
+ /** What a frame is drawn with. */
3
+ export interface CanvasFrame {
4
+ /** The effect's clock, in seconds (it stops while the loop is paused). */
5
+ time: number;
6
+ /** Seconds since the previous frame (0 for the first, at most 0.05). */
7
+ delta: number;
8
+ /** A still frame: no motion trails, flashes or transient effects. */
9
+ still: boolean;
10
+ }
11
+ /** An effect's renderer: plain drawing code, no React. */
12
+ export interface CanvasRenderer {
13
+ /** The canvas's size in CSS pixels, and the scale of its backing store. */
14
+ resize(width: number, height: number, scale: number): void;
15
+ /** Draw one frame (the context is already scaled to CSS pixels). */
16
+ draw(ctx: CanvasRenderingContext2D, frame: CanvasFrame): void;
17
+ /** Pointer over the host, in canvas CSS pixels (`inside`: within the canvas). */
18
+ pointerMove?(x: number, y: number, inside: boolean): void;
19
+ /** A press inside the host that is not on a link, button or field. */
20
+ pointerDown?(x: number, y: number): void;
21
+ /** The press ended (anywhere). */
22
+ pointerUp?(): void;
23
+ /** The pointer left the window. */
24
+ pointerLeave?(): void;
25
+ /** Buffers to free on unmount. */
26
+ dispose?(): void;
27
+ }
28
+ export interface CanvasEffectOptions {
29
+ /** Upper bound for devicePixelRatio. */
30
+ maxPixelRatio: number;
31
+ /** Resolution multiplier, 0.25–1. */
32
+ quality?: number;
33
+ /** One frame and no loop. */
34
+ still: boolean;
35
+ /** The clock for a still frame (and where an animated one starts). */
36
+ stillTime: number;
37
+ /** Changes when the effect's options change, so a still frame is drawn again. */
38
+ revision?: unknown;
39
+ }
40
+ /** The backing-store scale for a device pixel ratio, capped, times the quality. */
41
+ export declare function canvasScale(devicePixelRatio: number, maxPixelRatio: number, quality?: number): number;
42
+ /** Selector for what a press must not start an effect on (it belongs to the content). */
43
+ export declare const INTERACTIVE_TARGET = "a, button, input, textarea, select, label, summary, [role=\"button\"], [role=\"link\"], [contenteditable=\"\"], [contenteditable=\"true\"]";
44
+ /** Runs `renderer` on the canvas while mounted. */
45
+ export declare function useCanvasEffect(canvasRef: RefObject<HTMLCanvasElement | null>, renderer: CanvasRenderer, { maxPixelRatio, quality, still, stillTime, revision }: CanvasEffectOptions): void;
46
+ /**
47
+ * Follows the pointer over the canvas's host while `enabled`. The canvas takes no pointer events
48
+ * (content above it keeps them all), so the window is listened to and positions are taken
49
+ * relative to the canvas: the effect reacts over its whole host, even under text and cards.
50
+ */
51
+ export declare function useHostPointer(canvasRef: RefObject<HTMLCanvasElement | null>, renderer: CanvasRenderer, enabled: boolean): void;
@@ -0,0 +1,97 @@
1
+ import { useEffect as e } from "react";
2
+ // src/shared/backgrounds/canvasEffect.ts
3
+ var t = (e, t, n) => e < t ? t : e > n ? n : e;
4
+ function n(e, n, r = 1) {
5
+ return Math.min(Number.isFinite(e) && e > 0 ? e : 1, Math.max(1, n)) * t(r, .25, 1);
6
+ }
7
+ var r = "a, button, input, textarea, select, label, summary, [role=\"button\"], [role=\"link\"], [contenteditable=\"\"], [contenteditable=\"true\"]";
8
+ function i(t, r, { maxPixelRatio: i, quality: a = 1, still: o, stillTime: s, revision: c }) {
9
+ e(() => {
10
+ let e = t.current;
11
+ if (!e || typeof window > "u") return;
12
+ let c = null;
13
+ try {
14
+ c = e.getContext("2d");
15
+ } catch {
16
+ c = null;
17
+ }
18
+ if (!c) return;
19
+ let l = c, u = e.parentElement ?? e, d = 0, f = 0, p = 1, m = 0, h = 0, g = s, _ = !0, v = typeof document > "u" || document.visibilityState !== "hidden", y = typeof window.requestAnimationFrame == "function" ? window.requestAnimationFrame.bind(window) : null, b = typeof window.cancelAnimationFrame == "function" ? window.cancelAnimationFrame.bind(window) : null, x = (e, t) => {
20
+ d <= 0 || f <= 0 || (l.setTransform(p, 0, 0, p, 0, 0), r.draw(l, {
21
+ time: e,
22
+ delta: t,
23
+ still: o
24
+ }));
25
+ }, S = () => {
26
+ let t = u.getBoundingClientRect(), o = n(window.devicePixelRatio, i, a), s = Math.max(0, Math.round(t.width)), c = Math.max(0, Math.round(t.height));
27
+ return s === d && c === f && o === p ? !1 : (d = s, f = c, p = o, e.width = Math.max(1, Math.round(d * p)), e.height = Math.max(1, Math.round(f * p)), r.resize(d, f, p), !0);
28
+ }, C = () => !o && _ && v && y !== null, w = (e) => {
29
+ m = 0;
30
+ let t = h === 0 ? 0 : Math.min(.05, Math.max(0, (e - h) / 1e3));
31
+ h = e, g += t, x(g, t), T();
32
+ }, T = () => {
33
+ m === 0 && C() && y !== null && (m = y(w));
34
+ }, E = () => {
35
+ m !== 0 && b !== null && b(m), m = 0, h = 0;
36
+ }, D = () => {
37
+ C() ? T() : E();
38
+ };
39
+ S(), x(g, 0), T();
40
+ let O = null, k = () => {
41
+ S() && x(g, 0);
42
+ };
43
+ typeof ResizeObserver == "function" ? (O = new ResizeObserver(k), O.observe(u)) : window.addEventListener("resize", k);
44
+ let A = null;
45
+ typeof IntersectionObserver == "function" && (A = new IntersectionObserver((e) => {
46
+ let t = e[e.length - 1];
47
+ t && (_ = t.isIntersecting, D());
48
+ }), A.observe(u));
49
+ let j = () => {
50
+ v = document.visibilityState !== "hidden", D();
51
+ };
52
+ return document.addEventListener("visibilitychange", j), () => {
53
+ E(), O?.disconnect(), O || window.removeEventListener("resize", k), A?.disconnect(), document.removeEventListener("visibilitychange", j), e.width = 0, e.height = 0;
54
+ };
55
+ }, [
56
+ t,
57
+ r,
58
+ i,
59
+ a,
60
+ o,
61
+ s,
62
+ c
63
+ ]), e(() => () => r.dispose?.(), [r]);
64
+ }
65
+ function a(t, n, r) {
66
+ e(() => {
67
+ let e = t.current;
68
+ if (!r || !e || typeof window > "u") return;
69
+ let i = (t) => {
70
+ let n = e.getBoundingClientRect(), r = t.clientX - n.left, i = t.clientY - n.top;
71
+ return {
72
+ x: r,
73
+ y: i,
74
+ inside: r >= 0 && i >= 0 && r <= n.width && i <= n.height
75
+ };
76
+ }, a = (e) => {
77
+ let { x: t, y: r, inside: a } = i(e);
78
+ n.pointerMove?.(t, r, a);
79
+ }, o = (t) => {
80
+ if (t.button !== 0 && t.pointerType === "mouse") return;
81
+ let r = t.target;
82
+ if (r instanceof Element && r !== e && r.closest("a, button, input, textarea, select, label, summary, [role=\"button\"], [role=\"link\"], [contenteditable=\"\"], [contenteditable=\"true\"]") !== null) return;
83
+ let { x: a, y: o, inside: s } = i(t);
84
+ n.pointerMove?.(a, o, s), s && n.pointerDown?.(a, o);
85
+ }, s = () => n.pointerUp?.(), c = (e) => {
86
+ "relatedTarget" in e && e.relatedTarget || n.pointerLeave?.();
87
+ };
88
+ return window.addEventListener("pointermove", a, { passive: !0 }), window.addEventListener("pointerdown", o, { passive: !0 }), window.addEventListener("pointerup", s, { passive: !0 }), window.addEventListener("pointercancel", s, { passive: !0 }), document.addEventListener("pointerout", c, { passive: !0 }), window.addEventListener("blur", s), () => {
89
+ window.removeEventListener("pointermove", a), window.removeEventListener("pointerdown", o), window.removeEventListener("pointerup", s), window.removeEventListener("pointercancel", s), document.removeEventListener("pointerout", c), window.removeEventListener("blur", s), n.pointerLeave?.();
90
+ };
91
+ }, [
92
+ t,
93
+ n,
94
+ r
95
+ ]);
96
+ }
97
+ export { r as INTERACTIVE_TARGET, n as canvasScale, i as useCanvasEffect, a as useHostPointer };
@@ -0,0 +1,56 @@
1
+ /**
2
+ * BOFF-15169: colour maths for the animated backgrounds. Colours arrive as CSS strings (a hex from
3
+ * a prop, or a theme token resolved at run time) and are drawn on a canvas, so they are parsed to
4
+ * sRGB once and blended in OKLab, where a mix between two colours keeps an even lightness and
5
+ * hue (the originals blend their two colours the same way).
6
+ */
7
+ /** An sRGB colour, channels 0–255, alpha 0–1. */
8
+ export interface Rgba {
9
+ r: number;
10
+ g: number;
11
+ b: number;
12
+ a: number;
13
+ }
14
+ /** An OKLab colour: L 0–1, a and b roughly ±0.4. */
15
+ export interface Oklab {
16
+ L: number;
17
+ a: number;
18
+ b: number;
19
+ }
20
+ /** A hex or `rgb()`/`rgba()` colour; null for anything else (resolve those with a canvas). */
21
+ export declare function parseColor(input: string): Rgba | null;
22
+ /**
23
+ * Any CSS colour the browser understands (`oklch()`, `color-mix()`, a named colour…) as sRGB,
24
+ * by painting it on a 1×1 canvas. Hex and `rgb()` are parsed without one. Null when the colour
25
+ * cannot be read (no canvas, as in a test DOM, or an invalid colour).
26
+ */
27
+ export declare function resolveColor(input: string): Rgba | null;
28
+ /** A colour from props: hex and `rgb()` parsed, anything else resolved by the browser. */
29
+ export declare function readColor(value: string): Rgba | null;
30
+ /** Two colours from props, resolved; null when either cannot be read. */
31
+ export declare function readColorPair(first: string, second: string): readonly [Rgba, Rgba] | null;
32
+ export declare function toOklab({ r, g, b }: Rgba): Oklab;
33
+ export declare function fromOklab(lab: Oklab, alpha?: number): Rgba;
34
+ /** `from` → `to` in OKLab, `t` 0–1. */
35
+ export declare function mixOklab(from: Rgba, to: Rgba, t: number): Rgba;
36
+ /**
37
+ * An OKLab colour as sRGB, its chroma reduced (hue and lightness kept) where it lies outside
38
+ * sRGB, instead of clipping each channel (which shifts the hue and the lightness).
39
+ */
40
+ export declare function fromOklabInGamut(lab: Oklab, alpha?: number): Rgba;
41
+ /**
42
+ * The colour at OKLab lightness `L`, its chroma scaled by `chroma` (hue kept). Where that is
43
+ * outside sRGB the chroma gives way (not the lightness), so a pale tint of a vivid accent is as
44
+ * light as asked.
45
+ */
46
+ export declare function withLightness(color: Rgba, L: number, chroma?: number): Rgba;
47
+ /** Perceived lightness 0–1 (OKLab L). */
48
+ export declare function lightness(color: Rgba): number;
49
+ /**
50
+ * The matching ink of a colour for a light page: its lightness mirrored (white becomes near
51
+ * black, a pale tint its deep shade), hue and chroma kept. The originals' glints do the same on
52
+ * light backgrounds.
53
+ */
54
+ export declare function toInk(color: Rgba): Rgba;
55
+ /** `rgba(r, g, b, a)` for a canvas, with the alpha multiplied by `alpha`. */
56
+ export declare function cssRgba({ r, g, b, a }: Rgba, alpha?: number): string;
@@ -0,0 +1,153 @@
1
+ // src/shared/backgrounds/color.ts
2
+ var e = /^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i, t = /^rgba?\(\s*([^)]+)\)$/i, n = (e, t, n) => e < t ? t : e > n ? n : e;
3
+ function r(r) {
4
+ let i = r.trim(), a = e.exec(i);
5
+ if (a) {
6
+ let e = a[1];
7
+ e.length <= 4 && (e = [...e].map((e) => e + e).join(""));
8
+ let t = parseInt(e.slice(0, 6), 16), n = e.length === 8 ? parseInt(e.slice(6, 8), 16) / 255 : 1;
9
+ return {
10
+ r: t >> 16 & 255,
11
+ g: t >> 8 & 255,
12
+ b: t & 255,
13
+ a: n
14
+ };
15
+ }
16
+ let o = t.exec(i);
17
+ if (o) {
18
+ let e = o[1].replace("/", " ").split(/[\s,]+/).filter(Boolean);
19
+ if (e.length < 3) return null;
20
+ let t = (e) => e.endsWith("%") ? parseFloat(e) / 100 * 255 : parseFloat(e), r = {
21
+ r: t(e[0]),
22
+ g: t(e[1]),
23
+ b: t(e[2]),
24
+ a: ((e) => e === void 0 ? 1 : e.endsWith("%") ? parseFloat(e) / 100 : parseFloat(e))(e[3])
25
+ };
26
+ return [
27
+ r.r,
28
+ r.g,
29
+ r.b,
30
+ r.a
31
+ ].some((e) => Number.isNaN(e)) ? null : {
32
+ r: n(r.r, 0, 255),
33
+ g: n(r.g, 0, 255),
34
+ b: n(r.b, 0, 255),
35
+ a: n(r.a, 0, 1)
36
+ };
37
+ }
38
+ return null;
39
+ }
40
+ var i;
41
+ function a(e) {
42
+ let t = r(e);
43
+ if (t) return t;
44
+ if (i === void 0 && (i = null, typeof document < "u")) try {
45
+ let e = document.createElement("canvas");
46
+ e.width = 1, e.height = 1, i = e.getContext("2d", { willReadFrequently: !0 });
47
+ } catch {
48
+ i = null;
49
+ }
50
+ if (!i || typeof CSS < "u" && typeof CSS.supports == "function" && !CSS.supports("color", e)) return null;
51
+ i.fillStyle = e, i.clearRect(0, 0, 1, 1), i.fillRect(0, 0, 1, 1);
52
+ let [n, a, o, s] = i.getImageData(0, 0, 1, 1).data;
53
+ return s === 0 ? {
54
+ r: 0,
55
+ g: 0,
56
+ b: 0,
57
+ a: 0
58
+ } : {
59
+ r: n,
60
+ g: a,
61
+ b: o,
62
+ a: s / 255
63
+ };
64
+ }
65
+ function o(e) {
66
+ return r(e) ?? a(e);
67
+ }
68
+ function s(e, t) {
69
+ let n = o(e), r = o(t);
70
+ return n && r ? [n, r] : null;
71
+ }
72
+ var c = (e) => {
73
+ let t = e / 255;
74
+ return t <= .04045 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
75
+ }, l = (e) => {
76
+ let t = e <= .0031308 ? 12.92 * e : 1.055 * e ** (1 / 2.4) - .055;
77
+ return n(Math.round(t * 255), 0, 255);
78
+ };
79
+ function u({ r: e, g: t, b: n }) {
80
+ let r = c(e), i = c(t), a = c(n), o = Math.cbrt(.4122214708 * r + .5363325363 * i + .0514459929 * a), s = Math.cbrt(.2119034982 * r + .6806995451 * i + .1073969566 * a), l = Math.cbrt(.0883024619 * r + .2817188376 * i + .6299787005 * a);
81
+ return {
82
+ L: .2104542553 * o + .793617785 * s - .0040720468 * l,
83
+ a: 1.9779984951 * o - 2.428592205 * s + .4505937099 * l,
84
+ b: .0259040371 * o + .7827717662 * s - .808675766 * l
85
+ };
86
+ }
87
+ function d(e, t = 1) {
88
+ let [n, r, i] = p(e);
89
+ return {
90
+ r: l(n),
91
+ g: l(r),
92
+ b: l(i),
93
+ a: t
94
+ };
95
+ }
96
+ function f(e, t, r) {
97
+ let i = u(e), a = u(t), o = n(r, 0, 1);
98
+ return d({
99
+ L: i.L + (a.L - i.L) * o,
100
+ a: i.a + (a.a - i.a) * o,
101
+ b: i.b + (a.b - i.b) * o
102
+ }, e.a + (t.a - e.a) * o);
103
+ }
104
+ function p({ L: e, a: t, b: n }) {
105
+ let r = (e + .3963377774 * t + .2158037573 * n) ** 3, i = (e - .1055613458 * t - .0638541728 * n) ** 3, a = (e - .0894841775 * t - 1.291485548 * n) ** 3;
106
+ return [
107
+ 4.0767416621 * r - 3.3077115913 * i + .2309699292 * a,
108
+ -1.2684380046 * r + 2.6097574011 * i - .3413193965 * a,
109
+ -.0041960863 * r - .7034186147 * i + 1.707614701 * a
110
+ ];
111
+ }
112
+ var m = (e) => p(e).every((e) => e >= -1e-4 && e <= 1.0001);
113
+ function h(e, t = 1) {
114
+ if (m(e)) return d(e, t);
115
+ let n = 0, r = 1;
116
+ for (let t = 0; t < 12; t++) {
117
+ let t = (n + r) / 2;
118
+ m({
119
+ L: e.L,
120
+ a: e.a * t,
121
+ b: e.b * t
122
+ }) ? n = t : r = t;
123
+ }
124
+ return d({
125
+ L: e.L,
126
+ a: e.a * n,
127
+ b: e.b * n
128
+ }, t);
129
+ }
130
+ function g(e, t, r = 1) {
131
+ let i = u(e);
132
+ return h({
133
+ L: n(t, 0, 1),
134
+ a: i.a * r,
135
+ b: i.b * r
136
+ }, e.a);
137
+ }
138
+ function _(e) {
139
+ return u(e).L;
140
+ }
141
+ function v(e) {
142
+ let t = u(e);
143
+ return d({
144
+ L: n(1.08 - t.L, .12, .62),
145
+ a: t.a,
146
+ b: t.b
147
+ }, e.a);
148
+ }
149
+ function y({ r: e, g: t, b: r, a: i }, a = 1) {
150
+ let o = n(i * a, 0, 1);
151
+ return `rgba(${Math.round(e)}, ${Math.round(t)}, ${Math.round(r)}, ${Math.round(o * 1e3) / 1e3})`;
152
+ }
153
+ export { y as cssRgba, d as fromOklab, h as fromOklabInGamut, _ as lightness, f as mixOklab, r as parseColor, o as readColor, s as readColorPair, a as resolveColor, v as toInk, u as toOklab, g as withLightness };
@@ -0,0 +1,7 @@
1
+ import { CursorWaveColor } from './cursorWaveRenderer';
2
+ /** A colour in a pool given as props: a CSS colour, or a two-stop gradient (top → bottom). */
3
+ export type CursorWaveColorInput = string | {
4
+ stops: readonly [string, string];
5
+ };
6
+ /** A pool from props, resolved (unreadable entries are left out; none left: null). */
7
+ export declare function explicitPool(pool: readonly CursorWaveColorInput[]): readonly CursorWaveColor[] | null;
@@ -0,0 +1,14 @@
1
+ import { readColor as e } from "./color.js";
2
+ // src/shared/backgrounds/cursorWavePool.ts
3
+ function t(t) {
4
+ let n = [];
5
+ for (let r of t) if (typeof r == "string") {
6
+ let t = e(r);
7
+ t && n.push(t);
8
+ } else {
9
+ let t = e(r.stops[0]), i = e(r.stops[1]);
10
+ t && i && n.push({ stops: [t, i] });
11
+ }
12
+ return n.length > 0 ? n : null;
13
+ }
14
+ export { t as explicitPool };
@@ -0,0 +1,43 @@
1
+ import { CanvasRenderer } from './canvasEffect';
2
+ import { Rgba } from './color';
3
+ export type CursorWaveShape = 'circle' | 'triangle' | 'square';
4
+ /** A colour in the pool: solid, or a two-stop gradient (top → bottom). */
5
+ export type CursorWaveColor = Rgba | {
6
+ stops: readonly [Rgba, Rgba];
7
+ };
8
+ /** The effect's parameters (the documented ones, with their documented defaults). */
9
+ export interface CursorWaveParams {
10
+ /** Pixel spacing between cell centres (16–96). */
11
+ cellSize: number;
12
+ /** Cursor influence radius, % of min(width, height) (5–80). */
13
+ influenceRadiusVmin: number;
14
+ /** Time constant (s) of the swell-up ease (0.05–2). */
15
+ attackTime: number;
16
+ /** Time constant (s) of the relax-down ease (0.05–2). */
17
+ releaseTime: number;
18
+ /** Resting scale of every shape (0–0.5). */
19
+ idleScale: number;
20
+ /** Lowest peak scale a cell is given (0.5–4). */
21
+ minPeakScale: number;
22
+ /** Highest peak scale a cell is given (1–6). */
23
+ maxPeakScale: number;
24
+ /** Burst ring speed, px/s (200–4000). */
25
+ burstSpeed: number;
26
+ /** Burst ring thickness, px (40–600). */
27
+ burstThickness: number;
28
+ /** Pool of shapes assigned across the grid (repeat entries to bias it). */
29
+ shapes: readonly CursorWaveShape[];
30
+ /** Master alpha, 0–1. */
31
+ opacity: number;
32
+ }
33
+ export declare const CURSOR_WAVE_DEFAULTS: CursorWaveParams;
34
+ export interface CursorWaveSettings extends CursorWaveParams {
35
+ /** The colour pool, resolved. */
36
+ colors: readonly CursorWaveColor[];
37
+ }
38
+ export interface CursorWaveRenderer extends CanvasRenderer {
39
+ update(settings: CursorWaveSettings): void;
40
+ /** Rolls a ring out from (x, y), fractions of the frame (the centre by default). */
41
+ burst(x?: number, y?: number): void;
42
+ }
43
+ export declare function createCursorWaveRenderer(initial: CursorWaveSettings, seed?: number): CursorWaveRenderer;