Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .agent/skills/basalt-html/parts/runs.css

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion packages/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,19 @@ None of these changes how anything looks: each is an existing look or rule, expo
| `SkipLink` | The first thing on a page: a link past the bar and the navigation to the content. `<SkipLink target="main" />` renders `<a href="#main">Skip to content</a>`; the words are `children`, so an app in another language replaces them, and any anchor prop passes through (`target` may carry its `#`). It is unseen until it has focus. With a sticky bar (`SiteHeader`, `AppHeader` or your own `.basalt-sticky-bar`) it then hangs under the bar, space-2 below its line, on the brand's start edge at every width, so it covers nothing in the bar; without one it sits at the page's top start (space-2 in). **How it finds the bar:** when it takes focus it reads the real bottom edge of the first element matching `.basalt-site-header, .basalt-app-header, .basalt-sticky-bar` and sits space-2 below it, and reads it again on scroll and resize while it holds focus, so a bar that is not at the top of the viewport (a notice above it) is still cleared; with no script or no bar it is where the stylesheet puts it, under a bar at the top. It floats like a tooltip (level 3, the rim, `shadow-overlay`, radius 8) on the toast layer; 44px tall on a coarse pointer; not drawn in print. It is the HTML skill's `.skip-link`, drawn with the same tokens. **The app places it itself, as the first element of the page** (before the bar, so it is the first tab stop): `AppShell` and `SiteHeader` render none. Give the target `tabIndex={-1}` so following the link moves focus to it (`AppShell`: `mainProps={{ id: "main", tabIndex: -1 }}`); a target that cannot take focus starts the next Tab there instead. |
| `TimeChart`'s `lit`, `headline`, `headlineFormat`, `trend`, `plotSize`, `compact`, `lane`, `onDayActivate`, `activateHint`; `trailingMean(values, { window, min })` | The lit figure (DECISIONS 153; the implementation hasn't been reviewed). `lit`: solid marks take one vertical gradient in three neutral stops, a line one stroke in the top stop. `headline`: the frame with the picked day's number as the headline (one series), the unit beside it, one context line, no live region; its number is written in the chart's `locale` unless `headlineFormat` writes it. `trend`: `true` (7 days) or a window: the readings as small dots and their trailing mean as one straight line that breaks at a gap, one head dot, the number the trend. `plotSize="sm"` is the 96px plot. `compact` (with `kind="bar"` and `plotSize="sm"`) is the short bar plot (DECISIONS 160, the owner's choice for vote 10): no gridlines, no y labels, no gutter, the plot the figure's width; the legend, keys, table and caption stay; ignored for a line, a 240px plot or a second series. `lane` and `onDayActivate` are what `PhaseChart` is built from. `trailingMean` returns `Array<number \| null>` (no NaN for no data). |
| `PhaseChart` | A trend over weeks with a lane of one choice a week (seven days a choice; lanes of other lengths are in the backlog) and the open week's plate: `name`, `values`, `calls` (`{ word, changed?, text }`), `week`, `onWeekChange`, plus the words, all required and each a whole string, since the chart ships no word for the period: `laneLabel` ("Choose a check-in"), `previousLabel` and `nextLabel` ("Previous check-in", "Next check-in"), `callName(index)` ("Check-in 31", "Nov 3 check-in"), `statusLine(index, call)` (what the status line says of the open choice) and `activateHint` ("opens its check-in", Enter's hint in the legend), plus a `TimeChart`'s `title`, `days`, `format`, `summary`. A press on a day, or Enter, opens its week; on a phone the lane is marks with previous and next controls. |
| `ArchitectureDiagram`, `FlowchartDiagram`, `DataFlowDiagram`, `SequenceDiagram`, `SchemaDiagram` | Diagrams (DECISIONS 281 and 282; the implementation hasn't been reviewed): boxes and the lines between them, monochrome, one focal node inverted, three lines named by their look (`main`, `plain`, `dashed`) whose meaning the `legend` gives. Each takes the figure's `title`, `heading`, `source`, required `summary` and `legend`, and its own data: `nodes` placed by `col` and `row` (an architecture's `groups`, a flowchart's `shape`, a data flow's `lanes`), `edges` by node id (`fromSide`/`toSide` only to change the derived side), a sequence's `participants` and `steps`, a schema's `tables` with `references: "table.column"` on a foreign key. The array's order is the stacked order, the focus order and the list's. The drawn layout is used only where it fits; otherwise the figure is stacked, at most 480 wide. One tab stop, arrow keys between nodes, a trace on hover or keyboard focus, and "View as list". No layout engine, no dependency. |
| `ArchitectureDiagram`, `FlowchartDiagram`, `DataFlowDiagram`, `SequenceDiagram`, `SchemaDiagram` | Diagrams (DECISIONS 281 and 282; the implementation hasn't been reviewed): boxes and the lines between them, monochrome, one focal node inverted, three lines named by their look (`main`, `plain`, `dashed`) whose meaning the `legend` gives. Each takes the figure's `title`, `heading`, `source`, required `summary` and `legend`, and its own data: `nodes` placed by `col` and `row` (an architecture's `groups`, a flowchart's `shape`, a data flow's `lanes`), `edges` by node id (`fromSide`/`toSide` only to change the derived side), a sequence's `participants` and `steps`, a schema's `tables` with `references: "table.column"` on a foreign key. The array's order is the stacked order, the focus order and the list's. The drawn layout is used only where it fits; otherwise the figure is stacked, at most 480 wide. One tab stop, arrow keys between nodes, a trace on hover or keyboard focus, and "View as list". Automatic layout (`layout="auto"`, DECISIONS 306, 1.8; foundations, "Automatic layout") leaves `col` and `row` out: elkjs gives each card a column and a row, and nothing else of elk's is read. Place at build time with `placeDiagram` from `@srasyndicate/basalt/diagram-layout` and pass `placement`, and elkjs never reaches the browser; without `placement` it is loaded on demand. |
| `ChartGroup` | Charts stacked in one figure (`label` names it): the y gutter and the right margin are as wide as the widest chart's, so every plot starts and ends at the same x. Put the charts inside; each keeps its own title, legend, summary and table. |
| `ShareBar`, `shareOf(values)` | Parts of a whole as one bar: `parts` (`{ name, value }`), `size="sm"` (8px) or `"md"` (12px), `format(share, part)`. One ink, a 4px gap, each part's share (whole percents that add to 100) and name under it; a part that is more than nothing and rounds to 0 reads "<1%" (spoken "less than 1%"), and a part of nothing is left out. |
| `CoverageStrip`, `coverageWords(days)` | One cell a day (`{ date, recorded, why }`): `form="strip"` (slivers, 48px) or `"week"` (seven squares); the missing dates in words, built from the cells. |
| `MarksRow` | A row of marks in the form of the thing measured: `kind` `"columns"`, `"pills"` or `"blocks"`, `values` (`null` missing, `0` a rest day), `cap`, `label`, `height`. Drawn at rest. With a `label` it is an image whose description is its values in order (`format` writes each, `unrecordedLabel` is the word for a missing day); with none it is hidden. |
| `RangeMeter` | A reading against a plan range: `label`, `value`, `max`, `plan` `[low, high]`, `unit`. `role="meter"`; two ticks and a ringed marker from one scale. |
| `Reserve` | Room for words that change in place. `<Reserve show="saved" alternatives={{ idle: "Save", saving: "Saving…", saved: "Saved" }} />` draws every wording in one grid cell and shows the one `show` names, so the cell is as large as the largest and nothing beside it moves when the words do. The caller lists the wordings; nothing is worked out. The unseen ones are `aria-hidden` and `inert`, and `visibility: hidden`: out of the accessibility tree, not focusable, not selectable, not found by find-in-page. The wordings sit at the cell's start; `justify-items: end` on it (by `className`) puts a narrower one against the end. `alternativeClassNames` styles one wording by its key; `className` and any `span` prop pass through to the cell. A wording can be any node, so a state with an icon reserves the icon's room too. `Terminal` (its state words and its buttons) and `Meter` (its reading) are drawn with it. `MultiSelect`'s count keeps its own form (two CSS-generated sizers, no text in the DOM) because its group's description reads that element's text. |

**A linked build and elkjs.** A build that reaches Basalt through a linked folder or a workspace prints one esbuild warning, `equals-negative-zero`, from
`dist/diagram-elk.js`. That file is elkjs's own code, shipped unchanged, and the comparison is correct as written. An installed package
does not print it. To silence it, set `logOverride: { "equals-negative-zero": "silent" }` in the app's esbuild options; that silences the
same warning in the app's own code too.

**A page with its own sticky bar.** A page with `SiteHeader` or `AppHeader` gets `scrollbar-gutter: stable` and a `scroll-padding-top` of the bar plus `space-4` (`--basalt-sticky-offset` + `--basalt-space-4`: 72px with no inset), so an anchor or a focused control lands below the bar. A page that draws its own sticky bar gets the same by putting the class `basalt-sticky-bar` on it: `<header className="basalt-chrome basalt-sticky-bar">`. The offset is the one property, `--basalt-sticky-offset` (the bar's height plus the top safe area: 56 plus the inset by default); a bar of another height sets it on the root (`:root { --basalt-sticky-offset: calc(80px + env(safe-area-inset-top, 0px)); }`) and the landing follows, with the same step. The bar's own contents take a scroll margin as deep as that padding, so a Tab into the bar from a scrolled page holds the page still (the padding alone scrolls it): this applies to `SiteHeader`, `AppHeader` and `basalt-sticky-bar`. The app sidebar is not in that rule (it scrolls its own list), so its brand and first row still scroll the page a little when focused from a scrolled position.

## The phone and what is pinned
Expand Down
10 changes: 5 additions & 5 deletions packages/react/src/styles/components.css
Original file line number Diff line number Diff line change
Expand Up @@ -4397,12 +4397,12 @@
.basalt-run-stages .basalt-run-stage-meta { display: none; }
.basalt-run-stages .basalt-run-stage-line { grid-template-columns: var(--basalt-size-icon-sm) minmax(0, 1fr) auto; }
}
/* The connector: 1px of border-input on the marks' centre line, from space-1 under one mark to space-1 above the next, beside an open detail too. It
/* The connector: 1px of border-input, its end edge on the marks' centre line, from space-1 under one mark to space-1 above the next, beside an open detail too. It
never fills, breaks, moves or changes with a state: the mark and its word carry the state. A real border, so forced colours keep it. */
.basalt-run-stages > .basalt-run-stage:not(:last-child)::after {
content: "";
position: absolute;
inset-inline-start: round(down, calc(var(--basalt-size-icon-sm) / 2 - var(--basalt-size-hairline) / 2), var(--basalt-size-hairline));
inset-inline-start: calc(var(--basalt-size-icon-sm) / 2 - var(--basalt-size-hairline));
inset-block-start: calc(var(--basalt-space-2) + var(--basalt-text-sm-line-height) / 2 + var(--basalt-size-icon-sm) / 2 + var(--basalt-space-1));
inset-block-end: calc(-1 * (var(--basalt-space-2) + var(--basalt-text-sm-line-height) / 2 - var(--basalt-size-icon-sm) / 2 - var(--basalt-space-1)));
border-inline-start: var(--basalt-size-hairline) solid var(--basalt-border-input);
Expand Down Expand Up @@ -4460,7 +4460,7 @@
.basalt-run-rail:is([data-count="5"], [data-count="6"]) > .basalt-run-stage:not(:last-child)::after {
content: "";
position: absolute;
inset-inline-start: round(down, calc(var(--basalt-size-icon-sm) / 2 - var(--basalt-size-hairline) / 2), var(--basalt-size-hairline));
inset-inline-start: calc(var(--basalt-size-icon-sm) / 2 - var(--basalt-size-hairline));
inset-block-start: calc(var(--basalt-space-2) + var(--basalt-text-sm-line-height) / 2 + var(--basalt-size-icon-sm) / 2 + var(--basalt-space-1));
inset-block-end: calc(-1 * (var(--basalt-space-2) + var(--basalt-text-sm-line-height) / 2 - var(--basalt-size-icon-sm) / 2 - var(--basalt-space-1)));
border-inline-start: var(--basalt-size-hairline) solid var(--basalt-border-input);
Expand Down Expand Up @@ -4569,11 +4569,11 @@
end-aligned in its seat, and a step with no time ends its result on the same edge and holds no seat. */
.basalt-run-step-meta { display: block; justify-self: end; text-align: end; color: var(--basalt-text-tertiary); font-size: var(--basalt-text-xs-size); line-height: var(--basalt-text-sm-line-height); white-space: nowrap; font-variant-numeric: tabular-nums; }
.basalt-run-step-meta .basalt-run-timer { line-height: inherit; }
/* The connector, as the list's: between two full steps, beside a detail too, never a state. */
/* The connector, as the list's (its end edge on the marks' centre line): between two full steps, beside a detail too, never a state. */
.basalt-run-steps > .basalt-run-step:not(:last-child)::after {
content: "";
position: absolute;
inset-inline-start: round(down, calc(var(--basalt-size-icon-sm) / 2 - var(--basalt-size-hairline) / 2), var(--basalt-size-hairline));
inset-inline-start: calc(var(--basalt-size-icon-sm) / 2 - var(--basalt-size-hairline));
inset-block-start: calc(var(--basalt-space-2) + var(--basalt-text-sm-line-height) / 2 + var(--basalt-size-icon-sm) / 2 + var(--basalt-space-1));
inset-block-end: calc(-1 * (var(--basalt-space-2) + var(--basalt-text-sm-line-height) / 2 - var(--basalt-size-icon-sm) / 2 - var(--basalt-space-1)));
border-inline-start: var(--basalt-size-hairline) solid var(--basalt-border-input);
Expand Down
19 changes: 17 additions & 2 deletions packages/react/test/audit-fix-c3.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,31 @@ test("composition.d.ts does not write out every HTML attribute for Text and Head

// ---- A1-15: a consumer's build prints no warning, and the package loses nothing ----

test("an app built with esbuild, importing one component from dist, gets no warning", async () => {
// The one warning a consumer's build may print (DECISIONS 350): elkjs's own code, shipped unmodified (DECISIONS 306, 1.8 item 8.9); `x == -0` is
// `x == 0`; hidden for an installed package (esbuild does not print it for a file under node_modules). Only this id, from this file, at most once a build.
const ELK_WARNING = { id: "equals-negative-zero", file: "dist/diagram-elk.js" };
const isElkWarning = (warning) => warning.id === ELK_WARNING.id && (warning.location?.file ?? "").replaceAll("\\", "/").endsWith(ELK_WARNING.file);

test("an app built with esbuild, importing one component from dist, gets no warning but elkjs's one", async () => {
for (const name of ["Button", "Menu", "TimeChart", "CommandMenu"]) {
const result = await esbuild.build({
stdin: { contents: `import { ${name} } from "./dist/index.js"; console.log(${name});`, resolveDir: pkg, loader: "js" },
bundle: true, minify: true, format: "esm", splitting: true, outdir: path.join(pkg, ".bundle-check"), write: false, external: ["react", "react-dom", "react/jsx-runtime"], logLevel: "silent",
});
assert.deepEqual(result.warnings.map((warning) => `${warning.id}: ${warning.text}`), [], `${name}: a consumer's build warns`);
const elk = result.warnings.filter(isElkWarning);
assert.ok(elk.length <= 1, `${name}: elkjs's file warns ${elk.length} times, and only one is allowed`);
assert.deepEqual(result.warnings.filter((warning) => !isElkWarning(warning)).map((warning) => `${warning.id}: ${warning.text}`), [], `${name}: a consumer's build warns`);
}
});

test("the elkjs allowance is still needed: dist/diagram-elk.js bundled alone gives exactly that one warning (else remove the allowance)", async () => {
const result = await esbuild.build({
entryPoints: [path.join(dist, "diagram-elk.js")],
bundle: true, minify: true, format: "esm", write: false, logLevel: "silent",
});
assert.deepEqual(result.warnings.map((warning) => ({ id: warning.id, elk: isElkWarning(warning) })), [{ id: ELK_WARNING.id, elk: true }], "elkjs's file no longer warns as it did: take the allowance out of the test above");
});

test("dist has no bare import of one of its own chunks, every chunk is still imported by name, and every relative import resolves", () => {
const files = fs.readdirSync(dist).filter((f) => f.endsWith(".js"));
const bare = files.flatMap((file) => [...read(dist, file).matchAll(/^import "\.\/[^"]+";$/gm)].map((m) => `${file}: ${m[0]}`));
Expand Down
3 changes: 1 addition & 2 deletions packages/react/test/browser-floor.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const ALLOWED = {
"prefers-reduced-transparency": "The query is the opaque fallback for the sticky header; a browser that does not evaluate it (Safari, Firefox) keeps the smoked header. Text on the bar holds 4.5:1 over any backdrop, so this is comfort and not legibility (foundations, Browser support).",
"text-wrap: pretty": "A hint for the last line of a paragraph; a browser without it wraps as it always did.",
"field-sizing": "The Composer's field grows with its text (cimip-gaps-2, B3). Where CSS.supports(\"field-sizing\", \"content\") is false (Safari before 26.2, Firefox), composer.tsx measures the field's scrollHeight and sets its height within the same rows, so it grows there too (foundations, Writing to someone).",
"the round(), mod() and rem() functions": "The plain badge's dot margin (components.css, .basalt-badge[data-variant=\"plain\"] > .basalt-badge-dot), and the 1px connector's inline start in StageList, StageRail at five or six and RunTimeline (.basalt-run-stages, .basalt-run-rail, .basalt-run-steps: ::after). Chrome 123 and 124 drop the declaration, so the dot sits in its seat to the half pixel and not on whole pixels, and the connector, at `inset-inline-start: auto`, stands at the row's start edge and not on the marks' centre line, 7px from it. A fix changes a pixel, so it is the council's: found by this check, reported on the pull request that added it (the dot) and in the main-green report (the connector, #127).",
"the round(), mod() and rem() functions": "The plain badge's dot margin (components.css, .basalt-badge[data-variant=\"plain\"] > .basalt-badge-dot). Chrome 123 and 124 drop the declaration, so the dot sits in its seat to the half pixel and not on whole pixels. A fix changes a pixel, so it is the council's: found by this check, reported on the pull request that added it.",
"@starting-style": "The diagram viewer's opening motion (components.css, dialog.basalt-dialog.basalt-diagram-viewer, a native modal dialog: DECISIONS 310). Firefox before 129 opens it with no animation, and it still opens.",
"transition-behavior (allow-discrete)": "The diagram viewer's closing motion, which transitions the dialog's and its backdrop's `display` and `overlay` (Firefox before 129). Without it the viewer closes at once, with no animation, and it still closes.",
};
Expand All @@ -68,7 +68,6 @@ const SKILL_ALLOWED = {
"text-wrap: pretty": ALLOWED["text-wrap: pretty"],
"@starting-style": "The opening motion of the dialog, the sheet, the popover and the select's list (Firefox before 129). Without it they appear with no animation, and they still open.",
"transition-behavior (allow-discrete)": "The closing motion of the dialog, the popover and the select's list, which transitions `display` and `overlay` (Firefox before 129). Without it they close at once, with no animation, and they still close.",
"the round(), mod() and rem() functions": "The 1px connector's inline start in the runs module (runs.css, `--_cx` on .run-stages, .run-rail and .run-steps). Chrome 123 and 124 do not know round(), so the custom property is invalid where it is used and the connector, at `inset-inline-start: auto`, stands at the row's start edge and not on the marks' centre line, 7px from it. A fix changes a pixel, so it is the council's: found by this check, reported in the main-green report (#127).",
};

const sheets = () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/react/test/export-sizes.json
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@
"gzip": 315272
},
"styles": {
"bytes": 460324,
"gzip": 59128
"bytes": 460192,
"gzip": 59109
}
}
Loading
Loading