Public: anyone can read this; the crew can change it.

Every bare "No …" empty state is drawn from src/core/empty_words.ts, and the OWN_WORDS count table is deleted #18355

opened this

Merged 2h 7m ago, live in production

mason/forge:mason/18351-every-bare-no-empty-state-is-drawn-from → main 0 commits fork 1 thread · 1 unresolved

  • Merged. mason/18351-every-bare-no-empty-state-is-drawn-from was merged into main as e036110.

Review

Sign in to review this change.
30 files changed +113 −121
scripts/design-lint.ts +4 −5
@@ -81,7 +81,7 @@ import { scanFeel, staleAllows } from "../src/design/feel.ts";
8181 import { motionFindings } from "../src/design/motion.ts";
8282 import { PHONE_PX, widthFindings } from "../src/design/width.ts";
8383 import { cssBlocksAt, scanOverlay, sourceFiles } from "../src/design/overlay.ts";
84 import { ownWordsOff, type Source, tsSources, WIDTH_SKIP, widthReadsOver } from "../src/design/ratchets.ts";
84 import { bareNoFindings, type Source, tsSources, WIDTH_SKIP, widthReadsOver } from "../src/design/ratchets.ts";
8585
8686 // The covered-page rule lives in src/design/ so the release preflight runs it too (#11916).
8787 export { motionFindings, type MotionFinding } from "../src/design/motion.ts";
@@ -675,12 +675,11 @@ export function scanRing(root: string): string[] {
675675
676676 /**
677677 * The two ratchets the check most often refused for (#17521): a page's own bare "No …" empty state
678 * beyond OWN_WORDS (or fewer than it names), and a width read in script beyond WIDTH_READS. The
679 * same counts and words as test/empty-words-all.test.ts and test/behaviors-rule.test.ts.
678 * anywhere under src/web, and a width read in script beyond WIDTH_READS. The
679 * same findings as test/empty-words-all.test.ts (bare "No …") and test/behaviors-rule.test.ts (widths).
680680 */
681681 export function ratchetFindings(web: readonly Source[], src: readonly Source[]): string[] {
682 const own = ownWordsOff(web);
683 return [...own.over, ...own.moved, ...widthReadsOver(src)];
682 return [...bareNoFindings(web), ...widthReadsOver(src)];
684683 }
685684 /** Each over the files its test reads: every file under src/web, and src/ but for WIDTH_SKIP. */
686685 export function scanRatchets(root: string): string[] {
src/core/empty_words.ts +20 −2
@@ -102,6 +102,22 @@ const TABLE = {
102102 cloudResources: { sentence: "No cloud account is attached.", reason: "Attach one and the forge reads what it holds and what it costs." },
103103 gamePluginConfigs: { sentence: "No plugin config file is kept in the repository yet.", reason: "Add one below: it is a commit to the compose file." },
104104 gameSnapshots: { sentence: "No snapshot yet.", reason: "One is taken before every import or restore." },
105 // Lists a page used to word itself (#18351); each page's own words, drawn from here.
106 diffChanges: { sentence: "No changes." },
107 commitsPaged: { sentence: "No commits on this page.", reason: "You have paged past the end of this history." },
108 commitsShown: { sentence: "No commits to show." },
109 displayBuilds: { sentence: "No builds.", reason: "This display shows no builds yet." },
110 issueRepos: { sentence: "No repository to open an issue in.", reason: "Open one from a repository you can see." },
111 lookPicture: { sentence: "No picture yet.", reason: "One is taken when the preview comes up green." },
112 originAccount: { sentence: "No account connected.", reason: "Connect the account the apps live on, and what is left there is listed here." },
113 originConnect: { sentence: "No such connect.", reason: "It finished, expired, or was never yours. Start again from Connected accounts." },
114 templateForges: { sentence: "No forges to show for that template.", reason: "Only admins can list forges started from a template." },
115 shots: { sentence: "No screenshots on {} yet." },
116 welcomeIssues: { sentence: "No open issue carries {} right now." },
117 familyAlone: { sentence: "No parent, and none sent." },
118 notes: { sentence: "No notes yet.", reason: "Write one above." },
119 reportsMatch: { sentence: "No security reports match." },
120 visits: { sentence: "No visits recorded for {}." },
105121 } as const satisfies Readonly<Record<string, EmptyWords>>;
106122
107123 /** What Start a game box asks Talk, from the page and the terminal: `infra` plans one free, and the forge asks before it builds. */
@@ -114,9 +130,11 @@ export const EMPTY_WORDS: Readonly<Record<EmptyKind, EmptyWords>> = TABLE;
114130 /**
115131 * The sentence and its reason as one line of text: the terminal's empty screens and `emptyLine`.
116132 */
117 export function emptyText(kind: EmptyKind): string {
133 export function emptyText(kind: EmptyKind, subject?: string): string {
118134 const w: EmptyWords = TABLE[kind];
119 return w.reason === undefined ? w.sentence : `${w.sentence} ${w.reason}`;
135 const text = w.reason === undefined ? w.sentence : `${w.sentence} ${w.reason}`;
136 // A `{}` in the table's words is the one thing the page names (a build, a label); the words stay here.
137 return subject === undefined ? text : text.replaceAll("{}", () => subject);
120138 }
121139
122140 /**
src/design/ratchets.ts +14 −45
@@ -1,9 +1,10 @@
11 /**
2 * Two per-file ratchets, counted once (#17521): a page's own bare "No …" empty state (#15851) and a
3 * width read in script (#13783). test/empty-words-all.test.ts and test/behaviors-rule.test.ts hold
4 * them; scripts/design-lint.ts prints the same findings, so a builder sees them before the push.
5 * Each table names a file's count today; a file may hold no more, and an empty-words count must be
6 * exact, so moving one off shrinks it and a new one fails.
2 * Two per-file ratchets, counted once (#17521): a page's own bare "No …" empty state (#15851, now
3 * none at all: #18351) and a width read in script (#13783). test/empty-words-all.test.ts and
4 * test/behaviors-rule.test.ts hold them; scripts/design-lint.ts prints the same findings, so a
5 * builder sees them before the push. The width table names a file's count today; a file may hold no
6 * more. A bare "No …" has no table: none is allowed, whether a page words it in markup or hands it
7 * to a helper as `sentence:`.
78 *
89 * This module lives in src/design/, not src/web/, because the empty-words scan reads every file
910 * under src/web. The width pattern spells its words with a character class so this file reads no
@@ -18,9 +19,7 @@ import { join } from "node:path";
1819 */
1920 export const RATCHET_FIX = {
2021 ownWordsOver:
21 "Fix: add the words to the EMPTY_WORDS table (src/core/empty_words.ts) and draw them with emptyList(kind); never raise the file's count in OWN_WORDS.",
22 ownWordsMoved:
23 "Fix: it moved to the table, so lower the file's count in OWN_WORDS (src/design/ratchets.ts) to match, or delete its line at 0; lowering is the right move.",
22 "Fix: add the words to the EMPTY_WORDS table (src/core/empty_words.ts) and draw them with emptyList(kind), emptyLine(kind) or emptySection(kind); a bare \"No …\" under src/web is an error.",
2423 widthOver:
2524 "Fix: answer the width with a media or container query in CSS, or a behavior in src/web/behaviors.ts; never raise the file's count in WIDTH_READS (src/design/ratchets.ts).",
2625 ownScriptNew:
@@ -50,48 +49,18 @@ export function tsSources(root: string, dir: string, skip?: RegExp): Source[] {
5049 // A page's own "No …" empty state, in either form: empty({ title: "No …" }) (one line or several)
5150 // or an inline <p class="… muted …">No …</p>, whatever classes sit beside muted and whatever
5251 // follows. A new empty state goes in src/core/empty_words.ts and is drawn with emptyList(kind).
53 const OWN_FORM = /empty\(\{\s*(?:icon: [^,]+,\s*)?title: [`"]No |empty\("No |<p class="(?:[^"]* )?muted(?: [^"]*)?">\s*No /g;
54 // What is left is split into #15899 (admin, system), #15900 (boards, bets, flows), #15901
55 // (repository pages), #15902 (apps, forges) and #15903 (studio, renderers); #15851 waits for them.
56 export const OWN_WORDS: Readonly<Record<string, number>> = {
57 "src/web/diff-view.ts": 1,
58 "src/web/pages/boards.ts": 1,
59 "src/web/pages/browse.ts": 1,
60 "src/web/pages/build_shots.ts": 1,
61 "src/web/pages/commits.ts": 1,
62 "src/web/pages/contribute.ts": 1,
63 "src/web/pages/display.ts": 1,
64 "src/web/pages/family.ts": 1,
65 "src/web/pages/inventory.ts": 1,
66 "src/web/pages/issues.ts": 1,
67 "src/web/pages/looks.ts": 1,
68 "src/web/pages/notes.ts": 1,
69 "src/web/pages/origin-flow.ts": 1,
70 "src/web/pages/origins.ts": 1,
71 "src/web/pages/packs.ts": 2,
72 "src/web/pages/pull.ts": 1,
73 "src/web/pages/reports.ts": 1,
74 "src/web/pages/sources.ts": 1,
75 "src/web/studio/explore.ts": 1,
76 "src/web/studio/hold.ts": 1,
77 };
78
52 const OWN_FORM = /empty\(\{\s*(?:icon: [^,]+,\s*)?title: [`"]No |empty\("No |<p class="(?:[^"]* )?muted(?: [^"]*)?">\s*No |\bsentence: [`"]No /g;
7953 /** How many bare "No …" empty states the text words itself. */
8054 export const ownWords = (src: string): number => [...src.matchAll(OWN_FORM)].length;
8155
8256 /**
83 * Files under src/web off their OWN_WORDS count, each with its fix: `over` words more bare "No …"
84 * empty states than named (the table moves them), `moved` fewer (the count is lowered).
57 * Files under src/web that word a bare "No …" empty state, each with its fix (#18351): none may.
8558 */
86 export function ownWordsOff(files: readonly Source[]): { over: string[]; moved: string[] } {
87 const over: string[] = [];
88 const moved: string[] = [];
89 for (const f of files) {
90 const n = ownWords(f.text), named = OWN_WORDS[f.path] ?? 0;
91 if (n > named) over.push(`${f.path}: ${n} > ${named} bare 'No …' empty states. ${RATCHET_FIX.ownWordsOver}`);
92 else if (n < named) moved.push(`${f.path}: ${n} < ${named} bare 'No …' empty states. ${RATCHET_FIX.ownWordsMoved}`);
93 }
94 return { over, moved };
59 export function bareNoFindings(files: readonly Source[]): string[] {
60 return files.flatMap((f) => {
61 const n = ownWords(f.text);
62 return n === 0 ? [] : [`${f.path}: ${n} bare 'No …' empty state${n === 1 ? "" : "s"}. ${RATCHET_FIX.ownWordsOver}`];
63 });
9564 }
9665
9766 /** Paths under src/ the width ratchet does not read. */
src/web/diff-view.ts +2 −2
@@ -26,7 +26,6 @@ import {
2626 btn,
2727 card,
2828 disclosure,
29 empty,
3029 field as formField,
3130 icon,
3231 listCard,
@@ -38,6 +37,7 @@ import { kept, type Refused } from "./form.ts";
3837 import { renderMarkdown } from "./markdown.ts";
3938 import { permalink } from "./comments.ts";
4039 import { wordDiff, type Segment } from "./worddiff.ts";
40 import { emptyList } from "./empty_words.ts";
4141
4242 /** Highlighted tokens per side for a file, keyed by path in a SyntaxMap. */
4343 export interface FileTokens {
@@ -614,7 +614,7 @@ export function renderDiff(
614614 const opts: DiffViewOptions =
615615 options instanceof Map ? { syntax: options } : (options ?? {});
616616 if (diff.files.length === 0) {
617 return empty({ title: "No changes." });
617 return emptyList("diffChanges");
618618 }
619619 const shown = diff.files.slice(0, MAX_DIFF_FILES);
620620 const hidden = diff.files.length - shown.length;
src/web/empty_words.ts +10 −2
@@ -60,6 +60,13 @@ const ICONS = {
6060 labels: "tag",
6161 events: "activity",
6262 seriesAnswered: "activity",
63 diffChanges: "commit",
64 commitsPaged: "commit",
65 displayBuilds: "pin",
66 issueRepos: "issue",
67 originAccount: "download",
68 originConnect: "search",
69 templateForges: "search",
6370 } as const satisfies Partial<Record<EmptyKind, IconName>>;
6471
6572 export interface EmptyOptions {
@@ -96,8 +103,9 @@ export function emptyList(kind: keyof typeof ICONS, o: EmptyOptions = {}): Html
96103 * line, the sentence and its reason, no picture and no link, so the form stays in view. It is also
97104 * the compact form for small inline lists (a fieldset, a list item, a narrow phone), where the
98105 * picture block would cost layout and bytes; any kind may be drawn this way. */
99 export function emptyLine(kind: EmptyKind, o: { reason?: string; id?: string } = {}): Html {
100 const text = o.reason === undefined ? emptyText(kind) : `${EMPTY_WORDS[kind].sentence} ${o.reason}`;
106 export function emptyLine(kind: EmptyKind, o: { reason?: string; id?: string; subject?: string } = {}): Html {
107 const sentence = EMPTY_WORDS[kind].sentence.replaceAll("{}", () => o.subject ?? "{}");
108 const text = o.reason === undefined ? emptyText(kind, o.subject) : `${sentence} ${o.reason}`;
101109 if (o.id !== undefined) return html`<p class="muted small" id="${o.id}">${text}</p>`;
102110 return html`<p class="muted small">${text}</p>`;
103111 }
src/web/pages/boards.ts +2 −1
@@ -23,6 +23,7 @@ import { page } from "../layout.ts";
2323 import { btn, card, chartFrame, empty, field, selectField } from "../ui.ts";
2424 import { count, figure, figures, fold, reading, readingFailed, readingReplaceJs } from "../figure.ts";
2525 import { readForm } from "../form.ts";
26 import { emptyList } from "../empty_words.ts";
2627
2728 const AGGREGATES = ["count", "sum", "avg", "max"] as const;
2829 const OPS = ["eq", "ne", "lt", "lte", "gt", "gte", "starts"] as const;
@@ -172,7 +173,7 @@ async function explorer(ctx: Ctx, user: NonNullable<Ctx["auth"]["user"]>, asked:
172173 if (!answer.ok) {
173174 result = empty({ icon: "activity", title: "That query was refused", note: answer.error });
174175 } else if (answer.points === 0) {
175 result = empty({ icon: "activity", title: "No rows", note: "Nothing matches this query. Change the question below, or start from one of the questions above." });
176 result = emptyList("rows", { reason: "Nothing matches this query. Change the question below, or start from one of the questions above." });
176177 } else if (answer.chart === null) {
177178 result = html`<p class="bd-sub">The rows behind one point, as the values of ${columnWords(cols[0] ?? "")} with how many rows have each. <a href="${link({ ...p, rows: "" })}">Back to the chart</a>.</p>${raw(answer.table)}`;
178179 } else {
src/web/pages/browse.ts +2 −2
@@ -25,7 +25,7 @@
2525 * labels and authors instead.
2626 */
2727
28 import { emptyList } from "../empty_words.ts";
28 import { emptyLine, emptyList } from "../empty_words.ts";
2929 import { binaryRefusal } from "../render/opens_with.ts";
3030 import { clamp } from "../clamp.ts";
3131 import { mirrorJobFor, startMirrorJob } from "../../actions/origins.ts";
@@ -749,7 +749,7 @@ async function browseThread(
749749 <aside>
750750 ${card(
751751 detail.issue.labels.length === 0
752 ? html`<p class="muted small">No labels.</p>`
752 ? emptyLine("labels")
753753 : html`<div class="bar">
754754 ${detail.issue.labels.map((l) => labelChip(l))}
755755 </div>`,
src/web/pages/build_shots.ts +2 −1
@@ -14,6 +14,7 @@ import type { Ctx } from "../../http/context.ts";
1414 import { crumbsFor, loadRepo, notFoundPage, repoBase, repoHeader, repoPalette } from "../chrome.ts";
1515 import { html, type Html } from "../html.ts";
1616 import { page } from "../layout.ts";
17 import { emptyLine } from "../empty_words.ts";
1718
1819 export const SHOTS_LIVE = "build.shots,build.pinned";
1920
@@ -30,7 +31,7 @@ export async function shotsPage(ctx: Ctx): Promise<Response> {
3031 const at = `${base}/builds/${encodeURIComponent(label)}/shots`;
3132 const grid: Html =
3233 shots.items.length === 0
33 ? html`<p class="muted small">No screenshots on ${label} yet.</p>`
34 ? emptyLine("shots", { subject: label })
3435 : html`<div class="looks">${shots.items.map(
3536 (s) => html`<figure>
3637 <a class="look" href="${at}/${s.file}?v=${s.oid.slice(0, 12)}"><img src="${at}/${s.file}?v=${s.oid.slice(0, 12)}" alt="${s.caption === "" ? `Screenshot ${s.file}` : s.caption}" width="320" height="240" loading="lazy" decoding="async" /></a>
src/web/pages/commits.ts +1 −2
@@ -33,7 +33,6 @@ import { localScope, scopeGlyph, type RepoScope } from "../scope.ts";
3333 import {
3434 avatar,
3535 badge,
36 empty,
3736 messageText,
3837 originTag,
3938 pager,
@@ -211,7 +210,7 @@ export function historyBar(
211210
212211 export const noCommits = (later: boolean): Html =>
213212 later
214 ? empty({ icon: "commit", title: "No commits on this page", note: "You have paged past the end of this history." })
213 ? emptyList("commitsPaged")
215214 : emptyList("commits", { noAction: true });
216215
217216 // ---- the local pages ----
src/web/pages/contribute.ts +2 −1
@@ -9,6 +9,7 @@ import type { Ctx } from "../../http/context.ts";
99 import { welcome } from "../../system/telemetry.ts";
1010 import { html, type Html } from "../html.ts";
1111 import { page } from "../layout.ts";
12 import { emptyText } from "../../core/empty_words.ts";
1213
1314 /** The welcomed issues as rows the shell's j/k walk; Enter opens the issue. */
1415 export function welcomedList(issues: readonly { path: string; repo: string; number: number; title: string }[]): Html {
@@ -31,7 +32,7 @@ export function contributePage(ctx: Ctx): Response {
3132 <section class="stack" aria-labelledby="welcome-h">
3233 <h2 id="welcome-h">Issues that welcome outside work</h2>
3334 ${w.issues.length === 0
34 ? html`<p class="muted">No open issue carries the “${w.welcomeLabel}” label right now.</p>`
35 ? html`<p class="muted">${emptyText("welcomeIssues", `the “${w.welcomeLabel}” label`)}</p>`
3536 : welcomedList(w.issues)}
3637 </section>
3738 <section class="stack" aria-labelledby="propose-h">
src/web/pages/display.ts +3 −3
@@ -21,8 +21,8 @@ import type { Ctx } from "../../http/context.ts";
2121 import { crumbsFor, forbiddenPage, loadRepo, notFoundPage, repoBase, repoHeader, repoPalette } from "../chrome.ts";
2222 import { html, raw } from "../html.ts";
2323 import { flashTo, page } from "../layout.ts";
24 import { EMPTY_WORDS } from "../empty_words.ts";
25 import { btn, empty } from "../ui.ts";
24 import { EMPTY_WORDS, emptyList } from "../empty_words.ts";
25 import { btn } from "../ui.ts";
2626 import { readForm } from "../form.ts";
2727
2828 const LAYOUT_WORD = { shelf: "Shelf", grid: "Grid", graph: "Graph" } as const;
@@ -63,7 +63,7 @@ export async function displayPage(ctx: Ctx): Promise<Response> {
6363 ${!config.ok
6464 ? html`<p role="alert">${config.error}</p>`
6565 : items.length === 0
66 ? empty({ icon: "pin", title: "No builds", note: "This display shows no builds yet." })
66 ? emptyList("displayBuilds")
6767 : html`<p>${LAYOUT_WORD[config.value.layout]} · ${String(items.length)} ${items.length === 1 ? "build" : "builds"}</p>
6868 <div class="table-scroll" role="region" tabindex="0" aria-label="Builds">
6969 <table class="table" data-dense data-by="display-builds">
src/web/pages/family.ts +2 −1
@@ -20,6 +20,7 @@ import { badge, row } from "../ui.ts";
2020 import { FOLLOW_WORD } from "../../actions/follow_words.ts";
2121 import { familyTreeJs } from "./family_tree_js.ts";
2222 import { NO_KEY_HELD, NO_KEY_HOST_LINE } from "../../crew/no_key.ts";
23 import { emptyLine } from "../empty_words.ts";
2324
2425 export interface Node {
2526 readonly label: string;
@@ -162,7 +163,7 @@ export async function familyPage(
162163 ${treeRow(root, 0)}
163164 </ul>
164165 ${kids.more > 0 ? html`<p class="muted small">${plural(kids.more, "more forge")} not shown.</p>` : null}
165 ${alone ? html`<p class="muted small">No parent, and none sent.</p>` : null}
166 ${alone ? emptyLine("familyAlone") : null}
166167 ${ctx.auth.user === undefined ? null : html`<p class="muted small" data-fork-flows-link><a href="/forks/flows">Fork flows</a></p>`}
167168 </div>`,
168169 });
src/web/pages/inventory.ts +3 −5
@@ -16,8 +16,9 @@ import type { Ctx } from "../../http/context.ts";
1616 import { notFoundPage, pageHead, signInFirst } from "../chrome.ts";
1717 import { html, type Html } from "../html.ts";
1818 import { page } from "../layout.ts";
19 import { badge, btn, empty, row, seg, type Tone } from "../ui.ts";
19 import { badge, btn, row, seg, type Tone } from "../ui.ts";
2020 import { securityFloor } from "../../http/respond.ts";
21 import { emptyList } from "../empty_words.ts";
2122
2223 const TONE: Record<MigrationState, Tone> = {
2324 not_started: "default",
@@ -98,10 +99,7 @@ export async function inventoryPage(ctx: Ctx): Promise<Response> {
9899 const rendering = performance.now();
99100 const body =
100101 origins.length === 0
101 ? empty({
102 icon: "download",
103 title: "No account connected",
104 note: "Connect the account the apps live on, and what is left there is listed here.",
102 ? emptyList("originAccount", {
105103 action: btn("Connect an account", { href: "/migrate", variant: "primary" }),
106104 })
107105 : html`${pageHead("What is left to bring over", {
src/web/pages/issues.ts +2 −1
@@ -50,6 +50,7 @@ import {
5050 pageTitle,
5151 tellsHref,
5252 } from "../studio/nouns.ts";
53 import { emptyList } from "../empty_words.ts";
5354
5455 // ---- compose ----
5556
@@ -229,7 +230,7 @@ export function newIssueAnywhere(ctx: Ctx): Response {
229230 title: "New issue",
230231 body: html`<div class="page-head"><h1>New issue</h1></div>
231232 ${repos.length === 0
232 ? empty({ icon: "issue", title: "No repository to open an issue in", note: "Open one from a repository you can see." })
233 ? emptyList("issueRepos")
233234 : html`<p class="muted">Which repository?</p>${listCard(
234235 repos.map((r) =>
235236 row({
src/web/pages/looks.ts +2 −3
@@ -41,6 +41,7 @@ import { noPicture } from "../look_none.ts";
4141 import { loadRepo, repoBase } from "../chrome.ts";
4242 import { html, when, type Html } from "../html.ts";
4343 import { disclosure, sha, time } from "../ui.ts";
44 import { emptyLine } from "../empty_words.ts";
4445
4546 /** The newest picture at one width, when there is one. */
4647 export const pictured = (
@@ -171,9 +172,7 @@ export function lookCard(
171172 if (taken.length === 0 && attached.length === 0) {
172173 if (pull.state !== "open" || pull.mergedAt !== null) return html``;
173174 return block(
174 html`<p class="muted small">
175 No picture yet. One is taken when the preview comes up green.
176 </p>`,
175 emptyLine("lookPicture"),
177176 );
178177 }
179178 // Home first, then the rest in the order the manifest is likeliest to
src/web/pages/notes.ts +2 −1
@@ -22,6 +22,7 @@ import { html } from "../html.ts";
2222 import { flashTo, page } from "../layout.ts";
2323 import { btn, listCard, row, time } from "../ui.ts";
2424 import { cut } from "../../actions/ask_state_words.ts";
25 import { emptyLine } from "../empty_words.ts";
2526
2627 const HERE = "/notes";
2728 const SHOWN = 100;
@@ -86,7 +87,7 @@ export async function notesView(ctx: Ctx): Promise<Response> {
8687 <div class="bar"><span class="muted small">Enter saves · Shift+Enter for a new line</span><span class="spacer"></span>${btn("Save", { variant: "primary" })}</div>
8788 </form>
8889 ${rows.length === 0
89 ? html`<p class="muted small">No notes yet. Write one above.</p>`
90 ? emptyLine("notes")
9091 : listCard(rows, { extra: "bare" })}</div>`;
9192 return timePhase(ctx.request, "render", () =>
9293 page({ ctx, title: "Notes", body, styleCss: NOTES_CSS, scriptJs: notesJs, description: "Write an idea; watch it become shipped work." }),
src/web/pages/origin-flow.ts +1 −1
@@ -132,7 +132,7 @@ export function originFlowPage(ctx: Ctx): Response {
132132 <div class="narrow-wide">
133133 ${body}${waiting}
134134 <p class="muted small mt">
135 No JavaScript? Refresh this page to check again — the reload re-polls.
135 Without JavaScript, refresh this page to check again — the reload re-polls.
136136 </p>
137137 </div>`,
138138 scriptJs: pollJs,
src/web/pages/origins.ts +2 −5
@@ -89,7 +89,6 @@ import {
8989 badge,
9090 btn,
9191 confirmAction,
92 empty,
9392 icon,
9493 row,
9594 time,
@@ -98,6 +97,7 @@ import {
9897 copyField,
9998 toast,
10099 } from "../ui.ts";
100 import { emptyList } from "../empty_words.ts";
101101
102102 export type AccountSection =
103103 | "bring"
@@ -1308,10 +1308,7 @@ export async function originAppDelete(ctx: Ctx): Promise<Response> {
13081308 }
13091309
13101310 export function notFoundNote(): Html {
1311 return empty({
1312 icon: "search",
1313 title: "No such connect",
1314 note: "It finished, expired, or was never yours. Start again from Connected accounts.",
1311 return emptyList("originConnect", {
13151312 action: btn("Back to connected accounts", {
13161313 href: "/settings/origins",
13171314 variant: "primary",
src/web/pages/packs.ts +2 −2
@@ -162,7 +162,7 @@ function curatedPage(ctx: Ctx, pack: CuratedPack, legacy: Pack | undefined): Res
162162 : html`<section class="stack">
163163 <h2>Deploy it on your own machine</h2>
164164 ${copyField("pack-command", commands.join("\n"), `The command that deploys the ${legacy.title} pack`, "Copy the command", { lines: commands.length })}
165 <p class="muted small">No data, secrets or variables come with it.</p>
165 <p class="muted small">Data, secrets and variables do not come with it.</p>
166166 </section>`}
167167 <section class="stack">
168168 <h2>The apps inside</h2>
@@ -199,7 +199,7 @@ export async function packPage(ctx: Ctx): Promise<Response> {
199199 ${copyField("pack-command", commands.join("\n"), `The command that deploys the ${pack.title} pack`, "Copy the command", {
200200 lines: commands.length,
201201 })}
202 <p class="muted small">No data, secrets or variables come with it.</p>
202 <p class="muted small">Data, secrets and variables do not come with it.</p>
203203 </section>
204204 <section class="stack" id="pack-facts">
205205 <h2>What it brings</h2>
src/web/pages/pull.ts +2 −1
@@ -148,6 +148,7 @@ import {
148148 pullPage,
149149 wallCard,
150150 } from "../studio/change.ts";
151 import { emptyLine } from "../empty_words.ts";
151152
152153 /** Parse a "path~side~line" review anchor from a link or form field. */
153154 function parseAnchor(
@@ -1209,7 +1210,7 @@ export async function pullFilesPage(ctx: Ctx): Promise<Response> {
12091210 : [];
12101211 const commitsCard = card(
12111212 commits.length === 0
1212 ? html`<p class="muted small">No commits to show.</p>`
1213 ? emptyLine("commitsShown")
12131214 : html`<ul class="list">
12141215 ${commits.map(
12151216 (commit) =>
src/web/pages/reports.ts +2 −1
@@ -74,6 +74,7 @@ import { pageAddress } from "../studio/toolbar.ts";
7474 import { html, when, type Html } from "../html.ts";
7575 import { flashTo, page } from "../layout.ts";
7676 import { btn, field as formField, messageText, row, seg, time } from "../ui.ts";
77 import { emptyLine } from "../empty_words.ts";
7778
7879 /** The repository, when it takes reports: public, and so seen by anyone. */
7980 function publicRepo(ctx: Ctx): Repo | undefined {
@@ -575,7 +576,7 @@ export function securityPage(ctx: Ctx): Response {
575576 <p class="hint">The sealed reports labelled <code>security</code>, worst first, to fix or dismiss.</p>
576577 ${filterBar(base, filter)}
577578 ${groups.length === 0
578 ? html`<p class="muted small mt">No security reports match.</p>`
579 ? html`<div class="mt">${emptyLine("reportsMatch")}</div>`
579580 : groups.map(
580581 (g) => html`<section class="settings-block">
581582 <h2>${g.s} · ${String(g.items.length)}</h2>
src/web/pages/sources.ts +2 −1
@@ -36,6 +36,7 @@ import { btn, seg } from "../ui.ts";
3636 import { accountSections } from "./origins.ts";
3737 import { settingsPageResponse, timedAdminRepo } from "./settings.ts";
3838 import { getAppByRepo } from "../../core/apps.ts";
39 import { emptyLine } from "../empty_words.ts";
3940
4041 const CHART_W = 600;
4142 const CHART_H = 72;
@@ -230,7 +231,7 @@ export function sourcesBody(ctx: Ctx, q: Query, label: string): Html {
230231 </div>
231232 ${filters(q)}
232233 ${empties
233 ? html`<p class="muted">No visits recorded for ${label} in ${WINDOWS[q.window]} days.</p>`
234 ? emptyLine("visits", { subject: `${label} in ${WINDOWS[q.window]} days` })
234235 : html`${block(
235236 "Visits",
236237 html`<dl class="stats">
src/web/studio/explore.ts +2 −5
@@ -50,6 +50,7 @@ import { compact } from "../compact.ts";
5050 import { page, redirect } from "../layout.ts";
5151 import { heldCopy, pageTag } from "../page_tag.ts";
5252 import { btn, card, chartFrame, empty, nameMark, row as rowOf, seg, tabs, time } from "../ui.ts";
53 import { emptyList } from "../empty_words.ts";
5354
5455 const href = (query: ExploreQuery, page = 1): string => {
5556 const params = new URLSearchParams(exploreParams(query));
@@ -176,11 +177,7 @@ function terms(query: ExploreQuery): { term: string; without: ExploreQuery }[] {
176177 function emptyState(ctx: Ctx, query: ExploreQuery): Html {
177178 const line = exploreLine(query);
178179 if (query.template !== undefined)
179 return empty({
180 icon: "search",
181 title: `No forges to show for ${echoed(query.template)}`,
182 note: "Only admins can list forges started from a template.",
183 });
180 return emptyList("templateForges", { title: `No forges to show for ${echoed(query.template)}` });
184181 if (line !== "")
185182 return empty({
186183 icon: "search",
src/web/studio/hold.ts +1 −1
@@ -47,7 +47,7 @@ export function holdCard(
4747 () => html`<p class="muted small">Releases on green.</p>`,
4848 )}
4949 <p class="muted small">
50 No rule sends it to review or lands it until it is released. A person
50 Until it is released, no rule sends it to review or lands it. A person
5151 can still ship it.
5252 </p>
5353 ${when(
test/design-lint-ratchets.test.ts +5 −8
@@ -4,7 +4,7 @@
44 */
55 import { expect, test } from "bun:test";
66 import { ratchetFindings } from "../scripts/design-lint.ts";
7 import { OWN_WORDS, RATCHET_FIX, WIDTH_READS } from "../src/design/ratchets.ts";
7 import { RATCHET_FIX, WIDTH_READS } from "../src/design/ratchets.ts";
88
99 const page = "src/web/pages/packs.ts";
1010 const reader = "src/web/pages/map.ts";
@@ -12,20 +12,17 @@ const bareNo = (n: number) => Array.from({ length: n }, () => `<p class="small m
1212 const reads = (n: number) => Array.from({ length: n }, () => "const w = window.inner" + "Width;").join("\n");
1313
1414 test("one extra bare 'No …' and one extra width read are both named, with the fix", () => {
15 const web = [{ path: page, text: bareNo(OWN_WORDS[page]! + 1) }];
15 const web = [{ path: page, text: bareNo(1) }];
1616 const src = [{ path: reader, text: reads(WIDTH_READS[reader]! + 1) }];
1717 const found = ratchetFindings(web, src);
1818 expect(found).toEqual([
19 `${page}: 3 > 2 bare 'No …' empty states. ${RATCHET_FIX.ownWordsOver}`,
19 `${page}: 1 bare 'No …' empty state. ${RATCHET_FIX.ownWordsOver}`,
2020 `${reader}: 3 > 2 reads of a width in script. ${RATCHET_FIX.widthOver}`,
2121 ]);
2222 });
2323
24 test("a file at its count is quiet; one below is told to lower it", () => {
25 expect(ratchetFindings([{ path: page, text: bareNo(2) }], [{ path: reader, text: reads(2) }])).toEqual([]);
26 expect(ratchetFindings([{ path: page, text: bareNo(1) }], [])).toEqual([
27 `${page}: 1 < 2 bare 'No …' empty states. ${RATCHET_FIX.ownWordsMoved}`,
28 ]);
24 test("a width file at its count is quiet; no page may hold a bare 'No …'", () => {
25 expect(ratchetFindings([{ path: page, text: "" }], [{ path: reader, text: reads(2) }])).toEqual([]);
2926 });
3027
3128 test("a file nobody named may hold none", () => {
test/empty-notes.test.ts +2 −2
@@ -19,14 +19,14 @@ test("emptyNote draws the table's sentence in one muted paragraph", () => {
1919 expect(String(emptyNote("noChangeYet"))).toContain(NOTE_WORDS.noChangeYet);
2020 });
2121
22 // Pages that word their own empty note, by file: none opens with a bare "No" (the ratchet in

Non-blocking: the next line repeats this comment and still says to lower a count. Drop the older one.

23 // src/design/ratchets.ts holds that); these four carry a variable or a link, so they stay.
2224 // Pages that word their own empty note, by file. Move one onto NOTE_WORDS and lower its count.
2325 const OWN_WORDS: Readonly<Record<string, number>> = {
2426 "src/web/pages/next.ts": 1,
2527 "src/web/pages/now.ts": 1,
2628 "src/web/pages/waves.ts": 1,
27 "src/web/pages/sources.ts": 1,
2829 "src/web/pages/series.ts": 1,
29 "src/web/pages/contribute.ts": 1,
3030 };
3131
3232 test("the pages that still word their own empty note are the ones named, no more", async () => {
test/empty-words-all.test.ts +16 −14
@@ -6,8 +6,9 @@
66 * @tree-scan: walks all of src/web/ through tsSources (src/design/ratchets.ts).
77 */
88 import { expect, test } from "bun:test";
9 import { EMPTY_WORDS } from "../src/core/empty_words.ts";
10 import { ownWordsOff, RATCHET_FIX, tsSources } from "../src/design/ratchets.ts";
9 import { emptyLine } from "../src/web/empty_words.ts";
10 import { EMPTY_WORDS, emptyText } from "../src/core/empty_words.ts";
11 import { bareNoFindings, RATCHET_FIX, tsSources } from "../src/design/ratchets.ts";
1112
1213 // The form a page's own "No …" empty state takes, and the table of pages that still word one (a
1314 // ratchet: no more than its count, and the count exact), live in src/design/ratchets.ts, so
@@ -44,20 +45,21 @@ test("a link is a label and a place that exists; no default href points nowhere"
4445 }
4546 });
4647
47 test("a page does not word more bare 'No …' empty states than it is named for", () => {
48 expect(ownWordsOff(files).over).toEqual([]);
48 test("no page words a bare 'No …' empty state", () => {
49 expect(bareNoFindings(files)).toEqual([]);
4950 });
5051
51 test("a page that moved to the table is off the list of own words", () => {
52 expect(ownWordsOff(files).moved).toEqual([]);
52 test("a bare 'No …' in either form is named, with the fix", () => {
53 for (const text of ['<p class="muted">No rows</p>', 'empty({ title: "No rows" })', 'empty("No rows")', 'emptyLine("rows", { sentence: "No rows here." })', "emptyLine('rows', { sentence: `No rows on ${x}.` })"]) {
54 const found = bareNoFindings([{ path: "src/web/pages/new.ts", text }]);
55 expect(found).toEqual([`src/web/pages/new.ts: 1 bare 'No …' empty state. ${RATCHET_FIX.ownWordsOver}`]);
56 }
57 expect(bareNoFindings([{ path: "src/web/pages/new.ts", text: 'emptyList("rows")' }])).toEqual([]);
5358 });
5459
55 test("each own-words failure ends with the sentence that says which table or line to change", () => {
56 const over = ownWordsOff([{ path: "src/web/pages/new.ts", text: '<p class="muted">No rows</p>' }]).over;
57 const moved = ownWordsOff([{ path: "src/web/pages/packs.ts", text: "" }]).moved;
58 expect(over.length).toBe(1);
59 expect(over[0]!.endsWith(RATCHET_FIX.ownWordsOver)).toBe(true);
60 expect(moved.length).toBe(1);
61 expect(moved[0]!.endsWith(RATCHET_FIX.ownWordsMoved)).toBe(true);
62 expect(RATCHET_FIX.ownWordsMoved).toContain("moved to the table");
60 test("a `{}` in the table's words is filled by the page's subject, on the page and in the terminal", () => {
61 expect(emptyText("shots", "v1")).toBe("No screenshots on v1 yet.");
62 expect(String(emptyLine("visits", { subject: "v1 in 7 days" }))).toContain("No visits recorded for v1 in 7 days.");
63 expect(String(emptyLine("shots", { subject: "<b>", reason: "Wait." }))).toContain("No screenshots on &lt;b&gt; yet. Wait.");
64 expect(emptyText("welcomeIssues", "the “x” label")).toBe("No open issue carries the “x” label right now.");
6365 });
test/holds.test.ts +1 −1
@@ -709,7 +709,7 @@ describe("a hold is set, shown and lifted", () => {
709709 expect(after).toContain("holds this");
710710 expect(after).toContain(WHY);
711711 expect(after).toContain(
712 "No rule sends it to review or lands it until it is released",
712 "Until it is released, no rule sends it to review or lands it",
713713 );
714714 expect(after).toContain(
715715 `action="/alice/garden/pulls/${pull.number}/release"`,
test/packs.test.ts +1 −1
@@ -207,7 +207,7 @@ describe("pages", () => {
207207 expect(one.status).toBe(200);
208208 const body = await one.text();
209209 expect(body).toContain("scripts/pack.ts deploy games");
210 expect(body).toContain("No data, secrets or variables come with it.");
210 expect(body).toContain("Data, secrets and variables do not come with it.");
211211 expect(body).not.toContain("Help build these apps</h2>");
212212 expect(body).toContain("gabrielecirulli/2048");
213213 expect((await fetch(`${servers.url}/packs/nothing`)).status).toBe(404);
test/web-origins.test.ts +1 −1
@@ -674,7 +674,7 @@ describe("origins on the web", () => {
674674 expect(page).toContain(ghOauth.verificationUri);
675675 // The no-JavaScript half is on the page, and says so.
676676 expect(page).toContain("Check again");
677 expect(page).toContain("Refresh this page to check again");
677 expect(page).toContain("Without JavaScript, refresh this page to check again");
678678 // The device code itself never crosses to the browser.
679679 expect(page).not.toContain(ghOauth.deviceCode);
680680

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs