rpg-engine 0.21.0 → 0.23.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.
Files changed (165) hide show
  1. package/README.md +5 -5
  2. package/dist/campaign/create-campaign.d.ts +5 -0
  3. package/dist/campaign/create-campaign.js +40 -12
  4. package/dist/campaign/find-campaign.d.ts +5 -0
  5. package/dist/campaign/find-campaign.js +10 -5
  6. package/dist/campaign/host-files.d.ts +15 -4
  7. package/dist/campaign/host-files.js +134 -14
  8. package/dist/campaign/index.d.ts +4 -3
  9. package/dist/campaign/index.js +4 -3
  10. package/dist/campaign/port.d.ts +6 -0
  11. package/dist/campaign/port.js +24 -0
  12. package/dist/campaign/settings.d.ts +17 -0
  13. package/dist/campaign/settings.js +24 -1
  14. package/dist/cli/cli.js +33 -6
  15. package/dist/commands/config/config.js +15 -1
  16. package/dist/commands/config/dashboard.d.ts +4 -0
  17. package/dist/commands/config/dashboard.js +43 -7
  18. package/dist/commands/config/shown.js +4 -0
  19. package/dist/commands/config/words.d.ts +3 -1
  20. package/dist/commands/config/words.js +29 -2
  21. package/dist/commands/image.d.ts +3 -0
  22. package/dist/commands/image.js +31 -4
  23. package/dist/commands/import/import.d.ts +1 -1
  24. package/dist/commands/import/import.js +5 -0
  25. package/dist/commands/init.d.ts +2 -0
  26. package/dist/commands/init.js +21 -3
  27. package/dist/commands/mode.d.ts +1 -1
  28. package/dist/commands/package/data.js +27 -0
  29. package/dist/commands/package/theme.js +2 -1
  30. package/dist/commands/scene/scene.js +6 -1
  31. package/dist/commands/shared/books/adventures.d.ts +1 -0
  32. package/dist/commands/shared/books/adventures.js +1 -1
  33. package/dist/commands/shared/campaign/git.d.ts +25 -0
  34. package/dist/commands/shared/campaign/git.js +104 -0
  35. package/dist/commands/shared/campaign/images.js +5 -3
  36. package/dist/commands/shared/campaign/saves.js +5 -1
  37. package/dist/commands/shared/characters/voices.d.ts +2 -2
  38. package/dist/commands/shared/characters/voices.js +8 -5
  39. package/dist/commands/shared/packages/catalog.js +24 -5
  40. package/dist/commands/status.d.ts +1 -0
  41. package/dist/commands/status.js +8 -4
  42. package/dist/core/context.d.ts +17 -6
  43. package/dist/core/context.js +2 -1
  44. package/dist/core/version.d.ts +2 -0
  45. package/dist/core/version.js +5 -0
  46. package/dist/dashboard/guide/ar.md +12 -7
  47. package/dist/dashboard/guide/cs.md +11 -6
  48. package/dist/dashboard/guide/da.md +11 -6
  49. package/dist/dashboard/guide/de.md +13 -8
  50. package/dist/dashboard/guide/el.md +11 -6
  51. package/dist/dashboard/guide/en.md +10 -5
  52. package/dist/dashboard/guide/es.md +11 -6
  53. package/dist/dashboard/guide/fi.md +11 -6
  54. package/dist/dashboard/guide/fr.md +12 -7
  55. package/dist/dashboard/guide/he.md +11 -6
  56. package/dist/dashboard/guide/hi.md +11 -6
  57. package/dist/dashboard/guide/hu.md +11 -6
  58. package/dist/dashboard/guide/is.md +11 -6
  59. package/dist/dashboard/guide/it.md +42 -37
  60. package/dist/dashboard/guide/ja.md +12 -7
  61. package/dist/dashboard/guide/ko.md +11 -6
  62. package/dist/dashboard/guide/nb.md +12 -7
  63. package/dist/dashboard/guide/nl.md +13 -8
  64. package/dist/dashboard/guide/pl.md +11 -6
  65. package/dist/dashboard/guide/pt.md +11 -6
  66. package/dist/dashboard/guide/ro.md +11 -6
  67. package/dist/dashboard/guide/ru.md +12 -7
  68. package/dist/dashboard/guide/sv.md +11 -6
  69. package/dist/dashboard/guide/tr.md +12 -7
  70. package/dist/dashboard/guide/uk.md +12 -7
  71. package/dist/dashboard/guide/zh.md +11 -6
  72. package/dist/dashboard/i18n/ar.json +30 -2
  73. package/dist/dashboard/i18n/cs.json +30 -2
  74. package/dist/dashboard/i18n/da.json +30 -2
  75. package/dist/dashboard/i18n/de.json +30 -2
  76. package/dist/dashboard/i18n/el.json +30 -2
  77. package/dist/dashboard/i18n/es.json +30 -2
  78. package/dist/dashboard/i18n/fi.json +30 -2
  79. package/dist/dashboard/i18n/fr.json +30 -2
  80. package/dist/dashboard/i18n/he.json +30 -2
  81. package/dist/dashboard/i18n/hi.json +30 -2
  82. package/dist/dashboard/i18n/hu.json +30 -2
  83. package/dist/dashboard/i18n/is.json +30 -2
  84. package/dist/dashboard/i18n/it.json +30 -2
  85. package/dist/dashboard/i18n/ja.json +30 -2
  86. package/dist/dashboard/i18n/ko.json +30 -2
  87. package/dist/dashboard/i18n/nb.json +30 -2
  88. package/dist/dashboard/i18n/nl.json +30 -2
  89. package/dist/dashboard/i18n/pl.json +30 -2
  90. package/dist/dashboard/i18n/pt.json +30 -2
  91. package/dist/dashboard/i18n/ro.json +30 -2
  92. package/dist/dashboard/i18n/ru.json +30 -2
  93. package/dist/dashboard/i18n/sv.json +30 -2
  94. package/dist/dashboard/i18n/tr.json +30 -2
  95. package/dist/dashboard/i18n/uk.json +30 -2
  96. package/dist/dashboard/i18n/zh.json +30 -2
  97. package/dist/dashboard/packages/installed.js +2 -2
  98. package/dist/dashboard/packages/packages.js +1 -1
  99. package/dist/dashboard/parts/labels.js +7 -0
  100. package/dist/dashboard/settings/settings.js +45 -9
  101. package/dist/dashboard/shell/notices.js +1 -1
  102. package/dist/dashboard/shell/system-style.js +89 -5
  103. package/dist/dashboard/shell/tooltip.js +5 -4
  104. package/dist/dashboard/style.css +245 -84
  105. package/dist/git/git.d.ts +12 -0
  106. package/dist/git/git.js +175 -0
  107. package/dist/git/ignore.d.ts +2 -0
  108. package/dist/git/ignore.js +16 -0
  109. package/dist/git/index.d.ts +2 -0
  110. package/dist/git/index.js +2 -0
  111. package/dist/helpers/briefs.d.ts +4 -0
  112. package/dist/helpers/briefs.js +13 -0
  113. package/dist/helpers/chosen.d.ts +8 -4
  114. package/dist/helpers/chosen.js +38 -14
  115. package/dist/helpers/index.d.ts +3 -2
  116. package/dist/helpers/index.js +5 -3
  117. package/dist/helpers/opencode.d.ts +13 -0
  118. package/dist/helpers/opencode.js +202 -0
  119. package/dist/importer/index.d.ts +1 -1
  120. package/dist/importer/index.js +1 -1
  121. package/dist/instructions/index.d.ts +2 -2
  122. package/dist/instructions/index.js +3 -3
  123. package/dist/languages/pack.js +2 -1
  124. package/dist/server/approver.d.ts +4 -2
  125. package/dist/server/approver.js +27 -7
  126. package/dist/server/bell/antigravity.d.ts +10 -0
  127. package/dist/server/bell/antigravity.js +95 -0
  128. package/dist/server/bell/index.d.ts +2 -0
  129. package/dist/server/bell/index.js +2 -0
  130. package/dist/server/bell/listener.d.ts +43 -0
  131. package/dist/server/bell/listener.js +149 -0
  132. package/dist/server/dashboard/files.d.ts +3 -2
  133. package/dist/server/dashboard/files.js +44 -15
  134. package/dist/server/dashboard/index.d.ts +25 -3
  135. package/dist/server/dashboard/index.js +58 -23
  136. package/dist/server/dashboard/news.d.ts +5 -2
  137. package/dist/server/dashboard/news.js +82 -14
  138. package/dist/server/dashboard/ports.d.ts +17 -2
  139. package/dist/server/dashboard/ports.js +60 -4
  140. package/dist/server/mcp.d.ts +6 -4
  141. package/dist/server/mcp.js +66 -18
  142. package/dist/server/player-acts.d.ts +21 -1
  143. package/dist/server/player-acts.js +38 -2
  144. package/dist/server/route/front.d.ts +3 -0
  145. package/dist/server/route/front.js +97 -0
  146. package/dist/server/route/index.d.ts +3 -0
  147. package/dist/server/route/index.js +3 -0
  148. package/dist/server/route/notes.d.ts +8 -0
  149. package/dist/server/route/notes.js +50 -0
  150. package/dist/server/route/router.d.ts +31 -0
  151. package/dist/server/route/router.js +215 -0
  152. package/dist/themes/css.d.ts +1 -1
  153. package/dist/themes/css.js +101 -2
  154. package/dist/themes/index.d.ts +1 -1
  155. package/dist/themes/index.js +1 -1
  156. package/dist/themes/theme.d.ts +34 -3
  157. package/dist/themes/theme.js +176 -19
  158. package/instructions/core.md +1 -0
  159. package/instructions/dashboard-guide.md +1 -1
  160. package/instructions/start.md +1 -1
  161. package/instructions/voices-opencode.md +1 -0
  162. package/package.json +3 -2
  163. package/plugins/opencode.js +174 -0
  164. package/dist/server/bell-listener.d.ts +0 -9
  165. package/dist/server/bell-listener.js +0 -83
@@ -1,8 +1,19 @@
1
+ // The CSS of a theme, written by the engine alone: its faces, then one layer, theme, of custom properties and nothing else, which the page's rules read; and
2
+ // in the layer guarantees, the colours its focus ring and tooltip draw with.
3
+ import { mix } from "./contrast.js";
1
4
  // What follows a theme's face, always: a Latin face has no Arabic or Japanese letters, and the page's own faces have.
2
5
  const textFaces = `system-ui, -apple-system, "Segoe UI", sans-serif`;
3
6
  const storyFaces = `"Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif`;
4
7
  const titleCases = { "as-written": "none", capitals: "uppercase", "small-capitals": "none" };
5
- /** The CSS of a theme: its @font-face rules, then the layer theme with the values of both modes; its files at this address, such as /theme. */
8
+ // A shape as a corner: its radius and the shape CSS gives it; a cut corner is 8 px of bevel, where the browser draws one, else a round corner.
9
+ const shapeCorners = { rounded: undefined, square: ["0", "round"], pill: ["999px", "round"], cut: ["8px", "bevel"] };
10
+ const cardCorners = { round: "round", cut: "bevel", notch: "notch", scoop: "scoop" };
11
+ // The portraits' shapes: their corner and the rim of their glass, which is round only on a round coin.
12
+ const portraitCorners = { round: undefined, rounded: ["22%", "round"], square: ["4px", "round"], cut: ["28%", "bevel"] };
13
+ // The inks the page draws on the documents' paper and the maps', as tokens.css gives them: their folds, rules and grids are a little of it on the paper the theme gives.
14
+ const documentInk = "#2f261b";
15
+ const mapInk = "#3f2f1f";
16
+ /** The CSS of a theme: its @font-face rules, the layer theme with the values of both modes, the colours of the guarantees; its files at this address, such as /theme. */
6
17
  export function themeCss(theme, address) {
7
18
  const at = (file) => `${address}/${file.split("/").map(encodeURIComponent).join("/")}`;
8
19
  const faces = theme.fonts.map((font) => `@font-face { font-family: "${font.family}"; src: url("${at(font.file)}"); font-weight: ${font.weight}; font-display: swap; }`);
@@ -15,9 +26,25 @@ export function themeCss(theme, address) {
15
26
  ...(theme.titleCase === undefined ? [] : [`--title-case: ${titleCases[theme.titleCase]};`, `--title-variant: ${theme.titleCase === "small-capitals" ? "small-caps" : "normal"};`]),
16
27
  ...(theme.titleSpacing === undefined ? [] : [`--title-spacing: ${theme.titleSpacing}em;`]),
17
28
  ...(theme.innerLine === undefined ? [] : [`--card-inner-line: ${theme.innerLine};`]),
29
+ ...(theme.cardCorner === undefined || theme.cardCorner === "round" ? [] : [`--card-corner: ${cardCorners[theme.cardCorner]};`]),
30
+ ...shape("--button", theme.buttonShape),
31
+ ...tabs(theme.tabShape),
32
+ ...papers(theme.papers),
33
+ ...portraits(theme),
18
34
  ];
19
35
  const modes = ["light", "dark"].map((mode) => block(`:root[data-theme="${mode}"]`, [`color-scheme: ${mode};`, ...modeValues(theme, mode, at)]));
20
- return [...faces, `@layer theme {\n${[block(":root", common), ...modes].join("\n")}\n}`, ""].join("\n");
36
+ return [...faces, `@layer theme {\n${[block(":root", common), ...modes].join("\n")}\n}`, `@layer guarantees {\n${guarded(theme).join("\n")}\n}`, ""].join("\n");
37
+ }
38
+ /**
39
+ * The colours the focus ring and the tooltip draw with, the theme's, in the layer guarantees: on every element and !important, as guarantees.css sets the
40
+ * page's own, so that no rule of a theme's own style sheet changes them (D-575).
41
+ */
42
+ function guarded(theme) {
43
+ return ["light", "dark"].map((mode) => {
44
+ const colours = theme.modes[mode].colours;
45
+ const values = { accent: colours.accent, ink: colours.ink, paper: colours.paper, gold: colours.gold };
46
+ return block(`:root[data-theme="${mode}"], :root[data-theme="${mode}"] *`, Object.entries(values).map(([name, value]) => `--guard-${name}: ${value} !important;`));
47
+ });
21
48
  }
22
49
  function modeValues(theme, mode, at) {
23
50
  const given = theme.modes[mode];
@@ -34,7 +61,12 @@ function modeValues(theme, mode, at) {
34
61
  ...(given.barEdge === undefined ? [] : [`--bar-edge: ${given.barEdge};`]),
35
62
  ...texture("--page-texture", given.pageTexture, at),
36
63
  ...texture("--bar-texture", given.barTexture, at),
64
+ ...texture("--head-picture", given.headPicture, at),
65
+ ...(given.headPicture === undefined ? [] : [`--head-picture-shown: "";`]),
37
66
  ...(theme.ornament === undefined ? [] : [`--card-ornament: ${ornament(false)};`, `--card-ornament-mirrored: ${ornament(true)};`]),
67
+ ...cardTexture(theme.cardTexture, given.cardGrain, at),
68
+ ...shadows(theme.shadows, given, mode),
69
+ ...(theme.portraitFrame === undefined || theme.portraitFrame === "none" ? [] : [`--portrait-frame: ${frame(theme.portraitFrame, given.portraitFrame)};`]),
38
70
  ];
39
71
  }
40
72
  function face(token, family, after) {
@@ -48,6 +80,73 @@ function corners(card) {
48
80
  const scale = { xs: card / 3, s: card / 2, m: (card * 2) / 3, l: card, xl: (card * 4) / 3 };
49
81
  return Object.entries(scale).map(([step, value]) => `--radius-${step}: ${Math.round(value)}px;`);
50
82
  }
83
+ /** The corner of a kind of control, the page's own while the theme leaves it rounded. */
84
+ function shape(token, given) {
85
+ const corner = given === undefined ? undefined : shapeCorners[given];
86
+ return corner === undefined ? [] : [`${token}-radius: ${corner[0]};`, `${token}-corner: ${corner[1]};`];
87
+ }
88
+ /** The chosen tab: the page's bar under it, or a tint of the accent over the page, in the shape asked. */
89
+ function tabs(given) {
90
+ if (given === undefined || given === "underline") {
91
+ return [];
92
+ }
93
+ const corner = shapeCorners[given] ?? ["var(--radius-m)", "round"];
94
+ return [`--tab-radius: ${corner[0]};`, `--tab-corner: ${corner[1]};`, `--tab-chosen: color-mix(in srgb, var(--accent) 16%, var(--paper));`, `--tab-bar: transparent;`];
95
+ }
96
+ /** The paper of the documents, with its folds and rules drawn of its ink; and the land of the maps, a place's floor and grid and the world's fog drawn of it. */
97
+ function papers(given) {
98
+ return [
99
+ ...(given.documents === undefined ? [] : [`--doc-paper: ${given.documents};`, `--doc-fold: ${mix(documentInk, given.documents, 0.12)};`, `--doc-rule: ${mix(documentInk, given.documents, 0.3)};`]),
100
+ ...(given.maps === undefined
101
+ ? []
102
+ : [`--m-land: ${given.maps};`, `--map-paper: ${given.maps};`, `--map-floor: ${mix("#ffffff", given.maps, 0.3)};`, `--map-grid: ${mix(mapInk, given.maps, 0.2)};`, `--map-fog: ${mix(mapInk, given.maps, 0.15)};`]),
103
+ ];
104
+ }
105
+ /** The portraits' corner and their glass's rim, which only a round coin has. */
106
+ function portraits(theme) {
107
+ const corner = theme.portraitShape === undefined ? undefined : portraitCorners[theme.portraitShape];
108
+ return corner === undefined ? [] : [`--portrait-radius: ${corner[0]};`, `--portrait-corner: ${corner[1]};`, `--portrait-rim: linear-gradient(transparent, transparent);`];
109
+ }
110
+ /** A frame inside a portrait's edge, over the picture: one line, a thick one, or two with a dark line between them. */
111
+ function frame(kind, colour) {
112
+ return {
113
+ thin: `inset 0 0 0 2px ${colour}`,
114
+ thick: `inset 0 0 0 4px ${colour}`,
115
+ double: `inset 0 0 0 1.5px ${colour}, inset 0 0 0 3px rgb(0 0 0 / 0.55), inset 0 0 0 4.5px ${colour}`,
116
+ }[kind];
117
+ }
118
+ /** The cards' texture, drawn by the page in the grain's colour, faint under the card's own colour: 30% where it is thickest, which the check measures. */
119
+ function cardTexture(given, grain, at) {
120
+ if (given === undefined) {
121
+ return [];
122
+ }
123
+ const veil = "linear-gradient(color-mix(in srgb, var(--panel) 70%, transparent), color-mix(in srgb, var(--panel) 70%, transparent))";
124
+ const place = given.fit === "cover" ? "center / cover no-repeat" : "0 0 / auto repeat";
125
+ return [`--card-texture-layer: ${veil}, url("${at(given.picture)}?ink=${encodeURIComponent(grain)}&texture") ${place};`];
126
+ }
127
+ /**
128
+ * The shadows of whatever lifts, of the colour the mode gives or the page's: soft as the page's own, sharp as a cut-out laid on the page, none, or a glow
129
+ * all round; what lifts most, what floats, the most.
130
+ */
131
+ function shadows(kind, given, mode) {
132
+ if (kind === undefined || (kind === "soft" && given.shadow === undefined)) {
133
+ return [];
134
+ }
135
+ const colour = given.shadow ?? (kind === "glow" ? given.colours.accent : mode === "light" ? "#182c4c" : "#000000");
136
+ const of = (share) => `color-mix(in srgb, ${colour} ${share}%, transparent)`;
137
+ const shadow = {
138
+ soft: {
139
+ lift: `0 1px 2px ${of(mode === "light" ? 8 : 30)}${mode === "light" ? "" : ", inset 0 1px 0 rgb(255 255 255 / 0.05)"}`,
140
+ raise: `0 6px 18px -10px ${of(mode === "light" ? 35 : 60)}`,
141
+ up: `0 -6px 18px -12px ${of(35)}`,
142
+ overlay: `0 14px 32px -12px ${of(45)}, 0 3px 8px -3px ${of(25)}`,
143
+ },
144
+ sharp: { lift: `1px 1px 0 ${of(30)}`, raise: `3px 3px 0 ${of(22)}`, up: `0 -3px 0 ${of(22)}`, overlay: `5px 5px 0 ${of(35)}` },
145
+ none: { lift: "0 0 0 transparent", raise: "0 0 0 transparent", up: "0 0 0 transparent", overlay: "0 0 0 transparent" },
146
+ glow: { lift: `0 0 0 1px ${of(18)}`, raise: `0 0 16px -4px ${of(55)}`, up: `0 -4px 16px -6px ${of(45)}`, overlay: `0 0 28px -6px ${of(65)}, 0 0 0 1px ${of(35)}` },
147
+ }[kind];
148
+ return [`--lift: ${shadow.lift};`, `--raise: ${shadow.raise};`, `--raise-up: ${shadow.up};`, `--overlay: ${shadow.overlay};`];
149
+ }
51
150
  function texture(token, given, at) {
52
151
  if (given === undefined) {
53
152
  return [];
@@ -1,4 +1,4 @@
1
1
  export { contrast } from "./contrast.ts";
2
2
  export { themeCss } from "./css.ts";
3
3
  export { type InstalledTheme, installedThemes, isThemeId, themeId } from "./installed.ts";
4
- export { drawnOrnament, readTheme, themeFile, themeFileName, themeFilesNamed, themeIconNames, type ThemeReading } from "./theme.ts";
4
+ export { drawnOrnament, drawnTexture, readTheme, type Theme, themeFile, themeFileName, themeFilesNamed, themeIconNames, type ThemeReading } from "./theme.ts";
@@ -3,4 +3,4 @@
3
3
  export { contrast } from "./contrast.js";
4
4
  export { themeCss } from "./css.js";
5
5
  export { installedThemes, isThemeId, themeId } from "./installed.js";
6
- export { drawnOrnament, readTheme, themeFile, themeFileName, themeFilesNamed, themeIconNames } from "./theme.js";
6
+ export { drawnOrnament, drawnTexture, readTheme, themeFile, themeFileName, themeFilesNamed, themeIconNames } from "./theme.js";
@@ -34,6 +34,25 @@ export interface Theme {
34
34
  innerLine?: "none" | "solid" | "dashed" | "dotted";
35
35
  /** The picture in a card's lower corner, a file of the folder drawn in one colour. */
36
36
  ornament?: string;
37
+ /** The cards' corners cut, notched or scooped instead of round, as far as `corners` says. */
38
+ cardCorner?: "round" | "cut" | "notch" | "scoop";
39
+ /** A texture under the cards, an SVG drawn in each mode's grain colour, faint under the card's own colour. */
40
+ cardTexture?: ThemeTexture;
41
+ /** The shape of the buttons of words, and of the chosen tab. */
42
+ buttonShape?: Shape;
43
+ tabShape?: "underline" | Shape;
44
+ /** The shadows of whatever lifts: soft as the page's, sharp, none, or a glow. */
45
+ shadows?: "soft" | "sharp" | "none" | "glow";
46
+ /** The paper of the maps and of the documents found, the same in both modes. */
47
+ papers: {
48
+ maps?: string;
49
+ documents?: string;
50
+ };
51
+ /** The portraits' shape and a frame drawn inside their edge. */
52
+ portraitShape?: "round" | "rounded" | "square" | "cut";
53
+ portraitFrame?: "none" | "thin" | "thick" | "double";
54
+ /** A style sheet of its own, a file of the folder, which the page adds over its rules in a layer of its own, unchecked. */
55
+ style?: string;
37
56
  /** The lines of each icon it draws, by name: the d of its paths, on a grid of 24. */
38
57
  icons: Record<string, string>;
39
58
  modes: Record<ThemeModeName, ThemeMode>;
@@ -53,7 +72,17 @@ export interface ThemeMode {
53
72
  barEdge?: string;
54
73
  pageTexture?: ThemeTexture;
55
74
  barTexture?: ThemeTexture;
75
+ /** A picture at the end of the top, beside the campaign's name, under no words. */
76
+ headPicture?: ThemeTexture;
77
+ /** The colour the cards' texture is drawn in. */
78
+ cardGrain: string;
79
+ /** The colour of the shadows, when not the page's. */
80
+ shadow?: string;
81
+ /** The colour of the portraits' frame. */
82
+ portraitFrame: string;
56
83
  }
84
+ /** The shapes of a button or a tab: the page's rounded corners, square, a pill, or cut. */
85
+ type Shape = "rounded" | "square" | "pill" | "cut";
57
86
  /** A picture under the page or the top, repeated or covering it. */
58
87
  export interface ThemeTexture {
59
88
  picture: string;
@@ -69,10 +98,12 @@ export declare function readTheme(folder: string): ThemeReading;
69
98
  /** The real path of a file of a theme's folder, only when it is one and inside it, links resolved: what the dashboard serves. */
70
99
  export declare function themeFile(folder: string, name: string): string | undefined;
71
100
  /**
72
- * The files a theme.yaml names, with forward slashes, as written from its folder: its fonts and their licences, its ornament, icons and textures. None when
73
- * it does not read: its checks say why.
101
+ * The files a theme.yaml names, with forward slashes, as written from its folder: its fonts and their licences, its ornament, icons, textures and pictures,
102
+ * its style sheet and the pictures that names, read by `read`. None when it does not read: its checks say why.
74
103
  */
75
- export declare function themeFilesNamed(text: string): string[];
104
+ export declare function themeFilesNamed(text: string, read?: (name: string) => string | undefined): string[];
76
105
  /** An ornament drawn in one colour, turned for a page that reads right to left: the theme gives one drawing for both modes and both directions. */
77
106
  export declare function drawnOrnament(svg: string, ink: string, mirrored: boolean): string;
107
+ /** The cards' texture drawn in one colour: what it draws in currentColor, and what it fills without saying how, in that colour. */
108
+ export declare function drawnTexture(svg: string, ink: string): string;
78
109
  export {};
@@ -1,7 +1,7 @@
1
1
  // A theme of the dashboard (D-527, D-528): a folder of data, theme.yaml with its fonts, pictures and icons, read and checked as the engine reads its game
2
2
  // system. It gives values alone, colours, corners, fonts and the hooks the page documents; the page's own rules read them, so no part is the theme's to redraw.
3
3
  import { existsSync, readdirSync, readFileSync, realpathSync, statSync } from "node:fs";
4
- import { extname, isAbsolute, join, relative, sep } from "node:path";
4
+ import { extname, isAbsolute, join, posix, relative, sep } from "node:path";
5
5
  import { parse } from "yaml";
6
6
  import { z } from "zod";
7
7
  import { contrast, distance, isLight, mix } from "./contrast.js";
@@ -39,12 +39,12 @@ export function readTheme(folder) {
39
39
  if (problem !== undefined) {
40
40
  problems.push(`${place}: ${problem}`);
41
41
  }
42
- return name.replaceAll("\\", "/");
42
+ return written(name);
43
43
  };
44
44
  const fonts = (given.fonts ?? []).map((font, index) => {
45
45
  file(`fonts.${index}.file`, font.file, fontFiles);
46
46
  file(`fonts.${index}.license`, font.license, licenseFiles);
47
- return { family: font.family, file: font.file.replaceAll("\\", "/"), weight: String(font.weight ?? 400) };
47
+ return { family: font.family, file: written(font.file), weight: String(font.weight ?? 400) };
48
48
  });
49
49
  const family = (key) => {
50
50
  const name = given[key];
@@ -74,20 +74,35 @@ export function readTheme(folder) {
74
74
  }
75
75
  }
76
76
  const ornament = given.cards?.ornament === undefined ? undefined : file("cards.ornament", given.cards.ornament, [".svg"]);
77
+ const cardTexture = given.cards?.texture === undefined ? undefined : { picture: file("cards.texture.picture", given.cards.texture.picture, [".svg"]), fit: given.cards.texture.fit ?? "tile" };
78
+ if (cardTexture !== undefined && fileProblem(folder, cardTexture.picture, [".svg"]) === undefined) {
79
+ problems.push(...oneColourProblems(readFileSync(join(folder, cardTexture.picture), "utf8")).map((problem) => `cards.texture.picture: ${cardTexture.picture} ${problem}`));
80
+ }
81
+ const style = given.style === undefined ? undefined : file("style", given.style, [".css"]);
82
+ if (style !== undefined && fileProblem(folder, style, [".css"]) === undefined) {
83
+ problems.push(...styleProblems(folder, style));
84
+ }
85
+ const hooks = { tabs: given.tabs?.shape ?? "underline", grain: cardTexture !== undefined, frame: (given.portraits?.frame ?? "none") !== "none" };
77
86
  const modes = {};
78
87
  for (const mode of themeModes) {
79
88
  const asked = given[mode];
80
89
  const colours = derived(asked);
90
+ const cardEdge = asked["card-edge"] ?? colours.rule;
81
91
  modes[mode] = {
82
92
  colours,
83
- cardEdge: asked["card-edge"] ?? colours.rule,
93
+ cardEdge,
84
94
  ...(asked["title-glow"] === undefined || asked["title-glow"] === "none" ? {} : { titleGlow: asked["title-glow"] }),
85
95
  ...(asked["bar-edge"] === undefined || asked["bar-edge"] === "none" ? {} : { barEdge: asked["bar-edge"] }),
86
96
  ...(asked["page-texture"] === undefined ? {} : { pageTexture: { picture: file(`${mode}.page-texture.picture`, asked["page-texture"].picture, pictureFiles), fit: asked["page-texture"].fit ?? "tile" } }),
87
97
  ...(asked["bar-texture"] === undefined ? {} : { barTexture: { picture: file(`${mode}.bar-texture.picture`, asked["bar-texture"].picture, pictureFiles), fit: asked["bar-texture"].fit ?? "tile" } }),
98
+ ...(asked["head-picture"] === undefined ? {} : { headPicture: { picture: file(`${mode}.head-picture.picture`, asked["head-picture"].picture, pictureFiles), fit: asked["head-picture"].fit ?? "cover" } }),
99
+ cardGrain: asked["card-grain"] ?? cardEdge,
100
+ ...optional("shadow", asked.shadow),
101
+ portraitFrame: asked["portrait-frame"] ?? colours.gold,
88
102
  };
89
- problems.push(...legibilityProblems(mode, modes[mode]));
103
+ problems.push(...legibilityProblems(mode, modes[mode], hooks));
90
104
  }
105
+ problems.push(...paperProblems(given.papers ?? {}));
91
106
  const theme = {
92
107
  name: given.name,
93
108
  ...optional("version", given.version),
@@ -102,6 +117,15 @@ export function readTheme(folder) {
102
117
  ...optional("titleSpacing", given.titles?.spacing),
103
118
  ...optional("innerLine", given.cards?.["inner-line"]),
104
119
  ...optional("ornament", ornament),
120
+ ...optional("cardCorner", given.cards?.corner),
121
+ ...optional("cardTexture", cardTexture),
122
+ ...optional("buttonShape", given.buttons?.shape),
123
+ ...optional("tabShape", given.tabs?.shape),
124
+ ...optional("shadows", given.shadows),
125
+ papers: given.papers ?? {},
126
+ ...optional("portraitShape", given.portraits?.shape),
127
+ ...optional("portraitFrame", given.portraits?.frame),
128
+ ...optional("style", style),
105
129
  icons,
106
130
  modes,
107
131
  };
@@ -120,10 +144,10 @@ export function themeFile(folder, name) {
120
144
  }
121
145
  }
122
146
  /**
123
- * The files a theme.yaml names, with forward slashes, as written from its folder: its fonts and their licences, its ornament, icons and textures. None when
124
- * it does not read: its checks say why.
147
+ * The files a theme.yaml names, with forward slashes, as written from its folder: its fonts and their licences, its ornament, icons, textures and pictures,
148
+ * its style sheet and the pictures that names, read by `read`. None when it does not read: its checks say why.
125
149
  */
126
- export function themeFilesNamed(text) {
150
+ export function themeFilesNamed(text, read = () => undefined) {
127
151
  let data;
128
152
  try {
129
153
  data = parse(text);
@@ -135,9 +159,39 @@ export function themeFilesNamed(text) {
135
159
  const field = (value, key) => (typeof value === "object" && value !== null ? value[key] : undefined);
136
160
  const fonts = Array.isArray(given.fonts) ? given.fonts.flatMap((font) => [field(font, "file"), field(font, "license")]) : [];
137
161
  const icons = typeof given.icons === "object" && given.icons !== null ? Object.values(given.icons) : [];
138
- const textures = ["light", "dark"].flatMap((mode) => ["page-texture", "bar-texture"].map((texture) => field(field(given[mode], texture), "picture")));
139
- const named = [...fonts, ...icons, ...textures, field(given.cards, "ornament")];
140
- return named.filter((one) => typeof one === "string").map((one) => one.replaceAll("\\", "/").replace(/^(\.\/)+/, ""));
162
+ const textures = ["light", "dark"].flatMap((mode) => ["page-texture", "bar-texture", "head-picture"].map((texture) => field(field(given[mode], texture), "picture")));
163
+ const named = [...fonts, ...icons, ...textures, field(given.cards, "ornament"), field(field(given.cards, "texture"), "picture"), given.style];
164
+ const files = named.filter((one) => typeof one === "string").map(written);
165
+ const style = typeof given.style === "string" ? written(given.style) : undefined;
166
+ const sheet = style === undefined ? undefined : read(style);
167
+ return sheet === undefined || style === undefined ? files : [...files, ...styleUrls(sheet).filter(namesFile).map((url) => fromStyle(style, url))];
168
+ }
169
+ /** A name as written from a theme's folder, with forward slashes and no ./ before it. */
170
+ function written(name) {
171
+ return name.replaceAll("\\", "/").replace(/^(\.\/)+/, "");
172
+ }
173
+ /** The addresses a style sheet's url() give, as written, without their quotes. */
174
+ function styleUrls(css) {
175
+ return [...withoutComments(css).matchAll(/url\(\s*(?:"([^"]*)"|'([^']*)'|([^)\s]*))\s*\)/gi)].map((match) => (match[1] ?? match[2] ?? match[3]).trim());
176
+ }
177
+ /** Whether a style sheet's url() names a file from the sheet: not an element of the page (#glow), an address with a scheme, nor one from the page's root. */
178
+ function namesFile(url) {
179
+ return !url.startsWith("#") && !url.startsWith("/") && !/^[a-z][a-z\d+.-]*:/i.test(url);
180
+ }
181
+ /** An address of a theme's style sheet as a file of its folder: relative to the sheet, decoded as the browser does, its ./ and ../ resolved; one that climbs out keeps its .. */
182
+ function fromStyle(style, url) {
183
+ const path = url.split(/[?#]/)[0];
184
+ let name = path;
185
+ try {
186
+ name = decodeURIComponent(path);
187
+ }
188
+ catch {
189
+ // No valid escape: the browser asks for it as written, and the check says it is missing.
190
+ }
191
+ return posix.normalize(posix.join(posix.dirname(style), name));
192
+ }
193
+ function withoutComments(css) {
194
+ return css.replace(/\/\*[\s\S]*?\*\//g, "");
141
195
  }
142
196
  /** An ornament drawn in one colour, turned for a page that reads right to left: the theme gives one drawing for both modes and both directions. */
143
197
  export function drawnOrnament(svg, ink, mirrored) {
@@ -155,6 +209,12 @@ export function drawnOrnament(svg, ink, mirrored) {
155
209
  const end = coloured.lastIndexOf("</svg>");
156
210
  return `${coloured.slice(0, start)}<g transform="translate(${across} 0) scale(-1 1)">${coloured.slice(start, end)}</g>${coloured.slice(end)}`;
157
211
  }
212
+ /** The cards' texture drawn in one colour: what it draws in currentColor, and what it fills without saying how, in that colour. */
213
+ export function drawnTexture(svg, ink) {
214
+ const coloured = svg.replaceAll("currentColor", ink);
215
+ const opened = /<svg\b[^>]*>/.exec(coloured);
216
+ return opened === null || /\sfill\s*=/.test(opened[0]) ? coloured : `${coloured.slice(0, opened.index + 4)} fill="${ink}"${coloured.slice(opened.index + 4)}`;
217
+ }
158
218
  /** Whether each part of a file's name is written as the disk has it, capitals too: Windows finds Images/Corner.SVG, Linux does not. */
159
219
  function writtenAsIs(folder, name) {
160
220
  let at = folder;
@@ -182,10 +242,17 @@ const modeSchema = z.object({
182
242
  "bar-edge": z.union([z.literal("none"), colour]).optional(),
183
243
  "page-texture": texture.optional(),
184
244
  "bar-texture": texture.optional(),
245
+ "head-picture": texture.optional(),
246
+ "card-grain": colour.optional(),
247
+ shadow: colour.optional(),
248
+ "portrait-frame": colour.optional(),
185
249
  }).strict();
250
+ const shapes = ["rounded", "square", "pill", "cut"];
186
251
  const themeSchema = z.object({
187
252
  name: z.string().min(1),
188
253
  version: z.union([z.string().min(1), z.number()]).transform(String).optional(),
254
+ // The lowest rpg-engine that reads it, such as "0.22": checked as it is installed.
255
+ engine: z.string({ error: 'engine is written in quotes, as engine: "0.22": without them YAML reads 0.30 as the number 0.3' }).regex(/^\d+(\.\d+){0,2}$/, 'engine is the lowest rpg-engine version, such as "0.22", not a range').optional(),
189
256
  fonts: z.array(z.object({
190
257
  family: z.string().regex(/^[\p{L}\p{N} _-]+$/u, { error: "letters, numbers, spaces and hyphens alone" }),
191
258
  file: fileName,
@@ -198,7 +265,18 @@ const themeSchema = z.object({
198
265
  "number-font": z.enum(["text", "title"]).optional(),
199
266
  corners: z.number().min(0).max(16, { error: "a card's corner in pixels, from 0 to 16" }).optional(),
200
267
  titles: z.object({ case: z.enum(["as-written", "capitals", "small-capitals"]).optional(), spacing: z.number().min(-0.02).max(0.15).optional() }).strict().optional(),
201
- cards: z.object({ "inner-line": z.enum(["none", "solid", "dashed", "dotted"]).optional(), ornament: fileName.optional() }).strict().optional(),
268
+ cards: z.object({
269
+ "inner-line": z.enum(["none", "solid", "dashed", "dotted"]).optional(),
270
+ ornament: fileName.optional(),
271
+ corner: z.enum(["round", "cut", "notch", "scoop"]).optional(),
272
+ texture: texture.optional(),
273
+ }).strict().optional(),
274
+ buttons: z.object({ shape: z.enum(shapes).optional() }).strict().optional(),
275
+ tabs: z.object({ shape: z.enum(["underline", ...shapes]).optional() }).strict().optional(),
276
+ shadows: z.enum(["soft", "sharp", "none", "glow"]).optional(),
277
+ papers: z.object({ maps: colour.optional(), documents: colour.optional() }).strict().optional(),
278
+ portraits: z.object({ shape: z.enum(["round", "rounded", "square", "cut"]).optional(), frame: z.enum(["none", "thin", "thick", "double"]).optional() }).strict().optional(),
279
+ style: fileName.optional(),
202
280
  icons: z.record(z.string(), fileName).optional(),
203
281
  light: modeSchema,
204
282
  dark: modeSchema,
@@ -227,33 +305,67 @@ const pairs = [
227
305
  // The last button of a confirm that loses something.
228
306
  { ink: "on-low", ground: "low", least: 4.5, change: "on-low" },
229
307
  ];
308
+ // The pairs a hook adds when a theme uses it: the chosen tab's accent on its tint, and the words of a card on its texture where it is thickest, whose grain
309
+ // colour is the one to change.
310
+ const tabPairs = [{ ink: "accent", ground: "tab", least: 4.5, change: "accent" }];
311
+ const grainPairs = ["ink", "muted", "accent", "gold-ink", "ally", "low", "warn"].map((ink) => ({ ink, ground: "grain", least: 4.5, change: "card-grain" }));
312
+ /** The pairs a theme's colours must pass, with those of the hooks it uses. */
313
+ function pairsOf(hooks) {
314
+ return [...pairs, ...(hooks.tabs === "underline" ? [] : tabPairs), ...(hooks.grain ? grainPairs : [])];
315
+ }
230
316
  /**
231
317
  * What does not read in a mode: by colour of the theme to change, the pairs it fails, and the nearest colour that makes them all read without making another
232
318
  * pair fail; or, when none does, that one of the colours it sits on or under must change.
233
319
  */
234
- function legibilityProblems(mode, given) {
235
- const written = { ...given.colours, "card-edge": given.cardEdge };
320
+ function legibilityProblems(mode, given, hooks) {
321
+ const all = pairsOf(hooks);
322
+ const written = { ...given.colours, "card-edge": given.cardEdge, "card-grain": given.cardGrain };
236
323
  const shown = measured(written);
237
- const failing = pairs.filter((pair) => !reads(pair, shown));
324
+ const failing = all.filter((pair) => !reads(pair, shown));
238
325
  const problems = [...new Set(failing.map((pair) => pair.change))].map((change) => {
239
326
  const own = failing.filter((pair) => pair.change === change);
240
327
  const fails = own.map((pair) => `${pair.ink === change ? "" : `${pair.ink} `}on ${pair.ground} ${shown[pair.ground]} is ${ratioText(shown[pair.ink], shown[pair.ground])}:1`);
241
328
  const said = `${mode}: ${change} ${written[change]} does not read: ${fails.join(", ")}, the page needs ${own[0].least}:1`;
242
- const offered = readingColour(written, change);
243
- const others = [...new Set(pairs.filter((pair) => pair.change === change).flatMap((pair) => madeOf(pair.ground === change ? pair.ink : pair.ground)))].filter((name) => name !== change);
329
+ const offered = readingColour(written, change, all);
330
+ const others = [...new Set(all.filter((pair) => pair.change === change).flatMap((pair) => madeOf(pair.ground === change ? pair.ink : pair.ground)))].filter((name) => name !== change);
244
331
  return offered === undefined ? `${said}; no one colour reads on ${others.join(" and ")} as they are: change one of those` : `${said}; ${offered} would do`;
245
332
  });
246
333
  if (!apart(written)) {
247
334
  problems.push(`${mode}: ally ${written.ally} and low ${written.low} are too alike; friends and foes must not look the same`);
248
335
  }
336
+ if (hooks.frame && distance(given.portraitFrame, written.low) < 60) {
337
+ problems.push(`${mode}: portrait-frame ${given.portraitFrame} and low ${written.low} are too alike; a foe is ringed in low, and every portrait would look like one`);
338
+ }
249
339
  return problems;
250
340
  }
251
- // The colours the page mixes of the theme's: the two each mixes, and how much of the first.
341
+ // The inks the page writes on the paper of the documents and of the maps, copied from tokens.css and world.css, and the contrast each needs: words 4.5:1,
342
+ // a mark 3:1. The documents' ruled lines are faint, a texture, and need none.
343
+ const paperInks = {
344
+ documents: [["the documents' ink", "#2f261b", 4.5], ["their notes", "#5c4a30", 4.5], ["their links", "#7a3b16", 4.5], ["their seals", "#9b2f24", 3]],
345
+ maps: [["the maps' ink", "#3f2f1f", 4.5], ["the regions' names", "#5a3f4f", 4.5], ["their marks", "#6b4a5c", 3], ["the rivers", "#3a6d96", 3], ["the party's trail", "#b2361f", 3]],
346
+ };
347
+ /** What does not read on the paper a theme gives the documents or the maps, the same in both modes, and the nearest paper that reads. */
348
+ function paperProblems(papers) {
349
+ return ["documents", "maps"].flatMap((kind) => {
350
+ const paper = papers[kind];
351
+ const failing = paper === undefined ? [] : paperInks[kind].filter(([, ink, least]) => contrast(ink, paper) < least);
352
+ if (paper === undefined || failing.length === 0) {
353
+ return [];
354
+ }
355
+ const fails = failing.map(([name, ink, least]) => `${name} ${ink} on it is ${ratioText(ink, paper)}:1, the page needs ${least}:1`).join(", ");
356
+ const offered = [...Array(100).keys()].map((step) => mix("#ffffff", paper, (step + 1) / 100)).find((tried) => paperInks[kind].every(([, ink, least]) => contrast(ink, tried) >= least));
357
+ return [`papers.${kind} ${paper} does not read: ${fails}; the page writes dark on it in both modes, ${offered ?? "#ffffff"} would do`];
358
+ });
359
+ }
360
+ // The colours the page mixes of the theme's: the two each mixes, and how much of the first. The chosen tab's tint over the page; a card's texture where it
361
+ // is thickest, its grain at 30% over the card.
252
362
  const mixes = {
253
363
  cell: ["ink", "panel", 0.06],
254
364
  chip: ["accent", "panel-2", 0.16],
255
365
  "chip-muted": ["muted", "ink", 0.7],
256
366
  "on-gold-soft": ["on-gold", "gold", 0.75],
367
+ tab: ["accent", "paper", 0.16],
368
+ grain: ["card-grain", "panel", 0.3],
257
369
  };
258
370
  /** The colours as the page shows them, those it mixes included. */
259
371
  function measured(written) {
@@ -279,7 +391,7 @@ function ratioText(first, second) {
279
391
  * The colour nearest to the one written, toward white or toward black, that makes every pair it is in read, no pair that read stop reading, and friends and foes
280
392
  * that looked apart still look so; undefined when there is none.
281
393
  */
282
- function readingColour(written, change) {
394
+ function readingColour(written, change, pairs) {
283
395
  const before = measured(written);
284
396
  const readBefore = pairs.filter((pair) => reads(pair, before));
285
397
  const apartBefore = apart(written);
@@ -330,6 +442,51 @@ function fileProblem(folder, name, kinds) {
330
442
  const size = statSync(path).size;
331
443
  return size > mostBytes ? `"${name}" weighs ${Math.round(size / 1000)} KB; a theme's file weighs at most ${mostBytes / 1000} KB` : undefined;
332
444
  }
445
+ /**
446
+ * What keeps an SVG from being drawn in one colour, as the cards' texture is, so that the page knows the colour under every word: a paint other than
447
+ * currentColor, or what brings colours of its own, a style, a picture, foreign content, a filter, an animation that changes them.
448
+ */
449
+ function oneColourProblems(svg) {
450
+ const paints = [...svg.matchAll(/\b(fill|stroke|stop-color|flood-color|lighting-color|color)\s*(?:=\s*(["'])(.*?)\2|:\s*([^;"'}>]+))/gi)]
451
+ .map((match) => (match[3] ?? match[4]).trim())
452
+ .filter((paint) => !/^(currentcolor|none|inherit|transparent|url\(\s*['"]?#[^)]*\))$/i.test(paint));
453
+ const elements = [...new Set([...svg.matchAll(/<(style|image|foreignObject|script|filter|set|animateColor|animate)\b/gi)].map((match) => match[1]))];
454
+ return [
455
+ ...(paints.length === 0 ? [] : [`must draw in currentColor alone, which the page paints in card-grain; it paints ${[...new Set(paints)].slice(0, 4).join(", ")}`]),
456
+ ...(elements.length === 0 ? [] : [`must draw with shapes alone; it has ${elements.map((element) => `<${element}>`).join(", ")}`]),
457
+ ];
458
+ }
459
+ /**
460
+ * What a theme's own style sheet must not do: import another sheet, or name in url() what is not a picture of its folder. A help to its author, not a wall:
461
+ * the page's content security policy keeps the sheet from reaching the web.
462
+ */
463
+ function styleProblems(folder, style) {
464
+ const css = withoutComments(readFileSync(join(folder, style), "utf8"));
465
+ const imports = /@import\b/i.test(css) ? [`style: ${style} must not @import: write its rules in it, and name its pictures with url()`] : [];
466
+ const urls = styleUrls(css).flatMap((url) => {
467
+ const problem = urlProblem(folder, style, url);
468
+ return problem === undefined ? [] : [`style: url(${url}) in ${style}: ${problem}`];
469
+ });
470
+ return [...imports, ...urls];
471
+ }
472
+ /** What is wrong with a url() of a theme's style sheet, if anything: an element of the page, as url(#glow), is fine; a file is a picture of its folder. */
473
+ function urlProblem(folder, style, url) {
474
+ const instead = "put the picture in the theme's folder and name it from the sheet, such as images/ruled.svg";
475
+ if (url.startsWith("#")) {
476
+ return undefined;
477
+ }
478
+ if (/^data:/i.test(url)) {
479
+ return `the page blocks a data: address; ${instead}`;
480
+ }
481
+ if (/^[a-z][a-z\d+.-]*:/i.test(url) || url.startsWith("//")) {
482
+ return `a theme never reaches the web, and the page blocks it; ${instead}`;
483
+ }
484
+ if (url.startsWith("/")) {
485
+ return "an address from / is the page's, not the theme's folder; write it from the sheet, such as images/ruled.svg";
486
+ }
487
+ const problem = fileProblem(folder, fromStyle(style, url), pictureFiles);
488
+ return problem === undefined ? undefined : `${problem}; its url() name pictures of the theme's folder, written from the sheet`;
489
+ }
333
490
  /** The files of the same folder, to say which one was meant. */
334
491
  function similar(folder, name) {
335
492
  const place = join(folder, name.split(/[\\/]/).slice(0, -1).join(sep));
@@ -41,6 +41,7 @@ You are the game master of this table. It is a craft, and you inhabit it as an a
41
41
 
42
42
  - `mode`: when status says nothing is missing for the next mode and the player confirms.
43
43
  - `config`: whenever the player sets or changes a setting, in any mode.
44
+ - Git or GitHub for the campaign: `config git` commit or push, and the engine commits by itself at each session start, save and scene end; you make only the private repository and its remote, when asked, never a hook.
44
45
  - `find`, `show`: read a page before describing anything that already exists.
45
46
  - `rules`: whenever you are unsure how a rule works, before you rule and say what is at stake, and when the player questions a ruling.
46
47
  - `write`: record every new fact at once.
@@ -5,5 +5,5 @@ How the player uses their dashboard, to answer in a few words, as part of the ga
5
5
  - Journal: the quests, those followed with their star beside the page; the story by scenes; the companions' diaries; their own notes, which they may share with you.
6
6
  - World: what their character knows of the world, in four tabs: Map, the places they know with distances; Lore, the pages they know; Documents, what they have read; Calendar, the days and what is set on them.
7
7
  - On a page they see, as a character, a place or a quest, a button gives it a picture of their own in place of the one it has; your next call says so.
8
- - The icons at the row's end: Saves, to save or go back as the campaign's saves setting allows; Help, how to play with the chat and the page; Settings, the same as `config` (difficulty, dice digital or physical, units, language, pictures, lines and veils, mentor); Packages, the game systems, extensions and languages on this computer, and RPG Engine's own update, which the player makes there, never you, and in its menu the pages a game system or extension adds; About.
8
+ - The icons at the row's end: Saves, to save or go back as the campaign's saves setting allows; Help, how to play with the chat and the page; Settings, the same as `config` (difficulty, dice digital or physical, units, language, pictures, lines and veils, mentor, git where the campaign is a git repository); Packages, the game systems, extensions and languages on this computer, and RPG Engine's own update, which the player makes there, never you, and in its menu the pages a game system or extension adds; About.
9
9
  - When you call `ask`, the buttons appear on the page too: a click rolls the dice of a check, or with "By hand" a click on the lit row of their sheet or a throw of the tray's dice, and they may write their own words instead; their own dice are the physical setting, and then they give you the faces in the chat. They may also propose changes to their character's story there, which reach you to write with their yes.
@@ -1 +1 @@
1
- This folder is a tabletop role-playing campaign and you are its game master: you invent, play and rule; the `rpg` tools remember, roll and keep the accounts. Before your first reply in every chat, and again whenever the conversation has been summarized, call `instructions` (how to be its game master), then `status` (where the game stands). Follow them. Never mention tools, files or the engine to the player. Never read your app's past chats or their logs: the game remembers only through `status`.
1
+ This folder is a tabletop role-playing campaign and you are its game master: you invent, play and rule; the `rpg` server's tools remember, roll and keep the accounts. Before your first reply in every chat, and again whenever the conversation has been summarized, call `instructions` (how to be its game master), then `status` (where the game stands). Follow them. Never mention tools, files or the engine to the player. Never read your app's past chats or their logs: the game remembers only through `status`. Without `rpg` tools, do not play: tell the player to run `rpg init` in this folder and open a new chat.
@@ -0,0 +1 @@
1
+ Here the agent is the subagent rpg-character, started with the subagent tool, and its answer comes later as a message: once you started it, end your turn without a word to the player, and narrate when its lines come.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rpg-engine",
3
- "version": "0.21.0",
3
+ "version": "0.23.1",
4
4
  "description": "Play a tabletop role-playing game with an AI as your game master: the AI tells the story; RPG Engine remembers the world, rolls the dice and keeps the accounts.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -29,7 +29,8 @@
29
29
  "files": [
30
30
  "dist",
31
31
  "systems",
32
- "instructions"
32
+ "instructions",
33
+ "plugins"
33
34
  ],
34
35
  "scripts": {
35
36
  "build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsc && tsc -p src/dashboard && node -e \"require('node:fs').cpSync('src/dashboard', 'dist/dashboard', { recursive: true, filter: (path) => !/[.](tsx?|py)$|tsconfig[.]json$|[^a-z-]style$/.test(path) })\" && node src/dashboard/style/join.mjs dist/dashboard/style.css",