desk: the floating card, its groups, the segmented control, the desk colour
A new part, package desk (func CSS() []byte), beside chrome and menu: the desk tokens (--estilo-desk, --estilo-desk-ink), [estilo-card] (the floating surface; the app places it), [estilo-inspector] with its labelled groups, and [estilo-seg] / [estilo-seg-item] for buttons and for labels wrapping radios. Values are Docs' own, copied from Docs show.html at b45b7b2; Docs is unchanged and moves onto the part later. In forced colours a selected segment and a focused one keep separate marks, and a segment's rounded ends are the first and last segment, so a fieldset's legend does not square the first one. Slides' editor-tidy is the first user. Reviewed by GPT-6 Astra (task review, two scoped re-reviews, and the whole-branch review with Slides), recorded in oficina/estilo discussion 36. Approved by Paul, 2026-11-17. Hub CI green at ab9fdd3. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Squashed from desk into main. Squashed from desk into main.
4 files changed,
+290
−0
README.md+8 −0desk/desk.css+172 −0desk/desk.go+21 −0desk/desk_test.go+89 −0
CI passed — run details
diff --git a/README.md b/README.md| index 86463d5..683790f 100644 |
| --- a/README.md |
| +++ b/README.md |
| @@ -55,6 +55,14 @@ and keeps it out of the Menu sheet, and `menu.Item.Controls` is a toggle |
| account menu's Appearance is a three-way segmented selector that |
| `chrome.js` switches in place. |
| +`desk` is the grey desk an editor sits on (`--estilo-desk`), the floating |
| +glass card (`estilo-card`), the inspector built on it (`estilo-inspector`, |
| +with `estilo-inspector-group` and `estilo-inspector-label`) and the |
| +segmented control (`estilo-seg`, `estilo-seg-item`: a button with |
| +`aria-pressed`, or a label around a radio or checkbox). The values are |
| +Docs' own, copied; Slides is the first other app to use them. It is styling |
| +only, so it works with scripts off; the app places the card. |
| + |
| `colophon` is the suite's Colophon, reached from Help: every open-source |
| project an app is made with, in sections (typefaces, libraries by |
| runtime, icons and artwork, data, tools), each with a sentence or two on |
diff --git a/desk/desk.css b/desk/desk.css| new file mode 100644 |
| index 0000000..43d31f9 |
| --- /dev/null |
| +++ b/desk/desk.css |
| @@ -0,0 +1,172 @@ |
| +/* desk/desk.css: the desk colour, the floating card, the inspector and |
| + the segmented control. Values copied from Docs |
| + internal/docs/views/show.html at Docs origin/main b45b7b2. |
| + The app places the card ([estilo-card] sets no position); give it |
| + position: fixed or absolute, because its backdrop layer is anchored |
| + to it. */ |
| +@property --estilo-desk { |
| + syntax: "<color>"; |
| + inherits: true; |
| + initial-value: #e3e7ee; |
| +} |
| +@property --estilo-desk-ink { |
| + syntax: "<color>"; |
| + inherits: true; |
| + initial-value: #586070; |
| +} |
| +:root { |
| + --estilo-desk: light-dark(#e3e7ee, #0e1015); |
| + --estilo-desk-ink: light-dark(#586070, #9aa1ad); |
| + --estilo-inspector-inline-size: 248px; /* PUBLIC */ |
| + --estilo-inspector-inset: 12px; /* PUBLIC */ |
| +} |
| + |
| +/* The card: glass with the line as its rim. Surface only. */ |
| +[estilo-card] { |
| + box-sizing: border-box; |
| + padding: 12px; |
| + border: 1px solid transparent; |
| + border-radius: 12px; |
| + background: |
| + linear-gradient(light-dark(rgb(255 255 255 / 0.92), rgb(32 35 43 / 0.92)) 0 0) padding-box, |
| + linear-gradient(var(--rst-line) 0 0) border-box; |
| + box-shadow: |
| + inset 0 1px 0 light-dark(rgb(255 255 255 / 0.9), rgb(255 255 255 / 0.06)), |
| + 0 2px 4px rgb(23 32 60 / 0.06), |
| + 0 10px 20px -8px light-dark(rgb(23 32 60 / 0.18), rgb(0 0 0 / 0.5)), |
| + 0 28px 56px -20px light-dark(rgb(23 32 60 / 0.28), rgb(0 0 0 / 0.7)); |
| +} |
| +/* The blur is drawn by a layer behind the content, not by the card: a |
| + backdrop-filter makes its element the containing block of every |
| + fixed descendant. */ |
| +[estilo-card]::before { |
| + content: ""; |
| + position: absolute; |
| + inset: 0; |
| + z-index: -1; |
| + border-radius: inherit; |
| + -webkit-backdrop-filter: saturate(1.4) blur(14px); |
| + backdrop-filter: saturate(1.4) blur(14px); |
| + pointer-events: none; |
| +} |
| + |
| +[estilo-inspector] { |
| + inline-size: var(--estilo-inspector-inline-size); |
| + display: flex; |
| + flex-direction: column; |
| + gap: 14px; |
| + overflow-y: auto; |
| + overscroll-behavior: contain; |
| + font-size: 13px; |
| +} |
| +[estilo-inspector][data-state="closed"] { display: none; } |
| + |
| +[estilo-inspector-group] { |
| + display: flex; |
| + flex-wrap: wrap; |
| + gap: 6px 2px; |
| + margin: 0; |
| + padding: 0; |
| + border: 0; |
| +} |
| +/* A group with nothing showing is not shown. */ |
| +[estilo-inspector-group]:not(:has(> :not([estilo-inspector-label], [hidden]))) { display: none; } |
| +[estilo-inspector-label] { |
| + display: block; |
| + flex: 0 0 100%; |
| + margin: 0; |
| + color: var(--rst-text-muted); |
| + font: 650 11px/14px var(--rst-font, system-ui), sans-serif; |
| +} |
| + |
| +/* Selects and fields */ |
| +[estilo-inspector] select, |
| +[estilo-inspector] input:is([type="text"], [type="number"]) { |
| + box-sizing: border-box; |
| + min-inline-size: 0; |
| + block-size: 28px; |
| + padding-inline: var(--rst-sp-2); |
| + border: 1px solid var(--rst-line); |
| + border-radius: 8px; |
| + background: var(--rst-surface); |
| + color: var(--rst-text); |
| + font-size: 13px; |
| + font-weight: 500; |
| + text-overflow: ellipsis; |
| +} |
| + |
| +/* The segmented control: a joined row of 28px segments. A segment is a |
| + button (aria-pressed) or a label around a radio or checkbox. */ |
| +[estilo-seg] { |
| + display: flex; |
| + flex: 1 1 100%; |
| + min-inline-size: 0; |
| +} |
| +[estilo-seg-item] { |
| + position: relative; |
| + display: inline-flex; |
| + align-items: center; |
| + justify-content: center; |
| + flex: 1 1 0; |
| + box-sizing: border-box; |
| + min-inline-size: 24px; |
| + min-block-size: 28px; |
| + block-size: 28px; |
| + padding: 0; |
| + border: 0; |
| + border-radius: 0; |
| + background: var(--rst-surface-2); |
| + color: var(--rst-text); |
| + font: inherit; |
| + line-height: 1; |
| + cursor: pointer; |
| +} |
| +[estilo-seg-item]:nth-child(1 of [estilo-seg-item]) { |
| + border-start-start-radius: 8px; |
| + border-end-start-radius: 8px; |
| +} |
| +[estilo-seg-item]:nth-last-child(1 of [estilo-seg-item]) { |
| + border-start-end-radius: 8px; |
| + border-end-end-radius: 8px; |
| +} |
| +/* A radio or checkbox inside a segment is the state, not a thing to see. */ |
| +[estilo-seg-item] input { |
| + position: absolute; |
| + inset: 0; |
| + margin: 0; |
| + opacity: 0; |
| + cursor: inherit; |
| +} |
| +[estilo-seg-item]:hover:not(:disabled) { background: var(--rst-line); } |
| +[estilo-seg-item] svg { inline-size: 18px; block-size: 18px; } |
| +[estilo-seg-item]:disabled { color: var(--rst-text-faint); cursor: default; } |
| +/* Selected: tint and a complete 1px ring, so colour is not the only |
| + sign. A box-shadow costs no layout. */ |
| +[estilo-seg-item][aria-pressed="true"], |
| +[estilo-seg-item]:has(input:checked) { |
| + background: var(--rst-accent-soft); |
| + color: var(--rst-accent); |
| + font-weight: 700; |
| + box-shadow: inset 0 0 0 1px color-mix(in oklab, currentColor 45%, transparent); |
| +} |
| +[estilo-seg-item]:focus-visible, |
| +[estilo-seg-item]:has(input:focus-visible) { |
| + outline: 2px solid var(--rst-accent); |
| + outline-offset: -2px; |
| +} |
| +/* Forced colours drop the tint and the ring (a box-shadow). Selection |
| + and focus each get their own mark, so a segment that is both shows |
| + both: selection is a 2px border (Highlight), focus is an outline |
| + 2px outside the segment, raised over its neighbours. */ |
| +@media (forced-colors: active) { |
| + [estilo-seg-item][aria-pressed="true"], |
| + [estilo-seg-item]:has(input:checked) { |
| + border: 2px solid Highlight; |
| + } |
| + [estilo-seg-item]:focus-visible, |
| + [estilo-seg-item]:has(input:focus-visible) { |
| + z-index: 1; |
| + outline: 2px solid Highlight; |
| + outline-offset: 2px; |
| + } |
| +} |
diff --git a/desk/desk.go b/desk/desk.go| new file mode 100644 |
| index 0000000..91365de |
| --- /dev/null |
| +++ b/desk/desk.go |
| @@ -0,0 +1,21 @@ |
| +// Package desk is the grey desk an editor sits on ([--estilo-desk]), the |
| +// floating glass card ([estilo-card]), the inspector built on it |
| +// ([estilo-inspector], with [estilo-inspector-group] and |
| +// [estilo-inspector-label]) and the segmented control ([estilo-seg], |
| +// [estilo-seg-item]). The values are Docs' own; Slides is the first |
| +// other app to use them. |
| +// |
| +// Scripts off, all of it still works: it is styling only. A segment is |
| +// a button with aria-pressed, or a label around a radio or checkbox, so |
| +// a form posts without script. |
| +// |
| +// It carries no strings. Callers supply every label in their locale. |
| +package desk |
| + |
| +import _ "embed" |
| + |
| +//go:embed desk.css |
| +var css []byte |
| + |
| +// CSS returns desk.css. Link it after base.css. |
| +func CSS() []byte { return append([]byte(nil), css...) } |
diff --git a/desk/desk_test.go b/desk/desk_test.go| new file mode 100644 |
| index 0000000..4499051 |
| --- /dev/null |
| +++ b/desk/desk_test.go |
| @@ -0,0 +1,89 @@ |
| +package desk |
| + |
| +import ( |
| + "strings" |
| + "testing" |
| + |
| + "amadan.net/oficina/estilo.git/internal/tokencheck" |
| +) |
| + |
| +func TestDeskTokensAreDefined(t *testing.T) { |
| + missing, n := tokencheck.Undefined(CSS()) |
| + if n == 0 { |
| + t.Fatal("desk.css reads no rastrillo token; the check would pass vacuously") |
| + } |
| + if len(missing) > 0 { |
| + t.Fatal("desk.css reads undefined tokens:", missing) |
| + } |
| +} |
| + |
| +// The values are Docs' own, copied; a change here is a design decision. |
| +func TestCardAndSegAreDocs(t *testing.T) { |
| + src := string(CSS()) |
| + for _, want := range pins { |
| + if !strings.Contains(src, want) { |
| + t.Errorf("desk.css lost %q", want) |
| + } |
| + } |
| +} |
| + |
| +var pins = []string{ |
| + "--estilo-desk: light-dark(#e3e7ee, #0e1015)", |
| + "--estilo-desk-ink: light-dark(#586070, #9aa1ad)", |
| + "--estilo-inspector-inline-size: 248px", |
| + "--estilo-inspector-inset: 12px", |
| + "border-radius: 12px", |
| + "padding: 12px", |
| + "light-dark(rgb(255 255 255 / 0.92), rgb(32 35 43 / 0.92))", |
| + "0 28px 56px -20px light-dark(rgb(23 32 60 / 0.28), rgb(0 0 0 / 0.7))", |
| + "backdrop-filter: saturate(1.4) blur(14px)", |
| + "font: 650 11px/14px", |
| + "block-size: 28px", |
| + "box-shadow: inset 0 0 0 1px color-mix(in oklab, currentColor 45%, transparent)", |
| + "outline: 2px solid Highlight", |
| +} |
| + |
| +// In forced colours selection and focus must be separate marks, so a |
| +// segment that is both shows both: a border for selection, an offset |
| +// outline for focus, the focus rule after the selection rule. |
| +func TestForcedColoursSelectionAndFocusAreSeparate(t *testing.T) { |
| + src := string(CSS()) |
| + i := strings.Index(src, "@media (forced-colors: active)") |
| + if i < 0 { |
| + t.Fatal("desk.css has no forced-colors block") |
| + } |
| + block := src[i:] |
| + sel := strings.Index(block, "[estilo-seg-item][aria-pressed=\"true\"],\n [estilo-seg-item]:has(input:checked) {\n border: 2px solid Highlight;") |
| + foc := strings.Index(block, "[estilo-seg-item]:has(input:focus-visible) {\n z-index: 1;\n outline: 2px solid Highlight;\n outline-offset: 2px;") |
| + if sel < 0 { |
| + t.Error("forced colours: selected segment (button and checked input) lost its border") |
| + } |
| + if foc < 0 { |
| + t.Error("forced colours: focused segment (button and focused input) lost its offset outline") |
| + } |
| + if sel >= 0 && foc >= 0 && foc < sel { |
| + t.Error("forced colours: the focus rule must come after the selection rule") |
| + } |
| + if strings.Contains(block, "outline-offset: -2px") { |
| + t.Error("forced colours: an inset outline would hide focus on a selected segment") |
| + } |
| +} |
| + |
| +// The ends of a segmented control are its first and last segment, not its |
| +// first and last child: a <fieldset>'s <legend> is its first child. |
| +func TestSegEndsAreTheFirstAndLastSegment(t *testing.T) { |
| + src := string(CSS()) |
| + for _, want := range []string{ |
| + ":nth-child(1 of [estilo-seg-item])", |
| + ":nth-last-child(1 of [estilo-seg-item])", |
| + } { |
| + if !strings.Contains(src, want) { |
| + t.Errorf("desk.css lost %q", want) |
| + } |
| + } |
| + for _, bad := range []string{"[estilo-seg-item]:first-child", "[estilo-seg-item]:last-child"} { |
| + if strings.Contains(src, bad) { |
| + t.Errorf("desk.css still uses %q", bad) |
| + } |
| + } |
| +} |