@hadoku/ui-shell 0.1.36 → 0.1.37
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/chrome/shell.js +19 -14
- package/package.json +2 -2
package/dist/chrome/shell.js
CHANGED
|
@@ -13,27 +13,32 @@ import { useCallback } from 'react';
|
|
|
13
13
|
/** The frame `el` is drawn in: the app's own, or the embed's. */
|
|
14
14
|
const frameOf = (el) => el.closest('.cardtable-chrome');
|
|
15
15
|
/**
|
|
16
|
-
* Mark the page frame with `name`=`value` for as long as `el` is drawn.
|
|
17
|
-
*
|
|
16
|
+
* Mark the page frame with `name`=`value` for as long as `el` is drawn. Holders stack per
|
|
17
|
+
* attribute, in the order they took it: the frame always shows the LAST one still holding, and a
|
|
18
|
+
* holder that unmounts falls back to whichever is still underneath it — not just to nothing. A
|
|
19
|
+
* screen nested inside another's frame (the lobby's sideboard step holding `'match'` over the
|
|
20
|
+
* room's own `'fit'`) relies on this: it can give the attribute back to the one it covered.
|
|
18
21
|
*/
|
|
19
22
|
function hold(el, name, value) {
|
|
20
23
|
const frame = frameOf(el);
|
|
21
24
|
if (frame === null)
|
|
22
25
|
return () => undefined;
|
|
23
|
-
const
|
|
24
|
-
HELD.set(frame,
|
|
25
|
-
const
|
|
26
|
-
|
|
26
|
+
const stacks = HELD.get(frame) ?? new Map();
|
|
27
|
+
HELD.set(frame, stacks);
|
|
28
|
+
const stack = stacks.get(name) ?? [];
|
|
29
|
+
stacks.set(name, stack);
|
|
30
|
+
const entry = { value };
|
|
31
|
+
stack.push(entry);
|
|
27
32
|
frame.setAttribute(name, value);
|
|
28
33
|
return () => {
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
const at = stack.indexOf(entry);
|
|
35
|
+
if (at >= 0)
|
|
36
|
+
stack.splice(at, 1);
|
|
37
|
+
const top = stack[stack.length - 1];
|
|
38
|
+
if (top !== undefined)
|
|
39
|
+
frame.setAttribute(name, top.value);
|
|
40
|
+
else
|
|
41
|
+
frame.removeAttribute(name);
|
|
37
42
|
};
|
|
38
43
|
}
|
|
39
44
|
const HELD = new WeakMap();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hadoku/ui-shell",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "0.1.37",
|
|
4
|
+
"gitHead": "f7fa1adf56787f42a175c5ddd4e290f0d1355068",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"description": "The parts of a game's UI any game keeps: chrome, trim, room shell, embed mount, theme and settings frame, UI scale, usage counting, the sound mixer, motion and generic components. One appId parameterizes its storage keys, events and chat prefix. MIT; imports only react, react-dom and @wolffm/*.",
|