rpg-engine 0.4.0 → 0.5.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/README.md +1 -1
- package/dist/commands/ask.d.ts +37 -2
- package/dist/commands/ask.js +46 -17
- package/dist/commands/change.d.ts +7 -0
- package/dist/commands/change.js +34 -8
- package/dist/commands/config.js +4 -2
- package/dist/commands/game-extension-list.js +12 -0
- package/dist/commands/game-extensions.d.ts +1 -1
- package/dist/commands/game-extensions.js +242 -17
- package/dist/commands/game-master-rolls.d.ts +2 -0
- package/dist/commands/game-master-rolls.js +2 -0
- package/dist/commands/game-system-code.d.ts +9 -1
- package/dist/commands/game-system-code.js +27 -11
- package/dist/commands/game-widgets.d.ts +6 -1
- package/dist/commands/game-widgets.js +52 -4
- package/dist/commands/game-world.d.ts +15 -3
- package/dist/commands/game-world.js +45 -14
- package/dist/commands/package.d.ts +7 -1
- package/dist/commands/package.js +17 -2
- package/dist/commands/roll.js +2 -2
- package/dist/commands/scene.d.ts +1 -1
- package/dist/commands/view.d.ts +4 -0
- package/dist/commands/view.js +5 -3
- package/dist/core/context.d.ts +19 -0
- package/dist/core/files.d.ts +2 -0
- package/dist/core/files.js +10 -1
- package/dist/core/registry.d.ts +2 -0
- package/dist/dashboard/api.js +11 -3
- package/dist/dashboard/app.js +88 -8
- package/dist/dashboard/ask-card.js +118 -0
- package/dist/dashboard/dice/tray.js +5 -3
- package/dist/dashboard/extension-widgets.js +35 -9
- package/dist/dashboard/faces.js +6 -4
- package/dist/dashboard/help.js +10 -3
- package/dist/dashboard/i18n/ar.json +10 -1
- package/dist/dashboard/i18n/cs.json +9 -0
- package/dist/dashboard/i18n/da.json +9 -0
- package/dist/dashboard/i18n/de.json +9 -0
- package/dist/dashboard/i18n/el.json +10 -1
- package/dist/dashboard/i18n/es.json +9 -0
- package/dist/dashboard/i18n/fi.json +9 -0
- package/dist/dashboard/i18n/fr.json +9 -0
- package/dist/dashboard/i18n/he.json +10 -1
- package/dist/dashboard/i18n/hi.json +10 -1
- package/dist/dashboard/i18n/hu.json +9 -0
- package/dist/dashboard/i18n/is.json +9 -0
- package/dist/dashboard/i18n/it.json +9 -0
- package/dist/dashboard/i18n/ja.json +10 -1
- package/dist/dashboard/i18n/ko.json +10 -1
- package/dist/dashboard/i18n/nb.json +9 -0
- package/dist/dashboard/i18n/nl.json +9 -0
- package/dist/dashboard/i18n/pl.json +9 -0
- package/dist/dashboard/i18n/pt.json +9 -0
- package/dist/dashboard/i18n/ro.json +9 -0
- package/dist/dashboard/i18n/ru.json +9 -0
- package/dist/dashboard/i18n/sv.json +9 -0
- package/dist/dashboard/i18n/tr.json +9 -0
- package/dist/dashboard/i18n/uk.json +9 -0
- package/dist/dashboard/i18n/zh.json +11 -2
- package/dist/dashboard/markdown.js +15 -4
- package/dist/dashboard/pack-card.js +92 -0
- package/dist/dashboard/packages.js +11 -4
- package/dist/dashboard/rolls.js +2 -2
- package/dist/dashboard/scene.js +21 -10
- package/dist/dashboard/style.css +524 -4
- package/dist/dashboard-server.js +57 -1
- package/dist/extensions/api.d.ts +148 -17
- package/dist/extensions/extension.d.ts +10 -3
- package/dist/extensions/extension.js +16 -3
- package/dist/extensions/index.d.ts +3 -3
- package/dist/extensions/index.js +2 -2
- package/dist/extensions/packages.d.ts +8 -0
- package/dist/extensions/packages.js +48 -1
- package/dist/extensions/words.d.ts +2 -1
- package/dist/extensions/words.js +5 -4
- package/dist/index.d.ts +1 -1
- package/dist/mcp-server.js +1 -1
- package/dist/pages/index.d.ts +1 -1
- package/dist/pages/index.js +1 -1
- package/dist/pages/standard-fields.d.ts +2 -0
- package/dist/pages/standard-fields.js +8 -1
- package/dist/systems/game-system.d.ts +14 -9
- package/dist/systems/game-system.js +29 -19
- package/dist/systems/index.d.ts +1 -1
- package/dist/testing.d.ts +61 -0
- package/dist/testing.js +162 -0
- package/package.json +7 -2
|
@@ -315,6 +315,7 @@
|
|
|
315
315
|
"Factions": "Hizipler",
|
|
316
316
|
"factions, threats and places with secrets, no main plot: you choose where to go": "hizipler, tehditler ve sırlarla dolu yerler, ana olay örgüsü yok: nereye gideceğini sen seçersin",
|
|
317
317
|
"Failed": "Başarısız",
|
|
318
|
+
"failed: {count}": "başarısız: {count}",
|
|
318
319
|
"Failure": "Başarısızlık",
|
|
319
320
|
"Farm": "Çiftlik",
|
|
320
321
|
"feet and miles": "fit ve mil",
|
|
@@ -347,6 +348,7 @@
|
|
|
347
348
|
"Game system": "Oyun sistemi",
|
|
348
349
|
"Game systems, extensions and languages come from npm: a file, a link or a folder can be added all the same.": "Oyun sistemleri, eklentiler ve diller npm'den gelir; yine de dosya, bağlantı veya klasör eklenebilir.",
|
|
349
350
|
"GitHub does not answer.": "GitHub yanıt vermiyor.",
|
|
351
|
+
"GitHub is the site where RPG Engine is made: you write there with a free account, as in a forum, and anyone can read it.": "GitHub, RPG Engine'in yapıldığı site: orada ücretsiz bir hesapla, bir forumdaki gibi yazarsın ve herkes okuyabilir.",
|
|
350
352
|
"github.com/someone/an-adventure": "github.com/biri/bir-macera",
|
|
351
353
|
"Glass": "Cam",
|
|
352
354
|
"Go back": "Geri dön",
|
|
@@ -359,6 +361,7 @@
|
|
|
359
361
|
"happy": "mutlu",
|
|
360
362
|
"Hard": "Zor",
|
|
361
363
|
"has code: asks your yes": "kod içerir: onayını ister",
|
|
364
|
+
"held: {count}": "belirsiz: {count}",
|
|
362
365
|
"Help": "Yardım",
|
|
363
366
|
"Here": "Burası",
|
|
364
367
|
"hidden": "gizli",
|
|
@@ -611,6 +614,7 @@
|
|
|
611
614
|
"Onyx": "Oniks",
|
|
612
615
|
"Open": "Aç",
|
|
613
616
|
"Open a new chat with the master.": "Oyun yöneticisiyle yeni bir sohbet aç.",
|
|
617
|
+
"Open a report on GitHub": "GitHub'da bildirim aç",
|
|
614
618
|
"Open source, under the MIT licence.": "MIT lisansıyla açık kaynak.",
|
|
615
619
|
"Open the question": "Soruyu aç",
|
|
616
620
|
"Open the sheet": "Karakter kağıdını aç",
|
|
@@ -673,6 +677,8 @@
|
|
|
673
677
|
"Ready buttons": "Hazır düğmeler",
|
|
674
678
|
"Region": "Bölge",
|
|
675
679
|
"Regions and ways": "Bölgeler ve yollar",
|
|
680
|
+
"Report a problem": "Sorun bildir",
|
|
681
|
+
"Report a problem with {name}": "{name} ile ilgili sorun bildir",
|
|
676
682
|
"reroll once {condition}": "{condition} bir kez yeniden at",
|
|
677
683
|
"rest": "dinlenme",
|
|
678
684
|
"Restore the cleared rolls": "Temizlenen atışları geri getir",
|
|
@@ -744,6 +750,7 @@
|
|
|
744
750
|
"Someone": "Biri",
|
|
745
751
|
"Someone else's": "Başkasının",
|
|
746
752
|
"Someone else's · {author}": "Başkasının · {author}",
|
|
753
|
+
"Something doesn't work, confuses you or could be better? Tell us what you did, what you expected and what happened: every report helps.": "Bir şey çalışmıyor mu, kafanı mı karıştırıyor ya da daha iyi olabilir mi? Ne yaptığını, ne beklediğini ve ne olduğunu anlat: her bildirim işe yarar.",
|
|
747
754
|
"Sometimes": "Ara sıra",
|
|
748
755
|
"somewhere": "bir yerde",
|
|
749
756
|
"somewhere you do not know": "bilmediğin bir yer",
|
|
@@ -790,6 +797,7 @@
|
|
|
790
797
|
"Tales and events": "Hikâyeler ve olaylar",
|
|
791
798
|
"Talk to {name}": "{name} ile konuş",
|
|
792
799
|
"Tell the master": "Oyun yöneticisine söyle",
|
|
800
|
+
"Tell us": "Bize anlat",
|
|
793
801
|
"Temple": "Tapınak",
|
|
794
802
|
"tense action, strong colours, each message ending on a threat or a hook": "gergin aksiyon, canlı renkler, her mesaj bir tehdit ya da merak uyandıran bir kancayla biter",
|
|
795
803
|
"Text, or PDFs whose text can be selected, read best; a scanned PDF is read from the pictures of its pages, on Windows only, in a few minutes.": "En iyi metinler ve metni seçilebilen PDF'ler okunur; taranmış bir PDF sayfa görüntülerinden okunur, yalnızca Windows'ta ve birkaç dakikada.",
|
|
@@ -893,6 +901,7 @@
|
|
|
893
901
|
"This computer is translating the page into {language}: until then it stays in English.": "Bu bilgisayar sayfayı {language} diline çeviriyor: o zamana kadar sayfa İngilizce kalır.",
|
|
894
902
|
"This page": "Bu sayfa",
|
|
895
903
|
"This page could not be read now: try again in a moment.": "Bu sayfa şu an okunamadı: birazdan tekrar dene.",
|
|
904
|
+
"this roll: {count}": "bu atışta: {count}",
|
|
896
905
|
"This turn": "Bu tur",
|
|
897
906
|
"those you ask for": "istediklerin",
|
|
898
907
|
"Time is up": "Süre doldu",
|
|
@@ -315,6 +315,7 @@
|
|
|
315
315
|
"Factions": "Фракції",
|
|
316
316
|
"factions, threats and places with secrets, no main plot: you choose where to go": "фракції, загрози та місця з таємницями, без головного сюжету: ти сам обираєш, куди йти",
|
|
317
317
|
"Failed": "Провалені",
|
|
318
|
+
"failed: {count}": "провалено: {count}",
|
|
318
319
|
"Failure": "Невдача",
|
|
319
320
|
"Farm": "Ферма",
|
|
320
321
|
"feet and miles": "фути та милі",
|
|
@@ -347,6 +348,7 @@
|
|
|
347
348
|
"Game system": "Система гри",
|
|
348
349
|
"Game systems, extensions and languages come from npm: a file, a link or a folder can be added all the same.": "Системи гри, розширення та мови беруться з npm, але файл, посилання чи теку все одно можна додати.",
|
|
349
350
|
"GitHub does not answer.": "GitHub не відповідає.",
|
|
351
|
+
"GitHub is the site where RPG Engine is made: you write there with a free account, as in a forum, and anyone can read it.": "GitHub — це сайт, де створюють RPG Engine: там ти пишеш із безкоштовним обліковим записом, як на форумі, і кожен може це прочитати.",
|
|
350
352
|
"github.com/someone/an-adventure": "github.com/someone/an-adventure",
|
|
351
353
|
"Glass": "Скло",
|
|
352
354
|
"Go back": "Повернутися",
|
|
@@ -359,6 +361,7 @@
|
|
|
359
361
|
"happy": "радісний",
|
|
360
362
|
"Hard": "Важко",
|
|
361
363
|
"has code: asks your yes": "має код: попросить твоєї згоди",
|
|
364
|
+
"held: {count}": "під питанням: {count}",
|
|
362
365
|
"Help": "Довідка",
|
|
363
366
|
"Here": "Тут",
|
|
364
367
|
"hidden": "приховано",
|
|
@@ -611,6 +614,7 @@
|
|
|
611
614
|
"Onyx": "Онікс",
|
|
612
615
|
"Open": "Відкрити",
|
|
613
616
|
"Open a new chat with the master.": "Відкрий новий чат із майстром.",
|
|
617
|
+
"Open a report on GitHub": "Написати про проблему на GitHub",
|
|
614
618
|
"Open source, under the MIT licence.": "Відкритий код за ліцензією MIT.",
|
|
615
619
|
"Open the question": "Відкрити питання",
|
|
616
620
|
"Open the sheet": "Відкрити аркуш персонажа",
|
|
@@ -673,6 +677,8 @@
|
|
|
673
677
|
"Ready buttons": "Готові кнопки",
|
|
674
678
|
"Region": "Регіон",
|
|
675
679
|
"Regions and ways": "Регіони та шляхи",
|
|
680
|
+
"Report a problem": "Повідомити про проблему",
|
|
681
|
+
"Report a problem with {name}": "Повідомити про проблему з пакетом {name}",
|
|
676
682
|
"reroll once {condition}": "перекинути один раз {condition}",
|
|
677
683
|
"rest": "відпочинок",
|
|
678
684
|
"Restore the cleared rolls": "Відновити очищені кидки",
|
|
@@ -744,6 +750,7 @@
|
|
|
744
750
|
"Someone": "Хтось",
|
|
745
751
|
"Someone else's": "Чужий внесок",
|
|
746
752
|
"Someone else's · {author}": "Чужий внесок · {author}",
|
|
753
|
+
"Something doesn't work, confuses you or could be better? Tell us what you did, what you expected and what happened: every report helps.": "Щось не працює, бентежить або могло б бути краще? Розкажи, що було зроблено, чого ти очікуєш і що сталося: кожне повідомлення допомагає.",
|
|
747
754
|
"Sometimes": "Іноді",
|
|
748
755
|
"somewhere": "десь",
|
|
749
756
|
"somewhere you do not know": "місце, якого ти не знаєш",
|
|
@@ -790,6 +797,7 @@
|
|
|
790
797
|
"Tales and events": "Історії та події",
|
|
791
798
|
"Talk to {name}": "Говорити з {name}",
|
|
792
799
|
"Tell the master": "Сказати майстру",
|
|
800
|
+
"Tell us": "Розкажи нам",
|
|
793
801
|
"Temple": "Храм",
|
|
794
802
|
"tense action, strong colours, each message ending on a threat or a hook": "напружена дія, яскраві барви, кожне повідомлення завершується загрозою або зачіпкою",
|
|
795
803
|
"Text, or PDFs whose text can be selected, read best; a scanned PDF is read from the pictures of its pages, on Windows only, in a few minutes.": "Найкраще читаються текст або PDF із виділюваним текстом; скановані PDF читаються із зображень сторінок, лише у Windows, за кілька хвилин.",
|
|
@@ -893,6 +901,7 @@
|
|
|
893
901
|
"This computer is translating the page into {language}: until then it stays in English.": "Цей комп'ютер перекладає сторінку мовою «{language}»: до того часу вона залишається англійською.",
|
|
894
902
|
"This page": "Ця сторінка",
|
|
895
903
|
"This page could not be read now: try again in a moment.": "Цю сторінку зараз не вдалося прочитати: спробуй ще раз за хвилину.",
|
|
904
|
+
"this roll: {count}": "у цьому кидку: {count}",
|
|
896
905
|
"This turn": "Цей хід",
|
|
897
906
|
"those you ask for": "ті, які попросиш",
|
|
898
907
|
"Time is up": "Час вичерпано",
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
"Back up with {value}": "以 {value} 点生命站起",
|
|
164
164
|
"Backstory": "背景故事",
|
|
165
165
|
"Before session zero": "零号团之前",
|
|
166
|
-
"Behind the screen": "
|
|
166
|
+
"Behind the screen": "暗骰",
|
|
167
167
|
"below {value}": "低于{value}",
|
|
168
168
|
"Better for {better} and worse for {worse}: they cancel out": "{better}更有利,{worse}更不利:两者相抵",
|
|
169
169
|
"Between scenes": "场景之间",
|
|
@@ -315,6 +315,7 @@
|
|
|
315
315
|
"Factions": "势力",
|
|
316
316
|
"factions, threats and places with secrets, no main plot: you choose where to go": "势力、威胁和藏有秘密的地点,没有主线:去哪里由你决定",
|
|
317
317
|
"Failed": "已失败",
|
|
318
|
+
"failed: {count}": "失败:{count}",
|
|
318
319
|
"Failure": "失败",
|
|
319
320
|
"Farm": "农场",
|
|
320
321
|
"feet and miles": "英尺和英里",
|
|
@@ -347,6 +348,7 @@
|
|
|
347
348
|
"Game system": "游戏系统",
|
|
348
349
|
"Game systems, extensions and languages come from npm: a file, a link or a folder can be added all the same.": "游戏系统、扩展和语言来自 npm;也可以通过文件、链接或文件夹添加。",
|
|
349
350
|
"GitHub does not answer.": "GitHub 没有响应。",
|
|
351
|
+
"GitHub is the site where RPG Engine is made: you write there with a free account, as in a forum, and anyone can read it.": "GitHub 是制作 RPG Engine 的网站:用免费账号就能在上面发帖,就像在论坛里一样,任何人都能看到。",
|
|
350
352
|
"github.com/someone/an-adventure": "github.com/someone/an-adventure",
|
|
351
353
|
"Glass": "玻璃",
|
|
352
354
|
"Go back": "回到存档",
|
|
@@ -359,6 +361,7 @@
|
|
|
359
361
|
"happy": "开心",
|
|
360
362
|
"Hard": "困难",
|
|
361
363
|
"has code: asks your yes": "含代码:需要你确认",
|
|
364
|
+
"held: {count}": "待定:{count}",
|
|
362
365
|
"Help": "帮助",
|
|
363
366
|
"Here": "此处",
|
|
364
367
|
"hidden": "隐藏",
|
|
@@ -416,7 +419,7 @@
|
|
|
416
419
|
"In this campaign: the master searches its books.": "用于本战役:主持人会查阅其中的书。",
|
|
417
420
|
"In use": "使用中",
|
|
418
421
|
"In use · chosen in the setup": "使用中 · 在设置时选定",
|
|
419
|
-
"In view": "
|
|
422
|
+
"In view": "明骰",
|
|
420
423
|
"In your words": "自定义",
|
|
421
424
|
"Inn": "旅店",
|
|
422
425
|
"Inscription": "铭文",
|
|
@@ -611,6 +614,7 @@
|
|
|
611
614
|
"Onyx": "缟玛瑙",
|
|
612
615
|
"Open": "打开",
|
|
613
616
|
"Open a new chat with the master.": "与主持人开启新的聊天。",
|
|
617
|
+
"Open a report on GitHub": "在 GitHub 上反馈",
|
|
614
618
|
"Open source, under the MIT licence.": "采用 MIT 许可证开源。",
|
|
615
619
|
"Open the question": "打开问题",
|
|
616
620
|
"Open the sheet": "打开角色卡",
|
|
@@ -673,6 +677,8 @@
|
|
|
673
677
|
"Ready buttons": "快捷按钮",
|
|
674
678
|
"Region": "区域",
|
|
675
679
|
"Regions and ways": "区域与路径",
|
|
680
|
+
"Report a problem": "反馈问题",
|
|
681
|
+
"Report a problem with {name}": "反馈 {name} 的问题",
|
|
676
682
|
"reroll once {condition}": "{condition}时重掷一次",
|
|
677
683
|
"rest": "休息",
|
|
678
684
|
"Restore the cleared rolls": "恢复已清空的掷骰",
|
|
@@ -744,6 +750,7 @@
|
|
|
744
750
|
"Someone": "某人",
|
|
745
751
|
"Someone else's": "他人作品",
|
|
746
752
|
"Someone else's · {author}": "他人作品 · {author}",
|
|
753
|
+
"Something doesn't work, confuses you or could be better? Tell us what you did, what you expected and what happened: every report helps.": "有什么不好用、让你困惑,或者可以做得更好?说说你做了什么、本来期望什么、实际发生了什么:每一条反馈都有帮助。",
|
|
747
754
|
"Sometimes": "有时",
|
|
748
755
|
"somewhere": "别处",
|
|
749
756
|
"somewhere you do not know": "你不知道的地方",
|
|
@@ -790,6 +797,7 @@
|
|
|
790
797
|
"Tales and events": "传说与事件",
|
|
791
798
|
"Talk to {name}": "与{name}交谈",
|
|
792
799
|
"Tell the master": "告诉主持人",
|
|
800
|
+
"Tell us": "告诉我们",
|
|
793
801
|
"Temple": "神庙",
|
|
794
802
|
"tense action, strong colours, each message ending on a threat or a hook": "动作紧张,色彩浓烈,每条消息都以威胁或悬念收尾",
|
|
795
803
|
"Text, or PDFs whose text can be selected, read best; a scanned PDF is read from the pictures of its pages, on Windows only, in a few minutes.": "文本或可选中文字的 PDF 读取效果最好;扫描版 PDF 会根据页面图片读取,仅限 Windows,需要几分钟。",
|
|
@@ -893,6 +901,7 @@
|
|
|
893
901
|
"This computer is translating the page into {language}: until then it stays in English.": "这台电脑正在将页面翻译成{language},在此之前仍显示英文。",
|
|
894
902
|
"This page": "本页",
|
|
895
903
|
"This page could not be read now: try again in a moment.": "现在无法读取此页,请稍后再试。",
|
|
904
|
+
"this roll: {count}": "本次掷骰:{count}",
|
|
896
905
|
"This turn": "本回合",
|
|
897
906
|
"those you ask for": "只生成你要求的",
|
|
898
907
|
"Time is up": "时间到了",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
2
|
// A page's text as the player may read it, from its markdown (D-275): headings, paragraphs, lists, quotes, a secret discovered as a note of its own, bold and
|
|
3
3
|
// italics, links as their names, or as links where the page reading it says where they lead. Never HTML: every piece is text, so nothing in a page can run in
|
|
4
4
|
// the dashboard.
|
|
@@ -8,6 +8,10 @@ import { foldedText, listText, t } from "./text.js";
|
|
|
8
8
|
export function Markdown({ text, link, secretKnowers }) {
|
|
9
9
|
return _jsx("div", { class: "markdown", children: blocks(text, link, true, secretKnowers).map((block, index) => _jsx(Fragment, { children: block }, index)) });
|
|
10
10
|
}
|
|
11
|
+
/** A line of a page that is not a whole text, as a value of its fields: its links and its bold and italics, as the text reads them. */
|
|
12
|
+
export function InlineText({ text, link }) {
|
|
13
|
+
return _jsx(_Fragment, { children: inline(text, link) });
|
|
14
|
+
}
|
|
11
15
|
/** Who found out each secret, from what the view gives of a page: its secrets that only some of the player characters discovered; none when it gives none. */
|
|
12
16
|
export function knowersOf(knownBy) {
|
|
13
17
|
return knownBy === undefined || knownBy.length === 0 ? undefined : (title) => knownBy.find((one) => foldedText(one.secret.trim()) === foldedText(title))?.who;
|
|
@@ -153,7 +157,7 @@ function inline(text, link) {
|
|
|
153
157
|
return [];
|
|
154
158
|
}
|
|
155
159
|
const name = linkedName(target);
|
|
156
|
-
const words = said?.trim() ||
|
|
160
|
+
const words = said?.trim() || targetWords(target);
|
|
157
161
|
const plain = said === undefined || foldedText(said.trim()) === foldedText(name);
|
|
158
162
|
const address = name === "" || !plain ? undefined : link?.(name);
|
|
159
163
|
return address === undefined ? emphasis(words, index) : [_jsx("a", { class: "md-link", href: address, children: words }, index)];
|
|
@@ -172,7 +176,14 @@ function emphasis(text, at) {
|
|
|
172
176
|
return /^([*_]).+\1$/.test(piece) ? _jsx("em", { children: piece.slice(1, -1) }, key) : piece;
|
|
173
177
|
});
|
|
174
178
|
}
|
|
175
|
-
/** Links as their words: [[Page|name]] reads name, [[Page]] reads Page; a picture embedded reads nothing. */
|
|
179
|
+
/** Links as their words: [[Page|name]] reads name, [[Page]] reads Page, [[Page#Part]] Page › Part; a picture embedded reads nothing. */
|
|
176
180
|
function linkWords(text) {
|
|
177
|
-
return text.replace(/!?\[\[([^\]|]*)(?:\|([^\]]*))?\]\]/g, (whole, target, said) => whole.startsWith("!") && pictureFile.test(target.split("#")[0].trim()) ? "" : said?.trim() ||
|
|
181
|
+
return text.replace(/!?\[\[([^\]|]*)(?:\|([^\]]*))?\]\]/g, (whole, target, said) => whole.startsWith("!") && pictureFile.test(target.split("#")[0].trim()) ? "" : said?.trim() || targetWords(target));
|
|
182
|
+
}
|
|
183
|
+
/** The words of a link without its own, as Obsidian reads them: Page, Page › Part for a heading of it, Part alone for one of the same page; never a block's id. */
|
|
184
|
+
function targetWords(target) {
|
|
185
|
+
const name = linkedName(target);
|
|
186
|
+
const part = target.split("#").slice(1).join("#").trim();
|
|
187
|
+
const heading = part.startsWith("^") ? "" : part;
|
|
188
|
+
return [name, heading].filter((words) => words !== "").join(" › ");
|
|
178
189
|
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The card after a reading of what the master asks: the question's card once its widget answered, the one before while it has not; the card a call left
|
|
3
|
+
* once over, unless the player let it go; the one before while the button pressed goes; else none, as when another question takes its place. `gone`: the
|
|
4
|
+
* attempts the player let go, each with the question they did it at.
|
|
5
|
+
*/
|
|
6
|
+
export function nextPackCard(before, now, gone) {
|
|
7
|
+
const asked = now.asked ?? undefined;
|
|
8
|
+
if (asked !== undefined) {
|
|
9
|
+
const card = asked.card;
|
|
10
|
+
const kept = before?.key === card?.key ? before : undefined;
|
|
11
|
+
// Let go by the player at this very question, which the master has not taken back yet.
|
|
12
|
+
if (card === undefined || card.shows === undefined || (gone.has(card.key) && gone.get(card.key) === asked.id)) {
|
|
13
|
+
return card?.coming === true && kept !== undefined ? { card: kept } : {};
|
|
14
|
+
}
|
|
15
|
+
const sent = kept?.asked?.id === asked.id && kept.sent !== undefined ? { sent: kept.sent } : {};
|
|
16
|
+
return { card: { widget: card.widget, key: card.key, shows: card.shows, title: kept?.title ?? asked.question, asked, ...sent } };
|
|
17
|
+
}
|
|
18
|
+
const ended = now.card;
|
|
19
|
+
// The call over with nothing for its card to show, as a roll turned down before its first die: the card goes.
|
|
20
|
+
if (ended?.ended === true && ended.shows === undefined && before?.key === ended.key) {
|
|
21
|
+
return {};
|
|
22
|
+
}
|
|
23
|
+
if (ended?.ended === true && ended.shows !== undefined && !gone.has(ended.key)) {
|
|
24
|
+
const kept = before?.key === ended.key ? before : undefined;
|
|
25
|
+
const title = kept?.title === undefined ? {} : { title: kept.title };
|
|
26
|
+
return { card: { widget: ended.widget, key: ended.key, shows: ended.shows, ...title, ...(kept?.asked === undefined ? {} : { asked: kept.asked }), ended: true } };
|
|
27
|
+
}
|
|
28
|
+
// Its question gone with no button of it pressed, as answered in words or taken back by the master: the card goes, and what the call leaves stays away.
|
|
29
|
+
if (before !== undefined && before.ended !== true) {
|
|
30
|
+
return before.sent !== undefined ? { card: before } : { let: before.key };
|
|
31
|
+
}
|
|
32
|
+
return {};
|
|
33
|
+
}
|
|
34
|
+
/** Whether a question is asked in a package's card, coming or come, which shows in place of the banner and alone answers it (D-507). */
|
|
35
|
+
export function inCard(asked) {
|
|
36
|
+
return asked?.card !== undefined && (asked.card.shows !== undefined || asked.card.coming === true);
|
|
37
|
+
}
|
|
38
|
+
/** A widget's parts as a card lays them out: a count with no place in the middle, the facts in the place of the last count at the end, else the middle. */
|
|
39
|
+
export function cardLayout(shows) {
|
|
40
|
+
const layout = { places: { start: [], center: [], end: [] }, facts: [], texts: [], others: [] };
|
|
41
|
+
for (const part of shows.parts ?? []) {
|
|
42
|
+
if ("lead" in part) {
|
|
43
|
+
layout.lead ??= part;
|
|
44
|
+
}
|
|
45
|
+
else if ("track" in part) {
|
|
46
|
+
layout.places[part.track.stage ?? "center"].push(part.track);
|
|
47
|
+
}
|
|
48
|
+
else if ("facts" in part) {
|
|
49
|
+
layout.facts.push(...part.facts);
|
|
50
|
+
}
|
|
51
|
+
else if ("text" in part) {
|
|
52
|
+
layout.texts.push(part.text);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
layout.others.push(part);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return layout;
|
|
59
|
+
}
|
|
60
|
+
/** What changed on each count from one look of a card to the next, by its label: only the counts that changed. */
|
|
61
|
+
export function trackChanges(before, after) {
|
|
62
|
+
const changes = new Map();
|
|
63
|
+
const was = new Map(tracksOf(before).map((track) => [labelKey(track.label), track]));
|
|
64
|
+
for (const track of tracksOf(after)) {
|
|
65
|
+
const old = was.get(labelKey(track.label));
|
|
66
|
+
if (old === undefined) {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
const [from, to] = [litOf(old), litOf(track)];
|
|
70
|
+
const marked = range(to, to + (track.marked ?? 0)).filter((index) => index < litOf(old) || index >= litOf(old) + (old.marked ?? 0));
|
|
71
|
+
const change = { lit: range(from, to), out: range(to, from).reverse(), marked };
|
|
72
|
+
if (change.lit.length + change.out.length + change.marked.length > 0) {
|
|
73
|
+
changes.set(labelKey(track.label), change);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return changes;
|
|
77
|
+
}
|
|
78
|
+
/** A count's label as a key, the same however its values are given. */
|
|
79
|
+
export function labelKey(label) {
|
|
80
|
+
return JSON.stringify(label);
|
|
81
|
+
}
|
|
82
|
+
/** The marks a count shows filled: those lit, then those held. */
|
|
83
|
+
function litOf(track) {
|
|
84
|
+
return track.value + (track.held ?? 0);
|
|
85
|
+
}
|
|
86
|
+
function tracksOf(shows) {
|
|
87
|
+
return (shows?.parts ?? []).flatMap((part) => ("track" in part ? [part.track] : []));
|
|
88
|
+
}
|
|
89
|
+
/** The whole numbers from one to the other, the last left out; none when the second is not past the first. */
|
|
90
|
+
function range(from, to) {
|
|
91
|
+
return Array.from({ length: Math.max(0, to - from) }, (_, index) => from + index);
|
|
92
|
+
}
|
|
@@ -374,7 +374,7 @@ function CatalogRow({ entry, named, view, state, onAdd, onUpdate }) {
|
|
|
374
374
|
*/
|
|
375
375
|
function SystemRow({ system, newer, fresh, state, onUpdate, onUninstall }) {
|
|
376
376
|
const target = system.package ?? system.name;
|
|
377
|
-
return (_jsxs(PackageRow, { tile: "dice", tone: system.used ? undefined : "dim", name: _jsx("span", { class: "system-chip", children: system.name }), badges: _jsx(Trust, { verified: system.verified, code: system.code }), about: systemTitleLabel(system.title), meta: _jsx(VersionMeta, { version: system.version, newer: newer }), row: `system:${system.name}`, fresh: fresh, actions: _jsxs(_Fragment, { children: [newer !== undefined && _jsx(UpdateButton, { name: system.name, version: newer, busy: state.busy, onClick: () => onUpdate(target) }), system.used
|
|
377
|
+
return (_jsxs(PackageRow, { tile: "dice", tone: system.used ? undefined : "dim", name: _jsx("span", { class: "system-chip", children: system.name }), badges: _jsx(Trust, { verified: system.verified, code: system.code }), about: systemTitleLabel(system.title), meta: _jsxs(_Fragment, { children: [_jsx(VersionMeta, { version: system.version, newer: newer }), _jsx(ReportLink, { issues: system.issues, name: system.name, after: system.version !== undefined || newer !== undefined })] }), row: `system:${system.name}`, fresh: fresh, actions: _jsxs(_Fragment, { children: [newer !== undefined && _jsx(UpdateButton, { name: system.name, version: newer, busy: state.busy, onClick: () => onUpdate(target) }), system.used
|
|
378
378
|
? (_jsxs("span", { class: "package-lock", children: [_jsx(Icon, { name: "lock" }), t("In use · chosen in the setup")] }))
|
|
379
379
|
: (_jsxs(_Fragment, { children: [_jsx("span", { class: "package-quiet", children: t("Not in this campaign") }), system.package !== undefined && _jsx(UninstallButton, { name: system.name, busy: state.busy, onClick: () => onUninstall(target) })] }))] }), children: [_jsx(WorkNote, { work: state.work }), _jsx(SaidNote, { said: state.said })] }));
|
|
380
380
|
}
|
|
@@ -389,9 +389,9 @@ function AdventureRow({ adventure, fresh, state, onTakeOut }) {
|
|
|
389
389
|
function ExtensionRow({ extension, newer, fresh, state, onUse, onUpdate, onUninstall }) {
|
|
390
390
|
const name = phraseLabel(extension.name);
|
|
391
391
|
if ("broken" in extension) {
|
|
392
|
-
return (_jsxs(PackageRow, { tile: "alert", tone: "broken", name: name, about: _jsx("span", { class: "package-red", children: t("It does not read: install it again.") }), meta: _jsx("bdi", { class: "package-why", children: extension.broken }), actions: _jsxs(_Fragment, { children: [_jsxs("button", { type: "button", class: "button package-button", "aria-label": t("Install {name} again", { name }), "aria-disabled": state.busy, onClick: () => !state.busy && onUpdate(), children: [_jsx(Icon, { name: "update" }), t("Install it again")] }), _jsx(UninstallButton, { name: name, busy: state.busy, onClick: onUninstall })] }), children: [_jsx(WorkNote, { work: state.work }), _jsx(SaidNote, { said: state.said })] }));
|
|
392
|
+
return (_jsxs(PackageRow, { tile: "alert", tone: "broken", name: name, about: _jsx("span", { class: "package-red", children: t("It does not read: install it again.") }), meta: _jsxs(_Fragment, { children: [_jsx("bdi", { class: "package-why", children: extension.broken }), _jsx(ReportLink, { issues: extension.issues, name: name, after: true })] }), actions: _jsxs(_Fragment, { children: [_jsxs("button", { type: "button", class: "button package-button", "aria-label": t("Install {name} again", { name }), "aria-disabled": state.busy, onClick: () => !state.busy && onUpdate(), children: [_jsx(Icon, { name: "update" }), t("Install it again")] }), _jsx(UninstallButton, { name: name, busy: state.busy, onClick: onUninstall })] }), children: [_jsx(WorkNote, { work: state.work }), _jsx(SaidNote, { said: state.said })] }));
|
|
393
393
|
}
|
|
394
|
-
return (_jsxs(PackageRow, { tile: "packages", name: name, badges: _jsx(Trust, { verified: extension.verified, code: false }), about: `${phraseLabel(extension.about.replace(/\.$/, ""))}.`, meta: _jsx(VersionMeta, { version: extension.version, newer: newer }), row: `extension:${extension.package}`, fresh: fresh, actions: _jsxs(_Fragment, { children: [newer !== undefined && _jsx(UpdateButton, { name: name, version: newer, busy: state.busy, onClick: onUpdate }), _jsxs("label", { class: "package-use", children: [_jsx("input", { type: "checkbox", role: "switch", checked: extension.used, "aria-label": t("{name}: in use", { name }), "aria-disabled": state.busy, onClick: (event) => {
|
|
394
|
+
return (_jsxs(PackageRow, { tile: "packages", name: name, badges: _jsx(Trust, { verified: extension.verified, code: false }), about: `${phraseLabel(extension.about.replace(/\.$/, ""))}.`, meta: _jsxs(_Fragment, { children: [_jsx(VersionMeta, { version: extension.version, newer: newer }), _jsx(ReportLink, { issues: extension.issues, name: name, after: true })] }), row: `extension:${extension.package}`, fresh: fresh, actions: _jsxs(_Fragment, { children: [newer !== undefined && _jsx(UpdateButton, { name: name, version: newer, busy: state.busy, onClick: onUpdate }), _jsxs("label", { class: "package-use", children: [_jsx("input", { type: "checkbox", role: "switch", checked: extension.used, "aria-label": t("{name}: in use", { name }), "aria-disabled": state.busy, onClick: (event) => {
|
|
395
395
|
event.preventDefault();
|
|
396
396
|
if (!state.busy) {
|
|
397
397
|
onUse(!extension.used);
|
|
@@ -407,7 +407,7 @@ function MissingRow({ name, state, onInstall }) {
|
|
|
407
407
|
function LanguageRow({ language, newer, fresh, state, onUpdate, onUninstall }) {
|
|
408
408
|
const page = pageLanguage().toLowerCase().split("-")[0] === language.code.toLowerCase().split("-")[0];
|
|
409
409
|
const name = languageTitle(language);
|
|
410
|
-
return (_jsxs(PackageRow, { tile: "language", name: name, badges: _jsx(Trust, { verified: language.verified, code: false }), meta: _jsxs(_Fragment, { children: [_jsx(VersionMeta, { version: language.version, newer: newer }), page && ` · ${t("the language of this page")}
|
|
410
|
+
return (_jsxs(PackageRow, { tile: "language", name: name, badges: _jsx(Trust, { verified: language.verified, code: false }), meta: _jsxs(_Fragment, { children: [_jsx(VersionMeta, { version: language.version, newer: newer }), page && ` · ${t("the language of this page")}`, _jsx(ReportLink, { issues: language.issues, name: name, after: true })] }), row: `language:${language.code}`, fresh: fresh, actions: _jsxs(_Fragment, { children: [newer !== undefined && _jsx(UpdateButton, { name: name, version: newer, busy: state.busy, onClick: onUpdate }), _jsx(UninstallButton, { name: name, busy: state.busy, onClick: onUninstall })] }), children: [_jsx(WorkNote, { work: state.work }), _jsx(SaidNote, { said: state.said })] }));
|
|
411
411
|
}
|
|
412
412
|
/** A row of the page: the tile, the words, what can be done at the end; under them, the work going on and what happened. */
|
|
413
413
|
function PackageRow({ tile, tone, name, badges, about, meta, actions, focusable, row, fresh, children }) {
|
|
@@ -428,6 +428,13 @@ function Trust({ verified, code, author }) {
|
|
|
428
428
|
function VersionMeta({ version, newer }) {
|
|
429
429
|
return (_jsxs(_Fragment, { children: [version, version !== undefined && newer !== undefined && " · ", newer !== undefined && (_jsxs("span", { class: "package-update", children: [_jsx(Icon, { name: "update" }), t("new {version}", { version: newer })] }))] }));
|
|
430
430
|
}
|
|
431
|
+
/** Where the package's problems are reported, as its package.json says: after what its meta says before it, on a line of its own on a phone; nothing when it says nowhere. */
|
|
432
|
+
export function ReportLink({ issues, name, after }) {
|
|
433
|
+
if (issues === undefined) {
|
|
434
|
+
return null;
|
|
435
|
+
}
|
|
436
|
+
return (_jsxs(_Fragment, { children: [after && _jsx("span", { class: "package-report-gap", children: " · " }), _jsx("a", { class: "package-report", href: issues, target: "_blank", rel: "noreferrer", "aria-label": t("Report a problem with {name}", { name }), children: t("Report a problem") })] }));
|
|
437
|
+
}
|
|
431
438
|
/** Update, for a row npm has a newer version of. */
|
|
432
439
|
function UpdateButton({ name, version, busy, onClick }) {
|
|
433
440
|
return (_jsxs("button", { type: "button", class: "button package-button accent", "aria-label": t("Update {name} to {version}", { name, version }), "aria-disabled": busy, onClick: () => !busy && onClick(), children: [_jsx(Icon, { name: "update" }), t("Update")] }));
|
package/dist/dashboard/rolls.js
CHANGED
|
@@ -52,7 +52,7 @@ export function RollLog({ rolls, free, unread, campaign, party, several = false,
|
|
|
52
52
|
onMore();
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
|
-
return (_jsx("aside", { class: "rolls", "aria-labelledby": "rolls-title", children: _jsxs("details", { class: "rolls-card", open: open, children: [_jsx(CardHeader, { icon: cardIcons.rolls, title: _jsx("h2", { id: "rolls-title", class: "rolls-title", children: t("Rolls") }), preview: newest === undefined ? undefined : `${[nameOf(newest, of), newest.check].filter((part) => part !== undefined && part !== "").join(" · ")} · ${newest.total}`, open: open, onToggle: toggle }), _jsx("div", { class: "rolls-tools folding", children: (listed.shown.length > 0 || listed.more) && (_jsx("button", { type: "button", class: "icon-button tip-left", "aria-label": t("Clear the rolls"), "data-tip": t("Clear the list"), onClick: clear, children: _jsx(Icon, { name: "clearAll" }) })) }), _jsxs("div", { class: "roll-frame", children: [_jsxs("div", { class: "roll-scroll", ref: setScroller, children: [listed.shown.length === 0
|
|
55
|
+
return (_jsx("aside", { class: "rolls", "aria-labelledby": "rolls-title", children: _jsxs("details", { class: "rolls-card", open: open, children: [_jsx(CardHeader, { icon: cardIcons.rolls, title: _jsx("h2", { id: "rolls-title", class: "rolls-title", children: t("Rolls") }), preview: newest === undefined ? undefined : `${[nameOf(newest, of), newest.check].filter((part) => part !== undefined && part !== "").join(" · ")} · ${newest.says ?? newest.total}`, open: open, onToggle: toggle }), _jsx("div", { class: "rolls-tools folding", children: (listed.shown.length > 0 || listed.more) && (_jsx("button", { type: "button", class: "icon-button tip-left", "aria-label": t("Clear the rolls"), "data-tip": t("Clear the list"), onClick: clear, children: _jsx(Icon, { name: "clearAll" }) })) }), _jsxs("div", { class: "roll-frame", children: [_jsxs("div", { class: "roll-scroll", ref: setScroller, children: [listed.shown.length === 0
|
|
56
56
|
? _jsx("p", { class: "rolls-none", children: emptyText(rolls.length, listed.before) })
|
|
57
57
|
: (_jsx("ol", { class: "roll-list", children: [...listed.shown].reverse().map((roll) => (_jsx(RollRow, { roll: roll, name: nameOf(roll, of), token: tokenOf(roll, party, of), fresh: fresh.has(roll.id), greeted: greeted.current, several: several }, roll.id))) })), listed.more
|
|
58
58
|
? _jsx("button", { type: "button", class: "rolls-more", onClick: loadMore, children: t("Load more") })
|
|
@@ -84,7 +84,7 @@ function RollRow({ roll, name, token, fresh, greeted, several }) {
|
|
|
84
84
|
? _jsx("img", { class: "roll-robot", src: "/assets/favicon.svg", alt: "" })
|
|
85
85
|
: token === "die"
|
|
86
86
|
? (_jsx("span", { class: "token roll-die", "aria-hidden": "true", children: _jsx(Icon, { name: "dice" }) }))
|
|
87
|
-
: _jsx(Token, { member: token }), _jsxs("span", { class: "roll-who", children: [_jsx("span", { class: "visually-hidden", children: `${marked ? t("New.") + " " : ""}${free ? t("Your free roll, not logged:") : player ? (several ? t("The players' roll:") : t("Your roll:")) : t("The master's roll:")} ` }), name] }), roll.check && _jsx("span", { class: "roll-check", children: roll.check }), _jsx("span", { class: "roll-total num", children: roll.total }), _jsxs("span", { class: "roll-dice", children: [_jsx(DiceFaces, { dice: roll.dice, modifier: notationModifier(roll.notation) }), _jsx("span", { class: "visually-hidden", children: roll.text })] })] }));
|
|
87
|
+
: _jsx(Token, { member: token }), _jsxs("span", { class: "roll-who", children: [_jsx("span", { class: "visually-hidden", children: `${marked ? t("New.") + " " : ""}${free ? t("Your free roll, not logged:") : player ? (several ? t("The players' roll:") : t("Your roll:")) : t("The master's roll:")} ` }), name] }), roll.check && _jsx("span", { class: "roll-check", children: roll.check }), roll.says === undefined ? _jsx("span", { class: "roll-total num", children: roll.total }) : _jsx("span", { class: "roll-total roll-says", children: roll.says }), _jsxs("span", { class: "roll-dice", children: [_jsx(DiceFaces, { dice: roll.dice, modifier: notationModifier(roll.notation), tones: roll.tones }), _jsx("span", { class: "visually-hidden", children: roll.text })] })] }));
|
|
88
88
|
}
|
|
89
89
|
/** What the list says with no roll in it: what comes there, that the last half hour had none, or that the player cleared it. */
|
|
90
90
|
function emptyText(read, older) {
|
package/dist/dashboard/scene.js
CHANGED
|
@@ -3,17 +3,18 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-ru
|
|
|
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 { useEffect, useRef, useState } from "preact/hooks";
|
|
5
5
|
import { TalkName } from "./act-names.js";
|
|
6
|
+
import { sectionAddress } from "./address.js";
|
|
6
7
|
import { WidgetCards } from "./extension-widgets.js";
|
|
7
8
|
import { effectLabel, sinceDateLabel, terrainLabel } from "./game-words.js";
|
|
8
9
|
import { cardIcons, Icon } from "./icons.js";
|
|
9
10
|
import { phraseLabel, sceneTypeLabel, strangerLabel } from "./labels.js";
|
|
10
11
|
import { biomeLabel, biomes } from "./map-symbols.js";
|
|
11
|
-
import { knowersOf, Markdown } from "./markdown.js";
|
|
12
|
+
import { InlineText, knowersOf, Markdown } from "./markdown.js";
|
|
12
13
|
import { sideOf, Token } from "./party.js";
|
|
13
14
|
import { PlaceMap } from "./place-map-view.js";
|
|
14
15
|
import { Card } from "./sheet.js";
|
|
15
16
|
import { StatusPip } from "./status.js";
|
|
16
|
-
import { t } from "./text.js";
|
|
17
|
+
import { foldedText, t } from "./text.js";
|
|
17
18
|
import { CharacterCard, hasTurns, TurnBand, TurnsCard } from "./turns.js";
|
|
18
19
|
import { BiomeSwatch } from "./world.js";
|
|
19
20
|
// How long the band takes to come in or go out, the style sheet's --short, as the master's question folds.
|
|
@@ -69,17 +70,18 @@ function useBandMotion(turns) {
|
|
|
69
70
|
function PlaceLine({ place }) {
|
|
70
71
|
const [open, setOpen] = useState(false);
|
|
71
72
|
const text = place.text.trim();
|
|
73
|
+
const link = placeLinks(place);
|
|
72
74
|
if (place.image !== undefined) {
|
|
73
75
|
return _jsx(PlaceBand, { place: place, fold: { open, onToggle: () => setOpen(!open) } });
|
|
74
76
|
}
|
|
75
|
-
return (_jsxs("section", { class: "place-line", "aria-labelledby": "place-name", children: [_jsxs("div", { class: "place-line-head", children: [_jsx("span", { class: "place-line-mark", role: "img", "aria-label": t("Place"), "data-tip": t("Place"), children: _jsx(Icon, { name: "scene" }) }), _jsx("h2", { id: "place-name", children: place.name }), place.around.length > 0 && (_jsx("ul", { class: "place-env", "aria-label": t("Around"), children: place.around.map((item) => _jsx(Surrounding, { item: item, name: place.name }, `${"effect" in item ? item.effect : item.name} ${item.place ?? ""}`)) })), text !== "" && _jsx(DescriptionToggle, { open: open, controls: "place-line-text", onToggle: () => setOpen(!open) })] }), open && (_jsx("div", { id: "place-line-text", class: "place-line-text", children: _jsx(Markdown, { text: text, secretKnowers: knowersOf(place.knownBy) }) }))] }));
|
|
77
|
+
return (_jsxs("section", { class: "place-line", "aria-labelledby": "place-name", children: [_jsxs("div", { class: "place-line-head", children: [_jsx("span", { class: "place-line-mark", role: "img", "aria-label": t("Place"), "data-tip": t("Place"), children: _jsx(Icon, { name: "scene" }) }), _jsx("h2", { id: "place-name", children: place.name }), place.around.length > 0 && (_jsx("ul", { class: "place-env", "aria-label": t("Around"), children: place.around.map((item) => _jsx(Surrounding, { item: item, name: place.name, link: link }, `${"effect" in item ? item.effect : item.name} ${item.place ?? ""}`)) })), text !== "" && _jsx(DescriptionToggle, { open: open, controls: "place-line-text", onToggle: () => setOpen(!open) })] }), open && (_jsx("div", { id: "place-line-text", class: "place-line-text", children: _jsx(Markdown, { text: text, link: link, secretKnowers: knowersOf(place.knownBy) }) }))] }));
|
|
76
78
|
}
|
|
77
79
|
/** The button that opens a place's text where it stands, its chevron saying which way. */
|
|
78
80
|
function DescriptionToggle({ open, controls, onToggle }) {
|
|
79
81
|
return (_jsxs("button", { type: "button", class: "place-line-toggle", "aria-expanded": open, "aria-controls": controls, onClick: onToggle, children: [t("Description"), _jsx("span", { class: "chevron-tip tip-left", "aria-hidden": "true", "data-tip": open ? t("Close") : t("Open"), children: _jsx("svg", { class: "chevron", viewBox: "0 0 24 24", "aria-hidden": "true", children: _jsx("path", { d: "M6 9.5l6 6 6-6" }) }) })] }));
|
|
80
82
|
}
|
|
81
83
|
/** A place's text under its picture (D-444): three lines, and the rest at a click, which closes it again; a secret with who found it out (D-480 (7)). */
|
|
82
|
-
function PlaceAbout({ text, knowers }) {
|
|
84
|
+
function PlaceAbout({ text, link, knowers }) {
|
|
83
85
|
const [open, setOpen] = useState(false);
|
|
84
86
|
const [long, setLong] = useState(false);
|
|
85
87
|
const body = useRef(null);
|
|
@@ -94,7 +96,7 @@ function PlaceAbout({ text, knowers }) {
|
|
|
94
96
|
sizes.observe(element);
|
|
95
97
|
return () => sizes.disconnect();
|
|
96
98
|
}, [text, open]);
|
|
97
|
-
return (_jsxs("div", { class: "place-about", children: [_jsx("div", { ref: body, id: "place-about-text", class: open ? "place-about-text" : "place-about-text clamped", children: _jsx(Markdown, { text: text, secretKnowers: knowers }) }), (long || open) && (_jsx("button", { type: "button", class: "place-about-more", "aria-expanded": open, "aria-controls": "place-about-text", onClick: () => setOpen(!open), children: open ? t("less") : t("more") }))] }));
|
|
99
|
+
return (_jsxs("div", { class: "place-about", children: [_jsx("div", { ref: body, id: "place-about-text", class: open ? "place-about-text" : "place-about-text clamped", children: _jsx(Markdown, { text: text, link: link, secretKnowers: knowers }) }), (long || open) && (_jsx("button", { type: "button", class: "place-about-more", "aria-expanded": open, "aria-controls": "place-about-text", onClick: () => setOpen(!open), children: open ? t("less") : t("more") }))] }));
|
|
98
100
|
}
|
|
99
101
|
/**
|
|
100
102
|
* The place's band (D-309, D-444): its picture with its name over it, or without one a compact band; the places that hold it, what holds there; its text under
|
|
@@ -103,28 +105,37 @@ function PlaceAbout({ text, knowers }) {
|
|
|
103
105
|
function PlaceBand({ place, fold }) {
|
|
104
106
|
const text = place.text.trim();
|
|
105
107
|
const knowers = knowersOf(place.knownBy);
|
|
106
|
-
const
|
|
108
|
+
const link = placeLinks(place);
|
|
109
|
+
const caption = (_jsxs("div", { class: "place-caption", children: [place.within.length > 0 && (_jsx("ol", { class: "place-path", "aria-label": t("Within"), children: place.within.map((name) => _jsx("li", { children: name }, name)) })), _jsx("h2", { id: "place-name", children: place.name }), place.around.length > 0 && (_jsx("ul", { class: "place-env", "aria-label": t("Around"), children: place.around.map((item) => _jsx(Surrounding, { item: item, name: place.name, link: link }, `${"effect" in item ? item.effect : item.name} ${item.place ?? ""}`)) })), fold && text !== "" && _jsx(DescriptionToggle, { open: fold.open, controls: "place-band-text", onToggle: fold.onToggle })] }));
|
|
107
110
|
return place.image === undefined
|
|
108
|
-
? (_jsxs("header", { class: "place-band compact", children: [_jsxs("div", { class: "place-shot", children: [_jsx("div", { class: "place-disc", children: _jsx(Icon, { name: "house" }) }), caption] }), text !== "" && _jsx(PlaceAbout, { text: text, knowers: knowers })] }))
|
|
109
|
-
: (_jsxs("header", { class: fold === undefined ? "place-band over" : `place-band over folding${fold.open ? "" : " low"}`, children: [_jsxs("div", { class: "place-shot", children: [_jsx("figure", { class: "place-image", children: _jsx("img", { src: `/images/${encodeURIComponent(place.image.file)}?v=${place.image.version}`, alt: "" }) }), caption] }), fold === undefined && text !== "" && _jsx(PlaceAbout, { text: text, knowers: knowers }), fold?.open === true && text !== "" && (_jsx("div", { class: "place-about", id: "place-band-text", children: _jsx("div", { class: "place-about-text", children: _jsx(Markdown, { text: text, secretKnowers: knowers }) }) }))] }));
|
|
111
|
+
? (_jsxs("header", { class: "place-band compact", children: [_jsxs("div", { class: "place-shot", children: [_jsx("div", { class: "place-disc", children: _jsx(Icon, { name: "house" }) }), caption] }), text !== "" && _jsx(PlaceAbout, { text: text, link: link, knowers: knowers })] }))
|
|
112
|
+
: (_jsxs("header", { class: fold === undefined ? "place-band over" : `place-band over folding${fold.open ? "" : " low"}`, children: [_jsxs("div", { class: "place-shot", children: [_jsx("figure", { class: "place-image", children: _jsx("img", { src: `/images/${encodeURIComponent(place.image.file)}?v=${place.image.version}`, alt: "" }) }), caption] }), fold === undefined && text !== "" && _jsx(PlaceAbout, { text: text, link: link, knowers: knowers }), fold?.open === true && text !== "" && (_jsx("div", { class: "place-about", id: "place-band-text", children: _jsx("div", { class: "place-about-text", children: _jsx(Markdown, { text: text, link: link, secretKnowers: knowers }) }) }))] }));
|
|
110
113
|
}
|
|
111
114
|
/**
|
|
112
115
|
* One thing that holds there: an entry of the environment as its name and value, as light dim, the biome and the terrain the engine reads in the page's language;
|
|
113
116
|
* an effect with its end; the place it comes from, when another.
|
|
114
117
|
*/
|
|
115
|
-
function Surrounding({ item, name }) {
|
|
118
|
+
function Surrounding({ item, name, link }) {
|
|
116
119
|
const from = item.place === undefined || item.place === name ? undefined : item.place;
|
|
117
120
|
const entry = "effect" in item ? undefined : environmentLabel(item.name, item.value);
|
|
118
121
|
// A biome the page draws has its picture, as on the map, for the word before it.
|
|
119
122
|
const look = "effect" in item || item.name.trim().toLowerCase() !== "biome" ? undefined : item.value.trim().toLowerCase();
|
|
120
123
|
const biome = look !== undefined && biomes[look] !== undefined ? look : undefined;
|
|
121
|
-
return (_jsxs("li", { class: biome === undefined ? undefined : "biome", children: ["effect" in item ? effectLabel({ name: item.effect, end: item.end }) : (_jsxs(_Fragment, { children: [biome !== undefined && _jsx(BiomeSwatch, { look: biome }), entry?.name !== "" && _jsx("span", { class: biome === undefined ? "k" : "visually-hidden", children: entry?.name }), entry?.name !== "" && biome === undefined && " ", entry
|
|
124
|
+
return (_jsxs("li", { class: biome === undefined ? undefined : "biome", children: ["effect" in item ? effectLabel({ name: item.effect, end: item.end }) : (_jsxs(_Fragment, { children: [biome !== undefined && _jsx(BiomeSwatch, { look: biome }), entry?.name !== "" && _jsx("span", { class: biome === undefined ? "k" : "visually-hidden", children: entry?.name }), entry?.name !== "" && biome === undefined && " ", entry !== undefined && _jsx(InlineText, { text: entry.value, link: link })] })), from && _jsx("span", { class: "from", children: ` · ${from}` })] }));
|
|
122
125
|
}
|
|
123
126
|
/** An entry of a place's environment: the biome and the terrain, which the engine reads, in the page's language; any other as the master wrote it. */
|
|
124
127
|
function environmentLabel(name, value) {
|
|
125
128
|
const known = name.trim().toLowerCase();
|
|
126
129
|
return known === "biome" ? { name: t("biome"), value: biomeLabel(value)?.toLowerCase() ?? value } : known === "terrain" ? { name: "", value: phraseLabel(terrainLabel(value)) } : { name, value };
|
|
127
130
|
}
|
|
131
|
+
/** Where a link of a place's words leads: the place and those that hold it, which the character knows, to their pages in World; any other stays words. */
|
|
132
|
+
function placeLinks(place) {
|
|
133
|
+
const known = new Map([...place.within, place.name].map((name) => [foldedText(name), name]));
|
|
134
|
+
return (name) => {
|
|
135
|
+
const page = known.get(foldedText(name));
|
|
136
|
+
return page === undefined ? undefined : sectionAddress("world", "lore", page);
|
|
137
|
+
};
|
|
138
|
+
}
|
|
128
139
|
/** The open scene (D-309): its title, type and since when, who is in it, and the round and whose turn it is when it has them. */
|
|
129
140
|
function SceneCard({ scene }) {
|
|
130
141
|
const turn = scene.turn === undefined
|