Design system 1/3: blockr.ui's tokens, dark mode, card layout - #482
Conversation
The block header, corner radii, the sidebar chrome, the dockview shell and the remaining dock colours read blockr.ui's tokens instead of fixed values, so a theme restyles the dock.
The board options offer blockr.core's dark-mode switch; the tokens carry the dark scheme.
The block header and its rename field follow the design system, toggles that are on get the lighter accent, the subtitle goes, and the dock's chrome takes its tooltips (the light card) from blockr.ui's Blockr.tooltip.
A thin x on the tab close button, the controls moved up under the header, a single rule between controls and preview, and a 42px block mark.
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
59eba3c to
0be3b44
Compare
The feat/design-system-2 branch went with blockr.ui#47, and blockr.ui keeps its version at 0.0.1 between releases, so the 0.0.1.9041 floor could no longer be met.
A block without inputs keeps the default "inputs" among its visible sections, so its card drew the rule above the preview with no controls over it.
The card refuses a name of spaces like an empty one, but the field reports every keystroke, and req() only stopped the empty string: the board took the blank name, and the tab went blank, until the card restored it on blur.
On a locked board a double-click still opened the field, and the card showed a name the board had refused. The title now carries the gesture only when unlocked, and with it data-blockr-editable, which gives it blockr.ui's text cursor and "Double-click to edit" tooltip; the hover wash follows the same attribute.
The dot's blockr.ui tokens and the hollow waiting ring lived in block_status_dot_attrs() alone, which re-derived the status to pick them: a stale block with errors from its last run drew a red dot labelled "Inputs changed since this block last ran", while block_status_badge() and the DAG kept it grey. block_status_style() now names the tokens and the shape next to the literals, so the dot paints from the badge and the DAG can draw the same one.
At rest the "..." and a section toggle that is off took border-strong, which the dark scheme keeps faint for lines: 1.38:1 on the card, where the icon all but vanished. They now take text-disabled at rest and text-muted on hover, the pair a regular tool takes one step up.
Core ties thematic to the light/dark switch only when a board carries both options, so plots stayed white on the dark card. The switch comes from core and stays off by default: thematic has its own rough edges, but a user who turns it on gets plots in the board's colours.
The comments still spoke of plain values, a header with no inline style, and a white-ringed dot at the lower right placed to match the DAG's.
|
I pushed eight commits on top of yours, @christophsax, from reviewing this against blockr.ui main:
Merging this into #483 conflicts in three places. In One heads-up, with nothing to change here: with |
|
I also merged main into this branch: BristolMyersSquibb/blockr.core#337 retired the per-block |
The rule above the preview needed to know whether controls are open, which a data-open attribute written from R and kept current by block-sections.js told it. The panels' hidden accordion buttons already say it, and Bootstrap marks one collapsed as its panel starts to close, so :has() reads the same state at the same moment, and a card without controls needs no special case.
bsicons is already imported, and bs_icon("pin-angle") draws the same
path the function carried by hand, character for character.
The four blue aliases named blockr.ui's blue ramp, which a theme that changes the accent does not touch, so the focus rings, the selected card and the add button of the block browser, link and stack menus would have stayed blue. They now name the accent ramp, which points at the same blues by default.
History (what the markup used to be) and restatements of the rule below them go, and so does a comment claiming a weight its rule never set. The ones that explain a constraint stay, shorter. The two .blockr-block-mark rules become one.
Every card carried its own inline copy of the rename handler, about 40 lines of jQuery in an R string, plus an inline ondblclick. One handler on the document now serves all cards, whenever they were inserted, and starts from the double-click either block menu sends. An e2e test covers refusing an empty name, Escape, and a commit reaching the board.
The header's menu button and section toggles overrode Bootstrap's button properties with 12 `!important`s. They now set the `--bs-btn-*` variables Bootstrap's own state rules read. Scoped to the header's actions, the rules tie blockr.ui's `.btn-light` rule, which sets the same variables, and win on the source order the board-ui test pins. Hover swaps the rest pair that every state reads, so an open menu, a focused tool and a toggle that is on keep their look off the pointer and take the hover look under it, as before. Measured on every state (rest, hover, pressed, open, open under the pointer, keyboard focus; a toggle on and off, each under the pointer, and focused), the colours, backgrounds, outlines, sizes, padding and radius match the old rules exactly. The only computed difference is a zero-width border's style and colour, which draw nothing. The menu button drops its own focus ring, which repeated blockr.ui's `.btn:focus-visible` rule, and the transition now comes from blockr.ui's `.btn` rule.
The header's tools rested in text-disabled, 2.5:1 on white: under the 3:1 an active control's icon needs (WCAG 1.4.11), and the colour blockr.ui keeps for disabled controls. They now take the colours of blockr.ui's other tools, text-muted at rest and text-default on the hover wash, as BristolMyersSquibb/blockr.ui#61 now specifies.
|
Two follow-ups to my earlier comment, @christophsax, both for the 3:1 WCAG asks of icons and state indicators (1.4.11):
|
|
This branch conflicts with #491, now in the merge queue, in five files, @christophsax. That PR drops the
Outside those hunks nothing refers to |
|
We'll work through these ourselves once #491 is in, @christophsax, and ping you if we need anything. |
|
Done on this branch: the unset and waiting literals in |
The badge docs keep this branch's wording without the `NA` return, and the style test keeps the token assertions with #491's `unevaluated` loop.
The status spec's literal for the unset and waiting dots is the light value of border-warning, which BristolMyersSquibb/blockr.ui#61 moves from amber-500 to amber-600 (#d97706), the first amber at 3:1 on white. The DAG's canvas draws the literal, and the token test holds it to the token, so this goes up once that PR has merged.
Escape and Enter end the edit by blurring the field, and headless Chrome fires no blur in a tab that lacks the focus, so the test failed whenever another tab had been brought up after its own: Escape restored the name but left the field open. Focus emulation makes the tab behave as focused. With a second tab in front, the test fails without it and passes with it.
Not ready to merge: this needs blockr.ui #46 and #47 merged first. Until then
DESCRIPTIONinstalls blockr.ui fromfeat/design-system-2; thatRemotesline goes once #47 is on main.First of three stacked PRs that move the dock onto blockr.ui's design system. The next two are #483 (menus and the options sidebar) and #484 (simplified mode).
The dock reads its colours, radii, surfaces and type from blockr.ui's tokens, so a board follows blockr.ui's dark scheme.
dock_board_options()gets a light/dark switch, light by default. The block header drops its subtitle: a mark in the block's category colour carries the status dot, and the block type with its package is the mark's tooltip. The dock's chrome uses blockr.ui's tooltip instead of the native one.The simplified mode in #484 is a requirement still being worked out: #489.