@thebuilder/umbraco-docs 1.2.0 → 1.3.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.
- package/README.md +39 -0
- package/components/HeroParticles.astro +89 -0
- package/components/LandingHero.astro +3 -2
- package/components/LandingRoot.astro +10 -0
- package/dist/behaviors.js +14 -3
- package/dist/behaviors.js.map +1 -1
- package/dist/hero/browser.d.ts +30 -0
- package/dist/hero/browser.js +270 -0
- package/dist/hero/browser.js.map +1 -0
- package/dist/hero/field.d.ts +35 -0
- package/dist/hero/field.js +215 -0
- package/dist/hero/field.js.map +1 -0
- package/dist/hero/index.d.ts +6 -0
- package/dist/hero/index.js +4 -0
- package/dist/hero/index.js.map +1 -0
- package/dist/hero/scene.d.ts +44 -0
- package/dist/hero/scene.js +138 -0
- package/dist/hero/scene.js.map +1 -0
- package/dist/hero/shaders.generated.d.ts +6 -0
- package/dist/hero/shaders.generated.js +6 -0
- package/dist/hero/shaders.generated.js.map +1 -0
- package/dist/og/generator.js +7 -2
- package/dist/og/generator.js.map +1 -1
- package/dist/og/types.d.ts +2 -0
- package/dist/og/types.js +1 -0
- package/dist/og/types.js.map +1 -1
- package/package.json +15 -5
- package/styles/landing.css +30 -3
package/README.md
CHANGED
|
@@ -46,6 +46,43 @@ import { InstallCommand, LandingHero, LandingRoot } from "@thebuilder/umbraco-do
|
|
|
46
46
|
</LandingRoot>
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
+
`logo` is optional. A hero can also draw its own background, such as a canvas, through the `background` slot, which renders behind the glow and the content.
|
|
50
|
+
|
|
51
|
+
Elements that come into view together reveal one after another, 60ms apart. To hold reveals back, for example until a background intro gets going, set `--udocs-reveal-offset` on a container, such as `.udocs-hero__inner { --udocs-reveal-offset: 300ms; }`.
|
|
52
|
+
|
|
53
|
+
## Particle hero
|
|
54
|
+
|
|
55
|
+
`HeroParticles` draws the site's logo in glowing WebGPU particles behind the hero text, as on [umbraco.thebuilder.dk](https://umbraco.thebuilder.dk). The particles swirl in from a scattered sky, settle into the logo in its own colors, and scatter around the pointer. Put it in the hero's `background` slot, and leave out the hero's own `logo`, since the particles draw it:
|
|
56
|
+
|
|
57
|
+
```astro
|
|
58
|
+
---
|
|
59
|
+
import HeroParticles from "@thebuilder/umbraco-docs/components/HeroParticles";
|
|
60
|
+
import { LandingHero } from "@thebuilder/umbraco-docs/astro";
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
<LandingHero title="Example" description="A focused Umbraco package.">
|
|
64
|
+
<HeroParticles slot="background" logo="/logo.svg" />
|
|
65
|
+
</LandingHero>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
It needs the `vgpu` package, an optional peer dependency, so install it in the site:
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
pnpm add vgpu@^0.6.0
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The shaders ship prepared, so the site's build needs no extra setup. Import the component directly as shown; the `./astro` entry doesn't export it, so sites that don't use it never need `vgpu`.
|
|
75
|
+
|
|
76
|
+
How it behaves:
|
|
77
|
+
|
|
78
|
+
- **Shape.** The logo is drawn into a 256 pixel square and particles are placed on its solid pixels, taking their colors. Soft glow layers, below 60% coverage, are left out. An SVG logo's `viewBox` decides its shape. A cross-origin logo needs CORS; without it, the fallback below shows instead.
|
|
79
|
+
- **Motion.** Still shapes catch a slow band of light that sweeps across them. To make a stroke stream from one end to the other instead, pass `flow` with its center line as SVG path data, its width and the logo's `viewBox`, such as `flow={{ path: "M60 44v92a68 68 0 0 0 136 0V44", width: 36, viewBox: 256 }}`.
|
|
80
|
+
- **Layout.** It fills the hero down to the first content after the text, such as a `ScreenshotFrame`, and steps back behind the text. When the hero sits under a sticky header, such as Blume's, the particles run on up behind it, and the header starts clear and turns to its usual frosted bar as the page scrolls. Browsers without scroll-driven animations keep the header as it is.
|
|
81
|
+
- **Themes.** It follows `data-theme` on `<html>`, which Blume sets, and the system theme without one: light on dark, colored ink on light.
|
|
82
|
+
- **Fallbacks.** With reduced motion it draws one still frame. Without WebGPU, or if the logo can't be read, the logo shows large and faded instead. It pauses while scrolled out of view.
|
|
83
|
+
|
|
84
|
+
For a still of the same scene, such as a social card backdrop, `@thebuilder/umbraco-docs/hero` exports `createParticleField` and `createHeroScene`, which also run in Node with `vgpu/node`. The hub renders its card backdrop this way in `apps/hub/scripts/render-og-backdrop.ts`.
|
|
85
|
+
|
|
49
86
|
## Related packages
|
|
50
87
|
|
|
51
88
|
`loadUmbracoPackages()` reads the package list published at [umbraco.thebuilder.dk/packages.json](https://umbraco.thebuilder.dk/packages.json) during the build, so every docs site shows the current set of packages without keeping its own copy. Pass the result to `EcosystemSection`, which leaves out the current package.
|
|
@@ -87,3 +124,5 @@ pnpm exec umbraco-docs-og --check
|
|
|
87
124
|
```
|
|
88
125
|
|
|
89
126
|
Generation is deterministic. Check mode fails when an expected image is missing or stale.
|
|
127
|
+
|
|
128
|
+
To replace the default gradient, set `background` to a public image, such as `background: "/og/backdrop.png"`. It is scaled to cover the 1200×630 card and the text goes on top, so keep its left side calm. The hub renders its backdrop from its hero shaders with `apps/hub/scripts/render-og-backdrop.ts`.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The logo drawn in WebGPU particles behind a LandingHero's text. Put it in the hero's
|
|
3
|
+
// background slot. It needs the optional `vgpu` peer dependency; without WebGPU in the browser,
|
|
4
|
+
// the logo shows large and faded instead.
|
|
5
|
+
import type { HeroFlow } from "@thebuilder/umbraco-docs/hero";
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
/** The logo to draw, usually the same image as the site's logo. */
|
|
9
|
+
logo: string;
|
|
10
|
+
/** A stroke of the logo whose particles stream along it instead of holding still. */
|
|
11
|
+
flow?: HeroFlow;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const { logo, flow } = Astro.props;
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
<div class="udocs-particles" data-udocs-particles data-logo={logo} data-flow={flow ? JSON.stringify(flow) : undefined} aria-hidden="true">
|
|
18
|
+
<img class="udocs-particles__fallback" src={logo} alt="" decoding="async" />
|
|
19
|
+
<canvas class="udocs-particles__canvas"></canvas>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
import { startHeroParticles } from "@thebuilder/umbraco-docs/hero";
|
|
24
|
+
|
|
25
|
+
const started = new WeakSet<HTMLElement>();
|
|
26
|
+
|
|
27
|
+
const start = () => {
|
|
28
|
+
for (const container of document.querySelectorAll<HTMLElement>("[data-udocs-particles]")) {
|
|
29
|
+
if (started.has(container)) continue;
|
|
30
|
+
started.add(container);
|
|
31
|
+
const canvas = container.querySelector("canvas");
|
|
32
|
+
const hero = container.parentElement;
|
|
33
|
+
const logo = container.dataset.logo;
|
|
34
|
+
if (!canvas || !hero || !logo) continue;
|
|
35
|
+
const text = hero.querySelector<HTMLElement>(".udocs-hero__inner") ?? undefined;
|
|
36
|
+
|
|
37
|
+
// Stop above whatever follows the text in the hero, such as a screenshot. Under a sticky
|
|
38
|
+
// header, like Blume's, reach up behind it too, so the particles run on under the header
|
|
39
|
+
// instead of ending in a line at its edge. Only the header: content above it stays clear.
|
|
40
|
+
let lift = 0;
|
|
41
|
+
const coveringHeader = () => {
|
|
42
|
+
const rect = hero.getBoundingClientRect();
|
|
43
|
+
// Above the top of the viewport there is nothing to hit-test; keep the last measurement.
|
|
44
|
+
if (rect.top < 1) return lift;
|
|
45
|
+
for (const element of document.elementsFromPoint(rect.left + rect.width / 2, rect.top - 1)) {
|
|
46
|
+
for (let node: Element | null = element; node && node !== document.body; node = node.parentElement) {
|
|
47
|
+
const position = getComputedStyle(node).position;
|
|
48
|
+
if (position !== "sticky" && position !== "fixed") continue;
|
|
49
|
+
const box = node.getBoundingClientRect();
|
|
50
|
+
return box.bottom >= rect.top - 1 ? Math.max(Math.round(rect.top - box.top), 0) : 0;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return 0;
|
|
54
|
+
};
|
|
55
|
+
const fit = () => {
|
|
56
|
+
let below = text?.nextElementSibling;
|
|
57
|
+
while (below && ["SCRIPT", "STYLE", "TEMPLATE"].includes(below.tagName)) below = below.nextElementSibling;
|
|
58
|
+
if (below instanceof HTMLElement) container.style.setProperty("--udocs-particles-height", `${below.offsetTop}px`);
|
|
59
|
+
else container.style.removeProperty("--udocs-particles-height");
|
|
60
|
+
lift = coveringHeader();
|
|
61
|
+
hero.style.setProperty("--udocs-particles-lift", `${lift}px`);
|
|
62
|
+
// The header goes clear at the top of the page only when the particles run behind it.
|
|
63
|
+
document.documentElement.toggleAttribute("data-udocs-particles-header", lift > 0);
|
|
64
|
+
};
|
|
65
|
+
// Anything above the hero can move it too, such as a header changing height or a late banner.
|
|
66
|
+
// Both observers report once right away, which does the first fit.
|
|
67
|
+
const layout = new ResizeObserver(fit);
|
|
68
|
+
layout.observe(hero);
|
|
69
|
+
layout.observe(document.body);
|
|
70
|
+
|
|
71
|
+
const stop = startHeroParticles(canvas, {
|
|
72
|
+
logo,
|
|
73
|
+
...(container.dataset.flow ? { flow: JSON.parse(container.dataset.flow) } : {}),
|
|
74
|
+
...(text ? { text } : {}),
|
|
75
|
+
pointerArea: hero,
|
|
76
|
+
coveredTop: () => lift,
|
|
77
|
+
onFallback: () => { container.dataset.fallback = "true"; },
|
|
78
|
+
});
|
|
79
|
+
document.addEventListener("astro:before-swap", () => {
|
|
80
|
+
layout.disconnect();
|
|
81
|
+
document.documentElement.removeAttribute("data-udocs-particles-header");
|
|
82
|
+
stop();
|
|
83
|
+
}, { once: true });
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
start();
|
|
88
|
+
document.addEventListener("astro:page-load", start);
|
|
89
|
+
</script>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
interface Props {
|
|
3
3
|
title: string;
|
|
4
4
|
description: string;
|
|
5
|
-
logo
|
|
5
|
+
logo?: string;
|
|
6
6
|
logoAlt?: string;
|
|
7
7
|
accent?: string;
|
|
8
8
|
compatibility?: string;
|
|
@@ -12,9 +12,10 @@ const { title, description, logo, logoAlt = "", accent, compatibility } = Astro.
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
14
|
<section class="udocs-hero" aria-labelledby="udocs-hero-title">
|
|
15
|
+
<slot name="background" />
|
|
15
16
|
<div class="udocs-hero__glow" aria-hidden="true"></div>
|
|
16
17
|
<div class="udocs-shell udocs-hero__inner">
|
|
17
|
-
<img class="udocs-hero__logo" src={logo} width="72" height="72" alt={logoAlt} data-udocs-reveal />
|
|
18
|
+
{logo && <img class="udocs-hero__logo" src={logo} width="72" height="72" alt={logoAlt} data-udocs-reveal />}
|
|
18
19
|
<h1 id="udocs-hero-title" class="udocs-hero__title" data-udocs-reveal>
|
|
19
20
|
{title}{accent && <> <span class="udocs-hero__accent">{accent}</span></>}
|
|
20
21
|
</h1>
|
|
@@ -6,6 +6,16 @@ const { class: className } = Astro.props;
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
<div class:list={["udocs-landing", className]} data-udocs-root>
|
|
9
|
+
<script is:inline>
|
|
10
|
+
// Hide reveal targets before they first paint, so they animate in rather than out. The reveal
|
|
11
|
+
// behavior takes over when it loads; if it never does, show everything instead.
|
|
12
|
+
(() => {
|
|
13
|
+
const root = document.currentScript.parentElement;
|
|
14
|
+
if (matchMedia("(prefers-reduced-motion: reduce)").matches || !("IntersectionObserver" in window)) return;
|
|
15
|
+
root.dataset.udocsMotion = "true";
|
|
16
|
+
setTimeout(() => { if (!root.dataset.udocsObserved) root.dataset.udocsMotion = "false"; }, 3000);
|
|
17
|
+
})();
|
|
18
|
+
</script>
|
|
9
19
|
<slot />
|
|
10
20
|
</div>
|
|
11
21
|
|
package/dist/behaviors.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
const initialized = new WeakSet();
|
|
2
|
+
const STAGGER_MS = 60;
|
|
3
|
+
// Caps the wait for the last element of a large batch at 360ms.
|
|
4
|
+
const MAX_STAGGER_STEPS = 6;
|
|
2
5
|
export function initializeUmbracoDocs(root = document) {
|
|
3
6
|
const reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
4
7
|
for (const landing of root.querySelectorAll("[data-udocs-root]")) {
|
|
@@ -6,14 +9,22 @@ export function initializeUmbracoDocs(root = document) {
|
|
|
6
9
|
continue;
|
|
7
10
|
initialized.add(landing);
|
|
8
11
|
const reveals = landing.querySelectorAll("[data-udocs-reveal]");
|
|
9
|
-
|
|
12
|
+
// LandingRoot hid the reveal targets before first paint. If this ran too late, it already gave
|
|
13
|
+
// up and showed them, and hiding them again now would fade visible content out.
|
|
14
|
+
const gaveUp = landing.dataset.udocsMotion === "false";
|
|
15
|
+
if (!reducedMotion && !gaveUp && "IntersectionObserver" in window) {
|
|
10
16
|
landing.dataset.udocsMotion = "true";
|
|
17
|
+
landing.dataset.udocsObserved = "true";
|
|
11
18
|
const observer = new IntersectionObserver((entries) => {
|
|
19
|
+
// Elements that come into view together ripple in, in page order, instead of landing as one block.
|
|
20
|
+
let order = 0;
|
|
12
21
|
for (const entry of entries) {
|
|
13
22
|
if (!entry.isIntersecting)
|
|
14
23
|
continue;
|
|
15
|
-
entry.target
|
|
16
|
-
|
|
24
|
+
const element = entry.target;
|
|
25
|
+
element.style.setProperty("--udocs-reveal-stagger", `${Math.min(order++, MAX_STAGGER_STEPS) * STAGGER_MS}ms`);
|
|
26
|
+
element.dataset.udocsVisible = "true";
|
|
27
|
+
observer.unobserve(element);
|
|
17
28
|
}
|
|
18
29
|
}, { rootMargin: "0px 0px -10%", threshold: 0.1 });
|
|
19
30
|
reveals.forEach((element) => observer.observe(element));
|
package/dist/behaviors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"behaviors.js","sourceRoot":"","sources":["../src/behaviors.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG,IAAI,OAAO,EAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"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GAAG,EAAE,CAAC;oBACtC,CAAC,EAAE,IAAI,CAAC,CAAC;gBACX,CAAC;gBAAC,MAAM,CAAC;oBACP,MAAM,CAAC,OAAO,CAAC,eAAe,GAAG,MAAM,CAAC;oBACxC,IAAI,MAAM;wBAAE,MAAM,CAAC,WAAW,GAAG,oDAAoD,CAAC;gBACxF,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** A stroke of the logo that flows, as SVG path data in the logo's own coordinates. */
|
|
2
|
+
export interface HeroFlow {
|
|
3
|
+
/** The stroke's center line, from where the flow starts to where it ends. */
|
|
4
|
+
path: string;
|
|
5
|
+
/** The stroke's width, in the same units. */
|
|
6
|
+
width: number;
|
|
7
|
+
/** The logo's viewBox size, which the path's coordinates are in. A number means a square. */
|
|
8
|
+
viewBox: number | readonly [number, number];
|
|
9
|
+
}
|
|
10
|
+
export interface HeroParticlesOptions {
|
|
11
|
+
/** URL of the logo to draw; SVG or any image the browser can decode. Cross-origin images need CORS. */
|
|
12
|
+
logo: string;
|
|
13
|
+
flow?: HeroFlow;
|
|
14
|
+
/** The hero's text; the particles step back behind it. */
|
|
15
|
+
text?: HTMLElement;
|
|
16
|
+
/** Where the pointer is followed; defaults to the canvas's parent. */
|
|
17
|
+
pointerArea?: HTMLElement;
|
|
18
|
+
/**
|
|
19
|
+
* Pixels at the top of the canvas that sit behind something, such as a sticky header. The
|
|
20
|
+
* particles still drift there, but the logo centers on the rest.
|
|
21
|
+
*/
|
|
22
|
+
coveredTop?: () => number;
|
|
23
|
+
/** Called when the particles can't run here (no WebGPU, an unreadable logo, a lost device), so the page can show a still logo instead. */
|
|
24
|
+
onFallback?: () => void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Starts the particle hero on `canvas` and returns a teardown function. `canvas.dataset.ready` is
|
|
28
|
+
* set once a frame is on screen; when the particles can't run, `onFallback` is called instead.
|
|
29
|
+
*/
|
|
30
|
+
export declare function startHeroParticles(canvas: HTMLCanvasElement, options: HeroParticlesOptions): () => void;
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
// The page side of the particle hero: draws the logo into pixels, then runs the scene with the
|
|
2
|
+
// pointer, the theme, visibility and the frame loop. scene.ts owns the GPU work.
|
|
3
|
+
import { clock, frame, frameLoop, init, surface } from "vgpu";
|
|
4
|
+
import { createParticleField } from "./field.js";
|
|
5
|
+
import { CENTERED, createHeroScene } from "./scene.js";
|
|
6
|
+
const INTRO_SECONDS = 3.4;
|
|
7
|
+
const CLEAR = [0, 0, 0, 0];
|
|
8
|
+
// The logo is drawn into a square this many pixels wide before particles are placed on it.
|
|
9
|
+
const RASTER = 256;
|
|
10
|
+
/**
|
|
11
|
+
* Starts the particle hero on `canvas` and returns a teardown function. `canvas.dataset.ready` is
|
|
12
|
+
* set once a frame is on screen; when the particles can't run, `onFallback` is called instead.
|
|
13
|
+
*/
|
|
14
|
+
export function startHeroParticles(canvas, options) {
|
|
15
|
+
let disposed = false;
|
|
16
|
+
const fallBack = () => {
|
|
17
|
+
if (!disposed)
|
|
18
|
+
options.onFallback?.();
|
|
19
|
+
};
|
|
20
|
+
if (!("gpu" in navigator)) {
|
|
21
|
+
fallBack();
|
|
22
|
+
return () => { };
|
|
23
|
+
}
|
|
24
|
+
const area = options.pointerArea ?? canvas.parentElement ?? canvas;
|
|
25
|
+
const { text } = options;
|
|
26
|
+
const root = document.documentElement;
|
|
27
|
+
const systemDark = matchMedia("(prefers-color-scheme: dark)");
|
|
28
|
+
const reducedMotion = matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
29
|
+
// Blume and the hub both pin a chosen theme in data-theme; without one, follow the system.
|
|
30
|
+
const isDark = () => (root.dataset.theme ? root.dataset.theme === "dark" : systemDark.matches);
|
|
31
|
+
// Run newest first, so the gpu that everything else belongs to goes last.
|
|
32
|
+
const cleanups = [];
|
|
33
|
+
const onCleanup = (cleanup) => cleanups.unshift(cleanup);
|
|
34
|
+
void (async () => {
|
|
35
|
+
const field = await loadField(options).catch(() => undefined);
|
|
36
|
+
if (!field)
|
|
37
|
+
return fallBack();
|
|
38
|
+
if (disposed)
|
|
39
|
+
return;
|
|
40
|
+
// The particle draw reads the simulation output from a vertex-stage storage buffer. Browsers
|
|
41
|
+
// that don't know this limit reject it, but they allow vertex storage anyway, so retry without.
|
|
42
|
+
const gpu = await init({ requiredLimits: { maxStorageBuffersInVertexStage: 1 } })
|
|
43
|
+
.catch(() => init())
|
|
44
|
+
.catch(() => undefined);
|
|
45
|
+
if (!gpu)
|
|
46
|
+
return fallBack();
|
|
47
|
+
if (disposed)
|
|
48
|
+
return gpu.dispose();
|
|
49
|
+
onCleanup(() => gpu.dispose());
|
|
50
|
+
let lost = false;
|
|
51
|
+
void gpu.lost.then(() => {
|
|
52
|
+
lost = true;
|
|
53
|
+
delete canvas.dataset.ready;
|
|
54
|
+
fallBack();
|
|
55
|
+
});
|
|
56
|
+
const output = surface(gpu, canvas, { dpr: [1, 1.5], clearColor: CLEAR });
|
|
57
|
+
const scene = createHeroScene(gpu, output, field);
|
|
58
|
+
const dark = { value: isDark() ? 1 : 0, target: isDark() ? 1 : 0 };
|
|
59
|
+
scene.look({ dark: dark.value });
|
|
60
|
+
scene.move({ intro: reducedMotion ? 1 : 0 });
|
|
61
|
+
// Center the logo on the part of the canvas that isn't covered.
|
|
62
|
+
const place = () => {
|
|
63
|
+
const height = canvas.clientHeight || 1;
|
|
64
|
+
const covered = Math.min(Math.max(options.coveredTop?.() ?? 0, 0), height / 2) / height;
|
|
65
|
+
scene.place({ height: CENTERED.height * (1 - covered), offset: [0, CENTERED.offset[1] * (1 - covered) - covered] });
|
|
66
|
+
};
|
|
67
|
+
onCleanup(output.onResize(() => {
|
|
68
|
+
scene.resize(output.dpr);
|
|
69
|
+
place();
|
|
70
|
+
}));
|
|
71
|
+
// Measure where the text sits, so the composite can step back behind it.
|
|
72
|
+
const measureText = () => {
|
|
73
|
+
if (!text)
|
|
74
|
+
return;
|
|
75
|
+
const box = canvas.getBoundingClientRect();
|
|
76
|
+
const rect = text.getBoundingClientRect();
|
|
77
|
+
if (box.width === 0 || box.height === 0)
|
|
78
|
+
return;
|
|
79
|
+
scene.look({
|
|
80
|
+
text: {
|
|
81
|
+
min: [(rect.left - box.left) / box.width, (rect.top - box.top) / box.height],
|
|
82
|
+
max: [(rect.right - box.left) / box.width, (rect.bottom - box.top) / box.height],
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
const layout = new ResizeObserver(measureText);
|
|
87
|
+
layout.observe(canvas);
|
|
88
|
+
if (text)
|
|
89
|
+
layout.observe(text);
|
|
90
|
+
onCleanup(() => layout.disconnect());
|
|
91
|
+
measureText();
|
|
92
|
+
const compiled = await scene.compile().then(() => true, () => false);
|
|
93
|
+
if (!compiled)
|
|
94
|
+
return fallBack();
|
|
95
|
+
if (disposed)
|
|
96
|
+
return;
|
|
97
|
+
const render = (currentFrame) => {
|
|
98
|
+
scene.render(currentFrame);
|
|
99
|
+
canvas.dataset.ready = "true";
|
|
100
|
+
};
|
|
101
|
+
if (reducedMotion) {
|
|
102
|
+
// The settled logo, redrawn only when the size or theme changes.
|
|
103
|
+
const still = () => frame(gpu, render);
|
|
104
|
+
const resizeObserver = new ResizeObserver(still);
|
|
105
|
+
resizeObserver.observe(canvas);
|
|
106
|
+
onCleanup(() => resizeObserver.disconnect());
|
|
107
|
+
onCleanup(watchTheme(() => {
|
|
108
|
+
scene.look({ dark: isDark() ? 1 : 0 });
|
|
109
|
+
still();
|
|
110
|
+
}));
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
onCleanup(watchTheme(() => { dark.target = isDark() ? 1 : 0; }));
|
|
114
|
+
// Pointer in view space (y up, x scaled by aspect), eased in the loop so nothing snaps.
|
|
115
|
+
const pointer = { x: 0, y: 0, active: 0, targetX: 0, targetY: 0, targetActive: 0 };
|
|
116
|
+
const onPointerMove = (event) => {
|
|
117
|
+
// A finger has no hover, and a touch that scrolls the page should not leave a hole behind.
|
|
118
|
+
if (event.pointerType === "touch")
|
|
119
|
+
return;
|
|
120
|
+
const rect = canvas.getBoundingClientRect();
|
|
121
|
+
pointer.targetX = (((event.clientX - rect.left) / rect.width) * 2 - 1) * scene.aspect;
|
|
122
|
+
pointer.targetY = 1 - ((event.clientY - rect.top) / rect.height) * 2;
|
|
123
|
+
pointer.targetActive = 1;
|
|
124
|
+
};
|
|
125
|
+
const onPointerLeave = () => { pointer.targetActive = 0; };
|
|
126
|
+
area.addEventListener("pointermove", onPointerMove);
|
|
127
|
+
area.addEventListener("pointerleave", onPointerLeave);
|
|
128
|
+
area.addEventListener("pointercancel", onPointerLeave);
|
|
129
|
+
onCleanup(() => {
|
|
130
|
+
area.removeEventListener("pointermove", onPointerMove);
|
|
131
|
+
area.removeEventListener("pointerleave", onPointerLeave);
|
|
132
|
+
area.removeEventListener("pointercancel", onPointerLeave);
|
|
133
|
+
});
|
|
134
|
+
const time = clock(gpu);
|
|
135
|
+
let elapsed = 0;
|
|
136
|
+
const tilt = { x: 0, y: 0 };
|
|
137
|
+
const start = () => frameLoop(gpu, (currentFrame) => {
|
|
138
|
+
// Clamp the step, so returning to the tab does not fling the springs.
|
|
139
|
+
const dt = Math.min(time.deltaTime, 1 / 20);
|
|
140
|
+
elapsed += dt;
|
|
141
|
+
const follow = (rate) => 1 - Math.exp(-dt * rate);
|
|
142
|
+
pointer.x += (pointer.targetX - pointer.x) * follow(10);
|
|
143
|
+
pointer.y += (pointer.targetY - pointer.y) * follow(10);
|
|
144
|
+
pointer.active += (pointer.targetActive - pointer.active) * follow(4);
|
|
145
|
+
// The logo turns gently toward the pointer, and sways on its own when left alone.
|
|
146
|
+
const tiltX = pointer.x * 0.16 * pointer.active + Math.sin(elapsed * 0.23) * 0.1 * (1 - pointer.active);
|
|
147
|
+
const tiltY = -pointer.y * 0.12 * pointer.active + Math.sin(elapsed * 0.17) * 0.05 * (1 - pointer.active);
|
|
148
|
+
tilt.x += (tiltX - tilt.x) * follow(2);
|
|
149
|
+
tilt.y += (tiltY - tilt.y) * follow(2);
|
|
150
|
+
dark.value += (dark.target - dark.value) * follow(6);
|
|
151
|
+
scene.look({ dark: dark.value });
|
|
152
|
+
scene.move({
|
|
153
|
+
time: elapsed,
|
|
154
|
+
dt,
|
|
155
|
+
intro: Math.min(elapsed / INTRO_SECONDS, 1),
|
|
156
|
+
pointer: [pointer.x, pointer.y],
|
|
157
|
+
pointerActive: pointer.active,
|
|
158
|
+
tilt: [tilt.x, tilt.y],
|
|
159
|
+
});
|
|
160
|
+
render(currentFrame);
|
|
161
|
+
});
|
|
162
|
+
// Only animate while the hero is on screen.
|
|
163
|
+
let loop;
|
|
164
|
+
const visibility = new IntersectionObserver(([entry]) => {
|
|
165
|
+
if (entry?.isIntersecting) {
|
|
166
|
+
// A lost device stops the loop for good; the fallback is back by then.
|
|
167
|
+
if (!lost)
|
|
168
|
+
loop ??= start();
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
loop?.stop();
|
|
172
|
+
loop = undefined;
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
visibility.observe(canvas);
|
|
176
|
+
onCleanup(() => {
|
|
177
|
+
visibility.disconnect();
|
|
178
|
+
loop?.stop();
|
|
179
|
+
});
|
|
180
|
+
})();
|
|
181
|
+
function watchTheme(onChange) {
|
|
182
|
+
const observer = new MutationObserver(onChange);
|
|
183
|
+
observer.observe(root, { attributes: true, attributeFilter: ["data-theme"] });
|
|
184
|
+
systemDark.addEventListener("change", onChange);
|
|
185
|
+
return () => {
|
|
186
|
+
observer.disconnect();
|
|
187
|
+
systemDark.removeEventListener("change", onChange);
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
return () => {
|
|
191
|
+
disposed = true;
|
|
192
|
+
for (const cleanup of cleanups.splice(0))
|
|
193
|
+
cleanup();
|
|
194
|
+
delete canvas.dataset.ready;
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
/** Draws the logo into pixels and samples its flow, then places the particles. */
|
|
198
|
+
async function loadField({ logo, flow }) {
|
|
199
|
+
const { image, viewBox } = await loadLogo(logo);
|
|
200
|
+
// Fit the logo into the square, keeping its shape.
|
|
201
|
+
const box = flow ? viewBoxSize(flow.viewBox) : viewBox ?? [image.naturalWidth || 1, image.naturalHeight || 1];
|
|
202
|
+
const scale = RASTER / Math.max(box[0], box[1]);
|
|
203
|
+
const offset = [(RASTER - box[0] * scale) / 2, (RASTER - box[1] * scale) / 2];
|
|
204
|
+
const raster = document.createElement("canvas");
|
|
205
|
+
raster.width = RASTER;
|
|
206
|
+
raster.height = RASTER;
|
|
207
|
+
const context = raster.getContext("2d", { willReadFrequently: true });
|
|
208
|
+
if (!context)
|
|
209
|
+
throw new Error("No 2D canvas");
|
|
210
|
+
context.drawImage(image, offset[0], offset[1], box[0] * scale, box[1] * scale);
|
|
211
|
+
// Throws for a cross-origin logo without CORS; the caller leaves the fallback in place.
|
|
212
|
+
const pixels = context.getImageData(0, 0, RASTER, RASTER);
|
|
213
|
+
return createParticleField(pixels, flow ? { flow: sampleFlow(flow, scale, offset) } : {});
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Loads the logo once. An SVG with only a viewBox has no natural size of its own (browsers report
|
|
217
|
+
* 0, or a default box that would squash it), so an SVG is read as text for its viewBox and drawn
|
|
218
|
+
* from that same text.
|
|
219
|
+
*/
|
|
220
|
+
async function loadLogo(url) {
|
|
221
|
+
const image = new Image();
|
|
222
|
+
image.crossOrigin = "anonymous";
|
|
223
|
+
if (!/\.svg(?:[?#]|$)/i.test(url)) {
|
|
224
|
+
image.src = url;
|
|
225
|
+
await image.decode();
|
|
226
|
+
return { image };
|
|
227
|
+
}
|
|
228
|
+
const response = await fetch(url);
|
|
229
|
+
if (!response.ok)
|
|
230
|
+
throw new Error(`Logo request failed: ${response.status}`);
|
|
231
|
+
const source = await response.text();
|
|
232
|
+
const objectUrl = URL.createObjectURL(new Blob([source], { type: "image/svg+xml" }));
|
|
233
|
+
try {
|
|
234
|
+
image.src = objectUrl;
|
|
235
|
+
await image.decode();
|
|
236
|
+
}
|
|
237
|
+
finally {
|
|
238
|
+
URL.revokeObjectURL(objectUrl);
|
|
239
|
+
}
|
|
240
|
+
const attribute = new DOMParser().parseFromString(source, "image/svg+xml").documentElement.getAttribute("viewBox");
|
|
241
|
+
const [, , width, height] = attribute?.trim().split(/[\s,]+/).map(Number) ?? [];
|
|
242
|
+
return width && height ? { image, viewBox: [width, height] } : { image };
|
|
243
|
+
}
|
|
244
|
+
function viewBoxSize(viewBox) {
|
|
245
|
+
return typeof viewBox === "number" ? [viewBox, viewBox] : viewBox;
|
|
246
|
+
}
|
|
247
|
+
/** Samples the flow's SVG path with the browser's own geometry, in raster pixels. */
|
|
248
|
+
function sampleFlow(flow, scale, offset) {
|
|
249
|
+
const namespace = "http://www.w3.org/2000/svg";
|
|
250
|
+
const svg = document.createElementNS(namespace, "svg");
|
|
251
|
+
const path = document.createElementNS(namespace, "path");
|
|
252
|
+
path.setAttribute("d", flow.path);
|
|
253
|
+
svg.append(path);
|
|
254
|
+
// Path geometry is only measured reliably while the element is in a document.
|
|
255
|
+
svg.style.cssText = "position:absolute;width:0;height:0;visibility:hidden";
|
|
256
|
+
document.body.append(svg);
|
|
257
|
+
try {
|
|
258
|
+
const length = path.getTotalLength();
|
|
259
|
+
const count = Math.max(Math.ceil(length), 2);
|
|
260
|
+
const points = Array.from({ length: count + 1 }, (_, i) => {
|
|
261
|
+
const point = path.getPointAtLength((i / count) * length);
|
|
262
|
+
return [offset[0] + point.x * scale, offset[1] + point.y * scale];
|
|
263
|
+
});
|
|
264
|
+
return { points, width: flow.width * scale };
|
|
265
|
+
}
|
|
266
|
+
finally {
|
|
267
|
+
svg.remove();
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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AO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,GAAG,KAAK,EAAE,CAAC;IAC/C,CAAC;YAAS,CAAC;QACT,GAAG,CAAC,MAAM,EAAE,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Floats per `Particle` in simulate.wgsl. */
|
|
2
|
+
export declare const PARTICLE_FLOATS = 16;
|
|
3
|
+
/** Floats per `Sprite` in simulate.wgsl and particles.wgsl. */
|
|
4
|
+
export declare const SPRITE_FLOATS = 8;
|
|
5
|
+
/** Floats per `FlowSample` in simulate.wgsl. */
|
|
6
|
+
export declare const FLOW_FLOATS = 8;
|
|
7
|
+
/** Samples along a flow, caps included. */
|
|
8
|
+
export declare const FLOW_SAMPLES = 256;
|
|
9
|
+
/** RGBA pixels of the logo, as from `ImageData` or a raw decode. */
|
|
10
|
+
export interface LogoPixels {
|
|
11
|
+
readonly data: Uint8ClampedArray | Uint8Array;
|
|
12
|
+
readonly width: number;
|
|
13
|
+
readonly height: number;
|
|
14
|
+
}
|
|
15
|
+
/** A stroke of the logo that flows, in the same pixel space as `LogoPixels`. */
|
|
16
|
+
export interface FlowStroke {
|
|
17
|
+
/** Points along the stroke's center line, closely spaced, from where the flow starts to where it ends. */
|
|
18
|
+
readonly points: readonly (readonly [number, number])[];
|
|
19
|
+
/** The stroke's width. The flow narrows into round caps past both ends, like `stroke-linecap: round`. */
|
|
20
|
+
readonly width: number;
|
|
21
|
+
}
|
|
22
|
+
export interface ParticleField {
|
|
23
|
+
readonly count: number;
|
|
24
|
+
readonly particles: Float32Array<ArrayBuffer>;
|
|
25
|
+
/** FLOW_SAMPLES samples when the field has a flow; one unused sample otherwise. */
|
|
26
|
+
readonly flow: Float32Array<ArrayBuffer>;
|
|
27
|
+
readonly flowSamples: number;
|
|
28
|
+
/** The logo's solid bounds, in pixels. */
|
|
29
|
+
readonly center: readonly [number, number];
|
|
30
|
+
readonly size: readonly [number, number];
|
|
31
|
+
}
|
|
32
|
+
/** Builds the particles for a logo. */
|
|
33
|
+
export declare function createParticleField(logo: LogoPixels, options?: {
|
|
34
|
+
flow?: FlowStroke;
|
|
35
|
+
}): ParticleField;
|