oficina / mapa Public

Clone
git clone https://amadan.net/oficina/mapa

Plain git — no account needed to clone.

Download

Download this file

1/* prose.css: a page's body as the editor draws it (spec §4.2, §5).
2 *
3 * The server's HTML is the editor's DOM (internal/mapa/markup/render.go,
4 * editor/schema.mjs), so this one file styles both, before and after the
5 * editor mounts. [mapa-body] is today's page body; [mapa-prose] is the
6 * same surface in the new shell. Chips are styled wherever they appear:
7 * the Links lists show them too.
8 *
9 * Calma: only the icons carry colour. Look and measurements are the
10 * mock-up's (oficina/polish-audit/mapa-ux, css/mock.css). Only tokens.css
11 * custom properties are used, so the light/dark switch applies. */
12
13:is([mapa-body], [mapa-prose]) {
14 font-size: 16px;
15 line-height: 1.7;
16 overflow-wrap: anywhere;
17}
18
19/* Textblocks keep the spaces a person typed, as the editor needs; blocks
20 * themselves have no text between them, so nothing else needs it. */
21:is([mapa-body], [mapa-prose]) :is(p, h2, h3, h4, h5, h6, li > p,
22 blockquote p, pre) {
23 white-space: pre-wrap;
24}
25
26:is([mapa-body], [mapa-prose]) p { margin: 0 0 0.85em; /* spacing-allow: the document's own typographic rhythm, in em of its text (the server's HTML and the editor's DOM share it; gates L1 to L5) */ }
27:is([mapa-body], [mapa-prose]) > :first-child { margin-block-start: 0; }
28:is([mapa-body], [mapa-prose]) h2 {
29 margin: 1.9em 0 0.45em; /* spacing-allow: the document's own typographic rhythm, in em of its text (the server's HTML and the editor's DOM share it; gates L1 to L5) */
30 font-size: 1.375rem;
31 line-height: 1.25;
32 font-weight: 680;
33 letter-spacing: -0.012em;
34}
35:is([mapa-body], [mapa-prose]) h3 {
36 margin: 1.6em 0 0.35em; /* spacing-allow: the document's own typographic rhythm, in em of its text (the server's HTML and the editor's DOM share it; gates L1 to L5) */
37 font-size: 1.0625rem;
38 line-height: 1.3;
39 font-weight: 680;
40}
41:is([mapa-body], [mapa-prose]) :is(h4, h5, h6) {
42 margin: 1.4em 0 0.3em; /* spacing-allow: the document's own typographic rhythm, in em of its text (the server's HTML and the editor's DOM share it; gates L1 to L5) */
43 font-size: 1rem;
44 line-height: 1.35;
45 font-weight: 650;
46}
47:is([mapa-body], [mapa-prose]) :is(ul, ol) {
48 margin: 0 0 0.9em; /* spacing-allow: the document's own typographic rhythm, in em of its text (the server's HTML and the editor's DOM share it; gates L1 to L5) */
49 padding-inline-start: 1.5em; /* spacing-allow: the document's own typographic rhythm, in em of its text (the server's HTML and the editor's DOM share it; gates L1 to L5) */
50}
51:is([mapa-body], [mapa-prose]) li {
52 margin: 0.2em 0; /* spacing-allow: the document's own typographic rhythm, in em of its text (the server's HTML and the editor's DOM share it; gates L1 to L5) */
53 padding-inline-start: 0.15em; /* spacing-allow: the document's own typographic rhythm, in em of its text (the server's HTML and the editor's DOM share it; gates L1 to L5) */
54}
55/* An item's paragraph sits tight in its item; a nested list follows it. */
56:is([mapa-body], [mapa-prose]) li > p { margin: 0; }
57:is([mapa-body], [mapa-prose]) li > :is(ul, ol) { margin: 0.2em 0 0; /* spacing-allow: the document's own typographic rhythm, in em of its text (the server's HTML and the editor's DOM share it; gates L1 to L5) */ }
58:is([mapa-body], [mapa-prose]) li::marker { color: var(--rst-text-faint); }
59
60/* A task item: the box is drawn from mapa-task, and named for assistive
61 * technology by the generated content's alternative text. */
62:is([mapa-body], [mapa-prose]) li[mapa-task] { list-style: none; }
63:is([mapa-body], [mapa-prose]) li[mapa-task] > p::before {
64 content: ""; /* engines without alternative text */
65 content: "" / "Not done: ";
66 display: inline-block;
67 box-sizing: border-box;
68 inline-size: 15px;
69 block-size: 15px;
70 margin-inline: -1.35em calc(1.35em - 15px); /* spacing-allow: the task's box drawn in the list marker's place, 1.35em before the text */
71 vertical-align: -2px;
72 border: 1.5px solid var(--rst-line-strong);
73 border-radius: 4px;
74}
75:is([mapa-body], [mapa-prose]) li[mapa-task="done"] > p::before {
76 content: ""; /* engines without alternative text */
77 content: "" / "Done: ";
78 border-color: var(--rst-accent);
79 background:
80 var(--rst-accent)
81 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E")
82 center / 11px no-repeat;
83}
84:is([mapa-body], [mapa-prose]) li[mapa-task="done"] > p {
85 color: var(--rst-text-muted);
86 text-decoration: line-through;
87 text-decoration-color: var(--rst-line-strong);
88}
89
90:is([mapa-body], [mapa-prose]) blockquote {
91 margin: 1.1em 0; /* spacing-allow: the document's own typographic rhythm, in em of its text (the server's HTML and the editor's DOM share it; gates L1 to L5) */
92 padding: 2px 0 2px 18px; /* spacing-allow: 2px above and below keep the last paragraph's em margin inside the quote's rule; 18px from the rule to the text, the document's own */
93 border-inline-start: 3px solid var(--rst-line);
94 color: var(--rst-text-muted);
95}
96:is([mapa-body], [mapa-prose]) blockquote p { margin: 0 0 0.3em; /* spacing-allow: the document's own typographic rhythm, in em of its text (the server's HTML and the editor's DOM share it; gates L1 to L5) */ }
97:is([mapa-body], [mapa-prose]) code {
98 padding: 1px 5px; /* spacing-allow: inline code's tint hugs its glyphs, in the line's own rhythm */
99 border-radius: 5px;
100 background: var(--rst-surface-2);
101 font: 0.88em/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
102}
103:is([mapa-body], [mapa-prose]) pre {
104 margin: 1em 0 1.1em; /* spacing-allow: the document's own typographic rhythm, in em of its text (the server's HTML and the editor's DOM share it; gates L1 to L5) */
105 padding: var(--rst-sp-3) var(--rst-sp-4);
106 border-radius: 10px;
107 background: var(--rst-surface-2);
108 overflow-x: auto;
109 font: 13.5px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
110 tab-size: 4;
111}
112:is([mapa-body], [mapa-prose]) pre code {
113 padding: 0;
114 background: none;
115 font: inherit;
116}
117:is([mapa-body], [mapa-prose]) hr {
118 margin: 2em 0; /* spacing-allow: the document's own typographic rhythm, in em of its text (the server's HTML and the editor's DOM share it; gates L1 to L5) */
119 border: 0;
120 border-block-start: 1px solid var(--rst-line);
121}
122:is([mapa-body], [mapa-prose]) a:not([mapa-chip]) {
123 text-decoration-thickness: 1px;
124 text-underline-offset: 2px;
125}
126
127/* An empty body is the editor's one empty paragraph: the placeholder is
128 * drawn on it, so nothing moves when the editor mounts (§4.1). Without
129 * script there is no editor to type in, so no invitation to. */
130@media (scripting: enabled) {
131 :is([mapa-body], [mapa-prose]) > p:only-child:has(
132 > br.ProseMirror-trailingBreak:only-child)::before {
133 content: "Write, or type / for blocks and [[ to link";
134 position: absolute;
135 color: var(--rst-text-faint);
136 pointer-events: none;
137 }
138}
139
140/* ---- Chips (§4.2). */
141svg[mapa-i] {
142 inline-size: 16px;
143 block-size: 16px;
144 flex: none;
145 fill: none;
146 stroke: currentColor;
147 stroke-width: 1.75;
148 stroke-linecap: round;
149 stroke-linejoin: round;
150}
151
152/* A page link: a pill, the page glyph in the accent, ink text. */
153a[mapa-chip] {
154 display: inline;
155 padding: 1px 6px 1px 4px; /* spacing-allow: the pill hugs its line of text, 1px above and below, as links.css's chip */
156 border-radius: 6px;
157 background: color-mix(in oklab, var(--rst-surface-2) 85%, transparent);
158 box-shadow: inset 0 0 0 1px
159 color-mix(in oklab, var(--rst-line) 70%, transparent);
160 color: var(--rst-text);
161 font-weight: 500;
162 text-decoration: none;
163 white-space: nowrap;
164 box-decoration-break: clone;
165 -webkit-box-decoration-break: clone;
166}
167a[mapa-chip] > svg[mapa-i],
168span[mapa-chip="embed"] > svg[mapa-i] {
169 inline-size: 0.9em;
170 block-size: 0.9em;
171 vertical-align: -0.1em;
172 margin-inline-end: var(--rst-sp-1);
173 color: var(--rst-accent);
174 stroke-width: 2;
175}
176a[mapa-chip]:hover {
177 background: var(--rst-accent-soft);
178 box-shadow: inset 0 0 0 1px
179 color-mix(in oklab, var(--rst-accent) 35%, transparent);
180}
181a[mapa-chip]:focus-visible {
182 outline: 2px solid var(--rst-accent);
183 outline-offset: 1px;
184}
185
186/* Not written yet: no fill, a dashed rim, the page+ glyph, muted text.
187 * Three cues, so colour never carries it alone. */
188a[mapa-chip~="pending"] {
189 background: none;
190 box-shadow: none;
191 outline: 1px dashed var(--rst-line-strong);
192 outline-offset: -1px;
193 color: var(--rst-text-muted);
194}
195a[mapa-chip~="pending"] > svg[mapa-i] { color: var(--rst-text-faint); }
196a[mapa-chip~="pending"]:hover {
197 background: var(--rst-surface-2);
198 outline-color: var(--rst-text-muted);
199}
200
201/* A block whose block has gone: the page still opens, with the note. */
202a[mapa-chip~="gone"] > [mapa-chip-note] {
203 margin-inline-start: var(--rst-sp-1);
204 color: var(--rst-text-muted);
205 font-size: 0.85em;
206 font-weight: 400;
207}
208
209/* A date that is no date reads as the text it is. */
210[mapa-chip="broken"] { color: var(--rst-text-muted); }
211
212/* An embed, before slice 2 draws its card: a quiet chip. */
213span[mapa-chip="embed"] {
214 padding: 1px 6px 1px 4px; /* spacing-allow: the pill hugs its line of text, 1px above and below, as links.css's chip */
215 border-radius: 6px;
216 box-shadow: inset 0 0 0 1px var(--rst-line);
217 color: var(--rst-text-muted);
218 font-size: 0.92em;
219 white-space: nowrap;
220}
221span[mapa-chip="embed"] > svg[mapa-i] { color: var(--rst-text-faint); }
222
223/* ---- Arriving at a block (#b-…, a block chip's address).
224 * Every in-page target clears the sticky bar (html, frame.css). A block
225 * lands lower: 40% of the way down the view the bar leaves (353px of a
226 * 1280x800 window, 389px of a 390x844 phone). So a block that starts
227 * there or above in the first screen (a page's title and first few
228 * blocks) is not scrolled to at all, and a deeper one arrives in the
229 * upper part of the view, with what leads up to it above and room for
230 * what follows. A page too short to scroll never moves. The browser
231 * does all this before paint, without script.
232 * The block is then tinted once, and the tint fades: a shadow, inset
233 * for the tint and spread for its rim, so nothing is laid out again
234 * and a code block's own background stays under it. The editor draws
235 * the block anew as it mounts; the browser matches :target again by
236 * the end of the load, so the tint is not lost (build note 68). */
237:is([mapa-body], [mapa-prose]) [id^="b-"] {
238 scroll-margin-block-start: max(0px,
239 (100vh - var(--estilo-bar-block-size, 56px)) * 0.4 - 16px);
240}
241:is([mapa-body], [mapa-prose]) [id^="b-"]:target {
242 border-radius: 6px;
243 animation: mapa-arrive 1.8s ease-out;
244}
245@keyframes mapa-arrive {
246 0%, 35% {
247 box-shadow: inset 0 0 0 100vmax var(--rst-accent-soft),
248 0 0 0 4px var(--rst-accent-soft);
249 }
250 100% {
251 box-shadow: inset 0 0 0 100vmax transparent,
252 0 0 0 4px transparent;
253 }
254}
255/* No fade: the tint shows, still, and goes. */
256@media (prefers-reduced-motion: reduce) {
257 :is([mapa-body], [mapa-prose]) [id^="b-"]:target {
258 animation-duration: 1.5s;
259 animation-timing-function: step-end;
260 }
261}
262
263/* Images (images spec §2.1, §4.3, §4.5). Natural size, never scaled up,
264 capped at the column; the box is reserved from width and height before
265 a byte arrives. A lone image is a block. "Image not available" is one
266 fixed box, whatever it stands for. */
267:is([mapa-body], [mapa-prose]) img[src^="/i/"] {
268 max-inline-size: 100%;
269 block-size: auto;
270 vertical-align: bottom;
271 border-radius: var(--rst-radius-sm);
272}
273:is([mapa-body], [mapa-prose]) img.alone { display: block; }
274[mapa-image="unavailable"] {
275 display: inline-flex;
276 align-items: center;
277 justify-content: center;
278 inline-size: 12rem;
279 block-size: 4.5rem;
280 vertical-align: bottom;
281 border: 1px dashed var(--rst-line);
282 border-radius: var(--rst-radius-sm);
283 color: var(--rst-text-muted);
284 font-size: var(--rst-fs-sm);
285}
286[mapa-image="unavailable"].alone { display: flex; }
287/* The editor draws each image in a frame that holds it exactly: the
288 frame's box is the picture's, so mounting moves nothing (L5), and the
289 ALT badge and the description field lie over it (mapa.css). */
290[mapa-image-frame] {
291 position: relative;
292 display: inline-block;
293 max-inline-size: 100%;
294 vertical-align: bottom;
295 line-height: 0;
296}
297[mapa-image-frame].alone { display: block; inline-size: fit-content; }
298[mapa-image-frame].alone > img { display: block; }
299[mapa-image-frame].alone > [mapa-image="unavailable"] { display: flex; }
300[mapa-image-frame] > [mapa-image="unavailable"] { line-height: 1.4; }
301[mapa-image-frame][mapa-image-selected] > :is(img, [mapa-image]) {
302 outline: 2px solid var(--rst-accent);
303 outline-offset: 2px;
304}
305a[mapa-image-remove] { display: inline-block; }
306[mapa-remove-image] img { max-inline-size: 100%; block-size: auto; max-block-size: 50vh; }
307
308/* ---- A page's icon (columns and icons spec §2.4): an emoji in the
309 system's emoji face, or a square picture, wherever its title is, in
310 the glyph's own cell and at its size. Decoration only. */
311[mapa-icon] {
312 display: inline-block;
313 flex: none;
314 inline-size: 1em;
315 block-size: 1em;
316 line-height: 1;
317 text-align: center;
318 font-style: normal;
319 font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji",
320 system-ui, sans-serif;
321}
322img[mapa-icon] { object-fit: cover; border-radius: var(--rst-radius-sm, 4px); }
323a[mapa-chip] > [mapa-icon] {
324 inline-size: 0.95em;
325 block-size: 0.95em;
326 vertical-align: -0.12em;
327 margin-inline-end: var(--rst-sp-1);
328}
329
330/* ---- Column layouts (columns and icons spec §1.5): equal tracks,
331 top-aligned, a gap from the spacing scale, no rule, border or fill.
332 They stack below 36rem of the page column, measured on the column,
333 not the window: the sidebar and the Links panel change its width. */
334[mapa-doc] { container-type: inline-size; container-name: mapa-doc; }
335[mapa-columns] {
336 display: grid;
337 grid-template-columns: repeat(var(--mapa-columns, 2), minmax(0, 1fr));
338 column-gap: var(--rst-sp-5);
339 align-items: start;
340 /* The layout sits in the body's rhythm as a paragraph does. */
341 margin: 0 0 0.85em; /* spacing-allow: the document's own typographic rhythm, in em of its text (the server's HTML and the editor's DOM share it; gates L1 to L5) */
342}
343[mapa-columns="3"] { --mapa-columns: 3; }
344[mapa-columns="4"] { --mapa-columns: 4; }
345[mapa-column] { min-inline-size: 0; }
346[mapa-column] > :first-child { margin-block-start: 0; }
347[mapa-column] > :last-child { margin-block-end: 0; }
348@container mapa-doc (max-width: 36rem) {
349 /* Stacked, the columns read as consecutive blocks: the body's own
350 gap between them. */
351 [mapa-columns] { grid-template-columns: minmax(0, 1fr); row-gap: 0.85em; /* spacing-allow: the document's own typographic rhythm, in em of its text (the server's HTML and the editor's DOM share it; gates L1 to L5) */ }
352}
353/* While editing, the layout the caret is in shows where its columns are,
354 as an outline, which moves nothing. */
355[mapa-body].ProseMirror [mapa-columns]:focus-within > [mapa-column] {
356 outline: 1px dashed color-mix(in oklab, var(--rst-line) 80%, transparent);
357 outline-offset: var(--rst-sp-1);
358}
359