gedcom-ts 2026.5.3 → 2026.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/README.md +87 -20
- package/dist/booklet/booklet-date-en.d.ts +9 -0
- package/dist/booklet/booklet-date-factory.d.ts +21 -0
- package/dist/booklet/booklet-date-fr.d.ts +1 -0
- package/dist/booklet/booklet-date.d.ts +6 -0
- package/dist/booklet/booklet-estimate.d.ts +4 -3
- package/dist/booklet/booklet-gender-core.d.ts +3 -0
- package/dist/booklet/booklet-gender-data.d.ts +9 -0
- package/dist/booklet/booklet-gender.d.ts +8 -9
- package/dist/booklet/booklet-locale-helpers.d.ts +4 -0
- package/dist/booklet/booklet-locale-loader.d.ts +27 -0
- package/dist/booklet/booklet-locale-modules-source.d.ts +1 -0
- package/dist/booklet/booklet-locale-modules.d.ts +5 -0
- package/dist/booklet/booklet-locale.d.ts +15 -0
- package/dist/booklet/booklet-logo-loader.d.ts +8 -0
- package/dist/booklet/booklet-logo.d.ts +1 -5
- package/dist/booklet/booklet-messages-data.d.ts +15 -0
- package/dist/booklet/booklet-messages-types.d.ts +46 -0
- package/dist/booklet/booklet-messages.d.ts +7 -0
- package/dist/booklet/booklet-narrative-en.d.ts +10 -0
- package/dist/booklet/booklet-narrative-engine.d.ts +17 -0
- package/dist/booklet/booklet-narrative-fr.d.ts +10 -0
- package/dist/booklet/booklet-narrative-i18n.d.ts +44 -0
- package/dist/booklet/booklet-narrative-locales.d.ts +3 -0
- package/dist/booklet/booklet-narrative.d.ts +5 -8
- package/dist/booklet/booklet-pdf-bidi.d.ts +5 -0
- package/dist/booklet/booklet-pdf-content-text.d.ts +11 -0
- package/dist/booklet/booklet-pdf-font-runtime.d.ts +8 -0
- package/dist/booklet/booklet-pdf-font-runtime.node.d.ts +3 -0
- package/dist/booklet/booklet-pdf-font-sources.d.ts +6 -0
- package/dist/booklet/booklet-pdf-font.d.ts +14 -0
- package/dist/booklet/booklet-pdf-fontkit.d.ts +6 -0
- package/dist/booklet/booklet-pdf-text.d.ts +24 -0
- package/dist/booklet/booklet-pdf.d.ts +13 -0
- package/dist/booklet/booklet-person.d.ts +6 -3
- package/dist/booklet/booklet-place-en.d.ts +16 -0
- package/dist/booklet/booklet-place-factory.d.ts +28 -0
- package/dist/booklet/booklet-place.d.ts +13 -0
- package/dist/booklet/booklet-structure.d.ts +3 -2
- package/dist/booklet/booklet-timeline-canvas.d.ts +2 -9
- package/dist/booklet/booklet-timeline-loader.d.ts +6 -0
- package/dist/booklet/booklet-timeline-metrics.d.ts +8 -0
- package/dist/booklet/feature-chunks/booklet-logo-draw.d.ts +15 -0
- package/dist/booklet/feature-chunks/booklet-timeline-raster.d.ts +3 -0
- package/dist/booklet/font-chunks/booklet-font-subset-chars.d.ts +2 -0
- package/dist/booklet/font-chunks/booklet-pdf-font-bytes-ar.d.ts +2 -0
- package/dist/booklet/font-chunks/booklet-pdf-font-bytes-he.d.ts +2 -0
- package/dist/booklet/font-chunks/booklet-pdf-font-bytes-zh-ext.d.ts +2 -0
- package/dist/booklet/font-chunks/booklet-pdf-font-bytes-zh.d.ts +2 -0
- package/dist/booklet/index.d.ts +11 -3
- package/dist/booklet/locale-chunks/booklet-locale-ar.d.ts +3 -0
- package/dist/booklet/locale-chunks/booklet-locale-de.d.ts +3 -0
- package/dist/booklet/locale-chunks/booklet-locale-en.d.ts +3 -0
- package/dist/booklet/locale-chunks/booklet-locale-es.d.ts +3 -0
- package/dist/booklet/locale-chunks/booklet-locale-fr.d.ts +3 -0
- package/dist/booklet/locale-chunks/booklet-locale-he.d.ts +3 -0
- package/dist/booklet/locale-chunks/booklet-locale-it.d.ts +3 -0
- package/dist/booklet/locale-chunks/booklet-locale-nl.d.ts +3 -0
- package/dist/booklet/locale-chunks/booklet-locale-pl.d.ts +3 -0
- package/dist/booklet/locale-chunks/booklet-locale-pt.d.ts +3 -0
- package/dist/booklet/locale-chunks/booklet-locale-zh.d.ts +3 -0
- package/dist/booklet.cjs +1 -1
- package/dist/booklet.mjs +1 -1
- package/dist/feature-chunks/booklet-logo-draw.cjs +1 -0
- package/dist/feature-chunks/booklet-logo-draw.mjs +1 -0
- package/dist/feature-chunks/booklet-timeline-raster.cjs +1 -0
- package/dist/feature-chunks/booklet-timeline-raster.mjs +1 -0
- package/dist/font-chunks/booklet-pdf-font-bytes-ar.cjs +1 -0
- package/dist/font-chunks/booklet-pdf-font-bytes-ar.mjs +1 -0
- package/dist/font-chunks/booklet-pdf-font-bytes-he.cjs +1 -0
- package/dist/font-chunks/booklet-pdf-font-bytes-he.mjs +1 -0
- package/dist/font-chunks/booklet-pdf-font-bytes-zh-ext.cjs +1 -0
- package/dist/font-chunks/booklet-pdf-font-bytes-zh-ext.mjs +1 -0
- package/dist/font-chunks/booklet-pdf-font-bytes-zh.cjs +1 -0
- package/dist/font-chunks/booklet-pdf-font-bytes-zh.mjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/locale-chunks/booklet-locale-ar.cjs +1 -0
- package/dist/locale-chunks/booklet-locale-ar.mjs +1 -0
- package/dist/locale-chunks/booklet-locale-de.cjs +1 -0
- package/dist/locale-chunks/booklet-locale-de.mjs +1 -0
- package/dist/locale-chunks/booklet-locale-en.cjs +1 -0
- package/dist/locale-chunks/booklet-locale-en.mjs +1 -0
- package/dist/locale-chunks/booklet-locale-es.cjs +1 -0
- package/dist/locale-chunks/booklet-locale-es.mjs +1 -0
- package/dist/locale-chunks/booklet-locale-fr.cjs +1 -0
- package/dist/locale-chunks/booklet-locale-fr.mjs +1 -0
- package/dist/locale-chunks/booklet-locale-he.cjs +1 -0
- package/dist/locale-chunks/booklet-locale-he.mjs +1 -0
- package/dist/locale-chunks/booklet-locale-it.cjs +1 -0
- package/dist/locale-chunks/booklet-locale-it.mjs +1 -0
- package/dist/locale-chunks/booklet-locale-nl.cjs +1 -0
- package/dist/locale-chunks/booklet-locale-nl.mjs +1 -0
- package/dist/locale-chunks/booklet-locale-pl.cjs +1 -0
- package/dist/locale-chunks/booklet-locale-pl.mjs +1 -0
- package/dist/locale-chunks/booklet-locale-pt.cjs +1 -0
- package/dist/locale-chunks/booklet-locale-pt.mjs +1 -0
- package/dist/locale-chunks/booklet-locale-zh.cjs +1 -0
- package/dist/locale-chunks/booklet-locale-zh.mjs +1 -0
- package/dist/version.d.ts +1 -1
- package/package.json +104 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes of gedcom-ts
|
|
4
4
|
|
|
5
|
+
## [2026.5.4] - 2026-05-24
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **Livret multilingue** : traductions dédiées pour les 11 langues du site (`en`, `fr`, `de`, `nl`, `es`, `zh`, `it`, `pt`, `pl`, `ar`, `he`) — messages PDF, dates, lieux, accords de genre et récits narratifs.
|
|
10
|
+
- **RTL arabe / hébreu** : `isBookletLocaleRtl`, `bookletTextDirection`, mise en page PDF miroir ; **`bidi-js`** (réordonnancement visuel) et **`naqqash`** (formes contextuelles arabes).
|
|
11
|
+
- **Polices PDF intégrées** : Noto Sans Hebrew, Noto Sans Arabic et Noto Sans SC (subset, SIL OFL) en chunks lazy (`dist/font-chunks/`) ; chunk **`booklet-pdf-font-bytes-zh-ext`** (~1,4 MiB) si le GEDCOM contient des hanzi hors subset de base.
|
|
12
|
+
- **Rendu bi-police** : Helvetica pour le latin + Noto pour arabe / hébreu / chinois.
|
|
13
|
+
- **Architecture lazy du livret** : locales (`dist/locale-chunks/`), polices, logo SVG et frise canvas (`dist/feature-chunks/`) via `import()` — cœur `gedcom-ts/booklet` ~75 KiB minifié (~100 KiB obfusqué).
|
|
14
|
+
- **Exports TypeScript des chunks** : chaque sous-chemin `gedcom-ts/booklet/locale-chunks/*`, `font-chunks/*` et `feature-chunks/*` expose `types` + `import` / `require`.
|
|
15
|
+
- **Manifeste unique** : `scripts/booklet-chunk-manifest.mjs` alimente `build.js` et `package.json` (`npm run sync:exports` ou fin de `build:js`).
|
|
16
|
+
- **API hôte** : `registerBookletPdfFontBytes`, `registerPdfFontkit`, `ensureBookletLocale` — preload explicite des chunks (recommandé Vite/Angular).
|
|
17
|
+
- **Scripts** : `prepare:locales`, `prepare:fonts`, `sync:exports`.
|
|
18
|
+
- **Exports** : `BOOKLET_LOCALES`, `BOOKLET_RTL_LOCALES`, `isBookletLocale`, `preparePdfText`, `PdfTextOptions`, `loadBookletPdfFontBytes`, `localeNeedsUnicodePdfFont`, …
|
|
19
|
+
- **Tests** : `tests/booklet/` (i18n, RTL, polices ar/zh, bidi, chunk exports, dist imports).
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- **`pdf-lib` externalisé** : peer dependency ; `@pdf-lib/fontkit` chargé à la demande pour `zh` / `ar` / `he`.
|
|
24
|
+
- **Pipeline build livret** : esbuild → réécriture `./…-chunks/` → `gedcom-ts/booklet/…-chunks/` → obfuscation avec `reservedStrings` sur les chemins d’import dynamiques (analyse statique Vite).
|
|
25
|
+
- **`resolveBookletLocale`** : retourne la locale demandée (plus de repli silencieux vers l’anglais).
|
|
26
|
+
- **`drawGedcomTsLogoOnPage`** : async ; logo lazy (`getGedcomTsLogoPaths()`).
|
|
27
|
+
- **`ensureBookletLocale(locale)`** requis avant les APIs sync.
|
|
28
|
+
- **Frise chronologique** : titre et libellé « dates inconnues » localisés.
|
|
29
|
+
- **README** : tableau des tailles, guide d’intégration Vite/Angular.
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
|
|
33
|
+
- **Vite / Angular dev** : imports dynamiques relatifs pré-bundleés dans le cache deps — chemins package explicites dans `dist/booklet.mjs` + `exports` complets.
|
|
34
|
+
|
|
5
35
|
## [2026.5.3] - 2026-05-16
|
|
6
36
|
|
|
7
37
|
### Added
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
- edit the model in-place through a fluent, chainable API (`editPerson`, `editAct`, …)
|
|
8
8
|
- export data back to GEDCOM (`.ged`) or GEDZIP (`.zip`)
|
|
9
9
|
- geocode event places (OpenStreetMap / Nominatim) and group similar city names
|
|
10
|
-
- generate a **genealogy booklet** as PDF (`gedcom-ts/booklet`,
|
|
10
|
+
- generate a **genealogy booklet** as PDF (`gedcom-ts/booklet`, 11 locales including RTL Arabic/Hebrew)
|
|
11
11
|
|
|
12
12
|
## Live demo
|
|
13
13
|
|
|
@@ -28,7 +28,7 @@ A graphical demo showcasing the public API (import a `.ged` / `.zip`, browse the
|
|
|
28
28
|
- Version format **CalVer** `AAAA.M.micro` (e.g. `2026.5.3` = May 2026). See [CHANGELOG.md](CHANGELOG.md).
|
|
29
29
|
- Entry points:
|
|
30
30
|
- **`gedcom-ts`** — import, model, edit layer, export, geocoding
|
|
31
|
-
- **`gedcom-ts/booklet`** — PDF livret (`pdf-lib`
|
|
31
|
+
- **`gedcom-ts/booklet`** — PDF livret (`pdf-lib` en peerDependency, chargé depuis `node_modules`)
|
|
32
32
|
|
|
33
33
|
## Installation
|
|
34
34
|
|
|
@@ -36,7 +36,13 @@ A graphical demo showcasing the public API (import a `.ged` / `.zip`, browse the
|
|
|
36
36
|
npm install gedcom-ts
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
Both entry points come from the same package
|
|
39
|
+
Both entry points come from the same package. For the PDF booklet, **`pdf-lib` is a peer dependency** — install it in your app if you use `gedcom-ts/booklet`:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install pdf-lib
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
For `zh` / `ar` / `he` PDF output, your bundler should also be able to resolve `@pdf-lib/fontkit` (included in `gedcom-ts` dependencies; the host app typically preloads it — see [Bundle layout](#bundle-layout) below).
|
|
40
46
|
|
|
41
47
|
## Runtime Requirements
|
|
42
48
|
|
|
@@ -193,19 +199,69 @@ The legacy callback `getCityCoordinates` is deprecated — use the flow above.
|
|
|
193
199
|
|
|
194
200
|
## Genealogy booklet (PDF)
|
|
195
201
|
|
|
196
|
-
The **`gedcom-ts/booklet`** subpath builds a printable family booklet: cover page, table of contents, chapters by generation (Sosa), family sheets, and
|
|
202
|
+
The **`gedcom-ts/booklet`** subpath builds a printable family booklet: cover page, table of contents, chapters by generation (Sosa), family sheets, and narrative text from GEDCOM acts (birth, marriage, death, …). **English is the default locale** (`DEFAULT_BOOKLET_LOCALE`). Full copy is available for **`en`**, **`fr`**, **`de`**, **`nl`**, **`es`**, **`zh`**, **`it`**, **`pt`**, **`pl`**, **`ar`**, and **`he`** (aligned with [gedcomts.com](https://gedcomts.com) UI languages). Arabic and Hebrew use **RTL layout** in the PDF (`isBookletLocaleRtl`, `bookletTextDirection`).
|
|
203
|
+
|
|
204
|
+
### Bundle layout
|
|
205
|
+
|
|
206
|
+
Code is split so the host app only downloads what it uses. Approximate sizes after minify (obfuscation adds ~25–30 KiB on `gedcom-ts/booklet`).
|
|
207
|
+
|
|
208
|
+
| Artifact | Size (typ.) | When loaded |
|
|
209
|
+
| --- | ---: | --- |
|
|
210
|
+
| `gedcom-ts` (`dist/index.mjs`) | ~180 KiB | GEDCOM import / edit / export |
|
|
211
|
+
| `gedcom-ts/booklet` (`dist/booklet.mjs`) | ~100 KiB | livret (collect, estimate, PDF) |
|
|
212
|
+
| `locale-chunks/booklet-locale-*` | 14–26 KiB | one UI language |
|
|
213
|
+
| `feature-chunks/booklet-logo-draw` | ~11 KiB | cover logo (`coverLogo !== false`) |
|
|
214
|
+
| `feature-chunks/booklet-timeline-raster` | ~3 KiB | `timelineStyle: "canvas"` |
|
|
215
|
+
| `font-chunks/booklet-pdf-font-bytes-ar` | ~43 KiB | Arabic PDF |
|
|
216
|
+
| `font-chunks/booklet-pdf-font-bytes-he` | ~13 KiB | Hebrew PDF |
|
|
217
|
+
| `font-chunks/booklet-pdf-font-bytes-zh` | ~190 KiB | Chinese PDF (base subset) |
|
|
218
|
+
| `font-chunks/booklet-pdf-font-bytes-zh-ext` | ~1.4 MiB | Chinese PDF when GEDCOM names need extra Han |
|
|
219
|
+
| `pdf-lib` (peer, not in gedcom-ts) | ~500 KiB+ | any PDF generation |
|
|
220
|
+
|
|
221
|
+
**Not bundled in gedcom-ts:** `fflate` (main entry, external), `pdf-lib` (booklet peer). **`bidi-js`** and **`naqqash`** (Arabic shaping / RTL reordering) ship inside `gedcom-ts/booklet` today.
|
|
222
|
+
|
|
223
|
+
Call **`await ensureBookletLocale(locale)`** before sync APIs. `generateGenealogyBookletPdf` preloads locale, logo, and timeline when needed.
|
|
224
|
+
|
|
225
|
+
**Lazy chunk subpaths** (for bundler preload or explicit `import()` — normal apps should use `ensureBookletLocale()` instead):
|
|
226
|
+
|
|
227
|
+
| Subpath | Role |
|
|
228
|
+
| --- | --- |
|
|
229
|
+
| `gedcom-ts/booklet/locale-chunks/booklet-locale-{en,fr,de,nl,es,zh,it,pt,pl,ar,he}` | Messages, narratives, date/place helpers per locale |
|
|
230
|
+
| `gedcom-ts/booklet/font-chunks/booklet-pdf-font-bytes-{ar,he,zh,zh-ext}` | Subset Noto font bytes |
|
|
231
|
+
| `gedcom-ts/booklet/feature-chunks/booklet-logo-draw` | Cover logo SVG paths |
|
|
232
|
+
| `gedcom-ts/booklet/feature-chunks/booklet-timeline-raster` | Canvas timeline PNG rasterizer |
|
|
233
|
+
|
|
234
|
+
Each subpath is listed in `package.json` **`exports`** with matching **`types`** (`.d.ts` under `dist/booklet/…`) and runtime (`.mjs` / `.cjs` under `dist/…`). TypeScript resolves them via `exports.types` (`moduleResolution: bundler` / `node16`). Adding a locale updates `scripts/booklet-chunk-manifest.mjs`; `npm run build:js` regenerates chunk files and syncs `exports`.
|
|
235
|
+
|
|
236
|
+
### Vite / Angular integration
|
|
237
|
+
|
|
238
|
+
1. **Lazy-load the booklet entry** — `import('gedcom-ts/booklet')` only when the user opens export / download (not on every tree page).
|
|
239
|
+
2. **Preload the UI locale** — `import('gedcom-ts/booklet/locale-chunks/booklet-locale-fr')` (or your loader) before sync APIs; then `ensureBookletLocale('fr')`.
|
|
240
|
+
3. **Unicode PDF (`zh` / `ar` / `he`)** — the host app should import font chunks explicitly and call `registerBookletPdfFontBytes` + `registerPdfFontkit` before `generateGenealogyBookletPdf` (see [gedcomts.com](https://gedcomts.com) `booklet-pdf-deps.loader.ts` for a reference pattern).
|
|
241
|
+
4. **Dev server** — exclude the main booklet bundle from Vite pre-bundling so lazy subpaths resolve via `node_modules`:
|
|
242
|
+
|
|
243
|
+
```ts
|
|
244
|
+
// vite.config.ts / angular.json (esbuild optimizeDeps)
|
|
245
|
+
optimizeDeps: {
|
|
246
|
+
exclude: ["gedcom-ts/booklet"],
|
|
247
|
+
},
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Published `dist/booklet.mjs` keeps **literal** dynamic `import('gedcom-ts/booklet/…')` strings (rewrite before obfuscation, paths reserved from string encoding) so Vite can statically analyze chunk loads.
|
|
197
251
|
|
|
198
252
|
### Workflow
|
|
199
253
|
|
|
200
254
|
1. Import with `importGedFile` (`gedcom-ts`).
|
|
201
|
-
2.
|
|
202
|
-
3.
|
|
203
|
-
4.
|
|
255
|
+
2. **`await ensureBookletLocale(locale)`** — load messages/narratives for the chosen language.
|
|
256
|
+
3. Collect persons with `collectBookletPersons` (`gedcom-ts/booklet`).
|
|
257
|
+
4. Optionally preview size with `estimateBookletSize` + `groupBookletIntoChapters`.
|
|
258
|
+
5. Build bytes with `generateGenealogyBookletPdf`, then `downloadBookletPdf` (browser).
|
|
204
259
|
|
|
205
260
|
```ts
|
|
206
261
|
import { importGedFile } from "gedcom-ts";
|
|
207
262
|
import {
|
|
208
263
|
collectBookletPersons,
|
|
264
|
+
ensureBookletLocale,
|
|
209
265
|
groupBookletIntoChapters,
|
|
210
266
|
estimateBookletSize,
|
|
211
267
|
generateGenealogyBookletPdf,
|
|
@@ -217,23 +273,27 @@ async function exportBooklet(file: File) {
|
|
|
217
273
|
const ged = await importGedFile(file);
|
|
218
274
|
const root = ged.persons[0] ?? null;
|
|
219
275
|
|
|
276
|
+
const locale = "en" as const; // BookletLocale — align with your UI language (en, fr, de, nl, es, zh, it, pt, pl, ar, he)
|
|
277
|
+
await ensureBookletLocale(locale);
|
|
278
|
+
|
|
220
279
|
const entries = collectBookletPersons({
|
|
221
280
|
ged,
|
|
222
281
|
scope: "from-reference",
|
|
223
282
|
referencePerson: root,
|
|
224
283
|
maxGeneration: 6,
|
|
284
|
+
locale,
|
|
225
285
|
});
|
|
226
286
|
|
|
227
|
-
const chapters = groupBookletIntoChapters(entries);
|
|
287
|
+
const chapters = groupBookletIntoChapters(entries, locale);
|
|
228
288
|
const families = chapters.reduce((n, ch) => n + ch.families.length, 0);
|
|
229
|
-
const size = estimateBookletSize(chapters, entries.length, families, "summary", "canvas");
|
|
289
|
+
const size = estimateBookletSize(chapters, entries.length, families, "summary", "canvas", locale);
|
|
230
290
|
console.log(size.label);
|
|
231
291
|
|
|
232
292
|
const pdf = await generateGenealogyBookletPdf(
|
|
233
293
|
entries,
|
|
234
294
|
{
|
|
235
|
-
title: "
|
|
236
|
-
scopeLabel: "
|
|
295
|
+
title: "Family booklet",
|
|
296
|
+
scopeLabel: "Ancestors and descendants",
|
|
237
297
|
personCount: entries.length,
|
|
238
298
|
referenceName: root ? personDisplayName(root) : undefined,
|
|
239
299
|
},
|
|
@@ -241,10 +301,11 @@ async function exportBooklet(file: File) {
|
|
|
241
301
|
detailLevel: "summary",
|
|
242
302
|
timelineStyle: "canvas",
|
|
243
303
|
coverLogo: true,
|
|
304
|
+
locale,
|
|
244
305
|
},
|
|
245
306
|
);
|
|
246
307
|
|
|
247
|
-
downloadBookletPdf(pdf, "
|
|
308
|
+
downloadBookletPdf(pdf, "family-booklet.pdf");
|
|
248
309
|
}
|
|
249
310
|
```
|
|
250
311
|
|
|
@@ -258,8 +319,9 @@ Use `scope: "all"` and `referencePerson: null` to include every individual in th
|
|
|
258
319
|
| `scope` | `"all"` or `"from-reference"` (Sosa from `referencePerson`) |
|
|
259
320
|
| `referencePerson` | Root person for `"from-reference"`; `null` if scope is `"all"` |
|
|
260
321
|
| `maxGeneration` | Max Sosa generation (e.g. `6`); ignored when `scope === "all"` |
|
|
322
|
+
| `locale` | `BookletLocale` (default `"en"`) — `en`, `fr`, `de`, `nl`, `es`, `zh`, `it`, `pt`, `pl`, `ar`, `he` |
|
|
261
323
|
|
|
262
|
-
Helpers: `personDisplayName`, `buildBookletPersonEntry`, `sortBookletEntries`, `bookletSexFromPerson`.
|
|
324
|
+
Helpers: `personDisplayName`, `buildBookletPersonEntry`, `sortBookletEntries`, `bookletSexFromPerson`, `DEFAULT_BOOKLET_LOCALE`, `BOOKLET_LOCALES`, `isBookletLocaleRtl`.
|
|
263
325
|
|
|
264
326
|
### `generateGenealogyBookletPdf` options
|
|
265
327
|
|
|
@@ -268,24 +330,27 @@ Helpers: `personDisplayName`, `buildBookletPersonEntry`, `sortBookletEntries`, `
|
|
|
268
330
|
| `detailLevel` | `"summary"` \| `"detailed"` | Short prose per person vs longer biographies |
|
|
269
331
|
| `timelineStyle` | `"off"` \| `"canvas"` | Generation timeline pages per chapter |
|
|
270
332
|
| `coverLogo` | `true` (default), `false`, or `DrawGedcomTsLogoOptions` | gedcom-ts vector logo on the cover |
|
|
333
|
+
| `locale` | `BookletLocale` (default `"en"`) | Narrative, chapter titles, PDF chrome, timeline legend |
|
|
334
|
+
| `unicodeFont` | `Uint8Array` (optional) | Replace bundled Noto font for `zh` / `ar` / `he` |
|
|
271
335
|
|
|
272
|
-
`BookletPdfMeta`: `title`, `scopeLabel`, `personCount`, optional `referenceName
|
|
336
|
+
`BookletPdfMeta`: `title`, `scopeLabel`, `personCount`, optional `referenceName` (usually translated in the host app).
|
|
273
337
|
|
|
274
338
|
### Cover logo
|
|
275
339
|
|
|
276
|
-
The cover draws the **gedcom-ts logo** from
|
|
340
|
+
The cover draws the **gedcom-ts logo** from lazy-loaded SVG paths (`ensureBookletLogo`, `getGedcomTsLogoPaths`, `getGedcomTsLogoViewbox`). Reuse on custom PDF pages:
|
|
277
341
|
|
|
278
342
|
```ts
|
|
279
343
|
import { PDFDocument } from "pdf-lib";
|
|
280
344
|
import {
|
|
281
345
|
drawGedcomTsLogoOnPage,
|
|
282
346
|
defaultCoverLogoOptions,
|
|
283
|
-
|
|
347
|
+
ensureBookletLogo,
|
|
284
348
|
} from "gedcom-ts/booklet";
|
|
285
349
|
|
|
286
350
|
const doc = await PDFDocument.create();
|
|
287
351
|
const page = doc.addPage();
|
|
288
|
-
|
|
352
|
+
await ensureBookletLogo();
|
|
353
|
+
await drawGedcomTsLogoOnPage(page, defaultCoverLogoOptions());
|
|
289
354
|
```
|
|
290
355
|
|
|
291
356
|
### Booklet API cheat sheet
|
|
@@ -294,11 +359,13 @@ drawGedcomTsLogoOnPage(page, defaultCoverLogoOptions());
|
|
|
294
359
|
| --- | --- |
|
|
295
360
|
| Persons for the booklet | `collectBookletPersons` |
|
|
296
361
|
| Chapters / families | `groupBookletIntoChapters`, `partnerNamesLabel` |
|
|
297
|
-
|
|
|
362
|
+
| Localized narratives (custom UI) | `buildPersonSummaryNarrative`, `buildPersonDetailedNarratives`, `buildFamilyNarrative`, `buildChapterIntroNarrative` |
|
|
298
363
|
| Page estimate | `estimateBookletSize`, `bookletSizeAdvice` |
|
|
299
364
|
| Timeline data / PNG | `buildGenerationTimeline`, `rasterizeGenerationTimelinePng` |
|
|
300
|
-
| PDF output | `generateGenealogyBookletPdf`, `downloadBookletPdf`, `toPdfText` |
|
|
301
|
-
|
|
|
365
|
+
| PDF output | `generateGenealogyBookletPdf`, `downloadBookletPdf`, `toPdfText`, `preparePdfText` |
|
|
366
|
+
| Locale helpers | `resolveBookletLocale`, `bookletLocaleToBcp47`, `bookletTextDirection`, `BOOKLET_RTL_LOCALES`, `ensureBookletLocale` |
|
|
367
|
+
| Font preload (host) | `registerBookletPdfFontBytes`, `registerPdfFontkit`, `localeNeedsUnicodePdfFont` |
|
|
368
|
+
| Logo | `ensureBookletLogo`, `drawGedcomTsLogoOnPage`, `getGedcomTsLogoPaths`, `defaultCoverLogoOptions` |
|
|
302
369
|
|
|
303
370
|
## API reference
|
|
304
371
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const BOOKLET_UNKNOWN_DATE_EN = "Unknown date";
|
|
2
|
+
/** Year-only date (optional GEDCOM qualifier). */
|
|
3
|
+
export declare function isYearOnlyDate(dateLabel: string): boolean;
|
|
4
|
+
/** "on 15 March 1991", "in 1991", "about 1700", "before 1800", etc. */
|
|
5
|
+
export declare function onDate(dateLabel: string): string;
|
|
6
|
+
/** "From 1700 to 1850" or "From 15 March 1700 to 3 January 1850". */
|
|
7
|
+
export declare function lifeDateRange(from: string, to: string): string;
|
|
8
|
+
/** "was born in 1991" or "was born on 15 March 1991". */
|
|
9
|
+
export declare function seesDayOn(dateLabel: string): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface BookletDateConfig {
|
|
2
|
+
readonly unknownDate: string;
|
|
3
|
+
readonly onUnknown: string;
|
|
4
|
+
readonly inYear: (year: string) => string;
|
|
5
|
+
readonly beforeYear: (year: string) => string;
|
|
6
|
+
readonly afterYear: (year: string) => string;
|
|
7
|
+
readonly aboutYear: (year: string) => string;
|
|
8
|
+
readonly onFullDate: (date: string) => string;
|
|
9
|
+
readonly lifeRange: (from: string, to: string, fromIsYearOnly: boolean) => string;
|
|
10
|
+
readonly seesDayInYear: (year: string) => string;
|
|
11
|
+
readonly seesDayOnPhrase: (phrase: string) => string;
|
|
12
|
+
readonly seesDayOnFullDate: (date: string) => string;
|
|
13
|
+
}
|
|
14
|
+
export interface BookletDateModule {
|
|
15
|
+
readonly BOOKLET_UNKNOWN_DATE: string;
|
|
16
|
+
isYearOnlyDate(dateLabel: string): boolean;
|
|
17
|
+
onDate(dateLabel: string): string;
|
|
18
|
+
lifeDateRange(from: string, to: string): string;
|
|
19
|
+
seesDayOn(dateLabel: string): string;
|
|
20
|
+
}
|
|
21
|
+
export declare function createBookletDateModule(config: BookletDateConfig): BookletDateModule;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare const BOOKLET_UNKNOWN_DATE_FR = "Date inconnue";
|
|
1
2
|
/** Date réduite à une année (éventuellement avec qualificateur GEDCOM). */
|
|
2
3
|
export declare function isYearOnlyDate(dateLabel: string): boolean;
|
|
3
4
|
/** « le 15 mars 1991 », « en 1991 », « vers 1700 », « avant 1800 »… */
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { BookletLocale } from "./booklet-locale";
|
|
2
|
+
export declare function unknownDateLabel(locale?: BookletLocale): string;
|
|
3
|
+
export declare function isYearOnlyDate(dateLabel: string, locale?: BookletLocale): boolean;
|
|
4
|
+
export declare function onDate(dateLabel: string, locale?: BookletLocale): string;
|
|
5
|
+
export declare function lifeDateRange(from: string, to: string, locale?: BookletLocale): string;
|
|
6
|
+
export declare function seesDayOn(dateLabel: string, locale?: BookletLocale): string;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { BookletTimelineStyle } from './booklet-timeline';
|
|
2
2
|
import type { BookletChapter, BookletDetailLevel } from './booklet-structure';
|
|
3
|
+
import type { BookletLocale } from './booklet-locale';
|
|
3
4
|
export interface BookletSizeEstimate {
|
|
4
5
|
readonly pages: number;
|
|
5
6
|
readonly label: string;
|
|
6
7
|
}
|
|
7
8
|
/** Nombre de pages frise estimé pour un chapitre (tranches dynamiques). */
|
|
8
9
|
export declare function estimateTimelineSliceCount(rowCount: number): number;
|
|
9
|
-
/** Estimation grossière du nombre de pages pour orienter l
|
|
10
|
-
export declare function estimateBookletSize(chapters: readonly BookletChapter[], personCount: number, familyCount: number, detailLevel: BookletDetailLevel, timelineStyle?: BookletTimelineStyle): BookletSizeEstimate;
|
|
11
|
-
export declare function bookletSizeAdvice(personCount: number, detailLevel: BookletDetailLevel): string | null;
|
|
10
|
+
/** Estimation grossière du nombre de pages pour orienter l'utilisateur. */
|
|
11
|
+
export declare function estimateBookletSize(chapters: readonly BookletChapter[], personCount: number, familyCount: number, detailLevel: BookletDetailLevel, timelineStyle?: BookletTimelineStyle, locale?: BookletLocale): BookletSizeEstimate;
|
|
12
|
+
export declare function bookletSizeAdvice(personCount: number, detailLevel: BookletDetailLevel, locale?: BookletLocale): string | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BookletLocale } from './booklet-locale';
|
|
2
|
+
import type { BookletSex, PersonGenderWords } from './booklet-gender';
|
|
3
|
+
export interface GenderPhraseBundle {
|
|
4
|
+
readonly recensedChildren: (count: number) => string;
|
|
5
|
+
readonly otherUnions: (count: number) => string;
|
|
6
|
+
readonly usesPluralS: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const GENDER_WORDS: Partial<Record<BookletLocale, Record<BookletSex, PersonGenderWords>>>;
|
|
9
|
+
export declare const GENDER_PHRASES: Partial<Record<BookletLocale, GenderPhraseBundle>>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BookletLocale } from './booklet-locale';
|
|
1
2
|
/** Sexe GEDCOM exploité pour les accords du livret (M, F, U, X). */
|
|
2
3
|
export type BookletSex = 'M' | 'F' | 'U' | 'X';
|
|
3
4
|
export interface PersonGenderWords {
|
|
@@ -11,13 +12,11 @@ export interface PersonGenderWords {
|
|
|
11
12
|
readonly childOf: string;
|
|
12
13
|
readonly parentOf: string;
|
|
13
14
|
}
|
|
14
|
-
/**
|
|
15
|
-
export declare function personGenderWords(sex: BookletSex): PersonGenderWords;
|
|
16
|
-
/**
|
|
17
|
-
export declare function pluralS(count: number): string;
|
|
18
|
-
/**
|
|
15
|
+
/** Participles / role words aligned with the person's sex. U and X use neutral forms. */
|
|
16
|
+
export declare function personGenderWords(sex: BookletSex, locale?: BookletLocale): PersonGenderWords;
|
|
17
|
+
/** Plural suffix (French-style locales: 0 or 1 → singular; English: unused). */
|
|
18
|
+
export declare function pluralS(count: number, locale?: BookletLocale): string;
|
|
19
|
+
/** Singular / plural pick. */
|
|
19
20
|
export declare function pluralPick<T>(count: number, one: T, many: T): T;
|
|
20
|
-
|
|
21
|
-
export declare function
|
|
22
|
-
/** « 1 autre union citée… » / « N autres unions citées… ». */
|
|
23
|
-
export declare function otherUnionsPhrase(count: number): string;
|
|
21
|
+
export declare function recensedChildrenPhrase(count: number, locale?: BookletLocale): string;
|
|
22
|
+
export declare function otherUnionsPhrase(count: number, locale?: BookletLocale): string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Shared place-prefix helpers for locale date/place modules. */
|
|
2
|
+
export declare function hasCountryPrefix(core: string, prefixes: readonly string[]): boolean;
|
|
3
|
+
export declare function prefixedLocation(core: string, prefixes: readonly string[], elsePrefix: string): string;
|
|
4
|
+
export declare function commaPrefixedLocation(core: string, prefixes: readonly string[], elsePrefix: string): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { BookletDateModule } from './booklet-date-factory';
|
|
2
|
+
import type { BookletPlaceModule } from './booklet-place-factory';
|
|
3
|
+
import type { BookletSex, PersonGenderWords } from './booklet-gender';
|
|
4
|
+
import type { GenderPhraseBundle } from './booklet-gender-data';
|
|
5
|
+
import type { BookletLocale } from './booklet-locale';
|
|
6
|
+
import type { BookletMessages } from './booklet-messages-types';
|
|
7
|
+
import type { NarrativeModule } from './booklet-narrative-engine';
|
|
8
|
+
export interface BookletLocaleBundle {
|
|
9
|
+
readonly messages: BookletMessages;
|
|
10
|
+
readonly genderWords: Record<BookletSex, PersonGenderWords>;
|
|
11
|
+
readonly genderPhrases?: GenderPhraseBundle;
|
|
12
|
+
readonly dateModule: BookletDateModule;
|
|
13
|
+
readonly placeModule: BookletPlaceModule;
|
|
14
|
+
readonly narrativeModule: NarrativeModule;
|
|
15
|
+
}
|
|
16
|
+
export declare class BookletLocaleNotLoadedError extends Error {
|
|
17
|
+
constructor(locale: BookletLocale);
|
|
18
|
+
}
|
|
19
|
+
/** Clears cached locale bundles (tests). */
|
|
20
|
+
export declare function clearBookletLocaleCache(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Lazy-loads messages, gender, date/place, and narrative modules for one locale.
|
|
23
|
+
* Required before sync APIs (`getBookletMessages`, `collectBookletPersons`, …).
|
|
24
|
+
*/
|
|
25
|
+
export declare function ensureBookletLocale(locale?: BookletLocale): Promise<BookletLocale>;
|
|
26
|
+
export declare function getBookletLocaleBundle(locale: BookletLocale): BookletLocaleBundle;
|
|
27
|
+
export declare function isBookletLocaleLoaded(locale: BookletLocale): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BookletLocale } from './booklet-locale';
|
|
2
|
+
export declare function getBookletDateModule(locale: BookletLocale): import("./booklet-date-factory").BookletDateModule;
|
|
3
|
+
export declare function getBookletPlaceModule(locale: BookletLocale): import("./booklet-place-factory").BookletPlaceModule;
|
|
4
|
+
export declare function getBookletDateModuleIfLoaded(locale?: BookletLocale): import("./booklet-date-factory").BookletDateModule;
|
|
5
|
+
export declare function getBookletPlaceModuleIfLoaded(locale?: BookletLocale): import("./booklet-place-factory").BookletPlaceModule;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Booklet narrative / PDF locales (aligned with gedcomts.com site languages). */
|
|
2
|
+
export type BookletLocale = 'en' | 'fr' | 'de' | 'nl' | 'es' | 'zh' | 'it' | 'pt' | 'pl' | 'ar' | 'he';
|
|
3
|
+
export declare const DEFAULT_BOOKLET_LOCALE: BookletLocale;
|
|
4
|
+
export declare const BOOKLET_LOCALES: readonly BookletLocale[];
|
|
5
|
+
/** Locales with full booklet copy (messages, dates, places, gender, narratives). */
|
|
6
|
+
export declare const BOOKLET_LOCALES_IMPLEMENTED: readonly BookletLocale[];
|
|
7
|
+
export declare const BOOKLET_RTL_LOCALES: readonly BookletLocale[];
|
|
8
|
+
export declare function isBookletLocale(value: string | null | undefined): value is BookletLocale;
|
|
9
|
+
export declare function resolveBookletLocale(locale?: BookletLocale): BookletLocale;
|
|
10
|
+
export declare function isBookletLocaleRtl(locale?: BookletLocale): boolean;
|
|
11
|
+
export declare function bookletTextDirection(locale?: BookletLocale): 'ltr' | 'rtl';
|
|
12
|
+
/** BCP 47 tag for `toLocaleDateString` on the PDF cover. */
|
|
13
|
+
export declare function bookletLocaleToBcp47(locale: BookletLocale): string;
|
|
14
|
+
/** `Intl.Collator` / `localeCompare` tag for chapter name ordering. */
|
|
15
|
+
export declare function bookletLocaleCompareTag(locale: BookletLocale): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PDFPage } from 'pdf-lib';
|
|
2
|
+
import type { DrawGedcomTsLogoOptions, GedcomTsLogoLayout } from './booklet-logo';
|
|
3
|
+
export declare function clearBookletLogoCache(): void;
|
|
4
|
+
/** Loads SVG logo paths and draw helper (only when the cover logo is shown). */
|
|
5
|
+
export declare function ensureBookletLogo(): Promise<void>;
|
|
6
|
+
export declare function drawGedcomTsLogoOnPage(page: PDFPage, options?: DrawGedcomTsLogoOptions): Promise<GedcomTsLogoLayout>;
|
|
7
|
+
export declare function getGedcomTsLogoPaths(): Promise<readonly string[]>;
|
|
8
|
+
export declare function getGedcomTsLogoViewbox(): Promise<string>;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export { GEDCOM_TS_LOGO_PATHS, GEDCOM_TS_LOGO_VIEWBOX } from "./gedcom-ts-logo.paths";
|
|
1
|
+
import { type RGB } from 'pdf-lib';
|
|
3
2
|
/** Couleur de marque gedcom-ts (#19196f), pour pdf-lib `rgb(...)`. */
|
|
4
3
|
export declare const BOOKLET_BRAND_RGB: RGB;
|
|
5
4
|
export interface GedcomTsLogoLayout {
|
|
6
|
-
/** Ordonnée PDF du bas du logo (pour placer texte et barre en dessous). */
|
|
7
5
|
readonly bottomY: number;
|
|
8
6
|
readonly height: number;
|
|
9
7
|
}
|
|
@@ -15,5 +13,3 @@ export interface DrawGedcomTsLogoOptions {
|
|
|
15
13
|
}
|
|
16
14
|
/** Options par défaut du logo sur une page A4 (couverture du livret). */
|
|
17
15
|
export declare function defaultCoverLogoOptions(pageWidth?: number, pageHeight?: number): DrawGedcomTsLogoOptions;
|
|
18
|
-
/** Dessine le logo gedcom-ts en vecteur SVG sur la page (pdf-lib drawSvgPath). */
|
|
19
|
-
export declare function drawGedcomTsLogoOnPage(page: PDFPage, options?: DrawGedcomTsLogoOptions): GedcomTsLogoLayout;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { BookletMessages } from './booklet-messages-types';
|
|
2
|
+
import type { BookletLocale } from './booklet-locale';
|
|
3
|
+
export declare const MESSAGES_EN: BookletMessages;
|
|
4
|
+
export declare const MESSAGES_FR: BookletMessages;
|
|
5
|
+
export declare const MESSAGES_DE: BookletMessages;
|
|
6
|
+
export declare const MESSAGES_NL: BookletMessages;
|
|
7
|
+
export declare const MESSAGES_ES: BookletMessages;
|
|
8
|
+
export declare const MESSAGES_ZH: BookletMessages;
|
|
9
|
+
export declare const MESSAGES_IT: BookletMessages;
|
|
10
|
+
export declare const MESSAGES_PT: BookletMessages;
|
|
11
|
+
export declare const MESSAGES_PL: BookletMessages;
|
|
12
|
+
export declare const MESSAGES_AR: BookletMessages;
|
|
13
|
+
export declare const MESSAGES_HE: BookletMessages;
|
|
14
|
+
export declare const BOOKLET_MESSAGES: Record<BookletLocale, BookletMessages>;
|
|
15
|
+
export declare function messagesForLocale(locale: BookletLocale): BookletMessages;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { BookletLocale } from './booklet-locale';
|
|
2
|
+
export interface BookletMessages {
|
|
3
|
+
readonly unknownDates: string;
|
|
4
|
+
readonly unknownDate: string;
|
|
5
|
+
readonly chapterUnknownDates: string;
|
|
6
|
+
readonly generation1Title: string;
|
|
7
|
+
readonly generationTitle: (gen: number) => string;
|
|
8
|
+
readonly letterTitle: (letter: string) => string;
|
|
9
|
+
readonly chapterSubtitle: (count: number, dateRange: string) => string;
|
|
10
|
+
readonly chapterDateAbout: string;
|
|
11
|
+
readonly childrenNone: string;
|
|
12
|
+
readonly childrenMore: (n: number) => string;
|
|
13
|
+
readonly pagesEstimate: (n: number) => string;
|
|
14
|
+
readonly pagesEmpty: string;
|
|
15
|
+
readonly adviceDetailed120: string;
|
|
16
|
+
readonly adviceDetailed50: string;
|
|
17
|
+
readonly adviceSummary25: string;
|
|
18
|
+
readonly actTypeLabels: Partial<Record<string, string>>;
|
|
19
|
+
readonly spouseUnknown: string;
|
|
20
|
+
readonly timelineTitle: (chapterTitle: string) => string;
|
|
21
|
+
readonly timelineUnknownDates: string;
|
|
22
|
+
readonly pdf: {
|
|
23
|
+
readonly coverSubtitle: string;
|
|
24
|
+
readonly referencePerson: (name: string) => string;
|
|
25
|
+
readonly personCount: (n: number) => string;
|
|
26
|
+
readonly localNote: string;
|
|
27
|
+
readonly tocTitle: string;
|
|
28
|
+
readonly modeSummary: string;
|
|
29
|
+
readonly modeDetailed: string;
|
|
30
|
+
readonly contentHeading: string;
|
|
31
|
+
readonly introSummary: string;
|
|
32
|
+
readonly introDetailed: string;
|
|
33
|
+
readonly introSosa: string;
|
|
34
|
+
readonly familyHeading: (names: string) => string;
|
|
35
|
+
readonly generationLabel: (gen: number) => string;
|
|
36
|
+
readonly pageFooter: (n: number) => string;
|
|
37
|
+
};
|
|
38
|
+
readonly timeline: {
|
|
39
|
+
readonly legendBirth: string;
|
|
40
|
+
readonly legendDeath: string;
|
|
41
|
+
readonly legendMarriage: string;
|
|
42
|
+
readonly overflow: (n: number) => string;
|
|
43
|
+
readonly continuation: string;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export type { BookletLocale };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BookletLocale } from './booklet-locale';
|
|
2
|
+
export type { BookletMessages } from './booklet-messages-types';
|
|
3
|
+
export { ensureBookletLocale, clearBookletLocaleCache, isBookletLocaleLoaded } from './booklet-locale-loader';
|
|
4
|
+
export declare function getBookletMessages(locale?: BookletLocale): import("./booklet-messages-types").BookletMessages;
|
|
5
|
+
export declare function actTypeLabel(type: string, locale?: BookletLocale): string;
|
|
6
|
+
/** Loads locale data then returns messages (convenience for async call sites). */
|
|
7
|
+
export declare function loadBookletMessages(locale?: BookletLocale): Promise<import("./booklet-messages-types").BookletMessages>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BookletPersonEntry } from './booklet-person';
|
|
2
|
+
import type { BookletChapter, BookletDetailLevel, BookletFamilyUnit } from './booklet-structure';
|
|
3
|
+
/** Chapter: narrative opening sentence. */
|
|
4
|
+
export declare function buildChapterIntroNarrative(chapter: BookletChapter): string;
|
|
5
|
+
/** Family sheet as narrative. */
|
|
6
|
+
export declare function buildFamilyNarrative(family: BookletFamilyUnit, detailLevel: BookletDetailLevel): readonly string[];
|
|
7
|
+
/** Condensed portrait: one flowing paragraph, name cited once. */
|
|
8
|
+
export declare function buildPersonSummaryNarrative(entry: BookletPersonEntry): string;
|
|
9
|
+
/** Detailed portrait: a few paragraphs, without redundant birth/death. */
|
|
10
|
+
export declare function buildPersonDetailedNarratives(entry: BookletPersonEntry): readonly string[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { BookletDateModule } from './booklet-date-factory';
|
|
2
|
+
import type { BookletPlaceModule } from './booklet-place-factory';
|
|
3
|
+
import type { BookletLocale } from './booklet-locale';
|
|
4
|
+
import type { NarrativeStrings } from './booklet-narrative-i18n';
|
|
5
|
+
import type { BookletPersonEntry } from './booklet-person';
|
|
6
|
+
import type { BookletChapter, BookletDetailLevel, BookletFamilyUnit } from './booklet-structure';
|
|
7
|
+
export interface NarrativeModule {
|
|
8
|
+
buildChapterIntroNarrative: (chapter: BookletChapter) => string;
|
|
9
|
+
buildFamilyNarrative: (family: BookletFamilyUnit, detailLevel: BookletDetailLevel) => readonly string[];
|
|
10
|
+
buildPersonSummaryNarrative: (entry: BookletPersonEntry) => string;
|
|
11
|
+
buildPersonDetailedNarratives: (entry: BookletPersonEntry) => readonly string[];
|
|
12
|
+
}
|
|
13
|
+
export declare function createNarrativeModule(locale: BookletLocale, strings: NarrativeStrings, deps: {
|
|
14
|
+
readonly dateModule: BookletDateModule;
|
|
15
|
+
readonly placeModule: BookletPlaceModule;
|
|
16
|
+
readonly unknownDates: string;
|
|
17
|
+
}): NarrativeModule;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BookletPersonEntry } from './booklet-person';
|
|
2
|
+
import type { BookletChapter, BookletDetailLevel, BookletFamilyUnit } from './booklet-structure';
|
|
3
|
+
/** Chapitre : phrase d'ouverture narrative. */
|
|
4
|
+
export declare function buildChapterIntroNarrative(chapter: BookletChapter): string;
|
|
5
|
+
/** Fiche famille en récit. */
|
|
6
|
+
export declare function buildFamilyNarrative(family: BookletFamilyUnit, detailLevel: BookletDetailLevel): readonly string[];
|
|
7
|
+
/** Portrait condensé : un paragraphe fluide, nom cité une fois. */
|
|
8
|
+
export declare function buildPersonSummaryNarrative(entry: BookletPersonEntry): string;
|
|
9
|
+
/** Portrait détaillé : peu de paragraphes, sans redondance naissance/décès. */
|
|
10
|
+
export declare function buildPersonDetailedNarratives(entry: BookletPersonEntry): readonly string[];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { BookletLocale } from './booklet-locale';
|
|
2
|
+
import type { PersonGenderWords } from './booklet-gender';
|
|
3
|
+
export type NarrativeI18nLocale = Exclude<BookletLocale, 'en' | 'fr'>;
|
|
4
|
+
export interface NarrativeStrings {
|
|
5
|
+
readonly listConjunction: string;
|
|
6
|
+
readonly defaultAncestor: string;
|
|
7
|
+
readonly parentsSingle: (name: string, g: PersonGenderWords) => readonly string[];
|
|
8
|
+
readonly parentsMultiple: (names: string, g: PersonGenderWords) => readonly string[];
|
|
9
|
+
readonly unionWithMarriage: (spouse: string, marriageEmbed: string) => readonly string[];
|
|
10
|
+
readonly unionWithoutMarriage: (spouse: string, g: PersonGenderWords) => readonly string[];
|
|
11
|
+
readonly unionOneChild: (child: string, g: PersonGenderWords) => readonly string[];
|
|
12
|
+
readonly unionManyChildren: (children: string, g: PersonGenderWords) => readonly string[];
|
|
13
|
+
readonly lifeBornAndDied: (name: string, g: PersonGenderWords, born: string, birthPlace: string, died: string, deathPlace: string, lifeRange: string, rangeLoc: string, seesDay: string, afterBirthLoc: string) => readonly string[];
|
|
14
|
+
readonly lifeBirthOnly: (name: string, g: PersonGenderWords, born: string, where: string, seesDay: string) => readonly string[];
|
|
15
|
+
readonly lifeDeathOnly: (name: string, g: PersonGenderWords, died: string, where: string) => readonly string[];
|
|
16
|
+
readonly lifeApproxDates: (name: string, g: PersonGenderWords, datesLabel: string) => readonly string[];
|
|
17
|
+
readonly eventMarriage: (when: string, where: string) => readonly string[];
|
|
18
|
+
readonly eventDivorce: (when: string, where: string) => string;
|
|
19
|
+
readonly eventBaptism: (when: string, where: string, g: PersonGenderWords) => readonly string[];
|
|
20
|
+
readonly eventBurial: (when: string, where: string) => readonly string[];
|
|
21
|
+
readonly eventCremation: (when: string, where: string) => string;
|
|
22
|
+
readonly eventOccupation: (date: string, atPlace: string) => string;
|
|
23
|
+
readonly chapterGen1: (count: number, plural: string) => readonly string[];
|
|
24
|
+
readonly chapterGenN: (gen: number, count: number, plural: string, range: string) => readonly string[];
|
|
25
|
+
readonly chapterLetter: (title: string, count: number, plural: string, letter: string, range: string) => readonly string[];
|
|
26
|
+
readonly familyCouple: (short1: string, short2: string, full1: string, full2: string) => readonly string[];
|
|
27
|
+
readonly familyUnionWithMarriage: (marriageEmbed: string) => readonly string[];
|
|
28
|
+
readonly familyUnionWithoutMarriage: readonly string[];
|
|
29
|
+
readonly familyNoDescendants: string;
|
|
30
|
+
readonly familyOneChild: (name: string) => readonly string[];
|
|
31
|
+
readonly familyNChildren: (count: number, names: string) => string;
|
|
32
|
+
readonly familyDescendantsList: (names: string) => string;
|
|
33
|
+
readonly familyLoneFigure: (shortName: string, fullName: string) => readonly string[];
|
|
34
|
+
readonly familyMarriageNoted: (marriageEmbed: string) => readonly string[];
|
|
35
|
+
readonly familyDescendantsNoted: (names: string) => readonly string[];
|
|
36
|
+
readonly familyDescendantsRecensed: (recensed: string, names: string) => string;
|
|
37
|
+
readonly personBranchPresent: (name: string, g: PersonGenderWords) => readonly string[];
|
|
38
|
+
readonly personFewRecords: (name: string) => string;
|
|
39
|
+
readonly personResearchHint: string;
|
|
40
|
+
readonly personPortraitIncomplete: (name: string) => string;
|
|
41
|
+
readonly personUnionSection: (clauses: string) => readonly string[];
|
|
42
|
+
readonly personResearchNote: (preview: string) => readonly string[];
|
|
43
|
+
}
|
|
44
|
+
export declare const NARRATIVE_STRINGS: Record<NarrativeI18nLocale, NarrativeStrings>;
|