oficina / estilo Public

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

Plain git — no account needed to clone.

Download

Download this file

1# 🤖 estilo
2
3> **Confirmed 2026-08-31.** Paul's ruling: if Docs, Sheets and other
4> Oficina apps are going to share a design system, estilo makes sense and
5> should be started, with rastrillo's `day` theme as its base.
6
7> **Ruled, same day.** Paul, verbatim: *"Let's have estilo just be day
8> for now, but we can add oficina specific changes and components to it
9> as we need to."* This settles what "as its base" above meant: estilo's
10> theme **is** `day`, not derived from it or based on it — identical.
11> See "Theme" below.
12>
13> **Superseded 2026-09-29.** Paul chose Calma: estilo's theme is now the
14> suite's own, not `day` (decisions table, row 8; "Theme" below). The two
15> rulings above are kept as the history of how estilo started.
16
17The CARLOS suite's design-system variant. See `README.md` for what it is.
18
19This file is binding. Where it disagrees with a general skill, this file
20wins.
21
22---
23
24## The one rule
25
26> **Two specs are guesses. Two implementations are facts.**
27
28So: **one app builds a primitive here, and the other adopts it.** Not two
29implementations merged afterwards, and not an interface designed from two
30specs at once.
31
32A document editor's inspector shows text and style properties. A
33spreadsheet's shows cell format and data validation. A shape designed from
34both specs at once risks fitting neither — **the second use is what corrects
35it**, and it can only do that if there is something concrete to correct.
36
37**Until a second adoption, estilo is a home, not an agreed interface.**
38Treating it as an interface earlier buys exactly the ill-fitting abstraction
39that building it here was meant to avoid.
40
41(From ui-guidelines-52 via docs-e6, 2026-08-30. Written down because an
42empty repo invites the opposite.)
43
44---
45
46## Settled decisions
47
48| # | Ruling | Rejected | Who, when |
49|---|---|---|---|
50| 1 | **Shared suite components live here, not in rastrillo's `ui`** | Proposing them to the framework | Paul, 2026-08-30 |
51| 2 | **A separate repo, created before any primitive is written** | App-local until a second consumer; a nested module inside an app | Paul, 2026-08-30 |
52| 3 | **Resolved: use released Rastrillo v0.23.0** — §Dependency | Pinning a `main` pseudo-version | This session, 2026-08-30 |
53| 4 | **Estilo's own components are written in the bare-attribute grammar, and estilo defines their styling** — §Vocabulary | `class="rst-*"` (right for an app consuming rastrillo's CSS, wrong for a library shipping its own) | Paul, 2026-08-30 |
54| 5 | **The colour engine stays in rastrillo's `ui`** | Moving `Pair` and allocation here | ui-guidelines-52, 2026-08-30 |
55| 6 | *(Superseded by 8.)* **Estilo's theme is `day`, unchanged — not "derived from" or "based on" it. Divergence is allowed but must be driven by a named need, not a preference** — §Theme | Restyling on the strength of "day as a base"; changing a token because it "would look better" | Paul, 2026-08-31 |
56| 7 | **Public module, path `amadan.net/oficina/estilo.git`, licensed MPL-2.0.** Anyone can fetch it with plain Git; consumer `go.sum` files record its integrity. Preserve this path when discovery support changes. The licence grants no rights in the names or marks (MPL-2.0 §2.3). | Staying private with authenticated Git and `GOPRIVATE` (ruled 2026-09-07); a separately licensed subset copied into Contra; Contra keeping a plain look when self-hosted | Paul, 2026-11-21: publish estilo so Contra, which is MPL-2.0 and self-hostable, can build with the suite's look |
57| 8 | **Estilo's theme is Calma, the suite's own — no longer `day`.** Every app's colour sits on one ring of equal OKLCH lightness (`theme/apps.go`); each app is themed with its own accent (`theme.ForApp`). The marks are Calma's (Fanned Oficina mark, app icons with a glow of their own hue) and the suite's ambient effect is a seeded nebula (`sky`), placed at the sign-in, the team's home and the front page, **never inside an app** — §Theme | Keeping `day` "as a base"; one hue per app chosen by eye (Mail and Files would not fit); rim light, cores and motes in the sky | Paul, 2026-09-28/29, after six rounds of design directions: *"Calma is by far the best"*; *"Grain and filaments. No cores, no rim lights. Then go."* |
58| 9 | **The chrome is set in the system UI face and downloads no font.** `--rst-font` is `system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif` (the Modern Font Stacks "System UI" stack, and `day`'s); no estilo stylesheet declares a face. Calma's typography moves from Onest to system UI. The reason: the chrome must never flash (Paul, 2026-10-24: *"There should never be a flash of unstyled text. Ever."*, invisible text included), and **Onest cannot load in WebKit without a frame of invisible text**. Measured on `fix/chrome-font-no-flash`: with `font-display: optional` and a preload, WebKit paints the page with the chrome text invisible before the fallback; with Onest inlined as a `data:` URL in a render-blocking stylesheet, native WKWebView still painted the page with no text for 6-16 ms before Onest, in 12 of 12 runs. The system face is resolved during layout, so nothing waits and nothing swaps. v1's font files stay served, byte for byte, for old pages; nothing links them. `TestChromeFontIsSystemUI` holds it in CI; `make test-browser` proves it in Chromium and WebKit with pixels — §Theme | Onest with `font-display: swap` (the flash) or `block` (invisible, then the same swap); `optional` with a preload (invisible text in WebKit and Firefox before the fallback); Onest inlined as `data:` (a frame of invisible text in WebKit, every load, and `font-src data:` in every CSP); a metric-matched fallback (still a swap); a script gate (the door and the front page run without scripts) | Paul, 2026-10-25, choosing between Onest with a frame of invisible text in Safari and the system face; reviews: GPT-6-Astra (Codex) on `aab5e14` |
59| 10 | **The app side panel is estilo's `side` package**, moved from Mapa when Contra became its second consumer: `estilo-side-frame` (open, rail, or empty for the width to decide) around `nav[estilo-side]` and `<main>`, with `estilo-side-item`, `estilo-side-label`, `estilo-side-key`, `estilo-side-head`, `estilo-side-page`, `estilo-side-foot` and the fold. Mapa's values and behaviour, copied, not redesigned; Contra is the second use that corrects it, and Mapa adopts it by renaming | Contra copying Mapa's `mapa-side` CSS into a second app; designing a side from both apps' specs | Paul, 2026-11-21 |
60
61**Two callers at design time is the bar for *extraction*. It says nothing
62about *destination*.** Both consuming apps were told to propose their
63primitives to the framework, applied the right bar, and got the wrong
64answer, because the first question looked like it settled the second. Keep
65the two apart.
66
67---
68
69## Theme — RULED: Calma
70
71> **Paul, 2026-08-31, verbatim:** *"Let's have estilo just be day for
72> now, but we can add oficina specific changes and components to it as
73> we need to."*
74>
75> **Paul, 2026-09-28/29**, choosing among six rounds of design directions
76> (`~/amadan.net/oficina/design-directions/`, published for review at a
77> temporary site): Calma, *"by far the best"*, with the aurora that became
78> a nebula; then *"Grain and filaments. No cores, no rim lights. Then go."*
79
80`day` was the position estilo held until the suite chose its own look.
81It has now: **estilo's theme is Calma.** The "named need" row 6 asked for
82is Paul's decision to give the suite an identity, recorded as row 8.
83
84What Calma is, and where each part lives:
85
86- **`theme/estilo.css`** — the suite's tokens: a cool off-white page,
87 white cards, one grey text scale, the system UI face, 12px shapes, a
88 long low shadow, and Oficina's own accent. Status tones are `day`'s, unchanged.
89- **`theme/apps.go`** — the ring. Every app has a hue; all share one
90 OKLCH lightness and chroma, so no app is louder than another. The hues
91 are spaced to the eye (34-50°, widest across the muddy yellow-greens),
92 with room for Mail and Files. `theme.ForApp(slug)` is an app's whole
93 theme: estilo.css, then its accent. The ring is a closed set.
94- **Type is the system UI face** (row 9): `--rst-font` in estilo.css,
95 nothing downloaded, so the chrome cannot flash. **No webfont in the
96 chrome.** Whoever proposes one must first show it renders in WebKit
97 with no invisible frame — `make test-browser` is the bar, and on
98 2026-10-25 no loading strategy for Onest passed it.
99 `theme/fonts.go` only keeps v1's Onest files answering, byte for byte,
100 for old pages (`FontHandler` at `FontPrefix`, both deprecated); link
101 nothing to them.
102- **`brand/`** — the marks, generated from `icons.json` (hues must equal
103 the ring; `brand_test` checks) in web, iPhone and Mac shapes.
104- **`sky/`** — the ambient nebula: seeded per team; its colour (haze and
105 clouds) an inline placeholder painted in the first frame, its grain and
106 filaments two static files,
107 no script, still for anyone who asks for less motion. **It goes where
108 the suite meets you — the sign-in, the team's home, the front page —
109 and never inside an app.** Inside an app, only the icons carry colour.
110
111**The gates that replaced `TestMatchesDayByteForByte`**
112(`theme/theme_test.go`), and why each exists:
113
114- `TestDeclaresRastrilloTokens` — exactly `day`'s token *names*, so
115 rastrillo's `tokens.css` never meets an undefined `var(--rst-*)`, and
116 a rastrillo upgrade that adds or drops a token still fails here. Two
117 sources: the pinned v0.23.0's `day`, live, and the newest rastrillo an
118 app pins, as a snapshot in `theme/testdata/rastrillo-day-tokens.txt`
119 (v0.38.0 since 2026-11-20, when Home moved to it; v0.37.0 before).
120 A snapshot, because requiring a newer
121 rastrillo here would pull every app up to it. When an app moves to a
122 newer rastrillo, regenerate the snapshot from that release's `day`.
123 The 69 tokens rastrillo added between v0.23.0 and v0.37.0 (Fiesta's
124 fills, controls, tints, switches, type, and depth, light and sheen)
125 are declared at **the fallback the snapshot release's `tokens.css`
126 uses for each**, so rastrillo's own stylesheet draws exactly what it
127 would with none declared. v0.38.0 (Fiesta 1.5.0) declares the same 69
128 names; the equality was re-checked by script against its `tokens.css`
129 (every `var(--rst-…, fallback)`, by use site), and two had moved:
130 - `--rst-focus-edge` falls back to the accent, not
131 `--rst-line-strong`: Fiesta 1.5.0's one focus ring turns the field's
132 edge to it with the 2px accent outline flush on it. Calma now
133 declares `var(--rst-accent)`. Every rastrillo from **v0.29.0 to
134 v0.37.0** also reads `--rst-focus-edge` but draws its outline 2px off
135 the edge, so under this Calma a focused field shows **two accent
136 rings**. v0.28.0 and earlier don't read it and are unaffected.
137 - `--rst-ghost-face-hover` has two fallbacks: `transparent` for a
138 ghost button's hover, `--rst-surface-2` for the one-way sign-in
139 door's quiet controls. Calma keeps `transparent` at `:root` and sets
140 `--rst-surface-2` on the smart door (`[estilo-signin-screen]`,
141 estilo's hook, because the partial's `rst-` names are rastrillo's).
142 Two consequences, both deliberate:
143 - **Inside that screen, every ghost button** the partial draws gets
144 the pill on hover, not only the one-way door's. The classic door's
145 "Use a different email" (any rastrillo before v0.38.0, or v0.38.0
146 with `SigninOneWay` off) hovers with a full-width `surface-2` bar
147 where its own fallback is `transparent`. That's a deviation from
148 "each use site draws its fallback", accepted because no tighter
149 selector exists without `rst-` names.
150 - **Outside that screen,** the partial's one-way small controls get
151 `transparent`: the text still darkens on hover and focus, but
152 there's no pill. Drawing the door through `estilo-signin-screen` is
153 the convention that gives the pill; nothing enforces it.
154
155 **The rule: bump estilo and rastrillo together.** An app on rastrillo
156 v0.29.0 to v0.37.0 (on 2026-11-20: Docs v0.29.2, Equipo v0.30.3,
157 Fichas and Mapa v0.35.1) must move to rastrillo **v0.38.0 or later in
158 the same change** that bumps estilo past this commit. Apps on v0.28.0
159 or earlier (Sheets, Slides, Calendar, Calls and Memoria, all v0.27.1)
160 read neither token's new fallback and can bump estilo alone. Check an
161 app's pin with `git show origin/main:go.mod`.
162 Nothing pins the equality, so re-check it whenever the snapshot is
163 regenerated.
164 **An app's own CSS can still change** if it reads one of these tokens
165 with a different fallback: Fichas' `frame.css` reads
166 `var(--rst-rail-bg, var(--rst-bg))`, so its rail turns
167 `--rst-surface` when it bumps past this commit, unless that line
168 becomes `var(--rst-bg)` in the same bump. Check each app's CSS for
169 `var(--rst-…, …)` reads of these tokens when it bumps. Adopting
170 Fiesta's depth and sheen, or any other value for them, is a design
171 decision for Paul like any token change below.
172- `TestContrastMeetsWCAG` — every pair rastrillo's own gate checks, in
173 both schemes, for estilo.css **and every app's accent**, through
174 rastrillo's `ui.ContrastRatio` (parsing copied verbatim).
175- `TestAccentGoldens` — each app's accent block against `testdata/`, so
176 no colour moves without a diff that says so.
177
178**Changing a value is still a design decision for Paul**, not a
179session's. Change the ring or a token, regenerate the goldens
180deliberately (`go test ./theme -run Goldens -update`), read the diff, and
181record the reason here. "It would look better" is still not a reason on
182its own; Paul saying so is.
183
184**Recorded ring changes.** 2026-11-13: Mapa joined at 125 (between
185Fichas and Sheets; Paul: "more related to Fichas than it is to Memoria or
186Mail") and Equipo at 322 (between Memoria and Mail; Paul: "Co-ordinator
187in Pink"), after he reviewed real renders beside the suite. The Oficina
188mark and the sky gather every hue, so both changed; the sky's Prefix
189moved to v2 and its goldens were regenerated, while the seed domain
190(`estilo-sky/v1`) is unchanged so every team keeps its own sky's shape.
1912026-11-19: Equipo's glyph changed from the hub with four specialists and
192a tick to a chat bubble with two sparkles, the sparkle being the one the
193Equipo apps draw for the coordinator. Paul chose it from four bubble and
194sparkle drafts rendered beside Memoria, Mail and Calls: "the sparkle logo
195is probably the right one". The hue stays 322; the tail points right so
196it never reads as Calls' bubbles. Equipo joined the native icon set.
1972026-11-21: Contra, the suite's password manager, joined at 200 (between
198Files and Calls; Paul: "Colour seems fine"), with the Safe mark (Paul,
199after reviewing it in render: "Safe is the most appropriate because
200that's what this is... it's a vault rather than a key"). As with Mapa and
201Equipo, the Oficina mark and the sky changed; the sky's Prefix moved to
202v3 with new goldens, the seed domain unchanged. Contra has no native
203client, so it is not in the native icon set or `distribute.py`. The
204preview sheet now widens with the set; at 12 icons it had already cut
205off Files and Calls.
206
207---
208
209## Dependency — RULED, and check it before adding an import
210
211Rastrillo v0.23.0 supplies the theme and layout APIs Estilo needs. The earlier
212wait for a release is resolved; this module pins that released version.
213Estilo is public (row 7): fetch it with plain Git. Consumer go.sum files
214record its integrity.
215
216**The two-pins trap.** Estilo pins rastrillo; the apps pin estilo. That is
217the frozen-`tokens.css` problem one layer down — a component library
218carrying stale tokens while its consumers upgrade underneath it. **A
219tokens-drift check ships in the first commit that has code**, not after it
220bites. `rastrillo doctor` mechanises the single-pin case; this is the
221two-pin case and it is ours.
222
223---
224
225## Vocabulary — attributes here, and why that differs from the apps
226
227**Estilo's own components use the bare-attribute grammar**
228(`<div rst-inspector>`, variants in the value matched with `~=`), and
229**estilo ships their styling.**
230
231**Historical context:** Rastrillo v0.23.0 now ships attribute grammar. The
232following paragraphs record the earlier decision, before that release.
233
234**Read this before "correcting" it, because the surrounding conversation has
235said both things this week and the right answer depends on which repo you
236are in.**
237
238The argument for writing classes is: the attribute grammar exists in no
239rastrillo tree — verified again at `origin/main` `7a30456`, spec-only, no
240branch working on it — so a component written in it renders unstyled. **That
241is true for an app leaning on rastrillo's CSS, and false here.** Estilo
242ships its own components *and* their styling, so styling its own
243attribute-grammar components is not interim anything; it is permanently
244estilo's styling. There is nothing to migrate later and no parallel
245implementation to carry.
246
247And the positive reason, which is the stronger one: **estilo is the variant
248system that exists because of this direction.** Birthing it on the spelling
249being replaced is backwards. Estilo is where the new grammar gets proven,
250not where it waits.
251
252**The three-way split, which holds across the suite:**
253
254| Markup | Spelling | Styled by |
255|---|---|---|
256| Estilo's own components | Attribute grammar | Estilo |
257| An app's own markup, using estilo components | Attribute grammar | Estilo |
258| An app's own markup, using rastrillo's vocabulary | **The grammar emitted by the pinned release — attributes in v0.23.0** | rastrillo's `tokens.css` |
259
260The third row is not our choice and not our migration. It changes when
261rastrillo changes.
262
263Do not build on `.rst-page-header::after` — the accent rake line is retired
264in favour of `--rst-header-rule`.
265
266**Provenance, because this reversed within an hour.** docs-e6 first advised
267classes, reasoning correctly about its own app and then applying the
268conclusion to a different repo without re-deriving it. Paul challenged it;
269the correction is his. Recorded with the reasoning rather than the outcome,
270because the outcome alone reads like an error.
271
272## Standards every primitive meets
273
274Inherited from rastrillo's gates, and not negotiable downward:
275
276- **Twelve locales.** A primitive that only reads in English is unfinished.
277- **The script-required line stated per primitive.** Say plainly what works
278 with scripts off and what does not. "Acceptable for a grid, unacceptable
279 for a form" is the test.
280- **24×24 minimum target size**, measured on the smaller axis. Do not lean
281 on 2.5.8's spacing exception — a real hit area is honest, and the
282 exception is an argument you have to keep making.
283- **320px reflow.** Content requiring two-dimensional layout may scroll in
284 both axes; everything else reflows or it is a bug, not an exemption.
285- **Colour never carries meaning alone.** Whatever a colour *means* must
286 survive greyscale.
287- **Contrast arithmetic copied verbatim** from `ui/contrast_test.go`, never
288 reimplemented — two gates disagreeing by a rounding decision is a gate
289 that certifies the wrong thing while passing.
290- **Spacing on the scale** (Paul, 2026-11-22: "The spacing is all over
291 the place here... Can we somehow put something in place"). Every
292 margin, padding and gap is `var(--rst-sp-1)` to `var(--rst-sp-6)`, or
293 says why not in a `/* spacing-allow: why */` comment beside it:
294 geometry, never a preference. `make test-spacing` (Fiesta's spacing
295 check, run with `go run` at a version so estilo never requires Fiesta)
296 is a CI step. Blocks follow Fiesta's stack table (its DESIGN.md, "The
297 stack"), written in estilo's own rules, because an app's `tokens.css`
298 may predate `rst-stack`: the door's card is one. An app's own card
299 (`estilo-door-open`) marks a field's hint `estilo-signin-hint` (0.5rem
300 from its input, either side) and a section of its own
301 `estilo-signin-section` (1.5rem above it).
302
303---
304
305## The gallery
306
307**`rastrillo/cmd/dsgen` does NOT generate a gallery for an arbitrary
308module — verified 2026-08-31.** Its public surface is `-out`/`-mount`, and
309`internal/designsystem.Render` hardcodes imports of
310`github.com/carlosframework/rastrillo/ui`. It renders *rastrillo's own*
311vocabulary. Pointed at estilo it would reproduce rastrillo.org's gallery.
312
313An earlier version of this file claimed the opposite, on good authority
314that turned out to be wrong. Recorded rather than quietly deleted, because
315the next person will hear the same claim.
316
317So estilo's gallery is an open question, not a solved one. **Do not build a
318second generator on the strength of that** — the right move is probably to
319ask rastrillo for the seam rather than to fork the tool.
320
321---
322
323## Process
324
325Worktree per session, branch per piece of work, regular pushes,
326squash-merge to `main` only when the work is done, approved, and **CI is
327actually green** — checked, not assumed.
328
329**Every spec and every branch is reviewed by the highest-capability model
330available** before approval or merge, and **the reviewing model is
331recorded** in the branch discussion. A review nobody can attribute is a
332review nobody can check.
333
334**Every branch gets a discussion, and that discussion is the review
335record** — it survives a squash where a PR body does not. **A refusal gets
336surfaced in the discussion, never routed around.**
337
338🤖 / 👨 markers, `Co-Authored-By` trailers, published prompt ledgers.
339
340## Known constraints
341
342Measured facts about Calma's values that bear on the next change.
343
344- **The tightest text pair is faint text on an accent-tinted surface**:
345 4.63:1 for Files in dark, against a 4.5:1 floor. Darkening an accent's
346 soft tint or lightening `--rst-text-faint` in dark goes under first.
347- **The tightest boundary is a control border on the sunk surface**:
348 `--rst-line-strong` on `--rst-surface-2` in light, just over 3:1.
349- **At the accent's lightness some hues cannot hold full chroma in
350 sRGB.** `theme.Hex` takes chroma down until the colour fits, so hue and
351 lightness stay true (Files' light accent carries about 0.09, not 0.15).
352 An app that looks greyer than its neighbours is this, not a bug.
353- **A strict 40° ring always puts one app in olive or lime** at this
354 lightness; that is why the hues are spaced by eye.
355
356`TestContrastMeetsWCAG` measures all of these on every run; the numbers
357here are for the conversation before a change, not instead of the test.
358
359## Work in a worktree, and catch main up first
360
361Take a worktree for the work. Do not work in the shared checkout.
362
363 git -C <repo> fetch origin
364 git -C <repo> worktree add ../<repo>-<task> -b <branch> origin/main
365
366Both halves matter, for different reasons.
367
368**The worktree**, because several sessions share this machine and some
369share this repository, and a checkout has one HEAD, one index and one
370working tree between all of them. A branch switch under somebody else's
371uncommitted work destroys it with nothing on screen to say so, and two
372sessions editing the same paths disagree quietly instead of conflicting
373loudly. A worktree gives the work its own HEAD and its own files, and
374costs a directory.
375
376**From `origin/main`, after a fetch** — not from whatever the checkout
377happens to be sitting on. A branch cut from a stale main is a merge
378conflict scheduled for later, against files somebody else has renamed in
379the meantime. A branch cut from another task's branch is worse: it
380carries that task's commits into yours, where they are reviewed as
381though you wrote them, and the two can only be separated by hand.
382
383Remove it when the work has landed — `git worktree remove` — so that
384`git worktree list` keeps saying something true.
385
386Written down because of 2026-09-17, in `meet`. The shared checkout was
387sitting on one task's branch while holding a *different* task's feature
388uncommitted on disk — some four hundred lines, a new migration among
389them — put there by a session nobody else knew was working in that tree.
390Two other sessions were meanwhile coordinating over the same checkout by
391asking each other not to touch it, which is the arrangement a worktree
392makes unnecessary. Nothing was lost. Nothing about the arrangement would
393have said so if it had been, and by then the same feature existed twice,
394once on each side of a rename, because the two sessions had branched
395from different starting points.
396