rpg-engine 0.7.0 → 0.9.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 (397) hide show
  1. package/dist/adventures/index.d.ts +1 -1
  2. package/dist/adventures/index.js +1 -1
  3. package/dist/adventures/source.js +13 -13
  4. package/dist/campaign/create-campaign.js +10 -1
  5. package/dist/campaign/host-files.d.ts +2 -1
  6. package/dist/campaign/host-files.js +11 -11
  7. package/dist/campaign/index.d.ts +1 -1
  8. package/dist/campaign/index.js +1 -1
  9. package/dist/campaign/settings.d.ts +55 -64
  10. package/dist/campaign/settings.js +171 -174
  11. package/dist/{cli.js → cli/cli.js} +3 -3
  12. package/dist/{command-line.d.ts → cli/command-line.d.ts} +1 -1
  13. package/dist/{command-line.js → cli/command-line.js} +21 -20
  14. package/dist/commands/advance.d.ts +1 -1
  15. package/dist/commands/advance.js +7 -7
  16. package/dist/commands/ask.d.ts +1 -8
  17. package/dist/commands/ask.js +16 -29
  18. package/dist/commands/{change.d.ts → change/change.d.ts} +2 -2
  19. package/dist/commands/{change.js → change/change.js} +46 -52
  20. package/dist/commands/{game-damage.d.ts → change/damage.d.ts} +2 -2
  21. package/dist/commands/{game-damage.js → change/damage.js} +3 -3
  22. package/dist/commands/{game-recipe-pace.d.ts → change/recipe-pace.d.ts} +2 -2
  23. package/dist/commands/{game-recipe-pace.js → change/recipe-pace.js} +4 -4
  24. package/dist/commands/config.d.ts +4 -4
  25. package/dist/commands/config.js +142 -138
  26. package/dist/commands/effect.d.ts +1 -1
  27. package/dist/commands/effect.js +11 -12
  28. package/dist/commands/find.d.ts +4 -4
  29. package/dist/commands/find.js +2 -2
  30. package/dist/commands/image.js +6 -6
  31. package/dist/commands/{import.d.ts → import/import.d.ts} +2 -2
  32. package/dist/commands/{import.js → import/import.js} +101 -101
  33. package/dist/commands/{game-import.d.ts → import/run.d.ts} +3 -3
  34. package/dist/commands/{game-import.js → import/run.js} +13 -12
  35. package/dist/commands/index.js +7 -7
  36. package/dist/commands/init.js +3 -3
  37. package/dist/commands/install.js +1 -1
  38. package/dist/commands/instructions.js +6 -6
  39. package/dist/commands/mode.d.ts +2 -2
  40. package/dist/commands/mode.js +8 -8
  41. package/dist/commands/mood.js +4 -4
  42. package/dist/commands/move.js +13 -20
  43. package/dist/commands/package.d.ts +2 -2
  44. package/dist/commands/package.js +138 -93
  45. package/dist/commands/rename.js +3 -3
  46. package/dist/commands/reveal.js +29 -18
  47. package/dist/commands/{roll.d.ts → roll/roll.d.ts} +4 -4
  48. package/dist/commands/{roll.js → roll/roll.js} +69 -69
  49. package/dist/commands/{game-tables.d.ts → roll/tables.d.ts} +2 -2
  50. package/dist/commands/{game-tables.js → roll/tables.js} +4 -4
  51. package/dist/commands/rules.d.ts +2 -2
  52. package/dist/commands/rules.js +17 -9
  53. package/dist/commands/save.d.ts +1 -1
  54. package/dist/commands/save.js +18 -18
  55. package/dist/commands/scene.d.ts +4 -4
  56. package/dist/commands/scene.js +31 -28
  57. package/dist/commands/{game-advance.d.ts → shared/advance.d.ts} +4 -4
  58. package/dist/commands/{game-advance.js → shared/advance.js} +27 -27
  59. package/dist/commands/{game-adventures.d.ts → shared/adventures.d.ts} +3 -3
  60. package/dist/commands/{game-adventures.js → shared/adventures.js} +20 -27
  61. package/dist/commands/{game-bonds.d.ts → shared/bonds.d.ts} +3 -3
  62. package/dist/commands/{game-bonds.js → shared/bonds.js} +2 -2
  63. package/dist/commands/{game-checks.d.ts → shared/checks.d.ts} +3 -3
  64. package/dist/commands/{game-checks.js → shared/checks.js} +7 -7
  65. package/dist/commands/{game-dice-pool.d.ts → shared/dice-pool.d.ts} +3 -3
  66. package/dist/commands/{game-dice-pool.js → shared/dice-pool.js} +19 -12
  67. package/dist/commands/{effect-layer.d.ts → shared/effect-layer.d.ts} +2 -2
  68. package/dist/commands/{effect-layer.js → shared/effect-layer.js} +12 -12
  69. package/dist/commands/{game-effects.d.ts → shared/effects.d.ts} +7 -7
  70. package/dist/commands/{game-effects.js → shared/effects.js} +19 -19
  71. package/dist/commands/{game-environment.d.ts → shared/environment.d.ts} +1 -1
  72. package/dist/commands/{game-environment.js → shared/environment.js} +3 -3
  73. package/dist/commands/{game-events.d.ts → shared/events.d.ts} +5 -5
  74. package/dist/commands/{game-events.js → shared/events.js} +20 -22
  75. package/dist/commands/{game-examples.d.ts → shared/examples.d.ts} +4 -8
  76. package/dist/commands/{game-examples.js → shared/examples.js} +23 -23
  77. package/dist/commands/{game-experience.d.ts → shared/experience.d.ts} +2 -2
  78. package/dist/commands/{game-experience.js → shared/experience.js} +8 -11
  79. package/dist/commands/{game-grid-moves.d.ts → shared/grid-moves.d.ts} +6 -6
  80. package/dist/commands/{game-grid-moves.js → shared/grid-moves.js} +5 -5
  81. package/dist/commands/{game-grids.d.ts → shared/grids.d.ts} +4 -9
  82. package/dist/commands/{game-grids.js → shared/grids.js} +20 -19
  83. package/dist/commands/{game-images.d.ts → shared/images.d.ts} +3 -3
  84. package/dist/commands/{game-images.js → shared/images.js} +7 -6
  85. package/dist/commands/shared/inputs.d.ts +9 -0
  86. package/dist/commands/shared/inputs.js +12 -0
  87. package/dist/commands/{game-journey.d.ts → shared/journey.d.ts} +4 -6
  88. package/dist/commands/{game-journey.js → shared/journey.js} +13 -15
  89. package/dist/commands/{game-knowledge.d.ts → shared/knowledge.d.ts} +15 -8
  90. package/dist/commands/{game-knowledge.js → shared/knowledge.js} +56 -44
  91. package/dist/{library-reader.js → commands/shared/library-reader.js} +4 -4
  92. package/dist/commands/{game-library.d.ts → shared/library.d.ts} +7 -4
  93. package/dist/commands/{game-library.js → shared/library.js} +70 -50
  94. package/dist/commands/{game-limits.d.ts → shared/limits.d.ts} +3 -3
  95. package/dist/commands/{game-limits.js → shared/limits.js} +3 -3
  96. package/dist/commands/{game-loot.d.ts → shared/loot.d.ts} +2 -2
  97. package/dist/commands/{game-loot.js → shared/loot.js} +3 -3
  98. package/dist/commands/{game-master-rolls.d.ts → shared/master-rolls.d.ts} +2 -2
  99. package/dist/commands/{game-master-rolls.js → shared/master-rolls.js} +6 -6
  100. package/dist/commands/{game-mode.d.ts → shared/mode.d.ts} +4 -6
  101. package/dist/commands/{game-mode.js → shared/mode.js} +10 -10
  102. package/dist/commands/{game-money.d.ts → shared/money.d.ts} +3 -3
  103. package/dist/commands/{game-money.js → shared/money.js} +4 -4
  104. package/dist/commands/{game-moods.d.ts → shared/moods.d.ts} +3 -3
  105. package/dist/commands/{game-moods.js → shared/moods.js} +3 -3
  106. package/dist/commands/{game-moves.d.ts → shared/moves.d.ts} +2 -2
  107. package/dist/commands/{game-moves.js → shared/moves.js} +5 -5
  108. package/dist/commands/{game-offers.d.ts → shared/offers.d.ts} +3 -3
  109. package/dist/commands/{game-offers.js → shared/offers.js} +9 -12
  110. package/dist/commands/{game-outside.d.ts → shared/outside.d.ts} +3 -3
  111. package/dist/commands/{game-outside.js → shared/outside.js} +9 -9
  112. package/dist/commands/{game-catalog.d.ts → shared/packages/catalog.d.ts} +1 -3
  113. package/dist/commands/{game-catalog.js → shared/packages/catalog.js} +17 -22
  114. package/dist/commands/{game-package-code.d.ts → shared/packages/code.d.ts} +10 -14
  115. package/dist/commands/{game-package-code.js → shared/packages/code.js} +156 -59
  116. package/dist/commands/{game-extension-list.d.ts → shared/packages/extensions.d.ts} +6 -6
  117. package/dist/commands/{game-extension-list.js → shared/packages/extensions.js} +43 -22
  118. package/dist/commands/{game-package-hooks.d.ts → shared/packages/hooks.d.ts} +3 -3
  119. package/dist/commands/{game-package-hooks.js → shared/packages/hooks.js} +3 -3
  120. package/dist/commands/{game-widgets.d.ts → shared/packages/widgets.d.ts} +6 -10
  121. package/dist/commands/{game-widgets.js → shared/packages/widgets.js} +57 -57
  122. package/dist/commands/{page-counters.d.ts → shared/page-counters.d.ts} +3 -3
  123. package/dist/commands/{page-counters.js → shared/page-counters.js} +5 -5
  124. package/dist/{page-words.d.ts → commands/shared/page-words.d.ts} +2 -2
  125. package/dist/{page-words.js → commands/shared/page-words.js} +5 -4
  126. package/dist/commands/{parts.d.ts → shared/parts.d.ts} +3 -3
  127. package/dist/commands/{parts.js → shared/parts.js} +4 -4
  128. package/dist/commands/{game-positions.d.ts → shared/positions.d.ts} +3 -5
  129. package/dist/commands/{game-positions.js → shared/positions.js} +6 -7
  130. package/dist/commands/{problems.d.ts → shared/problems.d.ts} +3 -3
  131. package/dist/commands/{problems.js → shared/problems.js} +21 -22
  132. package/dist/commands/{progression.d.ts → shared/progression.d.ts} +2 -2
  133. package/dist/commands/{progression.js → shared/progression.js} +4 -4
  134. package/dist/commands/{game-quests.d.ts → shared/quests.d.ts} +4 -4
  135. package/dist/commands/{game-quests.js → shared/quests.js} +6 -6
  136. package/dist/commands/{game-recipes.d.ts → shared/recipes.d.ts} +3 -3
  137. package/dist/commands/{game-recipes.js → shared/recipes.js} +3 -3
  138. package/dist/commands/{game-reminders.d.ts → shared/reminders.d.ts} +4 -4
  139. package/dist/commands/{game-reminders.js → shared/reminders.js} +4 -4
  140. package/dist/commands/{game-roads.d.ts → shared/roads.d.ts} +5 -5
  141. package/dist/commands/{game-roads.js → shared/roads.js} +43 -44
  142. package/dist/commands/{game-rules.d.ts → shared/rules.d.ts} +13 -5
  143. package/dist/commands/shared/rules.js +66 -0
  144. package/dist/commands/{game-saves.d.ts → shared/saves.d.ts} +4 -4
  145. package/dist/commands/{game-saves.js → shared/saves.js} +51 -51
  146. package/dist/commands/{game-scene.d.ts → shared/scene.d.ts} +13 -3
  147. package/dist/commands/{game-scene.js → shared/scene.js} +41 -13
  148. package/dist/commands/{sheet.d.ts → shared/sheet.d.ts} +5 -5
  149. package/dist/commands/{sheet.js → shared/sheet.js} +76 -76
  150. package/dist/commands/{game-stacks.d.ts → shared/stacks.d.ts} +2 -9
  151. package/dist/commands/{game-stacks.js → shared/stacks.js} +22 -22
  152. package/dist/commands/{game-theme.d.ts → shared/theme.d.ts} +3 -3
  153. package/dist/commands/{game-theme.js → shared/theme.js} +2 -2
  154. package/dist/commands/{game-thoughts.d.ts → shared/thoughts.d.ts} +2 -4
  155. package/dist/commands/{game-thoughts.js → shared/thoughts.js} +6 -8
  156. package/dist/commands/{game-thresholds.d.ts → shared/thresholds.d.ts} +1 -1
  157. package/dist/commands/{game-thresholds.js → shared/thresholds.js} +4 -4
  158. package/dist/commands/{game-time.d.ts → shared/time.d.ts} +4 -4
  159. package/dist/commands/{game-time.js → shared/time.js} +6 -6
  160. package/dist/commands/{game-turn-uses.d.ts → shared/turn-uses.d.ts} +3 -3
  161. package/dist/commands/{game-turn-uses.js → shared/turn-uses.js} +12 -15
  162. package/dist/commands/{game-upkeep.d.ts → shared/upkeep.d.ts} +3 -3
  163. package/dist/commands/{game-upkeep.js → shared/upkeep.js} +69 -57
  164. package/dist/commands/{game-voices.d.ts → shared/voices.d.ts} +1 -1
  165. package/dist/commands/{game-voices.js → shared/voices.js} +2 -2
  166. package/dist/commands/{worked-out.d.ts → shared/worked-out.d.ts} +3 -8
  167. package/dist/commands/{worked-out.js → shared/worked-out.js} +238 -238
  168. package/dist/commands/{game-world.d.ts → shared/world.d.ts} +5 -14
  169. package/dist/commands/{game-world.js → shared/world.js} +72 -76
  170. package/dist/commands/show.d.ts +4 -1
  171. package/dist/commands/show.js +36 -18
  172. package/dist/commands/status.d.ts +1 -1
  173. package/dist/commands/status.js +28 -28
  174. package/dist/commands/thoughts.js +3 -3
  175. package/dist/commands/trade.js +9 -10
  176. package/dist/commands/translate.d.ts +1 -1
  177. package/dist/commands/translate.js +3 -3
  178. package/dist/commands/{game-open.d.ts → travel/open.d.ts} +3 -3
  179. package/dist/commands/{game-open.js → travel/open.js} +4 -5
  180. package/dist/commands/{route.d.ts → travel/route.d.ts} +1 -1
  181. package/dist/commands/{route.js → travel/route.js} +9 -10
  182. package/dist/commands/{travel.d.ts → travel/travel.d.ts} +2 -2
  183. package/dist/commands/{travel.js → travel/travel.js} +19 -21
  184. package/dist/commands/validate.js +5 -5
  185. package/dist/commands/{game-view-journal.d.ts → view/journal.d.ts} +5 -5
  186. package/dist/commands/{game-view-journal.js → view/journal.js} +5 -5
  187. package/dist/commands/{game-view-map.d.ts → view/map.d.ts} +3 -3
  188. package/dist/commands/{game-view-map.js → view/map.js} +15 -16
  189. package/dist/commands/{game-view-place.d.ts → view/place.d.ts} +6 -6
  190. package/dist/commands/{game-view-place.js → view/place.js} +108 -108
  191. package/dist/commands/{view.d.ts → view/view.d.ts} +16 -16
  192. package/dist/commands/{view.js → view/view.js} +41 -36
  193. package/dist/commands/{game-view-world.d.ts → view/world.d.ts} +4 -4
  194. package/dist/commands/{game-view-world.js → view/world.js} +7 -7
  195. package/dist/commands/{game-here.d.ts → write/here.d.ts} +5 -3
  196. package/dist/commands/{game-here.js → write/here.js} +18 -12
  197. package/dist/commands/{write.d.ts → write/write.d.ts} +6 -6
  198. package/dist/commands/{write.js → write/write.js} +44 -41
  199. package/dist/confirm/confirm.d.ts +2 -0
  200. package/dist/confirm/confirm.js +15 -5
  201. package/dist/core/consents.d.ts +3 -2
  202. package/dist/core/consents.js +43 -4
  203. package/dist/core/context.d.ts +8 -6
  204. package/dist/core/context.js +4 -2
  205. package/dist/core/download.js +16 -5
  206. package/dist/core/files.d.ts +8 -1
  207. package/dist/core/files.js +53 -21
  208. package/dist/core/formula.d.ts +7 -2
  209. package/dist/core/formula.js +63 -66
  210. package/dist/core/instruction-parts.js +1 -1
  211. package/dist/core/mood.d.ts +0 -1
  212. package/dist/core/mood.js +3 -3
  213. package/dist/core/package-api.d.ts +11 -0
  214. package/dist/core/package-api.js +2 -1
  215. package/dist/core/package-declarations.d.ts +9 -9
  216. package/dist/core/package-declarations.js +3 -3
  217. package/dist/core/process-mark.d.ts +8 -0
  218. package/dist/core/process-mark.js +72 -0
  219. package/dist/core/registry.d.ts +5 -0
  220. package/dist/core/registry.js +10 -0
  221. package/dist/core/session-store.d.ts +0 -1
  222. package/dist/core/session-store.js +11 -14
  223. package/dist/core/store.d.ts +4 -0
  224. package/dist/core/store.js +29 -8
  225. package/dist/core/text.d.ts +4 -0
  226. package/dist/core/text.js +11 -2
  227. package/dist/core/yaml-file.js +2 -2
  228. package/dist/dashboard/{acts.js → acts/acts.js} +2 -2
  229. package/dist/dashboard/{act-names.js → acts/names.js} +1 -1
  230. package/dist/dashboard/{act-sheet.js → acts/sheet.js} +3 -3
  231. package/dist/dashboard/{act-strip.js → acts/strip.js} +2 -2
  232. package/dist/dashboard/app.js +13 -13
  233. package/dist/dashboard/asked.js +1 -1
  234. package/dist/dashboard/dice/burn.js +1 -1
  235. package/dist/dashboard/dice/stage.js +1 -1
  236. package/dist/dashboard/game-words.js +4 -4
  237. package/dist/dashboard/{guide-blocks.js → help/blocks.js} +1 -1
  238. package/dist/dashboard/{help.js → help/help.js} +6 -6
  239. package/dist/dashboard/journal.js +1 -1
  240. package/dist/dashboard/kit.js +6 -5
  241. package/dist/dashboard/labels.js +7 -3
  242. package/dist/dashboard/markdown.js +1 -1
  243. package/dist/dashboard/{ask-card.js → packages/ask-card.js} +6 -6
  244. package/dist/dashboard/{package-page.js → packages/package-page.js} +3 -3
  245. package/dist/dashboard/{packages.js → packages/packages.js} +12 -12
  246. package/dist/dashboard/{page-code.js → packages/page-code.js} +4 -4
  247. package/dist/dashboard/{extension-widgets.js → packages/widgets.js} +5 -5
  248. package/dist/dashboard/party.js +1 -1
  249. package/dist/dashboard/person-panel.js +2 -13
  250. package/dist/dashboard/{map-sheet.js → place/map-sheet.js} +4 -4
  251. package/dist/dashboard/{place-map-view.js → place/map-view.js} +11 -11
  252. package/dist/dashboard/scene.js +4 -4
  253. package/dist/dashboard/settings.js +1 -1
  254. package/dist/dashboard/sheet.js +4 -4
  255. package/dist/dashboard/text.js +6 -0
  256. package/dist/dashboard/top.js +2 -2
  257. package/dist/dashboard/turns.js +2 -2
  258. package/dist/dashboard/widgets.js +1 -1
  259. package/dist/dashboard/{world-calendar.js → world/calendar.js} +7 -7
  260. package/dist/dashboard/{lore.js → world/known.js} +1 -1
  261. package/dist/dashboard/{world-lore.js → world/lore.js} +9 -9
  262. package/dist/dashboard/{world-map.js → world/map.js} +1 -1
  263. package/dist/dashboard/{world.js → world/world.js} +14 -14
  264. package/dist/dice/evaluate.js +1 -1
  265. package/dist/dice/index.d.ts +2 -2
  266. package/dist/dice/index.js +2 -2
  267. package/dist/dice/notation.d.ts +2 -0
  268. package/dist/dice/notation.js +22 -4
  269. package/dist/documents/markup.js +2 -2
  270. package/dist/documents/read.js +29 -13
  271. package/dist/effects/effect.js +2 -5
  272. package/dist/extensions/extension.js +6 -8
  273. package/dist/extensions/index.d.ts +1 -4
  274. package/dist/extensions/index.js +1 -4
  275. package/dist/extensions/words.js +2 -1
  276. package/dist/{pictures → helpers}/briefs.js +17 -14
  277. package/dist/{pictures → helpers}/claude.js +8 -18
  278. package/dist/{pictures → helpers}/codex.js +3 -15
  279. package/dist/helpers/index.d.ts +7 -0
  280. package/dist/helpers/index.js +9 -0
  281. package/dist/{pictures/helpers.d.ts → helpers/programs.d.ts} +6 -1
  282. package/dist/{pictures/helpers.js → helpers/programs.js} +16 -2
  283. package/dist/images/images.js +7 -5
  284. package/dist/images/index.d.ts +1 -1
  285. package/dist/images/index.js +1 -1
  286. package/dist/importer/index.d.ts +1 -1
  287. package/dist/importer/index.js +1 -1
  288. package/dist/importer/work.d.ts +0 -2
  289. package/dist/importer/work.js +9 -30
  290. package/dist/instructions/index.d.ts +2 -0
  291. package/dist/instructions/index.js +10 -0
  292. package/dist/languages/index.d.ts +1 -1
  293. package/dist/languages/index.js +1 -1
  294. package/dist/languages/language-pack.js +15 -3
  295. package/dist/library/books.js +29 -83
  296. package/dist/{extensions → packages}/engine.d.ts +1 -1
  297. package/dist/{extensions → packages}/engine.js +1 -1
  298. package/dist/packages/index.d.ts +3 -0
  299. package/dist/packages/index.js +4 -0
  300. package/dist/{extensions/packages.d.ts → packages/npm.d.ts} +2 -0
  301. package/dist/{extensions/packages.js → packages/npm.js} +74 -45
  302. package/dist/page.d.ts +9 -11
  303. package/dist/page.js +1 -2
  304. package/dist/pages/check.js +31 -40
  305. package/dist/pages/containers.js +20 -20
  306. package/dist/pages/environment.js +15 -15
  307. package/dist/pages/index.d.ts +9 -9
  308. package/dist/pages/index.js +9 -9
  309. package/dist/pages/inheritance.d.ts +2 -1
  310. package/dist/pages/inheritance.js +24 -24
  311. package/dist/pages/load.js +7 -7
  312. package/dist/pages/maps.d.ts +20 -0
  313. package/dist/pages/maps.js +51 -1
  314. package/dist/pages/markdown.d.ts +2 -0
  315. package/dist/pages/markdown.js +110 -79
  316. package/dist/pages/page-file.d.ts +2 -1
  317. package/dist/pages/page-file.js +31 -29
  318. package/dist/pages/rename-page.d.ts +4 -1
  319. package/dist/pages/rename-page.js +7 -3
  320. package/dist/pages/{stack-entry.d.ts → stacks/entry.d.ts} +0 -2
  321. package/dist/pages/{stack-entry.js → stacks/entry.js} +2 -6
  322. package/dist/pages/{stacks.d.ts → stacks/kinds.d.ts} +8 -1
  323. package/dist/pages/{stacks.js → stacks/kinds.js} +36 -41
  324. package/dist/pages/{stack-writes.d.ts → stacks/writes.d.ts} +2 -2
  325. package/dist/pages/{stack-writes.js → stacks/writes.js} +32 -32
  326. package/dist/pages/system-pages.js +15 -15
  327. package/dist/pages/world.d.ts +4 -0
  328. package/dist/pages/world.js +52 -20
  329. package/dist/pages/write-page.js +35 -34
  330. package/dist/player-notes/index.d.ts +1 -1
  331. package/dist/player-notes/index.js +1 -1
  332. package/dist/rules/page-search.js +3 -4
  333. package/dist/rules/rule-book.js +1 -1
  334. package/dist/rules/search.js +21 -21
  335. package/dist/rules/shown.js +1 -3
  336. package/dist/saves/saves.d.ts +2 -2
  337. package/dist/saves/saves.js +15 -3
  338. package/dist/{bell-listener.js → server/bell-listener.js} +3 -3
  339. package/dist/server/dashboard/files.d.ts +59 -0
  340. package/dist/server/dashboard/files.js +326 -0
  341. package/dist/server/dashboard/index.d.ts +114 -0
  342. package/dist/server/dashboard/index.js +419 -0
  343. package/dist/server/dashboard/news.d.ts +39 -0
  344. package/dist/server/dashboard/news.js +390 -0
  345. package/dist/server/dashboard/player.d.ts +48 -0
  346. package/dist/server/dashboard/player.js +242 -0
  347. package/dist/server/dashboard/ports.d.ts +10 -0
  348. package/dist/server/dashboard/ports.js +15 -0
  349. package/dist/server/dashboard/writes.d.ts +58 -0
  350. package/dist/server/dashboard/writes.js +492 -0
  351. package/dist/{mcp-server.d.ts → server/mcp.d.ts} +2 -2
  352. package/dist/{mcp-server.js → server/mcp.js} +57 -42
  353. package/dist/systems/game-system.d.ts +5 -3
  354. package/dist/systems/game-system.js +178 -149
  355. package/dist/systems/index.d.ts +1 -1
  356. package/dist/systems/index.js +1 -1
  357. package/dist/{testing.d.ts → testing/index.d.ts} +6 -6
  358. package/dist/{testing.js → testing/index.js} +32 -18
  359. package/dist/{system-checks.js → testing/system-checks.js} +18 -12
  360. package/dist/themes/theme.d.ts +3 -3
  361. package/dist/themes/theme.js +14 -14
  362. package/dist/time/calendar.js +5 -2
  363. package/dist/triggers/trigger.js +5 -8
  364. package/instructions/dashboard-guide.md +2 -1
  365. package/instructions/play.md +1 -1
  366. package/package.json +5 -5
  367. package/dist/commands/game-maps.d.ts +0 -20
  368. package/dist/commands/game-maps.js +0 -51
  369. package/dist/commands/game-rules.js +0 -36
  370. package/dist/dashboard-server.d.ts +0 -47
  371. package/dist/dashboard-server.js +0 -1830
  372. package/dist/pictures/index.d.ts +0 -7
  373. package/dist/pictures/index.js +0 -9
  374. /package/dist/{cli.d.ts → cli/cli.d.ts} +0 -0
  375. /package/dist/{library-reader.d.ts → commands/shared/library-reader.d.ts} +0 -0
  376. /package/dist/commands/{notes.d.ts → shared/notes.d.ts} +0 -0
  377. /package/dist/commands/{notes.js → shared/notes.js} +0 -0
  378. /package/dist/dashboard/{guide-markdown.js → help/markdown.js} +0 -0
  379. /package/dist/dashboard/{pack-card.js → packages/card.js} +0 -0
  380. /package/dist/dashboard/{people.js → packages/people.js} +0 -0
  381. /package/dist/dashboard/{place-map.js → place/map.js} +0 -0
  382. /package/dist/dashboard/{calendar.js → world/days.js} +0 -0
  383. /package/dist/{pictures → helpers}/briefs.d.ts +0 -0
  384. /package/dist/{pictures → helpers}/chosen.d.ts +0 -0
  385. /package/dist/{pictures → helpers}/chosen.js +0 -0
  386. /package/dist/{pictures → helpers}/claude.d.ts +0 -0
  387. /package/dist/{pictures → helpers}/codex.d.ts +0 -0
  388. /package/dist/{pictures → helpers}/stop.d.ts +0 -0
  389. /package/dist/{pictures → helpers}/stop.js +0 -0
  390. /package/dist/{pictures → helpers}/svg.d.ts +0 -0
  391. /package/dist/{pictures → helpers}/svg.js +0 -0
  392. /package/dist/{extensions → packages}/tarball.d.ts +0 -0
  393. /package/dist/{extensions → packages}/tarball.js +0 -0
  394. /package/dist/{bell-listener.d.ts → server/bell-listener.d.ts} +0 -0
  395. /package/dist/{player-acts.d.ts → server/player-acts.d.ts} +0 -0
  396. /package/dist/{player-acts.js → server/player-acts.js} +0 -0
  397. /package/dist/{system-checks.d.ts → testing/system-checks.d.ts} +0 -0
@@ -5,7 +5,7 @@ import { watch } from "node:fs";
5
5
  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
- import { FileStore, isInside, readText } from "./store.js";
8
+ import { FileStore, isInside, readText, wroteInCall } from "./store.js";
9
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
10
  // and log.
11
11
  const watchedTrees = ["world", "rules", "images"];
@@ -24,7 +24,6 @@ export class SessionStore extends FileStore {
24
24
  checkAll = false;
25
25
  unwatchable = false;
26
26
  changes = 0;
27
- wrote = false;
28
27
  // The files changed outside the session since they were last taken, each with its text before; and who reads the world before they are let in (OUT-1).
29
28
  outside = new Map();
30
29
  beforeOutside;
@@ -66,7 +65,6 @@ export class SessionStore extends FileStore {
66
65
  */
67
66
  async ready(everything = false) {
68
67
  await new Promise((done) => setImmediate(done));
69
- this.wrote = false;
70
68
  this.forgetPassing();
71
69
  if (everything || this.checkAll || this.unwatchable || this.changes > tooManyChanges) {
72
70
  this.checking ??= this.checkEverything().finally(() => (this.checking = undefined));
@@ -90,7 +88,7 @@ export class SessionStore extends FileStore {
90
88
  this.changed(path, { text: now }, now !== undefined);
91
89
  this.checkAll = true;
92
90
  const name = this.shownPath(resolve(path));
93
- throw new Error(this.wrote
91
+ throw new Error(wroteInCall()
94
92
  ? `${name} was changed by hand since this call read it, so the command stopped before writing it, after other files: look at them again with status and validate, and finish by hand only what is missing.`
95
93
  : `${name} was changed by hand since this call read it, so the command wrote nothing: look at it again, as with show or status, and repeat the command if it still fits.`);
96
94
  }
@@ -99,22 +97,18 @@ export class SessionStore extends FileStore {
99
97
  write(path, text) {
100
98
  this.freezeOutside(path);
101
99
  super.write(path, text);
102
- this.wrote = true;
103
100
  }
104
101
  append(path, text) {
105
102
  this.freezeOutside(path);
106
103
  super.append(path, text);
107
- this.wrote = true;
108
104
  }
109
105
  writeBytes(path, bytes) {
110
106
  this.freezeOutside(path);
111
107
  super.writeBytes(path, bytes);
112
- this.wrote = true;
113
108
  }
114
109
  remove(path) {
115
110
  this.freezeOutside(path);
116
111
  super.remove(path);
117
- this.wrote = true;
118
112
  }
119
113
  /** Stops watching, as the server closes. */
120
114
  close() {
@@ -235,19 +229,22 @@ export class SessionStore extends FileStore {
235
229
  this.checkAll = false;
236
230
  this.changes = 0;
237
231
  const paths = [...this.kept.keys()].filter((path) => [...this.roots].some((root) => isInside(root, path)));
238
- const texts = await Promise.all(paths.map((path) => readFile(path, "utf8").catch(() => undefined)));
232
+ const before = paths.map((path) => this.kept.get(path));
233
+ const read = await Promise.all(paths.map((path) => readFile(path, "utf8").catch(() => undefined)));
234
+ // A file the session wrote while they were read keeps the text it wrote, never the one read before.
235
+ const settled = paths.flatMap((path, index) => (this.kept.get(path) === before[index] ? [{ path, text: read[index] }] : []));
239
236
  // The files that came into a folder listed, which the session did not write: new, outside it (OUT-1).
240
237
  const listed = [...this.listings].filter(([folder]) => [...this.roots].some((root) => folder === root || isInside(root, folder)));
241
238
  const added = listed.flatMap(([folder, listing]) => {
242
239
  const known = new Set(listing);
243
240
  return filesIn(folder, () => true).filter((path) => !known.has(path) && !this.kept.has(path));
244
241
  });
245
- this.noteOutside([...paths.filter((path, index) => this.kept.get(path)?.text !== texts[index]), ...new Set(added)]);
246
- paths.forEach((path, index) => {
247
- if (this.kept.get(path)?.text !== texts[index]) {
248
- this.changed(path, { text: texts[index] }, texts[index] !== undefined);
242
+ this.noteOutside([...settled.filter(({ path, text }) => this.kept.get(path)?.text !== text).map(({ path }) => path), ...new Set(added)]);
243
+ for (const { path, text } of settled) {
244
+ if (this.kept.get(path)?.text !== text) {
245
+ this.changed(path, { text }, text !== undefined);
249
246
  }
250
- });
247
+ }
251
248
  this.roots.forEach((root) => {
252
249
  this.forgetUnder(root, false);
253
250
  this.watchFolders(root);
@@ -52,6 +52,8 @@ export declare class FileStore {
52
52
  append(path: string, text: string): void;
53
53
  /** Makes a folder, with those it needs, if it is not there. */
54
54
  makeFolder(path: string): void;
55
+ /** How many bytes a file has, as the disk says now, without reading it; undefined when there is none. */
56
+ size(path: string): number | undefined;
55
57
  /** When a file last changed, in milliseconds, as the disk says now; undefined when there is none. */
56
58
  modified(path: string): number | undefined;
57
59
  /** Removes a file. */
@@ -78,6 +80,8 @@ export declare class FileStore {
78
80
  export declare function files(): FileStore;
79
81
  /** Runs `work` with `store` as the store its modules read and write through; a command run inside another keeps that one's. */
80
82
  export declare function withFiles<T>(store: FileStore, work: () => T): T;
83
+ /** Whether the running call has written a file yet; false outside a call. */
84
+ export declare function wroteInCall(): boolean;
81
85
  /** Whether a path is inside a folder, below it: a folder named like "..notes" is inside too. */
82
86
  export declare function isInside(folder: string, path: string): boolean;
83
87
  /** The text of a file, or undefined when there is none: a folder or a file that cannot be read fails as before. */
@@ -3,7 +3,7 @@
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
4
  import { appendFileSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
5
5
  import { basename, dirname, isAbsolute, relative, resolve, sep } from "node:path";
6
- import { filesIn } from "./files.js";
6
+ import { fileOrder, filesIn } from "./files.js";
7
7
  import { frozen } from "./frozen.js";
8
8
  /**
9
9
  * The files of the installed game systems, kept for the whole process while none changes after it was read: a process that runs many calls, as the tests do,
@@ -103,12 +103,14 @@ export class FileStore {
103
103
  mkdirSync(dirname(path), { recursive: true });
104
104
  writeFileSync(path, text, "utf8");
105
105
  this.changed(path, { text }, true);
106
+ markWritten();
106
107
  }
107
108
  /** Writes a file's bytes as they are, with the folders it needs, as a save gives them back: what the store kept of it is read again. */
108
109
  writeBytes(path, bytes) {
109
110
  mkdirSync(dirname(path), { recursive: true });
110
111
  writeFileSync(path, bytes);
111
112
  this.changed(path, undefined, true);
113
+ markWritten();
112
114
  }
113
115
  /** Adds text at the end of a file, as the log grows. */
114
116
  append(path, text) {
@@ -116,11 +118,16 @@ export class FileStore {
116
118
  appendFileSync(path, text, "utf8");
117
119
  // A file never read stays to be read: what is kept of it would be only its end.
118
120
  this.changed(path, before === undefined ? undefined : { text: `${before.text ?? ""}${text}` }, true);
121
+ markWritten();
119
122
  }
120
123
  /** Makes a folder, with those it needs, if it is not there. */
121
124
  makeFolder(path) {
122
125
  mkdirSync(path, { recursive: true });
123
126
  }
127
+ /** How many bytes a file has, as the disk says now, without reading it; undefined when there is none. */
128
+ size(path) {
129
+ return existsSync(path) && statSync(path).isFile() ? statSync(path).size : undefined;
130
+ }
124
131
  /** When a file last changed, in milliseconds, as the disk says now; undefined when there is none. */
125
132
  modified(path) {
126
133
  return existsSync(path) ? statSync(path).mtimeMs : undefined;
@@ -129,6 +136,7 @@ export class FileStore {
129
136
  remove(path) {
130
137
  rmSync(path);
131
138
  this.changed(path, { text: undefined }, false);
139
+ markWritten();
132
140
  }
133
141
  entry(path) {
134
142
  const key = resolve(path);
@@ -176,6 +184,7 @@ export class FileStore {
176
184
  const listed = listing.includes(key);
177
185
  if (inside && exists && !listed) {
178
186
  listing.push(key);
187
+ listing.sort(fileOrder);
179
188
  }
180
189
  else if (inside && !exists && listed) {
181
190
  listing.splice(listing.indexOf(key), 1);
@@ -199,25 +208,25 @@ export class FileStore {
199
208
  }
200
209
  }
201
210
  }
211
+ // The running call: its store, and whether it wrote a file yet, its own even when a session's store serves several calls at once (D-196).
202
212
  const running = new AsyncLocalStorage();
203
213
  /** The store of the running command; outside one, a new store for each use, which reads the files as they are. */
204
214
  export function files() {
205
- return running.getStore() ?? new FileStore();
215
+ return running.getStore()?.store ?? new FileStore();
206
216
  }
207
217
  /** Runs `work` with `store` as the store its modules read and write through; a command run inside another keeps that one's. */
208
218
  export function withFiles(store, work) {
209
- return running.getStore() === undefined ? running.run(store, work) : work();
219
+ return running.getStore() === undefined ? running.run({ store, wrote: false }, work) : work();
220
+ }
221
+ /** Whether the running call has written a file yet; false outside a call. */
222
+ export function wroteInCall() {
223
+ return running.getStore()?.wrote === true;
210
224
  }
211
225
  /** Whether a path is inside a folder, below it: a folder named like "..notes" is inside too. */
212
226
  export function isInside(folder, path) {
213
227
  const below = relative(folder, path);
214
228
  return below !== "" && below !== ".." && !below.startsWith(`..${sep}`) && !isAbsolute(below);
215
229
  }
216
- /** Whether a file changed after a time, or is gone. */
217
- function changedSince(path, time) {
218
- const stats = statSync(path, { throwIfNoEntry: false });
219
- return stats === undefined || stats.mtimeMs >= time;
220
- }
221
230
  /** The text of a file, or undefined when there is none: a folder or a file that cannot be read fails as before. */
222
231
  export function readText(path) {
223
232
  try {
@@ -230,3 +239,15 @@ export function readText(path) {
230
239
  throw error;
231
240
  }
232
241
  }
242
+ /** Whether a file changed after a time, or is gone. */
243
+ function changedSince(path, time) {
244
+ const stats = statSync(path, { throwIfNoEntry: false });
245
+ return stats === undefined || stats.mtimeMs >= time;
246
+ }
247
+ /** Notes that the running call wrote a file, which a stop before its next write says (D-196). */
248
+ function markWritten() {
249
+ const call = running.getStore();
250
+ if (call !== undefined) {
251
+ call.wrote = true;
252
+ }
253
+ }
@@ -1,5 +1,9 @@
1
1
  /** A name as it is compared: any case, accents written either way (NFC) and a curly apostrophe as a straight one (SYS-5), so that "Città" from any system matches "città". */
2
2
  export declare function comparableText(text: string): string;
3
+ /** How many words a text has, as the spaces part them. */
4
+ export declare function wordCount(text: string): number;
5
+ /** How long a text is, in words: a Chinese, Japanese or Korean letter counts as one, as a model reads it; else about six letters a word. */
6
+ export declare function textSize(text: string): number;
3
7
  /** The first sentence of a text, up to its first ". ", as the help and the commands' reference give a command's description. */
4
8
  export declare function firstSentence(text: string): string;
5
9
  /** A noun with its article, as messages write it: "a character", "an item". */
package/dist/core/text.js CHANGED
@@ -5,8 +5,14 @@ export function comparableText(text) {
5
5
  return text.length > 200 ? comparable(text) : rememberedComparable(text);
6
6
  }
7
7
  const rememberedComparable = rememberedByText(comparable);
8
- function comparable(text) {
9
- return text.normalize("NFC").toLowerCase().replace(/[‘’]/g, "'");
8
+ /** How many words a text has, as the spaces part them. */
9
+ export function wordCount(text) {
10
+ return text.split(/\s+/).filter((word) => word !== "").length;
11
+ }
12
+ /** How long a text is, in words: a Chinese, Japanese or Korean letter counts as one, as a model reads it; else about six letters a word. */
13
+ export function textSize(text) {
14
+ const letters = text.match(/[\u3040-\u30ff\u3400-\u9fff\uac00-\ud7af]/gu)?.length ?? 0;
15
+ return Math.max(wordCount(text) + letters, Math.ceil(text.length / 6));
10
16
  }
11
17
  /** The first sentence of a text, up to its first ". ", as the help and the commands' reference give a command's description. */
12
18
  export function firstSentence(text) {
@@ -42,3 +48,6 @@ export function valueNamed(record, name) {
42
48
  export function linkTargetName(target) {
43
49
  return (target.replace(/\\$/, "").split("/").at(-1) ?? "").replace(/\.md$/i, "").trim();
44
50
  }
51
+ function comparable(text) {
52
+ return text.normalize("NFC").toLowerCase().replace(/[‘’]/g, "'");
53
+ }
@@ -19,8 +19,8 @@ export function writeYamlFile(path, document) {
19
19
  /** The text of a YAML file as a document, refused with the file's name when it is not valid YAML or does not hold keys and values. */
20
20
  function documentOf(path, text, holds) {
21
21
  const document = parseDocument(text);
22
- // Only the first line of the parser's message: the rest quotes the file.
23
- const invalid = (message) => new Error(`${basename(path)} is not valid YAML; fix it by hand: ${message.split("\n")[0]}`);
22
+ // Only the first line of the parser's message, without the colon that leads to the rest, which quotes the file.
23
+ const invalid = (message) => new Error(`${basename(path)} is not valid YAML; fix it by hand: ${message.split("\n")[0].replace(/:\s*$/, "")}`);
24
24
  if (document.errors.length > 0) {
25
25
  throw invalid(document.errors[0].message);
26
26
  }
@@ -1,5 +1,5 @@
1
- import { strangerLabel } from "./labels.js";
2
- import { t } from "./text.js";
1
+ import { strangerLabel } from "../labels.js";
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 = {};
5
5
  /** Sets the game system's own verbs; none, the engine's alone. */
@@ -2,8 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-ru
2
2
  // What starts the player's action (D-495): a thing's name of the sheet, or someone's, as a button where the page has the player's actions; else as it was.
3
3
  import { createContext } from "preact";
4
4
  import { useContext } from "preact/hooks";
5
+ import { t } from "../text.js";
5
6
  import { actTitle } from "./acts.js";
6
- import { t } from "./text.js";
7
7
  /** The player's actions where the page has them: none for a system that names none, and the page is as it was. */
8
8
  export const PlayerActsContext = createContext(undefined);
9
9
  /** The player's actions, when the page has them. */
@@ -1,9 +1,9 @@
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";
5
+ import { t } from "../text.js";
3
6
  import { actPeople, actSentence, actTitle, spokenBy, talkSentence, targetMode, verbLabel } from "./acts.js";
4
- import { Icon } from "./icons.js";
5
- import { PlaceMap } from "./place-map-view.js";
6
- import { t } from "./text.js";
7
7
  // How many characters a sentence may have, as the server takes them.
8
8
  const mostWords = 500;
9
9
  /**
@@ -2,8 +2,8 @@ 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";
6
- import { t } from "./text.js";
5
+ import { Icon } from "../icons.js";
6
+ import { t } from "../text.js";
7
7
  export function ActStrip({ entries, problem, onWithdraw, onCopy, onDismiss }) {
8
8
  const before = useRef(new Map());
9
9
  const [told, setTold] = useState("");
@@ -3,33 +3,33 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-ru
3
3
  // names and the table beside it, the turns of a fight, the followed quest and the rolls (D-279), read again whenever the server says something changed.
4
4
  import { render } from "preact";
5
5
  import { useEffect, useMemo, useRef, useState } from "preact/hooks";
6
- import { PlayerActsContext } from "./act-names.js";
7
- import { ActSheet } from "./act-sheet.js";
8
- import { ActStrip } from "./act-strip.js";
9
- import { saidStates, setSystemVerbs } from "./acts.js";
6
+ import { saidStates, setSystemVerbs } from "./acts/acts.js";
7
+ import { PlayerActsContext } from "./acts/names.js";
8
+ import { ActSheet } from "./acts/sheet.js";
9
+ import { ActStrip } from "./acts/strip.js";
10
10
  import { readAddress, sectionAddress } from "./address.js";
11
11
  import { answer, closeCard, readActs, readAsked, readGameTheme, readModules, readView, readWidgets, sayAct, sendSeen, withdrawAct } from "./api.js";
12
- import { AskCard } from "./ask-card.js";
13
12
  import { AskedDice } from "./asked-dice.js";
14
13
  import { AskedBanner } from "./asked.js";
15
14
  import { useMedia } from "./card.js";
16
15
  import { flies } from "./dice/pool.js";
17
16
  import { DiceTray } from "./dice/tray.js";
18
- import { WidgetCards, WidgetsContext } from "./extension-widgets.js";
19
17
  import { PageFoot } from "./footer.js";
20
18
  import { readFree, withFree, writeFree } from "./free-rolls.js";
21
- import { Help } from "./help.js";
19
+ import { Help } from "./help/help.js";
22
20
  import { Icon } from "./icons.js";
23
21
  import { FollowedQuests, JournalView, QuestEndings } from "./journal.js";
24
22
  import { checkOf, systemNameLabel } from "./labels.js";
25
23
  import { gameNotices, importNotices, Notices } from "./notices.js";
26
- import { inCard, nextPackCard } from "./pack-card.js";
27
- import { PackagePage } from "./package-page.js";
28
- import { PackagesPage } from "./packages.js";
29
- import { codeOfModule, ModulesContext, ownKey, preloadModules, systemPageStyle, useNavPages } from "./page-code.js";
24
+ import { AskCard } from "./packages/ask-card.js";
25
+ import { inCard, nextPackCard } from "./packages/card.js";
26
+ import { PackagePage } from "./packages/package-page.js";
27
+ import { PackagesPage } from "./packages/packages.js";
28
+ import { codeOfModule, ModulesContext, ownKey, preloadModules, systemPageStyle, useNavPages } from "./packages/page-code.js";
29
+ import { PeopleContext } from "./packages/people.js";
30
+ import { WidgetCards, WidgetsContext } from "./packages/widgets.js";
30
31
  import { About } from "./pages.js";
31
32
  import { PartyStrip } from "./party.js";
32
- import { PeopleContext } from "./people.js";
33
33
  import { rollReaction } from "./reactions.js";
34
34
  import { requestedOf, RequestedRoll } from "./requested.js";
35
35
  import { RollLog } from "./rolls.js";
@@ -44,7 +44,7 @@ import { browserLanguage, pageDirection, setLanguage, setSystemWords, t } from "
44
44
  import { restoreTheme } from "./theme.js";
45
45
  import { SetupCorner, Top } from "./top.js";
46
46
  import { hasTurns, TurnsCard, turnWords } from "./turns.js";
47
- import { WorldView } from "./world.js";
47
+ import { WorldView } from "./world/world.js";
48
48
  /** The product's name, as the page writes it: here only (D-276). */
49
49
  const productName = "RPG Engine";
50
50
  // How many of the last rolls the page reads at first, and how many more each time the player asks for older ones (D-302).
@@ -10,8 +10,8 @@ import { CoinFace } from "./faces.js";
10
10
  import { notationLabel } from "./game-words.js";
11
11
  import { Icon, NotationIcons } from "./icons.js";
12
12
  import { checkOf, notationModifier, sameDice, signed } from "./labels.js";
13
- import { MapSheet } from "./map-sheet.js";
14
13
  import { sheetAddress, sideOf, Token } from "./party.js";
14
+ import { MapSheet } from "./place/map-sheet.js";
15
15
  import { byHandPref, usePref } from "./prefs.js";
16
16
  import { t, tParts } from "./text.js";
17
17
  import { turnWords } from "./turns.js";
@@ -1,4 +1,4 @@
1
- // A die that does not count burns away (D-358): going out in a blink (D-414), it stays a moment where it fell, then consumed as paper by a fire, holes opening through it with a glowing,
1
+ // A die that does not count burns away (D-358): going out in a blink (D-538), it stays a moment where it fell, then consumed as paper by a fire, holes opening through it with a glowing,
2
2
  // charred edge, until nothing is left; with reduced motion it fades instead. A die that shows its lowest face cracks, dark lines spreading from a point, no
3
3
  // fire (D-363, D-382). Its materials, body and ink, burn or crack together, by its own shape.
4
4
  import * as THREE from "three";
@@ -11,7 +11,7 @@ import { frostPicture } from "./frost.js";
11
11
  import { coinKind } from "./models.js";
12
12
  import { coinOf, diceLook, texturePath } from "./sets.js";
13
13
  // A die that does not count, as the lower of two d20 with advantage, goes out, whatever its set: its colour gone and darker, its body to a third of its
14
- // light, its ink to some half, still read; never lighter, which on a dark die would look picked (D-348, D-414).
14
+ // light, its ink to some half, still read; never lighter, which on a dark die would look picked (D-348, D-538).
15
15
  const dimmedBody = 0.35;
16
16
  // How much of the window's foot the plate of the result covers, in pixels, until the plate of a throw is measured: from the window's edge to the plate's
17
17
  // top, on a wide screen and on a phone, where it comes out of the bar of the sections.
@@ -1,5 +1,5 @@
1
1
  import { fieldLabel, phraseLabel } from "./labels.js";
2
- import { isolated, listText, systemWord, t } from "./text.js";
2
+ import { isolated, listText, systemWord, systemWordAnyCase, t } from "./text.js";
3
3
  /** A game date in the page's language: day 3, 06:00, or day 3; any other text as it is. */
4
4
  export function gameDateLabel(date) {
5
5
  const read = readDate(date);
@@ -80,9 +80,9 @@ export function effectLabel(effect) {
80
80
  export function burnsLabel(name, burns) {
81
81
  return burns.fuel === name ? t("{count} left", { count: burns.left }) : t("{fuel}: {count} left", { fuel: effectName(burns.fuel), count: burns.left });
82
82
  }
83
- /** An effect's name in the page's language: a condition of the system in its words, as Unconscious in Italian; any other as written. */
83
+ /** An effect's name in the page's language: a condition of the system in its words, as Unconscious in Italian, whatever its capitals; any other as written. */
84
84
  export function effectName(name) {
85
- return systemWord("words", name) ?? name;
85
+ return systemWordAnyCase("words", name) ?? name;
86
86
  }
87
87
  /** Where a place is from the party, in the page's language: 12 km north-east, Here; the length as `length` writes it in the player's units. */
88
88
  export function fromLabel(from, length) {
@@ -154,7 +154,7 @@ export function factLabel(fact) {
154
154
  case "effect":
155
155
  return t("{who}: {effect}", { who: subjectLabel(fact.who), effect: effectLabel(fact) });
156
156
  case "effect-ended":
157
- return t("{who}: {effect} ended", { who: subjectLabel(fact.who), effect: fact.effect });
157
+ return t("{who}: {effect} ended", { who: subjectLabel(fact.who), effect: effectName(fact.effect) });
158
158
  case "back":
159
159
  return t("Back to save {save}: what came after it is gone", { save: fact.save });
160
160
  case "quest":
@@ -1,5 +1,5 @@
1
1
  // The markdown the guide is written in (D-413), read into blocks: headings, with an icon in a comment after them (<!-- icon: dice -->); paragraphs, lists,
2
- // tables, quotes, code. guide-markdown.tsx draws them.
2
+ // tables, quotes, code. markdown.tsx draws them.
3
3
  /** The blocks of a markdown text; its comments, but a heading's icon, left out. */
4
4
  export function markdownBlocks(text) {
5
5
  const lines = text.replace(/\r\n/g, "\n").replace(/<!--(?!\s*icon:)[\s\S]*?-->/g, "").split("\n");
@@ -3,12 +3,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
3
3
  // its parts a card that folds, the first two open. Its anchors are the English guide's, so that a link finds its heading in every language. At its end, how to
4
4
  // tell us what went wrong: the page's own words, so that the guide's translations stay as they are.
5
5
  import { useEffect, useMemo, useState } from "preact/hooks";
6
- import { CardHead, CardHeader } from "./card.js";
7
- import { anchorOf, markdownBlocks, plainText } from "./guide-blocks.js";
8
- import { Blocks, Inline } from "./guide-markdown.js";
9
- import { Icon, iconPath, isIconName } from "./icons.js";
10
- import { PageHead } from "./pages.js";
11
- import { pageLanguageOf, t } from "./text.js";
6
+ import { CardHead, CardHeader } from "../card.js";
7
+ import { Icon, iconPath, isIconName } from "../icons.js";
8
+ import { PageHead } from "../pages.js";
9
+ import { pageLanguageOf, t } from "../text.js";
10
+ import { anchorOf, markdownBlocks, plainText } from "./blocks.js";
11
+ import { Blocks, Inline } from "./markdown.js";
12
12
  /** How to play with RPG Engine: the guide, from installing it to the campaign's folder. */
13
13
  export function Help() {
14
14
  const language = pageLanguageOf(document.documentElement.lang);
@@ -7,7 +7,6 @@ import { useEffect, useRef, useState } from "preact/hooks";
7
7
  import { sectionAddress } from "./address.js";
8
8
  import { pictureAddress, readJournal } from "./api.js";
9
9
  import { CardHeader, useOpen } from "./card.js";
10
- import { WidgetCards } from "./extension-widgets.js";
11
10
  import { byDateLabel, factLabel, gameDateLabel } from "./game-words.js";
12
11
  import { Icon, iconPath } from "./icons.js";
13
12
  import { fieldLabel, phraseLabel, sceneTypeLabel } from "./labels.js";
@@ -15,6 +14,7 @@ import { endedQuests, followedQuests, keptFollowed } from "./layout.js";
15
14
  import { placeKinds } from "./map-symbols.js";
16
15
  import { knowersOf, Markdown } from "./markdown.js";
17
16
  import { Notes } from "./notes.js";
17
+ import { WidgetCards } from "./packages/widgets.js";
18
18
  import { PageHead } from "./pages.js";
19
19
  import { useChoice, useKeptText } from "./prefs.js";
20
20
  import { PageTabs } from "./tabs.js";
@@ -1,12 +1,13 @@
1
1
  import { jsx as _jsx } from "preact/jsx-runtime";
2
2
  import { useContext } from "preact/hooks";
3
- import { Drawn, Text } from "./extension-widgets.js";
4
3
  import { NotationIcons } from "./icons.js";
4
+ import { PeopleContext } from "./packages/people.js";
5
+ import { Drawn, Text } from "./packages/widgets.js";
5
6
  import { sideOf, Token } from "./party.js";
6
- import { PeopleContext } from "./people.js";
7
- export { Choices } from "./ask-card.js";
8
- export { Text, Track, Value, Who } from "./extension-widgets.js";
9
- export { cardPages } from "./page-code.js";
7
+ export { statusIcons } from "./icons.js";
8
+ export { Choices } from "./packages/ask-card.js";
9
+ export { cardPages } from "./packages/page-code.js";
10
+ export { Text, Track, Value, Who } from "./packages/widgets.js";
10
11
  /** A button of words, as the page's: gold for the one main action, quiet for a secondary one, danger for one that loses something. */
11
12
  export function Button({ children, onClick, kind, disabled, tip }) {
12
13
  return (_jsx("button", { type: "button", class: kind === undefined ? "button" : `button ${kind}`, "aria-disabled": disabled === true ? "true" : undefined, "data-tip": tip, onClick: () => disabled !== true && onClick(), children: children }));
@@ -2,7 +2,7 @@
2
2
  import { isolated, numberText, systemWord, t, timeText } from "./text.js";
3
3
  // The dice the page has a picture of: the d% as 100, the coin as 2.
4
4
  const drawnDice = [2, 4, 6, 8, 10, 12, 20, 100];
5
- /** A field's name as a label: its words apart, in capitals the short ones that name a field, such as str or ac, and those of two letters without a vowel, such as hp. */
5
+ /** A field's name as a label: its words apart, in capitals the short names, as ac, hp, or str which the system names Strength; age stays a word. */
6
6
  export function fieldLabel(field, fields = new Set()) {
7
7
  return systemWord("fields", field) ?? words(field).map((word) => (isShortName(word, fields) ? word.toUpperCase() : word)).join(" ");
8
8
  }
@@ -51,7 +51,7 @@ export function drawnDiceOf(notation) {
51
51
  const oneOfTwo = count === 2 && /\d*d(?:\d+|%|F)(?:k[hl]1|d[hl]1)(?![\d])/i.test(notation);
52
52
  return count <= 2 ? { sides: Array.from({ length: count }, () => sides), ...(oneOfTwo ? { faded: true } : {}) } : { sides: [sides], count };
53
53
  }
54
- /** An item of a list as the page shows it: the short name of a field in capitals, as WIS; any other with its first letter a capital, as Light hammer. */
54
+ /** An item of a list as the page shows it: a short name in capitals, as WIS; any other with its first letter a capital, as Light hammer. */
55
55
  export function itemLabel(item, fields = new Set()) {
56
56
  const word = item.trim();
57
57
  return systemWord("words", word) ?? systemWord("fields", word) ?? (isShortName(word.toLowerCase(), fields) ? word.toUpperCase() : phraseLabel(word));
@@ -131,8 +131,12 @@ function durationText(text) {
131
131
  function words(field) {
132
132
  return field.split("-").filter((word) => word !== "");
133
133
  }
134
+ /**
135
+ * Whether a word of a field's name is short for a name, so in capitals: a field of two letters, as ac, two letters without a vowel, as hp, or one of three the
136
+ * system names in full, as str for Strength; a word of three it does not, as age, is a word.
137
+ */
134
138
  function isShortName(word, fields) {
135
- return (/^[a-z]{2,3}$/.test(word) && fields.has(word)) || /^[b-df-hj-np-tv-z]{2}$/.test(word);
139
+ return (/^[a-z]{2}$/.test(word) && fields.has(word)) || /^[b-df-hj-np-tv-z]{2}$/.test(word) || (/^[a-z]{3}$/.test(word) && systemWord("names", word) !== undefined);
136
140
  }
137
141
  /** Dice written one way: of two dice dropping the lowest as keeping the highest, k as kh, 1d100 as 1d%, and the numbers added summed, as 1d20+2+1 is 1d20+3. */
138
142
  function plainDice(notation) {
@@ -3,8 +3,8 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "preact/jsx-ru
3
3
  // italics, links as their names, or as links where the page reading it says where they lead. Never HTML: every piece is text, so nothing in a page can run in
4
4
  // the dashboard.
5
5
  import { Fragment } from "preact";
6
- import { linkedName } from "./lore.js";
7
6
  import { foldedText, listText, t } from "./text.js";
7
+ import { linkedName } from "./world/known.js";
8
8
  export function Markdown({ text, link, secretKnowers }) {
9
9
  return _jsx("div", { class: "markdown", children: blocks(text, link, true, secretKnowers).map((block, index) => _jsx(Fragment, { children: block }, index)) });
10
10
  }
@@ -4,13 +4,13 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-ru
4
4
  // asks for, and the rule; once the dice have spoken, the outcome where the buttons were. Its extension's page code may draw the middle's figure, or the
5
5
  // whole inside, the frame staying the page's (D-510). What the dice changed moves once they land; the card stays until the player closes it.
6
6
  import { useEffect, useRef, useState } from "preact/hooks";
7
- import { Drawn, OwnerContext, Part, Text, textOf, Track, Who } from "./extension-widgets.js";
8
- import { Icon, NotationIcons } from "./icons.js";
9
- import { checkOf, fieldLabel } from "./labels.js";
10
- import { cardLayout, labelKey, trackChanges } from "./pack-card.js";
7
+ import { Icon, NotationIcons } from "../icons.js";
8
+ import { checkOf, fieldLabel } from "../labels.js";
9
+ import { t } from "../text.js";
10
+ import { turnWords } from "../turns.js";
11
+ import { cardLayout, labelKey, trackChanges } from "./card.js";
11
12
  import { deepQuery, ExtensionRoot, figureSize, pagePropsOf, usePageModule } from "./page-code.js";
12
- import { t } from "./text.js";
13
- import { turnWords } from "./turns.js";
13
+ import { Drawn, OwnerContext, Part, Text, textOf, Track, Who } from "./widgets.js";
14
14
  /** The card; `name`, with more than one player character, whom it asks; `widget`, whose card it is, its title for a card the page saw no question of. */
15
15
  export function AskCard({ card, name, widget, onAnswer, onWords, onClose }) {
16
16
  const element = useRef(null);
@@ -2,10 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-ru
2
2
  // A package's own pages (D-511): at #/pkg/<package>/<name>, the page's head with its title and icon, its whole inside drawn by the package's page code; and the
3
3
  // links to them in the package's row of Packages, by their titles.
4
4
  import { useContext, useEffect, useRef } from "preact/hooks";
5
- import { sectionAddress } from "./address.js";
6
- import { Drawn, WidgetsContext } from "./extension-widgets.js";
7
- import { Icon } from "./icons.js";
5
+ import { sectionAddress } from "../address.js";
6
+ import { Icon } from "../icons.js";
8
7
  import { codeOfModule, ExtensionRoot, ModulesContext, ownPageIn, pagePropsOf, usePageModule, useWidgetData } from "./page-code.js";
8
+ import { Drawn, WidgetsContext } from "./widgets.js";
9
9
  // Whether the player moved in the page since it loaded: a package's page opened then takes the focus to its title.
10
10
  let moved = false;
11
11
  if (typeof window !== "undefined") {
@@ -1,18 +1,18 @@
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 { sectionAddress } from "./address.js";
4
- import { addFile, addSource, changeLibrary, changePackage, exportCampaign, readCatalog, readEngine, readLibrary, readPackages, updateEngine, } from "./api.js";
5
- import { CardHead, useMedia } from "./card.js";
6
- import { gameDateLabel, sinceDateLabel } from "./game-words.js";
7
- import { Icon, iconPath } from "./icons.js";
8
- import { phraseLabel, systemTitleLabel } from "./labels.js";
9
- import { languageName } from "./languages.js";
3
+ import { sectionAddress } from "../address.js";
4
+ import { addFile, addSource, changeLibrary, changePackage, exportCampaign, readCatalog, readEngine, readLibrary, readPackages, updateEngine, } from "../api.js";
5
+ import { CardHead, useMedia } from "../card.js";
6
+ import { gameDateLabel, sinceDateLabel } from "../game-words.js";
7
+ import { Icon, iconPath } from "../icons.js";
8
+ import { phraseLabel, systemTitleLabel } from "../labels.js";
9
+ import { languageName } from "../languages.js";
10
+ import { PageHead } from "../pages.js";
11
+ import { Confirm } from "../saves.js";
12
+ import { Command } from "../settings.js";
13
+ import { PageTabs } from "../tabs.js";
14
+ import { arrowStep, foldedText, isolated, pageDirection, t } from "../text.js";
10
15
  import { OwnPageLinks } from "./package-page.js";
11
- import { PageHead } from "./pages.js";
12
- import { Confirm } from "./saves.js";
13
- import { Command } from "./settings.js";
14
- import { PageTabs } from "./tabs.js";
15
- import { arrowStep, foldedText, isolated, pageDirection, t } from "./text.js";
16
16
  // The engine's own name, never translated.
17
17
  const engineName = "RPG Engine";
18
18
  // Where the engine installed from this page is kept while the chat goes on with the one before it: in this tab, through a reload.
@@ -13,11 +13,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
13
13
  // portraits. When it breaks, its place says the error and whose it is, for whoever fixes it. The shapes are rpg-engine/page's, which src/page.ts declares.
14
14
  import { Component, createContext, render } from "preact";
15
15
  import { useContext, useEffect, useLayoutEffect, useRef, useState } from "preact/hooks";
16
- import { readWidgetData, runCommand } from "./api.js";
17
- import { fieldLabel } from "./labels.js";
16
+ import { readWidgetData, runCommand } from "../api.js";
17
+ import { fieldLabel } from "../labels.js";
18
+ import { isolated, numberText, pageDirection } from "../text.js";
19
+ import { shownTheme } from "../theme.js";
18
20
  import { PeopleContext } from "./people.js";
19
- import { isolated, numberText, pageDirection } from "./text.js";
20
- import { shownTheme } from "./theme.js";
21
21
  /** The pages of the dashboard a package's card stands in (D-511), after their own cards: as src/page.ts declares them to the packages. */
22
22
  export const cardPages = ["scene", "sheet", "world", "journal"];
23
23
  /** The packages' own pages in the order of their modules, the system's first, each where it says, the menu when it says nothing (D-512); none of a module coming or broken. */