react-x11 2.3.0 → 2.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-x11",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "react renderer with X11 as a target",
5
5
  "main": "./src/index.js",
6
6
  "files": [
package/src/node.d.ts CHANGED
@@ -106,8 +106,9 @@ export interface A11ySceneItem {
106
106
  * is destroyed and recreated under every screen reader holding it. */
107
107
  id: string;
108
108
  /** Where it is drawn, in the owning window's coordinates — the same
109
- * space as `abs` and a mouse event's `x`/`y`. Where AT focus draws and
110
- * what a magnifier follows. */
109
+ * space as `abs`, which is device pixels; a mouse event's `x`/`y` are
110
+ * logical, `scale` apart (docs/scale.md). Where AT focus draws and what
111
+ * a magnifier follows. */
111
112
  rect: Rect;
112
113
  /** The ARIA role it plays. `'group'` when it says none, which is
113
114
  * audible and promises nothing. A role that promises activation
@@ -186,8 +187,19 @@ export declare class Node {
186
187
  /** The owning `<window>` node, once attached. */
187
188
  readonly root: Node | null;
188
189
  readonly destroyed: boolean;
189
- /** Position and size within the owning window, valid after layout. */
190
+ /** Position and size within the owning window, valid after layout. In
191
+ * device pixels, like everything painted (docs/scale.md). */
190
192
  readonly abs: Rect;
193
+ /**
194
+ * Device pixels per logical pixel for this node's connection — resolved
195
+ * once by `createRoot` (docs/scale.md) and constant for the node's life.
196
+ * `this.style`, `this.abs` and `contentBox()` are already device pixels;
197
+ * a synthetic event's `x`/`y` are logical. This is for what never passes
198
+ * through a style — a paint constant such as a caret's width, or an
199
+ * event coordinate on its way to a comparison with `abs`. `1` on an
200
+ * ordinary display, `2` on a retina panel.
201
+ */
202
+ readonly scale: number;
191
203
  /** `abs` inset by the border and the padding — where the content goes,
192
204
  * and where every built-in draws. The insets come off the layout, which
193
205
  * is where percentages and the per-side overrides have already been
@@ -221,9 +233,10 @@ export declare class Node {
221
233
  //
222
234
  // Four questions in one index space and one coordinate space: characters
223
235
  // are **code points**, rectangles are in the owning window's coordinates —
224
- // the same ones `abs`, `contentBox()` and a mouse event's `x`/`y` use.
225
- // An element that answers them can be selected across by a `selectable`
226
- // ancestor with no registration of any kind.
236
+ // the same ones `abs` and `contentBox()` use, which are device pixels; a
237
+ // mouse event's `x`/`y` are the logical ones, `scale` apart. An element
238
+ // that answers them can be selected across by a `selectable` ancestor
239
+ // with no registration of any kind.
227
240
 
228
241
  /** This element's text, or null when it has none. The default. */
229
242
  textContent(): string | null;
@@ -66,6 +66,14 @@ export interface RenderX11Options {
66
66
  * D-Bus anywhere. See docs/accessibility.md.
67
67
  */
68
68
  a11y?: boolean;
69
+ /**
70
+ * Pin the display scale — device pixels per logical pixel (docs/scale.md).
71
+ * The headless harnesses resolve to exactly 1 on their own, so every
72
+ * geometry assertion means its numbers literally; `2` renders the tree
73
+ * the way a retina panel does, which is the only way to catch an element
74
+ * that compares a logical event coordinate with its device `abs`.
75
+ */
76
+ scale?: 'auto' | number;
69
77
  }
70
78
 
71
79
  /** One recorded assistive-technology fact, plus its one-line `summary`. */
@@ -13,7 +13,8 @@ export interface NativeEvent {
13
13
  /** X event type number. */
14
14
  type: number;
15
15
  name?: string;
16
- /** Window-relative pointer position. */
16
+ /** Window-relative pointer position, in device pixels — the numbers off
17
+ * the wire, and the ones to compare with a node's `abs` (docs/scale.md). */
17
18
  x: number;
18
19
  y: number;
19
20
  /** Screen coordinates — what you anchor a `<popup>` at. */
@@ -33,7 +34,9 @@ export interface SyntheticEvent<T = DrawnNode> {
33
34
  target: T;
34
35
  /** The node whose handler is running. */
35
36
  currentTarget: T | null;
36
- /** Window coordinates. */
37
+ /** Window coordinates, in logical pixels — the unit styles are written
38
+ * in. `nativeEvent.x`/`y` are the same point in device pixels, which is
39
+ * what a node's `abs` is in (docs/scale.md). */
37
40
  x: number;
38
41
  y: number;
39
42
  /** Coordinates relative to `target`'s box. */