Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

type: five features — signature tests, compare, hanging punctuation, fields and mail merge, live cells (#643)

nyblnet93a9519c3c10
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 909f22fc..e1c05167 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1948,6 +1948,39 @@ jobs:
# document the person chose — is NOT gated. Counterpart of slides'.
run: node scripts/test-type-restore-gate.ts
+ - name: Type signature-chain rig
+ # Canonical JSON and the chained signatures over it. A canonicalization
+ # bug does not crash — it silently fails valid documents or passes
+ # tampered ones — so this pins determinism, key order by UTF-16 code
+ # unit, volatile fields at every depth, and that the signer's NAME is
+ # inside the signed text (it was once only displayed beside the tick).
+ run: node scripts/test-type-canon.ts
+
+ - name: Type compare rig
+ # Comparing with another file is a VIEW: nothing commits, and the diff
+ # runs from that file to this one. Asserts which side is <del> and which
+ # is <ins>, because a reversed diff keeps the same change count and a
+ # count-only check cannot see it.
+ run: node scripts/test-type-compare.ts
+
+ - name: Type hanging-punctuation rig
+ # Optical margin alignment may only PAINT. A line break is held only
+ # when each line's first and last character both stay on it — a check
+ # on first characters alone passed a real reflow.
+ run: node scripts/test-type-micro.ts
+
+ - name: Type fields and mail-merge rig
+ # Fields are atoms resolved at render, never stored resolved. Merged
+ # letters get a fresh docId each and carry no credentials, signatures,
+ # comments or revision history from the template.
+ run: node scripts/test-type-fields.ts
+
+ - name: Type live-cells rig
+ # A field bound to an embedded sheet by row label and column heading,
+ # so inserting, reordering or sorting rows cannot re-point a sentence
+ # at a different number.
+ run: node scripts/test-type-live.ts
+
- name: Clipboard embedded-font rig
run: |
slides/node_modules/.bin/esbuild scripts/test-clipboard.ts --bundle --platform=node --format=esm --outfile="$RUNNER_TEMP/test-clipboard.mjs"
diff --git a/docs/DECISIONS.md b/docs/DECISIONS.md
index 3dda6e08..b6fe4b91 100644
--- a/docs/DECISIONS.md
+++ b/docs/DECISIONS.md
@@ -187,6 +187,45 @@ the host should not launch another app on its say-so. http, https and mailto are
what a link in a document means. A custom URL scheme is dropped rather than
opened, the same choice Android makes.
+## 2026-09-09 — bento/type: comparing with another file is a VIEW, never a merge
+
+**Decision.** `type/src/compare.ts` points the existing redline engine at a
+SECOND FILE — the user picks or drops another `.bento.html` (or a bare `.json`
+document) and gets the same word-level redline the Snapshot flow gives. Two
+constraints are settled here, because both are easy to reverse by accident.
+
+**No accept/reject against a foreign base.** `redlineview.ts` gained a
+`resolvable` flag and the file comparison passes `false`. Against a SNAPSHOT,
+reject means "restore what this document said a moment ago", and the
+accept/reject arithmetic lands somewhere the author meant to be. Against
+somebody else's document it means adopting their text wholesale — that is a
+merge, and a merge is a different feature with different questions (whose ids
+win, what happens to comments and tracked changes). Comparing may not touch the
+document and may not reach the saved file, the same rule the theme and the
+locale follow. If a future session wants three-way merge, it is new work beside
+this, not a flag flipped on it.
+
+**The direction is named in the UI, every time.** `redline(before, after)` is
+not symmetric but its change COUNT is: swap the ends and you get the same number
+of cards, each saying the opposite of the truth, with nothing on screen able to
+tell you which. The other file is `before` and the live document is `after` —
+their text paints as `<del>`, yours as `<ins>` — and the panel heading names
+both ends rather than saying "7 changes".
+
+Degenerate cases are part of the feature rather than error handling around it:
+an identical file is ANSWERED and never painted as an empty redline (an empty
+list is indistinguishable from a comparison that silently failed); another Bento
+app's file names the app it actually is; a differing `docId` is legitimate and
+noted, not refused; `parseDoc` repairs are surfaced, because a repaired block id
+shows up in the redline as a change nobody made.
+
+**Pointers.** `type/src/comparedoc.ts` (the reading and the direction, no DOM),
+`type/src/compare.ts` (the surface), `showComparison` in `redlineview.ts`. Rig:
+`scripts/test-type-compare.ts`, whose fixture is the BUILT
+`type/dist-single/*.bento.html` when one is on disk, and which pins the
+orientation by change CONTENT rather than count — verified by swapping the two
+arguments and watching six checks go red while the count stayed at three.
+
---
## 2026-08-19 — Cross-app embedding: static render + source, never a second renderer
@@ -8345,6 +8384,71 @@ sees alone (a peer's sync op, a document stored before intake was scrubbed).
A document's OWN `collab` is untouched by any of this; that is the file's.
`test-type-embed.ts`, `test-type-share.ts` and `test-export-secrets.ts` pin it.
+## 2026-09-09 — bento/type: hanging punctuation that provably cannot move a line
+
+**Optical margin alignment ships, and it hangs punctuation in RENDERING SPACE
+only.** `type/src/micro.ts` wraps the protruding character in a
+`<span class="t-hang">` that is `position: relative` with a `left` offset. CSS
+2.1 §9.4.3 says a relatively positioned box is painted moved and affects the
+layout of no other box, so the mechanism cannot reflow a paragraph by
+construction.
+
+**That constraint is not caution, it is the format's promise.** Line breaking
+is the browser's, `paginate.ts` measures the line boxes it produces, and a
+saved file's page count is a promise already made to whoever printed it. This
+is also why the TeX approach is unavailable: pdfTeX's protrusion feeds the
+overhang back into the badness computation and legitimately changes breaks,
+which is the point there and disqualifying here.
+
+**The offset is the character's side bearing and never more.** The objective is
+stated as a number — minimise the deviation of each line's INK edge from the
+margin — and once stated, ink flush is its optimum: hanging further, the classic
+"half the quote in the margin" look, makes the stated measurement worse. The
+bearings are measured from the real face at the real size through a canvas
+(`actualBoundingBoxLeft/Right`), so changing the document's typeface changes the
+answer. Anything under a third of a pixel is dropped rather than paid for with a
+wrapper.
+
+**A wrapper CAN still reflow, and it did.** Browsers break text-shaping runs at
+element boundaries, so wrapping a character can cost a kern pair. On a 14-page
+fixture, wrapping the comma of "…including time-sheets," made the word stop
+fitting and moved the break back to the hyphen in "time-". So the pass VERIFIES
+per paragraph and unwraps any paragraph whose lines moved. On that fixture the
+guard fires on 13 of 126 paragraphs — this is a routine event, not a
+theoretical one, and a version of this feature without the check would ship
+reflows.
+
+**The check must be two-sided, and the one-sided version passed a real
+reflow.** Asking only whether the character that OPENED each line is still on
+that line is not enough: in the "time-sheets" case "receipts" was still on line
+1 afterwards, because the word had moved down onto it. The line count and every
+line top were unchanged too. A break is held only when the line's FIRST and its
+LAST character are both still on it. `boundariesHeld` is that decision, and
+`scripts/test-type-micro.ts` carries the case.
+
+**`doc.optical` defaults to ON, including for files written before it existed.**
+This is a deliberate exception to "an old file renders exactly as it did", taken
+under the rule that allows one when the new output is strictly better and said
+so. What an old file promises is its PAGINATION, and that is bit-identical:
+measured over a 14-page, 162-block, 362-line mixed document (headings, justified
+prose, lists, blockquotes, a table, footnotes, display maths), every line's
+content and every page start offset is identical with the feature on and off,
+while the ink deviation's RMS over the 188 justified lines that reach the margin
+falls from 0.664px to 0.569px, and on the lines it acts on from 1.415px to
+0.010px. Only `false` is stored; an explicit `true` normalises away.
+
+**What it does not do, and these are limits of the mechanism rather than of the
+effort.** An automatic hyphen from `hyphens: auto` has no character behind it,
+so there is nothing to wrap and nothing to hang — only an explicit hyphen the
+author typed hangs. Right-to-left text, table cells and formulas are skipped.
+Letters do not hang: moving every line's last letter out by its bearing is
+margin kerning, a separate feature with a different risk profile.
+
+**Print runs the same pass, in the print document.** `buildPrintDocument` stays
+a pure string function; `printDocument` applies the pass to the first page's
+flow and clones the result into the others, which are copies of the same flow at
+the same width. `printHtml()` — the scripted surface — therefore returns
+un-hung markup, by design.
## 2026-09-26 — Spaces adopts the kernel dialog and panel; spaces keeps panel persistence
**Every modal in bento/spaces is `createDialog`** (kernel/src/ui/dialog.ts):
diff --git a/scripts/test-type-canon.ts b/scripts/test-type-canon.ts
new file mode 100644
index 00000000..ed2e5152
--- /dev/null
+++ b/scripts/test-type-canon.ts
@@ -0,0 +1,352 @@
+#!/usr/bin/env node
+// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+// bento/type canonicalization + signature-chain rig. node scripts/test-type-canon.ts
+//
+// WHY THIS RIG EXISTS. Signature code does not fail loudly. A canonicalization
+// bug does not crash and does not corrupt a file — it quietly makes an honest
+// document fail to verify, or, far worse, lets two DIFFERENT documents produce
+// the same bytes so one signature covers both. Neither is discovered until
+// somebody is in a dispute, which is the one moment you cannot re-run the test.
+//
+// So the properties pinned here are not "does it work"; they are the four
+// things a signature is worth nothing without:
+//
+// 1. DETERMINISM — the same document must produce the same bytes on every
+// machine, whatever order the keys happen to sit in memory. This is the
+// property that breaks when a developer "tidies" a serializer.
+// 2. INJECTIVITY — two different documents must NEVER produce the same
+// bytes. A collision here is a forgery: a signature taken over document A
+// verifies against document B. The lone-surrogate case below was exactly
+// this, and it was real.
+// 3. VOLATILITY — the fields that churn on every save must be dropped at
+// EVERY level, or opening a file breaks its own signature. This is what
+// makes the feature usable at all; get it wrong and every autosave
+// invalidates the chain.
+// 4. ORDER — the chain must make reordering, removing and re-labelling
+// signatures detectable without trusting anybody's clock.
+//
+// Anything the Signatures panel RENDERS is also pinned, because the panel is
+// where a false "✓ valid" would actually mislead someone.
+
+import {
+ canonicalize, digest, sign, verify, verifyChain, newKey, exportPub, VOLATILE,
+} from '../type/src/canon.ts';
+
+let checks = 0, failures = 0;
+const ok = (c: boolean, m: string) => {
+ checks++;
+ if (!c) { failures++; console.log(` FAIL ${m}`); } else console.log(` ok ${m}`);
+};
+const H = (s: string) => console.log(`\n=== ${s} ===`);
+const threw = (fn: () => unknown): string | null => {
+ try { fn(); return null; } catch (e) { return (e as Error).message; }
+};
+
+// A document shaped like the real thing, so the properties are pinned against
+// something a user could actually produce rather than a toy object.
+const doc = (over: Record<string, unknown> = {}) => ({
+ format: 'bento/type', version: 1, docId: 'doc-1', title: 'Agreement',
+ body: [{ id: 'p1', kind: 'para', text: 'The fee is due within 30 days.' }],
+ footnotes: {}, revisions: [], signatures: [], ...over,
+});
+
+// ────────────────────────────────────────────────────────────── 1. determinism
+H('determinism — insertion order must not change one byte');
+{
+ ok(canonicalize({ b: 1, a: 2 }) === canonicalize({ a: 2, b: 1 }),
+ 'top-level keys canonicalize identically whatever order they were written in');
+
+ const one = { z: { d: 4, c: 3 }, a: { b: 2, a: 1 } };
+ const two = { a: { a: 1, b: 2 }, z: { c: 3, d: 4 } };
+ ok(canonicalize(one) === canonicalize(two),
+ 'NESTED objects are sorted too — not just the top level');
+
+ const arr1 = { xs: [{ q: 1, p: 2 }, { s: 3, r: 4 }] };
+ const arr2 = { xs: [{ p: 2, q: 1 }, { r: 4, s: 3 }] };
+ ok(canonicalize(arr1) === canonicalize(arr2),
+ 'objects INSIDE arrays are sorted too — the deepest place a bug hides');
+
+ ok(canonicalize({ xs: [3, 1, 2] }) === '{"xs":[3,1,2]}',
+ 'arrays keep their order — an array is content, not a bag of keys');
+ ok(canonicalize({ xs: [1, 2, 3] }) !== canonicalize({ xs: [3, 2, 1] }),
+ 'and reordering an array therefore changes the document');
+
+ // The real thing: two hand-built copies of the same document, keys shuffled.
+ const shuffled = { title: 'Agreement', docId: 'doc-1', signatures: [], revisions: [],
+ footnotes: {}, body: [{ text: 'The fee is due within 30 days.', kind: 'para', id: 'p1' }],
+ version: 1, format: 'bento/type' };
+ ok(await digest(doc()) === await digest(shuffled),
+ 'a whole document digests identically with every key in a different place');
+}
+
+// ─────────────────────────────────────────────────────────── 2. key ordering
+H('key ordering is by UTF-16 code unit (RFC 8785 §3.2.3), not by locale');
+{
+ ok(canonicalize({ a: 1, A: 2, Z: 3 }) === '{"A":2,"Z":3,"a":1}',
+ 'uppercase sorts before lowercase — a locale sort would interleave them');
+ ok(['a', 'A', 'Z'].sort((x, y) => x.localeCompare(y)).join('') !== 'AZa',
+ '(and localeCompare really would disagree, so this test discriminates)');
+
+ ok(canonicalize({ a: 1, _: 2, '[': 3, '~': 4 }) === '{"[":3,"_":2,"a":1,"~":4}',
+ 'punctuation sorts by code point, not by any notion of "word characters"');
+
+ ok(canonicalize({ z: 1, 'é': 2 }) === '{"z":1,"é":2}',
+ 'a non-ASCII key sorts after ASCII, by its code unit');
+
+ // The discriminating case between UTF-16 code units and code POINTS: an
+ // astral character is a surrogate pair starting at U+D83D, which is BELOW
+ // U+FB00 as code units and ABOVE it as code points. RFC 8785 says code units.
+ ok(canonicalize({ 'ff': 1, '😀': 2 }) === '{"😀":2,"ff":1}',
+ 'an astral key sorts by its LEADING SURROGATE — code units, not code points');
+ ok([...'😀'][0].codePointAt(0)! > 'ff'.codePointAt(0)!,
+ '(by code point the order would be the other way round, so this test discriminates)');
+
+ ok(canonicalize({ '': 1, a: 2 }) === '{"":1,"a":2}', 'the empty key sorts first');
+}
+
+// ──────────────────────────────────────────────────────────── 3. volatile fields
+H('volatile fields are dropped at EVERY level, or saving breaks signing');
+{
+ ok(canonicalize({ modified: 'x', title: 'T' }) === '{"title":"T"}',
+ 'a volatile field is dropped at the root');
+
+ const nested = { body: { modified: 'x', sync: {}, collab: {}, text: 'a' } };
+ ok(canonicalize(nested) === '{"body":{"text":"a"}}',
+ 'and dropped one level down');
+ ok(canonicalize({ a: [{ preview: 'png', keep: 1 }] }) === '{"a":[{"keep":1}]}',
+ 'and inside an array, which is where an "only at the root" bug survives');
+
+ for (const k of VOLATILE) {
+ ok(canonicalize({ [k]: 'anything', keep: 1 }) === '{"keep":1}',
+ `'${k}' is excluded`);
+ }
+
+ // The property the whole feature rests on.
+ const before = doc({ modified: '2026-01-01T00:00:00Z', sync: { v: 2, ops: [1, 2, 3] } });
+ const after = doc({ modified: '2026-09-09T12:00:00Z', sync: { v: 9, ops: [] }, preview: '<svg/>' });
+ ok(await digest(before) === await digest(after),
+ 'two saves of the SAME text digest identically — otherwise every autosave breaks the chain');
+
+ ok(await digest(doc()) !== await digest(doc({ title: 'Other' })),
+ 'but a non-volatile field still counts');
+
+ ok(canonicalize({ modified: 1, a: 2 }, { volatile: new Set(['a']) }) === '{"modified":1}',
+ 'the volatile set is a parameter, so a caller can canonicalize with a different one');
+
+ ok(canonicalize({ a: 1, b: undefined }) === '{"a":1}',
+ 'a key explicitly set to undefined is indistinguishable from a missing one');
+}
+
+// ──────────────────────────────────────────────────────── 4. scalars and shapes
+H('scalars — the places a serializer quietly disagrees with itself');
+{
+ ok(canonicalize({ n: -0 }) === '{"n":0}', 'negative zero serializes as 0 (RFC 8785)');
+ ok(await digest({ n: -0 }) === await digest({ n: 0 }),
+ 'so -0 and 0 are the same document, which is what JSON round-tripping makes them');
+
+ ok(threw(() => canonicalize({ n: NaN }))?.includes('non-finite'), 'NaN is refused, loudly');
+ ok(threw(() => canonicalize({ n: Infinity }))?.includes('non-finite'), 'Infinity is refused');
+ ok(threw(() => canonicalize({ n: -Infinity }))?.includes('non-finite'), '-Infinity is refused');
+
+ ok(canonicalize({ n: 1e21 }) === '{"n":1e+21}', 'large numbers use ECMAScript Number::toString');
+ ok(canonicalize({ n: 1e-7 }) === '{"n":1e-7}', 'and so do small ones');
+ ok(canonicalize({ n: 1.5 }) === '{"n":1.5}', 'and ordinary ones are unsurprising');
+
+ ok(canonicalize({ s: 'a"b\\c' }) === '{"s":"a\\"b\\\\c"}', 'quote and backslash are escaped');
+ ok(canonicalize({ s: '\n\t\r\b\f' }) === '{"s":"\\n\\t\\r\\b\\f"}',
+ 'the short escapes are used for the five characters that have them');
+ ok(canonicalize({ s: '\u0001\u001f' }) === '{"s":"\\u0001\\u001f"}',
+ 'other control characters take the \\u form, lowercase hex');
+ ok(canonicalize({ s: '\u007f' }) === '{"s":"\u007f"}', 'DEL is NOT escaped — it is not a JSON control char');
+
+ ok(canonicalize(null) === 'null' && canonicalize({ a: null }) === '{"a":null}', 'null');
+ ok(canonicalize({ t: true, f: false }) === '{"f":false,"t":true}', 'booleans');
+ ok(canonicalize({ a: [], o: {} }) === '{"a":[],"o":{}}', 'empty array and empty object are distinct');
+ ok(canonicalize([]) !== canonicalize({}), 'and an empty array is not an empty object');
+
+ ok(threw(() => canonicalize({ f: () => 1 }))?.includes('cannot canonicalize'),
+ 'a function is refused rather than silently vanishing');
+}
+
+// ───────────────────────────────────────────────────── 5. Unicode: the two rules
+H('Unicode — NFC normalization, and NO two documents sharing bytes');
+{
+ const NFC = 'é', NFD = 'é'; // é, two ways
+ ok(NFC !== NFD, '(the two spellings really are different strings)');
+ ok(await digest({ s: NFC }) === await digest({ s: NFD }),
+ 'a VALUE normalizes to NFC — a Mac and a Windows machine typing "é" agree');
+
+ ok(await digest({ [NFC]: 1 }) === await digest({ [NFD]: 1 }),
+ 'a KEY normalizes to NFC as well, or the same document digests two ways');
+ ok(await digest({ [NFC]: 1, z: 2 }) === await digest({ [NFD]: 1, z: 2 }),
+ 'and it normalizes BEFORE sorting, or the key lands in a different slot');
+
+ ok(threw(() => canonicalize({ [NFC]: 1, [NFD]: 2 }))?.includes('duplicate'),
+ 'two keys that normalize to the SAME key is refused — silently emitting both '
+ + 'produces JSON with duplicate keys whose order depends on insertion order');
+
+ // INJECTIVITY. A lone surrogate is not valid Unicode, but it survives
+ // JSON.parse('"\\ud800"') perfectly happily, so a document can contain one.
+ // TextEncoder turns EVERY lone surrogate into U+FFFD, so unless they are
+ // escaped, three different documents share one digest — and a signature over
+ // any of them verifies against the other two.
+ const hi = { s: '\uD800' }, lo = { s: '\uDC00' }, repl = { s: '�' };
+ ok(await digest(hi) !== await digest(lo),
+ 'two different lone surrogates are two different documents');
+ ok(await digest(hi) !== await digest(repl),
+ 'and a lone surrogate is not the same document as a literal U+FFFD');
+ ok(canonicalize(hi) === '{"s":"\\ud800"}',
+ 'a lone surrogate is escaped (ES2019 well-formed JSON.stringify, per RFC 8785 §3.2.2.2)');
+ ok(canonicalize({ s: '😀' }) === '{"s":"😀"}',
+ 'but a WELL-FORMED pair is emitted literally, not escaped');
+ ok(await digest({ s: 'a\uD800b' }) !== await digest({ s: 'a\uDC00b' }),
+ 'and the same holds mid-string, which is how it would actually arrive');
+}
+
+// ──────────────────────────────────────────────────────────── 6. hostile shapes
+H('hostile input — a parsed document is attacker-controlled');
+{
+ const poison = JSON.parse('{"__proto__":{"polluted":1},"b":2}');
+ ok(canonicalize(poison) === '{"__proto__":{"polluted":1},"b":2}',
+ '__proto__ is an ordinary key and is SIGNED, not skipped');
+ ok(({} as Record<string, unknown>).polluted === undefined,
+ 'and canonicalizing it pollutes nothing');
+
+ const deep = JSON.parse('{"a":{"constructor":{"prototype":{"x":1}}}}');
+ ok(canonicalize(deep).includes('"constructor"'), 'so is "constructor"');
+
+ ok(await digest({ a: 1, b: 2 }) !== await digest({ 'a":1,"b': 2 }),
+ 'a key containing JSON punctuation cannot forge a different structure');
+ ok(canonicalize({ 'a":1,"b': 2 }) === '{"a\\":1,\\"b":2}', '(because it is escaped)');
+}
+
+// ─────────────────────────────────────────────────────────────── 7. signatures
+H('a signature verifies its own document and nothing else');
+{
+ const d = doc();
+ const key = await newKey();
+ const s = await sign(d, key, { name: 'Alice' });
+
+ ok((await verify(d, s)).ok, 'a fresh signature verifies against the document it covers');
+ ok((await verify(d, s)).why === null, 'and reports no reason');
+ ok(s.alg === 'ES256' && s.pub === await exportPub(key), 'it carries the algorithm and the public key');
+ ok(s.prev === '', 'the first signature chains to nothing');
+ ok(s.content === await digest(d), 'and records the content digest it signed');
+
+ // One character. This is the whole promise of the feature.
+ const edited = doc({ body: [{ id: 'p1', kind: 'para', text: 'The fee is due within 60 days.' }] });
+ const r = await verify(edited, s);
+ ok(!r.ok && r.why === 'content-changed',
+ 'changing ONE character of body text breaks it, and says so');
+
+ const invisible = doc({ body: [{ id: 'p1', kind: 'para', text: 'The fee is due within 30 days.', marks: [{ from: 4, to: 7, m: 'b' }] }] });
+ ok(!(await verify(invisible, s)).ok, 'so does adding a bold run — formatting is content');
+
+ ok((await verify(doc({ modified: 'later', sync: { v: 3 } }), s)).ok,
+ 'but re-saving does not, which is why the volatile set exists');
+
+ ok(!(await verify(doc({ docId: 'doc-2' }), s)).ok,
+ 'a signature does not travel to a document with a different docId');
+
+ // The signed text is `…|<docId>|<content>|<prev>|<name>`. docId and name are
+ // the two fields a document controls the LENGTH of, so both are quoted and
+ // escaped — otherwise a docId full of separators could shift the other fields
+ // along and make one signature's text collide with another's.
+ const framed = { ...doc(), docId: 'a|b|c' };
+ const fs = await sign(framed, key, { name: 'Alice' });
+ ok((await verify(framed, fs)).ok, 'a docId containing separators signs and verifies');
+ ok(!(await verify({ ...doc(), docId: 'a' }, { ...fs, content: await digest({ ...doc(), docId: 'a' }) })).ok,
+ 'and cannot be re-split into a different docId with the rest shifted along');
+ ok(!(await verify(doc(), { ...s, name: 'Alice|extra' })).ok,
+ 'nor can a name smuggle a separator past the framing');
+
+ const tamperedSig = { ...s, sig: s.sig.slice(0, -4) + (s.sig.endsWith('AAAA') ? 'BBBB' : 'AAAA') };
+ const t1 = await verify(d, tamperedSig);
+ ok(!t1.ok && t1.why === 'bad-signature', 'a mangled signature is rejected as bad-signature');
+
+ const other = await newKey();
+ const t2 = await verify(d, { ...s, pub: await exportPub(other) });
+ ok(!t2.ok && t2.why === 'bad-signature', 'swapping in someone else\'s public key does not help');
+
+ const t3 = await verify(d, { ...s, prev: 'something-else' });
+ ok(!t3.ok && t3.why === 'bad-signature', 'rewriting `prev` breaks the signature');
+
+ // The panel prints this name next to a green tick, so it must be signed.
+ const t4 = await verify(d, { ...s, name: 'Mallory' });
+ ok(!t4.ok && t4.why === 'bad-signature',
+ 'RELABELLING a valid signature breaks it — the name is beside the ✓ and must be covered');
+}
+
+// ─────────────────────────────────────────────────────────────────── 8. the chain
+H('the chain — order without a trusted clock');
+{
+ const d = doc();
+ const [ka, kb, kc] = [await newKey(), await newKey(), await newKey()];
+ const a = await sign(d, ka, { name: 'Alice' });
+ const b = await sign(d, kb, { name: 'Bob', prev: a });
+ const c = await sign(d, kc, { name: 'Carol', prev: b });
+
+ const good = await verifyChain(d, [a, b, c]);
+ ok(good.ok, 'three signatures in sequence verify');
+ ok(good.entries.length === 3 && good.entries.every(e => e.ok && e.linked && e.why === null),
+ 'and every entry is individually valid and linked');
+ ok(good.entries.map(e => e.name).join(',') === 'Alice,Bob,Carol',
+ 'the entries carry the names the panel renders, in order');
+ ok(b.prev === a.sig && c.prev === b.sig, 'each signature commits to the one before it');
+
+ const swapped = await verifyChain(d, [a, c, b]);
+ ok(!swapped.ok, 'reordering the chain fails');
+ ok(swapped.entries[0].linked && !swapped.entries[1].linked,
+ 'and `linked` points at WHERE it broke, which is what the panel shows');
+ ok(swapped.entries.every(e => e.ok),
+ 'while every signature is still individually valid — only the ORDER is wrong, '
+ + 'so "not linked" and "invalid" are genuinely different messages');
+
+ const dropped = await verifyChain(d, [a, c]);
+ ok(!dropped.ok && dropped.entries[0].linked && !dropped.entries[1].linked,
+ 'removing a middle signature is detectable — c no longer follows what it committed to');
+
+ const truncated = await verifyChain(d, [a, b]);
+ ok(truncated.ok, 'truncating the END is NOT detectable — a chain proves order, not completeness');
+
+ ok(!(await verifyChain(d, [b, c])).entries[0].linked,
+ 'and dropping the FIRST signature is detectable, because b commits to a');
+
+ const forged = await verifyChain(d, [a, { ...b, name: 'Mallory' }, c]);
+ ok(!forged.ok && !forged.entries[1].ok, 'relabelling a signature inside a chain is caught');
+
+ ok((await verifyChain(d, [])).ok && (await verifyChain(d, [])).entries.length === 0,
+ 'an empty chain is vacuously ok — the panel must not render it as "verified" '
+ + '(it early-returns on `!sigs.length`, which is what makes this safe)');
+}
+
+H('signing again after an edit — the chain reports the past honestly');
+{
+ const v1 = doc();
+ const ka = await newKey(), kb = await newKey();
+ const a = await sign(v1, ka, { name: 'Alice' });
+
+ const v2 = doc({ body: [{ id: 'p1', kind: 'para', text: 'The fee is due within 60 days.' }],
+ signatures: [a] });
+ const b = await sign(v2, kb, { name: 'Bob', prev: a });
+ const chain = [a, b];
+
+ const res = await verifyChain(v2, chain);
+ ok(!res.ok, 'the chain as a whole no longer verifies, because the text moved under Alice');
+ ok(!res.entries[0].ok && res.entries[0].why === 'content-changed',
+ "Alice's signature honestly reports that this is not the text she signed");
+ ok(res.entries[1].ok && res.entries[1].linked,
+ "and Bob's is valid and linked — he signed the document as it now stands");
+ ok(res.entries[0].linked, 'Alice is still LINKED — the order is intact, the content is not');
+
+ ok((await verifyChain(v1, chain)).entries[0].ok,
+ 'and against the ORIGINAL text Alice verifies again — nothing was destroyed');
+
+ ok(await digest(v2) === b.content,
+ 'signing digests the document INCLUDING the signature it chains from, because '
+ + '`signatures` is volatile and never enters the digest');
+}
+
+console.log(`\n${checks - failures}/${checks} checks passed`);
+if (failures) process.exit(1);
diff --git a/scripts/test-type-compare.ts b/scripts/test-type-compare.ts
new file mode 100644
index 00000000..9c620936
--- /dev/null
+++ b/scripts/test-type-compare.ts
@@ -0,0 +1,231 @@
+#!/usr/bin/env node
+// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+// bento/type compare-with-a-file rig. node scripts/test-type-compare.ts
+//
+// Two things can be silently wrong about comparing two documents, and neither
+// shows up as a crash:
+//
+// 1. THE DIRECTION. `redline(before, after)` is not symmetric, but its change
+// COUNT is — swap the ends and you get the same number of cards, each one
+// saying the opposite of the truth. A rig that only counted changes would
+// pass against a backwards implementation forever. So every orientation
+// check below reads the CONTENT of a change: their text must arrive as
+// `removed` and ours as `added`, because the panel paints `removed` as
+// <del> and a reader takes <del> to mean "this went away".
+//
+// 2. WHICH DOCUMENT WAS READ. The other file arrives as a saved shell whose
+// `#bento-doc` block is `<`-escaped (`<`) by the splice contract, or
+// as bare JSON. Read the wrong bytes, or accept another app's file, and
+// the redline is a confident answer to a question nobody asked.
+//
+// ON THE FIXTURE, which is the part this zone has got wrong before: a rig whose
+// fixture is something no real code produces passes forever while the feature
+// is broken. So the shell here is THE BUILT ARTIFACT — type/dist-single/
+// *.bento.html, what `npm run build:single` writes — whenever it exists, and
+// the run says which fixture it used. Where it does not exist (a CI job that
+// never built the app), the shell is reconstructed with the same escape rule
+// and the run says so out loud, because a fixture standing in for the real
+// thing must never be able to pass itself off as it.
+//
+// The document bodies are built from `emptyDoc()` and the app's own model, not
+// typed out as object literals: emptyDoc is what a fresh bento/type document
+// actually is, including the fields this rig has never heard of.
+
+import { register } from 'node:module';
+register('./lib/ts-resolve-hooks.mjs', import.meta.url);
+
+import { readFileSync, readdirSync } from 'node:fs';
+import { join, dirname } from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+const root = join(dirname(fileURLToPath(import.meta.url)), '..');
+
+const { extractDocJson, readTypeDoc, compareDocs } =
+ await import('../type/src/comparedoc.ts');
+const { emptyDoc, FORMAT } = await import('../type/src/model.ts');
+type TypeDoc = ReturnType<typeof emptyDoc>;
+
+let checks = 0, failures = 0;
+const ok = (c: boolean, m: string) => {
+ checks++;
+ if (!c) { failures++; console.log(` FAIL ${m}`); } else console.log(` ok ${m}`); };
+const H = (s: string) => console.log(`\n=== ${s} ===`);
+
+// ─────────────────────────────────────────────────────────────── the fixtures
+
+/**
+ * A document with real prose in it, built on top of a real `emptyDoc()`.
+ * Block ids are given explicitly because the redline ALIGNS ON THEM — two
+ * copies of a contract share ids, which is exactly the case being tested.
+ */
+function contract(docId: string, terms: string): TypeDoc {
+ const d = emptyDoc();
+ d.docId = docId;
+ d.title = 'Services Agreement';
+ d.body = [
+ { id: 'p1', kind: 'para', text: 'The parties agree as follows.' },
+ { id: 'p2', kind: 'para', text: `Payment is due within ${terms} of invoice.` },
+ { id: 'p3', kind: 'para', text: 'This agreement is governed by the laws of Sweden.' },
+ ];
+ return d;
+}
+
+/**
+ * The other side's copy, wrapped as a saved file — the real build artifact if
+ * one is on disk, otherwise the same bytes assembled by hand.
+ *
+ * The escaping is the point. kernel/src/save.ts writes the block as
+ * `'\n' + body.replace(/</g, '\\u003c') + '\n'` so the JSON can never contain
+ * `</script>`; a fixture that skipped it would be testing a file this suite has
+ * never written.
+ */
+const SHELL_RE = /\.bento\.html$/;
+function builtShell(): { html: string; real: boolean } {
+ const dir = join(root, 'type/dist-single');
+ try {
+ const f = readdirSync(dir).find(n => SHELL_RE.test(n));
+ if (f) return { html: readFileSync(join(dir, f), 'utf8'), real: true };
+ } catch { /* not built — fall through */ }
+ return { html: '', real: false };
+}
+
+const spliceInto = (html: string, doc: unknown): string =>
+ html.replace(/(<script[^>]*\bid=["']bento-doc["'][^>]*>)[\s\S]*?(<\/script>)/i,
+ (_m, open: string, close: string) =>
+ open + '\n' + JSON.stringify(doc).replace(/</g, '\\u003c') + '\n' + close);
+
+const HANDMADE = '<!DOCTYPE html>\n<html><head>'
+ + '<script type="application/bento+json" id="bento-doc">\n{}\n</script>'
+ + '</head><body><div id="bento-splash">bento/type</div></body></html>';
+
+const built = builtShell();
+console.log(built.real
+ ? '\nfixture: type/dist-single/*.bento.html — THE BUILT ARTIFACT'
+ : '\nfixture: reconstructed shell (type/dist-single not built; run `npm run build:single` in type/ to test the real one)');
+const SHELL = built.real ? built.html : HANDMADE;
+
+// THEIR copy: the same document id, one clause reworded, one clause struck.
+const theirs = contract('doc-services-1', '30 days');
+// OUR copy: what is open in the editor.
+const ours = contract('doc-services-1', 'sixty (60) calendar days');
+ours.body = [ours.body[0], ours.body[1],
+ { id: 'p4', kind: 'para', text: 'Late payment bears interest at the statutory rate.' }];
+
+H('reading the other file');
+{
+ const html = spliceInto(SHELL, theirs);
+ ok(html.includes('\\u003c') || !JSON.stringify(theirs).includes('<'),
+ 'the fixture shell carries the splice contract\'s <-escaping');
+
+ const x = extractDocJson(html);
+ ok(x.from === 'shell', 'a saved .bento.html is recognised as a shell, not as raw JSON');
+ const r = readTypeDoc(html);
+ ok(r.ok, 'the document comes back out of it');
+ ok(r.ok && r.doc.format === FORMAT, 'and it is a bento/type document');
+ ok(r.ok && r.doc.docId === 'doc-services-1', 'with the docId the file carried');
+ ok(r.ok && r.doc.body[1].text.includes('30 days'), 'and their wording, not ours');
+ ok(r.ok && r.repaired.length === 0, 'a file this app wrote needs no repair');
+}
+
+H('a bare document, which is what a chat AI hands back');
+{
+ const r = readTypeDoc(JSON.stringify(theirs, null, 2));
+ ok(extractDocJson('{"format":"x"}').from === 'raw', 'JSON with no shell around it is read as raw');
+ ok(r.ok && r.doc.docId === 'doc-services-1', 'and parses to the same document');
+}
+
+H('the direction — their text is what was REMOVED');
+{
+ const cmp = compareDocs(theirs, ours, 'counsel');
+ for (const c of cmp.set.changes) console.log(` · ${c.kind}`);
+
+ const text = cmp.set.changes.filter(c => c.kind === 'text') as Array<
+ { blockId: string; removed: string; added: string }>;
+ ok(text.length > 0, 'the reworded payment clause is reported as a text change');
+ const pay = text.find(c => c.blockId === 'p2');
+ ok(!!pay && pay.removed.includes('30'),
+ 'THEIR "30 days" is the REMOVED side (what the panel paints as <del>)');
+ ok(!!pay && pay.added.includes('sixty'),
+ 'OUR "sixty (60) calendar days" is the ADDED side');
+ ok(!!pay && !pay.removed.includes('sixty'),
+ 'and not the other way round — this is the check a swapped diff fails');
+
+ // The governing-law clause is in their copy and gone from ours: from their
+ // file to this document, that is a DELETION. Backwards it would be an insert.
+ const dels = cmp.set.changes.filter(c => c.kind === 'block-del') as Array<{ blockId: string }>;
+ const ins = cmp.set.changes.filter(c => c.kind === 'block-ins') as Array<{ blockId: string }>;
+ ok(dels.some(c => c.blockId === 'p3'),
+ 'a clause only THEY have reads as a deletion');
+ ok(ins.some(c => c.blockId === 'p4'),
+ 'a clause only WE have reads as an insertion');
+ ok(!dels.some(c => c.blockId === 'p4') && !ins.some(c => c.blockId === 'p3'),
+ 'and neither is reported the wrong way about');
+}
+
+H('comparing is a VIEW — it may not touch either document');
+{
+ const a = contract('doc-a', '30 days'), b = contract('doc-b', '45 days');
+ const beforeA = JSON.stringify(a), beforeB = JSON.stringify(b);
+ compareDocs(a, b);
+ ok(JSON.stringify(a) === beforeA, 'the other document is not mutated');
+ ok(JSON.stringify(b) === beforeB, 'and neither is this one');
+}
+
+H('the same document, compared with itself');
+{
+ const cmp = compareDocs(theirs, contract('doc-services-1', '30 days'));
+ ok(cmp.identical, 'is reported as identical');
+ ok(cmp.set.changes.length === 0, 'with no changes');
+ ok(cmp.sameDocId, 'and as the same document');
+ // The point of `identical` existing at all: the caller must be able to tell
+ // "no differences" from "the comparison never ran", which an empty change
+ // list alone cannot do.
+ ok('identical' in cmp, 'as a fact of its own, not as an empty list to infer from');
+}
+
+H('a different document is legitimate, and worth saying');
+{
+ const cmp = compareDocs(contract('doc-other', '30 days'), ours);
+ ok(!cmp.sameDocId, 'a mismatched docId is reported');
+ ok(cmp.set.changes.length > 0, 'but the comparison still runs — it is not an error');
+}
+
+H('the files that are not this');
+{
+ const slides = spliceInto(SHELL, { ...theirs, format: 'bento/slides' });
+ const r1 = readTypeDoc(slides);
+ ok(!r1.ok && r1.kind === 'other-app', 'another Bento app\'s file is refused as such');
+ ok(!r1.ok && r1.found === 'bento/slides', 'and names the app it actually is');
+
+ const r2 = readTypeDoc('<!DOCTYPE html><html><body><h1>a web page</h1></body></html>');
+ ok(!r2.ok && r2.kind === 'not-bento',
+ 'an ordinary web page is "not a Bento document", not a JSON syntax error');
+
+ // A file cut off mid-write. The block is there and the format is right, so
+ // nothing before JSON.parse can catch it.
+ const truncated = SHELL.replace(
+ /(<script[^>]*\bid=["']bento-doc["'][^>]*>)[\s\S]*?(<\/script>)/i,
+ (_m, open: string, close: string) => `${open}\n{"format":"bento/type","body":[\n${close}`);
+ const r3 = readTypeDoc(truncated);
+ ok(!r3.ok && r3.kind === 'json', 'a truncated document block is refused as unreadable JSON');
+
+ const r4 = readTypeDoc('');
+ ok(!r4.ok && r4.kind === 'empty', 'an empty file is refused as empty');
+
+ const r5 = readTypeDoc(JSON.stringify({ format: FORMAT, version: 1, docId: 'd', title: 'T' }));
+ ok(!r5.ok && r5.kind === 'shape', 'a bento/type document with no body is refused');
+}
+
+H('a repaired file says so — a repair can look like a change');
+{
+ // Duplicate block ids: parseDoc repairs the second deterministically, which
+ // changes an id the redline ALIGNS ON. Left unsaid, that surfaces as a
+ // deletion and an insertion the author never made.
+ const dupes = { ...theirs, body: [theirs.body[0], { ...theirs.body[0], text: 'A second block reusing the id.' }] };
+ const r = readTypeDoc(JSON.stringify(dupes));
+ ok(r.ok && r.repaired.length > 0, 'the repair is reported to the caller, not swallowed');
+}
+
+console.log(`\n${failures ? 'FAILED' : 'passed'} — ${checks - failures}/${checks} checks`);
+process.exit(failures ? 1 : 0);
diff --git a/scripts/test-type-fields.ts b/scripts/test-type-fields.ts
new file mode 100644
index 00000000..3b2afca5
--- /dev/null
+++ b/scripts/test-type-fields.ts
@@ -0,0 +1,337 @@
+#!/usr/bin/env node
+// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+// bento/type fields and mail merge. node scripts/test-type-fields.ts
+//
+// THE FIXTURES ARE BUILT BY THE APPS THAT WILL ACTUALLY FEED THIS.
+//
+// That sentence is the whole reason this file is shaped the way it is, and it
+// is a lesson this zone has already paid for: `scripts/test-type-embed.ts`
+// passed for weeks on a preview fixture (a bare `<svg>` in the host) that NO
+// app ever writes, and it went on passing while the boundary it certified was
+// broken. So the spreadsheet here is not a hand-typed object literal in the
+// shape a dash file might have — it is produced by `dash/src/import.ts`
+// `importDelimited` and `dash/src/starter.ts` `starterDoc`, the code paths a
+// real workbook comes out of, and it is wrapped in a `#bento-doc` block with
+// the SAME `<`-escape kernel/src/save.ts applies (PLATFORM §2). If dash changes
+// how it encodes a column, this rig goes red instead of certifying a merge that
+// silently reads nothing.
+//
+// What is checked:
+//
+// 1. a token resolves — `{{Name}}` typed in prose becomes a field, and the
+// field renders the row's value on paper;
+// 2. an unmatched field is EMPTY on paper, and is neither the literal token
+// nor "undefined" — the two failure modes that would print;
+// 3. converting tokens moves marks, footnotes and citations by the same rule
+// an edit does, because a field occupies no characters;
+// 4. every merged output gets a FRESH docId — 200 letters sharing the
+// template's identity is 200 files autosave believes are one document;
+// 5. no emitted file carries the source's collaboration block, checked
+// against the SERIALIZED bytes rather than against the object;
+// 6. the sheet reader gets real rows, real dictionary-encoded columns and
+// honours a hand correction.
+
+import { register } from 'node:module'
+register('./lib/ts-resolve-hooks.mjs', import.meta.url)
+
+const {
+ BUILTINS, fieldContext, fieldsOf, fillFieldsHtml, isBuiltin, resolveField,
+ safeFieldName, shiftFields, tokensToFields, withField, TOKEN,
+} = await import('../type/src/fields.ts')
+const { blockHtml } = await import('../type/src/render.ts')
+const { emptyDoc, parseDoc, spliceText } = await import('../type/src/model.ts')
+const { cellText, fillTokens, mergeDoc, readMergeSource, safeName } = await import('../type/src/merge.ts')
+const { importDelimited } = await import('../dash/src/import.ts')
+const { starterDoc } = await import('../dash/src/starter.ts')
+
+type Block = import('../type/src/model.ts').Block
+type TypeDoc = import('../type/src/model.ts').TypeDoc
+
+let checks = 0, bad = 0
+const ok = (cond: boolean, msg: string) => {
+ checks++
+ if (cond) console.log(` ok ${msg}`)
+ else { bad++; console.log(` FAIL ${msg}`) }
+}
+const H = (s: string) => console.log(`\n=== ${s} ===`)
+
+// ── the spreadsheet, built by dash ──────────────────────────────────────────
+//
+// A dictionary-encoded column is what dash writes for repeated text (its
+// default encoding, model.ts "dict is the default and the reason the format
+// fits"), so "Plan" being read correctly is a real check and not a formality.
+
+const CSV = [
+ 'Name,Company,Plan,Owed',
+ 'Ada Lovelace,Analytical Engines,Gold,1200',
+ 'Grace Hopper,Naval Systems,Gold,340',
+ 'Alan Turing,Bletchley,Silver,0',
+].join('\n')
+
+const imported = importDelimited(CSV, { name: 'Recipients', sheetId: 'sheet-r' })
+const sheetRaw = imported.sheet as Record<string, unknown>
+
+// A HAND CORRECTION, made through dash's own overlay shape: `cells` keyed
+// `<colId>:<rid>`. A merge that ignored it would mail out the number somebody
+// had already fixed on screen.
+const owedId = (sheetRaw.columns as Array<{ id: string; name: string }>)
+ .find(c => c.name === 'Owed')!.id
+const firstRid = (sheetRaw.rids as Array<[number, number]>)[0][0]
+sheetRaw.cells = { [`${owedId}:${firstRid}`]: { v: 999, by: 'someone', why: 'agreed discount' } }
+
+const workbook = { ...starterDoc(), title: 'Debtors', sheets: [sheetRaw] }
+
+/** A Bento file, spliced the way kernel/src/save.ts splices one (PLATFORM §2). */
+const bentoFile = (doc: unknown): string =>
+ '<!DOCTYPE html>\n<html><head>'
+ + '<script type="application/bento+json" id="bento-doc">\n'
+ + JSON.stringify(doc).replace(/</g, '\\u003c')
+ + '\n</script></head><body></body></html>'
+
+H('the sheet reader gets what dash actually wrote')
+const src = readMergeSource(bentoFile(workbook))
+{
+ ok(src !== null, 'a bento/dash file is recognised')
+ const sheet = src!.sheets.find(s => s.name === 'Recipients')
+ ok(!!sheet, 'the imported sheet is offered for merging')
+ ok(sheet!.columns.join(',') === 'Name,Company,Plan,Owed', `columns: ${sheet!.columns.join(',')}`)
+ ok(sheet!.rows.length === 3, `three rows read (${sheet!.rows.length})`)
+ ok(sheet!.rows[1].name === 'Grace Hopper', 'a raw text column reads back')
+ ok(sheet!.rows[2].plan === 'Silver', 'a DICTIONARY-encoded column reads back (dash\'s default encoding)')
+ ok(sheet!.rows[0].owed === '999', 'a hand correction in `cells` beats the imported value')
+ ok(sheet!.rows[2].owed === '0', 'a zero is a value, not a blank')
+ ok(readMergeSource(bentoFile({ ...emptyDoc(), title: 'A letter' })) === null,
+ 'a bento/type file offers no sheets — merging a document into itself is not a thing')
+ ok(readMergeSource('<html><body>hello</body></html>') === null, 'a non-Bento file is refused')
+}
+
+const sheet = src!.sheets.find(s => s.name === 'Recipients')!
+
+// ── the template ────────────────────────────────────────────────────────────
+
+H('a typed {{token}} becomes a field, and the text loses the characters')
+{
+ const b: Block = { id: 'p1', kind: 'para', text: 'Dear {{Name}}, of {{Company}}.' }
+ const out = tokensToFields(b, spliceText)!
+ ok(out.text === 'Dear , of .', `the token characters are gone: ${JSON.stringify(out.text)}`)
+ ok(fieldsOf(out).length === 2, 'two fields')
+ ok(fieldsOf(out)[0].name === 'Name' && fieldsOf(out)[0].at === 5, 'the first sits where its token began')
+ ok(fieldsOf(out)[1].name === 'Company' && fieldsOf(out)[1].at === 10, 'and so does the second')
+ ok(tokensToFields(out, spliceText) === null, 'a second pass finds nothing to do')
+}
+
+H('a field owns no characters, so the offsets around it do not move under it')
+{
+ // marks, a footnote and a citation over the SAME string — the four things
+ // that are offsets into `text` in this app.
+ // Offsets computed from the text rather than typed in, so the fixture cannot
+ // quietly stop describing what it claims to.
+ const text = 'Dear {{Name}}, the fee is due.'
+ const feeAt = text.indexOf('fee')
+ const b: Block = {
+ id: 'p2', kind: 'para', text,
+ marks: [{ t: 'b', from: feeAt, to: feeAt + 3 }],
+ notes: [{ id: 'n1', at: text.length }],
+ cites: [{ at: text.length, keys: ['smith2020'] }],
+ }
+ const out = tokensToFields(b, spliceText)!
+ ok(out.text.slice(out.marks![0].from, out.marks![0].to) === 'fee',
+ `the bold mark still covers "fee" (${JSON.stringify(out.text.slice(out.marks![0].from, out.marks![0].to))})`)
+ ok(out.notes![0].at === out.text.length, 'the footnote anchor followed the shortened text')
+ ok(out.cites![0].at === out.text.length, 'and so did the citation')
+}
+
+H('a field survives the model round-trip')
+{
+ const doc = emptyDoc()
+ doc.body = [withField({ id: 'p3', kind: 'para', text: 'Dear .' }, 5, 'Name')]
+ const round = parseDoc(JSON.stringify(doc))
+ ok(round.ok, 'the document parses')
+ ok(round.ok && fieldsOf(round.doc.body[0])[0]?.name === 'Name', 'the field is still there')
+
+ const clamped = parseDoc(JSON.stringify({
+ ...doc,
+ body: [{ id: 'p3', kind: 'para', text: 'Hi', fields: [{ name: 'Name', at: 900 }, { name: '', at: 0 }] }],
+ }))
+ ok(clamped.ok && fieldsOf(clamped.doc.body[0]).length === 1, 'a nameless field is dropped')
+ ok(clamped.ok && fieldsOf(clamped.doc.body[0])[0].at === 2, 'and an out-of-range offset is clamped to the text')
+}
+
+H('shiftFields moves anchors the way every other anchor in this app moves')
+{
+ const f = [{ at: 0, name: 'A' }, { at: 5, name: 'B' }, { at: 10, name: 'C' }]
+ ok(JSON.stringify(shiftFields(f, 2, 0, 3).map(x => x.at)) === '[0,8,13]', 'an insertion pushes what is after it')
+ ok(JSON.stringify(shiftFields(f, 3, 4, 0).map(x => x.at)) === '[0,6]',
+ 'a deletion drops the anchor whose words are gone and moves the rest')
+ ok(JSON.stringify(shiftFields(f, 20, 0, 5).map(x => x.at)) === '[0,5,10]', 'an edit after them all changes nothing')
+}
+
+// ── resolution ──────────────────────────────────────────────────────────────
+
+H('a token resolves — the row\'s value reaches the paper')
+{
+ const template = emptyDoc()
+ template.title = 'Statement'
+ template.body = [tokensToFields(
+ { id: 'p4', kind: 'para', text: 'Dear {{Name}} of {{Company}} — you owe {{Owed}}.' },
+ spliceText)!]
+
+ const merged = mergeDoc(template, sheet.rows[0], sheet.columns, 'Debtors — Recipients')
+ const paper = fillFieldsHtml(blockHtml(merged.body[0]), fieldContext(merged))
+ ok(paper.includes('Ada Lovelace'), `the name is on the page: ${paper}`)
+ ok(paper.includes('Analytical Engines'), 'and the company')
+ ok(paper.includes('999'), 'and the corrected figure')
+ ok(!paper.includes('{{'), 'and no token survives to be read by a recipient')
+}
+
+H('an unmatched field prints as NOTHING — not the token, not "undefined"')
+{
+ const b = tokensToFields({ id: 'p5', kind: 'para', text: 'Dear {{Nickname}}, hello.' }, spliceText)!
+ const doc = emptyDoc()
+ const paper = fillFieldsHtml(blockHtml(b), fieldContext(doc))
+ ok(!paper.includes('Nickname'), `the field NAME is not printed: ${paper}`)
+ ok(!paper.includes('{{'), 'the token is not printed either')
+ ok(!/undefined|null|NaN/.test(paper), 'and neither is a JavaScript accident')
+ ok(paper === 'Dear , hello.', `it is simply absent: ${JSON.stringify(paper)}`)
+
+ // The editor is the ONE surface that shows it, because the editor is the only
+ // place anyone can still fix it. blockHtml emits the unbound chip; the DOM
+ // filler (fillFields) only ever changes text and a class, never structure.
+ ok(blockHtml(b).includes('t-field-unbound'), 'while the editor marks it unbound')
+ ok(blockHtml(b).includes('>Nickname<'), 'and names it, so an author can see the hole')
+}
+
+H('a document answers for its own properties, and a bound row overrides them')
+{
+ const doc = emptyDoc()
+ doc.title = 'Q3 Terms'
+ doc.meta = { author: 'A. Author', company: 'Acme' }
+ const ctx = fieldContext(doc)
+ ok(resolveField({ at: 0, name: 'title' }, ctx) === 'Q3 Terms', '{{title}}')
+ ok(resolveField({ at: 0, name: 'Author' }, ctx) === 'A. Author', '{{Author}} — case does not matter')
+ ok(resolveField({ at: 0, name: ' company ' }, ctx) === 'Acme', 'nor does edge whitespace')
+ ok(resolveField({ at: 0, name: 'page' }, ctx) === null,
+ '{{page}} is unbound before anything has been paginated, rather than a confident "1"')
+
+ // A BOUND ROW WINS over a document property of the same name — see fields.ts
+ // for why that is the safer of the two failures. "Company" is the case that
+ // made the rule: it is both a document property and one of the commonest
+ // headings in a mail-merge sheet, and reserving it printed nothing at all.
+ const shadow = fieldContext(doc, { row: { company: 'Analytical Engines' } })
+ ok(resolveField({ at: 0, name: 'Company' }, shadow) === 'Analytical Engines',
+ 'a merge column takes over the document property of the same name')
+ ok(resolveField({ at: 0, name: 'author' }, shadow) === 'A. Author',
+ 'while a property the row says nothing about still answers for itself')
+ ok(BUILTINS.every(b => isBuiltin(b)) && isBuiltin('DATE') && !isBuiltin('Nickname'),
+ 'isBuiltin names exactly the set the dialog flags as shadowed')
+}
+
+H('a value from a spreadsheet is escaped, not interpreted')
+{
+ const b = tokensToFields({ id: 'p6', kind: 'para', text: '{{Name}}' }, spliceText)!
+ const doc = emptyDoc()
+ const evil = fillFieldsHtml(blockHtml(b),
+ fieldContext(doc, { row: { name: '<img src=x onerror=alert(1)>' } }))
+ ok(!evil.includes('<img'), `a cell cannot inject markup: ${evil}`)
+ ok(evil.includes('&lt;img'), 'it is shown as the text it is')
+
+ ok(safeFieldName('Full Name') === 'Full Name', 'a column name with a space is usable')
+ ok(safeFieldName('Invoice-No') === 'Invoice-No', 'so is one with a hyphen')
+ ok(safeFieldName('a<b') === null && safeFieldName('a"b') === null && safeFieldName('{x}') === null,
+ 'a name that could not survive an attribute or a token is refused')
+ ok(safeFieldName('x'.repeat(200)) === null, 'and one that could not survive a page')
+}
+
+H('{{page:2}} takes a width, and only where a width means anything')
+{
+ const b = tokensToFields({ id: 'p7', kind: 'para', text: '{{page:2}} of {{pages:2}}' }, spliceText)!
+ const fs = fieldsOf(b)
+ ok(fs[0].pad === 2 && fs[1].pad === 2, 'the width is read off the token')
+ const ctx = fieldContext(emptyDoc(), { pages: 9, pageOf: () => 6 })
+ ok(resolveField(fs[0], ctx, '') === '06', 'and zero-pads')
+ ok(resolveField(fs[1], ctx) === '09', 'both of them')
+ ok(withField({ id: 'x', kind: 'para', text: '' }, 0, 'Name', 2).fields![0].pad === undefined,
+ 'a width on a name that is not a page number is dropped rather than stored meaninglessly')
+ ok([...'{{page:2}}'.matchAll(TOKEN)][0][2] === '2', 'the token pattern itself carries the width')
+}
+
+// ── merging ─────────────────────────────────────────────────────────────────
+
+H('every output is its own document')
+{
+ const template = emptyDoc()
+ template.title = '{{Company}} statement'
+ template.body = [tokensToFields({ id: 'p8', kind: 'para', text: 'Dear {{Name}}.' }, spliceText)!]
+
+ const outs = sheet.rows.map(r => mergeDoc(template, r, sheet.columns, 'Debtors'))
+ const ids = new Set(outs.map(o => o.docId))
+ ok(ids.size === outs.length, `${ids.size} distinct docIds for ${outs.length} outputs`)
+ ok(!ids.has(template.docId), 'and none of them is the template\'s')
+ ok(outs.every(o => typeof o.docId === 'string' && o.docId.length > 8), 'each is a real id')
+ ok(outs[0].title === 'Analytical Engines statement',
+ `the title resolves per row, so the files have distinct names: ${outs[0].title}`)
+ ok(outs[0].merge?.row?.name === 'Ada Lovelace', 'the row rides along, so the output still RESOLVES its fields')
+ ok(fieldsOf(outs[0].body[0]).length === 1,
+ 'and the body still holds a FIELD — the value was never baked into the text')
+ ok(template.body[0].text === 'Dear .' && fieldsOf(template.body[0]).length === 1,
+ 'the template is untouched by merging')
+}
+
+H('no emitted file carries the source\'s collaboration block')
+{
+ const template = emptyDoc() as TypeDoc
+ // The credentials in the shape type/src/collab.ts actually mints (v2:
+ // an owner keypair, a room committed to it, a read key, an invite).
+ template.collab = {
+ room: 'w-ROOMSECRET', key: 'READKEY-b64url', on: true, v: 2,
+ owner: 'OWNERPUB', ownerPriv: 'OWNERPRIVATEKEY',
+ invite: { pub: 'INVPUB', priv: 'INVPRIVATEKEY', role: 'writer', sig: 'SIG' },
+ }
+ template.signatures = [{ by: 'A', at: '2026-01-01', sig: 'SIGNATURE-OVER-THE-TEMPLATE' } as never]
+ template.comments = { c1: { id: 'c1', block: 'b', from: 0, to: 1, quote: 'x',
+ messages: [{ id: 'm', author: 'A', at: 'now', text: 'check with legal' }] } }
+ // A revision carries a WHOLE COPY of an earlier body — the wording somebody
+ // negotiated away. Two hundred recipients must not each receive it.
+ template.revisions = [{ id: 'r1', at: 'then', label: 'first draft',
+ body: [{ id: 'p9', kind: 'para', text: 'we will pay THE OLD PRICE.' }] }]
+ template.body = [tokensToFields({ id: 'p9', kind: 'para', text: 'Dear {{Name}}.' }, spliceText)!]
+
+ const out = mergeDoc(template, sheet.rows[0], sheet.columns, 'Debtors')
+ ok(out.collab === undefined, 'the object has no collab')
+
+ // Checked against the BYTES, because that is what leaves the machine: the
+ // merged doc is spliced into a shell exactly as above, so grep the file.
+ const file = bentoFile(out)
+ const SECRETS = ['OWNERPRIVATEKEY', 'INVPRIVATEKEY', 'READKEY-b64url', 'w-ROOMSECRET', 'OWNERPUB']
+ for (const s of SECRETS) ok(!file.includes(s), `the emitted FILE does not contain ${s}`)
+ ok(!file.includes('SIGNATURE-OVER-THE-TEMPLATE'),
+ 'nor a signature that covers a document this one is not')
+ ok(!file.includes('check with legal'), 'nor the drafting comments')
+ ok(!file.includes('THE OLD PRICE'), 'nor an earlier draft of a clause, out of the revision history')
+ ok(file.includes('Ada Lovelace'), 'while the row it was merged from is there')
+ ok(bentoFile(template).includes('OWNERPRIVATEKEY'),
+ 'and the control holds: the same splice DOES carry them when nothing strips them')
+}
+
+H('file names')
+{
+ const row = { name: 'Ada Lovelace', company: 'Analytical/Engines' }
+ ok(fillTokens('{{name}} {{#}}', row, 7) === 'Ada Lovelace 7', 'a pattern takes columns and the row number')
+ ok(fillTokens('{{nothing}}!', row, 1) === '!', 'an unknown column in a pattern is empty, like everywhere else')
+ ok(safeName('Analytical/Engines', 'x') === 'Analytical Engines.bento.html',
+ 'a path separator out of a cell cannot become a directory')
+ ok(safeName('', 'merge-4') === 'merge-4.bento.html', 'an empty name falls back rather than writing ".bento.html"')
+ ok(safeName('..', 'merge-4') === 'merge-4.bento.html', 'and so does a name that is only dots')
+}
+
+H('cell values')
+{
+ ok(cellText(null) === '' && cellText(undefined) === '', 'a blank cell is a blank string, never "null"')
+ ok(cellText(0) === '0', 'a zero is a zero')
+ ok(cellText(NaN) === '', 'and a non-finite number is blank rather than "NaN" on somebody\'s invoice')
+ ok(cellText(true) === 'true' && cellText({}) === '', 'a boolean reads, an object does not')
+}
+
+console.log(`\n${checks - bad}/${checks} checks passed`)
+if (bad) process.exit(1)
diff --git a/scripts/test-type-live.ts b/scripts/test-type-live.ts
new file mode 100644
index 00000000..c22fb06f
--- /dev/null
+++ b/scripts/test-type-live.ts
@@ -0,0 +1,162 @@
+// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+//
+// LIVE CELLS — a field whose value is a cell of an embedded sheet.
+//
+// THE FIXTURE IS DASH'S OWN OUTPUT. The workbook here is built by calling
+// dash's `importDelimited` and `starterDoc`, not by hand-writing what a sheet
+// is assumed to look like — the same rule test-type-fields.ts follows, and for
+// the reason this zone learned the expensive way: an embed rig once passed for
+// weeks against a preview fixture no app had ever produced, certifying a
+// boundary that was broken the whole time. A fixture nobody's code writes
+// proves nothing.
+
+import { register } from 'node:module'
+register('./lib/ts-resolve-hooks.mjs', import.meta.url)
+
+const { parseAddress, resolveCell, embeddedSheets, cellResolver } = await import('../type/src/live.ts')
+const { fieldContext, resolveField } = await import('../type/src/fields.ts')
+const { sourceOfDoc } = await import('../type/src/merge.ts')
+const { emptyDoc } = await import('../type/src/model.ts')
+const { importDelimited } = await import('../dash/src/import.ts')
+const { starterDoc } = await import('../dash/src/starter.ts')
+
+let checks = 0, bad = 0
+const ok = (cond: boolean, msg: string) => {
+ checks++
+ if (!cond) { bad++; console.log(` FAIL ${msg}`) } else console.log(` ok ${msg}`)
+}
+const H = (s: string) => console.log(`\n— ${s} —`)
+
+// ── the sheet, as dash writes it ────────────────────────────────────────────
+const CSV = ['Quarter,Revenue,Margin,Note',
+ 'Q1,1000,12%,steady',
+ 'Q2,1150,13%,up',
+ 'Q3,1240,14%,best yet'].join('\n')
+const mk = (csv: string, name: string, id: string) =>
+ (importDelimited(csv, { name, sheetId: id }).sheet as Record<string, unknown>)
+const workbook = (...sheets: unknown[]) => ({ ...starterDoc(), title: 'Numbers', sheets })
+
+/** A type document embedding a dash workbook, the way embed.ts stores one. */
+const docWith = (...sheets: unknown[]) => ({
+ ...emptyDoc(),
+ body: [{ id: 'p1', kind: 'para', text: 'Revenue grew to ', fields: [{ at: 16, name: 'Q3!Revenue' }] },
+ { id: 'e1', kind: 'embed', text: '',
+ embed: { app: 'bento/dash', view: '<svg/>', doc: workbook(...sheets) } }],
+} as never)
+
+const sheet = mk(CSV, 'Quarters', 'sh-q')
+
+H('the address parses the way a person reads a table')
+{
+ ok(JSON.stringify(parseAddress('Q3!Revenue')) === '{"sheet":null,"row":"Q3","column":"Revenue"}',
+ 'two parts are row and column')
+ ok(parseAddress('Budget!Q3!Revenue')?.sheet === 'Budget', 'three parts name the sheet as well')
+ ok(parseAddress(' Q3 ! Revenue ')?.row === 'Q3', 'and are trimmed')
+ ok(parseAddress('Name') === null, 'a plain name is NOT an address — it must still reach the merge row')
+ ok(parseAddress('Q3!') === null, 'an empty part is refused rather than half-matched')
+ ok(parseAddress('a!b!c!d') === null, 'and so is a fourth part')
+}
+
+H('a cell resolves by row label and column heading')
+{
+ const sheets = sourceOfDoc(workbook(sheet))!.sheets
+ ok(resolveCell(parseAddress('Q3!Revenue')!, sheets).value === '1240', 'the number in the prose IS the number in the table')
+ // A PERCENT COLUMN READS AS ITS UNDERLYING NUMBER, and this is the sharp
+ // edge of the feature. dash's importer types "12%" as the number 0.12, and
+ // merge.ts resolved long ago that this app writes what the cell HOLDS, never
+ // dash's display format — carrying that formatter here would be a second
+ // implementation of someone else's rules, wrong the first time they change
+ // one. So `{{Q1!Margin}}` in prose reads "0.12", not "12%".
+ //
+ // Pinned rather than fixed, because it is a real limitation an author will
+ // meet, and the fix (format it in the sheet, in a text column) belongs where
+ // the format lives. If this is ever changed, this check is the argument.
+ ok(resolveCell(parseAddress('Q1!Margin')!, sheets).value === '0.12',
+ 'a percent column resolves to its UNDERLYING value (0.12), not its displayed one')
+ ok(resolveCell(parseAddress('q3!revenue')!, sheets).value === '1240', 'matching is case-insensitive, like every other field name')
+ ok(resolveCell(parseAddress('Q3!Note')!, sheets).value === 'best yet', 'and a text column reads back whole')
+}
+
+H('THE POINT: the address survives the sheet being edited')
+{
+ const before = sourceOfDoc(workbook(sheet))!.sheets
+ const v0 = resolveCell(parseAddress('Q3!Revenue')!, before).value
+
+ // A row inserted ABOVE the one the sentence cites. A cell reference (B4)
+ // would now silently point one row off — which is the exact drift this
+ // feature exists to prevent, so it is the case that matters most here.
+ const inserted = mk(['Quarter,Revenue,Margin,Note',
+ 'Q0,900,11%,prior',
+ 'Q1,1000,12%,steady',
+ 'Q2,1150,13%,up',
+ 'Q3,1240,14%,best yet'].join('\n'), 'Quarters', 'sh-q')
+ const after = sourceOfDoc(workbook(inserted))!.sheets
+ ok(v0 === '1240' && resolveCell(parseAddress('Q3!Revenue')!, after).value === '1240',
+ 'a row inserted ABOVE it does not move the answer')
+
+ // A column inserted before the cited one, likewise.
+ const recol = mk(['Quarter,Headcount,Revenue,Margin,Note',
+ 'Q1,10,1000,12%,steady',
+ 'Q2,11,1150,13%,up',
+ 'Q3,12,1240,14%,best yet'].join('\n'), 'Quarters', 'sh-q')
+ ok(resolveCell(parseAddress('Q3!Revenue')!, sourceOfDoc(workbook(recol))!.sheets).value === '1240',
+ 'nor does a column inserted before it')
+
+ // Reordering rows must not move it either — sorting a sheet is routine.
+ const sorted = mk(['Quarter,Revenue,Margin,Note',
+ 'Q3,1240,14%,best yet',
+ 'Q2,1150,13%,up',
+ 'Q1,1000,12%,steady'].join('\n'), 'Quarters', 'sh-q')
+ ok(resolveCell(parseAddress('Q3!Revenue')!, sourceOfDoc(workbook(sorted))!.sheets).value === '1240',
+ 'nor does sorting the sheet')
+}
+
+H('a miss is a miss, and says which')
+{
+ const sheets = sourceOfDoc(workbook(sheet))!.sheets
+ ok(resolveCell(parseAddress('Q9!Revenue')!, sheets).why === 'no-row', 'a row that is gone reports no-row')
+ ok(resolveCell(parseAddress('Q3!Profit')!, sheets).why === 'no-column', 'a heading that is gone reports no-column')
+ ok(resolveCell(parseAddress('Q3!Revenue')!, []).why === 'no-sheet', 'no embedded sheet at all reports no-sheet')
+ ok(resolveCell(parseAddress('Q9!Revenue')!, sheets).value === null,
+ 'and every one of them resolves to NULL, so fields.ts paints the unbound chip')
+}
+
+H('two sheets: named wins, unqualified refuses to guess')
+{
+ const other = mk(['Quarter,Revenue\nQ3,9999'].join('\n'), 'Forecast', 'sh-f')
+ const sheets = sourceOfDoc(workbook(sheet, other))!.sheets
+ ok(sheets.length === 2, 'both sheets are read')
+ ok(resolveCell(parseAddress('Quarters!Q3!Revenue')!, sheets).value === '1240', 'a named sheet resolves to its own cell')
+ ok(resolveCell(parseAddress('Forecast!Q3!Revenue')!, sheets).value === '9999', 'and the other to its')
+ ok(resolveCell(parseAddress('Q3!Revenue')!, sheets).why === 'ambiguous',
+ 'an UNQUALIFIED address that both could answer is refused, not silently taken from the first')
+ ok(resolveCell(parseAddress('Q1!Revenue')!, sheets).value === '1000',
+ 'while one only one sheet can answer still resolves')
+}
+
+H('it reaches the document through the ordinary field path')
+{
+ const doc = docWith(sheet)
+ ok(embeddedSheets(doc).length === 1, 'the sheet is found inside the embed block')
+ ok(cellResolver(doc)('Q3!Revenue') === '1240', 'the resolver answers an address')
+ ok(cellResolver(doc)('Name') === null, 'and declines anything that is not one')
+
+ const ctx = fieldContext(doc)
+ ok(resolveField({ at: 16, name: 'Q3!Revenue' }, ctx) === '1240',
+ 'resolveField returns the cell — the registration is live')
+ ok(resolveField({ at: 0, name: 'title' }, ctx) === doc.title,
+ 'and a built-in is untouched by it')
+ ok(resolveField({ at: 0, name: 'Nope!Nope' }, ctx) === null, 'an unresolvable address stays null')
+
+ // The merge row must still WIN, since live cells resolve last.
+ const withRow = fieldContext(doc, { row: { 'q3!revenue': 'FROM THE ROW' } })
+ ok(resolveField({ at: 0, name: 'Q3!Revenue' }, withRow) === 'FROM THE ROW',
+ 'a bound merge row still beats a live cell — adding this changed no existing precedence')
+
+ ok(fieldContext(emptyDoc()).cell?.('Q3!Revenue') === null ?? true,
+ 'a document embedding nothing resolves no cells and does not throw')
+}
+
+console.log(`\n${checks - bad}/${checks} checks passed`)
+if (bad) process.exit(1)
diff --git a/scripts/test-type-micro.ts b/scripts/test-type-micro.ts
new file mode 100644
index 00000000..3a5286b8
--- /dev/null
+++ b/scripts/test-type-micro.ts
@@ -0,0 +1,315 @@
+#!/usr/bin/env node
+// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+// bento/type microtypography rig. node scripts/test-type-micro.ts
+//
+// type/src/micro.ts hangs punctuation past the margin so the edge of the text
+// reads straight. The feature is small; the thing that could go wrong is not.
+//
+// THE REGRESSION THAT WOULD HURT MOST IS A REFLOW. Line breaking is the
+// browser's, pagination is measured off the line boxes it produces
+// (type/src/paginate.ts), and every saved file carries a page count that is
+// already a promise to whoever printed it. So an optical adjustment that moved
+// a single line break would move a page break, and there is no way to notice
+// that from inside the document.
+//
+// The implementation defends that in two layers and this rig checks BOTH,
+// because either alone is a promise rather than a proof:
+//
+// 1. THE MECHANISM CANNOT REFLOW. The offset is `position: relative` and a
+// `left`, which CSS 2.1 §9.4.3 says is painted-only and affects the layout
+// of no box at all. This rig reads the SHIPPED CSS and the SHIPPED code and
+// refuses anything else — a negative margin, an inline-block, a transform,
+// a letter-spacing. That is the form this bug would actually take: the
+// obvious way to hang a comma is `margin-right: -2px`, it looks identical
+// on the screenshot, and it reflows.
+// 2. THE PASS VERIFIES ITSELF. Wrapping a character in a span can still cost
+// a kern pair across the new element boundary, worth a fraction of a pixel
+// — and a fraction of a pixel is in principle enough to flip a break. So
+// the pass re-reads every line boundary after wrapping and unwraps the
+// paragraph if any of them moved. `boundariesHeld` is that decision, and
+// it is pure so that it can be exercised here rather than only in a
+// browser.
+//
+// And one more, quieter: the wrapper must be INVISIBLE TO THE MODEL. The editor
+// reads a block back out of the DOM on every keystroke, so a span the reader
+// does not understand is formatting silently invented or silently lost. The
+// round trip is checked against the same minimal parser the inline rig uses.
+//
+// What is NOT here: real layout. Node has none — getBoundingClientRect answers
+// zero for everything — so the geometry half (that the ink edge actually gets
+// straighter) is measured in a browser and reported with the change. What is
+// here is everything that decides whether that measurement is SAFE.
+
+import { readFileSync } from 'node:fs';
+import {
+ PROTRUDE_END, PROTRUDE_START, protrudes, opticalShift, boundariesHeld,
+ MIN_SHIFT, MAX_SHIFT_RATIO, LINE_EPS, opticalOn, stats, mergeLines, lineSplits, type Bearings,
+} from '../type/src/micro.ts';
+import { fromDom } from '../type/src/inline.ts';
+import { emptyDoc, parseDoc } from '../type/src/model.ts';
+
+let checks = 0, failures = 0;
+const ok = (c: boolean, m: string) => { checks++; if (!c) { failures++; console.log(` FAIL ${m}`); } else console.log(` ok ${m}`); };
+const H = (s: string) => console.log(`\n=== ${s} ===`);
+const J = (v: unknown) => JSON.stringify(v);
+
+const here = new URL('.', import.meta.url).pathname;
+const read = (p: string) => readFileSync(here + '../' + p, 'utf8');
+
+// ─────────────────────────────────────────── a minimal DOM, for the round trip
+// The same 40-line parser scripts/test-type-inline.ts carries, and for the same
+// reason: the property has to be checkable in CI, and a property only checked
+// in a browser is a property nobody checks.
+interface TNode { nodeType: 3; nodeValue: string; childNodes: TNode[] }
+interface ENode { nodeType: 1; tagName: string; attrs: Record<string, string>;
+ classList: { contains(c: string): boolean };
+ childNodes: Array<TNode | ENode>; getAttribute(n: string): string | null }
+
+const VOID = new Set(['br', 'img', 'hr']);
+function parse(html: string): ENode {
+ const mk = (tag: string, attrs: Record<string, string>): ENode => ({
+ nodeType: 1, tagName: tag.toUpperCase(), attrs, childNodes: [],
+ classList: { contains: (c: string) => (attrs.class ?? '').split(/\s+/).includes(c) },
+ getAttribute: (n: string) => attrs[n] ?? null,
+ });
+ const root = mk('div', {});
+ const stack: ENode[] = [root];
+ const re = /<\/?([a-zA-Z][a-zA-Z0-9]*)((?:\s+[a-zA-Z-]+="[^"]*")*)\s*\/?>/g;
+ let last = 0, m: RegExpExecArray | null;
+ const text = (s: string) => {
+ if (!s) return;
+ const decoded = s.replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&amp;/g, '&');
+ stack[stack.length - 1].childNodes.push({ nodeType: 3, nodeValue: decoded, childNodes: [] });
+ };
+ while ((m = re.exec(html))) {
+ text(html.slice(last, m.index));
+ last = m.index + m[0].length;
+ const tag = m[1].toLowerCase();
+ if (m[0].startsWith('</')) { if (stack.length > 1) stack.pop(); continue; }
+ const attrs: Record<string, string> = {};
+ for (const a of m[2].matchAll(/([a-zA-Z-]+)="([^"]*)"/g)) attrs[a[1]] = a[2];
+ const node = mk(tag, attrs);
+ stack[stack.length - 1].childNodes.push(node);
+ if (!VOID.has(tag) && !m[0].endsWith('/>')) stack.push(node);
+ }
+ text(html.slice(last));
+ return root;
+}
+
+// ─────────────────────────────────────────────────── which characters may hang
+H('what is allowed to hang, and at which end');
+{
+ ok(protrudes('.', 'end') && protrudes(',', 'end'), 'the full stop and the comma hang at the right margin');
+ ok(protrudes('-', 'end') && protrudes('—', 'end'), 'so do an explicit hyphen and an em dash');
+ ok(protrudes('”', 'end') && protrudes('’', 'end'), 'and closing quotes');
+ ok(protrudes('“', 'start') && protrudes('(', 'start'), 'opening quotes and brackets hang at the left');
+
+ // A LETTER MUST NOT HANG. Moving every line's last letter out by its side
+ // bearing is margin kerning — a different feature, with a different risk
+ // profile, and doing it here by accident would move every line of the
+ // document rather than the punctuated ones.
+ for (const ch of 'aeoxWy0') ok(!protrudes(ch, 'end') && !protrudes(ch, 'start'), `'${ch}' never hangs`);
+ ok(!protrudes(' ', 'end'), 'nor a space');
+
+ // the closing marks belong at the closing end and vice versa
+ ok(!protrudes('“', 'end'), 'an OPENING quote does not hang off the right margin');
+ ok(!protrudes('.', 'start'), 'a full stop does not hang off the left one');
+ ok(PROTRUDE_END.size > 0 && PROTRUDE_START.size > 0, 'both sets are populated');
+}
+
+// ─────────────────────────────────────────────────────────── how far it moves
+H('the offset is the side bearing, and nothing more');
+{
+ // a period in a 17px serif: ~4.6px advance, ink from 1.5 to 3.1
+ const period: Bearings = { advance: 4.6, inkLeft: 1.5, inkRight: 3.1 };
+ const s = opticalShift('.', 'end', period);
+ ok(Math.abs(s - 1.5) < 1e-9, `it moves right by the right side bearing: ${s.toFixed(2)}px`);
+ ok(s > 0, 'positive is out into the margin at the right edge');
+
+ // Ink flush is the OPTIMUM of the stated objective, so overshooting it is a
+ // regression and not a taste. After the shift the ink's right edge sits
+ // exactly on the advance box's right edge — i.e. on the margin.
+ ok(Math.abs((period.inkRight + s) - period.advance) < 1e-9,
+ 'after the shift the ink ends exactly where the advance box did — on the margin');
+
+ const quote: Bearings = { advance: 5.2, inkLeft: 1.1, inkRight: 4.9 };
+ const q = opticalShift('“', 'start', quote);
+ ok(Math.abs(q + 1.1) < 1e-9, `an opening quote moves LEFT by its left bearing: ${q.toFixed(2)}px`);
+ ok(q < 0, 'negative is out into the margin at the left edge');
+
+ ok(opticalShift('e', 'end', period) === 0, 'a character that may not hang gets no offset at all');
+
+ // clamps
+ const wild: Bearings = { advance: 4, inkLeft: 0, inkRight: 0 };
+ ok(Math.abs(opticalShift('.', 'end', wild) - 4 * MAX_SHIFT_RATIO) < 1e-9,
+ `an absurd bearing is capped at ${MAX_SHIFT_RATIO} of the advance — a substituted fallback face cannot throw a comma across the page`);
+ const overhang: Bearings = { advance: 4, inkLeft: -0.9, inkRight: 4.9 };
+ ok(opticalShift('’', 'end', overhang) < 0,
+ 'ink that already overhangs its box is pulled back IN, not pushed further out (italic and script faces)');
+ const tiny: Bearings = { advance: 4, inkLeft: 0.1, inkRight: 3.9 };
+ ok(opticalShift('.', 'end', tiny) === 0, `under ${MIN_SHIFT}px is not worth a wrapper and is dropped`);
+ ok(opticalShift('.', 'end', { advance: 0, inkLeft: 0, inkRight: 0 }) === 0, 'a zero advance yields nothing');
+ ok(opticalShift('.', 'end', { advance: NaN, inkLeft: 1, inkRight: 1 }) === 0, 'and so does a NaN');
+}
+
+// ────────────────────────────────────── THE ONE THAT MATTERS: no line moved
+H('the runtime guard: a paragraph whose line boundaries moved is unwrapped');
+{
+ // Three lines. `tops` is where they were, `after` where they are now, and
+ // the last two arrays say which line each line's LAST and FIRST character was
+ // found on afterwards. Held means every one of them is still on its own line.
+ const tops = [100, 120, 140];
+ const held = boundariesHeld(tops, [100, 120, 140], [0, 1, 2], [0, 1, 2]);
+ ok(held, 'nothing moved: the wrapping stands');
+
+ ok(!boundariesHeld(tops, [100, 120], [0, 1, 2], [0, 1, 2]),
+ 'a paragraph that lost a line is REJECTED — the reflow this feature must never cause');
+ ok(!boundariesHeld(tops, [100, 120, 140, 160], [0, 1, 2], [0, 1, 2]), 'and one that gained a line');
+
+ // THE ONE THAT GOT THROUGH. Measured on a real 14-page document: wrapping the
+ // comma of "…including time-sheets," cost the kern between the "s" and the
+ // ",", the word stopped fitting, and the break moved back to the hyphen in
+ // "time-". The line COUNT was unchanged, every line TOP was unchanged, and
+ // the character that OPENED line 1 was still on line 1 — the word had simply
+ // moved down onto it. Only the line's LAST character betrays this.
+ ok(!boundariesHeld(tops, [100, 120, 140], [1, 1, 2], [0, 1, 2]),
+ "a word that fell off the end of line 0 onto line 1 is caught — the one-sided check passed this on a real document");
+ ok(!boundariesHeld(tops, [100, 120, 140], [0, 1, 2], [0, 0, 2]),
+ 'and a word pulled UP from line 1 onto line 0, which is the same bug mirrored');
+
+ ok(boundariesHeld([100], [100.2], [0], [0]),
+ `sub-pixel noise inside ${LINE_EPS}px is not a reflow`);
+ ok(!boundariesHeld(tops, [100, 121.2, 140], [0, 1, 2], [0, 1, 2]),
+ 'but a line that actually shifted is');
+
+ // A rect we could not read comes back -1 (or NaN), and it must FAIL rather
+ // than pass — "I could not tell" is not "it was fine".
+ ok(!boundariesHeld(tops, [100, 120, 140], [0, -1, 2], [0, 1, 2]),
+ 'an unreadable line is treated as a failure, not as a pass');
+ ok(!boundariesHeld(tops, [100, NaN, 140], [0, 1, 2], [0, 1, 2]),
+ 'and so is an unreadable line top');
+ ok(!boundariesHeld(tops, [100, 120, 140], [0, 1], [0, 1, 2]),
+ 'a short observation array is a failure too, not a silently shorter loop');
+}
+
+// ─────────────────────────────────────────── rects are fragments, not lines
+H('client rects are merged into lines before anything is measured');
+{
+ // Range.getClientRects() returns one rect per rendered FRAGMENT. A line
+ // carrying a bold run comes back as two, each ending mid-line — read as
+ // lines, the paragraphs with the most formatting are exactly the ones that
+ // quietly stop hanging, because no "line" appears to reach the margin.
+ const R = (top: number, bottom: number, left: number, right: number) =>
+ ({ top, bottom, left, right, height: bottom - top, width: right - left }) as DOMRect;
+ const lines = mergeLines([R(0, 20, 0, 300), R(0, 20, 300, 608), R(20, 40, 0, 608)]);
+ ok(lines.length === 2, `three fragments over two lines merge to two lines (got ${lines.length})`);
+ ok(lines[0].left === 0 && lines[0].right === 608, 'the merged line spans from the first fragment to the last');
+
+ // a superscript footnote marker sits higher than the text it rides on and is
+ // still on that line — so the grouping is by overlap, not by an equal top
+ const withSup = mergeLines([R(0, 20, 0, 300), R(-6, 8, 300, 310), R(0, 20, 310, 608)]);
+ ok(withSup.length === 1, 'a raised footnote marker does not become a line of its own');
+ ok(withSup[0].right === 608, 'and the line still reaches the margin');
+
+ ok(mergeLines([]).length === 0, 'no rects, no lines');
+ ok(mergeLines([R(0, 0.2, 0, 300)]).length === 0, 'a zero-height rect is not a line');
+
+ // the split used to decide which line a character is on sits between them
+ const s = lineSplits(mergeLines([R(0, 20, 0, 608), R(24, 44, 0, 608)]));
+ ok(s.length === 1 && Math.abs(s[0] - 22) < 1e-9, `one split, midway between the lines: ${s[0]}`);
+}
+
+// ──────────────────────────────── the mechanism, as it is actually shipped
+H('the shipped CSS and code can only paint, never lay out');
+{
+ const css = read('type/src/styles.css');
+ const print = read('type/src/print.ts');
+ ok(/\.t-hang\s*\{\s*position:\s*relative;\s*\}/.test(css),
+ 'styles.css gives .t-hang relative positioning and nothing else');
+ ok(/\.t-hang\s*\{\s*position:\s*relative;\s*\}/.test(print),
+ 'and print.ts ships the same rule, so paper and screen hang identically');
+
+ // The bug this catches by name: hanging a comma with `margin-right: -2px`
+ // looks the same and reflows the paragraph.
+ const rule = (src: string) => (src.match(/\.t-hang\s*\{[^}]*\}/) ?? [''])[0];
+ const BANNED = /(margin|padding|width|display|float|transform|letter-spacing|word-spacing|font-|text-indent)/;
+ ok(!BANNED.test(rule(css)), 'the screen rule declares no property that could move another box');
+ ok(!BANNED.test(rule(print)), 'nor the print one');
+
+ // and the code may only ever set `left`
+ const micro = read('type/src/micro.ts');
+ const props = [...micro.matchAll(/span\.style\.([A-Za-z]+)\s*=/g)].map(m => m[1]);
+ ok(props.length > 0 && props.every(p => p === 'left'),
+ `the pass sets only 'left' on a wrapper (found: ${J([...new Set(props)])})`);
+ ok(!/span\.style\.cssText/.test(micro), 'and never a cssText it could smuggle anything through');
+}
+
+// ───────────────────────────────────────── invisible to the model
+H('a wrapper is transparent to the block reader');
+{
+ // The editor reads a block back out of the DOM on every keystroke. If the
+ // reader saw the wrapper, a paragraph would gain or lose formatting simply
+ // by being hung — and it would do it silently, on a document someone may
+ // already have signed.
+ const bare = '<p>He said <strong>no</strong>, twice.</p>';
+ const hung = '<p>He said <strong>no</strong><span class="t-hang" style="left:1.50px">,</span> twice<span class="t-hang" style="left:1.50px">.</span></p>';
+ const a = fromDom(parse(bare) as unknown as Node);
+ const b = fromDom(parse(hung) as unknown as Node);
+ ok(a.text === b.text, `the text is byte-identical: ${J(a.text)}`);
+ ok(J(a.marks) === J(b.marks), 'and so are the marks — the wrapper contributes none');
+ ok(b.text.includes(', twice.'), 'the punctuation is still IN the text, only painted elsewhere');
+
+ // one wrapped inside a mark, which is where a naive reader would split a run
+ const inside = '<p>He said <strong>no<span class="t-hang" style="left:1.50px">.</span></strong></p>';
+ const c = fromDom(parse(inside) as unknown as Node);
+ ok(J(c.marks) === J([{ t: 'b', from: 8, to: 11 }]),
+ `a wrapper inside a bold run does not split it: ${J(c.marks)}`);
+}
+
+// ───────────────────────────────────────────────────── the document property
+H('doc.optical — absent means on, and only `false` is stored');
+{
+ const fresh = emptyDoc();
+ ok(fresh.optical === undefined, 'a new document says nothing about it');
+ ok(opticalOn(fresh), 'and is therefore on');
+ ok(opticalOn({ optical: true }), 'true is on');
+ ok(!opticalOn({ optical: false }), 'false is off, and false is the only way to be off');
+
+ // A file written before this existed is the case that matters: it must open,
+ // and it must open with the feature on, because what it promised was its
+ // PAGINATION and that is untouched.
+ const old = parseDoc(JSON.stringify({ ...emptyDoc(), optical: undefined }));
+ ok(old.ok && old.doc.optical === undefined, 'an old file parses with no such field');
+ ok(old.ok && opticalOn(old.doc), 'and renders with optical margins on');
+
+ const off = parseDoc(JSON.stringify({ ...emptyDoc(), optical: false }));
+ ok(off.ok && off.doc.optical === false, 'a document that turned it off keeps it off through a parse');
+ const again = off.ok ? parseDoc(JSON.stringify(off.doc)) : off;
+ ok(again.ok && again.doc.optical === false, 'and through a save and a reopen');
+
+ const on = parseDoc(JSON.stringify({ ...emptyDoc(), optical: true }));
+ ok(on.ok && on.doc.optical === undefined, 'an explicit true is normalised away — the default carries no information');
+ const junk = parseDoc(JSON.stringify({ ...emptyDoc(), optical: 'yes please' }));
+ ok(junk.ok && junk.doc.optical === undefined, 'and junk is dropped rather than ridden along as truthy');
+}
+
+// ──────────────────────────────────────────────────────── the measurement
+H('the measurement the feature is justified by');
+{
+ const s = stats([-2, -1, 0, 1, 2]);
+ ok(s.n === 5 && Math.abs(s.mean) < 1e-12 && Math.abs(s.sd - Math.sqrt(2)) < 1e-12,
+ `mean and standard deviation of the ink offsets: n=${s.n} sd=${s.sd.toFixed(4)}`);
+ ok(stats([]).n === 0, 'an empty sample does not divide by zero');
+
+ // the claim, restated as arithmetic: hanging removes the right side bearing
+ // from each line's shortfall, so a sample of shortfalls shrinks toward zero
+ const before = [1.5, 0, 1.5, 0.9, 0, 1.5]; // periods, commas, letters
+ const rsb = [1.5, 0, 1.5, 0.9, 0, 1.5];
+ const after = before.map((b, i) => b - rsb[i]);
+ ok(stats(after).sd < stats(before).sd,
+ `removing the side bearing shrinks the spread of the ink edge: sd ${stats(before).sd.toFixed(3)} → ${stats(after).sd.toFixed(3)}`);
+}
+
+console.log(`\n${checks - failures}/${checks} checks passed`);
+process.exit(failures ? 1 : 0);
diff --git a/type/src/canon.ts b/type/src/canon.ts
index d3e045ab..5c30e835 100644
--- a/type/src/canon.ts
+++ b/type/src/canon.ts
@@ -47,13 +47,26 @@ function num(n: number): string {
return String(n);
}
-/** RFC 8785 string serialization: minimal escaping, NFC-normalized. */
+/**
+ * RFC 8785 string serialization: minimal escaping, NFC-normalized.
+ *
+ * LONE SURROGATES ARE ESCAPED, and that is not a detail. `JSON.parse('"\\ud800"')`
+ * succeeds, so a document really can carry an unpaired surrogate — and
+ * TextEncoder maps EVERY one of them to U+FFFD. Emitted literally, "a\uD800b",
+ * "a\uDC00b" and "a�b" would be three different documents sharing ONE
+ * digest, so a signature over any of them verifies against the other two. That
+ * is a collision, which is to say a forgery. Escaping them — what ES2019's
+ * well-formed JSON.stringify does, and what RFC 8785 §3.2.2.2 points at — keeps
+ * the map from documents to bytes injective. Well-formed pairs are still
+ * emitted literally; `for…of` yields those as one code point above 0xFFFF.
+ */
function str(s: string): string {
const t = s.normalize('NFC');
let out = '"';
for (const ch of t) {
const c = ch.codePointAt(0) ?? 0;
- if (ch === '"') out += '\\"';
+ if (c >= 0xd800 && c <= 0xdfff) out += '\\u' + c.toString(16).padStart(4, '0');
+ else if (ch === '"') out += '\\"';
else if (ch === '\\') out += '\\\\';
else if (c === 0x08) out += '\\b';
else if (c === 0x0c) out += '\\f';
@@ -69,6 +82,17 @@ function str(s: string): string {
/**
* Canonical JSON. Keys sorted by UTF-16 code unit (RFC 8785 §3.2.3), volatile
* fields dropped at EVERY level, no insignificant whitespace.
+ *
+ * KEYS ARE NORMALIZED BEFORE THEY ARE SORTED. Rule 1 at the top of this file
+ * normalizes text to NFC, and a key is text. Normalizing on the way out but
+ * sorting on the way in is the worst of both: "é" spelled U+00E9 sorts after
+ * "z" while the same key spelled U+0065 U+0301 sorts before it, so one document
+ * digests two ways depending on which keyboard produced the field name — the
+ * exact determinism failure rule 1 exists to prevent. Sorting the normalized
+ * form also makes the collision visible instead of silent: two keys that
+ * normalize alike would otherwise emit an object with DUPLICATE keys, in
+ * insertion order, which is neither valid JSON nor deterministic. That is
+ * refused rather than serialized.
*/
export function canonicalize(value: unknown, { volatile = VOLATILE } = {}): string {
const go = (v: unknown): string => {
@@ -79,10 +103,15 @@ export function canonicalize(value: unknown, { volatile = VOLATILE } = {}): stri
if (Array.isArray(v)) return '[' + v.map(go).join(',') + ']';
if (typeof v === 'object') {
const o = v as Record<string, unknown>;
- const keys = Object.keys(o)
- .filter(k => !volatile.has(k) && o[k] !== undefined)
- .sort(); // UTF-16 code-unit order
- return '{' + keys.map(k => str(k) + ':' + go(o[k])).join(',') + '}';
+ const src = new Map<string, string>(); // normalized key -> as written
+ for (const k of Object.keys(o)) {
+ const n = k.normalize('NFC');
+ if (volatile.has(n) || o[k] === undefined) continue;
+ if (src.has(n)) throw new TypeError(`duplicate key after NFC normalization: ${n}`);
+ src.set(n, k);
+ }
+ const keys = [...src.keys()].sort(); // UTF-16 code-unit order
+ return '{' + keys.map(k => str(k) + ':' + go(o[src.get(k)!])).join(',') + '}';
}
throw new TypeError(`cannot canonicalize ${typeof v}`);
};
@@ -124,9 +153,37 @@ export const exportPub = async (k: CryptoKeyPair): Promise<string> =>
b64u(await crypto.subtle.exportKey('raw', k.publicKey));
/**
- * Sign a revision, chaining to the previous signature.
+ * The bytes a signature is taken over.
+ *
+ * bento-type-sig.v1|<docId>|<content digest>|<prev sig or "">|<name>
*
- * The signed text is `bento-type-sig.v1|<docId>|<content digest>|<prev sig or "">`.
+ * THE NAME IS IN HERE, and it was not always. `name` is self-asserted — the
+ * signer chooses it and no crypto makes it true — but "self-asserted" has to
+ * mean asserted BY THE SIGNER, and while the name sat outside the signed text
+ * it was asserted by whoever held the file last: anyone could take a valid
+ * signature, rewrite `name` to somebody else's, and the Signatures panel would
+ * print that name beside a green ✓ valid. A claim the signature does not
+ * support is exactly what the panel warns about; it must not be one the panel
+ * itself manufactures. Bound in before bento/type's first release, so no
+ * shipped signature is invalidated.
+ *
+ * `at` is deliberately NOT in here. It is a self-asserted wall clock that can
+ * be backdated freely, the panel does not render it, and the model says it
+ * proves nothing — signing it would only lend it the credibility it must not
+ * have.
+ *
+ * docId and name are emitted through `str()` — quoted, escaped and
+ * NFC-normalized — because they are the two variable-length fields a document
+ * controls. Unquoted, a docId of `x|<digest>|<sig>` could shift every field
+ * right and make one signature's text collide with another's. The digests
+ * between them are fixed-alphabet base64url and cannot. Normalizing also means
+ * a name typed on a Mac verifies on Windows, which is rule 1 again.
+ */
+const sigText = (docId: string, content: string, prev: string, name: string) =>
+ `bento-type-sig.v1|${str(docId)}|${content}|${prev}|${str(name)}`;
+
+/**
+ * Sign a revision, chaining to the previous signature.
*
* Chaining is what buys ORDER without a trusted clock. A self-asserted
* timestamp can be backdated freely, so it is carried for display and
@@ -142,7 +199,7 @@ export async function sign(
): Promise<Signature> {
const content = await digest(doc);
const prevSig = prev ? prev.sig : '';
- const text = `bento-type-sig.v1|${doc.docId}|${content}|${prevSig}`;
+ const text = sigText(doc.docId, content, prevSig, name);
const sig = b64u(await crypto.subtle.sign(SIG, key.privateKey, enc.encode(text)));
return { alg: 'ES256', pub: await exportPub(key), name, content, prev: prevSig, sig };
}
@@ -151,7 +208,7 @@ export async function verify(doc: { docId: string }, entry: Signature): Promise<
const content = await digest(doc);
if (content !== entry.content) return { ok: false, why: 'content-changed' };
const pub = await crypto.subtle.importKey('raw', unb64u(entry.pub), EC, false, ['verify']);
- const text = `bento-type-sig.v1|${doc.docId}|${entry.content}|${entry.prev}`;
+ const text = sigText(doc.docId, entry.content, entry.prev, entry.name ?? '');
const ok = await crypto.subtle.verify(SIG, pub, unb64u(entry.sig), enc.encode(text));
return { ok, why: ok ? null : 'bad-signature' };
}
diff --git a/type/src/compare.css b/type/src/compare.css
new file mode 100644
index 00000000..d20bc572
--- /dev/null
+++ b/type/src/compare.css
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: MIT */
+/* Copyright (c) 2026 The Bento authors */
+
+/* compare.ts — the "compare with another document" dialog.
+ Reuses the house chrome (.t-overlay + .t-dlg + .t-btn); this file adds only
+ the drop target, which nothing else in bento/type has. CHROME tokens only:
+ the dialog floats over the page and follows the reader's theme, so a
+ --paper token here would be a white box in the dark theme (the bug class
+ scripts/test-type-theme.mjs exists for). */
+
+.t-compare { width: min(460px, 100%); }
+.t-compare h3 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
+
+.t-compare-drop {
+ display: flex; flex-direction: column; align-items: center; gap: 10px;
+ margin-top: 14px; padding: 22px 16px;
+ border: 1px dashed var(--line); border-radius: 10px;
+ background: var(--chrome-2); color: var(--muted);
+ font-size: 12.5px; text-align: center;
+}
+/* The whole point of a drop target is that it says when it has you. */
+.t-compare-drop.over {
+ border-style: solid; border-color: var(--accent);
+ background: color-mix(in srgb, var(--accent) 12%, transparent);
+ color: var(--ink);
+}
+/* Nothing inside may become the drag target itself, or moving the pointer
+ over the button fires dragleave and the zone flickers out from under it. */
+.t-compare-drop.over * { pointer-events: none; }
diff --git a/type/src/compare.ts b/type/src/compare.ts
new file mode 100644
index 00000000..64cf8e49
--- /dev/null
+++ b/type/src/compare.ts
@@ -0,0 +1,201 @@
+// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+//
+// COMPARE WITH A FILE — the surface over comparedoc.ts.
+//
+// comparedoc.ts reads the other document and decides the direction; this file
+// asks for the file, says what happened in the reader's language, and hands the
+// change set to redlineview.ts to paint. The split is redline.ts/redlineview.ts
+// again, and for the same reason: the part that can be silently wrong is
+// testable in node, and the part that needs a browser holds no correctness.
+//
+// TWO RULES THIS FILE EXISTS TO KEEP.
+//
+// 1. IT IS A VIEW. Comparing must not touch the document and must not reach the
+// saved file — the rule the theme and the locale already follow. Concretely:
+// the panel offers no Accept/Reject here, because "reject" against a base
+// that is somebody ELSE'S document means adopting their text wholesale,
+// which is a merge and not a comparison. `showComparison` is passed
+// `resolvable:false` for exactly that, and nothing in this file calls
+// `store.commit`.
+//
+// 2. THE DIRECTION IS SAID OUT LOUD, in the heading, naming both ends — never
+// shortened to "7 changes". A redline nobody can orient is worse than none,
+// and the cards cannot carry the orientation themselves.
+//
+// The degenerate cases are as much the feature as the diff is: a file from
+// another Bento app, a file that is not Bento at all, corrupt JSON, an
+// identical file (answered, never painted as an empty list), and a document
+// with a different docId — that last one being LEGITIMATE, since comparing two
+// unrelated documents is a real thing to want, but usually the wrong file. So
+// it is noted, not refused.
+
+import './compare.css';
+import { t } from './i18n.ts';
+import { registerMenuItem, type FeatureContext } from './features.ts';
+import { compareDocs, readTypeDoc, type CompareRead } from './comparedoc.ts';
+import { pickFile } from './embed.ts';
+import { showComparison } from './redlineview.ts';
+
+const el = (tag: string, cls?: string): HTMLElement => {
+ const n = document.createElement(tag); if (cls) n.className = cls; return n;
+};
+
+/** Everything a saved `.bento.html` or a bare document may arrive as. */
+const ACCEPT = '.html,text/html,.json,application/json';
+
+/**
+ * The reason a comparison could not be made, in the reader's language.
+ *
+ * Built here rather than in comparedoc.ts so the reading half stays free of
+ * i18n and runs in node — and every `t()` sits inside a function, never in a
+ * module-level const where it would freeze before the viewer's locale resolves.
+ */
+function whyNot(r: Extract<CompareRead, { ok: false }>): string {
+ switch (r.kind) {
+ case 'other-app':
+ return t('That is a {app} file, not a bento/type document.').replace('{app}', r.found ?? '');
+ case 'not-bento':
+ return t('That file does not look like a bento/type document.');
+ case 'empty':
+ return t('That file has no document in it.');
+ default:
+ return t('That file could not be read: {detail}').replace('{detail}', r.detail);
+ }
+}
+
+/**
+ * The caveats worth raising once a comparison HAS been made.
+ *
+ * A thunk, and it stays one all the way into the panel: the panel repaints on
+ * every store event and the About dialog can change locale under it, so a
+ * string resolved at compare time would be the wrong language from then on.
+ */
+function caveats(cmp: { sameDocId: boolean }, repaired: string[]): () => string {
+ const parts: Array<() => string> = [];
+ if (!cmp.sameDocId) {
+ parts.push(() => t('That file is a different document, not another copy of this one — comparing unrelated documents works, but check you picked the file you meant.'));
+ }
+ if (repaired.length) {
+ parts.push(() => (repaired.length === 1
+ ? t('One problem in that file was repaired as it was read, which can itself appear below as a change.')
+ : t('{n} problems in that file were repaired as it was read, which can themselves appear below as changes.')
+ .replace('{n}', String(repaired.length))));
+ }
+ parts.push(() => t('This is a view: changes are shown, never applied. Accept and reject are offered only against a Snapshot of this document.'));
+ return () => parts.map(p => p()).join(' ');
+}
+
+/** Read one picked or dropped file, and either explain the problem or show the redline. */
+export async function compareWithFile(ctx: FeatureContext, file: File): Promise<void> {
+ let text: string;
+ try { text = await file.text(); }
+ catch (e) { ctx.toast(t('That file could not be read: {detail}').replace('{detail}', (e as Error).message)); return; }
+
+ const read = readTypeDoc(text);
+ if (!read.ok) { ctx.toast(whyNot(read)); return; }
+
+ const live = ctx.store.doc;
+ const cmp = compareDocs(read.doc, live, live.meta?.author || 'you');
+
+ // An empty redline is indistinguishable from a comparison that never
+ // happened, so this case is ANSWERED and the panel is never opened on it.
+ if (cmp.identical) {
+ ctx.toast(t('That file is identical to this document — there is nothing to compare.'));
+ return;
+ }
+
+ const n = cmp.set.changes.length;
+ showComparison(ctx, {
+ base: { docId: read.doc.docId, body: read.doc.body },
+ set: cmp.set,
+ heading: () => (n === 1
+ ? t('1 change from “{file}” to this document')
+ : t('{n} changes from “{file}” to this document').replace('{n}', String(n))
+ ).replace('{file}', file.name),
+ note: caveats(cmp, read.repaired),
+ resolvable: false,
+ });
+}
+
+/**
+ * ⋯ → Compare with a file…
+ *
+ * A dialog rather than a bare file picker, for two reasons that are both about
+ * the direction: it is the only place with room to say which way the redline
+ * will read BEFORE the reader is looking at one, and a drop target only exists
+ * if there is something to drop onto. bento/type has no other drop handling, so
+ * the zone is scoped to this box rather than to the page — a document-wide
+ * handler would be sitting in the way of the one pictures will want later.
+ */
+export function openCompare(ctx: FeatureContext): void {
+ const back = el('div', 't-overlay');
+ const box = el('div', 't-dlg t-compare');
+ box.setAttribute('role', 'dialog');
+ box.setAttribute('aria-modal', 'true');
+
+ const h = el('h3');
+ h.textContent = t('Compare with another document');
+ box.appendChild(h);
+
+ const blurb = el('p', 't-about-blurb');
+ blurb.textContent = t('Choose another bento/type file. The redline shows what changed from that file to this document. Comparing never changes what you have open.');
+ box.appendChild(blurb);
+
+ const zone = el('div', 't-compare-drop');
+ const zoneText = el('div');
+ zoneText.textContent = t('Drop a Bento document here');
+ const choose = el('button', 't-btn') as HTMLButtonElement;
+ choose.type = 'button';
+ choose.textContent = t('Choose a file…');
+ zone.append(zoneText, choose);
+ box.appendChild(zone);
+
+ const foot = el('div', 't-dlg-foot');
+ const cancel = el('button', 't-btn') as HTMLButtonElement;
+ cancel.type = 'button';
+ cancel.textContent = t('Cancel');
+ foot.appendChild(cancel);
+ box.appendChild(foot);
+
+ const onKey = (e: KeyboardEvent) => { if (e.key === 'Escape') { e.preventDefault(); close(); } };
+ function close(): void {
+ window.removeEventListener('keydown', onKey, true);
+ back.remove();
+ }
+ const take = (f: File | null | undefined): void => {
+ if (!f) return;
+ close();
+ void compareWithFile(ctx, f);
+ };
+
+ cancel.addEventListener('click', close);
+ choose.addEventListener('click', () => { void pickFile(ACCEPT).then(take); });
+ // `dragover` MUST be prevented, on the scrim as well as the zone: without it
+ // the browser navigates to the dropped file, which throws away the document
+ // the reader has open. That is the one failure mode here that loses work.
+ zone.addEventListener('dragover', e => { e.preventDefault(); zone.classList.add('over'); });
+ zone.addEventListener('dragleave', () => zone.classList.remove('over'));
+ zone.addEventListener('drop', e => {
+ e.preventDefault();
+ zone.classList.remove('over');
+ take(e.dataTransfer?.files?.[0]);
+ });
+ back.addEventListener('dragover', e => e.preventDefault());
+ back.addEventListener('drop', e => e.preventDefault());
+ back.addEventListener('mousedown', e => { if (e.target === back) close(); });
+ window.addEventListener('keydown', onKey, true);
+
+ back.appendChild(box);
+ document.body.appendChild(back);
+ choose.focus();
+}
+
+registerMenuItem({
+ id: 'compare',
+ // a thunk, not t('…') — see features.ts's `Label`
+ label: () => t('Compare with a file…'),
+ // beside the snapshot review whose panel it borrows
+ order: 35,
+ run: openCompare,
+});
diff --git a/type/src/comparedoc.ts b/type/src/comparedoc.ts
new file mode 100644
index 00000000..ff104444
--- /dev/null
+++ b/type/src/comparedoc.ts
@@ -0,0 +1,113 @@
+// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+//
+// COMPARING TWO DOCUMENTS — the reading and the direction. No DOM, no i18n.
+//
+// This is to compare.ts what redline.ts is to redlineview.ts: the part with the
+// correctness in it, kept free of the chrome so scripts/test-type-compare.ts
+// can drive it in node against a file this app actually wrote. The rig cannot
+// import the surface — the surface imports a stylesheet — and more to the
+// point, the two questions that can be silently WRONG here (did we read the
+// right document, and which way round is the diff) are both answerable without
+// a browser.
+//
+// redline.ts has been able to diff two documents since it was written; what it
+// never had was a second document to diff against. `startReview` hands it a
+// revision of THIS document out of `doc.revisions`, so the whole feature could
+// only ever answer "what have I changed since I pressed Snapshot". The question
+// people actually have about a contract is the other one: THEY sent it back —
+// what did they change? That needs a second FILE and nothing more:
+//
+// file → parseDoc → redline(THAT file, THIS document) → redlineview
+//
+// THE DIRECTION IS THE WHOLE THING. `redline(before, after)` reports what turns
+// `before` into `after`; the OTHER file is `before` and the live document is
+// `after`, so a <del> is their text and an <ins> is yours. Read backwards that
+// is exactly wrong and entirely plausible — an insertion and a deletion look
+// identical if you have the ends swapped — and no card on screen carries the
+// information to tell the difference. Which is why compare.ts names both ends
+// in the heading every time, and why the rig pins the orientation rather than
+// only the change COUNT (a count is symmetric and would pass either way).
+//
+// AN EMPTY RESULT IS NOT A RESULT, either. Two identical documents and a
+// comparison that silently failed both come out as zero changes, so `identical`
+// is reported as its own fact rather than left for a caller to infer from an
+// empty list.
+
+import { parseDoc, type TypeDoc } from './model.ts';
+import { redline, type ChangeSet } from './redline.ts';
+import { DOC_BLOCK } from './embed.ts';
+
+/**
+ * What the user handed us, reduced to the document JSON.
+ *
+ * Two shapes are accepted because the DOCUMENT is this suite's interchange
+ * unit: a saved `.bento.html` shell is what sits on disk, and the bare JSON is
+ * what a chat AI can actually hand back (About → "Copy document JSON" is the
+ * other end of that round trip).
+ *
+ * `from` matters for the error message and nothing else: a `.html` file with no
+ * `#bento-doc` block is not corrupt JSON — it is not a Bento file — and telling
+ * someone their web page has a syntax error at position 1 helps nobody.
+ */
+export function extractDocJson(text: string): { json: string; from: 'shell' | 'raw' } {
+ const m = DOC_BLOCK.exec(text);
+ return m ? { json: m[1], from: 'shell' } : { json: text, from: 'raw' };
+}
+
+export type CompareRead =
+ | { ok: true; doc: TypeDoc; repaired: string[] }
+ | { ok: false; kind: 'empty' | 'json' | 'shape' | 'other-app' | 'not-bento'; detail: string; found?: string };
+
+/**
+ * Read a bento/type document out of a saved shell or a bare `.json`.
+ *
+ * `parseDoc` does the validating — including refusing another app's format
+ * outright, which is the check that makes "compare with a file" safe to point
+ * at a folder of mixed Bento files. Its repairs are SURFACED rather than
+ * swallowed: a repair can invent a block id, the redline aligns blocks by id,
+ * and an invented id shows up as a change nobody made.
+ */
+export function readTypeDoc(text: string): CompareRead {
+ const { json, from } = extractDocJson(text);
+ // Markup with no document in it — named for what it is, before parseDoc gets
+ // a chance to report the whole web page as a JSON syntax error.
+ if (from === 'raw' && json.trimStart().startsWith('<')) {
+ return { ok: false, kind: 'not-bento', detail: 'no #bento-doc block' };
+ }
+ const r = parseDoc(json);
+ if (r.ok) return { ok: true, doc: r.doc, repaired: r.repaired };
+ if (r.err === 'empty') return { ok: false, kind: 'empty', detail: '' };
+ if (r.err === 'format') {
+ // A sibling app's file is a different sentence from a stranger's: one tells
+ // you which app to open it in, the other that it is not ours at all.
+ return { ok: false, found: r.found, detail: r.detail,
+ kind: r.found?.startsWith('bento/') ? 'other-app' : 'not-bento' };
+ }
+ return { ok: false, kind: r.err, detail: r.detail };
+}
+
+export interface Comparison {
+ set: ChangeSet;
+ /** the two documents claim the same identity — that file is a copy of THIS one */
+ sameDocId: boolean;
+ /** no differences at all: say so, never paint an empty list as a result */
+ identical: boolean;
+}
+
+/**
+ * Diff another document against this one.
+ *
+ * `other` is `before` and `live` is `after` — see the header. The author on the
+ * change set is the LIVE document's, because the changes being described are
+ * the ones this copy carries relative to theirs.
+ *
+ * PURE. Comparing is a view: nothing here writes to either document, and
+ * nothing here may start to.
+ */
+export function compareDocs(other: TypeDoc, live: TypeDoc, author = 'you'): Comparison {
+ const set = redline({ docId: other.docId, body: other.body },
+ { docId: live.docId, body: live.body },
+ { author });
+ return { set, sameDocId: other.docId === live.docId, identical: set.changes.length === 0 };
+}
diff --git a/type/src/editor.ts b/type/src/editor.ts
index ca7a2ed3..af34d329 100644
--- a/type/src/editor.ts
+++ b/type/src/editor.ts
@@ -19,6 +19,7 @@
// model, so it is suppressed and every ⌘Z goes through the store.
import { renderBody, renderBlock, readBlock, isNoteAtom, TAG } from './render.ts';
+import { fillFields } from './fields.ts';
import { toggleMark, activeAt, setFont, fontAcross, type MarkType, type FontAttrs } from './inline.ts';
import { isList, uid, MAX_LIST_LEVEL, type Block, type TypeDoc } from './model.ts';
import type { Store } from './store.ts';
@@ -189,7 +190,14 @@ export class Editor {
// every keystroke, and renderBody rebuilds every paragraph in the
// document — on a long contract that is a visible stall per character.
const fresh = renderBlock(tracked);
+ // Derived content in the fresh block has to be filled, or it renders as
+ // its placeholder: `blockHtml` emits a field atom UNRESOLVED and the
+ // filler puts the value in (fields.ts, mirroring numberXrefs). renderBody
+ // does that for a whole-document render; this path replaces one block and
+ // never reaches it, so a field in a TRACKED document flashed back to its
+ // own name on every keystroke in that paragraph.
el.replaceWith(fresh);
+ fillFields(fresh, this.store.doc);
if (caretAt !== undefined) this.setCaret({ id: c.id, at: caretAt });
}
this.onChange?.();
diff --git a/type/src/embed.ts b/type/src/embed.ts
index dc271b56..8e599b42 100644
--- a/type/src/embed.ts
+++ b/type/src/embed.ts
@@ -203,7 +203,12 @@ export async function insertEmbed(ctx: FeatureContext): Promise<void> {
* the file, already static, already safe to show without running anything —
* so an embed of a saved Bento file costs no new rendering anywhere.
*/
-const DOC_BLOCK = /<script[^>]*\bid=["']bento-doc["'][^>]*>([\s\S]*?)<\/script>/i;
+// Exported because compare.ts reads a bento/type document out of a saved shell
+// the same way. The splice contract this pattern encodes (PLATFORM §2 —
+// plaintext JSON at a known id, in every Bento file ever written) must have
+// exactly ONE spelling in this app; two copies of the regex would be two
+// independent bets on the same contract, and only one of them would get fixed.
+export const DOC_BLOCK = /<script[^>]*\bid=["']bento-doc["'][^>]*>([\s\S]*?)<\/script>/i;
const PREVIEW = /data-bento-preview[^>]*>[\s\S]*?(<svg[\s\S]*?<\/svg>)/i;
export function readArtifact(html: string): EmbedData | null {
@@ -243,11 +248,19 @@ const fallbackView = (app: string): string =>
+ `<text x="160" y="94" text-anchor="middle" font-family="system-ui" font-size="13"`
+ ` fill="#5b6675">${(APPS[app] ?? app).replace(/[<&>]/g, '')}</text></svg>`;
-async function pickFile(): Promise<File | null> {
+/**
+ * The house file picker.
+ *
+ * `accept` is a parameter rather than a constant because compare.ts wants the
+ * same gesture for `.json` too — a bare document, the interchange unit chat
+ * AIs can actually hand back. The default is unchanged, so an embed still
+ * offers only Bento shells.
+ */
+export async function pickFile(accept = '.html,text/html'): Promise<File | null> {
return new Promise(resolve => {
const input = document.createElement('input');
input.type = 'file';
- input.accept = '.html,text/html';
+ input.accept = accept;
input.addEventListener('change', () => resolve(input.files?.[0] ?? null), { once: true });
input.click();
});
diff --git a/type/src/fields.ts b/type/src/fields.ts
new file mode 100644
index 00000000..bcf81c74
--- /dev/null
+++ b/type/src/fields.ts
@@ -0,0 +1,723 @@
+// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+//
+// FIELDS — text a document computes rather than stores.
+//
+// `{{page}}`, `{{title}}`, `{{date}}`, and — the reason this exists —
+// `{{Name}}`, bound to a column of a spreadsheet by mail merge (merge.ts).
+//
+// THE INVARIANT, which is bento/slides' and is not negotiable: the MODEL
+// stores the field, never its value. Only rendered output is resolved. That is
+// what makes inserting a page renumber every `{{page}}`, editing the document
+// properties restyle every letterhead, and a merged letter still a document
+// rather than a screenshot of one.
+//
+// ────────────────────────────────────────────────────────────────────────────
+// WHY A FIELD IS AN ATOM HERE AND A TOKEN IN slides
+//
+// bento/slides keeps `{{page}}` as literal characters inside a text element's
+// HTML and substitutes at render (slides/src/render.ts resolveFields). It then
+// pays for that with an editing hack: `canvas.startTextEdit` swaps the RESOLVED
+// text back to the raw token while the author is in the box, or the first
+// keystroke would commit "7" over `{{page}}` and destroy the field.
+//
+// That hack cannot be ported, and porting it would be the bug. In slides a text
+// element is edited as a WHOLE — you enter the box, you leave the box, and the
+// swap happens at those two moments. In bento/type the whole document is one
+// contentEditable stream, the caret is a MODEL position `(blockId, offset into
+// text)` (inline.ts, reason 3), and `editor.ts` reads the block back out of the
+// DOM on EVERY keystroke. So resolving into the text would mean:
+//
+// · the DOM holding 5 characters where the model holds 8, which makes every
+// caret computation in that paragraph wrong;
+// · marks, footnote anchors, cross-references, citations AND comment ranges
+// — all offsets into that same string — needing to be shifted through the
+// resolution and back again, in an app whose differentiator is that a
+// comment stays on the clause it was made about;
+// · `readBlock` writing the resolved value into the model the moment anyone
+// typed a space in the paragraph.
+//
+// So a field is an ATOM: it occupies a POSITION in the text and no characters,
+// exactly like the footnote marker (`notes`), the cross-reference (`refs`) and
+// the citation (`cites`) already do. `Block.fields` is a fourth list of
+// `{at, name}` over the same string, moved by the same rule in `spliceText`.
+// The editing gotcha is then not handled — it is STRUCTURALLY ABSENT. There is
+// nothing in the text to type over, `readBlock` recovers the field from the
+// atom, and the redline sees no text change when a value changes, which is
+// right: a mail merge is not an edit to the letter.
+//
+// `{{Name}}` remains the INTERCHANGE syntax — it is what an author types, what
+// a chat AI emits into the document JSON, and what a pasted template carries.
+// `bindTokens` converts those literal tokens into field atoms; it is an
+// explicit, undoable, whole-document act (the Insert menu, and automatically
+// when a data source is bound) rather than an autocorrect in the keystroke
+// path, because a silent conversion inside a TRACKED document would rewrite
+// somebody's recorded insertion.
+//
+// ────────────────────────────────────────────────────────────────────────────
+// WHAT AN UNMATCHED FIELD LOOKS LIKE, AND WHY
+//
+// A field whose name matches no built-in and no column of the bound row is
+// UNBOUND. Three behaviours, deliberately different by surface:
+//
+// editor the field name in a dimmed, dashed chip, with a tooltip saying
+// nothing supplies it. The author must be able to SEE that the
+// letter has a hole in it — this is the state that ruins 200
+// envelopes, so it is the one state that must not be quiet.
+// print, EMPTY. Not the literal `{{Name}}`, and not "undefined": a reader
+// preview must never be shown the machinery, and "Dear undefined," is
+// worse than "Dear ,". The visible gap is the report.
+// plain empty, as print.
+//
+// A BOUND field renders its value everywhere, in a faint chip in the editor so
+// it reads as computed, and as ordinary text on paper.
+//
+// THE MERGE ROW WINS OVER A BUILT-IN, and this went the other way first.
+//
+// The reserved-names version was written, and the rig killed it on the FIRST
+// realistic fixture: a spreadsheet of debtors with a column called "Company"
+// merged into a letter saying `{{Company}}` printed NOTHING, because `company`
+// is one of the document's own properties and the built-in answered first. So
+// did `Name`... and `Date`, `Title`, `Subject` and `Author` — which is to say
+// the reserved list is a list of the most likely column headings in a mail
+// merge. That is not an edge case, it is the feature's main road.
+//
+// The two failures are not symmetrical, which is what settles it. A SHADOWED
+// built-in is loud: the running head prints the recipient's company instead of
+// the author's, and whoever proofs page one sees it. An UNBOUND merge field is
+// silent: it prints nothing at all, reads as a typographic space, and is
+// discovered after two hundred envelopes are sealed. So the specific binding —
+// the row somebody deliberately attached to this document — takes precedence,
+// and merge.ts flags the shadowed names in the dialog at bind time, where the
+// author can still rename the column.
+
+import { t } from './i18n.ts';
+import { registerMenuItem, registerPaginated, registerTool, type FeatureContext } from './features.ts';
+// TYPES ONLY from model.ts, and that is load-bearing rather than tidy: model.ts
+// imports `shiftFields` and `readFieldRefs` from HERE (the same arrangement it
+// has with xref.ts), so a value import back would be a real evaluation-time
+// cycle. merge.ts, which does need model.ts's values, sits on the other side of
+// that edge and is the module registry.ts mounts — it imports this one.
+import type { Block, TypeDoc } from './model.ts';
+// TYPE-ONLY, so it is erased and joins no import graph — see `tocModule` below
+// for why that distinction matters in this particular module.
+import type { Metrics, Page } from './paginate.ts';
+
+/**
+ * A field: a name, at an offset into the block's text.
+ *
+ * Same shape as `NoteRef`/`XrefRef`, on purpose — one concept, four uses.
+ * `pad` is a zero-pad width and is only meaningful on `page`/`pages`
+ * (`{{page:2}}` → "06"), which is the one field a running foot needs to line
+ * up in a column.
+ */
+export interface FieldRef { at: number; name: string; pad?: number }
+
+/**
+ * Names the document answers itself. Everything else is looked up in the
+ * merge row, so a spreadsheet column named anything outside this list just
+ * works.
+ */
+export const BUILTINS = [
+ 'title', 'subtitle', 'author', 'company', 'subject', 'keywords',
+ 'date', 'time', 'page', 'pages',
+] as const;
+export type Builtin = (typeof BUILTINS)[number];
+const BUILTIN_SET: ReadonlySet<string> = new Set(BUILTINS);
+export const isBuiltin = (name: string): boolean => BUILTIN_SET.has(name.trim().toLowerCase());
+
+/** Only `page`/`pages` take a width; a padded `{{title:3}}` is a typo. */
+const PADDABLE: ReadonlySet<string> = new Set(['page', 'pages']);
+
+/**
+ * What a field name may be.
+ *
+ * Restricted at the boundary rather than trusted: a name arrives from a
+ * spreadsheet column, from hand-edited JSON, or from a pasted template, and it
+ * ends up in an HTML attribute AND in a `{{...}}` token. Braces, angle
+ * brackets, quotes, backslashes and the `:` that introduces a pad width are
+ * out because they could not survive both forms; control characters are out
+ * because they are how something slips past a check that reads only the
+ * visible text. Spaces and hyphens are IN -- "Full Name" and "Invoice-No" are
+ * what column headers actually look like, and a rule that rejected them would
+ * make the feature useless on real spreadsheets. The length cap is so a
+ * pathological header cannot make an unreadable document.
+ */
+const NAME_OK = /^[^{}<>"'\\:\u0000-\u001f\u007f]{1,64}$/;
+export const safeFieldName = (raw: string): string | null => {
+ const n = (raw ?? '').trim().replace(/\s+/g, ' ');
+ return n && NAME_OK.test(n) ? n : null;
+};
+
+/** Two names are the same field if they differ only by case or edge space. */
+export const fieldKey = (name: string): string => name.trim().toLowerCase();
+
+/**
+ * A field's address in the document: which block, and where in it.
+ *
+ * Needed because `{{page}}` is the one field whose value differs between two
+ * occurrences of the SAME field — a running foot repeated through a contract is
+ * a different number on every page — so resolution has to be able to say WHICH
+ * occurrence it is answering for. Rides the atom as `data-fkey`, so the string
+ * renderers (print, preview) can look it up without a DOM.
+ */
+export const fkeyOf = (blockId: string, at: number): string => `${blockId}:${at}`;
+
+// ───────────────────────────────────────────────────────────── model helpers
+
+export const fieldsOf = (b: Block): FieldRef[] => (b.fields as FieldRef[] | undefined) ?? [];
+
+/**
+ * Move field anchors to follow an edit that replaced [at, at+removed) with
+ * `added` characters.
+ *
+ * THE SAME RULE the notes and the cross-references use — `model.ts spliceText`
+ * calls this beside `shiftRefs`. Pure and DOM-free so the rig can hold it to
+ * that promise without a browser.
+ */
+export function shiftFields(fields: readonly FieldRef[], at: number, removed: number,
+ added: number): FieldRef[] {
+ const end = at + removed;
+ const delta = added - removed;
+ return fields
+ .filter(f => !(f.at > at && f.at < end))
+ .map(f => (f.at >= end ? { ...f, at: f.at + delta } : { ...f }))
+ .sort((x, y) => x.at - y.at);
+}
+
+/** Add a field to a block at an offset. Pure — the caller commits it. */
+export function withField(block: Block, at: number, name: string, pad?: number): Block {
+ const safe = safeFieldName(name);
+ if (!safe) return block;
+ const f: FieldRef = {
+ at: Math.max(0, Math.min(at, block.text.length)),
+ name: safe,
+ ...(pad && pad > 0 && PADDABLE.has(fieldKey(safe)) ? { pad: Math.min(9, Math.floor(pad)) } : {}),
+ };
+ return { ...block, fields: [...fieldsOf(block), f].sort((x, y) => x.at - y.at) };
+}
+
+/** Sanitize a `fields` array off a parsed document. Used by model.ts parseDoc. */
+export function readFieldRefs(raw: unknown, len: number): FieldRef[] {
+ if (!Array.isArray(raw)) return [];
+ const out: FieldRef[] = [];
+ for (const f of raw) {
+ if (!f || typeof f !== 'object') continue;
+ const r = f as Partial<FieldRef>;
+ const name = typeof r.name === 'string' ? safeFieldName(r.name) : null;
+ if (!name || typeof r.at !== 'number' || !Number.isFinite(r.at)) continue;
+ const pad = typeof r.pad === 'number' && r.pad > 0 && PADDABLE.has(fieldKey(name))
+ ? Math.min(9, Math.floor(r.pad)) : undefined;
+ out.push({ at: Math.max(0, Math.min(r.at, len)), name, ...(pad ? { pad } : {}) });
+ }
+ return out.sort((x, y) => x.at - y.at);
+}
+
+// ─────────────────────────────────────────────────────────── {{token}} ⇄ field
+
+/**
+ * `{{ Name }}` or `{{page:2}}`. Deliberately the SAME token spelling
+ * bento/slides uses, so a document moving between the two apps means the same
+ * thing in both, and so a chat AI that has seen one has seen the other.
+ */
+export const TOKEN = /\{\{\s*([^{}:<>"']{1,64}?)\s*(?::\s*(\d{1,2})\s*)?\}\}/g;
+
+/**
+ * Turn every literal `{{token}}` in a block's text into a field atom.
+ *
+ * Returns null when there is nothing to do, so a caller can commit only the
+ * blocks that changed. Pure: it walks the tokens back to front so each splice
+ * leaves the offsets of the ones still to come untouched, and it goes through
+ * `spliceText` — passed in rather than imported — so marks, notes, refs, cites
+ * and the fields already present all move by the one rule that exists for it.
+ *
+ * `spliceText` arrives as a parameter because model.ts imports THIS module
+ * (for `shiftFields`), and importing it back at module scope would be a
+ * value-level cycle — the same dance xref.ts already does.
+ */
+export function tokensToFields(
+ block: Block,
+ splice: (b: Block, at: number, removed: number, added: string) => Block,
+): Block | null {
+ const hits = [...block.text.matchAll(TOKEN)];
+ if (!hits.length) return null;
+ let out = block;
+ let changed = false;
+ for (let i = hits.length - 1; i >= 0; i--) {
+ const m = hits[i];
+ const name = safeFieldName(m[1]);
+ if (!name) continue;
+ const at = m.index!;
+ // Cut the characters out FIRST, then anchor the field where they were: the
+ // splice moves every other anchor in the block, and a field added before it
+ // would be moved by its own removal.
+ out = splice(out, at, m[0].length, '');
+ out = withField(out, at, name, m[2] ? Number(m[2]) : undefined);
+ changed = true;
+ }
+ return changed ? out : null;
+}
+
+/** The document with its `{{tokens}}` converted. Returns the count converted. */
+export function bindTokens(
+ doc: TypeDoc,
+ splice: (b: Block, at: number, removed: number, added: string) => Block,
+): number {
+ let n = 0;
+ doc.body.forEach((b, i) => {
+ const next = tokensToFields(b, splice);
+ if (!next) return;
+ n += fieldsOf(next).length - fieldsOf(b).length;
+ doc.body[i] = next;
+ });
+ return n;
+}
+
+/** A field written back as its token — for plain-text export and round-tripping. */
+export const tokenOf = (f: FieldRef): string => `{{${f.name}${f.pad ? `:${f.pad}` : ''}}}`;
+
+// ────────────────────────────────────────────────────────────────── resolving
+
+/**
+ * What the fields of one rendering resolve against.
+ *
+ * `page`/`pages` are OPTIONAL because they are not always knowable: the string
+ * renderers (preview.ts) draw a document that has not been paginated, and a
+ * field nobody can answer must read as unbound rather than as "1".
+ */
+export interface FieldContext {
+ title: string;
+ subtitle: string;
+ author: string;
+ company: string;
+ subject: string;
+ keywords: string;
+ date: Date;
+ /**
+ * Which page a particular field is ON, by its `fkey` (see `fkeyOf`).
+ *
+ * A FUNCTION rather than a number, because a document has many pages and the
+ * fields on it are not all on the same one — a running foot repeated through
+ * a contract is the whole use. It is optional because the page is not always
+ * knowable: pagination is a MEASUREMENT (paginate.ts walks line boxes), so
+ * before the first pass, and in the string renderers that draw a document
+ * nobody has laid out, `{{page}}` has no answer and reads as unbound rather
+ * than as a confident "1".
+ */
+ pageOf?: (fkey: string) => number | undefined;
+ pages?: number;
+ /** the merge row, keyed by `fieldKey` — see merge.ts */
+ row?: Record<string, string>;
+ /**
+ * A live cell in a sheet this document embeds — see live.ts.
+ *
+ * Consulted LAST, after the row and the built-ins, so adding this could not
+ * change what any existing field resolves to. It only ever answers names that
+ * parse as an address (`Q3!Revenue`), and those cannot collide with a
+ * built-in or, in practice, with a column heading.
+ */
+ cell?: (name: string) => string | null;
+}
+
+/**
+ * Where live cells plug in.
+ *
+ * A REGISTRATION rather than an import, because live.ts already imports this
+ * file for `fieldKey` and importing it back would make a cycle — and because it
+ * is how the rest of this app mounts an optional capability (registerPreview,
+ * registerPaginated). A build that never loads live.ts resolves every field
+ * exactly as it did before.
+ */
+type CellFactory = (doc: TypeDoc) => (name: string) => string | null;
+let cellFactory: CellFactory | null = null;
+export function registerCells(f: CellFactory): void { cellFactory = f; }
+
+/** The field values a document supplies about itself. */
+export function fieldContext(doc: TypeDoc, over: Partial<FieldContext> = {}): FieldContext {
+ const m = doc.meta ?? {};
+ const merge = (doc.merge as { row?: Record<string, string> } | undefined);
+ return {
+ title: doc.title ?? '',
+ subtitle: doc.subtitle ?? '',
+ author: m.author ?? '',
+ company: m.company ?? '',
+ subject: m.subject ?? '',
+ keywords: m.keywords ?? '',
+ date: new Date(),
+ ...(merge?.row ? { row: merge.row } : {}),
+ ...(cellFactory ? { cell: cellFactory(doc) } : {}),
+ ...over,
+ };
+}
+
+/**
+ * A field's value, or NULL when nothing supplies it.
+ *
+ * null is the whole point of the return type: the three surfaces show an
+ * unbound field differently (see this file's header) and every one of them
+ * needs to be able to tell "" from "there is no such thing".
+ */
+export function resolveField(f: FieldRef, ctx: FieldContext, fkey = ''): string | null {
+ const key = fieldKey(f.name);
+ // THE ROW FIRST. See this file's header: the built-in list is also the list
+ // of likely column headings, and losing a merge value is the silent failure
+ // while shadowing a document property is the loud one.
+ const bound = ctx.row?.[key];
+ if (bound !== undefined) return bound;
+ const pad = (n: number | undefined): string | null => {
+ if (n === undefined) return null;
+ return f.pad && f.pad > 0 ? String(n).padStart(f.pad, '0') : String(n);
+ };
+ switch (key) {
+ case 'title': return ctx.title;
+ case 'subtitle': return ctx.subtitle;
+ case 'author': return ctx.author;
+ case 'company': return ctx.company;
+ case 'subject': return ctx.subject;
+ case 'keywords': return ctx.keywords;
+ case 'date': return ctx.date.toLocaleDateString();
+ case 'time': return ctx.date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
+ case 'page': return pad(ctx.pageOf?.(fkey));
+ case 'pages': return pad(ctx.pages);
+ default: return ctx.cell?.(f.name) ?? null;
+ }
+}
+
+// ───────────────────────────────────────────────────────────────────── atoms
+
+const ESC: Record<string, string> = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' };
+const esc = (s: string) => s.replace(/[&<>"']/g, c => ESC[c]);
+
+export const FIELD_CLASS = 't-field';
+export const UNBOUND_CLASS = 't-field-unbound';
+
+/**
+ * The atoms a block contributes, keyed by offset — merged into `blockHtml`'s
+ * inject map beside the footnote markers, cross-references and citations.
+ *
+ * The atom is emitted UNRESOLVED, carrying the field name as its placeholder
+ * text; `fillFields` / `fillFieldsHtml` put the value in afterwards. That is
+ * `numberXrefs`' arrangement exactly, and it is the reason a field costs the
+ * caret nothing: filling writes text and one class, never structure.
+ */
+export function fieldAtoms(b: Block): Map<number, string> {
+ const m = new Map<number, string>();
+ for (const f of fieldsOf(b)) {
+ const prev = m.get(f.at) ?? '';
+ m.set(f.at,
+ prev + `<span class="${FIELD_CLASS} ${UNBOUND_CLASS}" data-field="${esc(f.name)}"`
+ + ` data-fkey="${esc(fkeyOf(b.id, f.at))}"`
+ + (f.pad ? ` data-pad="${f.pad}"` : '')
+ + ` contenteditable="false">${esc(f.name)}</span>`);
+ }
+ return m;
+}
+
+/** Is this element one of ours? A field owns no characters, so `readBlock`
+ * must never absorb its value into the block's text. */
+export const isFieldAtom = (el: Element): boolean =>
+ el.tagName === 'SPAN' && el.classList.contains(FIELD_CLASS);
+
+/** Read field atoms back out of a parsed block — the editor round-trip. */
+export function readFields(atoms: Array<{ at: number; el: Element }>): FieldRef[] {
+ const out: FieldRef[] = [];
+ for (const a of atoms) {
+ const el = a.el as HTMLElement;
+ const name = el.dataset?.field ? safeFieldName(el.dataset.field) : null;
+ if (!name) continue;
+ const pad = Number(el.dataset.pad);
+ out.push({ name, at: a.at,
+ ...(Number.isFinite(pad) && pad > 0 && PADDABLE.has(fieldKey(name)) ? { pad } : {}) });
+ }
+ return out.sort((x, y) => x.at - y.at);
+}
+
+// ────────────────────────────────────────────────────────────────── filling in
+
+// ─────────────────────────────────────────────────────────────── pagination
+//
+// `{{page}}` is the one field whose answer is a MEASUREMENT rather than a
+// lookup, so it arrives the way every measured thing in this app does: after a
+// pagination pass, through the `paginated` hook, from the same line-box
+// geometry paginate.ts used. Nothing here re-derives page boundaries — it asks
+// toc.ts's `pageOfY`, which is the one implementation of "which page is this y
+// on", so a field and a table of contents can never disagree about page 7.
+
+let PAGE_AT: Map<string, number> = new Map();
+let PAGE_COUNT: number | undefined;
+
+/** What the last pagination pass knows, as a FieldContext fragment. */
+export const pagination = (): Partial<FieldContext> =>
+ (PAGE_COUNT === undefined
+ ? {}
+ : { pages: PAGE_COUNT, pageOf: (k: string) => PAGE_AT.get(k) });
+
+/** Reset — for the rig, and for a document that has not been laid out. */
+export function setPagination(pages: number | undefined, at: Map<string, number> = new Map()): void {
+ PAGE_COUNT = pages;
+ PAGE_AT = at;
+}
+
+/**
+ * toc.ts's `pageOfY`, fetched LAZILY — and the laziness is load-bearing.
+ *
+ * model.ts imports this module, so anything this module imports at the top
+ * joins model.ts's own import graph. toc.ts calls `registerBlockDecorator` at
+ * MODULE SCOPE, so a static import here closes the cycle
+ * model → fields → toc → render → model and toc runs against a half-evaluated
+ * render.ts: measured, `Cannot access 'registerBlockDecorator' before
+ * initialization`, at import time, in every build. Deferring the import to the
+ * first pagination pass breaks the cycle in time rather than in structure — and
+ * the alternative, a second copy of "which page is this y on", is exactly what
+ * would let a field and a table of contents disagree about page 7.
+ */
+let PAGE_OF_Y: Promise<typeof import('./toc.ts')> | null = null;
+const tocModule = () => (PAGE_OF_Y ??= import('./toc.ts'));
+
+registerPaginated((ctx, metrics, paper) => {
+ const m = metrics as Metrics;
+ if (!m?.pages?.length) return;
+ void tocModule().then(({ pageOfY }) => measure(ctx, m, paper, pageOfY));
+});
+
+function measure(
+ ctx: FeatureContext,
+ m: Metrics,
+ paper: HTMLElement,
+ pageOfY: (pages: readonly Page[], y: number) => number | undefined,
+) {
+ // The SAME origin paginate.ts lineBoxes uses: the host's top plus the page's
+ // top margin, so y=0 is the first line's top rather than the top of the paper.
+ // An origin that disagreed by the margin would put every field one page out
+ // near a boundary — visible only on long documents, which is the worst kind.
+ const top0 = paper.getBoundingClientRect().top + (ctx.store.doc.page?.marginTop ?? 0);
+ const at = new Map<string, number>();
+ for (const el of paper.querySelectorAll<HTMLElement>(`span.${FIELD_CLASS}`)) {
+ const k = el.dataset.fkey;
+ if (!k) continue;
+ const n = pageOfY(m.pages, el.getBoundingClientRect().top - top0);
+ if (n !== undefined) at.set(k, n);
+ }
+ setPagination(m.pages.length, at);
+ // Re-fill in place: filling writes text and one class, never structure, so a
+ // caret sitting in the paragraph beside a page number does not move.
+ fillFields(paper, ctx.store.doc);
+}
+
+/**
+ * Fill the field atoms in a rendered host — the EDITOR path, called from
+ * renderBody after numberXrefs.
+ *
+ * An unbound field keeps the dashed chip and its own name, which is the only
+ * surface that shows one: see the header.
+ */
+export function fillFields(host: HTMLElement, doc: TypeDoc, over: Partial<FieldContext> = {}): void {
+ const ctx = fieldContext(doc, { ...pagination(), ...over });
+ for (const el of host.querySelectorAll<HTMLElement>(`span.${FIELD_CLASS}`)) {
+ const name = el.dataset.field ?? '';
+ const pad = Number(el.dataset.pad);
+ const v = resolveField({ name, at: 0, ...(Number.isFinite(pad) && pad > 0 ? { pad } : {}) },
+ ctx, el.dataset.fkey ?? '');
+ el.textContent = v === null ? name : v;
+ el.classList.toggle(UNBOUND_CLASS, v === null);
+ el.title = v === null
+ ? t('Nothing supplies “{name}” — it prints as nothing').replace('{name}', name)
+ : t('Field: {name}').replace('{name}', name);
+ }
+}
+
+/**
+ * Fill field atoms in a STRING of block HTML — the print and preview path.
+ *
+ * UNBOUND RESOLVES TO NOTHING HERE, and the whole span goes with it: a reader
+ * must not be shown the machinery, and an empty chip would still draw its
+ * dashed outline on paper. Pure, so the rig can assert paper and screen agree.
+ */
+export function fillFieldsHtml(html: string, ctx: FieldContext): string {
+ return html.replace(
+ new RegExp(`<span class="${FIELD_CLASS}[^"]*"([^>]*)>.*?</span>`, 'g'),
+ (_m, attrs: string) => {
+ const name = /data-field="([^"]*)"/.exec(attrs)?.[1] ?? '';
+ const fkey = /data-fkey="([^"]*)"/.exec(attrs)?.[1] ?? '';
+ const padRaw = /data-pad="(\d+)"/.exec(attrs)?.[1];
+ // The name came out of an attribute we escaped on the way in; decode the
+ // three entities that escaping can produce before looking it up, or a
+ // column called "R&D" never matches.
+ const plain = name.replace(/&quot;/g, '"').replace(/&#39;/g, "'")
+ .replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&amp;/g, '&');
+ const v = resolveField(
+ { name: plain, at: 0, ...(padRaw ? { pad: Number(padRaw) } : {}) }, ctx, fkey);
+ return v === null ? '' : `<span class="${FIELD_CLASS}">${esc(v)}</span>`;
+ });
+}
+
+/** A block as prose with its fields resolved — for plain-text export and search. */
+export function fieldedText(b: Block, ctx: FieldContext): string {
+ const fs = fieldsOf(b);
+ if (!fs.length) return b.text;
+ let out = '';
+ let at = 0;
+ for (const f of fs) {
+ out += b.text.slice(at, f.at) + (resolveField(f, ctx, fkeyOf(b.id, f.at)) ?? '');
+ at = f.at;
+ }
+ return out + b.text.slice(at);
+}
+
+// ─────────────────────────────────────────────────────────────────────── UI
+
+const FIELD_ICON =
+ '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"'
+ + ' fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">'
+ + '<path d="M4 7h16M4 7v10M20 7v10M4 17h16"/><path d="M9 12h6"/></svg>';
+
+/** The built-ins, with the label the picker shows. Never a module-level const
+ * of translated strings — this is a function so t() resolves at open time. */
+function builtinChoices(): Array<{ name: string; label: string }> {
+ return [
+ { name: 'title', label: t('Document title') },
+ { name: 'subtitle', label: t('Subtitle') },
+ { name: 'author', label: t('Author') },
+ { name: 'company', label: t('Company') },
+ { name: 'subject', label: t('Subject') },
+ { name: 'keywords', label: t('Keywords') },
+ { name: 'date', label: t('Today’s date') },
+ { name: 'time', label: t('Time of day') },
+ { name: 'page', label: t('Page number') },
+ { name: 'pages', label: t('Total pages') },
+ ];
+}
+
+/** The merge columns this document is bound to, if any. */
+export function boundColumns(doc: TypeDoc): string[] {
+ const m = doc.merge as { row?: Record<string, string>; columns?: string[] } | undefined;
+ if (Array.isArray(m?.columns)) return m!.columns!.filter(c => typeof c === 'string');
+ return m?.row ? Object.keys(m.row) : [];
+}
+
+/** Insert a field at the caret. */
+export function insertField(ctx: FeatureContext, name: string, pad?: number): void {
+ const c = ctx.editor.caret();
+ if (!c) { ctx.toast(t('Put the caret where the field goes')); return; }
+ const at = c.at;
+ ctx.store.breakRun();
+ ctx.store.commit(d => {
+ const i = d.body.findIndex(b => b.id === c.id);
+ if (i < 0) return;
+ d.body[i] = withField(d.body[i], at, name, pad);
+ }, { scope: { block: c.id } });
+ ctx.refresh();
+ ctx.editor.setCaret({ id: c.id, at });
+}
+
+export function openFieldPicker(ctx: FeatureContext): void {
+ const c = ctx.editor.caret();
+ if (!c) { ctx.toast(t('Put the caret where the field goes')); return; }
+
+ const back = document.createElement('div');
+ back.className = 't-overlay';
+ const box = document.createElement('div');
+ box.className = 't-dlg t-field-pick';
+ box.innerHTML = `<h3>${esc(t('Insert a field'))}</h3>`;
+
+ const list = document.createElement('div');
+ list.className = 't-field-list';
+ const add = (name: string, label: string, note?: string) => {
+ const b = document.createElement('button');
+ b.type = 'button';
+ b.innerHTML = `<b>${esc(label)}</b><span>${esc(note ?? `{{${name}}}`)}</span>`;
+ b.addEventListener('click', () => { close(); insertField(ctx, name); });
+ list.appendChild(b);
+ };
+
+ const cols = boundColumns(ctx.store.doc);
+ if (cols.length) {
+ const h = document.createElement('div');
+ h.className = 't-field-head';
+ h.textContent = t('From the data source');
+ list.appendChild(h);
+ for (const col of cols) add(col, col);
+ }
+ const h2 = document.createElement('div');
+ h2.className = 't-field-head';
+ h2.textContent = t('About this document');
+ list.appendChild(h2);
+ for (const b of builtinChoices()) add(b.name, b.label);
+ box.appendChild(list);
+
+ // A name can also be TYPED: a template is often written before its
+ // spreadsheet exists, and refusing to name a column that is not there yet
+ // would make the two impossible to write in either order.
+ const row = document.createElement('div');
+ row.className = 't-field-custom';
+ const input = document.createElement('input');
+ input.type = 'text';
+ input.className = 't-input';
+ input.placeholder = t('or a field name…');
+ const go = document.createElement('button');
+ go.type = 'button';
+ go.className = 't-btn';
+ go.textContent = t('Insert');
+ const commit = () => {
+ const n = safeFieldName(input.value);
+ if (!n) { ctx.toast(t('That is not a usable field name')); return; }
+ close();
+ insertField(ctx, n);
+ };
+ go.addEventListener('click', commit);
+ input.addEventListener('keydown', e => { if (e.key === 'Enter') { e.preventDefault(); commit(); } });
+ row.append(input, go);
+ box.appendChild(row);
+
+ const foot = document.createElement('div');
+ foot.className = 't-dlg-foot';
+ const cancel = document.createElement('button');
+ cancel.type = 'button';
+ cancel.className = 't-btn';
+ cancel.textContent = t('Cancel');
+ cancel.addEventListener('click', () => close());
+ foot.appendChild(cancel);
+ box.appendChild(foot);
+
+ const onKey = (e: KeyboardEvent) => { if (e.key === 'Escape') { e.preventDefault(); close(); } };
+ function close() {
+ window.removeEventListener('keydown', onKey, true);
+ back.remove();
+ if (c) ctx.editor.setCaret(c);
+ }
+ back.addEventListener('mousedown', e => { if (e.target === back) close(); });
+ window.addEventListener('keydown', onKey, true);
+ back.appendChild(box);
+ document.body.appendChild(back);
+ input.focus();
+}
+
+registerTool({
+ id: 'field',
+ icon: FIELD_ICON,
+ get title() { return t('Insert a field that the document fills in'); },
+ group: 'insert',
+ label: () => t('Field'),
+ order: 60,
+ run: openFieldPicker,
+});
+
+registerMenuItem({
+ id: 'fields-from-tokens',
+ label: () => t('Turn {{…}} tokens into fields'),
+ order: 61,
+ run: ctx => {
+ // Imported lazily so this module stays free of a value-level cycle with
+ // model.ts, which imports `shiftFields` from here.
+ void import('./model.ts').then(({ spliceText }) => {
+ let n = 0;
+ ctx.store.breakRun();
+ ctx.store.commit(d => { n = bindTokens(d, spliceText); });
+ ctx.editor.render();
+ ctx.refresh();
+ ctx.toast(n
+ ? t('{n} field(s) created from tokens').replace('{n}', String(n))
+ : t('No {{…}} tokens found in this document'));
+ });
+ },
+});
diff --git a/type/src/i18n/de.ts b/type/src/i18n/de.ts
index d32901b4..5bcaa45e 100644
--- a/type/src/i18n/de.ts
+++ b/type/src/i18n/de.ts
@@ -30,6 +30,7 @@ export const de: Catalog = {
"Appearance": "Erscheinungsbild",
"Applied style": "Angewendete Formatvorlage",
"Apply": "Anwenden",
+ "Author": "Autor",
"Author–year — APA-ish": "Autor–Jahr (APA-ähnlich)",
"Auto": "Automatisch",
"Bento artifact": "Bento-Artefakt",
@@ -58,10 +59,12 @@ export const de: Catalog = {
"Comments": "Kommentare",
"Comments hidden": "Kommentare ausgeblendet",
"Comments shown": "Kommentare angezeigt",
+ "Company": "Unternehmen",
"Contents": "Inhalt",
"Contents inserted. Page numbers fill in as the document paginates.": "Inhaltsverzeichnis eingefügt. Seitenzahlen werden ausgefüllt, sobald das Dokument paginiert wird.",
"Copy document JSON": "Dokument-JSON kopieren",
"Could not check right now.": "Konnte gerade nicht geprüft werden.",
+ "Could not read: {cols}": "Nicht lesbar: {cols}",
"Credits": "Danksagung",
"Cross-reference": "Querverweis",
"Custom": "Benutzerdefiniert",
@@ -80,6 +83,7 @@ export const de: Catalog = {
"Document id": "Dokument-ID",
"Document title": "Dokumenttitel",
"Drag to move, click for options": "Ziehen zum Verschieben, klicken für Optionen",
+ "Each row becomes one complete file in a folder you choose.": "Jede Zeile wird zu einer vollständigen Datei in einem Ordner Ihrer Wahl.",
"Edit": "Bearbeiten",
"Edit your comment": "Ihren Kommentar bearbeiten",
"Edit “{name}”": "„{name}“ bearbeiten",
@@ -88,9 +92,12 @@ export const de: Catalog = {
"Embedded from {app}": "Eingebettet aus {app}",
"Equation added — edit it in the Math panel": "Gleichung hinzugefügt – im Mathematik-Panel bearbeiten",
"Equation block": "Gleichungsblock",
+ "Field": "Feld",
+ "Field: {name}": "Feld: {name}",
"Figure": "Abbildung",
"Figures": "Abbildungen",
"File": "Datei",
+ "File names": "Dateinamen",
"Find": "Suchen",
"Find and replace (⌘F)": "Suchen und Ersetzen (⌘F)",
"Find in document": "Im Dokument suchen",
@@ -102,6 +109,7 @@ export const de: Catalog = {
"Formula": "Formel",
"Formula (⌘M)": "Formel (⌘M)",
"Formula added — edit it in the Math panel": "Formel hinzugefügt – im Mathematik-Panel bearbeiten",
+ "From the data source": "Aus der Datenquelle",
"From {app}": "Von {app}",
"Header row": "Kopfzeile",
"Heading 1": "Überschrift 1",
@@ -119,6 +127,8 @@ export const de: Catalog = {
"Insert a cross-reference": "Querverweis einfügen",
"Insert a cross-reference to a caption": "Querverweis auf eine Beschriftung einfügen",
"Insert a display equation on its own line": "Eine eigenständige Gleichungszeile einfügen",
+ "Insert a field": "Feld einfügen",
+ "Insert a field that the document fills in": "Ein Feld einfügen, das das Dokument ausfüllt",
"Insert a picture": "Bild einfügen",
"Insert a picture, table, formula, citation…": "Bild, Tabelle, Formel, Zitat einfügen…",
"Insert a table": "Tabelle einfügen",
@@ -130,6 +140,7 @@ export const de: Catalog = {
"Justified": "Blocksatz",
"Keep together": "Zusammenhalten",
"Keep with next": "Mit nächstem zusammenhalten",
+ "Keywords": "Schlagwörter",
"Label — “Table 2”": "Beschriftung – „Tabelle 2“",
"Landscape": "Querformat",
"Layout": "Layout",
@@ -140,11 +151,16 @@ export const de: Catalog = {
"Line spacing": "Zeilenabstand",
"Link (⌘K)": "Link (⌘K)",
"Link address": "Link-Adresse",
+ "Mail merge": "Serienbrief",
+ "Mail merge from a sheet…": "Serienbrief aus einem Blatt…",
"Margins": "Ränder",
"Margins…": "Ränder…",
"Match case": "Groß-/Kleinschreibung beachten",
"Math": "Mathematik",
"Medium": "Medium",
+ "Merge failed: {why}": "Serienbrief fehlgeschlagen: {why}",
+ "Merge {n} document(s)": "{n} Dokument(e) zusammenführen",
+ "Merged {n} document(s)": "{n} Dokument(e) zusammengeführt",
"Modified": "Geändert",
"More — revisions, signing, print": "Mehr – Überarbeitungen, Signieren, Drucken",
"Move down": "Nach unten verschieben",
@@ -159,8 +175,10 @@ export const de: Catalog = {
"No matches": "Keine Treffer",
"No sources yet. Paste a .bib file to get started.": "Noch keine Quellen. Fügen Sie eine .bib-Datei ein, um zu beginnen.",
"No tracked changes": "Keine nachverfolgten Änderungen",
+ "No {{…}} tokens found in this document": "Keine {{…}}-Platzhalter in diesem Dokument gefunden",
"Nothing is cited yet, so the list is empty.": "Es wurde noch nichts zitiert, daher ist die Liste leer.",
"Nothing matches.": "Keine Übereinstimmung.",
+ "Nothing supplies “{name}” — it prints as nothing": "Nichts liefert „{name}“ – es wird nichts gedruckt",
"Nothing that looks like a BibTeX entry.": "Nichts, das wie ein BibTeX-Eintrag aussieht.",
"Nothing to refer to yet — caption a table first": "Noch nichts zum Verweisen vorhanden – zuerst eine Tabelle beschriften",
"Nothing was imported.": "Es wurde nichts importiert.",
@@ -171,6 +189,7 @@ export const de: Catalog = {
"Numeric [1] — IEEE-ish": "Numerisch [1] (IEEE-ähnlich)",
"Off by default: most documents already carry their numbers in the heading text.": "Standardmäßig deaktiviert: Die meisten Dokumente tragen ihre Nummern bereits im Überschriftentext.",
"Open": "Öffnen",
+ "Optical margins": "Optischer Randausgleich",
"Orientation": "Ausrichtung",
"Original": "Original",
"Outline — show or hide the document map": "Gliederung – Dokumentkarte ein-/ausblenden",
@@ -179,6 +198,7 @@ export const de: Catalog = {
"Page break inserted": "Seitenumbruch eingefügt",
"Page break removed": "Seitenumbruch entfernt",
"Page breaking": "Seitenumbruch",
+ "Page number": "Seitenzahl",
"Page or section, optional — e.g. p. 34": "Seite oder Abschnitt, optional – z. B. S. 34",
"Page setup": "Seite einrichten",
"Page size": "Seitengröße",
@@ -196,12 +216,14 @@ export const de: Catalog = {
"Previous match (⇧Enter)": "Vorheriger Treffer (⇧Eingabe)",
"Print or PDF…": "Drucken oder PDF…",
"Properties": "Eigenschaften",
+ "Punctuation hangs a little past the margin so the edge of the text reads straight. It never changes where lines break, so the page count is the same either way.": "Satzzeichen ragen ein wenig über den Rand hinaus, damit die Textkante gerade wirkt. Der Zeilenumbruch ändert sich dabei nie, die Seitenzahl bleibt also in beiden Fällen gleich.",
"Put the caret in a heading first.": "Setzen Sie den Cursor zuerst in eine Überschrift.",
"Put the caret in a paragraph first": "Setzen Sie den Cursor zuerst in einen Absatz",
"Put the caret in the document first": "Setzen Sie den Cursor zuerst in das Dokument",
"Put the caret in the table or paragraph to caption": "Setzen Sie den Cursor in die zu beschriftende Tabelle oder den Absatz",
"Put the caret on a tracked change first": "Setzen Sie den Cursor zuerst auf eine nachverfolgte Änderung",
"Put the caret where the citation goes first": "Setzen Sie den Cursor zuerst an die Stelle für das Zitat",
+ "Put the caret where the field goes": "Setzen Sie den Cursor zuerst an die Stelle für das Feld",
"Put the caret where the formula should go": "Setzen Sie den Cursor an die Stelle für die Formel",
"Put the caret where the reference goes": "Setzen Sie den Cursor zuerst an die Stelle für den Verweis",
"Quote": "Zitat",
@@ -243,6 +265,7 @@ export const de: Catalog = {
"Select something to see its properties.": "Wählen Sie etwas aus, um seine Eigenschaften zu sehen.",
"Select the words you want to link": "Wählen Sie die Wörter aus, die Sie verlinken möchten",
"Semibold": "Halbfett",
+ "Sheet": "Blatt",
"Show comments": "Kommentare einblenden",
"Signatures": "Signaturen",
"Sign…": "Signieren…",
@@ -257,9 +280,13 @@ export const de: Catalog = {
"Space before": "Abstand davor",
"Space before (px)": "Abstand davor (px)",
"Start this paragraph on a new page.": "Dieser Absatz beginnt auf einer neuen Seite.",
+ "Stop": "Anhalten",
+ "Stopped after {n} of {all} document(s)": "Nach {n} von {all} Dokument(en) angehalten",
"Strikethrough": "Durchgestrichen",
"Style": "Formatvorlage",
"Style updated from this paragraph": "Formatvorlage anhand dieses Absatzes aktualisiert",
+ "Subject": "Betreff",
+ "Subtitle": "Untertitel",
"Supported: \\frac \\sqrt ^ _ \\sum \\int \\left( \\right) Greek, matrices, cases.": "Unterstützt: \\frac \\sqrt ^ _ \\sum \\int \\left( \\right), griechische Buchstaben, Matrizen, Fallunterscheidungen.",
"Table": "Tabelle",
"Tables and figures are numbered separately, in document order.": "Tabellen und Abbildungen werden getrennt in Dokumentreihenfolge nummeriert.",
@@ -270,8 +297,10 @@ export const de: Catalog = {
"That JSON was empty.": "Dieses JSON war leer.",
"That file could not be read as a picture.": "Diese Datei konnte nicht als Bild gelesen werden.",
"That file does not look like a Bento document.": "Diese Datei sieht nicht wie ein Bento-Dokument aus.",
+ "That file has no sheet with named columns to merge from.": "Diese Datei enthält kein Blatt mit benannten Spalten zum Zusammenführen.",
"That is already a caption": "Das ist bereits eine Beschriftung",
"That is not a bento/type document: {detail}": "Dies ist kein bento/type-Dokument: {detail}",
+ "That is not a usable field name": "Das ist kein verwendbarer Feldname",
"That is not an address this document can link to": "Dies ist keine Adresse, zu der dieses Dokument verlinken kann",
"That saved version could not be restored.": "Diese gespeicherte Version konnte nicht wiederhergestellt werden.",
"That sheet is larger than any printer takes.": "Dieses Blatt ist größer, als jeder Drucker verarbeiten kann.",
@@ -285,7 +314,9 @@ export const de: Catalog = {
"Theme: {mode} — click to cycle auto/light/dark": "Design: {mode} – klicken, um zwischen Automatisch/Hell/Dunkel zu wechseln",
"These render as [?key] in the document so they cannot be missed.": "Diese werden im Dokument als [?key] angezeigt, damit sie nicht übersehen werden.",
"This already has a caption": "Dies hat bereits eine Beschriftung",
+ "This browser can only download files one at a time, which is not workable past {n} rows. Open this document in Chrome or Edge to merge it.": "Dieser Browser kann Dateien nur einzeln herunterladen, was ab {n} Zeilen nicht mehr praktikabel ist. Öffnen Sie dieses Dokument in Chrome oder Edge, um es zusammenzuführen.",
"This browser cannot write back to the file, so every save makes a new copy. Chrome and Edge on a computer can save in place.": "Dieser Browser kann die Datei nicht zurückschreiben, daher erstellt jedes Speichern eine neue Kopie. Chrome und Edge auf einem Computer können direkt speichern.",
+ "This browser will download each file separately — expect one prompt per row.": "Dieser Browser lädt jede Datei einzeln herunter – rechnen Sie mit einer Abfrage pro Zeile.",
"This build cannot render captions yet — apply the core patch listed at the top of xref.ts": "Dieser Build kann Beschriftungen noch nicht rendern – wenden Sie den Kern-Patch oben in xref.ts an",
"This document has no sources yet. Import some BibTeX first.": "Dieses Dokument hat noch keine Quellen. Importieren Sie zuerst etwas BibTeX.",
"This embed could not be displayed safely.": "Dieses eingebettete Element konnte nicht sicher angezeigt werden.",
@@ -300,12 +331,16 @@ export const de: Catalog = {
"This reference points at something that is no longer in the document": "Dieser Verweis zeigt auf etwas, das nicht mehr im Dokument ist",
"Those side margins leave no room for text.": "Diese seitlichen Ränder lassen keinen Platz für Text.",
"Those top and bottom margins leave no room for text.": "Diese oberen und unteren Ränder lassen keinen Platz für Text.",
+ "Time of day": "Uhrzeit",
+ "Today’s date": "Heutiges Datum",
"Top / bottom (in)": "Oben / unten (Zoll)",
"Top / bottom (mm)": "Oben / unten (mm)",
+ "Total pages": "Seitenanzahl",
"Track changes": "Änderungen nachverfolgen",
"Tracked changes": "Nachverfolgte Änderungen",
"Tracking is on. Edits you make from now on are recorded here.": "Die Nachverfolgung ist aktiviert. Änderungen, die Sie ab jetzt vornehmen, werden hier erfasst.",
"Turn on \"Track changes\" in the properties panel, or take a Snapshot from ⋯ and use Review changes.": "Aktivieren Sie „Änderungen nachverfolgen“ im Eigenschaftenbereich, oder erstellen Sie über ⋯ eine Momentaufnahme und verwenden Sie Änderungen überprüfen.",
+ "Turn {{…}} tokens into fields": "{{…}}-Platzhalter in Felder umwandeln",
"Typeface": "Schriftart",
"US Legal": "US Legal",
"US Letter": "US Letter",
@@ -317,6 +352,7 @@ export const de: Catalog = {
"Update this file": "Diese Datei aktualisieren",
"Updates": "Updates",
"Use document defaults": "Dokumentstandards verwenden",
+ "Use {{#}} for the row number, or a column name in braces.": "Verwenden Sie {{#}} für die Zeilennummer oder einen Spaltennamen in geschweiften Klammern.",
"Version {v} is available.": "Version {v} ist verfügbar.",
"Visit bento.page (opens in a new tab)": "bento.page besuchen (öffnet einen neuen Tab)",
"Weight": "Schriftstärke",
@@ -338,6 +374,7 @@ export const de: Catalog = {
"mixed": "gemischt",
"mm": "mm",
"not cited": "nicht zitiert",
+ "or a field name…": "oder ein Feldname…",
"pt": "pt",
"the text this was about is gone": "der zugehörige Text ist nicht mehr vorhanden",
"v{app} · format v{fmt}": "v{app} · Format v{fmt}",
@@ -345,15 +382,18 @@ export const de: Catalog = {
"{key} is cited in this document. Remove it anyway?": "{key} wird in diesem Dokument zitiert. Trotzdem entfernen?",
"{m} changes": "{m} Änderungen",
"{n} broken reference(s)": "{n} defekte(r) Verweis(e)",
+ "{n} field(s) created from tokens": "{n} Feld(er) aus Platzhaltern erstellt",
"{n} more": "{n} weitere",
"{n} of {m}": "{n} von {m}",
"{n} of {total}": "{n} von {total}",
"{n} replies": "{n} Antworten",
"{open} open of {all}": "{open} von {all} offen",
"{pages} page(s) · {words} words · {blocks} blocks · {notes} footnote(s). The document, the editor and the typesetter are all in this one file.": "{pages} Seite(n) · {words} Wörter · {blocks} Blöcke · {notes} Fußnote(n). Dokument, Editor und Satzsystem befinden sich alle in dieser einen Datei.",
+ "{rows} row(s), {cols} column(s)": "{rows} Zeile(n), {cols} Spalte(n)",
"{rows} rows × {cols} columns": "{rows} Zeilen × {cols} Spalten",
"{size}, {orient} · text area {w} × {h} {unit}": "{size}, {orient} · Textbereich {w} × {h} {unit}",
"— mixed —": "— gemischt —",
+ "“{name}” is also a document property — this column takes over that field": "„{name}“ ist auch eine Dokumenteigenschaft – diese Spalte ersetzt jenes Feld",
"…": "…",
"⌃⇧↑ / ⌃⇧↓": "⌃⇧↑ / ⌃⇧↓",
"Discard": "Verwerfen",
@@ -404,4 +444,21 @@ export const de: Catalog = {
"Mints brand-new keys. Every previously sent copy stops syncing for good; share fresh copies afterwards.": "Erzeugt völlig neue Schlüssel. Alle zuvor gesendeten Kopien synchronisieren endgültig nicht mehr; teilen Sie danach neue Kopien.",
"Offline mode is on — nothing leaves this computer.": "Der Offlinemodus ist aktiv – nichts verlässt diesen Computer.",
"Tabs on this machine still sync; turn offline mode off to collaborate online.": "Tabs auf diesem Rechner synchronisieren weiterhin; schalten Sie den Offlinemodus aus, um online zusammenzuarbeiten.",
+ // compare with a file — the redline against another document (compare.ts)
+ "That is a {app} file, not a bento/type document.": "Das ist eine {app}-Datei, kein bento/type-Dokument.",
+ "That file does not look like a bento/type document.": "Diese Datei sieht nicht nach einem bento/type-Dokument aus.",
+ "That file has no document in it.": "Diese Datei enthält kein Dokument.",
+ "That file could not be read: {detail}": "Diese Datei konnte nicht gelesen werden: {detail}",
+ "That file is a different document, not another copy of this one — comparing unrelated documents works, but check you picked the file you meant.": "Diese Datei ist ein anderes Dokument, keine weitere Kopie dieses Dokuments – nicht verwandte Dokumente zu vergleichen funktioniert, prüfen Sie aber, ob Sie die gewünschte Datei gewählt haben.",
+ "One problem in that file was repaired as it was read, which can itself appear below as a change.": "Ein Problem in dieser Datei wurde beim Lesen repariert, was unten selbst als Änderung erscheinen kann.",
+ "{n} problems in that file were repaired as it was read, which can themselves appear below as changes.": "{n} Probleme in dieser Datei wurden beim Lesen repariert, was unten selbst als Änderungen erscheinen kann.",
+ "This is a view: changes are shown, never applied. Accept and reject are offered only against a Snapshot of this document.": "Dies ist nur eine Ansicht: Änderungen werden gezeigt, nie angewendet. Annehmen und Ablehnen gibt es nur gegenüber einer Momentaufnahme dieses Dokuments.",
+ "That file is identical to this document — there is nothing to compare.": "Diese Datei ist mit diesem Dokument identisch – es gibt nichts zu vergleichen.",
+ "1 change from “{file}” to this document": "1 Änderung von „{file}“ zu diesem Dokument",
+ "{n} changes from “{file}” to this document": "{n} Änderungen von „{file}“ zu diesem Dokument",
+ "Compare with another document": "Mit einem anderen Dokument vergleichen",
+ "Choose another bento/type file. The redline shows what changed from that file to this document. Comparing never changes what you have open.": "Wählen Sie eine andere bento/type-Datei. Der Vergleich zeigt, was sich von dieser Datei zu diesem Dokument geändert hat. Vergleichen ändert nie, was Sie geöffnet haben.",
+ "Drop a Bento document here": "Ein Bento-Dokument hier ablegen",
+ "Choose a file…": "Datei auswählen…",
+ "Compare with a file…": "Mit einer Datei vergleichen…",
}
diff --git a/type/src/i18n/es.ts b/type/src/i18n/es.ts
index ce709014..ac78b807 100644
--- a/type/src/i18n/es.ts
+++ b/type/src/i18n/es.ts
@@ -30,6 +30,7 @@ export const es: Catalog = {
"Appearance": "Apariencia",
"Applied style": "Estilo aplicado",
"Apply": "Aplicar",
+ "Author": "Autor",
"Author–year — APA-ish": "Autor-año (estilo APA)",
"Auto": "Automático",
"Bento artifact": "Artefacto de Bento",
@@ -58,10 +59,12 @@ export const es: Catalog = {
"Comments": "Comentarios",
"Comments hidden": "Comentarios ocultos",
"Comments shown": "Comentarios visibles",
+ "Company": "Empresa",
"Contents": "Contenido",
"Contents inserted. Page numbers fill in as the document paginates.": "Contenido insertado. Los números de página se completan a medida que el documento se pagina.",
"Copy document JSON": "Copiar el JSON del documento",
"Could not check right now.": "No se pudo comprobar en este momento.",
+ "Could not read: {cols}": "No se pudo leer: {cols}",
"Credits": "Créditos",
"Cross-reference": "Referencia cruzada",
"Custom": "Personalizado",
@@ -80,6 +83,7 @@ export const es: Catalog = {
"Document id": "ID del documento",
"Document title": "Título del documento",
"Drag to move, click for options": "Arrastra para mover, haz clic para ver opciones",
+ "Each row becomes one complete file in a folder you choose.": "Cada fila se convierte en un archivo completo dentro de la carpeta que elijas.",
"Edit": "Editar",
"Edit your comment": "Editar tu comentario",
"Edit “{name}”": "Editar «{name}»",
@@ -88,9 +92,12 @@ export const es: Catalog = {
"Embedded from {app}": "Insertado desde {app}",
"Equation added — edit it in the Math panel": "Ecuación añadida: edítala en el panel de matemáticas",
"Equation block": "Bloque de ecuación",
+ "Field": "Campo",
+ "Field: {name}": "Campo: {name}",
"Figure": "Figura",
"Figures": "Figuras",
"File": "Archivo",
+ "File names": "Nombres de archivo",
"Find": "Buscar",
"Find and replace (⌘F)": "Buscar y reemplazar (⌘F)",
"Find in document": "Buscar en el documento",
@@ -102,6 +109,7 @@ export const es: Catalog = {
"Formula": "Fórmula",
"Formula (⌘M)": "Fórmula (⌘M)",
"Formula added — edit it in the Math panel": "Fórmula añadida: edítala en el panel de matemáticas",
+ "From the data source": "De la fuente de datos",
"From {app}": "Desde {app}",
"Header row": "Fila de encabezado",
"Heading 1": "Título 1",
@@ -119,6 +127,8 @@ export const es: Catalog = {
"Insert a cross-reference": "Insertar una referencia cruzada",
"Insert a cross-reference to a caption": "Insertar una referencia cruzada a un título",
"Insert a display equation on its own line": "Insertar una ecuación en su propia línea",
+ "Insert a field": "Insertar un campo",
+ "Insert a field that the document fills in": "Insertar un campo que el documento rellena",
"Insert a picture": "Insertar una imagen",
"Insert a picture, table, formula, citation…": "Insertar una imagen, tabla, fórmula, cita…",
"Insert a table": "Insertar una tabla",
@@ -130,6 +140,7 @@ export const es: Catalog = {
"Justified": "Justificado",
"Keep together": "Mantener unido",
"Keep with next": "Mantener con el siguiente",
+ "Keywords": "Palabras clave",
"Label — “Table 2”": "Etiqueta: «Tabla 2»",
"Landscape": "Horizontal",
"Layout": "Diseño",
@@ -140,11 +151,16 @@ export const es: Catalog = {
"Line spacing": "Interlineado",
"Link (⌘K)": "Enlace (⌘K)",
"Link address": "Dirección del enlace",
+ "Mail merge": "Combinación de correspondencia",
+ "Mail merge from a sheet…": "Combinar correspondencia desde una hoja…",
"Margins": "Márgenes",
"Margins…": "Márgenes…",
"Match case": "Coincidir mayúsculas",
"Math": "Matemáticas",
"Medium": "Medio",
+ "Merge failed: {why}": "La combinación falló: {why}",
+ "Merge {n} document(s)": "Combinar {n} documento(s)",
+ "Merged {n} document(s)": "Se combinaron {n} documento(s)",
"Modified": "Modificado",
"More — revisions, signing, print": "Más: revisiones, firma, impresión",
"Move down": "Mover hacia abajo",
@@ -159,8 +175,10 @@ export const es: Catalog = {
"No matches": "Sin coincidencias",
"No sources yet. Paste a .bib file to get started.": "Aún no hay fuentes. Pega un archivo .bib para empezar.",
"No tracked changes": "Sin cambios control de cambios",
+ "No {{…}} tokens found in this document": "No se encontró ningún marcador {{…}} en este documento",
"Nothing is cited yet, so the list is empty.": "Aún no se ha citado nada, por lo que la lista está vacía.",
"Nothing matches.": "No hay coincidencias.",
+ "Nothing supplies “{name}” — it prints as nothing": "Nada proporciona «{name}»: se imprimirá vacío",
"Nothing that looks like a BibTeX entry.": "No hay nada que parezca una entrada BibTeX.",
"Nothing to refer to yet — caption a table first": "Aún no hay nada que referenciar: primero añade un título a una tabla",
"Nothing was imported.": "No se importó nada.",
@@ -171,6 +189,7 @@ export const es: Catalog = {
"Numeric [1] — IEEE-ish": "Numérico [1] (estilo IEEE)",
"Off by default: most documents already carry their numbers in the heading text.": "Desactivado de forma predeterminada: la mayoría de los documentos ya llevan sus números en el texto del título.",
"Open": "Abrir",
+ "Optical margins": "Márgenes ópticos",
"Orientation": "Orientación",
"Original": "Original",
"Outline — show or hide the document map": "Esquema: mostrar u ocultar el mapa del documento",
@@ -179,6 +198,7 @@ export const es: Catalog = {
"Page break inserted": "Salto de página insertado",
"Page break removed": "Salto de página eliminado",
"Page breaking": "Salto de página",
+ "Page number": "Número de página",
"Page or section, optional — e.g. p. 34": "Página o sección, opcional; p. ej., p. 34",
"Page setup": "Configurar página",
"Page size": "Tamaño de página",
@@ -196,12 +216,14 @@ export const es: Catalog = {
"Previous match (⇧Enter)": "Coincidencia anterior (⇧Intro)",
"Print or PDF…": "Imprimir o PDF…",
"Properties": "Propiedades",
+ "Punctuation hangs a little past the margin so the edge of the text reads straight. It never changes where lines break, so the page count is the same either way.": "La puntuación sobresale ligeramente del margen para que el borde del texto se vea recto. Nunca cambia dónde se parten las líneas, así que el número de páginas es el mismo en ambos casos.",
"Put the caret in a heading first.": "Primero coloca el cursor en un título.",
"Put the caret in a paragraph first": "Coloca primero el cursor en un párrafo",
"Put the caret in the document first": "Coloca primero el cursor en el documento",
"Put the caret in the table or paragraph to caption": "Coloca el cursor en la tabla o el párrafo que quieras titular",
"Put the caret on a tracked change first": "Coloca primero el cursor en un cambio control de cambios",
"Put the caret where the citation goes first": "Coloca primero el cursor donde irá la cita",
+ "Put the caret where the field goes": "Coloca primero el cursor donde irá el campo",
"Put the caret where the formula should go": "Coloca el cursor donde debe ir la fórmula",
"Put the caret where the reference goes": "Coloca primero el cursor donde irá la referencia",
"Quote": "Cita",
@@ -243,6 +265,7 @@ export const es: Catalog = {
"Select something to see its properties.": "Selecciona algo para ver sus propiedades.",
"Select the words you want to link": "Selecciona las palabras que quieres enlazar",
"Semibold": "Seminegrita",
+ "Sheet": "Hoja",
"Show comments": "Mostrar comentarios",
"Signatures": "Firmas",
"Sign…": "Firmar…",
@@ -257,9 +280,13 @@ export const es: Catalog = {
"Space before": "Espacio antes",
"Space before (px)": "Espacio antes (px)",
"Start this paragraph on a new page.": "Este párrafo comenzará en una página nueva.",
+ "Stop": "Detener",
+ "Stopped after {n} of {all} document(s)": "Se detuvo tras {n} de {all} documento(s)",
"Strikethrough": "Tachado",
"Style": "Estilo",
"Style updated from this paragraph": "Estilo actualizado a partir de este párrafo",
+ "Subject": "Asunto",
+ "Subtitle": "Subtítulo",
"Supported: \\frac \\sqrt ^ _ \\sum \\int \\left( \\right) Greek, matrices, cases.": "Compatible con: \\frac \\sqrt ^ _ \\sum \\int \\left( \\right), letras griegas, matrices, casos.",
"Table": "Tabla",
"Tables and figures are numbered separately, in document order.": "Las tablas y las figuras se numeran por separado, en el orden del documento.",
@@ -270,8 +297,10 @@ export const es: Catalog = {
"That JSON was empty.": "Ese JSON estaba vacío.",
"That file could not be read as a picture.": "No se pudo leer ese archivo como una imagen.",
"That file does not look like a Bento document.": "Ese archivo no parece ser un documento de Bento.",
+ "That file has no sheet with named columns to merge from.": "Ese archivo no tiene ninguna hoja con columnas con nombre para combinar.",
"That is already a caption": "Eso ya es un título",
"That is not a bento/type document: {detail}": "No es un documento de bento/type: {detail}",
+ "That is not a usable field name": "Ese no es un nombre de campo válido",
"That is not an address this document can link to": "Esa no es una dirección a la que este documento pueda enlazar",
"That saved version could not be restored.": "No se pudo restaurar esa versión guardada.",
"That sheet is larger than any printer takes.": "Esa hoja es más grande de lo que admite cualquier impresora.",
@@ -285,7 +314,9 @@ export const es: Catalog = {
"Theme: {mode} — click to cycle auto/light/dark": "Tema: {mode}: haz clic para alternar entre automático/claro/oscuro",
"These render as [?key] in the document so they cannot be missed.": "Se muestran como [?key] en el documento para que no pasen desapercibidas.",
"This already has a caption": "Esto ya tiene un título",
+ "This browser can only download files one at a time, which is not workable past {n} rows. Open this document in Chrome or Edge to merge it.": "Este navegador solo puede descargar los archivos de uno en uno, lo que no es viable por encima de {n} filas. Abre este documento en Chrome o Edge para combinarlo.",
"This browser cannot write back to the file, so every save makes a new copy. Chrome and Edge on a computer can save in place.": "Este navegador no puede reescribir el archivo, así que cada vez que guardas se crea una copia nueva. Chrome y Edge en un ordenador pueden guardar en el mismo archivo.",
+ "This browser will download each file separately — expect one prompt per row.": "Este navegador descargará cada archivo por separado: habrá un aviso por fila.",
"This build cannot render captions yet — apply the core patch listed at the top of xref.ts": "Esta compilación aún no puede renderizar títulos: aplica el parche del núcleo indicado al principio de xref.ts",
"This document has no sources yet. Import some BibTeX first.": "Este documento aún no tiene fuentes. Importa primero algo de BibTeX.",
"This embed could not be displayed safely.": "Este contenido incrustado no se pudo mostrar de forma segura.",
@@ -300,12 +331,16 @@ export const es: Catalog = {
"This reference points at something that is no longer in the document": "Esta referencia apunta a algo que ya no está en el documento",
"Those side margins leave no room for text.": "Esos márgenes laterales no dejan espacio para el texto.",
"Those top and bottom margins leave no room for text.": "Esos márgenes superior e inferior no dejan espacio para el texto.",
+ "Time of day": "Hora del día",
+ "Today’s date": "Fecha de hoy",
"Top / bottom (in)": "Superior / inferior (in)",
"Top / bottom (mm)": "Superior / inferior (mm)",
+ "Total pages": "Total de páginas",
"Track changes": "Control de cambios",
"Tracked changes": "Cambios control de cambios",
"Tracking is on. Edits you make from now on are recorded here.": "El seguimiento está activado. Las ediciones que hagas a partir de ahora se registran aquí.",
"Turn on \"Track changes\" in the properties panel, or take a Snapshot from ⋯ and use Review changes.": "Activa «Control de cambios» en el panel de propiedades, o toma una Instantánea desde ⋯ y usa Revisar cambios.",
+ "Turn {{…}} tokens into fields": "Convertir los marcadores {{…}} en campos",
"Typeface": "Tipo de letra",
"US Legal": "Legal (EE. UU.)",
"US Letter": "Carta (EE. UU.)",
@@ -317,6 +352,7 @@ export const es: Catalog = {
"Update this file": "Actualizar este archivo",
"Updates": "Actualizaciones",
"Use document defaults": "Usar los valores predeterminados del documento",
+ "Use {{#}} for the row number, or a column name in braces.": "Usa {{#}} para el número de fila, o un nombre de columna entre llaves.",
"Version {v} is available.": "La versión {v} está disponible.",
"Visit bento.page (opens in a new tab)": "Visitar bento.page (se abre en una pestaña nueva)",
"Weight": "Grosor",
@@ -338,6 +374,7 @@ export const es: Catalog = {
"mixed": "mixto",
"mm": "mm",
"not cited": "sin citar",
+ "or a field name…": "o un nombre de campo…",
"pt": "pt",
"the text this was about is gone": "el texto al que se refería ha desaparecido",
"v{app} · format v{fmt}": "v{app} · formato v{fmt}",
@@ -345,15 +382,18 @@ export const es: Catalog = {
"{key} is cited in this document. Remove it anyway?": "{key} está citada en este documento. ¿Quitarla de todos modos?",
"{m} changes": "{m} cambios",
"{n} broken reference(s)": "{n} referencia(s) rota(s)",
+ "{n} field(s) created from tokens": "Se crearon {n} campo(s) a partir de los marcadores",
"{n} more": "{n} más",
"{n} of {m}": "{n} de {m}",
"{n} of {total}": "{n} de {total}",
"{n} replies": "{n} respuestas",
"{open} open of {all}": "{open} abiertas de {all}",
"{pages} page(s) · {words} words · {blocks} blocks · {notes} footnote(s). The document, the editor and the typesetter are all in this one file.": "{pages} página(s) · {words} palabras · {blocks} bloques · {notes} nota(s) al pie. El documento, el editor y el compositor tipográfico están todos en este único archivo.",
+ "{rows} row(s), {cols} column(s)": "{rows} fila(s), {cols} columna(s)",
"{rows} rows × {cols} columns": "{rows} filas × {cols} columnas",
"{size}, {orient} · text area {w} × {h} {unit}": "{size}, {orient} · área de texto {w} × {h} {unit}",
"— mixed —": "— mixto —",
+ "“{name}” is also a document property — this column takes over that field": "«{name}» también es una propiedad del documento: esta columna sustituye a ese campo",
"…": "…",
"⌃⇧↑ / ⌃⇧↓": "⌃⇧↑ / ⌃⇧↓",
"Discard": "Descartar",
@@ -404,4 +444,21 @@ export const es: Catalog = {
"Mints brand-new keys. Every previously sent copy stops syncing for good; share fresh copies afterwards.": "Genera claves totalmente nuevas. Todas las copias enviadas antes dejan de sincronizarse para siempre; comparte copias nuevas después.",
"Offline mode is on — nothing leaves this computer.": "El modo sin conexión está activado: nada sale de este ordenador.",
"Tabs on this machine still sync; turn offline mode off to collaborate online.": "Las pestañas de este equipo siguen sincronizándose; desactiva el modo sin conexión para colaborar en línea.",
+ // compare with a file — the redline against another document (compare.ts)
+ "That is a {app} file, not a bento/type document.": "Ese es un archivo de {app}, no un documento de bento/type.",
+ "That file does not look like a bento/type document.": "Ese archivo no parece un documento de bento/type.",
+ "That file has no document in it.": "Ese archivo no contiene ningún documento.",
+ "That file could not be read: {detail}": "No se pudo leer ese archivo: {detail}",
+ "That file is a different document, not another copy of this one — comparing unrelated documents works, but check you picked the file you meant.": "Ese archivo es un documento distinto, no otra copia de este: comparar documentos sin relación funciona, pero comprueba que has elegido el archivo que querías.",
+ "One problem in that file was repaired as it was read, which can itself appear below as a change.": "Se reparó un problema de ese archivo al leerlo, lo que puede aparecer más abajo como un cambio.",
+ "{n} problems in that file were repaired as it was read, which can themselves appear below as changes.": "Se repararon {n} problemas de ese archivo al leerlo, lo que puede aparecer más abajo como cambios.",
+ "This is a view: changes are shown, never applied. Accept and reject are offered only against a Snapshot of this document.": "Esto es una vista: los cambios se muestran, nunca se aplican. Aceptar y rechazar solo se ofrecen frente a una instantánea de este documento.",
+ "That file is identical to this document — there is nothing to compare.": "Ese archivo es idéntico a este documento: no hay nada que comparar.",
+ "1 change from “{file}” to this document": "1 cambio de «{file}» a este documento",
+ "{n} changes from “{file}” to this document": "{n} cambios de «{file}» a este documento",
+ "Compare with another document": "Comparar con otro documento",
+ "Choose another bento/type file. The redline shows what changed from that file to this document. Comparing never changes what you have open.": "Elige otro archivo de bento/type. La comparación muestra qué cambió de ese archivo a este documento. Comparar nunca modifica lo que tienes abierto.",
+ "Drop a Bento document here": "Suelta aquí un documento de Bento",
+ "Choose a file…": "Elegir un archivo…",
+ "Compare with a file…": "Comparar con un archivo…",
}
diff --git a/type/src/i18n/fr.ts b/type/src/i18n/fr.ts
index b0eca3f2..5bf91789 100644
--- a/type/src/i18n/fr.ts
+++ b/type/src/i18n/fr.ts
@@ -30,6 +30,7 @@ export const fr: Catalog = {
"Appearance": "Apparence",
"Applied style": "Style appliqué",
"Apply": "Appliquer",
+ "Author": "Auteur",
"Author–year — APA-ish": "Auteur-année (style APA)",
"Auto": "Automatique",
"Bento artifact": "Artefact Bento",
@@ -58,10 +59,12 @@ export const fr: Catalog = {
"Comments": "Commentaires",
"Comments hidden": "Commentaires masqués",
"Comments shown": "Commentaires affichés",
+ "Company": "Société",
"Contents": "Sommaire",
"Contents inserted. Page numbers fill in as the document paginates.": "Sommaire inséré. Les numéros de page se complètent au fur et à mesure de la pagination du document.",
"Copy document JSON": "Copier le JSON du document",
"Could not check right now.": "Impossible de vérifier pour le moment.",
+ "Could not read: {cols}": "Lecture impossible : {cols}",
"Credits": "Crédits",
"Cross-reference": "Renvoi",
"Custom": "Personnalisé",
@@ -80,6 +83,7 @@ export const fr: Catalog = {
"Document id": "ID du document",
"Document title": "Titre du document",
"Drag to move, click for options": "Faites glisser pour déplacer, cliquez pour les options",
+ "Each row becomes one complete file in a folder you choose.": "Chaque ligne devient un fichier complet dans le dossier que vous choisissez.",
"Edit": "Modifier",
"Edit your comment": "Modifier votre commentaire",
"Edit “{name}”": "Modifier « {name} »",
@@ -88,9 +92,12 @@ export const fr: Catalog = {
"Embedded from {app}": "Intégré depuis {app}",
"Equation added — edit it in the Math panel": "Équation ajoutée — modifiez-la dans le panneau Mathématiques",
"Equation block": "Bloc d'équation",
+ "Field": "Champ",
+ "Field: {name}": "Champ : {name}",
"Figure": "Figure",
"Figures": "Figures",
"File": "Fichier",
+ "File names": "Noms de fichier",
"Find": "Rechercher",
"Find and replace (⌘F)": "Rechercher et remplacer (⌘F)",
"Find in document": "Rechercher dans le document",
@@ -102,6 +109,7 @@ export const fr: Catalog = {
"Formula": "Formule",
"Formula (⌘M)": "Formule (⌘M)",
"Formula added — edit it in the Math panel": "Formule ajoutée — modifiez-la dans le panneau Mathématiques",
+ "From the data source": "Depuis la source de données",
"From {app}": "Depuis {app}",
"Header row": "Ligne d'en-tête",
"Heading 1": "Titre 1",
@@ -119,6 +127,8 @@ export const fr: Catalog = {
"Insert a cross-reference": "Insérer un renvoi",
"Insert a cross-reference to a caption": "Insérer un renvoi vers une légende",
"Insert a display equation on its own line": "Insérer une équation sur sa propre ligne",
+ "Insert a field": "Insérer un champ",
+ "Insert a field that the document fills in": "Insérer un champ que le document remplit",
"Insert a picture": "Insérer une image",
"Insert a picture, table, formula, citation…": "Insérer une image, un tableau, une formule, une citation…",
"Insert a table": "Insérer un tableau",
@@ -130,6 +140,7 @@ export const fr: Catalog = {
"Justified": "Justifié",
"Keep together": "Ne pas scinder",
"Keep with next": "Solidaire du suivant",
+ "Keywords": "Mots-clés",
"Label — “Table 2”": "Étiquette : « Tableau 2 »",
"Landscape": "Paysage",
"Layout": "Mise en page",
@@ -140,11 +151,16 @@ export const fr: Catalog = {
"Line spacing": "Interligne",
"Link (⌘K)": "Lien (⌘K)",
"Link address": "Adresse du lien",
+ "Mail merge": "Publipostage",
+ "Mail merge from a sheet…": "Publipostage depuis une feuille…",
"Margins": "Marges",
"Margins…": "Marges…",
"Match case": "Respecter la casse",
"Math": "Mathématiques",
"Medium": "Medium",
+ "Merge failed: {why}": "Échec du publipostage : {why}",
+ "Merge {n} document(s)": "Fusionner {n} document(s)",
+ "Merged {n} document(s)": "{n} document(s) fusionné(s)",
"Modified": "Modifié",
"More — revisions, signing, print": "Plus — révisions, signature, impression",
"Move down": "Déplacer vers le bas",
@@ -159,8 +175,10 @@ export const fr: Catalog = {
"No matches": "Aucune occurrence",
"No sources yet. Paste a .bib file to get started.": "Pas encore de sources. Collez un fichier .bib pour commencer.",
"No tracked changes": "Aucune modification suivie",
+ "No {{…}} tokens found in this document": "Aucun marqueur {{…}} trouvé dans ce document",
"Nothing is cited yet, so the list is empty.": "Rien n'est encore cité, la liste est donc vide.",
"Nothing matches.": "Aucune correspondance.",
+ "Nothing supplies “{name}” — it prints as nothing": "Rien ne fournit « {name} » — l’impression sera vide",
"Nothing that looks like a BibTeX entry.": "Rien qui ressemble à une entrée BibTeX.",
"Nothing to refer to yet — caption a table first": "Rien à référencer pour l'instant — légendez d'abord un tableau",
"Nothing was imported.": "Rien n'a été importé.",
@@ -171,6 +189,7 @@ export const fr: Catalog = {
"Numeric [1] — IEEE-ish": "Numérique [1] (style IEEE)",
"Off by default: most documents already carry their numbers in the heading text.": "Désactivé par défaut : la plupart des documents portent déjà leurs numéros dans le texte du titre.",
"Open": "Ouvrir",
+ "Optical margins": "Marges optiques",
"Orientation": "Orientation",
"Original": "Original",
"Outline — show or hide the document map": "Plan — afficher ou masquer le plan du document",
@@ -179,6 +198,7 @@ export const fr: Catalog = {
"Page break inserted": "Saut de page inséré",
"Page break removed": "Saut de page supprimé",
"Page breaking": "Saut de page",
+ "Page number": "Numéro de page",
"Page or section, optional — e.g. p. 34": "Page ou section, facultatif — ex. p. 34",
"Page setup": "Mise en page",
"Page size": "Format de page",
@@ -196,12 +216,14 @@ export const fr: Catalog = {
"Previous match (⇧Enter)": "Occurrence précédente (⇧Entrée)",
"Print or PDF…": "Imprimer ou PDF…",
"Properties": "Propriétés",
+ "Punctuation hangs a little past the margin so the edge of the text reads straight. It never changes where lines break, so the page count is the same either way.": "La ponctuation déborde légèrement de la marge pour que le bord du texte paraisse droit. Cela ne change jamais les coupures de ligne, donc le nombre de pages reste le même.",
"Put the caret in a heading first.": "Placez d'abord le curseur dans un titre.",
"Put the caret in a paragraph first": "Placez d'abord le curseur dans un paragraphe",
"Put the caret in the document first": "Placez d'abord le curseur dans le document",
"Put the caret in the table or paragraph to caption": "Placez le curseur dans le tableau ou le paragraphe à légender",
"Put the caret on a tracked change first": "Placez d'abord le curseur sur une modification suivie",
"Put the caret where the citation goes first": "Placez d'abord le curseur à l'endroit où la citation doit apparaître",
+ "Put the caret where the field goes": "Placez d'abord le curseur à l'endroit où le champ doit apparaître",
"Put the caret where the formula should go": "Placez le curseur à l'endroit où la formule doit apparaître",
"Put the caret where the reference goes": "Placez d'abord le curseur à l'endroit où la référence doit apparaître",
"Quote": "Citation",
@@ -243,6 +265,7 @@ export const fr: Catalog = {
"Select something to see its properties.": "Sélectionnez un élément pour voir ses propriétés.",
"Select the words you want to link": "Sélectionnez les mots à lier",
"Semibold": "Demi-gras",
+ "Sheet": "Feuille",
"Show comments": "Afficher les commentaires",
"Signatures": "Signatures",
"Sign…": "Signer…",
@@ -257,9 +280,13 @@ export const fr: Catalog = {
"Space before": "Espace avant",
"Space before (px)": "Espace avant (px)",
"Start this paragraph on a new page.": "Ce paragraphe commencera sur une nouvelle page.",
+ "Stop": "Arrêter",
+ "Stopped after {n} of {all} document(s)": "Arrêté après {n} document(s) sur {all}",
"Strikethrough": "Barré",
"Style": "Style",
"Style updated from this paragraph": "Style mis à jour à partir de ce paragraphe",
+ "Subject": "Objet",
+ "Subtitle": "Sous-titre",
"Supported: \\frac \\sqrt ^ _ \\sum \\int \\left( \\right) Greek, matrices, cases.": "Pris en charge : \\frac \\sqrt ^ _ \\sum \\int \\left( \\right), lettres grecques, matrices, cas.",
"Table": "Tableau",
"Tables and figures are numbered separately, in document order.": "Les tableaux et les figures sont numérotés séparément, dans l'ordre du document.",
@@ -270,8 +297,10 @@ export const fr: Catalog = {
"That JSON was empty.": "Ce JSON était vide.",
"That file could not be read as a picture.": "Ce fichier n'a pas pu être lu comme une image.",
"That file does not look like a Bento document.": "Ce fichier ne ressemble pas à un document Bento.",
+ "That file has no sheet with named columns to merge from.": "Ce fichier ne contient aucune feuille avec des colonnes nommées à fusionner.",
"That is already a caption": "C'est déjà une légende",
"That is not a bento/type document: {detail}": "Ce n'est pas un document bento/type : {detail}",
+ "That is not a usable field name": "Ce n’est pas un nom de champ utilisable",
"That is not an address this document can link to": "Ce n'est pas une adresse vers laquelle ce document peut créer un lien",
"That saved version could not be restored.": "Impossible de restaurer cette version enregistrée.",
"That sheet is larger than any printer takes.": "Cette feuille est plus grande que ce qu'accepte n'importe quelle imprimante.",
@@ -285,7 +314,9 @@ export const fr: Catalog = {
"Theme: {mode} — click to cycle auto/light/dark": "Thème : {mode} — cliquez pour alterner automatique/clair/sombre",
"These render as [?key] in the document so they cannot be missed.": "Ils s'affichent sous la forme [?key] dans le document afin qu'on ne puisse pas les manquer.",
"This already has a caption": "Ceci a déjà une légende",
+ "This browser can only download files one at a time, which is not workable past {n} rows. Open this document in Chrome or Edge to merge it.": "Ce navigateur ne peut télécharger les fichiers qu’un par un, ce qui n’est pas praticable au-delà de {n} lignes. Ouvrez ce document dans Chrome ou Edge pour le fusionner.",
"This browser cannot write back to the file, so every save makes a new copy. Chrome and Edge on a computer can save in place.": "Ce navigateur ne peut pas réécrire le fichier, donc chaque enregistrement crée une nouvelle copie. Chrome et Edge sur ordinateur peuvent enregistrer sur place.",
+ "This browser will download each file separately — expect one prompt per row.": "Ce navigateur téléchargera chaque fichier séparément — attendez-vous à une invite par ligne.",
"This build cannot render captions yet — apply the core patch listed at the top of xref.ts": "Cette version ne peut pas encore afficher les légendes — appliquez le correctif du noyau indiqué en haut de xref.ts",
"This document has no sources yet. Import some BibTeX first.": "Ce document n'a pas encore de sources. Importez d'abord du BibTeX.",
"This embed could not be displayed safely.": "Cet élément intégré n'a pas pu être affiché en toute sécurité.",
@@ -300,12 +331,16 @@ export const fr: Catalog = {
"This reference points at something that is no longer in the document": "Cette référence pointe vers un élément qui n'est plus dans le document",
"Those side margins leave no room for text.": "Ces marges latérales ne laissent aucune place au texte.",
"Those top and bottom margins leave no room for text.": "Ces marges du haut et du bas ne laissent aucune place au texte.",
+ "Time of day": "Heure du jour",
+ "Today’s date": "Date du jour",
"Top / bottom (in)": "Haut / bas (po)",
"Top / bottom (mm)": "Haut / bas (mm)",
+ "Total pages": "Nombre total de pages",
"Track changes": "Suivi des modifications",
"Tracked changes": "Modifications suivies",
"Tracking is on. Edits you make from now on are recorded here.": "Le suivi est activé. Les modifications que vous apportez désormais sont enregistrées ici.",
"Turn on \"Track changes\" in the properties panel, or take a Snapshot from ⋯ and use Review changes.": "Activez « Suivi des modifications » dans le panneau des propriétés, ou prenez un instantané depuis ⋯ et utilisez Réviser les modifications.",
+ "Turn {{…}} tokens into fields": "Convertir les marqueurs {{…}} en champs",
"Typeface": "Police",
"US Legal": "Légal US",
"US Letter": "Lettre US",
@@ -317,6 +352,7 @@ export const fr: Catalog = {
"Update this file": "Mettre à jour ce fichier",
"Updates": "Mises à jour",
"Use document defaults": "Utiliser les valeurs par défaut du document",
+ "Use {{#}} for the row number, or a column name in braces.": "Utilisez {{#}} pour le numéro de ligne, ou un nom de colonne entre accolades.",
"Version {v} is available.": "La version {v} est disponible.",
"Visit bento.page (opens in a new tab)": "Visiter bento.page (ouvre un nouvel onglet)",
"Weight": "Graisse",
@@ -338,6 +374,7 @@ export const fr: Catalog = {
"mixed": "mixte",
"mm": "mm",
"not cited": "non citée",
+ "or a field name…": "ou un nom de champ…",
"pt": "pt",
"the text this was about is gone": "le texte concerné a disparu",
"v{app} · format v{fmt}": "v{app} · format v{fmt}",
@@ -345,15 +382,18 @@ export const fr: Catalog = {
"{key} is cited in this document. Remove it anyway?": "{key} est citée dans ce document. La supprimer quand même ?",
"{m} changes": "{m} modifications",
"{n} broken reference(s)": "{n} référence(s) rompue(s)",
+ "{n} field(s) created from tokens": "{n} champ(s) créé(s) à partir des marqueurs",
"{n} more": "{n} de plus",
"{n} of {m}": "{n} sur {m}",
"{n} of {total}": "{n} sur {total}",
"{n} replies": "{n} réponses",
"{open} open of {all}": "{open} ouverts sur {all}",
"{pages} page(s) · {words} words · {blocks} blocks · {notes} footnote(s). The document, the editor and the typesetter are all in this one file.": "{pages} page(s) · {words} mots · {blocks} blocs · {notes} note(s) de bas de page. Le document, l'éditeur et le compositeur sont tous dans ce seul fichier.",
+ "{rows} row(s), {cols} column(s)": "{rows} ligne(s), {cols} colonne(s)",
"{rows} rows × {cols} columns": "{rows} lignes × {cols} colonnes",
"{size}, {orient} · text area {w} × {h} {unit}": "{size}, {orient} · zone de texte {w} × {h} {unit}",
"— mixed —": "— mixte —",
+ "“{name}” is also a document property — this column takes over that field": "« {name} » est aussi une propriété du document — cette colonne remplace ce champ",
"…": "…",
"⌃⇧↑ / ⌃⇧↓": "⌃⇧↑ / ⌃⇧↓",
"Discard": "Ignorer",
@@ -404,4 +444,21 @@ export const fr: Catalog = {
"Mints brand-new keys. Every previously sent copy stops syncing for good; share fresh copies afterwards.": "Génère des clés entièrement nouvelles. Toutes les copies envoyées auparavant cessent définitivement de se synchroniser ; partagez ensuite de nouvelles copies.",
"Offline mode is on — nothing leaves this computer.": "Le mode hors ligne est activé — rien ne quitte cet ordinateur.",
"Tabs on this machine still sync; turn offline mode off to collaborate online.": "Les onglets de cet ordinateur continuent de se synchroniser ; désactivez le mode hors ligne pour collaborer en ligne.",
+ // compare with a file — the redline against another document (compare.ts)
+ "That is a {app} file, not a bento/type document.": "Ce fichier est un fichier {app}, pas un document bento/type.",
+ "That file does not look like a bento/type document.": "Ce fichier ne ressemble pas à un document bento/type.",
+ "That file has no document in it.": "Ce fichier ne contient aucun document.",
+ "That file could not be read: {detail}": "Impossible de lire ce fichier : {detail}",
+ "That file is a different document, not another copy of this one — comparing unrelated documents works, but check you picked the file you meant.": "Ce fichier est un autre document, pas une autre copie de celui-ci — comparer des documents sans rapport fonctionne, mais vérifiez que vous avez choisi le bon fichier.",
+ "One problem in that file was repaired as it was read, which can itself appear below as a change.": "Un problème de ce fichier a été réparé à la lecture, ce qui peut apparaître ci-dessous comme une modification.",
+ "{n} problems in that file were repaired as it was read, which can themselves appear below as changes.": "{n} problèmes de ce fichier ont été réparés à la lecture, ce qui peut apparaître ci-dessous comme des modifications.",
+ "This is a view: changes are shown, never applied. Accept and reject are offered only against a Snapshot of this document.": "Ceci est un affichage : les modifications sont montrées, jamais appliquées. Accepter et refuser ne sont proposés que face à un instantané de ce document.",
+ "That file is identical to this document — there is nothing to compare.": "Ce fichier est identique à ce document — il n'y a rien à comparer.",
+ "1 change from “{file}” to this document": "1 modification de « {file} » vers ce document",
+ "{n} changes from “{file}” to this document": "{n} modifications de « {file} » vers ce document",
+ "Compare with another document": "Comparer avec un autre document",
+ "Choose another bento/type file. The redline shows what changed from that file to this document. Comparing never changes what you have open.": "Choisissez un autre fichier bento/type. La comparaison montre ce qui a changé de ce fichier vers ce document. Comparer ne modifie jamais ce que vous avez ouvert.",
+ "Drop a Bento document here": "Déposez ici un document Bento",
+ "Choose a file…": "Choisir un fichier…",
+ "Compare with a file…": "Comparer avec un fichier…",
}
diff --git a/type/src/i18n/it.ts b/type/src/i18n/it.ts
index e1aac3ad..abeda12d 100644
--- a/type/src/i18n/it.ts
+++ b/type/src/i18n/it.ts
@@ -30,6 +30,7 @@ export const it: Catalog = {
"Appearance": "Aspetto",
"Applied style": "Stile applicato",
"Apply": "Applica",
+ "Author": "Autore",
"Author–year — APA-ish": "Autore-anno (stile APA)",
"Auto": "Automatico",
"Bento artifact": "Artefatto Bento",
@@ -58,10 +59,12 @@ export const it: Catalog = {
"Comments": "Commenti",
"Comments hidden": "Commenti nascosti",
"Comments shown": "Commenti visibili",
+ "Company": "Azienda",
"Contents": "Sommario",
"Contents inserted. Page numbers fill in as the document paginates.": "Sommario inserito. I numeri di pagina si compilano man mano che il documento viene impaginato.",
"Copy document JSON": "Copia il JSON del documento",
"Could not check right now.": "Impossibile controllare in questo momento.",
+ "Could not read: {cols}": "Impossibile leggere: {cols}",
"Credits": "Crediti",
"Cross-reference": "Riferimento incrociato",
"Custom": "Personalizzato",
@@ -80,6 +83,7 @@ export const it: Catalog = {
"Document id": "ID documento",
"Document title": "Titolo del documento",
"Drag to move, click for options": "Trascina per spostare, fai clic per le opzioni",
+ "Each row becomes one complete file in a folder you choose.": "Ogni riga diventa un file completo nella cartella che scegli.",
"Edit": "Modifica",
"Edit your comment": "Modifica il tuo commento",
"Edit “{name}”": "Modifica «{name}»",
@@ -88,9 +92,12 @@ export const it: Catalog = {
"Embedded from {app}": "Incorporato da {app}",
"Equation added — edit it in the Math panel": "Equazione aggiunta: modificala nel pannello Matematica",
"Equation block": "Blocco equazione",
+ "Field": "Campo",
+ "Field: {name}": "Campo: {name}",
"Figure": "Figura",
"Figures": "Figure",
"File": "File",
+ "File names": "Nomi dei file",
"Find": "Trova",
"Find and replace (⌘F)": "Trova e sostituisci (⌘F)",
"Find in document": "Trova nel documento",
@@ -102,6 +109,7 @@ export const it: Catalog = {
"Formula": "Formula",
"Formula (⌘M)": "Formula (⌘M)",
"Formula added — edit it in the Math panel": "Formula aggiunta: modificala nel pannello Matematica",
+ "From the data source": "Dall’origine dati",
"From {app}": "Da {app}",
"Header row": "Riga di intestazione",
"Heading 1": "Titolo 1",
@@ -119,6 +127,8 @@ export const it: Catalog = {
"Insert a cross-reference": "Inserisci un riferimento incrociato",
"Insert a cross-reference to a caption": "Inserisci un riferimento incrociato a una didascalia",
"Insert a display equation on its own line": "Inserisci un'equazione su una riga propria",
+ "Insert a field": "Inserisci un campo",
+ "Insert a field that the document fills in": "Inserisci un campo che il documento compila",
"Insert a picture": "Inserisci un'immagine",
"Insert a picture, table, formula, citation…": "Inserisci immagine, tabella, formula, citazione…",
"Insert a table": "Inserisci una tabella",
@@ -130,6 +140,7 @@ export const it: Catalog = {
"Justified": "Giustificato",
"Keep together": "Non dividere",
"Keep with next": "Solidale con il successivo",
+ "Keywords": "Parole chiave",
"Label — “Table 2”": "Etichetta: «Tabella 2»",
"Landscape": "Orizzontale",
"Layout": "Layout",
@@ -140,11 +151,16 @@ export const it: Catalog = {
"Line spacing": "Interlinea",
"Link (⌘K)": "Collegamento (⌘K)",
"Link address": "Indirizzo del collegamento",
+ "Mail merge": "Stampa unione",
+ "Mail merge from a sheet…": "Stampa unione da un foglio…",
"Margins": "Margini",
"Margins…": "Margini…",
"Match case": "Maiuscole/minuscole",
"Math": "Matematica",
"Medium": "Medio",
+ "Merge failed: {why}": "Unione non riuscita: {why}",
+ "Merge {n} document(s)": "Unisci {n} documento/i",
+ "Merged {n} document(s)": "Uniti {n} documento/i",
"Modified": "Modificato",
"More — revisions, signing, print": "Altro: revisioni, firma, stampa",
"Move down": "Sposta giù",
@@ -159,8 +175,10 @@ export const it: Catalog = {
"No matches": "Nessuna corrispondenza",
"No sources yet. Paste a .bib file to get started.": "Ancora nessuna fonte. Incolla un file .bib per iniziare.",
"No tracked changes": "Nessuna modifica registrata",
+ "No {{…}} tokens found in this document": "Nessun segnaposto {{…}} trovato in questo documento",
"Nothing is cited yet, so the list is empty.": "Non è stato ancora citato nulla, quindi l'elenco è vuoto.",
"Nothing matches.": "Nessuna corrispondenza.",
+ "Nothing supplies “{name}” — it prints as nothing": "Nulla fornisce «{name}»: verrà stampato vuoto",
"Nothing that looks like a BibTeX entry.": "Niente che assomigli a una voce BibTeX.",
"Nothing to refer to yet — caption a table first": "Ancora nulla a cui fare riferimento: aggiungi prima una didascalia a una tabella",
"Nothing was imported.": "Non è stato importato nulla.",
@@ -171,6 +189,7 @@ export const it: Catalog = {
"Numeric [1] — IEEE-ish": "Numerico [1] (stile IEEE)",
"Off by default: most documents already carry their numbers in the heading text.": "Disattivato per impostazione predefinita: la maggior parte dei documenti riporta già i numeri nel testo del titolo.",
"Open": "Apri",
+ "Optical margins": "Margini ottici",
"Orientation": "Orientamento",
"Original": "Originale",
"Outline — show or hide the document map": "Struttura: mostra o nascondi la mappa del documento",
@@ -179,6 +198,7 @@ export const it: Catalog = {
"Page break inserted": "Interruzione di pagina inserita",
"Page break removed": "Interruzione di pagina rimossa",
"Page breaking": "Interruzione di pagina",
+ "Page number": "Numero di pagina",
"Page or section, optional — e.g. p. 34": "Pagina o sezione, facoltativo — es. p. 34",
"Page setup": "Imposta pagina",
"Page size": "Dimensione pagina",
@@ -196,12 +216,14 @@ export const it: Catalog = {
"Previous match (⇧Enter)": "Corrispondenza precedente (⇧Invio)",
"Print or PDF…": "Stampa o PDF…",
"Properties": "Proprietà",
+ "Punctuation hangs a little past the margin so the edge of the text reads straight. It never changes where lines break, so the page count is the same either way.": "La punteggiatura sporge leggermente oltre il margine, così il bordo del testo appare dritto. Non cambia mai dove vanno a capo le righe, quindi il numero di pagine resta lo stesso.",
"Put the caret in a heading first.": "Posiziona prima il cursore in un titolo.",
"Put the caret in a paragraph first": "Posiziona prima il cursore in un paragrafo",
"Put the caret in the document first": "Posiziona prima il cursore nel documento",
"Put the caret in the table or paragraph to caption": "Posiziona il cursore nella tabella o nel paragrafo da didascalizzare",
"Put the caret on a tracked change first": "Posiziona prima il cursore su una modifica registrata",
"Put the caret where the citation goes first": "Posiziona prima il cursore dove deve andare la citazione",
+ "Put the caret where the field goes": "Posiziona prima il cursore dove deve andare il campo",
"Put the caret where the formula should go": "Posiziona il cursore dove deve andare la formula",
"Put the caret where the reference goes": "Posiziona prima il cursore dove deve andare il riferimento",
"Quote": "Citazione",
@@ -243,6 +265,7 @@ export const it: Catalog = {
"Select something to see its properties.": "Seleziona qualcosa per vederne le proprietà.",
"Select the words you want to link": "Seleziona le parole a cui aggiungere il collegamento",
"Semibold": "Semigrassetto",
+ "Sheet": "Foglio",
"Show comments": "Mostra commenti",
"Signatures": "Firme",
"Sign…": "Firma…",
@@ -257,9 +280,13 @@ export const it: Catalog = {
"Space before": "Spazio prima",
"Space before (px)": "Spazio prima (px)",
"Start this paragraph on a new page.": "Questo paragrafo inizierà su una nuova pagina.",
+ "Stop": "Interrompi",
+ "Stopped after {n} of {all} document(s)": "Interrotto dopo {n} di {all} documento/i",
"Strikethrough": "Barrato",
"Style": "Stile",
"Style updated from this paragraph": "Stile aggiornato in base a questo paragrafo",
+ "Subject": "Oggetto",
+ "Subtitle": "Sottotitolo",
"Supported: \\frac \\sqrt ^ _ \\sum \\int \\left( \\right) Greek, matrices, cases.": "Supportati: \\frac \\sqrt ^ _ \\sum \\int \\left( \\right), lettere greche, matrici, casi.",
"Table": "Tabella",
"Tables and figures are numbered separately, in document order.": "Tabelle e figure sono numerate separatamente, nell'ordine del documento.",
@@ -270,8 +297,10 @@ export const it: Catalog = {
"That JSON was empty.": "Quel JSON era vuoto.",
"That file could not be read as a picture.": "Impossibile leggere quel file come immagine.",
"That file does not look like a Bento document.": "Quel file non sembra un documento Bento.",
+ "That file has no sheet with named columns to merge from.": "Quel file non ha fogli con colonne denominate da unire.",
"That is already a caption": "Questa è già una didascalia",
"That is not a bento/type document: {detail}": "Non è un documento bento/type: {detail}",
+ "That is not a usable field name": "Non è un nome di campo utilizzabile",
"That is not an address this document can link to": "Non è un indirizzo a cui questo documento può collegarsi",
"That saved version could not be restored.": "Impossibile ripristinare quella versione salvata.",
"That sheet is larger than any printer takes.": "Quel foglio è più grande di quanto qualsiasi stampante possa gestire.",
@@ -285,7 +314,9 @@ export const it: Catalog = {
"Theme: {mode} — click to cycle auto/light/dark": "Tema: {mode}: fai clic per alternare automatico/chiaro/scuro",
"These render as [?key] in the document so they cannot be missed.": "Vengono visualizzati come [?key] nel documento in modo che non possano passare inosservati.",
"This already has a caption": "Questo ha già una didascalia",
+ "This browser can only download files one at a time, which is not workable past {n} rows. Open this document in Chrome or Edge to merge it.": "Questo browser può scaricare i file solo uno alla volta, il che non è praticabile oltre {n} righe. Apri questo documento in Chrome o Edge per unirlo.",
"This browser cannot write back to the file, so every save makes a new copy. Chrome and Edge on a computer can save in place.": "Questo browser non può riscrivere il file, quindi ogni salvataggio crea una nuova copia. Chrome ed Edge su computer possono salvare direttamente nel file.",
+ "This browser will download each file separately — expect one prompt per row.": "Questo browser scaricherà ogni file separatamente: attendi una richiesta per riga.",
"This build cannot render captions yet — apply the core patch listed at the top of xref.ts": "Questa build non può ancora renderizzare le didascalie: applica la patch del core indicata in cima a xref.ts",
"This document has no sources yet. Import some BibTeX first.": "Questo documento non ha ancora fonti. Importa prima del BibTeX.",
"This embed could not be displayed safely.": "Questo elemento incorporato non può essere visualizzato in modo sicuro.",
@@ -300,12 +331,16 @@ export const it: Catalog = {
"This reference points at something that is no longer in the document": "Questo riferimento punta a qualcosa che non è più nel documento",
"Those side margins leave no room for text.": "Questi margini laterali non lasciano spazio al testo.",
"Those top and bottom margins leave no room for text.": "Questi margini superiore e inferiore non lasciano spazio al testo.",
+ "Time of day": "Ora del giorno",
+ "Today’s date": "Data di oggi",
"Top / bottom (in)": "Superiore / inferiore (in)",
"Top / bottom (mm)": "Superiore / inferiore (mm)",
+ "Total pages": "Pagine totali",
"Track changes": "Registra modifiche",
"Tracked changes": "Modifiche registrate",
"Tracking is on. Edits you make from now on are recorded here.": "Il tracciamento è attivo. Le modifiche che apporti da ora in poi vengono registrate qui.",
"Turn on \"Track changes\" in the properties panel, or take a Snapshot from ⋯ and use Review changes.": "Attiva \"Registra modifiche\" nel pannello delle proprietà, oppure crea un'istantanea da ⋯ e usa Rivedi modifiche.",
+ "Turn {{…}} tokens into fields": "Converti i segnaposto {{…}} in campi",
"Typeface": "Carattere",
"US Legal": "Legale USA",
"US Letter": "Lettera USA",
@@ -317,6 +352,7 @@ export const it: Catalog = {
"Update this file": "Aggiorna questo file",
"Updates": "Aggiornamenti",
"Use document defaults": "Usa i valori predefiniti del documento",
+ "Use {{#}} for the row number, or a column name in braces.": "Usa {{#}} per il numero di riga, oppure un nome di colonna tra parentesi graffe.",
"Version {v} is available.": "La versione {v} è disponibile.",
"Visit bento.page (opens in a new tab)": "Visita bento.page (si apre in una nuova scheda)",
"Weight": "Peso",
@@ -338,6 +374,7 @@ export const it: Catalog = {
"mixed": "misto",
"mm": "mm",
"not cited": "non citata",
+ "or a field name…": "oppure un nome di campo…",
"pt": "pt",
"the text this was about is gone": "il testo a cui si riferiva non c'è più",
"v{app} · format v{fmt}": "v{app} · formato v{fmt}",
@@ -345,15 +382,18 @@ export const it: Catalog = {
"{key} is cited in this document. Remove it anyway?": "{key} è citata in questo documento. Rimuoverla comunque?",
"{m} changes": "{m} modifiche",
"{n} broken reference(s)": "{n} riferimento/i non valido/i",
+ "{n} field(s) created from tokens": "Creati {n} campo/i dai segnaposto",
"{n} more": "{n} altri",
"{n} of {m}": "{n} di {m}",
"{n} of {total}": "{n} di {total}",
"{n} replies": "{n} risposte",
"{open} open of {all}": "{open} aperti su {all}",
"{pages} page(s) · {words} words · {blocks} blocks · {notes} footnote(s). The document, the editor and the typesetter are all in this one file.": "{pages} pagina/e · {words} parole · {blocks} blocchi · {notes} nota/e a piè di pagina. Il documento, l'editor e il compositore tipografico sono tutti in questo unico file.",
+ "{rows} row(s), {cols} column(s)": "{rows} riga/righe, {cols} colonna/e",
"{rows} rows × {cols} columns": "{rows} righe × {cols} colonne",
"{size}, {orient} · text area {w} × {h} {unit}": "{size}, {orient} · area di testo {w} × {h} {unit}",
"— mixed —": "— misto —",
+ "“{name}” is also a document property — this column takes over that field": "«{name}» è anche una proprietà del documento: questa colonna sostituisce quel campo",
"…": "…",
"⌃⇧↑ / ⌃⇧↓": "⌃⇧↑ / ⌃⇧↓",
"Discard": "Scarta",
@@ -404,4 +444,21 @@ export const it: Catalog = {
"Mints brand-new keys. Every previously sent copy stops syncing for good; share fresh copies afterwards.": "Genera chiavi completamente nuove. Tutte le copie inviate in precedenza smettono definitivamente di sincronizzarsi; condividi poi copie nuove.",
"Offline mode is on — nothing leaves this computer.": "La modalità offline è attiva: nulla esce da questo computer.",
"Tabs on this machine still sync; turn offline mode off to collaborate online.": "Le schede su questo computer continuano a sincronizzarsi; disattiva la modalità offline per collaborare online.",
+ // compare with a file — the redline against another document (compare.ts)
+ "That is a {app} file, not a bento/type document.": "Questo è un file {app}, non un documento bento/type.",
+ "That file does not look like a bento/type document.": "Quel file non sembra un documento bento/type.",
+ "That file has no document in it.": "Quel file non contiene alcun documento.",
+ "That file could not be read: {detail}": "Impossibile leggere quel file: {detail}",
+ "That file is a different document, not another copy of this one — comparing unrelated documents works, but check you picked the file you meant.": "Quel file è un documento diverso, non un'altra copia di questo: confrontare documenti non collegati funziona, ma verifica di aver scelto il file giusto.",
+ "One problem in that file was repaired as it was read, which can itself appear below as a change.": "Un problema in quel file è stato riparato durante la lettura, cosa che può comparire qui sotto come una modifica.",
+ "{n} problems in that file were repaired as it was read, which can themselves appear below as changes.": "{n} problemi in quel file sono stati riparati durante la lettura, cosa che può comparire qui sotto come modifiche.",
+ "This is a view: changes are shown, never applied. Accept and reject are offered only against a Snapshot of this document.": "Questa è una vista: le modifiche sono mostrate, mai applicate. Accetta e rifiuta sono disponibili solo rispetto a un'istantanea di questo documento.",
+ "That file is identical to this document — there is nothing to compare.": "Quel file è identico a questo documento: non c'è nulla da confrontare.",
+ "1 change from “{file}” to this document": "1 modifica da «{file}» a questo documento",
+ "{n} changes from “{file}” to this document": "{n} modifiche da «{file}» a questo documento",
+ "Compare with another document": "Confronta con un altro documento",
+ "Choose another bento/type file. The redline shows what changed from that file to this document. Comparing never changes what you have open.": "Scegli un altro file bento/type. Il confronto mostra che cosa è cambiato da quel file a questo documento. Confrontare non modifica mai ciò che hai aperto.",
+ "Drop a Bento document here": "Trascina qui un documento Bento",
+ "Choose a file…": "Scegli un file…",
+ "Compare with a file…": "Confronta con un file…",
}
diff --git a/type/src/i18n/ja.ts b/type/src/i18n/ja.ts
index cea614dc..f08f7dec 100644
--- a/type/src/i18n/ja.ts
+++ b/type/src/i18n/ja.ts
@@ -30,6 +30,7 @@ export const ja: Catalog = {
"Appearance": "外観",
"Applied style": "適用中のスタイル",
"Apply": "適用",
+ "Author": "作成者",
"Author–year — APA-ish": "著者–年(APA風)",
"Auto": "自動",
"Bento artifact": "Bento アーティファクト",
@@ -58,10 +59,12 @@ export const ja: Catalog = {
"Comments": "コメント",
"Comments hidden": "コメントを非表示",
"Comments shown": "コメントを表示",
+ "Company": "会社",
"Contents": "目次",
"Contents inserted. Page numbers fill in as the document paginates.": "目次を挿入しました。ページ番号は文書のページ割り付けに応じて入ります。",
"Copy document JSON": "文書の JSON をコピー",
"Could not check right now.": "現在確認できませんでした。",
+ "Could not read: {cols}": "読み取れませんでした: {cols}",
"Credits": "クレジット",
"Cross-reference": "相互参照",
"Custom": "カスタム",
@@ -80,6 +83,7 @@ export const ja: Catalog = {
"Document id": "文書 ID",
"Document title": "文書のタイトル",
"Drag to move, click for options": "ドラッグで移動、クリックでオプション",
+ "Each row becomes one complete file in a folder you choose.": "各行が、選択したフォルダー内の完全なファイル 1 つになります。",
"Edit": "編集",
"Edit your comment": "自分のコメントを編集",
"Edit “{name}”": "「{name}」を編集",
@@ -88,9 +92,12 @@ export const ja: Catalog = {
"Embedded from {app}": "{app} から埋め込み",
"Equation added — edit it in the Math panel": "数式を追加しました — 数式パネルで編集してください",
"Equation block": "数式ブロック",
+ "Field": "フィールド",
+ "Field: {name}": "フィールド: {name}",
"Figure": "図",
"Figures": "図",
"File": "ファイル",
+ "File names": "ファイル名",
"Find": "検索",
"Find and replace (⌘F)": "検索と置換 (⌘F)",
"Find in document": "文書内を検索",
@@ -102,6 +109,7 @@ export const ja: Catalog = {
"Formula": "数式",
"Formula (⌘M)": "数式 (⌘M)",
"Formula added — edit it in the Math panel": "数式を追加しました — 数式パネルで編集してください",
+ "From the data source": "データソースから",
"From {app}": "{app} から",
"Header row": "見出し行",
"Heading 1": "見出し 1",
@@ -119,6 +127,8 @@ export const ja: Catalog = {
"Insert a cross-reference": "相互参照を挿入",
"Insert a cross-reference to a caption": "キャプションへの相互参照を挿入",
"Insert a display equation on its own line": "独立した行に数式を挿入",
+ "Insert a field": "フィールドを挿入",
+ "Insert a field that the document fills in": "文書が自動で埋めるフィールドを挿入",
"Insert a picture": "画像を挿入",
"Insert a picture, table, formula, citation…": "画像、表、数式、引用を挿入…",
"Insert a table": "表を挿入",
@@ -130,6 +140,7 @@ export const ja: Catalog = {
"Justified": "両端揃え",
"Keep together": "段落を分割しない",
"Keep with next": "次の段落と分離しない",
+ "Keywords": "キーワード",
"Label — “Table 2”": "ラベル — 「表 2」",
"Landscape": "横向き",
"Layout": "レイアウト",
@@ -140,11 +151,16 @@ export const ja: Catalog = {
"Line spacing": "行間",
"Link (⌘K)": "リンク (⌘K)",
"Link address": "リンク先アドレス",
+ "Mail merge": "差し込み印刷",
+ "Mail merge from a sheet…": "シートから差し込み印刷…",
"Margins": "余白",
"Margins…": "余白…",
"Match case": "大文字と小文字を区別",
"Math": "数式",
"Medium": "ミディアム",
+ "Merge failed: {why}": "差し込みに失敗しました: {why}",
+ "Merge {n} document(s)": "{n} 件の文書を作成",
+ "Merged {n} document(s)": "{n} 件の文書を作成しました",
"Modified": "変更後",
"More — revisions, signing, print": "その他 — 変更履歴、署名、印刷",
"Move down": "下に移動",
@@ -159,8 +175,10 @@ export const ja: Catalog = {
"No matches": "一致なし",
"No sources yet. Paste a .bib file to get started.": "まだソースがありません。.bib ファイルを貼り付けて始めましょう。",
"No tracked changes": "変更履歴はありません",
+ "No {{…}} tokens found in this document": "この文書に {{…}} トークンは見つかりませんでした",
"Nothing is cited yet, so the list is empty.": "まだ何も引用されていないため、リストは空です。",
"Nothing matches.": "一致するものがありません。",
+ "Nothing supplies “{name}” — it prints as nothing": "「{name}」に値を与えるものがありません — 印刷時は空になります",
"Nothing that looks like a BibTeX entry.": "BibTeX のエントリらしきものが見つかりません。",
"Nothing to refer to yet — caption a table first": "まだ参照できるものがありません — まず表にキャプションを付けてください",
"Nothing was imported.": "何もインポートされませんでした。",
@@ -171,6 +189,7 @@ export const ja: Catalog = {
"Numeric [1] — IEEE-ish": "数値 [1](IEEE風)",
"Off by default: most documents already carry their numbers in the heading text.": "既定ではオフです — ほとんどの文書では見出しのテキストにすでに番号が含まれているためです。",
"Open": "開く",
+ "Optical margins": "オプティカルマージン",
"Orientation": "向き",
"Original": "変更前",
"Outline — show or hide the document map": "アウトライン — 文書マップの表示/非表示",
@@ -179,6 +198,7 @@ export const ja: Catalog = {
"Page break inserted": "改ページを挿入しました",
"Page break removed": "改ページを削除しました",
"Page breaking": "改ページ",
+ "Page number": "ページ番号",
"Page or section, optional — e.g. p. 34": "ページまたはセクション(任意)— 例:p. 34",
"Page setup": "ページ設定",
"Page size": "ページサイズ",
@@ -196,12 +216,14 @@ export const ja: Catalog = {
"Previous match (⇧Enter)": "前を検索 (⇧Enter)",
"Print or PDF…": "印刷または PDF…",
"Properties": "プロパティ",
+ "Punctuation hangs a little past the margin so the edge of the text reads straight. It never changes where lines break, so the page count is the same either way.": "句読点をマージンの外側にわずかに突き出させ、テキストの端がまっすぐに見えるようにします。行の折り返し位置は変わらないため、ページ数はどちらでも同じです。",
"Put the caret in a heading first.": "まず見出しにカーソルを置いてください。",
"Put the caret in a paragraph first": "まず段落にカーソルを置いてください",
"Put the caret in the document first": "まず文書内にカーソルを置いてください",
"Put the caret in the table or paragraph to caption": "キャプションを付ける表または段落にカーソルを置いてください",
"Put the caret on a tracked change first": "まず変更履歴の箇所にカーソルを置いてください",
"Put the caret where the citation goes first": "まず引用を挿入する位置にカーソルを置いてください",
+ "Put the caret where the field goes": "まずフィールドを挿入する位置にカーソルを置いてください",
"Put the caret where the formula should go": "数式を挿入する位置にカーソルを置いてください",
"Put the caret where the reference goes": "まず参照を挿入する位置にカーソルを置いてください",
"Quote": "引用",
@@ -243,6 +265,7 @@ export const ja: Catalog = {
"Select something to see its properties.": "何かを選択するとプロパティが表示されます。",
"Select the words you want to link": "リンクしたい語句を選択してください",
"Semibold": "セミボールド",
+ "Sheet": "シート",
"Show comments": "コメントを表示",
"Signatures": "署名",
"Sign…": "署名…",
@@ -257,9 +280,13 @@ export const ja: Catalog = {
"Space before": "段落前の間隔",
"Space before (px)": "段落前の間隔 (px)",
"Start this paragraph on a new page.": "この段落を新しいページから開始します。",
+ "Stop": "停止",
+ "Stopped after {n} of {all} document(s)": "{all} 件中 {n} 件を作成したところで停止しました",
"Strikethrough": "取り消し線",
"Style": "スタイル",
"Style updated from this paragraph": "この段落の書式でスタイルを更新しました",
+ "Subject": "件名",
+ "Subtitle": "サブタイトル",
"Supported: \\frac \\sqrt ^ _ \\sum \\int \\left( \\right) Greek, matrices, cases.": "対応:\\frac \\sqrt ^ _ \\sum \\int \\left( \\right)、ギリシャ文字、行列、場合分け。",
"Table": "表",
"Tables and figures are numbered separately, in document order.": "表と図は文書内の順序でそれぞれ別々に番号付けされます。",
@@ -270,8 +297,10 @@ export const ja: Catalog = {
"That JSON was empty.": "その JSON は空でした。",
"That file could not be read as a picture.": "そのファイルは画像として読み込めませんでした。",
"That file does not look like a Bento document.": "そのファイルは Bento 文書ではないようです。",
+ "That file has no sheet with named columns to merge from.": "そのファイルには、差し込み元にできる名前付き列を持つシートがありません。",
"That is already a caption": "それはすでにキャプションです",
"That is not a bento/type document: {detail}": "bento/type の文書ではありません:{detail}",
+ "That is not a usable field name": "それはフィールド名として使えません",
"That is not an address this document can link to": "この文書からリンクできるアドレスではありません",
"That saved version could not be restored.": "保存されたバージョンを復元できませんでした。",
"That sheet is larger than any printer takes.": "その用紙サイズはどのプリンターにも対応していません。",
@@ -285,7 +314,9 @@ export const ja: Catalog = {
"Theme: {mode} — click to cycle auto/light/dark": "テーマ:{mode} — クリックで自動/ライト/ダークを切り替え",
"These render as [?key] in the document so they cannot be missed.": "これらは文書内に [?key] として表示されるため見逃すことはありません。",
"This already has a caption": "これにはすでにキャプションがあります",
+ "This browser can only download files one at a time, which is not workable past {n} rows. Open this document in Chrome or Edge to merge it.": "このブラウザーはファイルを 1 つずつダウンロードすることしかできず、{n} 行を超えると現実的ではありません。差し込みには Chrome または Edge でこの文書を開いてください。",
"This browser cannot write back to the file, so every save makes a new copy. Chrome and Edge on a computer can save in place.": "このブラウザはファイルへの書き戻しができないため、保存のたびに新しいコピーが作成されます。パソコン版の Chrome や Edge ならその場に保存できます。",
+ "This browser will download each file separately — expect one prompt per row.": "このブラウザーはファイルを 1 つずつダウンロードします — 行ごとに確認が表示されます。",
"This build cannot render captions yet — apply the core patch listed at the top of xref.ts": "このビルドではまだキャプションを描画できません — xref.ts の先頭に記載されているコアパッチを適用してください",
"This document has no sources yet. Import some BibTeX first.": "この文書にはまだ出典がありません。まず BibTeX をインポートしてください。",
"This embed could not be displayed safely.": "この埋め込みは安全に表示できませんでした。",
@@ -300,12 +331,16 @@ export const ja: Catalog = {
"This reference points at something that is no longer in the document": "この参照は文書内に存在しないものを指しています",
"Those side margins leave no room for text.": "左右の余白が広すぎて本文のスペースがありません。",
"Those top and bottom margins leave no room for text.": "上下の余白が広すぎて本文のスペースがありません。",
+ "Time of day": "時刻",
+ "Today’s date": "今日の日付",
"Top / bottom (in)": "上 / 下(インチ)",
"Top / bottom (mm)": "上 / 下(mm)",
+ "Total pages": "総ページ数",
"Track changes": "変更履歴の記録",
"Tracked changes": "変更履歴",
"Tracking is on. Edits you make from now on are recorded here.": "記録はオンです。これ以降の編集はここに記録されます。",
"Turn on \"Track changes\" in the properties panel, or take a Snapshot from ⋯ and use Review changes.": "プロパティパネルで「変更履歴の記録」をオンにするか、⋯ から「スナップショット」を取得して「変更をレビュー」を使用してください。",
+ "Turn {{…}} tokens into fields": "{{…}} トークンをフィールドに変換",
"Typeface": "書体",
"US Legal": "US リーガル",
"US Letter": "US レター",
@@ -317,6 +352,7 @@ export const ja: Catalog = {
"Update this file": "このファイルを更新",
"Updates": "更新",
"Use document defaults": "文書の既定値を使用",
+ "Use {{#}} for the row number, or a column name in braces.": "行番号には {{#}} を、列名は波かっこで囲んで指定します。",
"Version {v} is available.": "バージョン {v} が利用可能です。",
"Visit bento.page (opens in a new tab)": "bento.page を開く(新しいタブ)",
"Weight": "太さ",
@@ -338,6 +374,7 @@ export const ja: Catalog = {
"mixed": "混在",
"mm": "mm",
"not cited": "未引用",
+ "or a field name…": "またはフィールド名…",
"pt": "pt",
"the text this was about is gone": "対象のテキストは削除されました",
"v{app} · format v{fmt}": "v{app} ・ フォーマット v{fmt}",
@@ -345,15 +382,18 @@ export const ja: Catalog = {
"{key} is cited in this document. Remove it anyway?": "{key} はこの文書で引用されています。それでも削除しますか?",
"{m} changes": "変更 {m} 件",
"{n} broken reference(s)": "無効な参照 {n} 件",
+ "{n} field(s) created from tokens": "トークンから {n} 件のフィールドを作成しました",
"{n} more": "他 {n} 件",
"{n} of {m}": "{m} 件中 {n} 件目",
"{n} of {total}": "{total} 件中 {n} 件目",
"{n} replies": "返信 {n} 件",
"{open} open of {all}": "{all} 件中 {open} 件が未解決",
"{pages} page(s) · {words} words · {blocks} blocks · {notes} footnote(s). The document, the editor and the typesetter are all in this one file.": "{pages} ページ ・ {words} 語 ・ {blocks} ブロック ・ 脚注 {notes} 件。文書・エディタ・組版エンジンはすべてこの 1 ファイルに収められています。",
+ "{rows} row(s), {cols} column(s)": "{rows} 行、{cols} 列",
"{rows} rows × {cols} columns": "{rows} 行 × {cols} 列",
"{size}, {orient} · text area {w} × {h} {unit}": "{size}、{orient} ・ テキストエリア {w} × {h} {unit}",
"— mixed —": "— 混在 —",
+ "“{name}” is also a document property — this column takes over that field": "「{name}」は文書のプロパティ名でもあります — この列がそのフィールドを上書きします",
"…": "…",
"⌃⇧↑ / ⌃⇧↓": "⌃⇧↑ / ⌃⇧↓",
"Discard": "破棄",
@@ -404,4 +444,21 @@ export const ja: Catalog = {
"Mints brand-new keys. Every previously sent copy stops syncing for good; share fresh copies afterwards.": "新しい鍵を発行します。以前送信したコピーは完全に同期を停止するため、その後に新しいコピーを共有してください。",
"Offline mode is on — nothing leaves this computer.": "オフラインモードが有効です — このコンピューターから何も送信されません。",
"Tabs on this machine still sync; turn offline mode off to collaborate online.": "このマシン上のタブ同士は同期します。オンラインで共同編集するにはオフラインモードを解除してください。",
+ // compare with a file — the redline against another document (compare.ts)
+ "That is a {app} file, not a bento/type document.": "これは {app} のファイルであり、bento/type の文書ではありません。",
+ "That file does not look like a bento/type document.": "そのファイルは bento/type の文書ではないようです。",
+ "That file has no document in it.": "そのファイルには文書が含まれていません。",
+ "That file could not be read: {detail}": "そのファイルを読み取れませんでした: {detail}",
+ "That file is a different document, not another copy of this one — comparing unrelated documents works, but check you picked the file you meant.": "そのファイルはこの文書の別のコピーではなく、別の文書です — 無関係な文書どうしを比較することもできますが、意図したファイルを選んだか確認してください。",
+ "One problem in that file was repaired as it was read, which can itself appear below as a change.": "そのファイルの問題を 1 件、読み込み時に修復しました。その修復自体が下に変更として表示されることがあります。",
+ "{n} problems in that file were repaired as it was read, which can themselves appear below as changes.": "そのファイルの問題を {n} 件、読み込み時に修復しました。それらの修復自体が下に変更として表示されることがあります。",
+ "This is a view: changes are shown, never applied. Accept and reject are offered only against a Snapshot of this document.": "これは表示専用です。変更は示されるだけで、適用されることはありません。承諾と却下は、この文書のスナップショットに対してのみ行えます。",
+ "That file is identical to this document — there is nothing to compare.": "そのファイルはこの文書とまったく同じです — 比較するものがありません。",
+ "1 change from “{file}” to this document": "「{file}」からこの文書への変更 1 件",
+ "{n} changes from “{file}” to this document": "「{file}」からこの文書への変更 {n} 件",
+ "Compare with another document": "別の文書と比較",
+ "Choose another bento/type file. The redline shows what changed from that file to this document. Comparing never changes what you have open.": "別の bento/type ファイルを選んでください。そのファイルからこの文書への変更が比較として表示されます。比較しても、開いている文書が変わることはありません。",
+ "Drop a Bento document here": "Bento の文書をここにドロップ",
+ "Choose a file…": "ファイルを選択…",
+ "Compare with a file…": "ファイルと比較…",
}
diff --git a/type/src/i18n/packed.ts b/type/src/i18n/packed.ts
index 0b966335..04803b23 100644
--- a/type/src/i18n/packed.ts
+++ b/type/src/i18n/packed.ts
@@ -17,6 +17,7 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"(no heading)": ["(見出しなし)","(无标题)","(無標題)","(sin encabezado)","(pas de titre)","(keine Überschrift)","(nessun titolo)","(sem cabeçalho)"],
"(untitled)": ["(無題)","(无标题)","(無標題)","(sin título)","(sans titre)","(unbenannt)","(senza titolo)","(sem título)"],
"1 change": ["変更 1 件","1 处修订","1 處修訂","1 cambio","1 modification","1 Änderung","1 modifica","1 alteração"],
+ "1 change from “{file}” to this document": ["「{file}」からこの文書への変更 1 件","从“{file}”到此文档的 1 处修订","從「{file}」到這份文件的 1 處修訂","1 cambio de «{file}» a este documento","1 modification de « {file} » vers ce document","1 Änderung von „{file}“ zu diesem Dokument","1 modifica da «{file}» a questo documento","1 alteração de “{file}” para este documento"],
"A live viewer: follows every edit as it happens but can never change the document.": ["ライブの閲覧者です。すべての編集をリアルタイムで追いますが、文書を変更することはできません。","实时查看者:会实时跟随每一次编辑,但永远无法更改文档。","即時檢視者:會即時跟隨每一次編輯,但永遠無法變更文件。","Un lector en directo: sigue cada edición en el momento, pero nunca puede cambiar el documento.","Un lecteur en direct : suit chaque modification en temps réel, mais ne peut jamais modifier le document.","Ein Live-Betrachter: folgt jeder Änderung in Echtzeit, kann das Dokument aber nie ändern.","Un lettore in diretta: segue ogni modifica in tempo reale, ma non può mai cambiare il documento.","Um visualizador ao vivo: acompanha cada edição em tempo real, mas nunca pode alterar o documento."],
"A self-asserted claim, not an identity — this is the name shown beside your comments and tracked changes, and anyone can type any name here. It is remembered in this browser, applies immediately, and is never itself saved into the file (only the comments and changes it signs are).": ["自己申告の名前であり、本人確認ではありません — コメントや変更履歴の横に表示される名前で、誰でも自由に入力できます。このブラウザに記憶され、すぐに反映されますが、この名前自体がファイルに保存されることはありません(それが記名したコメントや変更のみが保存されます)。","这只是自行填写的名称,并非身份验证——它会显示在你的批注和修订旁边,任何人都可以在此输入任意名称。它会记住在此浏览器中,立即生效,且该名称本身不会保存到文件中(只有它署名的批注和修订才会保存)。","這只是自行填寫的名稱,並非身分驗證 — 它會顯示在你的註解與修訂旁邊,任何人都能在此輸入任意名稱。它會記在這個瀏覽器中,立即套用,但這個名稱本身不會存進檔案(只有它署名的註解與修訂才會被儲存)。","Es una declaración que tú mismo introduces, no una identidad: es el nombre que aparece junto a tus comentarios y cambios control de cambios, y cualquiera puede escribir el nombre que quiera aquí. Se recuerda en este navegador, se aplica de inmediato y nunca se guarda por sí mismo en el archivo (solo se guardan los comentarios y cambios que firma).","Il s'agit d'une déclaration que vous saisissez vous-même, pas d'une identité vérifiée : c'est le nom affiché à côté de vos commentaires et de vos modifications suivies, et n'importe qui peut saisir n'importe quel nom ici. Il est mémorisé dans ce navigateur, s'applique immédiatement et n'est jamais lui-même enregistré dans le fichier (seuls les commentaires et modifications qu'il signe le sont).","Dies ist eine selbst angegebene Angabe, keine verifizierte Identität – es ist der Name, der neben Ihren Kommentaren und nachverfolgten Änderungen angezeigt wird, und jeder kann hier einen beliebigen Namen eingeben. Er wird in diesem Browser gemerkt, gilt sofort und wird selbst nie in der Datei gespeichert (nur die Kommentare und Änderungen, die er signiert, werden gespeichert).","Si tratta di un'indicazione autodichiarata, non di un'identità verificata: è il nome mostrato accanto ai tuoi commenti e alle modifiche registrate, e chiunque può digitare qui il nome che vuole. Viene ricordato in questo browser, si applica immediatamente e non viene mai salvato di per sé nel file (vengono salvati solo i commenti e le modifiche che firma).","Uma declaração feita por você mesmo, não uma identidade — este é o nome exibido ao lado dos seus comentários e alterações controladas, e qualquer pessoa pode digitar qualquer nome aqui. Ele é lembrado neste navegador, aplica-se imediatamente e nunca é salvo no arquivo em si (somente os comentários e as alterações que ele assina são)."],
"About bento/type": ["bento/type について","关于 bento/type","關於 bento/type","Acerca de bento/type","À propos de bento/type","Info zu bento/type","Informazioni su bento/type","Sobre o bento/type"],
@@ -40,6 +41,7 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"Appearance": ["外観","外观","外觀","Apariencia","Apparence","Erscheinungsbild","Aspetto","Aspeto"],
"Applied style": ["適用中のスタイル","已应用的样式","已套用的樣式","Estilo aplicado","Style appliqué","Angewendete Formatvorlage","Stile applicato","Estilo aplicado"],
"Apply": ["適用","应用","套用","Aplicar","Appliquer","Anwenden","Applica","Aplicar"],
+ "Author": ["作成者","作者","作者","Autor","Auteur","Autor","Autore","Autor"],
"Author–year — APA-ish": ["著者–年(APA風)","著者–年份(类 APA)","作者–年份(類 APA)","Autor-año (estilo APA)","Auteur-année (style APA)","Autor–Jahr (APA-ähnlich)","Autore-anno (stile APA)","Autor–ano — estilo APA"],
"Auto": ["自動","自动","自動","Automático","Automatique","Automatisch","Automatico","Automático"],
"Bento artifact": ["Bento アーティファクト","Bento 制品","Bento 成品","Artefacto de Bento","Artefact Bento","Bento-Artefakt","Artefatto Bento","Artefato Bento"],
@@ -55,6 +57,8 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"Centre": ["中央揃え","居中","置中","Centrado","Centré","Zentriert","Al centro","Centralizado"],
"Check for updates": ["更新を確認","检查更新","檢查更新","Buscar actualizaciones","Rechercher des mises à jour","Nach Updates suchen","Controlla aggiornamenti","Verificar atualizações"],
"Checking…": ["確認中…","正在检查…","檢查中…","Comprobando…","Vérification…","Wird geprüft…","Verifica in corso…","Verificando…"],
+ "Choose a file…": ["ファイルを選択…","选择文件…","選擇檔案…","Elegir un archivo…","Choisir un fichier…","Datei auswählen…","Scegli un file…","Escolher um arquivo…"],
+ "Choose another bento/type file. The redline shows what changed from that file to this document. Comparing never changes what you have open.": ["別の bento/type ファイルを選んでください。そのファイルからこの文書への変更が比較として表示されます。比較しても、開いている文書が変わることはありません。","选择另一个 bento/type 文件。对比会显示从该文件到此文档发生了哪些修订。比较永远不会改变你打开的文档。","選擇另一個 bento/type 檔案。比對會顯示從該檔案到這份文件發生了哪些修訂。比較永遠不會變更你開啟的文件。","Elige otro archivo de bento/type. La comparación muestra qué cambió de ese archivo a este documento. Comparar nunca modifica lo que tienes abierto.","Choisissez un autre fichier bento/type. La comparaison montre ce qui a changé de ce fichier vers ce document. Comparer ne modifie jamais ce que vous avez ouvert.","Wählen Sie eine andere bento/type-Datei. Der Vergleich zeigt, was sich von dieser Datei zu diesem Dokument geändert hat. Vergleichen ändert nie, was Sie geöffnet haben.","Scegli un altro file bento/type. Il confronto mostra che cosa è cambiato da quel file a questo documento. Confrontare non modifica mai ciò che hai aperto.","Escolha outro arquivo do bento/type. A comparação mostra o que mudou desse arquivo para este documento. Comparar nunca altera o que você tem aberto."],
"Citation": ["引用","引文","引文","Cita","Citation","Zitat","Citazione","Citação"],
"Cite here": ["ここに引用","在此处插入引用","在此處插入引文","Citar aquí","Citer ici","Hier zitieren","Cita qui","Citar aqui"],
"Cited but not in this document": ["引用されているがこの文書にはない","已引用但不在本文档中","已引用但不在本文件中","Citada pero no está en este documento","Citée mais absente de ce document","Zitiert, aber nicht in diesem Dokument","Citata ma non presente in questo documento","Citado, mas não está neste documento"],
@@ -68,12 +72,16 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"Comments": ["コメント","批注","註解","Comentarios","Commentaires","Kommentare","Commenti","Comentários"],
"Comments hidden": ["コメントを非表示","批注已隐藏","註解已隱藏","Comentarios ocultos","Commentaires masqués","Kommentare ausgeblendet","Commenti nascosti","Comentários ocultos"],
"Comments shown": ["コメントを表示","批注已显示","註解已顯示","Comentarios visibles","Commentaires affichés","Kommentare angezeigt","Commenti visibili","Comentários visíveis"],
+ "Company": ["会社","公司","公司","Empresa","Société","Unternehmen","Azienda","Empresa"],
+ "Compare with a file…": ["ファイルと比較…","与文件比较…","與檔案比較…","Comparar con un archivo…","Comparer avec un fichier…","Mit einer Datei vergleichen…","Confronta con un file…","Comparar com um arquivo…"],
+ "Compare with another document": ["別の文書と比較","与另一个文档比较","與另一份文件比較","Comparar con otro documento","Comparer avec un autre document","Mit einem anderen Dokument vergleichen","Confronta con un altro documento","Comparar com outro documento"],
"Connect to the live session without saving a new copy — copies you sent earlier will meet you there.": ["新しいコピーを保存せずにライブセッションに接続します — 以前送ったコピーがそこで合流します。","无需保存新副本即可连接到实时协作 — 你之前发送的副本会在那里与你会合。","無需儲存新副本即可連線到即時協作 — 你先前傳送的副本會在那裡與你會合。","Conéctate a la sesión en directo sin guardar una copia nueva: las copias que enviaste antes te encontrarán allí.","Rejoignez la session en direct sans enregistrer de nouvelle copie — les copies envoyées précédemment vous y retrouveront.","Verbinden Sie sich mit der Live-Sitzung, ohne eine neue Kopie zu speichern – zuvor gesendete Kopien treffen Sie dort.","Connettiti alla sessione in diretta senza salvare una nuova copia: le copie inviate in precedenza ti raggiungeranno lì.","Conecte-se à sessão ao vivo sem salvar uma nova cópia — as cópias que você enviou antes encontrarão você lá."],
"Connecting to the live session…": ["ライブセッションに接続しています…","正在连接实时协作…","正在連線到即時協作…","Conectando con la sesión en directo…","Connexion à la session en direct…","Verbindung zur Live-Sitzung wird hergestellt …","Connessione alla sessione in tempo reale…","Conectando à sessão ao vivo…"],
"Contents": ["目次","目录","目錄","Contenido","Sommaire","Inhalt","Sommario","Índice"],
"Contents inserted. Page numbers fill in as the document paginates.": ["目次を挿入しました。ページ番号は文書のページ割り付けに応じて入ります。","已插入目录。页码将在文档分页时自动填入。","已插入目錄。頁碼會在文件分頁時自動填入。","Contenido insertado. Los números de página se completan a medida que el documento se pagina.","Sommaire inséré. Les numéros de page se complètent au fur et à mesure de la pagination du document.","Inhaltsverzeichnis eingefügt. Seitenzahlen werden ausgefüllt, sobald das Dokument paginiert wird.","Sommario inserito. I numeri di pagina si compilano man mano che il documento viene impaginato.","Sumário inserido. Os números de página são preenchidos conforme o documento é paginado."],
"Copy document JSON": ["文書の JSON をコピー","复制文档 JSON","複製文件 JSON","Copiar el JSON del documento","Copier le JSON du document","Dokument-JSON kopieren","Copia il JSON del documento","Copiar JSON do documento"],
"Could not check right now.": ["現在確認できませんでした。","目前无法检查。","目前無法檢查。","No se pudo comprobar en este momento.","Impossible de vérifier pour le moment.","Konnte gerade nicht geprüft werden.","Impossibile controllare in questo momento.","Não foi possível verificar agora."],
+ "Could not read: {cols}": ["読み取れませんでした: {cols}","无法读取:{cols}","無法讀取:{cols}","No se pudo leer: {cols}","Lecture impossible : {cols}","Nicht lesbar: {cols}","Impossibile leggere: {cols}","Não foi possível ler: {cols}"],
"Credits": ["クレジット","致谢","致謝","Créditos","Crédits","Danksagung","Crediti","Créditos"],
"Cross-reference": ["相互参照","交叉引用","交叉參照","Referencia cruzada","Renvoi","Querverweis","Riferimento incrociato","Referência cruzada"],
"Custom": ["カスタム","自定义","自訂","Personalizado","Personnalisé","Benutzerdefiniert","Personalizzato","Personalizado"],
@@ -94,6 +102,8 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"Document id": ["文書 ID","文档 ID","文件 ID","ID del documento","ID du document","Dokument-ID","ID documento","ID do documento"],
"Document title": ["文書のタイトル","文档标题","文件標題","Título del documento","Titre du document","Dokumenttitel","Titolo del documento","Título do documento"],
"Drag to move, click for options": ["ドラッグで移動、クリックでオプション","拖动以移动,点击查看选项","拖曳以移動,點按查看選項","Arrastra para mover, haz clic para ver opciones","Faites glisser pour déplacer, cliquez pour les options","Ziehen zum Verschieben, klicken für Optionen","Trascina per spostare, fai clic per le opzioni","Arraste para mover, clique para ver opções"],
+ "Drop a Bento document here": ["Bento の文書をここにドロップ","将 Bento 文档拖放到此处","將 Bento 文件拖放到此處","Suelta aquí un documento de Bento","Déposez ici un document Bento","Ein Bento-Dokument hier ablegen","Trascina qui un documento Bento","Solte um documento Bento aqui"],
+ "Each row becomes one complete file in a folder you choose.": ["各行が、選択したフォルダー内の完全なファイル 1 つになります。","每一行都会在你选择的文件夹中生成一个完整的文件。","每一列都會在你選擇的資料夾中產生一個完整的檔案。","Cada fila se convierte en un archivo completo dentro de la carpeta que elijas.","Chaque ligne devient un fichier complet dans le dossier que vous choisissez.","Jede Zeile wird zu einer vollständigen Datei in einem Ordner Ihrer Wahl.","Ogni riga diventa un file completo nella cartella che scegli.","Cada linha vira um arquivo completo na pasta que você escolher."],
"Edit": ["編集","编辑","編輯","Editar","Modifier","Bearbeiten","Modifica","Editar"],
"Edit your comment": ["自分のコメントを編集","编辑你的批注","編輯你的註解","Editar tu comentario","Modifier votre commentaire","Ihren Kommentar bearbeiten","Modifica il tuo commento","Editar seu comentário"],
"Edit “{name}”": ["「{name}」を編集","编辑“{name}”","編輯「{name}」","Editar «{name}»","Modifier « {name} »","„{name}“ bearbeiten","Modifica «{name}»","Editar “{name}”"],
@@ -104,9 +114,12 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"Embedded from {app}": ["{app} から埋め込み","嵌入自 {app}","嵌入自 {app}","Insertado desde {app}","Intégré depuis {app}","Eingebettet aus {app}","Incorporato da {app}","Incorporado de {app}"],
"Equation added — edit it in the Math panel": ["数式を追加しました — 数式パネルで編集してください","已添加公式 — 请在数学面板中编辑","已新增公式 — 請在數學面板中編輯","Ecuación añadida: edítala en el panel de matemáticas","Équation ajoutée — modifiez-la dans le panneau Mathématiques","Gleichung hinzugefügt – im Mathematik-Panel bearbeiten","Equazione aggiunta: modificala nel pannello Matematica","Equação adicionada — edite-a no painel Matemática"],
"Equation block": ["数式ブロック","公式块","公式區塊","Bloque de ecuación","Bloc d'équation","Gleichungsblock","Blocco equazione","Bloco de equação"],
+ "Field": ["フィールド","字段","欄位","Campo","Champ","Feld","Campo","Campo"],
+ "Field: {name}": ["フィールド: {name}","字段:{name}","欄位:{name}","Campo: {name}","Champ : {name}","Feld: {name}","Campo: {name}","Campo: {name}"],
"Figure": ["図","图","圖","Figura","Figure","Abbildung","Figura","Figura"],
"Figures": ["図","图","圖","Figuras","Figures","Abbildungen","Figure","Figuras"],
"File": ["ファイル","文件","檔案","Archivo","Fichier","Datei","File","Arquivo"],
+ "File names": ["ファイル名","文件名","檔案名稱","Nombres de archivo","Noms de fichier","Dateinamen","Nomi dei file","Nomes dos arquivos"],
"Find": ["検索","查找","尋找","Buscar","Rechercher","Suchen","Trova","Localizar"],
"Find and replace (⌘F)": ["検索と置換 (⌘F)","查找和替换 (⌘F)","尋找及取代 (⌘F)","Buscar y reemplazar (⌘F)","Rechercher et remplacer (⌘F)","Suchen und Ersetzen (⌘F)","Trova e sostituisci (⌘F)","Localizar e substituir (⌘F)"],
"Find in document": ["文書内を検索","在文档中查找","在文件中尋找","Buscar en el documento","Rechercher dans le document","Im Dokument suchen","Trova nel documento","Localizar no documento"],
@@ -118,6 +131,7 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"Formula": ["数式","公式","公式","Fórmula","Formule","Formel","Formula","Fórmula"],
"Formula (⌘M)": ["数式 (⌘M)","公式 (⌘M)","公式 (⌘M)","Fórmula (⌘M)","Formule (⌘M)","Formel (⌘M)","Formula (⌘M)","Fórmula (⌘M)"],
"Formula added — edit it in the Math panel": ["数式を追加しました — 数式パネルで編集してください","已添加公式 — 请在数学面板中编辑","已新增公式 — 請在數學面板中編輯","Fórmula añadida: edítala en el panel de matemáticas","Formule ajoutée — modifiez-la dans le panneau Mathématiques","Formel hinzugefügt – im Mathematik-Panel bearbeiten","Formula aggiunta: modificala nel pannello Matematica","Fórmula adicionada — edite-a no painel Matemática"],
+ "From the data source": ["データソースから","来自数据源","來自資料來源","De la fuente de datos","Depuis la source de données","Aus der Datenquelle","Dall’origine dati","Da fonte de dados"],
"From {app}": ["{app} から","来自 {app}","來自 {app}","Desde {app}","Depuis {app}","Von {app}","Da {app}","De {app}"],
"Go live": ["ライブを開始","开始实时协作","開始即時協作","Iniciar sesión en directo","Passer en direct","Live gehen","Vai in diretta","Ficar ao vivo"],
"Guest": ["ゲスト","访客","訪客","Invitado","Invité","Gast","Ospite","Convidado"],
@@ -137,6 +151,8 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"Insert a cross-reference": ["相互参照を挿入","插入交叉引用","插入交叉參照","Insertar una referencia cruzada","Insérer un renvoi","Querverweis einfügen","Inserisci un riferimento incrociato","Inserir uma referência cruzada"],
"Insert a cross-reference to a caption": ["キャプションへの相互参照を挿入","插入指向题注的交叉引用","插入指向題注的交叉參照","Insertar una referencia cruzada a un título","Insérer un renvoi vers une légende","Querverweis auf eine Beschriftung einfügen","Inserisci un riferimento incrociato a una didascalia","Inserir uma referência cruzada a uma legenda"],
"Insert a display equation on its own line": ["独立した行に数式を挿入","插入独占一行的公式","插入獨佔一行的公式","Insertar una ecuación en su propia línea","Insérer une équation sur sa propre ligne","Eine eigenständige Gleichungszeile einfügen","Inserisci un'equazione su una riga propria","Inserir uma equação em destaque, em linha própria"],
+ "Insert a field": ["フィールドを挿入","插入字段","插入欄位","Insertar un campo","Insérer un champ","Feld einfügen","Inserisci un campo","Inserir um campo"],
+ "Insert a field that the document fills in": ["文書が自動で埋めるフィールドを挿入","插入由文档自动填写的字段","插入由文件自動填入的欄位","Insertar un campo que el documento rellena","Insérer un champ que le document remplit","Ein Feld einfügen, das das Dokument ausfüllt","Inserisci un campo che il documento compila","Inserir um campo que o documento preenche"],
"Insert a picture": ["画像を挿入","插入图片","插入圖片","Insertar una imagen","Insérer une image","Bild einfügen","Inserisci un'immagine","Inserir uma imagem"],
"Insert a picture, table, formula, citation…": ["画像、表、数式、引用を挿入…","插入图片、表格、公式、引用…","插入圖片、表格、公式、引文…","Insertar una imagen, tabla, fórmula, cita…","Insérer une image, un tableau, une formule, une citation…","Bild, Tabelle, Formel, Zitat einfügen…","Inserisci immagine, tabella, formula, citazione…","Inserir imagem, tabela, fórmula, citação…"],
"Insert a table": ["表を挿入","插入表格","插入表格","Insertar una tabla","Insérer un tableau","Tabelle einfügen","Inserisci una tabella","Inserir uma tabela"],
@@ -149,6 +165,7 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"Justified": ["両端揃え","两端对齐","左右對齊","Justificado","Justifié","Blocksatz","Giustificato","Justificado"],
"Keep together": ["段落を分割しない","段落不跨页","段落不跨頁","Mantener unido","Ne pas scinder","Zusammenhalten","Non dividere","Manter junto"],
"Keep with next": ["次の段落と分離しない","与下段同页","與下段同頁","Mantener con el siguiente","Solidaire du suivant","Mit nächstem zusammenhalten","Solidale con il successivo","Manter com o próximo"],
+ "Keywords": ["キーワード","关键词","關鍵字","Palabras clave","Mots-clés","Schlagwörter","Parole chiave","Palavras-chave"],
"Label — “Table 2”": ["ラベル — 「表 2」","标签 —“表 2”","標籤 —「表 2」","Etiqueta: «Tabla 2»","Étiquette : « Tableau 2 »","Beschriftung – „Tabelle 2“","Etichetta: «Tabella 2»","Rótulo — “Tabela 2”"],
"Landscape": ["横向き","横向","橫向","Horizontal","Paysage","Querformat","Orizzontale","Paisagem"],
"Layout": ["レイアウト","布局","版面","Diseño","Mise en page","Layout","Layout","Layout"],
@@ -160,11 +177,16 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"Link (⌘K)": ["リンク (⌘K)","链接 (⌘K)","連結 (⌘K)","Enlace (⌘K)","Lien (⌘K)","Link (⌘K)","Collegamento (⌘K)","Link (⌘K)"],
"Link address": ["リンク先アドレス","链接地址","連結位址","Dirección del enlace","Adresse du lien","Link-Adresse","Indirizzo del collegamento","Endereço do link"],
"Live — this document is being shared": ["ライブ — この文書は共有中です","实时协作中 — 此文档正在共享","即時協作中 — 這份文件正在共用","En directo: este documento se está compartiendo","En direct — ce document est partagé","Live – dieses Dokument wird freigegeben","In diretta: questo documento è condiviso","Ao vivo — este documento está sendo compartilhado"],
+ "Mail merge": ["差し込み印刷","邮件合并","合併列印","Combinación de correspondencia","Publipostage","Serienbrief","Stampa unione","Mala direta"],
+ "Mail merge from a sheet…": ["シートから差し込み印刷…","从工作表邮件合并…","從工作表合併列印…","Combinar correspondencia desde una hoja…","Publipostage depuis une feuille…","Serienbrief aus einem Blatt…","Stampa unione da un foglio…","Mala direta a partir de uma planilha…"],
"Margins": ["余白","页边距","邊界","Márgenes","Marges","Ränder","Margini","Margens"],
"Margins…": ["余白…","页边距…","邊界…","Márgenes…","Marges…","Ränder…","Margini…","Margens…"],
"Match case": ["大文字と小文字を区別","区分大小写","區分大小寫","Coincidir mayúsculas","Respecter la casse","Groß-/Kleinschreibung beachten","Maiuscole/minuscole","Diferenciar maiúsculas"],
"Math": ["数式","数学","數學","Matemáticas","Mathématiques","Mathematik","Matematica","Matemática"],
"Medium": ["ミディアム","中等","中等","Medio","Medium","Medium","Medio","Médio"],
+ "Merge failed: {why}": ["差し込みに失敗しました: {why}","合并失败:{why}","合併失敗:{why}","La combinación falló: {why}","Échec du publipostage : {why}","Serienbrief fehlgeschlagen: {why}","Unione non riuscita: {why}","A mala direta falhou: {why}"],
+ "Merge {n} document(s)": ["{n} 件の文書を作成","合并 {n} 个文档","合併 {n} 份文件","Combinar {n} documento(s)","Fusionner {n} document(s)","{n} Dokument(e) zusammenführen","Unisci {n} documento/i","Mesclar {n} documento(s)"],
+ "Merged {n} document(s)": ["{n} 件の文書を作成しました","已合并 {n} 个文档","已合併 {n} 份文件","Se combinaron {n} documento(s)","{n} document(s) fusionné(s)","{n} Dokument(e) zusammengeführt","Uniti {n} documento/i","{n} documento(s) mesclado(s)"],
"Mints brand-new keys. Every previously sent copy stops syncing for good; share fresh copies afterwards.": ["新しい鍵を発行します。以前送信したコピーは完全に同期を停止するため、その後に新しいコピーを共有してください。","会生成全新的密钥。此前发送的每个副本都将永久停止同步;之后请重新共享新的副本。","會產生全新的金鑰。先前傳送的每個副本都將永久停止同步;之後請重新共用新的副本。","Genera claves totalmente nuevas. Todas las copias enviadas antes dejan de sincronizarse para siempre; comparte copias nuevas después.","Génère des clés entièrement nouvelles. Toutes les copies envoyées auparavant cessent définitivement de se synchroniser ; partagez ensuite de nouvelles copies.","Erzeugt völlig neue Schlüssel. Alle zuvor gesendeten Kopien synchronisieren endgültig nicht mehr; teilen Sie danach neue Kopien.","Genera chiavi completamente nuove. Tutte le copie inviate in precedenza smettono definitivamente di sincronizzarsi; condividi poi copie nuove.","Gera chaves novas em folha. Toda cópia enviada antes para de sincronizar de vez; compartilhe cópias novas depois."],
"Modified": ["変更後","已修改","已修改","Modificado","Modifié","Geändert","Modificato","Modificado"],
"More — revisions, signing, print": ["その他 — 変更履歴、署名、印刷","更多 — 修订、签名、打印","更多 — 修訂、簽署、列印","Más: revisiones, firma, impresión","Plus — révisions, signature, impression","Mehr – Überarbeitungen, Signieren, Drucken","Altro: revisioni, firma, stampa","Mais — revisões, assinatura, impressão"],
@@ -181,9 +203,11 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"No saved versions yet — they accumulate as you edit.": ["保存されたバージョンはまだありません — 編集するにつれて蓄積されます。","尚无已保存的版本 — 它们会随着你的编辑逐渐累积。","尚無已儲存的版本 — 會隨著你的編輯逐漸累積。","Aún no hay versiones guardadas: se acumulan a medida que editas.","Aucune version enregistrée pour l'instant : elles s'accumulent au fil de vos modifications.","Noch keine gespeicherten Versionen – sie sammeln sich an, während Sie bearbeiten.","Nessuna versione salvata per ora: si accumulano man mano che modifichi.","Ainda não há versões salvas — elas se acumulam conforme você edita."],
"No sources yet. Paste a .bib file to get started.": ["まだソースがありません。.bib ファイルを貼り付けて始めましょう。","尚无来源。粘贴 .bib 文件即可开始。","尚未有來源。貼上 .bib 檔案即可開始。","Aún no hay fuentes. Pega un archivo .bib para empezar.","Pas encore de sources. Collez un fichier .bib pour commencer.","Noch keine Quellen. Fügen Sie eine .bib-Datei ein, um zu beginnen.","Ancora nessuna fonte. Incolla un file .bib per iniziare.","Ainda não há fontes. Cole um arquivo .bib para começar."],
"No tracked changes": ["変更履歴はありません","没有修订记录","沒有修訂記錄","Sin cambios control de cambios","Aucune modification suivie","Keine nachverfolgten Änderungen","Nessuna modifica registrata","Nenhuma alteração controlada"],
+ "No {{…}} tokens found in this document": ["この文書に {{…}} トークンは見つかりませんでした","此文档中没有找到 {{…}} 记号","此文件中沒有找到 {{…}} 標記","No se encontró ningún marcador {{…}} en este documento","Aucun marqueur {{…}} trouvé dans ce document","Keine {{…}}-Platzhalter in diesem Dokument gefunden","Nessun segnaposto {{…}} trovato in questo documento","Nenhum marcador {{…}} encontrado neste documento"],
"Not sharing yet — click to start a live session": ["まだ共有していません — クリックしてライブセッションを開始","尚未共享 — 点击开始实时协作","尚未共用 — 按一下開始即時協作","Aún no se comparte: haz clic para iniciar una sesión en directo","Pas encore partagé — cliquez pour démarrer une session en direct","Noch nicht freigegeben – klicken, um eine Live-Sitzung zu starten","Non ancora condiviso: fai clic per avviare una sessione in tempo reale","Ainda não está compartilhando — clique para iniciar uma sessão ao vivo"],
"Nothing is cited yet, so the list is empty.": ["まだ何も引用されていないため、リストは空です。","尚未引用任何内容,因此列表为空。","尚未引用任何內容,因此清單是空的。","Aún no se ha citado nada, por lo que la lista está vacía.","Rien n'est encore cité, la liste est donc vide.","Es wurde noch nichts zitiert, daher ist die Liste leer.","Non è stato ancora citato nulla, quindi l'elenco è vuoto.","Nada foi citado ainda, então a lista está vazia."],
"Nothing matches.": ["一致するものがありません。","没有匹配项。","沒有相符項目。","No hay coincidencias.","Aucune correspondance.","Keine Übereinstimmung.","Nessuna corrispondenza.","Nada corresponde."],
+ "Nothing supplies “{name}” — it prints as nothing": ["「{name}」に値を与えるものがありません — 印刷時は空になります","没有任何来源提供“{name}”——打印时为空","沒有任何來源提供「{name}」——列印時為空白","Nada proporciona «{name}»: se imprimirá vacío","Rien ne fournit « {name} » — l’impression sera vide","Nichts liefert „{name}“ – es wird nichts gedruckt","Nulla fornisce «{name}»: verrà stampato vuoto","Nada fornece “{name}” — será impresso em branco"],
"Nothing that looks like a BibTeX entry.": ["BibTeX のエントリらしきものが見つかりません。","没有看起来像 BibTeX 条目的内容。","沒有看起來像 BibTeX 條目的內容。","No hay nada que parezca una entrada BibTeX.","Rien qui ressemble à une entrée BibTeX.","Nichts, das wie ein BibTeX-Eintrag aussieht.","Niente che assomigli a una voce BibTeX.","Nada que se pareça com uma entrada BibTeX."],
"Nothing to refer to yet — caption a table first": ["まだ参照できるものがありません — まず表にキャプションを付けてください","尚无可引用的内容 — 请先为表格添加题注","尚無可參照的內容 — 請先為表格加上題注","Aún no hay nada que referenciar: primero añade un título a una tabla","Rien à référencer pour l'instant — légendez d'abord un tableau","Noch nichts zum Verweisen vorhanden – zuerst eine Tabelle beschriften","Ancora nulla a cui fare riferimento: aggiungi prima una didascalia a una tabella","Ainda não há nada a referenciar — legende uma tabela primeiro"],
"Nothing was imported.": ["何もインポートされませんでした。","未导入任何内容。","未匯入任何內容。","No se importó nada.","Rien n'a été importé.","Es wurde nichts importiert.","Non è stato importato nulla.","Nada foi importado."],
@@ -194,8 +218,10 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"Numeric [1] — IEEE-ish": ["数値 [1](IEEE風)","数字 [1](类 IEEE)","數字 [1](類 IEEE)","Numérico [1] (estilo IEEE)","Numérique [1] (style IEEE)","Numerisch [1] (IEEE-ähnlich)","Numerico [1] (stile IEEE)","Numérico [1] — estilo IEEE"],
"Off by default: most documents already carry their numbers in the heading text.": ["既定ではオフです — ほとんどの文書では見出しのテキストにすでに番号が含まれているためです。","默认关闭:大多数文档的标题文本中已经包含编号。","預設關閉:大多數文件的標題文字中已經包含編號。","Desactivado de forma predeterminada: la mayoría de los documentos ya llevan sus números en el texto del título.","Désactivé par défaut : la plupart des documents portent déjà leurs numéros dans le texte du titre.","Standardmäßig deaktiviert: Die meisten Dokumente tragen ihre Nummern bereits im Überschriftentext.","Disattivato per impostazione predefinita: la maggior parte dei documenti riporta già i numeri nel testo del titolo.","Desativado por padrão: a maioria dos documentos já traz a numeração no texto do título."],
"Offline mode is on — nothing leaves this computer.": ["オフラインモードが有効です — このコンピューターから何も送信されません。","离线模式已开启 — 任何内容都不会离开这台电脑。","離線模式已開啟 — 任何內容都不會離開這台電腦。","El modo sin conexión está activado: nada sale de este ordenador.","Le mode hors ligne est activé — rien ne quitte cet ordinateur.","Der Offlinemodus ist aktiv – nichts verlässt diesen Computer.","La modalità offline è attiva: nulla esce da questo computer.","O modo offline está ativado — nada sai deste computador."],
+ "One problem in that file was repaired as it was read, which can itself appear below as a change.": ["そのファイルの問題を 1 件、読み込み時に修復しました。その修復自体が下に変更として表示されることがあります。","读取该文件时修复了 1 处问题,该修复本身可能会在下方显示为一处修订。","讀取該檔案時修復了 1 處問題,該修復本身可能會在下方顯示為一處修訂。","Se reparó un problema de ese archivo al leerlo, lo que puede aparecer más abajo como un cambio.","Un problème de ce fichier a été réparé à la lecture, ce qui peut apparaître ci-dessous comme une modification.","Ein Problem in dieser Datei wurde beim Lesen repariert, was unten selbst als Änderung erscheinen kann.","Un problema in quel file è stato riparato durante la lettura, cosa che può comparire qui sotto come una modifica.","Um problema nesse arquivo foi reparado durante a leitura, o que pode aparecer abaixo como uma alteração."],
"Only the document owner can mint editor invites": ["編集者用の招待を作成できるのは文書の所有者だけです","只有文档所有者才能创建编辑者邀请","只有文件擁有者才能建立編輯者邀請","Solo el propietario del documento puede crear invitaciones de edición","Seul le propriétaire du document peut créer des invitations de modification","Nur die Besitzerin oder der Besitzer des Dokuments kann Bearbeitungseinladungen erstellen","Solo il proprietario del documento può creare inviti di modifica","Somente o proprietário do documento pode gerar convites de edição"],
"Open": ["開く","打开","開啟","Abrir","Ouvrir","Öffnen","Apri","Abrir"],
+ "Optical margins": ["オプティカルマージン","视觉边距","視覺邊界","Márgenes ópticos","Marges optiques","Optischer Randausgleich","Margini ottici","Margens ópticas"],
"Orientation": ["向き","方向","方向","Orientación","Orientation","Ausrichtung","Orientamento","Orientação"],
"Original": ["変更前","原始","原始","Original","Original","Original","Originale","Original"],
"Outline — show or hide the document map": ["アウトライン — 文書マップの表示/非表示","大纲 — 显示或隐藏文档结构图","大綱 — 顯示或隱藏文件結構圖","Esquema: mostrar u ocultar el mapa del documento","Plan — afficher ou masquer le plan du document","Gliederung – Dokumentkarte ein-/ausblenden","Struttura: mostra o nascondi la mappa del documento","Estrutura — mostrar ou ocultar o mapa do documento"],
@@ -205,6 +231,7 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"Page break inserted": ["改ページを挿入しました","已插入分页符","已插入分頁符號","Salto de página insertado","Saut de page inséré","Seitenumbruch eingefügt","Interruzione di pagina inserita","Quebra de página inserida"],
"Page break removed": ["改ページを削除しました","已删除分页符","已刪除分頁符號","Salto de página eliminado","Saut de page supprimé","Seitenumbruch entfernt","Interruzione di pagina rimossa","Quebra de página removida"],
"Page breaking": ["改ページ","分页","分頁","Salto de página","Saut de page","Seitenumbruch","Interruzione di pagina","Quebra de página"],
+ "Page number": ["ページ番号","页码","頁碼","Número de página","Numéro de page","Seitenzahl","Numero di pagina","Número da página"],
"Page or section, optional — e.g. p. 34": ["ページまたはセクション(任意)— 例:p. 34","页码或章节(可选)— 例如第 34 页","頁碼或章節(選填)— 例如第 34 頁","Página o sección, opcional; p. ej., p. 34","Page ou section, facultatif — ex. p. 34","Seite oder Abschnitt, optional – z. B. S. 34","Pagina o sezione, facoltativo — es. p. 34","Página ou seção, opcional — ex.: p. 34"],
"Page setup": ["ページ設定","页面设置","頁面設定","Configurar página","Mise en page","Seite einrichten","Imposta pagina","Configuração da página"],
"Page size": ["ページサイズ","页面大小","頁面大小","Tamaño de página","Format de page","Seitengröße","Dimensione pagina","Tamanho da página"],
@@ -223,12 +250,14 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"Previous match (⇧Enter)": ["前を検索 (⇧Enter)","上一个匹配项 (⇧Enter)","上一個相符項目 (⇧Enter)","Coincidencia anterior (⇧Intro)","Occurrence précédente (⇧Entrée)","Vorheriger Treffer (⇧Eingabe)","Corrispondenza precedente (⇧Invio)","Ocorrência anterior (⇧Enter)"],
"Print or PDF…": ["印刷または PDF…","打印或导出 PDF…","列印或匯出 PDF…","Imprimir o PDF…","Imprimer ou PDF…","Drucken oder PDF…","Stampa o PDF…","Imprimir ou PDF…"],
"Properties": ["プロパティ","属性","屬性","Propiedades","Propriétés","Eigenschaften","Proprietà","Propriedades"],
+ "Punctuation hangs a little past the margin so the edge of the text reads straight. It never changes where lines break, so the page count is the same either way.": ["句読点をマージンの外側にわずかに突き出させ、テキストの端がまっすぐに見えるようにします。行の折り返し位置は変わらないため、ページ数はどちらでも同じです。","标点符号会稍稍伸出页边距,使文字的边缘看起来更整齐。它不会改变换行位置,因此页数不变。","標點符號會稍微伸出頁邊界,讓文字邊緣看起來更整齊。它不會改變換行位置,因此頁數不變。","La puntuación sobresale ligeramente del margen para que el borde del texto se vea recto. Nunca cambia dónde se parten las líneas, así que el número de páginas es el mismo en ambos casos.","La ponctuation déborde légèrement de la marge pour que le bord du texte paraisse droit. Cela ne change jamais les coupures de ligne, donc le nombre de pages reste le même.","Satzzeichen ragen ein wenig über den Rand hinaus, damit die Textkante gerade wirkt. Der Zeilenumbruch ändert sich dabei nie, die Seitenzahl bleibt also in beiden Fällen gleich.","La punteggiatura sporge leggermente oltre il margine, così il bordo del testo appare dritto. Non cambia mai dove vanno a capo le righe, quindi il numero di pagine resta lo stesso.","A pontuação avança um pouco além da margem para que a borda do texto pareça reta. Nunca muda onde as linhas quebram, portanto o número de páginas é o mesmo nos dois casos."],
"Put the caret in a heading first.": ["まず見出しにカーソルを置いてください。","请先将光标置于标题中。","請先將游標置於標題中。","Primero coloca el cursor en un título.","Placez d'abord le curseur dans un titre.","Setzen Sie den Cursor zuerst in eine Überschrift.","Posiziona prima il cursore in un titolo.","Posicione o cursor em um título primeiro."],
"Put the caret in a paragraph first": ["まず段落にカーソルを置いてください","请先将光标置于段落中","請先將游標置於段落中","Coloca primero el cursor en un párrafo","Placez d'abord le curseur dans un paragraphe","Setzen Sie den Cursor zuerst in einen Absatz","Posiziona prima il cursore in un paragrafo","Posicione o cursor em um parágrafo primeiro"],
"Put the caret in the document first": ["まず文書内にカーソルを置いてください","请先将光标置于文档中","請先將游標置於文件中","Coloca primero el cursor en el documento","Placez d'abord le curseur dans le document","Setzen Sie den Cursor zuerst in das Dokument","Posiziona prima il cursore nel documento","Posicione o cursor no documento primeiro"],
"Put the caret in the table or paragraph to caption": ["キャプションを付ける表または段落にカーソルを置いてください","将光标置于要添加题注的表格或段落中","將游標置於要加上題注的表格或段落中","Coloca el cursor en la tabla o el párrafo que quieras titular","Placez le curseur dans le tableau ou le paragraphe à légender","Setzen Sie den Cursor in die zu beschriftende Tabelle oder den Absatz","Posiziona il cursore nella tabella o nel paragrafo da didascalizzare","Posicione o cursor na tabela ou no parágrafo a legendar"],
"Put the caret on a tracked change first": ["まず変更履歴の箇所にカーソルを置いてください","请先将光标置于某处修订上","請先將游標置於某項修訂上","Coloca primero el cursor en un cambio control de cambios","Placez d'abord le curseur sur une modification suivie","Setzen Sie den Cursor zuerst auf eine nachverfolgte Änderung","Posiziona prima il cursore su una modifica registrata","Posicione o cursor sobre uma alteração controlada primeiro"],
"Put the caret where the citation goes first": ["まず引用を挿入する位置にカーソルを置いてください","请先将光标置于要插入引用的位置","請先將游標置於要插入引文的位置","Coloca primero el cursor donde irá la cita","Placez d'abord le curseur à l'endroit où la citation doit apparaître","Setzen Sie den Cursor zuerst an die Stelle für das Zitat","Posiziona prima il cursore dove deve andare la citazione","Posicione o cursor onde a citação deve entrar"],
+ "Put the caret where the field goes": ["まずフィールドを挿入する位置にカーソルを置いてください","请先将光标置于要插入字段的位置","請先將游標置於要插入欄位的位置","Coloca primero el cursor donde irá el campo","Placez d'abord le curseur à l'endroit où le champ doit apparaître","Setzen Sie den Cursor zuerst an die Stelle für das Feld","Posiziona prima il cursore dove deve andare il campo","Posicione o cursor onde o campo deve entrar"],
"Put the caret where the formula should go": ["数式を挿入する位置にカーソルを置いてください","请将光标置于要插入公式的位置","請將游標置於要插入公式的位置","Coloca el cursor donde debe ir la fórmula","Placez le curseur à l'endroit où la formule doit apparaître","Setzen Sie den Cursor an die Stelle für die Formel","Posiziona il cursore dove deve andare la formula","Posicione o cursor onde a fórmula deve entrar"],
"Put the caret where the reference goes": ["まず参照を挿入する位置にカーソルを置いてください","请先将光标置于要插入引用的位置","請先將游標置於要插入參照的位置","Coloca primero el cursor donde irá la referencia","Placez d'abord le curseur à l'endroit où la référence doit apparaître","Setzen Sie den Cursor zuerst an die Stelle für den Verweis","Posiziona prima il cursore dove deve andare il riferimento","Posicione o cursor onde a referência deve entrar"],
"Quote": ["引用","引述","引述","Cita","Citation","Zitat","Citazione","Citação"],
@@ -279,6 +308,7 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"Share": ["共有","共享","共用","Compartir","Partager","Freigeben","Condividi","Compartilhar"],
"Share a copy": ["コピーを共有","共享副本","共用副本","Compartir una copia","Partager une copie","Kopie freigeben","Condividi una copia","Compartilhar uma cópia"],
"Share — invite people to edit live, or send a view-only copy": ["共有 — 他のユーザーをライブ編集に招待するか、閲覧専用のコピーを送ります","共享 — 邀请他人实时协作编辑,或发送只读副本","共用 — 邀請他人即時協作編輯,或傳送唯讀副本","Compartir: invita a otras personas a editar en directo o envía una copia de solo lectura","Partager — invitez d'autres personnes à modifier en direct, ou envoyez une copie en lecture seule","Freigeben – laden Sie andere zum Live-Bearbeiten ein oder senden Sie eine schreibgeschützte Kopie","Condividi — invita altre persone a modificare in tempo reale o invia una copia di sola lettura","Compartilhar — convide pessoas para editar ao vivo ou envie uma cópia somente leitura"],
+ "Sheet": ["シート","工作表","工作表","Hoja","Feuille","Blatt","Foglio","Planilha"],
"Show comments": ["コメントを表示","显示批注","顯示註解","Mostrar comentarios","Afficher les commentaires","Kommentare einblenden","Mostra commenti","Mostrar comentários"],
"Shown next to your cursor and in the People list — stored only in this browser.": ["カーソルの横とユーザー一覧に表示されます — このブラウザにのみ保存されます。","显示在你的光标旁边和协作者列表中 — 仅保存在此浏览器中。","顯示在你的游標旁邊與協作者清單中 — 僅儲存在這個瀏覽器中。","Se muestra junto a tu cursor y en la lista de personas; se guarda solo en este navegador.","Affiché à côté de votre curseur et dans la liste des personnes — conservé uniquement dans ce navigateur.","Wird neben Ihrem Cursor und in der Personenliste angezeigt – nur in diesem Browser gespeichert.","Mostrato accanto al cursore e nell'elenco delle persone: memorizzato solo in questo browser.","Exibido ao lado do seu cursor e na lista de Pessoas — guardado apenas neste navegador."],
"Signatures": ["署名","签名","簽署","Firmas","Signatures","Signaturen","Firme","Assinaturas"],
@@ -295,11 +325,15 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"Space before": ["段落前の間隔","段前间距","段落前間距","Espacio antes","Espace avant","Abstand davor","Spazio prima","Espaço antes"],
"Space before (px)": ["段落前の間隔 (px)","段前间距(像素)","段落前間距(像素)","Espacio antes (px)","Espace avant (px)","Abstand davor (px)","Spazio prima (px)","Espaço antes (px)"],
"Start this paragraph on a new page.": ["この段落を新しいページから開始します。","此段落将从新的一页开始。","此段落將從新的一頁開始。","Este párrafo comenzará en una página nueva.","Ce paragraphe commencera sur une nouvelle page.","Dieser Absatz beginnt auf einer neuen Seite.","Questo paragrafo inizierà su una nuova pagina.","Iniciar este parágrafo em uma nova página."],
+ "Stop": ["停止","停止","停止","Detener","Arrêter","Anhalten","Interrompi","Parar"],
"Stop sharing": ["共有を停止","停止共享","停止共用","Dejar de compartir","Arrêter le partage","Freigabe beenden","Interrompi condivisione","Parar de compartilhar"],
+ "Stopped after {n} of {all} document(s)": ["{all} 件中 {n} 件を作成したところで停止しました","已在 {all} 个文档中完成 {n} 个后停止","已在 {all} 份文件中完成 {n} 份後停止","Se detuvo tras {n} de {all} documento(s)","Arrêté après {n} document(s) sur {all}","Nach {n} von {all} Dokument(en) angehalten","Interrotto dopo {n} di {all} documento/i","Parado após {n} de {all} documento(s)"],
"Stored only in this browser, never in the file or online.": ["このブラウザにのみ保存され、ファイルやオンラインには保存されません。","仅存储在此浏览器中,不会存入文件或上传到网络。","僅儲存在這個瀏覽器中,不會存入檔案或上傳到網路。","Se guarda solo en este navegador, nunca en el archivo ni en línea.","Conservé uniquement dans ce navigateur, jamais dans le fichier ni en ligne.","Wird nur in diesem Browser gespeichert, nie in der Datei oder online.","Memorizzato solo in questo browser, mai nel file né online.","Armazenado apenas neste navegador, nunca no arquivo nem online."],
"Strikethrough": ["取り消し線","删除线","刪除線","Tachado","Barré","Durchgestrichen","Barrato","Tachado"],
"Style": ["スタイル","样式","樣式","Estilo","Style","Formatvorlage","Stile","Estilo"],
"Style updated from this paragraph": ["この段落の書式でスタイルを更新しました","已根据此段落更新样式","已根據此段落更新樣式","Estilo actualizado a partir de este párrafo","Style mis à jour à partir de ce paragraphe","Formatvorlage anhand dieses Absatzes aktualisiert","Stile aggiornato in base a questo paragrafo","Estilo atualizado a partir deste parágrafo"],
+ "Subject": ["件名","主题","主旨","Asunto","Objet","Betreff","Oggetto","Assunto"],
+ "Subtitle": ["サブタイトル","副标题","副標題","Subtítulo","Sous-titre","Untertitel","Sottotitolo","Subtítulo"],
"Supported: \\frac \\sqrt ^ _ \\sum \\int \\left( \\right) Greek, matrices, cases.": ["対応:\\frac \\sqrt ^ _ \\sum \\int \\left( \\right)、ギリシャ文字、行列、場合分け。","支持:\\frac \\sqrt ^ _ \\sum \\int \\left( \\right),希腊字母、矩阵、分段函数。","支援:\\frac \\sqrt ^ _ \\sum \\int \\left( \\right),希臘字母、矩陣、分段函數。","Compatible con: \\frac \\sqrt ^ _ \\sum \\int \\left( \\right), letras griegas, matrices, casos.","Pris en charge : \\frac \\sqrt ^ _ \\sum \\int \\left( \\right), lettres grecques, matrices, cas.","Unterstützt: \\frac \\sqrt ^ _ \\sum \\int \\left( \\right), griechische Buchstaben, Matrizen, Fallunterscheidungen.","Supportati: \\frac \\sqrt ^ _ \\sum \\int \\left( \\right), lettere greche, matrici, casi.","Suportado: \\frac \\sqrt ^ _ \\sum \\int \\left( \\right) grego, matrizes, casos."],
"Table": ["表","表格","表格","Tabla","Tableau","Tabelle","Tabella","Tabela"],
"Tables and figures are numbered separately, in document order.": ["表と図は文書内の順序でそれぞれ別々に番号付けされます。","表格和图分别独立编号,按文档中的顺序排列。","表格與圖分別獨立編號,按文件中的順序排列。","Las tablas y las figuras se numeran por separado, en el orden del documento.","Les tableaux et les figures sont numérotés séparément, dans l'ordre du document.","Tabellen und Abbildungen werden getrennt in Dokumentreihenfolge nummeriert.","Tabelle e figure sono numerate separatamente, nell'ordine del documento.","Tabelas e figuras são numeradas separadamente, na ordem do documento."],
@@ -310,9 +344,17 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"That JSON could not be read.": ["その JSON を読み込めませんでした。","无法读取该 JSON。","無法讀取該 JSON。","No se pudo leer ese JSON.","Ce JSON n'a pas pu être lu.","Dieses JSON konnte nicht gelesen werden.","Impossibile leggere quel JSON.","Não foi possível ler esse JSON."],
"That JSON was empty.": ["その JSON は空でした。","该 JSON 为空。","該 JSON 是空的。","Ese JSON estaba vacío.","Ce JSON était vide.","Dieses JSON war leer.","Quel JSON era vuoto.","Esse JSON estava vazio."],
"That file could not be read as a picture.": ["そのファイルは画像として読み込めませんでした。","无法将该文件作为图片读取。","無法將該檔案作為圖片讀取。","No se pudo leer ese archivo como una imagen.","Ce fichier n'a pas pu être lu comme une image.","Diese Datei konnte nicht als Bild gelesen werden.","Impossibile leggere quel file come immagine.","Não foi possível ler esse arquivo como imagem."],
+ "That file could not be read: {detail}": ["そのファイルを読み取れませんでした: {detail}","无法读取该文件:{detail}","無法讀取該檔案:{detail}","No se pudo leer ese archivo: {detail}","Impossible de lire ce fichier : {detail}","Diese Datei konnte nicht gelesen werden: {detail}","Impossibile leggere quel file: {detail}","Não foi possível ler esse arquivo: {detail}"],
"That file does not look like a Bento document.": ["そのファイルは Bento 文書ではないようです。","该文件看起来不是 Bento 文档。","該檔案看起來不是 Bento 文件。","Ese archivo no parece ser un documento de Bento.","Ce fichier ne ressemble pas à un document Bento.","Diese Datei sieht nicht wie ein Bento-Dokument aus.","Quel file non sembra un documento Bento.","Esse arquivo não parece ser um documento Bento."],
+ "That file does not look like a bento/type document.": ["そのファイルは bento/type の文書ではないようです。","该文件看起来不是 bento/type 文档。","該檔案看起來不是 bento/type 文件。","Ese archivo no parece un documento de bento/type.","Ce fichier ne ressemble pas à un document bento/type.","Diese Datei sieht nicht nach einem bento/type-Dokument aus.","Quel file non sembra un documento bento/type.","Esse arquivo não parece um documento do bento/type."],
+ "That file has no document in it.": ["そのファイルには文書が含まれていません。","该文件中没有文档。","該檔案中沒有文件。","Ese archivo no contiene ningún documento.","Ce fichier ne contient aucun document.","Diese Datei enthält kein Dokument.","Quel file non contiene alcun documento.","Esse arquivo não contém nenhum documento."],
+ "That file has no sheet with named columns to merge from.": ["そのファイルには、差し込み元にできる名前付き列を持つシートがありません。","该文件中没有带命名列的工作表可用于合并。","該檔案中沒有具名欄位的工作表可用於合併。","Ese archivo no tiene ninguna hoja con columnas con nombre para combinar.","Ce fichier ne contient aucune feuille avec des colonnes nommées à fusionner.","Diese Datei enthält kein Blatt mit benannten Spalten zum Zusammenführen.","Quel file non ha fogli con colonne denominate da unire.","Esse arquivo não tem nenhuma planilha com colunas nomeadas para mesclar."],
+ "That file is a different document, not another copy of this one — comparing unrelated documents works, but check you picked the file you meant.": ["そのファイルはこの文書の別のコピーではなく、別の文書です — 無関係な文書どうしを比較することもできますが、意図したファイルを選んだか確認してください。","该文件是另一个文档,而不是此文档的另一份副本 — 比较无关的文档是可以的,但请确认你选对了文件。","該檔案是另一份文件,而不是這份文件的另一個副本 — 比較無關的文件是可以的,但請確認你選對了檔案。","Ese archivo es un documento distinto, no otra copia de este: comparar documentos sin relación funciona, pero comprueba que has elegido el archivo que querías.","Ce fichier est un autre document, pas une autre copie de celui-ci — comparer des documents sans rapport fonctionne, mais vérifiez que vous avez choisi le bon fichier.","Diese Datei ist ein anderes Dokument, keine weitere Kopie dieses Dokuments – nicht verwandte Dokumente zu vergleichen funktioniert, prüfen Sie aber, ob Sie die gewünschte Datei gewählt haben.","Quel file è un documento diverso, non un'altra copia di questo: confrontare documenti non collegati funziona, ma verifica di aver scelto il file giusto.","Esse arquivo é um documento diferente, não outra cópia deste — comparar documentos sem relação funciona, mas confira se você escolheu o arquivo certo."],
+ "That file is identical to this document — there is nothing to compare.": ["そのファイルはこの文書とまったく同じです — 比較するものがありません。","该文件与此文档完全相同 — 没有可比较的内容。","該檔案與這份文件完全相同 — 沒有可比較的內容。","Ese archivo es idéntico a este documento: no hay nada que comparar.","Ce fichier est identique à ce document — il n'y a rien à comparer.","Diese Datei ist mit diesem Dokument identisch – es gibt nichts zu vergleichen.","Quel file è identico a questo documento: non c'è nulla da confrontare.","Esse arquivo é idêntico a este documento — não há nada a comparar."],
+ "That is a {app} file, not a bento/type document.": ["これは {app} のファイルであり、bento/type の文書ではありません。","这是一个 {app} 文件,不是 bento/type 文档。","這是一個 {app} 檔案,不是 bento/type 文件。","Ese es un archivo de {app}, no un documento de bento/type.","Ce fichier est un fichier {app}, pas un document bento/type.","Das ist eine {app}-Datei, kein bento/type-Dokument.","Questo è un file {app}, non un documento bento/type.","Esse é um arquivo do {app}, não um documento do bento/type."],
"That is already a caption": ["それはすでにキャプションです","这已经是题注","這已經是題注","Eso ya es un título","C'est déjà une légende","Das ist bereits eine Beschriftung","Questa è già una didascalia","Isso já é uma legenda"],
"That is not a bento/type document: {detail}": ["bento/type の文書ではありません:{detail}","这不是 bento/type 文档:{detail}","這不是 bento/type 文件:{detail}","No es un documento de bento/type: {detail}","Ce n'est pas un document bento/type : {detail}","Dies ist kein bento/type-Dokument: {detail}","Non è un documento bento/type: {detail}","Isso não é um documento bento/type: {detail}"],
+ "That is not a usable field name": ["それはフィールド名として使えません","这不是可用的字段名","這不是可用的欄位名稱","Ese no es un nombre de campo válido","Ce n’est pas un nom de champ utilisable","Das ist kein verwendbarer Feldname","Non è un nome di campo utilizzabile","Esse não é um nome de campo utilizável"],
"That is not an address this document can link to": ["この文書からリンクできるアドレスではありません","这不是本文档可以链接到的地址","這不是本文件可以連結到的位址","Esa no es una dirección a la que este documento pueda enlazar","Ce n'est pas une adresse vers laquelle ce document peut créer un lien","Dies ist keine Adresse, zu der dieses Dokument verlinken kann","Non è un indirizzo a cui questo documento può collegarsi","Esse não é um endereço ao qual este documento pode vincular"],
"That saved version could not be restored.": ["保存されたバージョンを復元できませんでした。","无法恢复该已保存的版本。","無法還原該已儲存的版本。","No se pudo restaurar esa versión guardada.","Impossible de restaurer cette version enregistrée.","Diese gespeicherte Version konnte nicht wiederhergestellt werden.","Impossibile ripristinare quella versione salvata.","Não foi possível restaurar essa versão salva."],
"That sheet is larger than any printer takes.": ["その用紙サイズはどのプリンターにも対応していません。","该纸张尺寸超出了任何打印机的支持范围。","該紙張尺寸超出任何印表機的支援範圍。","Esa hoja es más grande de lo que admite cualquier impresora.","Cette feuille est plus grande que ce qu'accepte n'importe quelle imprimante.","Dieses Blatt ist größer, als jeder Drucker verarbeiten kann.","Quel foglio è più grande di quanto qualsiasi stampante possa gestire.","Essa folha é maior do que qualquer impressora aceita."],
@@ -326,7 +368,9 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"Theme: {mode} — click to cycle auto/light/dark": ["テーマ:{mode} — クリックで自動/ライト/ダークを切り替え","主题:{mode} — 点击可在自动/浅色/深色间切换","主題:{mode} — 點按可在自動/淺色/深色間切換","Tema: {mode}: haz clic para alternar entre automático/claro/oscuro","Thème : {mode} — cliquez pour alterner automatique/clair/sombre","Design: {mode} – klicken, um zwischen Automatisch/Hell/Dunkel zu wechseln","Tema: {mode}: fai clic per alternare automatico/chiaro/scuro","Tema: {mode} — clique para alternar automático/claro/escuro"],
"These render as [?key] in the document so they cannot be missed.": ["これらは文書内に [?key] として表示されるため見逃すことはありません。","这些会在文档中显示为 [?key],因此不会被忽略。","這些會在文件中顯示為 [?key],因此不會被忽略。","Se muestran como [?key] en el documento para que no pasen desapercibidas.","Ils s'affichent sous la forme [?key] dans le document afin qu'on ne puisse pas les manquer.","Diese werden im Dokument als [?key] angezeigt, damit sie nicht übersehen werden.","Vengono visualizzati come [?key] nel documento in modo che non possano passare inosservati.","Elas aparecem como [?key] no documento para não passarem despercebidas."],
"This already has a caption": ["これにはすでにキャプションがあります","这已经有题注了","這已經有題注了","Esto ya tiene un título","Ceci a déjà une légende","Dies hat bereits eine Beschriftung","Questo ha già una didascalia","Isto já tem uma legenda"],
+ "This browser can only download files one at a time, which is not workable past {n} rows. Open this document in Chrome or Edge to merge it.": ["このブラウザーはファイルを 1 つずつダウンロードすることしかできず、{n} 行を超えると現実的ではありません。差し込みには Chrome または Edge でこの文書を開いてください。","此浏览器只能逐个下载文件,超过 {n} 行就不切实际了。请在 Chrome 或 Edge 中打开此文档再进行合并。","此瀏覽器只能逐一下載檔案,超過 {n} 列就不切實際了。請在 Chrome 或 Edge 中開啟此文件再進行合併。","Este navegador solo puede descargar los archivos de uno en uno, lo que no es viable por encima de {n} filas. Abre este documento en Chrome o Edge para combinarlo.","Ce navigateur ne peut télécharger les fichiers qu’un par un, ce qui n’est pas praticable au-delà de {n} lignes. Ouvrez ce document dans Chrome ou Edge pour le fusionner.","Dieser Browser kann Dateien nur einzeln herunterladen, was ab {n} Zeilen nicht mehr praktikabel ist. Öffnen Sie dieses Dokument in Chrome oder Edge, um es zusammenzuführen.","Questo browser può scaricare i file solo uno alla volta, il che non è praticabile oltre {n} righe. Apri questo documento in Chrome o Edge per unirlo.","Este navegador só consegue baixar os arquivos um a um, o que não é viável acima de {n} linhas. Abra este documento no Chrome ou no Edge para fazer a mesclagem."],
"This browser cannot write back to the file, so every save makes a new copy. Chrome and Edge on a computer can save in place.": ["このブラウザはファイルへの書き戻しができないため、保存のたびに新しいコピーが作成されます。パソコン版の Chrome や Edge ならその場に保存できます。","此浏览器无法回写到文件,因此每次保存都会生成新副本。电脑版 Chrome 和 Edge 可以直接原地保存。","這個瀏覽器無法回寫至檔案,因此每次儲存都會產生新副本。電腦版 Chrome 和 Edge 可以直接原地儲存。","Este navegador no puede reescribir el archivo, así que cada vez que guardas se crea una copia nueva. Chrome y Edge en un ordenador pueden guardar en el mismo archivo.","Ce navigateur ne peut pas réécrire le fichier, donc chaque enregistrement crée une nouvelle copie. Chrome et Edge sur ordinateur peuvent enregistrer sur place.","Dieser Browser kann die Datei nicht zurückschreiben, daher erstellt jedes Speichern eine neue Kopie. Chrome und Edge auf einem Computer können direkt speichern.","Questo browser non può riscrivere il file, quindi ogni salvataggio crea una nuova copia. Chrome ed Edge su computer possono salvare direttamente nel file.","Este navegador não consegue escrever de volta no arquivo, então cada vez que você salva ele cria uma nova cópia. O Chrome e o Edge em um computador conseguem salvar no lugar."],
+ "This browser will download each file separately — expect one prompt per row.": ["このブラウザーはファイルを 1 つずつダウンロードします — 行ごとに確認が表示されます。","此浏览器会分别下载每个文件——每一行都会出现一次提示。","此瀏覽器會分別下載每個檔案——每一列都會出現一次提示。","Este navegador descargará cada archivo por separado: habrá un aviso por fila.","Ce navigateur téléchargera chaque fichier séparément — attendez-vous à une invite par ligne.","Dieser Browser lädt jede Datei einzeln herunter – rechnen Sie mit einer Abfrage pro Zeile.","Questo browser scaricherà ogni file separatamente: attendi una richiesta per riga.","Este navegador vai baixar cada arquivo separadamente — espere um aviso por linha."],
"This build cannot render captions yet — apply the core patch listed at the top of xref.ts": ["このビルドではまだキャプションを描画できません — xref.ts の先頭に記載されているコアパッチを適用してください","此构建版本尚不能渲染题注——请应用 xref.ts 顶部列出的核心补丁","此建置版本尚無法渲染題注 — 請套用 xref.ts 頂端列出的核心修補","Esta compilación aún no puede renderizar títulos: aplica el parche del núcleo indicado al principio de xref.ts","Cette version ne peut pas encore afficher les légendes — appliquez le correctif du noyau indiqué en haut de xref.ts","Dieser Build kann Beschriftungen noch nicht rendern – wenden Sie den Kern-Patch oben in xref.ts an","Questa build non può ancora renderizzare le didascalie: applica la patch del core indicata in cima a xref.ts","Esta versão ainda não consegue renderizar legendas — aplique o patch do núcleo listado no topo de xref.ts"],
"This document has no live session to follow": ["この文書には追従できるライブセッションがありません","此文档没有可跟随的实时协作","這份文件沒有可跟隨的即時協作","Este documento no tiene ninguna sesión en directo que seguir","Ce document n'a aucune session en direct à suivre","Dieses Dokument hat keine Live-Sitzung, der man folgen könnte","Questo documento non ha una sessione in diretta da seguire","Este documento não tem sessão ao vivo para acompanhar"],
"This document has no sources yet. Import some BibTeX first.": ["この文書にはまだ出典がありません。まず BibTeX をインポートしてください。","本文档尚无来源。请先导入一些 BibTeX。","本文件尚無來源。請先匯入一些 BibTeX。","Este documento aún no tiene fuentes. Importa primero algo de BibTeX.","Ce document n'a pas encore de sources. Importez d'abord du BibTeX.","Dieses Dokument hat noch keine Quellen. Importieren Sie zuerst etwas BibTeX.","Questo documento non ha ancora fonti. Importa prima del BibTeX.","Este documento ainda não tem fontes. Importe algum BibTeX primeiro."],
@@ -336,6 +380,7 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"This heading is no longer numbered.": ["この見出しは番号付けされなくなりました。","此标题不再编号。","此標題不再編號。","Este título ya no está numerado.","Ce titre n'est plus numéroté.","Diese Überschrift ist nicht mehr nummeriert.","Questo titolo non è più numerato.","Este título não está mais numerado."],
"This heading is numbered again.": ["この見出しは再び番号付けされました。","此标题已重新编号。","此標題已重新編號。","Este título vuelve a estar numerado.","Ce titre est de nouveau numéroté.","Diese Überschrift ist wieder nummeriert.","Questo titolo è di nuovo numerato.","Este título voltou a ser numerado."],
"This is a view-only copy — it follows the live session but can’t change the document.": ["これは閲覧専用のコピーです — ライブセッションに追従しますが、文書を変更することはできません。","这是一个只读副本 — 它会跟随实时协作,但无法更改文档。","這是一個唯讀副本 — 它會跟隨即時協作,但無法變更文件。","Esta es una copia de solo lectura: sigue la sesión en directo, pero no puede cambiar el documento.","Ceci est une copie en lecture seule — elle suit la session en direct mais ne peut pas modifier le document.","Dies ist eine schreibgeschützte Kopie – sie folgt der Live-Sitzung, kann das Dokument aber nicht ändern.","Questa è una copia di sola lettura: segue la sessione in diretta ma non può cambiare il documento.","Esta é uma cópia somente leitura — ela acompanha a sessão ao vivo, mas não pode alterar o documento."],
+ "This is a view: changes are shown, never applied. Accept and reject are offered only against a Snapshot of this document.": ["これは表示専用です。変更は示されるだけで、適用されることはありません。承諾と却下は、この文書のスナップショットに対してのみ行えます。","这只是一个视图:修订仅供查看,不会被应用。接受和拒绝仅在与本文档的快照比较时才提供。","這只是一個檢視:修訂僅供查看,不會被套用。接受與拒絕僅在與本文件的快照比較時才提供。","Esto es una vista: los cambios se muestran, nunca se aplican. Aceptar y rechazar solo se ofrecen frente a una instantánea de este documento.","Ceci est un affichage : les modifications sont montrées, jamais appliquées. Accepter et refuser ne sont proposés que face à un instantané de ce document.","Dies ist nur eine Ansicht: Änderungen werden gezeigt, nie angewendet. Annehmen und Ablehnen gibt es nur gegenüber einer Momentaufnahme dieses Dokuments.","Questa è una vista: le modifiche sono mostrate, mai applicate. Accetta e rifiuta sono disponibili solo rispetto a un'istantanea di questo documento.","Isto é uma visualização: as alterações são exibidas, nunca aplicadas. Aceitar e rejeitar só estão disponíveis em relação a um instantâneo deste documento."],
"This paragraph and the one after it stay on the same page.": ["この段落とその次の段落は同じページに保持されます。","此段落与下一段将保持在同一页。","此段落與下一段將保持在同一頁。","Este párrafo y el siguiente permanecen en la misma página.","Ce paragraphe et le suivant restent sur la même page.","Dieser Absatz und der nachfolgende bleiben auf derselben Seite.","Questo paragrafo e quello successivo restano nella stessa pagina.","Este parágrafo e o seguinte permanecem na mesma página."],
"This paragraph has direct formatting of its own, on top of its style.": ["この段落にはスタイルとは別に直接指定された書式があります。","此段落在其样式之上还带有直接格式。","此段落在其樣式之上還帶有直接格式。","Este párrafo tiene formato directo propio, además de su estilo.","Ce paragraphe possède sa propre mise en forme directe, en plus de son style.","Dieser Absatz hat zusätzlich zu seiner Formatvorlage eine eigene direkte Formatierung.","Questo paragrafo ha una propria formattazione diretta, oltre al suo stile.","Este parágrafo tem formatação direta própria, além do seu estilo."],
"This paragraph is never split across a page break.": ["この段落は改ページで分割されません。","此段落绝不会被分页符拆分。","此段落絕不會被分頁符號拆分。","Este párrafo nunca se divide por un salto de página.","Ce paragraphe n'est jamais scindé par un saut de page.","Dieser Absatz wird nie durch einen Seitenumbruch getrennt.","Questo paragrafo non viene mai diviso da un'interruzione di pagina.","Este parágrafo nunca é dividido por uma quebra de página."],
@@ -343,12 +388,16 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"This reference points at something that is no longer in the document": ["この参照は文書内に存在しないものを指しています","此引用指向的内容已不在文档中","此參照指向的內容已不在文件中","Esta referencia apunta a algo que ya no está en el documento","Cette référence pointe vers un élément qui n'est plus dans le document","Dieser Verweis zeigt auf etwas, das nicht mehr im Dokument ist","Questo riferimento punta a qualcosa che non è più nel documento","Esta referência aponta para algo que não está mais no documento"],
"Those side margins leave no room for text.": ["左右の余白が広すぎて本文のスペースがありません。","左右页边距过大,没有留出文本空间。","左右邊界過大,沒有留出文字空間。","Esos márgenes laterales no dejan espacio para el texto.","Ces marges latérales ne laissent aucune place au texte.","Diese seitlichen Ränder lassen keinen Platz für Text.","Questi margini laterali non lasciano spazio al testo.","Essas margens laterais não deixam espaço para o texto."],
"Those top and bottom margins leave no room for text.": ["上下の余白が広すぎて本文のスペースがありません。","上下页边距过大,没有留出文本空间。","上下邊界過大,沒有留出文字空間。","Esos márgenes superior e inferior no dejan espacio para el texto.","Ces marges du haut et du bas ne laissent aucune place au texte.","Diese oberen und unteren Ränder lassen keinen Platz für Text.","Questi margini superiore e inferiore non lasciano spazio al testo.","Essas margens superior e inferior não deixam espaço para o texto."],
+ "Time of day": ["時刻","时间","時間","Hora del día","Heure du jour","Uhrzeit","Ora del giorno","Hora do dia"],
+ "Today’s date": ["今日の日付","今天的日期","今天的日期","Fecha de hoy","Date du jour","Heutiges Datum","Data di oggi","Data de hoje"],
"Top / bottom (in)": ["上 / 下(インチ)","上 / 下(英寸)","上 / 下(英吋)","Superior / inferior (in)","Haut / bas (po)","Oben / unten (Zoll)","Superiore / inferiore (in)","Superior / inferior (pol)"],
"Top / bottom (mm)": ["上 / 下(mm)","上 / 下(毫米)","上 / 下(公釐)","Superior / inferior (mm)","Haut / bas (mm)","Oben / unten (mm)","Superiore / inferiore (mm)","Superior / inferior (mm)"],
+ "Total pages": ["総ページ数","总页数","總頁數","Total de páginas","Nombre total de pages","Seitenanzahl","Pagine totali","Total de páginas"],
"Track changes": ["変更履歴の記録","修订","追蹤修訂","Control de cambios","Suivi des modifications","Änderungen nachverfolgen","Registra modifiche","Controlar alterações"],
"Tracked changes": ["変更履歴","修订","修訂","Cambios control de cambios","Modifications suivies","Nachverfolgte Änderungen","Modifiche registrate","Alterações controladas"],
"Tracking is on. Edits you make from now on are recorded here.": ["記録はオンです。これ以降の編集はここに記録されます。","跟踪已开启。此后的编辑都会记录在此。","追蹤已開啟。此後的編輯都會記錄在這裡。","El seguimiento está activado. Las ediciones que hagas a partir de ahora se registran aquí.","Le suivi est activé. Les modifications que vous apportez désormais sont enregistrées ici.","Die Nachverfolgung ist aktiviert. Änderungen, die Sie ab jetzt vornehmen, werden hier erfasst.","Il tracciamento è attivo. Le modifiche che apporti da ora in poi vengono registrate qui.","O controle está ativado. As edições que você fizer a partir de agora são registradas aqui."],
"Turn on \"Track changes\" in the properties panel, or take a Snapshot from ⋯ and use Review changes.": ["プロパティパネルで「変更履歴の記録」をオンにするか、⋯ から「スナップショット」を取得して「変更をレビュー」を使用してください。","在属性面板中开启“修订”,或从 ⋯ 中获取“快照”并使用“审阅修订”。","在屬性面板中開啟「追蹤修訂」,或從 ⋯ 取得「快照」並使用「校閱修訂」。","Activa «Control de cambios» en el panel de propiedades, o toma una Instantánea desde ⋯ y usa Revisar cambios.","Activez « Suivi des modifications » dans le panneau des propriétés, ou prenez un instantané depuis ⋯ et utilisez Réviser les modifications.","Aktivieren Sie „Änderungen nachverfolgen“ im Eigenschaftenbereich, oder erstellen Sie über ⋯ eine Momentaufnahme und verwenden Sie Änderungen überprüfen.","Attiva \"Registra modifiche\" nel pannello delle proprietà, oppure crea un'istantanea da ⋯ e usa Rivedi modifiche.","Ative “Controlar alterações” no painel de propriedades, ou tire um Instantâneo em ⋯ e use Revisar alterações."],
+ "Turn {{…}} tokens into fields": ["{{…}} トークンをフィールドに変換","把 {{…}} 记号转换为字段","把 {{…}} 標記轉換為欄位","Convertir los marcadores {{…}} en campos","Convertir les marqueurs {{…}} en champs","{{…}}-Platzhalter in Felder umwandeln","Converti i segnaposto {{…}} in campi","Converter marcadores {{…}} em campos"],
"Typeface": ["書体","字体","字體","Tipo de letra","Police","Schriftart","Carattere","Fonte"],
"US Legal": ["US リーガル","美国法律用纸","美國法律用紙","Legal (EE. UU.)","Légal US","US Legal","Legale USA","US Legal"],
"US Letter": ["US レター","美国信纸","美國信紙","Carta (EE. UU.)","Lettre US","US Letter","Lettera USA","US Letter"],
@@ -361,6 +410,7 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"Update this file": ["このファイルを更新","更新此文件","更新此檔案","Actualizar este archivo","Mettre à jour ce fichier","Diese Datei aktualisieren","Aggiorna questo file","Atualizar este arquivo"],
"Updates": ["更新","更新","更新","Actualizaciones","Mises à jour","Updates","Aggiornamenti","Atualizações"],
"Use document defaults": ["文書の既定値を使用","使用文档默认值","使用文件預設值","Usar los valores predeterminados del documento","Utiliser les valeurs par défaut du document","Dokumentstandards verwenden","Usa i valori predefiniti del documento","Usar os padrões do documento"],
+ "Use {{#}} for the row number, or a column name in braces.": ["行番号には {{#}} を、列名は波かっこで囲んで指定します。","用 {{#}} 表示行号,或把列名放在大括号里。","用 {{#}} 表示列號,或把欄位名稱放在大括號裡。","Usa {{#}} para el número de fila, o un nombre de columna entre llaves.","Utilisez {{#}} pour le numéro de ligne, ou un nom de colonne entre accolades.","Verwenden Sie {{#}} für die Zeilennummer oder einen Spaltennamen in geschweiften Klammern.","Usa {{#}} per il numero di riga, oppure un nome di colonna tra parentesi graffe.","Use {{#}} para o número da linha, ou um nome de coluna entre chaves."],
"Version history": ["バージョン履歴","版本历史记录","版本歷程記錄","Historial de versiones","Historique des versions","Versionsverlauf","Cronologia versioni","Histórico de versões"],
"Version history…": ["バージョン履歴…","版本历史记录…","版本歷程記錄…","Historial de versiones…","Historique des versions…","Versionsverlauf…","Cronologia versioni…","Histórico de versões…"],
"Version {v} is available.": ["バージョン {v} が利用可能です。","有新版本 {v} 可用。","有新版本 {v} 可用。","La versión {v} está disponible.","La version {v} est disponible.","Version {v} ist verfügbar.","La versione {v} è disponibile.","A versão {v} está disponível."],
@@ -388,6 +438,7 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"mixed": ["混在","混合","混合","mixto","mixte","gemischt","misto","misto"],
"mm": ["mm","毫米","公釐","mm","mm","mm","mm","mm"],
"not cited": ["未引用","未引用","未引用","sin citar","non citée","nicht zitiert","non citata","não citado"],
+ "or a field name…": ["またはフィールド名…","或输入字段名…","或輸入欄位名稱…","o un nombre de campo…","ou un nom de champ…","oder ein Feldname…","oppure un nome di campo…","ou um nome de campo…"],
"pt": ["pt","磅","pt","pt","pt","pt","pt","pt"],
"the text this was about is gone": ["対象のテキストは削除されました","这条批注所指的文本已被删除","這則註解所指的文字已被刪除","el texto al que se refería ha desaparecido","le texte concerné a disparu","der zugehörige Text ist nicht mehr vorhanden","il testo a cui si riferiva non c'è più","o texto a que isto se referia não existe mais"],
"v{app} · format v{fmt}": ["v{app} ・ フォーマット v{fmt}","v{app} · 格式 v{fmt}","v{app} · 格式 v{fmt}","v{app} · formato v{fmt}","v{app} · format v{fmt}","v{app} · Format v{fmt}","v{app} · formato v{fmt}","v{app} · formato v{fmt}"],
@@ -397,16 +448,21 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"{name} (you)": ["{name}(あなた)","{name}(你)","{name}(你)","{name} (tú)","{name} (vous)","{name} (Sie)","{name} (tu)","{name} (você)"],
"{name} — click to follow": ["{name} — クリックして追跡","{name} — 点击跟随","{name} — 按一下跟隨","{name}: haz clic para seguir","{name} — cliquez pour suivre","{name} – klicken, um zu folgen","{name}: fai clic per seguire","{name} — clique para seguir"],
"{n} broken reference(s)": ["無効な参照 {n} 件","{n} 处无效引用","{n} 項失效參照","{n} referencia(s) rota(s)","{n} référence(s) rompue(s)","{n} defekte(r) Verweis(e)","{n} riferimento/i non valido/i","{n} referência(s) quebrada(s)"],
+ "{n} changes from “{file}” to this document": ["「{file}」からこの文書への変更 {n} 件","从“{file}”到此文档的 {n} 处修订","從「{file}」到這份文件的 {n} 處修訂","{n} cambios de «{file}» a este documento","{n} modifications de « {file} » vers ce document","{n} Änderungen von „{file}“ zu diesem Dokument","{n} modifiche da «{file}» a questo documento","{n} alterações de “{file}” para este documento"],
+ "{n} field(s) created from tokens": ["トークンから {n} 件のフィールドを作成しました","已从记号创建 {n} 个字段","已從標記建立 {n} 個欄位","Se crearon {n} campo(s) a partir de los marcadores","{n} champ(s) créé(s) à partir des marqueurs","{n} Feld(er) aus Platzhaltern erstellt","Creati {n} campo/i dai segnaposto","{n} campo(s) criado(s) a partir dos marcadores"],
"{n} more": ["他 {n} 件","还有 {n} 个","還有 {n} 個","{n} más","{n} de plus","{n} weitere","{n} altri","mais {n}"],
"{n} of {m}": ["{m} 件中 {n} 件目","第 {n} / {m} 个","第 {n} / {m} 個","{n} de {m}","{n} sur {m}","{n} von {m}","{n} di {m}","{n} de {m}"],
"{n} of {total}": ["{total} 件中 {n} 件目","第 {n} / {total} 个","第 {n} / {total} 個","{n} de {total}","{n} sur {total}","{n} von {total}","{n} di {total}","{n} de {total}"],
+ "{n} problems in that file were repaired as it was read, which can themselves appear below as changes.": ["そのファイルの問題を {n} 件、読み込み時に修復しました。それらの修復自体が下に変更として表示されることがあります。","读取该文件时修复了 {n} 处问题,这些修复本身可能会在下方显示为修订。","讀取該檔案時修復了 {n} 處問題,這些修復本身可能會在下方顯示為修訂。","Se repararon {n} problemas de ese archivo al leerlo, lo que puede aparecer más abajo como cambios.","{n} problèmes de ce fichier ont été réparés à la lecture, ce qui peut apparaître ci-dessous comme des modifications.","{n} Probleme in dieser Datei wurden beim Lesen repariert, was unten selbst als Änderungen erscheinen kann.","{n} problemi in quel file sono stati riparati durante la lettura, cosa che può comparire qui sotto come modifiche.","{n} problemas nesse arquivo foram reparados durante a leitura, o que pode aparecer abaixo como alterações."],
"{n} replies": ["返信 {n} 件","{n} 条回复","{n} 則回覆","{n} respuestas","{n} réponses","{n} Antworten","{n} risposte","{n} respostas"],
"{open} open of {all}": ["{all} 件中 {open} 件が未解決","{all} 条中 {open} 条未解决","{all} 則中 {open} 則未解決","{open} abiertas de {all}","{open} ouverts sur {all}","{open} von {all} offen","{open} aperti su {all}","{open} abertos de {all}"],
"{pages} page(s) · {words} words · {blocks} blocks · {notes} footnote(s). The document, the editor and the typesetter are all in this one file.": ["{pages} ページ ・ {words} 語 ・ {blocks} ブロック ・ 脚注 {notes} 件。文書・エディタ・組版エンジンはすべてこの 1 ファイルに収められています。","{pages} 页 · {words} 字 · {blocks} 个块 · {notes} 条脚注。文档、编辑器和排版引擎全都在这一个文件中。","{pages} 頁 · {words} 字 · {blocks} 個區塊 · {notes} 則註腳。文件、編輯器與排版引擎全都在這一個檔案中。","{pages} página(s) · {words} palabras · {blocks} bloques · {notes} nota(s) al pie. El documento, el editor y el compositor tipográfico están todos en este único archivo.","{pages} page(s) · {words} mots · {blocks} blocs · {notes} note(s) de bas de page. Le document, l'éditeur et le compositeur sont tous dans ce seul fichier.","{pages} Seite(n) · {words} Wörter · {blocks} Blöcke · {notes} Fußnote(n). Dokument, Editor und Satzsystem befinden sich alle in dieser einen Datei.","{pages} pagina/e · {words} parole · {blocks} blocchi · {notes} nota/e a piè di pagina. Il documento, l'editor e il compositore tipografico sono tutti in questo unico file.","{pages} página(s) · {words} palavras · {blocks} blocos · {notes} nota(s) de rodapé. O documento, o editor e o compositor tipográfico estão todos neste único arquivo."],
+ "{rows} row(s), {cols} column(s)": ["{rows} 行、{cols} 列","{rows} 行,{cols} 列","{rows} 列,{cols} 欄","{rows} fila(s), {cols} columna(s)","{rows} ligne(s), {cols} colonne(s)","{rows} Zeile(n), {cols} Spalte(n)","{rows} riga/righe, {cols} colonna/e","{rows} linha(s), {cols} coluna(s)"],
"{rows} rows × {cols} columns": ["{rows} 行 × {cols} 列","{rows} 行 × {cols} 列","{rows} 列 × {cols} 欄","{rows} filas × {cols} columnas","{rows} lignes × {cols} colonnes","{rows} Zeilen × {cols} Spalten","{rows} righe × {cols} colonne","{rows} linhas × {cols} colunas"],
"{size}, {orient} · text area {w} × {h} {unit}": ["{size}、{orient} ・ テキストエリア {w} × {h} {unit}","{size},{orient} · 文本区域 {w} × {h} {unit}","{size},{orient} · 文字區域 {w} × {h} {unit}","{size}, {orient} · área de texto {w} × {h} {unit}","{size}, {orient} · zone de texte {w} × {h} {unit}","{size}, {orient} · Textbereich {w} × {h} {unit}","{size}, {orient} · area di testo {w} × {h} {unit}","{size}, {orient} · área de texto {w} × {h} {unit}"],
"{when} (most recent)": ["{when}(最新)","{when}(最新)","{when}(最新)","{when} (más reciente)","{when} (le plus récent)","{when} (neueste)","{when} (più recente)","{when} (mais recente)"],
"— mixed —": ["— 混在 —","— 混合 —","— 混合 —","— mixto —","— mixte —","— gemischt —","— misto —","— misto —"],
+ "“{name}” is also a document property — this column takes over that field": ["「{name}」は文書のプロパティ名でもあります — この列がそのフィールドを上書きします","“{name}”也是文档属性名——此列将取代该字段","「{name}」也是文件屬性名稱——此欄位將取代該欄位","«{name}» también es una propiedad del documento: esta columna sustituye a ese campo","« {name} » est aussi une propriété du document — cette colonne remplace ce champ","„{name}“ ist auch eine Dokumenteigenschaft – diese Spalte ersetzt jenes Feld","«{name}» è anche una proprietà del documento: questa colonna sostituisce quel campo","“{name}” também é uma propriedade do documento — esta coluna substitui esse campo"],
"…": ["…","…","…","…","…","…","…","…"],
"⌃⇧↑ / ⌃⇧↓": ["⌃⇧↑ / ⌃⇧↓","⌃⇧↑ / ⌃⇧↓","⌃⇧↑ / ⌃⇧↓","⌃⇧↑ / ⌃⇧↓","⌃⇧↑ / ⌃⇧↓","⌃⇧↑ / ⌃⇧↓","⌃⇧↑ / ⌃⇧↓","⌃⇧↑ / ⌃⇧↓"],
"○ Not live — turns on when you share": ["○ ライブではありません — 共有するとオンになります","○ 未实时协作 — 共享后开启","○ 未即時協作 — 共用後開啟","○ No está en directo: se activa al compartir","○ Pas en direct — s'active lorsque vous partagez","○ Nicht live – wird beim Freigeben aktiviert","○ Non in diretta: si attiva quando condividi","○ Não está ao vivo — ativa quando você compartilha"],
diff --git a/type/src/i18n/pt.ts b/type/src/i18n/pt.ts
index a47dbac1..40d5a271 100644
--- a/type/src/i18n/pt.ts
+++ b/type/src/i18n/pt.ts
@@ -43,6 +43,7 @@ export const pt: Catalog = {
"Appearance": "Aspeto",
"Applied style": "Estilo aplicado",
"Apply": "Aplicar",
+ "Author": "Autor",
"Author–year — APA-ish": "Autor–ano — estilo APA",
"Auto": "Automático",
"Bento artifact": "Artefato Bento",
@@ -71,12 +72,14 @@ export const pt: Catalog = {
"Comments": "Comentários",
"Comments hidden": "Comentários ocultos",
"Comments shown": "Comentários visíveis",
+ "Company": "Empresa",
"Connect to the live session without saving a new copy — copies you sent earlier will meet you there.": "Conecte-se à sessão ao vivo sem salvar uma nova cópia — as cópias que você enviou antes encontrarão você lá.",
"Connecting to the live session…": "Conectando à sessão ao vivo…",
"Contents": "Índice",
"Contents inserted. Page numbers fill in as the document paginates.": "Sumário inserido. Os números de página são preenchidos conforme o documento é paginado.",
"Copy document JSON": "Copiar JSON do documento",
"Could not check right now.": "Não foi possível verificar agora.",
+ "Could not read: {cols}": "Não foi possível ler: {cols}",
"Credits": "Créditos",
"Cross-reference": "Referência cruzada",
"Custom": "Personalizado",
@@ -97,6 +100,7 @@ export const pt: Catalog = {
"Document id": "ID do documento",
"Document title": "Título do documento",
"Drag to move, click for options": "Arraste para mover, clique para ver opções",
+ "Each row becomes one complete file in a folder you choose.": "Cada linha vira um arquivo completo na pasta que você escolher.",
"Edit": "Editar",
"Edit your comment": "Editar seu comentário",
"Edit “{name}”": "Editar “{name}”",
@@ -107,9 +111,12 @@ export const pt: Catalog = {
"Embedded from {app}": "Incorporado de {app}",
"Equation added — edit it in the Math panel": "Equação adicionada — edite-a no painel Matemática",
"Equation block": "Bloco de equação",
+ "Field": "Campo",
+ "Field: {name}": "Campo: {name}",
"Figure": "Figura",
"Figures": "Figuras",
"File": "Arquivo",
+ "File names": "Nomes dos arquivos",
"Find": "Localizar",
"Find and replace (⌘F)": "Localizar e substituir (⌘F)",
"Find in document": "Localizar no documento",
@@ -121,6 +128,7 @@ export const pt: Catalog = {
"Formula": "Fórmula",
"Formula (⌘M)": "Fórmula (⌘M)",
"Formula added — edit it in the Math panel": "Fórmula adicionada — edite-a no painel Matemática",
+ "From the data source": "Da fonte de dados",
"From {app}": "De {app}",
"Go live": "Ficar ao vivo",
"Guest": "Convidado",
@@ -140,6 +148,8 @@ export const pt: Catalog = {
"Insert a cross-reference": "Inserir uma referência cruzada",
"Insert a cross-reference to a caption": "Inserir uma referência cruzada a uma legenda",
"Insert a display equation on its own line": "Inserir uma equação em destaque, em linha própria",
+ "Insert a field": "Inserir um campo",
+ "Insert a field that the document fills in": "Inserir um campo que o documento preenche",
"Insert a picture": "Inserir uma imagem",
"Insert a picture, table, formula, citation…": "Inserir imagem, tabela, fórmula, citação…",
"Insert a table": "Inserir uma tabela",
@@ -152,6 +162,7 @@ export const pt: Catalog = {
"Justified": "Justificado",
"Keep together": "Manter junto",
"Keep with next": "Manter com o próximo",
+ "Keywords": "Palavras-chave",
"Label — “Table 2”": "Rótulo — “Tabela 2”",
"Landscape": "Paisagem",
"Layout": "Layout",
@@ -163,11 +174,16 @@ export const pt: Catalog = {
"Link (⌘K)": "Link (⌘K)",
"Link address": "Endereço do link",
"Live — this document is being shared": "Ao vivo — este documento está sendo compartilhado",
+ "Mail merge": "Mala direta",
+ "Mail merge from a sheet…": "Mala direta a partir de uma planilha…",
"Margins": "Margens",
"Margins…": "Margens…",
"Match case": "Diferenciar maiúsculas",
"Math": "Matemática",
"Medium": "Médio",
+ "Merge failed: {why}": "A mala direta falhou: {why}",
+ "Merge {n} document(s)": "Mesclar {n} documento(s)",
+ "Merged {n} document(s)": "{n} documento(s) mesclado(s)",
"Mints brand-new keys. Every previously sent copy stops syncing for good; share fresh copies afterwards.": "Gera chaves novas em folha. Toda cópia enviada antes para de sincronizar de vez; compartilhe cópias novas depois.",
"Modified": "Modificado",
"More — revisions, signing, print": "Mais — revisões, assinatura, impressão",
@@ -184,9 +200,11 @@ export const pt: Catalog = {
"No saved versions yet — they accumulate as you edit.": "Ainda não há versões salvas — elas se acumulam conforme você edita.",
"No sources yet. Paste a .bib file to get started.": "Ainda não há fontes. Cole um arquivo .bib para começar.",
"No tracked changes": "Nenhuma alteração controlada",
+ "No {{…}} tokens found in this document": "Nenhum marcador {{…}} encontrado neste documento",
"Not sharing yet — click to start a live session": "Ainda não está compartilhando — clique para iniciar uma sessão ao vivo",
"Nothing is cited yet, so the list is empty.": "Nada foi citado ainda, então a lista está vazia.",
"Nothing matches.": "Nada corresponde.",
+ "Nothing supplies “{name}” — it prints as nothing": "Nada fornece “{name}” — será impresso em branco",
"Nothing that looks like a BibTeX entry.": "Nada que se pareça com uma entrada BibTeX.",
"Nothing to refer to yet — caption a table first": "Ainda não há nada a referenciar — legende uma tabela primeiro",
"Nothing was imported.": "Nada foi importado.",
@@ -199,6 +217,7 @@ export const pt: Catalog = {
"Offline mode is on — nothing leaves this computer.": "O modo offline está ativado — nada sai deste computador.",
"Only the document owner can mint editor invites": "Somente o proprietário do documento pode gerar convites de edição",
"Open": "Abrir",
+ "Optical margins": "Margens ópticas",
"Orientation": "Orientação",
"Original": "Original",
"Outline — show or hide the document map": "Estrutura — mostrar ou ocultar o mapa do documento",
@@ -208,6 +227,7 @@ export const pt: Catalog = {
"Page break inserted": "Quebra de página inserida",
"Page break removed": "Quebra de página removida",
"Page breaking": "Quebra de página",
+ "Page number": "Número da página",
"Page or section, optional — e.g. p. 34": "Página ou seção, opcional — ex.: p. 34",
"Page setup": "Configuração da página",
"Page size": "Tamanho da página",
@@ -226,12 +246,14 @@ export const pt: Catalog = {
"Previous match (⇧Enter)": "Ocorrência anterior (⇧Enter)",
"Print or PDF…": "Imprimir ou PDF…",
"Properties": "Propriedades",
+ "Punctuation hangs a little past the margin so the edge of the text reads straight. It never changes where lines break, so the page count is the same either way.": "A pontuação avança um pouco além da margem para que a borda do texto pareça reta. Nunca muda onde as linhas quebram, portanto o número de páginas é o mesmo nos dois casos.",
"Put the caret in a heading first.": "Posicione o cursor em um título primeiro.",
"Put the caret in a paragraph first": "Posicione o cursor em um parágrafo primeiro",
"Put the caret in the document first": "Posicione o cursor no documento primeiro",
"Put the caret in the table or paragraph to caption": "Posicione o cursor na tabela ou no parágrafo a legendar",
"Put the caret on a tracked change first": "Posicione o cursor sobre uma alteração controlada primeiro",
"Put the caret where the citation goes first": "Posicione o cursor onde a citação deve entrar",
+ "Put the caret where the field goes": "Posicione o cursor onde o campo deve entrar",
"Put the caret where the formula should go": "Posicione o cursor onde a fórmula deve entrar",
"Put the caret where the reference goes": "Posicione o cursor onde a referência deve entrar",
"Quote": "Citação",
@@ -282,6 +304,7 @@ export const pt: Catalog = {
"Share": "Compartilhar",
"Share a copy": "Compartilhar uma cópia",
"Share — invite people to edit live, or send a view-only copy": "Compartilhar — convide pessoas para editar ao vivo ou envie uma cópia somente leitura",
+ "Sheet": "Planilha",
"Show comments": "Mostrar comentários",
"Shown next to your cursor and in the People list — stored only in this browser.": "Exibido ao lado do seu cursor e na lista de Pessoas — guardado apenas neste navegador.",
"Signatures": "Assinaturas",
@@ -298,11 +321,15 @@ export const pt: Catalog = {
"Space before": "Espaço antes",
"Space before (px)": "Espaço antes (px)",
"Start this paragraph on a new page.": "Iniciar este parágrafo em uma nova página.",
+ "Stop": "Parar",
"Stop sharing": "Parar de compartilhar",
+ "Stopped after {n} of {all} document(s)": "Parado após {n} de {all} documento(s)",
"Stored only in this browser, never in the file or online.": "Armazenado apenas neste navegador, nunca no arquivo nem online.",
"Strikethrough": "Tachado",
"Style": "Estilo",
"Style updated from this paragraph": "Estilo atualizado a partir deste parágrafo",
+ "Subject": "Assunto",
+ "Subtitle": "Subtítulo",
"Supported: \\frac \\sqrt ^ _ \\sum \\int \\left( \\right) Greek, matrices, cases.": "Suportado: \\frac \\sqrt ^ _ \\sum \\int \\left( \\right) grego, matrizes, casos.",
"Table": "Tabela",
"Tables and figures are numbered separately, in document order.": "Tabelas e figuras são numeradas separadamente, na ordem do documento.",
@@ -314,8 +341,10 @@ export const pt: Catalog = {
"That JSON was empty.": "Esse JSON estava vazio.",
"That file could not be read as a picture.": "Não foi possível ler esse arquivo como imagem.",
"That file does not look like a Bento document.": "Esse arquivo não parece ser um documento Bento.",
+ "That file has no sheet with named columns to merge from.": "Esse arquivo não tem nenhuma planilha com colunas nomeadas para mesclar.",
"That is already a caption": "Isso já é uma legenda",
"That is not a bento/type document: {detail}": "Isso não é um documento bento/type: {detail}",
+ "That is not a usable field name": "Esse não é um nome de campo utilizável",
"That is not an address this document can link to": "Esse não é um endereço ao qual este documento pode vincular",
"That saved version could not be restored.": "Não foi possível restaurar essa versão salva.",
"That sheet is larger than any printer takes.": "Essa folha é maior do que qualquer impressora aceita.",
@@ -329,7 +358,9 @@ export const pt: Catalog = {
"Theme: {mode} — click to cycle auto/light/dark": "Tema: {mode} — clique para alternar automático/claro/escuro",
"These render as [?key] in the document so they cannot be missed.": "Elas aparecem como [?key] no documento para não passarem despercebidas.",
"This already has a caption": "Isto já tem uma legenda",
+ "This browser can only download files one at a time, which is not workable past {n} rows. Open this document in Chrome or Edge to merge it.": "Este navegador só consegue baixar os arquivos um a um, o que não é viável acima de {n} linhas. Abra este documento no Chrome ou no Edge para fazer a mesclagem.",
"This browser cannot write back to the file, so every save makes a new copy. Chrome and Edge on a computer can save in place.": "Este navegador não consegue escrever de volta no arquivo, então cada vez que você salva ele cria uma nova cópia. O Chrome e o Edge em um computador conseguem salvar no lugar.",
+ "This browser will download each file separately — expect one prompt per row.": "Este navegador vai baixar cada arquivo separadamente — espere um aviso por linha.",
"This build cannot render captions yet — apply the core patch listed at the top of xref.ts": "Esta versão ainda não consegue renderizar legendas — aplique o patch do núcleo listado no topo de xref.ts",
"This document has no live session to follow": "Este documento não tem sessão ao vivo para acompanhar",
"This document has no sources yet. Import some BibTeX first.": "Este documento ainda não tem fontes. Importe algum BibTeX primeiro.",
@@ -346,12 +377,16 @@ export const pt: Catalog = {
"This reference points at something that is no longer in the document": "Esta referência aponta para algo que não está mais no documento",
"Those side margins leave no room for text.": "Essas margens laterais não deixam espaço para o texto.",
"Those top and bottom margins leave no room for text.": "Essas margens superior e inferior não deixam espaço para o texto.",
+ "Time of day": "Hora do dia",
+ "Today’s date": "Data de hoje",
"Top / bottom (in)": "Superior / inferior (pol)",
"Top / bottom (mm)": "Superior / inferior (mm)",
+ "Total pages": "Total de páginas",
"Track changes": "Controlar alterações",
"Tracked changes": "Alterações controladas",
"Tracking is on. Edits you make from now on are recorded here.": "O controle está ativado. As edições que você fizer a partir de agora são registradas aqui.",
"Turn on \"Track changes\" in the properties panel, or take a Snapshot from ⋯ and use Review changes.": "Ative “Controlar alterações” no painel de propriedades, ou tire um Instantâneo em ⋯ e use Revisar alterações.",
+ "Turn {{…}} tokens into fields": "Converter marcadores {{…}} em campos",
"Typeface": "Fonte",
"US Legal": "US Legal",
"US Letter": "US Letter",
@@ -364,6 +399,7 @@ export const pt: Catalog = {
"Update this file": "Atualizar este arquivo",
"Updates": "Atualizações",
"Use document defaults": "Usar os padrões do documento",
+ "Use {{#}} for the row number, or a column name in braces.": "Use {{#}} para o número da linha, ou um nome de coluna entre chaves.",
"Version history": "Histórico de versões",
"Version history…": "Histórico de versões…",
"Version {v} is available.": "A versão {v} está disponível.",
@@ -391,6 +427,7 @@ export const pt: Catalog = {
"mixed": "misto",
"mm": "mm",
"not cited": "não citado",
+ "or a field name…": "ou um nome de campo…",
"pt": "pt",
"the text this was about is gone": "o texto a que isto se referia não existe mais",
"v{app} · format v{fmt}": "v{app} · formato v{fmt}",
@@ -400,19 +437,39 @@ export const pt: Catalog = {
"{name} (you)": "{name} (você)",
"{name} — click to follow": "{name} — clique para seguir",
"{n} broken reference(s)": "{n} referência(s) quebrada(s)",
+ "{n} field(s) created from tokens": "{n} campo(s) criado(s) a partir dos marcadores",
"{n} more": "mais {n}",
"{n} of {m}": "{n} de {m}",
"{n} of {total}": "{n} de {total}",
"{n} replies": "{n} respostas",
"{open} open of {all}": "{open} abertos de {all}",
"{pages} page(s) · {words} words · {blocks} blocks · {notes} footnote(s). The document, the editor and the typesetter are all in this one file.": "{pages} página(s) · {words} palavras · {blocks} blocos · {notes} nota(s) de rodapé. O documento, o editor e o compositor tipográfico estão todos neste único arquivo.",
+ "{rows} row(s), {cols} column(s)": "{rows} linha(s), {cols} coluna(s)",
"{rows} rows × {cols} columns": "{rows} linhas × {cols} colunas",
"{size}, {orient} · text area {w} × {h} {unit}": "{size}, {orient} · área de texto {w} × {h} {unit}",
"{when} (most recent)": "{when} (mais recente)",
"— mixed —": "— misto —",
+ "“{name}” is also a document property — this column takes over that field": "“{name}” também é uma propriedade do documento — esta coluna substitui esse campo",
"…": "…",
"⌃⇧↑ / ⌃⇧↓": "⌃⇧↑ / ⌃⇧↓",
"○ Not live — turns on when you share": "○ Não está ao vivo — ativa quando você compartilha",
"● Connecting…": "● Conectando…",
"● Live — {n} connected": "● Ao vivo — {n} conectados",
+ // compare with a file — the redline against another document (compare.ts)
+ "That is a {app} file, not a bento/type document.": "Esse é um arquivo do {app}, não um documento do bento/type.",
+ "That file does not look like a bento/type document.": "Esse arquivo não parece um documento do bento/type.",
+ "That file has no document in it.": "Esse arquivo não contém nenhum documento.",
+ "That file could not be read: {detail}": "Não foi possível ler esse arquivo: {detail}",
+ "That file is a different document, not another copy of this one — comparing unrelated documents works, but check you picked the file you meant.": "Esse arquivo é um documento diferente, não outra cópia deste — comparar documentos sem relação funciona, mas confira se você escolheu o arquivo certo.",
+ "One problem in that file was repaired as it was read, which can itself appear below as a change.": "Um problema nesse arquivo foi reparado durante a leitura, o que pode aparecer abaixo como uma alteração.",
+ "{n} problems in that file were repaired as it was read, which can themselves appear below as changes.": "{n} problemas nesse arquivo foram reparados durante a leitura, o que pode aparecer abaixo como alterações.",
+ "This is a view: changes are shown, never applied. Accept and reject are offered only against a Snapshot of this document.": "Isto é uma visualização: as alterações são exibidas, nunca aplicadas. Aceitar e rejeitar só estão disponíveis em relação a um instantâneo deste documento.",
+ "That file is identical to this document — there is nothing to compare.": "Esse arquivo é idêntico a este documento — não há nada a comparar.",
+ "1 change from “{file}” to this document": "1 alteração de “{file}” para este documento",
+ "{n} changes from “{file}” to this document": "{n} alterações de “{file}” para este documento",
+ "Compare with another document": "Comparar com outro documento",
+ "Choose another bento/type file. The redline shows what changed from that file to this document. Comparing never changes what you have open.": "Escolha outro arquivo do bento/type. A comparação mostra o que mudou desse arquivo para este documento. Comparar nunca altera o que você tem aberto.",
+ "Drop a Bento document here": "Solte um documento Bento aqui",
+ "Choose a file…": "Escolher um arquivo…",
+ "Compare with a file…": "Comparar com um arquivo…",
}
diff --git a/type/src/i18n/zh-Hans.ts b/type/src/i18n/zh-Hans.ts
index 1cede893..1dea9576 100644
--- a/type/src/i18n/zh-Hans.ts
+++ b/type/src/i18n/zh-Hans.ts
@@ -30,6 +30,7 @@ export const zhHans: Catalog = {
"Appearance": "外观",
"Applied style": "已应用的样式",
"Apply": "应用",
+ "Author": "作者",
"Author–year — APA-ish": "著者–年份(类 APA)",
"Auto": "自动",
"Bento artifact": "Bento 制品",
@@ -58,10 +59,12 @@ export const zhHans: Catalog = {
"Comments": "批注",
"Comments hidden": "批注已隐藏",
"Comments shown": "批注已显示",
+ "Company": "公司",
"Contents": "目录",
"Contents inserted. Page numbers fill in as the document paginates.": "已插入目录。页码将在文档分页时自动填入。",
"Copy document JSON": "复制文档 JSON",
"Could not check right now.": "目前无法检查。",
+ "Could not read: {cols}": "无法读取:{cols}",
"Credits": "致谢",
"Cross-reference": "交叉引用",
"Custom": "自定义",
@@ -80,6 +83,7 @@ export const zhHans: Catalog = {
"Document id": "文档 ID",
"Document title": "文档标题",
"Drag to move, click for options": "拖动以移动,点击查看选项",
+ "Each row becomes one complete file in a folder you choose.": "每一行都会在你选择的文件夹中生成一个完整的文件。",
"Edit": "编辑",
"Edit your comment": "编辑你的批注",
"Edit “{name}”": "编辑“{name}”",
@@ -88,9 +92,12 @@ export const zhHans: Catalog = {
"Embedded from {app}": "嵌入自 {app}",
"Equation added — edit it in the Math panel": "已添加公式 — 请在数学面板中编辑",
"Equation block": "公式块",
+ "Field": "字段",
+ "Field: {name}": "字段:{name}",
"Figure": "图",
"Figures": "图",
"File": "文件",
+ "File names": "文件名",
"Find": "查找",
"Find and replace (⌘F)": "查找和替换 (⌘F)",
"Find in document": "在文档中查找",
@@ -102,6 +109,7 @@ export const zhHans: Catalog = {
"Formula": "公式",
"Formula (⌘M)": "公式 (⌘M)",
"Formula added — edit it in the Math panel": "已添加公式 — 请在数学面板中编辑",
+ "From the data source": "来自数据源",
"From {app}": "来自 {app}",
"Header row": "标题行",
"Heading 1": "标题 1",
@@ -119,6 +127,8 @@ export const zhHans: Catalog = {
"Insert a cross-reference": "插入交叉引用",
"Insert a cross-reference to a caption": "插入指向题注的交叉引用",
"Insert a display equation on its own line": "插入独占一行的公式",
+ "Insert a field": "插入字段",
+ "Insert a field that the document fills in": "插入由文档自动填写的字段",
"Insert a picture": "插入图片",
"Insert a picture, table, formula, citation…": "插入图片、表格、公式、引用…",
"Insert a table": "插入表格",
@@ -130,6 +140,7 @@ export const zhHans: Catalog = {
"Justified": "两端对齐",
"Keep together": "段落不跨页",
"Keep with next": "与下段同页",
+ "Keywords": "关键词",
"Label — “Table 2”": "标签 —“表 2”",
"Landscape": "横向",
"Layout": "布局",
@@ -140,11 +151,16 @@ export const zhHans: Catalog = {
"Line spacing": "行距",
"Link (⌘K)": "链接 (⌘K)",
"Link address": "链接地址",
+ "Mail merge": "邮件合并",
+ "Mail merge from a sheet…": "从工作表邮件合并…",
"Margins": "页边距",
"Margins…": "页边距…",
"Match case": "区分大小写",
"Math": "数学",
"Medium": "中等",
+ "Merge failed: {why}": "合并失败:{why}",
+ "Merge {n} document(s)": "合并 {n} 个文档",
+ "Merged {n} document(s)": "已合并 {n} 个文档",
"Modified": "已修改",
"More — revisions, signing, print": "更多 — 修订、签名、打印",
"Move down": "下移",
@@ -159,8 +175,10 @@ export const zhHans: Catalog = {
"No matches": "没有匹配项",
"No sources yet. Paste a .bib file to get started.": "尚无来源。粘贴 .bib 文件即可开始。",
"No tracked changes": "没有修订记录",
+ "No {{…}} tokens found in this document": "此文档中没有找到 {{…}} 记号",
"Nothing is cited yet, so the list is empty.": "尚未引用任何内容,因此列表为空。",
"Nothing matches.": "没有匹配项。",
+ "Nothing supplies “{name}” — it prints as nothing": "没有任何来源提供“{name}”——打印时为空",
"Nothing that looks like a BibTeX entry.": "没有看起来像 BibTeX 条目的内容。",
"Nothing to refer to yet — caption a table first": "尚无可引用的内容 — 请先为表格添加题注",
"Nothing was imported.": "未导入任何内容。",
@@ -171,6 +189,7 @@ export const zhHans: Catalog = {
"Numeric [1] — IEEE-ish": "数字 [1](类 IEEE)",
"Off by default: most documents already carry their numbers in the heading text.": "默认关闭:大多数文档的标题文本中已经包含编号。",
"Open": "打开",
+ "Optical margins": "视觉边距",
"Orientation": "方向",
"Original": "原始",
"Outline — show or hide the document map": "大纲 — 显示或隐藏文档结构图",
@@ -179,6 +198,7 @@ export const zhHans: Catalog = {
"Page break inserted": "已插入分页符",
"Page break removed": "已删除分页符",
"Page breaking": "分页",
+ "Page number": "页码",
"Page or section, optional — e.g. p. 34": "页码或章节(可选)— 例如第 34 页",
"Page setup": "页面设置",
"Page size": "页面大小",
@@ -196,12 +216,14 @@ export const zhHans: Catalog = {
"Previous match (⇧Enter)": "上一个匹配项 (⇧Enter)",
"Print or PDF…": "打印或导出 PDF…",
"Properties": "属性",
+ "Punctuation hangs a little past the margin so the edge of the text reads straight. It never changes where lines break, so the page count is the same either way.": "标点符号会稍稍伸出页边距,使文字的边缘看起来更整齐。它不会改变换行位置,因此页数不变。",
"Put the caret in a heading first.": "请先将光标置于标题中。",
"Put the caret in a paragraph first": "请先将光标置于段落中",
"Put the caret in the document first": "请先将光标置于文档中",
"Put the caret in the table or paragraph to caption": "将光标置于要添加题注的表格或段落中",
"Put the caret on a tracked change first": "请先将光标置于某处修订上",
"Put the caret where the citation goes first": "请先将光标置于要插入引用的位置",
+ "Put the caret where the field goes": "请先将光标置于要插入字段的位置",
"Put the caret where the formula should go": "请将光标置于要插入公式的位置",
"Put the caret where the reference goes": "请先将光标置于要插入引用的位置",
"Quote": "引述",
@@ -243,6 +265,7 @@ export const zhHans: Catalog = {
"Select something to see its properties.": "选中一些内容以查看其属性。",
"Select the words you want to link": "选中要添加链接的文字",
"Semibold": "半粗体",
+ "Sheet": "工作表",
"Show comments": "显示批注",
"Signatures": "签名",
"Sign…": "签名…",
@@ -257,9 +280,13 @@ export const zhHans: Catalog = {
"Space before": "段前间距",
"Space before (px)": "段前间距(像素)",
"Start this paragraph on a new page.": "此段落将从新的一页开始。",
+ "Stop": "停止",
+ "Stopped after {n} of {all} document(s)": "已在 {all} 个文档中完成 {n} 个后停止",
"Strikethrough": "删除线",
"Style": "样式",
"Style updated from this paragraph": "已根据此段落更新样式",
+ "Subject": "主题",
+ "Subtitle": "副标题",
"Supported: \\frac \\sqrt ^ _ \\sum \\int \\left( \\right) Greek, matrices, cases.": "支持:\\frac \\sqrt ^ _ \\sum \\int \\left( \\right),希腊字母、矩阵、分段函数。",
"Table": "表格",
"Tables and figures are numbered separately, in document order.": "表格和图分别独立编号,按文档中的顺序排列。",
@@ -270,8 +297,10 @@ export const zhHans: Catalog = {
"That JSON was empty.": "该 JSON 为空。",
"That file could not be read as a picture.": "无法将该文件作为图片读取。",
"That file does not look like a Bento document.": "该文件看起来不是 Bento 文档。",
+ "That file has no sheet with named columns to merge from.": "该文件中没有带命名列的工作表可用于合并。",
"That is already a caption": "这已经是题注",
"That is not a bento/type document: {detail}": "这不是 bento/type 文档:{detail}",
+ "That is not a usable field name": "这不是可用的字段名",
"That is not an address this document can link to": "这不是本文档可以链接到的地址",
"That saved version could not be restored.": "无法恢复该已保存的版本。",
"That sheet is larger than any printer takes.": "该纸张尺寸超出了任何打印机的支持范围。",
@@ -285,7 +314,9 @@ export const zhHans: Catalog = {
"Theme: {mode} — click to cycle auto/light/dark": "主题:{mode} — 点击可在自动/浅色/深色间切换",
"These render as [?key] in the document so they cannot be missed.": "这些会在文档中显示为 [?key],因此不会被忽略。",
"This already has a caption": "这已经有题注了",
+ "This browser can only download files one at a time, which is not workable past {n} rows. Open this document in Chrome or Edge to merge it.": "此浏览器只能逐个下载文件,超过 {n} 行就不切实际了。请在 Chrome 或 Edge 中打开此文档再进行合并。",
"This browser cannot write back to the file, so every save makes a new copy. Chrome and Edge on a computer can save in place.": "此浏览器无法回写到文件,因此每次保存都会生成新副本。电脑版 Chrome 和 Edge 可以直接原地保存。",
+ "This browser will download each file separately — expect one prompt per row.": "此浏览器会分别下载每个文件——每一行都会出现一次提示。",
"This build cannot render captions yet — apply the core patch listed at the top of xref.ts": "此构建版本尚不能渲染题注——请应用 xref.ts 顶部列出的核心补丁",
"This document has no sources yet. Import some BibTeX first.": "本文档尚无来源。请先导入一些 BibTeX。",
"This embed could not be displayed safely.": "无法安全显示此嵌入内容。",
@@ -300,12 +331,16 @@ export const zhHans: Catalog = {
"This reference points at something that is no longer in the document": "此引用指向的内容已不在文档中",
"Those side margins leave no room for text.": "左右页边距过大,没有留出文本空间。",
"Those top and bottom margins leave no room for text.": "上下页边距过大,没有留出文本空间。",
+ "Time of day": "时间",
+ "Today’s date": "今天的日期",
"Top / bottom (in)": "上 / 下(英寸)",
"Top / bottom (mm)": "上 / 下(毫米)",
+ "Total pages": "总页数",
"Track changes": "修订",
"Tracked changes": "修订",
"Tracking is on. Edits you make from now on are recorded here.": "跟踪已开启。此后的编辑都会记录在此。",
"Turn on \"Track changes\" in the properties panel, or take a Snapshot from ⋯ and use Review changes.": "在属性面板中开启“修订”,或从 ⋯ 中获取“快照”并使用“审阅修订”。",
+ "Turn {{…}} tokens into fields": "把 {{…}} 记号转换为字段",
"Typeface": "字体",
"US Legal": "美国法律用纸",
"US Letter": "美国信纸",
@@ -317,6 +352,7 @@ export const zhHans: Catalog = {
"Update this file": "更新此文件",
"Updates": "更新",
"Use document defaults": "使用文档默认值",
+ "Use {{#}} for the row number, or a column name in braces.": "用 {{#}} 表示行号,或把列名放在大括号里。",
"Version {v} is available.": "有新版本 {v} 可用。",
"Visit bento.page (opens in a new tab)": "访问 bento.page(在新标签页中打开)",
"Weight": "字重",
@@ -338,6 +374,7 @@ export const zhHans: Catalog = {
"mixed": "混合",
"mm": "毫米",
"not cited": "未引用",
+ "or a field name…": "或输入字段名…",
"pt": "磅",
"the text this was about is gone": "这条批注所指的文本已被删除",
"v{app} · format v{fmt}": "v{app} · 格式 v{fmt}",
@@ -345,15 +382,18 @@ export const zhHans: Catalog = {
"{key} is cited in this document. Remove it anyway?": "{key} 已在本文档中被引用。仍要移除吗?",
"{m} changes": "{m} 处修订",
"{n} broken reference(s)": "{n} 处无效引用",
+ "{n} field(s) created from tokens": "已从记号创建 {n} 个字段",
"{n} more": "还有 {n} 个",
"{n} of {m}": "第 {n} / {m} 个",
"{n} of {total}": "第 {n} / {total} 个",
"{n} replies": "{n} 条回复",
"{open} open of {all}": "{all} 条中 {open} 条未解决",
"{pages} page(s) · {words} words · {blocks} blocks · {notes} footnote(s). The document, the editor and the typesetter are all in this one file.": "{pages} 页 · {words} 字 · {blocks} 个块 · {notes} 条脚注。文档、编辑器和排版引擎全都在这一个文件中。",
+ "{rows} row(s), {cols} column(s)": "{rows} 行,{cols} 列",
"{rows} rows × {cols} columns": "{rows} 行 × {cols} 列",
"{size}, {orient} · text area {w} × {h} {unit}": "{size},{orient} · 文本区域 {w} × {h} {unit}",
"— mixed —": "— 混合 —",
+ "“{name}” is also a document property — this column takes over that field": "“{name}”也是文档属性名——此列将取代该字段",
"…": "…",
"⌃⇧↑ / ⌃⇧↓": "⌃⇧↑ / ⌃⇧↓",
"Discard": "放弃",
@@ -404,4 +444,21 @@ export const zhHans: Catalog = {
"Mints brand-new keys. Every previously sent copy stops syncing for good; share fresh copies afterwards.": "会生成全新的密钥。此前发送的每个副本都将永久停止同步;之后请重新共享新的副本。",
"Offline mode is on — nothing leaves this computer.": "离线模式已开启 — 任何内容都不会离开这台电脑。",
"Tabs on this machine still sync; turn offline mode off to collaborate online.": "本机上的标签页之间仍会同步;要在线协作请关闭离线模式。",
+ // compare with a file — the redline against another document (compare.ts)
+ "That is a {app} file, not a bento/type document.": "这是一个 {app} 文件,不是 bento/type 文档。",
+ "That file does not look like a bento/type document.": "该文件看起来不是 bento/type 文档。",
+ "That file has no document in it.": "该文件中没有文档。",
+ "That file could not be read: {detail}": "无法读取该文件:{detail}",
+ "That file is a different document, not another copy of this one — comparing unrelated documents works, but check you picked the file you meant.": "该文件是另一个文档,而不是此文档的另一份副本 — 比较无关的文档是可以的,但请确认你选对了文件。",
+ "One problem in that file was repaired as it was read, which can itself appear below as a change.": "读取该文件时修复了 1 处问题,该修复本身可能会在下方显示为一处修订。",
+ "{n} problems in that file were repaired as it was read, which can themselves appear below as changes.": "读取该文件时修复了 {n} 处问题,这些修复本身可能会在下方显示为修订。",
+ "This is a view: changes are shown, never applied. Accept and reject are offered only against a Snapshot of this document.": "这只是一个视图:修订仅供查看,不会被应用。接受和拒绝仅在与本文档的快照比较时才提供。",
+ "That file is identical to this document — there is nothing to compare.": "该文件与此文档完全相同 — 没有可比较的内容。",
+ "1 change from “{file}” to this document": "从“{file}”到此文档的 1 处修订",
+ "{n} changes from “{file}” to this document": "从“{file}”到此文档的 {n} 处修订",
+ "Compare with another document": "与另一个文档比较",
+ "Choose another bento/type file. The redline shows what changed from that file to this document. Comparing never changes what you have open.": "选择另一个 bento/type 文件。对比会显示从该文件到此文档发生了哪些修订。比较永远不会改变你打开的文档。",
+ "Drop a Bento document here": "将 Bento 文档拖放到此处",
+ "Choose a file…": "选择文件…",
+ "Compare with a file…": "与文件比较…",
}
diff --git a/type/src/i18n/zh-Hant.ts b/type/src/i18n/zh-Hant.ts
index c6c214ad..dc90a854 100644
--- a/type/src/i18n/zh-Hant.ts
+++ b/type/src/i18n/zh-Hant.ts
@@ -30,6 +30,7 @@ export const zhHant: Catalog = {
"Appearance": "外觀",
"Applied style": "已套用的樣式",
"Apply": "套用",
+ "Author": "作者",
"Author–year — APA-ish": "作者–年份(類 APA)",
"Auto": "自動",
"Bento artifact": "Bento 成品",
@@ -58,10 +59,12 @@ export const zhHant: Catalog = {
"Comments": "註解",
"Comments hidden": "註解已隱藏",
"Comments shown": "註解已顯示",
+ "Company": "公司",
"Contents": "目錄",
"Contents inserted. Page numbers fill in as the document paginates.": "已插入目錄。頁碼會在文件分頁時自動填入。",
"Copy document JSON": "複製文件 JSON",
"Could not check right now.": "目前無法檢查。",
+ "Could not read: {cols}": "無法讀取:{cols}",
"Credits": "致謝",
"Cross-reference": "交叉參照",
"Custom": "自訂",
@@ -80,6 +83,7 @@ export const zhHant: Catalog = {
"Document id": "文件 ID",
"Document title": "文件標題",
"Drag to move, click for options": "拖曳以移動,點按查看選項",
+ "Each row becomes one complete file in a folder you choose.": "每一列都會在你選擇的資料夾中產生一個完整的檔案。",
"Edit": "編輯",
"Edit your comment": "編輯你的註解",
"Edit “{name}”": "編輯「{name}」",
@@ -88,9 +92,12 @@ export const zhHant: Catalog = {
"Embedded from {app}": "嵌入自 {app}",
"Equation added — edit it in the Math panel": "已新增公式 — 請在數學面板中編輯",
"Equation block": "公式區塊",
+ "Field": "欄位",
+ "Field: {name}": "欄位:{name}",
"Figure": "圖",
"Figures": "圖",
"File": "檔案",
+ "File names": "檔案名稱",
"Find": "尋找",
"Find and replace (⌘F)": "尋找及取代 (⌘F)",
"Find in document": "在文件中尋找",
@@ -102,6 +109,7 @@ export const zhHant: Catalog = {
"Formula": "公式",
"Formula (⌘M)": "公式 (⌘M)",
"Formula added — edit it in the Math panel": "已新增公式 — 請在數學面板中編輯",
+ "From the data source": "來自資料來源",
"From {app}": "來自 {app}",
"Header row": "標題列",
"Heading 1": "標題 1",
@@ -119,6 +127,8 @@ export const zhHant: Catalog = {
"Insert a cross-reference": "插入交叉參照",
"Insert a cross-reference to a caption": "插入指向題注的交叉參照",
"Insert a display equation on its own line": "插入獨佔一行的公式",
+ "Insert a field": "插入欄位",
+ "Insert a field that the document fills in": "插入由文件自動填入的欄位",
"Insert a picture": "插入圖片",
"Insert a picture, table, formula, citation…": "插入圖片、表格、公式、引文…",
"Insert a table": "插入表格",
@@ -130,6 +140,7 @@ export const zhHant: Catalog = {
"Justified": "左右對齊",
"Keep together": "段落不跨頁",
"Keep with next": "與下段同頁",
+ "Keywords": "關鍵字",
"Label — “Table 2”": "標籤 —「表 2」",
"Landscape": "橫向",
"Layout": "版面",
@@ -140,11 +151,16 @@ export const zhHant: Catalog = {
"Line spacing": "行距",
"Link (⌘K)": "連結 (⌘K)",
"Link address": "連結位址",
+ "Mail merge": "合併列印",
+ "Mail merge from a sheet…": "從工作表合併列印…",
"Margins": "邊界",
"Margins…": "邊界…",
"Match case": "區分大小寫",
"Math": "數學",
"Medium": "中等",
+ "Merge failed: {why}": "合併失敗:{why}",
+ "Merge {n} document(s)": "合併 {n} 份文件",
+ "Merged {n} document(s)": "已合併 {n} 份文件",
"Modified": "已修改",
"More — revisions, signing, print": "更多 — 修訂、簽署、列印",
"Move down": "下移",
@@ -159,8 +175,10 @@ export const zhHant: Catalog = {
"No matches": "沒有相符項目",
"No sources yet. Paste a .bib file to get started.": "尚未有來源。貼上 .bib 檔案即可開始。",
"No tracked changes": "沒有修訂記錄",
+ "No {{…}} tokens found in this document": "此文件中沒有找到 {{…}} 標記",
"Nothing is cited yet, so the list is empty.": "尚未引用任何內容,因此清單是空的。",
"Nothing matches.": "沒有相符項目。",
+ "Nothing supplies “{name}” — it prints as nothing": "沒有任何來源提供「{name}」——列印時為空白",
"Nothing that looks like a BibTeX entry.": "沒有看起來像 BibTeX 條目的內容。",
"Nothing to refer to yet — caption a table first": "尚無可參照的內容 — 請先為表格加上題注",
"Nothing was imported.": "未匯入任何內容。",
@@ -171,6 +189,7 @@ export const zhHant: Catalog = {
"Numeric [1] — IEEE-ish": "數字 [1](類 IEEE)",
"Off by default: most documents already carry their numbers in the heading text.": "預設關閉:大多數文件的標題文字中已經包含編號。",
"Open": "開啟",
+ "Optical margins": "視覺邊界",
"Orientation": "方向",
"Original": "原始",
"Outline — show or hide the document map": "大綱 — 顯示或隱藏文件結構圖",
@@ -179,6 +198,7 @@ export const zhHant: Catalog = {
"Page break inserted": "已插入分頁符號",
"Page break removed": "已刪除分頁符號",
"Page breaking": "分頁",
+ "Page number": "頁碼",
"Page or section, optional — e.g. p. 34": "頁碼或章節(選填)— 例如第 34 頁",
"Page setup": "頁面設定",
"Page size": "頁面大小",
@@ -196,12 +216,14 @@ export const zhHant: Catalog = {
"Previous match (⇧Enter)": "上一個相符項目 (⇧Enter)",
"Print or PDF…": "列印或匯出 PDF…",
"Properties": "屬性",
+ "Punctuation hangs a little past the margin so the edge of the text reads straight. It never changes where lines break, so the page count is the same either way.": "標點符號會稍微伸出頁邊界,讓文字邊緣看起來更整齊。它不會改變換行位置,因此頁數不變。",
"Put the caret in a heading first.": "請先將游標置於標題中。",
"Put the caret in a paragraph first": "請先將游標置於段落中",
"Put the caret in the document first": "請先將游標置於文件中",
"Put the caret in the table or paragraph to caption": "將游標置於要加上題注的表格或段落中",
"Put the caret on a tracked change first": "請先將游標置於某項修訂上",
"Put the caret where the citation goes first": "請先將游標置於要插入引文的位置",
+ "Put the caret where the field goes": "請先將游標置於要插入欄位的位置",
"Put the caret where the formula should go": "請將游標置於要插入公式的位置",
"Put the caret where the reference goes": "請先將游標置於要插入參照的位置",
"Quote": "引述",
@@ -243,6 +265,7 @@ export const zhHant: Catalog = {
"Select something to see its properties.": "選取一些內容以查看其屬性。",
"Select the words you want to link": "選取要加上連結的文字",
"Semibold": "半粗體",
+ "Sheet": "工作表",
"Show comments": "顯示註解",
"Signatures": "簽署",
"Sign…": "簽署…",
@@ -257,9 +280,13 @@ export const zhHant: Catalog = {
"Space before": "段落前間距",
"Space before (px)": "段落前間距(像素)",
"Start this paragraph on a new page.": "此段落將從新的一頁開始。",
+ "Stop": "停止",
+ "Stopped after {n} of {all} document(s)": "已在 {all} 份文件中完成 {n} 份後停止",
"Strikethrough": "刪除線",
"Style": "樣式",
"Style updated from this paragraph": "已根據此段落更新樣式",
+ "Subject": "主旨",
+ "Subtitle": "副標題",
"Supported: \\frac \\sqrt ^ _ \\sum \\int \\left( \\right) Greek, matrices, cases.": "支援:\\frac \\sqrt ^ _ \\sum \\int \\left( \\right),希臘字母、矩陣、分段函數。",
"Table": "表格",
"Tables and figures are numbered separately, in document order.": "表格與圖分別獨立編號,按文件中的順序排列。",
@@ -270,8 +297,10 @@ export const zhHant: Catalog = {
"That JSON was empty.": "該 JSON 是空的。",
"That file could not be read as a picture.": "無法將該檔案作為圖片讀取。",
"That file does not look like a Bento document.": "該檔案看起來不是 Bento 文件。",
+ "That file has no sheet with named columns to merge from.": "該檔案中沒有具名欄位的工作表可用於合併。",
"That is already a caption": "這已經是題注",
"That is not a bento/type document: {detail}": "這不是 bento/type 文件:{detail}",
+ "That is not a usable field name": "這不是可用的欄位名稱",
"That is not an address this document can link to": "這不是本文件可以連結到的位址",
"That saved version could not be restored.": "無法還原該已儲存的版本。",
"That sheet is larger than any printer takes.": "該紙張尺寸超出任何印表機的支援範圍。",
@@ -285,7 +314,9 @@ export const zhHant: Catalog = {
"Theme: {mode} — click to cycle auto/light/dark": "主題:{mode} — 點按可在自動/淺色/深色間切換",
"These render as [?key] in the document so they cannot be missed.": "這些會在文件中顯示為 [?key],因此不會被忽略。",
"This already has a caption": "這已經有題注了",
+ "This browser can only download files one at a time, which is not workable past {n} rows. Open this document in Chrome or Edge to merge it.": "此瀏覽器只能逐一下載檔案,超過 {n} 列就不切實際了。請在 Chrome 或 Edge 中開啟此文件再進行合併。",
"This browser cannot write back to the file, so every save makes a new copy. Chrome and Edge on a computer can save in place.": "這個瀏覽器無法回寫至檔案,因此每次儲存都會產生新副本。電腦版 Chrome 和 Edge 可以直接原地儲存。",
+ "This browser will download each file separately — expect one prompt per row.": "此瀏覽器會分別下載每個檔案——每一列都會出現一次提示。",
"This build cannot render captions yet — apply the core patch listed at the top of xref.ts": "此建置版本尚無法渲染題注 — 請套用 xref.ts 頂端列出的核心修補",
"This document has no sources yet. Import some BibTeX first.": "本文件尚無來源。請先匯入一些 BibTeX。",
"This embed could not be displayed safely.": "無法安全顯示此嵌入內容。",
@@ -300,12 +331,16 @@ export const zhHant: Catalog = {
"This reference points at something that is no longer in the document": "此參照指向的內容已不在文件中",
"Those side margins leave no room for text.": "左右邊界過大,沒有留出文字空間。",
"Those top and bottom margins leave no room for text.": "上下邊界過大,沒有留出文字空間。",
+ "Time of day": "時間",
+ "Today’s date": "今天的日期",
"Top / bottom (in)": "上 / 下(英吋)",
"Top / bottom (mm)": "上 / 下(公釐)",
+ "Total pages": "總頁數",
"Track changes": "追蹤修訂",
"Tracked changes": "修訂",
"Tracking is on. Edits you make from now on are recorded here.": "追蹤已開啟。此後的編輯都會記錄在這裡。",
"Turn on \"Track changes\" in the properties panel, or take a Snapshot from ⋯ and use Review changes.": "在屬性面板中開啟「追蹤修訂」,或從 ⋯ 取得「快照」並使用「校閱修訂」。",
+ "Turn {{…}} tokens into fields": "把 {{…}} 標記轉換為欄位",
"Typeface": "字體",
"US Legal": "美國法律用紙",
"US Letter": "美國信紙",
@@ -317,6 +352,7 @@ export const zhHant: Catalog = {
"Update this file": "更新此檔案",
"Updates": "更新",
"Use document defaults": "使用文件預設值",
+ "Use {{#}} for the row number, or a column name in braces.": "用 {{#}} 表示列號,或把欄位名稱放在大括號裡。",
"Version {v} is available.": "有新版本 {v} 可用。",
"Visit bento.page (opens in a new tab)": "前往 bento.page(在新分頁中開啟)",
"Weight": "字重",
@@ -338,6 +374,7 @@ export const zhHant: Catalog = {
"mixed": "混合",
"mm": "公釐",
"not cited": "未引用",
+ "or a field name…": "或輸入欄位名稱…",
"pt": "pt",
"the text this was about is gone": "這則註解所指的文字已被刪除",
"v{app} · format v{fmt}": "v{app} · 格式 v{fmt}",
@@ -345,15 +382,18 @@ export const zhHant: Catalog = {
"{key} is cited in this document. Remove it anyway?": "{key} 已在本文件中被引用。仍要移除嗎?",
"{m} changes": "{m} 項修訂",
"{n} broken reference(s)": "{n} 項失效參照",
+ "{n} field(s) created from tokens": "已從標記建立 {n} 個欄位",
"{n} more": "還有 {n} 個",
"{n} of {m}": "第 {n} / {m} 個",
"{n} of {total}": "第 {n} / {total} 個",
"{n} replies": "{n} 則回覆",
"{open} open of {all}": "{all} 則中 {open} 則未解決",
"{pages} page(s) · {words} words · {blocks} blocks · {notes} footnote(s). The document, the editor and the typesetter are all in this one file.": "{pages} 頁 · {words} 字 · {blocks} 個區塊 · {notes} 則註腳。文件、編輯器與排版引擎全都在這一個檔案中。",
+ "{rows} row(s), {cols} column(s)": "{rows} 列,{cols} 欄",
"{rows} rows × {cols} columns": "{rows} 列 × {cols} 欄",
"{size}, {orient} · text area {w} × {h} {unit}": "{size},{orient} · 文字區域 {w} × {h} {unit}",
"— mixed —": "— 混合 —",
+ "“{name}” is also a document property — this column takes over that field": "「{name}」也是文件屬性名稱——此欄位將取代該欄位",
"…": "…",
"⌃⇧↑ / ⌃⇧↓": "⌃⇧↑ / ⌃⇧↓",
"Discard": "捨棄",
@@ -404,4 +444,21 @@ export const zhHant: Catalog = {
"Mints brand-new keys. Every previously sent copy stops syncing for good; share fresh copies afterwards.": "會產生全新的金鑰。先前傳送的每個副本都將永久停止同步;之後請重新共用新的副本。",
"Offline mode is on — nothing leaves this computer.": "離線模式已開啟 — 任何內容都不會離開這台電腦。",
"Tabs on this machine still sync; turn offline mode off to collaborate online.": "本機上的分頁之間仍會同步;要線上協作請關閉離線模式。",
+ // compare with a file — the redline against another document (compare.ts)
+ "That is a {app} file, not a bento/type document.": "這是一個 {app} 檔案,不是 bento/type 文件。",
+ "That file does not look like a bento/type document.": "該檔案看起來不是 bento/type 文件。",
+ "That file has no document in it.": "該檔案中沒有文件。",
+ "That file could not be read: {detail}": "無法讀取該檔案:{detail}",
+ "That file is a different document, not another copy of this one — comparing unrelated documents works, but check you picked the file you meant.": "該檔案是另一份文件,而不是這份文件的另一個副本 — 比較無關的文件是可以的,但請確認你選對了檔案。",
+ "One problem in that file was repaired as it was read, which can itself appear below as a change.": "讀取該檔案時修復了 1 處問題,該修復本身可能會在下方顯示為一處修訂。",
+ "{n} problems in that file were repaired as it was read, which can themselves appear below as changes.": "讀取該檔案時修復了 {n} 處問題,這些修復本身可能會在下方顯示為修訂。",
+ "This is a view: changes are shown, never applied. Accept and reject are offered only against a Snapshot of this document.": "這只是一個檢視:修訂僅供查看,不會被套用。接受與拒絕僅在與本文件的快照比較時才提供。",
+ "That file is identical to this document — there is nothing to compare.": "該檔案與這份文件完全相同 — 沒有可比較的內容。",
+ "1 change from “{file}” to this document": "從「{file}」到這份文件的 1 處修訂",
+ "{n} changes from “{file}” to this document": "從「{file}」到這份文件的 {n} 處修訂",
+ "Compare with another document": "與另一份文件比較",
+ "Choose another bento/type file. The redline shows what changed from that file to this document. Comparing never changes what you have open.": "選擇另一個 bento/type 檔案。比對會顯示從該檔案到這份文件發生了哪些修訂。比較永遠不會變更你開啟的文件。",
+ "Drop a Bento document here": "將 Bento 文件拖放到此處",
+ "Choose a file…": "選擇檔案…",
+ "Compare with a file…": "與檔案比較…",
}
diff --git a/type/src/live.ts b/type/src/live.ts
new file mode 100644
index 00000000..93563b56
--- /dev/null
+++ b/type/src/live.ts
@@ -0,0 +1,167 @@
+// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+//
+// LIVE CELLS — a number in the prose that is the number in the table.
+//
+// "Revenue grew to 1,240" and a table three paragraphs down saying 1,310 is the
+// oldest defect in business writing, and it is not a typo: the sentence was
+// right when it was typed. A live cell is a FIELD (fields.ts) whose value comes
+// from a sheet this document already embeds, so the sentence cannot drift from
+// the table because it is not a separate copy of the number.
+//
+// ────────────────────────────────────────────────────────────────────────────
+// ADDRESSING BY LABEL, NOT BY CELL
+//
+// The obvious spelling is `{{sheet:B4}}`, and it is the wrong one. A row
+// inserted above B4 silently re-points the sentence at a different number —
+// which is the EXACT failure this feature exists to prevent, reintroduced with
+// a nicer syntax. Worse, it fails silently and plausibly: the sentence still
+// reads as a sentence.
+//
+// So a live cell is addressed the way a person reads a table: by the row's
+// label and the column's heading.
+//
+// {{Q3!Revenue}} row "Q3", column "Revenue"
+// {{Budget!Q3!Revenue}} ...in the sheet named "Budget"
+//
+// Insert a row, sort the sheet, add a column — the address still means what it
+// meant. It breaks only when the label or heading it names is actually gone,
+// which is a real change that SHOULD break, and which surfaces as fields.ts's
+// unbound chip rather than as a wrong number.
+//
+// The row label is the first column's value, which is already this suite's
+// convention: merge.ts, and dash's own table→chart bridge, both read column one
+// as labels.
+//
+// `!` is the separator because `:` cannot be one — fields.ts's TOKEN grammar
+// spends `:` on zero-padding (`{{page:2}}`) and excludes it from names, so
+// `{{sheet:B4}}` does not parse as a field at all. `!` is also what a
+// spreadsheet user already reads as "sheet over there".
+//
+// ────────────────────────────────────────────────────────────────────────────
+// WHAT "LIVE" HONESTLY MEANS
+//
+// It re-resolves from the COPY of the sheet inside this file, not from a
+// spreadsheet on anybody's disk. That is not a shortcut, it is the format: a
+// Bento document is one self-contained file, an `embed` block carries the whole
+// source document with it (embed.ts), and a file that phoned home for a number
+// would stop being a document you can email.
+//
+// The consequence is worth stating plainly wherever this is offered, because
+// the wrong belief is the plausible one: the sentence tracks the table IN THIS
+// FILE, and updates when the embed is refreshed.
+//
+// NOT YET SAID ANYWHERE IN THE UI. This module is the resolution layer; a field
+// typed as `{{Q3!Revenue}}` works today through fields.ts's ordinary token
+// binding, but nothing yet OFFERS live cells or explains that limit. A picker
+// that lists the embedded sheets' rows and columns — and carries that sentence
+// — is the missing half, and it is deliberately not faked here with a comment
+// claiming a function that does not exist.
+//
+// NOT FORMATTED, deliberately, and for merge.ts's stated reason: the value is
+// what the cell holds, never dash's display format. Carrying that formatter
+// here would be a second implementation of someone else's rules, wrong the
+// first time they change one. A document that needs "$1,200" rather than "1200"
+// formats it in the sheet, where the format lives.
+
+import { sourceOfDoc, cellText, type MergeSheet } from './merge.ts';
+import { fieldKey, registerCells } from './fields.ts';
+import type { Block, TypeDoc } from './model.ts';
+
+/** The separator. See this file's header for why it is not `:`. */
+export const SEP = '!';
+
+export interface CellAddress { sheet: string | null; row: string; column: string }
+
+/**
+ * Parse a field name as a cell address, or null if it is not one.
+ *
+ * Two parts mean (row, column) and rely on the document embedding exactly one
+ * sheet; three name the sheet as well. Anything else is not an address — and
+ * returning null rather than guessing matters, because a plain `{{Name}}` must
+ * keep reaching the merge row.
+ */
+export function parseAddress(name: string): CellAddress | null {
+ if (!name.includes(SEP)) return null;
+ const parts = name.split(SEP).map(p => p.trim());
+ if (parts.some(p => p === '')) return null;
+ if (parts.length === 2) return { sheet: null, row: parts[0], column: parts[1] };
+ if (parts.length === 3) return { sheet: parts[0], row: parts[1], column: parts[2] };
+ return null;
+}
+
+/** Every dash sheet this document embeds, in document order. */
+export function embeddedSheets(doc: TypeDoc): MergeSheet[] {
+ const out: MergeSheet[] = [];
+ for (const b of (doc.body ?? []) as Block[]) {
+ if (b.kind !== 'embed') continue;
+ const e = (b as { embed?: { app?: string; doc?: unknown } }).embed;
+ if (!e || e.app !== 'bento/dash') continue;
+ const src = sourceOfDoc(e.doc);
+ if (src) out.push(...src.sheets);
+ }
+ return out;
+}
+
+/**
+ * The value at an address, or null when nothing supplies it.
+ *
+ * null covers every miss — no such sheet, no such row, no such column, an
+ * ambiguous unqualified address — on purpose: fields.ts renders a null as the
+ * unbound chip, and one honest "this does not resolve" beats four ways of being
+ * subtly wrong. `why` is for the UI to explain WHICH miss, without inventing a
+ * second unbound convention.
+ */
+export function resolveCell(addr: CellAddress, sheets: readonly MergeSheet[]):
+ { value: string | null; why: string | null } {
+ if (!sheets.length) return { value: null, why: 'no-sheet' };
+
+ let scope = sheets;
+ if (addr.sheet !== null) {
+ const k = fieldKey(addr.sheet);
+ scope = sheets.filter(s => fieldKey(s.name) === k);
+ if (!scope.length) return { value: null, why: 'no-sheet' };
+ } else if (sheets.length > 1) {
+ // An unqualified address with several sheets present is AMBIGUOUS, and
+ // silently taking the first would be the same class of bug as a raw cell
+ // reference: right until somebody embeds a second sheet, then quietly wrong.
+ const hits = sheets.filter(s => findRow(s, addr) !== null);
+ if (hits.length > 1) return { value: null, why: 'ambiguous' };
+ if (!hits.length) return { value: null, why: 'no-row' };
+ scope = hits;
+ }
+
+ for (const s of scope) {
+ const row = findRow(s, addr);
+ if (row === null) continue;
+ const ck = fieldKey(addr.column);
+ if (!s.columns.some(c => fieldKey(c) === ck)) return { value: null, why: 'no-column' };
+ const raw = row[ck];
+ return { value: raw === undefined ? null : cellText(raw), why: raw === undefined ? 'no-column' : null };
+ }
+ return { value: null, why: 'no-row' };
+}
+
+/** The row whose FIRST column matches the address's label. */
+function findRow(s: MergeSheet, addr: CellAddress): Record<string, string> | null {
+ if (!s.columns.length) return null;
+ const first = fieldKey(s.columns[0]);
+ const want = fieldKey(addr.row);
+ for (const r of s.rows) if (fieldKey(r[first] ?? '') === want) return r;
+ return null;
+}
+
+/** The `cell` resolver fields.ts asks for. */
+export function cellResolver(doc: TypeDoc): (name: string) => string | null {
+ let sheets: MergeSheet[] | null = null; // read once per resolution pass
+ return (name: string): string | null => {
+ const addr = parseAddress(name);
+ if (!addr) return null;
+ if (sheets === null) sheets = embeddedSheets(doc);
+ return resolveCell(addr, sheets).value;
+ };
+}
+
+// Mounted by registry.ts. See fields.ts registerCells for why this is a
+// registration and not an import.
+registerCells(cellResolver);
diff --git a/type/src/merge.ts b/type/src/merge.ts
new file mode 100644
index 00000000..d326311b
--- /dev/null
+++ b/type/src/merge.ts
@@ -0,0 +1,592 @@
+// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+//
+// MAIL MERGE — one document, a spreadsheet, and N finished documents.
+//
+// Bind this document's fields (fields.ts) to the columns of a `bento/dash`
+// sheet and emit ONE COMPLETE `.bento.html` PER ROW: 200 rows in, 200
+// self-contained files out, each exactly the kind of file that produced it,
+// entirely offline, with no service and no account. That is the feature, and
+// the reason it can exist at all is that a Bento document already carries its
+// own viewer — a merged letter is not a PDF of a letter, it is a letter that
+// opens, edits, prints and signs like the template did.
+//
+// ────────────────────────────────────────────────────────────────────────────
+// WHAT A MERGED FILE CARRIES, AND WHAT IT MUST NOT
+//
+// docId FRESH, per output. `docId` is IDENTITY (PLATFORM §3): autosave
+// keys recovery by it, the version timeline is keyed by it, and
+// collaboration rooms are minted against it. Two hundred letters
+// sharing the template's docId would be two hundred files that
+// autosave believes are the same document — open the second one
+// and it offers to restore the first one's text over it. So the
+// one field the format says never to regenerate is MINTED here,
+// because these are new documents rather than copies of one.
+//
+// collab GONE. `docForExport` strips it by REMOVING the field, so a
+// private key added to the credentials later is covered without
+// anyone remembering this line. The template's room key and
+// owner key are a live write capability on the author's own
+// document; shipping them to every recipient hands each of them
+// edit access to the master, unrevocably.
+//
+// signatures DROPPED. A signature covers a canonical form of the document
+// that signed it. Change one word of a letter and the signature
+// over the template covers nothing it claims to — carrying it
+// forward would put a broken seal, or worse a convincing one, on
+// every output.
+//
+// comments DROPPED. Drafting notes on the template ("check this figure
+// revisions with legal") are not for two hundred recipients, and neither is
+// the revision history — `Revision.body` is a WHOLE COPY of the
+// document as it was, so carrying it forward both multiplies the
+// output by every draft and mails every recipient the earlier
+// wording of the clauses they are being sent. It is the same
+// disclosure a .docx makes when nobody remembers to inspect it.
+//
+// merge ADDED: `{ source, columns, row }`. This is the reason the
+// output is still a document. The row's VALUES live here and the
+// body still holds FIELDS, so the letter renders resolved,
+// re-renders resolved after an edit, and can say where its data
+// came from. Baking the values into the text would have been
+// fewer bytes and would have thrown the whole invariant away.
+//
+// ────────────────────────────────────────────────────────────────────────────
+// TWENTY THOUSAND ROWS
+//
+// Each output is a whole app shell (~600 KB), so 200 rows is ~120 MB of
+// writing and 20,000 rows is twelve gigabytes. Three consequences, all of them
+// visible in the code below:
+//
+// · ONE FILE IS HELD AT A TIME. The loop serializes, writes, and drops the
+// string. Nothing accumulates an array of outputs, which is what would turn
+// a large run into a tab crash instead of a long wait.
+// · IT YIELDS, AND IT CAN BE STOPPED. A `for` loop over 20,000 serializations
+// freezes the tab with no progress and no way out. Every row awaits a
+// macrotask so the browser paints, the dialog counts up, and Stop is a
+// button rather than the reload key.
+// · PAST `MERGE_WARN` IT REQUIRES A FOLDER. Below it, a browser without the
+// File System Access API can download the outputs one by one; above it,
+// that is thousands of download prompts and the run is refused with the
+// reason rather than started and abandoned halfway. Nothing is capped —
+// dash's rule (docs/DECISIONS.md 2026-08-02): say what will break, never
+// refuse a workable file.
+
+import { t } from './i18n.ts';
+import { registerMenuItem, type FeatureContext } from './features.ts';
+import { docForExport, newDocId, spliceText, type TypeDoc } from './model.ts';
+// Importing fields.ts here is also what MOUNTS it: registry.ts switches this
+// feature on with one line, and the field engine comes with the merge that
+// needs it.
+import { bindTokens, fieldKey, isBuiltin, safeFieldName } from './fields.ts';
+import { readArtifact } from './embed.ts';
+import { downloadFile, serializeAuto } from '../../kernel/src/save.ts';
+
+/** Rows past which a run needs a real folder to write into. */
+export const MERGE_WARN = 200;
+
+// ────────────────────────────────────────────────────────── reading the sheet
+
+export interface MergeSheet {
+ id: string;
+ name: string;
+ columns: string[];
+ /** one entry per row, keyed by `fieldKey(column)` */
+ rows: Array<Record<string, string>>;
+ /** columns that could not be read, with why — reported, never hidden */
+ skipped: string[];
+}
+
+export interface MergeSource {
+ title: string;
+ sheets: MergeSheet[];
+}
+
+/**
+ * A cell value as merge text.
+ *
+ * The UNDERLYING value, deliberately, not dash's display format. Applying a
+ * column's `format` pattern would mean carrying dash's formatter into this app
+ * — a second implementation of somebody else's rules, wrong the first time they
+ * change one. A merge writes what the cell holds; a document that needs "$1,200"
+ * rather than "1200" formats it in the sheet, in a text column, where the
+ * author can see what they will get.
+ */
+export const cellText = (v: unknown): string => {
+ if (v === null || v === undefined) return '';
+ if (typeof v === 'string') return v;
+ if (typeof v === 'number') return Number.isFinite(v) ? String(v) : '';
+ if (typeof v === 'boolean') return v ? 'true' : 'false';
+ return '';
+};
+
+/** Decode one `ColumnData` (dash's model.ts) into positional values. */
+function columnValues(enc: unknown, n: number): unknown[] | null {
+ if (!enc || typeof enc !== 'object') return null;
+ const d = enc as Record<string, unknown>;
+ if (d.enc === 'raw' && Array.isArray(d.v)) return d.v.slice(0, n);
+ if (d.enc === 'dict' && Array.isArray(d.dict) && Array.isArray(d.idx)) {
+ const dict = d.dict as unknown[];
+ return (d.idx as Array<number | null>).slice(0, n)
+ .map(i => (i === null || i === undefined ? null : dict[i] ?? null));
+ }
+ // 'pack' is dash's explicit ARCHIVE encoding for a frozen column — never the
+ // default and never chosen on the author's behalf. Decoding it here would be
+ // a second copy of a codec this app has no other reason to know, so the
+ // column is reported as unreadable and the author is told which one.
+ return null;
+}
+
+/** Expand dash's run-length row-id list into one id per row. */
+function ridList(rids: unknown): number[] {
+ if (!Array.isArray(rids)) return [];
+ const out: number[] = [];
+ for (const run of rids) {
+ if (!Array.isArray(run) || run.length < 2) continue;
+ const [start, count] = run as [number, number];
+ if (!Number.isFinite(start) || !Number.isFinite(count) || count < 0) continue;
+ for (let i = 0; i < count; i++) out.push(start + i);
+ }
+ return out;
+}
+
+/** "B7" → { col: 1, row: 6 }; anything else → null. */
+function a1(ref: string): { col: number; row: number } | null {
+ const m = /^([A-Z]+)(\d+)$/.exec(ref.trim().toUpperCase());
+ if (!m) return null;
+ let col = 0;
+ for (const ch of m[1]) col = col * 26 + (ch.charCodeAt(0) - 64);
+ return { col: col - 1, row: Number(m[2]) - 1 };
+}
+
+/**
+ * A table sheet: columns are columns, and the header is the column NAME rather
+ * than the first row of data.
+ */
+function readTableSheet(s: Record<string, unknown>): MergeSheet {
+ const rids = ridList(s.rids);
+ const n = rids.length;
+ const cols = Array.isArray(s.columns) ? (s.columns as Array<Record<string, unknown>>) : [];
+ const data = (s.data && typeof s.data === 'object') ? s.data as Record<string, unknown> : {};
+ const overrides = (s.cells && typeof s.cells === 'object') ? s.cells as Record<string, { v?: unknown }> : {};
+
+ const columns: string[] = [];
+ const skipped: string[] = [];
+ const rows: Array<Record<string, string>> = Array.from({ length: n }, () => ({}));
+
+ for (const c of cols) {
+ const id = typeof c.id === 'string' ? c.id : '';
+ const name = safeFieldName(typeof c.name === 'string' ? c.name : id);
+ if (!id || !name) { if (id) skipped.push(id); continue; }
+ const vals = columnValues(data[id], n);
+ if (!vals) { skipped.push(name); continue; }
+ columns.push(name);
+ const key = fieldKey(name);
+ for (let i = 0; i < n; i++) {
+ // A hand correction is what the author MEANT — an override beats the
+ // imported column, exactly as it does in the grid. Skipping this would
+ // mail out the number somebody had already fixed on screen.
+ const ov = overrides[`${id}:${rids[i]}`];
+ rows[i][key] = cellText(ov && 'v' in ov ? ov.v : vals[i]);
+ }
+ }
+ return { id: String(s.id ?? ''), name: String(s.name ?? ''), columns, rows, skipped };
+}
+
+/**
+ * A canvas sheet: the sparse A1 grid an invoice or a scratch pad is written on.
+ *
+ * ROW 1 IS THE HEADER. That is a convention rather than a fact in the file —
+ * a canvas sheet has no column names — so it is stated here, stated in the
+ * dialog, and a sheet whose first row is empty simply yields no columns rather
+ * than inventing "A", "B", "C" and merging gibberish into somebody's letters.
+ */
+function readCanvasSheet(s: Record<string, unknown>): MergeSheet {
+ const cells = (s.cells && typeof s.cells === 'object') ? s.cells as Record<string, { v?: unknown; f?: unknown }> : {};
+ const grid = new Map<string, string>();
+ let maxRow = 0;
+ for (const [ref, cell] of Object.entries(cells)) {
+ const p = a1(ref);
+ if (!p) continue;
+ grid.set(`${p.col}:${p.row}`, cellText(cell?.v));
+ if (p.row > maxRow) maxRow = p.row;
+ }
+ const columns: string[] = [];
+ const colAt: number[] = [];
+ for (let c = 0; c < 512; c++) {
+ const head = safeFieldName(grid.get(`${c}:0`) ?? '');
+ if (head) { columns.push(head); colAt.push(c); }
+ }
+ const rows: Array<Record<string, string>> = [];
+ for (let r = 1; r <= maxRow; r++) {
+ const row: Record<string, string> = {};
+ let any = false;
+ columns.forEach((name, i) => {
+ const v = grid.get(`${colAt[i]}:${r}`) ?? '';
+ row[fieldKey(name)] = v;
+ if (v) any = true;
+ });
+ // A wholly empty row is spacing, not a recipient. Merging it would produce
+ // a letter addressed to nobody, and on a 200-row sheet nobody would notice
+ // which one it was.
+ if (any) rows.push(row);
+ }
+ return { id: String(s.id ?? ''), name: String(s.name ?? ''), columns, rows, skipped: [] };
+}
+
+/**
+ * Pull the mergeable sheets out of a Bento file.
+ *
+ * Reads through `embed.ts readArtifact`, which extracts `#bento-doc` by pattern
+ * — sound ONLY because the splice contract (PLATFORM §2) guarantees that block
+ * is plaintext JSON at a known id in every Bento file ever written. Nothing of
+ * the source document is kept beyond the rows: the parsed doc goes out of scope
+ * at the end of this function, credentials and all.
+ */
+export function readMergeSource(html: string): MergeSource | null {
+ const art = readArtifact(html);
+ if (!art) return null;
+ return sourceOfDoc(art.doc);
+}
+
+/**
+ * The same read, from a document we ALREADY hold.
+ *
+ * `readMergeSource` starts from a file the user just picked; `live.ts` starts
+ * from the copy an `embed` block is already carrying, which never goes back
+ * through HTML. Splitting it here rather than re-deriving the sheet shape over
+ * there keeps ONE decoder for dash's column encodings — the `pack` case below
+ * is exactly the kind of thing that would get fixed in one copy and not the
+ * other.
+ */
+export function sourceOfDoc(parsed: unknown): MergeSource | null {
+ const doc = parsed as Record<string, unknown> | undefined;
+ if (!doc || doc.format !== 'bento/dash' || !Array.isArray(doc.sheets)) return null;
+ const sheets: MergeSheet[] = [];
+ for (const raw of doc.sheets as Array<Record<string, unknown>>) {
+ if (!raw || typeof raw !== 'object') continue;
+ const s = raw.kind === 'canvas' ? readCanvasSheet(raw)
+ : raw.kind === 'table' ? readTableSheet(raw)
+ // A pivot sheet is a derived view; merging one is meaningful but its rows
+ // live behind dash's own evaluation, so it is left out rather than read
+ // half-right.
+ : null;
+ if (s && s.columns.length) sheets.push(s);
+ }
+ return { title: typeof doc.title === 'string' ? doc.title : '', sheets };
+}
+
+// ─────────────────────────────────────────────────────────── making a document
+
+/**
+ * The template, merged against one row.
+ *
+ * See this file's header for what is minted, what is stripped and why. The
+ * clone is deep and taken from `docForExport`, so the credentials are gone
+ * before anything else is decided about the output.
+ */
+export function mergeDoc(template: TypeDoc, row: Record<string, string>,
+ columns: string[], source: string): TypeDoc {
+ const out = JSON.parse(JSON.stringify(docForExport(template))) as TypeDoc;
+ out.docId = newDocId();
+ out.signatures = [];
+ out.revisions = [];
+ delete out.comments;
+ delete out.template;
+ delete out.modified;
+ out.merge = { source, columns: [...columns], row: { ...row } };
+ // The TITLE is a plain string, not a block, so its `{{tokens}}` are resolved
+ // by substitution rather than by an atom — there are no marks or anchors over
+ // it to keep in step. This is what makes per-recipient file names possible.
+ out.title = fillTokens(template.title ?? '', row);
+ return out;
+}
+
+/**
+ * Substitute `{{tokens}}` in a plain string (a title, a file-name pattern).
+ *
+ * `{{#}}` is the 1-based row number, which a file-name pattern needs and a
+ * document body does not: two recipients may share a name and their files must
+ * not share a path.
+ */
+export function fillTokens(s: string, row: Record<string, string>, n?: number): string {
+ return s.replace(/\{\{\s*([^{}]{1,64}?)\s*\}\}/g, (_m, name: string) => {
+ if (name === '#') return n === undefined ? '' : String(n);
+ const v = row[fieldKey(name)];
+ return v === undefined ? '' : v;
+ });
+}
+
+/** A file name that a file system will actually accept. */
+export function safeName(raw: string, fallback: string): string {
+ const n = raw.replace(/[\\/:*?"<>|]/g, ' ')
+ .replace(/[\u0000-\u001f\u007f]/g, '')
+ .replace(/\s+/g, ' ')
+ .replace(/^[.\s]+|[.\s]+$/g, '')
+ .slice(0, 90);
+ return (n || fallback) + '.bento.html';
+}
+
+
+// ────────────────────────────────────────────────────────────────── running it
+
+interface DirHandle { getFileHandle(name: string, o: { create: boolean }): Promise<FsFile> }
+interface FsFile { createWritable(): Promise<{ write(b: Blob): Promise<void>; close(): Promise<void> }> }
+
+const canPickDirectory = (): boolean =>
+ typeof (globalThis as { showDirectoryPicker?: unknown }).showDirectoryPicker === 'function';
+
+/** Let the browser paint. See this file's header: a merge is a long job. */
+const yieldToUi = () => new Promise<void>(r => setTimeout(r, 0));
+
+export interface MergeRun {
+ template: TypeDoc;
+ sheet: MergeSheet;
+ source: string;
+ pattern: string;
+ dir: DirHandle | null;
+ onProgress(done: number, total: number, name: string): void;
+ stopped(): boolean;
+}
+
+/** Emit one file per row. Returns how many were written. */
+export async function runMerge(run: MergeRun): Promise<number> {
+ let done = 0;
+ for (let i = 0; i < run.sheet.rows.length; i++) {
+ if (run.stopped()) break;
+ const row = run.sheet.rows[i];
+ const doc = mergeDoc(run.template, row, run.sheet.columns, run.source);
+ const name = safeName(fillTokens(run.pattern, row, i + 1), `merge-${i + 1}`);
+ // serializeAuto, not serializeFile: it is the encryption-aware path, so a
+ // password-protected template produces password-protected outputs rather
+ // than two hundred plaintext copies of a document somebody encrypted.
+ const html = await serializeAuto(doc);
+ if (run.dir) {
+ const fh = await run.dir.getFileHandle(name, { create: true });
+ const w = await fh.createWritable();
+ await w.write(new Blob([html], { type: 'text/html' }));
+ await w.close();
+ } else {
+ downloadFile(html, name);
+ }
+ done++;
+ run.onProgress(done, run.sheet.rows.length, name);
+ await yieldToUi();
+ }
+ return done;
+}
+
+// ─────────────────────────────────────────────────────────────────────── UI
+
+async function pickFile(): Promise<File | null> {
+ return new Promise(resolve => {
+ const input = document.createElement('input');
+ input.type = 'file';
+ input.accept = '.html,text/html';
+ input.addEventListener('change', () => resolve(input.files?.[0] ?? null), { once: true });
+ input.click();
+ });
+}
+
+function overlay(): { back: HTMLElement; box: HTMLElement; close: () => void } {
+ const back = document.createElement('div');
+ back.className = 't-overlay';
+ const box = document.createElement('div');
+ box.className = 't-dlg t-merge';
+ back.appendChild(box);
+ const onKey = (e: KeyboardEvent) => { if (e.key === 'Escape') { e.preventDefault(); close(); } };
+ function close() { window.removeEventListener('keydown', onKey, true); back.remove(); }
+ window.addEventListener('keydown', onKey, true);
+ back.addEventListener('mousedown', e => { if (e.target === back) close(); });
+ document.body.appendChild(back);
+ return { back, box, close };
+}
+
+export async function openMerge(ctx: FeatureContext): Promise<void> {
+ const file = await pickFile();
+ if (!file) return;
+ const src = readMergeSource(await file.text());
+ if (!src || !src.sheets.length) {
+ ctx.toast(t('That file has no sheet with named columns to merge from.'));
+ return;
+ }
+
+ const { box, close } = overlay();
+ let sheet = src.sheets[0];
+
+ const render = () => {
+ box.replaceChildren();
+ const h = document.createElement('h3');
+ h.textContent = t('Mail merge');
+ box.appendChild(h);
+
+ // --- which sheet
+ if (src.sheets.length > 1) {
+ const row = document.createElement('div');
+ row.className = 't-row';
+ const lab = document.createElement('span');
+ lab.textContent = t('Sheet');
+ const sel = document.createElement('select');
+ src.sheets.forEach((s, i) => {
+ const o = document.createElement('option');
+ o.value = String(i);
+ o.textContent = `${s.name || t('Untitled')} — ${s.rows.length}`;
+ sel.appendChild(o);
+ });
+ sel.value = String(src.sheets.indexOf(sheet));
+ sel.addEventListener('change', () => { sheet = src.sheets[Number(sel.value)]; render(); });
+ row.append(lab, sel);
+ box.appendChild(row);
+ }
+
+ const summary = document.createElement('p');
+ summary.className = 't-merge-note';
+ summary.textContent = t('{rows} row(s), {cols} column(s)')
+ .replace('{rows}', String(sheet.rows.length))
+ .replace('{cols}', String(sheet.columns.length));
+ box.appendChild(summary);
+
+ // --- the columns, and the collisions
+ const cols = document.createElement('div');
+ cols.className = 't-merge-cols';
+ for (const c of sheet.columns) {
+ const chip = document.createElement('code');
+ chip.textContent = `{{${c}}}`;
+ // A column named "date" TAKES OVER {{date}} for this document — say so
+ // HERE, at bind time, where renaming the column is still cheap, rather
+ // than leaving it to be noticed on the running head of page one.
+ if (isBuiltin(c)) {
+ chip.className = 't-merge-clash';
+ chip.title = t('“{name}” is also a document property — this column takes over that field')
+ .replace('{name}', c);
+ }
+ cols.appendChild(chip);
+ }
+ box.appendChild(cols);
+
+ if (sheet.skipped.length) {
+ const warn = document.createElement('p');
+ warn.className = 't-merge-warn';
+ warn.textContent = t('Could not read: {cols}').replace('{cols}', sheet.skipped.join(', '));
+ box.appendChild(warn);
+ }
+
+ // --- file naming
+ const nameRow = document.createElement('div');
+ nameRow.className = 't-row';
+ const nameLab = document.createElement('span');
+ nameLab.textContent = t('File names');
+ const pattern = document.createElement('input');
+ pattern.type = 'text';
+ pattern.className = 't-input t-merge-pattern';
+ pattern.value = `${ctx.store.doc.title || 'Document'} {{#}}`;
+ nameRow.append(nameLab, pattern);
+ box.appendChild(nameRow);
+
+ const hint = document.createElement('p');
+ hint.className = 't-merge-note';
+ hint.textContent = t('Use {{#}} for the row number, or a column name in braces.');
+ box.appendChild(hint);
+
+ // --- how it will be written
+ const big = sheet.rows.length > MERGE_WARN;
+ const note = document.createElement('p');
+ note.className = big && !canPickDirectory() ? 't-merge-warn' : 't-merge-note';
+ note.textContent = canPickDirectory()
+ ? t('Each row becomes one complete file in a folder you choose.')
+ : big
+ ? t('This browser can only download files one at a time, which is not workable past {n} rows. Open this document in Chrome or Edge to merge it.')
+ .replace('{n}', String(MERGE_WARN))
+ : t('This browser will download each file separately — expect one prompt per row.');
+ box.appendChild(note);
+
+ const foot = document.createElement('div');
+ foot.className = 't-dlg-foot';
+ const cancel = document.createElement('button');
+ cancel.type = 'button';
+ cancel.className = 't-btn';
+ cancel.textContent = t('Cancel');
+ cancel.addEventListener('click', close);
+ const go = document.createElement('button');
+ go.type = 'button';
+ go.className = 't-btn t-btn-primary';
+ go.textContent = t('Merge {n} document(s)').replace('{n}', String(sheet.rows.length));
+ go.disabled = !sheet.rows.length || (big && !canPickDirectory());
+ go.addEventListener('click', () => { void start(pattern.value); });
+ foot.append(cancel, go);
+ box.appendChild(foot);
+ };
+
+ async function start(pattern: string) {
+ let dir: DirHandle | null = null;
+ if (canPickDirectory()) {
+ try {
+ dir = await (globalThis as unknown as { showDirectoryPicker(o: unknown): Promise<DirHandle> })
+ .showDirectoryPicker({ id: 'bento-merge', mode: 'readwrite' });
+ } catch { return; } // the picker was dismissed
+ }
+
+ // Fields first: an author who typed {{Name}} and never opened the Insert
+ // menu still gets a merge that works, and the conversion is one undoable
+ // step in their history rather than a hidden rewrite at emit time.
+ ctx.store.breakRun();
+ ctx.store.commit(d => { bindTokens(d, spliceText); });
+ ctx.editor.render();
+ ctx.refresh();
+
+ box.replaceChildren();
+ const h = document.createElement('h3');
+ h.textContent = t('Mail merge');
+ const bar = document.createElement('div');
+ bar.className = 't-merge-bar';
+ const fill = document.createElement('div');
+ bar.appendChild(fill);
+ const line = document.createElement('p');
+ line.className = 't-merge-note';
+ const foot = document.createElement('div');
+ foot.className = 't-dlg-foot';
+ const stop = document.createElement('button');
+ stop.type = 'button';
+ stop.className = 't-btn';
+ stop.textContent = t('Stop');
+ let stopped = false;
+ stop.addEventListener('click', () => { stopped = true; stop.disabled = true; });
+ foot.appendChild(stop);
+ box.append(h, bar, line, foot);
+
+ const total = sheet.rows.length;
+ let written = 0;
+ try {
+ written = await runMerge({
+ template: ctx.store.doc,
+ sheet,
+ source: `${src!.title || file!.name}${sheet.name ? ` — ${sheet.name}` : ''}`,
+ pattern,
+ dir,
+ stopped: () => stopped,
+ onProgress: (done, all, name) => {
+ fill.style.width = `${Math.round((done / Math.max(1, all)) * 100)}%`;
+ line.textContent = `${done} / ${all} — ${name}`;
+ },
+ });
+ } catch (err) {
+ close();
+ ctx.toast(t('Merge failed: {why}').replace('{why}', String((err as Error)?.message ?? err)));
+ return;
+ }
+ close();
+ ctx.toast(stopped
+ ? t('Stopped after {n} of {all} document(s)')
+ .replace('{n}', String(written)).replace('{all}', String(total))
+ : t('Merged {n} document(s)').replace('{n}', String(written)));
+ }
+
+ render();
+}
+
+registerMenuItem({
+ id: 'mail-merge',
+ label: () => t('Mail merge from a sheet…'),
+ order: 62,
+ run: ctx => { void openMerge(ctx); },
+});
diff --git a/type/src/micro.ts b/type/src/micro.ts
new file mode 100644
index 00000000..15361fce
--- /dev/null
+++ b/type/src/micro.ts
@@ -0,0 +1,654 @@
+// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+//
+// Microtypography — optical margin alignment.
+//
+// WHAT IT IS. A margin is straight when the INK lines up, not when the advance
+// boxes do. A line ending in a full stop has its last box flush with the
+// margin, but the period's ink stops well short of the box's right edge, so the
+// eye reads a notch. The same happens at the left margin under an opening
+// quote, whose ink sits high and right inside a box that is flush. Every book
+// you have read fixes this by letting the punctuation hang into the margin.
+// This module does that, and it is the difference between text that reads as a
+// page and text that reads as a web page.
+//
+// ─────────────────────────────────────── the constraint that shapes everything
+//
+// IT MUST NOT CHANGE WHERE LINES BREAK. Not "should rarely" — must not. Line
+// breaking is the browser's, pagination is MEASURED off the line boxes it
+// produces (paginate.ts), and every saved file carries a page count that is a
+// promise already made to whoever printed it. A microtypographic change that
+// reflowed a paragraph would move a page break, and the promise with it.
+//
+// That rules out the way TeX does this. TeX's protrusion feeds the character's
+// overhang back into the badness computation, so lines legitimately break
+// differently — that is the whole point there, and it is disqualifying here.
+//
+// So the offset is applied in RENDERING SPACE and nowhere else: the protruding
+// character is wrapped in a `<span class="t-hang">` that is `position:
+// relative` with a `left` offset. CSS 2.1 §9.4.3 is explicit that a relatively
+// positioned box is painted offset and that the offset "does not affect the
+// layout of any other box" — the guarantee is in the spec, not in a hope.
+//
+// The one residual hazard is the WRAPPER, not the offset: browsers break text
+// shaping runs at element boundaries, so wrapping the final character of a line
+// can lose a kern pair worth a fraction of a pixel, and a fraction of a pixel
+// is in principle enough to flip a break. That is why this module VERIFIES
+// rather than assumes — see `applyOptical`. If a block's line boundaries moved,
+// that block is unwrapped and left exactly as it was. A paragraph that cannot
+// be improved safely is not improved.
+//
+// ────────────────────────────────────────────────── how far a character hangs
+//
+// Exactly to ink flush, and no further. The objective is stated as a number —
+// minimise the deviation of each line's INK edge from the margin — and once it
+// is stated, the optimum is not a matter of taste: shift the character out by
+// its side bearing, so its ink lands on the margin. Hanging further (the
+// classic "half the quote in the margin" look) makes the stated measurement
+// WORSE, and there is no honest way to both claim the measurement and overshoot
+// it. The bearings are measured from the real font at the real size through a
+// canvas, not taken from a table of guesses, so a document that changes its
+// typeface gets that typeface's answer.
+//
+// ────────────────────────────────────────────────────────── what it does NOT do
+//
+// · AUTOMATIC HYPHENS DO NOT HANG. `hyphens: auto` draws a hyphen that has no
+// character behind it — there is no text node to wrap, and nothing to
+// attach an offset to. An explicit hyphen the author typed does hang.
+// Fixing the automatic one means putting soft hyphens into the text, which
+// is exactly what the spike rejected (every rendered address would drift
+// from every model address; see editor.ts's header).
+// · RIGHT-TO-LEFT text is skipped. The bearings arithmetic below assumes the
+// line's start is its left edge.
+// · TABLE CELLS and formulas are skipped: a cell's edge is a padding box, not
+// a margin, and a formula never justifies (styles.css says so).
+//
+// ────────────────────────────────────────────────────────────────── the switch
+//
+// `doc.optical === false` turns it off, and that is a DOCUMENT property rather
+// than a viewer preference for the same reason the typeface is one: it is how
+// the author's page is set. Absent means ON, including in every file written
+// before this existed — which is a deliberate exception to "old files render
+// exactly as they did", taken because the thing old files actually promise is
+// their PAGINATION, and that is bit-identical here by construction and by the
+// verification pass. The rendering is strictly better by the measurement above.
+
+/** Which end of a line a character sits at. */
+export type Edge = 'start' | 'end';
+
+/**
+ * Punctuation allowed to hang at the RIGHT margin.
+ *
+ * Closing marks and the low, light characters — the ones whose advance box is
+ * mostly empty on the right. A letter's right side bearing is a fifth of a
+ * period's and hanging it is margin kerning, a different (and later) feature.
+ */
+export const PROTRUDE_END: ReadonlySet<string> = new Set([
+ '.', ',', ';', ':', '!', '?', '·', '…',
+ '-', '‐', '‑', '–', '—', // hyphen, non-breaking, en, em
+ '"', "'", '’', '”', '»', '›', // quotes, closing
+ ')', ']', '}', '*',
+]);
+
+/**
+ * Punctuation allowed to hang at the LEFT margin.
+ *
+ * Opening marks. The classic case is a paragraph that starts with a quotation:
+ * without this its first line reads as indented, and with it the block's left
+ * edge is one straight line.
+ */
+export const PROTRUDE_START: ReadonlySet<string> = new Set([
+ '"', "'", '‘', '“', '«', '‹',
+ '(', '[', '{', '–', '—', '•', '·',
+]);
+
+export const protrudes = (ch: string, edge: Edge): boolean =>
+ (edge === 'end' ? PROTRUDE_END : PROTRUDE_START).has(ch);
+
+/** A glyph's advance and the horizontal extent of its ink within that advance. */
+export interface Bearings {
+ /** the advance width the layout engine gave it */
+ advance: number;
+ /** ink's left edge, measured from the advance box's left edge */
+ inkLeft: number;
+ /** ink's right edge, same origin */
+ inkRight: number;
+}
+
+/**
+ * How far to move the character, in px, positive to the RIGHT.
+ *
+ * End of line: out by the right side bearing, so the ink lands on the margin.
+ * Start of line: back by the left side bearing, for the same reason.
+ *
+ * Two clamps, and both have earned their place in other people's font code:
+ * a bearing may come back negative (ink that already overhangs its box, common
+ * in italic and script faces) and a bearing may come back absurd (a fallback
+ * face substituted for a missing glyph). Anything under a third of a pixel is
+ * dropped as beneath the point — it would cost a wrapper and buy nothing.
+ */
+export const MIN_SHIFT = 0.33;
+export const MAX_SHIFT_RATIO = 0.6;
+
+export function opticalShift(ch: string, edge: Edge, b: Bearings): number {
+ if (!protrudes(ch, edge)) return 0;
+ if (!(b.advance > 0) || !isFinite(b.inkLeft) || !isFinite(b.inkRight)) return 0;
+ const cap = b.advance * MAX_SHIFT_RATIO;
+ const raw = edge === 'end' ? b.advance - b.inkRight : -b.inkLeft;
+ const mag = Math.min(Math.abs(raw), cap);
+ if (mag < MIN_SHIFT) return 0;
+ return raw < 0 ? -mag : mag;
+}
+
+/**
+ * Did every line still end where it ended, and start where it started?
+ *
+ * BOTH HALVES, and the second one was learned the hard way. The first version
+ * of this check only asked whether the character that OPENED each line was
+ * still on that line — and it passed a real reflow, on a real document, in the
+ * measurement run that was supposed to prove the feature safe. Wrapping the
+ * comma of "…including time-sheets," cost the kern between "s" and "," , the
+ * word no longer fitted, and the break moved back to the hyphen in "time-".
+ * "receipts" — the character that opened line 1 — was STILL on line 1
+ * afterwards, because the word had moved down onto it. The line count was
+ * unchanged and every line top was unchanged too, so nothing else noticed
+ * either.
+ *
+ * So a break is held only when the line's LAST character and its FIRST
+ * character are both still on it. That is the definition of the break not
+ * having moved, and anything weaker is a check that passes the bug.
+ *
+ * Kept pure so the rig can exercise it without a layout engine.
+ */
+export const LINE_EPS = 0.5;
+
+export function boundariesHeld(
+ tops: readonly number[], after: readonly number[],
+ endLines: readonly number[], startLines: readonly number[],
+): boolean {
+ // NaN is "I could not read that rect", and it must FAIL. Written as positive
+ // tests rather than `!==`/`>` because every comparison against NaN is false,
+ // which is exactly how an unreadable line would silently pass.
+ if (tops.length !== after.length) return false;
+ for (let i = 0; i < tops.length; i++) if (!(Math.abs(tops[i] - after[i]) <= LINE_EPS)) return false;
+ if (endLines.length !== tops.length || startLines.length !== tops.length) return false;
+ for (let k = 0; k < tops.length; k++) {
+ if (!(endLines[k] === k) || !(startLines[k] === k)) return false;
+ }
+ return true;
+}
+
+// ───────────────────────────────────────────────────────────── font bearings
+
+const bearingCache = new Map<string, Bearings>();
+let measureCtx: CanvasRenderingContext2D | null | undefined;
+
+/** The CSS `font` shorthand for an element, rebuilt when the browser withholds it. */
+export function fontOf(el: Element): string {
+ const cs = styleOf(el);
+ if (cs.font) return cs.font;
+ return `${cs.fontStyle} ${cs.fontVariant} ${cs.fontWeight} ${cs.fontSize}/${cs.lineHeight} ${cs.fontFamily}`;
+}
+
+/**
+ * Ink bounds for one character in one font, from a canvas.
+ *
+ * `actualBoundingBoxLeft` is positive to the LEFT of the alignment point, which
+ * for the default `textAlign` is the advance box's left edge — so the ink's
+ * left coordinate is its negation, and getting that sign wrong moves every
+ * opening quote the wrong way.
+ */
+export function bearings(ch: string, font: string): Bearings | null {
+ const key = `${font}${ch}`;
+ const hit = bearingCache.get(key);
+ if (hit) return hit;
+ if (measureCtx === undefined) {
+ measureCtx = document.createElement('canvas').getContext('2d');
+ }
+ if (!measureCtx) return null;
+ measureCtx.font = font;
+ // A browser that refused the font string would measure in its own default and
+ // report bearings for the wrong face. Silence is the failure mode this
+ // module cannot have, so refuse instead.
+ if (!measureCtx.font) return null;
+ const m = measureCtx.measureText(ch);
+ const out: Bearings = {
+ advance: m.width,
+ inkLeft: -(m.actualBoundingBoxLeft ?? 0),
+ inkRight: m.actualBoundingBoxRight ?? m.width,
+ };
+ bearingCache.set(key, out);
+ return out;
+}
+
+// ──────────────────────────────────────────────────────────────── the DOM pass
+
+export interface MicroStats {
+ /** blocks examined this pass (a cached block is not examined) */
+ blocks: number;
+ /** characters given a hanging offset */
+ hung: number;
+ /** blocks unwrapped again because their line boundaries had moved */
+ reverted: number;
+ /** ms the pass took */
+ ms: number;
+}
+
+const HANG_CLASS = 't-hang';
+/** how close a line's edge must come to the block's content edge to count */
+const EDGE_TOL = 6;
+/** the layout signature that lets an untouched block be skipped entirely */
+const SIG = 'micro';
+
+/** Blocks whose edges are not margins, or whose text is not prose. */
+function skippable(el: HTMLElement): boolean {
+ if (el.dataset.kind === 'cell' || el.closest('.t-table, .t-math, .t-fnarea, pre, code')) return true;
+ const cs = styleOf(el);
+ if (cs.direction === 'rtl') return true;
+ if (cs.display === 'none' || cs.visibility === 'hidden') return true;
+ return false;
+}
+
+/**
+ * Rects merged into LINES.
+ *
+ * `Range.getClientRects()` does NOT return one rect per line — it returns one
+ * per rendered FRAGMENT, so a line carrying a bold run comes back as two or
+ * three, each ending mid-line. Read as lines that is silently wrong in the
+ * worst way: a fragment's right edge is nowhere near the margin, so the
+ * paragraphs with the most formatting are exactly the ones that quietly stop
+ * hanging. Grouped by vertical overlap rather than by an equal `top`, because a
+ * superscript footnote marker sits higher than the text it rides on and is
+ * still on that line.
+ */
+export interface Line { top: number; bottom: number; left: number; right: number }
+
+export function mergeLines(rects: readonly DOMRect[]): Line[] {
+ const src = rects.filter(r => r.height > 0.5 && r.width >= 0)
+ .slice().sort((a, b) => a.top - b.top || a.left - b.left);
+ const out: Line[] = [];
+ for (const r of src) {
+ const last = out[out.length - 1];
+ // overlap, not equality: a `sup` shares the line and not the baseline
+ if (last && r.top < last.bottom - 1) {
+ last.top = Math.min(last.top, r.top);
+ last.bottom = Math.max(last.bottom, r.bottom);
+ last.left = Math.min(last.left, r.left);
+ last.right = Math.max(last.right, r.right);
+ } else {
+ out.push({ top: r.top, bottom: r.bottom, left: r.left, right: r.right });
+ }
+ }
+ return out;
+}
+
+/**
+ * The y that separates line k from line k+1.
+ *
+ * Compared against a character's vertical CENTRE, which is what makes the
+ * answer the same for a superscript as for the text beside it.
+ */
+export const lineSplits = (lines: readonly Line[]): number[] =>
+ lines.slice(0, -1).map((l, i) => (l.bottom + lines[i + 1].top) / 2);
+
+/**
+ * The element's own document and view.
+ *
+ * NOT the module's `document`. print.ts runs this pass inside the print
+ * iframe's document, and a Range or an element made by the wrong document is
+ * either a WrongDocumentError or, worse, a silently adopted node.
+ */
+const docOf = (el: Node): Document => el.ownerDocument ?? (el as Document);
+const styleOf = (el: Element): CSSStyleDeclaration =>
+ (docOf(el).defaultView ?? window).getComputedStyle(el);
+
+/** Every text node under `el`, with the running character offset of each. */
+function textRuns(el: HTMLElement): Array<{ node: Text; at: number }> {
+ const out: Array<{ node: Text; at: number }> = [];
+ const w = docOf(el).createTreeWalker(el, NodeFilter.SHOW_TEXT);
+ let at = 0;
+ let n: Node | null;
+ while ((n = w.nextNode())) {
+ const len = (n.nodeValue ?? '').length;
+ if (len) { out.push({ node: n as Text, at }); at += len; }
+ }
+ return out;
+}
+
+/** (textNode, offset) for a character index across the whole block. */
+function locate(runs: Array<{ node: Text; at: number }>, i: number): { node: Text; off: number } | null {
+ for (let k = runs.length - 1; k >= 0; k--) {
+ if (i >= runs[k].at) {
+ const off = i - runs[k].at;
+ return off < runs[k].node.nodeValue!.length ? { node: runs[k].node, off } : null;
+ }
+ }
+ return null;
+}
+
+/** Take the wrappers back out, leaving the text byte-identical. */
+export function unhang(root: HTMLElement): void {
+ for (const span of Array.from(root.querySelectorAll<HTMLElement>(`span.${HANG_CLASS}`))) {
+ const parent = span.parentNode;
+ if (!parent) continue;
+ while (span.firstChild) parent.insertBefore(span.firstChild, span);
+ parent.removeChild(span);
+ }
+ root.normalize();
+}
+
+/**
+ * Optical margin alignment over a rendered flow.
+ *
+ * Runs after pagination has measured, because it cannot change what pagination
+ * measured — that is the invariant, and the pass proves it per block rather
+ * than asserting it. Blocks whose layout signature is unchanged since last time
+ * keep the wrappers they already have and are not touched at all, which is what
+ * keeps typing free: an edit re-examines one paragraph, not the document.
+ */
+export function applyOptical(host: HTMLElement, enabled: boolean): MicroStats {
+ const t0 = performance.now();
+ const stats: MicroStats = { blocks: 0, hung: 0, reverted: 0, ms: 0 };
+ if (!enabled) {
+ unhang(host);
+ for (const el of Array.from(host.querySelectorAll<HTMLElement>('[data-id]'))) delete el.dataset[SIG];
+ stats.ms = performance.now() - t0;
+ return stats;
+ }
+
+ for (const el of Array.from(host.querySelectorAll<HTMLElement>('[data-id]'))) {
+ if (skippable(el)) continue;
+ const font = fontOf(el);
+ const cs = styleOf(el);
+ const sig = `${el.offsetWidth}|${font}|${cs.textIndent}|${cs.textAlign}|${el.textContent}`;
+ if (el.dataset[SIG] === sig) continue;
+ stats.blocks++;
+ unhang(el);
+ const hung = hangBlock(el, font, cs);
+ stats.hung += hung.hung;
+ if (hung.reverted) stats.reverted++;
+ el.dataset[SIG] = sig;
+ }
+ stats.ms = performance.now() - t0;
+ return stats;
+}
+
+/**
+ * Everything a pass needs to know about one block's line layout.
+ *
+ * Shared by the hanging pass and the measurement so that the two cannot answer
+ * differently about where a line ends — a measurement that disagrees with the
+ * thing it is measuring is worse than no measurement.
+ */
+interface BlockLines {
+ lines: Line[];
+ text: string;
+ runs: Array<{ node: Text; at: number }>;
+ total: number;
+ left: number;
+ right: number;
+ /** index of the first NON-SPACE character of line k */
+ firstOf(k: number): number;
+ /** index of the last NON-SPACE character of line k */
+ lastOf(k: number): number;
+ /** was line k broken INSIDE a word — i.e. did the browser draw a hyphen? */
+ hyphenated(k: number): boolean;
+ /** vertical centre of character i, in client coords */
+ centre(i: number): number;
+}
+
+function blockLines(el: HTMLElement, cs: CSSStyleDeclaration): BlockLines | null {
+ const text = el.textContent ?? '';
+ if (!text.trim()) return null;
+ const d = docOf(el);
+ const range = d.createRange();
+ range.selectNodeContents(el);
+ const lines = mergeLines(Array.from(range.getClientRects()));
+ if (!lines.length) return null;
+ const runs = textRuns(el);
+ if (!runs.length) return null;
+ const total = runs[runs.length - 1].at + runs[runs.length - 1].node.nodeValue!.length;
+
+ const box = el.getBoundingClientRect();
+ const left = box.left + parseFloat(cs.paddingLeft || '0') + parseFloat(cs.borderLeftWidth || '0');
+ const right = box.right - parseFloat(cs.paddingRight || '0') - parseFloat(cs.borderRightWidth || '0');
+
+ const probe = d.createRange();
+ const centre = (i: number): number => {
+ const p = locate(runs, i);
+ if (!p) return NaN;
+ probe.setStart(p.node, p.off);
+ probe.setEnd(p.node, p.off + 1);
+ const r = probe.getBoundingClientRect();
+ return r.height > 0.5 ? r.top + r.height / 2 : NaN;
+ };
+ const splits = lineSplits(lines);
+
+ // boundary[k] = index of the first character of line k+1. Binary search,
+ // because a character's line index is monotonic in the character index — a
+ // per-character walk over the document is what hung the tab during the
+ // pagination spike (paginate.ts rule 2).
+ const boundary: number[] = [];
+ let lo = 0;
+ for (let k = 0; k + 1 < lines.length; k++) {
+ let a = lo, b = total;
+ while (a < b) {
+ const mid = (a + b) >> 1;
+ const cy = centre(mid);
+ // a character whose rect we cannot read counts as still on this line, so
+ // the search converges rather than throwing the block away
+ if (!isFinite(cy) || cy < splits[k]) a = mid + 1; else b = mid;
+ }
+ boundary.push(a);
+ lo = a;
+ }
+
+ // THE BREAK SPACE BELONGS TO THE LINE ABOVE IT. A line reading "…the term. "
+ // has a collapsed space as its last character, so the naive index is a space
+ // and nothing hangs — which is most lines. Measured before this: 14 hanging
+ // characters in a 14-page document, against 25 after.
+ const ws = /\s/;
+ const firstOf = (k: number) => {
+ let i = k === 0 ? 0 : boundary[k - 1];
+ while (i < total && ws.test(text[i])) i++;
+ return i;
+ };
+ const lastOf = (k: number) => {
+ let i = (k + 1 < lines.length ? boundary[k] : total) - 1;
+ while (i >= 0 && ws.test(text[i])) i--;
+ return i;
+ };
+ // A break with no whitespace at it is a break INSIDE a word, which means
+ // `hyphens: auto` drew a hyphen there — a glyph with no character behind it,
+ // which nothing can wrap and nothing can hang.
+ //
+ // Asked as "is the next line's first character the one right after this
+ // line's last", not by reading the character at the boundary index: the
+ // collapsed break space can be reported on either line, so an index-based
+ // test is noisy by one and re-classified ten lines of a fourteen-page
+ // document between two runs that had identical line breaking.
+ const hyphenated = (k: number) =>
+ k + 1 < lines.length && firstOf(k + 1) === lastOf(k) + 1;
+
+ return { lines, text, runs, total, left, right, firstOf, lastOf, hyphenated, centre };
+}
+
+/** One block. Returns what it did, having already undone it if it went wrong. */
+function hangBlock(el: HTMLElement, font: string, cs: CSSStyleDeclaration): { hung: number; reverted: boolean } {
+ const m = blockLines(el, cs);
+ if (!m) return { hung: 0, reverted: false };
+ const { lines, text, runs, left, right, firstOf, lastOf } = m;
+ const d = docOf(el);
+
+ // What to wrap: the last character of each line that reaches the right
+ // margin, and the first of each line that starts at the left one.
+ const jobs: Array<{ i: number; shift: number }> = [];
+ const want = (i: number, edge: Edge) => {
+ const ch = text[i];
+ if (!ch || !protrudes(ch, edge)) return;
+ const b = bearings(ch, font);
+ const shift = b && opticalShift(ch, edge, b);
+ if (shift) jobs.push({ i, shift });
+ };
+ for (let k = 0; k < lines.length; k++) {
+ if (Math.abs(lines[k].right - right) <= EDGE_TOL) want(lastOf(k), 'end');
+ if (Math.abs(lines[k].left - left) <= EDGE_TOL) want(firstOf(k), 'start');
+ }
+ if (!jobs.length) return { hung: 0, reverted: false };
+
+ // Wrap from the back, so an earlier job's text-node split cannot move a later
+ // job's offsets out from under it.
+ jobs.sort((x, y) => y.i - x.i);
+ let hung = 0;
+ for (const job of jobs) {
+ const p = locate(runs, job.i);
+ if (!p) continue;
+ const r = d.createRange();
+ r.setStart(p.node, p.off);
+ r.setEnd(p.node, p.off + 1);
+ const span = d.createElement('span');
+ span.className = HANG_CLASS;
+ span.style.left = `${job.shift.toFixed(2)}px`;
+ try { r.surroundContents(span); hung++; } catch { /* a mark boundary: skip it */ }
+ }
+ if (!hung) return { hung: 0, reverted: false };
+
+ // ── the verification. Nothing above is trusted.
+ //
+ // Every line's first AND last character is looked up again and must still be
+ // on that line. One side alone is not enough — see boundariesHeld, which
+ // records the reflow that got through the one-sided version.
+ const after = blockLines(el, cs);
+ if (!after) { unhang(el); return { hung: 0, reverted: true }; }
+ const lineAt = (i: number): number => {
+ const cy = after.centre(i);
+ if (!isFinite(cy)) return -1;
+ return after.lines.findIndex(l => cy >= l.top - 1 && cy <= l.bottom + 1);
+ };
+ const ks = lines.map((_, k) => k);
+ if (!boundariesHeld(
+ lines.map(r => r.top), after.lines.map(r => r.top),
+ ks.map(k => lineAt(lastOf(k))), ks.map(k => lineAt(firstOf(k))))) {
+ unhang(el);
+ return { hung: 0, reverted: true };
+ }
+ return { hung, reverted: false };
+}
+
+/** One line's ink edge, as an offset from the margin it is trying to reach. */
+export interface InkSample {
+ /** signed px: negative is ink stopping short of the margin */
+ dev: number;
+ /** the character painted at the line's end */
+ ch: string;
+ /** was the line broken inside a word, so the browser drew its own hyphen? */
+ hyphenated: boolean;
+}
+
+/**
+ * Where each justified line's INK actually ends, relative to the margin.
+ *
+ * This is the measurement the feature is justified by, and it lives in the
+ * shipped module rather than in a script so the claim can be re-checked on any
+ * document at any time. It reads the trailing character's OWN rect — which
+ * carries the hanging offset when there is one — and subtracts that character's
+ * right side bearing, so what comes back is the position of the last ink on
+ * the line and not the position of its advance box.
+ *
+ * The last line of a justified paragraph is excluded: it is set flush left and
+ * says nothing about the right margin. Hyphenated lines are REPORTED rather
+ * than dropped, because they are the population this feature cannot help
+ * (`hyphens: auto` draws a glyph with no character behind it) and hiding them
+ * would flatter the result.
+ */
+export function inkDeviation(host: HTMLElement): InkSample[] {
+ const out: InkSample[] = [];
+ const probe = docOf(host).createRange();
+ for (const el of Array.from(host.querySelectorAll<HTMLElement>('[data-id]'))) {
+ if (skippable(el)) continue;
+ const cs = styleOf(el);
+ if (cs.textAlign !== 'justify') continue;
+ const m = blockLines(el, cs);
+ if (!m) continue;
+ const font = fontOf(el);
+ for (let k = 0; k + 1 < m.lines.length; k++) {
+ const i = m.lastOf(k);
+ const ch = m.text[i];
+ if (!ch) continue;
+ const p = locate(m.runs, i);
+ if (!p) continue;
+ probe.setStart(p.node, p.off);
+ probe.setEnd(p.node, p.off + 1);
+ const r = probe.getBoundingClientRect();
+ if (!(r.height > 0.5)) continue;
+ const b = bearings(ch, font);
+ const rsb = b ? Math.max(0, b.advance - b.inkRight) : 0;
+ out.push({ dev: r.right - rsb - m.right, ch, hyphenated: m.hyphenated(k) });
+ }
+ }
+ return out;
+}
+
+/** mean and standard deviation of a sample, for reporting a measurement */
+export function stats(xs: readonly number[]): { n: number; mean: number; sd: number } {
+ const n = xs.length;
+ if (!n) return { n: 0, mean: 0, sd: 0 };
+ const mean = xs.reduce((a, b) => a + b, 0) / n;
+ const sd = Math.sqrt(xs.reduce((a, b) => a + (b - mean) ** 2, 0) / n);
+ return { n, mean, sd };
+}
+
+// ─────────────────────────────────────────────────────────────── registration
+
+import { registerPaginated, registerReady } from './features.ts';
+import type { TypeDoc } from './model.ts';
+
+/** Absent means on — see the header for why this file's default is not "off". */
+export const opticalOn = (doc: Pick<TypeDoc, 'optical'>): boolean => doc.optical !== false;
+
+/** The last pass's numbers, for the status line and for anyone measuring. */
+export let lastPass: MicroStats = { blocks: 0, hung: 0, reverted: 0, ms: 0 };
+
+registerPaginated((ctx, _metrics, host) => {
+ // The caret is saved and put back around the pass. Wrapping splits a text
+ // node, and a split under a live selection is how a caret jumps a character
+ // while somebody is typing — the model position is the one that survives it
+ // (editor.ts rule 1).
+ const focused = host.contains(document.activeElement) || host === document.activeElement;
+ const caret = focused ? ctx.editor.caret() : null;
+ lastPass = applyOptical(host, opticalOn(ctx.store.doc));
+ if (caret) ctx.editor.setCaret(caret);
+});
+
+registerReady(ctx => {
+ // A diagnostic handle, in the shape window.bento.comments() already
+ // established: the measurement this feature is justified by has to be
+ // re-runnable on a real document, not only in a rig.
+ (globalThis as unknown as Record<string, unknown>).bentoMicro = {
+ stats: () => lastPass,
+ // run a pass over an arbitrary rendered flow — the print document included,
+ // which is how the cross-document path (a Range must come from the node's
+ // OWN document) is checked without opening a print dialog
+ apply: (host: HTMLElement, on = true) => applyOptical(host, on),
+ deviation: (host?: HTMLElement) => {
+ const el = host ?? document.querySelector<HTMLElement>('.t-paper');
+ if (!el) return null;
+ const all = inkDeviation(el);
+ const flush = all.filter(s => !s.hyphenated);
+ return {
+ all: stats(all.map(s => s.dev)),
+ // the population this feature can act on at all
+ unhyphenated: stats(flush.map(s => s.dev)),
+ hyphenated: all.length - flush.length,
+ };
+ },
+ samples: (host?: HTMLElement) => {
+ const el = host ?? document.querySelector<HTMLElement>('.t-paper');
+ return el ? inkDeviation(el) : null;
+ },
+ set: (on: boolean) => {
+ ctx.store.commit(d => { if (on) delete d.optical; else d.optical = false; });
+ ctx.refresh();
+ },
+ };
+});
diff --git a/type/src/model.ts b/type/src/model.ts
index 19d8fbdd..2d961f29 100644
--- a/type/src/model.ts
+++ b/type/src/model.ts
@@ -16,6 +16,9 @@ import { withoutCaps } from '../../kernel/src/docfields.ts';
// value import is safe: xref.ts imports only TYPES from this module, precisely
// so the core can call into it without a cycle
import { shiftRefs } from './xref.ts';
+// same arrangement, same reason: fields.ts imports only TYPES from this module,
+// so the core can call into it without a value-level cycle. See fields.ts.
+import { readFieldRefs, shiftFields, type FieldRef } from './fields.ts';
import { readThreadsRaw, reconcileThreads } from './comments.ts';
export const FORMAT = 'bento/type';
@@ -168,6 +171,13 @@ export interface Block {
refs?: XrefRef[];
/** citations, by offset into `text` — atoms, like `notes` */
cites?: CiteRef[];
+ /**
+ * Fields — text the document computes rather than stores — by offset into
+ * `text`, atoms like `notes`. `{{page}}`, `{{title}}`, and the merge columns
+ * a mail merge binds. See fields.ts for why a field is an atom in this app
+ * and a literal token in bento/slides.
+ */
+ fields?: FieldRef[];
/**
* A named style this block carries BY REFERENCE — see docstyles.ts.
@@ -302,6 +312,17 @@ export interface TypeDoc {
* already in.
*/
type?: { family?: string; size?: number };
+ /**
+ * Optical margin alignment — hanging punctuation. See micro.ts.
+ *
+ * ABSENT MEANS ON, which is the one place this format deliberately does not
+ * render an old file exactly as it rendered before. What an old file promises
+ * is its PAGINATION, and that is untouched: the offsets are applied in
+ * rendering space (`position: relative`), never fed back into line breaking,
+ * and the pass verifies per paragraph that no line boundary moved. Only
+ * `false` is stored, because the default carries no information.
+ */
+ optical?: boolean;
revisions: Revision[];
signatures: Signature[];
/**
@@ -317,6 +338,15 @@ export interface TypeDoc {
* and reads identically.
*/
track?: boolean;
+ /**
+ * What a mail merge bound this document to — see merge.ts.
+ *
+ * ON THE OUTPUT, not on the template: an emitted letter carries the row it
+ * was made from, so its FIELDS still resolve and it is still a document
+ * rather than a rendering of one. Additive and optional, so a document that
+ * never merged has nothing here and reads exactly as it always did.
+ */
+ merge?: { source?: string; columns?: string[]; row?: Record<string, string> };
fonts?: Array<{ family: string; asset: string; weight?: string; style?: string }>;
assets?: Record<string, string>;
readonly?: boolean;
@@ -594,6 +624,7 @@ export function parseDoc(raw: string): ParseResult {
// failure — only a "this named style no longer exists" the panel can show.
if (typeof b.styleId === 'string' && b.styleId) out.styleId = b.styleId; else delete out.styleId;
delete out.level; delete out.cell; delete out.image; delete out.caption; delete out.refs; delete out.cites;
+ delete out.fields;
if (typeof b.role === 'string') out.role = b.role;
// `level` is clamped and only kept on list kinds. A level on a paragraph
// would be silently meaningless, and a level of 40 would render as a list
@@ -678,6 +709,13 @@ export function parseDoc(raw: string): ParseResult {
.sort((x, y) => x.at - y.at)
: undefined;
if (cites?.length) out.cites = cites;
+ // A field whose name means nothing to this build is KEPT, like a dangling
+ // cross-reference and unlike a dangling footnote: an unbound field renders
+ // as its name in the editor and as nothing on paper (fields.ts), which is
+ // a visible hole somebody can fix. Dropping it would silently delete the
+ // author's intention to say a name there.
+ const fields = readFieldRefs(b.fields, text.length);
+ if (fields.length) out.fields = fields;
body.push(out);
});
if (!body.length) body.push({ id: uid(), kind: 'para', text: '' });
@@ -748,6 +786,8 @@ export function parseDoc(raw: string): ParseResult {
signatures: Array.isArray(json.signatures) ? json.signatures as Signature[] : [],
};
if (Object.keys(styles).length) doc.styles = styles; else delete doc.styles;
+ // only `false` is a value; anything else — including a junk one — is the default
+ if (json.optical === false) doc.optical = false; else delete doc.optical;
if (typeof json.docId !== 'string' || !json.docId) repaired.push('minted a missing docId');
// Comment threads: parse totally, THEN repair. The order matters and the
// feature's note says why — repairing before an anchor moves would clamp it
@@ -829,6 +869,10 @@ export function spliceText(block: Block, at: number, removed: number, added: str
const r = shiftRefs(block.refs, at, removed, added.length);
if (r.length) out.refs = r; else delete out.refs;
}
+ if (block.fields?.length) {
+ const f = shiftFields(block.fields, at, removed, added.length);
+ if (f.length) out.fields = f; else delete out.fields;
+ }
if (block.notes?.length) {
const end = at + removed;
const delta = added.length - removed;
diff --git a/type/src/preview.ts b/type/src/preview.ts
index 63c239a8..0e8b73fc 100644
--- a/type/src/preview.ts
+++ b/type/src/preview.ts
@@ -53,6 +53,7 @@ import { margins, blockStyle } from './layout.ts';
import { docStyleCss } from './docstyles.ts';
import { captionIndex, docLang, fillXrefsHtml } from './xref.ts';
import { embedHtml } from './embed.ts';
+import { fieldContext, fillFieldsHtml, pagination } from './fields.ts';
import { displayMathHtml } from './math.ts';
/** Above this the preview is trimmed, then dropped to a title card. A preview
@@ -173,7 +174,11 @@ function flowHtml(body: Block[], doc: TypeDoc): string {
// numbering, not the slice's — "Figure 3" must read 3 even when only its
// caption's page made the cut, exactly as print.ts resolves against the
// whole body for every page it draws.
- return fillXrefsHtml(out.join(''), captionIndex(doc.body, docLang(doc)));
+ // Same two-pass fill as print.ts, and for the same reason: a thumbnail is
+ // read by someone who cannot run the app, so it must show values rather than
+ // `{{tokens}}` — and nothing at all for a field with no value.
+ return fillFieldsHtml(fillXrefsHtml(out.join(''), captionIndex(doc.body, docLang(doc))),
+ fieldContext(doc, pagination()));
}
// ─────────────────────────────────────────────────── staticizing
diff --git a/type/src/print.ts b/type/src/print.ts
index 22f6005d..f3fa7ee1 100644
--- a/type/src/print.ts
+++ b/type/src/print.ts
@@ -29,6 +29,8 @@ import { captionIndex, docLang, fillXrefsHtml } from './xref.ts';
import { blockStyle } from './layout.ts';
import { docStyleCss } from './docstyles.ts';
import { embedHtml } from './embed.ts';
+import { applyOptical, opticalOn } from './micro.ts';
+import { fieldContext, fillFieldsHtml, pagination } from './fields.ts';
export interface PrintOptions {
/** running head text; omitted = the document title */
@@ -88,6 +90,7 @@ h2 { font-size: 15.5px; font-weight: 600; margin: 24px 0 8px; hyphens: none; }
h3 { font-size: 14px; font-weight: 600; margin: 16px 0 6px; color: #3a3d44; hyphens: none; }
p { margin: 0 0 10px; text-align: justify; orphans: 2; widows: 2; text-wrap: pretty; }
p + p { text-indent: 1.4em; margin-top: -10px; padding-top: 10px; }
+.t-hang { position: relative; } /* optical margin alignment — see micro.ts */
.t-figure { margin: 12px 0; text-align: center; break-inside: avoid; page-break-inside: avoid; }
.t-figure img { max-width: 100%; height: auto; }
.t-figure[data-align="left"] { text-align: left; }
@@ -186,7 +189,14 @@ function bodyHtml(doc: TypeDoc, lang: string): string {
// The DOM pass (numberXrefs) and this string pass fill the SAME atoms from
// the SAME index, which is what stops the printed numbering drifting from the
// screen's — the drift this module exists to prevent.
- return fillXrefsHtml(out.join('\n'), captionIndex(body, lang));
+ // Fields are filled by the SAME string pass, from the SAME measurements the
+ // editor took (fields.ts `pagination()` is set by the paginated hook, and
+ // print is generated from that very pass) — so `{{page}}` prints the page the
+ // field is actually on and cannot disagree with the screen. An UNBOUND field
+ // resolves to nothing here, span and all: paper must never show the
+ // machinery. See fields.ts's header.
+ return fillFieldsHtml(fillXrefsHtml(out.join('\n'), captionIndex(body, lang)),
+ fieldContext(doc, pagination()));
}
/**
@@ -262,6 +272,20 @@ export function printDocument(doc: TypeDoc, metrics: Metrics, opts: PrintOptions
win.document.write(html);
win.document.close();
const go = () => {
+ // Optical margin alignment, in the printed document — not in
+ // buildPrintDocument, which stays a pure string function. Every page here
+ // holds a COPY of the same flow at the same width, so the pass runs once on
+ // the first copy and the result is cloned into the others: identical input,
+ // identical output, and one pass instead of one per page. The offsets are
+ // relative positioning, so the page windows still frame exactly the lines
+ // the editor's pagination chose.
+ if (opticalOn(doc)) {
+ const bodies = Array.from(win.document.querySelectorAll<HTMLElement>('.t-body'));
+ if (bodies.length) {
+ applyOptical(bodies[0], true);
+ for (let i = 1; i < bodies.length; i++) bodies[i].innerHTML = bodies[0].innerHTML;
+ }
+ }
win.focus();
win.print();
// leave it a moment: removing the frame during print cancels the job in
diff --git a/type/src/props.ts b/type/src/props.ts
index 06909028..3253c536 100644
--- a/type/src/props.ts
+++ b/type/src/props.ts
@@ -455,6 +455,20 @@ function documentSection(host: HTMLElement, ctx: FeatureContext): void {
ctx.refresh();
});
row(body, t('Track changes'), trk);
+
+ // ---- optical margins. A DOCUMENT property, beside the typeface, because it
+ // is how the page is set rather than how this reader likes to look at it.
+ const opt = el('input') as HTMLInputElement;
+ opt.type = 'checkbox';
+ opt.checked = doc.optical !== false;
+ opt.addEventListener('change', () => {
+ ctx.store.commit(d => { if (opt.checked) delete d.optical; else d.optical = false; });
+ ctx.refresh();
+ });
+ row(body, t('Optical margins'), opt);
+ const optNote = el('p', 't-note');
+ optNote.textContent = t('Punctuation hangs a little past the margin so the edge of the text reads straight. It never changes where lines break, so the page count is the same either way.');
+ body.appendChild(optNote);
const note = el('p', 't-note');
note.textContent = t('Off by default: most documents already carry their numbers in the heading text.');
body.appendChild(note);
diff --git a/type/src/redlineview.css b/type/src/redlineview.css
index 71295a4c..740296af 100644
--- a/type/src/redlineview.css
+++ b/type/src/redlineview.css
@@ -13,3 +13,15 @@
opacity: .5;
cursor: default;
}
+
+/* The caveat under a comparison's heading — a different docId, or repairs made
+ while reading the other file. Quieter than the heading it qualifies, and it
+ must stay legible in both themes, so it borrows chrome tokens only (a
+ --paper token here would be a white box in the dark theme; see
+ scripts/test-type-theme.mjs for the bug class). */
+.t-redline-note {
+ margin-bottom: 9px;
+ padding-inline-start: 8px;
+ border-inline-start: 2px solid var(--line);
+ color: var(--muted);
+}
diff --git a/type/src/redlineview.ts b/type/src/redlineview.ts
index 493814ad..065a91c1 100644
--- a/type/src/redlineview.ts
+++ b/type/src/redlineview.ts
@@ -1,8 +1,14 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2026 The Bento authors
//
-// THE SNAPSHOT REDLINE SURFACE — comparing the live document against a chosen
-// earlier revision, computed once per "Review changes…" click.
+// THE REDLINE SURFACE — comparing the live document against a chosen BASE,
+// computed once per "Review changes…" click.
+//
+// There are two bases now. A SNAPSHOT (`startReview`) is a revision of this
+// document, so the redline can be resolved — accept and reject mean something,
+// and `applyDecisions` commits. A COMPARISON (`showComparison`, driven by
+// compare.ts) is against another FILE, and is a VIEW only: see `resolvable`
+// below for why that is not the same feature with a flag.
//
// NOT review.ts. review.ts's tracked changes are live, per-edit, and always
// current — driven by `ins`/`del` marks the document itself carries. This is
@@ -26,7 +32,7 @@
import './redlineview.css';
import { registerPanel, type FeatureContext } from './features.ts';
-import { redline, apply as applyRedline, describe, type ChangeSet } from './redline.ts';
+import { redline, apply as applyRedline, describe, type Change, type ChangeSet } from './redline.ts';
import type { Block } from './model.ts';
import { uid } from './model.ts';
@@ -43,6 +49,26 @@ let baseBody: Block[] | null = null;
let baseLabel = '';
const decided = new Map<string, boolean>();
+/**
+ * WHERE THE BASE CAME FROM, which decides whether the redline is RESOLVABLE.
+ *
+ * A snapshot redline is resolvable: the base is a revision of THIS document,
+ * so "reject" means restore what this document said a moment ago, and the
+ * accept/reject arithmetic in `applyDecisions` lands somewhere the author
+ * meant to be. A comparison against ANOTHER FILE is not: rejecting there
+ * would mean adopting a different document's text wholesale, and comparing is
+ * a VIEW — the same rule the theme and the locale follow. So the buttons are
+ * not merely disabled in that mode, they are not offered, and `heading`/`note`
+ * say what is on screen instead.
+ *
+ * These are THUNKS, not strings. registerPanel's `label` learned the same
+ * lesson: a string resolved when the comparison starts is frozen at that
+ * locale, and the About picker rebuilds the workspace under it.
+ */
+let heading: (() => string) | null = null;
+let note: (() => string) | null = null;
+let resolvable = true;
+
// Set on mount, so the two actions below (which don't themselves commit to the
// store — computing a redline is a pure read) can still ask the panel to
// repaint. Accept/Reject DO commit, and every panel's `update` is already
@@ -70,6 +96,40 @@ export function startReview(ctx: FeatureContext): void {
decided.clear();
baseBody = base.body;
baseLabel = base.label;
+ heading = null;
+ note = null;
+ resolvable = true;
+ ctx.showPanel('review');
+ repaint?.();
+}
+
+/**
+ * Show a redline whose base is NOT a snapshot of this document — today, another
+ * file the reader picked (compare.ts).
+ *
+ * The caller owns the diff and every word on screen; this only paints. That
+ * split is deliberate: the direction of a comparison is the one thing a reader
+ * cannot recover from the cards themselves (an insertion and a deletion look
+ * identical read backwards), so whoever chose the direction is also the one who
+ * writes the sentence naming it, rather than this file guessing from a label.
+ */
+export function showComparison(ctx: FeatureContext, o: {
+ base: { docId: string; body: Block[] };
+ set: ChangeSet;
+ /** the sentence naming the direction, e.g. “7 changes from “x.html” to this document” */
+ heading: () => string;
+ /** an optional caveat beneath it — a different docId, repairs made on read */
+ note?: () => string;
+ /** may the reader accept/reject? FALSE for anything that is only a view */
+ resolvable?: boolean;
+}): void {
+ currentSet = o.set;
+ baseBody = o.base.body;
+ baseLabel = '';
+ decided.clear();
+ heading = o.heading;
+ note = o.note ?? null;
+ resolvable = o.resolvable ?? false;
ctx.showPanel('review');
repaint?.();
}
@@ -108,13 +168,27 @@ function paint(host: HTMLElement, ctx: FeatureContext): void {
}
const head = el('div', 't-hint');
- head.textContent = currentSet.changes.length
- ? `${currentSet.changes.length} change${currentSet.changes.length > 1 ? 's' : ''} since ${baseLabel}`
- : `No changes since ${baseLabel}. Edit the document, then press Review again.`;
- head.style.marginBottom = '9px';
+ head.textContent = heading ? heading()
+ : currentSet.changes.length
+ ? `${currentSet.changes.length} change${currentSet.changes.length > 1 ? 's' : ''} since ${baseLabel}`
+ : `No changes since ${baseLabel}. Edit the document, then press Review again.`;
+ head.style.marginBottom = note ? '4px' : '9px';
host.appendChild(head);
+ if (note) {
+ const n = el('div', 't-hint t-redline-note');
+ n.textContent = note();
+ host.appendChild(n);
+ }
if (!currentSet.changes.length) return;
+ // A view-only comparison stops here and shows the cards. Offering a disabled
+ // Accept would read as "not yet", when the truth is that this base is not
+ // something this document can be resolved against at all.
+ if (!resolvable) {
+ for (const c of currentSet.changes) host.appendChild(card(c));
+ return;
+ }
+
const bar = el('div'); bar.style.cssText = 'display:flex;gap:6px;margin-bottom:9px';
for (const [text, val] of [['Accept all', true], ['Reject all', false]] as const) {
const b = el('button') as HTMLButtonElement;
@@ -129,12 +203,7 @@ function paint(host: HTMLElement, ctx: FeatureContext): void {
host.appendChild(bar);
for (const c of currentSet.changes) {
- const card = el('div', 't-card');
- if (decided.has(c.id)) card.classList.add('done');
- const what = c.kind === 'text'
- ? `${c.removed ? `<del>${esc(c.removed)}</del>` : ''}${c.added ? `<ins>${esc(c.added)}</ins>` : ''}`
- : esc(describe(c));
- card.innerHTML = `<div class="who">${esc(c.author)} · ${c.kind}</div><div class="what">${what}</div>`;
+ const box = card(c);
const btns = el('div', 'btns');
for (const [text, val] of [['Accept', true], ['Reject', false]] as const) {
const b = el('button') as HTMLButtonElement;
@@ -147,11 +216,22 @@ function paint(host: HTMLElement, ctx: FeatureContext): void {
});
btns.appendChild(b);
}
- card.appendChild(btns);
- host.appendChild(card);
+ box.appendChild(btns);
+ host.appendChild(box);
}
}
+/** One change, as the reviewer reads it — with no decision attached to it yet. */
+function card(c: Change): HTMLElement {
+ const box = el('div', 't-card');
+ if (decided.has(c.id)) box.classList.add('done');
+ const what = c.kind === 'text'
+ ? `${c.removed ? `<del>${esc(c.removed)}</del>` : ''}${c.added ? `<ins>${esc(c.added)}</ins>` : ''}`
+ : esc(describe(c));
+ box.innerHTML = `<div class="who">${esc(c.author)} · ${c.kind}</div><div class="what">${what}</div>`;
+ return box;
+}
+
registerPanel({
id: 'redline',
label: 'Snapshot redline',
diff --git a/type/src/registry.ts b/type/src/registry.ts
index 6ceb987a..3d948401 100644
--- a/type/src/registry.ts
+++ b/type/src/registry.ts
@@ -37,6 +37,7 @@ import './comments.ts';
// is what makes an eighty-change document usable.
import './review.ts';
import './redlineview.ts'; // snapshot redlining — own panel host, see its header
+import './compare.ts'; // the same redline against another FILE — a view, never a merge
// auto-save + crash recovery: a debounced IndexedDB snapshot, a restore
// banner on boot when it disagrees with the loaded file, and version
// history (About dialog). See autosave.ts's header for the full design.
@@ -44,3 +45,14 @@ import './autosave.ts';
// the static first-page render written into every saved file, for readers
// (thumbnailers) that run no script — see preview.ts's header.
import './preview.ts';
+// optical margin alignment (hanging punctuation) — see micro.ts's header for
+// why it can be added to a document whose pagination is already a promise.
+import './micro.ts';
+// fields and mail merge: {{tokens}} resolved at render (never in the model),
+// and one complete .bento.html per row of a bound sheet. merge.ts imports
+// fields.ts, so this one line mounts both — see fields.ts's header.
+import './merge.ts';
+// live cells: a field whose value is a cell of a sheet this document embeds,
+// addressed by row label and column heading — see live.ts's header for why not
+// by cell reference.
+import './live.ts';
diff --git a/type/src/render.ts b/type/src/render.ts
index 309ac83d..05f0f231 100644
--- a/type/src/render.ts
+++ b/type/src/render.ts
@@ -15,6 +15,7 @@ import { blockStyle } from './layout.ts';
import { activeStyleId, ensureStyleSheet } from './docstyles.ts';
import { citeInject, isCiteAtom, mergeInject, paintCitations, readCiteAtoms } from './cite.ts';
import { displayMathHtml, inlineMathHtml, isMathMark } from './math.ts';
+import { fieldAtoms, fillFields, isFieldAtom, readFields } from './fields.ts';
import { renderEmbed } from './embed.ts';
export const TAG: Record<Block['kind'], string> = {
@@ -148,6 +149,11 @@ export function blockHtml(b: Block): string {
new Map((b.notes ?? []).map(n => [n.at, noteMarker(n.id)])),
refAtoms(b),
citeInject(b),
+ // A FIELD is the fourth atom over the same text, and it is here rather than
+ // in the text for the reason fields.ts's header gives at length: resolving
+ // into `text` would put the DOM and the model at different lengths, and the
+ // caret is a model offset into that string.
+ fieldAtoms(b),
);
const html = toHtml(b.text, b.marks ?? [], atoms.size ? atoms : undefined,
mathRanges.length ? mathRanges : undefined);
@@ -312,6 +318,7 @@ export function renderBody(doc: TypeDoc, host: HTMLElement): void {
numberNotes(host, doc);
numberXrefs(host, doc);
paintCitations(host, doc);
+ fillFields(host, doc);
}
/**
@@ -338,7 +345,8 @@ export function numberNotes(host: HTMLElement, _doc: TypeDoc): string[] {
* nothing that has no place to go.
*/
export function readBlock(el: HTMLElement, prev: Block): Block {
- const { text, marks, atoms } = fromDom(el, el2 => isNoteAtom(el2) || isXrefAtom(el2) || isCiteAtom(el2));
+ const { text, marks, atoms } = fromDom(el,
+ el2 => isNoteAtom(el2) || isXrefAtom(el2) || isCiteAtom(el2) || isFieldAtom(el2));
const out: Block = { ...prev, id: el.dataset.id || prev.id, text };
const kind = el.dataset.kind as Block['kind'] | undefined;
if (kind && kind in TAG) out.kind = kind;
@@ -351,5 +359,10 @@ export function readBlock(el: HTMLElement, prev: Block): Block {
if (refs.length) out.refs = refs; else delete out.refs;
const cites = readCiteAtoms(atoms);
if (cites.length) out.cites = cites; else delete out.cites;
+ // Recovered from the ATOM, never from the text — which is why typing around
+ // a field cannot destroy it and why the resolved value never lands in the
+ // model. This one line is the whole of the "editing gotcha" in this app.
+ const fields = readFields(atoms);
+ if (fields.length) out.fields = fields; else delete out.fields;
return out;
}
diff --git a/type/src/styles.css b/type/src/styles.css
index 6cdb25a9..1b55f84b 100644
--- a/type/src/styles.css
+++ b/type/src/styles.css
@@ -34,6 +34,14 @@
--paper-trk: #1a6b4a;
--paper-trk-bg: #eaf3ef;
--paper-trk-del: #a3312a;
+ /* Fields (fields.ts) are PAPER ink for the same reason tracked changes are:
+ the chip sits on the page, and a computed value that changed colour with a
+ chrome preference would be the one thing on the sheet doing so. The
+ UNBOUND colour is deliberately loud — a field nothing supplies is the state
+ that ruins two hundred envelopes, so it must be impossible to skim past. */
+ --paper-field-bg: #eef3fb;
+ --paper-field-ink: #24405f;
+ --paper-field-miss: #a3312a;
/* geometry */
--radius: 10px;
@@ -367,6 +375,11 @@ html, body {
.t-paper h3 { font-size: 14px; font-weight: 600; margin: 16px 0 6px; color: var(--paper-ink-2); hyphens: none; }
.t-paper p { margin: 0 0 10px; text-align: justify; orphans: 2; widows: 2; text-wrap: pretty; }
.t-paper p + p { text-indent: 1.4em; margin-top: -10px; padding-top: 10px; }
+/* Optical margin alignment (micro.ts). The offset is RELATIVE positioning and
+ nothing else, because a relatively positioned box is painted moved and
+ changes the layout of nothing — which is the only reason hanging punctuation
+ can be added to a document whose pagination is already a promise. */
+.t-hang { position: relative; }
/* ————— figures ————— */
.t-paper .t-figure {
margin: 14px 0; text-align: center;
@@ -594,6 +607,65 @@ html, body {
}
.t-xref-item:hover { background: var(--chrome-2); }
.t-xref-broken-head { margin: 12px 0 4px; font-size: 11px; color: var(--bad); font-weight: 600; }
+/* ─────────────────────────────────────────────────────────────────── fields
+ A field renders as a faint chip so an author can tell computed text from
+ text they typed. It is `contenteditable=false` and owns no characters in the
+ model (fields.ts), so it cannot be typed over or half-deleted. On PAPER the
+ chip is gone entirely: print.ts and preview.ts carry their own stylesheets
+ and neither knows this class, so a printed field is ordinary text. */
+.t-paper .t-field {
+ background: var(--paper-field-bg);
+ color: var(--paper-field-ink);
+ border-radius: 3px;
+ padding: 0 2px;
+ white-space: nowrap;
+}
+/* Nothing supplies this field. It prints as NOTHING, so the editor is the only
+ place anyone can find out — hence the dashed outline rather than a tint. */
+.t-paper .t-field-unbound {
+ background: transparent;
+ color: var(--paper-field-miss);
+ border: 1px dashed var(--paper-field-miss);
+ padding: 0 3px;
+ font-style: italic;
+}
+
+/* the Insert-field picker and the merge dialog — CHROME, so no --paper here */
+.t-field-pick { width: min(420px, 100%); }
+.t-field-pick h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
+.t-field-list { display: flex; flex-direction: column; gap: 2px; max-height: 46vh; overflow-y: auto; }
+.t-field-list button {
+ display: flex; gap: 8px; align-items: baseline; justify-content: space-between;
+ text-align: start; font: inherit; font-size: 12.5px; padding: 5px 8px; cursor: pointer;
+ background: transparent; color: var(--ink);
+ border: 1px solid transparent; border-radius: 6px;
+}
+.t-field-list button:hover, .t-field-list button:focus-visible {
+ background: var(--chrome-2); border-color: var(--line); outline: none;
+}
+.t-field-list button span { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
+.t-field-head { margin: 10px 0 3px; font-size: 11px; font-weight: 600; color: var(--muted); }
+.t-field-head:first-child { margin-top: 0; }
+.t-field-custom { display: flex; gap: 6px; margin-top: 10px; }
+.t-field-custom .t-input { flex: 1; }
+
+.t-merge { width: min(480px, 100%); }
+.t-merge h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
+.t-merge-note { margin: 6px 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
+.t-merge-warn { margin: 6px 0; font-size: 12px; color: var(--bad); line-height: 1.5; }
+.t-merge-cols { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
+.t-merge-cols code {
+ font-size: 11.5px; padding: 2px 6px; border-radius: 5px;
+ background: var(--chrome-2); color: var(--ink-2); border: 1px solid var(--line);
+}
+.t-merge-cols .t-merge-clash { color: var(--bad); border-color: var(--bad); }
+.t-merge-pattern { flex: 1; min-width: 0; }
+.t-merge-bar {
+ height: 6px; margin: 12px 0 6px; border-radius: 3px;
+ background: var(--chrome-2); overflow: hidden;
+}
+.t-merge-bar > div { height: 100%; width: 0; background: var(--accent); transition: width .12s linear; }
+
/* ─────────────────────────────────────────────────────── the link popover
CHROME, not document: it floats over the page and must follow the reader's
theme, so no --paper token appears here (scripts/test-type-theme.mjs would