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/components/catalogue.tsx

View on GitHub
"use client";

import { useCallback, useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ReactNode } from "react";
import { Basket, Branches, Cabinet, Dish, Drawer, Elevator, Exploded, Format, Hub, Keyboard, Laptop, Lockers, Loupe, Padlock, Patch, Phone, Phosphor, Plot, Plug, Query, Rail, Rebuild, Relay, Riffle, Router, Settle, Sieve, Slow, Stack, Terminal, Terrain, Turntable, Vault } from "@lucasmarkes/hairline/react";
import { ENTRIES, NOTICE, SHELVES, type Entry, type Shelf, type ShelfId } from "@/lib/catalogue";
import { LINKS, type FigureId } from "@/lib/figures";
import { Command } from "./command";
import { ExampleFrame } from "./example-frame";
import { MadeFrame } from "./made-frame";
import { Tabs, type Tab } from "./tabs";

const COMPONENTS: Record<FigureId, typeof Riffle> = { riffle: Riffle, terrain: Terrain, exploded: Exploded, phosphor: Phosphor, slow: Slow, turntable: Turntable, keyboard: Keyboard, elevator: Elevator, phone: Phone, laptop: Laptop, terminal: Terminal, cabinet: Cabinet, branches: Branches, vault: Vault, lockers: Lockers, padlock: Padlock, patch: Patch, dish: Dish, router: Router, loupe: Loupe, sieve: Sieve, rail: Rail, plug: Plug, query: Query, drawer: Drawer, basket: Basket, plot: Plot, hub: Hub, relay: Relay, settle: Settle, format: Format, rebuild: Rebuild, stack: Stack };

type Filter = "all" | ShelfId;

const svg = (children: ReactNode) => (
  <svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
    {children}
  </svg>
);

/** Each shelf's mark, drawn as the docs rail's are: a light fill under a line. */
const ICONS: Record<Filter, ReactNode> = {
  all: svg(
    <>
      <rect x="2" y="2" width="5" height="5" rx="1.5" fill="currentColor" fillOpacity=".2" />
      <rect x="9" y="2" width="5" height="5" rx="1.5" fill="currentColor" fillOpacity=".2" />
      <rect x="2" y="9" width="5" height="5" rx="1.5" fill="currentColor" fillOpacity=".2" />
      <rect x="9" y="9" width="5" height="5" rx="1.5" fill="currentColor" fillOpacity=".2" />
    </>,
  ),
  interfaces: svg(
    <>
      <rect x="1.75" y="2.75" width="12.5" height="10.5" rx="2.5" fill="currentColor" fillOpacity=".2" stroke="none" />
      <path d="M1.75 6h12.5" />
    </>,
  ),
  data: svg(
    <>
      <rect x="2" y="7" width="3" height="6" rx="1" fill="currentColor" fillOpacity=".2" />
      <rect x="6.5" y="3" width="3" height="10" rx="1" fill="currentColor" fillOpacity=".2" />
      <rect x="11" y="5" width="3" height="8" rx="1" fill="currentColor" fillOpacity=".2" />
    </>,
  ),
  machines: svg(
    <>
      <circle cx="8" cy="8" r="4.25" fill="currentColor" fillOpacity=".2" />
      <circle cx="8" cy="8" r="1.25" />
      <path d="M8 1.75v2M8 12.25v2M1.75 8h2M12.25 8h2" />
    </>,
  ),
  devices: svg(
    <>
      <rect x="4.75" y="1.75" width="6.5" height="12.5" rx="1.75" fill="currentColor" fillOpacity=".2" />
      <path d="M7 12h2" />
    </>,
  ),
  coding: svg(
    <>
      <rect x="1.75" y="2.75" width="12.5" height="10.5" rx="2.5" fill="currentColor" fillOpacity=".2" stroke="none" />
      <path d="M6 5c-1 0-1.25.5-1.25 1.25v.5C4.75 7.5 4.5 8 3.75 8c.75 0 1 .5 1 1.25v.5C4.75 10.5 5 11 6 11M10 5c1 0 1.25.5 1.25 1.25v.5c0 .75.25 1.25 1 1.25-.75 0-1 .5-1 1.25v.5c0 .75-.25 1.25-1.25 1.25" />
    </>,
  ),
  security: svg(
    <>
      <path d="M8 1.75 13 3.75v4.5c0 3-2.5 5-5 6-2.5-1-5-3-5-6v-4.5L8 1.75Z" fill="currentColor" fillOpacity=".2" />
      <path d="M6 8l1.5 1.5L10 6.5" />
    </>,
  ),
  connectivity: svg(
    <>
      <circle cx="4" cy="11.5" r="2.25" fill="currentColor" fillOpacity=".2" />
      <circle cx="12" cy="4.5" r="2.25" fill="currentColor" fillOpacity=".2" />
      <path d="m5.6 10 4.8-4.1" />
    </>,
  ),
  empty: svg(
    <>
      <rect x="2.25" y="2.25" width="11.5" height="11.5" rx="3" fill="currentColor" fillOpacity=".2" stroke="none" />
      <rect x="2.25" y="2.25" width="11.5" height="11.5" rx="3" strokeDasharray="2 2.4" />
    </>,
  ),
  marks: svg(
    <>
      <path d="M8 2.5 13.5 12h-11L8 2.5Z" fill="currentColor" fillOpacity=".2" />
      <circle cx="12.25" cy="4.25" r="1.5" />
    </>,
  ),
};

/** The rows of the filter: All, then each shelf, each in its colour with how many figures it holds. */
const ROWS: { id: Filter; title: string; color: string; n: number }[] = [
  { id: "all", title: "All", color: "#0a0a0a", n: ENTRIES.length },
  ...SHELVES.map((s) => ({ id: s.id, title: s.title, color: s.color, n: s.figures.length })),
];

const SHELF_OF = new Map(SHELVES.flatMap((s) => s.figures.map((f) => [f.id, s] as const)));

const tint = (color: string) => ({ "--gc": color }) as CSSProperties;

/** The filter a hash names, a bare #shelf, or All. */
const fromHash = (hash: string): Filter => {
  const id = hash.slice(1);
  return SHELVES.some((s) => s.id === id) ? (id as ShelfId) : "all";
};

/** What stands in a planned figure's place: its plinth in outline, a figure not drawn yet. */
function Ghost() {
  return (
    <svg className="fig-ghost" viewBox="0 0 400 320" aria-hidden="true">
      <path className="fig-ghost-dash" d="M200 92 342 163 200 234 58 163Z" />
      <path className="fig-ghost-plate" d="M200 128 258 157 200 186 142 157Z" />
      <path d="M142 157v22l58 29v-22M258 157v22l-58 29" />
      <path className="fig-ghost-dash" d="M200 92v-22M342 163h22M58 163H36" />
    </svg>
  );
}

/**
 * The figures on their shelves. The shelves are a filter: All, the default, shows every shelf, and a shelf shows only
 * itself. The choice is kept in the address as a bare #shelf, which names no element, so a link opens on it without
 * the browser scrolling. From 1100px the filter is a list by the column's left edge, its marks on the line the name in
 * the top bar starts on, and a plate slides to the pressed row; below that it is a strip under the top bar.
 *
 * A tile shows its figure live. Picking one opens a drawer with the figure large, an intensity slider, what the figure
 * reads, and its code three ways, highlighted on the server. A planned figure has its outline instead, and a link to
 * ask for it. A figure the skill made shows its page's stage, and its drawer the page with its own controls and the
 * prompt that drew it. The header and the closing note come from the server, around the shelves.
 */
export function Catalogue({ code, header, end }: { code: Record<FigureId, Tab[]>; header: ReactNode; end: ReactNode }) {
  const [filter, setFilterState] = useState<Filter>("all");
  const [entered, setEntered] = useState(false);
  const [open, setOpen] = useState(false);
  const [entry, setEntry] = useState<Entry | null>(null);
  const [intensity, setIntensity] = useState(0.5);
  const [reads, setReads] = useState("");
  const [edges, setEdges] = useState({ start: false, end: false });
  const list = useRef<HTMLDivElement>(null);
  const plate = useRef<HTMLSpanElement>(null);
  const strip = useRef<HTMLDivElement>(null);
  const head = useRef<HTMLDivElement>(null);
  const close = useRef<HTMLButtonElement>(null);
  const opener = useRef<HTMLElement | null>(null);
  const keyed = useRef(false);

  // the hash is read after mount, so the server's All and the first render agree
  useEffect(() => {
    const read = () => setFilterState(fromHash(window.location.hash));
    read();
    window.addEventListener("hashchange", read);
    return () => window.removeEventListener("hashchange", read);
  }, []);

  // the plate moves before paint, so it is never drawn under a row no longer pressed; the first time it lands in place
  useLayoutEffect(() => {
    const el = list.current;
    const place = () => {
      const row = el?.querySelector<HTMLElement>(`[data-filter="${filter}"]`);
      if (!el || !row || !plate.current) return;
      plate.current.style.transform = `translateY(${row.offsetTop}px)`;
      el.setAttribute("data-on", "");
    };
    place();
    if (el && !el.hasAttribute("data-live")) requestAnimationFrame(() => requestAnimationFrame(() => el.setAttribute("data-live", "")));
    window.addEventListener("resize", place);
    return () => window.removeEventListener("resize", place);
  }, [filter]);

  // brings the pressed pill into the strip by scrolling the strip alone
  useEffect(() => {
    const el = strip.current;
    const pill = el?.querySelector<HTMLElement>(`[data-filter="${filter}"]`);
    if (!el || !pill || !el.clientWidth) return;
    const pad = 24;
    const box = el.getBoundingClientRect();
    const at = pill.getBoundingClientRect();
    if (at.left - pad < box.left) el.scrollTo({ left: el.scrollLeft + at.left - pad - box.left });
    else if (at.right + pad > box.right) el.scrollTo({ left: el.scrollLeft + at.right + pad - box.right });
  }, [filter]);

  useEffect(() => {
    const el = strip.current;
    if (!el) return;
    const measure = () => setEdges({ start: el.scrollLeft > 1, end: el.scrollLeft + el.clientWidth < el.scrollWidth - 1 });
    measure();
    el.addEventListener("scroll", measure, { passive: true });
    const resize = new ResizeObserver(measure);
    resize.observe(el);
    return () => {
      el.removeEventListener("scroll", measure);
      resize.disconnect();
    };
  }, []);

  const setFilter = (id: Filter) => {
    if (id === filter) return;
    setFilterState(id);
    setEntered(true);
    try {
      history.replaceState(null, "", id === "all" ? location.pathname + location.search : `#${id}`);
    } catch {}
    // a pick made far down the page brings the shelves' top into view
    if (head.current && head.current.getBoundingClientRect().bottom < 0) {
      window.scrollTo({ top: 0, behavior: matchMedia("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth" });
    }
  };

  const pick = (f: Entry, from: HTMLElement | null, keyboard: boolean) => {
    opener.current = from;
    keyed.current = keyboard;
    if (entry?.id !== f.id) {
      setIntensity(0.5);
      setReads("");
    }
    setEntry(f);
    setOpen(true);
  };

  // focus returns to the tile's button, and its ring shows only when the keyboard closed the drawer: a script's focus
  // would otherwise draw it after a click on the ×; Escape counts as the keyboard only once it has been steering
  const shut = useCallback((keyboard: boolean) => {
    setOpen(false);
    const back = opener.current;
    if (back?.isConnected) back.focus({ preventScroll: true, focusVisible: keyboard } as FocusOptions);
  }, []);

  useEffect(() => {
    if (!open) return;
    // the × takes focus, with its ring only when the keyboard opened the drawer, as `shut` does on the way back
    close.current?.focus({ preventScroll: true, focusVisible: keyed.current } as FocusOptions);
    const onKey = (event: KeyboardEvent) => {
      if (event.key === "Tab") keyed.current = true;
      if (event.key === "Escape") shut(keyed.current);
    };
    document.addEventListener("keydown", onKey);
    return () => document.removeEventListener("keydown", onKey);
  }, [open, entry, shut]);

  const shown = filter === "all" ? SHELVES : SHELVES.filter((s) => s.id === filter);

  return (
    <>
      <nav aria-label="Shelves" className="doc-strip">
        <div ref={strip} className="doc-strip-scroll figs-strip" data-start={edges.start || undefined} data-end={edges.end || undefined}>
          <ul>
            {ROWS.map((r) => (
              <li key={r.id}>
                <button type="button" className="doc-link figs-pill" data-filter={r.id} aria-pressed={filter === r.id} style={tint(r.color)} onClick={() => setFilter(r.id)}>
                  {ICONS[r.id]}
                  {r.title}
                </button>
              </li>
            ))}
          </ul>
        </div>
      </nav>
      <main className="figs">
        <aside className="shelves">
          <div ref={list} role="group" aria-label="Shelves" className="shelf-list">
            <span ref={plate} className="shelf-plate" aria-hidden="true" />
            {ROWS.map((r) => (
              <button key={r.id} type="button" className="shelf" data-filter={r.id} aria-pressed={filter === r.id} style={tint(r.color)} onClick={() => setFilter(r.id)}>
                {ICONS[r.id]}
                <span>{r.title}</span>
                <span className="shelf-n">{r.n}</span>
              </button>
            ))}
          </div>
        </aside>
        <div className="figs-main">
          <div ref={head}>{header}</div>
          <div key={filter} className="figs-body" data-enter={entered ? "" : undefined}>
            {shown.map((s) => (
              <ShelfSection key={s.id} shelf={s} picked={open ? entry?.id : undefined} onPick={pick} />
            ))}
          </div>
          {/* wrapped, as the header is: an element from the server among this list's siblings warns for a key in dev */}
          <div>{end}</div>
        </div>
      </main>
      <aside
        id="figure-drawer"
        className="drawer"
        aria-labelledby={entry ? "figure-drawer-name" : undefined}
        inert={!open}
        data-open={open ? "" : undefined}
        onTransitionEnd={(event) => {
          if (event.target === event.currentTarget && event.propertyName === "visibility" && !open) setEntry(null);
        }}
      >
        {entry ? <Detail key={entry.id} entry={entry} code={entry.drawn ? code[entry.id] : undefined} intensity={intensity} setIntensity={setIntensity} reads={reads} setReads={setReads} closeRef={close} onClose={shut} /> : null}
      </aside>
    </>
  );
}

function ShelfSection({ shelf, picked, onPick }: { shelf: Shelf; picked?: string; onPick: (f: Entry, from: HTMLElement | null, keyboard: boolean) => void }) {
  const drawn = shelf.figures.filter((f) => f.drawn).length;
  return (
    <section id={`shelf-${shelf.id}`} className="doc-section" style={tint(shelf.color)} aria-labelledby={`shelf-${shelf.id}-h`}>
      <div className="doc-head figs-head">
        <h2 id={`shelf-${shelf.id}-h`} className="doc-h2">{shelf.title}</h2>
        <span className="figs-count">
          {shelf.id === "marks" ? "made with the skill" : <>{drawn} of {shelf.figures.length}<span className="sr-only"> drawn</span></>}
        </span>
      </div>
      <div className="fig-grid">
        {shelf.figures.map((f) => (
          <Tile key={f.id} entry={f} picked={picked === f.id} onPick={onPick} />
        ))}
      </div>
      {shelf.id === "marks" ? <p className="doc-p figs-notice">{NOTICE}</p> : null}
    </section>
  );
}

/**
 * One figure on its shelf. The whole tile takes a click, but the button is its name: the figure in the stage answers
 * the pointer and the keyboard itself, and Riffle's cards cannot sit inside a button. A click inside a made figure's
 * frame stays in the frame, so that tile opens from its name. Every tile plays its figure until a hand arrives.
 */
function Tile({ entry, picked, onPick }: { entry: Entry; picked: boolean; onPick: (f: Entry, from: HTMLElement | null, keyboard: boolean) => void }) {
  const button = useRef<HTMLButtonElement>(null);
  const Figure = entry.drawn ? COMPONENTS[entry.id] : null;
  const made = entry.drawn ? undefined : entry.made;
  return (
    <div className="fig-tile" data-planned={entry.drawn || made ? undefined : ""} data-picked={picked ? "" : undefined} onClick={(event) => onPick(entry, button.current, event.detail === 0)}>
      <div className="fig-stage">{Figure ? <Figure play /> : made ? <MadeFrame src={`/skill/${made.file}?theme=light&play=1`} title={entry.summary} /> : <Ghost />}</div>
      <div className="fig-foot">
        <button ref={button} type="button" className="fig-name" aria-label={entry.drawn || made ? undefined : `${entry.name}, planned`} aria-expanded={picked} aria-controls="figure-drawer" onClick={(event) => {
          event.stopPropagation();
          onPick(entry, button.current, event.detail === 0);
        }}>
          {entry.name}
        </button>
      </div>
    </div>
  );
}

function Detail({
  entry, code, intensity, setIntensity, reads, setReads, closeRef, onClose,
}: {
  entry: Entry; code?: Tab[]; intensity: number; setIntensity: (n: number) => void; reads: string; setReads: (s: string) => void;
  closeRef: React.RefObject<HTMLButtonElement | null>; onClose: (keyboard: boolean) => void;
}) {
  const shelf = SHELF_OF.get(entry.id)!;
  const Figure = entry.drawn ? COMPONENTS[entry.id] : null;
  const made = entry.drawn ? undefined : entry.made;
  return (
    <div className="detail">
      <div className="detail-h">
        <div>
          <h2 id="figure-drawer-name" className="detail-name">{entry.name}</h2>
          <p className="detail-meta">
            <span className="detail-shelf" style={tint(shelf.color)}>{ICONS[shelf.id]}{shelf.title}</span>
            {entry.drawn || made ? null : <span className="detail-tag">planned</span>}
          </p>
        </div>
        <button ref={closeRef} type="button" className="detail-close" aria-label="Close" onClick={(event) => onClose(event.detail === 0)}>
          <svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" aria-hidden="true">
            <path d="m4 4 8 8M12 4l-8 8" />
          </svg>
        </button>
      </div>
      {/* a made page brings its own plate and controls, so it sits outside the stage's box */}
      {made ? (
        <div className="detail-page"><ExampleFrame src={`/skill/${made.file}?theme=light`} title={entry.summary} /></div>
      ) : (
        <div className="fig-stage detail-stage">{Figure ? <Figure intensity={intensity} onRead={setReads} /> : <Ghost />}</div>
      )}
      <p className="detail-sum">
        {entry.summary} <b>Higher intensity:</b> {entry.stronger}
      </p>
      {made ? (
        <div className="detail-made">
          <Command code={made.prompt} kind="prompt" label={`Copy prompt: ${entry.name}`} />
          <p className="doc-p">Made with <a className="doc-more" href="/skills">hairline-create</a>. It is not in the package: the page is one file, and the prompt above draws it again.</p>
          <p className="doc-p figs-notice">{NOTICE}</p>
        </div>
      ) : Figure ? (
        <>
          <label className="slider">
            <span>intensity</span>
            <input type="range" min="0" max="1" step="0.01" value={intensity} onChange={(event) => setIntensity(Number(event.target.value))} />
            <span className="tabular-nums" aria-hidden="true">{intensity.toFixed(2)}</span>
          </label>
          <p className="detail-reads">
            reads <b aria-live="polite">{reads}</b>
          </p>
          {code ? <Tabs tabs={code} label={`${entry.name} code`} /> : null}
        </>
      ) : (
        <div className="detail-ask">
          <p><b>Not drawn yet.</b> This one is on the list. Ask for it, or for a variation, and it moves up.</p>
          <a className="doc-more" href={`${LINKS.github}/issues/new?title=${encodeURIComponent(`Figure: ${entry.name}`)}`}>Request on GitHub</a>
        </div>
      )}
    </div>
  );
}
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