react-x11 2.2.1 → 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/README.md +5 -3
- package/package.json +12 -5
- package/src/Reconciler.js +76 -11
- package/src/anchor.js +15 -5
- package/src/appcontext.js +27 -7
- package/src/cocoa/app.js +557 -0
- package/src/cocoa/bezels.js +161 -0
- package/src/cocoa/context2d.js +679 -0
- package/src/cocoa/fonts.js +541 -0
- package/src/cocoa/glarea.js +321 -0
- package/src/cocoa/globalmenu.js +149 -0
- package/src/cocoa/keymap.js +86 -0
- package/src/cocoa/native.js +51 -0
- package/src/cocoa/panehost.js +50 -0
- package/src/cocoa/panewindow.js +236 -0
- package/src/cocoa/presenter.js +837 -0
- package/src/cocoa/window.js +383 -0
- package/src/components/Button.js +68 -0
- package/src/components/Checkbox.js +43 -0
- package/src/components/Radio.js +37 -1
- package/src/components/Select.js +73 -28
- package/src/components/Slider.js +59 -0
- package/src/components/Switch.js +52 -0
- package/src/components/native.js +142 -0
- package/src/decorations.js +21 -24
- package/src/editmenu.js +23 -14
- package/src/events.js +11 -2
- package/src/frame/childmain.js +9 -0
- package/src/frame/index.js +162 -2
- package/src/glnodes.js +43 -0
- package/src/globalmenu.js +11 -3
- package/src/index.d.ts +10 -0
- package/src/node.d.ts +19 -6
- package/src/nodes.js +107 -33
- package/src/paintcache.js +15 -4
- package/src/palette.js +14 -0
- package/src/styles.js +5 -0
- package/src/testing/index.d.ts +8 -0
- package/src/types/elements.d.ts +10 -0
- package/src/types/events.d.ts +5 -2
package/src/palette.js
CHANGED
|
@@ -222,6 +222,19 @@ export const DefaultTheme = {
|
|
|
222
222
|
// than it looks next to a CSS padding for that reason: 12 here is about
|
|
223
223
|
// what 8 came to once a typical face's ascent had been added on.
|
|
224
224
|
paddingY: 12,
|
|
225
|
+
// Which scheme this palette *is* — 'light' or 'dark'. Not a colour but a
|
|
226
|
+
// fact about the colours, for the consumers that have to match them with
|
|
227
|
+
// something they do not paint themselves: the Cocoa backend picks the
|
|
228
|
+
// AppKit appearance its native control bezels are rendered in from this,
|
|
229
|
+
// so a pinned-light app gets light bezels on a dark desktop. A custom
|
|
230
|
+
// dark palette built over the light base should say `scheme: 'dark'`.
|
|
231
|
+
scheme: 'light',
|
|
232
|
+
// How the core controls render where the backend offers the platform's
|
|
233
|
+
// own: `'auto'` (native where supported — today the Cocoa backend),
|
|
234
|
+
// `'native'` (ask for it; warns and falls back to drawn where there is
|
|
235
|
+
// none) or `'drawn'` (always the themed rendering). Per-instance escape
|
|
236
|
+
// hatch: `native={false}` on the one custom-branded control.
|
|
237
|
+
controls: 'auto',
|
|
225
238
|
};
|
|
226
239
|
|
|
227
240
|
// Which pressed token is derived from which pair, when the palette does not
|
|
@@ -332,6 +345,7 @@ export function resolveTheme(value, base = DefaultTheme) {
|
|
|
332
345
|
* theme after it gets to do.
|
|
333
346
|
*/
|
|
334
347
|
export const DarkTheme = resolveTheme({
|
|
348
|
+
scheme: 'dark',
|
|
335
349
|
// A near-black with a little blue in it rather than #000: pure black shows
|
|
336
350
|
// every seam between a window and the widgets on it, and no desktop's dark
|
|
337
351
|
// theme uses it.
|
package/src/styles.js
CHANGED
|
@@ -466,6 +466,11 @@ const isState = (key) => key.charCodeAt(0) === 58; /* ':' */
|
|
|
466
466
|
* what a style can usefully ask about here is the window it is being laid
|
|
467
467
|
* out in, not the screen.
|
|
468
468
|
*
|
|
469
|
+
* The threshold is **logical** pixels, like every other number in a style
|
|
470
|
+
* block: `'@width >= 620'` flips where `width: 620` would fit, whatever
|
|
471
|
+
* the display scale (the window node divides its device size out before
|
|
472
|
+
* matching — `_resolveSizeQueries`).
|
|
473
|
+
*
|
|
469
474
|
* Unlike a state block, a size query *may* set layout properties. That is
|
|
470
475
|
* not an inconsistency: pointer state changes must never reflow the tree,
|
|
471
476
|
* but a size query is only ever re-evaluated during a layout pass that a
|
package/src/testing/index.d.ts
CHANGED
|
@@ -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`. */
|
package/src/types/elements.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ import type {
|
|
|
23
23
|
SubmitEvent,
|
|
24
24
|
SyntheticEvent,
|
|
25
25
|
ViewportEvent,
|
|
26
|
+
WheelEvent,
|
|
26
27
|
WindowResizeEvent,
|
|
27
28
|
} from './events.js';
|
|
28
29
|
|
|
@@ -841,6 +842,15 @@ export interface GlAreaProps extends DrawnProps<DrawnNode> {
|
|
|
841
842
|
onDraw?: (gl: any, info: DrawInfo) => void;
|
|
842
843
|
/** No GL surface — no GLX, or no matching visual. */
|
|
843
844
|
onError?: (err: Error) => void;
|
|
845
|
+
/**
|
|
846
|
+
* The wheel over the surface. Inherited from `EventHandlers` like every
|
|
847
|
+
* other element's, and listed here because it is the **only** pointer
|
|
848
|
+
* event a `<glarea>` currently reports: the surface owns its own X window,
|
|
849
|
+
* so it selects the wheel there and hands it to the window's event manager
|
|
850
|
+
* (see docs/elements.md). Deltas are pixels, `preventDefault()` takes the
|
|
851
|
+
* default scroll action back, and it bubbles from this node.
|
|
852
|
+
*/
|
|
853
|
+
onWheel?: (ev: WheelEvent<DrawnNode>) => void;
|
|
844
854
|
/** A click inside the surface that hit no mesh. */
|
|
845
855
|
onPointerMissed?: (ev: MouseEvent<DrawnNode>) => void;
|
|
846
856
|
}
|
package/src/types/events.d.ts
CHANGED
|
@@ -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. */
|