oficina / mapa Public

Mapa: prose.css, the body and its chips as the editor draws them

Spec §4.2, §5. One file styles the server's HTML and, in Phase 2, the
editor's identical DOM: the mock-up's measurements (16px/1.7, h2/h3,
lists, quote, code), white-space: pre-wrap on textblocks only, task
boxes drawn from mapa-task with named generated content, and the
empty-body placeholder on the editor's own empty paragraph. Chips per
Calma: a team pill with the page glyph in the accent and ink text;
pending with no fill, a dashed rim, the page+ glyph and muted text;
the calendar glyph on dates; a muted note on a removed block; a quiet
embed chip; a broken date as muted text.

Linked once in shell.html, after mapa.css. It targets [mapa-body] and
[mapa-prose], so the new shell can adopt either.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 3ed499de5ce983250781f2692476d369bda48e2c parent 0deaac8
2 files changed, +217 −0
  • internal/mapa/static/prose.css +216 −0
  • internal/mapa/templates/shell.html +1 −0
diff --git a/internal/mapa/static/prose.css b/internal/mapa/static/prose.css
new file mode 100644
index 0000000..54d1dd7
--- /dev/null
+++ b/internal/mapa/static/prose.css
@@ -0,0 +1,216 @@
+/* prose.css: a page's body as the editor draws it (spec §4.2, §5).
+ *
+ * The server's HTML is the editor's DOM (internal/mapa/markup/render.go,
+ * editor/schema.mjs), so this one file styles both, before and after the
+ * editor mounts. [mapa-body] is today's page body; [mapa-prose] is the
+ * same surface in the new shell. Chips are styled wherever they appear:
+ * the Links lists show them too.
+ *
+ * Calma: only the icons carry colour. Look and measurements are the
+ * mock-up's (oficina/polish-audit/mapa-ux, css/mock.css). Only tokens.css
+ * custom properties are used, so the light/dark switch applies. */
+
+:is([mapa-body], [mapa-prose]) {
+ font-size: 16px;
+ line-height: 1.7;
+ overflow-wrap: anywhere;
+}
+
+/* Textblocks keep the spaces a person typed, as the editor needs; blocks
+ * themselves have no text between them, so nothing else needs it. */
+:is([mapa-body], [mapa-prose]) :is(p, h2, h3, h4, h5, h6, li > p,
+ blockquote p, pre) {
+ white-space: pre-wrap;
+}
+
+:is([mapa-body], [mapa-prose]) p { margin: 0 0 0.85em; }
+:is([mapa-body], [mapa-prose]) > :first-child { margin-block-start: 0; }
+:is([mapa-body], [mapa-prose]) h2 {
+ margin: 1.9em 0 0.45em;
+ font-size: 1.375rem;
+ line-height: 1.25;
+ font-weight: 680;
+ letter-spacing: -0.012em;
+}
+:is([mapa-body], [mapa-prose]) h3 {
+ margin: 1.6em 0 0.35em;
+ font-size: 1.0625rem;
+ line-height: 1.3;
+ font-weight: 680;
+}
+:is([mapa-body], [mapa-prose]) :is(h4, h5, h6) {
+ margin: 1.4em 0 0.3em;
+ font-size: 1rem;
+ line-height: 1.35;
+ font-weight: 650;
+}
+:is([mapa-body], [mapa-prose]) :is(ul, ol) {
+ margin: 0 0 0.9em;
+ padding-inline-start: 1.5em;
+}
+:is([mapa-body], [mapa-prose]) li {
+ margin: 0.2em 0;
+ padding-inline-start: 0.15em;
+}
+/* An item's paragraph sits tight in its item; a nested list follows it. */
+:is([mapa-body], [mapa-prose]) li > p { margin: 0; }
+:is([mapa-body], [mapa-prose]) li > :is(ul, ol) { margin: 0.2em 0 0; }
+:is([mapa-body], [mapa-prose]) li::marker { color: var(--rst-text-faint); }
+
+/* A task item: the box is drawn from mapa-task, and named for assistive
+ * technology by the generated content's alternative text. */
+:is([mapa-body], [mapa-prose]) li[mapa-task] { list-style: none; }
+:is([mapa-body], [mapa-prose]) li[mapa-task] > p::before {
+ content: "" / "Not done: ";
+ display: inline-block;
+ box-sizing: border-box;
+ inline-size: 15px;
+ block-size: 15px;
+ margin-inline: -1.35em calc(1.35em - 15px);
+ vertical-align: -2px;
+ border: 1.5px solid var(--rst-line-strong);
+ border-radius: 4px;
+}
+:is([mapa-body], [mapa-prose]) li[mapa-task="done"] > p::before {
+ content: "" / "Done: ";
+ border-color: var(--rst-accent);
+ background:
+ var(--rst-accent)
+ 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")
+ center / 11px no-repeat;
+}
+:is([mapa-body], [mapa-prose]) li[mapa-task="done"] > p {
+ color: var(--rst-text-muted);
+ text-decoration: line-through;
+ text-decoration-color: var(--rst-line-strong);
+}
+
+:is([mapa-body], [mapa-prose]) blockquote {
+ margin: 1.1em 0;
+ padding: 2px 0 2px 18px;
+ border-inline-start: 3px solid var(--rst-line);
+ color: var(--rst-text-muted);
+}
+:is([mapa-body], [mapa-prose]) blockquote p { margin: 0 0 0.3em; }
+:is([mapa-body], [mapa-prose]) code {
+ padding: 1px 5px;
+ border-radius: 5px;
+ background: var(--rst-surface-2);
+ font: 0.88em/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
+}
+:is([mapa-body], [mapa-prose]) pre {
+ margin: 1em 0 1.1em;
+ padding: 14px 16px;
+ border-radius: 10px;
+ background: var(--rst-surface-2);
+ overflow-x: auto;
+ font: 13.5px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
+ tab-size: 4;
+}
+:is([mapa-body], [mapa-prose]) pre code {
+ padding: 0;
+ background: none;
+ font: inherit;
+}
+:is([mapa-body], [mapa-prose]) hr {
+ margin: 2em 0;
+ border: 0;
+ border-block-start: 1px solid var(--rst-line);
+}
+:is([mapa-body], [mapa-prose]) a:not([mapa-chip]) {
+ text-decoration-thickness: 1px;
+ text-underline-offset: 2px;
+}
+
+/* An empty body is the editor's one empty paragraph: the placeholder is
+ * drawn on it, so nothing moves when the editor mounts (§4.1). */
+:is([mapa-body], [mapa-prose]) > p:only-child:has(
+ > br.ProseMirror-trailingBreak:only-child)::before {
+ content: "Write, or type / for blocks and [[ to link";
+ position: absolute;
+ color: var(--rst-text-faint);
+ pointer-events: none;
+}
+
+/* ---- Chips (§4.2). */
+svg[mapa-i] {
+ inline-size: 16px;
+ block-size: 16px;
+ flex: none;
+ fill: none;
+ stroke: currentColor;
+ stroke-width: 1.75;
+ stroke-linecap: round;
+ stroke-linejoin: round;
+}
+
+/* A page link: a pill, the page glyph in the accent, ink text. */
+a[mapa-chip] {
+ display: inline;
+ padding: 1px 6px 1px 4px;
+ border-radius: 6px;
+ background: color-mix(in oklab, var(--rst-surface-2) 85%, transparent);
+ box-shadow: inset 0 0 0 1px
+ color-mix(in oklab, var(--rst-line) 70%, transparent);
+ color: var(--rst-text);
+ font-weight: 500;
+ text-decoration: none;
+ white-space: nowrap;
+ box-decoration-break: clone;
+ -webkit-box-decoration-break: clone;
+}
+a[mapa-chip] > svg[mapa-i],
+span[mapa-chip="embed"] > svg[mapa-i] {
+ inline-size: 0.9em;
+ block-size: 0.9em;
+ vertical-align: -0.1em;
+ margin-inline-end: 4px;
+ color: var(--rst-accent);
+ stroke-width: 2;
+}
+a[mapa-chip]:hover {
+ background: var(--rst-accent-soft);
+ box-shadow: inset 0 0 0 1px
+ color-mix(in oklab, var(--rst-accent) 35%, transparent);
+}
+a[mapa-chip]:focus-visible {
+ outline: 2px solid var(--rst-accent);
+ outline-offset: 1px;
+}
+
+/* Not written yet: no fill, a dashed rim, the page+ glyph, muted text.
+ * Three cues, so colour never carries it alone. */
+a[mapa-chip~="pending"] {
+ background: none;
+ box-shadow: none;
+ outline: 1px dashed var(--rst-line-strong);
+ outline-offset: -1px;
+ color: var(--rst-text-muted);
+}
+a[mapa-chip~="pending"] > svg[mapa-i] { color: var(--rst-text-faint); }
+a[mapa-chip~="pending"]:hover {
+ background: var(--rst-surface-2);
+ outline-color: var(--rst-text-muted);
+}
+
+/* A block whose block has gone: the page still opens, with the note. */
+a[mapa-chip~="gone"] > [mapa-chip-note] {
+ margin-inline-start: 6px;
+ color: var(--rst-text-muted);
+ font-size: 0.85em;
+ font-weight: 400;
+}
+
+/* A date that is no date reads as the text it is. */
+[mapa-chip="broken"] { color: var(--rst-text-muted); }
+
+/* An embed, before slice 2 draws its card: a quiet chip. */
+span[mapa-chip="embed"] {
+ padding: 1px 6px 1px 4px;
+ border-radius: 6px;
+ box-shadow: inset 0 0 0 1px var(--rst-line);
+ color: var(--rst-text-muted);
+ font-size: 0.92em;
+ white-space: nowrap;
+}
+span[mapa-chip="embed"] > svg[mapa-i] { color: var(--rst-text-faint); }
diff --git a/internal/mapa/templates/shell.html b/internal/mapa/templates/shell.html
index 22aec8e..e762611 100644
--- a/internal/mapa/templates/shell.html
+++ b/internal/mapa/templates/shell.html
@@ -16,6 +16,7 @@
<link rel="stylesheet" href="{{asset "static/menu.css"}}">
<link rel="stylesheet" href="{{asset "static/chrome.css"}}">
<link rel="stylesheet" href="{{asset "static/mapa.css"}}">
+<link rel="stylesheet" href="{{asset "static/prose.css"}}">
<script defer src="{{asset "static/rastrillo.js"}}"></script>
<script defer src="{{asset "static/busy.js"}}"></script>
<script defer src="{{asset "static/shell.js"}}"></script>