Skip to content

anbeime/skill / skills/hairline/hairline

hairline

Flagged

一句话生成跟随鼠标的交互式等轴测线框图(单文件、零依赖、双击即开),或把已有 SVG/Logo 重建为可交互线框。

FileKindSize
.github/FUNDING.ymlconfig20 B
.github/workflows/ci.ymlconfig1.2 KB
.github/workflows/consumers.ymlconfig954 B
.github/workflows/publish.ymlconfig3.0 KB
.gitignoreother351 B
.npmrcother55 B
CHANGELOG.mdmarkdown7.6 KB
CONTRIBUTING.mdmarkdown4.5 KB
LICENSEother1.0 KB
README.mdmarkdown11.5 KB
SKILL.mdskill md1.2 KB
apps/site/.gitignoreother82 B
apps/site/.vitest/json/output.jsonconfig22.3 KB
apps/site/app/docs/page.tsxother2.9 KB
apps/site/app/docs/sections.tsxother8.1 KB
apps/site/app/figures/page.tsxother2.4 KB
apps/site/app/globals.cssother43.7 KB
apps/site/app/inspo/page.tsxother14.0 KB
apps/site/app/layout.tsxother978 B
apps/site/app/llms.txt/route.tsscript228 B
apps/site/app/og/page.tsxother1.5 KB
apps/site/app/page.tsxother1.7 KB
apps/site/app/robots.tsscript382 B
apps/site/app/sitemap.tsscript382 B
apps/site/app/skills/page.tsxother6.2 KB
apps/site/components/anchor.tsxother1.3 KB
apps/site/components/assembly.tsxother10.2 KB
apps/site/components/catalogue.tsxother18.6 KB
apps/site/components/chrome.tsxother2.3 KB
apps/site/components/code-block.tsxother895 B
apps/site/components/command.tsxother1.6 KB
apps/site/components/copy.tsxother2.6 KB
apps/site/components/example-frame.tsxother3.1 KB
apps/site/components/install.tsxother1.7 KB
apps/site/components/made-frame.tsxother2.0 KB
apps/site/components/rail.tsxother11.0 KB
apps/site/components/skill-link.tsxother861 B
apps/site/components/tabs.tsxother4.1 KB
apps/site/next.config.mjsscript493 B
apps/site/package.jsonmanifest927 B
apps/site/playwright.config.tsscript485 B
apps/site/postcss.config.mjsscript60 B
apps/site/public/icon.svgother262 B
apps/site/public/inspo/craft.webpbinary61.9 KB
apps/site/public/inspo/dissection.webpbinary177.4 KB
apps/site/public/inspo/figures.webpbinary56.9 KB
apps/site/public/inspo/linear.webpbinary15.6 KB
apps/site/public/inspo/tune.webpbinary58.5 KB
apps/site/public/og.pngbinary94.3 KB
apps/site/public/skill/hairline-clearance.htmlother39.5 KB
apps/site/public/skill/hairline-cursor-tab.htmlother43.4 KB
apps/site/public/skill/hairline-deploy-liftoff.htmlother43.3 KB
apps/site/public/skill/hairline-firecrawl-reader.htmlother46.6 KB
apps/site/public/skill/hairline-funnel.htmlother40.4 KB
apps/site/public/skill/hairline-linear-cycle.htmlother43.5 KB
apps/site/public/skill/hairline-mastra.htmlother44.6 KB
apps/site/public/skill/hairline-notion.htmlother41.5 KB
apps/site/public/skill/hairline-resend-belt.htmlother46.5 KB
apps/site/public/skill/hairline-sidings.htmlother43.1 KB
apps/site/public/skill/hairline-storm.htmlother42.6 KB
apps/site/public/skill/hairline-vercel.htmlother40.6 KB
apps/site/test/catalogue.test.tsscript2.7 KB
apps/site/test/docs.test.tsscript8.9 KB
apps/site/test/figures.spec.tsscript15.0 KB
apps/site/test/share.test.tsscript652 B
apps/site/test/site.spec.tsscript44.8 KB
apps/site/test/skill.spec.tsscript17.8 KB
apps/site/test/skill.test.tsscript5.4 KB
apps/site/tsconfig.jsonconfig444 B
apps/site/turbo.jsonconfig364 B
apps/site/vercel.jsonconfig214 B
apps/site/vitest.config.tsscript265 B
assets/hero.gifbinary3.7 MB
fixtures/next-app/.gitignoreother123 B
fixtures/next-app/app/layout.tsxother281 B
fixtures/next-app/app/page.tsxother587 B
fixtures/next-app/app/registry/page.tsxother714 B
fixtures/next-app/app/vanilla.tsxother353 B
fixtures/next-app/next.config.mjsscript104 B
fixtures/next-app/package.jsonmanifest364 B
fixtures/next-app/tsconfig.jsonconfig590 B
fixtures/vite-vanilla/.gitignoreother38 B
fixtures/vite-vanilla/index.htmlother1.3 KB
fixtures/vite-vanilla/package.jsonmanifest245 B
fixtures/vite-vanilla/src/main.tsscript1.3 KB
fixtures/vite-vanilla/tsconfig.jsonconfig248 B
package.jsonmanifest895 B
packages/hairline/package.jsonmanifest2.4 KB
packages/hairline/playwright.config.tsscript637 B
packages/hairline/src/core/iso.tsscript9.1 KB
packages/hairline/src/core/motion.tsscript3.8 KB
packages/hairline/src/core/stage.tsscript15.0 KB
packages/hairline/src/core/styles.tsscript4.1 KB
packages/hairline/src/figures/basket.tsscript9.5 KB
packages/hairline/src/figures/branches.tsscript7.7 KB
packages/hairline/src/figures/cabinet.tsscript7.8 KB
packages/hairline/src/figures/dish.tsscript9.7 KB
packages/hairline/src/figures/drawer.tsscript7.5 KB
packages/hairline/src/figures/elevator.tsscript7.6 KB
packages/hairline/src/figures/exploded.tsscript5.2 KB
packages/hairline/src/figures/format.tsscript6.2 KB
packages/hairline/src/figures/hub.tsscript8.6 KB
packages/hairline/src/figures/keyboard.tsscript6.3 KB
packages/hairline/src/figures/laptop.tsscript7.3 KB
packages/hairline/src/figures/lockers.tsscript7.6 KB
packages/hairline/src/figures/loupe.tsscript6.1 KB
packages/hairline/src/figures/padlock.tsscript7.7 KB
packages/hairline/src/figures/patch.tsscript10.1 KB
packages/hairline/src/figures/phone.tsscript9.6 KB
packages/hairline/src/figures/phosphor.tsscript5.6 KB
packages/hairline/src/figures/plot.tsscript5.4 KB
packages/hairline/src/figures/plug.tsscript9.7 KB
packages/hairline/src/figures/query.tsscript8.8 KB
packages/hairline/src/figures/rail.tsscript4.9 KB
packages/hairline/src/figures/rebuild.tsscript10.3 KB
packages/hairline/src/figures/relay.tsscript8.0 KB
packages/hairline/src/figures/riffle-geometry.tsscript4.2 KB
packages/hairline/src/figures/riffle.tsscript5.2 KB
packages/hairline/src/figures/router.tsscript6.4 KB
packages/hairline/src/figures/settle.tsscript8.6 KB
packages/hairline/src/figures/sieve.tsscript5.9 KB
packages/hairline/src/figures/slow.tsscript7.2 KB
packages/hairline/src/figures/stack.tsscript5.5 KB
packages/hairline/src/figures/terminal.tsscript8.1 KB
packages/hairline/src/figures/terrain.tsscript4.4 KB
packages/hairline/src/figures/turntable-geometry.tsscript3.9 KB
packages/hairline/src/figures/turntable.tsscript6.5 KB
packages/hairline/src/figures/vault.tsscript9.8 KB
packages/hairline/src/index.tsscript17.9 KB
packages/hairline/src/intensity.tsscript3.2 KB
packages/hairline/src/mount.tsscript6.5 KB
packages/hairline/src/react.tsxother9.5 KB
packages/hairline/src/slab.tsscript3.1 KB
packages/hairline/test/browser/entry.tsscript1.4 KB
packages/hairline/test/browser/figures.spec.tsscript6.3 KB
packages/hairline/test/browser/harness.htmlother321 B
packages/hairline/test/browser/look.spec.tsscript9.5 KB
packages/hairline/test/browser/parity.spec.tsscript2.4 KB
packages/hairline/test/browser/read.spec.tsscript8.9 KB
packages/hairline/test/browser/serve.mjsscript1.7 KB
packages/hairline/test/browser/skill.spec.tsscript12.3 KB
packages/hairline/test/browser/theme.spec.tsscript3.9 KB
packages/hairline/test/dom.tsscript3.0 KB
packages/hairline/test/geometry.test.tsscript2.8 KB
packages/hairline/test/intensity.test.tsscript2.1 KB
packages/hairline/test/mount.test.tsscript33.1 KB
packages/hairline/test/parity/capture.mjsscript3.6 KB
packages/hairline/test/parity/clock.jsscript3.8 KB
packages/hairline/test/parity/driver.mjsscript1.9 KB
packages/hairline/test/parity/golden/exploded.jsonconfig24.7 KB
packages/hairline/test/parity/golden/phosphor.jsonconfig28.5 KB
packages/hairline/test/parity/golden/riffle.jsonconfig137.5 KB
packages/hairline/test/parity/golden/slow.jsonconfig41.4 KB
packages/hairline/test/parity/golden/terrain.jsonconfig216.7 KB
packages/hairline/test/parity/golden/turntable.jsonconfig32.3 KB
packages/hairline/test/parity/scripts.mjsscript2.8 KB
packages/hairline/test/react.test.tsxother7.5 KB
packages/hairline/test/skill/adopt.test.tsscript1.4 KB
packages/hairline/test/skill/build.test.tsscript3.3 KB
packages/hairline/test/skill/fixtures/broken.txtmarkdown19 B
packages/hairline/test/skill/fixtures/compound.svgother148 B
packages/hairline/test/skill/fixtures/illustrator.svgother334 B
packages/hairline/test/skill/fixtures/light.svgother123 B
packages/hairline/test/skill/fixtures/mark.svgother226 B
packages/hairline/test/skill/fixtures/mixed.svgother530 B
packages/hairline/test/skill/fixtures/moved.svgother182 B
packages/hairline/test/skill/fixtures/nested.svgother274 B
packages/hairline/test/skill/fixtures/rocket.svgother577 B
packages/hairline/test/skill/fixtures/scripted.svgother199 B
packages/hairline/test/skill/kernel.test.tsscript1.8 KB
packages/hairline/test/skill/look.test.tsscript2.2 KB
packages/hairline/test/skill/read.test.tsscript9.5 KB
packages/hairline/test/skill/shape.test.tsscript8.6 KB
packages/hairline/test/skill/validate.test.tsscript10.1 KB
packages/hairline/test/ssr.test.tsxother1.1 KB
packages/hairline/test/stage.test.tsscript11.6 KB
packages/hairline/test/types.test-d.tsxother4.9 KB
packages/hairline/tsconfig.jsonconfig212 B
packages/hairline/tsup.config.tsscript844 B
packages/hairline/vitest.config.tsscript163 B
pnpm-lock.yamlmanifest129.1 KB
pnpm-workspace.yamlconfig142 B
registry/build.mjsscript1.8 KB
registry/src/hairline.tsxother4.7 KB
registry/validate.mjsscript2.2 KB
scripts/base-url.mjsscript1.4 KB
scripts/changelog.mjsscript1.3 KB
scripts/consumers.mjsscript7.4 KB
scripts/kernel.mjsscript8.8 KB
scripts/og.mjsscript1.7 KB
scripts/release.mjsscript8.0 KB
tsconfig.base.jsonconfig442 B
turbo.jsonconfig620 B

apps/site/public/skill/hairline-resend-belt.html

View on GitHub
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hairline figure</title>
<link rel="icon" href="data:,">
<style>
  :root { color-scheme: light; --ground: #ffffff; --ink: #232327; --muted: #6f6f78; --line: #e0e0e4; }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) { color-scheme: dark; --ground: #08090a; --ink: #d0d6e0; --muted: #8a8c95; --line: #29292d; }
  }
  :root[data-theme="dark"] { color-scheme: dark; --ground: #08090a; --ink: #d0d6e0; --muted: #8a8c95; --line: #29292d; }
  :root[data-theme="light"] { color-scheme: light; }
  * { box-sizing: border-box; }
  body {
    margin: 0; min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
    background: var(--ground); color: var(--ink);
    font: 13px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased;
  }
  main { width: 100%; max-width: 640px; }
  .plate { position: relative; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
  .tag, .label, output, button { font: 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.02em; }
  .tag { position: absolute; top: 12px; z-index: 1; color: var(--muted); pointer-events: none; }
  #name { left: 14px; }
  #read { right: 14px; color: var(--ink); font-variant-numeric: tabular-nums; }
  .controls { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 14px; }
  .label { color: var(--muted); }
  input[type="range"] {
    flex: 1 1 96px; min-width: 0; height: 32px; margin: 0; background: transparent; cursor: pointer;
    -webkit-appearance: none; appearance: none;
  }
  input[type="range"]::-webkit-slider-runnable-track { height: 1px; background: var(--muted); }
  input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 13px; height: 13px; margin-top: -6px; border-radius: 50%;
    border: 1px solid var(--ink); background: var(--ground);
  }
  input[type="range"]::-moz-range-track { height: 1px; background: var(--muted); }
  input[type="range"]::-moz-range-thumb { width: 11px; height: 11px; border-radius: 50%; border: 1px solid var(--ink); background: var(--ground); }
  input[type="range"]:focus-visible, button:focus-visible { outline: 1.5px solid var(--ink); outline-offset: 2px; }
  output { min-width: 4ch; text-align: right; font-variant-numeric: tabular-nums; }
  button {
    height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px;
    background: transparent; color: var(--ink); cursor: pointer;
  }
  #play[aria-pressed="true"] { background: var(--ink); color: var(--ground); border-color: var(--ink); }
  #means { margin: 14px 0 0; text-wrap: pretty; }
  #rules { margin: 6px 0 0; line-height: 1.6; }
  #error { margin: 12px 0 0; padding-left: 10px; border-left: 1px solid var(--ink); }
</style>
</head>
<body>
<main>
  <div class="plate">
    <span class="tag" id="name"></span>
    <span class="tag" id="read"></span>
    <div id="stage"></div>
  </div>
  <div class="controls">
    <label class="label" for="intensity">intensity</label>
    <input id="intensity" type="range" min="0" max="1" step="0.01" value="0.5">
    <output id="value" for="intensity"></output>
    <span class="label">theme</span>
    <button id="theme" type="button" aria-label="Switch between the light and the dark theme"></button>
    <span class="label">play</span>
    <button id="play" type="button" aria-pressed="false">play</button>
  </div>
  <p id="means"></p>
  <p id="rules" class="label"></p>
  <p id="error" role="alert" hidden></p>
</main>
<script id="hl-kernel">
/* hairline kernel sha256:346b48bdef2cdfafd5343eba01494255cf75f9c078e6fcd1aafc62bab62980a1 */
/*
 * HL: everything a figure may call. Read this index; the code under it is the
 * package's src/core, unchanged, and a figure should not need to read it.
 *
 * Every figure is drawn in a 400 × 320 viewBox. World space is x/y on the
 * ground and z up. Plates are filled with the ground colour and painted back
 * to front, so a nearer one covers a farther one: append in that order. At
 * the default camera, Cam(45, 0.5, S), +x runs down to the right and +y down
 * to the left, so the corner with the largest x and y is nearest the viewer:
 * append by ascending x + y, from the far corner (smallest x and y) to it.
 *
 * Camera
 *   Cam(azDeg, k, S)                       a camera: azimuth in degrees, k = sin(elevation) (0.5 is the 2:1 view), S = scale
 *   fit(C, points, cx, cy)                 centres the box of [x, y, z] points on (cx, cy); call it once, before proj
 *                                          it only centres, it never scales: choose S by trying values, with the most extreme pose in points.
 *                                          The six figures use S 1.42 to 2.12; the boxes they fit come out 230 to 310 wide and 180 to 245 tall
 *   proj(C)                                returns P(x, y, z), which gives [sx, sy]
 *   unproj(C, sx, sy, z)                   the world [x, y] under a screen point, on the plane at height z
 *   facing(C)                              returns front(sample): whether a ring sample faces the camera
 * Rounded solids
 *   rrect(u0, v0, u1, v1, r, n)            a rounded rectangle, as a ring of samples {u, v, nu, nv}
 *   circ(R, n)                             a circle, as a ring
 *   rings(x0, y0, x1, y1, r, b)            [ring, inner]: a rounded footprint and its crease ring, inset by b
 *                                          r, the corner radius, is cut to half the shorter side. b, the crease's inset in world units
 *                                          (0.6 to 2.2 in the figures), must stay under half the shorter side or the crease turns inside out
 *   prism(P, front, ring, inner, z0, z1)   {sil, crease}: a solid standing from z0 to z1, as two path strings
 *   ringAt(P, ring, z)                     the ring's points, projected at height z
 *   run(ring, keep)                        the one cyclic run of samples that pass keep
 *   hull(points)                           the convex hull of screen points
 *   extremes(P, ring)                      [left, right, nearest] samples: where dashed drops fall from
 *   fillet(points, radii, n)               rounds every vertex of a closed polygon; returns the new points
 *                                          radii is an array, one radius per vertex, each cut to half its shorter edge; a single number gives NaN.
 *                                          n is the steps round each corner, default 4: each vertex becomes n + 1 points
 *   ghost(P, front, ring, z0, depth)       a reflection's path {d, y0, y1}; reflect() draws it for you
 * Paths and numbers
 *   poly(points)                           a closed path string
 *   open(points)                           an open polyline string
 *   seg(a, b)                              one segment between two screen points [sx, sy], as its own subpath; project world points with P first
 *   clamp(v, a, b)
 *   lerp(a, b, t)
 *   rad(deg)
 *   r2(n)                                  two decimals
 * The continuous clock: one spring per moving number
 *   spring(x, opts)                        at rest on x; write .t to retarget; opts {k, c, m, eps}, default k 100, c 18, m 1
 *   stepS(sp, dt)                          advances by dt seconds; returns whether it is still moving
 * The discrete clock: a 700ms tween on (.32, .72, 0, 1)
 *   tween(v, dur)                          at rest on v; dur defaults to 700 (ms)
 *   tset(tw, to, now, delay)               retargets from where it is, after delay ms: the stagger
 *                                          the same target again does nothing, so calling it on every pointer move is safe
 *   tval(tw, now)                          its value at now
 *   tdone(tw, now)                         whether it has landed
 *   bezier(x1, y1, x2, y2)                 a CSS cubic-bezier, as a function of progress
 *   EASE_LIFT                              the lift curve itself
 *   reducedMotion()                        true when the reader asked for less motion; springs and tweens already land at once
 *   setReducedMotion(on)                   the loop's business, not a figure's
 * Drawing
 *   mk(tag, attrs, parent)                 one svg element: the only way a figure makes a node
 *   solid(parent)                          {g, sil, cr}: a group holding a silhouette path and a crease path
 *   put(solid, paths)                      writes prism()'s {sil, crease} into solid()'s {sil, cr}: sil into sil, crease into cr
 *   flatDot(parent, C, r, cls)             a dot lying on the ground plane; cls is "dot", "dot m" or "dot off"
 *   place(el, point)                       moves a dot or a circle to [sx, sy]
 *   reflect(svg, parent, P, front, ring, z0, depth)   a fading mirror under a solid
 *   fade(svg, y0, y1, a0)                  a vertical fade, as a mask; returns the value for a mask attribute
 * Life
 *   register(stage, tick)                  joins the one frame loop; tick(dt in seconds, now in ms) returns true to ask for another frame; gives {wake, unregister}
 *   pointer(stage, handlers)               {move(point), down(point), leave()}, points in viewBox units; returns its disposer
 *   disposer()                             {add, on, dispose}: collects tear-down, so destroy is bag.dispose
 * The bench's business, not a figure's
 *   css(lightDark)
 *   inject(root)
 *   tour(stage, stops, onStop)             an unseen pointer that walks the stops, [x, y] in viewBox units or null to leave, and gives way to a real one; onStop(i) on each arrival; returns {stop}
 *   LAP                                    the default stops: a diamond around the centre, then a leave
 *
 * Classes, on path, polygon, ellipse and line. They are the whole palette; a
 * figure sets no colour, width or fill of its own.
 *     (none)   filled with the ground colour, medium stroke
 *     sil      the silhouette's stroke        hi    the bright stroke: the only highlight
 *     lo       the dim stroke                 nf    no fill        fo   fill only, no stroke
 *     dash     a dashed guide
 *     dot      a bright dot                   dot m   a medium dot     dot off   a dim dot
 */
var HL = (() => {
  var __defProp = Object.defineProperty;
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  var __getOwnPropNames = Object.getOwnPropertyNames;
  var __hasOwnProp = Object.prototype.hasOwnProperty;
  var __export = (target, all) => {
    for (var name in all)
      __defProp(target, name, { get: all[name], enumerable: true });
  };
  var __copyProps = (to, from, except, desc) => {
    if (from && typeof from === "object" || typeof from === "function") {
      for (let key of __getOwnPropNames(from))
        if (!__hasOwnProp.call(to, key) && key !== except)
          __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
    }
    return to;
  };
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

  // packages/hairline/src/core/kernel.ts
  var kernel_exports = {};
  __export(kernel_exports, {
    Cam: () => Cam,
    EASE_LIFT: () => EASE_LIFT,
    LAP: () => LAP,
    bezier: () => bezier,
    circ: () => circ,
    clamp: () => clamp,
    css: () => css,
    disposer: () => disposer,
    extremes: () => extremes,
    facing: () => facing,
    fade: () => fade,
    fillet: () => fillet,
    fit: () => fit,
    flatDot: () => flatDot,
    ghost: () => ghost,
    hull: () => hull,
    inject: () => inject,
    lerp: () => lerp,
    mk: () => mk,
    open: () => open,
    place: () => place,
    pointer: () => pointer,
    poly: () => poly,
    prism: () => prism,
    proj: () => proj,
    put: () => put,
    r2: () => r2,
    rad: () => rad,
    reducedMotion: () => reducedMotion,
    reflect: () => reflect,
    register: () => register,
    ringAt: () => ringAt,
    rings: () => rings,
    rrect: () => rrect,
    run: () => run,
    seg: () => seg,
    setReducedMotion: () => setReducedMotion,
    solid: () => solid,
    spring: () => spring,
    stepS: () => stepS,
    tdone: () => tdone,
    tour: () => tour,
    tset: () => tset,
    tval: () => tval,
    tween: () => tween,
    unproj: () => unproj
  });

  // packages/hairline/src/core/iso.ts
  var clamp = (v, a, b) => Math.max(a, Math.min(b, v));
  var lerp = (a, b, t) => a + (b - a) * t;
  var rad = (d) => d * Math.PI / 180;
  var r2 = (n) => Math.round(n * 100) / 100;
  var poly = (pts) => "M" + pts.map((p) => r2(p[0]) + " " + r2(p[1])).join("L") + "Z";
  var seg = (a, b) => `M${r2(a[0])} ${r2(a[1])}L${r2(b[0])} ${r2(b[1])}`;
  var open = (pts) => pts.length < 2 ? "" : "M" + pts.map((p) => r2(p[0]) + " " + r2(p[1])).join("L");
  var Cam = (azDeg, k, S) => ({ az: rad(azDeg), k, S, ox: 0, oy: 0 });
  function proj(C) {
    const c = Math.cos(C.az), s = Math.sin(C.az), zf = Math.sqrt(1 - C.k * C.k);
    return (x, y, z) => {
      const X = x * c - y * s, Y = x * s + y * c;
      return [C.ox + C.S * X, C.oy + C.S * (Y * C.k - z * zf)];
    };
  }
  function unproj(C, sx, sy, z) {
    const c = Math.cos(C.az), s = Math.sin(C.az), zf = Math.sqrt(1 - C.k * C.k);
    const X = (sx - C.ox) / C.S, Y = ((sy - C.oy) / C.S + z * zf) / C.k;
    return [X * c + Y * s, -X * s + Y * c];
  }
  function fit(C, pts, cx, cy) {
    C.ox = 0;
    C.oy = 0;
    const P = proj(C);
    let a = 1e9, b = -1e9, c = 1e9, d = -1e9;
    for (const p of pts) {
      const q = P(p[0], p[1], p[2]);
      a = Math.min(a, q[0]);
      b = Math.max(b, q[0]);
      c = Math.min(c, q[1]);
      d = Math.max(d, q[1]);
    }
    C.ox = cx - (a + b) / 2;
    C.oy = cy - (c + d) / 2;
  }
  function rrect(u0, v0, u1, v1, r, n = 4) {
    r = Math.max(0, Math.min(r, (u1 - u0) / 2, (v1 - v0) / 2));
    const out = [];
    for (const [cu, cv, a0] of [[u1 - r, v1 - r, 0], [u0 + r, v1 - r, 90], [u0 + r, v0 + r, 180], [u1 - r, v0 + r, 270]])
      for (let k = 0; k <= n; k++) {
        const a = rad(a0 + 90 * k / n), ca = Math.cos(a), sa = Math.sin(a);
        out.push({ u: cu + r * ca, v: cv + r * sa, nu: ca, nv: sa });
      }
    return out;
  }
  function circ(R, n = 96) {
    const out = [];
    for (let k = 0; k < n; k++) {
      const a = k / n * Math.PI * 2, ca = Math.cos(a), sa = Math.sin(a);
      out.push({ u: R * ca, v: R * sa, nu: ca, nv: sa });
    }
    return out;
  }
  function hull(input) {
    const pts = input.slice().sort((a, b) => a[0] - b[0] || a[1] - b[1]);
    const x = (o, a, b) => (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]);
    const lo = [], up = [];
    for (const p of pts) {
      while (lo.length > 1 && x(lo[lo.length - 2], lo[lo.length - 1], p) <= 0) lo.pop();
      lo.push(p);
    }
    for (let i = pts.length - 1; i >= 0; i--) {
      const p = pts[i];
      while (up.length > 1 && x(up[up.length - 2], up[up.length - 1], p) <= 0) up.pop();
      up.push(p);
    }
    lo.pop();
    up.pop();
    return lo.concat(up);
  }
  var ringAt = (P, ring, z) => ring.map((q) => P(q.u, q.v, z));
  var facing = (C) => {
    const s = Math.sin(C.az), c = Math.cos(C.az);
    return (q) => q.nu * s + q.nv * c >= -1e-6;
  };
  function run(ring, keep) {
    const n = ring.length;
    let s = -1;
    for (let i = 0; i < n; i++) if (keep(ring[i]) && !keep(ring[(i + n - 1) % n])) {
      s = i;
      break;
    }
    if (s < 0) return keep(ring[0]) ? ring.slice() : [];
    const out = [];
    for (let k = 0; k < n && keep(ring[(s + k) % n]); k++) out.push(ring[(s + k) % n]);
    return out;
  }
  function prism(P, front, ring, inner, z0, z1) {
    return {
      sil: poly(hull(ringAt(P, ring, z1).concat(ringAt(P, ring, z0)))),
      crease: inner ? open(ringAt(P, run(inner, front), z1)) : ""
    };
  }
  var rings = (x0, y0, x1, y1, r, b) => [
    rrect(x0, y0, x1, y1, r),
    rrect(x0 + b, y0 + b, x1 - b, y1 - b, Math.max(0.3, r - b))
  ];
  function extremes(P, ring) {
    const pr = ring.map((q) => P(q.u, q.v, 0));
    let a = 0, b = 0, c = 0;
    pr.forEach((p, k) => {
      if (p[0] < pr[a][0]) a = k;
      if (p[0] > pr[b][0]) b = k;
      if (p[1] > pr[c][1]) c = k;
    });
    return [ring[a], ring[b], ring[c]];
  }
  function fillet(pts, rs, n = 4) {
    const m = pts.length, out = [];
    for (let i = 0; i < m; i++) {
      const a = pts[(i + m - 1) % m], p = pts[i], b = pts[(i + 1) % m];
      const la = Math.hypot(a[0] - p[0], a[1] - p[1]), lb = Math.hypot(b[0] - p[0], b[1] - p[1]);
      const t = Math.min(rs[i], la / 2, lb / 2);
      const p1 = [p[0] + (a[0] - p[0]) / la * t, p[1] + (a[1] - p[1]) / la * t];
      const p2 = [p[0] + (b[0] - p[0]) / lb * t, p[1] + (b[1] - p[1]) / lb * t];
      for (let k = 0; k <= n; k++) {
        const s = k / n, w = 1 - s;
        out.push([w * w * p1[0] + 2 * w * s * p[0] + s * s * p2[0], w * w * p1[1] + 2 * w * s * p[1] + s * s * p2[1]]);
      }
    }
    return out;
  }
  function ghost(P, front, ring, z0, depth) {
    const f = run(ring, front), lowP = ringAt(P, f, z0 - depth);
    return {
      d: open(lowP) + [f[0], f[f.length - 1]].map((q) => seg(P(q.u, q.v, z0), P(q.u, q.v, z0 - depth))).join(""),
      y0: Math.min(...ringAt(P, f, z0).map((p) => p[1])),
      y1: Math.max(...lowP.map((p) => p[1])) + 2
    };
  }

  // packages/hairline/src/core/motion.ts
  var reduced = false;
  var setReducedMotion = (on) => {
    reduced = on;
  };
  var reducedMotion = () => reduced;
  function spring(x, o = {}) {
    return { x, v: 0, t: x, k: o.k ?? 100, c: o.c ?? 18, m: o.m ?? 1, eps: o.eps ?? 0.01 };
  }
  function stepS(sp, dt) {
    if (reduced) {
      sp.x = sp.t;
      sp.v = 0;
      return false;
    }
    const n = Math.max(1, Math.ceil(dt * 240)), h = dt / n;
    for (let i = 0; i < n; i++) {
      const a = (-sp.k * (sp.x - sp.t) - sp.c * sp.v) / sp.m;
      sp.v += a * h;
      sp.x += sp.v * h;
    }
    if (Math.abs(sp.x - sp.t) < sp.eps && Math.abs(sp.v) < sp.eps * 10) {
      sp.x = sp.t;
      sp.v = 0;
      return false;
    }
    return true;
  }
  function bezier(x1, y1, x2, y2) {
    const cx = 3 * x1, bx = 3 * (x2 - x1) - cx, ax = 1 - cx - bx;
    const cy = 3 * y1, by = 3 * (y2 - y1) - cy, ay = 1 - cy - by;
    const X = (u) => ((ax * u + bx) * u + cx) * u;
    const Y = (u) => ((ay * u + by) * u + cy) * u;
    const dX = (u) => (3 * ax * u + 2 * bx) * u + cx;
    return (t) => {
      if (t <= 0) return 0;
      if (t >= 1) return 1;
      let u = t;
      for (let i = 0; i < 8; i++) {
        const e = X(u) - t;
        if (Math.abs(e) < 1e-5) break;
        const d = dX(u);
        if (Math.abs(d) < 1e-6) break;
        u -= e / d;
      }
      if (!(u >= 0 && u <= 1) || Math.abs(X(u) - t) > 1e-4) {
        let lo = 0, hi = 1;
        u = t;
        for (let i = 0; i < 24; i++) {
          if (X(u) < t) lo = u;
          else hi = u;
          u = (lo + hi) / 2;
        }
      }
      return Y(u);
    };
  }
  var EASE_LIFT = bezier(0.32, 0.72, 0, 1);
  var tween = (v, dur = 700) => ({ from: v, to: v, t0: -1e9, dur });
  var tval = (tw, now) => {
    const p = clamp((now - tw.t0) / tw.dur, 0, 1);
    return tw.from + (tw.to - tw.from) * (reduced ? 1 : EASE_LIFT(p));
  };
  var tset = (tw, to, now, delay) => {
    if (tw.to === to) return;
    tw.from = tval(tw, now);
    tw.to = to;
    tw.t0 = now + delay;
  };
  var tdone = (tw, now) => reduced || now >= tw.t0 + tw.dur;

  // packages/hairline/src/core/stage.ts
  var NS = "http://www.w3.org/2000/svg";
  function mk(tag, attrs, parent) {
    const e = document.createElementNS(NS, tag);
    if (attrs) for (const k in attrs) e.setAttribute(k, String(attrs[k]));
    if (parent) parent.appendChild(e);
    return e;
  }
  function solid(parent) {
    const g = mk("g", {}, parent);
    return { g, sil: mk("path", { class: "sil" }, g), cr: mk("path", { class: "nf lo" }, g) };
  }
  var put = (el, s) => {
    el.sil.setAttribute("d", s.sil);
    el.cr.setAttribute("d", s.crease);
  };
  var flatDot = (parent, C, r, cls) => mk("ellipse", { rx: r2(r * C.S), ry: r2(r * C.S * C.k), class: cls }, parent);
  var place = (el, q) => {
    el.setAttribute("cx", String(r2(q[0])));
    el.setAttribute("cy", String(r2(q[1])));
  };
  var fid = 0;
  function fade(svg, y0, y1, a0 = 0.7) {
    const id = "hl-fd" + ++fid, defs = mk("defs", {}, svg);
    const lg = mk("linearGradient", { id: id + "g", gradientUnits: "userSpaceOnUse", x1: 0, y1: r2(y0), x2: 0, y2: r2(y1) }, defs);
    mk("stop", { offset: 0, "stop-color": "#fff", "stop-opacity": a0 }, lg);
    mk("stop", { offset: 1, "stop-color": "#fff", "stop-opacity": 0 }, lg);
    const m = mk("mask", { id, maskUnits: "userSpaceOnUse", x: 0, y: 0, width: 400, height: 320 }, defs);
    mk("rect", { x: 0, y: 0, width: 400, height: 320, fill: `url(#${id}g)` }, m);
    return `url(#${id})`;
  }
  function reflect(svg, parent, P, front, ring, z0, depth) {
    const r = ghost(P, front, ring, z0, depth);
    const gh = mk("g", { class: "ghost", mask: fade(svg, r.y0, r.y1) }, parent);
    mk("path", { d: r.d }, gh);
  }
  var boards = [];
  var byStage = /* @__PURE__ */ new Map();
  var raf = 0;
  var last = 0;
  var io = null;
  var rm = null;
  function frame() {
    const now = performance.now();
    const dt = Math.min(0.05, Math.max(0, (now - last) / 1e3));
    last = now;
    let any = false;
    for (const b of boards.slice()) if (b.vis && b.awake) {
      try {
        b.awake = !!b.tick(dt, now);
      } catch (err) {
        b.awake = false;
        setTimeout(() => {
          throw err;
        });
      }
      any = any || b.awake;
    }
    raf = any ? requestAnimationFrame(frame) : 0;
  }
  function wake(b) {
    b.awake = true;
    if (!raf) {
      last = performance.now();
      raf = requestAnimationFrame(frame);
    }
  }
  var onMotion = () => {
    setReducedMotion(!!rm?.matches);
    boards.forEach(wake);
  };
  function start() {
    if (io) return;
    io = new IntersectionObserver((es) => {
      for (const e of es) {
        const set = byStage.get(e.target);
        if (!set) continue;
        for (const b of set) {
          b.vis = e.isIntersecting;
          if (b.vis) wake(b);
        }
      }
    }, { rootMargin: "80px" });
    rm = matchMedia("(prefers-reduced-motion: reduce)");
    setReducedMotion(rm.matches);
    rm.addEventListener("change", onMotion);
  }
  function stop() {
    if (raf) cancelAnimationFrame(raf);
    raf = 0;
    io?.disconnect();
    io = null;
    rm?.removeEventListener("change", onMotion);
    rm = null;
  }
  function register(stage, tick) {
    start();
    const b = { stage, tick, vis: false, awake: true };
    boards.push(b);
    const peers = byStage.get(stage);
    if (peers) {
      for (const p of peers) b.vis = p.vis;
      peers.add(b);
      if (b.vis) wake(b);
    } else {
      byStage.set(stage, /* @__PURE__ */ new Set([b]));
      io.observe(stage);
    }
    tick(0, performance.now());
    let gone = false;
    return {
      wake: () => {
        if (!gone) wake(b);
      },
      unregister: () => {
        if (gone) return;
        gone = true;
        boards = boards.filter((x) => x !== b);
        const set = byStage.get(stage);
        if (set) {
          set.delete(b);
          if (!set.size) {
            byStage.delete(stage);
            io?.unobserve(stage);
          }
        }
        if (!boards.length) stop();
      }
    };
  }
  var handlers = /* @__PURE__ */ new WeakMap();
  var touring = /* @__PURE__ */ new WeakMap();
  function pointer(stage, on) {
    handlers.set(stage, on);
    let tm = 0;
    const pt = (e) => {
      const r = stage.getBoundingClientRect();
      return [(e.clientX - r.left) / r.width * 400, (e.clientY - r.top) / r.height * 320];
    };
    const move = (e) => {
      clearTimeout(tm);
      touring.get(stage)?.hold();
      on.move(pt(e), e);
    };
    const down = (e) => {
      clearTimeout(tm);
      touring.get(stage)?.hold();
      if (e.pointerType !== "mouse") stage.releasePointerCapture?.(e.pointerId);
      if (on.down) on.down(pt(e), e);
      else on.move(pt(e), e);
    };
    const leave = (e) => {
      clearTimeout(tm);
      tm = window.setTimeout(() => {
        on.leave(e);
        touring.get(stage)?.release();
      }, e.pointerType === "mouse" ? 0 : 1400);
    };
    stage.addEventListener("pointermove", move);
    stage.addEventListener("pointerdown", down);
    stage.addEventListener("pointerleave", leave);
    return () => {
      clearTimeout(tm);
      if (handlers.get(stage) === on) handlers.delete(stage);
      stage.removeEventListener("pointermove", move);
      stage.removeEventListener("pointerdown", down);
      stage.removeEventListener("pointerleave", leave);
    };
  }
  var LAP = [[128, 150], [200, 118], [272, 150], [200, 206], null];
  var TRAVEL = 900;
  var DWELL = 1200;
  var REST = 1800;
  var RESUME = 1200;
  var STAGGER = 450;
  var GHOST = { pointerType: "ghost" };
  var started = 0;
  function entry([x, y]) {
    const dx = x - 200, dy = y - 160;
    if (!dx && !dy) return [200, 320];
    const k = Math.min(dx ? (dx > 0 ? 200 : -200) / dx : Infinity, dy ? (dy > 0 ? 160 : -160) / dy : Infinity);
    return [200 + dx * k, 160 + dy * k];
  }
  function tour(stage, stops, onStop) {
    let i = 0;
    let wait = RESUME + STAGGER * (started++ % 4);
    let t = -1;
    let at = null;
    let origin = [200, 320];
    let hand = false, keys = stage.contains(stage.ownerDocument.activeElement);
    let gone = false;
    const leave = () => {
      at = null;
      t = -1;
      handlers.get(stage)?.leave(GHOST);
    };
    const tick = (dt) => {
      if (hand || keys || !stops.length) return false;
      if (reducedMotion()) {
        if (at) leave();
        return false;
      }
      if (wait > 0) {
        wait -= dt * 1e3;
        return true;
      }
      const stop2 = stops[i];
      if (stop2 === null) {
        if (at) leave();
        onStop?.(i);
        i = (i + 1) % stops.length;
        wait = REST;
        return true;
      }
      const h = handlers.get(stage);
      if (!h) return true;
      if (t < 0) {
        origin = at ?? entry(stop2);
        t = 0;
      }
      t = Math.min(TRAVEL, t + dt * 1e3);
      const k = EASE_LIFT(t / TRAVEL);
      at = [origin[0] + (stop2[0] - origin[0]) * k, origin[1] + (stop2[1] - origin[1]) * k];
      h.move(at, GHOST);
      if (t < TRAVEL) return true;
      onStop?.(i);
      i = (i + 1) % stops.length;
      t = -1;
      wait = DWELL;
      return true;
    };
    const take = () => {
      at = null;
      t = -1;
    };
    const give = () => {
      if (hand || keys) return;
      i = 0;
      t = -1;
      wait = RESUME;
      board.wake();
    };
    const me = {
      hold: () => {
        hand = true;
        take();
      },
      release: () => {
        if (!hand) return;
        hand = false;
        give();
      }
    };
    const focusIn = () => {
      keys = true;
      take();
    };
    const focusOut = (e) => {
      if (keys && !stage.contains(e.relatedTarget)) {
        keys = false;
        give();
      }
    };
    stage.addEventListener("focusin", focusIn);
    stage.addEventListener("focusout", focusOut);
    touring.set(stage, me);
    const board = register(stage, tick);
    return {
      stop: () => {
        if (gone) return;
        gone = true;
        board.unregister();
        stage.removeEventListener("focusin", focusIn);
        stage.removeEventListener("focusout", focusOut);
        if (touring.get(stage) === me) touring.delete(stage);
        if (at) leave();
      }
    };
  }
  function disposer() {
    let fns = [];
    return {
      add: (fn) => {
        fns.push(fn);
      },
      on: (target, type, fn, opts) => {
        const h = fn;
        target.addEventListener(type, h, opts);
        fns.push(() => target.removeEventListener(type, h, opts));
      },
      dispose: () => {
        const run2 = fns;
        fns = [];
        for (let i = run2.length - 1; i >= 0; i--) run2[i]();
      }
    };
  }

  // packages/hairline/src/core/styles.ts
  var LIGHT = { plate: "#ffffff", hi: "#232327", edge: "#a4a4ac", mid: "#c3c3c9", lo: "#e0e0e4" };
  var DARK = { plate: "#08090a", hi: "#d0d6e0", edge: "#5b5d64", mid: "#3e3e44", lo: "#29292d" };
  var KEYS = ["plate", "hi", "edge", "mid", "lo"];
  var vars = (p) => KEYS.map((k) => `--hl-${k}:var(--hairline-${k},${p[k]});`).join("");
  var EASE = "cubic-bezier(0.5,0,0.1,1)";
  var SVG = ":where([data-hairline]>svg)";
  function css(lightDark) {
    const both = Object.fromEntries(KEYS.map((k) => [k, `light-dark(${LIGHT[k]},${DARK[k]})`]));
    return [
      // the box, and the palette: light unless something below says otherwise
      `:where([data-hairline]){display:block;position:relative;aspect-ratio:5/4;touch-action:pan-y;user-select:none;-webkit-user-select:none;--hl-sw:var(--hairline-stroke,0.9);${vars(LIGHT)}}`,
      // the page's color-scheme
      lightDark ? `:where([data-hairline]){${vars(both)}}` : "",
      // an ancestor that says dark
      `:where(.dark,[data-theme="dark"]) :where([data-hairline]){${vars(DARK)}}`,
      // the figure's own theme option
      `:where([data-hairline][data-hairline-theme="light"]){${vars(LIGHT)}}`,
      `:where([data-hairline][data-hairline-theme="dark"]){${vars(DARK)}}`,
      `:where([data-hairline]:focus-visible){outline:1.5px solid var(--hl-hi);outline-offset:2px}`,
      `${SVG}{position:absolute;inset:0;width:100%;height:100%;display:block}`,
      // Riffle's live region: read, not seen
      `:where([data-hairline]>[data-hairline-live]){position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}`,
      // the drawing: plates are filled with the plate colour and painted back to front
      `${SVG} :where(path,polygon,ellipse,line){fill:var(--hl-plate);stroke:var(--hl-mid);stroke-width:var(--hl-sw);vector-effect:non-scaling-stroke;stroke-linejoin:round;stroke-linecap:round;transition:stroke 260ms ${EASE}}`,
      `${SVG} :where(.nf){fill:none}`,
      `${SVG} :where(.fo){stroke:none}`,
      `${SVG} :where(.sil){stroke:var(--hl-edge)}`,
      `${SVG} :where(.hi){stroke:var(--hl-hi)}`,
      `${SVG} :where(.lo){stroke:var(--hl-lo)}`,
      `${SVG} :where(.dash){stroke-dasharray:1 3}`,
      `${SVG} :where(.dot){stroke:none;fill:var(--hl-hi);transition:fill 260ms ${EASE}}`,
      `${SVG} :where(.dot.m){fill:var(--hl-edge)}`,
      `${SVG} :where(.dot.off){fill:var(--hl-lo)}`,
      `${SVG} :where(.ghost path){fill:none;stroke:var(--hl-mid)}`
    ].join("");
  }
  var done = /* @__PURE__ */ new WeakSet();
  function inject(root) {
    if (done.has(root)) return;
    done.add(root);
    const doc = root.nodeType === 9 ? root : root.ownerDocument;
    const win = doc.defaultView;
    const text = css(!!win?.CSS?.supports?.("color", "light-dark(#000,#fff)"));
    if (win && "adoptedStyleSheets" in root) {
      try {
        const sheet = new win.CSSStyleSheet();
        sheet.replaceSync(text);
        root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];
        return;
      } catch {
      }
    }
    const style = doc.createElement("style");
    style.setAttribute("data-hairline-style", "");
    style.textContent = text;
    (root.nodeType === 9 ? doc.head ?? doc.documentElement : root).appendChild(style);
  }
  return __toCommonJS(kernel_exports);
})();
/* /hairline kernel */
</script>
<script id="hl-bench">
/*
 * The bench: the page a figure is shown on. It makes the host and the svg the
 * way the package's mount does, hands them to the figure, and owns everything
 * around it: the read-out, the slider, the theme, the line under the stage.
 */
(() => {
  const RULES = ["hit", "order", "reach", "accent", "rest", "honesty", "cost", "clock", "radius", "quiet"];
  const $ = (id) => document.getElementById(id);
  const root = document.documentElement, params = new URLSearchParams(location.search);

  /* the theme: the system's until the switch is pressed, then the switch's */
  const dark = () => (root.dataset.theme ? root.dataset.theme === "dark" : matchMedia("(prefers-color-scheme: dark)").matches);
  const label = () => { $("theme").textContent = dark() ? "dark" : "light"; };
  $("theme").addEventListener("click", () => { root.dataset.theme = dark() ? "light" : "dark"; label(); });
  /* ?theme=light or ?theme=dark wins over the system's, as pressing the switch does */
  if (["light", "dark"].includes(params.get("theme"))) root.dataset.theme = params.get("theme");
  label();

  /* ?intensity=0 sets the slider before the figure mounts, for a look at either end */
  const i = (params.get("intensity") || "").trim();
  if (i && Number.isFinite(Number(i))) $("intensity").value = String(Math.min(1, Math.max(0, Number(i))));

  /* ?w=240 narrows the page, for a look at the size of a thumbnail */
  const w = Number(params.get("w"));
  if (w > 0) document.querySelector("main").style.maxWidth = w + "px";

  /* a figure that fails says so under the stage, instead of leaving an empty plate */
  addEventListener("error", (e) => {
    $("error").hidden = false;
    $("error").textContent = String((e.error && e.error.message) || e.message);
  });

  let mounted = false;
  window.hairline = (figure) => {
    if (mounted) throw new Error("hairline: one figure per page.");
    mounted = true;
    const stage = $("stage"), slider = $("intensity");

    /* intensity to the figure's own number: two straight lines that meet at 0.5, as in the package */
    const [lo, mid, hi] = figure.range;
    const at = (i) => Math.round((i <= 0.5 ? lo + (i / 0.5) * (mid - lo) : mid + ((i - 0.5) / 0.5) * (hi - mid)) * 1000) / 1000;

    HL.inject(document);
    stage.setAttribute("data-hairline", figure.name);
    stage.setAttribute("role", "img");
    stage.setAttribute("aria-label", figure.means);
    const svg = HL.mk("svg", { viewBox: "0 0 400 320", "aria-hidden": "true" }, stage);

    let text = null;
    const read = {
      get textContent() { return text; },
      set textContent(value) { text = value == null ? "" : String(value); $("read").textContent = text; },
    };

    document.title = "Hairline · " + figure.name;
    $("name").textContent = figure.name;
    $("means").textContent = figure.means;
    $("rules").textContent = figure.rules.map((n) => String(n).padStart(2, "0") + " " + RULES[n - 1]).join(" · ");
    const show = () => { $("value").textContent = String(at(Number(slider.value))); };
    show();

    const handle = figure.mount({ stage, svg, read }, at(Number(slider.value)));
    if (text === null) read.textContent = "rest";
    slider.addEventListener("input", () => { show(); handle.set(at(Number(slider.value))); });
    window.hairline.figure = handle;

    /* play: an unseen pointer walks the figure's tour (or HL.LAP) until a hand arrives; ?play=1 starts it on load */
    const play = $("play");
    window.hairline.playing = null;
    play.addEventListener("click", () => {
      const was = play.getAttribute("aria-pressed") === "true";
      if (was) { window.hairline.playing.stop(); window.hairline.playing = null; }
      else window.hairline.playing = HL.tour(stage, figure.tour || HL.LAP, (i) => { if (window.hairline.onStop) window.hairline.onStop(i); });
      play.setAttribute("aria-pressed", String(!was));
    });
    if (params.get("play") === "1") play.click();

    /* ?at=200,160 holds the pointer at a viewBox point, for a picture of the answer without a mouse */
    const p = (params.get("at") || "").split(",").map(Number);
    if (p.length === 2 && p.every(Number.isFinite)) {
      const r = stage.getBoundingClientRect();
      stage.dispatchEvent(new PointerEvent("pointermove", {
        pointerType: "mouse", pointerId: 1, bubbles: true,
        clientX: r.left + (p[0] / 400) * r.width, clientY: r.top + (p[1] / 320) * r.height,
      }));
    }
  };
})();
</script>
<script type="module" id="hl-figure">
/**
 * Resend, belt: the R lies on the top of a low rounded block, and the letters
 * it sends come out from under it, through a slot at the foot of its front,
 * onto a belt that runs on while the pointer is over the figure. At the end of
 * the belt each letter tips into a tray and lies on the ones before it. When
 * the pointer leaves, the belt runs down and stops. At rest one letter is on
 * the belt and two are in the tray. The slider is the belt's speed.
 */
const {
  Cam, clamp, facing, fit, open, poly, prism, proj, rad, seg, solid, put,
  spring, stepS, disposer, mk, pointer, register,
} = HL;

const T = 16, W = 48, BH = 7, BW = 17, GAP = 30, X0 = W - 11, XE = W + 96, LIFT = 1.2;
const TX0 = XE + 3, TX1 = XE + 47, TY = 24, RIM = 5, KEEP = 4, HOP = 560;

/** A rounded footprint as a ring of samples {u, v, nu, nv}, smooth at the corners. */
function rr(x0, y0, x1, y1, r, n = 16) {
  const out = [];
  for (const [cu, cv, a0] of [[x1 - r, y1 - r, 0], [x0 + r, y1 - r, 90], [x0 + r, y0 + r, 180], [x1 - r, y0 + r, 270]])
    for (let k = 0; k <= n; k++) { const a = rad(a0 + (90 * k) / n), c = Math.cos(a), s = Math.sin(a); out.push({ u: cu + r * c, v: cv + r * s, nu: c, nv: s }); }
  return out;
}

/** The R of the mark, read from its own path in the logo (411.6 square, y down), cubics sampled finely. */
const R = (() => {
  const d = "M251.761 0C331.485 0 378.9 47.4126 378.9 110.35C378.9 173.287 331.485 220.7 251.761 220.7H211.479L411.629 411.609H270.224L117.908 266.854C106.999 256.784 101.963 245.036 101.963 234.966C101.963 220.7 112.034 208.113 131.335 202.658L209.801 181.679C239.592 173.707 260.153 150.63 260.153 120.42C260.153 83.4968 229.941 62.0977 192.597 62.0977H0V0H251.761Z";
  const tok = d.match(/[A-Za-z]|-?[\d.]+/g), out = [], num = () => parseFloat(tok[i++]);
  let i = 0, cmd = "", x = 0, y = 0;
  while (i < tok.length && tok[i] !== "Z") {
    if (/[A-Za-z]/.test(tok[i])) cmd = tok[i++];
    if (cmd === "C") {
      const [x1, y1, x2, y2, x3, y3] = Array.from({ length: 6 }, num), b = (a, b, c, e, t) => (1 - t) ** 3 * a + 3 * (1 - t) ** 2 * t * b + 3 * (1 - t) * t * t * c + t ** 3 * e;
      for (let k = 1; k <= 20; k++) out.push([b(x, x1, x2, x3, k / 20), b(y, y1, y2, y3, k / 20)]);
      [x, y] = [x3, y3];
    } else { if (cmd !== "V") x = num(); if (cmd !== "H") y = num(); out.push([x, y]); }
  }
  const s = 56 / 411.6, c = 411.6 / 2;
  // lying on the panel: the mark's x along x, its top towards -y; the closing point repeats the first, so drop it
  return out.slice(0, -1).map(([px, py]) => [(px - c) * s, (py - c) * s]);
})();

/** A letter lying flat, in its own (a, b): 20 along the belt, 28 across it, its flap towards the slot. */
const BODY = rr(-10, -14, 10, 14, 2, 4).map((q) => [q.u, q.v]);
const FLAP = [[-8.6, -12.6], [2.4, 0], [-8.6, 12.6]];

function mount({ stage, svg, read }, value) {
  const bag = disposer();
  let speed = value;

  const C = Cam(45, 0.5, 1.4);
  fit(C, [[W, W, 0], [-W, -W, T + 4], [W, -W, 0], [-W, W, 0], [TX1, -TY, 0], [TX1, TY, 0], [TX0, -TY, RIM]], 200, 166);
  const P = proj(C), front = facing(C);
  const ring = (r, z) => r.map((q) => P(q.u, q.v, z));
  const frontRun = (r) => { const n = r.length, f = r.map(front); let s = f.findIndex((v, i) => v && !f[(i + n - 1) % n]); if (s < 0) return r; const o = []; for (let k = 0; k < n && f[(s + k) % n]; k++) o.push(r[(s + k) % n]); return o; };

  const g = mk("g", {}, svg);

  // the block: a rounded slab, its bevel along the front, and the panel inset in its top
  const block = mk("g", {}, g);
  const foot = rr(-W, -W, W, W, 14), bevel = rr(-W + 2.5, -W + 2.5, W - 2.5, W - 2.5, 11.5);
  put(solid(block), prism(P, front, foot, bevel, 0, T));
  mk("path", { class: "nf lo", d: poly(ring(rr(-W + 10, -W + 10, W - 10, W - 10, 8), T)) }, block);

  // the R, raised 4 from the panel: its foot, the walls that face you, their edges where they turn away, and its face
  const RH = 4, base = R.map(([x, y]) => P(x, y, T)), top = R.map(([x, y]) => P(x, y, T + RH)), up = top[0][1] - base[0][1];
  const area = base.reduce((a, p, i) => { const q = base[(i + 1) % base.length]; return a + p[0] * q[1] - q[0] * p[1]; }, 0);
  const faces = base.map((p, i) => { const q = base[(i + 1) % base.length], ex = q[0] - p[0]; return (area > 0 ? ex : -ex) > 0; });
  // a wall faces you when its outward normal points down the screen; with y down, that is its edge running one way along x
  let walls = "", turns = "";
  base.forEach((p, i) => {
    const j = (i + 1) % base.length, q = base[j];
    if (faces[i]) walls += poly([p, q, [q[0], q[1] + up], [p[0], p[1] + up]]);
    if (faces[i] !== faces[(i + base.length - 1) % base.length]) turns += seg(p, top[i]);
  });
  mk("path", { class: "sil", d: poly(base) }, block);
  mk("path", { class: "fo", d: walls }, block);
  mk("path", { class: "sil nf", d: turns }, block);
  const face = mk("path", { class: "sil hi", d: poly(top) }, block);

  // the slot at the foot of the front, and the dark inside just under its top edge
  mk("path", { class: "sil", d: poly([[-BW - 3, 0], [BW + 3, 0], [BW + 3, BH + 4], [-BW - 3, BH + 4]].map(([y, z]) => P(W, y, z))) }, block);
  mk("path", { class: "lo", d: seg(P(W, -BW - 1, BH + 2), P(W, BW + 1, BH + 2)) }, block);

  // the belt: a slab from the slot to the tray, and the slats across it that move as it runs
  const belt = mk("g", {}, g);
  put(solid(belt), prism(P, front, rr(W, -BW, XE, BW, 3, 4), null, 0, BH));
  const slats = Array.from({ length: Math.ceil((XE - W) / 12) + 1 }, () => mk("path", { class: "lo" }, belt));
  const onBelt = mk("g", {}, g);

  // the tray: an open box whose near walls are drawn again over what lies in it
  const tray = mk("g", {}, g);
  const outer = rr(TX0, -TY, TX1, TY, 5), inner = rr(TX0 + 3, -TY + 3, TX1 - 3, TY - 3, 2.5);
  put(solid(tray), prism(P, front, outer, null, 0, RIM));
  mk("path", { class: "nf lo", d: poly(ring(inner, RIM)) }, tray);
  const inTray = mk("g", {}, g);
  const lip = mk("g", {}, g), of = frontRun(outer), inf = frontRun(inner);
  mk("path", { class: "fo", d: poly([...ring(of, 0), ...ring(of, RIM).reverse()]) + poly([...ring(of, RIM), ...ring(inf, RIM).reverse()]) }, lip);
  mk("path", { class: "sil nf", d: open(ring(of, 0)) + seg(ring(of, 0)[0], ring(of, RIM)[0]) + seg(ring(of, 0)[of.length - 1], ring(of, RIM)[of.length - 1]) + open(ring(of, RIM)) }, lip);
  mk("path", { class: "nf lo", d: open(ring(inf, RIM)) }, lip);

  /** A letter: its three paths, drawn at (x, y, z) turned by h. */
  const letter = (parent) => { const grp = mk("g", {}, parent); return { grp, under: mk("path", { class: "lo" }, grp), body: mk("path", { class: "sil" }, grp), flap: mk("path", { class: "nf lo" }, grp) }; };
  function paint(L, x, y, z, h, slot) {
    const c = Math.cos(h), s = Math.sin(h), at = (pts) => pts.map(([a, b]) => [x + a * c - b * s, y + a * s + b * c]);
    // in the slot, what is still inside is pressed flat against its mouth: a straight cut, since the letter is square to it
    const hide = slot && x + 10 <= W, on = (pts, zz) => (hide ? "" : pts.map(([px, py]) => P(slot ? Math.max(px, W) : px, py, zz)));
    L.under.setAttribute("d", hide ? "" : poly(on(at(BODY), z - LIFT)));
    L.body.setAttribute("d", hide ? "" : poly(on(at(BODY), z)));
    L.flap.setAttribute("d", hide ? "" : open(on(at(FLAP), z)));
  }

  // letters: on the belt they ride at s - e; past its end they hop into the tray; in it they lie stacked
  let s = 0, sent = 0, hover = false;
  const vel = spring(0, { k: 30, c: 11 });
  const jitter = (k) => [((k * 37) % 11) - 5, ((k * 53) % 13) - 6, rad(((k * 29) % 17) - 8)];
  const riding = [{ e: -GAP, ...letter(onBelt) }], hopping = [], lying = [0, 1].map((k) => ({ ...letter(inTray), k }));
  sent = 2;

  // the letter d down a pile of n: the top ones askew, the deeper ones squared up under each other
  function trayAt(L, d, n) {
    const [jx, jy, jh] = jitter(L.k), f = clamp(1 - d / (KEEP - 1), 0, 1);
    return [(TX0 + TX1) / 2 + jx * f, jy * f, LIFT + 0.6 + Math.max(0, Math.min(n, KEEP) - 1 - d) * 1.2, jh * f];
  }
  const settle = (L, to, k) => { L.at = L.at ? L.at.map((v, i) => v + (to[i] - v) * k) : to; return to.some((v, i) => Math.abs(v - L.at[i]) > 0.02); };
  function lit() {
    const all = [...riding, ...hopping, ...lying];
    all.forEach((L) => L.body.classList.toggle("hi", false));
    face.classList.toggle("hi", !hover);
    if (hover && riding.length) riding[riding.length - 1].body.classList.toggle("hi", true);
  }

  function frame(dt, now) {
    let moving = stepS(vel, dt);
    s += vel.x * dt;
    // a new letter comes out as soon as the last one is a gap clear of the slot
    if (hover) {
      const last = riding[riding.length - 1];
      if (!last || s - last.e >= GAP) { riding.push({ e: last ? last.e + GAP : s, ...letter(onBelt) }); lit(); }
    }
    // a letter whose middle reaches the end of the belt leaves it for the tray
    while (riding.length && X0 + s - riding[0].e >= XE - 4) {
      const L = riding.shift();
      onBelt.removeChild(L.grp); inTray.append(L.grp);
      Object.assign(L, { k: sent++, t0: now, x0: XE - 4 });
      hopping.push(L);
    }
    // the slats come up out of the slot and go down over the far end: each narrows to nothing as it nears an end
    const slatPh = ((s % 12) + 12) % 12;
    slats.forEach((el, k) => { const x = W + slatPh + k * 12, hw = (BW - 2) * clamp(Math.min(x - W, XE - x) / 8, 0, 1);
      el.setAttribute("d", hw > 0.3 ? seg(P(x, -hw, BH), P(x, hw, BH)) : ""); });
    riding.forEach((L) => paint(L, X0 + s - L.e, 0, BH + LIFT, 0, true));
    // the hop: an arc over the rim, eased in and out, so it leaves the belt and lands on the pile without a knock
    hopping.slice().forEach((L) => {
      const p = clamp((now - L.t0) / HOP, 0, 1), e = p * p * (3 - 2 * p), [tx, ty, tz, th] = trayAt(L, 0, lying.length + 1);
      L.at = [L.x0 + (tx - L.x0) * e, ty * e, BH + LIFT + (tz - BH - LIFT) * e + 7 * Math.sin(Math.PI * e), th * e];
      if (p < 1) { moving = true; return; }
      hopping.splice(hopping.indexOf(L), 1);
      lying.push(L);
      // the tray keeps the last few: the oldest lies exactly under the next by now, so it goes unseen
      if (lying.length > KEEP + 1) lying.shift().grp.remove();
      read.textContent = hover ? `${sent} sent` : "rest";
    });
    // the pile eases to where it lies: each one settles down a step and squares up as a new one lands on it
    const n = lying.length, k = 1 - Math.exp(-dt * 7);
    lying.forEach((L, i) => { if (settle(L, trayAt(L, n - 1 - i, n), k)) moving = true; });
    [...hopping, ...lying].forEach((L) => paint(L, L.at[0], L.at[1], L.at[2], L.at[3], false));
    if (hover) moving = true;
    return moving;
  }

  const B = register(stage, frame);
  bag.add(B.unregister);

  function run(on) {
    if (on === hover) return;
    hover = on;
    vel.t = on ? speed : 0;
    read.textContent = on ? `${sent} sent` : "rest";
    lit();
    B.wake();
  }
  bag.add(pointer(stage, { move: () => run(true), leave: () => run(false) }));
  bag.add(() => svg.replaceChildren());
  lit();

  return {
    set: (v) => { speed = v; if (hover) { vel.t = v; B.wake(); } },
    destroy: bag.dispose,
  };
}

hairline({
  name: "resend-belt",
  means: "The R on its block: while the pointer is over it, the belt runs and the letters come out from under it into the tray.",
  rules: [5, 8, 10],
  range: [30, 45, 60],
  tour: [[200, 160], [260, 200], null],
  mount,
});
</script>
</body>
</html>
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall