@hadoku/ui-shell 0.1.90 → 0.1.92

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.
@@ -100,7 +100,13 @@ export function uiPx(px, node) {
100
100
  const at = node ?? (typeof document === 'undefined' ? null : document.documentElement);
101
101
  if (at == null)
102
102
  return px;
103
- const scale = parseFloat(getComputedStyle(scaleRootOf(at)).getPropertyValue('--ui-scale'));
103
+ const root = scaleRootOf(at);
104
+ // `applyUiScale` writes the scale inline and the document root's stylesheet default is 1, so neither needs a
105
+ // computed-style read — one forces the page's style up to date, and a render calls this on every pick
106
+ // (perf catalogue P31). Only a shadow host with nothing written asks what it inherits.
107
+ const inline = root.style.getPropertyValue('--ui-scale');
108
+ const written = inline !== '' ? inline : root === root.ownerDocument.documentElement ? '1' : getComputedStyle(root).getPropertyValue('--ui-scale');
109
+ const scale = parseFloat(written);
104
110
  return Number.isFinite(scale) && scale > 0 ? px * scale : px;
105
111
  }
106
112
  /** Per game (`<appId>:ui-scale`); for cardtable, the literal key stays `cardtable:ui-scale`. */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hadoku/ui-shell",
3
- "version": "0.1.90",
4
- "gitHead": "e23485ea4ec7df82776c1c582ec5e8c4e7e34f0d",
3
+ "version": "0.1.92",
4
+ "gitHead": "a48a97a570e6e442a8ea745c5c18eaad41f1bfdd",
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/*.",