rpg-engine 0.17.0 → 0.18.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 (42) hide show
  1. package/dist/commands/change/recipe.d.ts +2 -0
  2. package/dist/commands/change/recipe.js +4 -2
  3. package/dist/commands/reveal.d.ts +2 -0
  4. package/dist/commands/reveal.js +22 -3
  5. package/dist/commands/scene/close.js +3 -1
  6. package/dist/commands/scene/open.js +1 -1
  7. package/dist/commands/scene/scene.js +3 -2
  8. package/dist/commands/shared/packages/updates.d.ts +6 -0
  9. package/dist/commands/shared/packages/updates.js +114 -0
  10. package/dist/commands/shared/scene/scene.js +4 -0
  11. package/dist/commands/shared/time/recipes.d.ts +5 -0
  12. package/dist/commands/shared/time/recipes.js +19 -1
  13. package/dist/commands/status.d.ts +1 -0
  14. package/dist/commands/status.js +5 -0
  15. package/dist/commands/travel/travel.js +1 -0
  16. package/dist/commands/view/layers.d.ts +4 -2
  17. package/dist/commands/view/layers.js +15 -6
  18. package/dist/commands/view/place.d.ts +6 -0
  19. package/dist/commands/view/place.js +37 -13
  20. package/dist/commands/view/result.d.ts +2 -0
  21. package/dist/commands/view/view.d.ts +1 -0
  22. package/dist/commands/view/view.js +35 -12
  23. package/dist/core/context.d.ts +5 -0
  24. package/dist/core/length.d.ts +4 -1
  25. package/dist/core/length.js +13 -2
  26. package/dist/dashboard/app.js +1 -1
  27. package/dist/dashboard/dice/tray.js +7 -5
  28. package/dist/dashboard/parts/labels.js +26 -4
  29. package/dist/dashboard/parts/widgets.js +1 -1
  30. package/dist/dashboard/play/rolls.js +3 -3
  31. package/dist/dashboard/settings/setup.js +30 -13
  32. package/dist/dashboard/shell/table.js +7 -3
  33. package/dist/packages/npm.js +32 -7
  34. package/dist/pages/index.d.ts +2 -2
  35. package/dist/pages/index.js +2 -2
  36. package/dist/pages/load.d.ts +2 -0
  37. package/dist/pages/load.js +16 -3
  38. package/dist/scene/scene.d.ts +4 -1
  39. package/instructions/combat.md +2 -2
  40. package/instructions/core.md +2 -2
  41. package/instructions/play.md +3 -3
  42. package/package.json +1 -1
@@ -32,7 +32,7 @@ import { shownLayers } from "./layers.js";
32
32
  import { mapText, shownMap } from "./map.js";
33
33
  import { characterNamed, memoryOf, memoryText } from "./memory.js";
34
34
  import { knownNamedPage, knownPage, lineValues, placeLook, shownName, shownPage, valueCoins } from "./page.js";
35
- import { isDown, sceneLine, seenEffect, shownPlace, shownScene, strangerImage } from "./place.js";
35
+ import { isDown, sceneLine, seenEffect, seenInScene, shownPlace, shownScene, strangerImage } from "./place.js";
36
36
  import { shownSaves } from "./saves.js";
37
37
  import { diaryCount, diaryLine, diaryLines, isCopyName, rollCount, rollsShown, seenByRoll, shownRoll, storyFact } from "./story.js";
38
38
  import { knownDocuments, knownEntries, knownEntryText, shownCalendar } from "./world.js";
@@ -105,9 +105,11 @@ export const view = defineCommand({
105
105
  const knowledge = input.as === undefined ? playerKnowledge(root, world, input.focus) : knowledgeOf(root, world, characterNamed(world, input.as));
106
106
  // An import under way, which the dashboard tells the player (D-491 (11)); never the character agent.
107
107
  const importing = input.as === undefined ? importShown(root) : undefined;
108
+ // Before a player character, as in the setup, the system's words still name its own questions, as its Outcomes.
108
109
  if (knowledge === undefined) {
109
110
  const language = readSettings(root).language;
110
- return { kind: "none", ...(language === undefined ? {} : { language }), ...(importing === undefined ? {} : { importing }) };
111
+ const words = shownWords(root, context, world, language);
112
+ return { kind: "none", ...(language === undefined ? {} : { language }), ...(words === undefined ? {} : { words }), ...(importing === undefined ? {} : { importing }) };
111
113
  }
112
114
  const pc = knowledge.pc;
113
115
  // Who of the party the view gives: the player characters, the living first, or the one whose view it is for a character agent, and the companions (VIEW-12).
@@ -133,10 +135,11 @@ export const view = defineCommand({
133
135
  }
134
136
  const present = readPresent(root).date;
135
137
  const known = (name) => shownName(world, knowledge, name);
138
+ const lineNamed = namedInLines(root, readLog(root), world, [...players, ...companionsOf(world)], known);
136
139
  return {
137
140
  kind: "journal",
138
141
  ...(present === undefined ? {} : { now: formatGameDate(present) }),
139
- ...shownJournal(root, world, knowledge, present, (entry) => storyFact(world, entry, known), known, (name) => placeLook(root, context, world, knowledge, name)),
142
+ ...shownJournal(root, world, knowledge, present, (entry) => storyFact(world, entry, lineNamed(entry)), known, (name) => placeLook(root, context, world, knowledge, name)),
140
143
  // The diaries the player reads, the last line first: never a hidden line, as another character's (DIA-4).
141
144
  thoughts: thoughtsIn(root, world).filter((one) => !one.hidden).reverse().map((one) => ({ who: known(one.page.name) ?? "someone", ...(one.date === undefined ? {} : { date: one.date }), text: one.text })),
142
145
  };
@@ -177,7 +180,7 @@ export const view = defineCommand({
177
180
  const { coins } = campaignCoins(root, context);
178
181
  const system = campaignSystem(root, context);
179
182
  const open = readJourney(root)?.at !== undefined;
180
- const companions = world.pages.filter((page) => page.type === "character" && page.fields.role === "companion");
183
+ const companions = companionsOf(world);
181
184
  const language = readSettings(root).language;
182
185
  const memberWords = system === undefined || language === undefined ? undefined : systemWordsOf(root, system, language, context);
183
186
  const sight = { root, context, world, knowledge, party: [...players, ...companions], ...(memberWords === undefined ? {} : { words: memberWords.words }) };
@@ -217,31 +220,31 @@ export const view = defineCommand({
217
220
  };
218
221
  const now = readPresent(root).date;
219
222
  const named = (name) => shownName(world, knowledge, name);
223
+ const log = readLog(root);
224
+ const lineNamed = namedInLines(root, log, world, sight.party, named);
220
225
  // The picture of someone the log names, as the player character knows them; of a stranger, as the scene shows them, a copy by its creature (D-420, D-421).
221
- const picture = (name) => {
222
- const page = knownNamedPage(world, knowledge, name);
226
+ const picture = (name, known = named) => {
227
+ const page = known(name) === undefined ? undefined : knownNamedPage(world, knowledge, name);
223
228
  const who = String(name ?? "").trim();
224
229
  return page !== undefined
225
230
  ? shownImage(root, context, world, page, (base) => knowsPage(knowledge, base))
226
231
  : strangerImage(root, context, world, isCopyName(world, who) ? who.replace(/ \d+$/, "") : who);
227
232
  };
228
- const log = readLog(root);
229
233
  const seenAt = seenByRoll(log, readOpenScene(root).scene?.seen);
230
234
  const shownLines = log.filter((entry) => entry.visibility === "public");
231
235
  const moment = lastMoment(shownLines);
232
- const diary = shownLines.flatMap((entry) => diaryLine(world, entry, named));
236
+ const diary = shownLines.flatMap((entry) => diaryLine(world, entry, lineNamed(entry)));
233
237
  const shown = input.diary?.trim().toLowerCase() === "all" ? diary.length : diaryCount(input.diary);
234
238
  const shownRolls = shownLines.filter((entry) => entry.type === "roll");
235
239
  const place = shownPlace(sight);
236
240
  const openScene = shownScene(sight);
237
241
  const settings = readSettings(root);
238
242
  const today = now === undefined ? undefined : calendarDayOf(root, context, now.day);
239
- const words = system === undefined || settings.language === undefined ? undefined : systemWordsOf(root, system, settings.language, context);
240
- const titled = withPageTitles(words, world);
243
+ const titled = shownWords(root, context, world, settings.language);
241
244
  // The system's pages of the party's sheets, in the campaign's language where the system has no translation (D-539).
242
245
  wantTexts(root, context, world, [...players, ...companions]);
243
246
  const textsTranslating = translatingTexts(context, world);
244
- const layers = shownLayers(world, knowledge);
247
+ const layers = shownLayers(world, knowledge, system, measuresOf(root, system));
245
248
  return {
246
249
  kind: "overview",
247
250
  campaign: settings.name,
@@ -261,7 +264,7 @@ export const view = defineCommand({
261
264
  scene: sceneLine(sight, named),
262
265
  diary: diary.slice(Math.max(0, diary.length - shown)),
263
266
  total: diary.length,
264
- rolls: shownRolls.slice(-rollCount(input.rolls)).map((entry) => shownRoll(world, entry, named, picture, seenAt.get(entry.id))),
267
+ rolls: shownRolls.slice(-rollCount(input.rolls)).map((entry) => shownRoll(world, entry, lineNamed(entry), (name) => picture(name, lineNamed(entry)), seenAt.get(entry.id))),
265
268
  rollsTotal: shownRolls.length,
266
269
  problems: campaignProblems(root, world, context).length,
267
270
  ...(importing === undefined ? {} : { importing }),
@@ -325,6 +328,26 @@ export const view = defineCommand({
325
328
  }
326
329
  },
327
330
  });
331
+ function companionsOf(world) {
332
+ return world.pages.filter((page) => page.type === "character" && page.fields.role === "companion");
333
+ }
334
+ /**
335
+ * How each line of the log names people: those of the open scene name one it gives by what the character sees of them as one it does not know, while it keeps
336
+ * them (D-568); the lines before it as the character knows them.
337
+ */
338
+ function namedInLines(root, log, world, party, named) {
339
+ const scene = readOpenScene(root).scene;
340
+ const opened = scene === undefined ? -1 : log.findLastIndex((entry) => entry.type === "scene-opened");
341
+ const inScene = new Set(opened < 0 ? [] : log.slice(opened + 1).map((entry) => entry.id));
342
+ const hiding = (name) => (typeof name === "string" && seenInScene(world, party, scene, name) ? undefined : named(name));
343
+ return (entry) => (inScene.has(entry.id) ? hiding : named);
344
+ }
345
+ /** The game system's words in the campaign's language, with its pages' titles, for the dashboard (D-403); none when it has neither. */
346
+ function shownWords(root, context, world, language) {
347
+ const system = campaignSystem(root, context);
348
+ const words = system === undefined || language === undefined ? undefined : systemWordsOf(root, system, language, context);
349
+ return withPageTitles(words, world);
350
+ }
328
351
  /**
329
352
  * The system's words for the page, with the names its translation gives its pages, as Palla di fuoco for Fireball, where its words do not name them (D-542):
330
353
  * those translated on this computer too, where the system has no words in the language (D-539).
@@ -158,6 +158,11 @@ export interface PackageManager {
158
158
  search(): Promise<PackageInfo[] | {
159
159
  failed: string;
160
160
  }>;
161
+ /**
162
+ * The newest version of a package npm's registry has that this engine reads (D-569), asked within a few seconds; undefined when the registry does not
163
+ * answer in time, or has none. Missing where npm is not asked, as in most tests.
164
+ */
165
+ newest?(name: string): Promise<string | undefined>;
161
166
  }
162
167
  /** How this rpg-engine is installed (D-515 (3)): globally by npm, which updates it; as npm link of a folder in development; or any other way, from that folder. */
163
168
  export type EngineInstall = {
@@ -21,7 +21,10 @@ export declare function formatLength(metres: number, units: UnitSystem, imperial
21
21
  export declare function formatSpeed(metresAnHour: number, units: UnitSystem, imperial?: ImperialUnits): string;
22
22
  /** A short length, as on the map of a place (GRD-5), in the units of the story: 7.5 m; in imperial with the game's foot, 25 feet. */
23
23
  export declare function formatStep(metres: number, units: UnitSystem, imperial?: ImperialUnits): string;
24
- /** A text with the lengths it writes in feet told in the units of the story, as a speed of the sheet (D-328): 30 ft., fly 60 ft. is 9 m, fly 18 m in metric. */
24
+ /**
25
+ * A text with the lengths it writes in feet and miles told in the units of the story, with the game's foot and mile, as a speed of the sheet (D-328): 30 ft.,
26
+ * fly 60 ft. is 9 m, fly 18 m in metric; a 15-foot cone a 4.5 m cone, a 10-foot-radius sphere a 3 m radius sphere, 500 miles 750 km.
27
+ */
25
28
  export declare function lengthsInUnits(text: string, units: UnitSystem, imperial?: ImperialUnits): string;
26
29
  /** The first length a text gives, in metres, as a sheet writes a speed: 30 ft., 30 feet, 9 m; undefined when it gives none, or a number without its unit. */
27
30
  export declare function readFirstLength(value: unknown, imperial?: ImperialUnits): number | undefined;
@@ -35,9 +35,20 @@ export function formatSpeed(metresAnHour, units, imperial = trueImperialUnits) {
35
35
  export function formatStep(metres, units, imperial = trueImperialUnits) {
36
36
  return units === "imperial" ? `${Math.round(metres / imperial.foot)} feet` : `${oneDecimal(metres)} m`;
37
37
  }
38
- /** A text with the lengths it writes in feet told in the units of the story, as a speed of the sheet (D-328): 30 ft., fly 60 ft. is 9 m, fly 18 m in metric. */
38
+ /**
39
+ * A text with the lengths it writes in feet and miles told in the units of the story, with the game's foot and mile, as a speed of the sheet (D-328): 30 ft.,
40
+ * fly 60 ft. is 9 m, fly 18 m in metric; a 15-foot cone a 4.5 m cone, a 10-foot-radius sphere a 3 m radius sphere, 500 miles 750 km.
41
+ */
39
42
  export function lengthsInUnits(text, units, imperial = trueImperialUnits) {
40
- return units === "imperial" ? text : text.replace(/(\d+(?:\.\d+)?)\s*(?:ft\.?|feet|foot)(?![a-z])/gi, (_, number) => formatStep(Number(number) * imperial.foot, units, imperial));
43
+ if (units === "imperial") {
44
+ return text;
45
+ }
46
+ // A hyphen may join the number to its unit, and the unit to the word it measures.
47
+ return text.replace(/(\d{1,3}(?:,\d{3})+|\d+(?:\.\d+)?)(?:-|\s*)(ft\.?|feet|foot|miles?)(?![a-z])(-(?=[a-z]))?/gi, (_, number, unit, hyphen) => {
48
+ const amount = Number(number.replace(/,/g, ""));
49
+ const told = /^mile/i.test(unit) ? formatLength(amount * imperial.mile, units, imperial) : formatStep(amount * imperial.foot, units, imperial);
50
+ return hyphen === undefined ? told : `${told} `;
51
+ });
41
52
  }
42
53
  /** The first length a text gives, in metres, as a sheet writes a speed: 30 ft., 30 feet, 9 m; undefined when it gives none, or a number without its unit. */
43
54
  export function readFirstLength(value, imperial = trueImperialUnits) {
@@ -189,7 +189,7 @@ function App() {
189
189
  if (number !== reading.current) {
190
190
  return;
191
191
  }
192
- setSystemWords(overview.kind === "overview" ? overview.words : undefined);
192
+ setSystemWords(overview.kind === "overview" || overview.kind === "none" ? overview.words : undefined);
193
193
  setSystemVerbs(overview.kind === "overview" ? overview.verbs : undefined);
194
194
  setChangedPages(overview.kind === "overview" ? overview.layers : undefined);
195
195
  if (number === reading.current) {
@@ -8,7 +8,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-ru
8
8
  import { useEffect, useRef, useState } from "preact/hooks";
9
9
  import { CoinFace, CoinFaces, DiceFaces, tossWords } from "../parts/faces.js";
10
10
  import { DieIcon, Icon } from "../parts/icons.js";
11
- import { notationModifier, shownText, signed } from "../parts/labels.js";
11
+ import { rollModifier, rollText, shownText, signed } from "../parts/labels.js";
12
12
  import { trayCheck, useRequested } from "../play/requested.js";
13
13
  import { Token } from "../sheet/party.js";
14
14
  import { soundPref, useChoice, usePref } from "../shell/prefs.js";
@@ -193,20 +193,22 @@ export function DiceTray({ requested, sheetThrow, party, campaign, onLanded, onS
193
193
  useEffect(() => {
194
194
  if (requested !== undefined) {
195
195
  const toss = requested.toss;
196
- const title = requested.check ?? (toss === undefined ? requested.notation : t("Coins"));
196
+ // The master's notation may name a field, as 1d20+stealth: in the system's words.
197
+ const written = rollText(requested.notation);
198
+ const title = requested.check ?? (toss === undefined ? written : t("Coins"));
197
199
  // A check's is the player's character's when it names no one; the master's own is no one's.
198
200
  const member = party.find((candidate) => candidate.name === requested.who) ?? (requested.by === "player" && toss === undefined ? party.find((candidate) => candidate.role === "pc") : undefined);
199
201
  void throwAndShow({
200
202
  free: false,
201
203
  title,
202
- ...(title === requested.notation || toss !== undefined ? {} : { notation: requested.notation }),
204
+ ...(title === written || toss !== undefined ? {} : { notation: written }),
203
205
  dice: requested.dice,
204
- modifier: notationModifier(requested.notation),
206
+ modifier: rollModifier(requested),
205
207
  total: requested.total,
206
208
  ...(requested.says === undefined ? {} : { says: requested.says }),
207
209
  ...(requested.tones === undefined ? {} : { tones: requested.tones }),
208
210
  ...(toss === undefined ? {} : { toss, says: capitalized(tossWords(toss)) }),
209
- text: toss === undefined ? requested.text : tossWords(toss),
211
+ text: toss === undefined ? rollText(requested.text) : tossWords(toss),
210
212
  ...(member === undefined ? {} : { member }),
211
213
  roll: requested.id,
212
214
  }, lingers.asked, mastersDice(requested, party, campaign));
@@ -1,5 +1,4 @@
1
- // Labels from the names of the fields, in English (D-273): "hit-dice-d8" reads "hit dice d8", "str-save" "STR save"; names in the campaign's language come later.
2
- import { isolated, numberText, pageLocale, systemWord, t, timeText } from "../text.js";
1
+ import { isolated, numberText, pageLocale, systemWord, systemWordAnyCase, t, timeText } from "../text.js";
3
2
  // The dice the page has a picture of: the d% as 100, the coin as 2.
4
3
  const drawnDice = [2, 4, 6, 8, 10, 12, 20, 100];
5
4
  /** A field's name as a label: its words apart, in capitals the short names, as ac, hp, or str which the system names Strength; age stays a word. */
@@ -51,10 +50,17 @@ export function drawnDiceOf(notation) {
51
50
  const oneOfTwo = count === 2 && /\d*d(?:\d+|%|F)(?:k[hl]1|d[hl]1)(?![\d])/i.test(notation);
52
51
  return count <= 2 ? { sides: Array.from({ length: count }, () => sides), ...(oneOfTwo ? { faded: true } : {}) } : { sides: [sides], count };
53
52
  }
54
- /** An item of a list as the page shows it: a short name in capitals, as WIS; any other with its first letter a capital, as Light hammer. */
53
+ /**
54
+ * An item of a list as the page shows it: in the system's words, a name and its number too, as Cleric 3 (playtest 19); a short name in capitals, as WIS; any other
55
+ * with its first letter a capital, as Light hammer.
56
+ */
55
57
  export function itemLabel(item, fields = new Set()) {
56
58
  const word = item.trim();
57
- return systemWord("words", word) ?? systemWord("fields", word) ?? (isShortName(word.toLowerCase(), fields) ? word.toUpperCase() : phraseLabel(word));
59
+ const counted = /^(.*\D)\s+(\d+)$/.exec(word);
60
+ const countedWord = counted === null ? undefined : systemWord("words", counted[1]);
61
+ // A sheet's value as the master wrote it, «Dice set», finds the system's word in any case, «dice set».
62
+ return systemWord("words", word) ?? systemWord("fields", word) ?? systemWordAnyCase("words", word) ?? (counted === null || countedWord === undefined ? undefined : `${countedWord} ${counted[2]}`)
63
+ ?? (isShortName(word.toLowerCase(), fields) ? word.toUpperCase() : phraseLabel(word));
58
64
  }
59
65
  /** A label of a sheet's line as a phrase, its first letter a capital: "sleight of hand" reads "Sleight of hand"; "STR save" stays as it is. */
60
66
  export function phraseLabel(label) {
@@ -88,6 +94,22 @@ export function notationModifier(notation) {
88
94
  const match = /([+-]\d+)$/.exec(notation.replace(/\s+/g, ""));
89
95
  return match === null ? 0 : Number(match[1]);
90
96
  }
97
+ /**
98
+ * The number a roll adds to its dice: its notation's, as the 5 of 2d20kh1+5; with a field's name in it, as the master's 1d20+stealth, what its total adds to the
99
+ * dice kept, as the notation tells no number (playtest 19). A pool that counts successes adds none of its own.
100
+ */
101
+ export function rollModifier(roll) {
102
+ const terms = roll.notation.replace(/\s+/g, "").split(/[+-]/);
103
+ const named = terms.some((term) => /^[a-z]/i.test(term) && !/^d(?:\d|%|F)/i.test(term));
104
+ if (!named || roll.dice.length === 0 || roll.dice.some((die) => die.success !== undefined)) {
105
+ return notationModifier(roll.notation);
106
+ }
107
+ return roll.total - roll.dice.reduce((sum, die) => (die.dropped === true ? sum : sum + die.value), 0);
108
+ }
109
+ /** A roll's notation or text with the fields it adds in the system's words: 1d20+stealth = 22 [15] + 7 (stealth +7) reads Furtività for stealth in Italian. */
110
+ export function rollText(text) {
111
+ return text.replace(/(?<![\w%-])[a-z][a-z0-9]*(?:-[a-z0-9]+)*(?![\w-])/g, (name) => systemWord("fields", name) ?? name);
112
+ }
91
113
  /**
92
114
  * A number as it reads in the page's language: −1 with a minus sign rather than a hyphen, 4,2 m with the Italian comma; a field whose kind is duration, as 3m
93
115
  * of the engine, in words: 3 minuti.
@@ -58,7 +58,7 @@ export function Track({ value, label }) {
58
58
  }
59
59
  /** A list as chips, or as lines when it is of sentences; what the character's parts add to it apart, with where it comes from (PRO-7). */
60
60
  export function Chips({ value, fields }) {
61
- return (_jsxs("span", { class: "chips-block", children: [_jsx(Items, { items: value.items ?? [], field: value.field, fields: fields }), value.always && (_jsxs("span", { class: "always", children: [_jsx("span", { class: "always-from", children: t("Always, from {sources}", { sources: value.always.from.join(` ${t("and")} `) }) }), _jsx(Items, { items: value.always.items, field: value.field, fields: fields })] }))] }));
61
+ return (_jsxs("span", { class: "chips-block", children: [_jsx(Items, { items: value.items ?? [], field: value.field, fields: fields }), value.always && (_jsxs("span", { class: "always", children: [_jsx("span", { class: "always-from", children: t("Always, from {sources}", { sources: value.always.from.map((source) => itemLabel(source)).join(` ${t("and")} `) }) }), _jsx(Items, { items: value.always.items, field: value.field, fields: fields })] }))] }));
62
62
  }
63
63
  /** A list's items, each a button that acts when the system names verbs for its field (D-495). */
64
64
  function Items({ items, field, fields }) {
@@ -9,7 +9,7 @@ import { CardHeader, useOpen } from "../parts/card.js";
9
9
  import { CoinFaces, DiceFaces, tossWords } from "../parts/faces.js";
10
10
  import { gameDateLabel, notationLabel } from "../parts/game-words.js";
11
11
  import { cardIcons, Icon } from "../parts/icons.js";
12
- import { notationModifier, strangerLabel } from "../parts/labels.js";
12
+ import { rollModifier, rollText, strangerLabel } from "../parts/labels.js";
13
13
  import { rollWindow } from "../parts/layout.js";
14
14
  import { Token } from "../sheet/party.js";
15
15
  import { capitalized, pageLocale, t } from "../text.js";
@@ -79,7 +79,7 @@ function RollRow({ roll, name, token, coins, fresh, greeted, several }) {
79
79
  const free = "free" in roll;
80
80
  // The whole roll, which the lines may cut: whom and what, the dice as the chat writes them, the notation in words, and when (D-299); a toss's coins in words.
81
81
  const toss = roll.toss === undefined ? undefined : tossWords(roll.toss);
82
- const said = [roll.check === undefined ? name : `${name} · ${roll.check}`, toss ?? roll.text, toss === undefined ? notationLabel(roll.words) : undefined, rolledWhen(roll), free ? t("Free roll · not logged") : undefined]
82
+ const said = [roll.check === undefined ? name : `${name} · ${roll.check}`, toss ?? rollText(roll.text), toss === undefined ? notationLabel(roll.words) : undefined, rolledWhen(roll), free ? t("Free roll · not logged") : undefined]
83
83
  .filter((line) => line !== undefined && line !== "")
84
84
  .join("\n");
85
85
  return (_jsxs("li", { class: ["roll", player ? "by-player" : "by-master", free ? "free" : "", entering ? "entering" : ""].filter((part) => part !== "").join(" "), "data-roll": roll.id, title: said, children: [marked && _jsx("span", { class: "roll-flag", "aria-hidden": "true", children: "!" }), token === undefined
@@ -91,7 +91,7 @@ function RollRow({ roll, name, token, coins, fresh, greeted, several }) {
91
91
  : roll.says === undefined
92
92
  ? _jsx("span", { class: "roll-total num", children: roll.total })
93
93
  : _jsx("span", { class: "roll-total roll-says", children: roll.says }), _jsx("span", { class: "roll-dice", children: toss === undefined
94
- ? (_jsxs(_Fragment, { children: [_jsx(DiceFaces, { dice: roll.dice, modifier: notationModifier(roll.notation), tones: roll.tones }), _jsx("span", { class: "visually-hidden", children: roll.text })] }))
94
+ ? (_jsxs(_Fragment, { children: [_jsx(DiceFaces, { dice: roll.dice, modifier: rollModifier(roll), tones: roll.tones }), _jsx("span", { class: "visually-hidden", children: rollText(roll.text) })] }))
95
95
  : _jsx("span", { class: "roll-toss", children: capitalized(toss) }) })] }));
96
96
  }
97
97
  /** What a roll's faces mean in place of its total: the coins of a toss in the page's language, or what an extension's roll says. */
@@ -29,36 +29,44 @@ export function SetupView({ setup }) {
29
29
  // The choices left to the master, as the game keeps them until the master makes them, and those just left here.
30
30
  const [leftHere, setLeftHere] = useState(new Set());
31
31
  const left = new Set([...(setup.left ?? []), ...leftHere].filter((name) => questions.some((question) => question.name === name && !answered(question))));
32
- // The first question still open, once: the player moves on from there; with none, the last card.
33
- const [at, setAt] = useState(() => {
34
- const first = questions.findIndex((question) => !answered(question) && !(setup.left ?? []).includes(question.name));
35
- return first < 0 ? questions.length : first;
36
- });
32
+ // Until the player uses the page, the card follows the chat: the first question still open, as the master fills them from what the player says there
33
+ // (playtest 01); with none, the last card. Once the player chooses or moves here, the card is theirs.
34
+ const [own, setOwn] = useState(false);
35
+ const [at, setAt] = useState(0);
36
+ const current = own ? at : firstOpen(questions, setup.left ?? []);
37
37
  // Whether the player moved among the cards: then the new card's title takes the focus, never at the first reading.
38
38
  const [moved, setMoved] = useState(false);
39
39
  const [said, setSaid] = useState();
40
- const done = at >= questions.length;
41
- const question = questions[Math.min(at, questions.length - 1)];
40
+ const done = current >= questions.length;
41
+ const question = questions[Math.min(current, questions.length - 1)];
42
42
  const step = steps.indexOf(setup.mode);
43
43
  const go = (index) => {
44
+ setOwn(true);
44
45
  setMoved(true);
45
46
  setAt(index);
46
47
  };
48
+ // A choice made here keeps the card where it is, as the player made it.
49
+ const touch = () => {
50
+ if (!own) {
51
+ setOwn(true);
52
+ setAt(current);
53
+ }
54
+ };
47
55
  const leave = async (name) => {
48
56
  const refused = await sendSetupWord({ leave: name });
49
57
  setSaid(refused);
50
58
  if (refused === undefined) {
51
59
  setLeftHere((before) => new Set([...before, name]));
52
- go(at + 1);
60
+ go(current + 1);
53
61
  }
54
62
  };
55
- return (_jsxs("section", { class: "setup", "aria-labelledby": "setup-title", children: [_jsx("div", { class: "setup-host", children: _jsx(Master, { mood: "happy" }) }), _jsx(CampaignName, { name: setup.name }), _jsx("h1", { id: "setup-title", class: "visually-hidden", children: t("Setting up {campaign}", { campaign: setup.name }) }), _jsx("ol", { class: "setup-steps", "aria-label": t("Steps"), children: steps.map((one, index) => (_jsxs("li", { class: index < step ? "done" : index === step ? "now" : undefined, "aria-current": index === step ? "step" : undefined, children: [_jsx("span", { class: "setup-step-dot", "aria-hidden": "true", children: index < step ? "✓" : index + 1 }), stepName(one)] }, one))) }), said !== undefined && _jsx("p", { class: "setup-problem", role: "alert", children: said }), !done && question !== undefined && (_jsx(Question, { question: question, count: t("{value} of {max}", { value: at + 1, max: questions.length }), left: left.has(question.name), focus: moved, onBack: at > 0 ? () => go(at - 1) : undefined, onNext: () => go(at + 1), onLeave: () => void leave(question.name), onProblem: setSaid }, question.name)), done && _jsx(Ready, { setup: setup, left: left, focus: moved, onGo: go, onProblem: setSaid }), _jsx("ol", { class: "setup-dots", "aria-label": t("Questions"), style: { "--count": String(questions.length) }, children: questions.map((one, index) => (_jsx("li", { children: _jsx("button", { type: "button", class: [answered(one) ? "answered" : left.has(one.name) ? "left" : "", index === at ? "here" : ""].filter((name) => name !== "").join(" "), "aria-label": answered(one) ? t("{setting}: answered", { setting: settingLabel(one.name) }) : left.has(one.name) ? t("{setting}: left to the master", { setting: settingLabel(one.name) }) : settingLabel(one.name), "aria-current": index === at ? "step" : undefined, onClick: () => go(index) }) }, one.name))) }), _jsx("p", { class: "setup-chat", children: t("You can also tell the master in the chat: they hear what you choose here.") })] }));
63
+ return (_jsxs("section", { class: "setup", "aria-labelledby": "setup-title", children: [_jsx("div", { class: "setup-host", children: _jsx(Master, { mood: "happy" }) }), _jsx(CampaignName, { name: setup.name }), _jsx("h1", { id: "setup-title", class: "visually-hidden", children: t("Setting up {campaign}", { campaign: setup.name }) }), _jsx("ol", { class: "setup-steps", "aria-label": t("Steps"), children: steps.map((one, index) => (_jsxs("li", { class: index < step ? "done" : index === step ? "now" : undefined, "aria-current": index === step ? "step" : undefined, children: [_jsx("span", { class: "setup-step-dot", "aria-hidden": "true", children: index < step ? "✓" : index + 1 }), stepName(one)] }, one))) }), said !== undefined && _jsx("p", { class: "setup-problem", role: "alert", children: said }), !done && question !== undefined && (_jsx(Question, { question: question, count: t("{value} of {max}", { value: current + 1, max: questions.length }), left: left.has(question.name), focus: moved, onBack: current > 0 ? () => go(current - 1) : undefined, onNext: () => go(current + 1), onLeave: () => void leave(question.name), onTouch: touch, onProblem: setSaid }, question.name)), done && _jsx(Ready, { setup: setup, left: left, focus: moved, onGo: go, onProblem: setSaid }), _jsx("ol", { class: "setup-dots", "aria-label": t("Questions"), style: { "--count": String(questions.length) }, children: questions.map((one, index) => (_jsx("li", { children: _jsx("button", { type: "button", class: [answered(one) ? "answered" : left.has(one.name) ? "left" : "", index === current ? "here" : ""].filter((name) => name !== "").join(" "), "aria-label": answered(one) ? t("{setting}: answered", { setting: settingLabel(one.name) }) : left.has(one.name) ? t("{setting}: left to the master", { setting: settingLabel(one.name) }) : settingLabel(one.name), "aria-current": index === current ? "step" : undefined, onClick: () => go(index) }) }, one.name))) }), _jsx("p", { class: "setup-chat", children: t("You can also tell the master in the chat: they hear what you choose here.") })] }));
56
64
  }
57
65
  /**
58
66
  * One question as its card shows it: what it is, its choices large with what each means and the one the game suggests, or a list's items; back, next, or left
59
67
  * to the master. Its title takes the focus when the player moved to it.
60
68
  */
61
- function Question({ question, count, left, focus, onBack, onNext, onLeave, onProblem }) {
69
+ function Question({ question, count, left, focus, onBack, onNext, onLeave, onTouch, onProblem }) {
62
70
  const [picked, setPicked] = useState();
63
71
  const resting = useRef(undefined);
64
72
  const heading = useRef(null);
@@ -81,6 +89,7 @@ function Question({ question, count, left, focus, onBack, onNext, onLeave, onPro
81
89
  }, []);
82
90
  // A click chooses at once; the arrows show each choice and send the one they rest on.
83
91
  const pick = (choice, byKey) => {
92
+ onTouch();
84
93
  setPicked(choice);
85
94
  clearTimeout(resting.current?.timer);
86
95
  resting.current = undefined;
@@ -94,7 +103,7 @@ function Question({ question, count, left, focus, onBack, onNext, onLeave, onPro
94
103
  }, keyRest);
95
104
  resting.current = { choice, timer };
96
105
  };
97
- return (_jsxs("article", { class: "setup-card", "aria-labelledby": id, children: [_jsx("p", { class: "eyebrow setup-count", children: count }), _jsx("h2", { id: id, ref: heading, tabIndex: -1, children: title }), _jsx("p", { class: "setup-about", children: phraseLabel(t(question.about)) }), question.choices !== undefined && _jsx(Choices, { question: question, value: value, labelledBy: id, onPick: pick }), isList && _jsx(ListQuestion, { question: question, onProblem: onProblem }), left && value === undefined && _jsx("p", { class: "setup-left", children: t("Left to the master: they choose, and tell you.") }), _jsxs("div", { class: "setup-moves", children: [onBack !== undefined && _jsx("button", { type: "button", class: "button setup-back", onClick: onBack, children: t("Back") }), open && !isList && _jsx("button", { type: "button", class: "button quiet", onClick: onLeave, children: t("You decide") }), _jsxs("button", { type: "button", class: open ? "button quiet" : "button gold", onClick: onNext, children: [open ? t("Skip") : t("Next"), " ", _jsx(Icon, { name: "send" })] })] })] }));
106
+ return (_jsxs("article", { class: "setup-card", "aria-labelledby": id, onFocusIn: onTouch, children: [_jsx("p", { class: "eyebrow setup-count", children: count }), _jsx("h2", { id: id, ref: heading, tabIndex: -1, children: title }), _jsx("p", { class: "setup-about", children: phraseLabel(t(question.about)) }), question.choices !== undefined && _jsx(Choices, { question: question, value: value, labelledBy: id, onPick: pick }), isList && _jsx(ListQuestion, { question: question, onTouch: onTouch, onProblem: onProblem }), left && value === undefined && _jsx("p", { class: "setup-left", children: t("Left to the master: they choose, and tell you.") }), _jsxs("div", { class: "setup-moves", children: [onBack !== undefined && _jsx("button", { type: "button", class: "button setup-back", onClick: onBack, children: t("Back") }), open && !isList && _jsx("button", { type: "button", class: "button quiet", onClick: onLeave, children: t("You decide") }), _jsxs("button", { type: "button", class: open ? "button quiet" : "button gold", onClick: onNext, children: [open ? t("Skip") : t("Next"), " ", _jsx(Icon, { name: "send" })] })] })] }));
98
107
  }
99
108
  /** A question's choices as a radio group: one stop of Tab, the arrows move among them and choose; each with what it means, the suggested one marked. */
100
109
  function Choices({ question, value, labelledBy, onPick }) {
@@ -116,10 +125,13 @@ function Choices({ question, value, labelledBy, onPick }) {
116
125
  return (_jsx("div", { class: "setup-choices", role: "radiogroup", "aria-labelledby": labelledBy, onKeyDown: move, children: choices.map((choice, index) => (_jsxs("button", { type: "button", role: "radio", "aria-checked": value === choice.value, tabIndex: index === stop ? 0 : -1, class: "setup-choice", onClick: () => onPick(choice.value, false), children: [_jsxs("strong", { children: [choice.label === undefined ? valueLabel(choice.value) : phraseLabel(t(choice.label)), choice.value === question.suggested && _jsx("span", { class: "setup-suggested", children: choice.value === question.last ? t("Like last time") : t("Suggested") })] }), choice.means !== undefined && _jsx("span", { children: phraseLabel(t(choice.means)) })] }, choice.value))) }));
117
126
  }
118
127
  /** A list of the setup, lines or veils: its items to take off, a field to add one, and None for a player who wants none. */
119
- function ListQuestion({ question, onProblem }) {
128
+ function ListQuestion({ question, onTouch, onProblem }) {
120
129
  const [item, setItem] = useState("");
121
130
  const field = useRef(null);
122
- const send = (change) => void changeSetting(change).then(onProblem);
131
+ const send = (change) => {
132
+ onTouch();
133
+ void changeSetting(change).then(onProblem);
134
+ };
123
135
  return (_jsxs("div", { class: "setup-list", children: [(question.items ?? []).length > 0 && (_jsx("ul", { children: (question.items ?? []).map((one) => (_jsxs("li", { children: [one, _jsx("button", { type: "button", class: "icon-button", "aria-label": t("Take {item} off", { item: one }), onClick: () => {
124
136
  send({ setting: question.name, remove: one });
125
137
  field.current?.focus();
@@ -185,6 +197,11 @@ function CampaignName({ name }) {
185
197
  }
186
198
  } }), _jsx("button", { type: "submit", class: "button gold", children: t("Save") })] }));
187
199
  }
200
+ /** Where the questions stand: the first still open, neither answered nor left to the master; with none, past the last. */
201
+ function firstOpen(questions, left) {
202
+ const first = questions.findIndex((question) => !answered(question) && !left.includes(question.name));
203
+ return first < 0 ? questions.length : first;
204
+ }
188
205
  /** Whether a question is answered: a value chosen, or a list given, even with none. */
189
206
  function answered(question) {
190
207
  return question.value !== undefined || question.items !== undefined;
@@ -73,7 +73,7 @@ function TabMark({ path }) {
73
73
  }
74
74
  /**
75
75
  * The table's measures, taken only when it or the window changes size, never as the page scrolls. The rolls' list grows with its rolls up to twelve, as tall as
76
- * its first one draws, then scrolls inside. The table stays at the top while it fits the window; taller, its top goes up so that it scrolls with the page until
76
+ * the first one that has opened draws, then scrolls inside. The table stays at the top while it fits the window; taller, its top goes up so that it scrolls with the page until
77
77
  * its foot reaches the window's and stays there, the end of the rolls always in reach.
78
78
  */
79
79
  function useTableFit(track) {
@@ -88,8 +88,10 @@ function useTableFit(track) {
88
88
  if (stick === null) {
89
89
  return;
90
90
  }
91
+ // A new roll opens its place from nothing: measured then, a pixel high, it would leave the list room for one (playtest 19). The first row that has
92
+ // opened gives the measure; while none has, the list keeps the room it had.
91
93
  const rows = stick.querySelector(".roll-list");
92
- const first = rows?.firstElementChild;
94
+ const first = [...(rows?.children ?? [])].find((row) => row.getAnimations().every((animation) => animation.playState !== "running"));
93
95
  if (rows !== null && first instanceof HTMLElement) {
94
96
  const gap = Number.parseFloat(getComputedStyle(rows).rowGap) || 0;
95
97
  track.style.setProperty("--list-room", `${Math.ceil(mostRolls * first.offsetHeight + (mostRolls - 1) * gap)}px`);
@@ -114,14 +116,16 @@ function useTableFit(track) {
114
116
  sizes.observe(stick);
115
117
  }
116
118
  window.addEventListener("resize", update);
117
- // The table's top changes as the page's top or what the master asks come and go.
119
+ // The table's top changes as the page's top or what the master asks come and go; a roll has its height once it has opened.
118
120
  track.addEventListener("transitionend", update);
121
+ track.addEventListener("animationend", update);
119
122
  update();
120
123
  return () => {
121
124
  cancelAnimationFrame(asked);
122
125
  sizes.disconnect();
123
126
  window.removeEventListener("resize", update);
124
127
  track.removeEventListener("transitionend", update);
128
+ track.removeEventListener("animationend", update);
125
129
  track.style.removeProperty("--list-room");
126
130
  track.style.removeProperty("--table-top");
127
131
  };
@@ -17,6 +17,8 @@ const localFolder = "local";
17
17
  // An npm name with a version or a tag, or nothing a shell would read otherwise: the master writes it, and npm runs in a shell.
18
18
  const npmSpec = /^(@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*(@[0-9A-Za-z.+-]+)?$/;
19
19
  const installWait = 5 * 60 * 1000;
20
+ // How long the check for newer versions waits for the registry, at the start of a session (D-569): offline it gives up at once or after this.
21
+ const checkWait = 3000;
20
22
  // An npm package's name alone, without a version: a .tgz's becomes the name of its folder.
21
23
  const packageName = /^(@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/;
22
24
  // A folder's copy installed as files, never as a link, which Node may not follow where the app keeps the player's data; npm's package.json still names it
@@ -85,6 +87,14 @@ export function npmPackages(folder, run = runNpm) {
85
87
  return { failed: `npm's registry could not be reached: ${error instanceof Error ? error.message : String(error)}` };
86
88
  }
87
89
  },
90
+ newest: async (name) => {
91
+ try {
92
+ return await newestReadable(name);
93
+ }
94
+ catch {
95
+ return undefined;
96
+ }
97
+ },
88
98
  };
89
99
  }
90
100
  /** Whether a text is an npm package's name alone, such as notes or @me/notes: never a path, nor a version. */
@@ -227,14 +237,29 @@ function madeForNewer(info) {
227
237
  * that reads it. The latest alone when no version reads, which is then refused.
228
238
  */
229
239
  async function readableVersion(name, latest) {
230
- const all = await json(`${registry}/${name.replace("/", "%2f")}`);
231
- const kind = latest.kind === "system" ? "system" : "extension";
232
- const readable = Object.values(all?.versions ?? {}).map(infoOf).filter((one) => !one.version.includes("-") && readsApi(one.api, kind));
233
- const newest = readable.reduce((best, one) => (best === undefined || isNewerVersion(one.version, best.version) ? one : best), undefined);
240
+ const newest = newestOf(await json(`${registry}/${name.replace("/", "%2f")}`), latest);
234
241
  const engine = await engineReading(latest.api ?? 0);
235
242
  const newer = { version: latest.version, ...(engine === undefined ? {} : { engine }) };
236
243
  return newest === undefined ? latest : { ...newest, newer };
237
244
  }
245
+ /**
246
+ * The newest version of a package this engine reads (D-569): its latest, else the newest of all its versions that reads; undefined when it has none. Asked
247
+ * within a short wait in all, as at the start of a session, which never waits on npm for long.
248
+ */
249
+ async function newestReadable(name) {
250
+ const address = `${registry}/${checkedSpec(name).replace("/", "%2f")}`;
251
+ const signal = AbortSignal.timeout(checkWait);
252
+ const latest = await json(`${address}/latest`, signal);
253
+ const info = latest === undefined ? undefined : infoOf(latest);
254
+ return info === undefined || !madeForNewer(info) ? info?.version : newestOf(await json(address, signal), info)?.version;
255
+ }
256
+ /** The newest of all the versions npm's registry gives of a package that this engine reads, of the latest's kind, never a prerelease. */
257
+ function newestOf(all, latest) {
258
+ const versions = all?.versions ?? {};
259
+ const kind = latest.kind === "system" ? "system" : "extension";
260
+ const readable = Object.values(versions).map(infoOf).filter((one) => !one.version.includes("-") && readsApi(one.api, kind));
261
+ return readable.reduce((best, one) => (best === undefined || isNewerVersion(one.version, best.version) ? one : best), undefined);
262
+ }
238
263
  /** The first version of rpg-engine on npm that reads a package made for this API, as its package.json says; undefined when none does yet, or npm does not say. */
239
264
  async function engineReading(api) {
240
265
  try {
@@ -372,9 +397,9 @@ function infoOf(read) {
372
397
  function authorOf(read) {
373
398
  return typeof read.author === "string" ? read.author : read.author?.name;
374
399
  }
375
- /** A JSON answer of the registry; undefined when it has none, 404. */
376
- async function json(url) {
377
- const answer = await fetch(url, { headers: { accept: "application/json" }, signal: AbortSignal.timeout(20_000) });
400
+ /** A JSON answer of the registry, given up when the signal says; undefined when it has none, 404. */
401
+ async function json(url, signal = AbortSignal.timeout(20_000)) {
402
+ const answer = await fetch(url, { headers: { accept: "application/json" }, signal });
378
403
  if (answer.status === 404) {
379
404
  return undefined;
380
405
  }
@@ -4,7 +4,7 @@ export { changedEnvironment, environmentAt, type EnvironmentEntry, formatEnviron
4
4
  export { changedFields, type FieldChange, formatFields, linkListItems, readFields, readFieldValue, splitPageFile } from "./file.ts";
5
5
  export { baseChain, baseFieldOf, baseValue, derivedPages, followersOf, holdsField, type Inherited, inheritedByBase, inheritedFields, introductionFollowersOf, isNeverInherited, keepersOf, newBaseProblem, ownField, ownFieldChange, removedFieldName, sameAsBase, sectionFollowersOf, shownPart, uniquePage, writtenFieldName, } from "./inheritance.ts";
6
6
  export { layeredPage, layeredPages, layerFolder, type LayerMark, layerParts, layersFolderName, layerTakes, systemOriginal } from "./layers.ts";
7
- export { carriedWeight, type LoadRule, weightUnit } from "./load.ts";
7
+ export { carriedWeight, type LoadRule, poundsInKilograms, weightUnit } from "./load.ts";
8
8
  export { type MapField, mapKey, mapOf, mapProblems, type PlaceMap, readMapField, sameFrame } from "./maps.ts";
9
9
  export { everyGoalTicked, firstTable, goalsIn, introductionText, type Link, links, partContent, readSection, secretNames, sectionTitles, type TextMode, textParts, withLinksAsWords, withoutComments, withoutFencedBlocks, withoutUnreadSecrets, } from "./markdown.ts";
10
10
  export { formatPosition, type Position, readPosition } from "./positions.ts";
@@ -15,6 +15,6 @@ export { carriesKind, carriesNamed, entryKind, entryPage, goodsNamed, type HeldS
15
15
  export { canHold, containerFieldOf, isCoreField, isCounterField, isEmptyField, isStandardField, listFieldNames, misspelledFieldProblem, misspelledStandardField, newPageFields, standardValues } from "./standard-fields.ts";
16
16
  export { alwaysInList, declaredKind, hidingMessage, isDeclaredUncounted, kindMessage, readOnlyMessage, systemKnowsReason, systemLabel } from "./system-pages.ts";
17
17
  export { type PageType, pageTypeNames, worldFolderName } from "./types.ts";
18
- export { type Backlink, backlinks, bonusPages, concernsPlayer, createWorld, findPage, isCountedItem, isInParty, isPartyMember, isPlayerCharacter, linksIn, loadWorld, locate, namesakes, type Page, pageFileNamed, type PageMatch, pageNamed, pagesWithName, pagesWithNameOrAlias, pageWithPath, parsePageReference, playerCharacters, searchPages, searchSystemPages, systemFirstFix, type SystemInfo, systemPageNamed, type SystemPages, textsIn, validHoldersOf, versionTranslations, withPage, type World, } from "./world.ts";
18
+ export { type Backlink, backlinks, bonusPages, concernsPlayer, createWorld, findPage, heldNames, isCountedItem, isInParty, isPartyMember, isPlayerCharacter, linksIn, loadWorld, locate, namesakes, type Page, pageFileNamed, type PageMatch, pageNamed, pagesWithName, pagesWithNameOrAlias, pageWithPath, parsePageReference, playerCharacters, searchPages, searchSystemPages, systemFirstFix, type SystemInfo, systemPageNamed, type SystemPages, textsIn, validHoldersOf, versionTranslations, withPage, type World, } from "./world.ts";
19
19
  export { type LayerWrite, removeLayer, writeLayer } from "./write-layer.ts";
20
20
  export { checkFieldChange, type PageChange, writePage } from "./write-page.ts";
@@ -5,7 +5,7 @@ export { changedEnvironment, environmentAt, formatEnvironmentEntry, placesAround
5
5
  export { changedFields, formatFields, linkListItems, readFields, readFieldValue, splitPageFile } from "./file.js";
6
6
  export { baseChain, baseFieldOf, baseValue, derivedPages, followersOf, holdsField, inheritedByBase, inheritedFields, introductionFollowersOf, isNeverInherited, keepersOf, newBaseProblem, ownField, ownFieldChange, removedFieldName, sameAsBase, sectionFollowersOf, shownPart, uniquePage, writtenFieldName, } from "./inheritance.js";
7
7
  export { layeredPage, layeredPages, layerFolder, layerParts, layersFolderName, layerTakes, systemOriginal } from "./layers.js";
8
- export { carriedWeight, weightUnit } from "./load.js";
8
+ export { carriedWeight, poundsInKilograms, weightUnit } from "./load.js";
9
9
  export { mapKey, mapOf, mapProblems, readMapField, sameFrame } from "./maps.js";
10
10
  export { everyGoalTicked, firstTable, goalsIn, introductionText, links, partContent, readSection, secretNames, sectionTitles, textParts, withLinksAsWords, withoutComments, withoutFencedBlocks, withoutUnreadSecrets, } from "./markdown.js";
11
11
  export { formatPosition, readPosition } from "./positions.js";
@@ -16,6 +16,6 @@ export { carriesKind, carriesNamed, entryKind, entryPage, goodsNamed, heldStacks
16
16
  export { canHold, containerFieldOf, isCoreField, isCounterField, isEmptyField, isStandardField, listFieldNames, misspelledFieldProblem, misspelledStandardField, newPageFields, standardValues } from "./standard-fields.js";
17
17
  export { alwaysInList, declaredKind, hidingMessage, isDeclaredUncounted, kindMessage, readOnlyMessage, systemKnowsReason, systemLabel } from "./system-pages.js";
18
18
  export { pageTypeNames, worldFolderName } from "./types.js";
19
- export { backlinks, bonusPages, concernsPlayer, createWorld, findPage, isCountedItem, isInParty, isPartyMember, isPlayerCharacter, linksIn, loadWorld, locate, namesakes, pageFileNamed, pageNamed, pagesWithName, pagesWithNameOrAlias, pageWithPath, parsePageReference, playerCharacters, searchPages, searchSystemPages, systemFirstFix, systemPageNamed, textsIn, validHoldersOf, versionTranslations, withPage, } from "./world.js";
19
+ export { backlinks, bonusPages, concernsPlayer, createWorld, findPage, heldNames, isCountedItem, isInParty, isPartyMember, isPlayerCharacter, linksIn, loadWorld, locate, namesakes, pageFileNamed, pageNamed, pagesWithName, pagesWithNameOrAlias, pageWithPath, parsePageReference, playerCharacters, searchPages, searchSystemPages, systemFirstFix, systemPageNamed, textsIn, validHoldersOf, versionTranslations, withPage, } from "./world.js";
20
20
  export { removeLayer, writeLayer } from "./write-layer.js";
21
21
  export { checkFieldChange, writePage } from "./write-page.js";
@@ -13,5 +13,7 @@ export interface LoadRule {
13
13
  export declare function carriedWeight(world: World, rule: LoadRule, holder: Page): number;
14
14
  /** The unit the system's weights are written in, as lb; undefined when no page says. */
15
15
  export declare function weightUnit(world: World, field: string): string | undefined;
16
+ /** A weight written in pounds told in kilograms at the system's pound, its note kept: 6 lb is 3 kg, 5 lb (full) 2.5 kg (full); any other text unchanged. */
17
+ export declare function poundsInKilograms(text: string, pound: number): string;
16
18
  /** How many pieces one of a kind holds, by the field the system declares for its bundle: 1 for a kind not sold by the bundle (STK-2). */
17
19
  export declare function bundleOf(field: string | undefined, kind: Page): number;