rpg-engine 0.20.0 → 0.21.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.
Files changed (160) hide show
  1. package/dist/adventures/index.d.ts +1 -1
  2. package/dist/adventures/index.js +1 -1
  3. package/dist/adventures/source.d.ts +3 -0
  4. package/dist/adventures/source.js +11 -49
  5. package/dist/campaign/create-campaign.d.ts +1 -1
  6. package/dist/campaign/create-campaign.js +3 -2
  7. package/dist/campaign/find-campaign.d.ts +2 -0
  8. package/dist/campaign/find-campaign.js +2 -0
  9. package/dist/campaign/index.d.ts +1 -1
  10. package/dist/campaign/index.js +1 -1
  11. package/dist/campaign/settings.js +2 -2
  12. package/dist/commands/book.d.ts +16 -35
  13. package/dist/commands/book.js +86 -62
  14. package/dist/commands/config/config.js +1 -1
  15. package/dist/commands/config/dashboard.d.ts +2 -2
  16. package/dist/commands/config/dashboard.js +9 -3
  17. package/dist/commands/config/words.js +1 -1
  18. package/dist/commands/image.d.ts +5 -0
  19. package/dist/commands/image.js +6 -3
  20. package/dist/commands/package/data.d.ts +35 -0
  21. package/dist/commands/package/data.js +117 -0
  22. package/dist/commands/package/here.d.ts +7 -2
  23. package/dist/commands/package/here.js +23 -11
  24. package/dist/commands/package/install.js +14 -15
  25. package/dist/commands/package/language.d.ts +15 -0
  26. package/dist/commands/package/language.js +109 -0
  27. package/dist/commands/package/package.js +20 -10
  28. package/dist/commands/package/result.d.ts +19 -0
  29. package/dist/commands/package/theme.d.ts +13 -0
  30. package/dist/commands/package/theme.js +66 -0
  31. package/dist/commands/package/uninstall.d.ts +4 -1
  32. package/dist/commands/package/uninstall.js +29 -9
  33. package/dist/commands/scene/close.d.ts +1 -1
  34. package/dist/commands/scene/close.js +15 -8
  35. package/dist/commands/shared/books/adventures.d.ts +0 -4
  36. package/dist/commands/shared/books/adventures.js +2 -31
  37. package/dist/commands/shared/books/words.js +3 -2
  38. package/dist/commands/shared/campaign/book.d.ts +21 -8
  39. package/dist/commands/shared/campaign/book.js +65 -42
  40. package/dist/commands/shared/campaign/saves.js +2 -2
  41. package/dist/commands/shared/campaign/world.js +2 -1
  42. package/dist/commands/shared/packages/catalog.d.ts +3 -3
  43. package/dist/commands/shared/packages/catalog.js +98 -42
  44. package/dist/commands/shared/packages/unpacked.d.ts +50 -0
  45. package/dist/commands/shared/packages/unpacked.js +146 -0
  46. package/dist/core/archive.d.ts +13 -0
  47. package/dist/core/archive.js +76 -0
  48. package/dist/core/context.d.ts +2 -0
  49. package/dist/core/context.js +1 -0
  50. package/dist/core/store.d.ts +5 -1
  51. package/dist/core/store.js +15 -2
  52. package/dist/dashboard/api.js +24 -1
  53. package/dist/dashboard/app.js +7 -2
  54. package/dist/dashboard/guide/ar.md +8 -8
  55. package/dist/dashboard/guide/cs.md +8 -8
  56. package/dist/dashboard/guide/da.md +9 -9
  57. package/dist/dashboard/guide/de.md +8 -8
  58. package/dist/dashboard/guide/el.md +8 -8
  59. package/dist/dashboard/guide/en.md +7 -7
  60. package/dist/dashboard/guide/es.md +8 -8
  61. package/dist/dashboard/guide/fi.md +8 -8
  62. package/dist/dashboard/guide/fr.md +8 -8
  63. package/dist/dashboard/guide/he.md +8 -8
  64. package/dist/dashboard/guide/hi.md +8 -8
  65. package/dist/dashboard/guide/hu.md +8 -8
  66. package/dist/dashboard/guide/is.md +8 -8
  67. package/dist/dashboard/guide/it.md +8 -8
  68. package/dist/dashboard/guide/ja.md +8 -8
  69. package/dist/dashboard/guide/ko.md +8 -8
  70. package/dist/dashboard/guide/nb.md +9 -9
  71. package/dist/dashboard/guide/nl.md +8 -8
  72. package/dist/dashboard/guide/pl.md +8 -8
  73. package/dist/dashboard/guide/pt.md +8 -8
  74. package/dist/dashboard/guide/ro.md +8 -8
  75. package/dist/dashboard/guide/ru.md +9 -9
  76. package/dist/dashboard/guide/sv.md +8 -8
  77. package/dist/dashboard/guide/tr.md +8 -8
  78. package/dist/dashboard/guide/uk.md +9 -9
  79. package/dist/dashboard/guide/zh.md +8 -8
  80. package/dist/dashboard/i18n/ar.json +33 -5
  81. package/dist/dashboard/i18n/cs.json +33 -5
  82. package/dist/dashboard/i18n/da.json +33 -5
  83. package/dist/dashboard/i18n/de.json +33 -5
  84. package/dist/dashboard/i18n/el.json +33 -5
  85. package/dist/dashboard/i18n/es.json +33 -5
  86. package/dist/dashboard/i18n/fi.json +33 -5
  87. package/dist/dashboard/i18n/fr.json +33 -5
  88. package/dist/dashboard/i18n/he.json +33 -5
  89. package/dist/dashboard/i18n/hi.json +33 -5
  90. package/dist/dashboard/i18n/hu.json +33 -5
  91. package/dist/dashboard/i18n/is.json +33 -5
  92. package/dist/dashboard/i18n/it.json +33 -5
  93. package/dist/dashboard/i18n/ja.json +33 -5
  94. package/dist/dashboard/i18n/ko.json +33 -5
  95. package/dist/dashboard/i18n/nb.json +33 -5
  96. package/dist/dashboard/i18n/nl.json +33 -5
  97. package/dist/dashboard/i18n/pl.json +33 -5
  98. package/dist/dashboard/i18n/pt.json +33 -5
  99. package/dist/dashboard/i18n/ro.json +33 -5
  100. package/dist/dashboard/i18n/ru.json +33 -5
  101. package/dist/dashboard/i18n/sv.json +33 -5
  102. package/dist/dashboard/i18n/tr.json +33 -5
  103. package/dist/dashboard/i18n/uk.json +33 -5
  104. package/dist/dashboard/i18n/zh.json +33 -5
  105. package/dist/dashboard/journal/book.js +3 -2
  106. package/dist/dashboard/journal/journal.js +8 -5
  107. package/dist/dashboard/kit.js +1 -1
  108. package/dist/dashboard/packages/catalog.js +31 -14
  109. package/dist/dashboard/packages/engine.js +46 -2
  110. package/dist/dashboard/packages/installed.js +13 -0
  111. package/dist/dashboard/packages/outcomes.js +21 -0
  112. package/dist/dashboard/packages/packages.js +41 -18
  113. package/dist/dashboard/packages/rows.js +3 -1
  114. package/dist/dashboard/parts/icons.js +3 -0
  115. package/dist/dashboard/parts/picture.js +89 -0
  116. package/dist/dashboard/parts/refusals.js +8 -1
  117. package/dist/dashboard/parts/widgets.js +2 -1
  118. package/dist/dashboard/play/scene.js +8 -5
  119. package/dist/dashboard/settings/settings.js +23 -13
  120. package/dist/dashboard/sheet/party.js +5 -2
  121. package/dist/dashboard/sheet/sheet.js +2 -1
  122. package/dist/dashboard/shell/notices.js +2 -2
  123. package/dist/dashboard/shell/system-style.js +45 -12
  124. package/dist/dashboard/shell/tooltip.js +223 -0
  125. package/dist/dashboard/style.css +283 -132
  126. package/dist/dashboard/world/lore.js +4 -3
  127. package/dist/dashboard/world/place-card.js +2 -1
  128. package/dist/languages/index.d.ts +1 -1
  129. package/dist/languages/index.js +1 -1
  130. package/dist/languages/pack.d.ts +4 -1
  131. package/dist/languages/pack.js +16 -5
  132. package/dist/packages/engine.d.ts +7 -0
  133. package/dist/packages/engine.js +32 -1
  134. package/dist/packages/index.d.ts +1 -1
  135. package/dist/packages/index.js +1 -1
  136. package/dist/server/dashboard/engine.d.ts +18 -0
  137. package/dist/server/dashboard/engine.js +31 -0
  138. package/dist/server/dashboard/files.d.ts +8 -1
  139. package/dist/server/dashboard/files.js +30 -10
  140. package/dist/server/dashboard/index.d.ts +3 -0
  141. package/dist/server/dashboard/index.js +10 -1
  142. package/dist/server/dashboard/pictures.d.ts +7 -0
  143. package/dist/server/dashboard/pictures.js +62 -0
  144. package/dist/server/dashboard/writes.d.ts +5 -3
  145. package/dist/server/dashboard/writes.js +45 -14
  146. package/dist/testing/index.js +1 -0
  147. package/dist/themes/index.d.ts +2 -1
  148. package/dist/themes/index.js +4 -2
  149. package/dist/themes/installed.d.ts +14 -0
  150. package/dist/themes/installed.js +28 -0
  151. package/dist/themes/theme.d.ts +7 -0
  152. package/dist/themes/theme.js +22 -0
  153. package/instructions/core.md +3 -3
  154. package/instructions/dashboard-guide.md +1 -0
  155. package/instructions/mentor-hints.md +1 -1
  156. package/instructions/mentor-tutorial.md +1 -1
  157. package/instructions/party.md +1 -1
  158. package/instructions/play.md +2 -2
  159. package/package.json +1 -1
  160. package/systems/free/instructions/outcomes-told.md +1 -1
@@ -1,19 +1,36 @@
1
1
  import { readChoice } from "./prefs.js";
2
2
  /** The event that tells the page the game's style changed: what draws an icon draws it again. */
3
3
  export const gameStyleChanged = "rpg-engine:game-style";
4
- /** Whether the page shows the game's style, by system: the game's, or the page's own. */
4
+ /** The value of the choice that shows an installed theme, by its id. */
5
+ export function installedStyle(id) {
6
+ return `theme:${id}`;
7
+ }
8
+ /**
9
+ * Which style the page shows, by system: the game's, while it has one to show; an installed theme, while it is installed; or the page's own. One no longer
10
+ * offered goes back to the first: the game's, else the page's.
11
+ */
5
12
  export function systemStylePref(system) {
6
- return { key: `rpg-engine.game-style.${system}`, initial: "game", values: ["game", "page"] };
13
+ const shows = gameShows();
14
+ return {
15
+ key: `rpg-engine.game-style.${system}`,
16
+ initial: shows ? "game" : "page",
17
+ values: [...(shows ? ["game"] : []), ...(theme.themes ?? []).map((one) => installedStyle(one.id)), "page"],
18
+ };
7
19
  }
8
- /** 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. */
20
+ /** 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 installed. */
9
21
  export function gameStyle() {
10
- return { system: theme.system, name: theme.name, shows: theme.css !== undefined || freeStyle !== undefined, refused: theme.refused === true };
22
+ return { system: theme.system, name: theme.name, shows: gameShows(), refused: theme.refused === true, themes: (theme.themes ?? []).map(({ id, name }) => ({ id, name })) };
23
+ }
24
+ /** 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
+ export function shownInstalledTheme() {
26
+ return chosen().installed?.id;
11
27
  }
12
- /** The lines of an icon the game's style draws anew, while it is on; undefined for the page's own. */
28
+ /** The lines of an icon the style shown draws anew; undefined for the page's own. */
13
29
  export function themedIcon(name) {
14
- return styleOn() ? theme.icons?.[name] : undefined;
30
+ const style = chosen();
31
+ return style.installed !== undefined ? style.installed.icons[name] : style.game ? theme.icons?.[name] : undefined;
15
32
  }
16
- /** Takes the theme of the campaign's system as read, and the free style sheet of its page module; the page shows them while the game's style is on. */
33
+ /** Takes the theme of the campaign's system as read, with the themes installed, and the free style sheet of its page module; the page shows the one chosen. */
17
34
  export function takeSystemStyle(read, pageStyle) {
18
35
  const same = JSON.stringify(read) === JSON.stringify(theme) && pageStyle === freeStyle;
19
36
  theme = read;
@@ -22,16 +39,17 @@ export function takeSystemStyle(read, pageStyle) {
22
39
  applyGameStyle();
23
40
  }
24
41
  }
25
- /** Shows the game's style or the page's own, as the player keeps it for the campaign's system: after a change of that choice, or of what the system gives. */
42
+ /** Shows the style the player keeps for the campaign's system: after a change of that choice, or of what the system and this computer give. */
26
43
  export function applyGameStyle() {
27
44
  if (typeof document === "undefined") {
28
45
  return;
29
46
  }
30
- const on = styleOn();
47
+ const style = chosen();
31
48
  themeSheet ??= new CSSStyleSheet();
32
49
  freeSheet ??= new CSSStyleSheet();
33
- themeSheet.replaceSync(on ? theme.css ?? "" : "");
34
- freeSheet.replaceSync(on ? freeStyle ?? "" : "");
50
+ themeSheet.replaceSync(style.installed?.css ?? (style.game ? theme.css ?? "" : ""));
51
+ // The free style of the system's page module goes with its own theme alone: never under another's colours.
52
+ freeSheet.replaceSync(style.game ? freeStyle ?? "" : "");
35
53
  const others = document.adoptedStyleSheets.filter((sheet) => sheet !== themeSheet && sheet !== freeSheet);
36
54
  document.adoptedStyleSheets = [...others, themeSheet, freeSheet];
37
55
  document.querySelectorAll(".title-too-wide").forEach((title) => title.classList.remove("title-too-wide"));
@@ -47,8 +65,23 @@ let watching = false;
47
65
  let fitting = false;
48
66
  // The card titles the theme's face may make too wide, and the campaign's name.
49
67
  const titles = ":is(summary, .card-head) :is(h2, h3, .rolls-title), .titles h1";
68
+ /** Whether the game's own style has anything to show: its theme, or the free style of its page module. */
69
+ function gameShows() {
70
+ return theme.css !== undefined || freeStyle !== undefined;
71
+ }
72
+ /** The style the player keeps for the campaign's system: the game's, an installed theme, or neither, the page's own. */
73
+ function chosen() {
74
+ if (theme.system === undefined) {
75
+ return { game: false };
76
+ }
77
+ const value = readChoice(systemStylePref(theme.system));
78
+ const installed = theme.themes?.find((one) => installedStyle(one.id) === value);
79
+ return installed === undefined ? { game: value === "game" } : { game: false, installed };
80
+ }
81
+ /** Whether a style other than the page's own is on, whose faces may make a title too wide. */
50
82
  function styleOn() {
51
- return theme.system !== undefined && gameStyle().shows && readChoice(systemStylePref(theme.system)) === "game";
83
+ const style = chosen();
84
+ return style.game || style.installed !== undefined;
52
85
  }
53
86
  /**
54
87
  * Each title the theme's face makes wider than its card goes back to the text's face, that title alone (D-528 (4)): measured as the page changes, as its
@@ -0,0 +1,223 @@
1
+ // The page's one tooltip (T-228): what a control's `data-tip` says, shown in the top layer over every card, list and dialog, so that no box that scrolls or
2
+ // clips cuts it, and placed beside its control inside the window. After a moment under a pointer, at once when the keyboard reaches it, never at a touch;
3
+ // Escape or a press hides it. It is for the eye: what it says is already the control's name for a screen reader. It reaches into the packages' shadow roots.
4
+ // How far from its control, and from the window's edges.
5
+ const gap = 8;
6
+ const margin = 8;
7
+ // Moving from one tip to the next within this time shows the next at once.
8
+ const followTime = 300;
9
+ let tip;
10
+ // Whose tip shows, or waits for its moment, and how it was reached.
11
+ let target;
12
+ let reachedBy;
13
+ let timer;
14
+ // A control pressed or dismissed with Escape shows no tip until the pointer leaves it.
15
+ let quiet;
16
+ let hiddenAt = 0;
17
+ const watcher = typeof MutationObserver === "undefined" ? undefined : new MutationObserver(() => follow());
18
+ /** Starts the page's tooltips, once, at the page's start. */
19
+ export function startTooltips() {
20
+ document.addEventListener("pointerover", onPointerOver, true);
21
+ document.addEventListener("pointerout", onPointerOut, true);
22
+ document.addEventListener("pointerdown", onPress, true);
23
+ document.addEventListener("focusin", onFocusIn, true);
24
+ document.addEventListener("focusout", onFocusOut, true);
25
+ document.addEventListener("keydown", onKey, true);
26
+ document.addEventListener("scroll", onScroll, { capture: true, passive: true });
27
+ window.addEventListener("resize", onScroll, { passive: true });
28
+ }
29
+ function onPointerOver(event) {
30
+ if (event.pointerType === "touch") {
31
+ return;
32
+ }
33
+ const found = tipped(event.composedPath());
34
+ if (found !== quiet) {
35
+ quiet = undefined;
36
+ }
37
+ if (found === undefined || found === quiet) {
38
+ if (reachedBy !== "focus") {
39
+ hide();
40
+ }
41
+ return;
42
+ }
43
+ if (found !== target || reachedBy !== "pointer") {
44
+ const shownNow = tip?.classList.contains("shown") === true || performance.now() - hiddenAt < followTime;
45
+ wait(found, shownNow ? 0 : waitTime());
46
+ }
47
+ }
48
+ // The pointer leaving the window.
49
+ function onPointerOut(event) {
50
+ if (event.relatedTarget === null && reachedBy === "pointer") {
51
+ hide();
52
+ }
53
+ }
54
+ function onPress(event) {
55
+ const found = tipped(event.composedPath());
56
+ if (found !== undefined) {
57
+ quiet = found;
58
+ }
59
+ hide();
60
+ }
61
+ function onFocusIn(event) {
62
+ const focused = event.composedPath()[0];
63
+ if (focused instanceof Element && hasTip(focused) && focused !== quiet && focused.matches(":focus-visible")) {
64
+ show(focused, "focus");
65
+ }
66
+ else if (reachedBy === "focus") {
67
+ hide();
68
+ }
69
+ }
70
+ function onFocusOut(event) {
71
+ // Dismissed with Escape, it shows again when the keyboard comes back to it.
72
+ if (quiet === event.composedPath()[0]) {
73
+ quiet = undefined;
74
+ }
75
+ if (reachedBy === "focus") {
76
+ hide();
77
+ }
78
+ }
79
+ // Escape hides the tip shown (WCAG 1.4.13), and lets the key go on to what else it closes.
80
+ function onKey(event) {
81
+ if (event.key === "Escape" && target !== undefined) {
82
+ quiet = target;
83
+ hide();
84
+ }
85
+ }
86
+ // The tip follows its control as the page or a list scrolls, and goes with it out of sight; the pointer, left behind, shows the next as it goes over it.
87
+ function onScroll() {
88
+ place();
89
+ }
90
+ /** The nearest control with a tip along an event's path, across shadow roots. */
91
+ function tipped(path) {
92
+ return path.find((step) => step instanceof Element && hasTip(step));
93
+ }
94
+ function hasTip(element) {
95
+ return (element.getAttribute("data-tip") ?? "") !== "";
96
+ }
97
+ function wait(element, time) {
98
+ clearTimeout(timer);
99
+ if (time === 0) {
100
+ show(element, "pointer");
101
+ return;
102
+ }
103
+ hide();
104
+ target = element;
105
+ reachedBy = "pointer";
106
+ timer = setTimeout(() => show(element, "pointer"), time);
107
+ }
108
+ function show(element, how) {
109
+ clearTimeout(timer);
110
+ const shown = tipElement();
111
+ target = element;
112
+ reachedBy = how;
113
+ shown.textContent = element.getAttribute("data-tip");
114
+ shown.dir = getComputedStyle(element).direction === "rtl" ? "rtl" : "ltr";
115
+ watcher?.disconnect();
116
+ watcher?.observe(element, { attributes: true, attributeFilter: ["data-tip"] });
117
+ // Shown again, so that it stands over a dialog opened since; its side and state set before, as showing it reads its style, which it comes from.
118
+ if (shown.classList.contains("shown")) {
119
+ closeLayer(shown);
120
+ }
121
+ shown.dataset.side = askedSide(element);
122
+ shown.classList.add("shown");
123
+ openLayer(shown);
124
+ place();
125
+ }
126
+ function hide() {
127
+ clearTimeout(timer);
128
+ watcher?.disconnect();
129
+ target = undefined;
130
+ reachedBy = undefined;
131
+ if (tip?.classList.contains("shown") === true) {
132
+ tip.classList.remove("shown");
133
+ closeLayer(tip);
134
+ hiddenAt = performance.now();
135
+ }
136
+ }
137
+ // Its control's words changed while it shows, as a picture's while it is sent; or went.
138
+ function follow() {
139
+ if (target === undefined || tip === undefined) {
140
+ return;
141
+ }
142
+ if (!hasTip(target)) {
143
+ hide();
144
+ return;
145
+ }
146
+ tip.textContent = target.getAttribute("data-tip");
147
+ place();
148
+ }
149
+ /** Over its control, or under it (`.tip-below`), or on its start side (`.tip-left`), as asked; where there is no room, the other way; inside the window. */
150
+ function place() {
151
+ if (target === undefined || tip === undefined || !tip.classList.contains("shown")) {
152
+ return;
153
+ }
154
+ const box = target.getBoundingClientRect();
155
+ const windowWidth = document.documentElement.clientWidth;
156
+ const windowHeight = window.innerHeight;
157
+ // Its control gone, or scrolled out of sight.
158
+ if (!target.isConnected || (box.width === 0 && box.height === 0) || box.bottom < 0 || box.top > windowHeight) {
159
+ hide();
160
+ return;
161
+ }
162
+ const width = tip.offsetWidth;
163
+ const height = tip.offsetHeight;
164
+ const rtl = tip.dir === "rtl";
165
+ const asked = askedSide(target);
166
+ const startLeft = rtl ? box.right + gap : box.left - gap - width;
167
+ const roomAbove = box.top - gap - height >= margin;
168
+ const roomBelow = box.bottom + gap + height <= windowHeight - margin;
169
+ const roomStart = startLeft >= margin && startLeft + width <= windowWidth - margin;
170
+ const side = asked === "start" && roomStart ? "start" : asked === "below" ? (roomBelow || !roomAbove ? "below" : "above") : roomAbove || !roomBelow ? "above" : "below";
171
+ const left = side === "start" ? startLeft : box.left + box.width / 2 - width / 2;
172
+ const top = side === "start" ? box.top + box.height / 2 - height / 2 : side === "above" ? box.top - gap - height : box.bottom + gap;
173
+ tip.dataset.side = side;
174
+ tip.style.setProperty("--tip-left", `${Math.round(within(left, margin, windowWidth - margin - width))}px`);
175
+ tip.style.setProperty("--tip-top", `${Math.round(within(top, margin, windowHeight - margin - height))}px`);
176
+ }
177
+ function askedSide(element) {
178
+ return element.classList.contains("tip-left") ? "start" : element.classList.contains("tip-below") ? "below" : "above";
179
+ }
180
+ function within(value, low, high) {
181
+ return Math.max(low, Math.min(value, high));
182
+ }
183
+ // The one tip of the page, made at its first need, hidden from a screen reader: the control says it already.
184
+ function tipElement() {
185
+ if (tip === undefined) {
186
+ tip = document.createElement("div");
187
+ tip.className = "page-tip";
188
+ tip.setAttribute("aria-hidden", "true");
189
+ if (supportsPopover(tip)) {
190
+ tip.popover = "manual";
191
+ }
192
+ else {
193
+ tip.hidden = true;
194
+ }
195
+ document.body.append(tip);
196
+ }
197
+ return tip;
198
+ }
199
+ function openLayer(element) {
200
+ if (supportsPopover(element)) {
201
+ element.showPopover();
202
+ }
203
+ else {
204
+ element.hidden = false;
205
+ }
206
+ }
207
+ function closeLayer(element) {
208
+ if (!supportsPopover(element)) {
209
+ element.hidden = true;
210
+ }
211
+ else if (element.matches(":popover-open")) {
212
+ element.hidePopover();
213
+ }
214
+ }
215
+ function supportsPopover(element) {
216
+ return typeof element.showPopover === "function";
217
+ }
218
+ // The moment a pointer rests on a control before its tip shows: the page's --wait.
219
+ function waitTime() {
220
+ const value = getComputedStyle(document.documentElement).getPropertyValue("--wait").trim();
221
+ const time = Number.parseFloat(value);
222
+ return Number.isNaN(time) ? 500 : value.endsWith("ms") ? time : time * 1000;
223
+ }