rpg-engine 0.15.0 → 0.17.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 (503) hide show
  1. package/dist/adventures/source.d.ts +3 -1
  2. package/dist/adventures/source.js +31 -1
  3. package/dist/campaign/find-campaign.js +8 -4
  4. package/dist/campaign/index.d.ts +1 -1
  5. package/dist/campaign/index.js +1 -1
  6. package/dist/campaign/settings.d.ts +6 -0
  7. package/dist/campaign/settings.js +22 -1
  8. package/dist/cli/cli.js +1 -1
  9. package/dist/cli/command-line.js +1 -1
  10. package/dist/commands/advance.d.ts +1 -1
  11. package/dist/commands/advance.js +6 -6
  12. package/dist/commands/ask.js +7 -7
  13. package/dist/commands/change/amounts.d.ts +32 -0
  14. package/dist/commands/change/amounts.js +150 -0
  15. package/dist/commands/change/change.d.ts +4 -54
  16. package/dist/commands/change/change.js +19 -749
  17. package/dist/commands/change/damage.d.ts +30 -0
  18. package/dist/commands/change/damage.js +73 -2
  19. package/dist/commands/change/dice.d.ts +34 -0
  20. package/dist/commands/change/dice.js +59 -0
  21. package/dist/commands/change/fields.d.ts +37 -0
  22. package/dist/commands/change/fields.js +156 -0
  23. package/dist/commands/change/holder.d.ts +48 -0
  24. package/dist/commands/change/holder.js +162 -0
  25. package/dist/commands/change/recipe-pace.js +1 -1
  26. package/dist/commands/change/recipe.d.ts +58 -0
  27. package/dist/commands/change/recipe.js +179 -0
  28. package/dist/commands/choices.js +3 -3
  29. package/dist/commands/config/config.d.ts +15 -0
  30. package/dist/commands/config/config.js +355 -0
  31. package/dist/commands/config/custom-levels.d.ts +7 -0
  32. package/dist/commands/config/custom-levels.js +32 -0
  33. package/dist/commands/{config.d.ts → config/dashboard.d.ts} +2 -24
  34. package/dist/commands/config/dashboard.js +171 -0
  35. package/dist/commands/config/entries.d.ts +17 -0
  36. package/dist/commands/config/entries.js +76 -0
  37. package/dist/commands/config/news.d.ts +7 -0
  38. package/dist/commands/config/news.js +88 -0
  39. package/dist/commands/config/shown.d.ts +9 -0
  40. package/dist/commands/config/shown.js +80 -0
  41. package/dist/commands/config/words.d.ts +27 -0
  42. package/dist/commands/config/words.js +204 -0
  43. package/dist/commands/effect.js +9 -9
  44. package/dist/commands/find.js +1 -1
  45. package/dist/commands/image.js +6 -6
  46. package/dist/commands/import/import.d.ts +0 -2
  47. package/dist/commands/import/import.js +68 -45
  48. package/dist/commands/import/run.js +1 -1
  49. package/dist/commands/index.js +3 -3
  50. package/dist/commands/init.js +2 -2
  51. package/dist/commands/install.js +1 -1
  52. package/dist/commands/instructions.js +6 -6
  53. package/dist/commands/mode.d.ts +2 -2
  54. package/dist/commands/mode.js +8 -8
  55. package/dist/commands/mood.js +4 -4
  56. package/dist/commands/move.js +10 -10
  57. package/dist/commands/package/consent.d.ts +11 -0
  58. package/dist/commands/package/consent.js +52 -0
  59. package/dist/commands/package/here.d.ts +51 -0
  60. package/dist/commands/package/here.js +128 -0
  61. package/dist/commands/package/install.d.ts +10 -0
  62. package/dist/commands/package/install.js +337 -0
  63. package/dist/commands/package/package.d.ts +18 -0
  64. package/dist/commands/package/package.js +270 -0
  65. package/dist/commands/package/result.d.ts +89 -0
  66. package/dist/commands/package/result.js +1 -0
  67. package/dist/commands/package/uninstall.d.ts +6 -0
  68. package/dist/commands/package/uninstall.js +70 -0
  69. package/dist/commands/rename.js +3 -3
  70. package/dist/commands/reveal.js +5 -5
  71. package/dist/commands/roll/roll.js +11 -9
  72. package/dist/commands/roll/tables.js +1 -1
  73. package/dist/commands/rules.d.ts +2 -2
  74. package/dist/commands/rules.js +3 -3
  75. package/dist/commands/save.d.ts +2 -2
  76. package/dist/commands/save.js +2 -2
  77. package/dist/commands/scene/close.d.ts +18 -0
  78. package/dist/commands/scene/close.js +179 -0
  79. package/dist/commands/scene/members.d.ts +14 -0
  80. package/dist/commands/scene/members.js +32 -0
  81. package/dist/commands/scene/open.d.ts +6 -0
  82. package/dist/commands/scene/open.js +298 -0
  83. package/dist/commands/scene/result.d.ts +98 -0
  84. package/dist/commands/scene/result.js +2 -0
  85. package/dist/commands/{scene.d.ts → scene/scene.d.ts} +10 -36
  86. package/dist/commands/scene/scene.js +210 -0
  87. package/dist/commands/scene/turns.d.ts +18 -0
  88. package/dist/commands/scene/turns.js +229 -0
  89. package/dist/commands/shared/books/adventure-layers.d.ts +89 -0
  90. package/dist/commands/shared/books/adventure-layers.js +201 -0
  91. package/dist/commands/shared/{adventures.d.ts → books/adventures.d.ts} +28 -9
  92. package/dist/commands/shared/{adventures.js → books/adventures.js} +77 -35
  93. package/dist/commands/shared/{library-reader.js → books/library-reader.js} +3 -3
  94. package/dist/commands/shared/{library.d.ts → books/library.d.ts} +2 -2
  95. package/dist/commands/shared/{library.js → books/library.js} +9 -9
  96. package/dist/commands/shared/{rules.d.ts → books/rules.d.ts} +2 -2
  97. package/dist/commands/shared/{rules.js → books/rules.js} +5 -5
  98. package/dist/commands/shared/{system-texts.d.ts → books/system-texts.d.ts} +2 -2
  99. package/dist/commands/shared/{system-texts.js → books/system-texts.js} +9 -8
  100. package/dist/commands/shared/{page-words.d.ts → books/words.d.ts} +2 -2
  101. package/dist/commands/shared/{page-words.js → books/words.js} +4 -4
  102. package/dist/commands/shared/{checks.d.ts → campaign/checks.d.ts} +3 -3
  103. package/dist/commands/shared/{checks.js → campaign/checks.js} +7 -7
  104. package/dist/commands/shared/{images.d.ts → campaign/images.d.ts} +3 -3
  105. package/dist/commands/shared/{images.js → campaign/images.js} +5 -5
  106. package/dist/commands/shared/{mode.d.ts → campaign/mode.d.ts} +4 -4
  107. package/dist/commands/shared/{mode.js → campaign/mode.js} +24 -13
  108. package/dist/commands/shared/{money.d.ts → campaign/money.d.ts} +3 -3
  109. package/dist/commands/shared/{money.js → campaign/money.js} +2 -2
  110. package/dist/commands/shared/{offers.d.ts → campaign/offers.d.ts} +3 -3
  111. package/dist/commands/shared/{offers.js → campaign/offers.js} +3 -3
  112. package/dist/commands/shared/{outside.d.ts → campaign/outside.d.ts} +3 -3
  113. package/dist/commands/shared/{outside.js → campaign/outside.js} +7 -7
  114. package/dist/commands/shared/{parts.d.ts → campaign/parts.d.ts} +3 -3
  115. package/dist/commands/shared/{parts.js → campaign/parts.js} +3 -3
  116. package/dist/commands/shared/{problems.d.ts → campaign/problems.d.ts} +3 -3
  117. package/dist/commands/shared/{problems.js → campaign/problems.js} +17 -17
  118. package/dist/commands/shared/{quests.d.ts → campaign/quests.d.ts} +4 -4
  119. package/dist/commands/shared/{quests.js → campaign/quests.js} +6 -6
  120. package/dist/commands/shared/{saves.d.ts → campaign/saves.d.ts} +4 -4
  121. package/dist/commands/shared/{saves.js → campaign/saves.js} +10 -10
  122. package/dist/commands/shared/{theme.d.ts → campaign/theme.d.ts} +3 -3
  123. package/dist/commands/shared/{theme.js → campaign/theme.js} +1 -1
  124. package/dist/commands/shared/{world.d.ts → campaign/world.d.ts} +5 -5
  125. package/dist/commands/shared/{world.js → campaign/world.js} +17 -14
  126. package/dist/commands/shared/{knowledge.d.ts → characters/knowledge.d.ts} +3 -3
  127. package/dist/commands/shared/{knowledge.js → characters/knowledge.js} +4 -4
  128. package/dist/commands/shared/{moods.d.ts → characters/moods.d.ts} +3 -3
  129. package/dist/commands/shared/{moods.js → characters/moods.js} +3 -3
  130. package/dist/commands/shared/characters/orders.d.ts +4 -0
  131. package/dist/commands/shared/characters/orders.js +10 -0
  132. package/dist/commands/shared/{thoughts.d.ts → characters/thoughts.d.ts} +9 -6
  133. package/dist/commands/shared/{thoughts.js → characters/thoughts.js} +17 -7
  134. package/dist/commands/shared/{voices.d.ts → characters/voices.d.ts} +1 -1
  135. package/dist/commands/shared/{voices.js → characters/voices.js} +2 -2
  136. package/dist/commands/shared/examples.js +2 -2
  137. package/dist/commands/shared/packages/catalog.js +2 -2
  138. package/dist/commands/shared/packages/code.d.ts +1 -1
  139. package/dist/commands/shared/packages/code.js +8 -8
  140. package/dist/commands/shared/packages/extensions.d.ts +1 -1
  141. package/dist/commands/shared/packages/extensions.js +1 -1
  142. package/dist/commands/shared/packages/hooks.d.ts +1 -1
  143. package/dist/commands/shared/packages/hooks.js +1 -1
  144. package/dist/commands/shared/packages/widgets.d.ts +3 -3
  145. package/dist/commands/shared/packages/widgets.js +3 -3
  146. package/dist/commands/shared/{environment.d.ts → places/environment.d.ts} +1 -1
  147. package/dist/commands/shared/{environment.js → places/environment.js} +4 -4
  148. package/dist/commands/shared/{grid-moves.d.ts → places/grid-moves.d.ts} +4 -4
  149. package/dist/commands/shared/{grid-moves.js → places/grid-moves.js} +8 -7
  150. package/dist/commands/shared/{grids.d.ts → places/grids.d.ts} +4 -4
  151. package/dist/commands/shared/{grids.js → places/grids.js} +6 -6
  152. package/dist/commands/shared/{journey.d.ts → places/journey.d.ts} +3 -3
  153. package/dist/commands/shared/{journey.js → places/journey.js} +6 -6
  154. package/dist/commands/shared/{moves.d.ts → places/moves.d.ts} +2 -2
  155. package/dist/commands/shared/{moves.js → places/moves.js} +4 -4
  156. package/dist/commands/shared/{positions.d.ts → places/positions.d.ts} +2 -2
  157. package/dist/commands/shared/{positions.js → places/positions.js} +4 -4
  158. package/dist/commands/shared/{roads.d.ts → places/roads.d.ts} +5 -5
  159. package/dist/commands/shared/{roads.js → places/roads.js} +6 -6
  160. package/dist/commands/shared/{effects.d.ts → scene/effects.d.ts} +7 -7
  161. package/dist/commands/shared/{effects.js → scene/effects.js} +10 -10
  162. package/dist/commands/shared/{loot.d.ts → scene/loot.d.ts} +2 -2
  163. package/dist/commands/shared/{loot.js → scene/loot.js} +3 -3
  164. package/dist/commands/shared/{master-rolls.d.ts → scene/master-rolls.d.ts} +2 -2
  165. package/dist/commands/shared/{master-rolls.js → scene/master-rolls.js} +5 -5
  166. package/dist/commands/shared/{reminders.d.ts → scene/reminders.d.ts} +4 -4
  167. package/dist/commands/shared/{reminders.js → scene/reminders.js} +4 -4
  168. package/dist/commands/shared/{scene.d.ts → scene/scene.d.ts} +3 -3
  169. package/dist/commands/shared/{scene.js → scene/scene.js} +10 -8
  170. package/dist/commands/shared/{bonds.d.ts → sheet/bonds.d.ts} +3 -3
  171. package/dist/commands/shared/{bonds.js → sheet/bonds.js} +2 -2
  172. package/dist/commands/shared/{page-counters.d.ts → sheet/counters.d.ts} +3 -3
  173. package/dist/commands/shared/{page-counters.js → sheet/counters.js} +5 -5
  174. package/dist/commands/shared/{effect-layer.d.ts → sheet/effect-layer.d.ts} +2 -2
  175. package/dist/commands/shared/{effect-layer.js → sheet/effect-layer.js} +9 -6
  176. package/dist/commands/shared/sheet/effect-values.d.ts +9 -0
  177. package/dist/commands/shared/sheet/effect-values.js +69 -0
  178. package/dist/commands/shared/{experience.d.ts → sheet/experience.d.ts} +3 -3
  179. package/dist/commands/shared/{experience.js → sheet/experience.js} +5 -5
  180. package/dist/commands/shared/sheet/formula-problems.d.ts +8 -0
  181. package/dist/commands/shared/sheet/formula-problems.js +140 -0
  182. package/dist/commands/shared/sheet/formula-scope.d.ts +32 -0
  183. package/dist/commands/shared/sheet/formula-scope.js +235 -0
  184. package/dist/commands/shared/{limits.d.ts → sheet/limits.d.ts} +3 -3
  185. package/dist/commands/shared/{limits.js → sheet/limits.js} +5 -4
  186. package/dist/commands/shared/{progression.d.ts → sheet/progression.d.ts} +2 -2
  187. package/dist/commands/shared/{progression.js → sheet/progression.js} +4 -4
  188. package/dist/commands/shared/{sheet.d.ts → sheet/sheet.d.ts} +7 -5
  189. package/dist/commands/shared/{sheet.js → sheet/sheet.js} +11 -7
  190. package/dist/commands/shared/{stacks.d.ts → sheet/stacks.d.ts} +2 -2
  191. package/dist/commands/shared/{stacks.js → sheet/stacks.js} +4 -4
  192. package/dist/commands/shared/sheet/system-fields.d.ts +21 -0
  193. package/dist/commands/shared/sheet/system-fields.js +45 -0
  194. package/dist/commands/shared/{thresholds.d.ts → sheet/thresholds.d.ts} +1 -1
  195. package/dist/commands/shared/{thresholds.js → sheet/thresholds.js} +4 -4
  196. package/dist/commands/shared/{turn-uses.d.ts → sheet/turn-uses.d.ts} +3 -3
  197. package/dist/commands/shared/{turn-uses.js → sheet/turn-uses.js} +4 -3
  198. package/dist/commands/shared/{worked-out.d.ts → sheet/worked-out.d.ts} +11 -46
  199. package/dist/commands/shared/sheet/worked-out.js +291 -0
  200. package/dist/commands/shared/sheet/worked-text.d.ts +14 -0
  201. package/dist/commands/shared/sheet/worked-text.js +55 -0
  202. package/dist/commands/shared/{advance.d.ts → time/advance.d.ts} +3 -3
  203. package/dist/commands/shared/{advance.js → time/advance.js} +11 -11
  204. package/dist/commands/shared/{dice-pool.d.ts → time/dice-pool.d.ts} +3 -3
  205. package/dist/commands/shared/{dice-pool.js → time/dice-pool.js} +11 -11
  206. package/dist/commands/shared/{events.d.ts → time/events.d.ts} +5 -5
  207. package/dist/commands/shared/{events.js → time/events.js} +10 -13
  208. package/dist/commands/shared/{recipes.d.ts → time/recipes.d.ts} +3 -3
  209. package/dist/commands/shared/{recipes.js → time/recipes.js} +6 -5
  210. package/dist/commands/shared/{time.d.ts → time/time.d.ts} +4 -4
  211. package/dist/commands/shared/{time.js → time/time.js} +6 -6
  212. package/dist/commands/shared/{upkeep.d.ts → time/upkeep.d.ts} +3 -3
  213. package/dist/commands/shared/{upkeep.js → time/upkeep.js} +14 -13
  214. package/dist/commands/show.d.ts +9 -0
  215. package/dist/commands/show.js +43 -10
  216. package/dist/commands/status.d.ts +2 -1
  217. package/dist/commands/status.js +28 -22
  218. package/dist/commands/thoughts.d.ts +1 -0
  219. package/dist/commands/thoughts.js +26 -18
  220. package/dist/commands/trade.js +8 -8
  221. package/dist/commands/translate.d.ts +1 -1
  222. package/dist/commands/translate.js +3 -3
  223. package/dist/commands/travel/open.d.ts +1 -1
  224. package/dist/commands/travel/open.js +2 -2
  225. package/dist/commands/travel/route.js +7 -6
  226. package/dist/commands/travel/travel.d.ts +1 -1
  227. package/dist/commands/travel/travel.js +8 -8
  228. package/dist/commands/validate.js +3 -3
  229. package/dist/commands/view/journal.d.ts +2 -2
  230. package/dist/commands/view/journal.js +2 -2
  231. package/dist/commands/view/layers.d.ts +34 -0
  232. package/dist/commands/view/layers.js +44 -0
  233. package/dist/commands/view/map.d.ts +1 -1
  234. package/dist/commands/view/map.js +6 -6
  235. package/dist/commands/view/memory.d.ts +16 -0
  236. package/dist/commands/view/memory.js +96 -0
  237. package/dist/commands/view/page.d.ts +32 -0
  238. package/dist/commands/view/page.js +166 -0
  239. package/dist/commands/view/place.d.ts +7 -2
  240. package/dist/commands/view/place.js +30 -12
  241. package/dist/commands/view/result.d.ts +252 -0
  242. package/dist/commands/view/result.js +1 -0
  243. package/dist/commands/view/saves.d.ts +6 -0
  244. package/dist/commands/view/saves.js +53 -0
  245. package/dist/commands/view/story.d.ts +32 -0
  246. package/dist/commands/view/story.js +227 -0
  247. package/dist/commands/view/view.d.ts +29 -292
  248. package/dist/commands/view/view.js +31 -536
  249. package/dist/commands/view/world.d.ts +1 -1
  250. package/dist/commands/view/world.js +3 -3
  251. package/dist/commands/write/checks.d.ts +42 -0
  252. package/dist/commands/write/checks.js +291 -0
  253. package/dist/commands/write/here.d.ts +1 -1
  254. package/dist/commands/write/here.js +5 -5
  255. package/dist/commands/write/inheritance.d.ts +40 -0
  256. package/dist/commands/write/inheritance.js +185 -0
  257. package/dist/commands/write/input.d.ts +29 -0
  258. package/dist/commands/write/input.js +124 -0
  259. package/dist/commands/write/layer.d.ts +44 -0
  260. package/dist/commands/write/layer.js +68 -0
  261. package/dist/commands/write/notes.d.ts +22 -0
  262. package/dist/commands/write/notes.js +76 -0
  263. package/dist/commands/write/progression.d.ts +27 -0
  264. package/dist/commands/write/progression.js +175 -0
  265. package/dist/commands/write/write.d.ts +2 -0
  266. package/dist/commands/write/write.js +36 -816
  267. package/dist/core/files.d.ts +2 -0
  268. package/dist/core/files.js +7 -0
  269. package/dist/core/{package-declarations.d.ts → packages/declarations.d.ts} +1 -1
  270. package/dist/core/{package-declarations.js → packages/declarations.js} +1 -1
  271. package/dist/core/session-store.js +3 -3
  272. package/dist/core/store.d.ts +2 -2
  273. package/dist/core/store.js +18 -4
  274. package/dist/core/text.d.ts +2 -0
  275. package/dist/core/text.js +4 -0
  276. package/dist/dashboard/acts/acts.js +1 -1
  277. package/dist/dashboard/acts/sending.js +110 -0
  278. package/dist/dashboard/acts/sheet.js +2 -2
  279. package/dist/dashboard/acts/strip.js +1 -1
  280. package/dist/dashboard/address.js +6 -0
  281. package/dist/dashboard/api.js +19 -1
  282. package/dist/dashboard/app.js +51 -171
  283. package/dist/dashboard/dice/roller.js +1 -1
  284. package/dist/dashboard/dice/sets.js +2 -2
  285. package/dist/dashboard/dice/stage.js +1 -1
  286. package/dist/dashboard/dice/tray.js +6 -6
  287. package/dist/dashboard/guide/ar.md +7 -3
  288. package/dist/dashboard/guide/cs.md +9 -5
  289. package/dist/dashboard/guide/da.md +9 -5
  290. package/dist/dashboard/guide/de.md +7 -3
  291. package/dist/dashboard/guide/el.md +9 -5
  292. package/dist/dashboard/guide/en.md +4 -0
  293. package/dist/dashboard/guide/es.md +8 -4
  294. package/dist/dashboard/guide/fi.md +9 -5
  295. package/dist/dashboard/guide/fr.md +8 -4
  296. package/dist/dashboard/guide/he.md +7 -3
  297. package/dist/dashboard/guide/hi.md +10 -6
  298. package/dist/dashboard/guide/hu.md +8 -4
  299. package/dist/dashboard/guide/is.md +9 -5
  300. package/dist/dashboard/guide/it.md +5 -1
  301. package/dist/dashboard/guide/ja.md +9 -5
  302. package/dist/dashboard/guide/ko.md +8 -4
  303. package/dist/dashboard/guide/nb.md +8 -4
  304. package/dist/dashboard/guide/nl.md +8 -4
  305. package/dist/dashboard/guide/pl.md +8 -4
  306. package/dist/dashboard/guide/pt.md +7 -3
  307. package/dist/dashboard/guide/ro.md +9 -5
  308. package/dist/dashboard/guide/ru.md +8 -4
  309. package/dist/dashboard/guide/sv.md +9 -5
  310. package/dist/dashboard/guide/tr.md +9 -5
  311. package/dist/dashboard/guide/uk.md +8 -4
  312. package/dist/dashboard/guide/zh.md +8 -4
  313. package/dist/dashboard/help/help.js +3 -3
  314. package/dist/dashboard/i18n/ar.json +29 -0
  315. package/dist/dashboard/i18n/cs.json +29 -0
  316. package/dist/dashboard/i18n/da.json +29 -0
  317. package/dist/dashboard/i18n/de.json +29 -0
  318. package/dist/dashboard/i18n/el.json +29 -0
  319. package/dist/dashboard/i18n/es.json +29 -0
  320. package/dist/dashboard/i18n/fi.json +29 -0
  321. package/dist/dashboard/i18n/fr.json +29 -0
  322. package/dist/dashboard/i18n/he.json +29 -0
  323. package/dist/dashboard/i18n/hi.json +29 -0
  324. package/dist/dashboard/i18n/hu.json +29 -0
  325. package/dist/dashboard/i18n/is.json +29 -0
  326. package/dist/dashboard/i18n/it.json +29 -0
  327. package/dist/dashboard/i18n/ja.json +30 -1
  328. package/dist/dashboard/i18n/ko.json +29 -0
  329. package/dist/dashboard/i18n/nb.json +29 -0
  330. package/dist/dashboard/i18n/nl.json +29 -0
  331. package/dist/dashboard/i18n/pl.json +29 -0
  332. package/dist/dashboard/i18n/pt.json +29 -0
  333. package/dist/dashboard/i18n/ro.json +29 -0
  334. package/dist/dashboard/i18n/ru.json +29 -0
  335. package/dist/dashboard/i18n/sv.json +29 -0
  336. package/dist/dashboard/i18n/tr.json +29 -0
  337. package/dist/dashboard/i18n/uk.json +29 -0
  338. package/dist/dashboard/i18n/zh.json +29 -0
  339. package/dist/dashboard/{journal.js → journal/journal.js} +16 -16
  340. package/dist/dashboard/{notes.js → journal/notes.js} +4 -4
  341. package/dist/dashboard/kit.js +3 -3
  342. package/dist/dashboard/packages/ask-card.js +3 -3
  343. package/dist/dashboard/packages/catalog.js +196 -0
  344. package/dist/dashboard/packages/changes.js +111 -0
  345. package/dist/dashboard/packages/engine.js +87 -0
  346. package/dist/dashboard/packages/installed.js +53 -0
  347. package/dist/dashboard/packages/library.js +97 -0
  348. package/dist/dashboard/packages/outcomes.js +45 -0
  349. package/dist/dashboard/packages/packages.js +27 -578
  350. package/dist/dashboard/packages/page-code.js +15 -2
  351. package/dist/dashboard/packages/{package-page.js → page.js} +12 -5
  352. package/dist/dashboard/packages/rows.js +84 -0
  353. package/dist/dashboard/packages/share.js +44 -0
  354. package/dist/dashboard/packages/widgets.js +3 -3
  355. package/dist/dashboard/{card.js → parts/card.js} +1 -1
  356. package/dist/dashboard/parts/changed.js +37 -0
  357. package/dist/dashboard/{faces.js → parts/faces.js} +5 -5
  358. package/dist/dashboard/{game-words.js → parts/game-words.js} +1 -1
  359. package/dist/dashboard/{icons.js → parts/icons.js} +1 -1
  360. package/dist/dashboard/{labels.js → parts/labels.js} +2 -1
  361. package/dist/dashboard/{map-symbols.js → parts/map-symbols.js} +1 -1
  362. package/dist/dashboard/{markdown.js → parts/markdown.js} +2 -2
  363. package/dist/dashboard/{mood.js → parts/mood.js} +1 -1
  364. package/dist/dashboard/{refusals.js → parts/refusals.js} +5 -1
  365. package/dist/dashboard/{status.js → parts/status.js} +4 -4
  366. package/dist/dashboard/{widgets.js → parts/widgets.js} +5 -3
  367. package/dist/dashboard/place/key.js +24 -0
  368. package/dist/dashboard/place/paper.js +67 -0
  369. package/dist/dashboard/place/{map-sheet.js → sheet.js} +2 -2
  370. package/dist/dashboard/place/things.js +129 -0
  371. package/dist/dashboard/place/tokens.js +93 -0
  372. package/dist/dashboard/place/view.js +124 -0
  373. package/dist/dashboard/{asked-dice.js → play/asked-dice.js} +3 -3
  374. package/dist/dashboard/{asked.js → play/asked.js} +10 -10
  375. package/dist/dashboard/{choices.js → play/choices.js} +11 -10
  376. package/dist/dashboard/{requested.js → play/requested.js} +1 -1
  377. package/dist/dashboard/{rolls.js → play/rolls.js} +9 -9
  378. package/dist/dashboard/{scene.js → play/scene.js} +14 -14
  379. package/dist/dashboard/{turns.js → play/turns.js} +12 -12
  380. package/dist/dashboard/{language-choice.js → settings/language-choice.js} +1 -1
  381. package/dist/dashboard/{languages.js → settings/languages.js} +1 -1
  382. package/dist/dashboard/{saves.js → settings/saves.js} +8 -8
  383. package/dist/dashboard/{settings.js → settings/settings.js} +17 -15
  384. package/dist/dashboard/{setup.js → settings/setup.js} +5 -5
  385. package/dist/dashboard/{party.js → sheet/party.js} +8 -8
  386. package/dist/dashboard/{person-panel.js → sheet/person-panel.js} +4 -4
  387. package/dist/dashboard/{sheet.js → sheet/sheet.js} +27 -24
  388. package/dist/dashboard/{story.js → sheet/story.js} +3 -3
  389. package/dist/dashboard/{columns.js → shell/columns.js} +1 -1
  390. package/dist/dashboard/{footer.js → shell/footer.js} +3 -3
  391. package/dist/dashboard/{master.js → shell/master.js} +2 -2
  392. package/dist/dashboard/{notices.js → shell/notices.js} +3 -3
  393. package/dist/dashboard/{pages.js → shell/pages.js} +5 -5
  394. package/dist/dashboard/shell/shown.js +38 -0
  395. package/dist/dashboard/{table.js → shell/table.js} +2 -2
  396. package/dist/dashboard/{tabs.js → shell/tabs.js} +2 -2
  397. package/dist/dashboard/{top.js → shell/top.js} +7 -7
  398. package/dist/dashboard/style.css +288 -4
  399. package/dist/dashboard/world/calendar.js +4 -4
  400. package/dist/dashboard/world/drawing.js +92 -0
  401. package/dist/dashboard/world/key.js +21 -0
  402. package/dist/dashboard/world/lore.js +10 -6
  403. package/dist/dashboard/world/map-card.js +186 -0
  404. package/dist/dashboard/world/place-card.js +39 -0
  405. package/dist/dashboard/world/places.js +29 -0
  406. package/dist/dashboard/world/world.js +9 -341
  407. package/dist/extensions/extension.d.ts +1 -1
  408. package/dist/extensions/extension.js +1 -1
  409. package/dist/images/images.js +12 -9
  410. package/dist/index.d.ts +1 -1
  411. package/dist/languages/index.d.ts +1 -1
  412. package/dist/languages/index.js +1 -1
  413. package/dist/packages/npm.js +1 -1
  414. package/dist/page.d.ts +2 -2
  415. package/dist/page.js +1 -1
  416. package/dist/pages/check.js +23 -1
  417. package/dist/pages/containers.d.ts +1 -1
  418. package/dist/pages/containers.js +1 -1
  419. package/dist/pages/index.d.ts +4 -2
  420. package/dist/pages/index.js +4 -2
  421. package/dist/pages/inheritance.d.ts +2 -2
  422. package/dist/pages/layers.d.ts +52 -0
  423. package/dist/pages/layers.js +105 -0
  424. package/dist/pages/markdown.d.ts +5 -1
  425. package/dist/pages/markdown.js +13 -1
  426. package/dist/pages/rename-page.js +1 -1
  427. package/dist/pages/stacks/writes.js +48 -22
  428. package/dist/pages/standard-fields.d.ts +1 -1
  429. package/dist/pages/system-pages.d.ts +5 -3
  430. package/dist/pages/system-pages.js +16 -7
  431. package/dist/pages/world.d.ts +8 -1
  432. package/dist/pages/world.js +16 -4
  433. package/dist/pages/write-layer.d.ts +23 -0
  434. package/dist/pages/write-layer.js +162 -0
  435. package/dist/pages/write-page.d.ts +2 -2
  436. package/dist/pages/write-page.js +2 -2
  437. package/dist/rules/index.d.ts +1 -1
  438. package/dist/rules/index.js +1 -1
  439. package/dist/rules/search.d.ts +1 -1
  440. package/dist/rules/shown.d.ts +1 -1
  441. package/dist/server/dashboard/choices.d.ts +2 -0
  442. package/dist/server/dashboard/choices.js +6 -4
  443. package/dist/server/dashboard/files.js +5 -5
  444. package/dist/server/dashboard/index.d.ts +2 -2
  445. package/dist/server/dashboard/index.js +7 -3
  446. package/dist/server/dashboard/news.js +4 -3
  447. package/dist/server/dashboard/player.js +1 -1
  448. package/dist/server/dashboard/writes.d.ts +7 -0
  449. package/dist/server/dashboard/writes.js +48 -7
  450. package/dist/server/mcp.js +28 -13
  451. package/dist/systems/campaign-data.d.ts +15 -0
  452. package/dist/systems/campaign-data.js +85 -0
  453. package/dist/systems/{system-code.d.ts → code.d.ts} +1 -1
  454. package/dist/systems/{system-code.js → code.js} +2 -2
  455. package/dist/systems/game-system.d.ts +7 -61
  456. package/dist/systems/game-system.js +1 -984
  457. package/dist/systems/index.d.ts +6 -3
  458. package/dist/systems/index.js +6 -3
  459. package/dist/systems/installed.d.ts +31 -0
  460. package/dist/systems/installed.js +89 -0
  461. package/dist/systems/maps.d.ts +3 -0
  462. package/dist/systems/maps.js +9 -0
  463. package/dist/systems/read.d.ts +3 -0
  464. package/dist/systems/read.js +471 -0
  465. package/dist/systems/schema.d.ts +289 -0
  466. package/dist/systems/schema.js +243 -0
  467. package/dist/systems/settings.d.ts +19 -0
  468. package/dist/systems/settings.js +78 -0
  469. package/dist/systems/versions.d.ts +12 -0
  470. package/dist/systems/versions.js +52 -0
  471. package/dist/testing/index.js +1 -1
  472. package/instructions/import.md +1 -1
  473. package/instructions/play.md +1 -1
  474. package/instructions/voices.md +1 -1
  475. package/package.json +1 -1
  476. package/dist/commands/config.js +0 -948
  477. package/dist/commands/package.d.ts +0 -143
  478. package/dist/commands/package.js +0 -785
  479. package/dist/commands/scene.js +0 -894
  480. package/dist/commands/shared/worked-out.js +0 -805
  481. package/dist/dashboard/place/map-view.js +0 -417
  482. /package/dist/commands/shared/{library-reader.d.ts → books/library-reader.d.ts} +0 -0
  483. /package/dist/core/{package-api.d.ts → packages/api.d.ts} +0 -0
  484. /package/dist/core/{package-api.js → packages/api.js} +0 -0
  485. /package/dist/dashboard/{coins.js → parts/coins.js} +0 -0
  486. /package/dist/dashboard/{glass.js → parts/glass.js} +0 -0
  487. /package/dist/dashboard/{layout.js → parts/layout.js} +0 -0
  488. /package/dist/dashboard/{mood-faces.js → parts/mood-faces.js} +0 -0
  489. /package/dist/dashboard/{free-rolls.js → play/free-rolls.js} +0 -0
  490. /package/dist/dashboard/{reactions.js → play/reactions.js} +0 -0
  491. /package/dist/dashboard/{prefs.js → shell/prefs.js} +0 -0
  492. /package/dist/dashboard/{system-style.js → shell/system-style.js} +0 -0
  493. /package/dist/dashboard/{theme.js → shell/theme.js} +0 -0
  494. /package/dist/languages/{language-pack.d.ts → pack.d.ts} +0 -0
  495. /package/dist/languages/{language-pack.js → pack.js} +0 -0
  496. /package/dist/pages/{page-file.d.ts → file.d.ts} +0 -0
  497. /package/dist/pages/{page-file.js → file.js} +0 -0
  498. /package/dist/pages/{page-types.d.ts → types.d.ts} +0 -0
  499. /package/dist/pages/{page-types.js → types.js} +0 -0
  500. /package/dist/rules/{rule-book.d.ts → book.d.ts} +0 -0
  501. /package/dist/rules/{rule-book.js → book.js} +0 -0
  502. /package/dist/systems/{system-folders.d.ts → folders.d.ts} +0 -0
  503. /package/dist/systems/{system-folders.js → folders.js} +0 -0
@@ -21,3 +21,5 @@ export declare function realPath(path: string): string;
21
21
  * is a link to the folder. Such a package is never verified, whatever its name.
22
22
  */
23
23
  export declare function installedFromFolder(folder: string): boolean;
24
+ /** The name npm installed a package by, as @scope/name from node_modules/@scope/name; undefined for a folder that is no package of npm's own folder. */
25
+ export declare function npmPackageName(folder: string): string | undefined;
@@ -90,6 +90,13 @@ export function installedFromFolder(folder) {
90
90
  return false;
91
91
  }
92
92
  }
93
+ /** The name npm installed a package by, as @scope/name from node_modules/@scope/name; undefined for a folder that is no package of npm's own folder. */
94
+ export function npmPackageName(folder) {
95
+ const parts = resolve(folder).split(sep);
96
+ const name = parts.slice(parts.lastIndexOf("node_modules") + 1);
97
+ const fits = parts.includes("node_modules") && (name.length === 1 || (name.length === 2 && name[0].startsWith("@")));
98
+ return fits ? name.join("/") : undefined;
99
+ }
93
100
  /**
94
101
  * The packages the player installed in a folder of npm's, as the package.json beside it lists them; undefined where there is none, as for the engine's own
95
102
  * systems or a test's folder.
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { type CardPage, type FigureSize } from "./package-api.ts";
2
+ import { type CardPage, type FigureSize } from "./api.ts";
3
3
  export type { CardPage, FigureSize };
4
4
  /**
5
5
  * The version of the API a package is made for, which its package.json names as rpg-engine.api: the contract its code is given and what its extension.yaml or
@@ -1,7 +1,7 @@
1
1
  // What every package for rpg-engine declares alike, an extension in extension.yaml and a game system in system.yaml (D-502, D-510, D-514): the version of the
2
2
  // API it is made for, and its icons, widgets and figures, with the same limits.
3
3
  import { z } from "zod";
4
- import { cardPages } from "./package-api.js";
4
+ import { cardPages } from "./api.js";
5
5
  /**
6
6
  * The version of the API a package is made for, which its package.json names as rpg-engine.api: the contract its code is given and what its extension.yaml or
7
7
  * system.yaml may declare. It goes up with every addition an older engine would refuse or misread, and the engine reads a range (D-515, D-549): 2 added the widgets, 3 an extension's
@@ -6,9 +6,9 @@ import { readFile } from "node:fs/promises";
6
6
  import { isAbsolute, join, relative, resolve, sep } from "node:path";
7
7
  import { filesIn, foldersIn } from "./files.js";
8
8
  import { FileStore, isInside, readText, wroteInCall } from "./store.js";
9
- // The folders of a campaign below its own that hold what is kept: its pages, its house rules and its pictures. The campaign's folder holds its settings, state
10
- // and log.
11
- const watchedTrees = ["world", "rules", "images"];
9
+ // The folders of a campaign below its own that hold what is kept: its pages, its layers over the system's (SYS-11), its house rules and its pictures. The
10
+ // campaign's folder holds its settings, state and log.
11
+ const watchedTrees = ["world", "layers", "rules", "images"];
12
12
  // More changes than this between two calls, and a watcher on Linux may have lost some without a word: inotify keeps 16384 by default, then drops the rest.
13
13
  const tooManyChanges = 10_000;
14
14
  /** The files of a session of the MCP server, kept between calls and watched (D-193). */
@@ -35,8 +35,8 @@ export declare class FileStore {
35
35
  isLink(path: string): boolean;
36
36
  /** The links right inside `folder`, as they are now, by name, which entries leaves out; none when there is no such folder. */
37
37
  links(folder: string): string[];
38
- /** A file's bytes as they are now, as a save holds them; undefined when there is no file. */
39
- bytes(path: string): Uint8Array | undefined;
38
+ /** A file's bytes as they are now, as a save holds them, or only its first `length`; undefined when there is no file. */
39
+ bytes(path: string, length?: number): Uint8Array | undefined;
40
40
  /** The text of a file as it is now, for a command about to write it: in a call, the text the call reads; a session checks the disk (D-193). */
41
41
  fresh(path: string): string | undefined;
42
42
  /** Keeps the files of a campaign up to date for later calls: only the store of a session does (D-193). */
@@ -1,7 +1,7 @@
1
1
  // The files as a command sees them (D-137, D-194): each read at most once in a call, kept as its text and as what it reads as, frozen; what the command writes
2
2
  // updates what is kept. A command runs inside its store, and the modules reach it with files(): the MCP server will keep one for a whole session.
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
- import { appendFileSync, existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
4
+ import { appendFileSync, closeSync, existsSync, lstatSync, mkdirSync, openSync, readdirSync, readFileSync, readSync, rmSync, statSync, writeFileSync } from "node:fs";
5
5
  import { basename, dirname, isAbsolute, relative, resolve, sep } from "node:path";
6
6
  import { fileOrder, filesIn } from "./files.js";
7
7
  import { frozen } from "./frozen.js";
@@ -80,9 +80,12 @@ export class FileStore {
80
80
  links(folder) {
81
81
  return existsSync(folder) && statSync(folder).isDirectory() ? readdirSync(folder, { withFileTypes: true }).filter((entry) => entry.isSymbolicLink()).map((entry) => entry.name) : [];
82
82
  }
83
- /** A file's bytes as they are now, as a save holds them; undefined when there is no file. */
84
- bytes(path) {
85
- return existsSync(path) ? new Uint8Array(readFileSync(path)) : undefined;
83
+ /** A file's bytes as they are now, as a save holds them, or only its first `length`; undefined when there is no file. */
84
+ bytes(path, length) {
85
+ if (!existsSync(path)) {
86
+ return undefined;
87
+ }
88
+ return length === undefined ? new Uint8Array(readFileSync(path)) : firstBytes(path, length);
86
89
  }
87
90
  /** The text of a file as it is now, for a command about to write it: in a call, the text the call reads; a session checks the disk (D-193). */
88
91
  fresh(path) {
@@ -256,6 +259,17 @@ function changedSince(path, time) {
256
259
  const stats = statSync(path, { throwIfNoEntry: false });
257
260
  return stats === undefined || stats.mtimeMs >= time;
258
261
  }
262
+ /** The first `length` bytes of a file, or all of a shorter one, read without the rest. */
263
+ function firstBytes(path, length) {
264
+ const handle = openSync(path, "r");
265
+ try {
266
+ const bytes = new Uint8Array(length);
267
+ return bytes.subarray(0, readSync(handle, bytes, 0, length, 0));
268
+ }
269
+ finally {
270
+ closeSync(handle);
271
+ }
272
+ }
259
273
  /** Notes that the running call wrote a file, which a stop before its next write says (D-196). */
260
274
  function markWritten() {
261
275
  const call = running.getStore();
@@ -19,5 +19,7 @@ export declare function sameName(names: string[], name: string): string | undefi
19
19
  export declare function sameWord(one: string, other: string, words?: Record<string, string>): boolean;
20
20
  /** The value a record holds under a name, as names are compared (INH-5); undefined when it holds none. */
21
21
  export declare function valueNamed(record: Record<string, unknown>, name: string): unknown;
22
+ /** A field's value as the outputs show it in a line: a list as its items, anything else as written. */
23
+ export declare function valueText(value: unknown): string;
22
24
  /** The page a link's target names: [[folder/Page.md]], and [[Page\|label]] as written in tables, name Page. */
23
25
  export declare function linkTargetName(target: string): string;
package/dist/core/text.js CHANGED
@@ -49,6 +49,10 @@ export function valueNamed(record, name) {
49
49
  const key = sameName(Object.keys(record), name);
50
50
  return key === undefined ? undefined : record[key];
51
51
  }
52
+ /** A field's value as the outputs show it in a line: a list as its items, anything else as written. */
53
+ export function valueText(value) {
54
+ return Array.isArray(value) ? value.map(String).join(", ") : typeof value === "object" && value !== null ? JSON.stringify(value) : String(value);
55
+ }
52
56
  /** The page a link's target names: [[folder/Page.md]], and [[Page\|label]] as written in tables, name Page. */
53
57
  export function linkTargetName(target) {
54
58
  return (target.replace(/\\$/, "").split("/").at(-1) ?? "").replace(/\.md$/i, "").trim();
@@ -1,4 +1,4 @@
1
- import { strangerLabel } from "../labels.js";
1
+ import { strangerLabel } from "../parts/labels.js";
2
2
  import { t } from "../text.js";
3
3
  // The system's own verbs, by name, as the overview gives them (D-514).
4
4
  let systemVerbs = {};
@@ -0,0 +1,110 @@
1
+ // The player's sentences to the master (D-495), as the page holds them: the verbs of the sheet, the sentence being written, those said or copied and how the
2
+ // server holds them, sent, taken back, copied and gone from the strip after a while. The page's read() sets the acts and the verbs it reads, by their setters.
3
+ import { useEffect, useState } from "preact/hooks";
4
+ import { answer, readView, sayAct, withdrawAct } from "../api.js";
5
+ import { t } from "../text.js";
6
+ import { saidStates } from "./acts.js";
7
+ // How long a sentence the master heard, or one copied for the chat, stays in the strip (D-495).
8
+ const heardTime = 6000;
9
+ /** The player's sentences to the master and what the page does with them (D-495). */
10
+ export function useActs({ read, live, asked, foreground, version, players, member, several }) {
11
+ // The verbs of the player character's sheet, the sentences said or copied and how the server holds them, and the action the player is writing, with
12
+ // what started it, which has the focus back.
13
+ const [actions, setActions] = useState();
14
+ const [acts, setActs] = useState();
15
+ const [said, setSaid] = useState([]);
16
+ const [actProblem, setActProblem] = useState();
17
+ const [acting, setActing] = useState();
18
+ // Who acts from a sheet acts where they are: the place of one not in the foreground, read for them (VIEW-12).
19
+ const actsElsewhere = acting !== undefined && several && member?.role === "pc" && member.name !== foreground ? member.name : undefined;
20
+ const [actPlace, setActPlace] = useState();
21
+ useEffect(() => {
22
+ if (actsElsewhere === undefined) {
23
+ return;
24
+ }
25
+ let current = true;
26
+ void readView(undefined, 1, actsElsewhere).then((view) => {
27
+ if (current) {
28
+ setActPlace({ who: actsElsewhere, ...(view.kind === "overview" && view.place !== undefined ? { place: view.place } : {}) });
29
+ }
30
+ }, () => undefined);
31
+ return () => {
32
+ current = false;
33
+ };
34
+ }, [actsElsewhere, version]);
35
+ // The game gone, what the master had not heard is lost with the chat: the strip says so, even once the game is back (D-495).
36
+ useEffect(() => {
37
+ if (!live) {
38
+ setSaid((before) => before.map((one) => (acts?.heard.includes(one.id) === true ? one : { ...one, lost: true })));
39
+ }
40
+ }, [live]);
41
+ const strip = saidStates(said, acts, live);
42
+ const leaving = strip.filter((entry) => entry.state === "heard" || entry.state === "copied").map((entry) => entry.act.id).join();
43
+ // A sentence heard, or copied, goes from the strip after a while.
44
+ useEffect(() => {
45
+ if (leaving === "") {
46
+ return;
47
+ }
48
+ const timer = window.setTimeout(() => dismissAct(...leaving.split(",")), heardTime);
49
+ return () => window.clearTimeout(timer);
50
+ }, [leaving]);
51
+ const dismissAct = (...ids) => {
52
+ setSaid((before) => before.filter((one) => !ids.includes(one.id)));
53
+ setActProblem(undefined);
54
+ };
55
+ // With a question of the master's open, the sentence answers it (ASK-10); else it rings the master, or, in a chat that hears nothing by itself, is copied.
56
+ const question = asked !== undefined && asked.spend === undefined && asked.forced !== true ? asked : undefined;
57
+ const reply = question !== undefined ? "answer" : acts?.bell === true ? "tell" : "copy";
58
+ const sendAct = async (text) => {
59
+ setActProblem(undefined);
60
+ if (reply === "answer" && question !== undefined) {
61
+ const taken = await answer(question.id, text).catch(() => false);
62
+ void read();
63
+ return taken ? undefined : t("The answer did not reach the game: try again.");
64
+ }
65
+ if (reply === "copy") {
66
+ return await copyAct(text) ? undefined : t("Copy did not work: select the words and copy them yourself.");
67
+ }
68
+ const result = await sayAct(text);
69
+ if ("error" in result) {
70
+ return result.error;
71
+ }
72
+ setSaid((before) => [...before, { id: result.id, text }]);
73
+ setActs(result.shown);
74
+ return undefined;
75
+ };
76
+ const copyAct = async (text) => {
77
+ try {
78
+ await navigator.clipboard.writeText(text);
79
+ setSaid((before) => [...before.filter((one) => one.copied !== true || one.text !== text), { id: `copied ${Date.now()}`, text, copied: true }]);
80
+ return true;
81
+ }
82
+ catch {
83
+ return false;
84
+ }
85
+ };
86
+ // A sentence copied again from the strip goes from it; one that would not copy says so.
87
+ const copyFromStrip = (id, text) => void copyAct(text).then((done) => (done ? dismissAct(id) : setActProblem(t("Copy did not work: select the words and copy them yourself."))));
88
+ const withdraw = async (id) => {
89
+ const result = await withdrawAct(id);
90
+ if (result === "heard") {
91
+ setActProblem(t("The master has already heard it."));
92
+ void read();
93
+ }
94
+ else if (result === undefined) {
95
+ setActProblem(t("It did not reach the game: try again."));
96
+ }
97
+ else {
98
+ setActs(result);
99
+ dismissAct(id);
100
+ }
101
+ };
102
+ // The sheet closed, the focus goes back to what started the action.
103
+ const closeAct = () => {
104
+ const opener = acting?.opener;
105
+ setActing(undefined);
106
+ requestAnimationFrame(() => opener?.isConnected === true && opener.focus());
107
+ };
108
+ const playerActs = actions === undefined || players.length === 0 ? undefined : { actions, start: (start, opener) => setActing({ start, opener }) };
109
+ return { setActs, setActions, playerActs, acting, actsElsewhere, actPlace, reply, strip, actProblem, sendAct, closeAct, withdraw, copyFromStrip, dismissAct };
110
+ }
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime";
2
2
  import { useEffect, useRef, useState } from "preact/hooks";
3
- import { Icon } from "../icons.js";
4
- import { PlaceMap } from "../place/map-view.js";
3
+ import { Icon } from "../parts/icons.js";
4
+ import { PlaceMap } from "../place/view.js";
5
5
  import { t } from "../text.js";
6
6
  import { actPeople, actSentence, actTitle, spokenBy, talkSentence, targetMode, verbLabel } from "./acts.js";
7
7
  // How many characters a sentence may have, as the server takes them.
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-ru
2
2
  // The player's sentences after they go (D-495), in words and with a sign: said, with a button to take it back while it waits; called, the doorbell rang;
3
3
  // heard; or never heard, the chat gone, to say again there. A screen reader hears only the change of state.
4
4
  import { useEffect, useRef, useState } from "preact/hooks";
5
- import { Icon } from "../icons.js";
5
+ import { Icon } from "../parts/icons.js";
6
6
  import { t } from "../text.js";
7
7
  export function ActStrip({ entries, problem, onWithdraw, onCopy, onDismiss }) {
8
8
  const before = useRef(new Map());
@@ -46,6 +46,12 @@ export function sectionLabel(section) {
46
46
  };
47
47
  return labels[section];
48
48
  }
49
+ /** Writes the Scene's address over Combat's old one, without a step in the history. */
50
+ export function redirectCombat() {
51
+ if (/^#\/combat(\/|$)/.test(window.location.hash)) {
52
+ history.replaceState(null, "", sectionAddress("scene"));
53
+ }
54
+ }
49
55
  /** A part of an address as written, nothing when it is not well encoded. */
50
56
  function decoded(part) {
51
57
  try {
@@ -1,4 +1,4 @@
1
- import { refusalText } from "./refusals.js";
1
+ import { refusalText } from "./parts/refusals.js";
2
2
  import { t } from "./text.js";
3
3
  /** A picture's address, with when its file last changed, so that it comes again only when it changes. */
4
4
  export function pictureAddress(picture) {
@@ -208,6 +208,24 @@ export async function readLibrary() {
208
208
  export async function changeLibrary(action, path) {
209
209
  return await packageWork(() => fetch("/api/library", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ action, path }) }));
210
210
  }
211
+ /**
212
+ * Takes the campaign's change off a page of the game system (D-564), which then reads as the system writes it; the master hears of it by itself. A refusal
213
+ * names the page by `shown`, its name as the player reads it.
214
+ */
215
+ export async function putPageBack(page, shown) {
216
+ try {
217
+ const response = await fetch("/api/layer", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ page }) });
218
+ if (response.status === 202) {
219
+ return { done: true };
220
+ }
221
+ const body = await response.json().catch(() => ({}));
222
+ const code = body.code === "no-layer" || body.code === "scene-open" ? body.code : undefined;
223
+ return { done: false, error: refusalText(code === undefined ? body : { ...body, values: { ...body.values, page: shown } }, t("It did not reach the game: try again.")), ...(code === undefined ? {} : { code }) };
224
+ }
225
+ catch {
226
+ return { done: false, error: t("It did not reach the game: try again.") };
227
+ }
228
+ }
211
229
  /** Exports the campaign as an adventure, as it was at its start (ADV-7): the address to download its .zip from, or what went wrong. */
212
230
  export async function exportCampaign(credits) {
213
231
  try {