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,62 @@
|
|
|
1
|
+
// `useDesktopSettings()` — the desktop's interaction timings, as something a
|
|
2
|
+
// component re-renders on.
|
|
3
|
+
//
|
|
4
|
+
// The store lives in `desktopsettings.js`, which the renderer reads
|
|
5
|
+
// synchronously on the caret, click and drag paths. This is the same values,
|
|
6
|
+
// for an app drawing something the renderer does not.
|
|
7
|
+
|
|
8
|
+
import { useCallback, useSyncExternalStore } from 'react';
|
|
9
|
+
|
|
10
|
+
import { useApp } from './appcontext.js';
|
|
11
|
+
import { desktopSettings, watchDesktopSettings } from './desktopsettings.js';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* How this desktop wants an application to feel, live.
|
|
15
|
+
*
|
|
16
|
+
* ```jsx
|
|
17
|
+
* const { doubleClickMs, dragThreshold } = useDesktopSettings();
|
|
18
|
+
*
|
|
19
|
+
* // a <canvas> implementing its own gestures matches the rest of the desktop
|
|
20
|
+
* const onPointerDown = (e) => {
|
|
21
|
+
* const now = e.timeStamp;
|
|
22
|
+
* if (now - last.current < doubleClickMs) openItem();
|
|
23
|
+
* last.current = now;
|
|
24
|
+
* };
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* | | |
|
|
28
|
+
* | --- | --- |
|
|
29
|
+
* | `caretBlink` | **false means do not blink at all** — an accessibility setting |
|
|
30
|
+
* | `caretBlinkMs` | how long a caret stays in each state (530) |
|
|
31
|
+
* | `doubleClickMs` | how long a second click has to arrive in (400) |
|
|
32
|
+
* | `doubleClickDistance` | and how far it may land from the first (4px) |
|
|
33
|
+
* | `dragThreshold` | how far a press moves before it is a drag, not a click (4px) |
|
|
34
|
+
* | `source` | `'xsettings'`, or null where no settings daemon answered |
|
|
35
|
+
*
|
|
36
|
+
* **The built-in controls already follow these** — `<textinput>`'s caret,
|
|
37
|
+
* the click counting behind `ev.detail`, and the XDND drag threshold all
|
|
38
|
+
* read the same values. This hook is for an app drawing its own: a `<canvas>`
|
|
39
|
+
* with a text cursor in it, a custom gesture, a diagram editor with its own
|
|
40
|
+
* drag. Reach for it so that one widget on the screen does not feel unlike
|
|
41
|
+
* every other.
|
|
42
|
+
*
|
|
43
|
+
* `caretBlink` deserves the callout. A caret that ignores it is not a
|
|
44
|
+
* cosmetic miss: a moving thing on screen is what some people cannot read
|
|
45
|
+
* past, which is why the desktop offers the switch. Draw the caret solid
|
|
46
|
+
* rather than not at all.
|
|
47
|
+
*
|
|
48
|
+
* XSETTINGS is the only source — there is no portal interface for any of
|
|
49
|
+
* this — so on a desktop with no settings daemon `source` is null and the
|
|
50
|
+
* numbers above are this renderer's own defaults. They are not GTK's: the
|
|
51
|
+
* point of this hook is to follow a desktop that expressed a preference, not
|
|
52
|
+
* to change what happens on one that did not.
|
|
53
|
+
*/
|
|
54
|
+
export function useDesktopSettings() {
|
|
55
|
+
const app = useApp();
|
|
56
|
+
const subscribe = useCallback(
|
|
57
|
+
(onChange) => watchDesktopSettings(app, onChange),
|
|
58
|
+
[app],
|
|
59
|
+
);
|
|
60
|
+
const snapshot = useCallback(() => desktopSettings(app), [app]);
|
|
61
|
+
return useSyncExternalStore(subscribe, snapshot, snapshot);
|
|
62
|
+
}
|