rift-ds 1.25.0 → 1.27.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.
Files changed (61) hide show
  1. package/README.md +3 -1
  2. package/bin/templates/app/components/rift/font.css +7 -4
  3. package/chat/ChatThreads.d.ts +3 -1
  4. package/chat/ChatThreads.js +3 -1
  5. package/chat/ChatWidget.css +166 -15
  6. package/chat/ChatWidget.d.ts +1 -1
  7. package/chat/ChatWidget.js +5 -2
  8. package/components/ActionCard/ActionCard.d.ts +1 -1
  9. package/components/ContextMenu/ContextMenu.css +11 -0
  10. package/components/ContextMenu/ContextMenu.d.ts +1 -1
  11. package/components/ContextMenu/ContextMenu.js +3 -1
  12. package/components/DataTable/DataTable.css +24 -4
  13. package/components/DataTable/DataTable.js +41 -40
  14. package/components/DropdownMenu/DropdownMenu.css +38 -0
  15. package/components/DropdownMenu/DropdownMenu.d.ts +4 -0
  16. package/components/DropdownMenu/DropdownMenu.js +11 -5
  17. package/components/DropdownMenu/ShortcutHint.d.ts +9 -0
  18. package/components/DropdownMenu/ShortcutHint.js +6 -0
  19. package/components/InterruptCard/InterruptCard.d.ts +1 -1
  20. package/components/MegaMenu/MegaMenu.css +5 -3
  21. package/components/MegaMenu/MegaMenu.d.ts +4 -1
  22. package/components/MegaMenu/MegaMenu.js +34 -20
  23. package/components/MessageCard/MessageCard.css +17 -6
  24. package/components/MessageCard/MessageCard.d.ts +1 -1
  25. package/components/ShaderScene/ShaderScene.css +11 -3
  26. package/components/ShaderScene/ShaderScene.d.ts +14 -12
  27. package/components/ShaderScene/ShaderScene.js +33 -10
  28. package/components/ShaderScene/assemble.js +2 -0
  29. package/components/ShaderScene/renderer.d.ts +5 -1
  30. package/components/ShaderScene/renderer.js +46 -1
  31. package/components/ShaderScene/scenes.d.ts +57 -1
  32. package/components/ShaderScene/scenes.js +590 -8
  33. package/components/ShaderScene/types.d.ts +13 -0
  34. package/components/ThreadPanel/ThreadPanel.css +29 -0
  35. package/components/ThreadPanel/ThreadPanel.d.ts +2 -0
  36. package/components/ThreadPanel/ThreadPanel.js +13 -2
  37. package/components/registry.json +1 -1
  38. package/components/registry.json.d.ts +1 -1
  39. package/components/registry.json.js +1 -1
  40. package/index.js +2 -1
  41. package/package.json +1 -1
  42. package/tokens/presets/contrast.css +167 -290
  43. package/tokens/presets/coral.css +143 -254
  44. package/tokens/presets/forest.css +180 -310
  45. package/tokens/presets/gold.css +220 -391
  46. package/tokens/presets/marquee.css +150 -253
  47. package/tokens/presets/mono.css +162 -270
  48. package/tokens/presets/pink.css +228 -409
  49. package/tokens/presets/plum.css +228 -367
  50. package/tokens/presets/presets.css +1 -0
  51. package/tokens/presets/terminal.css +170 -301
  52. package/tokens/presets/violet.css +214 -380
  53. package/tokens/presets/warm.css +166 -293
  54. package/tokens/presets/zest.css +191 -335
  55. package/tokens/tokens-dark.css +9 -0
  56. package/tokens/tokens-forced-colors.css +4 -1
  57. package/tokens/tokens-light.css +9 -0
  58. package/tokens/tokens-motion.css +14 -0
  59. package/tokens/tokens-primitives.css +9 -0
  60. package/tokens/tokens-typography.css +9 -0
  61. package/tokens/tokens.css +12 -0
@@ -1,7 +1,7 @@
1
1
  const horizon = {
2
2
  id: "horizon",
3
3
  label: "Horizon",
4
- description: "A planet's limb at night, a fixed sun at the apex, a hazy world and ocean below.",
4
+ description: "A planet's limb at night, a sun on the arc, a hazy world and ocean below.",
5
5
  mode: "dark",
6
6
  /* The background field's roles, the ones a preset tunes for ambient
7
7
  shaders and a DESIGN.md import rewrites from the action colour: in the
@@ -20,7 +20,8 @@ const horizon = {
20
20
  { key: "glow", label: "Glow", min: 0, max: 2, step: 0.01, default: 1 },
21
21
  { key: "clouds", label: "Clouds", min: 0, max: 2, step: 0.01, default: 1 },
22
22
  { key: "ocean", label: "Ocean", min: 0, max: 2.5, step: 0.01, default: 1 },
23
- { key: "beam", label: "Beam", min: 0, max: 2.5, step: 0.01, default: 1 }
23
+ { key: "beam", label: "Beam", min: 0, max: 2.5, step: 0.01, default: 1 },
24
+ { key: "dawn", label: "Sun position", min: -0.5, max: 0.5, step: 0.01, default: 0 }
24
25
  ],
25
26
  glsl: (
26
27
  /* glsl */
@@ -47,10 +48,16 @@ vec3 scene(vec2 uv, float t) {
47
48
  float d = length(wl - centre) - radius;
48
49
 
49
50
  float halfW = 0.5 * aspect;
50
- float sunX = exp(-pow(w.x, 2.0) / (2.0 * 0.28 * 0.28));
51
- float wide = exp(-pow(w.x, 2.0) / (2.0 * 0.75 * 0.75));
51
+ /* The sun sits on the arc over its own place across the stage (the apex
52
+ at 0), and the light along the limb gathers round it. */
53
+ float sx = u_dawn * aspect;
54
+ float reachX = clamp(sx, -radius * 0.98, radius * 0.98);
55
+ float sy = centre.y + sqrt(radius * radius - reachX * reachX);
56
+ float fx = w.x - sx;
57
+ float sunX = exp(-pow(fx, 2.0) / (2.0 * 0.28 * 0.28));
58
+ float wide = exp(-pow(fx, 2.0) / (2.0 * 0.75 * 0.75));
52
59
  float energy = (0.4 + 0.45 * wide + 0.9 * sunX) * u_glow;
53
- float side = clamp(abs(w.x) / halfW, 0.0, 1.0);
60
+ float side = clamp(abs(fx) / halfW, 0.0, 1.0);
54
61
 
55
62
  float curtain = fbm(vec2(w.x * 5.0 + t * 0.05, d * 1.2 - t * 0.02));
56
63
  float band = fbm(vec2(w.x * 1.2 - t * 0.035, d * 11.0 + t * 0.015));
@@ -92,7 +99,7 @@ vec3 scene(vec2 uv, float t) {
92
99
  world += mix(u_rim, amber, 0.4) * cloud * near * 0.6 * energy;
93
100
  world += u_scatter * streaks * 0.08 * reach;
94
101
 
95
- vec2 src = vec2(0.0, crown - 0.005);
102
+ vec2 src = vec2(sx, sy - 0.005);
96
103
  vec2 r = p - src;
97
104
  float ang = atan(r.x, -r.y);
98
105
  float shafts = smoothstep(0.2, 0.95, fbm(vec2(ang * 1.6, 3.7)));
@@ -176,9 +183,584 @@ vec3 scene(vec2 uv, float t) {
176
183
  `
177
184
  )
178
185
  };
179
- const SCENES = [horizon, rift];
186
+ const glyphs = {
187
+ id: "glyphs",
188
+ label: "Glyphs",
189
+ description: "Soft light printed in type: a streak and its blooms read through characters that thicken with the brightness.",
190
+ mode: "dark",
191
+ colours: [
192
+ "--color-ambient-4",
193
+ "--color-ambient-2",
194
+ "--color-ambient-1",
195
+ "--color-ambient-3",
196
+ "--color-ambient-5"
197
+ ],
198
+ glyphs: ".·xxXXSO0#@",
199
+ /* Type at 1x on a 2x screen is soft, and this scene is cheap: six
200
+ Gaussians and two noise lookups a pixel. */
201
+ pixelRatio: 2,
202
+ params: [
203
+ { key: "cell", label: "Type size", min: 6, max: 40, step: 1, default: 15 },
204
+ { key: "ink", label: "Type strength", min: 0, max: 1, step: 0.01, default: 0.42 },
205
+ { key: "density", label: "Density", min: 0.2, max: 4, step: 0.05, default: 1.6 },
206
+ { key: "floor", label: "Floor", min: 0, max: 0.6, step: 0.01, default: 0.06 },
207
+ { key: "scatter", label: "Scatter", min: 0, max: 1.5, step: 0.01, default: 0.55 },
208
+ { key: "shimmer", label: "Shimmer", min: 0, max: 6, step: 0.1, default: 0.75 },
209
+ { key: "exposure", label: "Exposure", min: 0.2, max: 4, step: 0.05, default: 1.25 },
210
+ { key: "spread", label: "Spread", min: 0.3, max: 2.5, step: 0.05, default: 0.85 },
211
+ { key: "warp", label: "Warp", min: 0, max: 2, step: 0.05, default: 0.6 },
212
+ { key: "wave", label: "Wave", min: 0, max: 3, step: 0.05, default: 1 },
213
+ { key: "drift", label: "Drift", min: 0, max: 3, step: 0.05, default: 1.4 },
214
+ { key: "mosaic", label: "Mosaic", min: 0, max: 1, step: 0.01, default: 0 },
215
+ { key: "rise", label: "Height", min: -0.45, max: 0.45, step: 0.01, default: 0 }
216
+ ],
217
+ glsl: (
218
+ /* glsl */
219
+ `
220
+ /* A theme's ambient tones can be muted; pushed from their own grey and up
221
+ to full brightness they still read as hues once they are light. */
222
+ vec3 glyphHue(vec3 c) {
223
+ float grey = (c.r + c.g + c.b) / 3.0;
224
+ c = max(grey + (c - grey) * 1.8, vec3(0.0));
225
+ return c / max(max(c.r, max(c.g, c.b)), 1e-3);
226
+ }
227
+
228
+ /* One stretched Gaussian light: centre in 0 to 1 across and up the stage,
229
+ half extents along and across its own axis in stage heights, a tilt. */
230
+ float glyphLamp(vec2 p, float aspect, vec2 centre, vec2 extent, float tilt, float k, float t) {
231
+ vec2 c = (centre - 0.5) * vec2(aspect, 1.0);
232
+ c += u_drift * 0.05 * vec2(sin(t * 0.13 + k * 1.7), cos(t * 0.11 + k * 2.3));
233
+ float a = tilt + u_drift * 0.06 * sin(t * 0.09 + k * 1.3);
234
+ vec2 d = p - c;
235
+ d = vec2(cos(a) * d.x + sin(a) * d.y, -sin(a) * d.x + cos(a) * d.y) / (extent * u_spread);
236
+ return (1.0 + u_drift * 0.12 * sin(t * 0.21 + k * 2.9)) * exp(-dot(d, d));
237
+ }
238
+
239
+ /* The light at a pixel, tone-mapped. */
240
+ vec3 glyphLight(vec2 frag, float t) {
241
+ float aspect = u_size.x / u_size.y;
242
+ vec2 p = (frag / u_size - 0.5) * vec2(aspect, 1.0);
243
+ p.y -= u_rise;
244
+ p += u_warp * 0.09 * (vec2(vnoise(p * 1.6 + t * 0.05), vnoise(p * 1.6 + 7.3 - t * 0.04)) - 0.5);
245
+ /* Slow travelling swells, so the streak rolls like a ribbon. */
246
+ p.y += u_wave * (0.045 * sin(p.x * 2.6 + t * 0.35) + 0.025 * sin(p.x * 5.3 - t * 0.27 + 1.7));
247
+ p.x += u_wave * 0.03 * sin(p.y * 3.1 + t * 0.22);
248
+
249
+ vec3 haze = glyphHue(u_col[0]);
250
+ vec3 bloom = glyphHue(u_col[1]);
251
+ vec3 streak = glyphHue(u_col[2]);
252
+ vec3 low = glyphHue(u_col[3]);
253
+ vec3 foot = glyphHue(u_col[4]);
254
+ vec3 core = mix((haze + bloom + streak + low + foot) / 5.0, vec3(1.0), 0.85);
255
+
256
+ vec3 c = u_ground;
257
+ c += haze * 0.55 * glyphLamp(p, aspect, vec2(0.47, 0.62), vec2(0.95, 0.3), 0.05, 0.0, t);
258
+ c += bloom * 0.95 * glyphLamp(p, aspect, vec2(0.66, 0.74), vec2(0.5, 0.17), 0.2, 1.0, t);
259
+ c += core * 1.7 * glyphLamp(p, aspect, vec2(0.68, 0.625), vec2(0.3, 0.045), 0.0, 2.0, t);
260
+ c += streak * 1.5 * glyphLamp(p, aspect, vec2(0.3, 0.585), vec2(0.62, 0.011), 0.0, 3.0, t);
261
+ c += low * 1.0 * glyphLamp(p, aspect, vec2(0.8, 0.42), vec2(0.36, 0.2), -0.7, 4.0, t);
262
+ c += foot * 0.75 * glyphLamp(p, aspect, vec2(0.76, 0.2), vec2(0.4, 0.16), -1.1, 5.0, t);
263
+ return u_ground + (1.0 - exp(-(c - u_ground) * u_exposure));
264
+ }
265
+
266
+ vec3 scene(vec2 uv, float t) {
267
+ vec2 frag = uv * u_size;
268
+ float cellH = max(4.0, floor(u_cell * u_ratio + 0.5));
269
+ vec2 size = vec2(cellH * 0.6, cellH);
270
+ vec2 cell = floor(frag / size);
271
+ vec2 local = fract(frag / size);
272
+
273
+ vec3 blocky = glyphLight((cell + 0.5) * size, t);
274
+ vec3 col = mix(glyphLight(frag, t), blocky, u_mosaic);
275
+ /* A mosaic shows its seams. */
276
+ vec2 edge = min(local, 1.0 - local) * size;
277
+ col = mix(col, u_ground, u_mosaic * 0.3 * (1.0 - smoothstep(0.0, 1.5 * u_ratio, min(edge.x, edge.y))));
278
+
279
+ float lum = dot(blocky - u_ground, vec3(0.2126, 0.7152, 0.0722));
280
+ float beat = t * u_shimmer;
281
+ int tick = int(mod(floor(beat), 512.0));
282
+ ivec2 at = ivec2(cell) + 2048;
283
+ float roll = mix(rnd(at + tick * ivec2(17, 31)), rnd(at + (tick + 1) * ivec2(17, 31)),
284
+ smoothstep(0.0, 1.0, fract(beat)));
285
+ float v = (lum - u_floor) / (1.0 - u_floor) * u_density
286
+ + (roll - 0.5) * u_scatter * min(1.0, lum * 6.0 + 0.15);
287
+ float g = max(v, 0.0) * u_glyphCount;
288
+ float first = min(u_glyphCount - 1.0, floor(g));
289
+ float second = min(u_glyphCount - 1.0, first + 1.0);
290
+ float ink = mix(texture(u_glyphs, vec2((first + local.x) / u_glyphCount, local.y)).r,
291
+ texture(u_glyphs, vec2((second + local.x) / u_glyphCount, local.y)).r,
292
+ smoothstep(0.25, 0.75, fract(g)));
293
+ return mix(col, vec3(1.0), ink * u_ink * smoothstep(0.0, 0.1, v) * (0.45 + 0.55 * min(1.0, v)));
294
+ }
295
+ `
296
+ )
297
+ };
298
+ const prism = {
299
+ id: "prism",
300
+ label: "Prism",
301
+ description: "Beams of light from a cut stone, uneven in strength, their edges split into the theme's spectrum.",
302
+ mode: "dark",
303
+ colours: [
304
+ "--color-ambient-5",
305
+ "--color-ambient-6",
306
+ "--color-ambient-1",
307
+ "--color-ambient-2",
308
+ "--color-ambient-4"
309
+ ],
310
+ params: [
311
+ { key: "offset", label: "Position", min: -0.5, max: 0.5, step: 0.01, default: 0.12 },
312
+ { key: "spread", label: "Spread", min: 0, max: 2, step: 0.01, default: 0.6 },
313
+ { key: "tilt", label: "Tilt", min: -1, max: 1, step: 0.01, default: -0.25 },
314
+ { key: "fan", label: "Fan", min: 0, max: 3, step: 0.01, default: 1 },
315
+ { key: "beams", label: "Beams", min: 1, max: 10, step: 1, default: 7 },
316
+ { key: "sharp", label: "Sharpness", min: 0, max: 1, step: 0.01, default: 0.35 },
317
+ { key: "dispersion", label: "Dispersion", min: 0, max: 2, step: 0.01, default: 1 },
318
+ { key: "bleed", label: "Bleed", min: 0, max: 2, step: 0.01, default: 1 },
319
+ { key: "glow", label: "Glow", min: 0, max: 2, step: 0.01, default: 1 },
320
+ { key: "drift", label: "Drift", min: 0, max: 3, step: 0.05, default: 1 }
321
+ ],
322
+ glsl: (
323
+ /* glsl */
324
+ `
325
+ /* A theme's ambient tones can be muted; pushed from their own grey and up
326
+ to full brightness they read as a spectrum once they are light. */
327
+ vec3 prismHue(vec3 c) {
328
+ float grey = (c.r + c.g + c.b) / 3.0;
329
+ c = max(grey + (c - grey) * 1.8, vec3(0.0));
330
+ return c / max(max(c.r, max(c.g, c.b)), 1e-3);
331
+ }
332
+
333
+ vec3 scene(vec2 uv, float t) {
334
+ float aspect = u_size.x / u_size.y;
335
+ vec2 p = vec2((uv.x - 0.5) * aspect, uv.y - 0.5);
336
+ t *= u_drift;
337
+
338
+ vec3 hues[5];
339
+ vec3 total = vec3(0.0);
340
+ for (int k = 0; k < 5; k++) {
341
+ hues[k] = prismHue(u_col[k]);
342
+ total += hues[k];
343
+ }
344
+
345
+ float edge = mix(0.95, 0.12, u_sharp);
346
+ vec3 light = vec3(0.0);
347
+ for (int i = 0; i < 10; i++) {
348
+ if (float(i) >= u_beams) break;
349
+ ivec2 id = ivec2(i * 37 + 5, 91);
350
+ /* The facet this beam leaves, above the stage, and the way it points. */
351
+ vec2 facet = vec2(
352
+ u_offset * aspect + (rnd(id) - 0.5) * (0.25 + 0.5 * u_spread),
353
+ 0.58 + 0.5 * rnd(id + 1)
354
+ );
355
+ float angle = u_tilt * 0.7 + (rnd(id + 2) - 0.5) * 1.5 * u_spread
356
+ + 0.05 * sin(t * (0.05 + 0.06 * rnd(id + 3)) + 6.28 * rnd(id + 4));
357
+ vec2 dir = vec2(sin(angle), -cos(angle));
358
+ vec2 rel = p - facet;
359
+ float run = dot(rel, dir);
360
+ if (run <= 0.0) continue;
361
+ float across = dot(rel, vec2(dir.y, -dir.x));
362
+
363
+ /* A few strong beams among faint ones, each breathing as the stone turns. */
364
+ float strength = pow(rnd(id + 5), 2.2)
365
+ * (0.45 + 0.55 * sin(t * (0.04 + 0.05 * rnd(id + 6)) + 6.28 * rnd(id + 7)));
366
+ strength = max(strength, 0.0) + 0.012;
367
+ float mouth = 0.004 + 0.035 * rnd(id + 8) * rnd(id + 8);
368
+ float halfW = mouth + u_fan * (0.008 + 0.035 * rnd(id + 9)) * run;
369
+ float split = (0.5 + rnd(id + 10)) * 0.13 * u_dispersion * run;
370
+ /* It thins as it opens and gives out with distance. */
371
+ float carry = pow((mouth + 0.02) / (halfW + 0.02), 0.7) * exp(-run / (0.9 + 1.4 * rnd(id + 11)));
372
+
373
+ vec3 beam = vec3(0.0);
374
+ for (int k = 0; k < 5; k++) {
375
+ float off = abs(across - (float(k) / 4.0 - 0.5) * split);
376
+ float body = 1.0 - smoothstep(halfW * (1.0 - edge), halfW * (1.0 + edge) + 0.002, off);
377
+ float halo = exp(-(off * off) / (2.0 * (halfW * 1.7 + 0.015) * (halfW * 1.7 + 0.015)));
378
+ beam += hues[k] * (body + 0.1 * u_bleed * halo);
379
+ }
380
+ /* Every colour in one place is white light. */
381
+ light += beam / max(total, vec3(1e-3)) * strength * carry;
382
+ }
383
+ return u_ground + light * 0.5 * u_glow;
384
+ }
385
+ `
386
+ )
387
+ };
388
+ const meteors = {
389
+ id: "meteors",
390
+ label: "Meteors",
391
+ description: "A meteor shower over a planet's edge, a sun flaring on the limb.",
392
+ mode: "dark",
393
+ colours: [
394
+ "--color-ambient-2",
395
+ "--color-ambient-3",
396
+ "--color-ambient-5",
397
+ "--color-ambient-1",
398
+ "--color-ambient-4"
399
+ ],
400
+ params: [
401
+ { key: "crown", label: "Limb height", min: -0.2, max: 0.7, step: 0.01, default: 0.26 },
402
+ { key: "curve", label: "Flatness", min: 0.8, max: 8, step: 0.1, default: 2.2 },
403
+ { key: "lean", label: "Lean", min: -0.6, max: 0.6, step: 0.01, default: -0.18 },
404
+ { key: "sun", label: "Sun position", min: -0.5, max: 0.5, step: 0.01, default: 0.22 },
405
+ { key: "flare", label: "Flare", min: 0, max: 2, step: 0.01, default: 1 },
406
+ { key: "glow", label: "Glow", min: 0, max: 2, step: 0.01, default: 1 },
407
+ { key: "shower", label: "Shower", min: 0, max: 2, step: 0.01, default: 1 },
408
+ { key: "angle", label: "Fall angle", min: -1.2, max: 1.2, step: 0.01, default: 0.38 },
409
+ { key: "tail", label: "Tail length", min: 0.2, max: 3, step: 0.01, default: 1 },
410
+ { key: "fall", label: "Fall speed", min: 0, max: 3, step: 0.01, default: 1 },
411
+ { key: "stars", label: "Stars", min: 0, max: 2, step: 0.01, default: 1 },
412
+ { key: "soft", label: "Softness", min: 0, max: 2, step: 0.01, default: 1 }
413
+ ],
414
+ glsl: (
415
+ /* glsl */
416
+ `
417
+ vec3 meteorHue(vec3 c) {
418
+ float grey = (c.r + c.g + c.b) / 3.0;
419
+ c = max(grey + (c - grey) * 1.8, vec3(0.0));
420
+ return c / max(max(c.r, max(c.g, c.b)), 1e-3);
421
+ }
422
+
423
+ vec3 scene(vec2 uv, float t) {
424
+ float aspect = u_size.x / u_size.y;
425
+ vec2 p = vec2((uv.x - 0.5) * aspect, uv.y);
426
+ float px = 1.0 / u_size.y;
427
+
428
+ vec3 near = meteorHue(u_col[0]);
429
+ vec3 far = meteorHue(u_col[1]);
430
+ vec3 ember = meteorHue(u_col[2]);
431
+ vec3 sunTint = meteorHue(u_col[3]);
432
+ vec3 deep = meteorHue(u_col[4]);
433
+
434
+ /* ---- The limb: a circle far larger than the stage, leaning. */
435
+ float radius = u_curve * max(aspect, 1.0);
436
+ vec2 centre = vec2(u_lean * radius, u_crown - radius * sqrt(max(1.0 - u_lean * u_lean, 0.05)));
437
+ float d = length(p - centre) - radius;
438
+ float sky = smoothstep(0.0, 2.0 * px + 0.012 * u_soft, d);
439
+ /* The sun sits on the edge, over its own place across the stage. */
440
+ float sx = u_sun * aspect;
441
+ float reachX = clamp(sx - centre.x, -radius * 0.98, radius * 0.98);
442
+ vec2 sun = vec2(sx, centre.y + sqrt(radius * radius - reachX * reachX) + 0.004);
443
+ vec2 r = p - sun;
444
+ float fromSun = length(r);
445
+ float lit = exp(-fromSun / 0.55);
446
+ float litWide = exp(-fromSun / 1.4);
447
+
448
+ vec3 light = vec3(0.0);
449
+
450
+ /* ---- Stars, one to a cell at most. */
451
+ vec2 frag = uv * u_size;
452
+ ivec2 cell = ivec2(floor(frag / 30.0));
453
+ vec2 at = (vec2(cell) + 0.15 + 0.7 * vec2(rnd(cell + 37), rnd(cell + 71))) * 30.0;
454
+ float sd = length(frag - at);
455
+ float pick = rnd(cell + 911);
456
+ float star = exp(-(sd * sd) / (2.0 * 0.7 * 0.7)) * step(0.74, pick) * 0.32
457
+ * (0.25 + 0.75 * pow(rnd(cell + 5), 3.0))
458
+ * (0.7 + 0.3 * sin(t * (0.5 + 1.5 * rnd(cell + 13)) + 40.0 * pick));
459
+ light += mix(vec3(1.0), mix(near, far, rnd(cell + 3)), 0.3) * star * u_stars * (1.0 - 0.8 * exp(-fromSun / 0.18));
460
+
461
+ /* ---- The shower: lanes across the fall, three depths of them. */
462
+ vec2 dir = vec2(-sin(u_angle), -cos(u_angle));
463
+ vec2 q = vec2(p.x, p.y - 0.5);
464
+ float a = dot(q, vec2(-dir.y, dir.x));
465
+ float b = dot(q, dir);
466
+ /* Long enough that a meteor and its whole tail are off the stage when
467
+ its lane starts over, so none ever blinks out. */
468
+ float span = 2.0 + aspect + u_tail;
469
+ for (int i = 0; i < 3; i++) {
470
+ float depth = 1.0 + float(i) * 0.7;
471
+ float laneW = 0.13 / depth;
472
+ float lane = floor(a / laneW);
473
+ ivec2 id = ivec2(int(lane) + 2048, i * 57 + 3);
474
+ float u = t * u_fall * (0.1 + 0.16 * rnd(id)) / depth + rnd(id + 11) * 17.0;
475
+ ivec2 pass = id + ivec2(0, int(mod(floor(u), 512.0)) * 131 + 7);
476
+ float there = step(1.0 - 0.7 * u_shower, rnd(pass + 5));
477
+ float head = (fract(u) - 0.5) * span;
478
+ float ax = (lane + 0.2 + 0.6 * rnd(pass + 9)) * laneW;
479
+ float len = u_tail * (0.16 + 0.34 * rnd(pass + 13)) / depth;
480
+ float back = (head - b) / len;
481
+ float w = max((0.0011 + 0.0012 * rnd(pass + 17)) * (1.0 + 0.5 * u_soft) / depth, 0.6 * px) * (1.0 - 0.5 * clamp(back, 0.0, 1.0));
482
+ float across = exp(-pow((a - ax) / w, 2.0) * 0.5);
483
+ float trail = smoothstep(-3.0 * w / len, 0.25 * u_soft, back) * pow(max(1.0 - back, 0.0), 1.6);
484
+ vec3 tint = mix(vec3(1.0), near, smoothstep(0.0, 0.22, back));
485
+ tint = mix(tint, ember, smoothstep(0.2, 0.6, back));
486
+ tint = mix(tint, far, smoothstep(0.55, 1.0, back));
487
+ light += tint * across * trail * there * (0.3 + 0.7 * rnd(pass + 21)) * 0.55 / (1.0 + 1.2 * u_soft) / sqrt(depth);
488
+ }
489
+
490
+ /* ---- Air on the limb: a thin wash, cool away from the sun. */
491
+ vec3 air = mix(far, near, lit);
492
+ light += air * lobe(d - 0.012, 0.06, 0.02) * (0.015 + 0.08 * litWide) * u_glow;
493
+ light += deep * lobe(d, 0.3, 0.05) * 0.012 * litWide * u_glow;
494
+ light *= sky;
495
+
496
+ /* ---- The planet's lit edge: a band of light with no line in it, wide
497
+ by the sun and thinning to nothing away from it. */
498
+ float blur = 0.004 + 0.02 * u_soft;
499
+ float litMid = exp(-fromSun / 0.75);
500
+ float band = lobe(d + 0.3 * blur, blur * (0.12 + 1.1 * litMid), blur * (0.15 + 1.9 * litMid));
501
+ vec3 edge = mix(air, vec3(1.0), 0.3 + 0.55 * litMid);
502
+ light += edge * band * (0.06 + 0.6 * litMid * litMid) * u_glow;
503
+
504
+ /* ---- The sun: a soft core, a bloom, and four short spikes that the
505
+ softness melts into it. */
506
+ float coreR = 0.01 + 0.008 * u_soft;
507
+ float core = exp(-dot(r, r) / (2.0 * coreR * coreR));
508
+ float bloom = exp(-dot(r, r) / (2.0 * 0.07 * 0.07)) * 0.3 + exp(-fromSun / 0.16) * 0.1;
509
+ vec2 k = vec2(r.x + r.y, r.x - r.y) * 0.7071;
510
+ float thick = 0.006 + 0.012 * u_soft;
511
+ float spikes = exp(-pow(k.x / thick, 2.0) * 0.5) * exp(-abs(k.y) / 0.09)
512
+ + exp(-pow(k.y / thick, 2.0) * 0.5) * exp(-abs(k.x) / 0.09);
513
+ float veil = mix(0.5, 1.0, sky);
514
+ light += mix(sunTint, vec3(1.0), 0.85) * (core * 0.55 + spikes * 0.6 / (1.0 + u_soft) * veil) * u_flare;
515
+ light += mix(sunTint, vec3(1.0), 0.7) * bloom * veil * u_flare;
516
+
517
+ return u_ground + light;
518
+ }
519
+ `
520
+ )
521
+ };
522
+ const waves = {
523
+ id: "waves",
524
+ label: "Waves",
525
+ description: "A sea of points rolling off into the dark, bright on the crests, over a deep glow.",
526
+ mode: "dark",
527
+ colours: ["--color-ambient-4", "--color-ambient-3", "--color-ambient-2"],
528
+ params: [
529
+ { key: "rise", label: "Height", min: -0.3, max: 0.9, step: 0.01, default: 0.12 },
530
+ { key: "pitch", label: "View", min: 0.15, max: 1.2, step: 0.01, default: 0.3 },
531
+ { key: "swell", label: "Swell", min: 0, max: 2, step: 0.01, default: 1 },
532
+ { key: "wavelength", label: "Wave length", min: 0.4, max: 3, step: 0.01, default: 1 },
533
+ { key: "density", label: "Density", min: 3, max: 30, step: 0.5, default: 16 },
534
+ { key: "dot", label: "Dot size", min: 0.3, max: 2, step: 0.01, default: 1 },
535
+ { key: "glow", label: "Glow", min: 0, max: 2, step: 0.01, default: 1 },
536
+ { key: "reach", label: "Reach", min: 0.2, max: 3, step: 0.01, default: 1 },
537
+ { key: "drift", label: "Drift", min: 0, max: 3, step: 0.05, default: 1 }
538
+ ],
539
+ glsl: (
540
+ /* glsl */
541
+ `
542
+ vec3 waveHue(vec3 c) {
543
+ float grey = (c.r + c.g + c.b) / 3.0;
544
+ c = max(grey + (c - grey) * 1.8, vec3(0.0));
545
+ return c / max(max(c.r, max(c.g, c.b)), 1e-3);
546
+ }
547
+
548
+ const float WAVE_LENS = 1.6;
549
+
550
+ /* The sea's height at a place on the plane, -1 to 1. */
551
+ float waveHeight(vec2 q, float t) {
552
+ q /= u_wavelength;
553
+ float h = 0.5 * sin(dot(q, vec2(0.62, 0.78)) * 1.15 + t * 0.3)
554
+ + 0.28 * sin(dot(q, vec2(-0.74, 0.55)) * 2.1 - t * 0.23 + 1.3)
555
+ + 0.7 * (vnoise(q * 0.5 + vec2(0.0, t * 0.05)) - 0.5);
556
+ return h / 1.13;
557
+ }
558
+
559
+ vec3 scene(vec2 uv, float t) {
560
+ float aspect = u_size.x / u_size.y;
561
+ vec2 p = vec2((uv.x - 0.5) * aspect, uv.y - u_rise);
562
+ float px = 1.0 / u_size.y;
563
+ t *= u_drift;
564
+
565
+ vec3 deep = waveHue(u_col[0]);
566
+ vec3 smoke = waveHue(u_col[1]);
567
+ vec3 crest = mix(mix(deep, waveHue(u_col[2]), 0.25), vec3(1.0), 0.65);
568
+
569
+ /* An eye one unit over the plane, looking down at it by the pitch. The
570
+ ray through this pixel falls by 'fall' and runs out by 'run' a step. */
571
+ float cp = cos(u_pitch);
572
+ float sp = sin(u_pitch);
573
+ float fall = WAVE_LENS * sp - p.y * cp;
574
+ float run = WAVE_LENS * cp + p.y * sp;
575
+ float amp = 0.3 * u_swell;
576
+ float farZ = 6.6 * u_reach;
577
+ vec3 light = vec3(0.0);
578
+
579
+ if (fall > 1e-4 && run > 1e-4) {
580
+ /* The ray can only meet the sea inside the slab the swells occupy. */
581
+ float enter = (1.0 - amp) / fall;
582
+ float leave = min((1.0 + amp) / fall, 2.5 * farZ / run);
583
+ /* March by the clear height over the sea, divided by the fastest the
584
+ ray and the sea can close on each other, so a step can never pass
585
+ through a crest: fixed strides did, and whether a thin crest was
586
+ caught turned on where the samples fell, so patches of sea flickered
587
+ as the swell moved. Steps shrink toward the surface; a ray still
588
+ short of it when they run out is grazing a crest, and rests there. */
589
+ float closing = fall + amp * 1.7 / u_wavelength * length(vec2(p.x, run));
590
+ float k = enter;
591
+ /* The last crest the ray cleared on its way: where its height over
592
+ the sea stopped falling and rose again. */
593
+ float skimK = -1.0;
594
+ float lastOver = 1e3;
595
+ float lastK = enter;
596
+ bool falling = false;
597
+ for (int i = 0; i < 72; i++) {
598
+ float over = (1.0 - fall * k) - amp * waveHeight(vec2(p.x * k, run * k), t);
599
+ if (over < 0.0015 * k || k > leave) break;
600
+ if (over > lastOver && falling) skimK = lastK;
601
+ falling = over < lastOver;
602
+ lastOver = over;
603
+ lastK = k;
604
+ k += over / closing;
605
+ }
606
+ k = min(k, leave);
607
+
608
+ vec2 at = vec2(p.x * k, run * k);
609
+ float z = at.y;
610
+ float h = waveHeight(at, t);
611
+ float lift = smoothstep(-0.7, 0.8, h);
612
+ /* Black takes the far sea, and starkly: the dots go first, over a
613
+ short run, and the glow under them a little further out. The near
614
+ edge eases in. */
615
+ float nearEdge = smoothstep(0.0, 0.08, uv.y);
616
+ float fog = exp(-pow(z / (0.8 * farZ), 4.0)) * nearEdge;
617
+ float dotFog = exp(-pow(z / (0.56 * farZ), 6.0)) * nearEdge;
618
+
619
+ /* The glow in the water, smoky, brighter under a crest. */
620
+ float cloud = fbm(at * 0.3 + vec2(t * 0.03, -t * 0.02));
621
+ vec3 body = mix(deep, smoke, 0.3 * smoothstep(0.35, 0.75, cloud));
622
+ light += body * (0.04 + 0.22 * lift * lift) * (0.35 + 0.9 * cloud) * fog * u_glow;
623
+
624
+ /* The dots: this row's and the rows before and behind it, each drawn
625
+ round on the screen from its own place on the surface. */
626
+ float cellW = 1.0 / u_density;
627
+ float row = floor(z / cellW);
628
+ /* The rows either side of where the ray lands, three each way: seen
629
+ side-on a swell packs its rows closer than a dot is wide, and a dot
630
+ left out of the search was a notch in its neighbours that came and
631
+ went as the swell moved. */
632
+ /* And a dot stands proud of the surface it sits on, so one on a crest
633
+ shows above the crest's edge, where the ray has already gone past
634
+ to the sea behind: the rows at the crest it last cleared are looked
635
+ at too, or those dots are cut flat along every crest. */
636
+ float skimRow = skimK > 0.0 ? floor(run * skimK / cellW) : row;
637
+ float dots = 0.0;
638
+ vec2 before = p;
639
+ vec2 behind = p;
640
+ float here = 0.0;
641
+ for (int j = -3; j <= 6; j++) {
642
+ float r = j <= 3 ? row + float(j) : skimRow + float(j - 5);
643
+ if (j > 3 && abs(r - row) < 3.5) continue;
644
+ float cz = (r + 0.5) * cellW;
645
+ /* Where this ray is when it is that far out, to pick the column. */
646
+ float kz = cz / run;
647
+ /* Every other row sits half a cell across, like a halftone. */
648
+ float stagger = 0.5 * mod(r, 2.0);
649
+ float cx = (floor(p.x * kz / cellW - stagger) + 0.5 + stagger) * cellW;
650
+ float ch = waveHeight(vec2(cx, cz), t);
651
+ float cy = amp * ch - 1.0;
652
+ float depth = max(cz * cp - cy * sp, 1e-3);
653
+ vec2 on = vec2(cx, cy * cp + cz * sp) * WAVE_LENS / depth;
654
+ if (j == -1) before = on;
655
+ if (j == 1) behind = on;
656
+ float up = smoothstep(-0.7, 0.8, ch);
657
+ float rad = 0.15 * cellW * u_dot * (0.4 + 0.6 * up) * WAVE_LENS / depth;
658
+ if (j == 0) here = rad;
659
+ /* A dot finer than a pixel is drawn a pixel wide and that much
660
+ fainter, with a softer edge, so it glides rather than snapping
661
+ from one pixel to the next. */
662
+ float shown = max(rad, 1.2 * px);
663
+ float soft = px * mix(1.5, 1.0, smoothstep(1.5 * px, 4.0 * px, rad));
664
+ float disc = 1.0 - smoothstep(shown - soft, shown + soft, length(p - on));
665
+ dots = max(dots, disc * (rad * rad) / (shown * shown) * (0.1 + 0.9 * up * up));
666
+ }
667
+ /* Where the rows are finer than the pixels, or the dots themselves
668
+ are, they become their average: a field of points too small to
669
+ draw can only twinkle. */
670
+ float rowPx = 0.5 * length(behind - before) / px;
671
+ float even = 0.06 * u_dot * u_dot * (0.1 + 0.9 * lift * lift);
672
+ dots = mix(even, dots, smoothstep(1.5, 3.5, rowPx) * smoothstep(0.7, 1.6, here / px));
673
+ light += mix(deep, crest, 0.3 + 0.7 * lift) * dots * dotFog * 1.3;
674
+ }
675
+ return u_ground + light;
676
+ }
677
+ `
678
+ )
679
+ };
680
+ const aurora = {
681
+ id: "aurora",
682
+ label: "Aurora",
683
+ description: "Wide ribbons of the theme's colour folding through one another, round a deep void.",
684
+ mode: "dark",
685
+ colours: [
686
+ "--color-ambient-4",
687
+ "--color-ambient-3",
688
+ "--color-ambient-5",
689
+ "--color-ambient-2",
690
+ "--color-ambient-6"
691
+ ],
692
+ params: [
693
+ { key: "scale", label: "Scale", min: 0.3, max: 3, step: 0.01, default: 1 },
694
+ { key: "fold", label: "Folds", min: 0, max: 2, step: 0.01, default: 1 },
695
+ { key: "tilt", label: "Tilt", min: -1.6, max: 1.6, step: 0.01, default: 0.5 },
696
+ { key: "void", label: "Void", min: 0, max: 1, step: 0.01, default: 0.8 },
697
+ { key: "bloom", label: "Bloom", min: 0, max: 1, step: 0.01, default: 0.6 },
698
+ { key: "bright", label: "Brightness", min: 0.1, max: 1.5, step: 0.01, default: 0.8 },
699
+ { key: "drift", label: "Drift", min: 0, max: 3, step: 0.05, default: 1 }
700
+ ],
701
+ glsl: (
702
+ /* glsl */
703
+ `
704
+ /* Each tone saturated and lifted to full value, so the ribbons glow in a
705
+ theme's colour however dark its role sits. A tone with next to no hue
706
+ (a monochrome theme's greys) keeps its own value instead: lifted, every
707
+ grey would come out the same white. */
708
+ vec3 auroraHue(vec3 c) {
709
+ float hi = max(c.r, max(c.g, c.b));
710
+ float chroma = (hi - min(c.r, min(c.g, c.b))) / max(hi, 1e-3);
711
+ float grey = (c.r + c.g + c.b) / 3.0;
712
+ vec3 s = max(grey + (c - grey) * 1.6, vec3(0.0));
713
+ vec3 lifted = s / max(max(s.r, max(s.g, s.b)), 1e-3);
714
+ return mix(c, lifted, smoothstep(0.04, 0.2, chroma));
715
+ }
716
+
717
+ vec3 scene(vec2 uv, float t) {
718
+ float aspect = u_size.x / u_size.y;
719
+ vec2 p = vec2((uv.x - 0.5) * aspect, uv.y - 0.5);
720
+ t *= u_drift;
721
+ float ca = cos(u_tilt);
722
+ float sa = sin(u_tilt);
723
+ vec2 w = vec2(ca * p.x + sa * p.y, -sa * p.x + ca * p.y) * 2.3 * u_scale;
724
+
725
+ /* Fold the plane: each warp bends it along the last one's grain. */
726
+ for (int i = 1; i <= 4; i++) {
727
+ float n = float(i);
728
+ w.x += u_fold * 0.6 / n * sin(n * 1.25 * w.y + t * 0.11 + n * 1.7);
729
+ w.y += u_fold * 0.5 / n * cos(n * 1.05 * w.x - t * 0.09 + n * 2.3);
730
+ }
731
+
732
+ float a = 0.5 + 0.5 * sin(w.x * 1.15 + w.y * 0.5 + t * 0.05);
733
+ float b = 0.5 + 0.5 * sin(w.y * 1.35 - w.x * 0.45 + 2.1 - t * 0.04);
734
+ float c = 0.5 + 0.5 * sin((w.x + w.y) * 0.85 + 4.2 + t * 0.03);
735
+ float e = 0.5 + 0.5 * sin(w.x * 0.6 - w.y * 0.95 + 0.7);
736
+
737
+ vec3 base = auroraHue(u_col[0]);
738
+ vec3 col = base;
739
+ col = mix(col, auroraHue(u_col[1]), smoothstep(0.3, 0.9, a) * 0.8);
740
+ col = mix(col, mix(auroraHue(u_col[3]), vec3(1.0), 0.25), smoothstep(0.35, 0.95, c) * 0.6);
741
+ col = mix(col, auroraHue(u_col[2]), smoothstep(0.6, 1.0, b) * 0.8);
742
+ col = mix(col, auroraHue(u_col[4]), smoothstep(0.7, 1.0, e) * smoothstep(0.5, 0.9, b) * 0.6);
743
+ /* A pale bloom where ribbons cross. */
744
+ col = mix(col, vec3(1.0), u_bloom * smoothstep(0.25, 0.95, a * c + 0.35 * e) * 0.85);
745
+
746
+ /* The void, with the base tone deepening toward it. */
747
+ float pool = 0.5 + 0.5 * sin(w.x * 0.75 - w.y * 1.1 + 5.3 + t * 0.02);
748
+ float dark = u_void * smoothstep(0.5, 0.95, pool);
749
+ col = mix(col, base * 0.5, smoothstep(0.0, 0.6, dark) * 0.7);
750
+ float lit = 1.0 - smoothstep(0.35, 1.0, dark);
751
+ return u_ground + col * lit * u_bright;
752
+ }
753
+ `
754
+ )
755
+ };
756
+ const SCENES = [horizon, rift, glyphs, prism, meteors, waves, aurora];
180
757
  export {
181
758
  SCENES,
759
+ aurora,
760
+ glyphs,
182
761
  horizon,
183
- rift
762
+ meteors,
763
+ prism,
764
+ rift,
765
+ waves
184
766
  };
@@ -34,6 +34,19 @@ export type Scene = {
34
34
  * preset's colours.
35
35
  */
36
36
  mode?: "dark";
37
+ /**
38
+ * A ramp of characters, thin to heavy, for a scene that prints type. The
39
+ * renderer draws it once into a strip texture in the theme's code face
40
+ * (`--font-family-code`) and hands it to the GLSL as `u_glyphs`, with
41
+ * the number of characters in `u_glyphCount`.
42
+ */
43
+ glyphs?: string;
44
+ /**
45
+ * The most drawing-buffer pixels per CSS pixel the scene may use, for a
46
+ * scene with detail finer than soft light (type). Defaults to 1; the
47
+ * ratio in use reaches the GLSL as `u_ratio`.
48
+ */
49
+ pixelRatio?: number;
37
50
  params: ParamSpec[];
38
51
  glsl: string;
39
52
  };
@@ -864,6 +864,35 @@
864
864
  padding-inline-start: var(--padding-200);
865
865
  }
866
866
 
867
+ /* The footer's two forms share one cell, AppSidebar's: the slot keeps one
868
+ height in both states, so the rail never snaps, and the expanded form
869
+ fades out as the collapsed form fades in. The collapsed form stacks its
870
+ controls (the same ones at their smallest) on the rail's axis. */
871
+ .ds-thread-panel__footer-slots {
872
+ display: grid;
873
+ min-width: 0;
874
+ }
875
+
876
+ .ds-thread-panel__footer-slots > .ds-thread-panel__footer-slot {
877
+ grid-area: 1 / 1;
878
+ }
879
+
880
+ .ds-thread-panel__footer-slot--collapsed {
881
+ display: flex;
882
+ flex-direction: column;
883
+ align-items: center;
884
+ justify-content: flex-end;
885
+ gap: var(--gap-200);
886
+ padding-inline-start: 0;
887
+ opacity: 1;
888
+ pointer-events: auto;
889
+ }
890
+
891
+ .ds-thread-panel--expanded .ds-thread-panel__footer-slot--collapsed {
892
+ opacity: 0;
893
+ pointer-events: none;
894
+ }
895
+
867
896
  /* The rails' one profile block, AppSidebar's: a 40px avatar, the name over
868
897
  the meta line in paragraph type, AppSidebar's avatar-to-name gap.
869
898
  Collapsed, the avatar sits on the rail's axis (12 + 40 + 12 = 64);