dowel-ui 0.23.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,11 +14,27 @@
14
14
  "path": "dowel/theme.css",
15
15
  "target": "~/dowel/theme.css",
16
16
  "type": "registry:file",
17
- "content": "/*\n * dowel theme - the token vocabulary every product of the lacodda line shares.\n *\n * The vocabulary comes from the products themselves: kilna and kasl-server\n * already ship the same token names (bg / raise / soft / line / text / dim /\n * accent / good / warn / bad / info) and differ only in values. That is the\n * contract this file freezes. Names are the mockup's own words rather than\n * stock component-library names, so a screen can be checked against a mockup\n * in the mockup's words.\n *\n * Two things are parametric, and everything else is derived from them:\n *\n * --accent-base the product's hue from the brand-line registry\n * --neutral-base the hue the greys are tinted with (the accent, by default)\n *\n * Tinting the neutrals is not decoration - it is what the two live products do\n * by hand: kilna's greys lean magenta, kasl-server's lean gold. Here that lean\n * is one declaration instead of thirty hand-picked hex values.\n *\n * Soft variants are mixed from their own base with `color-mix`, so a product\n * that overrides `--accent-base` gets a matching `--accent-soft` for free and\n * cannot pick one that disagrees with it.\n *\n * Theme selection: no class on the root element follows the operating system,\n * an explicit `light` or `dark` class pins the theme. Components never use\n * `dark:` utilities - every colour goes through a token, and the theme swaps\n * the token underneath.\n */\n\n:root {\n /* The two parameters. `--accent-base` is overridden per product by an accent\n * file; `--neutral-base` follows it unless a product says otherwise. */\n --accent-base: #e8862d;\n --neutral-base: var(--accent-base);\n\n /* Ink and ground of the dark theme, before the neutral tint is mixed in.\n * Kept as their own tokens so the tint amount is the only thing that\n * changes when a product wants greyer or warmer chrome. */\n --ground: #131316;\n --ink: #ece9ef;\n\n /* How much of `--neutral-base` bleeds into the greys. The live products sit\n * at roughly this much: enough that the chrome belongs to the product,\n * little enough that it still reads as grey. */\n --neutral-tint: 6%;\n --neutral-tint-strong: 9%;\n\n color-scheme: dark;\n\n --bg: color-mix(in oklab, var(--neutral-base) var(--neutral-tint), var(--ground));\n --raise: color-mix(in oklab, var(--neutral-base) var(--neutral-tint), #1c1c21);\n\n /* Surfaces that lift by translucency rather than by their own colour: they\n * must work over `--bg` and over `--raise` alike. */\n --soft: rgb(255 255 255 / 0.045);\n --softer: rgb(255 255 255 / 0.025);\n --line: rgb(255 255 255 / 0.08);\n --line-2: rgb(255 255 255 / 0.15);\n\n --text: color-mix(in oklab, var(--neutral-base) var(--neutral-tint), var(--ink));\n --dim: color-mix(in oklab, var(--neutral-base) var(--neutral-tint-strong), #a7a2ad);\n --faint: color-mix(in oklab, var(--neutral-base) var(--neutral-tint-strong), #6e6a76);\n\n --accent: var(--accent-base);\n /* The hover/active partner: lighter on dark, where the ground is what the\n * accent has to separate from. */\n --accent-2: color-mix(in oklab, white 22%, var(--accent-base));\n --accent-soft: color-mix(in oklab, var(--accent-base) 16%, transparent);\n\n /* Status hues are the line's own and do not follow the product accent: a\n * green that shifted per product would stop meaning \"good\". Meaning never\n * rests on colour alone - a badge carries an icon and a word - so these\n * exist for emphasis, not as the message. */\n --good: #45d18f;\n --warn: #e8b13f;\n --bad: #ef6a6a;\n --info: #4cc4e0;\n --good-soft: color-mix(in oklab, var(--good) 14%, transparent);\n --warn-soft: color-mix(in oklab, var(--warn) 14%, transparent);\n --bad-soft: color-mix(in oklab, var(--bad) 14%, transparent);\n --info-soft: color-mix(in oklab, var(--info) 15%, transparent);\n\n /* Elevation, three steps. The products had one shadow and used it for\n * everything that leaves the flow - a toast, a dropdown and a modal all\n * floated by the same amount, so a modal never felt further away than the\n * menu it covered. `raise` keeps its original value, so nothing shifts under\n * the products already using it; the other two are the steps either side. */\n --shadow-lift: 0 2px 8px rgb(0 0 0 / 0.3);\n --shadow-raise: 0 10px 34px rgb(0 0 0 / 0.45);\n --shadow-float: 0 24px 60px rgb(0 0 0 / 0.55);\n}\n\n/*\n * Light theme, twice: once for the operating system's preference, once for the\n * explicit `light` class. The declarations are identical - only the selector\n * differs - so that a product can pin a theme against the system setting.\n */\n@media (prefers-color-scheme: light) {\n :root:not(.dark) {\n color-scheme: light;\n\n --ground: #f6f5f7;\n --ink: #232027;\n\n --bg: color-mix(in oklab, var(--neutral-base) var(--neutral-tint), var(--ground));\n --raise: #ffffff;\n\n /* Tinted, and translucent - which took two goes to get right.\n *\n * `color-mix` mixes the alpha along with the colour, so mixing 60% of an\n * opaque accent into a 5%-opaque grey gives a surface 62% opaque: twelve\n * times denser than the hairline it was meant to be. It went unnoticed for\n * ten versions because `bg-soft` was only ever used for a hover, where a\n * flash of colour reads as feedback rather than as a mistake. The first\n * component to sit on it permanently - Alert - made it obvious.\n *\n * `oklch(from … / alpha)` keeps the alpha out of the mix: the hue comes\n * from the tinted colour, the transparency is stated. */\n --soft: oklch(from color-mix(in oklab, var(--neutral-base) 45%, #181420) l c h / 0.05);\n --softer: oklch(from color-mix(in oklab, var(--neutral-base) 45%, #181420) l c h / 0.03);\n --line: oklch(from color-mix(in oklab, var(--neutral-base) 30%, #181420) l c h / 0.11);\n --line-2: oklch(from color-mix(in oklab, var(--neutral-base) 30%, #181420) l c h / 0.2);\n\n --text: color-mix(in oklab, var(--neutral-base) var(--neutral-tint), var(--ink));\n --dim: color-mix(in oklab, var(--neutral-base) var(--neutral-tint-strong), #63606b);\n --faint: color-mix(in oklab, var(--neutral-base) var(--neutral-tint-strong), #8a8692);\n\n /* On a light ground the accent has to darken to stay legible as text and\n * as a fill. It darkens *to* a lightness rather than *by* an amount: how\n * far a hue has to travel depends on where it starts, and a fixed step\n * that suits magenta leaves lime and gold short. Pinning the lightness and\n * keeping the hue and chroma clears 5:1 for every accent in the line. */\n --accent: oklch(from var(--accent-base) 0.5 c h);\n --accent-2: oklch(from var(--accent-base) 0.4 c h);\n --accent-soft: color-mix(in oklab, var(--accent-base) 12%, transparent);\n\n --good: #0c8554;\n --warn: #9a6b0c;\n --bad: #c93b3b;\n --info: #0d7f9c;\n --good-soft: color-mix(in oklab, var(--good) 12%, transparent);\n --warn-soft: color-mix(in oklab, var(--warn) 14%, transparent);\n --bad-soft: color-mix(in oklab, var(--bad) 12%, transparent);\n --info-soft: color-mix(in oklab, var(--info) 11%, transparent);\n\n --shadow-lift: 0 2px 8px rgb(30 24 38 / 0.08);\n --shadow-raise: 0 10px 30px rgb(30 24 38 / 0.14);\n --shadow-float: 0 24px 60px rgb(30 24 38 / 0.18);\n }\n}\n\n:root.light {\n color-scheme: light;\n\n --ground: #f6f5f7;\n --ink: #232027;\n\n --bg: color-mix(in oklab, var(--neutral-base) var(--neutral-tint), var(--ground));\n --raise: #ffffff;\n\n /* The same surfaces as above; see the note there. */\n --soft: oklch(from color-mix(in oklab, var(--neutral-base) 45%, #181420) l c h / 0.05);\n --softer: oklch(from color-mix(in oklab, var(--neutral-base) 45%, #181420) l c h / 0.03);\n --line: oklch(from color-mix(in oklab, var(--neutral-base) 30%, #181420) l c h / 0.11);\n --line-2: oklch(from color-mix(in oklab, var(--neutral-base) 30%, #181420) l c h / 0.2);\n\n --text: color-mix(in oklab, var(--neutral-base) var(--neutral-tint), var(--ink));\n --dim: color-mix(in oklab, var(--neutral-base) var(--neutral-tint-strong), #63606b);\n --faint: color-mix(in oklab, var(--neutral-base) var(--neutral-tint-strong), #8a8692);\n\n /* Darkened to a lightness, not by an amount - see the note above. */\n --accent: oklch(from var(--accent-base) 0.5 c h);\n --accent-2: oklch(from var(--accent-base) 0.4 c h);\n --accent-soft: color-mix(in oklab, var(--accent-base) 12%, transparent);\n\n --good: #0c8554;\n --warn: #9a6b0c;\n --bad: #c93b3b;\n --info: #0d7f9c;\n --good-soft: color-mix(in oklab, var(--good) 12%, transparent);\n --warn-soft: color-mix(in oklab, var(--warn) 14%, transparent);\n --bad-soft: color-mix(in oklab, var(--bad) 12%, transparent);\n --info-soft: color-mix(in oklab, var(--info) 11%, transparent);\n\n --shadow-lift: 0 2px 8px rgb(30 24 38 / 0.08);\n --shadow-raise: 0 10px 30px rgb(30 24 38 / 0.14);\n --shadow-float: 0 24px 60px rgb(30 24 38 / 0.18);\n}\n\n/*\n * `--on-accent` - what sits on top of an accent fill.\n *\n * A light accent (gold, lime, amber) needs dark glyphs; a dark one needs\n * white. The live products picked this by hand and wrote the answer into the\n * theme; here the theme works it out, by the same rule the brand-line S tile\n * uses.\n *\n * `contrast-color()` is the direct way to say it and is used where supported.\n * The fallback covers browsers that lack it. Relative colour syntax exposes\n * the accent's own lightness as `l`; `clamp()` turns that into a hard switch,\n * because the multiplication drives the middle term far past either bound\n * everywhere except within a hair of the threshold. Below it the accent is\n * dark and the result is 1 (white); above it, 0 (black). Chroma is dropped to\n * zero, so what comes out is neutral rather than a tinted grey.\n *\n * The threshold is 0.58, and it is deliberately far below the midpoint an eye\n * would guess. Contrast is not symmetric about it: a mid-lightness colour is\n * still much closer to white than to black in luminance, so black wins well\n * before the colour looks light. Checked against all fourteen accents of the\n * line - every one of them reads better with dark glyphs, the closest being\n * cobalt at 4.86:1 against 4.32:1 for white. A higher threshold is what puts\n * white text on magenta at 3.6:1, which is the defect this rule exists to\n * prevent.\n */\n:root {\n --on-accent: oklch(from var(--accent) clamp(0, (0.58 - l) * 1000, 1) 0 0);\n\n /*\n * The same question for the status fills, and it has to be asked separately:\n * `--on-accent` is derived from the accent, so using it on a `--warn` fill\n * is only ever right by coincidence. The line's first consumer did exactly\n * that - a count on a yellow badge, drawn in white at 1.95:1 - and it read\n * as correct for as long as the product happened to pin white.\n *\n * The status hues do not follow the product accent, so these four are the\n * same for every product; they are still derived rather than written down,\n * because the status colours themselves change between the themes.\n */\n --on-good: oklch(from var(--good) clamp(0, (0.58 - l) * 1000, 1) 0 0);\n --on-warn: oklch(from var(--warn) clamp(0, (0.58 - l) * 1000, 1) 0 0);\n --on-bad: oklch(from var(--bad) clamp(0, (0.58 - l) * 1000, 1) 0 0);\n --on-info: oklch(from var(--info) clamp(0, (0.58 - l) * 1000, 1) 0 0);\n}\n\n@supports (color: contrast-color(red)) {\n :root {\n --on-accent: contrast-color(var(--accent));\n --on-good: contrast-color(var(--good));\n --on-warn: contrast-color(var(--warn));\n --on-bad: contrast-color(var(--bad));\n --on-info: contrast-color(var(--info));\n }\n}\n\n/*\n * The Tailwind 4 surface. `--color-*: initial` drops the stock palette on\n * purpose: a raw `bg-zinc-800` in a product should not compile, because the\n * only colours that exist here are the line's own.\n */\n@theme inline {\n --color-*: initial;\n --color-bg: var(--bg);\n --color-raise: var(--raise);\n --color-soft: var(--soft);\n --color-softer: var(--softer);\n --color-line: var(--line);\n --color-line-2: var(--line-2);\n --color-text: var(--text);\n --color-dim: var(--dim);\n --color-faint: var(--faint);\n --color-accent: var(--accent);\n --color-accent-2: var(--accent-2);\n --color-accent-soft: var(--accent-soft);\n --color-on-accent: var(--on-accent);\n --color-on-good: var(--on-good);\n --color-on-warn: var(--on-warn);\n --color-on-bad: var(--on-bad);\n --color-on-info: var(--on-info);\n --color-good: var(--good);\n --color-good-soft: var(--good-soft);\n --color-warn: var(--warn);\n --color-warn-soft: var(--warn-soft);\n --color-bad: var(--bad);\n --color-bad-soft: var(--bad-soft);\n --color-info: var(--info);\n --color-info-soft: var(--info-soft);\n\n /* Kept because they are not palette choices: a hairline is `transparent`,\n * an SVG follows `currentColor`, and pure black and white are what an\n * overlay scrim and a print sheet are made of. */\n --color-transparent: transparent;\n --color-current: currentColor;\n --color-white: #fff;\n --color-black: #000;\n\n /*\n * Type. System stacks on purpose: a downloaded face costs a network round\n * trip before the first word appears, and the line's products are desktop\n * tools where the operating system's own face is the one the user already\n * reads everything else in.\n */\n --font-sans: 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, sans-serif;\n --font-mono: ui-monospace, 'Cascadia Code', 'SF Mono', Consolas, monospace;\n\n /*\n * Radius. Taken from what the products actually draw, not from a ratio:\n * `rounded-[9px]` appears twenty times and `rounded-[10px]` twelve, because\n * a control and the primary button were tuned by eye and then copied. The\n * scale keeps the cluster they landed in and gives it names.\n *\n * `md` is the control radius - inputs, buttons, list rows. That the primary\n * button was one pixel rounder than every other variant is not preserved:\n * the products differ from themselves there, and buttons of the same size\n * sitting side by side should not have mismatched corners.\n */\n --radius-xs: 4px;\n --radius-sm: 6px;\n --radius-md: 9px;\n --radius-lg: 12px;\n --radius-xl: 16px;\n --radius-2xl: 20px;\n\n /*\n * A radius nested inside another has to be smaller by the gap between them,\n * or the inner corner looks wrong against the outer one. The products did\n * this by hand once - 18px outside, 17px inside - and nowhere else.\n */\n --radius-inner: calc(var(--radius-lg) - 1px);\n\n /*\n * Type scale. The products live between 10px and 14px: `text-sm` and\n * `text-xs` together account for nine tenths of every size in both, and the\n * rest scattered across 9, 9.5, 10, 10.5, 11, 11.5, 12.5 and 13 - nine steps\n * inside four pixels, which no eye distinguishes and no reason justifies.\n * This is the same range with the noise removed.\n */\n --text-2xs: 10px;\n --text-2xs--line-height: 14px;\n --text-xs: 11px;\n --text-xs--line-height: 15px;\n --text-sm: 12px;\n --text-sm--line-height: 16px;\n --text-base: 14px;\n --text-base--line-height: 20px;\n --text-lg: 16px;\n --text-lg--line-height: 22px;\n --text-xl: 18px;\n --text-xl--line-height: 24px;\n --text-2xl: 21px;\n --text-2xl--line-height: 28px;\n\n /* Weights. `semibold` is what both products use for anything emphasised;\n * `bold` appears in neither, and the one `font-[650]` in a page title is the\n * kind of value a scale exists to absorb. */\n --font-weight-normal: 400;\n --font-weight-medium: 500;\n --font-weight-semibold: 600;\n\n /* Tracking. The uppercase caption is the only place the products track at\n * all - and they do it at 0.08em in six files and 0.09em in three, a\n * difference nobody can see. One name settles it. */\n --tracking-caption: 0.085em;\n --tracking-tight: -0.01em;\n\n /* Easing. `out` for anything the user asked for - it arrives fast and\n * settles, which reads as responsive. `in-out` for something moving on its\n * own. `in` is deliberately absent: it starts slowly, which on a control\n * reads as lag. */\n --ease-out: cubic-bezier(0.2, 0, 0, 1);\n --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);\n\n /*\n * Elevation. Three steps, because the products had one and used it for a\n * toast, a dropdown and a modal alike - so a modal never sat further from\n * the page than the menu it covered.\n */\n --shadow-lift: var(--shadow-lift);\n --shadow-raise: var(--shadow-raise);\n --shadow-float: var(--shadow-float);\n}\n\n/*\n * Stacking order.\n *\n * Not in `@theme`: Tailwind has no z-index namespace, so `z-50` is a literal\n * fifty and a named step would not compile. These are custom properties a\n * component reads directly - `z-index: var(--z-modal)`.\n *\n * The order is the products' own, with the gaps closed. They ran 10 for an\n * in-flow popup, 20 sticky, 30 menu, 40 for a floating button, 50 for modals\n * and drawers, then jumped to 70 and 80 for the command palette - which had to\n * clear the modal layer and had no name to do it with.\n */\n:root {\n /*\n * Motion. One duration existed before this - 160ms on a route change - and\n * everything else rode Tailwind's default. These are the steps around it:\n * `quick` for a colour or an opacity that should feel immediate, `base` for\n * something that moves, `slow` for something arriving from off-screen.\n *\n * Not in `@theme`: Tailwind's `duration-*` utility takes a literal number,\n * not a named step, so these are read directly - `transition-duration:\n * var(--duration-base)`. The easing curves opposite them ARE a namespace,\n * so `ease-out` is a class.\n *\n * Every duration here is for people who want motion: `prefers-reduced-\n * motion` cuts them to nothing further down.\n */\n --duration-quick: 120ms;\n --duration-base: 160ms;\n --duration-slow: 240ms;\n\n --z-popup: 10;\n --z-sticky: 20;\n --z-menu: 30;\n --z-floating: 40;\n --z-overlay: 50;\n --z-modal: 60;\n --z-palette: 70;\n --z-toast: 80;\n}\n\n/*\n * Base layer: what every product would otherwise write again. Scoped to\n * elements and to `:focus-visible`, never to a class, so nothing here can\n * collide with a component.\n */\nbody {\n margin: 0;\n background-color: var(--bg);\n color: var(--text);\n font-family: var(--font-sans);\n -webkit-font-smoothing: antialiased;\n}\n\n/*\n * In `@layer base`, so a component can turn it off.\n *\n * Unlayered, this rule has the same specificity as `focus-visible:outline-none`\n * from Tailwind - both are one pseudo-class - and wins on source order alone,\n * because the theme is imported before the utilities. Every component that\n * draws its own focus ring got this one on top of it: the command palette's\n * field had an accent outline it had explicitly opted out of, and a combobox\n * with chips drew two rings, one around the box and one around the input\n * inside it.\n *\n * A layered rule loses to any unlayered one regardless of specificity, which\n * is the whole point of cascade layers - the base layer states a default and\n * a component overrides it by saying so.\n */\n@layer base {\n :focus-visible {\n outline: 2px solid var(--accent);\n outline-offset: 2px;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n *,\n *::before,\n *::after {\n transition-duration: 0.01ms !important;\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n scroll-behavior: auto !important;\n }\n}\n\n/*\n * Scrollbars. A browser's default bar is a piece of someone else's chrome\n * sitting in the middle of the product - full width, with step arrows. These\n * are the line's own: thin, in the palette, drawn only where something\n * actually scrolls.\n */\n* {\n scrollbar-width: thin;\n scrollbar-color: var(--line-2) transparent;\n}\n\n*::-webkit-scrollbar {\n width: 10px;\n height: 10px;\n}\n\n*::-webkit-scrollbar-track {\n background: transparent;\n}\n\n*::-webkit-scrollbar-thumb {\n border: 3px solid transparent;\n border-radius: 999px;\n background: var(--line-2);\n background-clip: content-box;\n /* The thumb is drawn proportional to how much of the document fits on\n * screen, so a long one collapses it to a few pixels: still visible, no\n * longer catchable by a pointer. This is the floor below which it stops\n * being a control. */\n min-height: 2.5rem;\n}\n\n*::-webkit-scrollbar-thumb:hover {\n background: var(--dim);\n background-clip: content-box;\n}\n\n*::-webkit-scrollbar-corner {\n background: transparent;\n}\n\n*::-webkit-scrollbar-button {\n display: none;\n}\n"
17
+ "content": "/*\n * dowel theme - the token vocabulary every product of the lacodda line shares.\n *\n * The vocabulary comes from the products themselves: kilna and kasl-server\n * already ship the same token names (bg / raise / soft / line / text / dim /\n * accent / good / warn / bad / info) and differ only in values. That is the\n * contract this file freezes. Names are the mockup's own words rather than\n * stock component-library names, so a screen can be checked against a mockup\n * in the mockup's words.\n *\n * Two things are parametric, and everything else is derived from them:\n *\n * --accent-base the product's hue from the brand-line registry\n * --neutral-base the hue the greys are tinted with (the accent, by default)\n *\n * Tinting the neutrals is not decoration - it is what the two live products do\n * by hand: kilna's greys lean magenta, kasl-server's lean gold. Here that lean\n * is one declaration instead of thirty hand-picked hex values.\n *\n * Soft variants are mixed from their own base with `color-mix`, so a product\n * that overrides `--accent-base` gets a matching `--accent-soft` for free and\n * cannot pick one that disagrees with it.\n *\n * Theme selection: no class on the root element follows the operating system,\n * an explicit `light` or `dark` class pins the theme. Components never use\n * `dark:` utilities - every colour goes through a token, and the theme swaps\n * the token underneath.\n */\n\n:root {\n /* The two parameters. `--accent-base` is overridden per product by an accent\n * file; `--neutral-base` follows it unless a product says otherwise. */\n --accent-base: #e8862d;\n --neutral-base: var(--accent-base);\n\n /* Ink and ground of the dark theme, before the neutral tint is mixed in.\n * Kept as their own tokens so the tint amount is the only thing that\n * changes when a product wants greyer or warmer chrome. */\n --ground: #131316;\n --ink: #ece9ef;\n\n /* How much of `--neutral-base` bleeds into the greys. The live products sit\n * at roughly this much: enough that the chrome belongs to the product,\n * little enough that it still reads as grey. */\n --neutral-tint: 6%;\n --neutral-tint-strong: 9%;\n\n color-scheme: dark;\n\n --bg: color-mix(in oklab, var(--neutral-base) var(--neutral-tint), var(--ground));\n --raise: color-mix(in oklab, var(--neutral-base) var(--neutral-tint), #1c1c21);\n\n /* Surfaces that lift by translucency rather than by their own colour: they\n * must work over `--bg` and over `--raise` alike. */\n --soft: rgb(255 255 255 / 0.045);\n --softer: rgb(255 255 255 / 0.025);\n --line: rgb(255 255 255 / 0.08);\n --line-2: rgb(255 255 255 / 0.15);\n\n --text: color-mix(in oklab, var(--neutral-base) var(--neutral-tint), var(--ink));\n --dim: color-mix(in oklab, var(--neutral-base) var(--neutral-tint-strong), #a7a2ad);\n --faint: color-mix(in oklab, var(--neutral-base) var(--neutral-tint-strong), #6e6a76);\n\n --accent: var(--accent-base);\n /* The hover/active partner: lighter on dark, where the ground is what the\n * accent has to separate from. */\n --accent-2: color-mix(in oklab, white 22%, var(--accent-base));\n --accent-soft: color-mix(in oklab, var(--accent-base) 16%, transparent);\n\n /* Status hues are the line's own and do not follow the product accent: a\n * green that shifted per product would stop meaning \"good\". Meaning never\n * rests on colour alone - a badge carries an icon and a word - so these\n * exist for emphasis, not as the message. */\n --good: #45d18f;\n --warn: #e8b13f;\n --bad: #ef6a6a;\n --info: #4cc4e0;\n --good-soft: color-mix(in oklab, var(--good) 14%, transparent);\n --warn-soft: color-mix(in oklab, var(--warn) 14%, transparent);\n --bad-soft: color-mix(in oklab, var(--bad) 14%, transparent);\n --info-soft: color-mix(in oklab, var(--info) 15%, transparent);\n\n /* Series colours, for charts.\n *\n * Like the status hues and unlike everything else here, these do NOT follow\n * the product accent - and that is the whole decision. A series is a\n * property of the data, not of the product showing it; a palette derived\n * from the accent would paint the same series differently in kilna and in\n * kasl-server, which is the one thing a series colour must never do.\n *\n * Deriving them from the accent was measured, not guessed: rotating the hue\n * by fixed angles put the best candidate at Delta-E 12.1 from the product's\n * own accent with adjacent pairs at 9.8, and threw 46 of 152 colours outside\n * sRGB. The fixed palette does better on both counts.\n *\n * The cost of fixing them is stated plainly: 13 of the line's 19 accents sit\n * within Delta-E 8 of some slot (lyrid 2.7, atlas 3.1, turnout 3.2). A chart\n * shows one accent, so this is survivable - but it is exactly why identity is\n * carried by the legend and by direct labels, never by hue on its own. The\n * components of this block enforce that; it is not advice.\n *\n * Assigned in order, 1..8, and never cycled: a ninth series folds into\n * \"other\", or the chart becomes small multiples. The order is the\n * colour-blind-safety mechanism - the worst adjacent pair is Delta-E 8.4\n * under simulated protanopia - so re-ordering these breaks a gate.\n *\n * Slot 8 is the line's own value rather than the reference palette's. The\n * reference red sat Delta-E 1.9 from `--bad`, which would have let a series\n * impersonate a status; this one clears every status by 15 and costs\n * nothing, the worst adjacent pair being unchanged.\n *\n * Some slots sit below 3:1 against the surface. That is allowed only because\n * the relief ships with them: visible values, or the table view.\n */\n --series-1: #3987e5;\n --series-2: #d95926;\n --series-3: #199e70;\n --series-4: #c98500;\n --series-5: #d55181;\n --series-6: #008300;\n --series-7: #9085e9;\n --series-8: #a3215a;\n\n /* Magnitude rather than identity: one hue, light to dark. A heatmap cell\n * reads this. The lightest step is allowed to recede toward the surface,\n * because \"near zero\" should; an ordered-but-discrete scale (tiers, funnel\n * stages) starts at 300 instead, where the contrast still holds. */\n --scale-100: #0d366b;\n --scale-200: #184f95;\n --scale-300: #256abf;\n --scale-400: #2a78d6;\n --scale-500: #3987e5;\n --scale-600: #5598e7;\n --scale-700: #86b6ef;\n\n /* The chart's own furniture. A gridline that competes with the data is drawn\n * wrong, so it is quieter than `--line`; the axis is the one that may be\n * seen. */\n --chart-grid: rgb(255 255 255 / 0.06);\n --chart-axis: rgb(255 255 255 / 0.14);\n\n /* Heat, for a grid of cells where colour is the only thing carrying the\n * value - a year of activity, a month of a team's hours.\n *\n * Five discrete steps rather than the seven of `--scale-*`, and a separate\n * set rather than a slice of them, because the two answer different\n * questions. `--scale-*` is sequential: a continuous magnitude, where the\n * lightest step means \"near zero\" and may recede toward the surface.\n * Heat is ordinal: five shades a reader tells apart at a glance and matches\n * against a legend, which needs wider gaps between them (no slice of\n * `--scale-*` clears the 0.06 lightness step - they sit 0.047 apart) and a\n * bottom step that stays distinct from an empty cell.\n *\n * That last one is the whole point. A heatmap cell has more meanings than a\n * number: nothing recorded, a day still running, a day outside the data, and\n * a value. If the faintest value looks like the empty cell, the grid says\n * somebody did nothing on a day nobody reported - and `--heat-1` clears the\n * empty square by 2.1:1 so it cannot.\n *\n * Fixed, like the series and unlike almost everything else here. Derived\n * from the accent - as the first consumer did - the faintest step sat 1.3:1\n * from the empty cell for half the line, and pinning lightness instead ran\n * out of sRGB: the darkest accents cannot reach the top of the ramp at their\n * own chroma.\n */\n --heat-1: #28528e;\n --heat-2: #3a65a3;\n --heat-3: #4d78b7;\n --heat-4: #608ccd;\n --heat-5: #73a0e2;\n\n /* Syntax, for code shown inside a product.\n *\n * Eight kinds rather than the fifty a highlighter's theme names, because\n * these are the distinctions that survive across languages: a keyword, a\n * literal string, a number, a comment, an identifier, a type, punctuation,\n * and the metadata around the code (a decorator, an attribute, a prompt).\n * Anything finer is a grammar's own vocabulary and does not travel.\n *\n * Fixed, like the series and the heat ramps, and for the same reason: code\n * is not a property of the product showing it, and `if` should not be\n * magenta in kilna and cobalt in kasl-server.\n *\n * Chosen against the surface code actually sits on - `--soft` over `--bg`,\n * which is what CodeBlock and `.prose pre` draw - and every slot clears\n * 4.5:1 AS TEXT in both themes. That threshold, not the 3:1 the series are\n * held to, is the whole reason these exist separately: the series palette\n * was measured here first and five of its eight light values sat under 3:1,\n * one at 1.90:1. A filled bar can be pale; a 12px glyph cannot.\n *\n * These are deliberately NOT held to the colour-blind floor the series are.\n * A series colour is the identity of its mark - lose the hue and the data is\n * gone. Syntax colour is a second reading of what the text already says in\n * full: a keyword is a keyword by its spelling, and CodeBlock's default\n * renders no colour at all and stays readable. `syntax.test.ts` says so in\n * place, so the omission is not mistaken for an oversight.\n *\n * `comment` is the quietest on purpose - it is the one kind a reader is\n * meant to be able to skip - and still clears the threshold.\n */\n --syntax-keyword: #c792ea;\n --syntax-string: #9ccc65;\n --syntax-number: #f78c6c;\n --syntax-comment: #9e99a6;\n --syntax-name: #82aaff;\n --syntax-type: #4dd0b1;\n --syntax-punctuation: #c4bfcb;\n --syntax-meta: #f0a868;\n\n /* Elevation, three steps. The products had one shadow and used it for\n * everything that leaves the flow - a toast, a dropdown and a modal all\n * floated by the same amount, so a modal never felt further away than the\n * menu it covered. `raise` keeps its original value, so nothing shifts under\n * the products already using it; the other two are the steps either side. */\n --shadow-lift: 0 2px 8px rgb(0 0 0 / 0.3);\n --shadow-raise: 0 10px 34px rgb(0 0 0 / 0.45);\n --shadow-float: 0 24px 60px rgb(0 0 0 / 0.55);\n}\n\n/*\n * Light theme, twice: once for the operating system's preference, once for the\n * explicit `light` class. The declarations are identical - only the selector\n * differs - so that a product can pin a theme against the system setting.\n */\n@media (prefers-color-scheme: light) {\n :root:not(.dark) {\n color-scheme: light;\n\n --ground: #f6f5f7;\n --ink: #232027;\n\n --bg: color-mix(in oklab, var(--neutral-base) var(--neutral-tint), var(--ground));\n --raise: #ffffff;\n\n /* Tinted, and translucent - which took two goes to get right.\n *\n * `color-mix` mixes the alpha along with the colour, so mixing 60% of an\n * opaque accent into a 5%-opaque grey gives a surface 62% opaque: twelve\n * times denser than the hairline it was meant to be. It went unnoticed for\n * ten versions because `bg-soft` was only ever used for a hover, where a\n * flash of colour reads as feedback rather than as a mistake. The first\n * component to sit on it permanently - Alert - made it obvious.\n *\n * `oklch(from … / alpha)` keeps the alpha out of the mix: the hue comes\n * from the tinted colour, the transparency is stated. */\n --soft: oklch(from color-mix(in oklab, var(--neutral-base) 45%, #181420) l c h / 0.05);\n --softer: oklch(from color-mix(in oklab, var(--neutral-base) 45%, #181420) l c h / 0.03);\n --line: oklch(from color-mix(in oklab, var(--neutral-base) 30%, #181420) l c h / 0.11);\n --line-2: oklch(from color-mix(in oklab, var(--neutral-base) 30%, #181420) l c h / 0.2);\n\n --text: color-mix(in oklab, var(--neutral-base) var(--neutral-tint), var(--ink));\n --dim: color-mix(in oklab, var(--neutral-base) var(--neutral-tint-strong), #63606b);\n --faint: color-mix(in oklab, var(--neutral-base) var(--neutral-tint-strong), #8a8692);\n\n /* On a light ground the accent has to darken to stay legible as text and\n * as a fill. It darkens *to* a lightness rather than *by* an amount: how\n * far a hue has to travel depends on where it starts, and a fixed step\n * that suits magenta leaves lime and gold short. Pinning the lightness and\n * keeping the hue and chroma clears 5:1 for every accent in the line. */\n --accent: oklch(from var(--accent-base) 0.5 c h);\n --accent-2: oklch(from var(--accent-base) 0.4 c h);\n --accent-soft: color-mix(in oklab, var(--accent-base) 12%, transparent);\n\n --good: #0c8554;\n --warn: #9a6b0c;\n --bad: #c93b3b;\n --info: #0d7f9c;\n --good-soft: color-mix(in oklab, var(--good) 12%, transparent);\n --warn-soft: color-mix(in oklab, var(--warn) 14%, transparent);\n --bad-soft: color-mix(in oklab, var(--bad) 12%, transparent);\n --info-soft: color-mix(in oklab, var(--info) 11%, transparent);\n\n /* Series and scale, stepped for the light surface - the same eight hues\n * chosen again against this ground, not the dark values lightened. The dark\n * block says why these do not follow the product accent. */\n --series-1: #2a78d6;\n --series-2: #eb6834;\n --series-3: #1baf7a;\n --series-4: #eda100;\n --series-5: #e87ba4;\n --series-6: #008300;\n --series-7: #4a3aa7;\n --series-8: #85284d;\n\n --scale-100: #cde2fb;\n --scale-200: #9ec5f4;\n --scale-300: #6da7ec;\n --scale-400: #3987e5;\n --scale-500: #2a78d6;\n --scale-600: #1c5cab;\n --scale-700: #104281;\n\n --chart-grid: oklch(from color-mix(in oklab, var(--neutral-base) 30%, #181420) l c h / 0.08);\n --chart-axis: oklch(from color-mix(in oklab, var(--neutral-base) 30%, #181420) l c h / 0.18);\n\n /* The same five steps chosen again for the light ground, running the other\n * way: here \"more\" is darker. See the dark block for why heat is its own\n * ramp and not a slice of `--scale-*`. */\n --heat-1: #84a8fd;\n --heat-2: #7193e7;\n --heat-3: #5e7fd1;\n --heat-4: #4c6cbb;\n --heat-5: #3b58a6;\n\n /* The same eight kinds chosen again for the light ground - not the dark\n * values darkened. Each clears 4.5:1 as text against `--soft` over this\n * theme's `--bg`; the dark block says why syntax is its own palette and\n * why it is not held to the colour-blind floor. */\n --syntax-keyword: #7c3aad;\n --syntax-string: #276c2b;\n --syntax-number: #b5451b;\n --syntax-comment: #6f6b78;\n --syntax-name: #1a5fb4;\n --syntax-type: #00695c;\n --syntax-punctuation: #4a4753;\n --syntax-meta: #9c4a00;\n\n --shadow-lift: 0 2px 8px rgb(30 24 38 / 0.08);\n --shadow-raise: 0 10px 30px rgb(30 24 38 / 0.14);\n --shadow-float: 0 24px 60px rgb(30 24 38 / 0.18);\n }\n}\n\n:root.light {\n color-scheme: light;\n\n --ground: #f6f5f7;\n --ink: #232027;\n\n --bg: color-mix(in oklab, var(--neutral-base) var(--neutral-tint), var(--ground));\n --raise: #ffffff;\n\n /* The same surfaces as above; see the note there. */\n --soft: oklch(from color-mix(in oklab, var(--neutral-base) 45%, #181420) l c h / 0.05);\n --softer: oklch(from color-mix(in oklab, var(--neutral-base) 45%, #181420) l c h / 0.03);\n --line: oklch(from color-mix(in oklab, var(--neutral-base) 30%, #181420) l c h / 0.11);\n --line-2: oklch(from color-mix(in oklab, var(--neutral-base) 30%, #181420) l c h / 0.2);\n\n --text: color-mix(in oklab, var(--neutral-base) var(--neutral-tint), var(--ink));\n --dim: color-mix(in oklab, var(--neutral-base) var(--neutral-tint-strong), #63606b);\n --faint: color-mix(in oklab, var(--neutral-base) var(--neutral-tint-strong), #8a8692);\n\n /* Darkened to a lightness, not by an amount - see the note above. */\n --accent: oklch(from var(--accent-base) 0.5 c h);\n --accent-2: oklch(from var(--accent-base) 0.4 c h);\n --accent-soft: color-mix(in oklab, var(--accent-base) 12%, transparent);\n\n --good: #0c8554;\n --warn: #9a6b0c;\n --bad: #c93b3b;\n --info: #0d7f9c;\n --good-soft: color-mix(in oklab, var(--good) 12%, transparent);\n --warn-soft: color-mix(in oklab, var(--warn) 14%, transparent);\n --bad-soft: color-mix(in oklab, var(--bad) 12%, transparent);\n --info-soft: color-mix(in oklab, var(--info) 11%, transparent);\n\n /* Series and scale, stepped for the light surface - the same eight hues\n * chosen again against this ground, not the dark values lightened. The dark\n * block says why these do not follow the product accent. */\n --series-1: #2a78d6;\n --series-2: #eb6834;\n --series-3: #1baf7a;\n --series-4: #eda100;\n --series-5: #e87ba4;\n --series-6: #008300;\n --series-7: #4a3aa7;\n --series-8: #85284d;\n\n --scale-100: #cde2fb;\n --scale-200: #9ec5f4;\n --scale-300: #6da7ec;\n --scale-400: #3987e5;\n --scale-500: #2a78d6;\n --scale-600: #1c5cab;\n --scale-700: #104281;\n\n --chart-grid: oklch(from color-mix(in oklab, var(--neutral-base) 30%, #181420) l c h / 0.08);\n --chart-axis: oklch(from color-mix(in oklab, var(--neutral-base) 30%, #181420) l c h / 0.18);\n\n /* The same five steps chosen again for the light ground, running the other\n * way: here \"more\" is darker. See the dark block for why heat is its own\n * ramp and not a slice of `--scale-*`. */\n --heat-1: #84a8fd;\n --heat-2: #7193e7;\n --heat-3: #5e7fd1;\n --heat-4: #4c6cbb;\n --heat-5: #3b58a6;\n\n /* The same eight kinds chosen again for the light ground - not the dark\n * values darkened. Each clears 4.5:1 as text against `--soft` over this\n * theme's `--bg`; the dark block says why syntax is its own palette and\n * why it is not held to the colour-blind floor. */\n --syntax-keyword: #7c3aad;\n --syntax-string: #276c2b;\n --syntax-number: #b5451b;\n --syntax-comment: #6f6b78;\n --syntax-name: #1a5fb4;\n --syntax-type: #00695c;\n --syntax-punctuation: #4a4753;\n --syntax-meta: #9c4a00;\n\n --shadow-lift: 0 2px 8px rgb(30 24 38 / 0.08);\n --shadow-raise: 0 10px 30px rgb(30 24 38 / 0.14);\n --shadow-float: 0 24px 60px rgb(30 24 38 / 0.18);\n}\n\n/*\n * `--on-accent` - what sits on top of an accent fill.\n *\n * A light accent (gold, lime, amber) needs dark glyphs; a dark one needs\n * white. The live products picked this by hand and wrote the answer into the\n * theme; here the theme works it out, by the same rule the brand-line S tile\n * uses.\n *\n * `contrast-color()` is the direct way to say it and is used where supported.\n * The fallback covers browsers that lack it. Relative colour syntax exposes\n * the accent's own lightness as `l`; `clamp()` turns that into a hard switch,\n * because the multiplication drives the middle term far past either bound\n * everywhere except within a hair of the threshold. Below it the accent is\n * dark and the result is 1 (white); above it, 0 (black). Chroma is dropped to\n * zero, so what comes out is neutral rather than a tinted grey.\n *\n * The threshold is 0.58, and it is deliberately far below the midpoint an eye\n * would guess. Contrast is not symmetric about it: a mid-lightness colour is\n * still much closer to white than to black in luminance, so black wins well\n * before the colour looks light. Checked against all fourteen accents of the\n * line - every one of them reads better with dark glyphs, the closest being\n * cobalt at 4.86:1 against 4.32:1 for white. A higher threshold is what puts\n * white text on magenta at 3.6:1, which is the defect this rule exists to\n * prevent.\n */\n:root {\n --on-accent: oklch(from var(--accent) clamp(0, (0.58 - l) * 1000, 1) 0 0);\n\n /*\n * The same question for the status fills, and it has to be asked separately:\n * `--on-accent` is derived from the accent, so using it on a `--warn` fill\n * is only ever right by coincidence. The line's first consumer did exactly\n * that - a count on a yellow badge, drawn in white at 1.95:1 - and it read\n * as correct for as long as the product happened to pin white.\n *\n * The status hues do not follow the product accent, so these four are the\n * same for every product; they are still derived rather than written down,\n * because the status colours themselves change between the themes.\n */\n --on-good: oklch(from var(--good) clamp(0, (0.58 - l) * 1000, 1) 0 0);\n --on-warn: oklch(from var(--warn) clamp(0, (0.58 - l) * 1000, 1) 0 0);\n --on-bad: oklch(from var(--bad) clamp(0, (0.58 - l) * 1000, 1) 0 0);\n --on-info: oklch(from var(--info) clamp(0, (0.58 - l) * 1000, 1) 0 0);\n}\n\n@supports (color: contrast-color(red)) {\n :root {\n --on-accent: contrast-color(var(--accent));\n --on-good: contrast-color(var(--good));\n --on-warn: contrast-color(var(--warn));\n --on-bad: contrast-color(var(--bad));\n --on-info: contrast-color(var(--info));\n }\n}\n\n/*\n * The Tailwind 4 surface. `--color-*: initial` drops the stock palette on\n * purpose: a raw `bg-zinc-800` in a product should not compile, because the\n * only colours that exist here are the line's own.\n */\n@theme inline {\n --color-*: initial;\n --color-bg: var(--bg);\n --color-raise: var(--raise);\n --color-soft: var(--soft);\n --color-softer: var(--softer);\n --color-line: var(--line);\n --color-line-2: var(--line-2);\n --color-text: var(--text);\n --color-dim: var(--dim);\n --color-faint: var(--faint);\n --color-accent: var(--accent);\n --color-accent-2: var(--accent-2);\n --color-accent-soft: var(--accent-soft);\n --color-on-accent: var(--on-accent);\n --color-on-good: var(--on-good);\n --color-on-warn: var(--on-warn);\n --color-on-bad: var(--on-bad);\n --color-on-info: var(--on-info);\n --color-good: var(--good);\n --color-good-soft: var(--good-soft);\n --color-warn: var(--warn);\n --color-warn-soft: var(--warn-soft);\n --color-bad: var(--bad);\n --color-bad-soft: var(--bad-soft);\n --color-info: var(--info);\n --color-info-soft: var(--info-soft);\n\n /* Charts. `bg-series-3`, `fill-series-3`, `stroke-scale-500` - the same\n * utilities the rest of the vocabulary gets, so a chart is written in\n * tokens like everything else and `dowel/no-raw-color` can hold it to\n * that. */\n --color-series-1: var(--series-1);\n --color-series-2: var(--series-2);\n --color-series-3: var(--series-3);\n --color-series-4: var(--series-4);\n --color-series-5: var(--series-5);\n --color-series-6: var(--series-6);\n --color-series-7: var(--series-7);\n --color-series-8: var(--series-8);\n --color-scale-100: var(--scale-100);\n --color-scale-200: var(--scale-200);\n --color-scale-300: var(--scale-300);\n --color-scale-400: var(--scale-400);\n --color-scale-500: var(--scale-500);\n --color-scale-600: var(--scale-600);\n --color-scale-700: var(--scale-700);\n --color-chart-grid: var(--chart-grid);\n --color-chart-axis: var(--chart-axis);\n --color-heat-1: var(--heat-1);\n --color-heat-2: var(--heat-2);\n --color-heat-3: var(--heat-3);\n --color-heat-4: var(--heat-4);\n --color-heat-5: var(--heat-5);\n\n /* Syntax, so a highlighted token is written `text-syntax-keyword` like every\n * other colour in the system, and `dowel/no-raw-color` can hold it to that.\n * A highlighter's own stylesheet - which writes hex values into class names\n * of its own choosing - is what this replaces. */\n --color-syntax-keyword: var(--syntax-keyword);\n --color-syntax-string: var(--syntax-string);\n --color-syntax-number: var(--syntax-number);\n --color-syntax-comment: var(--syntax-comment);\n --color-syntax-name: var(--syntax-name);\n --color-syntax-type: var(--syntax-type);\n --color-syntax-punctuation: var(--syntax-punctuation);\n --color-syntax-meta: var(--syntax-meta);\n\n /* Kept because they are not palette choices: a hairline is `transparent`,\n * an SVG follows `currentColor`, and pure black and white are what an\n * overlay scrim and a print sheet are made of. */\n --color-transparent: transparent;\n --color-current: currentColor;\n --color-white: #fff;\n --color-black: #000;\n\n /*\n * Type. System stacks on purpose: a downloaded face costs a network round\n * trip before the first word appears, and the line's products are desktop\n * tools where the operating system's own face is the one the user already\n * reads everything else in.\n */\n --font-sans: 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, sans-serif;\n --font-mono: ui-monospace, 'Cascadia Code', 'SF Mono', Consolas, monospace;\n\n /*\n * Radius. Taken from what the products actually draw, not from a ratio:\n * `rounded-[9px]` appears twenty times and `rounded-[10px]` twelve, because\n * a control and the primary button were tuned by eye and then copied. The\n * scale keeps the cluster they landed in and gives it names.\n *\n * `md` is the control radius - inputs, buttons, list rows. That the primary\n * button was one pixel rounder than every other variant is not preserved:\n * the products differ from themselves there, and buttons of the same size\n * sitting side by side should not have mismatched corners.\n */\n --radius-xs: 4px;\n --radius-sm: 6px;\n --radius-md: 9px;\n --radius-lg: 12px;\n --radius-xl: 16px;\n --radius-2xl: 20px;\n\n /*\n * A radius nested inside another has to be smaller by the gap between them,\n * or the inner corner looks wrong against the outer one. The products did\n * this by hand once - 18px outside, 17px inside - and nowhere else.\n */\n --radius-inner: calc(var(--radius-lg) - 1px);\n\n /*\n * Type scale. The products live between 10px and 14px: `text-sm` and\n * `text-xs` together account for nine tenths of every size in both, and the\n * rest scattered across 9, 9.5, 10, 10.5, 11, 11.5, 12.5 and 13 - nine steps\n * inside four pixels, which no eye distinguishes and no reason justifies.\n * This is the same range with the noise removed.\n */\n --text-2xs: 10px;\n --text-2xs--line-height: 14px;\n --text-xs: 11px;\n --text-xs--line-height: 15px;\n --text-sm: 12px;\n --text-sm--line-height: 16px;\n --text-base: 14px;\n --text-base--line-height: 20px;\n --text-lg: 16px;\n --text-lg--line-height: 22px;\n --text-xl: 18px;\n --text-xl--line-height: 24px;\n --text-2xl: 21px;\n --text-2xl--line-height: 28px;\n\n /* Weights. `semibold` is what both products use for anything emphasised;\n * `bold` appears in neither, and the one `font-[650]` in a page title is the\n * kind of value a scale exists to absorb. */\n --font-weight-normal: 400;\n --font-weight-medium: 500;\n --font-weight-semibold: 600;\n\n /* Tracking. The uppercase caption is the only place the products track at\n * all - and they do it at 0.08em in six files and 0.09em in three, a\n * difference nobody can see. One name settles it. */\n --tracking-caption: 0.085em;\n --tracking-tight: -0.01em;\n\n /* Easing. `out` for anything the user asked for - it arrives fast and\n * settles, which reads as responsive. `in-out` for something moving on its\n * own. `in` is deliberately absent: it starts slowly, which on a control\n * reads as lag. */\n --ease-out: cubic-bezier(0.2, 0, 0, 1);\n --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);\n\n /*\n * Elevation. Three steps, because the products had one and used it for a\n * toast, a dropdown and a modal alike - so a modal never sat further from\n * the page than the menu it covered.\n */\n --shadow-lift: var(--shadow-lift);\n --shadow-raise: var(--shadow-raise);\n --shadow-float: var(--shadow-float);\n}\n\n/*\n * Stacking order.\n *\n * Not in `@theme`: Tailwind has no z-index namespace, so `z-50` is a literal\n * fifty and a named step would not compile. These are custom properties a\n * component reads directly - `z-index: var(--z-modal)`.\n *\n * The order is the products' own, with the gaps closed. They ran 10 for an\n * in-flow popup, 20 sticky, 30 menu, 40 for a floating button, 50 for modals\n * and drawers, then jumped to 70 and 80 for the command palette - which had to\n * clear the modal layer and had no name to do it with.\n */\n:root {\n /*\n * Motion. One duration existed before this - 160ms on a route change - and\n * everything else rode Tailwind's default. These are the steps around it:\n * `quick` for a colour or an opacity that should feel immediate, `base` for\n * something that moves, `slow` for something arriving from off-screen.\n *\n * Not in `@theme`: Tailwind's `duration-*` utility takes a literal number,\n * not a named step, so these are read directly - `transition-duration:\n * var(--duration-base)`. The easing curves opposite them ARE a namespace,\n * so `ease-out` is a class.\n *\n * Every duration here is for people who want motion: `prefers-reduced-\n * motion` cuts them to nothing further down.\n */\n --duration-quick: 120ms;\n --duration-base: 160ms;\n --duration-slow: 240ms;\n\n --z-popup: 10;\n --z-sticky: 20;\n --z-menu: 30;\n --z-floating: 40;\n --z-overlay: 50;\n --z-modal: 60;\n --z-palette: 70;\n --z-toast: 80;\n}\n\n/*\n * Base layer: what every product would otherwise write again. Scoped to\n * elements and to `:focus-visible`, never to a class, so nothing here can\n * collide with a component.\n */\nbody {\n margin: 0;\n background-color: var(--bg);\n color: var(--text);\n font-family: var(--font-sans);\n -webkit-font-smoothing: antialiased;\n}\n\n/*\n * In `@layer base`, so a component can turn it off.\n *\n * Unlayered, this rule has the same specificity as `focus-visible:outline-none`\n * from Tailwind - both are one pseudo-class - and wins on source order alone,\n * because the theme is imported before the utilities. Every component that\n * draws its own focus ring got this one on top of it: the command palette's\n * field had an accent outline it had explicitly opted out of, and a combobox\n * with chips drew two rings, one around the box and one around the input\n * inside it.\n *\n * A layered rule loses to any unlayered one regardless of specificity, which\n * is the whole point of cascade layers - the base layer states a default and\n * a component overrides it by saying so.\n */\n@layer base {\n :focus-visible {\n outline: 2px solid var(--accent);\n outline-offset: 2px;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n *,\n *::before,\n *::after {\n transition-duration: 0.01ms !important;\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n scroll-behavior: auto !important;\n }\n}\n\n/*\n * Scrollbars. A browser's default bar is a piece of someone else's chrome\n * sitting in the middle of the product - full width, with step arrows. These\n * are the line's own: thin, in the palette, drawn only where something\n * actually scrolls.\n */\n* {\n scrollbar-width: thin;\n scrollbar-color: var(--line-2) transparent;\n}\n\n*::-webkit-scrollbar {\n width: 10px;\n height: 10px;\n}\n\n*::-webkit-scrollbar-track {\n background: transparent;\n}\n\n*::-webkit-scrollbar-thumb {\n border: 3px solid transparent;\n border-radius: 999px;\n background: var(--line-2);\n background-clip: content-box;\n /* The thumb is drawn proportional to how much of the document fits on\n * screen, so a long one collapses it to a few pixels: still visible, no\n * longer catchable by a pointer. This is the floor below which it stops\n * being a control. */\n min-height: 2.5rem;\n}\n\n*::-webkit-scrollbar-thumb:hover {\n background: var(--dim);\n background-clip: content-box;\n}\n\n*::-webkit-scrollbar-corner {\n background: transparent;\n}\n\n*::-webkit-scrollbar-button {\n display: none;\n}\n"
18
18
  }
19
19
  ],
20
20
  "docs": "Import the theme, then your product accent:\n\n @import './dowel/theme.css';\n @import './dowel/accents/kilna.css';\n\nOutside the line, set the colour directly instead:\n\n :root { --accent-base: #2f7d6b; }"
21
21
  },
22
+ {
23
+ "extends": "none",
24
+ "name": "prose",
25
+ "type": "registry:style",
26
+ "title": "dowel prose",
27
+ "description": "The shape of text a product did not write by hand: rendered markdown, a description from a CMS, a model's reply. One class on the container, and the tags inside it - headings, lists, code, tables, quotes - are drawn in the line's tokens.",
28
+ "files": [
29
+ {
30
+ "path": "dowel/prose.css",
31
+ "target": "~/dowel/prose.css",
32
+ "type": "registry:file",
33
+ "content": "/*\n * dowel prose - the shape of text a product did not write by hand.\n *\n * Every other rule in this system is applied by a component, because a\n * component owns the element it draws. Rendered markdown is the case where\n * that is impossible: the product hands the DOM a string of HTML - from\n * `marked`, from a CMS, from a model's reply - and there is no React element\n * to hang a class on. The tags arrive already made. Only a descendant selector\n * reaches them.\n *\n * kilna proved the shape before this file existed, as thirty `[&_h1]:mt-4`\n * arbitrary variants inside one `className` string. It works and it is a\n * paragraph of unreadable text that no second product can share, which is the\n * whole argument for moving it here.\n *\n * Scoped to `.prose`, so nothing leaks: a stylesheet that styled `h2`\n * globally would reach into every component that happens to render one.\n *\n * WHY NOT A TYPOGRAPHY PLUGIN. `@tailwindcss/typography` answers the same\n * question and brings its own answer to a different one - its own type scale,\n * its own greys, its own idea of measure. Installing it next to this theme\n * means two vocabularies describing the same text, and the one that wins is\n * whichever loaded last. Every value below is a token from `theme.css`; there\n * is not a single colour or size written down here.\n *\n * WHAT THIS IS NOT FOR. Interface text - a label, a row, a button - is styled\n * by the component that draws it. `.prose` is for a reading column: a note, a\n * description, an article, a chat reply. Wrapping a form in it is how a screen\n * ends up with two competing ideas of what `text-sm` means.\n *\n * Import after the theme:\n *\n * @import 'tailwindcss';\n * @import './dowel/theme.css';\n * @import './dowel/prose.css';\n */\n\n.prose {\n /*\n * The reading size is `--text-base`, not the `--text-sm` the interface runs\n * at, and the two are different on purpose. Chrome is scanned - a label is\n * recognised rather than read - and it packs tighter the less of it there\n * is. Prose is read word by word, and 12px of continuous text is where a\n * reader starts leaning in. The products already knew this and did it by\n * hand: kilna's rendered markdown sets `text-sm` (12px) against an interface\n * of 11px, the same one-step lift.\n */\n font-size: var(--text-base);\n\n /*\n * Line height is set here rather than inherited from the size token, which\n * carries 20px for 14px text - right for a label, tight for a paragraph.\n * 1.65 is the ratio the eye returns to the start of the next line with; it\n * is a ratio rather than a length so a product that scales the size up for a\n * reading view keeps the proportion.\n */\n line-height: 1.65;\n color: var(--text);\n\n /*\n * A measure, not a width. Prose is unreadable across a wide window - the eye\n * loses the line it is returning from - and `ch` is the unit that says so in\n * the terms the limit is actually about: characters, at whatever size the\n * text is drawn. 68 is inside the 45-75 the typographic literature agrees\n * on, at the wide end because these are technical texts with code and long\n * identifiers in them.\n *\n * A product that has its own column - a chat bubble, a card - overrides\n * `max-width` and loses nothing else.\n */\n max-width: 68ch;\n\n /*\n * The shell of a desktop app usually turns selection off, so that dragging\n * inside a window moves the window. Text someone came to READ has to hand it\n * back, or the one thing a reader wants to do with a paragraph - take a\n * sentence out of it - is the thing the app forbids.\n */\n user-select: text;\n -webkit-user-select: text;\n}\n\n/*\n * Vertical rhythm.\n *\n * Margins collapse between siblings, so stating both a top and a bottom on\n * every block would double the gap at some joins and not others depending on\n * which value was larger. Instead: one bottom margin on everything, and the\n * top margin belongs to the headings alone, which are the only elements that\n * need more space above them than below - a heading belongs to what follows\n * it, and sitting equidistant between two paragraphs it appears to belong to\n * neither.\n */\n.prose > * {\n margin-block: 0 0.75em;\n}\n\n/* The first and last child never push the container open: a rendered note\n * inside a bordered card would otherwise have a gap at the top that the card's\n * own padding did not put there. */\n.prose > :first-child {\n margin-block-start: 0;\n}\n.prose > :last-child {\n margin-block-end: 0;\n}\n\n/*\n * Headings.\n *\n * The scale is the theme's, stepped down from a document's h1 - and it starts\n * lower than a web page's would, because prose here is almost always a section\n * INSIDE a screen that already has a title. An h1 drawn at 21px next to a page\n * heading of 18px makes the note look like the more important thing on screen.\n *\n * `text-wrap: balance` on headings only: it is expensive on long text and\n * makes a two-line heading break in the middle rather than leaving one word\n * alone on the second line.\n */\n.prose :is(h1, h2, h3, h4, h5, h6) {\n margin-block: 1.6em 0.5em;\n font-weight: var(--font-weight-semibold);\n line-height: 1.3;\n text-wrap: balance;\n /* A heading that ends up at the top of a scrolled container should not be\n * flush against its edge. */\n scroll-margin-block-start: 1rem;\n}\n\n.prose h1 {\n font-size: var(--text-xl);\n letter-spacing: var(--tracking-tight);\n}\n.prose h2 {\n font-size: var(--text-lg);\n letter-spacing: var(--tracking-tight);\n}\n.prose h3 {\n font-size: var(--text-base);\n}\n\n/*\n * h4 and below stop growing and start differentiating by other means: a\n * document nested six levels deep has run out of sizes long before it runs out\n * of levels, and inventing two more steps inside four pixels is the noise the\n * type scale exists to remove. They are the body size, set apart by weight and\n * by colour.\n */\n.prose :is(h4, h5, h6) {\n font-size: var(--text-base);\n color: var(--dim);\n}\n\n/* A heading directly after another has nothing between them to separate. */\n.prose :is(h1, h2, h3, h4, h5, h6) + :is(h1, h2, h3, h4, h5, h6) {\n margin-block-start: 0.8em;\n}\n\n/*\n * Lists.\n *\n * Tailwind's preflight strips the markers, which is right for the interface -\n * a menu is a `ul` and must not have bullets - and wrong here, where a list is\n * a list. They are put back, and `outside` so the marker hangs in the indent\n * and the text of a wrapped item lines up with itself rather than with the\n * bullet.\n */\n.prose :is(ul, ol) {\n padding-inline-start: 1.5em;\n}\n.prose ul {\n list-style: disc;\n}\n.prose ol {\n list-style: decimal;\n}\n/*\n * `--dim`, not `--faint`, and that was measured rather than chosen.\n *\n * A bullet looks like furniture, so the faintest token is the instinct. But\n * the marker is what says \"this is a list\" - drop it and an ordered list loses\n * its numbers, which are content. On the stand it came out at 3.17:1 against\n * the surface, below the 4.5:1 that anything carrying meaning has to clear,\n * and it read as a smudge at the size a bullet actually is. `--dim` puts it at\n * 6.2:1 and still sits back from the text.\n */\n.prose li::marker {\n color: var(--dim);\n}\n.prose li {\n margin-block: 0.25em;\n}\n\n/* A nested list belongs to the item above it, not to the gap after it. */\n.prose li > :is(ul, ol) {\n margin-block: 0.25em;\n}\n\n/* A task list from markdown: the checkbox replaces the marker, so the bullet\n * beside it would be a second one saying the same thing. */\n.prose li:has(> input[type='checkbox']:first-child) {\n list-style: none;\n margin-inline-start: -1.25em;\n}\n.prose li > input[type='checkbox'] {\n margin-inline-end: 0.4em;\n accent-color: var(--accent);\n}\n\n/*\n * Inline code.\n *\n * `0.9em` rather than a token: a monospaced face at the same nominal size as\n * the text around it looks larger, because its lowercase letters are taller\n * relative to the em. The correction is proportional to whatever size the\n * surrounding text happens to be, which a fixed token could not follow.\n */\n.prose code {\n font-family: var(--font-mono);\n font-size: 0.9em;\n background-color: var(--soft);\n border-radius: var(--radius-xs);\n padding: 0.15em 0.35em;\n /* A long identifier in the middle of a sentence must be allowed to break,\n * or it pushes the whole column wider than its measure. */\n overflow-wrap: anywhere;\n}\n\n/*\n * A code block is not a big inline code. The padding, background and radius\n * belong to the `pre`; the `code` inside it gives them all up, or the block\n * gets a second inset panel drawn inside itself - which is exactly what\n * happens when a typography plugin's inline rule is left to apply here.\n *\n * `overflow-x: auto` rather than wrapping: a wrapped line of code is a line\n * that lies about where it ends, and indentation is how code is read.\n */\n.prose pre {\n font-family: var(--font-mono);\n font-size: var(--text-sm);\n line-height: 1.55;\n background-color: var(--soft);\n border: 1px solid var(--line);\n border-radius: var(--radius-md);\n padding: 0.75rem 0.85rem;\n overflow-x: auto;\n /* `tab-size: 2` is the line's own indent; the browser default of 8 turns a\n * tab-indented file into a horizontal scroll for nothing. */\n tab-size: 2;\n}\n\n.prose pre code {\n background-color: transparent;\n border-radius: 0;\n padding: 0;\n font-size: inherit;\n /* Inside a scrolling block, breaking a long line would defeat the scroll. */\n overflow-wrap: normal;\n}\n\n/*\n * Links.\n *\n * `--accent-2` rather than `--accent`: on the dark theme the accent is the\n * product's own colour at full strength, which against body text reads as a\n * button that failed to draw. The partner shade is the one the products use\n * for a link, and it is also the one with room to darken on hover.\n *\n * Underlined, always. Colour alone is not a link - a reader who does not see\n * the hue gets no signal at all - and this is the one place in the system\n * where the rule \"meaning never rests on colour\" has a standard answer.\n */\n.prose a {\n color: var(--accent-2);\n text-decoration: underline;\n /* The underline drops below the descenders instead of striking through\n * them, which is the difference between a link and a crossed-out word. */\n text-underline-offset: 0.2em;\n text-decoration-thickness: from-font;\n overflow-wrap: anywhere;\n}\n\n.prose a:hover {\n color: var(--accent);\n}\n\n/*\n * A quotation.\n *\n * A rule on the left and dimmed text, rather than italics: a blockquote is\n * frequently a paragraph or more, and a long passage in italic is slower to\n * read for everyone and materially harder for some dyslexic readers.\n */\n.prose blockquote {\n border-inline-start: 2px solid var(--line-2);\n padding-inline-start: 0.9em;\n color: var(--dim);\n}\n\n/*\n * A table inside prose.\n *\n * `display: block` with its own scroll, because the one thing a table must not\n * do in a reading column is set the column's width: a note with a six-column\n * table in it would push every paragraph around it out to the table's width.\n * The cost is stated - a block-level table no longer participates in the\n * column's own layout - and it is the right trade for text.\n */\n.prose table {\n display: block;\n max-width: 100%;\n overflow-x: auto;\n border-collapse: collapse;\n font-size: var(--text-sm);\n}\n\n.prose :is(th, td) {\n border: 1px solid var(--line);\n padding: 0.3em 0.55em;\n text-align: start;\n vertical-align: top;\n}\n\n.prose th {\n background-color: var(--soft);\n font-weight: var(--font-weight-semibold);\n}\n\n/*\n * A horizontal rule is a section break, so the space around it is the point;\n * a hairline with a paragraph's gap either side reads as a mistake.\n */\n.prose hr {\n border: 0;\n border-block-start: 1px solid var(--line);\n margin-block: 2em;\n}\n\n.prose :is(strong, b) {\n font-weight: var(--font-weight-semibold);\n color: var(--text);\n}\n\n.prose :is(em, i) {\n font-style: italic;\n}\n\n.prose :is(s, del) {\n color: var(--dim);\n}\n\n.prose mark {\n background-color: var(--accent-soft);\n color: inherit;\n border-radius: var(--radius-xs);\n padding: 0.05em 0.2em;\n}\n\n/*\n * An image in prose is never wider than the column, and keeps its ratio when\n * it is constrained. `display: block` because an inline image sits on the text\n * baseline and leaves a strip of descender space under it that looks like a\n * broken margin.\n */\n.prose img {\n display: block;\n max-width: 100%;\n height: auto;\n border-radius: var(--radius-sm);\n}\n\n/*\n * `kbd` is drawn as a key rather than as code: a reader who sees `Ctrl` in the\n * same grey box as a variable name has to work out which it is. This matches\n * the Kbd primitive, so a key looks the same whether a component drew it or\n * markdown did.\n */\n.prose kbd {\n font-family: var(--font-mono);\n font-size: 0.85em;\n background-color: var(--raise);\n border: 1px solid var(--line-2);\n border-block-end-width: 2px;\n border-radius: var(--radius-xs);\n padding: 0.1em 0.35em;\n color: var(--dim);\n}\n\n/*\n * A definition list, which markdown does not produce but a CMS does.\n */\n.prose dt {\n font-weight: var(--font-weight-semibold);\n margin-block-start: 0.75em;\n}\n.prose dd {\n margin-inline-start: 1.5em;\n color: var(--dim);\n}\n\n/*\n * A footnote reference and the notes at the bottom - what `remark-gfm`\n * produces. Smaller and dimmer, because a footnote that reads at the weight of\n * the text interrupts the sentence carrying it.\n */\n.prose sup a {\n text-decoration: none;\n font-size: 0.8em;\n}\n.prose .footnotes {\n font-size: var(--text-sm);\n color: var(--dim);\n border-block-start: 1px solid var(--line);\n margin-block-start: 2em;\n padding-block-start: 0.75em;\n}\n\n/*\n * Tight: the same prose in a place that has no room for a reading column - a\n * chat bubble, a table cell, a hover card. The rhythm compresses and the\n * measure is given up to the container, because in a bubble the container IS\n * the measure. Nothing else changes: the same tags, the same tokens.\n */\n.prose-tight {\n font-size: var(--text-sm);\n line-height: 1.55;\n max-width: none;\n}\n\n.prose-tight > * {\n margin-block: 0 0.5em;\n}\n\n.prose-tight :is(h1, h2, h3, h4, h5, h6) {\n margin-block: 1em 0.35em;\n}\n\n.prose-tight :is(h1, h2) {\n font-size: var(--text-base);\n}\n\n.prose-tight h3 {\n font-size: var(--text-sm);\n}\n\n.prose-tight hr {\n margin-block: 1.2em;\n}\n"
34
+ }
35
+ ],
36
+ "docs": "Import it after the theme, then put the class on whatever holds the HTML:\n\n @import './dowel/theme.css';\n @import './dowel/prose.css';\n\n <div className=\"prose\" dangerouslySetInnerHTML={{ __html: html }} />\n\n`prose-tight` is the same rules with the rhythm compressed and the measure\ngiven up - for a chat bubble, a table cell, a hover card.\n\nSanitise the HTML before it reaches the DOM. This stylesheet draws markup;\nit does not make it safe."
37
+ },
22
38
  {
23
39
  "name": "accent-kasl",
24
40
  "type": "registry:file",
@@ -293,7 +309,7 @@
293
309
  "dependencies": [
294
310
  "@base-ui/react",
295
311
  "class-variance-authority",
296
- "dowel-ui@^0.23.0"
312
+ "dowel-ui@^0.25.0"
297
313
  ],
298
314
  "registryDependencies": [],
299
315
  "files": [
@@ -305,6 +321,64 @@
305
321
  }
306
322
  ]
307
323
  },
324
+ {
325
+ "name": "activity-heatmap",
326
+ "type": "registry:ui",
327
+ "title": "Activity-heatmap",
328
+ "description": "The shape everyone recognises: weeks as columns, weekdays as rows, time running left to right, and a value carried by how dark a square is. Two products of the line asked for it by name before it existed.",
329
+ "dependencies": [
330
+ "class-variance-authority",
331
+ "dowel-ui@^0.25.0"
332
+ ],
333
+ "registryDependencies": [
334
+ "https://lacodda.github.io/dowel/r/activity-weeks.json"
335
+ ],
336
+ "files": [
337
+ {
338
+ "path": "ui/activity-heatmap.tsx",
339
+ "target": "@ui/activity-heatmap.tsx",
340
+ "type": "registry:ui",
341
+ "content": "import type { HTMLAttributes, ReactNode } from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from 'dowel-ui'\nimport {\n weekdayRows,\n weeks,\n type ActivityEntry,\n type Cell,\n type Weekday,\n} from './activity-weeks'\n\n/*\n * A year of activity, one square per day.\n *\n * The shape everyone recognises: weeks as columns, weekdays as rows, time\n * running left to right, and a value carried by how dark a square is. Two\n * products of the line asked for it by name before it existed.\n *\n * **A cell has four meanings and only one of them is a number.** Nothing\n * recorded, a value, something still under way, and a date outside the range\n * asked for are four different facts. A grid that paints the first as the\n * palest shade of the second tells the reader somebody did nothing on a day\n * nobody reported - a claim invented by the drawing. So each has its own\n * treatment: a value is filled from the heat ramp, nothing recorded is the\n * bare empty square, something under way is outlined rather than filled\n * (there is no figure to shade, and any fill would be a number nobody gave),\n * and a padding square is drawn faintest of all, because the caller never\n * asked about it.\n *\n * **The legend is not decoration.** The scale is relative - the darkest square\n * is the busiest day in *this* grid, not a standard - so the grid says what\n * its own ceiling is. Without that, five shades look like an absolute measure\n * of a full day, which is a thing this component has no opinion about.\n *\n * **Colour is never the only channel.** Every square carries its date and its\n * figure in words, on a `title` and as its accessible name: a grid of five\n * shades says nothing to a screen reader, and little to anyone who does not\n * separate five blues.\n */\n\nexport const activityHeatmapVariants = cva('inline-flex flex-col gap-2', {\n variants: {\n size: {\n /* The year view, where a square is small enough that 53 columns fit. */\n sm: '[--cell:10px] [--gap:2px]',\n /* A quarter or a month, where there is room to hover comfortably. */\n md: '[--cell:14px] [--gap:3px]',\n },\n },\n defaultVariants: { size: 'md' },\n})\n\nexport const activityCellVariants = cva('rounded-[3px]', {\n variants: {\n kind: {\n /* The bare square. Not the faintest step of the ramp - that is a value,\n * and this is the absence of one. */\n none: 'bg-soft',\n value: '',\n /* Outlined rather than filled: under way has no total to shade. */\n partial: 'border border-dashed border-accent/60',\n /* Drawn, because the column has to be seven tall, but never as data:\n * the caller did not ask about this date. */\n outside: 'bg-softer/40',\n },\n step: {\n 1: 'bg-heat-1',\n 2: 'bg-heat-2',\n 3: 'bg-heat-3',\n 4: 'bg-heat-4',\n 5: 'bg-heat-5',\n },\n },\n defaultVariants: { kind: 'none' },\n})\n\nexport interface ActivityHeatmapProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'children'>,\n VariantProps<typeof activityHeatmapVariants> {\n /** What is known about each date. Dates with no entry are drawn as nothing\n * recorded, which is a different fact from a value of zero. */\n entries: ActivityEntry[]\n /** First date of the range, `YYYY-MM-DD`. */\n from: string\n /** Last date. */\n to: string\n /** The day a week starts on, Sunday-first like `Date#getUTCDay`. Monday by\n * default. It decides which row a date lands on, so it is stated rather than\n * guessed from a locale this cannot see. */\n weekStartsOn?: Weekday\n /** The ceiling the shades are measured against. Defaults to the largest\n * value present; state it to compare two grids by eye. */\n busiest?: number\n /** What the grid as a whole is, for a reader who cannot see it. */\n label: string\n /** What one square says. Given the cell, returns the sentence that becomes\n * its hover title and its accessible name - the caller owns it because only\n * the caller knows whether a value is hours, words or commits. */\n describe: (cell: Cell) => string\n /** Row labels, one per weekday in drawing order. Omitted entirely rather\n * than defaulted: a weekday name is a word in a language this cannot pick. */\n weekdayLabel?: (weekday: Weekday) => ReactNode\n}\n\nexport function ActivityHeatmap({\n entries,\n from,\n to,\n weekStartsOn = 1,\n busiest,\n label,\n describe,\n weekdayLabel,\n size,\n className,\n ...props\n}: ActivityHeatmapProps) {\n const columns = weeks(entries, { from, to, weekStartsOn, busiest })\n const rows = weekdayRows(weekStartsOn)\n\n return (\n <div className={cn(activityHeatmapVariants({ size }), className)} {...props}>\n <div className=\"flex gap-[var(--gap)]\" role=\"img\" aria-label={label}>\n {weekdayLabel !== undefined && (\n <div\n className=\"mr-1 flex flex-col gap-[var(--gap)] text-[10px] leading-[var(--cell)] text-faint\"\n aria-hidden\n >\n {rows.map((weekday) => (\n <span key={weekday} className=\"h-[var(--cell)]\">\n {weekdayLabel(weekday)}\n </span>\n ))}\n </div>\n )}\n\n {columns.map((column) => (\n <div key={column[0]!.date} className=\"flex flex-col gap-[var(--gap)]\">\n {column.map((cell) => (\n <span\n key={cell.date}\n title={describe(cell)}\n className={cn(\n 'size-[var(--cell)]',\n activityCellVariants({\n kind: cell.kind,\n step: cell.step as 1 | 2 | 3 | 4 | 5 | undefined,\n }),\n )}\n />\n ))}\n </div>\n ))}\n </div>\n </div>\n )\n}\n"
342
+ }
343
+ ]
344
+ },
345
+ {
346
+ "name": "activity-legend",
347
+ "type": "registry:ui",
348
+ "title": "Activity-legend",
349
+ "description": "Separate from the grid because a caller showing three grids on one screen wants one legend, and because the words in it are the product's.",
350
+ "dependencies": [
351
+ "dowel-ui@^0.25.0"
352
+ ],
353
+ "registryDependencies": [
354
+ "https://lacodda.github.io/dowel/r/activity-heatmap.json",
355
+ "https://lacodda.github.io/dowel/r/activity-weeks.json"
356
+ ],
357
+ "files": [
358
+ {
359
+ "path": "ui/activity-legend.tsx",
360
+ "target": "@ui/activity-legend.tsx",
361
+ "type": "registry:ui",
362
+ "content": "import type { HTMLAttributes, ReactNode } from 'react'\nimport { cn } from 'dowel-ui'\nimport { activityCellVariants } from './activity-heatmap'\nimport { STEPS } from './activity-weeks'\n\n/*\n * What the shades mean, in the same tokens the grid paints with.\n *\n * Separate from the grid because a caller showing three grids on one screen\n * wants one legend, and because the words in it are the product's.\n */\nexport interface ActivityLegendProps extends HTMLAttributes<HTMLDivElement> {\n /** The word at the faint end - \"less\", usually. */\n less: ReactNode\n /** The word at the dark end. */\n more: ReactNode\n /** What the darkest square stands for, in words: the scale is relative, and\n * without this the shades read as an absolute measure. Omitted when there is\n * no value in the grid to be busiest. */\n busiest?: ReactNode\n /** The other three meanings, each named. Omitted one at a time by a caller\n * whose data cannot produce that kind. */\n none?: ReactNode\n partial?: ReactNode\n}\n\nexport function ActivityLegend({\n less,\n more,\n busiest,\n none,\n partial,\n className,\n ...props\n}: ActivityLegendProps) {\n return (\n <div\n className={cn('flex flex-wrap items-center gap-x-5 gap-y-2 text-[11px] text-faint', className)}\n {...props}\n >\n <span className=\"flex items-center gap-1.5\">\n <span>{less}</span>\n {Array.from({ length: STEPS }, (_, index) => (\n <span\n key={index}\n className={cn('size-3', activityCellVariants({ kind: 'value', step: (index + 1) as 1 | 2 | 3 | 4 | 5 }))}\n />\n ))}\n <span>{more}</span>\n {busiest !== undefined && <span className=\"ml-1\">· {busiest}</span>}\n </span>\n\n {none !== undefined && (\n <span className=\"flex items-center gap-1.5\">\n <span className={cn('size-3', activityCellVariants({ kind: 'none' }))} />\n {none}\n </span>\n )}\n\n {partial !== undefined && (\n <span className=\"flex items-center gap-1.5\">\n <span className={cn('size-3', activityCellVariants({ kind: 'partial' }))} />\n {partial}\n </span>\n )}\n </div>\n )\n}\n"
363
+ }
364
+ ]
365
+ },
366
+ {
367
+ "name": "activity-weeks",
368
+ "type": "registry:ui",
369
+ "title": "Activity-weeks",
370
+ "description": "Split out for the reason `table-sort` and `track-segments` are - a product that draws this somewhere other than the DOM needs the arithmetic, not a component. One of the line's consumers draws it in a terminal.",
371
+ "dependencies": [],
372
+ "registryDependencies": [],
373
+ "files": [
374
+ {
375
+ "path": "ui/activity-weeks.tsx",
376
+ "target": "@ui/activity-weeks.tsx",
377
+ "type": "registry:ui",
378
+ "content": "/*\n * Laying a run of dates out in weeks, with no React in it.\n *\n * Split out for the reason `table-sort` and `track-segments` are - a product\n * that draws this somewhere other than the DOM needs the arithmetic, not a\n * component. One of the line's consumers draws it in a terminal.\n *\n * The rule the whole grid rests on, and the one worth stating loudest:\n * **a cell has four meanings and only one of them is a number.** Nothing\n * recorded, a value, a day still in progress, and a date outside the range\n * asked for are four different facts. A grid that paints \"nothing recorded\" as\n * the palest shade of \"a value\" tells the reader somebody did nothing on a day\n * nobody reported - which is a claim invented by the drawing.\n */\n\n/** What one square of the grid is. */\nexport type CellKind =\n /** No entry for this date. Not zero - no data at all. */\n | 'none'\n /** An entry with a figure behind it. */\n | 'value'\n /** Under way, with no total yet: today's row, a day still open. */\n | 'partial'\n /** A date the grid draws to keep its shape, outside the range asked for. */\n | 'outside'\n\n/** What the caller knows about one date. */\nexport interface ActivityEntry {\n /** `YYYY-MM-DD`. A label, never a moment: no zone shifts a date here. */\n date: string\n /** The figure. `null` for a day under way, which has no total yet. */\n value: number | null\n}\n\nexport interface Cell {\n date: string\n kind: CellKind\n value: number | null\n /** Which of the five steps this lands on, 1-5; `null` unless `kind` is\n * `value`. Discrete rather than continuous, because five shades can be told\n * apart and matched against a legend where a smooth gradient can only say\n * \"more\" and \"less\". */\n step: number | null\n /** Saturday or Sunday, read from the date itself.\n *\n * Only the weekend, never \"a day off\": which days someone actually rests is\n * a calendar this does not have, and guessing would mark an ordinary\n * Saturday shift as unusual. */\n weekend: boolean\n}\n\n/** Five steps, and the reason there are five: a legend a reader can count. */\nexport const STEPS = 5\n\n/** Sunday-first, because that is what `Date#getUTCDay` counts from. */\nexport type Weekday = 0 | 1 | 2 | 3 | 4 | 5 | 6\n\nconst DAY = 86_400_000\n\nfunction parse(date: string): number {\n return Date.parse(`${date}T00:00:00Z`)\n}\n\nfunction format(time: number): string {\n return new Date(time).toISOString().slice(0, 10)\n}\n\n/** Every date from `from` to `to` inclusive, as `YYYY-MM-DD`.\n *\n * Stepped through UTC so no local zone can shift a day: a date here is a\n * label, not a moment. */\nexport function datesBetween(from: string, to: string): string[] {\n const start = parse(from)\n const end = parse(to)\n if (!Number.isFinite(start) || !Number.isFinite(end) || end < start) return []\n\n const dates: string[] = []\n for (let time = start; time <= end; time += DAY) dates.push(format(time))\n return dates\n}\n\nexport function isWeekend(date: string): boolean {\n const day = new Date(parse(date)).getUTCDay()\n return day === 0 || day === 6\n}\n\nexport interface WeeksOptions {\n /** First date of the range the caller asked for. */\n from: string\n /** Last date. */\n to: string\n /** The day a week starts on. Monday in most of the world, Sunday in the US -\n * and it changes which column a date lands in, so it is stated rather than\n * guessed from a locale the grid cannot see. */\n weekStartsOn?: Weekday\n /** The ceiling the steps are measured against. Defaults to the largest value\n * present.\n *\n * Shared rather than per-column, so two grids can be compared: scaled to\n * itself, a quiet month and a heavy one each get their own darkest square,\n * which is the one thing a heatmap is for. */\n busiest?: number\n}\n\n/**\n * The range as columns of weeks, each column seven cells from the top.\n *\n * Columns rather than rows because that is the shape the grid is read in: a\n * week is a column, a weekday is a row, and time runs left to right.\n *\n * The first and last columns are padded to seven with `outside` cells, so\n * every column is the same height and a weekday stays on its own row. They are\n * not \"no data\" - the caller never asked about them - and drawing them as\n * empty squares would add days to the range that the reader did not request.\n */\nexport function weeks(entries: ActivityEntry[], options: WeeksOptions): Cell[][] {\n const { from, to, weekStartsOn = 1 } = options\n const dates = datesBetween(from, to)\n if (dates.length === 0) return []\n\n const byDate = new Map(entries.map((entry) => [entry.date, entry]))\n\n const values = entries\n .map((entry) => entry.value)\n .filter((value): value is number => value !== null && Number.isFinite(value))\n const busiest = options.busiest ?? (values.length > 0 ? Math.max(...values) : 0)\n\n const cellFor = (date: string): Cell => {\n const entry = byDate.get(date)\n const weekend = isWeekend(date)\n\n if (entry === undefined) return { date, kind: 'none', value: null, step: null, weekend }\n if (entry.value === null) return { date, kind: 'partial', value: null, step: null, weekend }\n\n return { date, kind: 'value', value: entry.value, step: stepFor(entry.value, busiest), weekend }\n }\n\n const outside = (date: string): Cell => ({\n date,\n kind: 'outside',\n value: null,\n step: null,\n weekend: isWeekend(date),\n })\n\n /* Where the first date sits in its own week, so the run starts on the right\n * row rather than at the top of the first column. */\n const columnOf = (date: string) => (new Date(parse(date)).getUTCDay() - weekStartsOn + 7) % 7\n\n const columns: Cell[][] = []\n let column: Cell[] = []\n\n // Pad the head, back-dating the squares so each one is the date it stands\n // for - a reader hovering the first column should not find a blank.\n const lead = columnOf(dates[0]!)\n for (let i = lead; i > 0; i--) column.push(outside(format(parse(dates[0]!) - i * DAY)))\n\n for (const date of dates) {\n column.push(cellFor(date))\n if (column.length === 7) {\n columns.push(column)\n column = []\n }\n }\n\n if (column.length > 0) {\n const last = parse(dates.at(-1)!)\n for (let i = 1; column.length < 7; i++) column.push(outside(format(last + i * DAY)))\n columns.push(column)\n }\n\n return columns\n}\n\n/**\n * Which step a value lands on, 1 to `STEPS`.\n *\n * The floor is 1 rather than 0: any value at all is a value, and a square\n * indistinguishable from an empty one would file a twenty-minute day under\n * \"nothing recorded\" - the confusion this module exists to prevent. A value of\n * zero is the exception, and it is the caller's own statement: zero measured is\n * not the same as nothing measured, and it still earns the faintest step.\n */\nexport function stepFor(value: number, busiest: number): number {\n /* No ceiling to measure against. That happens two ways and they mean\n * opposite things: a caller who stated no `busiest` and whose only values\n * are zero (every day measured, every day empty - the faintest step, because\n * that is what they are), or a caller who stated a ceiling of zero while\n * sending a real figure (the ceiling is wrong, and the figure is all the\n * grid has - the darkest, so it is not hidden). */\n if (!(busiest > 0)) return value > 0 ? STEPS : 1\n const share = Math.min(1, Math.max(0, value / busiest))\n return Math.max(1, Math.ceil(share * STEPS))\n}\n\n/** The weekday rows, in the order the grid draws them, as offsets from Sunday.\n *\n * Returned rather than assumed so a caller labelling the rows and a grid\n * drawing them cannot disagree about which row is Monday. */\nexport function weekdayRows(weekStartsOn: Weekday = 1): Weekday[] {\n return [0, 1, 2, 3, 4, 5, 6].map((offset) => ((weekStartsOn + offset) % 7) as Weekday)\n}\n"
379
+ }
380
+ ]
381
+ },
308
382
  {
309
383
  "name": "alert",
310
384
  "type": "registry:ui",
@@ -312,7 +386,7 @@
312
386
  "description": "A message that stays on the screen, in the flow of the page, about the thing next to it: this field could not be saved, this profile has no axes yet, this export is out of date.",
313
387
  "dependencies": [
314
388
  "class-variance-authority",
315
- "dowel-ui@^0.23.0"
389
+ "dowel-ui@^0.25.0"
316
390
  ],
317
391
  "registryDependencies": [],
318
392
  "files": [
@@ -331,7 +405,7 @@
331
405
  "description": "A small piece of state attached to something else: a count, a status, a label. It is not a button and never was - if it can be clicked it is a Chip.",
332
406
  "dependencies": [
333
407
  "class-variance-authority",
334
- "dowel-ui@^0.23.0"
408
+ "dowel-ui@^0.25.0"
335
409
  ],
336
410
  "registryDependencies": [],
337
411
  "files": [
@@ -350,7 +424,7 @@
350
424
  "description": "A strip across the top of the application, about the application: you are offline, this build is a preview, your licence expires on Friday, a new version is ready to install.",
351
425
  "dependencies": [
352
426
  "class-variance-authority",
353
- "dowel-ui@^0.23.0"
427
+ "dowel-ui@^0.25.0"
354
428
  ],
355
429
  "registryDependencies": [],
356
430
  "files": [
@@ -362,6 +436,25 @@
362
436
  }
363
437
  ]
364
438
  },
439
+ {
440
+ "name": "bar-chart",
441
+ "type": "registry:ui",
442
+ "title": "Bar-chart",
443
+ "description": "Bars rather than a line, and the distinction is the data's not the drawing's: a line says the value exists between the points, a column says each period is its own sum. Hours worked in a week is a sum - there is no \"Wednesday afternoon\" reading between two weeks - so it is a column.",
444
+ "dependencies": [
445
+ "class-variance-authority",
446
+ "dowel-ui@^0.25.0"
447
+ ],
448
+ "registryDependencies": [],
449
+ "files": [
450
+ {
451
+ "path": "ui/bar-chart.tsx",
452
+ "target": "@ui/bar-chart.tsx",
453
+ "type": "registry:ui",
454
+ "content": "import type { HTMLAttributes, ReactNode } from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from 'dowel-ui'\n\n/*\n * Columns over a baseline: one period, one bar.\n *\n * Bars rather than a line, and the distinction is the data's not the\n * drawing's: a line says the value exists between the points, a column says\n * each period is its own sum. Hours worked in a week is a sum - there is no\n * \"Wednesday afternoon\" reading between two weeks - so it is a column.\n *\n * **The chart owns its height in pixels.** That is not a style choice, it is\n * the defect this component exists to prevent. The first consumer drew its\n * bars as a percentage of the parent, inside a flex row sized from its own\n * content: the child had no base to be a percentage of, every bar computed to\n * zero, and the chart shipped as a row of bare axis labels. No test and no API\n * check could see it - the owner found it by looking, and it cost a patch\n * release. Here the plot is a stated number of pixels and a bar is a\n * percentage of *that*.\n *\n * **An absent period is not a short one.** A week with nothing recorded and a\n * week of twenty minutes are different facts, and a bar of no height says\n * neither - it reads as a bar that failed to render. So a gap keeps its place\n * in the row and is drawn as a mark of its own.\n *\n * Interaction is one `title` per column rather than a tooltip layer: this is a\n * small chart that sits inside a panel, and the numbers it holds also belong\n * in the list beside it. A reader who needs them exactly should not have to\n * hover to find out.\n */\n\nexport const barChartVariants = cva('flex items-end gap-1 border-b border-chart-axis', {\n variants: {\n size: {\n /* Inside a panel, beside other things. */\n sm: '[--plot:72px]',\n /* On its own, where the shape is the subject. */\n md: '[--plot:112px]',\n },\n },\n defaultVariants: { size: 'md' },\n})\n\nexport const barVariants = cva('mx-auto w-3/5 max-w-6 rounded-t-[4px]', {\n variants: {\n tone: {\n accent: 'bg-accent',\n /* For a bar that is one of several series, or one the caller is\n * highlighting against the rest. */\n series: 'bg-series-1',\n good: 'bg-good',\n warn: 'bg-warn',\n bad: 'bg-bad',\n /* The rest of the field, when one bar is the story: emphasis is the\n * most underused form in a chart of eight equal colours. */\n muted: 'bg-line-2',\n },\n },\n defaultVariants: { tone: 'accent' },\n})\n\nexport interface BarDatum {\n /** Distinguishes this column from its neighbours. */\n key: string\n /** The period's own sum. `null` is a period with nothing recorded, which is\n * not the same as a sum of zero and is not drawn as a bar. */\n value: number | null\n /** What goes under the column. Kept short - these labels sit at a width the\n * chart does not control. */\n label: ReactNode\n tone?: NonNullable<VariantProps<typeof barVariants>['tone']>\n /** What the column says, for a reader hovering it and for a screen reader.\n * Required per bar, because a rectangle announces nothing. */\n title: string\n}\n\nexport interface BarChartProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'children'>,\n VariantProps<typeof barChartVariants> {\n bars: BarDatum[]\n /** The top of the scale. Defaults to the tallest bar present; state it to\n * compare two charts, or to hold a scale still while the data moves. */\n max?: number\n /** What the whole chart is, in words. */\n label: string\n}\n\n/** The shortest a bar may be drawn, as a percentage of the plot.\n *\n * A twenty-minute week against a forty-hour one is half a percent, which\n * rounds to nothing: the period was recorded and would simply not be there. */\nconst MIN_BAR = 3\n\nexport function BarChart({ bars, max, label, size, className, ...props }: BarChartProps) {\n const values = bars.map((bar) => bar.value).filter((value): value is number => value !== null)\n /* A ceiling of at least one, so a chart of nothing but zeroes divides\n * safely and draws a row of floors rather than nothing at all. */\n const ceiling = Math.max(max ?? 0, ...values, 1)\n\n return (\n <div className={cn(barChartVariants({ size }), className)} role=\"img\" aria-label={label} {...props}>\n {bars.map((bar) => (\n <div key={bar.key} className=\"flex min-w-0 flex-1 flex-col items-center gap-1.5\">\n {/* The track carries the height itself. See the note above: a\n * percentage against a parent that has no height of its own\n * resolves to zero, and the chart disappears without failing. */}\n <div className=\"flex h-[var(--plot)] w-full items-end\" title={bar.title}>\n {bar.value === null ? (\n /* A gap, drawn as one. A bar of no height is indistinguishable\n * from a bar that did not render, and closing the gap up would\n * turn an absence into continuity - the one thing a trend must\n * not do. */\n <div className=\"mx-auto h-1 w-3/5 max-w-6 rounded-t-[4px] border-x border-t border-line-2\" />\n ) : (\n <div\n className={cn(barVariants({ tone: bar.tone }))}\n style={{ height: `${Math.max((bar.value / ceiling) * 100, MIN_BAR)}%` }}\n />\n )}\n </div>\n <span className=\"w-full truncate text-center text-[10px] text-faint tabular-nums\">\n {bar.label}\n </span>\n </div>\n ))}\n </div>\n )\n}\n\n/*\n * A line across the plot, at a value on the same scale.\n *\n * For the number every bar is read against - a median, a target, an agreed\n * norm. A chart without its baseline invites the reader to invent one, and the\n * one they invent is usually the tallest bar.\n *\n * Drawn as a solid hairline rather than a dash: a dashed rule reads as\n * \"projected\" or \"threshold\" when it is neither, and the doctrine is explicit\n * that grid and axis lines are solid.\n */\nexport interface BaselineProps extends HTMLAttributes<HTMLDivElement> {\n /** Where it sits, on the same scale as the bars. */\n value: number\n /** The same ceiling the chart is drawn against. */\n max: number\n /** What the line is, beside it. */\n children?: ReactNode\n}\n\nexport function Baseline({ value, max, children, className, ...props }: BaselineProps) {\n if (!(max > 0) || value < 0 || value > max) return null\n\n return (\n <div\n className={cn('pointer-events-none absolute inset-x-0 flex items-center gap-2', className)}\n style={{ bottom: `${(value / max) * 100}%` }}\n {...props}\n >\n {/* The rule stops short of the label rather than running under it: a\n * hairline crossing its own caption reads as a strikethrough. */}\n <div className=\"h-px flex-1 bg-chart-grid\" />\n {children !== undefined && (\n <span className=\"shrink-0 text-[10px] leading-none text-faint tabular-nums\">{children}</span>\n )}\n </div>\n )\n}\n\n/*\n * The box a chart and its baseline share.\n *\n * Two things it does, and both are the component's job rather than the\n * caller's. It establishes the positioning context the baseline needs - left\n * to the caller that is a `relative` remembered or forgotten, and forgotten it\n * puts the rule at the bottom of the page. And it keeps a gutter on the right\n * for the baseline's label, which otherwise sits on top of the last columns:\n * the label is outside the plot, so the plot has to end before it starts.\n */\nexport interface ChartFrameProps extends HTMLAttributes<HTMLDivElement> {\n /** Room on the right for the baseline's label. Omit it where there is no\n * baseline, or where the label is short enough to live in the panel's own\n * padding. */\n gutter?: boolean\n children: ReactNode\n}\n\nexport function ChartFrame({ gutter = true, className, ...props }: ChartFrameProps) {\n return <div className={cn('relative', gutter && 'pr-16', className)} {...props} />\n}\n"
455
+ }
456
+ ]
457
+ },
365
458
  {
366
459
  "name": "button",
367
460
  "type": "registry:ui",
@@ -370,7 +463,7 @@
370
463
  "dependencies": [
371
464
  "@base-ui/react",
372
465
  "class-variance-authority",
373
- "dowel-ui@^0.23.0"
466
+ "dowel-ui@^0.25.0"
374
467
  ],
375
468
  "registryDependencies": [],
376
469
  "files": [
@@ -404,7 +497,7 @@
404
497
  "title": "Calendar",
405
498
  "description": "The sums live next door in `calendar-math`, which has no React in it; this is the grid that draws them and the keyboard that moves around it.",
406
499
  "dependencies": [
407
- "dowel-ui@^0.23.0"
500
+ "dowel-ui@^0.25.0"
408
501
  ],
409
502
  "registryDependencies": [
410
503
  "https://lacodda.github.io/dowel/r/calendar-math.json"
@@ -425,7 +518,7 @@
425
518
  "description": "The interesting part is the words. A checkbox on its own is a nine-pixel target that says nothing; wired to a label it is the whole row, and the row is what a finger and a pointer both aim at. So the label is part of the component rather than something a caller remembers to add - the commonest bug in a hand-rolled checkbox is a `<label>` that is next to the input instead of tied to it, which looks identical and does nothing.",
426
519
  "dependencies": [
427
520
  "@base-ui/react",
428
- "dowel-ui@^0.23.0"
521
+ "dowel-ui@^0.25.0"
429
522
  ],
430
523
  "registryDependencies": [],
431
524
  "files": [
@@ -444,7 +537,7 @@
444
537
  "description": "A badge you can act on: a filter that can be removed, a tag with a count, a selected value in a field. The difference from a Badge is entirely about whether something happens when you click it - and if something does, that part is a real `<button>` with a real label, not a decorative cross.",
445
538
  "dependencies": [
446
539
  "class-variance-authority",
447
- "dowel-ui@^0.23.0"
540
+ "dowel-ui@^0.25.0"
448
541
  ],
449
542
  "registryDependencies": [],
450
543
  "files": [
@@ -456,13 +549,34 @@
456
549
  }
457
550
  ]
458
551
  },
552
+ {
553
+ "name": "code-block",
554
+ "type": "registry:ui",
555
+ "title": "Code-block",
556
+ "description": "The frame around a piece of code is the same everywhere and is written again in every product: the scroll that must not wrap, the gutter of line numbers that must not be selectable, the copy button, the caption saying which file this is, and the marking of the lines the reader was sent here to look at.",
557
+ "dependencies": [
558
+ "class-variance-authority",
559
+ "dowel-ui@^0.25.0"
560
+ ],
561
+ "registryDependencies": [
562
+ "https://lacodda.github.io/dowel/r/copy-button.json"
563
+ ],
564
+ "files": [
565
+ {
566
+ "path": "ui/code-block.tsx",
567
+ "target": "@ui/code-block.tsx",
568
+ "type": "registry:ui",
569
+ "content": "import type { HTMLAttributes } from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from 'dowel-ui'\nimport { CopyButton } from './copy-button'\n\n/*\n * Code, shown inside a product.\n *\n * The frame around a piece of code is the same everywhere and is written again\n * in every product: the scroll that must not wrap, the gutter of line numbers\n * that must not be selectable, the copy button, the caption saying which file\n * this is, and the marking of the lines the reader was sent here to look at.\n * All of that is here.\n *\n * WHAT IS DELIBERATELY NOT HERE IS THE HIGHLIGHTER. A registry component is\n * copied into a product and becomes its file, so whatever this imports becomes\n * that product's dependency for good. Shiki is over a megabyte of grammars\n * before a language is chosen and resolves asynchronously, which would give\n * this component a loading state for text already in memory; Prism is\n * synchronous and mutates globals. Either one decides, on the product's\n * behalf, which languages it ships - which is not a primitive's decision to\n * make.\n *\n * So the split is: this draws, the product colours. `tokens` takes lines of\n * `{ text, kind }` from any highlighter - a mapping is about twenty lines -\n * and the eight kinds are the ones that mean the same thing in every language.\n * Without `tokens` the block renders the plain string and is completely\n * usable, which is the honest default: most code in an interface is four lines\n * of a command, where colour adds nothing.\n *\n * The colours are `--syntax-*`, fixed like the series palette: `if` should not\n * be magenta in one product and cobalt in another. They are measured as TEXT,\n * against the hardest surface a block sits on rather than the typical one -\n * every one clears 4.5:1 in both themes. That is why they are not the series\n * palette, whose light values sink to 1.90:1 at this size.\n */\n\nexport const codeBlockVariants = cva(\n // `group` so the copy button reveals on hover of the whole block rather than\n // only once the pointer has found a button it cannot see; `relative` because\n // a block with no caption has nowhere to put that button but over the code.\n 'group relative overflow-hidden rounded-md border border-line bg-soft font-mono',\n {\n variants: {\n size: {\n sm: 'text-2xs',\n md: 'text-sm',\n },\n },\n defaultVariants: { size: 'md' },\n },\n)\n\n/** The eight distinctions worth drawing in every language. A highlighter's own\n * theme names fifty; the rest are one grammar's vocabulary and do not travel,\n * so they fold into the nearest of these. */\nexport type TokenKind =\n | 'keyword'\n | 'string'\n | 'number'\n | 'comment'\n /** An identifier: a variable, a function, a property. */\n | 'name'\n /** A type name, a class, a constructor. */\n | 'type'\n | 'punctuation'\n /** What surrounds the code rather than being it: a decorator, an attribute,\n * a shell prompt, a diff marker. */\n | 'meta'\n\nexport interface CodeToken {\n text: string\n /** Left out for text that takes the ordinary foreground - whitespace,\n * anything the highlighter had no opinion about. */\n kind?: TokenKind\n}\n\n/* A record rather than a template string, because Tailwind reads class names\n * out of the source: `text-syntax-${kind}` compiles to nothing, and the block\n * would render in the default colour with no error anywhere. */\nconst tokenColor: Record<TokenKind, string> = {\n keyword: 'text-syntax-keyword',\n string: 'text-syntax-string',\n number: 'text-syntax-number',\n comment: 'text-syntax-comment',\n name: 'text-syntax-name',\n type: 'text-syntax-type',\n punctuation: 'text-syntax-punctuation',\n meta: 'text-syntax-meta',\n}\n\nexport interface CodeBlockProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onCopy'>,\n VariantProps<typeof codeBlockVariants> {\n /** The code, as it should land on the clipboard. Always required, even when\n * `tokens` is given: what is copied is the text, not a reassembly of the\n * highlighting. */\n code: string\n /** The same code, coloured. Lines of tokens - one array per line, and the\n * newlines are the array boundaries rather than characters in the text.\n * Left out, the block draws `code` in one colour. */\n tokens?: CodeToken[][]\n /** Shown above the code: a file name, a path, a language. It is what brings\n * the header; without one the copy button floats over the code instead,\n * because a strip holding nothing but a button that hides until hover is\n * empty furniture. */\n caption?: string\n /** Numbers down the left. Off by default: they are for code a reader is\n * meant to refer to, and on a two-line command they are furniture. */\n numbered?: boolean\n /** Where the numbering starts, for an excerpt lifted out of a file. */\n firstLine?: number\n /** Lines to mark, in the same numbering the reader sees. */\n highlight?: readonly number[]\n /** Brings the copy button, and names it for a screen reader. Required to\n * have one, and deliberately without a default: a string this component\n * invents is a string the product cannot translate. */\n copyLabel?: string\n /** Announced after a successful copy. Required alongside `copyLabel`. */\n copiedLabel?: string\n /** Told what happened, for a product that wants its own toast. */\n onCopy?: (ok: boolean) => void\n /**\n * Let long lines wrap instead of scrolling.\n *\n * Off by default, and that is the right default for code: a wrapped line\n * lies about where it ends, and indentation is how code is read. It exists\n * for the case where the \"code\" is really a long single-line value - a URL,\n * a token, a stack frame - which scrolls forever and reads no better for it.\n */\n wrap?: boolean\n}\n\nexport function CodeBlock({\n code,\n tokens,\n caption,\n numbered = false,\n firstLine = 1,\n highlight,\n copyLabel,\n copiedLabel,\n onCopy,\n wrap = false,\n size,\n className,\n ...props\n}: CodeBlockProps) {\n /* The trailing newline almost every file ends with would draw an empty final\n * row - and, with numbering on, a number against nothing. It is stripped for\n * drawing only; `code` is what gets copied, unchanged. */\n const lines: CodeToken[][] =\n tokens ?? code.replace(/\\n$/, '').split('\\n').map((text) => [{ text }])\n const marked = new Set(highlight ?? [])\n\n /* Built once. Where it lands is the only thing that differs: inside the\n * header when there is one, and over the code when there is not - which is\n * why the block is `relative`. */\n const copy =\n copyLabel === undefined ? null : (\n <CopyButton\n value={code}\n label={copyLabel}\n copiedLabel={copiedLabel ?? copyLabel}\n onCopy={onCopy}\n className={caption === undefined ? 'absolute right-1.5 top-1.5 z-10 bg-raise' : undefined}\n />\n )\n\n return (\n <div className={cn(codeBlockVariants({ size }), className)} {...props}>\n {/*\n * The header exists for the caption. The copy button goes in it when\n * there is one, and over the code when there is not.\n *\n * The first version drew a header whenever there was EITHER, and a live\n * run showed what that is: a block holding a command, with no caption,\n * got a 34px strip containing one button that is invisible until hover.\n * Empty furniture on the commonest shape there is.\n *\n * Not `<figcaption>`: this is a div, and a caption claiming to be one\n * without a `<figure>` around it is a lie to a screen reader.\n */}\n {caption === undefined ? (\n copy\n ) : (\n <div className=\"flex items-center gap-2 border-b border-line bg-softer px-3 py-1.5\">\n <span className=\"grow truncate text-2xs text-dim\">{caption}</span>\n {copy}\n </div>\n )}\n\n {/*\n * `<pre>` inside the scroller rather than around it, so the horizontal\n * scrollbar belongs to the code and the header stays put above it.\n *\n * `tabIndex={0}` is not decoration: a region that scrolls has to be\n * reachable by the keyboard, or a reader who does not use a pointer\n * cannot see the right-hand end of a long line. It carries a role and a\n * label for the same reason.\n */}\n <pre\n tabIndex={0}\n className={cn(\n 'overflow-x-auto py-2 leading-relaxed',\n // Restored here because a product's shell usually turns selection\n // off - and code that cannot be selected cannot be taken away.\n 'select-text',\n 'focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent',\n )}\n >\n <code className=\"block\">\n {lines.map((line, index) => {\n const number = firstLine + index\n return (\n <span\n key={number}\n className={cn(\n 'flex px-3',\n /* A left rule as well as a tint: a marked line that says so\n * only by a wash of accent is a line nobody notices, and one\n * that a reader who does not see the hue never notices at\n * all. */\n marked.has(number) &&\n 'border-l-2 border-accent bg-accent-soft pl-[calc(0.75rem-2px)]',\n )}\n >\n {numbered && (\n /*\n * `user-select: none` is the whole reason the numbers are\n * drawn here rather than in a counter or a background: a\n * reader who selects the block to copy it must not get \"1\"\n * welded to the front of every line. That is the defect this\n * gutter exists to avoid, and it is invisible until someone\n * pastes.\n */\n <span\n className=\"mr-3 shrink-0 select-none text-right tabular-nums text-faint\"\n style={{ width: `${String(firstLine + lines.length - 1).length}ch` }}\n aria-hidden\n >\n {number}\n </span>\n )}\n {/* `break-words` alongside the wrapping, not instead of it.\n * `pre-wrap` breaks at spaces, and the case `wrap` exists for\n * - a URL, a token, a stack frame - has none: a live run\n * showed a JWT sitting 320px outside a block that had asked\n * to wrap. Only `overflow-wrap` breaks inside a word. */}\n <span\n className={cn(\n 'min-w-0',\n wrap ? 'whitespace-pre-wrap break-words' : 'whitespace-pre',\n )}\n >\n {/* A line with nothing on it still needs its height, or a\n * blank line between two paragraphs of code closes up and\n * the numbering drifts away from the file. */}\n {line.length === 0 ? (\n '\\n'\n ) : (\n line.map((token, at) => (\n <span\n key={at}\n className={token.kind === undefined ? undefined : tokenColor[token.kind]}\n >\n {token.text}\n </span>\n ))\n )}\n </span>\n </span>\n )\n })}\n </code>\n </pre>\n </div>\n )\n}\n"
570
+ }
571
+ ]
572
+ },
459
573
  {
460
574
  "name": "color-field",
461
575
  "type": "registry:ui",
462
576
  "title": "Color-field",
463
577
  "description": "Picking a colour for something the product stores: a tag, a project, a calendar. Note what that is *not* - it is not choosing the appearance of the interface. The theme decides that, from one accent, and a field that let a reader repaint the chrome would undo the argument the whole system rests on.",
464
578
  "dependencies": [
465
- "dowel-ui@^0.23.0"
579
+ "dowel-ui@^0.25.0"
466
580
  ],
467
581
  "registryDependencies": [
468
582
  "https://lacodda.github.io/dowel/r/input.json"
@@ -484,7 +598,7 @@
484
598
  "dependencies": [
485
599
  "@base-ui/react",
486
600
  "class-variance-authority",
487
- "dowel-ui@^0.23.0"
601
+ "dowel-ui@^0.25.0"
488
602
  ],
489
603
  "registryDependencies": [
490
604
  "https://lacodda.github.io/dowel/r/input.json",
@@ -507,7 +621,7 @@
507
621
  "dependencies": [
508
622
  "@base-ui/react",
509
623
  "class-variance-authority",
510
- "dowel-ui@^0.23.0"
624
+ "dowel-ui@^0.25.0"
511
625
  ],
512
626
  "registryDependencies": [
513
627
  "https://lacodda.github.io/dowel/r/combobox.json",
@@ -530,7 +644,7 @@
530
644
  "dependencies": [
531
645
  "@base-ui/react",
532
646
  "class-variance-authority",
533
- "dowel-ui@^0.23.0"
647
+ "dowel-ui@^0.25.0"
534
648
  ],
535
649
  "registryDependencies": [],
536
650
  "files": [
@@ -549,7 +663,7 @@
549
663
  "description": "The same list of actions as Menu, opened the other way round: by right click, or by a long press on a touch screen, over an *area* rather than from a button. So the trigger is not a control - it is the region the menu belongs to, a row, a canvas, a file tile - and it renders a `<div>`.",
550
664
  "dependencies": [
551
665
  "@base-ui/react",
552
- "dowel-ui@^0.23.0"
666
+ "dowel-ui@^0.25.0"
553
667
  ],
554
668
  "registryDependencies": [
555
669
  "https://lacodda.github.io/dowel/r/menu.json"
@@ -563,13 +677,31 @@
563
677
  }
564
678
  ]
565
679
  },
680
+ {
681
+ "name": "copy-button",
682
+ "type": "registry:ui",
683
+ "title": "Copy-button",
684
+ "description": "Whatever a product shows in a panel - code, a payload, a log, one side of a comparison - somebody eventually wants to take it away, and the button that lets them is written again every time with the same three things missed.",
685
+ "dependencies": [
686
+ "dowel-ui@^0.25.0"
687
+ ],
688
+ "registryDependencies": [],
689
+ "files": [
690
+ {
691
+ "path": "ui/copy-button.tsx",
692
+ "target": "@ui/copy-button.tsx",
693
+ "type": "registry:ui",
694
+ "content": "import { useCallback, useEffect, useRef, useState, type ButtonHTMLAttributes } from 'react'\nimport { cn } from 'dowel-ui'\n\n/*\n * The copy affordance in the corner of a block.\n *\n * Whatever a product shows in a panel - code, a payload, a log, one side of a\n * comparison - somebody eventually wants to take it away, and the button that\n * lets them is written again every time with the same three things missed.\n *\n * **It confirms only after the clipboard does.** The write can be refused:\n * it needs a secure context and, in some browsers, a permission. A tick\n * drawn on click is a lie in exactly the case the reader most needs the\n * truth.\n *\n * **It says so as well as showing it.** A tick that appears silently tells a\n * sighted reader it worked and tells nobody else. The live region is the\n * part that actually reports.\n *\n * **It stays reachable without a pointer.** Revealed on hover, which is\n * right - a permanent button in the corner of every block is clutter - and\n * on its own that makes it unreachable by keyboard. It is visible whenever\n * it has focus too, and that pairing is the whole trick.\n *\n * Copyable is the other shape of this, and the two are not interchangeable:\n * that one is a value sitting in a sentence - inline, truncating, showing the\n * text it copies - and this one is a control beside content already on screen,\n * so it carries an icon and no words.\n */\n\nexport interface CopyButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onCopy'> {\n /** What lands on the clipboard. */\n value: string\n /** What the button is called, for a screen reader. Required, and\n * deliberately without a default: a string this component invents is a\n * string the product cannot translate, and it would ship in English to\n * every reader who does not read English. */\n label: string\n /** What is announced after a successful copy. Required for the same\n * reason. */\n copiedLabel: string\n /** Told what happened, for a product that wants its own toast. `false` means\n * the clipboard refused. */\n onCopy?: (ok: boolean) => void\n}\n\nexport function CopyButton({\n value,\n label,\n copiedLabel,\n onCopy,\n className,\n ...props\n}: CopyButtonProps) {\n const [copied, setCopied] = useState(false)\n const timer = useRef<ReturnType<typeof setTimeout>>(undefined)\n\n // A component that sets state on a timer has to stop when it goes away, or\n // it wakes up in a tree that no longer exists.\n useEffect(() => () => clearTimeout(timer.current), [])\n\n const copy = useCallback(async () => {\n try {\n await navigator.clipboard.writeText(value)\n setCopied(true)\n onCopy?.(true)\n clearTimeout(timer.current)\n timer.current = setTimeout(() => setCopied(false), 1600)\n } catch {\n onCopy?.(false)\n }\n }, [value, onCopy])\n\n return (\n <>\n <button\n type=\"button\"\n onClick={copy}\n aria-label={copied ? copiedLabel : label}\n className={cn(\n 'shrink-0 rounded-sm p-1 text-faint transition-colors',\n 'hover:bg-soft hover:text-text',\n /* `group-hover` rather than a hover of its own: the button is in the\n * corner of a block, and it has to appear when the pointer is\n * anywhere over that block rather than only once it has found the\n * button. The container carries `group`. */\n 'opacity-0 group-hover:opacity-100 focus-visible:opacity-100',\n 'focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-accent',\n copied && 'text-good opacity-100',\n className,\n )}\n {...props}\n >\n {copied ? <Tick /> : <Clipboard />}\n </button>\n\n {/* The drawn tick is invisible to a screen reader; this is the part that\n * reports the copy. Outside the button, because its content changes and\n * a live region inside a labelled control is announced twice. */}\n <span role=\"status\" aria-live=\"polite\" className=\"sr-only\">\n {copied ? copiedLabel : ''}\n </span>\n </>\n )\n}\n\nfunction Clipboard() {\n return (\n <svg viewBox=\"0 0 16 16\" width=\"13\" height=\"13\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.4\" aria-hidden>\n <rect x=\"5.5\" y=\"2.5\" width=\"8\" height=\"10\" rx=\"1.5\" />\n <path d=\"M10.5 2.5v-.5a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h.5\" />\n </svg>\n )\n}\n\nfunction Tick() {\n return (\n <svg viewBox=\"0 0 16 16\" width=\"13\" height=\"13\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" aria-hidden>\n <path d=\"M3 8.5l3.5 3.5L13 5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n )\n}\n"
695
+ }
696
+ ]
697
+ },
566
698
  {
567
699
  "name": "copyable",
568
700
  "type": "registry:ui",
569
701
  "title": "Copyable",
570
702
  "description": "Any text that someone will eventually want to copy - an id, a path, a hash, a token - copied with one click. The rule comes from nitid: if a value is worth showing, it is worth being able to take away, and selecting a monospaced id by hand is a small daily tax.",
571
703
  "dependencies": [
572
- "dowel-ui@^0.23.0"
704
+ "dowel-ui@^0.25.0"
573
705
  ],
574
706
  "registryDependencies": [],
575
707
  "files": [
@@ -587,7 +719,7 @@
587
719
  "title": "Date-picker",
588
720
  "description": "The trigger is a button rather than a text input, and that is the decision worth stating. A typable date field has to answer \"what does `03/04/26` mean\" in a locale it cannot be sure of, and it answers wrong for half the world; a button showing the date spelled out has no such question. Where typing genuinely matters - a birth date, forty years back - the calendar is the wrong control anyway and a product should reach for a plain field.",
589
721
  "dependencies": [
590
- "dowel-ui@^0.23.0"
722
+ "dowel-ui@^0.25.0"
591
723
  ],
592
724
  "registryDependencies": [
593
725
  "https://lacodda.github.io/dowel/r/calendar.json",
@@ -610,7 +742,7 @@
610
742
  "title": "Date-range-picker",
611
743
  "description": "The interesting part is the state between them. After the first click there is a start and no end, and that is not an incomplete range to be hidden or a range of one day - it is the normal middle of the interaction, and the calendar has to show it: the first day marked, the days under the pointer shading as the reader moves, the popup staying open. Products that skip it end up with a picker that seems to do nothing until the second click.",
612
744
  "dependencies": [
613
- "dowel-ui@^0.23.0"
745
+ "dowel-ui@^0.25.0"
614
746
  ],
615
747
  "registryDependencies": [
616
748
  "https://lacodda.github.io/dowel/r/calendar.json",
@@ -635,7 +767,7 @@
635
767
  "dependencies": [
636
768
  "@base-ui/react",
637
769
  "class-variance-authority",
638
- "dowel-ui@^0.23.0"
770
+ "dowel-ui@^0.25.0"
639
771
  ],
640
772
  "registryDependencies": [],
641
773
  "files": [
@@ -647,6 +779,44 @@
647
779
  }
648
780
  ]
649
781
  },
782
+ {
783
+ "name": "diff-lines",
784
+ "type": "registry:ui",
785
+ "title": "Diff-lines",
786
+ "description": "Split out like `line-scale` and `table-sort`: a product that wants to know how much moved between two drafts - to put a number in a list, to decide whether to offer the comparison at all - should not have to render a component to find out.",
787
+ "dependencies": [],
788
+ "registryDependencies": [],
789
+ "files": [
790
+ {
791
+ "path": "ui/diff-lines.tsx",
792
+ "target": "@ui/diff-lines.tsx",
793
+ "type": "registry:ui",
794
+ "content": "/*\n * The comparison behind DiffView, with no React in it.\n *\n * Split out like `line-scale` and `table-sort`: a product that wants to know\n * how much moved between two drafts - to put a number in a list, to decide\n * whether to offer the comparison at all - should not have to render a\n * component to find out.\n *\n * Lines rather than words, and that is a choice about the subject. The text\n * being compared here is prose someone wrote and revised - a draft, a note, a\n * configuration file - and prose is revised BY THE LINE. A word-level diff of\n * a rewritten paragraph is confetti: technically accurate, and it answers a\n * question nobody asked. Where the subject really is word-level - a title, a\n * single sentence - a product compares the two strings itself.\n *\n * Plain longest-common-subsequence. The bodies are a page or two, so the exact\n * O(n·m) answer costs nothing and there is no reason to reach for a heuristic.\n *\n * Taken from kilna, which had it first, with the arithmetic unchanged and the\n * pairing added: `rows` is the part the donor did not have, and its absence is\n * what made the donor's two columns drift out of step.\n */\n\n/** One step through the comparison. */\nexport type Change =\n | { kind: 'same'; text: string }\n | { kind: 'added'; text: string }\n | { kind: 'removed'; text: string }\n\n/**\n * One row of a side-by-side comparison: what stands on each side of it.\n *\n * `null` is a side with nothing there - the gap opposite an inserted line -\n * and it is deliberately not an empty string. An empty string is a line\n * somebody wrote that happens to have no characters on it, and a comparison\n * that cannot tell those apart draws a blank line as a deletion.\n */\nexport interface DiffRow {\n before: string | null\n after: string | null\n kind: Change['kind']\n /** Line numbers in each text, 1-based, for a gutter. `null` on the side that\n * has nothing. */\n beforeLine: number | null\n afterLine: number | null\n}\n\n/** How many lines each side may have before the comparison gives up. A table\n * of 2000×2000 is four million cells; past that the honest answer is \"too long\n * to compare\", not a frozen window. */\nexport const LIMIT = 2000\n\nexport function diffLines(before: string, after: string): Change[] {\n const a = before.split('\\n')\n const b = after.split('\\n')\n\n if (a.length > LIMIT || b.length > LIMIT) {\n return [\n { kind: 'removed', text: before },\n { kind: 'added', text: after },\n ]\n }\n\n // lcs[i][j] - the length of the longest common subsequence of a[i..] and\n // b[j..]. Filled backwards so the walk forwards can be greedy.\n const lcs: number[][] = Array.from({ length: a.length + 1 }, () =>\n Array.from({ length: b.length + 1 }, () => 0),\n )\n\n for (let i = a.length - 1; i >= 0; i -= 1) {\n for (let j = b.length - 1; j >= 0; j -= 1) {\n lcs[i]![j] = a[i] === b[j] ? lcs[i + 1]![j + 1]! + 1 : Math.max(lcs[i + 1]![j]!, lcs[i]![j + 1]!)\n }\n }\n\n const changes: Change[] = []\n let i = 0\n let j = 0\n\n while (i < a.length && j < b.length) {\n if (a[i] === b[j]) {\n changes.push({ kind: 'same', text: a[i]! })\n i += 1\n j += 1\n } else if (lcs[i + 1]![j]! >= lcs[i]![j + 1]!) {\n changes.push({ kind: 'removed', text: a[i]! })\n i += 1\n } else {\n changes.push({ kind: 'added', text: b[j]! })\n j += 1\n }\n }\n\n while (i < a.length) {\n changes.push({ kind: 'removed', text: a[i]! })\n i += 1\n }\n while (j < b.length) {\n changes.push({ kind: 'added', text: b[j]! })\n j += 1\n }\n\n return changes\n}\n\n/**\n * The changes as rows of two columns - the thing that makes side-by-side mean\n * anything.\n *\n * The obvious way to draw two columns is to filter the change list twice: keep\n * everything that is not `added` on the left, everything that is not `removed`\n * on the right. Both columns come out individually correct and they stop\n * lining up at the first insertion, because from there on they hold different\n * numbers of rows. The reader then compares line 4 against line 3 for the rest\n * of the screen, and nothing about the drawing looks wrong - which is why the\n * defect survived in the product this was taken from.\n *\n * Pairing instead makes the alignment structural: a row is one object with two\n * sides, so the columns are the same height by construction rather than by two\n * filters happening to agree.\n *\n * A removal immediately followed by an insertion is paired into ONE row rather\n * than two. That is the common shape of an edit - a line was rewritten - and\n * showing the old and the new opposite each other is the whole point of the\n * comparison. Left as separate rows, a rewritten line reads as a deletion\n * followed by an unrelated addition, with a gap opposite each.\n */\nexport function rows(changes: readonly Change[]): DiffRow[] {\n const out: DiffRow[] = []\n let beforeLine = 1\n let afterLine = 1\n\n for (let at = 0; at < changes.length; at += 1) {\n const change = changes[at]!\n\n if (change.kind === 'same') {\n out.push({\n before: change.text,\n after: change.text,\n kind: 'same',\n beforeLine: beforeLine++,\n afterLine: afterLine++,\n })\n continue\n }\n\n if (change.kind === 'removed') {\n // A removal with an insertion right behind it is a rewrite: pair them,\n // so the reader sees what the line became rather than two separate\n // events with a gap opposite each.\n const next = changes[at + 1]\n if (next?.kind === 'added') {\n out.push({\n before: change.text,\n after: next.text,\n kind: 'removed',\n beforeLine: beforeLine++,\n afterLine: afterLine++,\n })\n at += 1\n continue\n }\n out.push({\n before: change.text,\n after: null,\n kind: 'removed',\n beforeLine: beforeLine++,\n afterLine: null,\n })\n continue\n }\n\n out.push({\n before: null,\n after: change.text,\n kind: 'added',\n beforeLine: null,\n afterLine: afterLine++,\n })\n }\n\n return out\n}\n\n/** How much moved, for the one line above a comparison - or for a list that\n * wants to say \"12 lines changed\" without drawing anything. */\nexport function countChanges(changes: readonly Change[]): { added: number; removed: number } {\n let added = 0\n let removed = 0\n for (const change of changes) {\n if (change.kind === 'added') added += 1\n else if (change.kind === 'removed') removed += 1\n }\n return { added, removed }\n}\n"
795
+ }
796
+ ]
797
+ },
798
+ {
799
+ "name": "diff-view",
800
+ "type": "registry:ui",
801
+ "title": "Diff-view",
802
+ "description": "The question this answers is \"how did this read before, and how does it read now\" - a version against the one before it, a proposal against what is there, a file against what is on disk. Not a code review: there is no staging, no comment, nothing to accept. It is for looking.",
803
+ "dependencies": [
804
+ "class-variance-authority",
805
+ "dowel-ui@^0.25.0"
806
+ ],
807
+ "registryDependencies": [
808
+ "https://lacodda.github.io/dowel/r/copy-button.json",
809
+ "https://lacodda.github.io/dowel/r/diff-lines.json"
810
+ ],
811
+ "files": [
812
+ {
813
+ "path": "ui/diff-view.tsx",
814
+ "target": "@ui/diff-view.tsx",
815
+ "type": "registry:ui",
816
+ "content": "import { useMemo, type HTMLAttributes, type ReactNode } from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from 'dowel-ui'\nimport { CopyButton } from './copy-button'\nimport { countChanges, diffLines, rows, type DiffRow } from './diff-lines'\n\n/*\n * Two drafts of the same text, with what moved between them shown.\n *\n * The question this answers is \"how did this read before, and how does it read\n * now\" - a version against the one before it, a proposal against what is\n * there, a file against what is on disk. Not a code review: there is no\n * staging, no comment, nothing to accept. It is for looking.\n *\n * SIDE BY SIDE, AND THE ALIGNMENT IS THE WHOLE THING. The obvious way to draw\n * two columns is to filter the change list twice - keep what is not `added` on\n * the left, what is not `removed` on the right - and it is what the product\n * this came from did. Both columns come out individually correct, and they\n * stop lining up at the first insertion: from there the reader is comparing\n * line 4 against line 3, with nothing looking wrong. `rows` in `diff-lines`\n * pairs the changes instead, so the two sides are one list and cannot drift.\n *\n * The alignment has a second half, in the drawing rather than the data: ONE\n * scrolling region holds both columns, and a row is a single grid row spanning\n * them. Two scrollers - the shape this was first written with - come apart the\n * moment a reader touches one of them, which undoes the pairing at the point\n * it matters most. It also means a row is as tall as its taller side, so a\n * wrapped line on the left keeps its partner beside it instead of pushing the\n * two texts out of step.\n *\n * Below a certain width the pair stacks - the \"after\" line under the \"before\"\n * one - because two columns each too narrow to hold a line of text answer\n * nothing: every line wraps into three and the comparison is worse than one\n * column would have been. The breakpoint is on the component rather than the\n * viewport (`@container`), since a diff in a side panel is narrow on a wide\n * screen.\n *\n * STACKS, not hides. This drew `hidden @3xl:flex` on the after side for a\n * while, under a comment that said \"stacked\" - so a narrow reader saw a line\n * marked `~` as rewritten and nothing to compare it with, on a screen that\n * looked finished. Every test passed: they count cells in the DOM, and jsdom\n * does not resolve a container query. Half a comparison is worse than none.\n *\n * Colour is never the message. A changed line carries a marker glyph in the\n * gutter - `+`, `-`, `~` - so the comparison reads without hue, in a\n * screenshot, and for the eighth of men who would otherwise see two tinted\n * greys.\n */\n\nexport const diffViewVariants = cva('@container flex flex-col gap-2 text-sm', {\n variants: {\n size: {\n sm: '[--diff-max:16rem]',\n md: '[--diff-max:28rem]',\n /** No ceiling: the comparison is as tall as it is, and the page scrolls.\n * For a diff that IS the screen rather than sitting on one. */\n full: '[--diff-max:none]',\n },\n },\n defaultVariants: { size: 'md' },\n})\n\nexport interface DiffViewProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onCopy'>,\n VariantProps<typeof diffViewVariants> {\n before: string\n after: string\n /** What each side is called - a version name, a date, \"on disk\". */\n beforeLabel: string\n afterLabel: string\n /** The line above the comparison: how much moved. The component counts, the\n * product says it in words - a count is a plural, and a plural belongs to a\n * language the component does not know. Given the two numbers, and left out\n * entirely when there is nothing to say. */\n summary?: (counts: { added: number; removed: number }) => ReactNode\n /** Numbers down each side. On by default: a comparison is usually read in\n * order to go and change something, and the number is how the reader finds\n * the place. */\n numbered?: boolean\n /**\n * Brings a copy button to each side's header, and names it.\n *\n * A function of the side's label rather than a string, because the two\n * buttons need distinguishable names - \"Copy\" twice on one screen tells a\n * reader using them which is which only by where they are, which is what a\n * label exists to avoid. Sticking the two together here (`${copy}: ${side}`)\n * would invent a phrase in a grammar this component does not know.\n */\n copyLabel?: (side: string) => string\n /** Announced after a successful copy. Required alongside `copyLabel`. */\n copiedLabel?: string\n /** Told what happened, for a product that wants its own toast. */\n onCopy?: (ok: boolean) => void\n}\n\nexport function DiffView({\n before,\n after,\n beforeLabel,\n afterLabel,\n summary,\n numbered = true,\n copyLabel,\n copiedLabel = '',\n onCopy,\n size,\n className,\n ...props\n}: DiffViewProps) {\n const changes = useMemo(() => diffLines(before, after), [before, after])\n const paired = useMemo(() => rows(changes), [changes])\n const counts = useMemo(() => countChanges(changes), [changes])\n\n /* Wide enough for the largest number either side will show. Sized from the\n * row count rather than from each column's own last number, so the two\n * gutters are the same width and the texts start at the same offset. */\n const width = String(paired.length).length\n\n return (\n <div className={cn(diffViewVariants({ size }), className)} {...props}>\n {summary !== undefined && <p className=\"text-xs text-dim\">{summary(counts)}</p>}\n\n <div className=\"overflow-hidden rounded-lg border border-line\">\n {/*\n * The headers sit outside the scroller, in the same two tracks, so\n * they stay put while the text moves under them.\n *\n * In one column they sit side by side instead of stacking, with an\n * arrow between them: stacked, they would be two labels separated by\n * the whole of the left-hand text, which labels nothing. Both are\n * always drawn - a comparison that names one of its two sides is one\n * the reader has to guess at.\n */}\n <div className=\"group flex items-center gap-2 border-b border-line bg-softer px-3 py-1 text-2xs font-medium text-dim @3xl:grid @3xl:grid-cols-2 @3xl:gap-0 @3xl:px-0 @3xl:py-0\">\n <span className=\"flex min-w-0 items-center gap-2 @3xl:grow @3xl:px-3 @3xl:py-1\">\n <span className=\"truncate @3xl:grow\">{beforeLabel}</span>\n {copyLabel !== undefined && (\n <CopyButton\n value={before}\n label={copyLabel(beforeLabel)}\n copiedLabel={copiedLabel}\n onCopy={onCopy}\n />\n )}\n </span>\n {/* Only while the two labels share a line. In two columns the tracks\n * say which is which. */}\n <span className=\"shrink-0 text-faint @3xl:hidden\" aria-hidden>\n {'\\u2192'}\n </span>\n <span className=\"flex min-w-0 items-center gap-2 @3xl:border-l @3xl:border-line @3xl:px-3 @3xl:py-1\">\n <span className=\"truncate @3xl:grow\">{afterLabel}</span>\n {copyLabel !== undefined && (\n <CopyButton\n value={after}\n label={copyLabel(afterLabel)}\n copiedLabel={copiedLabel}\n onCopy={onCopy}\n />\n )}\n </span>\n </div>\n\n <div\n /* The one scrolling region. Focusable because it scrolls: a region a\n * pointer can reach and a keyboard cannot is the usual way a long\n * diff hides its end. */\n tabIndex={0}\n className={cn(\n 'max-h-[var(--diff-max)] overflow-auto py-1 font-mono text-xs leading-relaxed',\n // A desktop shell turns selection off; a comparison is read in\n // order to copy something out of it.\n 'select-text',\n 'focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent',\n )}\n >\n <div className=\"grid grid-cols-1 @3xl:grid-cols-2\">\n {paired.map((row, index) => (\n // Lines repeat and reorder, so the text is not an identity; the\n // list is rebuilt whole whenever either side changes.\n <Row key={index} row={row} numbered={numbered} width={width} />\n ))}\n </div>\n </div>\n </div>\n </div>\n )\n}\n\n/* The glyph in the gutter, per side. A deletion is only a deletion on the left\n * - on the right that same row is a gap - so the marker depends on which\n * column is being drawn, not on the change alone. `~` for a rewritten line,\n * which is one event with a side each. */\nexport function marker(row: DiffRow, side: 'before' | 'after'): string {\n const text = side === 'before' ? row.before : row.after\n if (row.kind === 'same' || text === null) return ' '\n if (row.kind === 'removed' && row.after !== null) return '~'\n return side === 'before' ? '-' : '+'\n}\n\n/*\n * One row, as its two cells.\n *\n * They are siblings in the grid rather than a wrapper holding both, because a\n * wrapper would become the grid item and the columns would stop being columns.\n * `display: contents` would do it too and is worse: it removes the element\n * from the accessibility tree in several browsers, taking any grouping with\n * it.\n */\nfunction Row({ row, numbered, width }: { row: DiffRow; numbered: boolean; width: number }) {\n return (\n <>\n <Side row={row} side=\"before\" numbered={numbered} width={width} />\n <Side row={row} side=\"after\" numbered={numbered} width={width} />\n </>\n )\n}\n\nfunction Side({\n row,\n side,\n numbered,\n width,\n}: {\n row: DiffRow\n side: 'before' | 'after'\n numbered: boolean\n width: number\n}) {\n const text = side === 'before' ? row.before : row.after\n const line = side === 'before' ? row.beforeLine : row.afterLine\n const changed = row.kind !== 'same' && text !== null\n\n return (\n <div\n className={cn(\n 'flex px-2',\n // The rule between the columns belongs to the right-hand cells, so it\n // runs the full height of the text rather than stopping at the last\n // row of a short column. Gone while stacked, where there is no second\n // column for it to divide.\n /*\n * On the right in two columns; UNDER its partner in one.\n *\n * Never hidden, and that is the whole note. This read `hidden\n * @3xl:flex` for a while, under a comment saying the comparison\n * \"stacks\" - it did not stack, it dropped the after side entirely, so\n * a narrow reader saw a line marked `~` and nothing to compare it\n * with. A screen that looks finished and withholds half the answer is\n * worse than one that admits it has no room.\n *\n * Stacking needs no rule of its own: the cells are already siblings of\n * a grid that is one column until `@3xl`, so they fall under each\n * other by themselves. What the narrow layout does need is the rule\n * BETWEEN the pair, which is a top border there and a left border in\n * two columns.\n */\n side === 'after' && 'border-t border-line @3xl:border-t-0 @3xl:border-l',\n changed && (side === 'before' ? 'bg-bad-soft text-bad' : 'bg-good-soft text-good'),\n )}\n >\n {numbered && (\n // Never part of a selection: a reader copying a column wants the text,\n // not the text with a number welded to the front of every line.\n <span\n className=\"mr-2 shrink-0 select-none text-right tabular-nums text-faint\"\n style={{ width: `${width}ch` }}\n aria-hidden\n >\n {line ?? ''}\n </span>\n )}\n\n {/* The second channel, so the comparison reads without colour.\n * `aria-hidden` because a screen reader is told what changed by the\n * text itself; a spoken \"minus\" before every removed line is noise. */}\n <span className=\"mr-1.5 shrink-0 select-none\" aria-hidden>\n {marker(row, side)}\n </span>\n\n <span className=\"min-w-0 whitespace-pre-wrap break-words\">\n {/* A blank line still needs its height, or a gap opposite an insertion\n * collapses and the two columns come out of step by exactly the thing\n * the pairing prevented. */}\n {text === null || text === '' ? ' ' : text}\n </span>\n </div>\n )\n}\n"
817
+ }
818
+ ]
819
+ },
650
820
  {
651
821
  "name": "drawer",
652
822
  "type": "registry:ui",
@@ -655,7 +825,7 @@
655
825
  "dependencies": [
656
826
  "@base-ui/react",
657
827
  "class-variance-authority",
658
- "dowel-ui@^0.23.0"
828
+ "dowel-ui@^0.25.0"
659
829
  ],
660
830
  "registryDependencies": [],
661
831
  "files": [
@@ -673,7 +843,7 @@
673
843
  "title": "Duration-field",
674
844
  "description": "The alternative is what products keep building: two number boxes labelled \"hours\" and \"minutes\", which means two tab stops, two validations, and a reader who has to divide 90 minutes in their head before typing. Here they write `1h 30m`, or `90m`, or `1.5h`, and it means the same thing.",
675
845
  "dependencies": [
676
- "dowel-ui@^0.23.0"
846
+ "dowel-ui@^0.25.0"
677
847
  ],
678
848
  "registryDependencies": [
679
849
  "https://lacodda.github.io/dowel/r/input.json"
@@ -694,7 +864,7 @@
694
864
  "description": "Three kinds of nothing, and a product that draws the same panel for all three is telling the reader the wrong thing twice:\n * **empty** - there is nothing here yet, and that is normal. The panel says what would be here and offers the one action that makes it appear.",
695
865
  "dependencies": [
696
866
  "class-variance-authority",
697
- "dowel-ui@^0.23.0"
867
+ "dowel-ui@^0.25.0"
698
868
  ],
699
869
  "registryDependencies": [],
700
870
  "files": [
@@ -732,7 +902,7 @@
732
902
  "description": "Every form is the same four parts repeated: a name for the control, the control, sometimes a hint, and sometimes an error. Written by hand each time, they drift - the label loses its `htmlFor`, the hint is a `<div>` no screen reader mentions, the error appears in red and is announced by nothing at all. This is that arrangement, once.",
733
903
  "dependencies": [
734
904
  "@base-ui/react",
735
- "dowel-ui@^0.23.0"
905
+ "dowel-ui@^0.25.0"
736
906
  ],
737
907
  "registryDependencies": [],
738
908
  "files": [
@@ -750,7 +920,7 @@
750
920
  "title": "File-drop",
751
921
  "description": "A place to put files: drag them onto it, or press it and pick them. It takes files and hands them over - it does not upload them. Where they go, with which credentials, retried how - that is the product's transport, and a primitive that owned it would be wrong for every product whose upload does not look like the one it guessed.",
752
922
  "dependencies": [
753
- "dowel-ui@^0.23.0"
923
+ "dowel-ui@^0.25.0"
754
924
  ],
755
925
  "registryDependencies": [],
756
926
  "files": [
@@ -768,7 +938,7 @@
768
938
  "title": "Input",
769
939
  "description": "A single-line field. It is a plain `<input>` with the line's clothes on, so everything a browser gives an input for free - autofill, spellcheck, the right keyboard on a phone, `type=\"email\"` validation - still works.",
770
940
  "dependencies": [
771
- "dowel-ui@^0.23.0"
941
+ "dowel-ui@^0.25.0"
772
942
  ],
773
943
  "registryDependencies": [],
774
944
  "files": [
@@ -780,13 +950,49 @@
780
950
  }
781
951
  ]
782
952
  },
953
+ {
954
+ "name": "json-rows",
955
+ "type": "registry:ui",
956
+ "title": "Json-rows",
957
+ "description": "The sibling of `tree-rows`, built the same way and for the same reason: a product that wants to count the rows before drawing any of them - to put a viewer inside a VirtualList, to say \"1,204 entries\" - imports this and never the component.",
958
+ "dependencies": [],
959
+ "registryDependencies": [],
960
+ "files": [
961
+ {
962
+ "path": "ui/json-rows.tsx",
963
+ "target": "@ui/json-rows.tsx",
964
+ "type": "registry:ui",
965
+ "content": "/*\n * What a JSON value looks like as a list of rows, with no React in it.\n *\n * The sibling of `tree-rows`, built the same way and for the same reason: a\n * product that wants to count the rows before drawing any of them - to put a\n * viewer inside a VirtualList, to say \"1,204 entries\" - imports this and never\n * the component.\n *\n * Flattening is also what makes the keyboard simple. Down is the next row of\n * this list and Up the previous, whatever the nesting; a recursive walk at\n * every keystroke asks the same question and answers it differently at each\n * depth.\n */\n\n/** What a value is, for drawing and for deciding whether it opens.\n *\n * `null` is its own kind rather than an absence: in JSON it is a value\n * somebody wrote, and a viewer that shows it as an empty cell says the key is\n * missing when it is present and null - a distinction that decides bugs. */\nexport type JsonKind = 'object' | 'array' | 'string' | 'number' | 'boolean' | 'null'\n\n/** Any value `JSON.parse` can return. */\nexport type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue }\n\nexport interface JsonRow {\n /**\n * Where this sits, in JSONPath: `$.items[3].name`.\n *\n * The identity of a row, and deliberately not its index: a row's index\n * changes when a branch above it opens, and anything remembered by index -\n * which rows are open, which is selected - would jump to a different value\n * the moment something above it moved. It is also what a reader copies when\n * they want to point at this value from somewhere else.\n */\n path: string\n /** The key, or the index as written in the path. `null` only for the root. */\n key: string | null\n /** True when the key is an array index rather than an object's name - drawn\n * differently, because `0` as a name and `0` as a position are not the same\n * thing. */\n index: boolean\n kind: JsonKind\n /** The value itself, for a leaf. A branch has none: what it holds is in the\n * rows below it. */\n value?: string | number | boolean | null\n depth: number\n /** How many entries a branch holds, so a closed one can say so without being\n * opened. */\n size?: number\n /** The path of the branch this row sits in, if any. What Left uses to get\n * out of a deep branch in one press. */\n parent?: string\n}\n\nexport function kindOf(value: JsonValue): JsonKind {\n if (value === null) return 'null'\n if (Array.isArray(value)) return 'array'\n return typeof value as JsonKind\n}\n\nexport function isBranch(kind: JsonKind): boolean {\n return kind === 'object' || kind === 'array'\n}\n\n/*\n * A key as it appears in a path.\n *\n * Dot notation where the key is an ordinary identifier, brackets otherwise -\n * which is not decoration. `$.user name` is not a path anything can resolve,\n * and a key containing a dot (`$.a.b` for the single key `\"a.b\"`) is a path\n * that resolves to the WRONG value silently. Both are common in real data:\n * configuration files and anything exported from a spreadsheet.\n */\nfunction step(key: string): string {\n return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key)\n ? `.${key}`\n : `[${JSON.stringify(key)}]`\n}\n\n/**\n * The rows a value shows, in the order the eye and the keyboard travel.\n *\n * Only what is visible: a closed branch contributes its own row and nothing\n * below it. That is what keeps a viewer of a large document cheap - a\n * thousand-entry array that nobody opened costs one row.\n */\nexport function visibleRows(\n value: JsonValue,\n open: ReadonlySet<string>,\n { root = '$' }: { root?: string } = {},\n): JsonRow[] {\n const rows: JsonRow[] = []\n\n const walk = (\n node: JsonValue,\n path: string,\n key: string | null,\n index: boolean,\n depth: number,\n parent?: string,\n ): void => {\n const kind = kindOf(node)\n\n if (!isBranch(kind)) {\n rows.push({ path, key, index, kind, value: node as string | number | boolean | null, depth, parent })\n return\n }\n\n const entries: [string, JsonValue][] = Array.isArray(node)\n ? node.map((item, at) => [String(at), item])\n : Object.entries(node as { [key: string]: JsonValue })\n\n rows.push({ path, key, index, kind, depth, size: entries.length, parent })\n\n if (!open.has(path)) return\n\n for (const [childKey, child] of entries) {\n walk(\n child,\n Array.isArray(node) ? `${path}[${childKey}]` : `${path}${step(childKey)}`,\n childKey,\n Array.isArray(node),\n depth + 1,\n path,\n )\n }\n }\n\n walk(value, root, null, false, 0)\n return rows\n}\n\n/**\n * The paths to open so a document arrives readable.\n *\n * Bounded twice, by depth AND by size, and the second bound is the one that\n * does the work. A depth bound alone reads as sufficient and is not: the cost\n * of opening is measured in ROWS, while depth counts LEVELS, and those track\n * each other only while the branches are small - which is the case nobody\n * needed protecting from.\n *\n * Measured, not reasoned: a payload holding `assets: [1204 entries]` at its\n * top level rendered 1216 rows and 24,000 pixels of scroll on arrival under a\n * depth-2 bound, because the array sits AT depth 2. That is exactly the freeze\n * the bound exists to prevent, produced by the bound itself. The shape that\n * hurts is one huge branch near the surface, and a level count is blindest to\n * precisely that shape.\n *\n * So a branch opens when it is shallow enough AND holds fewer than `size`\n * entries. A branch left shut is not descended through either - what is inside\n * something the reader cannot see does not need deciding about.\n */\nexport function branchPaths(\n value: JsonValue,\n {\n root = '$',\n depth = 2,\n /** How many entries a branch may hold and still open by itself. Twenty is\n * about a screen: enough that a settings file arrives open, few enough\n * that a list of records arrives as a list of records. */\n size = 20,\n }: { root?: string; depth?: number; size?: number } = {},\n): Set<string> {\n const paths = new Set<string>()\n\n const walk = (node: JsonValue, path: string, level: number): void => {\n const kind = kindOf(node)\n if (!isBranch(kind) || level > depth) return\n\n const entries: [string, JsonValue][] = Array.isArray(node)\n ? node.map((item, at) => [String(at), item])\n : Object.entries(node as { [key: string]: JsonValue })\n\n // Too big to open, so it stays shut - and nothing below it is considered:\n // those rows are not going to be drawn either way.\n if (entries.length > size) return\n\n paths.add(path)\n\n for (const [key, child] of entries) {\n walk(child, Array.isArray(node) ? `${path}[${key}]` : `${path}${step(key)}`, level + 1)\n }\n }\n\n walk(value, root, 1)\n return paths\n}\n\n/**\n * What a closed branch says about itself: `{ 4 }` or `[ 1204 ]`.\n *\n * The count rather than a preview of the contents. A preview of the first\n * entries reads as though those are all of them, which is the one thing a\n * closed branch must not imply.\n */\nexport function summarise(row: JsonRow): string {\n if (row.kind === 'array') return `[ ${row.size ?? 0} ]`\n return `{ ${row.size ?? 0} }`\n}\n"
966
+ }
967
+ ]
968
+ },
969
+ {
970
+ "name": "json-viewer",
971
+ "type": "registry:ui",
972
+ "title": "Json-viewer",
973
+ "description": "What a product reaches for when it has to show a response, a settings file, a webhook payload - data the reader needs to understand, not edit. The alternative it replaces is `JSON.stringify(value, null, 2)` inside a `<pre>`, which is fine for twenty lines and useless for two hundred: nothing folds, nothing is findable, and the shape of the document is somewhere inside the indentation.",
974
+ "dependencies": [
975
+ "dowel-ui@^0.25.0"
976
+ ],
977
+ "registryDependencies": [
978
+ "https://lacodda.github.io/dowel/r/json-rows.json"
979
+ ],
980
+ "files": [
981
+ {
982
+ "path": "ui/json-viewer.tsx",
983
+ "target": "@ui/json-viewer.tsx",
984
+ "type": "registry:ui",
985
+ "content": "import { useMemo, useState, type KeyboardEvent } from 'react'\nimport { cn } from 'dowel-ui'\nimport {\n branchPaths,\n isBranch,\n summarise,\n visibleRows,\n type JsonRow,\n type JsonValue,\n} from './json-rows'\n\n/*\n * A JSON value, read rather than parsed by eye.\n *\n * What a product reaches for when it has to show a response, a settings file,\n * a webhook payload - data the reader needs to understand, not edit. The\n * alternative it replaces is `JSON.stringify(value, null, 2)` inside a `<pre>`,\n * which is fine for twenty lines and useless for two hundred: nothing folds,\n * nothing is findable, and the shape of the document is somewhere inside the\n * indentation.\n *\n * It is a TREE, and it deliberately does not reuse TreeView. A row here is a\n * key AND a value, and TreeView's row is one `ReactNode` label - pouring JSON\n * into it means the component can no longer colour a value by its type, tell\n * an array index from a name, or offer the two things a reader actually wants\n * (the value at this row, the path to it). What is genuinely shared is the\n * arithmetic of which rows are visible, and that is shared: `json-rows` is the\n * sibling of `tree-rows`, both with no React in them.\n *\n * The keyboard is the ARIA tree pattern, for the reason TreeView states it:\n *\n * **One tab stop, not one per row.** A document of four hundred rows with a\n * `tabIndex` on each is four hundred stops between whatever is above it and\n * whatever is below.\n *\n * **Right and Left do different things depending on where the cursor is.**\n * Right opens a closed branch, steps into an open one, does nothing on a\n * leaf; Left closes an open branch and otherwise jumps to the parent, which\n * is how a reader gets out of a deep branch without walking back up through\n * every sibling.\n *\n * Values are coloured with `--syntax-*`, the same tokens a CodeBlock uses, so\n * a string is the same green in both. Colour is never the only signal: a\n * string is quoted, a branch says how many it holds, and null is the word.\n */\n\nexport interface JsonViewerProps {\n value: JsonValue\n /** Which branches are open, by path. Uncontrolled if omitted, starting with\n * the top two levels open - the shape of an answer rather than the whole\n * document. */\n open?: ReadonlySet<string>\n onOpenChange?: (open: Set<string>) => void\n /** Told which row was activated, with its path and its value. What a product\n * hangs \"copy this\" or \"go to this setting\" on. */\n onActivate?: (row: JsonRow) => void\n /** What a screen reader calls it. Required, and without a default: a string\n * this component invents is a string the product cannot translate. */\n label: string\n /** The path the document starts at, for a viewer showing one field of a\n * larger record. Paths are then written so they still mean something in that\n * record. */\n root?: string\n className?: string\n}\n\nexport function JsonViewer({\n value,\n open: openProp,\n onOpenChange,\n onActivate,\n label,\n root = '$',\n className,\n}: JsonViewerProps) {\n const [openState, setOpenState] = useState(() => branchPaths(value, { root }))\n const open = openProp ?? openState\n\n const rows = useMemo(() => visibleRows(value, open, { root }), [value, open, root])\n\n /* The cursor is a path, not an index. An index would point at a different\n * value the moment a branch above it opened - the cursor would appear to\n * jump on its own. */\n const [cursor, setCursor] = useState<string>(root)\n const at = Math.max(\n 0,\n rows.findIndex((row) => row.path === cursor),\n )\n\n const setOpen = (next: Set<string>) => {\n if (openProp === undefined) setOpenState(next)\n onOpenChange?.(next)\n }\n\n const toggle = (path: string) => {\n const next = new Set(open)\n if (next.has(path)) next.delete(path)\n else next.add(path)\n setOpen(next)\n }\n\n const move = (to: number) => {\n const row = rows[Math.min(Math.max(to, 0), rows.length - 1)]\n if (row !== undefined) setCursor(row.path)\n }\n\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n const row = rows[at]\n if (row === undefined) return\n\n switch (event.key) {\n case 'ArrowDown':\n move(at + 1)\n break\n case 'ArrowUp':\n move(at - 1)\n break\n case 'ArrowRight':\n // Open a closed branch; step into an open one. On a leaf, nothing -\n // rather than falling through to the next row, which would make Right\n // a second Down and lose the reader their place in the nesting.\n if (isBranch(row.kind) && !open.has(row.path)) toggle(row.path)\n else if (isBranch(row.kind)) move(at + 1)\n else return\n break\n case 'ArrowLeft':\n // Close what is open; otherwise leave the branch. The second half is\n // what makes a deep document navigable at all.\n if (isBranch(row.kind) && open.has(row.path)) toggle(row.path)\n else if (row.parent !== undefined) setCursor(row.parent)\n else return\n break\n case 'Home':\n move(0)\n break\n case 'End':\n move(rows.length - 1)\n break\n case 'Enter':\n case ' ':\n if (isBranch(row.kind)) toggle(row.path)\n onActivate?.(row)\n break\n default:\n return\n }\n // Only for a key this component handled: swallowing every keystroke would\n // take Tab and the browser's own shortcuts with it.\n event.preventDefault()\n }\n\n return (\n <div\n role=\"tree\"\n aria-label={label}\n // The one tab stop. The arrows move a cursor inside it - the arrangement\n // a radio group has, and for the same reason.\n tabIndex={0}\n onKeyDown={onKeyDown}\n className={cn(\n 'overflow-auto rounded-md border border-line bg-soft py-1 font-mono text-xs leading-relaxed',\n // A desktop shell turns selection off; this is data someone came to\n // take away.\n 'select-text',\n 'focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent',\n className,\n )}\n >\n {rows.map((row) => {\n const branch = isBranch(row.kind)\n const expanded = branch ? open.has(row.path) : undefined\n\n return (\n <div\n key={row.path}\n role=\"treeitem\"\n aria-level={row.depth + 1}\n aria-expanded={expanded}\n aria-selected={row.path === cursor}\n onClick={() => {\n setCursor(row.path)\n if (branch) toggle(row.path)\n onActivate?.(row)\n }}\n className={cn(\n 'flex cursor-default items-baseline gap-1.5 px-2 py-px',\n 'hover:bg-softer',\n row.path === cursor && 'bg-accent-soft',\n )}\n // Indentation as padding rather than nested elements: a row four\n // levels down is still a sibling of every other row, which is what\n // lets the whole list be windowed.\n style={{ paddingLeft: `${row.depth * 0.9 + 0.5}rem` }}\n >\n {/* The twisty. A fixed-width slot even on a leaf, so the keys of a\n * branch and a leaf at the same level line up - without it the\n * eye reads the indentation wrong. */}\n <span className={cn('w-2 shrink-0 text-faint', !branch && 'invisible')} aria-hidden>\n {expanded === true ? '▾' : '▸'}\n </span>\n\n {row.key !== null && (\n <>\n <span className={row.index ? 'text-faint tabular-nums' : 'text-syntax-name'}>\n {row.index ? row.key : `\"${row.key}\"`}\n </span>\n <span className=\"text-syntax-punctuation\" aria-hidden>\n :\n </span>\n </>\n )}\n\n {branch ? (\n /* A closed branch says how many it holds; an open one says it\n * too, because the count is still the fastest answer to \"how big\n * is this\" once the reader has scrolled past the first entries. */\n <span className=\"text-faint\">{summarise(row)}</span>\n ) : (\n <Leaf row={row} />\n )}\n </div>\n )\n })}\n </div>\n )\n}\n\n/*\n * A value, drawn as what it is.\n *\n * Quotes on a string are not decoration: `\"1\"` and `1` are different values,\n * and a viewer that draws them alike hides the commonest bug in any JSON\n * payload - a number that arrived as a string. Colour says the same thing\n * faster for those who see it; the quotes say it to everyone.\n */\nfunction Leaf({ row }: { row: JsonRow }) {\n if (row.kind === 'string') {\n return (\n <span className=\"min-w-0 break-all text-syntax-string\">{`\"${String(row.value)}\"`}</span>\n )\n }\n if (row.kind === 'number') {\n return <span className=\"text-syntax-number tabular-nums\">{String(row.value)}</span>\n }\n if (row.kind === 'boolean') {\n return <span className=\"text-syntax-keyword\">{String(row.value)}</span>\n }\n // `null` in the same colour as a comment: present, and nothing there. Drawn\n // as the word rather than as an empty cell, which would read as a key with\n // no value at all.\n return <span className=\"text-syntax-comment\">null</span>\n}\n"
986
+ }
987
+ ]
988
+ },
783
989
  {
784
990
  "name": "kbd",
785
991
  "type": "registry:ui",
786
992
  "title": "Kbd",
787
993
  "description": "A key, as printed in a menu or a hint: `Ctrl` `K`. It is a `<kbd>` element because that is what the element is for - a screen reader announces it as keyboard input rather than reading a stray capital letter.",
788
994
  "dependencies": [
789
- "dowel-ui@^0.23.0"
995
+ "dowel-ui@^0.25.0"
790
996
  ],
791
997
  "registryDependencies": [],
792
998
  "files": [
@@ -805,7 +1011,7 @@
805
1011
  "description": "The shape every product builds out of two `<div>`s in a flex row, and the reason it is worth having once: it is a `<dl>`, and the pairing is what a screen reader announces. Two divs read as four unrelated pieces of text - \"Created\", \"2 hours ago\", \"Owner\", \"Ines\" - and nothing says which value belongs to which name. The right element says it for free.",
806
1012
  "dependencies": [
807
1013
  "class-variance-authority",
808
- "dowel-ui@^0.23.0"
1014
+ "dowel-ui@^0.25.0"
809
1015
  ],
810
1016
  "registryDependencies": [],
811
1017
  "files": [
@@ -817,6 +1023,43 @@
817
1023
  }
818
1024
  ]
819
1025
  },
1026
+ {
1027
+ "name": "line-chart",
1028
+ "type": "registry:ui",
1029
+ "title": "Line-chart",
1030
+ "description": "The distinction against its neighbours is the data's, not the drawing's. A column says each period is its own sum - hours worked in a week, and there is no Wednesday-afternoon figure between two weeks. A line says the value existed the whole time and was sampled: an account balance, a price, a temperature. Drawing a sum as a line claims readings nobody took; drawing a level as columns throws away the thing being watched.",
1031
+ "dependencies": [
1032
+ "class-variance-authority",
1033
+ "dowel-ui@^0.25.0"
1034
+ ],
1035
+ "registryDependencies": [
1036
+ "https://lacodda.github.io/dowel/r/line-scale.json"
1037
+ ],
1038
+ "files": [
1039
+ {
1040
+ "path": "ui/line-chart.tsx",
1041
+ "target": "@ui/line-chart.tsx",
1042
+ "type": "registry:ui",
1043
+ "content": "import type { HTMLAttributes, ReactNode } from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from 'dowel-ui'\nimport { boundsOf, pathOf, runs, ticksFor, yOf, type Bounds, type Point } from './line-scale'\n\n/*\n * A quantity over time, where it continues between the readings.\n *\n * The distinction against its neighbours is the data's, not the drawing's. A\n * column says each period is its own sum - hours worked in a week, and there\n * is no Wednesday-afternoon figure between two weeks. A line says the value\n * existed the whole time and was sampled: an account balance, a price, a\n * temperature. Drawing a sum as a line claims readings nobody took; drawing a\n * level as columns throws away the thing being watched.\n *\n * Sparkline is the same shape with the axes taken away, for beside a figure.\n * This one has them, because a balance without a scale is a squiggle.\n *\n * **A hole breaks the line.** Interpolating across invents a reading; closing\n * the gap up moves every later point and makes the axis lie about when things\n * happened. Both are quieter than the truth, which is why the truth has to be\n * drawn deliberately.\n *\n * **The floor is not zero unless the caller says so**, and that is a departure\n * from BarChart on purpose. A bar's length is the quantity, so its baseline\n * has to be zero. A line's subject is change, and a balance between 4,900 and\n * 5,100 on a zero-based axis is a flat rule. The ticks are what keep this\n * honest: they say where the bottom is.\n *\n * The plot owns its height in pixels, for the reason BarChart does - a\n * percentage against a parent with no height of its own resolves to zero, and\n * the chart disappears without failing.\n */\n\nexport const lineChartVariants = cva('relative w-full', {\n variants: {\n size: {\n sm: '[--plot:96px]',\n md: '[--plot:160px]',\n },\n /* Room on the right for the tick labels. Drawn inside the plot they sit on\n * top of whatever the line is doing there - found by looking, with `$5,200`\n * crossed out by its own series. A gutter costs a little width and cannot\n * collide. */\n gutter: {\n true: 'pr-12',\n false: '',\n },\n },\n defaultVariants: { size: 'md', gutter: true },\n})\n\nexport const lineVariants = cva('fill-none', {\n variants: {\n tone: {\n accent: 'stroke-accent',\n series: 'stroke-series-1',\n good: 'stroke-good',\n bad: 'stroke-bad',\n muted: 'stroke-dim',\n },\n },\n defaultVariants: { tone: 'accent' },\n})\n\nexport interface LineChartProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'children'>,\n VariantProps<typeof lineChartVariants>,\n VariantProps<typeof lineVariants> {\n /** The readings, in order. `value: null` is a measurement not taken. */\n points: Point[]\n /** Override any edge of the plot. `min: 0` for a count, where zero is the\n * truth rather than a flattening. */\n bounds?: Partial<Bounds>\n /** What the chart as a whole says, for a reader who cannot see it. */\n label: string\n /** How many value ticks to aim for. They land on round numbers, so the count\n * is a wish rather than a promise. `0` draws none. */\n ticks?: number\n /** Turns a tick into its label. Without it the number is drawn as it is -\n * which is right for a count and wrong for money or a duration. */\n formatTick?: (value: number) => string\n /** The labels under the axis - usually the first and last reading. Two or\n * three, not one per point: the axis is not a place for a list. */\n footer?: ReactNode\n}\n\nexport function LineChart({\n points,\n bounds: stated,\n label,\n ticks = 4,\n formatTick,\n footer,\n tone,\n size,\n className,\n ...props\n}: LineChartProps) {\n const bounds = boundsOf(points, stated)\n\n /* Nothing measured is not a chart of zeroes: an empty plot with its axis is\n * the honest drawing, and the caller says so in words beside it. */\n if (bounds === null) {\n return (\n <div\n className={cn(lineChartVariants({ size, gutter: false }), className)}\n role=\"img\"\n aria-label={label}\n {...props}\n >\n <div className=\"h-[var(--plot)] w-full border-b border-chart-axis\" />\n </div>\n )\n }\n\n const drawn = runs(points, bounds)\n const rules = ticks > 0 ? ticksFor(bounds, ticks) : []\n\n return (\n <div\n className={cn(lineChartVariants({ size, gutter: rules.length > 0 }), className)}\n role=\"img\"\n aria-label={label}\n {...props}\n >\n <div className=\"relative h-[var(--plot)] w-full border-b border-chart-axis\">\n {rules.map((tick) => {\n const y = yOf(tick, bounds)\n if (y === null) return null\n return (\n <div key={tick} className=\"pointer-events-none absolute inset-x-0\" style={{ top: `${y}%` }}>\n {/* Solid hairline: a dashed rule reads as a threshold or a\n * projection, and this is neither. */}\n <div className=\"h-px w-full bg-chart-grid\" />\n {/* Outside the plot, in the gutter the variant reserves: a label\n * drawn over the series is a label crossed out by it. */}\n <span className=\"absolute -top-1.5 left-full pl-1.5 text-[10px] leading-none text-faint tabular-nums\">\n {formatTick ? formatTick(tick) : tick}\n </span>\n </div>\n )\n })}\n\n {/* `preserveAspectRatio=\"none\"` is what lets the plot be a box of the\n * caller's shape while the maths stays in percentages: x and y scale\n * independently, which would bend a shape but cannot bend a line\n * whose every segment is straight. The stroke is drawn in absolute\n * units so it does not stretch with the box. */}\n <svg\n viewBox=\"0 0 100 100\"\n preserveAspectRatio=\"none\"\n className=\"absolute inset-0 h-full w-full overflow-visible\"\n aria-hidden\n >\n {drawn.map((run) => (\n <path\n key={run[0]!.at}\n d={pathOf(run)}\n vectorEffect=\"non-scaling-stroke\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={cn(lineVariants({ tone }))}\n />\n ))}\n </svg>\n </div>\n\n {footer !== undefined && (\n <div className=\"mt-1 flex justify-between text-[10px] text-faint tabular-nums\">{footer}</div>\n )}\n </div>\n )\n}\n"
1044
+ }
1045
+ ]
1046
+ },
1047
+ {
1048
+ "name": "line-scale",
1049
+ "type": "registry:ui",
1050
+ "title": "Line-scale",
1051
+ "description": "Split out like `track-segments` and `activity-weeks`: a product labelling its own points, or checking its own domain sums, should not import a component to get at the numbers.",
1052
+ "dependencies": [],
1053
+ "registryDependencies": [],
1054
+ "files": [
1055
+ {
1056
+ "path": "ui/line-scale.tsx",
1057
+ "target": "@ui/line-scale.tsx",
1058
+ "type": "registry:ui",
1059
+ "content": "/*\n * The arithmetic behind LineChart, with no React in it.\n *\n * Split out like `track-segments` and `activity-weeks`: a product labelling\n * its own points, or checking its own domain sums, should not import a\n * component to get at the numbers.\n *\n * Two things live here and neither is obvious. Turning a series with holes in\n * it into drawable runs, and choosing the ticks on an axis - which is a\n * question about what reads as a round number, not about dividing a range into\n * equal parts.\n */\n\n/** One reading. `value: null` is a measurement that was not taken - which is\n * not a reading of zero, and not a reason to move the ones after it. */\nexport interface Point {\n /** Position along the axis. Same units throughout: a timestamp, an index. */\n at: number\n value: number | null\n}\n\nexport interface Bounds {\n /** The value the left edge stands for. */\n from: number\n /** The right edge. */\n to: number\n /** The bottom of the plot. */\n min: number\n /** The top. */\n max: number\n}\n\n/** A point placed in the box, in percentages: x from the left, y from the top\n * (SVG's own direction, so a larger value has a smaller y). */\nexport interface Placed {\n x: number\n y: number\n at: number\n value: number\n}\n\n/**\n * The bounds a series is drawn against.\n *\n * The y range does NOT start at zero by default, and that is a deliberate\n * departure from the bar's rule. A bar's length *is* the quantity, so its\n * baseline has to be zero or the length lies. A line's job is the shape of a\n * change, and a balance moving between 4,900 and 5,100 flattens into a\n * horizontal rule on a zero-based axis - the very thing the reader opened the\n * chart to see. What keeps it honest is that the axis is labelled: the ticks\n * say where the bottom is, so nobody reads the floor as nothing.\n *\n * A caller who wants zero states it, and for a quantity that is a count rather\n * than a level - requests, errors - they should.\n */\nexport function boundsOf(points: Point[], stated: Partial<Bounds> = {}): Bounds | null {\n const drawn = points.filter((point): point is Point & { value: number } => point.value !== null)\n if (drawn.length === 0) return null\n\n const values = drawn.map((point) => point.value)\n const positions = points.map((point) => point.at)\n\n const from = stated.from ?? Math.min(...positions)\n const to = stated.to ?? Math.max(...positions)\n\n let min = stated.min ?? Math.min(...values)\n let max = stated.max ?? Math.max(...values)\n\n /* A flat series has no range to scale against, and dividing by it would put\n * every point at the same y - or at NaN. Given a band around the value, the\n * line sits in the middle of the plot and reads as what it is: unchanging. */\n if (!(max > min)) {\n const pad = Math.abs(max) > 0 ? Math.abs(max) * 0.1 : 1\n min = max - pad\n max = max + pad\n }\n\n return { from, to, min, max }\n}\n\n/**\n * The series as runs of consecutive readings.\n *\n * A hole breaks the line rather than being drawn through or closed up, and the\n * three options are worth naming because two of them lie:\n *\n * **Interpolating across** invents a reading nobody took - the one thing a\n * chart of measurements must never do.\n *\n * **Dropping the point** keeps the line whole and moves every later reading\n * to the left, so the axis stops matching the data: a chart that says the\n * value was 40 in March when it was 40 in April.\n *\n * **Breaking the line** leaves the gap visible, keeps every other point\n * where it belongs, and invents nothing. So that is what happens here.\n *\n * A run of one point is kept: it has no line, but it has a dot, and dropping\n * it would hide a reading that exists.\n */\nexport function runs(points: Point[], bounds: Bounds): Placed[][] {\n const span = bounds.to - bounds.from\n const height = bounds.max - bounds.min\n if (!(span > 0) || !(height > 0)) return []\n\n const out: Placed[][] = []\n let run: Placed[] = []\n\n for (const point of points) {\n if (point.value === null) {\n if (run.length > 0) out.push(run)\n run = []\n continue\n }\n\n const clamped = Math.min(Math.max(point.value, bounds.min), bounds.max)\n run.push({\n x: ((point.at - bounds.from) / span) * 100,\n // SVG's y grows downward, so the largest value sits at the top.\n y: ((bounds.max - clamped) / height) * 100,\n at: point.at,\n value: point.value,\n })\n }\n\n if (run.length > 0) out.push(run)\n return out\n}\n\n/** A run as an SVG path, in the same percentages.\n *\n * Straight segments rather than a curve: a spline through measured points\n * overshoots between them, inventing highs and lows that were never recorded -\n * the same lie as interpolating across a gap, drawn more prettily. */\nexport function pathOf(run: Placed[]): string {\n return run\n .map((point, index) => `${index === 0 ? 'M' : 'L'}${point.x.toFixed(2)} ${point.y.toFixed(2)}`)\n .join(' ')\n}\n\n/**\n * Ticks for the value axis, on round numbers.\n *\n * Not the range cut into equal parts: 4,900 to 5,100 in four gives 4,950 and\n * 5,050, which nobody reads as a landmark. A tick's job is to be recognised\n * instantly, so the step is the nearest 1, 2, 5 or 10 above what the range\n * needs, and the ticks are the multiples of it inside the range.\n *\n * Returns nothing when a step would not fit - a range too narrow for a round\n * number is better with no ticks than with invented ones.\n */\nexport function ticksFor(bounds: Bounds, wanted = 4): number[] {\n const height = bounds.max - bounds.min\n if (!(height > 0) || wanted < 1) return []\n\n const rough = height / wanted\n const magnitude = 10 ** Math.floor(Math.log10(rough))\n const step = [1, 2, 5, 10].map((n) => n * magnitude).find((candidate) => candidate >= rough)\n if (step === undefined) return []\n\n const ticks: number[] = []\n for (let tick = Math.ceil(bounds.min / step) * step; tick <= bounds.max; tick += step) {\n // Floating point leaves 0.30000000000000004 where 0.3 was meant; the step\n // is what decides how many decimals are real.\n const decimals = Math.max(0, -Math.floor(Math.log10(step)))\n ticks.push(Number(tick.toFixed(decimals)))\n }\n\n return ticks\n}\n\n/** Where a value sits in the plot, as a percentage from the top - for a tick's\n * rule, or a threshold drawn across the line. */\nexport function yOf(value: number, bounds: Bounds): number | null {\n const height = bounds.max - bounds.min\n if (!(height > 0)) return null\n if (value < bounds.min || value > bounds.max) return null\n return ((bounds.max - value) / height) * 100\n}\n"
1060
+ }
1061
+ ]
1062
+ },
820
1063
  {
821
1064
  "name": "menu",
822
1065
  "type": "registry:ui",
@@ -825,7 +1068,7 @@
825
1068
  "dependencies": [
826
1069
  "@base-ui/react",
827
1070
  "class-variance-authority",
828
- "dowel-ui@^0.23.0"
1071
+ "dowel-ui@^0.25.0"
829
1072
  ],
830
1073
  "registryDependencies": [],
831
1074
  "files": [
@@ -844,7 +1087,7 @@
844
1087
  "description": "A number typed into a text input is a string that happens to look like a number, and every product then writes the same four fixes: strip the letters, clamp to a range, round to a step, and decide what an empty box means. This is those four, once, plus the stepper - because a value with a small range is faster nudged than typed.",
845
1088
  "dependencies": [
846
1089
  "@base-ui/react",
847
- "dowel-ui@^0.23.0"
1090
+ "dowel-ui@^0.25.0"
848
1091
  ],
849
1092
  "registryDependencies": [
850
1093
  "https://lacodda.github.io/dowel/r/input.json"
@@ -864,7 +1107,7 @@
864
1107
  "title": "Number-format",
865
1108
  "description": "Two things, and the second is the reason this is a component rather than a call to `toLocaleString` at each site.",
866
1109
  "dependencies": [
867
- "dowel-ui@^0.23.0"
1110
+ "dowel-ui@^0.25.0"
868
1111
  ],
869
1112
  "registryDependencies": [],
870
1113
  "files": [
@@ -882,7 +1125,7 @@
882
1125
  "title": "Page-size",
883
1126
  "description": "Its own file rather than a part of `Pagination`, because the two are needed apart often enough: a list that scrolls for ever wants \"how many to load at a time\" and no page buttons, and a table with a fixed page size wants the buttons and no choice. Together they were also over the size gate, which asked the right question.",
884
1127
  "dependencies": [
885
- "dowel-ui@^0.23.0"
1128
+ "dowel-ui@^0.25.0"
886
1129
  ],
887
1130
  "registryDependencies": [
888
1131
  "https://lacodda.github.io/dowel/r/select.json"
@@ -902,7 +1145,7 @@
902
1145
  "title": "Pagination",
903
1146
  "description": "The arithmetic is exported separately from the component for the same reason `table-sort` is a file of its own: a product that pages on the server needs the page numbers and not the buttons, and computing them a second time in a different place is how the two disagree about where the last page ends.",
904
1147
  "dependencies": [
905
- "dowel-ui@^0.23.0"
1148
+ "dowel-ui@^0.25.0"
906
1149
  ],
907
1150
  "registryDependencies": [
908
1151
  "https://lacodda.github.io/dowel/r/button.json"
@@ -923,7 +1166,7 @@
923
1166
  "description": "The raised surface everything else sits on. It is the one place a screen gets its structure from, so it stays deliberately plain: a ground, a hairline, a corner.",
924
1167
  "dependencies": [
925
1168
  "class-variance-authority",
926
- "dowel-ui@^0.23.0"
1169
+ "dowel-ui@^0.25.0"
927
1170
  ],
928
1171
  "registryDependencies": [],
929
1172
  "files": [
@@ -941,7 +1184,7 @@
941
1184
  "title": "Password-field",
942
1185
  "description": "The reveal is the whole component, and it is not a convenience. A masked field is the only one in a form where a typo cannot be seen, so people either paste (fine) or type slowly and get it wrong anyway; the toggle is what turns an unverifiable field into a checkable one, and it is why long passphrases became usable at all.",
943
1186
  "dependencies": [
944
- "dowel-ui@^0.23.0"
1187
+ "dowel-ui@^0.25.0"
945
1188
  ],
946
1189
  "registryDependencies": [
947
1190
  "https://lacodda.github.io/dowel/r/input.json"
@@ -963,7 +1206,7 @@
963
1206
  "dependencies": [
964
1207
  "@base-ui/react",
965
1208
  "class-variance-authority",
966
- "dowel-ui@^0.23.0"
1209
+ "dowel-ui@^0.25.0"
967
1210
  ],
968
1211
  "registryDependencies": [],
969
1212
  "files": [
@@ -983,7 +1226,7 @@
983
1226
  "dependencies": [
984
1227
  "@base-ui/react",
985
1228
  "class-variance-authority",
986
- "dowel-ui@^0.23.0"
1229
+ "dowel-ui@^0.25.0"
987
1230
  ],
988
1231
  "registryDependencies": [],
989
1232
  "files": [
@@ -1003,7 +1246,7 @@
1003
1246
  "dependencies": [
1004
1247
  "@base-ui/react",
1005
1248
  "class-variance-authority",
1006
- "dowel-ui@^0.23.0"
1249
+ "dowel-ui@^0.25.0"
1007
1250
  ],
1008
1251
  "registryDependencies": [],
1009
1252
  "files": [
@@ -1042,7 +1285,7 @@
1042
1285
  "dependencies": [
1043
1286
  "@base-ui/react",
1044
1287
  "class-variance-authority",
1045
- "dowel-ui@^0.23.0"
1288
+ "dowel-ui@^0.25.0"
1046
1289
  ],
1047
1290
  "registryDependencies": [],
1048
1291
  "files": [
@@ -1060,7 +1303,7 @@
1060
1303
  "title": "Rating-scale",
1061
1304
  "description": "Generalised from kilna, where it is how a work is scored on each of its axes. The shape is a row of marks rather than stars: stars carry a meaning of their own - a review, a public verdict - and this is as often \"how hard was this\" or \"how finished is it\" as it is \"how good\".",
1062
1305
  "dependencies": [
1063
- "dowel-ui@^0.23.0"
1306
+ "dowel-ui@^0.25.0"
1064
1307
  ],
1065
1308
  "registryDependencies": [],
1066
1309
  "files": [
@@ -1078,7 +1321,7 @@
1078
1321
  "title": "Relative-time",
1079
1322
  "description": "The relative-time primitive.",
1080
1323
  "dependencies": [
1081
- "dowel-ui@^0.23.0"
1324
+ "dowel-ui@^0.25.0"
1082
1325
  ],
1083
1326
  "registryDependencies": [],
1084
1327
  "files": [
@@ -1096,7 +1339,7 @@
1096
1339
  "title": "Save-state",
1097
1340
  "description": "The quiet line beside a field that saves itself: \"saving…\", then a tick that fades. It exists because a form without a Save button has to say what it did anyway - otherwise the reader is left guessing whether their edit survived, and the usual answer to that guess is to press Ctrl+S at a page that has no such thing.",
1098
1341
  "dependencies": [
1099
- "dowel-ui@^0.23.0"
1342
+ "dowel-ui@^0.25.0"
1100
1343
  ],
1101
1344
  "registryDependencies": [
1102
1345
  "https://lacodda.github.io/dowel/r/spinner.json"
@@ -1116,7 +1359,7 @@
1116
1359
  "title": "Search-field",
1117
1360
  "description": "An Input that knows it is a search box, which is three small things the products kept not doing:\n * - a magnifier, so the field is recognisable before it is read; - a way to clear it that is not \"select all and delete\" - and one that a keyboard can reach, which a decorative `<span>` cannot; - the shortcut that focuses it, shown in the field rather than learned.",
1118
1361
  "dependencies": [
1119
- "dowel-ui@^0.23.0"
1362
+ "dowel-ui@^0.25.0"
1120
1363
  ],
1121
1364
  "registryDependencies": [
1122
1365
  "https://lacodda.github.io/dowel/r/input.json",
@@ -1140,7 +1383,7 @@
1140
1383
  "dependencies": [
1141
1384
  "@base-ui/react",
1142
1385
  "class-variance-authority",
1143
- "dowel-ui@^0.23.0"
1386
+ "dowel-ui@^0.25.0"
1144
1387
  ],
1145
1388
  "registryDependencies": [
1146
1389
  "https://lacodda.github.io/dowel/r/input.json"
@@ -1176,7 +1419,7 @@
1176
1419
  "title": "Skeleton",
1177
1420
  "description": "The rule the component is built on, and the reason it takes a shape rather than filling the space:\n * **A skeleton of the wrong shape is worse than no skeleton.**\n * It promises something the content does not keep, and the promise is paid for in a jump: the page settles, the scrollbar appears, and whatever the reader was about to click has moved. Measured rather than assumed - the line's own calendar showed a list of four short lines where a six-row month grid was about to land, and the skeleton was itself the jump it existed to prevent.",
1178
1421
  "dependencies": [
1179
- "dowel-ui@^0.23.0"
1422
+ "dowel-ui@^0.25.0"
1180
1423
  ],
1181
1424
  "registryDependencies": [],
1182
1425
  "files": [
@@ -1195,7 +1438,7 @@
1195
1438
  "description": "The case for it over a NumberField is that the number does not matter much: a volume, an opacity, a weight in a search filter. Where the exact figure does matter, a slider is a worse field with more pixels - it cannot be typed into, it cannot be pasted into, and it has no state for \"empty\".",
1196
1439
  "dependencies": [
1197
1440
  "@base-ui/react",
1198
- "dowel-ui@^0.23.0"
1441
+ "dowel-ui@^0.25.0"
1199
1442
  ],
1200
1443
  "registryDependencies": [],
1201
1444
  "files": [
@@ -1207,6 +1450,25 @@
1207
1450
  }
1208
1451
  ]
1209
1452
  },
1453
+ {
1454
+ "name": "sparkline",
1455
+ "type": "registry:ui",
1456
+ "title": "Sparkline",
1457
+ "description": "The shape of a history, not a chart of it: no axes, no gridlines, no ticks.",
1458
+ "dependencies": [
1459
+ "class-variance-authority",
1460
+ "dowel-ui@^0.25.0"
1461
+ ],
1462
+ "registryDependencies": [],
1463
+ "files": [
1464
+ {
1465
+ "path": "ui/sparkline.tsx",
1466
+ "target": "@ui/sparkline.tsx",
1467
+ "type": "registry:ui",
1468
+ "content": "import type { SVGAttributes } from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from 'dowel-ui'\n\n/*\n * A line small enough to sit beside the number it belongs to.\n *\n * The shape of a history, not a chart of it: no axes, no gridlines, no ticks.\n * \"61 → 74 → 82\" reads perfectly at three points and stops working at ten; a\n * line holds both, and the exact figures stay in the list underneath.\n *\n * Three things here are not free choices.\n *\n * **The box is drawn at the size it is shown at.** A `viewBox` wider than the\n * element scales x and y by different factors: the line bends away from the\n * data and the end dot stretches into a wedge. So the size is a variant rather\n * than a `className`, and each variant states the same numbers twice on\n * purpose - once for the geometry, once for the element - from one place. The\n * donor took a `size` object *and* a class, and every call site repeated\n * itself: `size={{ width: 52, height: 16 }} className=\"h-4 w-[52px]\"`.\n *\n * **The scale comes from outside.** `max` is what the axis allows, not what\n * this line happens to reach, so two works can be compared by eye. Normalised\n * to itself, a line that moved 61 → 63 would climb the whole box and read as a\n * transformation.\n *\n * **The line does not judge.** The donor coloured it green when it ended\n * higher and red when it ended lower, which is a claim the component cannot\n * support: for time-to-answer or error rate, down is the good direction. So\n * the line is drawn in the de-emphasis tone and the newest point in the accent\n * - the eye goes to \"where it is now\", and what that means is said in words\n * next to it, usually by a StatTile's delta. `tone` is there for a caller who\n * genuinely knows the direction's meaning.\n *\n * Not interactive, and that is the form rather than an omission: a sparkline\n * has no room for a hover target that is not the whole of it. A reader who\n * needs the exact figures gets them from the table beside it.\n */\n\nconst GEOMETRY = {\n sm: { width: 52, height: 16, dot: 1.75, stroke: 1.25 },\n md: { width: 120, height: 28, dot: 2.5, stroke: 1.5 },\n} as const\n\nexport type SparklineSize = keyof typeof GEOMETRY\n\nexport const sparklineVariants = cva('shrink-0 overflow-visible', {\n variants: {\n size: {\n /* Beside a figure in a row - an axis of a rubric, a cell in a table. */\n sm: 'h-4 w-[52px]',\n /* Beside a total, where the shape is meant to be read rather than\n * glanced at. */\n md: 'h-7 w-[120px]',\n },\n },\n defaultVariants: { size: 'md' },\n})\n\nexport const sparklineLineVariants = cva('fill-none', {\n variants: {\n tone: {\n /* The default, and the one a caller should almost always leave alone:\n * the line is context for the number beside it. */\n muted: 'stroke-dim',\n /* For a line that IS the subject - one chart on a page, nothing else to\n * defer to. */\n accent: 'stroke-accent',\n /* Only where the caller knows what the direction means. A component\n * cannot: for time-to-answer, down is the good news. */\n good: 'stroke-good',\n bad: 'stroke-bad',\n },\n },\n defaultVariants: { tone: 'muted' },\n})\n\nexport const sparklineDotVariants = cva('', {\n variants: {\n tone: {\n /* The newest point carries the accent even under the muted line: it is\n * the one the eye is looking for, and one dot of colour is enough to\n * find it without the line making a claim. */\n muted: 'fill-accent',\n accent: 'fill-accent',\n good: 'fill-good',\n bad: 'fill-bad',\n },\n },\n defaultVariants: { tone: 'muted' },\n})\n\n/** Breathing room, so the stroke and the end dot are not clipped by the box. */\nconst PAD = 3\n\nexport interface SparklineProps\n extends Omit<SVGAttributes<SVGSVGElement>, 'values'>,\n VariantProps<typeof sparklineLineVariants> {\n /** Oldest first. Fewer than two points is not a line, and draws nothing. */\n values: number[]\n /** The top of the scale, so two lines can be compared by eye. Defaults to\n * the highest value present, which makes the line self-scaled - fine for one\n * line alone, wrong for a column of them. */\n max?: number\n /** What the line says, for a reader who cannot see it. Required: an unlabelled\n * `img` is an unlabelled image, and this one carries information. */\n label: string\n size?: SparklineSize\n}\n\nexport function Sparkline({ values, max, label, size, tone, className, ...props }: SparklineProps) {\n // One point is a dot with no direction and no point; zero is nothing at all.\n if (values.length < 2) return null\n\n /* The default lives in `sparklineVariants` like every other variant in the\n * library; this resolves the same word for the geometry, so the numbers and\n * the classes cannot disagree about which size is being drawn. */\n const { width, height, dot, stroke } = GEOMETRY[size ?? 'md']\n\n /* The ceiling never sits below the data: a value above `max` would otherwise\n * be drawn outside the box. Clamped rather than rejected, because a score\n * that overshoots its stated scale is the caller's problem to notice, not a\n * reason to draw nothing. */\n const top = Math.max(...values, max ?? 0)\n /* A flat line at zero, or a flat line anywhere with no stated scale, would\n * divide by zero. It is drawn along the bottom, which is where it belongs. */\n const span = width - PAD * 2\n const rise = height - PAD * 2\n\n const points = values.map((value, index) => {\n const x = PAD + (span * index) / (values.length - 1)\n // SVG's y grows downward, so a larger value has to sit higher up.\n const y = top === 0 ? PAD + rise : PAD + rise - (rise * value) / top\n return [x, y] as const\n })\n\n const path = points\n .map(([x, y], index) => `${index === 0 ? 'M' : 'L'}${x.toFixed(1)} ${y.toFixed(1)}`)\n .join(' ')\n const [lastX, lastY] = points.at(-1)!\n\n return (\n <svg\n viewBox={`0 0 ${width} ${height}`}\n className={cn(sparklineVariants({ size }), className)}\n role=\"img\"\n aria-label={label}\n {...props}\n >\n <path\n d={path}\n strokeWidth={stroke}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={cn(sparklineLineVariants({ tone }))}\n />\n <circle cx={lastX} cy={lastY} r={dot} className={cn(sparklineDotVariants({ tone }))} />\n </svg>\n )\n}\n"
1469
+ }
1470
+ ]
1471
+ },
1210
1472
  {
1211
1473
  "name": "spinner",
1212
1474
  "type": "registry:ui",
@@ -1214,7 +1476,7 @@
1214
1476
  "description": "Something is happening and the answer has not arrived. It carries no text of its own - what is loading is the product's word, not the system's - but it does have to say *something* to a screen reader, or a page that is busy is silently identical to a page that is empty.",
1215
1477
  "dependencies": [
1216
1478
  "class-variance-authority",
1217
- "dowel-ui@^0.23.0"
1479
+ "dowel-ui@^0.25.0"
1218
1480
  ],
1219
1481
  "registryDependencies": [],
1220
1482
  "files": [
@@ -1226,6 +1488,25 @@
1226
1488
  }
1227
1489
  ]
1228
1490
  },
1491
+ {
1492
+ "name": "stat-tile",
1493
+ "type": "registry:ui",
1494
+ "title": "Stat-tile",
1495
+ "description": "The smallest thing on a dashboard and the one every product writes itself: a label above, a number below, sometimes a word about which way it moved.",
1496
+ "dependencies": [
1497
+ "class-variance-authority",
1498
+ "dowel-ui@^0.25.0"
1499
+ ],
1500
+ "registryDependencies": [],
1501
+ "files": [
1502
+ {
1503
+ "path": "ui/stat-tile.tsx",
1504
+ "target": "@ui/stat-tile.tsx",
1505
+ "type": "registry:ui",
1506
+ "content": "import type { HTMLAttributes, ReactNode } from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from 'dowel-ui'\n\n/*\n * One figure, and what it is a figure of.\n *\n * The smallest thing on a dashboard and the one every product writes itself:\n * a label above, a number below, sometimes a word about which way it moved.\n * It is here because the first consumer had written it twice - once on the\n * personal page, once on the team one - and the copies had already drifted:\n * one had grown a warning tone the other lacked, and the tone classes in it\n * were concatenated without a space, so a figure that was both accented and\n * warning would have emitted `text-accent-2text-warn` and been styled by\n * neither. Nothing had gone wrong on screen yet; the two flags were simply\n * never passed together.\n *\n * A `<dl>` rather than two divs, for the reason KeyValue is one: the pairing\n * is what a screen reader announces. Loose divs read as two unrelated pieces\n * of text and nothing says the number belongs to the label.\n *\n * Numbers are set in the mono face with tabular figures, so a column of tiles\n * lines up and a value that ticks does not shuffle its neighbours sideways.\n * That matters more than it sounds: a live figure redrawn every few seconds in\n * proportional digits makes the whole row twitch.\n *\n * The delta is a second, quieter line rather than a colour on the value. A\n * number that turns red is a number whose colour has to be explained, and the\n * explanation is never on the screen; a delta says \"+12% vs last week\" and\n * needs nothing. Its tone is stated by the caller rather than inferred from\n * the sign, because down is good for a figure like \"time to first response\",\n * and a component cannot know which figure it is holding.\n */\n\nexport const statTileVariants = cva('min-w-0', {\n variants: {\n size: {\n /* The dashboard default: a row of these under a heading. */\n md: '',\n /* For a tile that leads a page rather than sitting in a row of six. */\n lg: '',\n },\n },\n defaultVariants: { size: 'md' },\n})\n\nexport const statTileValueVariants = cva('mt-1 font-mono tabular-nums', {\n variants: {\n size: {\n md: 'text-lg',\n lg: 'text-2xl',\n },\n tone: {\n /* The reading tone: what this figure is, not how it is doing. `accent`\n * marks the one figure a panel is really about; `warn` and `bad` are for\n * a figure that is itself a problem - people with no agent reporting,\n * a queue that is backing up. */\n default: 'text-text',\n accent: 'text-accent-2',\n warn: 'text-warn',\n bad: 'text-bad',\n },\n },\n defaultVariants: { size: 'md', tone: 'default' },\n})\n\nexport const statTileDeltaVariants = cva('mt-1 text-xs', {\n variants: {\n tone: {\n /* Neutral by default, because most movement is just movement. */\n default: 'text-dim',\n good: 'text-good',\n bad: 'text-bad',\n },\n },\n defaultVariants: { tone: 'default' },\n})\n\nexport interface StatTileProps\n extends Omit<HTMLAttributes<HTMLDListElement>, 'title'>,\n VariantProps<typeof statTileVariants> {\n /** What the figure is. */\n label: ReactNode\n /** The figure. Already formatted - a duration, a count, a percentage: this\n * component decides how a number looks, never what it says. */\n value: ReactNode\n /** How the value itself reads. */\n tone?: NonNullable<VariantProps<typeof statTileValueVariants>['tone']>\n /** Which way it moved, in words the caller chooses: `+12% vs last week`,\n * `3 fewer than yesterday`. Omitted when there is nothing to compare to -\n * an empty line here reads as \"unchanged\", which is a claim. */\n delta?: ReactNode\n /** Whether that movement is good news. Stated rather than read off the sign,\n * because for a figure like time-to-answer a fall is the good direction. */\n deltaTone?: NonNullable<VariantProps<typeof statTileDeltaVariants>['tone']>\n}\n\nexport function StatTile({\n label,\n value,\n tone,\n delta,\n deltaTone,\n size,\n className,\n ...props\n}: StatTileProps) {\n return (\n <dl className={cn(statTileVariants({ size }), className)} {...props}>\n <dt className=\"text-xs font-medium text-dim\">{label}</dt>\n <dd className={cn(statTileValueVariants({ size, tone }))}>{value}</dd>\n {/* A second `dd` for the same term: the spec allows several, and this is\n * what they are for - one fact with two parts. A `<div>` here would end\n * the description list's pairing, and the delta would be read as loose\n * text next to the number rather than as part of it. */}\n {delta !== undefined && delta !== null && (\n <dd className={cn(statTileDeltaVariants({ tone: deltaTone }))}>{delta}</dd>\n )}\n </dl>\n )\n}\n\n/*\n * A row of tiles.\n *\n * Both donors wrote the identical container - `flex flex-wrap items-baseline\n * gap-x-8 gap-y-3` inside a Panel - and both had to get `items-baseline`\n * right, which is the part that is easy to miss: without it, a tile carrying a\n * delta is taller than its neighbours and the whole row's numbers stop sharing\n * a line.\n *\n * Wrapping rather than a grid, because the number of figures is decided at\n * runtime (one donor hides two of its five until there is something to say),\n * and a grid with a fixed column count leaves a hole where a hidden tile was.\n */\nexport type StatRowProps = HTMLAttributes<HTMLDivElement>\n\nexport function StatRow({ className, ...props }: StatRowProps) {\n return <div className={cn('flex flex-wrap items-baseline gap-x-8 gap-y-3', className)} {...props} />\n}\n"
1507
+ }
1508
+ ]
1509
+ },
1229
1510
  {
1230
1511
  "name": "switch",
1231
1512
  "type": "registry:ui",
@@ -1233,7 +1514,7 @@
1233
1514
  "description": "The difference from Checkbox is not how it looks, and getting it wrong is the commonest mistake in the pair. A checkbox is an answer collected now and submitted later, with the rest of the form; a switch is a setting that applies the moment it moves. Put a switch in a form with a Save button and the reader cannot tell whether anything happened - they flipped it, and nothing said so.",
1234
1515
  "dependencies": [
1235
1516
  "@base-ui/react",
1236
- "dowel-ui@^0.23.0"
1517
+ "dowel-ui@^0.25.0"
1237
1518
  ],
1238
1519
  "registryDependencies": [],
1239
1520
  "files": [
@@ -1268,7 +1549,7 @@
1268
1549
  "description": "Parts rather than a `columns` prop, and that is the decision worth stating: a `<DataTable columns={…} rows={…} />` is quicker to write for the first table and then owns every cell in the product forever. The moment one column needs a Badge, another a link, and a third the row's own menu, the prop grows a `render` for each - at which point it is JSX with extra steps, spelt in a shape only this component understands.",
1269
1550
  "dependencies": [
1270
1551
  "class-variance-authority",
1271
- "dowel-ui@^0.23.0"
1552
+ "dowel-ui@^0.25.0"
1272
1553
  ],
1273
1554
  "registryDependencies": [
1274
1555
  "https://lacodda.github.io/dowel/r/table-sort.json"
@@ -1289,7 +1570,7 @@
1289
1570
  "description": "Free text turned into a list: type a word, press Enter, it becomes a chip.",
1290
1571
  "dependencies": [
1291
1572
  "class-variance-authority",
1292
- "dowel-ui@^0.23.0"
1573
+ "dowel-ui@^0.25.0"
1293
1574
  ],
1294
1575
  "registryDependencies": [
1295
1576
  "https://lacodda.github.io/dowel/r/chip.json",
@@ -1310,7 +1591,7 @@
1310
1591
  "title": "Textarea",
1311
1592
  "description": "A multi-line field that can grow with what is typed into it, which is the only interesting part: a fixed box makes someone scroll inside a scroll, and a box that grows without limit pushes the button they are trying to reach off the screen. `autoResize` grows it; `maxRows` says when to stop and let it scroll after all.",
1312
1593
  "dependencies": [
1313
- "dowel-ui@^0.23.0"
1594
+ "dowel-ui@^0.25.0"
1314
1595
  ],
1315
1596
  "registryDependencies": [
1316
1597
  "https://lacodda.github.io/dowel/r/input.json"
@@ -1330,7 +1611,7 @@
1330
1611
  "title": "Time-field",
1331
1612
  "description": "No donor for this one: neither product of the line had a time field, so this is written from the same shape as DurationField, and for the same reason. Anything a person plausibly types is accepted - `9`, `9:30`, `930`, `9.30`, `9pm`, `21:30` - and what comes back is always `HH:MM`.",
1332
1613
  "dependencies": [
1333
- "dowel-ui@^0.23.0"
1614
+ "dowel-ui@^0.25.0"
1334
1615
  ],
1335
1616
  "registryDependencies": [
1336
1617
  "https://lacodda.github.io/dowel/r/input.json"
@@ -1352,7 +1633,7 @@
1352
1633
  "dependencies": [
1353
1634
  "@base-ui/react",
1354
1635
  "class-variance-authority",
1355
- "dowel-ui@^0.23.0"
1636
+ "dowel-ui@^0.25.0"
1356
1637
  ],
1357
1638
  "registryDependencies": [],
1358
1639
  "files": [
@@ -1372,7 +1653,7 @@
1372
1653
  "dependencies": [
1373
1654
  "@base-ui/react",
1374
1655
  "class-variance-authority",
1375
- "dowel-ui@^0.23.0"
1656
+ "dowel-ui@^0.25.0"
1376
1657
  ],
1377
1658
  "registryDependencies": [],
1378
1659
  "files": [
@@ -1384,6 +1665,43 @@
1384
1665
  }
1385
1666
  ]
1386
1667
  },
1668
+ {
1669
+ "name": "track-segments",
1670
+ "type": "registry:ui",
1671
+ "title": "Track-segments",
1672
+ "description": "Split out for the reason `table-sort` and `tree-rows` are: a product that needs the numbers - to label a segment, to test its own domain code, to draw the same shape somewhere that is not the DOM - should not import a component to get them.",
1673
+ "dependencies": [],
1674
+ "registryDependencies": [],
1675
+ "files": [
1676
+ {
1677
+ "path": "ui/track-segments.tsx",
1678
+ "target": "@ui/track-segments.tsx",
1679
+ "type": "registry:ui",
1680
+ "content": "/*\n * The arithmetic behind Track, with no React in it.\n *\n * Split out for the reason `table-sort` and `tree-rows` are: a product that\n * needs the numbers - to label a segment, to test its own domain code, to draw\n * the same shape somewhere that is not the DOM - should not import a component\n * to get them.\n *\n * What lives here is only the geometry. Turning a day of work into segments,\n * or a set of tiers into them, is the product's own arithmetic and stays with\n * the product: this knows about spans and percentages and nothing else.\n */\n\n/** A segment as the caller states it, in whatever units the caller counts in. */\nexport interface SegmentInput {\n /** Where it starts. Same units as `end` and as the track's span. */\n start: number\n /** Where it ends. A segment ending before it starts is empty, not backwards. */\n end: number\n}\n\n/** A segment as it is drawn: percentages of the track. */\nexport interface Placed {\n /** Distance from the left edge, 0-100. */\n left: number\n /** Width, 0-100. */\n width: number\n /** Whether the width is the real one, or the floor standing in for it.\n *\n * Worth knowing rather than hiding: a caller labelling segments may want to\n * say \"under a minute\" instead of a duration the bar is no longer drawing to\n * scale. */\n widened: boolean\n}\n\n/** The smallest a segment may be drawn, in percent.\n *\n * A ten-second pause in an eight-hour day is 0.03% of the track, which rounds\n * to no pixels at all: the segment is real, was measured, and would simply not\n * be there. The floor is the width at which a sliver is still visible on a\n * track a few hundred pixels wide. */\nexport const MIN_SEGMENT_WIDTH = 0.6\n\nexport interface PlaceOptions {\n /** The value the left edge stands for. Defaults to the first segment's start. */\n from?: number\n /** The value the right edge stands for. Defaults to the last segment's end. */\n to?: number\n /** Override the floor - `0` to draw every segment exactly to scale. */\n minWidth?: number\n}\n\n/**\n * Lay segments out along a track, as percentages.\n *\n * The scale is stated by `from` and `to` rather than inferred, because the two\n * readings differ and both are wanted: a day of work is read against itself\n * (an eight-hour day drawn across a third of the width wastes the space where\n * the breaks are), while a set of tiers is read against the whole 0-100 scale,\n * where the distance to the next tier is the distance you have to close.\n *\n * Widening a sliver to the floor is what makes this worth having once. It also\n * introduces the only subtlety here: a widened segment can run into the one\n * after it, and two segments drawn overlapping is a worse lie than a segment\n * drawn slightly too wide. So the pass is done in order, and each segment is\n * held back to where the next one starts - a floor is a request, not a\n * guarantee, and the last one may be trimmed by the end of the track.\n */\nexport function place(segments: SegmentInput[], options: PlaceOptions = {}): Placed[] {\n if (segments.length === 0) return []\n\n const from = options.from ?? Math.min(...segments.map((s) => s.start))\n const to = options.to ?? Math.max(...segments.map((s) => s.end))\n const span = to - from\n\n // A track with no span has nothing to scale against: every segment would be\n // at the same place with the same width, which is not a drawing of anything.\n if (!(span > 0)) return []\n\n const floor = options.minWidth ?? MIN_SEGMENT_WIDTH\n\n const raw = segments.map((segment) => {\n const start = Math.min(Math.max(segment.start, from), to)\n const end = Math.min(Math.max(segment.end, start), to)\n return { left: ((start - from) / span) * 100, width: ((end - start) / span) * 100 }\n })\n\n if (floor <= 0) return raw.map((segment) => ({ ...segment, widened: false }))\n\n /*\n * Widening is a layout pass, not a per-segment decision, and the first\n * version of this got it wrong in a way worth recording: it capped each\n * sliver at \"where the next segment starts\", which protects against overlap\n * and also means a segment that touches its neighbour can never grow at all.\n * Both shapes this component exists for are contiguous - work then break\n * then work, one tier after another - so the floor did nothing for either of\n * them, and the tests missed it because their crowded case had a gap.\n *\n * So a widened segment pushes what follows instead. That borrows room the\n * track does not have, and the debt is paid back at the end by the segments\n * wide enough to afford it - never by another sliver, which would undo the\n * widening we just did.\n */\n const widened: Placed[] = []\n let shift = 0\n\n for (const segment of raw) {\n const left = segment.left + shift\n if (segment.width >= floor) {\n widened.push({ left, width: segment.width, widened: false })\n continue\n }\n shift += floor - segment.width\n widened.push({ left, width: floor, widened: true })\n }\n\n if (shift === 0) return widened\n\n /* The debt is only owed if the track has actually overflowed. A sliver on an\n * otherwise empty track - one segment, or several with gaps between them -\n * grows into room nobody was using, and nothing needs to give way. */\n const end = widened.at(-1)!\n const overflow = end.left + end.width - 100\n if (overflow <= 0) return widened\n\n /* Who can pay: everything above the floor, by however much it has to spare.\n * Taken in proportion, so one long stretch is not singled out to absorb the\n * whole debt while its neighbour keeps its exact width. */\n const spare = widened.reduce((sum, s) => sum + (s.widened ? 0 : Math.max(0, s.width - floor)), 0)\n\n /* Nobody can pay: every segment is at or under the floor, and the track is\n * genuinely too crowded to draw honestly at this width. The floor loses -\n * a bar running off its own end is worse than slivers too thin to see. */\n if (spare <= 0) return raw.map((segment) => ({ ...segment, widened: false }))\n\n let paid = 0\n return widened.map((segment) => {\n const left = segment.left - paid\n if (segment.widened) return { ...segment, left }\n\n const contribution = (Math.max(0, segment.width - floor) / spare) * overflow\n paid += contribution\n return { left, width: segment.width - contribution, widened: false }\n })\n}\n\n/** Where a marker sits on the same scale, as a percentage, or `null` when it\n * falls outside the track.\n *\n * Outside rather than clamped: a marker pinned to the edge says \"here, at the\n * very end\", which is a different statement from \"not on this track at all\". */\nexport function markerAt(value: number, from: number, to: number): number | null {\n const span = to - from\n if (!(span > 0)) return null\n if (value < from || value > to) return null\n return ((value - from) / span) * 100\n}\n"
1681
+ }
1682
+ ]
1683
+ },
1684
+ {
1685
+ "name": "track",
1686
+ "type": "registry:ui",
1687
+ "title": "Track",
1688
+ "description": "Two products had written this independently and arrived at the same construction - a rounded track, segments positioned absolutely by percent, a floor under the segment width so a short one does not vanish - differing only in what a segment meant. One drew the tiers of a rubric with the score standing among them; the other drew a working day as alternating work and breaks. Neither could be built from the other, and each knew something the other did not: the tiers had the marker and the three-state reading of a segment (passed, standing in, still ahead), the day had the minimum width and the difference between an empty track and an unknown one.",
1689
+ "dependencies": [
1690
+ "class-variance-authority",
1691
+ "dowel-ui@^0.25.0"
1692
+ ],
1693
+ "registryDependencies": [
1694
+ "https://lacodda.github.io/dowel/r/track-segments.json"
1695
+ ],
1696
+ "files": [
1697
+ {
1698
+ "path": "ui/track.tsx",
1699
+ "target": "@ui/track.tsx",
1700
+ "type": "registry:ui",
1701
+ "content": "import type { HTMLAttributes, ReactNode } from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from 'dowel-ui'\nimport { markerAt, place, type SegmentInput } from './track-segments'\n\n/*\n * A bar divided into stretches, with something standing somewhere along it.\n *\n * Two products had written this independently and arrived at the same\n * construction - a rounded track, segments positioned absolutely by percent, a\n * floor under the segment width so a short one does not vanish - differing\n * only in what a segment meant. One drew the tiers of a rubric with the score\n * standing among them; the other drew a working day as alternating work and\n * breaks. Neither could be built from the other, and each knew something the\n * other did not: the tiers had the marker and the three-state reading of a\n * segment (passed, standing in, still ahead), the day had the minimum width\n * and the difference between an empty track and an unknown one.\n *\n * So it is one component, and the two are its two shapes:\n *\n * **spans** - stretches of a whole, each meaning something in its own right:\n * work and breaks, phases, occupancy. Adjacent or separated; gaps are the\n * track showing through.\n *\n * **thresholds** - a scale cut into bands, with a position on it. Here the\n * segments are contiguous by construction and the point is not the bands but\n * where you stand among them: \"nearly a clip\" is what the reader wants, and\n * a badge saying which band you are in cannot say it.\n *\n * The arithmetic is in `track-segments`, importable without React.\n *\n * What this does NOT do is own its own height in pixels, and that is\n * deliberate: it is `h-1.5` in one donor and `h-2.5` in the other because the\n * bar carries different weight on the two screens. What it does own is the\n * geometry inside itself - percentages of its own box, never of a parent's -\n * which is the part that broke when a consumer put a percentage-height chart\n * inside a flex row and every bar resolved to zero.\n */\n\nexport const trackVariants = cva('relative w-full overflow-hidden rounded-full', {\n variants: {\n size: {\n /* Beside text, where the bar is a detail of a line. */\n sm: 'h-1.5',\n /* On its own row, where the bar is the thing being read. */\n md: 'h-2.5',\n },\n },\n defaultVariants: { size: 'md' },\n})\n\nexport const trackSegmentVariants = cva('absolute top-0 h-full', {\n variants: {\n tone: {\n /* The subject: work done, the band you are standing in. */\n accent: 'bg-accent',\n /* Behind you, or secondary: a band already passed. Dimmed so the\n * current one carries the eye - a flat wash of \"reached\" over half the\n * bar says only that you are not at zero. */\n past: 'bg-accent/40',\n /* Ahead, or simply not the subject: a break, a band not yet reached. */\n idle: 'bg-line-2',\n /* Status, for a stretch that is itself a state rather than a quantity. */\n good: 'bg-good',\n warn: 'bg-warn',\n bad: 'bg-bad',\n },\n },\n defaultVariants: { tone: 'accent' },\n})\n\nexport type TrackTone = NonNullable<VariantProps<typeof trackSegmentVariants>['tone']>\n\nexport interface TrackSegment extends SegmentInput {\n /** Distinguishes this segment from its neighbours in the DOM. */\n key: string\n tone?: TrackTone\n /** What this stretch is, in words. Shown on hover, and the only place the\n * segment's meaning exists for a reader who cannot see the colours. */\n label?: string\n}\n\nexport interface TrackProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'children'>,\n VariantProps<typeof trackVariants> {\n segments: TrackSegment[]\n /** The value the left edge stands for. Defaults to the earliest segment. */\n from?: number\n /** The value the right edge stands for. Defaults to the latest segment. */\n to?: number\n /** Where the position marker stands, on the same scale as the segments.\n * Omitted when there is no such thing - a day of work has no \"you are here\". */\n marker?: number\n /** What the whole bar says, for a reader who cannot see it. Required: the\n * segments are decoration to a screen reader, and their titles are not\n * announced in order. */\n label: string\n /** Override the floor under a segment's width - `0` draws everything exactly\n * to scale.\n *\n * The floor is right for a day of work, where a short break is a fact worth\n * seeing. It is wrong wherever the widths are being compared to each other,\n * because a widened segment is no longer to scale and a reader measuring by\n * eye would be measuring the floor. */\n minWidth?: number\n /** Separate adjacent segments with a hairline of the ground.\n *\n * On for thresholds, where the bands touch and the boundary between two\n * reached ones would otherwise be invisible. Off for spans, where a gap in\n * the data is meant to look different from a gap between two stretches. */\n divided?: boolean\n}\n\nexport function Track({\n segments,\n from,\n to,\n marker,\n label,\n minWidth,\n divided = false,\n size,\n className,\n ...props\n}: TrackProps) {\n const placed = place(segments, { from, to, minWidth })\n\n /* The marker rides the same scale as the segments, so it is resolved against\n * the same bounds rather than against its own reading of them. */\n const bounds = {\n from: from ?? Math.min(...segments.map((s) => s.start), Infinity),\n to: to ?? Math.max(...segments.map((s) => s.end), -Infinity),\n }\n const at = marker === undefined ? null : markerAt(marker, bounds.from, bounds.to)\n\n return (\n <div\n role=\"img\"\n aria-label={label}\n className={cn(trackVariants({ size }), 'bg-soft', className)}\n {...props}\n >\n {placed.map((geometry, index) => {\n const segment = segments[index]!\n return (\n <span\n key={segment.key}\n title={segment.label}\n style={{ left: `${geometry.left}%`, width: `${geometry.width}%` }}\n className={cn(\n trackSegmentVariants({ tone: segment.tone }),\n // The hairline is drawn in the page's own ground rather than in\n // a border colour, so it reads as a cut between two fills\n // instead of a third colour of its own.\n divided && index > 0 && 'border-l border-bg',\n )}\n />\n )\n })}\n\n {at !== null && (\n /* A dark core inside a light sheath, so the mark keeps its contrast\n * over the accent band it usually stands on as well as over the empty\n * road ahead. Centred on its position rather than starting at it: the\n * mark says \"here\", and a mark whose left edge is the position reads\n * as half a step further along than it is. */\n <span\n style={{ left: `${at}%` }}\n className=\"absolute top-1/2 h-[10px] w-[6px] -translate-x-1/2 -translate-y-1/2 rounded-full bg-bg ring-2 ring-text\"\n />\n )}\n </div>\n )\n}\n\n/*\n * The labels under a track.\n *\n * Separate from the track because the two donors disagreed about whether there\n * are any - the day had none, the tiers had one per band - and because a caller\n * with three bands and a narrow column will want to drop them without giving\n * up the bar.\n */\nexport interface TrackScaleProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode\n}\n\nexport function TrackScale({ className, ...props }: TrackScaleProps) {\n return (\n <div\n className={cn('flex justify-between text-[10px] text-faint', className)}\n {...props}\n />\n )\n}\n"
1702
+ }
1703
+ ]
1704
+ },
1387
1705
  {
1388
1706
  "name": "tree-rows",
1389
1707
  "type": "registry:ui",
@@ -1406,7 +1724,7 @@
1406
1724
  "title": "Tree-view",
1407
1725
  "description": "The shape products reach for and then get wrong in the same place every time. A tree is not a nest of lists with click handlers - it is one control with a cursor in it, and the difference is the whole component:\n * **One tab stop, not one per node.** A tree of four hundred files with a `tabIndex` on each is four hundred stops between the sidebar and the editor. The container is what the keyboard reaches, and the arrows move a cursor inside it - the arrangement a `RadioGroup` has, for the same reason.",
1408
1726
  "dependencies": [
1409
- "dowel-ui@^0.23.0"
1727
+ "dowel-ui@^0.25.0"
1410
1728
  ],
1411
1729
  "registryDependencies": [
1412
1730
  "https://lacodda.github.io/dowel/r/tree-rows.json"
@@ -1426,7 +1744,7 @@
1426
1744
  "title": "Truncate",
1427
1745
  "description": "Text that does not fit, cut with an ellipsis - and, importantly, still readable in full: the element carries its own text as a `title`, so hovering shows what was cut. Every product wrote the one-line version of this and none of them remembered the title.",
1428
1746
  "dependencies": [
1429
- "dowel-ui@^0.23.0"
1747
+ "dowel-ui@^0.25.0"
1430
1748
  ],
1431
1749
  "registryDependencies": [],
1432
1750
  "files": [
@@ -1444,7 +1762,7 @@
1444
1762
  "title": "Virtual-list",
1445
1763
  "description": "The browser is fine with long lists until it is not: a hundred thousand `<div>`s is a layout the machine recomputes on every change, and the page stops responding while it does. What is drawn instead is the window the reader can actually see, held in place by a tall spacer, so the scrollbar still says how much there is.",
1446
1764
  "dependencies": [
1447
- "dowel-ui@^0.23.0"
1765
+ "dowel-ui@^0.25.0"
1448
1766
  ],
1449
1767
  "registryDependencies": [],
1450
1768
  "files": [