diff --git a/docs/architecture/ribbon.md b/docs/architecture/ribbon.md index cb1c311..cb7940a 100644 --- a/docs/architecture/ribbon.md +++ b/docs/architecture/ribbon.md @@ -46,13 +46,18 @@ so the split is invisible there. Ribbon.svelte ├─ .ribbon-tabs File pill · quick access (save, undo, redo) · tabs · contextual tabs │ · spacer · document name · appearance · UI language -└─ .ribbon-body the active tab's groups, a fixed --w-ribbon-h (108px) band +└─ .ribbon-body the active tab's groups, a fixed --w-ribbon-h (84px) band ``` The band's height never changes: it scrolls horizontally with a hidden scrollbar instead of collapsing groups into popovers the way Word does when the window narrows. That is the single biggest simplification here, and the reason two things below are necessary. +84px is the tallest control in any tab — Table Layout's two-line `Insert above`, 65px — plus the +group footer and the band's padding, so no tab carries dead space above its buttons. Every metric +feeding that sum is pinned in px, line-heights included: a ratio hands the band's height to +whatever font resolves, and the group footers then hang out of the band. + A chevron in the tab strip drops the band entirely, leaving the strip (`odf-editor-ribbon-collapsed`). Clicking any tab brings it back — Word instead floats it over the document until the next click lands in the text, which is the part not built. @@ -86,7 +91,7 @@ at every height. A flex row cannot reserve width in part of its height, so it mo | `selection.ts` | `saveRange` / `withRange` — a popover steals focus, so the range is replayed before the command | | `fontList.svelte.ts` | Recent, web-safe and detected fonts, shared by every font picker | | `controls/` | Font family box, font size box, style gallery | -| `.rb-captioned` (global.css) | Wraps a reused picker standing alone in a group: its trigger grows to the big button's 34px box and 28px glyph, so a group of pickers and a group of buttons are the same size | +| `.rb-captioned` (global.css) | Wraps a reused picker standing alone in a group: its trigger grows to the big button's 32px box and 28px glyph, so a group of pickers and a group of buttons are the same size | | `tabs/` | One file per tab | Reading what the selection formats is **not** here: `utils/selectionFormat.ts` answers it diff --git a/src/lib/components/ribbon/Ribbon.svelte b/src/lib/components/ribbon/Ribbon.svelte index 9c4b442..de10031 100644 --- a/src/lib/components/ribbon/Ribbon.svelte +++ b/src/lib/components/ribbon/Ribbon.svelte @@ -379,14 +379,14 @@ flex-wrap: wrap; align-items: center; gap: 2px; - padding: 5px 10px 0; + padding: 3px 10px 0; } .ribbon-tab { position: relative; border: none; background: none; - padding: 7px 9px 6px; + padding: 5px 9px; border-radius: 4px 4px 0 0; color: var(--w-text); font-family: inherit; @@ -433,7 +433,7 @@ background: var(--w-accent-fill); color: #fff; border-radius: 4px; - padding: 6px 16px; + padding: 5px 14px; margin-right: 6px; font-family: inherit; font-size: 13px; @@ -448,8 +448,8 @@ display: inline-flex; align-items: center; justify-content: center; - width: 30px; - height: 28px; + width: 28px; + height: 26px; border: none; background: none; border-radius: 4px; @@ -512,7 +512,7 @@ display: flex; align-items: stretch; height: var(--w-ribbon-h); - padding: 6px 12px; + padding: 3px 10px; /* Fixed height, scroll instead of Word's responsive group collapsing — the scrollbar is hidden so the band stays clean. */ overflow-x: auto; diff --git a/src/lib/components/ribbon/RibbonButton.svelte b/src/lib/components/ribbon/RibbonButton.svelte index af0a589..61d9e11 100644 --- a/src/lib/components/ribbon/RibbonButton.svelte +++ b/src/lib/components/ribbon/RibbonButton.svelte @@ -119,8 +119,8 @@ picker beside it answer the pointer the same way. */ .rb-big { flex-direction: column; - gap: 4px; - padding: 4px 7px 6px; + gap: 2px; + padding: 2px 6px 3px; } .rb-big .rb-face { @@ -128,7 +128,7 @@ min-height: 28px; flex: 1; border-radius: 4px; - padding: 3px 4px; + padding: 2px 4px; margin: 0 -4px; } @@ -140,7 +140,7 @@ .rb-small { gap: 5px; border-radius: 3px; - padding: 3px 8px; + padding: 2px 8px; } .rb-icon { @@ -158,14 +158,17 @@ .rb-small.active, .rb-icon.active { background: var(--w-active); } + /* Word wraps a two-word label onto two lines; at the default line-height that + button alone would set the band's height. */ .rb-label { + line-height: 14px; color: inherit; } /* Rides closer to the label than the 4px column gap: the two read as one line. */ .rb-stack-caret { display: flex; - height: 10px; + height: 8px; margin-top: -3px; color: var(--w-text-dim); } @@ -197,12 +200,12 @@ and the caret under it open the menu. Icon, label and caret each get their own line — abreast, the caret widens the button by its own width. */ .rb-split-col { flex-direction: column; } - .rb-split-col .rb-big { padding: 3px 7px 0; } + .rb-split-col .rb-big { padding: 2px 6px 0; } .rb-split-col .rb-caret { flex-direction: column; width: auto; - padding: 0 7px 2px; + padding: 0 6px 1px; border-radius: 0 0 3px 3px; color: var(--w-text); } diff --git a/src/lib/components/ribbon/RibbonGroup.svelte b/src/lib/components/ribbon/RibbonGroup.svelte index b2ac4c4..d9232ae 100644 --- a/src/lib/components/ribbon/RibbonGroup.svelte +++ b/src/lib/components/ribbon/RibbonGroup.svelte @@ -31,7 +31,7 @@ display: flex; flex-direction: column; flex-shrink: 0; - padding: 2px 4px 0; + padding: 0 4px; } /* Takes the slack down to a floor of two gallery tiles plus its chevron; past @@ -55,7 +55,7 @@ align-items: center; justify-content: center; gap: 2px; - height: 15px; + height: 13px; } /* Stays inside its own group, so a label longer than the controls above it reads @@ -64,6 +64,7 @@ min-width: 0; font-family: var(--w-font); font-size: 11px; + line-height: 13px; color: var(--w-text-dim); white-space: nowrap; overflow: hidden; @@ -74,8 +75,8 @@ display: inline-flex; align-items: center; justify-content: center; - width: 14px; - height: 14px; + width: 13px; + height: 13px; border: none; background: none; border-radius: 2px; diff --git a/src/lib/components/ribbon/controls/StyleGallery.svelte b/src/lib/components/ribbon/controls/StyleGallery.svelte index 17ef531..f68ee19 100644 --- a/src/lib/components/ribbon/controls/StyleGallery.svelte +++ b/src/lib/components/ribbon/controls/StyleGallery.svelte @@ -123,7 +123,8 @@