@heroiclands/package-build 25.0.0 → 25.1.1
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 +26 -0
- package/README.md +1 -0
- package/bin/content-commands.mjs +30 -96
- package/bin/encoding-commands.mjs +146 -0
- package/bin/package-build.mjs +35 -24
- package/config.mjs +25 -0
- package/convert.mjs +182 -0
- package/docs/api.md +144 -6
- package/docs/authoring/links-and-markup.md +260 -481
- package/docs/commands.md +110 -119
- package/docs/configuration.md +31 -13
- package/docs/content-format.md +11 -4
- package/docs/diagnostics.md +43 -16
- package/docs/encoding-core.md +193 -0
- package/docs/guides/book.md +2 -2
- package/docs/guides/module-project.md +23 -1
- package/docs/guides/site.md +2 -2
- package/docs/guides/writing-in-invented-scripts.md +458 -575
- package/docs/reference/format-details.md +292 -404
- package/docs/reference/note-types.md +83 -63
- package/docs/source-preview.md +8 -0
- package/e2e.mjs +1 -1
- package/engine/base-compiler.mjs +27 -9
- package/engine/content-charset.mjs +13 -1
- package/engine/content-format.yaml +6 -2
- package/engine/content-index.mjs +6 -2
- package/engine/content-links.mjs +1 -0
- package/engine/content-scripts.mjs +614 -459
- package/engine/content-scroll.mjs +4 -4
- package/engine/content-spans.mjs +40 -9
- package/engine/content-verse.mjs +1 -1
- package/engine/converter-data.mjs +70 -0
- package/engine/dictionary-rows.mjs +2 -34
- package/engine/encoding-integrity.mjs +94 -0
- package/engine/encoding-language.mjs +506 -0
- package/engine/encoding-lexicon.mjs +701 -0
- package/engine/encoding-notes.mjs +186 -0
- package/engine/encoding-standard.mjs +42 -0
- package/engine/encoding-template.mjs +370 -0
- package/engine/encoding-terms.mjs +178 -0
- package/engine/encoding.mjs +952 -0
- package/engine/extension-attributes.mjs +2 -0
- package/engine/helpers.mjs +1 -1
- package/engine/index.mjs +7 -0
- package/engine/language-terms.mjs +17 -16
- package/engine/{logographic.mjs → language-writings.mjs} +29 -38
- package/engine/markup-validation.mjs +1 -1
- package/engine/note-vocabulary.mjs +4 -158
- package/engine/pdf-render.mjs +31 -3
- package/engine/roman-characters.mjs +135 -16
- package/engine/roman-run.mjs +149 -0
- package/engine/roman-verse.mjs +95 -0
- package/engine/run-rows.mjs +29 -31
- package/engine/run-words.mjs +2 -2
- package/engine/script-emphasis-terms.mjs +3 -0
- package/engine/script-emphasis.mjs +3 -10
- package/engine/script-font-delivery.mjs +9 -12
- package/engine/script-fonts.mjs +2 -1
- package/engine/site-build.mjs +14 -5
- package/engine/site-preview.mjs +12 -2
- package/engine/sql-tables.mjs +36 -31
- package/engine/verse-metre.mjs +1 -1
- package/engine/word-forms.mjs +1 -1
- package/engine/word-inflections.mjs +48 -0
- package/engine/word-rows.mjs +1 -1
- package/engine/word-terms.mjs +16 -17
- package/package.json +11 -5
- package/types/config.d.mts +5 -0
- package/types/convert.d.mts +44 -0
- package/types/e2e.d.mts +1 -1
- package/types/engine/base-compiler.d.mts +4 -2
- package/types/engine/content-index.d.mts +4 -1
- package/types/engine/content-scripts.d.mts +103 -42
- package/types/engine/converter-data.d.mts +11 -0
- package/types/engine/dictionary-rows.d.mts +1 -25
- package/types/engine/encoding-integrity.d.mts +14 -0
- package/types/engine/encoding-language.d.mts +36 -0
- package/types/engine/encoding-lexicon.d.mts +259 -0
- package/types/engine/encoding-notes.d.mts +39 -0
- package/types/engine/encoding-standard.d.mts +11 -0
- package/types/engine/encoding-template.d.mts +44 -0
- package/types/engine/encoding-terms.d.mts +143 -0
- package/types/engine/encoding.d.mts +155 -0
- package/types/engine/helpers.d.mts +1 -1
- package/types/engine/index.d.mts +4 -0
- package/types/engine/language-terms.d.mts +1 -1
- package/types/engine/{logographic.d.mts → language-writings.d.mts} +6 -6
- package/types/engine/markup-validation.d.mts +1 -1
- package/types/engine/pdf-render.d.mts +1 -1
- package/types/engine/roman-characters.d.mts +2 -2
- package/types/engine/roman-run.d.mts +101 -0
- package/types/engine/roman-verse.d.mts +23 -0
- package/types/engine/run-rows.d.mts +13 -20
- package/types/engine/script-emphasis-terms.d.mts +2 -0
- package/types/engine/script-emphasis.d.mts +1 -1
- package/types/engine/script-font-delivery.d.mts +2 -3
- package/types/engine/script-fonts.d.mts +5 -0
- package/types/engine/site-preview.d.mts +1 -1
- package/types/engine/word-inflections.d.mts +25 -0
- package/engine/map-lexicon.mjs +0 -1045
- package/engine/text-maps.mjs +0 -654
- package/engine/written-in.mjs +0 -204
- package/types/engine/map-lexicon.d.mts +0 -330
- package/types/engine/text-maps.d.mts +0 -189
- package/types/engine/written-in.d.mts +0 -76
|
@@ -1,189 +0,0 @@
|
|
|
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, unwritten?: object}>}}
|
|
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
|
-
* Under a logographic map, a word with no writing is written as typed and
|
|
49
|
-
* carries `unwritten`, why it has none.
|
|
50
|
-
*/
|
|
51
|
-
export function applyMap(map: TextMap | undefined, text: string, { font, native, writing }?: MapOptions): {
|
|
52
|
-
text: string;
|
|
53
|
-
pieces: Array<{
|
|
54
|
-
at: number;
|
|
55
|
-
from: string;
|
|
56
|
-
to: string;
|
|
57
|
-
row: boolean;
|
|
58
|
-
native?: boolean;
|
|
59
|
-
unwritten?: object;
|
|
60
|
-
}>;
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* Every map the index records declare, by name. The first note to declare a
|
|
64
|
-
* name keeps it; the duplicate is the lint's to report.
|
|
65
|
-
*
|
|
66
|
-
* @param {Iterable<Record<string, any>>|undefined} records - Index records.
|
|
67
|
-
* @returns {Map<string, TextMap>} The maps.
|
|
68
|
-
*/
|
|
69
|
-
export function mapsFromRecords(records: Iterable<Record<string, any>> | undefined): Map<string, TextMap>;
|
|
70
|
-
/**
|
|
71
|
-
* One row per well-formed map row, for the `maps` relation: the shared rows
|
|
72
|
-
* with no `font`, then each listed face's own rows with its slug.
|
|
73
|
-
*
|
|
74
|
-
* @param {Iterable<Record<string, any>>} records - Index records.
|
|
75
|
-
* @param {(record: Record<string, any>) => string|null} ownerOf - A record's
|
|
76
|
-
* page Address.
|
|
77
|
-
* @returns {Array<Record<string, string|number|null>>} The rows, in record
|
|
78
|
-
* then authored order; `row` is the row's 1-based place in its list.
|
|
79
|
-
*/
|
|
80
|
-
export function mapRows(records: Iterable<Record<string, any>>, ownerOf: (record: Record<string, any>) => string | null): Array<Record<string, string | number | null>>;
|
|
81
|
-
/**
|
|
82
|
-
* Check a note's `data.map`: its name, that no other note declares it, each
|
|
83
|
-
* row written as a list, a `before` condition on a map with no `vowels`, an
|
|
84
|
-
* empty `fonts`, a generic family in it, and a row of a logographic map that
|
|
85
|
-
* matches a letter. The data-key check owns every
|
|
86
|
-
* key, its kind and the words a condition takes; whether a listed face is
|
|
87
|
-
* installed, and draws what the map writes, is
|
|
88
|
-
* {@link module:engine/map-lexicon.checkMapFonts}'s.
|
|
89
|
-
*
|
|
90
|
-
* @param {{file: string, raw?: string, fm?: Record<string, any>}} note - The note.
|
|
91
|
-
* @param {{index?: {notes?: Iterable<object>}}} [context] - The lint index.
|
|
92
|
-
* @returns {object[]} The findings, each at its key.
|
|
93
|
-
*/
|
|
94
|
-
export function checkMapField(note: {
|
|
95
|
-
file: string;
|
|
96
|
-
raw?: string;
|
|
97
|
-
fm?: Record<string, any>;
|
|
98
|
-
}, { index }?: {
|
|
99
|
-
index?: {
|
|
100
|
-
notes?: Iterable<object>;
|
|
101
|
-
};
|
|
102
|
-
}): object[];
|
|
103
|
-
/** What a map's `name` may be. */
|
|
104
|
-
export const MAP_NAME: RegExp;
|
|
105
|
-
/** Each condition a row may carry, and the values it takes. */
|
|
106
|
-
export const MAP_CONDITIONS: Readonly<{
|
|
107
|
-
before: readonly string[];
|
|
108
|
-
at: readonly string[];
|
|
109
|
-
}>;
|
|
110
|
-
/** The generic families, which a map's `fonts` may not list. */
|
|
111
|
-
export const GENERIC_FAMILIES: readonly string[];
|
|
112
|
-
/** Every column of the `maps` relation, in order. */
|
|
113
|
-
export const MAP_COLUMNS: readonly string[];
|
|
114
|
-
/**
|
|
115
|
-
* One row, read.
|
|
116
|
-
*/
|
|
117
|
-
export type MapRow = {
|
|
118
|
-
/**
|
|
119
|
-
* - The characters it matches.
|
|
120
|
-
*/
|
|
121
|
-
from: string;
|
|
122
|
-
/**
|
|
123
|
-
* - What it writes in their place.
|
|
124
|
-
*/
|
|
125
|
-
to: string;
|
|
126
|
-
/**
|
|
127
|
-
* - What must follow the match.
|
|
128
|
-
*/
|
|
129
|
-
before?: "vowel" | "consonant" | undefined;
|
|
130
|
-
/**
|
|
131
|
-
* - Where the match must sit.
|
|
132
|
-
*/
|
|
133
|
-
at?: "start" | "end" | undefined;
|
|
134
|
-
};
|
|
135
|
-
/**
|
|
136
|
-
* A map ready to apply.
|
|
137
|
-
*/
|
|
138
|
-
export type TextMap = {
|
|
139
|
-
/**
|
|
140
|
-
* - Its name.
|
|
141
|
-
*/
|
|
142
|
-
name: string;
|
|
143
|
-
/**
|
|
144
|
-
* - Whether it writes words from the lexicon
|
|
145
|
-
* alone, its rows only between them.
|
|
146
|
-
*/
|
|
147
|
-
logographic: boolean;
|
|
148
|
-
/**
|
|
149
|
-
* - The characters `before: vowel` reads.
|
|
150
|
-
*/
|
|
151
|
-
vowels: ReadonlySet<string>;
|
|
152
|
-
/**
|
|
153
|
-
* - Its well-formed shared rows, in authored order.
|
|
154
|
-
*/
|
|
155
|
-
rows: readonly MapRow[];
|
|
156
|
-
/**
|
|
157
|
-
* - Its shared rows
|
|
158
|
-
* by the first character of `from`, longest first, conditioned before plain.
|
|
159
|
-
*/
|
|
160
|
-
byFirst: ReadonlyMap<string, readonly MapRow[]>;
|
|
161
|
-
/**
|
|
162
|
-
* -
|
|
163
|
-
* Each listed face by slug, in listed order, with its own rows.
|
|
164
|
-
*/
|
|
165
|
-
fonts: ReadonlyMap<string, {
|
|
166
|
-
rows: readonly MapRow[];
|
|
167
|
-
byFirst: ReadonlyMap<string, readonly MapRow[]>;
|
|
168
|
-
}>;
|
|
169
|
-
};
|
|
170
|
-
/**
|
|
171
|
-
* How a text is mapped beyond the rows.
|
|
172
|
-
*/
|
|
173
|
-
export type MapOptions = {
|
|
174
|
-
/**
|
|
175
|
-
* - The face the text is set in, whose own rows are
|
|
176
|
-
* tried first.
|
|
177
|
-
*/
|
|
178
|
-
font?: string | undefined;
|
|
179
|
-
/**
|
|
180
|
-
* - A word's native
|
|
181
|
-
* form, for the word exactly as given, or `undefined` where it states none.
|
|
182
|
-
*/
|
|
183
|
-
native?: ((word: string) => string | undefined) | undefined;
|
|
184
|
-
/**
|
|
185
|
-
* -
|
|
186
|
-
* A word's writing under a logographic map; without one, no word has one.
|
|
187
|
-
*/
|
|
188
|
-
writing?: ((word: string) => import("./logographic.mjs").Writing) | undefined;
|
|
189
|
-
};
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Whether a map is drawn in a face: it lists the face, or lists none.
|
|
3
|
-
*
|
|
4
|
-
* @param {import("./text-maps.mjs").TextMap} map - The map.
|
|
5
|
-
* @param {string} font - The face's slug.
|
|
6
|
-
* @returns {boolean} Whether the map may set text in it.
|
|
7
|
-
*/
|
|
8
|
-
export function drawnIn(map: import("./text-maps.mjs").TextMap, font: string): boolean;
|
|
9
|
-
/**
|
|
10
|
-
* The script each configured language's note names, where the map is known
|
|
11
|
-
* and is drawn in the face. A default that names an unknown map or a face its
|
|
12
|
-
* map is not drawn in is the note's finding, and fills no run.
|
|
13
|
-
*
|
|
14
|
-
* @param {ReadonlyMap<string, Record<string, any>>} byName - Each configured
|
|
15
|
-
* language's note record, by language name, from
|
|
16
|
-
* {@link module:engine/map-lexicon.languageRecordsByName}.
|
|
17
|
-
* @param {ReadonlyMap<string, import("./text-maps.mjs").TextMap>} maps - The
|
|
18
|
-
* maps by name.
|
|
19
|
-
* @returns {Map<string, WrittenIn>} The scripts, by language name.
|
|
20
|
-
*/
|
|
21
|
-
export function writtenInOf(byName: ReadonlyMap<string, Record<string, any>>, maps: ReadonlyMap<string, import("./text-maps.mjs").TextMap>): Map<string, WrittenIn>;
|
|
22
|
-
/**
|
|
23
|
-
* The keys a run takes from its language's script: each of `map` and `font`
|
|
24
|
-
* the run does not state, where it agrees with the one the run does.
|
|
25
|
-
*
|
|
26
|
-
* @param {{lang?: string, map?: string, font?: string}} keys - The run's keys,
|
|
27
|
-
* its own and those it inherits.
|
|
28
|
-
* @param {ReadonlyMap<string, WrittenIn>|undefined} scripts - Each language's
|
|
29
|
-
* script, from {@link writtenInOf}.
|
|
30
|
-
* @param {ReadonlyMap<string, import("./text-maps.mjs").TextMap>|undefined} maps -
|
|
31
|
-
* The maps by name.
|
|
32
|
-
* @returns {{map?: string, font?: string}} What the run takes; empty when it
|
|
33
|
-
* takes nothing.
|
|
34
|
-
*/
|
|
35
|
-
export function fromWrittenIn(keys: {
|
|
36
|
-
lang?: string;
|
|
37
|
-
map?: string;
|
|
38
|
-
font?: string;
|
|
39
|
-
}, scripts: ReadonlyMap<string, WrittenIn> | undefined, maps: ReadonlyMap<string, import("./text-maps.mjs").TextMap> | undefined): {
|
|
40
|
-
map?: string;
|
|
41
|
-
font?: string;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Check a note's `data.writtenIn`: that the note is a language, that `map`
|
|
45
|
-
* names a map a mapping note declares, and that the map is drawn in `font`.
|
|
46
|
-
* The data-key check owns the keys and their kinds.
|
|
47
|
-
*
|
|
48
|
-
* @param {{file: string, raw?: string, fm?: Record<string, any>}} note - The note.
|
|
49
|
-
* @param {{index?: {notes?: Iterable<object>}}} [context] - The lint index;
|
|
50
|
-
* without one, only the note's `subType` is checked.
|
|
51
|
-
* @returns {object[]} The findings, each at its key or value.
|
|
52
|
-
*/
|
|
53
|
-
export function checkWrittenIn(note: {
|
|
54
|
-
file: string;
|
|
55
|
-
raw?: string;
|
|
56
|
-
fm?: Record<string, any>;
|
|
57
|
-
}, { index }?: {
|
|
58
|
-
index?: {
|
|
59
|
-
notes?: Iterable<object>;
|
|
60
|
-
};
|
|
61
|
-
}): object[];
|
|
62
|
-
/** The `data` key a language note names its script in. */
|
|
63
|
-
export const WRITTEN_IN_KEY: "writtenIn";
|
|
64
|
-
/**
|
|
65
|
-
* A language's script.
|
|
66
|
-
*/
|
|
67
|
-
export type WrittenIn = {
|
|
68
|
-
/**
|
|
69
|
-
* - The `data.map.name` of the mapping note.
|
|
70
|
-
*/
|
|
71
|
-
map: string;
|
|
72
|
-
/**
|
|
73
|
-
* - The slug of the face, one the map is drawn in.
|
|
74
|
-
*/
|
|
75
|
-
font: string;
|
|
76
|
-
};
|