rpg-engine 0.14.1 → 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.
- package/dist/campaign/index.d.ts +1 -1
- package/dist/campaign/index.js +1 -1
- package/dist/campaign/last-choices.js +1 -1
- package/dist/campaign/settings.d.ts +25 -5
- package/dist/campaign/settings.js +38 -9
- package/dist/cli/cli.js +1 -1
- package/dist/cli/command-line.js +1 -1
- package/dist/commands/advance.d.ts +1 -1
- package/dist/commands/advance.js +6 -6
- package/dist/commands/ask.js +7 -7
- package/dist/commands/change/amounts.d.ts +32 -0
- package/dist/commands/change/amounts.js +150 -0
- package/dist/commands/change/change.d.ts +4 -54
- package/dist/commands/change/change.js +19 -749
- package/dist/commands/change/damage.d.ts +30 -0
- package/dist/commands/change/damage.js +73 -2
- package/dist/commands/change/dice.d.ts +34 -0
- package/dist/commands/change/dice.js +59 -0
- package/dist/commands/change/fields.d.ts +37 -0
- package/dist/commands/change/fields.js +156 -0
- package/dist/commands/change/holder.d.ts +48 -0
- package/dist/commands/change/holder.js +162 -0
- package/dist/commands/change/recipe-pace.js +1 -1
- package/dist/commands/change/recipe.d.ts +58 -0
- package/dist/commands/change/recipe.js +179 -0
- package/dist/commands/choices.js +3 -3
- package/dist/commands/config/config.d.ts +15 -0
- package/dist/commands/config/config.js +355 -0
- package/dist/commands/config/custom-levels.d.ts +7 -0
- package/dist/commands/config/custom-levels.js +32 -0
- package/dist/commands/{config.d.ts → config/dashboard.d.ts} +4 -26
- package/dist/commands/config/dashboard.js +171 -0
- package/dist/commands/config/entries.d.ts +17 -0
- package/dist/commands/config/entries.js +76 -0
- package/dist/commands/config/news.d.ts +7 -0
- package/dist/commands/config/news.js +88 -0
- package/dist/commands/config/shown.d.ts +9 -0
- package/dist/commands/config/shown.js +80 -0
- package/dist/commands/config/words.d.ts +27 -0
- package/dist/commands/config/words.js +204 -0
- package/dist/commands/effect.js +9 -9
- package/dist/commands/find.d.ts +4 -4
- package/dist/commands/find.js +1 -1
- package/dist/commands/image.js +6 -6
- package/dist/commands/import/import.d.ts +0 -2
- package/dist/commands/import/import.js +45 -44
- package/dist/commands/import/run.js +1 -1
- package/dist/commands/index.js +3 -3
- package/dist/commands/init.js +2 -2
- package/dist/commands/install.js +1 -1
- package/dist/commands/instructions.js +17 -6
- package/dist/commands/mode.d.ts +2 -2
- package/dist/commands/mode.js +17 -9
- package/dist/commands/mood.js +4 -4
- package/dist/commands/move.js +10 -10
- package/dist/commands/package/consent.d.ts +11 -0
- package/dist/commands/package/consent.js +52 -0
- package/dist/commands/package/here.d.ts +51 -0
- package/dist/commands/package/here.js +128 -0
- package/dist/commands/package/install.d.ts +10 -0
- package/dist/commands/package/install.js +337 -0
- package/dist/commands/package/package.d.ts +18 -0
- package/dist/commands/package/package.js +236 -0
- package/dist/commands/package/result.d.ts +90 -0
- package/dist/commands/package/result.js +1 -0
- package/dist/commands/package/uninstall.d.ts +6 -0
- package/dist/commands/package/uninstall.js +70 -0
- package/dist/commands/rename.js +3 -3
- package/dist/commands/reveal.js +5 -5
- package/dist/commands/roll/roll.js +11 -9
- package/dist/commands/roll/tables.js +1 -1
- package/dist/commands/rules.d.ts +2 -2
- package/dist/commands/rules.js +3 -3
- package/dist/commands/save.d.ts +1 -1
- package/dist/commands/save.js +2 -2
- package/dist/commands/scene/close.d.ts +18 -0
- package/dist/commands/scene/close.js +179 -0
- package/dist/commands/scene/members.d.ts +14 -0
- package/dist/commands/scene/members.js +32 -0
- package/dist/commands/scene/open.d.ts +6 -0
- package/dist/commands/scene/open.js +298 -0
- package/dist/commands/scene/result.d.ts +98 -0
- package/dist/commands/scene/result.js +2 -0
- package/dist/commands/{scene.d.ts → scene/scene.d.ts} +10 -36
- package/dist/commands/scene/scene.js +210 -0
- package/dist/commands/scene/turns.d.ts +18 -0
- package/dist/commands/scene/turns.js +229 -0
- package/dist/commands/shared/{adventures.d.ts → books/adventures.d.ts} +5 -3
- package/dist/commands/shared/{adventures.js → books/adventures.js} +23 -19
- package/dist/commands/shared/{library-reader.js → books/library-reader.js} +3 -3
- package/dist/commands/shared/{library.d.ts → books/library.d.ts} +2 -2
- package/dist/commands/shared/{library.js → books/library.js} +9 -9
- package/dist/commands/shared/{rules.d.ts → books/rules.d.ts} +2 -2
- package/dist/commands/shared/{rules.js → books/rules.js} +5 -5
- package/dist/commands/shared/{system-texts.d.ts → books/system-texts.d.ts} +2 -2
- package/dist/commands/shared/{system-texts.js → books/system-texts.js} +9 -8
- package/dist/commands/shared/{page-words.d.ts → books/words.d.ts} +2 -2
- package/dist/commands/shared/{page-words.js → books/words.js} +4 -4
- package/dist/commands/shared/{checks.d.ts → campaign/checks.d.ts} +3 -3
- package/dist/commands/shared/{checks.js → campaign/checks.js} +7 -7
- package/dist/commands/shared/{images.d.ts → campaign/images.d.ts} +3 -3
- package/dist/commands/shared/{images.js → campaign/images.js} +5 -5
- package/dist/commands/shared/{mode.d.ts → campaign/mode.d.ts} +4 -4
- package/dist/commands/shared/{mode.js → campaign/mode.js} +28 -13
- package/dist/commands/shared/{money.d.ts → campaign/money.d.ts} +3 -3
- package/dist/commands/shared/{money.js → campaign/money.js} +2 -2
- package/dist/commands/shared/{offers.d.ts → campaign/offers.d.ts} +3 -3
- package/dist/commands/shared/{offers.js → campaign/offers.js} +3 -3
- package/dist/commands/shared/{outside.d.ts → campaign/outside.d.ts} +3 -3
- package/dist/commands/shared/{outside.js → campaign/outside.js} +7 -7
- package/dist/commands/shared/{parts.d.ts → campaign/parts.d.ts} +10 -3
- package/dist/commands/shared/{parts.js → campaign/parts.js} +26 -3
- package/dist/commands/shared/{problems.d.ts → campaign/problems.d.ts} +3 -3
- package/dist/commands/shared/{problems.js → campaign/problems.js} +17 -17
- package/dist/commands/shared/{quests.d.ts → campaign/quests.d.ts} +4 -4
- package/dist/commands/shared/{quests.js → campaign/quests.js} +6 -6
- package/dist/commands/shared/{saves.d.ts → campaign/saves.d.ts} +4 -4
- package/dist/commands/shared/{saves.js → campaign/saves.js} +10 -10
- package/dist/commands/shared/{theme.d.ts → campaign/theme.d.ts} +3 -3
- package/dist/commands/shared/{theme.js → campaign/theme.js} +1 -1
- package/dist/commands/shared/{world.d.ts → campaign/world.d.ts} +5 -5
- package/dist/commands/shared/{world.js → campaign/world.js} +17 -14
- package/dist/commands/shared/{knowledge.d.ts → characters/knowledge.d.ts} +3 -3
- package/dist/commands/shared/{knowledge.js → characters/knowledge.js} +4 -4
- package/dist/commands/shared/{moods.d.ts → characters/moods.d.ts} +3 -3
- package/dist/commands/shared/{moods.js → characters/moods.js} +3 -3
- package/dist/commands/shared/characters/orders.d.ts +4 -0
- package/dist/commands/shared/characters/orders.js +10 -0
- package/dist/commands/shared/{thoughts.d.ts → characters/thoughts.d.ts} +2 -2
- package/dist/commands/shared/{thoughts.js → characters/thoughts.js} +3 -3
- package/dist/commands/shared/{voices.d.ts → characters/voices.d.ts} +1 -1
- package/dist/commands/shared/{voices.js → characters/voices.js} +2 -2
- package/dist/commands/shared/examples.js +2 -2
- package/dist/commands/shared/packages/catalog.js +2 -2
- package/dist/commands/shared/packages/code.d.ts +1 -1
- package/dist/commands/shared/packages/code.js +8 -8
- package/dist/commands/shared/packages/extensions.d.ts +1 -1
- package/dist/commands/shared/packages/extensions.js +1 -1
- package/dist/commands/shared/packages/hooks.d.ts +1 -1
- package/dist/commands/shared/packages/hooks.js +1 -1
- package/dist/commands/shared/packages/widgets.d.ts +3 -3
- package/dist/commands/shared/packages/widgets.js +3 -3
- package/dist/commands/shared/{environment.d.ts → places/environment.d.ts} +1 -1
- package/dist/commands/shared/{environment.js → places/environment.js} +4 -4
- package/dist/commands/shared/{grid-moves.d.ts → places/grid-moves.d.ts} +4 -4
- package/dist/commands/shared/{grid-moves.js → places/grid-moves.js} +8 -7
- package/dist/commands/shared/{grids.d.ts → places/grids.d.ts} +4 -4
- package/dist/commands/shared/{grids.js → places/grids.js} +6 -6
- package/dist/commands/shared/{journey.d.ts → places/journey.d.ts} +3 -3
- package/dist/commands/shared/{journey.js → places/journey.js} +6 -6
- package/dist/commands/shared/{moves.d.ts → places/moves.d.ts} +2 -2
- package/dist/commands/shared/{moves.js → places/moves.js} +4 -4
- package/dist/commands/shared/{positions.d.ts → places/positions.d.ts} +2 -2
- package/dist/commands/shared/{positions.js → places/positions.js} +4 -4
- package/dist/commands/shared/{roads.d.ts → places/roads.d.ts} +5 -5
- package/dist/commands/shared/{roads.js → places/roads.js} +6 -6
- package/dist/commands/shared/{effects.d.ts → scene/effects.d.ts} +7 -7
- package/dist/commands/shared/{effects.js → scene/effects.js} +10 -10
- package/dist/commands/shared/{loot.d.ts → scene/loot.d.ts} +2 -2
- package/dist/commands/shared/{loot.js → scene/loot.js} +3 -3
- package/dist/commands/shared/{master-rolls.d.ts → scene/master-rolls.d.ts} +2 -2
- package/dist/commands/shared/{master-rolls.js → scene/master-rolls.js} +5 -5
- package/dist/commands/shared/{reminders.d.ts → scene/reminders.d.ts} +4 -4
- package/dist/commands/shared/{reminders.js → scene/reminders.js} +4 -4
- package/dist/commands/shared/{scene.d.ts → scene/scene.d.ts} +3 -3
- package/dist/commands/shared/{scene.js → scene/scene.js} +7 -7
- package/dist/commands/shared/{bonds.d.ts → sheet/bonds.d.ts} +3 -3
- package/dist/commands/shared/{bonds.js → sheet/bonds.js} +2 -2
- package/dist/commands/shared/{page-counters.d.ts → sheet/counters.d.ts} +3 -3
- package/dist/commands/shared/{page-counters.js → sheet/counters.js} +5 -5
- package/dist/commands/shared/{effect-layer.d.ts → sheet/effect-layer.d.ts} +2 -2
- package/dist/commands/shared/{effect-layer.js → sheet/effect-layer.js} +9 -6
- package/dist/commands/shared/sheet/effect-values.d.ts +9 -0
- package/dist/commands/shared/sheet/effect-values.js +69 -0
- package/dist/commands/shared/{experience.d.ts → sheet/experience.d.ts} +3 -3
- package/dist/commands/shared/{experience.js → sheet/experience.js} +5 -5
- package/dist/commands/shared/sheet/formula-problems.d.ts +8 -0
- package/dist/commands/shared/sheet/formula-problems.js +140 -0
- package/dist/commands/shared/sheet/formula-scope.d.ts +32 -0
- package/dist/commands/shared/sheet/formula-scope.js +235 -0
- package/dist/commands/shared/{limits.d.ts → sheet/limits.d.ts} +3 -3
- package/dist/commands/shared/{limits.js → sheet/limits.js} +5 -4
- package/dist/commands/shared/{progression.d.ts → sheet/progression.d.ts} +2 -2
- package/dist/commands/shared/{progression.js → sheet/progression.js} +4 -4
- package/dist/commands/shared/{sheet.d.ts → sheet/sheet.d.ts} +5 -5
- package/dist/commands/shared/{sheet.js → sheet/sheet.js} +11 -7
- package/dist/commands/shared/{stacks.d.ts → sheet/stacks.d.ts} +2 -2
- package/dist/commands/shared/{stacks.js → sheet/stacks.js} +4 -4
- package/dist/commands/shared/sheet/system-fields.d.ts +21 -0
- package/dist/commands/shared/sheet/system-fields.js +45 -0
- package/dist/commands/shared/{thresholds.d.ts → sheet/thresholds.d.ts} +1 -1
- package/dist/commands/shared/{thresholds.js → sheet/thresholds.js} +4 -4
- package/dist/commands/shared/{turn-uses.d.ts → sheet/turn-uses.d.ts} +3 -3
- package/dist/commands/shared/{turn-uses.js → sheet/turn-uses.js} +4 -3
- package/dist/commands/shared/{worked-out.d.ts → sheet/worked-out.d.ts} +11 -46
- package/dist/commands/shared/sheet/worked-out.js +291 -0
- package/dist/commands/shared/sheet/worked-text.d.ts +14 -0
- package/dist/commands/shared/sheet/worked-text.js +55 -0
- package/dist/commands/shared/{advance.d.ts → time/advance.d.ts} +3 -3
- package/dist/commands/shared/{advance.js → time/advance.js} +11 -11
- package/dist/commands/shared/{dice-pool.d.ts → time/dice-pool.d.ts} +3 -3
- package/dist/commands/shared/{dice-pool.js → time/dice-pool.js} +11 -11
- package/dist/commands/shared/{events.d.ts → time/events.d.ts} +5 -5
- package/dist/commands/shared/{events.js → time/events.js} +10 -13
- package/dist/commands/shared/{recipes.d.ts → time/recipes.d.ts} +3 -3
- package/dist/commands/shared/{recipes.js → time/recipes.js} +6 -5
- package/dist/commands/shared/{time.d.ts → time/time.d.ts} +4 -4
- package/dist/commands/shared/{time.js → time/time.js} +6 -6
- package/dist/commands/shared/{upkeep.d.ts → time/upkeep.d.ts} +3 -3
- package/dist/commands/shared/{upkeep.js → time/upkeep.js} +14 -13
- package/dist/commands/show.d.ts +4 -1
- package/dist/commands/show.js +28 -9
- package/dist/commands/status.d.ts +2 -1
- package/dist/commands/status.js +34 -23
- package/dist/commands/thoughts.js +3 -3
- package/dist/commands/trade.js +8 -8
- package/dist/commands/translate.d.ts +1 -1
- package/dist/commands/translate.js +3 -3
- package/dist/commands/travel/open.d.ts +1 -1
- package/dist/commands/travel/open.js +2 -2
- package/dist/commands/travel/route.js +7 -6
- package/dist/commands/travel/travel.d.ts +1 -1
- package/dist/commands/travel/travel.js +8 -8
- package/dist/commands/validate.js +3 -3
- package/dist/commands/view/journal.d.ts +2 -2
- package/dist/commands/view/journal.js +2 -2
- package/dist/commands/view/map.d.ts +1 -1
- package/dist/commands/view/map.js +6 -6
- package/dist/commands/view/memory.d.ts +16 -0
- package/dist/commands/view/memory.js +90 -0
- package/dist/commands/view/page.d.ts +32 -0
- package/dist/commands/view/page.js +163 -0
- package/dist/commands/view/place.d.ts +7 -2
- package/dist/commands/view/place.js +30 -12
- package/dist/commands/view/result.d.ts +245 -0
- package/dist/commands/view/result.js +1 -0
- package/dist/commands/view/saves.d.ts +6 -0
- package/dist/commands/view/saves.js +53 -0
- package/dist/commands/view/story.d.ts +32 -0
- package/dist/commands/view/story.js +227 -0
- package/dist/commands/view/view.d.ts +26 -292
- package/dist/commands/view/view.js +26 -534
- package/dist/commands/view/world.d.ts +1 -1
- package/dist/commands/view/world.js +3 -3
- package/dist/commands/write/checks.d.ts +42 -0
- package/dist/commands/write/checks.js +291 -0
- package/dist/commands/write/here.d.ts +1 -1
- package/dist/commands/write/here.js +5 -5
- package/dist/commands/write/inheritance.d.ts +40 -0
- package/dist/commands/write/inheritance.js +189 -0
- package/dist/commands/write/input.d.ts +29 -0
- package/dist/commands/write/input.js +124 -0
- package/dist/commands/write/layer.d.ts +36 -0
- package/dist/commands/write/layer.js +48 -0
- package/dist/commands/write/notes.d.ts +22 -0
- package/dist/commands/write/notes.js +76 -0
- package/dist/commands/write/progression.d.ts +27 -0
- package/dist/commands/write/progression.js +175 -0
- package/dist/commands/write/write.d.ts +2 -1
- package/dist/commands/write/write.js +33 -817
- package/dist/core/files.d.ts +2 -0
- package/dist/core/files.js +7 -0
- package/dist/core/{package-declarations.d.ts → packages/declarations.d.ts} +1 -1
- package/dist/core/{package-declarations.js → packages/declarations.js} +1 -1
- package/dist/core/session-store.js +3 -3
- package/dist/core/store.d.ts +2 -2
- package/dist/core/store.js +18 -4
- package/dist/dashboard/acts/acts.js +1 -1
- package/dist/dashboard/acts/sending.js +110 -0
- package/dist/dashboard/acts/sheet.js +2 -2
- package/dist/dashboard/acts/strip.js +1 -1
- package/dist/dashboard/address.js +6 -0
- package/dist/dashboard/api.js +1 -1
- package/dist/dashboard/app.js +47 -171
- package/dist/dashboard/dice/roller.js +1 -1
- package/dist/dashboard/dice/sets.js +2 -2
- package/dist/dashboard/dice/stage.js +1 -1
- package/dist/dashboard/dice/tray.js +6 -6
- package/dist/dashboard/guide/ar.md +9 -4
- package/dist/dashboard/guide/cs.md +10 -5
- package/dist/dashboard/guide/da.md +9 -4
- package/dist/dashboard/guide/de.md +9 -4
- package/dist/dashboard/guide/el.md +10 -5
- package/dist/dashboard/guide/en.md +7 -2
- package/dist/dashboard/guide/es.md +9 -4
- package/dist/dashboard/guide/fi.md +9 -4
- package/dist/dashboard/guide/fr.md +9 -4
- package/dist/dashboard/guide/he.md +9 -4
- package/dist/dashboard/guide/hi.md +10 -5
- package/dist/dashboard/guide/hu.md +10 -5
- package/dist/dashboard/guide/is.md +9 -4
- package/dist/dashboard/guide/it.md +9 -4
- package/dist/dashboard/guide/ja.md +12 -7
- package/dist/dashboard/guide/ko.md +11 -6
- package/dist/dashboard/guide/nb.md +9 -4
- package/dist/dashboard/guide/nl.md +10 -5
- package/dist/dashboard/guide/pl.md +9 -4
- package/dist/dashboard/guide/pt.md +9 -4
- package/dist/dashboard/guide/ro.md +9 -4
- package/dist/dashboard/guide/ru.md +9 -4
- package/dist/dashboard/guide/sv.md +9 -4
- package/dist/dashboard/guide/tr.md +11 -6
- package/dist/dashboard/guide/uk.md +9 -4
- package/dist/dashboard/guide/zh.md +9 -4
- package/dist/dashboard/help/help.js +3 -3
- package/dist/dashboard/i18n/ar.json +20 -0
- package/dist/dashboard/i18n/cs.json +20 -0
- package/dist/dashboard/i18n/da.json +20 -0
- package/dist/dashboard/i18n/de.json +20 -0
- package/dist/dashboard/i18n/el.json +20 -0
- package/dist/dashboard/i18n/es.json +20 -0
- package/dist/dashboard/i18n/fi.json +20 -0
- package/dist/dashboard/i18n/fr.json +20 -0
- package/dist/dashboard/i18n/he.json +20 -0
- package/dist/dashboard/i18n/hi.json +20 -0
- package/dist/dashboard/i18n/hu.json +20 -0
- package/dist/dashboard/i18n/is.json +20 -0
- package/dist/dashboard/i18n/it.json +20 -0
- package/dist/dashboard/i18n/ja.json +21 -1
- package/dist/dashboard/i18n/ko.json +20 -0
- package/dist/dashboard/i18n/nb.json +20 -0
- package/dist/dashboard/i18n/nl.json +20 -0
- package/dist/dashboard/i18n/pl.json +20 -0
- package/dist/dashboard/i18n/pt.json +20 -0
- package/dist/dashboard/i18n/ro.json +20 -0
- package/dist/dashboard/i18n/ru.json +20 -0
- package/dist/dashboard/i18n/sv.json +20 -0
- package/dist/dashboard/i18n/tr.json +20 -0
- package/dist/dashboard/i18n/uk.json +20 -0
- package/dist/dashboard/i18n/zh.json +20 -0
- package/dist/dashboard/{journal.js → journal/journal.js} +16 -16
- package/dist/dashboard/{notes.js → journal/notes.js} +4 -4
- package/dist/dashboard/kit.js +3 -3
- package/dist/dashboard/packages/ask-card.js +3 -3
- package/dist/dashboard/packages/catalog.js +196 -0
- package/dist/dashboard/packages/engine.js +87 -0
- package/dist/dashboard/packages/installed.js +53 -0
- package/dist/dashboard/packages/library.js +97 -0
- package/dist/dashboard/packages/outcomes.js +45 -0
- package/dist/dashboard/packages/packages.js +20 -576
- package/dist/dashboard/packages/page-code.js +15 -2
- package/dist/dashboard/packages/{package-page.js → page.js} +12 -5
- package/dist/dashboard/packages/rows.js +84 -0
- package/dist/dashboard/packages/share.js +44 -0
- package/dist/dashboard/packages/widgets.js +3 -3
- package/dist/dashboard/{card.js → parts/card.js} +1 -1
- package/dist/dashboard/{faces.js → parts/faces.js} +5 -5
- package/dist/dashboard/{game-words.js → parts/game-words.js} +1 -1
- package/dist/dashboard/{icons.js → parts/icons.js} +1 -1
- package/dist/dashboard/{labels.js → parts/labels.js} +8 -1
- package/dist/dashboard/{map-symbols.js → parts/map-symbols.js} +1 -1
- package/dist/dashboard/{markdown.js → parts/markdown.js} +2 -2
- package/dist/dashboard/{mood.js → parts/mood.js} +1 -1
- package/dist/dashboard/{refusals.js → parts/refusals.js} +1 -1
- package/dist/dashboard/{status.js → parts/status.js} +4 -4
- package/dist/dashboard/{widgets.js → parts/widgets.js} +2 -2
- package/dist/dashboard/place/key.js +24 -0
- package/dist/dashboard/place/paper.js +67 -0
- package/dist/dashboard/place/{map-sheet.js → sheet.js} +2 -2
- package/dist/dashboard/place/things.js +129 -0
- package/dist/dashboard/place/tokens.js +93 -0
- package/dist/dashboard/place/view.js +124 -0
- package/dist/dashboard/{asked-dice.js → play/asked-dice.js} +3 -3
- package/dist/dashboard/{asked.js → play/asked.js} +10 -10
- package/dist/dashboard/{choices.js → play/choices.js} +9 -9
- package/dist/dashboard/{requested.js → play/requested.js} +1 -1
- package/dist/dashboard/{rolls.js → play/rolls.js} +9 -9
- package/dist/dashboard/{scene.js → play/scene.js} +14 -14
- package/dist/dashboard/{turns.js → play/turns.js} +12 -12
- package/dist/dashboard/{language-choice.js → settings/language-choice.js} +1 -1
- package/dist/dashboard/{languages.js → settings/languages.js} +1 -1
- package/dist/dashboard/{saves.js → settings/saves.js} +8 -8
- package/dist/dashboard/{settings.js → settings/settings.js} +17 -15
- package/dist/dashboard/{setup.js → settings/setup.js} +6 -6
- package/dist/dashboard/{party.js → sheet/party.js} +8 -8
- package/dist/dashboard/{person-panel.js → sheet/person-panel.js} +4 -4
- package/dist/dashboard/{sheet.js → sheet/sheet.js} +17 -17
- package/dist/dashboard/{story.js → sheet/story.js} +3 -3
- package/dist/dashboard/{columns.js → shell/columns.js} +1 -1
- package/dist/dashboard/{footer.js → shell/footer.js} +3 -3
- package/dist/dashboard/{master.js → shell/master.js} +2 -2
- package/dist/dashboard/{notices.js → shell/notices.js} +3 -3
- package/dist/dashboard/{pages.js → shell/pages.js} +5 -5
- package/dist/dashboard/shell/shown.js +37 -0
- package/dist/dashboard/{table.js → shell/table.js} +2 -2
- package/dist/dashboard/{tabs.js → shell/tabs.js} +2 -2
- package/dist/dashboard/{top.js → shell/top.js} +7 -7
- package/dist/dashboard/style.css +90 -9
- package/dist/dashboard/world/calendar.js +4 -4
- package/dist/dashboard/world/drawing.js +92 -0
- package/dist/dashboard/world/key.js +21 -0
- package/dist/dashboard/world/lore.js +5 -5
- package/dist/dashboard/world/map-card.js +186 -0
- package/dist/dashboard/world/place-card.js +39 -0
- package/dist/dashboard/world/places.js +29 -0
- package/dist/dashboard/world/world.js +9 -341
- package/dist/extensions/extension.d.ts +1 -1
- package/dist/extensions/extension.js +1 -1
- package/dist/images/images.js +12 -9
- package/dist/index.d.ts +1 -1
- package/dist/languages/index.d.ts +1 -1
- package/dist/languages/index.js +1 -1
- package/dist/library/books.js +2 -0
- package/dist/packages/npm.js +1 -1
- package/dist/page.d.ts +2 -2
- package/dist/page.js +1 -1
- package/dist/pages/check.js +23 -1
- package/dist/pages/containers.d.ts +1 -1
- package/dist/pages/containers.js +1 -1
- package/dist/pages/index.d.ts +4 -2
- package/dist/pages/index.js +4 -2
- package/dist/pages/inheritance.d.ts +2 -2
- package/dist/pages/layers.d.ts +50 -0
- package/dist/pages/layers.js +97 -0
- package/dist/pages/rename-page.js +1 -1
- package/dist/pages/stacks/writes.js +48 -22
- package/dist/pages/standard-fields.d.ts +1 -1
- package/dist/pages/system-pages.d.ts +5 -3
- package/dist/pages/system-pages.js +16 -7
- package/dist/pages/world.d.ts +8 -1
- package/dist/pages/world.js +16 -4
- package/dist/pages/write-layer.d.ts +18 -0
- package/dist/pages/write-layer.js +108 -0
- package/dist/pages/write-page.d.ts +2 -2
- package/dist/pages/write-page.js +2 -2
- package/dist/rules/index.d.ts +1 -1
- package/dist/rules/index.js +1 -1
- package/dist/rules/search.d.ts +1 -1
- package/dist/rules/shown.d.ts +1 -1
- package/dist/server/dashboard/choices.js +3 -3
- package/dist/server/dashboard/files.js +5 -5
- package/dist/server/dashboard/index.d.ts +2 -2
- package/dist/server/dashboard/index.js +2 -2
- package/dist/server/dashboard/news.js +4 -3
- package/dist/server/dashboard/player.js +1 -1
- package/dist/server/dashboard/writes.js +10 -8
- package/dist/server/mcp.js +28 -13
- package/dist/systems/campaign-data.d.ts +15 -0
- package/dist/systems/campaign-data.js +85 -0
- package/dist/systems/{system-code.d.ts → code.d.ts} +1 -1
- package/dist/systems/{system-code.js → code.js} +2 -2
- package/dist/systems/game-system.d.ts +7 -61
- package/dist/systems/game-system.js +1 -984
- package/dist/systems/index.d.ts +6 -3
- package/dist/systems/index.js +6 -3
- package/dist/systems/installed.d.ts +31 -0
- package/dist/systems/installed.js +89 -0
- package/dist/systems/maps.d.ts +3 -0
- package/dist/systems/maps.js +9 -0
- package/dist/systems/read.d.ts +3 -0
- package/dist/systems/read.js +471 -0
- package/dist/systems/schema.d.ts +289 -0
- package/dist/systems/schema.js +243 -0
- package/dist/systems/settings.d.ts +19 -0
- package/dist/systems/settings.js +78 -0
- package/dist/systems/versions.d.ts +12 -0
- package/dist/systems/versions.js +52 -0
- package/dist/testing/index.js +1 -1
- package/instructions/import.md +1 -1
- package/instructions/length-a-few-sessions.md +1 -0
- package/instructions/length-one-evening.md +1 -0
- package/instructions/play.md +1 -1
- package/instructions/session-zero.md +1 -1
- package/instructions/setup.md +1 -1
- package/package.json +1 -1
- package/dist/commands/config.js +0 -917
- package/dist/commands/package.d.ts +0 -143
- package/dist/commands/package.js +0 -785
- package/dist/commands/scene.js +0 -894
- package/dist/commands/shared/worked-out.js +0 -805
- package/dist/dashboard/place/map-view.js +0 -417
- /package/dist/commands/shared/{library-reader.d.ts → books/library-reader.d.ts} +0 -0
- /package/dist/core/{package-api.d.ts → packages/api.d.ts} +0 -0
- /package/dist/core/{package-api.js → packages/api.js} +0 -0
- /package/dist/dashboard/{coins.js → parts/coins.js} +0 -0
- /package/dist/dashboard/{glass.js → parts/glass.js} +0 -0
- /package/dist/dashboard/{layout.js → parts/layout.js} +0 -0
- /package/dist/dashboard/{mood-faces.js → parts/mood-faces.js} +0 -0
- /package/dist/dashboard/{free-rolls.js → play/free-rolls.js} +0 -0
- /package/dist/dashboard/{reactions.js → play/reactions.js} +0 -0
- /package/dist/dashboard/{prefs.js → shell/prefs.js} +0 -0
- /package/dist/dashboard/{system-style.js → shell/system-style.js} +0 -0
- /package/dist/dashboard/{theme.js → shell/theme.js} +0 -0
- /package/dist/languages/{language-pack.d.ts → pack.d.ts} +0 -0
- /package/dist/languages/{language-pack.js → pack.js} +0 -0
- /package/dist/pages/{page-file.d.ts → file.d.ts} +0 -0
- /package/dist/pages/{page-file.js → file.js} +0 -0
- /package/dist/pages/{page-types.d.ts → types.d.ts} +0 -0
- /package/dist/pages/{page-types.js → types.js} +0 -0
- /package/dist/rules/{rule-book.d.ts → book.d.ts} +0 -0
- /package/dist/rules/{rule-book.js → book.js} +0 -0
- /package/dist/systems/{system-folders.d.ts → folders.d.ts} +0 -0
- /package/dist/systems/{system-folders.js → folders.js} +0 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime";
|
|
2
|
+
import { terrainLabel } from "../parts/game-words.js";
|
|
3
|
+
import { Glass, GlassDefs } from "../parts/glass.js";
|
|
4
|
+
import { biomes, placeKinds, symbolRadius } from "../parts/map-symbols.js";
|
|
5
|
+
import { t } from "../text.js";
|
|
6
|
+
import { fading, hexCorners, hexesOf, marksOf, nameRun, nameShares, pathOf, placeAreaLabels, placeLabels, regionEdges, riverOutline, scaleBar } from "./map.js";
|
|
7
|
+
// The ways in the order they are drawn, the rivers under the roads.
|
|
8
|
+
const wayOrder = ["river", "road", "path"];
|
|
9
|
+
/**
|
|
10
|
+
* The drawing, from the view: the paper, the hexes lit and fogged with the marks of their biome and the ink round each region, the ways drawn by hand with
|
|
11
|
+
* their tails into the fog, the trail, the places, the party, the labels, the compass and the scale.
|
|
12
|
+
*/
|
|
13
|
+
export function Drawing({ map, layout, ways, trails, lifted, ghost, passages, lead, view, size, narrow, chosen }) {
|
|
14
|
+
const { width, height } = size;
|
|
15
|
+
const X = (x) => width / 2 + (x - view.x) * view.s;
|
|
16
|
+
const Y = (y) => height / 2 - (y - view.y) * view.s;
|
|
17
|
+
const screen = (points) => points.map((point) => ({ x: X(point.x), y: Y(point.y) }));
|
|
18
|
+
const line = (points) => pathOf(screen(points));
|
|
19
|
+
const { across, hexes } = hexesOf(view, width, height, lifted, layout.regions);
|
|
20
|
+
const hexPixels = across * view.s;
|
|
21
|
+
const edges = regionEdges(hexes, across);
|
|
22
|
+
const scale = scaleBar(view.s, map.unit);
|
|
23
|
+
const image = lead?.image === undefined ? undefined : `/images/${encodeURIComponent(lead.image.file)}?v=${lead.image.version}`;
|
|
24
|
+
const party = map.party;
|
|
25
|
+
// Ink a little bolder near, finer far.
|
|
26
|
+
const weight = Math.min(1.5, Math.max(0.7, view.s / 8));
|
|
27
|
+
const drawn = [...ways].sort((first, second) => wayRank(first.kind) - wayRank(second.kind));
|
|
28
|
+
// What the labels must leave free: the tools, the compass, the scale and the places' symbols; the regions' names go first, below their middle, above, across it.
|
|
29
|
+
const reserved = [{ x: width - 64, y: 0, width: 64, height: 220 }, { x: 0, y: 0, width: 80, height: 86 }, { x: 0, y: height - 50, width: 210, height: 50 }];
|
|
30
|
+
const markBoxes = layout.spots.map((spot) => ({ x: X(spot.x) - symbolOf(spot).r, y: Y(spot.y) - symbolOf(spot).r, width: symbolOf(spot).r * 2, height: symbolOf(spot).r * 2 }));
|
|
31
|
+
const regionWishes = layout.regions.map((region) => ({
|
|
32
|
+
x: X(region.x),
|
|
33
|
+
ys: nameShares(region, hexes).map((share) => Y(region.y + region.radius * share)),
|
|
34
|
+
width: region.name.length * 14,
|
|
35
|
+
height: region.terrain === undefined ? 20 : 34,
|
|
36
|
+
}));
|
|
37
|
+
const regionLabels = placeAreaLabels(regionWishes, markBoxes, reserved, width, height);
|
|
38
|
+
const regionBoxes = regionLabels.flatMap((placed, index) => placed === undefined ? [] : [{ x: placed.x - regionWishes[index].width / 2 - 3, y: placed.y - 15, width: regionWishes[index].width + 6, height: regionWishes[index].height }]);
|
|
39
|
+
// A way's name along its longest run between two stops on the screen, following its bends, when the run holds it.
|
|
40
|
+
const wayNames = drawn.map((way) => {
|
|
41
|
+
const run = nameRun(screen(way.course), way.stops, way.name.length * 7.5 + 60);
|
|
42
|
+
// The bends of a river or a path would scatter its name: it goes along their way instead, beside them.
|
|
43
|
+
return run === undefined || wayLook(way.kind) === "road" ? run : [run[0], run.at(-1)];
|
|
44
|
+
});
|
|
45
|
+
const labels = placeLabels(layout.spots.map((spot) => {
|
|
46
|
+
const isParty = spot === layout.partySpot;
|
|
47
|
+
const big = isParty || (placeKinds[spot.kind ?? ""]?.size ?? 0) >= 2;
|
|
48
|
+
return { text: spot.name, x: X(spot.x), y: Y(spot.y), r: isParty ? 19 : symbolOf(spot).r + 1, size: big ? 16 : 13.5, weight: weightOf(spot, layout) };
|
|
49
|
+
}), markBoxes, [...reserved, ...regionBoxes], width, height);
|
|
50
|
+
return (_jsxs("svg", { class: "map-svg", viewBox: `0 0 ${width} ${height}`, "aria-hidden": "true", children: [_jsxs("defs", { children: [_jsx(GlassDefs, { prefix: "map" }), _jsxs("filter", { id: "map-grain", x: "0", y: "0", width: "100%", height: "100%", children: [_jsx("feTurbulence", { type: "fractalNoise", baseFrequency: "0.9", numOctaves: 3, seed: 2 }), _jsx("feColorMatrix", { values: "0 0 0 0 0.35 0 0 0 0 0.25 0 0 0 0 0.12 0 0 0 0.09 0" }), _jsx("feComposite", { in2: "SourceGraphic", operator: "in" })] }), _jsxs("filter", { id: "map-ink", x: "-5%", y: "-5%", width: "110%", height: "110%", children: [_jsx("feTurbulence", { type: "fractalNoise", baseFrequency: "0.05", numOctaves: 2, seed: 4 }), _jsx("feDisplacementMap", { in: "SourceGraphic", scale: 2.2 })] }), _jsxs("radialGradient", { id: "map-age", cx: "50%", cy: "50%", r: "72%", children: [_jsx("stop", { offset: "0.62", "stop-color": "#6e5028", "stop-opacity": "0" }), _jsx("stop", { offset: "1", "stop-color": "#6e5028", "stop-opacity": "0.3" })] }), _jsx("clipPath", { id: "map-token", children: _jsx("circle", { r: 13 }) }), wayNames.map((run, index) => run === undefined ? null : _jsx("path", { id: `world-way-name-${index}`, d: pathOf(run) }, index))] }), _jsx("rect", { class: "map-fog", width: width, height: height }), hexes.map((hex, index) => (_jsx("polygon", { class: hex.lit ? `hex lit ${biomeLook(hex.biome)}` : "hex fogged", "fill-opacity": hex.lit ? (0.8 + hex.tone * 0.2).toFixed(2) : undefined, points: hexCorners(hex, across).map((corner) => `${X(corner.x).toFixed(1)},${Y(corner.y).toFixed(1)}`).join(" ") }, index))), hexPixels >= 24 && (_jsx("g", { class: "tufts", children: hexes.filter((hex) => hex.lit && hex.biome !== undefined && biomes[hex.biome] !== undefined).flatMap((hex, index) => marksOf(hex, hexPixels).map((mark, at) => (_jsx("path", { class: `tuft ${hex.biome}`, transform: `translate(${(X(hex.x) + mark.x).toFixed(1)} ${(Y(hex.y) + mark.y).toFixed(1)}) scale(${mark.scale.toFixed(2)})`, d: biomes[hex.biome ?? ""].mark }, `${index} ${at}`)))) })), [...edges].map(([region, segments]) => (_jsx("path", { class: `region-edge ${biomeLook(layout.regions.find((one) => one.name === region)?.biome)}${region === chosen ? " selected" : ""}`, d: segments.map(([from, to]) => `M${X(from.x).toFixed(1)} ${Y(from.y).toFixed(1)}L${X(to.x).toFixed(1)} ${Y(to.y).toFixed(1)}`).join(""), filter: "url(#map-ink)" }, region))), _jsx("rect", { class: "map-grain", width: width, height: height, filter: "url(#map-grain)" }), trails.map((run, index) => _jsx("path", { class: "trail", d: line(run) }, index)), drawn.filter((way) => way.name === chosen).map((way, index) => _jsx("path", { class: "chosen-way", d: line(way.course) }, index)), ghost !== undefined && (_jsxs("g", { class: "ghost", children: [ghost.ways.map((way, index) => _jsx(WayDrawing, { way: way, look: wayLook(way.kind), screen: screen, weight: weight }, `${way.name} ${index}`)), ghost.spots.map((spot) => _jsx(PlaceSymbol, { spot: spot, x: X(spot.x), y: Y(spot.y), chosen: false }, spot.name))] })), drawn.map((way, index) => _jsx(WayDrawing, { way: way, look: wayLook(way.kind), screen: screen, weight: weight }, `${way.name} ${index}`)), drawn.map((way, index) => wayNames[index] === undefined ? null : (_jsx("text", { class: `way-label ${wayLook(way.kind)}`, dy: wayLook(way.kind) === "river" ? -16 : -6, children: _jsx("textPath", { href: `#world-way-name-${index}`, startOffset: "50%", "text-anchor": "middle", children: way.name }) }, `${way.name} ${index}`))), _jsx("rect", { class: "map-age", width: width, height: height, fill: "url(#map-age)" }), layout.spots.filter((spot) => passages.includes(spot.name)).map((spot) => _jsx("circle", { class: "passage-ring", cx: X(spot.x), cy: Y(spot.y), r: symbolOf(spot).r + 5 }, spot.name)), layout.spots.filter((spot) => spot !== layout.partySpot).map((spot) => _jsx(PlaceSymbol, { spot: spot, x: X(spot.x), y: Y(spot.y), chosen: spot.name === chosen }, spot.name)), party !== undefined && (_jsxs("g", { class: layout.partySpot !== undefined && layout.partySpot.name === chosen ? "party-mark selected" : "party-mark", transform: `translate(${X(party.x).toFixed(1)} ${Y(party.y).toFixed(1)})`, "data-place": layout.partySpot?.name, children: [_jsx("circle", { class: "party-pulse", r: 17 }), _jsxs("g", { filter: "url(#map-drop)", children: [_jsx("circle", { class: "party-ring", r: 17 }), _jsx("circle", { class: "party-disc", r: 14.5 }), image !== undefined && _jsx("image", { href: image, x: -13, y: -13, width: 26, height: 26, "clip-path": "url(#map-token)" }), _jsx(Glass, { r: 14.5, prefix: "map" })] })] })), _jsxs("g", { class: "labels", children: [layout.regions.map((region, index) => {
|
|
51
|
+
const placed = regionLabels[index];
|
|
52
|
+
return placed === undefined ? null : (_jsxs("g", { children: [_jsx("text", { class: "label region-label", x: placed.x, y: placed.y, "text-anchor": "middle", children: region.name }), region.terrain !== undefined && _jsx("text", { class: "label region-note", x: placed.x, y: placed.y + 15, "text-anchor": "middle", children: terrainLabel(region.terrain) })] }, region.name));
|
|
53
|
+
}), layout.spots.map((spot, index) => {
|
|
54
|
+
const label = labels[index];
|
|
55
|
+
const big = spot === layout.partySpot || (placeKinds[spot.kind ?? ""]?.size ?? 0) >= 2;
|
|
56
|
+
return label.hidden ? null : _jsx("text", { class: `label place-label${big ? " big" : ""}`, x: label.x, y: label.y, "text-anchor": label.anchor, children: label.text }, spot.name);
|
|
57
|
+
})] }), _jsxs("g", { class: "compass", transform: `translate(${narrow ? 34 : 40} ${narrow ? 42 : 46}) scale(${narrow ? 0.85 : 1})`, children: [_jsx("circle", { class: "compass-ring", r: 15 }), _jsx("path", { class: "compass-diagonals", d: "M-12-12 12 12 M-12 12 12-12" }), _jsx("path", { class: "compass-point", d: "M0-26 5-5 26 0 5 5 0 26-5 5-26 0-5-5Z" }), _jsx("path", { class: "compass-shade", d: "M0-26 5-5 0 0Z M26 0 5 5 0 0Z M0 26-5 5 0 0Z M-26 0-5-5 0 0Z" }), _jsx("text", { class: "compass-n", y: -30, "text-anchor": "middle", children: "N" })] }), _jsxs("g", { class: "scale", transform: `translate(16 ${height - 22})`, children: [_jsx("rect", { class: "scale-back", x: -8, y: -20, width: scale.width + 64, height: 34, rx: 6 }), _jsx("rect", { class: "scale-a", width: scale.width / 2, height: 5 }), _jsx("rect", { class: "scale-b", x: scale.width / 2, width: scale.width / 2, height: 5 }), _jsx("text", { class: "scale-text", x: 0, y: -8, children: "0" }), _jsx("text", { class: "scale-text", x: scale.width, y: -8, "text-anchor": "middle", children: scale.value }), _jsx("text", { class: "scale-text", x: scale.width + 8, y: 5, children: map.unit.name === "km" ? "km" : t("miles") })] })] }));
|
|
58
|
+
}
|
|
59
|
+
/** A place's symbol by its kind: a disc with its picture, in four sizes; a kind the page does not know, a plain dot. */
|
|
60
|
+
export function PlaceSymbol({ spot, x, y, chosen }) {
|
|
61
|
+
const kind = spot.kind === undefined ? undefined : placeKinds[spot.kind];
|
|
62
|
+
const { r } = symbolOf(spot);
|
|
63
|
+
const scale = r * 1.62 / 24;
|
|
64
|
+
return (_jsxs("g", { class: `spot size-${kind?.size ?? "dot"}${chosen ? " selected" : ""}`, transform: `translate(${x.toFixed(1)} ${y.toFixed(1)})`, "data-place": spot.name, children: [kind === undefined ? _jsx("circle", { class: "spot-dot", r: 4 }) : (_jsxs("g", { filter: "url(#map-drop)", children: [_jsx("circle", { class: "spot-disc", r: r }), _jsx("path", { class: "spot-glyph", transform: `translate(${-12 * scale} ${-12 * scale}) scale(${scale})`, d: kind.glyph }), _jsx(Glass, { r: r, prefix: "map" })] })), _jsx("circle", { class: "spot-hit", r: Math.max(r, 16) })] }));
|
|
65
|
+
}
|
|
66
|
+
/** The look of a biome: its own when the page draws it, the bare land for none, another for one it does not know. */
|
|
67
|
+
export function biomeLook(biome) {
|
|
68
|
+
return biome === undefined ? "open" : biomes[biome] !== undefined ? biome : "unknown-biome";
|
|
69
|
+
}
|
|
70
|
+
export function wayLook(kind) {
|
|
71
|
+
return wayOrder.includes(kind) ? kind : "other";
|
|
72
|
+
}
|
|
73
|
+
export function wayRank(kind) {
|
|
74
|
+
const rank = wayOrder.indexOf(wayLook(kind));
|
|
75
|
+
return rank < 0 ? wayOrder.length : rank;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A way drawn by hand, in the map's ink: a road as two lines, a path dashed, a river in water widening toward its mouth, outlined in ink; its tails fade into
|
|
79
|
+
* the fog.
|
|
80
|
+
*/
|
|
81
|
+
function WayDrawing({ way, look, screen, weight }) {
|
|
82
|
+
const course = screen(way.course);
|
|
83
|
+
return (_jsxs("g", { class: `way-drawing ${look}`, children: [way.tails.map((tail) => fading(screen(tail.course)).map((piece, index) => (_jsx("path", { class: `tail ${look}`, d: pathOf(piece.points), "stroke-opacity": piece.opacity.toFixed(2), "stroke-width": (look === "river" ? (tail.from === "before" ? 1.6 : 4.4) : look === "road" ? 2.2 : 1.3) * weight }, `${tail.from} ${index}`)))), look === "river" && _jsx("path", { class: "river-water", d: riverOutline(course, 1.6 * weight, 4.6 * weight), filter: "url(#map-ink)" }), look === "road" && (_jsxs(_Fragment, { children: [_jsx("path", { class: "road-ink", d: pathOf(course), "stroke-width": 3.8 * weight, filter: "url(#map-ink)" }), _jsx("path", { class: "road-paper", d: pathOf(course), "stroke-width": 1.5 * weight })] })), (look === "path" || look === "other") && _jsx("path", { class: `${look}-ink`, d: pathOf(course), "stroke-width": 1.4 * weight, filter: "url(#map-ink)" })] }));
|
|
84
|
+
}
|
|
85
|
+
function symbolOf(spot) {
|
|
86
|
+
const kind = spot.kind === undefined ? undefined : placeKinds[spot.kind];
|
|
87
|
+
return { r: kind === undefined ? 5 : symbolRadius[kind.size] };
|
|
88
|
+
}
|
|
89
|
+
/** How much a place's name weighs for its room: the party's place, then the larger kinds, then those holding more. */
|
|
90
|
+
function weightOf(spot, layout) {
|
|
91
|
+
return (spot === layout.partySpot ? 100 : 0) + (placeKinds[spot.kind ?? ""]?.size ?? -1) * 20 + layout.inside(spot.name).length * 5;
|
|
92
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { biomeLabel, biomes, placeKindLabel, placeKinds } from "../parts/map-symbols.js";
|
|
3
|
+
import { t } from "../text.js";
|
|
4
|
+
import { biomeLook, PlaceSymbol, wayLook, wayRank } from "./drawing.js";
|
|
5
|
+
/** The key under the map: the ways, the trail and the party; the land's biomes, difficult terrain and the fog; the kinds of place on this map. */
|
|
6
|
+
export function Key({ map, layout, narrow, trail, passages }) {
|
|
7
|
+
// A passage is no line on the map: its ring says it (ROA-8).
|
|
8
|
+
const ways = [...new Set(map.roads.filter((road) => road.kind !== "portal").map((road) => wayLook(road.kind)))].sort((first, second) => wayRank(first) - wayRank(second));
|
|
9
|
+
const lands = [...new Set(layout.regions.map((region) => biomeLook(region.biome)))].filter((look) => look !== "open");
|
|
10
|
+
const kinds = [...new Set(layout.spots.map((spot) => (spot.kind !== undefined && placeKinds[spot.kind] !== undefined ? spot.kind : "other")))];
|
|
11
|
+
return (_jsxs("details", { class: "map-key", open: !narrow, children: [_jsx("summary", { children: t("Key") }), _jsxs("div", { class: "key-groups", children: [_jsxs("div", { class: "key-group", children: [_jsx("h4", { class: "eyebrow key-title", children: t("Ways") }), _jsxs("ul", { children: [ways.map((look) => (_jsxs("li", { children: [_jsxs("svg", { class: "key-way", viewBox: "0 0 30 16", "aria-hidden": "true", children: [look === "river" && _jsx("path", { class: "river-water", d: "M2 9.6Q8 5.8 15 8.2T28 6.6L28 9.6Q22 12 15 10.4T2 10.8Z" }), look === "road" && (_jsxs(_Fragment, { children: [_jsx("path", { class: "road-ink", d: "M2 9q7-4 13-1t13-1", "stroke-width": 3.8 }), _jsx("path", { class: "road-paper", d: "M2 9q7-4 13-1t13-1", "stroke-width": 1.5 })] })), (look === "path" || look === "other") && _jsx("path", { class: `${look}-ink`, d: "M2 9q7-4 13-1t13-1", "stroke-width": 1.4 })] }), wayLabel(look)] }, look))), trail && (_jsxs("li", { children: [_jsx("svg", { class: "key-way", viewBox: "0 0 30 16", "aria-hidden": "true", children: _jsx("path", { class: "trail", d: "M4 8h22" }) }), t("Your trail")] })), _jsxs("li", { children: [_jsxs("svg", { class: "key-symbol", viewBox: "-9 -9 18 18", "aria-hidden": "true", children: [_jsx("circle", { class: "party-ring", r: 7.5 }), _jsx("circle", { class: "party-disc", r: 5.5 })] }), t("Your party")] }), passages && (_jsxs("li", { children: [_jsx("svg", { class: "key-symbol", viewBox: "-12 -12 24 24", "aria-hidden": "true", children: _jsx("circle", { class: "passage-ring", r: 9 }) }), t("Passage to another map")] }))] })] }), _jsxs("div", { class: "key-group", children: [_jsx("h4", { class: "eyebrow key-title", children: t("Land") }), _jsxs("ul", { children: [lands.map((look) => (_jsxs("li", { children: [_jsx(BiomeSwatch, { look: look }), biomeLabel(look) ?? t("Other land")] }, look))), _jsxs("li", { children: [_jsx("svg", { class: "key-swatch", viewBox: "0 0 22 16", "aria-hidden": "true", children: _jsx("rect", { class: "hex fogged", x: 1, y: 1, width: 20, height: 14, rx: 3 }) }), t("Not found yet")] })] })] }), _jsxs("div", { class: "key-group", children: [_jsx("h4", { class: "eyebrow key-title", children: t("Places") }), _jsx("ul", { children: kinds.map((kind) => (_jsxs("li", { children: [_jsx("svg", { class: "key-symbol", viewBox: "-17 -17 34 34", "aria-hidden": "true", children: _jsx(PlaceSymbol, { spot: { name: kind, x: 0, y: 0, within: [], ...(kind === "other" ? {} : { kind }) }, x: 0, y: 0, chosen: false }) }), placeKindLabel(kind) ?? t("Other place")] }, kind))) })] })] })] }));
|
|
12
|
+
}
|
|
13
|
+
/** A biome's own picture, as the map draws its land: a tile in its colour with its mark, or the bare land for one the page does not know. */
|
|
14
|
+
export function BiomeSwatch({ look }) {
|
|
15
|
+
return (_jsxs("svg", { class: "key-swatch", viewBox: "0 0 22 16", "aria-hidden": "true", children: [_jsx("rect", { class: `hex lit ${look}`, x: 1, y: 1, width: 20, height: 14, rx: 3 }), biomes[look] !== undefined && _jsx("path", { class: `tuft ${look}`, transform: "translate(11 9)", d: biomes[look].mark })] }));
|
|
16
|
+
}
|
|
17
|
+
/** A kind of way by its name in the page's language: River, Road, Path. */
|
|
18
|
+
export function wayLabel(kind) {
|
|
19
|
+
const labels = { river: t("River"), road: t("Road"), path: t("Path"), portal: t("Portal"), other: t("Other way") };
|
|
20
|
+
return labels[kind] ?? `${kind[0]?.toUpperCase() ?? ""}${kind.slice(1)}`;
|
|
21
|
+
}
|
|
@@ -2,11 +2,11 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-ru
|
|
|
2
2
|
import { useEffect, useRef, useState } from "preact/hooks";
|
|
3
3
|
import { sectionAddress } from "../address.js";
|
|
4
4
|
import { pictureAddress, readView } from "../api.js";
|
|
5
|
-
import { useMedia } from "../card.js";
|
|
6
|
-
import { Icon } from "../icons.js";
|
|
7
|
-
import { placeKindLabel, placeKinds } from "../map-symbols.js";
|
|
8
|
-
import { knowersOf, Markdown, plainLine } from "../markdown.js";
|
|
9
|
-
import { Token } from "../party.js";
|
|
5
|
+
import { useMedia } from "../parts/card.js";
|
|
6
|
+
import { Icon } from "../parts/icons.js";
|
|
7
|
+
import { placeKindLabel, placeKinds } from "../parts/map-symbols.js";
|
|
8
|
+
import { knowersOf, Markdown, plainLine } from "../parts/markdown.js";
|
|
9
|
+
import { Token } from "../sheet/party.js";
|
|
10
10
|
import { arrowStep, capitalized, foldedText, t } from "../text.js";
|
|
11
11
|
import { documentLook, foundLore, groupedLore, knownTo, loreGroupOf } from "./known.js";
|
|
12
12
|
// From this width the reader stands beside the list.
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
// The world map's card: the maps the character knows as tabs, the view that moves and zooms with the mouse, the wheel, touch and the keys, its tools.
|
|
3
|
+
import { useEffect, useMemo, useRef, useState } from "preact/hooks";
|
|
4
|
+
import { Icon } from "../parts/icons.js";
|
|
5
|
+
import { t } from "../text.js";
|
|
6
|
+
import { Drawing } from "./drawing.js";
|
|
7
|
+
import { Key } from "./key.js";
|
|
8
|
+
import { clampScale, fitView, liftedOf, mapNameOf, trailCourse, waterOf, wayShapes, zoomedView } from "./map.js";
|
|
9
|
+
import { PlaceCard } from "./place-card.js";
|
|
10
|
+
// How wide the map shows around the party at first on a phone, in km; how much a step of the zoom and of the keys moves.
|
|
11
|
+
const phoneSpan = 46;
|
|
12
|
+
const zoomStep = 1.5;
|
|
13
|
+
const keyStep = 60;
|
|
14
|
+
// How far a pointer moves before a press is a drag, not a click, in pixels.
|
|
15
|
+
const dragFrom = 4;
|
|
16
|
+
/**
|
|
17
|
+
* The map's card: its head, with the maps the character knows as tabs; the map with its tools and the card of the chosen place; the key under it. `map` is what
|
|
18
|
+
* the current map draws, `full` the whole world map, for the ways that lead to other maps.
|
|
19
|
+
*/
|
|
20
|
+
export function MapCard({ map, full, part, layout, lead, chosen, focus, onChoose, onGo, readMore }) {
|
|
21
|
+
const box = useRef(null);
|
|
22
|
+
const [size, setSize] = useState();
|
|
23
|
+
const [view, setView] = useState();
|
|
24
|
+
// The ways drawn by hand and the trail along them, once for each map: the same at every drawing.
|
|
25
|
+
const ways = useMemo(() => wayShapes(map), [map]);
|
|
26
|
+
const trails = useMemo(() => part.trails.map((run) => trailCourse(run, ways, waterOf(map))), [part, ways, map]);
|
|
27
|
+
const lifted = useMemo(() => liftedOf(map, layout, ways, trails), [map, layout, ways, trails]);
|
|
28
|
+
// Under a map aligned with another, the other one as a ghost: its ways and its places, faint (D-320).
|
|
29
|
+
const ghost = useMemo(() => {
|
|
30
|
+
if (part.ghost === undefined) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
const { places, roads } = part.ghost;
|
|
34
|
+
return { ways: wayShapes({ ...full, places, roads }), spots: places.filter((place) => place.x !== undefined && place.y !== undefined && place.radius === undefined) };
|
|
35
|
+
}, [part, full]);
|
|
36
|
+
const pointers = useRef(new Map());
|
|
37
|
+
const drag = useRef(undefined);
|
|
38
|
+
const narrow = size !== undefined && size.width < 600;
|
|
39
|
+
// The map's size, as the window changes it.
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
const element = box.current;
|
|
42
|
+
if (element === null) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const observer = new ResizeObserver(() => setSize({ width: element.clientWidth, height: element.clientHeight }));
|
|
46
|
+
observer.observe(element);
|
|
47
|
+
return () => observer.disconnect();
|
|
48
|
+
}, []);
|
|
49
|
+
// The first view: all the character knows; on a phone, the land around the party; with a place already chosen, as from the Lore's Show on the map, that place.
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (size !== undefined && view === undefined) {
|
|
52
|
+
const spot = shownPoint(map, layout, focus.name);
|
|
53
|
+
const start = startView(map, lifted, size);
|
|
54
|
+
setView(spot === undefined ? start : roomFor(spot, start, size, size.width < 600));
|
|
55
|
+
}
|
|
56
|
+
}, [size]);
|
|
57
|
+
// A place chosen: the map brings it where the card leaves room, right of it on a wide screen, above it on a phone.
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
const spot = shownPoint(map, layout, focus.name);
|
|
60
|
+
if (spot !== undefined && size !== undefined && view !== undefined) {
|
|
61
|
+
setView(roomFor(spot, view, size, narrow));
|
|
62
|
+
}
|
|
63
|
+
}, [focus.count]);
|
|
64
|
+
// The wheel zooms around the pointer; the page does not scroll under it.
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
const element = box.current;
|
|
67
|
+
if (element === null || size === undefined) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const wheel = (event) => {
|
|
71
|
+
event.preventDefault();
|
|
72
|
+
const bounds = element.getBoundingClientRect();
|
|
73
|
+
setView((before) => before === undefined ? before : zoomedView(before, event.deltaY < 0 ? 1.2 : 1 / 1.2, { x: event.clientX - bounds.left, y: event.clientY - bounds.top }, size.width, size.height));
|
|
74
|
+
};
|
|
75
|
+
element.addEventListener("wheel", wheel, { passive: false });
|
|
76
|
+
return () => element.removeEventListener("wheel", wheel);
|
|
77
|
+
}, [size]);
|
|
78
|
+
const zoom = (factor) => {
|
|
79
|
+
if (size !== undefined) {
|
|
80
|
+
setView((before) => before === undefined ? before : zoomedView(before, factor, { x: size.width / 2, y: size.height / 2 }, size.width, size.height));
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
// One pointer moves the map, two pinch it: mouse, pen and touch alike. A press that hardly moves is a click.
|
|
84
|
+
const begin = (moved) => {
|
|
85
|
+
const points = [...pointers.current.values()];
|
|
86
|
+
const centre = middleOf(points);
|
|
87
|
+
drag.current = view === undefined ? undefined : { view, ...centre, spread: spreadOf(points), moved };
|
|
88
|
+
};
|
|
89
|
+
const onPointerDown = (event) => {
|
|
90
|
+
pointers.current.set(event.pointerId, { x: event.clientX, y: event.clientY });
|
|
91
|
+
begin(false);
|
|
92
|
+
};
|
|
93
|
+
const onPointerMove = (event) => {
|
|
94
|
+
const start = drag.current;
|
|
95
|
+
if (start === undefined || !pointers.current.has(event.pointerId)) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
pointers.current.set(event.pointerId, { x: event.clientX, y: event.clientY });
|
|
99
|
+
const points = [...pointers.current.values()];
|
|
100
|
+
const centre = middleOf(points);
|
|
101
|
+
const spread = spreadOf(points);
|
|
102
|
+
if (!start.moved && Math.hypot(centre.x - start.x, centre.y - start.y) < dragFrom && points.length === 1) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (!start.moved) {
|
|
106
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
107
|
+
start.moved = true;
|
|
108
|
+
}
|
|
109
|
+
const s = start.spread > 0 && spread > 0 ? clampScale(start.view.s * spread / start.spread) : start.view.s;
|
|
110
|
+
setView({ s, x: start.view.x - (centre.x - start.x) / s, y: start.view.y + (centre.y - start.y) / s });
|
|
111
|
+
};
|
|
112
|
+
const onPointerUp = (event) => {
|
|
113
|
+
pointers.current.delete(event.pointerId);
|
|
114
|
+
const moved = drag.current?.moved === true;
|
|
115
|
+
if (pointers.current.size > 0) {
|
|
116
|
+
begin(moved);
|
|
117
|
+
}
|
|
118
|
+
else if (!moved) {
|
|
119
|
+
// A click on a place opens its card; on the land, it closes it.
|
|
120
|
+
const name = event.target.closest("[data-place]")?.dataset.place;
|
|
121
|
+
onChoose(name);
|
|
122
|
+
drag.current = undefined;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
drag.current = undefined;
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const onKeyDown = (event) => {
|
|
129
|
+
// Escape closes the card from anywhere in the map, and the map takes the keys again.
|
|
130
|
+
if (event.key === "Escape" && chosen !== undefined) {
|
|
131
|
+
onChoose(undefined);
|
|
132
|
+
box.current?.focus();
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (event.target !== box.current || view === undefined) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const step = keyStep / view.s;
|
|
139
|
+
const moves = { ArrowLeft: [-step, 0], ArrowRight: [step, 0], ArrowUp: [0, step], ArrowDown: [0, -step] };
|
|
140
|
+
const move = moves[event.key];
|
|
141
|
+
if (move !== undefined) {
|
|
142
|
+
event.preventDefault();
|
|
143
|
+
setView({ ...view, x: view.x + move[0], y: view.y + move[1] });
|
|
144
|
+
}
|
|
145
|
+
else if (event.key === "+" || event.key === "=") {
|
|
146
|
+
zoom(zoomStep);
|
|
147
|
+
}
|
|
148
|
+
else if (event.key === "-") {
|
|
149
|
+
zoom(1 / zoomStep);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
const spot = layout.spots.find((one) => one.name === chosen);
|
|
153
|
+
const label = layout.partySpot === undefined ? t("World map") : t("World map, your party at {place}", { place: layout.partySpot.name });
|
|
154
|
+
const here = full.maps.find((known) => known.name === part.name);
|
|
155
|
+
const partyMap = full.party === undefined ? undefined : mapNameOf(full, full.party);
|
|
156
|
+
return (_jsxs("section", { class: "card map-card", "aria-labelledby": "map-title", children: [_jsxs("header", { class: "map-head", children: [_jsx("h3", { id: "map-title", children: t("Map") }), _jsx("span", { class: "map-sub", children: [
|
|
157
|
+
layout.spots.length === 1 ? t("1 place you know") : t("{count} places you know", { count: layout.spots.length }),
|
|
158
|
+
here?.under === undefined ? undefined : t("under {map}", { map: here.under }),
|
|
159
|
+
here?.mirror === undefined ? undefined : t("the mirror of {map}", { map: here.mirror }),
|
|
160
|
+
partyMap === undefined || partyMap === part.name ? undefined : t("your party is on {map}", { map: partyMap }),
|
|
161
|
+
].filter((text) => text !== undefined).join(" · ") }), _jsxs("button", { type: "button", class: "map-to-list", onClick: () => document.getElementById("places-title")?.scrollIntoView({ block: "start", behavior: "smooth" }), children: [_jsx(Icon, { name: "list" }), _jsx("span", { children: t("List") })] })] }), full.maps.length > 1 && (_jsx("nav", { class: "map-tabs", "aria-label": t("Maps"), children: full.maps.map((known) => (_jsxs("button", { type: "button", class: "map-tab", "aria-current": known.name === part.name ? "true" : undefined, onClick: () => onGo(known.name), children: [known.name, known.name === partyMap && _jsx("span", { class: "map-tab-party", "aria-label": t("your party is here") })] }, known.name))) })), _jsxs("div", { ref: box, class: "map", tabIndex: 0, role: "region", "aria-roledescription": "map", "aria-label": label, "aria-describedby": "map-help", onPointerDown: onPointerDown, onPointerMove: onPointerMove, onPointerUp: onPointerUp, onPointerCancel: onPointerUp, onKeyDown: onKeyDown, children: [size !== undefined && view !== undefined && (_jsx(Drawing, { map: map, layout: layout, ways: ways, trails: trails, lifted: lifted, ghost: ghost, passages: part.passages.map((passage) => passage.place), lead: lead, view: view, size: size, narrow: narrow, chosen: chosen })), _jsxs("div", { class: "map-tools", role: "toolbar", "aria-label": t("Map"), children: [_jsx(Tool, { name: "plus", label: t("Zoom in"), onClick: () => zoom(zoomStep) }), _jsx(Tool, { name: "minus", label: t("Zoom out"), onClick: () => zoom(1 / zoomStep) }), _jsx(Tool, { name: "locate", label: t("Your party"), onClick: () => (map.party !== undefined && view !== undefined ? setView({ ...view, x: map.party.x, y: map.party.y }) : partyMap !== undefined && onGo(partyMap)) }), _jsx(Tool, { name: "fit", label: t("All you know"), onClick: () => size !== undefined && setView(fitView(lifted, size.width, size.height)) })] }), _jsx("p", { id: "map-help", class: "visually-hidden", children: t("Arrows move the map, plus and minus zoom, Escape closes a place's card. The list of places below says the same.") }), spot !== undefined && _jsx(PlaceCard, { place: spot, map: full, layout: layout, narrow: narrow, onClose: () => onChoose(undefined), onGo: onGo, readMore: readMore(spot.name) })] }), _jsx(Key, { map: map, layout: layout, narrow: narrow, trail: trails.length > 0, passages: part.passages.length > 0 })] }));
|
|
162
|
+
}
|
|
163
|
+
function Tool({ name, label, onClick }) {
|
|
164
|
+
return (_jsx("button", { type: "button", class: "map-tool", "aria-label": label, "data-tip": label, onClick: onClick, onPointerDown: (event) => event.stopPropagation(), onPointerUp: (event) => event.stopPropagation(), children: _jsx(Icon, { name: name }) }));
|
|
165
|
+
}
|
|
166
|
+
/** The view at first: all the character knows; on a phone, the land around the party. */
|
|
167
|
+
function startView(map, lifted, size) {
|
|
168
|
+
return size.width < 600 && map.party !== undefined ? { x: map.party.x, y: map.party.y, s: clampScale(size.width / phoneSpan) } : fitView(lifted, size.width, size.height);
|
|
169
|
+
}
|
|
170
|
+
/** The view that brings a place where the card leaves room: right of it on a wide screen, in the upper part on a phone. */
|
|
171
|
+
function roomFor(spot, view, size, narrow) {
|
|
172
|
+
const freeX = narrow ? size.width / 2 : (340 + size.width - 60) / 2;
|
|
173
|
+
const freeY = narrow ? size.height * 0.2 : size.height / 2;
|
|
174
|
+
return { ...view, x: spot.x - (freeX - size.width / 2) / view.s, y: spot.y - (size.height / 2 - freeY) / view.s };
|
|
175
|
+
}
|
|
176
|
+
/** Where the map brings a name chosen: a place, the middle of a region, or the middle of a way; none for a name it does not draw. */
|
|
177
|
+
function shownPoint(map, layout, name) {
|
|
178
|
+
const points = map.roads.find((road) => road.name === name)?.points;
|
|
179
|
+
return layout.spots.find((one) => one.name === name) ?? layout.regions.find((one) => one.name === name) ?? points?.[Math.floor((points?.length ?? 0) / 2)];
|
|
180
|
+
}
|
|
181
|
+
function middleOf(points) {
|
|
182
|
+
return { x: points.reduce((sum, point) => sum + point.x, 0) / points.length, y: points.reduce((sum, point) => sum + point.y, 0) / points.length };
|
|
183
|
+
}
|
|
184
|
+
function spreadOf(points) {
|
|
185
|
+
return points.length > 1 ? Math.hypot(points[0].x - points[1].x, points[0].y - points[1].y) : 0;
|
|
186
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime";
|
|
2
|
+
// The card of a place on the world map: its picture, what it is and where, its text as the character knows it, what it holds, its ways.
|
|
3
|
+
import { useEffect, useRef, useState } from "preact/hooks";
|
|
4
|
+
import { sectionAddress } from "../address.js";
|
|
5
|
+
import { pictureAddress, readView } from "../api.js";
|
|
6
|
+
import { fromLabel } from "../parts/game-words.js";
|
|
7
|
+
import { Icon } from "../parts/icons.js";
|
|
8
|
+
import { placeKindLabel } from "../parts/map-symbols.js";
|
|
9
|
+
import { plainLine } from "../parts/markdown.js";
|
|
10
|
+
import { t } from "../text.js";
|
|
11
|
+
import { lengthText, waysOf } from "./map.js";
|
|
12
|
+
/** The card of a place: its picture, what it is and where, its text as the character knows it, what it holds, its ways, the scene when the party is there. */
|
|
13
|
+
export function PlaceCard({ place, map, layout, narrow, onClose, onGo, readMore }) {
|
|
14
|
+
const [text, setText] = useState();
|
|
15
|
+
const here = place === layout.partySpot;
|
|
16
|
+
const region = layout.regions.find((one) => place.within.includes(one.name));
|
|
17
|
+
const inside = layout.inside(place.name);
|
|
18
|
+
const ways = waysOf(map, place.name);
|
|
19
|
+
const closer = useRef(null);
|
|
20
|
+
// Its text, read when the card opens: the first lines as the character knows them.
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
// Only this place's: an answer for the one opened before, which came late, is left.
|
|
23
|
+
let live = true;
|
|
24
|
+
setText(undefined);
|
|
25
|
+
readView(place.name).then((page) => live && setText(page.kind === "page" ? plainLine(page.text) : undefined), () => live && setText(undefined));
|
|
26
|
+
closer.current?.focus({ preventScroll: true });
|
|
27
|
+
return () => {
|
|
28
|
+
live = false;
|
|
29
|
+
};
|
|
30
|
+
}, [place.name]);
|
|
31
|
+
const eyebrow = [placeKindLabel(place.kind) ?? t("Place"), region?.name, here || place.from?.direction === undefined ? undefined : t("{distance} from you", { distance: fromLabel(place.from, (km) => lengthText(km, map.unit)) })].filter((part) => part !== undefined);
|
|
32
|
+
return (_jsxs("div", { class: narrow ? "place-card sheet" : "place-card", role: "dialog", "aria-labelledby": "place-card-title", onPointerDown: (event) => event.stopPropagation(), onPointerUp: (event) => event.stopPropagation(), children: [place.image !== undefined && _jsx("img", { class: "pc-image", src: pictureAddress(place.image), alt: "" }), _jsx("button", { ref: closer, type: "button", class: "pc-close icon-button", "aria-label": t("Close"), onClick: onClose, children: _jsx(Icon, { name: "close" }) }), _jsxs("div", { class: "pc-body", children: [_jsx("p", { class: "eyebrow pc-eyebrow", children: eyebrow.join(" · ") }), _jsx("h3", { id: "place-card-title", children: place.name }), here && (_jsxs("p", { class: "pc-here", children: [_jsx("span", { class: "here-dot", "aria-hidden": "true" }), t("Your party is here")] })), text !== undefined && _jsx("p", { class: "pc-text", children: text }), readMore !== undefined && _jsx("a", { class: "pc-more md-link", href: readMore, children: t("Read all you know") }), inside.length > 0 && (_jsxs(_Fragment, { children: [_jsx("h4", { class: "eyebrow pc-sub", children: t("Inside") }), _jsx("ul", { class: "in-chips", children: inside.flatMap((child) => [
|
|
33
|
+
_jsx("li", { class: "in-chip", children: child.name }, child.name),
|
|
34
|
+
...layout.inside(child.name).map((grandchild) => (_jsxs("li", { class: "in-chip", children: [_jsx("span", { class: "in-path", children: "\u203A" }), " ", grandchild.name] }, grandchild.name))),
|
|
35
|
+
]) })] })), ways.length > 0 && (_jsxs(_Fragment, { children: [_jsx("h4", { class: "eyebrow pc-sub", children: t("Ways") }), _jsx("ul", { class: "pc-ways", children: ways.map((way, index) => (_jsxs("li", { children: [_jsx(Icon, { name: wayIcon(way.kind) }), _jsxs("span", { children: [_jsx("b", { children: way.road }), ` ${t("to")} `, way.map === undefined || way.to === undefined ? way.to ?? t("somewhere you do not know") : (_jsx("button", { type: "button", class: "way-to-map", onClick: () => onGo(way.map, way.to), children: t("{place}, on {map}", { place: way.to, map: way.map }) })), way.km !== undefined && " · ", way.km !== undefined && _jsx("span", { class: "way-km num", children: lengthText(way.km, map.unit) })] })] }, index))) })] })), here && (_jsxs("a", { class: "pc-scene", href: sectionAddress("scene"), children: [_jsx(Icon, { name: "scene" }), _jsx("span", { children: t("Scene") })] }))] })] }));
|
|
36
|
+
}
|
|
37
|
+
function wayIcon(kind) {
|
|
38
|
+
return kind === "river" ? "river" : kind === "path" ? "path" : "road";
|
|
39
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { fromLabel, terrainLabel } from "../parts/game-words.js";
|
|
3
|
+
import { biomeLabel, biomes, placeKindLabel } from "../parts/map-symbols.js";
|
|
4
|
+
import { t } from "../text.js";
|
|
5
|
+
import { BiomeSwatch, wayLabel } from "./key.js";
|
|
6
|
+
import { lengthText } from "./map.js";
|
|
7
|
+
/** The map's twin: every place the character knows, nearest the party first, with how far and which way; then the regions and the ways. */
|
|
8
|
+
export function PlacesList({ map, full, layout, onChoose }) {
|
|
9
|
+
const choose = (name) => {
|
|
10
|
+
onChoose(name);
|
|
11
|
+
document.querySelector(".map")?.scrollIntoView({ block: "nearest", behavior: "smooth" });
|
|
12
|
+
};
|
|
13
|
+
return (_jsxs("section", { class: "card map-list", "aria-labelledby": "places-title", children: [_jsxs("header", { class: "map-head", children: [_jsx("h3", { id: "places-title", children: t("Places you know") }), _jsx("span", { class: "map-sub", children: map.party === undefined ? t("on the map") : t("from your party, as the crow flies") })] }), _jsx("ol", { class: "places", children: layout.spots.map((spot) => (_jsx("li", { children: _jsxs("button", { type: "button", class: "place-row", onClick: () => choose(spot.name), children: [_jsx("span", { class: "pr-name", children: spot.name }), _jsx("span", { class: "pr-kind", children: [placeKindLabel(spot.kind) ?? t("Place"), ...(layout.inside(spot.name).length > 0 ? [t("{count} inside", { count: layout.inside(spot.name).length })] : [])].join(" · ") }), _jsx("span", { class: "pr-far num", dir: "auto", children: spot.from === undefined ? "" : fromLabel(spot.from, (km) => lengthText(km, map.unit)) })] }) }, spot.name))) }), (layout.regions.length > 0 || map.roads.length > 0) && _jsx("h4", { class: "eyebrow pc-sub", children: t("Regions and ways") }), _jsxs("ul", { class: "places", children: [layout.regions.map((region) => _jsx(RegionRow, { region: region, unit: map.unit }, region.name)), waysListed(map.roads, full.roads).map((road) => (_jsx("li", { children: _jsxs("span", { class: "place-row static", children: [_jsx("span", { class: "pr-name", children: road.name }), _jsx("span", { class: "pr-kind", children: wayLabel(road.kind) }), _jsx("span", { class: "pr-far num", children: lengthText(road.km, map.unit) })] }) }, road.name)))] })] }));
|
|
14
|
+
}
|
|
15
|
+
function RegionRow({ region, unit }) {
|
|
16
|
+
return (_jsx("li", { children: _jsxs("span", { class: "place-row static", children: [_jsx("span", { class: "pr-name", children: region.name }), _jsxs("span", { class: "pr-kind", children: [region.biome !== undefined && biomes[region.biome] !== undefined && _jsx(BiomeSwatch, { look: region.biome }), [t("Region"), biomeLabel(region.biome), region.terrain === undefined ? undefined : terrainLabel(region.terrain)].filter((part) => part !== undefined).join(" · ")] }), _jsx("span", { class: "pr-far num", dir: "auto", children: t("{length} across", { length: lengthText(region.radius * 2, unit) }) })] }) }));
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The ways of a map as its list names them: each once, with its whole length, on this map and the others it leads to, its pieces together; a portal, which
|
|
20
|
+
* has none, left out.
|
|
21
|
+
*/
|
|
22
|
+
function waysListed(roads, whole) {
|
|
23
|
+
const names = [...new Set(roads.filter((road) => road.kind !== "portal").map((road) => road.name))];
|
|
24
|
+
return names.map((name) => {
|
|
25
|
+
const pieces = whole.filter((road) => road.name === name);
|
|
26
|
+
const km = pieces.reduce((sum, road) => sum + road.points.slice(1).reduce((length, point) => length + point.km, 0), 0);
|
|
27
|
+
return { name, kind: pieces[0]?.kind ?? "other", km };
|
|
28
|
+
});
|
|
29
|
+
}
|