rpg-engine 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/campaign/host-files.js +4 -1
- package/dist/campaign/index.d.ts +2 -1
- package/dist/campaign/index.js +2 -1
- package/dist/campaign/port.d.ts +6 -0
- package/dist/campaign/port.js +24 -0
- package/dist/campaign/settings.d.ts +17 -0
- package/dist/campaign/settings.js +24 -1
- package/dist/cli/cli.js +15 -0
- package/dist/commands/config/config.js +15 -1
- package/dist/commands/config/dashboard.d.ts +4 -0
- package/dist/commands/config/dashboard.js +37 -6
- package/dist/commands/config/shown.js +4 -0
- package/dist/commands/config/words.d.ts +3 -1
- package/dist/commands/config/words.js +28 -1
- package/dist/commands/mode.d.ts +1 -1
- package/dist/commands/package/data.js +27 -0
- package/dist/commands/package/theme.js +2 -1
- package/dist/commands/scene/scene.js +6 -1
- package/dist/commands/shared/books/adventures.d.ts +1 -0
- package/dist/commands/shared/books/adventures.js +1 -1
- package/dist/commands/shared/campaign/git.d.ts +25 -0
- package/dist/commands/shared/campaign/git.js +104 -0
- package/dist/commands/shared/campaign/saves.js +5 -1
- package/dist/commands/shared/packages/catalog.js +24 -5
- package/dist/commands/status.d.ts +1 -0
- package/dist/commands/status.js +8 -4
- package/dist/core/context.d.ts +2 -0
- package/dist/core/version.d.ts +2 -0
- package/dist/core/version.js +5 -0
- package/dist/dashboard/guide/ar.md +6 -4
- package/dist/dashboard/guide/cs.md +6 -4
- package/dist/dashboard/guide/da.md +6 -4
- package/dist/dashboard/guide/de.md +8 -6
- package/dist/dashboard/guide/el.md +6 -4
- package/dist/dashboard/guide/en.md +5 -3
- package/dist/dashboard/guide/es.md +6 -4
- package/dist/dashboard/guide/fi.md +6 -4
- package/dist/dashboard/guide/fr.md +6 -4
- package/dist/dashboard/guide/he.md +6 -4
- package/dist/dashboard/guide/hi.md +6 -4
- package/dist/dashboard/guide/hu.md +6 -4
- package/dist/dashboard/guide/is.md +6 -4
- package/dist/dashboard/guide/it.md +6 -4
- package/dist/dashboard/guide/ja.md +7 -5
- package/dist/dashboard/guide/ko.md +6 -4
- package/dist/dashboard/guide/nb.md +7 -5
- package/dist/dashboard/guide/nl.md +6 -4
- package/dist/dashboard/guide/pl.md +6 -4
- package/dist/dashboard/guide/pt.md +6 -4
- package/dist/dashboard/guide/ro.md +6 -4
- package/dist/dashboard/guide/ru.md +6 -4
- package/dist/dashboard/guide/sv.md +6 -4
- package/dist/dashboard/guide/tr.md +6 -4
- package/dist/dashboard/guide/uk.md +6 -4
- package/dist/dashboard/guide/zh.md +6 -4
- package/dist/dashboard/i18n/ar.json +25 -0
- package/dist/dashboard/i18n/cs.json +25 -0
- package/dist/dashboard/i18n/da.json +25 -0
- package/dist/dashboard/i18n/de.json +25 -0
- package/dist/dashboard/i18n/el.json +25 -0
- package/dist/dashboard/i18n/es.json +25 -0
- package/dist/dashboard/i18n/fi.json +25 -0
- package/dist/dashboard/i18n/fr.json +25 -0
- package/dist/dashboard/i18n/he.json +25 -0
- package/dist/dashboard/i18n/hi.json +25 -0
- package/dist/dashboard/i18n/hu.json +25 -0
- package/dist/dashboard/i18n/is.json +25 -0
- package/dist/dashboard/i18n/it.json +25 -0
- package/dist/dashboard/i18n/ja.json +25 -0
- package/dist/dashboard/i18n/ko.json +25 -0
- package/dist/dashboard/i18n/nb.json +25 -0
- package/dist/dashboard/i18n/nl.json +25 -0
- package/dist/dashboard/i18n/pl.json +25 -0
- package/dist/dashboard/i18n/pt.json +25 -0
- package/dist/dashboard/i18n/ro.json +25 -0
- package/dist/dashboard/i18n/ru.json +25 -0
- package/dist/dashboard/i18n/sv.json +25 -0
- package/dist/dashboard/i18n/tr.json +25 -0
- package/dist/dashboard/i18n/uk.json +25 -0
- package/dist/dashboard/i18n/zh.json +25 -0
- package/dist/dashboard/packages/installed.js +2 -2
- package/dist/dashboard/packages/packages.js +1 -1
- package/dist/dashboard/parts/labels.js +7 -0
- package/dist/dashboard/settings/settings.js +33 -6
- package/dist/dashboard/shell/system-style.js +89 -5
- package/dist/dashboard/shell/tooltip.js +5 -4
- package/dist/dashboard/style.css +234 -81
- package/dist/git/git.d.ts +12 -0
- package/dist/git/git.js +175 -0
- package/dist/git/ignore.d.ts +2 -0
- package/dist/git/ignore.js +16 -0
- package/dist/git/index.d.ts +2 -0
- package/dist/git/index.js +2 -0
- package/dist/importer/index.d.ts +1 -1
- package/dist/importer/index.js +1 -1
- package/dist/languages/pack.js +2 -1
- package/dist/server/bell-listener.d.ts +2 -1
- package/dist/server/bell-listener.js +10 -41
- package/dist/server/dashboard/files.d.ts +3 -2
- package/dist/server/dashboard/files.js +44 -15
- package/dist/server/dashboard/index.d.ts +15 -2
- package/dist/server/dashboard/index.js +52 -22
- package/dist/server/dashboard/news.d.ts +3 -2
- package/dist/server/dashboard/news.js +19 -5
- package/dist/server/dashboard/ports.d.ts +17 -2
- package/dist/server/dashboard/ports.js +60 -4
- package/dist/server/mcp.d.ts +3 -2
- package/dist/server/mcp.js +55 -11
- package/dist/themes/css.d.ts +1 -1
- package/dist/themes/css.js +101 -2
- package/dist/themes/index.d.ts +1 -1
- package/dist/themes/index.js +1 -1
- package/dist/themes/theme.d.ts +34 -3
- package/dist/themes/theme.js +176 -19
- package/instructions/core.md +1 -0
- package/instructions/dashboard-guide.md +1 -1
- package/package.json +1 -1
|
@@ -24,6 +24,12 @@ const groups = [
|
|
|
24
24
|
{ names: ["lines", "veils"] },
|
|
25
25
|
{ names: ["orders"] },
|
|
26
26
|
{ names: ["pictures", "pictures-by", "language"] },
|
|
27
|
+
// Only where the campaign's folder is a git repository (D-576).
|
|
28
|
+
// What a public repository would show of the player (D-576).
|
|
29
|
+
{
|
|
30
|
+
names: ["git", "git-saves", "git-sessions"],
|
|
31
|
+
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
|
+
},
|
|
27
33
|
];
|
|
28
34
|
/** The Settings section; with `several` player characters, what a value means says so where it speaks of one character (D-480 (2)). */
|
|
29
35
|
export function SettingsView({ version, several = false }) {
|
|
@@ -59,7 +65,10 @@ export function SettingsView({ version, several = false }) {
|
|
|
59
65
|
...group.names.flatMap((name) => settings.filter((setting) => setting.name === name)),
|
|
60
66
|
...(group.system ? settings.filter((setting) => !known.has(setting.name)) : []),
|
|
61
67
|
];
|
|
62
|
-
|
|
68
|
+
if (shown.length === 0) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
return (_jsxs("section", { class: "settings-group", children: [_jsx("h3", { children: groupTitle(index) }), group.note !== undefined && _jsx("p", { class: "settings-group-note", 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.names[0]));
|
|
63
72
|
}), _jsx(WidgetSettings, { onChange: change }), _jsx(PageSettings, {})] }));
|
|
64
73
|
}
|
|
65
74
|
/**
|
|
@@ -350,7 +359,7 @@ export function Command({ text }) {
|
|
|
350
359
|
/**
|
|
351
360
|
* Under the theme, the game's style, when the campaign's system has one, a theme or a page style (D-528), or this computer has themes installed (D-574): the
|
|
352
361
|
* game's, each installed theme by its name, or the page's, kept in this browser for that system; the game's left out when its theme does not pass the check
|
|
353
|
-
* of legibility, which the page's then says.
|
|
362
|
+
* of legibility, which the page's then says. Under it, for a theme shown with a style sheet of its own, whether the page adds it.
|
|
354
363
|
*/
|
|
355
364
|
function gameStyleRows() {
|
|
356
365
|
const style = gameStyle();
|
|
@@ -370,7 +379,9 @@ function gameStyleRows() {
|
|
|
370
379
|
...style.themes.map((one) => ({ value: installedStyle(one.id), label: one.name })),
|
|
371
380
|
{ value: "page", label: t("The page's"), ...refusedMeans },
|
|
372
381
|
];
|
|
373
|
-
|
|
382
|
+
const own = style.ownStyle;
|
|
383
|
+
return [
|
|
384
|
+
{
|
|
374
385
|
key: "game-style",
|
|
375
386
|
name: t("Game style"),
|
|
376
387
|
about,
|
|
@@ -382,7 +393,22 @@ function gameStyleRows() {
|
|
|
382
393
|
},
|
|
383
394
|
// The names of the installed themes go under the row's, with room for them.
|
|
384
395
|
...(installed ? { under: true } : {}),
|
|
385
|
-
}
|
|
396
|
+
},
|
|
397
|
+
// The own style sheet of the theme shown, which the page adds unchecked: off, the theme keeps its colours, faces and pictures (D-575).
|
|
398
|
+
...(own === undefined ? [] : [{
|
|
399
|
+
key: "theme-style",
|
|
400
|
+
name: t("Theme's own style"),
|
|
401
|
+
about: t("what the theme adds to the page's look beyond its colours, faces and pictures; the page does not check it, so it may read less well"),
|
|
402
|
+
// Settings never take it, whatever it does: this switch stays in reach.
|
|
403
|
+
note: t("Settings never show it, so you can always turn it off here."),
|
|
404
|
+
options: [{ value: "on", label: t("On") }, { value: "off", label: t("Off") }],
|
|
405
|
+
value: readChoice(own),
|
|
406
|
+
pick: (value) => {
|
|
407
|
+
writeChoice(own, value);
|
|
408
|
+
applyGameStyle();
|
|
409
|
+
},
|
|
410
|
+
}]),
|
|
411
|
+
];
|
|
386
412
|
}
|
|
387
413
|
/** A name as a part of an element's id, without spaces: "dice sound" is dice-sound. */
|
|
388
414
|
function idOf(name) {
|
|
@@ -481,7 +507,8 @@ function PageSettings() {
|
|
|
481
507
|
return (_jsxs("section", { class: "settings-group", children: [_jsx("h3", { children: t("This page") }), _jsx("p", { class: "setting-about", children: t("Kept in this browser alone.") }), rows.map((row) => {
|
|
482
508
|
const id = `page-${row.key}`;
|
|
483
509
|
const chosen = row.options.find((option) => option.value === row.value);
|
|
484
|
-
|
|
510
|
+
const described = [`${id}-about`, ...(chosen?.means === undefined ? [] : [`${id}-means`]), ...(row.note === undefined ? [] : [`${id}-note`])].join(" ");
|
|
511
|
+
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 })] }))] }, row.key));
|
|
485
512
|
})] }));
|
|
486
513
|
}
|
|
487
514
|
/**
|
|
@@ -557,7 +584,7 @@ function Segmented({ label, described, options, value, onPick }) {
|
|
|
557
584
|
}
|
|
558
585
|
/** A group of the campaign's settings by its place, in the page's language. */
|
|
559
586
|
function groupTitle(index) {
|
|
560
|
-
return [t("The game"), t("Learning the game"), t("The master's style"), t("Dice and measures"), t("Limits"), t("Your companions"), t("Pictures and language")][index] ?? "";
|
|
587
|
+
return [t("The game"), t("Learning the game"), t("The master's style"), t("Dice and measures"), t("Limits"), t("Your companions"), t("Pictures and language"), t("Git")][index] ?? "";
|
|
561
588
|
}
|
|
562
589
|
/** What a list's field suggests, as an example. */
|
|
563
590
|
function exampleOf(name) {
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// The game's style on the page (D-528, D-574): the theme of the campaign's system, its CSS of custom properties in the layer theme, its icons, and the free
|
|
2
|
+
// style sheet of the system's page module over the page's; or a theme installed on this computer, its CSS and icons alone; or the page's own. This browser
|
|
3
|
+
// remembers the choice for each system. A theme's own style sheet comes last, in the layer theme-style, while the player keeps it on, for each theme (D-575).
|
|
4
|
+
import { readAddress } from "../address.js";
|
|
1
5
|
import { readChoice } from "./prefs.js";
|
|
2
6
|
/** The event that tells the page the game's style changed: what draws an icon draws it again. */
|
|
3
7
|
export const gameStyleChanged = "rpg-engine:game-style";
|
|
@@ -17,9 +21,20 @@ export function systemStylePref(system) {
|
|
|
17
21
|
values: [...(shows ? ["game"] : []), ...(theme.themes ?? []).map((one) => installedStyle(one.id)), "page"],
|
|
18
22
|
};
|
|
19
23
|
}
|
|
20
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* The game's style as last read, for Settings: its system and its theme's name; whether it has anything to show, or its theme was refused; the themes
|
|
26
|
+
* installed; and the choice that keeps the own style sheet of the theme shown on, when it has one.
|
|
27
|
+
*/
|
|
21
28
|
export function gameStyle() {
|
|
22
|
-
|
|
29
|
+
const own = shownOwnStyle();
|
|
30
|
+
return {
|
|
31
|
+
system: theme.system,
|
|
32
|
+
name: theme.name,
|
|
33
|
+
shows: gameShows(),
|
|
34
|
+
refused: theme.refused === true,
|
|
35
|
+
themes: (theme.themes ?? []).map(({ id, name }) => ({ id, name })),
|
|
36
|
+
...(own === undefined ? {} : { ownStyle: own.choice }),
|
|
37
|
+
};
|
|
23
38
|
}
|
|
24
39
|
/** The installed theme the page shows for the campaign's system, by its id; undefined when it shows the game's style or its own. */
|
|
25
40
|
export function shownInstalledTheme() {
|
|
@@ -50,8 +65,9 @@ export function applyGameStyle() {
|
|
|
50
65
|
themeSheet.replaceSync(style.installed?.css ?? (style.game ? theme.css ?? "" : ""));
|
|
51
66
|
// The free style of the system's page module goes with its own theme alone: never under another's colours.
|
|
52
67
|
freeSheet.replaceSync(style.game ? freeStyle ?? "" : "");
|
|
53
|
-
|
|
54
|
-
|
|
68
|
+
adopt();
|
|
69
|
+
watchAddress();
|
|
70
|
+
showOwnStyle();
|
|
55
71
|
document.querySelectorAll(".title-too-wide").forEach((title) => title.classList.remove("title-too-wide"));
|
|
56
72
|
watchTitles();
|
|
57
73
|
fitTitles();
|
|
@@ -61,6 +77,72 @@ let theme = {};
|
|
|
61
77
|
let freeStyle;
|
|
62
78
|
let themeSheet;
|
|
63
79
|
let freeSheet;
|
|
80
|
+
// The link to the own style sheet of the theme shown, and its address.
|
|
81
|
+
let ownLink;
|
|
82
|
+
let ownAddress;
|
|
83
|
+
/** The page's sheets of the game's style, after the page's own: the theme's custom properties, the system's free style. */
|
|
84
|
+
function adopt() {
|
|
85
|
+
const ours = [themeSheet, freeSheet].filter((sheet) => sheet !== undefined);
|
|
86
|
+
document.adoptedStyleSheets = [...document.adoptedStyleSheets.filter((sheet) => !ours.includes(sheet)), ...ours];
|
|
87
|
+
}
|
|
88
|
+
/** The own style sheet of the theme shown, when it has one: its address, and the choice that keeps it on, by the theme. */
|
|
89
|
+
function shownOwnStyle() {
|
|
90
|
+
const style = chosen();
|
|
91
|
+
const address = style.installed?.style ?? (style.game ? theme.style : undefined);
|
|
92
|
+
const key = style.installed?.id ?? `game.${theme.system ?? ""}`;
|
|
93
|
+
return address === undefined ? undefined : { address, choice: { key: `rpg-engine.theme-style.${key}`, initial: "on", values: ["on", "off"] } };
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Shows a theme's own style sheet, from its address, or none: a link to the server's sheet of one line that imports it into the layer theme-style, so that
|
|
97
|
+
* no brace of it closes that layer and its url() come from its folder. The new one shows before the old goes; one that fails is asked again at the next change.
|
|
98
|
+
*/
|
|
99
|
+
function takeOwnStyle(address) {
|
|
100
|
+
if (address === ownAddress) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
ownAddress = address;
|
|
104
|
+
const gone = ownLink;
|
|
105
|
+
ownLink = undefined;
|
|
106
|
+
if (address === undefined) {
|
|
107
|
+
gone?.remove();
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const link = document.createElement("link");
|
|
111
|
+
link.rel = "stylesheet";
|
|
112
|
+
link.href = address;
|
|
113
|
+
link.addEventListener("load", () => {
|
|
114
|
+
gone?.remove();
|
|
115
|
+
fitTitles();
|
|
116
|
+
});
|
|
117
|
+
link.addEventListener("error", () => {
|
|
118
|
+
gone?.remove();
|
|
119
|
+
if (ownLink === link) {
|
|
120
|
+
link.remove();
|
|
121
|
+
ownLink = undefined;
|
|
122
|
+
ownAddress = undefined;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
ownLink = link;
|
|
126
|
+
document.head.append(link);
|
|
127
|
+
}
|
|
128
|
+
/** Whether the page shows Settings, which never take a theme's own style sheet: whatever it does, the switch that turns it off stays in reach. */
|
|
129
|
+
function inSettings() {
|
|
130
|
+
return readAddress(window.location.hash).section === "settings";
|
|
131
|
+
}
|
|
132
|
+
/** Takes the own style sheet off on the way into Settings, and back on the way out. */
|
|
133
|
+
function watchAddress() {
|
|
134
|
+
if (watchingAddress) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
watchingAddress = true;
|
|
138
|
+
window.addEventListener("hashchange", showOwnStyle);
|
|
139
|
+
}
|
|
140
|
+
/** Shows the own style sheet of the theme shown while the player keeps it on, out of Settings. */
|
|
141
|
+
function showOwnStyle() {
|
|
142
|
+
const own = shownOwnStyle();
|
|
143
|
+
takeOwnStyle(own !== undefined && readChoice(own.choice) === "on" && !inSettings() ? own.address : undefined);
|
|
144
|
+
}
|
|
145
|
+
let watchingAddress = false;
|
|
64
146
|
let watching = false;
|
|
65
147
|
let fitting = false;
|
|
66
148
|
// The card titles the theme's face may make too wide, and the campaign's name.
|
|
@@ -109,7 +191,9 @@ function fitTitles() {
|
|
|
109
191
|
fitting = false;
|
|
110
192
|
for (const title of document.querySelectorAll(titles)) {
|
|
111
193
|
const head = title.closest("summary, .card-head") ?? title;
|
|
112
|
-
|
|
194
|
+
// The campaign's name is cut by its link, not by its title.
|
|
195
|
+
const cut = title.querySelector(":scope > .title-home") ?? title;
|
|
196
|
+
if (!title.classList.contains("title-too-wide") && (cut.scrollWidth > cut.clientWidth + 1 || head.scrollWidth > head.clientWidth + 1)) {
|
|
113
197
|
title.classList.add("title-too-wide");
|
|
114
198
|
}
|
|
115
199
|
}
|
|
@@ -171,8 +171,9 @@ function place() {
|
|
|
171
171
|
const left = side === "start" ? startLeft : box.left + box.width / 2 - width / 2;
|
|
172
172
|
const top = side === "start" ? box.top + box.height / 2 - height / 2 : side === "above" ? box.top - gap - height : box.bottom + gap;
|
|
173
173
|
tip.dataset.side = side;
|
|
174
|
-
|
|
175
|
-
tip.style.setProperty("
|
|
174
|
+
// Inline and !important, as no style sheet's rule outweighs them, a theme's own either (D-575).
|
|
175
|
+
tip.style.setProperty("left", `${Math.round(within(left, margin, windowWidth - margin - width))}px`, "important");
|
|
176
|
+
tip.style.setProperty("top", `${Math.round(within(top, margin, windowHeight - margin - height))}px`, "important");
|
|
176
177
|
}
|
|
177
178
|
function askedSide(element) {
|
|
178
179
|
return element.classList.contains("tip-left") ? "start" : element.classList.contains("tip-below") ? "below" : "above";
|
|
@@ -215,9 +216,9 @@ function closeLayer(element) {
|
|
|
215
216
|
function supportsPopover(element) {
|
|
216
217
|
return typeof element.showPopover === "function";
|
|
217
218
|
}
|
|
218
|
-
// The moment a pointer rests on a control before its tip shows: the page's --wait.
|
|
219
|
+
// The moment a pointer rests on a control before its tip shows: the page's --wait, never more than a second, whatever a theme's own sheet says (D-575).
|
|
219
220
|
function waitTime() {
|
|
220
221
|
const value = getComputedStyle(document.documentElement).getPropertyValue("--wait").trim();
|
|
221
222
|
const time = Number.parseFloat(value);
|
|
222
|
-
return Number.isNaN(time) ? 500 : value.endsWith("ms") ? time : time * 1000;
|
|
223
|
+
return Number.isNaN(time) ? 500 : Math.min(Math.max(value.endsWith("ms") ? time : time * 1000, 0), 1000);
|
|
223
224
|
}
|