@heroiclands/package-build 25.5.4 → 25.6.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 (108) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +7 -0
  3. package/assets/styles/content-base.css +1 -1
  4. package/bin/content-commands.mjs +32 -8
  5. package/docs/api.md +81 -32
  6. package/docs/authoring/frontmatter.md +1 -1
  7. package/docs/authoring/links-and-markup.md +59 -10
  8. package/docs/commands.md +60 -17
  9. package/docs/configuration.md +3 -2
  10. package/docs/content-format.md +50 -1
  11. package/docs/diagnostics.md +17 -0
  12. package/docs/guides/module-project.md +11 -3
  13. package/docs/guides/reference-pages.md +4 -1
  14. package/docs/guides/site.md +13 -3
  15. package/docs/guides/writing-in-invented-scripts.md +5 -2
  16. package/docs/reference/format-details.md +233 -138
  17. package/docs/reference/note-types.md +165 -152
  18. package/docs/reference/theme-pages.md +1 -0
  19. package/e2e.mjs +1 -1
  20. package/engine/base-compiler.mjs +2 -0
  21. package/engine/compile-corpus.mjs +6 -2
  22. package/engine/content-charset.mjs +1 -1
  23. package/engine/content-format.yaml +9 -7
  24. package/engine/content-html.mjs +3 -2
  25. package/engine/content-index.mjs +23 -0
  26. package/engine/content-links.mjs +8 -0
  27. package/engine/content-render.mjs +14 -2
  28. package/engine/content-scripts.mjs +44 -6
  29. package/engine/content-session.mjs +11 -7
  30. package/engine/content-spans.mjs +3 -4
  31. package/engine/content-tables.mjs +12 -5
  32. package/engine/content-verse.mjs +52 -10
  33. package/engine/core-report.mjs +27 -18
  34. package/engine/culture-reach.mjs +3 -0
  35. package/engine/declared-sections.mjs +100 -0
  36. package/engine/derived-sections.mjs +36 -2
  37. package/engine/dictionary-rows.mjs +2 -1
  38. package/engine/generated-sections.mjs +2 -0
  39. package/engine/holdings.mjs +107 -3
  40. package/engine/index-records.mjs +3 -1
  41. package/engine/index.mjs +1 -1
  42. package/engine/language-data.mjs +0 -1
  43. package/engine/language-names.mjs +53 -23
  44. package/engine/language-rows.mjs +1 -3
  45. package/engine/language-terms.mjs +7 -10
  46. package/engine/map-dot.mjs +22 -0
  47. package/engine/markdown-blocks.mjs +23 -8
  48. package/engine/markdownlint-run.mjs +1 -1
  49. package/engine/markup-validation.mjs +2 -0
  50. package/engine/metadata-index.mjs +1 -0
  51. package/engine/note-addresses.mjs +16 -0
  52. package/engine/note-vocabulary.mjs +29 -13
  53. package/engine/npc-generate.mjs +52 -7
  54. package/engine/office-holders.mjs +76 -0
  55. package/engine/page-breaks.mjs +143 -0
  56. package/engine/pdf-build.mjs +12 -4
  57. package/engine/pdf-render.mjs +12 -2
  58. package/engine/place-kinds.mjs +106 -0
  59. package/engine/preview-index.mjs +4 -2
  60. package/engine/settlement-tables.mjs +410 -675
  61. package/engine/settlement-terms.mjs +118 -0
  62. package/engine/site-build.mjs +14 -7
  63. package/engine/site-preview.mjs +3 -0
  64. package/engine/site-render.mjs +18 -4
  65. package/engine/site-root.mjs +10 -1
  66. package/engine/site-serve-http.mjs +151 -0
  67. package/engine/site-serve.mjs +196 -126
  68. package/engine/sql-tables.mjs +101 -7
  69. package/engine/standing-terms.mjs +9 -5
  70. package/engine/standings.mjs +83 -31
  71. package/engine/unique-items.mjs +85 -0
  72. package/engine/verse-metre.mjs +50 -5
  73. package/engine/verse-regions.mjs +16 -0
  74. package/package.json +9 -4
  75. package/site-theme/data/banner-kinds.yaml +2 -0
  76. package/sohl/actors.mjs +4 -3
  77. package/types/e2e.d.mts +1 -1
  78. package/types/engine/content-html.d.mts +2 -1
  79. package/types/engine/content-scripts.d.mts +9 -1
  80. package/types/engine/content-verse.d.mts +11 -2
  81. package/types/engine/core-report.d.mts +6 -2
  82. package/types/engine/culture-reach.d.mts +3 -0
  83. package/types/engine/declared-sections.d.mts +30 -0
  84. package/types/engine/derived-sections.d.mts +5 -1
  85. package/types/engine/holdings.d.mts +34 -2
  86. package/types/engine/index-records.d.mts +2 -1
  87. package/types/engine/language-names.d.mts +18 -6
  88. package/types/engine/language-terms.d.mts +5 -1
  89. package/types/engine/markdown-blocks.d.mts +5 -1
  90. package/types/engine/npc-generate.d.mts +3 -0
  91. package/types/engine/office-holders.d.mts +33 -0
  92. package/types/engine/page-breaks.d.mts +38 -0
  93. package/types/engine/pdf-render.d.mts +2 -0
  94. package/types/engine/place-kinds.d.mts +18 -0
  95. package/types/engine/settlement-tables.d.mts +25 -158
  96. package/types/engine/settlement-terms.d.mts +53 -0
  97. package/types/engine/site-build.d.mts +3 -1
  98. package/types/engine/site-render.d.mts +6 -2
  99. package/types/engine/site-root.d.mts +3 -1
  100. package/types/engine/site-serve-http.d.mts +1 -0
  101. package/types/engine/site-serve.d.mts +12 -6
  102. package/types/engine/sql-tables.d.mts +35 -3
  103. package/types/engine/standing-terms.d.mts +3 -2
  104. package/types/engine/standings.d.mts +14 -2
  105. package/types/engine/unique-items.d.mts +12 -0
  106. package/types/engine/verse-metre.d.mts +2 -1
  107. package/types/engine/verse-regions.d.mts +8 -0
  108. package/vendor/markdownlint.mjs +855 -569
@@ -21,6 +21,23 @@ export function findSqlBlocks(markdown: string): Array<{
21
21
  layout: string;
22
22
  block: string;
23
23
  }>;
24
+ /**
25
+ * Where a query reads the `file` block of the index record: `file.path`,
26
+ * `file.folder` or `file.name`, bare or qualified by a relation or its alias.
27
+ * A note is selected by property, tag or address, so a query that reaches for
28
+ * the file it was written in is refused. A field of a note's own data that is
29
+ * named `file` is not the block and is left alone.
30
+ *
31
+ * @param {string} sql - One fence's query.
32
+ * @returns {{line: number, column: number, text: string}|undefined} The first
33
+ * reference, its 0-based line within the query and 1-based column, or
34
+ * nothing where the query makes none.
35
+ */
36
+ export function findFileReference(sql: string): {
37
+ line: number;
38
+ column: number;
39
+ text: string;
40
+ } | undefined;
24
41
  /**
25
42
  * Open a DuckDB view over the content index.
26
43
  *
@@ -205,25 +222,35 @@ export function prepareInlineSqlExpressions(db: any, sources: any): Promise<Map<
205
222
  * @param {Map<string, Map<string, string>>} [opts.derived] - The derived
206
223
  * lists, from an earlier call over the same records, which are not derived
207
224
  * again.
225
+ * @param {Map<string,{raw?:string}>} [opts.parsed] - Captured source locators.
208
226
  * @param {object[]} [opts.all=records] - Complete records for lexical lineage
209
227
  * traversal through providers outside the surface's audience.
210
228
  * @returns {Promise<{sections: Map<string, string>, views: Set<string>,
211
229
  * derived: Map<string, Map<string, string>>,
212
- * lexical: Map<string, import("./lexical-sections.mjs").LexicalSection[]>}>} Note file to its sections,
230
+ * lexical: Map<string, import("./lexical-sections.mjs").LexicalSection[]>,
231
+ * declared: Map<string, Array<{slug:string,heading:string,markdown:string}>>}>} Note file to its sections,
213
232
  * joined in order; the files whose sections hold an event view's fence; and
214
233
  * the derived lists alone.
215
234
  */
216
- export function generatedSectionsFor(db: object | undefined, records: object[], contentBase: string, { only, foreignIndex, config, derived: given, all }?: {
235
+ export function generatedSectionsFor(db: object | undefined, records: object[], contentBase: string, { only, foreignIndex, config, derived: given, all, parsed }?: {
217
236
  only?: string | undefined;
218
237
  foreignIndex?: Map<string, object> | undefined;
219
238
  config?: object | undefined;
220
239
  derived?: Map<string, Map<string, string>> | undefined;
240
+ parsed?: Map<string, {
241
+ raw?: string;
242
+ }> | undefined;
221
243
  all?: object[] | undefined;
222
244
  }): Promise<{
223
245
  sections: Map<string, string>;
224
246
  views: Set<string>;
225
247
  derived: Map<string, Map<string, string>>;
226
248
  lexical: Map<string, import("./lexical-sections.mjs").LexicalSection[]>;
249
+ declared: Map<string, Array<{
250
+ slug: string;
251
+ heading: string;
252
+ markdown: string;
253
+ }>>;
227
254
  }>;
228
255
  /**
229
256
  * Join each note's generated sections to its body among the sources a
@@ -262,13 +289,18 @@ export function joinGeneratedSections(generated: {
262
289
  * empty set carrying them.
263
290
  *
264
291
  * @param {Map<string, object[]>} prepared - From {@link prepareSqlTables}.
265
- * @param {{sections: Map<string, string>, lexical?: Map<string, import("./lexical-sections.mjs").LexicalSection[]>}} generated - From
292
+ * @param {{sections: Map<string, string>, lexical?: Map<string, import("./lexical-sections.mjs").LexicalSection[]>, declared?: Map<string, Array<{slug:string,heading:string,markdown:string}>>}} generated - From
266
293
  * {@link generatedSectionsFor}.
267
294
  * @returns {void}
268
295
  */
269
296
  export function attachGeneratedSections(prepared: Map<string, object[]>, generated: {
270
297
  sections: Map<string, string>;
271
298
  lexical?: Map<string, import("./lexical-sections.mjs").LexicalSection[]>;
299
+ declared?: Map<string, Array<{
300
+ slug: string;
301
+ heading: string;
302
+ markdown: string;
303
+ }>>;
272
304
  }): void;
273
305
  /**
274
306
  * Each declared dependency's cached index, as {@link openNotesDatabase} attaches
@@ -20,8 +20,9 @@ export const STANDING_BODY_TYPES: readonly string[];
20
20
  * The keys one standing carries, as inner-key declarations.
21
21
  *
22
22
  * `rank` is the level on the body's own `governance.ranks` ladder, and every
23
- * membership states one. `office` is a key of its `governance.offices` map, and
24
- * is stated only where the being holds a post. `societies` names the societies
23
+ * membership states one. `office` is a key of its `governance.offices` map, or
24
+ * a list of them where the being holds several posts in that body, and is
25
+ * stated only where the being holds a post. `societies` names the societies
25
26
  * the membership is held in, as a list because a membership can span several.
26
27
  *
27
28
  * @type {readonly import("./data-keys.mjs").InnerKeySpec[]}
@@ -98,12 +98,24 @@ export function standingsDigest(fm: object): {
98
98
  ranks?: Record<string, string>;
99
99
  offices?: Record<string, string>;
100
100
  } | undefined;
101
+ /**
102
+ * The posts a standing holds, trimmed, in the order written.
103
+ *
104
+ * `office` is one post or a list of them, and every reader — the line on the
105
+ * being's page, the SoHL item, the derived holders of an office — wants the
106
+ * same list from both.
107
+ *
108
+ * @param {object} [standing] - `{rank, office}`, either or both absent.
109
+ * @returns {string[]} The posts, blank and non-text entries left out.
110
+ */
111
+ export function standingOffices(standing?: object): string[];
101
112
  /**
102
113
  * What a standing says before the body that confers it — `War Chief, Hárár
103
114
  * (5), of ` — or `""` where no standing is held.
104
115
  *
105
116
  * The office leads, because it is the more particular of the two: a reader
106
- * meeting "War Chief" has been told the rung as well. The rung follows as its
117
+ * meeting "War Chief" has been told the rung as well. Several posts in one
118
+ * body lead in the order written, `Treasurer, Chancellor, …`. The rung follows as its
107
119
  * title with its level in parentheses, read from the body's own ladder; where
108
120
  * the ladder names no rung at that level, or none is available, it reads as
109
121
  * `Rank 5` and the number is not repeated. The body closes the phrase, which is
@@ -131,7 +143,7 @@ export function standingLead(standing: object, digest?: {
131
143
  * 3. the entry states a standing at all — what a stated standing holds is the
132
144
  * inner-key check's, read from {@link STANDING_FIELDS};
133
145
  * 4. a `rank` is a level the named body's `governance.ranks` declares;
134
- * 5. an `office` is a key of that body's `governance.offices`.
146
+ * 5. each post an `office` names is a key of that body's `governance.offices`.
135
147
  *
136
148
  * Both of the last two are read from the named body's own frontmatter as the
137
149
  * lint runs, so a rung or a post that does not exist fails on every being pointing
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Report a unique item whose note links no place or being.
3
+ *
4
+ * @param {object} note - The note: `file`, `raw`, `body` and parsed `fm`.
5
+ * @param {{index?: object}} [options] - The lint's options.
6
+ * @returns {object[]} The finding, located at `unique`, or none.
7
+ */
8
+ export function checkUniqueItem(note: object, { index }?: {
9
+ index?: object;
10
+ }): object[];
11
+ /** The note types a unique item's links must reach at least one of. */
12
+ export const UNIQUE_ITEM_LINK_TYPES: readonly string[];
@@ -73,7 +73,7 @@ export function metreMessage({ min, max }: {
73
73
  * @param {ReadonlyArray<{start: number, end: number, indent: string, attributes: Record<string, string>, classes: string[]}>} blocks -
74
74
  * The divs, from {@link module:engine/content-verse.scanVerse}.
75
75
  * @param {string[]} lines - The source's lines.
76
- * @param {{languages?: Readonly<Record<string, {tag: string}>>, metres?: ReadonlyMap<string, import("./metre-declaration.mjs").Metre>, metreBooks?: ReadonlyMap<string, MetreBook>, lexicons?: ReadonlyMap<string, unknown>, attributeColumns: (line: string, key: string) => {key: number, value: number}}} ctx -
76
+ * @param {{languages?: Readonly<Record<string, {tag: string}>>, metres?: ReadonlyMap<string, import("./metre-declaration.mjs").Metre>, metreBooks?: ReadonlyMap<string, MetreBook>, lexicons?: ReadonlyMap<string, unknown>, referenceName?: (target: string) => string|undefined, attributeColumns: (line: string, key: string) => {key: number, value: number}}} ctx -
77
77
  * The metres and books, and how the div says its columns and where its
78
78
  * keys sit.
79
79
  * @returns {{errors: object[], warnings: object[]}} The findings at 1-based
@@ -92,6 +92,7 @@ export function metreFindings(blocks: ReadonlyArray<{
92
92
  metres?: ReadonlyMap<string, import("./metre-declaration.mjs").Metre>;
93
93
  metreBooks?: ReadonlyMap<string, MetreBook>;
94
94
  lexicons?: ReadonlyMap<string, unknown>;
95
+ referenceName?: (target: string) => string | undefined;
95
96
  attributeColumns: (line: string, key: string) => {
96
97
  key: number;
97
98
  value: number;
@@ -51,6 +51,14 @@ export type VerseRegion = {
51
51
  * - Authored body bytes.
52
52
  */
53
53
  body: string;
54
+ /**
55
+ * - Body without Markdown container prefixes.
56
+ */
57
+ logicalBody: string;
58
+ /**
59
+ * - Logical UTF-16 offsets mapped to authored body offsets, including the end.
60
+ */
61
+ bodyOffsets: number[];
54
62
  /**
55
63
  * - Authored values.
56
64
  */