forge
Clone
https://git.tahinli.com/Tahinli/forge.git
0 watching·0 forks·Rust·AGPL-3.0·7.1 MiB·490f099·Tahinli·7 hours ago·322 commits
| 1 | # Forge page language |
| 2 | |
| 3 | Every page follows this, with no exceptions. The look lives in one place, `style/_one.scss`, the parts |
| 4 | in `crates/forge-web-app/src/views/parts.rs`. A page writes structure and classes only: no page has its |
| 5 | own button, field, menu, tab, tag or box. If something does not fit, change the part, never the page. |
| 6 | |
| 7 | `scripts/audit/measure.ts` reads the computed look of every control on every page and reports anything |
| 8 | outside this language. |
| 9 | |
| 10 | ## A page |
| 11 | |
| 12 | `main` holds these and nothing else, in this order: |
| 13 | |
| 14 | 1. **Head**: `<section class="head">`, written with `head(title: .., sub: .., <actions>)` or, in a repo, |
| 15 | `repo_head(head: header, title: .., sub: .., <actions>)`. One visible `h1`. What the page is and what |
| 16 | you can do about it sit together: the actions come right after the title, never at the far end. |
| 17 | 2. **Tabs**: `<nav class="tabs">`, the sections of the area you are in. Settings and admin get theirs from |
| 18 | the shell, and a page's head goes above them by itself. A repo's are inside `repo_head`. |
| 19 | 3. **Strip** (`.strip`): only CI steps and files under review. It shows the whole thing and is how you |
| 20 | move through it. Never on repo or settings pages. |
| 21 | 4. **Work**: one `.sheet`, or `.work` when the page has a list to pick from: |
| 22 | `<div class="work"> rail(..) <div class="sheet">..</div> </div>`. |
| 23 | |
| 24 | Also allowed in `main`: `.state` and `.alert` for a message about the whole page. |
| 25 | |
| 26 | No visible title is ever missing, and no `h1 class="sr-only"`. No page sets a width: the sheet takes the |
| 27 | room. A page without a sub-list has no rail. |
| 28 | |
| 29 | ## The rail |
| 30 | |
| 31 | `rail(label: .., items: vec![RailItem { name, val, href, current }])`. It holds **one** list, never two. A |
| 32 | long list scrolls by itself, with a filter input above it. One folder at a time; the path bar goes up. |
| 33 | Sections never go in the rail: they go in `.tabs`. |
| 34 | |
| 35 | ## The sheet |
| 36 | |
| 37 | `<div class="sheet">`, white, radius 16, hairline ring. Add `fit` for a sheet that should hug its content. |
| 38 | |
| 39 | - `<div class="sheet-tools"><strong>Name</strong> <a class="act">Tool</a> ...</div>`: 48px row, the name |
| 40 | of what is showing and its quiet tools right after it. |
| 41 | - `<section class="sec"><h2>Topic</h2> ... </section>`: one topic. Hairline between topics. |
| 42 | - A list: rows, with no heading if the tools row names it. |
| 43 | - The sheet holds the content. Nothing nests a box in a box: no `.card`, `.rows-pane`, `.fit-pane`, |
| 44 | `.row-line`, `.row-field`, `.page-head`, sidebars or second columns. |
| 45 | |
| 46 | ## Rows |
| 47 | |
| 48 | `<a class="line" data-kb-row=""><span class="name">..</span><span class="val">..</span></a>` when the item |
| 49 | has its own page. Otherwise the row shows everything at once: its facts in the one `.val`, joined with |
| 50 | " · ", and its actions right after them on the same line. A state that is the usual case (a public repository) |
| 51 | says nothing; the unusual one is a plain fact in the `.val` ("Private · ★ 2"), never a tag. A confirm opens in place of its word, on the row. |
| 52 | |
| 53 | ```html |
| 54 | <div class="line"> |
| 55 | <span class="name">laptop</span><span class="val">SHA256:9fK2c1Qx · added 3 days ago</span> |
| 56 | confirm_act(..Delete..) |
| 57 | </div> |
| 58 | ``` |
| 59 | |
| 60 | `<details class="row-open">` only for a row whose hidden part is an edit form (a rename, a role). Never a |
| 61 | row that opens to show facts or a single action, never a link to a page that shows the same row again: |
| 62 | one click to see, one to act. |
| 63 | |
| 64 | Details come right after the title on one line. Nothing is pushed to the far end of a row: |
| 65 | no `margin-left:auto`, no `justify-content:space-between`, no second column at the right. |
| 66 | |
| 67 | ## Actions |
| 68 | |
| 69 | - **Button**: `<button>` (soft), `<button class="primary">` (filled), `.small`. A head holds the page's |
| 70 | main action as `.primary` and its others as soft. A form's submit is `.primary`, once, under its fields. |
| 71 | `a.button` for a link that acts like one. Every action beside a title is that soft pill (or the filled |
| 72 | one), whatever it is made of: an `a.act`, a form's `button.act` or a reveal's `summary.act` in the head |
| 73 | takes the pill's look, so no head shows a bare word beside a button. |
| 74 | On a tabbed page the head's action follows the tab: a profile shows Edit profile on Overview, New |
| 75 | repository on Repositories, New snippet on Snippets and New organization on Organizations, and the |
| 76 | list itself carries no second "New ..." line under it. |
| 77 | - **Facts**: a page that describes one thing (an account, an organization) lists it as `.sec.facts`: |
| 78 | compact 34px lines of a `.key` on the label column, the `.val`, and the action for that fact on the |
| 79 | same line. No hints under a heading or a fact. |
| 80 | - **Time range**: every log has a When filter (Any time, Last hour, Last 24 hours, Last 7 days, Last |
| 81 | 30 days, Today, Dates…). Dates… shows From and To day fields in the viewer's timezone, and the tools |
| 82 | row starts with the count of entries that match, so "how many sign-ins last week" is one glance. |
| 83 | - **Tool**: `.act`, a word in the accent's ink (14px, 600, radius 12), never the dim colour of a hint. |
| 84 | A topic's own action, standing alone under its heading in `.sec > .acts` or right in the `.sec` |
| 85 | (Rename repository, Transfer repository), takes the small soft pill (32px, like Star) instead, |
| 86 | red-worded when dangerous. On a line of facts a tool stays a word. `.act.danger` for destructive. This is what goes in |
| 87 | tools rows, in rows and in `.acts`. |
| 88 | - `reveal(label, id, open)`: a tool that opens its form in place. `open` when a form came back with an error. |
| 89 | In a `.fields` form its word starts on the controls' edge. What should not be one click away |
| 90 | (regenerating recovery codes, turning off two-factor) is a reveal whose form asks for the password |
| 91 | and the code again, never a prominent button. |
| 92 | - `confirm_act(lang, label, action, csrf, fields, note)`: every destructive action. It always asks first, in |
| 93 | place, with a small filled danger button and "Keep it". There are no one-click deletes. |
| 94 | - `post_act(label, action, csrf, fields)`: a tool that posts at once, for what loses nothing. |
| 95 | - No optimistic UI. Show done only after the server said so. |
| 96 | |
| 97 | ## Forms |
| 98 | |
| 99 | ```html |
| 100 | <form class="fields"> |
| 101 | <div class="field"><label for="x">Name</label><input id="x"></div> |
| 102 | <button type="submit" class="primary">Save</button> |
| 103 | </form> |
| 104 | ``` |
| 105 | |
| 106 | The label sits beside its control in one column. `.field-pair` for two short |
| 107 | fields. A checkbox is `<label class="switch"><input type="checkbox"><span>..</span></label>`, the box right |
| 108 | before its label. Few fixed options are `.choice`: |
| 109 | |
| 110 | ```html |
| 111 | <div class="choice"><label><input type="radio" name="theme" value="auto" checked><span>Auto</span></label> ..</div> |
| 112 | ``` |
| 113 | |
| 114 | Longer lists are a `<select>`, 280px like a line of text with its chevron at its end, so every control in a |
| 115 | form ends on one edge. Fields are soft filled shapes with no line around them. Every control has a |
| 116 | label. Errors are `alert` at the top of the form they belong to, which stays open with the user's text. |
| 117 | |
| 118 | ## Lists and search |
| 119 | |
| 120 | Every list that can grow has a search, and every search is `finder_field` (`views/find.rs`): a live |
| 121 | `.plain-search` (results follow typing, no Enter) with two options beside it, Exact and Aa (match case), |
| 122 | which apply the moment they are ticked. By default a search forgives typos and case. Its placeholder |
| 123 | names what is searched ("Search users", "Search organizations", not one text for every tab). A category |
| 124 | filter is a `.find-filter`: its word, then the small soft select, on the same line. Inside a topic the |
| 125 | row is `form.sec-tools`. |
| 126 | |
| 127 | A list that can grow is paged, never endless: about one screen of rows. Pagers appear only when another |
| 128 | page exists, as one `nav.pager` row under the list on the sheet's inset. A numbered pager always has |
| 129 | Previous and Next and always seven page slots once there are more than seven pages, so nothing in the |
| 130 | row moves when you change page; a step you cannot take stays in place, dimmed. An empty list is |
| 131 | `.state` with one line and its action as `.act`. A log reads as text: action words, then facts joined |
| 132 | with " · ", never raw JSON. Runs of the same action by the same person fold into one `details.log-group` |
| 133 | line with "×N" and what they share; the line opens in place to list every entry with what differs, and |
| 134 | a page counts folded lines, so a page of folds is as full as any other. |
| 135 | |
| 136 | ## Menus |
| 137 | |
| 138 | Every dropdown, menu, popover and hover panel is the same panel: `.menu-list`, `.pop-panel` or |
| 139 | `.row-menu-panel`, radius 20, shadow and ring, rows 34px high. Instant, no animation. No browser |
| 140 | triangles. It never leaves the window, on a phone either. |
| 141 | |
| 142 | ## Colour |
| 143 | |
| 144 | Tokens only: `--bg`, `--surface`, `--surface-2`, `--text`, `--muted`, `--border`, `--border-strong`, `--accent`, |
| 145 | `--accent-soft`, `--bad`, `--danger-bg`, `--add-bg`, `--del-bg`. Accent marks the one live or selected |
| 146 | thing. In CI, running is the accent, passed is `--ok` green and failed is `--bad`, everywhere a result |
| 147 | shows (ticks, step strips, timeline, history bars). `--ok` takes the accent's lightness and strength |
| 148 | with a green hue, so results sit with whichever accent is chosen. Cancelled is grey, never red. Added |
| 149 | is blue and deleted is rose. |
| 150 | |
| 151 | A colour choice offers five presets and a Custom chip (its swatch and the word), on the same columns |
| 152 | in every row. Backgrounds and accents of one hue share a column: Ink and Sage (the default for light |
| 153 | and dark), Anvil and Ember, Dusk and Ocean, Heather and Plum, Blush and Rose. |
| 154 | |
| 155 | ## Type |
| 156 | |
| 157 | Figtree for words, IBM Plex Mono for hashes, numbers beside names, paths and logs. No uppercase, no |
| 158 | letter-spacing, no Archivo. `h1` 26/34 bold; `h2` 13 semibold dim; body 15/22; tools 14; hints 13. |
| 159 | |
| 160 | ## Words |
| 161 | |
| 162 | No microcopy: no hints, helper text, subtext, intros or explanations, on any page. A head's sub holds |
| 163 | facts only (state, author, time, branch), or nothing. Labels, values, errors and one-line empty states |
| 164 | stay. Short, plain, sentence case, no em dashes. All text goes through i18n, or |
| 165 | `crate::pages::passkeys::s(lang, "English", "Türkçe")`, in proper Turkish ("çevrim içi" is two words). A |
| 166 | Turkish page shows no English, an English page no Turkish. |
| 167 | |
| 168 | ## Rules that stayed |
| 169 | |
| 170 | - No page transitions, no decorative motion. Live arrivals only, off for reduced motion. |
| 171 | - CSP is strict: no inline style attributes, no inline script. |
| 172 | - List rows carry `data-kb-row`. Live pages keep `data-live`, `data-arrive` and every data attribute |
| 173 | nav.js reads. |
| 174 | - Signed-in preferences live in the database. |
| 175 | - A setting must visibly change something, or it goes. |
| 176 | - A phone (390px) is one column: no sideways scroll, tabs scroll inside their row. The sheet runs to |
| 177 | the screen's edges with a hairline above and below, never a box inside the padded page, and a |
| 178 | `fit` sheet takes the whole width there. |
| 179 | - Pages fit one screen where they can: use tabs and the rail, not stacked unrelated topics. |
| 180 | |
| 181 | ## Fewer places |
| 182 | |
| 183 | - One place for each thing. A setting, a count or an action shows on exactly one page; another page |
| 184 | links to it instead of repeating it. The unread count is in the profile corner and the inbox, nowhere |
| 185 | else; the theme is chosen in Appearance only. |
| 186 | - One door per audience. An area holds what its people do: a repository's settings say what the repo |
| 187 | is (General), who works on it, how branches are guarded, what it talks to, and its Danger zone |
| 188 | (rename, transfer, visibility, archive, delete). Admin is Users, Runners, Server, Mail, Backups, |
| 189 | Health and Audit log; what belongs to one of those (invites, replication, a backup's settings) is a |
| 190 | rail item there, never a tab or a second copy in Server. |
| 191 | - One main action per head. What is rare (a badge snippet, a raw log, a download) is a tool word in the |
| 192 | sheet's tools row, not a pill beside the title. |
| 193 | - A conversation is quiet: a comment's tools are words (React · Edit · Delete), a run of events by one |
| 194 | person folds into one line, a fact that holds the usual value (not pinned, no milestone, open to |
| 195 | everyone) shows only its key and its word. |
| 196 | - No chatty lines. A sentence the page would read the same without goes. |
| 197 | |
| 198 | ## Fixed places |
| 199 | |
| 200 | - Every head on a page with tabs is one height (a 38px title line and one sub line), so the tabs and the |
| 201 | sheet never move when you switch tabs. |
| 202 | - The path bar names every place above the page as a link: section, item (`#12`), page. A page whose |
| 203 | parent is not in its address (a job's run) passes it to `shell(parents: ..)`. No page needs the browser's |
| 204 | Back button. |
| 205 | - A form of one field puts its submit beside the field. |
| 206 | - Every control has one focus ring: 2px in `--focus`, inside its own edge (`outline-offset: -2px`), so |
| 207 | no sheet, row or scrolling list cuts it. |
| 208 | - A tab's own pages sit in its rail: the Security log is a Security rail item, not a page of its own. |
| 209 | - No page is an orphan. A page that makes or shows something of yours (a new repository, an import, a |
| 210 | snippet, a new organization) shows your profile tabs with the area it belongs to marked, and the inbox |
| 211 | pages (Notifications, Needs you, Review requests) share one rail, so a mouse reaches every neighbour. |
| 212 | - An action a server cannot carry out shows as unavailable: no "send again" when mail is not set up. |
| 213 | - Avatars without an uploaded image are drawn in the page (a letter on a colour from the name), so a |
| 214 | list of people or organizations never waits on image requests. |