rpg-engine 0.20.0 → 0.22.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 (194) hide show
  1. package/dist/adventures/index.d.ts +1 -1
  2. package/dist/adventures/index.js +1 -1
  3. package/dist/adventures/source.d.ts +3 -0
  4. package/dist/adventures/source.js +11 -49
  5. package/dist/campaign/create-campaign.d.ts +1 -1
  6. package/dist/campaign/create-campaign.js +3 -2
  7. package/dist/campaign/find-campaign.d.ts +2 -0
  8. package/dist/campaign/find-campaign.js +2 -0
  9. package/dist/campaign/host-files.js +4 -1
  10. package/dist/campaign/index.d.ts +3 -2
  11. package/dist/campaign/index.js +3 -2
  12. package/dist/campaign/port.d.ts +6 -0
  13. package/dist/campaign/port.js +24 -0
  14. package/dist/campaign/settings.d.ts +17 -0
  15. package/dist/campaign/settings.js +26 -3
  16. package/dist/cli/cli.js +15 -0
  17. package/dist/commands/book.d.ts +16 -35
  18. package/dist/commands/book.js +86 -62
  19. package/dist/commands/config/config.js +16 -2
  20. package/dist/commands/config/dashboard.d.ts +6 -2
  21. package/dist/commands/config/dashboard.js +45 -8
  22. package/dist/commands/config/shown.js +4 -0
  23. package/dist/commands/config/words.d.ts +3 -1
  24. package/dist/commands/config/words.js +29 -2
  25. package/dist/commands/image.d.ts +5 -0
  26. package/dist/commands/image.js +6 -3
  27. package/dist/commands/mode.d.ts +1 -1
  28. package/dist/commands/package/data.d.ts +35 -0
  29. package/dist/commands/package/data.js +144 -0
  30. package/dist/commands/package/here.d.ts +7 -2
  31. package/dist/commands/package/here.js +23 -11
  32. package/dist/commands/package/install.js +14 -15
  33. package/dist/commands/package/language.d.ts +15 -0
  34. package/dist/commands/package/language.js +109 -0
  35. package/dist/commands/package/package.js +20 -10
  36. package/dist/commands/package/result.d.ts +19 -0
  37. package/dist/commands/package/theme.d.ts +13 -0
  38. package/dist/commands/package/theme.js +67 -0
  39. package/dist/commands/package/uninstall.d.ts +4 -1
  40. package/dist/commands/package/uninstall.js +29 -9
  41. package/dist/commands/scene/close.d.ts +1 -1
  42. package/dist/commands/scene/close.js +15 -8
  43. package/dist/commands/scene/scene.js +6 -1
  44. package/dist/commands/shared/books/adventures.d.ts +1 -4
  45. package/dist/commands/shared/books/adventures.js +3 -32
  46. package/dist/commands/shared/books/words.js +3 -2
  47. package/dist/commands/shared/campaign/book.d.ts +21 -8
  48. package/dist/commands/shared/campaign/book.js +65 -42
  49. package/dist/commands/shared/campaign/git.d.ts +25 -0
  50. package/dist/commands/shared/campaign/git.js +104 -0
  51. package/dist/commands/shared/campaign/saves.js +7 -3
  52. package/dist/commands/shared/campaign/world.js +2 -1
  53. package/dist/commands/shared/packages/catalog.d.ts +3 -3
  54. package/dist/commands/shared/packages/catalog.js +118 -43
  55. package/dist/commands/shared/packages/unpacked.d.ts +50 -0
  56. package/dist/commands/shared/packages/unpacked.js +146 -0
  57. package/dist/commands/status.d.ts +1 -0
  58. package/dist/commands/status.js +8 -4
  59. package/dist/core/archive.d.ts +13 -0
  60. package/dist/core/archive.js +76 -0
  61. package/dist/core/context.d.ts +4 -0
  62. package/dist/core/context.js +1 -0
  63. package/dist/core/store.d.ts +5 -1
  64. package/dist/core/store.js +15 -2
  65. package/dist/core/version.d.ts +2 -0
  66. package/dist/core/version.js +5 -0
  67. package/dist/dashboard/api.js +24 -1
  68. package/dist/dashboard/app.js +7 -2
  69. package/dist/dashboard/guide/ar.md +11 -9
  70. package/dist/dashboard/guide/cs.md +11 -9
  71. package/dist/dashboard/guide/da.md +12 -10
  72. package/dist/dashboard/guide/de.md +13 -11
  73. package/dist/dashboard/guide/el.md +11 -9
  74. package/dist/dashboard/guide/en.md +10 -8
  75. package/dist/dashboard/guide/es.md +11 -9
  76. package/dist/dashboard/guide/fi.md +11 -9
  77. package/dist/dashboard/guide/fr.md +11 -9
  78. package/dist/dashboard/guide/he.md +11 -9
  79. package/dist/dashboard/guide/hi.md +11 -9
  80. package/dist/dashboard/guide/hu.md +11 -9
  81. package/dist/dashboard/guide/is.md +11 -9
  82. package/dist/dashboard/guide/it.md +11 -9
  83. package/dist/dashboard/guide/ja.md +12 -10
  84. package/dist/dashboard/guide/ko.md +11 -9
  85. package/dist/dashboard/guide/nb.md +12 -10
  86. package/dist/dashboard/guide/nl.md +11 -9
  87. package/dist/dashboard/guide/pl.md +11 -9
  88. package/dist/dashboard/guide/pt.md +11 -9
  89. package/dist/dashboard/guide/ro.md +11 -9
  90. package/dist/dashboard/guide/ru.md +12 -10
  91. package/dist/dashboard/guide/sv.md +11 -9
  92. package/dist/dashboard/guide/tr.md +11 -9
  93. package/dist/dashboard/guide/uk.md +12 -10
  94. package/dist/dashboard/guide/zh.md +11 -9
  95. package/dist/dashboard/i18n/ar.json +58 -5
  96. package/dist/dashboard/i18n/cs.json +58 -5
  97. package/dist/dashboard/i18n/da.json +58 -5
  98. package/dist/dashboard/i18n/de.json +58 -5
  99. package/dist/dashboard/i18n/el.json +58 -5
  100. package/dist/dashboard/i18n/es.json +58 -5
  101. package/dist/dashboard/i18n/fi.json +58 -5
  102. package/dist/dashboard/i18n/fr.json +58 -5
  103. package/dist/dashboard/i18n/he.json +58 -5
  104. package/dist/dashboard/i18n/hi.json +58 -5
  105. package/dist/dashboard/i18n/hu.json +58 -5
  106. package/dist/dashboard/i18n/is.json +58 -5
  107. package/dist/dashboard/i18n/it.json +58 -5
  108. package/dist/dashboard/i18n/ja.json +58 -5
  109. package/dist/dashboard/i18n/ko.json +58 -5
  110. package/dist/dashboard/i18n/nb.json +58 -5
  111. package/dist/dashboard/i18n/nl.json +58 -5
  112. package/dist/dashboard/i18n/pl.json +58 -5
  113. package/dist/dashboard/i18n/pt.json +58 -5
  114. package/dist/dashboard/i18n/ro.json +58 -5
  115. package/dist/dashboard/i18n/ru.json +58 -5
  116. package/dist/dashboard/i18n/sv.json +58 -5
  117. package/dist/dashboard/i18n/tr.json +58 -5
  118. package/dist/dashboard/i18n/uk.json +58 -5
  119. package/dist/dashboard/i18n/zh.json +58 -5
  120. package/dist/dashboard/journal/book.js +3 -2
  121. package/dist/dashboard/journal/journal.js +8 -5
  122. package/dist/dashboard/kit.js +1 -1
  123. package/dist/dashboard/packages/catalog.js +31 -14
  124. package/dist/dashboard/packages/engine.js +46 -2
  125. package/dist/dashboard/packages/installed.js +13 -0
  126. package/dist/dashboard/packages/outcomes.js +21 -0
  127. package/dist/dashboard/packages/packages.js +41 -18
  128. package/dist/dashboard/packages/rows.js +3 -1
  129. package/dist/dashboard/parts/icons.js +3 -0
  130. package/dist/dashboard/parts/labels.js +7 -0
  131. package/dist/dashboard/parts/picture.js +89 -0
  132. package/dist/dashboard/parts/refusals.js +8 -1
  133. package/dist/dashboard/parts/widgets.js +2 -1
  134. package/dist/dashboard/play/scene.js +8 -5
  135. package/dist/dashboard/settings/settings.js +55 -18
  136. package/dist/dashboard/sheet/party.js +5 -2
  137. package/dist/dashboard/sheet/sheet.js +2 -1
  138. package/dist/dashboard/shell/notices.js +2 -2
  139. package/dist/dashboard/shell/system-style.js +132 -15
  140. package/dist/dashboard/shell/tooltip.js +224 -0
  141. package/dist/dashboard/style.css +497 -193
  142. package/dist/dashboard/world/lore.js +4 -3
  143. package/dist/dashboard/world/place-card.js +2 -1
  144. package/dist/git/git.d.ts +12 -0
  145. package/dist/git/git.js +175 -0
  146. package/dist/git/ignore.d.ts +2 -0
  147. package/dist/git/ignore.js +16 -0
  148. package/dist/git/index.d.ts +2 -0
  149. package/dist/git/index.js +2 -0
  150. package/dist/importer/index.d.ts +1 -1
  151. package/dist/importer/index.js +1 -1
  152. package/dist/languages/index.d.ts +1 -1
  153. package/dist/languages/index.js +1 -1
  154. package/dist/languages/pack.d.ts +4 -1
  155. package/dist/languages/pack.js +18 -6
  156. package/dist/packages/engine.d.ts +7 -0
  157. package/dist/packages/engine.js +32 -1
  158. package/dist/packages/index.d.ts +1 -1
  159. package/dist/packages/index.js +1 -1
  160. package/dist/server/bell-listener.d.ts +2 -1
  161. package/dist/server/bell-listener.js +10 -41
  162. package/dist/server/dashboard/engine.d.ts +18 -0
  163. package/dist/server/dashboard/engine.js +31 -0
  164. package/dist/server/dashboard/files.d.ts +11 -3
  165. package/dist/server/dashboard/files.js +66 -17
  166. package/dist/server/dashboard/index.d.ts +18 -2
  167. package/dist/server/dashboard/index.js +62 -23
  168. package/dist/server/dashboard/news.d.ts +3 -2
  169. package/dist/server/dashboard/news.js +19 -5
  170. package/dist/server/dashboard/pictures.d.ts +7 -0
  171. package/dist/server/dashboard/pictures.js +62 -0
  172. package/dist/server/dashboard/ports.d.ts +17 -2
  173. package/dist/server/dashboard/ports.js +60 -4
  174. package/dist/server/dashboard/writes.d.ts +5 -3
  175. package/dist/server/dashboard/writes.js +45 -14
  176. package/dist/server/mcp.d.ts +3 -2
  177. package/dist/server/mcp.js +55 -11
  178. package/dist/testing/index.js +1 -0
  179. package/dist/themes/css.d.ts +1 -1
  180. package/dist/themes/css.js +101 -2
  181. package/dist/themes/index.d.ts +2 -1
  182. package/dist/themes/index.js +4 -2
  183. package/dist/themes/installed.d.ts +14 -0
  184. package/dist/themes/installed.js +28 -0
  185. package/dist/themes/theme.d.ts +38 -0
  186. package/dist/themes/theme.js +192 -13
  187. package/instructions/core.md +4 -3
  188. package/instructions/dashboard-guide.md +2 -1
  189. package/instructions/mentor-hints.md +1 -1
  190. package/instructions/mentor-tutorial.md +1 -1
  191. package/instructions/party.md +1 -1
  192. package/instructions/play.md +2 -2
  193. package/package.json +1 -1
  194. package/systems/free/instructions/outcomes-told.md +1 -1
@@ -38,7 +38,8 @@ export declare function packagesNow(response: ServerResponse, served: Served, np
38
38
  export declare function changePackage(request: IncomingMessage, response: ServerResponse, served: Served): Promise<void>;
39
39
  /**
40
40
  * Something the player adds on the page (D-485 (1)): a .zip or a .tgz as the request's body, named by its X-File-Name, or { source }: a link, an npm name or a
41
- * folder of this computer. The engine tells the kind by what it holds; an adventure is read in memory, a .tgz kept in the player's data folder while npm installs it.
41
+ * folder of this computer. The engine tells the kind by what it holds; a .zip, an adventure, a theme or a language, is read in memory, a .tgz kept in the
42
+ * player's data folder while npm installs it.
42
43
  */
43
44
  export declare function addPackage(request: IncomingMessage, response: ServerResponse, served: Served): Promise<void>;
44
45
  /**
@@ -53,8 +54,9 @@ export declare function libraryNow(response: ServerResponse, served: Served): Pr
53
54
  */
54
55
  export declare function changeLibrary(request: IncomingMessage, response: ServerResponse, served: Served): Promise<void>;
55
56
  /**
56
- * rpg-engine itself on the Packages page (D-515 (3)): its version, npm's latest and whether it is newer, and how it is installed, read at each look; its update,
57
- * from the page alone, globally with npm as it was installed, a development link or another install told and never touched; then how the chat takes it.
57
+ * rpg-engine itself on the Packages page (D-515 (3)): its version, npm's latest and whether it is newer, asked at most once a day (T-219), and how it is
58
+ * installed; its update, from the page alone with the player's yes in a window of their computer, globally with npm as it was installed, a development link or
59
+ * another install told and never touched; then how the chat takes it.
58
60
  */
59
61
  export declare function engineNow(request: IncomingMessage, response: ServerResponse, served: Served): Promise<void>;
60
62
  /** What the page may add (D-485, D-486), from npm and GitHub, read again at most every ten minutes, or when the page asks it fresh. */
@@ -1,13 +1,12 @@
1
1
  import { basename, join } from "node:path";
2
2
  import { z } from "zod";
3
- import { readAdventureZip } from "../../adventures/index.js";
4
3
  import { findCampaign, readSettings, readTextSetting, requireCampaign, settingNames } from "../../campaign/index.js";
5
4
  import { config } from "../../commands/config/config.js";
6
5
  import { playerSettingNamed, playerSettings, setupSettingNamed } from "../../commands/config/dashboard.js";
6
+ import { installDataPackage, zipDataPackage } from "../../commands/package/data.js";
7
7
  import { isInstalledPackage } from "../../commands/package/here.js";
8
8
  import { adventureText, packageCommand } from "../../commands/package/package.js";
9
9
  import { playerSaveNews, save } from "../../commands/save.js";
10
- import { installAdventure } from "../../commands/shared/books/adventures.js";
11
10
  import { libraryContents, libraryEntries, startLibraryReading, unquoted } from "../../commands/shared/books/library.js";
12
11
  import { campaignMode } from "../../commands/shared/campaign/mode.js";
13
12
  import { exportsFolderName, resetPoints } from "../../commands/shared/campaign/saves.js";
@@ -25,6 +24,7 @@ import { getVersion, isNewerVersion } from "../../core/version.js";
25
24
  import { extensionWords, findExtension } from "../../extensions/index.js";
26
25
  import { samePath } from "../../library/index.js";
27
26
  import { readableSystems } from "../../systems/index.js";
27
+ import { askLatest, knownLatest } from "./engine.js";
28
28
  import { decoded, mostSaid, readBody, readBytes, securityHeaders, send, sendJson } from "./files.js";
29
29
  // How long the catalog is kept before npm and GitHub are asked again.
30
30
  const catalogLife = 10 * 60 * 1000;
@@ -226,7 +226,16 @@ export async function packagesNow(response, served, npm) {
226
226
  system: system === undefined ? null : { name: system.name, title: system.title },
227
227
  // The other systems of this computer, for a new campaign: a campaign's own is chosen in its setup (D-475).
228
228
  otherSystems: readableSystems(served.context.systemFolders).filter((other) => other.name !== system?.name).map((other) => ({ name: other.name, title: other.title })),
229
- ...(list.kind === "list" ? { installed: inLanguage(list.installed, served, readTextSetting(root, "language")), missing: list.missing, adventures: list.adventures, systems: list.systems, languages: list.languages } : {}),
229
+ ...(list.kind === "list"
230
+ ? {
231
+ installed: inLanguage(list.installed, served, readTextSetting(root, "language")),
232
+ missing: list.missing,
233
+ adventures: list.adventures,
234
+ systems: list.systems,
235
+ languages: list.languages,
236
+ themes: list.themes,
237
+ }
238
+ : {}),
230
239
  ...(available?.kind === "available" ? { available: available.packages, ...(available.failed === undefined ? {} : { failed: available.failed }) } : {}),
231
240
  ...(served.packageWork === undefined ? {} : { working: served.packageWork }),
232
241
  };
@@ -261,7 +270,8 @@ export async function changePackage(request, response, served) {
261
270
  }
262
271
  /**
263
272
  * Something the player adds on the page (D-485 (1)): a .zip or a .tgz as the request's body, named by its X-File-Name, or { source }: a link, an npm name or a
264
- * folder of this computer. The engine tells the kind by what it holds; an adventure is read in memory, a .tgz kept in the player's data folder while npm installs it.
273
+ * folder of this computer. The engine tells the kind by what it holds; a .zip, an adventure, a theme or a language, is read in memory, a .tgz kept in the
274
+ * player's data folder while npm installs it.
265
275
  */
266
276
  export async function addPackage(request, response, served) {
267
277
  const json = /^application\/json/i.test(String(request.headers["content-type"] ?? ""));
@@ -278,7 +288,7 @@ export async function addPackage(request, response, served) {
278
288
  }
279
289
  if (bytes !== undefined && !/\.(zip|tgz|tar\.gz)$/i.test(file)) {
280
290
  sendJson(response, 400, {
281
- error: `${file} is neither a .zip nor a .tgz: an adventure comes as a .zip, an extension, a game system or a language as a .tgz.`,
291
+ error: `${file} is neither a .zip nor a .tgz: an adventure, a theme or a language comes as a .zip; an extension, a game system or a language from npm as a .tgz.`,
282
292
  code: "file-kind",
283
293
  values: { name: file },
284
294
  });
@@ -287,9 +297,9 @@ export async function addPackage(request, response, served) {
287
297
  const source = given?.success === true ? given.data.source : file;
288
298
  await packageWork(response, served, source, "add", async (context) => {
289
299
  if (bytes !== undefined && /\.zip$/i.test(file)) {
290
- const root = requireCampaign(context.folder);
291
- const installed = installAdventure(root, context, readAdventureZip(bytes, file), file);
292
- return { kind: "adventure", news: `The player, on the dashboard, added an adventure: ${adventureText(installed)}` };
300
+ const result = await installDataPackage(requireCampaign(context.folder), context, zipDataPackage(bytes, file, file), file);
301
+ const said = result.kind === "adventure-installed" ? `an adventure: ${adventureText(result)}` : `${file}: ${packageCommand.format(result)}`;
302
+ return { kind: kindOf(result.kind), news: `The player, on the dashboard, added ${said}` };
293
303
  }
294
304
  const kept = bytes === undefined ? undefined : join(served.context.home ?? packagesFolder(), "uploads", file);
295
305
  try {
@@ -352,8 +362,9 @@ export async function changeLibrary(request, response, served) {
352
362
  });
353
363
  }
354
364
  /**
355
- * rpg-engine itself on the Packages page (D-515 (3)): its version, npm's latest and whether it is newer, and how it is installed, read at each look; its update,
356
- * from the page alone, globally with npm as it was installed, a development link or another install told and never touched; then how the chat takes it.
365
+ * rpg-engine itself on the Packages page (D-515 (3)): its version, npm's latest and whether it is newer, asked at most once a day (T-219), and how it is
366
+ * installed; its update, from the page alone with the player's yes in a window of their computer, globally with npm as it was installed, a development link or
367
+ * another install told and never touched; then how the chat takes it.
357
368
  */
358
369
  export async function engineNow(request, response, served) {
359
370
  const updater = served.context.engine;
@@ -366,7 +377,7 @@ export async function engineNow(request, response, served) {
366
377
  // What npm installed since this server started comes with a new chat: said apart, never as the version that runs.
367
378
  const onDisk = updater.onDisk();
368
379
  if (request.method === "GET") {
369
- const [latest, installed] = await Promise.all([updater.latest(), updater.installed()]);
380
+ const [latest, installed] = await Promise.all([knownLatest(served, updater), updater.installed()]);
370
381
  sendJson(response, 200, {
371
382
  version,
372
383
  ...(onDisk === version ? {} : { installed: onDisk }),
@@ -382,8 +393,8 @@ export async function engineNow(request, response, served) {
382
393
  sendJson(response, 400, { error: "Send what to do with rpg-engine: { action: update }." });
383
394
  return;
384
395
  }
385
- await packageWork(response, served, "rpg-engine", "engine", async () => {
386
- const latest = await updater.latest();
396
+ await packageWork(response, served, "rpg-engine", "engine", async (context) => {
397
+ const latest = await askLatest(served, updater);
387
398
  if ("failed" in latest) {
388
399
  throw new Refusal(`${latest.failed}: update it once this computer is online. Nothing changed.`, "engine-offline", { why: latest.failed });
389
400
  }
@@ -400,6 +411,7 @@ export async function engineNow(request, response, served) {
400
411
  name: installed.folder,
401
412
  });
402
413
  }
414
+ await engineYes(context, onDisk, latest.version);
403
415
  const why = await updater.update(latest.version);
404
416
  if (why !== undefined) {
405
417
  throw new Refusal(`rpg-engine could not be updated: ${why}. Nothing changed.`, "engine-failed", { why });
@@ -414,6 +426,24 @@ export async function engineNow(request, response, served) {
414
426
  };
415
427
  });
416
428
  }
429
+ /**
430
+ * The player's own yes to updating rpg-engine, in a window of their computer, never the page's click alone (D-477): a no holds for the session (D-510); where
431
+ * no window opens, the command that updates it from a terminal.
432
+ */
433
+ async function engineYes(context, from, to) {
434
+ if (context.declined?.has("rpg-engine") === true) {
435
+ throw new Refusal("The player said no to updating rpg-engine in this session: it is not asked again until the game's server starts again. Nothing changed.", "declined");
436
+ }
437
+ const question = `Update RPG Engine from ${from} to ${to}? npm installs it on this computer, for every campaign. The chat you play in keeps ${from} until you start a new one.`;
438
+ const answer = context.confirm === undefined ? "none" : await context.confirm.ask("Update RPG Engine", question, context.signal, { yes: "Update", no: "Not now" });
439
+ if (answer === "no") {
440
+ context.declined?.add("rpg-engine");
441
+ throw new Refusal("The player did not want to update rpg-engine. Nothing changed.", "declined");
442
+ }
443
+ if (answer === "none") {
444
+ throw new Refusal("No window for the player's yes opens on this computer: update it in a terminal with npm install -g rpg-engine. Nothing changed.", "no-window");
445
+ }
446
+ }
417
447
  /** What the page may add (D-485, D-486), from npm and GitHub, read again at most every ten minutes, or when the page asks it fresh. */
418
448
  export async function catalogNow(response, served, fresh) {
419
449
  const kept = served.catalog;
@@ -534,7 +564,8 @@ async function packageWork(response, served, name, action, work) {
534
564
  }
535
565
  /** The kind of package a result of package install says it installed. */
536
566
  function kindOf(result) {
537
- return result === "adventure-installed" ? "adventure" : result === "system-installed" ? "system" : result === "language-installed" ? "language" : "extension";
567
+ const kinds = { "adventure-installed": "adventure", "system-installed": "system", "language-installed": "language", "theme-installed": "theme" };
568
+ return kinds[result] ?? "extension";
538
569
  }
539
570
  /** A file's name as the page sends it, encoded for a header; as it is when it does not decode. */
540
571
  function fileName(header) {
@@ -15,8 +15,9 @@ export declare function createMcpServer(context?: Context, environment?: Record<
15
15
  */
16
16
  export declare function startMcpServer(): Promise<void>;
17
17
  /**
18
- * Opens the player's dashboard before the first call that finds a campaign in the server's folder, as after init, and lets that call wait for it, so that its
19
- * status gives the link (D-270, D-277); never in a folder without a campaign. The game goes on without it.
18
+ * Opens the player's dashboard as the chat starts and before the first call that finds a campaign in the server's folder, as after init, and lets that call
19
+ * wait for it, so that its status gives the link (D-270, D-277, D-577); never in a folder without a campaign. Where another chat of the campaign serves its
20
+ * page, the link is that page's, and this chat asks after it every few seconds, to serve it at the same port once that chat closes. The game goes on without it.
20
21
  */
21
22
  export declare function dashboardOpener(context: Context, session: SessionStore, ports?: number[]): {
22
23
  open(): Promise<void>;
@@ -10,6 +10,7 @@ import { commands } from "../commands/index.js";
10
10
  import { installCampaignSystem } from "../commands/package/install.js";
11
11
  import { libraryRunner } from "../commands/shared/books/library-reader.js";
12
12
  import { pagePhrase } from "../commands/shared/books/words.js";
13
+ import { commitSessionStart } from "../commands/shared/campaign/git.js";
13
14
  import { outsideNews, whileClosedNews } from "../commands/shared/campaign/outside.js";
14
15
  import { newChatText, wentBackTo } from "../commands/shared/campaign/saves.js";
15
16
  import { campaignWorld } from "../commands/shared/campaign/world.js";
@@ -28,7 +29,7 @@ import { hostInstructions, startInstructions } from "../instructions/index.js";
28
29
  import { npmEngine, npmPackages } from "../packages/index.js";
29
30
  import { loadSystemCode } from "../systems/index.js";
30
31
  import { chatKeeper } from "./chats.js";
31
- import { startDashboard } from "./dashboard/index.js";
32
+ import { answers, campaignPageElsewhere, campaignPorts, dashboardAt, isCampaignPage, startDashboard } from "./dashboard/index.js";
32
33
  // While the player decides, the call reports progress this often, so that a host does not take it for a call that hangs.
33
34
  const progressEvery = 20 * 1000;
34
35
  // A form closed faster than anyone could read it was never shown: the host declares forms it does not show (ASK-6).
@@ -39,6 +40,8 @@ const tooFastForPerson = 1500;
39
40
  const entryPointsWithoutForms = ["claude-desktop"];
40
41
  // Hosts ask for the tools tens of milliseconds after initialized: the world, which takes a second or more to read in a large campaign, is read after that.
41
42
  const preloadAfter = 250;
43
+ // How often a chat asks after its campaign's page, which another chat serves, to serve it once that one closes (D-577).
44
+ const heldAskEvery = 3000;
42
45
  /** The line that closes every answer of a tool, a phrase of the page's, so that its languages have it. */
43
46
  export const masterScreenLine = "The text above lies behind the master's screen, forbidden to the players' eyes.";
44
47
  /**
@@ -105,7 +108,11 @@ export function createMcpServer(context = defaultContext(), environment = proces
105
108
  // ours missing here, starts to install then, while the player writes: the first call waits for the same install and says it (SYS-10, D-520).
106
109
  const installing = () => void installer.install().then(afterCall).catch(() => undefined);
107
110
  if (context.files instanceof SessionStore) {
108
- setTimeout(() => void preload(context, context.files).then(installing), preloadAfter);
111
+ // The campaign's page too, as the chat starts, never waiting for the player's first words (D-577).
112
+ setTimeout(() => void preload(context, context.files).then(() => {
113
+ void beforeCall?.().catch(() => undefined);
114
+ installing();
115
+ }), preloadAfter);
109
116
  }
110
117
  else {
111
118
  installing();
@@ -153,20 +160,55 @@ export async function startMcpServer() {
153
160
  await server.connect(new StdioServerTransport());
154
161
  }
155
162
  /**
156
- * Opens the player's dashboard before the first call that finds a campaign in the server's folder, as after init, and lets that call wait for it, so that its
157
- * status gives the link (D-270, D-277); never in a folder without a campaign. The game goes on without it.
163
+ * Opens the player's dashboard as the chat starts and before the first call that finds a campaign in the server's folder, as after init, and lets that call
164
+ * wait for it, so that its status gives the link (D-270, D-277, D-577); never in a folder without a campaign. Where another chat of the campaign serves its
165
+ * page, the link is that page's, and this chat asks after it every few seconds, to serve it at the same port once that chat closes. The game goes on without it.
158
166
  */
159
167
  export function dashboardOpener(context, session, ports) {
160
168
  let opening;
169
+ // The page another chat serves, and the wait for it to go.
170
+ let held;
171
+ let waiting;
172
+ let closed = false;
173
+ const open = async () => {
174
+ const root = withFiles(session, () => findCampaign(context.folder));
175
+ opening ??= root === undefined ? undefined : startDashboard(context, session, { ports }).catch(() => undefined);
176
+ const dashboard = await opening;
177
+ if (dashboard === undefined && root !== undefined && held === undefined && waiting === undefined && !closed) {
178
+ const elsewhere = await campaignPageElsewhere(root, ports ?? campaignPorts(root));
179
+ if (elsewhere !== undefined && !closed && waiting === undefined) {
180
+ held = elsewhere.url;
181
+ waitFor(root, elsewhere.port);
182
+ }
183
+ }
184
+ context.dashboard = dashboard?.url ?? held;
185
+ context.dashboardHeld = dashboard === undefined && held !== undefined;
186
+ context.page = dashboard?.player;
187
+ context.news = dashboard?.news;
188
+ };
189
+ // Asks after the page, saying this chat waits there, so that the doorbell does not take that chat's for this one's; once it goes, serves it. A page
190
+ // that does not answer while its port still takes calls is a chat busy with its world: it is still there.
191
+ const waitFor = (root, port) => {
192
+ waiting = setInterval(() => {
193
+ void dashboardAt(port, process.env.CLAUDE_CODE_SESSION_ID).then(async (there) => {
194
+ const gone = there === undefined ? !(await answers(port)) : !isCampaignPage(there, root);
195
+ if (closed || waiting === undefined || !gone) {
196
+ return;
197
+ }
198
+ clearInterval(waiting);
199
+ waiting = undefined;
200
+ held = undefined;
201
+ opening = undefined;
202
+ void open().catch(() => undefined);
203
+ });
204
+ }, heldAskEvery);
205
+ waiting.unref();
206
+ };
161
207
  return {
162
- open: async () => {
163
- opening ??= withFiles(session, () => findCampaign(context.folder)) === undefined ? undefined : startDashboard(context, session, { ports }).catch(() => undefined);
164
- const dashboard = await opening;
165
- context.dashboard = dashboard?.url;
166
- context.page = dashboard?.player;
167
- context.news = dashboard?.news;
168
- },
208
+ open,
169
209
  close: async () => {
210
+ closed = true;
211
+ clearInterval(waiting);
170
212
  await (await opening)?.close();
171
213
  },
172
214
  };
@@ -194,6 +236,8 @@ async function preload(context, session) {
194
236
  context.characterAgent = hasCharacterAgent(root);
195
237
  refreshHostFiles(root, hostInstructions(), context.platform);
196
238
  campaignWorld(root, context);
239
+ // What the last session left, committed as this one starts, where the campaign keeps itself in git (D-576).
240
+ void commitSessionStart(root, context);
197
241
  }
198
242
  });
199
243
  }
@@ -60,6 +60,7 @@ export async function testCampaign(options) {
60
60
  systemFolders,
61
61
  systemCode: await loadSystemCode(systemFolders),
62
62
  extensionFolders: [packages],
63
+ unpacked: join(base, "unpacked"),
63
64
  };
64
65
  const started = [];
65
66
  // Each call reads the campaign's context as the test left it, a page or a signal of its own included.
@@ -1,3 +1,3 @@
1
1
  import type { Theme } from "./theme.ts";
2
- /** The CSS of a theme: its @font-face rules, then the layer theme with the values of both modes; its files at this address, such as /theme. */
2
+ /** The CSS of a theme: its @font-face rules, the layer theme with the values of both modes, the colours of the guarantees; its files at this address, such as /theme. */
3
3
  export declare function themeCss(theme: Theme, address: string): string;
@@ -1,8 +1,19 @@
1
+ // The CSS of a theme, written by the engine alone: its faces, then one layer, theme, of custom properties and nothing else, which the page's rules read; and
2
+ // in the layer guarantees, the colours its focus ring and tooltip draw with.
3
+ import { mix } from "./contrast.js";
1
4
  // What follows a theme's face, always: a Latin face has no Arabic or Japanese letters, and the page's own faces have.
2
5
  const textFaces = `system-ui, -apple-system, "Segoe UI", sans-serif`;
3
6
  const storyFaces = `"Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif`;
4
7
  const titleCases = { "as-written": "none", capitals: "uppercase", "small-capitals": "none" };
5
- /** The CSS of a theme: its @font-face rules, then the layer theme with the values of both modes; its files at this address, such as /theme. */
8
+ // A shape as a corner: its radius and the shape CSS gives it; a cut corner is 8 px of bevel, where the browser draws one, else a round corner.
9
+ const shapeCorners = { rounded: undefined, square: ["0", "round"], pill: ["999px", "round"], cut: ["8px", "bevel"] };
10
+ const cardCorners = { round: "round", cut: "bevel", notch: "notch", scoop: "scoop" };
11
+ // The portraits' shapes: their corner and the rim of their glass, which is round only on a round coin.
12
+ const portraitCorners = { round: undefined, rounded: ["22%", "round"], square: ["4px", "round"], cut: ["28%", "bevel"] };
13
+ // The inks the page draws on the documents' paper and the maps', as tokens.css gives them: their folds, rules and grids are a little of it on the paper the theme gives.
14
+ const documentInk = "#2f261b";
15
+ const mapInk = "#3f2f1f";
16
+ /** The CSS of a theme: its @font-face rules, the layer theme with the values of both modes, the colours of the guarantees; its files at this address, such as /theme. */
6
17
  export function themeCss(theme, address) {
7
18
  const at = (file) => `${address}/${file.split("/").map(encodeURIComponent).join("/")}`;
8
19
  const faces = theme.fonts.map((font) => `@font-face { font-family: "${font.family}"; src: url("${at(font.file)}"); font-weight: ${font.weight}; font-display: swap; }`);
@@ -15,9 +26,25 @@ export function themeCss(theme, address) {
15
26
  ...(theme.titleCase === undefined ? [] : [`--title-case: ${titleCases[theme.titleCase]};`, `--title-variant: ${theme.titleCase === "small-capitals" ? "small-caps" : "normal"};`]),
16
27
  ...(theme.titleSpacing === undefined ? [] : [`--title-spacing: ${theme.titleSpacing}em;`]),
17
28
  ...(theme.innerLine === undefined ? [] : [`--card-inner-line: ${theme.innerLine};`]),
29
+ ...(theme.cardCorner === undefined || theme.cardCorner === "round" ? [] : [`--card-corner: ${cardCorners[theme.cardCorner]};`]),
30
+ ...shape("--button", theme.buttonShape),
31
+ ...tabs(theme.tabShape),
32
+ ...papers(theme.papers),
33
+ ...portraits(theme),
18
34
  ];
19
35
  const modes = ["light", "dark"].map((mode) => block(`:root[data-theme="${mode}"]`, [`color-scheme: ${mode};`, ...modeValues(theme, mode, at)]));
20
- return [...faces, `@layer theme {\n${[block(":root", common), ...modes].join("\n")}\n}`, ""].join("\n");
36
+ return [...faces, `@layer theme {\n${[block(":root", common), ...modes].join("\n")}\n}`, `@layer guarantees {\n${guarded(theme).join("\n")}\n}`, ""].join("\n");
37
+ }
38
+ /**
39
+ * The colours the focus ring and the tooltip draw with, the theme's, in the layer guarantees: on every element and !important, as guarantees.css sets the
40
+ * page's own, so that no rule of a theme's own style sheet changes them (D-575).
41
+ */
42
+ function guarded(theme) {
43
+ return ["light", "dark"].map((mode) => {
44
+ const colours = theme.modes[mode].colours;
45
+ const values = { accent: colours.accent, ink: colours.ink, paper: colours.paper, gold: colours.gold };
46
+ return block(`:root[data-theme="${mode}"], :root[data-theme="${mode}"] *`, Object.entries(values).map(([name, value]) => `--guard-${name}: ${value} !important;`));
47
+ });
21
48
  }
22
49
  function modeValues(theme, mode, at) {
23
50
  const given = theme.modes[mode];
@@ -34,7 +61,12 @@ function modeValues(theme, mode, at) {
34
61
  ...(given.barEdge === undefined ? [] : [`--bar-edge: ${given.barEdge};`]),
35
62
  ...texture("--page-texture", given.pageTexture, at),
36
63
  ...texture("--bar-texture", given.barTexture, at),
64
+ ...texture("--head-picture", given.headPicture, at),
65
+ ...(given.headPicture === undefined ? [] : [`--head-picture-shown: "";`]),
37
66
  ...(theme.ornament === undefined ? [] : [`--card-ornament: ${ornament(false)};`, `--card-ornament-mirrored: ${ornament(true)};`]),
67
+ ...cardTexture(theme.cardTexture, given.cardGrain, at),
68
+ ...shadows(theme.shadows, given, mode),
69
+ ...(theme.portraitFrame === undefined || theme.portraitFrame === "none" ? [] : [`--portrait-frame: ${frame(theme.portraitFrame, given.portraitFrame)};`]),
38
70
  ];
39
71
  }
40
72
  function face(token, family, after) {
@@ -48,6 +80,73 @@ function corners(card) {
48
80
  const scale = { xs: card / 3, s: card / 2, m: (card * 2) / 3, l: card, xl: (card * 4) / 3 };
49
81
  return Object.entries(scale).map(([step, value]) => `--radius-${step}: ${Math.round(value)}px;`);
50
82
  }
83
+ /** The corner of a kind of control, the page's own while the theme leaves it rounded. */
84
+ function shape(token, given) {
85
+ const corner = given === undefined ? undefined : shapeCorners[given];
86
+ return corner === undefined ? [] : [`${token}-radius: ${corner[0]};`, `${token}-corner: ${corner[1]};`];
87
+ }
88
+ /** The chosen tab: the page's bar under it, or a tint of the accent over the page, in the shape asked. */
89
+ function tabs(given) {
90
+ if (given === undefined || given === "underline") {
91
+ return [];
92
+ }
93
+ const corner = shapeCorners[given] ?? ["var(--radius-m)", "round"];
94
+ return [`--tab-radius: ${corner[0]};`, `--tab-corner: ${corner[1]};`, `--tab-chosen: color-mix(in srgb, var(--accent) 16%, var(--paper));`, `--tab-bar: transparent;`];
95
+ }
96
+ /** The paper of the documents, with its folds and rules drawn of its ink; and the land of the maps, a place's floor and grid and the world's fog drawn of it. */
97
+ function papers(given) {
98
+ return [
99
+ ...(given.documents === undefined ? [] : [`--doc-paper: ${given.documents};`, `--doc-fold: ${mix(documentInk, given.documents, 0.12)};`, `--doc-rule: ${mix(documentInk, given.documents, 0.3)};`]),
100
+ ...(given.maps === undefined
101
+ ? []
102
+ : [`--m-land: ${given.maps};`, `--map-paper: ${given.maps};`, `--map-floor: ${mix("#ffffff", given.maps, 0.3)};`, `--map-grid: ${mix(mapInk, given.maps, 0.2)};`, `--map-fog: ${mix(mapInk, given.maps, 0.15)};`]),
103
+ ];
104
+ }
105
+ /** The portraits' corner and their glass's rim, which only a round coin has. */
106
+ function portraits(theme) {
107
+ const corner = theme.portraitShape === undefined ? undefined : portraitCorners[theme.portraitShape];
108
+ return corner === undefined ? [] : [`--portrait-radius: ${corner[0]};`, `--portrait-corner: ${corner[1]};`, `--portrait-rim: linear-gradient(transparent, transparent);`];
109
+ }
110
+ /** A frame inside a portrait's edge, over the picture: one line, a thick one, or two with a dark line between them. */
111
+ function frame(kind, colour) {
112
+ return {
113
+ thin: `inset 0 0 0 2px ${colour}`,
114
+ thick: `inset 0 0 0 4px ${colour}`,
115
+ double: `inset 0 0 0 1.5px ${colour}, inset 0 0 0 3px rgb(0 0 0 / 0.55), inset 0 0 0 4.5px ${colour}`,
116
+ }[kind];
117
+ }
118
+ /** The cards' texture, drawn by the page in the grain's colour, faint under the card's own colour: 30% where it is thickest, which the check measures. */
119
+ function cardTexture(given, grain, at) {
120
+ if (given === undefined) {
121
+ return [];
122
+ }
123
+ const veil = "linear-gradient(color-mix(in srgb, var(--panel) 70%, transparent), color-mix(in srgb, var(--panel) 70%, transparent))";
124
+ const place = given.fit === "cover" ? "center / cover no-repeat" : "0 0 / auto repeat";
125
+ return [`--card-texture-layer: ${veil}, url("${at(given.picture)}?ink=${encodeURIComponent(grain)}&texture") ${place};`];
126
+ }
127
+ /**
128
+ * The shadows of whatever lifts, of the colour the mode gives or the page's: soft as the page's own, sharp as a cut-out laid on the page, none, or a glow
129
+ * all round; what lifts most, what floats, the most.
130
+ */
131
+ function shadows(kind, given, mode) {
132
+ if (kind === undefined || (kind === "soft" && given.shadow === undefined)) {
133
+ return [];
134
+ }
135
+ const colour = given.shadow ?? (kind === "glow" ? given.colours.accent : mode === "light" ? "#182c4c" : "#000000");
136
+ const of = (share) => `color-mix(in srgb, ${colour} ${share}%, transparent)`;
137
+ const shadow = {
138
+ soft: {
139
+ lift: `0 1px 2px ${of(mode === "light" ? 8 : 30)}${mode === "light" ? "" : ", inset 0 1px 0 rgb(255 255 255 / 0.05)"}`,
140
+ raise: `0 6px 18px -10px ${of(mode === "light" ? 35 : 60)}`,
141
+ up: `0 -6px 18px -12px ${of(35)}`,
142
+ overlay: `0 14px 32px -12px ${of(45)}, 0 3px 8px -3px ${of(25)}`,
143
+ },
144
+ sharp: { lift: `1px 1px 0 ${of(30)}`, raise: `3px 3px 0 ${of(22)}`, up: `0 -3px 0 ${of(22)}`, overlay: `5px 5px 0 ${of(35)}` },
145
+ none: { lift: "0 0 0 transparent", raise: "0 0 0 transparent", up: "0 0 0 transparent", overlay: "0 0 0 transparent" },
146
+ glow: { lift: `0 0 0 1px ${of(18)}`, raise: `0 0 16px -4px ${of(55)}`, up: `0 -4px 16px -6px ${of(45)}`, overlay: `0 0 28px -6px ${of(65)}, 0 0 0 1px ${of(35)}` },
147
+ }[kind];
148
+ return [`--lift: ${shadow.lift};`, `--raise: ${shadow.raise};`, `--raise-up: ${shadow.up};`, `--overlay: ${shadow.overlay};`];
149
+ }
51
150
  function texture(token, given, at) {
52
151
  if (given === undefined) {
53
152
  return [];
@@ -1,3 +1,4 @@
1
1
  export { contrast } from "./contrast.ts";
2
2
  export { themeCss } from "./css.ts";
3
- export { drawnOrnament, readTheme, themeFile, themeFileName, themeIconNames, type ThemeReading } from "./theme.ts";
3
+ export { type InstalledTheme, installedThemes, isThemeId, themeId } from "./installed.ts";
4
+ export { drawnOrnament, drawnTexture, readTheme, type Theme, themeFile, themeFileName, themeFilesNamed, themeIconNames, type ThemeReading } from "./theme.ts";
@@ -1,4 +1,6 @@
1
- // The dashboard's themes (D-527, D-528): a folder of data a game system names, read and checked here, its CSS of custom properties written here.
1
+ // The dashboard's themes (D-527, D-528): a folder of data a game system names, or a package of its own installed on this computer, read and checked here,
2
+ // its CSS of custom properties written here.
2
3
  export { contrast } from "./contrast.js";
3
4
  export { themeCss } from "./css.js";
4
- export { drawnOrnament, readTheme, themeFile, themeFileName, themeIconNames } from "./theme.js";
5
+ export { installedThemes, isThemeId, themeId } from "./installed.js";
6
+ export { drawnOrnament, drawnTexture, readTheme, themeFile, themeFileName, themeFilesNamed, themeIconNames } from "./theme.js";
@@ -0,0 +1,14 @@
1
+ import { type Theme } from "./theme.ts";
2
+ /** A theme installed on this computer: its id, which names its folder and its address; the theme when it passes its checks, else what to fix, each a line. */
3
+ export interface InstalledTheme {
4
+ id: string;
5
+ folder: string;
6
+ theme?: Theme;
7
+ problems: string[];
8
+ }
9
+ /** The themes in this folder, by their id; one refused is listed with its problems, for the player to see why it is not offered. */
10
+ export declare function installedThemes(folder: string): InstalledTheme[];
11
+ /** Whether a text is a theme's id: lowercase letters and digits, joined by hyphens. */
12
+ export declare function isThemeId(text: string): boolean;
13
+ /** The id of a theme by its name, lowercase letters, digits and hyphens: Old Parchment is old-parchment; a name without such letters, by a print of it. */
14
+ export declare function themeId(name: string): string;
@@ -0,0 +1,28 @@
1
+ // The themes installed on this computer for every campaign, as packages of data alone: each in a folder of its own named by its id, read and checked as a
2
+ // game system's theme is.
3
+ import { createHash } from "node:crypto";
4
+ import { join } from "node:path";
5
+ import { files } from "../core/store.js";
6
+ import { readTheme } from "./theme.js";
7
+ // What an id is made of; a folder being unpacked starts with a dot, and is none.
8
+ const idPattern = /^[a-z0-9]+(-[a-z0-9]+)*$/;
9
+ /** The themes in this folder, by their id; one refused is listed with its problems, for the player to see why it is not offered. */
10
+ export function installedThemes(folder) {
11
+ return files().entries(folder)
12
+ .filter((entry) => entry.isFolder && idPattern.test(entry.name))
13
+ .map((entry) => entry.name)
14
+ .sort()
15
+ .map((id) => {
16
+ const path = join(folder, id);
17
+ return { id, folder: path, ...readTheme(path) };
18
+ });
19
+ }
20
+ /** Whether a text is a theme's id: lowercase letters and digits, joined by hyphens. */
21
+ export function isThemeId(text) {
22
+ return idPattern.test(text);
23
+ }
24
+ /** The id of a theme by its name, lowercase letters, digits and hyphens: Old Parchment is old-parchment; a name without such letters, by a print of it. */
25
+ export function themeId(name) {
26
+ const id = name.normalize("NFKD").replace(/[̀-ͯ]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").slice(0, 64).replace(/^-+|-+$/g, "");
27
+ return id === "" ? `theme-${createHash("sha256").update(name).digest("hex").slice(0, 8)}` : id;
28
+ }
@@ -14,6 +14,8 @@ type ColourName = (typeof requiredColours)[number] | (typeof optionalColours)[nu
14
14
  /** A theme as read, its files checked and its derived colours filled in. */
15
15
  export interface Theme {
16
16
  name: string;
17
+ /** Its version, as a theme installed on its own gives it. */
18
+ version?: string;
17
19
  /** The folder it was read from: its files are served from there. */
18
20
  folder: string;
19
21
  fonts: ThemeFont[];
@@ -32,6 +34,25 @@ export interface Theme {
32
34
  innerLine?: "none" | "solid" | "dashed" | "dotted";
33
35
  /** The picture in a card's lower corner, a file of the folder drawn in one colour. */
34
36
  ornament?: string;
37
+ /** The cards' corners cut, notched or scooped instead of round, as far as `corners` says. */
38
+ cardCorner?: "round" | "cut" | "notch" | "scoop";
39
+ /** A texture under the cards, an SVG drawn in each mode's grain colour, faint under the card's own colour. */
40
+ cardTexture?: ThemeTexture;
41
+ /** The shape of the buttons of words, and of the chosen tab. */
42
+ buttonShape?: Shape;
43
+ tabShape?: "underline" | Shape;
44
+ /** The shadows of whatever lifts: soft as the page's, sharp, none, or a glow. */
45
+ shadows?: "soft" | "sharp" | "none" | "glow";
46
+ /** The paper of the maps and of the documents found, the same in both modes. */
47
+ papers: {
48
+ maps?: string;
49
+ documents?: string;
50
+ };
51
+ /** The portraits' shape and a frame drawn inside their edge. */
52
+ portraitShape?: "round" | "rounded" | "square" | "cut";
53
+ portraitFrame?: "none" | "thin" | "thick" | "double";
54
+ /** A style sheet of its own, a file of the folder, which the page adds over its rules in a layer of its own, unchecked. */
55
+ style?: string;
35
56
  /** The lines of each icon it draws, by name: the d of its paths, on a grid of 24. */
36
57
  icons: Record<string, string>;
37
58
  modes: Record<ThemeModeName, ThemeMode>;
@@ -51,7 +72,17 @@ export interface ThemeMode {
51
72
  barEdge?: string;
52
73
  pageTexture?: ThemeTexture;
53
74
  barTexture?: ThemeTexture;
75
+ /** A picture at the end of the top, beside the campaign's name, under no words. */
76
+ headPicture?: ThemeTexture;
77
+ /** The colour the cards' texture is drawn in. */
78
+ cardGrain: string;
79
+ /** The colour of the shadows, when not the page's. */
80
+ shadow?: string;
81
+ /** The colour of the portraits' frame. */
82
+ portraitFrame: string;
54
83
  }
84
+ /** The shapes of a button or a tab: the page's rounded corners, square, a pill, or cut. */
85
+ type Shape = "rounded" | "square" | "pill" | "cut";
55
86
  /** A picture under the page or the top, repeated or covering it. */
56
87
  export interface ThemeTexture {
57
88
  picture: string;
@@ -66,6 +97,13 @@ export interface ThemeReading {
66
97
  export declare function readTheme(folder: string): ThemeReading;
67
98
  /** The real path of a file of a theme's folder, only when it is one and inside it, links resolved: what the dashboard serves. */
68
99
  export declare function themeFile(folder: string, name: string): string | undefined;
100
+ /**
101
+ * The files a theme.yaml names, with forward slashes, as written from its folder: its fonts and their licences, its ornament, icons, textures and pictures,
102
+ * its style sheet and the pictures that names, read by `read`. None when it does not read: its checks say why.
103
+ */
104
+ export declare function themeFilesNamed(text: string, read?: (name: string) => string | undefined): string[];
69
105
  /** An ornament drawn in one colour, turned for a page that reads right to left: the theme gives one drawing for both modes and both directions. */
70
106
  export declare function drawnOrnament(svg: string, ink: string, mirrored: boolean): string;
107
+ /** The cards' texture drawn in one colour: what it draws in currentColor, and what it fills without saying how, in that colour. */
108
+ export declare function drawnTexture(svg: string, ink: string): string;
71
109
  export {};