react-x11 2.10.2 → 2.12.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.
Files changed (100) hide show
  1. package/README.md +278 -129
  2. package/package.json +10 -3
  3. package/src/Reconciler.js +15 -17
  4. package/src/a11y.js +2 -2
  5. package/src/anchor.js +7 -5
  6. package/src/bootstrap.js +14 -0
  7. package/src/clientmessage.js +1 -1
  8. package/src/cocoa/app.js +304 -49
  9. package/src/cocoa/bezels.js +175 -30
  10. package/src/cocoa/dnd.js +27 -13
  11. package/src/cocoa/fonts.js +3 -3
  12. package/src/cocoa/glarea.js +20 -3
  13. package/src/cocoa/main.d.ts +8 -0
  14. package/src/cocoa/main.js +43 -0
  15. package/src/cocoa/panehost.js +15 -5
  16. package/src/cocoa/presenter.js +13 -9
  17. package/src/cocoa/promotion.js +4 -7
  18. package/src/cocoa/relaunch.js +207 -0
  19. package/src/cocoa/screencolor.js +62 -0
  20. package/src/cocoa/threaded.js +246 -0
  21. package/src/cocoa/window.js +256 -42
  22. package/src/components/Select.js +2 -2
  23. package/src/components/anchor.js +3 -3
  24. package/src/components/native.js +12 -7
  25. package/src/components/theme.js +2 -2
  26. package/src/debug.js +1 -1
  27. package/src/decorations.js +1 -1
  28. package/src/editmenu.js +2 -2
  29. package/src/errors.js +46 -0
  30. package/src/events.js +6 -6
  31. package/src/foreignnodes.js +3 -2
  32. package/src/frames.js +2 -2
  33. package/src/glnodes.js +1 -1
  34. package/src/grid.js +1653 -0
  35. package/src/host.d.ts +230 -0
  36. package/src/host.js +11 -3
  37. package/src/imagesource.js +1 -1
  38. package/src/index.d.ts +21 -4
  39. package/src/index.js +9 -1
  40. package/src/layouts.js +721 -0
  41. package/src/node.d.ts +4 -2
  42. package/src/node.js +19 -21
  43. package/src/nodes/animation.js +644 -0
  44. package/src/nodes/box.js +21 -0
  45. package/src/nodes/boxpaint.js +473 -0
  46. package/src/nodes/canvas.js +269 -0
  47. package/src/nodes/cascade.js +600 -0
  48. package/src/nodes/damage.js +183 -0
  49. package/src/nodes/edithistory.js +124 -0
  50. package/src/nodes/editmenupopup.js +260 -0
  51. package/src/nodes/hittest.js +185 -0
  52. package/src/nodes/image.js +266 -0
  53. package/src/nodes/install.js +75 -0
  54. package/src/nodes/invalidate.js +465 -0
  55. package/src/nodes/kinds.js +31 -0
  56. package/src/nodes/layout.js +439 -0
  57. package/src/nodes/layouthost.js +949 -0
  58. package/src/nodes/node.js +868 -0
  59. package/src/nodes/paint.js +466 -0
  60. package/src/nodes/position.js +366 -0
  61. package/src/nodes/preedit.js +127 -0
  62. package/src/nodes/queries.js +330 -0
  63. package/src/nodes/rects.js +102 -0
  64. package/src/nodes/scrollable.js +891 -0
  65. package/src/nodes/scrollbars.js +138 -0
  66. package/src/nodes/scrollblit.js +1034 -0
  67. package/src/nodes/selectable.js +142 -0
  68. package/src/nodes/styling.js +225 -0
  69. package/src/nodes/text.js +649 -0
  70. package/src/nodes/textarea.js +391 -0
  71. package/src/nodes/textinput.js +1146 -0
  72. package/src/nodes/util.js +17 -0
  73. package/src/nodes/window/anchoring.js +161 -0
  74. package/src/nodes/window/capabilities.js +190 -0
  75. package/src/nodes/window/debugpaint.js +83 -0
  76. package/src/nodes/window/droptarget.js +145 -0
  77. package/src/nodes/window/floors.js +577 -0
  78. package/src/nodes/window/flush.js +334 -0
  79. package/src/nodes/window/hints.js +482 -0
  80. package/src/nodes/window/listeners.js +222 -0
  81. package/src/nodes/window/popup.js +71 -0
  82. package/src/nodes/window/size.js +591 -0
  83. package/src/nodes/window/window.js +945 -0
  84. package/src/palette.js +1 -1
  85. package/src/registry.js +7 -3
  86. package/src/screencolor.js +212 -38
  87. package/src/screencolorhooks.js +6 -2
  88. package/src/styles.js +137 -15
  89. package/src/svgnodes.js +2 -1
  90. package/src/testing/harness.js +2 -2
  91. package/src/textselection.js +5 -3
  92. package/src/trace-registry.js +1 -1
  93. package/src/types/components.d.ts +38 -6
  94. package/src/types/elements.d.ts +11 -1
  95. package/src/types/nodes.d.ts +33 -5
  96. package/src/types/screencolor.d.ts +20 -14
  97. package/src/types/style.d.ts +94 -3
  98. package/src/windowstate.js +1 -1
  99. package/src/yoga.js +1 -1
  100. package/src/nodes.js +0 -13120
@@ -37,8 +37,39 @@ export type Align =
37
37
  | 'space-around';
38
38
 
39
39
  export type FlexWrap = 'nowrap' | 'wrap' | 'wrap-reverse';
40
- export type PositionType = 'static' | 'relative' | 'absolute';
41
- export type Display = 'flex' | 'none';
40
+ export type PositionType = 'static' | 'relative' | 'absolute' | 'sticky';
41
+ /** `'grid'` lays the box's children out as a CSS grid — see docs/styling.md,
42
+ * "Grid"; `'none'` hides the box and everything in it. */
43
+ export type Display = 'flex' | 'grid' | 'none';
44
+
45
+ /**
46
+ * A grid line, as CSS's `grid-column` / `grid-row` write it: a number
47
+ * counting from 1 at the start or from -1 at the end, `'span 2'`, or a
48
+ * start and an end — `'2 / 4'`, `'1 / -1'`, `'2 / span 3'`.
49
+ */
50
+ export type GridLine =
51
+ | number
52
+ | 'auto'
53
+ | `span ${number}`
54
+ | `${number} / ${number}`
55
+ | `${number}/${number}`
56
+ | `${number} / span ${number}`
57
+ | `span ${number} / ${number}`
58
+ | `${number} / auto`
59
+ | `auto / ${number}`
60
+ | `auto / span ${number}`;
61
+
62
+ export type GridAutoFlow =
63
+ | 'row'
64
+ | 'column'
65
+ | 'dense'
66
+ | 'row dense'
67
+ | 'column dense'
68
+ | 'dense row'
69
+ | 'dense column';
70
+
71
+ export type JustifyItems = 'flex-start' | 'center' | 'flex-end' | 'stretch';
72
+ export type JustifySelf = 'auto' | JustifyItems;
42
73
  export type Overflow = 'visible' | 'hidden' | 'scroll';
43
74
  export type BorderStyle = 'solid' | 'dashed';
44
75
  export type PointerEvents = 'auto' | 'none';
@@ -108,7 +139,67 @@ export interface LayoutStyle {
108
139
  * say `minWidth: 0` (or an `overflow` that clips) for that. */
109
140
  flexShrink?: number;
110
141
  flexBasis?: Dimension;
111
- position?: PositionType;
142
+ /**
143
+ * `'relative'` (the default) and `'absolute'` move the box by its insets.
144
+ * `'sticky'` lays it out in flow like `'relative'`, then holds it inside
145
+ * the nearest scroll pane's edges by its insets — `top: 0` keeps a header
146
+ * at the top of the pane until its parent scrolls away and takes it
147
+ * along. A position registered with `registerPosition` (react-x11/host)
148
+ * is written the same way, by name or with its options, and also lays the
149
+ * box out in flow and then moves it. Either paints over its siblings of
150
+ * the same `zIndex`. See docs/styling.md, "Sticky positioning" and
151
+ * "Custom positions".
152
+ */
153
+ position?: import('../host.js').PositionValue;
154
+ /**
155
+ * A layout algorithm arranging this box's children in place of flexbox,
156
+ * by name or written with its options — `'equal-row'`,
157
+ * `{ name: 'masonry', columns: 3 }`. It runs inside the layout pass; the
158
+ * box's own `gap`, `justifyContent` and `alignItems` are what it spaces
159
+ * and aligns by. See docs/styling.md, "Custom layouts".
160
+ */
161
+ layout?: import('../host.js').LayoutValue;
162
+ /** What this box tells the layout arranging it — `masonry`'s `span`. */
163
+ layoutItem?: import('../host.js').CustomLayoutItem;
164
+ /**
165
+ * A `display: 'grid'` box's columns: a CSS track list — `'200px 1fr'`,
166
+ * `'auto 1fr'`, `'repeat(auto-fill, minmax(200px, 1fr))'` — with lengths
167
+ * in logical pixels written `px`, `%` of the grid and `fr` shares; or a
168
+ * number, that many equal columns (`repeat(n, minmax(0, 1fr))`). A list
169
+ * that would not lay out is an error naming it. See docs/styling.md,
170
+ * "Grid".
171
+ */
172
+ gridTemplateColumns?: number | string;
173
+ /** …its rows, the same way. */
174
+ gridTemplateRows?: number | string;
175
+ /** Named areas: one quoted string per row, as CSS writes them —
176
+ * `'"head head" "side main"'` — or an array of the rows. */
177
+ gridTemplateAreas?: string | readonly string[];
178
+ /** The size of a column the grid adds for an item placed past its
179
+ * template: a track list taken in turn, or a number — a length, here. */
180
+ gridAutoColumns?: number | string;
181
+ /** …and of a row, the same way. */
182
+ gridAutoRows?: number | string;
183
+ /** How a child with no place of its own is placed: along the rows (the
184
+ * default) or the columns — and `dense` to back-fill a hole. */
185
+ gridAutoFlow?: GridAutoFlow;
186
+ /** Where each child sits across its area when it is narrower than the
187
+ * area; `alignItems` is the other axis. */
188
+ justifyItems?: JustifyItems;
189
+ /** A grid child's columns: `2`, `'span 2'`, `'1 / -1'`. */
190
+ gridColumn?: GridLine;
191
+ /** …and its rows. */
192
+ gridRow?: GridLine;
193
+ /** The name of an area in the grid's `gridTemplateAreas`, or CSS's four
194
+ * lines; `gridColumn` and `gridRow` beside it win for their axis. */
195
+ gridArea?: string | number;
196
+ /** Where this child sits across its area; `'auto'` is the grid's
197
+ * `justifyItems`. */
198
+ justifySelf?: JustifySelf;
199
+ /** An offset from the edge — or, under sticky or a registered position,
200
+ * the scheme's to read: how close to the scroll pane's edge the box may
201
+ * come, for sticky, where a percentage is of the pane's size. The same
202
+ * holds for the other five. */
112
203
  top?: Length;
113
204
  right?: Length;
114
205
  bottom?: Length;
@@ -3,7 +3,7 @@
3
3
  //
4
4
  // A `<window>` asks for `fullscreen` or `maximized` and the window manager
5
5
  // decides — and it decides on its own account too, when the user hits a
6
- // hotkey or the titlebar button. `nodes.js` sends the requests; this is the
6
+ // hotkey or the titlebar button. `nodes/window/hints.js` sends the requests; this is the
7
7
  // half that reads back what actually happened, plus the two things an app
8
8
  // needs that are not states at all: whether it has the keyboard, and whether
9
9
  // anyone can see it.
package/src/yoga.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // The layout engine, without a top-level await.
2
2
  //
3
- // Every drawn node owns one yoga node (`nodes.js`), and `styles.js` is the
3
+ // Every drawn node owns one yoga node (`src/nodes/`), and `styles.js` is the
4
4
  // translation from style props to yoga setters. This module is where the
5
5
  // engine itself comes from.
6
6
  //