{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "usage",
  "type": "registry:block",
  "title": "Usage block",
  "description": "A plan's usage as one screen, drawn only in rails: trends under the figures, storage and bandwidth by kind of file, the plan's limits against their budgets and build times by site. Each kind of file keeps one data hue on the whole screen, and nothing moves.",
  "registryDependencies": [
    "https://littmd.vercel.app/r/litt.json",
    "https://littmd.vercel.app/r/breakdown.json",
    "https://littmd.vercel.app/r/chart.json",
    "https://littmd.vercel.app/r/sparkline.json",
    "https://littmd.vercel.app/r/spread.json",
    "https://littmd.vercel.app/r/stat.json",
    "https://littmd.vercel.app/r/tag.json"
  ],
  "files": [
    {
      "path": "registry/litt/components/litt-blocks/usage.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n// @litt/usage 2026.10.26. What changed: https://littmd.vercel.app/changelog.md\n\n/**\n * Usage: a plan's usage, drawn only in rails. A block: a whole screen built from the litt parts, to copy and make your\n * own. Swap the sample data at the top for yours; the layout, the hues and the words around them stay.\n *\n * Trends sit in thin lines at the foot of the figures, storage and bandwidth split by kind of file, the plan's limits\n * carry their budgets, and build times spread by site. Each hue names one kind of file across the whole screen (R7),\n * everything else stays in the foreground, and nothing moves. The grid measures itself, so it stacks in a narrow box.\n */\nimport { useId, type ReactNode } from \"react\";\nimport { Breakdown, type BreakdownItem } from \"../litt/breakdown\";\nimport { Meter } from \"../litt/chart\";\nimport { Sparkline } from \"../litt/sparkline\";\nimport { Spread } from \"../litt/spread\";\nimport { Stat, StatGroup } from \"../litt/stat\";\nimport { Tag } from \"../litt/tag\";\n\n/* ----------------------------------------------------------------- data */\n\n/** A seeded generator (mulberry32), so the block draws the same data on every load and on the server. */\nfunction seeded(seed: number) {\n  let a = seed >>> 0;\n  return () => {\n    a = (a + 0x6d2b79f5) >>> 0;\n    let t = a;\n    t = Math.imul(t ^ (t >>> 15), t | 1);\n    t ^= t + Math.imul(t ^ (t >>> 7), t | 61);\n    return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n  };\n}\n\n/** Fourteen days that wander around a level, with quieter weekends. */\nfunction days(seed: number, level: number, swing: number) {\n  const next = seeded(seed);\n  return Array.from({ length: 14 }, (_, i) => Math.round(level * (i % 7 >= 5 ? 0.55 : 1) + (next() - 0.5) * swing));\n}\n\n/** Build times in seconds for one site: most near its median, a few slow ones. */\nfunction builds(seed: number, median: number, spread: number, count = 40) {\n  const next = seeded(seed);\n  return Array.from({ length: count }, () => {\n    const z = Math.sqrt(-2 * Math.log(Math.max(next(), 1e-9))) * Math.cos(2 * Math.PI * next());\n    return Math.round(Math.max(8, median * Math.exp(spread * z)));\n  });\n}\n\n/* Each kind of file keeps one hue everywhere on the page (R7). */\nconst STORAGE: BreakdownItem[] = [\n  { label: \"Video\", value: 58, hue: \"violet\" },\n  { label: \"Images\", value: 24, hue: \"teal\" },\n  { label: \"Documents\", value: 6, hue: \"blue\" },\n  { label: \"Fonts\", value: 3, hue: \"amber\" },\n];\nconst BANDWIDTH: BreakdownItem[] = [\n  { label: \"Images\", value: 212, hue: \"teal\" },\n  { label: \"Video\", value: 151, hue: \"violet\" },\n  { label: \"Fonts\", value: 31, hue: \"amber\" },\n  { label: \"Documents\", value: 18, hue: \"blue\" },\n];\n\nconst SITES = [\n  { label: \"Halo site\", values: builds(41, 39, 0.28) },\n  { label: \"Northwind\", values: builds(42, 29, 0.22) },\n  { label: \"Marlow Labs\", values: builds(43, 58, 0.3) },\n  { label: \"Atlas portfolio\", values: builds(44, 37, 0.2) },\n  { label: \"Grotta Type\", values: builds(45, 23, 0.18) },\n];\n\n/* ----------------------------------------------------------------- the page */\n\n/** A section of the page: a small heading, a quiet note, and its rails. No box: the air does the separating. */\nfunction Section({ title, note, children }: { title: string; note: string; children: ReactNode }) {\n  const id = useId();\n  return (\n    <section aria-labelledby={id} className=\"grid min-w-0 content-start gap-6\">\n      <div className=\"grid gap-1\">\n        <h4 id={id} className=\"text-litt-body text-litt-fg\">\n          {title}\n        </h4>\n        <p className=\"text-litt-small text-litt-fg-subtle\">{note}</p>\n      </div>\n      {children}\n    </section>\n  );\n}\n\nexport function Usage() {\n  return (\n    <div className=\"@container w-full\">\n      <div className=\"grid grid-cols-1 gap-16\">\n        <header className=\"flex flex-wrap items-center gap-3\">\n          <h3 className=\"text-litt-h3 text-litt-fg\">Halden Studio</h3>\n          <Tag>Pro plan</Tag>\n          <Tag>October</Tag>\n        </header>\n\n        <StatGroup>\n          <Stat label=\"Deploys\" value={214} delta=\"Up 12% on September\" tone=\"good\" trend={<Sparkline label=\"Deploys per day, last 14 days\" values={days(1, 19, 8)} />} />\n          <Stat\n            label=\"Median build\"\n            value={39}\n            unit=\"s\"\n            delta=\"Down 4 s on September\"\n            tone=\"good\"\n            trend={<Sparkline label=\"Median build time, last 14 days\" values={days(2, 41, 8)} baseline={45} formatValue={(v) => `${v} s`} />}\n          />\n          <Stat label=\"Bandwidth\" value={412} unit=\" GB\" trend={<Sparkline label=\"Bandwidth per day, last 14 days\" values={days(3, 32, 10)} formatValue={(v) => `${v} GB`} />} />\n          <Stat label=\"Sites live\" value={14} delta=\"Up 2 on September\" tone=\"good\" />\n        </StatGroup>\n\n        <div className=\"grid grid-cols-1 gap-16 @min-[52rem]:grid-cols-2\">\n          <Section title=\"Files\" note=\"Storage by kind of file, against the plan's 100 GB.\">\n            <Breakdown label=\"Storage\" items={STORAGE} total={100} totalText=\"91 of 100 GB\" formatValue={(v) => `${v} GB`} />\n          </Section>\n\n          <div className=\"grid min-w-0 content-start gap-16\">\n            <Section title=\"Traffic\" note=\"Bandwidth by the same kinds, in the same hues.\">\n              <Breakdown label=\"Bandwidth\" items={BANDWIDTH} totalText=\"412 GB\" formatValue={(v) => `${v} GB`} layout=\"legend\" />\n            </Section>\n            <Section title=\"Limits\" note=\"The plan's budgets. The tick is the budget, and only the bar past it is news.\">\n              <div className=\"grid gap-6\">\n                <Meter label=\"Build minutes\" value={1380} max={3000} valueText=\"1,380 of 3,000\" target={2400} targetText=\"budget 2,400\" />\n                <Meter label=\"Bandwidth\" value={412} max={500} valueText=\"412 of 500 GB\" target={400} targetText=\"budget 400 GB\" />\n                <Meter label=\"Seats\" value={4} max={5} valueText=\"4 of 5\" steps={5} />\n                <Meter label=\"Custom domains\" value={7} max={10} valueText=\"7 of 10\" steps={10} />\n              </div>\n            </Section>\n          </div>\n        </div>\n\n        <Section title=\"Build times by site\" note=\"The last 40 builds of each site. Rose is build time.\">\n          <Spread label=\"Build times by site, last 40 builds\" items={SITES} hue=\"rose\" domain={[0, 120]} ticks={[0, 40, 80, 120].map((v) => ({ value: v, label: `${v} s` }))} formatValue={(v) => `${Math.round(v)} s`} goal={60} goalLabel=\"60 s goal\" />\n        </Section>\n      </div>\n    </div>\n  );\n}\n",
      "target": "components/litt-blocks/usage.tsx"
    }
  ],
  "docs": "Import Usage from components/litt-blocks/usage. The sample data sits at the top of the file: keep one hue per kind of thing across the screen when you replace it. See it live at https://littmd.vercel.app/#usage.",
  "meta": {
    "version": "2026.10.26",
    "released": "2026-10-26",
    "changelog": "https://littmd.vercel.app/changelog.md"
  }
}
