@heroiclands/package-build 22.21.0 → 22.23.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.
- package/CHANGELOG.md +223 -0
- package/assets/styles/content-base.css +162 -0
- package/bin/content-commands.mjs +77 -17
- package/bin/package-build.mjs +15 -2
- package/ci/content-format-reference.mjs +68 -1
- package/config.mjs +26 -0
- package/content-config.mjs +153 -6
- package/docs/api.md +120 -89
- package/docs/authoring/assets.md +14 -0
- package/docs/authoring/dates-and-calendars.md +41 -3
- package/docs/authoring/frontmatter.md +2 -2
- package/docs/authoring/links-and-markup.md +325 -35
- package/docs/commands.md +12 -10
- package/docs/configuration.md +117 -14
- package/docs/content-format.md +4 -2
- package/docs/guides/book.md +5 -4
- package/docs/guides/reference-pages.md +15 -0
- package/docs/reference/format-details.md +545 -104
- package/docs/reference/note-types.md +30 -13
- package/engine/actor-compiler.mjs +23 -0
- package/engine/anchored-sections.mjs +35 -4
- package/engine/anchors.mjs +26 -30
- package/engine/art-fields.mjs +118 -0
- package/engine/art-slots.mjs +7 -1
- package/engine/asset-index.mjs +160 -10
- package/engine/asset-replacement.mjs +93 -0
- package/engine/asset-types.mjs +240 -0
- package/engine/base-compiler.mjs +139 -22
- package/engine/base-styles.mjs +149 -0
- package/engine/bundles.mjs +13 -2
- package/engine/compendiums.mjs +8 -1
- package/engine/content-blocks.mjs +410 -0
- package/engine/content-embeds.mjs +19 -0
- package/engine/content-figures.mjs +468 -0
- package/engine/content-footnotes.mjs +197 -0
- package/engine/content-format-check.mjs +15 -12
- package/engine/content-format.yaml +1 -1
- package/engine/content-images.mjs +126 -25
- package/engine/content-index.mjs +38 -12
- package/engine/content-links.mjs +14 -6
- package/engine/content-tables.mjs +45 -4
- package/engine/content-tasklists.mjs +189 -0
- package/engine/docs-checks.mjs +4 -4
- package/engine/extension-attributes.mjs +48 -2
- package/engine/field-reference.mjs +31 -10
- package/engine/field-spec.mjs +10 -8
- package/engine/foreign-catalog.mjs +143 -18
- package/engine/frontmatter-lint.mjs +120 -65
- package/engine/frontmatter.mjs +3 -3
- package/engine/heading-attributes.mjs +321 -0
- package/engine/helpers.mjs +109 -41
- package/engine/homepage.mjs +8 -8
- package/engine/index.mjs +3 -0
- package/engine/infobox-registry.mjs +4 -1
- package/engine/infobox-render.mjs +15 -3
- package/engine/infobox.mjs +129 -15
- package/engine/itinerary-scenes.mjs +4 -10
- package/engine/journals.mjs +294 -50
- package/engine/lore-events.mjs +197 -0
- package/engine/macros.mjs +1 -1
- package/engine/markdown-expressions.mjs +434 -59
- package/engine/note-dates.mjs +354 -12
- package/engine/note-frontmatter.mjs +7 -16
- package/engine/note-vocabulary.mjs +183 -42
- package/engine/page-lists.mjs +358 -0
- package/engine/pathnames.mjs +36 -0
- package/engine/pdf-build.mjs +431 -74
- package/engine/pdf-images.mjs +64 -0
- package/engine/pdf-render.mjs +563 -66
- package/engine/rank-ladder.mjs +198 -0
- package/engine/reckoning-markers.mjs +1 -1
- package/engine/retired-fields.mjs +8 -13
- package/engine/scenes.mjs +26 -7
- package/engine/site-build.mjs +166 -23
- package/engine/site-config.mjs +10 -1
- package/engine/site-index.mjs +90 -3
- package/engine/site-preview.mjs +20 -7
- package/engine/social-ties.mjs +52 -14
- package/engine/sql-tables.mjs +66 -9
- package/engine/standings.mjs +89 -6
- package/engine/system-block.mjs +56 -30
- package/engine/web-wikilinks.mjs +48 -1
- package/hm3/actors.mjs +8 -5
- package/manifest.mjs +43 -24
- package/package.json +1 -1
- package/packagebuild-metadata.jsonl +13 -13
- package/sohl/actors.mjs +22 -99
- package/sohl/item-fields.mjs +5 -5
- package/sohl/items.mjs +1 -1
- package/sohl/note-schemas.mjs +11 -21
- package/types/config.d.mts +9 -0
- package/types/content-config.d.mts +48 -1
- package/types/engine/actor-compiler.d.mts +11 -0
- package/types/engine/anchored-sections.d.mts +24 -0
- package/types/engine/anchors.d.mts +9 -4
- package/types/engine/art-fields.d.mts +64 -0
- package/types/engine/asset-index.d.mts +43 -0
- package/types/engine/asset-replacement.d.mts +22 -0
- package/types/engine/asset-types.d.mts +18 -0
- package/types/engine/base-compiler.d.mts +19 -17
- package/types/engine/base-styles.d.mts +93 -0
- package/types/engine/content-blocks.d.mts +87 -0
- package/types/engine/content-embeds.d.mts +16 -0
- package/types/engine/content-figures.d.mts +101 -0
- package/types/engine/content-footnotes.d.mts +80 -0
- package/types/engine/content-format-check.d.mts +8 -6
- package/types/engine/content-images.d.mts +78 -12
- package/types/engine/content-index.d.mts +8 -2
- package/types/engine/content-tables.d.mts +12 -4
- package/types/engine/content-tasklists.d.mts +72 -0
- package/types/engine/extension-attributes.d.mts +22 -1
- package/types/engine/field-reference.d.mts +21 -0
- package/types/engine/field-spec.d.mts +20 -16
- package/types/engine/foreign-catalog.d.mts +39 -0
- package/types/engine/frontmatter.d.mts +1 -1
- package/types/engine/heading-attributes.d.mts +179 -0
- package/types/engine/helpers.d.mts +29 -10
- package/types/engine/homepage.d.mts +7 -7
- package/types/engine/index.d.mts +1 -0
- package/types/engine/infobox-registry.d.mts +4 -1
- package/types/engine/infobox-render.d.mts +6 -1
- package/types/engine/infobox.d.mts +6 -0
- package/types/engine/journals.d.mts +41 -12
- package/types/engine/lore-events.d.mts +14 -0
- package/types/engine/markdown-expressions.d.mts +46 -2
- package/types/engine/note-dates.d.mts +64 -1
- package/types/engine/note-frontmatter.d.mts +1 -4
- package/types/engine/note-vocabulary.d.mts +82 -6
- package/types/engine/page-lists.d.mts +126 -0
- package/types/engine/pathnames.d.mts +26 -0
- package/types/engine/pdf-build.d.mts +28 -6
- package/types/engine/pdf-images.d.mts +52 -0
- package/types/engine/pdf-render.d.mts +84 -2
- package/types/engine/rank-ladder.d.mts +32 -0
- package/types/engine/retired-fields.d.mts +4 -6
- package/types/engine/site-build.d.mts +27 -4
- package/types/engine/site-config.d.mts +9 -0
- package/types/engine/site-index.d.mts +67 -1
- package/types/engine/site-preview.d.mts +1 -1
- package/types/engine/sql-tables.d.mts +31 -7
- package/types/engine/standings.d.mts +21 -3
- package/types/engine/system-block.d.mts +37 -14
- package/types/engine/web-wikilinks.d.mts +3 -1
- package/types/hm3/actors.d.mts +21 -3
- package/types/manifest.d.mts +19 -23
- package/types/sohl/actors.d.mts +6 -7
- package/engine/content-admonitions.mjs +0 -114
- package/engine/content-captions.mjs +0 -181
- package/engine/content-secrets.mjs +0 -112
- package/types/engine/content-admonitions.d.mts +0 -24
- package/types/engine/content-captions.d.mts +0 -45
- package/types/engine/content-secrets.d.mts +0 -17
package/engine/pdf-images.mjs
CHANGED
|
@@ -40,6 +40,70 @@ export const pdfTextHeight = PDF_PAGE.height - 2 * PDF_PAGE.margin;
|
|
|
40
40
|
export const pdfColumnWidth = (columns = 2) =>
|
|
41
41
|
(pdfTextWidth * (1 - 0.04 * (columns - 1))) / columns;
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* The fraction of the page's one-column measure a picture's role may fill at
|
|
45
|
+
* most — one table, read by {@link bookImageWidthIn}, so a policy change here
|
|
46
|
+
* is the one line it costs rather than an edit to every note drawing a role.
|
|
47
|
+
*
|
|
48
|
+
* A `portrait` or an `emblem` names a subject or a mark, which sits beside
|
|
49
|
+
* prose rather than replacing a page of it; a `banner`, a `plate` and a `map`
|
|
50
|
+
* are each meant to be looked at in full. The measure is the page's own text
|
|
51
|
+
* width, {@link pdfTextWidth}, so a role's slot does not shrink when a page
|
|
52
|
+
* happens to be set in two columns — it is what the picture is *for* that
|
|
53
|
+
* sets the slot, not the layout it lands in.
|
|
54
|
+
*
|
|
55
|
+
* @type {Readonly<Record<string, number>>}
|
|
56
|
+
*/
|
|
57
|
+
export const BOOK_ROLE_SLOTS = Object.freeze({
|
|
58
|
+
portrait: 0.5,
|
|
59
|
+
emblem: 0.5,
|
|
60
|
+
banner: 1,
|
|
61
|
+
plate: 1,
|
|
62
|
+
map: 1,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The book's nominal width for an icon-type picture, in inches, whatever its
|
|
67
|
+
* file holds — almost every icon is an SVG with no pixel count to measure.
|
|
68
|
+
*
|
|
69
|
+
* @type {number}
|
|
70
|
+
*/
|
|
71
|
+
export const BOOK_ICON_WIDTH_IN = 1;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The width the book draws one picture at, in inches, when nothing authored
|
|
75
|
+
* narrows it to a named `size=`.
|
|
76
|
+
*
|
|
77
|
+
* > drawn width = min(the role's slot, natural pixels ÷ the print floor)
|
|
78
|
+
*
|
|
79
|
+
* **Every size here is a maximum, never a target**: a picture is never drawn
|
|
80
|
+
* larger than it was made. The print floor is {@link PDF_PAGE.dpi}, the same
|
|
81
|
+
* constant the page geometry above is set against, so a role's slot and the
|
|
82
|
+
* page it is drawn on cannot disagree about what a pixel is worth.
|
|
83
|
+
*
|
|
84
|
+
* An icon-type address takes the nominal icon width whatever role it might
|
|
85
|
+
* otherwise carry — `role` never reaches one, since the asset record refuses
|
|
86
|
+
* it there. A vector carries no pixel count, so nothing narrows its role's
|
|
87
|
+
* slot. A picture declaring no role answers `undefined`: the medium's
|
|
88
|
+
* ordinary size, decided elsewhere by a named `size=` or by its own natural
|
|
89
|
+
* pixels within whatever it is set in.
|
|
90
|
+
*
|
|
91
|
+
* @param {object} [asset] - What {@link module:engine/art-fields.assetImageInfoByPathname}
|
|
92
|
+
* records for the picture's address.
|
|
93
|
+
* @param {string} [asset.type] - The asset's type — `icon` or `image`.
|
|
94
|
+
* @param {string} [asset.role] - The picture's declared role.
|
|
95
|
+
* @param {number|""} [asset.width] - The file's own pixel width; blank for a vector.
|
|
96
|
+
* @returns {number|undefined} The drawn width, in inches.
|
|
97
|
+
*/
|
|
98
|
+
export function bookImageWidthIn({ type, role, width } = {}) {
|
|
99
|
+
if (type === "icon") return BOOK_ICON_WIDTH_IN;
|
|
100
|
+
const fraction = role ? BOOK_ROLE_SLOTS[role] : undefined;
|
|
101
|
+
if (!fraction) return undefined;
|
|
102
|
+
const slot = fraction * pdfTextWidth;
|
|
103
|
+
if (typeof width !== "number" || !Number.isFinite(width) || width <= 0) return slot;
|
|
104
|
+
return Math.min(slot, width / PDF_PAGE.dpi);
|
|
105
|
+
}
|
|
106
|
+
|
|
43
107
|
/**
|
|
44
108
|
* Optimize staged raster images without changing their authored files.
|
|
45
109
|
*
|