@heroiclands/package-build 24.1.1 → 25.1.0

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.
Files changed (107) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +1 -0
  3. package/bin/content-commands.mjs +30 -96
  4. package/bin/encoding-commands.mjs +146 -0
  5. package/bin/package-build.mjs +35 -24
  6. package/config.mjs +25 -0
  7. package/convert.mjs +182 -0
  8. package/docs/api.md +154 -11
  9. package/docs/authoring/links-and-markup.md +260 -473
  10. package/docs/commands.md +118 -119
  11. package/docs/configuration.md +31 -13
  12. package/docs/content-format.md +11 -4
  13. package/docs/diagnostics.md +43 -16
  14. package/docs/encoding-core.md +135 -0
  15. package/docs/guides/book.md +2 -2
  16. package/docs/guides/module-project.md +23 -1
  17. package/docs/guides/site.md +2 -2
  18. package/docs/guides/writing-in-invented-scripts.md +453 -569
  19. package/docs/reference/format-details.md +290 -380
  20. package/docs/reference/note-types.md +80 -62
  21. package/docs/source-preview.md +8 -0
  22. package/e2e.mjs +1 -1
  23. package/engine/base-compiler.mjs +27 -9
  24. package/engine/content-charset.mjs +21 -1
  25. package/engine/content-format.yaml +7 -2
  26. package/engine/content-index.mjs +6 -2
  27. package/engine/content-links.mjs +1 -0
  28. package/engine/content-scripts.mjs +658 -423
  29. package/engine/content-scroll.mjs +4 -4
  30. package/engine/content-spans.mjs +40 -9
  31. package/engine/content-verse.mjs +1 -1
  32. package/engine/converter-data.mjs +70 -0
  33. package/engine/dictionary-rows.mjs +2 -34
  34. package/engine/encoding-integrity.mjs +94 -0
  35. package/engine/encoding-language.mjs +506 -0
  36. package/engine/encoding-lexicon.mjs +699 -0
  37. package/engine/encoding-notes.mjs +186 -0
  38. package/engine/encoding-standard.mjs +42 -0
  39. package/engine/encoding-template.mjs +313 -0
  40. package/engine/encoding-terms.mjs +141 -0
  41. package/engine/encoding.mjs +946 -0
  42. package/engine/extension-attributes.mjs +2 -0
  43. package/engine/helpers.mjs +1 -1
  44. package/engine/index.mjs +10 -0
  45. package/engine/language-data.mjs +4 -1
  46. package/engine/language-terms.mjs +23 -12
  47. package/engine/{logographic.mjs → language-writings.mjs} +29 -38
  48. package/engine/markup-validation.mjs +1 -1
  49. package/engine/note-vocabulary.mjs +4 -158
  50. package/engine/pdf-render.mjs +31 -3
  51. package/engine/roman-characters.mjs +232 -0
  52. package/engine/roman-run.mjs +149 -0
  53. package/engine/roman-verse.mjs +95 -0
  54. package/engine/run-rows.mjs +29 -31
  55. package/engine/run-words.mjs +2 -2
  56. package/engine/script-emphasis-terms.mjs +3 -0
  57. package/engine/script-emphasis.mjs +3 -10
  58. package/engine/script-font-delivery.mjs +9 -12
  59. package/engine/script-fonts.mjs +2 -1
  60. package/engine/site-build.mjs +14 -5
  61. package/engine/site-preview.mjs +12 -2
  62. package/engine/sql-tables.mjs +36 -31
  63. package/engine/verse-metre.mjs +1 -1
  64. package/engine/word-forms.mjs +1 -1
  65. package/engine/word-inflections.mjs +48 -0
  66. package/engine/word-rows.mjs +1 -1
  67. package/engine/word-terms.mjs +16 -17
  68. package/package.json +11 -5
  69. package/types/config.d.mts +5 -0
  70. package/types/convert.d.mts +44 -0
  71. package/types/e2e.d.mts +1 -1
  72. package/types/engine/base-compiler.d.mts +4 -2
  73. package/types/engine/content-charset.d.mts +8 -0
  74. package/types/engine/content-index.d.mts +4 -1
  75. package/types/engine/content-scripts.d.mts +108 -42
  76. package/types/engine/converter-data.d.mts +11 -0
  77. package/types/engine/dictionary-rows.d.mts +1 -25
  78. package/types/engine/encoding-integrity.d.mts +14 -0
  79. package/types/engine/encoding-language.d.mts +36 -0
  80. package/types/engine/encoding-lexicon.d.mts +259 -0
  81. package/types/engine/encoding-notes.d.mts +39 -0
  82. package/types/engine/encoding-standard.d.mts +11 -0
  83. package/types/engine/encoding-template.d.mts +43 -0
  84. package/types/engine/encoding-terms.d.mts +105 -0
  85. package/types/engine/encoding.d.mts +155 -0
  86. package/types/engine/helpers.d.mts +1 -1
  87. package/types/engine/index.d.mts +5 -0
  88. package/types/engine/language-terms.d.mts +1 -1
  89. package/types/engine/{logographic.d.mts → language-writings.d.mts} +6 -6
  90. package/types/engine/markup-validation.d.mts +1 -1
  91. package/types/engine/pdf-render.d.mts +1 -1
  92. package/types/engine/roman-characters.d.mts +45 -0
  93. package/types/engine/roman-run.d.mts +101 -0
  94. package/types/engine/roman-verse.d.mts +23 -0
  95. package/types/engine/run-rows.d.mts +13 -20
  96. package/types/engine/script-emphasis-terms.d.mts +2 -0
  97. package/types/engine/script-emphasis.d.mts +1 -1
  98. package/types/engine/script-font-delivery.d.mts +2 -3
  99. package/types/engine/script-fonts.d.mts +5 -0
  100. package/types/engine/site-preview.d.mts +1 -1
  101. package/types/engine/word-inflections.d.mts +25 -0
  102. package/engine/map-lexicon.mjs +0 -1034
  103. package/engine/text-maps.mjs +0 -654
  104. package/engine/written-in.mjs +0 -204
  105. package/types/engine/map-lexicon.d.mts +0 -330
  106. package/types/engine/text-maps.d.mts +0 -189
  107. package/types/engine/written-in.d.mts +0 -76
@@ -7,11 +7,8 @@
7
7
  * own `lang=`, else the one the div or fence around it states.
8
8
  * @property {string|null} tag - The BCP 47 tag it resolves to, or null.
9
9
  * @property {string|null} font - Its explicit font, an inherited ordinary
10
- * prose family, or the configured default for an opted-in native run.
11
- * @property {string|null} map - Its explicit map or the configured map of an
12
- * opted-in native run; null for Roman language-only text.
13
- * @property {boolean} [nativefont] - Explicit native opt-in on this construct;
14
- * absent on Roman runs. This internal flag is not a SQL column.
10
+ * prose family, or the font of the selected encoding document.
11
+ * @property {string|null} enc - Its resolved encoding document, or default for Roman text.
15
12
  * @property {number} line - 1-based file line of its opening.
16
13
  * @property {number} column - 1-based UTF-16 file column of its opening.
17
14
  */
@@ -38,22 +35,24 @@ export function recordRuns(body: string, { context, bodyLine, bodyColumn, syntax
38
35
  syntax?: import("./content-session.mjs").ContentSyntax | undefined;
39
36
  }): RecordRun[];
40
37
  /**
41
- * Give explicitly native recorded runs the map and face their language names in
42
- * `data.writtenIn`, where the run leaves them unstated, as a run is set. Read
43
- * once every record exists, since a run's language note may be recorded after
44
- * the note that marks it.
38
+ * Resolve recorded encoding Addresses and fill the language and font supplied
39
+ * by each selected document, once every index record exists.
45
40
  *
46
41
  * @param {Record<string, any>[]} records - The package's index records; each
47
42
  * note record's `runs` is updated in place.
48
- * @param {{languages?: Readonly<Record<string, {tag: string, note?: string}>>, contentPackage?: string}} config -
43
+ * @param {{languages?: Readonly<Record<string, {tag: string, note?: string}>>, contentPackage?: string, rootDir?:string, paths?:{content?:string}}} config -
49
44
  * The configured languages, whose `note` names each language note.
50
45
  */
51
- export function fillWrittenIn(records: Record<string, any>[], config: {
46
+ export function fillEncodingRuns(records: Record<string, any>[], config: {
52
47
  languages?: Readonly<Record<string, {
53
48
  tag: string;
54
49
  note?: string;
55
50
  }>>;
56
51
  contentPackage?: string;
52
+ rootDir?: string;
53
+ paths?: {
54
+ content?: string;
55
+ };
57
56
  }): void;
58
57
  /**
59
58
  * The containing page's NOTE identity.
@@ -91,19 +90,13 @@ export type RecordRun = {
91
90
  tag: string | null;
92
91
  /**
93
92
  * - Its explicit font, an inherited ordinary
94
- * prose family, or the configured default for an opted-in native run.
93
+ * prose family, or the font of the selected encoding document.
95
94
  */
96
95
  font: string | null;
97
96
  /**
98
- * - Its explicit map or the configured map of an
99
- * opted-in native run; null for Roman language-only text.
97
+ * - Its resolved encoding document, or default for Roman text.
100
98
  */
101
- map: string | null;
102
- /**
103
- * - Explicit native opt-in on this construct;
104
- * absent on Roman runs. This internal flag is not a SQL column.
105
- */
106
- nativefont?: boolean | undefined;
99
+ enc: string | null;
107
100
  /**
108
101
  * - 1-based file line of its opening.
109
102
  */
@@ -26,3 +26,5 @@ export const LANGUAGE_EMPHASES: readonly string[];
26
26
  export const SCRIPT_DIRECTIONS: readonly string[];
27
27
  /** The `subType` of a script note. */
28
28
  export const SCRIPT_SUBTYPE: "script";
29
+ /** The ordinary prose families accepted by font=. */
30
+ export const GENERIC_FAMILIES: readonly string[];
@@ -12,7 +12,7 @@ export function emphasesFromRecords(records: Iterable<Record<string, any>> | und
12
12
  *
13
13
  * @param {ReadonlyMap<string, Record<string, any>>} byName - Each configured
14
14
  * language's note record, by language name, from
15
- * {@link module:engine/map-lexicon.languageRecordsByName}.
15
+ * {@link module:engine/encoding-lexicon.languageRecordsByName}.
16
16
  * @returns {Map<string, LanguageEmphasis>} The conventions, by language name;
17
17
  * a language whose note states none, or one the build does not know, is
18
18
  * absent.
@@ -1,9 +1,8 @@
1
1
  /**
2
2
  * The faces the package's notes set text in, read from the notes
3
3
  * themselves: every Markdown file under the content tree that writes `font=`
4
- * is scanned for its runs, and the face every language note names in
5
- * `data.writtenIn` counts, since a run marked with the language alone is set
6
- * in it.
4
+ * is scanned for its runs, and encoding documents supply the fonts their
5
+ * encoded runs infer.
7
6
  *
8
7
  * @param {DeliveryConfig} config - The resolved configuration.
9
8
  * @param {import("./script-fonts.mjs").ScriptFonts} installed - The fonts package.
@@ -4,6 +4,7 @@
4
4
  * @typedef {object} FaceCodepoint
5
5
  * @property {string} codepoint - `U+` and the hexadecimal code point.
6
6
  * @property {string} glyph - The glyph's name in the face.
7
+ * @property {string} [code] - The font's case-sensitive glyph code.
7
8
  * @property {string} kind - What it is: `letter`, `numeral`, `mark` and so on.
8
9
  */
9
10
  /**
@@ -77,6 +78,10 @@ export type FaceCodepoint = {
77
78
  * - The glyph's name in the face.
78
79
  */
79
80
  glyph: string;
81
+ /**
82
+ * - The font's case-sensitive glyph code.
83
+ */
84
+ code?: string | undefined;
80
85
  /**
81
86
  * - What it is: `letter`, `numeral`, `mark` and so on.
82
87
  */
@@ -11,7 +11,7 @@
11
11
  * @param {string} text - Markdown, optionally beginning with YAML frontmatter.
12
12
  * @param {{dark?: boolean, infobox?: boolean, file?: string, currentDate?: string,
13
13
  * index?: import("./preview-index.mjs").PreviewIndex}} [options] - Explicit palette, profile visibility, diagnostic filename, neutral current date (default "720.1") and the content index, from {@link module:engine/preview-index.previewIndex}.
14
- * @returns {{ok: boolean, html: string, frontmatter: object, findings: object[]}} HTML and metadata with locally calculable ages; unavailable ages remain absent or null.
14
+ * @returns {{ok: boolean, html: string, frontmatter: object, findings: object[]}} HTML and metadata with locally calculable ages; unavailable ages remain absent or null. Error findings set `ok` to false while retaining the HTML.
15
15
  */
16
16
  export function renderPreview(text: string, { dark, infobox, file, currentDate, index }?: {
17
17
  dark?: boolean;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * A noun's stated plural, or the first literal ending replacement that fits.
3
+ *
4
+ * @param {{form: string, class?: unknown, plural?: unknown}} word - A word of
5
+ * `data.words`.
6
+ * @param {Record<string, any>|undefined} grammar - Its language's
7
+ * `data.grammar`.
8
+ * @returns {string|null} The plural, or `null` for a word that is no noun or
9
+ * that no rule fits.
10
+ */
11
+ export function pluralOf(word: {
12
+ form: string;
13
+ class?: unknown;
14
+ plural?: unknown;
15
+ }, grammar: Record<string, any> | undefined): string | null;
16
+ /**
17
+ * The plural a language's `data.grammar.plural` rule gives a form: the first
18
+ * literal ending replacement that fits, whatever the form's class.
19
+ *
20
+ * @param {string} form - The form.
21
+ * @param {Record<string, any>|undefined} grammar - Its language's
22
+ * `data.grammar`.
23
+ * @returns {string|null} The plural, or `null` where no rule fits.
24
+ */
25
+ export function pluralByRule(form: string, grammar: Record<string, any> | undefined): string | null;