rpg-engine 0.13.0 → 0.14.1
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 +2 -0
- package/dist/campaign/choices.d.ts +30 -0
- package/dist/campaign/choices.js +84 -0
- package/dist/campaign/index.d.ts +4 -1
- package/dist/campaign/index.js +4 -1
- package/dist/campaign/last-choices.d.ts +6 -0
- package/dist/campaign/last-choices.js +34 -0
- package/dist/campaign/levels.d.ts +50 -0
- package/dist/campaign/levels.js +189 -0
- package/dist/campaign/settings.d.ts +35 -13
- package/dist/campaign/settings.js +20 -51
- package/dist/commands/ask.d.ts +8 -0
- package/dist/commands/ask.js +2 -1
- package/dist/commands/change/change.js +6 -4
- package/dist/commands/choices.d.ts +64 -0
- package/dist/commands/choices.js +216 -0
- package/dist/commands/config.d.ts +8 -1
- package/dist/commands/config.js +165 -21
- package/dist/commands/index.js +2 -0
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.js +8 -4
- package/dist/commands/rename.js +8 -3
- package/dist/commands/save.d.ts +1 -1
- package/dist/commands/shared/experience.d.ts +9 -2
- package/dist/commands/shared/experience.js +42 -7
- package/dist/commands/shared/knowledge.d.ts +2 -0
- package/dist/commands/shared/knowledge.js +5 -0
- package/dist/commands/shared/mode.js +10 -3
- package/dist/commands/shared/offers.d.ts +3 -1
- package/dist/commands/shared/offers.js +6 -1
- package/dist/commands/shared/rules.js +5 -1
- package/dist/commands/shared/time.d.ts +6 -0
- package/dist/commands/shared/time.js +35 -3
- package/dist/commands/shared/upkeep.js +3 -3
- package/dist/commands/shared/world.js +7 -4
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.js +15 -7
- package/dist/commands/view/view.js +10 -7
- package/dist/commands/write/write.js +5 -2
- package/dist/dashboard/address.js +8 -1
- package/dist/dashboard/api.js +20 -0
- package/dist/dashboard/app.js +18 -6
- package/dist/dashboard/choices.js +343 -0
- package/dist/dashboard/guide/ar.md +12 -10
- package/dist/dashboard/guide/cs.md +12 -10
- package/dist/dashboard/guide/da.md +13 -11
- package/dist/dashboard/guide/de.md +12 -10
- package/dist/dashboard/guide/el.md +14 -12
- package/dist/dashboard/guide/en.md +11 -9
- package/dist/dashboard/guide/es.md +12 -10
- package/dist/dashboard/guide/fi.md +12 -10
- package/dist/dashboard/guide/fr.md +12 -10
- package/dist/dashboard/guide/he.md +12 -10
- package/dist/dashboard/guide/hi.md +12 -10
- package/dist/dashboard/guide/hu.md +12 -10
- package/dist/dashboard/guide/is.md +13 -11
- package/dist/dashboard/guide/it.md +12 -10
- package/dist/dashboard/guide/ja.md +12 -10
- package/dist/dashboard/guide/ko.md +14 -12
- package/dist/dashboard/guide/nb.md +13 -11
- package/dist/dashboard/guide/nl.md +12 -10
- package/dist/dashboard/guide/pl.md +12 -10
- package/dist/dashboard/guide/pt.md +12 -10
- package/dist/dashboard/guide/ro.md +12 -10
- package/dist/dashboard/guide/ru.md +12 -10
- package/dist/dashboard/guide/sv.md +12 -10
- package/dist/dashboard/guide/tr.md +12 -10
- package/dist/dashboard/guide/uk.md +13 -11
- package/dist/dashboard/guide/zh.md +12 -10
- package/dist/dashboard/i18n/ar.json +80 -0
- package/dist/dashboard/i18n/cs.json +80 -0
- package/dist/dashboard/i18n/da.json +80 -0
- package/dist/dashboard/i18n/de.json +80 -0
- package/dist/dashboard/i18n/el.json +80 -0
- package/dist/dashboard/i18n/es.json +80 -0
- package/dist/dashboard/i18n/fi.json +80 -0
- package/dist/dashboard/i18n/fr.json +80 -0
- package/dist/dashboard/i18n/he.json +80 -0
- package/dist/dashboard/i18n/hi.json +80 -0
- package/dist/dashboard/i18n/hu.json +80 -0
- package/dist/dashboard/i18n/is.json +80 -0
- package/dist/dashboard/i18n/it.json +80 -0
- package/dist/dashboard/i18n/ja.json +80 -0
- package/dist/dashboard/i18n/ko.json +80 -0
- package/dist/dashboard/i18n/nb.json +80 -0
- package/dist/dashboard/i18n/nl.json +80 -0
- package/dist/dashboard/i18n/pl.json +80 -0
- package/dist/dashboard/i18n/pt.json +80 -0
- package/dist/dashboard/i18n/ro.json +80 -0
- package/dist/dashboard/i18n/ru.json +80 -0
- package/dist/dashboard/i18n/sv.json +80 -0
- package/dist/dashboard/i18n/tr.json +80 -0
- package/dist/dashboard/i18n/uk.json +80 -0
- package/dist/dashboard/i18n/zh.json +80 -0
- package/dist/dashboard/icons.js +4 -0
- package/dist/dashboard/labels.js +32 -0
- package/dist/dashboard/party.js +13 -5
- package/dist/dashboard/settings.js +89 -40
- package/dist/dashboard/setup.js +1 -1
- package/dist/dashboard/sheet.js +3 -2
- package/dist/dashboard/style.css +744 -6
- package/dist/dashboard/top.js +8 -4
- package/dist/server/dashboard/choices.d.ts +41 -0
- package/dist/server/dashboard/choices.js +176 -0
- package/dist/server/dashboard/index.js +17 -1
- package/dist/time/game-date.d.ts +9 -0
- package/dist/time/game-date.js +9 -0
- package/dist/time/index.d.ts +1 -1
- package/dist/time/index.js +1 -1
- package/instructions/dashboard-guide.md +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ 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 { CoinFace } from "./faces.js";
|
|
7
7
|
import { DieSwatch, Icon } from "./icons.js";
|
|
8
|
-
import { phraseLabel, settingLabel, valueLabel } from "./labels.js";
|
|
8
|
+
import { customLabel, itemLabel, leveledItemLabel, phraseLabel, rateParts, settingLabel, valueLabel } from "./labels.js";
|
|
9
9
|
import { LanguageChoice, languageLine } from "./language-choice.js";
|
|
10
10
|
import { WidgetsContext } from "./packages/widgets.js";
|
|
11
11
|
import { PageHead } from "./pages.js";
|
|
@@ -17,7 +17,7 @@ import { pickTheme, shownTheme } from "./theme.js";
|
|
|
17
17
|
// The groups of the campaign's settings, in order; a setting the game system adds goes with the dice, as whether the master's rolls are shown (D-287). How the
|
|
18
18
|
// master plays holds who voices the characters (D-490) and how much the master thinks (D-462) too.
|
|
19
19
|
const groups = [
|
|
20
|
-
{ names: ["ruleset", "difficulty", "lethality", "saves", "rigor"] },
|
|
20
|
+
{ names: ["ruleset", "difficulty", "lethality", "saves", "rigor", "between-sessions"] },
|
|
21
21
|
{ names: ["mentor", "learned"] },
|
|
22
22
|
{ names: ["prose", "story", "author", "style", "voices", "effort"] },
|
|
23
23
|
{ names: ["dice", "master-rolls", "units"], system: true },
|
|
@@ -52,13 +52,13 @@ export function SettingsView({ version, several = false }) {
|
|
|
52
52
|
read();
|
|
53
53
|
return said;
|
|
54
54
|
};
|
|
55
|
-
const known = new Set(groups.flatMap((group) => group.names));
|
|
55
|
+
const known = new Set([...groups.flatMap((group) => group.names), ...Object.values(customParts)]);
|
|
56
56
|
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) => {
|
|
57
57
|
const shown = [
|
|
58
58
|
...group.names.flatMap((name) => settings.filter((setting) => setting.name === name)),
|
|
59
59
|
...(group.system ? settings.filter((setting) => !known.has(setting.name)) : []),
|
|
60
60
|
];
|
|
61
|
-
return (_jsxs("section", { class: "settings-group", children: [_jsx("h3", { children: groupTitle(index) }), shown.map((setting) => _jsx(SettingRow, { setting: setting, off: offBy(setting, settings), several: several, onChange: change }, setting.name))] }, group.names[0]));
|
|
61
|
+
return (_jsxs("section", { class: "settings-group", children: [_jsx("h3", { children: groupTitle(index) }), 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.names[0]));
|
|
62
62
|
}), _jsx(WidgetSettings, { onChange: change }), _jsx(PageSettings, {})] }));
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
@@ -77,28 +77,16 @@ function offBy(setting, settings) {
|
|
|
77
77
|
* 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
|
|
78
78
|
* value means; why it counts for nothing now, its values still to choose.
|
|
79
79
|
*/
|
|
80
|
-
function SettingRow({ setting, off, several = false, onChange }) {
|
|
81
|
-
// The value just picked shows at once, until the setting is read again.
|
|
82
|
-
const [picked, setPicked] = useState();
|
|
83
|
-
const resting = useRef(undefined);
|
|
80
|
+
function SettingRow({ setting, off, several = false, parts, onChange }) {
|
|
84
81
|
const said = useSaid();
|
|
85
|
-
const value = picked ?? setting.value;
|
|
86
82
|
const id = `setting-${idOf(setting.name)}`;
|
|
87
83
|
// The version of the rules changes the game's rules: it asks first (D-514 (2)).
|
|
88
84
|
const [asking, setAsking] = useState();
|
|
89
85
|
const rules = setting.name === rulesetSetting;
|
|
90
|
-
useEffect(() => setPicked(undefined), [setting]);
|
|
91
|
-
// A choice the arrows left still resting goes when the section closes.
|
|
92
|
-
useEffect(() => () => {
|
|
93
|
-
if (resting.current !== undefined) {
|
|
94
|
-
clearTimeout(resting.current.timer);
|
|
95
|
-
// Never the rules without the player's yes.
|
|
96
|
-
if (!rules) {
|
|
97
|
-
void onChange({ setting: setting.name, value: resting.current.choice });
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}, []);
|
|
101
86
|
const row = useRef(null);
|
|
87
|
+
// A choice the arrows left still resting goes when the section closes; never the rules without the player's yes.
|
|
88
|
+
const { picked, setPicked, choose } = usePicked(setting, (choice) => send({ setting: setting.name, value: choice }), rules ? undefined : (choice) => void onChange({ setting: setting.name, value: choice }));
|
|
89
|
+
const value = picked ?? setting.value;
|
|
102
90
|
// The focus on the value chosen, once the dialog that asked is gone.
|
|
103
91
|
const focusChosen = () => {
|
|
104
92
|
requestAnimationFrame(() => row.current?.querySelector("[role=radio][aria-checked=true]")?.focus());
|
|
@@ -122,31 +110,28 @@ function SettingRow({ setting, off, several = false, onChange }) {
|
|
|
122
110
|
setPicked(undefined);
|
|
123
111
|
focusChosen();
|
|
124
112
|
};
|
|
125
|
-
// A
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
if (
|
|
131
|
-
|
|
132
|
-
return;
|
|
113
|
+
// A value written in the chat or by hand that the page does not offer, as a rate of its own: beside the others, chosen, and still there once another is.
|
|
114
|
+
const unoffered = setting.value !== undefined && setting.choices?.some((choice) => choice.value === setting.value) === false ? setting.value : undefined;
|
|
115
|
+
const [kept, setKept] = useState(unoffered);
|
|
116
|
+
const written = unoffered ?? kept;
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
if (unoffered !== undefined) {
|
|
119
|
+
setKept(unoffered);
|
|
133
120
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
return (_jsxs("div", { ref: row, class: off === undefined ? "setting" : "setting off", children: [_jsxs("div", { class: "setting-what", children: [_jsx("span", { class: "setting-name", id: id, children: settingLabel(setting.name) }), _jsx("span", { class: "setting-about", id: `${id}-about`, children: t(setting.about) })] }), setting.choices !== undefined
|
|
144
|
-
? (_jsx(Segmented, { label: id, described: described, options: setting.choices.map((choice) => ({ value: choice.value, label: choiceLabel(setting.name, choice) })), value: value, onPick: choose }))
|
|
121
|
+
}, [unoffered]);
|
|
122
|
+
const choices = setting.choices === undefined ? undefined : [...setting.choices, ...(written === undefined ? [] : [{ value: written }])];
|
|
123
|
+
const label = (choice) => (choice.value === written ? writtenLabel(setting.name, choice.value) : choiceLabel(setting.name, choice));
|
|
124
|
+
const chosen = choices?.find((choice) => choice.value === value);
|
|
125
|
+
const means = chosen === undefined ? undefined : chosen.value === written ? writtenMeans(setting.name, chosen.value) : chosen.means === undefined ? undefined : meansText(setting.name, chosen.value, chosen.means, several);
|
|
126
|
+
const unset = setting.most === undefined && (choices === undefined ? setting.items === undefined && setting.value === undefined : chosen === undefined);
|
|
127
|
+
const described = [`${id}-about`, ...(means === undefined || rules ? [] : [`${id}-means`]), ...(off === undefined ? [] : [`${id}-off`])].join(" ");
|
|
128
|
+
return (_jsxs("div", { ref: row, class: off === undefined ? "setting" : "setting off", children: [_jsxs("div", { class: "setting-what", children: [_jsx("span", { class: "setting-name", id: id, children: settingLabel(setting.name) }), _jsx("span", { class: "setting-about", id: `${id}-about`, children: t(setting.about) })] }), choices !== undefined
|
|
129
|
+
? (_jsx(Segmented, { label: id, described: described, options: choices.map((choice) => ({ value: choice.value, label: label(choice) })), value: value, onPick: choose }))
|
|
145
130
|
: setting.name === "language"
|
|
146
131
|
? _jsx(LanguageChoice, { value: value, labelledBy: id, describedBy: `${id}-about`, onPick: (code) => choose(code, false) })
|
|
147
132
|
: setting.most !== undefined
|
|
148
133
|
? _jsx(TextSetting, { setting: setting, label: id, onChange: send })
|
|
149
|
-
: _jsx(ListSetting, { setting: setting, label: id, onChange: send }), _jsxs("div", { class: "setting-after", children: [off !== undefined && _jsx("p", { class: "setting-off", id: `${id}-off`, children: off }), chosen
|
|
134
|
+
: _jsx(ListSetting, { setting: setting, label: id, onChange: send }), _jsxs("div", { class: "setting-after", children: [off !== undefined && _jsx("p", { class: "setting-off", id: `${id}-off`, children: off }), chosen !== undefined && means !== undefined && !rules && (_jsxs("p", { class: "setting-means", id: `${id}-means`, children: [_jsxs("strong", { children: [label(chosen), ":"] }), " ", means] })), setting.name === "language" && value !== undefined && _jsx("p", { class: "setting-means", children: languageLine(value) }), unset && _jsx("p", { class: "setting-unset", children: choices === undefined ? t("Not answered yet: add them here, or the master asks you.") : t("Not chosen yet: choose here, or the master asks you.") }), setting.note !== undefined && _jsx(SettingNote, { note: setting.note }), _jsx("p", { class: said.now?.problem ? "setting-said problem" : "setting-said", role: "status", children: said.now?.text })] }), value === customValue && parts?.entries !== undefined && _jsx(LeveledParts, { setting: parts, labelledBy: id, onChange: onChange }), asking !== undefined && (_jsxs(Confirm, { title: t("Play by {rules}?", { rules: choiceLabel(setting.name, setting.choices?.find((choice) => choice.value === asking) ?? { value: asking }, false) }), onClose: keep, children: [_jsx("p", { children: t("The game follows these rules from the master's next move: the sheets are worked out with them, and the master reads them.") }), _jsx("p", { class: "confirm-note", children: t("What is already in play stays as it is, and you can go back whenever you want.") }), _jsxs("div", { class: "confirm-buttons", children: [_jsx("button", { type: "button", class: "button", autoFocus: true, onClick: keep, children: t("Cancel") }), _jsx("button", { type: "button", class: "button gold", onClick: () => {
|
|
150
135
|
setAsking(undefined);
|
|
151
136
|
focusChosen();
|
|
152
137
|
void onChange({ setting: setting.name, value: asking }).then(said.show);
|
|
@@ -159,12 +144,76 @@ const rulesetSetting = "ruleset";
|
|
|
159
144
|
* `capital` false keeps it as written, for inside a sentence.
|
|
160
145
|
*/
|
|
161
146
|
function choiceLabel(setting, choice, capital = true) {
|
|
147
|
+
if (choice.value === customValue && customParts[setting] !== undefined) {
|
|
148
|
+
return customLabel(setting);
|
|
149
|
+
}
|
|
162
150
|
if (setting !== rulesetSetting || choice.means === undefined) {
|
|
163
151
|
return valueLabel(choice.value);
|
|
164
152
|
}
|
|
165
153
|
const means = t(choice.means);
|
|
166
154
|
return capital ? phraseLabel(means) : means;
|
|
167
155
|
}
|
|
156
|
+
/** A value the page does not offer, on its button: a rate of the time between sessions in words, 2 hours every 1 day (D-133); any other as written. */
|
|
157
|
+
function writtenLabel(setting, value) {
|
|
158
|
+
const rate = setting === "between-sessions" ? rateParts(value) : undefined;
|
|
159
|
+
return rate === undefined ? valueLabel(value) : t("{game} every {real}", rate);
|
|
160
|
+
}
|
|
161
|
+
/** What a value the page does not offer means: a rate of the time between sessions as the others say it, or that it reads as none (D-133); undefined for another setting's. */
|
|
162
|
+
function writtenMeans(setting, value) {
|
|
163
|
+
if (setting !== "between-sessions") {
|
|
164
|
+
return undefined;
|
|
165
|
+
}
|
|
166
|
+
const rate = rateParts(value);
|
|
167
|
+
return rate === undefined
|
|
168
|
+
? t("written in the campaign, but it reads as no time: the story's time stops until you choose one here")
|
|
169
|
+
: t("{game} of the story for every {real} you are away: when you come back, at your first move the master lets it pass and tells what the world did meanwhile", rate);
|
|
170
|
+
}
|
|
171
|
+
// The value of difficulty and rigor whose parts each have a level of their own, and the setting that holds them, which shows under its row, never as one (T-132).
|
|
172
|
+
const customValue = "custom";
|
|
173
|
+
const customParts = { difficulty: "custom-difficulty", rigor: "custom-rigor" };
|
|
174
|
+
/**
|
|
175
|
+
* A value chosen at once by a click, by the arrows once they rest on it, so that the game is changed once; the one picked shows until the setting is read
|
|
176
|
+
* again (`read`), and one the arrows left resting goes with `leave` when the row does.
|
|
177
|
+
*/
|
|
178
|
+
function usePicked(read, send, leave) {
|
|
179
|
+
const [picked, setPicked] = useState();
|
|
180
|
+
const resting = useRef(undefined);
|
|
181
|
+
useEffect(() => setPicked(undefined), [read]);
|
|
182
|
+
useEffect(() => () => {
|
|
183
|
+
if (resting.current !== undefined) {
|
|
184
|
+
clearTimeout(resting.current.timer);
|
|
185
|
+
leave?.(resting.current.choice);
|
|
186
|
+
}
|
|
187
|
+
}, []);
|
|
188
|
+
const choose = (choice, byKey) => {
|
|
189
|
+
setPicked(choice);
|
|
190
|
+
clearTimeout(resting.current?.timer);
|
|
191
|
+
resting.current = undefined;
|
|
192
|
+
if (!byKey) {
|
|
193
|
+
send(choice);
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
const timer = setTimeout(() => {
|
|
197
|
+
resting.current = undefined;
|
|
198
|
+
send(choice);
|
|
199
|
+
}, 700);
|
|
200
|
+
resting.current = { choice, timer };
|
|
201
|
+
};
|
|
202
|
+
return { picked, setPicked, choose };
|
|
203
|
+
}
|
|
204
|
+
/** The parts of a custom difficulty or rigor under its row, each with its name, what it is and its levels, as the setting's own values (T-132). */
|
|
205
|
+
function LeveledParts({ setting, labelledBy, onChange }) {
|
|
206
|
+
const id = `setting-${idOf(setting.name)}`;
|
|
207
|
+
return (_jsxs("div", { class: "setting-parts", role: "group", "aria-labelledby": `${labelledBy} ${id}`, children: [_jsx("span", { hidden: true, id: id, children: t("part by part") }), (setting.entries ?? []).map((entry) => _jsx(LeveledPart, { setting: setting, part: entry, onChange: onChange }, entry.name))] }));
|
|
208
|
+
}
|
|
209
|
+
function LeveledPart({ setting, part, onChange }) {
|
|
210
|
+
const said = useSaid();
|
|
211
|
+
const id = `setting-${idOf(setting.name)}-${idOf(part.name)}`;
|
|
212
|
+
const label = leveledItemLabel(part.name);
|
|
213
|
+
const send = (level) => onChange({ setting: setting.name, value: `${part.name}: ${level}` });
|
|
214
|
+
const { picked, choose } = usePicked(setting, (level) => void send(level).then(said.show), (level) => void send(level));
|
|
215
|
+
return (_jsxs("div", { class: "setting-part", children: [_jsxs("div", { class: "setting-what", children: [_jsx("span", { class: "setting-name", id: id, children: label?.name ?? itemLabel(part.name) }), _jsx("span", { class: "setting-about", id: `${id}-about`, children: label?.about })] }), _jsx(Segmented, { label: id, described: `${id}-about`, options: (setting.choices ?? []).map((choice) => ({ value: choice.value, label: valueLabel(choice.value) })), value: picked ?? part.value, onPick: choose }), _jsx("p", { class: said.now?.problem ? "setting-said problem" : "setting-said", role: "status", children: said.now?.text })] }));
|
|
216
|
+
}
|
|
168
217
|
/** What a change said, in its row: saved for a few seconds, what went wrong until the next change. */
|
|
169
218
|
function useSaid() {
|
|
170
219
|
const [now, setNow] = useState();
|
package/dist/dashboard/setup.js
CHANGED
|
@@ -113,7 +113,7 @@ function Choices({ question, value, labelledBy, onPick }) {
|
|
|
113
113
|
onPick(choices[next].value, true);
|
|
114
114
|
buttons[next]?.focus();
|
|
115
115
|
};
|
|
116
|
-
return (_jsx("div", { class: "setup-choices", role: "radiogroup", "aria-labelledby": labelledBy, onKeyDown: move, children: choices.map((choice, index) => (_jsxs("button", { type: "button", role: "radio", "aria-checked": value === choice.value, tabIndex: index === stop ? 0 : -1, class: "setup-choice", onClick: () => onPick(choice.value, false), children: [_jsxs("strong", { children: [choice.label === undefined ? valueLabel(choice.value) : phraseLabel(t(choice.label)), choice.value === question.suggested && _jsx("span", { class: "setup-suggested", children: t("Suggested") })] }), choice.means !== undefined && _jsx("span", { children: phraseLabel(t(choice.means)) })] }, choice.value))) }));
|
|
116
|
+
return (_jsx("div", { class: "setup-choices", role: "radiogroup", "aria-labelledby": labelledBy, onKeyDown: move, children: choices.map((choice, index) => (_jsxs("button", { type: "button", role: "radio", "aria-checked": value === choice.value, tabIndex: index === stop ? 0 : -1, class: "setup-choice", onClick: () => onPick(choice.value, false), children: [_jsxs("strong", { children: [choice.label === undefined ? valueLabel(choice.value) : phraseLabel(t(choice.label)), choice.value === question.suggested && _jsx("span", { class: "setup-suggested", children: choice.value === question.last ? t("Like last time") : t("Suggested") })] }), choice.means !== undefined && _jsx("span", { children: phraseLabel(t(choice.means)) })] }, choice.value))) }));
|
|
117
117
|
}
|
|
118
118
|
/** A list of the setup, lines or veils: its items to take off, a field to add one, and None for a player who wants none. */
|
|
119
119
|
function ListQuestion({ question, onProblem }) {
|
package/dist/dashboard/sheet.js
CHANGED
|
@@ -4,6 +4,7 @@ import { itemVerbs } from "./acts/acts.js";
|
|
|
4
4
|
import { ActName, usePlayerActs } from "./acts/names.js";
|
|
5
5
|
import { readExplanations } from "./api.js";
|
|
6
6
|
import { CardHeader, useOpen } from "./card.js";
|
|
7
|
+
import { ChoicesNotice } from "./choices.js";
|
|
7
8
|
import { FixedColumns } from "./columns.js";
|
|
8
9
|
import { besideLabel, memberPlaceLabel } from "./game-words.js";
|
|
9
10
|
import { cardIcons, DieIcon, Icon } from "./icons.js";
|
|
@@ -22,7 +23,7 @@ import { Effects, ProgressBar, ValueDrawing } from "./widgets.js";
|
|
|
22
23
|
// The cards of the page's text, after the system's groups, the whole width: the player character's story in the player's words, then the rest of the text.
|
|
23
24
|
const descriptionCard = "Description";
|
|
24
25
|
const backstoryCard = "Backstory";
|
|
25
|
-
export function MemberSheet({ member, headline, sheet, cards, text, knownBy, story, version, onRoll, scene }) {
|
|
26
|
+
export function MemberSheet({ member, headline, sheet, cards, text, knownBy, story, version, onRoll, scene, choices = [] }) {
|
|
26
27
|
const { rail, others } = arrangedGroups(sheet, cards);
|
|
27
28
|
const fields = sheetFields(member, sheet);
|
|
28
29
|
const group = (shown) => _jsx(Group, { member: member.name, group: shown, fields: fields, version: version, onRoll: onRoll, first: shown === others[0] }, shown.name);
|
|
@@ -37,7 +38,7 @@ export function MemberSheet({ member, headline, sheet, cards, text, knownBy, sto
|
|
|
37
38
|
const described = story !== undefined && story.trim() !== "" && text.startsWith(story) ? text.slice(story.length).trimStart() : text;
|
|
38
39
|
return (_jsxs("section", { class: "sheet", "aria-label": member.name, children: [_jsxs("header", { class: "band", children: [_jsxs("div", { class: "identity", 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
|
|
39
40
|
? (_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)] }))] }))
|
|
40
|
-
: null, member.place && (_jsxs("p", { class: "place", children: [_jsx(Icon, { name: "place" }), memberPlaceLabel(member.place)] }))] })] }), 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 })] })] })] }));
|
|
41
|
+
: null, member.place && (_jsxs("p", { class: "place", children: [_jsx(Icon, { name: "place" }), memberPlaceLabel(member.place)] }))] })] }), 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 })] })] })] }));
|
|
41
42
|
}
|
|
42
43
|
/** 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. */
|
|
43
44
|
export function SheetAtHand({ member, sheet, names, version, onRoll }) {
|