react-x11 2.15.3 → 2.16.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.
Files changed (67) hide show
  1. package/README.md +37 -0
  2. package/package.json +3 -3
  3. package/src/Reconciler.js +85 -22
  4. package/src/acceleratorhooks.js +40 -6
  5. package/src/anchor.js +79 -19
  6. package/src/capabilities.js +29 -4
  7. package/src/cocoa/app.js +211 -11
  8. package/src/cocoa/context2d.js +23 -0
  9. package/src/cocoa/fonts.js +78 -0
  10. package/src/cocoa/presenter.js +17 -0
  11. package/src/cocoa/promotion.js +20 -0
  12. package/src/cocoa/relaunch.js +8 -3
  13. package/src/cocoa/symbols.js +64 -0
  14. package/src/cocoa/threaded.js +24 -4
  15. package/src/cocoa/window.js +362 -139
  16. package/src/components/ProgressBar.js +1 -1
  17. package/src/components/Slider.js +72 -39
  18. package/src/components/anchor.js +7 -2
  19. package/src/components/index.js +1 -0
  20. package/src/components/theme.js +32 -28
  21. package/src/desktopcapabilityhooks.js +29 -6
  22. package/src/filedialoghooks.js +3 -5
  23. package/src/frame/childmain.js +8 -20
  24. package/src/frame/env.js +2 -10
  25. package/src/icontheme.js +240 -0
  26. package/src/imagesource.js +83 -1
  27. package/src/index.d.ts +10 -1
  28. package/src/index.js +3 -0
  29. package/src/keysymchars.js +47 -0
  30. package/src/keysyms.d.ts +19 -1
  31. package/src/keysyms.js +107 -8
  32. package/src/node.d.ts +7 -0
  33. package/src/nodes/animation.js +17 -47
  34. package/src/nodes/cascade.js +17 -2
  35. package/src/nodes/image.js +63 -1
  36. package/src/nodes/kinds.js +12 -0
  37. package/src/nodes/layout.js +5 -1
  38. package/src/nodes/node.js +17 -3
  39. package/src/nodes/paint.js +117 -0
  40. package/src/nodes/scope.js +259 -0
  41. package/src/nodes/scrollable.js +53 -6
  42. package/src/nodes/text.js +2 -0
  43. package/src/nodes/textarea.js +1 -1
  44. package/src/nodes/textinput.js +1 -1
  45. package/src/nodes/window/anchoring.js +45 -18
  46. package/src/nodes/window/flush.js +6 -5
  47. package/src/nodes/window/popup.js +10 -0
  48. package/src/nodes/window/size.js +40 -2
  49. package/src/nodes/window/window.js +41 -14
  50. package/src/registry.js +2 -1
  51. package/src/screens.js +159 -24
  52. package/src/settings.js +332 -0
  53. package/src/statusnotifier.js +164 -17
  54. package/src/styles.js +212 -8
  55. package/src/symbols.js +200 -0
  56. package/src/testing/mock-app.js +10 -0
  57. package/src/trayhooks.js +21 -5
  58. package/src/types/capabilities.d.ts +13 -1
  59. package/src/types/components.d.ts +33 -0
  60. package/src/types/elements.d.ts +57 -6
  61. package/src/types/events.d.ts +5 -0
  62. package/src/types/filedialog.d.ts +3 -1
  63. package/src/types/style.d.ts +57 -0
  64. package/src/types/system.d.ts +104 -0
  65. package/src/types/tray.d.ts +14 -2
  66. package/src/wayland/xkb.js +170 -59
  67. package/src/windowid.js +62 -20
@@ -188,10 +188,23 @@ export function fdStream(fd, write = fs.writeSync) {
188
188
  /**
189
189
  * Stdout and stderr on fds 1 and 2, and a console over them — the console
190
190
  * too, because Bun's writes past `process.stdout` altogether.
191
+ *
192
+ * A `Console` is only the writing half of the runtime's console. Node adds
193
+ * the inspector's methods on top — `timeStamp`, `profile`, `profileEnd`,
194
+ * `context`, `createTask` — and `console.Console`, so the new console takes
195
+ * whatever it lacks from the one it replaces, as it is. Code that loaded
196
+ * before this saw them: React's development reconciler asks once, as it
197
+ * loads, whether `console.timeStamp` is a function, and calls it on every
198
+ * render after, so a script importing `react-x11/test` ahead of `react-x11`
199
+ * threw `console.timeStamp is not a function` on its first render.
191
200
  */
192
- export function installStdio(proc = process, global = globalThis) {
193
- const stdout = fdStream(1);
194
- const stderr = fdStream(2);
201
+ export function installStdio(
202
+ proc = process,
203
+ global = globalThis,
204
+ write = fs.writeSync,
205
+ ) {
206
+ const stdout = fdStream(1, write);
207
+ const stderr = fdStream(2, write);
195
208
  Object.defineProperty(proc, 'stdout', {
196
209
  configurable: true,
197
210
  get: () => stdout,
@@ -200,10 +213,17 @@ export function installStdio(proc = process, global = globalThis) {
200
213
  configurable: true,
201
214
  get: () => stderr,
202
215
  });
216
+ const runtime = global.console;
217
+ const ours = new Console({ stdout, stderr });
218
+ for (const key of Reflect.ownKeys(runtime)) {
219
+ if (key in ours) continue;
220
+ const desc = Object.getOwnPropertyDescriptor(runtime, key);
221
+ Object.defineProperty(ours, key, desc);
222
+ }
203
223
  Object.defineProperty(global, 'console', {
204
224
  configurable: true,
205
225
  writable: true,
206
- value: new Console({ stdout, stderr }),
226
+ value: ours,
207
227
  });
208
228
  }
209
229