Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
perf(website): serve responsive wallpapers from Cloudflare R2
EtienneLescot2c64f7e0c17b
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.ymlindex ff31102d3..8565f14e9 100644--- a/.github/workflows/docs.yml+++ b/.github/workflows/docs.yml@@ -84,6 +84,9 @@ jobs:- name: Check demo loopsworking-directory: websiterun: npm run check:loops -- --live+ - name: Check responsive backgrounds+ working-directory: website+ run: npm run check:backgrounds -- --live# The recreation's data is generated from the app's own source and a# vendored project document. It is committed, so it can go stale in either# direction — a locale key moves, a timeline constant changes — and the@@ -145,4 +148,4 @@ jobs:id-token: writesteps:- id: deployment- uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0\ No newline at end of file+ uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0diff --git a/website/media/README.md b/website/media/README.mdindex cb864848d..c00cf7a67 100644--- a/website/media/README.md+++ b/website/media/README.md@@ -33,3 +33,24 @@ off. On the `getopenscreen.com` zone: a cache rule keeping the loops at theedge for a year with query strings out of the cache key, a WAF rule that servesonly GET/HEAD under `/loops/` with no query string, a 120 requests / 10 s per-IPrate limit, and billing alerts at any spend and at half of the free tier.++## Responsive backgrounds++The live homepage uses original wallpapers from `public/wallpapers/`, cropped+to 16:9 and encoded offline in AVIF (quality 80, 4:4:4, 10-bit) and WebP+(quality 90), at 960, 1920 and 2560 pixels wide. `<picture>` selects one format+and size; the driver retains two image layers and decodes the next background+before fading it in. Small picker thumbnails and the emergency JPEG fallbacks+remain local. CDN transforms are unnecessary.++1. `node scripts/media/encode-backgrounds.mjs --dir <out>`+2. `node scripts/media/publish-backgrounds.mjs --cut <yyyy-mm><letter> --dir <out>`+3. `npm run check:backgrounds -- --live`, then commit `backgrounds.json` and+ `src/lib/background-media.ts`. The manifest records source hashes, encoder+ settings, dimensions, byte sizes and output hashes. Each file is capped at+ 120 KB. Never rewrite a published cut or request it before uploading.++Backgrounds live under `/loops/backgrounds/<cut>/`, reusing the custom domain's+existing WAF and year-long cache rules for GET/HEAD under `/loops/` without+query strings. The bucket, rate limit and billing alerts are shared; no new+Cloudflare product or cache/WAF rule is required. `masters/` remains private.diff --git a/website/media/backgrounds.json b/website/media/backgrounds.jsonnew file mode 100644index 000000000..6aec2e09b--- /dev/null+++ b/website/media/backgrounds.json@@ -0,0 +1,182 @@+{+ "cut": "2026-10a",+ "base": "https://media.getopenscreen.com/loops/backgrounds/2026-10a",+ "sources": [+ {+ "path": "public/wallpapers/wallpaper2.jpg",+ "sha256": "0a841d3d70b0282706abc764e40fb19b1468c39adc8b1b7a7390d279ac899c06"+ },+ {+ "path": "public/wallpapers/wallpaper5.jpg",+ "sha256": "1a24ef74b68cd68c57421352223cd3ee2c8e24cce815c94c116ee6343e2a9429"+ },+ {+ "path": "public/wallpapers/wallpaper8.jpg",+ "sha256": "1310c9d66385e9ecb41309e186c2f83dfb612a9c3ee2fccb59cfb4d3e853d90c"+ },+ {+ "path": "public/wallpapers/wallpaper11.jpg",+ "sha256": "8224024049d8044878020e50447c2974b855ee3fc8d69bee5c95a0d652833dfb"+ }+ ],+ "encoder": {+ "sharp": "0.35.4",+ "avif": {+ "quality": 80,+ "effort": 6,+ "chromaSubsampling": "4:4:4",+ "bitdepth": 10+ },+ "webp": {+ "quality": 90,+ "effort": 6,+ "smartSubsample": true+ }+ },+ "files": {+ "bg-1-960.avif": {+ "bytes": 13892,+ "width": 960,+ "height": 540,+ "sha256": "db8645812a9fdac76b1113a15114ba3f3a699ed567d842c71aa40d44241e10c6"+ },+ "bg-1-960.webp": {+ "bytes": 20436,+ "width": 960,+ "height": 540,+ "sha256": "c6368eda97c246723203cda2243bcb4a019fd3b1fa9334608a6ba473d0a93a65"+ },+ "bg-1-1920.avif": {+ "bytes": 32577,+ "width": 1920,+ "height": 1080,+ "sha256": "6d52c6acf9a795f983ad4bd9f16073e6d2e0419cd8e039358e695a1a98f983ec"+ },+ "bg-1-1920.webp": {+ "bytes": 48794,+ "width": 1920,+ "height": 1080,+ "sha256": "8b03b985c8506458cf029f33c0b27fb12132b0879bef3b8e11eb2428c75acc04"+ },+ "bg-1-2560.avif": {+ "bytes": 48725,+ "width": 2560,+ "height": 1440,+ "sha256": "be54006d49b90398650cb5979d4512e20bef752b396ca74ac6fda71f7891ef69"+ },+ "bg-1-2560.webp": {+ "bytes": 71392,+ "width": 2560,+ "height": 1440,+ "sha256": "b839687d148b38c7e6206cdf21827a98ff8c26d68b5c3f54ce04b3b81e37fd2d"+ },+ "bg-2-960.avif": {+ "bytes": 11465,+ "width": 960,+ "height": 540,+ "sha256": "48820969f49f3ee547d21ab520ae36c3926918678bd12dfc4c6f4ea11079f321"+ },+ "bg-2-960.webp": {+ "bytes": 18902,+ "width": 960,+ "height": 540,+ "sha256": "7491c80af7d0f434dc0ff7841909727e5a7803f95bdb6b1e5f85d21fecf1f3e5"+ },+ "bg-2-1920.avif": {+ "bytes": 46312,+ "width": 1920,+ "height": 1080,+ "sha256": "7942f65f4bd24757c1cb1735cceaa10651f5c979df68b3fda9c3d13ff8073867"+ },+ "bg-2-1920.webp": {+ "bytes": 55880,+ "width": 1920,+ "height": 1080,+ "sha256": "59b5c66401332740def4fc6efbbc4f301ac1c09f0fc8bf003abde08edaf31b24"+ },+ "bg-2-2560.avif": {+ "bytes": 92043,+ "width": 2560,+ "height": 1440,+ "sha256": "e73772de7c0a6ac850764958580eb3d794c6e47e8d2422a79bf149d18c96e4f3"+ },+ "bg-2-2560.webp": {+ "bytes": 91988,+ "width": 2560,+ "height": 1440,+ "sha256": "4dbde134e0c6e094939b25b07790b436976e90712021306a364f77b399fdb459"+ },+ "bg-3-960.avif": {+ "bytes": 11708,+ "width": 960,+ "height": 540,+ "sha256": "203b231ebde26eb8469a8b0ccd2800902704934412dfcbbbbe6501ecf3bf12df"+ },+ "bg-3-960.webp": {+ "bytes": 17022,+ "width": 960,+ "height": 540,+ "sha256": "998861eb9e4a9cce00e7043dcf22842e4812eb05d900d627fdbb6f9543178007"+ },+ "bg-3-1920.avif": {+ "bytes": 35963,+ "width": 1920,+ "height": 1080,+ "sha256": "afdcb77d2ff634c32dd5076a4daa9d58769ef356dbb304fb0e16c63ee0e979a3"+ },+ "bg-3-1920.webp": {+ "bytes": 46942,+ "width": 1920,+ "height": 1080,+ "sha256": "02163a3eea63a7e66901bd7c04af4ba2fb5a4c1c5cd354777c973074e9e7c596"+ },+ "bg-3-2560.avif": {+ "bytes": 66082,+ "width": 2560,+ "height": 1440,+ "sha256": "480a05d1b89712d334598de88840c951e524692fa72b074840de8e146c262aac"+ },+ "bg-3-2560.webp": {+ "bytes": 69668,+ "width": 2560,+ "height": 1440,+ "sha256": "d09ef5ed9dbc2027f3f08b072cc081bc7c6610a8a88fbad99d53a83bacee4734"+ },+ "bg-4-960.avif": {+ "bytes": 16401,+ "width": 960,+ "height": 540,+ "sha256": "88faa4f459e9c18f2164f418043ae7f5398617a150088838f22bcc8d82cb922c"+ },+ "bg-4-960.webp": {+ "bytes": 25330,+ "width": 960,+ "height": 540,+ "sha256": "f61bb6fbe5254cce4e86bbd3b9cfebdd2d96856f5bdd4d78c1ceed53191ee267"+ },+ "bg-4-1920.avif": {+ "bytes": 39291,+ "width": 1920,+ "height": 1080,+ "sha256": "8b83a3ccd6f6b45480e080307e1a31b7e197639f7ca36aa2c3a73af6ecb129f5"+ },+ "bg-4-1920.webp": {+ "bytes": 62498,+ "width": 1920,+ "height": 1080,+ "sha256": "531f87d4afd6753217439616e86d65b4f5ea0a1e37af156f63a2d34a4bf8dab8"+ },+ "bg-4-2560.avif": {+ "bytes": 57882,+ "width": 2560,+ "height": 1440,+ "sha256": "875843b37a7fb3e2d3c491bf9838689e6f9ca0ad322c9cf55090673951bd0bcf"+ },+ "bg-4-2560.webp": {+ "bytes": 89628,+ "width": 2560,+ "height": 1440,+ "sha256": "7bb94eeaeae99b4df980b201d979f752b851dadb9eaf3d61421ead2c77db6005"+ }+ }+}diff --git a/website/package-lock.json b/website/package-lock.jsonindex 4b13dc1c2..99e29127c 100644--- a/website/package-lock.json+++ b/website/package-lock.json@@ -24,6 +24,7 @@"@docusaurus/module-type-aliases": "~3.10.1","@docusaurus/tsconfig": "~3.10.1","@docusaurus/types": "~3.10.1",+ "sharp": "^0.35.4","typescript": "~5.6.2"},"engines": {@@ -4182,6 +4183,533 @@"@hapi/hoek": "^9.0.0"}},+ "node_modules/@img/colour": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.1.0.tgz",+ "integrity": "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@img/sharp-darwin-arm64": {+ "version": "0.35.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.35.4.tgz",+ "integrity": "sha512-Uhfl4V4lhP2nbUVF9+hyH1+luj86f1gUFeo8ALYxFoULoU+G87D43BfeMP8XHsk9boxAnCY/bf2EHwhA7MuGsA==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-darwin-arm64": "1.3.3"+ }+ },+ "node_modules/@img/sharp-darwin-x64": {+ "version": "0.35.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.35.4.tgz",+ "integrity": "sha512-hWniXY3bG5qKpkKrAwPe4y+VTPmf086YQAnkxWh7uA1YrlRouWGa0M0Mxj3ZjnXFkv7/TD1bTy9lGUK26vRvWw==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-darwin-x64": "1.3.3"+ }+ },+ "node_modules/@img/sharp-freebsd-wasm32": {+ "version": "0.35.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-freebsd-wasm32/-/sharp-freebsd-wasm32-0.35.4.tgz",+ "integrity": "sha512-lIsKw/BU+kjB4eZjxrYrZmwOJYi3Ajrv66iAlBmUPyKc3HpnloevB1g3wxGD9P/5BbQ1brBGl65VRRrCvQDEqA==",+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "freebsd"+ ],+ "dependencies": {+ "@img/sharp-wasm32": "0.35.4"+ },+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-darwin-arm64": {+ "version": "1.3.3",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.3.3.tgz",+ "integrity": "sha512-suTBPTDGrI9WodccaDdwZItTSaBYASlBk1NSfElSHrUfzu3szG6lvIF58+WiFvnfzuK8ZBFS5zE00PxqxnRiPg==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "darwin"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-darwin-x64": {+ "version": "1.3.3",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.3.3.tgz",+ "integrity": "sha512-FVJZ5mITMobmXIz/hPDTw0EintTW5H3WfrxwLqEqjiIihlu+hVRyGrFQ60xl0Lxn7Bt3zdpevPaQi0HEzqz9fw==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "darwin"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-arm": {+ "version": "1.3.3",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.3.3.tgz",+ "integrity": "sha512-3rbU4vqXXc3hY/OiXdl52xZvT0F1yEngWfvqudtPJg/KkyiaQw2DRsFrNzpmLvfavbwOq3qXn36GP8obHRULQA==",+ "cpu": [+ "arm"+ ],+ "dev": true,+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-arm64": {+ "version": "1.3.3",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.3.3.tgz",+ "integrity": "sha512-0DaL0A6Xu6sQSQFwe4iVCrKWU2cCTItnRsYsCdxAMm9NF6twAA9BKnoqy4hqz4+azQ0JHuA26qiUKsf1XJ/v5A==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-ppc64": {+ "version": "1.3.3",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.3.3.tgz",+ "integrity": "sha512-cdn1OvUBwsXhbC0zSzJnNzf5MZ/mTrobawDvNXBTxe8VtqKAm0sRuEY2Evzovb/w9JMk4TvRxqt1mekSuJz64w==",+ "cpu": [+ "ppc64"+ ],+ "dev": true,+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-riscv64": {+ "version": "1.3.3",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-riscv64/-/sharp-libvips-linux-riscv64-1.3.3.tgz",+ "integrity": "sha512-HjPVx7yKz+0lqdhDlTw1tt90wamBoxhiXpvl1XZpJLiHH4RCJ5yDTqH+VlYPv2fwFs89JFw4c1IexYOcQUi4IQ==",+ "cpu": [+ "riscv64"+ ],+ "dev": true,+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-s390x": {+ "version": "1.3.3",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.3.3.tgz",+ "integrity": "sha512-neWLh+3yCNThxnfy3c4BbVBeGgt9aftno+XbT56iK28RgeDs3UOFWviLWlUu0bArYVYJaFDK+RRohbicUNCm8Q==",+ "cpu": [+ "s390x"+ ],+ "dev": true,+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-x64": {+ "version": "1.3.3",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.3.3.tgz",+ "integrity": "sha512-4vKmvAst9nrowcqquKFAyZJUDolUaIp8uRiN0mWFguJ1IplC9/pitXtlnnlU4aa/eJw3J7i67V+pwUL+wZGdsA==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linuxmusl-arm64": {+ "version": "1.3.3",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.3.3.tgz",+ "integrity": "sha512-Y9kQaLMuNoB0bPYOOdcZMaseNrFpPodIWWMrx+CZyydf2xn68j9WYc6sWWRrDwNkzCQjKYfc68L7jKjGlHMibw==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linuxmusl-x64": {+ "version": "1.3.3",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.3.3.tgz",+ "integrity": "sha512-fj8Mv0HHfD1Rr+4I68+3agJynxDWtBFgicTbSOb9Bke6pIwzGcJ+RX/yHjmiEGFMCavY/dxvem7MyNaJF+wDiw==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-linux-arm": {+ "version": "0.35.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.35.4.tgz",+ "integrity": "sha512-7OAS8gI0EReKGVN2HssHlM6umJgxF5VI3xN0p9FA91p/YO+ou5hiNghLdZ5BEHztwaaK5+bLKRf8x/o2L2nk9A==",+ "cpu": [+ "arm"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-arm": "1.3.3"+ }+ },+ "node_modules/@img/sharp-linux-arm64": {+ "version": "0.35.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.35.4.tgz",+ "integrity": "sha512-De4jpEnAU8Hd5oT0j1G3uL4ZvTuipVMn7YC6vPaJhy6/7EwEae0SVAoBrUMYQbkLGDm85taVWwuPc1a44LTzCQ==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-arm64": "1.3.3"+ }+ },+ "node_modules/@img/sharp-linux-ppc64": {+ "version": "0.35.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.35.4.tgz",+ "integrity": "sha512-2oYZJeIl4kCcMGk4ouZVjnkCtFrpQFlNEtJ6GbxzhHQchwH0NH/qEb9ykmOl29dqwMq+JhFdZn+1ak2FKhI9fQ==",+ "cpu": [+ "ppc64"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-ppc64": "1.3.3"+ }+ },+ "node_modules/@img/sharp-linux-riscv64": {+ "version": "0.35.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-riscv64/-/sharp-linux-riscv64-0.35.4.tgz",+ "integrity": "sha512-cPbNChoRURAWdebDIHSenxRpgEdy7JkPydSnUxRm9VvKD7m0/xVaR/8Fzlu81pk5nHEvHH87UZUA7cTtwnbJSA==",+ "cpu": [+ "riscv64"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-riscv64": "1.3.3"+ }+ },+ "node_modules/@img/sharp-linux-s390x": {+ "version": "0.35.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.35.4.tgz",+ "integrity": "sha512-RY0JFY8Fd6RonCBtHz+DvadaPkXDSI1AUn6yWL9TipqkZ1vY8w8evqdgyDFnkm4/K1ve1TvZiaePP5oSd4+WVQ==",+ "cpu": [+ "s390x"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-s390x": "1.3.3"+ }+ },+ "node_modules/@img/sharp-linux-x64": {+ "version": "0.35.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.35.4.tgz",+ "integrity": "sha512-9qvvEAuk8k89TfWUoX2htWjbAMX8p+NxCppjpcg5k6xMsjhBQPTsoIh36h9Qde4WRuGpJeYnOjdosDn/cnv+OA==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-x64": "1.3.3"+ }+ },+ "node_modules/@img/sharp-linuxmusl-arm64": {+ "version": "0.35.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.35.4.tgz",+ "integrity": "sha512-KB5jxpfWQTr0nc3xdHtWChdbifHrBGsd2SM62Eyxrl8afikm+f5qGBU75SJIZBT/S1MC8XyacdlXBMSWq6OURA==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linuxmusl-arm64": "1.3.3"+ }+ },+ "node_modules/@img/sharp-linuxmusl-x64": {+ "version": "0.35.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.35.4.tgz",+ "integrity": "sha512-f+eZJZIQNEEd26RPSW+76chwOf1XtA2Y/O+5ocVyLliHkeih3e+jhLVBdNTd2rS3IbNXK8+ug93Vf5ZXtF5Lxg==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linuxmusl-x64": "1.3.3"+ }+ },+ "node_modules/@img/sharp-wasm32": {+ "version": "0.35.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.35.4.tgz",+ "integrity": "sha512-zQnl4Kwp7Q6NHsENtU2T/00Zi+w3AQNwz3+UaTyVBy2FpXrzXzGjndpK61onhZjRtRpQXxCTeqw19bVyXOh7jA==",+ "dev": true,+ "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT",+ "optional": true,+ "dependencies": {+ "@emnapi/runtime": "^1.11.3"+ },+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-webcontainers-wasm32": {+ "version": "0.35.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-webcontainers-wasm32/-/sharp-webcontainers-wasm32-0.35.4.tgz",+ "integrity": "sha512-ESfNkywmCfPNyaZjxooddJQiQ+l/nTpGEOGthxiLnIHXC/CmcBixnfwUleX9mCz9ovrUUvKMap/pm8RYbzfwaA==",+ "cpu": [+ "wasm32"+ ],+ "dev": true,+ "license": "Apache-2.0",+ "optional": true,+ "dependencies": {+ "@img/sharp-wasm32": "0.35.4"+ },+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-win32-arm64": {+ "version": "0.35.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.35.4.tgz",+ "integrity": "sha512-iNdlBX9gLVvqe2I3uIJSIKTq6wckP/DYxZtcqxm09x5Gi24DnFBmPAWZmr60ZyYMG0xlzo6goG3670ar+RXvRw==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "Apache-2.0 AND LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-win32-ia32": {+ "version": "0.35.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.35.4.tgz",+ "integrity": "sha512-kqRsbaa5CS6KHlpxnN7WhE6vAAugXyZButpRdvDWetlv6Qv4N9WTcrWzF7tXfB9T7MsoadqdI8hmwLq6UlLvtw==",+ "cpu": [+ "ia32"+ ],+ "dev": true,+ "license": "Apache-2.0 AND LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": "^20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-win32-x64": {+ "version": "0.35.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.35.4.tgz",+ "integrity": "sha512-XtmnYhBcrORsJ4XJngyzr/EWP0hRZLAZRFaApdKuviyqF78+ylxh2y06ZmtULAMOnObJ3ucpN0AcwSWnMowTRg==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "Apache-2.0 AND LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },"node_modules/@jest/schemas": {"version": "29.6.3","resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz",@@ -17527,6 +18055,56 @@"integrity": "sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==","license": "MIT"},+ "node_modules/sharp": {+ "version": "0.35.4",+ "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.35.4.tgz",+ "integrity": "sha512-n++8XWcj+jCOr2IOl7h8LbKnGBDY4aPbmprMONBNFdn0ImXqpGVv5zliDs0V9HbmbCQLpbuo2ej9rAoOQTvMDA==",+ "dev": true,+ "license": "Apache-2.0",+ "dependencies": {+ "@img/colour": "^1.1.0",+ "detect-libc": "^2.1.2",+ "semver": "^7.8.5"+ },+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-darwin-arm64": "0.35.4",+ "@img/sharp-darwin-x64": "0.35.4",+ "@img/sharp-freebsd-wasm32": "0.35.4",+ "@img/sharp-libvips-darwin-arm64": "1.3.3",+ "@img/sharp-libvips-darwin-x64": "1.3.3",+ "@img/sharp-libvips-linux-arm": "1.3.3",+ "@img/sharp-libvips-linux-arm64": "1.3.3",+ "@img/sharp-libvips-linux-ppc64": "1.3.3",+ "@img/sharp-libvips-linux-riscv64": "1.3.3",+ "@img/sharp-libvips-linux-s390x": "1.3.3",+ "@img/sharp-libvips-linux-x64": "1.3.3",+ "@img/sharp-libvips-linuxmusl-arm64": "1.3.3",+ "@img/sharp-libvips-linuxmusl-x64": "1.3.3",+ "@img/sharp-linux-arm": "0.35.4",+ "@img/sharp-linux-arm64": "0.35.4",+ "@img/sharp-linux-ppc64": "0.35.4",+ "@img/sharp-linux-riscv64": "0.35.4",+ "@img/sharp-linux-s390x": "0.35.4",+ "@img/sharp-linux-x64": "0.35.4",+ "@img/sharp-linuxmusl-arm64": "0.35.4",+ "@img/sharp-linuxmusl-x64": "0.35.4",+ "@img/sharp-webcontainers-wasm32": "0.35.4",+ "@img/sharp-win32-arm64": "0.35.4",+ "@img/sharp-win32-ia32": "0.35.4",+ "@img/sharp-win32-x64": "0.35.4"+ },+ "peerDependenciesMeta": {+ "@types/node": {+ "optional": true+ }+ }+ },"node_modules/shebang-command": {"version": "2.0.0","resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",diff --git a/website/package.json b/website/package.jsonindex 8e0a4fccb..01d46f3a4 100644--- a/website/package.json+++ b/website/package.json@@ -14,7 +14,8 @@"i18n:check": "node scripts/i18n.mjs check","i18n:sync": "node scripts/i18n.mjs sync","test": "node --disable-warning=MODULE_TYPELESS_PACKAGE_JSON --test \"src/**/*.test.ts\"",- "check:loops": "node --disable-warning=MODULE_TYPELESS_PACKAGE_JSON scripts/check-loops.mjs"+ "check:loops": "node --disable-warning=MODULE_TYPELESS_PACKAGE_JSON scripts/check-loops.mjs",+ "check:backgrounds": "node --disable-warning=MODULE_TYPELESS_PACKAGE_JSON scripts/check-backgrounds.mjs"},"dependencies": {"@docusaurus/core": "~3.10.1",@@ -33,6 +34,7 @@"@docusaurus/module-type-aliases": "~3.10.1","@docusaurus/tsconfig": "~3.10.1","@docusaurus/types": "~3.10.1",+ "sharp": "^0.35.4","typescript": "~5.6.2"},"browserslist": {diff --git a/website/scripts/check-backgrounds.mjs b/website/scripts/check-backgrounds.mjsnew file mode 100644index 000000000..615f99b08--- /dev/null+++ b/website/scripts/check-backgrounds.mjs@@ -0,0 +1,68 @@+#!/usr/bin/env node+/** Hold the responsive wallpaper URLs to their immutable publication manifest. */+import { readFileSync } from "node:fs";+import { resolve } from "node:path";+import {+ BACKGROUND_BASE,+ BACKGROUND_WALLPAPERS,+ BACKGROUND_WIDTHS,+} from "../src/lib/background-media.ts";++const manifest = JSON.parse(+ readFileSync(resolve(import.meta.dirname, "../media/backgrounds.json"), "utf8"),+);+const live = process.argv.includes("--live");+const problems = [];+if (manifest.base !== BACKGROUND_BASE)+ problems.push("background manifest and code point at different cuts");+const names = BACKGROUND_WALLPAPERS.flatMap((_, index) =>+ BACKGROUND_WIDTHS.flatMap((width) =>+ ["avif", "webp"].map((format) => `bg-${index + 1}-${width}.${format}`),+ ),+);+if (Object.keys(manifest.files).length !== names.length)+ problems.push("unexpected number of variants");+for (const name of names) {+ const file = manifest.files[name];+ const width = Number(name.match(/-(\d+)\./)[1]);+ if (+ !file ||+ file.width !== width ||+ file.height !== Math.round((width * 9) / 16) ||+ file.bytes <= 0 ||+ file.bytes > 120_000 ||+ !/^[a-f0-9]{64}$/.test(file.sha256)+ ) {+ problems.push(`${name}: missing or invalid publication record`);+ }+}+if (live && problems.length === 0) {+ // Share the video's conservative pacing, below the zone's 120 requests / 10 s.+ for (let offset = 0; offset < names.length; offset += 6) {+ if (offset) await new Promise((resolve) => setTimeout(resolve, 750));+ await Promise.all(+ names.slice(offset, offset + 6).map(async (name) => {+ try {+ const response = await fetch(`${BACKGROUND_BASE}/${name}`, {+ method: "HEAD",+ signal: AbortSignal.timeout(15_000),+ });+ if (!response.ok) problems.push(`${name}: HTTP ${response.status}`);+ else if (+ Number(response.headers.get("content-length")) !== manifest.files[name].bytes ||+ response.headers.get("content-type")?.split(";")[0] !==+ `image/${name.split(".").at(-1)}`+ ) {+ problems.push(`${name}: served size or format differs from its record`);+ }+ } catch (error) {+ problems.push(`${name}: ${error.message}`);+ }+ }),+ );+ }+}+if (problems.length) throw new Error(`Backgrounds: ${problems.join("\n")}`);+console.log(+ `Backgrounds OK: ${names.length} variants${live ? ", all live at their recorded sizes" : ""}`,+);diff --git a/website/scripts/media/encode-backgrounds.mjs b/website/scripts/media/encode-backgrounds.mjsnew file mode 100644index 000000000..c35392de8--- /dev/null+++ b/website/scripts/media/encode-backgrounds.mjs@@ -0,0 +1,32 @@+#!/usr/bin/env node+/** node scripts/media/encode-backgrounds.mjs --dir <output>; originals stay in public/wallpapers. */+import { mkdir, writeFile } from "node:fs/promises";+import { resolve } from "node:path";+import { parseArgs } from "node:util";+import sharp from "sharp";+import { BACKGROUND_WALLPAPERS, BACKGROUND_WIDTHS } from "../../src/lib/background-media.ts";++const { values } = parseArgs({ options: { dir: { type: "string" } } });+if (!values.dir) throw new Error("usage: encode-backgrounds.mjs --dir <output>");+const dir = resolve(values.dir);+await mkdir(dir, { recursive: true });+const root = resolve(import.meta.dirname, "../../..");+// Run sequentially: AV1 encoding is an offline task, not a reason to monopolise the developer's CPU.+for (const [index, wallpaper] of BACKGROUND_WALLPAPERS.entries()) {+ for (const width of BACKGROUND_WIDTHS) {+ const source = resolve(root, "public/wallpapers", `wallpaper${wallpaper}.jpg`);+ const resized = sharp(source).resize(width, Math.round((width * 9) / 16), { fit: "cover" });+ for (const format of ["avif", "webp"]) {+ const image = resized.clone();+ const output =+ format === "avif"+ ? await image+ .avif({ quality: 80, effort: 6, chromaSubsampling: "4:4:4", bitdepth: 10 })+ .toBuffer()+ : await image.webp({ quality: 90, effort: 6, smartSubsample: true }).toBuffer();+ const name = `bg-${index + 1}-${width}.${format}`;+ await writeFile(resolve(dir, name), output);+ console.log(`${name}: ${output.length} B`);+ }+ }+}diff --git a/website/scripts/media/publish-backgrounds.mjs b/website/scripts/media/publish-backgrounds.mjsnew file mode 100644index 000000000..1bec59705--- /dev/null+++ b/website/scripts/media/publish-backgrounds.mjs@@ -0,0 +1,149 @@+#!/usr/bin/env node+/** Immutable responsive wallpaper cut. Upload before requesting its public URLs.+ * node scripts/media/publish-backgrounds.mjs --cut 2026-10a --dir <encoded files>+ * --no-upload prepares the manifest offline; it does not publish any assets.+ * CF_CLI can name the cf CLI's JS entry point when its executable is not on PATH.+ */+import { execFileSync } from "node:child_process";+import { createHash } from "node:crypto";+import { readdirSync, readFileSync, writeFileSync } from "node:fs";+import { join, resolve } from "node:path";+import { parseArgs } from "node:util";+import sharp from "sharp";++import { BACKGROUND_WALLPAPERS, BACKGROUND_WIDTHS } from "../../src/lib/background-media.ts";++const { values } = parseArgs({+ options: {+ cut: { type: "string" },+ dir: { type: "string" },+ "no-upload": { type: "boolean" },+ },+});+if (!values.dir || !values.cut || !/^[0-9a-z-]+$/.test(values.cut)) {+ throw new Error(+ "usage: publish-backgrounds.mjs --cut <folder> --dir <encoded files> [--no-upload]",+ );+}+const root = resolve(import.meta.dirname, "../..");+const dir = resolve(values.dir);+// Reuse the existing public /loops/ namespace and its year-long edge cache.+const prefix = `loops/backgrounds/${values.cut}/`;+const names = BACKGROUND_WALLPAPERS.flatMap((_, index) =>+ BACKGROUND_WIDTHS.flatMap((width) =>+ ["avif", "webp"].map((format) => `bg-${index + 1}-${width}.${format}`),+ ),+);+const actual = readdirSync(dir).filter((name) => /\.(avif|webp)$/.test(name));+if (actual.length !== names.length || actual.some((name) => !names.includes(name))) {+ throw new Error("Incomplete or unexpected background variants; nothing uploaded or written");+}+const files = {};+const hashes = {};+for (const name of names) {+ const bytes = readFileSync(join(dir, name));+ const image = await sharp(bytes).metadata();+ const width = Number(name.match(/-(\d+)\./)[1]);+ if (+ image.width !== width ||+ image.height !== Math.round((width * 9) / 16) ||+ bytes.length > 120_000+ ) {+ throw new Error(`${name}: unexpected dimensions or exceeds 120 KB`);+ }+ files[name] = {+ bytes: bytes.length,+ width: image.width,+ height: image.height,+ sha256: createHash("sha256").update(bytes).digest("hex"),+ };+ hashes[name] = createHash("md5").update(bytes).digest("hex");+}++if (!values["no-upload"]) {+ const cf = (args) =>+ execFileSync(+ process.env.CF_CLI ? process.execPath : "cf",+ process.env.CF_CLI ? [process.env.CF_CLI, ...args] : args,+ { encoding: "utf8", maxBuffer: 1 << 24 },+ );+ const listed = JSON.parse(+ cf([+ "r2",+ "objects",+ "list",+ "--bucket-name",+ "openscreen-media",+ "--prefix",+ prefix,+ "--per-page",+ "1000",+ ]),+ );+ if (!Array.isArray(listed) || listed.length >= 1000)+ throw new Error("Unrecognized or truncated R2 listing");+ const remote = new Map(listed.map((object) => [object.key.slice(prefix.length), object]));+ for (const [name, object] of remote) {+ if (!files[name] || object.etag.replaceAll('"', "") !== hashes[name]) {+ throw new Error(`${prefix} is already published with different bytes; use a new cut`);+ }+ }+ for (const name of names) {+ if (!remote.has(name)) {+ cf([+ "r2",+ "objects",+ "put",+ `${prefix}${name}`,+ "--bucket-name",+ "openscreen-media",+ "--file",+ join(dir, name),+ "--content-type",+ `image/${name.split(".").at(-1)}`,+ "-q",+ ]);+ }+ console.log(`${remote.has(name) ? "already there" : "uploaded"}: ${name}`);+ }+}++const base = `https://media.getopenscreen.com/${prefix.slice(0, -1)}`;+const sources = BACKGROUND_WALLPAPERS.map((wallpaper) => {+ const path = `public/wallpapers/wallpaper${wallpaper}.jpg`;+ return {+ path,+ sha256: createHash("sha256")+ .update(readFileSync(resolve(root, "..", path)))+ .digest("hex"),+ };+});+writeFileSync(+ resolve(root, "media/backgrounds.json"),+ `${JSON.stringify(+ {+ cut: values.cut,+ base,+ sources,+ encoder: {+ sharp: sharp.versions.sharp,+ avif: { quality: 80, effort: 6, chromaSubsampling: "4:4:4", bitdepth: 10 },+ webp: { quality: 90, effort: 6, smartSubsample: true },+ },+ files,+ },+ null,+ "\t",+ )}\n`,+);+const libPath = resolve(root, "src/lib/background-media.ts");+writeFileSync(+ libPath,+ readFileSync(libPath, "utf8").replace(+ /export const BACKGROUND_BASE = "[^"]+";/,+ `export const BACKGROUND_BASE = "${base}";`,+ ),+);+console.log(+ `${names.length} variants recorded${values["no-upload"] ? " offline; upload before using the CDN URLs" : " and published"}`,+);diff --git a/website/src/components/Recreation/backgrounds.test.ts b/website/src/components/Recreation/backgrounds.test.tsnew file mode 100644index 000000000..e5c9170d4--- /dev/null+++ b/website/src/components/Recreation/backgrounds.test.ts@@ -0,0 +1,115 @@+import assert from "node:assert/strict";+import { test } from "node:test";++import { type BackgroundLayer, createBackgrounds } from "./backgrounds.ts";++function deferred() {+ let resolve!: () => void;+ let reject!: () => void;+ const promise = new Promise<void>((yes, no) => {+ resolve = yes;+ reject = no;+ });+ return { promise, resolve, reject };+}++const flush = () => new Promise<void>((resolve) => setImmediate(resolve));+function harness() {+ const loads: { slot: number; index: number; done: ReturnType<typeof deferred> }[] = [];+ const paints: { slot: number; visible: boolean; foreground: boolean }[] = [];+ const fades: ReturnType<typeof deferred>[] = [];+ const layers = [0, 1].map(+ (slot): BackgroundLayer => ({+ load(index) {+ const done = deferred();+ loads.push({ slot, index, done });+ return done.promise;+ },+ show(visible, foreground = false) {+ paints.push({ slot, visible, foreground });+ },+ }),+ ) as [BackgroundLayer, BackgroundLayer];+ const controller = createBackgrounds(layers, 3, () => {+ const fade = deferred();+ fades.push(fade);+ return fade.promise;+ });+ return { controller, loads, paints, fades };+}++test("keep the painted wallpaper until the new one decodes, then hold it through the fade", async () => {+ const h = harness();+ h.controller.show(0);+ assert.equal(h.loads.length, 1);+ assert.deepEqual(h.paints, []);+ h.loads[0].done.resolve();+ await flush();+ assert.deepEqual(h.paints, [+ { slot: 0, visible: true, foreground: false },+ { slot: 1, visible: true, foreground: true },+ ]);+ assert.equal(h.loads.length, 1, "do not replace the outgoing bitmap mid-fade");+ h.fades[0].resolve();+ await flush();+ assert.deepEqual(h.paints.at(-1), { slot: 0, visible: false, foreground: false });+ assert.equal(h.loads[1].index, 1, "only the next wallpaper is prepared");+ h.controller.dispose();+});++test("rapid scroll during decode skips obsolete wallpapers", async () => {+ const h = harness();+ h.controller.show(0);+ h.controller.show(1);+ h.controller.show(2);+ h.loads[0].done.resolve();+ await flush();+ assert.deepEqual(h.paints, []);+ assert.equal(h.loads[1].index, 2);+ h.loads[1].done.resolve();+ await flush();+ assert.equal(h.paints.at(-1)?.foreground, true);+ assert.equal(h.loads.length, 2);+ h.controller.dispose();+ h.fades[0].resolve();+});++test("scrolling back during a fade waits for it, then decodes only the latest request", async () => {+ const h = harness();+ h.controller.show(0);+ h.loads[0].done.resolve();+ await flush();+ h.controller.show(1);+ h.controller.show(2);+ assert.equal(h.loads.length, 1);+ h.fades[0].resolve();+ await flush();+ assert.equal(h.loads[1].index, 2);+ assert.equal(h.loads[1].slot, 0);+ h.controller.dispose();+ h.loads[1].done.resolve();+});++test("a failed download retains the current picture and a later scroll can recover", async () => {+ const h = harness();+ h.controller.show(0);+ h.loads[0].done.reject();+ await flush();+ assert.deepEqual(h.paints, []);+ h.controller.show(2);+ h.loads[1].done.resolve();+ await flush();+ assert.equal(h.paints.at(-1)?.foreground, true);+ h.controller.dispose();+ h.fades[0].resolve();+});++test("detaching during decode prevents a stale driver from changing the scene", async () => {+ const h = harness();+ h.controller.show(0);+ h.controller.dispose();+ h.loads[0].done.resolve();+ await flush();+ assert.deepEqual(h.paints, []);+ assert.equal(h.loads.length, 1);+});diff --git a/website/src/components/Recreation/backgrounds.ts b/website/src/components/Recreation/backgrounds.tsnew file mode 100644index 000000000..d988286a4--- /dev/null+++ b/website/src/components/Recreation/backgrounds.ts@@ -0,0 +1,149 @@+import {+ BACKGROUND_FADE_MS,+ BACKGROUND_SIZES,+ BACKGROUND_WALLPAPERS,+ backgroundFallback,+ backgroundSrcSet,+} from "../../lib/background-media.ts";++export interface BackgroundLayer {+ load: (index: number) => Promise<void>;+ show: (visible: boolean, foreground?: boolean) => void;+}++/** Two decoded layers: keep the current picture until its replacement is ready.+ * Requests during a decode or fade collapse to the latest scroll position. */+export function createBackgrounds(+ layers: [BackgroundLayer, BackgroundLayer],+ rest: number,+ settle: () => Promise<void>,+) {+ let active = 0;+ let shown = rest;+ let wanted = rest;+ let running = false;+ let disposed = false;+ const loaded: (number | null)[] = [rest, null];++ async function prepare(slot: number, index: number): Promise<boolean> {+ if (loaded[slot] === index) return true;+ loaded[slot] = null;+ try {+ await layers[slot].load(index);+ loaded[slot] = index;+ return !disposed;+ } catch {+ // Both CDN and local fallback failed; retain the painted layer.+ return false;+ }+ }++ async function pump() {+ if (running || disposed) return;+ running = true;+ while (!disposed) {+ const slot = 1 - active;+ if (wanted !== shown) {+ const next = wanted;+ if (!(await prepare(slot, next))) break;+ if (disposed) break;+ if (next !== wanted) continue;+ const outgoing = active;+ layers[outgoing].show(true, false);+ layers[slot].show(true, true);+ active = slot;+ shown = next;+ await settle();+ if (!disposed) layers[outgoing].show(false, false);+ } else {+ // Reuse the faded-out layer for the next swatch, never all four.+ const next = (shown + 1) % BACKGROUND_WALLPAPERS.length;+ const ready = await prepare(slot, next);+ if (!ready && wanted === next) break;+ if (wanted === shown) break;+ }+ }+ running = false;+ }++ void pump();+ return {+ show(index: number) {+ if (index === wanted || disposed) return;+ wanted = index;+ void pump();+ },+ dispose() {+ disposed = true;+ },+ };+}++function setSource(picture: HTMLPictureElement, index: number) {+ const img = picture.querySelector("img")!;+ for (const source of Array.from(picture.querySelectorAll("source"))) {+ source.srcset = backgroundSrcSet(index, source.type === "image/avif" ? "avif" : "webp");+ }+ img.sizes = BACKGROUND_SIZES;+ img.src = backgroundFallback(index);+ picture.dataset.background = String(index);+}++/** A supported format can still fail to load; <picture> does not try its fallback then. */+export function restoreLocalBackground(img: HTMLImageElement) {+ if (img.currentSrc === img.src) return;+ for (const source of Array.from(img.parentElement!.querySelectorAll("source"))) {+ source.removeAttribute("srcset");+ }+ // Removing the sources lets the browser select img.src, the local JPEG.+}++export function attachBackgrounds(root: HTMLElement, rest: number) {+ const pictures = Array.from(root.querySelectorAll<HTMLPictureElement>("[data-background-layer]"));+ let disposed = false;+ const layers = pictures.map(+ (picture): BackgroundLayer => ({+ async load(index) {+ setSource(picture, index);+ const img = picture.querySelector("img")!;+ try {+ await img.decode();+ } catch {+ if (disposed) return;+ for (const source of Array.from(picture.querySelectorAll("source"))) {+ source.removeAttribute("srcset");+ }+ img.src = backgroundFallback(index);+ await img.decode();+ }+ // Establish the hidden opacity before reusing a cached image in the+ // same frame. This style read happens once per image, never on scroll.+ if (!disposed) void window.getComputedStyle(picture).opacity;+ },+ show(visible, foreground = false) {+ picture.style.zIndex = foreground ? "1" : "0";+ picture.dataset.visible = String(visible);+ },+ }),+ ) as [BackgroundLayer, BackgroundLayer];+ const controller = createBackgrounds(+ layers,+ rest,+ () => new Promise((resolve) => setTimeout(resolve, BACKGROUND_FADE_MS)),+ );+ return {+ show: controller.show,+ dispose() {+ disposed = true;+ controller.dispose();+ setSource(pictures[0], rest);+ pictures[0].dataset.visible = "true";+ pictures[1].dataset.visible = "false";+ for (const picture of pictures) picture.style.removeProperty("z-index");+ for (const source of Array.from(pictures[1].querySelectorAll("source"))) {+ source.removeAttribute("srcset");+ }+ pictures[1].querySelector("img")!.removeAttribute("src");+ },+ };+}diff --git a/website/src/components/Recreation/driver.ts b/website/src/components/Recreation/driver.tsindex 6175b7381..8aa2f0824 100644--- a/website/src/components/Recreation/driver.ts+++ b/website/src/components/Recreation/driver.ts@@ -22,6 +22,7 @@* which is the fastest cadence the decoder can hold without building a queue.*/+import { attachBackgrounds } from "./backgrounds";import { CURSORS } from "./generated";import { followHeight, footageSize } from "./layout";import { createPlayback, DOCK_VIEWPORTS, followDock } from "./playback";@@ -188,6 +189,7 @@ export function attachDriver(refs: DriverRefs, cls: DriverClasses): () => void {}const { band, root, cam, padValue, flow, pause } = refs;+ const backgrounds = attachBackgrounds(root, frameAt(1).bg);const hero = document.querySelector<HTMLElement>("[data-home-hero]");const card = root.querySelector<HTMLElement>("[data-composite]")!;const captions = root.querySelector<HTMLElement>("[data-cap]")!.parentElement!;@@ -686,6 +688,7 @@ export function attachDriver(refs: DriverRefs, cls: DriverClasses): () => void {// composite from one act to the other in a single frame.num("--tl", f.tl, 3);if (String(f.bg) !== root.dataset.bg) root.dataset.bg = String(f.bg);+ backgrounds.show(f.bg);num("--fit", f.fit);num("--pad-pct", f.paddingPct, 2);num("--frame-scale", f.frameScale, 4);@@ -904,6 +907,7 @@ export function attachDriver(refs: DriverRefs, cls: DriverClasses): () => void {hero.style.removeProperty("opacity");hero.inert = false;}+ backgrounds.dispose();release(refs, cls);};}diff --git a/website/src/components/Recreation/index.tsx b/website/src/components/Recreation/index.tsxindex b970e7f2d..4e114981e 100644--- a/website/src/components/Recreation/index.tsx+++ b/website/src/components/Recreation/index.tsx@@ -53,6 +53,8 @@ import {} from "lucide-react";import { useEffect, useRef } from "react";+import { BACKGROUND_SIZES, backgroundFallback, backgroundSrcSet } from "../../lib/background-media";+import { restoreLocalBackground } from "./backgrounds";import { attachDriver, SCENE_QUERIES } from "./driver";import { CONTROLS, CURSORS, INSPECTOR, PANELS, WAVEFORM } from "./generated";import { DOCK_VIEWPORTS } from "./playback";@@ -88,8 +90,6 @@ const REST = frameAt(1);/** The twelve wallpapers the picker shows, in the design's order. */const WALLPAPERS = [2, 5, 8, 11, 1, 4, 6, 7, 9, 10, 12, 13];-/** The four the background beat steps through, as full-size canvas layers. */-const CANVAS_BG = [1, 2, 3, 4];/** The ruler's half-second ticks and its labelled seconds. */const RULER = Array.from({ length: 103 }, (_, i) => (i - 18) / 2).filter((t) => t <= 42);@@ -534,16 +534,33 @@ export default function Recreation() {{/* ═══ THE COMPOSITE ═══ */}<div className={styles.card} data-composite=""><div className={styles.cardClip}>- {CANVAS_BG.map((n) => (- <img- key={n}+ {[0, 1].map((slot) => (+ <picture+ key={slot}className={styles.bg}- data-i={n - 1}- src={`/img/walkthrough/canvas-bg-${n}.jpg`}- alt=""- loading={n === 1 ? undefined : "lazy"}- decoding="async"- />+ data-background-layer=""+ data-background={slot === 0 ? REST.bg : undefined}+ data-visible={slot === 0}+ >+ <source+ type="image/avif"+ sizes={BACKGROUND_SIZES}+ srcSet={slot === 0 ? backgroundSrcSet(REST.bg, "avif") : undefined}+ />+ <source+ type="image/webp"+ sizes={BACKGROUND_SIZES}+ srcSet={slot === 0 ? backgroundSrcSet(REST.bg, "webp") : undefined}+ />+ <img+ src={slot === 0 ? backgroundFallback(REST.bg) : undefined}+ alt=""+ decoding="async"+ onError={(event) => restoreLocalBackground(event.currentTarget)}+ width="2560"+ height="1440"+ />+ </picture>))}<div className={styles.footage}><div className={styles.zoomer} data-shot-box>diff --git a/website/src/components/Recreation/styles.module.css b/website/src/components/Recreation/styles.module.cssindex 8ee8fc9ec..2be3f1dad 100644--- a/website/src/components/Recreation/styles.module.css+++ b/website/src/components/Recreation/styles.module.css@@ -1007,6 +1007,7 @@share one unchanged 16:9 canvas, uniformly fitted rather than stretched. */.footage {position: absolute;+ z-index: 2;left: 50%;top: 50%;width: 100%;@@ -1024,31 +1025,25 @@transition: transform 0.7s var(--ease);}-/* Four wallpapers, cross-fading on `data-bg`. Only the one whose index matches- is opaque, so the picker's selection and the canvas cannot disagree. The- attribute is always present — the markup renders the closing frame's pick and- the driver overwrites it per frame — so this needs no undriven fallback. */+/* The outgoing picture stays painted until the incoming responsive image is+ decoded. Only two layers are retained, including the next prepared swatch. */.bg {position: absolute;inset: 0;width: 100%;height: 100%;- object-fit: cover;opacity: 0;- transition: opacity 0.55s var(--ease);}-/* The first one is the floor of the stack, so something is always painted while- the others cross-fade over it. It is first in the markup as well as here: a- floor drawn later would paint over the picture it is meant to sit under. */-.bg[data-i="0"] {+.bg[data-visible="true"] {opacity: 1;+ transition: opacity 0.55s var(--ease);}-.stage[data-bg="1"] .bg[data-i="1"],-.stage[data-bg="2"] .bg[data-i="2"],-.stage[data-bg="3"] .bg[data-i="3"] {- opacity: 1;+.bg img {+ width: 100%;+ height: 100%;+ object-fit: cover;}/* The recorded window. Scaled, not inset — the page inside must not reflowdiff --git a/website/src/lib/background-media.ts b/website/src/lib/background-media.tsnew file mode 100644index 000000000..4185ff401--- /dev/null+++ b/website/src/lib/background-media.ts@@ -0,0 +1,16 @@+/** Immutable R2 cut, published before the site points at it. */+export const BACKGROUND_BASE = "https://media.getopenscreen.com/loops/backgrounds/2026-10a";+export const BACKGROUND_WIDTHS = [960, 1920, 2560] as const;+export const BACKGROUND_WALLPAPERS = [2, 5, 8, 11] as const;+export const BACKGROUND_SIZES = "(max-width: 900px) calc(100vw - 36px), 92vw";+export const BACKGROUND_FADE_MS = 550;++export function backgroundSrcSet(index: number, format: "avif" | "webp"): string {+ return BACKGROUND_WIDTHS.map(+ (width) => `${BACKGROUND_BASE}/bg-${index + 1}-${width}.${format} ${width}w`,+ ).join(", ");+}++export function backgroundFallback(index: number): string {+ return `/img/walkthrough/canvas-bg-${index + 1}.jpg`;+}