| 1 | {{/* show — GET /d/{sqid}, the document read view (spec §6.1/§6.2). |
| 2 | handlers.go's show builds the view data: Title is the document's |
| 3 | own title, printed as-is the same way list.html's row titles are |
| 4 | (data, not authored copy — not resolved through rastrillo.T); |
| 5 | HTML is Store.HTML's server-rendered replay of the CRDT's |
| 6 | ProseMirror fragment through wazero, never a database column, and |
| 7 | is empty for a document with no updates yet — an ordinary empty |
| 8 | canvas below, not an error. It is template.HTML, so {{.HTML}} |
| 9 | below is written out unescaped on purpose — see Store.HTML's own |
| 10 | doc comment for where that trust decision is made and why. |
| 11 | |
| 12 | [docs-canvas]/[docs-page]/[docs-text] are this app's own |
| 13 | vocabulary (SKILL.md §7: "ui is rastrillo's vocabulary, not |
| 14 | yours"), not rastrillo's, so they are not spelled rst-*, same |
| 15 | reasoning as list.html's [docs-thumb]. |
| 16 | |
| 17 | The canvas opts out of the surrounding theme on purpose (spec |
| 18 | §10.2, the brief's canvas constraint): a document is a piece of |
| 19 | paper, and paper does not follow the reader's dark-mode |
| 20 | preference the way the chrome around it does. color-scheme: |
| 21 | light plus literal colours below — never var(--rst-surface) or |
| 22 | var(--rst-text), which would make the "page" repaint itself dark |
| 23 | along with everything else on screen. |
| 24 | |
| 25 | [docs-page] is one page-shaped container, and it stays one in both |
| 26 | view modes. Paged draws desk-coloured gaps BETWEEN pages as widget |
| 27 | decorations inside the text flow (fixtures/pages.mjs) rather than |
| 28 | repeating this element. |
| 29 | |
| 30 | This comment used to say a later version would repeat [docs-page] |
| 31 | once per page. It cannot: ProseMirror owns everything inside the |
| 32 | editable element ({mount: el}), so its children cannot be wrapped |
| 33 | in sibling page boxes without taking the document away from it. |
| 34 | Repeating the box is a layout-engine shape; a decoration is a |
| 35 | pagination-as-a-view shape, and a view is all pagination can be |
| 36 | while page breaks are computed from measured heights and never |
| 37 | persisted. |
| 38 | |
| 39 | Writes the bare rst-* attribute grammar throughout — see |
| 40 | list.html's own comment on why, and |
| 41 | render_test.go's TestOurTemplatesUseTheAttributeGrammar, which |
| 42 | holds it against this file too. */}} |
| 43 | {{/* The bar is the layout's (views/layout.html, chrome.go). On this |
| 44 | screen it carries the document's title, editable in place for anyone |
| 45 | who may write (estilo's title slot, POST /d/{sqid}/title), and the |
| 46 | owner's "Share…" action. Sign out is in the account menu and nowhere |
| 47 | else. */}} |
| 48 | {{/* In <head>, ahead of every stylesheet: one preload per face this |
| 49 | document is set in (fontgate.go), so the fonts start downloading |
| 50 | with the page; then the generated font stylesheet; then the hold |
| 51 | (fixtures/fonts-hold.js), a plain blocking script, so it runs before |
| 52 | anything is painted. The hold is set by that script and never |
| 53 | rendered here: a reader with no script is not held, and sees the |
| 54 | system faces, which are final. crossorigin because fonts are fetched |
| 55 | in CORS mode even from this origin, and a preload without it is a |
| 56 | second download. */}} |
| 57 | {{define "pagehead"}}{{range .Fonts.Preloads}}<link rel="preload" as="font" type="font/woff2" crossorigin href="{{.}}"> |
| 58 | {{end}}<link rel="stylesheet" href="{{.Fonts.Stylesheet}}"> |
| 59 | <script src="{{.Fonts.Hold}}"></script> |
| 60 | {{end}} |
| 61 | {{define "content"}}<link rel="stylesheet" href="{{asset "static/estilo-save-status.css"}}"><style> |
| 62 | /* This screen is the one that is not a column of content. It is a |
| 63 | document on a desk, and in both of the applications this layout |
| 64 | language comes from the desk runs to the window's edges. |
| 65 | |
| 66 | [rst-page] — rastrillo's own <main>, written by the topbar shell |
| 67 | outside any block this app can override — is a 64rem centred |
| 68 | column with --rst-sp-5/--rst-sp-4/--rst-sp-6 of padding. That is |
| 69 | right for the list and wrong here, in two separate ways: it |
| 70 | leaves the grey tray as a rectangle floating in white with about |
| 71 | 85px of tray showing either side of the sheet, and it holds the |
| 72 | formatting bar to 64rem when the bar belongs to the window the |
| 73 | way the shell's own bar above it does. |
| 74 | |
| 75 | Cancelling the column here rather than reaching for |
| 76 | `width: 100vw` is the same choice, for the same reason, that the |
| 77 | narrow-screen block below already records: 100vw measures the |
| 78 | viewport INCLUDING a classic scrollbar, so it overhangs by the |
| 79 | scrollbar's width and starts exactly the horizontal scroll that |
| 80 | SC 1.4.10 forbids. A container told to stop padding itself |
| 81 | cannot overhang. |
| 82 | |
| 83 | Scoped by delivery rather than by selector: this stylesheet is |
| 84 | inside show.html's own "content" and ships only with this page, |
| 85 | so the rule reaches neither the list nor sign-in. It is written |
| 86 | bare — no `[docs-canvas] ~` dance — because a page-wide rule |
| 87 | that pretends to be scoped is worse than one that says what it |
| 88 | does. */ |
| 89 | [rst-page] { |
| 90 | max-inline-size: none; |
| 91 | padding: 0; |
| 92 | } |
| 93 | /* The document's title is in the estilo bar now (chrome.go), weighted |
| 94 | 550 as the page's subject and editable in place for a writer. It |
| 95 | used to be [docs-shell-title], a 12.5px regular span that could not |
| 96 | be renamed. */ |
| 97 | /* The desk the paper sits on, and the ink of what is written on the |
| 98 | desk (page numbers) rather than on the paper. A cool grey taken |
| 99 | from Docs' own hue, so the page reads as lit paper on a surface |
| 100 | rather than a white box on a grey one; dark in dark mode, where |
| 101 | the paper stays paper. |
| 102 | |
| 103 | Registered as <color> so light-dark() resolves where they are |
| 104 | declared, on :root, in the reader's scheme, and the resolved |
| 105 | colour is what inherits. [docs-page] is color-scheme: light (its |
| 106 | colours are literals, spec §10.2), and an unregistered property |
| 107 | would re-resolve inside it to the light desk: the gap between two |
| 108 | sheets would be a light strip on a dark desk. */ |
| 109 | @property --docs-desk { |
| 110 | syntax: "<color>"; |
| 111 | inherits: true; |
| 112 | initial-value: #e3e7ee; |
| 113 | } |
| 114 | @property --docs-desk-ink { |
| 115 | syntax: "<color>"; |
| 116 | inherits: true; |
| 117 | initial-value: #586070; |
| 118 | } |
| 119 | :root { |
| 120 | --docs-desk: light-dark(#e3e7ee, #0e1015); |
| 121 | --docs-desk-ink: light-dark(#586070, #9aa1ad); |
| 122 | } |
| 123 | /* The whole screen is the desk: the strip beside the floating |
| 124 | toolbar is desk, not page background. */ |
| 125 | body:has([docs-canvas]) { |
| 126 | background: var(--docs-desk); |
| 127 | } |
| 128 | /* [docs-canvas] is the tray the page sits in — chrome around paper, |
| 129 | so it takes the reader's scheme; the paper itself opts out (see |
| 130 | [docs-page]). */ |
| 131 | [docs-canvas] { |
| 132 | display: flex; |
| 133 | justify-content: center; |
| 134 | /* Less air above the sheet than below it. The tray used to carry |
| 135 | --rst-sp-6 on both block edges and sat under a page header that |
| 136 | had already spent --rst-sp-5 of its own below the rule; with the |
| 137 | header gone and the bar sitting directly on the tray, the same |
| 138 | --rst-sp-6 read as a gap rather than as a margin. --rst-sp-5 |
| 139 | above puts the top of the sheet where the eye expects it from |
| 140 | the bar; --rst-sp-6 below is scroll run-out, which wants to stay |
| 141 | generous. */ |
| 142 | padding: var(--rst-sp-5) var(--rst-sp-4) var(--rst-sp-6); |
| 143 | background: var(--docs-desk); |
| 144 | } |
| 145 | /* [docs-page]: white, centred, with margins — literal colours per |
| 146 | spec §10.2, not var(--rst-surface)/var(--rst-text): a document |
| 147 | stored as dark paper by its author must still read as dark paper |
| 148 | to a reader in light mode, and vice versa, so nothing here may |
| 149 | depend on which theme is currently active. Sized to a US Letter |
| 150 | page's proportions at 96dpi; a real page-geometry constant |
| 151 | arrives with the layout engine, not this task. */ |
| 152 | [docs-page] { |
| 153 | box-sizing: border-box; |
| 154 | display: flex; |
| 155 | flex-direction: column; |
| 156 | inline-size: min(100%, 8.5in); |
| 157 | min-block-size: 11in; |
| 158 | margin-block-end: var(--rst-sp-6); |
| 159 | padding: 1in; /* spacing-allow: the page's own margins, Letter's inch, as internal/export/pdf.go prints them */ |
| 160 | color-scheme: light; |
| 161 | background: #ffffff; |
| 162 | color: #1a1a1a; |
| 163 | border-radius: 2px; |
| 164 | /* Paper lying flat on the desk: a hairline edge, a contact shadow |
| 165 | and a short soft one. Lower than the toolbar's dock, which floats |
| 166 | over it and casts the longer shadow, so the two depth cues agree |
| 167 | with the page scrolling under the dock. */ |
| 168 | box-shadow: |
| 169 | 0 0 0 1px rgb(23 32 60 / 0.06), |
| 170 | 0 1px 2px rgb(23 32 60 / 0.08), |
| 171 | 0 8px 20px -12px rgb(23 32 60 / 0.20); |
| 172 | } |
| 173 | /* Narrow screens stop simulating paper, because at phone widths the |
| 174 | simulation costs more than it says. |
| 175 | |
| 176 | Above this breakpoint a reader sees TWO nested insets: |
| 177 | [docs-canvas]'s own 1rem tray padding, then [docs-page]'s 1in. |
| 178 | That inner inch is a real measurement — it stands for the |
| 179 | document's page margin, which page setup and the layout engine |
| 180 | will own properly later — and on a desktop it is worth every |
| 181 | pixel. On a 375px phone the two together (375 - 32 - 192) leave a |
| 182 | 151px column, and at 320px, which this app supports without |
| 183 | exemption (WCAG 2.2 AA SC 1.4.10), 96px: about twelve characters |
| 184 | of 12pt body text per line. A page margin that squeezes the page |
| 185 | is no longer describing the page. |
| 186 | |
| 187 | (Every character count in this comment divides by 8px, the |
| 188 | average advance of 12pt Georgia — the fallback for the serif this |
| 189 | canvas used to default to. Stated because the counts here were |
| 190 | for a while derived from two different divisors at once: "five |
| 191 | characters" for 64px is 12.8px each, "40 characters" for 320px is |
| 192 | 8px each, and both sat in the same paragraph claiming to be |
| 193 | measured. The default is Carlito now, which sets narrower than |
| 194 | that at the same size, so these are if anything conservative — |
| 195 | the breakpoint the arithmetic argues for does not move.) |
| 196 | |
| 197 | (The count and the numbers in this paragraph have now been wrong |
| 198 | in both directions, which is worth leaving on the record. They |
| 199 | first said two insets and 151px/96px, forgetting that [rst-page] |
| 200 | pads --rst-sp-4 either side; that was corrected to three and |
| 201 | 119px/64px. Both were true of the tree they were written against. |
| 202 | [rst-page] no longer pads this screen at all — the rule at the top |
| 203 | of this stylesheet zeroes it, so that the tray can reach the |
| 204 | window's edges — which puts the arithmetic back on two insets and |
| 205 | back on the original figures. Re-measure rather than trusting any |
| 206 | of the three the next time something above this changes.) |
| 207 | |
| 208 | So below 36rem the tray's side padding goes to nothing, the sheet |
| 209 | runs edge to edge, its block padding drops from --rst-sp-5/-6 to |
| 210 | --rst-sp-4, and ONE margin survives inside it. Text goes to 343px |
| 211 | at 375px wide and 288px at 320px. The 1in is untouched at every |
| 212 | width above the breakpoint, so where the print margin can be shown |
| 213 | honestly it still is. |
| 214 | |
| 215 | 36rem is a judgement rather than a formula, and the honest version |
| 216 | of the arithmetic says so: at 576px the two insets leave a 352px |
| 217 | column, about 44 characters of this face — a hair under the 45 |
| 218 | that make a comfortable measure, where before the shell's padding |
| 219 | came off it was 320px and about 40. The breakpoint has not been |
| 220 | moved to follow that, deliberately: 36rem was already the |
| 221 | conservative end of its own argument, the change only ever gives |
| 222 | the sheet more room, and moving a breakpoint because a number |
| 223 | improved is how a breakpoint stops meaning anything. Phones in |
| 224 | portrait are all well below it; a tablet or a small window keeps |
| 225 | the paper. |
| 226 | |
| 227 | The shadow goes with the tray — it exists to lift the sheet off the |
| 228 | grey, and once there is no grey beside it, it is a dark smear on the |
| 229 | screen edge. What deliberately does NOT change: the flex column and |
| 230 | min-block-size, because the editable node fills the page's text area |
| 231 | so that a click in the empty space below the last paragraph still |
| 232 | lands in the document (see fixtures/editor-entry.js's |
| 233 | placeCaretFromPage), and the literal colours, which must not repaint |
| 234 | under anyone's theme at any width. |
| 235 | |
| 236 | `screen and`, not a bare width query, and it is not decoration. A |
| 237 | media query with no type matches print too, and a print box is |
| 238 | measured in CSS pixels like any other: US Letter and A4 come out |
| 239 | around 700-800px and stay above this breakpoint, but A5 portrait is |
| 240 | about 559px and crosses it. Printing a document on A5 would then |
| 241 | drop the 1in for the 1rem meant for a phone screen — an |
| 242 | edge-bleeding sheet, in the one medium where the page margin is |
| 243 | not a metaphor at all. `screen` is what keeps the paragraph above |
| 244 | true. */ |
| 245 | @media screen and (max-width: 36rem) { |
| 246 | [docs-canvas] { |
| 247 | /* Zeroing the tray's own padding is now all it takes to reach |
| 248 | the screen edge. It used to take a second rule as well — |
| 249 | `margin-inline: calc(var(--rst-sp-4) * -1)`, cancelling the |
| 250 | --rst-sp-4 that [rst-page] pads on every side — and that rule |
| 251 | is gone because the inset it cancelled is gone: the [rst-page] |
| 252 | override at the top of this stylesheet zeroes that padding at |
| 253 | every width, so there is nothing left here to pull back. |
| 254 | The reasoning it carried has not been lost, only moved: the |
| 255 | argument for cancelling a known padding instead of reaching |
| 256 | for `width: 100vw`, which overhangs by a classic scrollbar's |
| 257 | width and starts the horizontal scroll SC 1.4.10 forbids, is |
| 258 | written out where that override lives. */ |
| 259 | padding-inline: 0; |
| 260 | padding-block: var(--rst-sp-4); |
| 261 | /* Room above the page's text for one line of the font status, |
| 262 | which hangs over the tray here ([docs-fonts-status]). */ |
| 263 | padding-block-start: 2rem; /* spacing-allow: one line of the font status, which hangs over the tray here */ |
| 264 | } |
| 265 | [docs-page] { |
| 266 | inline-size: 100%; |
| 267 | margin-block-end: 0; |
| 268 | padding: var(--rst-sp-4); |
| 269 | box-shadow: none; |
| 270 | } |
| 271 | /* The page gap's negative margin has to match the padding it is |
| 272 | pulling back out of, and that padding is different here. |
| 273 | |
| 274 | [docs-page-gap]'s rule below uses margin-inline: -1in against the |
| 275 | wide layout's 1in padding. At this width the padding is |
| 276 | --rst-sp-4 (1rem), so a -1in margin overhangs the page by about |
| 277 | 80px on each side — with nothing clipping it, that is a |
| 278 | horizontal scrollbar on every phone in paged mode. SC 1.4.10, |
| 279 | failed, in the one check this branch promised to keep green. |
| 280 | |
| 281 | Missed because the narrow block was written before the gaps |
| 282 | existed and nothing went back to look at it, and not caught |
| 283 | because Chromium will not start in this sandbox. Derived, not |
| 284 | measured — the arithmetic is 1in = 96px against 1rem = 16px. */ |
| 285 | [docs-page-gap] { |
| 286 | margin-inline: calc(var(--rst-sp-4) * -1); |
| 287 | padding-inline-end: var(--rst-sp-4); |
| 288 | } |
| 289 | } |
| 290 | /* [docs-text] holds Store.HTML's rendered markup (core/src/fragment.rs |
| 291 | — <p>, <h1>-<h6>, <ul>/<ol>/<li>, <blockquote>, and the marks |
| 292 | <strong>/<em>/<code>; the only attribute it ever emits is class, |
| 293 | and every class it can emit is a literal from one of that file's |
| 294 | own closed tables, so no byte of a document ever reaches attribute |
| 295 | position — which is what makes Store.HTML's template.HTML return |
| 296 | honest). white-space is the browser default (normal), |
| 297 | not pre-wrap: that was for the old plain-text read view, and real |
| 298 | block markup carries its own line breaks now — pre-wrap on real |
| 299 | HTML would double up on the blank lines <p> already produces. |
| 300 | Colours below are literal, same reasoning as [docs-page] above: |
| 301 | a document's own marks must not repaint under the reader's |
| 302 | colour scheme. */ |
| 303 | /* The fonts are not here. internal/fonts generates their stylesheet |
| 304 | from its manifest (the "pagehead" block above links it): every |
| 305 | face's @font-face with font-display: block, the default family on |
| 306 | [docs-text], each family on its mark's class, the fallback each |
| 307 | commits to, and the hold that keeps the sheet hidden until the |
| 308 | faces have loaded (NO-FOUT.md). The PDF exporter measures with the |
| 309 | same font programs, so a line ends at the same word on screen and |
| 310 | on paper. |
| 311 | |
| 312 | LINE-breaks, not paginates: internal/export/pdf.go breaks pages |
| 313 | between LINES and the screen between BLOCKS, so a paragraph that |
| 314 | straddles a page boundary lands differently. Screen page numbers |
| 315 | are an orientation aid; the PDF's are the ones to quote. */ |
| 316 | [docs-text] { |
| 317 | overflow-wrap: break-word; |
| 318 | font-size: 12pt; |
| 319 | line-height: 1.4; |
| 320 | } |
| 321 | /* The size marks (core/src/fragment.rs's MARKS table, and the same |
| 322 | class names in fixtures/editor-entry.js's schema). The font marks' |
| 323 | classes are in internal/fonts' generated stylesheet. A mark carries |
| 324 | no value of its own: the set is closed, which is what keeps a |
| 325 | document's bytes out of attribute position in the server-rendered |
| 326 | read view. */ |
| 327 | /* The point ladder (fixtures/sizes.mjs, fragment.rs's MARKS, and |
| 328 | internal/export/pdf.go's SizePt — one ladder in four places). |
| 329 | |
| 330 | ABSOLUTE pt, not em, and that is a change from the four-step scale |
| 331 | these replaced. A multiplier compounds: 14pt inside a heading that |
| 332 | is itself 1.6em would come out at 1.6 x 14, which is not what |
| 333 | anybody means by setting a run to 14pt. Every word processor treats |
| 334 | a chosen size as absolute, and so does this now — the size a person |
| 335 | picks is the size the text is, wherever it sits. |
| 336 | |
| 337 | 12pt has no rule because it has no mark: it is [docs-text]'s own |
| 338 | font-size above, and the default carries no mark anywhere in this |
| 339 | system. */ |
| 340 | [docs-text] .docs-size-8 { font-size: 8pt; } |
| 341 | [docs-text] .docs-size-9 { font-size: 9pt; } |
| 342 | [docs-text] .docs-size-10 { font-size: 10pt; } |
| 343 | [docs-text] .docs-size-11 { font-size: 11pt; } |
| 344 | [docs-text] .docs-size-14 { font-size: 14pt; } |
| 345 | [docs-text] .docs-size-18 { font-size: 18pt; } |
| 346 | [docs-text] .docs-size-24 { font-size: 24pt; } |
| 347 | [docs-text] .docs-size-36 { font-size: 36pt; } |
| 348 | [docs-text] .docs-size-48 { font-size: 48pt; } |
| 349 | [docs-text] .docs-size-72 { font-size: 72pt; } |
| 350 | /* The four-step scale the ladder replaced: Small, Large and Extra |
| 351 | large, which were 0.85em, 1.25em and 1.5em of a 12pt body — 10.2, |
| 352 | 15 and 18pt. They are no longer offered by the control and they are |
| 353 | styled here forever, because documents in the wild carry these |
| 354 | marks and a mark that stops being styled is text that silently |
| 355 | loses its size. |
| 356 | |
| 357 | Mapped onto the nearest ladder step rather than kept as their old |
| 358 | multipliers, so the two systems cannot disagree about one document: |
| 359 | 10 and 18 are exact, and 15 rounds to 14. A document set in "Large" |
| 360 | is therefore one point smaller than it was. That is a real change |
| 361 | and it is the honest price of a closed ladder — the alternative is |
| 362 | a fifteenth mark preserving a number nobody chose, since "Large" |
| 363 | never told anyone it meant 15pt. */ |
| 364 | [docs-text] .docs-size-sm { font-size: 10pt; } |
| 365 | [docs-text] .docs-size-lg { font-size: 14pt; } |
| 366 | [docs-text] .docs-size-xl { font-size: 18pt; } |
| 367 | /* Indent (fragment.rs's indent_class, fixtures/indent.mjs's |
| 368 | indentClass, and internal/export/pdf.go's indentOf — one step in |
| 369 | four places). Half an inch per level, which is what Docs, Word and |
| 370 | Pages all use, and eight levels, past which a paragraph on US |
| 371 | Letter has no measure left. |
| 372 | |
| 373 | margin-inline-start rather than padding: the indent has to move the |
| 374 | text away from the page margin, and padding would leave a |
| 375 | blockquote's own border rule sitting at the old position while its |
| 376 | text moved. |
| 377 | |
| 378 | Written out as eight rules rather than generated from a custom |
| 379 | property, because this stylesheet is read by |
| 380 | TestPageGeometryMatchesTheStylesheet, which parses these numbers out |
| 381 | of the file and compares them with the Go exporter's. A calc() over |
| 382 | a variable would be tidier here and unparseable there, and a |
| 383 | geometry check that cannot see the numbers is one that reports |
| 384 | agreement without checking any. */ |
| 385 | /* Paged mode: the desk showing between two sheets. |
| 386 | (fixtures/pages.mjs draws these as widget decorations; nothing |
| 387 | about them is in the document — see that module's head comment for |
| 388 | why a persisted page break would be an edit two people could fight |
| 389 | over.) |
| 390 | |
| 391 | The negative inline margins are the trick that makes one |
| 392 | [docs-page] look like several. The gap lives inside the page's own |
| 393 | text flow, so it is inset by [docs-page]'s 1in padding; pulling it |
| 394 | back out by that inch lets it paint the desk colour edge to edge, |
| 395 | and the box-shadow above and below reproduces the lift a sheet's |
| 396 | own edge has. |
| 397 | |
| 398 | The colour is a literal, matching [docs-canvas]'s own: this is the |
| 399 | desk, and the desk does not follow the reader's dark-mode |
| 400 | preference any more than the paper does (spec §10.2). |
| 401 | |
| 402 | Only in paged mode, and only under a screen. In print the browser |
| 403 | does its own pagination and a drawn gap would be a grey band across |
| 404 | somebody's page. */ |
| 405 | [docs-canvas][data-view="infinite"] [docs-page-gap] { |
| 406 | display: none; |
| 407 | } |
| 408 | /* Print. |
| 409 | (File → Print, which is window.print() — fixtures/menu.mjs's |
| 410 | LOCAL_COMMANDS. Deliberately not a second PDF exporter: this is the |
| 411 | browser printing the page a person is looking at, and the PDF |
| 412 | export is a different thing with its own File item.) |
| 413 | |
| 414 | The browser paginates here, which makes a THIRD paginator after the |
| 415 | screen's and pdf.go's. They will not always agree, and that is |
| 416 | stated rather than papered over — see the @font-face comment above. |
| 417 | What this stylesheet has to do is get the chrome out of the way and |
| 418 | hand the browser a page-shaped page. |
| 419 | |
| 420 | @page carries the geometry, so [docs-page] gives up its own |
| 421 | padding: keeping both would inset the text by two inches. The size |
| 422 | and margin match internal/export/pdf.go's PageWidthPt/PageHeightPt |
| 423 | and MarginPt, so a printed page and an exported one have the same |
| 424 | measure even where they break in different places. |
| 425 | |
| 426 | The screen's page gaps go: the browser is making real pages now, |
| 427 | and a drawn gap would be a grey band across somebody's paper. */ |
| 428 | @page { |
| 429 | size: letter; |
| 430 | margin: 1in; /* spacing-allow: the printed page's margins, pdf.go's MarginPt */ |
| 431 | } |
| 432 | @media print { |
| 433 | [docs-page-gap] { |
| 434 | display: none; |
| 435 | } |
| 436 | /* Every piece of chrome. The bar is estilo's and is named by its |
| 437 | vocabulary, not ours. */ |
| 438 | [estilo-bar], |
| 439 | [docs-chrome], |
| 440 | [docs-inspector], |
| 441 | [docs-jumpto] { |
| 442 | display: none !important; |
| 443 | } |
| 444 | /* The desk is not paper. Both of these carry literal colours on |
| 445 | screen (spec §10.2) and both must simply stop existing here — |
| 446 | printing a grey background wastes a reader's ink to reproduce a |
| 447 | metaphor. */ |
| 448 | body:has([docs-canvas]), |
| 449 | [docs-canvas] { |
| 450 | display: block; |
| 451 | padding: 0; |
| 452 | background: none; |
| 453 | } |
| 454 | [docs-page] { |
| 455 | inline-size: auto; |
| 456 | min-block-size: 0; |
| 457 | margin: 0; |
| 458 | padding: 0; |
| 459 | box-shadow: none; |
| 460 | } |
| 461 | /* Widows and orphans are the one typographic courtesy print gives |
| 462 | away for free, and a heading stranded at the foot of a page is |
| 463 | the thing people notice. */ |
| 464 | [docs-text] p { |
| 465 | orphans: 2; |
| 466 | widows: 2; |
| 467 | } |
| 468 | [docs-text] h1, |
| 469 | [docs-text] h2, |
| 470 | [docs-text] h3, |
| 471 | [docs-text] h4, |
| 472 | [docs-text] h5, |
| 473 | [docs-text] h6 { |
| 474 | break-after: avoid; |
| 475 | } |
| 476 | } |
| 477 | [docs-page-gap] { |
| 478 | display: flex; |
| 479 | align-items: center; |
| 480 | justify-content: flex-end; |
| 481 | block-size: var(--rst-sp-6); |
| 482 | margin-block: 1em; /* spacing-allow: the gap between two drawn pages, in the document's own text size */ |
| 483 | margin-inline: -1in; /* spacing-allow: out across the page's inch margins, to the sheet's edges */ |
| 484 | padding-inline-end: 1in; /* spacing-allow: the page number sits on the text's edge, an inch in */ |
| 485 | background: var(--docs-desk); |
| 486 | box-shadow: |
| 487 | inset 0 1px 0 rgb(23 32 60 / 0.10), |
| 488 | inset 0 6px 10px -6px rgb(23 32 60 / 0.22), |
| 489 | inset 0 -1px 0 rgb(23 32 60 / 0.06); |
| 490 | user-select: none; |
| 491 | } |
| 492 | /* The number of the page starting BELOW the gap. Quiet, and the |
| 493 | desk's ink rather than the paper's: it sits on the desk. */ |
| 494 | /* Furniture, so the chrome's face rather than one of the document's: |
| 495 | a webfont here would be held or swapped like the text. */ |
| 496 | [docs-page-number] { |
| 497 | color: var(--docs-desk-ink); |
| 498 | font-family: var(--rst-font, system-ui), sans-serif; |
| 499 | font-size: 9pt; |
| 500 | } |
| 501 | /* The Tools menu's two dialogs. Chrome, so they take the app's theme |
| 502 | tokens and repaint with the reader's light/dark preference — unlike |
| 503 | the paper, which does not. |
| 504 | |
| 505 | The backdrop is the browser's own; ::backdrop is the only way to |
| 506 | colour it and it needs no JavaScript. */ |
| 507 | [docs-dialog] { |
| 508 | max-inline-size: min(30rem, calc(100vw - var(--rst-sp-6))); |
| 509 | padding: var(--rst-sp-4); |
| 510 | border: 1px solid var(--rst-line); |
| 511 | /* A float: the suite's one floating radius (estilo menu.css). */ |
| 512 | border-radius: var(--estilo-float-radius); |
| 513 | background: var(--rst-surface); |
| 514 | color: var(--rst-text); |
| 515 | box-shadow: var(--rst-shadow-pop); |
| 516 | } |
| 517 | /* Opened by the server, not showModal(), so it is not in the top |
| 518 | layer: it floats over the desk itself, under the bars. */ |
| 519 | [docs-import-arrival][open] { |
| 520 | position: fixed; |
| 521 | inset-block-start: calc(var(--rst-sp-6) * 3); |
| 522 | inset-inline: 0; |
| 523 | margin-inline: auto; |
| 524 | max-block-size: calc(100vh - var(--rst-sp-6) * 4); |
| 525 | overflow: auto; |
| 526 | z-index: 30; |
| 527 | } |
| 528 | [docs-import-report] h2 { |
| 529 | margin-block: 0 var(--rst-sp-3); |
| 530 | } |
| 531 | [docs-import-report] ul { |
| 532 | padding-inline-start: var(--rst-sp-4); |
| 533 | } |
| 534 | [docs-dialog]::backdrop { |
| 535 | background: var(--rst-overlay); |
| 536 | } |
| 537 | [docs-dialog] h2 { |
| 538 | margin-block: 0 var(--rst-sp-3); |
| 539 | font-size: var(--rst-fs-lg, 1.1rem); |
| 540 | } |
| 541 | [docs-dialog] form { |
| 542 | display: flex; |
| 543 | justify-content: flex-end; |
| 544 | margin-block-start: var(--rst-sp-4); |
| 545 | } |
| 546 | /* Label on the left, number on the right, on one row each — the |
| 547 | shape every word processor's word count has, and the one that lets |
| 548 | a reader compare two numbers by scanning down a column. */ |
| 549 | [docs-dialog-rows] { |
| 550 | margin: 0; |
| 551 | } |
| 552 | [docs-dialog-rows] > div { |
| 553 | display: flex; |
| 554 | gap: var(--rst-sp-4); |
| 555 | justify-content: space-between; |
| 556 | padding-block: var(--rst-sp-1); |
| 557 | } |
| 558 | [docs-dialog-rows] > div + div { |
| 559 | border-block-start: 1px solid var(--rst-line); |
| 560 | } |
| 561 | [docs-dialog-rows] dt { |
| 562 | color: var(--rst-text-muted); |
| 563 | } |
| 564 | [docs-dialog-rows] dd { |
| 565 | margin: 0; |
| 566 | font-variant-numeric: tabular-nums; |
| 567 | } |
| 568 | [docs-shortcuts-group] { |
| 569 | margin-block: var(--rst-sp-3) var(--rst-sp-1); |
| 570 | color: var(--rst-text-muted); |
| 571 | font-size: var(--rst-fs-sm); |
| 572 | font-weight: 600; |
| 573 | } |
| 574 | [docs-shortcuts-row] { |
| 575 | display: flex; |
| 576 | align-items: baseline; |
| 577 | gap: var(--rst-sp-4); |
| 578 | justify-content: space-between; |
| 579 | padding-block: var(--rst-sp-1); |
| 580 | } |
| 581 | [docs-shortcuts-row] kbd { |
| 582 | color: var(--rst-text-muted); |
| 583 | font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; |
| 584 | font-size: var(--rst-fs-sm); |
| 585 | white-space: nowrap; |
| 586 | } |
| 587 | [docs-text] .docs-indent-1 { margin-inline-start: 0.5in; /* spacing-allow: an indent level, half an inch each, as Word and the PDF set it */ } |
| 588 | [docs-text] .docs-indent-2 { margin-inline-start: 1in; /* spacing-allow: an indent level, half an inch each, as Word and the PDF set it */ } |
| 589 | [docs-text] .docs-indent-3 { margin-inline-start: 1.5in; /* spacing-allow: an indent level, half an inch each, as Word and the PDF set it */ } |
| 590 | [docs-text] .docs-indent-4 { margin-inline-start: 2in; /* spacing-allow: an indent level, half an inch each, as Word and the PDF set it */ } |
| 591 | [docs-text] .docs-indent-5 { margin-inline-start: 2.5in; /* spacing-allow: an indent level, half an inch each, as Word and the PDF set it */ } |
| 592 | [docs-text] .docs-indent-6 { margin-inline-start: 3in; /* spacing-allow: an indent level, half an inch each, as Word and the PDF set it */ } |
| 593 | [docs-text] .docs-indent-7 { margin-inline-start: 3.5in; /* spacing-allow: an indent level, half an inch each, as Word and the PDF set it */ } |
| 594 | [docs-text] .docs-indent-8 { margin-inline-start: 4in; /* spacing-allow: an indent level, half an inch each, as Word and the PDF set it */ } |
| 595 | /* Paragraph alignment (fragment.rs's ALIGNMENTS table, and the same |
| 596 | class names in fixtures/editor-entry.js's schema and |
| 597 | fixtures/toolbar.mjs's controls). The first block-level formatting, |
| 598 | and the first class here that lands on a <p> rather than on a span |
| 599 | around a run — so unlike the marks above it is on the same element |
| 600 | as the margin rules below rather than inside them. |
| 601 | |
| 602 | Two classes, not three: left is what a paragraph already is, so it |
| 603 | spends no class and no attribute at all, which is what keeps a |
| 604 | document written before alignment existed rendering byte-identically |
| 605 | (core/tests/fragment.rs pins that). A value the renderer does not |
| 606 | know never reaches this stylesheet — it is dropped in Rust, before |
| 607 | any of it could reach attribute position. |
| 608 | |
| 609 | text-align, not margin arithmetic: the browser has the measured |
| 610 | line and CSS is how you ask it for this. internal/export/pdf.go has |
| 611 | to do the arithmetic by hand instead, offsetting each line within |
| 612 | the column it wrapped in, and internal/docs's own |
| 613 | TestTheAlignmentClassesSetTextAlign is what holds the two |
| 614 | descriptions of "centred" to each other. */ |
| 615 | [docs-text] .docs-align-center { |
| 616 | text-align: center; |
| 617 | } |
| 618 | [docs-text] .docs-align-right { |
| 619 | text-align: right; |
| 620 | } |
| 621 | /* First and last block lose their outer margin so [docs-page]'s own |
| 622 | 1in padding is the only air above the first line and below the |
| 623 | last — otherwise a leading <p> or <h1> would stack its own |
| 624 | margin-block-start on top of the page padding. */ |
| 625 | [docs-text] > :first-child { |
| 626 | margin-block-start: 0; |
| 627 | } |
| 628 | [docs-text] > :last-child { |
| 629 | margin-block-end: 0; |
| 630 | } |
| 631 | /* Paragraphs stack like lines rather than like blocks: nothing |
| 632 | before, nothing after. That is how Google Docs defines its own |
| 633 | "Normal text" (0pt before, 0pt after, 1.15 line spacing), and a |
| 634 | document pasted out of Docs is the ordinary case here. The 1em |
| 635 | that used to sit under every paragraph turned a list of short |
| 636 | paragraphs into a widely spaced document nobody asked for, and |
| 637 | put a double gap wherever the author had left a blank line of |
| 638 | their own. |
| 639 | |
| 640 | p:empty is what keeps that blank line, and it is load-bearing |
| 641 | rather than tidying. An empty paragraph reaches the read view as |
| 642 | `<p></p>` — core/src/fragment.rs's fragment_html emits exactly |
| 643 | that, and core/tests/fragment.rs pins it — and it was visible on |
| 644 | screen ONLY because it contributed the margin above. With that |
| 645 | margin gone it collapses to zero height, so a blank line would |
| 646 | still appear while editing, where ProseMirror puts a |
| 647 | `<br class="ProseMirror-trailingBreak">` inside an empty |
| 648 | textblock and :empty therefore does not match, and would then |
| 649 | silently vanish for a reader with no JavaScript. The other two |
| 650 | renderers already keep it: internal/export/pdf.go's paragraph |
| 651 | gives an empty paragraph a whole line box, and in Markdown the |
| 652 | paragraph break IS a blank line. This stylesheet was the one |
| 653 | that needed telling. */ |
| 654 | [docs-text] p { |
| 655 | margin-block: 0; |
| 656 | } |
| 657 | [docs-text] p:empty { |
| 658 | min-block-size: 1lh; |
| 659 | } |
| 660 | /* Headings clamp to level 1-6 (fragment.rs), but every seed document |
| 661 | today only ever produces <h2> (generate-seed.mjs's block |
| 662 | classifier) — sized so a heading reads as a heading against 12pt |
| 663 | body text without shouting the way a bare browser default h1 |
| 664 | would. */ |
| 665 | [docs-text] h1, |
| 666 | [docs-text] h2, |
| 667 | [docs-text] h3, |
| 668 | [docs-text] h4, |
| 669 | [docs-text] h5, |
| 670 | [docs-text] h6 { |
| 671 | font-family: inherit; |
| 672 | font-weight: 700; |
| 673 | line-height: 1.3; |
| 674 | margin-block: 1.5em 0.5em; /* spacing-allow: the document's headings, in its own text size, as the PDF sets them */ |
| 675 | } |
| 676 | [docs-text] h1 { |
| 677 | font-size: 1.6em; |
| 678 | } |
| 679 | [docs-text] h2 { |
| 680 | font-size: 1.3em; |
| 681 | } |
| 682 | [docs-text] h3 { |
| 683 | font-size: 1.1em; |
| 684 | } |
| 685 | [docs-text] h4, |
| 686 | [docs-text] h5, |
| 687 | [docs-text] h6 { |
| 688 | font-size: 1em; |
| 689 | font-style: italic; |
| 690 | } |
| 691 | /* A list stacks like the paragraphs around it, and its items stack |
| 692 | like each other — both follow from the rule above rather than |
| 693 | being a second opinion about density. A list keeping 1em below it |
| 694 | and nothing above would carry a gap on one side of itself only, |
| 695 | because the other side used to come from the paragraph before it; |
| 696 | and an `li` keeping 0.35em would leave items further apart than |
| 697 | two paragraphs are, inverting the one relationship a reader can |
| 698 | actually see (a list is tighter than the prose around it, not |
| 699 | looser). Headings and blockquotes keep their own margins: those |
| 700 | were never supplied by a neighbouring paragraph, so nothing here |
| 701 | changes what they need. |
| 702 | |
| 703 | `li > :last-child` still earns its place with `p` at zero — a |
| 704 | nested list, or a blockquote inside an item, has margins of its |
| 705 | own for it to cancel. */ |
| 706 | [docs-text] ul, |
| 707 | [docs-text] ol { |
| 708 | margin-block: 0; |
| 709 | padding-inline-start: 1.4em; /* spacing-allow: a list's indent in the document's text size */ |
| 710 | } |
| 711 | [docs-text] li > :last-child { |
| 712 | margin-block-end: 0; |
| 713 | } |
| 714 | [docs-text] blockquote { |
| 715 | margin-block: 1em; /* spacing-allow: a quotation's space in the document's text size */ |
| 716 | margin-inline: 0; |
| 717 | padding-inline-start: 1em; /* spacing-allow: the quotation's indent from its rule, in the document's text size */ |
| 718 | border-inline-start: 3px solid #c8c8c8; |
| 719 | color: #4a4a4a; |
| 720 | font-style: italic; |
| 721 | } |
| 722 | [docs-text] strong { |
| 723 | font-weight: 700; |
| 724 | } |
| 725 | [docs-text] em { |
| 726 | font-style: italic; |
| 727 | } |
| 728 | [docs-text] code { |
| 729 | font-size: 0.85em; |
| 730 | background: #f0f0f0; |
| 731 | padding: 0.15em 0.35em; /* spacing-allow: inline code's tint around its letters, in the text's size */ |
| 732 | border-radius: 3px; |
| 733 | } |
| 734 | |
| 735 | /* Images (Docs images spec §2.4, §4.1): the read view's markup and |
| 736 | the editor's NodeView draw the same <img>, at most the text's width |
| 737 | and in its own proportions. One that cannot be drawn is a fixed box |
| 738 | saying so, with its alt text under it. */ |
| 739 | [docs-text] img { |
| 740 | max-inline-size: 100%; |
| 741 | block-size: auto; |
| 742 | vertical-align: bottom; |
| 743 | } |
| 744 | [docs-text] .docs-image-missing, |
| 745 | [docs-text] [docs-image-missing] { |
| 746 | display: inline-flex; |
| 747 | flex-direction: column; |
| 748 | justify-content: center; |
| 749 | gap: var(--rst-sp-1); |
| 750 | min-inline-size: 12em; |
| 751 | min-block-size: 6em; |
| 752 | padding: var(--rst-sp-3); |
| 753 | border: 1px dashed #b8b8b8; |
| 754 | border-radius: 4px; |
| 755 | background: #f6f6f6; |
| 756 | color: #5a5a5a; |
| 757 | font-size: 0.85em; |
| 758 | font-style: normal; |
| 759 | vertical-align: bottom; |
| 760 | } |
| 761 | [docs-image-missing-alt] { |
| 762 | color: #4a4a4a; |
| 763 | font-style: italic; |
| 764 | } |
| 765 | /* The editor's frame holds the picture exactly, so the badge, the |
| 766 | bubble and the description field can sit over it. */ |
| 767 | [docs-image-frame] { |
| 768 | position: relative; |
| 769 | display: inline-block; |
| 770 | max-inline-size: 100%; |
| 771 | vertical-align: bottom; |
| 772 | } |
| 773 | [docs-image-frame][docs-image-selected] img, |
| 774 | [docs-image-frame][docs-image-selected] [docs-image-missing] { |
| 775 | outline: 2px solid var(--rst-focus, #2b6cd4); |
| 776 | outline-offset: 2px; |
| 777 | } |
| 778 | [docs-alt-badge] { |
| 779 | position: absolute; |
| 780 | inset-inline-start: var(--rst-sp-2); |
| 781 | inset-block-end: var(--rst-sp-2); |
| 782 | min-inline-size: 28px; |
| 783 | min-block-size: 24px; |
| 784 | padding: 0 var(--rst-sp-1); |
| 785 | border: 1px solid #fff; |
| 786 | border-radius: 4px; |
| 787 | background: rgba(20, 20, 20, 0.72); |
| 788 | color: #fff; |
| 789 | font: 600 11px/1 var(--rst-font-sans, system-ui); |
| 790 | letter-spacing: 0.04em; |
| 791 | cursor: pointer; |
| 792 | opacity: 0; |
| 793 | } |
| 794 | [docs-alt-badge="missing"] { |
| 795 | border-style: dashed; |
| 796 | background: rgba(20, 20, 20, 0.5); |
| 797 | opacity: 1; |
| 798 | } |
| 799 | [docs-image-frame]:hover [docs-alt-badge], |
| 800 | [docs-image-frame][docs-image-selected] [docs-alt-badge], |
| 801 | [docs-alt-badge]:focus-visible { |
| 802 | opacity: 1; |
| 803 | } |
| 804 | [docs-image-bubble] { |
| 805 | position: absolute; |
| 806 | inset-inline-end: var(--rst-sp-2); |
| 807 | inset-block-start: var(--rst-sp-2); |
| 808 | display: none; |
| 809 | gap: var(--rst-sp-1); |
| 810 | padding: var(--rst-sp-1); |
| 811 | border-radius: var(--rst-radius-sm, 6px); |
| 812 | background: var(--rst-surface, #fff); |
| 813 | box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18); |
| 814 | font: 13px/1.2 var(--rst-font-sans, system-ui); |
| 815 | font-style: normal; |
| 816 | white-space: nowrap; |
| 817 | } |
| 818 | [docs-image-frame][docs-image-selected] [docs-image-bubble] { |
| 819 | display: inline-flex; |
| 820 | } |
| 821 | [docs-alt] { |
| 822 | position: absolute; |
| 823 | inset-inline: 0; |
| 824 | inset-block-end: 0; |
| 825 | display: flex; |
| 826 | flex-direction: column; |
| 827 | gap: var(--rst-sp-1); |
| 828 | padding: var(--rst-sp-2); |
| 829 | background: rgba(255, 255, 255, 0.94); |
| 830 | font: 13px/1.3 var(--rst-font-sans, system-ui); |
| 831 | font-style: normal; |
| 832 | } |
| 833 | [docs-alt="popover"] { |
| 834 | inset-block-end: auto; |
| 835 | inset-block-start: 100%; |
| 836 | inline-size: max(16rem, 100%); |
| 837 | z-index: 2; |
| 838 | border-radius: var(--rst-radius-sm, 6px); |
| 839 | box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18); |
| 840 | } |
| 841 | [docs-alt] textarea { |
| 842 | resize: none; |
| 843 | font: inherit; |
| 844 | padding: var(--rst-sp-1); |
| 845 | } |
| 846 | /* An upload's place while it uploads: a box of fixed height with the |
| 847 | file's name and its progress, never a node (§2.3). On failure it |
| 848 | says why and offers Retry and Remove. */ |
| 849 | [docs-upload] { |
| 850 | display: inline-flex; |
| 851 | flex-wrap: wrap; |
| 852 | align-items: center; |
| 853 | gap: var(--rst-sp-2); |
| 854 | min-inline-size: 14em; |
| 855 | max-inline-size: 100%; |
| 856 | min-block-size: 4em; |
| 857 | padding: var(--rst-sp-2) var(--rst-sp-3); |
| 858 | border: 1px dashed #b8b8b8; |
| 859 | border-radius: 4px; |
| 860 | background: #f6f6f6; |
| 861 | color: #4a4a4a; |
| 862 | font: 13px/1.3 var(--rst-font-sans, system-ui); |
| 863 | font-style: normal; |
| 864 | vertical-align: bottom; |
| 865 | user-select: none; |
| 866 | } |
| 867 | [docs-upload="failed"] { |
| 868 | border-color: #c0392b; |
| 869 | background: #fdf3f2; |
| 870 | } |
| 871 | [docs-upload-name] { |
| 872 | font-weight: 600; |
| 873 | overflow-wrap: anywhere; |
| 874 | } |
| 875 | [docs-upload-actions] { |
| 876 | display: inline-flex; |
| 877 | gap: var(--rst-sp-1); |
| 878 | } |
| 879 | .docs-dropcursor { |
| 880 | background: var(--rst-focus, #2b6cd4); |
| 881 | } |
| 882 | [docs-images-live] { |
| 883 | position: absolute; |
| 884 | inline-size: 1px; |
| 885 | block-size: 1px; |
| 886 | overflow: hidden; |
| 887 | clip-path: inset(50%); |
| 888 | white-space: nowrap; |
| 889 | } |
| 890 | |
| 891 | /* [docs-editor] is the same element as [docs-text] above — the |
| 892 | mount point, which ProseMirror turns into the contenteditable |
| 893 | surface itself ({mount: el}, editor-entry.js). Two rules it needs |
| 894 | that the scriptless read view does not: |
| 895 | |
| 896 | flex: 1 0 auto (with [docs-page]'s own column flex above) grows |
| 897 | the editable node down to the bottom of the page's text area |
| 898 | instead of stopping at the last line of prose. Without it a click |
| 899 | in the empty space below the final paragraph lands on [docs-page] |
| 900 | — not on anything editable — and nothing happens, which reads as |
| 901 | a broken document rather than a short one. Basis auto and |
| 902 | flex-shrink 0 so a document longer than one page still lays out |
| 903 | at its own height and pushes the page taller, rather than being |
| 904 | squeezed back into 11in. |
| 905 | |
| 906 | outline: none drops the browser's default focus ring. Every |
| 907 | browser draws one around a focused contenteditable, which here |
| 908 | meant a blue box tracing the text area of the paper — paper does |
| 909 | not have a focus ring, and the caret already says where typing |
| 910 | will go. This is the one case where removing an outline costs no |
| 911 | accessibility: the element's own text cursor is a stronger, |
| 912 | always-visible focus indicator than the ring it replaces, unlike |
| 913 | a button or a link where the ring is the only signal. Buttons in |
| 914 | the chrome above keep rastrillo's own focus styling untouched. */ |
| 915 | [docs-editor] { |
| 916 | flex: 1 0 auto; |
| 917 | } |
| 918 | [docs-editor]:focus, |
| 919 | [docs-editor]:focus-visible { |
| 920 | outline: none; |
| 921 | } |
| 922 | |
| 923 | /* [docs-chrome] is the slab of chrome between the estilo bar and the |
| 924 | paper. It held two strips, the menu bar over the formatting bar, |
| 925 | until I2 (spec 2026-11-11) moved the menu bar into the estilo bar |
| 926 | (chrome.Bar.Menubar): it now holds the formatting strip and, below |
| 927 | 800px, the strip's undo/redo pair; from 64rem the strip is the |
| 928 | floating inspector and the slab holds nothing in flow. |
| 929 | |
| 930 | Sticky, so a formatting bar is there when a person is writing on |
| 931 | the third page, not only the first. |
| 932 | |
| 933 | Chrome, not paper: unlike [docs-page] and [docs-text] these take |
| 934 | the app's theme tokens and repaint with the reader's light/dark |
| 935 | preference. */ |
| 936 | /* ONE sticky element, wrapping both strips — not two. |
| 937 | The menu bar and [docs-bar] were each `position: sticky; |
| 938 | inset-block-start: 0` for about an hour, which does not stack: two |
| 939 | sticky siblings pinned to the same offset occupy the same band, so |
| 940 | on the first scroll the formatting bar slid underneath the menu bar |
| 941 | and was gone. Found in review before it was pushed, and worth the |
| 942 | comment because the broken version looks obviously right — each bar |
| 943 | "sticks to the top" is exactly what you would write. |
| 944 | A container that sticks, holding two children that do not, is the |
| 945 | shape that actually keeps them in order. */ |
| 946 | /* Below the estilo bar, which is sticky too: the published height, |
| 947 | never a copied 52px (spec §5.3). z-index 3 stays under the bar's 45, |
| 948 | so the account menu paints over the menubar and the toolbar. */ |
| 949 | [docs-chrome] { |
| 950 | position: sticky; |
| 951 | inset-block-start: var(--estilo-bar-block-size); |
| 952 | z-index: 3; |
| 953 | background: var(--rst-surface); |
| 954 | border-block-end: 1px solid var(--rst-line); |
| 955 | } |
| 956 | /* A reader's slab holds only the font notes: no rule of its own under |
| 957 | the header's. */ |
| 958 | [docs-chrome]:not(:has([docs-bar])) { |
| 959 | border-block-end: 0; |
| 960 | } |
| 961 | [docs-bar] { |
| 962 | display: flex; |
| 963 | flex-wrap: wrap; |
| 964 | align-items: center; |
| 965 | gap: var(--rst-sp-2); |
| 966 | padding: var(--rst-sp-2) var(--rst-sp-4); |
| 967 | } |
| 968 | /* What the page says about its fonts (fixtures/font-status.mjs): a |
| 969 | strip hanging just under the bars, over the tray and the page's top |
| 970 | margin, which hold no text and no control (branch review 8: laid |
| 971 | over the formatting bar, it covered the controls a person tabbed |
| 972 | to). It takes no space of its own, so saying something moves |
| 973 | nothing, and it wraps rather than clipping; the tray above the page |
| 974 | is kept tall enough for one line of it at every width |
| 975 | ([docs-canvas] below), and the gate makes room for the longer |
| 976 | substitutes note before the page is shown. Empty and transparent |
| 977 | when there is nothing to say, but still in the page: its text is a |
| 978 | live region, which is only heard if it was there before the text |
| 979 | changed. */ |
| 980 | [docs-fonts-status] { |
| 981 | position: absolute; |
| 982 | inset-inline: 0; |
| 983 | inset-block-start: 100%; |
| 984 | /* Under the bars' own menus: an open File menu draws over it. Still |
| 985 | above the page, because the bars' stacking context is. */ |
| 986 | z-index: -1; |
| 987 | display: flex; |
| 988 | align-items: center; |
| 989 | gap: var(--rst-sp-2); |
| 990 | padding: var(--rst-sp-1) var(--rst-sp-4); |
| 991 | background: var(--rst-surface); |
| 992 | border-block-end: 1px solid var(--rst-line); |
| 993 | color: var(--rst-text); |
| 994 | font-size: var(--rst-fs-sm); |
| 995 | opacity: 0; |
| 996 | pointer-events: none; |
| 997 | } |
| 998 | [docs-fonts-status][data-state] { |
| 999 | opacity: 1; |
| 1000 | pointer-events: auto; |
| 1001 | } |
| 1002 | [docs-fonts-status-text] { |
| 1003 | flex: 1 1 auto; |
| 1004 | min-inline-size: 0; |
| 1005 | margin: 0; |
| 1006 | overflow-wrap: anywhere; |
| 1007 | } |
| 1008 | [docs-fonts-status-dismiss] { |
| 1009 | flex: none; |
| 1010 | min-inline-size: 28px; |
| 1011 | min-block-size: 28px; |
| 1012 | display: none; |
| 1013 | padding: 0; |
| 1014 | border: 0; |
| 1015 | border-radius: var(--rst-radius-sm); |
| 1016 | background: transparent; |
| 1017 | color: inherit; |
| 1018 | cursor: pointer; |
| 1019 | } |
| 1020 | [docs-fonts-status-dismiss]:hover { |
| 1021 | background: var(--rst-surface-2, rgba(0, 0, 0, 0.06)); |
| 1022 | } |
| 1023 | [docs-fonts-status][data-state="notice"] [docs-fonts-status-dismiss], |
| 1024 | [docs-fonts-status][data-state="unavailable"] [docs-fonts-status-dismiss], |
| 1025 | [docs-fonts-status][data-state="substitute"] [docs-fonts-status-dismiss] { |
| 1026 | display: inline-flex; |
| 1027 | align-items: center; |
| 1028 | justify-content: center; |
| 1029 | } |
| 1030 | /* The menu bar's titles and panels are estilo's ([estilo-menubar], |
| 1031 | [estilo-menu], estilo menu.css): the one menu style the suite shares, |
| 1032 | square titles in the page flow and a 9px floating panel with inset |
| 1033 | rows, a check column and a key column. The [docs-menu-*] rules that |
| 1034 | used to be here drew a second, different menu (6px panels, full-bleed |
| 1035 | rows, 6px rounded titles) and are gone. */ |
| 1036 | /* [docs-toolbar] is a sibling of [docs-canvas], never inside |
| 1037 | [docs-editor]: ProseMirror's {mount: el} takes over everything |
| 1038 | inside that element, so a toolbar rendered in there would be |
| 1039 | replaced by the document on the first mount. */ |
| 1040 | /* flex: 1 1 auto is the CLS fix, measured. As a content-sized flex item |
| 1041 | the toolbar was laid out in the first paint at 645px wide and three |
| 1042 | rows tall at 1440px: that paint happens while the parser is still |
| 1043 | running, before ui/select.js has swapped the three native selects for |
| 1044 | their comboboxes, and a wrapping flex container sized to its content |
| 1045 | wraps. Then it settled to one 28px row, and the paper below jumped |
| 1046 | 60px: a layout shift of 0.137 on six or seven document loads in |
| 1047 | twelve, on main as well as here (polish-audit/shots r2 notes). Taking |
| 1048 | the bar's width from the start, it has room for the native selects |
| 1049 | too; with the group rule below, the first paint is the last. */ |
| 1050 | [docs-toolbar] { |
| 1051 | display: flex; |
| 1052 | flex: 1 1 auto; |
| 1053 | min-inline-size: 0; |
| 1054 | flex-wrap: wrap; |
| 1055 | align-items: center; |
| 1056 | gap: var(--rst-sp-1); |
| 1057 | } |
| 1058 | /* A group wraps inside itself, and that is not the same claim as |
| 1059 | the gap/rule one below. The three <select>s — Style, Font, Size — |
| 1060 | are one group, and a <select>'s automatic minimum size is its |
| 1061 | widest option, so at 320px (§10.3's reflow width, which this app |
| 1062 | supports without exemption) the three of them measure wider than |
| 1063 | the bar and the page grows a horizontal scrollbar: SC 1.4.10, |
| 1064 | failed. Letting the group wrap and letting each control shrink |
| 1065 | below its content — min-inline-size: 0, which is what actually |
| 1066 | lifts that automatic minimum — is what keeps the row inside the |
| 1067 | viewport. The rule between groups survives a wrap, so the |
| 1068 | grouping still reads once it has happened. |
| 1069 | |
| 1070 | This predates the bar being restructured around it; it was not |
| 1071 | introduced by that work and is, if anything, slightly less bad |
| 1072 | than it was. The toolbar used to sit inside [rst-page] and get |
| 1073 | 320 - 32 (the shell's padding) - 32 (its own) = 256px at this |
| 1074 | width; it now gets 320 - 32 = 288px, because the shell no longer |
| 1075 | pads this screen. Both overflow. Measured at 320px in Chromium, |
| 1076 | before and after. */ |
| 1077 | [docs-toolbar-group] { |
| 1078 | display: flex; |
| 1079 | flex-wrap: wrap; |
| 1080 | align-items: center; |
| 1081 | gap: 2px; /* spacing-allow: a group's 32px tools sit as one set, a hairline apart */ |
| 1082 | } |
| 1083 | /* ...but only where it has to. Chrome sizes a wrapping flex container |
| 1084 | by its widest item, not by the sum of them, so with wrap on, the Style, |
| 1085 | Font and Size group was laid out one select per row in the first paint |
| 1086 | (88px tall, before ui/select.js has run) and then collapsed to one row: |
| 1087 | the 0.137 layout shift the toolbar rule above also answers. At 40rem |
| 1088 | and wider the three always fit on a line, so they are held on one. */ |
| 1089 | @media (min-width: 40rem) { |
| 1090 | [docs-toolbar-group] { |
| 1091 | flex-wrap: nowrap; |
| 1092 | } |
| 1093 | } |
| 1094 | /* A rule between groups rather than a wider gap: at 320px (§10.3's |
| 1095 | reflow width) the bar wraps, and a gap that has wrapped tells a |
| 1096 | reader nothing about which controls belong together. */ |
| 1097 | [docs-toolbar-group] + [docs-toolbar-group] { |
| 1098 | margin-inline-start: var(--rst-sp-2); |
| 1099 | padding-inline-start: var(--rst-sp-2); |
| 1100 | border-inline-start: 1px solid var(--rst-line); |
| 1101 | } |
| 1102 | /* 28px, comfortably over WCAG 2.2 AA's 24x24 minimum target |
| 1103 | (AGENTS.md: no exemptions). Nothing here touches :focus-visible — |
| 1104 | the editable surface drops its focus ring on the argument that a |
| 1105 | caret says more, and that argument does not extend to a button, |
| 1106 | which has no caret. */ |
| 1107 | [docs-tool] { |
| 1108 | display: inline-flex; |
| 1109 | align-items: center; |
| 1110 | justify-content: center; |
| 1111 | min-inline-size: 32px; |
| 1112 | min-block-size: 32px; |
| 1113 | padding: 0 var(--rst-sp-1); |
| 1114 | border: 0; |
| 1115 | /* Rounded, like the dock they sit in (below). The square |
| 1116 | borderless buttons of the shared-chrome round (spec §13 Q4) sat |
| 1117 | in a full-width strip; inside a rounded bar a square highlight |
| 1118 | reads as a mistake. */ |
| 1119 | border-radius: var(--rst-radius-sm); |
| 1120 | background: transparent; |
| 1121 | background-image: var(--docs-flare); |
| 1122 | color: var(--rst-text); |
| 1123 | font: inherit; |
| 1124 | line-height: 1; |
| 1125 | cursor: pointer; |
| 1126 | } |
| 1127 | /* Hovered, a button lights where the pointer is on it (brand/ |
| 1128 | pointer.js writes --rst-mx/--rst-my; centred without it). */ |
| 1129 | [docs-tool]:hover:not(:disabled) { |
| 1130 | background-color: var(--rst-surface-2); |
| 1131 | background-image: |
| 1132 | var(--docs-flare), |
| 1133 | radial-gradient(40px circle at var(--rst-mx, 50%) var(--rst-my, 50%), light-dark(color-mix(in srgb, var(--rst-accent) 18%, transparent), color-mix(in srgb, var(--rst-accent) 8%, transparent)), transparent 75%); |
| 1134 | } |
| 1135 | /* aria-pressed is the state, and colour is not allowed to be the only |
| 1136 | thing that shows it (§10.3, and AGENTS.md's "no exemptions"). |
| 1137 | |
| 1138 | This rule used to lean on `font-weight: 700` for that, and the |
| 1139 | comment used to say so. Weight does nothing to an SVG icon, and six |
| 1140 | of the nine controls in this bar are icon-only. Worse, the pressed |
| 1141 | background is the SAME `--rst-accent-soft` as :hover above, so a |
| 1142 | hovered unpressed button and a pressed one differed by icon hue |
| 1143 | alone — which is exactly the thing §10.3 forbids, asserted by a |
| 1144 | comment to be handled while it was not. |
| 1145 | |
| 1146 | A complete 1px ring is what carries it: present or absent, |
| 1147 | independent of hue, and equally legible on the icon buttons and on |
| 1148 | B/I/<>. The weight stays because it still helps the three lettered |
| 1149 | buttons; it is no longer what this rule depends on. |
| 1150 | |
| 1151 | It was a 2px rule under the glyph until Paul looked at it |
| 1152 | (2026-09-02) and asked for "simple borders, not the weird rounded |
| 1153 | one-side". He was reading a real defect, not a preference: a |
| 1154 | one-sided rule inside a box with `border-radius` does not stop at |
| 1155 | the corner, it follows the curve, so the underline turned up at |
| 1156 | both ends and the pressed button read as a tab or a tooltip stem |
| 1157 | rather than a selected control. Either the rule or the radius had |
| 1158 | to go, and the radius is the house style every other control on |
| 1159 | this screen is drawn with. |
| 1160 | |
| 1161 | Still box-shadow rather than `border`, and for the reason the |
| 1162 | previous comment gave: it costs no layout, so it cannot shrink the |
| 1163 | 28px target and cannot widen the bar. That last part is not |
| 1164 | housekeeping — the toolbar has to fit 320px (AGENTS.md's reflow |
| 1165 | rule, no exemptions), and a real 1px border on nine buttons would |
| 1166 | have spent 18px of that budget to say the same thing. `inset 0 0 0 |
| 1167 | 1px` draws the ring on the inside of the same box, following the |
| 1168 | same radius the rest of the control already has. */ |
| 1169 | [docs-tool][aria-pressed="true"] { |
| 1170 | background: var(--rst-accent-soft); |
| 1171 | color: var(--rst-accent); |
| 1172 | font-weight: 700; |
| 1173 | box-shadow: inset 0 0 0 1px color-mix(in oklab, currentColor 45%, transparent); |
| 1174 | } |
| 1175 | [docs-tool]:disabled { |
| 1176 | color: var(--rst-text-faint); |
| 1177 | cursor: default; |
| 1178 | } |
| 1179 | /* Forced colours drop the pressed tint and the inset ring (a box |
| 1180 | shadow), so a pressed control looked like every other: it keeps a |
| 1181 | Highlight outline there, in the strip and the inspector alike |
| 1182 | (review on #106). */ |
| 1183 | @media (forced-colors: active) { |
| 1184 | /* Pressed is a colour everywhere else, which forced colours take |
| 1185 | away: an outline says it instead, on the toolbar's tools (and so |
| 1186 | the sheet's chips) and on the quick bar's. */ |
| 1187 | [docs-tool][aria-pressed="true"], |
| 1188 | [docs-qtool][aria-pressed="true"], |
| 1189 | [docs-qtool][aria-expanded="true"] { |
| 1190 | outline: 2px solid Highlight; |
| 1191 | outline-offset: -2px; |
| 1192 | } |
| 1193 | } |
| 1194 | /* A button's name as a tooltip, drawn here rather than by the |
| 1195 | browser's title attribute: Safari placed that one at the corner |
| 1196 | of the window, far from the button, inside the blurred dock. The |
| 1197 | name is the button's aria-label, the same words a screen reader |
| 1198 | hears. It waits half a second, so it never flickers along the bar |
| 1199 | under a passing pointer, and keyboard focus shows it too, at once. |
| 1200 | Only at 40rem and wider: below that the bar is a sideways scroller, |
| 1201 | where a tooltip under it would be clipped and would make the strip |
| 1202 | scroll vertically. */ |
| 1203 | @media (hover: hover) and (min-width: 40rem) { |
| 1204 | [docs-tool] { |
| 1205 | position: relative; |
| 1206 | } |
| 1207 | [docs-tool]::after { |
| 1208 | content: attr(aria-label); |
| 1209 | position: absolute; |
| 1210 | inset-block-start: calc(100% + 8px); |
| 1211 | inset-inline-start: 50%; |
| 1212 | z-index: 5; |
| 1213 | translate: -50% -2px; |
| 1214 | padding: var(--rst-sp-1) var(--rst-sp-2); |
| 1215 | border-radius: 6px; |
| 1216 | background: light-dark(#262a33, #eceef2); |
| 1217 | color: light-dark(#ffffff, #15171c); |
| 1218 | font: 500 12px/1.3 var(--rst-font, system-ui), sans-serif; |
| 1219 | white-space: nowrap; |
| 1220 | pointer-events: none; |
| 1221 | opacity: 0; |
| 1222 | transition: opacity 120ms ease, translate 120ms ease; |
| 1223 | } |
| 1224 | [docs-tool]:hover::after { |
| 1225 | opacity: 1; |
| 1226 | translate: -50% 0; |
| 1227 | transition-delay: 500ms; |
| 1228 | } |
| 1229 | [docs-tool]:focus-visible::after { |
| 1230 | opacity: 1; |
| 1231 | translate: -50% 0; |
| 1232 | } |
| 1233 | [docs-tool]:disabled::after { |
| 1234 | display: none; |
| 1235 | } |
| 1236 | } |
| 1237 | [docs-tool] svg { |
| 1238 | inline-size: 20px; |
| 1239 | block-size: 20px; |
| 1240 | fill: none; |
| 1241 | stroke: currentColor; |
| 1242 | stroke-width: 1.6; |
| 1243 | stroke-linecap: round; |
| 1244 | stroke-linejoin: round; |
| 1245 | } |
| 1246 | /* The letterforms are the icon for bold, italic and code — every |
| 1247 | editor a person has used draws them this way, and a B that is |
| 1248 | actually bold says more than a glyph of one would. System faces: |
| 1249 | the chrome loads no webfont, so it has nothing to hold or swap. */ |
| 1250 | [docs-tool-glyph] { |
| 1251 | font-size: 15px; |
| 1252 | } |
| 1253 | [docs-tool-glyph="bold"] { |
| 1254 | font-family: Georgia, "Times New Roman", serif; |
| 1255 | font-weight: 700; |
| 1256 | } |
| 1257 | [docs-tool-glyph="italic"] { |
| 1258 | font-family: Georgia, "Times New Roman", serif; |
| 1259 | font-style: italic; |
| 1260 | } |
| 1261 | [docs-tool-glyph="code"] { |
| 1262 | font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; |
| 1263 | font-size: 13px; |
| 1264 | } |
| 1265 | [docs-tool-select] { |
| 1266 | min-block-size: 28px; |
| 1267 | /* min-inline-size: 0 lifts the automatic minimum size, which for |
| 1268 | a <select> is its widest option — see [docs-toolbar-group]'s |
| 1269 | own comment for what that overflows and where. Wrapping is what |
| 1270 | actually resolves the 320px case, and it is the better of the |
| 1271 | two outcomes: these three controls carry words, and a control |
| 1272 | shrunk under its widest word is a control you cannot read. This |
| 1273 | only takes over if a viewport is narrow enough that even one of |
| 1274 | them will not fit on a line of its own. */ |
| 1275 | min-inline-size: 0; |
| 1276 | max-inline-size: 11rem; |
| 1277 | padding: 0 var(--rst-sp-1); |
| 1278 | border: 1px solid var(--rst-line); |
| 1279 | border-radius: var(--rst-radius-sm); |
| 1280 | background: var(--rst-surface); |
| 1281 | color: var(--rst-text); |
| 1282 | font-size: var(--rst-fs-sm); |
| 1283 | } |
| 1284 | /* Once ui/select.js has run, the native <select> is visually hidden |
| 1285 | and the control a person actually uses is an [rst-combo] wrapper |
| 1286 | inserted just before it. Every constraint that was on the select |
| 1287 | has to move onto the wrapper, or it stops applying at exactly the |
| 1288 | moment the enhancement lands. |
| 1289 | |
| 1290 | The width cap is the one that matters. [docs-toolbar-group]'s own |
| 1291 | comment explains at length why these three controls carry |
| 1292 | min-inline-size: 0 and a max — a control whose automatic minimum is |
| 1293 | its widest option overflows the bar at 320px, and this app supports |
| 1294 | that width without exemption. select.js's input is width: 100% of |
| 1295 | its wrapper, so an uncapped wrapper reintroduces exactly the reflow |
| 1296 | failure that comment was written about. */ |
| 1297 | [docs-toolbar] [rst-combo] { |
| 1298 | position: relative; |
| 1299 | min-inline-size: 0; |
| 1300 | max-inline-size: 11rem; |
| 1301 | } |
| 1302 | [docs-toolbar] [rst-combo] [rst-input] { |
| 1303 | inline-size: 100%; |
| 1304 | min-block-size: 28px; |
| 1305 | padding: 0 var(--rst-sp-1); |
| 1306 | border: 1px solid var(--rst-line); |
| 1307 | border-radius: var(--rst-radius-sm); |
| 1308 | background: var(--rst-surface); |
| 1309 | color: var(--rst-text); |
| 1310 | font: inherit; |
| 1311 | font-size: var(--rst-fs-sm); |
| 1312 | } |
| 1313 | /* A list is at least its combobox's width and otherwise as wide as its |
| 1314 | widest row, so no row wraps: a font row is its family's name in that |
| 1315 | family's face, and Liberation Mono's is wider than the 11rem box. |
| 1316 | Every row is then one line, the same height. The phone rule below |
| 1317 | restates this for its fixed, anchored lists, and wins by order. */ |
| 1318 | [docs-toolbar] [rst-combo-list] { |
| 1319 | inset-inline-end: auto; |
| 1320 | box-sizing: border-box; |
| 1321 | min-inline-size: 100%; |
| 1322 | inline-size: max-content; |
| 1323 | } |
| 1324 | /* A phone: one row that scrolls sideways, not three rows of wrapped |
| 1325 | controls with separators stranded at the starts of lines (the audit's |
| 1326 | "crowded at 390px"). The toolbar is its own horizontal scroller, so |
| 1327 | the page never overflows, and nothing wraps, so the first paint is |
| 1328 | already the final one (CLS stays 0). |
| 1329 | |
| 1330 | The catch is the three comboboxes: their lists are absolutely |
| 1331 | positioned under the input, and inside a scroller they would be |
| 1332 | clipped. Anchor positioning takes them out: each list is fixed to the |
| 1333 | viewport and anchored to its own combobox. Where a browser has no |
| 1334 | anchor positioning (Firefox, today) the whole rule is skipped and the |
| 1335 | bar wraps as before, which is crowded but every list still opens. */ |
| 1336 | @media (max-width: 39.99rem) { |
| 1337 | @supports (anchor-name: --docs-probe) { |
| 1338 | [docs-toolbar] { |
| 1339 | flex-wrap: nowrap; |
| 1340 | overflow-x: auto; |
| 1341 | /* Not auto, which overflow-x: auto would make it: the combos' |
| 1342 | absolutely placed live regions reach 13px below the bar, and |
| 1343 | the strip then scrolled up and down under a finger. */ |
| 1344 | overflow-y: hidden; |
| 1345 | overscroll-behavior-x: contain; |
| 1346 | scrollbar-width: thin; |
| 1347 | padding-block-end: 2px; /* spacing-allow: room for the thin scrollbar under the strip's tools */ |
| 1348 | } |
| 1349 | [docs-toolbar-group] { |
| 1350 | flex: none; |
| 1351 | flex-wrap: nowrap; |
| 1352 | } |
| 1353 | [docs-toolbar] [rst-combo], |
| 1354 | [docs-tool-select] { |
| 1355 | flex: none; |
| 1356 | inline-size: 7.5rem; |
| 1357 | } |
| 1358 | [docs-toolbar] [rst-combo]:has(#docs-select-size-combo), |
| 1359 | #docs-select-size { |
| 1360 | inline-size: 4.5rem; |
| 1361 | } |
| 1362 | [docs-toolbar] [rst-combo]:has(#docs-select-block-combo) { anchor-name: --docs-select-block; } |
| 1363 | [docs-toolbar] [rst-combo]:has(#docs-select-font-combo) { anchor-name: --docs-select-font; } |
| 1364 | [docs-toolbar] [rst-combo]:has(#docs-select-size-combo) { anchor-name: --docs-select-size; } |
| 1365 | [docs-toolbar] [rst-combo]:has(#docs-select-block-combo) [rst-combo-list] { position-anchor: --docs-select-block; } |
| 1366 | [docs-toolbar] [rst-combo]:has(#docs-select-font-combo) [rst-combo-list] { position-anchor: --docs-select-font; } |
| 1367 | [docs-toolbar] [rst-combo]:has(#docs-select-size-combo) [rst-combo-list] { position-anchor: --docs-select-size; } |
| 1368 | /* A list as wide as its widest row can run off the screen from a |
| 1369 | box near its end (the font list did, by 6px at 320px): it then |
| 1370 | hangs from the box's other edge, and is never wider than the |
| 1371 | screen. */ |
| 1372 | [docs-toolbar] [rst-combo-list] { |
| 1373 | position: fixed; |
| 1374 | inset: auto; |
| 1375 | top: anchor(bottom); |
| 1376 | left: anchor(left); |
| 1377 | min-inline-size: anchor-size(width); |
| 1378 | inline-size: max-content; |
| 1379 | max-inline-size: calc(100vw - 2 * var(--rst-sp-2)); |
| 1380 | position-try-fallbacks: flip-inline; |
| 1381 | } |
| 1382 | /* ui/select.js opens a list upward when there is more room above, |
| 1383 | and tokens.css then sets bottom: 100% and top: auto, at a weight |
| 1384 | that beats the rule above. For a fixed list that is 100% of the |
| 1385 | viewport: the list sat wholly above the screen. */ |
| 1386 | [docs-toolbar] [rst-combo][rst-combo-up] [rst-combo-list] { |
| 1387 | top: auto; |
| 1388 | bottom: anchor(top); |
| 1389 | } |
| 1390 | } |
| 1391 | } |
| 1392 | /* The paragraph styles' list shows each style as it looks (Paul, after |
| 1393 | Google Docs): ui/select.js copies an option's data-rst-class onto |
| 1394 | its row, so Heading 1 is drawn large and bold, down to Body text. |
| 1395 | In the chrome's face, which is always loaded, rather than the |
| 1396 | document's, so opening the list can never flash a fallback; the |
| 1397 | sizes keep the document's own ratios (show.html's h1 1.6em, h2 |
| 1398 | 1.3em, h3 1.1em) on a 14px body. */ |
| 1399 | [docs-toolbar] [rst-combo-list] .docs-style-paragraph { font-size: 14px; } |
| 1400 | [docs-toolbar] [rst-combo-list] .docs-style-heading-1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; } |
| 1401 | [docs-toolbar] [rst-combo-list] .docs-style-heading-2 { font-size: 18px; font-weight: 700; } |
| 1402 | [docs-toolbar] [rst-combo-list] .docs-style-heading-3 { font-size: 15.5px; font-weight: 700; } |
| 1403 | [docs-toolbar] [rst-combo-list] [class*="docs-style-heading"] { line-height: 1.25; padding-block: 6px; /* spacing-allow: editor chrome: the style list's options, each drawn at its heading's own size, 6px clear of each other */ } |
| 1404 | /* Disabled is mirrored onto the input by fixtures/toolbar.mjs — |
| 1405 | select.js does not do it — and has to LOOK disabled too, or the |
| 1406 | control reads as usable while refusing to be used. Same token the |
| 1407 | buttons already use. */ |
| 1408 | [docs-toolbar] [rst-combo] [rst-input]:disabled { |
| 1409 | color: var(--rst-text-faint); |
| 1410 | cursor: default; |
| 1411 | } |
| 1412 | /* iOS zooms the page into any text control under 16px, and tokens.css |
| 1413 | brings controls up to 16px where the pointer is coarse. The three |
| 1414 | comboboxes (and their selects, before select.js runs) set |
| 1415 | --rst-fs-sm with selectors that outweigh its bare `input`, so they |
| 1416 | stayed at 12.5px. Same rule, same max(), restated at their weight. |
| 1417 | TestNoZoomOnTap (browser tag) measures them. */ |
| 1418 | @media (pointer: coarse) { |
| 1419 | [docs-toolbar] [rst-combo] [rst-input], |
| 1420 | [docs-tool-select] { |
| 1421 | font-size: max(1rem, 1em); |
| 1422 | } |
| 1423 | } |
| 1424 | /* ── I2 (spec 2026-11-11): the stacked header's undo/redo, and the |
| 1425 | formatting bar as a floating inspector from 64rem. ── |
| 1426 | |
| 1427 | Undo and redo are one pair with two homes (views/partials/ |
| 1428 | editor_bar.html's docs-history), and exactly one is drawn: the |
| 1429 | strip's below 800px, where estilo's header is the one-row bar with |
| 1430 | the menus as a second row and has no room for it (spec C6), and the |
| 1431 | bar's lead slot from 800px. 800px is estilo's own breakpoint, |
| 1432 | stated in px as estilo states it. */ |
| 1433 | [docs-bar] > [docs-history] { |
| 1434 | display: flex; |
| 1435 | flex: none; |
| 1436 | align-items: center; |
| 1437 | gap: 2px; /* spacing-allow: undo and redo as one pair, like a toolbar group */ |
| 1438 | padding-inline-end: var(--rst-sp-2); |
| 1439 | border-inline-end: 1px solid var(--rst-line); |
| 1440 | } |
| 1441 | /* The bar's lead now shows at every width: in the 56px header from |
| 1442 | 704px, and in the phone's compact row below it (estilo's |
| 1443 | Bar.Compact, design/phone-web). So the strip's pair is never shown. |
| 1444 | It stays in the markup for now; slice P2 rebuilds the strip. */ |
| 1445 | [docs-bar] > [docs-history] { display: none; } |
| 1446 | /* In the header: one grey pill lit from the top, two 24px buttons |
| 1447 | with a hairline between, 28px in all, the controls set's height. A |
| 1448 | hovered button lifts within it. */ |
| 1449 | [docs-history~="lead"] { |
| 1450 | display: inline-flex; |
| 1451 | align-items: center; |
| 1452 | gap: 0; |
| 1453 | padding: 2px; /* spacing-allow: two 24px buttons in a 28px pill, the control set's height */ |
| 1454 | border-radius: 999px; |
| 1455 | background: linear-gradient(light-dark(rgb(255 255 255 / 0.55), rgb(255 255 255 / 0.04)), transparent 60%), var(--rst-surface-2); |
| 1456 | box-shadow: |
| 1457 | inset 0 1px 0 light-dark(rgb(255 255 255 / 0.85), rgb(255 255 255 / 0.06)), |
| 1458 | inset 0 -1px 0 light-dark(rgb(23 32 60 / 0.05), rgb(0 0 0 / 0.2)), |
| 1459 | 0 1px 2px rgb(23 32 60 / 0.06); |
| 1460 | } |
| 1461 | [docs-history~="lead"] [docs-tool] { |
| 1462 | min-inline-size: 30px; |
| 1463 | min-block-size: 24px; |
| 1464 | block-size: 24px; |
| 1465 | padding: 0 3px; /* spacing-allow: a 24px glyph button inside the pill */ |
| 1466 | border-radius: 999px; |
| 1467 | color: var(--rst-text); |
| 1468 | } |
| 1469 | [docs-history~="lead"] [docs-tool] + [docs-tool] { position: relative; } |
| 1470 | [docs-history~="lead"] [docs-tool] + [docs-tool]::before { |
| 1471 | content: ""; |
| 1472 | position: absolute; |
| 1473 | inset-inline-start: -0.5px; |
| 1474 | inset-block: 6px; |
| 1475 | border-inline-start: 1px solid light-dark(rgb(23 32 60 / 0.14), rgb(255 255 255 / 0.14)); |
| 1476 | } |
| 1477 | [docs-history~="lead"] [docs-tool] svg { inline-size: 16px; block-size: 16px; } |
| 1478 | [docs-history~="lead"] [docs-tool]:hover:not(:disabled) { |
| 1479 | background-color: var(--rst-surface); |
| 1480 | box-shadow: inset 0 1px 0 light-dark(rgb(255 255 255 / 0.9), rgb(255 255 255 / 0.08)), 0 1px 2px rgb(23 32 60 / 0.10); |
| 1481 | } |
| 1482 | [docs-history~="lead"] [docs-tool]:disabled { color: var(--rst-text-faint); opacity: 0.6; } |
| 1483 | @media (hover: hover) and (min-width: 40rem) { |
| 1484 | [docs-history~="lead"] [docs-tool]::after { inset-block-start: calc(100% + 6px); } |
| 1485 | } |
| 1486 | /* Coarse pointers: the pair's buttons are 32px each way (review on |
| 1487 | #106: they were 30x28), and the pill is theirs, 32px, the height |
| 1488 | estilo gives the other header controls there. */ |
| 1489 | @media (pointer: coarse) { |
| 1490 | [docs-history~="lead"] { padding: 0; } |
| 1491 | [docs-history~="lead"] [docs-tool] { min-inline-size: 32px; min-block-size: 32px; block-size: 32px; } |
| 1492 | } |
| 1493 | |
| 1494 | /* The inspector's box. Below 64rem it is only the strip's holder, |
| 1495 | laid out as the toolbar was (the bar's width from the first paint: |
| 1496 | the CLS fix above), and none of the card it becomes. The section |
| 1497 | labels are the inspector's alone; they still name their groups |
| 1498 | (aria-labelledby reads a hidden label). */ |
| 1499 | /* Basis 0, not auto: beside the strip's undo/redo (below 800px) an |
| 1500 | auto basis is the toolbar's whole one-row width, and the strip |
| 1501 | wrapped it onto a second row under the pair. It takes what the row |
| 1502 | has left, from the first paint, as the toolbar did. */ |
| 1503 | [docs-inspector][rst-box] { |
| 1504 | display: flex; |
| 1505 | flex: 1 1 0%; |
| 1506 | min-inline-size: 0; |
| 1507 | margin: 0; |
| 1508 | padding: 0; |
| 1509 | border: 0; |
| 1510 | border-radius: 0; |
| 1511 | background: none; |
| 1512 | box-shadow: none; |
| 1513 | } |
| 1514 | [docs-toolbar-label] { display: none; } |
| 1515 | |
| 1516 | /* From 64rem, the inspector (spec I2, Paul's choice of the five |
| 1517 | layouts): the same [docs-toolbar], one role="toolbar" and one |
| 1518 | roving tab stop, laid out as a 248px panel floating 12px under the |
| 1519 | header and 12px from the inline end, its groups labelled sections |
| 1520 | 14px apart. The header's height is estilo's published variable, |
| 1521 | never a number. Server-rendered at its final size and state, so |
| 1522 | the first paint is the last; closed (the docs-inspector cookie) |
| 1523 | hides it here and only here: below 64rem the strip shows whatever |
| 1524 | the state (C3). The menu bar is in the header now, so [docs-chrome] |
| 1525 | holds nothing in flow at this width. */ |
| 1526 | @media screen and (min-width: 64rem) { |
| 1527 | [docs-chrome] { |
| 1528 | background: transparent; |
| 1529 | border-block-end: 0; |
| 1530 | } |
| 1531 | [docs-bar] { padding: 0; } |
| 1532 | [docs-inspector][rst-box] { |
| 1533 | position: fixed; |
| 1534 | z-index: 4; |
| 1535 | inset-block-start: calc(var(--estilo-bar-block-size) + 12px); |
| 1536 | inset-inline-end: 12px; |
| 1537 | display: block; |
| 1538 | box-sizing: border-box; |
| 1539 | inline-size: 248px; |
| 1540 | padding: var(--rst-sp-3); |
| 1541 | border: 1px solid transparent; |
| 1542 | border-radius: 12px; |
| 1543 | /* Glass, with the line as its rim: the light below brightens the |
| 1544 | rim and washes the face near the pointer. */ |
| 1545 | background: |
| 1546 | linear-gradient(light-dark(rgb(255 255 255 / 0.92), rgb(32 35 43 / 0.92)) 0 0) padding-box, |
| 1547 | linear-gradient(var(--rst-line) 0 0) border-box; |
| 1548 | box-shadow: |
| 1549 | inset 0 1px 0 light-dark(rgb(255 255 255 / 0.9), rgb(255 255 255 / 0.06)), |
| 1550 | 0 2px 4px rgb(23 32 60 / 0.06), |
| 1551 | 0 10px 20px -8px light-dark(rgb(23 32 60 / 0.18), rgb(0 0 0 / 0.5)), |
| 1552 | 0 28px 56px -20px light-dark(rgb(23 32 60 / 0.28), rgb(0 0 0 / 0.7)); |
| 1553 | font-size: 13px; |
| 1554 | } |
| 1555 | /* The glass's blur is drawn by a layer behind the panel's content, |
| 1556 | not by the panel: a backdrop-filter makes its element the |
| 1557 | containing block of every fixed descendant, and the pickers' |
| 1558 | lists below are fixed so that a scrolling panel cannot clip |
| 1559 | them. */ |
| 1560 | [docs-inspector][rst-box]::before { |
| 1561 | content: ""; |
| 1562 | position: absolute; |
| 1563 | inset: 0; |
| 1564 | z-index: -1; |
| 1565 | border-radius: inherit; |
| 1566 | -webkit-backdrop-filter: saturate(1.4) blur(14px); |
| 1567 | backdrop-filter: saturate(1.4) blur(14px); |
| 1568 | pointer-events: none; |
| 1569 | } |
| 1570 | [docs-inspector][data-state="closed"] { display: none; } |
| 1571 | /* A short window (review on #106): the panel stops 12px above the |
| 1572 | window's foot and scrolls. Only where anchor positioning lets the |
| 1573 | pickers' lists hang outside it, fixed to the viewport and anchored |
| 1574 | to their own boxes, as the phone strip's are; elsewhere the panel |
| 1575 | stays as tall as it is and nothing in it is clipped. */ |
| 1576 | @supports (anchor-name: --docs-probe) { |
| 1577 | [docs-inspector][rst-box] { |
| 1578 | max-block-size: calc(100dvh - var(--estilo-bar-block-size) - 24px); |
| 1579 | overflow-y: auto; |
| 1580 | overscroll-behavior: contain; |
| 1581 | } |
| 1582 | [docs-inspector] [rst-combo]:has(#docs-select-block-combo) { anchor-name: --docs-select-block; } |
| 1583 | [docs-inspector] [rst-combo]:has(#docs-select-font-combo) { anchor-name: --docs-select-font; } |
| 1584 | [docs-inspector] [rst-combo]:has(#docs-select-size-combo) { anchor-name: --docs-select-size; } |
| 1585 | [docs-inspector] [rst-combo]:has(#docs-select-block-combo) [rst-combo-list] { position-anchor: --docs-select-block; } |
| 1586 | [docs-inspector] [rst-combo]:has(#docs-select-font-combo) [rst-combo-list] { position-anchor: --docs-select-font; } |
| 1587 | [docs-inspector] [rst-combo]:has(#docs-select-size-combo) [rst-combo-list] { position-anchor: --docs-select-size; } |
| 1588 | [docs-inspector] [rst-combo-list] { |
| 1589 | position: fixed; |
| 1590 | inset: auto; |
| 1591 | top: anchor(bottom); |
| 1592 | left: anchor(left); |
| 1593 | min-inline-size: anchor-size(width); |
| 1594 | inline-size: max-content; |
| 1595 | max-inline-size: calc(100vw - 2 * var(--rst-sp-2)); |
| 1596 | position-try-fallbacks: flip-inline; |
| 1597 | } |
| 1598 | [docs-inspector] [rst-combo][rst-combo-up] [rst-combo-list] { |
| 1599 | top: auto; |
| 1600 | bottom: anchor(top); |
| 1601 | } |
| 1602 | } |
| 1603 | /* The font notes hang under the header as before; while the |
| 1604 | inspector is open they stop short of it, so their dismiss button |
| 1605 | is never under the panel. */ |
| 1606 | [docs-chrome]:has([docs-inspector][data-state="open"]) [docs-fonts-status] { |
| 1607 | inset-inline-end: calc(248px + 24px); |
| 1608 | } |
| 1609 | [docs-inspector] [docs-toolbar] { |
| 1610 | flex-direction: column; |
| 1611 | align-items: stretch; |
| 1612 | flex-wrap: nowrap; |
| 1613 | gap: 14px; /* spacing-allow: editor chrome, not page rhythm: the inspector's groups at the density its approved I2 design set, in a 248px panel */ |
| 1614 | padding: 0; |
| 1615 | } |
| 1616 | [docs-inspector] [docs-toolbar-group], |
| 1617 | [docs-inspector] [docs-toolbar-group] + [docs-toolbar-group] { |
| 1618 | display: flex; |
| 1619 | flex-wrap: wrap; |
| 1620 | gap: 6px 2px; /* spacing-allow: editor chrome: the inspector's 32px tools packed as the toolbar packs them, a hairline across and 6px down */ |
| 1621 | margin: 0; |
| 1622 | padding: 0; |
| 1623 | border: 0; |
| 1624 | } |
| 1625 | [docs-inspector] [docs-toolbar-label] { |
| 1626 | display: block; |
| 1627 | flex: 0 0 100%; |
| 1628 | margin: 0; |
| 1629 | color: var(--rst-text-muted); |
| 1630 | font: 650 11px/14px var(--rst-font, system-ui), sans-serif; |
| 1631 | } |
| 1632 | /* Text, Alignment and Lists: joined segmented rows of 28px |
| 1633 | buttons. The pressed one keeps the ring as well as the tint |
| 1634 | (colour never carries the state alone). */ |
| 1635 | [docs-inspector] [docs-toolbar-group]:not([docs-toolbar-group="style"]) [docs-tool] { |
| 1636 | flex: 1 1 0; |
| 1637 | min-inline-size: 0; |
| 1638 | min-block-size: 28px; |
| 1639 | block-size: 28px; |
| 1640 | padding: 0; |
| 1641 | background-color: var(--rst-surface-2); |
| 1642 | border-radius: 0; |
| 1643 | } |
| 1644 | [docs-inspector] [docs-toolbar-group]:not([docs-toolbar-group="style"]) [docs-tool]:first-of-type { |
| 1645 | border-start-start-radius: 8px; |
| 1646 | border-end-start-radius: 8px; |
| 1647 | } |
| 1648 | [docs-inspector] [docs-toolbar-group]:not([docs-toolbar-group="style"]) [docs-tool]:last-of-type { |
| 1649 | border-start-end-radius: 8px; |
| 1650 | border-end-end-radius: 8px; |
| 1651 | } |
| 1652 | [docs-inspector] [docs-toolbar-group]:not([docs-toolbar-group="style"]) [docs-tool][aria-pressed="true"] { |
| 1653 | background-color: var(--rst-accent-soft); |
| 1654 | } |
| 1655 | [docs-inspector] [docs-tool] svg { inline-size: 18px; block-size: 18px; } |
| 1656 | /* The section labels name the buttons' groups, and a tooltip under |
| 1657 | a button would cover the next section. */ |
| 1658 | [docs-inspector] [docs-tool]::after { display: none; } |
| 1659 | /* Style: the paragraph style full width, then font and size (64px) |
| 1660 | on one row. Placed by id, the native select and the combobox |
| 1661 | select.js puts before it alike, so the grid is the same before |
| 1662 | the enhancement as after (the native one leaves the flow, as |
| 1663 | rst-sr-only, when it is replaced). */ |
| 1664 | [docs-inspector] [docs-toolbar-group="style"] { |
| 1665 | display: grid; |
| 1666 | grid-template-columns: minmax(0, 1fr) 64px; |
| 1667 | gap: 6px; /* spacing-allow: editor chrome: the inspector's pickers 6px apart, as its tools are */ |
| 1668 | } |
| 1669 | [docs-inspector] [docs-toolbar-group="style"] > [docs-toolbar-label], |
| 1670 | [docs-inspector] #docs-select-block, |
| 1671 | [docs-inspector] [rst-combo]:has(#docs-select-block-combo) { |
| 1672 | grid-column: 1 / -1; |
| 1673 | } |
| 1674 | [docs-inspector] [rst-combo], |
| 1675 | [docs-inspector] [docs-tool-select] { |
| 1676 | flex: none; |
| 1677 | inline-size: auto; |
| 1678 | min-inline-size: 0; |
| 1679 | max-inline-size: none; |
| 1680 | } |
| 1681 | [docs-inspector] [rst-combo] [rst-input], |
| 1682 | [docs-inspector] [docs-tool-select] { |
| 1683 | box-sizing: border-box; |
| 1684 | min-block-size: 28px; |
| 1685 | block-size: 28px; |
| 1686 | padding-inline: var(--rst-sp-2) 22px; /* spacing-allow: the picker's chevron at the end */ |
| 1687 | border: 1px solid var(--rst-line); |
| 1688 | border-radius: 8px; |
| 1689 | background: var(--rst-surface); |
| 1690 | font-size: 13px; |
| 1691 | font-weight: 500; |
| 1692 | text-overflow: ellipsis; |
| 1693 | } |
| 1694 | /* Focused, a picker keeps its field and the focus ring alone marks |
| 1695 | it: a second, inner border inside the ring drew a box within a |
| 1696 | box. */ |
| 1697 | [docs-inspector] [rst-combo] [rst-input]:focus { |
| 1698 | border-color: transparent; |
| 1699 | } |
| 1700 | /* A chevron says it opens, and is a target of its own |
| 1701 | (fixtures/toolbar.mjs opens the list from it), the full height of |
| 1702 | the picker and wide enough to hit; the field before it keeps its |
| 1703 | text cursor, for typing a font's name. */ |
| 1704 | [docs-inspector] [rst-combo]::after { |
| 1705 | content: ""; |
| 1706 | position: absolute; |
| 1707 | inset-block: 0; |
| 1708 | inset-inline-end: 0; |
| 1709 | inline-size: 26px; |
| 1710 | background: var(--rst-text-muted); |
| 1711 | -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 3.5 5 6.5 8 3.5' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 10px no-repeat; |
| 1712 | mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 3.5 5 6.5 8 3.5' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 10px no-repeat; |
| 1713 | cursor: pointer; |
| 1714 | } |
| 1715 | [docs-inspector] [rst-combo]:has([rst-input]:disabled)::after { |
| 1716 | cursor: default; |
| 1717 | } |
| 1718 | /* Coarse pointers: every control rises to 32px, and the pickers keep |
| 1719 | the 16px floor the strip's rule gives them (iOS zooms into a text |
| 1720 | control under 16px): the inspector's 13px above outweighs that |
| 1721 | rule, so it is restated here, at this weight (review on #106; |
| 1722 | TestNoZoomOnTap's wide leg). */ |
| 1723 | @media (pointer: coarse) { |
| 1724 | [docs-inspector] [docs-toolbar-group]:not([docs-toolbar-group="style"]) [docs-tool], |
| 1725 | [docs-inspector] [rst-combo] [rst-input], |
| 1726 | [docs-inspector] [docs-tool-select] { |
| 1727 | min-block-size: 32px; |
| 1728 | block-size: 32px; |
| 1729 | } |
| 1730 | [docs-inspector] [rst-combo] [rst-input], |
| 1731 | [docs-inspector] [docs-tool-select] { |
| 1732 | font-size: max(1rem, 1em); |
| 1733 | } |
| 1734 | } |
| 1735 | /* The light (rastrillo's card light: light.js eases --rst-card-x, |
| 1736 | -y and -lit on any [rst-box]). The rim brightens and the face |
| 1737 | washes near the pointer. The glow is drawn from --rst-card-lit |
| 1738 | reshaped to end at 0.3 (Paul: the fade was "taking slightly too |
| 1739 | long"): gone about half a second after the pointer leaves, not |
| 1740 | two. Far fainter in dark. Only where something hovers, so a touch |
| 1741 | never leaves a light where a finger lifted; light.js itself does |
| 1742 | nothing under reduced motion, which leaves the plain rim. */ |
| 1743 | @media (hover: hover) { |
| 1744 | [docs-inspector][rst-box] { |
| 1745 | --docs-lit: max(0, var(--rst-card-lit) * 1.43 - 0.43); |
| 1746 | background: |
| 1747 | radial-gradient(calc(var(--docs-lit) * 360px) circle at var(--rst-card-x) var(--rst-card-y), light-dark(color-mix(in srgb, var(--rst-accent) 9%, transparent), color-mix(in srgb, var(--rst-accent) 4%, transparent)), transparent 70%) padding-box, |
| 1748 | linear-gradient(light-dark(rgb(255 255 255 / 0.92), rgb(32 35 43 / 0.92)) 0 0) padding-box, |
| 1749 | radial-gradient(calc(var(--docs-lit) * 240px) circle at var(--rst-card-x) var(--rst-card-y), light-dark(color-mix(in srgb, var(--rst-accent) 70%, var(--rst-line)), color-mix(in srgb, var(--rst-accent) 30%, var(--rst-line))), var(--rst-line) 80%) border-box; |
| 1750 | } |
| 1751 | /* Back-lit hover (Paul: against the panel's glow a grey hover is |
| 1752 | lost): a hovered control brightens to the surface with a halo |
| 1753 | of the accent spilling round it, as if lit from behind, above |
| 1754 | its segment neighbours while it does. */ |
| 1755 | [docs-inspector] [docs-tool], |
| 1756 | [docs-inspector] [rst-combo] [rst-input] { |
| 1757 | transition: background-color 140ms ease, box-shadow 160ms ease, var(--docs-release); |
| 1758 | } |
| 1759 | [docs-inspector] [docs-toolbar-group] [docs-tool]:hover:not(:disabled), |
| 1760 | [docs-inspector] [rst-combo]:hover [rst-input]:not(:disabled) { |
| 1761 | position: relative; |
| 1762 | z-index: 1; |
| 1763 | background-color: var(--rst-surface); |
| 1764 | box-shadow: |
| 1765 | 0 0 0 1px light-dark(color-mix(in srgb, var(--rst-accent) 22%, transparent), color-mix(in srgb, var(--rst-accent) 14%, transparent)), |
| 1766 | 0 0 12px 1px light-dark(color-mix(in srgb, var(--rst-accent) 26%, transparent), color-mix(in srgb, var(--rst-accent) 9%, transparent)), |
| 1767 | 0 2px 6px -2px rgb(23 32 60 / 0.12); |
| 1768 | } |
| 1769 | [docs-inspector] [docs-toolbar-group] [docs-tool][aria-pressed="true"]:hover:not(:disabled) { |
| 1770 | background-color: var(--rst-accent-soft); |
| 1771 | box-shadow: |
| 1772 | inset 0 0 0 1px color-mix(in oklab, currentColor 45%, transparent), |
| 1773 | 0 0 12px 1px light-dark(color-mix(in srgb, var(--rst-accent) 26%, transparent), color-mix(in srgb, var(--rst-accent) 9%, transparent)); |
| 1774 | } |
| 1775 | } |
| 1776 | @media (hover: hover) and (prefers-reduced-motion: reduce) { |
| 1777 | [docs-inspector] [docs-tool], |
| 1778 | [docs-inspector] [rst-combo] [rst-input] { |
| 1779 | transition: none; |
| 1780 | } |
| 1781 | } |
| 1782 | |
| 1783 | /* The sheet stays centred unless the inspector needs the room |
| 1784 | (Paul: "the inspector shouldn't push the sheet to the left unless |
| 1785 | there's not enough space"). A centred 816px sheet's end edge must |
| 1786 | clear R, the inspector's 248px, its 12px margin and a 16px gap: |
| 1787 | so the end padding grows by twice the overlap, 16 + 816 + 2R - W. |
| 1788 | W is the canvas's containing block (a padding percentage), not |
| 1789 | 100vw, which counts a classic scrollbar. It never needs more than |
| 1790 | R: past that the sheet would shrink further than the room it |
| 1791 | has, so from there (below 1108px) the sheet fills what is left |
| 1792 | beside the panel. Closed, the sheet is plainly centred. */ |
| 1793 | [docs-canvas] { |
| 1794 | padding-block-start: var(--rst-sp-4); |
| 1795 | } |
| 1796 | [docs-chrome]:has([docs-inspector][data-state="open"]) ~ [docs-canvas] { |
| 1797 | --docs-reserve: calc(248px + 12px + 16px); |
| 1798 | /* spacing-allow: room for the inspector beside the 816px sheet, derived from both widths */ |
| 1799 | padding-inline-end: clamp(16px, calc(16px + 816px + 2 * var(--docs-reserve) - 100%), var(--docs-reserve)); |
| 1800 | } |
| 1801 | } |
| 1802 | |
| 1803 | /* ── The phone (design/phone-web, approved by Paul 2026-11-28; P1) ── |
| 1804 | Below 704px, or on a phone held sideways, estilo's compact bar is one |
| 1805 | 52px row (Back, the undo/redo pair, Aa and •••), and this page draws |
| 1806 | what the native iPhone screen does under it: a large title with the |
| 1807 | save state as its subtitle, then the paper, full-bleed, with no desk |
| 1808 | band above it. The formatting strip shows only when Aa asks for it |
| 1809 | (brand/phone.js); the corner toast gives way to the subtitle. The |
| 1810 | query is estilo's own (chrome.css), in px as its 800px is. From |
| 1811 | 704px nothing here applies. */ |
| 1812 | [docs-title-block] { display: none; } |
| 1813 | [docs-more-help] > summary { list-style: none; } |
| 1814 | [docs-more-help] > summary::-webkit-details-marker { display: none; } |
| 1815 | [docs-more-help] [docs-more-chevron] { flex: none; inline-size: 18px; block-size: 18px; margin-inline-start: auto; color: var(--rst-text-muted); } |
| 1816 | [docs-more-help][open] [docs-more-chevron] { transform: rotate(180deg); } |
| 1817 | /* Help's rows sit under its label: the icon column and its gap in. */ |
| 1818 | [docs-more-help] > :not(summary) { |
| 1819 | padding-inline-start: calc(var(--rst-sp-4) + 1.25rem + var(--rst-sp-3)); /* spacing-allow: the row's padding, its 20px icon column and the gap, so Help's rows align with the labels above */ |
| 1820 | } |
| 1821 | [docs-aa-glyph] { font-weight: 650; letter-spacing: -0.02em; } |
| 1822 | /* The inline title the folded bar shows (editor_bar.html's |
| 1823 | docs-inline-title): the title over the state, one line each, cut |
| 1824 | with an ellipsis, as native's inline title is. */ |
| 1825 | [docs-inline-title] { line-height: 1.2; } |
| 1826 | [docs-inline-title] > b, |
| 1827 | [docs-inline-sub] { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } |
| 1828 | [docs-inline-title] > b { color: var(--rst-text); font-size: 15px; font-weight: 600; } |
| 1829 | [docs-inline-sub] { color: var(--rst-text-muted); font-size: 12px; } |
| 1830 | /* The state in the inline line takes the subtitle's tones: the warning |
| 1831 | while it retries, the negative tone, bold, once something is lost. */ |
| 1832 | [docs-inline-state][data-state="retrying"] { color: var(--rst-tone-warning-fg); } |
| 1833 | [docs-inline-state][data-state="failed"] { color: var(--rst-tone-negative-fg); font-weight: 600; } |
| 1834 | @media (max-width: 703.98px), (max-height: 480px) and (pointer: coarse) { |
| 1835 | [docs-title-block] { |
| 1836 | display: block; |
| 1837 | padding: var(--rst-sp-2) 20px var(--rst-sp-3); /* spacing-allow: the native screen's 20pt side margin, the paper's below */ |
| 1838 | background: var(--rst-surface); |
| 1839 | } |
| 1840 | [docs-title] { |
| 1841 | margin: 0 0 var(--rst-sp-2); |
| 1842 | color: var(--rst-text); |
| 1843 | font-size: 28px; |
| 1844 | font-weight: 700; |
| 1845 | line-height: 1.15; |
| 1846 | letter-spacing: -0.02em; |
| 1847 | overflow-wrap: anywhere; |
| 1848 | } |
| 1849 | /* Three lines, then an ellipsis. On the text's own box: a button is |
| 1850 | one atomic inline, so a clamp on the heading cannot reach inside |
| 1851 | it. */ |
| 1852 | [docs-title-text] { |
| 1853 | display: -webkit-box; |
| 1854 | overflow: hidden; |
| 1855 | -webkit-box-orient: vertical; |
| 1856 | -webkit-line-clamp: 3; |
| 1857 | line-clamp: 3; |
| 1858 | } |
| 1859 | [docs-title-edit] { |
| 1860 | display: block; |
| 1861 | inline-size: 100%; |
| 1862 | margin: 0; |
| 1863 | padding: 0; |
| 1864 | border: 0; |
| 1865 | background: none; |
| 1866 | color: inherit; |
| 1867 | font: inherit; |
| 1868 | letter-spacing: inherit; |
| 1869 | text-align: start; |
| 1870 | cursor: text; |
| 1871 | } |
| 1872 | [docs-title-edit]:focus-visible { outline: 2px solid var(--rst-accent); outline-offset: 4px; border-radius: 4px; } |
| 1873 | [docs-title-input] { |
| 1874 | box-sizing: border-box; |
| 1875 | inline-size: 100%; |
| 1876 | margin: 0 0 var(--rst-sp-2); |
| 1877 | padding: 0; |
| 1878 | border: 0; |
| 1879 | border-radius: 4px; |
| 1880 | background: transparent; |
| 1881 | color: var(--rst-text); |
| 1882 | font: 700 28px/1.15 var(--rst-font); |
| 1883 | letter-spacing: -0.02em; |
| 1884 | outline: 2px solid var(--rst-accent); |
| 1885 | outline-offset: 4px; |
| 1886 | } |
| 1887 | [docs-title-hint] { margin: 0 0 var(--rst-sp-2); color: var(--rst-accent); font-size: 12px; } |
| 1888 | [docs-title-error] { margin: 0 0 var(--rst-sp-2); color: var(--rst-tone-negative-fg); font-size: 12px; font-weight: 600; } |
| 1889 | /* With script, the heading until it is tapped; then the field and its |
| 1890 | hint in its place. Without, the field and its Rename button. Decided |
| 1891 | by the media feature, so the first paint is already the right one. */ |
| 1892 | @media (scripting: enabled) { |
| 1893 | [docs-title-form] :is([docs-title-input], [docs-title-hint], [docs-title-error], [docs-title-submit], [docs-title-cancel]) { display: none; } |
| 1894 | [docs-title-form][data-editing] [docs-title] { display: none; } |
| 1895 | [docs-title-form][data-editing] [docs-title-input] { display: block; } |
| 1896 | /* Return and Esc are a keyboard's; on a touch screen the keyboard's |
| 1897 | own Done renames, and Cancel puts the title back (Fable on #179). */ |
| 1898 | [docs-title-form][data-editing] [docs-title-cancel] { display: inline-flex; margin-block-end: var(--rst-sp-2); } |
| 1899 | @media (pointer: fine) { |
| 1900 | [docs-title-form][data-editing] [docs-title-hint] { display: block; } |
| 1901 | } |
| 1902 | /* A rename that failed says so in the hint's place (brand/phone.js), |
| 1903 | at every pointer. */ |
| 1904 | [docs-title-form][data-editing] [docs-title-error]:not([hidden]) { display: block; } |
| 1905 | [docs-title-form]:has([docs-title-error]:not([hidden])) [docs-title-hint] { display: none; } |
| 1906 | } |
| 1907 | @media (scripting: none) { |
| 1908 | [docs-title-form] :is([docs-title], [docs-title-cancel]) { display: none; } |
| 1909 | [docs-title-form] [docs-title-input] { outline: 0; border-block-end: 1px solid var(--rst-line); } |
| 1910 | [docs-title-form] [docs-title-submit] { margin-block: var(--rst-sp-2); } |
| 1911 | } |
| 1912 | [docs-subtitle] { |
| 1913 | display: flex; |
| 1914 | flex-wrap: wrap; |
| 1915 | align-items: center; |
| 1916 | gap: var(--rst-sp-2); |
| 1917 | margin: 0; |
| 1918 | color: var(--rst-text-muted); |
| 1919 | font-size: 13px; |
| 1920 | } |
| 1921 | [docs-subtitle-dot] { inline-size: 3px; block-size: 3px; border-radius: 50%; background: currentColor; opacity: 0.6; } |
| 1922 | [docs-view-only] { display: inline-flex; align-items: center; gap: var(--rst-sp-1); } |
| 1923 | |
| 1924 | /* The paper, full-bleed under the title: no desk band above it, the |
| 1925 | native screen's 20pt margins, and at least the screen's height so |
| 1926 | a short document is not a white card on the desk. Dark mode keeps |
| 1927 | it white (Paul's answer 6). */ |
| 1928 | [docs-canvas] { padding: 0; } |
| 1929 | [docs-page] { |
| 1930 | inline-size: 100%; |
| 1931 | min-block-size: calc(100dvh - var(--estilo-bar-block-size)); |
| 1932 | margin-block-end: 0; |
| 1933 | /* Room above the text for the font status, which hangs from the |
| 1934 | chrome's foot over the paper here ([docs-fonts-status]): always |
| 1935 | there, so the text never moves as a note comes and goes. */ |
| 1936 | padding: var(--rst-sp-6) 20px; /* spacing-allow: the native screen's 20pt side margin */ |
| 1937 | border-radius: 0; |
| 1938 | box-shadow: none; |
| 1939 | } |
| 1940 | [docs-page-gap] { |
| 1941 | margin-inline: -20px; /* spacing-allow: the gap spans the paper, its 20px padding pulled back */ |
| 1942 | padding-inline-end: 20px; /* spacing-allow: as above */ |
| 1943 | } |
| 1944 | |
| 1945 | /* No strip on a phone: Aa opens the Format sheet (below), which is the |
| 1946 | same [docs-inspector] restyled, and the quick bar rides the |
| 1947 | keyboard. The strip's holder lays out as nothing. */ |
| 1948 | [docs-bar] { display: contents; } |
| 1949 | [docs-chrome] { border-block-end: 0; } |
| 1950 | /* The subtitle and the folded bar's inline line say the save state |
| 1951 | (the editor drives all three, fixtures/editor-entry.js), so the |
| 1952 | corner toast, where the keyboard and Safari's bar sit, gives way to |
| 1953 | them: once brand/phone.js has marked the page, since it is what |
| 1954 | folds the bar. Without it the toast stays, and a failure is still |
| 1955 | said wherever the page has scrolled to (Fable on #179, S1). */ |
| 1956 | :root[data-docs-phone] [estilo-save-status~="floating"] { display: none; } |
| 1957 | |
| 1958 | /* The undo/redo pair in the compact row: the mock-up's 36px pill, its |
| 1959 | glyphs in the accent like the row's other tools, each 40px wide and |
| 1960 | a 44px target. */ |
| 1961 | [docs-history~="lead"] { |
| 1962 | block-size: 36px; |
| 1963 | padding: 0 2px; /* spacing-allow: two 40px buttons in the 36px pill, 2px from its ends */ |
| 1964 | } |
| 1965 | [docs-history~="lead"] [docs-tool] { |
| 1966 | position: relative; |
| 1967 | min-inline-size: 40px; |
| 1968 | min-block-size: 36px; |
| 1969 | block-size: 36px; |
| 1970 | color: var(--rst-accent); |
| 1971 | } |
| 1972 | /* On touch, where nothing hovers, ::after is free of its tooltip |
| 1973 | and takes the target to 44px; ::before is the hairline. */ |
| 1974 | @media (pointer: coarse) { |
| 1975 | [docs-history~="lead"] [docs-tool]::after { content: ""; position: absolute; inset: -4px 0; } |
| 1976 | } |
| 1977 | [docs-history~="lead"] [docs-tool] svg { inline-size: 22px; block-size: 22px; } |
| 1978 | } |
| 1979 | |
| 1980 | /* ── The Format sheet and the quick bar (design/phone-web, P2) ────────── |
| 1981 | Below 704px (estilo's compact query) the inspector is a non-modal |
| 1982 | half-height bottom sheet that Aa opens (brand/phone.js sets |
| 1983 | data-docs-sheet on <html>): the same element and the same one |
| 1984 | role="toolbar" as the strip and the floating inspector (I2), laid out |
| 1985 | in the native sheet's order: the style chips, the font picker with |
| 1986 | the size stepper, marks beside alignment, lists beside indent and |
| 1987 | clear formatting. 50% of the screen tall at the default text size, |
| 1988 | and it scrolls inside when a larger text size needs more. The quick |
| 1989 | bar is a capsule 8px above the on-screen keyboard while the document |
| 1990 | has the caret; where the browser has no visualViewport it is a strip |
| 1991 | under the bar (data-docs-quickbar="strip"). From 704px none of it is |
| 1992 | drawn. */ |
| 1993 | /* These rules hide by weight and by order, both. The second selector |
| 1994 | outweighs the desktop inspector's "[docs-inspector] |
| 1995 | [docs-toolbar-group] + [docs-toolbar-group] { display: flex }" |
| 1996 | (three attributes each, and this comes later). The compact rules |
| 1997 | below that show them again are at least as heavy and come later |
| 1998 | still. So: keep this block after the inspector's rules and before |
| 1999 | the compact ones, and don't wrap it in :where(), which would drop |
| 2000 | the weight that beats the desktop rule. TestTheFormatSheetAndTheQuickBar |
| 2001 | checks at 1280px that none of it is drawn. */ |
| 2002 | [docs-sheet-head], [docs-sheet-only], [docs-quickbar], |
| 2003 | [docs-inspector] [docs-toolbar-group][docs-sheet-only] { display: none; } |
| 2004 | @media (max-width: 703.98px), (max-height: 480px) and (pointer: coarse) { |
| 2005 | :root:not([data-docs-sheet="open"]) [docs-inspector][rst-box] { display: none; } |
| 2006 | :root[data-docs-sheet="open"] [docs-inspector][rst-box] { |
| 2007 | position: fixed; |
| 2008 | z-index: 46; |
| 2009 | inset-inline: 0; |
| 2010 | inset-block-end: 0; |
| 2011 | display: block; |
| 2012 | box-sizing: border-box; |
| 2013 | block-size: 50dvh; |
| 2014 | max-block-size: calc(100dvh - var(--estilo-bar-block-size)); |
| 2015 | overflow-y: auto; |
| 2016 | overscroll-behavior: contain; |
| 2017 | padding: var(--rst-sp-2) var(--rst-sp-4) calc(var(--rst-sp-4) + env(safe-area-inset-bottom)); |
| 2018 | border-radius: 28px 28px 0 0; |
| 2019 | background: var(--rst-surface); |
| 2020 | box-shadow: 0 -10px 40px -12px rgb(0 0 0 / 0.35), 0 0 0 1px light-dark(transparent, var(--rst-line)); |
| 2021 | } |
| 2022 | /* The page can be scrolled clear of the sheet. */ |
| 2023 | :root[data-docs-sheet="open"] [docs-page] { |
| 2024 | padding-block-end: calc(50dvh + var(--rst-sp-6)); /* spacing-allow: as tall as the sheet and a step more, so the end of the text scrolls clear of it */ |
| 2025 | } |
| 2026 | /* touch-action: none, or the sheet's own scroll takes the drag and the |
| 2027 | swipe down never reaches 60px. */ |
| 2028 | [docs-inspector] [docs-sheet-head] { display: flex; flex-wrap: wrap; align-items: center; margin-block-end: var(--rst-sp-2); touch-action: none; } |
| 2029 | [docs-sheet-grab] { |
| 2030 | flex: 0 0 100%; |
| 2031 | block-size: 5px; |
| 2032 | margin-block-end: var(--rst-sp-2); |
| 2033 | background: linear-gradient(var(--rst-line-strong), var(--rst-line-strong)) center / 36px 5px no-repeat; |
| 2034 | border-radius: 3px; |
| 2035 | touch-action: none; |
| 2036 | cursor: grab; |
| 2037 | } |
| 2038 | [docs-sheet-title] { flex: 1; margin: 0; color: var(--rst-text); font-size: 17px; font-weight: 650; } |
| 2039 | [docs-sheet-close] { |
| 2040 | position: relative; |
| 2041 | display: grid; |
| 2042 | place-items: center; |
| 2043 | inline-size: 32px; |
| 2044 | block-size: 32px; |
| 2045 | padding: 0; |
| 2046 | border: 0; |
| 2047 | border-radius: 50%; |
| 2048 | background: var(--rst-surface-2); |
| 2049 | color: var(--rst-text-muted); |
| 2050 | } |
| 2051 | [docs-sheet-close]::before { content: ""; position: absolute; inset: -6px; } |
| 2052 | [docs-inspector] [docs-toolbar] { |
| 2053 | display: flex; |
| 2054 | flex-wrap: wrap; |
| 2055 | gap: var(--rst-sp-3); |
| 2056 | overflow: visible; |
| 2057 | padding: 0; |
| 2058 | } |
| 2059 | [docs-inspector] [docs-toolbar-group] { |
| 2060 | flex: 1 1 calc(50% - var(--rst-sp-3)); |
| 2061 | flex-wrap: nowrap; |
| 2062 | gap: 0; |
| 2063 | min-inline-size: 9rem; |
| 2064 | margin: 0; |
| 2065 | padding: 0; |
| 2066 | border: 0; |
| 2067 | border-radius: 12px; |
| 2068 | background: var(--rst-surface-2); |
| 2069 | overflow: hidden; |
| 2070 | } |
| 2071 | [docs-inspector] [docs-toolbar-group] + [docs-toolbar-group] { margin: 0; padding: 0; border: 0; } |
| 2072 | [docs-inspector] [docs-toolbar-group] [docs-tool] { |
| 2073 | flex: 1 1 0; |
| 2074 | min-inline-size: 44px; |
| 2075 | block-size: 44px; |
| 2076 | border-radius: 10px; |
| 2077 | color: var(--rst-text); |
| 2078 | } |
| 2079 | [docs-inspector] [docs-toolbar-group] [docs-tool] svg { inline-size: 22px; block-size: 22px; } |
| 2080 | [docs-inspector] [docs-toolbar-group] [docs-tool][aria-pressed="true"] { background: var(--rst-accent-soft); color: var(--rst-accent); } |
| 2081 | /* Font and size: the font picker takes the row, the size picker sits |
| 2082 | between its two steps. The style picker is the chips here. */ |
| 2083 | [docs-inspector] [docs-toolbar-group="style"] { flex: 0 0 100%; gap: var(--rst-sp-2); background: none; overflow: visible; } |
| 2084 | [docs-inspector] [docs-toolbar-group="style"] [rst-combo]:has(#docs-select-block-combo), |
| 2085 | [docs-inspector] #docs-select-block { display: none; } |
| 2086 | [docs-inspector] [docs-toolbar-group="style"] [rst-combo]:has(#docs-select-font-combo), |
| 2087 | [docs-inspector] #docs-select-font { flex: 1 1 0; inline-size: auto; min-inline-size: 0; } |
| 2088 | [docs-inspector] [docs-toolbar-group="style"] [rst-combo]:has(#docs-select-size-combo), |
| 2089 | [docs-inspector] #docs-select-size { flex: none; inline-size: 4.5rem; order: 2; } |
| 2090 | [docs-inspector] [docs-step="down"] { order: 1; } |
| 2091 | [docs-inspector] [docs-step="up"] { order: 3; } |
| 2092 | [docs-inspector] [docs-toolbar-group="style"] [docs-tool] { flex: none; background: var(--rst-surface-2); color: var(--rst-accent); font-size: 22px; } |
| 2093 | [docs-inspector] [docs-toolbar-group="style"] :is(input, select) { block-size: 44px; font-size: max(1rem, 1em); } |
| 2094 | [docs-inspector] [docs-toolbar-group][docs-sheet-only] { display: flex; } |
| 2095 | [docs-inspector] [docs-toolbar-group="style"] [docs-sheet-only] { display: inline-grid; place-items: center; } |
| 2096 | /* Style: the chips first, each drawn as the style it sets. */ |
| 2097 | [docs-inspector] [docs-toolbar-group="style"] { flex-wrap: wrap; } |
| 2098 | [docs-inspector] [docs-toolbar-group="style"] [docs-chips] { |
| 2099 | display: flex; |
| 2100 | flex: 0 0 100%; |
| 2101 | gap: var(--rst-sp-2); |
| 2102 | overflow-x: auto; |
| 2103 | scrollbar-width: none; |
| 2104 | } |
| 2105 | [docs-inspector] [docs-toolbar-group="style"] [docs-chip] { |
| 2106 | min-inline-size: 0; |
| 2107 | padding: 0 var(--rst-sp-3); |
| 2108 | border: 1.5px solid transparent; |
| 2109 | border-radius: 12px; |
| 2110 | color: var(--rst-text); |
| 2111 | white-space: nowrap; |
| 2112 | } |
| 2113 | [docs-inspector] [docs-toolbar-group="style"] [docs-chip][aria-pressed="true"] { border-color: var(--rst-accent); background: var(--rst-accent-soft); color: var(--rst-text); } |
| 2114 | [docs-inspector] [docs-toolbar-group="style"] [docs-chip="paragraph"] { font-size: 16px; font-weight: 400; } |
| 2115 | [docs-inspector] [docs-toolbar-group="style"] [docs-chip="heading-1"] { font-size: 22px; font-weight: 700; } |
| 2116 | [docs-inspector] [docs-toolbar-group="style"] [docs-chip="heading-2"] { font-size: 19px; font-weight: 700; } |
| 2117 | [docs-inspector] [docs-toolbar-group="style"] [docs-chip="heading-3"] { font-size: 17px; font-weight: 700; } |
| 2118 | [docs-tool-glyph="clear"] { font-weight: 600; } |
| 2119 | [docs-tool-glyph="clear"] sub { font-size: 0.65em; } |
| 2120 | |
| 2121 | /* The quick bar: a capsule on the keyboard, placed by brand/phone.js |
| 2122 | (its bottom set inline from visualViewport), or a strip under the |
| 2123 | bar where there is no visualViewport. */ |
| 2124 | [docs-quickbar][data-shown] { |
| 2125 | position: fixed; |
| 2126 | z-index: 46; |
| 2127 | display: flex; |
| 2128 | align-items: center; |
| 2129 | gap: 0; |
| 2130 | } |
| 2131 | [docs-quickbar][data-shown="keyboard"] { |
| 2132 | inset-inline: var(--rst-sp-2); |
| 2133 | block-size: 48px; |
| 2134 | padding: 0 2px; /* spacing-allow: the capsule's 44px tools, 2px from its ends */ |
| 2135 | border-radius: 24px; |
| 2136 | background: light-dark(rgb(255 255 255 / 0.92), rgb(52 55 62 / 0.94)); |
| 2137 | -webkit-backdrop-filter: blur(16px) saturate(1.5); |
| 2138 | backdrop-filter: blur(16px) saturate(1.5); |
| 2139 | box-shadow: 0 8px 24px -10px rgb(0 0 0 / 0.35), inset 0 0 0 0.5px light-dark(rgb(0 0 0 / 0.1), rgb(255 255 255 / 0.12)); |
| 2140 | } |
| 2141 | [docs-quickbar][data-shown="strip"] { |
| 2142 | inset-inline: 0; |
| 2143 | inset-block-start: var(--estilo-bar-block-size); |
| 2144 | padding: 0 var(--rst-sp-2); |
| 2145 | border-block-end: 1px solid var(--rst-line); |
| 2146 | background: var(--rst-surface); |
| 2147 | } |
| 2148 | [docs-qtool] { |
| 2149 | display: inline-grid; |
| 2150 | place-items: center; |
| 2151 | min-inline-size: 42px; |
| 2152 | block-size: 44px; |
| 2153 | padding: 0; |
| 2154 | border: 0; |
| 2155 | border-radius: 22px; |
| 2156 | background: none; |
| 2157 | color: var(--rst-text); |
| 2158 | font-size: 18px; |
| 2159 | } |
| 2160 | [docs-qtool] svg { inline-size: 22px; block-size: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; } |
| 2161 | [docs-qtool][aria-pressed="true"], [docs-qtool][aria-expanded="true"] { background: var(--rst-accent-soft); color: var(--rst-accent); } |
| 2162 | [docs-qtool]:disabled { color: var(--rst-text-faint); } |
| 2163 | [docs-quickbar-hide] { margin-inline-start: auto; } |
| 2164 | [docs-quickbar-sep] { |
| 2165 | inline-size: 1px; |
| 2166 | block-size: 22px; |
| 2167 | margin: 0 2px; /* spacing-allow: a hairline between the capsule's sets */ |
| 2168 | background: var(--rst-line); |
| 2169 | } |
| 2170 | } |
| 2171 | /* The selection the sheet keeps while the keyboard is away (the |
| 2172 | editor's keptSelection decoration): drawn as the browser's own. */ |
| 2173 | [data-docs-kept] { background: rgb(46 91 180 / 0.25); } |
| 2174 | [data-docs-kept-caret] { |
| 2175 | border-inline-start: 2px solid #2e5bb4; |
| 2176 | margin-inline-start: -1px; /* spacing-allow: the drawn caret sits on the boundary, as the browser's does */ |
| 2177 | } |
| 2178 | </style> |
| 2179 | {{/* This page has no [rst-page-header]. It used to, and what it held |
| 2180 | is not gone — every piece of it moved to where its equivalent |
| 2181 | lives in the two applications this layout language comes from. |
| 2182 | What follows is only the map. |
| 2183 | |
| 2184 | The route back to the list was [docs-back], a breadcrumb above |
| 2185 | the title, and is now the bar's brand link, "Docs" — the same |
| 2186 | control on every screen rather than one this page draws for |
| 2187 | itself. Until [docs-back] landed this page had no in-app |
| 2188 | navigation at all, so arriving by a bookmark or a mailed link left |
| 2189 | a person with no route to their own list. |
| 2190 | |
| 2191 | The title is in the bar beside the brand, editable in place. |
| 2192 | |
| 2193 | Sign-out (POST /signout, auth.go) is in the bar's account menu and |
| 2194 | nowhere else: it used to be the last item of File as well. |
| 2195 | |
| 2196 | The exports are items in the File menu below. They used to be two |
| 2197 | ghost buttons pinned to the formatting bar's trailing end, which is |
| 2198 | what Paul's brief called the "random buttons": export is a |
| 2199 | document-level verb, and the formatting bar is a group of run-level |
| 2200 | controls, so it was the one place a person would not look. They are |
| 2201 | still ordinary links to ordinary URLs, so both still work with no |
| 2202 | JavaScript at all — spec §6.2 — and both are GETs of a document the |
| 2203 | signed-in person may already read, so neither needs a form or a CSRF |
| 2204 | token. download tells the browser to save rather than navigate; the |
| 2205 | filename it uses comes from the server's Content-Disposition, not |
| 2206 | from this attribute, because a title is arbitrary text a person |
| 2207 | typed and sanitising it belongs server-side (handlers.go's |
| 2208 | exportFilename). */}} |
| 2209 | {{/* The menu bar is in the estilo bar now (spec I2: chrome.Bar.Menubar, |
| 2210 | rendered from views/partials/editor_bar.html's docs-menubar): under |
| 2211 | the title from 800px, and estilo's second row below that. There is |
| 2212 | one menu bar in the page; this strip no longer draws its own. */}} |
| 2213 | {{/* [docs-chrome] is the single sticky element wrapping both bars. |
| 2214 | |
| 2215 | It was styled and never rendered for one review cycle, which cost |
| 2216 | two things at once: [docs-bar] had been `position: sticky` before |
| 2217 | this branch and stopped being, so the formatting bar scrolled away |
| 2218 | — a regression against main sitting under a 30-line comment |
| 2219 | describing the fix that replaced it; and File → Print printed the |
| 2220 | menu bar and the toolbar across the top of page one, because the |
| 2221 | print rule hides [docs-chrome] and nothing carried it. |
| 2222 | |
| 2223 | Both rules were correct. Neither had an element. */}} |
| 2224 | {{/* The large title (design/phone-web): the document's heading on a |
| 2225 | phone, three lines at most, with the save state as its subtitle |
| 2226 | (phone.go). Hidden from 704px, where the bar carries the title. A |
| 2227 | writer renames it in place: a tap on the heading (or ••• ▸ Rename) |
| 2228 | turns it into the field, Return renames through the same POST as the |
| 2229 | bar's title, Esc puts it back (brand/phone.js). With no script the |
| 2230 | field and its Rename button are shown instead of the heading, so it |
| 2231 | still renames. A reader's says "View only". */}} |
| 2232 | <div docs-title-block id="docs-title"> |
| 2233 | {{- if .CanWrite}} |
| 2234 | <form docs-title-form method="post" action="/d/{{.Sqid}}/title"> |
| 2235 | <h1 docs-title dir="auto"><button type="button" docs-title-edit aria-describedby="docs-title-edit-says"><span docs-title-text>{{.Title}}</span></button></h1> |
| 2236 | <span id="docs-title-edit-says" hidden>{{.Large.Rename}}</span> |
| 2237 | <input docs-title-input id="docs-title-input" name="title" value="{{.Title}}" maxlength="256" aria-label="{{.Large.TitleLabel}}" aria-describedby="docs-title-hint" autocomplete="off" spellcheck="false" dir="auto" enterkeyhint="done"> |
| 2238 | <p docs-title-hint id="docs-title-hint">{{.Large.TitleHint}}</p> |
| 2239 | <p docs-title-error role="alert" hidden>{{.Large.RenameFailed}}</p> |
| 2240 | <button rst-btn="ghost" type="button" docs-title-cancel>{{.Large.Cancel}}</button> |
| 2241 | <button rst-btn type="submit" docs-title-submit>{{.Large.Rename}}</button> |
| 2242 | </form> |
| 2243 | {{- else}} |
| 2244 | <h1 docs-title dir="auto"><span docs-title-text>{{.Title}}</span></h1> |
| 2245 | {{- end}} |
| 2246 | <p docs-subtitle>{{with .Large.Shared}}<span docs-subtitle-shared>{{.}}</span><span docs-subtitle-dot aria-hidden="true"></span>{{end}}{{if .CanWrite}}{{template "estilo-save-status" .Large.Status}}{{else}}<span docs-view-only><svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/></svg>{{.Large.ViewOnly}}</span>{{end}}</p> |
| 2247 | </div> |
| 2248 | <div docs-chrome> |
| 2249 | {{/* A reader cannot format: no strip, no inspector, no undo/redo (review |
| 2250 | on #106). The editor bundle, which drives them, is the writer's too. */}} |
| 2251 | {{if .CanWrite}}<div docs-bar id="docs-strip"> |
| 2252 | {{/* The formatting bar (fixtures/toolbar.mjs). Rendered server-side, |
| 2253 | with every label resolved from the catalog (render.go's |
| 2254 | docs.editor.toolbar.*) — the bundle carries no copy of its own, |
| 2255 | the same rule [estilo-save-status] below already follows. |
| 2256 | |
| 2257 | It is rendered even for a reader with no JavaScript, where it |
| 2258 | does nothing at all. That is a deliberate choice and the weaker |
| 2259 | of the two: the alternative is rendering it only when the editor |
| 2260 | mounts, which means the page reflows under a person the moment |
| 2261 | the bundle runs, and means the server template has to know |
| 2262 | something it cannot know. A visible-but-inert bar is the smaller |
| 2263 | harm, and the controls are all disabled until the toolbar's own |
| 2264 | plugin enables them, so nothing here invites a click that would |
| 2265 | silently do nothing. |
| 2266 | |
| 2267 | role="toolbar" with an accessible name, and each control's name |
| 2268 | from the catalog rather than from its glyph: a button whose only |
| 2269 | content is a "B" announces as "B" to a screen reader without |
| 2270 | one. */}} |
| 2271 | {{/* Undo and redo, below 800px: the bar's lead slot carries the same |
| 2272 | pair from 800px (views/partials/editor_bar.html). Outside the |
| 2273 | toolbar, and out of its roving tab stop (spec I2, P1.2 and C6). */}} |
| 2274 | {{template "docs-history" .Toolbar.StripHistory}} |
| 2275 | {{/* The inspector (spec I2): from 64rem the formatting bar is a panel |
| 2276 | floating under the header at the inline end, its groups labelled |
| 2277 | sections; from 800px to 64rem it is the strip under the header, and |
| 2278 | below 800px the phone's strip, as before. One element at every |
| 2279 | width, so one role="toolbar", one roving tab stop, and one set of |
| 2280 | tests. The aside is what the bar's Format toggle controls; its |
| 2281 | state is the docs-inspector cookie's, rendered here (menu.go's |
| 2282 | inspectorState), and closed hides it only at 64rem and up: below |
| 2283 | that the strip shows regardless (C3). rst-box makes it a card for |
| 2284 | rastrillo's light.js, whose rim and wash brand/light.css draws. */}} |
| 2285 | <aside docs-inspector id="{{.InspectorID}}" rst-box data-state="{{.Inspector}}" aria-label="{{.Toolbar.Inspector}}"> |
| 2286 | {{/* The phone's Format sheet's head (design/phone-web, P2): below 704px |
| 2287 | this aside is a half-height bottom sheet that Aa opens |
| 2288 | (brand/phone.js), and this is its grabber, title and close. Not drawn |
| 2289 | at any other width, where the aside is the strip or the inspector. */}} |
| 2290 | <div docs-sheet-head> |
| 2291 | <span docs-sheet-grab aria-hidden="true"></span> |
| 2292 | <h2 docs-sheet-title tabindex="-1">{{.Toolbar.Format}}</h2> |
| 2293 | <button docs-sheet-close type="button" aria-label="{{.Toolbar.Close}}"><svg viewBox="0 0 20 20" width="16" height="16" aria-hidden="true" focusable="false"><path d="M5 5l10 10M15 5 5 15" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" fill="none"/></svg></button> |
| 2294 | </div> |
| 2295 | <div docs-toolbar role="toolbar" aria-orientation="horizontal" aria-label="{{.Toolbar.Label}}"> |
| 2296 | {{/* The three selects opt into rastrillo's searchable-select |
| 2297 | enhancement (ui/select.js, already served by render.go's |
| 2298 | vendoredStaticFS and linked by the shell's own layout). Paul's |
| 2299 | brief: "selects should be Rastrillo design system searchable |
| 2300 | selects". |
| 2301 | |
| 2302 | data-rst-select is the opt-in for a HAND-WRITTEN select — |
| 2303 | ui/partials/field-select.html emits it only past ten options, on |
| 2304 | the framework's judgement that search over a handful of items is |
| 2305 | furniture rather than help. All three take it here anyway. Two |
| 2306 | reasons: they sit side by side in one group, and one combobox |
| 2307 | flanked by two native selects looks worse than either extreme; |
| 2308 | and all three are growth surfaces — Size has eleven options |
| 2309 | already, Style grows with named styles, and the face list is |
| 2310 | built to grow. If the filter over three fonts reads as silly in |
| 2311 | the morning it is one attribute to take off, which is why the |
| 2312 | tension is recorded rather than resolved silently. |
| 2313 | |
| 2314 | The three data-rst-select-* strings are the framework's own |
| 2315 | catalog keys, resolved server-side (export.go) because select.js |
| 2316 | builds its markup in the browser where the catalog is out of |
| 2317 | reach. |
| 2318 | |
| 2319 | Still `disabled` until the editor mounts, like every other |
| 2320 | control in this bar — and select.js does NOT mirror that, so |
| 2321 | toolbar.mjs mirrors it onto the combobox by hand. Left alone, |
| 2322 | the enhancement ships a control that looks usable, accepts focus |
| 2323 | and typing, and drives a disabled select behind it. */}} |
| 2324 | <div docs-toolbar-group="style" role="group" aria-labelledby="docs-group-style"> |
| 2325 | <span docs-toolbar-label id="docs-group-style">{{.Toolbar.GroupStyle}}</span> |
| 2326 | {{/* The sheet's style chips (design/phone-web, P2): the paragraph |
| 2327 | styles as buttons, each drawn at its own size and weight, pressed |
| 2328 | for the style the selection is in. Sheet only: elsewhere the block |
| 2329 | select below is the style control. Inside this group, not a group |
| 2330 | of their own before it, so the groups after Style keep the |
| 2331 | neighbours they have on the desktop. A ceiling to ui/select.js, |
| 2332 | so the font and size lists below them open downward, inside the |
| 2333 | sheet, and never up over the chips (it skips a ceiling that is |
| 2334 | not drawn, as on the desktop). */}} |
| 2335 | <div docs-chips docs-sheet-only data-rst-select-ceiling> |
| 2336 | {{range .Toolbar.Blocks}}<button docs-tool docs-chip="{{.Value}}" tabindex="-1" type="button" data-docs-command="block_{{.Value}}" aria-pressed="false" disabled>{{.Label}}</button>{{end}} |
| 2337 | </div> |
| 2338 | <select docs-tool-select rst-input id="docs-select-block" tabindex="-1" disabled data-docs-select="block" aria-label="{{.Toolbar.BlockLabel}}" |
| 2339 | data-rst-select data-rst-select-filter="{{.Toolbar.SelectFilter}}" data-rst-select-results="{{.Toolbar.SelectResults}}" data-rst-select-result-one="{{.Toolbar.SelectResultOne}}"> |
| 2340 | {{range .Toolbar.Blocks}}<option value="{{.Value}}" data-rst-class="docs-style-{{.Value}}">{{.Label}}</option>{{end}} |
| 2341 | </select> |
| 2342 | <select docs-tool-select rst-input id="docs-select-font" tabindex="-1" disabled data-docs-select="font" aria-label="{{.Toolbar.FontLabel}}" |
| 2343 | data-rst-select data-rst-select-filter="{{.Toolbar.SelectFilter}}" data-rst-select-results="{{.Toolbar.SelectResults}}" data-rst-select-result-one="{{.Toolbar.SelectResultOne}}"> |
| 2344 | {{/* Each family's name, drawn in its own face: ui/select.js puts |
| 2345 | data-rst-class on the row and on the closed box (rastrillo |
| 2346 | v0.28.0), and the class is a name-only preview subset |
| 2347 | (internal/fonts). The name is the family's own, is not |
| 2348 | translated, and is the whole row: no description. */}} |
| 2349 | {{range .Toolbar.Fonts}}<option value="{{.Value}}" data-rst-class="{{.Class}}">{{.Name}}</option>{{end}} |
| 2350 | </select> |
| 2351 | <select docs-tool-select rst-input id="docs-select-size" tabindex="-1" disabled data-docs-select="size" aria-label="{{.Toolbar.SizeLabel}}" |
| 2352 | data-rst-select data-rst-select-filter="{{.Toolbar.SelectFilter}}" data-rst-select-results="{{.Toolbar.SelectResults}}" data-rst-select-result-one="{{.Toolbar.SelectResultOne}}"> |
| 2353 | {{range .Toolbar.Sizes}}<option value="{{.Value}}">{{.Label}}</option>{{end}} |
| 2354 | </select> |
| 2355 | {{/* The sheet's size stepper: one step down or up the ladder either |
| 2356 | side of the size picker (toolbar.mjs's size_down and size_up). */}} |
| 2357 | <button docs-tool docs-sheet-only docs-step="down" tabindex="-1" type="button" data-docs-command="size_down" aria-label="{{.Toolbar.SizeDown}}" disabled><span aria-hidden="true">−</span></button> |
| 2358 | <button docs-tool docs-sheet-only docs-step="up" tabindex="-1" type="button" data-docs-command="size_up" aria-label="{{.Toolbar.SizeUp}}" disabled><span aria-hidden="true">+</span></button> |
| 2359 | </div> |
| 2360 | <div docs-toolbar-group="text" role="group" aria-labelledby="docs-group-text"> |
| 2361 | <span docs-toolbar-label id="docs-group-text">{{.Toolbar.GroupText}}</span> |
| 2362 | <button docs-tool tabindex="-1" type="button" data-docs-command="strong" aria-label="{{.Toolbar.Bold}}" aria-pressed="false" disabled> |
| 2363 | <span docs-tool-glyph="bold" aria-hidden="true">B</span> |
| 2364 | </button> |
| 2365 | <button docs-tool tabindex="-1" type="button" data-docs-command="em" aria-label="{{.Toolbar.Italic}}" aria-pressed="false" disabled> |
| 2366 | <span docs-tool-glyph="italic" aria-hidden="true">I</span> |
| 2367 | </button> |
| 2368 | <button docs-tool tabindex="-1" type="button" data-docs-command="code" aria-label="{{.Toolbar.Code}}" aria-pressed="false" disabled> |
| 2369 | <span docs-tool-glyph="code" aria-hidden="true"><></span> |
| 2370 | </button> |
| 2371 | </div> |
| 2372 | {{/* Alignment: the first block-level formatting, so it gets a group |
| 2373 | of its own between the inline marks and the list controls, which |
| 2374 | is also where the block it acts on sits in the reading order. |
| 2375 | |
| 2376 | aria-pressed rather than a select, and exactly one of the three |
| 2377 | is pressed at any moment — toolbar.mjs's sync sets it from the |
| 2378 | block the cursor is in, the same way Bold reads the marks there. |
| 2379 | [docs-tool]'s 28px box already clears WCAG 2.2 AA's 24x24 |
| 2380 | minimum. These three are icon-only, so the pressed state is shown |
| 2381 | by the inset bar under the glyph rather than by the weight change |
| 2382 | that serves B/I/<> — see that rule's own comment, which used to |
| 2383 | claim the weight covered every button and did not (§10.3: colour |
| 2384 | never carries meaning alone). */}} |
| 2385 | <div docs-toolbar-group="align" role="group" aria-labelledby="docs-group-align"> |
| 2386 | <span docs-toolbar-label id="docs-group-align">{{.Toolbar.GroupAlign}}</span> |
| 2387 | <button docs-tool tabindex="-1" type="button" data-docs-command="align_left" aria-label="{{.Toolbar.AlignLeft}}" aria-pressed="false" disabled> |
| 2388 | <svg viewBox="0 0 20 20" aria-hidden="true" focusable="false"><path d="M3 5h14M3 9h9M3 13h14M3 17h9"/></svg> |
| 2389 | </button> |
| 2390 | <button docs-tool tabindex="-1" type="button" data-docs-command="align_center" aria-label="{{.Toolbar.AlignCenter}}" aria-pressed="false" disabled> |
| 2391 | <svg viewBox="0 0 20 20" aria-hidden="true" focusable="false"><path d="M3 5h14M5.5 9h9M3 13h14M5.5 17h9"/></svg> |
| 2392 | </button> |
| 2393 | <button docs-tool tabindex="-1" type="button" data-docs-command="align_right" aria-label="{{.Toolbar.AlignRight}}" aria-pressed="false" disabled> |
| 2394 | <svg viewBox="0 0 20 20" aria-hidden="true" focusable="false"><path d="M3 5h14M8 9h9M3 13h14M8 17h9"/></svg> |
| 2395 | </button> |
| 2396 | </div> |
| 2397 | <div docs-toolbar-group="lists" role="group" aria-labelledby="docs-group-lists"> |
| 2398 | <span docs-toolbar-label id="docs-group-lists">{{.Toolbar.GroupLists}}</span> |
| 2399 | <button docs-tool tabindex="-1" type="button" data-docs-command="bullet_list" aria-label="{{.Toolbar.BulletList}}" aria-pressed="false" disabled> |
| 2400 | <svg viewBox="0 0 20 20" aria-hidden="true" focusable="false"><circle cx="4" cy="6" r="1.1" fill="currentColor" stroke="none"/><circle cx="4" cy="10" r="1.1" fill="currentColor" stroke="none"/><circle cx="4" cy="14" r="1.1" fill="currentColor" stroke="none"/><path d="M8 6h9M8 10h9M8 14h9"/></svg> |
| 2401 | </button> |
| 2402 | <button docs-tool tabindex="-1" type="button" data-docs-command="ordered_list" aria-label="{{.Toolbar.OrderedList}}" aria-pressed="false" disabled> |
| 2403 | <svg viewBox="0 0 20 20" aria-hidden="true" focusable="false"><path d="M8 6h9M8 10h9M8 14h9"/><text x="1.5" y="7.6" font-size="5.5" fill="currentColor" stroke="none">1</text><text x="1.5" y="11.6" font-size="5.5" fill="currentColor" stroke="none">2</text><text x="1.5" y="15.6" font-size="5.5" fill="currentColor" stroke="none">3</text></svg> |
| 2404 | </button> |
| 2405 | <button docs-tool tabindex="-1" type="button" data-docs-command="blockquote" aria-label="{{.Toolbar.Quote}}" aria-pressed="false" disabled> |
| 2406 | <svg viewBox="0 0 20 20" aria-hidden="true" focusable="false"><path d="M4 5v10"/><path d="M8 7h9M8 11h9M8 15h6"/></svg> |
| 2407 | </button> |
| 2408 | </div> |
| 2409 | {{/* Insert (Docs images spec §2.1): the image button, which opens a |
| 2410 | file picker; drawn only where images are set up. */}} |
| 2411 | {{if .Images.On}}<div docs-toolbar-group="insert" role="group" aria-labelledby="docs-group-insert"> |
| 2412 | <span docs-toolbar-label id="docs-group-insert">{{.Images.Insert}}</span> |
| 2413 | <button docs-tool tabindex="-1" type="button" data-docs-command="insert_image" aria-label="{{.Images.Image}}" disabled> |
| 2414 | <svg viewBox="0 0 20 20" aria-hidden="true" focusable="false"><rect x="2.5" y="4" width="15" height="12" rx="1.5"/><circle cx="7" cy="8.5" r="1.4"/><path d="m3 14.5 4.5-4 3.5 3 2.5-2 3.5 3"/></svg> |
| 2415 | </button> |
| 2416 | </div>{{end}} |
| 2417 | {{/* The sheet's last group: outdent, indent and clear formatting, which |
| 2418 | only the Format menu had (the audit's finding 3). Sheet only. */}} |
| 2419 | <div docs-toolbar-group="more" docs-sheet-only role="group" aria-labelledby="docs-group-more"> |
| 2420 | <span docs-toolbar-label id="docs-group-more">{{.Toolbar.GroupMore}}</span> |
| 2421 | <button docs-tool tabindex="-1" type="button" data-docs-command="outdent" aria-label="{{.Toolbar.Outdent}}" disabled> |
| 2422 | <svg viewBox="0 0 20 20" aria-hidden="true" focusable="false"><path d="M3 5h14M9 9h8M9 13h8M3 17h14"/><path d="M6 9 3.5 11 6 13"/></svg> |
| 2423 | </button> |
| 2424 | <button docs-tool tabindex="-1" type="button" data-docs-command="indent" aria-label="{{.Toolbar.Indent}}" disabled> |
| 2425 | <svg viewBox="0 0 20 20" aria-hidden="true" focusable="false"><path d="M3 5h14M9 9h8M9 13h8M3 17h14"/><path d="M3.5 9 6 11l-2.5 2"/></svg> |
| 2426 | </button> |
| 2427 | <button docs-tool tabindex="-1" type="button" data-docs-command="clear_formatting" aria-label="{{.Toolbar.Clear}}" disabled> |
| 2428 | <span docs-tool-glyph="clear" aria-hidden="true">T<sub>×</sub></span> |
| 2429 | </button> |
| 2430 | </div> |
| 2431 | </div> |
| 2432 | </aside> |
| 2433 | </div>{{end}} |
| 2434 | {{/* What the page says about its fonts, just under the bars: a font |
| 2435 | is loading, a change was refused while it did, a font could not be |
| 2436 | loaded, or substitutes are shown (fixtures/font-status.mjs). The |
| 2437 | copy is the catalog's; the script picks which to say. */}} |
| 2438 | <div docs-fonts-status data-loading="{{.Fonts.Loading}}" data-refused="{{.Fonts.Refused}}" data-unavailable="{{.Fonts.Unavailable}}" data-substitute="{{.Fonts.Substitute}}"> |
| 2439 | <p docs-fonts-status-text role="status"></p> |
| 2440 | <button docs-fonts-status-dismiss type="button" aria-label="{{.Fonts.Dismiss}}" title="{{.Fonts.Dismiss}}"><svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true" focusable="false"><path d="M5 5l10 10M15 5 5 15" stroke="currentColor" stroke-width="1.6" fill="none"/></svg></button> |
| 2441 | </div> |
| 2442 | </div>{{/* closes [docs-chrome] */}} |
| 2443 | {{/* data-view is the person's paged/infinite preference, read from the |
| 2444 | docs-view cookie server-side (menu.go's viewMode) so the FIRST |
| 2445 | paint is already right. Doing it in the bundle instead would mean |
| 2446 | anyone who prefers paged watches an infinite document reflow into |
| 2447 | pages a moment after it appears. |
| 2448 | |
| 2449 | data-page-label is the page-number template |
| 2450 | ("Page {n}") for fixtures/pages.mjs to stamp into each gap. Copy, |
| 2451 | so it comes from the catalog here rather than being a literal in |
| 2452 | the bundle — the rule the toolbar and the save-status indicator |
| 2453 | already follow. */}} |
| 2454 | {{/* data-docs-fonts-need names the faces the sheet is shown in, which |
| 2455 | fixtures/fonts-gate.mjs waits for: fontgate.go. */}} |
| 2456 | <div docs-canvas data-view="{{.ViewMode}}" data-page-label="{{.PageLabel}}" data-docs-fonts-need="{{.Fonts.Need}}"> |
| 2457 | <div docs-page> |
| 2458 | {{/* docs-editor is the ProseMirror mount point (fixtures/editor-entry.js, |
| 2459 | Task 6): the same [docs-text] container the scriptless read view |
| 2460 | already renders into, not a second element beside it. ProseMirror |
| 2461 | replaces this container's contents only once it mounts, so the |
| 2462 | server-rendered {{.HTML}} below is what a scriptless reader sees |
| 2463 | and what a scripted reader sees until the editor takes over — spec |
| 2464 | §6.2, and editor_view_test.go's own |
| 2465 | TestShowRendersContentWithoutScript pins it. data-sqid is the |
| 2466 | bundle's only way to learn which document's update log |
| 2467 | (/d/{{.Sqid}}/updates) to load and post to. */}} |
| 2468 | {{/* A reader gets the same container without the mount point, the |
| 2469 | data-sqid or (below) the script — absent, not disabled, because a |
| 2470 | disabled editor is one CSS rule from being an editor again. The |
| 2471 | server-rendered HTML is identical either way, so this is the |
| 2472 | scriptless read view the whole page already falls back to. */}} |
| 2473 | {{if .CanWrite}}<div docs-text docs-editor data-sqid="{{.Sqid}}" data-save-status-module="{{asset "static/estilo-save-status.mjs"}}"{{if .Images.On}} data-images{{end}}>{{.HTML}}</div> |
| 2474 | {{else}}<div docs-text>{{.HTML}}</div>{{end}} |
| 2475 | </div> |
| 2476 | </div> |
| 2477 | {{/* The quick format bar (design/phone-web, P2; Paul's answer 2): on a |
| 2478 | phone, while the document has the caret and the on-screen keyboard is |
| 2479 | up, a capsule 8px above the keyboard, kept there by brand/phone.js on |
| 2480 | visualViewport. Where a browser has no visualViewport it is a strip |
| 2481 | under the bar instead. Aa opens the Format sheet; B, I and the lists |
| 2482 | are bound and kept current by the toolbar (fixtures/toolbar.mjs, as |
| 2483 | the undo/redo pairs are: outside the role="toolbar"); the last button |
| 2484 | puts the keyboard away. A writer's only, and never drawn from 704px. */}} |
| 2485 | {{if .CanWrite}}<div docs-quickbar role="group" aria-label="{{.Toolbar.Format}}"> |
| 2486 | <button docs-qtool docs-quickbar-aa type="button" aria-label="{{.Toolbar.Format}}" aria-controls="{{.InspectorID}}" aria-expanded="false" disabled><span docs-aa-glyph aria-hidden="true">Aa</span></button> |
| 2487 | <span docs-quickbar-sep aria-hidden="true"></span> |
| 2488 | <button docs-qtool type="button" data-docs-command="strong" aria-label="{{.Toolbar.Bold}}" aria-pressed="false" disabled><span docs-tool-glyph="bold" aria-hidden="true">B</span></button> |
| 2489 | <button docs-qtool type="button" data-docs-command="em" aria-label="{{.Toolbar.Italic}}" aria-pressed="false" disabled><span docs-tool-glyph="italic" aria-hidden="true">I</span></button> |
| 2490 | <button docs-qtool type="button" data-docs-command="bullet_list" aria-label="{{.Toolbar.BulletList}}" aria-pressed="false" disabled><svg viewBox="0 0 20 20" aria-hidden="true" focusable="false"><circle cx="4" cy="6" r="1.1" fill="currentColor" stroke="none"/><circle cx="4" cy="10" r="1.1" fill="currentColor" stroke="none"/><circle cx="4" cy="14" r="1.1" fill="currentColor" stroke="none"/><path d="M8 6h9M8 10h9M8 14h9"/></svg></button> |
| 2491 | <button docs-qtool type="button" data-docs-command="ordered_list" aria-label="{{.Toolbar.OrderedList}}" aria-pressed="false" disabled><svg viewBox="0 0 20 20" aria-hidden="true" focusable="false"><path d="M8 6h9M8 10h9M8 14h9"/><text x="1.5" y="7.6" font-size="5.5" fill="currentColor" stroke="none">1</text><text x="1.5" y="11.6" font-size="5.5" fill="currentColor" stroke="none">2</text><text x="1.5" y="15.6" font-size="5.5" fill="currentColor" stroke="none">3</text></svg></button> |
| 2492 | <button docs-qtool type="button" data-docs-command="blockquote" aria-label="{{.Toolbar.Quote}}" aria-pressed="false" disabled><svg viewBox="0 0 20 20" aria-hidden="true" focusable="false"><path d="M4 5v10"/><path d="M8 7h9M8 11h9M8 15h6"/></svg></button> |
| 2493 | {{if .Images.On}}<button docs-qtool type="button" data-docs-command="insert_image" aria-label="{{.Images.Image}}" disabled><svg viewBox="0 0 20 20" aria-hidden="true" focusable="false"><rect x="2.5" y="4" width="15" height="12" rx="1.5"/><circle cx="7" cy="8.5" r="1.4"/><path d="m3 14.5 4.5-4 3.5 3 2.5-2 3.5 3"/></svg></button>{{end}} |
| 2494 | <span docs-quickbar-sep aria-hidden="true"></span> |
| 2495 | <button docs-qtool docs-quickbar-hide type="button" aria-label="{{.Toolbar.HideKeyboard}}" disabled><svg viewBox="0 0 20 20" aria-hidden="true" focusable="false"><rect x="2.5" y="3.5" width="15" height="9" rx="1.5"/><path d="M5.5 6.5h1M9.5 6.5h1M13.5 6.5h1M6.5 9.5h7"/><path d="m7.5 15 2.5 2.5 2.5-2.5"/></svg></button> |
| 2496 | </div>{{end}} |
| 2497 | {{/* What the editor says about an image (fixtures/image-upload.mjs and |
| 2498 | image-view.mjs read these by name): the catalog's, since the bundle |
| 2499 | carries no copy of its own. A writer's only; the read view draws |
| 2500 | images on the server. */}} |
| 2501 | {{if .CanWrite}}{{with .Images}}<div docs-images hidden |
| 2502 | data-uploading="{{.Uploading}}" data-not-uploaded="{{.NotUploaded}}" data-not-uploaded-why="{{.NotUploadedWhy}}" |
| 2503 | data-error-type="{{.ErrorType}}" data-error-svg="{{.ErrorSVG}}" data-error-size="{{.ErrorSize}}" |
| 2504 | data-error-offline="{{.ErrorOffline}}" data-error-failed="{{.ErrorFailed}}" data-error-off="{{.ErrorOff}}" |
| 2505 | data-retry="{{.Retry}}" data-remove="{{.Remove}}" data-added="{{.Added}}" data-added-end="{{.AddedEnd}}" |
| 2506 | data-left-one="{{.LeftOne}}" data-left-other="{{.LeftOther}}" data-missing="{{.Missing}}" |
| 2507 | data-name="{{.Name}}" data-name-none="{{.NameNone}}" data-unnamed="{{.Unnamed}}" data-alt-badge="{{.AltBadge}}" data-alt-add="{{.AltAdd}}" |
| 2508 | data-alt-edit="{{.AltEdit}}" data-alt-label="{{.AltLabel}}" data-alt-text="{{.AltText}}" data-open="{{.Open}}" |
| 2509 | data-bubble="{{.Bubble}}"></div>{{end}}{{end}} |
| 2510 | {{/* The Tools menu's two dialogs. |
| 2511 | |
| 2512 | Native <dialog>, so the browser provides modality, Escape, focus |
| 2513 | trapping and the backdrop — four things that are easy to get subtly |
| 2514 | wrong by hand and none of which is the interesting part of either |
| 2515 | feature. |
| 2516 | |
| 2517 | Rendered on every document page and empty until opened: the copy is |
| 2518 | here because every user-visible string is a catalog key, and the |
| 2519 | bundle fills in numbers (fixtures/wordcount.mjs) and rows |
| 2520 | (fixtures/shortcuts.mjs) only. With no JavaScript neither can open, |
| 2521 | which is honest — there is no editor to count or to send keys to. |
| 2522 | |
| 2523 | Outside [docs-editor], like every other piece of chrome on this |
| 2524 | screen: ProseMirror's {mount: el} takes over everything inside that |
| 2525 | element. */}} |
| 2526 | {{/* The import report, once, on arrival from POST /import. Open from |
| 2527 | the server and closed by a dialog form, so it needs no script; it |
| 2528 | reopens from the bar's Import report link (/d/{sqid}/import-report). */}} |
| 2529 | {{with .ImportReport}}<dialog docs-dialog docs-import-arrival open> |
| 2530 | {{template "docs-import-report" .}} |
| 2531 | <form method="dialog"><button rst-btn="primary" type="submit" autofocus>{{$.CloseReport}}</button></form> |
| 2532 | </dialog>{{end}} |
| 2533 | <dialog docs-dialog docs-wordcount> |
| 2534 | <h2>{{.Dialogs.WordCountTitle}}</h2> |
| 2535 | <dl docs-dialog-rows> |
| 2536 | <div><dt>{{.Dialogs.WordCountWords}}</dt><dd docs-count-words>0</dd></div> |
| 2537 | <div><dt>{{.Dialogs.WordCountCharacters}}</dt><dd docs-count-characters>0</dd></div> |
| 2538 | <div><dt>{{.Dialogs.WordCountCharactersNoSpaces}}</dt><dd docs-count-characters-nospaces>0</dd></div> |
| 2539 | <div><dt>{{.Dialogs.WordCountParagraphs}}</dt><dd docs-count-paragraphs>0</dd></div> |
| 2540 | {{/* Hidden until something is selected — a row reading "0" invites |
| 2541 | a reader to work out whether that is a count or an absence. */}} |
| 2542 | <div docs-count-selection hidden><dt>{{.Dialogs.WordCountSelection}}</dt><dd docs-count-selection-words>0</dd></div> |
| 2543 | </dl> |
| 2544 | <form method="dialog"><button rst-btn="ghost" type="submit">{{.Dialogs.WordCountClose}}</button></form> |
| 2545 | </dialog> |
| 2546 | <dialog docs-dialog docs-shortcuts> |
| 2547 | <h2>{{.Dialogs.ShortcutsTitle}}</h2> |
| 2548 | <div docs-shortcuts-body></div> |
| 2549 | {{/* The bindings no menu item carries, so shortcuts.mjs cannot read |
| 2550 | them off the bar. Rendered here as data for it to pick up rather |
| 2551 | than as literals in the bundle. */}} |
| 2552 | <div docs-shortcuts-extra hidden data-group="{{.Dialogs.ShortcutsGroup}}"> |
| 2553 | {{range .Dialogs.ShortcutsExtra}}<span data-label="{{.Label}}" data-keys="{{.Keys}}"></span>{{end}} |
| 2554 | </div> |
| 2555 | <form method="dialog"><button rst-btn="ghost" type="submit">{{.Dialogs.ShortcutsClose}}</button></form> |
| 2556 | </dialog> |
| 2557 | {{template "estilo-save-status" .SaveStatus}} |
| 2558 | {{/* type="module" defer: modules are deferred by default, but stated |
| 2559 | explicitly here so load order (after the DOM, before DOMContentLoaded) |
| 2560 | doesn't depend on that default going unnoticed by a future edit. Served |
| 2561 | without a session (assets.go's staticHandler, ahead of the |
| 2562 | RequireSession group) and, if it throws, editor-entry.js's own catch |
| 2563 | marks [docs-editor] data-editor-failed rather than clearing it — the |
| 2564 | read view above stays exactly as rendered. */}} |
| 2565 | {{/* The font gate first: scripts run in document order, and the editor |
| 2566 | registers with it (fixtures/fonts-gate.mjs). */}} |
| 2567 | <script type="module" src="{{.Fonts.Script}}"></script> |
| 2568 | {{if .CanWrite}}<script type="module" defer src="{{.EditorScript}}"></script>{{end}} |
| 2569 | {{/* The Share popover (brand/share-pop.js), for the owner, who alone |
| 2570 | has a Share in the bar. */}} |
| 2571 | {{if .CanShare}}<link rel="stylesheet" href="{{asset "static/brand/share-pop.css"}}"> |
| 2572 | <script defer src="{{asset "static/brand/share-pop.js"}}"></script>{{end}} |
| 2573 | {{/* The Format toggle (brand/inspector.js): enables the bar's button, |
| 2574 | shows and hides the inspector and remembers it in the cookie. Without |
| 2575 | it the button stays disabled and the inspector open. */}} |
| 2576 | {{if .CanWrite}}<script defer src="{{asset "static/brand/inspector.js"}}"></script>{{end}} |
| 2577 | {{/* The phone screen (brand/phone.js): the bar folds the title in as the |
| 2578 | large title scrolls away, ••• runs the menu bar's commands and Rename, |
| 2579 | Aa shows the strip, and the large title renames in place. Everyone |
| 2580 | gets it; a reader's page has only the fold and •••. */}} |
| 2581 | <script defer src="{{asset "static/brand/phone.js"}}"></script> |
| 2582 | {{template "docs-jumpto" .}} |
| 2583 | {{end}} |
| 2584 | |