diff --git a/.agent/skills/basalt-html/SKILL.md b/.agent/skills/basalt-html/SKILL.md index 1f4251ae..4aa875bd 100644 --- a/.agent/skills/basalt-html/SKILL.md +++ b/.agent/skills/basalt-html/SKILL.md @@ -9,9 +9,9 @@ Standalone HTML that looks and behaves like Basalt: one file, no network, dark a ## Use it -1. Pick the modules from the index below, then print their usage in one call, always with core: `node .agent/skills/basalt-html/compose.mjs --usage core table status callout`. Core is the layout, type, panel and button classes every page uses. Each usage also names the modules it needs and the classes, attributes and tags that bring it in. `--usage` alone prints the index. -2. Write the **body** to a file such as `report.body.html`: the HTML that goes inside ``, with the classes the usage names. The same file may carry `` (else the first `<h1>` is the title), your own `<style>`, and head tags: `<meta name="description">`, `og:`/`twitter:` meta, `<link rel="icon" href="data:…">` or `canonical` (any other meta or link is refused); the script adds `Basalt.init()` unless your own `<script>` calls it. -3. Run `node .agent/skills/basalt-html/compose.mjs report.body.html` (writes `report.html`; `--out <page.html>` names it). It wraps the body in the doctype, meta and theme bootstrap, inlines Geist, and adds the core CSS and script plus only the modules your classes, attributes and tags use, and the icons you name in quotes. It prints what it added, and one warning line for each module added. `--no-fonts` skips Geist (only for a file a tool reads, never a file a person opens), `--lang fr` sets the language, `--all` adds every module. +1. Pick modules from the index below and print their usage in one call, always with core: `node .agent/skills/basalt-html/compose.mjs --usage core table status callout`. Core is the layout, type, panel and button classes every page uses. Each usage also names the modules it needs and the classes, attributes and tags that add it. `--usage` alone prints the index. +2. Write the **body** to a file such as `report.body.html`: the HTML inside `<body>`, with the classes the usage names. It may also carry `<title>` (else the first `<h1>` is the title), your own `<style>`, and head tags: `<meta name="description">`, `og:`/`twitter:` meta, `<link rel="icon" href="data:…">` or `canonical` (any other meta or link is refused); the script adds `Basalt.init()` unless your own `<script>` calls it. +3. Run `node .agent/skills/basalt-html/compose.mjs report.body.html` (writes `report.html`; `--out <page.html>` names it). It wraps the body in the doctype, meta and theme bootstrap, inlines Geist and adds the core CSS and script, only the modules your classes, attributes and tags use, and the icons you name in quotes. It prints what it added, and one warning line for each module added. `--no-fonts` skips Geist (only for a file a tool reads, never a file a person opens), `--lang fr` sets the language, `--all` adds every module. 4. Open the page in both themes at 1440 and 390 wide before you hand it over. It follows the system theme; the toggle or `Basalt.toggleTheme()` switches it. `examples/static.body.html`, `sales.body.html` (reports) and `interactive.body.html` (inputs, tabs, a palette) are bodies to copy. Never open or paste `parts/`: it is minified output. @@ -20,9 +20,9 @@ Standalone HTML that looks and behaves like Basalt: one file, no network, dark a Markup built only at run time (a `.row` your script writes) won't be seen: add `<!-- basalt:use rows -->` to the body. -- **core** `.page`, `.stack`, `.panel`, `.card`, `.btn`: always in; print its usage with your modules. +- **core** `.page`, `.stack`, `.panel`, `.card`, `.btn`: always in; print its usage too. - **glyph** `data-glyph`: Basalt's own glyph by name, never drawn by hand; filled inside `aria-current`. -- **topbar** `.topbar`, `.site-footer`: once per page; never restyle it; no danger button; no second blurred layer. +- **topbar** `.topbar`, `.site-footer`, `.version-link`: once per page; never restyle it; no danger button or second blur. - **kbd** `data-kbd`, `.kbd`: only a real shortcut the page binds, never on the primary fill; `data-doc` for keys in prose. - **segment** `.segment`: `button[aria-pressed]`, one true; a click doesn't switch it, your script does. - **forms** `.field`, `.input`, `<input>`, `<select>`, `<textarea>`: wrap a select in `.select`; errors are `aria-invalid`. @@ -88,21 +88,22 @@ Markup built only at run time (a `.row` your script writes) won't be seen: add ` - **topbar-nav** `.topbar-links`: five links at most, one `.topbar-action`; the script builds the narrow menu, never write it. - **app-shell** `.app-shell`: the document scrolls; one smoked bar; every sidebar item has a glyph. - **pane** `.pane-layout`: page first, pane after. +- **release** `.release`: only from `tools/changelog/skill-body.mjs`; never `hidden` on a fold. - **tab-bar** `.tab-bar`: three to five links, glyph over label; with more, four and a More sheet. -Your own CSS goes in a `<style>` in the body (moved to the head, after Basalt's), using `--basalt-*` tokens only. Element selectors (`a`, `button`, `table`, `h1`) go inside `@layer reset { }`, so they can never beat a Basalt class; class rules can sit unlayered. Basalt's classes are in `@layer basalt`, so any unlayered rule of yours wins without `!important`. Never restyle a Basalt class from an element rule. +Your own CSS goes in a `<style>` in the body (moved to the head, after Basalt's), using `--basalt-*` tokens only. Element selectors (`a`, `button`, `table`, `h1`) go in `@layer reset { }`, so they never beat a Basalt class; class rules can sit unlayered. Basalt's classes are in `@layer basalt`, so any unlayered rule of yours wins without `!important`. Never restyle a Basalt class from an element rule. ## Rules -- **Monochrome.** Colour only in named roles: status (a dot or icon beside its word), a product's accent, syntax inside code. Never decorative, never the only carrier of meaning. +- **Monochrome.** Colour only in named roles: status (a dot or icon beside its word), a product's accent, syntax in code. Never decorative, never the only carrier of meaning. - **Type:** Geist and Geist Mono, weights 400, 500 and 600 only. Mono for identifiers, code, numbers in logs. -- **Levels, rim, nesting.** A panel (`.panel`, `.card`, `.callout`, `.code`, `.table-wrap`) is one level above what holds it, capped at 3, with a 1px rim and no shadow. Level is position, not importance: a hero is still level 1. Group with space and dividers first; a panel is for a distinct object; at most one panel deep. Only things that leave the flow (menu, popover, dialog) take `.float` and a shadow. +- **Levels, rim, nesting.** A panel (`.panel`, `.card`, `.callout`, `.code`, `.table-wrap`) is one level above what holds it, capped at 3, with a 1px rim and no shadow. Level is position, not importance: a hero is level 1. Group with space and dividers first; a panel is for a distinct object; at most one panel deep. Only things that leave the flow (menu, popover, dialog) take `.float` and a shadow. - **Keys.** No single-character shortcuts on the page (WCAG 2.1.4): a shortcut needs ⌘, ⌃ or ⌥. - **Selected** is a shape or weight, never a wash alone: a segment or tab label at 600 (400 at rest) on its pill or underline, a row's filled background, a checked box. No vertical bar; an outline never marks a state. - **Both themes, always.** WCAG 2.2 AA: 4.5:1 text, 3:1 boundaries, focus and icons (the tokens pass; do not invent colours). - **Motion** from the tokens only; entries ease out, nothing bounces or overshoots; under reduced motion, opacity only. A press is a colour step; only `.btn` scales (`--usage core`). -- **390px wide** must work: no sideways scroll, touch targets at least 44px (standalone links too: `--usage core`), inputs 16px (the CSS does this on coarse pointers). Don't hide a column to make a table fit. +- **390px wide** must work: no sideways scroll, touch targets at least 44px (standalone links too: `--usage core`), inputs 16px (the CSS does it on coarse pointers). Don't hide a column to make a table fit. - **No** CDN, framework, web font request, glow, gradient, dot grid, outer frame around the page, bounce, press scale beyond `.btn`'s .98, red fill, or decorative colour. Danger is red text with a red hairline. - **Brand SVG file** (from `brand/`): paste it with `data-brand` on its `<svg>`; compose hides it and drops its title. The link round it needs `aria-label`. -- **A dot between words** is `.dot-sep`, never an `aria-hidden` dot with a hidden comma; a value and its unit need a space between them (`--usage core`). +- **A dot between words** is `.dot-sep`, never an `aria-hidden` dot with a hidden comma; a value and its unit need a space (`--usage core`). - Icons: Phosphor Bold via `<i data-icon="Name"></i>`, 16px (`data-size="20"` beside 18 to 24px text). Available: Command, Option, Control, Sun, Moon, Info, Warning, ArrowRight, ArrowLeft, ArrowUp, ArrowDown, CaretUpDown, Trash, Download, ArrowClockwise, CheckCircle, XCircle, MinusCircle, Prohibit, GithubLogo, XLogo, LinkedinLogo, InstagramLogo, YoutubeLogo, EnvelopeSimple, TerminalWindow. Check, close, chevrons, copy, plus, minus, search: core glyphs (`data-glyph`), not icons. A script that names one writes it as a quoted string (`icon: 'Trash'`). Need another icon? Add its name to tools/html-skill/src/icons.json and rebuild. Never draw one, never use an emoji. diff --git a/.agent/skills/basalt-html/parts/app-shell.css b/.agent/skills/basalt-html/parts/app-shell.css index d834add3..dab92ac7 100644 --- a/.agent/skills/basalt-html/parts/app-shell.css +++ b/.agent/skills/basalt-html/parts/app-shell.css @@ -1 +1 @@ -@layer basalt{.app-shell{display:grid;grid-template-columns:var(--basalt-size-sidebar-width) minmax(0,1fr);min-height:100dvh}:root{--basalt-shell-width: calc(var(--basalt-size-sidebar-width) + var(--basalt-size-page-width))}.app-shell[data-capped]{max-width:var(--basalt-shell-width);margin-inline:auto}.app-shell[data-capped] .app-main{max-width:none}@media(width>=1024px){:root:has(.app-shell) .skip-link{--_brand-start: calc(2 * var(--basalt-space-3) + var(--basalt-space-1-5));inset-inline-start:var(--_brand-start)}:root:has(.app-shell[data-capped]) .skip-link{inset-inline-start:calc(max(var(--basalt-space-0),(100% - var(--basalt-shell-width)) / 2) + var(--_brand-start))}}@media(width>=720px)and (width<1024px){:root:has(.app-shell) .skip-link{inset-inline-start:calc((var(--basalt-size-rail-width) - var(--basalt-size-tap-min)) / 2)}}.app-column{min-width:0}.app-sidebar{position:sticky;top:0;align-self:start;box-sizing:border-box;display:flex;flex-direction:column;height:100dvh;padding-inline:var(--basalt-space-3);overflow-y:auto;overscroll-behavior:contain;border-inline-end:var(--basalt-size-hairline) solid var(--basalt-border-divider);background:var(--basalt-surface-page);color:var(--basalt-text-primary);font-family:var(--basalt-font-family-sans)}.app-brand{box-sizing:border-box;display:flex;align-items:center;flex:none;height:var(--basalt-sticky-offset);padding-top:var(--bh-inset-top);padding-inline:calc(var(--basalt-space-1-5) + var(--basalt-space-3))}.app-brand .brand>span{display:inline-flex;align-items:center;gap:var(--basalt-space-2);height:var(--basalt-size-control-md);border-radius:var(--basalt-radius-sm)}.app-brand .brand>.brand-rail{display:none}.app-nav{flex:1 0 auto;padding-bottom:var(--basalt-space-4)}.app-account{flex:none;padding-bottom:var(--basalt-space-4)}.app-main{box-sizing:border-box;min-width:0;max-width:var(--basalt-size-page-width);padding:var(--basalt-space-6) var(--bh-pad-right) var(--basalt-space-16) var(--bh-pad-left)}.app-bar{box-sizing:border-box;display:flex;align-items:center;gap:var(--basalt-space-2);height:calc(var(--basalt-size-header) - var(--basalt-size-hairline));padding-top:var(--basalt-size-hairline);padding-inline:var(--bh-pad-left) var(--bh-pad-right)}.app-title{min-width:0;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:var(--basalt-font-weight-semibold) var(--basalt-text-lg-size) / var(--basalt-text-lg-line-height) var(--basalt-font-family-sans);letter-spacing:var(--basalt-text-lg-tracking)}.app-actions{display:flex;align-items:center;flex:none;gap:var(--basalt-space-2)}.app-heading{display:flex;flex-direction:column;flex:0 1 auto;min-width:0}.app-facts{min-width:0;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--basalt-text-secondary);font:var(--basalt-font-weight-regular) var(--bh-sm);letter-spacing:var(--basalt-text-sm-tracking)}.app-facts>*{vertical-align:top}@media(width>=720px)and (width<1024px){.app-shell{grid-template-columns:var(--basalt-size-rail-width) minmax(0,1fr)}.app-sidebar{padding-inline:0}.app-brand{justify-content:center;padding-inline:0}.app-brand .brand{justify-content:center}.app-brand .brand>.brand-full{display:none}.app-brand .brand>.brand-rail{display:inline-flex}}@media(width<720px){.app-shell{grid-template-columns:minmax(0,1fr)}.app-sidebar{display:none}.app-actions{gap:var(--basalt-space-1)}.app-header .btn[data-variant=primary]{flex:none}.app-shell[data-tabbar] .app-main{padding-bottom:calc(var(--basalt-bottom-offset) + var(--basalt-space-6))}}@media(forced-colors:active){.app-sidebar{border-inline-end-color:CanvasText}}} +@layer basalt{.app-shell{display:grid;grid-template-columns:var(--basalt-size-sidebar-width) minmax(0,1fr);min-height:100dvh}:root{--basalt-shell-width: calc(var(--basalt-size-sidebar-width) + var(--basalt-size-page-width))}.app-shell[data-capped]{max-width:var(--basalt-shell-width);margin-inline:auto}.app-shell[data-capped] .app-main{max-width:none}@media(width>=1024px){:root:has(.app-shell) .skip-link{--_brand-start: calc(2 * var(--basalt-space-3) + var(--basalt-space-1-5));inset-inline-start:var(--_brand-start)}:root:has(.app-shell[data-capped]) .skip-link{inset-inline-start:calc(max(var(--basalt-space-0),(100% - var(--basalt-shell-width)) / 2) + var(--_brand-start))}}@media(width>=720px)and (width<1024px){:root:has(.app-shell) .skip-link{inset-inline-start:calc((var(--basalt-size-rail-width) - var(--basalt-size-tap-min)) / 2)}}.app-column{min-width:0}.app-sidebar{position:sticky;top:0;align-self:start;box-sizing:border-box;display:flex;flex-direction:column;height:100dvh;padding-inline:var(--basalt-space-3);overflow-y:auto;overscroll-behavior:contain;border-inline-end:var(--basalt-size-hairline) solid var(--basalt-border-divider);background:var(--basalt-surface-page);color:var(--basalt-text-primary);font-family:var(--basalt-font-family-sans)}.app-brand{box-sizing:border-box;display:flex;align-items:center;flex:none;height:var(--basalt-sticky-offset);padding-top:var(--bh-inset-top);padding-inline:calc(var(--basalt-space-1-5) + var(--basalt-space-3))}.app-brand .brand>span{display:inline-flex;align-items:center;gap:var(--basalt-space-2);height:var(--basalt-size-control-md);border-radius:var(--basalt-radius-sm)}.app-brand .brand>.brand-rail{display:none}.app-nav{flex:1 0 auto;padding-bottom:var(--basalt-space-4)}.app-account{flex:none;padding-bottom:var(--basalt-space-4)}.app-main{box-sizing:border-box;min-width:0;max-width:var(--basalt-size-page-width);padding:var(--basalt-space-6) var(--bh-pad-right) var(--basalt-space-16) var(--bh-pad-left)}.app-bar{box-sizing:border-box;display:flex;align-items:center;gap:var(--basalt-space-2);height:calc(var(--basalt-size-header) - var(--basalt-size-hairline));padding-top:var(--basalt-size-hairline);padding-inline:var(--bh-pad-left) var(--bh-pad-right)}.app-title{min-width:0;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:var(--basalt-font-weight-semibold) var(--basalt-text-lg-size) / var(--basalt-text-lg-line-height) var(--basalt-font-family-sans);letter-spacing:var(--basalt-text-lg-tracking)}.app-actions{display:flex;align-items:center;flex:none;gap:var(--basalt-space-2)}.app-heading{display:flex;flex-direction:column;flex:0 1 auto;min-width:0}.app-facts{min-width:0;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--basalt-text-secondary);font:var(--basalt-font-weight-regular) var(--bh-sm);letter-spacing:var(--basalt-text-sm-tracking)}.app-facts>*{vertical-align:top}@media(width>=720px)and (width<1024px){.app-shell{grid-template-columns:var(--basalt-size-rail-width) minmax(0,1fr)}.app-sidebar{padding-inline:0}.app-brand{justify-content:center;padding-inline:0}.app-brand .brand{justify-content:center}.app-brand .brand>.brand-full{display:none}.app-brand .brand>.brand-rail{display:inline-flex}}@media(width<720px){.app-shell{grid-template-columns:minmax(0,1fr)}.app-sidebar{display:none}.app-actions{gap:var(--basalt-space-1)}.app-header .btn[data-variant=primary]{flex:none}.app-shell[data-tabbar] .app-main{padding-bottom:calc(var(--basalt-bottom-offset) + var(--basalt-space-6))}}@media(forced-colors:active){.app-sidebar{border-inline-end-color:CanvasText}}.app-version{margin:var(--basalt-space-2) calc(var(--basalt-space-1-5) + var(--basalt-space-3)) 0}@media(width>=720px)and (width<1024px){.app-version{margin-inline:var(--basalt-space-1-5)}.app-version .version-link{display:flex;justify-content:center;text-align:center}.app-version :is(.version-link-words>:first-child,.version-link-date){position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}}} diff --git a/.agent/skills/basalt-html/parts/app-shell.js b/.agent/skills/basalt-html/parts/app-shell.js index c674ab3c..e12ddfc1 100644 --- a/.agent/skills/basalt-html/parts/app-shell.js +++ b/.agent/skills/basalt-html/parts/app-shell.js @@ -1 +1 @@ -(function(i){"use strict";var n=i._;n.step(55,"wireAppShell",function(){var a=document.querySelectorAll(".app-shell");if(!a.length)return;var e=matchMedia("(width < 1024px)");function l(){a.forEach(function(c){c.querySelectorAll(".app-sidebar .nav").forEach(function(r){r.toggleAttribute("data-collapsed",e.matches),r.querySelectorAll(".nav-item").forEach(function(t){var o=t.querySelector(".nav-label");e.matches&&o?(t.setAttribute("data-tooltip",o.textContent.trim()),t.setAttribute("data-tooltip-side","right")):(t.removeAttribute("data-tooltip"),t.removeAttribute("data-tooltip-side"))})})})}e.addEventListener("change",l),l()})})(window.Basalt); +(function(u){"use strict";var c=u._;c.step(55,"wireAppShell",function(){var a=document.querySelectorAll(".app-shell");if(!a.length)return;var o=matchMedia("(width < 1024px)");function i(){a.forEach(function(l){l.querySelectorAll(".app-sidebar .nav").forEach(function(t){t.toggleAttribute("data-collapsed",o.matches),t.querySelectorAll(".nav-item").forEach(function(e){var r=e.querySelector(".nav-label");o.matches&&r?(e.setAttribute("data-tooltip",r.textContent.trim()),e.setAttribute("data-tooltip-side","right")):(e.removeAttribute("data-tooltip"),e.removeAttribute("data-tooltip-side"))})}),l.querySelectorAll(".app-sidebar .version-link").forEach(function(t){var e=t.querySelector(".version-link-word"),r=t.querySelector(".version-link-number"),n=t.querySelector(".version-link-date time");o.matches?(t.setAttribute("data-tooltip",(e?e.textContent.trim()+" ":"")+(r?r.textContent.trim():"")+(n?" · "+n.textContent.trim():"")),t.setAttribute("data-tooltip-side","right")):(t.removeAttribute("data-tooltip"),t.removeAttribute("data-tooltip-side"))})})}o.addEventListener("change",i),i()})})(window.Basalt); diff --git a/.agent/skills/basalt-html/parts/manifest.json b/.agent/skills/basalt-html/parts/manifest.json index 7fb544d5..b7946814 100644 --- a/.agent/skills/basalt-html/parts/manifest.json +++ b/.agent/skills/basalt-html/parts/manifest.json @@ -1,5 +1,5 @@ { - "$comment": "Which parts of the skill's CSS and JS a page gets. The core is always in. A module is in when the page's body has one of its classes, attributes or tags, matches one of its text patterns, or is named in a <!-- basalt:use name --> comment, and when another module needs it (requires). Modules are added in the order listed here, which is the order of the source files' cascade. classes: every class the module's CSS styles (the test checks them against the CSS and against SKILL.md). budget: the most bytes its minified CSS and JS may reach together. budgets: skillMd (SKILL.md, the context an agent pays: never above what it was), core (the CSS and JS of every page). icons: Phosphor names the module's script draws itself. Raised in the first parity PR (the owner's \"bring up the parity\"): forms (the number-input, search-clear and file-input chrome), disclosure (the native details marker), status (the accent reader and the forced-colours badge border), spinner (a fixed 16px ring), and the new number, range and accent modules. skillMd rose 10555 to 10900 for the new rules (number field, native chrome, the braille rule, the accent). Raised in the second parity PR (popup rows, levels and the segment's pill): segment 1400 to 3700 (the shared sliding pill: its script, 1.5 KB, and its CSS with the pill's two fallbacks), rows 3600 to 4300 (#27's plate-in-a-row geometry, the plate per level, the glide's shared plate and the forced-colours lit row, net of the removed bar), palette 9400 to 11300 (the glide's script, 2.4 KB: it follows the lit row, travels on a pointer, snaps on a key, and fades in place on leaving). The art module (DECISIONS 101 and 104) is the token groups only some pages name, taken out of the core so the core stays under its cap: the chart roles and lengths, the art colours, the aspect ratios and the stage headroom, in both themes (2087 bytes at 2100; it grows only when a token of those groups is added). A page gets it when its body names one of them, a var() in its own style included. The every-module page has no cap of its own (owner, DECISIONS 79): each part is capped, and a page carries only the parts it uses. usage: the most bytes of a module's usage text (src/usage/NAME.md; core.usage for core.md), which compose.mjs --usage prints on demand. It is context an agent pays only for the modules its page uses, so it is capped per part as SKILL.md and the CSS and script are (DECISIONS 79 and 109). Each is set a little above what its text was when the usage moved out of SKILL.md (DECISIONS 109); raising one needs a reason in the PR, and a rise of 40 to 50% is the owner's. textWords: each text pattern said in words, which compose.mjs --usage prints instead of the regular expression (one for each entry of text, in order). builds: modules a module requires whose markup its script writes, so --usage prints a line saying so instead of their usage text (the palette builds its own rows and key chips). The council's clarity check of the usage texts (all three: not yet clear) raised eight caps because the texts gained what an agent had to guess: callout 200 to 700 (the icon and one wrapper div around the title and body as markup, the four status icons, the role React's Callout renders), palette 1100 to 1300 (an item shown whole, keys as an array, keywords), stats 450 to 800 (a snippet of the figures and of the dl), tabs 500 to 650 (the unselected panels), code 250 to 450 (the markup and what each token class means), segment 150 to 300 (a click does not switch it), progress 150 to 350 (the empty span that paints the fill), theme 250 to 400 (leave the button empty), and accent 250 to 300. Topbar went down, 700 to 500, as its build detail was cut. Raised in the usage PR (the council's clarity check): palette 11300 to 11450 (the module grew 11283 to 11448, +165, about 1.5%), for the guard that makes a string `keys` warn and draw no chip instead of throwing in `keys.filter`, which the palette's usage already promised. Round 2 of the clarity check: tabs 650 to 750 (the panel's top space shown in the snippet, and that the script selects a tab on click). Raised in the site-icons and status PR (skill-parity part A, DECISIONS 106 and 107): status 1650 to 1900 (the neutral, pending and running marks, the badge's real border, and the forced-colours disc, net of the red danger word it drops) and its usage 400 to 1000 (every status in words, the word alone, running, forced colours); rows 4300 to 4450 (the profile list's seat rule and the status parts on a lit row) and its usage 300 to 600 (the profile list, with the one mistake: never an empty element for the seat). New: the links module (2671 bytes: the social row, the new-tab arrow's CSS and the script that draws it; budget 2750) and its usage (1746 bytes; cap 1850), which carries the social link, the glyph set, icon only and the new tab. Dropping Regular halves icons.json. Added in the overlay PR (skill-parity-4, batch 7 step 2, DECISIONS 108): the shared plate leaves palette.js for a glide module (the palette, a menu and the notification centre all call it), so the palette's cap went down, 11450 to 9250, and rows 4450 to 3850 (the plate's CSS moved to glide); and the overlay layer comes in as seven modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: popover (the native popup shell), menu, dialog (the dialog and alert dialog), sheet (on every side, the top one the site header's narrow menu), tooltip, toast and notifications (the centre). skillMd is unchanged in its cap (the eight new index lines fit within it); the core is unchanged in bytes. Added in the figures and charts PR (skill-parity-5, batch 7 step 3, DECISIONS 108): four modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: meter (React's Meter, CSS only, 2581 bytes), dlist (the description list, CSS only, 1265), terminal (the code block's transcript: its CSS, 3242, and the script that draws the gutter, the copy button and the replay, 4824) and chart (React's TimeChart and ChartGroup: 7313 of CSS and 23262 of script, which port chart.tsx's scale, layout, lane, labels, sentences, keyboard and table; it needs the art tokens, the table and the kbd chips, and a page without a chart carries none of it). Stats grew for the source line (budget 700 to 850, 798 bytes; its usage 800 to 950, 675 to 899 bytes, +33%, under the owner's 40 to 50%). skillMd is unchanged in its cap (four index lines fit within it); the core is unchanged in bytes. Added in the forms and selection PR (skill-parity-6, batch 7 step 4, DECISIONS 108): six modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: select (React's Select: the native select's closed trigger in every browser and, where `appearance: base-select` is shipped, the styled list with its two-line rows; a small script that says which input lit a row, 7740 bytes before it, choice (Checkbox, Radio, RadioGroup and Switch as styled native inputs; CSS only, with the first-frame rule), choice-card (ChoiceCard; CSS only), toggle (the pressed toggle's plate and check seat on .btn; CSS only), selection (a table's checkbox column: its fixed width and the script that sets aria-selected, the mixed header box and the count) and loops (the page-level hold on every loop with its switch: the held look and the script that stores it). The select's styles left forms, whose budget fell 3650 to 3250. skillMd rose 8621 to the size of its six new index lines, within its cap; the core is unchanged in bytes; compose adds the stored-hold line to the head of a page that has the loops module. Revised in the same PR (the lead's review of the build): the select gains select.js (one row is lit at a time, by whichever of the pointer and the keys moved last), and choice, toggle, selection and loops carry the first-frame rule, so a state a script sets on load (a mixed header box, the stored hold) paints at once with no crossfade. Added in the navigation and layout PR (skill-parity-7, batch 7 step 5, DECISIONS 108): five modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: glyph (Basalt's core glyphs drawn by name, at rest and selected, from a table the build works out from the drawn set; a page carries only the glyphs it names, and the drawing of a core glyph from data-glyph left the sheet module, which draws none now), nav (React's Nav: the sidebar's, the narrow menu's and More's rows, with the shared hugging pill), topbar-nav (the site header's links, one action and narrow menu, built by script from the bar's markup), app-shell (the shell, its sidebar and rail, and the app header) and tab-bar (the phone tab bar). The topbar module became the site header's bar (React's SiteHeader, DECISIONS 108: 56px with its line inside, the 44 by 44 brand target, the narrow-screen buttons, the derived sticky offset), budget 1600 to 3200 because its rules gained the app header's shared smoke, and its usage 500 to 750 (+50%) for the lockup's markup (the links, action and menu are topbar-nav's usage). Glide 3700 to 3950: the navigation's pill is a shape inside the row that the plate follows (about 200 bytes). The core's usage 2000 to 2100 (+5%): h2 is the Section step, the prose column's measure, and a link already 44px tall needs no margin. skillMd rose 9317 to 9863 for five index lines, under its cap; the core CSS grew 38 bytes (the layout tokens replace raw lengths, the gutter is one derived property, h2, .prose and .lead follow foundations) and the core script is unchanged. A module's media query writes %bp-md%, %bp-lg% or %bp-container% and the build substitutes the breakpoint tokens. Added in the tables and filters PR (skill-parity-8, batch 7 step 6, DECISIONS 108): the existing table module gains React's table additions (DECISIONS 95: the row header, \"Not observed\", the row density and the scroll hint with its small script), budget 1400 to 3000 (it was 1134 bytes of CSS; it is 2168 of CSS and 693 of script) and its usage 700 to 950 (+36%); and two modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: still-table (React's Table with `columns`: the fixed layout from a colgroup, the whole header cell as the sort button with its reserved seat, aria-sort, the pinned columns and their divider, the empty row; 4767 of CSS and 3264 of script, budget 8200) and filter (React's MultiSelect and FilterResult: the chips, the trigger and checklist with the search band from ten values, Clear held in place, the one debounced result line, and the narrowing of a table by `data-column`; 8240 of CSS and 7978 of script, budget 16400; it needs the popover, glide, glyph and choice modules). The core is unchanged in bytes. skillMd rose 9863 to 10128 for two index lines and the CaretUpDown icon's name, within its cap. Added in the commands PR (skill-parity-9, batch 7 step 7, DECISIONS 103 and 108): one new module a page carries only when it uses it, command-list (React's CommandList: the command panel set in the page, list plus preview, the push; it extends the palette and needs rows, kbd and glide; 5229 of CSS and 8734 of script, budget 14000, usage 2150). Two-line rows come to the existing modules: rows 3850 to 5350 (the described row's grid and description line, the push's chevron: 1481 bytes of CSS, the same rules React's menu rows carry), palette 9250 to 9900 (its rows are one function the list shares, with the description and the two-tier ranking of title matches over keyword and description matches; +636) and its usage 1300 to 1350, rows' usage 600 to 800, and glide 3950 to 4000 (a host that is idle counts as having no lit row, +54). skillMd rose 10128 to 10259 for one index line, within its cap; the core's CSS grew 24 bytes (.split.aside takes size-list-width in place of its raw 20rem: the same 320px, so no pixel moves) and the core script is unchanged. Added in the art PR (skill-parity-10, batch 7 step 8, DECISIONS 104 and 108): two modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: stage (React's Stage and PairedArt: full-bleed art under the site header, the pull-up by the sticky offset, the headroom, the paired art that follows the page's theme, and the forced-colours and print rules; CSS only, 1179 bytes) and framed-art (React's FramedArt: the figure, its rim and radius, the reserved box, the placeholder and the failed alt, the caption and credit; 2208 bytes of CSS and the 733-byte script that sets the frame's phase); both need the art tokens. The bar stays smoked over a stage: React clears it only over a stage that passed the headroom test helper, and a page has no test run (DECISIONS 108's note), so the skill builds no clear state. skillMd rose 10259 to 10500 for two index lines, within its cap; the core is unchanged in bytes. The callout gained the status rim in the same PR (DECISIONS 82, D8's status callouts): success, warning and danger draw their border in the status colour at 45% mixed in sRGB over the callout's own level, one solid colour on every side, and CanvasText in forced colours with the icon; the status colour is now one property the icon and the rim read. Its budget rose 900 to 1150 (the module is 1089 bytes, from 792: +297, about 37%); its usage is unchanged. Added in the overlays-and-the-rest PR (skill-parity-11, batch 7 step 9, DECISIONS 90 and 108): the last two parts of D8's part 5, each a module a page carries only when it uses it, with its own cap and usage cap set a little above its size: combobox (React's Combobox: the input with its caret button inside, the popup of the menu's rows with the glide's shared plate and two-line options, the filtering, the keys, the hidden value, the empty message and the check; 4342 of CSS and 6423 of script, budget 10900, usage 2150; it needs forms, popover and glide, and builds the last two) and sparkline (React's Sparkline: the label and latest value, the line, the axis, the empty sentence and the loading line that breathes; 1609 of CSS and 1874 of script, budget 3600, usage 950). The combobox copies the menu's row rules, as the select's list does, because React's Combobox renders MenuItem rows (a 40px hit area, a 36px plate) and the skill's .row is the palette's 44px: it carries no menu script. popover.js gains the combobox popup in the list of popups that keep focus where it is (+21 bytes, within its cap). skillMd rose 10500 to 10724 for two index lines, within its cap; the core is unchanged in bytes. Added in the motion-rules PR (DECISIONS 136 and 139): one module, ambient (a page's one ambient loop: CSS 828 bytes, script 433, budget 1300, usage 800), taken out of loops so the hold's own module grows only by the icon toggle's glyph swap (loops 2000 to 2200, +10%; its usage 1300 to 1650 for the icon form and the new settings-row sentence, +27%); and the chart's entrance (`entrance: true`: the marks' animations, their conditions and the redraw that restarts them at the elapsed time, 23262 to 25299 bytes of script; budget 30700 to 32800, +7%, usage 2500 to 2950, +18%). The core grew by the three tokens (27704 to 27862 bytes of CSS, under its cap). its stage usage gained the ambient art's line (1650 to 1750, +6%). skillMd rose 10724 to the size of the ambient index line, within its cap. Raised again in the motion-rules amendment (DECISIONS 143): chart 32800 to 33800 (script 25299 to 26375 bytes, +4%; +10% over the 30700 it began with) for the glide a new data set makes mid-entrance, print settling it, and `Basalt.pageChange()`; its usage 2950 to 3150 (+26% over the 2500 it began with). Raised in the second motion-rules amendment (DECISIONS 148): chart 33800 to 34400 (script 26375 to 26970 bytes: a line and its markers glide from their drawn geometry, and `beforeprint` settles the entrance; +12% over the 30700 it began with); topbar-nav 6900 to 7500 (+8.7%: the narrow menu's pause row, its CSS and 275 bytes of script, DECISIONS 148 item 2); loops usage 1650 to 1800 (+38% over the 1300 it began with, for the icon form's `title` and the menu row). Raised in the audit-design-b PR (DECISIONS 138 and 139): still-table 8200 to 13400 (+63%: the module was 7927 bytes and is 13311; the cut cell's plate, its focus stops and its dismissal, ported from React's cell-peek.ts, are 4273 bytes of script and 1111 of CSS; a still table that truncates needs them). The same PR: core usage 2100 to 2250 (+7%: the skip link, one bullet), forms usage 350 to 480 (+37%: the required mark), still-table usage 1950 to 2150 (+10%: the cut cell and the width rule), notifications usage 1050 to 1100 (+5%: the 44px entry on touch). The skip link's rim and radius took the core 30457 to 30609 bytes, under its cap (the rules that hang it under the bar are the topbar module's: 3200 to 3600, +12.5%); core 30720 to 31050 (+1.1%, DECISIONS 147: also the bar's links left out of the rule: the pseudo-element that makes a short standalone link a 44 by 44 target), skip-link script in the topbar module (3200 to 4150 over this PR, +30%: the rules that hang the link under the bar, 3600, and the script that reads the bar's real edge, 4150), sparkline 3600 to 4050 (+12.5%: React's ticker structure, so the value copies once on its line, and in forced colours the strips go and the number is plain text), forms budget 3250 to 3500 (+7.7%: the necessity word), notifications 9050 to 9250 (+2.2%: the 44px entry). Raised in the audit-design-b PR's E2 port (DECISIONS 138 and 139: the core set draws check, close, the chevrons, copy, plus, minus and search wherever a component draws them): the modules that drew a Phosphor icon for one of those now carry the core glyph's whole SVG, written in at build time (`%glyph-svg:name%`, the markup the glyph module's `_.glyph(name)` returns, so no module needs the glyph module and a page pays for nothing it does not use), and the Phosphor path of the same icon leaves the page. Each module's own bytes rose by that markup, and a page's total moved by what the Phosphor path it no longer carries saves: menu 8600 to 8900 (+303), combobox 10900 to 11200 (+303), copy 1900 to 2400 (+640), terminal 8100 to 8850 (+761), toast 13850 to 14150 (+325), number 2900 to 3400 (+557), filter 16400 to 17050 (+785), palette 9900 to 10450 (+536); the command list shares the palette's search drawing and fell 20 bytes. Set in integration-nov15, where the type-layout, motion-rules and audit-design-b branches meet: the combined tree measured SKILL.md 10959 bytes (each side's cap was 10900: both added index lines), core 31192 bytes (caps 30720 and 31050: the page-row and display rules, the three motion tokens and the skip link and 44px target rules all land in the core CSS) and core usage 2348 bytes (caps 2300 and 2250: type-layout's line and the skip-link bullet), so each is set to the measured bytes rounded up to the next 50: skillMd 10900 to 11000, core 31050 to 31200, core usage 2300 to 2350. Raised in the audit-design PR (decisions 138 and 139, parts A, D and C11): core 30720 to 31600 (+2.9%: the more-contrast block and its three aliases, and the field boundary token, every page carries as React does; the shadow-pill token is gone; the script gained `reserve`, 240 bytes), segment 3700 to 4100 and tabs 2300 to 2700 (the chosen label is 600 against 400, its width reserved by a span that carries its own copy, drawn unseen at 600; the pill's drop shadow is gone), and the segment's usage 300 to 380 (the weight and the glyph-only button). Raised again in the audit-design-a amendment (decision 145): core 31600 to 32300 (reserve() also reserves a label that is not plain text), segment 4100 to 5100 and tabs 2700 to 3500 (the second copy of such a label, and an icon drawn in both its forms), glyph 1100 to 1300 (a glyph in a segment or tab is drawn in both forms). Raised in the second audit-design-a amendment (decision 149): core 32300 to 32800 (reserve() builds the second copy of a label without any id, name, reference or hidden control, and does not copy a frame or media), segment 5100 to 5400 and its usage 380 to 500 (the 600 is on the label, the one-line rule and the usage text); the still-table cap is back at 8200, as the wash is on every cell again. Return 3 of the audit-design-a build (decision 149): tabs 3500 to 3700 (a tab the script has not reserved is 600 itself when selected, and one it declined is marked; the same two lines are in segment, which stays under 5400). Raised in the audit-fix-c2 PR (engineering, no pixel changes): toast 13850 to 14350 (the module was 13789 bytes and is 14288, +499, 3.6%) for F6, which focuses the Notifications region and Shift+Tab or Escape from it (or from the first toast) leaves it for where focus came from (and keeps a dialog's focus trap from wrapping it), as Base UI's viewport does in React, and for placing the region from focus (in the modal that holds it, or in the body), so a toast is never under a backdrop or in an inert modal whatever order the modals opened in (A3-09); the palette module grew 9864 to 9897 of its 9900 so that a palette opened over a modal sits inside it; topbar 3200 to 3250 (3123 to 3233, +110) for the scroll margin on what the bar holds, so a Tab into the bar from a scrolled page does not scroll the page (React's rule from PR #66); stage usage 1650 to 1750 (1580 to 1713, +8%) for the art's new place in the markup, after the content (A1-09), the stage's own CSS rising 1179 to 1208 within its 1250. skillMd rose 10724 to 10876 for the sentence that says a body may carry head tags, within its 10900. compose.mjs, the tool an agent runs, has no cap here (it is never in a page): it grew 21673 to 38153 bytes for the tokenizer that reads a body as HTML does and the head tags. Raised in the site-parts PR (DECISIONS 146, round 39), which folds each new part into the module it belongs with, so SKILL.md gains no index line (it has 41 bytes under its cap and a new module needs about 100): topbar 4150 to 17600 (+13450: the site footer and its disclosures, the lockup by pixel density, and a bar that arrives or leaves and returns, with its observer; a page that has a .topbar and no footer carries them too: the alternative, a module for each, needs its own index line and so SKILL.md bytes) and its usage 950 to 2900 (the footer's markup, the lockup's and the phase's); theme 650 to 4550 (the three-word theme choice: its CSS 2230 bytes and its script, 2277, with arrows, storage and the system listener) and its usage 400 to 1150 (the choice's markup written in full, so the right word is chosen before any script); segment 3700 to 3800 (a radio group's checked state besides a pressed button); stage 1250 to 2150 (its first script, 768 bytes, for fit and anchor) and its usage 1750 to 2000; framed-art 3000 to 3900 (drawn art in the frame: fit, anchor, no scaling strokes) and its usage 1250 to 1400. SKILL.md rose 10959 to 10992 (the topbar and theme index lines name .site-footer and .theme-choice). The head's theme line also writes data-theme-choice. Raised in site-parts return 2 (DECISIONS 146 B1 and B4): theme 4550 to 5350 (+800: the icon form of the theme choice, [data-theme-menu], whose button shows the theme in use, is named for the choice and opens the page's own .menu of three radio rows, in the theme script's 3073 bytes; the menu and popover modules are the page's, brought by its markup, so no module line was added and SKILL.md is 10993 of 11000) and its usage 1150 to 2200 (+91%: the menu's markup is written in full, and the deprecated toggle is said once); app-shell usage 2000 to 2100 and topbar-nav usage 1900 to 1950 (the theme control leaves the bar's text; the tools and the end cluster come in). The two example bodies still carry the deprecated data-theme-toggle. Return 2, F3 (DECISIONS 146 F): stage 2150 to 2250 (script 842 bytes: slice is the stage's default, as a frame's, and a drawing's own preserveAspectRatio stands unless the stage names data-fit or data-anchor) and its usage 2000 to 2150. framed-art 3900 to 4000 (a drawing's own preserveAspectRatio stands unless the figure names data-fit or data-anchor, +101 bytes). Return 3: theme 5350 to 5900 (script +569 bytes: who wrote data-theme, so System follows the system's change live and a theme the page set by hand, or a .dark or .light root, survives it). Raised in the controls port (DECISIONS 154): skillMd 11000 to 11200 for two index lines (link-tabs and option-chips, 214 bytes together), and core 31200 to 31600 for the nine tokens the port adds to every page's token CSS (the control rungs 44 to 64, two container widths, the confirm hold and the amount's opacity, 311 bytes). New modules (DECISIONS 154): link-tabs 2700 (its sizes, the 640 container step, the forced-colours underline, and the select that replaces the row under 720 with its 590-byte script, A15; it requires the select module), option-chips 5700 (the chip's states each written for a native radio inside a label, which needs :has on every one, plus the 1 KB script that keeps an aria-disabled chip reachable and never chosen). Return 3 (DECISIONS 154 conformance): link-tabs 2700 to 3100 and its usage 1650 to 1850 (the select's height for each row size, and a script that reads aria-current when it is needed and watches it move: 3,048 bytes), option-chips 5700 to 6700 (each state written twice, as a state attribute and as :has(), so no browser needs :has(): 4,975 CSS and 1,623 script). Return 4 (DECISIONS 158, Q2): link-tabs 3100 to 4300 and its usage 1850 to 2400 (the \"Go to\" label drawn at the select's start with its measured clearance, the select's accessible name kept as the words and the chosen page's, and the key hold that keeps a letter or an arrow on the closed select from navigating: 4,174 bytes, CSS 2,951 and script 1,223). Raised in the links-and-rows port (DECISIONS 152; the owner's approval is the lead's to confirm): the new link-rows module (5050 bytes of CSS, 50 of them for Castle's big-row arrow stepping colour over duration-fast, return 1, 1500 of usage: the directory's and the big rows' CSS, whose arrow is a core glyph drawn as a mask, and their tokens, size-row taken out of the core like type-layout's), disclosure 1550 to 3500 (Show all: the track, the clip and the settle, 1.5 KB of script and 1.8 KB of CSS), copy 2400 to 3500 (the form with words: the one cell and its script). SKILL.md rose 10959 to 10997 for one line, within its 11000 cap. Raised in the charts port PR (DECISIONS 153, D7a): chart 34400 to 34650 (script 26970 to 27270 bytes, +1.1% on the 34283 it was: `Basalt.trailingMean`, the trend maths React exports as `trailingMean`, 300 bytes), its usage 3150 to 3350 (+6%: one line for it). The tokens the batch adds (chart-lit-top, -mid and -base in both themes, size-chart-plot-sm, size-chart-row, size-meter-marker and radius-2xs) took the art module 2087 to 2546 bytes (budget 2100 to 2600, +24%: the chart tokens are its group) and the core 31192 to 31250 (cap 31200 to 31300, +0.3%: radius-2xs). Only D7a names a skill module in the charts ballot; the lit marks, the headline frame, the phase chart, the share bar, the coverage strip, the marks row and the range meter are React-only in this batch. Added in the overlays-and-search PR (DECISIONS 155, D10b and D13a): the sheet gains React's head, body and foot (the 44px close, the 20/28 title over a 13px count, the divider and the safe areas; its CSS 3.6 to 5.2 KB, budget 4050 to 5250, +30%) and its usage 1050 to 1450 (+38%: the anatomy and the step's focus, two bullets); and one new module a page carries only when it uses it, search (React's SearchDialog: the form, the field's -2 outline, the count line, the fixed-height results area and the rows with their picture slots and full-bleed hover wash; CSS only, 4368 bytes, budget 4400, usage 2050; it requires the dialog). The dialog's title draws no ring when script focuses it. skillMd rose 10959 to 11079 for the search line (the sheet's line is unchanged: its usage carries the anatomy), so its cap rose 11000 to 11100 (+0.9%). The core's CSS grew 31192 to 31421 bytes for the six new size tokens (the wide dialog, the search trigger and the logo and picture slots of a search result): its cap rose 31200 to 31450 (+0.8%). The two 44px values (the sheet's close and the search field) are local to their modules, with a lint exception that says they join the controls batch's size token (DECISIONS 154). Set in integration-nov15b, where audit-design-a, audit-fix-c2, site-parts, port-controls, port-links-rows, port-charts and port-overlays-search meet: the combined tree measured SKILL.md 11560 bytes (the caps were 11000, 11100 and 11200: each side added index lines), core 34086 bytes (caps 31300 to 33550: every side's rules land in the core CSS and script), topbar 17660 (17600 from site-parts, plus audit-fix-c2's skip-link and focus work), number 3453 (3400), palette 11379 (11000, audit-fix-c2's hosted scrim plus the core search glyph), dialog 5120 (5100), toast 15692 (15400) and stage usage 2248 (2150), each over every side's cap, so each is set to the measured bytes rounded up to the next 50: skillMd 11200 to 11600, core 33550 to 34100, topbar 17600 to 17700, number 3400 to 3500, palette 11000 to 11400, dialog 5100 to 5150, toast 15400 to 15700, stage usage 2150 to 2250. The segment cap is the base's 5400 plus port-controls' 100 (5500), unchanged by the merge. Raised in integration-nov15b, join 2 (a link tab takes the selected state, DECISIONS 138 A, 145, 149 and 154's D12 row): link-tabs 4300 to 5750 (+34%: the module was 4174 bytes and is 5736; the 600 against 400, the reserved width and the second copy of a composed label, an icon drawn in both its forms, the same rules a tab carries, 1,530 bytes of CSS and script) and its usage 2400 to 2550 (+6%: one bullet). The cap is the measured bytes rounded up to the next 50; a module that needs the tab's rules carries them as the segment and tabs modules do, so a page without link tabs pays nothing. Raised in the panels, art and parts port (DECISIONS 162): table 3000 to 3150 and its usage 950 to 1450 (the flat form and the two-line cell), stage 2250 to 2600 and its usage 2250 to 3100 (the closing block: its held art, forced colours and print; its section gap is type-layout's --basalt-section-gap, which a page with data-closing brings), the new app-tile 4300 (a 120-point polygon clip and the hairline's mask of the same outline), captioned 2000 and period 1400; skillMd 11600 to 11950 for one index line each for captioned, app-tile and period (358 bytes; the file is 11918). Raised in the logs, status and forms port (DECISIONS 162): core 34100 to 34200 (the new size-field-label-inline token, 80px, is written into every page's tokens: 25 bytes); dlist 1300 to 1900 and its usage 950 to 1060 (the stacked form, R9 and R10: a title over its text, 20px between entries, no divider; one usage line). Raised in audit-fix-c6 (the owner's cap, raised by the builder and for the owner to confirm): glyph 1300 to 1900, for redrawing a glyph when its ancestor's aria-current or data-current moves (the lists that hold glyphs are watched). Raised in the colour-ink-ladder build (DECISIONS 166): core 34200 to 34350 (the four lifted dark inks are four new primitives, each written into every page's tokens: the core measured 34307). Raised in the audit-2-design build (DECISIONS 167, Q7a): disclosure 3500 to 3800 (the core chevron drawn as a mask in place of two borders: the module measured 3755). Joined in the integration of c7 (#86) and c10 (#91): option-chips 6750 to 6850 (c7's reset resync and c10's data-ready together measure 6839). Raised in table-sort-3 (DECISIONS 257 and 261, the owner's pick: three sort states, the arrow after the label, explainers on column titles): still-table 13400 to 14650 (+9.3%: the module was 13343 bytes and is 14602; the end-aligned label's move by a transform, its right-to-left sign and the indicator that waits for it on a fine pointer, 912 bytes of CSS; the third state, the sort from the table's own order and a .explainer kept out of the button, 347 bytes of script) and its usage 2150 to 2250 (2197: the third state and the own order); the new explainer module 5850 (5842: a manual native popover opened from the sort button on hover, keyboard focus and a long press, placed above the header or beside it, 1752 bytes of CSS and 4090 of script; a page without explainers pays nothing) and its usage 900; skillMd 12250 to 12400 for the explainer's index line (113 bytes; the file is 12352). Each cap is the measured bytes rounded up to the next 50. Raised in table-sort-3's fix pass (Astra's review): explainer 5850 to 6900 (+18%: 5842 to 6864 bytes; the gap between the header and the card kept while a pointer crosses it, the close when its header leaves the view whatever has focus, the dismissal held until pointer and focus have both left, and its page-wide listeners and timers scoped to an open card and stopped when the table leaves the page, 1,022 bytes of script). Raised in cimip-gaps-2 batch B5 (the touch sizes under 720 whatever the pointer: each coarse-pointer target rule also answers a window under 720, about 20 bytes a rule; forms merged its three into one and stays under 3500): select 9000 to 9100 (measured 9064), selection 1480 to 1500 (1486), filter 17450 to 17500 (17473), option-chips 6850 to 6900 (6853), menu 8900 to 8950 (8902). B5 fix pass 1 (Astra): core 34550 to 34950 (measured 34911: 30762 CSS and 4149 JS) for stacked links in a column, each giving up the side of its 44px box that meets a neighbour, so a tap on a link's words is always that link's; core had 12 bytes free. DECISIONS 274 (the owner's pick: under 720 the toast stack hangs from the bar): toast 15700 to 16050 (measured 16035; 8 bytes were free; the stack's direction became one sign variable, trimming 585 of the 920 bytes the phone form first took). B5 merged with main (5ad5345a): main's own core measured 34930 against its 34550 cap before B5; with B5 (the touch sizes under 720 and stacked links in a column) it is 35331, so core is 35350; nav 5350 to 5400 (measured 5364: B4's nav plus the touch size under 720). The full run after the stream (DECISIONS 246): the site footer's links keep their own flex column under 720, as React's, out of the bare-link touch rule (26 bytes), so core is 35400 (measured 35357); sheet 5250 to 5400 (measured 5368: React's B5 ring room, ported: the held actions reach space-1-5 above their band, clipped, and the body keeps space-1-5 at each end). Raised for diagram motion and service marks (DECISIONS 292): skillMd 12550 to 12650 for the diagram-motion module's one line; diagram 87200 to 91000 for what a still diagram now carries (a card's mark and its seat, the pending frame, the comparison that writes a drawing only when it changed, and the print rule), and its usage 2600 to 4300 for the decision's four lines and the list of mark ids; the new diagram-motion module (the motion engine, its stylesheet and the motion tokens, in a page only when a diagram is animated) at 26200. Raised when the diagram tests were first run (DECISIONS 298): diagram 91000 to 91250 and diagram-motion 26200 to 26850. Raised in batch A of the diagrams backlog (DECISIONS 301): diagram 91250 to 92400, for the engine fixes it bundles (a decision kept no taller than it is wide, labels on whole pixels, slots beside a straight line, a one-column schema's turn-back); the skill keeps the development checks a production React build now drops. Raised again in that batch's review fixes: diagram 92400 to 92650, for the drawn layout refusing two lines laid on one another (Neon's blocking finding 1 on #126). Fix round 1 of #124 had already taken them to 91205 and 26621 with the tests unrun; this round added 1 byte (every focal node prints its fill; a one-form mark's dark form falls back to its light one) and 180 (the entrance keeps its own clock when it is drawn again while paused).", + "$comment": "Which parts of the skill's CSS and JS a page gets. The core is always in. A module is in when the page's body has one of its classes, attributes or tags, matches one of its text patterns, or is named in a <!-- basalt:use name --> comment, and when another module needs it (requires). Modules are added in the order listed here, which is the order of the source files' cascade. classes: every class the module's CSS styles (the test checks them against the CSS and against SKILL.md). budget: the most bytes its minified CSS and JS may reach together. budgets: skillMd (SKILL.md, the context an agent pays: never above what it was), core (the CSS and JS of every page). icons: Phosphor names the module's script draws itself. Raised in the first parity PR (the owner's \"bring up the parity\"): forms (the number-input, search-clear and file-input chrome), disclosure (the native details marker), status (the accent reader and the forced-colours badge border), spinner (a fixed 16px ring), and the new number, range and accent modules. skillMd rose 10555 to 10900 for the new rules (number field, native chrome, the braille rule, the accent). Raised in the second parity PR (popup rows, levels and the segment's pill): segment 1400 to 3700 (the shared sliding pill: its script, 1.5 KB, and its CSS with the pill's two fallbacks), rows 3600 to 4300 (#27's plate-in-a-row geometry, the plate per level, the glide's shared plate and the forced-colours lit row, net of the removed bar), palette 9400 to 11300 (the glide's script, 2.4 KB: it follows the lit row, travels on a pointer, snaps on a key, and fades in place on leaving). The art module (DECISIONS 101 and 104) is the token groups only some pages name, taken out of the core so the core stays under its cap: the chart roles and lengths, the art colours, the aspect ratios and the stage headroom, in both themes (2087 bytes at 2100; it grows only when a token of those groups is added). A page gets it when its body names one of them, a var() in its own style included. The every-module page has no cap of its own (owner, DECISIONS 79): each part is capped, and a page carries only the parts it uses. usage: the most bytes of a module's usage text (src/usage/NAME.md; core.usage for core.md), which compose.mjs --usage prints on demand. It is context an agent pays only for the modules its page uses, so it is capped per part as SKILL.md and the CSS and script are (DECISIONS 79 and 109). Each is set a little above what its text was when the usage moved out of SKILL.md (DECISIONS 109); raising one needs a reason in the PR, and a rise of 40 to 50% is the owner's. textWords: each text pattern said in words, which compose.mjs --usage prints instead of the regular expression (one for each entry of text, in order). builds: modules a module requires whose markup its script writes, so --usage prints a line saying so instead of their usage text (the palette builds its own rows and key chips). The council's clarity check of the usage texts (all three: not yet clear) raised eight caps because the texts gained what an agent had to guess: callout 200 to 700 (the icon and one wrapper div around the title and body as markup, the four status icons, the role React's Callout renders), palette 1100 to 1300 (an item shown whole, keys as an array, keywords), stats 450 to 800 (a snippet of the figures and of the dl), tabs 500 to 650 (the unselected panels), code 250 to 450 (the markup and what each token class means), segment 150 to 300 (a click does not switch it), progress 150 to 350 (the empty span that paints the fill), theme 250 to 400 (leave the button empty), and accent 250 to 300. Topbar went down, 700 to 500, as its build detail was cut. Raised in the usage PR (the council's clarity check): palette 11300 to 11450 (the module grew 11283 to 11448, +165, about 1.5%), for the guard that makes a string `keys` warn and draw no chip instead of throwing in `keys.filter`, which the palette's usage already promised. Round 2 of the clarity check: tabs 650 to 750 (the panel's top space shown in the snippet, and that the script selects a tab on click). Raised in the site-icons and status PR (skill-parity part A, DECISIONS 106 and 107): status 1650 to 1900 (the neutral, pending and running marks, the badge's real border, and the forced-colours disc, net of the red danger word it drops) and its usage 400 to 1000 (every status in words, the word alone, running, forced colours); rows 4300 to 4450 (the profile list's seat rule and the status parts on a lit row) and its usage 300 to 600 (the profile list, with the one mistake: never an empty element for the seat). New: the links module (2671 bytes: the social row, the new-tab arrow's CSS and the script that draws it; budget 2750) and its usage (1746 bytes; cap 1850), which carries the social link, the glyph set, icon only and the new tab. Dropping Regular halves icons.json. Added in the overlay PR (skill-parity-4, batch 7 step 2, DECISIONS 108): the shared plate leaves palette.js for a glide module (the palette, a menu and the notification centre all call it), so the palette's cap went down, 11450 to 9250, and rows 4450 to 3850 (the plate's CSS moved to glide); and the overlay layer comes in as seven modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: popover (the native popup shell), menu, dialog (the dialog and alert dialog), sheet (on every side, the top one the site header's narrow menu), tooltip, toast and notifications (the centre). skillMd is unchanged in its cap (the eight new index lines fit within it); the core is unchanged in bytes. Added in the figures and charts PR (skill-parity-5, batch 7 step 3, DECISIONS 108): four modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: meter (React's Meter, CSS only, 2581 bytes), dlist (the description list, CSS only, 1265), terminal (the code block's transcript: its CSS, 3242, and the script that draws the gutter, the copy button and the replay, 4824) and chart (React's TimeChart and ChartGroup: 7313 of CSS and 23262 of script, which port chart.tsx's scale, layout, lane, labels, sentences, keyboard and table; it needs the art tokens, the table and the kbd chips, and a page without a chart carries none of it). Stats grew for the source line (budget 700 to 850, 798 bytes; its usage 800 to 950, 675 to 899 bytes, +33%, under the owner's 40 to 50%). skillMd is unchanged in its cap (four index lines fit within it); the core is unchanged in bytes. Added in the forms and selection PR (skill-parity-6, batch 7 step 4, DECISIONS 108): six modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: select (React's Select: the native select's closed trigger in every browser and, where `appearance: base-select` is shipped, the styled list with its two-line rows; a small script that says which input lit a row, 7740 bytes before it, choice (Checkbox, Radio, RadioGroup and Switch as styled native inputs; CSS only, with the first-frame rule), choice-card (ChoiceCard; CSS only), toggle (the pressed toggle's plate and check seat on .btn; CSS only), selection (a table's checkbox column: its fixed width and the script that sets aria-selected, the mixed header box and the count) and loops (the page-level hold on every loop with its switch: the held look and the script that stores it). The select's styles left forms, whose budget fell 3650 to 3250. skillMd rose 8621 to the size of its six new index lines, within its cap; the core is unchanged in bytes; compose adds the stored-hold line to the head of a page that has the loops module. Revised in the same PR (the lead's review of the build): the select gains select.js (one row is lit at a time, by whichever of the pointer and the keys moved last), and choice, toggle, selection and loops carry the first-frame rule, so a state a script sets on load (a mixed header box, the stored hold) paints at once with no crossfade. Added in the navigation and layout PR (skill-parity-7, batch 7 step 5, DECISIONS 108): five modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: glyph (Basalt's core glyphs drawn by name, at rest and selected, from a table the build works out from the drawn set; a page carries only the glyphs it names, and the drawing of a core glyph from data-glyph left the sheet module, which draws none now), nav (React's Nav: the sidebar's, the narrow menu's and More's rows, with the shared hugging pill), topbar-nav (the site header's links, one action and narrow menu, built by script from the bar's markup), app-shell (the shell, its sidebar and rail, and the app header) and tab-bar (the phone tab bar). The topbar module became the site header's bar (React's SiteHeader, DECISIONS 108: 56px with its line inside, the 44 by 44 brand target, the narrow-screen buttons, the derived sticky offset), budget 1600 to 3200 because its rules gained the app header's shared smoke, and its usage 500 to 750 (+50%) for the lockup's markup (the links, action and menu are topbar-nav's usage). Glide 3700 to 3950: the navigation's pill is a shape inside the row that the plate follows (about 200 bytes). The core's usage 2000 to 2100 (+5%): h2 is the Section step, the prose column's measure, and a link already 44px tall needs no margin. skillMd rose 9317 to 9863 for five index lines, under its cap; the core CSS grew 38 bytes (the layout tokens replace raw lengths, the gutter is one derived property, h2, .prose and .lead follow foundations) and the core script is unchanged. A module's media query writes %bp-md%, %bp-lg% or %bp-container% and the build substitutes the breakpoint tokens. Added in the tables and filters PR (skill-parity-8, batch 7 step 6, DECISIONS 108): the existing table module gains React's table additions (DECISIONS 95: the row header, \"Not observed\", the row density and the scroll hint with its small script), budget 1400 to 3000 (it was 1134 bytes of CSS; it is 2168 of CSS and 693 of script) and its usage 700 to 950 (+36%); and two modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: still-table (React's Table with `columns`: the fixed layout from a colgroup, the whole header cell as the sort button with its reserved seat, aria-sort, the pinned columns and their divider, the empty row; 4767 of CSS and 3264 of script, budget 8200) and filter (React's MultiSelect and FilterResult: the chips, the trigger and checklist with the search band from ten values, Clear held in place, the one debounced result line, and the narrowing of a table by `data-column`; 8240 of CSS and 7978 of script, budget 16400; it needs the popover, glide, glyph and choice modules). The core is unchanged in bytes. skillMd rose 9863 to 10128 for two index lines and the CaretUpDown icon's name, within its cap. Added in the commands PR (skill-parity-9, batch 7 step 7, DECISIONS 103 and 108): one new module a page carries only when it uses it, command-list (React's CommandList: the command panel set in the page, list plus preview, the push; it extends the palette and needs rows, kbd and glide; 5229 of CSS and 8734 of script, budget 14000, usage 2150). Two-line rows come to the existing modules: rows 3850 to 5350 (the described row's grid and description line, the push's chevron: 1481 bytes of CSS, the same rules React's menu rows carry), palette 9250 to 9900 (its rows are one function the list shares, with the description and the two-tier ranking of title matches over keyword and description matches; +636) and its usage 1300 to 1350, rows' usage 600 to 800, and glide 3950 to 4000 (a host that is idle counts as having no lit row, +54). skillMd rose 10128 to 10259 for one index line, within its cap; the core's CSS grew 24 bytes (.split.aside takes size-list-width in place of its raw 20rem: the same 320px, so no pixel moves) and the core script is unchanged. Added in the art PR (skill-parity-10, batch 7 step 8, DECISIONS 104 and 108): two modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: stage (React's Stage and PairedArt: full-bleed art under the site header, the pull-up by the sticky offset, the headroom, the paired art that follows the page's theme, and the forced-colours and print rules; CSS only, 1179 bytes) and framed-art (React's FramedArt: the figure, its rim and radius, the reserved box, the placeholder and the failed alt, the caption and credit; 2208 bytes of CSS and the 733-byte script that sets the frame's phase); both need the art tokens. The bar stays smoked over a stage: React clears it only over a stage that passed the headroom test helper, and a page has no test run (DECISIONS 108's note), so the skill builds no clear state. skillMd rose 10259 to 10500 for two index lines, within its cap; the core is unchanged in bytes. The callout gained the status rim in the same PR (DECISIONS 82, D8's status callouts): success, warning and danger draw their border in the status colour at 45% mixed in sRGB over the callout's own level, one solid colour on every side, and CanvasText in forced colours with the icon; the status colour is now one property the icon and the rim read. Its budget rose 900 to 1150 (the module is 1089 bytes, from 792: +297, about 37%); its usage is unchanged. Added in the overlays-and-the-rest PR (skill-parity-11, batch 7 step 9, DECISIONS 90 and 108): the last two parts of D8's part 5, each a module a page carries only when it uses it, with its own cap and usage cap set a little above its size: combobox (React's Combobox: the input with its caret button inside, the popup of the menu's rows with the glide's shared plate and two-line options, the filtering, the keys, the hidden value, the empty message and the check; 4342 of CSS and 6423 of script, budget 10900, usage 2150; it needs forms, popover and glide, and builds the last two) and sparkline (React's Sparkline: the label and latest value, the line, the axis, the empty sentence and the loading line that breathes; 1609 of CSS and 1874 of script, budget 3600, usage 950). The combobox copies the menu's row rules, as the select's list does, because React's Combobox renders MenuItem rows (a 40px hit area, a 36px plate) and the skill's .row is the palette's 44px: it carries no menu script. popover.js gains the combobox popup in the list of popups that keep focus where it is (+21 bytes, within its cap). skillMd rose 10500 to 10724 for two index lines, within its cap; the core is unchanged in bytes. Added in the motion-rules PR (DECISIONS 136 and 139): one module, ambient (a page's one ambient loop: CSS 828 bytes, script 433, budget 1300, usage 800), taken out of loops so the hold's own module grows only by the icon toggle's glyph swap (loops 2000 to 2200, +10%; its usage 1300 to 1650 for the icon form and the new settings-row sentence, +27%); and the chart's entrance (`entrance: true`: the marks' animations, their conditions and the redraw that restarts them at the elapsed time, 23262 to 25299 bytes of script; budget 30700 to 32800, +7%, usage 2500 to 2950, +18%). The core grew by the three tokens (27704 to 27862 bytes of CSS, under its cap). its stage usage gained the ambient art's line (1650 to 1750, +6%). skillMd rose 10724 to the size of the ambient index line, within its cap. Raised again in the motion-rules amendment (DECISIONS 143): chart 32800 to 33800 (script 25299 to 26375 bytes, +4%; +10% over the 30700 it began with) for the glide a new data set makes mid-entrance, print settling it, and `Basalt.pageChange()`; its usage 2950 to 3150 (+26% over the 2500 it began with). Raised in the second motion-rules amendment (DECISIONS 148): chart 33800 to 34400 (script 26375 to 26970 bytes: a line and its markers glide from their drawn geometry, and `beforeprint` settles the entrance; +12% over the 30700 it began with); topbar-nav 6900 to 7500 (+8.7%: the narrow menu's pause row, its CSS and 275 bytes of script, DECISIONS 148 item 2); loops usage 1650 to 1800 (+38% over the 1300 it began with, for the icon form's `title` and the menu row). Raised in the audit-design-b PR (DECISIONS 138 and 139): still-table 8200 to 13400 (+63%: the module was 7927 bytes and is 13311; the cut cell's plate, its focus stops and its dismissal, ported from React's cell-peek.ts, are 4273 bytes of script and 1111 of CSS; a still table that truncates needs them). The same PR: core usage 2100 to 2250 (+7%: the skip link, one bullet), forms usage 350 to 480 (+37%: the required mark), still-table usage 1950 to 2150 (+10%: the cut cell and the width rule), notifications usage 1050 to 1100 (+5%: the 44px entry on touch). The skip link's rim and radius took the core 30457 to 30609 bytes, under its cap (the rules that hang it under the bar are the topbar module's: 3200 to 3600, +12.5%); core 30720 to 31050 (+1.1%, DECISIONS 147: also the bar's links left out of the rule: the pseudo-element that makes a short standalone link a 44 by 44 target), skip-link script in the topbar module (3200 to 4150 over this PR, +30%: the rules that hang the link under the bar, 3600, and the script that reads the bar's real edge, 4150), sparkline 3600 to 4050 (+12.5%: React's ticker structure, so the value copies once on its line, and in forced colours the strips go and the number is plain text), forms budget 3250 to 3500 (+7.7%: the necessity word), notifications 9050 to 9250 (+2.2%: the 44px entry). Raised in the audit-design-b PR's E2 port (DECISIONS 138 and 139: the core set draws check, close, the chevrons, copy, plus, minus and search wherever a component draws them): the modules that drew a Phosphor icon for one of those now carry the core glyph's whole SVG, written in at build time (`%glyph-svg:name%`, the markup the glyph module's `_.glyph(name)` returns, so no module needs the glyph module and a page pays for nothing it does not use), and the Phosphor path of the same icon leaves the page. Each module's own bytes rose by that markup, and a page's total moved by what the Phosphor path it no longer carries saves: menu 8600 to 8900 (+303), combobox 10900 to 11200 (+303), copy 1900 to 2400 (+640), terminal 8100 to 8850 (+761), toast 13850 to 14150 (+325), number 2900 to 3400 (+557), filter 16400 to 17050 (+785), palette 9900 to 10450 (+536); the command list shares the palette's search drawing and fell 20 bytes. Set in integration-nov15, where the type-layout, motion-rules and audit-design-b branches meet: the combined tree measured SKILL.md 10959 bytes (each side's cap was 10900: both added index lines), core 31192 bytes (caps 30720 and 31050: the page-row and display rules, the three motion tokens and the skip link and 44px target rules all land in the core CSS) and core usage 2348 bytes (caps 2300 and 2250: type-layout's line and the skip-link bullet), so each is set to the measured bytes rounded up to the next 50: skillMd 10900 to 11000, core 31050 to 31200, core usage 2300 to 2350. Raised in the audit-design PR (decisions 138 and 139, parts A, D and C11): core 30720 to 31600 (+2.9%: the more-contrast block and its three aliases, and the field boundary token, every page carries as React does; the shadow-pill token is gone; the script gained `reserve`, 240 bytes), segment 3700 to 4100 and tabs 2300 to 2700 (the chosen label is 600 against 400, its width reserved by a span that carries its own copy, drawn unseen at 600; the pill's drop shadow is gone), and the segment's usage 300 to 380 (the weight and the glyph-only button). Raised again in the audit-design-a amendment (decision 145): core 31600 to 32300 (reserve() also reserves a label that is not plain text), segment 4100 to 5100 and tabs 2700 to 3500 (the second copy of such a label, and an icon drawn in both its forms), glyph 1100 to 1300 (a glyph in a segment or tab is drawn in both forms). Raised in the second audit-design-a amendment (decision 149): core 32300 to 32800 (reserve() builds the second copy of a label without any id, name, reference or hidden control, and does not copy a frame or media), segment 5100 to 5400 and its usage 380 to 500 (the 600 is on the label, the one-line rule and the usage text); the still-table cap is back at 8200, as the wash is on every cell again. Return 3 of the audit-design-a build (decision 149): tabs 3500 to 3700 (a tab the script has not reserved is 600 itself when selected, and one it declined is marked; the same two lines are in segment, which stays under 5400). Raised in the audit-fix-c2 PR (engineering, no pixel changes): toast 13850 to 14350 (the module was 13789 bytes and is 14288, +499, 3.6%) for F6, which focuses the Notifications region and Shift+Tab or Escape from it (or from the first toast) leaves it for where focus came from (and keeps a dialog's focus trap from wrapping it), as Base UI's viewport does in React, and for placing the region from focus (in the modal that holds it, or in the body), so a toast is never under a backdrop or in an inert modal whatever order the modals opened in (A3-09); the palette module grew 9864 to 9897 of its 9900 so that a palette opened over a modal sits inside it; topbar 3200 to 3250 (3123 to 3233, +110) for the scroll margin on what the bar holds, so a Tab into the bar from a scrolled page does not scroll the page (React's rule from PR #66); stage usage 1650 to 1750 (1580 to 1713, +8%) for the art's new place in the markup, after the content (A1-09), the stage's own CSS rising 1179 to 1208 within its 1250. skillMd rose 10724 to 10876 for the sentence that says a body may carry head tags, within its 10900. compose.mjs, the tool an agent runs, has no cap here (it is never in a page): it grew 21673 to 38153 bytes for the tokenizer that reads a body as HTML does and the head tags. Raised in the site-parts PR (DECISIONS 146, round 39), which folds each new part into the module it belongs with, so SKILL.md gains no index line (it has 41 bytes under its cap and a new module needs about 100): topbar 4150 to 17600 (+13450: the site footer and its disclosures, the lockup by pixel density, and a bar that arrives or leaves and returns, with its observer; a page that has a .topbar and no footer carries them too: the alternative, a module for each, needs its own index line and so SKILL.md bytes) and its usage 950 to 2900 (the footer's markup, the lockup's and the phase's); theme 650 to 4550 (the three-word theme choice: its CSS 2230 bytes and its script, 2277, with arrows, storage and the system listener) and its usage 400 to 1150 (the choice's markup written in full, so the right word is chosen before any script); segment 3700 to 3800 (a radio group's checked state besides a pressed button); stage 1250 to 2150 (its first script, 768 bytes, for fit and anchor) and its usage 1750 to 2000; framed-art 3000 to 3900 (drawn art in the frame: fit, anchor, no scaling strokes) and its usage 1250 to 1400. SKILL.md rose 10959 to 10992 (the topbar and theme index lines name .site-footer and .theme-choice). The head's theme line also writes data-theme-choice. Raised in site-parts return 2 (DECISIONS 146 B1 and B4): theme 4550 to 5350 (+800: the icon form of the theme choice, [data-theme-menu], whose button shows the theme in use, is named for the choice and opens the page's own .menu of three radio rows, in the theme script's 3073 bytes; the menu and popover modules are the page's, brought by its markup, so no module line was added and SKILL.md is 10993 of 11000) and its usage 1150 to 2200 (+91%: the menu's markup is written in full, and the deprecated toggle is said once); app-shell usage 2000 to 2100 and topbar-nav usage 1900 to 1950 (the theme control leaves the bar's text; the tools and the end cluster come in). The two example bodies still carry the deprecated data-theme-toggle. Return 2, F3 (DECISIONS 146 F): stage 2150 to 2250 (script 842 bytes: slice is the stage's default, as a frame's, and a drawing's own preserveAspectRatio stands unless the stage names data-fit or data-anchor) and its usage 2000 to 2150. framed-art 3900 to 4000 (a drawing's own preserveAspectRatio stands unless the figure names data-fit or data-anchor, +101 bytes). Return 3: theme 5350 to 5900 (script +569 bytes: who wrote data-theme, so System follows the system's change live and a theme the page set by hand, or a .dark or .light root, survives it). Raised in the controls port (DECISIONS 154): skillMd 11000 to 11200 for two index lines (link-tabs and option-chips, 214 bytes together), and core 31200 to 31600 for the nine tokens the port adds to every page's token CSS (the control rungs 44 to 64, two container widths, the confirm hold and the amount's opacity, 311 bytes). New modules (DECISIONS 154): link-tabs 2700 (its sizes, the 640 container step, the forced-colours underline, and the select that replaces the row under 720 with its 590-byte script, A15; it requires the select module), option-chips 5700 (the chip's states each written for a native radio inside a label, which needs :has on every one, plus the 1 KB script that keeps an aria-disabled chip reachable and never chosen). Return 3 (DECISIONS 154 conformance): link-tabs 2700 to 3100 and its usage 1650 to 1850 (the select's height for each row size, and a script that reads aria-current when it is needed and watches it move: 3,048 bytes), option-chips 5700 to 6700 (each state written twice, as a state attribute and as :has(), so no browser needs :has(): 4,975 CSS and 1,623 script). Return 4 (DECISIONS 158, Q2): link-tabs 3100 to 4300 and its usage 1850 to 2400 (the \"Go to\" label drawn at the select's start with its measured clearance, the select's accessible name kept as the words and the chosen page's, and the key hold that keeps a letter or an arrow on the closed select from navigating: 4,174 bytes, CSS 2,951 and script 1,223). Raised in the links-and-rows port (DECISIONS 152; the owner's approval is the lead's to confirm): the new link-rows module (5050 bytes of CSS, 50 of them for Castle's big-row arrow stepping colour over duration-fast, return 1, 1500 of usage: the directory's and the big rows' CSS, whose arrow is a core glyph drawn as a mask, and their tokens, size-row taken out of the core like type-layout's), disclosure 1550 to 3500 (Show all: the track, the clip and the settle, 1.5 KB of script and 1.8 KB of CSS), copy 2400 to 3500 (the form with words: the one cell and its script). SKILL.md rose 10959 to 10997 for one line, within its 11000 cap. Raised in the charts port PR (DECISIONS 153, D7a): chart 34400 to 34650 (script 26970 to 27270 bytes, +1.1% on the 34283 it was: `Basalt.trailingMean`, the trend maths React exports as `trailingMean`, 300 bytes), its usage 3150 to 3350 (+6%: one line for it). The tokens the batch adds (chart-lit-top, -mid and -base in both themes, size-chart-plot-sm, size-chart-row, size-meter-marker and radius-2xs) took the art module 2087 to 2546 bytes (budget 2100 to 2600, +24%: the chart tokens are its group) and the core 31192 to 31250 (cap 31200 to 31300, +0.3%: radius-2xs). Only D7a names a skill module in the charts ballot; the lit marks, the headline frame, the phase chart, the share bar, the coverage strip, the marks row and the range meter are React-only in this batch. Added in the overlays-and-search PR (DECISIONS 155, D10b and D13a): the sheet gains React's head, body and foot (the 44px close, the 20/28 title over a 13px count, the divider and the safe areas; its CSS 3.6 to 5.2 KB, budget 4050 to 5250, +30%) and its usage 1050 to 1450 (+38%: the anatomy and the step's focus, two bullets); and one new module a page carries only when it uses it, search (React's SearchDialog: the form, the field's -2 outline, the count line, the fixed-height results area and the rows with their picture slots and full-bleed hover wash; CSS only, 4368 bytes, budget 4400, usage 2050; it requires the dialog). The dialog's title draws no ring when script focuses it. skillMd rose 10959 to 11079 for the search line (the sheet's line is unchanged: its usage carries the anatomy), so its cap rose 11000 to 11100 (+0.9%). The core's CSS grew 31192 to 31421 bytes for the six new size tokens (the wide dialog, the search trigger and the logo and picture slots of a search result): its cap rose 31200 to 31450 (+0.8%). The two 44px values (the sheet's close and the search field) are local to their modules, with a lint exception that says they join the controls batch's size token (DECISIONS 154). Set in integration-nov15b, where audit-design-a, audit-fix-c2, site-parts, port-controls, port-links-rows, port-charts and port-overlays-search meet: the combined tree measured SKILL.md 11560 bytes (the caps were 11000, 11100 and 11200: each side added index lines), core 34086 bytes (caps 31300 to 33550: every side's rules land in the core CSS and script), topbar 17660 (17600 from site-parts, plus audit-fix-c2's skip-link and focus work), number 3453 (3400), palette 11379 (11000, audit-fix-c2's hosted scrim plus the core search glyph), dialog 5120 (5100), toast 15692 (15400) and stage usage 2248 (2150), each over every side's cap, so each is set to the measured bytes rounded up to the next 50: skillMd 11200 to 11600, core 33550 to 34100, topbar 17600 to 17700, number 3400 to 3500, palette 11000 to 11400, dialog 5100 to 5150, toast 15400 to 15700, stage usage 2150 to 2250. The segment cap is the base's 5400 plus port-controls' 100 (5500), unchanged by the merge. Raised in integration-nov15b, join 2 (a link tab takes the selected state, DECISIONS 138 A, 145, 149 and 154's D12 row): link-tabs 4300 to 5750 (+34%: the module was 4174 bytes and is 5736; the 600 against 400, the reserved width and the second copy of a composed label, an icon drawn in both its forms, the same rules a tab carries, 1,530 bytes of CSS and script) and its usage 2400 to 2550 (+6%: one bullet). The cap is the measured bytes rounded up to the next 50; a module that needs the tab's rules carries them as the segment and tabs modules do, so a page without link tabs pays nothing. Raised in the panels, art and parts port (DECISIONS 162): table 3000 to 3150 and its usage 950 to 1450 (the flat form and the two-line cell), stage 2250 to 2600 and its usage 2250 to 3100 (the closing block: its held art, forced colours and print; its section gap is type-layout's --basalt-section-gap, which a page with data-closing brings), the new app-tile 4300 (a 120-point polygon clip and the hairline's mask of the same outline), captioned 2000 and period 1400; skillMd 11600 to 11950 for one index line each for captioned, app-tile and period (358 bytes; the file is 11918). Raised in the logs, status and forms port (DECISIONS 162): core 34100 to 34200 (the new size-field-label-inline token, 80px, is written into every page's tokens: 25 bytes); dlist 1300 to 1900 and its usage 950 to 1060 (the stacked form, R9 and R10: a title over its text, 20px between entries, no divider; one usage line). Raised in audit-fix-c6 (the owner's cap, raised by the builder and for the owner to confirm): glyph 1300 to 1900, for redrawing a glyph when its ancestor's aria-current or data-current moves (the lists that hold glyphs are watched). Raised in the colour-ink-ladder build (DECISIONS 166): core 34200 to 34350 (the four lifted dark inks are four new primitives, each written into every page's tokens: the core measured 34307). Raised in the audit-2-design build (DECISIONS 167, Q7a): disclosure 3500 to 3800 (the core chevron drawn as a mask in place of two borders: the module measured 3755). Joined in the integration of c7 (#86) and c10 (#91): option-chips 6750 to 6850 (c7's reset resync and c10's data-ready together measure 6839). Raised in table-sort-3 (DECISIONS 257 and 261, the owner's pick: three sort states, the arrow after the label, explainers on column titles): still-table 13400 to 14650 (+9.3%: the module was 13343 bytes and is 14602; the end-aligned label's move by a transform, its right-to-left sign and the indicator that waits for it on a fine pointer, 912 bytes of CSS; the third state, the sort from the table's own order and a .explainer kept out of the button, 347 bytes of script) and its usage 2150 to 2250 (2197: the third state and the own order); the new explainer module 5850 (5842: a manual native popover opened from the sort button on hover, keyboard focus and a long press, placed above the header or beside it, 1752 bytes of CSS and 4090 of script; a page without explainers pays nothing) and its usage 900; skillMd 12250 to 12400 for the explainer's index line (113 bytes; the file is 12352). Each cap is the measured bytes rounded up to the next 50. Raised in table-sort-3's fix pass (Astra's review): explainer 5850 to 6900 (+18%: 5842 to 6864 bytes; the gap between the header and the card kept while a pointer crosses it, the close when its header leaves the view whatever has focus, the dismissal held until pointer and focus have both left, and its page-wide listeners and timers scoped to an open card and stopped when the table leaves the page, 1,022 bytes of script). Raised in cimip-gaps-2 batch B5 (the touch sizes under 720 whatever the pointer: each coarse-pointer target rule also answers a window under 720, about 20 bytes a rule; forms merged its three into one and stays under 3500): select 9000 to 9100 (measured 9064), selection 1480 to 1500 (1486), filter 17450 to 17500 (17473), option-chips 6850 to 6900 (6853), menu 8900 to 8950 (8902). B5 fix pass 1 (Astra): core 34550 to 34950 (measured 34911: 30762 CSS and 4149 JS) for stacked links in a column, each giving up the side of its 44px box that meets a neighbour, so a tap on a link's words is always that link's; core had 12 bytes free. DECISIONS 274 (the owner's pick: under 720 the toast stack hangs from the bar): toast 15700 to 16050 (measured 16035; 8 bytes were free; the stack's direction became one sign variable, trimming 585 of the 920 bytes the phone form first took). B5 merged with main (5ad5345a): main's own core measured 34930 against its 34550 cap before B5; with B5 (the touch sizes under 720 and stacked links in a column) it is 35331, so core is 35350; nav 5350 to 5400 (measured 5364: B4's nav plus the touch size under 720). The full run after the stream (DECISIONS 246): the site footer's links keep their own flex column under 720, as React's, out of the bare-link touch rule (26 bytes), so core is 35400 (measured 35357); sheet 5250 to 5400 (measured 5368: React's B5 ring room, ported: the held actions reach space-1-5 above their band, clipped, and the body keeps space-1-5 at each end). Raised for diagram motion and service marks (DECISIONS 292): skillMd 12550 to 12650 for the diagram-motion module's one line; diagram 87200 to 91000 for what a still diagram now carries (a card's mark and its seat, the pending frame, the comparison that writes a drawing only when it changed, and the print rule), and its usage 2600 to 4300 for the decision's four lines and the list of mark ids; the new diagram-motion module (the motion engine, its stylesheet and the motion tokens, in a page only when a diagram is animated) at 26200. Raised when the diagram tests were first run (DECISIONS 298): diagram 91000 to 91250 and diagram-motion 26200 to 26850. Raised in batch A of the diagrams backlog (DECISIONS 301): diagram 91250 to 92400, for the engine fixes it bundles (a decision kept no taller than it is wide, labels on whole pixels, slots beside a straight line, a one-column schema's turn-back); the skill keeps the development checks a production React build now drops. Raised again in that batch's review fixes: diagram 92400 to 92650, for the drawn layout refusing two lines laid on one another (Neon's blocking finding 1 on #126). Fix round 1 of #124 had already taken them to 91205 and 26621 with the tests unrun; this round added 1 byte (every focal node prints its fill; a one-form mark's dark form falls back to its light one) and 180 (the entrance keeps its own clock when it is drawn again while paused). DECISIONS 320 (versions and release notes): the release module is new (budget 15900 at first, usage 2400); topbar, app-shell and tab-bar gain the version link's classes (budgets: topbar 17700 to 19900, app-shell 4300 to 5200 with the rail's tooltip for it, tab-bar 4850 to 5200), their usage caps rising 2900 to 3100, 2600 to 2850 and 2250 to 2400 for its one line each; skillMd rose 12650 to 12800 for the release module's line and .version-link in topbar's. The code review of round 68 adds data-focus-self to the popover module (its Tab walk; budget 4950 to 5600, usage cap 950 to 1100) and logical start and end for its alignment; the release module's header grid and the Sources panel's touch rows take it to 16900. The spacing sweep of round 68 (DECISIONS 326: Copy link's words on the edge, the callout's last change, its reference column, the last release, the touch rows' end and the whole code chip) takes the release module to 17400. The ruling on where a release ends (DECISIONS 331: no padding under the last change in a release, a release-ending fold's hang, an arrived change keeping its padding, the panel holding its first margin, Build details 44 on touch and a closed Fixed panel taking no room) takes it to 19000. The code recheck of round 68 (recheck 5) has the popover's Tab walk follow Safari's own rule (Tab skips links on Apple's WebKit, Option-Tab reaches them): popover 5600 to 5900. The pixel recheck of round 68 has the Sources panel's touch rows keep their 20px lines with the link's box as hit area, space-3 rows and space-6 between two linked values (recheck-pixels 4), and the release's whole header take the arrival's plate: release 19000 to 19600. Merging #127 (stages, DECISIONS 316 and 328) into the versioning branch: both had raised skillMd from 12650 to 12800 for their own module's line, and together they came to 12886; SKILL.md was tightened in its wording (no rule dropped) to stay within 12800.", "budgets": { "skillMd": 12800, "core": 35550 @@ -75,10 +75,16 @@ "site-footer-group", "site-footer-label", "site-footer-base", - "site-footer-legal" - ], - "budget": 17700, - "usage": 2900, + "site-footer-legal", + "version-link", + "version-link-words", + "version-link-number", + "version-link-pre", + "version-link-date", + "site-footer-legal-row" + ], + "budget": 19900, + "usage": 3100, "attrs": [ "data-phase-after" ] @@ -1036,8 +1042,8 @@ "attrs": [ "popovertarget" ], - "budget": 4950, - "usage": 950 + "budget": 5900, + "usage": 1100 }, "menu": { "classes": [ @@ -1320,7 +1326,8 @@ "app-title", "app-actions", "app-heading", - "app-facts" + "app-facts", + "app-version" ], "requires": [ "topbar", @@ -1328,8 +1335,8 @@ "tooltip" ], "viewportFit": true, - "budget": 4300, - "usage": 2600 + "budget": 5200, + "usage": 2850 }, "pane": { "classes": [ @@ -1341,6 +1348,64 @@ "budget": 1700, "usage": 1000 }, + "release": { + "classes": [ + "release-notes", + "release", + "release-head", + "release-head-text", + "release-word", + "release-heading", + "release-version", + "release-meta", + "release-badges", + "release-action-link", + "release-copy", + "release-summary", + "release-paragraph", + "release-audience", + "release-audience-title", + "release-action", + "release-callout-title", + "release-upgrade", + "release-section", + "release-section-title", + "release-count", + "release-all", + "release-fold", + "release-fold-title", + "release-fold-panel", + "release-build", + "release-build-list", + "release-list", + "release-entry", + "release-entry-words", + "release-entry-text", + "release-area", + "release-migrate", + "release-source-cell", + "release-source", + "release-id", + "release-sources", + "release-sources-list", + "release-mono", + "release-index", + "release-index-title", + "release-index-list", + "release-index-link", + "release-index-number" + ], + "requires": [ + "disclosure", + "callout", + "popover", + "dlist", + "copy", + "status" + ], + "budget": 19600, + "usage": 2400 + }, "tab-bar": { "classes": [ "tab-bar", @@ -1349,11 +1414,12 @@ "tab-bar-glyph", "tab-bar-label", "tab-bar-dot", - "tab-bar-sheet-head" + "tab-bar-sheet-head", + "tab-bar-version" ], "viewportFit": true, - "budget": 4850, - "usage": 2250 + "budget": 5200, + "usage": 2400 } } } diff --git a/.agent/skills/basalt-html/parts/popover.js b/.agent/skills/basalt-html/parts/popover.js index d2024697..b91aa236 100644 --- a/.agent/skills/basalt-html/parts/popover.js +++ b/.agent/skills/basalt-html/parts/popover.js @@ -1 +1 @@ -(function(A){"use strict";var h=A._,E=0,i=5,y='.float[popover]:not([role="tooltip"])';h.tabbables=function(t){return Array.prototype.filter.call(t.querySelectorAll('a[href],button:not([disabled]),input:not([disabled]):not([type=hidden]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])'),function(e){return e.getClientRects().length&&!e.closest("[hidden],[inert]")})},h.place=function(t,e,o){o=o||{};var r=o.side||"bottom",n=o.align||"start",s=o.offset==null?6:o.offset,a=e.getBoundingClientRect(),l=document.documentElement.clientWidth,b=document.documentElement.clientHeight,c={top:a.top-s-i,bottom:b-a.bottom-s-i,left:a.left-s-i,right:l-a.right-s-i},g={top:"bottom",bottom:"top",left:"right",right:"left"},_=r==="top"||r==="bottom",u=t.style;u.setProperty("--available-height",Math.max(c[r],c[g[r]])+"px"),u.setProperty("--available-width",l-2*i+"px"),(_?t.offsetHeight:t.offsetWidth)>c[r]&&c[g[r]]>c[r]&&(r=g[r]),u.setProperty("--available-height",Math.max(c[r],0)+"px");var f=t.offsetWidth,v=t.offsetHeight,x=function(d){return _?{x:d==="start"?a.left:d==="end"?a.right-f:a.left+(a.width-f)/2,y:r==="bottom"?a.bottom+s:a.top-s-v}:{x:r==="right"?a.right+s:a.left-s-f,y:d==="start"?a.top:d==="end"?a.bottom-v:a.top+(a.height-v)/2}},w=function(d){return d.x>=i&&d.y>=i&&d.x+f<=l-i&&d.y+v<=b-i},m=x(n);!w(m)&&n!=="center"&&w(x(n==="start"?"end":"start"))&&(n=n==="start"?"end":"start",m=x(n));var L=Math.max(i,Math.min(m.x,l-i-f)),q=Math.max(i,Math.min(m.y,b-i-v));u.left=Math.round(L)+"px",u.top=Math.round(q)+"px";var H=n==="center"?"center":n==="start"?"left":"right";u.setProperty("--origin",_?(r==="bottom"?"top ":"bottom ")+H:(r==="right"?"left ":"right ")+(n==="center"?"center":n==="start"?"top":"bottom")),t.setAttribute("data-placed",r)};function P(t,e){return e&&e.source||document.querySelector('[popovertarget="'+t.id+'"]')||t.dataset.anchor&&document.querySelector(t.dataset.anchor)}function M(t,e){var o=P(t,e);t.__anchor=o,t.hasAttribute("role")||t.setAttribute("role",t.matches(".menu")?"menu":"dialog");var r=t.querySelector(".popover-title");if(r&&!t.hasAttribute("aria-labelledby")&&!t.hasAttribute("aria-label")&&(r.id=r.id||"bh-pop-"+ ++E,t.setAttribute("aria-labelledby",r.id)),o){o.setAttribute("aria-expanded","true"),o.hasAttribute("aria-haspopup")||o.setAttribute("aria-haspopup",t.getAttribute("role")==="menu"?"menu":"dialog");var n=function(){h.place(t,o,{side:t.dataset.side,align:t.dataset.align})};n(),t.__again=n,window.addEventListener("resize",n),window.addEventListener("scroll",n,!0)}if(t.__bhFocus||(t.__bhFocus=!0,t.addEventListener("focusout",function(a){var l=a.relatedTarget;l&&!t.contains(l)&&l!==t.__anchor&&!(l.closest&&l.closest("[popover]:popover-open"))&&t.matches(":popover-open")&&t.hidePopover()})),!t.matches('[role="menu"], .combobox-popup')){var s=h.tabbables(t)[0];s||t.setAttribute("tabindex","-1"),(s||t).focus({preventScroll:!0})}}function S(t){t.__again&&(window.removeEventListener("resize",t.__again),window.removeEventListener("scroll",t.__again,!0),t.__again=null);var e=t.__anchor;e&&(e.setAttribute("aria-expanded","false"),t.__had&&(!document.activeElement||document.activeElement===document.body)&&e.focus({preventScroll:!0})),t.__had=!1}h.step(120,"wirePopover",function(){document.documentElement.__bhPopover||(document.documentElement.__bhPopover=!0,document.addEventListener("beforetoggle",function(t){var e=t.target;t.newState==="closed"&&e.matches&&e.matches(y)&&(e.__had=e.contains(document.activeElement))},!0),document.addEventListener("toggle",function(t){var e=t.target;!e.matches||!e.matches(y)||(t.newState==="open"?M(e,t):S(e))},!0))})})(window.Basalt); +(function(A){"use strict";var m=A._,E=0,o=5,w='.float[popover]:not([role="tooltip"])';m.tabbables=function(t){return Array.prototype.filter.call(t.querySelectorAll('a[href],button:not([disabled]),input:not([disabled]):not([type=hidden]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])'),function(e){return e.getClientRects().length&&!e.closest("[hidden],[inert]")})},m.place=function(t,e,i){i=i||{};var a=i.side||"bottom",s=i.align||"start",u=i.offset==null?6:i.offset,r=e.getBoundingClientRect(),g=document.documentElement.clientWidth,_=document.documentElement.clientHeight,n={top:r.top-u-o,bottom:_-r.bottom-u-o,left:r.left-u-o,right:g-r.right-u-o},l={top:"bottom",bottom:"top",left:"right",right:"left"},c=a==="top"||a==="bottom",d=t.style;d.setProperty("--available-height",Math.max(n[a],n[l[a]])+"px"),d.setProperty("--available-width",g-2*o+"px"),(c?t.offsetHeight:t.offsetWidth)>n[a]&&n[l[a]]>n[a]&&(a=l[a]),d.setProperty("--available-height",Math.max(n[a],0)+"px");var f=t.offsetWidth,h=t.offsetHeight,b=function(v){return c?{x:v==="start"?r.left:v==="end"?r.right-f:r.left+(r.width-f)/2,y:a==="bottom"?r.bottom+u:r.top-u-h}:{x:a==="right"?r.right+u:r.left-u-f,y:v==="start"?r.top:v==="end"?r.bottom-h:r.top+(r.height-h)/2}},y=function(v){return v.x>=o&&v.y>=o&&v.x+f<=g-o&&v.y+h<=_-o},x=b(s);!y(x)&&s!=="center"&&y(b(s==="start"?"end":"start"))&&(s=s==="start"?"end":"start",x=b(s));var M=Math.max(o,Math.min(x.x,g-o-f)),q=Math.max(o,Math.min(x.y,_-o-h));d.left=Math.round(M)+"px",d.top=Math.round(q)+"px";var k=s==="center"?"center":s==="start"?"left":"right";d.setProperty("--origin",c?(a==="bottom"?"top ":"bottom ")+k:(a==="right"?"left ":"right ")+(s==="center"?"center":s==="start"?"top":"bottom")),t.setAttribute("data-placed",a)};function P(t,e){return e&&e.source||document.querySelector('[popovertarget="'+t.id+'"]')||t.dataset.anchor&&document.querySelector(t.dataset.anchor)}function S(t,e){var i=P(t,e);t.__anchor=i,t.hasAttribute("role")||t.setAttribute("role",t.matches(".menu")?"menu":"dialog");var a=t.querySelector(".popover-title");if(a&&!t.hasAttribute("aria-labelledby")&&!t.hasAttribute("aria-label")&&(a.id=a.id||"bh-pop-"+ ++E,t.setAttribute("aria-labelledby",a.id)),i){i.setAttribute("aria-expanded","true"),i.hasAttribute("aria-haspopup")||i.setAttribute("aria-haspopup",t.getAttribute("role")==="menu"?"menu":"dialog");var s=getComputedStyle(i).direction==="rtl",u=s&&t.dataset.align==="end"?"start":s&&(!t.dataset.align||t.dataset.align==="start")?"end":t.dataset.align,r=function(){m.place(t,i,{side:t.dataset.side,align:u})};r(),t.__again=r,window.addEventListener("resize",r),window.addEventListener("scroll",r,!0)}if(t.__bhFocus||(t.__bhFocus=!0,t.addEventListener("focusout",function(n){var l=n.relatedTarget;l&&!t.contains(l)&&l!==t.__anchor&&!(l.closest&&l.closest("[popover]:popover-open"))&&t.matches(":popover-open")&&t.hidePopover()})),t.hasAttribute("data-focus-self")){if(t.setAttribute("tabindex","-1"),t.focus({preventScroll:!0}),!t.__bhTab){t.__bhTab=!0;var g=/^Apple/.test(navigator.vendor||"");t.addEventListener("keydown",function(n){if(!(n.key!=="Tab"||n.defaultPrevented)){var l=!g||n.altKey,c=m.tabbables(t).filter(function(x){return l||!x.matches("a[href], area[href]")}),d=document.activeElement,f=d===t?-1:c.indexOf(d);if(f<0&&d!==t){for(var h=c.length,b=0;b<c.length;b++)if(d.compareDocumentPosition(c[b])&4){h=b;break}f=n.shiftKey?h:h-1}var y=f+(n.shiftKey?-1:1);if(n.preventDefault(),y>=c.length){t.hidePopover(),t.__anchor&&t.__anchor.focus({preventScroll:!0});return}(y<0?t:c[y]).focus({preventScroll:!0})}})}}else if(!t.matches('[role="menu"], .combobox-popup')){var _=m.tabbables(t)[0];_||t.setAttribute("tabindex","-1"),(_||t).focus({preventScroll:!0})}}function L(t){t.__again&&(window.removeEventListener("resize",t.__again),window.removeEventListener("scroll",t.__again,!0),t.__again=null);var e=t.__anchor;e&&(e.setAttribute("aria-expanded","false"),t.__had&&(!document.activeElement||document.activeElement===document.body)&&e.focus({preventScroll:!0})),t.__had=!1}m.step(120,"wirePopover",function(){document.documentElement.__bhPopover||(document.documentElement.__bhPopover=!0,document.addEventListener("beforetoggle",function(t){var e=t.target;t.newState==="closed"&&e.matches&&e.matches(w)&&(e.__had=e.contains(document.activeElement))},!0),document.addEventListener("toggle",function(t){var e=t.target;!e.matches||!e.matches(w)||(t.newState==="open"?S(e,t):L(e))},!0))})})(window.Basalt); diff --git a/.agent/skills/basalt-html/parts/release.css b/.agent/skills/basalt-html/parts/release.css new file mode 100644 index 00000000..4a08027c --- /dev/null +++ b/.agent/skills/basalt-html/parts/release.css @@ -0,0 +1 @@ +@layer basalt{.release-notes{--basalt-plate: var(--basalt-plate-0)}.release-action{--basalt-plate: var(--basalt-plate-1)}.release-fold{justify-content:space-between;gap:var(--basalt-space-3)}.release-fold:after{background:var(--basalt-text-secondary)}.release-word{display:none;margin-bottom:var(--basalt-space-1);color:var(--basalt-text-secondary);font:var(--basalt-font-weight-regular) var(--bh-xs);letter-spacing:var(--basalt-text-xs-tracking);white-space:nowrap;opacity:0;visibility:hidden;transition:opacity calc(var(--basalt-duration-slow) * .75) var(--basalt-ease-in),visibility var(--basalt-duration-instant) linear calc(var(--basalt-duration-slow) * .75)}:is(.release-entry[data-arrival]>.release-word,.release[data-arrival]>.release-head .release-word){display:block}:is(.release-entry[data-arrived]>.release-word,.release[data-arrived]>.release-head .release-word){opacity:1;visibility:visible;transition-duration:var(--basalt-duration-instant);transition-delay:var(--basalt-duration-instant)}@media(forced-colors:active){.release-word{color:CanvasText}}@media(prefers-reduced-motion:reduce){.release-word,.release-entry:before,.release-head:before{transition-property:none}}.release-notes{min-width:0;font-family:var(--basalt-font-family-sans);color:var(--basalt-text-primary)}.release{container-type:inline-size;max-width:calc(var(--basalt-size-prose-width) + var(--basalt-space-6) + var(--basalt-size-sidebar-width));padding-block:var(--basalt-space-10);border-top:var(--basalt-size-hairline) solid var(--basalt-border-divider);scroll-margin-top:calc(var(--basalt-sticky-offset, var(--basalt-space-0)) + var(--basalt-space-4))}.release:first-of-type{padding-top:0;border-top:0}.release:last-of-type{padding-bottom:0}.release-notes>.release-build:first-child{max-width:calc(var(--basalt-size-prose-width) + var(--basalt-space-6) + var(--basalt-size-sidebar-width));margin:0 0 var(--basalt-space-6)}.release:focus,.release-entry:focus{outline:none}.release-head{position:relative;isolation:isolate;display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:var(--basalt-space-4);align-items:center}.release-head-text{display:contents}.release-head-text>*{grid-column:1 / -1;min-width:0}.release-head-text>.release-word{grid-row:1}.release-head-text>:is(.release-number-line,.release-heading:not([data-headline])){grid-column:1;grid-row:2}.release-head-text>.release-heading[data-headline]{grid-row:3}.release-head-text>.release-heading[data-headline]~.release-meta{grid-row:4}.release-head-text>.release-heading:not([data-headline])~.release-meta{grid-row:3}.release-head-text>:not(.release-word)~*{margin-top:var(--basalt-space-1)}.release-head>.release-copy{grid-column:2;grid-row:2;align-self:center;margin-block:calc(-1 * var(--basalt-size-tap-min));margin-inline-end:calc(-1 * var(--basalt-space-2-5))}.release-heading{margin:0;font:var(--basalt-font-weight-semibold) var(--basalt-text-2xl-size) / var(--basalt-text-2xl-line-height) var(--basalt-font-family-sans);letter-spacing:var(--basalt-text-2xl-tracking);text-wrap:balance;overflow-wrap:break-word}.release-version{font-family:var(--basalt-font-family-mono);letter-spacing:0;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}.release-version[data-words]{font-family:var(--basalt-font-family-sans);letter-spacing:var(--basalt-text-2xl-tracking)}.release-meta{margin:0;color:var(--basalt-text-secondary);font:var(--basalt-font-weight-regular) var(--basalt-text-sm-size) / var(--basalt-text-sm-line-height) var(--basalt-font-family-sans);letter-spacing:var(--basalt-text-sm-tracking);font-variant-numeric:tabular-nums}.release-badges{display:inline-flex;gap:var(--basalt-space-2);margin-inline-start:var(--basalt-space-2);vertical-align:middle}.release-action-link{position:relative;z-index:1;color:inherit;text-decoration:underline;text-decoration-color:var(--basalt-border-input);text-decoration-thickness:var(--basalt-size-hairline);text-underline-offset:var(--basalt-size-underline-offset);border-radius:var(--basalt-radius-xs)}.release-action-link:hover{color:var(--basalt-text-primary);text-decoration-color:currentColor}.release-action-link:focus-visible{outline:var(--basalt-size-focus-width) solid var(--basalt-border-focus);outline-offset:var(--basalt-size-focus-offset)}.release-copy{flex:none}.release-summary,.release-paragraph{margin:0;max-width:var(--basalt-size-prose-width);font-size:var(--basalt-text-md-size);line-height:var(--basalt-text-md-line-height);letter-spacing:var(--basalt-text-md-tracking);text-wrap:pretty}.release-summary{margin-top:var(--basalt-space-4)}.release-audience{display:grid;gap:var(--basalt-space-1);margin-top:var(--basalt-space-4)}.release-audience-title{margin:0;font:var(--basalt-font-weight-semibold) var(--basalt-text-md-size) / var(--basalt-text-md-line-height) var(--basalt-font-family-sans);letter-spacing:var(--basalt-text-md-tracking)}.release-action{margin-top:var(--basalt-space-6)}.release-action>div{flex:1;min-width:0}.release-action .release-list{grid-template-columns:minmax(0,calc(var(--basalt-size-prose-width) - var(--basalt-size-hairline) - var(--basalt-space-4) - var(--basalt-size-icon-sm) - var(--basalt-space-3))) minmax(0,max-content)}.release-callout-title{margin:0;font:inherit;letter-spacing:inherit}.release-action .callout-body{color:var(--basalt-text-primary)}.release-upgrade{margin:0 0 var(--basalt-space-2);color:var(--basalt-text-secondary)}.release-section,.release-all{margin-top:var(--basalt-space-6)}.release-section-title{margin:0 0 var(--basalt-space-2);font:var(--basalt-font-weight-semibold) var(--basalt-text-md-size) / var(--basalt-text-md-line-height) var(--basalt-font-family-sans);letter-spacing:var(--basalt-text-md-tracking)}.release-count{margin-inline-start:var(--basalt-space-1);color:var(--basalt-text-tertiary);font-weight:var(--basalt-font-weight-regular);font-variant-numeric:tabular-nums}.release-action .release-count{color:var(--basalt-text-secondary)}.release-all .release-summary,.release-all .release-section:first-child{margin-top:var(--basalt-space-2)}.release-all .release-summary+.release-section{margin-top:var(--basalt-space-4)}.release-all .release-section-title{font-size:var(--basalt-text-base-size);line-height:var(--basalt-text-base-line-height);letter-spacing:var(--basalt-text-base-tracking)}.release-fold{min-height:var(--basalt-text-md-line-height);padding:0;font:var(--basalt-font-weight-semibold) var(--basalt-text-md-size) / var(--basalt-text-md-line-height) var(--basalt-font-family-sans);letter-spacing:var(--basalt-text-md-tracking)}.release-fold-title{margin:0}.release-fold-panel[hidden=until-found]{display:block!important;content-visibility:hidden}.release-section[data-folded] .release-fold-panel:not([hidden]){padding-top:var(--basalt-space-2)}.release-build{margin-top:var(--basalt-space-2)}.release-build .release-fold{min-height:var(--basalt-size-control-xs);font:var(--basalt-font-weight-regular) var(--basalt-text-base-size) / var(--basalt-text-base-line-height) var(--basalt-font-family-sans);letter-spacing:var(--basalt-text-base-tracking)}.release-build-list{margin-block:var(--basalt-space-3)}.release-fold-panel{display:flow-root}.release>.release-build:last-child{margin-bottom:calc((var(--basalt-text-base-line-height) - var(--basalt-size-control-xs)) / 2)}.release>.release-build:last-child>.release-fold-panel:not([hidden]){padding-bottom:calc((var(--basalt-size-control-xs) - var(--basalt-text-base-line-height)) / 2)}.release-list{display:grid;grid-template-columns:minmax(0,var(--basalt-size-prose-width)) minmax(0,max-content);justify-content:start;column-gap:var(--basalt-space-6);margin:0;padding:0;list-style:none}.release-entry{position:relative;display:grid;grid-template-columns:subgrid;grid-column:1 / -1;align-items:baseline;--_release-entry-pad: var(--basalt-space-1-5);padding-block:var(--_release-entry-pad);scroll-margin-top:calc(var(--basalt-sticky-offset, var(--basalt-space-0)) + var(--basalt-space-8))}:where(.release-action .release-list,.release>.release-section:not([data-folded]):last-child>.release-list,.release>.release-all:last-child>.release-fold-panel>.release-section:last-child>.release-list,.release>.release-section[data-folded]:last-child>.release-fold-panel>.release-list)>.release-entry:last-child{padding-bottom:0}.release-word{grid-column:1 / -1}.release-entry-words{grid-column:1;display:grid;justify-items:start;gap:var(--basalt-space-1);min-width:0}.release-entry-text{margin:0;color:var(--basalt-text-primary);font-size:var(--basalt-text-base-size);line-height:var(--basalt-text-base-line-height);letter-spacing:var(--basalt-text-base-tracking);text-wrap:pretty;overflow-wrap:break-word}.release-entry-text code{display:inline-block;max-inline-size:100%}.release-area{font-weight:var(--basalt-font-weight-medium)}.release-migrate{position:relative;font-size:var(--basalt-text-base-size);line-height:var(--basalt-text-base-line-height)}.release-source-cell{grid-column:2;justify-self:start;min-width:0}.release-source-cell:empty{display:none}.release-source{position:relative;margin:0;padding-inline:0;border:0;border-radius:var(--basalt-radius-xs);background:none;color:var(--basalt-text-secondary);text-align:start;cursor:pointer;transition:color var(--basalt-duration-fast) var(--basalt-ease-out)}.release-source:hover{color:var(--basalt-text-primary)}.release-source:focus-visible{outline:var(--basalt-size-focus-width) solid var(--basalt-border-focus);outline-offset:var(--basalt-size-focus-offset)}.release-source{display:inline;baseline-source:first;padding-block:var(--basalt-space-0-5);margin-block:calc(-1 * var(--basalt-space-0-5));font-family:var(--basalt-font-family-mono);font-size:var(--basalt-text-sm-size);line-height:var(--basalt-text-base-line-height);letter-spacing:0}.release-id{display:inline-block;max-width:100%;overflow-wrap:anywhere;vertical-align:top;text-decoration:underline;text-decoration-color:var(--basalt-border-input);text-decoration-thickness:var(--basalt-size-hairline);text-underline-offset:var(--basalt-size-underline-offset);transition:text-decoration-color var(--basalt-duration-fast) var(--basalt-ease-out)}.release-source:hover .release-id{text-decoration-color:currentColor}.release-action-link{white-space:nowrap}.release-sources{width:var(--basalt-size-popover-max)}.release-sources-list{margin-block:var(--basalt-space-2) var(--basalt-space-4)}.release-mono{font-family:var(--basalt-font-family-mono);font-size:var(--basalt-text-sm-size)}@container (width < 640px){.release-list,.release-action .release-list{grid-template-columns:minmax(0,1fr)}.release-entry{row-gap:var(--basalt-space-0-5);--_release-entry-pad: var(--basalt-space-2)}.release-source-cell{grid-column:1}.release-source{padding-block:calc((var(--basalt-size-control-xs) - var(--basalt-text-sm-line-height)) / 2);margin-block:calc((var(--basalt-text-sm-line-height) - var(--basalt-size-control-xs)) / 2);line-height:var(--basalt-text-sm-line-height);white-space:normal}}@media(pointer:coarse){.release-entry{--_release-entry-pad: var(--basalt-space-3)}.release-source{line-height:var(--basalt-text-base-line-height)}.release-source:before,.release-action-link:after,.release-migrate:after{content:"";position:absolute;top:50%;left:50%;width:max(100%,var(--basalt-size-tap-min));height:var(--basalt-size-tap-min);transform:translate(-50%,-50%)}.release-fold,.release-build .release-fold{min-height:var(--basalt-size-tap-min)}.release>:is(.release-all,.release-section[data-folded]):last-child{margin-bottom:calc((var(--basalt-text-md-line-height) - var(--basalt-size-tap-min)) / 2)}.release>:is(.release-all,.release-section[data-folded]):last-child>.release-fold-panel:not([hidden]){padding-bottom:calc((var(--basalt-size-tap-min) - var(--basalt-text-md-line-height)) / 2)}.release>.release-build:last-child{margin-bottom:calc((var(--basalt-text-base-line-height) - var(--basalt-size-tap-min)) / 2)}.release>.release-build:last-child>.release-fold-panel:not([hidden]){padding-bottom:calc((var(--basalt-size-tap-min) - var(--basalt-text-base-line-height)) / 2)}@container (width < 640px){.release-source{padding-block:calc((var(--basalt-size-control-xs) - var(--basalt-text-base-line-height)) / 2);margin-block:calc((var(--basalt-text-base-line-height) - var(--basalt-size-control-xs)) / 2);line-height:var(--basalt-text-base-line-height)}.release-entry[data-link]:has(.release-source){row-gap:var(--basalt-space-6)}}}@media(pointer:coarse),(width<720px){.release-sources .dlist>div{padding-block:var(--basalt-space-3)}.release-sources .dlist>div:first-child{padding-top:0}.release-sources .dlist>div:last-child{padding-bottom:0}.release-sources dd a{position:relative;display:inline;min-width:0;min-height:0;margin-block:0}.release-sources dd a:after{content:"";position:absolute;inset-block:auto;top:50%;left:50%;width:max(100%,var(--basalt-size-tap-min));height:var(--basalt-size-tap-min);transform:translate(-50%,-50%)}.release-sources dd:has(a)+dd:has(a){margin-top:var(--basalt-space-6)}@container (width < 480px){.release-sources dd:has(a)+dd:has(a){margin-top:calc(var(--basalt-space-6) - var(--basalt-space-0-5))}}}.release-entry[data-arrival]{isolation:isolate}.release .release-entry[data-arrival]{padding-bottom:var(--_release-entry-pad)}:is(.release-entry[data-arrival],.release[data-arrival]>.release-head):before{content:"";position:absolute;z-index:-1;inset:calc(-1 * var(--basalt-space-1)) calc(-1 * var(--basalt-space-2));border-radius:var(--basalt-radius-md);pointer-events:none;background-color:transparent;transition:background-color calc(var(--basalt-duration-slow) * .75) var(--basalt-ease-in)}:is(.release-entry[data-arrived],.release[data-arrived]>.release-head):before{background-color:var(--basalt-plate);transition-duration:var(--basalt-duration-instant)}:is(.release-entry[data-arrived],.release[data-arrived]>.release-head) .release-count{color:var(--basalt-text-secondary)}@media(forced-colors:active){:is(.release-entry[data-arrival],.release[data-arrival]>.release-head):before{display:none}}.release-index-title{margin:0 0 var(--basalt-space-2);font:var(--basalt-font-weight-medium) var(--basalt-text-sm-size) / var(--basalt-text-sm-line-height) var(--basalt-font-family-sans);letter-spacing:var(--basalt-text-sm-tracking)}.release-index-list{display:grid;margin:0;padding:0;list-style:none}.release-index-link{display:flex;align-items:baseline;justify-content:space-between;gap:var(--basalt-space-4);padding-block:var(--basalt-space-1-5);border-radius:var(--basalt-radius-xs);color:var(--basalt-text-secondary);font:var(--basalt-font-weight-regular) var(--basalt-text-sm-size) / var(--basalt-text-sm-line-height) var(--basalt-font-family-sans);font-variant-numeric:tabular-nums;text-decoration:none}.release-index-number{color:var(--basalt-text-primary);font-family:var(--basalt-font-family-mono);letter-spacing:0;overflow-wrap:anywhere}.release-index-number[data-words]{font-family:var(--basalt-font-family-sans)}.release-index-link time{flex:none;color:var(--basalt-text-tertiary)}.release-index-link:hover .release-index-number{text-decoration:underline;text-decoration-thickness:var(--basalt-size-hairline);text-underline-offset:var(--basalt-size-underline-offset)}.release-index-link:focus-visible{outline:var(--basalt-size-focus-width) solid var(--basalt-border-focus);outline-offset:var(--basalt-size-focus-offset)}.release-index[data-release-form=fold]{margin-bottom:var(--basalt-space-8)}.release-index[data-release-form=fold] .release-fold{font:var(--basalt-font-weight-medium) var(--basalt-text-sm-size) / var(--basalt-text-sm-line-height) var(--basalt-font-family-sans)}@media(pointer:coarse){.release-index-link{align-items:center;min-height:var(--basalt-size-tap-min);padding-block:0}}.release-index[data-release-form=fold]{display:none}@container (width < 920px){.pane-layout .release-index[data-release-form=fold]{display:block}.pane:has(>.release-index[data-release-form=pane]){display:none}}@media print{:is(.release-notes,.release-index) .release-fold-panel{content-visibility:visible}:is(.release-notes,.release-index) .release-fold-panel[hidden]{display:flow-root!important;content-visibility:visible}.release-section[data-folded] .release-fold-panel[hidden]{padding-top:var(--basalt-space-2)}.release-copy,.release-notes [data-copy-text],.release-sources,.release-build .btn{display:none}.release-id{text-decoration:none}}} diff --git a/.agent/skills/basalt-html/parts/release.js b/.agent/skills/basalt-html/parts/release.js new file mode 100644 index 00000000..96d48ada --- /dev/null +++ b/.agent/skills/basalt-html/parts/release.js @@ -0,0 +1 @@ +(function(u){"use strict";var f=u._,m=/^(Arrow(Up|Down|Left|Right)|Page(Up|Down)|Home|End| |Shift|Control|Alt|Meta|CapsLock)$/,n=null;function s(e,t){var r=document.getElementById(e.getAttribute("aria-controls"));e.setAttribute("aria-expanded",String(t)),r&&(t?r.removeAttribute("hidden"):r.setAttribute("hidden","until-found"))}function A(){document.querySelectorAll(".release-fold").forEach(function(e){if(!e.__bhRelease){e.__bhRelease=!0,s(e,!1),e.addEventListener("click",function(){s(e,e.getAttribute("aria-expanded")!=="true")});var t=document.getElementById(e.getAttribute("aria-controls"));t&&t.addEventListener("beforematch",function(){e.setAttribute("aria-expanded","true")})}})}function g(e){var t=e.closest("[data-base]");return t?t.getAttribute("data-base"):location.origin+location.pathname}function o(){if(n){n.removeAttribute("data-arrived");var e=n.querySelector(".release-word");e&&e.setAttribute("aria-hidden","true"),n=null}}function h(e){if(!e)return null;var t=document.getElementById(e);if(t&&(t.classList.contains("release")||t.classList.contains("release-entry")))return t;for(var r=document.querySelectorAll(".release[data-replaces]"),a=0;a<r.length;a++)if(r[a].getAttribute("data-replaces").split(" ").some(function(i){return"v"+i===e}))return r[a];return null}function l(){var e=location.hash.slice(1),t=e;try{t=decodeURIComponent(e)}catch{}var r=h(t);if(o(),!!r){for(var a=r.parentElement;a;a=a.parentElement)if(a.classList&&a.classList.contains("release-fold-panel")&&a.hasAttribute("hidden")){var i=document.querySelector('[aria-controls="'+CSS.escape(a.id)+'"]');i&&s(i,!0)}r.setAttribute("tabindex","-1"),r.setAttribute("data-arrival",""),r.setAttribute("data-arrived","");var d=r.classList.contains("release")?r.querySelector(".release-head .release-word"):r.querySelector(":scope > .release-word");d&&d.removeAttribute("aria-hidden"),n=r,requestAnimationFrame(function(){r.scrollIntoView({block:r.getBoundingClientRect().height>innerHeight*.6?"start":"center"}),r.focus({preventScroll:!0}),requestAnimationFrame(function(){r.__bhArmed=!0})})}}function c(e){if(!(!n||!n.__bhArmed)){if(e.type==="keydown"){var t=e.target&&e.target.closest&&e.target.closest("input, textarea, select, [contenteditable]");if(m.test(e.key)&&!(e.key===" "&&t))return}n.__bhArmed=!1,o()}}f.step(78,"wireRelease",function(){document.querySelector(".release, .release-index")&&(A(),document.addEventListener("click",function(e){var t=e.target.closest&&e.target.closest("[data-copy-fragment]");t&&t.setAttribute("data-copy-text",g(t)+"#"+t.getAttribute("data-copy-fragment"))},!0),document.addEventListener("pointerdown",c,!0),document.addEventListener("keydown",c,!0),addEventListener("hashchange",l),l())})})(window.Basalt); diff --git a/.agent/skills/basalt-html/parts/tab-bar.css b/.agent/skills/basalt-html/parts/tab-bar.css index 43b83dc7..6717f9c0 100644 --- a/.agent/skills/basalt-html/parts/tab-bar.css +++ b/.agent/skills/basalt-html/parts/tab-bar.css @@ -1 +1 @@ -@layer basalt{:root{--bh-inset-bottom: max(env(safe-area-inset-bottom, var(--basalt-space-0)), var(--bh-inset-bottom-sim, var(--basalt-space-0)));--bh-inset-left: env(safe-area-inset-left, var(--basalt-space-0));--bh-inset-right: env(safe-area-inset-right, var(--basalt-space-0));--basalt-bottom-offset: var(--basalt-space-0)}@media(width<720px){:root:has(.tab-bar){--basalt-bottom-offset: calc(var(--basalt-size-tab-bar) + var(--bh-inset-bottom));scroll-padding-bottom:calc(var(--basalt-bottom-offset) + var(--basalt-space-4))}}.tab-bar{display:none}@media(width<720px){.tab-bar{--bh-tap-margin: 0;position:fixed;inset-inline:0;bottom:0;z-index:var(--basalt-layer-sticky);box-sizing:border-box;display:block;padding-bottom:var(--bh-inset-bottom);padding-inline:var(--bh-inset-left) var(--bh-inset-right);border-top:var(--basalt-size-hairline) solid var(--basalt-border-hairline);background:var(--basalt-surface-page);color:var(--basalt-text-primary);font-family:var(--basalt-font-family-sans)}}@media print{.tab-bar{display:none}}.tab-bar-list{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);height:calc(var(--basalt-size-tab-bar) - var(--basalt-size-hairline));margin:0;padding:0;list-style:none}.tab-bar-list>li{display:flex;min-width:0;margin:0;padding:0}.tab-bar-item{box-sizing:border-box;flex:1;min-width:0;height:100%;min-height:0;margin:0;padding:var(--basalt-space-0-5) var(--basalt-space-0-5) 0;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:var(--basalt-space-0-5);border:0;background:none;color:var(--basalt-text-primary);font:inherit;text-decoration:none;outline:none;cursor:pointer;-webkit-tap-highlight-color:transparent}.tab-bar-glyph{position:relative;flex:none;display:flex;align-items:center;justify-content:center;width:var(--basalt-size-control-md);height:var(--basalt-size-control-md);border-radius:var(--basalt-radius-full);transition:background-color var(--basalt-duration-fast) var(--basalt-ease-out)}.tab-bar-label{display:inline-flex;flex-direction:column;align-items:center;max-width:100%;font:var(--basalt-font-weight-regular) var(--bh-xs);letter-spacing:var(--basalt-text-xs-tracking);white-space:nowrap}.tab-bar-label[data-label]:after{content:attr(data-label);height:0;overflow:hidden;visibility:hidden;font-weight:var(--basalt-font-weight-semibold);user-select:none;pointer-events:none}.tab-bar-item:is([aria-current=page],[data-current]) .tab-bar-label{font-weight:var(--basalt-font-weight-semibold)}.tab-bar-dot{position:absolute;top:var(--basalt-space-1);inset-inline-end:var(--basalt-space-1);width:var(--basalt-size-dot);height:var(--basalt-size-dot);border-radius:var(--basalt-radius-full);background-color:currentColor}@media(hover:hover)and (pointer:fine){.tab-bar-item:hover .tab-bar-glyph{background-color:var(--basalt-state-selected);transition-duration:var(--basalt-duration-instant)}}.tab-bar-item:active .tab-bar-glyph{background-color:var(--basalt-state-selected);transition-duration:var(--basalt-duration-instant)}.tab-bar[data-keys] .tab-bar-item:is(:hover,:active) .tab-bar-glyph{background-color:transparent}.tab-bar-item:focus-visible{outline:var(--basalt-size-focus-width) solid var(--basalt-border-focus);outline-offset:calc(-1 * var(--basalt-size-focus-width))}.tab-bar-sheet-head{display:flex;align-items:center;justify-content:space-between;gap:var(--basalt-space-2);margin-bottom:var(--basalt-space-2)}.tab-bar-sheet-head .dialog-title{margin:0}@media(forced-colors:active){.tab-bar{background:Canvas;border-top-color:CanvasText}.tab-bar-item{color:LinkText}.tab-bar-item:is(:hover,:active) .tab-bar-glyph{forced-color-adjust:none;background-color:Highlight;color:HighlightText}.tab-bar[data-keys] .tab-bar-item:is(:hover,:active) .tab-bar-glyph{forced-color-adjust:auto;background-color:transparent;color:inherit}.tab-bar-dot{forced-color-adjust:none;background-color:CanvasText}}} +@layer basalt{:root{--bh-inset-bottom: max(env(safe-area-inset-bottom, var(--basalt-space-0)), var(--bh-inset-bottom-sim, var(--basalt-space-0)));--bh-inset-left: env(safe-area-inset-left, var(--basalt-space-0));--bh-inset-right: env(safe-area-inset-right, var(--basalt-space-0));--basalt-bottom-offset: var(--basalt-space-0)}@media(width<720px){:root:has(.tab-bar){--basalt-bottom-offset: calc(var(--basalt-size-tab-bar) + var(--bh-inset-bottom));scroll-padding-bottom:calc(var(--basalt-bottom-offset) + var(--basalt-space-4))}}.tab-bar{display:none}@media(width<720px){.tab-bar{--bh-tap-margin: 0;position:fixed;inset-inline:0;bottom:0;z-index:var(--basalt-layer-sticky);box-sizing:border-box;display:block;padding-bottom:var(--bh-inset-bottom);padding-inline:var(--bh-inset-left) var(--bh-inset-right);border-top:var(--basalt-size-hairline) solid var(--basalt-border-hairline);background:var(--basalt-surface-page);color:var(--basalt-text-primary);font-family:var(--basalt-font-family-sans)}}@media print{.tab-bar{display:none}}.tab-bar-list{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);height:calc(var(--basalt-size-tab-bar) - var(--basalt-size-hairline));margin:0;padding:0;list-style:none}.tab-bar-list>li{display:flex;min-width:0;margin:0;padding:0}.tab-bar-item{box-sizing:border-box;flex:1;min-width:0;height:100%;min-height:0;margin:0;padding:var(--basalt-space-0-5) var(--basalt-space-0-5) 0;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:var(--basalt-space-0-5);border:0;background:none;color:var(--basalt-text-primary);font:inherit;text-decoration:none;outline:none;cursor:pointer;-webkit-tap-highlight-color:transparent}.tab-bar-glyph{position:relative;flex:none;display:flex;align-items:center;justify-content:center;width:var(--basalt-size-control-md);height:var(--basalt-size-control-md);border-radius:var(--basalt-radius-full);transition:background-color var(--basalt-duration-fast) var(--basalt-ease-out)}.tab-bar-label{display:inline-flex;flex-direction:column;align-items:center;max-width:100%;font:var(--basalt-font-weight-regular) var(--bh-xs);letter-spacing:var(--basalt-text-xs-tracking);white-space:nowrap}.tab-bar-label[data-label]:after{content:attr(data-label);height:0;overflow:hidden;visibility:hidden;font-weight:var(--basalt-font-weight-semibold);user-select:none;pointer-events:none}.tab-bar-item:is([aria-current=page],[data-current]) .tab-bar-label{font-weight:var(--basalt-font-weight-semibold)}.tab-bar-dot{position:absolute;top:var(--basalt-space-1);inset-inline-end:var(--basalt-space-1);width:var(--basalt-size-dot);height:var(--basalt-size-dot);border-radius:var(--basalt-radius-full);background-color:currentColor}@media(hover:hover)and (pointer:fine){.tab-bar-item:hover .tab-bar-glyph{background-color:var(--basalt-state-selected);transition-duration:var(--basalt-duration-instant)}}.tab-bar-item:active .tab-bar-glyph{background-color:var(--basalt-state-selected);transition-duration:var(--basalt-duration-instant)}.tab-bar[data-keys] .tab-bar-item:is(:hover,:active) .tab-bar-glyph{background-color:transparent}.tab-bar-item:focus-visible{outline:var(--basalt-size-focus-width) solid var(--basalt-border-focus);outline-offset:calc(-1 * var(--basalt-size-focus-width))}.tab-bar-sheet-head{display:flex;align-items:center;justify-content:space-between;gap:var(--basalt-space-2);margin-bottom:var(--basalt-space-2)}.tab-bar-sheet-head .dialog-title{margin:0}@media(forced-colors:active){.tab-bar{background:Canvas;border-top-color:CanvasText}.tab-bar-item{color:LinkText}.tab-bar-item:is(:hover,:active) .tab-bar-glyph{forced-color-adjust:none;background-color:Highlight;color:HighlightText}.tab-bar[data-keys] .tab-bar-item:is(:hover,:active) .tab-bar-glyph{forced-color-adjust:auto;background-color:transparent;color:inherit}.tab-bar-dot{forced-color-adjust:none;background-color:CanvasText}}.tab-bar-version{box-sizing:border-box;display:flex;align-items:center;min-height:var(--basalt-size-tap-min);margin-top:var(--basalt-space-2);padding-inline:calc(var(--basalt-space-1-5) + var(--basalt-space-3));border-top:var(--basalt-size-hairline) solid var(--basalt-border-divider)}.tab-bar-version .version-link{font-size:var(--basalt-text-sm-size);line-height:var(--basalt-text-sm-line-height);letter-spacing:var(--basalt-text-sm-tracking)}} diff --git a/.agent/skills/basalt-html/parts/topbar.css b/.agent/skills/basalt-html/parts/topbar.css index 61efa151..5d24ae7c 100644 --- a/.agent/skills/basalt-html/parts/topbar.css +++ b/.agent/skills/basalt-html/parts/topbar.css @@ -1 +1 @@ -@layer basalt{:root{--bh-inset-top: env(safe-area-inset-top, var(--basalt-space-0));--bh-inset-left: env(safe-area-inset-left, var(--basalt-space-0));--bh-inset-right: env(safe-area-inset-right, var(--basalt-space-0));--basalt-sticky-offset: calc(var(--basalt-size-header) + var(--bh-inset-top));--bh-pad-left: max(var(--basalt-gutter), var(--bh-inset-left));--bh-pad-right: max(var(--basalt-gutter), var(--bh-inset-right))}:root:has(.topbar,.app-header){scrollbar-gutter:stable;scroll-padding-top:calc(var(--basalt-sticky-offset) + var(--basalt-space-4))}:is(.topbar,.app-header) *{scroll-margin-top:calc(-1 * (var(--basalt-sticky-offset) + var(--basalt-space-4)))}.topbar,.app-header{position:sticky;top:0;z-index:var(--basalt-layer-sticky);height:var(--basalt-sticky-offset);padding-top:var(--bh-inset-top);background:var(--basalt-surface-chrome);-webkit-backdrop-filter:blur(var(--basalt-blur-chrome));backdrop-filter:blur(var(--basalt-blur-chrome));border-bottom:var(--basalt-size-hairline) solid var(--basalt-border-hairline);color:var(--basalt-text-primary)}.skip-link{position:fixed;top:calc(var(--basalt-sticky-offset) + var(--basalt-space-2));inset-inline-start:var(--bh-pad-left);transform:none}:root:has(.topbar) .skip-link{inset-inline-start:max(var(--bh-pad-left),calc((100% - var(--basalt-size-page-width)) / 2 + var(--bh-pad-left)))}.skip-link:not(:focus){clip-path:inset(50%)}:is(.topbar,.app-header) :is(.faint,.necessity){color:var(--basalt-text-secondary)}:is(.topbar,.app-header) .btn[data-variant=ghost]:active:not([disabled],[aria-disabled=true],[aria-busy=true]){color:var(--basalt-text-primary)}:is(.topbar,.app-header)[data-solid]{background:var(--basalt-surface-page);-webkit-backdrop-filter:none;backdrop-filter:none}@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))){.topbar,.app-header{background:var(--basalt-surface-page)}}@media(prefers-reduced-transparency:reduce){.topbar,.app-header{background:var(--basalt-surface-page);-webkit-backdrop-filter:none;backdrop-filter:none}}.topbar-inner{display:flex;align-items:center;gap:var(--basalt-space-2);height:calc(var(--basalt-size-header) - var(--basalt-size-hairline));max-width:var(--basalt-size-page-width);margin-inline:auto;padding-top:var(--basalt-size-hairline);padding-inline:var(--bh-pad-left) var(--bh-pad-right)}.brand{position:relative;display:inline-flex;align-items:center;flex:none;gap:var(--basalt-space-2);height:var(--basalt-size-tap-min);min-width:var(--basalt-size-tap-min);margin:0;color:var(--basalt-text-primary);font:var(--basalt-font-weight-semibold) var(--bh-md);letter-spacing:var(--basalt-text-md-tracking);text-decoration:none;white-space:nowrap;outline:none;-webkit-tap-highlight-color:transparent}.brand:focus-visible:after{content:"";position:absolute;inset-block:calc((var(--basalt-size-tap-min) - var(--basalt-size-control-md)) / 2);inset-inline:0;border-radius:var(--basalt-radius-sm);outline:var(--basalt-size-focus-width) solid var(--basalt-border-focus);outline-offset:var(--basalt-size-focus-offset);pointer-events:none}.lockup-sprite{position:absolute;width:0;height:0;overflow:hidden;pointer-events:none}.lockup{display:block;flex:none;max-width:none;pointer-events:none}.lockup-2x{display:none}@media(min-resolution:2dppx),(-webkit-min-device-pixel-ratio:2){.lockup-1x{display:none}.lockup-2x{display:block}}.site-slot{position:relative;height:var(--basalt-sticky-offset)}.site-slot>.topbar{--_from: calc(-100% - var(--basalt-size-hairline));position:absolute;inset:0 0 auto}.site-slot>.topbar[data-form=bar]{position:fixed;top:0}.site-slot>.topbar[data-form=bar][data-motion=from]{transform:translateY(var(--_from));transition:none}.site-slot>.topbar[data-form=bar][data-motion=in]{transform:translateY(0);transition:transform var(--basalt-duration-slower) var(--basalt-ease-out)}.site-slot>.topbar[data-form=bar][data-motion=out]{transform:translateY(var(--_from));transition:transform calc(var(--basalt-duration-slower) * .75) var(--basalt-ease-in)}@media(prefers-reduced-motion:reduce){.site-slot>.topbar[data-form=bar][data-motion]{transform:none}.site-slot>.topbar[data-form=bar][data-motion=from]{opacity:0}.site-slot>.topbar[data-form=bar][data-motion=in]{opacity:1;transition:opacity var(--basalt-duration-slower) var(--basalt-ease-out)}.site-slot>.topbar[data-form=bar][data-motion=out]{opacity:0;transition:opacity calc(var(--basalt-duration-slower) * .75) var(--basalt-ease-in)}}.site-page{display:flex;flex-direction:column;min-height:100svh}.site-page>main{flex:1 0 auto}.site-footer{--_gap: var(--basalt-space-12);--_above: var(--basalt-space-16);box-sizing:border-box;width:100%;max-width:var(--basalt-size-page-width);margin:var(--_above) auto 0;padding:0 var(--bh-pad-right) calc(var(--basalt-space-8) + env(safe-area-inset-bottom,var(--basalt-space-0))) var(--bh-pad-left);color:var(--basalt-text-secondary);font:var(--basalt-font-weight-regular) var(--bh-sm);letter-spacing:var(--basalt-text-sm-tracking)}.site-footer-body{padding-top:var(--basalt-space-8);border-top:var(--basalt-size-hairline) solid var(--basalt-border-divider)}.site-footer-top{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));column-gap:var(--basalt-gutter);row-gap:var(--basalt-space-8)}.site-footer-id{grid-column:1 / span 4;display:flex;flex-direction:column;align-items:flex-start;gap:var(--basalt-space-3);min-width:0}.site-footer-id>.brand{margin-block:calc(-1 * (var(--basalt-size-tap-min) - var(--basalt-size-control-md)) / 2)}.site-footer-note{margin:0;max-width:var(--basalt-size-prose-width)}.site-footer-links{grid-column:5 / -1;min-width:0}.site-footer-top:not(:has(.site-footer-id))>.site-footer-links{grid-column:1 / -1}.site-footer-groups{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));column-gap:var(--basalt-gutter);row-gap:var(--basalt-space-8);align-items:start}.site-footer-group{min-width:0}.site-footer-label{margin:0 0 var(--basalt-space-1);color:var(--basalt-text-primary);font:var(--basalt-font-weight-medium) var(--bh-sm);letter-spacing:var(--basalt-text-sm-tracking)}.site-footer-links-host{--_hang: calc(var(--basalt-space-0-5) + var(--basalt-space-2));position:relative;isolation:isolate;margin-inline-start:calc(-1 * var(--_hang))}.site-footer-links-host>ul{margin:0;padding:0;list-style:none}.site-footer-links-host a{position:relative;z-index:1;box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;width:max-content;min-height:var(--basalt-size-control-md);margin:0;padding-inline:var(--_hang);color:var(--basalt-text-secondary);font:var(--basalt-font-weight-regular) var(--bh-sm);letter-spacing:var(--basalt-text-sm-tracking);text-decoration:none;overflow-wrap:anywhere;outline:none;-webkit-tap-highlight-color:transparent;transition:color var(--basalt-duration-fast) var(--basalt-ease-out)}.site-footer-links-host a:before{content:"";position:absolute;z-index:-1;inset:calc((100% - var(--basalt-size-control-sm)) / 2) var(--basalt-space-0-5);border-radius:var(--basalt-radius-full);background-color:transparent;transition:background-color var(--basalt-duration-fast) var(--basalt-ease-out)}.site-footer-links-host a[data-label]:after{content:attr(data-label);height:0;overflow:hidden;visibility:hidden;font-weight:var(--basalt-font-weight-semibold);user-select:none;pointer-events:none}.site-footer-links-host a[aria-current=page]{color:var(--basalt-text-primary);font-weight:var(--basalt-font-weight-semibold)}@media(hover:hover){.site-footer-links-host a:hover{color:var(--basalt-text-primary);transition-duration:var(--basalt-duration-instant)}.site-footer-links-host a:hover:before{background-color:var(--basalt-state-selected);transition-duration:var(--basalt-duration-instant)}}.site-footer-links-host a:is(:active,:focus-visible){color:var(--basalt-text-primary);transition-duration:var(--basalt-duration-instant)}.site-footer-links-host a:active:before{background-color:var(--basalt-state-selected);transition-duration:var(--basalt-duration-instant)}.site-footer-links-host a:focus-visible:before{outline:var(--basalt-size-focus-width) solid var(--basalt-border-focus);outline-offset:var(--basalt-size-focus-offset)}.site-footer-links-host[data-keys] a:is(:hover,:active):before{background-color:transparent}.site-footer-links-host[data-keys] a:hover:not([aria-current],:focus-visible){color:var(--basalt-text-secondary)}.site-footer-links-host>.plate{--panel-plate: var(--basalt-state-selected);border-radius:var(--basalt-radius-full)}@media(prefers-reduced-motion:no-preference)and (forced-colors:none)and (hover:hover)and (pointer:fine){.site-footer-links-host[data-glide] a:before{background-color:transparent;transition-duration:var(--basalt-duration-instant)}}@media(pointer:coarse),(width<720px){.site-footer-links-host a{min-height:var(--basalt-size-tap-min)}}.site-footer[data-form=line] .site-footer-top{display:flex;flex-wrap:wrap;align-items:center;column-gap:var(--basalt-space-6);row-gap:var(--basalt-space-2)}.site-footer[data-form=line] .site-footer-links{flex:1 1 auto}.site-footer[data-form=line] .site-footer-links-host{margin-inline-start:0}.site-footer[data-form=line] .site-footer-links-host>ul{display:flex;flex-wrap:wrap}.site-footer-base{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;column-gap:var(--basalt-space-6);row-gap:var(--basalt-space-4);margin-top:var(--_gap)}.site-footer[data-form=line] .site-footer-base{margin-top:var(--basalt-space-4)}.site-footer-legal{margin:0;max-width:var(--basalt-size-prose-width);color:var(--basalt-text-tertiary)}.site-footer-toggle{display:none;align-items:center;justify-content:space-between;box-sizing:border-box;width:100%;height:var(--basalt-size-tap-min);margin:0;padding:0;border:0;background:transparent;color:var(--basalt-text-primary);font:inherit;letter-spacing:inherit;text-align:start;cursor:pointer;-webkit-tap-highlight-color:transparent}.site-footer-toggle:focus-visible{outline:var(--basalt-size-focus-width) solid var(--basalt-border-focus);outline-offset:var(--basalt-size-focus-offset)}.site-footer-toggle>svg{color:var(--basalt-text-secondary);transition:transform var(--basalt-duration-slow) var(--basalt-ease-out),color var(--basalt-duration-fast) var(--basalt-ease-out)}@media(hover:hover){.site-footer-toggle:hover>svg{color:var(--basalt-text-primary)}}.site-footer-group[data-open] .site-footer-toggle>svg{transform:rotate(180deg)}@media(prefers-reduced-motion:reduce){.site-footer-toggle>svg{transition:color var(--basalt-duration-fast) var(--basalt-ease-out)}}@media(width<1024px){.site-footer{--_above: var(--basalt-space-12)}.site-footer-id,.site-footer-links{grid-column:1 / -1}.site-footer-id{flex-direction:row;flex-wrap:wrap;align-items:center;column-gap:var(--basalt-space-6)}}@media(width<720px){.site-footer{--_gap: var(--basalt-space-8);--_above: var(--basalt-space-8)}.site-footer-top{row-gap:var(--basalt-space-6)}.site-footer-id{flex-direction:column;align-items:flex-start}.site-footer-groups{grid-template-columns:repeat(2,minmax(0,1fr));column-gap:var(--basalt-space-4);row-gap:var(--basalt-space-6)}.site-footer-base{flex-direction:column;align-items:flex-start}.site-footer[data-wired] .site-footer-groups{grid-template-columns:minmax(0,1fr);row-gap:0}.site-footer[data-wired] .site-footer-group+.site-footer-group{border-top:var(--basalt-size-hairline) solid var(--basalt-border-divider)}.site-footer[data-wired] .site-footer-label{margin:0}.site-footer[data-wired] .site-footer-label-wide{display:none}.site-footer[data-wired] .site-footer-toggle{display:flex}.site-footer[data-wired] .site-footer-group:not([data-open])>.site-footer-links-host{display:none}.site-footer[data-wired] .site-footer-group[data-open]>.site-footer-links-host{padding-bottom:var(--basalt-space-2)}}@media(width<720px){.topbar-inner{gap:var(--basalt-space-1)}:is(.topbar,.app-header) .btn{--_h: var(--basalt-size-tap-min);border-radius:var(--basalt-radius-md);min-width:var(--basalt-size-tap-min)}}@media(forced-colors:active){.topbar,.app-header{background:Canvas;color:CanvasText;border-bottom-color:CanvasText;-webkit-backdrop-filter:none;backdrop-filter:none}.site-footer-body,.site-footer[data-wired] .site-footer-group+.site-footer-group{border-color:CanvasText}.site-footer-links-host a:hover,.site-footer-links-host a:active{forced-color-adjust:none;color:HighlightText}.site-footer-links-host a:hover:before,.site-footer-links-host a:active:before{background-color:Highlight}.site-footer-links-host[data-keys] a:is(:hover,:active){forced-color-adjust:auto;color:inherit}.site-footer-links-host[data-keys] a:is(:hover,:active):before{background-color:transparent}}@media print{.topbar,.app-header{position:static;background:var(--basalt-surface-page);-webkit-backdrop-filter:none;backdrop-filter:none}.site-slot>.topbar[data-form]{position:absolute;transform:none;opacity:1;transition:none}.site-footer-toggle{display:none}}} +@layer basalt{:root{--bh-inset-top: env(safe-area-inset-top, var(--basalt-space-0));--bh-inset-left: env(safe-area-inset-left, var(--basalt-space-0));--bh-inset-right: env(safe-area-inset-right, var(--basalt-space-0));--basalt-sticky-offset: calc(var(--basalt-size-header) + var(--bh-inset-top));--bh-pad-left: max(var(--basalt-gutter), var(--bh-inset-left));--bh-pad-right: max(var(--basalt-gutter), var(--bh-inset-right))}:root:has(.topbar,.app-header){scrollbar-gutter:stable;scroll-padding-top:calc(var(--basalt-sticky-offset) + var(--basalt-space-4))}:is(.topbar,.app-header) *{scroll-margin-top:calc(-1 * (var(--basalt-sticky-offset) + var(--basalt-space-4)))}.topbar,.app-header{position:sticky;top:0;z-index:var(--basalt-layer-sticky);height:var(--basalt-sticky-offset);padding-top:var(--bh-inset-top);background:var(--basalt-surface-chrome);-webkit-backdrop-filter:blur(var(--basalt-blur-chrome));backdrop-filter:blur(var(--basalt-blur-chrome));border-bottom:var(--basalt-size-hairline) solid var(--basalt-border-hairline);color:var(--basalt-text-primary)}.skip-link{position:fixed;top:calc(var(--basalt-sticky-offset) + var(--basalt-space-2));inset-inline-start:var(--bh-pad-left);transform:none}:root:has(.topbar) .skip-link{inset-inline-start:max(var(--bh-pad-left),calc((100% - var(--basalt-size-page-width)) / 2 + var(--bh-pad-left)))}.skip-link:not(:focus){clip-path:inset(50%)}:is(.topbar,.app-header) :is(.faint,.necessity){color:var(--basalt-text-secondary)}:is(.topbar,.app-header) .btn[data-variant=ghost]:active:not([disabled],[aria-disabled=true],[aria-busy=true]){color:var(--basalt-text-primary)}:is(.topbar,.app-header)[data-solid]{background:var(--basalt-surface-page);-webkit-backdrop-filter:none;backdrop-filter:none}@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))){.topbar,.app-header{background:var(--basalt-surface-page)}}@media(prefers-reduced-transparency:reduce){.topbar,.app-header{background:var(--basalt-surface-page);-webkit-backdrop-filter:none;backdrop-filter:none}}.topbar-inner{display:flex;align-items:center;gap:var(--basalt-space-2);height:calc(var(--basalt-size-header) - var(--basalt-size-hairline));max-width:var(--basalt-size-page-width);margin-inline:auto;padding-top:var(--basalt-size-hairline);padding-inline:var(--bh-pad-left) var(--bh-pad-right)}.brand{position:relative;display:inline-flex;align-items:center;flex:none;gap:var(--basalt-space-2);height:var(--basalt-size-tap-min);min-width:var(--basalt-size-tap-min);margin:0;color:var(--basalt-text-primary);font:var(--basalt-font-weight-semibold) var(--bh-md);letter-spacing:var(--basalt-text-md-tracking);text-decoration:none;white-space:nowrap;outline:none;-webkit-tap-highlight-color:transparent}.brand:focus-visible:after{content:"";position:absolute;inset-block:calc((var(--basalt-size-tap-min) - var(--basalt-size-control-md)) / 2);inset-inline:0;border-radius:var(--basalt-radius-sm);outline:var(--basalt-size-focus-width) solid var(--basalt-border-focus);outline-offset:var(--basalt-size-focus-offset);pointer-events:none}.lockup-sprite{position:absolute;width:0;height:0;overflow:hidden;pointer-events:none}.lockup{display:block;flex:none;max-width:none;pointer-events:none}.lockup-2x{display:none}@media(min-resolution:2dppx),(-webkit-min-device-pixel-ratio:2){.lockup-1x{display:none}.lockup-2x{display:block}}.site-slot{position:relative;height:var(--basalt-sticky-offset)}.site-slot>.topbar{--_from: calc(-100% - var(--basalt-size-hairline));position:absolute;inset:0 0 auto}.site-slot>.topbar[data-form=bar]{position:fixed;top:0}.site-slot>.topbar[data-form=bar][data-motion=from]{transform:translateY(var(--_from));transition:none}.site-slot>.topbar[data-form=bar][data-motion=in]{transform:translateY(0);transition:transform var(--basalt-duration-slower) var(--basalt-ease-out)}.site-slot>.topbar[data-form=bar][data-motion=out]{transform:translateY(var(--_from));transition:transform calc(var(--basalt-duration-slower) * .75) var(--basalt-ease-in)}@media(prefers-reduced-motion:reduce){.site-slot>.topbar[data-form=bar][data-motion]{transform:none}.site-slot>.topbar[data-form=bar][data-motion=from]{opacity:0}.site-slot>.topbar[data-form=bar][data-motion=in]{opacity:1;transition:opacity var(--basalt-duration-slower) var(--basalt-ease-out)}.site-slot>.topbar[data-form=bar][data-motion=out]{opacity:0;transition:opacity calc(var(--basalt-duration-slower) * .75) var(--basalt-ease-in)}}.site-page{display:flex;flex-direction:column;min-height:100svh}.site-page>main{flex:1 0 auto}.site-footer{--_gap: var(--basalt-space-12);--_above: var(--basalt-space-16);box-sizing:border-box;width:100%;max-width:var(--basalt-size-page-width);margin:var(--_above) auto 0;padding:0 var(--bh-pad-right) calc(var(--basalt-space-8) + env(safe-area-inset-bottom,var(--basalt-space-0))) var(--bh-pad-left);color:var(--basalt-text-secondary);font:var(--basalt-font-weight-regular) var(--bh-sm);letter-spacing:var(--basalt-text-sm-tracking)}.site-footer-body{padding-top:var(--basalt-space-8);border-top:var(--basalt-size-hairline) solid var(--basalt-border-divider)}.site-footer-top{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));column-gap:var(--basalt-gutter);row-gap:var(--basalt-space-8)}.site-footer-id{grid-column:1 / span 4;display:flex;flex-direction:column;align-items:flex-start;gap:var(--basalt-space-3);min-width:0}.site-footer-id>.brand{margin-block:calc(-1 * (var(--basalt-size-tap-min) - var(--basalt-size-control-md)) / 2)}.site-footer-note{margin:0;max-width:var(--basalt-size-prose-width)}.site-footer-links{grid-column:5 / -1;min-width:0}.site-footer-top:not(:has(.site-footer-id))>.site-footer-links{grid-column:1 / -1}.site-footer-groups{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));column-gap:var(--basalt-gutter);row-gap:var(--basalt-space-8);align-items:start}.site-footer-group{min-width:0}.site-footer-label{margin:0 0 var(--basalt-space-1);color:var(--basalt-text-primary);font:var(--basalt-font-weight-medium) var(--bh-sm);letter-spacing:var(--basalt-text-sm-tracking)}.site-footer-links-host{--_hang: calc(var(--basalt-space-0-5) + var(--basalt-space-2));position:relative;isolation:isolate;margin-inline-start:calc(-1 * var(--_hang))}.site-footer-links-host>ul{margin:0;padding:0;list-style:none}.site-footer-links-host a{position:relative;z-index:1;box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;width:max-content;min-height:var(--basalt-size-control-md);margin:0;padding-inline:var(--_hang);color:var(--basalt-text-secondary);font:var(--basalt-font-weight-regular) var(--bh-sm);letter-spacing:var(--basalt-text-sm-tracking);text-decoration:none;overflow-wrap:anywhere;outline:none;-webkit-tap-highlight-color:transparent;transition:color var(--basalt-duration-fast) var(--basalt-ease-out)}.site-footer-links-host a:before{content:"";position:absolute;z-index:-1;inset:calc((100% - var(--basalt-size-control-sm)) / 2) var(--basalt-space-0-5);border-radius:var(--basalt-radius-full);background-color:transparent;transition:background-color var(--basalt-duration-fast) var(--basalt-ease-out)}.site-footer-links-host a[data-label]:after{content:attr(data-label);height:0;overflow:hidden;visibility:hidden;font-weight:var(--basalt-font-weight-semibold);user-select:none;pointer-events:none}.site-footer-links-host a[aria-current=page]{color:var(--basalt-text-primary);font-weight:var(--basalt-font-weight-semibold)}@media(hover:hover){.site-footer-links-host a:hover{color:var(--basalt-text-primary);transition-duration:var(--basalt-duration-instant)}.site-footer-links-host a:hover:before{background-color:var(--basalt-state-selected);transition-duration:var(--basalt-duration-instant)}}.site-footer-links-host a:is(:active,:focus-visible){color:var(--basalt-text-primary);transition-duration:var(--basalt-duration-instant)}.site-footer-links-host a:active:before{background-color:var(--basalt-state-selected);transition-duration:var(--basalt-duration-instant)}.site-footer-links-host a:focus-visible:before{outline:var(--basalt-size-focus-width) solid var(--basalt-border-focus);outline-offset:var(--basalt-size-focus-offset)}.site-footer-links-host[data-keys] a:is(:hover,:active):before{background-color:transparent}.site-footer-links-host[data-keys] a:hover:not([aria-current],:focus-visible){color:var(--basalt-text-secondary)}.site-footer-links-host>.plate{--panel-plate: var(--basalt-state-selected);border-radius:var(--basalt-radius-full)}@media(prefers-reduced-motion:no-preference)and (forced-colors:none)and (hover:hover)and (pointer:fine){.site-footer-links-host[data-glide] a:before{background-color:transparent;transition-duration:var(--basalt-duration-instant)}}@media(pointer:coarse),(width<720px){.site-footer-links-host a{min-height:var(--basalt-size-tap-min)}}.site-footer[data-form=line] .site-footer-top{display:flex;flex-wrap:wrap;align-items:center;column-gap:var(--basalt-space-6);row-gap:var(--basalt-space-2)}.site-footer[data-form=line] .site-footer-links{flex:1 1 auto}.site-footer[data-form=line] .site-footer-links-host{margin-inline-start:0}.site-footer[data-form=line] .site-footer-links-host>ul{display:flex;flex-wrap:wrap}.site-footer-base{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;column-gap:var(--basalt-space-6);row-gap:var(--basalt-space-4);margin-top:var(--_gap)}.site-footer[data-form=line] .site-footer-base{margin-top:var(--basalt-space-4)}.site-footer-legal{margin:0;max-width:var(--basalt-size-prose-width);color:var(--basalt-text-tertiary)}.site-footer-toggle{display:none;align-items:center;justify-content:space-between;box-sizing:border-box;width:100%;height:var(--basalt-size-tap-min);margin:0;padding:0;border:0;background:transparent;color:var(--basalt-text-primary);font:inherit;letter-spacing:inherit;text-align:start;cursor:pointer;-webkit-tap-highlight-color:transparent}.site-footer-toggle:focus-visible{outline:var(--basalt-size-focus-width) solid var(--basalt-border-focus);outline-offset:var(--basalt-size-focus-offset)}.site-footer-toggle>svg{color:var(--basalt-text-secondary);transition:transform var(--basalt-duration-slow) var(--basalt-ease-out),color var(--basalt-duration-fast) var(--basalt-ease-out)}@media(hover:hover){.site-footer-toggle:hover>svg{color:var(--basalt-text-primary)}}.site-footer-group[data-open] .site-footer-toggle>svg{transform:rotate(180deg)}@media(prefers-reduced-motion:reduce){.site-footer-toggle>svg{transition:color var(--basalt-duration-fast) var(--basalt-ease-out)}}@media(width<1024px){.site-footer{--_above: var(--basalt-space-12)}.site-footer-id,.site-footer-links{grid-column:1 / -1}.site-footer-id{flex-direction:row;flex-wrap:wrap;align-items:center;column-gap:var(--basalt-space-6)}}@media(width<720px){.site-footer{--_gap: var(--basalt-space-8);--_above: var(--basalt-space-8)}.site-footer-top{row-gap:var(--basalt-space-6)}.site-footer-id{flex-direction:column;align-items:flex-start}.site-footer-groups{grid-template-columns:repeat(2,minmax(0,1fr));column-gap:var(--basalt-space-4);row-gap:var(--basalt-space-6)}.site-footer-base{flex-direction:column;align-items:flex-start}.site-footer[data-wired] .site-footer-groups{grid-template-columns:minmax(0,1fr);row-gap:0}.site-footer[data-wired] .site-footer-group+.site-footer-group{border-top:var(--basalt-size-hairline) solid var(--basalt-border-divider)}.site-footer[data-wired] .site-footer-label{margin:0}.site-footer[data-wired] .site-footer-label-wide{display:none}.site-footer[data-wired] .site-footer-toggle{display:flex}.site-footer[data-wired] .site-footer-group:not([data-open])>.site-footer-links-host{display:none}.site-footer[data-wired] .site-footer-group[data-open]>.site-footer-links-host{padding-bottom:var(--basalt-space-2)}}@media(width<720px){.topbar-inner{gap:var(--basalt-space-1)}:is(.topbar,.app-header) .btn{--_h: var(--basalt-size-tap-min);border-radius:var(--basalt-radius-md);min-width:var(--basalt-size-tap-min)}}@media(forced-colors:active){.topbar,.app-header{background:Canvas;color:CanvasText;border-bottom-color:CanvasText;-webkit-backdrop-filter:none;backdrop-filter:none}.site-footer-body,.site-footer[data-wired] .site-footer-group+.site-footer-group{border-color:CanvasText}.site-footer-links-host a:hover,.site-footer-links-host a:active{forced-color-adjust:none;color:HighlightText}.site-footer-links-host a:hover:before,.site-footer-links-host a:active:before{background-color:Highlight}.site-footer-links-host[data-keys] a:is(:hover,:active){forced-color-adjust:auto;color:inherit}.site-footer-links-host[data-keys] a:is(:hover,:active):before{background-color:transparent}}@media print{.topbar,.app-header{position:static;background:var(--basalt-surface-page);-webkit-backdrop-filter:none;backdrop-filter:none}.site-slot>.topbar[data-form]{position:absolute;transform:none;opacity:1;transition:none}.site-footer-toggle{display:none}}.version-link{position:relative;box-sizing:border-box;display:inline-flex;flex-wrap:wrap;align-items:baseline;column-gap:var(--basalt-space-3);max-width:100%;overflow-x:clip;padding-block:var(--basalt-space-1);border-radius:var(--basalt-radius-xs);color:var(--basalt-text-secondary);font:var(--basalt-font-weight-regular) var(--basalt-text-xs-size) / var(--basalt-text-xs-line-height) var(--basalt-font-family-sans);letter-spacing:var(--basalt-text-xs-tracking);font-variant-numeric:tabular-nums;text-decoration:none;-webkit-tap-highlight-color:transparent;transition:color var(--basalt-duration-fast) var(--basalt-ease-out)}.version-link-words,.version-link-date{position:relative;min-width:0;overflow-wrap:anywhere}.version-link-date:before{content:"·";content:"·" / "";position:absolute;inset-inline-end:100%;width:var(--basalt-space-3);text-align:center}.version-link-pre{display:inline-block;max-width:100%}.version-link-number{display:inline-flex;flex-direction:column;max-width:100%}.version-link-number:after{content:attr(data-label);height:0;overflow:hidden;visibility:hidden;font-weight:var(--basalt-font-weight-semibold);user-select:none;pointer-events:none}.version-link:hover{color:var(--basalt-text-primary)}.version-link:hover :is(.version-link-words,.version-link-date>time){text-decoration:underline;text-decoration-thickness:var(--basalt-size-hairline);text-underline-offset:var(--basalt-size-underline-offset)}.version-link:focus-visible{outline:var(--basalt-size-focus-width) solid var(--basalt-border-focus);outline-offset:var(--basalt-size-focus-offset)}.version-link[aria-current=page]{color:var(--basalt-text-primary)}.version-link[aria-current=page] .version-link-number{font-weight:var(--basalt-font-weight-semibold)}@media(pointer:coarse){.version-link:after{content:"";position:absolute;inset-inline:0;top:50%;height:max(100%,var(--basalt-size-tap-min));transform:translateY(-50%)}}.site-footer-legal-row{display:flex;flex-wrap:wrap;align-items:baseline;gap:var(--basalt-space-1) var(--basalt-space-4);min-width:0}.site-footer-legal-row .version-link{font-size:var(--basalt-text-sm-size);line-height:var(--basalt-text-sm-line-height);letter-spacing:var(--basalt-text-sm-tracking)}} diff --git a/.agent/skills/basalt-html/parts/usage/app-shell.md b/.agent/skills/basalt-html/parts/usage/app-shell.md index 09b9f206..1b4d4ba0 100644 --- a/.agent/skills/basalt-html/parts/usage/app-shell.md +++ b/.agent/skills/basalt-html/parts/usage/app-shell.md @@ -23,3 +23,4 @@ An app's frame (React's `AppShell` and `AppHeader`): a sidebar at 1024 and up, t - `.brand-full` is the lockup, `.brand-rail` the mark alone (the rail shows it). The sidebar's brand band draws no line. - Don't use `.page` inside `.app-main`; it is already the page's width with the gutter. The shell needs `viewport-fit=cover` for the phone's safe areas: compose adds it. - `data-capped` on the shell holds it to the sidebar plus 72rem, centred; the page then fills its column. A page with a pane beside it: `--usage pane`. +- The version this session runs: a `.version-link` in `div.app-version`, last in `.app-account`; the rail shows the number alone and the script gives it the whole line as a tooltip. No "What's new" item. diff --git a/.agent/skills/basalt-html/parts/usage/popover.md b/.agent/skills/basalt-html/parts/usage/popover.md index 40abc956..4e581481 100644 --- a/.agent/skills/basalt-html/parts/usage/popover.md +++ b/.agent/skills/basalt-html/parts/usage/popover.md @@ -13,3 +13,4 @@ A native popup beside its opener: `<button class="btn" popovertarget="p1">` then - Put the popup where its opener sits, inside whatever holds the opener: its level is the opener's plus one. The browser opens, light-dismisses and closes it on Esc and returns focus; the script positions it (below, at the start; `data-side="top|left|right"` and `data-align="center|end"` on the popup), moves focus in and closes it when focus leaves. - Name it with a `.popover-title`. No danger styling, no second blurred layer, and it is never modal: for a decision use `dialog`. +- `data-focus-self` on the popup: it takes focus itself when it opens, rather than its first control (Tab goes on into it). diff --git a/.agent/skills/basalt-html/parts/usage/release.md b/.agent/skills/basalt-html/parts/usage/release.md new file mode 100644 index 00000000..b0ee591d --- /dev/null +++ b/.agent/skills/basalt-html/parts/usage/release.md @@ -0,0 +1,20 @@ +# release + +A package's changelog or a product's release notes (React's `ReleaseNotes` and `ReleaseIndex`), from the records `tools/changelog` writes. Don't write the markup by hand: run `node tools/changelog/skill-body.mjs --form reference|notes --out body.html` (`--running 1.4.0` marks "Your version") and compose that body. Its words follow the release-words skill. + +```html +<div class="release-notes" data-release-form="reference"> + <section class="release" id="v0.2.0" aria-labelledby="v0.2.0-heading"> + <header class="release-head">…the number and date in one h2, the counts, Copy link…</header> + <div class="callout release-action" data-status="warning" id="v0.2.0-action">…Action needed…</div> + <section class="release-section"><h3 class="release-section-title">Added<span class="release-count">…</span></h3><ul class="release-list">…</ul></section> + </section> +</div> +``` + +- Releases highest first; a release is `#v1.4.0`, an entry its permanent id. Arriving at either opens its folds, scrolls to it, focuses it and marks it "Linked" until the reader acts; a candidate's address opens the release that replaces it (`data-replaces`). +- `data-release-form="reference"`: the list open, only Fixed folds (past 3, in a release of more than 10). `"notes"`: the audience paragraphs lead and the list (with the summary) is one fold, "All changes", or "Other changes" under Action needed. +- Folds are `button.disclosure.release-fold` in their heading, the panel written open: the script closes it (`hidden="until-found"`), so without script and in print everything shows. Never write `hidden` yourself. +- A source line opens a `.release-sources` popover: Pull request, Tickets, Commit, and Author only when the entry has one. Copy link buttons copy the page's own address (`data-base` on `.release-notes`, or the window's) and the fragment. +- The versions: `nav.release-index` in a `.pane-layout`'s pane, and a second one with `data-release-form="fold"` before the notes; each shows only where it belongs. +- Build details sits on the release this session runs, with the running build's rows; never a row from a release. diff --git a/.agent/skills/basalt-html/parts/usage/tab-bar.md b/.agent/skills/basalt-html/parts/usage/tab-bar.md index d8b32ed1..9837640e 100644 --- a/.agent/skills/basalt-html/parts/usage/tab-bar.md +++ b/.agent/skills/basalt-html/parts/usage/tab-bar.md @@ -17,3 +17,4 @@ The phone tab bar (React's `TabBar`): an app's destinations under 720, glyph ove - Every item has a glyph and a label, one word where it can be, both primary ink; the label is 12/16. The current page: `aria-current="page"`, its glyph selected and its label 600, no pill or bar. If it is under More, put `data-current` on the More button and say so in its `aria-label` ("More, Settings, current page"). - `.tab-bar-dot` says something is new; its words follow, visually hidden. Counts are spoken, never drawn. - Inside `.app-shell` give the shell `data-tabbar`: its content pads past the bar. On its own, pad your content's bottom by `calc(var(--basalt-bottom-offset) + var(--basalt-space-6))`, as the shell does. compose adds `viewport-fit=cover` for the safe area. +- In an app with a version, More's last row is the same `.version-link` in `div.tab-bar-version`, after the sheet's `.nav`. diff --git a/.agent/skills/basalt-html/parts/usage/topbar.md b/.agent/skills/basalt-html/parts/usage/topbar.md index 1fc52c6d..ac41d762 100644 --- a/.agent/skills/basalt-html/parts/usage/topbar.md +++ b/.agent/skills/basalt-html/parts/usage/topbar.md @@ -37,3 +37,4 @@ The page's one blurred (smoked) surface; it falls back to opaque on its own. - Groups are labelled `h2`s in sentence case; up to six links with no label and no `.site-footer-groups` is the line form (`data-form="line"` on the footer). The legal line and the theme choice are required. One `nav`. - The script makes each link a pill, and under 720 each group a disclosure (closed unless it holds `aria-current="page"`). Write none of it. +- The version (`.version-link`, written by `skill-body.mjs`'s `versionLink`) follows the legal line: wrap both in `div.site-footer-legal-row`, the label the product ("Basalt 0.2.0 · Nov 23, 2026"). Nothing marks a release as new. diff --git a/.agent/skills/release-words/SKILL.md b/.agent/skills/release-words/SKILL.md new file mode 100644 index 00000000..981259db --- /dev/null +++ b/.agent/skills/release-words/SKILL.md @@ -0,0 +1,153 @@ +--- +name: release-words +description: Write, edit or review a changelog entry, a release's summary, release notes or a version's page for Basalt or one of the owner's products. Use when a pull request changes something a person using the release will notice (it needs an entry), when a release is cut, when a release is announced, and when reviewing any of those before it is published. +--- + +# Release words + +The rules for the words of a release: one line per change (an entry), a release's summary, and release notes. They come from the +owner's standard of 23 Nov 2026 (`MAIN/.review/council/versioning/owner-handoff/versioning-and-changelog-standard.md`, section 5 for the +rules and 8 for the audit) and his answers in DECISIONS 308, 315 and 318, with the corrections the council's check found. Rule ids +(R1 to R20) are stable: cite them. For release notes, read `.agent/skills/site-words/SKILL.md` too: its rules hold in full. + +## Who decides + +- An agent drafts. **A person reads the rendered release before it is published** and says so on the release's pull request (R16). An + agent never records that for him. +- The owner's words are rulings. A fact nobody can find in the repository (a removal date, who the author is, what is public) is asked + for, never written. +- **Author is the person who wrote an entry's words, or who has said they take authorship of them.** An agent writes `author` only + when that person has said so for that pull request. Asking for a change, approving it or merging it makes nobody its author, and + an entry with no author is complete: its page shows no Author row. + +## Three kinds of text + +| | An entry | A summary | Release notes | +|---|---|---|---| +| What | One line for one change | One to three sentences over a release's list | A headline, then a short paragraph for each group of people it changes something for | +| Where | Every release, in the list | Every release of more than three changes. Optional where release notes lead, and then it goes with the list | A release with something new for the people using it; never a release of fixes alone | +| Voice | Past tense, no "we", no period | Plain sentences, present tense | Plain sentences, present tense; "we" is allowed and rarely needed | +| Rules | R1 to R15, R17, R19, R20 | R10, R11, R13, R15, R17, R18 | site-words, and R10, R11, R13, R15, R17, R18 | + +A product's page leads with the release notes and keeps the summary and the entries behind one fold. A reference changelog +(Basalt's) shows the summary and the entries. + +## An entry + +**R1. Start with one verb from the set, in past tense:** Added, Changed, Improved, Deprecated, Removed, Fixed, Reverted. A product's +entries too ("Home: Improved the open incident list so …", never "Home: The list now keeps your place"). +**R2. One change.** "And also", or two names that do two things, is two entries. Each thing a person can newly use is its own entry +(R20). +**R3. One sentence of at most 30 words, with no period at the end.** Under 12 words, check that the condition is there (R5); it is a +prompt to look, not a failure ("Fixed `/hooks` losing your place when going back" is right at 8). +**R4. Name the thing as its users write it.** A component, prop, token, class, export or command is in code formatting, spelled as it is +exported. A product's own words are not code: a button's label is in quotation marks, a rule ("touch targets") is plain. An entry with +no identifier to name needs none. +**R5. Fixed: the symptom a person saw, and when.** Never the cause, never "an issue". If nobody could have seen it, it has no entry (R8). +**R6. Changed: the old behavior and the new, in any wording** ("instead of", "from 1200ms to 1600ms", "where only the window's width +mattered before"). **Improved: a number or something a person can observe.** An old value comes from the code before the change, never +from memory. +**R7. An entry that needs action says what changed, what to do and by when,** and is marked `action`. One sentence if the fix fits in +it; otherwise it links its migration note. A deprecation names the replacement, the version that removes it and the earliest date, and +those two are the owner's decision: with no decision, the entry is "Added" for the new name and says nothing of removal. +`action` says where the entry stands on the page. It does not set the version: the entry's `bump` does. A type has a floor (Removed +is major, Added and Deprecated are minor, Fixed and Security are patch), a Changed entry always states `major`, `minor` or `patch`, +and `bump` may raise an entry and never lower it. What breaks on upgrading a package is `major` and `action`. A package's deprecation +breaks nothing on upgrading: it is a minor, under Deprecated. A product's notice with a date is `action` at whatever bump it needs. +**R8. For the person using the release.** No refactor, test, CI, dependency bump or internal rename unless they can see it. No fix for +something that was added and repaired between the same two releases: it never shipped broken. +**R9. Never "bug fixes and performance improvements".** If the fixes are too small to list, say how many and link the diff. +**R10. No marketing words** ("seamless", "powerful", "robust") and no exclamation marks. +**R11. "Now" once, for the new behavior. No future tense** except a dated removal. +**R12. It reads alone.** The sentence parses after the verb, and it does not lean on its neighbors ("both calls", "the same as above"). +It does not name its own release's version: that is not known when the entry is written, and the page says it. +**R13. Numerals with units, exact.** A measured number keeps its conditions ("about 860px with 20 rows") or is left out. +**R14. Sources go in the entry's file, not its sentence:** the pull request, tickets, bump and author are fields (see the file format in +`tools/changelog/README.md`). Never a ticket id, a pull request number or a name in the words. +**R15. No em dashes, no semicolons, no emoji, US spelling** ("color", "multicolor", "canceled"). +**R16. A person reads the final text** (see Who decides). +**R17. Every fact is in the repository or was given by the owner.** Never invent a date, a version, a commit, a deploy, a ticket, an +author, a removal promise or a rollout ("everyone is on this version"). Never name someone as author because they asked for the +change or approved it (see Who decides). +**R18. Nothing in a headline, a summary or a paragraph that the list does not hold.** Each paragraph names the entries it covers; a +claim with no entry gets an entry or goes. +**R19. Classify against the last published release.** Something that release did not have is Added, however many pull requests it took. +Fixed is only for behavior a published release had. +**R20. One entry for each thing a person can newly use:** a component, a prop, a hook, a token, a command, a page. A public addition +with no entry is a missing entry. + +An area comes before the sentence when the package or product has more than one surface: the component (`Button:`), `Tokens:`, a +product's page (`Home:`). It is a field, not typed into the sentence. + +## A summary + +One to three sentences: what the release adds or changes, in the order a reader would care. No list of everything, no count that the +page already shows, no adjective. + +## Release notes + +- **The headline is a subject and what it does now** ("A monitor can open an incident room"). Not "X's first release", not + "Introducing", no adjective. +- **Lead with what a person can do, then a paragraph for each group it differs for,** headed by the product's own word for them + ("For admins", "For responders"). Only groups the release changes something for: one paragraph with no heading when it is the same + for everyone, never a paragraph for each role to fill a row. +- **A paragraph is one to three sentences and says where to find it** ("On Home, open an incident marked …"). An instruction is an + instruction: "In Settings, open Integrations and add a webhook." +- **Something a person must do, or lose something, is "Action needed",** above the paragraphs, with who and by when. A step that only + turns a new thing on is not: it goes in that group's paragraph. +- **Say what the product does, in the reader's words,** not how it is built ("the agent's checks", not "the agent's first look already + running"; no "a second model that only reads the record"). Don't reassure about what did not change unless the release put it in doubt. +- Literal commands a person types (`@agent`) are code. Don't promise "anything". +- **A summary, when release notes lead, goes with the list**, inside the fold, and is optional there: the paragraphs have already + said what the release does. + +## The page's own words + +Fixed in Basalt's parts, in every product: "Release notes" (a product's page), "Changelog" (a package's), "Version", "Unreleased", +"Action needed", "Security", "Deprecated", "Removed", "Added", "Changed", "Fixed", "All changes", "Other changes" (the same fold when action entries stand above it), "Build +details", "Versions", +"Sources", "Pull request", "Ticket" and "Tickets", "Commit", "Author" and "Authors", "Your version", "Pre-release", "Linked", +"Copy link", "Copy link to this change", "Copy build details", "How to migrate", "3 more", "12 changes", "1 change", "4 need action", +"1 needs action". A package's action list opens "Before upgrading from 0.1.0, check these 4 changes." (the numbers computed). + +## The audit, before a release is published + +Log each failure as `rule id, quoted line, rewrite`. `node tools/changelog/audit.mjs` runs the lines marked (m); the rest are read. + +**Version** +- [ ] (m) The version is at least the highest `bump` among the entries, from the last release in its line (one place right in 0.x) +- [ ] (m) Every Changed entry states its bump; no bump is below its type's floor; every major entry is `action` +- [ ] The bump of each Changed entry is right: major if it can break someone's code or take something away, patch only for an + improvement with nothing to learn +- [ ] Every `action` and Deprecated entry says what to do, in its sentence or its migration note (R7) +- [ ] A deprecation's version and date are the owner's (R7, R17) +- [ ] (m) A pre-release is `-canary`, `-beta` or `-rc` +- [ ] (m) A stable release holds every entry its candidates held, under the same ids +- [ ] (m) No published release's record changed + +**Structure** +- [ ] (m) Sections in the order Action needed, Security, Deprecated, Removed, Added, Changed, Fixed; none empty +- [ ] (m) An area on every entry of a package or product with more than one surface +- [ ] (m) `CHANGELOG.md`, the page and the GitHub Release are generated from the one record + +**Each entry** +- [ ] (m) Starts with a verb of R1 +- [ ] One change, one sentence, (m) at most 30 words, (m) no period at the end (R2, R3) +- [ ] Names what it changed as its users write it (R4) +- [ ] Fixed: symptom and condition (R5). Changed: old and new. Improved: a number or an observable result (R6) +- [ ] Reads alone, and does not name its own version (R12) +- [ ] Nothing internal, nothing that never shipped broken (R8) +- [ ] (m) No stock phrase, banned word, exclamation mark, em dash, semicolon, emoji or British spelling (R9, R10, R15) +- [ ] (m) No future tense outside a dated removal (R11) +- [ ] (m) No ticket id, pull request number or person's name in the words (R14) +- [ ] (m) Every ticket matches one tracker, and an author, where there is one, is in the config +- [ ] An author wrote the words or said they take authorship of them; nobody is named for asking or approving (R17) +- [ ] Classified against the last published release (R19); every public addition has an entry (R20) + +**Summary and release notes** +- [ ] site-words, every rule +- [ ] The headline is a subject and what it does now +- [ ] (m) Every paragraph covers at least one entry; every claim is in the list (R18) +- [ ] Only the groups it changes something for +- [ ] Every fact is in the repository or was given by the owner (R17) +- [ ] A person read the rendered release and said so on the pull request (R16) diff --git a/.agent/skills/site-words/SKILL.md b/.agent/skills/site-words/SKILL.md index da2d51d1..bf07770e 100644 --- a/.agent/skills/site-words/SKILL.md +++ b/.agent/skills/site-words/SKILL.md @@ -10,6 +10,8 @@ The rules the owner set for the words on his sites, learned in the wording audit keeps its own voice; these rules hold on all of them. When a rule here and the owner's newer word disagree, his word wins: log it and fix this file. +A changelog entry, a release's summary or release notes also follows `.agent/skills/release-words/SKILL.md` (DECISIONS 320): its rules add to these. + ## Who decides - **His words are rulings; your words are proposals.** Draft from the record, never invent facts, and give delegated designers the exact diff --git a/AGENTS.md b/AGENTS.md index 0cdaa394..cf5fe486 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -168,6 +168,21 @@ Basalt has one owner (Bailey) and a design panel of two independent design revie traveller between two resting places on screen uses `ease-in-out` (a leg of 300ms up to 150px, 2ms a pixel above, 600ms from 300px); a filtered or sorted list or grid moves what stays by transform and never replaces an item (past 48 items that would move, it lands at once); a number beside a figure never counts up. The hold or printing settles a running entrance at once, and a page change without a reload counts as a load. Under reduced motion, opacity only. See `docs/motion.md`. +- **Versions and release notes:** a version is SemVer shown with its ship date ("Version 1.4.0 · Nov 23, 2026"), one link to the + release notes (`VersionLink`): at the sidebar's foot under the account items, the number alone in the rail, the last row of More's + sheet on a phone, after the legal line in a site's footer. Nothing marks a release as new, and there is no "What's new" item. A + release is its number and date in one heading, a summary, "Action needed" (a warning callout, never folded), a paragraph for each + audience it changes something for, then one line a change under Security, Deprecated, Removed, Added, Changed and Fixed, with counts + computed from the list. A product's list is one fold holding its summary, "All changes", or "Other changes" when action entries + stand above it, counted by what it opens; a package's is open, and only Fixed folds (past 3, in a release of more than 10). An + entry's source line is the pull request and at most two tickets, a quiet text button that opens "Sources" (pull request, tickets, + commit, and the author when the entry has one): beside the words from 640 of the release's own width, under them below it. On + touch no 44px box reaches another target's box or crosses a rim, a divider or a clipping edge: an entry is `space-3` above and + below, and a link with a source line under it stands `space-6` above it. The last change in Action needed or in a release has no + padding under it, and its box reaches into the callout's or the release's own padding. A release's last line is `space-10` above + its divider, whatever ends it. A change that has arrived keeps its padding. A release is `#v1.4.0`; an entry's id is permanent + and holds no version. The entry or release a link opens is the stream's arrival (the plate and "Linked"). Build details is on + the running release alone, from the running build. No area filter. - **Density and touch:** compact moves controls one step down, with a floor of 24px. Touch targets stay at least 44px whatever the density, on touch and in any window under 720 whatever the pointer (16px text entry stays touch-only), except a chart's day, reached by drag and by the keys (the phase lane's marks keep 44px). Text entry is 16px on touch. A one-line notification entry is at least 44 tall on touch, and a `Link` on a line of its own has a 44px hit box with no change to layout, its words raised over a stacked neighbour's box; a link in a sentence keeps its line. @@ -244,7 +259,8 @@ Basalt has one owner (Bailey) and a design panel of two independent design revie ## Writing words Any agent that writes, edits or reviews words a visitor will read (the sites, the products, Basalt's own UI strings) reads -`.agent/skills/site-words/SKILL.md` first: the owner's rules for copy, the research behind them, and how a rewrite is approved. +`.agent/skills/site-words/SKILL.md` first: the owner's rules for copy, the research behind them, and how a rewrite is approved. A changelog entry, +a release's summary or release notes also follows `.agent/skills/release-words/SKILL.md` (DECISIONS 320). ## Generating HTML diff --git a/docs/foundations.md b/docs/foundations.md index 922b54b7..a8cc09a3 100644 --- a/docs/foundations.md +++ b/docs/foundations.md @@ -2674,6 +2674,91 @@ at it, as a `Terminal` does, and says what must be heard through `StatusLine`. B - **Loading.** The stream's parts are drawn by `LoadingShape` like any others: an avatar is a bone in its disc, the name, time and words are bars as long as their words, a mark is a bone in its box. Nothing in them is sized by hand for loading. +## Versions and release notes + +The version on display, a package's changelog and a product's release notes (`VersionLink`, `ReleaseNotes` and `ReleaseIndex`; the HTML skill's +`release` module and `.version-link`; the records and outputs of `tools/changelog`). **Status:** decided by the council (DECISIONS 308, 315 and 318 +for the owner's answers, 320 revised by 321 for the rest); the implementation hasn't been reviewed. The words are `.agent/skills/release-words/SKILL.md`. + +### The version and its place + +- **A version is SemVer, shown with its ship date:** "Version 1.4.0 · Nov 23, 2026", no "v", the date a US short date with its year, never moved by + a reader's time zone. Build metadata (`1.4.0+9f3c1e2`) is never part of it. Markdown writes `## 1.4.0 - 2026-11-23`; a release's address is `#v1.4.0`. +- **One link to the release notes at that version** (`VersionLink`), showing the version this session runs: 12/16 Geist, tabular, in secondary ink + (primary and an underline on hover), the focus ring at +2, radius 4. Two parts that never break inside, the word with the number and the date; + when they do not fit one line the date goes under the number and the dot is not drawn. 24 tall on a fine pointer, a 44px hit box on touch that + moves nothing. On the release notes it is the current page: `aria-current`, primary, the number at 600 with its width reserved. Its name is the + visible words in order, then where it goes ("Version 1.4.0, Nov 23, 2026, release notes"). +- **Its places:** under the account items at the sidebar's foot, `space-2` below them, on the nav glyphs' start edge; in the rail (720 to 1023) + the number alone, centred, breaking before a pre-release's hyphen, the label and the date in its name and tooltip; under 720 the last row of More's + sheet, under a divider, 44 tall, at 13/18 (an app with no More draws it on its account or settings page); on a site with no sidebar, after the + legal line on its row, at 13/18, labelled with the product. +- **Nothing marks a release as new:** no dot, badge, read state or expiry, and no "What's new" item. A release that asks something of people says + so where they work (a `Callout`, a `NoticeBar` on a site), by the product's choice. + +### The page + +- **Releases highest first by SemVer precedence**, one column, each at most `size-prose-width` plus `space-6` plus `size-sidebar-width`, `space-10` + apart with a 1px divider between. A release ends on its last line: `space-10` from that line to the divider, as from the divider to the next + release's first line, whatever ends it. A fold that ends a release hangs the lower spare half of its button into that padding, open and closed; a + drawn box (Action needed, Copy build details) is measured from its edge. The versions are a pane beside the list (`ReleaseIndex` in `PaneLayout`'s + pane) and a closed fold above it where the pane would follow the page. No filter and no search. +- **A package's changelog** ("Changelog") shows Unreleased (merged work) and leads each release with its summary; **a product's release notes** + ("Release notes") never shows Unreleased and leads with its headline and a paragraph for each audience. +- **The header:** one heading holds the number and the date. With no headline the number is the heading, Geist Mono at `text-2xl`, 600, the meta + line under it at `space-1`; with a headline the meta line comes first (the number in Geist, as at the foot), then the headline at `text-2xl`, 600, + balanced. The meta line is 13/18 secondary, joined by dots: the date, the counts computed from the list ("17 changes", "4 need action", which links + to Action needed and takes the touch box), then "Pre-release" and "Your version", each the neutral outline `Badge` with no status. Copy link is a + ghost `sm` `CopyButton` at the end of the header's first line (the number, or a headline release's number and date), its centre on that line's + centre whatever its height, taking no height of its own; only that line makes room for it, and the headline and the counts take the release's + width. It is named for its release and copies the page's own address, read when it is pressed. +- **The order:** the header; a package's summary (16/24, primary, `space-4` under the header); Action needed; a product's paragraphs (an `h3` at 16/24 + 600 over each, none for everyone, `space-4` apart); then the list: Security, Deprecated, Removed, Added, Changed, Fixed, `space-6` apart, each an + `h3` at 16/24 600 with its count after it in tertiary at `space-1`. Empty sections are left out. +- **Action needed** is a warning `Callout` with its count, never folded, directly under the header (under the summary in a package's release). It + holds the entries marked `action`, which stand there and nowhere else. A package's opens "Before upgrading from 0.1.0, check these 4 changes."; + a product's has no opening line. +- **Folds:** a product's list is one fold holding its summary, "All changes", or "Other changes" when action entries stand above it, counted by what + it opens; inside it the headings are `h4` at 14/20 and nothing folds again. A package's list is open and only Fixed folds, past 3 in a release of + more than 10. A fold's button is its heading, 44 tall on touch; closed panels stay in the document so the browser's find opens them. Without + script and in print every fold is open. +- **Build details** is on the release this session runs, and on no other, at its foot, quieter than the fold above it (14/20, 400): the running + build's own rows (identifiers in mono) and Copy build details. Nothing in it is read from a release's record. When the running version matches no + release on the page, it stands above the first. + +### An entry and its sources + +- **The words:** 14/20, primary, the area first at 500. Code is inline code. A migration note is a link on its own line under the sentence. +- **The source line** is a quiet text button in Geist Mono at 13 on the entry's 20px line, secondary, underlined in `border-input`: the pull request, + then at most two tickets, then "3 more". Its name is its text after a hidden "Sources: ", described by the entry's words. From 640 of the + release's own width it stands beside the words in a column of its own down the list (`space-6` away), so the words keep one measure down a list; + under it, it is its own line under the words, wrapping between ids. +- **On touch no 44px box reaches another target's box**, and none crosses a rim, a divider or a clipping edge. A box is hit area and takes no room. + Between changes the entry keeps them apart: `space-3` above and below, the source line on the 20px line (a one-line entry is 44 tall), and, under + 640, a link with a source line under it `space-6` above it, with `space-3` under the entry. Where nothing follows a change inside its box, the + change has no padding under it and its box reaches into that box's own padding: to the callout's rim in Action needed (`space-3`, all of it), and + `space-3` into a release's `space-10`. At the foot of the list it reaches into the page's gap, so what follows a release list stands at least + `space-3` below it. On a fine pointer the source line's hit is 24 tall and reaches `space-0-5`. +- **A change that has arrived keeps its padding** in every place, for as long as its "Linked" line is held: the plate is a drawn box, equal above its + first line and under its last. +- **The sources panel** is a `Popover` under the line, end-aligned, at most `size-popover-max`, titled "Sources": Pull request, Ticket or Tickets (the + tracker's name in words, then the id), Commit, and Author only when the entry has one; then Copy link to this change. No "Built by", "Code review", + "Edited by" or "Decision" row. + +### Arriving + +- **An entry's id is permanent** and holds no version; a release is `#v1.4.0`. The fragment is looked up by id, never as a selector. A candidate whose + stable version has shipped is not drawn, and its address opens the stable release. +- **The target** has every fold that holds it opened, is scrolled to (its middle, or its top when it is taller than most of the window), focused with + no ring, and takes the stream's arrival: the plate (radius 8, `space-2` past the sides, `space-1` above and below; a release's on its header) and + "Linked" in secondary at 12 on a line above it, until the reader presses or types. In forced colours the plate goes and the word stays. + +### Modes and widths + +No sideways scroll at 390, 360 and 320, with every fold open and under WCAG 1.4.12 text spacing; an id longer than its line breaks anywhere. In forced +colours links and the source line keep their underline. Under more contrast tertiary steps to secondary. Print shows every fold, hides the Copy +buttons and prints a source line as text. + ## Stages and runs **Status.** Decided by the council for the owner's handoff (DECISIONS 302, 304, 307, 312 and 316); the implementation hasn't been reviewed. diff --git a/package.json b/package.json index d2333be6..88640363 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "ci:local": "node scripts/ci-local.mjs", "test:brand": "npm run build -w packages/tokens && node --test --test-timeout=120000 brand/test/*.test.mjs", "test:html-skill": "node --test --test-timeout=120000 tools/html-skill/test/*.test.mjs", + "test:changelog": "node --test --test-timeout=120000 tools/changelog/test/*.test.mjs", "test:sites": "node --test --test-timeout=120000 sites/test/*.test.mjs", "html-skill:shots": "node tools/html-skill/shoot.mjs" }, diff --git a/packages/react/build.mjs b/packages/react/build.mjs index 7ace96f1..2d890c6f 100644 --- a/packages/react/build.mjs +++ b/packages/react/build.mjs @@ -129,13 +129,65 @@ const readBarrel = (file, dir) => { }; readBarrel(path.join(here, "src", "index.ts"), path.join(here, "src")); +// The release notes' Sources popup is the fourth (a source line loads it on first use, release-notes.tsx), built the same way and for the same reason: a +// page of releases draws no popup until a reader asks for one, so the popup, its positioning and Floating UI are not in ReleaseNotes' first load. It +// imports nothing of Basalt's (the page draws what it holds and hands it in), and Base UI's popover is inlined too: left external, an app's bundler +// finds Base UI's popover in both this lazy file and the static Popover (feedback.tsx) and makes it a shared chunk that every import of that module +// then loads (ReleaseIndex went from 31 KB to 144 KB for an accordion), because it assigns chunks before it shakes. Only React stays external. +const reactOnly = ["react", "react/*", "react-dom", "react-dom/*"]; +// Base UI reads use-sync-external-store, which is CommonJS that requires React: an ES module cannot inline it (its require would fail in a browser), and +// left external it would be one more module shared with the static graph. Basalt needs React 19, which has useSyncExternalStore itself, and Base UI's +// selector path (with-selector) runs only before React 19, so the two are answered from React here. +const storeFromReact = { + name: "store-from-react", + setup(build) { + build.onResolve({ filter: /^use-sync-external-store\/shim(\/with-selector)?(\.js)?$/ }, (args) => ({ path: args.path, namespace: "store-from-react" })); + build.onLoad({ filter: /.*/, namespace: "store-from-react" }, (args) => ({ + contents: /with-selector/.test(args.path) + ? 'import { useSyncExternalStore } from "react"; export function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector) { return useSyncExternalStore(subscribe, () => selector(getSnapshot()), getServerSnapshot ? () => selector(getServerSnapshot()) : undefined); }' + : 'export { useSyncExternalStore } from "react";', + loader: "js", + })); + }, +}; +await esbuild.build({ + bundle: true, + format: "esm", + platform: "neutral", + target: "es2022", + jsx: "automatic", + logLevel: "warning", + entryPoints: [path.join(here, "src/release-sources.tsx")], + outdir: dist, + external: reactOnly, + plugins: [storeFromReact], + banner: { js: `"use client";` }, +}); + +// The rail's tooltip for the version at the foot is the fifth (AppShell loads it when the rail shows a version), built the same way and, like the Sources +// popup, with Base UI's tooltip inlined, so the shell's own import is what it was. Its one cost: the shell's TooltipProvider does not reach this copy, so +// the version's tooltip keeps its own open delay rather than the rail's shared one. +await esbuild.build({ + bundle: true, + format: "esm", + platform: "neutral", + target: "es2022", + jsx: "automatic", + logLevel: "warning", + entryPoints: [path.join(here, "src/rail-tooltip.tsx")], + outdir: dist, + external: reactOnly, + plugins: [storeFromReact, { name: "lazy-flight", setup(build) { build.onResolve({ filter: /^\.\/glyph-flight$/ }, (args) => (args.kind === "dynamic-import" ? { path: "./glyph-flight.js", external: true } : undefined)); } }], + banner: { js: `"use client";` }, +}); + await esbuild.build({ // One module per source file: with "sideEffects" limited to CSS, an app's bundler drops // every module it doesn't import (an app using Button never loads Menu, Base UI's menu or Shiki). // The core glyphs are modules of their own (src/glyphs), so an app that imports HomeGlyph bundles only HomeGlyph. entryPoints: [ // index.ts is not bundled: it is a barrel of `export { … } from "./module"` and is written as one, below, so each export comes from the module that holds it. - ...fs.readdirSync(path.join(here, "src")).filter((f) => /\.tsx?$/.test(f) && !f.endsWith(".d.ts") && !["command-panel.tsx", "glyph-flight.tsx", "diagram-motion.tsx", "diagram-motion-core.ts", "index.ts"].includes(f)).map((f) => path.join(here, "src", f)), + ...fs.readdirSync(path.join(here, "src")).filter((f) => /\.tsx?$/.test(f) && !f.endsWith(".d.ts") && !["command-panel.tsx", "glyph-flight.tsx", "diagram-motion.tsx", "diagram-motion-core.ts", "release-sources.tsx", "rail-tooltip.tsx", "index.ts"].includes(f)).map((f) => path.join(here, "src", f)), ...fs.readdirSync(path.join(here, "src", "glyphs")).filter((f) => /\.ts$/.test(f)).map((f) => path.join(here, "src", "glyphs", f)), // The service marks (DECISIONS 292, 2.6): one module a mark under dist/marks, at @srasyndicate/basalt/marks/<id>, never imported by the index, so an // app pays for the marks it imports and no others. Generated by marks/generate.mjs. @@ -146,7 +198,7 @@ await esbuild.build({ ...fs.readdirSync(path.join(here, "src", "tooling")).filter((f) => /\.ts$/.test(f)).map((f) => path.join(here, "src", "tooling", f)), ], define: { __PHOSPHOR_NOTICE__: JSON.stringify(phosphorNotice), __BASALT_ROOT_MAP__: JSON.stringify(JSON.stringify(rootMap)) }, - plugins: [{ name: "lazy-modules", setup(build) { build.onResolve({ filter: /^\.\/(command-panel|glyph-flight|diagram-motion)$/ }, (args) => (args.kind === "dynamic-import" ? { path: `${args.path}.js`, external: true } : undefined)); } }], + plugins: [{ name: "lazy-modules", setup(build) { build.onResolve({ filter: /^\.\/(command-panel|glyph-flight|diagram-motion|release-sources|rail-tooltip)$/ }, (args) => (args.kind === "dynamic-import" ? { path: `${args.path}.js`, external: true } : undefined)); } }], outdir: dist, bundle: true, splitting: true, @@ -199,7 +251,7 @@ const needsClient = (file, seen = new Set()) => { seen.add(file); return staticImports(fs.readFileSync(path.join(dist, file), "utf8")).some((specifier) => clientImport.test(specifier) || (/^\.\/chunk-/.test(specifier) && needsClient(specifier.slice(2), seen))); }; -for (const file of fs.readdirSync(dist, { recursive: true }).filter((f) => f.endsWith(".js") && !path.basename(f).startsWith("chunk-") && !["command-panel.js", "glyph-flight.js", "diagram-motion.js"].includes(f))) { +for (const file of fs.readdirSync(dist, { recursive: true }).filter((f) => f.endsWith(".js") && !path.basename(f).startsWith("chunk-") && !["command-panel.js", "glyph-flight.js", "diagram-motion.js", "release-sources.js", "rail-tooltip.js"].includes(f))) { const code = fs.readFileSync(path.join(dist, file), "utf8"); if (needsClient(file)) fs.writeFileSync(path.join(dist, file), `"use client";\n${code}`); } diff --git a/packages/react/src/app-shell.tsx b/packages/react/src/app-shell.tsx index 1ff9778c..a2857a1f 100644 --- a/packages/react/src/app-shell.tsx +++ b/packages/react/src/app-shell.tsx @@ -6,8 +6,10 @@ import { DotLine } from "./dot-sep"; import { NavRailContext } from "./nav"; import { usePinnedEdges } from "./pinned-edges"; import { useScreenKeyboardLayout } from "./screen-keyboard"; +import type { TooltipProps } from "./display"; import { useMediaQuery } from "./use-media"; import { join } from "./utils"; +import { RailTooltipContext, VersionContext, VersionPlaceContext } from "./version-place"; // The app shell (decisions 96): a sidebar at 1024 and up, the rail from 720 to 1023, the phone tab bar under 720, and one // header over the content column. The document is the scroller, never an inner pane (a page's own pane beside it is @@ -15,6 +17,15 @@ import { join } from "./utils"; // size-tab-bar and the breakpoints; decision 101). The capped form is --basalt-shell-width wide at most, centred: by default // size-sidebar-width plus size-page-width, so at the cap the column is exactly the page's own cap. +// The rail's tooltip for the version, on demand: only a shell in the rail with a version loads it (rail-tooltip.tsx). Until it is there the number +// stands alone, with its whole line in its name. A lazy component is made on first use, so loading this module does nothing. +let railTooltip: React.ComponentType<TooltipProps> | undefined; +function LazyRailTooltip(props: TooltipProps) { + railTooltip ??= React.lazy(() => import("./rail-tooltip").then((module) => ({ default: module.RailTooltip }))); + const Tip = railTooltip; + return <React.Suspense fallback={props.children}><Tip {...props} /></React.Suspense>; +} + export interface AppShellProps extends Omit<React.ComponentProps<"div">, "children"> { /** The brand in the sidebar's 56px band: the lockup (mark and word). It links home and draws no line of its own. A brand file goes in as `<BrandSvg source={file} />`, which hides it and drops its title; the link's name is `brandLabel`. */ brand: React.ReactNode; @@ -31,6 +42,11 @@ export interface AppShellProps extends Omit<React.ComponentProps<"div">, "childr sidebar: React.ReactNode; /** Account items pinned to the sidebar's foot: a second `Nav` (named "Account", say) holding Settings, Profile and the like. */ account?: React.ReactNode; + /** + * The version this session runs, as a `VersionLink` to the release notes at that version. Drawn at the sidebar's foot under the account + * items, as the number alone in the rail (the date in its name and tooltip), and as the last row of `TabBarMore`'s sheet under 720. + */ + version?: React.ReactNode; /** The `AppHeader`: it spans the content column only, never the sidebar. */ header: React.ReactNode; /** The phone `TabBar`, for an app with three or more destinations. Content pads past it, and toasts sit above it. */ @@ -63,7 +79,7 @@ export interface AppShellProps extends Omit<React.ComponentProps<"div">, "childr * content column and sticks to the document, which is what scrolls: set `scrollbar-gutter: stable` on the page (the shell * does for the document it is in), and give the viewport meta `viewport-fit=cover` so the safe-area insets work. */ -export function AppShell({ brand, brandLabel, homeHref = "/", brandMark, sidebar, account, header, tabBar, foot, mainProps, capped = false, className, children, ...props }: AppShellProps) { +export function AppShell({ brand, brandLabel, homeHref = "/", brandMark, sidebar, account, version, header, tabBar, foot, mainProps, capped = false, className, children, ...props }: AppShellProps) { const rail = useMediaQuery(`(width < ${breakpoint.lg}px)`); useScreenKeyboardLayout(); usePinnedEdges(foot != null); @@ -79,7 +95,16 @@ export function AppShell({ brand, brandLabel, homeHref = "/", brandMark, sidebar <TooltipProvider> <NavRailContext.Provider value={rail}> <div className="basalt-app-nav">{sidebar}</div> - {account ? <div className="basalt-app-account">{account}</div> : null} + {account || version ? ( + <div className="basalt-app-account"> + {account} + {version ? ( + <div className="basalt-app-version"> + <VersionPlaceContext.Provider value={rail ? "rail" : "foot"}><RailTooltipContext.Provider value={LazyRailTooltip}>{version}</RailTooltipContext.Provider></VersionPlaceContext.Provider> + </div> + ) : null} + </div> + ) : null} </NavRailContext.Provider> </TooltipProvider> </aside> @@ -88,7 +113,7 @@ export function AppShell({ brand, brandLabel, homeHref = "/", brandMark, sidebar <main {...mainProps} className={join("basalt-app-main", mainProps?.className)}>{children}</main> {foot != null ? <div className="basalt-app-foot" data-pinned-edge="bottom">{foot}</div> : null} </div> - {tabBar} + {version ? <VersionContext.Provider value={version}>{tabBar}</VersionContext.Provider> : tabBar} </div> ); } diff --git a/packages/react/src/arrival.ts b/packages/react/src/arrival.ts new file mode 100644 index 00000000..723a758d --- /dev/null +++ b/packages/react/src/arrival.ts @@ -0,0 +1,101 @@ +import * as React from "react"; + +import { useInShape } from "./in-shape"; + +// The entry a link, a search result or a notice opened (DECISIONS 266, and 320 for the release notes): scrolled to, focused with no ring (it is a +// place, not a control), and marked until the reader acts (a press, or a key that is not one that reads around it). Shared by the stream's entries +// and the release notes' releases and entries; each draws its own mark (the plate and the word "Linked"). Nothing runs when the module loads. + +/** Keys that read around the entry rather than act: they leave the mark where it is. A pattern, not a set, so loading the module builds nothing. */ +const reading = (key: string) => /^(Arrow(Up|Down|Left|Right)|Page(Up|Down)|Home|End| |Shift|Control|Alt|Meta|CapsLock)$/.test(key); + +export interface ArrivalProps { + /** This is the entry a link, a search result or a notice opened: it is scrolled to, focused and marked until the reader acts. */ + arrived?: boolean; + /** The word that says so, in the entry's head. Default "Linked"; an app says why in its own words ("Search result", "From your notice"). */ + arrivedLabel?: string; + /** The reader has acted, so the mark is going. Without it the part ends the mark itself; with it, the app may also clear `arrived`. */ + onArrivedEnd?: () => void; +} + +// One entry arrives at a time. The one placed last is the one the reader is at: placing another ends the one before (its `onArrivedEnd` is +// called). Assigned only while an entry is arrived, so loading this module does nothing. +let current: { end: () => void } | undefined; + +/** Whether the element has a box the reader can see: not under `display: none` (nor `content-visibility: hidden`). */ +const shown = (el: HTMLElement) => el.getClientRects().length > 0 && (typeof el.checkVisibility !== "function" || el.checkVisibility()); + +/** The nearest ancestor that scrolls the entry on the block axis, or null when it is the page. */ +function scrollerOf(el: HTMLElement): HTMLElement | null { + for (let at = el.parentElement; at && at !== document.body && at !== document.documentElement; at = at.parentElement) { + const { overflowY } = getComputedStyle(at); + if ((overflowY === "auto" || overflowY === "scroll") && at.scrollHeight > at.clientHeight) return at; + } + return null; +} + +/** + * The arrival's state: shown while `arrived` and the reader has not acted yet. Once the entry has a box (a pane it sits in may be hidden when it + * mounts) it is scrolled to and focused, once each time it turns on, and from then the reader's first act ends it. + */ +export function useArrival<T extends HTMLElement>({ arrived = false, onArrivedEnd }: ArrivalProps) { + const inShape = useInShape(); + const ref = React.useRef<T>(null); + const [ended, setEnded] = React.useState(false); + const [ever, setEver] = React.useState(false); + const [placed, setPlaced] = React.useState(false); + const end = React.useRef(onArrivedEnd); + end.current = onArrivedEnd; + React.useEffect(() => { if (arrived) setEnded(false); }, [arrived]); + const on = arrived && !ended && inShape === 0; + React.useEffect(() => { if (!on) setPlaced(false); }, [on]); + React.useLayoutEffect(() => { + if (!on || placed) return undefined; + const el = ref.current; + if (!el) return undefined; + const place = () => { + // A short entry is brought to the middle of what scrolls it; one taller than most of that (the pane's visible height, or the window's), to its top. + const scroller = scrollerOf(el); + const room = scroller ? scroller.clientHeight : window.innerHeight; + el.scrollIntoView({ block: el.getBoundingClientRect().height > room * 0.6 ? "start" : "center", inline: "nearest" }); + el.focus({ preventScroll: true }); + setEver(true); + setPlaced(true); + }; + if (shown(el)) { place(); return undefined; } + // Not laid out yet (a hidden tab or pane): wait until it has a box, then place it once. + const watch = new ResizeObserver(() => { if (shown(el)) { watch.disconnect(); place(); } }); + watch.observe(el); + return () => watch.disconnect(); + }, [on, placed]); + React.useEffect(() => { + if (!on || !placed) return undefined; + const finish = () => { setEnded(true); end.current?.(); }; + const self = { end: finish }; + if (current && current !== self) current.end(); + current = self; + const act = (event: Event) => { + if (event.type === "keydown") { + const key = (event as KeyboardEvent).key; + const inField = (event.target as Element | null)?.closest?.("input, textarea, select, [contenteditable='true'], [contenteditable='']"); + if (reading(key) && !(key === " " && inField)) return; + } + finish(); + }; + // From the next frame, so the press or key that opened the entry does not end its mark. + const frame = requestAnimationFrame(() => { + document.addEventListener("pointerdown", act, true); + document.addEventListener("keydown", act, true); + }); + return () => { + if (current === self) current = undefined; + cancelAnimationFrame(frame); + document.removeEventListener("pointerdown", act, true); + document.removeEventListener("keydown", act, true); + }; + }, [on, placed]); + // Once it has arrived the entry stays a focus target, so taking the mark away never drops the reader's focus. + const attrs = { ref, tabIndex: ever || on ? -1 : undefined, "data-arrival": ever || on ? "" : undefined, "data-arrived": on ? "" : undefined }; + return { on, ever: ever || on, attrs }; +} + diff --git a/packages/react/src/copy-button.tsx b/packages/react/src/copy-button.tsx index 52bf4626..ff661ba7 100644 --- a/packages/react/src/copy-button.tsx +++ b/packages/react/src/copy-button.tsx @@ -9,8 +9,8 @@ import { Reserve } from "./reserve"; import { join } from "./utils"; export interface CopyButtonProps extends Omit<React.ComponentProps<"button">, "children" | "onClick" | "type" | "color"> { - /** What is copied. */ - text: string; + /** What is copied, or a function that gives it when the button is pressed (an address that follows the page's route). */ + text: string | (() => string); /** The words at rest, in the app's language: "Copy address". Default "Copy". */ children?: React.ReactNode; /** The words after the copy: default "Copied". */ @@ -37,7 +37,7 @@ export function CopyButton({ text, children = "Copy", copiedLabel = "Copied", st React.useEffect(() => () => clearTimeout(timer.current), []); const copy = async () => { try { - await navigator.clipboard.writeText(text); + await navigator.clipboard.writeText(typeof text === "function" ? text() : text); } catch { // clipboard refused (an insecure context or no permission): leave the button as it was return; diff --git a/packages/react/src/index.ts b/packages/react/src/index.ts index 39669fe3..9193ef7f 100644 --- a/packages/react/src/index.ts +++ b/packages/react/src/index.ts @@ -129,6 +129,13 @@ export { EventLine, EventLog, EventLogRule, EventText, EventTime } from "./event export type { EventLineProps, EventLogProps, EventLogRuleProps, EventTextProps, EventTimeProps } from "./event-log"; export { Stream, StreamArrivedWord, StreamBlock, StreamEntry, StreamMessage, StreamNote, StreamQuote } from "./stream"; export type { ArrivalProps, StreamBlockProps, StreamEntryProps, StreamMessageProps, StreamNoteProps, StreamProps, StreamQuoteProps } from "./stream"; +// Versions and release notes (DECISIONS 320): each its own module, so an app that shows only the foot's link loads only that. +export { VersionLink } from "./version-link"; +export type { VersionLinkProps } from "./version-link"; +export { ReleaseNotes } from "./release-notes"; +export type { ReleaseAudience, ReleaseBuildRow, ReleaseBump, ReleaseEntryRecord, ReleaseEntryType, ReleaseNotesProps, ReleaseRecord, ReleaseWords } from "./release-notes"; +export { ReleaseIndex } from "./release-index"; +export type { ReleaseIndexProps } from "./release-index"; export { DisclosureRow } from "./disclosure-row"; export type { DisclosureRowProps } from "./disclosure-row"; export { ActivityList, ActivityStep } from "./activity-list"; diff --git a/packages/react/src/rail-tooltip.tsx b/packages/react/src/rail-tooltip.tsx new file mode 100644 index 00000000..9663dbbb --- /dev/null +++ b/packages/react/src/rail-tooltip.tsx @@ -0,0 +1,3 @@ +// The rail's tooltip for the version at the foot (DECISIONS 320, 1.2), loaded by AppShell only when the rail shows a version: the shell's own import +// stays as it was, and a page with no version, or out of the rail, loads no tooltip for it. Nothing runs when the module loads. +export { Tooltip as RailTooltip } from "./display"; diff --git a/packages/react/src/release-date.ts b/packages/react/src/release-date.ts new file mode 100644 index 00000000..abfbee3f --- /dev/null +++ b/packages/react/src/release-date.ts @@ -0,0 +1,18 @@ +// A release's ship date (DECISIONS 320, 1.1): a calendar date written once, `YYYY-MM-DD`, drawn "Nov 23, 2026" with its year always, and never +// moved by a reader's time zone, so it cannot show the day before. It draws nothing and holds no state; nothing runs when the module loads. + +/** The parts of an ISO calendar date, or null when it is not one. */ +export function calendarDate(iso: string): { year: number; month: number; day: number } | null { + const match = /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/.exec(iso); + if (!match) return null; + const [year, month, day] = [Number(match[1]), Number(match[2]), Number(match[3])]; + const at = new Date(Date.UTC(year, month - 1, day)); + return at.getUTCFullYear() === year && at.getUTCMonth() === month - 1 && at.getUTCDate() === day ? { year, month, day } : null; +} + +/** "Nov 23, 2026" in `en-US`: the locale's short date with its year, read in UTC so the day never moves. A string that is not a date is returned as it is. */ +export function formatReleaseDate(iso: string, locale: string | string[] = "en-US"): string { + const date = calendarDate(iso); + if (!date) return iso; + return new Intl.DateTimeFormat(locale, { month: "short", day: "numeric", year: "numeric", timeZone: "UTC" }).format(new Date(Date.UTC(date.year, date.month - 1, date.day))); +} diff --git a/packages/react/src/release-index.tsx b/packages/react/src/release-index.tsx new file mode 100644 index 00000000..74ebec0e --- /dev/null +++ b/packages/react/src/release-index.tsx @@ -0,0 +1,71 @@ +import * as React from "react"; + +import { Accordion, AccordionItem } from "./feedback"; +import { formatReleaseDate } from "./release-date"; +import type { ReleaseRecord } from "./release-types"; +import { join } from "./utils"; + +// The versions (DECISIONS 320, 2.11): a `nav` named "Versions", one link a release, in the page's order: the number in mono and primary, the date +// at the row's end in tertiary, 13/18, 30 tall and 44 on touch; hover underlines the number. Beside the list it is `PaneLayout`'s pane, under a +// 13/18, 500 heading; where the pane would follow the page instead, it is a closed fold above the first release. A page draws both forms, the +// pane in `PaneLayout`'s pane and the fold before `ReleaseNotes`, and each shows only where it belongs: +// +// <PaneLayout pane={<ReleaseIndex releases={releases} />} paneLabel="Versions"> +// <ReleaseIndex releases={releases} form="fold" /> +// <ReleaseNotes releases={releases} form="reference" product="Basalt" /> +// </PaneLayout> + +export interface ReleaseIndexProps extends Omit<React.ComponentProps<"nav">, "children"> { + releases: readonly Pick<ReleaseRecord, "version" | "date" | "unreleased">[]; + /** Default "Versions". */ + label?: string; + /** "pane" (default): the list under its heading, for `PaneLayout`'s pane. "fold": a closed fold above the first release, where the pane is not beside the page. */ + form?: "pane" | "fold"; + /** The dates' locale. Default "en-US". */ + locale?: string; + /** The word for the Unreleased row. Default "Unreleased". */ + unreleasedLabel?: string; +} + +/** The versions of a release page. See the module note. */ +export function ReleaseIndex({ releases, label = "Versions", form = "pane", locale = "en-US", unreleasedLabel = "Unreleased", className, ...props }: ReleaseIndexProps) { + const titleId = React.useId(); + // Without script the fold is open; once the page runs it starts closed. + const [open, setOpen] = React.useState<string[]>(["versions"]); + const wired = React.useRef(false); + React.useLayoutEffect(() => { + if (wired.current || form !== "fold") return; + wired.current = true; + setOpen([]); + }, [form]); + const list = ( + <ul className="basalt-release-index-list"> + {releases.map((release) => { + const id = release.unreleased ? "unreleased" : `v${release.version}`; + return ( + <li key={id}> + <a href={`#${id}`} className="basalt-release-index-link"> + <span className="basalt-release-index-number" data-words={release.unreleased ? "" : undefined}>{release.unreleased ? unreleasedLabel : release.version}</span> + {release.date ? <><span className="basalt-visually-hidden">, </span><time dateTime={release.date}>{formatReleaseDate(release.date, locale)}</time></> : null} + </a> + </li> + ); + })} + </ul> + ); + if (form === "fold") { + return ( + <nav {...props} aria-label={label} data-form="fold" className={join("basalt-release-index", className)}> + <Accordion hiddenUntilFound value={open} onValueChange={setOpen} className="basalt-release-fold"> + <AccordionItem value="versions" title={label} headingLevel={2}>{list}</AccordionItem> + </Accordion> + </nav> + ); + } + return ( + <nav {...props} aria-labelledby={titleId} data-form="pane" className={join("basalt-release-index", className)}> + <h2 id={titleId} className="basalt-release-index-title">{label}</h2> + {list} + </nav> + ); +} diff --git a/packages/react/src/release-notes.tsx b/packages/react/src/release-notes.tsx new file mode 100644 index 00000000..896b2e85 --- /dev/null +++ b/packages/react/src/release-notes.tsx @@ -0,0 +1,510 @@ +import * as React from "react"; + +import { useArrival } from "./arrival"; +import { CopyButton } from "./copy-button"; +import { DescriptionItem, DescriptionList } from "./description-list"; +import { Badge } from "./display"; +import { DotLine, DotSep } from "./dot-sep"; +import { Accordion, AccordionItem, Callout } from "./feedback"; +import { inLevel, useFloatingLayer, usePopupLevel } from "./layers"; +import { Link } from "./navigation"; +import { formatReleaseDate } from "./release-date"; +import type { ReleaseEntryRecord, ReleaseEntryType, ReleaseRecord } from "./release-types"; +import { TextButton } from "./text-button"; +import { join } from "./utils"; + +export type { ReleaseAudience, ReleaseBump, ReleaseEntryRecord, ReleaseEntryType, ReleaseRecord } from "./release-types"; + +// A page of releases from their records (DECISIONS 320, section 2): a package's changelog ("reference") or a product's release notes ("notes"). +// Releases highest first, one column, each at most the words' measure plus space-6 plus the sidebar's width, space-10 apart with a divider +// between. A release is its header (the number and the date in one heading, the counts computed from its list, "Pre-release" and "Your version", +// Copy link), then a package's summary, "Action needed" (a warning callout, never folded), a product's paragraphs for each audience, then one line +// a change under Security, Deprecated, Removed, Added, Changed and Fixed. A product's list is one fold holding its summary: "All changes", or +// "Other changes" when action entries stand above it, counted by what it opens. A package's list is open and only Fixed folds (past 3, in a +// release of more than 10). Each entry's source line (the pull request and at most two tickets) is a quiet text button that opens "Sources"; +// from 640 of the release's own width it stands beside the words in one column down the list, under it below that. A release is `#v1.4.0`, an +// entry its permanent id; the one a link opens is the stream's arrival (the plate and "Linked"), with every fold that holds it opened. Build +// details is on the release this session runs, from the running build. Nothing on the page is typed twice: the order, the counts, the folds and +// the callout's opening line come from the record. Without script, and in print, every fold is open. + +/** The page's fixed words, for another language. Counted words are functions of their number. */ +export interface ReleaseWords { + unreleased: string; + actionNeeded: string; + sections: Record<ReleaseEntryType, string>; + allChanges: string; + otherChanges: string; + buildDetails: string; + sources: string; + pullRequest: string; + ticket: string; + tickets: string; + commit: string; + author: string; + authors: string; + yourVersion: string; + preRelease: string; + linked: string; + copyLink: string; + /** The name of a release's Copy link: "Copy link to Basalt 0.2.0". */ + copyLinkTo: (release: string) => string; + copyLinkToChange: string; + copyBuildDetails: string; + copied: string; + linkCopied: string; + buildDetailsCopied: string; + more: (count: number) => string; + changes: (count: number) => string; + needAction: (count: number) => string; + /** "Before upgrading from 0.1.0, check these 4 changes." */ + beforeUpgrading: (previous: string, count: number) => string; +} + +const WORDS: ReleaseWords = { + unreleased: "Unreleased", + actionNeeded: "Action needed", + sections: { security: "Security", deprecated: "Deprecated", removed: "Removed", added: "Added", changed: "Changed", fixed: "Fixed" }, + allChanges: "All changes", + otherChanges: "Other changes", + buildDetails: "Build details", + sources: "Sources", + pullRequest: "Pull request", + ticket: "Ticket", + tickets: "Tickets", + commit: "Commit", + author: "Author", + authors: "Authors", + yourVersion: "Your version", + preRelease: "Pre-release", + linked: "Linked", + copyLink: "Copy link", + copyLinkTo: (release) => `Copy link to ${release}`, + copyLinkToChange: "Copy link to this change", + copyBuildDetails: "Copy build details", + copied: "Copied", + linkCopied: "Link copied", + buildDetailsCopied: "Build details copied", + more: (count) => `${count} more`, + changes: (count) => `${count} ${count === 1 ? "change" : "changes"}`, + needAction: (count) => `${count} ${count === 1 ? "needs action" : "need action"}`, + beforeUpgrading: (previous, count) => `Before upgrading from ${previous}, check ${count === 1 ? "this change" : `these ${count} changes`}.`, +}; + +export interface ReleaseBuildRow { + label: string; + value: string; + /** An identifier (a build, a commit): mono. */ + mono?: boolean; +} + +export interface ReleaseNotesProps extends Omit<React.ComponentProps<"div">, "children"> { + releases: readonly ReleaseRecord[]; + /** "reference": the list open, Unreleased shown (a package). "notes": audience paragraphs lead and the list folds (a product). */ + form: "reference" | "notes"; + /** The product's name, for "Copy link to Basalt 0.2.0". */ + product: string; + /** The page's own address, for copied links. Default: the window's, read when a button is pressed. */ + baseHref?: string; + /** The version this session runs: that release carries "Your version". */ + running?: string; + /** The running build's own rows, from what the app's build wrote: Build details, on the release marked "Your version". Never read from a record. */ + runningBuild?: readonly ReleaseBuildRow[]; + /** The level of a release's heading. Default 2. */ + headingLevel?: 2 | 3; + /** The entry or release to mark as arrived, for an app with its own router. Default: the window's fragment, followed on hashchange. */ + arrived?: string | null; + onArrivedEnd?: () => void; + /** The page's fixed words, for another language. */ + words?: Partial<ReleaseWords>; + /** The dates' locale. Default "en-US". */ + locale?: string; +} + +const ORDER: readonly ReleaseEntryType[] = ["security", "deprecated", "removed", "added", "changed", "fixed"]; +const RANK = { major: 0, minor: 1, patch: 2 } as const; +/** Fixed folds when the release holds more than this many changes, and Fixed more than `FOLD_FIXED`. */ +const FOLD_OVER = 10; +const FOLD_FIXED = 3; +/** The source line names the pull request and at most this many tickets. */ +const SHOWN_TICKETS = 2; + +/** A release's address: "v1.4.0", "unreleased". */ +export const releaseId = (release: Pick<ReleaseRecord, "version" | "unreleased">) => (release.unreleased ? "unreleased" : `v${release.version}`); + +/** Inside a section, entries stand by impact (the bump), then by area, then by id. */ +const byImpact = (a: ReleaseEntryRecord, b: ReleaseEntryRecord) => + RANK[a.bump] - RANK[b.bump] || (a.area ?? "").localeCompare(b.area ?? "", "en") || a.id.localeCompare(b.id, "en"); + +/** The sentence: backticks mark code, and nothing else is markup. */ +function Sentence({ text }: { text: string }) { + const parts = text.split(/`([^`]+)`/); + return <>{parts.map((part, index) => (index % 2 ? <code key={index} className="basalt-inline-code">{part}</code> : <React.Fragment key={index}>{part}</React.Fragment>))}</>; +} + +interface Section { type: ReleaseEntryType; entries: ReleaseEntryRecord[] } + +/** The release's parts, computed from its record. */ +function partsOf(release: ReleaseRecord, form: ReleaseNotesProps["form"]) { + const action = release.entries.filter((entry) => entry.action).sort(byImpact); + const sections: Section[] = ORDER.map((type) => ({ type, entries: release.entries.filter((entry) => !entry.action && entry.type === type).sort(byImpact) })).filter((section) => section.entries.length > 0); + const inside = sections.reduce((sum, section) => sum + section.entries.length, 0); + const leads = form === "notes" && Boolean(release.audiences?.length); + const folded = leads && inside > 0; + // Only a package's list folds Fixed; a product's patch with no paragraphs shows its list open (2.7). + const fixedFolds = form === "reference" && release.entries.length > FOLD_OVER && (sections.find((section) => section.type === "fixed")?.entries.length ?? 0) > FOLD_FIXED; + return { action, sections, inside, leads, folded, fixedFolds }; +} + +/** The keys of the folds a release has, and the fold that holds each entry. */ +function foldsOf(release: ReleaseRecord, form: ReleaseNotesProps["form"]) { + const id = releaseId(release); + const { folded, fixedFolds, sections } = partsOf(release, form); + const all: string[] = []; + const holding = new Map<string, string>(); + if (folded) { + all.push(`${id}__all`); + for (const section of sections) for (const entry of section.entries) holding.set(entry.id, `${id}__all`); + } else if (fixedFolds) { + all.push(`${id}__fixed`); + for (const entry of sections.find((section) => section.type === "fixed")?.entries ?? []) holding.set(entry.id, `${id}__fixed`); + } + return { all, holding }; +} + +/** + * The page's own address with no fragment and no query, read when a Copy button is pressed: the app's, or the window's then, so a page that has + * changed its route since it was drawn copies where it is now. + */ +const baseOf = (baseHref: string | undefined) => () => (baseHref !== undefined ? baseHref : `${window.location.origin}${window.location.pathname}`); + +/** The arrived target: the app's, or the window's fragment followed on hashchange. Each change is a fresh arrival. */ +function useTarget(arrived: string | null | undefined) { + const [fragment, setFragment] = React.useState<string | null>(null); + React.useEffect(() => { + if (arrived !== undefined) return undefined; + let frame = 0; + const read = () => { + const raw = window.location.hash.slice(1); + let id = raw; + try { id = decodeURIComponent(raw); } catch { /* a fragment that is not valid percent-encoding is read as written */ } + // Turn it off first, then on, so the same target reached again (Back, then Forward) arrives again. + setFragment(null); + cancelAnimationFrame(frame); + frame = requestAnimationFrame(() => setFragment(id || null)); + }; + read(); + window.addEventListener("hashchange", read); + return () => { cancelAnimationFrame(frame); window.removeEventListener("hashchange", read); }; + }, [arrived]); + return arrived !== undefined ? arrived : fragment; +} + +interface Shared { + words: ReleaseWords; + base: () => string; + locale: string; + level: 2 | 3; + target: string | null; + onArrivedEnd?: () => void; + open: ReadonlySet<string>; + setFold: (key: string, open: boolean) => void; +} + +/** The word "Linked", on a line above what arrived, kept in place once it has been shown so its going moves nothing. */ +function ArrivedWord({ on, ever, label }: { on: boolean; ever: boolean; label: string }) { + if (!ever) return null; + return <span className="basalt-stream-word basalt-stream-word-line basalt-release-word" data-on={on ? "" : undefined} aria-hidden={on ? undefined : true}>{label}</span>; +} + +function Heading({ level, ...props }: React.ComponentProps<"h2"> & { level: number }) { + return React.createElement(`h${Math.min(level, 6)}`, props); +} + +/** A fold: an accordion of one item whose heading holds the button. Closed panels stay in the document, so the browser's find opens them. */ +function Fold({ name, title, level, shared, className, children }: { name: string; title: React.ReactNode; level: number; shared: Shared; className?: string; children: React.ReactNode }) { + const value = shared.open.has(name) ? [name] : []; + return ( + <Accordion hiddenUntilFound value={value} onValueChange={(next) => shared.setFold(name, next.includes(name))} className={join("basalt-release-fold", className)}> + <AccordionItem value={name} headingLevel={Math.min(level, 6) as 2 | 3 | 4 | 5 | 6} title={title}>{children}</AccordionItem> + </Accordion> + ); +} + +/** A count after its name, `space-1` away: the space is read, the gap drawn. */ +const Count = ({ n }: { n: number }) => <span className="basalt-release-count"><span className="basalt-visually-hidden"> </span>{n}</span>; + +// The Sources popup loads the first time a reader reaches for a source line (release-sources.tsx): the page draws the line, and the popup, its +// positioning and Floating UI come only when someone asks. Pointing at or focusing a line starts the load; pressing it opens the panel as soon as +// the popup is there (a press that waits shows the TextButton's own busy mark after 300ms). Assigned on first use, so loading this module does nothing. +type SourcesModule = typeof import("./release-sources"); +let sourcesLoading: Promise<SourcesModule> | undefined; +const loadSources = () => (sourcesLoading ??= import("./release-sources").catch((error) => { sourcesLoading = undefined; throw error; })); + +function SourceLine({ entry, textId, shared }: { entry: ReleaseEntryRecord; textId: string; shared: Shared }) { + // The panel itself takes focus when it opens (its first link would draw a ring the reader did not ask for); Tab goes on into it. + const panel = React.useRef<HTMLDivElement>(null); + const level = usePopupLevel(); + const layer = useFloatingLayer(); + const [Popup, setPopup] = React.useState<SourcesModule["SourcesPopup"] | null>(null); + const [open, setOpen] = React.useState(false); + const { words } = shared; + const tickets = entry.tickets ?? []; + const ids: string[] = []; + if (entry.pr) ids.push(`#${entry.pr.number}`); + for (const ticket of tickets.slice(0, SHOWN_TICKETS)) ids.push(ticket.label); + if (!entry.pr && !tickets.length && entry.commit) ids.push(entry.commit.sha.slice(0, 8)); + if (!ids.length) return null; + const more = tickets.length - SHOWN_TICKETS; + const shown = more > 0 ? [...ids, words.more(more)] : ids; + const warm = () => { loadSources().catch(() => {}); }; + const trigger = ( + <TextButton + quiet + className="basalt-release-source" + aria-describedby={textId} + aria-haspopup="dialog" + aria-expanded={open} + onPointerEnter={Popup ? undefined : warm} + onFocus={Popup ? undefined : warm} + onClick={Popup ? undefined : () => loadSources().then((module) => { setPopup(() => module.SourcesPopup); setOpen(true); })} + > + <span className="basalt-visually-hidden">{words.sources}: </span> + {shown.map((id, index) => ( + <React.Fragment key={index}> + {index > 0 ? <DotSep spaced /> : null} + <span className="basalt-release-id">{id}</span> + </React.Fragment> + ))} + </TextButton> + ); + if (!Popup) return trigger; + const rows = ( + <> + <DescriptionList className="basalt-release-sources-list"> + {entry.pr ? <DescriptionItem term={words.pullRequest} mono><a className="basalt-link" href={entry.pr.href}><span className="basalt-link-label">#{entry.pr.number}</span></a></DescriptionItem> : null} + {tickets.length ? ( + <DescriptionItem + term={tickets.length === 1 ? words.ticket : words.tickets} + values={tickets.map((ticket) => ( + <>{ticket.tracker} {ticket.href ? <a className="basalt-link basalt-release-mono" href={ticket.href}><span className="basalt-link-label">{ticket.label}</span></a> : <span className="basalt-release-mono">{ticket.label}</span>}</> + ))} + /> + ) : null} + {entry.commit ? ( + <DescriptionItem term={words.commit} mono> + {entry.commit.href ? <a className="basalt-link" href={entry.commit.href}><span className="basalt-link-label">{entry.commit.sha.slice(0, 8)}</span></a> : entry.commit.sha.slice(0, 8)} + </DescriptionItem> + ) : null} + {entry.authors?.length ? <DescriptionItem term={entry.authors.length === 1 ? words.author : words.authors} values={entry.authors} /> : null} + </DescriptionList> + <CopyButton size="sm" text={() => `${shared.base()}#${entry.id}`} copiedLabel={words.copied} statusLabel={words.linkCopied}>{words.copyLinkToChange}</CopyButton> + </> + ); + return <Popup open={open} onOpenChange={setOpen} trigger={trigger} level={level} layer={layer} panelRef={panel} title={words.sources}>{inLevel(level, rows)}</Popup>; +} + +function Entry({ entry, shared }: { entry: ReleaseEntryRecord; shared: Shared }) { + const arrival = useArrival<HTMLLIElement>({ arrived: shared.target === entry.id, onArrivedEnd: shared.onArrivedEnd }); + const textId = `${entry.id}__words`; + return ( + <li {...arrival.attrs} id={entry.id} data-link={entry.link ? "" : undefined} className="basalt-release-entry"> + <ArrivedWord on={arrival.on} ever={arrival.ever} label={shared.words.linked} /> + <div className="basalt-release-entry-words"> + <p className="basalt-release-entry-text" id={textId}> + {entry.area ? <><span className="basalt-release-area">{entry.area}:</span>{" "}</> : null} + <Sentence text={entry.text} /> + </p> + {entry.link ? <Link href={entry.link.href} className="basalt-release-migrate">{entry.link.label}</Link> : null} + </div> + <span className="basalt-release-source-cell"><SourceLine entry={entry} textId={textId} shared={shared} /></span> + </li> + ); +} + +const List = ({ entries, shared }: { entries: ReleaseEntryRecord[]; shared: Shared }) => ( + <ul className="basalt-release-list">{entries.map((entry) => <Entry key={entry.id} entry={entry} shared={shared} />)}</ul> +); + +function Sections({ release, sections, level, foldFixed, shared }: { release: ReleaseRecord; sections: Section[]; level: number; foldFixed: boolean; shared: Shared }) { + const id = releaseId(release); + return ( + <> + {sections.map((section) => { + const title = <>{shared.words.sections[section.type]}<Count n={section.entries.length} /></>; + if (section.type === "fixed" && foldFixed) { + return ( + <section key={section.type} className="basalt-release-section" data-folded=""> + <Fold name={`${id}__fixed`} title={title} level={level} shared={shared}><List entries={section.entries} shared={shared} /></Fold> + </section> + ); + } + return ( + <section key={section.type} className="basalt-release-section"> + <Heading level={level} className="basalt-release-section-title">{title}</Heading> + <List entries={section.entries} shared={shared} /> + </section> + ); + })} + </> + ); +} + +function BuildDetails({ rows, shared }: { rows: readonly ReleaseBuildRow[]; shared: Shared }) { + return ( + <div className="basalt-release-build"> + <Fold name="__build" title={shared.words.buildDetails} level={shared.level + 1} shared={shared}> + <DescriptionList className="basalt-release-build-list"> + {rows.map((row) => <DescriptionItem key={row.label} term={row.label} mono={row.mono}>{row.value}</DescriptionItem>)} + </DescriptionList> + <CopyButton size="sm" text={rows.map((row) => `${row.label}: ${row.value}`).join("\n")} copiedLabel={shared.words.copied} statusLabel={shared.words.buildDetailsCopied}>{shared.words.copyBuildDetails}</CopyButton> + </Fold> + </div> + ); +} + +function Release({ release, form, product, running, runningBuild, shared }: { release: ReleaseRecord; form: ReleaseNotesProps["form"]; product: string; running?: string; runningBuild?: readonly ReleaseBuildRow[]; shared: Shared }) { + const { words, level, locale } = shared; + const id = releaseId(release); + const arrival = useArrival<HTMLElement>({ arrived: shared.target === id, onArrivedEnd: shared.onArrivedEnd }); + const { action, sections, inside, leads, folded, fixedFolds } = partsOf(release, form); + const total = release.entries.length; + const day = release.date ? formatReleaseDate(release.date, locale) : null; + const yours = running !== undefined && !release.unreleased && running === release.version; + const pre = !release.unreleased && release.version.includes("-"); + const name = release.unreleased ? words.unreleased : `${product} ${release.version}`; + const date = release.date && day ? <time dateTime={release.date}>{day}</time> : null; + const counts = [ + total ? <React.Fragment key="c">{words.changes(total)}</React.Fragment> : null, + action.length ? <a key="a" href={`#${id}__action`} className="basalt-release-action-link">{words.needAction(action.length)}</a> : null, + ]; + const badges = pre || yours ? ( + <span className="basalt-release-badges"> + {pre ? <Badge>{words.preRelease}</Badge> : null} + {yours ? <Badge>{words.yourVersion}</Badge> : null} + </span> + ) : null; + const facts = counts.filter(Boolean); + const headingId = `${id}__heading`; + const heading = release.title ? ( + <> + {/* The first line, drawn: the number and the date. The heading says them itself, so the drawn line is not read twice. */} + <p className="basalt-release-meta basalt-release-number-line" aria-hidden="true"><DotLine>{release.version}{date}</DotLine></p> + <Heading level={level} id={headingId} className="basalt-release-heading" data-headline=""> + <span className="basalt-visually-hidden">{release.version}{day ? `, ${day}` : ""}: </span> + <span className="basalt-release-title">{release.title}</span> + </Heading> + {facts.length || badges ? <p className="basalt-release-meta"><DotLine>{facts}</DotLine>{badges}</p> : null} + </> + ) : ( + <> + <Heading level={level} id={headingId} className="basalt-release-heading"> + <span className="basalt-release-version" data-words={release.unreleased ? "" : undefined}>{release.unreleased ? words.unreleased : release.version}</span> + {date ? <span className="basalt-visually-hidden">, {day}</span> : null} + </Heading> + {date || facts.length || badges ? <p className="basalt-release-meta"><DotLine>{date}{facts}</DotLine>{badges}</p> : null} + </> + ); + const summary = release.summary ? <p className="basalt-release-summary">{release.summary}</p> : null; + const actionBlock = action.length ? ( + <Callout + status="warning" + id={`${id}__action`} + className="basalt-release-action" + title={<Heading level={level + 1} className="basalt-release-callout-title">{words.actionNeeded}<Count n={action.length} /></Heading>} + > + {form === "reference" && release.previous ? <p className="basalt-release-upgrade">{words.beforeUpgrading(release.previous, action.length)}</p> : null} + <List entries={action} shared={shared} /> + </Callout> + ) : null; + return ( + <section {...arrival.attrs} id={id} aria-labelledby={headingId} data-form={form} className="basalt-release"> + <header className="basalt-release-head"> + <div className="basalt-release-head-text"> + <ArrivedWord on={arrival.on} ever={arrival.ever} label={words.linked} /> + {heading} + </div> + <CopyButton variant="ghost" size="sm" text={() => `${shared.base()}#${id}`} aria-label={words.copyLinkTo(name)} copiedLabel={words.copied} statusLabel={words.linkCopied} className="basalt-release-copy"> + {words.copyLink} + </CopyButton> + </header> + {leads ? null : summary} + {actionBlock} + {leads ? release.audiences!.map((audience, index) => ( + <section key={index} className="basalt-release-audience"> + {audience.for ? <Heading level={level + 1} className="basalt-release-audience-title">{audience.for}</Heading> : null} + <p className="basalt-release-paragraph">{audience.text}</p> + </section> + )) : null} + {folded ? ( + <div className="basalt-release-all"> + <Fold name={`${id}__all`} level={level + 1} shared={shared} title={<>{action.length ? words.otherChanges : words.allChanges}<Count n={inside} /></>}> + {summary} + <Sections release={release} sections={sections} level={level + 2} foldFixed={false} shared={shared} /> + </Fold> + </div> + ) : ( + <> + {leads ? summary : null} + <Sections release={release} sections={sections} level={level + 1} foldFixed={fixedFolds} shared={shared} /> + </> + )} + {yours && runningBuild?.length ? <BuildDetails rows={runningBuild} shared={shared} /> : null} + </section> + ); +} + +/** The releases from their records. See the module note. */ +export function ReleaseNotes({ releases, form, product, baseHref, running, runningBuild, headingLevel = 2, arrived, onArrivedEnd, words: wordsProp, locale = "en-US", className, ...props }: ReleaseNotesProps) { + const words = React.useMemo(() => ({ ...WORDS, ...wordsProp, sections: { ...WORDS.sections, ...wordsProp?.sections } }), [wordsProp]); + const drawn = React.useMemo(() => releases.filter((release) => !(form === "notes" && release.unreleased)), [releases, form]); + const base = React.useMemo(() => baseOf(baseHref), [baseHref]); + const raw = useTarget(arrived); + // A version that a drawn release replaces opens that release. + const target = React.useMemo(() => { + if (!raw) return null; + const stable = drawn.find((release) => release.replaces?.some((version) => `v${version}` === raw)); + return stable ? releaseId(stable) : raw; + }, [raw, drawn]); + // Without script every fold is open; once the page runs, they start closed. + const [wired, setWired] = React.useState(false); + const [open, setOpen] = React.useState<ReadonlySet<string>>(() => new Set()); + React.useLayoutEffect(() => setWired(true), []); + const folds = React.useMemo(() => { + const all: string[] = ["__build"]; + const holding = new Map<string, string>(); + for (const release of drawn) { + const own = foldsOf(release, form); + all.push(...own.all); + for (const [entry, fold] of own.holding) holding.set(entry, fold); + } + return { all, holding }; + }, [drawn, form]); + // The arrival opens every fold that holds its target. + React.useEffect(() => { + const fold = target ? folds.holding.get(target) : undefined; + if (fold) setOpen((now) => (now.has(fold) ? now : new Set([...now, fold]))); + }, [target, folds]); + const setFold = React.useCallback((key: string, next: boolean) => setOpen((now) => { + const copy = new Set(now); + if (next) copy.add(key); + else copy.delete(key); + return copy; + }), []); + const shared: Shared = { + words, + base, + locale, + level: headingLevel, + target, + onArrivedEnd, + open: wired ? open : new Set(folds.all), + setFold, + }; + const matches = running !== undefined && drawn.some((release) => !release.unreleased && release.version === running); + return ( + <div {...props} data-form={form} className={join("basalt-release-notes", className)}> + {running !== undefined && !matches && runningBuild?.length ? <BuildDetails rows={runningBuild} shared={shared} /> : null} + {drawn.map((release) => <Release key={releaseId(release)} release={release} form={form} product={product} running={running} runningBuild={runningBuild} shared={shared} />)} + </div> + ); +} diff --git a/packages/react/src/release-sources.tsx b/packages/react/src/release-sources.tsx new file mode 100644 index 00000000..8c7f0fae --- /dev/null +++ b/packages/react/src/release-sources.tsx @@ -0,0 +1,40 @@ +import { Popover as BasePopover } from "@base-ui/react/popover"; +import * as React from "react"; + +// The Sources panel's popup (DECISIONS 320, 2.9), loaded the first time a reader reaches for a source line (release-notes.tsx), so a page of releases +// does not load a popup, its positioning and Floating UI until someone asks. It is built on its own (build.mjs) and imports nothing of Basalt's: what it +// holds (the rows, Copy link to this change) and the popup's level and layer are drawn and measured by the page, which already has them, and handed in. +// Its classes and its placement are PopoverContent's: below the source line, end-aligned, 6 under it, kept inside the window by space-4 each side. + +export interface SourcesPopupProps { + open: boolean; + onOpenChange: (open: boolean) => void; + /** The source line's button: the popup's opener, rendered as the trigger so focus returns to it. */ + trigger: React.ReactElement; + /** The popup's level: its opener's plus one. */ + level: number; + /** The floating layer's stacking, from the page. */ + layer?: React.CSSProperties; + /** The panel, which takes focus when it opens. */ + panelRef: React.RefObject<HTMLDivElement | null>; + title: React.ReactNode; + children: React.ReactNode; +} + +const KEEP_AXIS = { fallbackAxisSide: "none" } as const; + +export function SourcesPopup({ open, onOpenChange, trigger, level, layer, panelRef, title, children }: SourcesPopupProps) { + return ( + <BasePopover.Root open={open} onOpenChange={(next) => onOpenChange(next)}> + <BasePopover.Trigger render={trigger} /> + <BasePopover.Portal> + <BasePopover.Positioner side="bottom" align="end" sideOffset={6} collisionPadding={16} collisionAvoidance={KEEP_AXIS} style={layer} className="basalt-positioner"> + <BasePopover.Popup ref={panelRef} initialFocus={panelRef} data-level={level} className="basalt-popover basalt-release-sources"> + <BasePopover.Title className="basalt-popover-title">{title}</BasePopover.Title> + {children} + </BasePopover.Popup> + </BasePopover.Positioner> + </BasePopover.Portal> + </BasePopover.Root> + ); +} diff --git a/packages/react/src/release-types.ts b/packages/react/src/release-types.ts new file mode 100644 index 00000000..84c9b49e --- /dev/null +++ b/packages/react/src/release-types.ts @@ -0,0 +1,54 @@ +// The record a release page is drawn from (DECISIONS 320, 3.4): what `tools/changelog` writes, one entry per change. Basalt's own types, so an app's +// type-check reads no tool's declarations. Types only: nothing here runs. + +/** The sections a change stands in, in the order every output draws them, under "Action needed". */ +export type ReleaseEntryType = "security" | "deprecated" | "removed" | "added" | "changed" | "fixed"; + +/** The least version bump a change needs. */ +export type ReleaseBump = "major" | "minor" | "patch"; + +export interface ReleaseEntryRecord { + /** Permanent: set when the entry is written and never changed or reused. The entry's address on the page ("#pr120-1"). */ + id: string; + type: ReleaseEntryType; + bump: ReleaseBump; + /** The component or page it concerns ("FormGrid", "Home"), drawn before the sentence at 500. */ + area?: string; + /** One sentence. Backticks mark code; nothing else in it is markup. */ + text: string; + /** Someone must do something: the entry stands under "Action needed" and nowhere else in its release. */ + action?: boolean; + /** Its migration note, drawn as a link on its own line under the sentence. */ + link?: { label: string; href: string }; + pr?: { number: number; href: string }; + commit?: { sha: string; href?: string }; + /** At most two are on the source line, then "3 more"; every one is in the sources panel. */ + tickets?: { tracker: string; label: string; href?: string }[]; + /** Who wrote the entry's words, or said they take authorship of them. Absent when nobody has: the panel then has no Author row. */ + authors?: string[]; +} + +export interface ReleaseAudience { + /** The group's own word ("For admins"), an `h3`. Absent for a paragraph for everyone. */ + for?: string; + text: string; + /** The entries the paragraph is about. */ + covers: string[]; +} + +export interface ReleaseRecord { + /** SemVer ("1.4.0", "2.0.0-rc.2"), or "Unreleased" with `unreleased`. */ + version: string; + /** The ship date, `YYYY-MM-DD`. Absent while unreleased. */ + date?: string; + unreleased?: boolean; + /** The release this one was checked against: "Before upgrading from 0.1.0". */ + previous?: string; + /** The pre-releases of this version, no longer drawn: their addresses open this release. */ + replaces?: string[]; + /** A product's headline: "A monitor can open an incident room". */ + title?: string; + summary?: string; + audiences?: ReleaseAudience[]; + entries: ReleaseEntryRecord[]; +} diff --git a/packages/react/src/site-footer.tsx b/packages/react/src/site-footer.tsx index c60456e9..e88bd3f3 100644 --- a/packages/react/src/site-footer.tsx +++ b/packages/react/src/site-footer.tsx @@ -7,6 +7,7 @@ import type { SiteHeaderLink } from "./site-nav"; import { ThemeChoiceControl } from "./theme-choice"; import type { ThemeChoiceWords } from "./theme-choice"; import { join } from "./utils"; +import { VersionPlaceContext } from "./version-place"; // The site footer (DECISIONS 146 A): the end of every site page, on the page at level 0 with no fill, rim or shadow. The brand, an optional sentence and social links; the // links, either one unlabelled line of up to six beside the brand or labelled groups; then the base: the legal line and the theme choice, both required. One 1px divider the @@ -33,6 +34,8 @@ export interface SiteFooterProps extends Omit<React.ComponentProps<"footer">, "c groups?: SiteFooterGroup[]; /** The legal line: required. At most `size-prose-width`, in tertiary ink. */ legal: React.ReactNode; + /** The version, as a `VersionLink` labelled with the product ("Basalt 0.2.0 · Nov 23, 2026"), on the legal line's row after it, at its 13/18. */ + version?: React.ReactNode; /** The links' landmark name. Default "Footer". */ navLabel?: string; /** The theme choice's words, for translation. The theme choice is always in the footer, since the site header has none. */ @@ -60,7 +63,7 @@ function Group({ group, id }: { group: SiteFooterGroup; id: string }) { * The site footer. Put it last on the page, after `main`, inside `SitePage` so a short page keeps it at the window's foot. The site's own: its words, which groups and * links, the note, the brand, the legal text and what the footer sits on (a mass). Basalt's: the order, the pill links at `sm`, the disclosures, the divider and the theme choice. */ -export function SiteFooter({ brand, note, social, links, groups, legal, navLabel = "Footer", themeWords, className, ...props }: SiteFooterProps) { +export function SiteFooter({ brand, note, social, links, groups, legal, version, navLabel = "Footer", themeWords, className, ...props }: SiteFooterProps) { const base = React.useId(); // Disclosures are drawn once script has run: without it every group is open and two a row. const [wired, setWired] = React.useState(false); @@ -92,7 +95,12 @@ export function SiteFooter({ brand, note, social, links, groups, legal, navLabel )} </div> <div className="basalt-site-footer-base"> - <p className="basalt-site-footer-legal">{legal}</p> + {version ? ( + <div className="basalt-site-footer-legal-row"> + <p className="basalt-site-footer-legal">{legal}</p> + <VersionPlaceContext.Provider value="footer">{version}</VersionPlaceContext.Provider> + </div> + ) : <p className="basalt-site-footer-legal">{legal}</p>} <ThemeChoiceControl words={themeWords} /> </div> </div> diff --git a/packages/react/src/stream.tsx b/packages/react/src/stream.tsx index d950d169..cf3e2766 100644 --- a/packages/react/src/stream.tsx +++ b/packages/react/src/stream.tsx @@ -2,10 +2,13 @@ import * as React from "react"; import { Avatar } from "./composition"; import { DotSep } from "./dot-sep"; -import { useInShape } from "./in-shape"; +import { useArrival } from "./arrival"; +import type { ArrivalProps } from "./arrival"; import { inLevel, usePanelLevel } from "./layers"; import { join } from "./utils"; +export type { ArrivalProps } from "./arrival"; + // ---- The stream ---- // A conversation or a timeline, oldest first: a support thread, a team chat, a document's comments, an agent's run, a project's history. One // column, one order. A message is an avatar, a name, a time and its words; consecutive messages from one author join (the app says which, since @@ -21,98 +24,6 @@ import { join } from "./utils"; // word stays. const DEFAULT_ARRIVED = "Linked"; -/** Keys that read around the entry rather than act: they leave the mark where it is. A pattern, not a set, so loading the module builds nothing. */ -const reading = (key: string) => /^(Arrow(Up|Down|Left|Right)|Page(Up|Down)|Home|End| |Shift|Control|Alt|Meta|CapsLock)$/.test(key); - -export interface ArrivalProps { - /** This is the entry a link, a search result or a notice opened: it is scrolled to, focused and marked until the reader acts. */ - arrived?: boolean; - /** The word that says so, in the entry's head. Default "Linked"; an app says why in its own words ("Search result", "From your notice"). */ - arrivedLabel?: string; - /** The reader has acted, so the mark is going. Without it the part ends the mark itself; with it, the app may also clear `arrived`. */ - onArrivedEnd?: () => void; -} - -// One entry arrives at a time. The one placed last is the one the reader is at: placing another ends the one before (its `onArrivedEnd` is -// called). Assigned only while an entry is arrived, so loading this module does nothing. -let current: { end: () => void } | undefined; - -/** Whether the element has a box the reader can see: not under `display: none` (nor `content-visibility: hidden`). */ -const shown = (el: HTMLElement) => el.getClientRects().length > 0 && (typeof el.checkVisibility !== "function" || el.checkVisibility()); - -/** The nearest ancestor that scrolls the entry on the block axis, or null when it is the page. */ -function scrollerOf(el: HTMLElement): HTMLElement | null { - for (let at = el.parentElement; at && at !== document.body && at !== document.documentElement; at = at.parentElement) { - const { overflowY } = getComputedStyle(at); - if ((overflowY === "auto" || overflowY === "scroll") && at.scrollHeight > at.clientHeight) return at; - } - return null; -} - -/** - * The arrival's state: shown while `arrived` and the reader has not acted yet. Once the entry has a box (a pane it sits in may be hidden when it - * mounts) it is scrolled to and focused, once each time it turns on, and from then the reader's first act ends it. - */ -function useArrival<T extends HTMLElement>({ arrived = false, onArrivedEnd }: ArrivalProps) { - const inShape = useInShape(); - const ref = React.useRef<T>(null); - const [ended, setEnded] = React.useState(false); - const [ever, setEver] = React.useState(false); - const [placed, setPlaced] = React.useState(false); - const end = React.useRef(onArrivedEnd); - end.current = onArrivedEnd; - React.useEffect(() => { if (arrived) setEnded(false); }, [arrived]); - const on = arrived && !ended && inShape === 0; - React.useEffect(() => { if (!on) setPlaced(false); }, [on]); - React.useLayoutEffect(() => { - if (!on || placed) return undefined; - const el = ref.current; - if (!el) return undefined; - const place = () => { - // A short entry is brought to the middle of what scrolls it; one taller than most of that (the pane's visible height, or the window's), to its top. - const scroller = scrollerOf(el); - const room = scroller ? scroller.clientHeight : window.innerHeight; - el.scrollIntoView({ block: el.getBoundingClientRect().height > room * 0.6 ? "start" : "center", inline: "nearest" }); - el.focus({ preventScroll: true }); - setEver(true); - setPlaced(true); - }; - if (shown(el)) { place(); return undefined; } - // Not laid out yet (a hidden tab or pane): wait until it has a box, then place it once. - const watch = new ResizeObserver(() => { if (shown(el)) { watch.disconnect(); place(); } }); - watch.observe(el); - return () => watch.disconnect(); - }, [on, placed]); - React.useEffect(() => { - if (!on || !placed) return undefined; - const finish = () => { setEnded(true); end.current?.(); }; - const self = { end: finish }; - if (current && current !== self) current.end(); - current = self; - const act = (event: Event) => { - if (event.type === "keydown") { - const key = (event as KeyboardEvent).key; - const inField = (event.target as Element | null)?.closest?.("input, textarea, select, [contenteditable='true'], [contenteditable='']"); - if (reading(key) && !(key === " " && inField)) return; - } - finish(); - }; - // From the next frame, so the press or key that opened the entry does not end its mark. - const frame = requestAnimationFrame(() => { - document.addEventListener("pointerdown", act, true); - document.addEventListener("keydown", act, true); - }); - return () => { - if (current === self) current = undefined; - cancelAnimationFrame(frame); - document.removeEventListener("pointerdown", act, true); - document.removeEventListener("keydown", act, true); - }; - }, [on, placed]); - // Once it has arrived the entry stays a focus target, so taking the mark away never drops the reader's focus. - const attrs = { ref, tabIndex: ever || on ? -1 : undefined, "data-arrival": ever || on ? "" : undefined, "data-arrived": on ? "" : undefined }; - return { on, ever: ever || on, attrs }; -} // A message's head shows the word when the message itself, or a block in it, is the one arrived, in the arriving entry's own words. A message with // no head drawn (joined) has no place for it: a block there draws its word itself. diff --git a/packages/react/src/styles/components.css b/packages/react/src/styles/components.css index 7beca44d..24145fce 100644 --- a/packages/react/src/styles/components.css +++ b/packages/react/src/styles/components.css @@ -7545,6 +7545,294 @@ .basalt-stream-word { color: CanvasText; } } + /* ---- Versions and release notes (DECISIONS 320). ---- */ + /* The version with its date, one link (VersionLink). 12/16 Geist, tabular, secondary ink; hover lifts it to primary and underlines both parts. + Two parts that never break inside, the word with the number (joined by a no-break space) and the date: when they do not fit one line the + date goes under the number. The dot stands in the gap before the date, so a date that has gone under starts its line with no dot: the gap + is then left of the link's own box, which clips it on the inline axis. A version longer than the place wraps anywhere. */ + .basalt-version-link { + position: relative; + box-sizing: border-box; + display: inline-flex; + flex-wrap: wrap; + align-items: baseline; + column-gap: var(--basalt-space-3); + max-width: 100%; + overflow-x: clip; + padding-block: var(--basalt-space-1); + border-radius: var(--basalt-radius-xs); + color: var(--basalt-text-secondary); + font: var(--basalt-font-weight-regular) var(--basalt-text-xs-size) / var(--basalt-text-xs-line-height) var(--basalt-font-family-sans); + letter-spacing: var(--basalt-text-xs-tracking); + font-variant-numeric: tabular-nums; + text-decoration: none; + -webkit-tap-highlight-color: transparent; + transition: color var(--basalt-duration-fast) var(--basalt-ease-out); + } + .basalt-version-link-words, .basalt-version-link-date { position: relative; min-width: 0; overflow-wrap: anywhere; } + .basalt-version-link-date::before { content: "·"; content: "·" / ""; position: absolute; inset-inline-end: 100%; width: var(--basalt-space-3); text-align: center; } + .basalt-version-link-pre { display: inline-block; max-width: 100%; } + /* The number reserves its 600 width, so being the current page moves nothing. */ + .basalt-version-link-number { display: inline-flex; flex-direction: column; max-width: 100%; } + .basalt-version-link-number::after { content: attr(data-label); height: 0; overflow: hidden; visibility: hidden; font-weight: var(--basalt-font-weight-semibold); user-select: none; pointer-events: none; } + .basalt-version-link:hover { color: var(--basalt-text-primary); } + .basalt-version-link:hover :is(.basalt-version-link-words, .basalt-version-link-date > time) { text-decoration: underline; text-decoration-thickness: var(--basalt-size-hairline); text-underline-offset: var(--basalt-size-underline-offset); } + .basalt-version-link:focus-visible { outline: var(--basalt-size-focus-width) solid var(--basalt-border-focus); outline-offset: var(--basalt-size-focus-offset); } + .basalt-version-link[aria-current="page"] { color: var(--basalt-text-primary); } + .basalt-version-link[aria-current="page"] .basalt-version-link-number { font-weight: var(--basalt-font-weight-semibold); } + /* On touch a 44px hit box that moves nothing. */ + @media (pointer: coarse) { + .basalt-version-link::after { content: ""; position: absolute; inset-inline: 0; top: 50%; height: max(100%, var(--basalt-size-tap-min)); transform: translateY(-50%); } + } + /* At the sidebar's foot: under the account items, space-2 below them, the words on the nav glyphs' start edge (the nav's space-1-5 and the + pill's space-3 in from the sidebar's own padding). The foot's own space-4 is below. */ + .basalt-app-version { margin: var(--basalt-space-2) calc(var(--basalt-space-1-5) + var(--basalt-space-3)) 0; } + /* In the rail: the number alone, centred, breaking before a pre-release's hyphen if it must; the label and the date are in its name and its tooltip. */ + .basalt-version-link[data-place="rail"] { display: flex; justify-content: center; text-align: center; } + /* stylelint-disable-next-line unit-disallowed-list -- the 1px clip box of the visually-hidden pattern; it must be exactly 1px */ + .basalt-version-link[data-place="rail"] :is(.basalt-version-link-word, .basalt-version-link-date) { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; } + /* stylelint-disable-next-line unit-disallowed-list -- size-breakpoint-md (720px) and size-breakpoint-lg (1024px): a media query cannot read a token; from 720 the rail, from 1024 the sidebar */ + @media (width >= 720px) and (width < 1024px) { + .basalt-app-version { margin-inline: var(--basalt-space-1-5); } + } + /* The last row of More's sheet: under a divider, space-2 below the list, 44 tall, at 13/18, on the nav glyphs' edge. */ + .basalt-tabbar-version { + box-sizing: border-box; + display: flex; + align-items: center; + min-height: var(--basalt-size-tap-min); + margin-top: var(--basalt-space-2); + padding-inline: calc(var(--basalt-space-1-5) + var(--basalt-space-3)); + border-top: var(--basalt-size-hairline) solid var(--basalt-border-divider); + } + :is(.basalt-tabbar-version, .basalt-site-footer-legal-row) .basalt-version-link { font-size: var(--basalt-text-sm-size); line-height: var(--basalt-text-sm-line-height); letter-spacing: var(--basalt-text-sm-tracking); } + /* A site's footer: after the legal line, on its row, space-4 apart, wrapping under it. */ + .basalt-site-footer-legal-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--basalt-space-1) var(--basalt-space-4); min-width: 0; } + + /* A release. One column, at most the words' measure, space-6 and room for a source line; space-10 apart with a divider between. Its own + container, so the source line goes under the words below 640 of the release's own width. */ + .basalt-release-notes { min-width: 0; font-family: var(--basalt-font-family-sans); color: var(--basalt-text-primary); } + .basalt-release { + container-type: inline-size; + max-width: calc(var(--basalt-size-prose-width) + var(--basalt-space-6) + var(--basalt-size-sidebar-width)); + padding-block: var(--basalt-space-10); + border-top: var(--basalt-size-hairline) solid var(--basalt-border-divider); + scroll-margin-top: calc(var(--basalt-sticky-offset) + var(--basalt-space-4)); + } + .basalt-release:first-of-type { padding-top: 0; border-top: 0; } + /* The last release carries no padding of its own under it: what follows the list is the page's gap alone (sweep 68-4). */ + .basalt-release:last-of-type { padding-bottom: 0; } + .basalt-release-notes > .basalt-release-build:first-child { max-width: calc(var(--basalt-size-prose-width) + var(--basalt-space-6) + var(--basalt-size-sidebar-width)); margin: 0 0 var(--basalt-space-6); } + .basalt-release:focus, .basalt-release-entry:focus { outline: none; } + /* The header is a grid: Copy link stands at the end of the first line (the number, or a headline release's number-and-date line), centred on it, + and only that line makes room for it; the headline and the counts take the release's whole width. The button takes no height of its own (its + margins take it back), so a 44px button on touch moves no line. */ + .basalt-release-head { position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--basalt-space-4); align-items: center; } + .basalt-release-head-text { display: contents; } + .basalt-release-head-text > * { grid-column: 1 / -1; min-width: 0; } + .basalt-release-head-text > .basalt-release-word { grid-row: 1; } + .basalt-release-head-text > :is(.basalt-release-number-line, .basalt-release-heading:not([data-headline])) { grid-column: 1; grid-row: 2; } + .basalt-release-head-text > .basalt-release-heading[data-headline] { grid-row: 3; } + .basalt-release-head-text > .basalt-release-heading[data-headline] ~ .basalt-release-meta { grid-row: 4; } + .basalt-release-head-text > .basalt-release-heading:not([data-headline]) ~ .basalt-release-meta { grid-row: 3; } + .basalt-release-head-text > :not(.basalt-release-word) ~ * { margin-top: var(--basalt-space-1); } + /* A ghost button at the column's edge puts its words on the edge: its plate hangs space-2-5 past it (DECISIONS 326, sweep 68-1). */ + .basalt-release-head > .basalt-release-copy { grid-column: 2; grid-row: 2; align-self: center; margin-block: calc(-1 * var(--basalt-size-tap-min)); margin-inline-end: calc(-1 * var(--basalt-space-2-5)); } + .basalt-release-heading { margin: 0; font: var(--basalt-font-weight-semibold) var(--basalt-text-2xl-size) / var(--basalt-text-2xl-line-height) var(--basalt-font-family-sans); letter-spacing: var(--basalt-text-2xl-tracking); text-wrap: balance; overflow-wrap: break-word; } + /* The number standing alone is mono; in a line with its date (a headline's meta line) it is Geist, as at the foot. */ + .basalt-release-version { font-family: var(--basalt-font-family-mono); letter-spacing: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; } + .basalt-release-version[data-words] { font-family: var(--basalt-font-family-sans); letter-spacing: var(--basalt-text-2xl-tracking); } + .basalt-release-meta { margin: 0; color: var(--basalt-text-secondary); font: var(--basalt-font-weight-regular) var(--basalt-text-sm-size) / var(--basalt-text-sm-line-height) var(--basalt-font-family-sans); letter-spacing: var(--basalt-text-sm-tracking); font-variant-numeric: tabular-nums; } + .basalt-release-badges { display: inline-flex; gap: var(--basalt-space-2); margin-inline-start: var(--basalt-space-2); vertical-align: middle; } + .basalt-release-action-link { position: relative; z-index: 1; color: inherit; text-decoration: underline; text-decoration-color: var(--basalt-border-input); text-decoration-thickness: var(--basalt-size-hairline); text-underline-offset: var(--basalt-size-underline-offset); border-radius: var(--basalt-radius-xs); } + .basalt-release-action-link:hover { color: var(--basalt-text-primary); text-decoration-color: currentColor; } + .basalt-release-action-link:focus-visible { outline: var(--basalt-size-focus-width) solid var(--basalt-border-focus); outline-offset: var(--basalt-size-focus-offset); } + .basalt-release-copy { flex: none; } + .basalt-release-summary, .basalt-release-paragraph { margin: 0; max-width: var(--basalt-size-prose-width); font-size: var(--basalt-text-md-size); line-height: var(--basalt-text-md-line-height); letter-spacing: var(--basalt-text-md-tracking); text-wrap: pretty; } + .basalt-release-summary { margin-top: var(--basalt-space-4); } + .basalt-release-audience { display: grid; gap: var(--basalt-space-1); margin-top: var(--basalt-space-4); } + .basalt-release-audience-title { margin: 0; font: var(--basalt-font-weight-semibold) var(--basalt-text-md-size) / var(--basalt-text-md-line-height) var(--basalt-font-family-sans); letter-spacing: var(--basalt-text-md-tracking); } + .basalt-release-action { margin-top: var(--basalt-space-6); } + /* One reference column down the page: inside the callout the words' column is shorter by the callout's inset (its hairline, space-4, the 16px + mark and space-3), so its references start where the open lists' do (sweep 68-3). Under 640 of the release's width the list is one column. */ + .basalt-release-action .basalt-release-list { grid-template-columns: minmax(0, calc(var(--basalt-size-prose-width) - var(--basalt-size-hairline) - var(--basalt-space-4) - var(--basalt-size-icon-sm) - var(--basalt-space-3))) minmax(0, max-content); } + .basalt-release-callout-title { margin: 0; font: inherit; letter-spacing: inherit; } + .basalt-release-action .basalt-callout-text { color: var(--basalt-text-primary); } + .basalt-release-upgrade { margin: 0 0 var(--basalt-space-2); color: var(--basalt-text-secondary); } + .basalt-release-section, .basalt-release-all { margin-top: var(--basalt-space-6); } + .basalt-release-section-title { margin: 0 0 var(--basalt-space-2); font: var(--basalt-font-weight-semibold) var(--basalt-text-md-size) / var(--basalt-text-md-line-height) var(--basalt-font-family-sans); letter-spacing: var(--basalt-text-md-tracking); } + .basalt-release-count { margin-inline-start: var(--basalt-space-1); color: var(--basalt-text-tertiary); font-weight: var(--basalt-font-weight-regular); font-variant-numeric: tabular-nums; } + .basalt-release-action .basalt-release-count { color: var(--basalt-text-secondary); } + /* Inside a product's fold: the summary first, space-2 under the fold's heading; the sections' headings a step smaller. Nothing folds again. */ + .basalt-release-all .basalt-release-summary { margin-top: var(--basalt-space-2); } + .basalt-release-all .basalt-release-section:first-child { margin-top: var(--basalt-space-2); } + .basalt-release-all .basalt-release-summary + .basalt-release-section { margin-top: var(--basalt-space-4); } + .basalt-release-all .basalt-release-section-title { font-size: var(--basalt-text-base-size); line-height: var(--basalt-text-base-line-height); letter-spacing: var(--basalt-text-base-tracking); } + /* A fold: its heading holds the button, at the section heading's size, the chevron at the release's end. */ + .basalt-release-fold .basalt-accordion-trigger { min-height: var(--basalt-text-md-line-height); padding: 0; font: var(--basalt-font-weight-semibold) var(--basalt-text-md-size) / var(--basalt-text-md-line-height) var(--basalt-font-family-sans); letter-spacing: var(--basalt-text-md-tracking); } + .basalt-release-fold .basalt-accordion-content { padding-bottom: 0; font: inherit; color: inherit; } + /* An open fold's panel lets the arrival's plate and a focus ring reach space-2 past its sides (it clips only while it opens and closes). */ + .basalt-release-fold .basalt-accordion-panel { overflow: clip; overflow-clip-margin: var(--basalt-space-2); } + .basalt-release-section[data-folded] .basalt-accordion-content { padding-top: var(--basalt-space-2); } + /* Build details: at the release's foot, quieter than the fold above it (14/20, 400). */ + .basalt-release-build { margin-top: var(--basalt-space-2); } + .basalt-release-build .basalt-accordion-trigger { min-height: var(--basalt-size-control-xs); font: var(--basalt-font-weight-regular) var(--basalt-text-base-size) / var(--basalt-text-base-line-height) var(--basalt-font-family-sans); letter-spacing: var(--basalt-text-base-tracking); } + .basalt-release-build-list { margin-block: var(--basalt-space-3); } + /* An opening fold moves what is under it by its panel's height alone. The panel clips without making a formatting context, so the content's first + margin (space-2 under a product's fold, space-3 in Build details) would pass through it and land outside the height that animates; the content + holds it. Nothing moves at rest. */ + .basalt-release-fold .basalt-accordion-content { display: flow-root; } + /* A fold that ends a release hangs the lower spare half of its button, (its row − its line) / 2, into the release's padding, open and closed: the + open panel's content gives it back. So the release's last line is space-10 above its divider, and pressing the fold changes nothing but the + panel. On a fine pointer only Build details' button (24) is taller than its line (20); on touch see the rows below. */ + .basalt-release > .basalt-release-build:last-child { margin-bottom: calc((var(--basalt-text-base-line-height) - var(--basalt-size-control-xs)) / 2); } + .basalt-release > .basalt-release-build:last-child .basalt-accordion-content { padding-bottom: calc((var(--basalt-size-control-xs) - var(--basalt-text-base-line-height)) / 2); } + + /* The list is a grid and each entry a subgrid of it: column one the words, at most the measure; column two the source lines, as wide as the + list's widest, space-6 away, starting on one edge. So the words keep one measure down a list. A source line is one line (decision 2.8): where + the release is too narrow for the measure and the widest line, the words give way, the two columns sharing what is left until the line fits, + and only an id longer than its column's share breaks inside itself (recheck-pixels 2). */ + .basalt-release-list { display: grid; grid-template-columns: minmax(0, var(--basalt-size-prose-width)) minmax(0, max-content); justify-content: start; column-gap: var(--basalt-space-6); margin: 0; padding: 0; list-style: none; } + .basalt-release-entry { + position: relative; + display: grid; + grid-template-columns: subgrid; + grid-column: 1 / -1; + align-items: baseline; + --_release-entry-pad: var(--basalt-space-1-5); + padding-block: var(--_release-entry-pad); + scroll-margin-top: calc(var(--basalt-sticky-offset) + var(--basalt-space-8)); + } + /* Where nothing follows a change inside its box, the change has no padding under it (DECISIONS 326 and 331): the last change in Action needed + (13 above its first line and 13 under its last), and the last change before a release's end, in an open list or inside a fold that ends the + release, so a release ends on its last line, space-10 above its divider. Its tap box reaches into that box's own padding. */ + :where(.basalt-release-action .basalt-release-list, + .basalt-release > .basalt-release-section:not([data-folded]):last-child > .basalt-release-list, + .basalt-release > .basalt-release-all:last-child .basalt-accordion-content > .basalt-release-section:last-child > .basalt-release-list, + .basalt-release > .basalt-release-section[data-folded]:last-child .basalt-accordion-content > .basalt-release-list) > .basalt-release-entry:last-child { padding-bottom: 0; } + .basalt-release-word { grid-column: 1 / -1; } + .basalt-release-entry-words { grid-column: 1; display: grid; justify-items: start; gap: var(--basalt-space-1); min-width: 0; } + .basalt-release-entry-text { margin: 0; color: var(--basalt-text-primary); font-size: var(--basalt-text-base-size); line-height: var(--basalt-text-base-line-height); letter-spacing: var(--basalt-text-base-tracking); text-wrap: pretty; overflow-wrap: break-word; } + .basalt-release-area { font-weight: var(--basalt-font-weight-medium); } + /* Inline code keeps the entry's 20px line (its own line would grow a line by a pixel), so a one-line entry is the height the touch rule counts on. */ + /* A code chip moves to the next line whole, and breaks inside only when it is wider than the line (sweep 68-6). */ + .basalt-release-entry-text .basalt-inline-code { display: inline-block; max-inline-size: 100%; line-height: 1; } + .basalt-release-migrate { position: relative; font-size: var(--basalt-text-base-size); line-height: var(--basalt-text-base-line-height); } + .basalt-release-source-cell { grid-column: 2; justify-self: start; min-width: 0; } + .basalt-release-source-cell:empty { display: none; } + /* The source line: a quiet TextButton in Geist Mono at 13 on the entry's 20px line, its hit 24 tall on a fine pointer. Ids never break inside + (an id longer than the line breaks anywhere); beside the words the line does not wrap. */ + .basalt-text-button.basalt-release-source { display: inline; baseline-source: first; padding-block: var(--basalt-space-0-5); margin-block: calc(-1 * var(--basalt-space-0-5)); font-family: var(--basalt-font-family-mono); font-size: var(--basalt-text-sm-size); line-height: var(--basalt-text-base-line-height); letter-spacing: 0; } + /* Each id carries the underline (an id never breaks inside, so it is a box of its own, which a label's underline would not reach). It stands at + its line's top, so an id long enough to break inside itself puts its first line, not its last, beside the words' first line; a one-line id is + drawn where it was. A button laid out inline is an inline block, whose baseline would be its last line: the source line takes its first + (baseline-source), so a source line of two lines stands beside the words' first line (recheck-pixels 2). */ + .basalt-text-button.basalt-release-source > .basalt-text-button-label { text-decoration: none; } + .basalt-release-id { display: inline-block; max-width: 100%; overflow-wrap: anywhere; vertical-align: top; text-decoration: underline; text-decoration-color: var(--basalt-border-input); text-decoration-thickness: var(--basalt-size-hairline); text-underline-offset: var(--basalt-size-underline-offset); transition: text-decoration-color var(--basalt-duration-fast) var(--basalt-ease-out); } + .basalt-release-source:hover .basalt-release-id { text-decoration-color: currentColor; } + .basalt-release-action-link { white-space: nowrap; } + .basalt-release-sources { width: var(--basalt-size-popover-max); } + .basalt-release-sources-list { margin-block: var(--basalt-space-2) var(--basalt-space-4); } + .basalt-release-mono { font-family: var(--basalt-font-family-mono); font-size: var(--basalt-text-sm-size); } + /* Narrow (under 640 of the release's own width): the source line is its own line under the words, space-0-5 below, wrapping between ids. */ + /* stylelint-disable-next-line basalt/container-length -- size-breakpoint-container-lg (640px): a container query cannot read a custom property */ + @container (width < 640px) { + .basalt-release-list, .basalt-release-action .basalt-release-list { grid-template-columns: minmax(0, 1fr); } + .basalt-release-entry { row-gap: var(--basalt-space-0-5); --_release-entry-pad: var(--basalt-space-2); } + .basalt-release-source-cell { grid-column: 1; } + .basalt-text-button.basalt-release-source { padding-block: calc((var(--basalt-size-control-xs) - var(--basalt-text-sm-line-height)) / 2); margin-block: calc((var(--basalt-text-sm-line-height) - var(--basalt-size-control-xs)) / 2); line-height: var(--basalt-text-sm-line-height); white-space: normal; } + } + /* On touch no 44px box reaches another target's box or crosses a rim, a divider or a clipping edge: an entry is space-3 above and below (a + one-line entry is 44 tall), the source line keeps the entry's 20px line, and "4 need action" and the migration link take the box too, with no + change to layout. The last change in Action needed or in a release has no padding under it, and its box reaches into the callout's or the + release's own padding. A release's last line is space-10 above its divider, whatever ends it. A change that has arrived keeps its padding. */ + @media (pointer: coarse) { + .basalt-release-entry { --_release-entry-pad: var(--basalt-space-3); } + .basalt-text-button.basalt-release-source { line-height: var(--basalt-text-base-line-height); } + .basalt-text-button.basalt-release-source::before, + .basalt-release-action-link::after, + .basalt-release-migrate::after { content: ""; position: absolute; top: 50%; left: 50%; /* physical: it is centred, in either direction */ width: max(100%, var(--basalt-size-tap-min)); height: var(--basalt-size-tap-min); transform: translate(-50%, -50%); } + .basalt-release-fold .basalt-accordion-trigger { min-height: var(--basalt-size-tap-min); } + /* A fold's 44px row on a 24px line hangs 10; Build details' on its 20px line, 12. */ + .basalt-release > :is(.basalt-release-all, .basalt-release-section[data-folded]):last-child { margin-bottom: calc((var(--basalt-text-md-line-height) - var(--basalt-size-tap-min)) / 2); } + .basalt-release > :is(.basalt-release-all, .basalt-release-section[data-folded]):last-child .basalt-accordion-content { padding-bottom: calc((var(--basalt-size-tap-min) - var(--basalt-text-md-line-height)) / 2); } + .basalt-release > .basalt-release-build:last-child { margin-bottom: calc((var(--basalt-text-base-line-height) - var(--basalt-size-tap-min)) / 2); } + .basalt-release > .basalt-release-build:last-child .basalt-accordion-content { padding-bottom: calc((var(--basalt-size-tap-min) - var(--basalt-text-base-line-height)) / 2); } + /* stylelint-disable-next-line basalt/container-length -- size-breakpoint-container-lg (640px): a container query cannot read a custom property */ + @container (width < 640px) { + .basalt-text-button.basalt-release-source { padding-block: calc((var(--basalt-size-control-xs) - var(--basalt-text-base-line-height)) / 2); margin-block: calc((var(--basalt-text-base-line-height) - var(--basalt-size-control-xs)) / 2); line-height: var(--basalt-text-base-line-height); } + /* A link with a source line under it: space-6 between the two (10 + 24 + 10, so the two boxes meet and do not overlap); the change ends as + every other change does, space-3 under it, which still holds the source line's box (sweep 68-5). */ + .basalt-release-entry[data-link]:has(.basalt-release-source) { row-gap: var(--basalt-space-6); } + } + } + + /* The Sources panel on touch, and in any window under 720 (DECISIONS 331, recheck-pixels 4): a linked value keeps its 20px line and its place after + the tracker's name, and its 44px box is hit area that takes no room. The rows are space-3 above and below, so a link's box ends on its row's + divider; two linked values in one row stand space-6 apart, so their boxes meet and do not overlap. */ + /* stylelint-disable-next-line unit-disallowed-list -- size-breakpoint-md (720px): a media query cannot read a token; under it the touch sizes apply whatever the pointer */ + @media (pointer: coarse), (width < 720px) { + .basalt-release-sources .basalt-description-item { padding-block: var(--basalt-space-3); } + .basalt-release-sources .basalt-description-item:first-child { padding-top: 0; } + .basalt-release-sources .basalt-description-item:last-child { padding-bottom: 0; } + .basalt-release-sources .basalt-description-details a { position: relative; display: inline; min-width: 0; min-height: 0; margin-block: 0; } + .basalt-release-sources .basalt-description-details a::after { content: ""; position: absolute; top: 50%; left: 50%; /* physical: it is centred, in either direction */ width: max(100%, var(--basalt-size-tap-min)); height: var(--basalt-size-tap-min); transform: translate(-50%, -50%); } + .basalt-release-sources .basalt-description-details:has(a) + .basalt-description-details:has(a) { margin-top: var(--basalt-space-6); } + /* stylelint-disable-next-line basalt/container-length -- size-breakpoint-container (480px): a container query cannot read a custom property */ + @container (width < 480px) { + .basalt-release-sources .basalt-description-details:has(a) + .basalt-description-details:has(a) { margin-top: calc(var(--basalt-space-6) - var(--basalt-space-0-5)); } + } + } + + /* The entry, or the release, a link opened: the stream's arrival (the plate and the word "Linked"). An entry takes the plate itself, a release + on its header. Tertiary words on the plate step to secondary; in forced colours the plate goes and the word stays. */ + .basalt-release-entry[data-arrival] { isolation: isolate; } + /* A change that has arrived keeps its padding in every place, for as long as its "Linked" line is held: the plate is a drawn box, equal above its + first line and under its last (DECISIONS 331). */ + .basalt-release .basalt-release-entry:has(> .basalt-release-word) { padding-bottom: var(--_release-entry-pad); } + /* The header's plate is placed by no grid line, so it is the whole header's padding box (number, date, headline and counts), not the first row: + an absolutely placed item with no lines takes the grid's padding edges, and the head's rows are implicit (recheck-pixels 3). */ + :is(.basalt-release-entry[data-arrival], .basalt-release[data-arrival] > .basalt-release-head)::before { + content: ""; position: absolute; z-index: -1; inset: calc(-1 * var(--basalt-space-1)) calc(-1 * var(--basalt-space-2)); border-radius: var(--basalt-radius-md); pointer-events: none; + background-color: transparent; transition: background-color calc(var(--basalt-duration-slow) * 0.75) var(--basalt-ease-in); + } + :is(.basalt-release-entry[data-arrived], .basalt-release[data-arrived] > .basalt-release-head)::before { background-color: var(--basalt-plate); transition-duration: var(--basalt-duration-instant); } + :is(.basalt-release-entry[data-arrived], .basalt-release[data-arrived] > .basalt-release-head) .basalt-release-count { color: var(--basalt-text-secondary); } + @media (forced-colors: active) { + :is(.basalt-release-entry[data-arrival], .basalt-release[data-arrival] > .basalt-release-head)::before { display: none; } + } + + /* The versions: a nav of links, the number in mono and primary, the date at the row's end in tertiary, 13/18, 30 tall and 44 on touch. + The pane form beside the page; the fold form above the first release where the pane would follow the page instead. */ + .basalt-release-index-title { margin: 0 0 var(--basalt-space-2); font: var(--basalt-font-weight-medium) var(--basalt-text-sm-size) / var(--basalt-text-sm-line-height) var(--basalt-font-family-sans); letter-spacing: var(--basalt-text-sm-tracking); } + .basalt-release-index-list { display: grid; margin: 0; padding: 0; list-style: none; } + .basalt-release-index-link { display: flex; align-items: baseline; justify-content: space-between; gap: var(--basalt-space-4); padding-block: var(--basalt-space-1-5); border-radius: var(--basalt-radius-xs); color: var(--basalt-text-secondary); font: var(--basalt-font-weight-regular) var(--basalt-text-sm-size) / var(--basalt-text-sm-line-height) var(--basalt-font-family-sans); font-variant-numeric: tabular-nums; text-decoration: none; } + .basalt-release-index-number { color: var(--basalt-text-primary); font-family: var(--basalt-font-family-mono); letter-spacing: 0; overflow-wrap: anywhere; } + .basalt-release-index-number[data-words] { font-family: var(--basalt-font-family-sans); } + .basalt-release-index-link time { flex: none; color: var(--basalt-text-tertiary); } + .basalt-release-index-link:hover .basalt-release-index-number { text-decoration: underline; text-decoration-thickness: var(--basalt-size-hairline); text-underline-offset: var(--basalt-size-underline-offset); } + .basalt-release-index-link:focus-visible { outline: var(--basalt-size-focus-width) solid var(--basalt-border-focus); outline-offset: var(--basalt-size-focus-offset); } + .basalt-release-index[data-form="fold"] { margin-bottom: var(--basalt-space-8); } + .basalt-release-index[data-form="fold"] .basalt-accordion-trigger { font: var(--basalt-font-weight-medium) var(--basalt-text-sm-size) / var(--basalt-text-sm-line-height) var(--basalt-font-family-sans); } + @media (pointer: coarse) { + .basalt-release-index-link { align-items: center; min-height: var(--basalt-size-tap-min); padding-block: 0; } + } + /* Where PaneLayout puts its pane beside the page the pane form shows; where the pane follows the page, the fold does, and the pane is not drawn. */ + .basalt-release-index[data-form="fold"] { display: none; } + /* stylelint-disable-next-line basalt/container-length -- size-sidebar-width (256px) + size-gutter (24px) + size-breakpoint-container-lg (640px), PaneLayout's own threshold; a container query cannot read a custom property */ + @container (width < 920px) { + .basalt-pane-layout .basalt-release-index[data-form="fold"] { display: block; } + .basalt-pane:has(> .basalt-release-index[data-form="pane"]) { display: none; } + } + + /* Print and no script: every fold is open (the parts draw them open until script runs); Copy buttons are not printed, and a source line prints as text. */ + @media print { + :is(.basalt-release-notes, .basalt-release-index) .basalt-accordion-panel { height: auto; overflow: visible; content-visibility: visible; } + :is(.basalt-release-notes, .basalt-release-index) .basalt-accordion-panel[hidden] { display: block; } + .basalt-release-copy, .basalt-release-notes .basalt-copy-button, .basalt-release-sources, .basalt-release-build .basalt-button { display: none; } + .basalt-release-id { text-decoration: none; } + } + /* ---- The disclosure row: a button on one line (cut while closed, wrapped when open), its mark, its meta and the core chevron, which morphs from right to down. Hover lifts the ink; there is no wash. Focus is the control ring at +2. 28 tall (44 on touch), text at 13. ---- */ .basalt-disclosure { min-width: 0; } diff --git a/packages/react/src/tab-bar.tsx b/packages/react/src/tab-bar.tsx index 62d30b4f..9bafbbcc 100644 --- a/packages/react/src/tab-bar.tsx +++ b/packages/react/src/tab-bar.tsx @@ -10,6 +10,7 @@ import type { IconComponent } from "./types"; import { useScreenKeyboardLayout } from "./screen-keyboard"; import { useKeysMark } from "./use-media"; import { join } from "./utils"; +import { VersionContext, VersionPlaceContext } from "./version-place"; // The phone tab bar (decisions 96): the destinations of an app under 720, always glyph over label. It is navigation, so a // `nav` of links with `aria-current="page"`, never a tablist. Solid `surface-page` with a hairline on top: the header is the @@ -96,9 +97,14 @@ export interface TabBarMoreProps { children: React.ReactNode; } -/** The last cell when there are more than five destinations: a button that opens the rest in a bottom `Sheet`. */ +/** + * The last cell when there are more than five destinations: a button that opens the rest in a bottom `Sheet`. Inside `AppShell` with a `version`, + * the sheet's last row is that version, under a divider (DECISIONS 320, 1.2). + */ export function TabBarMore({ icon = MoreNavGlyph, label = "More", current, dot, children }: TabBarMoreProps) { const [open, setOpen] = React.useState(false); + const version = React.useContext(VersionContext); + const closeOnLink = (event: React.MouseEvent) => { if ((event.target as Element).closest("a")) setOpen(false); }; const name = current ? `${label}, ${current}, current page` : label; return ( <li className="basalt-tabbar-entry"> @@ -112,7 +118,8 @@ export function TabBarMore({ icon = MoreNavGlyph, label = "More", current, dot, <SheetTitle>{label}</SheetTitle> <SheetClose render={<IconButton icon={CloseGlyph} label={`Close ${label.toLowerCase()}`} />} /> </div> - <Nav aria-label={label} onClick={(event) => { if ((event.target as Element).closest("a")) setOpen(false); }}>{children}</Nav> + <Nav aria-label={label} onClick={closeOnLink}>{children}</Nav> + {version ? <div className="basalt-tabbar-version" onClick={closeOnLink}><VersionPlaceContext.Provider value="more">{version}</VersionPlaceContext.Provider></div> : null} </SheetContent> </Sheet> </li> diff --git a/packages/react/src/version-link.tsx b/packages/react/src/version-link.tsx new file mode 100644 index 00000000..a8ed19bc --- /dev/null +++ b/packages/react/src/version-link.tsx @@ -0,0 +1,72 @@ +import * as React from "react"; + +import { DotSep } from "./dot-sep"; +import { formatReleaseDate } from "./release-date"; +import { join } from "./utils"; +import { RailTooltipContext, VersionPlaceContext } from "./version-place"; + +// The version with its ship date, as one link to the release notes at that version (DECISIONS 320, 1.2): "Version 1.4.0 · Nov 23, 2026". It +// shows the version this session runs. It is the only way to the release notes (there is no "What's new" item), and nothing marks a release as +// new. 12/16 Geist in secondary ink, tabular, lifting to primary with an underline on hover; on the release notes it is the current page, its +// number at 600 with its width reserved. Two parts never break inside, the word with the number and the date: when both do not fit one line the +// date goes under the number and the dot is not drawn. 24 tall on a fine pointer, a 44px hit box on touch that moves nothing. +// +// Its place decides its form, set by the part that holds it: at the sidebar's foot under the account items; in the rail (720 to 1023) the +// number alone, centred, the label and the date in its name and its tooltip; the last row of More's sheet on a phone, at 13/18; after the legal +// line in a site's footer, at 13/18, labelled with the product. An app whose tab bar has no More draws it on its account or settings page. + +export interface VersionLinkProps extends Omit<React.ComponentProps<"a">, "children"> { + /** SemVer without build metadata: "1.4.0", "2.0.0-rc.2". */ + version: string; + /** The day it shipped, an ISO calendar date ("2026-11-23"). Drawn "Nov 23, 2026" and never moved by a time zone. */ + date: string; + /** The release notes at this version: "/release-notes#v1.4.0". */ + href: string; + /** The word before the number. Default "Version"; a site's footer gives the product ("Basalt"). */ + label?: string; + /** The end of the link's name. Default "release notes". */ + destinationLabel?: string; + /** This page is the release notes. */ + current?: boolean; + /** Default "en-US". */ + locale?: string; +} + +/** The number, with a pre-release's hyphen kept with what follows it, so where the line is short it breaks before the hyphen. */ +function VersionNumber({ version }: { version: string }) { + const at = version.indexOf("-"); + if (at < 0) return <>{version}</>; + return <>{version.slice(0, at)}<wbr /><span className="basalt-version-link-pre">{version.slice(at)}</span></>; +} + +/** The version with its ship date, one link to the release notes at that version. See the module note. */ +export function VersionLink({ version, date, href, label = "Version", destinationLabel = "release notes", current = false, locale = "en-US", className, ...props }: VersionLinkProps) { + const place = React.useContext(VersionPlaceContext); + const day = formatReleaseDate(date, locale); + const rail = place === "rail"; + const RailTooltip = React.useContext(RailTooltipContext); + const link = ( + <a + {...props} + href={href} + // The visible words in order, joined as they are read, then where it goes (WCAG 2.5.3 and 2.4.4). The parts are flex items, whose text a + // name would join with stray spaces ("1.4.0 , Nov 23"), so the name is written whole. + aria-label={props["aria-label"] ?? `${label} ${version}, ${day}, ${destinationLabel}`} + aria-current={current ? "page" : props["aria-current"]} + data-place={place ?? undefined} + className={join("basalt-version-link", className)} + > + <span className="basalt-version-link-words"> + {/* A no-break space: the word and the number are one part. */} + <span className="basalt-version-link-word">{label}{"\u00a0"}</span> + <span className="basalt-version-link-number" data-label={version}><span><VersionNumber version={version} /></span></span> + </span> + {" "} + <span className="basalt-version-link-date"> + <time dateTime={date}>{day}</time> + </span> + </a> + ); + if (!rail || !RailTooltip) return link; + return <RailTooltip content={<span>{label} {version}<DotSep spaced />{day}</span>} side="right">{link}</RailTooltip>; +} diff --git a/packages/react/src/version-place.ts b/packages/react/src/version-place.ts new file mode 100644 index 00000000..0e148b80 --- /dev/null +++ b/packages/react/src/version-place.ts @@ -0,0 +1,20 @@ +import * as React from "react"; + +import type { TooltipProps } from "./display"; + +// Where a `VersionLink` is drawn, set by the part that holds it (DECISIONS 320, 1.2): the sidebar's foot ("foot"), the rail from 720 to 1023 +// ("rail"), the last row of More's sheet ("more") and a site's footer ("footer"). Anywhere else (an account page) it is the plain line. +// `AppShell` also hands the version itself to `TabBarMore` through `VersionContext`, as it hands the rail to `Nav`. Nothing runs when it loads. + +export type VersionPlace = "foot" | "rail" | "more" | "footer"; + +export const VersionPlaceContext = /* @__PURE__ */ React.createContext<VersionPlace | null>(null); + +/** The app shell's `version`, for More's sheet to draw as its last row. */ +export const VersionContext = /* @__PURE__ */ React.createContext<React.ReactNode>(null); + +/** + * The rail's tooltip, handed down by `AppShell`, which already carries it for `Nav`. So a `VersionLink` in a site's footer or on an account page + * loads no tooltip at all. + */ +export const RailTooltipContext = /* @__PURE__ */ React.createContext<React.ComponentType<TooltipProps> | null>(null); diff --git a/packages/react/test/bundle.test.mjs b/packages/react/test/bundle.test.mjs index acd9623d..196467c8 100644 --- a/packages/react/test/bundle.test.mjs +++ b/packages/react/test/bundle.test.mjs @@ -293,6 +293,9 @@ test("no module in dist builds a registry or reads a primitive's part when it lo for (const file of files) { // command-panel.js is the lazy module: it loads on first open, and its Maps are Phosphor's icon tables, bundled in if (path.basename(file) === "command-panel.js") continue; + // The release notes' Sources popup and the rail's tooltip are lazy too, with Base UI inlined so they share no chunk (build.mjs): its module-level + // tables are Base UI's own, and load only when a reader first reaches for a source line, or a rail shows a version. + if (["release-sources.js", "rail-tooltip.js"].includes(path.basename(file))) continue; const source = fs.readFileSync(file, "utf8"); // `var x = /* @__PURE__ */ new Set()` is still an allocation at load for (const match of source.matchAll(/^(?:var|let|const) \w+ = (?:\/\*.*?\*\/ )?(?:new (?:Map|Set|WeakMap|WeakSet|Intl\.\w+|RegExp)\(|Base\w+\.\w+;)/gm)) offenders.push(`${path.relative(dist, file)}: ${match[0]}`); @@ -555,7 +558,7 @@ test("the whole package up front and styles.css, minified and gzipped, stay with test("importing every file in dist allocates no registry or formatter, reads no browser global, and throws nothing", async () => { const { execFileSync } = await import("node:child_process"); const dist = path.join(pkg, "dist"); - const files = nodeFs.readdirSync(dist, { recursive: true }).filter((f) => f.endsWith(".js") && path.basename(f) !== "command-panel.js" && !["head/theme.js", "head/loops.js"].includes(f.split(path.sep).join("/"))).sort((a, b) => Number(path.basename(b).startsWith("chunk-")) - Number(path.basename(a).startsWith("chunk-")) || a.localeCompare(b)); + const files = nodeFs.readdirSync(dist, { recursive: true }).filter((f) => f.endsWith(".js") && !["command-panel.js", "release-sources.js", "rail-tooltip.js"].includes(path.basename(f)) && !["head/theme.js", "head/loops.js"].includes(f.split(path.sep).join("/"))).sort((a, b) => Number(path.basename(b).startsWith("chunk-")) - Number(path.basename(a).startsWith("chunk-")) || a.localeCompare(b)); assert.ok(files.length > 200, `${files.length} files in dist`); const script = ` import { pathToFileURL } from "node:url"; @@ -678,6 +681,37 @@ test("the imports plugin never rewrites a file that resolves another copy of Bas } }); +// DECISIONS 320, 2.15: the version link, the release notes and the versions are each a module of their own, so an app that shows only the foot's link +// loads only that (VersionLink takes the rail's tooltip from AppShell, which loads it on demand). The Sources popup loads on a reader's first reach for a +// source line (release-sources.js, built on its own with Base UI's popover inlined, so it makes no shared chunk), and AppShell's rail tooltip for the +// version the same way (rail-tooltip.js). Measured with splitting: VersionLink 2,107, ReleaseIndex 31,035 (Base UI's accordion), ReleaseNotes 67,232 +// (the accordion, the callout, the copy and text buttons; 173,798 with the popup up front); each limit is the measurement rounded up to the next 50. +// ReleaseNotes measured 67,535 once #127 was merged in (DECISIONS 328's Button and TextButton changes, which its copy and text buttons carry). +for (const [name, limit] of [["VersionLink", 2_150], ["ReleaseIndex", 31_050], ["ReleaseNotes", 67_550]]) { + test(`${name} alone, with splitting, loads only its own static graph (${limit} bytes at most)`, async () => { + const { bytes, chunks } = await graph(name); + assert.ok(bytes < limit, `${name}: ${bytes} bytes in ${chunks} chunks (limit ${limit})`); + }); +} + +test("VersionLink loads none of the release notes, the versions or the tooltip", async () => { + const { inputs } = await graph("VersionLink"); + assert.deepEqual(inputs.filter((input) => /release-notes|release-index|display\.js|@base-ui/.test(input)), []); +}); + +test("ReleaseNotes loads no popup up front: no popover, no positioning, no Floating UI until a source line is pressed", async () => { + const { inputs } = await graph("ReleaseNotes"); + assert.deepEqual(inputs.filter((input) => /@floating-ui\/(dom|core|react-dom)|floating-ui-react|@base-ui\/react\/popover|release-sources|useAnchorPositioning/.test(input)), []); +}); + +// AppShell measured alone (the size table): 103,887 before the version, 115,101 with the rail's tooltip up front, 104,373 with it on demand; with +// splitting its static graph measures 104,964, so the limit is 105,000. +test("AppShell loads the rail's tooltip for the version on demand", async () => { + const { inputs, bytes } = await graph("AppShell"); + assert.deepEqual(inputs.filter((input) => /rail-tooltip/.test(input)), []); + assert.ok(bytes < 105_000, `AppShell: ${bytes} bytes (limit 105,000)`); +}); + // DECISIONS 316, ruling 3: TextButton draws its end icon through ControlIcon, so a chevron that opens something in place morphs; measured 11,412 (10,600 to 11,450). // Stages and runs (DECISIONS 316): each new part has its own limit, the measured static graph rounded up to the next 50. StageMark carries Phosphor's five // circled marks (one file each, as Terminal imports its marks) and the ring; StageBadge, RunTimer, RunAnnouncer and formatRunTime load no Phosphor, and none diff --git a/packages/react/test/export-sizes.json b/packages/react/test/export-sizes.json index 31b26c54..f1190009 100644 --- a/packages/react/test/export-sizes.json +++ b/packages/react/test/export-sizes.json @@ -16,7 +16,7 @@ "AlertDialogTrigger": 69874, "AmbientMark": 569, "AppHeader": 1285, - "AppShell": 103887, + "AppShell": 104373, "AppTile": 1112, "ArchitectureDiagram": 67582, "ArrowDownGlyph": 2868, @@ -66,7 +66,7 @@ "CommandList": 33268, "CommandMenu": 87036, "Composer": 52175, - "CopyButton": 18635, + "CopyButton": 18660, "CopyGlyph": 2884, "Countdown": 3016, "CoverageStrip": 1570, @@ -170,7 +170,7 @@ "MultiSelect": 150691, "Nav": 4774, "NavGroup": 538, - "NavItem": 110701, + "NavItem": 110693, "NoticeBar": 813, "NotificationCenter": 152208, "NotificationCentre": 152218, @@ -218,6 +218,8 @@ "Reflow": 6095, "ReflowItem": 470, "Refreshing": 1911, + "ReleaseIndex": 30827, + "ReleaseNotes": 67192, "Reserve": 441, "Reveal": 19694, "RoutesGlyph": 3009, @@ -265,7 +267,7 @@ "ShortcutList": 10032, "SingleKeysSwitch": 17082, "SiteBrand": 1302, - "SiteFooter": 14780, + "SiteFooter": 15010, "SiteHeader": 179204, "SiteLockupDefs": 694, "SiteMenu": 171526, @@ -297,10 +299,10 @@ "Stepper": 26919, "Stream": 283, "StreamArrivedWord": 470, - "StreamBlock": 2764, - "StreamEntry": 2583, - "StreamMessage": 14856, - "StreamNote": 2651, + "StreamBlock": 2788, + "StreamEntry": 2611, + "StreamMessage": 14883, + "StreamNote": 2679, "StreamQuote": 991, "Switch": 16297, "SwitchRow": 24811, @@ -314,7 +316,7 @@ "Tab": 40055, "TabBar": 3501, "TabBarItem": 1859, - "TabBarMore": 91228, + "TabBarMore": 91447, "Table": 8305, "TableBody": 143, "TableCall": 391, @@ -354,6 +356,7 @@ "Tray": 90410, "TrayRow": 502, "TrendsGlyph": 2924, + "VersionLink": 1973, "VisuallyHidden": 258, "WAIT_MIN_SHOWN_MS": 26, "WAIT_SHOW_AFTER_MS": 26, @@ -423,11 +426,11 @@ "useWaitMark": 303 }, "package": { - "bytes": 893833, - "gzip": 296205 + "bytes": 909580, + "gzip": 301315 }, "styles": { - "bytes": 409564, - "gzip": 53057 + "bytes": 429096, + "gzip": 55422 } } diff --git a/packages/react/test/release-arrival.test.mjs b/packages/react/test/release-arrival.test.mjs new file mode 100644 index 00000000..8aa4b9ef --- /dev/null +++ b/packages/react/test/release-arrival.test.mjs @@ -0,0 +1,157 @@ +// Arriving at a release or an entry (DECISIONS 320, 2.10): the fragment is looked up by id, every fold that holds the target is opened, the +// target is scrolled to and focused with no ring, and it takes the stream's mark (the plate and "Linked") until the reader presses or types. +// Driven in Chromium against the built package. The fixtures are made up (Slate, a package; Harbor, a product). +import assert from "node:assert/strict"; +import fs from "node:fs"; +import path from "node:path"; +import { after, before, describe, test } from "node:test"; + +import { HARBOR, HARBOR_BEFORE, RUNNING_BUILD, SLATE } from "./release-fixture.mjs"; +import { bundleFixture, launch, pkg, settle } from "./support.mjs"; + +let browser; +before(async () => { browser = await launch(); }); +after(async () => { await browser?.close(); }); + +const CSS = () => fs.readFileSync(path.join(pkg, "dist", "styles.css"), "utf8"); + +/** A page at a real address with a fragment, so arriving is a real fragment navigation and Back works. */ +async function arrive(fragment, { releases = "SLATE", form = "reference", product = "Slate", theme = "light", width = 1024, height = 700, ...options } = {}) { + const context = await browser.newContext({ viewport: { width, height }, ...options }); + const page = await context.newPage(); + page.context_ = context; + const errors = []; + page.on("pageerror", (error) => errors.push(error.message)); + page.errors = errors; + await page.route("https://example.test/**", (route) => route.fulfill({ contentType: "text/html", body: `<!doctype html><html data-theme="${theme}"><head><style>${CSS()}</style></head><body style="margin:0;background:var(--basalt-surface-page);color:var(--basalt-text-primary)"><main id="root" style="padding:24px"></main></body></html>` })); + await page.goto(`https://example.test/changelog${fragment}`); + const data = `const SLATE = ${JSON.stringify(SLATE)}; const HARBOR = ${JSON.stringify(HARBOR)}; const HARBOR_BEFORE = ${JSON.stringify(HARBOR_BEFORE)}; const RUNNING_BUILD = ${JSON.stringify(RUNNING_BUILD)};`; + await page.addScriptTag({ content: await bundleFixture(`${data} createRoot(document.getElementById("root")).render(<B.ReleaseNotes releases={${releases}} form="${form}" product="${product}" running="1.4.0" runningBuild={RUNNING_BUILD} />);`) }); + await settle(page); + await page.waitForTimeout(50); + await settle(page); + return page; +} +const state = (page) => page.evaluate(() => { + const arrived = [...document.querySelectorAll("[data-arrived]")].map((el) => el.id); + const focused = document.activeElement?.id ?? null; + const word = document.querySelector("[data-arrived] .basalt-release-word[data-on]"); + return { arrived, focused, word: word ? word.textContent : null }; +}); +const inView = (page, id) => page.evaluate((target) => { + const r = document.getElementById(target).getBoundingClientRect(); + return r.top >= 0 && r.top < innerHeight; +}, id); + +describe("arriving", () => { + test("a fragment to a release marks its header, focuses it with no ring, and says Linked", async () => { + const page = await arrive("#v0.2.0"); + assert.deepEqual(await state(page), { arrived: ["v0.2.0"], focused: "v0.2.0", word: "Linked" }); + assert.ok(await inView(page, "v0.2.0")); + assert.equal(await page.locator('[id="v0.2.0"]').evaluate((el) => getComputedStyle(el).outlineStyle), "none"); + const plate = await page.locator('[id="v0.2.0"] > .basalt-release-head').evaluate((el) => getComputedStyle(el, "::before").backgroundColor); + assert.notEqual(plate, "rgba(0, 0, 0, 0)", "the plate is on its header"); + await page.context_.close(); + }); + + test("a fragment to an entry: the entry takes the plate and the word", async () => { + const page = await arrive("#pr41-1"); + assert.deepEqual(await state(page), { arrived: ["pr41-1"], focused: "pr41-1", word: "Linked" }); + assert.ok(await inView(page, "pr41-1")); + assert.notEqual(await page.locator('[id="pr41-1"]').evaluate((el) => getComputedStyle(el, "::before").backgroundColor), "rgba(0, 0, 0, 0)"); + await page.context_.close(); + }); + + test("an entry in a closed fold: the fold opens and the entry is reached", async () => { + const page = await arrive("#pr49-1"); + assert.equal(await page.locator('[id="v0.2.0"] .basalt-release-section[data-folded] .basalt-accordion-trigger').getAttribute("aria-expanded"), "true"); + assert.equal(await page.locator('[id="pr49-1"]').isVisible(), true); + assert.deepEqual(await state(page), { arrived: ["pr49-1"], focused: "pr49-1", word: "Linked" }); + assert.ok(await inView(page, "pr49-1")); + await page.context_.close(); + }); + + test("an entry inside a product's All changes", async () => { + const page = await arrive("#pr131-1", { releases: "HARBOR", form: "notes", product: "Harbor" }); + assert.equal(await page.locator('[id="pr131-1"]').isVisible(), true); + assert.deepEqual(await state(page), { arrived: ["pr131-1"], focused: "pr131-1", word: "Linked" }); + await page.context_.close(); + }); + + test("a candidate's address while it is drawn, and the stable release once it replaces it; an entry's address is the same in both", async () => { + let page = await arrive("#v2.0.0-rc.2", { releases: "HARBOR_BEFORE", form: "notes", product: "Harbor" }); + assert.deepEqual((await state(page)).arrived, ["v2.0.0-rc.2"]); + await page.context_.close(); + page = await arrive("#v2.0.0-rc.2", { releases: "HARBOR", form: "notes", product: "Harbor" }); + assert.deepEqual((await state(page)).arrived, ["v2.0.0"]); + assert.equal((await state(page)).focused, "v2.0.0"); + await page.context_.close(); + for (const releases of ["HARBOR_BEFORE", "HARBOR"]) { + page = await arrive("#pr142-1", { releases, form: "notes", product: "Harbor" }); + assert.deepEqual((await state(page)).arrived, ["pr142-1"], releases); + await page.context_.close(); + } + }); + + test("an unknown fragment marks nothing and throws nothing; a dotted version is never read as a selector", async () => { + for (const fragment of ["#nothing-here", "#2026.11.23", "#v9.9.9", "#%E0%A4%A"]) { + const page = await arrive(fragment); + assert.deepEqual((await state(page)).arrived, []); + assert.deepEqual(page.errors, []); + await page.context_.close(); + } + }); + + test("in forced colours the plate goes and the word stays", async () => { + const page = await arrive("#pr41-1", { forcedColors: "active" }); + assert.equal(await page.locator('[id="pr41-1"]').evaluate((el) => getComputedStyle(el, "::before").display), "none"); + assert.equal((await state(page)).word, "Linked"); + assert.equal(await page.locator('[id="pr41-1"] .basalt-release-word').isVisible(), true); + await page.context_.close(); + }); +}); + +describe("the mark ends, and arriving again", () => { + test("an arrow key leaves the mark; a press ends it, and focus stays", async () => { + const page = await arrive("#pr41-1"); + await page.keyboard.press("ArrowDown"); + await settle(page); + assert.deepEqual((await state(page)).arrived, ["pr41-1"]); + await page.mouse.click(5, 5); + await settle(page); + assert.deepEqual((await state(page)).arrived, []); + assert.equal(await page.locator('[id="pr41-1"] .basalt-release-word').count(), 1, "the word keeps its room"); + await page.context_.close(); + }); + + test("a link on the page is a hashchange that arrives; Back arrives at the one before", async () => { + const page = await arrive("#v0.2.0"); + await page.evaluate(() => { location.hash = "#pr45-1"; }); + await settle(page); + await page.waitForTimeout(50); + assert.deepEqual((await state(page)).arrived, ["pr45-1"]); + await page.goBack(); + await settle(page); + await page.waitForTimeout(50); + assert.deepEqual((await state(page)).arrived, ["v0.2.0"]); + assert.equal((await state(page)).focused, "v0.2.0"); + // The versions' links are fragment links too. + await page.evaluate(() => { location.hash = "#v0.1.0"; }); + await page.waitForTimeout(50); + await settle(page); + assert.deepEqual((await state(page)).arrived, ["v0.1.0"]); + await page.context_.close(); + }); + + test("an app with its own router names the target; the window's fragment is then not read", async () => { + const context = await browser.newContext({ viewport: { width: 1024, height: 700 } }); + const page = await context.newPage(); + await page.route("https://example.test/**", (route) => route.fulfill({ contentType: "text/html", body: `<!doctype html><html><head><style>${CSS()}</style></head><body><main id="root"></main></body></html>` })); + await page.goto("https://example.test/changelog#v0.1.0"); + await page.addScriptTag({ content: await bundleFixture(`const SLATE = ${JSON.stringify(SLATE)}; createRoot(document.getElementById("root")).render(<B.ReleaseNotes releases={SLATE} form="reference" product="Slate" arrived="pr45-1" />);`) }); + await settle(page); + await page.waitForTimeout(50); + assert.deepEqual((await state(page)).arrived, ["pr45-1"]); + await context.close(); + }); +}); diff --git a/packages/react/test/release-fixture.mjs b/packages/react/test/release-fixture.mjs new file mode 100644 index 00000000..21bb4fae --- /dev/null +++ b/packages/react/test/release-fixture.mjs @@ -0,0 +1,203 @@ +// The two made-up projects of tools/changelog/fixtures, as page data for the release tests: Slate (a package) and Harbor (a product). Every fact in +// them is invented. Read from the fixtures the tool writes, so the parts are drawn from what the tool produces. +import fs from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +import { pageReleases, readRecords } from "../../../tools/changelog/records.mjs"; + +const FIXTURES = path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "..", "..", "tools", "changelog", "fixtures"); +export const SLATE = JSON.parse(fs.readFileSync(path.join(FIXTURES, "slate", "releases.json"), "utf8")); +export const HARBOR = JSON.parse(fs.readFileSync(path.join(FIXTURES, "harbor", "releases.json"), "utf8")); +/** Harbor as it stood before 2.0.0 shipped: its two candidates drawn as releases of their own. */ +export const HARBOR_BEFORE = pageReleases(path.join(FIXTURES, "harbor"), { records: readRecords(path.join(FIXTURES, "harbor")).filter((record) => record.version !== "2.0.0"), pending: [] }); +/** What a running Harbor build says of itself (made up): never read from a release's record. */ +export const RUNNING_BUILD = [{ label: "Build", value: "1.4.0+9f3c1e2", mono: true }, { label: "Commit", value: "9f3c1e2a7d04", mono: true }, { label: "Basalt", value: "0.2.0", mono: true }]; + +/** A Harbor app shell with the version at its foot, the release notes as its page and More holding Settings (TSX for a fixture). */ +export const harborShell = ({ running = "1.4.0", date = "2026-11-23", releases = "HARBOR", extra = "" } = {}) => ` + const version = <B.VersionLink version="${running}" date="${date}" href="#v${running}" current />; + return ( + <B.AppShell brand={<span style={{ fontWeight: 600 }}>Harbor</span>} brandLabel="Harbor home" + sidebar={<B.Nav aria-label="Primary"><B.NavItem href="#" icon={B.HomeGlyph}>Home</B.NavItem><B.NavItem href="#" icon={B.SearchGlyph}>Incidents</B.NavItem></B.Nav>} + account={<B.Nav aria-label="Account"><B.NavItem href="#" icon={B.SettingsGlyph}>Settings</B.NavItem></B.Nav>} + version={version} + header={<B.AppHeader title="Release notes" />} + tabBar={<B.TabBar><B.TabBarItem href="#" icon={B.HomeGlyph}>Home</B.TabBarItem><B.TabBarItem href="#" icon={B.SearchGlyph}>Incidents</B.TabBarItem><B.TabBarMore current="Release notes"><B.NavItem href="#" icon={B.SettingsGlyph}>Settings</B.NavItem></B.TabBarMore></B.TabBar>}> + <B.ReleaseNotes releases={${releases}} form="notes" product="Harbor" running="${running}" runningBuild={RUNNING_BUILD} baseHref="https://harbor.example/release-notes" ${extra} /> + </B.AppShell> + );`; + +/** + * The spacing sweep's measurements of a page of releases (DECISIONS 326, round 68), run in the page with the class prefix ("basalt-" for React, + * "" for the HTML skill): where Copy link's words end against the header's edge (68-1), the action callout's inset above its first words and + * under its last (68-2), the left edge of each list's references (68-3), each release's padding under it (68-4), the gap from each change's + * last line to the next change's first (68-5) and how many lines each code chip in a change's words is drawn on (68-6). + */ +export const SWEEP = (p) => { + const q = (root, s) => root.querySelector(s.replace(/@/g, `.${p}`)); + const qa = (root, s) => [...root.querySelectorAll(s.replace(/@/g, `.${p}`))]; + const r = (el) => el.getBoundingClientRect(); + const textRight = (el) => { + const walker = document.createTreeWalker(el, NodeFilter.SHOW_TEXT); + let right = -Infinity; + for (let node = walker.nextNode(); node; node = walker.nextNode()) { + if (!node.textContent.trim() || node.parentElement.closest("[hidden], [aria-hidden='true']") || getComputedStyle(node.parentElement).visibility === "hidden") continue; + const range = document.createRange(); + range.selectNodeContents(node); + for (const rect of range.getClientRects()) if (rect.width) right = Math.max(right, rect.right); + } + return right; + }; + const contentBottom = (el) => r(el).bottom - parseFloat(getComputedStyle(el).paddingBottom); + const contentTop = (el) => r(el).top + parseFloat(getComputedStyle(el).paddingTop); + const releases = qa(document, "@release"); + return { + copy: releases.map((el) => { const copy = q(el, "@release-copy"); const head = q(el, "@release-head"); return copy && copy.offsetParent ? { id: el.id, off: Math.round((r(head).right - textRight(copy)) * 10) / 10 } : null; }).filter(Boolean), + callouts: qa(document, "@release-action").map((el) => { + const body = el.lastElementChild; + const entries = qa(el, "@release-entry"); + const last = entries.at(-1); + return { id: el.id, top: Math.round((r(body).top - r(el).top) * 10) / 10, bottom: Math.round((r(el).bottom - contentBottom(last)) * 10) / 10 }; + }), + references: qa(document, "@release-source-cell").filter((el) => el.offsetParent && r(el).width).map((el) => ({ inCallout: !!el.closest(`.${p}release-action`), x: Math.round(r(el).left * 10) / 10 })), + padding: releases.map((el) => ({ id: el.id, bottom: getComputedStyle(el).paddingBottom })), + gaps: qa(document, "@release-entry").filter((el) => el.offsetParent && el.nextElementSibling?.matches(`.${p}release-entry`)).map((el) => ({ id: el.id, linked: el.hasAttribute("data-link"), gap: Math.round((contentTop(el.nextElementSibling) - contentBottom(el)) * 10) / 10, under: Math.round((r(el).bottom - Math.max(...[...el.children].filter((c) => r(c).height).map((c) => r(c).bottom))) * 10) / 10 })), + chips: qa(document, "@release-entry-text " + (p ? "@inline-code" : "code")).filter((el) => el.offsetParent).map((el) => ({ text: el.textContent, lines: [...el.getClientRects()].filter((rect) => rect.width).length, wider: r(el).width > r(el.parentElement).width })), + }; +}; + +/** + * Where each release ends (DECISIONS 331), measured in the page with the class prefix ("basalt-" for React, "" for the HTML skill), as the ruling + * measured it: a line is its text's rectangle with its leading (the smaller half of an odd leading above), and a drawn box (Action needed, a bordered + * button) is its edge. Copy link takes no height of its own and is left out. + * - ends: for every release with a divider under it, what ends it and the gap from its lowest line or drawn edge to that divider (40 ruled). + * - taps: every 44px tap box (a pseudo-element centred on its control): the targets it meets, how far it is inside its callout's rim and its + * release's divider, and, for the last change in a list, what a finger on its lowest row lands on. + * - plates: for each arrived change, the plate's room above its first line and under its last. + * - under: from the list's foot to the next thing below it on the page (the footer, or the tab bar), or null. + */ +export const ENDS = (p) => { + const c = (s) => s.replace(/@/g, `.${p}`); + const qa = (root, s) => [...root.querySelectorAll(c(s))]; + const R = (el) => el.getBoundingClientRect(); + const f = (n) => Math.round(n * 100) / 100; + const shown = (el) => el.checkVisibility({ checkVisibilityCSS: true, visibilityProperty: true }) && !el.closest(`.${p}visually-hidden, .visually-hidden, [hidden]`); + const lines = (root, { hidden = false } = {}) => { + const all = []; + const walk = document.createTreeWalker(root, NodeFilter.SHOW_TEXT); + for (let n = walk.nextNode(); n; n = walk.nextNode()) { + const el = n.parentElement; + if (!n.textContent.trim() || el.closest(c("@release-copy")) || (!hidden && !shown(el))) continue; + const range = document.createRange(); + range.selectNodeContents(n); + for (const q of range.getClientRects()) { + if (q.width < 1 || q.height < 1) continue; + const lead = ((parseFloat(getComputedStyle(el).lineHeight) || q.height) - q.height) / 2; + all.push({ t: q.top - Math.floor(lead), b: q.bottom + Math.ceil(lead) }); + } + } + return all; + }; + const filled = (cs) => !/^(transparent|rgba\(0, 0, 0, 0\))$/.test(cs.backgroundColor); + const drawn = (root) => qa(root, "@callout, @button, .btn").filter((el) => shown(el) && !el.closest(c("@release-copy")) && (parseFloat(getComputedStyle(el).borderBottomWidth) > 0 || filled(getComputedStyle(el)))).map((el) => R(el).bottom); + const releases = qa(document, "@release").filter((el) => el.matches(c("@release")) && shown(el)); + const ends = releases.slice(0, -1).map((el, i) => { + const lowest = Math.max(...lines(el).map((l) => l.b), ...drawn(el)); + const last = el.lastElementChild; + const fold = last.querySelector(c("@accordion-trigger, @release-fold")); + return { id: el.id, ends: last.className.toString().split(" ")[0] + (last.hasAttribute("data-folded") ? "[data-folded]" : ""), open: fold ? fold.getAttribute("aria-expanded") === "true" || fold.hasAttribute("data-panel-open") : null, gap: f(R(releases[i + 1]).top - lowest) }; + }); + const hosts = [...qa(document, "@release-source").map((el) => [el, "::before"]), ...qa(document, "@release-migrate, @release-action-link").map((el) => [el, "::after"])].filter(([el]) => shown(el)); + const geometry = ([el, pseudo]) => { + const ps = getComputedStyle(el, pseudo); + const q = R(el); + if (ps.content === "none" || ps.position !== "absolute") return { el, l: q.left, r: q.right, t: q.top, b: q.bottom }; + const w = parseFloat(ps.width), h = parseFloat(ps.height), cx = (q.left + q.right) / 2, cy = (q.top + q.bottom) / 2; + return { el, l: cx - w / 2, r: cx + w / 2, t: cy - h / 2, b: cy + h / 2 }; + }; + const boxes = hosts.map(geometry); + const targets = [...document.querySelectorAll("button, a[href], [role='button'], summary, input, select, textarea")].filter((el) => shown(el) && !el.closest("[inert]")); + const meets = (a, b) => Math.min(a.r, b.r) - Math.max(a.l, b.l) > 0.5 && Math.min(a.b, b.b) - Math.max(a.t, b.t) > 0.5; + /** An element's box in the same l, r, t, b terms as a tap box (a DOMRect's are left, right, top and bottom). */ + const edges = (el) => { const q = R(el); return { l: q.left, r: q.right, t: q.top, b: q.bottom }; }; + const taps = boxes.map((box) => { + const { el } = box; + const entry = el.closest(c("@release-entry")); + const callout = el.closest(c("@release-action")); + const release = el.closest(c("@release")); + const name = `${entry?.id ?? release?.id}: ${el.textContent.trim().slice(0, 20)}`; + const out = { name, last: Boolean(entry?.matches(":last-child")), meets: [ + ...boxes.filter((o) => o !== box && meets(o, box)).map((o) => o.el.textContent.trim().slice(0, 20)), + ...targets.filter((o) => o !== el && !el.contains(o) && !o.contains(el) && !boxes.some((x) => x.el === o) && meets(edges(o), box)).map((o) => (o.getAttribute("aria-label") || o.textContent).trim().slice(0, 20)), + ] }; + if (callout) out.insideRim = f(R(callout).bottom - parseFloat(getComputedStyle(callout).borderBottomWidth) - box.b); + const next = release && releases[releases.indexOf(release) + 1]; + if (next) out.insideDivider = f(R(next).top - box.b); + return out; + }); + // What a finger on the middle of a last change's lowest box row lands on, each brought to the middle of the window first. + hosts.forEach((host, i) => { + if (!taps[i].last) return; + host[0].scrollIntoView({ block: "center" }); + const box = geometry(host); + const hit = document.elementFromPoint((box.l + box.r) / 2, box.b - 1); + taps[i].lowestRow = hit === host[0] || host[0].contains(hit) ? "itself" : hit?.className?.toString().slice(0, 30) || hit?.tagName || "nothing"; + }); + scrollTo(0, 0); + const plates = qa(document, "@release-entry").filter((el) => el.hasAttribute("data-arrival") && shown(el)).map((el) => { + const ps = getComputedStyle(el, "::before"); + const box = R(el); + const plateT = box.top + parseFloat(ps.top), plateB = box.bottom - parseFloat(ps.bottom); + const ls = lines(el, { hidden: true }); + return { id: el.id, last: el.matches(":last-child"), inCallout: Boolean(el.closest(c("@release-action"))), above: f(Math.min(...ls.map((l) => l.t)) - plateT), under: f(plateB - Math.max(...ls.map((l) => l.b))) }; + }); + const notes = document.querySelector(c("@release-notes")) ?? releases.at(-1)?.parentElement; + let under = null; + if (notes) { + scrollTo(0, document.scrollingElement.scrollHeight); + const foot = R(notes).bottom; + const below = [...document.querySelectorAll("footer, nav, [class*='tabbar'], [class*='tab-bar']")].filter((el) => shown(el) && !notes.contains(el) && R(el).top >= foot - 0.5 && R(el).height); + if (below.length) under = f(Math.min(...below.map((el) => R(el).top)) - foot); + scrollTo(0, 0); + } + return { ends, taps, plates, under }; +}; + +/** + * The open Sources panel's rows on touch (DECISIONS 331, recheck-pixels 4), in either renderer (both write a dl of div rows of dt and dd): each value's + * height, the room between a tracker's name and its linked id, each row's padding, where a last linked value's 44px box ends against its row's edge, + * the distance between two linked values in one row, and the room from each row's label to its first value. + */ +export const SOURCES = () => { + const panel = [...document.querySelectorAll("[popover]:popover-open, .basalt-release-sources")].find((el) => el.matches(".release-sources, .basalt-release-sources") && el.checkVisibility()); + const R = (el) => el.getBoundingClientRect(); + const f = (n) => Math.round(n * 100) / 100; + const box = (a) => { const q = R(a); const h = parseFloat(getComputedStyle(a, "::after").height); const c = (q.top + q.bottom) / 2; return { t: c - h / 2, b: c + h / 2, h }; }; + const rows = [...panel.querySelectorAll("dl > div")]; + return rows.map((row, i) => { + const cs = getComputedStyle(row); + const values = [...row.querySelectorAll("dd")]; + const linked = values.filter((dd) => dd.querySelector("a")); + const out = { term: row.querySelector("dt").textContent.trim(), padTop: cs.paddingTop, padBottom: cs.paddingBottom, first: i === 0, last: i === rows.length - 1 }; + out.heights = values.map((dd) => f(R(dd).height)); + out.labelToValue = f(R(values[0]).top - R(row.querySelector("dt")).bottom); + out.nameGaps = linked.map((dd) => { const text = [...dd.childNodes].find((n) => n.nodeType === 3 && n.textContent.trim()); if (!text) return null; const range = document.createRange(); range.selectNodeContents(text); const words = [...range.getClientRects()].filter((q) => q.width).at(-1); return f(R(dd.querySelector("a")).left - words.right); }).filter((g) => g !== null); + out.boxes = linked.map((dd) => box(dd.querySelector("a")).h); + const lastValue = values.at(-1); + if (lastValue?.querySelector("a")) out.lastBoxToEdge = f(R(row).bottom - box(lastValue.querySelector("a")).b); + out.linkedPairs = values.slice(1).map((dd, k) => [values[k], dd]).filter(([a, b]) => a.querySelector("a") && b.querySelector("a")).map(([a, b]) => f(box(b.querySelector("a")).t - box(a.querySelector("a")).b)); + return out; + }); +}; + +/** + * Each drawn source line (recheck-pixels 2), in the page with the class prefix ("basalt-" for React, "" for the HTML skill): how many lines its ids + * stand on, its tallest id (an id long enough breaks inside itself), and how far its first id stands from its words' first line. + */ +export const SOURCE_LINES = (p) => [...document.querySelectorAll(`.${p}release-source`)].filter((b) => b.checkVisibility()).map((b) => { + const entry = b.closest(`.${p}release-entry`); + const ids = [...b.querySelectorAll(`.${p}release-id`)].map((id) => id.getBoundingClientRect()); + const words = entry.querySelector(`.${p}release-entry-text`).getBoundingClientRect().top; + return { id: entry.id, lines: new Set(ids.map((q) => Math.round(q.top))).size, tall: Math.max(...ids.map((q) => q.height)), offset: Math.round(Math.min(...ids.map((q) => q.top)) - words) }; +}); diff --git a/packages/react/test/release-notes.test.mjs b/packages/react/test/release-notes.test.mjs new file mode 100644 index 00000000..a1c6ab78 --- /dev/null +++ b/packages/react/test/release-notes.test.mjs @@ -0,0 +1,681 @@ +// A page of releases (DECISIONS 320, section 2): ReleaseNotes in both forms from the made-up fixtures (Slate, a package; Harbor, a product), +// driven in Chromium against the built package with the real stylesheet. +import assert from "node:assert/strict"; +import fs from "node:fs"; +import { createRequire } from "node:module"; +import path from "node:path"; +import { after, before, describe, test } from "node:test"; + +import { ENDS, HARBOR, RUNNING_BUILD, SLATE, SOURCE_LINES, SOURCES, SWEEP, harborShell } from "./release-fixture.mjs"; +import { bundleFixture, fixturePage, launch, pkg, settle } from "./support.mjs"; + +const axeSource = fs.readFileSync(createRequire(import.meta.url).resolve("axe-core/axe.min.js"), "utf8"); +let browser; +before(async () => { browser = await launch(); }); +after(async () => { await browser?.close(); }); + +const DATA = `const HARBOR = ${JSON.stringify(HARBOR)}; const SLATE = ${JSON.stringify(SLATE)}; const RUNNING_BUILD = ${JSON.stringify(RUNNING_BUILD)};`; +const app = (jsx) => `${DATA} document.body.style.margin = "0"; document.body.style.background = "var(--basalt-surface-page)"; document.body.style.color = "var(--basalt-text-primary)"; +function App() { ${jsx} } +createRoot(document.getElementById("root")).render(<App />);`; +/** Slate's changelog on a site page: the versions in the pane beside it, or in a fold above it. */ +const SLATE_PAGE = (more = "") => `return <main style={{ boxSizing: "border-box", width: "100%", maxWidth: 1200, margin: "0 auto", padding: "48px 16px" }}> + <B.PaneLayout pane={<B.ReleaseIndex releases={SLATE} />} paneLabel="Versions"><B.ReleaseIndex releases={SLATE} form="fold" /><B.ReleaseNotes releases={SLATE} form="reference" product="Slate" baseHref="https://slate.example/changelog" ${more} /></B.PaneLayout></main>;`; +const open = async (jsx, { theme = "light", width = 1440, height = 900, ...options } = {}) => { + const { page, errors } = await fixturePage(browser, app(jsx), { theme, viewport: { width, height }, standards: true, ...options }); + await settle(page); + page.errors = errors; + return page; +}; +const box = (locator) => locator.evaluate((el) => { const r = el.getBoundingClientRect(); return { x: r.x, y: r.y, width: r.width, height: r.height, right: r.right, bottom: r.bottom }; }); +/** What a part draws, as a reader sees it: the dots of DotSep as " · ", a count after its name, and nothing that is visually hidden. */ +const DRAWN = (el) => { + const copy = el.cloneNode(true); + copy.querySelectorAll(".basalt-visually-hidden").forEach((n) => n.remove()); + copy.querySelectorAll(".basalt-dot-sep").forEach((n) => n.replaceWith(" · ")); + copy.querySelectorAll(".basalt-release-count, .basalt-badge").forEach((n) => n.before(" ")); + return copy.textContent.replace(/\s+/g, " ").trim(); +}; +const words = (locator) => locator.evaluate(DRAWN); +const axe = async (page) => { + await page.evaluate(() => { document.title = "Basalt"; document.documentElement.lang = "en"; }); + await page.addScriptTag({ content: axeSource }); + return page.evaluate(async () => { + const options = { runOnly: { type: "tag", values: ["wcag2a", "wcag2aa", "wcag21a", "wcag21aa", "wcag22aa"] }, resultTypes: ["violations"] }; + const result = await globalThis.axe.run({ exclude: [["[data-base-ui-focus-guard]"]] }, options); + return result.violations.map((v) => `${v.id}: ${v.nodes.map((n) => n.target.join(" ")).join(" | ")}`); + }); +}; +/** Open every fold on the page (the releases' and the versions'). */ +const openAll = async (page) => { + for (let round = 0; round < 3; round++) { + const closed = page.locator(".basalt-release-notes .basalt-accordion-trigger:not([data-panel-open]), .basalt-release-index .basalt-accordion-trigger:not([data-panel-open])"); + const n = await closed.count(); + if (!n) break; + for (let i = 0; i < n; i++) await closed.first().evaluate((el) => el.click()); + await settle(page); + } +}; +/** An accessible name as Chrome computes it: a visually hidden comma or colon stands apart from the words before it ("0.2.0 , Nov 16"). */ +const named = (text) => new RegExp(`^${text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/([,:])/g, "\\s*$1")}$`); +const release = (page, id) => page.locator(`[id="${id}"]`); +const headings = (locator, level) => locator.locator(`h${level}`).evaluateAll((els, drawn) => els.map((el) => new Function(`return (${drawn})`)()(el)), DRAWN.toString()); + +describe("the two forms from one record", () => { + test("a heading holds the number and the date (and a product's headline), so a reader moving by headings hears which release and when", async () => { + const slate = await open(SLATE_PAGE()); + assert.equal(await slate.getByRole("heading", { name: named("0.2.0, Nov 16, 2026"), level: 2 }).count(), 1); + assert.equal(await slate.getByRole("heading", { name: named("0.2.1, Nov 16, 2026"), level: 2 }).count(), 1); + assert.equal(await slate.getByRole("heading", { name: "Unreleased", exact: true, level: 2 }).count(), 1); + const harbor = await open(harborShell()); + assert.equal(await harbor.getByRole("heading", { name: named("1.4.0, Nov 23, 2026: A monitor can open an incident room"), level: 2 }).count(), 1); + assert.equal(await harbor.getByRole("heading", { name: named("1.4.1, Dec 8, 2026"), level: 2 }).count(), 1); + // A product's page never shows Unreleased. + assert.equal(await harbor.getByRole("heading", { name: "Unreleased" }).count(), 0); + }); + + test("the counts are computed from the list, with their singulars", async () => { + const slate = await open(SLATE_PAGE()); + assert.equal(await words(release(slate, "v0.2.0").locator(".basalt-release-meta")), "Nov 16, 2026 · 14 changes · 4 need action"); + assert.equal(await words(release(slate, "v0.2.1").locator(".basalt-release-meta")), "Nov 16, 2026 · 1 change"); + assert.equal(await words(release(slate, "v0.1.0").locator(".basalt-release-meta")), "Nov 2, 2026"); + assert.equal(await release(slate, "v0.2.0").getByRole("link", { name: "4 need action" }).getAttribute("href"), "#v0.2.0__action"); + const harbor = await open(harborShell()); + assert.equal(await words(release(harbor, "v1.3.0").locator("p.basalt-release-meta:not(.basalt-release-number-line)")), "2 changes · 1 needs action"); + assert.equal(await words(release(harbor, "v1.4.0").locator("p.basalt-release-meta:not(.basalt-release-number-line)")), "5 changes Your version"); + // Releases highest first by precedence: a backport to 1.x sits under 2.0.0 though it shipped after it. + assert.deepEqual(await harbor.locator(".basalt-release").evaluateAll((els) => els.map((el) => el.id)), ["v2.0.0", "v1.4.1", "v1.4.0", "v1.3.1", "v1.3.0"]); + }); + + test("a package's order: the summary, Action needed opening with the upgrade line, then Deprecated, Added, Changed and Fixed", async () => { + const page = await open(SLATE_PAGE()); + const own = release(page, "v0.2.0"); + const order = await own.evaluate((el) => [...el.children].map((child) => child.className.split(" ").find((name) => name.startsWith("basalt-release-")) ?? child.className)); + assert.deepEqual(order, ["basalt-release-head", "basalt-release-summary", "basalt-release-action", "basalt-release-section", "basalt-release-section", "basalt-release-section", "basalt-release-section"]); + assert.deepEqual(await headings(own, 3), ["Action needed 4", "Deprecated 1", "Added 3", "Changed 1", "Fixed 5"]); + assert.equal(await words(own.locator(".basalt-release-upgrade")), "Before upgrading from 0.1.0, check these 4 changes."); + // An action entry stands there and nowhere else in its release. + assert.equal(await own.locator('[id="pr41-1"]').count(), 1); + assert.equal(await own.locator('.basalt-release-action [id="pr41-1"]').count(), 1); + // A release with no entries is its summary, never a heading over nothing. + assert.equal(await words(release(page, "v0.1.0").locator(".basalt-release-summary")), "The first version in this changelog. Earlier work is in the repository's history."); + }); + + test("a product's order: the header, Action needed, the paragraphs, then one fold holding the summary and the list", async () => { + const page = await open(harborShell()); + const own = release(page, "v1.4.0"); + const order = await own.evaluate((el) => [...el.children].map((child) => child.className.split(" ").find((name) => name.startsWith("basalt-release-")))); + assert.deepEqual(order, ["basalt-release-head", "basalt-release-audience", "basalt-release-audience", "basalt-release-audience", "basalt-release-all", "basalt-release-build"]); + assert.deepEqual(await headings(own, 3), ["For responders", "For admins", "All changes 5", "Build details"]); + // The summary is the first thing inside the fold. + await own.getByRole("button", { name: "All changes 5" }).click(); + await settle(page); + const inside = await own.locator(".basalt-release-all .basalt-accordion-content").evaluate((el) => [...el.children].map((child) => child.className)); + assert.equal(inside[0], "basalt-release-summary"); + assert.deepEqual(await headings(own.locator(".basalt-release-all"), 4), ["Added 2", "Changed 1", "Fixed 2"]); + const withAction = release(page, "v2.0.0"); + const order2 = await withAction.evaluate((el) => [...el.children].map((child) => child.className.split(" ").find((name) => name.startsWith("basalt-release-")))); + assert.deepEqual(order2, ["basalt-release-head", "basalt-release-action", "basalt-release-audience", "basalt-release-audience", "basalt-release-all"]); + }); + + test("the folds: Fixed past 3 in a release of more than 10, a product's list behind one fold, and Action needed never folded", async () => { + const slate = await open(SLATE_PAGE()); + const folds = await slate.locator(".basalt-release-notes .basalt-accordion-trigger").evaluateAll((els, drawn) => els.map((el) => new Function(`return (${drawn})`)()(el)), DRAWN.toString()); + assert.deepEqual(folds, ["Fixed 5"]); + assert.equal(await slate.locator('[id="pr49-1"]').isVisible(), false, "closed"); + assert.equal(await slate.locator(".basalt-release-action").isVisible(), true); + assert.equal(await slate.locator(".basalt-accordion-panel .basalt-release-action, .basalt-accordion-panel [id='pr41-1']").count(), 0, "no action entry in a fold"); + const harbor = await open(harborShell()); + assert.equal(await harbor.locator(".basalt-accordion-panel .basalt-release-action").count(), 0); + // A patch with no paragraphs shows its summary and its list open, even with four fixes. + assert.equal(await release(harbor, "v1.3.1").locator(".basalt-accordion-trigger").count(), 0); + }); + + test("the fold is named for what it opens: Other changes when actions stand above it, and its count is what it opens", async () => { + const page = await open(harborShell()); + for (const [id, name, count] of [["v1.4.0", "All changes", 5], ["v1.3.0", "Other changes", 1], ["v2.0.0", "Other changes", 3]]) { + const own = release(page, id); + const trigger = own.locator(".basalt-release-all .basalt-accordion-trigger"); + assert.equal(await words(trigger), `${name} ${count}`, id); + await trigger.click(); + await settle(page); + assert.equal(await own.locator(".basalt-release-all .basalt-release-entry").count(), count, `${id} opens ${count}`); + } + // The header keeps the release's totals. + assert.equal(await words(release(page, "v1.3.0").locator("p.basalt-release-meta:not(.basalt-release-number-line)")), "2 changes · 1 needs action"); + }); + + test("the number in a headline's meta line is Geist; standing alone it is mono", async () => { + const page = await open(harborShell()); + const family = (locator) => locator.evaluate((el) => getComputedStyle(el).fontFamily); + assert.doesNotMatch(await family(release(page, "v1.4.0").locator(".basalt-release-number-line")), /mono/i); + assert.match(await family(release(page, "v1.4.1").locator(".basalt-release-version")), /mono/i); + }); +}); + +describe("entries and their sources", () => { + test("at 1440 the words keep one measure down each list, and the sources start on one edge", async () => { + const page = await open(SLATE_PAGE()); + await openAll(page); + const lists = await page.locator(".basalt-release-notes .basalt-release-list").evaluateAll((els) => els.map((list) => { + const texts = [...list.querySelectorAll(":scope > .basalt-release-entry > .basalt-release-entry-words")].map((el) => Math.round(el.getBoundingClientRect().width)); + const sources = [...list.querySelectorAll(":scope > .basalt-release-entry > .basalt-release-source-cell")].map((el) => Math.round(el.getBoundingClientRect().left)); + return { texts: [...new Set(texts)], sources: [...new Set(sources)] }; + })); + for (const list of lists) { + assert.equal(list.texts.length, 1, `one measure: ${list.texts}`); + assert.equal(list.sources.length, 1, `one edge: ${list.sources}`); + } + }); + + test("at 390 the source line is its own line under the words, on their start edge", async () => { + const page = await open(SLATE_PAGE(), { width: 390, height: 844 }); + const entry = page.locator('[id="pr41-1"]'); + const text = await box(entry.locator(".basalt-release-entry-text")); + const source = await box(entry.locator(".basalt-release-source")); + assert.ok(source.y > text.y, "under the words"); + assert.equal(Math.round(source.x), Math.round(text.x)); + assert.ok(text.width > 280, `the words get the width: ${text.width}`); + }); + + test("the source line: the pull request, at most two tickets, then 3 more; its name is its text after Sources, described by the entry", async () => { + const page = await open(SLATE_PAGE()); + const tokens = page.locator('[id="pr46-1"] .basalt-release-source'); + assert.equal(await words(tokens), "#46 · DS-27 · DS-31 · 3 more"); + // The name is the visible words after a hidden "Sources: ", each dot read as a comma. + assert.equal(await page.getByRole("button", { name: named("Sources: #46, DS-27, DS-31, 3 more") }).count(), 1); + assert.equal(await tokens.getAttribute("aria-describedby"), "pr46-1__words"); + // An entry with no pull request leads with its commit; an unreleased one with nothing to show has no line. + assert.match(await words(page.locator('[id="docs-contrast-note"] .basalt-release-source')), /^[0-9a-f]{8}$/); + const family = await tokens.evaluate((el) => getComputedStyle(el).fontFamily); + assert.match(family, /mono/i); + }); + + test("the sources panel: Pull request, Tickets, Commit and Author when there is one; none of the rejected rows; Copy link to this change", async () => { + const page = await open(SLATE_PAGE()); + await page.locator('[id="pr41-1"] .basalt-release-source').click(); + let panel = page.locator(".basalt-release-sources"); + await panel.waitFor(); + await settle(page); + const terms = () => panel.locator("dt").evaluateAll((els) => els.map((el) => el.textContent)); + assert.deepEqual(await terms(), ["Pull request", "Tickets", "Commit", "Author"]); + assert.deepEqual(await panel.locator("dd").evaluateAll((els) => els.map((el) => el.textContent.replace(/\s+/g, " ").trim())).then((list) => list.slice(0, 3)), ["#41", "Linear SL-112", "Jira PRJ-88"]); + assert.equal(await panel.getByRole("link", { name: "SL-112" }).getAttribute("href"), "https://linear.app/example/issue/SL-112"); + assert.equal(await panel.getByRole("link", { name: "PRJ-88" }).count(), 0, "a text tracker is not linked"); + assert.match(await words(panel), /Sam Rivera/); + assert.doesNotMatch(await words(panel), /Built by|Code review|Edited by|Decision/); + assert.equal(await panel.getByRole("button", { name: "Copy link to this change" }).count(), 1); + // Focus moved into the panel; Escape returns it to the source line. + assert.equal(await page.evaluate(() => Boolean(document.activeElement?.closest(".basalt-release-sources"))), true); + await page.keyboard.press("Escape"); + await settle(page); + assert.equal(await page.evaluate(() => document.activeElement?.closest(".basalt-release-entry")?.id), "pr41-1"); + // An entry with no author has no Author row. + await page.locator('[id="pr42-1"] .basalt-release-source').click(); + panel = page.locator(".basalt-release-sources"); + await panel.waitFor(); + assert.deepEqual(await terms(), ["Pull request", "Commit"]); + }); + + test("copied addresses: the app's base, or the window's when a button is pressed, with no query", async () => { + const context = await browser.newContext({ viewport: { width: 1440, height: 900 }, permissions: ["clipboard-read", "clipboard-write"] }); + const page = await context.newPage(); + await page.route("https://slate.example/**", (route) => route.fulfill({ contentType: "text/html", body: "<!doctype html><html><head></head><body><div id=root></div></body></html>" })); + await page.goto("https://slate.example/changelog?from=menu"); + await page.addStyleTag({ content: fs.readFileSync(path.join(pkg, "dist", "styles.css"), "utf8") }); + await page.addScriptTag({ content: await bundleFixture(app(`return <B.ReleaseNotes releases={SLATE} form="reference" product="Slate" />;`)) }); + await settle(page); + await page.getByRole("button", { name: "Copy link to Slate 0.2.0" }).click(); + assert.equal(await page.evaluate(() => navigator.clipboard.readText()), "https://slate.example/changelog#v0.2.0"); + // The page changes its route with the part still drawn: the address is read when the button is pressed, for a release and for an entry. + await page.evaluate(() => history.pushState({}, "", "/new-notes?context=two")); + await page.getByRole("button", { name: "Copy link to Slate 0.2.1" }).click(); + await page.waitForFunction(() => navigator.clipboard.readText().then((text) => text.endsWith("#v0.2.1"))); + assert.equal(await page.evaluate(() => navigator.clipboard.readText()), "https://slate.example/new-notes#v0.2.1"); + await page.locator('[id="pr41-1"] .basalt-release-source').click(); + await page.getByRole("button", { name: "Copy link to this change" }).click(); + await page.waitForFunction(() => navigator.clipboard.readText().then((text) => text.endsWith("#pr41-1"))); + assert.equal(await page.evaluate(() => navigator.clipboard.readText()), "https://slate.example/new-notes#pr41-1"); + await page.keyboard.press("Escape"); + await page.getByRole("button", { name: "Copy link to Unreleased" }).click(); + await page.waitForFunction(() => navigator.clipboard.readText().then((text) => text.endsWith("#unreleased"))); + assert.equal(await page.evaluate(() => navigator.clipboard.readText()), "https://slate.example/new-notes#unreleased"); + await context.close(); + // An app that gives its address: that is what is copied, whatever the window's is. + const other = await open(harborShell()); + await other.evaluate(() => { window.copied = []; Object.defineProperty(navigator, "clipboard", { value: { writeText: async (text) => { window.copied.push(text); } }, configurable: true }); }); + await other.getByRole("button", { name: "Copy link to Harbor 1.4.0" }).click(); + await other.waitForFunction(() => window.copied.length === 1); + assert.deepEqual(await other.evaluate(() => window.copied), ["https://harbor.example/release-notes#v1.4.0"]); + }); +}); + +describe("the header, the lazy panel and long sources", () => { + for (const [width, touch] of [[1440, false], [390, false], [390, true]]) { + test(`Copy link is centred on the header's first line, which alone makes room for it (${width}${touch ? ", touch" : ""})`, async () => { + for (const [jsx, ids] of [[harborShell(), ["v1.4.0", "v1.4.1"]], [SLATE_PAGE(), ["v0.2.0", "unreleased"]]]) { + const page = await open(jsx, { width, height: 900, hasTouch: touch }); + for (const id of ids) { + const r = await page.locator(`[id="${id}"]`).evaluate((el) => { + const box = (n) => n.getBoundingClientRect(); + const first = el.querySelector(".basalt-release-number-line, .basalt-release-heading:not([data-headline])"); + const copy = el.querySelector(".basalt-release-copy"); + const title = el.querySelector(".basalt-release-title"); + const centre = (n) => box(n).top + box(n).height / 2; + return { off: Math.abs(centre(copy) - centre(first)), title: title ? box(title.closest("h2, h3")).width : null, release: box(el).width, firstTop: box(first).top, headTop: box(el.querySelector(".basalt-release-head")).top }; + }); + assert.ok(r.off <= 1, `${id}: Copy link is ${r.off}px off the first line`); + assert.equal(Math.round(r.firstTop), Math.round(r.headTop), `${id}: the first line is the header's top`); + if (r.title !== null) assert.ok(Math.abs(r.title - Math.min(r.release, 824)) <= 1, `${id}: the headline takes the release's width (${r.title} of ${r.release})`); + } + } + }); + } + + test("the Sources popup is not on the page until a reader asks; the first press, or Enter, opens it with focus on the panel", async () => { + const page = await open(SLATE_PAGE()); + assert.equal(await page.locator(".basalt-release-sources").count(), 0); + const line = page.locator('[id="pr45-1"] .basalt-release-source'); + assert.equal(await line.getAttribute("aria-haspopup"), "dialog"); + assert.equal(await line.getAttribute("aria-expanded"), "false"); + await line.focus(); + await page.keyboard.press("Enter"); + await page.locator(".basalt-release-sources").waitFor(); + await page.waitForFunction(() => document.activeElement?.classList.contains("basalt-release-sources")); + await page.keyboard.press("Escape"); + await page.waitForFunction(() => document.activeElement?.closest?.(".basalt-release-entry")?.id === "pr45-1"); + assert.equal(await page.locator('[id="pr45-1"] .basalt-release-source').getAttribute("aria-expanded"), "false"); + }); + + test("on touch at 390 every link in the open Sources panel is 44 tall to a finger, and none takes another's taps", async () => { + const page = await open(SLATE_PAGE(), { width: 390, height: 844, hasTouch: true }); + await page.locator('[id="pr46-1"] .basalt-release-source').click(); + await page.locator(".basalt-release-sources a").first().waitFor(); + await settle(page); + const rows = await page.evaluate(() => { + const owner = (x, y) => document.elementFromPoint(x, y)?.closest("a, button") ?? null; + return [...document.querySelectorAll(".basalt-release-sources a, .basalt-release-sources button")].map((el) => { + el.scrollIntoView({ block: "center" }); + const b = el.getBoundingClientRect(); + const cx = b.x + Math.min(b.width / 2, 20); + const cy = b.y + b.height / 2; + let top = cy; + let bottom = cy; + while (top > cy - 60 && owner(cx, top - 1) === el) top--; + while (bottom < cy + 60 && owner(cx, bottom + 1) === el) bottom++; + return { label: el.textContent.trim(), hit: owner(cx, cy) === el ? Math.round(bottom - top) + 1 : 0 }; + }); + }); + assert.ok(rows.length >= 6, `${rows.length} controls`); + assert.deepEqual(rows.filter((row) => row.hit < 44).map((row) => `${row.label}: ${row.hit}`), []); + }); + + test("Sources on touch: a linked value keeps its 20px line and its place after the tracker's name; rows are space-3 above and below; boxes end on their row's edge (recheck-pixels 4)", async () => { + const page = await open(SLATE_PAGE(), { width: 390, height: 844, hasTouch: true }); + for (const id of ["pr41-1", "pr46-1"]) { + await page.locator(`[id="${id}"] .basalt-release-source`).click(); + await page.locator(".basalt-release-sources a").first().waitFor(); + await page.waitForTimeout(100); + const rows = await page.evaluate(`(${SOURCES})()`); + assert.ok(rows.length >= 3, id); + for (const row of rows) { + assert.deepEqual(row.heights.filter((h) => Math.abs(h - 20) > 0.5), [], `${id} ${row.term}: every value is one 20px line`); + assert.deepEqual(row.nameGaps.filter((g) => g < 2), [], `${id} ${row.term}: the tracker's name keeps its space`); + assert.deepEqual(row.boxes.filter((h) => h !== 44), [], `${id} ${row.term}: each link's box is 44`); + if (!row.first) assert.equal(row.padTop, "12px", `${id} ${row.term}`); + if (!row.last) assert.equal(row.padBottom, "12px", `${id} ${row.term}`); + if (!row.last && row.lastBoxToEdge !== undefined) assert.ok(Math.abs(row.lastBoxToEdge) <= 1, `${id} ${row.term}: the box ends ${row.lastBoxToEdge} from the row's edge`); + for (const gap of row.linkedPairs) assert.ok(Math.abs(gap) <= 1, `${id} ${row.term}: two linked values' boxes meet (${gap})`); + } + // A linked value stands under its label as an unlinked one does. + assert.ok(Math.max(...rows.map((row) => row.labelToValue)) - Math.min(...rows.map((row) => row.labelToValue)) <= 0.5, `${id}: ${rows.map((row) => `${row.term} ${row.labelToValue}`)}`); + await page.keyboard.press("Escape"); + await page.waitForTimeout(100); + } + }); + + for (const width of [968, 1024, 820]) { + test(`beside the words a source line is one line, and the words give way (recheck-pixels 2, ${width})`, async () => { + const page = await open(SLATE_PAGE(), { width, height: 900 }); + await openAll(page); + const rows = await page.evaluate(`(${SOURCE_LINES})("basalt-")`); + assert.ok(rows.length >= 10); + assert.deepEqual(rows.filter((row) => row.lines !== 1).map((row) => `${row.id}: ${row.lines} lines`), []); + assert.deepEqual(rows.filter((row) => Math.abs(row.offset) > 2).map((row) => `${row.id}: ${row.offset}`), [], "each source line stands on its words' first line"); + }); + } + + test("an id longer than its column's share breaks inside itself, and its first line stands beside the words' first line (recheck-pixels 2)", async () => { + const long = structuredClone(SLATE); + long.find((r) => r.version === "0.2.0").entries.find((e) => e.id === "pr41-1").tickets.unshift({ tracker: "Linear", label: `SL-${"9".repeat(100)}`, href: "https://linear.app/example/issue/SL-9" }); + for (const width of [968, 1440]) { + const page = await open(`const SLATE_LONG = ${JSON.stringify(long)}; ${SLATE_PAGE().replace(/releases=\{SLATE\}/g, "releases={SLATE_LONG}")}`, { width, height: 900 }); + const row = (await page.evaluate(`(${SOURCE_LINES})("basalt-")`)).find((r) => r.id === "pr41-1"); + assert.ok(row.tall > 40, `the long id breaks inside itself (${row.tall})`); + assert.ok(Math.abs(row.offset) <= 2, `its first line is beside the words' first line (${row.offset})`); + assert.equal(await page.evaluate(() => document.documentElement.scrollWidth), width); + } + }); + + test("a long source id keeps to the release's width beside the words, and breaks inside itself", async () => { + const long = `PRJ-${"9".repeat(100)}`; + const release = { version: "3.0.0", date: "2026-12-01", entries: [{ id: "pr60-1", type: "fixed", bump: "patch", area: "List", text: "Fixed the list losing its place", pr: { number: 60, href: "https://example.test/pull/60" }, tickets: [{ tracker: "Jira", label: long }] }] }; + for (const width of [1000, 1440]) { + const page = await open(`return <div style={{ padding: 16 }}><B.ReleaseNotes releases={${JSON.stringify([release])}} form="reference" product="Slate" /></div>;`, { width }); + assert.equal(await page.evaluate(() => document.documentElement.scrollWidth), width); + const list = await box(page.locator(".basalt-release-list")); + const source = await box(page.locator(".basalt-release-source")); + assert.ok(source.right <= list.right + 0.5, `the source line ends inside the list (${source.right} of ${list.right})`); + } + }); + + test("a product's patch with no paragraphs shows its list open, however many fixes", async () => { + const fixes = Array.from({ length: 11 }, (_, index) => ({ id: `pr${70 + index}-1`, type: "fixed", bump: "patch", area: "Rooms", text: `Fixed the room timer in case ${index + 1}` })); + const page = await open(`return <B.ReleaseNotes releases={${JSON.stringify([{ version: "1.4.2", date: "2026-12-09", summary: "Fixes to the room timer.", entries: fixes }])}} form="notes" product="Harbor" />;`); + assert.equal(await page.locator(".basalt-accordion-trigger").count(), 0); + assert.equal(await page.locator(".basalt-release-entry").count(), 11); + }); +}); + +/** Slate's changelog on a site page with its footer: the page's own room under the last release is half the section gap, the footer's the other half. */ +const SLATE_SITE_PAGE = (more = "") => `return <B.SitePage><main style={{ boxSizing: "border-box", width: "100%", maxWidth: 1200, margin: "0 auto", padding: "48px 16px calc(var(--basalt-section-gap) / 2)" }}> + <B.PaneLayout pane={<B.ReleaseIndex releases={SLATE} />} paneLabel="Versions"><B.ReleaseIndex releases={SLATE} form="fold" /><B.ReleaseNotes releases={SLATE} form="reference" product="Slate" ${more} /></B.PaneLayout></main><B.SiteFooter id="slate-footer" brand="Slate" legal="© 2026 Example" /></B.SitePage>;`; +describe("the spacing sweep (DECISIONS 326, round 68)", () => { + const SLATE_SITE = SLATE_SITE_PAGE(); + for (const [width, touch] of [[1440, false], [390, false], [390, true]]) { + test(`each box hugs what it shows (${width}${touch ? ", touch" : ""})`, async () => { + for (const [name, jsx] of [["Slate", SLATE_SITE], ["Harbor", harborShell()]]) { + const page = await open(jsx, { width, height: 900, hasTouch: touch }); + await openAll(page); + const m = await page.evaluate(`(${SWEEP})("basalt-")`); + // 68-1: Copy link is a ghost button at the header's end, so its words end on the header's edge. + assert.ok(m.copy.length >= 4, name); + assert.deepEqual(m.copy.filter((c) => Math.abs(c.off) > 0.5), [], `${name}: Copy link's words end on the edge`); + // 68-2: the callout's inset is the same above its first words and under its last. + assert.ok(m.callouts.length >= 1, name); + for (const c of m.callouts) assert.ok(Math.abs(c.top - c.bottom) <= 0.5, `${name} ${c.id}: ${c.top} above, ${c.bottom} under`); + // 68-3: at the wide form one reference column runs down the page, inside the callout and out of it. + if (width === 1440) assert.equal(new Set(m.references.map((r) => r.x)).size, 1, `${name}: references start at ${[...new Set(m.references.map((r) => `${r.inCallout ? "callout " : ""}${r.x}`))]}`); + // 68-4: the last release carries no padding under it; the others keep space-10. + assert.deepEqual(m.padding.map((r) => r.bottom), [...m.padding.slice(1).map(() => "40px"), "0px"], name); + // 68-5: every change ends alike, a linked one too: one gap from a change's last line to the next change's first. + assert.ok(m.gaps.length >= 5, name); + assert.equal(new Set(m.gaps.map((g) => g.gap)).size, 1, `${name}: ${m.gaps.map((g) => `${g.id}${g.linked ? " (linked)" : ""} ${g.gap}`).join(", ")}`); + // 68-6: a code chip shorter than its line is drawn on one line. + assert.deepEqual(m.chips.filter((c) => !c.wider && c.lines !== 1).map((c) => c.text), [], name); + if (name === "Slate") { + assert.ok(m.chips.some((c) => c.text === "() => localStorage"), "the chip the sweep found split is measured"); + // 68-4: the gap from the last release to the footer is the section gap alone (128 from 1024, 64 under 720). + const gap = await page.evaluate(() => document.getElementById("slate-footer").getBoundingClientRect().top - [...document.querySelectorAll(".basalt-release")].at(-1).getBoundingClientRect().bottom); + assert.equal(Math.round(gap), width === 1440 ? 128 : 64, "the gap above the footer"); + } + } + }); + } +}); + +describe("where a release ends (DECISIONS 331)", () => { + const PAGES = () => [["Slate", SLATE_SITE_PAGE()], ["Harbor", harborShell()]]; + /** Press the button of every fold that ends a release, and wait for the panels. */ + const pressEndingFolds = async (page) => { + await page.evaluate(() => { for (const r of document.querySelectorAll(".basalt-release")) r.lastElementChild.querySelector(".basalt-accordion-trigger")?.click(); }); + await settle(page); + }; + for (const [width, touch] of [[390, true], [820, true], [1440, false]]) { + test(`every release's last line is space-10 above its divider, whatever ends it, and pressing a fold that ends one moves nothing else (${width}${touch ? ", touch" : ""})`, async () => { + for (const [name, jsx] of PAGES()) { + const page = await open(jsx, { width, height: 900, hasTouch: touch, reducedMotion: "reduce" }); + const rounds = []; + for (const state of ["closed", "open", "closed again"]) { + if (state !== "closed") await pressEndingFolds(page); + const m = await page.evaluate(`(${ENDS})("basalt-")`); + rounds.push([state, m.ends]); + assert.ok(m.ends.length >= 3, name); + assert.deepEqual(m.ends.filter((e) => Math.abs(e.gap - 40) > 0.5), [], `${name}, folds ${state}`); + } + // Each way a release ends is met: an open list, and a fold (Slate's Fixed, Harbor's Other changes, Harbor's Build details), open and closed. + const kinds = new Set(rounds.flatMap(([, ends]) => ends.map((e) => `${e.ends}${e.open === null ? "" : e.open ? " open" : " closed"}`))); + if (name === "Slate") for (const kind of ["basalt-release-section", "basalt-release-section[data-folded] closed", "basalt-release-section[data-folded] open"]) assert.ok(kinds.has(kind), `${name}: ${kind} in ${[...kinds]}`); + if (name === "Harbor") for (const kind of ["basalt-release-section", "basalt-release-all closed", "basalt-release-all open", "basalt-release-build closed", "basalt-release-build open"]) assert.ok(kinds.has(kind), `${name}: ${kind} in ${[...kinds]}`); + assert.deepEqual(page.errors, []); + } + }); + } + + for (const width of [390, 820]) { + test(`on touch at ${width}: no tap box meets another target or crosses a rim or a divider, and a last change's lowest row is its own`, async () => { + for (const [name, jsx] of PAGES()) { + const page = await open(jsx, { width, height: 900, hasTouch: true, reducedMotion: "reduce" }); + await openAll(page); + const m = await page.evaluate(`(${ENDS})("basalt-")`); + assert.ok(m.taps.length > 10, name); + assert.deepEqual(m.taps.filter((t) => t.meets.length).map((t) => `${t.name} meets ${t.meets}`), [], name); + assert.deepEqual(m.taps.filter((t) => t.insideRim < -0.5).map((t) => `${t.name}: ${t.insideRim}`), [], `${name}: past a callout's rim`); + assert.deepEqual(m.taps.filter((t) => t.insideDivider < -0.5).map((t) => `${t.name}: ${t.insideDivider}`), [], `${name}: past a divider`); + const last = m.taps.filter((t) => t.last); + assert.ok(last.length >= 3, name); + assert.deepEqual(last.filter((t) => t.lowestRow !== "itself").map((t) => `${t.name}: ${t.lowestRow}`), [], name); + // The last change in Action needed reaches the rim's inner edge and no further (space-3, all of it). + assert.ok(m.taps.some((t) => t.last && t.insideRim !== undefined && Math.abs(t.insideRim) <= 0.5), `${name}: ${m.taps.filter((t) => t.insideRim !== undefined).map((t) => t.insideRim)}`); + } + }); + } + + for (const [width, touch] of [[390, true], [1440, false]]) { + test(`a change that has arrived keeps its padding: its plate is equal above and under, last in Action needed and at a release's end (${width}${touch ? ", touch" : ""})`, async () => { + for (const [name, id, jsx] of [ + ["Slate, Action needed", "pr43-1", SLATE_SITE_PAGE('arrived="pr43-1"')], + ["Slate, an open list", "pr52-1", SLATE_SITE_PAGE('arrived="pr52-1"')], + ["Harbor, Action needed", "pr140-1", harborShell({ extra: 'arrived="pr140-1"' })], + ["Harbor, a fold", "pr143-1", harborShell({ extra: 'arrived="pr143-1"' })], + ]) { + const page = await open(jsx, { width, height: 900, hasTouch: touch, reducedMotion: "reduce" }); + const m = await page.evaluate(`(${ENDS})("basalt-")`); + const plate = m.plates.find((p) => p.id === id); + assert.ok(plate, `${name}: ${id} arrived`); + assert.ok(plate.last, `${name}: ${id} is the last change in its list`); + assert.ok(Math.abs(plate.above - plate.under) <= 0.5, `${name}: the plate is ${plate.above} above and ${plate.under} under`); + } + }); + } + + test("the overlap measurement sees an ordinary button laid over a source line's box (recheck 7)", async () => { + const page = await open(SLATE_SITE_PAGE(), { width: 390, height: 900, hasTouch: true, reducedMotion: "reduce" }); + const clean = await page.evaluate(`(${ENDS})("basalt-")`); + assert.deepEqual(clean.taps.find((t) => t.name.startsWith("pr41-1:")).meets, []); + // A positive control: an ordinary 44px button laid over the middle of #41's source line is seen by the measurement (recheck 7). + await page.evaluate(() => { + const source = document.querySelector('[id="pr41-1"] .basalt-release-source'); + source.scrollIntoView({ block: "center" }); + const q = source.getBoundingClientRect(); + const probe = Object.assign(document.createElement("button"), { textContent: "Probe" }); + Object.assign(probe.style, { position: "fixed", zIndex: "10", left: `${q.left + q.width / 2 - 22}px`, top: `${q.top + q.height / 2 - 22}px`, width: "44px", height: "44px" }); + document.body.append(probe); + }); + const control = await page.evaluate(`(${ENDS})("basalt-")`); + assert.deepEqual(control.taps.find((t) => t.name.startsWith("pr41-1:")).meets, ["Probe"]); + }); + + for (const [width, touch] of [[390, true], [1440, false]]) { + test(`an arrived release's plate covers its whole header: the number, the date and the counts (recheck-pixels 3, ${width})`, async () => { + const page = await open(SLATE_SITE_PAGE('arrived="v0.2.0"'), { width, height: 900, hasTouch: touch, reducedMotion: "reduce" }); + const m = await page.evaluate((sel) => { + const head = document.querySelector(sel); + const q = head.getBoundingClientRect(); + const ps = getComputedStyle(head, "::before"); + return { head: q.height, width: q.width, plate: parseFloat(ps.height), plateWidth: parseFloat(ps.width), top: parseFloat(ps.top) }; + }, '[id="v0.2.0"] > .basalt-release-head'); + // The plate is the whole header grown by space-1 above and below and space-2 at each side, not its first row. + assert.ok(Math.abs(m.plate - (m.head + 8)) <= 0.5, `the plate is ${m.plate} tall on a ${m.head} header`); + assert.ok(Math.abs(m.plateWidth - (m.width + 16)) <= 0.5, `the plate is ${m.plateWidth} wide on a ${m.width} header`); + assert.ok(m.head > 50, "the header holds the number, the date and the counts"); + }); + } + + test("what follows a release list stands at least space-3 below it, so a last change's box reaches no further than the page's gap", async () => { + for (const [name, jsx, width, touch] of [["Slate", SLATE_SITE_PAGE(), 390, true], ["Slate", SLATE_SITE_PAGE(), 1440, false], ["Harbor", harborShell(), 390, true]]) { + const page = await open(jsx, { width, height: 900, hasTouch: touch, reducedMotion: "reduce" }); + const m = await page.evaluate(`(${ENDS})("basalt-")`); + assert.ok(m.under !== null && m.under >= 12 - 0.5, `${name} at ${width}: ${m.under}`); + } + }); + + test("an opening fold moves what is under it by its panel's height alone: no margin passes through the panel", async () => { + for (const [name, jsx, width] of [["Harbor", harborShell(), 390], ["Harbor", harborShell(), 1440], ["Slate", SLATE_SITE_PAGE(), 390]]) { + const page = await open(jsx, { width, height: 900, hasTouch: width < 720, reducedMotion: "reduce" }); + const folds = await page.locator(".basalt-release .basalt-release-fold .basalt-accordion-trigger").count(); + assert.ok(folds >= 1, name); + for (let i = 0; i < folds; i++) { + const trigger = page.locator(".basalt-release .basalt-release-fold .basalt-accordion-trigger").nth(i); + const read = () => trigger.evaluate((el) => { + const release = el.closest(".basalt-release"); + const next = release.nextElementSibling; + const panel = el.closest(".basalt-accordion-item").querySelector(".basalt-accordion-panel"); + return { below: (next ?? release).getBoundingClientRect()[next ? "top" : "bottom"], panel: panel.hidden ? 0 : panel.getBoundingClientRect().height }; + }); + const closed = await read(); + await trigger.evaluate((el) => el.click()); + await settle(page); + const opened = await read(); + assert.ok(Math.abs(opened.below - closed.below - (opened.panel - closed.panel)) <= 0.5, `${name} at ${width}, fold ${i}: moved ${opened.below - closed.below} for a ${opened.panel}px panel`); + await trigger.evaluate((el) => el.click()); + await settle(page); + } + } + }); +}); + +describe("Build details", () => { + test("on the release this session runs and no other, with the app's rows, and Copy build details", async () => { + const page = await open(harborShell()); + assert.equal(await page.locator(".basalt-release-build").count(), 1); + const own = release(page, "v1.4.0"); + assert.equal(await own.locator(".basalt-release-build").count(), 1); + await own.getByRole("button", { name: "Build details" }).click(); + await settle(page); + assert.deepEqual(await own.locator(".basalt-release-build dt").evaluateAll((els) => els.map((el) => el.textContent)), ["Build", "Commit", "Basalt"]); + assert.deepEqual(await own.locator(".basalt-release-build dd").evaluateAll((els) => els.map((el) => el.textContent)), ["1.4.0+9f3c1e2", "9f3c1e2a7d04", "0.2.0"]); + assert.equal(await own.getByRole("button", { name: "Copy build details" }).count(), 1); + assert.equal(await page.getByText("Your version").count(), 1); + }); + + test("a running build between two releases: Build details stands above the first release", async () => { + const page = await open(harborShell({ running: "1.4.2", date: "2026-12-09" })); + const first = await page.locator(".basalt-release-notes").evaluate((el) => el.firstElementChild.className); + assert.equal(first, "basalt-release-build"); + assert.equal(await page.locator(".basalt-release .basalt-release-build").count(), 0); + assert.equal(await page.getByText("Your version").count(), 0); + }); +}); + +describe("widths, modes and touch", () => { + for (const width of [390, 360, 320]) { + test(`no sideways scroll at ${width}, every fold open, plain and under WCAG 1.4.12 text spacing`, async () => { + for (const jsx of [SLATE_PAGE(), harborShell()]) { + const page = await open(jsx, { width, height: 800 }); + await openAll(page); + assert.equal(await page.evaluate(() => document.documentElement.scrollWidth), width); + await page.addStyleTag({ content: "* { line-height: 1.5 !important; letter-spacing: 0.12em !important; word-spacing: 0.16em !important; } p { margin-bottom: 2em !important; }" }); + await settle(page); + assert.equal(await page.evaluate(() => document.documentElement.scrollWidth), width, "under text spacing"); + const outside = await page.evaluate((w) => [...document.querySelectorAll(".basalt-release-notes *")].filter((el) => { const r = el.getBoundingClientRect(); return r.width && (r.right > w + 0.5) && getComputedStyle(el).visibility !== "hidden" && !el.closest(".basalt-visually-hidden"); }).map((el) => el.className).slice(0, 5), width); + assert.deepEqual(outside, []); + } + }); + } + + test("forced colours: the source line and links keep their underline", async () => { + const page = await open(SLATE_PAGE(), { forcedColors: "active" }); + assert.equal(await page.locator('[id="pr41-1"] .basalt-release-id').first().evaluate((el) => getComputedStyle(el).textDecorationLine), "underline"); + assert.equal(await page.locator('[id="pr41-1"] .basalt-release-migrate').evaluate((el) => getComputedStyle(el).textDecorationLine), "underline"); + }); + + test("print: every fold is open, Copy buttons are not printed, and a source line prints as text", async () => { + const page = await open(harborShell()); + await page.emulateMedia({ media: "print" }); + await settle(page); + assert.equal(await page.locator('[id="pr131-1"]').isVisible(), true, "inside All changes"); + assert.equal(await page.locator('[id="pr143-1"]').isVisible(), true); + assert.equal(await page.locator(".basalt-release-copy").first().isVisible(), false); + assert.equal(await page.locator(".basalt-release-id").first().evaluate((el) => getComputedStyle(el).textDecorationLine), "none"); + }); + + test("without script every fold is open: the server's markup has no closed panel", async () => { + const { renderToString } = createRequire(import.meta.url)("react-dom/server"); + const React = createRequire(import.meta.url)("react"); + const B = await import(path.join(pkg, "dist", "index.js")); + const html = renderToString(React.createElement(B.ReleaseNotes, { releases: HARBOR, form: "notes", product: "Harbor", running: "1.4.0", runningBuild: RUNNING_BUILD })); + assert.doesNotMatch(html, /hidden="until-found"|hidden=""/); + assert.match(html, /id="pr131-1"/); + }); + + for (const theme of ["light", "dark"]) { + test(`axe finds nothing on either page, folds open (${theme})`, async () => { + for (const jsx of [SLATE_PAGE(), harborShell()]) { + const page = await open(jsx, { theme }); + await openAll(page); + assert.deepEqual(await axe(page), []); + assert.deepEqual(page.errors, []); + } + }); + } + + // The probe of proofs/targets.mjs: for every control of the releases, on a touch screen, the rows of its own drawn words that a tap sends to + // another control, and its height to a finger. + const probe = (page) => page.evaluate(() => { + const label = (el) => (el.getAttribute("aria-label") || el.textContent).replace(/\s+/g, " ").trim().slice(0, 48); + const owner = (x, y) => document.elementFromPoint(x, y)?.closest("a, button") ?? null; + const controls = [...document.querySelectorAll(".basalt-release a, .basalt-release button")].filter((el) => el.offsetParent && !el.closest(".basalt-popover")); + const rows = []; + for (const el of controls) { + el.scrollIntoView({ block: "center" }); + const rects = []; + const walk = document.createTreeWalker(el, NodeFilter.SHOW_TEXT); + for (let n = walk.nextNode(); n; n = walk.nextNode()) { + if (!n.data.trim() || n.parentElement.closest(".basalt-visually-hidden, [hidden]")) continue; + const range = document.createRange(); + range.selectNodeContents(n); + for (const r of range.getClientRects()) if (r.width > 1 && r.height > 1) rects.push(r); + } + if (!rects.length) continue; + let stolen = 0; + const thieves = new Set(); + for (const r of rects) for (let y = Math.ceil(r.top); y < Math.floor(r.bottom); y++) { + let lost = false; + for (let x = Math.ceil(r.left) + 1; x < Math.floor(r.right); x += 3) { const o = owner(x, y + 0.5); if (o && o !== el) { lost = true; thieves.add(label(o)); } } + if (lost) stolen++; + } + const b = el.getBoundingClientRect(); + const cx = b.x + Math.min(b.width / 2, 20); + const cy = (rects[0].top + rects[rects.length - 1].bottom) / 2; + let top = cy; + let bottom = cy; + while (top > cy - 60 && owner(cx, top - 1) === el) top--; + while (bottom < cy + 60 && owner(cx, bottom + 1) === el) bottom++; + rows.push({ control: label(el), stolen, to: [...thieves], hit: owner(cx, cy) === el ? Math.round(bottom - top) + 1 : 0 }); + } + return rows; + }); + + for (const width of [390, 360, 820]) { + test(`on touch at ${width}: no control receives a tap on another's words, and every control is at least 44 tall to a finger`, async () => { + for (const jsx of [SLATE_PAGE(), harborShell()]) { + const page = await open(jsx, { width, height: 844, hasTouch: true }); + await openAll(page); + const rows = await probe(page); + assert.ok(rows.length > 10); + assert.deepEqual(rows.filter((row) => row.stolen > 0), []); + assert.deepEqual(rows.filter((row) => row.hit < 44).map((row) => `${row.control}: ${row.hit}`), []); + } + }); + } + + test("on touch at 390: a tap on the bottom edge of How to migrate reaches the link and not Sources", async () => { + const page = await open(SLATE_PAGE(), { width: 390, height: 844, hasTouch: true }); + const link = page.locator('[id="pr41-1"] .basalt-release-migrate'); + await link.scrollIntoViewIfNeeded(); + const words = await link.locator(".basalt-link-label").evaluate((el) => { const r = el.getBoundingClientRect(); return { x: r.left + r.width / 2, y: r.bottom - 1 }; }); + const hit = await page.evaluate(({ x, y }) => document.elementFromPoint(x, y)?.closest("a, button")?.className, words); + assert.match(hit, /basalt-release-migrate/); + }); +}); diff --git a/packages/react/test/version-link.test.mjs b/packages/react/test/version-link.test.mjs new file mode 100644 index 00000000..6acf4c50 --- /dev/null +++ b/packages/react/test/version-link.test.mjs @@ -0,0 +1,237 @@ +// The version at the sidebar's foot (DECISIONS 320, 1.2): VersionLink, AppShell's `version`, More's last row and the site footer. Driven in +// Chromium against the built package with the real stylesheet. The product, its versions and dates are made up (Harbor). +import assert from "node:assert/strict"; +import fs from "node:fs"; +import { createRequire } from "node:module"; +import { after, before, describe, test } from "node:test"; + +import { HARBOR, RUNNING_BUILD, harborShell } from "./release-fixture.mjs"; +import { fixturePage, launch, settle } from "./support.mjs"; + +const axeSource = fs.readFileSync(createRequire(import.meta.url).resolve("axe-core/axe.min.js"), "utf8"); +let browser; +before(async () => { browser = await launch(); }); +after(async () => { await browser?.close(); }); + +const DATA = `const HARBOR = ${JSON.stringify(HARBOR)}; const RUNNING_BUILD = ${JSON.stringify(RUNNING_BUILD)};`; +const app = (jsx) => `${DATA} document.body.style.margin = "0"; document.body.style.background = "var(--basalt-surface-page)"; +function App() { ${jsx} } +createRoot(document.getElementById("root")).render(<App />);`; +const open = async (jsx, { theme = "light", width = 1440, height = 900, ...options } = {}) => { + const { page, errors } = await fixturePage(browser, app(jsx), { theme, viewport: { width, height }, standards: true, ...options }); + await settle(page); + page.errors = errors; + return page; +}; +const box = (locator) => locator.evaluate((el) => { const r = el.getBoundingClientRect(); return { x: r.x, y: r.y, width: r.width, height: r.height, right: r.right, bottom: r.bottom }; }); +/** How tall a control is to a tap: the run of points down its middle that land on it. */ +const hitHeight = (locator) => locator.evaluate((el) => { + const r = el.getBoundingClientRect(); + const x = r.left + Math.min(r.width / 2, 20); + const cy = r.top + r.height / 2; + const mine = (y) => document.elementFromPoint(x, y)?.closest("a, button") === el; + let top = cy; + let bottom = cy; + while (top > cy - 60 && mine(top - 1)) top--; + while (bottom < cy + 60 && mine(bottom + 1)) bottom++; + return Math.round(bottom - top) + 1; +}); +const axe = async (page) => { + await page.evaluate(() => { document.title = "Basalt"; document.documentElement.lang = "en"; }); + await page.addScriptTag({ content: axeSource }); + return page.evaluate(async () => { + const options = { runOnly: { type: "tag", values: ["wcag2a", "wcag2aa", "wcag21a", "wcag21aa", "wcag22aa"] }, resultTypes: ["violations"] }; + const result = await globalThis.axe.run({ exclude: [["[data-base-ui-focus-guard]"]] }, options); + return result.violations.map((v) => `${v.id}: ${v.nodes.map((n) => n.target.join(" ")).join(" | ")}`); + }); +}; +/** The shell with the version at its foot. */ +const FOOT = (version = "1.4.0") => harborShell({ running: version }); +/** The words a link draws: its text less what is hidden, and the dot where both parts share a line (the dot is drawn, never text). */ +const drawn = (locator) => locator.evaluate((el) => { + const shown = (part) => { + if (!part) return ""; + const out = []; + const walk = document.createTreeWalker(part, NodeFilter.SHOW_TEXT); + for (let n = walk.nextNode(); n; n = walk.nextNode()) { + let hidden = false; + for (let up = n.parentElement; up && up !== el; up = up.parentElement) if (up.getBoundingClientRect().width <= 1) hidden = true; + if (hidden) continue; + const range = document.createRange(); + range.selectNodeContents(n); + if ([...range.getClientRects()].some((r) => r.width > 1)) out.push(n.data); + } + return out.join("").replace(/\s+/g, " ").trim(); + }; + const words = shown(el.querySelector(".basalt-version-link-words")); + const dateEl = el.querySelector(".basalt-version-link-date"); + const date = shown(dateEl); + if (!date) return words; + const sameLine = Math.abs(dateEl.getBoundingClientRect().top - el.querySelector(".basalt-version-link-words").getBoundingClientRect().top) < 2; + return `${words}${sameLine ? " · " : " "}${date}`; +}); + +describe("the link", () => { + test("its name is the visible words in order, then where it goes; the date is a calendar date, never moved by a time zone", async () => { + const page = await open(FOOT(), { timezoneId: "Pacific/Honolulu" }); + const link = page.getByRole("link", { name: "Version 1.4.0, Nov 23, 2026, release notes", exact: true }); + assert.equal(await link.count(), 1); + assert.equal(await link.getAttribute("href"), "#v1.4.0"); + assert.equal(await drawn(link), "Version 1.4.0 · Nov 23, 2026"); + assert.equal(await page.locator(".basalt-app-sidebar time").getAttribute("datetime"), "2026-11-23"); + const style = await link.first().evaluate((el) => { const s = getComputedStyle(el); return { size: s.fontSize, line: s.lineHeight, family: s.fontFamily, numeric: s.fontVariantNumeric }; }); + assert.deepEqual([style.size, style.line, style.numeric], ["12px", "16px", "tabular-nums"]); + assert.doesNotMatch(style.family, /mono/i, "Geist, not mono"); + }); + + test("it fits the foot's 195px on one line; the room is the sidebar less its edge and the nav glyphs' inset each side", async () => { + const page = await open(FOOT()); + const link = page.locator(".basalt-app-sidebar .basalt-version-link"); + const room = await page.locator(".basalt-app-version").evaluate((el) => el.getBoundingClientRect().width); + assert.ok(room >= 194 && room <= 196, `room ${room}`); + const words = await box(page.locator(".basalt-version-link-words")); + const date = await box(page.locator(".basalt-version-link-date")); + assert.equal(Math.round(words.y), Math.round(date.y), "one line"); + assert.equal(Math.round((await box(link)).x), Math.round((await box(page.locator(".basalt-app-version"))).x)); + }); + + test("a canary that does not fit: the date goes under the number, with no leading dot, and nothing is wider than the foot", async () => { + const page = await open(FOOT("1.5.0-canary.20261123.1")); + const link = await box(page.locator(".basalt-app-sidebar .basalt-version-link")); + const words = await box(page.locator(".basalt-app-sidebar .basalt-version-link-words")); + const date = await box(page.locator(".basalt-app-sidebar .basalt-version-link-date")); + assert.ok(date.y >= words.bottom - 1, "the date is on a line of its own, under the number"); + assert.equal(Math.round(date.x), Math.round(link.x), "it starts the line"); + // The dot stands in the gap before the date: left of the link's own box, which clips it. + const dot = await page.locator(".basalt-app-sidebar .basalt-version-link-date").evaluate((el) => { + const s = getComputedStyle(el, "::before"); + return { right: el.getBoundingClientRect().left, clip: getComputedStyle(el.closest("a")).overflowX, content: s.content }; + }); + assert.equal(dot.clip, "clip"); + assert.ok(dot.right <= link.x + 0.5, "the dot is outside the link's box"); + assert.ok(link.width <= 195.5, `the link is ${link.width} wide`); + // On one line, the dot is drawn between the parts. + const page2 = await open(FOOT()); + const one = await page2.locator(".basalt-app-sidebar .basalt-version-link-date").evaluate((el) => el.getBoundingClientRect().left - el.closest("a").getBoundingClientRect().left); + assert.ok(one > 12, "the date follows the number, with the dot in the gap"); + }); + + test("on the release notes it is the current page: aria-current, primary ink, the number at 600, and no change of width", async () => { + const page = await open(`return <div style={{ display: "grid", justifyItems: "start", gap: 8, padding: 16 }}><B.VersionLink data-testid="rest" version="1.4.0" date="2026-11-23" href="#v1.4.0" /><B.VersionLink data-testid="current" current version="1.4.0" date="2026-11-23" href="#v1.4.0" /></div>;`); + const rest = page.getByTestId("rest"); + const current = page.getByTestId("current"); + assert.equal(await current.getAttribute("aria-current"), "page"); + assert.equal(await rest.getAttribute("aria-current"), null); + assert.equal((await box(rest)).width, (await box(current)).width); + const weight = (locator) => locator.locator(".basalt-version-link-number").evaluate((el) => getComputedStyle(el).fontWeight); + assert.equal(await weight(current), "600"); + assert.equal(await weight(rest), "400"); + const ink = (locator) => locator.evaluate((el) => getComputedStyle(el).color); + const primary = await page.evaluate(() => { const i = document.createElement("i"); i.style.color = "var(--basalt-text-primary)"; document.body.append(i); const c = getComputedStyle(i).color; i.remove(); return c; }); + assert.equal(await ink(current), primary); + assert.notEqual(await ink(rest), primary); + await rest.hover(); + await settle(page); + assert.equal(await ink(rest), primary, "hover lifts it to primary"); + assert.equal(await rest.locator(".basalt-version-link-words").evaluate((el) => getComputedStyle(el).textDecorationLine), "underline"); + }); + + test("24 tall on a fine pointer, and a 44px hit box on touch that moves nothing", async () => { + const fine = await open(FOOT()); + const at = (page) => page.locator(".basalt-app-sidebar .basalt-version-link"); + assert.equal((await box(at(fine))).height, 24); + assert.equal(await hitHeight(at(fine)), 24); + const touch = await open(FOOT(), { hasTouch: true }); + assert.equal((await box(at(touch))).height, 24); + assert.ok(await hitHeight(at(touch)) >= 44); + }); +}); + +describe("its places", () => { + test("at the sidebar's foot: under the account items, space-2 below them, the words on the nav glyphs' start edge", async () => { + const page = await open(harborShell()); + const link = page.locator(".basalt-app-sidebar .basalt-version-link"); + const glyph = await box(page.locator(".basalt-app-account .basalt-nav-item .basalt-icon").first()); + const account = await box(page.locator(".basalt-app-account .basalt-nav")); + const own = await box(link); + assert.equal(Math.round(own.x), Math.round(glyph.x), "on the glyphs' start edge"); + assert.equal(Math.round(own.y - account.bottom), 8, "space-2 under the account items"); + assert.equal(await link.getAttribute("aria-current"), "page"); + // There is no "What's new" item, and nothing marks a release as new. + assert.equal(await page.getByText(/what's new/i).count(), 0); + assert.equal(await page.locator(".basalt-nav-dot, .basalt-tabbar-dot").count(), 0); + }); + + test("in the rail: the number alone, centred, the label and the date in its name and its tooltip", async () => { + const page = await open(harborShell(), { width: 820 }); + const link = page.locator(".basalt-app-sidebar .basalt-version-link"); + assert.equal(await drawn(link), "1.4.0"); + assert.equal(await page.getByRole("link", { name: "Version 1.4.0, Nov 23, 2026, release notes" }).count(), 1); + const rail = await box(page.locator(".basalt-app-sidebar")); + const number = await box(link.locator(".basalt-version-link-number")); + assert.ok(Math.abs((number.x + number.width / 2) - (rail.x + rail.width / 2)) <= 1.5, "centred in the rail"); + // The rail's tooltip loads on demand: until it is there the number stands alone, so a pointer that arrived first moves off and back. + const tip = page.getByRole("tooltip"); + for (let attempt = 0; attempt < 10 && !(await tip.count()); attempt++) { + await page.mouse.move(400, 400); + await link.hover(); + await page.waitForTimeout(300); + } + await tip.waitFor(); + // The tooltip says the whole line: the dot is DotSep's, drawn as a dot and read as a comma. + assert.equal(await tip.evaluate((el) => [...(el.querySelector(":scope > span") ?? el).childNodes].map((n) => (n.nodeType === 3 ? n.data : n.classList?.contains("basalt-dot-sep") ? " · " : n.textContent)).join("").replace(/\s+/g, " ").trim()), "Version 1.4.0 · Nov 23, 2026"); + }); + + test("in the rail a release candidate breaks before its hyphen, and nothing is wider than the rail", async () => { + const page = await open(harborShell({ running: "2.0.0-rc.2", date: "2026-12-03" }), { width: 820 }); + const link = page.locator(".basalt-app-sidebar .basalt-version-link"); + const lines = await link.locator(".basalt-version-link-number > span").evaluate((el) => [...el.getClientRects()].length > 1 || el.getBoundingClientRect().height > 20); + assert.ok(lines, "two lines"); + const pre = await box(link.locator(".basalt-version-link-pre")); + const rail = await box(page.locator(".basalt-app-sidebar")); + assert.ok(pre.right <= rail.right, "inside the rail"); + assert.equal(await link.locator(".basalt-version-link-pre").evaluate((el) => el.textContent), "-rc.2"); + }); + + test("on a phone: the last row of More's sheet, under a divider, 44 tall, at 13/18, on the nav glyphs' edge", async () => { + const page = await open(harborShell(), { width: 390, height: 844 }); + await page.getByRole("button", { name: "More, Release notes, current page" }).click(); + await settle(page); + const row = page.locator(".basalt-tabbar-version"); + await row.waitFor(); + const link = row.locator(".basalt-version-link"); + assert.equal(await drawn(link), "Version 1.4.0 · Nov 23, 2026"); + const style = await row.evaluate((el) => ({ height: el.getBoundingClientRect().height, border: getComputedStyle(el).borderTopWidth, last: el === el.parentElement.lastElementChild || !el.nextElementSibling })); + assert.ok(style.height >= 44); + assert.equal(style.border, "1px"); + assert.ok(style.last, "the last row"); + assert.deepEqual(await link.evaluate((el) => [getComputedStyle(el).fontSize, getComputedStyle(el).lineHeight]), ["13px", "18px"]); + const glyph = await box(page.locator(".basalt-tabbar-sheet .basalt-nav-item .basalt-icon").first()); + assert.equal(Math.round((await box(link)).x), Math.round(glyph.x)); + }); + + test("in a site's footer: after the legal line, on its row, at its 13/18, labelled with the product", async () => { + const page = await open(`return <B.SitePage><main style={{ height: 200 }} /><B.SiteFooter legal="© 2026 Example" version={<B.VersionLink label="Slate" version="0.2.1" date="2026-11-16" href="/changelog#v0.2.1" />} /></B.SitePage>;`); + const link = page.getByRole("link", { name: "Slate 0.2.1, Nov 16, 2026, release notes" }); + assert.equal(await link.count(), 1); + const legal = await box(page.locator(".basalt-site-footer-legal")); + const own = await box(link); + assert.ok(own.x > legal.right, "after the legal line"); + assert.ok(Math.abs(own.y + own.height / 2 - (legal.y + legal.height / 2)) < 6, "on its row"); + assert.deepEqual(await link.evaluate((el) => [getComputedStyle(el).fontSize, getComputedStyle(el).lineHeight]), ["13px", "18px"]); + }); + + for (const theme of ["light", "dark"]) { + test(`axe finds nothing at the foot, in the rail and in More (${theme})`, async () => { + for (const width of [1440, 820]) { + const page = await open(harborShell(), { theme, width }); + assert.deepEqual(await axe(page), [], `${width}`); + assert.deepEqual(page.errors, []); + } + const phone = await open(harborShell(), { theme, width: 390, height: 844 }); + await phone.getByRole("button", { name: /^More/ }).click(); + await settle(phone); + assert.deepEqual(await axe(phone), []); + }); + } +}); diff --git a/packages/tokens/test/contrast.test.mjs b/packages/tokens/test/contrast.test.mjs index 75f0ddf3..9e6e5ed6 100644 --- a/packages/tokens/test/contrast.test.mjs +++ b/packages/tokens/test/contrast.test.mjs @@ -1042,6 +1042,25 @@ for (const theme of THEMES) { }); } +// ---- Versions and release notes (DECISIONS 320, 2.8 and 2.10) ---- +// +// The release page's new pairs. The arrival's plate is plate-0 on the page and plate-1 inside a callout (an action entry); on it the source line and a count +// are secondary, since tertiary steps up on the plate (it measures under 4.5:1 on light's plate-0, which is why the step is the rule). The source line and the +// meta line are secondary on the page and on the warning callout's neutral fill at level 1; a section's count is tertiary on the page. +for (const theme of THEMES) { + test(`${theme}: the release page's pairs: secondary on plate-0 and plate-1, on the page and on a callout; a count in tertiary on the page`, () => { + for (const surface of ["plate-0", "plate-1", "surface-page", "surface-1"]) { + const bg = color(theme, surface); + const r = ratio(over(color(theme, "text-secondary"), bg), bg); + assert.ok(r >= 4.5, `${theme}: text-secondary on ${surface} is ${fmt(r)}:1`); + } + const page = color(theme, "surface-page"); + assert.ok(ratio(over(color(theme, "text-tertiary"), page), page) >= 4.5, `${theme}: a count (tertiary) on the page`); + // The plate's step from tertiary to secondary is needed: in light, tertiary on plate-0 is under 4.5:1. + if (theme === "light") assert.ok(ratio(color(theme, "text-tertiary"), color(theme, "plate-0")) < 4.5, "light: tertiary on plate-0 needs the step to secondary"); + }); +} + // ---- Stages and runs (DECISIONS 316, 2.2): the tail's first step, a failed row's 0.88, the queued breath and the connector; the four deeper steps // are the one named exception (foundations, Principles) and are read by nothing but a run timeline's tail ---- diff --git a/scripts/test-all.mjs b/scripts/test-all.mjs index 0f21b45e..8442020c 100644 --- a/scripts/test-all.mjs +++ b/scripts/test-all.mjs @@ -8,6 +8,7 @@ export const SUITES = [ { label: "html skill", command: "npm run test:html-skill" }, { label: "brand", command: "npm run test:brand" }, { label: "sites", command: "npm run test:sites" }, + { label: "changelog tool", command: "npm run test:changelog" }, ]; if (isMain(import.meta.url)) await runSteps(SUITES, { title: "npm test" }); diff --git a/tools/changelog/README.md b/tools/changelog/README.md new file mode 100644 index 00000000..770e3039 --- /dev/null +++ b/tools/changelog/README.md @@ -0,0 +1,151 @@ +# The changelog tool + +Versions, changelogs and release notes for Basalt and for each of the owner's products (DECISIONS 320). One small file per change, written in +the pull request that makes it, frozen into a record when a release is cut, and generated into every output: `CHANGELOG.md`, the page's data +(the `ReleaseRecord[]` that `ReleaseNotes` takes), a GitHub Release's body and a page for the HTML skill. Node only, with no dependency. + +The words follow `.agent/skills/release-words/SKILL.md`. The page's parts are `VersionLink`, `ReleaseNotes` and `ReleaseIndex` in +`@srasyndicate/basalt`, and the `release` module in the HTML skill. + +Nothing here publishes a version of Basalt. Basalt's first release is the owner's to cut (DECISIONS 320, backlog 1); until then the repository +has no `changelog.config.json`, no `.changes` and no records. `fixtures/` holds two made-up projects, Slate (a package) and Harbor (a product). + +## Versions + +SemVer 2.0.0, shown with the ship date: `1.4.0 · Nov 23, 2026` on a page, `## 1.4.0 - 2026-11-23` in Markdown, `v1.4.0` as a tag and +`#v1.4.0` as a release's address. Build metadata (`1.4.0+9f3c1e2`) is never part of a release's version; the running build is the app's to +show (Build details). + +| Bump | A package | A product | +|---|---|---| +| Major | Removing or renaming a token, component, prop, CSS variable or documented data attribute; changing a token's `$type` or a prop's type; making an optional prop required; raising the minimum React, Node or browser; changing a default that alters behavior | It takes away or reshapes something people rely on, or they must act for it to keep working | +| Minor | New tokens, components, props or variants; deprecations; a token's value changing while its role holds | Something a person can newly do; a dated notice that something will go | +| Patch | Fixes; accessibility fixes that restore documented behavior; docs and types that were wrong | Fixes and improvements to what exists | + +**In 0.x the numbers move one place right:** a breaking change raises the minor, and everything else raises the patch. A caret range +(`^0.2.0`) then takes additions and fixes and never a break. Basalt stays in 0.x until its public API is written down; 1.0.0 is the owner's +call. The two packages share one version number. + +**A line** is the versions that share their breaking number: the major, or in 0.x the minor. A new version must be higher than every release +in its line; one that opens a line must be higher than every release there is. A fix to a maintained older line (1.4.1 after 2.0.0) is frozen +on that line's branch (`release/1.x`) and its record is then added to the default branch by a pull request, because the page is built there. + +**Pre-releases** are `-beta.N` and `-rc.N`, each frozen with its own record holding what no earlier pre-release of that version holds. Freezing +one removes nothing. The stable version takes every pending file, names the pre-releases it `replaces`, and from then they are drawn in no +output and their addresses open the stable release. A canary (`1.5.0-canary.20261123.1`) is a build from the default branch with no freeze +and no record. + +## An entry + +One file per change, `.changes/<id>.md`, added by the pull request that makes the change: + +```md +--- +type: changed +area: FormGrid +pr: 120 +author: bailey +tickets: [ENG-398, PROJ-88] +bump: major +action: true +migration: docs/migrating.md#formgrid-frame +--- +Changed the parent layout item for `FormGrid` to `.basalt-form-grid-frame`, where existing sizing rules must move +``` + +- **The id** is the file's name, set once and never changed or reused: `pr120-1` (the pull request and the entry's number in it), or any + `a-z0-9-` slug for a change with no pull request. `pr120-1.md` must say `pr: 120`, and an entry that says `pr: 120` is named `pr120-N.md`. + `unreleased` and anything starting `v` and a digit are reserved for releases, and `main` and anything starting `bh-` for the page's own elements (the main landmark, and the ids the HTML skill's scripts make). A backport is its own pull request and its own entry. A pending file whose id a + shipped release holds stops the build (a candidate's pending files are kept on purpose until its stable version ships). The parts' own + element ids end `__words`, `__heading` and the like, outside the ids' alphabet, so an entry named `fix-words` never meets one. +- **The head** is `key: value` lines between two `---`. It is not YAML. An unknown key, a key written twice or a line that is not `key: value` + stops the tool, naming the file and the line. + +| Key | Value | +|---|---| +| `type` | `security`, `deprecated`, `removed`, `added`, `changed` or `fixed`. Required | +| `area` | The component, `Tokens`, or a product's page (`Home`), drawn before the sentence. On every entry when a project has more than one surface | +| `pr` | The pull request's number | +| `author` | A key of the config's `people`: the person who wrote the entry's words, or who has said they take authorship of them. Optional. Never who asked for the change, approved it or merged it | +| `tickets` | A list in square brackets, in the order written. **The only place a ticket id is read from**: never a pull request's body, a commit's trailer, a branch name, a title or a sentence | +| `bump` | `major`, `minor` or `patch`. Required for `changed`; otherwise only to raise the type's floor, never to lower it | +| `action` | `true` when a reader must do something: it stands under "Action needed". It raises no number. A `major` entry is always `action` | +| `migration` | The migration note: a file in the repository (opened at the release's tag), a path from the site's root, or an `https` address. Drawn as "How to migrate" | + +Each type's least bump: Removed is major; Added and Deprecated are minor; Fixed and Security are patch; Changed states its own. + +**Release notes** are one more file, `.changes/release.md`, when a release has them: a head with `title` and `summary`, then a paragraph for +everyone with no heading and a `## For admins` heading for each audience, each paragraph opening with a `covers:` line naming the entries it +is about. A paragraph that covers none, names an entry the release does not hold, holds a second `covers` line or runs to a second paragraph +stops the tool, naming the line. + +```md +--- +title: A monitor can open an incident room +summary: Monitors can open incident rooms through a webhook, and Home marks the incidents they open. +--- +covers: [pr131-1] +A monitor that can send a webhook can now open an incident room when its alarm fires. + +## For admins +covers: [pr131-1] +In Settings, open Integrations and add a webhook. Paste its address into your monitor. +``` + +A release with no entries must have a summary, and so must one of more than three changes, unless paragraphs lead it. + +## The config + +`changelog.config.json`, at the repository's root: + +```json +{ + "product": "Basalt", + "repository": "https://github.com/example/basalt", + "trackers": [ + { "name": "Linear", "pattern": "(?:ENG|DES)-[1-9][0-9]*", "url": "https://linear.app/example/issue/{id}" }, + { "name": "Jira", "pattern": "PROJ-[1-9][0-9]*", "url": "https://example.atlassian.net/browse/{id}", "show": "text" }, + { "name": "GitHub", "pattern": "basalt#(?<n>[1-9][0-9]*)", "url": "https://github.com/example/basalt/issues/{n}", "label": "issue #{n}" } + ], + "people": { "bailey": { "name": "Bailey Jones" } } +} +``` + +`form` is optional: `"reference"` (the default, a package's changelog) or `"notes"` (a product's release notes). It decides how `CHANGELOG.md` and a +GitHub Release are written: a package's opens Action needed with "Before upgrading from 0.1.0, check these 4 changes." and groups a GitHub Release's +sections under "Changes"; a product's puts Action needed first with no upgrade line, then its headline as a heading over its paragraphs, then the +fold's heading ("All changes", or "Other changes") over the summary and the sections, so every paragraph sits under a heading of its own. + +- `name` is the word shown, and is unique. `pattern` is matched against the whole id: write it without `^` and `$`, name team keys and never + a catch-all, and write a number as `[1-9][0-9]*`. +- `url` and `label` may use `{id}` and the pattern's named groups; any other variable is refused, and so is an id whose match leaves a used group + unset (a pattern with alternatives). Each value is percent-encoded into the URL, + which must be `https` with no variable in its host. +- `show` is `link` (the default), `text` (shown, not linked) or `none` (recorded, never published). +- A GitHub issue is written `repo#45`, never `#45`, which is a pull request. +- Whether a ticket exists in its tracker is not checked here; a project may check it in CI. + +## Commands + +| Command | What it does | +|---|---| +| `node tools/changelog/release.mjs <version> --date <YYYY-MM-DD>` | Freezes a release on the branch it is cut from. Checks every pending file, the version against its line and the highest bump among the entries, and each entry's commit (the first-parent commit that added its file; a shallow clone is refused). Builds every output in memory, then writes `changelog/releases/<version>.json` once (with the repository, so a later config cannot re-point its comparison) and `CHANGELOG.md`, and only then, for a stable version, removes the pending files and `release.md`. A freeze that stops consumes nothing; one that stopped after its record was written, even partway through removing the pending files, is finished by running it again. One freeze runs at a time in a checkout: a second is refused while the first holds its lock (a file in the git directory; one left by a stopped freeze is taken over) | +| `node tools/changelog/build.mjs` | Regenerates `CHANGELOG.md` from the records and the pending files (the Unreleased section is what no pre-release holds) | +| `node tools/changelog/build.mjs --json <file>` | Writes the page's data | +| `node tools/changelog/build.mjs --github <version>` | Prints a GitHub Release's body | +| `node tools/changelog/build.mjs --check` | Fails when `CHANGELOG.md` is not what the records give, a tagged record differs from its tag's copy, or a release this branch has published is gone: one whose tag is in its history, or one whose record its history added (a maintained line's, brought over by a pull request) | +| `node tools/changelog/audit.mjs` | Runs the lines of the release-words audit marked (m). It flags and a person decides. For R18 it flags a sentence of a headline, summary or paragraph when most of what it names is in none of the entries it covers (an instruction, "In Settings, open …", is not a claim) | +| `node tools/changelog/fixtures/make.mjs` | Rebuilds the two made-up fixtures by running the tool over their histories | +| `node tools/changelog/skill-body.mjs --form <reference\|notes>` | Writes a body for the HTML skill's `release` module from the records | + +Every option takes `--root <repository>`; the default is the working directory. Every output is generated from the records and the pending +files and nothing else: a rebuild needs no git and no network, and a later config change cannot re-point a frozen release. + +## Why not changesets + +The owner's standard names changesets (S 4.1). The idea it wants from them is kept: one small file per change, written in the pull request, +generated into every output. The format is not. A changeset's head maps package names to a bump (`"@scope/pkg": minor`); its generated +`CHANGELOG.md` is headed by bump (`### Major Changes`, `### Minor Changes`, `### Patch Changes`), not by type. The GitHub changelog formatter +(`@changesets/changelog-github`) accepts overrides for `pr`, `commit` and `author` under a `_:` key, but there is no field for a type, tickets, +`action` or a permanent id, and an author there is a GitHub login. Checked against `docs/guide/writing-changesets.md` and +`packages/apply-release-plan/src/get-changelog-entry.ts` in `changesets/changesets` on Nov 23, 2026. diff --git a/tools/changelog/audit.mjs b/tools/changelog/audit.mjs new file mode 100644 index 00000000..5da0ff16 --- /dev/null +++ b/tools/changelog/audit.mjs @@ -0,0 +1,194 @@ +// The audit's marked lines (DECISIONS 320, 4; `.agent/skills/release-words/SKILL.md`, "The audit"): node tools/changelog/audit.mjs [--root <repository>] +// It flags, and a person decides: the check showed that neither accepting nor dismissing every flag is right. Each flag is a rule id, the +// quoted line and what is wrong. The lines the skill does not mark are read by a person. +import fs from "node:fs"; +import path from "node:path"; + +import { taggedDifferences } from "./build.mjs"; +import { loadConfig } from "./config.mjs"; +import { CHANGES_DIR, FLOOR, NOTES_FILE, readEntry, readNotes, TYPES } from "./entries.mjs"; +import { changelogMarkdown } from "./outputs.mjs"; +import { pageReleases, readRecords } from "./records.mjs"; +import { atLeast, carries, higher, must } from "./semver.mjs"; + +export const VERBS = ["Added", "Changed", "Improved", "Deprecated", "Removed", "Fixed", "Reverted"]; +export const MAX_WORDS = 30; + +// R9: stock phrases that say nothing a reader can check. +const STOCK = [/\bbug fixes\b/i, /\bperformance improvements\b/i, /\bvarious (?:fixes|improvements)\b/i, /\bminor (?:fixes|improvements)\b/i, /\bgeneral improvements\b/i, /\bstability improvements\b/i]; +// R10: marketing words. +const BANNED = ["seamless", "seamlessly", "powerful", "robust", "effortless", "effortlessly", "blazing", "revolutionary", "game-changing", "cutting-edge", "best-in-class", "world-class", "delightful", "beautiful", "stunning", "magical", "supercharge", "supercharged"]; +// R15: British spellings, in prose (an identifier is spelled as it is exported). +const BRITISH = /\b(?:(?:multi-?)?colour(?:s|ed|ing|ful)?|centre(?:s|d)?|behaviour(?:s|al)?|cancell(?:ed|ing)|favour(?:s|ed|ite|ites)?|honour(?:s|ed)?|neighbour(?:s|ing)?|labour|organis(?:e|ed|es|ing|ation)|recognis(?:e|ed|es|ing)|optimis(?:e|ed|es|ing|ation)|customis(?:e|ed|es|ing|ation)|initialis(?:e|ed|es|ing|ation)|normalis(?:e|ed|es|ing|ation)|serialis(?:e|ed|es|ing|ation)|summaris(?:e|ed|es|ing)|licence|catalogue|dialogue|analys(?:e|ed|es|ing)|grey|programme|travell(?:ed|ing)|modell(?:ed|ing)|labell(?:ed|ing)|fulfil)\b/i; +const FUTURE = /\b(?:will|shall|going to|won't)\b/i; + +/** The sentence's prose: code spans taken out, since an identifier is written as it is exported. */ +const prose = (text) => text.replace(/`[^`]*`/g, "`code`"); + +/** + * Flags for one entry's words and fields. `config` gives the trackers and the people, so an id or a name in the words is caught. + * Each flag is `{ rule, message }`. + */ +export function auditEntry(entry, config) { + const flags = []; + const flag = (rule, message) => flags.push({ rule, message }); + const text = entry.text; + const words = prose(text); + + const [first] = text.split(/\s+/); + if (!VERBS.includes(first)) flag("R1", `starts with "${first}", not a verb of R1 (${VERBS.join(", ")})`); + const count = text.trim().split(/\s+/).length; + if (count > MAX_WORDS) flag("R3", `${count} words; at most ${MAX_WORDS}`); + if (/[.]$/.test(text.trim())) flag("R3", "ends with a period"); + for (const pattern of STOCK) if (pattern.test(words)) flag("R9", `a stock phrase ("${words.match(pattern)[0]}")`); + for (const word of BANNED) if (new RegExp(`\\b${word}\\b`, "i").test(words)) flag("R10", `a marketing word ("${word}")`); + if (words.includes("!")) flag("R10", "an exclamation mark"); + if (words.includes("—")) flag("R15", "an em dash"); + if (words.includes(";")) flag("R15", "a semicolon"); + if (/\p{Extended_Pictographic}/u.test(words)) flag("R15", "an emoji"); + const british = words.match(BRITISH); + if (british) flag("R15", `a British spelling ("${british[0]}")`); + // A dated removal is the one place for the future tense: a deprecation or removal that names a year. + const datedRemoval = ["deprecated", "removed"].includes(entry.type) && /\b20[0-9]{2}\b/.test(text); + if (FUTURE.test(words) && !datedRemoval) flag("R11", `the future tense ("${words.match(FUTURE)[0]}") outside a dated removal`); + if (/(?:^|[^\w`])#[0-9]+\b/.test(text) || /\b(?:PR|pull request)\s*#?[0-9]+\b/i.test(text)) flag("R14", "a pull request number in the words"); + for (const tracker of config?.trackers ?? []) { + const anywhere = new RegExp(`(?<![\\w#-])(?:${tracker.pattern})(?![\\w-])`, "u"); + const hit = text.match(anywhere); + if (hit) flag("R14", `a ${tracker.name} ticket id ("${hit[0]}") in the words`); + } + for (const person of Object.values(config?.people ?? {})) { + if (new RegExp(`\\b${person.name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\b`).test(words)) flag("R14", `a person's name ("${person.name}") in the words`); + } + // Version: the bump a type needs, and the one link from the bump to action. + const floor = FLOOR[entry.type]; + if (!entry.bump) flag("Version", "a changed entry states its bump"); + else if (floor && !atLeast(entry.bump, floor)) flag("Version", `a ${entry.type} entry needs at least a ${floor}`); + if (entry.bump === "major" && !entry.action) flag("Version", "a major entry is action"); + return flags; +} + +// R18: nothing in a headline, a summary or a paragraph that the list does not hold. Whether a sentence's claim is in an entry is a reader's call, so +// the audit flags a sentence for a person when most of what it names appears in none of the entries it covers (their words and areas). An +// instruction ("In Settings, open Integrations", "Paste its address") tells a reader where to find what an entry says, and is not a claim. +const STOP = new Set("about above across after again already also another because been before being below between both cannot could does doing down during each every from have having here into itself just more most much must never only other over same should since some such than that their them then there these they this those through under until upon very were what when where which while will with within without would your yours first".split(" ")); +const INSTRUCTION = /^(?:(?:in|on|from|under)\s+[^,]+,\s*)?(?:open|add|paste|choose|select|press|go|click|tap|type|name|set|turn|run|check|use|find|connect|read|copy|see|remove|move|pass|replace)\b/i; +/** A word's plain forms, so "codes", "coded" and "coding" meet "code", and "fixes" meets "fixed". */ +const forms = (word) => { + const bare = word.replace(/'s?$/, ""); + const out = new Set([bare]); + for (const end of ["ing", "ed", "es", "s", "d"]) if (bare.endsWith(end) && bare.length - end.length >= 3) { const root = bare.slice(0, -end.length); out.add(root); out.add(`${root}e`); } + return [...out]; +}; +const words = (text) => text.toLowerCase().replace(/`[^`]*`/g, " ").split(/[^a-z']+/).filter((word) => word.length >= 4 && !STOP.has(word)); + +/** Sentences of a headline, summary or paragraph that name mostly what the entries they cover do not. Each is `{ sentence, unknown }`. */ +export function unsupported(text, entries, { product } = {}) { + if (!entries.length) return []; + const known = new Set([...entries.flatMap((entry) => words(`${entry.area ?? ""} ${entry.text}`)), ...words(product ?? "")].flatMap(forms)); + const out = []; + for (const sentence of text.split(/(?<=[.!?])\s+/).map((part) => part.trim()).filter(Boolean)) { + if (INSTRUCTION.test(sentence)) continue; + const named = words(sentence); + const unknown = [...new Set(named.filter((word) => !forms(word).some((form) => known.has(form))))]; + if (unknown.length >= 2 && unknown.length * 2 >= new Set(named).size) out.push({ sentence, unknown }); + } + return out; +} + +/** R18 flags for a release's words: its headline and summary against every entry, each paragraph against the entries it covers. */ +export function auditNotes(release, { product } = {}) { + const flags = []; + const byId = new Map(release.entries.map((entry) => [entry.id, entry])); + const check = (text, entries, what) => { + for (const { sentence, unknown } of unsupported(text, entries, { product })) flags.push({ rule: "R18", line: sentence, message: `${what}: ${unknown.join(", ")} ${unknown.length === 1 ? "is" : "are"} in no entry it covers; give it an entry or take it out` }); + }; + if (release.title) check(release.title, release.entries, "the headline"); + if (release.summary) check(release.summary, release.entries, "the summary"); + for (const audience of release.audiences ?? []) check(audience.text, audience.covers.map((id) => byId.get(id)).filter(Boolean), audience.for ? `"${audience.for}"` : "the paragraph for everyone"); + return flags; +} + +/** Flags for one frozen release against the others. */ +export function auditRecord(record, records) { + const flags = []; + const flag = (rule, message) => flags.push({ rule, message }); + const version = must(record.version); + if (version.pre.length && !["canary", "beta", "rc"].includes(version.pre[0])) flag("Version", `the pre-release "${record.version}" is not -canary, -beta or -rc`); + if (record.previous) { + const needed = record.entries.reduce((most, entry) => higher(most, entry.bump ?? "patch"), "patch"); + const carried = carries(record.previous, version.core); + if (record.entries.length && (!carried || !atLeast(carried, needed))) flag("Version", `${record.version} from ${record.previous} does not carry the ${needed} its entries need`); + } + for (const replaced of record.replaces ?? []) { + const candidate = records.find((other) => other.version === replaced); + if (!candidate) { + flag("Version", `replaces ${replaced}, which has no record`); + continue; + } + const ids = new Set(record.entries.map((entry) => entry.id)); + for (const entry of candidate.entries) if (!ids.has(entry.id)) flag("Version", `${replaced} held "${entry.id}", which ${record.version} does not: was it taken out on purpose?`); + } + for (const audience of record.audiences ?? []) if (!audience.covers?.length) flag("R18", `a paragraph covers no entry: "${audience.text}"`); + return flags; +} + +/** Every flag in a repository: the pending files, the records, CHANGELOG.md and the tags. Each is `{ where, rule, line, message }`. */ +export function audit(root) { + const flags = []; + const config = loadConfig(root); + const records = readRecords(root); + const pending = []; + const dir = path.join(root, CHANGES_DIR); + const names = fs.existsSync(dir) ? fs.readdirSync(dir).filter((name) => name.endsWith(".md") && name !== NOTES_FILE && name !== "README.md").sort() : []; + for (const name of names) { + const file = path.join(CHANGES_DIR, name); + try { + pending.push({ file, entry: readEntry(fs.readFileSync(path.join(root, file), "utf8"), file, config) }); + } catch (error) { + flags.push({ where: file, rule: "Each entry", line: "", message: error.message }); + } + } + const notesFile = path.join(dir, NOTES_FILE); + if (fs.existsSync(notesFile)) { + try { + const notes = readNotes(fs.readFileSync(notesFile, "utf8"), path.join(CHANGES_DIR, NOTES_FILE), new Set(pending.map(({ entry }) => entry.id))); + for (const found of auditNotes({ ...notes, entries: pending.map(({ entry }) => entry) }, { product: config.product })) flags.push({ where: path.join(CHANGES_DIR, NOTES_FILE), ...found }); + } catch (error) { + flags.push({ where: path.join(CHANGES_DIR, NOTES_FILE), rule: "R18", line: "", message: error.message }); + } + } + const all = [...pending.map(({ file, entry }) => ({ where: file, entry })), ...records.flatMap((record) => record.entries.map((entry) => ({ where: `${record.version} ${entry.id}`, entry })))]; + for (const { where, entry } of all) for (const found of auditEntry(entry, config)) flags.push({ where, line: entry.text, ...found }); + // An area on every entry when the package or product has more than one surface: when any entry has one, every entry does. + if (all.some(({ entry }) => entry.area)) for (const { where, entry } of all) if (!entry.area) flags.push({ where, rule: "Structure", line: entry.text, message: "no area, where other entries have one" }); + for (const record of records) for (const found of auditRecord(record, records)) flags.push({ where: record.version, line: "", ...found }); + for (const record of records) for (const found of auditNotes(record, { product: config.product })) flags.push({ where: record.version, ...found }); + for (const entry of all) if (!TYPES.includes(entry.entry.type)) flags.push({ where: entry.where, rule: "Structure", line: entry.entry.text, message: `type "${entry.entry.type}"` }); + const changelog = path.join(root, "CHANGELOG.md"); + if (fs.existsSync(changelog) && records.length) { + const expected = changelogMarkdown(pageReleases(root, { config, records, pending: pending.map(({ entry }) => entry) }), { product: config.product, form: config.form }); + if (fs.readFileSync(changelog, "utf8") !== expected) flags.push({ where: "CHANGELOG.md", rule: "Structure", line: "", message: "is not what the records give: run node tools/changelog/build.mjs" }); + } + for (const difference of taggedDifferences(root)) flags.push({ where: "records", rule: "Version", line: "", message: difference }); + return flags; +} + +/** A flag as the skill logs it: rule id, quoted line, what to look at. */ +export const formatFlag = (flag) => `${flag.rule}, ${flag.where}${flag.line ? `, "${flag.line}"` : ""}: ${flag.message}`; + +const { isMain } = await import("../../scripts/is-main.mjs"); +if (isMain(import.meta.url)) { + const args = process.argv.slice(2); + const at = args.indexOf("--root"); + const root = path.resolve(at >= 0 ? args[at + 1] : process.cwd()); + try { + const flags = audit(root); + for (const flag of flags) process.stdout.write(`${formatFlag(flag)}\n`); + process.stdout.write(flags.length ? `${flags.length} ${flags.length === 1 ? "flag" : "flags"}: a person decides each.\n` : "No flags.\n"); + process.exit(flags.length ? 1 : 0); + } catch (error) { + process.stderr.write(`${error.message}\n`); + process.exit(1); + } +} diff --git a/tools/changelog/build.mjs b/tools/changelog/build.mjs new file mode 100644 index 00000000..40f75182 --- /dev/null +++ b/tools/changelog/build.mjs @@ -0,0 +1,136 @@ +// The outputs, from the records and the pending files alone (DECISIONS 320, 3.4): +// node tools/changelog/build.mjs regenerate CHANGELOG.md +// node tools/changelog/build.mjs --json <file> the page's data, the ReleaseRecord[] that ReleaseNotes takes +// node tools/changelog/build.mjs --github <version> a GitHub Release's body, on stdout +// node tools/changelog/build.mjs --check CHANGELOG.md is what the records give, and every tagged record matches its tag +// Option: --root <repository> (default the working directory). +// No network and no git, except --check reading the tags. +import { execFileSync } from "node:child_process"; +import fs from "node:fs"; +import path from "node:path"; + +import { loadConfig } from "./config.mjs"; +import { changelogMarkdown, githubBody } from "./outputs.mjs"; +import { pageReleases, readRecords, RECORDS_DIR } from "./records.mjs"; +import { parse } from "./semver.mjs"; + +/** Every output for a repository, as strings, from its records and pending files. */ +export function outputs(root) { + const config = loadConfig(root); + const records = readRecords(root); + const releases = pageReleases(root, { config, records }); + return { + config, + releases, + changelog: changelogMarkdown(releases, { product: config.product, form: config.form }), + json: `${JSON.stringify(releases, null, 2)}\n`, + github: (version) => { + const release = releases.find((candidate) => candidate.version === version); + if (!release) throw new Error(`${version} is not a drawn release`); + // The comparison is the frozen record's repository, so a later config cannot re-point it. + const record = records.find((candidate) => candidate.version === version); + return githubBody(release, { repository: record?.repository ?? config.repository, form: config.form }); + }, + }; +} + +/** + * A published version is never edited (S 3.2.10), and never deleted: every record whose tag exists must equal the tag's copy, byte for byte, and every + * release tag this branch's history holds, and every record its history added, must still be there. A maintained line's tags are not in the default + * branch's history, so its record is answered for on the default branch from the commit that added it there (the pull request that brought it). + * Returns the differences, each a sentence. + */ +export function taggedDifferences(root) { + const differences = []; + const recordFile = (version) => `${RECORDS_DIR.split(path.sep).join("/")}/${version}.json`; + const tagged = (tag, file) => { + try { + return execFileSync("git", ["show", `${tag}:${file}`], { cwd: root, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }); + } catch { + return null; + } + }; + const records = readRecords(root); + const have = new Set(records.map((record) => record.version)); + for (const record of records) { + const tag = `v${record.version}`; + try { + execFileSync("git", ["rev-parse", "--verify", "--quiet", `refs/tags/${tag}`], { cwd: root, stdio: "ignore" }); + } catch { + continue; + } + const file = recordFile(record.version); + const copy = tagged(tag, file); + if (copy === null) differences.push(`${file}: the tag ${tag} holds no record`); + else if (copy !== fs.readFileSync(path.join(root, file), "utf8")) differences.push(`${file} differs from the copy tagged ${tag}; a published version is never edited`); + } + let merged = []; + try { + merged = execFileSync("git", ["tag", "--list", "v*", "--merged", "HEAD"], { cwd: root, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).split("\n").filter(Boolean); + } catch { + merged = []; + } + for (const tag of merged) { + const version = tag.slice(1); + if (have.has(version) || !parse(version)) continue; + // A tag with a record in its own tree is a release; one with none (a tag from before the changelog) is not this tool's. + if (tagged(tag, recordFile(version)) !== null) { + differences.push(`${recordFile(version)} is gone, and ${tag} released it; a published version is never deleted`); + have.add(version); + } + } + // A record this branch's history added is published here, tagged here or not (a maintained line's release, added to the default branch by a + // pull request, is tagged on its own branch): one that is gone was deleted. + let added = []; + try { + added = execFileSync("git", ["log", "--diff-filter=A", "--name-only", "--format=", "HEAD", "--", recordFile("").replace(/\/\.json$/, "/")], { cwd: root, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).split("\n").filter(Boolean); + } catch { + added = []; + } + for (const file of new Set(added)) { + const version = path.posix.basename(file, ".json"); + if (have.has(version) || !parse(version) || file !== recordFile(version)) continue; + differences.push(`${file} is gone, and this branch's history published it; a published version is never deleted`); + } + return differences; +} + +function main(argv) { + const args = [...argv]; + const take = (flag, hasValue = true) => { + const at = args.indexOf(flag); + if (at < 0) return undefined; + return hasValue ? args.splice(at, 2)[1] : (args.splice(at, 1), true); + }; + const root = path.resolve(take("--root") ?? process.cwd()); + const json = take("--json"); + const github = take("--github"); + const check = take("--check", false); + const out = outputs(root); + if (check) { + const problems = taggedDifferences(root); + const file = path.join(root, "CHANGELOG.md"); + if (!fs.existsSync(file) || fs.readFileSync(file, "utf8") !== out.changelog) problems.push("CHANGELOG.md is not what the records give: run node tools/changelog/build.mjs"); + for (const problem of problems) process.stderr.write(`${problem}\n`); + process.exit(problems.length ? 1 : 0); + } + if (github) { + process.stdout.write(out.github(github)); + return; + } + if (json) { + fs.writeFileSync(path.resolve(json), out.json); + return; + } + fs.writeFileSync(path.join(root, "CHANGELOG.md"), out.changelog); +} + +const { isMain } = await import("../../scripts/is-main.mjs"); +if (isMain(import.meta.url)) { + try { + main(process.argv.slice(2)); + } catch (error) { + process.stderr.write(`${error.message}\n`); + process.exit(1); + } +} diff --git a/tools/changelog/config.mjs b/tools/changelog/config.mjs new file mode 100644 index 00000000..a168a393 --- /dev/null +++ b/tools/changelog/config.mjs @@ -0,0 +1,136 @@ +// `changelog.config.json`: the product, its repository, its trackers and its people (DECISIONS 320, 3.2). Read and checked before any entry. +import fs from "node:fs"; +import path from "node:path"; + +export const CONFIG_FILE = "changelog.config.json"; + +const VARIABLE = /\{([A-Za-z][A-Za-z0-9]*)\}/g; +const TRACKER_KEYS = ["name", "pattern", "url", "label", "show"]; +const TOP_KEYS = ["product", "repository", "form", "trackers", "people"]; +const PERSON_KEYS = ["name"]; +export const SHOWS = ["link", "text", "none"]; + +const fail = (where, message) => { throw new Error(`${CONFIG_FILE}: ${where}: ${message}`); }; + +function checkHttps(where, url) { + if (!/^https:\/\//.test(url)) fail(where, `"${url}" must be https`); + // The variables go after the host only: in the path, the query or the fragment. + if (!/^https:\/\/[^/?#{}]+(?:[/?#]|$)/.test(url)) fail(where, `"${url}" holds a variable in its host`); + try { + new URL(url.replace(VARIABLE, "x")); + } catch { + fail(where, `"${url}" is not a URL`); + } +} + +/** + * Check a parsed config and return it ready to use: each tracker's pattern compiled to match the whole id. Stops on the first fault, naming it. + */ +export function readConfig(raw) { + if (!raw || typeof raw !== "object" || Array.isArray(raw)) fail("the file", "is not a JSON object"); + for (const key of Object.keys(raw)) if (!TOP_KEYS.includes(key)) fail("the file", `unknown key "${key}"`); + if (typeof raw.product !== "string" || !raw.product.trim()) fail("product", "is the product's name, and is required"); + if (typeof raw.repository !== "string") fail("repository", "is the repository's https address, and is required"); + if (/[{}]/.test(raw.repository)) fail("repository", "holds no variable"); + checkHttps("repository", raw.repository); + const repository = raw.repository.replace(/\/+$/, ""); + // A package's changelog ("reference") or a product's release notes ("notes"): the outputs follow the page's form. + const form = raw.form ?? "reference"; + if (!["reference", "notes"].includes(form)) fail("form", `is "reference" (a package) or "notes" (a product)`); + + const names = new Set(); + const trackers = (raw.trackers ?? []).map((tracker, index) => { + const at = `trackers[${index}]`; + if (!tracker || typeof tracker !== "object") fail(at, "is not an object"); + for (const key of Object.keys(tracker)) if (!TRACKER_KEYS.includes(key)) fail(at, `unknown key "${key}"`); + const { name, pattern, url, label } = tracker; + const show = tracker.show ?? "link"; + if (typeof name !== "string" || !name.trim()) fail(at, `"name" is the word shown, and is required`); + if (names.has(name)) fail(at, `the name "${name}" is used twice`); + names.add(name); + const where = `${at} (${name})`; + if (typeof pattern !== "string" || !pattern) fail(where, `"pattern" is required`); + if (pattern.startsWith("^") || pattern.endsWith("$")) fail(where, `write the pattern without ^ and $: it is matched against the whole id`); + let regexp; + try { + regexp = new RegExp(`^(?:${pattern})$`, "u"); + } catch (error) { + fail(where, `the pattern does not compile: ${error.message}`); + } + const groups = new Set([...pattern.matchAll(/\(\?<([A-Za-z][A-Za-z0-9]*)>/g)].map((match) => match[1])); + for (const [field, template] of [["url", url], ["label", label]]) { + if (template === undefined) continue; + if (typeof template !== "string") fail(where, `"${field}" is a string`); + for (const [, variable] of template.matchAll(VARIABLE)) { + if (variable !== "id" && !groups.has(variable)) fail(where, `"{${variable}}" in "${field}" is neither {id} nor a named group of the pattern`); + } + if (/[{}]/.test(template.replace(VARIABLE, ""))) fail(where, `"${field}" holds a brace that is not a variable`); + } + if (!SHOWS.includes(show)) fail(where, `"show" is link, text or none`); + if (show === "link" && url === undefined) fail(where, `a linked tracker needs "url"`); + if (url !== undefined) checkHttps(where, url); + return { name, pattern, regexp, url: url ?? null, label: label ?? null, show }; + }); + + const people = Object.create(null); + for (const [key, person] of Object.entries(raw.people ?? {})) { + if (!/^[a-z0-9][a-z0-9-]*$/.test(key)) fail(`people.${key}`, "a person's key is lowercase letters, digits and hyphens"); + if (!person || typeof person !== "object") fail(`people.${key}`, "is not an object"); + for (const field of Object.keys(person)) if (!PERSON_KEYS.includes(field)) fail(`people.${key}`, `unknown key "${field}"`); + if (typeof person.name !== "string" || !person.name.trim()) fail(`people.${key}`, `"name" is required`); + people[key] = { name: person.name }; + } + + return { product: raw.product, repository, form, trackers, people }; +} + +/** Read and check the config at a repository's root. */ +export function loadConfig(root) { + const file = path.join(root, CONFIG_FILE); + let text; + try { + text = fs.readFileSync(file, "utf8"); + } catch { + throw new Error(`${CONFIG_FILE}: not found at ${root}`); + } + let raw; + try { + raw = JSON.parse(text); + } catch (error) { + throw new Error(`${CONFIG_FILE}: not JSON: ${error.message}`); + } + return readConfig(raw); +} + +/** + * One ticket id, resolved against every tracker: exactly one must match the whole id. `where` names the file. The result is what a frozen + * release keeps, so a later config change cannot re-point it. + */ +export function resolveTicket(id, config, where) { + const hits = config.trackers.map((tracker) => ({ tracker, match: tracker.regexp.exec(id) })).filter((hit) => hit.match); + const names = config.trackers.map((tracker) => tracker.name).join(", ") || "none configured"; + if (hits.length === 0) throw new Error(`${where}: ticket "${id}" matches no tracker (${names})`); + if (hits.length > 1) throw new Error(`${where}: ticket "${id}" matches ${hits.length} trackers (${hits.map((hit) => hit.tracker.name).join(", ")})`); + const [{ tracker, match }] = hits; + const values = { id, ...(match.groups ?? {}) }; + // A pattern with alternatives may leave a named group unset for this id: a link or label that uses it would say "undefined". + for (const template of [ticketTemplate(tracker)].flat()) { + for (const [, name] of template.matchAll(VARIABLE)) if (values[name] === undefined) throw new Error(`${where}: ticket "${id}" leaves {${name}} unset, which ${tracker.name}'s ${tracker.show === "link" ? "url or label" : "label"} uses`); + } + const fill = (template, encode) => template.replace(VARIABLE, (_, name) => (encode ? encodeURIComponent(values[name]) : values[name])); + const ticket = { tracker: tracker.name, id, label: tracker.label ? fill(tracker.label, false) : id, show: tracker.show }; + if (tracker.show === "link") ticket.href = fill(tracker.url, true); + return ticket; +} + +const ticketTemplate = (tracker) => [tracker.show === "link" ? tracker.url : null, tracker.label].filter(Boolean); + +/** A person's name from their key, or a stop naming the file. */ +export function resolvePerson(key, config, where) { + const person = Object.hasOwn(config.people, key) ? config.people[key] : undefined; + if (!person) throw new Error(`${where}: author "${key}" is not a key of the config's "people" (${Object.keys(config.people).join(", ") || "none"})`); + return person.name; +} + +export const pullHref = (config, number) => `${config.repository}/pull/${number}`; +export const commitHref = (config, sha) => `${config.repository}/commit/${sha}`; diff --git a/tools/changelog/entries.mjs b/tools/changelog/entries.mjs new file mode 100644 index 00000000..f9ec2d72 --- /dev/null +++ b/tools/changelog/entries.mjs @@ -0,0 +1,212 @@ +// The entry files (DECISIONS 320, 3.3 and 3.4): `.changes/<id>.md`, one per change, added by the pull request that makes it. The head is +// `key: value` lines between two `---`, read here and nowhere else: a ticket id is read only from the `tickets` field of the entry's own file, +// never from a pull request's body, a commit's trailer, a branch name, a title or a sentence. It is not YAML, and no parser is added. +import fs from "node:fs"; +import path from "node:path"; + +import { resolvePerson, resolveTicket } from "./config.mjs"; +import { atLeast, BUMPS } from "./semver.mjs"; + +export const CHANGES_DIR = ".changes"; +export const NOTES_FILE = "release.md"; + +/** The sections, in the order every output draws them (2.7). "Action needed" stands above them all and is not a type. */ +export const TYPES = ["security", "deprecated", "removed", "added", "changed", "fixed"]; + +/** The least bump of each type; Changed has none and states its own (1.1). */ +export const FLOOR = { removed: "major", added: "minor", deprecated: "minor", fixed: "patch", security: "patch", changed: null }; + +const KEYS = ["type", "area", "pr", "author", "tickets", "bump", "action", "migration"]; +const ID = /^[a-z0-9][a-z0-9-]*$/; + +/** Whether an id is reserved for a release's address: "unreleased", and anything that starts with a v and a digit (2.10). */ +export const reservedId = (id) => id === "unreleased" || /^v[0-9]/.test(id); + +/** + * Whether an id is one the page itself uses: "main", the main landmark a skip link opens, and anything starting "bh-", the ids the HTML skill's + * scripts make (a popover's title, a tooltip, a dialog's parts). An entry holding one would share its address with that element. + */ +export const pageId = (id) => id === "main" || id.startsWith("bh-"); + +/** The `key: value` lines between two `---` at the top of a file. Returns the head (with each key's line number) and the body's lines. */ +export function readHead(source, file, keys) { + const lines = source.replace(/\r\n?/g, "\n").split("\n"); + if (lines[0] !== "---") throw new Error(`${file}:1: the file starts with "---"`); + const end = lines.indexOf("---", 1); + if (end < 0) throw new Error(`${file}: the head is not closed with "---"`); + const head = {}; + const at = {}; + for (let index = 1; index < end; index++) { + const line = lines[index]; + const match = /^([a-z]+): ?(.*)$/.exec(line); + if (!match) throw new Error(`${file}:${index + 1}: not a "key: value" line: ${JSON.stringify(line)}`); + const [, key, value] = match; + if (!keys.includes(key)) throw new Error(`${file}:${index + 1}: unknown key "${key}" (the keys are ${keys.join(", ")})`); + if (key in head) throw new Error(`${file}:${index + 1}: "${key}" is written twice`); + head[key] = value.trim(); + at[key] = index + 1; + } + return { head, at, body: lines.slice(end + 1), bodyLine: end + 2 }; +} + +/** A list in square brackets: `[ENG-398, PROJ-88]`. Items are trimmed; an empty item, a space inside one or an item listed twice stops. */ +export function readList(value, where, what) { + const list = /^\[(.*)\]$/.exec(value); + if (!list) throw new Error(`${where}: "${what}" is a list in square brackets, such as [ENG-398, PROJ-88]`); + if (list[1].trim() === "") return []; + const items = list[1].split(",").map((item) => item.trim()); + const seen = new Set(); + for (const item of items) { + if (item === "") throw new Error(`${where}: "${what}" has an empty item (a comma with nothing after it)`); + if (/\s/.test(item)) throw new Error(`${where}: "${item}" in "${what}" holds a space`); + if (seen.has(item)) throw new Error(`${where}: "${item}" is listed twice in "${what}"`); + seen.add(item); + } + return items; +} + +/** + * Read one entry file. `file` is its path as shown in messages; its base name, less `.md`, is the entry's id. Returns the entry as the + * record keeps it, less its commit (the freeze resolves that). + */ +export function readEntry(source, file, config) { + const id = path.basename(file).replace(/\.md$/, ""); + if (!file.endsWith(".md")) throw new Error(`${file}: an entry is a .md file`); + if (!ID.test(id)) throw new Error(`${file}: the id "${id}" is lowercase letters, digits and hyphens`); + if (reservedId(id)) throw new Error(`${file}: the id "${id}" is reserved for a release's address`); + if (pageId(id)) throw new Error(`${file}: the id "${id}" is the page's own ("main", or the "bh-" ids the HTML skill makes)`); + const { head, at, body } = readHead(source, file, KEYS); + const line = (key) => `${file}:${at[key]}`; + + if (!("type" in head)) throw new Error(`${file}: "type" is required (${TYPES.join(", ")})`); + const type = head.type; + if (!TYPES.includes(type)) throw new Error(`${line("type")}: type "${type}" is one of ${TYPES.join(", ")}`); + + let pr; + if ("pr" in head) { + if (!/^[1-9][0-9]*$/.test(head.pr)) throw new Error(`${line("pr")}: "pr" is the pull request's number, such as 120`); + pr = Number(head.pr); + } + const fromPr = /^pr([1-9][0-9]*)-[1-9][0-9]*$/.exec(id); + if (fromPr && pr !== Number(fromPr[1])) throw new Error(`${file}: the file is named for pull request ${fromPr[1]}, so it says "pr: ${fromPr[1]}"${pr ? `, not ${pr}` : ""}`); + // Both ways: an entry from a pull request is named for it; a free slug is for a change with no pull request. + if (pr && !fromPr) throw new Error(`${file}: an entry from pull request ${pr} is named pr${pr}-1.md (pr${pr}-2.md for its second); a free name is for a change with no pull request`); + + let action = false; + if ("action" in head) { + if (head.action !== "true" && head.action !== "false") throw new Error(`${line("action")}: "action" is true or false`); + action = head.action === "true"; + } + + const floor = FLOOR[type]; + let bump = floor; + if ("bump" in head) { + if (!BUMPS.includes(head.bump)) throw new Error(`${line("bump")}: "bump" is major, minor or patch`); + if (floor && !atLeast(head.bump, floor)) throw new Error(`${line("bump")}: a ${type} entry needs at least a ${floor}; "bump" may raise it and never lower it`); + bump = head.bump; + } + if (!bump) throw new Error(`${file}: a changed entry states its bump ("bump: major", "minor" or "patch"): a default that alters behavior is major, a token's value minor, an improvement patch`); + if (bump === "major" && !action) throw new Error(`${file}: a major entry is always "action: true": what breaks is what a reader checks before upgrading`); + + let area; + if ("area" in head) { + if (!head.area) throw new Error(`${line("area")}: "area" is empty`); + area = head.area; + } + + let tickets = []; + if ("tickets" in head) tickets = readList(head.tickets, line("tickets"), "tickets").map((ticket) => resolveTicket(ticket, config, file)); + + let authors; + if ("author" in head) { + if (!head.author) throw new Error(`${line("author")}: "author" is empty; leave the key out when nobody has claimed the words`); + authors = [resolvePerson(head.author, config, line("author"))]; + } + + let migration; + if ("migration" in head) { + if (!head.migration) throw new Error(`${line("migration")}: "migration" is empty`); + migration = head.migration; + } + + const text = body.join("\n").trim().replace(/\s*\n\s*/g, " "); + if (!text) throw new Error(`${file}: the entry's sentence is missing under the head`); + + const entry = { id, type, bump, text }; + if (area) entry.area = area; + if (action) entry.action = true; + if (migration) entry.migration = migration; + if (pr) entry.pr = pr; + if (tickets.length) entry.tickets = tickets; + if (authors) entry.authors = authors; + return entry; +} + +const NOTES_KEYS = ["title", "summary"]; + +/** + * `.changes/release.md`: a release's notes. A head with `title` and `summary`; then a paragraph for everyone (no heading) and a `## For admins` + * heading for each audience, each block opening with a `covers: [ids]` line. `ids` is every entry id the paragraph may name. + */ +export function readNotes(source, file, ids) { + const { head, body, bodyLine } = readHead(source, file, NOTES_KEYS); + const notes = {}; + if (head.title) notes.title = head.title; + if (head.summary) notes.summary = head.summary; + const blocks = []; + let block = { for: undefined, line: bodyLine, lines: [] }; + body.forEach((text, index) => { + const heading = /^## (.+)$/.exec(text); + if (heading) { + blocks.push(block); + block = { for: heading[1].trim(), line: bodyLine + index, lines: [] }; + } else { + block.lines.push({ text, line: bodyLine + index }); + } + }); + blocks.push(block); + const audiences = []; + for (const { for: group, line, lines } of blocks) { + const filled = lines.filter((entry) => entry.text.trim() !== ""); + if (!filled.length) { + if (group) throw new Error(`${file}:${line}: "${group}" has no paragraph`); + continue; + } + const [first, ...rest] = filled; + // One paragraph a block: a second "covers" line, or words after a blank line, would publish unchecked words (start the next with a ## heading). + const stray = rest.find((entry) => /^covers:/.test(entry.text.trim())); + if (stray) throw new Error(`${file}:${stray.line}: a second "covers" line in one block; each paragraph is its own block under its own "## " heading`); + const start = lines.indexOf(first); + const gap = lines.findIndex((entry, index) => index > start && entry.text.trim() === "" && lines.slice(index + 1).some((after) => after.text.trim() !== "")); + if (gap >= 0) throw new Error(`${file}:${lines[gap].line + 1}: ${group ? `"${group}"` : "the paragraph for everyone"} holds two paragraphs; it is one paragraph of one to three sentences`); + const covers = /^covers: ?(.*)$/.exec(first.text.trim()); + if (!covers) throw new Error(`${file}:${first.line}: a paragraph opens with a "covers: [ids]" line naming the entries it is about`); + const list = readList(covers[1].trim(), `${file}:${first.line}`, "covers"); + if (!list.length) throw new Error(`${file}:${first.line}: the paragraph covers no entry: a claim with no entry gets an entry or goes (R18)`); + for (const id of list) if (!ids.has(id)) throw new Error(`${file}:${first.line}: covers "${id}", which is no entry of this release`); + const text = rest.map((entry) => entry.text.trim()).join(" ").trim(); + if (!text) throw new Error(`${file}:${first.line}: the paragraph is missing under its "covers" line`); + const audience = { text, covers: list }; + if (group) audience.for = group; + audiences.push(audience); + } + if (audiences.length) notes.audiences = audiences; + return notes; +} + +/** Every pending entry file in a repository's `.changes`, read and checked, sorted by id. */ +export function readPending(root, config) { + const dir = path.join(root, CHANGES_DIR); + if (!fs.existsSync(dir)) return []; + return fs.readdirSync(dir) + .filter((name) => name.endsWith(".md") && name !== NOTES_FILE && name !== "README.md") + .sort() + .map((name) => readEntry(fs.readFileSync(path.join(dir, name), "utf8"), path.join(CHANGES_DIR, name), config)); +} + +/** The pending release notes, or null. */ +export function readPendingNotes(root, ids) { + const file = path.join(root, CHANGES_DIR, NOTES_FILE); + if (!fs.existsSync(file)) return null; + return readNotes(fs.readFileSync(file, "utf8"), path.join(CHANGES_DIR, NOTES_FILE), ids); +} diff --git a/tools/changelog/fixtures/harbor/CHANGELOG.md b/tools/changelog/fixtures/harbor/CHANGELOG.md new file mode 100644 index 00000000..35d0a4ea --- /dev/null +++ b/tools/changelog/fixtures/harbor/CHANGELOG.md @@ -0,0 +1,95 @@ +# Changelog + +Every version of Harbor. This file is generated by `tools/changelog` from `changelog/releases` and `.changes`. Edit those, never this file. + +## 2.0.0 - 2026-12-07 + +### Action needed + +- Sign-in: Removed sign-in with a shared room code, so each responder signs in with their own account before Jan 15, 2027 ([#140](https://github.com/example/harbor/pull/140)) + +### Responders sign in with their own account + +Each responder now signs in with their own account, through your company's identity provider. + +#### For admins + +In Settings, open Sign-in and connect your identity provider. Shared room codes stop working on Jan 15, 2027. + +### Other changes + +Single sign-on replaces shared room codes, with a sign-in page for your company's identity provider. + +#### Added + +- Sign-in: Added single sign-on through your company's identity provider ([#141](https://github.com/example/harbor/pull/141), Linear [OPS-230](https://linear.app/example/issue/OPS-230)) +- Sign-in: Added a sign-in page that names your company's identity provider ([#142](https://github.com/example/harbor/pull/142)) + +#### Fixed + +- Rooms: Fixed the room list scrolling to the top when a new room opened ([#143](https://github.com/example/harbor/pull/143)) + +## 1.4.1 - 2026-12-08 + +### Fixed + +- Rooms: Fixed the room timer showing 0:00 after a reload in a second tab ([#145](https://github.com/example/harbor/pull/145)) + +## 1.4.0 - 2026-11-23 + +### A monitor can open an incident room + +A monitor that can send a webhook can now open an incident room when its alarm fires. + +#### For responders + +On Home, open an incident marked "Opened by a monitor". + +#### For admins + +In Settings, open Integrations and add a webhook. Paste its address into your monitor. + +### All changes + +Monitors can open incident rooms through a webhook, and Home marks the incidents they open. The open incident list keeps its place, and two fixes cover the lobby and search. + +#### Added + +- Home: Added an "Opened by a monitor" mark to incidents that a webhook declared ([#131](https://github.com/example/harbor/pull/131)) +- Integrations: Added webhook declarations so a monitor can open an incident room when its alarm fires ([#131](https://github.com/example/harbor/pull/131), Linear [OPS-204](https://linear.app/example/issue/OPS-204)) + +#### Changed + +- Home: Improved the open incident list so your scroll position stays fixed when an incident arrives above it ([#132](https://github.com/example/harbor/pull/132)) + +#### Fixed + +- Lobby: Fixed "Waiting to be admitted" staying on screen after the commander had admitted you, until you reloaded the page ([#133](https://github.com/example/harbor/pull/133)) +- Past incidents: Fixed search missing an update the commander had published in the last minute ([#134](https://github.com/example/harbor/pull/134)) + +## 1.3.1 - 2026-11-23 + +Fixes to the recap, the room timer, the directory and sign-in. + +### Fixed + +- Directory: Fixed a vendor's support line showing the previous vendor's number after you switched rows quickly ([#130](https://github.com/example/harbor/pull/130)) +- Rooms: Fixed the recap starting from the room's first message when you had been away for under a minute ([#129](https://github.com/example/harbor/pull/129)) +- Rooms: Fixed the room timer showing 0:00 after a reload ([#135](https://github.com/example/harbor/pull/135)) +- Sign-in: Fixed the code field clearing when you pasted a code ([#136](https://github.com/example/harbor/pull/136)) + +## 1.3.0 - 2026-11-20 + +### Action needed + +- Updates: Changed published updates to require approval from a second commander, so name a second commander for each room before Dec 1, 2026 ([#126](https://github.com/example/harbor/pull/126)) + +### Updates need a second approval + +An update to people outside the room now needs a second commander's approval before it is published. + +### Other changes + +#### Added + +- Updates: Added an approval request that a second commander can grant or return with a note ([#126](https://github.com/example/harbor/pull/126)) diff --git a/tools/changelog/fixtures/harbor/changelog.config.json b/tools/changelog/fixtures/harbor/changelog.config.json new file mode 100644 index 00000000..bf5f65d3 --- /dev/null +++ b/tools/changelog/fixtures/harbor/changelog.config.json @@ -0,0 +1,17 @@ +{ + "product": "Harbor", + "repository": "https://github.com/example/harbor", + "form": "notes", + "trackers": [ + { + "name": "Linear", + "pattern": "OPS-[1-9][0-9]*", + "url": "https://linear.app/example/issue/{id}" + } + ], + "people": { + "ada": { + "name": "Ada Okoye" + } + } +} diff --git a/tools/changelog/fixtures/harbor/changelog/releases/1.3.0.json b/tools/changelog/fixtures/harbor/changelog/releases/1.3.0.json new file mode 100644 index 00000000..d46f1a86 --- /dev/null +++ b/tools/changelog/fixtures/harbor/changelog/releases/1.3.0.json @@ -0,0 +1,48 @@ +{ + "version": "1.3.0", + "date": "2026-11-20", + "repository": "https://github.com/example/harbor", + "title": "Updates need a second approval", + "audiences": [ + { + "text": "An update to people outside the room now needs a second commander's approval before it is published.", + "covers": [ + "pr126-1", + "pr126-2" + ] + } + ], + "entries": [ + { + "id": "pr126-1", + "type": "changed", + "bump": "minor", + "area": "Updates", + "text": "Changed published updates to require approval from a second commander, so name a second commander for each room before Dec 1, 2026", + "action": true, + "pr": { + "number": 126, + "href": "https://github.com/example/harbor/pull/126" + }, + "commit": { + "sha": "2c4871d3254c112ba29d82602cc94275572ce257", + "href": "https://github.com/example/harbor/commit/2c4871d3254c112ba29d82602cc94275572ce257" + } + }, + { + "id": "pr126-2", + "type": "added", + "bump": "minor", + "area": "Updates", + "text": "Added an approval request that a second commander can grant or return with a note", + "pr": { + "number": 126, + "href": "https://github.com/example/harbor/pull/126" + }, + "commit": { + "sha": "393ee05942dff95b0943289abdc6ddc0a51ca987", + "href": "https://github.com/example/harbor/commit/393ee05942dff95b0943289abdc6ddc0a51ca987" + } + } + ] +} diff --git a/tools/changelog/fixtures/harbor/changelog/releases/1.3.1.json b/tools/changelog/fixtures/harbor/changelog/releases/1.3.1.json new file mode 100644 index 00000000..512be14b --- /dev/null +++ b/tools/changelog/fixtures/harbor/changelog/releases/1.3.1.json @@ -0,0 +1,69 @@ +{ + "version": "1.3.1", + "date": "2026-11-23", + "previous": "1.3.0", + "repository": "https://github.com/example/harbor", + "summary": "Fixes to the recap, the room timer, the directory and sign-in.", + "entries": [ + { + "id": "pr130-1", + "type": "fixed", + "bump": "patch", + "area": "Directory", + "text": "Fixed a vendor's support line showing the previous vendor's number after you switched rows quickly", + "pr": { + "number": 130, + "href": "https://github.com/example/harbor/pull/130" + }, + "commit": { + "sha": "d5c0cac2cecaee7c66b0d2f15c31ed1ba245ca66", + "href": "https://github.com/example/harbor/commit/d5c0cac2cecaee7c66b0d2f15c31ed1ba245ca66" + } + }, + { + "id": "pr129-1", + "type": "fixed", + "bump": "patch", + "area": "Rooms", + "text": "Fixed the recap starting from the room's first message when you had been away for under a minute", + "pr": { + "number": 129, + "href": "https://github.com/example/harbor/pull/129" + }, + "commit": { + "sha": "d5a5398a6de3d34b72bff90064483ca838cc22c0", + "href": "https://github.com/example/harbor/commit/d5a5398a6de3d34b72bff90064483ca838cc22c0" + } + }, + { + "id": "pr135-1", + "type": "fixed", + "bump": "patch", + "area": "Rooms", + "text": "Fixed the room timer showing 0:00 after a reload", + "pr": { + "number": 135, + "href": "https://github.com/example/harbor/pull/135" + }, + "commit": { + "sha": "e94330f40ba8bd8dce7574923ccc238c5831d573", + "href": "https://github.com/example/harbor/commit/e94330f40ba8bd8dce7574923ccc238c5831d573" + } + }, + { + "id": "pr136-1", + "type": "fixed", + "bump": "patch", + "area": "Sign-in", + "text": "Fixed the code field clearing when you pasted a code", + "pr": { + "number": 136, + "href": "https://github.com/example/harbor/pull/136" + }, + "commit": { + "sha": "79ac5b66ce07b63548e1511a069cd8ebe5eb4b7c", + "href": "https://github.com/example/harbor/commit/79ac5b66ce07b63548e1511a069cd8ebe5eb4b7c" + } + } + ] +} diff --git a/tools/changelog/fixtures/harbor/changelog/releases/1.4.0.json b/tools/changelog/fixtures/harbor/changelog/releases/1.4.0.json new file mode 100644 index 00000000..710673ca --- /dev/null +++ b/tools/changelog/fixtures/harbor/changelog/releases/1.4.0.json @@ -0,0 +1,122 @@ +{ + "version": "1.4.0", + "date": "2026-11-23", + "previous": "1.3.1", + "repository": "https://github.com/example/harbor", + "title": "A monitor can open an incident room", + "summary": "Monitors can open incident rooms through a webhook, and Home marks the incidents they open. The open incident list keeps its place, and two fixes cover the lobby and search.", + "audiences": [ + { + "text": "A monitor that can send a webhook can now open an incident room when its alarm fires.", + "covers": [ + "pr131-1" + ] + }, + { + "text": "On Home, open an incident marked \"Opened by a monitor\".", + "covers": [ + "pr131-2" + ], + "for": "For responders" + }, + { + "text": "In Settings, open Integrations and add a webhook. Paste its address into your monitor.", + "covers": [ + "pr131-1" + ], + "for": "For admins" + } + ], + "entries": [ + { + "id": "pr131-2", + "type": "added", + "bump": "minor", + "area": "Home", + "text": "Added an \"Opened by a monitor\" mark to incidents that a webhook declared", + "pr": { + "number": 131, + "href": "https://github.com/example/harbor/pull/131" + }, + "commit": { + "sha": "2c1f382d8af35dbf349b6054d80009be806a25e8", + "href": "https://github.com/example/harbor/commit/2c1f382d8af35dbf349b6054d80009be806a25e8" + }, + "authors": [ + "Ada Okoye" + ] + }, + { + "id": "pr131-1", + "type": "added", + "bump": "minor", + "area": "Integrations", + "text": "Added webhook declarations so a monitor can open an incident room when its alarm fires", + "pr": { + "number": 131, + "href": "https://github.com/example/harbor/pull/131" + }, + "commit": { + "sha": "f972daff12326b42cdc2f6cbc77f0c3544476b35", + "href": "https://github.com/example/harbor/commit/f972daff12326b42cdc2f6cbc77f0c3544476b35" + }, + "tickets": [ + { + "tracker": "Linear", + "id": "OPS-204", + "label": "OPS-204", + "show": "link", + "href": "https://linear.app/example/issue/OPS-204" + } + ], + "authors": [ + "Ada Okoye" + ] + }, + { + "id": "pr132-1", + "type": "changed", + "bump": "patch", + "area": "Home", + "text": "Improved the open incident list so your scroll position stays fixed when an incident arrives above it", + "pr": { + "number": 132, + "href": "https://github.com/example/harbor/pull/132" + }, + "commit": { + "sha": "ac34519ba05096cf79627037004d77b7b7a53c62", + "href": "https://github.com/example/harbor/commit/ac34519ba05096cf79627037004d77b7b7a53c62" + } + }, + { + "id": "pr133-1", + "type": "fixed", + "bump": "patch", + "area": "Lobby", + "text": "Fixed \"Waiting to be admitted\" staying on screen after the commander had admitted you, until you reloaded the page", + "pr": { + "number": 133, + "href": "https://github.com/example/harbor/pull/133" + }, + "commit": { + "sha": "8b6460d2486ee68f4ec5cd340b5632b53ab6fc8c", + "href": "https://github.com/example/harbor/commit/8b6460d2486ee68f4ec5cd340b5632b53ab6fc8c" + } + }, + { + "id": "pr134-1", + "type": "fixed", + "bump": "patch", + "area": "Past incidents", + "text": "Fixed search missing an update the commander had published in the last minute", + "pr": { + "number": 134, + "href": "https://github.com/example/harbor/pull/134" + }, + "commit": { + "sha": "5fc5342c90440fe75be4511bf9874f3f48fb3b13", + "href": "https://github.com/example/harbor/commit/5fc5342c90440fe75be4511bf9874f3f48fb3b13" + } + } + ] +} diff --git a/tools/changelog/fixtures/harbor/changelog/releases/1.4.1.json b/tools/changelog/fixtures/harbor/changelog/releases/1.4.1.json new file mode 100644 index 00000000..bb186bdf --- /dev/null +++ b/tools/changelog/fixtures/harbor/changelog/releases/1.4.1.json @@ -0,0 +1,23 @@ +{ + "version": "1.4.1", + "date": "2026-12-08", + "previous": "1.4.0", + "repository": "https://github.com/example/harbor", + "entries": [ + { + "id": "pr145-1", + "type": "fixed", + "bump": "patch", + "area": "Rooms", + "text": "Fixed the room timer showing 0:00 after a reload in a second tab", + "pr": { + "number": 145, + "href": "https://github.com/example/harbor/pull/145" + }, + "commit": { + "sha": "b87ac424f7c5d86741be5e40def96fcae58503f4", + "href": "https://github.com/example/harbor/commit/b87ac424f7c5d86741be5e40def96fcae58503f4" + } + } + ] +} diff --git a/tools/changelog/fixtures/harbor/changelog/releases/2.0.0-rc.1.json b/tools/changelog/fixtures/harbor/changelog/releases/2.0.0-rc.1.json new file mode 100644 index 00000000..3c3a4476 --- /dev/null +++ b/tools/changelog/fixtures/harbor/changelog/releases/2.0.0-rc.1.json @@ -0,0 +1,65 @@ +{ + "version": "2.0.0-rc.1", + "date": "2026-12-01", + "previous": "1.4.0", + "repository": "https://github.com/example/harbor", + "title": "Responders sign in with their own account", + "audiences": [ + { + "text": "Each responder now signs in with their own account, through your company's identity provider.", + "covers": [ + "pr141-1" + ] + }, + { + "text": "In Settings, open Sign-in and connect your identity provider. Shared room codes stop working on Jan 15, 2027.", + "covers": [ + "pr140-1", + "pr141-1" + ], + "for": "For admins" + } + ], + "entries": [ + { + "id": "pr140-1", + "type": "removed", + "bump": "major", + "area": "Sign-in", + "text": "Removed sign-in with a shared room code, so each responder signs in with their own account before Jan 15, 2027", + "action": true, + "pr": { + "number": 140, + "href": "https://github.com/example/harbor/pull/140" + }, + "commit": { + "sha": "1f1eabacd6e698c20de36b74406b3daaeda818dd", + "href": "https://github.com/example/harbor/commit/1f1eabacd6e698c20de36b74406b3daaeda818dd" + } + }, + { + "id": "pr141-1", + "type": "added", + "bump": "minor", + "area": "Sign-in", + "text": "Added single sign-on through your company's identity provider", + "pr": { + "number": 141, + "href": "https://github.com/example/harbor/pull/141" + }, + "commit": { + "sha": "e9d0f6591487e04f2d5618d23e6998f8aa5ed398", + "href": "https://github.com/example/harbor/commit/e9d0f6591487e04f2d5618d23e6998f8aa5ed398" + }, + "tickets": [ + { + "tracker": "Linear", + "id": "OPS-230", + "label": "OPS-230", + "show": "link", + "href": "https://linear.app/example/issue/OPS-230" + } + ] + } + ] +} diff --git a/tools/changelog/fixtures/harbor/changelog/releases/2.0.0-rc.2.json b/tools/changelog/fixtures/harbor/changelog/releases/2.0.0-rc.2.json new file mode 100644 index 00000000..54da1398 --- /dev/null +++ b/tools/changelog/fixtures/harbor/changelog/releases/2.0.0-rc.2.json @@ -0,0 +1,32 @@ +{ + "version": "2.0.0-rc.2", + "date": "2026-12-03", + "previous": "1.4.0", + "repository": "https://github.com/example/harbor", + "title": "A sign-in page names your identity provider", + "audiences": [ + { + "text": "The sign-in page now names your company's identity provider, so responders know which account to use.", + "covers": [ + "pr142-1" + ] + } + ], + "entries": [ + { + "id": "pr142-1", + "type": "added", + "bump": "minor", + "area": "Sign-in", + "text": "Added a sign-in page that names your company's identity provider", + "pr": { + "number": 142, + "href": "https://github.com/example/harbor/pull/142" + }, + "commit": { + "sha": "090709e865e860827cbffa34fc9c12c33481dd35", + "href": "https://github.com/example/harbor/commit/090709e865e860827cbffa34fc9c12c33481dd35" + } + } + ] +} diff --git a/tools/changelog/fixtures/harbor/changelog/releases/2.0.0.json b/tools/changelog/fixtures/harbor/changelog/releases/2.0.0.json new file mode 100644 index 00000000..a24da25b --- /dev/null +++ b/tools/changelog/fixtures/harbor/changelog/releases/2.0.0.json @@ -0,0 +1,101 @@ +{ + "version": "2.0.0", + "date": "2026-12-07", + "previous": "1.4.0", + "replaces": [ + "2.0.0-rc.1", + "2.0.0-rc.2" + ], + "repository": "https://github.com/example/harbor", + "title": "Responders sign in with their own account", + "summary": "Single sign-on replaces shared room codes, with a sign-in page for your company's identity provider.", + "audiences": [ + { + "text": "Each responder now signs in with their own account, through your company's identity provider.", + "covers": [ + "pr141-1", + "pr142-1" + ] + }, + { + "text": "In Settings, open Sign-in and connect your identity provider. Shared room codes stop working on Jan 15, 2027.", + "covers": [ + "pr140-1", + "pr141-1" + ], + "for": "For admins" + } + ], + "entries": [ + { + "id": "pr140-1", + "type": "removed", + "bump": "major", + "area": "Sign-in", + "text": "Removed sign-in with a shared room code, so each responder signs in with their own account before Jan 15, 2027", + "action": true, + "pr": { + "number": 140, + "href": "https://github.com/example/harbor/pull/140" + }, + "commit": { + "sha": "1f1eabacd6e698c20de36b74406b3daaeda818dd", + "href": "https://github.com/example/harbor/commit/1f1eabacd6e698c20de36b74406b3daaeda818dd" + } + }, + { + "id": "pr141-1", + "type": "added", + "bump": "minor", + "area": "Sign-in", + "text": "Added single sign-on through your company's identity provider", + "pr": { + "number": 141, + "href": "https://github.com/example/harbor/pull/141" + }, + "commit": { + "sha": "e9d0f6591487e04f2d5618d23e6998f8aa5ed398", + "href": "https://github.com/example/harbor/commit/e9d0f6591487e04f2d5618d23e6998f8aa5ed398" + }, + "tickets": [ + { + "tracker": "Linear", + "id": "OPS-230", + "label": "OPS-230", + "show": "link", + "href": "https://linear.app/example/issue/OPS-230" + } + ] + }, + { + "id": "pr142-1", + "type": "added", + "bump": "minor", + "area": "Sign-in", + "text": "Added a sign-in page that names your company's identity provider", + "pr": { + "number": 142, + "href": "https://github.com/example/harbor/pull/142" + }, + "commit": { + "sha": "090709e865e860827cbffa34fc9c12c33481dd35", + "href": "https://github.com/example/harbor/commit/090709e865e860827cbffa34fc9c12c33481dd35" + } + }, + { + "id": "pr143-1", + "type": "fixed", + "bump": "patch", + "area": "Rooms", + "text": "Fixed the room list scrolling to the top when a new room opened", + "pr": { + "number": 143, + "href": "https://github.com/example/harbor/pull/143" + }, + "commit": { + "sha": "07336e6cb9e6ef3e87f17d49313afd5f30f99569", + "href": "https://github.com/example/harbor/commit/07336e6cb9e6ef3e87f17d49313afd5f30f99569" + } + } + ] +} diff --git a/tools/changelog/fixtures/harbor/releases-candidate.json b/tools/changelog/fixtures/harbor/releases-candidate.json new file mode 100644 index 00000000..30ab882b --- /dev/null +++ b/tools/changelog/fixtures/harbor/releases-candidate.json @@ -0,0 +1,351 @@ +[ + { + "version": "2.0.0-rc.2", + "date": "2026-12-03", + "previous": "1.4.0", + "title": "A sign-in page names your identity provider", + "audiences": [ + { + "text": "The sign-in page now names your company's identity provider, so responders know which account to use.", + "covers": [ + "pr142-1" + ] + } + ], + "entries": [ + { + "id": "pr142-1", + "type": "added", + "bump": "minor", + "area": "Sign-in", + "text": "Added a sign-in page that names your company's identity provider", + "pr": { + "number": 142, + "href": "https://github.com/example/harbor/pull/142" + }, + "commit": { + "sha": "090709e865e860827cbffa34fc9c12c33481dd35", + "href": "https://github.com/example/harbor/commit/090709e865e860827cbffa34fc9c12c33481dd35" + } + } + ] + }, + { + "version": "2.0.0-rc.1", + "date": "2026-12-01", + "previous": "1.4.0", + "title": "Responders sign in with their own account", + "audiences": [ + { + "text": "Each responder now signs in with their own account, through your company's identity provider.", + "covers": [ + "pr141-1" + ] + }, + { + "text": "In Settings, open Sign-in and connect your identity provider. Shared room codes stop working on Jan 15, 2027.", + "covers": [ + "pr140-1", + "pr141-1" + ], + "for": "For admins" + } + ], + "entries": [ + { + "id": "pr140-1", + "type": "removed", + "bump": "major", + "area": "Sign-in", + "text": "Removed sign-in with a shared room code, so each responder signs in with their own account before Jan 15, 2027", + "action": true, + "pr": { + "number": 140, + "href": "https://github.com/example/harbor/pull/140" + }, + "commit": { + "sha": "1f1eabacd6e698c20de36b74406b3daaeda818dd", + "href": "https://github.com/example/harbor/commit/1f1eabacd6e698c20de36b74406b3daaeda818dd" + } + }, + { + "id": "pr141-1", + "type": "added", + "bump": "minor", + "area": "Sign-in", + "text": "Added single sign-on through your company's identity provider", + "pr": { + "number": 141, + "href": "https://github.com/example/harbor/pull/141" + }, + "commit": { + "sha": "e9d0f6591487e04f2d5618d23e6998f8aa5ed398", + "href": "https://github.com/example/harbor/commit/e9d0f6591487e04f2d5618d23e6998f8aa5ed398" + }, + "tickets": [ + { + "tracker": "Linear", + "label": "OPS-230", + "href": "https://linear.app/example/issue/OPS-230" + } + ] + } + ] + }, + { + "version": "1.4.1", + "date": "2026-12-08", + "previous": "1.4.0", + "entries": [ + { + "id": "pr145-1", + "type": "fixed", + "bump": "patch", + "area": "Rooms", + "text": "Fixed the room timer showing 0:00 after a reload in a second tab", + "pr": { + "number": 145, + "href": "https://github.com/example/harbor/pull/145" + }, + "commit": { + "sha": "b87ac424f7c5d86741be5e40def96fcae58503f4", + "href": "https://github.com/example/harbor/commit/b87ac424f7c5d86741be5e40def96fcae58503f4" + } + } + ] + }, + { + "version": "1.4.0", + "date": "2026-11-23", + "previous": "1.3.1", + "title": "A monitor can open an incident room", + "summary": "Monitors can open incident rooms through a webhook, and Home marks the incidents they open. The open incident list keeps its place, and two fixes cover the lobby and search.", + "audiences": [ + { + "text": "A monitor that can send a webhook can now open an incident room when its alarm fires.", + "covers": [ + "pr131-1" + ] + }, + { + "text": "On Home, open an incident marked \"Opened by a monitor\".", + "covers": [ + "pr131-2" + ], + "for": "For responders" + }, + { + "text": "In Settings, open Integrations and add a webhook. Paste its address into your monitor.", + "covers": [ + "pr131-1" + ], + "for": "For admins" + } + ], + "entries": [ + { + "id": "pr131-2", + "type": "added", + "bump": "minor", + "area": "Home", + "text": "Added an \"Opened by a monitor\" mark to incidents that a webhook declared", + "pr": { + "number": 131, + "href": "https://github.com/example/harbor/pull/131" + }, + "commit": { + "sha": "2c1f382d8af35dbf349b6054d80009be806a25e8", + "href": "https://github.com/example/harbor/commit/2c1f382d8af35dbf349b6054d80009be806a25e8" + }, + "authors": [ + "Ada Okoye" + ] + }, + { + "id": "pr131-1", + "type": "added", + "bump": "minor", + "area": "Integrations", + "text": "Added webhook declarations so a monitor can open an incident room when its alarm fires", + "pr": { + "number": 131, + "href": "https://github.com/example/harbor/pull/131" + }, + "commit": { + "sha": "f972daff12326b42cdc2f6cbc77f0c3544476b35", + "href": "https://github.com/example/harbor/commit/f972daff12326b42cdc2f6cbc77f0c3544476b35" + }, + "tickets": [ + { + "tracker": "Linear", + "label": "OPS-204", + "href": "https://linear.app/example/issue/OPS-204" + } + ], + "authors": [ + "Ada Okoye" + ] + }, + { + "id": "pr132-1", + "type": "changed", + "bump": "patch", + "area": "Home", + "text": "Improved the open incident list so your scroll position stays fixed when an incident arrives above it", + "pr": { + "number": 132, + "href": "https://github.com/example/harbor/pull/132" + }, + "commit": { + "sha": "ac34519ba05096cf79627037004d77b7b7a53c62", + "href": "https://github.com/example/harbor/commit/ac34519ba05096cf79627037004d77b7b7a53c62" + } + }, + { + "id": "pr133-1", + "type": "fixed", + "bump": "patch", + "area": "Lobby", + "text": "Fixed \"Waiting to be admitted\" staying on screen after the commander had admitted you, until you reloaded the page", + "pr": { + "number": 133, + "href": "https://github.com/example/harbor/pull/133" + }, + "commit": { + "sha": "8b6460d2486ee68f4ec5cd340b5632b53ab6fc8c", + "href": "https://github.com/example/harbor/commit/8b6460d2486ee68f4ec5cd340b5632b53ab6fc8c" + } + }, + { + "id": "pr134-1", + "type": "fixed", + "bump": "patch", + "area": "Past incidents", + "text": "Fixed search missing an update the commander had published in the last minute", + "pr": { + "number": 134, + "href": "https://github.com/example/harbor/pull/134" + }, + "commit": { + "sha": "5fc5342c90440fe75be4511bf9874f3f48fb3b13", + "href": "https://github.com/example/harbor/commit/5fc5342c90440fe75be4511bf9874f3f48fb3b13" + } + } + ] + }, + { + "version": "1.3.1", + "date": "2026-11-23", + "previous": "1.3.0", + "summary": "Fixes to the recap, the room timer, the directory and sign-in.", + "entries": [ + { + "id": "pr130-1", + "type": "fixed", + "bump": "patch", + "area": "Directory", + "text": "Fixed a vendor's support line showing the previous vendor's number after you switched rows quickly", + "pr": { + "number": 130, + "href": "https://github.com/example/harbor/pull/130" + }, + "commit": { + "sha": "d5c0cac2cecaee7c66b0d2f15c31ed1ba245ca66", + "href": "https://github.com/example/harbor/commit/d5c0cac2cecaee7c66b0d2f15c31ed1ba245ca66" + } + }, + { + "id": "pr129-1", + "type": "fixed", + "bump": "patch", + "area": "Rooms", + "text": "Fixed the recap starting from the room's first message when you had been away for under a minute", + "pr": { + "number": 129, + "href": "https://github.com/example/harbor/pull/129" + }, + "commit": { + "sha": "d5a5398a6de3d34b72bff90064483ca838cc22c0", + "href": "https://github.com/example/harbor/commit/d5a5398a6de3d34b72bff90064483ca838cc22c0" + } + }, + { + "id": "pr135-1", + "type": "fixed", + "bump": "patch", + "area": "Rooms", + "text": "Fixed the room timer showing 0:00 after a reload", + "pr": { + "number": 135, + "href": "https://github.com/example/harbor/pull/135" + }, + "commit": { + "sha": "e94330f40ba8bd8dce7574923ccc238c5831d573", + "href": "https://github.com/example/harbor/commit/e94330f40ba8bd8dce7574923ccc238c5831d573" + } + }, + { + "id": "pr136-1", + "type": "fixed", + "bump": "patch", + "area": "Sign-in", + "text": "Fixed the code field clearing when you pasted a code", + "pr": { + "number": 136, + "href": "https://github.com/example/harbor/pull/136" + }, + "commit": { + "sha": "79ac5b66ce07b63548e1511a069cd8ebe5eb4b7c", + "href": "https://github.com/example/harbor/commit/79ac5b66ce07b63548e1511a069cd8ebe5eb4b7c" + } + } + ] + }, + { + "version": "1.3.0", + "date": "2026-11-20", + "title": "Updates need a second approval", + "audiences": [ + { + "text": "An update to people outside the room now needs a second commander's approval before it is published.", + "covers": [ + "pr126-1", + "pr126-2" + ] + } + ], + "entries": [ + { + "id": "pr126-1", + "type": "changed", + "bump": "minor", + "area": "Updates", + "text": "Changed published updates to require approval from a second commander, so name a second commander for each room before Dec 1, 2026", + "action": true, + "pr": { + "number": 126, + "href": "https://github.com/example/harbor/pull/126" + }, + "commit": { + "sha": "2c4871d3254c112ba29d82602cc94275572ce257", + "href": "https://github.com/example/harbor/commit/2c4871d3254c112ba29d82602cc94275572ce257" + } + }, + { + "id": "pr126-2", + "type": "added", + "bump": "minor", + "area": "Updates", + "text": "Added an approval request that a second commander can grant or return with a note", + "pr": { + "number": 126, + "href": "https://github.com/example/harbor/pull/126" + }, + "commit": { + "sha": "393ee05942dff95b0943289abdc6ddc0a51ca987", + "href": "https://github.com/example/harbor/commit/393ee05942dff95b0943289abdc6ddc0a51ca987" + } + } + ] + } +] diff --git a/tools/changelog/fixtures/harbor/releases.json b/tools/changelog/fixtures/harbor/releases.json new file mode 100644 index 00000000..379a678e --- /dev/null +++ b/tools/changelog/fixtures/harbor/releases.json @@ -0,0 +1,356 @@ +[ + { + "version": "2.0.0", + "date": "2026-12-07", + "previous": "1.4.0", + "replaces": [ + "2.0.0-rc.1", + "2.0.0-rc.2" + ], + "title": "Responders sign in with their own account", + "summary": "Single sign-on replaces shared room codes, with a sign-in page for your company's identity provider.", + "audiences": [ + { + "text": "Each responder now signs in with their own account, through your company's identity provider.", + "covers": [ + "pr141-1", + "pr142-1" + ] + }, + { + "text": "In Settings, open Sign-in and connect your identity provider. Shared room codes stop working on Jan 15, 2027.", + "covers": [ + "pr140-1", + "pr141-1" + ], + "for": "For admins" + } + ], + "entries": [ + { + "id": "pr140-1", + "type": "removed", + "bump": "major", + "area": "Sign-in", + "text": "Removed sign-in with a shared room code, so each responder signs in with their own account before Jan 15, 2027", + "action": true, + "pr": { + "number": 140, + "href": "https://github.com/example/harbor/pull/140" + }, + "commit": { + "sha": "1f1eabacd6e698c20de36b74406b3daaeda818dd", + "href": "https://github.com/example/harbor/commit/1f1eabacd6e698c20de36b74406b3daaeda818dd" + } + }, + { + "id": "pr141-1", + "type": "added", + "bump": "minor", + "area": "Sign-in", + "text": "Added single sign-on through your company's identity provider", + "pr": { + "number": 141, + "href": "https://github.com/example/harbor/pull/141" + }, + "commit": { + "sha": "e9d0f6591487e04f2d5618d23e6998f8aa5ed398", + "href": "https://github.com/example/harbor/commit/e9d0f6591487e04f2d5618d23e6998f8aa5ed398" + }, + "tickets": [ + { + "tracker": "Linear", + "label": "OPS-230", + "href": "https://linear.app/example/issue/OPS-230" + } + ] + }, + { + "id": "pr142-1", + "type": "added", + "bump": "minor", + "area": "Sign-in", + "text": "Added a sign-in page that names your company's identity provider", + "pr": { + "number": 142, + "href": "https://github.com/example/harbor/pull/142" + }, + "commit": { + "sha": "090709e865e860827cbffa34fc9c12c33481dd35", + "href": "https://github.com/example/harbor/commit/090709e865e860827cbffa34fc9c12c33481dd35" + } + }, + { + "id": "pr143-1", + "type": "fixed", + "bump": "patch", + "area": "Rooms", + "text": "Fixed the room list scrolling to the top when a new room opened", + "pr": { + "number": 143, + "href": "https://github.com/example/harbor/pull/143" + }, + "commit": { + "sha": "07336e6cb9e6ef3e87f17d49313afd5f30f99569", + "href": "https://github.com/example/harbor/commit/07336e6cb9e6ef3e87f17d49313afd5f30f99569" + } + } + ] + }, + { + "version": "1.4.1", + "date": "2026-12-08", + "previous": "1.4.0", + "entries": [ + { + "id": "pr145-1", + "type": "fixed", + "bump": "patch", + "area": "Rooms", + "text": "Fixed the room timer showing 0:00 after a reload in a second tab", + "pr": { + "number": 145, + "href": "https://github.com/example/harbor/pull/145" + }, + "commit": { + "sha": "b87ac424f7c5d86741be5e40def96fcae58503f4", + "href": "https://github.com/example/harbor/commit/b87ac424f7c5d86741be5e40def96fcae58503f4" + } + } + ] + }, + { + "version": "1.4.0", + "date": "2026-11-23", + "previous": "1.3.1", + "title": "A monitor can open an incident room", + "summary": "Monitors can open incident rooms through a webhook, and Home marks the incidents they open. The open incident list keeps its place, and two fixes cover the lobby and search.", + "audiences": [ + { + "text": "A monitor that can send a webhook can now open an incident room when its alarm fires.", + "covers": [ + "pr131-1" + ] + }, + { + "text": "On Home, open an incident marked \"Opened by a monitor\".", + "covers": [ + "pr131-2" + ], + "for": "For responders" + }, + { + "text": "In Settings, open Integrations and add a webhook. Paste its address into your monitor.", + "covers": [ + "pr131-1" + ], + "for": "For admins" + } + ], + "entries": [ + { + "id": "pr131-2", + "type": "added", + "bump": "minor", + "area": "Home", + "text": "Added an \"Opened by a monitor\" mark to incidents that a webhook declared", + "pr": { + "number": 131, + "href": "https://github.com/example/harbor/pull/131" + }, + "commit": { + "sha": "2c1f382d8af35dbf349b6054d80009be806a25e8", + "href": "https://github.com/example/harbor/commit/2c1f382d8af35dbf349b6054d80009be806a25e8" + }, + "authors": [ + "Ada Okoye" + ] + }, + { + "id": "pr131-1", + "type": "added", + "bump": "minor", + "area": "Integrations", + "text": "Added webhook declarations so a monitor can open an incident room when its alarm fires", + "pr": { + "number": 131, + "href": "https://github.com/example/harbor/pull/131" + }, + "commit": { + "sha": "f972daff12326b42cdc2f6cbc77f0c3544476b35", + "href": "https://github.com/example/harbor/commit/f972daff12326b42cdc2f6cbc77f0c3544476b35" + }, + "tickets": [ + { + "tracker": "Linear", + "label": "OPS-204", + "href": "https://linear.app/example/issue/OPS-204" + } + ], + "authors": [ + "Ada Okoye" + ] + }, + { + "id": "pr132-1", + "type": "changed", + "bump": "patch", + "area": "Home", + "text": "Improved the open incident list so your scroll position stays fixed when an incident arrives above it", + "pr": { + "number": 132, + "href": "https://github.com/example/harbor/pull/132" + }, + "commit": { + "sha": "ac34519ba05096cf79627037004d77b7b7a53c62", + "href": "https://github.com/example/harbor/commit/ac34519ba05096cf79627037004d77b7b7a53c62" + } + }, + { + "id": "pr133-1", + "type": "fixed", + "bump": "patch", + "area": "Lobby", + "text": "Fixed \"Waiting to be admitted\" staying on screen after the commander had admitted you, until you reloaded the page", + "pr": { + "number": 133, + "href": "https://github.com/example/harbor/pull/133" + }, + "commit": { + "sha": "8b6460d2486ee68f4ec5cd340b5632b53ab6fc8c", + "href": "https://github.com/example/harbor/commit/8b6460d2486ee68f4ec5cd340b5632b53ab6fc8c" + } + }, + { + "id": "pr134-1", + "type": "fixed", + "bump": "patch", + "area": "Past incidents", + "text": "Fixed search missing an update the commander had published in the last minute", + "pr": { + "number": 134, + "href": "https://github.com/example/harbor/pull/134" + }, + "commit": { + "sha": "5fc5342c90440fe75be4511bf9874f3f48fb3b13", + "href": "https://github.com/example/harbor/commit/5fc5342c90440fe75be4511bf9874f3f48fb3b13" + } + } + ] + }, + { + "version": "1.3.1", + "date": "2026-11-23", + "previous": "1.3.0", + "summary": "Fixes to the recap, the room timer, the directory and sign-in.", + "entries": [ + { + "id": "pr130-1", + "type": "fixed", + "bump": "patch", + "area": "Directory", + "text": "Fixed a vendor's support line showing the previous vendor's number after you switched rows quickly", + "pr": { + "number": 130, + "href": "https://github.com/example/harbor/pull/130" + }, + "commit": { + "sha": "d5c0cac2cecaee7c66b0d2f15c31ed1ba245ca66", + "href": "https://github.com/example/harbor/commit/d5c0cac2cecaee7c66b0d2f15c31ed1ba245ca66" + } + }, + { + "id": "pr129-1", + "type": "fixed", + "bump": "patch", + "area": "Rooms", + "text": "Fixed the recap starting from the room's first message when you had been away for under a minute", + "pr": { + "number": 129, + "href": "https://github.com/example/harbor/pull/129" + }, + "commit": { + "sha": "d5a5398a6de3d34b72bff90064483ca838cc22c0", + "href": "https://github.com/example/harbor/commit/d5a5398a6de3d34b72bff90064483ca838cc22c0" + } + }, + { + "id": "pr135-1", + "type": "fixed", + "bump": "patch", + "area": "Rooms", + "text": "Fixed the room timer showing 0:00 after a reload", + "pr": { + "number": 135, + "href": "https://github.com/example/harbor/pull/135" + }, + "commit": { + "sha": "e94330f40ba8bd8dce7574923ccc238c5831d573", + "href": "https://github.com/example/harbor/commit/e94330f40ba8bd8dce7574923ccc238c5831d573" + } + }, + { + "id": "pr136-1", + "type": "fixed", + "bump": "patch", + "area": "Sign-in", + "text": "Fixed the code field clearing when you pasted a code", + "pr": { + "number": 136, + "href": "https://github.com/example/harbor/pull/136" + }, + "commit": { + "sha": "79ac5b66ce07b63548e1511a069cd8ebe5eb4b7c", + "href": "https://github.com/example/harbor/commit/79ac5b66ce07b63548e1511a069cd8ebe5eb4b7c" + } + } + ] + }, + { + "version": "1.3.0", + "date": "2026-11-20", + "title": "Updates need a second approval", + "audiences": [ + { + "text": "An update to people outside the room now needs a second commander's approval before it is published.", + "covers": [ + "pr126-1", + "pr126-2" + ] + } + ], + "entries": [ + { + "id": "pr126-1", + "type": "changed", + "bump": "minor", + "area": "Updates", + "text": "Changed published updates to require approval from a second commander, so name a second commander for each room before Dec 1, 2026", + "action": true, + "pr": { + "number": 126, + "href": "https://github.com/example/harbor/pull/126" + }, + "commit": { + "sha": "2c4871d3254c112ba29d82602cc94275572ce257", + "href": "https://github.com/example/harbor/commit/2c4871d3254c112ba29d82602cc94275572ce257" + } + }, + { + "id": "pr126-2", + "type": "added", + "bump": "minor", + "area": "Updates", + "text": "Added an approval request that a second commander can grant or return with a note", + "pr": { + "number": 126, + "href": "https://github.com/example/harbor/pull/126" + }, + "commit": { + "sha": "393ee05942dff95b0943289abdc6ddc0a51ca987", + "href": "https://github.com/example/harbor/commit/393ee05942dff95b0943289abdc6ddc0a51ca987" + } + } + ] + } +] diff --git a/tools/changelog/fixtures/make.mjs b/tools/changelog/fixtures/make.mjs new file mode 100644 index 00000000..b7d8d20e --- /dev/null +++ b/tools/changelog/fixtures/make.mjs @@ -0,0 +1,279 @@ +// The fixtures (DECISIONS 320, 6.1): two made-up projects, "Slate" (a package) and "Harbor" (a product), built by running the real tool. +// Every fact in them is invented: the products, versions, dates, pull requests, tickets, people and commits. Nothing is Basalt's or CIMIP's. +// node tools/changelog/fixtures/make.mjs +// It builds each project's history in a temporary git repository (each entry file committed as its own squashed pull request, the notes +// written, then `freeze` run, as a person cutting the release would) with fixed authors and dates, so the commits and every byte written are +// the same on every run. It then copies the config, the records, the pending files, CHANGELOG.md and the page's data (`releases.json`) here. +import { execFileSync } from "node:child_process"; +import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +import { freeze } from "../release.mjs"; +import { loadConfig } from "../config.mjs"; +import { pageReleases, readRecords } from "../records.mjs"; + +const HERE = path.dirname(fileURLToPath(import.meta.url)); + +// ---------- Slate: a package, in 0.x ---------- + +export const SLATE = { + name: "slate", + config: { + product: "Slate", + repository: "https://github.com/example/slate", + trackers: [ + { name: "Linear", pattern: "(?:SL|DS)-[1-9][0-9]*", url: "https://linear.app/example/issue/{id}" }, + { name: "Jira", pattern: "PRJ-[1-9][0-9]*", url: "https://example.atlassian.net/browse/{id}", show: "text" }, + { name: "GitHub", pattern: "slate#(?<n>[1-9][0-9]*)", url: "https://github.com/example/slate/issues/{n}", label: "issue #{n}" }, + { name: "Support", pattern: "SUP-[1-9][0-9]*", show: "none" }, + ], + people: { sam: { name: "Sam Rivera" } }, + }, + steps: [ + { notes: { summary: "The first version in this changelog. Earlier work is in the repository's history." }, version: "0.1.0", date: "2026-11-02" }, + { + entries: [ + { id: "pr41-1", pr: 41, type: "changed", area: "Grid", bump: "major", action: true, author: "sam", tickets: ["SL-112", "PRJ-88"], migration: "docs/migrating.md#grid-frame", text: "Changed the parent layout item for `Grid` to `.slate-grid-frame`, where existing sizing rules must move" }, + { id: "pr41-2", pr: 41, type: "changed", area: "storedCount", bump: "major", action: true, migration: "docs/migrating.md#stored-counts", text: "Changed stored counts to require an explicit store, so pass `() => localStorage` when reading, writing or clearing old counts" }, + { id: "pr42-1", pr: 42, type: "changed", area: "fillForm", bump: "major", action: true, text: "Changed `fillForm` to keep null fields empty, so omit unknown fields or pass `undefined`" }, + { id: "pr43-1", pr: 43, type: "changed", area: "TableHeader", bump: "major", action: true, text: "Changed fixed `TableHeader` cells to show a supplied `hint`, so remove that prop where a header should stay plain" }, + { id: "pr44-1", pr: 44, type: "deprecated", area: "Banner", text: "Deprecated `Banner` in favor of `Notice`, which takes the same props, removed in 1.0.0 no earlier than Mar 1, 2027" }, + { id: "pr45-1", pr: 45, type: "added", area: "Composer", author: "sam", tickets: ["SL-120"], text: "Added `Composer`, a message field that grows from 2 to 8 rows, with Send last and a status line under it" }, + { id: "pr45-2", pr: 45, type: "added", area: "Mention", text: "Added `Mention` to show a name after @ and mark a mention of the reader when `you` is set" }, + { id: "pr46-1", pr: 46, type: "added", area: "Tokens", tickets: ["DS-27", "DS-31", "PRJ-90", "slate#45", "SL-131", "SUP-7"], text: "Added `--slate-plate` for a highlighted row's solid fill on its current surface level" }, + { id: "pr47-1", pr: 47, type: "changed", area: "Toast", bump: "minor", text: "Changed toasts on phones to sit 8px below the top bar instead of above the bottom tabs" }, + { id: "pr48-1", pr: 48, type: "fixed", area: "Checkbox", tickets: ["slate#45"], text: "Fixed scrolling checkbox lists adding empty space below the page inside a sticky container" }, + { id: "pr49-1", pr: 49, type: "fixed", area: "SelectList", text: "Fixed keyboard focus leaving `SelectList` when the focused row was removed" }, + { id: "pr49-2", pr: 49, type: "fixed", area: "Sheet", text: "Fixed clipped focus rings at the top and bottom of a sheet's scrolling body" }, + { id: "pr50-1", pr: 50, type: "fixed", area: "Sidebar", text: "Fixed the brand mark sitting off center when the sidebar collapsed to its rail" }, + { id: "docs-contrast-note", type: "fixed", area: "Docs", text: "Fixed the contrast table listing secondary ink on the sunken band at 4.1:1, where it measures 4.6:1" }, + ], + notes: { summary: "Slate 0.2.0 adds a composer with mentions and a plate token for highlighted rows. Check existing layout rules and stored data before upgrading." }, + version: "0.2.0", + date: "2026-11-16", + }, + { entries: [{ id: "pr52-1", pr: 52, type: "fixed", area: "Composer", text: "Fixed `Composer` losing its draft when the window lost focus" }], version: "0.2.1", date: "2026-11-16" }, + { + entries: [ + { id: "pr53-1", pr: 53, type: "changed", area: "Chart", bump: "patch", text: "Changed production builds to leave out development checks, so the minified `Chart` module is 3,227 bytes smaller" }, + { id: "pr54-1", pr: 54, type: "fixed", area: "Chart", text: "Fixed blurry labels on 1px chart lines when a label fell between whole pixels" }, + ], + }, + ], +}; + +// ---------- Harbor: a product, from 1.x, with a maintained older line ---------- + +export const HARBOR = { + name: "harbor", + config: { + product: "Harbor", + repository: "https://github.com/example/harbor", + form: "notes", + trackers: [{ name: "Linear", pattern: "OPS-[1-9][0-9]*", url: "https://linear.app/example/issue/{id}" }], + people: { ada: { name: "Ada Okoye" } }, + }, + steps: [ + { + entries: [ + { id: "pr126-1", pr: 126, type: "changed", area: "Updates", bump: "minor", action: true, text: "Changed published updates to require approval from a second commander, so name a second commander for each room before Dec 1, 2026" }, + { id: "pr126-2", pr: 126, type: "added", area: "Updates", text: "Added an approval request that a second commander can grant or return with a note" }, + ], + notes: { title: "Updates need a second approval", audiences: [{ covers: ["pr126-1", "pr126-2"], text: "An update to people outside the room now needs a second commander's approval before it is published." }] }, + version: "1.3.0", + date: "2026-11-20", + }, + { + entries: [ + { id: "pr129-1", pr: 129, type: "fixed", area: "Rooms", text: "Fixed the recap starting from the room's first message when you had been away for under a minute" }, + { id: "pr130-1", pr: 130, type: "fixed", area: "Directory", text: "Fixed a vendor's support line showing the previous vendor's number after you switched rows quickly" }, + { id: "pr135-1", pr: 135, type: "fixed", area: "Rooms", text: "Fixed the room timer showing 0:00 after a reload" }, + { id: "pr136-1", pr: 136, type: "fixed", area: "Sign-in", text: "Fixed the code field clearing when you pasted a code" }, + ], + notes: { summary: "Fixes to the recap, the room timer, the directory and sign-in." }, + version: "1.3.1", + date: "2026-11-23", + }, + { + entries: [ + { id: "pr131-1", pr: 131, type: "added", area: "Integrations", author: "ada", tickets: ["OPS-204"], text: "Added webhook declarations so a monitor can open an incident room when its alarm fires" }, + { id: "pr131-2", pr: 131, type: "added", area: "Home", author: "ada", text: "Added an \"Opened by a monitor\" mark to incidents that a webhook declared" }, + { id: "pr132-1", pr: 132, type: "changed", area: "Home", bump: "patch", text: "Improved the open incident list so your scroll position stays fixed when an incident arrives above it" }, + { id: "pr133-1", pr: 133, type: "fixed", area: "Lobby", text: "Fixed \"Waiting to be admitted\" staying on screen after the commander had admitted you, until you reloaded the page" }, + { id: "pr134-1", pr: 134, type: "fixed", area: "Past incidents", text: "Fixed search missing an update the commander had published in the last minute" }, + ], + notes: { + title: "A monitor can open an incident room", + summary: "Monitors can open incident rooms through a webhook, and Home marks the incidents they open. The open incident list keeps its place, and two fixes cover the lobby and search.", + audiences: [ + { covers: ["pr131-1"], text: "A monitor that can send a webhook can now open an incident room when its alarm fires." }, + { for: "For responders", covers: ["pr131-2"], text: "On Home, open an incident marked \"Opened by a monitor\"." }, + { for: "For admins", covers: ["pr131-1"], text: "In Settings, open Integrations and add a webhook. Paste its address into your monitor." }, + ], + }, + version: "1.4.0", + date: "2026-11-23", + }, + { branch: "release/1.x", from: "1.4.0" }, + { + entries: [ + { id: "pr140-1", pr: 140, type: "removed", area: "Sign-in", action: true, text: "Removed sign-in with a shared room code, so each responder signs in with their own account before Jan 15, 2027" }, + { id: "pr141-1", pr: 141, type: "added", area: "Sign-in", tickets: ["OPS-230"], text: "Added single sign-on through your company's identity provider" }, + ], + notes: { + title: "Responders sign in with their own account", + audiences: [ + { covers: ["pr141-1"], text: "Each responder now signs in with their own account, through your company's identity provider." }, + { for: "For admins", covers: ["pr140-1", "pr141-1"], text: "In Settings, open Sign-in and connect your identity provider. Shared room codes stop working on Jan 15, 2027." }, + ], + }, + version: "2.0.0-rc.1", + date: "2026-12-01", + }, + { + entries: [{ id: "pr142-1", pr: 142, type: "added", area: "Sign-in", text: "Added a sign-in page that names your company's identity provider" }], + notes: { + title: "A sign-in page names your identity provider", + audiences: [{ covers: ["pr142-1"], text: "The sign-in page now names your company's identity provider, so responders know which account to use." }], + }, + version: "2.0.0-rc.2", + date: "2026-12-03", + }, + { + entries: [{ id: "pr143-1", pr: 143, type: "fixed", area: "Rooms", text: "Fixed the room list scrolling to the top when a new room opened" }], + notes: { + title: "Responders sign in with their own account", + summary: "Single sign-on replaces shared room codes, with a sign-in page for your company's identity provider.", + audiences: [ + { covers: ["pr141-1", "pr142-1"], text: "Each responder now signs in with their own account, through your company's identity provider." }, + { for: "For admins", covers: ["pr140-1", "pr141-1"], text: "In Settings, open Sign-in and connect your identity provider. Shared room codes stop working on Jan 15, 2027." }, + ], + }, + version: "2.0.0", + date: "2026-12-07", + }, + { + branch: "release/1.x", + entries: [{ id: "pr145-1", pr: 145, type: "fixed", area: "Rooms", text: "Fixed the room timer showing 0:00 after a reload in a second tab" }], + version: "1.4.1", + date: "2026-12-08", + // A maintained line's record is added to the default branch by a pull request, because the page is built there. + backTo: "main", + }, + ], +}; + +// ---------- the build ---------- + +const entryFile = (entry) => { + const head = ["---", `type: ${entry.type}`]; + if (entry.area) head.push(`area: ${entry.area}`); + if (entry.pr) head.push(`pr: ${entry.pr}`); + if (entry.author) head.push(`author: ${entry.author}`); + if (entry.tickets) head.push(`tickets: [${entry.tickets.join(", ")}]`); + if (entry.bump) head.push(`bump: ${entry.bump}`); + if (entry.action) head.push("action: true"); + if (entry.migration) head.push(`migration: ${entry.migration}`); + return `${head.join("\n")}\n---\n${entry.text}\n`; +}; + +const notesFile = (notes) => { + const head = ["---"]; + if (notes.title) head.push(`title: ${notes.title}`); + if (notes.summary) head.push(`summary: ${notes.summary}`); + head.push("---"); + const blocks = (notes.audiences ?? []).map((audience) => `${audience.for ? `## ${audience.for}\n` : ""}covers: [${audience.covers.join(", ")}]\n${audience.text}\n`); + return `${head.join("\n")}\n${blocks.join("\n")}`; +}; + +/** Build one project's history in a fresh repository and return its path. */ +export function buildRepository(project, dir = fs.mkdtempSync(path.join(os.tmpdir(), `changelog-${project.name}-`))) { + let clock = Date.UTC(2026, 9, 1, 12); + const env = () => { + clock += 60_000; + const when = new Date(clock).toISOString(); + return { ...process.env, GIT_AUTHOR_NAME: "Example", GIT_AUTHOR_EMAIL: "example@example.com", GIT_COMMITTER_NAME: "Example", GIT_COMMITTER_EMAIL: "example@example.com", GIT_AUTHOR_DATE: when, GIT_COMMITTER_DATE: when }; + }; + const git = (...args) => execFileSync("git", args, { cwd: dir, env: env(), encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim(); + git("init", "-q", "-b", "main"); + git("config", "commit.gpgsign", "false"); + fs.writeFileSync(path.join(dir, "changelog.config.json"), `${JSON.stringify(project.config, null, 2)}\n`); + git("add", "-A"); + git("commit", "-q", "-m", "Start"); + for (const step of project.steps) { + if (step.from) { + git("branch", step.branch, `v${step.from}`); + continue; + } + if (step.branch) git("checkout", "-q", step.branch); + for (const entry of step.entries ?? []) { + fs.mkdirSync(path.join(dir, ".changes"), { recursive: true }); + fs.writeFileSync(path.join(dir, ".changes", `${entry.id}.md`), entryFile(entry)); + git("add", "-A"); + git("commit", "-q", "-m", entry.pr ? `${entry.area}: ${entry.text.split(" ").slice(0, 6).join(" ")} (#${entry.pr})` : `${entry.area}: ${entry.text.split(" ").slice(0, 6).join(" ")}`); + } + if (!step.version) continue; + const notes = path.join(dir, ".changes", "release.md"); + if (step.notes) { + fs.mkdirSync(path.dirname(notes), { recursive: true }); + fs.writeFileSync(notes, notesFile(step.notes)); + git("add", "-A"); + git("commit", "-q", "-m", `Release notes for ${step.version}`); + } + freeze({ root: dir, version: step.version, date: step.date }); + git("add", "-A"); + git("commit", "-q", "-m", `Release ${step.version}`); + git("tag", `v${step.version}`); + if (step.backTo) { + const record = fs.readFileSync(path.join(dir, "changelog", "releases", `${step.version}.json`), "utf8"); + git("checkout", "-q", step.backTo); + fs.writeFileSync(path.join(dir, "changelog", "releases", `${step.version}.json`), record); + // The default branch's CHANGELOG.md is regenerated with the record in it. + const { changelogMarkdown } = OUTPUTS; + const config = loadConfig(dir); + fs.writeFileSync(path.join(dir, "CHANGELOG.md"), changelogMarkdown(pageReleases(dir, { config }), { product: config.product, form: config.form })); + git("add", "-A"); + git("commit", "-q", "-m", `Add the ${step.version} record (#146)`); + } else if (step.branch) { + git("checkout", "-q", "main"); + } + } + return dir; +} + +const OUTPUTS = await import("../outputs.mjs"); + +/** Copy what a project's repository holds into its fixture folder (or `out`). */ +export function copyOut(project, dir, out = path.join(HERE, project.name)) { + fs.rmSync(out, { recursive: true, force: true }); + fs.mkdirSync(path.join(out, "changelog", "releases"), { recursive: true }); + fs.copyFileSync(path.join(dir, "changelog.config.json"), path.join(out, "changelog.config.json")); + for (const name of fs.readdirSync(path.join(dir, "changelog", "releases"))) fs.copyFileSync(path.join(dir, "changelog", "releases", name), path.join(out, "changelog", "releases", name)); + const changes = path.join(dir, ".changes"); + if (fs.existsSync(changes) && fs.readdirSync(changes).length) { + fs.mkdirSync(path.join(out, ".changes")); + for (const name of fs.readdirSync(changes)) fs.copyFileSync(path.join(changes, name), path.join(out, ".changes", name)); + } + // Entries merged since the last release are in CHANGELOG.md's Unreleased section, as `node tools/changelog/build.mjs` writes it. + const config = loadConfig(out); + const releases = pageReleases(out, { config }); + fs.writeFileSync(path.join(out, "CHANGELOG.md"), OUTPUTS.changelogMarkdown(releases, { product: config.product, form: config.form })); + fs.writeFileSync(path.join(out, "releases.json"), `${JSON.stringify(releases, null, 2)}\n`); + // Harbor as it stood before 2.0.0 shipped: the page with its two candidates drawn (the review round's Pre-release picture, the arrival tests). + if (project.name === "harbor") { + const records = readRecords(out).filter((record) => record.version !== "2.0.0"); + fs.writeFileSync(path.join(out, "releases-candidate.json"), `${JSON.stringify(pageReleases(out, { config, records, pending: [] }), null, 2)}\n`); + } +} + +const { isMain } = await import("../../../scripts/is-main.mjs"); +if (isMain(import.meta.url)) { + for (const project of [SLATE, HARBOR]) { + const dir = buildRepository(project); + copyOut(project, dir); + fs.rmSync(dir, { recursive: true, force: true }); + process.stdout.write(`Wrote tools/changelog/fixtures/${project.name}\n`); + } +} diff --git a/tools/changelog/fixtures/slate/.changes/pr53-1.md b/tools/changelog/fixtures/slate/.changes/pr53-1.md new file mode 100644 index 00000000..170c9b52 --- /dev/null +++ b/tools/changelog/fixtures/slate/.changes/pr53-1.md @@ -0,0 +1,7 @@ +--- +type: changed +area: Chart +pr: 53 +bump: patch +--- +Changed production builds to leave out development checks, so the minified `Chart` module is 3,227 bytes smaller diff --git a/tools/changelog/fixtures/slate/.changes/pr54-1.md b/tools/changelog/fixtures/slate/.changes/pr54-1.md new file mode 100644 index 00000000..d117f114 --- /dev/null +++ b/tools/changelog/fixtures/slate/.changes/pr54-1.md @@ -0,0 +1,6 @@ +--- +type: fixed +area: Chart +pr: 54 +--- +Fixed blurry labels on 1px chart lines when a label fell between whole pixels diff --git a/tools/changelog/fixtures/slate/CHANGELOG.md b/tools/changelog/fixtures/slate/CHANGELOG.md new file mode 100644 index 00000000..08123620 --- /dev/null +++ b/tools/changelog/fixtures/slate/CHANGELOG.md @@ -0,0 +1,58 @@ +# Changelog + +Every version of Slate. This file is generated by `tools/changelog` from `changelog/releases` and `.changes`. Edit those, never this file. + +## Unreleased + +### Changed + +- Chart: Changed production builds to leave out development checks, so the minified `Chart` module is 3,227 bytes smaller ([#53](https://github.com/example/slate/pull/53)) + +### Fixed + +- Chart: Fixed blurry labels on 1px chart lines when a label fell between whole pixels ([#54](https://github.com/example/slate/pull/54)) + +## 0.2.1 - 2026-11-16 + +### Fixed + +- Composer: Fixed `Composer` losing its draft when the window lost focus ([#52](https://github.com/example/slate/pull/52)) + +## 0.2.0 - 2026-11-16 + +Slate 0.2.0 adds a composer with mentions and a plate token for highlighted rows. Check existing layout rules and stored data before upgrading. + +### Action needed + +Before upgrading from 0.1.0, check these 4 changes. + +- fillForm: Changed `fillForm` to keep null fields empty, so omit unknown fields or pass `undefined` ([#42](https://github.com/example/slate/pull/42)) +- Grid: Changed the parent layout item for `Grid` to `.slate-grid-frame`, where existing sizing rules must move [How to migrate](https://github.com/example/slate/blob/v0.2.0/docs/migrating.md#grid-frame) ([#41](https://github.com/example/slate/pull/41), Linear [SL-112](https://linear.app/example/issue/SL-112), Jira PRJ-88) +- storedCount: Changed stored counts to require an explicit store, so pass `() => localStorage` when reading, writing or clearing old counts [How to migrate](https://github.com/example/slate/blob/v0.2.0/docs/migrating.md#stored-counts) ([#41](https://github.com/example/slate/pull/41)) +- TableHeader: Changed fixed `TableHeader` cells to show a supplied `hint`, so remove that prop where a header should stay plain ([#43](https://github.com/example/slate/pull/43)) + +### Deprecated + +- Banner: Deprecated `Banner` in favor of `Notice`, which takes the same props, removed in 1.0.0 no earlier than Mar 1, 2027 ([#44](https://github.com/example/slate/pull/44)) + +### Added + +- Composer: Added `Composer`, a message field that grows from 2 to 8 rows, with Send last and a status line under it ([#45](https://github.com/example/slate/pull/45), Linear [SL-120](https://linear.app/example/issue/SL-120)) +- Mention: Added `Mention` to show a name after @ and mark a mention of the reader when `you` is set ([#45](https://github.com/example/slate/pull/45)) +- Tokens: Added `--slate-plate` for a highlighted row's solid fill on its current surface level ([#46](https://github.com/example/slate/pull/46), Linear [DS-27](https://linear.app/example/issue/DS-27), Linear [DS-31](https://linear.app/example/issue/DS-31), Jira PRJ-90, GitHub [issue #45](https://github.com/example/slate/issues/45), Linear [SL-131](https://linear.app/example/issue/SL-131)) + +### Changed + +- Toast: Changed toasts on phones to sit 8px below the top bar instead of above the bottom tabs ([#47](https://github.com/example/slate/pull/47)) + +### Fixed + +- Checkbox: Fixed scrolling checkbox lists adding empty space below the page inside a sticky container ([#48](https://github.com/example/slate/pull/48), GitHub [issue #45](https://github.com/example/slate/issues/45)) +- Docs: Fixed the contrast table listing secondary ink on the sunken band at 4.1:1, where it measures 4.6:1 ([b703be2f](https://github.com/example/slate/commit/b703be2fcc41217ae7ab767e7987389c3e954f30)) +- SelectList: Fixed keyboard focus leaving `SelectList` when the focused row was removed ([#49](https://github.com/example/slate/pull/49)) +- Sheet: Fixed clipped focus rings at the top and bottom of a sheet's scrolling body ([#49](https://github.com/example/slate/pull/49)) +- Sidebar: Fixed the brand mark sitting off center when the sidebar collapsed to its rail ([#50](https://github.com/example/slate/pull/50)) + +## 0.1.0 - 2026-11-02 + +The first version in this changelog. Earlier work is in the repository's history. diff --git a/tools/changelog/fixtures/slate/changelog.config.json b/tools/changelog/fixtures/slate/changelog.config.json new file mode 100644 index 00000000..22c0931b --- /dev/null +++ b/tools/changelog/fixtures/slate/changelog.config.json @@ -0,0 +1,33 @@ +{ + "product": "Slate", + "repository": "https://github.com/example/slate", + "trackers": [ + { + "name": "Linear", + "pattern": "(?:SL|DS)-[1-9][0-9]*", + "url": "https://linear.app/example/issue/{id}" + }, + { + "name": "Jira", + "pattern": "PRJ-[1-9][0-9]*", + "url": "https://example.atlassian.net/browse/{id}", + "show": "text" + }, + { + "name": "GitHub", + "pattern": "slate#(?<n>[1-9][0-9]*)", + "url": "https://github.com/example/slate/issues/{n}", + "label": "issue #{n}" + }, + { + "name": "Support", + "pattern": "SUP-[1-9][0-9]*", + "show": "none" + } + ], + "people": { + "sam": { + "name": "Sam Rivera" + } + } +} diff --git a/tools/changelog/fixtures/slate/changelog/releases/0.1.0.json b/tools/changelog/fixtures/slate/changelog/releases/0.1.0.json new file mode 100644 index 00000000..b7523e51 --- /dev/null +++ b/tools/changelog/fixtures/slate/changelog/releases/0.1.0.json @@ -0,0 +1,7 @@ +{ + "version": "0.1.0", + "date": "2026-11-02", + "repository": "https://github.com/example/slate", + "summary": "The first version in this changelog. Earlier work is in the repository's history.", + "entries": [] +} diff --git a/tools/changelog/fixtures/slate/changelog/releases/0.2.0.json b/tools/changelog/fixtures/slate/changelog/releases/0.2.0.json new file mode 100644 index 00000000..ba514c09 --- /dev/null +++ b/tools/changelog/fixtures/slate/changelog/releases/0.2.0.json @@ -0,0 +1,308 @@ +{ + "version": "0.2.0", + "date": "2026-11-16", + "previous": "0.1.0", + "repository": "https://github.com/example/slate", + "summary": "Slate 0.2.0 adds a composer with mentions and a plate token for highlighted rows. Check existing layout rules and stored data before upgrading.", + "entries": [ + { + "id": "pr42-1", + "type": "changed", + "bump": "major", + "area": "fillForm", + "text": "Changed `fillForm` to keep null fields empty, so omit unknown fields or pass `undefined`", + "action": true, + "pr": { + "number": 42, + "href": "https://github.com/example/slate/pull/42" + }, + "commit": { + "sha": "82fb3df79be2ac6451f4589e55eb79951b1f4086", + "href": "https://github.com/example/slate/commit/82fb3df79be2ac6451f4589e55eb79951b1f4086" + } + }, + { + "id": "pr41-1", + "type": "changed", + "bump": "major", + "area": "Grid", + "text": "Changed the parent layout item for `Grid` to `.slate-grid-frame`, where existing sizing rules must move", + "action": true, + "link": { + "label": "How to migrate", + "href": "https://github.com/example/slate/blob/v0.2.0/docs/migrating.md#grid-frame" + }, + "pr": { + "number": 41, + "href": "https://github.com/example/slate/pull/41" + }, + "commit": { + "sha": "678c43d8a10a4ae7c62a1da937f08d4b42680f42", + "href": "https://github.com/example/slate/commit/678c43d8a10a4ae7c62a1da937f08d4b42680f42" + }, + "tickets": [ + { + "tracker": "Linear", + "id": "SL-112", + "label": "SL-112", + "show": "link", + "href": "https://linear.app/example/issue/SL-112" + }, + { + "tracker": "Jira", + "id": "PRJ-88", + "label": "PRJ-88", + "show": "text" + } + ], + "authors": [ + "Sam Rivera" + ] + }, + { + "id": "pr41-2", + "type": "changed", + "bump": "major", + "area": "storedCount", + "text": "Changed stored counts to require an explicit store, so pass `() => localStorage` when reading, writing or clearing old counts", + "action": true, + "link": { + "label": "How to migrate", + "href": "https://github.com/example/slate/blob/v0.2.0/docs/migrating.md#stored-counts" + }, + "pr": { + "number": 41, + "href": "https://github.com/example/slate/pull/41" + }, + "commit": { + "sha": "69d07142a7bb472c3ddb4dd2b4030ce29823a57f", + "href": "https://github.com/example/slate/commit/69d07142a7bb472c3ddb4dd2b4030ce29823a57f" + } + }, + { + "id": "pr43-1", + "type": "changed", + "bump": "major", + "area": "TableHeader", + "text": "Changed fixed `TableHeader` cells to show a supplied `hint`, so remove that prop where a header should stay plain", + "action": true, + "pr": { + "number": 43, + "href": "https://github.com/example/slate/pull/43" + }, + "commit": { + "sha": "897fa5905a841db8f081670aa625c18ce6f6b1aa", + "href": "https://github.com/example/slate/commit/897fa5905a841db8f081670aa625c18ce6f6b1aa" + } + }, + { + "id": "pr44-1", + "type": "deprecated", + "bump": "minor", + "area": "Banner", + "text": "Deprecated `Banner` in favor of `Notice`, which takes the same props, removed in 1.0.0 no earlier than Mar 1, 2027", + "pr": { + "number": 44, + "href": "https://github.com/example/slate/pull/44" + }, + "commit": { + "sha": "5e5902046b8892bbe63216e16af0647c10a744ee", + "href": "https://github.com/example/slate/commit/5e5902046b8892bbe63216e16af0647c10a744ee" + } + }, + { + "id": "pr45-1", + "type": "added", + "bump": "minor", + "area": "Composer", + "text": "Added `Composer`, a message field that grows from 2 to 8 rows, with Send last and a status line under it", + "pr": { + "number": 45, + "href": "https://github.com/example/slate/pull/45" + }, + "commit": { + "sha": "5e84c6544e6bfee98d639cbe6b81091279cf846e", + "href": "https://github.com/example/slate/commit/5e84c6544e6bfee98d639cbe6b81091279cf846e" + }, + "tickets": [ + { + "tracker": "Linear", + "id": "SL-120", + "label": "SL-120", + "show": "link", + "href": "https://linear.app/example/issue/SL-120" + } + ], + "authors": [ + "Sam Rivera" + ] + }, + { + "id": "pr45-2", + "type": "added", + "bump": "minor", + "area": "Mention", + "text": "Added `Mention` to show a name after @ and mark a mention of the reader when `you` is set", + "pr": { + "number": 45, + "href": "https://github.com/example/slate/pull/45" + }, + "commit": { + "sha": "bf14c30afcb2e3321134233c7d6cc5a7069e6997", + "href": "https://github.com/example/slate/commit/bf14c30afcb2e3321134233c7d6cc5a7069e6997" + } + }, + { + "id": "pr47-1", + "type": "changed", + "bump": "minor", + "area": "Toast", + "text": "Changed toasts on phones to sit 8px below the top bar instead of above the bottom tabs", + "pr": { + "number": 47, + "href": "https://github.com/example/slate/pull/47" + }, + "commit": { + "sha": "6305bea62d1eeffb606f12efb6d568f8c2704144", + "href": "https://github.com/example/slate/commit/6305bea62d1eeffb606f12efb6d568f8c2704144" + } + }, + { + "id": "pr46-1", + "type": "added", + "bump": "minor", + "area": "Tokens", + "text": "Added `--slate-plate` for a highlighted row's solid fill on its current surface level", + "pr": { + "number": 46, + "href": "https://github.com/example/slate/pull/46" + }, + "commit": { + "sha": "01bba6343c13e202aebb88cac07e25063f90eac4", + "href": "https://github.com/example/slate/commit/01bba6343c13e202aebb88cac07e25063f90eac4" + }, + "tickets": [ + { + "tracker": "Linear", + "id": "DS-27", + "label": "DS-27", + "show": "link", + "href": "https://linear.app/example/issue/DS-27" + }, + { + "tracker": "Linear", + "id": "DS-31", + "label": "DS-31", + "show": "link", + "href": "https://linear.app/example/issue/DS-31" + }, + { + "tracker": "Jira", + "id": "PRJ-90", + "label": "PRJ-90", + "show": "text" + }, + { + "tracker": "GitHub", + "id": "slate#45", + "label": "issue #45", + "show": "link", + "href": "https://github.com/example/slate/issues/45" + }, + { + "tracker": "Linear", + "id": "SL-131", + "label": "SL-131", + "show": "link", + "href": "https://linear.app/example/issue/SL-131" + }, + { + "tracker": "Support", + "id": "SUP-7", + "label": "SUP-7", + "show": "none" + } + ] + }, + { + "id": "pr48-1", + "type": "fixed", + "bump": "patch", + "area": "Checkbox", + "text": "Fixed scrolling checkbox lists adding empty space below the page inside a sticky container", + "pr": { + "number": 48, + "href": "https://github.com/example/slate/pull/48" + }, + "commit": { + "sha": "3f842bfcee12cbbfc899975588325fc12cdc7772", + "href": "https://github.com/example/slate/commit/3f842bfcee12cbbfc899975588325fc12cdc7772" + }, + "tickets": [ + { + "tracker": "GitHub", + "id": "slate#45", + "label": "issue #45", + "show": "link", + "href": "https://github.com/example/slate/issues/45" + } + ] + }, + { + "id": "docs-contrast-note", + "type": "fixed", + "bump": "patch", + "area": "Docs", + "text": "Fixed the contrast table listing secondary ink on the sunken band at 4.1:1, where it measures 4.6:1", + "commit": { + "sha": "b703be2fcc41217ae7ab767e7987389c3e954f30", + "href": "https://github.com/example/slate/commit/b703be2fcc41217ae7ab767e7987389c3e954f30" + } + }, + { + "id": "pr49-1", + "type": "fixed", + "bump": "patch", + "area": "SelectList", + "text": "Fixed keyboard focus leaving `SelectList` when the focused row was removed", + "pr": { + "number": 49, + "href": "https://github.com/example/slate/pull/49" + }, + "commit": { + "sha": "71c54b0a5104dca190cad0815a4a72304b3c259a", + "href": "https://github.com/example/slate/commit/71c54b0a5104dca190cad0815a4a72304b3c259a" + } + }, + { + "id": "pr49-2", + "type": "fixed", + "bump": "patch", + "area": "Sheet", + "text": "Fixed clipped focus rings at the top and bottom of a sheet's scrolling body", + "pr": { + "number": 49, + "href": "https://github.com/example/slate/pull/49" + }, + "commit": { + "sha": "f8eb7a17a49c2cbd289f8a6c323787918d5d8c01", + "href": "https://github.com/example/slate/commit/f8eb7a17a49c2cbd289f8a6c323787918d5d8c01" + } + }, + { + "id": "pr50-1", + "type": "fixed", + "bump": "patch", + "area": "Sidebar", + "text": "Fixed the brand mark sitting off center when the sidebar collapsed to its rail", + "pr": { + "number": 50, + "href": "https://github.com/example/slate/pull/50" + }, + "commit": { + "sha": "fc8a00590e637a58f13d8b87c6927f6afd34c439", + "href": "https://github.com/example/slate/commit/fc8a00590e637a58f13d8b87c6927f6afd34c439" + } + } + ] +} diff --git a/tools/changelog/fixtures/slate/changelog/releases/0.2.1.json b/tools/changelog/fixtures/slate/changelog/releases/0.2.1.json new file mode 100644 index 00000000..bbeb0fbf --- /dev/null +++ b/tools/changelog/fixtures/slate/changelog/releases/0.2.1.json @@ -0,0 +1,23 @@ +{ + "version": "0.2.1", + "date": "2026-11-16", + "previous": "0.2.0", + "repository": "https://github.com/example/slate", + "entries": [ + { + "id": "pr52-1", + "type": "fixed", + "bump": "patch", + "area": "Composer", + "text": "Fixed `Composer` losing its draft when the window lost focus", + "pr": { + "number": 52, + "href": "https://github.com/example/slate/pull/52" + }, + "commit": { + "sha": "eb8028ba88c28077a2106030c2692135bb638d6f", + "href": "https://github.com/example/slate/commit/eb8028ba88c28077a2106030c2692135bb638d6f" + } + } + ] +} diff --git a/tools/changelog/fixtures/slate/releases.json b/tools/changelog/fixtures/slate/releases.json new file mode 100644 index 00000000..d25cb6b8 --- /dev/null +++ b/tools/changelog/fixtures/slate/releases.json @@ -0,0 +1,341 @@ +[ + { + "version": "Unreleased", + "unreleased": true, + "entries": [ + { + "id": "pr53-1", + "type": "changed", + "bump": "patch", + "area": "Chart", + "text": "Changed production builds to leave out development checks, so the minified `Chart` module is 3,227 bytes smaller", + "pr": { + "number": 53, + "href": "https://github.com/example/slate/pull/53" + } + }, + { + "id": "pr54-1", + "type": "fixed", + "bump": "patch", + "area": "Chart", + "text": "Fixed blurry labels on 1px chart lines when a label fell between whole pixels", + "pr": { + "number": 54, + "href": "https://github.com/example/slate/pull/54" + } + } + ] + }, + { + "version": "0.2.1", + "date": "2026-11-16", + "previous": "0.2.0", + "entries": [ + { + "id": "pr52-1", + "type": "fixed", + "bump": "patch", + "area": "Composer", + "text": "Fixed `Composer` losing its draft when the window lost focus", + "pr": { + "number": 52, + "href": "https://github.com/example/slate/pull/52" + }, + "commit": { + "sha": "eb8028ba88c28077a2106030c2692135bb638d6f", + "href": "https://github.com/example/slate/commit/eb8028ba88c28077a2106030c2692135bb638d6f" + } + } + ] + }, + { + "version": "0.2.0", + "date": "2026-11-16", + "previous": "0.1.0", + "summary": "Slate 0.2.0 adds a composer with mentions and a plate token for highlighted rows. Check existing layout rules and stored data before upgrading.", + "entries": [ + { + "id": "pr42-1", + "type": "changed", + "bump": "major", + "area": "fillForm", + "text": "Changed `fillForm` to keep null fields empty, so omit unknown fields or pass `undefined`", + "action": true, + "pr": { + "number": 42, + "href": "https://github.com/example/slate/pull/42" + }, + "commit": { + "sha": "82fb3df79be2ac6451f4589e55eb79951b1f4086", + "href": "https://github.com/example/slate/commit/82fb3df79be2ac6451f4589e55eb79951b1f4086" + } + }, + { + "id": "pr41-1", + "type": "changed", + "bump": "major", + "area": "Grid", + "text": "Changed the parent layout item for `Grid` to `.slate-grid-frame`, where existing sizing rules must move", + "action": true, + "link": { + "label": "How to migrate", + "href": "https://github.com/example/slate/blob/v0.2.0/docs/migrating.md#grid-frame" + }, + "pr": { + "number": 41, + "href": "https://github.com/example/slate/pull/41" + }, + "commit": { + "sha": "678c43d8a10a4ae7c62a1da937f08d4b42680f42", + "href": "https://github.com/example/slate/commit/678c43d8a10a4ae7c62a1da937f08d4b42680f42" + }, + "tickets": [ + { + "tracker": "Linear", + "label": "SL-112", + "href": "https://linear.app/example/issue/SL-112" + }, + { + "tracker": "Jira", + "label": "PRJ-88" + } + ], + "authors": [ + "Sam Rivera" + ] + }, + { + "id": "pr41-2", + "type": "changed", + "bump": "major", + "area": "storedCount", + "text": "Changed stored counts to require an explicit store, so pass `() => localStorage` when reading, writing or clearing old counts", + "action": true, + "link": { + "label": "How to migrate", + "href": "https://github.com/example/slate/blob/v0.2.0/docs/migrating.md#stored-counts" + }, + "pr": { + "number": 41, + "href": "https://github.com/example/slate/pull/41" + }, + "commit": { + "sha": "69d07142a7bb472c3ddb4dd2b4030ce29823a57f", + "href": "https://github.com/example/slate/commit/69d07142a7bb472c3ddb4dd2b4030ce29823a57f" + } + }, + { + "id": "pr43-1", + "type": "changed", + "bump": "major", + "area": "TableHeader", + "text": "Changed fixed `TableHeader` cells to show a supplied `hint`, so remove that prop where a header should stay plain", + "action": true, + "pr": { + "number": 43, + "href": "https://github.com/example/slate/pull/43" + }, + "commit": { + "sha": "897fa5905a841db8f081670aa625c18ce6f6b1aa", + "href": "https://github.com/example/slate/commit/897fa5905a841db8f081670aa625c18ce6f6b1aa" + } + }, + { + "id": "pr44-1", + "type": "deprecated", + "bump": "minor", + "area": "Banner", + "text": "Deprecated `Banner` in favor of `Notice`, which takes the same props, removed in 1.0.0 no earlier than Mar 1, 2027", + "pr": { + "number": 44, + "href": "https://github.com/example/slate/pull/44" + }, + "commit": { + "sha": "5e5902046b8892bbe63216e16af0647c10a744ee", + "href": "https://github.com/example/slate/commit/5e5902046b8892bbe63216e16af0647c10a744ee" + } + }, + { + "id": "pr45-1", + "type": "added", + "bump": "minor", + "area": "Composer", + "text": "Added `Composer`, a message field that grows from 2 to 8 rows, with Send last and a status line under it", + "pr": { + "number": 45, + "href": "https://github.com/example/slate/pull/45" + }, + "commit": { + "sha": "5e84c6544e6bfee98d639cbe6b81091279cf846e", + "href": "https://github.com/example/slate/commit/5e84c6544e6bfee98d639cbe6b81091279cf846e" + }, + "tickets": [ + { + "tracker": "Linear", + "label": "SL-120", + "href": "https://linear.app/example/issue/SL-120" + } + ], + "authors": [ + "Sam Rivera" + ] + }, + { + "id": "pr45-2", + "type": "added", + "bump": "minor", + "area": "Mention", + "text": "Added `Mention` to show a name after @ and mark a mention of the reader when `you` is set", + "pr": { + "number": 45, + "href": "https://github.com/example/slate/pull/45" + }, + "commit": { + "sha": "bf14c30afcb2e3321134233c7d6cc5a7069e6997", + "href": "https://github.com/example/slate/commit/bf14c30afcb2e3321134233c7d6cc5a7069e6997" + } + }, + { + "id": "pr47-1", + "type": "changed", + "bump": "minor", + "area": "Toast", + "text": "Changed toasts on phones to sit 8px below the top bar instead of above the bottom tabs", + "pr": { + "number": 47, + "href": "https://github.com/example/slate/pull/47" + }, + "commit": { + "sha": "6305bea62d1eeffb606f12efb6d568f8c2704144", + "href": "https://github.com/example/slate/commit/6305bea62d1eeffb606f12efb6d568f8c2704144" + } + }, + { + "id": "pr46-1", + "type": "added", + "bump": "minor", + "area": "Tokens", + "text": "Added `--slate-plate` for a highlighted row's solid fill on its current surface level", + "pr": { + "number": 46, + "href": "https://github.com/example/slate/pull/46" + }, + "commit": { + "sha": "01bba6343c13e202aebb88cac07e25063f90eac4", + "href": "https://github.com/example/slate/commit/01bba6343c13e202aebb88cac07e25063f90eac4" + }, + "tickets": [ + { + "tracker": "Linear", + "label": "DS-27", + "href": "https://linear.app/example/issue/DS-27" + }, + { + "tracker": "Linear", + "label": "DS-31", + "href": "https://linear.app/example/issue/DS-31" + }, + { + "tracker": "Jira", + "label": "PRJ-90" + }, + { + "tracker": "GitHub", + "label": "issue #45", + "href": "https://github.com/example/slate/issues/45" + }, + { + "tracker": "Linear", + "label": "SL-131", + "href": "https://linear.app/example/issue/SL-131" + } + ] + }, + { + "id": "pr48-1", + "type": "fixed", + "bump": "patch", + "area": "Checkbox", + "text": "Fixed scrolling checkbox lists adding empty space below the page inside a sticky container", + "pr": { + "number": 48, + "href": "https://github.com/example/slate/pull/48" + }, + "commit": { + "sha": "3f842bfcee12cbbfc899975588325fc12cdc7772", + "href": "https://github.com/example/slate/commit/3f842bfcee12cbbfc899975588325fc12cdc7772" + }, + "tickets": [ + { + "tracker": "GitHub", + "label": "issue #45", + "href": "https://github.com/example/slate/issues/45" + } + ] + }, + { + "id": "docs-contrast-note", + "type": "fixed", + "bump": "patch", + "area": "Docs", + "text": "Fixed the contrast table listing secondary ink on the sunken band at 4.1:1, where it measures 4.6:1", + "commit": { + "sha": "b703be2fcc41217ae7ab767e7987389c3e954f30", + "href": "https://github.com/example/slate/commit/b703be2fcc41217ae7ab767e7987389c3e954f30" + } + }, + { + "id": "pr49-1", + "type": "fixed", + "bump": "patch", + "area": "SelectList", + "text": "Fixed keyboard focus leaving `SelectList` when the focused row was removed", + "pr": { + "number": 49, + "href": "https://github.com/example/slate/pull/49" + }, + "commit": { + "sha": "71c54b0a5104dca190cad0815a4a72304b3c259a", + "href": "https://github.com/example/slate/commit/71c54b0a5104dca190cad0815a4a72304b3c259a" + } + }, + { + "id": "pr49-2", + "type": "fixed", + "bump": "patch", + "area": "Sheet", + "text": "Fixed clipped focus rings at the top and bottom of a sheet's scrolling body", + "pr": { + "number": 49, + "href": "https://github.com/example/slate/pull/49" + }, + "commit": { + "sha": "f8eb7a17a49c2cbd289f8a6c323787918d5d8c01", + "href": "https://github.com/example/slate/commit/f8eb7a17a49c2cbd289f8a6c323787918d5d8c01" + } + }, + { + "id": "pr50-1", + "type": "fixed", + "bump": "patch", + "area": "Sidebar", + "text": "Fixed the brand mark sitting off center when the sidebar collapsed to its rail", + "pr": { + "number": 50, + "href": "https://github.com/example/slate/pull/50" + }, + "commit": { + "sha": "fc8a00590e637a58f13d8b87c6927f6afd34c439", + "href": "https://github.com/example/slate/commit/fc8a00590e637a58f13d8b87c6927f6afd34c439" + } + } + ] + }, + { + "version": "0.1.0", + "date": "2026-11-02", + "summary": "The first version in this changelog. Earlier work is in the repository's history.", + "entries": [] + } +] diff --git a/tools/changelog/outputs.mjs b/tools/changelog/outputs.mjs new file mode 100644 index 00000000..f3998b66 --- /dev/null +++ b/tools/changelog/outputs.mjs @@ -0,0 +1,105 @@ +// The outputs (DECISIONS 320, 3.4): CHANGELOG.md, the page's data and a GitHub Release's body, each generated from the records and the pending +// files and nothing else, with the same entries in the same order (2.7): Action needed, Security, Deprecated, Removed, Added, Changed, Fixed. +import { TYPES } from "./entries.mjs"; +import { byImpact } from "./records.mjs"; + +export const SECTION_NAMES = { action: "Action needed", security: "Security", deprecated: "Deprecated", removed: "Removed", added: "Added", changed: "Changed", fixed: "Fixed" }; + +/** A release's sections in order, each non-empty: the action entries first, then the rest by type. An action entry stands there and nowhere else. */ +export function sectionsOf(release) { + const out = []; + const action = release.entries.filter((entry) => entry.action).sort(byImpact); + if (action.length) out.push({ key: "action", entries: action }); + for (const type of TYPES) { + const entries = release.entries.filter((entry) => !entry.action && entry.type === type).sort(byImpact); + if (entries.length) out.push({ key: type, entries }); + } + return out; +} + +/** "Before upgrading from 0.1.0, check these 4 changes.": a package's callout opens with it, computed from the record. */ +export function upgradeLine(release) { + const count = release.entries.filter((entry) => entry.action).length; + if (!count || !release.previous) return null; + return `Before upgrading from ${release.previous}, check ${count === 1 ? "this change" : `these ${count} changes`}.`; +} + +const sources = (entry) => { + const parts = []; + if (entry.pr) parts.push(`[#${entry.pr.number}](${entry.pr.href})`); + for (const ticket of entry.tickets ?? []) parts.push(ticket.href ? `${ticket.tracker} [${ticket.label}](${ticket.href})` : `${ticket.tracker} ${ticket.label}`); + if (!parts.length && entry.commit) parts.push(`[${entry.commit.sha.slice(0, 8)}](${entry.commit.href})`); + return parts.length ? ` (${parts.join(", ")})` : ""; +}; + +/** One entry as a Markdown list item: the area, the sentence, the migration link, then its sources. */ +export function entryLine(entry) { + const area = entry.area ? `${entry.area}: ` : ""; + const link = entry.link ? ` [${entry.link.label}](${entry.link.href})` : ""; + return `- ${area}${entry.text}${link}${sources(entry)}`; +} + +/** + * A release's body in Markdown, as blocks, in the page's order and with the form the config names. `level` is the level of the release's own parts + * (3 under CHANGELOG.md's "## 1.4.0 - 2026-11-23", 2 in a GitHub Release). + * + * A package's ("reference"): the summary, Action needed opening with the upgrade line, then the sections, which a GitHub Release groups under "Changes". + * A product's ("notes"): Action needed first, with no upgrade line; then the headline as a heading over the paragraph for everyone, a heading under it + * for each audience; then the fold's own heading ("All changes", or "Other changes" under Action needed) over the summary and the sections. Every + * paragraph then sits under a heading of its own, so none reads as part of the list above it. When every change stands in Action needed there is no + * fold, and the summary follows the paragraphs, as on the page. A product's release with no paragraphs (a patch) is its summary and its sections. + */ +function releaseBody(release, { form = "reference", level = 3 } = {}) { + const h = (depth) => "#".repeat(level + depth); + const blocks = []; + const sections = sectionsOf(release); + const action = sections.find((section) => section.key === "action"); + const rest = sections.filter((section) => section.key !== "action"); + const list = (section, depth) => [`${h(depth)} ${SECTION_NAMES[section.key]}`, ...(section.key === "action" && form === "reference" && upgradeLine(release) ? ["", upgradeLine(release)] : []), "", ...section.entries.map(entryLine)].join("\n"); + const leads = form === "notes" && release.audiences?.length; + if (form === "notes" && release.title && !leads) blocks.push({ kind: "notes", text: `**${release.title}**` }); + if (form === "reference" && release.summary) blocks.push({ kind: "notes", text: release.summary }); + if (action) blocks.push({ kind: "action", text: list(action, 0) }); + if (leads) { + const paragraphs = []; + for (const audience of release.audiences) paragraphs.push(audience.for ? `${h(1)} ${audience.for}\n\n${audience.text}` : audience.text); + blocks.push({ kind: "notes", text: [`${h(0)} ${release.title ?? "Release notes"}`, ...paragraphs].join("\n\n") }); + if (rest.length) { + const fold = `${h(0)} ${action ? "Other changes" : "All changes"}`; + blocks.push({ kind: "fold", text: [fold, ...(release.summary ? [release.summary] : []), ...rest.map((section) => list(section, 1))].join("\n\n") }); + } else if (release.summary) { + // Every change stands in Action needed, so there is no fold: the page draws the summary after the paragraphs, and so does this. + blocks.push({ kind: "notes", text: release.summary }); + } + return blocks; + } + if (form === "notes" && release.summary) blocks.push({ kind: "notes", text: release.summary }); + for (const section of rest) blocks.push({ kind: "section", text: list(section, form === "reference" && level === 2 ? 1 : 0) }); + return blocks; +} + +/** `CHANGELOG.md`: every drawn release, highest first, headed `## 1.4.0 - 2026-11-23` (S 4.2). */ +export function changelogMarkdown(releases, { product, form = "reference" } = {}) { + const blocks = [`# Changelog`]; + if (product) blocks.push(`Every version of ${product}. This file is generated by \`tools/changelog\` from \`changelog/releases\` and \`.changes\`. Edit those, never this file.`); + for (const release of releases) { + blocks.push(release.unreleased ? "## Unreleased" : `## ${release.version} - ${release.date}`); + blocks.push(...releaseBody(release, { form, level: 3 }).map((block) => block.text)); + } + return `${blocks.join("\n\n")}\n`; +} + +/** A GitHub Release's body for one release (S 7.3): the same parts a level up; a package's sections sit under "Changes". */ +export function githubBody(release, { repository, form = "reference" } = {}) { + const blocks = []; + let changes = false; + for (const block of releaseBody(release, { form, level: 2 })) { + if (block.kind === "section" && form === "reference" && !changes) { + blocks.push("## Changes"); + changes = true; + } + blocks.push(block.text); + } + if (repository && release.previous) blocks.push(`Full diff: [v${release.previous}...v${release.version}](${repository}/compare/v${release.previous}...v${release.version})`); + return `${blocks.join("\n\n")}\n`; +} diff --git a/tools/changelog/records.mjs b/tools/changelog/records.mjs new file mode 100644 index 00000000..ac15c362 --- /dev/null +++ b/tools/changelog/records.mjs @@ -0,0 +1,158 @@ +// The frozen records (DECISIONS 320, 3.4): `changelog/releases/<version>.json`, one per release, written once by the freeze and never edited. +// Every output (CHANGELOG.md, the page's data, a GitHub Release's body) is generated from these and the pending files, and nothing else. +import fs from "node:fs"; +import path from "node:path"; + +import { commitHref, pullHref } from "./config.mjs"; +import { FLOOR, readPending, TYPES } from "./entries.mjs"; +import { atLeast, descending, must } from "./semver.mjs"; + +export const RECORDS_DIR = path.join("changelog", "releases"); +export const HOW_TO_MIGRATE = "How to migrate"; + +const RANK = { major: 0, minor: 1, patch: 2 }; + +/** Inside a section, entries stand by impact (the bump), then by area, then by id (S 4.4). */ +export function byImpact(a, b) { + return RANK[a.bump] - RANK[b.bump] || (a.area ?? "").localeCompare(b.area ?? "", "en") || a.id.localeCompare(b.id, "en"); +} + +/** Whether a string is a real calendar date written `YYYY-MM-DD`. */ +export function isDate(value) { + const match = /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/.exec(String(value)); + if (!match) return false; + const [, y, m, d] = match.map(Number); + const day = new Date(Date.UTC(y, m - 1, d)); + return day.getUTCFullYear() === y && day.getUTCMonth() === m - 1 && day.getUTCDate() === d; +} + +/** + * Where an entry's migration note opens. An https address stays; a path from the site's root ("/docs/…") stays; any other is a file in the + * repository, opened at the release's tag (or the default branch's head while unreleased). + */ +export function migrationHref(migration, config, version) { + if (/^https:\/\//.test(migration) || migration.startsWith("/") || migration.startsWith("#")) return migration; + if (/^[a-z][a-z0-9+.-]*:/i.test(migration)) throw new Error(`migration "${migration}" is an https address, a path from the site's root, or a file in the repository`); + return `${config.repository}/blob/${version ? `v${version}` : "HEAD"}/${migration}`; +} + +/** An entry as a record holds it: the file's fields, with every address resolved, so the record alone rebuilds it. */ +export function recordEntry(entry, config, { version, commit } = {}) { + const out = { id: entry.id, type: entry.type, bump: entry.bump }; + if (entry.area) out.area = entry.area; + out.text = entry.text; + if (entry.action) out.action = true; + if (entry.migration) out.link = { label: HOW_TO_MIGRATE, href: migrationHref(entry.migration, config, version) }; + if (entry.pr) out.pr = { number: entry.pr, href: pullHref(config, entry.pr) }; + if (commit) out.commit = { sha: commit, href: commitHref(config, commit) }; + if (entry.tickets?.length) out.tickets = entry.tickets.map((ticket) => ({ ...ticket })); + if (entry.authors?.length) out.authors = [...entry.authors]; + return out; +} + +function checkRecord(record, file) { + const fail = (message) => { throw new Error(`${file}: ${message}`); }; + must(record.version, file); + if (path.basename(file) !== `${record.version}.json`) fail(`the file is named for its version, ${record.version}.json`); + if (!isDate(record.date)) fail(`"date" is a calendar date, YYYY-MM-DD`); + if (!Array.isArray(record.entries)) fail(`"entries" is a list`); + const ids = new Set(); + for (const entry of record.entries) { + if (ids.has(entry.id)) fail(`the entry id "${entry.id}" is used twice`); + ids.add(entry.id); + if (!TYPES.includes(entry.type)) fail(`entry "${entry.id}": type "${entry.type}"`); + const floor = FLOOR[entry.type]; + if (!entry.bump || (floor && !atLeast(entry.bump, floor))) fail(`entry "${entry.id}": the bump "${entry.bump}" is below its type's floor`); + } + for (const audience of record.audiences ?? []) { + if (!audience.covers?.length) fail(`a paragraph covers no entry`); + for (const id of audience.covers) if (!ids.has(id)) fail(`a paragraph covers "${id}", which is no entry of this release`); + } + return record; +} + +/** Every record in a repository, read and checked. */ +export function readRecords(root) { + const dir = path.join(root, RECORDS_DIR); + if (!fs.existsSync(dir)) return []; + const records = fs.readdirSync(dir) + .filter((name) => name.endsWith(".json")) + .map((name) => { + const file = path.join(RECORDS_DIR, name); + let record; + try { + record = JSON.parse(fs.readFileSync(path.join(root, file), "utf8")); + } catch (error) { + throw new Error(`${file}: not JSON: ${error.message}`); + } + return checkRecord(record, file); + }); + checkIds(records); + return records.sort((a, b) => descending(a.version, b.version)); +} + +/** Stop on an entry id held by two records, unless one of them replaces the other (a candidate and its stable release). */ +export function checkIds(records) { + const holder = new Map(); + for (const record of records) { + for (const entry of record.entries) { + const other = holder.get(entry.id); + if (other) { + const related = (other.replaces ?? []).includes(record.version) || (record.replaces ?? []).includes(other.version); + if (!related) throw new Error(`the entry id "${entry.id}" is held by ${other.version} and ${record.version}; an id is never used twice (a backport writes its own entry)`); + } + holder.set(entry.id, record); + } + } +} + +/** The versions a drawn release stands in for: the pre-releases its record replaces. */ +export function replacedVersions(records) { + return new Set(records.flatMap((record) => record.replaces ?? [])); +} + +/** A ticket as the page shows it: a hidden tracker's tickets are recorded and never published, and a text tracker's are not linked. */ +function pageTickets(tickets) { + const shown = (tickets ?? []).filter((ticket) => ticket.show !== "none"); + return shown.length ? shown.map((ticket) => (ticket.show === "link" && ticket.href ? { tracker: ticket.tracker, label: ticket.label, href: ticket.href } : { tracker: ticket.tracker, label: ticket.label })) : undefined; +} + +function pageEntry(entry) { + const out = { ...entry }; + const tickets = pageTickets(entry.tickets); + if (tickets) out.tickets = tickets; + else delete out.tickets; + return out; +} + +/** + * The page's data: the `ReleaseRecord[]` that `ReleaseNotes` takes, highest first, with the Unreleased section (the pending files that no + * pre-release record holds) on top when there is one. A pre-release whose stable version has shipped is not drawn: its address opens the + * stable release (`replaces`). `config` is read only for the pending files; a frozen release is drawn from its record alone. + */ +export function pageReleases(root, { config, records = readRecords(root), pending } = {}) { + const replaced = replacedVersions(records); + const drawn = records.filter((record) => !replaced.has(record.version)).sort((a, b) => descending(a.version, b.version)); + const out = []; + const held = new Set(records.filter((record) => must(record.version).pre.length).flatMap((record) => record.entries.map((entry) => entry.id))); + // An entry is at one address: a pending file whose id a stable release holds would draw it twice (a candidate's pending copies are kept on purpose). + const shipped = new Map(records.filter((record) => !must(record.version).pre.length).flatMap((record) => record.entries.map((entry) => [entry.id, record.version]))); + const all = pending ?? (config ? readPending(root, config) : []); + const twice = all.find((entry) => shipped.has(entry.id)); + if (twice) throw new Error(`.changes/${twice.id}.md: the id is held by ${shipped.get(twice.id)}, which has shipped; an entry is never used twice (remove the file, or write a new entry with its own id)`); + const waiting = all.filter((entry) => !held.has(entry.id)); + if (waiting.length) { + out.push({ version: "Unreleased", unreleased: true, entries: waiting.map((entry) => pageEntry(recordEntry(entry, config))).sort(byImpact) }); + } + for (const record of drawn) { + const release = { version: record.version, date: record.date }; + if (record.previous) release.previous = record.previous; + if (record.replaces?.length) release.replaces = [...record.replaces]; + if (record.title) release.title = record.title; + if (record.summary) release.summary = record.summary; + if (record.audiences?.length) release.audiences = record.audiences.map((audience) => ({ ...audience, covers: [...audience.covers] })); + release.entries = record.entries.map(pageEntry); + out.push(release); + } + return out; +} diff --git a/tools/changelog/release.mjs b/tools/changelog/release.mjs new file mode 100644 index 00000000..57a15578 --- /dev/null +++ b/tools/changelog/release.mjs @@ -0,0 +1,312 @@ +// Freezing a release (DECISIONS 320, 3.4): node tools/changelog/release.mjs <version> --date <YYYY-MM-DD> +// Run on the branch the release is cut from: the default branch, or a maintained line's own (release/1.x). It reads the config and every pending +// file, checks the version against the entries and the releases in its line, resolves each entry's commit, writes the record once and, for a +// stable version, removes the pending files and regenerates CHANGELOG.md. The version is the owner's to give; the tool refuses one that +// understates the release. +import { execFileSync } from "node:child_process"; +import fs from "node:fs"; +import path from "node:path"; + +import { loadConfig } from "./config.mjs"; +import { CHANGES_DIR, NOTES_FILE, readPending, readPendingNotes } from "./entries.mjs"; +import { changelogMarkdown } from "./outputs.mjs"; +import { byImpact, isDate, pageReleases, readRecords, recordEntry, RECORDS_DIR } from "./records.mjs"; +import { atLeast, carries, compare, higher, least, line, must } from "./semver.mjs"; + +const RANK_WORD = { major: "a major", minor: "a minor", patch: "a patch" }; + +/** git in the repository, its output trimmed. */ +function git(root, args) { + return execFileSync("git", args, { cwd: root, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim(); +} + +/** + * The commit that put an entry on this branch: the first-parent commit that added its file. A merge counts as the commit that added it (its + * diff against its first parent), a squash or a rebased commit as itself. If that commit's subject names a different pull request, stop. + */ +export function entryCommit(root, entry) { + const file = `${CHANGES_DIR}/${entry.id}.md`; + const log = git(root, ["log", "--first-parent", "--full-history", "--diff-merges=first-parent", "--diff-filter=A", "--format=%H%x09%s", "--", file]); + const [first] = log.split("\n").filter(Boolean); + if (!first) throw new Error(`${file}: no commit on this branch added it; commit it first`); + const [sha, subject = ""] = first.split("\t"); + const named = /^Merge pull request #([0-9]+)\b/.exec(subject) ?? /\(#([0-9]+)\)\s*$/.exec(subject); + if (named && entry.pr && Number(named[1]) !== entry.pr) { + throw new Error(`${file}: says pull request ${entry.pr}, and the commit that added it (${sha.slice(0, 8)}) is "${subject}"`); + } + return sha; +} + +/** Check the version against the records and the entries (1.1). Returns the base it is measured from, or null for the first release. */ +export function checkVersion(version, records, entries) { + const next = must(version, "the version"); + if (next.pre.length) { + const kind = next.pre[0]; + if (kind === "canary") throw new Error(`${version}: a canary is a build from the default branch, with no freeze and no record`); + if (!(["beta", "rc"].includes(kind) && next.pre.length === 2 && /^[1-9][0-9]*$/.test(next.pre[1]))) { + throw new Error(`${version}: a frozen pre-release is -beta.N or -rc.N`); + } + } + if (records.some((record) => compare(record.version, version) === 0)) throw new Error(`${version} is published, and a published version is never edited`); + const ownLine = line(next); + const inLine = records.filter((record) => line(record.version) === ownLine); + const against = inLine.length ? inLine : records; + const above = against.filter((record) => compare(record.version, version) > 0).sort((a, b) => compare(b.version, a.version)); + if (above.length) { + throw new Error(inLine.length + ? `${version} is not higher than ${above[0].version}, released in its line (${ownLine}${ownLine.includes(".") ? ".x" : ".x.x"})` + : `${version} opens a line, so it must be higher than every release; ${above[0].version} is higher`); + } + const core = must(next.core); + const stableBelow = (list) => list.filter((record) => !must(record.version).pre.length && compare(record.version, core) < 0).sort((a, b) => compare(b.version, a.version))[0]; + const base = stableBelow(inLine) ?? stableBelow(records) ?? null; + if (!base) return null; + const needed = entries.reduce((most, entry) => higher(most, entry.bump), "patch"); + const carried = carries(base.version, core); + if (!entries.length) { + if (!carried) throw new Error(`${version} is not higher than ${base.version}`); + return base; + } + if (!carried || !atLeast(carried, needed)) { + const why = entries.filter((entry) => entry.bump === needed).map((entry) => entry.id).slice(0, 3).join(", "); + throw new Error(`${version} understates the release: from ${base.version} it needs ${RANK_WORD[needed]} (${why})${core.major === 0 ? ", one place right in 0.x" : ""}, so at least ${least(base.version, needed)}`); + } + return base; +} + +/** Whether a process is running (one we may not signal is running). */ +function alive(pid) { + if (!Number.isInteger(pid) || pid <= 0) return false; + try { + process.kill(pid, 0); + return true; + } catch (error) { + return error.code === "EPERM"; + } +} + +/** + * One freeze at a time in a repository: two freezes of different versions would otherwise read the same pending files and both record them. + * The lock is a file in the git directory holding the freezing process's id, made only if it is not there. One left by a freeze that was stopped (its process is + * gone) is taken over. Returns the function that lets it go. + */ +export function lockFreeze(root) { + // In the checkout's git directory: out of the tree, and nothing is made in it before every check passes. + const file = path.join(git(root, ["rev-parse", "--absolute-git-dir"]), "changelog-freeze.lock"); + for (let attempt = 0; attempt < 2; attempt++) { + try { + fs.writeFileSync(file, `${process.pid}\n`, { flag: "wx" }); + return () => fs.rmSync(file, { force: true }); + } catch (error) { + if (error.code !== "EEXIST") throw error; + const pid = Number.parseInt(fs.readFileSync(file, "utf8"), 10); + if (alive(pid)) throw new Error(`another freeze is running (process ${pid}); run this one again when it has ended`); + fs.rmSync(file, { force: true }); + } + } + throw new Error("another freeze took the lock first; run this one again when it has ended"); +} + +/** + * Freeze `version`, shipped on `date`. `root` is the repository. Returns what it wrote. + * + * It is one step that either happens or does not: every check runs and every output is built in memory first; the record and CHANGELOG.md are + * written beside their places and then moved in (the record with a hard link, which fails if another freeze wrote it first), and only then are + * the pending files consumed. A freeze that stops before that leaves the inputs as they were. One that stopped after its record was written, + * before or while it consumed the pending files, is finished by running it again: the files its record holds are checked against it, removed, + * and CHANGELOG.md is written again. Only one freeze runs at a time in a repository (lockFreeze). + */ +export function freeze({ root, version, date }) { + if (!isDate(date)) throw new Error(`--date "${date}" is a calendar date, YYYY-MM-DD`); + const unlock = lockFreeze(root); + try { + const file = path.join(root, RECORDS_DIR, `${version}.json`); + if (!fs.existsSync(file)) return commit({ root, version, date }); + // The record is there: this freeze finishes an interrupted one, or the version is published. Anything that stops it says the second. + try { + return must(version, "the version").pre.length ? commit({ root, version, date }) : finish({ root, version, date }); + } catch (error) { + if (error.finishing) throw error; + throw new Error(`${version} is published, and a published version is never edited`); + } + } finally { + unlock(); + } +} + +/** + * Finish a stable freeze that stopped after writing its record: every pending file the record holds must say what the record says, and the + * date must be the record's. Those files and release.md are removed and CHANGELOG.md is written from the records and what is left. A record + * that holds no pending file and has no release.md left is simply published. + */ +function finish({ root, version, date }) { + const config = loadConfig(root); + const file = path.join(root, RECORDS_DIR, `${version}.json`); + const records = readRecords(root); + const record = records.find((item) => item.version === version); + if (!record || record.date !== date) throw new Error("published"); + const held = new Map(record.entries.map((entry) => [entry.id, entry])); + const pending = readPending(root, config); + const mine = pending.filter((entry) => held.has(entry.id)); + const notesFile = path.join(root, CHANGES_DIR, NOTES_FILE); + const notes = fs.existsSync(notesFile) ? readPendingNotes(root, new Set([...pending.map((entry) => entry.id), ...held.keys()])) : null; + const same = (a, b) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null); + const notesMine = Boolean(notes) && same(notes.summary, record.summary) && same(notes.title, record.title) && same(notes.audiences, record.audiences); + if (!mine.length && !notesMine) throw new Error("published"); + for (const entry of mine) { + const kept = held.get(entry.id); + const now = recordEntry(entry, config, { version, commit: kept.commit?.sha }); + if (JSON.stringify(now) !== JSON.stringify(kept)) throw new Error("published"); + } + const left = pending.filter((entry) => !held.has(entry.id)); + const changelog = changelogMarkdown(pageReleases(root, { config, records, pending: left }), { product: config.product, form: config.form }); + writeChangelog(root, changelog); + const removed = consume(root, version, mine, notesMine); + return { record, file, removed, finished: true }; +} + +/** Write CHANGELOG.md beside its place, then move it in. */ +function writeChangelog(root, text) { + const changelogFile = path.join(root, "CHANGELOG.md"); + const temp = `${changelogFile}.freeze-${process.pid}-${Date.now()}`; + try { + fs.writeFileSync(temp, text); + fs.renameSync(temp, changelogFile); + } catch (error) { + error.finishing = true; + throw error; + } finally { + fs.rmSync(temp, { force: true }); + } +} + +/** Remove the pending files a frozen record holds, then release.md. One that cannot be removed stops the freeze, which running it again finishes. */ +function consume(root, version, entries, notes) { + const removed = []; + const files = [...entries.map((entry) => `${CHANGES_DIR}/${entry.id}.md`), ...(notes ? [`${CHANGES_DIR}/${NOTES_FILE}`] : [])]; + for (const name of files) { + try { + fs.rmSync(path.join(root, name), { force: true }); + } catch (error) { + const stopped = new Error(`${version} is frozen, and removing ${name} failed (${error.code ?? error.message}); fix that, then run the same freeze again to finish it`); + stopped.finishing = true; + throw stopped; + } + removed.push(name); + } + return removed; +} + +function commit({ root, version, date }) { + const config = loadConfig(root); + const file = path.join(root, RECORDS_DIR, `${version}.json`); + const existing = fs.existsSync(file) ? fs.readFileSync(file, "utf8") : null; + // A record already there is measured against what this freeze would write: equal, and the freeze finishes; different, and it is published. + const allRecords = readRecords(root); + const records = existing === null ? allRecords : allRecords.filter((record) => record.version !== version); + if (existing !== null && records.length === allRecords.length) throw new Error(`${path.join(RECORDS_DIR, `${version}.json`)} exists and is not a record of ${version}`); + const pending = readPending(root, config); + const ids = new Set(pending.map((entry) => entry.id)); + const notes = readPendingNotes(root, ids); + const next = must(version, "the version"); + const pre = next.pre.length > 0; + + // A pre-release takes what no earlier pre-release of its version holds; a stable version takes every pending file and replaces them. + const candidates = records.filter((record) => { const v = must(record.version); return v.pre.length && v.core === next.core; }); + const heldByCandidates = new Set(candidates.flatMap((record) => record.entries.map((entry) => entry.id))); + const taken = pre ? pending.filter((entry) => !heldByCandidates.has(entry.id)) : pending; + + const base = checkVersion(version, records, pending); + + // An id is never used twice: only a candidate that this stable release replaces may hold one of its entries. + const takenIds = new Set(taken.map((entry) => entry.id)); + for (const record of records) { + if (!pre && candidates.includes(record)) continue; + const clash = record.entries.find((entry) => takenIds.has(entry.id)); + if (clash) throw new Error(`${CHANGES_DIR}/${clash.id}.md: the id is already held by ${record.version}; a backport writes its own entry`); + } + + if (!taken.length && !notes?.summary) throw new Error(`${version} has no entries, so it needs a summary in ${CHANGES_DIR}/${NOTES_FILE} (no release is a heading over nothing)`); + if (taken.length > 3 && !notes?.summary && !notes?.audiences?.length) throw new Error(`${version} has ${taken.length} changes, so it needs a summary in ${CHANGES_DIR}/${NOTES_FILE}`); + + if (git(root, ["rev-parse", "--is-shallow-repository"]) === "true") throw new Error("this clone is shallow: fetch the whole history (git fetch --unshallow) so each entry's commit can be found"); + const entries = taken.map((entry) => recordEntry(entry, config, { version, commit: entryCommit(root, entry) })).sort(byImpact); + + const record = { version, date }; + if (base) record.previous = base.version; + if (!pre && candidates.length) record.replaces = candidates.map((candidate) => candidate.version).sort(compare); + // The repository is frozen with the release, so a later config cannot re-point its comparison ("Full diff"). + record.repository = config.repository; + if (notes?.title) record.title = notes.title; + if (notes?.summary) record.summary = notes.summary; + if (notes?.audiences) { + // A paragraph covers only what this release's own list holds (R18): a candidate is drawn with what it added, until its stable version ships. + const own = new Set(taken.map((entry) => entry.id)); + for (const audience of notes.audiences) for (const id of audience.covers) if (!own.has(id)) throw new Error(`${CHANGES_DIR}/${NOTES_FILE}: covers "${id}", which ${version} does not hold`); + record.audiences = notes.audiences; + } + record.entries = entries; + const recordText = `${JSON.stringify(record, null, 2)}\n`; + if (existing !== null && existing !== recordText) throw new Error(`${version} is published, and a published version is never edited`); + + // Every output, in memory: the records with this one, and the pending files this freeze leaves. + const consumed = pre ? [] : pending; + const left = pre ? pending : []; + const changelog = changelogMarkdown(pageReleases(root, { config, records: [...records, record], pending: left }), { product: config.product, form: config.form }); + + // Stage, then move in. Nothing is consumed until both are in place. + const changelogFile = path.join(root, "CHANGELOG.md"); + const stage = `.freeze-${process.pid}-${Date.now()}`; + const recordTemp = `${file}${stage}`; + const changelogTemp = `${changelogFile}${stage}`; + let wroteRecord = false; + try { + fs.mkdirSync(path.dirname(file), { recursive: true }); + fs.writeFileSync(changelogTemp, changelog); + if (existing === null) { + fs.writeFileSync(recordTemp, recordText, { flag: "wx" }); + try { + fs.linkSync(recordTemp, file); + } catch (error) { + if (error.code === "EEXIST") throw new Error(`${path.join(RECORDS_DIR, `${version}.json`)} was written by another freeze; run this one again to finish or to see what differs`); + throw error; + } + wroteRecord = true; + } + fs.renameSync(changelogTemp, changelogFile); + } catch (error) { + if (wroteRecord) fs.rmSync(file, { force: true }); + error.finishing = true; + throw error; + } finally { + fs.rmSync(recordTemp, { force: true }); + fs.rmSync(changelogTemp, { force: true }); + } + + const removed = consume(root, version, consumed, !pre && Boolean(notes)); + return { record, file, removed, finished: existing !== null }; +} + +function main(argv) { + const args = [...argv]; + const at = args.indexOf("--date"); + const date = at >= 0 ? args.splice(at, 2)[1] : undefined; + const rootAt = args.indexOf("--root"); + const root = rootAt >= 0 ? path.resolve(args.splice(rootAt, 2)[1]) : process.cwd(); + const [version] = args; + if (!version || !date) { + process.stderr.write("usage: node tools/changelog/release.mjs <version> --date <YYYY-MM-DD> [--root <repository>]\n"); + process.exit(2); + } + try { + const { record, removed } = freeze({ root, version, date }); + process.stdout.write(`Wrote ${RECORDS_DIR}/${version}.json: ${record.entries.length} ${record.entries.length === 1 ? "entry" : "entries"}${record.previous ? `, from ${record.previous}` : ""}${record.replaces ? `, replacing ${record.replaces.join(", ")}` : ""}.\n`); + if (removed.length) process.stdout.write(`Removed ${removed.length} pending ${removed.length === 1 ? "file" : "files"} and regenerated CHANGELOG.md.\n`); + } catch (error) { + process.stderr.write(`${error.message}\n`); + process.exit(1); + } +} + +const { isMain } = await import("../../scripts/is-main.mjs"); +if (isMain(import.meta.url)) main(process.argv.slice(2)); diff --git a/tools/changelog/semver.mjs b/tools/changelog/semver.mjs new file mode 100644 index 00000000..1168c813 --- /dev/null +++ b/tools/changelog/semver.mjs @@ -0,0 +1,99 @@ +// SemVer 2.0.0, as far as the changelog needs it: parsing, precedence, lines and bumps (DECISIONS 320, 1.1). No dependency. + +const NUMBER = "(0|[1-9][0-9]*)"; +const IDENT = "(?:0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*)"; +const PATTERN = new RegExp(`^${NUMBER}\\.${NUMBER}\\.${NUMBER}(?:-(${IDENT}(?:\\.${IDENT})*))?(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?$`); + +/** A parsed version, or null when the string is not SemVer 2.0.0. */ +export function parse(version) { + const match = PATTERN.exec(String(version)); + if (!match) return null; + const [, major, minor, patch, pre, build] = match; + return { + version: String(version), + major: Number(major), + minor: Number(minor), + patch: Number(patch), + pre: pre ? pre.split(".") : [], + build: build ?? null, + core: `${major}.${minor}.${patch}`, + }; +} + +/** Parse or stop with the reason. */ +export function must(version, where = "version") { + const parsed = parse(version); + if (!parsed) throw new Error(`${where}: "${version}" is not a SemVer version (MAJOR.MINOR.PATCH, a pre-release after a hyphen)`); + if (parsed.build) throw new Error(`${where}: "${version}" holds build metadata; a release's version never does`); + return parsed; +} + +const numeric = (id) => /^[0-9]+$/.test(id); + +/** SemVer precedence: negative when a is lower. Build metadata is ignored, so two builds of one version compare equal. */ +export function compare(a, b) { + const x = typeof a === "string" ? must(a) : a; + const y = typeof b === "string" ? must(b) : b; + for (const key of ["major", "minor", "patch"]) if (x[key] !== y[key]) return x[key] - y[key]; + if (!x.pre.length || !y.pre.length) return (y.pre.length ? 1 : 0) - (x.pre.length ? 1 : 0); + for (let index = 0; index < Math.max(x.pre.length, y.pre.length); index++) { + const p = x.pre[index]; + const q = y.pre[index]; + if (p === undefined) return -1; + if (q === undefined) return 1; + if (p === q) continue; + // Compared as integers of any size: Number would make rc.9007199254740992 and rc.9007199254740993 equal. + if (numeric(p) && numeric(q)) { const a = BigInt(p); const b = BigInt(q); return a < b ? -1 : a > b ? 1 : 0; } + if (numeric(p)) return -1; + if (numeric(q)) return 1; + return p < q ? -1 : 1; + } + return 0; +} + +/** Highest first. */ +export const descending = (a, b) => compare(b, a); + +/** + * A version's line: the versions that share their breaking number, the major, or in 0.x the minor (1.1). "1", "0.2". + */ +export function line(version) { + const v = typeof version === "string" ? must(version) : version; + return v.major === 0 ? `0.${v.minor}` : String(v.major); +} + +export const BUMPS = ["patch", "minor", "major"]; +const RANK = { patch: 1, minor: 2, major: 3 }; + +/** The higher of two bumps. */ +export const higher = (a, b) => (RANK[a] >= RANK[b] ? a : b); + +/** Whether `bump` is at least `floor`. */ +export const atLeast = (bump, floor) => RANK[bump] >= RANK[floor]; + +/** + * What moving from `base` to `next` (cores only) says, as the bump it can carry. From 1.0, the number that moved. In 0.x the numbers move one + * place right: the minor is the breaking number and the patch carries everything else, so a patch there may carry a minor's entries. + */ +export function carries(base, next) { + const from = typeof base === "string" ? must(base) : base; + const to = typeof next === "string" ? must(next) : next; + if (to.major !== from.major) return to.major > from.major ? "major" : null; + if (to.minor !== from.minor) { + if (to.minor < from.minor) return null; + return to.major === 0 ? "major" : "minor"; + } + if (to.patch > from.patch) return to.major === 0 ? "minor" : "patch"; + return null; +} + +/** The smallest version after `base` that carries `bump`: what the tool suggests when it refuses a version. */ +export function least(base, bump) { + const from = typeof base === "string" ? must(base) : base; + if (from.major === 0) { + return bump === "major" ? `0.${from.minor + 1}.0` : `0.${from.minor}.${from.patch + 1}`; + } + if (bump === "major") return `${from.major + 1}.0.0`; + if (bump === "minor") return `${from.major}.${from.minor + 1}.0`; + return `${from.major}.${from.minor}.${from.patch + 1}`; +} diff --git a/tools/changelog/skill-body.mjs b/tools/changelog/skill-body.mjs new file mode 100644 index 00000000..749834ba --- /dev/null +++ b/tools/changelog/skill-body.mjs @@ -0,0 +1,162 @@ +// A page body for the HTML skill's `release` module, from the records (DECISIONS 320, 2.15 and 3.4): the same releases, parts and order as React's +// `ReleaseNotes`, `ReleaseIndex` and `VersionLink`, written as markup an agent composes. +// node tools/changelog/skill-body.mjs --form reference|notes [--root <repository>] [--running <version>] [--base <address>] --out <body.html> +// then: node .agent/skills/basalt-html/compose.mjs <body.html> +// Every fold is written open: the module's script closes it, so without script the page shows everything. +import fs from "node:fs"; +import path from "node:path"; + +import { loadConfig } from "./config.mjs"; +import { sectionsOf, SECTION_NAMES, upgradeLine } from "./outputs.mjs"; +import { pageReleases } from "./records.mjs"; + +const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; +/** "Nov 23, 2026": the calendar date as written, never moved by a time zone. */ +export const usDate = (iso) => { const [y, m, d] = iso.split("-").map(Number); return `${MONTHS[m - 1]} ${d}, ${y}`; }; +const esc = (value) => String(value).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """); +/** The sentence: backticks mark code, and nothing else is markup. */ +const sentence = (text) => text.split(/`([^`]+)`/).map((part, index) => (index % 2 ? `<code>${esc(part)}</code>` : esc(part))).join(""); +const DOT = `<span class="dot-sep" data-spaced><span class="visually-hidden">, </span></span>`; +const dots = (parts) => parts.filter(Boolean).join(DOT); +const plural = (n, one, many) => `${n} ${n === 1 ? one : many}`; +const count = (n) => `<span class="release-count"><span class="visually-hidden"> </span>${n}</span>`; +export const releaseId = (release) => (release.unreleased ? "unreleased" : `v${release.version}`); +const SHOWN_TICKETS = 2; +// An element's own id that is not an address ends "__words", "__heading" and the like: a public id is lowercase letters, digits and hyphens, so the +// two never meet (an entry may be named "fix-words"). + +/** The version with its date, one link (VersionLink). `label` is the word before the number; a site's footer gives the product. */ +export function versionLink({ version, date, href, label = "Version", current = false, destination = "release notes" }) { + const at = version.indexOf("-"); + const number = at < 0 ? esc(version) : `${esc(version.slice(0, at))}<wbr><span class="version-link-pre">${esc(version.slice(at))}</span>`; + // The name is written whole: the two parts are flex items, whose text a name would join with stray spaces. + return `<a class="version-link" href="${esc(href)}" aria-label="${esc(`${label} ${version}, ${usDate(date)}, ${destination}`)}"${current ? ' aria-current="page"' : ""}><span class="version-link-words"><span class="version-link-word">${esc(label)} </span><span class="version-link-number" data-label="${esc(version)}"><span>${number}</span></span></span> <span class="version-link-date"><time datetime="${esc(date)}">${usDate(date)}</time></span></a>`; +} + +function sources(entry) { + const tickets = entry.tickets ?? []; + const ids = []; + if (entry.pr) ids.push(`#${entry.pr.number}`); + for (const ticket of tickets.slice(0, SHOWN_TICKETS)) ids.push(ticket.label); + if (!entry.pr && !tickets.length && entry.commit) ids.push(entry.commit.sha.slice(0, 8)); + if (!ids.length) return ""; + const more = tickets.length - SHOWN_TICKETS; + if (more > 0) ids.push(`${more} more`); + const rows = []; + if (entry.pr) rows.push(`<div><dt>Pull request</dt><dd data-mono><a href="${esc(entry.pr.href)}">#${entry.pr.number}</a></dd></div>`); + if (tickets.length) rows.push(`<div><dt>${tickets.length === 1 ? "Ticket" : "Tickets"}</dt>${tickets.map((ticket) => `<dd>${esc(ticket.tracker)} ${ticket.href ? `<a class="release-mono" href="${esc(ticket.href)}">${esc(ticket.label)}</a>` : `<span class="release-mono">${esc(ticket.label)}</span>`}</dd>`).join("")}</div>`); + if (entry.commit) rows.push(`<div><dt>Commit</dt><dd data-mono>${entry.commit.href ? `<a href="${esc(entry.commit.href)}">${entry.commit.sha.slice(0, 8)}</a>` : entry.commit.sha.slice(0, 8)}</dd></div>`); + if (entry.authors?.length) rows.push(`<div><dt>${entry.authors.length === 1 ? "Author" : "Authors"}</dt>${entry.authors.map((name) => `<dd>${esc(name)}</dd>`).join("")}</div>`); + const panel = `${entry.id}__sources`; + return `<button type="button" class="release-source" popovertarget="${panel}" aria-describedby="${entry.id}__words"><span class="visually-hidden">Sources: </span>${ids.map((id) => `<span class="release-id">${esc(id)}</span>`).join(DOT)}</button>` + + `<div class="panel float popover release-sources" popover id="${panel}" data-align="end" data-focus-self><h2 class="popover-title">Sources</h2><dl class="dlist release-sources-list">${rows.join("")}</dl>` + + `<button class="btn" data-size="sm" data-copy-text="#${esc(entry.id)}" data-copy-fragment="${esc(entry.id)}" data-copy-words="Copied" data-copy-status="Link copied"><span>Copy link to this change</span></button></div>`; +} + +function entry(item) { + const area = item.area ? `<span class="release-area">${esc(item.area)}:</span> ` : ""; + const link = item.link ? `<a class="release-migrate" href="${esc(item.link.href)}">${esc(item.link.label)}</a>` : ""; + return `<li class="release-entry" id="${esc(item.id)}"${item.link ? " data-link" : ""}><span class="release-word" aria-hidden="true">Linked</span><div class="release-entry-words"><p class="release-entry-text" id="${esc(item.id)}__words">${area}${sentence(item.text)}</p>${link}</div><span class="release-source-cell">${sources(item)}</span></li>`; +} + +const list = (entries) => `<ul class="release-list">${entries.map(entry).join("")}</ul>`; + +/** A fold, written open: its heading holds the button; the script closes it, and the browser's find opens it. */ +const fold = (id, level, title, body, className = "") => `<h${level} class="release-fold-title${className}"><button type="button" class="disclosure release-fold" aria-expanded="true" aria-controls="${id}"><span>${title}</span></button></h${level}><div class="release-fold-panel" id="${id}">${body}</div>`; + +function sectionsHtml(release, sections, level, foldFixed) { + return sections.map((section) => { + const title = `${SECTION_NAMES[section.key]}${count(section.entries.length)}`; + if (section.key === "fixed" && foldFixed) return `<section class="release-section" data-folded>${fold(`${releaseId(release)}__fixed`, level, title, list(section.entries))}</section>`; + return `<section class="release-section"><h${level} class="release-section-title">${title}</h${level}>${list(section.entries)}</section>`; + }).join(""); +} + +function buildDetails(rows, id, level) { + const dl = `<dl class="dlist release-build-list">${rows.map((row) => `<div><dt>${esc(row.label)}</dt><dd${row.mono ? " data-mono" : ""}>${esc(row.value)}</dd></div>`).join("")}</dl>`; + const copy = `<button class="btn" data-size="sm" data-copy-text="${esc(rows.map((row) => `${row.label}: ${row.value}`).join("\n"))}" data-copy-words="Copied" data-copy-status="Build details copied"><span>Copy build details</span></button>`; + return `<div class="release-build">${fold(id, level, "Build details", dl + copy)}</div>`; +} + +function release(item, { form, product, running, runningBuild, level }) { + const id = releaseId(item); + const all = sectionsOf(item); + const action = all.find((section) => section.key === "action")?.entries ?? []; + const sections = all.filter((section) => section.key !== "action"); + const inside = sections.reduce((sum, section) => sum + section.entries.length, 0); + const leads = form === "notes" && Boolean(item.audiences?.length); + const folded = leads && inside > 0; + const fixed = sections.find((section) => section.key === "fixed")?.entries.length ?? 0; + // Only a package's list folds Fixed; a product's patch with no paragraphs shows its list open (2.7). + const fixedFolds = form === "reference" && item.entries.length > 10 && fixed > 3; + const total = item.entries.length; + const yours = running !== undefined && !item.unreleased && running === item.version; + const pre = !item.unreleased && item.version.includes("-"); + const date = item.date ? `<time datetime="${item.date}">${usDate(item.date)}</time>` : ""; + const facts = [total ? plural(total, "change", "changes") : "", action.length ? `<a class="release-action-link" href="#${id}__action">${plural(action.length, "needs action", "need action")}</a>` : ""]; + const badges = pre || yours ? `<span class="release-badges">${pre ? `<span class="badge">Pre-release</span>` : ""}${yours ? `<span class="badge">Your version</span>` : ""}</span>` : ""; + const h = `h${level}`; + const heading = item.title + ? `<p class="release-meta release-number-line" aria-hidden="true">${dots([esc(item.version), date])}</p><${h} class="release-heading" id="${id}__heading" data-headline><span class="visually-hidden">${esc(item.version)}${item.date ? `, ${usDate(item.date)}` : ""}: </span><span class="release-title">${esc(item.title)}</span></${h}>` + (facts.some(Boolean) || badges ? `<p class="release-meta">${dots(facts)}${badges}</p>` : "") + : `<${h} class="release-heading" id="${id}__heading"><span class="release-version"${item.unreleased ? " data-words" : ""}>${item.unreleased ? "Unreleased" : esc(item.version)}</span>${date ? `<span class="visually-hidden">, ${usDate(item.date)}</span>` : ""}</${h}>` + (date || facts.some(Boolean) || badges ? `<p class="release-meta">${dots([date, ...facts])}${badges}</p>` : ""); + const name = item.unreleased ? "Unreleased" : `${product} ${item.version}`; + const head = `<header class="release-head"><div class="release-head-text"><span class="release-word" aria-hidden="true">Linked</span>${heading}</div><button class="btn release-copy" data-variant="ghost" data-size="sm" data-copy-text="#${id}" data-copy-fragment="${id}" data-copy-words="Copied" data-copy-status="Link copied" aria-label="Copy link to ${esc(name)}"><span>Copy link</span></button></header>`; + const summary = item.summary ? `<p class="release-summary">${esc(item.summary)}</p>` : ""; + const upgrade = form === "reference" ? upgradeLine(item) : null; + const callout = action.length ? `<div class="callout release-action" data-status="warning" id="${id}__action"><i data-icon="Warning"></i><div><div class="callout-title"><h${level + 1} class="release-callout-title">Action needed${count(action.length)}</h${level + 1}></div><div class="callout-body">${upgrade ? `<p class="release-upgrade">${esc(upgrade)}</p>` : ""}${list(action)}</div></div></div>` : ""; + const audiences = leads ? item.audiences.map((audience) => `<section class="release-audience">${audience.for ? `<h${level + 1} class="release-audience-title">${esc(audience.for)}</h${level + 1}>` : ""}<p class="release-paragraph">${esc(audience.text)}</p></section>`).join("") : ""; + const body = folded + ? `<div class="release-all">${fold(`${id}__all`, level + 1, `${action.length ? "Other changes" : "All changes"}${count(inside)}`, summary + sectionsHtml(item, sections, level + 2, false))}</div>` + : (leads ? summary : "") + sectionsHtml(item, sections, level + 1, fixedFolds); + const build = yours && runningBuild?.length ? buildDetails(runningBuild, `${id}__build`, level + 1) : ""; + const replaces = item.replaces?.length ? ` data-replaces="${esc(item.replaces.join(" "))}"` : ""; + return `<section class="release" id="${id}" aria-labelledby="${id}__heading" data-release-form="${form}"${replaces}>${head}${leads ? "" : summary}${callout}${audiences}${body}${build}</section>`; +} + +/** The releases, as `ReleaseNotes` draws them. `base` is the page's address for copied links; without it the script reads the window's. */ +export function releaseNotesHtml(releases, { form, product, running, runningBuild, base, level = 2 }) { + const drawn = releases.filter((item) => !(form === "notes" && item.unreleased)); + const matches = running !== undefined && drawn.some((item) => !item.unreleased && item.version === running); + const top = running !== undefined && !matches && runningBuild?.length ? buildDetails(runningBuild, "__build", level + 1) : ""; + return `<div class="release-notes" data-release-form="${form}"${base ? ` data-base="${esc(base)}"` : ""}>${top}${drawn.map((item) => release(item, { form, product, running, runningBuild, level })).join("")}</div>`; +} + +/** The versions, as `ReleaseIndex` draws them: "pane" beside the page, "fold" above the first release. */ +export function releaseIndexHtml(releases, { form = "pane", label = "Versions" } = {}) { + const rows = `<ul class="release-index-list">${releases.map((item) => `<li><a class="release-index-link" href="#${releaseId(item)}"><span class="release-index-number"${item.unreleased ? " data-words" : ""}>${item.unreleased ? "Unreleased" : esc(item.version)}</span>${item.date ? `<span class="visually-hidden">, </span><time datetime="${item.date}">${usDate(item.date)}</time>` : ""}</a></li>`).join("")}</ul>`; + if (form === "fold") return `<nav class="release-index" data-release-form="fold" aria-label="${esc(label)}">${fold("__versions-fold", 2, esc(label), rows)}</nav>`; + return `<nav class="release-index" data-release-form="pane" aria-labelledby="__versions-title"><h2 class="release-index-title" id="__versions-title">${esc(label)}</h2>${rows}</nav>`; +} + +/** A whole page body: a package's changelog with its versions, or a product's release notes. */ +export function pageBody(releases, { form, product, running, runningBuild, base, title = form === "notes" ? "Release notes" : "Changelog" }) { + const notes = releaseNotesHtml(releases, { form, product, running, runningBuild, base }); + if (form === "notes") return `<main class="page" id="main"><h1>${esc(title)}</h1>${notes}</main>\n`; + return `<main class="page" id="main"><h1>${esc(title)}</h1><div class="pane-layout"><div class="pane-grid"><div class="pane-page">${releaseIndexHtml(releases, { form: "fold" })}${notes}</div><section class="pane" aria-label="Versions">${releaseIndexHtml(releases)}</section></div></div></main>\n`; +} + +function main(argv) { + const args = [...argv]; + const take = (flag) => { const at = args.indexOf(flag); return at < 0 ? undefined : args.splice(at, 2)[1]; }; + const root = path.resolve(take("--root") ?? process.cwd()); + const form = take("--form") ?? "reference"; + const running = take("--running"); + const base = take("--base"); + const out = take("--out"); + if (!["reference", "notes"].includes(form) || !out) { + process.stderr.write("usage: node tools/changelog/skill-body.mjs --form reference|notes [--root <repository>] [--running <version>] [--base <address>] --out <body.html>\n"); + process.exit(2); + } + const config = loadConfig(root); + fs.writeFileSync(path.resolve(out), pageBody(pageReleases(root, { config }), { form, product: config.product, running, base })); +} + +const { isMain } = await import("../../scripts/is-main.mjs"); +if (isMain(import.meta.url)) { + try { + main(process.argv.slice(2)); + } catch (error) { + process.stderr.write(`${error.message}\n`); + process.exit(1); + } +} diff --git a/tools/changelog/test/audit.test.mjs b/tools/changelog/test/audit.test.mjs new file mode 100644 index 00000000..de033331 --- /dev/null +++ b/tools/changelog/test/audit.test.mjs @@ -0,0 +1,114 @@ +// DECISIONS 320, 4: the audit runs the lines the skill marks (m). It flags and a person decides. The check's false positives must not flag; its +// true ones must. +import assert from "node:assert/strict"; +import fs from "node:fs"; +import path from "node:path"; +import { test } from "node:test"; +import { fileURLToPath } from "node:url"; + +import { audit, auditEntry, auditNotes, auditRecord } from "../audit.mjs"; +import { readConfig } from "../config.mjs"; +import { CONFIG, repository, tempDir, writeRecord } from "./support.mjs"; + +const config = readConfig(CONFIG); +const FIXTURES = path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "fixtures"); +const rules = (text, more = {}) => auditEntry({ id: "x", type: "fixed", bump: "patch", text, ...more }, config).map((flag) => flag.rule); + +test("the check's false positives do not flag", () => { + // R6 accepts old and new in any wording: "which before" is not a flag. + assert.deepEqual(rules("Changed the default gap to 12px, which before was 8px", { type: "changed", bump: "minor" }), []); + // An entry with nothing that has an identifier needs no code formatting. + assert.deepEqual(rules("Fixed the brand mark sitting off center when the sidebar collapsed to its rail"), []); + // Under 12 words is a prompt to look, not a failure. + assert.deepEqual(rules("Fixed `/hooks` losing your place when going back"), []); + // A spelling inside code is the identifier as exported. + assert.deepEqual(rules("Added `NotificationCenter` as the US spelling of `NotificationCentre`", { type: "added", bump: "minor" }), []); + // A dated removal may use the future tense. + assert.deepEqual(rules("Deprecated `Banner` in favor of `Notice`, which will be removed in 2.0.0 no earlier than Mar 1, 2027", { type: "deprecated", bump: "minor" }), []); + // A product's quoted label and a GitHub issue written as repo#45 in a sentence are not pull request numbers. + assert.deepEqual(rules("Fixed \"Waiting to be admitted\" staying on screen after the commander had admitted you"), []); +}); + +test("the check's true positives flag, each with its rule", () => { + assert.deepEqual(rules("Bug fixes and performance improvements"), ["R1", "R9", "R9"]); + assert.deepEqual(rules("Fixed the list losing its place when a row was removed (ENG-398)"), ["R14"]); + assert.deepEqual(rules("Fixed the list losing its place when a row was removed."), ["R3"]); + const thirtyOne = `Fixed ${Array.from({ length: 30 }, (_, index) => `word${index}`).join(" ")}`; + assert.deepEqual(rules(thirtyOne), ["R3"]); + const thirty = `Fixed ${Array.from({ length: 29 }, (_, index) => `word${index}`).join(" ")}`; + assert.deepEqual(rules(thirty), []); +}); + +test("the other marked lines: banned words, punctuation, emoji, British spelling, future tense, numbers and names in the words", () => { + assert.deepEqual(rules("Added a seamless, powerful composer", { type: "added", bump: "minor" }), ["R10", "R10"]); + assert.deepEqual(rules("Fixed the composer!"), ["R10"]); + assert.deepEqual(rules("Fixed the composer — it lost drafts"), ["R15"]); + assert.deepEqual(rules("Fixed the composer; it lost drafts"), ["R15"]); + assert.deepEqual(rules("Fixed the composer losing drafts 🎉"), ["R15"]); + assert.deepEqual(rules("Fixed the colour of a cancelled run"), ["R15"]); + assert.deepEqual(rules("Fixed the list, which will now keep its place"), ["R11"]); + assert.deepEqual(rules("Fixed the list losing its place, from #120"), ["R14"]); + assert.deepEqual(rules("Fixed the list losing its place, reported in PR 120"), ["R14"]); + assert.deepEqual(rules("Fixed the list losing its place, reported by Sam Rivera"), ["R14"]); + assert.deepEqual(rules("Fixed the list losing its place, see repo#45"), ["R14"]); + assert.deepEqual(rules("The list now keeps its place"), ["R1"]); +}); + +test("the version lines: a bump below the floor, a Changed entry with none, a major entry that is not action", () => { + assert.deepEqual(rules("Changed the toast's place", { type: "changed", bump: undefined }), ["Version"]); + assert.deepEqual(rules("Added `Stepper`", { type: "added", bump: "patch" }), ["Version"]); + assert.deepEqual(rules("Changed the default gap to 12px instead of 8px", { type: "changed", bump: "major" }), ["Version"]); +}); + +test("a release: the bump it carries, the pre-release's form and a stable release holding its candidates' entries", () => { + const entry = (id, bump) => ({ id, type: bump === "minor" ? "added" : "fixed", bump, text: "Fixed it" }); + assert.deepEqual(auditRecord({ version: "1.4.1", date: "2026-11-23", previous: "1.4.0", entries: [entry("a", "minor")] }, []).map((flag) => flag.message), ["1.4.1 from 1.4.0 does not carry the minor its entries need"]); + assert.deepEqual(auditRecord({ version: "0.2.1", date: "2026-11-23", previous: "0.2.0", entries: [entry("a", "minor")] }, []), []); + assert.deepEqual(auditRecord({ version: "2.0.0-alpha.1", date: "2026-11-23", entries: [] }, []).map((flag) => flag.rule), ["Version"]); + const rc = { version: "2.0.0-rc.1", date: "2026-12-01", entries: [entry("a", "patch"), entry("b", "patch")] }; + const stable = { version: "2.0.0", date: "2026-12-07", previous: "1.4.0", replaces: ["2.0.0-rc.1"], entries: [entry("a", "patch")] }; + assert.deepEqual(auditRecord(stable, [rc, stable]).map((flag) => flag.message), ['2.0.0-rc.1 held "b", which 2.0.0 does not: was it taken out on purpose?']); +}); + +test("the fixtures pass the audit, and a repository's flags name where they are", () => { + assert.deepEqual(audit(path.join(FIXTURES, "slate")), []); + assert.deepEqual(audit(path.join(FIXTURES, "harbor")), []); + const copy = path.join(tempDir(), "slate"); + fs.cpSync(path.join(FIXTURES, "slate"), copy, { recursive: true }); + fs.writeFileSync(path.join(copy, ".changes", "pr55-1.md"), "---\ntype: fixed\narea: Chart\npr: 55\n---\nFixed the chart.\n"); + fs.writeFileSync(path.join(copy, ".changes", "pr56-1.md"), "---\ntype: fixed\npr: 56\ntickets: [XX-1]\n---\nFixed the chart\n"); + const flags = audit(copy); + assert.deepEqual(flags.map((flag) => [flag.where, flag.rule]), [ + [".changes/pr56-1.md", "Each entry"], + [".changes/pr55-1.md", "R3"], + ["CHANGELOG.md", "Structure"], + ]); + assert.match(flags[0].message, /ticket "XX-1" matches no tracker/); +}); + +test("an area on every entry when any has one, and a tagged record that changed", () => { + const repo = repository(); + writeRecord(repo.dir, { version: "1.0.0", date: "2026-11-20", entries: [{ id: "a", type: "fixed", bump: "patch", area: "List", text: "Fixed the list losing its place" }, { id: "b", type: "fixed", bump: "patch", text: "Fixed the sheet losing its place" }] }); + repo.commitAll("Release 1.0.0"); + repo.git("tag", "v1.0.0"); + writeRecord(repo.dir, { version: "1.0.0", date: "2026-11-21", entries: [{ id: "a", type: "fixed", bump: "patch", area: "List", text: "Fixed the list losing its place" }, { id: "b", type: "fixed", bump: "patch", text: "Fixed the sheet losing its place" }] }); + const flags = audit(repo.dir); + assert.deepEqual(flags.map((flag) => [flag.where, flag.rule]), [["1.0.0 b", "Structure"], ["records", "Version"]]); +}); + +test("R18: a sentence in a headline, summary or paragraph naming mostly what its entries do not is flagged; an instruction is not", () => { + const entries = [ + { id: "pr131-1", type: "added", bump: "minor", area: "Integrations", text: "Added webhook declarations so a monitor can open an incident room when its alarm fires" }, + { id: "pr131-2", type: "added", bump: "minor", area: "Home", text: "Added an \"Opened by a monitor\" mark to incidents that a webhook declared" }, + ]; + // The two claims the code review found in Harbor 1.4.0's first draft. + const release = { version: "1.4.0", entries, title: "A monitor can open an incident room", audiences: [ + { covers: ["pr131-1"], text: "A monitor that can send a webhook can now open an incident room when its alarm fires. The room shows the alarm, the service it names and the checks already run." }, + { for: "For responders", covers: ["pr131-2"], text: "On Home, open an incident marked \"Opened by a monitor\". The first message in the room is the alarm, with a link to the monitor." }, + { for: "For admins", covers: ["pr131-1"], text: "In Settings, open Integrations and add a webhook. Paste its address into your monitor." }, + ] }; + assert.deepEqual(auditNotes(release).map((flag) => flag.line), [ + "The room shows the alarm, the service it names and the checks already run.", + "The first message in the room is the alarm, with a link to the monitor.", + ]); +}); diff --git a/tools/changelog/test/config.test.mjs b/tools/changelog/test/config.test.mjs new file mode 100644 index 00000000..6d5133a5 --- /dev/null +++ b/tools/changelog/test/config.test.mjs @@ -0,0 +1,87 @@ +// DECISIONS 320, 3.2: the tracker config is read and checked before any entry. +import assert from "node:assert/strict"; +import { test } from "node:test"; + +import { readConfig, resolveTicket } from "../config.mjs"; +import { CONFIG, stops } from "./support.mjs"; + +const one = (tracker) => readConfig({ product: "Example", repository: "https://github.com/example/repo", trackers: [tracker] }); + +test("a pattern written with ^ or $ is refused: the tool matches the whole id", () => { + assert.match(stops(() => one({ name: "Tracker", pattern: "^T-[1-9][0-9]*", url: "https://t.example/{id}" })), /without \^ and \$/); + assert.match(stops(() => one({ name: "Tracker", pattern: "T-[1-9][0-9]*$", url: "https://t.example/{id}" })), /without \^ and \$/); +}); + +test("the whole id is matched, so a pattern never matches part of one", () => { + const config = one({ name: "Tracker", pattern: "T-[1-9][0-9]*", url: "https://t.example/{id}" }); + assert.equal(resolveTicket("T-7", config, "f").id, "T-7"); + assert.match(stops(() => resolveTicket("XT-7", config, "f")), /matches no tracker/); + assert.match(stops(() => resolveTicket("T-7x", config, "f")), /matches no tracker/); +}); + +test("a variable that is neither {id} nor a named group is refused when the config is read", () => { + const message = stops(() => one({ name: "Tracker", pattern: "T-[0-9]+", url: "https://t.example/{n}" })); + assert.match(message, /"\{n\}".*neither \{id\} nor a named group/); + assert.match(stops(() => one({ name: "Tracker", pattern: "T-[0-9]+", url: "https://t.example/{id}", label: "T {num}" })), /"\{num\}" in "label"/); +}); + +test("a variable in the host, http and a non-web scheme are refused", () => { + assert.match(stops(() => one({ name: "Tracker", pattern: "(?<team>[a-z]+)-[0-9]+", url: "https://{team}.example/{id}" })), /variable in its host/); + assert.match(stops(() => one({ name: "Tracker", pattern: "T-[0-9]+", url: "http://t.example/{id}" })), /must be https/); + assert.match(stops(() => one({ name: "Tracker", pattern: "T-[0-9]+", url: "javascript:alert({id})" })), /must be https/); + assert.match(stops(() => readConfig({ product: "Example", repository: "http://github.com/example/repo" })), /must be https/); +}); + +test("a name used twice is refused", () => { + const message = stops(() => readConfig({ product: "Example", repository: "https://github.com/example/repo", trackers: [ + { name: "Linear", pattern: "ENG-[1-9][0-9]*", url: "https://a.example/{id}" }, + { name: "Linear", pattern: "DES-[1-9][0-9]*", url: "https://b.example/{id}" }, + ] })); + assert.match(message, /"Linear" is used twice/); +}); + +test("an unknown key, a pattern that does not compile and a linked tracker with no url are refused", () => { + assert.match(stops(() => one({ name: "Tracker", pattern: "T-[0-9]+", url: "https://t.example/{id}", colour: "red" })), /unknown key "colour"/); + assert.match(stops(() => one({ name: "Tracker", pattern: "T-[0-9+", url: "https://t.example/{id}" })), /does not compile/); + assert.match(stops(() => one({ name: "Tracker", pattern: "T-[0-9]+" })), /needs "url"/); + assert.match(stops(() => readConfig({ product: "Example", repository: "https://github.com/example/repo", extra: 1 })), /unknown key "extra"/); +}); + +test("{id} is replaced at every occurrence, and percent-encoded in the URL", () => { + const config = one({ name: "Tracker", pattern: "T-[1-9][0-9]*", url: "https://t.example/{id}/view?key={id}" }); + assert.equal(resolveTicket("T-7", config, "f").href, "https://t.example/T-7/view?key=T-7"); + const loose = one({ name: "Loose", pattern: "[a-z/?#]+", url: "https://t.example/browse/{id}" }); + assert.equal(resolveTicket("a/b?c#d", loose, "f").href, "https://t.example/browse/a%2Fb%3Fc%23d"); +}); + +test("a named group fills the url and the label", () => { + const config = readConfig(CONFIG); + const ticket = resolveTicket("repo#45", config, "f"); + assert.deepEqual(ticket, { tracker: "GitHub", id: "repo#45", label: "issue #45", show: "link", href: "https://github.com/example/repo/issues/45" }); +}); + +test("show: link (the default) links the id, text shows it unlinked, none records it and is not published", () => { + const config = readConfig({ product: "Example", repository: "https://github.com/example/repo", trackers: [ + { name: "Linear", pattern: "ENG-[1-9][0-9]*", url: "https://linear.app/example/issue/{id}" }, + { name: "Jira", pattern: "PROJ-[1-9][0-9]*", url: "https://example.atlassian.net/browse/{id}", show: "text" }, + { name: "Support", pattern: "SUP-[1-9][0-9]*", show: "none" }, + ] }); + assert.equal(resolveTicket("ENG-1", config, "f").href, "https://linear.app/example/issue/ENG-1"); + assert.equal(resolveTicket("PROJ-2", config, "f").href, undefined); + assert.equal(resolveTicket("PROJ-2", config, "f").show, "text"); + assert.equal(resolveTicket("SUP-3", config, "f").show, "none"); + assert.match(stops(() => one({ name: "Tracker", pattern: "T-[0-9]+", url: "https://t.example/{id}", show: "hidden" })), /link, text or none/); +}); + +test("people are keys with a name; the config needs a product and a repository", () => { + assert.match(stops(() => readConfig({ repository: "https://github.com/example/repo" })), /product/); + assert.match(stops(() => readConfig({ product: "Example" })), /repository/); + assert.match(stops(() => readConfig({ product: "Example", repository: "https://github.com/example/repo", people: { Sam: { name: "Sam" } } })), /lowercase/); + assert.match(stops(() => readConfig({ product: "Example", repository: "https://github.com/example/repo", people: { sam: {} } })), /"name" is required/); +}); + +test("a named group that this id's match leaves unset is refused, never written as undefined", () => { + const config = one({ name: "Tickets", pattern: "(?:OTH-[0-9]+|T-(?<n>[0-9]+))", url: "https://tickets.example/{n}" }); + assert.equal(resolveTicket("T-7", config, "f").href, "https://tickets.example/7"); + assert.match(stops(() => resolveTicket("OTH-2", config, "f")), /ticket "OTH-2" leaves \{n\} unset/); +}); diff --git a/tools/changelog/test/entries.test.mjs b/tools/changelog/test/entries.test.mjs new file mode 100644 index 00000000..672fdc72 --- /dev/null +++ b/tools/changelog/test/entries.test.mjs @@ -0,0 +1,159 @@ +// DECISIONS 320, 3.3 and 3.4: an id is read from one place, the `tickets` field of the entry's own file. Every row of 3.3's table, by its input and +// its message; the head's grammar; the id against the file's name; the bump and the author. +import assert from "node:assert/strict"; +import { test } from "node:test"; + +import { readConfig } from "../config.mjs"; +import { readEntry, readNotes } from "../entries.mjs"; +import { CONFIG, entryText, stops } from "./support.mjs"; + +const config = readConfig(CONFIG); +const FILE = ".changes/pr120-1.md"; +const head = (tickets, more = {}) => ({ type: "changed", area: "FormGrid", pr: 120, bump: "major", action: true, ...(tickets === null ? {} : { tickets }), ...more }); +const SENTENCE = "Changed the parent layout item for `FormGrid` to `.basalt-form-grid-frame`, where existing sizing rules must move"; +const read = (source, file = FILE) => readEntry(source, file, config); +const ids = (source, file) => (read(source, file).tickets ?? []).map((ticket) => ticket.id); + +test("the entry says ENG-398, the pull request's body PROJ-88 and a trailer DES-27: only the entry's field is read", () => { + // The body and the trailer are not inputs at all: the reader takes the file and nothing else. Words that look like them are words. + const source = entryText(head("[ENG-398]"), `${SENTENCE}\n\nTickets: PROJ-88\nRefs: DES-27`); + assert.deepEqual(ids(source), ["ENG-398"]); +}); + +test("an empty list and an absent field are the same: no tickets, and nothing to fall back to", () => { + assert.deepEqual(ids(entryText(head("[]"), SENTENCE)), []); + assert.deepEqual(ids(entryText(head(null), SENTENCE)), []); + assert.equal(read(entryText(head(null), SENTENCE)).tickets, undefined); +}); + +test("two entries in one pull request each keep their own list", () => { + assert.deepEqual(ids(entryText(head("[ENG-398]"), SENTENCE), ".changes/pr120-1.md"), ["ENG-398"]); + assert.deepEqual(ids(entryText(head(null), SENTENCE), ".changes/pr120-2.md"), []); +}); + +test("a quoted Tickets: example and a fenced template in the words are words: only the head is read", () => { + const source = `${entryText(head("[PROJ-88]"), SENTENCE)}\nWrite \`Tickets: ENG-1\` in the body.\n\n\`\`\`\ntickets: [ENG-2]\n\`\`\`\n`; + assert.deepEqual(ids(source), ["PROJ-88"]); +}); + +test("two tickets fields stop, naming the file and the line", () => { + const source = `---\ntype: fixed\npr: 120\ntickets: [ENG-398]\ntickets: [PROJ-88]\n---\nFixed the list\n`; + assert.equal(stops(() => read(source)), `${FILE}:5: "tickets" is written twice`); +}); + +test("eng-398, an en dash, #45 and other#45 match no tracker: the message names the file, the id and the trackers", () => { + for (const id of ["eng-398", "ENG–398", "#45", "other#45"]) { + assert.equal(stops(() => read(entryText(head(`[${id}]`), SENTENCE))), `${FILE}: ticket "${id}" matches no tracker (Linear, Jira, GitHub)`); + } +}); + +test("a trailing comma is an empty item, and a duplicate is listed twice", () => { + assert.match(stops(() => read(entryText(head("[ENG-398,]"), SENTENCE))), /^\.changes\/pr120-1\.md:\d+: "tickets" has an empty item/); + assert.match(stops(() => read(entryText(head("[ENG-398, ENG-398]"), SENTENCE))), /"ENG-398" is listed twice in "tickets"/); +}); + +test("spaces around an id are trimmed; a space inside one stops", () => { + assert.deepEqual(ids(entryText(head("[ ENG-398 , PROJ-88 ]"), SENTENCE)), ["ENG-398", "PROJ-88"]); + assert.match(stops(() => read(entryText(head("[ENG 398]"), SENTENCE))), /"ENG 398" in "tickets" holds a space/); +}); + +test("ENG-0398 and ENG-0 stop under the documented number pattern", () => { + for (const id of ["ENG-0398", "ENG-0"]) assert.match(stops(() => read(entryText(head(`[${id}]`), SENTENCE))), new RegExp(`ticket "${id}" matches no tracker`)); +}); + +test("a second tracker that also claims ENG- ids stops, naming both", () => { + const two = readConfig({ ...CONFIG, trackers: [CONFIG.trackers[0], { name: "Tracker 2", pattern: "ENG-[0-9]+", url: "https://t2.example/{id}" }] }); + assert.equal(stops(() => readEntry(entryText(head("[ENG-398]"), SENTENCE), FILE, two)), `${FILE}: ticket "ENG-398" matches 2 trackers (Linear, Tracker 2)`); +}); + +test("tickets keep the order written, each resolved to its tracker, label and address", () => { + const entry = read(entryText(head("[PROJ-88, repo#45, ENG-398]"), SENTENCE)); + assert.deepEqual(entry.tickets, [ + { tracker: "Jira", id: "PROJ-88", label: "PROJ-88", show: "text" }, + { tracker: "GitHub", id: "repo#45", label: "issue #45", show: "link", href: "https://github.com/example/repo/issues/45" }, + { tracker: "Linear", id: "ENG-398", label: "ENG-398", show: "link", href: "https://linear.app/example/issue/ENG-398" }, + ]); +}); + +test("the head's grammar: --- first, closed, key: value lines, known keys only, a list in brackets", () => { + assert.equal(stops(() => read("type: fixed\n---\nFixed it\n")), `${FILE}:1: the file starts with "---"`); + assert.equal(stops(() => read("---\ntype: fixed\nFixed it\n")), `${FILE}: the head is not closed with "---"`); + assert.match(stops(() => read("---\ntype fixed\n---\nFixed it\n")), /pr120-1\.md:2: not a "key: value" line/); + assert.match(stops(() => read("---\ntype: fixed\npr: 120\nTickets: [ENG-1]\n---\nFixed it\n")), /:4: not a "key: value" line/); + assert.match(stops(() => read("---\ntype: fixed\npr: 120\nreviewer: sam\n---\nFixed it\n")), /:4: unknown key "reviewer"/); + assert.match(stops(() => read(entryText(head("ENG-398"), SENTENCE))), /"tickets" is a list in square brackets/); + assert.match(stops(() => read("---\ntype: fixed\npr: 120\n---\n\n")), /the entry's sentence is missing/); + assert.match(stops(() => read("---\ntype: improved\npr: 120\n---\nImproved it\n")), /type "improved" is one of security, deprecated, removed, added, changed, fixed/); +}); + +test("an id the page itself uses is refused: main (the skip link's landmark) and the HTML skill's bh- ids (recheck 4)", () => { + for (const name of ["main", "bh-pop-1", "bh-tooltip", "bh-"]) { + assert.equal(stops(() => read(entryText({ type: "fixed" }), `.changes/${name}.md`)), `.changes/${name}.md: the id "${name}" is the page's own ("main", or the "bh-" ids the HTML skill makes)`); + } + for (const name of ["mainline", "main-menu", "bh", "fix-words", "fix-sources"]) assert.equal(read(entryText({ type: "fixed" }), `.changes/${name}.md`).id, name); +}); + +test("the id is the file's name: pr120-1.md says pr: 120; a slug is lowercase; unreleased and v-digit ids are reserved", () => { + assert.equal(stops(() => read(entryText({ type: "fixed", pr: 121 }), FILE)), `${FILE}: the file is named for pull request 120, so it says "pr: 120", not 121`); + assert.match(stops(() => read(entryText({ type: "fixed" }), FILE)), /so it says "pr: 120"$/); + assert.equal(read(entryText({ type: "fixed" }), ".changes/docs-contrast-note.md").id, "docs-contrast-note"); + assert.match(stops(() => read(entryText({ type: "fixed" }), ".changes/Docs_Note.md")), /lowercase letters, digits and hyphens/); + assert.match(stops(() => read(entryText({ type: "fixed" }), ".changes/unreleased.md")), /reserved/); + assert.match(stops(() => read(entryText({ type: "fixed" }), ".changes/v1-fix.md")), /reserved/); + assert.match(stops(() => read(entryText({ type: "fixed", pr: "12a" }), ".changes/fix-12.md")), /"pr" is the pull request's number/); +}); + +test("the bump: each type's floor, a Changed entry states its own, and a major entry is action", () => { + assert.equal(read(entryText({ type: "added", pr: 120 })).bump, "minor"); + assert.equal(read(entryText({ type: "deprecated", pr: 120 })).bump, "minor"); + assert.equal(read(entryText({ type: "fixed", pr: 120 })).bump, "patch"); + assert.equal(read(entryText({ type: "security", pr: 120 })).bump, "patch"); + assert.equal(read(entryText({ type: "removed", pr: 120, action: true })).bump, "major"); + assert.equal(read(entryText({ type: "fixed", pr: 120, bump: "minor" })).bump, "minor"); + assert.match(stops(() => read(entryText({ type: "changed", pr: 120 }))), /a changed entry states its bump/); + assert.match(stops(() => read(entryText({ type: "added", pr: 120, bump: "patch" }))), /an? added entry needs at least a minor/); + assert.match(stops(() => read(entryText({ type: "removed", pr: 120 }))), /a major entry is always "action: true"/); + assert.match(stops(() => read(entryText({ type: "changed", pr: 120, bump: "major" }))), /a major entry is always "action: true"/); + assert.match(stops(() => read(entryText({ type: "fixed", pr: 120, action: "yes" }))), /"action" is true or false/); + // A deprecation marked action is a minor: action raises nothing. + const deprecation = read(entryText({ type: "deprecated", pr: 120, action: true })); + assert.equal(deprecation.bump, "minor"); + assert.equal(deprecation.action, true); +}); + +test("the author is a key of the config's people, optional; an unknown key stops", () => { + assert.deepEqual(read(entryText({ type: "fixed", pr: 120, author: "sam" })).authors, ["Sam Rivera"]); + assert.equal(read(entryText({ type: "fixed", pr: 120 })).authors, undefined); + assert.match(stops(() => read(entryText({ type: "fixed", pr: 120, author: "octocat" }))), /author "octocat" is not a key of the config's "people" \(sam\)/); +}); + +test("the release notes: each paragraph opens with covers, names entries that exist, and covers at least one", () => { + const entries = new Set(["pr131-1", "pr131-2"]); + const notes = readNotes("---\ntitle: A monitor can open an incident room\n---\ncovers: [pr131-1]\nA monitor can open a room.\n\n## For admins\ncovers: [pr131-1, pr131-2]\nIn Settings, open Integrations.\n", ".changes/release.md", entries); + assert.deepEqual(notes, { title: "A monitor can open an incident room", audiences: [ + { text: "A monitor can open a room.", covers: ["pr131-1"] }, + { for: "For admins", text: "In Settings, open Integrations.", covers: ["pr131-1", "pr131-2"] }, + ] }); + assert.match(stops(() => readNotes("---\n---\ncovers: []\nA claim.\n", ".changes/release.md", entries)), /covers no entry/); + assert.match(stops(() => readNotes("---\n---\ncovers: [pr999-1]\nA claim.\n", ".changes/release.md", entries)), /covers "pr999-1", which is no entry/); + assert.match(stops(() => readNotes("---\n---\nA claim with no covers line.\n", ".changes/release.md", entries)), /opens with a "covers: \[ids\]" line/); + assert.match(stops(() => readNotes("---\n---\n## For admins\n\n", ".changes/release.md", entries)), /"For admins" has no paragraph/); +}); + +test("an entry from a pull request is named for it, and a free name is for a change with none", () => { + assert.match(stops(() => read(entryText({ type: "fixed", pr: 123 }), ".changes/editor.md")), /an entry from pull request 123 is named pr123-1\.md/); + assert.equal(read(entryText({ type: "fixed" }), ".changes/editor.md").id, "editor"); +}); + +test("the author is an own key of the config's people: constructor and the like are refused", () => { + const empty = readConfig({ ...CONFIG, people: {} }); + for (const key of ["constructor", "toString", "__proto__"]) { + assert.match(stops(() => readEntry(entryText({ type: "fixed", pr: 120, author: key }), FILE, empty)), /is not a key of the config's "people"/); + } +}); + +test("a paragraph is one block: a second covers line, or a second paragraph, stops with its line", () => { + const entries = new Set(["pr131-1"]); + assert.match(stops(() => readNotes("---\n---\ncovers: [pr131-1]\nFirst paragraph.\n\ncovers: [missing]\nSecond paragraph.\n", ".changes/release.md", entries)), /release\.md:6: a second "covers" line in one block/); + assert.match(stops(() => readNotes("---\n---\ncovers: [pr131-1]\nFirst paragraph.\n\nSecond paragraph.\n", ".changes/release.md", entries)), /release\.md:\d+: the paragraph for everyone holds two paragraphs/); +}); diff --git a/tools/changelog/test/outputs.test.mjs b/tools/changelog/test/outputs.test.mjs new file mode 100644 index 00000000..f95f2261 --- /dev/null +++ b/tools/changelog/test/outputs.test.mjs @@ -0,0 +1,221 @@ +// DECISIONS 320, 3.4: every output is generated from the records and nothing else. CHANGELOG.md, the page's data and a GitHub Release's body +// hold the same entries in the order of 2.7; a replaced pre-release is in none of them; Unreleased leaves out what a candidate holds; a rebuild +// needs no git and no network; a changed config does not change a frozen release. The fixtures are what the tool writes. +import assert from "node:assert/strict"; +import { execFileSync } from "node:child_process"; +import fs from "node:fs"; +import path from "node:path"; +import { test } from "node:test"; +import { fileURLToPath } from "node:url"; + +import { outputs, taggedDifferences } from "../build.mjs"; +import { loadConfig } from "../config.mjs"; +import { readEntry } from "../entries.mjs"; +import { buildRepository, copyOut, HARBOR, SLATE } from "../fixtures/make.mjs"; +import { sectionsOf, SECTION_NAMES } from "../outputs.mjs"; +import { pageReleases, readRecords } from "../records.mjs"; +import { repository, tempDir, writeRecord } from "./support.mjs"; + +const HERE = path.dirname(fileURLToPath(import.meta.url)); +const FIXTURES = path.join(HERE, "..", "fixtures"); +const BUILD = path.join(HERE, "..", "build.mjs"); + +/** The pull request numbers in a Markdown block, in order: the order the entries stand in. */ +const prsIn = (markdown) => [...markdown.matchAll(/\[#([0-9]+)\]/g)].map((match) => Number(match[1])); +const section = (markdown, start, end) => markdown.slice(markdown.indexOf(start), end ? markdown.indexOf(end, markdown.indexOf(start) + start.length) : undefined); + +test("CHANGELOG.md, the page's data and the GitHub body hold the same entries in the order of 2.7", () => { + const slate = outputs(path.join(FIXTURES, "slate")); + const release = slate.releases.find((candidate) => candidate.version === "0.2.0"); + const order = sectionsOf(release); + assert.deepEqual(order.map((part) => part.key), ["action", "deprecated", "added", "changed", "fixed"]); + const fromData = order.flatMap((part) => part.entries.map((entry) => entry.pr?.number)).filter(Boolean); + const markdown = section(slate.changelog, "## 0.2.0 - 2026-11-16", "## 0.1.0"); + assert.deepEqual(prsIn(markdown), fromData); + const headings = [...markdown.matchAll(/^### (.+)$/gm)].map((match) => match[1]); + assert.deepEqual(headings, ["Action needed", "Deprecated", "Added", "Changed", "Fixed"]); + const github = slate.github("0.2.0"); + assert.deepEqual(prsIn(github), fromData); + assert.deepEqual([...github.matchAll(/^##+ (.+)$/gm)].map((match) => match[1]), ["Action needed", "Changes", "Deprecated", "Added", "Changed", "Fixed"]); + assert.match(github, /^Before upgrading from 0\.1\.0, check these 4 changes\.$/m); + assert.match(github, /Full diff: \[v0\.1\.0\.\.\.v0\.2\.0\]\(https:\/\/github\.com\/example\/slate\/compare\/v0\.1\.0\.\.\.v0\.2\.0\)/); + // Every section name the outputs use is one of the page's fixed words. + for (const heading of headings) assert.ok(Object.values(SECTION_NAMES).includes(heading)); +}); + +test("a product's release: Action needed first with no upgrade line, then the headline over its paragraphs, then the fold over the summary and the list", () => { + const harbor = outputs(path.join(FIXTURES, "harbor")); + const markdown = section(harbor.changelog, "## 2.0.0 - 2026-12-07", "## 1.4.1"); + assert.doesNotMatch(markdown, /Before upgrading/); + assert.deepEqual([...markdown.matchAll(/^(#{3,4}) (.+)$/gm)].map((match) => `${match[1]} ${match[2]}`), ["### Action needed", "### Responders sign in with their own account", "#### For admins", "### Other changes", "#### Added", "#### Fixed"]); + // Every paragraph sits under a heading of its own: none follows a list. + const blocks = markdown.split(/\n\n/).map((block) => block.trim()).filter(Boolean); + blocks.forEach((block, index) => { if (!/^[#-]/.test(block) && index > 0) assert.match(blocks[index - 1], /^#/, `"${block.slice(0, 40)}" follows a heading`); }); + const github = harbor.github("2.0.0"); + assert.deepEqual([...github.matchAll(/^(#{2,3}) (.+)$/gm)].map((match) => `${match[1]} ${match[2]}`), ["## Action needed", "## Responders sign in with their own account", "### For admins", "## Other changes", "### Added", "### Fixed"]); +}); + +test("a product's patch with an action and no headline gets no package upgrade line: the form is the config's", async () => { + const { changelogMarkdown } = await import("../outputs.mjs"); + const release = { version: "1.3.2", date: "2026-11-24", previous: "1.3.1", entries: [{ id: "pr9-1", type: "changed", bump: "patch", action: true, text: "Changed the room timer to stop at midnight, so restart long rooms each day" }] }; + assert.doesNotMatch(changelogMarkdown([release], { form: "notes" }), /Before upgrading/); + assert.match(changelogMarkdown([release], { form: "reference" }), /Before upgrading from 1\.3\.1, check this change\./); +}); + +test("a product release whose every change needs action keeps its summary, after the paragraphs, in CHANGELOG.md and a GitHub Release (recheck 6)", async () => { + const { changelogMarkdown, githubBody } = await import("../outputs.mjs"); + const release = { + version: "1.4.1", previous: "1.4.0", date: "2026-11-22", title: "Recovery", summary: "The recovery screen changed.", + audiences: [{ text: "Use a recovery code.", covers: ["login"] }, { for: "For admins", text: "Send each person a new code.", covers: ["login"] }], + entries: [{ id: "login", type: "security", bump: "patch", action: true, text: "Use a new recovery code after resetting a password" }], + }; + for (const [name, text] of [["CHANGELOG.md", changelogMarkdown([release], { form: "notes" })], ["GitHub", githubBody(release, { form: "notes" })]]) { + const at = (words) => text.indexOf(words); + assert.ok(at("The recovery screen changed.") > 0, `${name}: the summary is written`); + assert.ok(at("Action needed") < at("Use a recovery code.") && at("Send each person a new code.") < at("The recovery screen changed."), `${name}: after the paragraphs, as on the page`); + assert.doesNotMatch(text, /Other changes|All changes/, `${name}: no fold over nothing`); + } +}); + +test("a replaced pre-release is in no output, and its entries are each in one place", () => { + const harbor = outputs(path.join(FIXTURES, "harbor")); + assert.deepEqual(harbor.releases.map((release) => release.version), ["2.0.0", "1.4.1", "1.4.0", "1.3.1", "1.3.0"]); + assert.doesNotMatch(harbor.changelog, /rc\.[12]/); + for (const pr of [140, 141, 142]) assert.equal(prsIn(harbor.changelog).filter((number) => number === pr).length, 1, `#${pr} once`); + assert.throws(() => harbor.github("2.0.0-rc.1"), /not a drawn release/); + assert.deepEqual(harbor.releases[0].replaces, ["2.0.0-rc.1", "2.0.0-rc.2"]); + // Before the stable version shipped, its candidates were drawn as releases of their own, each with what it added. + const records = readRecords(path.join(FIXTURES, "harbor")).filter((record) => record.version !== "2.0.0"); + const before = pageReleases(path.join(FIXTURES, "harbor"), { records, pending: [] }); + assert.deepEqual(before.slice(0, 2).map((release) => [release.version, release.entries.map((entry) => entry.id)]), [["2.0.0-rc.2", ["pr142-1"]], ["2.0.0-rc.1", ["pr140-1", "pr141-1"]]]); +}); + +test("Unreleased is the pending files that no pre-release record holds", () => { + const root = path.join(FIXTURES, "harbor"); + const config = loadConfig(root); + const records = readRecords(root).filter((record) => record.version !== "2.0.0"); + const pending = [ + readEntry("---\ntype: removed\narea: Sign-in\npr: 140\naction: true\n---\nRemoved sign-in with a shared room code\n", ".changes/pr140-1.md", config), + readEntry("---\ntype: fixed\narea: Rooms\npr: 143\n---\nFixed the room list scrolling to the top when a new room opened\n", ".changes/pr143-1.md", config), + ]; + const releases = pageReleases(root, { config, records, pending }); + assert.equal(releases[0].version, "Unreleased"); + assert.deepEqual(releases[0].entries.map((entry) => entry.id), ["pr143-1"]); + assert.equal(releases[0].entries[0].commit, undefined, "an unreleased entry has no commit"); +}); + +test("rebuilding with no git and no network gives the same bytes", () => { + for (const name of ["slate", "harbor"]) { + const copy = path.join(tempDir(), name); + fs.cpSync(path.join(FIXTURES, name), copy, { recursive: true }); + fs.rmSync(path.join(copy, "CHANGELOG.md")); + // No git on the PATH at all: the build reads files and nothing else. + execFileSync(process.execPath, [BUILD, "--root", copy], { env: { PATH: "" } }); + execFileSync(process.execPath, [BUILD, "--root", copy, "--json", path.join(copy, "out.json")], { env: { PATH: "" } }); + assert.equal(fs.readFileSync(path.join(copy, "CHANGELOG.md"), "utf8"), fs.readFileSync(path.join(FIXTURES, name, "CHANGELOG.md"), "utf8"), name); + assert.equal(fs.readFileSync(path.join(copy, "out.json"), "utf8"), fs.readFileSync(path.join(FIXTURES, name, "releases.json"), "utf8"), name); + } +}); + +test("a changed config does not change a frozen release", () => { + const copy = path.join(tempDir(), "slate"); + fs.cpSync(path.join(FIXTURES, "slate"), copy, { recursive: true }); + const before = outputs(copy).releases.filter((release) => !release.unreleased); + const githubBefore = Object.fromEntries(["0.2.1", "0.1.0", "0.2.0"].map((version) => [version, outputs(copy).github(version)])); + const config = JSON.parse(fs.readFileSync(path.join(copy, "changelog.config.json"), "utf8")); + config.repository = "https://git.example/elsewhere/slate"; + config.trackers = config.trackers.map((tracker) => ({ ...tracker, url: tracker.url ? "https://tracker.example/{id}" : undefined, show: tracker.show === "none" ? "link" : tracker.show, ...(tracker.show === "none" ? { url: "https://tracker.example/{id}" } : {}) })); + config.people = {}; + fs.writeFileSync(path.join(copy, "changelog.config.json"), JSON.stringify(config)); + const after = outputs(copy).releases.filter((release) => !release.unreleased); + assert.deepEqual(after, before); + // The GitHub body's comparison is the frozen record's repository, the empty release's too. + for (const version of ["0.2.1", "0.1.0", "0.2.0"]) assert.equal(outputs(copy).github(version), githubBefore[version], version); +}); + +test("a hidden tracker's tickets are recorded and not published; a text tracker's are not linked", () => { + const root = path.join(FIXTURES, "slate"); + const record = readRecords(root).find((candidate) => candidate.version === "0.2.0"); + const frozen = record.entries.find((entry) => entry.id === "pr46-1"); + assert.deepEqual(frozen.tickets.map((ticket) => ticket.id), ["DS-27", "DS-31", "PRJ-90", "slate#45", "SL-131", "SUP-7"]); + const drawn = outputs(root).releases.find((release) => release.version === "0.2.0").entries.find((entry) => entry.id === "pr46-1"); + assert.deepEqual(drawn.tickets.map((ticket) => ticket.label), ["DS-27", "DS-31", "PRJ-90", "issue #45", "SL-131"]); + assert.equal(drawn.tickets.find((ticket) => ticket.label === "PRJ-90").href, undefined); + assert.doesNotMatch(outputs(root).changelog, /SUP-7/); +}); + +test("a record that differs from its tag's copy is found", () => { + const repo = repository(); + writeRecord(repo.dir, { version: "1.0.0", date: "2026-11-20", entries: [] }); + repo.commitAll("Release 1.0.0"); + repo.git("tag", "v1.0.0"); + assert.deepEqual(taggedDifferences(repo.dir), []); + writeRecord(repo.dir, { version: "1.0.0", date: "2026-11-21", entries: [] }); + assert.deepEqual(taggedDifferences(repo.dir), ["changelog/releases/1.0.0.json differs from the copy tagged v1.0.0; a published version is never edited"]); +}); + +test("the fixtures are what the tool writes, from their histories", () => { + for (const project of [SLATE, HARBOR]) { + const dir = buildRepository(project, tempDir(`changelog-${project.name}-`)); + const out = path.join(tempDir(), project.name); + copyOut(project, dir, out); + for (const file of ["CHANGELOG.md", "releases.json", ...(project.name === "harbor" ? ["releases-candidate.json"] : []), ...fs.readdirSync(path.join(out, "changelog", "releases")).map((name) => path.join("changelog", "releases", name))]) { + assert.equal(fs.readFileSync(path.join(out, file), "utf8"), fs.readFileSync(path.join(FIXTURES, project.name, file), "utf8"), `${project.name}/${file}`); + } + assert.deepEqual(fs.readdirSync(path.join(out, "changelog", "releases")).sort(), fs.readdirSync(path.join(FIXTURES, project.name, "changelog", "releases")).sort()); + } +}); + +test("a tagged record that is deleted is found, as an edited one is", () => { + const repo = repository(); + writeRecord(repo.dir, { version: "1.0.0", date: "2026-11-20", entries: [] }); + repo.commitAll("Release 1.0.0"); + repo.git("tag", "v1.0.0"); + fs.rmSync(path.join(repo.dir, "changelog", "releases", "1.0.0.json")); + assert.deepEqual(taggedDifferences(repo.dir), ["changelog/releases/1.0.0.json is gone, and v1.0.0 released it; a published version is never deleted"]); + // A maintained line's tag is not in the default branch's history, so the default branch does not answer for it. + repo.git("checkout", "-q", "--", "."); + repo.git("checkout", "-q", "-b", "release/0.x", "HEAD~1"); + writeRecord(repo.dir, { version: "0.9.1", date: "2026-11-21", entries: [] }); + repo.commitAll("Release 0.9.1"); + repo.git("tag", "v0.9.1"); + repo.git("checkout", "-q", "main"); + assert.deepEqual(taggedDifferences(repo.dir), []); +}); + +test("a maintained line's record, once a pull request has added it to the default branch, cannot be deleted there (recheck 3)", () => { + const repo = repository(); + writeRecord(repo.dir, { version: "2.0.0", date: "2026-11-20", entries: [] }); + repo.commitAll("Release 2.0.0"); + repo.git("tag", "v2.0.0"); + repo.git("checkout", "-q", "-b", "release/1.x", "HEAD~1"); + writeRecord(repo.dir, { version: "1.4.1", date: "2026-11-22", entries: [] }); + repo.commitAll("Release 1.4.1"); + repo.git("tag", "v1.4.1"); + repo.git("checkout", "-q", "main"); + assert.deepEqual(taggedDifferences(repo.dir), [], "before it is brought over, the default branch does not answer for it"); + repo.git("checkout", "v1.4.1", "--", "changelog/releases/1.4.1.json"); + repo.commitAll("Add the 1.4.1 record (#77)"); + assert.deepEqual(taggedDifferences(repo.dir), []); + fs.rmSync(path.join(repo.dir, "changelog", "releases", "1.4.1.json")); + const gone = ["changelog/releases/1.4.1.json is gone, and this branch's history published it; a published version is never deleted"]; + assert.deepEqual(taggedDifferences(repo.dir), gone, "deleted in the working tree"); + repo.commitAll("Remove the 1.4.1 record"); + assert.deepEqual(taggedDifferences(repo.dir), gone, "and once the deletion is committed"); + // A record deleted from the default branch with its own tag merged is reported once, by its tag. + fs.rmSync(path.join(repo.dir, "changelog", "releases", "2.0.0.json")); + assert.deepEqual(taggedDifferences(repo.dir), ["changelog/releases/2.0.0.json is gone, and v2.0.0 released it; a published version is never deleted", ...gone]); +}); + +test("a pending file whose id a shipped release holds stops the build; a candidate's pending copy does not", () => { + const copy = path.join(tempDir(), "slate"); + fs.cpSync(path.join(FIXTURES, "slate"), copy, { recursive: true }); + fs.writeFileSync(path.join(copy, ".changes", "pr52-1.md"), "---\ntype: fixed\narea: Composer\npr: 52\n---\nFixed `Composer` losing its draft when the window lost focus\n"); + assert.throws(() => outputs(copy), /\.changes\/pr52-1\.md: the id is held by 0\.2\.1, which has shipped/); + // Harbor before 2.0.0: the candidates' entries are pending on purpose, and Unreleased leaves them out. + const root = path.join(FIXTURES, "harbor"); + const config = loadConfig(root); + const records = readRecords(root).filter((record) => record.version !== "2.0.0"); + const pending = [readEntry("---\ntype: added\narea: Sign-in\npr: 141\n---\nAdded single sign-on through your company's identity provider\n", ".changes/pr141-1.md", config)]; + assert.equal(pageReleases(root, { config, records, pending })[0].version, "2.0.0-rc.2"); +}); diff --git a/tools/changelog/test/release.test.mjs b/tools/changelog/test/release.test.mjs new file mode 100644 index 00000000..4aec7228 --- /dev/null +++ b/tools/changelog/test/release.test.mjs @@ -0,0 +1,366 @@ +// DECISIONS 320, 1.1 and 3.4: the freeze. The bump in 0.x and from 1.0, the line, pre-releases, the commit that added each file, and what it +// refuses. Every repository here is a throwaway one with made-up entries. +import assert from "node:assert/strict"; +import { execFileSync } from "node:child_process"; +import fs from "node:fs"; +import path from "node:path"; +import { spawnSync } from "node:child_process"; +import { test } from "node:test"; +import { fileURLToPath } from "node:url"; + +import { pageReleases, readRecords } from "../records.mjs"; +import { freeze } from "../release.mjs"; +import { readConfig } from "../config.mjs"; +import { CONFIG, repository, stops, tempDir, writeRecord } from "./support.mjs"; + +const config = readConfig(CONFIG); +const released = (version, date, entries = []) => ({ version, date, entries }); +const fixed = (pr, n = 1) => [`pr${pr}-${n}`, { type: "fixed", area: "List", pr }]; + +test("from 1.0: a patch is refused for an Added entry, and the message says the least version", () => { + const repo = repository(); + writeRecord(repo.dir, released("1.4.0", "2026-11-20")); + repo.commitAll("Release 1.4.0"); + repo.entry("pr10-1", { type: "added", area: "Stepper", pr: 10 }, "Added `Stepper` with queued and running states"); + assert.equal(stops(() => freeze({ root: repo.dir, version: "1.4.1", date: "2026-11-23" })), "1.4.1 understates the release: from 1.4.0 it needs a minor (pr10-1), so at least 1.5.0"); + assert.equal(freeze({ root: repo.dir, version: "1.5.0", date: "2026-11-23" }).record.previous, "1.4.0"); +}); + +test("in 0.x the numbers move one place right: an addition rides a patch, and a breaking change needs the minor", () => { + const repo = repository(); + writeRecord(repo.dir, released("0.2.0", "2026-11-20")); + repo.commitAll("Release 0.2.0"); + repo.entry("pr11-1", { type: "added", area: "Stepper", pr: 11 }, "Added `Stepper` with queued and running states"); + assert.equal(freeze({ root: repo.dir, version: "0.2.1", date: "2026-11-21" }).record.entries[0].id, "pr11-1"); + repo.commitAll("Release 0.2.1"); + repo.entry("pr12-1", { type: "removed", area: "Banner", pr: 12, action: true }, "Removed `Banner`, so use `Notice` with the same props"); + assert.equal(stops(() => freeze({ root: repo.dir, version: "0.2.2", date: "2026-11-23" })), "0.2.2 understates the release: from 0.2.1 it needs a major (pr12-1), one place right in 0.x, so at least 0.3.0"); + assert.equal(freeze({ root: repo.dir, version: "0.3.0", date: "2026-11-23" }).record.previous, "0.2.1"); +}); + +test("a minor is accepted for a deprecation marked action: action raises nothing", () => { + const repo = repository(); + writeRecord(repo.dir, released("1.4.0", "2026-11-20")); + repo.commitAll("Release 1.4.0"); + repo.entry("pr13-1", { type: "deprecated", area: "Banner", pr: 13, action: true }, "Deprecated `Banner` in favor of `Notice`, removed in 2.0.0 no earlier than Mar 1, 2027"); + const { record } = freeze({ root: repo.dir, version: "1.5.0", date: "2026-11-23" }); + assert.deepEqual(record.entries.map((entry) => [entry.id, entry.bump, entry.action]), [["pr13-1", "minor", true]]); +}); + +test("a Changed entry with no bump, a bump below its floor and a major entry without action are refused", () => { + const cases = [ + [{ type: "changed", area: "Toast", pr: 14 }, /a changed entry states its bump/], + [{ type: "added", area: "Toast", pr: 14, bump: "patch" }, /an? added entry needs at least a minor/], + [{ type: "changed", area: "Toast", pr: 14, bump: "major" }, /a major entry is always "action: true"/], + ]; + for (const [head, message] of cases) { + const repo = repository(); + repo.entry("pr14-1", head, "Changed toasts to sit below the bar instead of above the tabs"); + assert.match(stops(() => freeze({ root: repo.dir, version: "1.0.0", date: "2026-11-23" })), message); + assert.deepEqual(fs.readdirSync(repo.dir).filter((name) => name === "changelog"), [], "nothing is written before every check passes"); + } +}); + +test("a version higher than the entries need is accepted: the version is the owner's to give", () => { + const repo = repository(); + writeRecord(repo.dir, released("1.4.0", "2026-11-20")); + repo.commitAll("Release 1.4.0"); + repo.entry(...fixed(15), "Fixed the list losing its place when a row was removed"); + assert.equal(freeze({ root: repo.dir, version: "2.0.0", date: "2026-11-23" }).record.previous, "1.4.0"); +}); + +test("the line: 1.4.1 is accepted after 2.0.0, 1.3.9 is refused after 1.4.0, and a version opening a line must top them all", () => { + const repo = repository(); + writeRecord(repo.dir, released("1.3.0", "2026-11-01")); + writeRecord(repo.dir, released("1.4.0", "2026-11-10")); + writeRecord(repo.dir, { ...released("2.0.0", "2026-11-20"), previous: "1.4.0" }); + repo.commitAll("Earlier releases"); + repo.entry(...fixed(16), "Fixed the list losing its place when a row was removed"); + assert.equal(stops(() => freeze({ root: repo.dir, version: "1.3.9", date: "2026-11-23" })), "1.3.9 is not higher than 1.4.0, released in its line (1.x.x)"); + assert.equal(stops(() => freeze({ root: repo.dir, version: "2.0.0", date: "2026-11-23" })), "2.0.0 is published, and a published version is never edited"); + const { record } = freeze({ root: repo.dir, version: "1.4.1", date: "2026-11-23" }); + assert.equal(record.previous, "1.4.0", "measured from the highest stable release below it in its own line"); + // 0.x lines are the minor: 0.3.0 opens a line and must be higher than every release there is. + const other = repository(); + writeRecord(other.dir, released("1.0.0", "2026-11-01")); + other.commitAll("Release 1.0.0"); + other.entry(...fixed(17), "Fixed the list losing its place when a row was removed"); + assert.equal(stops(() => freeze({ root: other.dir, version: "0.3.0", date: "2026-11-23" })), "0.3.0 opens a line, so it must be higher than every release; 1.0.0 is higher"); +}); + +test("two releases of one day are ordered by precedence, never by date", () => { + const repo = repository(); + writeRecord(repo.dir, released("1.4.0", "2026-11-23")); + repo.commitAll("Release 1.4.0"); + repo.entry(...fixed(18), "Fixed the list losing its place when a row was removed"); + freeze({ root: repo.dir, version: "1.4.1", date: "2026-11-23" }); + // A backport the same day to an older line: it sits below by precedence, though it was frozen last. + writeRecord(repo.dir, released("1.3.5", "2026-11-23")); + assert.deepEqual(pageReleases(repo.dir, { config }).map((release) => release.version), ["1.4.1", "1.4.0", "1.3.5"]); +}); + +test("pre-releases: a candidate's freeze removes nothing, the next holds only what is new, the stable version holds all under the same ids", () => { + const repo = repository(); + writeRecord(repo.dir, released("1.4.0", "2026-11-20")); + repo.commitAll("Release 1.4.0"); + repo.entry("pr20-1", { type: "removed", area: "Sign-in", pr: 20, action: true }, "Removed sign-in with a shared code, so each person signs in with their own account"); + repo.entry("pr21-1", { type: "added", area: "Sign-in", pr: 21 }, "Added single sign-on through your company's identity provider"); + const rc1 = freeze({ root: repo.dir, version: "2.0.0-rc.1", date: "2026-12-01" }); + assert.deepEqual(rc1.removed, []); + assert.deepEqual(repo.pending(), ["pr20-1.md", "pr21-1.md"], "every pending file stays"); + repo.commitAll("Release 2.0.0-rc.1"); + repo.entry("pr22-1", { type: "added", area: "Sign-in", pr: 22 }, "Added a sign-in page that names your identity provider"); + const rc2 = freeze({ root: repo.dir, version: "2.0.0-rc.2", date: "2026-12-03" }); + assert.deepEqual(rc2.record.entries.map((entry) => entry.id), ["pr22-1"]); + repo.commitAll("Release 2.0.0-rc.2"); + // The Unreleased section is what no candidate holds: nothing, here. + assert.equal(pageReleases(repo.dir, { config })[0].version, "2.0.0-rc.2"); + const stable = freeze({ root: repo.dir, version: "2.0.0", date: "2026-12-07" }); + assert.deepEqual(stable.record.entries.map((entry) => entry.id).sort(), ["pr20-1", "pr21-1", "pr22-1"]); + assert.deepEqual(stable.record.replaces, ["2.0.0-rc.1", "2.0.0-rc.2"]); + assert.equal(stable.record.previous, "1.4.0"); + // The same entry has the same commit in the candidate and in the stable release. + assert.equal(stable.record.entries.find((entry) => entry.id === "pr20-1").commit.sha, repo.record("2.0.0-rc.1").entries.find((entry) => entry.id === "pr20-1").commit.sha); + assert.deepEqual(repo.pending(), [], "the stable version takes every pending file"); + assert.deepEqual(pageReleases(repo.dir, { config }).map((release) => release.version), ["2.0.0", "1.4.0"], "a replaced candidate is not drawn"); +}); + +test("a canary has no freeze, and a pre-release is -beta.N or -rc.N", () => { + const repo = repository(); + repo.entry(...fixed(23), "Fixed the list losing its place when a row was removed"); + assert.match(stops(() => freeze({ root: repo.dir, version: "1.0.0-canary.20261123.1", date: "2026-11-23" })), /a canary is a build from the default branch, with no freeze/); + assert.match(stops(() => freeze({ root: repo.dir, version: "1.0.0-alpha.1", date: "2026-11-23" })), /-beta\.N or -rc\.N/); + assert.match(stops(() => freeze({ root: repo.dir, version: "1.0.0+9f3c1e2", date: "2026-11-23" })), /holds build metadata/); + assert.match(stops(() => freeze({ root: repo.dir, version: "2026.11.23.1", date: "2026-11-23" })), /not a SemVer version/); + assert.match(stops(() => freeze({ root: repo.dir, version: "1.0.0", date: "2026-11-31" })), /a calendar date/); +}); + +test("the commit is the first-parent commit that added the file: a merge, a squash and a rebase", () => { + const repo = repository(); + // A merge: the entry is committed on a branch and merged with a merge commit. The merge is the commit that put it on main. + repo.git("checkout", "-q", "-b", "feature"); + repo.entry("pr30-1", { type: "fixed", area: "List", pr: 30 }, "Fixed the list losing its place when a row was removed", "Fix the list"); + repo.git("checkout", "-q", "main"); + repo.git("merge", "-q", "--no-ff", "feature", "-m", "Merge pull request #30 from example/feature"); + const merge = repo.git("rev-parse", "HEAD"); + // A squash: one commit on main, its subject ending with the pull request. + const squash = repo.entry("pr31-1", { type: "fixed", area: "Sheet", pr: 31 }, "Fixed clipped focus rings at the top of a sheet's body", "Fix the sheet's rings (#31)"); + // A rebase: the branch's own commit, replayed onto main, with no number in its subject. + repo.git("checkout", "-q", "-b", "rebased"); + repo.entry("pr32-1", { type: "fixed", area: "Toast", pr: 32 }, "Fixed toasts stacking under the tab bar on phones", "Fix toasts under the tab bar"); + repo.git("checkout", "-q", "main"); + repo.git("rebase", "-q", "rebased"); + const rebased = repo.git("rev-parse", "HEAD"); + const { record } = freeze({ root: repo.dir, version: "1.0.0", date: "2026-11-23" }); + const sha = (id) => record.entries.find((entry) => entry.id === id).commit.sha; + assert.equal(sha("pr30-1"), merge); + assert.equal(sha("pr31-1"), squash); + assert.equal(sha("pr32-1"), rebased); + assert.equal(record.entries.find((entry) => entry.id === "pr31-1").commit.href, `https://github.com/example/repo/commit/${squash}`); +}); + +test("a commit whose subject names another pull request stops, showing both; an uncommitted entry stops", () => { + const repo = repository(); + repo.entry("pr33-1", { type: "fixed", area: "List", pr: 33 }, "Fixed the list losing its place when a row was removed", "Fix the list (#34)"); + assert.match(stops(() => freeze({ root: repo.dir, version: "1.0.0", date: "2026-11-23" })), /\.changes\/pr33-1\.md: says pull request 33, and the commit that added it \([0-9a-f]{8}\) is "Fix the list \(#34\)"/); + const fresh = repository(); + fresh.write("pr35-1", { type: "fixed", area: "List", pr: 35 }, "Fixed the list losing its place when a row was removed"); + assert.match(stops(() => freeze({ root: fresh.dir, version: "1.0.0", date: "2026-11-23" })), /no commit on this branch added it/); +}); + +test("a shallow clone is refused", () => { + const repo = repository(); + repo.entry(...fixed(36), "Fixed the list losing its place when a row was removed"); + repo.entry(...fixed(37), "Fixed the list losing its place when a row was added"); + const clone = path.join(tempDir(), "clone"); + execFileSync("git", ["clone", "-q", "--depth", "1", `file://${repo.dir}`, clone]); + assert.match(stops(() => freeze({ root: clone, version: "1.0.0", date: "2026-11-23" })), /this clone is shallow/); +}); + +test("a record is never overwritten, and a published version is never frozen again", () => { + const repo = repository(); + repo.entry(...fixed(38), "Fixed the list losing its place when a row was removed"); + freeze({ root: repo.dir, version: "1.0.0", date: "2026-11-23" }); + const before = fs.readFileSync(path.join(repo.dir, "changelog", "releases", "1.0.0.json"), "utf8"); + assert.equal(stops(() => freeze({ root: repo.dir, version: "1.0.0", date: "2026-11-24" })), "1.0.0 is published, and a published version is never edited"); + assert.equal(fs.readFileSync(path.join(repo.dir, "changelog", "releases", "1.0.0.json"), "utf8"), before); +}); + +test("covers is enforced: a paragraph naming no entry, or one this release does not hold, stops", () => { + const repo = repository(); + repo.entry("pr40-1", { type: "added", area: "Integrations", pr: 40 }, "Added webhook declarations so a monitor can open a room"); + repo.notes("---\ntitle: A monitor can open a room\n---\ncovers: [pr41-1]\nA monitor can open a room.\n"); + assert.match(stops(() => freeze({ root: repo.dir, version: "1.0.0", date: "2026-11-23" })), /covers "pr41-1", which is no entry/); + repo.notes("---\ntitle: A monitor can open a room\n---\ncovers: [pr40-1]\nA monitor can open a room.\n"); + const { record } = freeze({ root: repo.dir, version: "1.0.0", date: "2026-11-23" }); + assert.deepEqual(record.audiences, [{ text: "A monitor can open a room.", covers: ["pr40-1"] }]); + assert.equal(record.title, "A monitor can open a room"); +}); + +test("a release with no entries needs a summary; one of more than three needs a summary or paragraphs", () => { + const empty = repository(); + assert.match(stops(() => freeze({ root: empty.dir, version: "0.1.0", date: "2026-11-02" })), /has no entries, so it needs a summary/); + empty.notes("---\nsummary: The first version in this changelog. Earlier work is in the repository's history.\n---\n"); + assert.equal(freeze({ root: empty.dir, version: "0.1.0", date: "2026-11-02" }).record.entries.length, 0); + const many = repository(); + for (let pr = 50; pr < 54; pr++) many.entry(...fixed(pr), `Fixed the list losing its place in case ${pr}`); + assert.match(stops(() => freeze({ root: many.dir, version: "1.0.0", date: "2026-11-23" })), /has 4 changes, so it needs a summary/); +}); + +test("an unknown author is refused; an entry with no author is accepted and has no authors", () => { + const repo = repository(); + repo.entry("pr60-1", { type: "fixed", area: "List", pr: 60, author: "octocat" }, "Fixed the list losing its place when a row was removed"); + assert.match(stops(() => freeze({ root: repo.dir, version: "1.0.0", date: "2026-11-23" })), /author "octocat" is not a key/); + const ok = repository(); + ok.entry("pr61-1", { type: "fixed", area: "List", pr: 61, author: "sam" }, "Fixed the list losing its place when a row was removed"); + ok.entry("pr62-1", { type: "fixed", area: "List", pr: 62 }, "Fixed the list losing its place when a row was added"); + const { record } = freeze({ root: ok.dir, version: "1.0.0", date: "2026-11-23" }); + assert.deepEqual(record.entries.find((entry) => entry.id === "pr61-1").authors, ["Sam Rivera"]); + assert.equal("authors" in record.entries.find((entry) => entry.id === "pr62-1"), false); +}); + +test("an id held by two records that do not replace one another stops", () => { + const repo = repository(); + writeRecord(repo.dir, { ...released("1.4.0", "2026-11-20"), entries: [{ id: "pr70-1", type: "fixed", bump: "patch", text: "Fixed the list" }] }); + repo.commitAll("Release 1.4.0"); + // A backport that reuses the id instead of writing its own entry. + repo.entry("pr70-1", { type: "fixed", area: "List", pr: 70 }, "Fixed the list losing its place when a row was removed"); + assert.match(stops(() => freeze({ root: repo.dir, version: "1.4.1", date: "2026-11-23" })), /pr70-1\.md: the id is already held by 1\.4\.0; a backport writes its own entry/); + // Two records holding one id, neither replacing the other: reading them stops. + writeRecord(repo.dir, { ...released("2.0.0", "2026-11-21"), entries: [{ id: "pr70-1", type: "fixed", bump: "patch", text: "Fixed the list" }] }); + assert.match(stops(() => readRecords(repo.dir)), /the entry id "pr70-1" is held by 1\.4\.0 and 2\.0\.0/); + // A stable release and the candidate it replaces may share it. + fs.rmSync(path.join(repo.dir, "changelog", "releases", "2.0.0.json")); + writeRecord(repo.dir, { ...released("2.0.0-rc.1", "2026-11-21"), entries: [{ id: "pr71-1", type: "fixed", bump: "patch", text: "Fixed the list" }] }); + writeRecord(repo.dir, { ...released("2.0.0", "2026-11-22"), replaces: ["2.0.0-rc.1"], entries: [{ id: "pr71-1", type: "fixed", bump: "patch", text: "Fixed the list" }] }); + assert.equal(readRecords(repo.dir).length, 3); +}); + +test("a stable version removes the pending files and release.md, and regenerates CHANGELOG.md", () => { + const repo = repository(); + repo.entry("pr80-1", { type: "added", area: "Stepper", pr: 80, tickets: "[ENG-12, PROJ-4]" }, "Added `Stepper` with queued and running states"); + repo.notes("---\nsummary: Slate adds a stepper.\n---\n"); + const result = freeze({ root: repo.dir, version: "1.0.0", date: "2026-11-23" }); + assert.deepEqual(result.removed, [".changes/pr80-1.md", ".changes/release.md"]); + const changelog = fs.readFileSync(path.join(repo.dir, "CHANGELOG.md"), "utf8"); + assert.match(changelog, /^## 1\.0\.0 - 2026-11-23$/m); + assert.match(changelog, /^- Stepper: Added `Stepper` with queued and running states \(\[#80\]\(https:\/\/github\.com\/example\/repo\/pull\/80\), Linear \[ENG-12\]\(https:\/\/linear\.app\/example\/issue\/ENG-12\), Jira PROJ-4\)$/m); + assert.deepEqual(result.record.entries[0].tickets.map((ticket) => ticket.id), ["ENG-12", "PROJ-4"]); +}); + +test("a freeze that fails consumes nothing, and the same freeze then succeeds", () => { + const repo = repository(); + repo.entry("pr90-1", { type: "added", area: "Stepper", pr: 90 }, "Added `Stepper` with queued and running states"); + repo.notes("---\nsummary: The first version in this changelog.\n---\n"); + // An output that cannot be written: CHANGELOG.md is a directory. + fs.mkdirSync(path.join(repo.dir, "CHANGELOG.md")); + assert.match(stops(() => freeze({ root: repo.dir, version: "1.0.0", date: "2026-11-23" })), /EISDIR|directory/); + assert.equal(fs.existsSync(path.join(repo.dir, "changelog", "releases", "1.0.0.json")), false, "no record"); + assert.deepEqual(repo.pending(), ["pr90-1.md", "release.md"], "every input is where it was"); + assert.deepEqual(fs.readdirSync(path.join(repo.dir, "changelog", "releases")), [], "no staged file is left"); + fs.rmSync(path.join(repo.dir, "CHANGELOG.md"), { recursive: true }); + const { record, removed } = freeze({ root: repo.dir, version: "1.0.0", date: "2026-11-23" }); + assert.equal(record.summary, "The first version in this changelog."); + assert.deepEqual(removed, [".changes/pr90-1.md", ".changes/release.md"]); +}); + +test("a freeze interrupted after its record was written is finished by running it again", () => { + const repo = repository(); + repo.entry("pr91-1", { type: "fixed", area: "List", pr: 91 }, "Fixed the list losing its place when a row was removed"); + freeze({ root: repo.dir, version: "1.0.0", date: "2026-11-23" }); + // As if it had stopped before consuming its inputs: the pending file is back, the record is there. + repo.git("checkout", "--", ".changes"); + assert.deepEqual(repo.pending(), ["pr91-1.md"]); + const again = freeze({ root: repo.dir, version: "1.0.0", date: "2026-11-23" }); + assert.equal(again.finished, true); + assert.deepEqual(repo.pending(), []); + // A different freeze of the same version is refused: it is published. + repo.git("checkout", "--", ".changes"); + assert.equal(stops(() => freeze({ root: repo.dir, version: "1.0.0", date: "2026-11-24" })), "1.0.0 is published, and a published version is never edited"); +}); + +test("pre-release numbers compare as integers of any size", async () => { + const { compare } = await import("../semver.mjs"); + assert.ok(compare("1.0.0-rc.9007199254740993", "1.0.0-rc.9007199254740992") > 0); + assert.ok(compare("1.0.0-rc.10", "1.0.0-rc.9") > 0); +}); + +const RELEASE_CLI = fileURLToPath(new URL("../release.mjs", import.meta.url)); +const BUILD_CLI = fileURLToPath(new URL("../build.mjs", import.meta.url)); +const check = (dir) => spawnSync(process.execPath, [BUILD_CLI, "--check", "--root", dir], { encoding: "utf8" }); + +test("a freeze that stops while removing its pending files is finished by running it again (recheck 1)", () => { + const repo = repository(); + repo.entry("editor", { type: "fixed", area: "Editor" }, "Fixed the editor losing its draft when the page reloaded"); + repo.entry("list", { type: "fixed", area: "List" }, "Fixed the list losing its place when a row was removed"); + repo.notes("---\nsummary: Drafts survive a reload.\n---\n"); + // The second pending file cannot be removed (as a locked file on macOS): the first is gone by then. + const rm = fs.rmSync; + fs.rmSync = function (target, ...rest) { + if (String(target).endsWith(path.join(".changes", "list.md"))) throw Object.assign(new Error("operation not permitted"), { code: "EPERM" }); + return rm.call(this, target, ...rest); + }; + try { + assert.equal(stops(() => freeze({ root: repo.dir, version: "1.0.0", date: "2026-11-23" })), "1.0.0 is frozen, and removing .changes/list.md failed (EPERM); fix that, then run the same freeze again to finish it"); + } finally { + fs.rmSync = rm; + } + assert.deepEqual(repo.pending(), ["list.md", "release.md"], "the first file went, the rest stayed"); + const again = freeze({ root: repo.dir, version: "1.0.0", date: "2026-11-23" }); + assert.equal(again.finished, true); + assert.deepEqual(again.removed, [".changes/list.md", ".changes/release.md"]); + assert.deepEqual(repo.pending(), []); + assert.deepEqual(repo.record("1.0.0").entries.map((entry) => entry.id).sort(), ["editor", "list"]); + assert.equal(check(repo.dir).status, 0, check(repo.dir).stderr); + // Finished, it is published: a third run, or one with another date, is refused. + assert.equal(stops(() => freeze({ root: repo.dir, version: "1.0.0", date: "2026-11-23" })), "1.0.0 is published, and a published version is never edited"); +}); + +test("a pending file that says something other than the record does not finish a stopped freeze: the version is published", () => { + const repo = repository(); + repo.entry("editor", { type: "fixed", area: "Editor" }, "Fixed the editor losing its draft when the page reloaded"); + freeze({ root: repo.dir, version: "1.0.0", date: "2026-11-23" }); + repo.write("editor", { type: "fixed", area: "Editor" }, "Fixed the editor dropping its draft on a reload"); + assert.equal(stops(() => freeze({ root: repo.dir, version: "1.0.0", date: "2026-11-23" })), "1.0.0 is published, and a published version is never edited"); + assert.deepEqual(repo.pending(), ["editor.md"], "nothing is removed"); +}); + +test("two freezes never run at once: a second one, started while the first installs its record, is refused and records nothing (recheck 2)", () => { + const repo = repository(); + repo.entry("editor", { type: "fixed", area: "Editor" }, "Fixed the editor losing its draft when the page reloaded"); + repo.entry("list", { type: "fixed", area: "List" }, "Fixed the list losing its place when a row was removed"); + // The first CLI runs a second, unmodified CLI for another version at the moment it installs its record. + const dir = tempDir(); + const hook = path.join(dir, "interleave.mjs"); + const second = path.join(dir, "second.json"); + fs.writeFileSync(hook, `import fs from "node:fs"; +import { spawnSync } from "node:child_process"; +const link = fs.linkSync; +fs.linkSync = function (...args) { + const run = spawnSync(process.execPath, [process.argv[1], "--root", process.env.FREEZE_ROOT, "1.0.1", "--date", "2026-11-23"], { encoding: "utf8" }); + fs.writeFileSync(process.env.FREEZE_SECOND, JSON.stringify({ status: run.status, message: (run.stderr || run.stdout).trim() })); + return link.apply(this, args); +}; +`); + const first = spawnSync(process.execPath, ["--import", hook, RELEASE_CLI, "--root", repo.dir, "1.0.0", "--date", "2026-11-23"], { encoding: "utf8", env: { ...process.env, FREEZE_ROOT: repo.dir, FREEZE_SECOND: second }, timeout: 60_000 }); + assert.equal(first.status, 0, first.stderr); + const other = JSON.parse(fs.readFileSync(second, "utf8")); + assert.equal(other.status, 1); + assert.match(other.message, /^another freeze is running \(process [0-9]+\); run this one again when it has ended$/); + assert.deepEqual(fs.readdirSync(path.join(repo.dir, "changelog", "releases")), ["1.0.0.json"]); + assert.deepEqual(repo.pending(), []); + assert.equal(check(repo.dir).status, 0); +}); + +test("the freeze's lock: held by a running process it refuses; left by a stopped one it is taken over", () => { + const repo = repository(); + repo.entry("editor", { type: "fixed", area: "Editor" }, "Fixed the editor losing its draft when the page reloaded"); + const lock = path.join(repo.git("rev-parse", "--absolute-git-dir"), "changelog-freeze.lock"); + fs.writeFileSync(lock, `${process.pid}\n`); + assert.equal(stops(() => freeze({ root: repo.dir, version: "1.0.0", date: "2026-11-23" })), `another freeze is running (process ${process.pid}); run this one again when it has ended`); + assert.deepEqual(repo.pending(), ["editor.md"]); + const gone = spawnSync(process.execPath, ["-e", ""]).pid; + fs.writeFileSync(lock, `${gone}\n`); + assert.equal(freeze({ root: repo.dir, version: "1.0.0", date: "2026-11-23" }).record.entries[0].id, "editor"); + assert.equal(fs.existsSync(lock), false, "the lock is let go"); +}); diff --git a/tools/changelog/test/support.mjs b/tools/changelog/test/support.mjs new file mode 100644 index 00000000..5362a9fe --- /dev/null +++ b/tools/changelog/test/support.mjs @@ -0,0 +1,87 @@ +// Shared by the changelog tool's tests: a throwaway git repository with a config, entry files written and committed as a person would. +import { execFileSync } from "node:child_process"; +import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; +import { after } from "node:test"; + +const made = []; +after(() => { for (const dir of made) fs.rmSync(dir, { recursive: true, force: true }); }); + +/** A made-up config: Linear-like and Jira-like trackers and one person. Every value is invented. */ +export const CONFIG = { + product: "Example", + repository: "https://github.com/example/repo", + trackers: [ + { name: "Linear", pattern: "(?:ENG|DES)-[1-9][0-9]*", url: "https://linear.app/example/issue/{id}" }, + { name: "Jira", pattern: "PROJ-[1-9][0-9]*", url: "https://example.atlassian.net/browse/{id}", show: "text" }, + { name: "GitHub", pattern: "repo#(?<n>[1-9][0-9]*)", url: "https://github.com/example/repo/issues/{n}", label: "issue #{n}" }, + ], + people: { sam: { name: "Sam Rivera" } }, +}; + +export function tempDir(prefix = "changelog-test-") { + const dir = fs.mkdtempSync(path.join(os.tmpdir(), prefix)); + made.push(dir); + return dir; +} + +/** An entry file's text from its head fields and sentence. */ +export function entryText(head, text = "Fixed the example list losing its place when a row was removed") { + const lines = ["---", ...Object.entries(head).map(([key, value]) => `${key}: ${Array.isArray(value) ? `[${value.join(", ")}]` : value}`), "---", text, ""]; + return lines.join("\n"); +} + +/** A repository with the config committed. `git(...)` runs in it; `entry(id, head, text, subject)` writes and commits one entry file. */ +export function repository(config = CONFIG) { + const dir = tempDir(); + let clock = Date.UTC(2026, 10, 1, 9); + const env = () => { + clock += 60_000; + const when = new Date(clock).toISOString(); + return { ...process.env, GIT_AUTHOR_NAME: "Example", GIT_AUTHOR_EMAIL: "example@example.com", GIT_COMMITTER_NAME: "Example", GIT_COMMITTER_EMAIL: "example@example.com", GIT_AUTHOR_DATE: when, GIT_COMMITTER_DATE: when }; + }; + const git = (...args) => execFileSync("git", args, { cwd: dir, env: env(), encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim(); + git("init", "-q", "-b", "main"); + git("config", "commit.gpgsign", "false"); + fs.writeFileSync(path.join(dir, "changelog.config.json"), JSON.stringify(config, null, 2)); + git("add", "-A"); + git("commit", "-q", "-m", "Start"); + const write = (id, head, text) => { + fs.mkdirSync(path.join(dir, ".changes"), { recursive: true }); + fs.writeFileSync(path.join(dir, ".changes", `${id}.md`), entryText(head, text)); + }; + const entry = (id, head, text, subject = `Change ${id}${head.pr ? ` (#${head.pr})` : ""}`) => { + write(id, head, text); + git("add", "-A"); + git("commit", "-q", "-m", subject); + return git("rev-parse", "HEAD"); + }; + const notes = (source) => { + fs.mkdirSync(path.join(dir, ".changes"), { recursive: true }); + fs.writeFileSync(path.join(dir, ".changes", "release.md"), source); + git("add", "-A"); + git("commit", "-q", "-m", "Release notes"); + }; + const commitAll = (message) => { git("add", "-A"); git("commit", "-q", "-m", message); }; + const record = (version) => JSON.parse(fs.readFileSync(path.join(dir, "changelog", "releases", `${version}.json`), "utf8")); + const pending = () => (fs.existsSync(path.join(dir, ".changes")) ? fs.readdirSync(path.join(dir, ".changes")).sort() : []); + return { dir, git, write, entry, notes, commitAll, record, pending }; +} + +/** Write a record by hand (a release that happened before the test). */ +export function writeRecord(dir, record) { + const file = path.join(dir, "changelog", "releases", `${record.version}.json`); + fs.mkdirSync(path.dirname(file), { recursive: true }); + fs.writeFileSync(file, `${JSON.stringify(record, null, 2)}\n`); +} + +/** Run `fn` and return the message it stopped with, or fail when it did not stop. */ +export function stops(fn) { + try { + fn(); + } catch (error) { + return error.message; + } + throw new Error("expected it to stop, and it went on"); +} diff --git a/tools/html-skill/README.md b/tools/html-skill/README.md index 766a65b1..315ce7b2 100644 --- a/tools/html-skill/README.md +++ b/tools/html-skill/README.md @@ -76,6 +76,8 @@ The twelfth (the motion rules, DECISIONS 136, 143 and 148) is `parity-12.test.mj The fourteenth (the controls port, DECISIONS 154) is `parity-14.test.mjs`: the skill's `option-chips` module against React's `OptionChips` (the legend, the count, a resting, a chosen and an unavailable chip and their seats, the +2 focus ring, forced colours) and its `link-tabs` module against `LinkTabs` (the row, the current link, a resting link and the underline at 36, 48 and 56, in both themes), then their behaviour: choosing moves no chip (0px), an unavailable chip is reached by the arrow keys and never chosen, a 56 row is 48 in a container under 640, and under 720 the row is replaced by a select of the same links (the form at 719 and 720, one navigation exposed and one Tab stop at each width, nothing moving between the markup and the script, choosing navigates, `linktabsnavigate` for a page that routes itself (focus stays on the select; on the default a new page loads), the "Go to" label before the page's name and in the select's name, a letter or arrow on the closed select held and never navigating, 44 tall on touch). The switch row, the button forms, the text button and the tabs' shared seat are React's alone. +The sixteenth (versions and release notes, DECISIONS 320) is `parity-16.test.mjs`: the `release` module and the version link, written by `tools/changelog/skill-body.mjs` from the made-up fixtures, beside React's `ReleaseNotes` and `VersionLink` from the same records, in both themes at 1440 and 390 (a release, its header, an entry, the source line, the sources panel, the version link in a footer and at the foot), with no difference; `release.test.mjs` pins the module's behaviour (the folds written open and closed by the script to `hidden="until-found"`, no script, print, the arrival, the copied addresses, the version link's tooltip in the rail). + The log slots, status bar, command block, event log, source stamp, inline-label rows, filter toolbar, notice bar, listbox, open list, drawer and `Reflow` are React's alone: the skill has no module for them (DECISIONS 167, Q8). Whether the skill gets the links and the charts is not decided. The panels, art and parts port (DECISIONS 162) is `parity-panels-art-parts.test.mjs`: the skill's flat table and two-line cell (`data-flat`, `.table-call`), the closing block (`data-closing`, which brings the type-layout module for `--basalt-section-gap`), captioned columns (`.captioned`), the app tile (`.app-tile`: a 120-point polygon clip and the hairline as a mask of the same outline, so no script and no page-level definitions) and the period stepper (`.period`) rendered beside React's in both themes and compared by computed style, the tile by pixel at every size (a pixel may differ by anti-aliasing at the edge only), then the stepper's room (0px through the whole-span view), its ends' focus, its row under 640px of its container, forced colours, print and axe. diff --git a/tools/html-skill/src/modules.json b/tools/html-skill/src/modules.json index 7fb544d5..b7946814 100644 --- a/tools/html-skill/src/modules.json +++ b/tools/html-skill/src/modules.json @@ -1,5 +1,5 @@ { - "$comment": "Which parts of the skill's CSS and JS a page gets. The core is always in. A module is in when the page's body has one of its classes, attributes or tags, matches one of its text patterns, or is named in a <!-- basalt:use name --> comment, and when another module needs it (requires). Modules are added in the order listed here, which is the order of the source files' cascade. classes: every class the module's CSS styles (the test checks them against the CSS and against SKILL.md). budget: the most bytes its minified CSS and JS may reach together. budgets: skillMd (SKILL.md, the context an agent pays: never above what it was), core (the CSS and JS of every page). icons: Phosphor names the module's script draws itself. Raised in the first parity PR (the owner's \"bring up the parity\"): forms (the number-input, search-clear and file-input chrome), disclosure (the native details marker), status (the accent reader and the forced-colours badge border), spinner (a fixed 16px ring), and the new number, range and accent modules. skillMd rose 10555 to 10900 for the new rules (number field, native chrome, the braille rule, the accent). Raised in the second parity PR (popup rows, levels and the segment's pill): segment 1400 to 3700 (the shared sliding pill: its script, 1.5 KB, and its CSS with the pill's two fallbacks), rows 3600 to 4300 (#27's plate-in-a-row geometry, the plate per level, the glide's shared plate and the forced-colours lit row, net of the removed bar), palette 9400 to 11300 (the glide's script, 2.4 KB: it follows the lit row, travels on a pointer, snaps on a key, and fades in place on leaving). The art module (DECISIONS 101 and 104) is the token groups only some pages name, taken out of the core so the core stays under its cap: the chart roles and lengths, the art colours, the aspect ratios and the stage headroom, in both themes (2087 bytes at 2100; it grows only when a token of those groups is added). A page gets it when its body names one of them, a var() in its own style included. The every-module page has no cap of its own (owner, DECISIONS 79): each part is capped, and a page carries only the parts it uses. usage: the most bytes of a module's usage text (src/usage/NAME.md; core.usage for core.md), which compose.mjs --usage prints on demand. It is context an agent pays only for the modules its page uses, so it is capped per part as SKILL.md and the CSS and script are (DECISIONS 79 and 109). Each is set a little above what its text was when the usage moved out of SKILL.md (DECISIONS 109); raising one needs a reason in the PR, and a rise of 40 to 50% is the owner's. textWords: each text pattern said in words, which compose.mjs --usage prints instead of the regular expression (one for each entry of text, in order). builds: modules a module requires whose markup its script writes, so --usage prints a line saying so instead of their usage text (the palette builds its own rows and key chips). The council's clarity check of the usage texts (all three: not yet clear) raised eight caps because the texts gained what an agent had to guess: callout 200 to 700 (the icon and one wrapper div around the title and body as markup, the four status icons, the role React's Callout renders), palette 1100 to 1300 (an item shown whole, keys as an array, keywords), stats 450 to 800 (a snippet of the figures and of the dl), tabs 500 to 650 (the unselected panels), code 250 to 450 (the markup and what each token class means), segment 150 to 300 (a click does not switch it), progress 150 to 350 (the empty span that paints the fill), theme 250 to 400 (leave the button empty), and accent 250 to 300. Topbar went down, 700 to 500, as its build detail was cut. Raised in the usage PR (the council's clarity check): palette 11300 to 11450 (the module grew 11283 to 11448, +165, about 1.5%), for the guard that makes a string `keys` warn and draw no chip instead of throwing in `keys.filter`, which the palette's usage already promised. Round 2 of the clarity check: tabs 650 to 750 (the panel's top space shown in the snippet, and that the script selects a tab on click). Raised in the site-icons and status PR (skill-parity part A, DECISIONS 106 and 107): status 1650 to 1900 (the neutral, pending and running marks, the badge's real border, and the forced-colours disc, net of the red danger word it drops) and its usage 400 to 1000 (every status in words, the word alone, running, forced colours); rows 4300 to 4450 (the profile list's seat rule and the status parts on a lit row) and its usage 300 to 600 (the profile list, with the one mistake: never an empty element for the seat). New: the links module (2671 bytes: the social row, the new-tab arrow's CSS and the script that draws it; budget 2750) and its usage (1746 bytes; cap 1850), which carries the social link, the glyph set, icon only and the new tab. Dropping Regular halves icons.json. Added in the overlay PR (skill-parity-4, batch 7 step 2, DECISIONS 108): the shared plate leaves palette.js for a glide module (the palette, a menu and the notification centre all call it), so the palette's cap went down, 11450 to 9250, and rows 4450 to 3850 (the plate's CSS moved to glide); and the overlay layer comes in as seven modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: popover (the native popup shell), menu, dialog (the dialog and alert dialog), sheet (on every side, the top one the site header's narrow menu), tooltip, toast and notifications (the centre). skillMd is unchanged in its cap (the eight new index lines fit within it); the core is unchanged in bytes. Added in the figures and charts PR (skill-parity-5, batch 7 step 3, DECISIONS 108): four modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: meter (React's Meter, CSS only, 2581 bytes), dlist (the description list, CSS only, 1265), terminal (the code block's transcript: its CSS, 3242, and the script that draws the gutter, the copy button and the replay, 4824) and chart (React's TimeChart and ChartGroup: 7313 of CSS and 23262 of script, which port chart.tsx's scale, layout, lane, labels, sentences, keyboard and table; it needs the art tokens, the table and the kbd chips, and a page without a chart carries none of it). Stats grew for the source line (budget 700 to 850, 798 bytes; its usage 800 to 950, 675 to 899 bytes, +33%, under the owner's 40 to 50%). skillMd is unchanged in its cap (four index lines fit within it); the core is unchanged in bytes. Added in the forms and selection PR (skill-parity-6, batch 7 step 4, DECISIONS 108): six modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: select (React's Select: the native select's closed trigger in every browser and, where `appearance: base-select` is shipped, the styled list with its two-line rows; a small script that says which input lit a row, 7740 bytes before it, choice (Checkbox, Radio, RadioGroup and Switch as styled native inputs; CSS only, with the first-frame rule), choice-card (ChoiceCard; CSS only), toggle (the pressed toggle's plate and check seat on .btn; CSS only), selection (a table's checkbox column: its fixed width and the script that sets aria-selected, the mixed header box and the count) and loops (the page-level hold on every loop with its switch: the held look and the script that stores it). The select's styles left forms, whose budget fell 3650 to 3250. skillMd rose 8621 to the size of its six new index lines, within its cap; the core is unchanged in bytes; compose adds the stored-hold line to the head of a page that has the loops module. Revised in the same PR (the lead's review of the build): the select gains select.js (one row is lit at a time, by whichever of the pointer and the keys moved last), and choice, toggle, selection and loops carry the first-frame rule, so a state a script sets on load (a mixed header box, the stored hold) paints at once with no crossfade. Added in the navigation and layout PR (skill-parity-7, batch 7 step 5, DECISIONS 108): five modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: glyph (Basalt's core glyphs drawn by name, at rest and selected, from a table the build works out from the drawn set; a page carries only the glyphs it names, and the drawing of a core glyph from data-glyph left the sheet module, which draws none now), nav (React's Nav: the sidebar's, the narrow menu's and More's rows, with the shared hugging pill), topbar-nav (the site header's links, one action and narrow menu, built by script from the bar's markup), app-shell (the shell, its sidebar and rail, and the app header) and tab-bar (the phone tab bar). The topbar module became the site header's bar (React's SiteHeader, DECISIONS 108: 56px with its line inside, the 44 by 44 brand target, the narrow-screen buttons, the derived sticky offset), budget 1600 to 3200 because its rules gained the app header's shared smoke, and its usage 500 to 750 (+50%) for the lockup's markup (the links, action and menu are topbar-nav's usage). Glide 3700 to 3950: the navigation's pill is a shape inside the row that the plate follows (about 200 bytes). The core's usage 2000 to 2100 (+5%): h2 is the Section step, the prose column's measure, and a link already 44px tall needs no margin. skillMd rose 9317 to 9863 for five index lines, under its cap; the core CSS grew 38 bytes (the layout tokens replace raw lengths, the gutter is one derived property, h2, .prose and .lead follow foundations) and the core script is unchanged. A module's media query writes %bp-md%, %bp-lg% or %bp-container% and the build substitutes the breakpoint tokens. Added in the tables and filters PR (skill-parity-8, batch 7 step 6, DECISIONS 108): the existing table module gains React's table additions (DECISIONS 95: the row header, \"Not observed\", the row density and the scroll hint with its small script), budget 1400 to 3000 (it was 1134 bytes of CSS; it is 2168 of CSS and 693 of script) and its usage 700 to 950 (+36%); and two modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: still-table (React's Table with `columns`: the fixed layout from a colgroup, the whole header cell as the sort button with its reserved seat, aria-sort, the pinned columns and their divider, the empty row; 4767 of CSS and 3264 of script, budget 8200) and filter (React's MultiSelect and FilterResult: the chips, the trigger and checklist with the search band from ten values, Clear held in place, the one debounced result line, and the narrowing of a table by `data-column`; 8240 of CSS and 7978 of script, budget 16400; it needs the popover, glide, glyph and choice modules). The core is unchanged in bytes. skillMd rose 9863 to 10128 for two index lines and the CaretUpDown icon's name, within its cap. Added in the commands PR (skill-parity-9, batch 7 step 7, DECISIONS 103 and 108): one new module a page carries only when it uses it, command-list (React's CommandList: the command panel set in the page, list plus preview, the push; it extends the palette and needs rows, kbd and glide; 5229 of CSS and 8734 of script, budget 14000, usage 2150). Two-line rows come to the existing modules: rows 3850 to 5350 (the described row's grid and description line, the push's chevron: 1481 bytes of CSS, the same rules React's menu rows carry), palette 9250 to 9900 (its rows are one function the list shares, with the description and the two-tier ranking of title matches over keyword and description matches; +636) and its usage 1300 to 1350, rows' usage 600 to 800, and glide 3950 to 4000 (a host that is idle counts as having no lit row, +54). skillMd rose 10128 to 10259 for one index line, within its cap; the core's CSS grew 24 bytes (.split.aside takes size-list-width in place of its raw 20rem: the same 320px, so no pixel moves) and the core script is unchanged. Added in the art PR (skill-parity-10, batch 7 step 8, DECISIONS 104 and 108): two modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: stage (React's Stage and PairedArt: full-bleed art under the site header, the pull-up by the sticky offset, the headroom, the paired art that follows the page's theme, and the forced-colours and print rules; CSS only, 1179 bytes) and framed-art (React's FramedArt: the figure, its rim and radius, the reserved box, the placeholder and the failed alt, the caption and credit; 2208 bytes of CSS and the 733-byte script that sets the frame's phase); both need the art tokens. The bar stays smoked over a stage: React clears it only over a stage that passed the headroom test helper, and a page has no test run (DECISIONS 108's note), so the skill builds no clear state. skillMd rose 10259 to 10500 for two index lines, within its cap; the core is unchanged in bytes. The callout gained the status rim in the same PR (DECISIONS 82, D8's status callouts): success, warning and danger draw their border in the status colour at 45% mixed in sRGB over the callout's own level, one solid colour on every side, and CanvasText in forced colours with the icon; the status colour is now one property the icon and the rim read. Its budget rose 900 to 1150 (the module is 1089 bytes, from 792: +297, about 37%); its usage is unchanged. Added in the overlays-and-the-rest PR (skill-parity-11, batch 7 step 9, DECISIONS 90 and 108): the last two parts of D8's part 5, each a module a page carries only when it uses it, with its own cap and usage cap set a little above its size: combobox (React's Combobox: the input with its caret button inside, the popup of the menu's rows with the glide's shared plate and two-line options, the filtering, the keys, the hidden value, the empty message and the check; 4342 of CSS and 6423 of script, budget 10900, usage 2150; it needs forms, popover and glide, and builds the last two) and sparkline (React's Sparkline: the label and latest value, the line, the axis, the empty sentence and the loading line that breathes; 1609 of CSS and 1874 of script, budget 3600, usage 950). The combobox copies the menu's row rules, as the select's list does, because React's Combobox renders MenuItem rows (a 40px hit area, a 36px plate) and the skill's .row is the palette's 44px: it carries no menu script. popover.js gains the combobox popup in the list of popups that keep focus where it is (+21 bytes, within its cap). skillMd rose 10500 to 10724 for two index lines, within its cap; the core is unchanged in bytes. Added in the motion-rules PR (DECISIONS 136 and 139): one module, ambient (a page's one ambient loop: CSS 828 bytes, script 433, budget 1300, usage 800), taken out of loops so the hold's own module grows only by the icon toggle's glyph swap (loops 2000 to 2200, +10%; its usage 1300 to 1650 for the icon form and the new settings-row sentence, +27%); and the chart's entrance (`entrance: true`: the marks' animations, their conditions and the redraw that restarts them at the elapsed time, 23262 to 25299 bytes of script; budget 30700 to 32800, +7%, usage 2500 to 2950, +18%). The core grew by the three tokens (27704 to 27862 bytes of CSS, under its cap). its stage usage gained the ambient art's line (1650 to 1750, +6%). skillMd rose 10724 to the size of the ambient index line, within its cap. Raised again in the motion-rules amendment (DECISIONS 143): chart 32800 to 33800 (script 25299 to 26375 bytes, +4%; +10% over the 30700 it began with) for the glide a new data set makes mid-entrance, print settling it, and `Basalt.pageChange()`; its usage 2950 to 3150 (+26% over the 2500 it began with). Raised in the second motion-rules amendment (DECISIONS 148): chart 33800 to 34400 (script 26375 to 26970 bytes: a line and its markers glide from their drawn geometry, and `beforeprint` settles the entrance; +12% over the 30700 it began with); topbar-nav 6900 to 7500 (+8.7%: the narrow menu's pause row, its CSS and 275 bytes of script, DECISIONS 148 item 2); loops usage 1650 to 1800 (+38% over the 1300 it began with, for the icon form's `title` and the menu row). Raised in the audit-design-b PR (DECISIONS 138 and 139): still-table 8200 to 13400 (+63%: the module was 7927 bytes and is 13311; the cut cell's plate, its focus stops and its dismissal, ported from React's cell-peek.ts, are 4273 bytes of script and 1111 of CSS; a still table that truncates needs them). The same PR: core usage 2100 to 2250 (+7%: the skip link, one bullet), forms usage 350 to 480 (+37%: the required mark), still-table usage 1950 to 2150 (+10%: the cut cell and the width rule), notifications usage 1050 to 1100 (+5%: the 44px entry on touch). The skip link's rim and radius took the core 30457 to 30609 bytes, under its cap (the rules that hang it under the bar are the topbar module's: 3200 to 3600, +12.5%); core 30720 to 31050 (+1.1%, DECISIONS 147: also the bar's links left out of the rule: the pseudo-element that makes a short standalone link a 44 by 44 target), skip-link script in the topbar module (3200 to 4150 over this PR, +30%: the rules that hang the link under the bar, 3600, and the script that reads the bar's real edge, 4150), sparkline 3600 to 4050 (+12.5%: React's ticker structure, so the value copies once on its line, and in forced colours the strips go and the number is plain text), forms budget 3250 to 3500 (+7.7%: the necessity word), notifications 9050 to 9250 (+2.2%: the 44px entry). Raised in the audit-design-b PR's E2 port (DECISIONS 138 and 139: the core set draws check, close, the chevrons, copy, plus, minus and search wherever a component draws them): the modules that drew a Phosphor icon for one of those now carry the core glyph's whole SVG, written in at build time (`%glyph-svg:name%`, the markup the glyph module's `_.glyph(name)` returns, so no module needs the glyph module and a page pays for nothing it does not use), and the Phosphor path of the same icon leaves the page. Each module's own bytes rose by that markup, and a page's total moved by what the Phosphor path it no longer carries saves: menu 8600 to 8900 (+303), combobox 10900 to 11200 (+303), copy 1900 to 2400 (+640), terminal 8100 to 8850 (+761), toast 13850 to 14150 (+325), number 2900 to 3400 (+557), filter 16400 to 17050 (+785), palette 9900 to 10450 (+536); the command list shares the palette's search drawing and fell 20 bytes. Set in integration-nov15, where the type-layout, motion-rules and audit-design-b branches meet: the combined tree measured SKILL.md 10959 bytes (each side's cap was 10900: both added index lines), core 31192 bytes (caps 30720 and 31050: the page-row and display rules, the three motion tokens and the skip link and 44px target rules all land in the core CSS) and core usage 2348 bytes (caps 2300 and 2250: type-layout's line and the skip-link bullet), so each is set to the measured bytes rounded up to the next 50: skillMd 10900 to 11000, core 31050 to 31200, core usage 2300 to 2350. Raised in the audit-design PR (decisions 138 and 139, parts A, D and C11): core 30720 to 31600 (+2.9%: the more-contrast block and its three aliases, and the field boundary token, every page carries as React does; the shadow-pill token is gone; the script gained `reserve`, 240 bytes), segment 3700 to 4100 and tabs 2300 to 2700 (the chosen label is 600 against 400, its width reserved by a span that carries its own copy, drawn unseen at 600; the pill's drop shadow is gone), and the segment's usage 300 to 380 (the weight and the glyph-only button). Raised again in the audit-design-a amendment (decision 145): core 31600 to 32300 (reserve() also reserves a label that is not plain text), segment 4100 to 5100 and tabs 2700 to 3500 (the second copy of such a label, and an icon drawn in both its forms), glyph 1100 to 1300 (a glyph in a segment or tab is drawn in both forms). Raised in the second audit-design-a amendment (decision 149): core 32300 to 32800 (reserve() builds the second copy of a label without any id, name, reference or hidden control, and does not copy a frame or media), segment 5100 to 5400 and its usage 380 to 500 (the 600 is on the label, the one-line rule and the usage text); the still-table cap is back at 8200, as the wash is on every cell again. Return 3 of the audit-design-a build (decision 149): tabs 3500 to 3700 (a tab the script has not reserved is 600 itself when selected, and one it declined is marked; the same two lines are in segment, which stays under 5400). Raised in the audit-fix-c2 PR (engineering, no pixel changes): toast 13850 to 14350 (the module was 13789 bytes and is 14288, +499, 3.6%) for F6, which focuses the Notifications region and Shift+Tab or Escape from it (or from the first toast) leaves it for where focus came from (and keeps a dialog's focus trap from wrapping it), as Base UI's viewport does in React, and for placing the region from focus (in the modal that holds it, or in the body), so a toast is never under a backdrop or in an inert modal whatever order the modals opened in (A3-09); the palette module grew 9864 to 9897 of its 9900 so that a palette opened over a modal sits inside it; topbar 3200 to 3250 (3123 to 3233, +110) for the scroll margin on what the bar holds, so a Tab into the bar from a scrolled page does not scroll the page (React's rule from PR #66); stage usage 1650 to 1750 (1580 to 1713, +8%) for the art's new place in the markup, after the content (A1-09), the stage's own CSS rising 1179 to 1208 within its 1250. skillMd rose 10724 to 10876 for the sentence that says a body may carry head tags, within its 10900. compose.mjs, the tool an agent runs, has no cap here (it is never in a page): it grew 21673 to 38153 bytes for the tokenizer that reads a body as HTML does and the head tags. Raised in the site-parts PR (DECISIONS 146, round 39), which folds each new part into the module it belongs with, so SKILL.md gains no index line (it has 41 bytes under its cap and a new module needs about 100): topbar 4150 to 17600 (+13450: the site footer and its disclosures, the lockup by pixel density, and a bar that arrives or leaves and returns, with its observer; a page that has a .topbar and no footer carries them too: the alternative, a module for each, needs its own index line and so SKILL.md bytes) and its usage 950 to 2900 (the footer's markup, the lockup's and the phase's); theme 650 to 4550 (the three-word theme choice: its CSS 2230 bytes and its script, 2277, with arrows, storage and the system listener) and its usage 400 to 1150 (the choice's markup written in full, so the right word is chosen before any script); segment 3700 to 3800 (a radio group's checked state besides a pressed button); stage 1250 to 2150 (its first script, 768 bytes, for fit and anchor) and its usage 1750 to 2000; framed-art 3000 to 3900 (drawn art in the frame: fit, anchor, no scaling strokes) and its usage 1250 to 1400. SKILL.md rose 10959 to 10992 (the topbar and theme index lines name .site-footer and .theme-choice). The head's theme line also writes data-theme-choice. Raised in site-parts return 2 (DECISIONS 146 B1 and B4): theme 4550 to 5350 (+800: the icon form of the theme choice, [data-theme-menu], whose button shows the theme in use, is named for the choice and opens the page's own .menu of three radio rows, in the theme script's 3073 bytes; the menu and popover modules are the page's, brought by its markup, so no module line was added and SKILL.md is 10993 of 11000) and its usage 1150 to 2200 (+91%: the menu's markup is written in full, and the deprecated toggle is said once); app-shell usage 2000 to 2100 and topbar-nav usage 1900 to 1950 (the theme control leaves the bar's text; the tools and the end cluster come in). The two example bodies still carry the deprecated data-theme-toggle. Return 2, F3 (DECISIONS 146 F): stage 2150 to 2250 (script 842 bytes: slice is the stage's default, as a frame's, and a drawing's own preserveAspectRatio stands unless the stage names data-fit or data-anchor) and its usage 2000 to 2150. framed-art 3900 to 4000 (a drawing's own preserveAspectRatio stands unless the figure names data-fit or data-anchor, +101 bytes). Return 3: theme 5350 to 5900 (script +569 bytes: who wrote data-theme, so System follows the system's change live and a theme the page set by hand, or a .dark or .light root, survives it). Raised in the controls port (DECISIONS 154): skillMd 11000 to 11200 for two index lines (link-tabs and option-chips, 214 bytes together), and core 31200 to 31600 for the nine tokens the port adds to every page's token CSS (the control rungs 44 to 64, two container widths, the confirm hold and the amount's opacity, 311 bytes). New modules (DECISIONS 154): link-tabs 2700 (its sizes, the 640 container step, the forced-colours underline, and the select that replaces the row under 720 with its 590-byte script, A15; it requires the select module), option-chips 5700 (the chip's states each written for a native radio inside a label, which needs :has on every one, plus the 1 KB script that keeps an aria-disabled chip reachable and never chosen). Return 3 (DECISIONS 154 conformance): link-tabs 2700 to 3100 and its usage 1650 to 1850 (the select's height for each row size, and a script that reads aria-current when it is needed and watches it move: 3,048 bytes), option-chips 5700 to 6700 (each state written twice, as a state attribute and as :has(), so no browser needs :has(): 4,975 CSS and 1,623 script). Return 4 (DECISIONS 158, Q2): link-tabs 3100 to 4300 and its usage 1850 to 2400 (the \"Go to\" label drawn at the select's start with its measured clearance, the select's accessible name kept as the words and the chosen page's, and the key hold that keeps a letter or an arrow on the closed select from navigating: 4,174 bytes, CSS 2,951 and script 1,223). Raised in the links-and-rows port (DECISIONS 152; the owner's approval is the lead's to confirm): the new link-rows module (5050 bytes of CSS, 50 of them for Castle's big-row arrow stepping colour over duration-fast, return 1, 1500 of usage: the directory's and the big rows' CSS, whose arrow is a core glyph drawn as a mask, and their tokens, size-row taken out of the core like type-layout's), disclosure 1550 to 3500 (Show all: the track, the clip and the settle, 1.5 KB of script and 1.8 KB of CSS), copy 2400 to 3500 (the form with words: the one cell and its script). SKILL.md rose 10959 to 10997 for one line, within its 11000 cap. Raised in the charts port PR (DECISIONS 153, D7a): chart 34400 to 34650 (script 26970 to 27270 bytes, +1.1% on the 34283 it was: `Basalt.trailingMean`, the trend maths React exports as `trailingMean`, 300 bytes), its usage 3150 to 3350 (+6%: one line for it). The tokens the batch adds (chart-lit-top, -mid and -base in both themes, size-chart-plot-sm, size-chart-row, size-meter-marker and radius-2xs) took the art module 2087 to 2546 bytes (budget 2100 to 2600, +24%: the chart tokens are its group) and the core 31192 to 31250 (cap 31200 to 31300, +0.3%: radius-2xs). Only D7a names a skill module in the charts ballot; the lit marks, the headline frame, the phase chart, the share bar, the coverage strip, the marks row and the range meter are React-only in this batch. Added in the overlays-and-search PR (DECISIONS 155, D10b and D13a): the sheet gains React's head, body and foot (the 44px close, the 20/28 title over a 13px count, the divider and the safe areas; its CSS 3.6 to 5.2 KB, budget 4050 to 5250, +30%) and its usage 1050 to 1450 (+38%: the anatomy and the step's focus, two bullets); and one new module a page carries only when it uses it, search (React's SearchDialog: the form, the field's -2 outline, the count line, the fixed-height results area and the rows with their picture slots and full-bleed hover wash; CSS only, 4368 bytes, budget 4400, usage 2050; it requires the dialog). The dialog's title draws no ring when script focuses it. skillMd rose 10959 to 11079 for the search line (the sheet's line is unchanged: its usage carries the anatomy), so its cap rose 11000 to 11100 (+0.9%). The core's CSS grew 31192 to 31421 bytes for the six new size tokens (the wide dialog, the search trigger and the logo and picture slots of a search result): its cap rose 31200 to 31450 (+0.8%). The two 44px values (the sheet's close and the search field) are local to their modules, with a lint exception that says they join the controls batch's size token (DECISIONS 154). Set in integration-nov15b, where audit-design-a, audit-fix-c2, site-parts, port-controls, port-links-rows, port-charts and port-overlays-search meet: the combined tree measured SKILL.md 11560 bytes (the caps were 11000, 11100 and 11200: each side added index lines), core 34086 bytes (caps 31300 to 33550: every side's rules land in the core CSS and script), topbar 17660 (17600 from site-parts, plus audit-fix-c2's skip-link and focus work), number 3453 (3400), palette 11379 (11000, audit-fix-c2's hosted scrim plus the core search glyph), dialog 5120 (5100), toast 15692 (15400) and stage usage 2248 (2150), each over every side's cap, so each is set to the measured bytes rounded up to the next 50: skillMd 11200 to 11600, core 33550 to 34100, topbar 17600 to 17700, number 3400 to 3500, palette 11000 to 11400, dialog 5100 to 5150, toast 15400 to 15700, stage usage 2150 to 2250. The segment cap is the base's 5400 plus port-controls' 100 (5500), unchanged by the merge. Raised in integration-nov15b, join 2 (a link tab takes the selected state, DECISIONS 138 A, 145, 149 and 154's D12 row): link-tabs 4300 to 5750 (+34%: the module was 4174 bytes and is 5736; the 600 against 400, the reserved width and the second copy of a composed label, an icon drawn in both its forms, the same rules a tab carries, 1,530 bytes of CSS and script) and its usage 2400 to 2550 (+6%: one bullet). The cap is the measured bytes rounded up to the next 50; a module that needs the tab's rules carries them as the segment and tabs modules do, so a page without link tabs pays nothing. Raised in the panels, art and parts port (DECISIONS 162): table 3000 to 3150 and its usage 950 to 1450 (the flat form and the two-line cell), stage 2250 to 2600 and its usage 2250 to 3100 (the closing block: its held art, forced colours and print; its section gap is type-layout's --basalt-section-gap, which a page with data-closing brings), the new app-tile 4300 (a 120-point polygon clip and the hairline's mask of the same outline), captioned 2000 and period 1400; skillMd 11600 to 11950 for one index line each for captioned, app-tile and period (358 bytes; the file is 11918). Raised in the logs, status and forms port (DECISIONS 162): core 34100 to 34200 (the new size-field-label-inline token, 80px, is written into every page's tokens: 25 bytes); dlist 1300 to 1900 and its usage 950 to 1060 (the stacked form, R9 and R10: a title over its text, 20px between entries, no divider; one usage line). Raised in audit-fix-c6 (the owner's cap, raised by the builder and for the owner to confirm): glyph 1300 to 1900, for redrawing a glyph when its ancestor's aria-current or data-current moves (the lists that hold glyphs are watched). Raised in the colour-ink-ladder build (DECISIONS 166): core 34200 to 34350 (the four lifted dark inks are four new primitives, each written into every page's tokens: the core measured 34307). Raised in the audit-2-design build (DECISIONS 167, Q7a): disclosure 3500 to 3800 (the core chevron drawn as a mask in place of two borders: the module measured 3755). Joined in the integration of c7 (#86) and c10 (#91): option-chips 6750 to 6850 (c7's reset resync and c10's data-ready together measure 6839). Raised in table-sort-3 (DECISIONS 257 and 261, the owner's pick: three sort states, the arrow after the label, explainers on column titles): still-table 13400 to 14650 (+9.3%: the module was 13343 bytes and is 14602; the end-aligned label's move by a transform, its right-to-left sign and the indicator that waits for it on a fine pointer, 912 bytes of CSS; the third state, the sort from the table's own order and a .explainer kept out of the button, 347 bytes of script) and its usage 2150 to 2250 (2197: the third state and the own order); the new explainer module 5850 (5842: a manual native popover opened from the sort button on hover, keyboard focus and a long press, placed above the header or beside it, 1752 bytes of CSS and 4090 of script; a page without explainers pays nothing) and its usage 900; skillMd 12250 to 12400 for the explainer's index line (113 bytes; the file is 12352). Each cap is the measured bytes rounded up to the next 50. Raised in table-sort-3's fix pass (Astra's review): explainer 5850 to 6900 (+18%: 5842 to 6864 bytes; the gap between the header and the card kept while a pointer crosses it, the close when its header leaves the view whatever has focus, the dismissal held until pointer and focus have both left, and its page-wide listeners and timers scoped to an open card and stopped when the table leaves the page, 1,022 bytes of script). Raised in cimip-gaps-2 batch B5 (the touch sizes under 720 whatever the pointer: each coarse-pointer target rule also answers a window under 720, about 20 bytes a rule; forms merged its three into one and stays under 3500): select 9000 to 9100 (measured 9064), selection 1480 to 1500 (1486), filter 17450 to 17500 (17473), option-chips 6850 to 6900 (6853), menu 8900 to 8950 (8902). B5 fix pass 1 (Astra): core 34550 to 34950 (measured 34911: 30762 CSS and 4149 JS) for stacked links in a column, each giving up the side of its 44px box that meets a neighbour, so a tap on a link's words is always that link's; core had 12 bytes free. DECISIONS 274 (the owner's pick: under 720 the toast stack hangs from the bar): toast 15700 to 16050 (measured 16035; 8 bytes were free; the stack's direction became one sign variable, trimming 585 of the 920 bytes the phone form first took). B5 merged with main (5ad5345a): main's own core measured 34930 against its 34550 cap before B5; with B5 (the touch sizes under 720 and stacked links in a column) it is 35331, so core is 35350; nav 5350 to 5400 (measured 5364: B4's nav plus the touch size under 720). The full run after the stream (DECISIONS 246): the site footer's links keep their own flex column under 720, as React's, out of the bare-link touch rule (26 bytes), so core is 35400 (measured 35357); sheet 5250 to 5400 (measured 5368: React's B5 ring room, ported: the held actions reach space-1-5 above their band, clipped, and the body keeps space-1-5 at each end). Raised for diagram motion and service marks (DECISIONS 292): skillMd 12550 to 12650 for the diagram-motion module's one line; diagram 87200 to 91000 for what a still diagram now carries (a card's mark and its seat, the pending frame, the comparison that writes a drawing only when it changed, and the print rule), and its usage 2600 to 4300 for the decision's four lines and the list of mark ids; the new diagram-motion module (the motion engine, its stylesheet and the motion tokens, in a page only when a diagram is animated) at 26200. Raised when the diagram tests were first run (DECISIONS 298): diagram 91000 to 91250 and diagram-motion 26200 to 26850. Raised in batch A of the diagrams backlog (DECISIONS 301): diagram 91250 to 92400, for the engine fixes it bundles (a decision kept no taller than it is wide, labels on whole pixels, slots beside a straight line, a one-column schema's turn-back); the skill keeps the development checks a production React build now drops. Raised again in that batch's review fixes: diagram 92400 to 92650, for the drawn layout refusing two lines laid on one another (Neon's blocking finding 1 on #126). Fix round 1 of #124 had already taken them to 91205 and 26621 with the tests unrun; this round added 1 byte (every focal node prints its fill; a one-form mark's dark form falls back to its light one) and 180 (the entrance keeps its own clock when it is drawn again while paused).", + "$comment": "Which parts of the skill's CSS and JS a page gets. The core is always in. A module is in when the page's body has one of its classes, attributes or tags, matches one of its text patterns, or is named in a <!-- basalt:use name --> comment, and when another module needs it (requires). Modules are added in the order listed here, which is the order of the source files' cascade. classes: every class the module's CSS styles (the test checks them against the CSS and against SKILL.md). budget: the most bytes its minified CSS and JS may reach together. budgets: skillMd (SKILL.md, the context an agent pays: never above what it was), core (the CSS and JS of every page). icons: Phosphor names the module's script draws itself. Raised in the first parity PR (the owner's \"bring up the parity\"): forms (the number-input, search-clear and file-input chrome), disclosure (the native details marker), status (the accent reader and the forced-colours badge border), spinner (a fixed 16px ring), and the new number, range and accent modules. skillMd rose 10555 to 10900 for the new rules (number field, native chrome, the braille rule, the accent). Raised in the second parity PR (popup rows, levels and the segment's pill): segment 1400 to 3700 (the shared sliding pill: its script, 1.5 KB, and its CSS with the pill's two fallbacks), rows 3600 to 4300 (#27's plate-in-a-row geometry, the plate per level, the glide's shared plate and the forced-colours lit row, net of the removed bar), palette 9400 to 11300 (the glide's script, 2.4 KB: it follows the lit row, travels on a pointer, snaps on a key, and fades in place on leaving). The art module (DECISIONS 101 and 104) is the token groups only some pages name, taken out of the core so the core stays under its cap: the chart roles and lengths, the art colours, the aspect ratios and the stage headroom, in both themes (2087 bytes at 2100; it grows only when a token of those groups is added). A page gets it when its body names one of them, a var() in its own style included. The every-module page has no cap of its own (owner, DECISIONS 79): each part is capped, and a page carries only the parts it uses. usage: the most bytes of a module's usage text (src/usage/NAME.md; core.usage for core.md), which compose.mjs --usage prints on demand. It is context an agent pays only for the modules its page uses, so it is capped per part as SKILL.md and the CSS and script are (DECISIONS 79 and 109). Each is set a little above what its text was when the usage moved out of SKILL.md (DECISIONS 109); raising one needs a reason in the PR, and a rise of 40 to 50% is the owner's. textWords: each text pattern said in words, which compose.mjs --usage prints instead of the regular expression (one for each entry of text, in order). builds: modules a module requires whose markup its script writes, so --usage prints a line saying so instead of their usage text (the palette builds its own rows and key chips). The council's clarity check of the usage texts (all three: not yet clear) raised eight caps because the texts gained what an agent had to guess: callout 200 to 700 (the icon and one wrapper div around the title and body as markup, the four status icons, the role React's Callout renders), palette 1100 to 1300 (an item shown whole, keys as an array, keywords), stats 450 to 800 (a snippet of the figures and of the dl), tabs 500 to 650 (the unselected panels), code 250 to 450 (the markup and what each token class means), segment 150 to 300 (a click does not switch it), progress 150 to 350 (the empty span that paints the fill), theme 250 to 400 (leave the button empty), and accent 250 to 300. Topbar went down, 700 to 500, as its build detail was cut. Raised in the usage PR (the council's clarity check): palette 11300 to 11450 (the module grew 11283 to 11448, +165, about 1.5%), for the guard that makes a string `keys` warn and draw no chip instead of throwing in `keys.filter`, which the palette's usage already promised. Round 2 of the clarity check: tabs 650 to 750 (the panel's top space shown in the snippet, and that the script selects a tab on click). Raised in the site-icons and status PR (skill-parity part A, DECISIONS 106 and 107): status 1650 to 1900 (the neutral, pending and running marks, the badge's real border, and the forced-colours disc, net of the red danger word it drops) and its usage 400 to 1000 (every status in words, the word alone, running, forced colours); rows 4300 to 4450 (the profile list's seat rule and the status parts on a lit row) and its usage 300 to 600 (the profile list, with the one mistake: never an empty element for the seat). New: the links module (2671 bytes: the social row, the new-tab arrow's CSS and the script that draws it; budget 2750) and its usage (1746 bytes; cap 1850), which carries the social link, the glyph set, icon only and the new tab. Dropping Regular halves icons.json. Added in the overlay PR (skill-parity-4, batch 7 step 2, DECISIONS 108): the shared plate leaves palette.js for a glide module (the palette, a menu and the notification centre all call it), so the palette's cap went down, 11450 to 9250, and rows 4450 to 3850 (the plate's CSS moved to glide); and the overlay layer comes in as seven modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: popover (the native popup shell), menu, dialog (the dialog and alert dialog), sheet (on every side, the top one the site header's narrow menu), tooltip, toast and notifications (the centre). skillMd is unchanged in its cap (the eight new index lines fit within it); the core is unchanged in bytes. Added in the figures and charts PR (skill-parity-5, batch 7 step 3, DECISIONS 108): four modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: meter (React's Meter, CSS only, 2581 bytes), dlist (the description list, CSS only, 1265), terminal (the code block's transcript: its CSS, 3242, and the script that draws the gutter, the copy button and the replay, 4824) and chart (React's TimeChart and ChartGroup: 7313 of CSS and 23262 of script, which port chart.tsx's scale, layout, lane, labels, sentences, keyboard and table; it needs the art tokens, the table and the kbd chips, and a page without a chart carries none of it). Stats grew for the source line (budget 700 to 850, 798 bytes; its usage 800 to 950, 675 to 899 bytes, +33%, under the owner's 40 to 50%). skillMd is unchanged in its cap (four index lines fit within it); the core is unchanged in bytes. Added in the forms and selection PR (skill-parity-6, batch 7 step 4, DECISIONS 108): six modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: select (React's Select: the native select's closed trigger in every browser and, where `appearance: base-select` is shipped, the styled list with its two-line rows; a small script that says which input lit a row, 7740 bytes before it, choice (Checkbox, Radio, RadioGroup and Switch as styled native inputs; CSS only, with the first-frame rule), choice-card (ChoiceCard; CSS only), toggle (the pressed toggle's plate and check seat on .btn; CSS only), selection (a table's checkbox column: its fixed width and the script that sets aria-selected, the mixed header box and the count) and loops (the page-level hold on every loop with its switch: the held look and the script that stores it). The select's styles left forms, whose budget fell 3650 to 3250. skillMd rose 8621 to the size of its six new index lines, within its cap; the core is unchanged in bytes; compose adds the stored-hold line to the head of a page that has the loops module. Revised in the same PR (the lead's review of the build): the select gains select.js (one row is lit at a time, by whichever of the pointer and the keys moved last), and choice, toggle, selection and loops carry the first-frame rule, so a state a script sets on load (a mixed header box, the stored hold) paints at once with no crossfade. Added in the navigation and layout PR (skill-parity-7, batch 7 step 5, DECISIONS 108): five modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: glyph (Basalt's core glyphs drawn by name, at rest and selected, from a table the build works out from the drawn set; a page carries only the glyphs it names, and the drawing of a core glyph from data-glyph left the sheet module, which draws none now), nav (React's Nav: the sidebar's, the narrow menu's and More's rows, with the shared hugging pill), topbar-nav (the site header's links, one action and narrow menu, built by script from the bar's markup), app-shell (the shell, its sidebar and rail, and the app header) and tab-bar (the phone tab bar). The topbar module became the site header's bar (React's SiteHeader, DECISIONS 108: 56px with its line inside, the 44 by 44 brand target, the narrow-screen buttons, the derived sticky offset), budget 1600 to 3200 because its rules gained the app header's shared smoke, and its usage 500 to 750 (+50%) for the lockup's markup (the links, action and menu are topbar-nav's usage). Glide 3700 to 3950: the navigation's pill is a shape inside the row that the plate follows (about 200 bytes). The core's usage 2000 to 2100 (+5%): h2 is the Section step, the prose column's measure, and a link already 44px tall needs no margin. skillMd rose 9317 to 9863 for five index lines, under its cap; the core CSS grew 38 bytes (the layout tokens replace raw lengths, the gutter is one derived property, h2, .prose and .lead follow foundations) and the core script is unchanged. A module's media query writes %bp-md%, %bp-lg% or %bp-container% and the build substitutes the breakpoint tokens. Added in the tables and filters PR (skill-parity-8, batch 7 step 6, DECISIONS 108): the existing table module gains React's table additions (DECISIONS 95: the row header, \"Not observed\", the row density and the scroll hint with its small script), budget 1400 to 3000 (it was 1134 bytes of CSS; it is 2168 of CSS and 693 of script) and its usage 700 to 950 (+36%); and two modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: still-table (React's Table with `columns`: the fixed layout from a colgroup, the whole header cell as the sort button with its reserved seat, aria-sort, the pinned columns and their divider, the empty row; 4767 of CSS and 3264 of script, budget 8200) and filter (React's MultiSelect and FilterResult: the chips, the trigger and checklist with the search band from ten values, Clear held in place, the one debounced result line, and the narrowing of a table by `data-column`; 8240 of CSS and 7978 of script, budget 16400; it needs the popover, glide, glyph and choice modules). The core is unchanged in bytes. skillMd rose 9863 to 10128 for two index lines and the CaretUpDown icon's name, within its cap. Added in the commands PR (skill-parity-9, batch 7 step 7, DECISIONS 103 and 108): one new module a page carries only when it uses it, command-list (React's CommandList: the command panel set in the page, list plus preview, the push; it extends the palette and needs rows, kbd and glide; 5229 of CSS and 8734 of script, budget 14000, usage 2150). Two-line rows come to the existing modules: rows 3850 to 5350 (the described row's grid and description line, the push's chevron: 1481 bytes of CSS, the same rules React's menu rows carry), palette 9250 to 9900 (its rows are one function the list shares, with the description and the two-tier ranking of title matches over keyword and description matches; +636) and its usage 1300 to 1350, rows' usage 600 to 800, and glide 3950 to 4000 (a host that is idle counts as having no lit row, +54). skillMd rose 10128 to 10259 for one index line, within its cap; the core's CSS grew 24 bytes (.split.aside takes size-list-width in place of its raw 20rem: the same 320px, so no pixel moves) and the core script is unchanged. Added in the art PR (skill-parity-10, batch 7 step 8, DECISIONS 104 and 108): two modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: stage (React's Stage and PairedArt: full-bleed art under the site header, the pull-up by the sticky offset, the headroom, the paired art that follows the page's theme, and the forced-colours and print rules; CSS only, 1179 bytes) and framed-art (React's FramedArt: the figure, its rim and radius, the reserved box, the placeholder and the failed alt, the caption and credit; 2208 bytes of CSS and the 733-byte script that sets the frame's phase); both need the art tokens. The bar stays smoked over a stage: React clears it only over a stage that passed the headroom test helper, and a page has no test run (DECISIONS 108's note), so the skill builds no clear state. skillMd rose 10259 to 10500 for two index lines, within its cap; the core is unchanged in bytes. The callout gained the status rim in the same PR (DECISIONS 82, D8's status callouts): success, warning and danger draw their border in the status colour at 45% mixed in sRGB over the callout's own level, one solid colour on every side, and CanvasText in forced colours with the icon; the status colour is now one property the icon and the rim read. Its budget rose 900 to 1150 (the module is 1089 bytes, from 792: +297, about 37%); its usage is unchanged. Added in the overlays-and-the-rest PR (skill-parity-11, batch 7 step 9, DECISIONS 90 and 108): the last two parts of D8's part 5, each a module a page carries only when it uses it, with its own cap and usage cap set a little above its size: combobox (React's Combobox: the input with its caret button inside, the popup of the menu's rows with the glide's shared plate and two-line options, the filtering, the keys, the hidden value, the empty message and the check; 4342 of CSS and 6423 of script, budget 10900, usage 2150; it needs forms, popover and glide, and builds the last two) and sparkline (React's Sparkline: the label and latest value, the line, the axis, the empty sentence and the loading line that breathes; 1609 of CSS and 1874 of script, budget 3600, usage 950). The combobox copies the menu's row rules, as the select's list does, because React's Combobox renders MenuItem rows (a 40px hit area, a 36px plate) and the skill's .row is the palette's 44px: it carries no menu script. popover.js gains the combobox popup in the list of popups that keep focus where it is (+21 bytes, within its cap). skillMd rose 10500 to 10724 for two index lines, within its cap; the core is unchanged in bytes. Added in the motion-rules PR (DECISIONS 136 and 139): one module, ambient (a page's one ambient loop: CSS 828 bytes, script 433, budget 1300, usage 800), taken out of loops so the hold's own module grows only by the icon toggle's glyph swap (loops 2000 to 2200, +10%; its usage 1300 to 1650 for the icon form and the new settings-row sentence, +27%); and the chart's entrance (`entrance: true`: the marks' animations, their conditions and the redraw that restarts them at the elapsed time, 23262 to 25299 bytes of script; budget 30700 to 32800, +7%, usage 2500 to 2950, +18%). The core grew by the three tokens (27704 to 27862 bytes of CSS, under its cap). its stage usage gained the ambient art's line (1650 to 1750, +6%). skillMd rose 10724 to the size of the ambient index line, within its cap. Raised again in the motion-rules amendment (DECISIONS 143): chart 32800 to 33800 (script 25299 to 26375 bytes, +4%; +10% over the 30700 it began with) for the glide a new data set makes mid-entrance, print settling it, and `Basalt.pageChange()`; its usage 2950 to 3150 (+26% over the 2500 it began with). Raised in the second motion-rules amendment (DECISIONS 148): chart 33800 to 34400 (script 26375 to 26970 bytes: a line and its markers glide from their drawn geometry, and `beforeprint` settles the entrance; +12% over the 30700 it began with); topbar-nav 6900 to 7500 (+8.7%: the narrow menu's pause row, its CSS and 275 bytes of script, DECISIONS 148 item 2); loops usage 1650 to 1800 (+38% over the 1300 it began with, for the icon form's `title` and the menu row). Raised in the audit-design-b PR (DECISIONS 138 and 139): still-table 8200 to 13400 (+63%: the module was 7927 bytes and is 13311; the cut cell's plate, its focus stops and its dismissal, ported from React's cell-peek.ts, are 4273 bytes of script and 1111 of CSS; a still table that truncates needs them). The same PR: core usage 2100 to 2250 (+7%: the skip link, one bullet), forms usage 350 to 480 (+37%: the required mark), still-table usage 1950 to 2150 (+10%: the cut cell and the width rule), notifications usage 1050 to 1100 (+5%: the 44px entry on touch). The skip link's rim and radius took the core 30457 to 30609 bytes, under its cap (the rules that hang it under the bar are the topbar module's: 3200 to 3600, +12.5%); core 30720 to 31050 (+1.1%, DECISIONS 147: also the bar's links left out of the rule: the pseudo-element that makes a short standalone link a 44 by 44 target), skip-link script in the topbar module (3200 to 4150 over this PR, +30%: the rules that hang the link under the bar, 3600, and the script that reads the bar's real edge, 4150), sparkline 3600 to 4050 (+12.5%: React's ticker structure, so the value copies once on its line, and in forced colours the strips go and the number is plain text), forms budget 3250 to 3500 (+7.7%: the necessity word), notifications 9050 to 9250 (+2.2%: the 44px entry). Raised in the audit-design-b PR's E2 port (DECISIONS 138 and 139: the core set draws check, close, the chevrons, copy, plus, minus and search wherever a component draws them): the modules that drew a Phosphor icon for one of those now carry the core glyph's whole SVG, written in at build time (`%glyph-svg:name%`, the markup the glyph module's `_.glyph(name)` returns, so no module needs the glyph module and a page pays for nothing it does not use), and the Phosphor path of the same icon leaves the page. Each module's own bytes rose by that markup, and a page's total moved by what the Phosphor path it no longer carries saves: menu 8600 to 8900 (+303), combobox 10900 to 11200 (+303), copy 1900 to 2400 (+640), terminal 8100 to 8850 (+761), toast 13850 to 14150 (+325), number 2900 to 3400 (+557), filter 16400 to 17050 (+785), palette 9900 to 10450 (+536); the command list shares the palette's search drawing and fell 20 bytes. Set in integration-nov15, where the type-layout, motion-rules and audit-design-b branches meet: the combined tree measured SKILL.md 10959 bytes (each side's cap was 10900: both added index lines), core 31192 bytes (caps 30720 and 31050: the page-row and display rules, the three motion tokens and the skip link and 44px target rules all land in the core CSS) and core usage 2348 bytes (caps 2300 and 2250: type-layout's line and the skip-link bullet), so each is set to the measured bytes rounded up to the next 50: skillMd 10900 to 11000, core 31050 to 31200, core usage 2300 to 2350. Raised in the audit-design PR (decisions 138 and 139, parts A, D and C11): core 30720 to 31600 (+2.9%: the more-contrast block and its three aliases, and the field boundary token, every page carries as React does; the shadow-pill token is gone; the script gained `reserve`, 240 bytes), segment 3700 to 4100 and tabs 2300 to 2700 (the chosen label is 600 against 400, its width reserved by a span that carries its own copy, drawn unseen at 600; the pill's drop shadow is gone), and the segment's usage 300 to 380 (the weight and the glyph-only button). Raised again in the audit-design-a amendment (decision 145): core 31600 to 32300 (reserve() also reserves a label that is not plain text), segment 4100 to 5100 and tabs 2700 to 3500 (the second copy of such a label, and an icon drawn in both its forms), glyph 1100 to 1300 (a glyph in a segment or tab is drawn in both forms). Raised in the second audit-design-a amendment (decision 149): core 32300 to 32800 (reserve() builds the second copy of a label without any id, name, reference or hidden control, and does not copy a frame or media), segment 5100 to 5400 and its usage 380 to 500 (the 600 is on the label, the one-line rule and the usage text); the still-table cap is back at 8200, as the wash is on every cell again. Return 3 of the audit-design-a build (decision 149): tabs 3500 to 3700 (a tab the script has not reserved is 600 itself when selected, and one it declined is marked; the same two lines are in segment, which stays under 5400). Raised in the audit-fix-c2 PR (engineering, no pixel changes): toast 13850 to 14350 (the module was 13789 bytes and is 14288, +499, 3.6%) for F6, which focuses the Notifications region and Shift+Tab or Escape from it (or from the first toast) leaves it for where focus came from (and keeps a dialog's focus trap from wrapping it), as Base UI's viewport does in React, and for placing the region from focus (in the modal that holds it, or in the body), so a toast is never under a backdrop or in an inert modal whatever order the modals opened in (A3-09); the palette module grew 9864 to 9897 of its 9900 so that a palette opened over a modal sits inside it; topbar 3200 to 3250 (3123 to 3233, +110) for the scroll margin on what the bar holds, so a Tab into the bar from a scrolled page does not scroll the page (React's rule from PR #66); stage usage 1650 to 1750 (1580 to 1713, +8%) for the art's new place in the markup, after the content (A1-09), the stage's own CSS rising 1179 to 1208 within its 1250. skillMd rose 10724 to 10876 for the sentence that says a body may carry head tags, within its 10900. compose.mjs, the tool an agent runs, has no cap here (it is never in a page): it grew 21673 to 38153 bytes for the tokenizer that reads a body as HTML does and the head tags. Raised in the site-parts PR (DECISIONS 146, round 39), which folds each new part into the module it belongs with, so SKILL.md gains no index line (it has 41 bytes under its cap and a new module needs about 100): topbar 4150 to 17600 (+13450: the site footer and its disclosures, the lockup by pixel density, and a bar that arrives or leaves and returns, with its observer; a page that has a .topbar and no footer carries them too: the alternative, a module for each, needs its own index line and so SKILL.md bytes) and its usage 950 to 2900 (the footer's markup, the lockup's and the phase's); theme 650 to 4550 (the three-word theme choice: its CSS 2230 bytes and its script, 2277, with arrows, storage and the system listener) and its usage 400 to 1150 (the choice's markup written in full, so the right word is chosen before any script); segment 3700 to 3800 (a radio group's checked state besides a pressed button); stage 1250 to 2150 (its first script, 768 bytes, for fit and anchor) and its usage 1750 to 2000; framed-art 3000 to 3900 (drawn art in the frame: fit, anchor, no scaling strokes) and its usage 1250 to 1400. SKILL.md rose 10959 to 10992 (the topbar and theme index lines name .site-footer and .theme-choice). The head's theme line also writes data-theme-choice. Raised in site-parts return 2 (DECISIONS 146 B1 and B4): theme 4550 to 5350 (+800: the icon form of the theme choice, [data-theme-menu], whose button shows the theme in use, is named for the choice and opens the page's own .menu of three radio rows, in the theme script's 3073 bytes; the menu and popover modules are the page's, brought by its markup, so no module line was added and SKILL.md is 10993 of 11000) and its usage 1150 to 2200 (+91%: the menu's markup is written in full, and the deprecated toggle is said once); app-shell usage 2000 to 2100 and topbar-nav usage 1900 to 1950 (the theme control leaves the bar's text; the tools and the end cluster come in). The two example bodies still carry the deprecated data-theme-toggle. Return 2, F3 (DECISIONS 146 F): stage 2150 to 2250 (script 842 bytes: slice is the stage's default, as a frame's, and a drawing's own preserveAspectRatio stands unless the stage names data-fit or data-anchor) and its usage 2000 to 2150. framed-art 3900 to 4000 (a drawing's own preserveAspectRatio stands unless the figure names data-fit or data-anchor, +101 bytes). Return 3: theme 5350 to 5900 (script +569 bytes: who wrote data-theme, so System follows the system's change live and a theme the page set by hand, or a .dark or .light root, survives it). Raised in the controls port (DECISIONS 154): skillMd 11000 to 11200 for two index lines (link-tabs and option-chips, 214 bytes together), and core 31200 to 31600 for the nine tokens the port adds to every page's token CSS (the control rungs 44 to 64, two container widths, the confirm hold and the amount's opacity, 311 bytes). New modules (DECISIONS 154): link-tabs 2700 (its sizes, the 640 container step, the forced-colours underline, and the select that replaces the row under 720 with its 590-byte script, A15; it requires the select module), option-chips 5700 (the chip's states each written for a native radio inside a label, which needs :has on every one, plus the 1 KB script that keeps an aria-disabled chip reachable and never chosen). Return 3 (DECISIONS 154 conformance): link-tabs 2700 to 3100 and its usage 1650 to 1850 (the select's height for each row size, and a script that reads aria-current when it is needed and watches it move: 3,048 bytes), option-chips 5700 to 6700 (each state written twice, as a state attribute and as :has(), so no browser needs :has(): 4,975 CSS and 1,623 script). Return 4 (DECISIONS 158, Q2): link-tabs 3100 to 4300 and its usage 1850 to 2400 (the \"Go to\" label drawn at the select's start with its measured clearance, the select's accessible name kept as the words and the chosen page's, and the key hold that keeps a letter or an arrow on the closed select from navigating: 4,174 bytes, CSS 2,951 and script 1,223). Raised in the links-and-rows port (DECISIONS 152; the owner's approval is the lead's to confirm): the new link-rows module (5050 bytes of CSS, 50 of them for Castle's big-row arrow stepping colour over duration-fast, return 1, 1500 of usage: the directory's and the big rows' CSS, whose arrow is a core glyph drawn as a mask, and their tokens, size-row taken out of the core like type-layout's), disclosure 1550 to 3500 (Show all: the track, the clip and the settle, 1.5 KB of script and 1.8 KB of CSS), copy 2400 to 3500 (the form with words: the one cell and its script). SKILL.md rose 10959 to 10997 for one line, within its 11000 cap. Raised in the charts port PR (DECISIONS 153, D7a): chart 34400 to 34650 (script 26970 to 27270 bytes, +1.1% on the 34283 it was: `Basalt.trailingMean`, the trend maths React exports as `trailingMean`, 300 bytes), its usage 3150 to 3350 (+6%: one line for it). The tokens the batch adds (chart-lit-top, -mid and -base in both themes, size-chart-plot-sm, size-chart-row, size-meter-marker and radius-2xs) took the art module 2087 to 2546 bytes (budget 2100 to 2600, +24%: the chart tokens are its group) and the core 31192 to 31250 (cap 31200 to 31300, +0.3%: radius-2xs). Only D7a names a skill module in the charts ballot; the lit marks, the headline frame, the phase chart, the share bar, the coverage strip, the marks row and the range meter are React-only in this batch. Added in the overlays-and-search PR (DECISIONS 155, D10b and D13a): the sheet gains React's head, body and foot (the 44px close, the 20/28 title over a 13px count, the divider and the safe areas; its CSS 3.6 to 5.2 KB, budget 4050 to 5250, +30%) and its usage 1050 to 1450 (+38%: the anatomy and the step's focus, two bullets); and one new module a page carries only when it uses it, search (React's SearchDialog: the form, the field's -2 outline, the count line, the fixed-height results area and the rows with their picture slots and full-bleed hover wash; CSS only, 4368 bytes, budget 4400, usage 2050; it requires the dialog). The dialog's title draws no ring when script focuses it. skillMd rose 10959 to 11079 for the search line (the sheet's line is unchanged: its usage carries the anatomy), so its cap rose 11000 to 11100 (+0.9%). The core's CSS grew 31192 to 31421 bytes for the six new size tokens (the wide dialog, the search trigger and the logo and picture slots of a search result): its cap rose 31200 to 31450 (+0.8%). The two 44px values (the sheet's close and the search field) are local to their modules, with a lint exception that says they join the controls batch's size token (DECISIONS 154). Set in integration-nov15b, where audit-design-a, audit-fix-c2, site-parts, port-controls, port-links-rows, port-charts and port-overlays-search meet: the combined tree measured SKILL.md 11560 bytes (the caps were 11000, 11100 and 11200: each side added index lines), core 34086 bytes (caps 31300 to 33550: every side's rules land in the core CSS and script), topbar 17660 (17600 from site-parts, plus audit-fix-c2's skip-link and focus work), number 3453 (3400), palette 11379 (11000, audit-fix-c2's hosted scrim plus the core search glyph), dialog 5120 (5100), toast 15692 (15400) and stage usage 2248 (2150), each over every side's cap, so each is set to the measured bytes rounded up to the next 50: skillMd 11200 to 11600, core 33550 to 34100, topbar 17600 to 17700, number 3400 to 3500, palette 11000 to 11400, dialog 5100 to 5150, toast 15400 to 15700, stage usage 2150 to 2250. The segment cap is the base's 5400 plus port-controls' 100 (5500), unchanged by the merge. Raised in integration-nov15b, join 2 (a link tab takes the selected state, DECISIONS 138 A, 145, 149 and 154's D12 row): link-tabs 4300 to 5750 (+34%: the module was 4174 bytes and is 5736; the 600 against 400, the reserved width and the second copy of a composed label, an icon drawn in both its forms, the same rules a tab carries, 1,530 bytes of CSS and script) and its usage 2400 to 2550 (+6%: one bullet). The cap is the measured bytes rounded up to the next 50; a module that needs the tab's rules carries them as the segment and tabs modules do, so a page without link tabs pays nothing. Raised in the panels, art and parts port (DECISIONS 162): table 3000 to 3150 and its usage 950 to 1450 (the flat form and the two-line cell), stage 2250 to 2600 and its usage 2250 to 3100 (the closing block: its held art, forced colours and print; its section gap is type-layout's --basalt-section-gap, which a page with data-closing brings), the new app-tile 4300 (a 120-point polygon clip and the hairline's mask of the same outline), captioned 2000 and period 1400; skillMd 11600 to 11950 for one index line each for captioned, app-tile and period (358 bytes; the file is 11918). Raised in the logs, status and forms port (DECISIONS 162): core 34100 to 34200 (the new size-field-label-inline token, 80px, is written into every page's tokens: 25 bytes); dlist 1300 to 1900 and its usage 950 to 1060 (the stacked form, R9 and R10: a title over its text, 20px between entries, no divider; one usage line). Raised in audit-fix-c6 (the owner's cap, raised by the builder and for the owner to confirm): glyph 1300 to 1900, for redrawing a glyph when its ancestor's aria-current or data-current moves (the lists that hold glyphs are watched). Raised in the colour-ink-ladder build (DECISIONS 166): core 34200 to 34350 (the four lifted dark inks are four new primitives, each written into every page's tokens: the core measured 34307). Raised in the audit-2-design build (DECISIONS 167, Q7a): disclosure 3500 to 3800 (the core chevron drawn as a mask in place of two borders: the module measured 3755). Joined in the integration of c7 (#86) and c10 (#91): option-chips 6750 to 6850 (c7's reset resync and c10's data-ready together measure 6839). Raised in table-sort-3 (DECISIONS 257 and 261, the owner's pick: three sort states, the arrow after the label, explainers on column titles): still-table 13400 to 14650 (+9.3%: the module was 13343 bytes and is 14602; the end-aligned label's move by a transform, its right-to-left sign and the indicator that waits for it on a fine pointer, 912 bytes of CSS; the third state, the sort from the table's own order and a .explainer kept out of the button, 347 bytes of script) and its usage 2150 to 2250 (2197: the third state and the own order); the new explainer module 5850 (5842: a manual native popover opened from the sort button on hover, keyboard focus and a long press, placed above the header or beside it, 1752 bytes of CSS and 4090 of script; a page without explainers pays nothing) and its usage 900; skillMd 12250 to 12400 for the explainer's index line (113 bytes; the file is 12352). Each cap is the measured bytes rounded up to the next 50. Raised in table-sort-3's fix pass (Astra's review): explainer 5850 to 6900 (+18%: 5842 to 6864 bytes; the gap between the header and the card kept while a pointer crosses it, the close when its header leaves the view whatever has focus, the dismissal held until pointer and focus have both left, and its page-wide listeners and timers scoped to an open card and stopped when the table leaves the page, 1,022 bytes of script). Raised in cimip-gaps-2 batch B5 (the touch sizes under 720 whatever the pointer: each coarse-pointer target rule also answers a window under 720, about 20 bytes a rule; forms merged its three into one and stays under 3500): select 9000 to 9100 (measured 9064), selection 1480 to 1500 (1486), filter 17450 to 17500 (17473), option-chips 6850 to 6900 (6853), menu 8900 to 8950 (8902). B5 fix pass 1 (Astra): core 34550 to 34950 (measured 34911: 30762 CSS and 4149 JS) for stacked links in a column, each giving up the side of its 44px box that meets a neighbour, so a tap on a link's words is always that link's; core had 12 bytes free. DECISIONS 274 (the owner's pick: under 720 the toast stack hangs from the bar): toast 15700 to 16050 (measured 16035; 8 bytes were free; the stack's direction became one sign variable, trimming 585 of the 920 bytes the phone form first took). B5 merged with main (5ad5345a): main's own core measured 34930 against its 34550 cap before B5; with B5 (the touch sizes under 720 and stacked links in a column) it is 35331, so core is 35350; nav 5350 to 5400 (measured 5364: B4's nav plus the touch size under 720). The full run after the stream (DECISIONS 246): the site footer's links keep their own flex column under 720, as React's, out of the bare-link touch rule (26 bytes), so core is 35400 (measured 35357); sheet 5250 to 5400 (measured 5368: React's B5 ring room, ported: the held actions reach space-1-5 above their band, clipped, and the body keeps space-1-5 at each end). Raised for diagram motion and service marks (DECISIONS 292): skillMd 12550 to 12650 for the diagram-motion module's one line; diagram 87200 to 91000 for what a still diagram now carries (a card's mark and its seat, the pending frame, the comparison that writes a drawing only when it changed, and the print rule), and its usage 2600 to 4300 for the decision's four lines and the list of mark ids; the new diagram-motion module (the motion engine, its stylesheet and the motion tokens, in a page only when a diagram is animated) at 26200. Raised when the diagram tests were first run (DECISIONS 298): diagram 91000 to 91250 and diagram-motion 26200 to 26850. Raised in batch A of the diagrams backlog (DECISIONS 301): diagram 91250 to 92400, for the engine fixes it bundles (a decision kept no taller than it is wide, labels on whole pixels, slots beside a straight line, a one-column schema's turn-back); the skill keeps the development checks a production React build now drops. Raised again in that batch's review fixes: diagram 92400 to 92650, for the drawn layout refusing two lines laid on one another (Neon's blocking finding 1 on #126). Fix round 1 of #124 had already taken them to 91205 and 26621 with the tests unrun; this round added 1 byte (every focal node prints its fill; a one-form mark's dark form falls back to its light one) and 180 (the entrance keeps its own clock when it is drawn again while paused). DECISIONS 320 (versions and release notes): the release module is new (budget 15900 at first, usage 2400); topbar, app-shell and tab-bar gain the version link's classes (budgets: topbar 17700 to 19900, app-shell 4300 to 5200 with the rail's tooltip for it, tab-bar 4850 to 5200), their usage caps rising 2900 to 3100, 2600 to 2850 and 2250 to 2400 for its one line each; skillMd rose 12650 to 12800 for the release module's line and .version-link in topbar's. The code review of round 68 adds data-focus-self to the popover module (its Tab walk; budget 4950 to 5600, usage cap 950 to 1100) and logical start and end for its alignment; the release module's header grid and the Sources panel's touch rows take it to 16900. The spacing sweep of round 68 (DECISIONS 326: Copy link's words on the edge, the callout's last change, its reference column, the last release, the touch rows' end and the whole code chip) takes the release module to 17400. The ruling on where a release ends (DECISIONS 331: no padding under the last change in a release, a release-ending fold's hang, an arrived change keeping its padding, the panel holding its first margin, Build details 44 on touch and a closed Fixed panel taking no room) takes it to 19000. The code recheck of round 68 (recheck 5) has the popover's Tab walk follow Safari's own rule (Tab skips links on Apple's WebKit, Option-Tab reaches them): popover 5600 to 5900. The pixel recheck of round 68 has the Sources panel's touch rows keep their 20px lines with the link's box as hit area, space-3 rows and space-6 between two linked values (recheck-pixels 4), and the release's whole header take the arrival's plate: release 19000 to 19600. Merging #127 (stages, DECISIONS 316 and 328) into the versioning branch: both had raised skillMd from 12650 to 12800 for their own module's line, and together they came to 12886; SKILL.md was tightened in its wording (no rule dropped) to stay within 12800.", "budgets": { "skillMd": 12800, "core": 35550 @@ -75,10 +75,16 @@ "site-footer-group", "site-footer-label", "site-footer-base", - "site-footer-legal" - ], - "budget": 17700, - "usage": 2900, + "site-footer-legal", + "version-link", + "version-link-words", + "version-link-number", + "version-link-pre", + "version-link-date", + "site-footer-legal-row" + ], + "budget": 19900, + "usage": 3100, "attrs": [ "data-phase-after" ] @@ -1036,8 +1042,8 @@ "attrs": [ "popovertarget" ], - "budget": 4950, - "usage": 950 + "budget": 5900, + "usage": 1100 }, "menu": { "classes": [ @@ -1320,7 +1326,8 @@ "app-title", "app-actions", "app-heading", - "app-facts" + "app-facts", + "app-version" ], "requires": [ "topbar", @@ -1328,8 +1335,8 @@ "tooltip" ], "viewportFit": true, - "budget": 4300, - "usage": 2600 + "budget": 5200, + "usage": 2850 }, "pane": { "classes": [ @@ -1341,6 +1348,64 @@ "budget": 1700, "usage": 1000 }, + "release": { + "classes": [ + "release-notes", + "release", + "release-head", + "release-head-text", + "release-word", + "release-heading", + "release-version", + "release-meta", + "release-badges", + "release-action-link", + "release-copy", + "release-summary", + "release-paragraph", + "release-audience", + "release-audience-title", + "release-action", + "release-callout-title", + "release-upgrade", + "release-section", + "release-section-title", + "release-count", + "release-all", + "release-fold", + "release-fold-title", + "release-fold-panel", + "release-build", + "release-build-list", + "release-list", + "release-entry", + "release-entry-words", + "release-entry-text", + "release-area", + "release-migrate", + "release-source-cell", + "release-source", + "release-id", + "release-sources", + "release-sources-list", + "release-mono", + "release-index", + "release-index-title", + "release-index-list", + "release-index-link", + "release-index-number" + ], + "requires": [ + "disclosure", + "callout", + "popover", + "dlist", + "copy", + "status" + ], + "budget": 19600, + "usage": 2400 + }, "tab-bar": { "classes": [ "tab-bar", @@ -1349,11 +1414,12 @@ "tab-bar-glyph", "tab-bar-label", "tab-bar-dot", - "tab-bar-sheet-head" + "tab-bar-sheet-head", + "tab-bar-version" ], "viewportFit": true, - "budget": 4850, - "usage": 2250 + "budget": 5200, + "usage": 2400 } } } diff --git a/tools/html-skill/src/modules/app-shell.css b/tools/html-skill/src/modules/app-shell.css index 0916319d..66a6cf31 100644 --- a/tools/html-skill/src/modules/app-shell.css +++ b/tools/html-skill/src/modules/app-shell.css @@ -115,4 +115,14 @@ @media (forced-colors: active) { .app-sidebar { border-inline-end-color: CanvasText; } } + + /* ---- The version at the sidebar's foot (DECISIONS 320): under the account items, space-2 below them, on the nav glyphs' start edge. In the rail the + number alone, centred, breaking before a pre-release's hyphen; the label and the date are in its name and its tooltip (the script). ---- */ + .app-version { margin: var(--basalt-space-2) calc(var(--basalt-space-1-5) + var(--basalt-space-3)) 0; } + @media (width >= %bp-md%) and (width < %bp-lg%) { + .app-version { margin-inline: var(--basalt-space-1-5); } + .app-version .version-link { display: flex; justify-content: center; text-align: center; } + /* stylelint-disable-next-line unit-disallowed-list -- the 1px clip box of the visually-hidden pattern; it must be exactly 1px */ + .app-version :is(.version-link-words > :first-child, .version-link-date) { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; } + } } diff --git a/tools/html-skill/src/modules/app-shell.js b/tools/html-skill/src/modules/app-shell.js index 67829341..fe6dad49 100644 --- a/tools/html-skill/src/modules/app-shell.js +++ b/tools/html-skill/src/modules/app-shell.js @@ -25,6 +25,19 @@ } }); }); + // The version at the foot: in the rail the number alone, so the tooltip says the whole line (DECISIONS 320). + shell.querySelectorAll('.app-sidebar .version-link').forEach(function (link) { + var word = link.querySelector('.version-link-word'); + var number = link.querySelector('.version-link-number'); + var date = link.querySelector('.version-link-date time'); + if (rail.matches) { + link.setAttribute('data-tooltip', (word ? word.textContent.trim() + ' ' : '') + (number ? number.textContent.trim() : '') + (date ? ' · ' + date.textContent.trim() : '')); + link.setAttribute('data-tooltip-side', 'right'); + } else { + link.removeAttribute('data-tooltip'); + link.removeAttribute('data-tooltip-side'); + } + }); }); } rail.addEventListener('change', sync); diff --git a/tools/html-skill/src/modules/popover.js b/tools/html-skill/src/modules/popover.js index 3337b3f5..04c51158 100644 --- a/tools/html-skill/src/modules/popover.js +++ b/tools/html-skill/src/modules/popover.js @@ -76,7 +76,10 @@ if (anchor) { anchor.setAttribute('aria-expanded', 'true'); if (!anchor.hasAttribute('aria-haspopup')) anchor.setAttribute('aria-haspopup', pop.getAttribute('role') === 'menu' ? 'menu' : 'dialog'); - var again = function () { _.place(pop, anchor, { side: pop.dataset.side, align: pop.dataset.align }); }; + // Start and end are the opener's own: in a right-to-left page "end" is the left edge. + var rtl = getComputedStyle(anchor).direction === 'rtl'; + var align = rtl && pop.dataset.align === 'end' ? 'start' : rtl && (!pop.dataset.align || pop.dataset.align === 'start') ? 'end' : pop.dataset.align; + var again = function () { _.place(pop, anchor, { side: pop.dataset.side, align: align }); }; again(); pop.__again = again; window.addEventListener('resize', again); @@ -89,7 +92,35 @@ if (to && !pop.contains(to) && to !== pop.__anchor && !(to.closest && to.closest('[popover]:popover-open')) && pop.matches(':popover-open')) pop.hidePopover(); }); } - if (!pop.matches('[role="menu"], .combobox-popup')) { + // A popup marked data-focus-self takes focus itself, as React's Sources panel does. Tab then walks the popup's own controls by the browser's own + // rule, which React's portal gets from the page: Safari's Tab skips links by default and Option-Tab reaches them, so on Apple's WebKit the first + // Tab from the panel reaches its button, and elsewhere its links come first. The walk is ours because WebKit's own Tab, from a popup in the top + // layer, leaves it for the page's start. Back from the first control is the panel; past the last the popup closes and focus goes to the opener. + if (pop.hasAttribute('data-focus-self')) { + pop.setAttribute('tabindex', '-1'); + pop.focus({ preventScroll: true }); + if (!pop.__bhTab) { + pop.__bhTab = true; + var appleTab = /^Apple/.test(navigator.vendor || ''); + pop.addEventListener('keydown', function (ev) { + if (ev.key !== 'Tab' || ev.defaultPrevented) return; + var links = !appleTab || ev.altKey; + var list = _.tabbables(pop).filter(function (el) { return links || !el.matches('a[href], area[href]'); }); + var cur = document.activeElement; + var at = cur === pop ? -1 : list.indexOf(cur); + if (at < 0 && cur !== pop) { + // A control the walk skips (a link a click focused): go on from its place in the popup. + var after = list.length; + for (var i = 0; i < list.length; i++) if (cur.compareDocumentPosition(list[i]) & 4) { after = i; break; } + at = ev.shiftKey ? after : after - 1; + } + var next = at + (ev.shiftKey ? -1 : 1); + ev.preventDefault(); + if (next >= list.length) { pop.hidePopover(); if (pop.__anchor) pop.__anchor.focus({ preventScroll: true }); return; } + (next < 0 ? pop : list[next]).focus({ preventScroll: true }); + }); + } + } else if (!pop.matches('[role="menu"], .combobox-popup')) { var first = _.tabbables(pop)[0]; if (!first) pop.setAttribute('tabindex', '-1'); (first || pop).focus({ preventScroll: true }); diff --git a/tools/html-skill/src/modules/release.css b/tools/html-skill/src/modules/release.css new file mode 100644 index 00000000..91cb70a2 --- /dev/null +++ b/tools/html-skill/src/modules/release.css @@ -0,0 +1,242 @@ +/* The release module (React's ReleaseNotes and ReleaseIndex, DECISIONS 320): a package's changelog or a product's release notes, from the records + (tools/changelog writes the markup). A module: compose.mjs adds it when the markup has a .release. Every value is a token; the folds are the + disclosure module's buttons, written open and closed by this module's script, so without script and in print everything shows. + Source: tools/html-skill/src/modules/release.css (do not edit the copy in the skill folder). */ + +@layer basalt { + .release-notes { --basalt-plate: var(--basalt-plate-0); } + .release-action { --basalt-plate: var(--basalt-plate-1); } + /* The fold's button: the disclosure's, at the section heading's size, its chevron in secondary ink as React's accordion caret. */ + .release-fold { justify-content: space-between; gap: var(--basalt-space-3); } + .release-fold::after { background: var(--basalt-text-secondary); } + /* The word on the target: the stream's, kept in place once shown so its going moves nothing. */ + .release-word { display: none; margin-bottom: var(--basalt-space-1); color: var(--basalt-text-secondary); font: var(--basalt-font-weight-regular) var(--bh-xs); letter-spacing: var(--basalt-text-xs-tracking); white-space: nowrap; opacity: 0; visibility: hidden; transition: opacity calc(var(--basalt-duration-slow) * 0.75) var(--basalt-ease-in), visibility var(--basalt-duration-instant) linear calc(var(--basalt-duration-slow) * 0.75); } + :is(.release-entry[data-arrival] > .release-word, .release[data-arrival] > .release-head .release-word) { display: block; } + :is(.release-entry[data-arrived] > .release-word, .release[data-arrived] > .release-head .release-word) { opacity: 1; visibility: visible; transition-duration: var(--basalt-duration-instant); transition-delay: var(--basalt-duration-instant); } + @media (forced-colors: active) { .release-word { color: CanvasText; } } + @media (prefers-reduced-motion: reduce) { .release-word, .release-entry::before, .release-head::before { transition-property: none; } } + + /* A release. One column, at most the words' measure, space-6 and room for a source line; space-10 apart with a divider between. Its own + container, so the source line goes under the words below 640 of the release's own width. */ + .release-notes { min-width: 0; font-family: var(--basalt-font-family-sans); color: var(--basalt-text-primary); } + .release { + container-type: inline-size; + max-width: calc(var(--basalt-size-prose-width) + var(--basalt-space-6) + var(--basalt-size-sidebar-width)); + padding-block: var(--basalt-space-10); + border-top: var(--basalt-size-hairline) solid var(--basalt-border-divider); + scroll-margin-top: calc(var(--basalt-sticky-offset, var(--basalt-space-0)) + var(--basalt-space-4)); + } + .release:first-of-type { padding-top: 0; border-top: 0; } + /* The last release carries no padding under it: what follows is the page's gap alone (sweep 68-4). */ + .release:last-of-type { padding-bottom: 0; } + .release-notes > .release-build:first-child { max-width: calc(var(--basalt-size-prose-width) + var(--basalt-space-6) + var(--basalt-size-sidebar-width)); margin: 0 0 var(--basalt-space-6); } + .release:focus, .release-entry:focus { outline: none; } + /* The header is a grid: Copy link stands at the end of the first line, centred on it, and only that line makes room for it. */ + .release-head { position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--basalt-space-4); align-items: center; } + .release-head-text { display: contents; } + .release-head-text > * { grid-column: 1 / -1; min-width: 0; } + .release-head-text > .release-word { grid-row: 1; } + .release-head-text > :is(.release-number-line, .release-heading:not([data-headline])) { grid-column: 1; grid-row: 2; } + .release-head-text > .release-heading[data-headline] { grid-row: 3; } + .release-head-text > .release-heading[data-headline] ~ .release-meta { grid-row: 4; } + .release-head-text > .release-heading:not([data-headline]) ~ .release-meta { grid-row: 3; } + .release-head-text > :not(.release-word) ~ * { margin-top: var(--basalt-space-1); } + /* A ghost button at the column's edge puts its words on the edge: its plate hangs space-2-5 past it (sweep 68-1). */ + .release-head > .release-copy { grid-column: 2; grid-row: 2; align-self: center; margin-block: calc(-1 * var(--basalt-size-tap-min)); margin-inline-end: calc(-1 * var(--basalt-space-2-5)); } + .release-heading { margin: 0; font: var(--basalt-font-weight-semibold) var(--basalt-text-2xl-size) / var(--basalt-text-2xl-line-height) var(--basalt-font-family-sans); letter-spacing: var(--basalt-text-2xl-tracking); text-wrap: balance; overflow-wrap: break-word; } + /* The number standing alone is mono; in a line with its date (a headline's meta line) it is Geist, as at the foot. */ + .release-version { font-family: var(--basalt-font-family-mono); letter-spacing: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; } + .release-version[data-words] { font-family: var(--basalt-font-family-sans); letter-spacing: var(--basalt-text-2xl-tracking); } + .release-meta { margin: 0; color: var(--basalt-text-secondary); font: var(--basalt-font-weight-regular) var(--basalt-text-sm-size) / var(--basalt-text-sm-line-height) var(--basalt-font-family-sans); letter-spacing: var(--basalt-text-sm-tracking); font-variant-numeric: tabular-nums; } + .release-badges { display: inline-flex; gap: var(--basalt-space-2); margin-inline-start: var(--basalt-space-2); vertical-align: middle; } + .release-action-link { position: relative; z-index: 1; color: inherit; text-decoration: underline; text-decoration-color: var(--basalt-border-input); text-decoration-thickness: var(--basalt-size-hairline); text-underline-offset: var(--basalt-size-underline-offset); border-radius: var(--basalt-radius-xs); } + .release-action-link:hover { color: var(--basalt-text-primary); text-decoration-color: currentColor; } + .release-action-link:focus-visible { outline: var(--basalt-size-focus-width) solid var(--basalt-border-focus); outline-offset: var(--basalt-size-focus-offset); } + .release-copy { flex: none; } + .release-summary, .release-paragraph { margin: 0; max-width: var(--basalt-size-prose-width); font-size: var(--basalt-text-md-size); line-height: var(--basalt-text-md-line-height); letter-spacing: var(--basalt-text-md-tracking); text-wrap: pretty; } + .release-summary { margin-top: var(--basalt-space-4); } + .release-audience { display: grid; gap: var(--basalt-space-1); margin-top: var(--basalt-space-4); } + .release-audience-title { margin: 0; font: var(--basalt-font-weight-semibold) var(--basalt-text-md-size) / var(--basalt-text-md-line-height) var(--basalt-font-family-sans); letter-spacing: var(--basalt-text-md-tracking); } + .release-action { margin-top: var(--basalt-space-6); } + .release-action > div { flex: 1; min-width: 0; } + /* One reference column down the page: inside the callout the words' column is shorter by the callout's inset (its hairline, space-4, the 16px + mark and space-3), so its references start where the open lists' do (sweep 68-3). Under 640 of the release's width the list is one column. */ + .release-action .release-list { grid-template-columns: minmax(0, calc(var(--basalt-size-prose-width) - var(--basalt-size-hairline) - var(--basalt-space-4) - var(--basalt-size-icon-sm) - var(--basalt-space-3))) minmax(0, max-content); } + .release-callout-title { margin: 0; font: inherit; letter-spacing: inherit; } + .release-action .callout-body { color: var(--basalt-text-primary); } + .release-upgrade { margin: 0 0 var(--basalt-space-2); color: var(--basalt-text-secondary); } + .release-section, .release-all { margin-top: var(--basalt-space-6); } + .release-section-title { margin: 0 0 var(--basalt-space-2); font: var(--basalt-font-weight-semibold) var(--basalt-text-md-size) / var(--basalt-text-md-line-height) var(--basalt-font-family-sans); letter-spacing: var(--basalt-text-md-tracking); } + .release-count { margin-inline-start: var(--basalt-space-1); color: var(--basalt-text-tertiary); font-weight: var(--basalt-font-weight-regular); font-variant-numeric: tabular-nums; } + .release-action .release-count { color: var(--basalt-text-secondary); } + /* Inside a product's fold: the summary first, space-2 under the fold's heading; the sections' headings a step smaller. Nothing folds again. */ + .release-all .release-summary { margin-top: var(--basalt-space-2); } + .release-all .release-section:first-child { margin-top: var(--basalt-space-2); } + .release-all .release-summary + .release-section { margin-top: var(--basalt-space-4); } + .release-all .release-section-title { font-size: var(--basalt-text-base-size); line-height: var(--basalt-text-base-line-height); letter-spacing: var(--basalt-text-base-tracking); } + /* A fold: its heading holds the button, at the section heading's size, the chevron at the release's end. */ + .release-fold { min-height: var(--basalt-text-md-line-height); padding: 0; font: var(--basalt-font-weight-semibold) var(--basalt-text-md-size) / var(--basalt-text-md-line-height) var(--basalt-font-family-sans); letter-spacing: var(--basalt-text-md-tracking); } + .release-fold-title { margin: 0; } + /* A closed fold is hidden until found, so the browser's find opens it: the core's [hidden] would take it out of the page, which find cannot reach. */ + .release-fold-panel[hidden="until-found"] { display: block !important; content-visibility: hidden; } + /* Only an open panel takes its room: a closed one is hidden until found, which skips its content but would keep its padding. */ + .release-section[data-folded] .release-fold-panel:not([hidden]) { padding-top: var(--basalt-space-2); } + /* Build details: at the release's foot, quieter than the fold above it (14/20, 400). */ + .release-build { margin-top: var(--basalt-space-2); } + .release-build .release-fold { min-height: var(--basalt-size-control-xs); font: var(--basalt-font-weight-regular) var(--basalt-text-base-size) / var(--basalt-text-base-line-height) var(--basalt-font-family-sans); letter-spacing: var(--basalt-text-base-tracking); } + .release-build-list { margin-block: var(--basalt-space-3); } + /* An open fold's panel holds its first child's margin (space-2 under a product's fold, space-3 in Build details), so the panel's height is all + that an opening moves. Nothing moves at rest. */ + .release-fold-panel { display: flow-root; } + /* A fold that ends a release hangs the lower spare half of its button, (its row − its line) / 2, into the release's padding, open and closed: the + open panel gives it back. So the release's last line is space-10 above its divider (DECISIONS 331). On a fine pointer only Build details' button + (24) is taller than its line (20); on touch see the rows below. */ + .release > .release-build:last-child { margin-bottom: calc((var(--basalt-text-base-line-height) - var(--basalt-size-control-xs)) / 2); } + .release > .release-build:last-child > .release-fold-panel:not([hidden]) { padding-bottom: calc((var(--basalt-size-control-xs) - var(--basalt-text-base-line-height)) / 2); } + + /* The list is a grid and each entry a subgrid of it: column one the words, at most the measure; column two the source lines, as wide as the + list's widest, space-6 away, starting on one edge. So the words keep one measure down a list. A source line is one line (decision 2.8): where + the release is too narrow for the measure and the widest line, the words give way, the two columns sharing what is left until the line fits, + and only an id longer than its column's share breaks inside itself (recheck-pixels 2). */ + .release-list { display: grid; grid-template-columns: minmax(0, var(--basalt-size-prose-width)) minmax(0, max-content); justify-content: start; column-gap: var(--basalt-space-6); margin: 0; padding: 0; list-style: none; } + .release-entry { + position: relative; + display: grid; + grid-template-columns: subgrid; + grid-column: 1 / -1; + align-items: baseline; + --_release-entry-pad: var(--basalt-space-1-5); + padding-block: var(--_release-entry-pad); + scroll-margin-top: calc(var(--basalt-sticky-offset, var(--basalt-space-0)) + var(--basalt-space-8)); + } + /* Where nothing follows a change inside its box, the change has no padding under it (DECISIONS 326 and 331): the last change in Action needed, and + the last change before a release's end, in an open list or inside a fold that ends the release. Its tap box reaches into that box's padding. */ + :where(.release-action .release-list, + .release > .release-section:not([data-folded]):last-child > .release-list, + .release > .release-all:last-child > .release-fold-panel > .release-section:last-child > .release-list, + .release > .release-section[data-folded]:last-child > .release-fold-panel > .release-list) > .release-entry:last-child { padding-bottom: 0; } + .release-word { grid-column: 1 / -1; } + .release-entry-words { grid-column: 1; display: grid; justify-items: start; gap: var(--basalt-space-1); min-width: 0; } + .release-entry-text { margin: 0; color: var(--basalt-text-primary); font-size: var(--basalt-text-base-size); line-height: var(--basalt-text-base-line-height); letter-spacing: var(--basalt-text-base-tracking); text-wrap: pretty; overflow-wrap: break-word; } + /* A code chip moves to the next line whole, and breaks inside only when it is wider than the line (sweep 68-6). */ + .release-entry-text code { display: inline-block; max-inline-size: 100%; } + .release-area { font-weight: var(--basalt-font-weight-medium); } + .release-migrate { position: relative; font-size: var(--basalt-text-base-size); line-height: var(--basalt-text-base-line-height); } + .release-source-cell { grid-column: 2; justify-self: start; min-width: 0; } + .release-source-cell:empty { display: none; } + /* The source line: a quiet TextButton in Geist Mono at 13 on the entry's 20px line, its hit 24 tall on a fine pointer. Ids never break inside + (an id longer than the line breaks anywhere); beside the words the line does not wrap. */ + .release-source { position: relative; margin: 0; padding-inline: 0; border: 0; border-radius: var(--basalt-radius-xs); background: none; color: var(--basalt-text-secondary); text-align: start; cursor: pointer; transition: color var(--basalt-duration-fast) var(--basalt-ease-out); } + .release-source:hover { color: var(--basalt-text-primary); } + .release-source:focus-visible { outline: var(--basalt-size-focus-width) solid var(--basalt-border-focus); outline-offset: var(--basalt-size-focus-offset); } + .release-source { display: inline; baseline-source: first; padding-block: var(--basalt-space-0-5); margin-block: calc(-1 * var(--basalt-space-0-5)); font-family: var(--basalt-font-family-mono); font-size: var(--basalt-text-sm-size); line-height: var(--basalt-text-base-line-height); letter-spacing: 0; } + /* Each id carries the underline (an id never breaks inside, so it is a box of its own, which a label's underline would not reach). It stands at + its line's top, so an id long enough to break inside itself puts its first line, not its last, beside the words' first line; a one-line id is + drawn where it was. A button laid out inline is an inline block, whose baseline would be its last line: the source line takes its first + (baseline-source), so a source line of two lines stands beside the words' first line (recheck-pixels 2). */ + .release-id { display: inline-block; max-width: 100%; overflow-wrap: anywhere; vertical-align: top; text-decoration: underline; text-decoration-color: var(--basalt-border-input); text-decoration-thickness: var(--basalt-size-hairline); text-underline-offset: var(--basalt-size-underline-offset); transition: text-decoration-color var(--basalt-duration-fast) var(--basalt-ease-out); } + .release-source:hover .release-id { text-decoration-color: currentColor; } + .release-action-link { white-space: nowrap; } + .release-sources { width: var(--basalt-size-popover-max); } + .release-sources-list { margin-block: var(--basalt-space-2) var(--basalt-space-4); } + .release-mono { font-family: var(--basalt-font-family-mono); font-size: var(--basalt-text-sm-size); } + /* Narrow (under 640 of the release's own width): the source line is its own line under the words, space-0-5 below, wrapping between ids. */ + /* size-breakpoint-container-lg: a container query cannot read a token, so the build writes its value here */ + @container (width < %bp-container-lg%) { + .release-list, .release-action .release-list { grid-template-columns: minmax(0, 1fr); } + .release-entry { row-gap: var(--basalt-space-0-5); --_release-entry-pad: var(--basalt-space-2); } + .release-source-cell { grid-column: 1; } + .release-source { padding-block: calc((var(--basalt-size-control-xs) - var(--basalt-text-sm-line-height)) / 2); margin-block: calc((var(--basalt-text-sm-line-height) - var(--basalt-size-control-xs)) / 2); line-height: var(--basalt-text-sm-line-height); white-space: normal; } + } + /* On touch no 44px box reaches another target's box or crosses a rim, a divider or a clipping edge: an entry is space-3 above and below (a + one-line entry is 44 tall), the source line keeps the entry's 20px line, and "4 need action" and the migration link take the box too, with no + change to layout. The last change in Action needed or in a release has no padding under it, and its box reaches into the callout's or the + release's own padding. A release's last line is space-10 above its divider, whatever ends it. A change that has arrived keeps its padding. */ + @media (pointer: coarse) { + .release-entry { --_release-entry-pad: var(--basalt-space-3); } + .release-source { line-height: var(--basalt-text-base-line-height); } + .release-source::before, + .release-action-link::after, + .release-migrate::after { content: ""; position: absolute; top: 50%; left: 50%; /* physical: it is centred, in either direction */ width: max(100%, var(--basalt-size-tap-min)); height: var(--basalt-size-tap-min); transform: translate(-50%, -50%); } + .release-fold, .release-build .release-fold { min-height: var(--basalt-size-tap-min); } + /* A fold's 44px row on a 24px line hangs 10; Build details' on its 20px line, 12. */ + .release > :is(.release-all, .release-section[data-folded]):last-child { margin-bottom: calc((var(--basalt-text-md-line-height) - var(--basalt-size-tap-min)) / 2); } + .release > :is(.release-all, .release-section[data-folded]):last-child > .release-fold-panel:not([hidden]) { padding-bottom: calc((var(--basalt-size-tap-min) - var(--basalt-text-md-line-height)) / 2); } + .release > .release-build:last-child { margin-bottom: calc((var(--basalt-text-base-line-height) - var(--basalt-size-tap-min)) / 2); } + .release > .release-build:last-child > .release-fold-panel:not([hidden]) { padding-bottom: calc((var(--basalt-size-tap-min) - var(--basalt-text-base-line-height)) / 2); } + /* size-breakpoint-container-lg: a container query cannot read a token, so the build writes its value here */ + @container (width < %bp-container-lg%) { + .release-source { padding-block: calc((var(--basalt-size-control-xs) - var(--basalt-text-base-line-height)) / 2); margin-block: calc((var(--basalt-text-base-line-height) - var(--basalt-size-control-xs)) / 2); line-height: var(--basalt-text-base-line-height); } + /* A link with a source line under it: space-6 between the two (10 + 24 + 10, so the two boxes meet and do not overlap); the change ends as + every other change does, space-3 under it, which still holds the source line's box (sweep 68-5). */ + .release-entry[data-link]:has(.release-source) { row-gap: var(--basalt-space-6); } + } + } + + /* The Sources panel on touch, and in any window under 720 (DECISIONS 331, recheck-pixels 4): a linked value keeps its 20px line and its place after + the tracker's name, and its 44px box is hit area that takes no room. The rows are space-3 above and below, so a link's box ends on its row's + divider; two linked values in one row stand space-6 apart, so their boxes meet and do not overlap. */ + @media (pointer: coarse), (width < %bp-md%) { + .release-sources .dlist > div { padding-block: var(--basalt-space-3); } + .release-sources .dlist > div:first-child { padding-top: 0; } + .release-sources .dlist > div:last-child { padding-bottom: 0; } + .release-sources dd a { position: relative; display: inline; min-width: 0; min-height: 0; margin-block: 0; } + .release-sources dd a::after { content: ""; position: absolute; inset-block: auto; top: 50%; left: 50%; /* physical: it is centred, in either direction */ width: max(100%, var(--basalt-size-tap-min)); height: var(--basalt-size-tap-min); transform: translate(-50%, -50%); } + .release-sources dd:has(a) + dd:has(a) { margin-top: var(--basalt-space-6); } + /* size-breakpoint-container: a container query cannot read a token, so the build writes its value here */ + @container (width < %bp-container%) { + .release-sources dd:has(a) + dd:has(a) { margin-top: calc(var(--basalt-space-6) - var(--basalt-space-0-5)); } + } + } + + /* The entry, or the release, a link opened: the stream's arrival (the plate and the word "Linked"). An entry takes the plate itself, a release + on its header. Tertiary words on the plate step to secondary; in forced colours the plate goes and the word stays. */ + .release-entry[data-arrival] { isolation: isolate; } + /* A change that has arrived keeps its padding in every place, for as long as its "Linked" line is held: the plate is a drawn box, equal above its + first line and under its last (DECISIONS 331). */ + .release .release-entry[data-arrival] { padding-bottom: var(--_release-entry-pad); } + /* The header's plate is placed by no grid line, so it is the whole header's padding box (number, date, headline and counts), not the first row: + an absolutely placed item with no lines takes the grid's padding edges, and the head's rows are implicit (recheck-pixels 3). */ + :is(.release-entry[data-arrival], .release[data-arrival] > .release-head)::before { + content: ""; position: absolute; z-index: -1; inset: calc(-1 * var(--basalt-space-1)) calc(-1 * var(--basalt-space-2)); border-radius: var(--basalt-radius-md); pointer-events: none; + background-color: transparent; transition: background-color calc(var(--basalt-duration-slow) * 0.75) var(--basalt-ease-in); + } + :is(.release-entry[data-arrived], .release[data-arrived] > .release-head)::before { background-color: var(--basalt-plate); transition-duration: var(--basalt-duration-instant); } + :is(.release-entry[data-arrived], .release[data-arrived] > .release-head) .release-count { color: var(--basalt-text-secondary); } + @media (forced-colors: active) { + :is(.release-entry[data-arrival], .release[data-arrival] > .release-head)::before { display: none; } + } + + /* The versions: a nav of links, the number in mono and primary, the date at the row's end in tertiary, 13/18, 30 tall and 44 on touch. + The pane form beside the page; the fold form above the first release where the pane would follow the page instead. */ + .release-index-title { margin: 0 0 var(--basalt-space-2); font: var(--basalt-font-weight-medium) var(--basalt-text-sm-size) / var(--basalt-text-sm-line-height) var(--basalt-font-family-sans); letter-spacing: var(--basalt-text-sm-tracking); } + .release-index-list { display: grid; margin: 0; padding: 0; list-style: none; } + .release-index-link { display: flex; align-items: baseline; justify-content: space-between; gap: var(--basalt-space-4); padding-block: var(--basalt-space-1-5); border-radius: var(--basalt-radius-xs); color: var(--basalt-text-secondary); font: var(--basalt-font-weight-regular) var(--basalt-text-sm-size) / var(--basalt-text-sm-line-height) var(--basalt-font-family-sans); font-variant-numeric: tabular-nums; text-decoration: none; } + .release-index-number { color: var(--basalt-text-primary); font-family: var(--basalt-font-family-mono); letter-spacing: 0; overflow-wrap: anywhere; } + .release-index-number[data-words] { font-family: var(--basalt-font-family-sans); } + .release-index-link time { flex: none; color: var(--basalt-text-tertiary); } + .release-index-link:hover .release-index-number { text-decoration: underline; text-decoration-thickness: var(--basalt-size-hairline); text-underline-offset: var(--basalt-size-underline-offset); } + .release-index-link:focus-visible { outline: var(--basalt-size-focus-width) solid var(--basalt-border-focus); outline-offset: var(--basalt-size-focus-offset); } + .release-index[data-release-form="fold"] { margin-bottom: var(--basalt-space-8); } + .release-index[data-release-form="fold"] .release-fold { font: var(--basalt-font-weight-medium) var(--basalt-text-sm-size) / var(--basalt-text-sm-line-height) var(--basalt-font-family-sans); } + @media (pointer: coarse) { + .release-index-link { align-items: center; min-height: var(--basalt-size-tap-min); padding-block: 0; } + } + /* Where PaneLayout puts its pane beside the page the pane form shows; where the pane follows the page, the fold does, and the pane is not drawn. */ + .release-index[data-release-form="fold"] { display: none; } + /* stylelint-disable-next-line basalt/container-length -- size-sidebar-width (256px) + size-gutter (24px) + size-breakpoint-container-lg (640px), PaneLayout's own threshold; a container query cannot read a custom property */ + @container (width < 920px) { + .pane-layout .release-index[data-release-form="fold"] { display: block; } + .pane:has(> .release-index[data-release-form="pane"]) { display: none; } + } + + /* Print and no script: every fold is open (the parts draw them open until script runs); Copy buttons are not printed, and a source line prints as text. */ + @media print { + :is(.release-notes, .release-index) .release-fold-panel { content-visibility: visible; } + :is(.release-notes, .release-index) .release-fold-panel[hidden] { display: flow-root !important; content-visibility: visible; } + .release-section[data-folded] .release-fold-panel[hidden] { padding-top: var(--basalt-space-2); } + .release-copy, .release-notes [data-copy-text], .release-sources, .release-build .btn { display: none; } + .release-id { text-decoration: none; } + } + +} diff --git a/tools/html-skill/src/modules/release.js b/tools/html-skill/src/modules/release.js new file mode 100644 index 00000000..a709e0f7 --- /dev/null +++ b/tools/html-skill/src/modules/release.js @@ -0,0 +1,110 @@ +/* Basalt HTML script, release module (React's ReleaseNotes and ReleaseIndex, DECISIONS 320): the folds, the copied addresses and the arrival. + - Folds are written open, so without script everything shows. This closes each one to hidden="until-found" (the browser's find opens it) and + toggles it from its button. + - A Copy link button with data-copy-fragment copies the page's own address (the release notes' data-base, or the window's, with no query) and + that fragment, read when it is pressed. + - Arriving (on load and on every hashchange): the fragment is looked up with getElementById, never as a selector ("v1.4.0" is not one); a + candidate's address opens the release that replaces it (data-replaces); every fold holding the target opens; the target is scrolled to and + focused with no ring and takes the stream's mark (the plate and "Linked") until the reader presses or types. + Source: tools/html-skill/src/modules/release.js (do not edit the copy in the skill folder). */ +(function (B) { + 'use strict'; + var _ = B._; + var READS = /^(Arrow(Up|Down|Left|Right)|Page(Up|Down)|Home|End| |Shift|Control|Alt|Meta|CapsLock)$/; + var at = null; + + function setFold(button, open) { + var panel = document.getElementById(button.getAttribute('aria-controls')); + button.setAttribute('aria-expanded', String(open)); + if (!panel) return; + if (open) panel.removeAttribute('hidden'); + else panel.setAttribute('hidden', 'until-found'); + } + + function wireFolds() { + document.querySelectorAll('.release-fold').forEach(function (button) { + if (button.__bhRelease) return; + button.__bhRelease = true; + setFold(button, false); + button.addEventListener('click', function () { setFold(button, button.getAttribute('aria-expanded') !== 'true'); }); + var panel = document.getElementById(button.getAttribute('aria-controls')); + // Found by the browser's find: it removes hidden itself; the button follows. + if (panel) panel.addEventListener('beforematch', function () { button.setAttribute('aria-expanded', 'true'); }); + }); + } + + function base(button) { + var notes = button.closest('[data-base]'); + return notes ? notes.getAttribute('data-base') : location.origin + location.pathname; + } + + function end() { + if (!at) return; + at.removeAttribute('data-arrived'); + var word = at.querySelector('.release-word'); + if (word) word.setAttribute('aria-hidden', 'true'); + at = null; + } + + function target(id) { + if (!id) return null; + var el = document.getElementById(id); + if (el && (el.classList.contains('release') || el.classList.contains('release-entry'))) return el; + // A candidate no longer drawn: its stable release says it replaces it. + var releases = document.querySelectorAll('.release[data-replaces]'); + for (var i = 0; i < releases.length; i++) { + if (releases[i].getAttribute('data-replaces').split(' ').some(function (v) { return 'v' + v === id; })) return releases[i]; + } + return null; + } + + function arrive() { + var raw = location.hash.slice(1); + var id = raw; + try { id = decodeURIComponent(raw); } catch (e) { /* a fragment that is not valid percent-encoding is read as written */ } + var el = target(id); + end(); + if (!el) return; + for (var p = el.parentElement; p; p = p.parentElement) { + if (p.classList && p.classList.contains('release-fold-panel') && p.hasAttribute('hidden')) { + var button = document.querySelector('[aria-controls="' + CSS.escape(p.id) + '"]'); + if (button) setFold(button, true); + } + } + el.setAttribute('tabindex', '-1'); + el.setAttribute('data-arrival', ''); + el.setAttribute('data-arrived', ''); + var word = el.classList.contains('release') ? el.querySelector('.release-head .release-word') : el.querySelector(':scope > .release-word'); + if (word) word.removeAttribute('aria-hidden'); + at = el; + requestAnimationFrame(function () { + el.scrollIntoView({ block: el.getBoundingClientRect().height > innerHeight * 0.6 ? 'start' : 'center' }); + el.focus({ preventScroll: true }); + // From the next frame, so the press or key that opened it does not end its mark. + requestAnimationFrame(function () { el.__bhArmed = true; }); + }); + } + + function act(event) { + if (!at || !at.__bhArmed) return; + if (event.type === 'keydown') { + var inField = event.target && event.target.closest && event.target.closest('input, textarea, select, [contenteditable]'); + if (READS.test(event.key) && !(event.key === ' ' && inField)) return; + } + at.__bhArmed = false; + end(); + } + + _.step(78, 'wireRelease', function () { + if (!document.querySelector('.release, .release-index')) return; + wireFolds(); + document.addEventListener('click', function (event) { + var button = event.target.closest && event.target.closest('[data-copy-fragment]'); + if (button) button.setAttribute('data-copy-text', base(button) + '#' + button.getAttribute('data-copy-fragment')); + }, true); + document.addEventListener('pointerdown', act, true); + document.addEventListener('keydown', act, true); + addEventListener('hashchange', arrive); + arrive(); + }); +})(window.Basalt); diff --git a/tools/html-skill/src/modules/tab-bar.css b/tools/html-skill/src/modules/tab-bar.css index ff7fab2a..d8debb70 100644 --- a/tools/html-skill/src/modules/tab-bar.css +++ b/tools/html-skill/src/modules/tab-bar.css @@ -133,4 +133,8 @@ .tab-bar[data-keys] .tab-bar-item:is(:hover, :active) .tab-bar-glyph { forced-color-adjust: auto; background-color: transparent; color: inherit; } .tab-bar-dot { forced-color-adjust: none; background-color: CanvasText; } } + + /* ---- The version as the last row of More's sheet (DECISIONS 320): under a divider, space-2 below the list, 44 tall, at 13/18, on the nav glyphs' edge. ---- */ + .tab-bar-version { box-sizing: border-box; display: flex; align-items: center; min-height: var(--basalt-size-tap-min); margin-top: var(--basalt-space-2); padding-inline: calc(var(--basalt-space-1-5) + var(--basalt-space-3)); border-top: var(--basalt-size-hairline) solid var(--basalt-border-divider); } + .tab-bar-version .version-link { font-size: var(--basalt-text-sm-size); line-height: var(--basalt-text-sm-line-height); letter-spacing: var(--basalt-text-sm-tracking); } } diff --git a/tools/html-skill/src/modules/topbar.css b/tools/html-skill/src/modules/topbar.css index 5f068d2d..6524bcd0 100644 --- a/tools/html-skill/src/modules/topbar.css +++ b/tools/html-skill/src/modules/topbar.css @@ -267,4 +267,45 @@ .site-slot > .topbar[data-form] { position: absolute; transform: none; opacity: 1; transition: none; } .site-footer-toggle { display: none; } } + + /* ---- The version with its date (React's VersionLink, DECISIONS 320): one link to the release notes at that version. 12/16, tabular, secondary + ink; hover lifts it to primary and underlines both parts. Two parts never break inside (the word with the number, joined by a no-break space, + and the date): when they do not fit one line the date goes under the number, and the dot, standing in the gap before the date, is then left of + the link's own box, which clips it. A version longer than its place wraps anywhere. In a site's footer it follows the legal line, on its row. ---- */ + .version-link { + position: relative; + box-sizing: border-box; + display: inline-flex; + flex-wrap: wrap; + align-items: baseline; + column-gap: var(--basalt-space-3); + max-width: 100%; + overflow-x: clip; + padding-block: var(--basalt-space-1); + border-radius: var(--basalt-radius-xs); + color: var(--basalt-text-secondary); + font: var(--basalt-font-weight-regular) var(--basalt-text-xs-size) / var(--basalt-text-xs-line-height) var(--basalt-font-family-sans); + letter-spacing: var(--basalt-text-xs-tracking); + font-variant-numeric: tabular-nums; + text-decoration: none; + -webkit-tap-highlight-color: transparent; + transition: color var(--basalt-duration-fast) var(--basalt-ease-out); + } + .version-link-words, .version-link-date { position: relative; min-width: 0; overflow-wrap: anywhere; } + .version-link-date::before { content: "·"; content: "·" / ""; position: absolute; inset-inline-end: 100%; width: var(--basalt-space-3); text-align: center; } + .version-link-pre { display: inline-block; max-width: 100%; } + /* The number reserves its 600 width, so being the current page moves nothing. */ + .version-link-number { display: inline-flex; flex-direction: column; max-width: 100%; } + .version-link-number::after { content: attr(data-label); height: 0; overflow: hidden; visibility: hidden; font-weight: var(--basalt-font-weight-semibold); user-select: none; pointer-events: none; } + .version-link:hover { color: var(--basalt-text-primary); } + .version-link:hover :is(.version-link-words, .version-link-date > time) { text-decoration: underline; text-decoration-thickness: var(--basalt-size-hairline); text-underline-offset: var(--basalt-size-underline-offset); } + .version-link:focus-visible { outline: var(--basalt-size-focus-width) solid var(--basalt-border-focus); outline-offset: var(--basalt-size-focus-offset); } + .version-link[aria-current="page"] { color: var(--basalt-text-primary); } + .version-link[aria-current="page"] .version-link-number { font-weight: var(--basalt-font-weight-semibold); } + /* On touch a 44px hit box that moves nothing. */ + @media (pointer: coarse) { + .version-link::after { content: ""; position: absolute; inset-inline: 0; top: 50%; height: max(100%, var(--basalt-size-tap-min)); transform: translateY(-50%); } + } + .site-footer-legal-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--basalt-space-1) var(--basalt-space-4); min-width: 0; } + .site-footer-legal-row .version-link { font-size: var(--basalt-text-sm-size); line-height: var(--basalt-text-sm-line-height); letter-spacing: var(--basalt-text-sm-tracking); } } diff --git a/tools/html-skill/src/usage/app-shell.md b/tools/html-skill/src/usage/app-shell.md index 09b9f206..1b4d4ba0 100644 --- a/tools/html-skill/src/usage/app-shell.md +++ b/tools/html-skill/src/usage/app-shell.md @@ -23,3 +23,4 @@ An app's frame (React's `AppShell` and `AppHeader`): a sidebar at 1024 and up, t - `.brand-full` is the lockup, `.brand-rail` the mark alone (the rail shows it). The sidebar's brand band draws no line. - Don't use `.page` inside `.app-main`; it is already the page's width with the gutter. The shell needs `viewport-fit=cover` for the phone's safe areas: compose adds it. - `data-capped` on the shell holds it to the sidebar plus 72rem, centred; the page then fills its column. A page with a pane beside it: `--usage pane`. +- The version this session runs: a `.version-link` in `div.app-version`, last in `.app-account`; the rail shows the number alone and the script gives it the whole line as a tooltip. No "What's new" item. diff --git a/tools/html-skill/src/usage/popover.md b/tools/html-skill/src/usage/popover.md index 40abc956..4e581481 100644 --- a/tools/html-skill/src/usage/popover.md +++ b/tools/html-skill/src/usage/popover.md @@ -13,3 +13,4 @@ A native popup beside its opener: `<button class="btn" popovertarget="p1">` then - Put the popup where its opener sits, inside whatever holds the opener: its level is the opener's plus one. The browser opens, light-dismisses and closes it on Esc and returns focus; the script positions it (below, at the start; `data-side="top|left|right"` and `data-align="center|end"` on the popup), moves focus in and closes it when focus leaves. - Name it with a `.popover-title`. No danger styling, no second blurred layer, and it is never modal: for a decision use `dialog`. +- `data-focus-self` on the popup: it takes focus itself when it opens, rather than its first control (Tab goes on into it). diff --git a/tools/html-skill/src/usage/release.md b/tools/html-skill/src/usage/release.md new file mode 100644 index 00000000..b0ee591d --- /dev/null +++ b/tools/html-skill/src/usage/release.md @@ -0,0 +1,20 @@ +# release + +A package's changelog or a product's release notes (React's `ReleaseNotes` and `ReleaseIndex`), from the records `tools/changelog` writes. Don't write the markup by hand: run `node tools/changelog/skill-body.mjs --form reference|notes --out body.html` (`--running 1.4.0` marks "Your version") and compose that body. Its words follow the release-words skill. + +```html +<div class="release-notes" data-release-form="reference"> + <section class="release" id="v0.2.0" aria-labelledby="v0.2.0-heading"> + <header class="release-head">…the number and date in one h2, the counts, Copy link…</header> + <div class="callout release-action" data-status="warning" id="v0.2.0-action">…Action needed…</div> + <section class="release-section"><h3 class="release-section-title">Added<span class="release-count">…</span></h3><ul class="release-list">…</ul></section> + </section> +</div> +``` + +- Releases highest first; a release is `#v1.4.0`, an entry its permanent id. Arriving at either opens its folds, scrolls to it, focuses it and marks it "Linked" until the reader acts; a candidate's address opens the release that replaces it (`data-replaces`). +- `data-release-form="reference"`: the list open, only Fixed folds (past 3, in a release of more than 10). `"notes"`: the audience paragraphs lead and the list (with the summary) is one fold, "All changes", or "Other changes" under Action needed. +- Folds are `button.disclosure.release-fold` in their heading, the panel written open: the script closes it (`hidden="until-found"`), so without script and in print everything shows. Never write `hidden` yourself. +- A source line opens a `.release-sources` popover: Pull request, Tickets, Commit, and Author only when the entry has one. Copy link buttons copy the page's own address (`data-base` on `.release-notes`, or the window's) and the fragment. +- The versions: `nav.release-index` in a `.pane-layout`'s pane, and a second one with `data-release-form="fold"` before the notes; each shows only where it belongs. +- Build details sits on the release this session runs, with the running build's rows; never a row from a release. diff --git a/tools/html-skill/src/usage/tab-bar.md b/tools/html-skill/src/usage/tab-bar.md index d8b32ed1..9837640e 100644 --- a/tools/html-skill/src/usage/tab-bar.md +++ b/tools/html-skill/src/usage/tab-bar.md @@ -17,3 +17,4 @@ The phone tab bar (React's `TabBar`): an app's destinations under 720, glyph ove - Every item has a glyph and a label, one word where it can be, both primary ink; the label is 12/16. The current page: `aria-current="page"`, its glyph selected and its label 600, no pill or bar. If it is under More, put `data-current` on the More button and say so in its `aria-label` ("More, Settings, current page"). - `.tab-bar-dot` says something is new; its words follow, visually hidden. Counts are spoken, never drawn. - Inside `.app-shell` give the shell `data-tabbar`: its content pads past the bar. On its own, pad your content's bottom by `calc(var(--basalt-bottom-offset) + var(--basalt-space-6))`, as the shell does. compose adds `viewport-fit=cover` for the safe area. +- In an app with a version, More's last row is the same `.version-link` in `div.tab-bar-version`, after the sheet's `.nav`. diff --git a/tools/html-skill/src/usage/topbar.md b/tools/html-skill/src/usage/topbar.md index 1fc52c6d..ac41d762 100644 --- a/tools/html-skill/src/usage/topbar.md +++ b/tools/html-skill/src/usage/topbar.md @@ -37,3 +37,4 @@ The page's one blurred (smoked) surface; it falls back to opaque on its own. - Groups are labelled `h2`s in sentence case; up to six links with no label and no `.site-footer-groups` is the line form (`data-form="line"` on the footer). The legal line and the theme choice are required. One `nav`. - The script makes each link a pill, and under 720 each group a disclosure (closed unless it holds `aria-current="page"`). Write none of it. +- The version (`.version-link`, written by `skill-body.mjs`'s `versionLink`) follows the legal line: wrap both in `div.site-footer-legal-row`, the label the product ("Basalt 0.2.0 · Nov 23, 2026"). Nothing marks a release as new. diff --git a/tools/html-skill/test/parity-16.test.mjs b/tools/html-skill/test/parity-16.test.mjs new file mode 100644 index 00000000..7b1353f6 --- /dev/null +++ b/tools/html-skill/test/parity-16.test.mjs @@ -0,0 +1,146 @@ +// The sixteenth parity PR (versions and release notes, DECISIONS 320): the skill's release module and version link, written by tools/changelog/skill-body.mjs, +// beside React's ReleaseNotes and VersionLink from the same made-up records (Slate, a package; Harbor, a product), in both themes at 1440 and 390, compared +// by computed style: a release, its header, an entry, the source line, the sources panel and the version link at the sidebar's foot and in a site's footer. +import assert from "node:assert/strict"; +import { after, before, describe, test } from "node:test"; + +import { compose } from "../../../.agent/skills/basalt-html/compose.mjs"; +import { fixturePage, launch as launchReact } from "../../../packages/react/test/support.mjs"; +import { HARBOR, RUNNING_BUILD, SLATE } from "../../../packages/react/test/release-fixture.mjs"; +import { releaseNotesHtml, versionLink } from "../../changelog/skill-body.mjs"; +import { launch, openHtml } from "./support.mjs"; + +let browser; +let reactBrowser; +before(async () => { browser = await launch(); reactBrowser = await launchReact(); }); +after(async () => { await browser?.close(); await reactBrowser?.close(); }); + +const THEMES = ["dark", "light"]; +// The skill's page carries its own base (ink, 14/20 sans, border-box); React's fixture has none, so it is given the same. +const BASE = "*, ::before, ::after { box-sizing: border-box; } body { margin: 0; background: var(--basalt-surface-page); color: var(--basalt-text-primary); font: 400 14px / 20px var(--basalt-font-family-sans); }"; +const TYPE = ["fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "color"]; +const BOX = ["width", "height", "paddingTop", "paddingBottom", "paddingLeft", "marginTop", "borderTopWidth", "borderTopStyle", "borderTopColor"]; + +const measure = (page, selector, props) => page.evaluate(({ selector, props }) => { + const el = document.querySelector(selector); + if (!el) return null; + const s = getComputedStyle(el); + const out = {}; + for (const p of props) out[p] = ["width", "height"].includes(p) ? `${Math.round(el.getBoundingClientRect()[p] * 10) / 10}px` : s[p]; + return out; +}, { selector, props }); +const settleAnimations = (page) => page.evaluate(async () => { await new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(r))); await Promise.all(document.getAnimations().filter((a) => a.effect?.getComputedTiming().iterations !== Infinity).map((a) => a.finished.catch(() => {}))); }); +async function compare(react, skill, [r, s], props, label) { + await settleAnimations(react); + await settleAnimations(skill); + const a = await measure(react, r, props); + const b = await measure(skill, s, props); + assert.ok(a && b, `${label}: both exist (${r} / ${s})`); + assert.deepEqual(b, a, label); +} + +const DATA = `const SLATE = ${JSON.stringify(SLATE)}; const HARBOR = ${JSON.stringify(HARBOR)}; const RUNNING_BUILD = ${JSON.stringify(RUNNING_BUILD)};`; +const reactPage = async (jsx, { theme, width }) => { + const r = await fixturePage(reactBrowser, `${DATA} createRoot(document.getElementById("root")).render(${jsx});`, { theme, colorScheme: theme, viewport: { width, height: 900 }, standards: true }); + await r.page.addStyleTag({ content: BASE }); + return r.page; +}; +const skillPage = async (body, { theme, width }) => (await openHtml(browser, compose(`<title>Parity${body}`, { fonts: false }).html, { scheme: theme, width })).page; + +const frame = (width) => width - 32; +const REACT_NOTES = (form, width) => `
`; +const SKILL_NOTES = (form, width) => `
${releaseNotesHtml(form === "notes" ? HARBOR : SLATE, { form, product: form === "notes" ? "Harbor" : "Slate", running: form === "notes" ? "1.4.0" : undefined, runningBuild: form === "notes" ? RUNNING_BUILD : undefined, base: "https://example.test/notes" })}
`; + +const PARTS = [ + ["a release", '[id="v0.2.0"]', '[id="v0.2.0"]', ["width", "paddingTop", "paddingBottom", "borderTopWidth", "borderTopColor", "maxWidth"]], + ["its header", '[id="v0.2.0"] .basalt-release-head', '[id="v0.2.0"] .release-head', ["width", "height", "display", "gap"]], + ["the number", '[id="v0.2.0"] .basalt-release-version', '[id="v0.2.0"] .release-version', [...TYPE, "width", "height"]], + ["the meta line", '[id="v0.2.0"] p.basalt-release-meta', '[id="v0.2.0"] p.release-meta', [...TYPE, "width", "height"]], + ["Copy link", '[id="v0.2.0"] .basalt-release-copy', '[id="v0.2.0"] .release-copy', [...TYPE, "width", "height", "paddingLeft"]], + ["the summary", '[id="v0.2.0"] .basalt-release-summary', '[id="v0.2.0"] .release-summary', [...TYPE, ...BOX]], + ["Action needed", '[id="v0.2.0"] .basalt-release-action', '[id="v0.2.0"] .release-action', ["width", "height", "marginTop", "borderTopColor", "backgroundColor"]], + ["its heading", '[id="v0.2.0"] .basalt-release-callout-title', '[id="v0.2.0"] .release-callout-title', [...TYPE, "width", "height"]], + ["the upgrade line", '[id="v0.2.0"] .basalt-release-upgrade', '[id="v0.2.0"] .release-upgrade', [...TYPE, "width", "height"]], + ["a section", '[id="v0.2.0"] .basalt-release-section', '[id="v0.2.0"] .release-section', ["width", "height", "marginTop"]], + ["its heading", '[id="v0.2.0"] .basalt-release-section-title', '[id="v0.2.0"] .release-section-title', [...TYPE, "width", "height", "marginBottom"]], + ["a count", '[id="v0.2.0"] .basalt-release-section .basalt-release-count', '[id="v0.2.0"] .release-section .release-count', [...TYPE, "marginLeft"]], + ["an entry", '[id="pr45-1"]', '[id="pr45-1"]', ["width", "height", "paddingTop", "paddingBottom", "gridTemplateColumns", "columnGap"]], + ["its words", '[id="pr45-1"] .basalt-release-entry-text', '[id="pr45-1"] .release-entry-text', [...TYPE, "width", "height"]], + ["its area", '[id="pr45-1"] .basalt-release-area', '[id="pr45-1"] .release-area', TYPE], + ["the source line", '[id="pr46-1"] .basalt-release-source', '[id="pr46-1"] .release-source', [...TYPE, "width", "height", "paddingTop", "cursor"]], + ["a source id", '[id="pr46-1"] .basalt-release-id', '[id="pr46-1"] .release-id', [...TYPE, "width", "height", "textDecorationLine", "textDecorationColor"]], + ["How to migrate", '[id="pr41-1"] .basalt-release-migrate', '[id="pr41-1"] .release-migrate', [...TYPE, "width", "height", "textDecorationLine"]], + ["a fold", '[id="v0.2.0"] .basalt-accordion-trigger', '[id="v0.2.0"] .release-fold', [...TYPE, "width", "height"]], +]; +const NOTES_PARTS = [ + ["a headline", '[id="v1.4.0"] .basalt-release-heading', '[id="v1.4.0"] .release-heading', [...TYPE, "width", "height"]], + ["its number line", '[id="v1.4.0"] .basalt-release-number-line', '[id="v1.4.0"] .release-number-line', [...TYPE, "width", "height"]], + ["a paragraph's heading", '[id="v1.4.0"] .basalt-release-audience-title', '[id="v1.4.0"] .release-audience-title', [...TYPE, "width", "height"]], + ["a paragraph", '[id="v1.4.0"] .basalt-release-paragraph', '[id="v1.4.0"] .release-paragraph', [...TYPE, "width", "height"]], + ["All changes", '[id="v1.4.0"] .basalt-release-all .basalt-accordion-trigger', '[id="v1.4.0"] .release-all .release-fold', [...TYPE, "width", "height"]], + ["Build details", '[id="v1.4.0"] .basalt-release-build .basalt-accordion-trigger', '[id="v1.4.0"] .release-build .release-fold', [...TYPE, "width", "height"]], + ["a badge", '[id="v1.4.0"] .basalt-badge', '[id="v1.4.0"] .badge', [...TYPE, "width", "height", "borderTopColor"]], + ["the release below", '[id="v1.3.1"]', '[id="v1.3.1"]', ["width", "height", "paddingTop"]], +]; + +describe("a release and its parts: the skill's, against React's", () => { + for (const theme of THEMES) for (const width of [1440, 390]) { + test(`a package's changelog in ${theme} at ${width}`, async () => { + const react = await reactPage(REACT_NOTES("reference", width), { theme, width }); + const skill = await skillPage(SKILL_NOTES("reference", width), { theme, width }); + for (const [label, r, s, props] of PARTS) await compare(react, skill, [r, s], props, `${label} (${theme}, ${width})`); + await react.close(); + await skill.context().close(); + }); + test(`a product's release notes in ${theme} at ${width}`, async () => { + const react = await reactPage(REACT_NOTES("notes", width), { theme, width }); + const skill = await skillPage(SKILL_NOTES("notes", width), { theme, width }); + for (const [label, r, s, props] of NOTES_PARTS) await compare(react, skill, [r, s], props, `${label} (${theme}, ${width})`); + await react.close(); + await skill.context().close(); + }); + } + + for (const theme of THEMES) test(`the sources panel, opened, in ${theme}`, async () => { + const react = await reactPage(REACT_NOTES("reference", 1440), { theme, width: 1440 }); + const skill = await skillPage(SKILL_NOTES("reference", 1440), { theme, width: 1440 }); + await react.locator('[id="pr41-1"] .basalt-release-source').click(); + await skill.locator('[id="pr41-1"] .release-source').click(); + await react.locator(".basalt-release-sources").waitFor(); + await skill.locator(".release-sources:popover-open").waitFor(); + for (const [label, r, s, props] of [ + ["the panel", ".basalt-release-sources", ".release-sources:popover-open", ["width", "paddingTop", "paddingLeft", "borderTopLeftRadius", "backgroundColor"]], + ["its title", ".basalt-release-sources .basalt-popover-title", ".release-sources:popover-open .popover-title", TYPE], + ["a label", ".basalt-release-sources dt", ".release-sources:popover-open dt", TYPE], + ["a value", ".basalt-release-sources dd", ".release-sources:popover-open dd", TYPE], + ]) await compare(react, skill, [r, s], props, `${label} (${theme})`); + // The same rows, in the same order. + const rows = (page, selector) => page.locator(`${selector} dt`).evaluateAll((els) => els.map((el) => el.textContent)); + assert.deepEqual(await rows(skill, ".release-sources:popover-open"), await rows(react, ".basalt-release-sources")); + await react.close(); + await skill.context().close(); + }); +}); + +describe("the version link: the skill's, against React's", () => { + const LINK = ["fontFamily", "fontSize", "lineHeight", "letterSpacing", "color", "width", "height", "paddingTop", "columnGap", "fontVariantNumeric"]; + for (const theme of THEMES) test(`in a site's footer and at the sidebar's foot, in ${theme}`, async () => { + const react = await reactPage(`
+

© 2026 Example

+
+
+
`, { theme, width: 1440 }); + const skill = await skillPage(`
+ ', { fonts: true }).html), __ROUND34_SKILL_TABLE__: JSON.stringify(compose(`Skill table
RunStatusRegionDuration
run-0142ReadyFrankfurt4m 12s
run-0141BuildingAshburn2m 50s
run-0140ErrorSydney11m 03s
`, { fonts: true }).html) }, nodePaths: [path.join(repo, "node_modules")], - loader: { ".png": "dataurl" }, + loader: { ".png": "dataurl", ".jpg": "dataurl" }, logLevel: "warning", }); const js = inlineScript(bundle.outputFiles[0].text); diff --git a/tools/review/round68-pairs.mjs b/tools/review/round68-pairs.mjs new file mode 100644 index 00000000..138cbc9d --- /dev/null +++ b/tools/review/round68-pairs.mjs @@ -0,0 +1,81 @@ +// Round 68's pictures for the owner's eye (DECISIONS 320, 6.1 item 6; Fable's pixel review B1): for each item, this build's own shots beside the +// prototype's, in both themes, cropped to the part the item is about and written as JPEGs under assets/round-68, with an index the round imports. +// npm run review -- 68 (the build's shots, into .review/basalt-round-68-screenshots) +// node tools/review/round68-pairs.mjs +// npm run review -- 68 (again, with the pictures in the walkthrough) +// The prototype's shots and the decision's proofs live with the council's papers, outside the repository; only the crops are committed. +import fs from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +import { chromium } from "playwright"; + +const HERE = path.dirname(fileURLToPath(import.meta.url)); +const BUILD = path.join(HERE, "..", "..", ".review", "basalt-round-68-screenshots"); +const [PROTOTYPE, PROOFS] = process.argv.slice(2); +if (!PROTOTYPE || !PROOFS) { + process.stderr.write("usage: node tools/review/round68-pairs.mjs \n"); + process.exit(2); +} +const OUT = path.join(HERE, "assets", "round-68"); + +// Each picture: [where, file without -theme.png, crop box in the source's pixels or null for all of it]. The build's shots are 2x. +const SIDEBAR = [0, 1100, 600, 700]; +export const PAIRS = [ + { id: "1", build: [["build", "01-foot-1440", SIDEBAR], ["build", "01-foot-current-1440", SIDEBAR]], proto: [["proto", "console-sidebar-1440", [0, 1100, 512, 700]]], extra: [["proofs", "foot-options-1760", null]] }, + { id: "2", build: [["build", "01-foot-hover-820", [0, 1100, 900, 700]], ["build", "01-foot-candidate-820", [0, 1100, 600, 700]]], proto: [] }, + { id: "3", build: [["build", "01-foot-more-390", [0, 900, 780, 900]], ["build", "01-foot-current-more-390", [0, 900, 780, 900]]], proto: [["proto", "console-more-390", [0, 788, 780, 900]]] }, + { id: "4", build: [["build", "01-foot-1440", [0, 0, 600, 1800]], ["build", "01-foot-more-390", [0, 900, 780, 900]]], proto: [["proto", "console-sidebar-1440", null], ["proto", "console-sidebar-seen-1440", null], ["proto", "console-menu-1440", null]] }, + { id: "5", build: [["build", "03-changelog-action-1440", [240, 0, 2400, 1800]], ["build", "03-changelog-action-390", null]], proto: [["proto", "changelog-1440", [240, 4200, 2400, 5400]]] }, + { id: "6", build: [["build", "02-release-notes-all-1440", [512, 0, 2368, 1800]], ["build", "02-release-notes-all-390", null]], proto: [["proto", "console-full-1440", [512, 0, 2368, 3078]], ["proto", "console-full-390", [0, 0, 780, 2400]]] }, + { id: "7", build: [["build", "03-changelog-1440", [0, 0, 2880, 1800]], ["build", "03-changelog-390", [0, 0, 780, 1800]]], proto: [["proto", "changelog-filter-1440", [0, 0, 2880, 1800]], ["proto", "changelog-filter-390", [0, 0, 780, 1800]]] }, + { id: "8", build: [["build", "03-changelog-action-1440", [240, 0, 2400, 1200]]], proto: [] }, + { id: "10", build: [["build", "03-changelog-action-1440", [270, 0, 1650, 1800]], ["build", "03-changelog-action-390", null]], proto: [["proto", "changelog-provcrop-1440", null]] }, + { id: "11", build: [["build", "04-sources-sources-1440", [700, 200, 2180, 1600]]], proto: [["proto", "changelog-provenance-1440", [700, 200, 2180, 1600]], ["proto", "changelog-made-1440", null], ["proto", "console-about-1440", null]] }, + { id: "12", build: [["build", "04-sources-sources-1440", [700, 200, 2180, 1600]], ["build", "04-sources-sources-none-1440", [700, 200, 2180, 1600]]], proto: [["proto", "changelog-provenance-1440", [700, 200, 2180, 1600]]] }, + { id: "13", build: [["build", "02-release-notes-build-1440", [512, 0, 2368, 1800]], ["build", "02-release-notes-between-1440", [512, 0, 2368, 1800]], ["build", "02-release-notes-build-390", null]], proto: [["proto", "console-build-390", [0, 2400, 780, 1806]]] }, +]; + +const ROOT = { build: BUILD, proto: PROTOTYPE, proofs: PROOFS }; +/** Widest a picture is written: the walkthrough draws each column at most about 690 wide, so this is 2x of that. Every source is a 2x shot, so a picture is drawn at half its source width (one scale for both sides), or the column's width where that is less. */ +const WIDEST = 1400; + +const browser = await chromium.launch(); +const page = await browser.newPage(); +fs.rmSync(OUT, { recursive: true, force: true }); +fs.mkdirSync(OUT, { recursive: true }); +const index = []; +for (const pair of PAIRS) { + for (const theme of ["dark", "light"]) { + for (const [side, list] of [["build", pair.build], ["proto", pair.proto], ["extra", pair.extra ?? []]]) { + for (const [n, [where, name, box]] of list.entries()) { + const file = path.join(ROOT[where], `${name}-${theme}.png`); + if (!fs.existsSync(file)) throw new Error(`${file} is missing`); + const data = `data:image/png;base64,${fs.readFileSync(file).toString("base64")}`; + const jpeg = await page.evaluate(async ({ data, box, widest }) => { + const image = new Image(); + image.src = data; + await image.decode(); + const [x, y, w, h] = box ?? [0, 0, image.naturalWidth, image.naturalHeight]; + const cw = Math.min(w, image.naturalWidth - x); + const ch = Math.min(h, image.naturalHeight - y); + const scale = Math.min(1, widest / cw); + const canvas = document.createElement("canvas"); + canvas.width = Math.round(cw * scale); + canvas.height = Math.round(ch * scale); + const context = canvas.getContext("2d"); + context.imageSmoothingQuality = "high"; + context.drawImage(image, x, y, cw, ch, 0, 0, canvas.width, canvas.height); + return { url: canvas.toDataURL("image/jpeg", 0.82), width: Math.round(cw / 2) }; + }, { data, box, widest: WIDEST }); + const out = `${pair.id}-${side}-${n}-${theme}.jpg`; + fs.writeFileSync(path.join(OUT, out), Buffer.from(jpeg.url.split(",")[1], "base64")); + index.push([out, jpeg.width]); + } + } + } +} +await browser.close(); +const ident = (name) => `p_${name.replace(/\.jpg$/, "").replace(/-/g, "_")}`; +fs.writeFileSync(path.join(OUT, "index.ts"), `// Written by tools/review/round68-pairs.mjs: the owner's-eye pictures of round 68, this build's beside the prototype's, each with the width it is drawn at.\n${index.map(([name]) => `import ${ident(name)} from "./${name}";`).join("\n")}\n\nexport const PICTURES: Record = {\n${index.map(([name, width]) => ` "${name.replace(/\.jpg$/, "")}": { src: ${ident(name)}, width: ${width} },`).join("\n")}\n};\n`); +process.stdout.write(`${index.length} pictures in ${path.relative(process.cwd(), OUT)}\n`); diff --git a/tools/review/round68.tsx b/tools/review/round68.tsx new file mode 100644 index 00000000..c3ba6a26 --- /dev/null +++ b/tools/review/round68.tsx @@ -0,0 +1,329 @@ +// Round 68: versions, changelogs and release notes (DECISIONS 320, revised by 321; the owner's answers in 308, 315 and 318). A heavy council round on the owner's +// standard and his answers to Opus's prototype, checked by Astra and decided by Fable, who revised eight objections after the final positions. Built by Opus +// from the decision; the implementation has not been reviewed. Every fact on these pages is made up: a package ("Slate") and a product ("Harbor"), their +// versions, dates, pull requests, tickets, authors and commits, built by running tools/changelog over two invented histories (tools/changelog/fixtures). +// Nothing here is Basalt's or CIMIP's history, and nothing publishes a version. + +import * as React from "react"; + +import { + AppHeader, + AppShell, + HomeGlyph, + Nav, + NavItem, + PaneLayout, + ReleaseIndex, + ReleaseNotes, + SearchGlyph, + SettingsGlyph, + SiteFooter, + SitePage, + TabBar, + TabBarItem, + TabBarMore, + VersionLink, +} from "../../packages/react/src/index"; +import type { ReleaseRecord } from "../../packages/react/src/index"; +import harborCandidate from "../changelog/fixtures/harbor/releases-candidate.json"; +import harborData from "../changelog/fixtures/harbor/releases.json"; +import slateData from "../changelog/fixtures/slate/releases.json"; +import { PICTURES } from "./assets/round-68/index"; +import type { Round } from "./rounds"; + +const HARBOR = harborData as unknown as ReleaseRecord[]; +/** Harbor before 2.0.0 shipped: its two candidates drawn, the session on 2.0.0-rc.2. */ +const HARBOR_CANDIDATE = harborCandidate as unknown as ReleaseRecord[]; +const SLATE = slateData as unknown as ReleaseRecord[]; +/** What a running Harbor build says of itself (made up): Build details, never read from a release's record. */ +const COMMITS: Record = { "1.4.0": "9f3c1e2a7d04", "1.4.2": "c07a51e9b3d2", "2.0.0-rc.2": "4b1d0e7f2a96" }; +const buildOf = (running: string) => [{ label: "Build", value: `${running}+${COMMITS[running]!.slice(0, 7)}`, mono: true }, { label: "Commit", value: COMMITS[running]!, mono: true }, { label: "Basalt", value: "0.2.0", mono: true }]; +const kindOf = (state: string) => state.replace(/-(reduced-motion|forced-colours|more-contrast)$/, ""); + +/** After the page has drawn, press what a state opens: a fold, a source line, More. */ +function usePress(selectors: string[]) { + React.useEffect(() => { + const timer = window.setTimeout(() => { + for (const selector of selectors) for (const el of Array.from(document.querySelectorAll(selector))) el.click(); + }, 120); + return () => window.clearTimeout(timer); + }, [selectors.join("|")]); +} + +// ---- a product: Harbor's app shell, the version at its foot, the release notes as its page ---- + +function Harbor({ state, page = "notes" }: { state: string; page?: "home" | "notes" }) { + const kind = kindOf(state); + const candidate = kind.startsWith("candidate") || kind === "pre-release"; + const running = kind === "between" ? "1.4.2" : candidate ? "2.0.0-rc.2" : "1.4.0"; + const date = kind === "between" ? "2026-12-09" : candidate ? "2026-12-03" : "2026-11-23"; + const releases = kind === "pre-release" ? HARBOR_CANDIDATE : HARBOR; + const notes = page === "notes"; + const press: string[] = []; + if (kind === "all") press.push('[id="v1.4.0"] .basalt-accordion-trigger:not([data-panel-open])'); + if (kind === "build") press.push('[id="v1.4.0"] .basalt-release-build .basalt-accordion-trigger:not([data-panel-open])'); + if (kind === "other") press.push('[id="v1.3.0"] .basalt-accordion-trigger:not([data-panel-open])'); + if (kind === "pre-release") press.push('[id="v2.0.0-rc.2"] .basalt-accordion-trigger:not([data-panel-open])'); + if (kind.endsWith("more")) press.push(".basalt-tabbar-more"); + usePress(press); + React.useEffect(() => { + const at = kind === "other" ? "v1.3.0" : kind === "all" ? "v1.4.0" : kind === "build" ? "v1.4.0" : null; + if (at) window.setTimeout(() => { const el = document.getElementById(at); el?.querySelector(kind === "build" ? ".basalt-release-build" : ".basalt-release-head")?.scrollIntoView({ block: kind === "build" ? "center" : "start" }); }, 400); + }, [kind]); + // The "hover" state rests a real pointer on the version in the rail (the attribute is a prop, so the rail's tooltip, which arrives on demand, keeps it). + const version = ; + return ( + Harbor} + brandMark={H} + brandLabel="Harbor home" + sidebar={} + account={} + version={version} + header={} + tabBar={( + + Home + Incidents + Settings + + )} + > + {notes ? ( + + ) : ( +

Two incidents are open. The version at the sidebar's foot is at rest here: another page is current.

+ )} +
+ ); +} + +// ---- a package: Slate's changelog on a site page, the versions beside it, the version in the footer ---- + +function Slate({ state }: { state: string }) { + const kind = kindOf(state); + const press: string[] = []; + if (kind === "sources") press.push('[id="pr41-1"] .basalt-release-source'); + if (kind === "sources-none") press.push('[id="pr42-1"] .basalt-release-source'); + if (kind === "versions") press.push(".basalt-release-index[data-form=\"fold\"] .basalt-accordion-trigger"); + usePress(press); + React.useEffect(() => { + const at = kind === "sources" ? "pr41-1" : kind === "sources-none" ? "pr42-1" : kind === "action" ? "v0.2.0__action" : kind === "footer" ? "slate-footer" : null; + if (at) window.setTimeout(() => document.getElementById(at)?.scrollIntoView({ block: kind === "footer" ? "end" : "start" }), kind.startsWith("sources") ? 0 : 200); + }, [kind]); + const arrived = kind === "arrived" ? "pr49-1" : kind === "release-arrived" ? "v0.2.0" : null; + return ( + +
+

Changelog

+

Every version of @example/slate and @example/slate-tokens. The two packages share one version number.

+

To see the version you have installed, run npm ls @example/slate.

+ } paneLabel="Versions"> + + + +
+ Slate} note="Slate is a made-up design system for these pictures." legal="© 2026 Example" version={} /> +
+ ); +} + +// ---- for the owner's eye: each item, this build's pictures beside the prototype's (tools/review/round68-pairs.mjs writes them) ---- + +const ITEMS: Array<{ id: string; title: string; words: string; extra?: string; noProto?: string }> = [ + { id: "1", title: "1. The foot's line", words: "\"Version 1.4.0 · Nov 23, 2026\" in the interface's own type (12/16 Geist) and secondary ink, at rest (Home current), and current on the release notes (primary, the number at 600). The prototype's B was small mono in the quietest ink, without a date. Below: the decision's three ways (A the number in mono, B plain, C with the word, decided), with a candidate and a canary.", extra: "The three ways (decision proofs, foot-options)" }, + { id: "2", title: "2. The rail", words: "720 to 1023: the number alone, centred, its whole line in its name and its tooltip; a release candidate fits.", noProto: "The prototype drew nothing in the rail." }, + { id: "3", title: "3. More's last row", words: "Under 720 the version is More's last row, under a divider, 44 tall, at 13/18, at rest and current." }, + { id: "4", title: "4. Nothing marks a release as new", words: "No dot, no badge, no read state, no \"What's new\" item. The prototype marked the sidebar, the settings button and its menu until the release was seen." }, + { id: "5", title: "5. Deprecated and Removed before Added", words: "Action needed, Security, Deprecated, Removed, Added, Changed, Fixed. In the prototype a 31-line Added stood above the deprecation." }, + { id: "6", title: "6. One set of section names", words: "A product's list uses Added, Changed and Fixed, as a package's does, inside one fold with the summary." }, + { id: "7", title: "7. No area filter", words: "The first screen starts with the first release. In the prototype the filter took the first screen and could hide every breaking change." }, + { id: "8", title: "8. 0.x", words: "In 0.x the minor is the breaking number: Slate 0.2.0 holds four breaking changes and is a minor from 0.1.0; a fix the same day is 0.2.1.", noProto: "Words are enough for the rule." }, + { id: "9", title: "9. Entries are Basalt's own files, not changesets", words: "One file per change in .changes/, with its type, area, pull request, tickets, bump, action and author. A changeset's head maps packages to bumps and has no field for a type, tickets, action or a permanent id.", noProto: "Words are enough." }, + { id: "10", title: "10. The source line underlined", words: "\"#41 · SL-112 · PRJ-88\" is the quiet text button Basalt already has, beside the words from 640 of the release's width and under them on a phone. The prototype's was bare tertiary text." }, + { id: "11", title: "11. No Decision row, install command, \"How it was made\" or About sheet", words: "Sources holds the pull request, the tickets, the commit and the author when there is one; nothing else." }, + { id: "12", title: "12. Author only when someone claimed the words", words: "#41 (Sam Rivera wrote it) has an Author row; #42 (nobody has claimed it) has none." }, + { id: "13", title: "13. Build details on \"Your version\"", words: "On the release this session runs, from the running build; above the first release when the running build is between two releases." }, +]; + +function useTheme() { + const read = () => (typeof document === "undefined" ? "dark" : document.documentElement.getAttribute("data-theme") === "light" ? "light" : document.documentElement.getAttribute("data-theme") === "dark" ? "dark" : matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark"); + return React.useSyncExternalStore((change) => { const watch = new MutationObserver(change); watch.observe(document.documentElement, { attributes: true, attributeFilter: ["data-theme", "class"] }); return () => watch.disconnect(); }, read, () => "dark"); +} + +/** The pictures of one side of an item, each at its own size (never scaled to a column), or null. */ +function Pictures({ id, side, theme, label }: { id: string; side: string; theme: string; label: string }) { + const list = Object.keys(PICTURES).filter((key) => key.startsWith(`${id}-${side}-`) && key.endsWith(`-${theme}`)).sort(); + if (!list.length) return null; + return ( +
+ {list.map((key) => {`${label},)} +
+ ); +} + +/** The widest picture of one side of an item, in CSS pixels. */ +const widest = (id: string, side: string, theme: string) => Math.max(0, ...Object.keys(PICTURES).filter((key) => key.startsWith(`${id}-${side}-`) && key.endsWith(`-${theme}`)).map((key) => PICTURES[key]!.width)); + +/** + * One item: its words, then this build's pictures beside the prototype's. Each picture is drawn at its own size, so a pair is at one scale; the two + * sides stand side by side where both fit the stage, and one above the other where they do not (a side is as wide as its widest picture). + */ +function Item({ item, theme }: { item: (typeof ITEMS)[number]; theme: string }) { + const label = { margin: "0 0 8px", fontSize: 13, lineHeight: "18px", fontWeight: 500, color: "var(--basalt-text-secondary)" } as const; + const side = (name: string) => ({ flex: "0 1 auto", width: Math.max(widest(item.id, name, theme), 240), maxWidth: "100%", minWidth: 0 }); + return ( +
+
+

{item.title}

+

{item.words}

+
+
+

This build

{item.id === "9" ?

Words are enough.

: }
+

The prototype

{item.noProto ?

{item.noProto}

: }
+
+ {item.extra ?

{item.extra}

: null} +
+ ); +} + +/** The step's default view draws all thirteen items down the page; a state "item-N" draws item N alone (the shot tool's view of it). */ +function OwnersEye({ state }: { state: string }) { + const theme = useTheme(); + const items = state.startsWith("item-") ? ITEMS.filter((candidate) => candidate.id === state.slice(5)) : ITEMS; + return ( +
+ {items.map((item) => )} +
+ ); +} + +const COMMON = [ + "Decided by the council (DECISIONS 320, revised by 321 after the final positions; the owner's answers are 308, 315 and 318). The owner sees this PR before it merges; the implementation has not been reviewed.", + "Every fact is made up: Slate (a package) and Harbor (a product), their versions, dates, pull requests, tickets, authors and commits, written by running tools/changelog over two invented histories. Nothing publishes a version of Basalt or CIMIP.", +]; + +const WIDE = [1440, 820, 390]; + +export const ROUND_68: Round = { + id: "68", + title: "Versions, changelogs and release notes (DECISIONS 320, 321)", + reviewed: false, + summary: + "The version with its ship date at the sidebar's foot, in the rail, as More's last row and in a site's footer (VersionLink); a package's changelog and a product's release notes from one record (ReleaseNotes, ReleaseIndex), with Action needed, the audience paragraphs, the folds, the source line and its Sources panel, Build details on the running release, and arriving at a release or an entry. Built by Opus from the council's decision (DECISIONS 320, revised by 321); the implementation has not been reviewed. Shot in both themes at 1440, 820 and 390 (the phone with touch). Every fact on the pages is made up.", + steps: [ + { + id: "foot", + name: "The version at the foot", + intro: "A product's shell: the version this session runs, with its ship date, as one link to the release notes at that version. At rest on Home (another page is current), and current on the release notes (the \"current\" shots).", + decisions: [ + ...COMMON, + "For the owner's eye 1: \"Version 1.4.0 · Nov 23, 2026\" in the interface's own type (12/16 Geist, tabular) and secondary ink, where the prototype's option B was small mono in the quietest ink and had no date. In mono the line fits 1.4.0 with 3px to spare and wraps at 1.4.10 or any pre-release; mono's digits also read \"1 . 4 . 0\". With \"What's new\" gone this is the only way to the notes, so it steps up one ink.", + "For the owner's eye 2: in the rail (720 to 1023) the number alone, centred; the label and date are in its name and its tooltip (the \"hover@820\" shot). A release candidate breaks before its hyphen (the \"candidate\" shots).", + "For the owner's eye 3: under 720 it is More's last row, under a divider, 44 tall, at 13/18 (the \"more@390\" shot). An app with no More draws it on its account or settings page.", + "For the owner's eye 4: nothing marks a release as new. No dot, no badge, no read state, no \"What's new\" item. A release that asks something of people says so where they work, by the product's choice.", + "At rest (the default shots, Home current): secondary ink at 400. On the release notes it is the current page (the \"current\" shots): primary ink and the number at 600, its width reserved, so nothing moves.", + ], + tryIt: [ + "Narrow the window through 1023 and 720: the foot's line, the rail's number with its tooltip, then More's last row.", + "Tab to the version: one link, named \"Version 1.4.0, Nov 23, 2026, release notes\".", + ], + states: ["more@390", "hover@820", "current@1440", "current@820", "current-more@390", "candidate@1440", "candidate@820"], + widths: WIDE, + scales: [2], + bleed: true, + touch: true, + height: 900, + demo: ({ state }) => , + }, + { + id: "release-notes", + name: "A product's release notes", + intro: "Harbor's release notes: a headline, Action needed when a release asks something of its people, a paragraph for each audience, then one fold holding the summary and a line per change.", + decisions: [ + ...COMMON, + "The header: the number and the date first, in Geist (the foot's case), then the headline, then the counts computed from the list and the outline badges \"Pre-release\" and \"Your version\". One heading holds them, so a reader moving by headings hears \"1.4.0, Nov 23, 2026: A monitor can open an incident room\".", + "The fold is named for what it opens: \"All changes 5\" when every entry is inside it, \"Other changes 1\" under Action needed (Harbor 1.3.0, the \"other\" shots). The header keeps the release's totals.", + "For the owner's eye 6: a product's list uses the package's section names (Added, Changed, Fixed), not \"Improvements\" and \"Fixes\"; the paragraphs above carry the product's voice.", + "For the owner's eye 13: Build details is on \"Your version\" alone and shows the running build (1.4.0+9f3c1e2, its commit, the Basalt it was built on), never a row frozen with a release: two builds can share a version. A build between two releases puts it above the first release (the \"between\" shot).", + "2.0.0 shipped after two candidates: they are no longer drawn, and their addresses open 2.0.0. 1.4.1, a fix to the 1.x line shipped after 2.0.0, stands under it by SemVer precedence, not by date. The \"pre-release\" shots are Harbor before 2.0.0 shipped, the session on 2.0.0-rc.2: \"Pre-release\" and \"Your version\" on one release, each the neutral outline badge.", + ], + tryIt: [ + "Open \"All changes\": the summary, then Added, Changed and Fixed, each with its source line.", + "Press a source line: Sources, with the pull request, the ticket, the commit, and the author where the entry has one.", + "Find \"lobby\" with the browser's find: the fold opens.", + ], + states: ["all", "other", "build@1440", "build@390", "between@1440", "pre-release@1440", "pre-release@390", "arrived", "forced-colours@1440"], + widths: WIDE, + scales: [2], + bleed: true, + touch: true, + height: 900, + demo: ({ state }) => , + }, + { + id: "changelog", + name: "A package's changelog", + intro: "Slate's changelog: every version, the list open, Unreleased on top, the versions beside it (a fold above it on a narrow page), and the version in the footer.", + decisions: [ + ...COMMON, + "For the owner's eye 5: Deprecated and Removed come before Added, in every output (page, CHANGELOG.md, GitHub Release): Action needed, Security, Deprecated, Removed, Added, Changed, Fixed. His order had them after Changed, where a long Added buried a deprecation.", + "For the owner's eye 7: no area filter. Every entry carries its area as its first word, Added and Changed never fold, and the browser's find opens Fixed, so \"Tokens:\" in find-in-page is the filter.", + "For the owner's eye 8: in 0.x the minor is the breaking number and the patch everything else; the tool refuses a version that understates its entries. Slate 0.2.0 has four breaking changes, so it is a minor from 0.1.0; 0.2.1 the same day is a fix.", + "For the owner's eye 10: the source line is underlined (the quiet text button Basalt already has), where the prototype's was bare tertiary text: \"#41 · SL-112 · PRJ-88\", at most two tickets then \"3 more\". From 640 of the release's own width it stands beside the words in one column, so the words keep one measure down a list; under it, it is its own line.", + "Only Fixed folds, past 3 in a release of more than 10. Action needed opens with \"Before upgrading from 0.1.0, check these 4 changes.\", computed.", + ], + tryIt: [ + "Press \"4 need action\": the page moves to the callout.", + "Open a version from the Versions list: its address is #v0.2.1, and Back returns.", + "Narrow the page under 920: the Versions pane becomes a fold above the first release.", + ], + states: ["action", "versions@390", "footer", "forced-colours@1440", "more-contrast@1440"], + widths: WIDE, + scales: [2], + bleed: true, + touch: true, + height: 900, + demo: ({ state }) => , + }, + { + id: "sources", + name: "Sources and arriving", + intro: "The source line opens Sources; an entry's or a release's address is permanent, and the one a link opens is marked as the stream marks the entry you came to.", + decisions: [ + ...COMMON, + "For the owner's eye 11: no \"Decision\" row, no install command, no \"How it was made\", no About sheet, no \"Built by\" or \"Code review\".", + "For the owner's eye 12: Author is shown only when someone wrote the entry's words or said they take authorship of them (\"sources\": Sam Rivera on Slate's #41); an entry nobody has claimed has no Author row (\"sources-none\"). Most of Basalt's entries are drafted by agents, so most will show none until the owner says so for an entry.", + "For the owner's eye 9: entries are Basalt's own files (.changes/.md), not changesets: a changeset's head maps packages to bumps and has no field for a type, tickets, action or a permanent id. Its ticket ids are read from the entry's own tickets field and nowhere else.", + "Arriving at #pr49-1 opens the closed Fixed fold and marks the entry: the plate and \"Linked\", until the reader presses or types (\"arrived\"). A release takes the plate on its header (\"release-arrived\"). In forced colours the plate goes and the word stays.", + ], + tryIt: [ + "Press a source line, then Tab: the panel ends in Copy link to this change; Escape returns to the line.", + "Open the page at #pr49-1, then press anywhere: the mark goes and focus stays.", + ], + states: ["sources", "sources-none", "arrived", "release-arrived", "arrived-forced-colours@1440"], + widths: [1440, 390], + scales: [2], + bleed: true, + touch: true, + height: 900, + demo: ({ state }) => , + }, + { + id: "owners-eye", + name: "For the owner's eye", + intro: "The thirteen items the decision puts in front of the owner, each as this build's pictures beside the prototype's he answered, in the walkthrough's theme, all thirteen down the page. Each picture is at its own size; a pair too wide to stand side by side stands one above the other.", + decisions: [ + ...COMMON, + "The pictures are cropped from this round's own shots and from the prototype's (tools/review/round68-pairs.mjs). Each pair is at one scale.", + ], + tryIt: ["Switch the theme: every picture has its pair in the other."], + states: ITEMS.map((item) => `item-${item.id}`), + widths: [1440], + scales: [2], + bleed: true, + height: 1400, + demo: ({ state }) => , + }, + ], +}; diff --git a/tools/review/rounds.tsx b/tools/review/rounds.tsx index 92b487e9..544f0e2f 100644 --- a/tools/review/rounds.tsx +++ b/tools/review/rounds.tsx @@ -132,6 +132,7 @@ import { ROUND_63 } from "./round63"; import { ROUND_64 } from "./round64"; import { ROUND_65 } from "./round65"; import { ROUND_67 } from "./round67"; +import { ROUND_68 } from "./round68"; export interface Step { id: string; @@ -704,3 +705,4 @@ ROUNDS.push(ROUND_64); ROUNDS.push(ROUND_65); // Round 66 is left for diagram batch B (claude/diagrams-b), building beside this one. ROUNDS.push(ROUND_67); +ROUNDS.push(ROUND_68);