rpg-engine 0.20.0 → 0.21.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 (160) 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/index.d.ts +1 -1
  10. package/dist/campaign/index.js +1 -1
  11. package/dist/campaign/settings.js +2 -2
  12. package/dist/commands/book.d.ts +16 -35
  13. package/dist/commands/book.js +86 -62
  14. package/dist/commands/config/config.js +1 -1
  15. package/dist/commands/config/dashboard.d.ts +2 -2
  16. package/dist/commands/config/dashboard.js +9 -3
  17. package/dist/commands/config/words.js +1 -1
  18. package/dist/commands/image.d.ts +5 -0
  19. package/dist/commands/image.js +6 -3
  20. package/dist/commands/package/data.d.ts +35 -0
  21. package/dist/commands/package/data.js +117 -0
  22. package/dist/commands/package/here.d.ts +7 -2
  23. package/dist/commands/package/here.js +23 -11
  24. package/dist/commands/package/install.js +14 -15
  25. package/dist/commands/package/language.d.ts +15 -0
  26. package/dist/commands/package/language.js +109 -0
  27. package/dist/commands/package/package.js +20 -10
  28. package/dist/commands/package/result.d.ts +19 -0
  29. package/dist/commands/package/theme.d.ts +13 -0
  30. package/dist/commands/package/theme.js +66 -0
  31. package/dist/commands/package/uninstall.d.ts +4 -1
  32. package/dist/commands/package/uninstall.js +29 -9
  33. package/dist/commands/scene/close.d.ts +1 -1
  34. package/dist/commands/scene/close.js +15 -8
  35. package/dist/commands/shared/books/adventures.d.ts +0 -4
  36. package/dist/commands/shared/books/adventures.js +2 -31
  37. package/dist/commands/shared/books/words.js +3 -2
  38. package/dist/commands/shared/campaign/book.d.ts +21 -8
  39. package/dist/commands/shared/campaign/book.js +65 -42
  40. package/dist/commands/shared/campaign/saves.js +2 -2
  41. package/dist/commands/shared/campaign/world.js +2 -1
  42. package/dist/commands/shared/packages/catalog.d.ts +3 -3
  43. package/dist/commands/shared/packages/catalog.js +98 -42
  44. package/dist/commands/shared/packages/unpacked.d.ts +50 -0
  45. package/dist/commands/shared/packages/unpacked.js +146 -0
  46. package/dist/core/archive.d.ts +13 -0
  47. package/dist/core/archive.js +76 -0
  48. package/dist/core/context.d.ts +2 -0
  49. package/dist/core/context.js +1 -0
  50. package/dist/core/store.d.ts +5 -1
  51. package/dist/core/store.js +15 -2
  52. package/dist/dashboard/api.js +24 -1
  53. package/dist/dashboard/app.js +7 -2
  54. package/dist/dashboard/guide/ar.md +8 -8
  55. package/dist/dashboard/guide/cs.md +8 -8
  56. package/dist/dashboard/guide/da.md +9 -9
  57. package/dist/dashboard/guide/de.md +8 -8
  58. package/dist/dashboard/guide/el.md +8 -8
  59. package/dist/dashboard/guide/en.md +7 -7
  60. package/dist/dashboard/guide/es.md +8 -8
  61. package/dist/dashboard/guide/fi.md +8 -8
  62. package/dist/dashboard/guide/fr.md +8 -8
  63. package/dist/dashboard/guide/he.md +8 -8
  64. package/dist/dashboard/guide/hi.md +8 -8
  65. package/dist/dashboard/guide/hu.md +8 -8
  66. package/dist/dashboard/guide/is.md +8 -8
  67. package/dist/dashboard/guide/it.md +8 -8
  68. package/dist/dashboard/guide/ja.md +8 -8
  69. package/dist/dashboard/guide/ko.md +8 -8
  70. package/dist/dashboard/guide/nb.md +9 -9
  71. package/dist/dashboard/guide/nl.md +8 -8
  72. package/dist/dashboard/guide/pl.md +8 -8
  73. package/dist/dashboard/guide/pt.md +8 -8
  74. package/dist/dashboard/guide/ro.md +8 -8
  75. package/dist/dashboard/guide/ru.md +9 -9
  76. package/dist/dashboard/guide/sv.md +8 -8
  77. package/dist/dashboard/guide/tr.md +8 -8
  78. package/dist/dashboard/guide/uk.md +9 -9
  79. package/dist/dashboard/guide/zh.md +8 -8
  80. package/dist/dashboard/i18n/ar.json +33 -5
  81. package/dist/dashboard/i18n/cs.json +33 -5
  82. package/dist/dashboard/i18n/da.json +33 -5
  83. package/dist/dashboard/i18n/de.json +33 -5
  84. package/dist/dashboard/i18n/el.json +33 -5
  85. package/dist/dashboard/i18n/es.json +33 -5
  86. package/dist/dashboard/i18n/fi.json +33 -5
  87. package/dist/dashboard/i18n/fr.json +33 -5
  88. package/dist/dashboard/i18n/he.json +33 -5
  89. package/dist/dashboard/i18n/hi.json +33 -5
  90. package/dist/dashboard/i18n/hu.json +33 -5
  91. package/dist/dashboard/i18n/is.json +33 -5
  92. package/dist/dashboard/i18n/it.json +33 -5
  93. package/dist/dashboard/i18n/ja.json +33 -5
  94. package/dist/dashboard/i18n/ko.json +33 -5
  95. package/dist/dashboard/i18n/nb.json +33 -5
  96. package/dist/dashboard/i18n/nl.json +33 -5
  97. package/dist/dashboard/i18n/pl.json +33 -5
  98. package/dist/dashboard/i18n/pt.json +33 -5
  99. package/dist/dashboard/i18n/ro.json +33 -5
  100. package/dist/dashboard/i18n/ru.json +33 -5
  101. package/dist/dashboard/i18n/sv.json +33 -5
  102. package/dist/dashboard/i18n/tr.json +33 -5
  103. package/dist/dashboard/i18n/uk.json +33 -5
  104. package/dist/dashboard/i18n/zh.json +33 -5
  105. package/dist/dashboard/journal/book.js +3 -2
  106. package/dist/dashboard/journal/journal.js +8 -5
  107. package/dist/dashboard/kit.js +1 -1
  108. package/dist/dashboard/packages/catalog.js +31 -14
  109. package/dist/dashboard/packages/engine.js +46 -2
  110. package/dist/dashboard/packages/installed.js +13 -0
  111. package/dist/dashboard/packages/outcomes.js +21 -0
  112. package/dist/dashboard/packages/packages.js +41 -18
  113. package/dist/dashboard/packages/rows.js +3 -1
  114. package/dist/dashboard/parts/icons.js +3 -0
  115. package/dist/dashboard/parts/picture.js +89 -0
  116. package/dist/dashboard/parts/refusals.js +8 -1
  117. package/dist/dashboard/parts/widgets.js +2 -1
  118. package/dist/dashboard/play/scene.js +8 -5
  119. package/dist/dashboard/settings/settings.js +23 -13
  120. package/dist/dashboard/sheet/party.js +5 -2
  121. package/dist/dashboard/sheet/sheet.js +2 -1
  122. package/dist/dashboard/shell/notices.js +2 -2
  123. package/dist/dashboard/shell/system-style.js +45 -12
  124. package/dist/dashboard/shell/tooltip.js +223 -0
  125. package/dist/dashboard/style.css +283 -132
  126. package/dist/dashboard/world/lore.js +4 -3
  127. package/dist/dashboard/world/place-card.js +2 -1
  128. package/dist/languages/index.d.ts +1 -1
  129. package/dist/languages/index.js +1 -1
  130. package/dist/languages/pack.d.ts +4 -1
  131. package/dist/languages/pack.js +16 -5
  132. package/dist/packages/engine.d.ts +7 -0
  133. package/dist/packages/engine.js +32 -1
  134. package/dist/packages/index.d.ts +1 -1
  135. package/dist/packages/index.js +1 -1
  136. package/dist/server/dashboard/engine.d.ts +18 -0
  137. package/dist/server/dashboard/engine.js +31 -0
  138. package/dist/server/dashboard/files.d.ts +8 -1
  139. package/dist/server/dashboard/files.js +30 -10
  140. package/dist/server/dashboard/index.d.ts +3 -0
  141. package/dist/server/dashboard/index.js +10 -1
  142. package/dist/server/dashboard/pictures.d.ts +7 -0
  143. package/dist/server/dashboard/pictures.js +62 -0
  144. package/dist/server/dashboard/writes.d.ts +5 -3
  145. package/dist/server/dashboard/writes.js +45 -14
  146. package/dist/testing/index.js +1 -0
  147. package/dist/themes/index.d.ts +2 -1
  148. package/dist/themes/index.js +4 -2
  149. package/dist/themes/installed.d.ts +14 -0
  150. package/dist/themes/installed.js +28 -0
  151. package/dist/themes/theme.d.ts +7 -0
  152. package/dist/themes/theme.js +22 -0
  153. package/instructions/core.md +3 -3
  154. package/instructions/dashboard-guide.md +1 -0
  155. package/instructions/mentor-hints.md +1 -1
  156. package/instructions/mentor-tutorial.md +1 -1
  157. package/instructions/party.md +1 -1
  158. package/instructions/play.md +2 -2
  159. package/package.json +1 -1
  160. package/systems/free/instructions/outcomes-told.md +1 -1
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime";
2
2
  // The Packages section (D-485, D-486, D-488), in three tabs: Installed first, what is here by kind: the game system, with the pages of it the campaign changed
3
- // under the one it plays (D-564), the campaign's adventures with its own export last, the extensions with whether the campaign uses each, the languages; its
4
- // tab counts the updates and marks what the campaign lacks. Then Add: one card to add a package: the catalog of what npm and GitHub offer first, always open,
3
+ // under the one it plays (D-564), the campaign's adventures with its own export last, the extensions with whether the campaign uses each, the themes and the
4
+ // languages of every campaign (D-574); its tab counts the updates and marks what the campaign lacks. Then Add: one card to add a package: the catalog of what npm and GitHub offer first, always open,
5
5
  // then a link, an npm name, a folder or a file. Then Library: the folders of the player's books for this campaign alone (D-491 (13)). One work at a time; one
6
6
  // not ours with code, or a folder added to the library, waits for the player's yes in a window of their computer, said in every tab.
7
7
  import { useEffect, useRef, useState } from "preact/hooks";
@@ -12,14 +12,15 @@ import { Icon, iconPath } from "../parts/icons.js";
12
12
  import { phraseLabel } from "../parts/labels.js";
13
13
  import { Confirm } from "../settings/saves.js";
14
14
  import { PageHead } from "../shell/pages.js";
15
+ import { shownInstalledTheme } from "../shell/system-style.js";
15
16
  import { PageTabs } from "../shell/tabs.js";
16
17
  import { t } from "../text.js";
17
- import { AddField, CatalogList, entryOf, entryTitle, newerOf, updateCount } from "./catalog.js";
18
+ import { AddField, CatalogList, entryOf, entryTitle, languageEntryOf, newerOf, newerVersion, themeEntryOf, updateCount } from "./catalog.js";
18
19
  import { ChangedPages } from "./changes.js";
19
20
  import { EngineCard, engineName, focusEngine, keepUpdate, keptUpdate, NeedsEngine } from "./engine.js";
20
- import { AdventureRow, ExtensionRow, LanguageRow, languageTitle, MissingRow, SystemRow } from "./installed.js";
21
+ import { AdventureRow, ExtensionRow, LanguageRow, languageTitle, MissingRow, SystemRow, ThemeRow } from "./installed.js";
21
22
  import { libraryReading, LibraryTab } from "./library.js";
22
- import { addedText, doneText, failure, uninstallText } from "./outcomes.js";
23
+ import { addedText, doneText, engineFailure, failure, uninstallText } from "./outcomes.js";
23
24
  import { CardSaid, SaidNote, WorkNote } from "./rows.js";
24
25
  import { ShareCampaign } from "./share.js";
25
26
  /**
@@ -174,13 +175,7 @@ export function PackagesPage({ version, tab, item, layers = [], sceneOpen = fals
174
175
  setUpdated({ ...done, now: true });
175
176
  }
176
177
  else {
177
- setSaid({
178
- at: "engine",
179
- problem: true,
180
- ...(outcome.code === "busy"
181
- ? { text: t("One package at a time: wait for the one under way, then try again.") }
182
- : { text: t("RPG Engine was not updated."), why: outcome.error }),
183
- });
178
+ setSaid({ at: "engine", problem: true, ...engineFailure(outcome) });
184
179
  askEngine();
185
180
  }
186
181
  read();
@@ -188,6 +183,10 @@ export function PackagesPage({ version, tab, item, layers = [], sceneOpen = fals
188
183
  const add = (at, source) => run(at, "add", source, () => addSource(source), addedText);
189
184
  const addTheFile = (file) => run("add", "add", file.name, () => addFile(file), addedText);
190
185
  const change = (at, action, name, label, after) => run(at, action, name, () => changePackage(action, name), () => doneText(action, label), after);
186
+ // One of data alone from GitHub, a theme or a language, is updated by adding it again from its link, in the place of the one here; npm's by npm.
187
+ const update = (at, name, label, entry) => entry !== undefined && /^https?:\/\//i.test(entry.source)
188
+ ? run(at, "update", entry.source, () => addSource(entry.source), () => doneText("update", label))
189
+ : change(at, "update", name, label);
191
190
  const addToLibrary = (path) => run("library", "library", path, () => changeLibrary("add", path), () => t("The folder is on this computer and in this campaign: its books are read now, then the master searches them."));
192
191
  // One the computer has not leaves the list once taken out: what came of it is said under the field.
193
192
  const useInCampaign = (path, use, away) => run(`library:${path}`, "library", path, () => changeLibrary(use ? "add" : "remove", path), () => (use ? t("In this campaign: the master searches its books.") : away ? t("{name} is out of the campaign.", { name: path }) : t("Off in this campaign: it stays on this computer.")), away && !use ? "library" : undefined);
@@ -206,6 +205,8 @@ export function PackagesPage({ version, tab, item, layers = [], sceneOpen = fals
206
205
  const systems = view?.systems ?? [];
207
206
  const adventures = view?.adventures ?? [];
208
207
  const languages = view?.languages ?? [];
208
+ const themes = view?.themes ?? [];
209
+ const themeShown = shownInstalledTheme();
209
210
  // The engine npm has that this page may install: one more update on the Installed tab, and the way for a package that needs it.
210
211
  const engineNew = engine.read?.update === true && engine.read.install === "global" && updated === undefined ? engine.read.latest : undefined;
211
212
  const updates = (view === undefined ? 0 : updateCount(view, catalog.read)) + (engineNew === undefined ? 0 : 1);
@@ -218,9 +219,21 @@ export function PackagesPage({ version, tab, item, layers = [], sceneOpen = fals
218
219
  { key: "installed", name: t("Installed"), label: [t("Installed"), ...marksText(updates, missing)].join(", "), marks: _jsx(TabMarks, { updates: updates, missing: missing }) },
219
220
  { key: "add", name: t("Add") },
220
221
  { key: "library", name: t("Library"), label: [t("Library"), ...marksText(0, away)].join(", "), marks: _jsx(TabMarks, { updates: 0, missing: away }) },
221
- ] }), view !== undefined && (_jsxs("div", { class: "package-panel", id: "packages-panel", role: "tabpanel", "aria-label": shownTab === "add" ? t("Add") : shownTab === "library" ? t("Library") : t("Installed"), children: [elsewhere !== undefined && _jsx(WorkNote, { work: elsewhere, whose: workTitle(elsewhere, catalog.read) }), saidElsewhere !== undefined && _jsx(SaidNote, { said: saidElsewhere }), shownTab === "library" && (_jsx(LibraryTab, { view: library, problem: libraryProblem, state: rowState, onAdd: (path) => void addToLibrary(path), onUse: (path, use, away) => void useInCampaign(path, use, away), onForget: (path, name) => setAsking({ kind: "library", path, name }) })), shownTab === "add" && (_jsx("section", { class: "card", "aria-label": t("Add"), children: _jsxs("div", { class: "card-body package-body", children: [_jsx(CatalogList, { catalog: catalog, view: view, state: (entry) => rowState(`catalog:${entry.source}`), needs: (entry) => needs(entry.newer), onAdd: (entry) => void add(`catalog:${entry.source}`, entry.source), onUpdate: (entry) => void change(`catalog:${entry.source}`, "update", entry.source, entryTitle(entry)), onRetry: () => askCatalog(true) }), _jsx(AddField, { state: rowState("add"), onAdd: (source) => void add("add", source), onFile: (file) => void addTheFile(file) })] }) })), shownTab === "installed" && (_jsxs(_Fragment, { children: [!engine.hidden && _jsx(EngineCard, { engine: engine.read, updated: updated, newer: engineNew, state: rowState("engine"), onUpdate: () => void updateTheEngine() }), _jsxs("section", { class: "card", "aria-labelledby": "packages-systems", children: [_jsx(CardHead, { icon: iconPath("dice"), title: _jsx("h3", { id: "packages-systems", tabIndex: -1, children: t("Game system") }) }), _jsxs("div", { class: "card-body package-body", children: [_jsx("ul", { class: "package-list", children: systems.map((system) => (_jsx(SystemRow, { system: system, newer: system.package === undefined ? undefined : newerOf(system.package, "system", catalog.read), needs: system.package === undefined ? null : needs(entryOf(system.package, "system", catalog.read)?.newer), changes: system.used ? _jsx(ChangedPages, { layers: layers, sceneOpen: sceneOpen, open: item, onChanged: onChanged }) : undefined, fresh: fresh.includes(`system:${system.name}`), state: rowState(`system:${system.name}`), onUpdate: (target) => void change(`system:${system.name}`, "update", target, system.name), onUninstall: (target) => setAsking({ kind: "uninstall", what: "system", name: system.name, target, at: `system:${system.name}` }) }, system.name))) }), _jsx(CardSaid, { said: said, at: "systems" })] })] }), _jsxs("section", { class: "card", "aria-labelledby": "packages-adventures", children: [_jsx(CardHead, { icon: iconPath("world"), title: _jsx("h3", { id: "packages-adventures", tabIndex: -1, children: t("Adventures") }), ...(adventures.length === 0 ? {} : { note: String(adventures.length) }) }), _jsxs("div", { class: "card-body package-body", children: [adventures.length === 0 && _jsx("p", { class: "package-note", children: t("None yet: add one in Add, from the catalog, a .zip or a link.") }), adventures.length > 0 && (_jsx("ul", { class: "package-list", children: adventures.map((adventure) => (_jsx(AdventureRow, { adventure: adventure, fresh: fresh.includes(`adventure:${adventure.title}`), state: rowState(`adventure:${adventure.title}`), onTakeOut: () => setAsking({ kind: "adventure", title: adventure.title }) }, adventure.title))) })), _jsx(CardSaid, { said: said, at: "adventures" }), _jsx(ShareCampaign, {})] })] }), _jsxs("section", { class: "card", "aria-labelledby": "packages-extensions", children: [_jsx(CardHead, { icon: iconPath("packages"), title: _jsx("h3", { id: "packages-extensions", tabIndex: -1, children: t("Extensions") }), ...(view.installed.length + view.missing.length === 0 ? {} : { note: t("{count} in use", { count: usedCount(view) }) }) }), _jsxs("div", { class: "card-body package-body", children: [view.installed.length + view.missing.length === 0 && _jsx("p", { class: "package-note", children: t("None: an extension adds rules and tools to the game; you find them in Add, in the catalog.") }), view.installed.length + view.missing.length > 0 && (_jsxs("ul", { class: "package-list", children: [view.installed.map((extension) => (_jsx(ExtensionRow, { extension: extension, newer: newerOf(extension.package, "extension", catalog.read), needs: needs(entryOf(extension.package, "extension", catalog.read)?.newer), fresh: fresh.includes(`extension:${extension.package}`), state: rowState(`extension:${extension.package}`), onUse: (use) => void (use
222
+ ] }), view !== undefined && (_jsxs("div", { class: "package-panel", id: "packages-panel", role: "tabpanel", "aria-label": shownTab === "add" ? t("Add") : shownTab === "library" ? t("Library") : t("Installed"), children: [elsewhere !== undefined && _jsx(WorkNote, { work: elsewhere, whose: workTitle(elsewhere, catalog.read) }), saidElsewhere !== undefined && _jsx(SaidNote, { said: saidElsewhere }), shownTab === "library" && (_jsx(LibraryTab, { view: library, problem: libraryProblem, state: rowState, onAdd: (path) => void addToLibrary(path), onUse: (path, use, away) => void useInCampaign(path, use, away), onForget: (path, name) => setAsking({ kind: "library", path, name }) })), shownTab === "add" && (_jsx("section", { class: "card", "aria-label": t("Add"), children: _jsxs("div", { class: "card-body package-body", children: [_jsx(CatalogList, { catalog: catalog, view: view, state: (entry) => rowState(`catalog:${entry.source}`), needs: (entry) => needs(entry.newer), onAdd: (entry) => void add(`catalog:${entry.source}`, entry.source), onUpdate: (entry) => void update(`catalog:${entry.source}`, entry.source, entryTitle(entry), entry), onRetry: () => askCatalog(true) }), _jsx(AddField, { state: rowState("add"), onAdd: (source) => void add("add", source), onFile: (file) => void addTheFile(file) })] }) })), shownTab === "installed" && (_jsxs(_Fragment, { children: [!engine.hidden && _jsx(EngineCard, { engine: engine.read, updated: updated, newer: engineNew, state: rowState("engine"), onUpdate: () => void updateTheEngine() }), _jsxs("section", { class: "card", "aria-labelledby": "packages-systems", children: [_jsx(CardHead, { icon: iconPath("dice"), title: _jsx("h3", { id: "packages-systems", tabIndex: -1, children: t("Game system") }) }), _jsxs("div", { class: "card-body package-body", children: [_jsx("ul", { class: "package-list", children: systems.map((system) => (_jsx(SystemRow, { system: system, newer: system.package === undefined ? undefined : newerOf(system.package, "system", catalog.read), needs: system.package === undefined ? null : needs(entryOf(system.package, "system", catalog.read)?.newer), changes: system.used ? _jsx(ChangedPages, { layers: layers, sceneOpen: sceneOpen, open: item, onChanged: onChanged }) : undefined, fresh: fresh.includes(`system:${system.name}`), state: rowState(`system:${system.name}`), onUpdate: (target) => void change(`system:${system.name}`, "update", target, system.name), onUninstall: (target) => setAsking({ kind: "uninstall", what: "system", name: system.name, target, at: `system:${system.name}` }) }, system.name))) }), _jsx(CardSaid, { said: said, at: "systems" })] })] }), _jsxs("section", { class: "card", "aria-labelledby": "packages-adventures", children: [_jsx(CardHead, { icon: iconPath("world"), title: _jsx("h3", { id: "packages-adventures", tabIndex: -1, children: t("Adventures") }), ...(adventures.length === 0 ? {} : { note: String(adventures.length) }) }), _jsxs("div", { class: "card-body package-body", children: [adventures.length === 0 && _jsx("p", { class: "package-note", children: t("None yet: add one in Add, from the catalog, a .zip or a link.") }), adventures.length > 0 && (_jsx("ul", { class: "package-list", children: adventures.map((adventure) => (_jsx(AdventureRow, { adventure: adventure, fresh: fresh.includes(`adventure:${adventure.title}`), state: rowState(`adventure:${adventure.title}`), onTakeOut: () => setAsking({ kind: "adventure", title: adventure.title }) }, adventure.title))) })), _jsx(CardSaid, { said: said, at: "adventures" }), _jsx(ShareCampaign, {})] })] }), _jsxs("section", { class: "card", "aria-labelledby": "packages-extensions", children: [_jsx(CardHead, { icon: iconPath("packages"), title: _jsx("h3", { id: "packages-extensions", tabIndex: -1, children: t("Extensions") }), ...(view.installed.length + view.missing.length === 0 ? {} : { note: t("{count} in use", { count: usedCount(view) }) }) }), _jsxs("div", { class: "card-body package-body", children: [view.installed.length + view.missing.length === 0 && _jsx("p", { class: "package-note", children: t("None: an extension adds rules and tools to the game; you find them in Add, in the catalog.") }), view.installed.length + view.missing.length > 0 && (_jsxs("ul", { class: "package-list", children: [view.installed.map((extension) => (_jsx(ExtensionRow, { extension: extension, newer: newerOf(extension.package, "extension", catalog.read), needs: needs(entryOf(extension.package, "extension", catalog.read)?.newer), fresh: fresh.includes(`extension:${extension.package}`), state: rowState(`extension:${extension.package}`), onUse: (use) => void (use
222
223
  ? add(`extension:${extension.package}`, extension.package)
223
- : change(`extension:${extension.package}`, "remove", extension.package, phraseLabel(extension.name))), onUpdate: () => void change(`extension:${extension.package}`, "update", extension.package, phraseLabel(extension.name)), onUninstall: () => setAsking({ kind: "uninstall", what: "extension", name: phraseLabel(extension.name), target: extension.package, at: `extension:${extension.package}` }) }, extension.package))), view.missing.map((name) => _jsx(MissingRow, { name: name, state: rowState(`extension:${name}`), onInstall: () => void add(`extension:${name}`, name) }, name))] })), _jsx(CardSaid, { said: said, at: "extensions" })] })] }), _jsxs("section", { class: "card", "aria-labelledby": "packages-languages", children: [_jsx(CardHead, { icon: iconPath("language"), title: _jsx("h3", { id: "packages-languages", tabIndex: -1, children: t("Languages") }) }), _jsxs("div", { class: "card-body package-body", children: [languages.length === 0 && _jsx("p", { class: "package-note", children: t("None. The dashboard has its own languages; a language package takes the place of one with a translation made by hand.") }), languages.length > 0 && (_jsx("ul", { class: "package-list", children: languages.map((language) => (_jsx(LanguageRow, { language: language, newer: newerOf(language.package, "language", catalog.read), needs: needs(entryOf(language.package, "language", catalog.read)?.newer), fresh: fresh.includes(`language:${language.code}`), state: rowState(`language:${language.code}`), onUpdate: () => void change(`language:${language.code}`, "update", language.package, languageTitle(language)), onUninstall: () => setAsking({ kind: "uninstall", what: "language", name: languageTitle(language), target: language.package, at: `language:${language.code}` }) }, language.package))) })), _jsx(CardSaid, { said: said, at: "languages" })] })] })] }))] })), asking?.kind === "adventure" && (_jsxs(Confirm, { title: t("Take {name} out of the campaign?", { name: asking.title }), onClose: () => setAsking(undefined), children: [_jsx("p", { children: t("Its places, people and pages leave the world. To have it again, add it once more.") }), _jsxs("div", { class: "confirm-buttons", children: [_jsx("button", { type: "button", class: "button", autoFocus: true, onClick: () => setAsking(undefined), children: t("Cancel") }), _jsx("button", { type: "button", class: "button danger final", onClick: () => confirmed(asking), children: t("Take out") })] })] })), asking?.kind === "library" && (_jsxs(Confirm, { title: t("Take {path} off this computer?", { path: asking.name }), onClose: () => setAsking(undefined), children: [_jsx("p", { children: t("No campaign searches it any more, and the text RPG Engine read of its books is deleted. The books stay where they are.") }), _jsxs("div", { class: "confirm-buttons", children: [_jsx("button", { type: "button", class: "button", autoFocus: true, onClick: () => setAsking(undefined), children: t("Cancel") }), _jsx("button", { type: "button", class: "button danger final", onClick: () => confirmed(asking), children: t("Take off") })] })] })), asking?.kind === "uninstall" && (_jsxs(Confirm, { title: t("Uninstall {name} from this computer?", { name: asking.name }), onClose: () => setAsking(undefined), children: [uninstallText(asking.what), _jsxs("div", { class: "confirm-buttons", children: [_jsx("button", { type: "button", class: "button", autoFocus: true, onClick: () => setAsking(undefined), children: t("Cancel") }), _jsx("button", { type: "button", class: "button danger final", onClick: () => confirmed(asking), children: t("Uninstall") })] })] }))] }));
224
+ : change(`extension:${extension.package}`, "remove", extension.package, phraseLabel(extension.name))), onUpdate: () => void change(`extension:${extension.package}`, "update", extension.package, phraseLabel(extension.name)), onUninstall: () => setAsking({ kind: "uninstall", what: "extension", name: phraseLabel(extension.name), target: extension.package, at: `extension:${extension.package}` }) }, extension.package))), view.missing.map((name) => _jsx(MissingRow, { name: name, state: rowState(`extension:${name}`), onInstall: () => void add(`extension:${name}`, name) }, name))] })), _jsx(CardSaid, { said: said, at: "extensions" })] })] }), _jsxs("section", { class: "card", "aria-labelledby": "packages-themes", children: [_jsx(CardHead, { icon: iconPath("theme"), title: _jsx("h3", { id: "packages-themes", tabIndex: -1, children: t("Themes") }), ...(themes.length === 0 ? {} : { note: String(themes.length) }) }), _jsxs("div", { class: "card-body package-body", children: [themes.length === 0 && _jsx("p", { class: "package-note", children: t("None: a theme changes the page's colours, faces and pictures, in every campaign; you find them in Add, in the catalog.") }), themes.length > 0 && (_jsxs(_Fragment, { children: [_jsx("ul", { class: "package-list", children: themes.map((theme) => {
225
+ const entry = themeEntryOf(theme, catalog.read);
226
+ return (_jsx(ThemeRow, { theme: theme, newer: newerVersion(entry), shown: theme.id === themeShown, fresh: fresh.includes(`theme:${theme.id}`), state: rowState(`theme:${theme.id}`), onUpdate: () => void update(`theme:${theme.id}`, theme.id, theme.name, entry), onUninstall: () => setAsking({ kind: "uninstall", what: "theme", name: theme.name, target: `theme:${theme.id}`, at: `theme:${theme.id}` }) }, theme.id));
227
+ }) }), _jsx("p", { class: "package-note", children: t("You choose one in Settings, under Game style.") })] })), _jsx(CardSaid, { said: said, at: "themes" })] })] }), _jsxs("section", { class: "card", "aria-labelledby": "packages-languages", children: [_jsx(CardHead, { icon: iconPath("language"), title: _jsx("h3", { id: "packages-languages", tabIndex: -1, children: t("Languages") }) }), _jsxs("div", { class: "card-body package-body", children: [languages.length === 0 && _jsx("p", { class: "package-note", children: t("None. The dashboard has its own languages; a language package takes the place of one with a translation made by hand.") }), languages.length > 0 && (_jsx("ul", { class: "package-list", children: languages.map((language) => {
228
+ const entry = languageEntryOf(language, catalog.read);
229
+ return (_jsx(LanguageRow, { language: language, newer: newerVersion(entry), needs: needs(entry?.newer), fresh: fresh.includes(`language:${language.code}`), state: rowState(`language:${language.code}`), onUpdate: () => void update(`language:${language.code}`, language.package, languageTitle(language), entry), onUninstall: () => setAsking({
230
+ kind: "uninstall",
231
+ what: "language",
232
+ name: languageTitle(language),
233
+ target: language.unpacked === true ? `language:${language.code}` : language.package,
234
+ at: `language:${language.code}`,
235
+ }) }, language.package));
236
+ }) })), _jsx(CardSaid, { said: said, at: "languages" })] })] })] }))] })), asking?.kind === "adventure" && (_jsxs(Confirm, { title: t("Take {name} out of the campaign?", { name: asking.title }), onClose: () => setAsking(undefined), children: [_jsx("p", { children: t("Its places, people and pages leave the world. To have it again, add it once more.") }), _jsxs("div", { class: "confirm-buttons", children: [_jsx("button", { type: "button", class: "button", autoFocus: true, onClick: () => setAsking(undefined), children: t("Cancel") }), _jsx("button", { type: "button", class: "button danger final", onClick: () => confirmed(asking), children: t("Take out") })] })] })), asking?.kind === "library" && (_jsxs(Confirm, { title: t("Take {path} off this computer?", { path: asking.name }), onClose: () => setAsking(undefined), children: [_jsx("p", { children: t("No campaign searches it any more, and the text RPG Engine read of its books is deleted. The books stay where they are.") }), _jsxs("div", { class: "confirm-buttons", children: [_jsx("button", { type: "button", class: "button", autoFocus: true, onClick: () => setAsking(undefined), children: t("Cancel") }), _jsx("button", { type: "button", class: "button danger final", onClick: () => confirmed(asking), children: t("Take off") })] })] })), asking?.kind === "uninstall" && (_jsxs(Confirm, { title: t("Uninstall {name} from this computer?", { name: asking.name }), onClose: () => setAsking(undefined), children: [uninstallText(asking.what), _jsxs("div", { class: "confirm-buttons", children: [_jsx("button", { type: "button", class: "button", autoFocus: true, onClick: () => setAsking(undefined), children: t("Cancel") }), _jsx("button", { type: "button", class: "button danger final", onClick: () => confirmed(asking), children: t("Uninstall") })] })] }))] }));
224
237
  }
225
238
  /** On the Installed tab, what asks for the player: the updates npm has, with their count, and a mark when the campaign lists what this computer lacks. */
226
239
  function TabMarks({ updates, missing }) {
@@ -240,6 +253,7 @@ function rowKeys(view) {
240
253
  ...(view.systems ?? []).map((one) => `system:${one.name}`),
241
254
  ...(view.adventures ?? []).map((one) => `adventure:${one.title}`),
242
255
  ...view.installed.map((one) => `extension:${one.package}`),
256
+ ...(view.themes ?? []).map((one) => `theme:${one.id}`),
243
257
  ...(view.languages ?? []).map((one) => `language:${one.code}`),
244
258
  ];
245
259
  }
@@ -253,7 +267,13 @@ function tabOf(at) {
253
267
  return at === "add" || at.startsWith("catalog:") ? "add" : at === "library" || at.startsWith("library:") ? "library" : "installed";
254
268
  }
255
269
  // The card of each kind among the installed, by its heading's id.
256
- const cardOf = { system: "packages-systems", adventure: "packages-adventures", extension: "packages-extensions", language: "packages-languages" };
270
+ const cardOf = {
271
+ system: "packages-systems",
272
+ adventure: "packages-adventures",
273
+ extension: "packages-extensions",
274
+ theme: "packages-themes",
275
+ language: "packages-languages",
276
+ };
257
277
  /** How many extensions the campaign uses, those this computer lacks among them. */
258
278
  function usedCount(view) {
259
279
  return view.installed.filter((one) => !("broken" in one) && one.used).length + view.missing.length;
@@ -266,6 +286,7 @@ function workPlace(work, view, catalog) {
266
286
  const adventure = view.adventures?.find((one) => same(one.title));
267
287
  const system = view.systems?.find((one) => same(one.name, one.package));
268
288
  const language = view.languages?.find((one) => same(one.code, one.package));
289
+ const theme = view.themes?.find((one) => same(one.id, one.name));
269
290
  const entry = catalog?.entries.find((one) => same(one.source));
270
291
  if (work.action === "library" || work.action === "engine") {
271
292
  return work.action;
@@ -281,7 +302,9 @@ function workPlace(work, view, catalog) {
281
302
  ? `system:${system.name}`
282
303
  : language !== undefined
283
304
  ? `language:${language.code}`
284
- : entry !== undefined
285
- ? `catalog:${entry.source}`
286
- : "add";
305
+ : theme !== undefined
306
+ ? `theme:${theme.id}`
307
+ : entry !== undefined
308
+ ? `catalog:${entry.source}`
309
+ : "add";
287
310
  }
@@ -47,7 +47,9 @@ export function WorkNote({ work, whose }) {
47
47
  if (work.phase === "yes") {
48
48
  return (_jsxs("div", { class: "package-window", role: "status", children: [_jsx(Icon, { name: "window" }), _jsxs("span", { children: [named, _jsx("strong", { children: t("Answer in the window of your computer.") }), " ", work.action === "library"
49
49
  ? t("It asks whether RPG Engine may read the documents of that folder. Can't see it? It is behind the browser.")
50
- : t("It asks whether code that RPG Engine did not publish may run here. Can't see it? It is behind the browser.")] })] }));
50
+ : work.action === "engine"
51
+ ? t("It asks whether to update RPG Engine on this computer. Can't see it? It is behind the browser.")
52
+ : t("It asks whether code that RPG Engine did not publish may run here. Can't see it? It is behind the browser.")] })] }));
51
53
  }
52
54
  return (_jsxs("div", { class: "package-progress", role: "status", children: [_jsx("span", { class: "package-bar", "aria-hidden": "true" }), _jsxs("span", { children: [named, _jsx("strong", { children: workingText(work.action) }), " ", t("You can go to another page: it goes on by itself.")] })] }));
53
55
  }
@@ -92,9 +92,12 @@ const iconPaths = {
92
92
  // The Packages page (D-486): a file to add, the catalog's search, a language, the window of the computer where the yes is given, more rows.
93
93
  file: "M6 3h8l4 4v14H6Z M14 3v4h4 M9 13h6 M9 16.5h6",
94
94
  folder: "M3 5h6.5l2 2.5H21V20H3Z",
95
+ picture: "M3.5 5h17v14h-17Z M3.5 16l5-5 4.5 4.5 3-3 4.5 4.5 M15.5 7a1.5 1.5 0 1 0 0 3a1.5 1.5 0 1 0 0-3Z",
95
96
  library: "M4 6h3.5v14.5H4Z M9 3.5h3.5v17H9Z M9 7.5h3.5 M16.5 20.5l3.3-.9-3.4-12.5-3.3.9Z",
96
97
  search: "M10.5 4a6.5 6.5 0 1 0 0 13a6.5 6.5 0 1 0 0-13Z M15.5 15.5 20 20",
97
98
  language: "M4 5h9 M8.5 3v2 M6 5c.5 3 2.8 5.5 6 7 M11 5c-.6 3-2.5 5.6-5.5 7.3 M12.5 21l4-9 4 9 M14 17.5h5",
99
+ // A painter's palette: a theme, the page's colours and faces (D-574).
100
+ theme: "M12 3a9 9 0 1 0 0 18c1 0 1.7-.8 1.7-1.7 0-.4-.2-.8-.4-1.1-.3-.3-.4-.7-.4-1.1 0-.9.8-1.7 1.7-1.7h2.1a5.3 5.3 0 0 0 5.3-5.3C22 6.6 17.5 3 12 3Z M7.5 12h.01 M9 8h.01 M13.5 7h.01 M17 10h.01",
98
101
  window: "M3 5h18v14H3Z M3 9h18 M6 7h.01 M8.5 7h.01",
99
102
  more: "M6 9l6 6 6-6",
100
103
  // A thing in a list of bonds, as attuned: two rings linked.
@@ -0,0 +1,89 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
2
+ import { useRef, useState } from "preact/hooks";
3
+ import { givePicture } from "../api.js";
4
+ import { t } from "../text.js";
5
+ import { Icon } from "./icons.js";
6
+ // What the game takes, as image takes it: the browser's chooser shows these first.
7
+ const pictureTypes = "image/png,image/jpeg,image/webp,image/svg+xml";
8
+ // How long a picture stays darkened, at most, waiting for the new one to reach the page.
9
+ const longestWait = 8000;
10
+ /** A page's picture as a coin, with the control that gives it one of the player's own on its rim, across from the pip of its side. */
11
+ export function PictureSpot({ page, has = true, children, class: extra }) {
12
+ return (_jsxs("span", { class: extra === undefined ? "picture-spot" : `picture-spot ${extra}`, children: [children, _jsx(PictureButton, { page: page, has: has, icon: true, rim: true })] }));
13
+ }
14
+ /**
15
+ * The control that gives `page` a picture of the player's own: "Change the picture…", or "Add a picture…" while it shows none; as words, or as an icon over a
16
+ * picture's corner, its tip towards the picture's start, or on a coin's rim, its tip over it. In a list's row it is on its thumb's rim, no stop of Tab, and no
17
+ * button on touch, as the page it opens has one.
18
+ */
19
+ export function PictureButton({ page, has, icon = false, rim = false, row = false }) {
20
+ const own = useRef(null);
21
+ const input = useRef(null);
22
+ const [sending, setSending] = useState(false);
23
+ const [problem, setProblem] = useState();
24
+ const [said, setSaid] = useState("");
25
+ const words = has ? t("Change the picture…") : t("Add a picture…");
26
+ const named = has ? t("Change the picture: {page}", { page }) : t("Add a picture: {page}", { page });
27
+ const send = async (file) => {
28
+ if (file === undefined) {
29
+ return;
30
+ }
31
+ const host = own.current?.parentElement ?? null;
32
+ const before = shownPicture(host);
33
+ setSending(true);
34
+ setProblem(undefined);
35
+ setSaid("");
36
+ const refused = await givePicture(page, file);
37
+ if (input.current !== null) {
38
+ input.current.value = "";
39
+ }
40
+ if (refused !== undefined) {
41
+ setSending(false);
42
+ setProblem(refused);
43
+ return;
44
+ }
45
+ setSaid(t("{page} has your picture now.", { page }));
46
+ // Over a picture, it stays darkened until the new one is on the page, and clears into it.
47
+ if (icon && host !== null) {
48
+ await newPicture(host, before);
49
+ }
50
+ setSending(false);
51
+ };
52
+ const choose = (event) => {
53
+ // Over a picture that opens something, the click is the control's alone.
54
+ event.preventDefault();
55
+ event.stopPropagation();
56
+ if (!sending) {
57
+ input.current?.click();
58
+ }
59
+ };
60
+ const classes = ["picture-give", icon ? "icon" : "", sending ? "sending" : "", problem === undefined ? "" : "refused"].filter((name) => name !== "");
61
+ return (_jsxs("span", { ref: own, class: classes.join(" "), children: [_jsx("input", { ref: input, type: "file", accept: pictureTypes, hidden: true, tabIndex: -1, onChange: (event) => void send(event.currentTarget.files?.[0]) }), _jsxs("button", { type: "button", class: icon ? (rim || row ? "icon-button" : "icon-button tip-left") : "button package-button", "aria-label": named, "data-tip": icon ? (sending ? t("Sending…") : words) : undefined, "aria-busy": sending, "aria-disabled": sending ? "true" : undefined, tabIndex: row ? -1 : undefined, onClick: choose, children: [icon ? _jsx("span", { class: "picture-plate", children: sending ? _jsx(Waiting, {}) : _jsx(Icon, { name: "picture" }) }) : sending ? _jsx(Waiting, {}) : _jsx(Icon, { name: "picture" }), !icon && (sending ? t("Sending…") : words)] }), problem !== undefined && _jsx("span", { class: "picture-problem", role: "alert", children: problem }), _jsx("span", { class: "visually-hidden", role: "status", children: said })] }));
62
+ }
63
+ /** The ring that turns while the picture is sent, in place of the icon. */
64
+ function Waiting() {
65
+ return _jsx("span", { class: "picture-wait", "aria-hidden": "true" });
66
+ }
67
+ /** The address of the picture a host shows now, or "" for none. */
68
+ function shownPicture(host) {
69
+ return host?.querySelector("img")?.src ?? "";
70
+ }
71
+ /** Settles once the host shows a picture other than `before`, loaded, or after the longest wait, if the page does not change. */
72
+ function newPicture(host, before) {
73
+ return new Promise((resolve) => {
74
+ const done = () => {
75
+ watch.disconnect();
76
+ clearTimeout(timer);
77
+ resolve();
78
+ };
79
+ const watch = new MutationObserver(() => {
80
+ const image = host.querySelector("img");
81
+ if (image !== null && image.src !== before) {
82
+ watch.disconnect();
83
+ void image.decode().catch(() => undefined).then(done);
84
+ }
85
+ });
86
+ const timer = setTimeout(done, longestWait);
87
+ watch.observe(host, { subtree: true, childList: true, attributes: true, attributeFilter: ["src"] });
88
+ });
89
+ }
@@ -24,7 +24,9 @@ const phrases = {
24
24
  "system-taken": (values) => t("There is already a game system called {system} on this computer: {name} would take its name.", values),
25
25
  "system-unread": (values) => t("{name} was installed, but it does not read as a game system: uninstall it.", values),
26
26
  "language-code": (values) => t("{name} says it is a language, but brings code: a language is texts only.", values),
27
- "language-refused": (values) => t("{name} cannot be used, and was taken off this computer: {why}", values),
27
+ // npm's language taken off again, or one of data alone never written: either way, it is not on this computer.
28
+ "language-refused": (values) => t("{name} cannot be used, and is not on this computer: {why}", values),
29
+ "theme-refused": (values) => t("{name} is no theme the page can use: {why}", values),
28
30
  "language-kept": (values) => t("{name} cannot be used, and version {version} stays: {why}", values),
29
31
  "not-used": (values) => t("This campaign does not use {name}.", values),
30
32
  "system-played": (values) => t("This campaign plays {name}: it stays on this computer.", values),
@@ -45,6 +47,7 @@ const phrases = {
45
47
  "archive-link": (values) => t("{name} holds {entry}, which is not a plain file: it is refused whole.", values),
46
48
  "archive-accents": (values) => t("{name} names files with accents in another encoding: make the zip again with 7-Zip.", values),
47
49
  "not-adventure": (values) => t("{name} is not an adventure: it has no adventure.yaml at its top. A document is imported by the master.", values),
50
+ "not-package": (values) => t("{name} is no package: it has no adventure.yaml, theme.yaml or language.yaml at its top. A document is imported by the master.", values),
48
51
  "adventure-file": (values) => t("{name} holds {file}, which an adventure may not hold: it is refused whole.", values),
49
52
  "not-a-name": (values) => t("{name} is not the name of an npm package.", values),
50
53
  "folder-characters": (values) => t("The folder {name} has characters npm cannot take: move it to another path.", values),
@@ -62,4 +65,8 @@ const phrases = {
62
65
  "scene-open": () => t("It can be put back once the scene being played is over."),
63
66
  "file-big": (values) => t("The file is more than {size} MB: no package is that big.", values),
64
67
  "file-kind": (values) => t("{name} is neither a .zip nor a .tgz.", values),
68
+ "picture-big": (values) => t("The picture is more than {size} MB: make it smaller.", values),
69
+ "not-picture": (values) => t("{name} is not a PNG, JPEG, WebP or SVG picture.", values),
70
+ "no-page": (values) => t("Your character knows no page called {page}: reload the page.", values),
71
+ "system-page": (values) => t("{page} comes from the game system, with its own picture.", values),
65
72
  };
@@ -74,10 +74,11 @@ function Items({ items, field, fields }) {
74
74
  /** Someone's effects as tags, each with its end; past `most`, how many more. */
75
75
  export function Effects({ effects, most }) {
76
76
  const shown = most === undefined ? effects : effects.slice(0, most);
77
+ const others = effects.slice(shown.length).map((effect) => effectLabel(effect)).join(", ");
77
78
  // Where few fit (`most`), one with a drawing is its icon alone, its words in its tooltip and for a screen reader (D-516); else its icon before its words.
78
79
  return effects.length === 0 ? null : (_jsxs("span", { class: "effects", children: [shown.map((effect) => effect.icon !== undefined && most !== undefined
79
80
  ? (_jsx("span", { class: "effect icon-only", role: "img", "aria-label": effectLabel(effect), "data-tip": effectLabel(effect), children: _jsx(EffectIcon, { path: effect.icon }) }, effect.text))
80
- : (_jsxs("span", { class: effect.icon === undefined ? "effect" : "effect with-icon", title: effectLabel(effect), children: [effect.icon !== undefined && _jsx(EffectIcon, { path: effect.icon }), effectName(effect.name), effect.end && most === undefined ? _jsx("span", { class: "end", children: `· ${effectEndLabel(effect.end)}` }) : null, effect.burns && most === undefined ? _jsx("span", { class: "end", children: `· ${burnsLabel(effect.name, effect.burns)}` }) : null] }, effect.text))), effects.length > shown.length && _jsx("span", { class: "effect more", dir: "ltr", "data-tip": effects.slice(shown.length).map((effect) => effectLabel(effect)).join(", "), children: `+${numberText(effects.length - shown.length)}` })] }));
81
+ : (_jsxs("span", { class: effect.icon === undefined ? "effect" : "effect with-icon", title: effectLabel(effect), children: [effect.icon !== undefined && _jsx(EffectIcon, { path: effect.icon }), effectName(effect.name), effect.end && most === undefined ? _jsx("span", { class: "end", children: `· ${effectEndLabel(effect.end)}` }) : null, effect.burns && most === undefined ? _jsx("span", { class: "end", children: `· ${burnsLabel(effect.name, effect.burns)}` }) : null] }, effect.text))), effects.length > shown.length && _jsx("span", { class: "effect more", dir: "ltr", role: "img", "aria-label": others, "data-tip": others, children: `+${numberText(effects.length - shown.length)}` })] }));
81
82
  }
82
83
  /** The drawing of an effect, a path on a grid of 24 stroked as the page's icons. */
83
84
  function EffectIcon({ path }) {
@@ -1,6 +1,4 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime";
2
- // The Scene section (D-309, VIEW-6, D-444): where the party is, its picture with the places around it, its name, what holds there and its text; the open
3
- // scene and who is in it; outside a scene who is there of those the character knows; the map. While the scene goes by turns, the turns first.
4
2
  import { useContext, useEffect, useRef, useState } from "preact/hooks";
5
3
  import { TalkName } from "../acts/names.js";
6
4
  import { sectionAddress } from "../address.js";
@@ -10,6 +8,7 @@ import { cardIcons, Icon } from "../parts/icons.js";
10
8
  import { phraseLabel, sceneTypeLabel, strangerLabel } from "../parts/labels.js";
11
9
  import { biomeLabel, biomes } from "../parts/map-symbols.js";
12
10
  import { InlineText, knowersOf, Markdown } from "../parts/markdown.js";
11
+ import { PictureButton, PictureSpot } from "../parts/picture.js";
13
12
  import { downTint, personState, StatusPip } from "../parts/status.js";
14
13
  import { PlaceMap } from "../place/view.js";
15
14
  import { sideOf, Token } from "../sheet/party.js";
@@ -108,8 +107,8 @@ function PlaceBand({ place, fold }) {
108
107
  const link = placeLinks(place);
109
108
  const caption = (_jsxs("div", { class: "place-caption", children: [place.within.length > 0 && (_jsx("ol", { class: "place-path", "aria-label": t("Within"), children: place.within.map((name) => _jsx("li", { children: name }, name)) })), _jsx("h2", { id: "place-name", children: place.name }), place.around.length > 0 && (_jsx("ul", { class: "place-env", "aria-label": t("Around"), children: place.around.map((item) => _jsx(Surrounding, { item: item, name: place.name, link: link }, `${"effect" in item ? item.effect : item.name} ${item.place ?? ""}`)) })), fold && text !== "" && _jsx(DescriptionToggle, { open: fold.open, controls: "place-band-text", onToggle: fold.onToggle })] }));
110
109
  return place.image === undefined
111
- ? (_jsxs("header", { class: "place-band compact", children: [_jsxs("div", { class: "place-shot", children: [_jsx("div", { class: "place-disc", children: _jsx(Icon, { name: "house" }) }), caption] }), text !== "" && _jsx(PlaceAbout, { text: text, link: link, knowers: knowers })] }))
112
- : (_jsxs("header", { class: fold === undefined ? "place-band over" : `place-band over folding${fold.open ? "" : " low"}`, children: [_jsxs("div", { class: "place-shot", children: [_jsx("figure", { class: "place-image", children: _jsx("img", { src: `/images/${encodeURIComponent(place.image.file)}?v=${place.image.version}`, alt: "" }) }), caption] }), fold === undefined && text !== "" && _jsx(PlaceAbout, { text: text, link: link, knowers: knowers }), fold?.open === true && text !== "" && (_jsx("div", { class: "place-about", id: "place-band-text", children: _jsx("div", { class: "place-about-text", children: _jsx(Markdown, { text: text, link: link, secretKnowers: knowers }) }) }))] }));
110
+ ? (_jsxs("header", { class: "place-band compact", children: [_jsxs("div", { class: "place-shot", children: [_jsx(PictureSpot, { page: place.name, has: false, class: "place-disc-spot", children: _jsx("div", { class: "place-disc", children: _jsx(Icon, { name: "house" }) }) }), caption] }), text !== "" && _jsx(PlaceAbout, { text: text, link: link, knowers: knowers })] }))
111
+ : (_jsxs("header", { class: fold === undefined ? "place-band over" : `place-band over folding${fold.open ? "" : " low"}`, children: [_jsxs("div", { class: "place-shot picture-host", children: [_jsx("figure", { class: "place-image", children: _jsx("img", { src: `/images/${encodeURIComponent(place.image.file)}?v=${place.image.version}`, alt: "" }) }), caption, _jsx(PictureButton, { page: place.name, has: true, icon: true })] }), fold === undefined && text !== "" && _jsx(PlaceAbout, { text: text, link: link, knowers: knowers }), fold?.open === true && text !== "" && (_jsx("div", { class: "place-about", id: "place-band-text", children: _jsx("div", { class: "place-about-text", children: _jsx(Markdown, { text: text, link: link, secretKnowers: knowers }) }) }))] }));
113
112
  }
114
113
  /**
115
114
  * One thing that holds there: an entry of the environment as its name and value, as light dim, the biome and the terrain the engine reads in the page's language;
@@ -157,7 +156,7 @@ function People({ people }) {
157
156
  };
158
157
  return (_jsx("ul", { class: "present", children: people.map((person, index) => (_jsxs("li", { class: person.role === "other" && index > 0 && people[index - 1].role !== "other" ? "after-party" : undefined, children: [person.stranger && person.image === undefined
159
158
  ? (_jsxs("span", { class: ["token stranger", letterOf(person.name) === undefined ? "" : "numbered", person.hostile === true ? "hostile" : ""].filter((name) => name !== "").join(" "), "aria-hidden": "true", children: [letterOf(person.name) ?? _jsx(Icon, { name: "stranger" }), _jsx(StatusPip, { status: { ...person, party: false } })] }))
160
- : (_jsx(Token, { member: { name: person.name, role: person.role, ...(person.image === undefined ? {} : { image: person.image }), ...(person.icon === undefined ? {} : { icon: person.icon }) }, hostile: person.hostile === true, side: sideOf(person.role), status: statusOf(person), dying: downTint(statusOf(person)), number: person.stranger ? letterOf(person.name) : undefined })), person.role === "pc"
159
+ : (_jsx(PersonPicture, { person: person, children: _jsx(Token, { member: { name: person.name, role: person.role, ...(person.image === undefined ? {} : { image: person.image }), ...(person.icon === undefined ? {} : { icon: person.icon }) }, hostile: person.hostile === true, side: sideOf(person.role), status: statusOf(person), dying: downTint(statusOf(person)), number: person.stranger ? letterOf(person.name) : undefined }) })), person.role === "pc"
161
160
  ? _jsx(PersonName, { person: person })
162
161
  : (_jsx(TalkName, { name: person.stranger ? strangerLabel(person.name) : person.name, children: _jsx(PersonName, { person: person }) }))] }, `${person.name} ${index}`))) }));
163
162
  }
@@ -169,3 +168,7 @@ function PersonName({ person }) {
169
168
  function letterOf(name) {
170
169
  return /^creature ([A-Z])$/.exec(name)?.[1];
171
170
  }
171
+ /** Someone's token with the control for a picture of the player's own, but a stranger's: what stands for them is no page the player sees. */
172
+ function PersonPicture({ person, children }) {
173
+ return person.stranger === true ? _jsx(_Fragment, { children: children }) : _jsx(PictureSpot, { page: person.name, has: person.image !== undefined, children: children });
174
+ }
@@ -9,7 +9,7 @@ import { DieSwatch, Icon } from "../parts/icons.js";
9
9
  import { customLabel, itemLabel, leveledItemLabel, phraseLabel, rateParts, settingLabel, valueLabel } from "../parts/labels.js";
10
10
  import { PageHead } from "../shell/pages.js";
11
11
  import { byHandPref, conditionsPref, readChoice, soundPref, tokenSymbolsPref, useChoice, usePref, usePrefChange, writeChoice } from "../shell/prefs.js";
12
- import { applyGameStyle, gameStyle, systemStylePref } from "../shell/system-style.js";
12
+ import { applyGameStyle, gameStyle, installedStyle, systemStylePref } from "../shell/system-style.js";
13
13
  import { pickTheme, shownTheme } from "../shell/theme.js";
14
14
  import { arrowStep, t } from "../text.js";
15
15
  import { LanguageChoice, languageLine } from "./language-choice.js";
@@ -307,7 +307,7 @@ function TextSetting({ setting, label, onChange }) {
307
307
  }
308
308
  /** What the player should know of a setting on this computer, as how to have pictures: its lines, its steps in order, the commands to copy, and a line after. */
309
309
  function SettingNote({ note }) {
310
- const blocks = [...noteBlocks(t(note.text, note.values)), ...(note.also === undefined ? [] : [t(note.also, note.values)])];
310
+ const blocks = [...noteBlocks(t(note.text, note.values)), ...(note.also ?? []).map((line) => t(line, note.values))];
311
311
  return (_jsxs("div", { class: note.fix ? "setting-note fix" : "setting-note", children: [_jsx(Icon, { name: "info" }), _jsx("div", { class: "setting-note-text", children: blocks.map((block, index) => typeof block === "string" ? _jsx("p", { children: withCommands(block) }, index) : (_jsx("ol", { children: block.map((step) => _jsx("li", { children: withCommands(step) }, step)) }, index))) })] }));
312
312
  }
313
313
  /** A note's lines, those numbered as steps together. */
@@ -348,30 +348,40 @@ export function Command({ text }) {
348
348
  return (_jsxs("span", { class: "setting-command", children: [_jsx("code", { children: text.split(" ").flatMap((word, index) => [index === 0 ? "" : " ", _jsx("span", { class: "command-word", children: word }, index)]) }), _jsx("button", { type: "button", class: "setting-copy", "aria-label": t("Copy {command}", { command: text }), onClick: () => void copy(), children: copied ? t("Copied") : t("Copy") })] }));
349
349
  }
350
350
  /**
351
- * Under the theme, the game's style, when the campaign's system has one, a theme or a page style (D-528): its own or the page's, kept in this browser for that
352
- * system; the page's alone when its theme does not pass the check of legibility.
351
+ * Under the theme, the game's style, when the campaign's system has one, a theme or a page style (D-528), or this computer has themes installed (D-574): the
352
+ * game's, each installed theme by its name, or the page's, kept in this browser for that system; the game's left out when its theme does not pass the check
353
+ * of legibility, which the page's then says.
353
354
  */
354
355
  function gameStyleRows() {
355
356
  const style = gameStyle();
356
- if (style.system === undefined || (!style.shows && !style.refused)) {
357
+ const installed = style.themes.length > 0;
358
+ if (style.system === undefined || (!style.shows && !style.refused && !installed)) {
357
359
  return [];
358
360
  }
359
361
  const choice = systemStylePref(style.system);
360
- const name = t("Game style");
361
- if (!style.shows) {
362
- const means = t("This game's style does not pass the page's check of legibility: the page keeps its own.");
363
- return [{ key: "game-style", name, about: t("the colours, faces and pictures of the game system"), options: [{ value: "page", label: t("The page's"), means }], value: "page", pick: () => undefined }];
364
- }
362
+ const refusedMeans = style.refused && !style.shows ? { means: t("This game's style does not pass the page's check of legibility: the page keeps its own.") } : {};
363
+ const about = !installed
364
+ ? style.name === undefined ? t("the colours, faces and pictures of the game system") : t("the colours, faces and pictures of {name}, from the game system", { name: style.name })
365
+ : style.shows
366
+ ? t("the colours, faces and pictures: the game system's, a theme you installed, or the page's own")
367
+ : t("the colours, faces and pictures: a theme you installed, or the page's own");
368
+ const options = [
369
+ ...(style.shows ? [{ value: "game", label: t("The game's") }] : []),
370
+ ...style.themes.map((one) => ({ value: installedStyle(one.id), label: one.name })),
371
+ { value: "page", label: t("The page's"), ...refusedMeans },
372
+ ];
365
373
  return [{
366
374
  key: "game-style",
367
- name,
368
- about: style.name === undefined ? t("the colours, faces and pictures of the game system") : t("the colours, faces and pictures of {name}, from the game system", { name: style.name }),
369
- options: [{ value: "game", label: t("The game's") }, { value: "page", label: t("The page's") }],
375
+ name: t("Game style"),
376
+ about,
377
+ options,
370
378
  value: readChoice(choice),
371
379
  pick: (value) => {
372
380
  writeChoice(choice, value);
373
381
  applyGameStyle();
374
382
  },
383
+ // The names of the installed themes go under the row's, with room for them.
384
+ ...(installed ? { under: true } : {}),
375
385
  }];
376
386
  }
377
387
  /** A name as a part of an element's id, without spaces: "dice sound" is dice-sound. */
@@ -38,9 +38,12 @@ export function PartyStrip({ party, chosen, scene, waiting = new Map() }) {
38
38
  : counter && _jsx(Bar, { value: counter, label: fieldLabel(counter.field) }), _jsx(Effects, { effects: besideWord(member.effects, status.person), most: 2 })] }, member.name));
39
39
  }) }));
40
40
  }
41
- /** A party member's token with the pip of their state (D-419), in the strip and the sheet's band; never in the rolls. Their class in its tooltip (D-409). */
41
+ /**
42
+ * A party member's token with the pip of their state (D-419), in the strip and the sheet's band; never in the rolls. Their class in its tooltip in the strip
43
+ * (D-409); none on the sheet's band, large, which writes name and class beside it and has the picture's control on its rim.
44
+ */
42
45
  export function MemberToken({ member, large, status, choices }) {
43
- return (_jsxs("span", { class: "token-holder", "data-tip": member.headline === undefined ? undefined : `${member.name} · ${member.headline}`, children: [_jsx(Token, { member: member, large: large, side: sideOf(member.role), status: status, dying: downTint(status) }), choices === true && (_jsx("span", { class: "choices-pip", "aria-hidden": "true", children: _jsx(Icon, { name: "up" }) }))] }));
46
+ return (_jsxs("span", { class: "token-holder", "data-tip": member.headline === undefined || large === true ? undefined : `${member.name} · ${member.headline}`, children: [_jsx(Token, { member: member, large: large, side: sideOf(member.role), status: status, dying: downTint(status) }), choices === true && (_jsx("span", { class: "choices-pip", "aria-hidden": "true", children: _jsx(Icon, { name: "up" }) }))] }));
44
47
  }
45
48
  /** The side of one of the party by their role; anyone else has none. */
46
49
  export function sideOf(role) {
@@ -12,6 +12,7 @@ import { fieldLabel, groupLabels, itemLabel, phraseLabel, readableIds, rollLabel
12
12
  import { arrangedGroups, groupLayout, orderedValues, widgetOf } from "../parts/layout.js";
13
13
  import { knowersOf, Markdown, plainLine } from "../parts/markdown.js";
14
14
  import { MoodFace, moodLabel } from "../parts/mood.js";
15
+ import { PictureSpot } from "../parts/picture.js";
15
16
  import { besideWord, memberStatus } from "../parts/status.js";
16
17
  import { Effects, ProgressBar, ValueDrawing } from "../parts/widgets.js";
17
18
  import { ChoicesNotice } from "../play/choices.js";
@@ -37,7 +38,7 @@ export function MemberSheet({ member, headline, layered, sheet, cards, text, kno
37
38
  const shownApart = personFields([...person, ...boxes]);
38
39
  // The player character's story has its own card: the rest of the page's text is its description (D-386).
39
40
  const described = story !== undefined && story.trim() !== "" && text.startsWith(story) ? text.slice(story.length).trimStart() : text;
40
- return (_jsxs("section", { class: "sheet", "aria-label": member.name, children: [_jsxs("header", { class: "band", children: [_jsxs("div", { class: "identity", children: [_jsx(MemberToken, { member: member, large: true, status: status }), _jsxs("div", { class: "who", children: [_jsx("h2", { children: member.name }), (headline !== undefined && headline !== "") || member.mood !== undefined
41
+ return (_jsxs("section", { class: "sheet", "aria-label": member.name, children: [_jsxs("header", { class: "band", children: [_jsxs("div", { class: "identity", children: [_jsx(PictureSpot, { page: member.name, has: member.image !== undefined, children: _jsx(MemberToken, { member: member, large: true, status: status }) }), _jsxs("div", { class: "who", children: [_jsx("h2", { children: member.name }), (headline !== undefined && headline !== "") || member.mood !== undefined
41
42
  ? (_jsxs("p", { class: "headline", children: [headline, headline !== undefined && headline !== "" && member.mood !== undefined && " · ", member.mood !== undefined && (_jsxs("span", { class: "mood-word", children: [_jsx(MoodFace, { mood: member.mood }), moodLabel(member.mood)] }))] }))
42
43
  : null, member.place && (_jsxs("p", { class: "place", children: [_jsx(Icon, { name: "place" }), memberPlaceLabel(member.place)] })), layered === true && _jsx(ChangedLine, {})] })] }), choices.map((set) => _jsx(ChoicesNotice, { set: set }, set.id)), person.map((shown) => _jsx(PersonPanel, { shown: shown }, shown.widget.id)), _jsx(ValueLine, { values: member.counters.filter((value) => !shownApart.has(value.field)), fields: fields, boxes: boxes }), _jsx(Effects, { effects: besideWord(member.effects, status.person) })] }), _jsxs("div", { class: "sheet-body", children: [rail.length > 0 && _jsx("div", { class: "rail", children: rail.map(group) }), _jsxs("div", { class: "sheet-main", children: [_jsx(FixedColumns, { cards: others.map((shown) => ({ key: shown.name, node: group(shown) })) }), _jsxs("div", { class: "wide-cards", children: [story !== undefined && (_jsxs(Card, { name: backstoryCard, title: t("Backstory"), icon: cardIcons.backstory, layout: "lore", preview: plainLine(story) ?? t("Not written yet"), children: [story.trim() !== "" && _jsx(Markdown, { text: story }), _jsx(StoryBox, { story: story, who: member.name })] })), described.trim() !== "" && (_jsx(Card, { name: descriptionCard, title: t("Description"), icon: cardIcons.description, layout: "lore", preview: plainLine(described), children: _jsx(Markdown, { text: described, secretKnowers: knowersOf(knownBy) }) }))] }), _jsx(WidgetCards, { place: "page", page: "sheet", who: member.name, view: member })] })] })] }));
43
44
  }
@@ -1,11 +1,11 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "preact/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime";
2
2
  import { Icon } from "../parts/icons.js";
3
3
  import { languageName } from "../settings/languages.js";
4
4
  import { pageLocale, pageTranslation, t } from "../text.js";
5
5
  export function Notices({ notices }) {
6
6
  return notices.length === 0 ? null : (_jsx("div", { class: "notices", children: notices.map((notice) => {
7
7
  // The role on the words alone, always the same node: a count beside them is read where it is, never heard at each step.
8
- return (_jsxs("p", { class: `notice ${notice.kind}`, children: [_jsx(Icon, { name: notice.kind === "info" ? "info" : "alert" }), _jsx("span", { role: notice.kind === "problem" ? "alert" : "status", children: notice.text }), notice.count !== undefined && (_jsxs(_Fragment, { children: [_jsx("span", { class: "count", dir: "ltr", children: `${notice.count.done}/${notice.count.of}` }), _jsx("span", { class: "bar", "aria-hidden": "true", style: { "--done": `${Math.round((100 * notice.count.done) / Math.max(notice.count.of, 1))}%` } })] }))] }, notice.key ?? notice.text));
8
+ return (_jsxs("p", { class: `notice ${notice.kind}`, children: [_jsx(Icon, { name: notice.kind === "info" ? "info" : "alert" }), _jsxs("span", { class: "notice-words", children: [_jsx("span", { role: notice.kind === "problem" ? "alert" : "status", children: notice.text }), notice.link !== undefined && _jsx("a", { class: "notice-link", href: notice.link.href, children: notice.link.text })] }), notice.count !== undefined && (_jsxs(_Fragment, { children: [_jsx("span", { class: "count", dir: "ltr", children: `${notice.count.done}/${notice.count.of}` }), _jsx("span", { class: "bar", "aria-hidden": "true", style: { "--done": `${Math.round((100 * notice.count.done) / Math.max(notice.count.of, 1))}%` } })] })), notice.hide !== undefined && (_jsx("button", { type: "button", class: "icon-button notice-hide tip-left", "aria-label": notice.hide.label, "data-tip": notice.hide.label, onClick: notice.hide.onHide, children: _jsx(Icon, { name: "close" }) }))] }, notice.key ?? notice.text));
9
9
  }) }));
10
10
  }
11
11
  /** What the page says of an import under way (D-491 (11)): what it is doing, and how far; nothing without one. */