@heroiclands/package-build 23.12.6 → 23.12.7
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 +12 -0
- package/assets/styles/content-base.css +25 -0
- package/bin/content-commands.mjs +264 -3
- package/bin/package-build.mjs +25 -0
- package/content-config.mjs +72 -0
- package/docs/api.md +10 -9
- package/docs/authoring/links-and-markup.md +439 -47
- package/docs/commands.md +127 -0
- package/docs/configuration.md +66 -3
- package/docs/content-format.md +3 -1
- package/docs/guides/book.md +11 -0
- package/docs/guides/module-project.md +16 -0
- package/docs/guides/site.md +19 -0
- package/docs/reference/format-details.md +372 -6
- package/docs/reference/note-types.md +36 -11
- package/engine/base-compiler.mjs +2 -0
- package/engine/bundles.mjs +7 -2
- package/engine/compile-corpus.mjs +3 -1
- package/engine/content-charset.mjs +21 -2
- package/engine/content-format.yaml +1 -0
- package/engine/content-index.mjs +12 -0
- package/engine/content-poetry.mjs +22 -4
- package/engine/content-scripts.mjs +1219 -0
- package/engine/content-session.mjs +2 -0
- package/engine/data-keys.mjs +5 -1
- package/engine/dictionary-layout.mjs +18 -12
- package/engine/dictionary-rows.mjs +11 -2
- package/engine/helpers.mjs +8 -2
- package/engine/index-records.mjs +1 -0
- package/engine/journals.mjs +14 -3
- package/engine/language-data.mjs +137 -1
- package/engine/language-tag.mjs +103 -0
- package/engine/language-terms.mjs +16 -4
- package/engine/map-lexicon.mjs +762 -0
- package/engine/markup-validation.mjs +17 -3
- package/engine/names.mjs +1 -1
- package/engine/note-vocabulary.mjs +113 -0
- package/engine/pdf-build.mjs +28 -10
- package/engine/pdf-render.mjs +116 -11
- package/engine/run-rows.mjs +119 -0
- package/engine/run-words.mjs +266 -0
- package/engine/scenes.mjs +1 -0
- package/engine/script-font-delivery.mjs +321 -0
- package/engine/script-fonts.mjs +172 -0
- package/engine/site-build.mjs +10 -3
- package/engine/site-config.mjs +5 -0
- package/engine/site-root.mjs +19 -5
- package/engine/sql-tables.mjs +111 -1
- package/engine/text-maps.mjs +607 -0
- package/engine/verb-pattern.mjs +99 -0
- package/engine/word-pattern.mjs +27 -0
- package/engine/word-rows.mjs +8 -2
- package/engine/word-terms.mjs +44 -0
- package/hugo-theme/layouts/_default/baseof.html +3 -0
- package/hugo-theme/static/css/style.css +10 -0
- package/manifest.mjs +9 -1
- package/package.json +1 -1
- package/types/content-config.d.mts +26 -0
- package/types/engine/compile-corpus.d.mts +2 -1
- package/types/engine/content-index.d.mts +11 -3
- package/types/engine/content-poetry.d.mts +7 -0
- package/types/engine/content-scripts.d.mts +226 -0
- package/types/engine/data-keys.d.mts +2 -2
- package/types/engine/dictionary-rows.d.mts +15 -0
- package/types/engine/helpers.d.mts +5 -1
- package/types/engine/journals.d.mts +7 -2
- package/types/engine/language-data.d.mts +2 -0
- package/types/engine/language-tag.d.mts +8 -0
- package/types/engine/language-terms.d.mts +2 -1
- package/types/engine/map-lexicon.d.mts +274 -0
- package/types/engine/markup-validation.d.mts +7 -2
- package/types/engine/pdf-build.d.mts +26 -3
- package/types/engine/pdf-render.d.mts +17 -2
- package/types/engine/run-rows.d.mts +89 -0
- package/types/engine/run-words.d.mts +86 -0
- package/types/engine/script-font-delivery.d.mts +134 -0
- package/types/engine/script-fonts.d.mts +168 -0
- package/types/engine/site-build.d.mts +2 -1
- package/types/engine/site-root.d.mts +11 -3
- package/types/engine/text-maps.d.mts +175 -0
- package/types/engine/verb-pattern.d.mts +65 -0
- package/types/engine/word-pattern.d.mts +13 -0
- package/types/engine/word-terms.d.mts +6 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A word as it is compared: NFC, lowercase, `’` read as `'`.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} word - The word.
|
|
5
|
+
* @returns {string} Its folded form.
|
|
6
|
+
*/
|
|
7
|
+
export function foldWord(word: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* The words a language note accepts of its own: its forms, and what its
|
|
10
|
+
* plural rows, verb pattern and replacing suffixes derive from them.
|
|
11
|
+
*
|
|
12
|
+
* @param {Record<string, any>} data - The language note's `data`.
|
|
13
|
+
* @returns {Set<string>} The words, folded.
|
|
14
|
+
*/
|
|
15
|
+
export function lexiconWords(data: Record<string, any>): Set<string>;
|
|
16
|
+
/**
|
|
17
|
+
* The words of every name a language note registers under a tongue other than
|
|
18
|
+
* `translation`.
|
|
19
|
+
*
|
|
20
|
+
* @param {Record<string, any>|undefined} data - The language note's `data`.
|
|
21
|
+
* @returns {Set<string>} The words, folded.
|
|
22
|
+
*/
|
|
23
|
+
export function registeredNameWords(data: Record<string, any> | undefined): Set<string>;
|
|
24
|
+
/**
|
|
25
|
+
* What a mapped run's words are checked against, for one language.
|
|
26
|
+
*
|
|
27
|
+
* @typedef {object} WordBook
|
|
28
|
+
* @property {string} language - The language's configured name, as `lang=`
|
|
29
|
+
* writes it.
|
|
30
|
+
* @property {(word: string) => boolean} accepts - Whether a folded word is
|
|
31
|
+
* one of the language's.
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* Each configured language's word book: one per language whose `note` names a
|
|
35
|
+
* language note.
|
|
36
|
+
*
|
|
37
|
+
* @param {Iterable<Record<string, any>>|undefined} records - Index records.
|
|
38
|
+
* @param {{languages?: Readonly<Record<string, {tag: string, note?: string}>>, contentPackage?: string}} config -
|
|
39
|
+
* The resolved configuration.
|
|
40
|
+
* @returns {Map<string, WordBook>} The books by language name.
|
|
41
|
+
*/
|
|
42
|
+
export function wordBooksFromRecords(records: Iterable<Record<string, any>> | undefined, config?: {
|
|
43
|
+
languages?: Readonly<Record<string, {
|
|
44
|
+
tag: string;
|
|
45
|
+
note?: string;
|
|
46
|
+
}>>;
|
|
47
|
+
contentPackage?: string;
|
|
48
|
+
}): Map<string, WordBook>;
|
|
49
|
+
/**
|
|
50
|
+
* The words of a text its book does not accept, each once, at the offset of
|
|
51
|
+
* its first character: a compound not accepted whole gives each part that is
|
|
52
|
+
* not.
|
|
53
|
+
*
|
|
54
|
+
* @param {string} text - The text, with no escapes.
|
|
55
|
+
* @param {WordBook} book - The language's book.
|
|
56
|
+
* @param {Set<string>} [said] - The folded words already reported in this
|
|
57
|
+
* run, which are not reported again; updated.
|
|
58
|
+
* @returns {Array<{offset: number, word: string}>} The words, in order.
|
|
59
|
+
*/
|
|
60
|
+
export function unknownWords(text: string, book: WordBook, said?: Set<string>): Array<{
|
|
61
|
+
offset: number;
|
|
62
|
+
word: string;
|
|
63
|
+
}>;
|
|
64
|
+
/**
|
|
65
|
+
* The finding for a word of a mapped run that is not a word of its language.
|
|
66
|
+
*
|
|
67
|
+
* @param {string} word - The word as written.
|
|
68
|
+
* @param {string} language - The language as `lang=` names it.
|
|
69
|
+
* @returns {string} The message.
|
|
70
|
+
*/
|
|
71
|
+
export function unknownWordMessage(word: string, language: string): string;
|
|
72
|
+
/**
|
|
73
|
+
* What a mapped run's words are checked against, for one language.
|
|
74
|
+
*/
|
|
75
|
+
export type WordBook = {
|
|
76
|
+
/**
|
|
77
|
+
* - The language's configured name, as `lang=`
|
|
78
|
+
* writes it.
|
|
79
|
+
*/
|
|
80
|
+
language: string;
|
|
81
|
+
/**
|
|
82
|
+
* - Whether a folded word is
|
|
83
|
+
* one of the language's.
|
|
84
|
+
*/
|
|
85
|
+
accepts: (word: string) => boolean;
|
|
86
|
+
};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The faces the package's notes set text in with `font=`, read from the
|
|
3
|
+
* notes themselves: every Markdown file under the content tree that writes
|
|
4
|
+
* `font=` is scanned for its runs.
|
|
5
|
+
*
|
|
6
|
+
* @param {DeliveryConfig} config - The resolved configuration.
|
|
7
|
+
* @param {import("./script-fonts.mjs").ScriptFonts} installed - The fonts package.
|
|
8
|
+
* @returns {ReadonlySet<string>} The slugs of the faces used.
|
|
9
|
+
*/
|
|
10
|
+
export function facesUsed(config: DeliveryConfig, installed: import("./script-fonts.mjs").ScriptFonts): ReadonlySet<string>;
|
|
11
|
+
/**
|
|
12
|
+
* The files a target receives, as paths relative to the fonts package root.
|
|
13
|
+
*
|
|
14
|
+
* @param {DeliveryConfig} config - The resolved configuration.
|
|
15
|
+
* @param {string[]} formats - The font formats the target uses: `woff2`, `ttf`.
|
|
16
|
+
* @returns {{root: string, version: string, files: string[]}|undefined} The
|
|
17
|
+
* files, sorted: `fonts.css`, `LICENSE` and every file in `fonts/` of a
|
|
18
|
+
* listed format. `undefined` when the consumer ships none.
|
|
19
|
+
*/
|
|
20
|
+
export function scriptFontFiles(config: DeliveryConfig, formats: string[]): {
|
|
21
|
+
root: string;
|
|
22
|
+
version: string;
|
|
23
|
+
files: string[];
|
|
24
|
+
} | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* The fonts package's stylesheet as a target stages it: each `@font-face`
|
|
27
|
+
* `src` lists only the files staged beside it, so no browser asks for a
|
|
28
|
+
* format the target does not carry. A `local(…)` source stays, and a face
|
|
29
|
+
* left with no source is dropped.
|
|
30
|
+
*
|
|
31
|
+
* @param {string} css - The stylesheet as the package publishes it.
|
|
32
|
+
* @param {ReadonlySet<string>} staged - The staged files, relative to the
|
|
33
|
+
* stylesheet: `fonts/SemaronKuriale-Regular.woff2`.
|
|
34
|
+
* @returns {string} The stylesheet to stage.
|
|
35
|
+
*/
|
|
36
|
+
export function stagedStylesheet(css: string, staged: ReadonlySet<string>): string;
|
|
37
|
+
/**
|
|
38
|
+
* Copy the delivered files into a directory, keeping their relative layout so
|
|
39
|
+
* the stylesheet's `url("fonts/…")` resolves from where it lands. The
|
|
40
|
+
* stylesheet is rewritten by {@link stagedStylesheet} to name only the files
|
|
41
|
+
* copied with it.
|
|
42
|
+
*
|
|
43
|
+
* @param {DeliveryConfig} config - The resolved configuration.
|
|
44
|
+
* @param {string} dest - The directory to fill; created when there is
|
|
45
|
+
* something to put in it.
|
|
46
|
+
* @param {string[]} formats - The font formats the target uses.
|
|
47
|
+
* @returns {number} How many files were written; 0 when the consumer ships none.
|
|
48
|
+
*/
|
|
49
|
+
export function copyScriptFonts(config: DeliveryConfig, dest: string, formats: string[]): number;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the package ships what its manifest and stylesheet promise: the
|
|
52
|
+
* stylesheet, the licence and every file the manifest lists.
|
|
53
|
+
*
|
|
54
|
+
* @param {DeliveryConfig} config - The resolved configuration.
|
|
55
|
+
* @returns {{file: string, severity: "error", message: string}[]} One finding
|
|
56
|
+
* per missing file, located at the manifest; empty when the consumer ships none.
|
|
57
|
+
*/
|
|
58
|
+
export function checkScriptFonts(config: DeliveryConfig): {
|
|
59
|
+
file: string;
|
|
60
|
+
severity: "error";
|
|
61
|
+
message: string;
|
|
62
|
+
}[];
|
|
63
|
+
/**
|
|
64
|
+
* The site param naming the stylesheet, relative to the site root.
|
|
65
|
+
*
|
|
66
|
+
* @param {DeliveryConfig} config - The resolved configuration.
|
|
67
|
+
* @returns {string|undefined} The versioned address, or `undefined` when the
|
|
68
|
+
* site ships no fonts.
|
|
69
|
+
*/
|
|
70
|
+
export function siteFontsParam(config: DeliveryConfig): string | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* The directory under the Hugo static tree that holds this version's fonts.
|
|
73
|
+
*
|
|
74
|
+
* @param {string} version - The fonts package's version.
|
|
75
|
+
* @returns {string} The POSIX path, relative to `build/hugo/static`.
|
|
76
|
+
*/
|
|
77
|
+
export function siteFontsDestination(version: string): string;
|
|
78
|
+
/**
|
|
79
|
+
* The manifest `styles`, with the fonts' stylesheet named after the base sheet.
|
|
80
|
+
*
|
|
81
|
+
* @param {object} options
|
|
82
|
+
* @param {unknown} options.styles - The `styles` so far, base sheet included.
|
|
83
|
+
* @param {"system"|"module"} options.artifact - Which artifact is shipped.
|
|
84
|
+
* @param {boolean} options.delivered - Whether the module carries the fonts.
|
|
85
|
+
* @returns {unknown} The `styles` to emit.
|
|
86
|
+
*/
|
|
87
|
+
export function withScriptFontStyle({ styles, artifact, delivered: carried }: {
|
|
88
|
+
styles: unknown;
|
|
89
|
+
artifact: "system" | "module";
|
|
90
|
+
delivered: boolean;
|
|
91
|
+
}): unknown;
|
|
92
|
+
/**
|
|
93
|
+
* The directory of TTFs a book's compiler searches.
|
|
94
|
+
*
|
|
95
|
+
* @param {DeliveryConfig} config - The resolved configuration.
|
|
96
|
+
* @returns {string|undefined} The package's `fonts/` directory, or `undefined`
|
|
97
|
+
* when the consumer ships no fonts.
|
|
98
|
+
*/
|
|
99
|
+
export function typstScriptFontPath(config: DeliveryConfig): string | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* Where the files land in the staged Foundry module, relative to its root.
|
|
102
|
+
*
|
|
103
|
+
* @type {string}
|
|
104
|
+
*/
|
|
105
|
+
export const STAGED_FONTS_DIR: string;
|
|
106
|
+
/**
|
|
107
|
+
* Where the files land in the Hugo static tree, relative to `build/hugo/static`,
|
|
108
|
+
* beneath a directory per version.
|
|
109
|
+
*
|
|
110
|
+
* @type {string}
|
|
111
|
+
*/
|
|
112
|
+
export const SITE_FONTS_DIR: string;
|
|
113
|
+
/**
|
|
114
|
+
* The part of a resolved configuration delivery reads.
|
|
115
|
+
*/
|
|
116
|
+
export type DeliveryConfig = {
|
|
117
|
+
/**
|
|
118
|
+
* - The consuming package's root.
|
|
119
|
+
*/
|
|
120
|
+
rootDir?: string | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* - Where its notes are; relative to
|
|
123
|
+
* `rootDir` unless absolute.
|
|
124
|
+
*/
|
|
125
|
+
paths?: {
|
|
126
|
+
content?: string;
|
|
127
|
+
} | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* - Its languages.
|
|
130
|
+
*/
|
|
131
|
+
languages?: Readonly<Record<string, {
|
|
132
|
+
tag: string;
|
|
133
|
+
}>> | undefined;
|
|
134
|
+
};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One code point a face draws, as `fonts.json` lists it.
|
|
3
|
+
*
|
|
4
|
+
* @typedef {object} FaceCodepoint
|
|
5
|
+
* @property {string} codepoint - `U+` and the hexadecimal code point.
|
|
6
|
+
* @property {string} glyph - The glyph's name in the face.
|
|
7
|
+
* @property {string} kind - What it is: `letter`, `numeral`, `mark` and so on.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* One entry of `fonts.json`.
|
|
11
|
+
*
|
|
12
|
+
* @typedef {object} FontEntry
|
|
13
|
+
* @property {string} [name] - Its unique key; `family` when absent.
|
|
14
|
+
* @property {string} family - The CSS and Typst font family.
|
|
15
|
+
* @property {string} class - The class that sets text in it, `hl-<slug>`.
|
|
16
|
+
* @property {Record<string, string>} files - Its font files, by format.
|
|
17
|
+
* @property {string} direction - `ltr` or `rtl`.
|
|
18
|
+
* @property {string[]} features - OpenType features it turns on.
|
|
19
|
+
* @property {FaceCodepoint[]} [codepoints] - Every code point it draws.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* A face as a run reads it.
|
|
23
|
+
*
|
|
24
|
+
* @typedef {object} Face
|
|
25
|
+
* @property {string} slug - What `font=` names it by: its class without `hl-`.
|
|
26
|
+
* @property {string} family - The CSS and Typst font family.
|
|
27
|
+
* @property {string} class - The class that sets text in it.
|
|
28
|
+
* @property {string} direction - `ltr` or `rtl`.
|
|
29
|
+
* @property {string[]} features - OpenType features it turns on.
|
|
30
|
+
* @property {ReadonlySet<number>} draws - Every code point it draws.
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* The installed fonts package, as a consumer sees it.
|
|
34
|
+
*
|
|
35
|
+
* @typedef {object} ScriptFonts
|
|
36
|
+
* @property {string} root - The package's directory.
|
|
37
|
+
* @property {string} version - Its `package.json` version.
|
|
38
|
+
* @property {{families: FontEntry[]}|undefined} manifest - Its `fonts.json`,
|
|
39
|
+
* `undefined` when the installed version ships none.
|
|
40
|
+
* @property {Map<string, Face>} faces - Each face by its slug, in manifest
|
|
41
|
+
* order; empty without a manifest.
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* The slug `font=` names a face by: its class without the `hl-` prefix.
|
|
45
|
+
*
|
|
46
|
+
* @param {FontEntry} entry - A `fonts.json` entry.
|
|
47
|
+
* @returns {string|undefined} The slug, or `undefined` for an entry with no class.
|
|
48
|
+
*/
|
|
49
|
+
export function faceSlug(entry: FontEntry): string | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* The fonts package the consumer at `rootDir` installed.
|
|
52
|
+
*
|
|
53
|
+
* @param {string} rootDir - The consuming package's root, holding its
|
|
54
|
+
* `package.json`.
|
|
55
|
+
* @returns {ScriptFonts|undefined} The package, or `undefined` when the
|
|
56
|
+
* consumer has not installed it.
|
|
57
|
+
* @throws {Error} When the installed `fonts.json` is not readable JSON, or
|
|
58
|
+
* holds no `families` list.
|
|
59
|
+
*/
|
|
60
|
+
export function resolveScriptFonts(rootDir: string): ScriptFonts | undefined;
|
|
61
|
+
/** The npm name of the fonts package. */
|
|
62
|
+
export const FONTS_PACKAGE: "@heroiclands/fonts";
|
|
63
|
+
/** The manifest the fonts package publishes at its root. */
|
|
64
|
+
export const FONTS_MANIFEST: "fonts.json";
|
|
65
|
+
/**
|
|
66
|
+
* One code point a face draws, as `fonts.json` lists it.
|
|
67
|
+
*/
|
|
68
|
+
export type FaceCodepoint = {
|
|
69
|
+
/**
|
|
70
|
+
* - `U+` and the hexadecimal code point.
|
|
71
|
+
*/
|
|
72
|
+
codepoint: string;
|
|
73
|
+
/**
|
|
74
|
+
* - The glyph's name in the face.
|
|
75
|
+
*/
|
|
76
|
+
glyph: string;
|
|
77
|
+
/**
|
|
78
|
+
* - What it is: `letter`, `numeral`, `mark` and so on.
|
|
79
|
+
*/
|
|
80
|
+
kind: string;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* One entry of `fonts.json`.
|
|
84
|
+
*/
|
|
85
|
+
export type FontEntry = {
|
|
86
|
+
/**
|
|
87
|
+
* - Its unique key; `family` when absent.
|
|
88
|
+
*/
|
|
89
|
+
name?: string | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* - The CSS and Typst font family.
|
|
92
|
+
*/
|
|
93
|
+
family: string;
|
|
94
|
+
/**
|
|
95
|
+
* - The class that sets text in it, `hl-<slug>`.
|
|
96
|
+
*/
|
|
97
|
+
class: string;
|
|
98
|
+
/**
|
|
99
|
+
* - Its font files, by format.
|
|
100
|
+
*/
|
|
101
|
+
files: Record<string, string>;
|
|
102
|
+
/**
|
|
103
|
+
* - `ltr` or `rtl`.
|
|
104
|
+
*/
|
|
105
|
+
direction: string;
|
|
106
|
+
/**
|
|
107
|
+
* - OpenType features it turns on.
|
|
108
|
+
*/
|
|
109
|
+
features: string[];
|
|
110
|
+
/**
|
|
111
|
+
* - Every code point it draws.
|
|
112
|
+
*/
|
|
113
|
+
codepoints?: FaceCodepoint[] | undefined;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* A face as a run reads it.
|
|
117
|
+
*/
|
|
118
|
+
export type Face = {
|
|
119
|
+
/**
|
|
120
|
+
* - What `font=` names it by: its class without `hl-`.
|
|
121
|
+
*/
|
|
122
|
+
slug: string;
|
|
123
|
+
/**
|
|
124
|
+
* - The CSS and Typst font family.
|
|
125
|
+
*/
|
|
126
|
+
family: string;
|
|
127
|
+
/**
|
|
128
|
+
* - The class that sets text in it.
|
|
129
|
+
*/
|
|
130
|
+
class: string;
|
|
131
|
+
/**
|
|
132
|
+
* - `ltr` or `rtl`.
|
|
133
|
+
*/
|
|
134
|
+
direction: string;
|
|
135
|
+
/**
|
|
136
|
+
* - OpenType features it turns on.
|
|
137
|
+
*/
|
|
138
|
+
features: string[];
|
|
139
|
+
/**
|
|
140
|
+
* - Every code point it draws.
|
|
141
|
+
*/
|
|
142
|
+
draws: ReadonlySet<number>;
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* The installed fonts package, as a consumer sees it.
|
|
146
|
+
*/
|
|
147
|
+
export type ScriptFonts = {
|
|
148
|
+
/**
|
|
149
|
+
* - The package's directory.
|
|
150
|
+
*/
|
|
151
|
+
root: string;
|
|
152
|
+
/**
|
|
153
|
+
* - Its `package.json` version.
|
|
154
|
+
*/
|
|
155
|
+
version: string;
|
|
156
|
+
/**
|
|
157
|
+
* - Its `fonts.json`,
|
|
158
|
+
* `undefined` when the installed version ships none.
|
|
159
|
+
*/
|
|
160
|
+
manifest: {
|
|
161
|
+
families: FontEntry[];
|
|
162
|
+
} | undefined;
|
|
163
|
+
/**
|
|
164
|
+
* - Each face by its slug, in manifest
|
|
165
|
+
* order; empty without a manifest.
|
|
166
|
+
*/
|
|
167
|
+
faces: Map<string, Face>;
|
|
168
|
+
};
|
|
@@ -230,7 +230,7 @@ export function pageDestination(page: {
|
|
|
230
230
|
slug: string;
|
|
231
231
|
}): string;
|
|
232
232
|
/** Transform one content page without writing the site mount. */
|
|
233
|
-
export function renderSitePage(page: any, { index, foreign, universe, pass, decorate, linkable, sqlTables, config, artIndex, figuresByAddress, events, drawings, }: {
|
|
233
|
+
export function renderSitePage(page: any, { index, foreign, universe, pass, decorate, linkable, sqlTables, config, artIndex, figuresByAddress, events, drawings, runs, }: {
|
|
234
234
|
index: any;
|
|
235
235
|
foreign: any;
|
|
236
236
|
universe: any;
|
|
@@ -243,6 +243,7 @@ export function renderSitePage(page: any, { index, foreign, universe, pass, deco
|
|
|
243
243
|
figuresByAddress?: Map<any, any> | undefined;
|
|
244
244
|
events: any;
|
|
245
245
|
drawings?: Map<any, any> | undefined;
|
|
246
|
+
runs?: import("./content-scripts.mjs").RunContext | undefined;
|
|
246
247
|
}): {
|
|
247
248
|
page: any;
|
|
248
249
|
body: string;
|
|
@@ -18,15 +18,23 @@
|
|
|
18
18
|
*/
|
|
19
19
|
export function noindexHeaders(): string[];
|
|
20
20
|
/**
|
|
21
|
-
* The `_headers` file's contents: the `noindex` rules, and
|
|
21
|
+
* The `_headers` file's contents: the `noindex` rules, and the script fonts'
|
|
22
|
+
* cache rule when the site carries them.
|
|
22
23
|
*
|
|
23
24
|
* No `Cache-Control` is pinned on the prefix root. It is the homepage, and a
|
|
24
25
|
* lifetime on it would hold a stale copy at the most-linked address after a
|
|
25
|
-
* deploy; Pages' own defaults for a page apply.
|
|
26
|
+
* deploy; Pages' own defaults for a page apply. The fonts sit under a path
|
|
27
|
+
* that names their version, so a year's lifetime never serves a stale file.
|
|
26
28
|
*
|
|
29
|
+
* @param {object} [options] - Options.
|
|
30
|
+
* @param {string} [options.pkg] - The content package, which is the prefix.
|
|
31
|
+
* @param {boolean} [options.fonts] - Whether the site carries the fonts.
|
|
27
32
|
* @returns {string} The file's contents.
|
|
28
33
|
*/
|
|
29
|
-
export function headers(
|
|
34
|
+
export function headers({ pkg, fonts }?: {
|
|
35
|
+
pkg?: string | undefined;
|
|
36
|
+
fonts?: boolean | undefined;
|
|
37
|
+
}): string;
|
|
30
38
|
export function indexSite(where: {
|
|
31
39
|
site: string;
|
|
32
40
|
output: string;
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read one authored row.
|
|
3
|
+
*
|
|
4
|
+
* @param {unknown} row - The row as YAML gave it.
|
|
5
|
+
* @returns {{row: MapRow}|{problem: string, key?: string}} The row, or what is
|
|
6
|
+
* wrong with it and the key the fault sits at.
|
|
7
|
+
*/
|
|
8
|
+
export function readMapRow(row: unknown): {
|
|
9
|
+
row: MapRow;
|
|
10
|
+
} | {
|
|
11
|
+
problem: string;
|
|
12
|
+
key?: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Compile a `data.map` value, keeping its well-formed rows.
|
|
16
|
+
*
|
|
17
|
+
* @param {unknown} value - The note's `data.map`.
|
|
18
|
+
* @returns {TextMap|undefined} The map, or `undefined` when it has no valid name.
|
|
19
|
+
*/
|
|
20
|
+
export function compileMap(value: unknown): TextMap | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* A native form found for a word in lowercase, given the word's capital as the
|
|
23
|
+
* rows write it: the rows map the word's first sound as written and in
|
|
24
|
+
* lowercase, and where the native form begins with the lowercase result, that
|
|
25
|
+
* beginning becomes the capital one.
|
|
26
|
+
*
|
|
27
|
+
* @param {TextMap} map - The map.
|
|
28
|
+
* @param {string|undefined} font - The face.
|
|
29
|
+
* @param {string} word - The word as written.
|
|
30
|
+
* @param {string} native - The native form of its lowercase.
|
|
31
|
+
* @returns {string|undefined} The native form, capitalised; `undefined` where
|
|
32
|
+
* it does not begin as the rows begin the word, so the rows cannot say how.
|
|
33
|
+
*/
|
|
34
|
+
export function capitalNative(map: TextMap, font: string | undefined, word: string, native: string): string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Apply a map to text.
|
|
37
|
+
*
|
|
38
|
+
* @param {TextMap|undefined} map - The map; without one the text is returned
|
|
39
|
+
* as it is.
|
|
40
|
+
* @param {string} text - The text, with no escapes in it.
|
|
41
|
+
* @param {MapOptions} [options] - The face, and the native forms of words.
|
|
42
|
+
* @returns {{text: string, pieces: Array<{at: number, from: string, to: string, row: boolean, native?: boolean}>}}
|
|
43
|
+
* The rewritten text, and each piece of it with the UTF-16 offset in `text`
|
|
44
|
+
* it came from: a matched row's `from` and what it wrote, a word and its
|
|
45
|
+
* native form (`native: true`), or one character that passed through. A
|
|
46
|
+
* capitalised word whose native form the rows cannot capitalise is written
|
|
47
|
+
* as stated and carries `uncapitalised`, the lowercase form it was found by.
|
|
48
|
+
*/
|
|
49
|
+
export function applyMap(map: TextMap | undefined, text: string, { font, native }?: MapOptions): {
|
|
50
|
+
text: string;
|
|
51
|
+
pieces: Array<{
|
|
52
|
+
at: number;
|
|
53
|
+
from: string;
|
|
54
|
+
to: string;
|
|
55
|
+
row: boolean;
|
|
56
|
+
native?: boolean;
|
|
57
|
+
}>;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Every map the index records declare, by name. The first note to declare a
|
|
61
|
+
* name keeps it; the duplicate is the lint's to report.
|
|
62
|
+
*
|
|
63
|
+
* @param {Iterable<Record<string, any>>|undefined} records - Index records.
|
|
64
|
+
* @returns {Map<string, TextMap>} The maps.
|
|
65
|
+
*/
|
|
66
|
+
export function mapsFromRecords(records: Iterable<Record<string, any>> | undefined): Map<string, TextMap>;
|
|
67
|
+
/**
|
|
68
|
+
* One row per well-formed map row, for the `maps` relation: the shared rows
|
|
69
|
+
* with no `font`, then each listed face's own rows with its slug.
|
|
70
|
+
*
|
|
71
|
+
* @param {Iterable<Record<string, any>>} records - Index records.
|
|
72
|
+
* @param {(record: Record<string, any>) => string|null} ownerOf - A record's
|
|
73
|
+
* page Address.
|
|
74
|
+
* @returns {Array<Record<string, string|number|null>>} The rows, in record
|
|
75
|
+
* then authored order; `row` is the row's 1-based place in its list.
|
|
76
|
+
*/
|
|
77
|
+
export function mapRows(records: Iterable<Record<string, any>>, ownerOf: (record: Record<string, any>) => string | null): Array<Record<string, string | number | null>>;
|
|
78
|
+
/**
|
|
79
|
+
* Check a note's `data.map`: its name, that no other note declares it, each
|
|
80
|
+
* row written as a list, a `before` condition on a map with no `vowels`, an
|
|
81
|
+
* empty `fonts`, and a generic family in it. The data-key check owns every
|
|
82
|
+
* key, its kind and the words a condition takes; whether a listed face is
|
|
83
|
+
* installed, and draws what the map writes, is
|
|
84
|
+
* {@link module:engine/map-lexicon.checkMapFonts}'s.
|
|
85
|
+
*
|
|
86
|
+
* @param {{file: string, raw?: string, fm?: Record<string, any>}} note - The note.
|
|
87
|
+
* @param {{index?: {notes?: Iterable<object>}}} [context] - The lint index.
|
|
88
|
+
* @returns {object[]} The findings, each at its key.
|
|
89
|
+
*/
|
|
90
|
+
export function checkMapField(note: {
|
|
91
|
+
file: string;
|
|
92
|
+
raw?: string;
|
|
93
|
+
fm?: Record<string, any>;
|
|
94
|
+
}, { index }?: {
|
|
95
|
+
index?: {
|
|
96
|
+
notes?: Iterable<object>;
|
|
97
|
+
};
|
|
98
|
+
}): object[];
|
|
99
|
+
/** What a map's `name` may be. */
|
|
100
|
+
export const MAP_NAME: RegExp;
|
|
101
|
+
/** Each condition a row may carry, and the values it takes. */
|
|
102
|
+
export const MAP_CONDITIONS: Readonly<{
|
|
103
|
+
before: readonly string[];
|
|
104
|
+
at: readonly string[];
|
|
105
|
+
}>;
|
|
106
|
+
/** The generic families, which a map's `fonts` may not list. */
|
|
107
|
+
export const GENERIC_FAMILIES: readonly string[];
|
|
108
|
+
/** Every column of the `maps` relation, in order. */
|
|
109
|
+
export const MAP_COLUMNS: readonly string[];
|
|
110
|
+
/**
|
|
111
|
+
* One row, read.
|
|
112
|
+
*/
|
|
113
|
+
export type MapRow = {
|
|
114
|
+
/**
|
|
115
|
+
* - The characters it matches.
|
|
116
|
+
*/
|
|
117
|
+
from: string;
|
|
118
|
+
/**
|
|
119
|
+
* - What it writes in their place.
|
|
120
|
+
*/
|
|
121
|
+
to: string;
|
|
122
|
+
/**
|
|
123
|
+
* - What must follow the match.
|
|
124
|
+
*/
|
|
125
|
+
before?: "vowel" | "consonant" | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* - Where the match must sit.
|
|
128
|
+
*/
|
|
129
|
+
at?: "end" | "start" | undefined;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* A map ready to apply.
|
|
133
|
+
*/
|
|
134
|
+
export type TextMap = {
|
|
135
|
+
/**
|
|
136
|
+
* - Its name.
|
|
137
|
+
*/
|
|
138
|
+
name: string;
|
|
139
|
+
/**
|
|
140
|
+
* - The characters `before: vowel` reads.
|
|
141
|
+
*/
|
|
142
|
+
vowels: ReadonlySet<string>;
|
|
143
|
+
/**
|
|
144
|
+
* - Its well-formed shared rows, in authored order.
|
|
145
|
+
*/
|
|
146
|
+
rows: readonly MapRow[];
|
|
147
|
+
/**
|
|
148
|
+
* - Its shared rows
|
|
149
|
+
* by the first character of `from`, longest first, conditioned before plain.
|
|
150
|
+
*/
|
|
151
|
+
byFirst: ReadonlyMap<string, readonly MapRow[]>;
|
|
152
|
+
/**
|
|
153
|
+
* -
|
|
154
|
+
* Each listed face by slug, in listed order, with its own rows.
|
|
155
|
+
*/
|
|
156
|
+
fonts: ReadonlyMap<string, {
|
|
157
|
+
rows: readonly MapRow[];
|
|
158
|
+
byFirst: ReadonlyMap<string, readonly MapRow[]>;
|
|
159
|
+
}>;
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* How a text is mapped beyond the rows.
|
|
163
|
+
*/
|
|
164
|
+
export type MapOptions = {
|
|
165
|
+
/**
|
|
166
|
+
* - The face the text is set in, whose own rows are
|
|
167
|
+
* tried first.
|
|
168
|
+
*/
|
|
169
|
+
font?: string | undefined;
|
|
170
|
+
/**
|
|
171
|
+
* - A word's native
|
|
172
|
+
* form, for the word exactly as given, or `undefined` where it states none.
|
|
173
|
+
*/
|
|
174
|
+
native?: ((word: string) => string | undefined) | undefined;
|
|
175
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A stated verb pattern, as its readers use it.
|
|
3
|
+
*
|
|
4
|
+
* @typedef {object} VerbPattern
|
|
5
|
+
* @property {boolean} invariant - Whether verbs keep the citation form for
|
|
6
|
+
* every person.
|
|
7
|
+
* @property {string|undefined} replaces - The letters each ending takes the
|
|
8
|
+
* place of, where the pattern states them.
|
|
9
|
+
* @property {Array<{name: string, label: string, ending: string}>} endings -
|
|
10
|
+
* The six endings in presentation order; empty for an invariant pattern.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Read a language's verb pattern.
|
|
14
|
+
*
|
|
15
|
+
* @param {unknown} verbs - The language's `data.grammar.verbs`, as authored or
|
|
16
|
+
* as a SQL row carries it (absent fields `null`).
|
|
17
|
+
* @returns {VerbPattern|undefined} The pattern, or `undefined` where none is
|
|
18
|
+
* stated in full.
|
|
19
|
+
*/
|
|
20
|
+
export function verbPattern(verbs: unknown): VerbPattern | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* A stem with its closing letters swapped for an ending, or with the ending
|
|
23
|
+
* added where the stem does not close on them.
|
|
24
|
+
*
|
|
25
|
+
* @param {string} stem - The stem.
|
|
26
|
+
* @param {string} ending - The ending.
|
|
27
|
+
* @param {string|undefined} letters - The closing letters the ending takes
|
|
28
|
+
* the place of; none adds the ending.
|
|
29
|
+
* @returns {string} The form.
|
|
30
|
+
*/
|
|
31
|
+
export function replaceClosing(stem: string, ending: string, letters: string | undefined): string;
|
|
32
|
+
/**
|
|
33
|
+
* The present form of a verb for one ending.
|
|
34
|
+
*
|
|
35
|
+
* @param {string} citation - The citation form.
|
|
36
|
+
* @param {string} ending - The person's ending; empty leaves the citation
|
|
37
|
+
* form, less any closing `replaces`.
|
|
38
|
+
* @param {string} [replaces] - The pattern's `replaces`.
|
|
39
|
+
* @returns {string} The form.
|
|
40
|
+
*/
|
|
41
|
+
export function verbForm(citation: string, ending: string, replaces?: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* A stated verb pattern, as its readers use it.
|
|
44
|
+
*/
|
|
45
|
+
export type VerbPattern = {
|
|
46
|
+
/**
|
|
47
|
+
* - Whether verbs keep the citation form for
|
|
48
|
+
* every person.
|
|
49
|
+
*/
|
|
50
|
+
invariant: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* - The letters each ending takes the
|
|
53
|
+
* place of, where the pattern states them.
|
|
54
|
+
*/
|
|
55
|
+
replaces: string | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* -
|
|
58
|
+
* The six endings in presentation order; empty for an invariant pattern.
|
|
59
|
+
*/
|
|
60
|
+
endings: Array<{
|
|
61
|
+
name: string;
|
|
62
|
+
label: string;
|
|
63
|
+
ending: string;
|
|
64
|
+
}>;
|
|
65
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **What a word is in running text.** A word is a maximal run of letters,
|
|
3
|
+
* combining marks and digits, and an apostrophe (`'` or `’`), a hyphen or an
|
|
4
|
+
* en dash joins two such runs into one word: `k'aralzon`, `Arzen-Thalor`.
|
|
5
|
+
* Anything else, whitespace and punctuation included, sits between words.
|
|
6
|
+
*
|
|
7
|
+
* The name catalog reads a label's last word by it, and a mapped run reads
|
|
8
|
+
* each word it looks up in a lexicon by it.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
/** One word; global, so `matchAll` walks every word of a text. */
|
|
13
|
+
export const WORD: RegExp;
|