rpg-engine 0.4.1 → 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/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-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/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 +9 -0
- 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 +9 -0
- 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 +9 -0
- package/dist/dashboard/i18n/hi.json +9 -0
- 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 +9 -0
- package/dist/dashboard/i18n/ko.json +9 -0
- 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 +9 -0
- 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/style.css +521 -3
- 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
package/dist/dashboard/app.js
CHANGED
|
@@ -8,7 +8,8 @@ import { ActSheet } from "./act-sheet.js";
|
|
|
8
8
|
import { ActStrip } from "./act-strip.js";
|
|
9
9
|
import { saidStates } from "./acts.js";
|
|
10
10
|
import { readAddress, sectionAddress } from "./address.js";
|
|
11
|
-
import { answer, readActs, readAsked, readView, readWidgets, sayAct, sendSeen, withdrawAct } from "./api.js";
|
|
11
|
+
import { answer, closeCard, readActs, readAsked, readView, readWidgets, sayAct, sendSeen, withdrawAct } from "./api.js";
|
|
12
|
+
import { AskCard } from "./ask-card.js";
|
|
12
13
|
import { AskedBanner } from "./asked.js";
|
|
13
14
|
import { useMedia } from "./card.js";
|
|
14
15
|
import { DeathSaveCard } from "./death-save.js";
|
|
@@ -19,7 +20,9 @@ import { readFree, withFree, writeFree } from "./free-rolls.js";
|
|
|
19
20
|
import { Help } from "./help.js";
|
|
20
21
|
import { Icon } from "./icons.js";
|
|
21
22
|
import { FollowedQuests, JournalView, QuestEndings } from "./journal.js";
|
|
23
|
+
import { checkOf } from "./labels.js";
|
|
22
24
|
import { gameNotices, importNotices, Notices } from "./notices.js";
|
|
25
|
+
import { inCard, nextPackCard } from "./pack-card.js";
|
|
23
26
|
import { PackagesPage } from "./packages.js";
|
|
24
27
|
import { About } from "./pages.js";
|
|
25
28
|
import { PartyStrip } from "./party.js";
|
|
@@ -101,6 +104,9 @@ function App() {
|
|
|
101
104
|
// were when a reading of them fails, and an answer older than one shown left out.
|
|
102
105
|
const [widgets, setWidgets] = useState([]);
|
|
103
106
|
const widgetReading = useRef({ asked: 0, shown: 0 });
|
|
107
|
+
// The card of a package's question as last read, even while the dice that changed it fly; the attempts the player let go, with the question then (D-507).
|
|
108
|
+
const packNow = useRef();
|
|
109
|
+
const packsGone = useRef(new Map());
|
|
104
110
|
// Reads view again for whom the address names, or the player character the master calls, and what the master asks; an answer that comes after a newer one
|
|
105
111
|
// is left out.
|
|
106
112
|
const read = async () => {
|
|
@@ -113,8 +119,8 @@ function App() {
|
|
|
113
119
|
}
|
|
114
120
|
}, () => undefined);
|
|
115
121
|
try {
|
|
116
|
-
const [first,
|
|
117
|
-
const asked =
|
|
122
|
+
const [first, askedNow, actsNow] = await Promise.all([readView(undefined, rollsAsked.current), readAsked().catch(() => undefined), readActs().catch(() => undefined)]);
|
|
123
|
+
const asked = askedNow === undefined ? undefined : askedNow.asked ?? undefined;
|
|
118
124
|
// With more than one player character, a question for one elsewhere puts them in the foreground: the place, the map and the squares are theirs (VIEW-12).
|
|
119
125
|
const here = first.kind === "overview" && (first.place?.here ?? []).some((one) => one.name === asked?.who);
|
|
120
126
|
const focus = first.kind === "overview" && first.foreground !== undefined && asked?.who !== first.foreground && !here ? playerNamed(first.party, asked?.who)?.name : undefined;
|
|
@@ -178,9 +184,11 @@ function App() {
|
|
|
178
184
|
const shownCard = card?.roll !== undefined && card.outcome === undefined ? toldCard(card, party) : card;
|
|
179
185
|
savingNow.current = shownCard;
|
|
180
186
|
setSaving(shownCard);
|
|
181
|
-
// So does a die of a rest the player spends, whose card shows it once it lands (D-492).
|
|
187
|
+
// So does a die of a rest the player spends, whose card shows it once it lands (D-492); and a roll from a package's card, its marks (D-507).
|
|
182
188
|
const spent = asked?.spend?.rolls.some((roll) => roll.id === asking?.id) === true;
|
|
183
|
-
|
|
189
|
+
const packRolled = packNow.current?.sent !== undefined;
|
|
190
|
+
const pack = askedNow === undefined ? packNow.current : packOf(askedNow);
|
|
191
|
+
if (asking !== undefined && ((card !== undefined && card.roll === undefined) || spent || packRolled) && holding.current === undefined) {
|
|
184
192
|
holding.current = { roll: asking, timer: window.setTimeout(() => land(asking.id), longestHold) };
|
|
185
193
|
}
|
|
186
194
|
setShown((before) => withHeld(before, {
|
|
@@ -203,6 +211,7 @@ function App() {
|
|
|
203
211
|
place: overview.kind === "overview" ? overview.place : undefined,
|
|
204
212
|
openScene: overview.kind === "overview" ? overview.openScene : undefined,
|
|
205
213
|
asked,
|
|
214
|
+
pack,
|
|
206
215
|
version: before.version + 1,
|
|
207
216
|
readAt: new Date(),
|
|
208
217
|
noCharacter: overview.kind === "none",
|
|
@@ -217,6 +226,75 @@ function App() {
|
|
|
217
226
|
}
|
|
218
227
|
}
|
|
219
228
|
};
|
|
229
|
+
// The card of a package's question after a reading (D-507): an attempt asked again is no longer let go; one whose card went unanswered is.
|
|
230
|
+
const packOf = (told) => {
|
|
231
|
+
const key = told.asked?.card?.key;
|
|
232
|
+
if (key !== undefined && packsGone.current.has(key) && packsGone.current.get(key) !== told.asked?.id) {
|
|
233
|
+
packsGone.current.delete(key);
|
|
234
|
+
}
|
|
235
|
+
const next = nextPackCard(packNow.current, told, packsGone.current);
|
|
236
|
+
if (next.let !== undefined) {
|
|
237
|
+
packsGone.current.set(next.let, undefined);
|
|
238
|
+
}
|
|
239
|
+
packNow.current = next.card;
|
|
240
|
+
return next.card;
|
|
241
|
+
};
|
|
242
|
+
// The card shown, and as last read, the same: pressed, closed.
|
|
243
|
+
const setPack = (pack) => {
|
|
244
|
+
packNow.current = pack;
|
|
245
|
+
setShown((before) => ({ ...before, pack, ...(before.pending === undefined ? {} : { pending: { ...before.pending, pack } }) }));
|
|
246
|
+
};
|
|
247
|
+
// A button of a package's card (D-507): the card waits with it pressed while the answer goes; the core's change of mind takes the card away with it.
|
|
248
|
+
const answerPack = async (index) => {
|
|
249
|
+
const card = packNow.current;
|
|
250
|
+
const asked = card?.asked;
|
|
251
|
+
if (card === undefined || asked === undefined || card.ended === true || card.sent !== undefined) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
const leaves = checkOf(asked.labels[index] ?? "", asked.title) === undefined && (asked.buttons?.[index] ?? undefined) === undefined;
|
|
255
|
+
if (leaves) {
|
|
256
|
+
packsGone.current.set(card.key, asked.id);
|
|
257
|
+
}
|
|
258
|
+
setPack(leaves ? undefined : { ...card, sent: index });
|
|
259
|
+
try {
|
|
260
|
+
await answer(asked.id, index);
|
|
261
|
+
}
|
|
262
|
+
catch {
|
|
263
|
+
packsGone.current.delete(card.key);
|
|
264
|
+
setPack({ ...card, sent: undefined });
|
|
265
|
+
}
|
|
266
|
+
void read();
|
|
267
|
+
};
|
|
268
|
+
// The player's own words in place of a button (ASK-10): taken, the card goes with its question, as the master hears them.
|
|
269
|
+
const sayPack = async (text, focused) => {
|
|
270
|
+
const card = packNow.current;
|
|
271
|
+
const asked = card?.asked;
|
|
272
|
+
if (card === undefined || asked === undefined || card.ended === true || card.sent !== undefined) {
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
const taken = await answer(asked.id, text).catch(() => false);
|
|
276
|
+
if (taken) {
|
|
277
|
+
packsGone.current.set(card.key, asked.id);
|
|
278
|
+
setPack(undefined);
|
|
279
|
+
if (focused) {
|
|
280
|
+
focusAfterCard();
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
void read();
|
|
284
|
+
return taken;
|
|
285
|
+
};
|
|
286
|
+
const closePack = (focused) => {
|
|
287
|
+
const key = packNow.current?.key;
|
|
288
|
+
if (key !== undefined) {
|
|
289
|
+
packsGone.current.set(key, undefined);
|
|
290
|
+
// Closed for the server too: no reading, here or on another page, brings it back.
|
|
291
|
+
void closeCard(key);
|
|
292
|
+
}
|
|
293
|
+
setPack(undefined);
|
|
294
|
+
if (focused) {
|
|
295
|
+
focusAfterCard();
|
|
296
|
+
}
|
|
297
|
+
};
|
|
220
298
|
// The death save's dice, or a rest's die, have landed: its outcome on the card, and the sheet as the roll left it (D-461, D-492).
|
|
221
299
|
const land = (roll) => {
|
|
222
300
|
const held = holding.current;
|
|
@@ -346,7 +424,8 @@ function App() {
|
|
|
346
424
|
void read();
|
|
347
425
|
return taken;
|
|
348
426
|
};
|
|
349
|
-
|
|
427
|
+
// A package's question is answered from its card alone (D-507).
|
|
428
|
+
const requested = live ? requestedOf(answering === shown.asked?.id || inCard(shown.asked) ? undefined : shown.asked, (index) => void answerFrom(index)) : undefined;
|
|
350
429
|
// The open scene goes by turns, as a fight, and whether the turn is a player character's (D-314, D-315, D-444); whose, by name, when there are more.
|
|
351
430
|
const fight = hasTurns(shown.openScene);
|
|
352
431
|
const turnOf = fight ? playerNamed(shown.party, shown.openScene?.turn) : undefined;
|
|
@@ -456,13 +535,13 @@ function App() {
|
|
|
456
535
|
setFree([]);
|
|
457
536
|
writeFree(shown.campaign, []);
|
|
458
537
|
} }, shown.campaign));
|
|
459
|
-
return (_jsx(RequestedRoll.Provider, { value: requested, children: _jsx(WidgetsContext.Provider, { value: widgets, children: _jsx(PlayerActsContext.Provider, { value: playerActs, children: _jsxs("div", { class: live ? "page" : "page stale", children: [!inSetup && (_jsx(Top, { campaign: shown.campaign, product: productName, system: shown.system?.name, now: shown.now, calendar: shown.calendar, path: shown.place === undefined ? undefined : [...shown.place.within, shown.place.name], live: live, mood: shown.masterMood, moment: moment, asleep: !live && shown.readAt !== undefined, section: address.section, fight: fight, yourTurn: yourTurn, turnName: turnName })), inSetup && _jsx(SetupCorner, { live: live }), _jsx(Notices, { notices: notices }), live && saving !== undefined && (_jsx(DeathSaveCard, { asked: saving.asked, save: saving.save, member: dying, name: several ? dying?.name : undefined, roll: saving.roll, outcome: saving.outcome, rolling: saving.sent === true || answering === saving.asked.id || shown.asked?.id !== saving.asked.id, onRoll: () => void rollSave(), onClose: closeSave }, saving.asked.id)), live && saving === undefined && shown.asked?.spend !== undefined && (_jsx(SpendCard, { asked: shown.asked, spend: shown.asked.spend, member: shown.party.find((candidate) => candidate.name === shown.asked?.spend?.who), flying: holding.current?.roll.id, onSpend: (field) => answerSpend(shown.asked?.id, { spend: field }), onDone: async (focused) => {
|
|
538
|
+
return (_jsx(RequestedRoll.Provider, { value: requested, children: _jsx(WidgetsContext.Provider, { value: shown.pack === undefined ? widgets : widgets.filter((widget) => widget.id !== shown.pack?.widget), children: _jsx(PlayerActsContext.Provider, { value: playerActs, children: _jsxs("div", { class: live ? "page" : "page stale", children: [!inSetup && (_jsx(Top, { campaign: shown.campaign, product: productName, system: shown.system?.name, now: shown.now, calendar: shown.calendar, path: shown.place === undefined ? undefined : [...shown.place.within, shown.place.name], live: live, mood: shown.masterMood, moment: moment, asleep: !live && shown.readAt !== undefined, section: address.section, fight: fight, yourTurn: yourTurn, turnName: turnName })), inSetup && _jsx(SetupCorner, { live: live }), _jsx(Notices, { notices: notices }), live && saving !== undefined && (_jsx(DeathSaveCard, { asked: saving.asked, save: saving.save, member: dying, name: several ? dying?.name : undefined, roll: saving.roll, outcome: saving.outcome, rolling: saving.sent === true || answering === saving.asked.id || shown.asked?.id !== saving.asked.id, onRoll: () => void rollSave(), onClose: closeSave }, saving.asked.id)), live && saving === undefined && shown.asked?.spend !== undefined && (_jsx(SpendCard, { asked: shown.asked, spend: shown.asked.spend, member: shown.party.find((candidate) => candidate.name === shown.asked?.spend?.who), flying: holding.current?.roll.id, onSpend: (field) => answerSpend(shown.asked?.id, { spend: field }), onDone: async (focused) => {
|
|
460
539
|
const taken = await answerSpend(shown.asked?.id, 0);
|
|
461
540
|
if (taken && focused) {
|
|
462
541
|
focusAfterCard();
|
|
463
542
|
}
|
|
464
543
|
return taken;
|
|
465
|
-
} }, shown.asked.id)), live && saving === undefined && shown.asked && shown.asked.spend === undefined && (_jsx(AskedBanner, { asked: shown.asked, yourTurn: yourTurn && (asker === undefined || asker.name === turnOf?.name), who: asker, turnName: turnName, map: shown.place?.map, place: shown.place?.name, answered: answering === shown.asked.id, onAnswered: () => void read() })), inSetup
|
|
544
|
+
} }, shown.asked.id)), live && saving === undefined && shown.pack !== undefined && (_jsx(AskCard, { card: shown.pack, name: several ? playerNamed(shown.party, shown.pack.asked?.who)?.name ?? turnName : undefined, title: widgets.find((widget) => widget.id === shown.pack?.widget)?.title, onAnswer: (index) => void answerPack(index), onWords: sayPack, onClose: closePack }, shown.pack.key)), live && saving === undefined && shown.pack === undefined && shown.asked && shown.asked.spend === undefined && !inCard(shown.asked) && (_jsx(AskedBanner, { asked: shown.asked, yourTurn: yourTurn && (asker === undefined || asker.name === turnOf?.name), who: asker, turnName: turnName, map: shown.place?.map, place: shown.place?.name, answered: answering === shown.asked.id, onAnswered: () => void read() })), inSetup
|
|
466
545
|
? _jsx(SetupView, { setup: setup })
|
|
467
546
|
: (_jsxs(_Fragment, { children: [live && yourTurn && address.section !== "scene" && shown.asked === undefined && saving === undefined && (_jsxs("a", { class: "turn-notice", href: sectionAddress("scene"), children: [_jsx(Icon, { name: "combat" }), _jsx("span", { children: [turnWords(turnName), shown.openScene?.round === undefined ? "" : t("Round {round}", { round: shown.openScene.round })].filter((part) => part !== "").join(" · ") }), _jsx("span", { class: "turn-notice-go", children: t("Go to the scene") })] })), _jsx(Notices, { notices: importing }), !table && _jsx(QuestEndings, { version: shown.version, campaign: shown.campaign }), address.section === "party" && _jsx(PartyStrip, { party: shown.party, chosen: shown.chosen, scene: shown.openScene }), _jsxs("div", { class: "body", children: [_jsxs("main", { children: [address.section === "about" && _jsx(About, { product: productName, system: shown.system }), address.section === "help" && _jsx(Help, {}), !table && address.section === "scene" && _jsx(FollowedQuests, { version: shown.version, campaign: shown.campaign }), address.section === "scene" && (_jsx(SceneView, { place: shown.place, scene: shown.openScene, actor: actor, foreground: shown.foreground, several: several, party: shown.party, turnsBeside: table, onShowCard: (name) => {
|
|
468
547
|
handed.current = { who: name, turn: turnKey(shown.openScene) };
|
|
@@ -530,6 +609,7 @@ function withHeld(before, next, hold) {
|
|
|
530
609
|
knownBy: shown.knownBy,
|
|
531
610
|
story: shown.story,
|
|
532
611
|
openScene: shown.openScene,
|
|
612
|
+
pack: shown.pack,
|
|
533
613
|
});
|
|
534
614
|
return { ...next, ...steady(before), pending: steady(next) };
|
|
535
615
|
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime";
|
|
2
|
+
// The card of a package's question (D-507): its widget's parts in the frame of the master's question, which stays through the questions of one attempt. Its
|
|
3
|
+
// counts on a stage of three places; under them the roll's button, or the choices a die asks for, and the rule; once the dice have spoken, the outcome where
|
|
4
|
+
// the buttons were. What the dice changed moves on its marks once they land; the card stays until the player closes it.
|
|
5
|
+
import { useEffect, useRef, useState } from "preact/hooks";
|
|
6
|
+
import { Drawn, Part, Text, textOf, Track } from "./extension-widgets.js";
|
|
7
|
+
import { Icon, NotationIcons } from "./icons.js";
|
|
8
|
+
import { checkOf } from "./labels.js";
|
|
9
|
+
import { cardLayout, labelKey, trackChanges } from "./pack-card.js";
|
|
10
|
+
import { t } from "./text.js";
|
|
11
|
+
import { turnWords } from "./turns.js";
|
|
12
|
+
/** The card; `name`, with more than one player character, whom it asks; `title`, its widget's, for a card the page saw no question of. */
|
|
13
|
+
export function AskCard({ card, name, title, onAnswer, onWords, onClose }) {
|
|
14
|
+
const element = useRef(null);
|
|
15
|
+
// Whether the focus was on one of its buttons as it was pressed: it goes to the next question's first button, or to Close at the end.
|
|
16
|
+
const pressed = useRef(false);
|
|
17
|
+
// What the card showed before, what changed since, and that change in words for a screen reader.
|
|
18
|
+
const look = useRef({ said: "", changes: new Map(), told: "" });
|
|
19
|
+
const said = JSON.stringify(card.shows);
|
|
20
|
+
if (look.current.said !== said) {
|
|
21
|
+
const changes = trackChanges(look.current.shows, card.shows);
|
|
22
|
+
look.current = { said, shows: card.shows, changes, told: look.current.shows === undefined ? "" : toldText(card, changes) };
|
|
23
|
+
}
|
|
24
|
+
const { changes, told } = look.current;
|
|
25
|
+
const layout = cardLayout(card.shows);
|
|
26
|
+
const asked = card.ended === true ? undefined : card.asked;
|
|
27
|
+
const ruled = card.asked?.rule;
|
|
28
|
+
const check = card.asked === undefined ? undefined : checkOf(card.asked.labels[0] ?? "", card.asked.title);
|
|
29
|
+
const question = card.title ?? asked?.question;
|
|
30
|
+
const prompt = asked !== undefined && question !== asked.question ? asked.question : undefined;
|
|
31
|
+
// The widget's lead is the outcome once it has a tone, good or bad; before, it names who rolls, which the line on top says.
|
|
32
|
+
const outcome = layout.lead?.tone === undefined ? undefined : layout.lead;
|
|
33
|
+
const id = card.key.replace(/[^a-z0-9-]/gi, "-");
|
|
34
|
+
const ruleId = `ask-rule-${id}`;
|
|
35
|
+
const state = card.ended === true ? "ended" : card.sent !== undefined ? "rolling" : "asking";
|
|
36
|
+
// The player's own words, as in the master's question: while they go, and what went wrong.
|
|
37
|
+
const [words, setWords] = useState("");
|
|
38
|
+
const [saying, setSaying] = useState(false);
|
|
39
|
+
const [problem, setProblem] = useState();
|
|
40
|
+
const busy = card.sent !== undefined || saying;
|
|
41
|
+
// While it stays in sight, the rolls beside the sheet stay in sight under it, as under the master's question (D-291); once it scrolls with the page, not.
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
const box = element.current;
|
|
44
|
+
if (box === null) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const root = document.documentElement;
|
|
48
|
+
const publish = () => {
|
|
49
|
+
if (getComputedStyle(box).position === "sticky") {
|
|
50
|
+
root.style.setProperty("--asked-space", `${box.offsetHeight + 16}px`);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
root.style.removeProperty("--asked-space");
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const observer = new ResizeObserver(publish);
|
|
57
|
+
observer.observe(box);
|
|
58
|
+
publish();
|
|
59
|
+
return () => {
|
|
60
|
+
observer.disconnect();
|
|
61
|
+
root.style.removeProperty("--asked-space");
|
|
62
|
+
};
|
|
63
|
+
}, [card.ended]);
|
|
64
|
+
// The button pressed gone, the focus that was on it goes to the next question's first button, or to Close once the card has its outcome.
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (!pressed.current || element.current === null || element.current.contains(document.activeElement)) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const next = element.current.querySelector(card.ended === true ? ".ask-close" : ".ask-choices button:not([aria-disabled='true'])");
|
|
70
|
+
if (next !== null) {
|
|
71
|
+
pressed.current = false;
|
|
72
|
+
next.focus();
|
|
73
|
+
}
|
|
74
|
+
}, [card.asked?.id, card.ended]);
|
|
75
|
+
const press = (index) => {
|
|
76
|
+
if (card.sent !== undefined) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
pressed.current = element.current?.contains(document.activeElement) === true;
|
|
80
|
+
onAnswer(index);
|
|
81
|
+
};
|
|
82
|
+
const say = async (event) => {
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
const text = words.trim();
|
|
85
|
+
if (text === "" || busy) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
setSaying(true);
|
|
89
|
+
setProblem(undefined);
|
|
90
|
+
if (await onWords(text, element.current?.contains(document.activeElement) === true)) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
setSaying(false);
|
|
94
|
+
setProblem(t("The answer did not reach the game: try again."));
|
|
95
|
+
};
|
|
96
|
+
const place = (stage) => {
|
|
97
|
+
const tracks = layout.places[stage];
|
|
98
|
+
// The facts under the counts at the end, or in the middle when none is at the end.
|
|
99
|
+
const facts = stage === (layout.places.end.length > 0 ? "end" : "center") ? layout.facts : [];
|
|
100
|
+
return (_jsxs("div", { class: `ask-place at-${stage}`, children: [tracks.map((track) => _jsx(Track, { track: track, place: stage, change: changes.get(labelKey(track.label)) }, labelKey(track.label))), facts.length > 0 && (_jsx("ul", { class: "chips ask-facts", children: facts.map((fact, index) => (_jsx("li", { dir: "auto", children: _jsx(Text, { text: fact }) }, index))) }))] }));
|
|
101
|
+
};
|
|
102
|
+
return (_jsxs("section", { ref: element, class: `asked ask-card ${state}`, "aria-labelledby": `ask-${id}`, children: [_jsx("img", { class: "asked-robot", src: "/assets/favicon.svg", alt: "" }), _jsxs("div", { class: "asked-body", children: [card.ended === true && (_jsx("button", { type: "button", class: "icon-button ask-close", "aria-label": t("Close"), "data-tip": t("Close"), onClick: () => onClose(element.current?.contains(document.activeElement) === true), children: _jsx(Icon, { name: "close" }) })), _jsx("p", { class: "eyebrow asked-turn", children: check === undefined ? title ?? turnWords(name) : `${turnWords(name)} · ${check.check}` }), _jsx("p", { id: `ask-${id}`, class: "asked-question", role: asked !== undefined && prompt === undefined ? "alert" : undefined, children: question ?? title }), _jsxs("div", { class: "ask-stage", children: [place("start"), place("center"), place("end")] }), layout.others.length > 0 && _jsx("div", { class: "ask-others", children: layout.others.map((part, index) => _jsx(Part, { part: part }, index)) }), _jsxs("div", { class: "ask-foot", children: [asked !== undefined && (_jsxs(_Fragment, { children: [prompt !== undefined && _jsx("p", { class: "ask-prompt", role: "alert", children: prompt }), _jsx("div", { class: "ask-choices", children: asked.labels.map((label, index) => {
|
|
103
|
+
const roll = checkOf(label, asked.title);
|
|
104
|
+
const own = asked.buttons?.[index] ?? undefined;
|
|
105
|
+
// A choice that says what it costs, as "it resets", in the red of what is lost; else a plain button.
|
|
106
|
+
const kind = roll !== undefined ? "ask-roll" : own?.note !== undefined ? "button danger ask-leave" : "button ask-leave";
|
|
107
|
+
return (_jsxs("button", { type: "button", class: card.sent === index ? `${kind} sent` : kind, "aria-disabled": card.sent === undefined ? undefined : "true", "aria-describedby": ruled === undefined ? undefined : ruleId, onClick: () => press(index), children: [roll !== undefined && _jsx(NotationIcons, { notation: roll.dice }), _jsx("span", { class: "asked-check-name", children: own?.name ?? roll?.check ?? label }), own?.note !== undefined && _jsx("span", { class: "ask-note", children: own.note }), roll !== undefined && _jsx("span", { class: "visually-hidden", children: roll.dice })] }, `${asked.id} ${index}`));
|
|
108
|
+
}) })] })), asked === undefined && outcome !== undefined && (_jsxs("p", { class: outcome.tone === undefined ? "ask-outcome" : `ask-outcome ${outcome.tone}`, "aria-hidden": "true", children: [outcome.icon !== undefined && _jsx(Drawn, { path: outcome.icon, kind: "ask-outcome-icon" }), _jsx("span", { dir: "auto", children: _jsx(Text, { text: outcome.lead }) })] })), asked === undefined && layout.texts.map((text, index) => (_jsx("p", { class: "ask-then", dir: "auto", children: _jsx(Text, { text: text }) }, index))), ruled !== undefined && _jsx("p", { id: ruleId, class: "ask-rule", dir: "auto", children: ruled }), asked !== undefined && (_jsxs("form", { class: "asked-own ask-own", onSubmit: (event) => void say(event), children: [_jsx("input", { type: "text", value: words, maxLength: mostWords, placeholder: t("Or write what you do…"), "aria-label": t("Or write what you do"), disabled: busy, onInput: (event) => setWords(event.currentTarget.value) }), _jsx("button", { type: "submit", class: "icon-button", "aria-label": t("Send"), "data-tip": t("Send"), disabled: busy || words.trim() === "", children: _jsx(Icon, { name: "send" }) })] })), problem !== undefined && _jsx("p", { class: "asked-problem", role: "alert", children: problem })] }), _jsx("p", { class: "visually-hidden", role: "status", children: told })] })] }));
|
|
109
|
+
}
|
|
110
|
+
// How many characters the player's own words may have, as the server takes them.
|
|
111
|
+
const mostWords = 500;
|
|
112
|
+
/** What a look of the card changed, for a screen reader, once: its outcome, then each count that changed, as "Failed. Pins: 0 of 6. Failures: 3 of 4." */
|
|
113
|
+
function toldText(card, changes) {
|
|
114
|
+
const layout = cardLayout(card.shows);
|
|
115
|
+
const lead = layout.lead?.tone === undefined ? "" : `${textOf(layout.lead.lead)}.`;
|
|
116
|
+
const counts = Object.values(layout.places).flat().filter((track) => changes.has(labelKey(track.label))).map((track) => `${textOf(track.label)}: ${t("{value} of {max}", { value: track.value + (track.held ?? 0), max: track.max })}.`);
|
|
117
|
+
return [lead, ...counts].filter((part) => part !== "").join(" ");
|
|
118
|
+
}
|
|
@@ -116,8 +116,8 @@ export function DiceTray({ requested, sheetThrow, party, onLanded, onShown, onFr
|
|
|
116
116
|
await new Promise((painted) => requestAnimationFrame(painted));
|
|
117
117
|
const plateTop = measuredPlate.current?.getBoundingClientRect().top;
|
|
118
118
|
// The header as it stands now, full at the page's top or compact below it: no die lands under it; on a wide screen nor on the card of a death save,
|
|
119
|
-
// whose outcome comes as they land (D-461),
|
|
120
|
-
const card = matchMedia("(min-width: 601px)").matches ? document.querySelector(".dying-card.rolling, .spend-card")?.getBoundingClientRect().bottom : undefined;
|
|
119
|
+
// whose outcome comes as they land (D-461), of a rest's dice (D-492), or of a package's question (D-507). A phone has no room under it.
|
|
120
|
+
const card = matchMedia("(min-width: 601px)").matches ? document.querySelector(".dying-card.rolling, .spend-card, .ask-card")?.getBoundingClientRect().bottom : undefined;
|
|
121
121
|
const headerBottom = Math.max(0, document.querySelector(".top")?.getBoundingClientRect().bottom ?? 0, card ?? 0);
|
|
122
122
|
if (plateTop !== undefined && plateTop > 0) {
|
|
123
123
|
loaded?.cover(window.innerHeight - plateTop, headerBottom, card !== undefined);
|
|
@@ -194,6 +194,8 @@ export function DiceTray({ requested, sheetThrow, party, onLanded, onShown, onFr
|
|
|
194
194
|
dice: requested.dice,
|
|
195
195
|
modifier: notationModifier(requested.notation),
|
|
196
196
|
total: requested.total,
|
|
197
|
+
...(requested.says === undefined ? {} : { says: requested.says }),
|
|
198
|
+
...(requested.tones === undefined ? {} : { tones: requested.tones }),
|
|
197
199
|
text: requested.text,
|
|
198
200
|
...(member === undefined ? {} : { member }),
|
|
199
201
|
roll: requested.id,
|
|
@@ -303,7 +305,7 @@ export function DiceTray({ requested, sheetThrow, party, onLanded, onShown, onFr
|
|
|
303
305
|
}
|
|
304
306
|
/** What the plate says: whose roll and which, the dice one by one with the modifier, the total large, a rare face's words, and for a screen reader the chat's text. */
|
|
305
307
|
function PlateContent({ plate }) {
|
|
306
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { class: "plate-head", children: [plate.member && _jsx(Token, { member: plate.member }), _jsxs("span", { class: "plate-what", children: [_jsx("span", { class: "plate-title", children: plate.title }), plate.free && (_jsx("span", { class: "plate-under", children: _jsx("span", { class: "plate-tag", children: t("Free roll · not logged") }) }))] })] }), _jsx(DiceFaces, { dice: plate.dice, modifier: plate.modifier, className: "plate-dice" }), _jsx("span", { class: "plate-total num", children: shownText(String(plate.total)) }), plate.rare && _jsx("p", { class: "plate-rare", children: plate.rare.words }), _jsx("span", { class: "visually-hidden", children: plate.free ? t("{dice}, free roll, not logged", { dice: plate.text }) : plate.text })] }));
|
|
308
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { class: "plate-head", children: [plate.member && _jsx(Token, { member: plate.member }), _jsxs("span", { class: "plate-what", children: [_jsx("span", { class: "plate-title", children: plate.title }), plate.free && (_jsx("span", { class: "plate-under", children: _jsx("span", { class: "plate-tag", children: t("Free roll · not logged") }) }))] })] }), _jsx(DiceFaces, { dice: plate.dice, modifier: plate.modifier, className: "plate-dice", tones: plate.tones }), plate.says === undefined ? _jsx("span", { class: "plate-total num", children: shownText(String(plate.total)) }) : _jsx("span", { class: "plate-total plate-says", children: plate.says }), plate.rare && _jsx("p", { class: "plate-rare", children: plate.rare.words }), _jsx("span", { class: "visually-hidden", children: plate.free ? t("{dice}, free roll, not logged", { dice: plate.text }) : plate.text })] }));
|
|
307
309
|
}
|
|
308
310
|
/** A free throw as this browser's rolls keep it (D-330 (4)): whose sheet it is from, the number's label as its check, its dice and total. */
|
|
309
311
|
function pageRoll(plate, number) {
|
|
@@ -88,7 +88,7 @@ function WidgetCard({ widget }) {
|
|
|
88
88
|
return (_jsxs("section", { class: "card widget-card", "aria-labelledby": id, children: [_jsx(CardHead, { icon: shows?.icon ?? widget.icon ?? iconPath("packages"), title: _jsx("h3", { id: id, ref: title, tabIndex: -1, children: widget.title }), ...(shows?.note === undefined ? {} : { note: _jsx(Text, { text: shows.note }) }) }), shows?.parts !== undefined && shows.parts.length > 0 && _jsx("div", { class: "card-body widget-body", children: shows.parts.map((part, index) => _jsx(Part, { part: part }, index)) })] }));
|
|
89
89
|
}
|
|
90
90
|
/** A part of a widget's card, as the page draws its own. */
|
|
91
|
-
function Part({ part }) {
|
|
91
|
+
export function Part({ part }) {
|
|
92
92
|
if ("lead" in part) {
|
|
93
93
|
return (_jsxs("div", { class: "widget-lead", children: [part.icon !== undefined && _jsx(Drawn, { path: part.icon, kind: "widget-lead-icon" }), _jsx("span", { class: "widget-lead-words", dir: "auto", children: _jsx(Text, { text: part.lead }) }), part.value !== undefined && _jsx(Value, { value: part.value, kind: "widget-lead-value" })] }));
|
|
94
94
|
}
|
|
@@ -112,17 +112,43 @@ function Part({ part }) {
|
|
|
112
112
|
}
|
|
113
113
|
return _jsx("img", { class: "widget-image", src: `/images/ext/${encodeURIComponent(part.image.extension)}/${encodeURIComponent(part.image.file)}?v=${part.image.version}`, alt: textOf(part.alt), loading: "lazy" });
|
|
114
114
|
}
|
|
115
|
-
/**
|
|
116
|
-
|
|
115
|
+
/**
|
|
116
|
+
* A count as marks, or a bar, with its label; a screen reader hears the label once, in the count's name, with its value in words (D-507). Marks are pips, or
|
|
117
|
+
* tall steps of a progress with their count under them; good ones circles, bad ones squares; after those lit, the held, the marked and the coming. In a card
|
|
118
|
+
* of a question, its place there, and what changed since the card's last look, for its marks to move.
|
|
119
|
+
*/
|
|
120
|
+
export function Track({ track, place, change }) {
|
|
117
121
|
const label = textOf(track.label);
|
|
118
122
|
const said = t("{value} of {max}", { value: track.value, max: track.max });
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
const steps = track.look === "steps";
|
|
124
|
+
const marks = track.look !== "bar" && track.max <= (steps ? mostSteps : mostPips);
|
|
125
|
+
const kind = [place === undefined ? "widget-track" : `ask-track track-${place}`, track.tone ?? ""].filter((name) => name !== "").join(" ");
|
|
126
|
+
const more = [
|
|
127
|
+
track.held === undefined || track.held === 0 ? "" : t("held: {count}", { count: track.held }),
|
|
128
|
+
track.marked === undefined || track.marked === 0 ? "" : t("failed: {count}", { count: track.marked }),
|
|
129
|
+
track.coming === undefined || track.coming === 0 ? "" : t("this roll: {count}", { count: track.coming }),
|
|
130
|
+
].filter((part) => part !== "");
|
|
131
|
+
const named = [`${label}: ${said}`, ...more].join(", ");
|
|
132
|
+
return (_jsxs("div", { class: kind, children: [_jsx("span", { class: "widget-track-label", dir: "auto", "aria-hidden": "true", children: label }), marks
|
|
133
|
+
? (_jsx("span", { class: ["pips", steps ? "steps" : "", track.tone ?? ""].filter((name) => name !== "").join(" "), role: "img", "aria-label": named, children: Array.from({ length: track.max }, (_, index) => _jsx(Mark, { index: index, track: track, change: change }, index)) }))
|
|
134
|
+
: (_jsxs("span", { class: "bar-line", children: [_jsx("span", { class: "bar", role: "meter", "aria-label": label, "aria-valuemin": 0, "aria-valuemax": track.max, "aria-valuenow": track.value, "aria-valuetext": more.length === 0 ? said : [said, ...more].join(", "), children: _jsx("span", { class: "fill", style: { "--fill": String(track.value / track.max) } }) }), _jsx("span", { class: "num", "aria-hidden": "true", children: `${numberText(track.value)}/${numberText(track.max)}` })] })), marks && steps && _jsx("span", { class: "track-count num", "aria-hidden": "true", children: `${numberText(track.value + (track.held ?? 0))}/${numberText(track.max)}` })] }));
|
|
135
|
+
}
|
|
136
|
+
// How many marks a count draws at most, as pips or as steps; past that, a bar.
|
|
137
|
+
const mostPips = 10;
|
|
138
|
+
const mostSteps = 12;
|
|
139
|
+
/** One mark of a count: lit, held, marked or coming, by where it falls after the value; lit or gone out just now, its step in the order they move. */
|
|
140
|
+
function Mark({ index, track, change }) {
|
|
141
|
+
const held = track.value + (track.held ?? 0);
|
|
142
|
+
const marked = held + (track.marked ?? 0);
|
|
143
|
+
const state = index < track.value ? "on" : index < held ? "held" : index < marked ? "marked" : index < marked + (track.coming ?? 0) ? "coming" : "";
|
|
144
|
+
const lit = change?.lit.indexOf(index) ?? -1;
|
|
145
|
+
const out = change?.out.indexOf(index) ?? -1;
|
|
146
|
+
const moves = lit >= 0 ? "lit" : out >= 0 ? "out" : change?.marked.includes(index) === true ? "struck" : "";
|
|
147
|
+
const step = Math.max(lit, out, 0);
|
|
148
|
+
return _jsx("span", { class: ["pip", state, moves].filter((name) => name !== "").join(" "), style: moves === "" ? undefined : { "--step": String(step) } });
|
|
123
149
|
}
|
|
124
150
|
/** Words of an extension, its values written in the page's language, each set apart. */
|
|
125
|
-
function Text({ text }) {
|
|
151
|
+
export function Text({ text }) {
|
|
126
152
|
if (typeof text === "string") {
|
|
127
153
|
return _jsx(_Fragment, { children: text });
|
|
128
154
|
}
|
|
@@ -155,6 +181,6 @@ function rangeText(from, to) {
|
|
|
155
181
|
return typeof format.formatRange === "function" ? format.formatRange(from, to) : `${numberText(from)}–${numberText(to)}`;
|
|
156
182
|
}
|
|
157
183
|
/** An extension's icon, drawn as the page strokes its own. */
|
|
158
|
-
function Drawn({ path, kind }) {
|
|
184
|
+
export function Drawn({ path, kind }) {
|
|
159
185
|
return (_jsx("svg", { class: kind, viewBox: "0 0 24 24", "aria-hidden": "true", children: _jsx("path", { d: path }) }));
|
|
160
186
|
}
|
package/dist/dashboard/faces.js
CHANGED
|
@@ -2,13 +2,15 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-ru
|
|
|
2
2
|
import { rareFace } from "./dice/models.js";
|
|
3
3
|
import { DieIcon } from "./icons.js";
|
|
4
4
|
import { signed } from "./labels.js";
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/** The dice as chips; with how each turned out, when a package's roll says it, a good one green and a bad one red (D-507). */
|
|
6
|
+
export function DiceFaces({ dice, modifier, className, tones }) {
|
|
7
|
+
const toned = tones !== undefined && tones.length === dice.length;
|
|
8
|
+
return (_jsxs("ol", { class: className === undefined ? "dice-faces" : `dice-faces ${className}`, "aria-hidden": "true", children: [dice.map((die, index) => _jsx(DieChip, { die: die, tone: toned ? tones[index] ?? undefined : undefined }, index)), modifier !== 0 && _jsx("li", { class: "die-modifier", children: signed(modifier) })] }));
|
|
7
9
|
}
|
|
8
|
-
function DieChip({ die }) {
|
|
10
|
+
function DieChip({ die, tone }) {
|
|
9
11
|
const rare = rareFace(die);
|
|
10
12
|
const faces = die.faces !== undefined && die.faces.length > 1 ? die.faces.map((value) => faceText(die.sides, value)).join("+") : faceText(die.sides, die.value);
|
|
11
|
-
return (_jsxs("li", { class: ["die-chip", die.dropped === true ? "dropped" : "", rare === undefined ? "" : `rare-${rare}`].filter((name) => name !== "").join(" "), children: [_jsx(DieIcon, { sides: die.sides }), _jsxs("span", { children: [die.rerolledFrom !== undefined && (_jsxs(_Fragment, { children: [_jsx("s", { children: faceText(die.sides, die.rerolledFrom) }), "\u2192"] })), faces] })] }));
|
|
13
|
+
return (_jsxs("li", { class: ["die-chip", die.dropped === true ? "dropped" : "", rare === undefined ? "" : `rare-${rare}`, tone === undefined ? "" : `tone-${tone}`].filter((name) => name !== "").join(" "), children: [_jsx(DieIcon, { sides: die.sides }), _jsxs("span", { children: [die.rerolledFrom !== undefined && (_jsxs(_Fragment, { children: [_jsx("s", { children: faceText(die.sides, die.rerolledFrom) }), "\u2192"] })), faces] })] }));
|
|
12
14
|
}
|
|
13
15
|
/** A face as a chip shows it: a number, or a dF's −, 0 and +. */
|
|
14
16
|
function faceText(sides, value) {
|
package/dist/dashboard/help.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
2
|
// Help (D-409, D-413): the complete guide, in the page's language, as its markdown file has it (guide/<code>.md): what it is, an index of chips, and each of
|
|
3
|
-
// its parts a card that folds, the first two open. Its anchors are the English guide's, so that a link finds its heading in every language.
|
|
3
|
+
// its parts a card that folds, the first two open. Its anchors are the English guide's, so that a link finds its heading in every language. At its end, how to
|
|
4
|
+
// tell us what went wrong: the page's own words, so that the guide's translations stay as they are.
|
|
4
5
|
import { useEffect, useMemo, useState } from "preact/hooks";
|
|
5
|
-
import { CardHeader } from "./card.js";
|
|
6
|
+
import { CardHead, CardHeader } from "./card.js";
|
|
6
7
|
import { anchorOf, markdownBlocks, plainText } from "./guide-blocks.js";
|
|
7
8
|
import { Blocks, Inline } from "./guide-markdown.js";
|
|
8
9
|
import { Icon, iconPath, isIconName } from "./icons.js";
|
|
@@ -46,7 +47,13 @@ export function Help() {
|
|
|
46
47
|
}
|
|
47
48
|
focused?.focus({ preventScroll: true });
|
|
48
49
|
}, [sought]);
|
|
49
|
-
return (_jsxs("section", { class: "page-stack help", "aria-labelledby": "help-title", children: [_jsx(PageHead, { section: "help", id: "help-title" }), _jsx("div", { class: "help-lead", children: _jsx(Blocks, { blocks: lead, anchors: anchors, go: go }) }), _jsx("nav", { class: "help-index", "aria-label": t("Contents"), children: parts.map((part) => (_jsxs("button", { type: "button", class: "help-chip", onClick: () => go(anchors.get(part.heading) ?? ""), children: [_jsx(Icon, { name: iconOf(part.heading) }), _jsx(Inline, { text: part.heading.text, go: go })] }, part.heading.text))) }), _jsx("div", { class: "help-cards", children: parts.map((part, index) => (_jsxs("details", { id: anchors.get(part.heading), class: "group help-card", open: open.has(index), children: [_jsx(CardHeader, { icon: iconPath(iconOf(part.heading)), title: _jsx("h3", { children: part.heading.text }), preview: plainText(part.blocks.find((block) => block.kind === "paragraph")?.text ?? ""), open: open.has(index), onToggle: (event) => toggle(index, event) }), _jsx("div", { class: "guide", children: _jsx(Blocks, { blocks: part.blocks, anchors: anchors, go: go }) })] }, part.heading.text))) })] }));
|
|
50
|
+
return (_jsxs("section", { class: "page-stack help", "aria-labelledby": "help-title", children: [_jsx(PageHead, { section: "help", id: "help-title" }), _jsx("div", { class: "help-lead", children: _jsx(Blocks, { blocks: lead, anchors: anchors, go: go }) }), _jsx("nav", { class: "help-index", "aria-label": t("Contents"), children: parts.map((part) => (_jsxs("button", { type: "button", class: "help-chip", onClick: () => go(anchors.get(part.heading) ?? ""), children: [_jsx(Icon, { name: iconOf(part.heading) }), _jsx(Inline, { text: part.heading.text, go: go })] }, part.heading.text))) }), _jsx("div", { class: "help-cards", children: parts.map((part, index) => (_jsxs("details", { id: anchors.get(part.heading), class: "group help-card", open: open.has(index), children: [_jsx(CardHeader, { icon: iconPath(iconOf(part.heading)), title: _jsx("h3", { children: part.heading.text }), preview: plainText(part.blocks.find((block) => block.kind === "paragraph")?.text ?? ""), open: open.has(index), onToggle: (event) => toggle(index, event) }), _jsx("div", { class: "guide", children: _jsx(Blocks, { blocks: part.blocks, anchors: anchors, go: go }) })] }, part.heading.text))) }), _jsx(ReportCard, {})] }));
|
|
51
|
+
}
|
|
52
|
+
/** Where the issues of RPG Engine are reported, as its README says. */
|
|
53
|
+
export const issuesLink = "https://github.com/stefanocaronia/rpg-engine/issues";
|
|
54
|
+
/** The invitation to report what went wrong, said to one who may never have seen GitHub: what to write there, and that it is a public page. */
|
|
55
|
+
export function ReportCard() {
|
|
56
|
+
return (_jsxs("section", { class: "card help-report", "aria-labelledby": "help-report-title", children: [_jsx(CardHead, { icon: iconPath("chat"), title: _jsx("h3", { id: "help-report-title", children: t("Tell us") }) }), _jsxs("div", { class: "card-body", children: [_jsx("p", { children: t("Something doesn't work, confuses you or could be better? Tell us what you did, what you expected and what happened: every report helps.") }), _jsx("p", { class: "help-report-note", children: t("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.") }), _jsxs("a", { class: "about-link", href: issuesLink, target: "_blank", rel: "noreferrer", children: [_jsx(Icon, { name: "github" }), t("Open a report on GitHub")] })] })] }));
|
|
50
57
|
}
|
|
51
58
|
/** The guide in a language, and in English for its anchors; empty until they are read. */
|
|
52
59
|
function useGuide(language) {
|
|
@@ -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": "انتهى الوقت",
|
|
@@ -315,6 +315,7 @@
|
|
|
315
315
|
"Factions": "Frakce",
|
|
316
316
|
"factions, threats and places with secrets, no main plot: you choose where to go": "frakce, hrozby a místa s tajemstvím, žádná hlavní zápletka: kam půjdeš, je na tobě",
|
|
317
317
|
"Failed": "Nezdařené",
|
|
318
|
+
"failed: {count}": "neúspěšné: {count}",
|
|
318
319
|
"Failure": "Neúspěch",
|
|
319
320
|
"Farm": "Statek",
|
|
320
321
|
"feet and miles": "stopy a míle",
|
|
@@ -347,6 +348,7 @@
|
|
|
347
348
|
"Game system": "Herní systém",
|
|
348
349
|
"Game systems, extensions and languages come from npm: a file, a link or a folder can be added all the same.": "Herní systémy, rozšíření a jazyky pocházejí z npm: přidat jde i soubor, odkaz nebo složka.",
|
|
349
350
|
"GitHub does not answer.": "GitHub neodpovídá.",
|
|
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 je web, kde RPG Engine vzniká: píšeš tam s bezplatným účtem, jako ve fóru, a číst to může kdokoli.",
|
|
350
352
|
"github.com/someone/an-adventure": "github.com/nekdo/dobrodruzstvi",
|
|
351
353
|
"Glass": "Sklo",
|
|
352
354
|
"Go back": "Vrátit se",
|
|
@@ -359,6 +361,7 @@
|
|
|
359
361
|
"happy": "veselý",
|
|
360
362
|
"Hard": "Těžká",
|
|
361
363
|
"has code: asks your yes": "obsahuje kód: potřebuje tvůj souhlas",
|
|
364
|
+
"held: {count}": "nejisté: {count}",
|
|
362
365
|
"Help": "Nápověda",
|
|
363
366
|
"Here": "Tady",
|
|
364
367
|
"hidden": "skryté",
|
|
@@ -611,6 +614,7 @@
|
|
|
611
614
|
"Onyx": "Onyx",
|
|
612
615
|
"Open": "Otevřít",
|
|
613
616
|
"Open a new chat with the master.": "Otevři nový chat s Pánem jeskyně.",
|
|
617
|
+
"Open a report on GitHub": "Otevřít hlášení na GitHubu",
|
|
614
618
|
"Open source, under the MIT licence.": "Otevřený zdrojový kód pod licencí MIT.",
|
|
615
619
|
"Open the question": "Otevřít otázku",
|
|
616
620
|
"Open the sheet": "Otevřít deník postavy",
|
|
@@ -673,6 +677,8 @@
|
|
|
673
677
|
"Ready buttons": "Hotová tlačítka",
|
|
674
678
|
"Region": "Oblast",
|
|
675
679
|
"Regions and ways": "Oblasti a cesty",
|
|
680
|
+
"Report a problem": "Nahlásit problém",
|
|
681
|
+
"Report a problem with {name}": "Nahlásit problém s balíčkem {name}",
|
|
676
682
|
"reroll once {condition}": "hodit znovu jednou {condition}",
|
|
677
683
|
"rest": "odpočinek",
|
|
678
684
|
"Restore the cleared rolls": "Obnovit vymazané hody",
|
|
@@ -744,6 +750,7 @@
|
|
|
744
750
|
"Someone": "Někdo",
|
|
745
751
|
"Someone else's": "Cizí",
|
|
746
752
|
"Someone else's · {author}": "Cizí · {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.": "Něco nefunguje, mate tě nebo by mohlo být lepší? Popiš, co se dělo, co očekáváš a co se stalo: každé hlášení pomáhá.",
|
|
747
754
|
"Sometimes": "Někdy",
|
|
748
755
|
"somewhere": "někde jinde",
|
|
749
756
|
"somewhere you do not know": "místo, které neznáš",
|
|
@@ -790,6 +797,7 @@
|
|
|
790
797
|
"Tales and events": "Příběhy a události",
|
|
791
798
|
"Talk to {name}": "Promluvit si s {name}",
|
|
792
799
|
"Tell the master": "Říct Pánu jeskyně",
|
|
800
|
+
"Tell us": "Dej nám vědět",
|
|
793
801
|
"Temple": "Chrám",
|
|
794
802
|
"tense action, strong colours, each message ending on a threat or a hook": "napínavá akce, sytré barvy, každá zpráva končí hrozbou nebo záchytným bodem",
|
|
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.": "Nejlépe se čtou texty nebo PDF s vybíratelným textem; naskenované PDF se čte z obrázků stránek, jen ve Windows, a trvá to několik minut.",
|
|
@@ -893,6 +901,7 @@
|
|
|
893
901
|
"This computer is translating the page into {language}: until then it stays in English.": "Tento počítač stránku překládá do jazyka {language}: do té doby zůstává v angličtině.",
|
|
894
902
|
"This page": "Tato stránka",
|
|
895
903
|
"This page could not be read now: try again in a moment.": "Tuto stránku teď nelze přečíst. Zkus to za chvíli znovu.",
|
|
904
|
+
"this roll: {count}": "v tomto hodu: {count}",
|
|
896
905
|
"This turn": "Tento tah",
|
|
897
906
|
"those you ask for": "ty, o které požádáš",
|
|
898
907
|
"Time is up": "Čas vypršel",
|