react-x11 1.2.0 → 2.0.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.
- package/README.md +330 -81
- package/package.json +132 -14
- package/src/ClickToComponent.js +9 -2
- package/src/DevToolsIntegration.js +440 -32
- package/src/Reconciler.js +463 -165
- package/src/a11y.js +1299 -0
- package/src/acceleratorhooks.js +86 -0
- package/src/accelerators.js +128 -0
- package/src/activate.js +168 -0
- package/src/anchor.js +360 -0
- package/src/appcontext.js +161 -0
- package/src/appearance.js +748 -0
- package/src/appearancehooks.js +96 -0
- package/src/apphooks.js +73 -0
- package/src/application.js +748 -0
- package/src/atspi.js +1953 -0
- package/src/bus.js +545 -0
- package/src/bushooks.js +136 -0
- package/src/clientmessage.js +140 -0
- package/src/clipboard.js +121 -0
- package/src/components/Button.js +148 -33
- package/src/components/Checkbox.js +66 -32
- package/src/components/Dialog.js +96 -29
- package/src/components/FileDialog.js +491 -0
- package/src/components/Icon.js +329 -0
- package/src/components/Menu.js +797 -133
- package/src/components/PasswordInput.js +434 -0
- package/src/components/ProgressBar.js +91 -12
- package/src/components/Radio.js +78 -35
- package/src/components/Select.js +255 -65
- package/src/components/Slider.js +102 -41
- package/src/components/SplitPane.js +206 -0
- package/src/components/Switch.js +100 -22
- package/src/components/Table.js +529 -0
- package/src/components/Tabs.js +211 -0
- package/src/components/Tooltip.js +528 -54
- package/src/components/anchor.js +154 -107
- package/src/components/change.js +34 -0
- package/src/components/dnd.js +103 -0
- package/src/components/index.js +16 -3
- package/src/components/keys.js +17 -20
- package/src/components/scribble.js +247 -0
- package/src/components/theme.js +350 -42
- package/src/components/typeahead.js +12 -2
- package/src/compose.js +868 -0
- package/src/compositing.js +224 -0
- package/src/dbusmenu.js +384 -0
- package/src/debug.d.ts +63 -0
- package/src/debug.js +642 -0
- package/src/decorations.js +486 -0
- package/src/desktopsettings.js +209 -0
- package/src/desktopsettingshooks.js +62 -0
- package/src/dnd.js +1725 -0
- package/src/editmenu.js +272 -0
- package/src/errors.js +98 -0
- package/src/events.js +1406 -162
- package/src/extensions.js +45 -0
- package/src/filedialog.js +375 -0
- package/src/filedialoghooks.js +132 -0
- package/src/fonthooks.js +64 -0
- package/src/fonts.js +301 -0
- package/src/foreignnodes.js +519 -0
- package/src/frame/child.js +33 -0
- package/src/frame/childmain.js +274 -0
- package/src/frame/env.js +140 -0
- package/src/frame/index.js +444 -0
- package/src/frame/lifecycle.js +67 -0
- package/src/frame/protocol.js +179 -0
- package/src/frames.js +73 -0
- package/src/glbackend.js +114 -0
- package/src/glnodes.js +125 -67
- package/src/globalmenu.js +683 -0
- package/src/host.d.ts +88 -0
- package/src/host.js +42 -0
- package/src/idle.js +490 -0
- package/src/idlehooks.js +100 -0
- package/src/imagesource.js +349 -0
- package/src/index.d.ts +475 -0
- package/src/index.js +83 -9
- package/src/inputtime.js +206 -0
- package/src/jsx-dev-runtime.d.ts +21 -0
- package/src/jsx-dev-runtime.js +2 -0
- package/src/jsx-runtime.d.ts +39 -0
- package/src/jsx-runtime.js +6 -0
- package/src/keyboard.js +256 -0
- package/src/keyboardstate.js +278 -0
- package/src/keyboardstatehooks.js +58 -0
- package/src/keysyms.d.ts +149 -0
- package/src/keysyms.js +270 -0
- package/src/locale.js +170 -0
- package/src/localehooks.js +47 -0
- package/src/menuitem.js +223 -0
- package/src/node.d.ts +597 -0
- package/src/node.js +44 -0
- package/src/nodes.js +9546 -690
- package/src/ntk.d.ts +44 -0
- package/src/ntk.js +25 -0
- package/src/paintcache.js +366 -0
- package/src/palette.js +380 -0
- package/src/pastestate.js +66 -0
- package/src/portal.js +461 -0
- package/src/priority.js +26 -0
- package/src/refresh/index.d.ts +40 -0
- package/src/refresh/index.js +122 -0
- package/src/refresh/loader.d.ts +37 -0
- package/src/refresh/loader.js +401 -0
- package/src/refresh/register.d.ts +5 -0
- package/src/refresh/register.js +13 -0
- package/src/registry.js +232 -0
- package/src/scale.js +626 -0
- package/src/scalehooks.js +27 -0
- package/src/screencolor.js +640 -0
- package/src/screencolorhooks.js +101 -0
- package/src/screens.js +754 -0
- package/src/screenshooks.js +137 -0
- package/src/startup.js +302 -0
- package/src/style.d.ts +126 -0
- package/src/style.js +33 -0
- package/src/styles.js +1482 -6
- package/src/svgnodes.js +306 -0
- package/src/testing/a11y.js +484 -0
- package/src/testing/components.js +414 -0
- package/src/testing/events.js +407 -0
- package/src/testing/harness.js +455 -0
- package/src/testing/index.d.ts +558 -0
- package/src/testing/index.js +85 -0
- package/src/testing/mock-app.js +463 -0
- package/src/testing/pixels.js +152 -0
- package/src/testing/queries.js +224 -0
- package/src/textrange.js +83 -0
- package/src/textselection.js +439 -0
- package/src/trace-registry.js +63 -0
- package/src/transfer.js +93 -0
- package/src/types/appearance.d.ts +84 -0
- package/src/types/application.d.ts +173 -0
- package/src/types/components.d.ts +820 -0
- package/src/types/dbus.d.ts +177 -0
- package/src/types/elements.d.ts +897 -0
- package/src/types/events.d.ts +549 -0
- package/src/types/filedialog.d.ts +260 -0
- package/src/types/fonts.d.ts +124 -0
- package/src/types/frame.d.ts +146 -0
- package/src/types/globalmenu.d.ts +42 -0
- package/src/types/nodes.d.ts +199 -0
- package/src/types/screencolor.d.ts +84 -0
- package/src/types/style.d.ts +434 -0
- package/src/types/system.d.ts +287 -0
- package/src/windowid.js +151 -0
- package/src/windowstate.js +393 -0
- package/src/xsettings.js +336 -0
- package/src/yoga.d.ts +55 -0
- package/src/yoga.js +135 -0
- package/src/components/Canvas3D.js +0 -28
- package/src/geometry3d.js +0 -223
- package/src/pointer3d.js +0 -158
- package/src/raycast3d.js +0 -146
- package/src/richnodes.js +0 -436
- package/src/scene3d.js +0 -683
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom URI schemes and single-instance launches:
|
|
3
|
+
* `registerApplication()`, `useAppOpen()` and the raise an inbound link
|
|
4
|
+
* needs. See docs/uri-schemes.md.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { DrawnNode, NtkWindow } from './nodes.js';
|
|
8
|
+
import type { RefObject } from 'react';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* What the desktop said about the launch this handler is answering.
|
|
12
|
+
*
|
|
13
|
+
* **Every field is untrusted.** `org.freedesktop.Application.Open` is callable
|
|
14
|
+
* by any peer on the session bus — a per-user socket, not an authorization
|
|
15
|
+
* check — so a hostile local process can fabricate all of it. The timestamp in
|
|
16
|
+
* particular is a hint, not a credential: the worst it buys an attacker is
|
|
17
|
+
* making this app steal its own focus.
|
|
18
|
+
*/
|
|
19
|
+
export interface LaunchContext {
|
|
20
|
+
/** `platform_data` as received, with variants unwrapped. */
|
|
21
|
+
readonly platformData: Readonly<Record<string, unknown>>;
|
|
22
|
+
/**
|
|
23
|
+
* The X server timestamp of the user action behind the launch, from the
|
|
24
|
+
* `_TIME` suffix of `desktop-startup-id`, or `null`.
|
|
25
|
+
*
|
|
26
|
+
* This is the value {@link activateWindow} wants. `null` is a real answer —
|
|
27
|
+
* a launch from a shell has no timestamp — and `0` is not a substitute for
|
|
28
|
+
* it: EWMH gives zero its own meaning.
|
|
29
|
+
*/
|
|
30
|
+
readonly timestamp: number | null;
|
|
31
|
+
/** `desktop-startup-id`, unparsed, or `null`. */
|
|
32
|
+
readonly startupId: string | null;
|
|
33
|
+
/** `activation-token`. Read and exposed; there is no Wayland here. */
|
|
34
|
+
readonly activationToken: string | null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface ApplicationOptions {
|
|
38
|
+
/**
|
|
39
|
+
* The well-known D-Bus name, the `.desktop` file's basename and the URI
|
|
40
|
+
* scheme, all at once — the desktop entry spec ties them together. A
|
|
41
|
+
* malformed one throws: it is a mistake in the source, not a fact about the
|
|
42
|
+
* machine.
|
|
43
|
+
*/
|
|
44
|
+
appId: string;
|
|
45
|
+
/**
|
|
46
|
+
* The schemes this app answers for. Used to filter what a second instance
|
|
47
|
+
* forwards and what an inbound `Open` delivers; `file:` is always allowed
|
|
48
|
+
* alongside them, and omitting this filters nothing.
|
|
49
|
+
*
|
|
50
|
+
* `http`, `https` and `file` are refused — being the default browser or file
|
|
51
|
+
* handler is a different feature. RFC 8252 §7.1 wants a scheme derived from
|
|
52
|
+
* a domain you control, written in reverse.
|
|
53
|
+
*/
|
|
54
|
+
schemes?: string[];
|
|
55
|
+
/** Same as subscribing with {@link onAppOpen}, before anything can arrive. */
|
|
56
|
+
onOpen?: (uris: string[], ctx: LaunchContext) => void;
|
|
57
|
+
onActivate?: (ctx: LaunchContext) => void;
|
|
58
|
+
/**
|
|
59
|
+
* A desktop action was invoked (`ActivateAction`). Without a handler the
|
|
60
|
+
* method is a no-op that still replies correctly, which is the difference
|
|
61
|
+
* between an unimplemented action and an app the shell thinks is broken.
|
|
62
|
+
*/
|
|
63
|
+
onAction?: (name: string, params: unknown[], ctx: LaunchContext) => void;
|
|
64
|
+
/**
|
|
65
|
+
* The launch arguments to look for URIs in. Defaults to
|
|
66
|
+
* `process.argv.slice(2)`, which is where `Exec=my-app %u` puts them.
|
|
67
|
+
*/
|
|
68
|
+
argv?: string[];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface AppRegistration {
|
|
72
|
+
/**
|
|
73
|
+
* `'primary'` — this process owns the name and will receive `Open`.
|
|
74
|
+
*
|
|
75
|
+
* `'secondary'` — another instance owns it, this launch's URIs have been
|
|
76
|
+
* forwarded to it, and the caller should exit. **The library does not exit
|
|
77
|
+
* for you.**
|
|
78
|
+
*/
|
|
79
|
+
readonly role: 'primary' | 'secondary';
|
|
80
|
+
readonly appId: string;
|
|
81
|
+
/** Derived from `appId`, never passed in — exposed because the dash rule is
|
|
82
|
+
* easy to get wrong and fails silently. */
|
|
83
|
+
readonly objectPath: string;
|
|
84
|
+
/** Give the name back and stop serving. Idempotent. */
|
|
85
|
+
release(): Promise<void>;
|
|
86
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Own this app's name on the session bus and export
|
|
91
|
+
* `org.freedesktop.Application` on it.
|
|
92
|
+
*
|
|
93
|
+
* ```js
|
|
94
|
+
* const app = await registerApplication({
|
|
95
|
+
* appId: 'com.example.myapp',
|
|
96
|
+
* schemes: ['com.example.myapp'],
|
|
97
|
+
* });
|
|
98
|
+
* if (app?.role === 'secondary') process.exit(0);
|
|
99
|
+
* const root = await createRoot();
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* **Call it before `createRoot`.** On the D-Bus path the bus started this
|
|
103
|
+
* process *because* someone called `Open`, and that call is outstanding while
|
|
104
|
+
* the app boots.
|
|
105
|
+
*
|
|
106
|
+
* `null` means there is no session bus — ssh, a bare `startx`, a container,
|
|
107
|
+
* CI, Node 20 without the transport. The app runs as an ordinary single-window
|
|
108
|
+
* program, and a URI that arrived in `argv` still reaches {@link onAppOpen}.
|
|
109
|
+
* It never rejects for anything about the machine; a malformed `appId` or an
|
|
110
|
+
* unusable scheme throws.
|
|
111
|
+
*/
|
|
112
|
+
export declare function registerApplication(
|
|
113
|
+
options: ApplicationOptions,
|
|
114
|
+
): Promise<AppRegistration | null>;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* The desktop handed this app URIs to open. Returns an unsubscribe function.
|
|
118
|
+
* Anything that arrived before the first handler attached is replayed to it.
|
|
119
|
+
*/
|
|
120
|
+
export declare function onAppOpen(
|
|
121
|
+
handler: (uris: string[], ctx: LaunchContext) => void,
|
|
122
|
+
): () => void;
|
|
123
|
+
|
|
124
|
+
/** The desktop asked this app to come forward with nothing to open. */
|
|
125
|
+
export declare function onAppActivate(
|
|
126
|
+
handler: (ctx: LaunchContext) => void,
|
|
127
|
+
): () => void;
|
|
128
|
+
|
|
129
|
+
/** {@link onAppOpen} as rendering code sees it. Nothing to wrap. */
|
|
130
|
+
export declare function useAppOpen(
|
|
131
|
+
handler: (uris: string[], ctx: LaunchContext) => void,
|
|
132
|
+
): void;
|
|
133
|
+
|
|
134
|
+
/** {@link onAppActivate} as rendering code sees it. */
|
|
135
|
+
export declare function useAppActivate(
|
|
136
|
+
handler: (ctx: LaunchContext) => void,
|
|
137
|
+
): void;
|
|
138
|
+
|
|
139
|
+
export interface ActivateWindowOptions {
|
|
140
|
+
/**
|
|
141
|
+
* The X server time of the user action being answered.
|
|
142
|
+
*
|
|
143
|
+
* Omitted, the last input this app saw is used — EWMH's own definition of
|
|
144
|
+
* the field. A deep link should pass `ctx.timestamp` instead: the click in
|
|
145
|
+
* the browser is the user action, not whatever this app last saw. `null`
|
|
146
|
+
* sends `CurrentTime`, which most window managers will decline.
|
|
147
|
+
*/
|
|
148
|
+
timestamp?: number | null;
|
|
149
|
+
/** EWMH source indication: `1` an application (default), `2` a pager. */
|
|
150
|
+
source?: 1 | 2;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Ask the window manager to raise and focus a window.
|
|
155
|
+
*
|
|
156
|
+
* `target` is anything {@link windowIdOf} accepts, or nothing — in which case
|
|
157
|
+
* this app's only top-level window is used (its focused one, when it has
|
|
158
|
+
* several).
|
|
159
|
+
*
|
|
160
|
+
* Returns whether the request was **issued**. `true` is not a promise that the
|
|
161
|
+
* window came forward: EWMH lets the window manager refuse and set
|
|
162
|
+
* `_NET_WM_STATE_DEMANDS_ATTENTION` instead, and no client can tell the
|
|
163
|
+
* difference from here.
|
|
164
|
+
*/
|
|
165
|
+
export declare function activateWindow(
|
|
166
|
+
target?:
|
|
167
|
+
| NtkWindow
|
|
168
|
+
| DrawnNode
|
|
169
|
+
| RefObject<NtkWindow | DrawnNode | null>
|
|
170
|
+
| number
|
|
171
|
+
| null,
|
|
172
|
+
options?: ActivateWindowOptions,
|
|
173
|
+
): boolean;
|