@42-central/ui-react 0.23.0 → 0.24.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,4 +1,5 @@
1
1
  import type { WithTestId } from "../../lib/test-id";
2
+ import { type StarfieldClassNames } from "./starfield";
2
3
  /**
3
4
  * AmbientBackground — a decorative, brand-tinted page background: a soft
4
5
  * radial glow plus a fine film-grain noise texture, so a flat page fill reads
@@ -18,6 +19,12 @@ import type { WithTestId } from "../../lib/test-id";
18
19
  * regardless of z-index — nesting a blended layer inside another `fixed`
19
20
  * wrapper would cut off what it can blend against).
20
21
  *
22
+ * `withStarfield` adds a third, opt-in layer set: a slowly moving starry sky
23
+ * over soft violet nebulae (dimming dust, breathing bright stars, a rare
24
+ * meteor), seeded so it is identical on every render. It follows the same
25
+ * recipe — separate fixed layers, no shared wrapper — and stills under reduced
26
+ * motion, either the OS setting or `data-motion="reduced"` on `<html>`.
27
+ *
21
28
  * The actual glow/noise values are CSS custom properties (`--ambient-glow` /
22
29
  * `--ambient-noise`, defined in `theme.css`, brand-tinted and theme-aware via
23
30
  * `data-theme`) rather than hardcoded here — override either on `:root` to
@@ -36,22 +43,26 @@ import type { WithTestId } from "../../lib/test-id";
36
43
  */
37
44
  /**
38
45
  * There is no root element, so `testId` lands on each layer with its part as a
39
- * suffix: `` `${testId}-glow` `` and `` `${testId}-noise` ``.
46
+ * suffix: `` `${testId}-glow` `` and `` `${testId}-noise` ``, and with the
47
+ * starfield `` `${testId}-nebula-<n>` ``, `` `${testId}-stars` `` and
48
+ * `` `${testId}-meteors` ``.
40
49
  */
41
50
  export type AmbientBackgroundProps = WithTestId & {
42
51
  /** Render the radial glow layer. Default `true`. */
43
52
  withGlow?: boolean;
44
53
  /** Render the film-grain noise layer. Default `true`. */
45
54
  withNoise?: boolean;
55
+ /** Render the starfield over the glow and noise: nebulae, stars and meteors. Default `false`. */
56
+ withStarfield?: boolean;
46
57
  /** @deprecated Renamed `withGlow`. Removed in the next minor. `withGlow` wins when both are set. */
47
58
  glow?: boolean;
48
59
  /** @deprecated Renamed `withNoise`. Removed in the next minor. `withNoise` wins when both are set. */
49
60
  noise?: boolean;
50
61
  /** Extra classes for each layer. */
51
- classNames?: {
62
+ classNames?: StarfieldClassNames & {
52
63
  glow?: string;
53
64
  noise?: string;
54
65
  };
55
66
  };
56
- export declare const AmbientBackground: ({ glow, noise, withGlow, withNoise, classNames, testId, }: AmbientBackgroundProps) => import("react").JSX.Element;
67
+ export declare const AmbientBackground: ({ glow, noise, withGlow, withNoise, withStarfield, classNames, testId, }: AmbientBackgroundProps) => import("react").JSX.Element;
57
68
  //# sourceMappingURL=ambient-background.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ambient-background.d.ts","sourceRoot":"","sources":["../../../src/components/ambient-background/ambient-background.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,UAAU,GAAG;IAChD,oDAAoD;IACpD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,yDAAyD;IACzD,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,oGAAoG;IACpG,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,sGAAsG;IACtG,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,oCAAoC;IACpC,UAAU,CAAC,EAAE;QACX,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;CACF,CAAA;AAED,eAAO,MAAM,iBAAiB,8DAO3B,sBAAsB,gCA6BxB,CAAA"}
1
+ {"version":3,"file":"ambient-background.d.ts","sourceRoot":"","sources":["../../../src/components/ambient-background/ambient-background.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAa,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG,UAAU,GAAG;IAChD,oDAAoD;IACpD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,yDAAyD;IACzD,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,iGAAiG;IACjG,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,oGAAoG;IACpG,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,sGAAsG;IACtG,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,oCAAoC;IACpC,UAAU,CAAC,EAAE,mBAAmB,GAAG;QACjC,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;CACF,CAAA;AAED,eAAO,MAAM,iBAAiB,6EAQ3B,sBAAsB,gCA8BxB,CAAA"}
@@ -3,11 +3,231 @@ import { props } from '../../chunk-WYCMIIRR.js';
3
3
  import { cn } from '../../chunk-4ASNIDV7.js';
4
4
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
5
5
 
6
+ var prng = (seed) => () => {
7
+ seed = seed + 1831565813 | 0;
8
+ let t = Math.imul(seed ^ seed >>> 15, 1 | seed);
9
+ t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t;
10
+ return ((t ^ t >>> 14) >>> 0) / 4294967296;
11
+ };
12
+ var round = (n) => Math.round(n * 100) / 100;
13
+ var TONES = [
14
+ "fill-brand-500 dark:fill-brand-100",
15
+ "fill-purple-500 dark:fill-purple-200",
16
+ "fill-pink-500 dark:fill-pink-200"
17
+ ];
18
+ var pickTone = (n) => n < 0.78 ? TONES[0] : n < 0.95 ? TONES[1] : TONES[2];
19
+ var DIM_BEATS = [
20
+ { duration: "11s", delay: "-3s" },
21
+ { duration: "17s", delay: "-11s" },
22
+ { duration: "23s", delay: "-7s" }
23
+ ];
24
+ var scatter = (seed, size, count) => {
25
+ const random = prng(seed);
26
+ const group = prng(seed + 1);
27
+ const phases = DIM_BEATS.map(() => new Map(TONES.map((tone) => [tone, []])));
28
+ for (let i = 0; i < count; i++) {
29
+ const weight = random() ** 2.4;
30
+ const star = {
31
+ // Kept off the tile's edge so no dot is cut in half where tiles meet.
32
+ x: round(2 + random() * (size - 4)),
33
+ y: round(2 + random() * (size - 4)),
34
+ r: round(0.4 + weight * 0.75),
35
+ opacity: round(0.22 + weight * 0.4 + random() * 0.1)
36
+ };
37
+ phases[Math.floor(group() * phases.length)]?.get(pickTone(random()))?.push(star);
38
+ }
39
+ return { size, phases: phases.map((phase) => [...phase]) };
40
+ };
41
+ var TILES = [scatter(42, 509, 26), scatter(1337, 733, 38)];
42
+ var BRIGHT_STARS = [
43
+ { x: "8%", y: "14%", sparkle: true, delay: "0s", duration: "7s" },
44
+ { x: "31%", y: "6%", sparkle: false, delay: "-2s", duration: "9s" },
45
+ { x: "62%", y: "11%", sparkle: false, delay: "-5s", duration: "8s" },
46
+ { x: "88%", y: "22%", sparkle: true, delay: "-3s", duration: "10s" },
47
+ { x: "18%", y: "58%", sparkle: false, delay: "-6s", duration: "8s" },
48
+ { x: "47%", y: "41%", sparkle: false, delay: "-1s", duration: "11s" },
49
+ { x: "76%", y: "63%", sparkle: true, delay: "-4s", duration: "9s" },
50
+ { x: "36%", y: "86%", sparkle: false, delay: "-7s", duration: "10s" },
51
+ { x: "93%", y: "90%", sparkle: false, delay: "-2.5s", duration: "7s" }
52
+ ];
53
+ var SPARKLE = "M0 -6Q0 0 6 0Q0 0 0 6Q0 0 -6 0Q0 0 0 -6Z";
54
+ var BLEED = 15;
55
+ var SPAN = 100 + 2 * BLEED;
56
+ var inLayer = (viewport, offset = 0) => `${round((viewport + offset) / SPAN * 100)}%`;
57
+ var cloud = ({ rx, ry, x, y }, { color, strength }) => `radial-gradient(ellipse ${inLayer(rx)} ${inLayer(ry)} at ${inLayer(x, BLEED)} ${inLayer(y, BLEED)}, color-mix(in oklab, var(${color}) ${strength}%, transparent), color-mix(in oklab, var(${color}) ${strength * 0.45}%, transparent) 45%, transparent 100%)`;
58
+ var CLOUDS = [
59
+ {
60
+ at: { rx: 42, ry: 34, x: 30, y: 64 },
61
+ dark: { color: "--color-purple-400", strength: 9 },
62
+ light: { color: "--color-purple-200", strength: 14 },
63
+ drift: { x: "6vw", y: "-4vh", scale: 1.12, fade: 0.7, duration: "70s", delay: "-20s" }
64
+ },
65
+ {
66
+ at: { rx: 60, ry: 38, x: 42, y: 104 },
67
+ dark: { color: "--color-purple-800", strength: 20 },
68
+ light: { color: "--color-purple-200", strength: 26 },
69
+ drift: { x: "-8vw", y: "-3vh", scale: 1.08, fade: 0.85, duration: "95s", delay: "-50s" }
70
+ },
71
+ {
72
+ at: { rx: 40, ry: 34, x: 92, y: 4 },
73
+ dark: { color: "--color-purple-800", strength: 22 },
74
+ light: { color: "--color-purple-200", strength: 28 },
75
+ drift: { x: "-5vw", y: "5vh", scale: 1.15, fade: 0.8, duration: "85s", delay: "-10s" }
76
+ },
77
+ {
78
+ at: { rx: 46, ry: 40, x: 24, y: 20 },
79
+ dark: { color: "--color-brand-700", strength: 18 },
80
+ light: { color: "--color-brand-200", strength: 24 },
81
+ drift: { x: "7vw", y: "4vh", scale: 1.1, fade: 0.85, duration: "110s", delay: "-70s" }
82
+ },
83
+ {
84
+ at: { rx: 36, ry: 30, x: 4, y: 92 },
85
+ dark: { color: "--color-pink-800", strength: 10 },
86
+ light: { color: "--color-pink-200", strength: 16 },
87
+ drift: { x: "5vw", y: "-6vh", scale: 1.2, fade: 0.6, duration: "75s", delay: "-35s" }
88
+ }
89
+ ];
90
+ var cloudStyle = ({ at, dark, light, drift }) => ({
91
+ "--nebula-light": cloud(at, light),
92
+ "--nebula-dark": cloud(at, dark),
93
+ "--drift-x": drift.x,
94
+ "--drift-y": drift.y,
95
+ "--drift-scale": drift.scale,
96
+ "--drift-fade": drift.fade,
97
+ inset: `-${BLEED}%`,
98
+ animationDuration: drift.duration,
99
+ animationDelay: drift.delay
100
+ });
101
+ var METEORS = [
102
+ { x: "72%", y: "8%", angle: "152deg", duration: "37s", delay: "9s" },
103
+ { x: "50%", y: "20%", angle: "160deg", duration: "53s", delay: "24s" },
104
+ { x: "92%", y: "30%", angle: "148deg", duration: "71s", delay: "41s" }
105
+ ];
106
+ var HALO_THEME = "[--star-halo-core:var(--color-brand-400)] [--star-halo-rim:var(--color-purple-400)] dark:[--star-halo-core:var(--color-brand-100)] dark:[--star-halo-rim:var(--color-purple-300)]";
107
+ var LAYER = "ambient-starfield pointer-events-none fixed -z-10 forced-colors:hidden";
108
+ var Starfield = ({
109
+ classNames,
110
+ testId
111
+ }) => /* @__PURE__ */ jsxs(Fragment, { children: [
112
+ CLOUDS.map((c, i) => /* @__PURE__ */ jsx(
113
+ "div",
114
+ {
115
+ "aria-hidden": "true",
116
+ className: cn(
117
+ LAYER,
118
+ "[background-image:var(--nebula-light)] motion-safe:animate-ambient-nebula-drift dark:[background-image:var(--nebula-dark)]",
119
+ classNames?.nebula
120
+ ),
121
+ style: cloudStyle(c),
122
+ ...props({ "data-testid": testId && `${testId}-nebula-${i}` })
123
+ },
124
+ `${c.at.x}-${c.at.y}`
125
+ )),
126
+ /* @__PURE__ */ jsxs(
127
+ "div",
128
+ {
129
+ "aria-hidden": "true",
130
+ className: cn(LAYER, "inset-0 opacity-70 dark:opacity-100", HALO_THEME, classNames?.stars),
131
+ ...props({ "data-testid": testId && `${testId}-stars` }),
132
+ children: [
133
+ /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", className: "absolute size-0", children: /* @__PURE__ */ jsxs("defs", { children: [
134
+ TILES.flatMap(
135
+ ({ size, phases }, i) => phases.map((groups, phase) => /* @__PURE__ */ jsx(
136
+ "pattern",
137
+ {
138
+ id: `ambient-starfield-tile-${i}-${phase}`,
139
+ width: size,
140
+ height: size,
141
+ patternUnits: "userSpaceOnUse",
142
+ children: groups.map(([tone, stars]) => /* @__PURE__ */ jsx("g", { className: tone, children: stars.map(({ x, y, r, opacity }) => /* @__PURE__ */ jsx("circle", { cx: x, cy: y, r, fillOpacity: opacity }, `${x}-${y}`)) }, tone))
143
+ },
144
+ `${i}-${phase}`
145
+ ))
146
+ ),
147
+ /* @__PURE__ */ jsxs("radialGradient", { id: "ambient-starfield-halo", children: [
148
+ /* @__PURE__ */ jsx("stop", { offset: "0%", style: { stopColor: "var(--star-halo-core)" }, stopOpacity: 0.32 }),
149
+ /* @__PURE__ */ jsx("stop", { offset: "35%", style: { stopColor: "var(--star-halo-rim)" }, stopOpacity: 0.1 }),
150
+ /* @__PURE__ */ jsx("stop", { offset: "100%", style: { stopColor: "var(--star-halo-rim)" }, stopOpacity: 0 })
151
+ ] })
152
+ ] }) }),
153
+ DIM_BEATS.map(({ duration, delay }, phase) => /* @__PURE__ */ jsx(
154
+ "svg",
155
+ {
156
+ "aria-hidden": "true",
157
+ className: "absolute inset-0 size-full motion-safe:animate-ambient-star-dim",
158
+ style: { animationDuration: duration, animationDelay: delay },
159
+ children: TILES.map(({ size }, i) => /* @__PURE__ */ jsx(
160
+ "rect",
161
+ {
162
+ width: "100%",
163
+ height: "100%",
164
+ fill: `url(#ambient-starfield-tile-${i}-${phase})`
165
+ },
166
+ size
167
+ ))
168
+ },
169
+ duration
170
+ )),
171
+ /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", className: "absolute inset-0 size-full", children: BRIGHT_STARS.map(({ x, y, sparkle, delay, duration }) => /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", x, y, overflow: "visible", children: /* @__PURE__ */ jsxs(
172
+ "g",
173
+ {
174
+ className: "motion-safe:animate-ambient-star-twinkle",
175
+ style: { animationDelay: delay, animationDuration: duration },
176
+ children: [
177
+ /* @__PURE__ */ jsx("circle", { r: 7, fill: "url(#ambient-starfield-halo)" }),
178
+ sparkle ? /* @__PURE__ */ jsx(
179
+ "path",
180
+ {
181
+ d: SPARKLE,
182
+ className: "fill-purple-400 dark:fill-purple-100",
183
+ fillOpacity: 0.4
184
+ }
185
+ ) : null,
186
+ /* @__PURE__ */ jsx("circle", { r: 1.1, className: "fill-brand-500 dark:fill-brand-50", fillOpacity: 0.85 })
187
+ ]
188
+ }
189
+ ) }, `${x}-${y}`)) })
190
+ ]
191
+ }
192
+ ),
193
+ /* @__PURE__ */ jsx(
194
+ "div",
195
+ {
196
+ "aria-hidden": "true",
197
+ className: cn(
198
+ LAYER,
199
+ "ambient-starfield-meteors inset-0 hidden overflow-hidden motion-safe:block",
200
+ classNames?.meteors
201
+ ),
202
+ ...props({ "data-testid": testId && `${testId}-meteors` }),
203
+ children: METEORS.map(({ x, y, angle, duration, delay }) => (
204
+ // A zero-size anchor turned to the meteor's heading; the streak
205
+ // ends at it, head first, and flies along that heading.
206
+ /* @__PURE__ */ jsx(
207
+ "span",
208
+ {
209
+ className: "absolute size-0",
210
+ style: { left: x, top: y, rotate: angle },
211
+ children: /* @__PURE__ */ jsx(
212
+ "span",
213
+ {
214
+ className: "absolute top-0 right-0 h-px w-28 origin-right rounded-full bg-linear-to-r from-transparent to-brand-500/50 opacity-0 motion-safe:animate-ambient-meteor dark:to-white/60",
215
+ style: { animationDuration: duration, animationDelay: delay }
216
+ }
217
+ )
218
+ },
219
+ `${x}-${y}`
220
+ )
221
+ ))
222
+ }
223
+ )
224
+ ] });
6
225
  var AmbientBackground = ({
7
226
  glow,
8
227
  noise,
9
228
  withGlow = glow ?? true,
10
229
  withNoise = noise ?? true,
230
+ withStarfield = false,
11
231
  classNames,
12
232
  testId
13
233
  }) => {
@@ -37,7 +257,8 @@ var AmbientBackground = ({
37
257
  style: { backgroundImage: "var(--ambient-noise)" },
38
258
  ...props({ "data-testid": testId && `${testId}-noise` })
39
259
  }
40
- )
260
+ ),
261
+ withStarfield && /* @__PURE__ */ jsx(Starfield, { classNames, testId })
41
262
  ] });
42
263
  };
43
264
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ambient-background/ambient-background.tsx"],"names":[],"mappings":";;;;;AA4DO,IAAM,oBAAoB,CAAC;AAAA,EAChC,IAAA;AAAA,EACA,KAAA;AAAA,EACA,WAAW,IAAA,IAAQ,IAAA;AAAA,EACnB,YAAY,KAAA,IAAS,IAAA;AAAA,EACrB,UAAA;AAAA,EACA;AACF,CAAA,KAA8B;AAC5B,EAAA,IAAI,IAAA,KAAS,MAAA,EAAW,eAAA,CAAgB,mBAAA,EAAqB,QAAQ,UAAU,CAAA;AAC/E,EAAA,IAAI,KAAA,KAAU,MAAA,EAAW,eAAA,CAAgB,mBAAA,EAAqB,SAAS,WAAW,CAAA;AAClF,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA;AAAA,IAAA,QAAA,oBACC,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,aAAA,EAAY,MAAA;AAAA,QACZ,SAAA,EAAW,EAAA;AAAA,UACT,8DAAA;AAAA,UACA,UAAA,EAAY;AAAA,SACd;AAAA,QACA,KAAA,EAAO,EAAE,eAAA,EAAiB,qBAAA,EAAsB;AAAA,QAC/C,GAAG,MAAM,EAAE,aAAA,EAAe,UAAU,CAAA,EAAG,MAAM,SAAS;AAAA;AAAA,KACzD;AAAA,IAED,SAAA,oBACC,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,aAAA,EAAY,MAAA;AAAA,QACZ,SAAA,EAAW,EAAA;AAAA,UACT,wEAAA;AAAA,UACA,UAAA,EAAY;AAAA,SACd;AAAA,QACA,KAAA,EAAO,EAAE,eAAA,EAAiB,sBAAA,EAAuB;AAAA,QAChD,GAAG,MAAM,EAAE,aAAA,EAAe,UAAU,CAAA,EAAG,MAAM,UAAU;AAAA;AAAA;AAC1D,GAAA,EAEJ,CAAA;AAEJ","file":"index.js","sourcesContent":["import { cn } from \"../../lib/cn\"\nimport { warnRenamedProp } from \"../../lib/dev-warn\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\n\n/**\n * AmbientBackground — a decorative, brand-tinted page background: a soft\n * radial glow plus a fine film-grain noise texture, so a flat page fill reads\n * as a considered surface instead of a plain color.\n *\n * Render it once, as the first child of your root layout (so later content\n * naturally paints over it) — both layers are `position: fixed`, so a single\n * instance covers the whole viewport regardless of scroll position or page\n * height. It renders nothing interactive: `aria-hidden`, `pointer-events-none`,\n * and hidden under `forced-colors` (Windows High Contrast), since a decorative\n * background has no place overriding a user's forced palette.\n *\n * Glow and noise render as two *independent* fixed elements rather than one\n * wrapper containing two children, so either can be toggled/overridden\n * without the other, and neither traps a future blend-mode override inside\n * an isolated stacking context (`position: fixed` always creates one,\n * regardless of z-index — nesting a blended layer inside another `fixed`\n * wrapper would cut off what it can blend against).\n *\n * The actual glow/noise values are CSS custom properties (`--ambient-glow` /\n * `--ambient-noise`, defined in `theme.css`, brand-tinted and theme-aware via\n * `data-theme`) rather than hardcoded here — override either on `:root` to\n * reskin it without forking this component.\n *\n * Pure Server Component: no state, no client JS.\n *\n * @example\n * ```tsx\n * // app/layout.tsx\n * <body>\n * <AmbientBackground />\n * {children}\n * </body>\n * ```\n */\n/**\n * There is no root element, so `testId` lands on each layer with its part as a\n * suffix: `` `${testId}-glow` `` and `` `${testId}-noise` ``.\n */\nexport type AmbientBackgroundProps = WithTestId & {\n /** Render the radial glow layer. Default `true`. */\n withGlow?: boolean\n /** Render the film-grain noise layer. Default `true`. */\n withNoise?: boolean\n /** @deprecated Renamed `withGlow`. Removed in the next minor. `withGlow` wins when both are set. */\n glow?: boolean\n /** @deprecated Renamed `withNoise`. Removed in the next minor. `withNoise` wins when both are set. */\n noise?: boolean\n /** Extra classes for each layer. */\n classNames?: {\n glow?: string\n noise?: string\n }\n}\n\nexport const AmbientBackground = ({\n glow,\n noise,\n withGlow = glow ?? true,\n withNoise = noise ?? true,\n classNames,\n testId,\n}: AmbientBackgroundProps) => {\n if (glow !== undefined) warnRenamedProp(\"AmbientBackground\", \"glow\", \"withGlow\")\n if (noise !== undefined) warnRenamedProp(\"AmbientBackground\", \"noise\", \"withNoise\")\n return (\n <>\n {withGlow && (\n <div\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none fixed inset-0 -z-10 forced-colors:hidden\",\n classNames?.glow,\n )}\n style={{ backgroundImage: \"var(--ambient-glow)\" }}\n {...props({ \"data-testid\": testId && `${testId}-glow` })}\n />\n )}\n {withNoise && (\n <div\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none fixed inset-0 -z-10 bg-repeat forced-colors:hidden\",\n classNames?.noise,\n )}\n style={{ backgroundImage: \"var(--ambient-noise)\" }}\n {...props({ \"data-testid\": testId && `${testId}-noise` })}\n />\n )}\n </>\n )\n}\n"]}
1
+ {"version":3,"sources":["../../../src/components/ambient-background/starfield.tsx","../../../src/components/ambient-background/ambient-background.tsx"],"names":["jsxs","Fragment","jsx"],"mappings":";;;;;AAoBA,IAAM,IAAA,GAAO,CAAC,IAAA,KAAiB,MAAM;AACnC,EAAA,IAAA,GAAQ,OAAO,UAAA,GAAc,CAAA;AAC7B,EAAA,IAAI,IAAI,IAAA,CAAK,IAAA,CAAK,OAAQ,IAAA,KAAS,EAAA,EAAK,IAAI,IAAI,CAAA;AAChD,EAAA,CAAA,GAAK,CAAA,GAAI,KAAK,IAAA,CAAK,CAAA,GAAK,MAAM,CAAA,EAAI,EAAA,GAAK,CAAC,CAAA,GAAK,CAAA;AAC7C,EAAA,OAAA,CAAA,CAAS,CAAA,GAAK,CAAA,KAAM,EAAA,MAAS,CAAA,IAAK,UAAA;AACpC,CAAA;AAEA,IAAM,QAAQ,CAAC,CAAA,KAAc,KAAK,KAAA,CAAM,CAAA,GAAI,GAAG,CAAA,GAAI,GAAA;AAMnD,IAAM,KAAA,GAAQ;AAAA,EACZ,oCAAA;AAAA,EACA,sCAAA;AAAA,EACA;AACF,CAAA;AAIA,IAAM,QAAA,GAAW,CAAC,CAAA,KAAqB,CAAA,GAAI,OAAO,KAAA,CAAM,CAA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AAG,MAAM,EAAE,aAAA,EAAe,UAAU,CAAA,EAAG,MAAM,SAAS;AAAA;AAAA,KACzD;AAAA,IAED,6BACCA,GAAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,aAAA,EAAY,MAAA;AAAA,QACZ,SAAA,EAAW,EAAA;AAAA,UACT,wEAAA;AAAA,UACA,UAAA,EAAY;AAAA,SACd;AAAA,QACA,KAAA,EAAO,EAAE,eAAA,EAAiB,sBAAA,EAAuB;AAAA,QAChD,GAAG,MAAM,EAAE,aAAA,EAAe,UAAU,CAAA,EAAG,MAAM,UAAU;AAAA;AAAA,KAC1D;AAAA,IAED,aAAA,oBAAiBA,GAAAA,CAAC,SAAA,EAAA,EAAU,YAAwB,MAAA,EAAgB;AAAA,GAAA,EACvE,CAAA;AAEJ","file":"index.js","sourcesContent":["import type { CSSProperties } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { props } from \"../../lib/props\"\n\n// The starfield AmbientBackground draws with `withStarfield`: a starry sky over\n// soft violet nebulae, stacked on the glow and noise (the noise is what\n// dithers these gradients so they never band). Every layer takes the same\n// recipe as glow and noise (fixed, -z-10, no shared wrapper) and paints over\n// them, still under every piece of the app.\n//\n// Everything is computed once at module load from a seeded PRNG, so the sky\n// is identical on every render, on the server and the client, and on every\n// visit. It moves, slowly: the clouds drift and swell, the dust dims and comes\n// back, the brighter stars breathe, and now and then a meteor crosses. All of\n// it is CSS animation of transform and opacity (keyframes in theme.css), so\n// the compositor runs it and no script does per frame; and all of it sits\n// behind `motion-safe:` and the `data-motion=\"reduced\"` rule in theme.css, so\n// with reduced motion the sky is a still picture, without the meteors.\n\n// mulberry32: tiny, fast, and good enough to scatter dots.\nconst prng = (seed: number) => () => {\n seed = (seed + 0x6d2b79f5) | 0\n let t = Math.imul(seed ^ (seed >>> 15), 1 | seed)\n t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296\n}\n\nconst round = (n: number) => Math.round(n * 100) / 100\n\ntype Star = { x: number; y: number; r: number; opacity: number }\n\n// Most stars are a cool white; a few lean violet or pink, as in the design.\n// On a light sky the same hues go dark, so the dots read as ink, not glare.\nconst TONES = [\n \"fill-brand-500 dark:fill-brand-100\",\n \"fill-purple-500 dark:fill-purple-200\",\n \"fill-pink-500 dark:fill-pink-200\",\n] as const\n\ntype Tone = (typeof TONES)[number]\n\nconst pickTone = (n: number): Tone => (n < 0.78 ? TONES[0] : n < 0.95 ? TONES[1] : TONES[2])\n\n// The dust dims in a few groups, each on its own slow beat, so at any moment\n// some stars are fading and others coming back. A group is a whole layer\n// fading (cheap: the compositor does it), and its stars are scattered all\n// over, so it reads as single stars dimming, not as a region pulsing. The\n// beats share no common factor, so the groups never line up into one blink.\nconst DIM_BEATS = [\n { duration: \"11s\", delay: \"-3s\" },\n { duration: \"17s\", delay: \"-11s\" },\n { duration: \"23s\", delay: \"-7s\" },\n] as const\n\n// Dots for one repeating tile, by dimming group, then by tone so each tone\n// is one <g>.\nconst scatter = (seed: number, size: number, count: number) => {\n const random = prng(seed)\n // Its own sequence, so sorting the dots into groups doesn't move them.\n const group = prng(seed + 1)\n const phases = DIM_BEATS.map(() => new Map<Tone, Star[]>(TONES.map((tone) => [tone, []])))\n for (let i = 0; i < count; i++) {\n // Skewed towards the faintest, smallest dots: a real sky is mostly dust.\n const weight = random() ** 2.4\n const star = {\n // Kept off the tile's edge so no dot is cut in half where tiles meet.\n x: round(2 + random() * (size - 4)),\n y: round(2 + random() * (size - 4)),\n r: round(0.4 + weight * 0.75),\n opacity: round(0.22 + weight * 0.4 + random() * 0.1),\n }\n phases[Math.floor(group() * phases.length)]?.get(pickTone(random()))?.push(star)\n }\n return { size, phases: phases.map((phase) => [...phase]) }\n}\n\n// Two tiles of coprime-ish sizes overlap into a pattern that only repeats\n// every few thousand pixels, so the eye never catches the tiling. Fixed pixel\n// tiles (not a scaled viewBox) keep the same density on a phone and a wide\n// screen. Together about one dot per 6000px², the design's own density.\nconst TILES = [scatter(42, 509, 26), scatter(1337, 733, 38)]\n\n// The few brighter stars, placed by viewport percentage so they spread over\n// any screen. A soft halo rather than a hard disc; the three with `sparkle`\n// carry the design's diffraction spikes, kept thin and short.\nconst BRIGHT_STARS = [\n { x: \"8%\", y: \"14%\", sparkle: true, delay: \"0s\", duration: \"7s\" },\n { x: \"31%\", y: \"6%\", sparkle: false, delay: \"-2s\", duration: \"9s\" },\n { x: \"62%\", y: \"11%\", sparkle: false, delay: \"-5s\", duration: \"8s\" },\n { x: \"88%\", y: \"22%\", sparkle: true, delay: \"-3s\", duration: \"10s\" },\n { x: \"18%\", y: \"58%\", sparkle: false, delay: \"-6s\", duration: \"8s\" },\n { x: \"47%\", y: \"41%\", sparkle: false, delay: \"-1s\", duration: \"11s\" },\n { x: \"76%\", y: \"63%\", sparkle: true, delay: \"-4s\", duration: \"9s\" },\n { x: \"36%\", y: \"86%\", sparkle: false, delay: \"-7s\", duration: \"10s\" },\n { x: \"93%\", y: \"90%\", sparkle: false, delay: \"-2.5s\", duration: \"7s\" },\n] as const\n\n// A four-point sparkle with concave sides: reads as a lens glint, not a shape.\nconst SPARKLE = \"M0 -6Q0 0 6 0Q0 0 0 6Q0 0 -6 0Q0 0 0 -6Z\"\n\n// Each cloud's layer overhangs the viewport by this much on every side, so a\n// cloud cut by the screen's edge (several are) can drift without the cut\n// ever coming into view.\nconst BLEED = 15\nconst SPAN = 100 + 2 * BLEED\n\n// A length or a position given in viewport %, as % of the overhanging layer.\nconst inLayer = (viewport: number, offset = 0) => `${round(((viewport + offset) / SPAN) * 100)}%`\n\ntype Ellipse = { rx: number; ry: number; x: number; y: number }\ntype Hue = { color: string; strength: number }\n\n// Violet and indigo clouds after the design's \"Nébuleuse\", softened: wide\n// ellipses that fade out over their whole radius so no edge ever shows. The\n// design's blue core is already the kit's ambient glow; this adds the purple.\nconst cloud = ({ rx, ry, x, y }: Ellipse, { color, strength }: Hue) =>\n `radial-gradient(ellipse ${inLayer(rx)} ${inLayer(ry)} at ${inLayer(x, BLEED)} ${inLayer(y, BLEED)}, color-mix(in oklab, var(${color}) ${strength}%, transparent), color-mix(in oklab, var(${color}) ${strength * 0.45}%, transparent) 45%, transparent 100%)`\n\n// Each cloud drifts on its own long, slow swing (there and back, eased at\n// both ends), swelling a little and thinning as it goes: a few px a second,\n// so the sky is never seen moving, only found changed. On a light sky the\n// same clouds are pale tints, so the light theme keeps the violet without\n// muddying the page.\nconst CLOUDS: {\n at: Ellipse\n dark: Hue\n light: Hue\n drift: { x: string; y: string; scale: number; fade: number; duration: string; delay: string }\n}[] = [\n {\n at: { rx: 42, ry: 34, x: 30, y: 64 },\n dark: { color: \"--color-purple-400\", strength: 9 },\n light: { color: \"--color-purple-200\", strength: 14 },\n drift: { x: \"6vw\", y: \"-4vh\", scale: 1.12, fade: 0.7, duration: \"70s\", delay: \"-20s\" },\n },\n {\n at: { rx: 60, ry: 38, x: 42, y: 104 },\n dark: { color: \"--color-purple-800\", strength: 20 },\n light: { color: \"--color-purple-200\", strength: 26 },\n drift: { x: \"-8vw\", y: \"-3vh\", scale: 1.08, fade: 0.85, duration: \"95s\", delay: \"-50s\" },\n },\n {\n at: { rx: 40, ry: 34, x: 92, y: 4 },\n dark: { color: \"--color-purple-800\", strength: 22 },\n light: { color: \"--color-purple-200\", strength: 28 },\n drift: { x: \"-5vw\", y: \"5vh\", scale: 1.15, fade: 0.8, duration: \"85s\", delay: \"-10s\" },\n },\n {\n at: { rx: 46, ry: 40, x: 24, y: 20 },\n dark: { color: \"--color-brand-700\", strength: 18 },\n light: { color: \"--color-brand-200\", strength: 24 },\n drift: { x: \"7vw\", y: \"4vh\", scale: 1.1, fade: 0.85, duration: \"110s\", delay: \"-70s\" },\n },\n {\n at: { rx: 36, ry: 30, x: 4, y: 92 },\n dark: { color: \"--color-pink-800\", strength: 10 },\n light: { color: \"--color-pink-200\", strength: 16 },\n drift: { x: \"5vw\", y: \"-6vh\", scale: 1.2, fade: 0.6, duration: \"75s\", delay: \"-35s\" },\n },\n]\n\n// The cloud's picture per theme and its drift, as variables the classes and\n// the ambient-nebula-drift keyframes (theme.css) read.\nconst cloudStyle = ({ at, dark, light, drift }: (typeof CLOUDS)[number]) =>\n ({\n \"--nebula-light\": cloud(at, light),\n \"--nebula-dark\": cloud(at, dark),\n \"--drift-x\": drift.x,\n \"--drift-y\": drift.y,\n \"--drift-scale\": drift.scale,\n \"--drift-fade\": drift.fade,\n inset: `-${BLEED}%`,\n animationDuration: drift.duration,\n animationDelay: drift.delay,\n }) as CSSProperties\n\n// The meteors: three, each on its own long cycle and visible for about a\n// second of it, so one crosses every twenty seconds or so, never on arrival\n// and almost never two at once. Thin, short and faint, high in the sky,\n// falling down and to the left. Seen from the corner of the eye, not watched.\nconst METEORS = [\n { x: \"72%\", y: \"8%\", angle: \"152deg\", duration: \"37s\", delay: \"9s\" },\n { x: \"50%\", y: \"20%\", angle: \"160deg\", duration: \"53s\", delay: \"24s\" },\n { x: \"92%\", y: \"30%\", angle: \"148deg\", duration: \"71s\", delay: \"41s\" },\n] as const\n\n// The halo's stops, per theme: a gradient stop takes no `dark:` class.\nconst HALO_THEME =\n \"[--star-halo-core:var(--color-brand-400)] [--star-halo-rim:var(--color-purple-400)] dark:[--star-halo-core:var(--color-brand-100)] dark:[--star-halo-rim:var(--color-purple-300)]\"\n\n// Every layer's recipe: decorative, out of the pointer's way and out of a\n// forced palette's. `ambient-starfield` is the hook theme.css's\n// `data-motion=\"reduced\"` rule stills it by.\nconst LAYER = \"ambient-starfield pointer-events-none fixed -z-10 forced-colors:hidden\"\n\nexport type StarfieldClassNames = {\n /** Each nebula cloud's layer. */\n nebula?: string\n /** The layer holding the dust and the brighter stars. */\n stars?: string\n /** The meteors' layer. */\n meteors?: string\n}\n\nexport const Starfield = ({\n classNames,\n testId,\n}: {\n classNames?: StarfieldClassNames\n testId?: string\n}) => (\n <>\n {CLOUDS.map((c, i) => (\n <div\n key={`${c.at.x}-${c.at.y}`}\n aria-hidden=\"true\"\n className={cn(\n LAYER,\n \"[background-image:var(--nebula-light)] motion-safe:animate-ambient-nebula-drift dark:[background-image:var(--nebula-dark)]\",\n classNames?.nebula,\n )}\n style={cloudStyle(c)}\n {...props({ \"data-testid\": testId && `${testId}-nebula-${i}` })}\n />\n ))}\n\n {/* Fainter on a light sky: dark dots at the dark sky's strength read\n as specks rather than dust. Set on the wrapper, because the layers\n inside animate their own opacity. */}\n <div\n aria-hidden=\"true\"\n className={cn(LAYER, \"inset-0 opacity-70 dark:opacity-100\", HALO_THEME, classNames?.stars)}\n {...props({ \"data-testid\": testId && `${testId}-stars` })}\n >\n <svg aria-hidden=\"true\" className=\"absolute size-0\">\n <defs>\n {TILES.flatMap(({ size, phases }, i) =>\n phases.map((groups, phase) => (\n <pattern\n // biome-ignore lint/suspicious/noArrayIndexKey: a static, never-reordered list\n key={`${i}-${phase}`}\n id={`ambient-starfield-tile-${i}-${phase}`}\n width={size}\n height={size}\n patternUnits=\"userSpaceOnUse\"\n >\n {groups.map(([tone, stars]) => (\n <g key={tone} className={tone}>\n {stars.map(({ x, y, r, opacity }) => (\n <circle key={`${x}-${y}`} cx={x} cy={y} r={r} fillOpacity={opacity} />\n ))}\n </g>\n ))}\n </pattern>\n )),\n )}\n <radialGradient id=\"ambient-starfield-halo\">\n <stop offset=\"0%\" style={{ stopColor: \"var(--star-halo-core)\" }} stopOpacity={0.32} />\n <stop offset=\"35%\" style={{ stopColor: \"var(--star-halo-rim)\" }} stopOpacity={0.1} />\n <stop offset=\"100%\" style={{ stopColor: \"var(--star-halo-rim)\" }} stopOpacity={0} />\n </radialGradient>\n </defs>\n </svg>\n\n {DIM_BEATS.map(({ duration, delay }, phase) => (\n <svg\n key={duration}\n aria-hidden=\"true\"\n className=\"absolute inset-0 size-full motion-safe:animate-ambient-star-dim\"\n style={{ animationDuration: duration, animationDelay: delay }}\n >\n {TILES.map(({ size }, i) => (\n <rect\n key={size}\n width=\"100%\"\n height=\"100%\"\n fill={`url(#ambient-starfield-tile-${i}-${phase})`}\n />\n ))}\n </svg>\n ))}\n\n <svg aria-hidden=\"true\" className=\"absolute inset-0 size-full\">\n {BRIGHT_STARS.map(({ x, y, sparkle, delay, duration }) => (\n <svg key={`${x}-${y}`} aria-hidden=\"true\" x={x} y={y} overflow=\"visible\">\n <g\n className=\"motion-safe:animate-ambient-star-twinkle\"\n style={{ animationDelay: delay, animationDuration: duration }}\n >\n <circle r={7} fill=\"url(#ambient-starfield-halo)\" />\n {sparkle ? (\n <path\n d={SPARKLE}\n className=\"fill-purple-400 dark:fill-purple-100\"\n fillOpacity={0.4}\n />\n ) : null}\n <circle r={1.1} className=\"fill-brand-500 dark:fill-brand-50\" fillOpacity={0.85} />\n </g>\n </svg>\n ))}\n </svg>\n </div>\n\n {/* Only where motion is welcome: a meteor standing still is a scratch. */}\n <div\n aria-hidden=\"true\"\n className={cn(\n LAYER,\n \"ambient-starfield-meteors inset-0 hidden overflow-hidden motion-safe:block\",\n classNames?.meteors,\n )}\n {...props({ \"data-testid\": testId && `${testId}-meteors` })}\n >\n {METEORS.map(({ x, y, angle, duration, delay }) => (\n // A zero-size anchor turned to the meteor's heading; the streak\n // ends at it, head first, and flies along that heading.\n <span\n key={`${x}-${y}`}\n className=\"absolute size-0\"\n style={{ left: x, top: y, rotate: angle }}\n >\n <span\n className=\"absolute top-0 right-0 h-px w-28 origin-right rounded-full bg-linear-to-r from-transparent to-brand-500/50 opacity-0 motion-safe:animate-ambient-meteor dark:to-white/60\"\n style={{ animationDuration: duration, animationDelay: delay }}\n />\n </span>\n ))}\n </div>\n </>\n)\n","import { cn } from \"../../lib/cn\"\nimport { warnRenamedProp } from \"../../lib/dev-warn\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { Starfield, type StarfieldClassNames } from \"./starfield\"\n\n/**\n * AmbientBackground — a decorative, brand-tinted page background: a soft\n * radial glow plus a fine film-grain noise texture, so a flat page fill reads\n * as a considered surface instead of a plain color.\n *\n * Render it once, as the first child of your root layout (so later content\n * naturally paints over it) — both layers are `position: fixed`, so a single\n * instance covers the whole viewport regardless of scroll position or page\n * height. It renders nothing interactive: `aria-hidden`, `pointer-events-none`,\n * and hidden under `forced-colors` (Windows High Contrast), since a decorative\n * background has no place overriding a user's forced palette.\n *\n * Glow and noise render as two *independent* fixed elements rather than one\n * wrapper containing two children, so either can be toggled/overridden\n * without the other, and neither traps a future blend-mode override inside\n * an isolated stacking context (`position: fixed` always creates one,\n * regardless of z-index — nesting a blended layer inside another `fixed`\n * wrapper would cut off what it can blend against).\n *\n * `withStarfield` adds a third, opt-in layer set: a slowly moving starry sky\n * over soft violet nebulae (dimming dust, breathing bright stars, a rare\n * meteor), seeded so it is identical on every render. It follows the same\n * recipe — separate fixed layers, no shared wrapper — and stills under reduced\n * motion, either the OS setting or `data-motion=\"reduced\"` on `<html>`.\n *\n * The actual glow/noise values are CSS custom properties (`--ambient-glow` /\n * `--ambient-noise`, defined in `theme.css`, brand-tinted and theme-aware via\n * `data-theme`) rather than hardcoded here — override either on `:root` to\n * reskin it without forking this component.\n *\n * Pure Server Component: no state, no client JS.\n *\n * @example\n * ```tsx\n * // app/layout.tsx\n * <body>\n * <AmbientBackground />\n * {children}\n * </body>\n * ```\n */\n/**\n * There is no root element, so `testId` lands on each layer with its part as a\n * suffix: `` `${testId}-glow` `` and `` `${testId}-noise` ``, and with the\n * starfield `` `${testId}-nebula-<n>` ``, `` `${testId}-stars` `` and\n * `` `${testId}-meteors` ``.\n */\nexport type AmbientBackgroundProps = WithTestId & {\n /** Render the radial glow layer. Default `true`. */\n withGlow?: boolean\n /** Render the film-grain noise layer. Default `true`. */\n withNoise?: boolean\n /** Render the starfield over the glow and noise: nebulae, stars and meteors. Default `false`. */\n withStarfield?: boolean\n /** @deprecated Renamed `withGlow`. Removed in the next minor. `withGlow` wins when both are set. */\n glow?: boolean\n /** @deprecated Renamed `withNoise`. Removed in the next minor. `withNoise` wins when both are set. */\n noise?: boolean\n /** Extra classes for each layer. */\n classNames?: StarfieldClassNames & {\n glow?: string\n noise?: string\n }\n}\n\nexport const AmbientBackground = ({\n glow,\n noise,\n withGlow = glow ?? true,\n withNoise = noise ?? true,\n withStarfield = false,\n classNames,\n testId,\n}: AmbientBackgroundProps) => {\n if (glow !== undefined) warnRenamedProp(\"AmbientBackground\", \"glow\", \"withGlow\")\n if (noise !== undefined) warnRenamedProp(\"AmbientBackground\", \"noise\", \"withNoise\")\n return (\n <>\n {withGlow && (\n <div\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none fixed inset-0 -z-10 forced-colors:hidden\",\n classNames?.glow,\n )}\n style={{ backgroundImage: \"var(--ambient-glow)\" }}\n {...props({ \"data-testid\": testId && `${testId}-glow` })}\n />\n )}\n {withNoise && (\n <div\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none fixed inset-0 -z-10 bg-repeat forced-colors:hidden\",\n classNames?.noise,\n )}\n style={{ backgroundImage: \"var(--ambient-noise)\" }}\n {...props({ \"data-testid\": testId && `${testId}-noise` })}\n />\n )}\n {withStarfield && <Starfield classNames={classNames} testId={testId} />}\n </>\n )\n}\n"]}
@@ -0,0 +1,13 @@
1
+ export type StarfieldClassNames = {
2
+ /** Each nebula cloud's layer. */
3
+ nebula?: string;
4
+ /** The layer holding the dust and the brighter stars. */
5
+ stars?: string;
6
+ /** The meteors' layer. */
7
+ meteors?: string;
8
+ };
9
+ export declare const Starfield: ({ classNames, testId, }: {
10
+ classNames?: StarfieldClassNames;
11
+ testId?: string;
12
+ }) => import("react").JSX.Element;
13
+ //# sourceMappingURL=starfield.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"starfield.d.ts","sourceRoot":"","sources":["../../../src/components/ambient-background/starfield.tsx"],"names":[],"mappings":"AAmMA,MAAM,MAAM,mBAAmB,GAAG;IAChC,iCAAiC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,0BAA0B;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,SAAS,4BAGnB;IACD,UAAU,CAAC,EAAE,mBAAmB,CAAA;IAChC,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,gCAwHA,CAAA"}
package/dist/theme.css CHANGED
@@ -1420,6 +1420,81 @@ body {
1420
1420
  --ambient-noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.4' numOctaves='2' stitchTiles='stitch' result='t'/%3E%3CfeColorMatrix in='t' type='matrix' values='0 0 0 0 0.573 0 0 0 0 0.69 0 0 0 0 0.98 0 0 0 1 0' result='c'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='gamma' amplitude='0.09' exponent='2' offset='0'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
1421
1421
  }
1422
1422
 
1423
+ /* The starfield's motion (`withStarfield`, see ambient-background/starfield.tsx).
1424
+ Every animated piece sets its own delay and duration inline, so these are
1425
+ just the shapes; the utilities are applied behind `motion-safe:`. */
1426
+ @theme static {
1427
+ /* The brighter stars breathe, slowly and out of step. Dimming, never
1428
+ vanishing: a star that blinks out reads as a glitch, not a twinkle. */
1429
+ --animate-ambient-star-twinkle: ambient-star-twinkle 8s ease-in-out infinite;
1430
+ /* The dust dims the same way, deeper and slower, one group per layer. */
1431
+ --animate-ambient-star-dim: ambient-star-dim 17s ease-in-out infinite;
1432
+ /* The nebula's clouds swing slowly away and back, each by its own drift
1433
+ (`--drift-*`, set per cloud): moved, swollen a little and thinned out at
1434
+ the far end, eased at both. */
1435
+ --animate-ambient-nebula-drift: ambient-nebula-drift 90s ease-in-out infinite alternate;
1436
+ /* A meteor's whole cycle is mostly waiting: it streaks across in the first
1437
+ 2% (about a second of its long cycle), its tail growing behind the head
1438
+ as it fades in and burning out before it stops, then nothing until the
1439
+ next pass. Linear, because a meteor doesn't ease. */
1440
+ --animate-ambient-meteor: ambient-meteor 40s linear infinite;
1441
+ }
1442
+
1443
+ @keyframes ambient-star-twinkle {
1444
+ 0%,
1445
+ 100% {
1446
+ opacity: 1;
1447
+ }
1448
+ 50% {
1449
+ opacity: 0.5;
1450
+ }
1451
+ }
1452
+
1453
+ @keyframes ambient-star-dim {
1454
+ 0%,
1455
+ 100% {
1456
+ opacity: 1;
1457
+ }
1458
+ 50% {
1459
+ opacity: 0.35;
1460
+ }
1461
+ }
1462
+
1463
+ @keyframes ambient-nebula-drift {
1464
+ to {
1465
+ transform: translate3d(var(--drift-x), var(--drift-y), 0) scale(var(--drift-scale));
1466
+ opacity: var(--drift-fade);
1467
+ }
1468
+ }
1469
+
1470
+ @keyframes ambient-meteor {
1471
+ 0% {
1472
+ opacity: 0;
1473
+ transform: translateX(0) scaleX(0.2);
1474
+ }
1475
+ 0.5% {
1476
+ opacity: 1;
1477
+ }
1478
+ 2%,
1479
+ 100% {
1480
+ opacity: 0;
1481
+ transform: translateX(18rem) scaleX(1);
1482
+ }
1483
+ }
1484
+
1485
+ /* `motion-safe:` reads only the OS setting; apps that let people choose
1486
+ in-app set `data-motion="reduced"` on `<html>`, and the sky stills for that
1487
+ too: no drift, no dimming, no meteors. */
1488
+ :where(:root[data-motion="reduced"]) {
1489
+ .ambient-starfield,
1490
+ .ambient-starfield * {
1491
+ animation: none;
1492
+ }
1493
+ .ambient-starfield-meteors {
1494
+ display: none;
1495
+ }
1496
+ }
1497
+
1423
1498
  /* `Tabs`: a trigger whose list's indicator is still `hidden` — the server
1424
1499
  render, and the client until Ark has measured the selected trigger (Ark
1425
1500
  clears `hidden` and sets the rect in the same render). The selected trigger
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@42-central/ui-react",
3
- "version": "0.23.0",
3
+ "version": "0.24.0",
4
4
  "description": "React UI kit for 42 tools",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -75,4 +75,63 @@ describe("AmbientBackground", () => {
75
75
  // biome-ignore lint/style/noNonNullAssertion: exactly 2 children are rendered above
76
76
  expect(noiseEl!.className).toContain("noise-class")
77
77
  })
78
+ describe("withStarfield", () => {
79
+ it("is off by default", () => {
80
+ const { container } = render(<AmbientBackground />)
81
+ expect(container.querySelector(".ambient-starfield")).toBeNull()
82
+ })
83
+
84
+ it("adds its layers after glow and noise, each fixed at the top level, decorative and out of a forced palette", () => {
85
+ const { container } = render(<AmbientBackground withStarfield />)
86
+ const layers = Array.from(container.children) as HTMLElement[]
87
+ // glow, noise, five nebula clouds, the stars, the meteors
88
+ expect(layers).toHaveLength(9)
89
+ expect(layers[0]?.style.backgroundImage).toBe("var(--ambient-glow)")
90
+ expect(layers[1]?.style.backgroundImage).toBe("var(--ambient-noise)")
91
+ for (const el of layers.slice(2)) {
92
+ expect(el.className).toContain("ambient-starfield")
93
+ expect(el.getAttribute("aria-hidden")).toBe("true")
94
+ expect(el.className).toContain("pointer-events-none")
95
+ expect(el.className).toContain("forced-colors:hidden")
96
+ expect(el.className).toContain("fixed")
97
+ expect(el.className).not.toContain("absolute")
98
+ }
99
+ })
100
+
101
+ it("animates only behind motion-safe, and keeps the meteors hidden without it", () => {
102
+ const { container } = render(
103
+ <AmbientBackground withStarfield withGlow={false} withNoise={false} />,
104
+ )
105
+ const animated = container.querySelectorAll('[class*="animate-ambient-"]')
106
+ expect(animated.length).toBeGreaterThan(0)
107
+ for (const el of Array.from(animated)) {
108
+ for (const cls of Array.from(el.classList).filter((c) => c.includes("animate-"))) {
109
+ expect(cls.startsWith("motion-safe:")).toBe(true)
110
+ }
111
+ }
112
+ const meteors = container.querySelector(".ambient-starfield-meteors")
113
+ expect(meteors?.classList).toContain("hidden")
114
+ expect(meteors?.classList).toContain("motion-safe:block")
115
+ })
116
+
117
+ it("draws the same sky on every render", () => {
118
+ const a = render(<AmbientBackground withStarfield />).container.innerHTML
119
+ const b = render(<AmbientBackground withStarfield />).container.innerHTML
120
+ expect(a).toBe(b)
121
+ })
122
+
123
+ it("suffixes testId per starfield layer and merges their classNames", () => {
124
+ const { getByTestId, getAllByTestId } = render(
125
+ <AmbientBackground
126
+ withStarfield
127
+ testId="bg"
128
+ classNames={{ nebula: "n", stars: "s", meteors: "m" }}
129
+ />,
130
+ )
131
+ expect(getByTestId("bg-nebula-0").className).toContain("n")
132
+ expect(getByTestId("bg-stars").className).toContain("s")
133
+ expect(getByTestId("bg-meteors").className).toContain("m")
134
+ expect(getAllByTestId(/^bg-nebula-/)).toHaveLength(5)
135
+ })
136
+ })
78
137
  })
@@ -2,6 +2,7 @@ import { cn } from "../../lib/cn"
2
2
  import { warnRenamedProp } from "../../lib/dev-warn"
3
3
  import { props } from "../../lib/props"
4
4
  import type { WithTestId } from "../../lib/test-id"
5
+ import { Starfield, type StarfieldClassNames } from "./starfield"
5
6
 
6
7
  /**
7
8
  * AmbientBackground — a decorative, brand-tinted page background: a soft
@@ -22,6 +23,12 @@ import type { WithTestId } from "../../lib/test-id"
22
23
  * regardless of z-index — nesting a blended layer inside another `fixed`
23
24
  * wrapper would cut off what it can blend against).
24
25
  *
26
+ * `withStarfield` adds a third, opt-in layer set: a slowly moving starry sky
27
+ * over soft violet nebulae (dimming dust, breathing bright stars, a rare
28
+ * meteor), seeded so it is identical on every render. It follows the same
29
+ * recipe — separate fixed layers, no shared wrapper — and stills under reduced
30
+ * motion, either the OS setting or `data-motion="reduced"` on `<html>`.
31
+ *
25
32
  * The actual glow/noise values are CSS custom properties (`--ambient-glow` /
26
33
  * `--ambient-noise`, defined in `theme.css`, brand-tinted and theme-aware via
27
34
  * `data-theme`) rather than hardcoded here — override either on `:root` to
@@ -40,19 +47,23 @@ import type { WithTestId } from "../../lib/test-id"
40
47
  */
41
48
  /**
42
49
  * There is no root element, so `testId` lands on each layer with its part as a
43
- * suffix: `` `${testId}-glow` `` and `` `${testId}-noise` ``.
50
+ * suffix: `` `${testId}-glow` `` and `` `${testId}-noise` ``, and with the
51
+ * starfield `` `${testId}-nebula-<n>` ``, `` `${testId}-stars` `` and
52
+ * `` `${testId}-meteors` ``.
44
53
  */
45
54
  export type AmbientBackgroundProps = WithTestId & {
46
55
  /** Render the radial glow layer. Default `true`. */
47
56
  withGlow?: boolean
48
57
  /** Render the film-grain noise layer. Default `true`. */
49
58
  withNoise?: boolean
59
+ /** Render the starfield over the glow and noise: nebulae, stars and meteors. Default `false`. */
60
+ withStarfield?: boolean
50
61
  /** @deprecated Renamed `withGlow`. Removed in the next minor. `withGlow` wins when both are set. */
51
62
  glow?: boolean
52
63
  /** @deprecated Renamed `withNoise`. Removed in the next minor. `withNoise` wins when both are set. */
53
64
  noise?: boolean
54
65
  /** Extra classes for each layer. */
55
- classNames?: {
66
+ classNames?: StarfieldClassNames & {
56
67
  glow?: string
57
68
  noise?: string
58
69
  }
@@ -63,6 +74,7 @@ export const AmbientBackground = ({
63
74
  noise,
64
75
  withGlow = glow ?? true,
65
76
  withNoise = noise ?? true,
77
+ withStarfield = false,
66
78
  classNames,
67
79
  testId,
68
80
  }: AmbientBackgroundProps) => {
@@ -92,6 +104,7 @@ export const AmbientBackground = ({
92
104
  {...props({ "data-testid": testId && `${testId}-noise` })}
93
105
  />
94
106
  )}
107
+ {withStarfield && <Starfield classNames={classNames} testId={testId} />}
95
108
  </>
96
109
  )
97
110
  }
@@ -0,0 +1,331 @@
1
+ import type { CSSProperties } from "react"
2
+ import { cn } from "../../lib/cn"
3
+ import { props } from "../../lib/props"
4
+
5
+ // The starfield AmbientBackground draws with `withStarfield`: a starry sky over
6
+ // soft violet nebulae, stacked on the glow and noise (the noise is what
7
+ // dithers these gradients so they never band). Every layer takes the same
8
+ // recipe as glow and noise (fixed, -z-10, no shared wrapper) and paints over
9
+ // them, still under every piece of the app.
10
+ //
11
+ // Everything is computed once at module load from a seeded PRNG, so the sky
12
+ // is identical on every render, on the server and the client, and on every
13
+ // visit. It moves, slowly: the clouds drift and swell, the dust dims and comes
14
+ // back, the brighter stars breathe, and now and then a meteor crosses. All of
15
+ // it is CSS animation of transform and opacity (keyframes in theme.css), so
16
+ // the compositor runs it and no script does per frame; and all of it sits
17
+ // behind `motion-safe:` and the `data-motion="reduced"` rule in theme.css, so
18
+ // with reduced motion the sky is a still picture, without the meteors.
19
+
20
+ // mulberry32: tiny, fast, and good enough to scatter dots.
21
+ const prng = (seed: number) => () => {
22
+ seed = (seed + 0x6d2b79f5) | 0
23
+ let t = Math.imul(seed ^ (seed >>> 15), 1 | seed)
24
+ t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t
25
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296
26
+ }
27
+
28
+ const round = (n: number) => Math.round(n * 100) / 100
29
+
30
+ type Star = { x: number; y: number; r: number; opacity: number }
31
+
32
+ // Most stars are a cool white; a few lean violet or pink, as in the design.
33
+ // On a light sky the same hues go dark, so the dots read as ink, not glare.
34
+ const TONES = [
35
+ "fill-brand-500 dark:fill-brand-100",
36
+ "fill-purple-500 dark:fill-purple-200",
37
+ "fill-pink-500 dark:fill-pink-200",
38
+ ] as const
39
+
40
+ type Tone = (typeof TONES)[number]
41
+
42
+ const pickTone = (n: number): Tone => (n < 0.78 ? TONES[0] : n < 0.95 ? TONES[1] : TONES[2])
43
+
44
+ // The dust dims in a few groups, each on its own slow beat, so at any moment
45
+ // some stars are fading and others coming back. A group is a whole layer
46
+ // fading (cheap: the compositor does it), and its stars are scattered all
47
+ // over, so it reads as single stars dimming, not as a region pulsing. The
48
+ // beats share no common factor, so the groups never line up into one blink.
49
+ const DIM_BEATS = [
50
+ { duration: "11s", delay: "-3s" },
51
+ { duration: "17s", delay: "-11s" },
52
+ { duration: "23s", delay: "-7s" },
53
+ ] as const
54
+
55
+ // Dots for one repeating tile, by dimming group, then by tone so each tone
56
+ // is one <g>.
57
+ const scatter = (seed: number, size: number, count: number) => {
58
+ const random = prng(seed)
59
+ // Its own sequence, so sorting the dots into groups doesn't move them.
60
+ const group = prng(seed + 1)
61
+ const phases = DIM_BEATS.map(() => new Map<Tone, Star[]>(TONES.map((tone) => [tone, []])))
62
+ for (let i = 0; i < count; i++) {
63
+ // Skewed towards the faintest, smallest dots: a real sky is mostly dust.
64
+ const weight = random() ** 2.4
65
+ const star = {
66
+ // Kept off the tile's edge so no dot is cut in half where tiles meet.
67
+ x: round(2 + random() * (size - 4)),
68
+ y: round(2 + random() * (size - 4)),
69
+ r: round(0.4 + weight * 0.75),
70
+ opacity: round(0.22 + weight * 0.4 + random() * 0.1),
71
+ }
72
+ phases[Math.floor(group() * phases.length)]?.get(pickTone(random()))?.push(star)
73
+ }
74
+ return { size, phases: phases.map((phase) => [...phase]) }
75
+ }
76
+
77
+ // Two tiles of coprime-ish sizes overlap into a pattern that only repeats
78
+ // every few thousand pixels, so the eye never catches the tiling. Fixed pixel
79
+ // tiles (not a scaled viewBox) keep the same density on a phone and a wide
80
+ // screen. Together about one dot per 6000px², the design's own density.
81
+ const TILES = [scatter(42, 509, 26), scatter(1337, 733, 38)]
82
+
83
+ // The few brighter stars, placed by viewport percentage so they spread over
84
+ // any screen. A soft halo rather than a hard disc; the three with `sparkle`
85
+ // carry the design's diffraction spikes, kept thin and short.
86
+ const BRIGHT_STARS = [
87
+ { x: "8%", y: "14%", sparkle: true, delay: "0s", duration: "7s" },
88
+ { x: "31%", y: "6%", sparkle: false, delay: "-2s", duration: "9s" },
89
+ { x: "62%", y: "11%", sparkle: false, delay: "-5s", duration: "8s" },
90
+ { x: "88%", y: "22%", sparkle: true, delay: "-3s", duration: "10s" },
91
+ { x: "18%", y: "58%", sparkle: false, delay: "-6s", duration: "8s" },
92
+ { x: "47%", y: "41%", sparkle: false, delay: "-1s", duration: "11s" },
93
+ { x: "76%", y: "63%", sparkle: true, delay: "-4s", duration: "9s" },
94
+ { x: "36%", y: "86%", sparkle: false, delay: "-7s", duration: "10s" },
95
+ { x: "93%", y: "90%", sparkle: false, delay: "-2.5s", duration: "7s" },
96
+ ] as const
97
+
98
+ // A four-point sparkle with concave sides: reads as a lens glint, not a shape.
99
+ const SPARKLE = "M0 -6Q0 0 6 0Q0 0 0 6Q0 0 -6 0Q0 0 0 -6Z"
100
+
101
+ // Each cloud's layer overhangs the viewport by this much on every side, so a
102
+ // cloud cut by the screen's edge (several are) can drift without the cut
103
+ // ever coming into view.
104
+ const BLEED = 15
105
+ const SPAN = 100 + 2 * BLEED
106
+
107
+ // A length or a position given in viewport %, as % of the overhanging layer.
108
+ const inLayer = (viewport: number, offset = 0) => `${round(((viewport + offset) / SPAN) * 100)}%`
109
+
110
+ type Ellipse = { rx: number; ry: number; x: number; y: number }
111
+ type Hue = { color: string; strength: number }
112
+
113
+ // Violet and indigo clouds after the design's "Nébuleuse", softened: wide
114
+ // ellipses that fade out over their whole radius so no edge ever shows. The
115
+ // design's blue core is already the kit's ambient glow; this adds the purple.
116
+ const cloud = ({ rx, ry, x, y }: Ellipse, { color, strength }: Hue) =>
117
+ `radial-gradient(ellipse ${inLayer(rx)} ${inLayer(ry)} at ${inLayer(x, BLEED)} ${inLayer(y, BLEED)}, color-mix(in oklab, var(${color}) ${strength}%, transparent), color-mix(in oklab, var(${color}) ${strength * 0.45}%, transparent) 45%, transparent 100%)`
118
+
119
+ // Each cloud drifts on its own long, slow swing (there and back, eased at
120
+ // both ends), swelling a little and thinning as it goes: a few px a second,
121
+ // so the sky is never seen moving, only found changed. On a light sky the
122
+ // same clouds are pale tints, so the light theme keeps the violet without
123
+ // muddying the page.
124
+ const CLOUDS: {
125
+ at: Ellipse
126
+ dark: Hue
127
+ light: Hue
128
+ drift: { x: string; y: string; scale: number; fade: number; duration: string; delay: string }
129
+ }[] = [
130
+ {
131
+ at: { rx: 42, ry: 34, x: 30, y: 64 },
132
+ dark: { color: "--color-purple-400", strength: 9 },
133
+ light: { color: "--color-purple-200", strength: 14 },
134
+ drift: { x: "6vw", y: "-4vh", scale: 1.12, fade: 0.7, duration: "70s", delay: "-20s" },
135
+ },
136
+ {
137
+ at: { rx: 60, ry: 38, x: 42, y: 104 },
138
+ dark: { color: "--color-purple-800", strength: 20 },
139
+ light: { color: "--color-purple-200", strength: 26 },
140
+ drift: { x: "-8vw", y: "-3vh", scale: 1.08, fade: 0.85, duration: "95s", delay: "-50s" },
141
+ },
142
+ {
143
+ at: { rx: 40, ry: 34, x: 92, y: 4 },
144
+ dark: { color: "--color-purple-800", strength: 22 },
145
+ light: { color: "--color-purple-200", strength: 28 },
146
+ drift: { x: "-5vw", y: "5vh", scale: 1.15, fade: 0.8, duration: "85s", delay: "-10s" },
147
+ },
148
+ {
149
+ at: { rx: 46, ry: 40, x: 24, y: 20 },
150
+ dark: { color: "--color-brand-700", strength: 18 },
151
+ light: { color: "--color-brand-200", strength: 24 },
152
+ drift: { x: "7vw", y: "4vh", scale: 1.1, fade: 0.85, duration: "110s", delay: "-70s" },
153
+ },
154
+ {
155
+ at: { rx: 36, ry: 30, x: 4, y: 92 },
156
+ dark: { color: "--color-pink-800", strength: 10 },
157
+ light: { color: "--color-pink-200", strength: 16 },
158
+ drift: { x: "5vw", y: "-6vh", scale: 1.2, fade: 0.6, duration: "75s", delay: "-35s" },
159
+ },
160
+ ]
161
+
162
+ // The cloud's picture per theme and its drift, as variables the classes and
163
+ // the ambient-nebula-drift keyframes (theme.css) read.
164
+ const cloudStyle = ({ at, dark, light, drift }: (typeof CLOUDS)[number]) =>
165
+ ({
166
+ "--nebula-light": cloud(at, light),
167
+ "--nebula-dark": cloud(at, dark),
168
+ "--drift-x": drift.x,
169
+ "--drift-y": drift.y,
170
+ "--drift-scale": drift.scale,
171
+ "--drift-fade": drift.fade,
172
+ inset: `-${BLEED}%`,
173
+ animationDuration: drift.duration,
174
+ animationDelay: drift.delay,
175
+ }) as CSSProperties
176
+
177
+ // The meteors: three, each on its own long cycle and visible for about a
178
+ // second of it, so one crosses every twenty seconds or so, never on arrival
179
+ // and almost never two at once. Thin, short and faint, high in the sky,
180
+ // falling down and to the left. Seen from the corner of the eye, not watched.
181
+ const METEORS = [
182
+ { x: "72%", y: "8%", angle: "152deg", duration: "37s", delay: "9s" },
183
+ { x: "50%", y: "20%", angle: "160deg", duration: "53s", delay: "24s" },
184
+ { x: "92%", y: "30%", angle: "148deg", duration: "71s", delay: "41s" },
185
+ ] as const
186
+
187
+ // The halo's stops, per theme: a gradient stop takes no `dark:` class.
188
+ const HALO_THEME =
189
+ "[--star-halo-core:var(--color-brand-400)] [--star-halo-rim:var(--color-purple-400)] dark:[--star-halo-core:var(--color-brand-100)] dark:[--star-halo-rim:var(--color-purple-300)]"
190
+
191
+ // Every layer's recipe: decorative, out of the pointer's way and out of a
192
+ // forced palette's. `ambient-starfield` is the hook theme.css's
193
+ // `data-motion="reduced"` rule stills it by.
194
+ const LAYER = "ambient-starfield pointer-events-none fixed -z-10 forced-colors:hidden"
195
+
196
+ export type StarfieldClassNames = {
197
+ /** Each nebula cloud's layer. */
198
+ nebula?: string
199
+ /** The layer holding the dust and the brighter stars. */
200
+ stars?: string
201
+ /** The meteors' layer. */
202
+ meteors?: string
203
+ }
204
+
205
+ export const Starfield = ({
206
+ classNames,
207
+ testId,
208
+ }: {
209
+ classNames?: StarfieldClassNames
210
+ testId?: string
211
+ }) => (
212
+ <>
213
+ {CLOUDS.map((c, i) => (
214
+ <div
215
+ key={`${c.at.x}-${c.at.y}`}
216
+ aria-hidden="true"
217
+ className={cn(
218
+ LAYER,
219
+ "[background-image:var(--nebula-light)] motion-safe:animate-ambient-nebula-drift dark:[background-image:var(--nebula-dark)]",
220
+ classNames?.nebula,
221
+ )}
222
+ style={cloudStyle(c)}
223
+ {...props({ "data-testid": testId && `${testId}-nebula-${i}` })}
224
+ />
225
+ ))}
226
+
227
+ {/* Fainter on a light sky: dark dots at the dark sky's strength read
228
+ as specks rather than dust. Set on the wrapper, because the layers
229
+ inside animate their own opacity. */}
230
+ <div
231
+ aria-hidden="true"
232
+ className={cn(LAYER, "inset-0 opacity-70 dark:opacity-100", HALO_THEME, classNames?.stars)}
233
+ {...props({ "data-testid": testId && `${testId}-stars` })}
234
+ >
235
+ <svg aria-hidden="true" className="absolute size-0">
236
+ <defs>
237
+ {TILES.flatMap(({ size, phases }, i) =>
238
+ phases.map((groups, phase) => (
239
+ <pattern
240
+ // biome-ignore lint/suspicious/noArrayIndexKey: a static, never-reordered list
241
+ key={`${i}-${phase}`}
242
+ id={`ambient-starfield-tile-${i}-${phase}`}
243
+ width={size}
244
+ height={size}
245
+ patternUnits="userSpaceOnUse"
246
+ >
247
+ {groups.map(([tone, stars]) => (
248
+ <g key={tone} className={tone}>
249
+ {stars.map(({ x, y, r, opacity }) => (
250
+ <circle key={`${x}-${y}`} cx={x} cy={y} r={r} fillOpacity={opacity} />
251
+ ))}
252
+ </g>
253
+ ))}
254
+ </pattern>
255
+ )),
256
+ )}
257
+ <radialGradient id="ambient-starfield-halo">
258
+ <stop offset="0%" style={{ stopColor: "var(--star-halo-core)" }} stopOpacity={0.32} />
259
+ <stop offset="35%" style={{ stopColor: "var(--star-halo-rim)" }} stopOpacity={0.1} />
260
+ <stop offset="100%" style={{ stopColor: "var(--star-halo-rim)" }} stopOpacity={0} />
261
+ </radialGradient>
262
+ </defs>
263
+ </svg>
264
+
265
+ {DIM_BEATS.map(({ duration, delay }, phase) => (
266
+ <svg
267
+ key={duration}
268
+ aria-hidden="true"
269
+ className="absolute inset-0 size-full motion-safe:animate-ambient-star-dim"
270
+ style={{ animationDuration: duration, animationDelay: delay }}
271
+ >
272
+ {TILES.map(({ size }, i) => (
273
+ <rect
274
+ key={size}
275
+ width="100%"
276
+ height="100%"
277
+ fill={`url(#ambient-starfield-tile-${i}-${phase})`}
278
+ />
279
+ ))}
280
+ </svg>
281
+ ))}
282
+
283
+ <svg aria-hidden="true" className="absolute inset-0 size-full">
284
+ {BRIGHT_STARS.map(({ x, y, sparkle, delay, duration }) => (
285
+ <svg key={`${x}-${y}`} aria-hidden="true" x={x} y={y} overflow="visible">
286
+ <g
287
+ className="motion-safe:animate-ambient-star-twinkle"
288
+ style={{ animationDelay: delay, animationDuration: duration }}
289
+ >
290
+ <circle r={7} fill="url(#ambient-starfield-halo)" />
291
+ {sparkle ? (
292
+ <path
293
+ d={SPARKLE}
294
+ className="fill-purple-400 dark:fill-purple-100"
295
+ fillOpacity={0.4}
296
+ />
297
+ ) : null}
298
+ <circle r={1.1} className="fill-brand-500 dark:fill-brand-50" fillOpacity={0.85} />
299
+ </g>
300
+ </svg>
301
+ ))}
302
+ </svg>
303
+ </div>
304
+
305
+ {/* Only where motion is welcome: a meteor standing still is a scratch. */}
306
+ <div
307
+ aria-hidden="true"
308
+ className={cn(
309
+ LAYER,
310
+ "ambient-starfield-meteors inset-0 hidden overflow-hidden motion-safe:block",
311
+ classNames?.meteors,
312
+ )}
313
+ {...props({ "data-testid": testId && `${testId}-meteors` })}
314
+ >
315
+ {METEORS.map(({ x, y, angle, duration, delay }) => (
316
+ // A zero-size anchor turned to the meteor's heading; the streak
317
+ // ends at it, head first, and flies along that heading.
318
+ <span
319
+ key={`${x}-${y}`}
320
+ className="absolute size-0"
321
+ style={{ left: x, top: y, rotate: angle }}
322
+ >
323
+ <span
324
+ className="absolute top-0 right-0 h-px w-28 origin-right rounded-full bg-linear-to-r from-transparent to-brand-500/50 opacity-0 motion-safe:animate-ambient-meteor dark:to-white/60"
325
+ style={{ animationDuration: duration, animationDelay: delay }}
326
+ />
327
+ </span>
328
+ ))}
329
+ </div>
330
+ </>
331
+ )
@@ -28,6 +28,8 @@ const sources = readdirSync(componentsDir, { recursive: true, encoding: "utf8" }
28
28
  */
29
29
  const NOT_ICONS: Record<string, string> = {
30
30
  "avatar/avatar.tsx": "the group's notch mask, never painted",
31
+ "ambient-background/starfield.tsx":
32
+ "a background illustration: filled dots and glints, no stroke",
31
33
  "circular-progress/circular-progress.tsx": "a progress ring, its width is the `thickness` prop",
32
34
  "geodesic/badge-frame.tsx":
33
35
  "an illustration: wires drawn in viewBox units, scaling with the badge",
package/src/theme.css CHANGED
@@ -1420,6 +1420,81 @@ body {
1420
1420
  --ambient-noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.4' numOctaves='2' stitchTiles='stitch' result='t'/%3E%3CfeColorMatrix in='t' type='matrix' values='0 0 0 0 0.573 0 0 0 0 0.69 0 0 0 0 0.98 0 0 0 1 0' result='c'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='gamma' amplitude='0.09' exponent='2' offset='0'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
1421
1421
  }
1422
1422
 
1423
+ /* The starfield's motion (`withStarfield`, see ambient-background/starfield.tsx).
1424
+ Every animated piece sets its own delay and duration inline, so these are
1425
+ just the shapes; the utilities are applied behind `motion-safe:`. */
1426
+ @theme static {
1427
+ /* The brighter stars breathe, slowly and out of step. Dimming, never
1428
+ vanishing: a star that blinks out reads as a glitch, not a twinkle. */
1429
+ --animate-ambient-star-twinkle: ambient-star-twinkle 8s ease-in-out infinite;
1430
+ /* The dust dims the same way, deeper and slower, one group per layer. */
1431
+ --animate-ambient-star-dim: ambient-star-dim 17s ease-in-out infinite;
1432
+ /* The nebula's clouds swing slowly away and back, each by its own drift
1433
+ (`--drift-*`, set per cloud): moved, swollen a little and thinned out at
1434
+ the far end, eased at both. */
1435
+ --animate-ambient-nebula-drift: ambient-nebula-drift 90s ease-in-out infinite alternate;
1436
+ /* A meteor's whole cycle is mostly waiting: it streaks across in the first
1437
+ 2% (about a second of its long cycle), its tail growing behind the head
1438
+ as it fades in and burning out before it stops, then nothing until the
1439
+ next pass. Linear, because a meteor doesn't ease. */
1440
+ --animate-ambient-meteor: ambient-meteor 40s linear infinite;
1441
+ }
1442
+
1443
+ @keyframes ambient-star-twinkle {
1444
+ 0%,
1445
+ 100% {
1446
+ opacity: 1;
1447
+ }
1448
+ 50% {
1449
+ opacity: 0.5;
1450
+ }
1451
+ }
1452
+
1453
+ @keyframes ambient-star-dim {
1454
+ 0%,
1455
+ 100% {
1456
+ opacity: 1;
1457
+ }
1458
+ 50% {
1459
+ opacity: 0.35;
1460
+ }
1461
+ }
1462
+
1463
+ @keyframes ambient-nebula-drift {
1464
+ to {
1465
+ transform: translate3d(var(--drift-x), var(--drift-y), 0) scale(var(--drift-scale));
1466
+ opacity: var(--drift-fade);
1467
+ }
1468
+ }
1469
+
1470
+ @keyframes ambient-meteor {
1471
+ 0% {
1472
+ opacity: 0;
1473
+ transform: translateX(0) scaleX(0.2);
1474
+ }
1475
+ 0.5% {
1476
+ opacity: 1;
1477
+ }
1478
+ 2%,
1479
+ 100% {
1480
+ opacity: 0;
1481
+ transform: translateX(18rem) scaleX(1);
1482
+ }
1483
+ }
1484
+
1485
+ /* `motion-safe:` reads only the OS setting; apps that let people choose
1486
+ in-app set `data-motion="reduced"` on `<html>`, and the sky stills for that
1487
+ too: no drift, no dimming, no meteors. */
1488
+ :where(:root[data-motion="reduced"]) {
1489
+ .ambient-starfield,
1490
+ .ambient-starfield * {
1491
+ animation: none;
1492
+ }
1493
+ .ambient-starfield-meteors {
1494
+ display: none;
1495
+ }
1496
+ }
1497
+
1423
1498
  /* `Tabs`: a trigger whose list's indicator is still `hidden` — the server
1424
1499
  render, and the client until Ark has measured the selected trigger (Ark
1425
1500
  clears `hidden` and sets the rect in the same render). The selected trigger
package/src/theme.test.ts CHANGED
@@ -13,8 +13,16 @@ const themeCss = readFileSync(join(import.meta.dirname, "theme.css"), "utf8")
13
13
  * (e.g. Rating's `data-checked:animate-rating-pop
14
14
  * motion-reduce:data-checked:animate-none`) — a one-shot, non-`data-state`
15
15
  * animation with no separate entrance/exit pair to coordinate globally, so
16
- * there's nothing the shared override would add. */
17
- const EXEMPT_FROM_GLOBAL_OVERRIDE = new Set(["rating-pop"])
16
+ * there's nothing the shared override would add. The AmbientBackground
17
+ * starfield's loops are the same case from the other side: only ever applied
18
+ * behind `motion-safe:`, so under reduced motion they never start. */
19
+ const EXEMPT_FROM_GLOBAL_OVERRIDE = new Set([
20
+ "rating-pop",
21
+ "ambient-star-twinkle",
22
+ "ambient-star-dim",
23
+ "ambient-nebula-drift",
24
+ "ambient-meteor",
25
+ ])
18
26
 
19
27
  /** Every `--animate-*` custom property registered in a `@theme` block — the
20
28
  * kit's full set of entrance/exit + looping keyframe animations. Pulled from