forge
Explore
Log in

Don't you dare go Hollow

forge

Clone
★ 0

0 watching0 forksRustAGPL-3.010.5 MiB41ee476Tahinli29 days ago283 commits

ui-language.md6.7 KiBHistoryRawDownload

Forge page language

Every page follows this, with no exceptions. The look lives in one place, style/_one.scss, the parts in crates/forge-web/src/views/parts.rs. A page writes structure and classes only: no page has its own button, field, menu, tab, tag or box. If something does not fit, change the part, never the page.

scripts/audit/measure.ts reads the computed look of every control on every page and reports anything outside this language.

A page

main holds these and nothing else, in this order:

  1. Head: <section class="head">, written with head(title: .., sub: .., <actions>) or, in a repo, repo_head(head: header, title: .., sub: .., <actions>). One visible h1. What the page is and what you can do about it sit together: the actions come right after the title, never at the far end.
  2. Tabs: <nav class="tabs">, the sections of the area you are in. Settings and admin get theirs from the shell, and a page's head goes above them by itself. A repo's are inside repo_head.
  3. Strip (.strip): only CI steps and files under review. It shows the whole thing and is how you move through it. Never on repo or settings pages.
  4. Work: one .sheet, or .work when the page has a list to pick from: <div class="work"> rail(..) <div class="sheet">..</div> </div>.

Also allowed in main: .state and .alert for a message about the whole page.

No visible title is ever missing, and no h1 class="sr-only". No page sets a width: the sheet takes the room. A page without a sub-list has no rail.

The rail

rail(label: .., items: vec![RailItem { name, val, href, current }]). It holds one list, never two. A long list scrolls by itself, with a filter input above it. One folder at a time; the path bar goes up. Sections never go in the rail: they go in .tabs.

The sheet

<div class="sheet">, white, radius 16, hairline ring. Add fit for a sheet that should hug its content.

  • <div class="sheet-tools"><strong>Name</strong> <a class="act">Tool</a> ...</div>: 48px row, the name of what is showing and its quiet tools right after it.
  • <section class="sec"><h2>Topic</h2> ... </section>: one topic. Hairline between topics.
  • A list: rows, with no heading if the tools row names it.
  • The sheet holds the content. Nothing nests a box in a box: no .card, .rows-pane, .fit-pane, .row-line, .row-field, .page-head, sidebars or second columns.

Rows

<a class="line" data-kb-row=""><span class="name">..</span><span class="val">..</span></a> when the item has its own page. When it opens in place:

<details class="row-open">
  <summary class="line"><span class="name">laptop</span><span class="val">SHA256:9fK2c1Qx</span></summary>
  <div class="opened">..</div>
</details>

Details come right after the title on one line. Nothing is pushed to the far end of a row: no margin-left:auto, no justify-content:space-between, no second column at the right.

Actions

  • Button: <button> (soft), <button class="primary"> (filled), .small. A head holds the page's main action as .primary and its others as soft. A form's submit is .primary, once, under its fields. a.button for a link that acts like one.
  • Tool: .act, a quiet word (14px, dim, radius 12). .act.danger for destructive. This is what goes in tools rows, in rows and in .acts.
  • reveal(label, id, open): a tool that opens its form in place. open when a form came back with an error.
  • confirm_act(lang, label, action, csrf, fields, note): every destructive action. It always asks first, in place, with a small filled danger button and "Keep it". There are no one-click deletes.
  • post_act(label, action, csrf, fields): a tool that posts at once, for what loses nothing.
  • No optimistic UI. Show done only after the server said so.

Forms

<form class="fields">
  <div class="field"><label for="x">Name</label><input id="x"><p class="hint">One line.</p></div>
  <button type="submit" class="primary">Save</button>
</form>

The label sits beside its control in one column, the hint after the control. .field-pair for two short fields. A checkbox is <label class="switch"><input type="checkbox"><span>..</span></label>, the box right before its label. Few fixed options are .choice:

<div class="choice"><label><input type="radio" name="theme" value="auto" checked><span>Auto</span></label> ..</div>

Longer lists are a <select>, 280px like a line of text with its chevron at its end, so every control in a form ends on one edge. Fields are soft filled shapes with no line around them. Every control has a label. Errors are alert at the top of the form they belong to, which stays open with the user's text.

Every search bar is live: data-live-search on a real GET form's input in .plain-search. It sits in the tools row or above the rail's list. Filters are the rail, or .tabs when there are only a few. Pagers appear only when another page exists, as one nav.pager row (Newer, the page, Older) under the list. An empty list is .state with one line and its action as .act.

Menus

Every dropdown, menu, popover and hover panel is the same panel: .menu-list, .pop-panel or .row-menu-panel, radius 20, shadow and ring, rows 34px high. Instant, no animation. No browser triangles. It never leaves the window, on a phone either.

Colour

Tokens only: --bg, --surface, --surface-2, --text, --muted, --border, --border-strong, --accent, --accent-soft, --bad, --danger-bg, --add-bg, --del-bg. Accent marks the one live or selected thing. Running colour is the accent. Passed is neutral. Failed is --bad. Cancelled is grey, never red. Added is blue and deleted is rose. Graphs use the same set: neutral marks, accent for now.

Type

Figtree for words, IBM Plex Mono for hashes, numbers beside names, paths and logs. No uppercase, no letter-spacing, no Archivo. h1 26/34 bold; h2 13 semibold dim; body 15/22; tools 14; hints 13.

Words

Short, plain, sentence case, no em dashes. All text goes through i18n, or crate::pages::passkeys::s(lang, "English", "Türkçe"), in proper Turkish ("çevrim içi" is two words). A Turkish page shows no English, an English page no Turkish.

Rules that stayed

  • No page transitions, no decorative motion. Live arrivals only, off for reduced motion.
  • CSP is strict: no inline style attributes, no inline script.
  • List rows carry data-kb-row. Live pages keep data-live, data-arrive and every data attribute nav.js reads.
  • Signed-in preferences live in the database.
  • A setting must visibly change something, or it goes.
  • A phone (390px) is one column: no sideways scroll, tabs scroll inside their row.
  • Pages fit one screen where they can: use tabs and the rail, not stacked unrelated topics.