Something went wrong. Try again.
Monorepo for Tangled forked from tangled.org/core
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253<script lang="ts"> import "#lib/components/landing/features/ci.css"; import { play } from "#lib/components/landing/sound.ts"; import { onMount } from "svelte"; import { prefersReducedMotion } from "svelte/motion"; import { getGuest } from "#lib/components/landing/guest.svelte.ts"; import { Chain, Live } from "#lib/components/landing/live.svelte.ts"; import { Steps } from "#lib/components/landing/features/ci.svelte.ts"; import CiStep from "#lib/components/landing/features/CiStep.svelte"; import cableBefore from "#lib/components/landing/assets/cards/ci-cable-before.svg"; import cableAfter from "#lib/components/landing/assets/cards/ci-cable-after.svg"; import cableBeforeLight from "#lib/components/landing/assets/cards/ci-cable-before-light.svg"; import cableAfterLight from "#lib/components/landing/assets/cards/ci-cable-after-light.svg"; import capL from "#lib/components/landing/assets/cards/ci-vps-cap-l.svg"; import capR from "#lib/components/landing/assets/cards/ci-vps-cap-r.svg"; import grill from "#lib/components/landing/assets/cards/ci-vps-grill.svg";
/* * Powerful CI: a NixOS box with eight slots, a cable in and a cable out. * One slot at a time, rightmost first, a workflow is pulled up out of the box, its steps run * and tick off one by one, then it fades, drops back in, and the next slot to * the left goes. Loops; pauses off screen and in a hidden tab. Reduced motion holds one * frame — slot 2 up with build.yml — and the cables stand still. * * Each slot is a button: clicking one waiting in its groove swaps it in for the running one, * with a motor whirring up, and the loop carries on from there. */
const guest = getGuest();
/** One per slot, rightmost (slot-1) first. */ const WORKFLOWS = [ ["build.yml", ["boot microVM", "fetch nix inputs", "start postgres", "test"]], ["lint.yml", ["boot microVM", "nix flake check", "gofmt", "golangci-lint"]], ["test.yml", ["boot microVM", "start redis", "go test ./...", "upload coverage"]], ["docker.yml", ["boot microVM", "docker build", "scan image", "docker push"]], ["docs.yml", ["boot microVM", "fetch nix inputs", "build site", "deploy pages"]], ["release.yml", ["boot microVM", "nix build", "sign artifacts", "publish"]], ["bench.yml", ["boot microVM", "warm cache", "run benchmarks", "compare"]], ["e2e.yml", ["boot microVM", "start postgres", "seed database", "playwright"]] ] as const;
/* * Where each slot stands in its groove: the bottom-centre of the slot, in the group's * 547 × 291 frame (slot-1 first, with the active one dropped back in * line). The slot is a 135.55 × 161.45 card under the slots' iso transform, anchored there; * down, all but its top 50.65 is clipped below the groove. */ const GROOVES = [ [366.2, 204.2], [336.2, 193.2], [309.2, 184.2], [279.2, 174.2], [251.2, 164.2], [223.2, 154.2], [194.2, 145.2], [166.2, 135] ];
/* * What shows above a groove, for the slot whose bottom-centre is (x, y): above the card's * foot, along the groove, and left of the card above its thickness's foot, 3px left and 2px * up. */ const SLANT = Math.tan((28 * Math.PI) / 180); const FOOT = 59.8; const groove = (x: number, y: number) => { const left = x - FOOT - 3; const at = (px: number, py: number) => `${px}px ${py}px`; return `polygon(${[ at(0, -200), at(547, -200), at(547, y - (547 - x) * SLANT), at(x - FOOT, y + FOOT * SLANT), at(left, y + FOOT * SLANT - 2), at(0, y + FOOT * SLANT - 2 + left * SLANT) ].join(", ")})`; };
/** The device's eight slot openings, on its top face (before its iso transform). */ const SLOTS = [ [18.83, 11.01], [49.06, 11.68], [78.54, 10.41], [108.59, 10.87], [138.64, 11.33], [169.97, 10.91], [198.17, 10.52], [230.7, 11.39] ];
/** The dots along each cable: distance from the far end (in) or the socket (out). */ const CABLES = { in: { x: 4, y: 96.5, len: 148, dots: [34.9, 55.9, 76.4, 81.5, 102.8] }, out: { x: 400.6, y: 233.6, len: 153, dots: [3.6, 9.4, 11.1, 21.4, 29.2, 32.1, 52.6, 57.7, 79] } };
/** Timings (ms) — the slides themselves are CSS transitions of the same length. */ const PULL = 700; const DROP = 550; const STEP = 400;
/** The slot that's up (-1: none) and whether its card shows. */ let up = $state(-1); let shown = $state(false);
/* The loop is one chain of timers (live.svelte.ts): it holds while the box is off screen, in a hidden tab or in a closed beat, and picks up where it was. */ const live = new Live(0.4); const chain = new Chain(() => live.running); const steps = new Steps(chain);
function pull(slot: number) { up = slot; steps.reset(WORKFLOWS[slot][1].length); // The content waves in once the slot is most of the way up; the first step starts as // the wave finishes. chain.wait(PULL / 2, () => { shown = true; chain.wait(250, () => steps.run(0, STEP, finished)); }); }
function finished() { guest.markDone("ci"); chain.wait(500, () => { shown = false; chain.wait(260, () => { const slot = up; up = -1; chain.wait(DROP, () => pull((slot + 1) % WORKFLOWS.length)); }); }); }
/** The running card waves out over this long before a picked slot takes its place (ms). */ const SWAP = 160;
function pick(slot: number) { if (slot === up) return; play("loading", { theme: "mech", emphasis: "strong", volume: 0.75 }); guest.markDone("ci"); if (prefersReducedMotion.current) { up = slot; steps.reset(WORKFLOWS[slot][1].length, "ok"); return; } shown = false; chain.wait(up < 0 ? 0 : SWAP, () => pull(slot)); }
onMount(() => { if (prefersReducedMotion.current) { up = 1; shown = true; steps.reset(WORKFLOWS[1][1].length, "ok"); } else chain.wait(0, () => pull(0)); });</script>
{#snippet flow(c: (typeof CABLES)["in"])} <span class="cd-flow at" style:--x="{c.x}px" style:--y="{c.y}px" style:--len="{c.len}px"> {#each c.dots as d (d)} <span class="cd-dot" style:--d="{d}px" style:animation-delay="{(-d / c.len) * 9}s" ></span> {/each} </span>{/snippet}
<div class={["cd", up >= 0 && "busy"]} role="group" aria-label="A NixOS server running CI workflows, one slot after another." data-held={!live.running || undefined} {@attach live.watch}> <img class="cd-at at cd-cable-in dark-art" src={cableBefore} alt="" width="146" height="59" /> <img class="cd-at at cd-cable-in light-art" src={cableBeforeLight} alt="" width="146" height="59" /> {@render flow(CABLES.in)}
<div class="cd-at at cd-box"> <span class="cd-slab"> <span class="cd-top glint"> {#each SLOTS as [x, y] (x)} <span class="cd-groove at" style:--x="{x}px" style:--y="{y}px"></span> {/each} </span> </span> <span class="cd-at at cd-cap cd-cap-l" style:--cap={`url("${capL}")`}></span> <span class="cd-at at cd-cap cd-cap-r" style:--cap={`url("${capR}")`}></span> </div> {#each [180.24, 186.11, 191.97] as y (y)} <span class="cd-at at cd-vent" style:--y="{y}px"><span></span></span> {/each} <img class="cd-at at cd-grill" src={grill} alt="" width="25" height="23" /> <span class="cd-at at cd-led-box off"><span class="cd-led"><span></span></span></span> <span class="cd-at at cd-led-box on"><span class="cd-led"><span></span></span></span> <span class="cd-at at cd-nix"><span>NixOS</span></span>
<!-- Back to front: slot 8 (leftmost) is painted first. --> {#each GROOVES.toReversed() as [x, y], r (r)} {@const i = GROOVES.length - 1 - r} <div class="cd-slot-fx" style:clip-path={groove(x, y)}> <div class="cd-slot at" style:--x="{x - 67.78}px" style:--y="{y - 161.45}px"> <button type="button" class={["cd-card glint", up === i && "up"]} aria-pressed={up === i} aria-label="Run {WORKFLOWS[i][0]}" onclick={() => pick(i)} > {#if up === i} <span class={["cd-run", shown && "shown"]}> <span class="cd-file" style:--i={0}>{WORKFLOWS[i][0]}</span> <span class="cd-steps"> {#each WORKFLOWS[i][1] as name, s (name)} <CiStep {name} state={steps.states[s] ?? ""} class="cd-step" i={s + 1} /> {/each} </span> </span> {/if} </button> </div> </div> {/each}
<img class="cd-at at cd-cable-out dark-art" src={cableAfter} alt="" width="149" height="61" /> <img class="cd-at at cd-cable-out light-art" src={cableAfterLight} alt="" width="149" height="61" /> {@render flow(CABLES.out)}</div>