rpg-engine 0.15.0 → 0.16.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 (486) hide show
  1. package/dist/campaign/index.d.ts +1 -1
  2. package/dist/campaign/index.js +1 -1
  3. package/dist/campaign/settings.d.ts +6 -0
  4. package/dist/campaign/settings.js +22 -1
  5. package/dist/cli/cli.js +1 -1
  6. package/dist/cli/command-line.js +1 -1
  7. package/dist/commands/advance.d.ts +1 -1
  8. package/dist/commands/advance.js +6 -6
  9. package/dist/commands/ask.js +7 -7
  10. package/dist/commands/change/amounts.d.ts +32 -0
  11. package/dist/commands/change/amounts.js +150 -0
  12. package/dist/commands/change/change.d.ts +4 -54
  13. package/dist/commands/change/change.js +19 -749
  14. package/dist/commands/change/damage.d.ts +30 -0
  15. package/dist/commands/change/damage.js +73 -2
  16. package/dist/commands/change/dice.d.ts +34 -0
  17. package/dist/commands/change/dice.js +59 -0
  18. package/dist/commands/change/fields.d.ts +37 -0
  19. package/dist/commands/change/fields.js +156 -0
  20. package/dist/commands/change/holder.d.ts +48 -0
  21. package/dist/commands/change/holder.js +162 -0
  22. package/dist/commands/change/recipe-pace.js +1 -1
  23. package/dist/commands/change/recipe.d.ts +58 -0
  24. package/dist/commands/change/recipe.js +179 -0
  25. package/dist/commands/choices.js +3 -3
  26. package/dist/commands/config/config.d.ts +15 -0
  27. package/dist/commands/config/config.js +355 -0
  28. package/dist/commands/config/custom-levels.d.ts +7 -0
  29. package/dist/commands/config/custom-levels.js +32 -0
  30. package/dist/commands/{config.d.ts → config/dashboard.d.ts} +2 -24
  31. package/dist/commands/config/dashboard.js +171 -0
  32. package/dist/commands/config/entries.d.ts +17 -0
  33. package/dist/commands/config/entries.js +76 -0
  34. package/dist/commands/config/news.d.ts +7 -0
  35. package/dist/commands/config/news.js +88 -0
  36. package/dist/commands/config/shown.d.ts +9 -0
  37. package/dist/commands/config/shown.js +80 -0
  38. package/dist/commands/config/words.d.ts +27 -0
  39. package/dist/commands/config/words.js +204 -0
  40. package/dist/commands/effect.js +9 -9
  41. package/dist/commands/find.js +1 -1
  42. package/dist/commands/image.js +6 -6
  43. package/dist/commands/import/import.d.ts +0 -2
  44. package/dist/commands/import/import.js +45 -44
  45. package/dist/commands/import/run.js +1 -1
  46. package/dist/commands/index.js +3 -3
  47. package/dist/commands/init.js +2 -2
  48. package/dist/commands/install.js +1 -1
  49. package/dist/commands/instructions.js +6 -6
  50. package/dist/commands/mode.d.ts +2 -2
  51. package/dist/commands/mode.js +8 -8
  52. package/dist/commands/mood.js +4 -4
  53. package/dist/commands/move.js +10 -10
  54. package/dist/commands/package/consent.d.ts +11 -0
  55. package/dist/commands/package/consent.js +52 -0
  56. package/dist/commands/package/here.d.ts +51 -0
  57. package/dist/commands/package/here.js +128 -0
  58. package/dist/commands/package/install.d.ts +10 -0
  59. package/dist/commands/package/install.js +337 -0
  60. package/dist/commands/package/package.d.ts +18 -0
  61. package/dist/commands/package/package.js +236 -0
  62. package/dist/commands/package/result.d.ts +90 -0
  63. package/dist/commands/package/result.js +1 -0
  64. package/dist/commands/package/uninstall.d.ts +6 -0
  65. package/dist/commands/package/uninstall.js +70 -0
  66. package/dist/commands/rename.js +3 -3
  67. package/dist/commands/reveal.js +5 -5
  68. package/dist/commands/roll/roll.js +11 -9
  69. package/dist/commands/roll/tables.js +1 -1
  70. package/dist/commands/rules.d.ts +2 -2
  71. package/dist/commands/rules.js +3 -3
  72. package/dist/commands/save.d.ts +1 -1
  73. package/dist/commands/save.js +2 -2
  74. package/dist/commands/scene/close.d.ts +18 -0
  75. package/dist/commands/scene/close.js +179 -0
  76. package/dist/commands/scene/members.d.ts +14 -0
  77. package/dist/commands/scene/members.js +32 -0
  78. package/dist/commands/scene/open.d.ts +6 -0
  79. package/dist/commands/scene/open.js +298 -0
  80. package/dist/commands/scene/result.d.ts +98 -0
  81. package/dist/commands/scene/result.js +2 -0
  82. package/dist/commands/{scene.d.ts → scene/scene.d.ts} +10 -36
  83. package/dist/commands/scene/scene.js +210 -0
  84. package/dist/commands/scene/turns.d.ts +18 -0
  85. package/dist/commands/scene/turns.js +229 -0
  86. package/dist/commands/shared/{adventures.d.ts → books/adventures.d.ts} +5 -3
  87. package/dist/commands/shared/{adventures.js → books/adventures.js} +23 -19
  88. package/dist/commands/shared/{library-reader.js → books/library-reader.js} +3 -3
  89. package/dist/commands/shared/{library.d.ts → books/library.d.ts} +2 -2
  90. package/dist/commands/shared/{library.js → books/library.js} +9 -9
  91. package/dist/commands/shared/{rules.d.ts → books/rules.d.ts} +2 -2
  92. package/dist/commands/shared/{rules.js → books/rules.js} +5 -5
  93. package/dist/commands/shared/{system-texts.d.ts → books/system-texts.d.ts} +2 -2
  94. package/dist/commands/shared/{system-texts.js → books/system-texts.js} +9 -8
  95. package/dist/commands/shared/{page-words.d.ts → books/words.d.ts} +2 -2
  96. package/dist/commands/shared/{page-words.js → books/words.js} +4 -4
  97. package/dist/commands/shared/{checks.d.ts → campaign/checks.d.ts} +3 -3
  98. package/dist/commands/shared/{checks.js → campaign/checks.js} +7 -7
  99. package/dist/commands/shared/{images.d.ts → campaign/images.d.ts} +3 -3
  100. package/dist/commands/shared/{images.js → campaign/images.js} +5 -5
  101. package/dist/commands/shared/{mode.d.ts → campaign/mode.d.ts} +4 -4
  102. package/dist/commands/shared/{mode.js → campaign/mode.js} +24 -13
  103. package/dist/commands/shared/{money.d.ts → campaign/money.d.ts} +3 -3
  104. package/dist/commands/shared/{money.js → campaign/money.js} +2 -2
  105. package/dist/commands/shared/{offers.d.ts → campaign/offers.d.ts} +3 -3
  106. package/dist/commands/shared/{offers.js → campaign/offers.js} +3 -3
  107. package/dist/commands/shared/{outside.d.ts → campaign/outside.d.ts} +3 -3
  108. package/dist/commands/shared/{outside.js → campaign/outside.js} +7 -7
  109. package/dist/commands/shared/{parts.d.ts → campaign/parts.d.ts} +3 -3
  110. package/dist/commands/shared/{parts.js → campaign/parts.js} +3 -3
  111. package/dist/commands/shared/{problems.d.ts → campaign/problems.d.ts} +3 -3
  112. package/dist/commands/shared/{problems.js → campaign/problems.js} +17 -17
  113. package/dist/commands/shared/{quests.d.ts → campaign/quests.d.ts} +4 -4
  114. package/dist/commands/shared/{quests.js → campaign/quests.js} +6 -6
  115. package/dist/commands/shared/{saves.d.ts → campaign/saves.d.ts} +4 -4
  116. package/dist/commands/shared/{saves.js → campaign/saves.js} +10 -10
  117. package/dist/commands/shared/{theme.d.ts → campaign/theme.d.ts} +3 -3
  118. package/dist/commands/shared/{theme.js → campaign/theme.js} +1 -1
  119. package/dist/commands/shared/{world.d.ts → campaign/world.d.ts} +5 -5
  120. package/dist/commands/shared/{world.js → campaign/world.js} +17 -14
  121. package/dist/commands/shared/{knowledge.d.ts → characters/knowledge.d.ts} +3 -3
  122. package/dist/commands/shared/{knowledge.js → characters/knowledge.js} +4 -4
  123. package/dist/commands/shared/{moods.d.ts → characters/moods.d.ts} +3 -3
  124. package/dist/commands/shared/{moods.js → characters/moods.js} +3 -3
  125. package/dist/commands/shared/characters/orders.d.ts +4 -0
  126. package/dist/commands/shared/characters/orders.js +10 -0
  127. package/dist/commands/shared/{thoughts.d.ts → characters/thoughts.d.ts} +2 -2
  128. package/dist/commands/shared/{thoughts.js → characters/thoughts.js} +3 -3
  129. package/dist/commands/shared/{voices.d.ts → characters/voices.d.ts} +1 -1
  130. package/dist/commands/shared/{voices.js → characters/voices.js} +2 -2
  131. package/dist/commands/shared/examples.js +2 -2
  132. package/dist/commands/shared/packages/catalog.js +2 -2
  133. package/dist/commands/shared/packages/code.d.ts +1 -1
  134. package/dist/commands/shared/packages/code.js +8 -8
  135. package/dist/commands/shared/packages/extensions.d.ts +1 -1
  136. package/dist/commands/shared/packages/extensions.js +1 -1
  137. package/dist/commands/shared/packages/hooks.d.ts +1 -1
  138. package/dist/commands/shared/packages/hooks.js +1 -1
  139. package/dist/commands/shared/packages/widgets.d.ts +3 -3
  140. package/dist/commands/shared/packages/widgets.js +3 -3
  141. package/dist/commands/shared/{environment.d.ts → places/environment.d.ts} +1 -1
  142. package/dist/commands/shared/{environment.js → places/environment.js} +4 -4
  143. package/dist/commands/shared/{grid-moves.d.ts → places/grid-moves.d.ts} +4 -4
  144. package/dist/commands/shared/{grid-moves.js → places/grid-moves.js} +8 -7
  145. package/dist/commands/shared/{grids.d.ts → places/grids.d.ts} +4 -4
  146. package/dist/commands/shared/{grids.js → places/grids.js} +6 -6
  147. package/dist/commands/shared/{journey.d.ts → places/journey.d.ts} +3 -3
  148. package/dist/commands/shared/{journey.js → places/journey.js} +6 -6
  149. package/dist/commands/shared/{moves.d.ts → places/moves.d.ts} +2 -2
  150. package/dist/commands/shared/{moves.js → places/moves.js} +4 -4
  151. package/dist/commands/shared/{positions.d.ts → places/positions.d.ts} +2 -2
  152. package/dist/commands/shared/{positions.js → places/positions.js} +4 -4
  153. package/dist/commands/shared/{roads.d.ts → places/roads.d.ts} +5 -5
  154. package/dist/commands/shared/{roads.js → places/roads.js} +6 -6
  155. package/dist/commands/shared/{effects.d.ts → scene/effects.d.ts} +7 -7
  156. package/dist/commands/shared/{effects.js → scene/effects.js} +10 -10
  157. package/dist/commands/shared/{loot.d.ts → scene/loot.d.ts} +2 -2
  158. package/dist/commands/shared/{loot.js → scene/loot.js} +3 -3
  159. package/dist/commands/shared/{master-rolls.d.ts → scene/master-rolls.d.ts} +2 -2
  160. package/dist/commands/shared/{master-rolls.js → scene/master-rolls.js} +5 -5
  161. package/dist/commands/shared/{reminders.d.ts → scene/reminders.d.ts} +4 -4
  162. package/dist/commands/shared/{reminders.js → scene/reminders.js} +4 -4
  163. package/dist/commands/shared/{scene.d.ts → scene/scene.d.ts} +3 -3
  164. package/dist/commands/shared/{scene.js → scene/scene.js} +7 -7
  165. package/dist/commands/shared/{bonds.d.ts → sheet/bonds.d.ts} +3 -3
  166. package/dist/commands/shared/{bonds.js → sheet/bonds.js} +2 -2
  167. package/dist/commands/shared/{page-counters.d.ts → sheet/counters.d.ts} +3 -3
  168. package/dist/commands/shared/{page-counters.js → sheet/counters.js} +5 -5
  169. package/dist/commands/shared/{effect-layer.d.ts → sheet/effect-layer.d.ts} +2 -2
  170. package/dist/commands/shared/{effect-layer.js → sheet/effect-layer.js} +9 -6
  171. package/dist/commands/shared/sheet/effect-values.d.ts +9 -0
  172. package/dist/commands/shared/sheet/effect-values.js +69 -0
  173. package/dist/commands/shared/{experience.d.ts → sheet/experience.d.ts} +3 -3
  174. package/dist/commands/shared/{experience.js → sheet/experience.js} +5 -5
  175. package/dist/commands/shared/sheet/formula-problems.d.ts +8 -0
  176. package/dist/commands/shared/sheet/formula-problems.js +140 -0
  177. package/dist/commands/shared/sheet/formula-scope.d.ts +32 -0
  178. package/dist/commands/shared/sheet/formula-scope.js +235 -0
  179. package/dist/commands/shared/{limits.d.ts → sheet/limits.d.ts} +3 -3
  180. package/dist/commands/shared/{limits.js → sheet/limits.js} +5 -4
  181. package/dist/commands/shared/{progression.d.ts → sheet/progression.d.ts} +2 -2
  182. package/dist/commands/shared/{progression.js → sheet/progression.js} +4 -4
  183. package/dist/commands/shared/{sheet.d.ts → sheet/sheet.d.ts} +5 -5
  184. package/dist/commands/shared/{sheet.js → sheet/sheet.js} +11 -7
  185. package/dist/commands/shared/{stacks.d.ts → sheet/stacks.d.ts} +2 -2
  186. package/dist/commands/shared/{stacks.js → sheet/stacks.js} +4 -4
  187. package/dist/commands/shared/sheet/system-fields.d.ts +21 -0
  188. package/dist/commands/shared/sheet/system-fields.js +45 -0
  189. package/dist/commands/shared/{thresholds.d.ts → sheet/thresholds.d.ts} +1 -1
  190. package/dist/commands/shared/{thresholds.js → sheet/thresholds.js} +4 -4
  191. package/dist/commands/shared/{turn-uses.d.ts → sheet/turn-uses.d.ts} +3 -3
  192. package/dist/commands/shared/{turn-uses.js → sheet/turn-uses.js} +4 -3
  193. package/dist/commands/shared/{worked-out.d.ts → sheet/worked-out.d.ts} +11 -46
  194. package/dist/commands/shared/sheet/worked-out.js +291 -0
  195. package/dist/commands/shared/sheet/worked-text.d.ts +14 -0
  196. package/dist/commands/shared/sheet/worked-text.js +55 -0
  197. package/dist/commands/shared/{advance.d.ts → time/advance.d.ts} +3 -3
  198. package/dist/commands/shared/{advance.js → time/advance.js} +11 -11
  199. package/dist/commands/shared/{dice-pool.d.ts → time/dice-pool.d.ts} +3 -3
  200. package/dist/commands/shared/{dice-pool.js → time/dice-pool.js} +11 -11
  201. package/dist/commands/shared/{events.d.ts → time/events.d.ts} +5 -5
  202. package/dist/commands/shared/{events.js → time/events.js} +10 -13
  203. package/dist/commands/shared/{recipes.d.ts → time/recipes.d.ts} +3 -3
  204. package/dist/commands/shared/{recipes.js → time/recipes.js} +6 -5
  205. package/dist/commands/shared/{time.d.ts → time/time.d.ts} +4 -4
  206. package/dist/commands/shared/{time.js → time/time.js} +6 -6
  207. package/dist/commands/shared/{upkeep.d.ts → time/upkeep.d.ts} +3 -3
  208. package/dist/commands/shared/{upkeep.js → time/upkeep.js} +14 -13
  209. package/dist/commands/show.d.ts +3 -0
  210. package/dist/commands/show.js +28 -9
  211. package/dist/commands/status.d.ts +2 -1
  212. package/dist/commands/status.js +28 -22
  213. package/dist/commands/thoughts.js +3 -3
  214. package/dist/commands/trade.js +8 -8
  215. package/dist/commands/translate.d.ts +1 -1
  216. package/dist/commands/translate.js +3 -3
  217. package/dist/commands/travel/open.d.ts +1 -1
  218. package/dist/commands/travel/open.js +2 -2
  219. package/dist/commands/travel/route.js +7 -6
  220. package/dist/commands/travel/travel.d.ts +1 -1
  221. package/dist/commands/travel/travel.js +8 -8
  222. package/dist/commands/validate.js +3 -3
  223. package/dist/commands/view/journal.d.ts +2 -2
  224. package/dist/commands/view/journal.js +2 -2
  225. package/dist/commands/view/map.d.ts +1 -1
  226. package/dist/commands/view/map.js +6 -6
  227. package/dist/commands/view/memory.d.ts +16 -0
  228. package/dist/commands/view/memory.js +90 -0
  229. package/dist/commands/view/page.d.ts +32 -0
  230. package/dist/commands/view/page.js +163 -0
  231. package/dist/commands/view/place.d.ts +7 -2
  232. package/dist/commands/view/place.js +30 -12
  233. package/dist/commands/view/result.d.ts +245 -0
  234. package/dist/commands/view/result.js +1 -0
  235. package/dist/commands/view/saves.d.ts +6 -0
  236. package/dist/commands/view/saves.js +53 -0
  237. package/dist/commands/view/story.d.ts +32 -0
  238. package/dist/commands/view/story.js +227 -0
  239. package/dist/commands/view/view.d.ts +26 -292
  240. package/dist/commands/view/view.js +26 -534
  241. package/dist/commands/view/world.d.ts +1 -1
  242. package/dist/commands/view/world.js +3 -3
  243. package/dist/commands/write/checks.d.ts +42 -0
  244. package/dist/commands/write/checks.js +291 -0
  245. package/dist/commands/write/here.d.ts +1 -1
  246. package/dist/commands/write/here.js +5 -5
  247. package/dist/commands/write/inheritance.d.ts +40 -0
  248. package/dist/commands/write/inheritance.js +189 -0
  249. package/dist/commands/write/input.d.ts +29 -0
  250. package/dist/commands/write/input.js +124 -0
  251. package/dist/commands/write/layer.d.ts +36 -0
  252. package/dist/commands/write/layer.js +48 -0
  253. package/dist/commands/write/notes.d.ts +22 -0
  254. package/dist/commands/write/notes.js +76 -0
  255. package/dist/commands/write/progression.d.ts +27 -0
  256. package/dist/commands/write/progression.js +175 -0
  257. package/dist/commands/write/write.d.ts +1 -0
  258. package/dist/commands/write/write.js +32 -816
  259. package/dist/core/files.d.ts +2 -0
  260. package/dist/core/files.js +7 -0
  261. package/dist/core/{package-declarations.d.ts → packages/declarations.d.ts} +1 -1
  262. package/dist/core/{package-declarations.js → packages/declarations.js} +1 -1
  263. package/dist/core/session-store.js +3 -3
  264. package/dist/core/store.d.ts +2 -2
  265. package/dist/core/store.js +18 -4
  266. package/dist/dashboard/acts/acts.js +1 -1
  267. package/dist/dashboard/acts/sending.js +110 -0
  268. package/dist/dashboard/acts/sheet.js +2 -2
  269. package/dist/dashboard/acts/strip.js +1 -1
  270. package/dist/dashboard/address.js +6 -0
  271. package/dist/dashboard/api.js +1 -1
  272. package/dist/dashboard/app.js +47 -171
  273. package/dist/dashboard/dice/roller.js +1 -1
  274. package/dist/dashboard/dice/sets.js +2 -2
  275. package/dist/dashboard/dice/stage.js +1 -1
  276. package/dist/dashboard/dice/tray.js +6 -6
  277. package/dist/dashboard/guide/ar.md +5 -3
  278. package/dist/dashboard/guide/cs.md +5 -3
  279. package/dist/dashboard/guide/da.md +5 -3
  280. package/dist/dashboard/guide/de.md +5 -3
  281. package/dist/dashboard/guide/el.md +5 -3
  282. package/dist/dashboard/guide/en.md +2 -0
  283. package/dist/dashboard/guide/es.md +4 -2
  284. package/dist/dashboard/guide/fi.md +5 -3
  285. package/dist/dashboard/guide/fr.md +4 -2
  286. package/dist/dashboard/guide/he.md +4 -2
  287. package/dist/dashboard/guide/hi.md +6 -4
  288. package/dist/dashboard/guide/hu.md +4 -2
  289. package/dist/dashboard/guide/is.md +5 -3
  290. package/dist/dashboard/guide/it.md +3 -1
  291. package/dist/dashboard/guide/ja.md +7 -5
  292. package/dist/dashboard/guide/ko.md +6 -4
  293. package/dist/dashboard/guide/nb.md +4 -2
  294. package/dist/dashboard/guide/nl.md +5 -3
  295. package/dist/dashboard/guide/pl.md +4 -2
  296. package/dist/dashboard/guide/pt.md +4 -2
  297. package/dist/dashboard/guide/ro.md +5 -3
  298. package/dist/dashboard/guide/ru.md +5 -3
  299. package/dist/dashboard/guide/sv.md +5 -3
  300. package/dist/dashboard/guide/tr.md +6 -4
  301. package/dist/dashboard/guide/uk.md +4 -2
  302. package/dist/dashboard/guide/zh.md +5 -3
  303. package/dist/dashboard/help/help.js +3 -3
  304. package/dist/dashboard/i18n/ar.json +4 -0
  305. package/dist/dashboard/i18n/cs.json +4 -0
  306. package/dist/dashboard/i18n/da.json +4 -0
  307. package/dist/dashboard/i18n/de.json +4 -0
  308. package/dist/dashboard/i18n/el.json +4 -0
  309. package/dist/dashboard/i18n/es.json +4 -0
  310. package/dist/dashboard/i18n/fi.json +4 -0
  311. package/dist/dashboard/i18n/fr.json +4 -0
  312. package/dist/dashboard/i18n/he.json +4 -0
  313. package/dist/dashboard/i18n/hi.json +4 -0
  314. package/dist/dashboard/i18n/hu.json +4 -0
  315. package/dist/dashboard/i18n/is.json +4 -0
  316. package/dist/dashboard/i18n/it.json +4 -0
  317. package/dist/dashboard/i18n/ja.json +5 -1
  318. package/dist/dashboard/i18n/ko.json +4 -0
  319. package/dist/dashboard/i18n/nb.json +4 -0
  320. package/dist/dashboard/i18n/nl.json +4 -0
  321. package/dist/dashboard/i18n/pl.json +4 -0
  322. package/dist/dashboard/i18n/pt.json +4 -0
  323. package/dist/dashboard/i18n/ro.json +4 -0
  324. package/dist/dashboard/i18n/ru.json +4 -0
  325. package/dist/dashboard/i18n/sv.json +4 -0
  326. package/dist/dashboard/i18n/tr.json +4 -0
  327. package/dist/dashboard/i18n/uk.json +4 -0
  328. package/dist/dashboard/i18n/zh.json +4 -0
  329. package/dist/dashboard/{journal.js → journal/journal.js} +16 -16
  330. package/dist/dashboard/{notes.js → journal/notes.js} +4 -4
  331. package/dist/dashboard/kit.js +3 -3
  332. package/dist/dashboard/packages/ask-card.js +3 -3
  333. package/dist/dashboard/packages/catalog.js +196 -0
  334. package/dist/dashboard/packages/engine.js +87 -0
  335. package/dist/dashboard/packages/installed.js +53 -0
  336. package/dist/dashboard/packages/library.js +97 -0
  337. package/dist/dashboard/packages/outcomes.js +45 -0
  338. package/dist/dashboard/packages/packages.js +20 -576
  339. package/dist/dashboard/packages/page-code.js +15 -2
  340. package/dist/dashboard/packages/{package-page.js → page.js} +12 -5
  341. package/dist/dashboard/packages/rows.js +84 -0
  342. package/dist/dashboard/packages/share.js +44 -0
  343. package/dist/dashboard/packages/widgets.js +3 -3
  344. package/dist/dashboard/{card.js → parts/card.js} +1 -1
  345. package/dist/dashboard/{faces.js → parts/faces.js} +5 -5
  346. package/dist/dashboard/{game-words.js → parts/game-words.js} +1 -1
  347. package/dist/dashboard/{icons.js → parts/icons.js} +1 -1
  348. package/dist/dashboard/{labels.js → parts/labels.js} +2 -1
  349. package/dist/dashboard/{map-symbols.js → parts/map-symbols.js} +1 -1
  350. package/dist/dashboard/{markdown.js → parts/markdown.js} +2 -2
  351. package/dist/dashboard/{mood.js → parts/mood.js} +1 -1
  352. package/dist/dashboard/{refusals.js → parts/refusals.js} +1 -1
  353. package/dist/dashboard/{status.js → parts/status.js} +4 -4
  354. package/dist/dashboard/{widgets.js → parts/widgets.js} +2 -2
  355. package/dist/dashboard/place/key.js +24 -0
  356. package/dist/dashboard/place/paper.js +67 -0
  357. package/dist/dashboard/place/{map-sheet.js → sheet.js} +2 -2
  358. package/dist/dashboard/place/things.js +129 -0
  359. package/dist/dashboard/place/tokens.js +93 -0
  360. package/dist/dashboard/place/view.js +124 -0
  361. package/dist/dashboard/{asked-dice.js → play/asked-dice.js} +3 -3
  362. package/dist/dashboard/{asked.js → play/asked.js} +10 -10
  363. package/dist/dashboard/{choices.js → play/choices.js} +9 -9
  364. package/dist/dashboard/{requested.js → play/requested.js} +1 -1
  365. package/dist/dashboard/{rolls.js → play/rolls.js} +9 -9
  366. package/dist/dashboard/{scene.js → play/scene.js} +14 -14
  367. package/dist/dashboard/{turns.js → play/turns.js} +12 -12
  368. package/dist/dashboard/{language-choice.js → settings/language-choice.js} +1 -1
  369. package/dist/dashboard/{languages.js → settings/languages.js} +1 -1
  370. package/dist/dashboard/{saves.js → settings/saves.js} +8 -8
  371. package/dist/dashboard/{settings.js → settings/settings.js} +17 -15
  372. package/dist/dashboard/{setup.js → settings/setup.js} +5 -5
  373. package/dist/dashboard/{party.js → sheet/party.js} +8 -8
  374. package/dist/dashboard/{person-panel.js → sheet/person-panel.js} +4 -4
  375. package/dist/dashboard/{sheet.js → sheet/sheet.js} +17 -17
  376. package/dist/dashboard/{story.js → sheet/story.js} +3 -3
  377. package/dist/dashboard/{columns.js → shell/columns.js} +1 -1
  378. package/dist/dashboard/{footer.js → shell/footer.js} +3 -3
  379. package/dist/dashboard/{master.js → shell/master.js} +2 -2
  380. package/dist/dashboard/{notices.js → shell/notices.js} +3 -3
  381. package/dist/dashboard/{pages.js → shell/pages.js} +5 -5
  382. package/dist/dashboard/shell/shown.js +37 -0
  383. package/dist/dashboard/{table.js → shell/table.js} +2 -2
  384. package/dist/dashboard/{tabs.js → shell/tabs.js} +2 -2
  385. package/dist/dashboard/{top.js → shell/top.js} +7 -7
  386. package/dist/dashboard/style.css +74 -3
  387. package/dist/dashboard/world/calendar.js +4 -4
  388. package/dist/dashboard/world/drawing.js +92 -0
  389. package/dist/dashboard/world/key.js +21 -0
  390. package/dist/dashboard/world/lore.js +5 -5
  391. package/dist/dashboard/world/map-card.js +186 -0
  392. package/dist/dashboard/world/place-card.js +39 -0
  393. package/dist/dashboard/world/places.js +29 -0
  394. package/dist/dashboard/world/world.js +9 -341
  395. package/dist/extensions/extension.d.ts +1 -1
  396. package/dist/extensions/extension.js +1 -1
  397. package/dist/images/images.js +12 -9
  398. package/dist/index.d.ts +1 -1
  399. package/dist/languages/index.d.ts +1 -1
  400. package/dist/languages/index.js +1 -1
  401. package/dist/packages/npm.js +1 -1
  402. package/dist/page.d.ts +2 -2
  403. package/dist/page.js +1 -1
  404. package/dist/pages/check.js +23 -1
  405. package/dist/pages/containers.d.ts +1 -1
  406. package/dist/pages/containers.js +1 -1
  407. package/dist/pages/index.d.ts +4 -2
  408. package/dist/pages/index.js +4 -2
  409. package/dist/pages/inheritance.d.ts +2 -2
  410. package/dist/pages/layers.d.ts +50 -0
  411. package/dist/pages/layers.js +97 -0
  412. package/dist/pages/rename-page.js +1 -1
  413. package/dist/pages/stacks/writes.js +48 -22
  414. package/dist/pages/standard-fields.d.ts +1 -1
  415. package/dist/pages/system-pages.d.ts +5 -3
  416. package/dist/pages/system-pages.js +16 -7
  417. package/dist/pages/world.d.ts +8 -1
  418. package/dist/pages/world.js +16 -4
  419. package/dist/pages/write-layer.d.ts +18 -0
  420. package/dist/pages/write-layer.js +108 -0
  421. package/dist/pages/write-page.d.ts +2 -2
  422. package/dist/pages/write-page.js +2 -2
  423. package/dist/rules/index.d.ts +1 -1
  424. package/dist/rules/index.js +1 -1
  425. package/dist/rules/search.d.ts +1 -1
  426. package/dist/rules/shown.d.ts +1 -1
  427. package/dist/server/dashboard/choices.js +3 -3
  428. package/dist/server/dashboard/files.js +5 -5
  429. package/dist/server/dashboard/index.d.ts +2 -2
  430. package/dist/server/dashboard/index.js +2 -2
  431. package/dist/server/dashboard/news.js +4 -3
  432. package/dist/server/dashboard/player.js +1 -1
  433. package/dist/server/dashboard/writes.js +9 -7
  434. package/dist/server/mcp.js +28 -13
  435. package/dist/systems/campaign-data.d.ts +15 -0
  436. package/dist/systems/campaign-data.js +85 -0
  437. package/dist/systems/{system-code.d.ts → code.d.ts} +1 -1
  438. package/dist/systems/{system-code.js → code.js} +2 -2
  439. package/dist/systems/game-system.d.ts +7 -61
  440. package/dist/systems/game-system.js +1 -984
  441. package/dist/systems/index.d.ts +6 -3
  442. package/dist/systems/index.js +6 -3
  443. package/dist/systems/installed.d.ts +31 -0
  444. package/dist/systems/installed.js +89 -0
  445. package/dist/systems/maps.d.ts +3 -0
  446. package/dist/systems/maps.js +9 -0
  447. package/dist/systems/read.d.ts +3 -0
  448. package/dist/systems/read.js +471 -0
  449. package/dist/systems/schema.d.ts +289 -0
  450. package/dist/systems/schema.js +243 -0
  451. package/dist/systems/settings.d.ts +19 -0
  452. package/dist/systems/settings.js +78 -0
  453. package/dist/systems/versions.d.ts +12 -0
  454. package/dist/systems/versions.js +52 -0
  455. package/dist/testing/index.js +1 -1
  456. package/instructions/import.md +1 -1
  457. package/instructions/play.md +1 -1
  458. package/package.json +1 -1
  459. package/dist/commands/config.js +0 -948
  460. package/dist/commands/package.d.ts +0 -143
  461. package/dist/commands/package.js +0 -785
  462. package/dist/commands/scene.js +0 -894
  463. package/dist/commands/shared/worked-out.js +0 -805
  464. package/dist/dashboard/place/map-view.js +0 -417
  465. /package/dist/commands/shared/{library-reader.d.ts → books/library-reader.d.ts} +0 -0
  466. /package/dist/core/{package-api.d.ts → packages/api.d.ts} +0 -0
  467. /package/dist/core/{package-api.js → packages/api.js} +0 -0
  468. /package/dist/dashboard/{coins.js → parts/coins.js} +0 -0
  469. /package/dist/dashboard/{glass.js → parts/glass.js} +0 -0
  470. /package/dist/dashboard/{layout.js → parts/layout.js} +0 -0
  471. /package/dist/dashboard/{mood-faces.js → parts/mood-faces.js} +0 -0
  472. /package/dist/dashboard/{free-rolls.js → play/free-rolls.js} +0 -0
  473. /package/dist/dashboard/{reactions.js → play/reactions.js} +0 -0
  474. /package/dist/dashboard/{prefs.js → shell/prefs.js} +0 -0
  475. /package/dist/dashboard/{system-style.js → shell/system-style.js} +0 -0
  476. /package/dist/dashboard/{theme.js → shell/theme.js} +0 -0
  477. /package/dist/languages/{language-pack.d.ts → pack.d.ts} +0 -0
  478. /package/dist/languages/{language-pack.js → pack.js} +0 -0
  479. /package/dist/pages/{page-file.d.ts → file.d.ts} +0 -0
  480. /package/dist/pages/{page-file.js → file.js} +0 -0
  481. /package/dist/pages/{page-types.d.ts → types.d.ts} +0 -0
  482. /package/dist/pages/{page-types.js → types.js} +0 -0
  483. /package/dist/rules/{rule-book.d.ts → book.d.ts} +0 -0
  484. /package/dist/rules/{rule-book.js → book.js} +0 -0
  485. /package/dist/systems/{system-folders.d.ts → folders.d.ts} +0 -0
  486. /package/dist/systems/{system-folders.js → folders.js} +0 -0
@@ -0,0 +1,129 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "preact/jsx-runtime";
2
+ // The things of the place's legend, drawn by kind in their box: furniture, fire, stairs, trees, rocks, roofs and the rest.
3
+ import { Fragment } from "preact";
4
+ import { size } from "./paper.js";
5
+ /** A thing of the legend, by its kind (D-325), in its box; the kinds drawn one a square draw each of their squares. Any other is a box with its symbol. */
6
+ export function Thing({ kind, symbol, x, y, w, h, cells }) {
7
+ const inset = (share) => ({ x: x + size * share, y: y + size * share, width: w - size * share * 2, height: h - size * share * 2 });
8
+ const [cx, cy, small] = [x + w / 2, y + h / 2, Math.min(w, h)];
9
+ const along = w >= h;
10
+ switch (kind) {
11
+ case "table":
12
+ return _jsx("rect", { ...inset(0.14), rx: 5, class: "lm-wood" });
13
+ case "counter":
14
+ return (_jsxs(_Fragment, { children: [_jsx("rect", { ...inset(0.12), rx: 2, class: "lm-wood dark" }), _jsx("line", { x1: x + size * 0.2, y1: y + h - size * 0.32, x2: x + w - size * 0.2, y2: y + h - size * 0.32, class: "lm-detail" })] }));
15
+ case "seat":
16
+ return _jsx("rect", { ...inset(0.3), rx: 3, class: "lm-wood" });
17
+ case "bed": {
18
+ const box = inset(0.1);
19
+ return (_jsxs(_Fragment, { children: [_jsx("rect", { ...box, rx: 3, class: "lm-cloth" }), _jsx("rect", { x: box.x + 4, y: box.y + 4, width: box.width - 8, height: Math.min(10, box.height / 4), rx: 3, class: "lm-paper-fill" })] }));
20
+ }
21
+ case "shelf": {
22
+ const box = inset(0.1);
23
+ return (_jsxs(_Fragment, { children: [_jsx("rect", { ...box, class: "lm-wood dark" }), [0.25, 0.5, 0.75].map((share) => (along
24
+ ? _jsx("line", { x1: box.x + box.width * share, y1: box.y, x2: box.x + box.width * share, y2: box.y + box.height, class: "lm-detail" }, share)
25
+ : _jsx("line", { x1: box.x, y1: box.y + box.height * share, x2: box.x + box.width, y2: box.y + box.height * share, class: "lm-detail" }, share)))] }));
26
+ }
27
+ case "hearth":
28
+ return (_jsxs(_Fragment, { children: [_jsx("rect", { ...inset(0.06), rx: 3, class: "lm-stone" }), _jsx("path", { class: "lm-flame", d: flame(cx, cy + small * 0.24, small * 0.42) })] }));
29
+ case "fire":
30
+ return (_jsxs(_Fragment, { children: [_jsx("circle", { cx: cx, cy: cy, r: small * 0.34, class: "lm-stone ring" }), _jsx("path", { class: "lm-flame", d: flame(cx, cy + small * 0.17, small * 0.36) })] }));
31
+ case "barrel":
32
+ return (_jsx(_Fragment, { children: cells.map(([cellX, cellY]) => (_jsxs(Fragment, { children: [_jsx("circle", { cx: cellX + size / 2, cy: cellY + size / 2, r: size * 0.33, class: "lm-wood" }), _jsx("circle", { cx: cellX + size / 2, cy: cellY + size / 2, r: size * 0.19, class: "lm-detail" })] }, `${cellX} ${cellY}`))) }));
33
+ case "crate":
34
+ return (_jsx(_Fragment, { children: cells.map(([cellX, cellY]) => (_jsxs(Fragment, { children: [_jsx("rect", { x: cellX + 6, y: cellY + 6, width: size - 12, height: size - 12, class: "lm-wood" }), _jsx("path", { d: `M${cellX + 6} ${cellY + 6}L${cellX + size - 6} ${cellY + size - 6}M${cellX + size - 6} ${cellY + 6}L${cellX + 6} ${cellY + size - 6}`, class: "lm-detail" })] }, `${cellX} ${cellY}`))) }));
35
+ case "stairs": {
36
+ const box = inset(0.05);
37
+ const steps = Math.max(4, Math.round((along ? box.width : box.height) / 8));
38
+ return (_jsxs(_Fragment, { children: [_jsx("rect", { ...box, class: "lm-paper-fill" }), Array.from({ length: steps - 1 }, (_, step) => {
39
+ const share = (step + 1) / steps;
40
+ return along
41
+ ? _jsx("line", { x1: box.x + box.width * share, y1: box.y, x2: box.x + box.width * share, y2: box.y + box.height, class: "lm-detail" }, step)
42
+ : _jsx("line", { x1: box.x, y1: box.y + box.height * share, x2: box.x + box.width, y2: box.y + box.height * share, class: "lm-detail" }, step);
43
+ })] }));
44
+ }
45
+ case "ladder":
46
+ return (_jsx("path", { class: "lm-detail strong", d: `M${cx - 7} ${y + 5}V${y + h - 5}M${cx + 7} ${y + 5}V${y + h - 5}${Array.from({ length: Math.max(1, Math.round(h / 8) - 1) }, (_, rung) => `M${cx - 7} ${y + 8 + rung * 8}h14`).join("")}` }));
47
+ case "trapdoor": {
48
+ const box = inset(0.12);
49
+ return (_jsxs(_Fragment, { children: [_jsx("rect", { ...box, class: "lm-wood" }), _jsx("path", { class: "lm-detail", d: `M${box.x} ${box.y + box.height / 3}h${box.width}M${box.x} ${box.y + box.height * 2 / 3}h${box.width}` })] }));
50
+ }
51
+ case "pit": {
52
+ const box = inset(0.06);
53
+ return (_jsxs(_Fragment, { children: [_jsx("rect", { ...box, class: "lm-pit" }), _jsx("rect", { x: box.x + 6, y: box.y + 6, width: Math.max(0, box.width - 12), height: Math.max(0, box.height - 12), class: "lm-pit deep" })] }));
54
+ }
55
+ case "pillar":
56
+ return _jsx(_Fragment, { children: cells.map(([cellX, cellY]) => _jsx("circle", { cx: cellX + size / 2, cy: cellY + size / 2, r: size * 0.3, class: "lm-ink-fill" }, `${cellX} ${cellY}`)) });
57
+ case "statue":
58
+ return (_jsxs(_Fragment, { children: [_jsx("rect", { ...inset(0.14), class: "lm-stone" }), _jsx("circle", { cx: cx, cy: cy, r: small * 0.2, class: "lm-ink-fill" })] }));
59
+ case "altar":
60
+ return (_jsxs(_Fragment, { children: [_jsx("rect", { ...inset(0.16), rx: 1, class: "lm-stone" }), _jsx("path", { class: "lm-detail", d: `M${x + size * 0.24} ${y + size * 0.3}h${w - size * 0.48}` })] }));
61
+ case "well":
62
+ return (_jsxs(_Fragment, { children: [_jsx("circle", { cx: cx, cy: cy, r: small * 0.36, class: "lm-stone" }), _jsx("circle", { cx: cx, cy: cy, r: small * 0.22, class: "lm-pit deep" })] }));
63
+ case "tree":
64
+ // A tree a square, the crowns overlapping: a wood, not a blob.
65
+ return (_jsxs(_Fragment, { children: [cells.map(([cellX, cellY]) => {
66
+ const jitter = ((cellX * 7 + cellY * 3) / size) % 5 - 2;
67
+ return _jsx("path", { class: "lm-canopy", d: canopy(cellX + size / 2 + jitter, cellY + size / 2 - jitter, size * 0.56) }, `${cellX} ${cellY}`);
68
+ }), cells.map(([cellX, cellY]) => _jsx("circle", { cx: cellX + size / 2, cy: cellY + size / 2, r: size * 0.07, class: "lm-ink-fill" }, `t${cellX} ${cellY}`))] }));
69
+ case "rocks":
70
+ return (_jsx(_Fragment, { children: cells.map(([cellX, cellY]) => (_jsxs(Fragment, { children: [_jsx("path", { class: "lm-stone", d: `M${cellX + 8} ${cellY + 26}l5 -13l9 -5l8 6l3 12l-9 8z` }), _jsx("path", { class: "lm-detail", d: `M${cellX + 22} ${cellY + 8}l-3 10l11 4` })] }, `${cellX} ${cellY}`))) }));
71
+ case "low-wall":
72
+ return (_jsxs(_Fragment, { children: [_jsx("path", { class: "lm-low-wall", d: along ? `M${x + 2} ${cy}H${x + w - 2}` : `M${cx} ${y + 2}V${y + h - 2}` }), cells.map(([cellX, cellY]) => _jsx("rect", { x: cellX + size / 2 - 3, y: cellY + size / 2 - 3, width: 6, height: 6, class: "lm-ink-fill" }, `${cellX} ${cellY}`))] }));
73
+ case "bridge":
74
+ return (_jsxs(_Fragment, { children: [_jsx("rect", { ...inset(0.1), class: "lm-wood" }), _jsx("path", { class: "lm-detail", d: Array.from({ length: Math.round((along ? w : h) / 8) }, (_, plank) => (along ? `M${x + size * 0.1 + plank * 8} ${y + size * 0.1}v${h - size * 0.2}` : `M${x + size * 0.1} ${y + size * 0.1 + plank * 8}h${w - size * 0.2}`)).join("") })] }));
75
+ case "machine":
76
+ return (_jsxs(_Fragment, { children: [_jsx("rect", { ...inset(0.12), rx: 3, class: "lm-metal" }), _jsx("circle", { cx: cx, cy: cy, r: small * 0.16, class: "lm-detail" })] }));
77
+ case "vehicle":
78
+ return (_jsxs(_Fragment, { children: [_jsx("rect", { ...inset(0.16), rx: 4, class: "lm-wood" }), _jsx("path", { class: "lm-detail strong", d: `M${x + size * 0.1} ${y + size * 0.3}v8M${x + w - size * 0.1} ${y + size * 0.3}v8M${x + size * 0.1} ${y + h - size * 0.3}v-8M${x + w - size * 0.1} ${y + h - size * 0.3}v-8` })] }));
79
+ case "tent":
80
+ return (_jsxs(_Fragment, { children: [_jsx("rect", { ...inset(0.08), class: "lm-cloth" }), _jsx("path", { class: "lm-detail", d: `M${x + size * 0.08} ${y + size * 0.08}L${x + w - size * 0.08} ${y + h - size * 0.08}M${x + w - size * 0.08} ${y + size * 0.08}L${x + size * 0.08} ${y + h - size * 0.08}` })] }));
81
+ case "building":
82
+ return _jsx(Roof, { x: x, y: y, w: w, h: h, cells: cells });
83
+ case "stall":
84
+ return (_jsxs(_Fragment, { children: [_jsx("rect", { ...inset(0.1), class: "lm-awning" }), _jsx("path", { class: "lm-detail", d: Array.from({ length: Math.max(1, Math.round(w / 10) - 1) }, (_, stripe) => `M${x + size * 0.1 + (stripe + 1) * 9} ${y + size * 0.1}v${h - size * 0.2}`).join("") })] }));
85
+ case "fountain":
86
+ return (_jsxs(_Fragment, { children: [_jsx("circle", { cx: cx, cy: cy, r: small * 0.44, class: "lm-stone" }), _jsx("circle", { cx: cx, cy: cy, r: small * 0.36, class: "lm-basin" }), _jsx("circle", { cx: cx, cy: cy, r: small * 0.1, class: "lm-stone" }), _jsx("path", { class: "lm-wave", d: `M${cx - small * 0.26} ${cy + small * 0.18}q4 -4 8 0t8 0` })] }));
87
+ case "cliff":
88
+ // The drop: a line along the top, teeth falling from it.
89
+ return (_jsxs(_Fragment, { children: [_jsx("path", { class: "lm-detail strong", d: `M${x} ${y + 4}H${x + w}` }), _jsx("path", { class: "lm-cliff", d: Array.from({ length: Math.round(w / 8) }, (_, tooth) => `M${x + 2 + tooth * 8} ${y + 5}l3 ${h * 0.55}l3 ${-h * 0.55}`).join("") })] }));
90
+ case "hedge":
91
+ return _jsx("path", { class: "lm-canopy", d: along ? `M${x + 6} ${cy - 7}h${w - 12}a7 7 0 0 1 0 14h${-(w - 12)}a7 7 0 0 1 0 -14z` : `M${cx - 7} ${y + 6}v${h - 12}a7 7 0 0 0 14 0v${-(h - 12)}a7 7 0 0 0 -14 0z` });
92
+ case "hazard":
93
+ return (_jsx(_Fragment, { children: cells.map(([cellX, cellY]) => (_jsxs(Fragment, { children: [_jsx("path", { class: "lm-hazard", d: `M${cellX + size / 2} ${cellY + size / 2 - 12}l12 21h-24z` }), _jsx("text", { class: "lm-hazard-mark", x: cellX + size / 2, y: cellY + size / 2 + 6, "text-anchor": "middle", children: "!" })] }, `${cellX} ${cellY}`))) }));
94
+ case "mark":
95
+ return (_jsxs(_Fragment, { children: [_jsx("circle", { cx: cx, cy: cy, r: small * 0.38, class: "lm-mark" }), _jsx("circle", { cx: cx, cy: cy, r: small * 0.24, class: "lm-mark" })] }));
96
+ default:
97
+ return (_jsxs(_Fragment, { children: [_jsx("rect", { ...inset(0.2), rx: 6, class: "lm-thing-any" }), _jsx("text", { class: "lm-thing-symbol", x: cx, y: cy + 1, "text-anchor": "middle", "dominant-baseline": "middle", children: symbol })] }));
98
+ }
99
+ }
100
+ /** Roofs: the piece's squares in tiles, its outline, the ridge along its longer side. */
101
+ function Roof({ x, y, w, h, cells }) {
102
+ const inPiece = (cellX, cellY) => cells.some(([px, py]) => px === cellX && py === cellY);
103
+ const edges = cells.flatMap(([cellX, cellY]) => [[cellX, cellY - size, `M${cellX} ${cellY}h${size}`], [cellX + size, cellY, `M${cellX + size} ${cellY}v${size}`], [cellX, cellY + size, `M${cellX} ${cellY + size}h${size}`], [
104
+ cellX - size,
105
+ cellY,
106
+ `M${cellX} ${cellY}v${size}`,
107
+ ]]
108
+ .filter(([nx, ny]) => !inPiece(nx, ny))
109
+ .map(([, , path]) => path));
110
+ const along = w >= h;
111
+ const middle = along ? y + Math.floor(h / size / 2) * size + (h / size % 2 === 1 ? size / 2 : 0) : x + Math.floor(w / size / 2) * size + (w / size % 2 === 1 ? size / 2 : 0);
112
+ const ridge = cells.filter(([cellX, cellY]) => (along ? cellY <= middle && cellY + size >= middle : cellX <= middle && cellX + size >= middle))
113
+ .map(([cellX, cellY]) => (along ? `M${cellX} ${middle}h${size}` : `M${middle} ${cellY}v${size}`)).join("");
114
+ return (_jsxs("g", { class: `lm-roof tone-${Math.round((x + y) / size) % 3}`, children: [cells.map(([cellX, cellY]) => _jsx("rect", { class: "lm-roof-tiles", x: cellX, y: cellY, width: size, height: size }, `${cellX} ${cellY}`)), _jsx("path", { class: "lm-roof-edge", d: edges.join("") }), _jsx("path", { class: "lm-ridge", d: ridge })] }));
115
+ }
116
+ /** A flame, from its foot. */
117
+ function flame(x, y, height) {
118
+ return `M${x} ${y}c${-height * 0.45} ${-height * 0.25} ${-height * 0.3} ${-height * 0.7} 0 ${-height}c${height * 0.05} ${height * 0.3} ${height * 0.35} ${height * 0.35} ${height * 0.3} ${height * 0.65}`
119
+ + `c${-height * 0.02} ${height * 0.2} ${-height * 0.15} ${height * 0.33} ${-height * 0.3} ${height * 0.35}z`;
120
+ }
121
+ /** A tree's crown: a circle of lobes. */
122
+ function canopy(x, y, r) {
123
+ const bumps = 9;
124
+ return Array.from({ length: bumps + 1 }, (_, index) => {
125
+ const angle = (index / bumps) * Math.PI * 2;
126
+ const [px, py] = [x + Math.cos(angle) * r, y + Math.sin(angle) * r];
127
+ return index === 0 ? `M${px} ${py}` : `A${r * 0.36} ${r * 0.36} 0 0 1 ${px} ${py}`;
128
+ }).join("") + "z";
129
+ }
@@ -0,0 +1,93 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "preact/jsx-runtime";
2
+ import { Glass } from "../parts/glass.js";
3
+ import { strangerLabel } from "../parts/labels.js";
4
+ import { statusMarks, statusWords } from "../parts/status.js";
5
+ import { sideIcons, sideOf } from "../sheet/party.js";
6
+ import { conditionsPref, tokenSymbolsPref, useChoice, usePref } from "../shell/prefs.js";
7
+ import { size } from "./paper.js";
8
+ /**
9
+ * Someone on the map, as a coin (D-409): their picture to its edge, or a stranger's number, as Creature 2's, or the hood, under glass, its edge bevelled, lit
10
+ * above and shaded below, its shadow low on the paper; no ring of a side. Whoever acts is raised off the paper, a little larger, its shadow wide and soft (D-419); a foe the master marked glows
11
+ * red a little (D-415); one of the party has the pip of their side at the lower left, with their class's symbol or the side's (D-414); anyone the pip of
12
+ * their state at the lower right, and its words in the token's title (D-419).
13
+ */
14
+ export function Token({ one, index, acting, hostile, x, y, scale, choice }) {
15
+ const [symbols] = usePref(tokenSymbolsPref);
16
+ const side = one.side ?? 1;
17
+ const r = size * side * 0.43;
18
+ const number = one.stranger ? /[A-Z]?\d+$/.exec(one.name)?.[0] : undefined;
19
+ const pip = symbols ? sideOf(one.role) : undefined;
20
+ // On a map shown small, as on a phone, the marks grow to stay readable, each toward the token's middle by as much as it grows, its paper too, so that the
21
+ // box round it keeps its outer edges and two tokens side by side keep their marks apart as at full size.
22
+ const grow = Math.min(1.4, Math.max(1, 0.65 / scale));
23
+ // The two pips below share the square's width with their neighbours' on either side: past 1.12 the player's character's, gold-ringed, would touch the
24
+ // state's pip, on the token or the next one; the number, alone above, grows on.
25
+ const below = Math.min(grow, 1.12);
26
+ const inward = (radius, paper, by = below) => (by - 1) * (radius + paper);
27
+ const pipPaper = pip === "you" ? 3 : 1.5;
28
+ return (_jsxs("g", { class: ["lm-token", one.role, acting ? "acting" : "", fallenOf(one), choice === undefined ? "" : "choosable", choice?.chosen === true ? "chosen" : ""].filter((name) => name !== "").join(" "), style: acting ? { transformOrigin: `${x}px ${y}px` } : undefined, onClick: choice?.onChoose, children: [_jsx("title", { children: [`${one.stranger ? strangerLabel(one.name) : one.name}, ${one.square}`, ...statusWords(one)].join(" · ") }), hostile && (_jsxs(_Fragment, { children: [_jsx("circle", { class: "lm-hostile-glow", cx: x, cy: y, r: r + 7, fill: "url(#lm-hostile-glow)" }), _jsx("circle", { class: "lm-hostile", cx: x, cy: y, r: r + 2.4 })] })), choice !== undefined && _jsx("circle", { class: "lm-choice", cx: x, cy: y, r: r + 4 }), _jsxs("g", { filter: "url(#lm-drop)", children: [_jsx("circle", { class: "lm-disc", cx: x, cy: y, r: r }), _jsx("circle", { class: "lm-ring", cx: x, cy: y, r: r - 0.5 }), one.image
29
+ ? _jsx("image", { href: `/images/${encodeURIComponent(one.image.file)}?v=${one.image.version}`, x: x - r, y: y - r, width: r * 2, height: r * 2, "clip-path": `url(#lm-token-${index})` })
30
+ : (_jsx("g", { transform: `translate(${x} ${y}) scale(${side})`, children: number !== undefined
31
+ ? _jsx("text", { class: "lm-number", y: 1, "text-anchor": "middle", "dominant-baseline": "middle", children: number })
32
+ : one.stranger
33
+ ? _jsx("path", { class: "lm-stranger", d: "M12 3c-4 0-6.5 3.5-6.5 8v3.5L4 20.5h16l-1.5-6V11c0-4.5-2.5-8-6.5-8Z", transform: "translate(-10.8 -11) scale(0.9)" })
34
+ : _jsx("text", { class: "lm-number", y: 1, "text-anchor": "middle", "dominant-baseline": "middle", children: one.name.slice(0, 1).toUpperCase() }) })), _jsx(Glass, { x: x, y: y, r: r, prefix: "lm" }), _jsx("path", { class: "lm-bevel-lit", d: crescent(x, y, r, 1.5) }), _jsx("path", { class: "lm-bevel-shade", d: crescent(x, y, r, -1.5) })] }), pip !== undefined && _jsx(MapPip, { side: pip, icon: one.stranger ? undefined : one.icon, x: x - r * 0.725 + inward(pipRadius, pipPaper), y: y + r * 0.725 - inward(pipRadius, pipPaper), grow: below }), one.image !== undefined && number !== undefined && _jsx(MapNumber, { number: number, x: x + r * 0.725 - inward(numberRadius, 1.5, grow), y: y - r * 0.725 + inward(numberRadius, 1.5, grow), grow: grow }), _jsx(MapStatus, { one: one, x: x + r * 0.56 - inward(statusRadius, 1.5), y: y + r * 0.56 - inward(statusRadius, 1.5), grow: below })] }));
35
+ }
36
+ /** Someone on the map with what a widget on them says: dead by its rules too. */
37
+ export function standingOf(one, person) {
38
+ return { ...one, party: one.role !== "other", person, ...(person?.dead === true ? { dead: true } : {}) };
39
+ }
40
+ /** At 0 a token greyed, until its counter rises again; dead, greyer and faded, as in the party's strip (D-461). */
41
+ function fallenOf(one) {
42
+ return one.dead === true ? "dead" : one.down === true ? "fallen" : "";
43
+ }
44
+ // The marks on a token as on one of 40 pixels on the page: the side's pip of 17, the state's of 12, a number's coin 13 high.
45
+ const pipRadius = size * 0.43 * (17 / 40);
46
+ const statusRadius = size * 0.43 * (12 / 40);
47
+ const numberRadius = size * 0.43 * (13 / 40);
48
+ /**
49
+ * A token's pip on the map (D-414): as on the page, a disc of the side's colour with its symbol, ringed in the paper's colour; the same size for any creature,
50
+ * larger by `grow` on a map shown small.
51
+ */
52
+ function MapPip({ side, icon, x, y, grow }) {
53
+ const radius = pipRadius * grow;
54
+ // A symbol of 12 in the pip of 17.
55
+ const scale = (radius * 2 * (12 / 17)) / 24;
56
+ return (_jsxs("g", { class: `lm-pip ${side}`, "aria-hidden": "true", children: [_jsx("circle", { class: "lm-pip-paper", cx: x, cy: y, r: radius + (side === "you" ? 3 : 1.5) * grow }), side === "you" && _jsx("circle", { class: "lm-pip-gold", cx: x, cy: y, r: radius + 1.5 * grow }), _jsx("circle", { class: "lm-pip-disc", cx: x, cy: y, r: radius }), _jsx("path", { class: "lm-pip-symbol", d: icon ?? sideIcons[side], transform: `translate(${x - 12 * scale} ${y - 12 * scale}) scale(${scale})` })] }));
57
+ }
58
+ /**
59
+ * A stranger's number over their picture (D-420): as on the page, a small dark coin at the token's upper right, ringed in the paper's colour; wider for two
60
+ * letters; larger by `grow` on a map shown small.
61
+ */
62
+ function MapNumber({ number, x, y, grow }) {
63
+ // Figures of 8.5 on the coin.
64
+ const height = numberRadius * 2 * grow;
65
+ const width = Math.max(height, (number.length * 6 + 4) * grow);
66
+ return (_jsxs("g", { class: "lm-number-pip", "aria-hidden": "true", "font-size": 8.5 * grow, children: [_jsx("rect", { class: "lm-pip-paper", x: x - width / 2 - 1.5 * grow, y: y - height / 2 - 1.5 * grow, width: width + 3 * grow, height: height + 3 * grow, rx: height / 2 + 1.5 * grow }), _jsx("rect", { class: "lm-number-disc", x: x - width / 2, y: y - height / 2, width: width, height: height, rx: height / 2 }), _jsx("text", { class: "lm-number-small", x: x, y: y + 0.5 * grow, "text-anchor": "middle", "dominant-baseline": "middle", children: number })] }));
67
+ }
68
+ /**
69
+ * The pip of someone's state on the map (D-419): as on the page, smaller than the side's, a second coin behind when there are more; the same size for any
70
+ * creature, larger by `grow` on a map shown small.
71
+ */
72
+ function MapStatus({ one, x, y, grow }) {
73
+ const [shown] = useChoice(conditionsPref);
74
+ const marks = statusMarks(one);
75
+ if (shown === "never" || marks.length === 0) {
76
+ return null;
77
+ }
78
+ const radius = statusRadius * grow;
79
+ const paper = 1.5 * grow;
80
+ // A symbol of 9.6 in the pip of 12.
81
+ const scale = (radius * 2 * (24 / 30)) / 24;
82
+ // The second coin up more than out, within the token's square: a crescent of about 3 of the token's 40 past the paper round the first (D-420).
83
+ const behind = { x: radius * 0.3, y: radius * 0.85 };
84
+ const strong = marks[0].kind === "state";
85
+ return (_jsxs("g", { class: ["lm-status", strong ? "strong" : "", marks[0].tone ?? "", shown === "hover" ? "on-hover" : ""].filter((name) => name !== "").join(" "), "aria-hidden": "true", children: [marks.length > 1 && (_jsxs(_Fragment, { children: [_jsx("circle", { class: "lm-pip-paper", cx: x + behind.x, cy: y - behind.y, r: radius + paper }), _jsx("circle", { class: "lm-status-back", cx: x + behind.x, cy: y - behind.y, r: radius })] })), _jsx("circle", { class: "lm-pip-paper", cx: x, cy: y, r: radius + paper }), _jsx("circle", { class: "lm-status-disc", cx: x, cy: y, r: radius }), _jsx("path", { class: marks[0].filled ? "lm-status-symbol filled" : "lm-status-symbol", d: marks[0].icon, transform: `translate(${x - 12 * scale} ${y - 12 * scale}) scale(${scale})` })] }));
86
+ }
87
+ /** The thin crescent a coin's bevel lights, from its top when `offset` is positive or shades at its bottom when negative: the circle less itself moved by it. */
88
+ function crescent(x, y, r, offset) {
89
+ const half = Math.sqrt(r * r - (offset / 2) ** 2);
90
+ const middle = y + offset / 2;
91
+ const [outer, inner] = offset > 0 ? [1, 0] : [0, 1];
92
+ return `M${x - half} ${middle}A${r} ${r} 0 1 ${outer} ${x + half} ${middle}A${r} ${r} 0 0 ${inner} ${x - half} ${middle}Z`;
93
+ }
@@ -0,0 +1,124 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime";
2
+ // The map of the place where the party is (GRD-6, D-323, D-325), in ink and washes on light paper in both themes: walls hatched in bundles with a
3
+ // shade along them, the floor's outline rounded where it meets rock, the ground by the place's look and its kinds, the things of the legend drawn by kind, by
4
+ // square or by piece, doors and where squares lead, the squares' names; who stands where as coins, the one acting raised off the paper, a foe the master marked glowing (D-415); then the key, and who
5
+ // is where in words, the map's twin.
6
+ import { Fragment } from "preact";
7
+ import { useContext, useEffect, useRef, useState } from "preact/hooks";
8
+ import { TalkName, usePlayerActs } from "../acts/names.js";
9
+ import { WidgetsContext } from "../packages/widgets.js";
10
+ import { CardHead } from "../parts/card.js";
11
+ import { GlassDefs } from "../parts/glass.js";
12
+ import { iconPath } from "../parts/icons.js";
13
+ import { shownText, strangerLabel } from "../parts/labels.js";
14
+ import { personState } from "../parts/status.js";
15
+ import { t } from "../text.js";
16
+ import { featureName, MapKey } from "./key.js";
17
+ import { columnName, exitSide, floorLoops, groundKinds, isSolid, isStandable, isWalled, kindAt, nextTo, piecesOf, squareName, squareOf, symbolAt, tracedLoop } from "./map.js";
18
+ import { Corner, Door, Exit, Ground, Patterns, size } from "./paper.js";
19
+ import { Thing } from "./things.js";
20
+ import { standingOf, Token } from "./tokens.js";
21
+ // The order of who is where under the map.
22
+ const roles = ["pc", "companion", "other"];
23
+ export function PlaceMap({ map, place, acting, picking, choosing, bare = false, self: selfName }) {
24
+ const svg = useRef(null);
25
+ const where = useRef(null);
26
+ const acts = usePlayerActs();
27
+ const widgets = useContext(WidgetsContext);
28
+ // On the page, a token touched starts talking to them, the focus coming back to their line of who is where (D-495).
29
+ const talking = acts === undefined || picking !== undefined ? undefined : {
30
+ onChoose: (name) => {
31
+ const line = [...(where.current?.querySelectorAll("button.talk") ?? [])].find((button) => button.dataset.name === name);
32
+ return name !== undefined && acts.start({ talk: name }, line ?? svg.current ?? document.body);
33
+ },
34
+ };
35
+ const tokens = choosing ?? talking;
36
+ const scale = useScale(svg);
37
+ const sides = map.exits.map((exit) => exitSide(map, squareOf(exit.square) ?? { column: 0, row: 0 }));
38
+ const [left, top] = [30 + (sides.includes("left") ? 30 : 0), 30 + (sides.includes("top") ? 36 : 0)];
39
+ const [right, bottom] = [14 + (sides.includes("right") ? 30 : 0), 14 + (sides.includes("bottom") ? 34 : 0)];
40
+ const X = (column) => left + column * size;
41
+ const Y = (row) => top + row * size;
42
+ const [width, height] = [left + map.columns * size + right, top + map.rows * size + bottom];
43
+ const squares = Array.from({ length: map.rows }, (_, row) => Array.from({ length: map.columns }, (_, column) => ({ column, row }))).flat();
44
+ const open = squares.filter((square) => !isSolid(map, square));
45
+ const loops = floorLoops(map, X, Y);
46
+ const walled = isWalled(map);
47
+ const floor = loops.map((loop) => tracedLoop(loop, false, size * 0.5)).join("");
48
+ const outline = walled ? loops.map((loop) => tracedLoop(loop, true, size * 0.5)).join("") : "";
49
+ const featureAt = (square) => map.legend.find((feature) => feature.symbol === symbolAt(map, square));
50
+ // Hatching only next to the rooms: farther the rock or the masonry is left as paper.
51
+ const nearRoom = (square) => [-1, 0, 1].some((dc) => [-1, 0, 1].some((dr) => !isSolid(map, { column: square.column + dc, row: square.row + dr })));
52
+ const things = map.legend.filter((feature) => !["wall", "rock", "floor", "door", "open-door", "secret-door", "opening", ...groundKinds].includes(feature.kind));
53
+ const standing = map.at.flatMap((one) => {
54
+ const square = squareOf(one.square);
55
+ return square === undefined ? [] : [{ ...one, at: square }];
56
+ });
57
+ const self = standing.find((one) => one.role === "pc" && (selfName === undefined || one.name === selfName));
58
+ // What one fills, in squares a side: a large creature stands on the square at the top left of its own (GRD-4).
59
+ const middle = (one) => [X(one.at.column) + (size * (one.side ?? 1)) / 2, Y(one.at.row) + (size * (one.side ?? 1)) / 2];
60
+ // The squares the character can still reach, and those it stands on, which are never out of its reach (D-328).
61
+ const reach = [
62
+ ...(map.reach ?? []).flatMap((name) => {
63
+ const square = squareOf(name);
64
+ return square === undefined ? [] : [square];
65
+ }),
66
+ ...(map.reach === undefined || self === undefined
67
+ ? []
68
+ : Array.from({ length: (self.side ?? 1) ** 2 }, (_, index) => ({ column: self.at.column + (index % (self.side ?? 1)), row: self.at.row + Math.floor(index / (self.side ?? 1)) }))),
69
+ ];
70
+ const letters = Math.max(11, 11 / scale);
71
+ const frame = useRef(null);
72
+ // On a phone the map keeps squares a finger can read and scrolls aside (D-547): it opens with the player's character in the middle.
73
+ useEffect(() => {
74
+ const box = frame.current;
75
+ if (box === null || self === undefined || box.scrollWidth <= box.clientWidth) {
76
+ return;
77
+ }
78
+ const [x] = middle(self);
79
+ const shown = box.scrollWidth / width;
80
+ // The frame keeps its squares left to right in every language, so its scroll does too.
81
+ box.scrollLeft = Math.max(0, x * shown - box.clientWidth / 2);
82
+ }, [map.columns, map.rows, self?.at.column, self?.at.row]);
83
+ const drawn = (_jsxs(_Fragment, { children: [_jsx("path", { class: "lm-floor-fill", d: floor, "fill-rule": "evenodd" }), _jsx("g", { class: "lm-ground", "clip-path": "url(#lm-open)", children: open.filter((square) => groundKinds.includes(kindAt(map, square))).map((square) => _jsx(Ground, { kind: kindAt(map, square), x: X(square.column), y: Y(square.row), side: size, seed: square }, squareName(square))) }), _jsx("path", { class: "lm-grid", d: open.map((square) => `M${X(square.column)} ${Y(square.row)}h${size}v${size}h${-size}z`).join(""), "clip-path": "url(#lm-open)" }), open.filter((square) => featureAt(square)?.difficult).map((square) => _jsx(Corner, { x: X(square.column), y: Y(square.row), side: size }, squareName(square))), things.map((feature) => piecesOf(map, feature.symbol, feature.kind).map((piece) => (_jsxs("g", { class: `lm-thing ${feature.kind}`, children: [_jsx("title", { children: [featureName(feature), feature.blocks ? t("blocks") : "", feature.difficult ? t("difficult") : ""].filter((part) => part !== "").join(", ") }), _jsx(Thing, { kind: feature.kind, symbol: feature.symbol, x: X(piece.left), y: Y(piece.top), w: (piece.right - piece.left) * size, h: (piece.bottom - piece.top) * size, cells: piece.squares.map((square) => [X(square.column), Y(square.row)]) })] }, `${feature.symbol} ${piece.left} ${piece.top}`)))), _jsx("path", { class: "lm-shade", d: outline, "clip-path": "url(#lm-open)", filter: "url(#lm-blur)" })] }));
84
+ return (_jsxs("section", { class: "lm", "aria-labelledby": "lm-title", children: [_jsx(CardHead, { icon: iconPath("world"), title: _jsx("h3", { id: "lm-title", children: t("Map") }), note: place }), _jsx("div", { ref: frame, class: picking === undefined && choosing === undefined ? "lm-frame" : "lm-frame panned", style: { "--map-width": String(width) }, children: _jsxs("svg", { ref: svg, class: `lm-svg lm-look-${map.ground}`, viewBox: `0 0 ${width} ${height}`, ...(picking === undefined && choosing === undefined ? {} : { width: width * 1.2 }), role: "img", "aria-label": t("Map of {place}", { place }), children: [_jsxs("defs", { children: [_jsx(Patterns, {}), _jsx(GlassDefs, { prefix: "lm" }), _jsxs("radialGradient", { id: "lm-hostile-glow", children: [_jsx("stop", { offset: "0.75", "stop-color": "#c8321f", "stop-opacity": "0.3" }), _jsx("stop", { offset: "1", "stop-color": "#c8321f", "stop-opacity": "0" })] }), _jsx("clipPath", { id: "lm-open", children: _jsx("path", { d: floor, "clip-rule": "evenodd" }) }), !walled && (_jsx("mask", { id: "lm-fade", maskUnits: "userSpaceOnUse", x: 0, y: 0, width: width, height: height, children: _jsx("rect", { x: X(0) + size * 0.35, y: Y(0) + size * 0.35, width: map.columns * size - size * 0.7, height: map.rows * size - size * 0.7, fill: "#fff", filter: "url(#lm-soft)" }) })), standing.map((one, index) => (_jsx("clipPath", { id: `lm-token-${index}`, children: _jsx("circle", { cx: middle(one)[0], cy: middle(one)[1], r: size * (one.side ?? 1) * 0.43 }) }, index)))] }), _jsx("rect", { class: "lm-paper", width: width, height: height }), _jsx("g", { class: "lm-walls", children: squares.filter((square) => ["wall", "rock", "window"].includes(kindAt(map, square)) && nearRoom(square)).map((square) => (_jsxs(Fragment, { children: [_jsx("rect", { class: "lm-wall-under", x: X(square.column), y: Y(square.row), width: size, height: size }), _jsx("rect", { class: `lm-wall ${kindAt(map, square)}`, x: X(square.column), y: Y(square.row), width: size, height: size })] }, squareName(square)))) }), walled ? drawn : _jsx("g", { mask: "url(#lm-fade)", children: drawn }), reach.length > 0 && (_jsx("g", { class: "lm-out", "aria-hidden": "true", "clip-path": "url(#lm-open)", children: open.filter((square) => !reach.some((near) => near.column === square.column && near.row === square.row)).map((square) => (_jsx("rect", { x: X(square.column), y: Y(square.row), width: size, height: size }, squareName(square)))) })), _jsx("path", { class: "lm-outline", d: outline, filter: "url(#lm-ink)" }), squares.filter((square) => ["door", "open-door", "secret-door"].includes(kindAt(map, square))).map((square) => (_jsx(Door, { kind: kindAt(map, square), name: featureAt(square)?.name ?? "door", square: square, map: map, x: X(square.column), y: Y(square.row) }, squareName(square)))), map.exits.map((exit, index) => {
85
+ const square = squareOf(exit.square);
86
+ return square === undefined ? null : _jsx(Exit, { side: sides[index], to: exit.to, x: X(square.column) + size / 2, y: Y(square.row) + size / 2, letters: Math.max(13, 12 / scale) }, exit.square);
87
+ }), _jsxs("g", { class: "lm-coordinates", "font-size": letters, children: [Array.from({ length: map.columns }, (_, column) => _jsx("text", { x: X(column) + size / 2, y: top - 10, "text-anchor": "middle", children: columnName(column) }, `c${column}`)), Array.from({ length: map.rows }, (_, row) => _jsx("text", { x: left - 10, y: Y(row) + size / 2, "text-anchor": "end", "dominant-baseline": "middle", children: row + 1 }, `r${row}`))] }), _jsx("g", { class: "lm-tokens", children: standing.map((one, index) => {
88
+ // Talking needs someone else, never one of the player characters; choosing for an action takes the one acting too, as themselves, and
89
+ // with more than one the others by name.
90
+ const other = one.role !== "pc" || (choosing !== undefined && selfName !== undefined && one !== self);
91
+ const shown = !other ? undefined : one.stranger ? strangerLabel(one.name) : one.name;
92
+ const choice = tokens === undefined || (shown === undefined && choosing === undefined) ? undefined : {
93
+ chosen: choosing !== undefined && choosing.selected === shown && shown !== undefined,
94
+ onChoose: () => tokens.onChoose(shown),
95
+ };
96
+ return (_jsx(Token, { one: standingOf(one, one.role === "other" ? undefined : personState(widgets, one.name)), index: index, acting: one.name === acting, hostile: one.hostile === true, x: middle(one)[0], y: middle(one)[1], scale: scale, ...(choice === undefined ? {} : { choice }) }, index));
97
+ }) }), picking !== undefined && (_jsx("g", { class: "lm-picks", children: squares.filter((square) => isStandable(map, square)).map((square) => (_jsx("rect", { class: picking.selected === squareName(square) ? "lm-pick selected" : "lm-pick", x: X(square.column) + 1, y: Y(square.row) + 1, width: size - 2, height: size - 2, rx: 4, onClick: () => picking.onSelect(squareName(square)), children: _jsx("title", { children: squareName(square) }) }, squareName(square)))) }))] }) }), !bare && _jsx(MapKey, { map: map, reach: reach.length > 0, self: selfName }), !bare && standing.length > 0 && (_jsx("ul", { ref: where, class: "lm-where", "aria-label": t("Who is where"), children: standing.toSorted((first, second) => measuredFirst(first, second, selfName === undefined ? undefined : self) || roles.indexOf(first.role) - roles.indexOf(second.role)).map((one, index) => (_jsxs("li", { class: `lm-where-${one.role}${one.hostile === true ? " hostile" : ""}`, children: [one.role === "pc"
98
+ ? _jsx("span", { class: "lm-where-name", children: one.name })
99
+ : (_jsx(TalkName, { name: one.stranger ? strangerLabel(one.name) : one.name, children: _jsx("span", { class: "lm-where-name", children: one.stranger ? strangerLabel(one.name) : one.name }) })), _jsx("span", { class: "lm-key-square", children: one.square }), selfName !== undefined && one === self
100
+ ? _jsx("span", { class: "lm-where-far", children: t("from here") })
101
+ : one.distance !== undefined
102
+ ? _jsx("span", { class: "lm-where-far", children: shownText(one.distance) })
103
+ : self !== undefined && one !== self && (nextTo(one.at, self.at) || one.square === self.square) && (_jsx("span", { class: "lm-where-far", children: selfName === undefined ? t("next to you") : t("next to {name}", { name: selfName }) }))] }, index))) }))] }));
104
+ }
105
+ /** The one the distances are from before anyone else, when named: a negative number puts the first before the second. */
106
+ function measuredFirst(first, second, from) {
107
+ return from === undefined ? 0 : first === from ? -1 : second === from ? 1 : 0;
108
+ }
109
+ /** How much the map is scaled on the screen, from its drawn width to its shown one: the letters around it keep a readable size on a phone. */
110
+ function useScale(svg) {
111
+ const [scale, setScale] = useState(1);
112
+ useEffect(() => {
113
+ const element = svg.current;
114
+ if (element === null || typeof ResizeObserver === "undefined") {
115
+ return;
116
+ }
117
+ const measure = () => setScale(element.getBoundingClientRect().width / (element.viewBox.baseVal?.width || 1));
118
+ const observer = new ResizeObserver(measure);
119
+ observer.observe(element);
120
+ measure();
121
+ return () => observer.disconnect();
122
+ }, []);
123
+ return scale;
124
+ }
@@ -3,9 +3,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
3
3
  // for each counter of dice, which rolls one of its dice and stays, and the button that ends it. The engine rolls each die and the question comes back with
4
4
  // the counters as they are; a game's own card, as the 5e's for its hit dice, comes from its page module.
5
5
  import { useEffect, useRef, useState } from "preact/hooks";
6
- import { DieIcon } from "./icons.js";
7
- import { fieldLabel, signed } from "./labels.js";
8
- import { numberText, t } from "./text.js";
6
+ import { DieIcon } from "../parts/icons.js";
7
+ import { fieldLabel, signed } from "../parts/labels.js";
8
+ import { numberText, t } from "../text.js";
9
9
  export function AskedDice({ asked, spend, flying, onSpend, onDone }) {
10
10
  const element = useRef(null);
11
11
  // A die asked of the engine, until its roll comes back, as how many rolls there were then; the end asked.
@@ -4,16 +4,16 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "preact/jsx-ru
4
4
  // hand, as the player may choose for this browser, a check has no button: it is rolled from its row of the sheet or with the tray's dice (D-330).
5
5
  import { Fragment } from "preact";
6
6
  import { useEffect, useLayoutEffect, useRef, useState } from "preact/hooks";
7
- import { answer } from "./api.js";
8
- import { trayThrows } from "./dice/pool.js";
9
- import { CoinFace } from "./faces.js";
10
- import { notationLabel } from "./game-words.js";
11
- import { Icon, NotationIcons } from "./icons.js";
12
- import { checkOf, notationModifier, sameDice, signed } from "./labels.js";
13
- import { sheetAddress, sideOf, Token } from "./party.js";
14
- import { MapSheet } from "./place/map-sheet.js";
15
- import { byHandPref, usePref } from "./prefs.js";
16
- import { t, tParts } from "./text.js";
7
+ import { answer } from "../api.js";
8
+ import { trayThrows } from "../dice/pool.js";
9
+ import { CoinFace } from "../parts/faces.js";
10
+ import { notationLabel } from "../parts/game-words.js";
11
+ import { Icon, NotationIcons } from "../parts/icons.js";
12
+ import { checkOf, notationModifier, sameDice, signed } from "../parts/labels.js";
13
+ import { MapSheet } from "../place/sheet.js";
14
+ import { sheetAddress, sideOf, Token } from "../sheet/party.js";
15
+ import { byHandPref, usePref } from "../shell/prefs.js";
16
+ import { t, tParts } from "../text.js";
17
17
  import { turnWords } from "./turns.js";
18
18
  // How far below the top the banner stays, as in the style sheet; how many characters the player's own words may have, as the server takes them.
19
19
  const bannerTop = 16;
@@ -1,13 +1,13 @@
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 { choicesAddress } from "./address.js";
4
- import { changeChoices, readChoices, readView } from "./api.js";
5
- import { useMedia } from "./card.js";
6
- import { Icon, NotationIcons } from "./icons.js";
7
- import { diceIn, shownNotation } from "./labels.js";
8
- import { Markdown } from "./markdown.js";
9
- import { sheetAddress, sideOf, Token } from "./party.js";
10
- import { arrowStep, capitalized, foldedText, t } from "./text.js";
3
+ import { choicesAddress } from "../address.js";
4
+ import { changeChoices, readChoices, readView } from "../api.js";
5
+ import { useMedia } from "../parts/card.js";
6
+ import { Icon, NotationIcons } from "../parts/icons.js";
7
+ import { diceIn, shownNotation } from "../parts/labels.js";
8
+ import { Markdown } from "../parts/markdown.js";
9
+ import { sheetAddress, sideOf, Token } from "../sheet/party.js";
10
+ import { arrowStep, capitalized, foldedText, t } from "../text.js";
11
11
  // From this width an option's page stands beside the choices; under it, in their place.
12
12
  const wide = "(min-width: 900px)";
13
13
  // From how many options a choice has its search, and the ones chosen over it.
@@ -238,7 +238,7 @@ function ItemState({ item }) {
238
238
  function OptionCard({ id, option, role, checked, closed, tabIndex, read, href, total, about, hand, onChoose }) {
239
239
  const opening = about ?? option.pages?.[0].opening;
240
240
  const kinds = ["choice-card", checked ? "chosen" : "", closed && !checked ? "closed" : "", option.notation === undefined ? "" : "choice-roll", href === undefined ? "alone" : ""];
241
- return (_jsxs("div", { class: kinds.filter((kind) => kind !== "").join(" "), children: [_jsxs("button", { type: "button", class: "choice-pick", role: role, "aria-checked": checked, "aria-disabled": closed ? true : undefined, tabIndex: tabIndex, "aria-labelledby": total === undefined ? `${id}-name` : `${id}-name ${id}-total`, "aria-describedby": opening === undefined || opening === "" ? undefined : `${id}-about`, onClick: onChoose, children: [_jsx("span", { class: role === "checkbox" ? "choice-mark square" : "choice-mark", "aria-hidden": "true", children: _jsx(Icon, { name: "check" }) }), _jsxs("span", { class: "choice-words", children: [_jsxs("strong", { id: `${id}-name`, class: option.notation === undefined ? undefined : "choice-dice", children: [option.notation !== undefined && _jsx(NotationIcons, { notation: option.notation }), _jsx("bdi", { children: option.label }), option.notation !== undefined && _jsx("bdi", { class: "num", children: shownNotation(option.notation) })] }), opening !== undefined && opening !== "" && _jsx("span", { class: "choice-about", id: `${id}-about`, children: opening })] }), total !== undefined && _jsx("span", { class: "choice-total num", id: `${id}-total`, children: total })] }), href !== undefined && option.pages !== undefined && (_jsx("a", { class: "icon-button choice-read tip-left", href: href, "data-name": option.pages[0].name, "aria-label": t("Read {name}", { name: option.label }), "data-tip": t("Read {name}", { name: option.label }), "aria-current": read ? "true" : undefined, children: _jsx(Icon, { name: "read" }) })), hand] }));
241
+ return (_jsxs("div", { class: kinds.filter((kind) => kind !== "").join(" "), children: [_jsxs("button", { type: "button", class: "choice-pick", role: role, "aria-checked": checked, "aria-disabled": closed ? true : undefined, tabIndex: tabIndex, "aria-labelledby": total === undefined ? `${id}-name` : `${id}-name ${id}-total`, "aria-describedby": opening === undefined || opening === "" ? undefined : `${id}-about`, onClick: onChoose, children: [_jsx("span", { class: role === "checkbox" ? "choice-mark square" : "choice-mark", "aria-hidden": "true", children: _jsx(Icon, { name: "check" }) }), _jsxs("span", { class: "choice-words", children: [_jsxs("strong", { id: `${id}-name`, class: option.notation === undefined ? undefined : "choice-dice", children: [option.notation !== undefined && _jsx(NotationIcons, { notation: option.notation }), _jsx("bdi", { children: option.label }), option.notation !== undefined && _jsx("bdi", { class: "num", children: shownNotation(option.notation) })] }), opening !== undefined && opening !== "" && _jsx("span", { class: "choice-about", id: `${id}-about`, dir: "auto", children: opening })] }), total !== undefined && _jsx("span", { class: "choice-total num", id: `${id}-total`, children: total })] }), href !== undefined && option.pages !== undefined && (_jsx("a", { class: "icon-button choice-read tip-left", href: href, "data-name": option.pages[0].name, "aria-label": t("Read {name}", { name: option.label }), "data-tip": t("Read {name}", { name: option.label }), "aria-current": read ? "true" : undefined, children: _jsx(Icon, { name: "read" }) })), hand] }));
242
242
  }
243
243
  /** The field of a roll made with the player's own dice: a number for each die, as it landed, then Write. */
244
244
  function HandDice({ notation, id, onWrite }) {
@@ -2,7 +2,7 @@
2
2
  // tray's dice when they are a check's own; every other roll of the page is free.
3
3
  import { createContext } from "preact";
4
4
  import { useContext } from "preact/hooks";
5
- import { checkOf, sameDice } from "./labels.js";
5
+ import { checkOf, sameDice } from "../parts/labels.js";
6
6
  export const RequestedRoll = createContext(undefined);
7
7
  /** The roll the master asks now, when it is one, and what answers its checks. */
8
8
  export function requestedOf(asked, answer) {
@@ -4,15 +4,15 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-ru
4
4
  // newest roll while it is closed (D-284), on the table beside the sheet too. Those of the last half hour, older ones at a click at the end of the
5
5
  // list; Clear starts the list again, the log untouched, and forgets the free rolls; Restore brings the log back, never them (D-302, D-304).
6
6
  import { useEffect, useRef, useState } from "preact/hooks";
7
- import { CardHeader, useOpen } from "./card.js";
8
- import { coinOf, mastersDice } from "./dice/sets.js";
9
- import { CoinFaces, DiceFaces, tossWords } from "./faces.js";
10
- import { gameDateLabel, notationLabel } from "./game-words.js";
11
- import { cardIcons, Icon } from "./icons.js";
12
- import { notationModifier, strangerLabel } from "./labels.js";
13
- import { rollWindow } from "./layout.js";
14
- import { Token } from "./party.js";
15
- import { capitalized, pageLocale, t } from "./text.js";
7
+ import { coinOf, mastersDice } from "../dice/sets.js";
8
+ import { CardHeader, useOpen } from "../parts/card.js";
9
+ import { CoinFaces, DiceFaces, tossWords } from "../parts/faces.js";
10
+ import { gameDateLabel, notationLabel } from "../parts/game-words.js";
11
+ import { cardIcons, Icon } from "../parts/icons.js";
12
+ import { notationModifier, strangerLabel } from "../parts/labels.js";
13
+ import { rollWindow } from "../parts/layout.js";
14
+ import { Token } from "../sheet/party.js";
15
+ import { capitalized, pageLocale, t } from "../text.js";
16
16
  // Where the browser remembers when the player last cleared the list of a campaign; how many older rolls each Load more shows.
17
17
  const clearedKey = "rpg-engine.rolls-cleared";
18
18
  const moreRolls = 10;
@@ -2,21 +2,21 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-ru
2
2
  // The Scene section (D-309, VIEW-6, D-444): where the party is, its picture with the places around it, its name, what holds there and its text; the open
3
3
  // scene and who is in it; outside a scene who is there of those the character knows; the map. While the scene goes by turns, the turns first.
4
4
  import { useContext, useEffect, useRef, useState } from "preact/hooks";
5
- import { TalkName } from "./acts/names.js";
6
- import { sectionAddress } from "./address.js";
7
- import { effectLabel, sinceDateLabel, terrainLabel } from "./game-words.js";
8
- import { cardIcons, Icon } from "./icons.js";
9
- import { phraseLabel, sceneTypeLabel, strangerLabel } from "./labels.js";
10
- import { biomeLabel, biomes } from "./map-symbols.js";
11
- import { InlineText, knowersOf, Markdown } from "./markdown.js";
12
- import { WidgetCards, WidgetsContext } from "./packages/widgets.js";
13
- import { sideOf, Token } from "./party.js";
14
- import { PlaceMap } from "./place/map-view.js";
15
- import { Card } from "./sheet.js";
16
- import { downTint, personState, StatusPip } from "./status.js";
17
- import { foldedText, t } from "./text.js";
5
+ import { TalkName } from "../acts/names.js";
6
+ import { sectionAddress } from "../address.js";
7
+ import { WidgetCards, WidgetsContext } from "../packages/widgets.js";
8
+ import { effectLabel, sinceDateLabel, terrainLabel } from "../parts/game-words.js";
9
+ import { cardIcons, Icon } from "../parts/icons.js";
10
+ import { phraseLabel, sceneTypeLabel, strangerLabel } from "../parts/labels.js";
11
+ import { biomeLabel, biomes } from "../parts/map-symbols.js";
12
+ import { InlineText, knowersOf, Markdown } from "../parts/markdown.js";
13
+ import { downTint, personState, StatusPip } from "../parts/status.js";
14
+ import { PlaceMap } from "../place/view.js";
15
+ import { sideOf, Token } from "../sheet/party.js";
16
+ import { Card } from "../sheet/sheet.js";
17
+ import { foldedText, t } from "../text.js";
18
+ import { BiomeSwatch } from "../world/key.js";
18
19
  import { CharacterCard, hasTurns, TurnBand, TurnsCard } from "./turns.js";
19
- import { BiomeSwatch } from "./world/world.js";
20
20
  // How long the band takes to come in or go out, the style sheet's --short, as the master's question folds.
21
21
  const bandTime = 250;
22
22
  /**
@@ -4,18 +4,18 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-ru
4
4
  // strip that lights up on their turn, their counter, the party's as numbers and a foe's in words, their state as icons, what they keep, the death saves at 0;
5
5
  // and the player's character's card, the fields and groups of its sheet the system names. The page never decides a rule: it shows.
6
6
  import { useContext, useEffect, useRef } from "preact/hooks";
7
- import { TalkName } from "./acts/names.js";
8
- import { CardHead, CardHeader, useOpen } from "./card.js";
9
- import { Icon, iconPath } from "./icons.js";
10
- import { fieldLabel, itemLabel, phraseLabel, shownText, strangerLabel } from "./labels.js";
11
- import { stripCounter } from "./layout.js";
12
- import { WidgetsContext } from "./packages/widgets.js";
13
- import { sideOf, Token } from "./party.js";
14
- import { PersonPanel, personShown } from "./person-panel.js";
15
- import { SheetAtHand } from "./sheet.js";
16
- import { downTint, personState, StatusIcons, StatusPip } from "./status.js";
17
- import { arrowStep, t } from "./text.js";
18
- import { Bar } from "./widgets.js";
7
+ import { TalkName } from "../acts/names.js";
8
+ import { WidgetsContext } from "../packages/widgets.js";
9
+ import { CardHead, CardHeader, useOpen } from "../parts/card.js";
10
+ import { Icon, iconPath } from "../parts/icons.js";
11
+ import { fieldLabel, itemLabel, phraseLabel, shownText, strangerLabel } from "../parts/labels.js";
12
+ import { stripCounter } from "../parts/layout.js";
13
+ import { downTint, personState, StatusIcons, StatusPip } from "../parts/status.js";
14
+ import { Bar } from "../parts/widgets.js";
15
+ import { sideOf, Token } from "../sheet/party.js";
16
+ import { PersonPanel, personShown } from "../sheet/person-panel.js";
17
+ import { SheetAtHand } from "../sheet/sheet.js";
18
+ import { arrowStep, t } from "../text.js";
19
19
  /** Whether the open scene goes by turns. */
20
20
  export function hasTurns(scene) {
21
21
  return (scene?.fighters?.length ?? 0) > 0;
@@ -2,8 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
2
2
  // The game's language as a choice with a search (D-394): every language, each in its own words and in the page's, those the page is written in first; a code
3
3
  // not in the list can be written whole, as pt-PT. A choice is saved at once, as the other settings'.
4
4
  import { useEffect, useId, useMemo, useState } from "preact/hooks";
5
+ import { pageLocale, pageTranslation, t } from "../text.js";
5
6
  import { languageName, languageOf, languages, matches } from "./languages.js";
6
- import { pageLocale, pageTranslation, t } from "./text.js";
7
7
  export function LanguageChoice({ value, labelledBy, describedBy, onPick }) {
8
8
  const pageLanguage = pageLocale();
9
9
  const all = useMemo(() => languages(pageLanguage), [pageLanguage]);
@@ -1,6 +1,6 @@
1
1
  // The languages the player may choose for the game (D-394): every language the master can play in, each named in its own words and in the page's by the
2
2
  // browser; a code not listed can still be written. Those the page is written in come first.
3
- import { foldedText, pageLanguages } from "./text.js";
3
+ import { foldedText, pageLanguages } from "../text.js";
4
4
  // The languages of the list, by code: ISO 639-1, with the regional variants that read differently.
5
5
  const codes = [
6
6
  "af",