Bento, the office suite that fits in a file
TypeScript mit-licenseofficeoffice-365office-suiteoffice-toolsoffice365open-sourcepowerpointself-hostedsingle-page-appslidesslideshareslideshowslideshow-galleryslideshow-makerslideshows
spaces: a page can have a cover, and a view can be a gallery (#392)
nyblnetbeb5a19c57cd
diff --git a/scripts/test-spaces-model.ts b/scripts/test-spaces-model.tsindex d6744519..c22426db 100644--- a/scripts/test-spaces-model.ts+++ b/scripts/test-spaces-model.ts@@ -541,6 +541,129 @@ for (const [label, input, err] of [ok(/openAddProperty\(page\.id, addProp\)/.test(props), 'the properties panel offers it')}+// ---- a view is about a set of pages, and can be looked at as a table -------+// A view meant ONE thing: every page carrying a `status`. That made the tracker+// work and everything else impossible — no "the pages with an Author", no "the+// pages under Books", so a space could hold a backlog and never a reading list.+//+// ABSENT MEANS ISSUES. That is the compatibility rule, not a default: every+// view block written before `source` existed carries none and must keep showing+// the backlog forever, and a view set back to Issues must be byte-identical to+// one that never moved — the same rule `filter` already follows.+{+ const fs = await import('node:fs')+ const fields = fs.readFileSync(new URL('../spaces/src/fields.ts', import.meta.url), 'utf8')+ const render = fs.readFileSync(new URL('../spaces/src/render.ts', import.meta.url), 'utf8')+ const ed = fs.readFileSync(new URL('../spaces/src/editor.ts', import.meta.url), 'utf8')++ ok(/export function viewRows\(/.test(fields), 'a view selects its rows through one function')+ ok(/if \(!has && !under\) return issuesOf\(doc\)/.test(fields),+ '…and with no source it is still the backlog, so old view blocks are unchanged')+ ok(/viewRows\(doc, \(b as \{ source\?: unknown \}\)\.source\)/.test(render),+ 'the renderer asks for the block\'s own source rather than the issues')++ // The table is the shape a base is usually looked at in. Its columns must+ // come from the ROWS, not the vocabulary: a table of books carrying no+ // Estimate should not grow an Estimate column because the schema has one.+ ok(/layout === 'table'/.test(render), 'a view can be a table')+ ok(/rows\.some\(\(r\) => r\.values\.has\(k\)\)/.test(render),+ '…whose columns are the fields the rows actually carry')+ ok(/overflow-x/.test(fs.readFileSync(new URL('../spaces/src/styles.css', import.meta.url), 'utf8')+ .split('.sp-view-tablewrap')[1]?.slice(0, 120) ?? ''),+ '…and scrolls inside itself, so a wide table never scrolls the page sideways')++ // Cycling all the way round must leave the block as it started. The cycle+ // ends at GALLERY now, so it is the last shape that clears the key.+ ok(/gallery: undefined/.test(ed), 'cycling past the last layout clears the key rather than storing "board"')+}++// ---- a page has a cover, and a view can be a gallery -----------------------+// COVERS ARE THE ONE FIELD THAT WOULD TEMPT SOMEBODY INTO A URL, because that+// is how every hosted notes app stores one — and a URL in a document is a+// network request on open (PLATFORM §1), which `icon` already refuses in the+// same terms. So the refusal is not a comment: `coverSrc` is the ONE place that+// decides, and everything (the page, the gallery card) goes through it.+//+// The other half is that a cover is an asset reference that is NOT on a block,+// and every asset sweep in the app was written as a loop over blocks. Miss one+// and the failure is silent and specific: the readout calls every cover an+// orphan and offers to delete it, or a page grafted into another space arrives+// with a cover pointing at nothing.+{+ const fs = await import('node:fs')+ const { coverSrc, pageAssetKeys } = await import('../spaces/src/model.ts')+ const { orphanAssets } = await import('../spaces/src/assets.ts')++ // 1. ADDITIVITY: a build that predates the field round-trips it untouched,+ // and this build does not invent one.+ const withCover = parseDoc(doc({+ assets: { k1: 'data:image/png;base64,AAA' },+ pages: [{ id: 'p1', title: 'One', cover: 'asset:k1', blocks: [{ id: 'b1', type: 'p', html: 'hi' }] }],+ }))+ ok(withCover.ok === true, 'a page carrying a cover loads')+ const cd = (withCover as { doc: SpacesDoc }).doc+ ok(cd.pages[0].cover === 'asset:k1', '…and the cover survives the round trip')+ ok((cd.pages[1] ?? {}).cover === undefined && parseDoc(doc()).ok === true+ && ((parseDoc(doc()) as { doc: SpacesDoc }).doc.pages[0] as { cover?: unknown }).cover === undefined,+ '…and a page written before covers existed still has none')++ // 2. NEVER THE NETWORK. The field is KEPT (additivity) and renders nothing.+ ok(coverSrc({ id: 'x', title: '', blocks: [], cover: 'asset:k1' } as unknown as Page) === 'asset:k1',+ 'an asset cover renders')+ ok(coverSrc({ id: 'x', title: '', blocks: [], cover: 'data:image/png;base64,AAA' } as unknown as Page)+ === 'data:image/png;base64,AAA', 'an embedded cover renders')+ ok(coverSrc({ id: 'x', title: '', blocks: [], cover: 'https://example.com/a.jpg' } as unknown as Page) === '',+ 'a REMOTE cover renders nothing — opening a document never touches the network')+ ok(coverSrc({ id: 'x', title: '', blocks: [], cover: '/cover.jpg' } as unknown as Page) === '',+ '…and a relative path is remote too, because it is a real request on a static host')+ ok(coverSrc({ id: 'x', title: '', blocks: [] } as unknown as Page) === '', 'no cover, no picture')++ // 3. A COVER IS A USE. This is the assertion that catches the block-only loop.+ ok(pageAssetKeys(cd.pages[0]).join(',') === 'k1', 'a page reports the asset its cover holds')+ ok(orphanAssets(cd).length === 0,+ 'a cover\'s bytes are not an orphan — nothing else on the page points at them')+ const dropped = JSON.parse(JSON.stringify(cd)) as SpacesDoc+ delete (dropped.pages[0] as { cover?: unknown }).cover+ ok(orphanAssets(dropped).join(',') === 'k1', '…and they ARE one once the cover is removed')++ // 4. A COVER TRAVELS. Extract carries the bytes; graft remaps the key.+ const cut = extractSpace(cd, 'p1', { docId: 'doc-x', now: '2026-08-22T00:00:00.000Z' })+ ok((cut.doc.assets ?? {}).k1 !== undefined, 'a page extracted on its own takes its cover with it')+ const host = (parseDoc(doc({+ assets: { k1: 'data:image/png;base64,ZZZ' },+ pages: [{ id: 'h1', title: 'Host', blocks: [{ id: 'hb1', type: 'image', src: 'asset:k1' }] }],+ })) as { doc: SpacesDoc }).doc+ const plan = planGraft(host, JSON.parse(JSON.stringify(cut.doc)), {})+ const landed = plan.pages.find((p) => p.title === 'One')!+ ok(String(landed.cover).startsWith('asset:') && landed.cover !== 'asset:k1',+ 'a grafted cover follows its bytes to their new key — the host already had a DIFFERENT k1')+ ok(plan.assets[String(landed.cover).slice(6)] === 'data:image/png;base64,AAA',+ '…and the bytes it lands on are the ones it arrived with')++ // 5. THE GALLERY. The shape the covers exist for.+ const render = fs.readFileSync(new URL('../spaces/src/render.ts', import.meta.url), 'utf8')+ const ed2 = fs.readFileSync(new URL('../spaces/src/editor.ts', import.meta.url), 'utf8')+ const props2 = fs.readFileSync(new URL('../spaces/src/props.ts', import.meta.url), 'utf8')+ ok(/layout === 'gallery'/.test(render), 'a view can be a gallery')+ ok(/gallery: 'board'/.test(render) && /table: 'gallery'/.test(render),+ '…reachable from the one layout control, which cycles through it')+ ok(/resolveSrc\(coverSrc\(r\.page\), doc\)/.test(render),+ '…and a card asks coverSrc for the picture, so a remote cover is refused there too')+ ok(/sp-gcard-bare/.test(render),+ '…and a page with no cover gets a panel of its own rather than a hole')+ ok(/pickCover\(pageId: string\)/.test(ed2), 'a cover is chosen through the editor')+ // the METHOD's own body, not the file: `prepareImage` appears in four other+ // places, so a check that only proved the file mentions it would pass with a+ // cover picker that read the raw bytes and skipped the budget entirely+ const coverFn = ed2.slice(ed2.indexOf('private async pickCover'),+ ed2.indexOf('private removeCover'))+ ok(/prepareImage\(file\)/.test(coverFn) && /internAsset\(/.test(coverFn)+ && /IMAGE_EMBED_BUDGET/.test(coverFn),+ '…through the IMAGE pipeline: downscaled, content-addressed, and the same budget question')+ ok(/delete p\.cover/.test(ed2), 'removing a cover DELETES the key rather than storing an empty string')+ ok(/pickCover\(page\.id\)/.test(props2), 'the properties panel offers it, beside the icon')+}+// ---- a view is about a set of pages, and can be looked at as a table -------// A view meant ONE thing: every page carrying a `status`. That made the tracker// work and everything else impossible — no "the pages with an Author", no "the@@ -573,7 +696,54 @@ for (const [label, input, err] of ['…and scrolls inside itself, so a wide table never scrolls the page sideways')// Cycling all the way round must leave the block as it started.- ok(/table: undefined/.test(ed), 'cycling past table clears the key rather than storing "board"')+ ok(/gallery: undefined/.test(ed), 'cycling past the LAST layout clears the key rather than storing "board"')+}++// ---- a t() the extractor cannot SEE ----------------------------------------+// scripts/build-spaces-i18n.mjs sweeps t() call sites for LITERAL strings, plus+// one dedicated indirection (it reads `label:`/`hint:` out of blocks.ts, because+// the block menu renders them as `t(item.label)`). Anything else — most of all+// `t(SOME_MAP[key])` — compiles, runs, and reaches no catalog. The coverage+// figure cannot see it either: the packer builds its key list from what it+// swept, so eight locales report 100% while the control reads English.+//+// This class has cost three separate strings, two of them found by this check:+// · the panel's plural forms (caught before merge)+// · the view layout button — "Board", "List" and "Show as a list" were WRITTEN+// in de.ts and ABSENT from packed.ts: translations already done, dropped+// · FIELD_TYPE_LABEL — five of six property types (Select, Number, Date,+// Person, Labels) were in NO catalog at all+//+// SCOPE: map and property lookups, which is the shape that bites. A bare+// `t(param)` inside a helper is not flagged — its callers pass literals, which+// the sweep sees at the call site, and the second t() is a harmless miss that+// returns its argument.+{+ const fs = await import('node:fs')+ const srcDir = new URL('../spaces/src/', import.meta.url)+ const offenders: string[] = []+ for (const f of fs.readdirSync(srcDir).filter((n: string) => n.endsWith('.ts'))) {+ // COMMENTS ARE NOT CODE. The first draft of this check flagged its own+ // prose — two doc comments that quote `t(MAP[key])` while explaining why it+ // is wrong. A source scan that cannot tell code from a sentence about code+ // reports the documentation as the bug.+ const text = fs.readFileSync(new URL(f, srcDir), 'utf8')+ .replace(/\/\*[\s\S]*?\*\//g, '')+ .replace(/(^|[^:])\/\/[^\n]*/g, '$1')+ // t(NAME[...]) or t(NAME.prop) — a lookup whose result is displayed+ for (const [, expr] of text.matchAll(/\bt\(\s*([A-Za-z_$][\w$]*\s*(?:\[[^\]]*\]|\.[\w$]+))/g)) {+ const e = expr.trim()+ // THE ONE INDIRECTION THE EXTRACTOR IMPLEMENTS. It reads every `label:`+ // and `hint:` literal out of blocks.ts, so `x.label` / `x.hint` is swept+ // whatever the loop variable is called — spec, item, i. The BRACKET form+ // is what stays flagged, because that is the shape that has actually+ // shipped English three times.+ if (/\.(label|hint)$/.test(e)) continue+ offenders.push(`${f}: t(${e.slice(0, 40)})`)+ }+ }+ ok(offenders.length === 0,+ `no t() reads a map the extractor cannot sweep${offenders.length ? ' — ' + offenders.join(' | ') : ''}`)}// ---- find & replace: the number shown IS the number changed ----------------diff --git a/spaces/CHANGELOG.md b/spaces/CHANGELOG.mdindex 75612e93..11595dbc 100644--- a/spaces/CHANGELOG.md+++ b/spaces/CHANGELOG.md@@ -14,6 +14,33 @@ Versions follow `0.MINOR.PATCH` while pre-1.0.## [Unreleased]+- **Every displayed word reaches the catalogs.** The view layout button read+ English in all eight languages: it was written `t(LAYOUT_WORD[here])`, and the+ extractor sweeps LITERALS, so no catalog ever learned the strings existed —+ while the coverage figure said 100%, because it counts what it swept.+ "Board", "List" and "Show as a list" were sitting translated in the catalogs+ and being dropped. The same shape hid five of the six property-type names+ (Select, Number, Date, Person, Labels), which were in no catalog at all. Both+ now choose their words at the call site, and a rig check fails on any `t()`+ that reads a map the extractor cannot see.++- **Page covers, and a gallery to show them off.** A page can carry a picture+ across the top of it — chosen in the properties panel beside the icon, and+ the page's own icon rides up over its lower edge. A view has a fourth shape+ in the layout cycle: **Gallery**, a grid of cards showing each page's cover,+ its title and the values it carries. That is the shape that makes a reading+ list or a film log look like one rather than like a backlog.++ **A cover is never a URL.** `asset:` or `data:` only, for the same reason a+ page icon is one emoji and never an address: opening a document must not+ touch the network. A file that arrives carrying a remote cover keeps the+ field and shows no picture, and the validator says so. Covers go through the+ same pipeline an image block does — downscaled before they travel, stored+ once however many pages use them, the same question asked above 4MB.++ Additive: absent on every page written before this, and a card with no cover+ gets a tinted panel of its own carrying the page's icon.+- **A graph view.** ⋯ → *Graph* draws the space as its pages and the linksbetween them: every non-archived page is a node, sized by how connected itis, joined by an edge for every `[[wikilink]]` and for every parent/childdiff --git a/spaces/src/agent.ts b/spaces/src/agent.tsindex 01b36086..e2b412a7 100644--- a/spaces/src/agent.ts+++ b/spaces/src/agent.ts@@ -30,7 +30,7 @@// an undo entry that undoes nothing. Planning first also makes the whole write// path testable in node, where there is no store and no DOM.-import { type SpacesDoc, type Page, type Block, buildIndex, isRemote, newBlock, newPage, uid, descendantsOf, linkCard, commentsOn } from './model.ts'+import { type SpacesDoc, type Page, type Block, buildIndex, isRemote, newBlock, newPage, uid, descendantsOf, linkCard, commentsOn, pageAssetKeys } from './model.ts'import { SPECS, SPEC } from './blocks.ts'import { sanitizeInline, textOf, inertBody, esc, UNWRAP } from './sanitize.ts'import { orphanAssets, humanBytes } from './assets.ts'@@ -277,6 +277,27 @@ export function validateDoc(doc: SpacesDoc): ValidateResult {/** field keys already seen on THIS page — one value per field, per page */const propKeys = new Set<string>()+ // ---- the cover -------------------------------------------------------+ // A page's cover is the one asset reference that is not on a block, so it+ // needs saying here or every cover reads as an orphan below. And a REMOTE+ // one renders nothing at all — the field is kept (additivity), but silence+ // is the failure this report exists to break.+ const coverRef = typeof (p as { cover?: unknown }).cover === 'string'+ ? String((p as { cover?: unknown }).cover) : ''+ if (coverRef.startsWith('asset:')) {+ const key = coverRef.slice(6)+ usedAssets.add(key)+ if (!(key in assets)) {+ add({ page: p.id, code: 'missing-asset', severity: 'error', path: 'cover',+ message: `Page "${p.title}" has a cover referencing asset "${key}", which is not in doc.assets — no cover renders.`,+ fix: 'Add the data: URI to doc.assets under that key, or point cover at one that is there.' })+ }+ } else if (coverRef && isRemote(coverRef)) {+ add({ page: p.id, code: 'remote-cover', severity: 'warning', path: 'cover',+ message: `Page "${p.title}" has a remote cover (${coverRef.slice(0, 48)}), which is DROPPED at render — opening a space never contacts a third party.`,+ fix: 'Embed the bytes: put the data: URI in doc.assets and reference it as asset:<key>.' })+ }+if (!blocks.length) {// Not cosmetic: the editor's caret, gutter and / menu all hang off a// block, so a page with none cannot be typed into at all. The editor@@ -675,6 +696,8 @@ export function statsDoc(doc: SpacesDoc): StatsResult {}}}+ // the cover is a reference too, and one that is not on any block+ for (const k of pageAssetKeys(p)) use.set(k, (use.get(k) ?? 0) + 1)}for (const f of doc.fonts ?? []) use.set(f.asset, (use.get(f.asset) ?? 0) + 1)diff --git a/spaces/src/assets.ts b/spaces/src/assets.tsindex 272a53f7..7895c1bb 100644--- a/spaces/src/assets.ts+++ b/spaces/src/assets.ts@@ -7,7 +7,7 @@// the work: identical bytes are stored once, and a photo off a phone is// downscaled before it travels, visibly and reversibly.-import type { SpacesDoc } from './model'+import { pageAssetKeys, type SpacesDoc } from './model.ts'/** Longest edge kept when downscaling. Above this, detail is invisible in a* text column and costs megabytes. */@@ -88,6 +88,9 @@ export async function internAsset(doc: SpacesDoc, dataUri: string): Promise<striexport function orphanAssets(doc: SpacesDoc): string[] {const used = new Set<string>()for (const p of doc.pages) {+ // a page's COVER is a reference outside its blocks, and the only one. Miss+ // it and every cover reads as an orphan the readout offers to delete.+ for (const k of pageAssetKeys(p)) used.add(k)for (const b of p.blocks) {for (const v of [b.src, (b as Record<string, unknown>).poster]) {if (typeof v === 'string' && v.startsWith('asset:')) used.add(v.slice(6))diff --git a/spaces/src/editor.ts b/spaces/src/editor.tsindex a770ba6d..8a155b30 100644--- a/spaces/src/editor.ts+++ b/spaces/src/editor.ts@@ -26,7 +26,7 @@ import type { MarkTag } from './marks'import { MENU_SPECS, MD_SPECS, SPEC, CALLOUT_TONES } from './blocks'import {fieldByKey, fieldsOf, propHtml, propBlock, propBlockOf, isIssue, headerLength,- reorderPages, columnMoves, ISSUE_FIELDS, withField, freeFieldKey, FIELD_TYPE_LABEL,+ reorderPages, columnMoves, ISSUE_FIELDS, withField, freeFieldKey, fieldTypeLabel, FIELD_TYPES,cycleSort,type DropAim, type FieldSpec, type ViewFilter, type ViewSort,} from './fields'@@ -215,6 +215,8 @@ export class Editor {locked: () => this.store.readOnly || this.reading,repaint: () => this.paintPage(),pickPoster: (id) => void this.pickPoster(id),+ pickCover: (pageId) => void this.pickCover(pageId),+ removeCover: (pageId) => this.removeCover(pageId),pickMedia: (id) => void this.pickMedia(id),openIconPicker: (pageId, anchor) => this.openIconPicker(pageId, anchor),openAddProperty: (pageId, anchor) => this.openAddProperty(pageId, anchor),@@ -1853,11 +1855,21 @@ export class Editor {private toggleViewLayout(blockId: string): void {const b = this.store.block(blockId)const now = String((b as { layout?: unknown } | undefined)?.layout ?? 'board')- // Board -> list -> table -> board. `board` is the ABSENT key, never a- // stored 'board': a view cycled all the way round is byte-identical to one- // nobody ever touched, which is the same rule filter and source follow.- const next: Record<string, string | undefined> = { board: 'list', list: 'table', table: undefined }- this.editView(blockId, 'layout', next[now] ?? (now === 'table' ? undefined : 'list'))+ // Board -> list -> table -> gallery -> board. `board` is the ABSENT key,+ // never a stored 'board': a view cycled all the way round is byte-identical+ // to one nobody ever touched, which is the same rule filter and source+ // follow.+ const next: Record<string, string | undefined> = {+ board: 'list', list: 'table', table: 'gallery', gallery: undefined,+ }+ // A layout key from a NEWER build lands on the start of the cycle rather+ // than nowhere, so the control is never a button that does nothing.+ // Object.hasOwn, not a bare `in`: `'toString' in next` is TRUE and+ // next['toString'] is a native function, so a hand-authored+ // layout:"toString" rendered `function toString() { [native code] }` as the+ // button's label and stored a FUNCTION into the model. The same class this+ // file guards against in resolveSrc and pageMark.+ this.editView(blockId, 'layout', Object.hasOwn(next, now) ? next[now] : 'list')}/**@@ -3511,7 +3523,7 @@ export class Editor {if (spare.length) {pop.append(el('div', 'sp-pop-title', t('Add a property')))for (const f of spare) {- pop.append(this.menuItem('tag', f.label, t(FIELD_TYPE_LABEL[f.vt] ?? 'Text'), () => put(f)))+ pop.append(this.menuItem('tag', f.label, fieldTypeLabel(f.vt), () => put(f)))}}@@ -3523,10 +3535,10 @@ export class Editor {name.placeholder = t('Name')const type = document.createElement('select')type.className = 'sp-select'- for (const [vt, label] of Object.entries(FIELD_TYPE_LABEL)) {+ for (const vt of FIELD_TYPES) {const o = document.createElement('option')o.value = vt- o.textContent = t(label)+ o.textContent = fieldTypeLabel(vt)type.append(o)}type.value = 'text'@@ -4365,6 +4377,71 @@ export class Editor {input.click()}+ /**+ * The picture across the top of a page.+ *+ * The IMAGE pipeline, not a second one: prepareImage downscales a phone photo+ * before it travels, internAsset content-addresses the bytes so two pages+ * with the same cover store it once, and the same budget asks the same+ * question at the same size. A cover is the field most likely to be given a+ * 6MB photograph — inventing a separate policy for it is how one app ends up+ * with two answers to "how big is too big".+ */+ private async pickCover(pageId: string): Promise<void> {+ const input = document.createElement('input')+ input.type = 'file'+ input.accept = 'image/*'+ input.addEventListener('change', () => {+ const file = input.files?.[0]+ if (!file) return+ void (async () => {+ const s = this.store+ if (s.readOnly) return+ this.status(t('Reading image…'))+ let prepared+ try { prepared = await prepareImage(file) } catch {+ this.status(t('That file could not be read as an image')); return+ }+ if (prepared.dataUri.length > IMAGE_EMBED_BUDGET) {+ const okay = confirm(t(+ 'This image is {size} and travels inside the file, making it that much bigger for everyone you send it to. Embed it anyway?',+ { size: humanBytes(prepared.dataUri.length) },+ ))+ if (!okay) { this.status(''); return }+ }+ // hashed and interned BEFORE the commit, so the bytes and the reference+ // land in one synchronous mutation — one undo step, exactly as an image+ // block does it+ const ref = await internAsset(s.doc, prepared.dataUri)+ s.commit(() => {+ const p = s.index.page.get(pageId)+ if (p) p.cover = ref+ }, { scope: 'doc' })+ this.repaint()+ this.status(prepared.original+ ? t('Image added ({size})', { size: humanBytes(prepared.dataUri.length) })+ : t('Image added, resized to fit ({from} → {to})', {+ from: humanBytes(prepared.wasBytes), to: humanBytes(prepared.dataUri.length),+ }))+ })()+ })+ input.click()+ }++ /** No cover DELETES the key. A page whose cover was set and removed is+ * byte-identical to one that never had one. The bytes stay in the asset+ * table until nothing points at them — orphanAssets is what reports that,+ * and it counts covers. */+ private removeCover(pageId: string): void {+ const s = this.store+ if (s.readOnly) return+ s.commit(() => {+ const p = s.index.page.get(pageId)+ if (p) delete p.cover+ }, { scope: 'doc' })+ this.repaint()+ }+// ---- importing existing notes ---------------------------------------------/*** The way in.diff --git a/spaces/src/fields.ts b/spaces/src/fields.tsindex 2ec8c029..dfaa6b6c 100644--- a/spaces/src/fields.ts+++ b/spaces/src/fields.ts@@ -26,6 +26,10 @@// is. Keeping it in step with `value` is this file's job.import type { SpacesDoc, Page, Block } from './model'+// .ts extension: the model rig loads this file under node, whose resolver will+// not follow an extensionless import. Vite is unaffected — the same fix main+// already carries for i18n/packed.+import { t } from './i18n.ts'/** What a field holds. Deliberately few: every one costs an editor and a* permanent commitment, and a tracker needs exactly these. */@@ -36,15 +40,30 @@ export type FieldType = 'select' | 'person' | 'number' | 'date' | 'text' | 'labe* words and never translated; the labels are English source strings that t()* looks up at render time — never here, where they would freeze at import.*/-export const FIELD_TYPE_LABEL: Record<FieldType, string> = {- text: 'Text',- select: 'Select',- number: 'Number',- date: 'Date',- person: 'Person',- labels: 'Labels',+/**+ * What each type is called to somebody choosing one.+ *+ * A FUNCTION with literal t() calls, not a map of English read back through+ * `t(MAP[key])`. The extractor sweeps LITERALS, so the map version compiled,+ * ran, and put five of these six words in no catalog at all — measured: Select,+ * Number, Date, Person and Labels were absent from packed.ts while eight locales+ * reported 100%, because the packer counts what it swept. `t()` at call time,+ * never in a module-level const, which would freeze at import.+ */+export function fieldTypeLabel(vt: FieldType): string {+ switch (vt) {+ case 'select': return t('Select')+ case 'number': return t('Number')+ case 'date': return t('Date')+ case 'person': return t('Person')+ case 'labels': return t('Labels')+ default: return t('Text')+ }}+/** The types a new field can be, in the order the picker offers them. */+export const FIELD_TYPES: FieldType[] = ['text', 'select', 'number', 'date', 'person', 'labels']+export interface FieldOption {id: stringlabel: stringdiff --git a/spaces/src/i18n/de.ts b/spaces/src/i18n/de.tsindex d4d2ede0..29921266 100644--- a/spaces/src/i18n/de.ts+++ b/spaces/src/i18n/de.ts@@ -22,6 +22,7 @@ export const de: Catalog = {"A note, tip or warning": "Eine Notiz, ein Tipp oder eine Warnung","A page cannot contain itself": "Eine Seite kann sich nicht selbst enthalten","A password encrypts the document inside the file. There is no recovery — lose it and the space is gone.": "Ein Passwort verschlüsselt das Dokument in der Datei. Es gibt keine Wiederherstellung — verlierst du es, ist der Space weg.",+ "A picture across the top of this page": "Ein Bild am oberen Rand dieser Seite","A second file — the original is left alone": "Eine zweite Datei — das Original bleibt unberührt","A sort here is newer than this build and was not applied.": "Eine Sortierung dieser Ansicht ist neuer als diese Version und wurde nicht angewendet.","A space is never a dead end: the whole document is plain JSON in this file, and every page exports as Markdown.": "Ein Space ist nie eine Sackgasse: Das ganze Dokument ist reines JSON in dieser Datei, und jede Seite lässt sich als Markdown exportieren.",@@ -99,6 +100,7 @@ export const de: Catalog = {"Choose a space…": "Space auswählen…","Choose the field the columns come from": "Feld wählen, aus dem die Spalten kommen","Choose the order": "Reihenfolge wählen",+ "Choose…": "Auswählen…","Clear filter": "Filter zurücksetzen","Clear formatting": "Formatierung entfernen","Click a page to open it · drag to move · scroll to zoom": "Auf eine Seite klicken, um sie zu öffnen · ziehen zum Bewegen · scrollen zum Zoomen",@@ -130,6 +132,7 @@ export const de: Catalog = {"Could not verify an update, so nothing was changed.": "Ein Update ließ sich nicht verifizieren, daher wurde nichts geändert.","Couldn’t access the clipboard": "Zugriff auf die Zwischenablage nicht möglich","Couldn’t reach the live session": "Live-Sitzung nicht erreichbar",+ "Cover": "Titelbild","Create “{name}”": "„{name}“ erstellen","Dark": "Dunkel","Default": "Standard",@@ -618,4 +621,12 @@ export const de: Catalog = {"Pages nested under this one": "Seiten unterhalb dieser Seite","Pages that have this property": "Seiten mit dieser Eigenschaft","Which pages": "Welche Seiten",+ "Gallery": "Galerie",+ "Show as a gallery": "Als Galerie anzeigen",+ "Show as a table": "Als Tabelle anzeigen",+ "Select": "Auswahl",+ "Number": "Zahl",+ "Date": "Datum",+ "Person": "Person",+ "Labels": "Labels",}diff --git a/spaces/src/i18n/es.ts b/spaces/src/i18n/es.tsindex 49d8e687..772b824f 100644--- a/spaces/src/i18n/es.ts+++ b/spaces/src/i18n/es.ts@@ -22,6 +22,7 @@ export const es: Catalog = {"A note, tip or warning": "Una nota, un consejo o una advertencia","A page cannot contain itself": "Una página no puede contenerse a sí misma","A password encrypts the document inside the file. There is no recovery — lose it and the space is gone.": "Una contraseña cifra el documento dentro del archivo. No hay forma de recuperarla — si la pierdes, el espacio desaparece.",+ "A picture across the top of this page": "Una imagen en la parte superior de esta página","A second file — the original is left alone": "Un segundo archivo — el original queda intacto","A sort here is newer than this build and was not applied.": "Un orden de esta vista es más reciente que esta versión y no se ha aplicado.","A space is never a dead end: the whole document is plain JSON in this file, and every page exports as Markdown.": "Un espacio nunca es un callejón sin salida: todo el documento es JSON plano dentro de este archivo, y cada página se exporta como Markdown.",@@ -99,6 +100,7 @@ export const es: Catalog = {"Choose a space…": "Elegir un espacio…","Choose the field the columns come from": "Elige el campo del que salen las columnas","Choose the order": "Elige el orden",+ "Choose…": "Elegir…","Clear filter": "Borrar el filtro","Clear formatting": "Borrar formato","Click a page to open it · drag to move · scroll to zoom": "Haz clic en una página para abrirla · arrastra para mover · desplázate para acercar",@@ -130,6 +132,7 @@ export const es: Catalog = {"Could not verify an update, so nothing was changed.": "No se pudo verificar la actualización, así que no se cambió nada.","Couldn’t access the clipboard": "No se pudo acceder al portapapeles","Couldn’t reach the live session": "No se pudo contactar la sesión en vivo",+ "Cover": "Portada","Create “{name}”": "Crear «{name}»","Dark": "Oscuro","Default": "Predeterminado",@@ -618,4 +621,12 @@ export const es: Catalog = {"Pages nested under this one": "Páginas anidadas bajo esta","Pages that have this property": "Páginas que tienen esta propiedad","Which pages": "Qué páginas",+ "Gallery": "Galería",+ "Show as a gallery": "Mostrar como galería",+ "Show as a table": "Mostrar como tabla",+ "Select": "Selección",+ "Number": "Número",+ "Date": "Fecha",+ "Person": "Persona",+ "Labels": "Etiquetas",}diff --git a/spaces/src/i18n/fr.ts b/spaces/src/i18n/fr.tsindex 2a5d0243..a7042f28 100644--- a/spaces/src/i18n/fr.ts+++ b/spaces/src/i18n/fr.ts@@ -22,6 +22,7 @@ export const fr: Catalog = {"A note, tip or warning": "Une note, un conseil ou un avertissement","A page cannot contain itself": "Une page ne peut pas se contenir elle-même","A password encrypts the document inside the file. There is no recovery — lose it and the space is gone.": "Un mot de passe chiffre le document à l’intérieur du fichier. Il n’y a aucune récupération — perdez-le et l’espace est perdu.",+ "A picture across the top of this page": "Une image en haut de cette page","A second file — the original is left alone": "Un second fichier — l’original reste intact","A sort here is newer than this build and was not applied.": "Un tri de cette vue est plus récent que cette version et n’a pas été appliqué.","A space is never a dead end: the whole document is plain JSON in this file, and every page exports as Markdown.": "Un espace n’est jamais une impasse : tout le document est du JSON brut dans ce fichier, et chaque page s’exporte en Markdown.",@@ -99,6 +100,7 @@ export const fr: Catalog = {"Choose a space…": "Choisir un espace…","Choose the field the columns come from": "Choisir le champ dont viennent les colonnes","Choose the order": "Choisir l’ordre",+ "Choose…": "Choisir…","Clear filter": "Effacer le filtre","Clear formatting": "Effacer la mise en forme","Click a page to open it · drag to move · scroll to zoom": "Cliquez sur une page pour l’ouvrir · glissez pour déplacer · défilez pour zoomer",@@ -130,6 +132,7 @@ export const fr: Catalog = {"Could not verify an update, so nothing was changed.": "Impossible de vérifier une mise à jour, rien n’a été modifié.","Couldn’t access the clipboard": "Impossible d'accéder au presse-papiers","Couldn’t reach the live session": "Impossible de joindre la session live",+ "Cover": "Couverture","Create “{name}”": "Créer « {name} »","Dark": "Sombre","Default": "Par défaut",@@ -618,4 +621,12 @@ export const fr: Catalog = {"Pages nested under this one": "Pages imbriquées sous celle-ci","Pages that have this property": "Pages qui ont cette propriété","Which pages": "Quelles pages",+ "Gallery": "Galerie",+ "Show as a gallery": "Afficher en galerie",+ "Show as a table": "Afficher en tableau",+ "Select": "Sélection",+ "Number": "Nombre",+ "Date": "Date",+ "Person": "Personne",+ "Labels": "Étiquettes",}diff --git a/spaces/src/i18n/it.ts b/spaces/src/i18n/it.tsindex b7c96f27..a4f1c6af 100644--- a/spaces/src/i18n/it.ts+++ b/spaces/src/i18n/it.ts@@ -22,6 +22,7 @@ export const it: Catalog = {"A note, tip or warning": "Una nota, un consiglio o un avviso","A page cannot contain itself": "Una pagina non può contenere sé stessa","A password encrypts the document inside the file. There is no recovery — lose it and the space is gone.": "Una password cifra il documento dentro il file. Non c’è modo di recuperarla — se la perdi, lo spazio è perso.",+ "A picture across the top of this page": "Un'immagine in cima a questa pagina","A second file — the original is left alone": "Un secondo file — l’originale resta intatto","A sort here is newer than this build and was not applied.": "Un ordinamento di questa vista è più recente di questa versione e non è stato applicato.","A space is never a dead end: the whole document is plain JSON in this file, and every page exports as Markdown.": "Uno spazio non è mai un vicolo cieco: l’intero documento è JSON puro dentro questo file, e ogni pagina si esporta in Markdown.",@@ -99,6 +100,7 @@ export const it: Catalog = {"Choose a space…": "Scegli uno spazio…","Choose the field the columns come from": "Scegli il campo da cui nascono le colonne","Choose the order": "Scegli l’ordine",+ "Choose…": "Scegli…","Clear filter": "Azzera il filtro","Clear formatting": "Cancella formattazione","Click a page to open it · drag to move · scroll to zoom": "Fai clic su una pagina per aprirla · trascina per spostare · scorri per ingrandire",@@ -130,6 +132,7 @@ export const it: Catalog = {"Could not verify an update, so nothing was changed.": "Impossibile verificare l’aggiornamento, quindi non è stato modificato nulla.","Couldn’t access the clipboard": "Impossibile accedere agli appunti","Couldn’t reach the live session": "Impossibile raggiungere la sessione live",+ "Cover": "Copertina","Create “{name}”": "Crea «{name}»","Dark": "Scuro","Default": "Predefinito",@@ -618,4 +621,12 @@ export const it: Catalog = {"Pages nested under this one": "Pagine annidate sotto questa","Pages that have this property": "Pagine che hanno questa proprietà","Which pages": "Quali pagine",+ "Gallery": "Galleria",+ "Show as a gallery": "Mostra come galleria",+ "Show as a table": "Mostra come tabella",+ "Select": "Selezione",+ "Number": "Numero",+ "Date": "Data",+ "Person": "Persona",+ "Labels": "Etichette",}diff --git a/spaces/src/i18n/ja.ts b/spaces/src/i18n/ja.tsindex d65e47cf..89841877 100644--- a/spaces/src/i18n/ja.ts+++ b/spaces/src/i18n/ja.ts@@ -22,6 +22,7 @@ export const ja: Catalog = {"A note, tip or warning": "メモ・ヒント・注意","A page cannot contain itself": "ページを自分自身に入れることはできません","A password encrypts the document inside the file. There is no recovery — lose it and the space is gone.": "パスワードはファイル内のドキュメントを暗号化します。復元手段はありません — 忘れたらこのスペースは失われます。",+ "A picture across the top of this page": "このページ上部に表示する画像","A second file — the original is left alone": "2 つ目のファイル — 元のファイルはそのまま","A sort here is newer than this build and was not applied.": "このビューには、このバージョンより新しい並び順があり、適用されていません。","A space is never a dead end: the whole document is plain JSON in this file, and every page exports as Markdown.": "スペースは行き止まりになりません。ドキュメント全体はこのファイル内のプレーンな JSON で、どのページも Markdown に書き出せます。",@@ -99,6 +100,7 @@ export const ja: Catalog = {"Choose a space…": "スペースを選ぶ…","Choose the field the columns come from": "列のもとになるフィールドを選ぶ","Choose the order": "並び順を選ぶ",+ "Choose…": "選択…","Clear filter": "フィルターを解除","Clear formatting": "書式をクリア","Click a page to open it · drag to move · scroll to zoom": "ページをクリックで開く · ドラッグで移動 · スクロールで拡大縮小",@@ -130,6 +132,7 @@ export const ja: Catalog = {"Could not verify an update, so nothing was changed.": "更新を検証できなかったため、何も変更していません。","Couldn’t access the clipboard": "クリップボードにアクセスできませんでした","Couldn’t reach the live session": "ライブセッションに接続できませんでした",+ "Cover": "カバー","Create “{name}”": "「{name}」を作成","Dark": "ダーク","Default": "デフォルト",@@ -618,4 +621,12 @@ export const ja: Catalog = {"Pages nested under this one": "このページの下にあるページ","Pages that have this property": "このプロパティを持つページ","Which pages": "どのページ",+ "Gallery": "ギャラリー",+ "Show as a gallery": "ギャラリーで表示",+ "Show as a table": "テーブルで表示",+ "Select": "選択",+ "Number": "数値",+ "Date": "日付",+ "Person": "担当者",+ "Labels": "ラベル",}diff --git a/spaces/src/i18n/packed.ts b/spaces/src/i18n/packed.tsindex 0f7b1edc..2ed45fd6 100644--- a/spaces/src/i18n/packed.ts+++ b/spaces/src/i18n/packed.ts@@ -24,6 +24,7 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {"A note, tip or warning": ["メモ・ヒント・注意","注释、提示或警告","註記、提示或警告","Una nota, un consejo o una advertencia","Une note, un conseil ou un avertissement","Eine Notiz, ein Tipp oder eine Warnung","Una nota, un consiglio o un avviso","Uma nota, dica ou aviso"],"A page cannot contain itself": ["ページを自分自身に入れることはできません","页面不能包含自身","頁面不能包含自己","Una página no puede contenerse a sí misma","Une page ne peut pas se contenir elle-même","Eine Seite kann sich nicht selbst enthalten","Una pagina non può contenere sé stessa","Uma página não pode conter-se a si própria"],"A password encrypts the document inside the file. There is no recovery — lose it and the space is gone.": ["パスワードはファイル内のドキュメントを暗号化します。復元手段はありません — 忘れたらこのスペースは失われます。","密码会加密文件内的文档。没有任何找回方式 — 密码丢了,空间就没了。","密碼會加密檔案內的文件。沒有任何復原方式 — 密碼一旦遺失,這個空間就沒了。","Una contraseña cifra el documento dentro del archivo. No hay forma de recuperarla — si la pierdes, el espacio desaparece.","Un mot de passe chiffre le document à l’intérieur du fichier. Il n’y a aucune récupération — perdez-le et l’espace est perdu.","Ein Passwort verschlüsselt das Dokument in der Datei. Es gibt keine Wiederherstellung — verlierst du es, ist der Space weg.","Una password cifra il documento dentro il file. Non c’è modo di recuperarla — se la perdi, lo spazio è perso.","Uma palavra-passe encripta o documento dentro do ficheiro. Não há recuperação — se a perder, o espaço desaparece."],+ "A picture across the top of this page": ["このページ上部に表示する画像","显示在此页面顶部的图片","顯示在此頁面頂部的圖片","Una imagen en la parte superior de esta página","Une image en haut de cette page","Ein Bild am oberen Rand dieser Seite","Un'immagine in cima a questa pagina","Uma imagem no topo desta página"],"A second file — the original is left alone": ["2 つ目のファイル — 元のファイルはそのまま","另存一个新文件 — 原文件不动","第二個檔案 — 原檔案不受影響","Un segundo archivo — el original queda intacto","Un second fichier — l’original reste intact","Eine zweite Datei — das Original bleibt unberührt","Un secondo file — l’originale resta intatto","Um segundo ficheiro — o original fica intacto"],"A sort here is newer than this build and was not applied.": ["このビューには、このバージョンより新しい並び順があり、適用されていません。","此视图中有比当前版本更新的排序方式,未被应用。","此檢視中有比目前版本更新的排序方式,未被套用。","Un orden de esta vista es más reciente que esta versión y no se ha aplicado.","Un tri de cette vue est plus récent que cette version et n’a pas été appliqué.","Eine Sortierung dieser Ansicht ist neuer als diese Version und wurde nicht angewendet.","Un ordinamento di questa vista è più recente di questa versione e non è stato applicato.","Uma ordenação desta vista é mais recente do que esta versão e não foi aplicada."],"A space is never a dead end: the whole document is plain JSON in this file, and every page exports as Markdown.": ["スペースは行き止まりになりません。ドキュメント全体はこのファイル内のプレーンな JSON で、どのページも Markdown に書き出せます。","空间绝不是死胡同:整个文档就是这个文件里的纯 JSON,每个页面都能导出为 Markdown。","空間永遠不會是死路:整份文件就是此檔案中的純 JSON,每個頁面也都能匯出成 Markdown。","Un espacio nunca es un callejón sin salida: todo el documento es JSON plano dentro de este archivo, y cada página se exporta como Markdown.","Un espace n’est jamais une impasse : tout le document est du JSON brut dans ce fichier, et chaque page s’exporte en Markdown.","Ein Space ist nie eine Sackgasse: Das ganze Dokument ist reines JSON in dieser Datei, und jede Seite lässt sich als Markdown exportieren.","Uno spazio non è mai un vicolo cieco: l’intero documento è JSON puro dentro questo file, e ogni pagina si esporta in Markdown.","Um espaço nunca é um beco sem saída: todo o documento é JSON simples dentro deste ficheiro e todas as páginas se exportam para Markdown."],@@ -69,6 +70,7 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {"Block options": ["ブロックのオプション","块选项","區塊選項","Opciones del bloque","Options du bloc","Block-Optionen","Opzioni del blocco","Opções do bloco"],"Blocks": ["ブロック","块","區塊","Bloques","Blocs","Blöcke","Blocchi","Blocos"],"Blue": ["青","蓝色","藍色","Azul","Bleu","Blau","Blu","Azul"],+ "Board": ["ボード","看板","看板","Tablero","Tableau","Board","Bacheca","Quadro"],"Board or list": ["ボードまたはリスト","看板或列表","看板或清單","Tablero o lista","Tableau ou liste","Board oder Liste","Bacheca o elenco","Quadro ou lista"],"Bold": ["ボールド","粗体","粗體","Negrita","Gras","Fett","Grassetto","Negrito"],"Bold — ⌘B": ["ボールド — ⌘B","粗体 — ⌘B","粗體 — ⌘B","Negrita — ⌘B","Gras — ⌘B","Fett — ⌘B","Grassetto — ⌘B","Negrito — ⌘B"],@@ -103,6 +105,7 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {"Choose the field the columns come from": ["列のもとになるフィールドを選ぶ","选择用作分栏的字段","選擇作為欄的欄位","Elige el campo del que salen las columnas","Choisir le champ dont viennent les colonnes","Feld wählen, aus dem die Spalten kommen","Scegli il campo da cui nascono le colonne","Escolha o campo de onde vêm as colunas"],"Choose the order": ["並び順を選ぶ","选择排序方式","選擇排序方式","Elige el orden","Choisir l’ordre","Reihenfolge wählen","Scegli l’ordine","Escolha a ordem"],"Choose which pages this view holds": ["このビューに入れるページを選ぶ","选择此视图包含哪些页面","選擇此檢視包含哪些頁面","Elige qué páginas contiene esta vista","Choisir les pages que contient cette vue","Wählen, welche Seiten diese Ansicht enthält","Scegli quali pagine contiene questa vista","Escolhe que páginas esta vista contém"],+ "Choose…": ["選択…","选择…","選擇…","Elegir…","Choisir…","Auswählen…","Scegli…","Escolher…"],"Clear filter": ["フィルターを解除","清除筛选","清除篩選","Borrar el filtro","Effacer le filtre","Filter zurücksetzen","Azzera il filtro","Limpar o filtro"],"Clear formatting": ["書式をクリア","清除格式","清除格式","Borrar formato","Effacer la mise en forme","Formatierung entfernen","Cancella formattazione","Limpar formatação"],"Click a page to open it · drag to move · scroll to zoom": ["ページをクリックで開く · ドラッグで移動 · スクロールで拡大縮小","点击页面即可打开 · 拖动移动 · 滚动缩放","點擊頁面即可開啟 · 拖曳移動 · 捲動縮放","Haz clic en una página para abrirla · arrastra para mover · desplázate para acercar","Cliquez sur une page pour l’ouvrir · glissez pour déplacer · défilez pour zoomer","Auf eine Seite klicken, um sie zu öffnen · ziehen zum Bewegen · scrollen zum Zoomen","Fai clic su una pagina per aprirla · trascina per spostare · scorri per ingrandire","Clica numa página para a abrir · arrasta para mover · desloca para ampliar"],@@ -132,8 +135,10 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {"Could not reach the update channel.": ["更新チャンネルに接続できませんでした。","无法连接更新通道。","無法連線到更新來源。","No se pudo contactar con el canal de actualizaciones.","Impossible de joindre le canal de mise à jour.","Der Update-Kanal war nicht erreichbar.","Impossibile raggiungere il canale degli aggiornamenti.","Não foi possível contactar o canal de atualizações."],"Couldn’t access the clipboard": ["クリップボードにアクセスできませんでした","无法访问剪贴板","無法存取剪貼簿","No se pudo acceder al portapapeles","Impossible d'accéder au presse-papiers","Zugriff auf die Zwischenablage nicht möglich","Impossibile accedere agli appunti","Não foi possível acessar a área de transferência"],"Couldn’t reach the live session": ["ライブセッションに接続できませんでした","无法连接实时会话","無法連線即時會話","No se pudo contactar la sesión en vivo","Impossible de joindre la session live","Live-Sitzung nicht erreichbar","Impossibile raggiungere la sessione live","Não foi possível alcançar a sessão ao vivo"],+ "Cover": ["カバー","封面","封面","Portada","Couverture","Titelbild","Copertina","Capa"],"Create “{name}”": ["「{name}」を作成","创建“{name}”","建立「{name}」","Crear «{name}»","Créer « {name} »","„{name}“ erstellen","Crea «{name}»","Criar “{name}”"],"Dark": ["ダーク","深色","深色","Oscuro","Sombre","Dunkel","Scuro","Escuro"],+ "Date": ["日付","日期","日期","Fecha","Date","Datum","Data","Data"],"Default": ["デフォルト","默认","預設","Predeterminado","Par défaut","Standard","Predefinito","Padrão"],"Delete": ["削除","删除","刪除","Eliminar","Supprimer","Löschen","Elimina","Eliminar"],"Delete “{name}”?": ["「{name}」を削除しますか?","要删除“{name}”吗?","要刪除「{name}」嗎?","¿Eliminar «{name}»?","Supprimer « {name} » ?","„{name}“ löschen?","Eliminare «{name}»?","Eliminar “{name}”?"],@@ -191,6 +196,7 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {"Following — view only": ["追従中 — 閲覧のみ","跟随中 — 仅供查看","跟隨中 — 僅供檢視","Siguiendo — solo lectura","Suivi en cours — lecture seule","Folgt mit — nur Ansicht","In ascolto — sola lettura","Acompanhando — somente visualização"],"Formatting": ["書式","格式","格式","Formato","Mise en forme","Formatierung","Formattazione","Formatação"],"Full width": ["全幅","全宽","全寬","Ancho completo","Pleine largeur","Volle Breite","Larghezza piena","Largura total"],+ "Gallery": ["ギャラリー","图库","圖庫","Galería","Galerie","Galerie","Galleria","Galeria"],"Getting around": ["移動","导航","導覽","Moverse","Se déplacer","Navigieren","Spostarsi","Navegar"],"Graph": ["グラフ","关系图","關係圖","Grafo","Graphe","Graph","Grafo","Grafo"],"Gray": ["グレー","灰色","灰色","Gris","Gris","Grau","Grigio","Cinza"],@@ -235,6 +241,7 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {"Journal date": ["ジャーナルの日付","日志日期","日誌日期","Fecha del diario","Date du journal","Journaldatum","Data del diario","Data do diário"],"Key-verified identity": ["鍵で検証済みのアイデンティティ","密钥验证的身份","金鑰驗證的身份","Identidad verificada por clave","Identité vérifiée par clé","Schlüssel-verifizierte Identität","Identità verificata da chiave","Identidade verificada por chave"],"Keyboard shortcuts": ["キーボードショートカット","键盘快捷键","鍵盤快速鍵","Atajos de teclado","Raccourcis clavier","Tastaturkürzel","Scorciatoie da tastiera","Atalhos de teclado"],+ "Labels": ["ラベル","标签","標籤","Etiquetas","Étiquettes","Labels","Etichette","Etiquetas"],"Language": ["言語","语言","語言","Idioma","Langue","Sprache","Lingua","Idioma"],"Language follows whoever opens the file. It is never written into the document.": ["言語はファイルを開いた人に従います。ドキュメントには書き込まれません。","语言跟随打开文件的人,绝不会写入文档。","語言取決於開啟檔案的人,永遠不會寫入文件中。","El idioma sigue a quien abre el archivo. Nunca se escribe en el documento.","La langue suit la personne qui ouvre le fichier. Elle n’est jamais écrite dans le document.","Die Sprache richtet sich danach, wer die Datei öffnet. Sie wird nie ins Dokument geschrieben.","La lingua segue chi apre il file. Non viene mai scritta nel documento.","O idioma segue quem abre o ficheiro. Nunca é escrito no documento."],"Language — what this block is highlighted as": ["言語 — このブロックを何として色分けするか","语言 — 这个块按什么语言着色","語言 — 這個區塊以什麼語言上色","Lenguaje — cómo se colorea este bloque","Langage — la coloration de ce bloc","Sprache — wie dieser Block hervorgehoben wird","Linguaggio — come viene evidenziato questo blocco","Linguagem — como este bloco é realçado"],@@ -254,6 +261,7 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {"Linked": ["リンク","链接","連結","Enlazado","Lié","Verknüpft","Collegata","Externo"],"Linked from": ["リンク元","链接来源","連結來源","Enlazado desde","Liens entrants","Verlinkt von","Collegata da","Ligado a partir de"],"Links to it become dead": ["このページへのリンクが切れます","指向它的链接会失效","指向它的連結會失效","Los enlaces a ella dejan de funcionar","Les liens vers elle seront rompus","Links darauf laufen ins Leere","I collegamenti a questa pagina si interrompono","As ligações para ela ficam quebradas"],+ "List": ["リスト","列表","清單","Lista","Liste","Liste","Elenco","Lista"],"Live": ["ライブ","已连接","已連線","En vivo","En direct","Live","Dal vivo","Ao vivo"],"Live — nobody else is here yet": ["ライブ中 — まだほかに誰もいません","实时协作中 — 还没有其他人","即時協作中 — 還沒有其他人","En directo — todavía no hay nadie más","En direct — personne d’autre pour l’instant","Live — noch niemand sonst da","In diretta — non c’è ancora nessun altro","Ao vivo — ainda não há mais ninguém"],"Live — send someone the file to bring them in": ["ライブ中 — ファイルを送れば参加できます","实时协作中 — 把文件发给别人即可加入","即時協作中 — 把檔案傳給別人即可加入","En directo — envía el archivo a alguien para que entre","En direct — envoyez le fichier à quelqu’un pour qu’il rejoigne","Live — schick jemandem die Datei, dann ist er dabei","In diretta — manda il file a qualcuno per farlo entrare","Ao vivo — envie o ficheiro a alguém para essa pessoa entrar"],@@ -298,6 +306,7 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {"Nothing on this canvas yet.": ["このキャンバスにはまだ何もありません。","此画布上还没有内容。","此畫布上還沒有內容。","Aún no hay nada en este lienzo.","Rien sur ce canevas pour l’instant.","Auf dieser Leinwand ist noch nichts.","Non c’è ancora nulla su questa tela.","Ainda não há nada nesta tela."],"Nothing to draw yet — link two pages with [[ and they will appear here.": ["まだ描くものがありません — [[ で 2 つのページをつなぐと、ここに現れます。","还没有可绘制的内容 — 用 [[ 链接两个页面,它们就会出现在这里。","還沒有可繪製的內容 — 用 [[ 連結兩個頁面,它們就會出現在這裡。","Todavía no hay nada que dibujar — enlaza dos páginas con [[ y aparecerán aquí.","Rien à dessiner pour l’instant — reliez deux pages avec [[ et elles apparaîtront ici.","Noch nichts zu zeichnen — verknüpfe zwei Seiten mit [[ und sie erscheinen hier.","Non c’è ancora nulla da disegnare — collega due pagine con [[ e appariranno qui.","Ainda não há nada para desenhar — liga duas páginas com [[ e aparecerão aqui."],"Now an issue": ["イシューになりました","现在是事项了","現在是項目了","Ahora es una incidencia","C’est désormais un ticket","Jetzt ein Issue","Ora è una issue","Agora é uma tarefa"],+ "Number": ["数値","数字","數字","Número","Nombre","Zahl","Numero","Número"],"Numbered list": ["番号付きリスト","编号列表","編號清單","Lista numerada","Liste numérotée","Nummerierte Liste","Elenco numerato","Lista numerada"],"Off by default — they were archived for a reason": ["既定ではオフ — アーカイブしたのには理由があります","默认关闭 — 当初归档总是有原因的","預設關閉 — 它們被封存是有原因的","Desactivado por defecto — por algo se archivaron","Désactivé par défaut — elles ont été archivées pour une raison","Standardmäßig aus — sie wurden aus einem Grund archiviert","Disattivo per impostazione predefinita — sono state archiviate per un motivo","Desativado por predefinição — foram arquivadas por alguma razão"],"Offline mode is on — nothing leaves this computer.": ["オフラインモードがオンです — このコンピュータから何も送信されません。","离线模式已开启 — 任何数据都不会离开这台电脑。","離線模式已開啟 — 任何資料都不會離開這台電腦。","El modo sin conexión está activo: nada sale de este equipo.","Le mode hors ligne est activé — rien ne quitte cet ordinateur.","Der Offline-Modus ist aktiv — nichts verlässt diesen Computer.","La modalità offline è attiva: nulla lascia questo computer.","O modo offline está ativado — nada sai deste computador."],@@ -328,6 +337,7 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {"Paste document JSON here…": ["ここにドキュメント JSON を貼り付け…","在此粘贴文档 JSON…","在此貼上文件 JSON…","Pega aquí el JSON del documento…","Collez le JSON du document ici…","Dokument-JSON hier einfügen…","Incolla qui il JSON del documento…","Cole aqui o JSON do documento…"],"Paste or type a link": ["リンクを貼り付けるか入力してください","粘贴或输入链接","貼上或輸入連結","Pega o escribe un enlace","Collez ou saisissez un lien","Link einfügen oder eingeben","Incolla o scrivi un collegamento","Cole ou digite um link"],"People in this space": ["このスペースにいる人","此空间中的人","此空間中的人","Personas en este espacio","Personnes dans cet espace","Personen in diesem Space","Persone in questo spazio","Pessoas neste espaço"],+ "Person": ["担当者","人员","人員","Persona","Personne","Person","Persona","Pessoa"],"Picture": ["画像","图片","圖片","Imagen","Image","Bild","Immagine","Imagem"],"Picture…": ["画像…","图片…","圖片…","Imagen…","Image…","Bild…","Immagine…","Imagem…"],"Pink": ["ピンク","粉色","粉紅色","Rosa","Rose","Rosa","Rosa","Rosa"],@@ -402,8 +412,13 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {"Search all pages, with nothing selected": ["何も選択せずに全ページを検索","未选中内容时,搜索所有页面","未選取內容時,搜尋所有頁面","Buscar en todas las páginas, sin nada seleccionado","Rechercher dans toutes les pages, sans sélection","Alle Seiten durchsuchen, wenn nichts markiert ist","Cerca in tutte le pagine, senza nulla selezionato","Pesquisar todas as páginas, sem nada selecionado"],"Search all pages…": ["全ページを検索…","搜索所有页面…","搜尋所有頁面…","Buscar en todas las páginas…","Rechercher dans toutes les pages…","Alle Seiten durchsuchen…","Cerca in tutte le pagine…","Pesquisar em todas as páginas…"],"Search this space": ["このスペースを検索","搜索此空间","搜尋此空間","Buscar en este espacio","Rechercher dans cet espace","Diesen Space durchsuchen","Cerca in questo spazio","Pesquisar neste espaço"],+ "Select": ["選択","单选","單選","Selección","Sélection","Auswahl","Selezione","Seleção"],"Set a password…": ["パスワードを設定…","设置密码…","設定密碼…","Establecer una contraseña…","Définir un mot de passe…","Passwort festlegen…","Imposta una password…","Definir uma palavra-passe…"],"Share this space": ["このスペースを共有","共享此空间","分享此空間","Compartir este espacio","Partager cet espace","Diesen Space teilen","Condividi questo spazio","Partilhar este espaço"],+ "Show as a board": ["ボードで表示","以看板显示","以看板顯示","Mostrar como tablero","Afficher en tableau","Als Board anzeigen","Mostra come bacheca","Mostrar como quadro"],+ "Show as a gallery": ["ギャラリーで表示","以图库显示","以圖庫顯示","Mostrar como galería","Afficher en galerie","Als Galerie anzeigen","Mostra come galleria","Mostrar como galeria"],+ "Show as a list": ["リストで表示","以列表显示","以清單顯示","Mostrar como lista","Afficher en liste","Als Liste anzeigen","Mostra come elenco","Mostrar como lista"],+ "Show as a table": ["テーブルで表示","以表格显示","以表格顯示","Mostrar como tabla","Afficher en tableau","Als Tabelle anzeigen","Mostra come tabella","Mostrar como tabela"],"Show or hide properties": ["プロパティの表示・非表示","显示或隐藏属性","顯示或隱藏屬性","Mostrar u ocultar las propiedades","Afficher ou masquer les propriétés","Eigenschaften ein- oder ausblenden","Mostra o nascondi le proprietà","Mostrar ou ocultar as propriedades"],"Show or hide the page list": ["ページ一覧の表示・非表示","显示或隐藏页面列表","顯示或隱藏頁面清單","Mostrar u ocultar la lista de páginas","Afficher ou masquer la liste des pages","Seitenliste ein- oder ausblenden","Mostra o nascondi l’elenco delle pagine","Mostrar ou ocultar a lista de páginas"],"Show playback controls to the reader": ["読み手に再生コントロールを表示する","向读者显示播放控件","向讀者顯示播放控制項","Mostrar los controles de reproducción a quien lee","Afficher les contrôles de lecture au lecteur","Wiedergabesteuerung für Lesende anzeigen","Mostra i controlli di riproduzione a chi legge","Mostrar os controlos de reprodução a quem lê"],diff --git a/spaces/src/i18n/pt.ts b/spaces/src/i18n/pt.tsindex 2f39d430..0e26b5a6 100644--- a/spaces/src/i18n/pt.ts+++ b/spaces/src/i18n/pt.ts@@ -22,6 +22,7 @@ export const pt: Catalog = {"A note, tip or warning": "Uma nota, dica ou aviso","A page cannot contain itself": "Uma página não pode conter-se a si própria","A password encrypts the document inside the file. There is no recovery — lose it and the space is gone.": "Uma palavra-passe encripta o documento dentro do ficheiro. Não há recuperação — se a perder, o espaço desaparece.",+ "A picture across the top of this page": "Uma imagem no topo desta página","A second file — the original is left alone": "Um segundo ficheiro — o original fica intacto","A sort here is newer than this build and was not applied.": "Uma ordenação desta vista é mais recente do que esta versão e não foi aplicada.","A space is never a dead end: the whole document is plain JSON in this file, and every page exports as Markdown.": "Um espaço nunca é um beco sem saída: todo o documento é JSON simples dentro deste ficheiro e todas as páginas se exportam para Markdown.",@@ -99,6 +100,7 @@ export const pt: Catalog = {"Choose a space…": "Escolher um espaço…","Choose the field the columns come from": "Escolha o campo de onde vêm as colunas","Choose the order": "Escolha a ordem",+ "Choose…": "Escolher…","Clear filter": "Limpar o filtro","Clear formatting": "Limpar formatação","Click a page to open it · drag to move · scroll to zoom": "Clica numa página para a abrir · arrasta para mover · desloca para ampliar",@@ -130,6 +132,7 @@ export const pt: Catalog = {"Could not verify an update, so nothing was changed.": "Não foi possível verificar a atualização, por isso nada foi alterado.","Couldn’t access the clipboard": "Não foi possível acessar a área de transferência","Couldn’t reach the live session": "Não foi possível alcançar a sessão ao vivo",+ "Cover": "Capa","Create “{name}”": "Criar “{name}”","Dark": "Escuro","Default": "Padrão",@@ -618,4 +621,12 @@ export const pt: Catalog = {"Pages nested under this one": "Páginas aninhadas sob esta","Pages that have this property": "Páginas que têm esta propriedade","Which pages": "Que páginas",+ "Gallery": "Galeria",+ "Show as a gallery": "Mostrar como galeria",+ "Show as a table": "Mostrar como tabela",+ "Select": "Seleção",+ "Number": "Número",+ "Date": "Data",+ "Person": "Pessoa",+ "Labels": "Etiquetas",}diff --git a/spaces/src/i18n/zh-Hans.ts b/spaces/src/i18n/zh-Hans.tsindex e6d12819..f97f50a2 100644--- a/spaces/src/i18n/zh-Hans.ts+++ b/spaces/src/i18n/zh-Hans.ts@@ -22,6 +22,7 @@ export const zh_Hans: Catalog = {"A note, tip or warning": "注释、提示或警告","A page cannot contain itself": "页面不能包含自身","A password encrypts the document inside the file. There is no recovery — lose it and the space is gone.": "密码会加密文件内的文档。没有任何找回方式 — 密码丢了,空间就没了。",+ "A picture across the top of this page": "显示在此页面顶部的图片","A second file — the original is left alone": "另存一个新文件 — 原文件不动","A sort here is newer than this build and was not applied.": "此视图中有比当前版本更新的排序方式,未被应用。","A space is never a dead end: the whole document is plain JSON in this file, and every page exports as Markdown.": "空间绝不是死胡同:整个文档就是这个文件里的纯 JSON,每个页面都能导出为 Markdown。",@@ -99,6 +100,7 @@ export const zh_Hans: Catalog = {"Choose a space…": "选择一个空间…","Choose the field the columns come from": "选择用作分栏的字段","Choose the order": "选择排序方式",+ "Choose…": "选择…","Clear filter": "清除筛选","Clear formatting": "清除格式","Click a page to open it · drag to move · scroll to zoom": "点击页面即可打开 · 拖动移动 · 滚动缩放",@@ -130,6 +132,7 @@ export const zh_Hans: Catalog = {"Could not verify an update, so nothing was changed.": "无法验证更新,因此未做任何改动。","Couldn’t access the clipboard": "无法访问剪贴板","Couldn’t reach the live session": "无法连接实时会话",+ "Cover": "封面","Create “{name}”": "创建“{name}”","Dark": "深色","Default": "默认",@@ -618,4 +621,12 @@ export const zh_Hans: Catalog = {"Pages nested under this one": "嵌套在此页面下的页面","Pages that have this property": "具有此属性的页面","Which pages": "哪些页面",+ "Gallery": "图库",+ "Show as a gallery": "以图库显示",+ "Show as a table": "以表格显示",+ "Select": "单选",+ "Number": "数字",+ "Date": "日期",+ "Person": "人员",+ "Labels": "标签",}diff --git a/spaces/src/i18n/zh-Hant.ts b/spaces/src/i18n/zh-Hant.tsindex b2915573..85526d58 100644--- a/spaces/src/i18n/zh-Hant.ts+++ b/spaces/src/i18n/zh-Hant.ts@@ -22,6 +22,7 @@ export const zh_Hant: Catalog = {"A note, tip or warning": "註記、提示或警告","A page cannot contain itself": "頁面不能包含自己","A password encrypts the document inside the file. There is no recovery — lose it and the space is gone.": "密碼會加密檔案內的文件。沒有任何復原方式 — 密碼一旦遺失,這個空間就沒了。",+ "A picture across the top of this page": "顯示在此頁面頂部的圖片","A second file — the original is left alone": "第二個檔案 — 原檔案不受影響","A sort here is newer than this build and was not applied.": "此檢視中有比目前版本更新的排序方式,未被套用。","A space is never a dead end: the whole document is plain JSON in this file, and every page exports as Markdown.": "空間永遠不會是死路:整份文件就是此檔案中的純 JSON,每個頁面也都能匯出成 Markdown。",@@ -99,6 +100,7 @@ export const zh_Hant: Catalog = {"Choose a space…": "選擇一個空間…","Choose the field the columns come from": "選擇作為欄的欄位","Choose the order": "選擇排序方式",+ "Choose…": "選擇…","Clear filter": "清除篩選","Clear formatting": "清除格式","Click a page to open it · drag to move · scroll to zoom": "點擊頁面即可開啟 · 拖曳移動 · 捲動縮放",@@ -130,6 +132,7 @@ export const zh_Hant: Catalog = {"Could not verify an update, so nothing was changed.": "無法驗證更新,因此未變更任何內容。","Couldn’t access the clipboard": "無法存取剪貼簿","Couldn’t reach the live session": "無法連線即時會話",+ "Cover": "封面","Create “{name}”": "建立「{name}」","Dark": "深色","Default": "預設",@@ -618,4 +621,12 @@ export const zh_Hant: Catalog = {"Pages nested under this one": "巢狀在此頁面下的頁面","Pages that have this property": "具有此屬性的頁面","Which pages": "哪些頁面",+ "Gallery": "圖庫",+ "Show as a gallery": "以圖庫顯示",+ "Show as a table": "以表格顯示",+ "Select": "單選",+ "Number": "數字",+ "Date": "日期",+ "Person": "人員",+ "Labels": "標籤",}diff --git a/spaces/src/model.ts b/spaces/src/model.tsindex 330793e7..82c6d1b8 100644--- a/spaces/src/model.ts+++ b/spaces/src/model.ts@@ -268,6 +268,20 @@ export interface Page {parent?: string/** one emoji, never a URL — a URL would be a network dependency */icon?: string+ /**+ * A picture across the top of the page.+ *+ * `asset:<key>` or a `data:` URI, and NEVER a URL — for exactly the reason+ * `icon` is not one. PLATFORM §1: opening a document must not touch the+ * network, and a cover is the field most likely to tempt someone into a+ * link, because that is how every hosted notes app does it. A file that+ * arrives carrying a remote cover keeps the field (additivity) and renders+ * NOTHING, which `coverSrc` is the single place that decides.+ *+ * Absent on every page written before this, so an older build renders the+ * page it always did and round-trips the field untouched.+ */+ cover?: string/** flat, pre-order; nesting via Block.parent */blocks: Block[]/**@@ -748,6 +762,27 @@ export function isRemote(src: string): boolean {return !src.startsWith('asset:') && !src.startsWith('data:')}+/**+ * The cover a page actually shows — '' when it has none, and '' when what it+ * has would reach the network.+ *+ * ONE PLACE decides that, because the rule has to hold for the page, the+ * gallery card, the asset sweep and anything added later. A remote cover is+ * not repaired and not deleted: the field round-trips, and validate() says so+ * out loud (agent.ts) rather than the picture silently not being there.+ */+export function coverSrc(page: Page): string {+ const c = (page as { cover?: unknown }).cover+ if (typeof c !== 'string' || !c) return ''+ return isRemote(c) ? '' : c+}++/** Every asset key a PAGE references outside its blocks — today, its cover. */+export function pageAssetKeys(page: Page): string[] {+ const c = (page as { cover?: unknown }).cover+ return typeof c === 'string' && c.startsWith('asset:') ? [c.slice(6)] : []+}+/*** What an `asset:` src actually points at, or the src itself.*diff --git a/spaces/src/portable.ts b/spaces/src/portable.tsindex 5e82af85..fe6a3f8f 100644--- a/spaces/src/portable.ts+++ b/spaces/src/portable.ts@@ -17,7 +17,7 @@// place that already has the tests for it.// `.ts` extensions ON PURPOSE: node resolves this module directly for the rig.-import { type SpacesDoc, type Page, type Block, repairId } from './model.ts'+import { type SpacesDoc, type Page, type Block, repairId, pageAssetKeys } from './model.ts'import { esc } from './sanitize.ts'/** An `<a href="#p/…">` in a block, however many attributes it carries. */@@ -198,7 +198,10 @@ export function extractSpace(// ---- assets: only what travelled references ------------------------------const used = new Set<string>()- for (const p of pages) for (const b of p.blocks) for (const k of assetKeysOf(b)) used.add(k)+ for (const p of pages) {+ for (const k of pageAssetKeys(p)) used.add(k)+ for (const b of p.blocks) for (const k of assetKeysOf(b)) used.add(k)+ }// Fonts are the exception, and they are not an exception to the rule: a// `@font-face` the theme names is referenced by every page in the document.// Dropping it changes how the extract LOOKS, which an export must not do.@@ -387,7 +390,10 @@ export function planGraft(assets[k] = byteskeyMap.set(key, k)}- for (const p of pages) for (const b of p.blocks) for (const k of assetKeysOf(b)) intern(k)+ for (const p of pages) {+ for (const k of pageAssetKeys(p)) intern(k)+ for (const b of p.blocks) for (const k of assetKeysOf(b)) intern(k)+ }const haveFont = new Set((host.fonts ?? []).map((f) => `${f.family}|${f.weight ?? ''}|${f.style ?? ''}`))const fonts: NonNullable<SpacesDoc['fonts']> = []@@ -398,7 +404,17 @@ export function planGraft(if (mapped) fonts.push({ ...f, asset: mapped })}- for (const p of pages) for (const b of p.blocks) rewriteAssetRefs(b, keyMap)+ for (const p of pages) {+ // a grafted page's cover follows its bytes to their new key, like any other+ // reference — otherwise a page pasted into another space keeps a cover that+ // points at nothing+ const c = (p as { cover?: unknown }).cover+ if (typeof c === 'string' && c.startsWith('asset:')) {+ const next = keyMap.get(c.slice(6))+ if (next) p.cover = `asset:${next}`+ }+ for (const b of p.blocks) rewriteAssetRefs(b, keyMap)+ }return {pages,diff --git a/spaces/src/props.ts b/spaces/src/props.tsindex 70f603de..10822a56 100644--- a/spaces/src/props.ts+++ b/spaces/src/props.ts@@ -46,6 +46,9 @@ export interface PropsHost {locked(): booleanrepaint(): voidpickPoster(id: string): void+ /** a page's cover picture — the editor owns the file picker and the budget */+ pickCover(pageId: string): void+ removeCover(pageId: string): voidpickMedia(id: string): voidopenIconPicker(pageId: string, anchor: HTMLElement): void/** the editor owns popovers; the panel only says which page wants one */@@ -298,6 +301,27 @@ export class PropsPanel {icon.addEventListener('click', () => this.app.openIconPicker(page.id, icon))this.row(t('Icon'), icon)+ // THE COVER, beside the icon, because they are the same question asked of+ // two sizes: what does this page look like before you have read it.+ //+ // Two LITERAL calls rather than t(has ? a : b): the extractor sweeps+ // literals, so an interpolated key compiles, runs, and is never translated+ // in any of the eight catalogs.+ const has = !!String((page as { cover?: unknown }).cover ?? '')+ const covers = mk('div', 'sp-insp-btns')+ const pick = mk('button', 'sp-btn' + (has ? ' sp-on' : ''), has ? t('Replace…') : t('Choose…'))+ pick.type = 'button'+ pick.title = t('A picture across the top of this page')+ pick.addEventListener('click', () => this.app.pickCover(page.id))+ covers.appendChild(pick)+ if (has) {+ const drop = mk('button', 'sp-btn', t('Remove'))+ drop.type = 'button'+ drop.addEventListener('click', () => { this.app.removeCover(page.id); this.rebuild(true) })+ covers.appendChild(drop)+ }+ this.row(t('Cover'), covers)+// HOW WIDE THIS PAGE IS — the page menu's own control, in the place the// question is now asked. The default is an ABSENT key, never a stored// 'normal': a page set to wide and back is byte-identical to one neverdiff --git a/spaces/src/render.ts b/spaces/src/render.tsindex 717a33dd..3bb2a762 100644--- a/spaces/src/render.ts+++ b/spaces/src/render.ts@@ -9,7 +9,7 @@// story, native ⌘F, print fidelity and lossless markdown export at once, from// one decision.-import { type SpacesDoc, type Page, type Block, loadsRemotely, assetValue, tableOf, linkCard } from './model'+import { type SpacesDoc, type Page, type Block, loadsRemotely, assetValue, tableOf, linkCard, coverSrc } from './model'import { sanitizeInline, inertBody, esc } from './sanitize'import { tokenize } from './highlight'import { t, locale } from './i18n'@@ -978,6 +978,34 @@ export function renderPage(page: Page, doc: SpacesDoc, opts: RenderOpts = {}): H}if (width) inner.classList.add('sp-wide')+ // THE COVER, above everything, and FULL-BLEED rather than inside the column.+ // That is what makes it read as a cover instead of as the first image in the+ // page: it belongs to the page, not to the prose, so it ignores the measure+ // the way a book's jacket ignores the type area. It escapes the reading+ // column's padding with negative margins off `--sp-pad-x/y`, which is why+ // that padding is written as variables — a hard-coded -44px would be wrong on+ // a phone, wrong in reading mode and wrong in print, all silently.+ //+ // `resolveSrc` is the same lookup an image block goes through, and `coverSrc`+ // is what refuses a remote one — so a cover can never make opening a document+ // a network request (PLATFORM §1).+ const cover = resolveSrc(coverSrc(page), doc)+ if (cover) {+ art.classList.add('sp-has-cover')+ const wrap = document.createElement('div')+ wrap.className = 'sp-cover'+ const img = document.createElement('img')+ img.className = 'sp-cover-img'+ img.src = cover+ // DECORATIVE, deliberately. The page's own title is right underneath it and+ // says the same thing; a screen reader announcing "cover image" before every+ // title is noise, and there is nowhere to write alt text for it anyway.+ img.alt = ''+ img.setAttribute('aria-hidden', 'true')+ wrap.appendChild(img)+ art.appendChild(wrap)+ }+const h = document.createElement('h1')h.className = 'sp-title'h.dataset.pageTitle = page.id@@ -1000,6 +1028,49 @@ function shownValue(f: FieldSpec | undefined, value: unknown): string {return String(value)}+/**+ * A stable hue for a page with no cover.+ *+ * FNV-1a over the id, which is the same cheap hash assets.ts falls back to:+ * every reader of one file computes the same colour, and a page keeps its+ * colour when it is renamed.+ *+ * A CURATED SET, not 360 free hues. Free hue was measured drawing 61 and 54 in+ * the same grid — the same dirty chartreuse twice — and five cards as+ * peach/pink/pink/lavender/lavender: two near-duplicate pairs out of five. It+ * also lands on olive and mustard, which no amount of alpha rescues, and goes+ * muddy in the dark theme. Eight stops spaced around the wheel and chosen to+ * be distinguishable at 30% alpha on both grounds; neighbours in a grid differ+ * because the stops differ, not because the hash happened to spread.+ */+const CARD_HUES = [210, 265, 320, 8, 32, 48, 152, 186]++function hueOf(id: string): number {+ let h = 0x811c9dc5+ for (let i = 0; i < id.length; i++) { h ^= id.charCodeAt(i); h = Math.imul(h, 0x01000193) >>> 0 }+ return CARD_HUES[h % CARD_HUES.length]+}++/**+ * What a coverless card shows: the page's icon, else the first character of+ * its title.+ *+ * The same rule `calloutMark` follows and for the same reasons — a name from+ * the icon set is markup we wrote, anything else is TEXT out of a file someone+ * sent you, and `Object.hasOwn` keeps `toString` from resolving to a function.+ */+function pageMark(host: HTMLElement, page: Page): void {+ const icon = typeof page.icon === 'string' ? page.icon : ''+ if (icon) {+ if (Object.hasOwn(ICONS, icon)) { host.innerHTML = ICONS[icon as IconName]; host.classList.add('sp-gcard-ico') }+ else host.textContent = icon+ return+ }+ // [...str][0], not str[0]: an emoji or a CJK title is not one UTF-16 unit,+ // and slicing one in half renders a replacement character.+ host.textContent = [...(page.title || '?').trim()][0] ?? '?'+}+/*** A BOARD or a LIST of the issues in this space.*@@ -1049,7 +1120,9 @@ function renderView(host: HTMLElement, b: Block, doc: SpacesDoc, opts: RenderOpt// THREE shapes now, so the button says what you are looking at and the// click moves to the next one. A menu to choose between three is still a// menu too many; a cycle is one control and one word.- const LAYOUT_WORD: Record<string, string> = { board: 'Board', list: 'List', table: 'Table' }+ const LAYOUT_WORD: Record<string, string> = {+ board: 'Board', list: 'List', table: 'Table', gallery: 'Gallery',+ }const here = LAYOUT_WORD[layout] ? layout : 'board'const asList = here !== 'board'// Three WHOLE sentences rather than one with the shape interpolated into@@ -1057,11 +1130,25 @@ function renderView(host: HTMLElement, b: Block, doc: SpacesDoc, opts: RenderOpt// catalogs, where the article and the adjective agree with the noun's// gender — der Tafel / die Liste, un tableau / une liste. Two of these// three keys already existed for the same reason.- const NEXT_TIP: Record<string, string> = {- board: 'Show as a list', list: 'Show as a table', table: 'Show as a board',+ const NEXT: Record<string, string> = {+ board: 'list', list: 'table', table: 'gallery', gallery: 'board',+ }+ // THE EXTRACTOR SWEEPS LITERALS. `t(LAYOUT_WORD[here])` compiles, runs, and+ // is never translated by anybody: no catalog ever learns the string exists,+ // and the packer still reports 100% because it builds coverage from the+ // keys it swept. Measured on main: "Board", "List" and "Show as a list"+ // were present in de.ts and ABSENT from packed.ts — translations already+ // written, dropped on the floor, while the button read English in all eight+ // locales. The maps stay (they answer "what is next"); the words are chosen+ // at the call site, where the sweep can see them.+ const LAYOUT_LABEL: Record<string, string> = {+ board: t('Board'), list: t('List'), table: t('Table'), gallery: t('Gallery'),}- const NEXT: Record<string, string> = { board: 'list', list: 'table', table: 'board' }- const layoutB = btn('viewLayout', t(LAYOUT_WORD[here]), t(NEXT_TIP[here]))+ const NEXT_LABEL: Record<string, string> = {+ board: t('Show as a list'), list: t('Show as a table'),+ table: t('Show as a gallery'), gallery: t('Show as a board'),+ }+ const layoutB = btn('viewLayout', LAYOUT_LABEL[here], NEXT_LABEL[here])layoutB.dataset.next = NEXT[here]// GROUP BY. Only fields with declared options: a board's columns ARE the@@ -1191,6 +1278,155 @@ function renderView(host: HTMLElement, b: Block, doc: SpacesDoc, opts: RenderOptreturn a}+ // TABLE — the shape a base is usually looked at in, and the one this app did+ // not have. Columns are the fields the ROWS ACTUALLY CARRY, in the schema's+ // declared order: a table of books should not carry an Estimate column+ // because the vocabulary happens to contain one, and a page that has a field+ // the others lack should not be the reason everyone gets an empty column.+ if (layout === 'table') {+ const keys = fieldsOf(doc).map((f) => f.key).filter((k) => rows.some((r) => r.values.has(k)))+ const wrap = document.createElement('div')+ // its own scroller: a wide table must not make the PAGE scroll sideways+ wrap.className = 'sp-view-tablewrap'+ const table = document.createElement('table')+ table.className = 'sp-view-table'+ const thead = document.createElement('thead')+ const hr = document.createElement('tr')+ const th0 = document.createElement('th')+ th0.textContent = t('Page')+ hr.appendChild(th0)+ for (const k of keys) {+ const th = document.createElement('th')+ th.textContent = fieldByKey(doc, k)?.label ?? k+ hr.appendChild(th)+ }+ thead.appendChild(hr)+ table.appendChild(thead)+ const tb = document.createElement('tbody')+ for (const r of rows) {+ const tr = document.createElement('tr')+ const td0 = document.createElement('td')+ // the page itself, reached the same way a card reaches it+ const a = document.createElement('a')+ a.className = 'sp-view-cellink'+ a.href = `#p/${r.page.id}`+ a.dataset.page = r.page.id+ a.textContent = r.page.title || t('Untitled')+ td0.appendChild(a)+ tr.appendChild(td0)+ for (const k of keys) {+ const td = document.createElement('td')+ const f = fieldByKey(doc, k)+ const v = r.values.get(k)+ // THROUGH THE OPTION, so a select shows its label and its colour rather+ // than the id the model stores — the same thing propHtml does for the+ // header strip, and for the same reason: the id is not for reading.+ const opt = optionOf(f, v)+ if (opt) {+ const chip = document.createElement('span')+ chip.className = 'sp-prop-chip'+ const dot = document.createElement('span')+ dot.className = 'sp-prop-dot'+ if (opt.color) dot.style.background = opt.color+ chip.append(dot, document.createTextNode(opt.label))+ td.appendChild(chip)+ } else if (v !== undefined && v !== null && String(v) !== '') {+ td.textContent = String(v)+ } else {+ td.className = 'sp-view-empty'+ td.textContent = '—'+ }+ tr.appendChild(td)+ }+ tb.appendChild(tr)+ }+ table.appendChild(tb)+ wrap.appendChild(table)+ host.appendChild(wrap)+ return+ }++ // GALLERY — the shape that makes a reading list look like a reading list. A+ // board answers "what state is this in" and a table answers "what does it+ // say"; a gallery answers "which one is it", which for books, films, recipes+ // and people is the question actually being asked, and is why the covers+ // exist at all.+ //+ // A card without a cover is not a hole. It gets a tinted panel carrying the+ // page's own icon (or its first letter), on a hue derived from the page id —+ // so a gallery of pages nobody has given a picture to still reads as a set of+ // distinct things rather than as a grid of grey rectangles.+ if (layout === 'gallery') {+ const grid = document.createElement('div')+ grid.className = 'sp-gallery'+ for (const r of rows) {+ const cardEl = document.createElement('div')+ cardEl.className = 'sp-gcard'+ cardEl.dataset.issue = r.page.id++ const shot = document.createElement('div')+ shot.className = 'sp-gcard-shot'+ const src = resolveSrc(coverSrc(r.page), doc)+ if (src) {+ const img = document.createElement('img')+ img.src = src+ img.alt = ''+ img.setAttribute('aria-hidden', 'true')+ // A gallery is many pictures at once — the one place in this app where+ // decoding them all up front is a real cost, and the one place the+ // browser can be told not to.+ img.loading = 'lazy'+ img.decoding = 'async'+ shot.appendChild(img)+ } else {+ shot.classList.add('sp-gcard-bare')+ // deterministic, so a page keeps its colour across reloads, readers and+ // machines — the same reason ids are repaired from the id and never+ // from Math.random+ shot.style.setProperty('--h', String(hueOf(r.page.id)))+ const mark = document.createElement('span')+ mark.className = 'sp-gcard-mark'+ pageMark(mark, r.page)+ shot.appendChild(mark)+ }+ cardEl.appendChild(shot)++ const body = document.createElement('div')+ body.className = 'sp-gcard-body'+ const t1 = document.createElement(opts.editable === false ? 'span' : 'a')+ t1.className = 'sp-issue-title'+ if (t1 instanceof HTMLAnchorElement) t1.href = `#p/${r.page.id}`+ t1.textContent = r.page.title || t('Untitled')+ body.appendChild(t1)++ // EVERY field the page carries, not the tracker's four. A gallery of+ // books whose cards showed Priority and Estimate and not the Author would+ // be the board wearing a different shape.+ const meta = document.createElement('span')+ meta.className = 'sp-issue-meta'+ for (const f of fieldsOf(doc)) {+ const v = r.values.get(f.key)+ if (v === undefined || v === null || v === '' || (Array.isArray(v) && !v.length)) continue+ const chip = document.createElement('span')+ chip.className = 'sp-issue-chip'+ const o = optionOf(f, v)+ if (o?.color) {+ const d = document.createElement('span')+ d.className = 'sp-prop-dot'+ d.style.background = o.color+ chip.appendChild(d)+ }+ chip.append(document.createTextNode(shownValue(f, v)))+ meta.appendChild(chip)+ }+ if (meta.childElementCount) body.appendChild(meta)+ cardEl.appendChild(body)+ grid.appendChild(cardEl)+ }+ host.appendChild(grid)+ return+ }+// TABLE — the shape a base is usually looked at in, and the one this app did// not have. Columns are the fields the ROWS ACTUALLY CARRY, in the schema's// declared order: a table of books should not carry an Estimate columndiff --git a/spaces/src/styles.css b/spaces/src/styles.cssindex b95b38c3..219db52e 100644--- a/spaces/src/styles.css+++ b/spaces/src/styles.css@@ -346,7 +346,12 @@ option { background: var(--field); color: var(--ink); }/* ————— the reading column ————— */.sp-main {flex: 1 1 auto; overflow: auto; background: var(--bg);- padding: 44px 28px 40vh;+ /* AS VARIABLES, because a full-bleed page cover has to escape exactly this+ padding with a negative margin, and this padding is four different numbers+ (here, on a phone, in reading view, on paper). A hard-coded -44px would be+ wrong in three of them, silently. */+ --sp-pad-x: 28px; --sp-pad-y: 44px;+ padding: var(--sp-pad-y) var(--sp-pad-x) 40vh;}.sp-page-inner { margin: 0 auto; font-size: var(--sp-read); }.sp-title {@@ -1032,7 +1037,7 @@ button.sp-callout-chip:hover { text-decoration: underline; text-underline-offset}[dir='rtl'] .sp-side.sp-open { inset: 0 0 0 auto; }.sp-scrim { position: fixed; inset: 0; background: rgb(var(--shade) / .3); z-index: 45; }- .sp-main { padding: 26px 18px 45vh; }+ .sp-main { --sp-pad-x: 18px; --sp-pad-y: 26px; padding: var(--sp-pad-y) var(--sp-pad-x) 45vh; }/* THE MARGIN THE GUTTER LIVES IN — see below — and it hangs off the PAGE, notoff `.sp-main`. `.sp-main` is chrome and follows the interface direction;the gutter is anchored to a block, and blocks follow the DOCUMENT's@@ -1086,7 +1091,7 @@ button.sp-callout-chip:hover { text-decoration: underline; text-underline-offset}.sp-bar, .sp-side, .sp-insp, .sp-insp-rz, .sp-banner, .sp-gutter, .sp-scrim, .sp-langchip { display: none !important; }.sp-tb-tools, .sp-tb-grip { display: none !important; }- .sp-main { overflow: visible; padding: 0; background: #fff; }+ .sp-main { overflow: visible; --sp-pad-x: 0px; --sp-pad-y: 0px; padding: 0; background: #fff; }.sp-toggle-body[hidden] { display: block !important; } /* toggles print OPEN */.sp-b-h1, .sp-b-h2, .sp-b-h3, .sp-title { break-after: avoid; }.sp-b-code, .sp-b-image figure, .sp-b-quote { break-inside: avoid; }@@ -1290,7 +1295,7 @@ button.sp-callout-chip:hover { text-decoration: underline; text-underline-offset.sp-b.sp-hit { background: color-mix(in srgb, var(--accent) 22%, transparent); border-radius: 4px; transition: background .5s; }/* ————— reading view ————— */-.sp-app.sp-reading .sp-main { padding-top: 56px; }+.sp-app.sp-reading .sp-main { --sp-pad-y: 56px; padding-top: var(--sp-pad-y); }.sp-app.sp-reading .sp-doctitle { pointer-events: none; }.sp-btn.sp-on { background: var(--chrome-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }.sp-app.sp-reading .sp-page-inner { font-size: 17px; }@@ -2101,6 +2106,113 @@ button.sp-issue-set:hover { background: var(--chrome-2); border-color: var(--edg}@media print { .sp-cm-mark, .sp-cm-row { display: none !important; } }+/* ————— page covers ————— */+/* A COVER IS FULL-BLEED. It belongs to the page rather than to the prose, so+ it ignores the measure and escapes the reading column's padding — which is+ why that padding is `--sp-pad-x/y` rather than four literals scattered+ through this file. The height is viewport-relative with a floor and a+ ceiling: a fixed 200px is a stripe on a large screen and half the window on+ a short one. */+.sp-cover {+ /* NO BOTTOM MARGIN. It used to be 26px, and the inner column's -30px lift is+ its ADJACENT SIBLING, so the two collapsed to -4px: measured, cover bottom+ 317 against icon top 313. The disc sat tangent to the picture and the+ comment below described an arrangement that was not happening. The air+ under the cover is the inner's business now, because only one of the two+ can own it. */+ margin: calc(-1 * var(--sp-pad-y, 0px)) calc(-1 * var(--sp-pad-x, 0px)) 0;+ height: clamp(150px, 30vh, 320px);+ overflow: hidden; position: relative; background: var(--chrome-2);+ /* A near-white photograph — a scan, snow, a whiteboard — is the same colour+ as the page, so without an edge it reads as "the image failed to load"+ rather than as a picture. An inset hairline costs nothing and is invisible+ on every other image. */+ box-shadow: inset 0 0 0 1px rgb(var(--shade) / .08);+}+.sp-cover-img { display: block; width: 100%; height: 100%; object-fit: cover; }+/* The lift is what makes it read as a cover rather than as a banner sitting on+ top of a document: the title rises INTO the picture's lower edge, which is+ the arrangement everyone recognises. A scrim under the title would fight the+ page background in one theme or the other, so the page's own background does+ the work — the column is opaque and the picture ends behind it. */+/* WHAT MAKES IT A COVER RATHER THAN A BANNER: the page's own icon rides up+ over the picture's lower edge, on the column's own left margin. That is the+ arrangement everybody recognises, and the icon is the thing to lift — the+ title is a line of text and putting THAT over a photograph means a scrim,+ contrast rules and a colour that works over every possible image. A 54px+ disc in the page background does not. */+/* THE LIFT IS THE ICON'S, so it only applies where an icon renders. The reading+ view draws no page icon, and the lift still applied there: measured, cover+ bottom 197 against title top 193 — the TITLE on the photograph, unscrimmed,+ which is the one thing the comment above says this design exists to avoid. It+ survived over a dark sky and would not over a light one. `:has()` asks the+ only question that matters — is there a disc to do the lifting. */+.sp-page.sp-has-cover .sp-page-inner { position: relative; margin-top: 26px; }+.sp-page.sp-has-cover .sp-page-inner:has(> .sp-pageicon) { margin-top: -26px; }+.sp-page.sp-has-cover .sp-pageicon {+ width: 58px; height: 58px; margin-inline-start: -6px; margin-bottom: 2px;+ background: var(--bg); border-radius: 14px; color: var(--ink-2, var(--ink));+ box-shadow: 0 1px 4px rgb(var(--shade) / .16);+}+.sp-page.sp-has-cover .sp-pageicon:hover { background: var(--chrome-2); }+.sp-page.sp-has-cover .sp-pageicon svg { width: 32px; height: 32px; }+/* an emoji icon is TEXT in that box, and 34px is the size that fills it */+.sp-page.sp-has-cover .sp-pageicon { font-size: 32px; line-height: 1; }+@media print {+ /* on paper the picture is the picture; the lift is a screen affordance, and+ the icon is hidden in print anyway */+ .sp-cover { height: 5cm; margin-bottom: 10mm; break-inside: avoid; }+ .sp-page.sp-has-cover .sp-page-inner { margin-top: 0; }+}++/* ————— the gallery ————— */+/* THE SHAPE THAT MAKES A READING LIST LOOK LIKE ONE. Cards are as wide as they+ need to be and the grid decides how many fit — `auto-fill` with a minimum,+ never a column count, so the same view is three across in the panel-open+ editor and five across on a wide screen without anybody configuring it. */+.sp-gallery {+ display: grid; gap: 14px;+ grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));+ margin-bottom: 4px;+}+.sp-gcard {+ position: relative; display: flex; flex-direction: column;+ background: var(--surface); border: 1px solid var(--line); border-radius: 10px;+ overflow: hidden;+}+.sp-gcard:hover { border-color: var(--edge); box-shadow: 0 4px 14px rgb(var(--shade) / .10); }+.sp-gcard-shot {+ aspect-ratio: 3 / 2; background: var(--chrome-2);+ /* the same floor the page cover gets: a white picture still has an edge */+ box-shadow: inset 0 0 0 1px rgb(var(--shade) / .08);+ display: flex; align-items: center; justify-content: center; overflow: hidden;+}+.sp-gcard-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }+/* A CARD WITH NO COVER IS NOT A HOLE. Its own hue, derived from the page id, so+ a gallery nobody has given pictures to still reads as a set of distinct+ things. `hsl` with an alpha keeps it a tint in both themes rather than a+ colour that glows on the dark one. */+.sp-gcard-bare {+ background:+ linear-gradient(150deg, hsl(var(--h, 210) 62% 62% / .30), hsl(calc(var(--h, 210) * 1deg + 40deg) 62% 58% / .16));+}+/* --ink-2, not --muted: a grey letter on a 30% tint was the same value as the+ tint in the dark theme. */+.sp-gcard-mark { font-size: 34px; line-height: 1; color: var(--ink-2, var(--ink)); font-weight: 600; }+.sp-gcard-ico svg { width: 30px; height: 30px; }+.sp-gcard-body { padding: 10px 11px 11px; }+/* CLAMPED. One four-line title inflates its grid row and every card beside it+ gets stretched with dead space under a one-line title — measured at seven+ columns, six cards carrying ~60px of nothing. Two lines is the difference+ between a grid and a pile. (`a.sp-gcard` is dead — the card is a div — so the+ selector loses it.) */+.sp-gcard .sp-issue-title {+ font-size: 13.5px; font-weight: 600;+ display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;+ overflow: hidden;+}+.sp-gcard .sp-issue-meta { margin-top: 6px; }+/* ————— CANVAS ————————————————————————————————————————————————————————————A bounded surface with cards placed on it (canvas.ts). The block is`sp-b-canvas`; its parts are `sp-cv-*`, on the `sp-tb-*` precedent — `.sp-card`