rpg-engine 0.22.0 → 0.24.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 +5 -5
- package/dist/campaign/create-campaign.d.ts +6 -1
- package/dist/campaign/create-campaign.js +41 -13
- package/dist/campaign/find-campaign.d.ts +5 -0
- package/dist/campaign/find-campaign.js +20 -5
- package/dist/campaign/host-files.d.ts +14 -4
- package/dist/campaign/host-files.js +193 -36
- package/dist/campaign/index.d.ts +2 -2
- package/dist/campaign/index.js +2 -2
- package/dist/campaign/settings.d.ts +3 -3
- package/dist/campaign/settings.js +5 -4
- package/dist/cli/cli.js +28 -7
- package/dist/commands/config/config.js +1 -1
- package/dist/commands/config/dashboard.js +28 -6
- package/dist/commands/config/words.js +2 -1
- package/dist/commands/image.d.ts +3 -0
- package/dist/commands/image.js +32 -5
- package/dist/commands/import/import.d.ts +3 -1
- package/dist/commands/import/import.js +16 -3
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.js +21 -3
- package/dist/commands/instructions.js +1 -1
- package/dist/commands/shared/campaign/git.js +1 -1
- package/dist/commands/shared/campaign/images.js +6 -3
- package/dist/commands/shared/campaign/mode.js +1 -1
- package/dist/commands/shared/characters/voices.d.ts +2 -2
- package/dist/commands/shared/characters/voices.js +9 -6
- package/dist/commands/shared/sheet/sheet.d.ts +2 -2
- package/dist/commands/shared/sheet/sheet.js +3 -3
- package/dist/core/context.d.ts +21 -6
- package/dist/core/context.js +2 -1
- package/dist/dashboard/acts/acts.js +39 -11
- package/dist/dashboard/acts/head.js +7 -0
- package/dist/dashboard/acts/names.js +4 -2
- package/dist/dashboard/acts/sending.js +23 -22
- package/dist/dashboard/acts/sheet.js +7 -149
- package/dist/dashboard/acts/strip.js +10 -14
- package/dist/dashboard/acts/talk.js +51 -0
- package/dist/dashboard/acts/thing.js +169 -0
- package/dist/dashboard/app.js +3 -3
- package/dist/dashboard/guide/ar.md +17 -14
- package/dist/dashboard/guide/cs.md +15 -12
- package/dist/dashboard/guide/da.md +15 -12
- package/dist/dashboard/guide/de.md +14 -11
- package/dist/dashboard/guide/el.md +14 -11
- package/dist/dashboard/guide/en.md +13 -10
- package/dist/dashboard/guide/es.md +14 -11
- package/dist/dashboard/guide/fi.md +14 -11
- package/dist/dashboard/guide/fr.md +14 -11
- package/dist/dashboard/guide/he.md +14 -11
- package/dist/dashboard/guide/hi.md +14 -11
- package/dist/dashboard/guide/hu.md +14 -11
- package/dist/dashboard/guide/is.md +14 -11
- package/dist/dashboard/guide/it.md +57 -54
- package/dist/dashboard/guide/ja.md +14 -11
- package/dist/dashboard/guide/ko.md +15 -12
- package/dist/dashboard/guide/nb.md +14 -11
- package/dist/dashboard/guide/nl.md +16 -13
- package/dist/dashboard/guide/pl.md +14 -11
- package/dist/dashboard/guide/pt.md +14 -11
- package/dist/dashboard/guide/ro.md +15 -12
- package/dist/dashboard/guide/ru.md +14 -11
- package/dist/dashboard/guide/sv.md +15 -12
- package/dist/dashboard/guide/tr.md +15 -12
- package/dist/dashboard/guide/uk.md +15 -12
- package/dist/dashboard/guide/zh.md +15 -12
- package/dist/dashboard/i18n/ar.json +28 -11
- package/dist/dashboard/i18n/cs.json +28 -11
- package/dist/dashboard/i18n/da.json +28 -11
- package/dist/dashboard/i18n/de.json +28 -11
- package/dist/dashboard/i18n/el.json +28 -11
- package/dist/dashboard/i18n/es.json +28 -11
- package/dist/dashboard/i18n/fi.json +28 -11
- package/dist/dashboard/i18n/fr.json +28 -11
- package/dist/dashboard/i18n/he.json +28 -11
- package/dist/dashboard/i18n/hi.json +28 -11
- package/dist/dashboard/i18n/hu.json +28 -11
- package/dist/dashboard/i18n/is.json +28 -11
- package/dist/dashboard/i18n/it.json +104 -87
- package/dist/dashboard/i18n/ja.json +28 -11
- package/dist/dashboard/i18n/ko.json +28 -11
- package/dist/dashboard/i18n/nb.json +28 -11
- package/dist/dashboard/i18n/nl.json +28 -11
- package/dist/dashboard/i18n/pl.json +28 -11
- package/dist/dashboard/i18n/pt.json +28 -11
- package/dist/dashboard/i18n/ro.json +28 -11
- package/dist/dashboard/i18n/ru.json +28 -11
- package/dist/dashboard/i18n/sv.json +28 -11
- package/dist/dashboard/i18n/tr.json +28 -11
- package/dist/dashboard/i18n/uk.json +28 -11
- package/dist/dashboard/i18n/zh.json +28 -11
- package/dist/dashboard/packages/packages.js +1 -1
- package/dist/dashboard/parts/icons.js +2 -0
- package/dist/dashboard/parts/labels.js +2 -1
- package/dist/dashboard/parts/layout.js +34 -0
- package/dist/dashboard/parts/widgets.js +6 -2
- package/dist/dashboard/settings/language-choice.js +1 -1
- package/dist/dashboard/settings/settings.js +73 -39
- package/dist/dashboard/settings/tabs.js +14 -0
- package/dist/dashboard/sheet/sheet.js +54 -33
- package/dist/dashboard/shell/notices.js +2 -2
- package/dist/dashboard/style.css +135 -52
- package/dist/helpers/antigravity.d.ts +47 -0
- package/dist/helpers/antigravity.js +434 -0
- package/dist/helpers/briefs.d.ts +4 -0
- package/dist/helpers/briefs.js +13 -0
- package/dist/helpers/chosen.d.ts +15 -7
- package/dist/helpers/chosen.js +96 -45
- package/dist/helpers/index.d.ts +4 -2
- package/dist/helpers/index.js +6 -3
- package/dist/helpers/opencode.d.ts +13 -0
- package/dist/helpers/opencode.js +295 -0
- package/dist/helpers/programs.d.ts +8 -0
- package/dist/helpers/programs.js +35 -2
- package/dist/helpers/stop.d.ts +2 -0
- package/dist/helpers/stop.js +20 -1
- package/dist/helpers/svg.d.ts +4 -1
- package/dist/helpers/svg.js +16 -4
- package/dist/instructions/index.d.ts +4 -2
- package/dist/instructions/index.js +6 -3
- package/dist/server/approver.d.ts +4 -2
- package/dist/server/approver.js +27 -7
- package/dist/server/bell/antigravity.d.ts +15 -0
- package/dist/server/bell/antigravity.js +113 -0
- package/dist/server/bell/index.d.ts +2 -0
- package/dist/server/bell/index.js +2 -0
- package/dist/server/bell/listener.d.ts +43 -0
- package/dist/server/bell/listener.js +154 -0
- package/dist/server/dashboard/index.d.ts +10 -1
- package/dist/server/dashboard/index.js +6 -1
- package/dist/server/dashboard/news.d.ts +3 -1
- package/dist/server/dashboard/news.js +64 -10
- package/dist/server/fence.d.ts +21 -0
- package/dist/server/fence.js +69 -0
- package/dist/server/mcp.d.ts +3 -2
- package/dist/server/mcp.js +37 -7
- package/dist/server/player-acts.d.ts +21 -1
- package/dist/server/player-acts.js +39 -3
- package/dist/server/route/front.d.ts +3 -0
- package/dist/server/route/front.js +97 -0
- package/dist/server/route/index.d.ts +3 -0
- package/dist/server/route/index.js +3 -0
- package/dist/server/route/notes.d.ts +8 -0
- package/dist/server/route/notes.js +50 -0
- package/dist/server/route/router.d.ts +31 -0
- package/dist/server/route/router.js +215 -0
- package/dist/server/subagent.d.ts +4 -0
- package/dist/server/subagent.js +30 -0
- package/instructions/start.md +1 -1
- package/instructions/voices-antigravity.md +1 -0
- package/instructions/voices-codex.md +1 -0
- package/instructions/voices-opencode.md +1 -0
- package/package.json +3 -2
- package/plugins/opencode.js +174 -0
- package/dist/server/bell-listener.d.ts +0 -10
- package/dist/server/bell-listener.js +0 -52
|
@@ -1,38 +1,49 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime";
|
|
2
2
|
import { useContext, useEffect, useRef, useState } from "preact/hooks";
|
|
3
3
|
import { sectionLabel } from "../address.js";
|
|
4
4
|
import { changeSetting, readSettings } from "../api.js";
|
|
5
5
|
import { coinDesignPref, coinDesigns, coinLook, coinMetals, coinPref, diceEdgesPref, diceLook, diceSetPref, diceSets, texturePath } from "../dice/sets.js";
|
|
6
6
|
import { WidgetsContext } from "../packages/widgets.js";
|
|
7
|
+
import { CardHead } from "../parts/card.js";
|
|
7
8
|
import { CoinFace } from "../parts/faces.js";
|
|
8
|
-
import { DieSwatch, Icon } from "../parts/icons.js";
|
|
9
|
+
import { cardIcons, DieSwatch, Icon, iconPath } from "../parts/icons.js";
|
|
9
10
|
import { customLabel, itemLabel, leveledItemLabel, phraseLabel, rateParts, settingLabel, valueLabel } from "../parts/labels.js";
|
|
10
11
|
import { PageHead } from "../shell/pages.js";
|
|
11
12
|
import { byHandPref, conditionsPref, readChoice, soundPref, tokenSymbolsPref, useChoice, usePref, usePrefChange, writeChoice } from "../shell/prefs.js";
|
|
12
13
|
import { applyGameStyle, gameStyle, installedStyle, systemStylePref } from "../shell/system-style.js";
|
|
14
|
+
import { PageTabs } from "../shell/tabs.js";
|
|
13
15
|
import { pickTheme, shownTheme } from "../shell/theme.js";
|
|
14
16
|
import { arrowStep, t } from "../text.js";
|
|
15
17
|
import { LanguageChoice, languageLine } from "./language-choice.js";
|
|
16
18
|
import { Confirm } from "./saves.js";
|
|
17
|
-
|
|
18
|
-
//
|
|
19
|
+
import { settingsTab, settingsTabLabel, settingsTabs } from "./tabs.js";
|
|
20
|
+
// The cards of the campaign's settings, in the order groupTitle names them: each in its tab, with its picture and its settings in order. A setting the game
|
|
21
|
+
// system adds goes with the dice, as whether the master's rolls are shown (D-287). The master's style holds who voices the characters (D-490) and how much the
|
|
22
|
+
// master thinks (D-462) too.
|
|
19
23
|
const groups = [
|
|
20
|
-
{ names: ["ruleset", "difficulty", "lethality", "saves", "rigor", "between-sessions"] },
|
|
21
|
-
{ names: ["
|
|
22
|
-
{
|
|
23
|
-
{ names: ["
|
|
24
|
-
{ names: ["lines", "veils"] },
|
|
25
|
-
{ names: ["orders"] },
|
|
26
|
-
{ names: ["pictures", "pictures-by", "language"] },
|
|
24
|
+
{ tab: "game", key: "rules", icon: () => iconPath("combat"), names: ["ruleset", "difficulty", "lethality", "saves", "rigor", "between-sessions"] },
|
|
25
|
+
{ tab: "game", key: "dice", icon: () => iconPath("dice"), names: ["dice", "master-rolls", "units"], system: true },
|
|
26
|
+
{ tab: "game", key: "learning", icon: () => iconPath("help"), names: ["mentor", "learned"] },
|
|
27
|
+
{ tab: "master", key: "style", icon: () => cardIcons.backstory, names: ["prose", "story", "author", "style", "voices", "effort"] },
|
|
28
|
+
{ tab: "master", key: "limits", icon: () => iconPath("hand"), names: ["lines", "veils"] },
|
|
29
|
+
{ tab: "master", key: "companions", icon: () => cardIcons.here, names: ["orders"] },
|
|
30
|
+
{ tab: "campaign", key: "pictures", icon: () => iconPath("picture"), names: ["pictures", "pictures-by", "language"] },
|
|
27
31
|
// Only where the campaign's folder is a git repository (D-576).
|
|
28
32
|
// What a public repository would show of the player (D-576).
|
|
29
33
|
{
|
|
34
|
+
tab: "campaign",
|
|
35
|
+
key: "git",
|
|
36
|
+
icon: () => iconPath("branch"),
|
|
30
37
|
names: ["git", "git-saves", "git-sessions"],
|
|
31
38
|
note: () => t("Keep the repository private. It holds the log of your sessions and your user's name on this computer; with the chats in, everything you wrote to the master too."),
|
|
32
39
|
},
|
|
33
40
|
];
|
|
34
|
-
/**
|
|
35
|
-
|
|
41
|
+
/**
|
|
42
|
+
* The Settings section, on the tab its address names; with `several` player characters, what a value means says so where it speaks of one character
|
|
43
|
+
* (D-480 (2)).
|
|
44
|
+
*/
|
|
45
|
+
export function SettingsView({ version, tab, several = false }) {
|
|
46
|
+
const shownTab = settingsTab(tab);
|
|
36
47
|
const [settings, setSettings] = useState();
|
|
37
48
|
const [problem, setProblem] = useState();
|
|
38
49
|
const reads = useRef(0);
|
|
@@ -60,16 +71,21 @@ export function SettingsView({ version, several = false }) {
|
|
|
60
71
|
return said;
|
|
61
72
|
};
|
|
62
73
|
const known = new Set([...groups.flatMap((group) => group.names), ...Object.values(customParts)]);
|
|
63
|
-
return (_jsxs("section", { class: "settings", "aria-labelledby": "settings-title", children: [_jsx(PageHead, { section: "settings", id: "settings-title" }), _jsx("p", { class: "settings-lead", children: t("A change counts at once, from now on: what is already in play stays as it is. The master hears of it at their next move, and of nothing you put back as it was.") }), problem !== undefined && _jsx("p", { class: "settings-problem", role: "alert", children: problem }), settings !== undefined && groups.map((group, index) => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
74
|
+
return (_jsxs("section", { class: "page-stack settings", "aria-labelledby": "settings-title", children: [_jsx(PageHead, { section: "settings", id: "settings-title" }), _jsx("p", { class: "settings-lead", children: t("A change counts at once, from now on: what is already in play stays as it is. The master hears of it at their next move, and of nothing you put back as it was.") }), problem !== undefined && _jsx("p", { class: "settings-problem", role: "alert", children: problem }), _jsx(PageTabs, { section: "settings", label: t("Settings"), chosen: shownTab, tabs: settingsTabs.map((key) => ({ key, name: settingsTabLabel(key) })) }), _jsxs("div", { class: "settings-panel", id: "settings-panel", role: "tabpanel", "aria-labelledby": `settings-tab-${shownTab}`, children: [settings !== undefined && groups.map((group, index) => {
|
|
75
|
+
const shown = group.tab !== shownTab ? [] : [
|
|
76
|
+
...group.names.flatMap((name) => settings.filter((setting) => setting.name === name)),
|
|
77
|
+
...(group.system ? settings.filter((setting) => !known.has(setting.name)) : []),
|
|
78
|
+
];
|
|
79
|
+
if (shown.length === 0) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
return (_jsxs(SettingsCard, { name: group.key, icon: group.icon(), title: groupTitle(index), children: [group.note !== undefined && (_jsxs("div", { class: "settings-card-note setting-note fix", children: [_jsx(Icon, { name: "lock" }), _jsx("p", { children: group.note() })] })), shown.map((setting) => (_jsx(SettingRow, { setting: setting, off: offBy(setting, settings), several: several, parts: settings.find((one) => one.name === customParts[setting.name]), onChange: change }, setting.name)))] }, group.key));
|
|
83
|
+
}), shownTab === "campaign" && _jsx(WidgetSettings, { onChange: change }), shownTab === "page" && _jsx(PageSettings, {})] })] }));
|
|
84
|
+
}
|
|
85
|
+
/** A card of settings, always open: its picture and its title, then its rows, a rule between them. */
|
|
86
|
+
function SettingsCard({ name, icon, title, children }) {
|
|
87
|
+
const id = `settings-${name}`;
|
|
88
|
+
return (_jsxs("section", { class: "card", "aria-labelledby": id, children: [_jsx(CardHead, { icon: icon, title: _jsx("h3", { id: id, children: title }) }), _jsx("div", { class: "card-body settings-body", children: children })] }));
|
|
73
89
|
}
|
|
74
90
|
/**
|
|
75
91
|
* What a value of a setting means, in the page's language; with more than one player character, checkpoint goes back when all die, or when one does and the
|
|
@@ -78,10 +94,19 @@ export function SettingsView({ version, several = false }) {
|
|
|
78
94
|
function meansText(setting, value, means, several) {
|
|
79
95
|
return several && setting === "saves" && value === "checkpoint" ? t("if they all die, or if the table chooses it when one dies: back to the end of the last scene") : t(means);
|
|
80
96
|
}
|
|
81
|
-
/**
|
|
97
|
+
/**
|
|
98
|
+
* Why a setting counts for nothing now, as the prose while an author is written (D-395), or what goes into the repository while the engine commits nothing
|
|
99
|
+
* (D-576); undefined for one that counts. Its values stay to choose, for when it counts again.
|
|
100
|
+
*/
|
|
82
101
|
function offBy(setting, settings) {
|
|
83
|
-
const
|
|
84
|
-
|
|
102
|
+
const valueOf = (name) => settings.find((one) => one.name === name)?.value;
|
|
103
|
+
if (setting.name === "prose" && valueOf("author") !== undefined) {
|
|
104
|
+
return t("The author you wrote takes its place: this counts again once you clear the author.");
|
|
105
|
+
}
|
|
106
|
+
if ((setting.name === "git-saves" || setting.name === "git-sessions") && valueOf("git") === "off") {
|
|
107
|
+
return t("Counts only with automatic commits: while they are off, the engine puts nothing into the repository.");
|
|
108
|
+
}
|
|
109
|
+
return undefined;
|
|
85
110
|
}
|
|
86
111
|
/**
|
|
87
112
|
* One setting: its name and what it is, its values to choose from, a list's items to add and take off, the player's own words, or the language; what the chosen
|
|
@@ -414,7 +439,10 @@ function gameStyleRows() {
|
|
|
414
439
|
function idOf(name) {
|
|
415
440
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-");
|
|
416
441
|
}
|
|
417
|
-
/**
|
|
442
|
+
/**
|
|
443
|
+
* The page's own settings, in this browser alone, in three cards: its look, the theme and the game's style; the tokens' symbols and conditions; the dice's
|
|
444
|
+
* sound, set and edges, the coins, rolling by hand.
|
|
445
|
+
*/
|
|
418
446
|
function PageSettings() {
|
|
419
447
|
usePrefChange();
|
|
420
448
|
const [sound, setSound] = usePref(soundPref);
|
|
@@ -425,7 +453,7 @@ function PageSettings() {
|
|
|
425
453
|
const [byHand, setByHand] = usePref(byHandPref);
|
|
426
454
|
const [symbols, setSymbols] = usePref(tokenSymbolsPref);
|
|
427
455
|
const [conditions, setConditions] = useChoice(conditionsPref);
|
|
428
|
-
const
|
|
456
|
+
const look = [
|
|
429
457
|
{
|
|
430
458
|
key: "theme",
|
|
431
459
|
name: t("Theme"),
|
|
@@ -435,6 +463,8 @@ function PageSettings() {
|
|
|
435
463
|
pick: (value) => pickTheme(value === "dark" ? "dark" : "light"),
|
|
436
464
|
},
|
|
437
465
|
...gameStyleRows(),
|
|
466
|
+
];
|
|
467
|
+
const tokens = [
|
|
438
468
|
{
|
|
439
469
|
key: "token-symbols",
|
|
440
470
|
name: t("Token symbols"),
|
|
@@ -451,6 +481,8 @@ function PageSettings() {
|
|
|
451
481
|
value: conditions,
|
|
452
482
|
pick: setConditions,
|
|
453
483
|
},
|
|
484
|
+
];
|
|
485
|
+
const dice = [
|
|
454
486
|
{ key: "dice-sound", name: t("Dice sound"), about: t("the dice as they roll"), options: [{ value: "on", label: t("On") }, { value: "off", label: t("Off") }], value: sound ? "on" : "off", pick: (value) => setSound(value === "on") },
|
|
455
487
|
{
|
|
456
488
|
key: "dice-set",
|
|
@@ -504,16 +536,18 @@ function PageSettings() {
|
|
|
504
536
|
pick: (value) => setByHand(value === "hand"),
|
|
505
537
|
},
|
|
506
538
|
];
|
|
507
|
-
return (_jsxs("
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
539
|
+
return (_jsxs(_Fragment, { children: [_jsx("p", { class: "settings-kept", children: t("Kept in this browser alone: the master hears nothing of them.") }), _jsx(SettingsCard, { name: "look", icon: iconPath("theme"), title: t("Look"), children: look.map((row) => _jsx(PageSetting, { row: row }, row.key)) }), _jsx(SettingsCard, { name: "tokens", icon: iconPath("party"), title: t("Tokens"), children: tokens.map((row) => _jsx(PageSetting, { row: row }, row.key)) }), _jsx(SettingsCard, { name: "dice-set", icon: iconPath("dice"), title: t("Dice and coins"), children: dice.map((row) => _jsx(PageSetting, { row: row }, row.key)) })] }));
|
|
540
|
+
}
|
|
541
|
+
/** One of the page's own settings: its name and what it is, its values, what the chosen one means and the line under it. */
|
|
542
|
+
function PageSetting({ row }) {
|
|
543
|
+
const id = `page-${row.key}`;
|
|
544
|
+
const chosen = row.options.find((option) => option.value === row.value);
|
|
545
|
+
const described = [`${id}-about`, ...(chosen?.means === undefined ? [] : [`${id}-means`]), ...(row.note === undefined ? [] : [`${id}-note`])].join(" ");
|
|
546
|
+
return (_jsxs("div", { class: row.under === true ? "setting under" : "setting", children: [_jsxs("div", { class: "setting-what", children: [_jsx("span", { class: "setting-name", id: id, children: row.name }), _jsx("span", { class: "setting-about", id: `${id}-about`, children: row.about })] }), _jsx(Segmented, { label: id, described: described, options: row.options, value: row.value, onPick: row.pick }), (chosen?.means !== undefined || row.note !== undefined) && (_jsxs("div", { class: "setting-after", children: [chosen?.means !== undefined && (_jsxs("p", { class: "setting-means", id: `${id}-means`, children: [_jsxs("strong", { children: [chosen.label, ":"] }), " ", chosen.means] })), row.note !== undefined && _jsx("p", { class: "setting-means", id: `${id}-note`, children: row.note })] }))] }));
|
|
513
547
|
}
|
|
514
548
|
/**
|
|
515
|
-
* Where the page shows the extensions' widgets (D-502), for the campaign: each in the top, the table's column, a page, or
|
|
516
|
-
* extension gives it sends it back there. None without a widget; never one on each of the party.
|
|
549
|
+
* Where the page shows the extensions' widgets (D-502), for the campaign, in a card of the campaign's tab: each in the top, the table's column, a page, or
|
|
550
|
+
* nowhere, and which page; the place its extension gives it sends it back there. None without a widget; never one on each of the party.
|
|
517
551
|
*/
|
|
518
552
|
function WidgetSettings({ onChange }) {
|
|
519
553
|
// One on each of the party stands where its package puts it: there is nowhere else for it (D-514).
|
|
@@ -521,7 +555,7 @@ function WidgetSettings({ onChange }) {
|
|
|
521
555
|
if (widgets.length === 0) {
|
|
522
556
|
return null;
|
|
523
557
|
}
|
|
524
|
-
return (
|
|
558
|
+
return (_jsx(SettingsCard, { name: "widgets", icon: iconPath("packages"), title: t("Extensions on the page"), children: widgets.map((widget) => _jsx(WidgetRow, { widget: widget, onChange: onChange }, widget.id)) }));
|
|
525
559
|
}
|
|
526
560
|
// The pages a widget's card may stand in, in the order of the sections.
|
|
527
561
|
const widgetPages = ["sheet", "scene", "journal", "world"];
|
|
@@ -582,9 +616,9 @@ function Segmented({ label, described, options, value, onPick }) {
|
|
|
582
616
|
};
|
|
583
617
|
return (_jsx("span", { class: "segmented", role: "radiogroup", "aria-labelledby": label, "aria-describedby": described, onKeyDown: move, children: options.map((option, index) => (_jsxs("button", { type: "button", role: "radio", "aria-checked": option.value === value, tabIndex: index === Math.max(at, 0) ? 0 : -1, onClick: () => option.value !== value && onPick(option.value, false), children: [option.picture, option.label] }, option.value))) }));
|
|
584
618
|
}
|
|
585
|
-
/** A
|
|
619
|
+
/** A card of the campaign's settings by its place, in the page's language. */
|
|
586
620
|
function groupTitle(index) {
|
|
587
|
-
return [t("
|
|
621
|
+
return [t("Rules and difficulty"), t("Dice and measures"), t("Learning the game"), t("The master's style"), t("Limits"), t("Your companions"), t("Pictures and language"), t("Git")][index] ?? "";
|
|
588
622
|
}
|
|
589
623
|
/** What a list's field suggests, as an example. */
|
|
590
624
|
function exampleOf(name) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// The tabs of Settings: the game, the master and the campaign, whose settings are the campaign's, then the page's own, kept in this browser; each in the
|
|
2
|
+
// address, as #/settings/master.
|
|
3
|
+
import { t } from "../text.js";
|
|
4
|
+
/** The tabs, in the order the page shows them: the first one's address is the section's own, #/settings. */
|
|
5
|
+
export const settingsTabs = ["game", "master", "campaign", "page"];
|
|
6
|
+
/** The tab an address names; the first for none, or for one Settings do not have. */
|
|
7
|
+
export function settingsTab(written) {
|
|
8
|
+
return settingsTabs.find((tab) => tab === written) ?? settingsTabs[0];
|
|
9
|
+
}
|
|
10
|
+
/** A tab's name, in the page's language. */
|
|
11
|
+
export function settingsTabLabel(tab) {
|
|
12
|
+
const labels = { game: t("Game"), master: t("Master"), campaign: t("Campaign"), page: t("This page") };
|
|
13
|
+
return labels[tab];
|
|
14
|
+
}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime";
|
|
2
|
+
// Someone's sheet (D-273, D-276, D-284): a band with their line and effects, then the system's groups as cards, those of a few short numbers in a rail beside
|
|
3
|
+
// the others in columns that stay as the player opens and closes them (D-383), and the page's text the whole width, in two columns where there is room, the
|
|
4
|
+
// player character's story in a card of its own, where the player writes their own character's story (D-373); a click on a number the system rolls throws it for fun (D-280), and its tooltip says how it is made
|
|
5
|
+
// (FOR-8). While the master asks a roll, the number its check names lights up and answers it (D-330, ASK-12). A companion who keeps no sheet shows the stat
|
|
6
|
+
// block of its creature (D-275).
|
|
7
|
+
import { Fragment } from "preact";
|
|
2
8
|
import { useContext, useEffect, useId, useRef, useState } from "preact/hooks";
|
|
3
|
-
import { itemVerbs } from "../acts/acts.js";
|
|
4
|
-
import { ActName, usePlayerActs } from "../acts/names.js";
|
|
9
|
+
import { itemVerbs, thingKey, thingVerbs } from "../acts/acts.js";
|
|
10
|
+
import { ActName, ThingVerbsContext, usePlayerActs } from "../acts/names.js";
|
|
5
11
|
import { readExplanations } from "../api.js";
|
|
6
12
|
import { WidgetCards, WidgetsContext } from "../packages/widgets.js";
|
|
7
13
|
import { CardHeader, useOpen } from "../parts/card.js";
|
|
@@ -9,7 +15,7 @@ import { ChangedLine, ChangedMark } from "../parts/changed.js";
|
|
|
9
15
|
import { besideLabel, memberPlaceLabel } from "../parts/game-words.js";
|
|
10
16
|
import { cardIcons, DieIcon, Icon } from "../parts/icons.js";
|
|
11
17
|
import { fieldLabel, groupLabels, itemLabel, phraseLabel, readableIds, rollLabel, shownNotation, shownText } from "../parts/labels.js";
|
|
12
|
-
import { arrangedGroups, groupLayout, orderedValues, widgetOf } from "../parts/layout.js";
|
|
18
|
+
import { arrangedGroups, equippedFirst, groupLayout, orderedValues, widgetOf } from "../parts/layout.js";
|
|
13
19
|
import { knowersOf, Markdown, plainLine } from "../parts/markdown.js";
|
|
14
20
|
import { MoodFace, moodLabel } from "../parts/mood.js";
|
|
15
21
|
import { PictureSpot } from "../parts/picture.js";
|
|
@@ -38,9 +44,11 @@ export function MemberSheet({ member, headline, layered, sheet, cards, text, kno
|
|
|
38
44
|
const shownApart = personFields([...person, ...boxes]);
|
|
39
45
|
// The player character's story has its own card: the rest of the page's text is its description (D-386).
|
|
40
46
|
const described = story !== undefined && story.trim() !== "" && text.startsWith(story) ? text.slice(story.length).trimStart() : text;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
// A thing has the same verbs wherever the sheet has it (D-581 (D)).
|
|
48
|
+
const verbs = thingVerbs(usePlayerActs()?.actions, sheet);
|
|
49
|
+
return (_jsx(ThingVerbsContext.Provider, { value: verbs, children: _jsxs("section", { class: "sheet", "aria-label": member.name, children: [_jsxs("header", { class: "band", children: [_jsxs("div", { class: "identity", children: [_jsx(PictureSpot, { page: member.name, has: member.image !== undefined, children: _jsx(MemberToken, { member: member, large: true, status: status }) }), _jsxs("div", { class: "who", children: [_jsx("h2", { children: member.name }), (headline !== undefined && headline !== "") || member.mood !== undefined
|
|
50
|
+
? (_jsxs("p", { class: "headline", children: [headline, headline !== undefined && headline !== "" && member.mood !== undefined && " · ", member.mood !== undefined && (_jsxs("span", { class: "mood-word", children: [_jsx(MoodFace, { mood: member.mood }), moodLabel(member.mood)] }))] }))
|
|
51
|
+
: null, member.place && (_jsxs("p", { class: "place", children: [_jsx(Icon, { name: "place" }), memberPlaceLabel(member.place)] })), layered === true && _jsx(ChangedLine, {})] })] }), choices.map((set) => _jsx(ChoicesNotice, { set: set }, set.id)), person.map((shown) => _jsx(PersonPanel, { shown: shown }, shown.widget.id)), _jsx(ValueLine, { values: member.counters.filter((value) => !shownApart.has(value.field)), fields: fields, boxes: boxes }), _jsx(Effects, { effects: besideWord(member.effects, status.person) })] }), _jsxs("div", { class: "sheet-body", children: [rail.length > 0 && _jsx("div", { class: "rail", children: rail.map(group) }), _jsxs("div", { class: "sheet-main", children: [_jsx(FixedColumns, { cards: others.map((shown) => ({ key: shown.name, node: group(shown) })) }), _jsxs("div", { class: "wide-cards", children: [story !== undefined && (_jsxs(Card, { name: backstoryCard, title: t("Backstory"), icon: cardIcons.backstory, layout: "lore", preview: plainLine(story) ?? t("Not written yet"), children: [story.trim() !== "" && _jsx(Markdown, { text: story }), _jsx(StoryBox, { story: story, who: member.name })] })), described.trim() !== "" && (_jsx(Card, { name: descriptionCard, title: t("Description"), icon: cardIcons.description, layout: "lore", preview: plainLine(described), children: _jsx(Markdown, { text: described, secretKnowers: knowersOf(knownBy) }) }))] }), _jsx(WidgetCards, { place: "page", page: "sheet", who: member.name, view: member })] })] })] }) }));
|
|
44
52
|
}
|
|
45
53
|
/** What of someone's sheet the Combat section keeps at hand (D-315): the fields it names in a line of boxes, as under the name, then the groups it names as their cards. */
|
|
46
54
|
export function SheetAtHand({ member, sheet, names, version, onRoll }) {
|
|
@@ -51,7 +59,9 @@ export function SheetAtHand({ member, sheet, names, version, onRoll }) {
|
|
|
51
59
|
const counted = personFields(boxes);
|
|
52
60
|
const line = names.flatMap((wanted) => sheet.flatMap((group) => group.values).filter((value) => same(value.field, wanted) && !counted.has(value.field)));
|
|
53
61
|
const groups = names.flatMap((wanted) => sheet.filter((group) => same(group.name, wanted)));
|
|
54
|
-
|
|
62
|
+
// The verbs of the whole sheet, not only of the groups at hand (D-581 (D)).
|
|
63
|
+
const verbs = thingVerbs(usePlayerActs()?.actions, sheet);
|
|
64
|
+
return (_jsxs(ThingVerbsContext.Provider, { value: verbs, children: [(line.length > 0 || boxes.length > 0) && _jsx(ValueLine, { values: line, fields: fields, boxes: boxes }), groups.map((group) => _jsx(Group, { member: member.name, group: group, fields: fields, version: version, onRoll: onRoll }, group.name))] }));
|
|
55
65
|
}
|
|
56
66
|
/** What a row shows beside its value, when it says something more: a written speed equal to the one that counts now says nothing. */
|
|
57
67
|
function shownBeside(value) {
|
|
@@ -208,8 +218,11 @@ function systemText(word) {
|
|
|
208
218
|
*/
|
|
209
219
|
function ItemsTable({ group, fields }) {
|
|
210
220
|
const acts = usePlayerActs();
|
|
221
|
+
const verbsOf = useContext(ThingVerbsContext);
|
|
211
222
|
const [closed, setClosed] = useState(new Set());
|
|
212
|
-
|
|
223
|
+
// What is equipped first, under its own heading, then a rule and the rest (D-581 (6)).
|
|
224
|
+
const { equipped, rest } = equippedFirst(group.items ?? []);
|
|
225
|
+
const items = [...equipped, ...rest];
|
|
213
226
|
const columns = items[0]?.values.map((value) => value.field) ?? [];
|
|
214
227
|
const labels = groupLabels(columns, fields);
|
|
215
228
|
const depths = items.map((item) => item.depth ?? 0);
|
|
@@ -226,31 +239,39 @@ function ItemsTable({ group, fields }) {
|
|
|
226
239
|
// What is carried tells how many after its name, as Torce (6), with no column of its own (Stefano, 15 October).
|
|
227
240
|
const carried = columns.length === 1 && columns[0] === "quantity";
|
|
228
241
|
const count = (item) => (carried ? item.values[0]?.text ?? "" : "");
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
item.
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
242
|
+
const span = carried ? 1 : columns.length + 1;
|
|
243
|
+
// The verbs of a thing, the same wherever the sheet has it (D-581 (D)).
|
|
244
|
+
const verbsFor = (item) => verbsOf?.get(thingKey(item.item)) ?? itemVerbs(acts?.actions, item) ?? [];
|
|
245
|
+
return (_jsxs("table", { class: ["items", marked ? "marked" : "", carried ? "carried" : ""].filter((name) => name !== "").join(" "), children: [_jsx("thead", { class: carried ? "visually-hidden" : undefined, children: _jsxs("tr", { children: [_jsx("th", { scope: "col", children: _jsx("span", { class: "visually-hidden", children: t("Name") }) }), !carried && columns.map((field) => _jsx("th", { scope: "col", children: phraseLabel(labels.get(field) ?? fieldLabel(field, fields)) }, field))] }) }), _jsxs("tbody", { children: [equipped.length > 0 && (_jsx("tr", { class: "items-head", children: _jsx("th", { scope: "colgroup", colSpan: span, class: "eyebrow", children: t("Equipped") }) })), items.map((item, index) => {
|
|
246
|
+
if (!shown[index]) {
|
|
247
|
+
return null;
|
|
248
|
+
}
|
|
249
|
+
const name = itemName(item.item);
|
|
250
|
+
const bonds = (item.bonds ?? []).map((list) => fieldLabel(list, fields));
|
|
251
|
+
const parts = [
|
|
252
|
+
item.inside === undefined ? undefined : t("in {container}", { container: itemName(item.inside) }),
|
|
253
|
+
item.equipped === true ? t("Equipped") : undefined,
|
|
254
|
+
...bonds,
|
|
255
|
+
].filter((part) => part !== undefined);
|
|
256
|
+
const said = parts.map((part) => `, ${part}`).join("");
|
|
257
|
+
// What the thing's card says under its name: how many, where it is, whether equipped.
|
|
258
|
+
const facts = [...(count(item) === "" ? [] : [`×${count(item)}`]), ...parts];
|
|
259
|
+
const words = (_jsxs(_Fragment, { children: [marked && _jsx(ItemPicture, { image: item.image, equipped: item.equipped === true }), _jsx("span", { children: name }), count(item) !== "" && _jsx("span", { class: "item-count", children: ` (${count(item)})` }), bonds.length > 0 && (_jsx("span", { class: "item-bond", "data-tip": bonds.join(", "), "aria-hidden": "true", children: _jsx(Icon, { name: "bond" }) })), said !== "" && _jsx("span", { class: "visually-hidden", children: said })] }));
|
|
260
|
+
// The campaign changed its page of the game system (D-564): an asterisk after its name, outside what acts.
|
|
261
|
+
const changed = item.layered === true && _jsx(ChangedMark, {});
|
|
262
|
+
// The name opens the thing's card, with its verbs when the system names some; a container's opens and closes what it holds, and its info
|
|
263
|
+
// icon opens its card (D-495, D-581).
|
|
264
|
+
const about = t("About {item}", { item: name });
|
|
265
|
+
const line = (_jsxs("tr", { class: item.depth === undefined ? undefined : "inside", children: [_jsxs("th", { scope: "row", class: holds(index) ? "holds" : undefined, style: item.depth === undefined ? undefined : { "--depth": item.depth }, children: [holds(index)
|
|
266
|
+
? (_jsxs(_Fragment, { children: [_jsxs("button", { type: "button", class: "fold", "aria-expanded": !closed.has(key(index)), onClick: () => toggle(index), children: [_jsx(Icon, { name: "fold" }), words] }), acts !== undefined && (_jsx("button", { type: "button", class: "icon-button item-info", "aria-label": about, "data-tip": about, onClick: (event) => acts.start({ verbs: verbsFor(item), item: name, page: item.item, facts }, event.currentTarget), children: _jsx(Icon, { name: "info" }) }))] }))
|
|
267
|
+
: acts === undefined
|
|
268
|
+
? words
|
|
269
|
+
: (_jsx(ActName, { verbs: verbsFor(item), item: name, page: item.item, facts: facts, ...(item.document === true ? { document: true } : {}), said: `${count(item) === "" ? "" : ` (${count(item)})`}${said}`, children: words })), changed] }), !carried && item.values.map((value) => _jsx("td", { class: widgetOf(value) === "text" ? undefined : "num", children: shownText(value.text, value.kind) }, value.field))] }, key(index)));
|
|
270
|
+
// A rule between what is equipped and the rest, when both have lines.
|
|
271
|
+
return index === equipped.length && index > 0
|
|
272
|
+
? (_jsxs(Fragment, { children: [_jsx("tr", { class: "items-rule", "aria-hidden": "true", children: _jsx("td", { colSpan: span }) }), line] }, key(index)))
|
|
273
|
+
: line;
|
|
274
|
+
})] })] }));
|
|
254
275
|
}
|
|
255
276
|
/** A thing's picture, one colour as the words beside it, gold when equipped: the game's drawing of its kind as a mask, or the page's own of any thing. */
|
|
256
277
|
function ItemPicture({ image, equipped }) {
|
|
@@ -43,9 +43,9 @@ export function gameNotices(problems, textsTranslating) {
|
|
|
43
43
|
text: problems === 1 ? t("The campaign has a problem in its files: the master sees it and fixes it.") : t("The campaign has {count} problems in its files: the master sees them and fixes them.", { count: problems }),
|
|
44
44
|
}]),
|
|
45
45
|
...(translation?.state === "translating" ? [{ kind: "info", text: t("This computer is translating the page into {language}: until then it stays in English.", { language }) }] : []),
|
|
46
|
-
...(translation?.state === "unable" ? [{ kind: "info", text: t("The page stays in English:
|
|
46
|
+
...(translation?.state === "unable" ? [{ kind: "info", text: t("The page stays in English: your AI app would translate it into {language} on this computer, but none can now.", { language }) }] : []),
|
|
47
47
|
...(textsTranslating !== undefined
|
|
48
|
-
? [{ kind: "info", text: t("With your account,
|
|
48
|
+
? [{ kind: "info", text: t("With your account, your AI app is translating the game's rules into {language}: until then they stay in English.", { language: textsLanguage }) }]
|
|
49
49
|
: []),
|
|
50
50
|
];
|
|
51
51
|
}
|