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.
Files changed (158) hide show
  1. package/README.md +330 -81
  2. package/package.json +132 -14
  3. package/src/ClickToComponent.js +9 -2
  4. package/src/DevToolsIntegration.js +440 -32
  5. package/src/Reconciler.js +463 -165
  6. package/src/a11y.js +1299 -0
  7. package/src/acceleratorhooks.js +86 -0
  8. package/src/accelerators.js +128 -0
  9. package/src/activate.js +168 -0
  10. package/src/anchor.js +360 -0
  11. package/src/appcontext.js +161 -0
  12. package/src/appearance.js +748 -0
  13. package/src/appearancehooks.js +96 -0
  14. package/src/apphooks.js +73 -0
  15. package/src/application.js +748 -0
  16. package/src/atspi.js +1953 -0
  17. package/src/bus.js +545 -0
  18. package/src/bushooks.js +136 -0
  19. package/src/clientmessage.js +140 -0
  20. package/src/clipboard.js +121 -0
  21. package/src/components/Button.js +148 -33
  22. package/src/components/Checkbox.js +66 -32
  23. package/src/components/Dialog.js +96 -29
  24. package/src/components/FileDialog.js +491 -0
  25. package/src/components/Icon.js +329 -0
  26. package/src/components/Menu.js +797 -133
  27. package/src/components/PasswordInput.js +434 -0
  28. package/src/components/ProgressBar.js +91 -12
  29. package/src/components/Radio.js +78 -35
  30. package/src/components/Select.js +255 -65
  31. package/src/components/Slider.js +102 -41
  32. package/src/components/SplitPane.js +206 -0
  33. package/src/components/Switch.js +100 -22
  34. package/src/components/Table.js +529 -0
  35. package/src/components/Tabs.js +211 -0
  36. package/src/components/Tooltip.js +528 -54
  37. package/src/components/anchor.js +154 -107
  38. package/src/components/change.js +34 -0
  39. package/src/components/dnd.js +103 -0
  40. package/src/components/index.js +16 -3
  41. package/src/components/keys.js +17 -20
  42. package/src/components/scribble.js +247 -0
  43. package/src/components/theme.js +350 -42
  44. package/src/components/typeahead.js +12 -2
  45. package/src/compose.js +868 -0
  46. package/src/compositing.js +224 -0
  47. package/src/dbusmenu.js +384 -0
  48. package/src/debug.d.ts +63 -0
  49. package/src/debug.js +642 -0
  50. package/src/decorations.js +486 -0
  51. package/src/desktopsettings.js +209 -0
  52. package/src/desktopsettingshooks.js +62 -0
  53. package/src/dnd.js +1725 -0
  54. package/src/editmenu.js +272 -0
  55. package/src/errors.js +98 -0
  56. package/src/events.js +1406 -162
  57. package/src/extensions.js +45 -0
  58. package/src/filedialog.js +375 -0
  59. package/src/filedialoghooks.js +132 -0
  60. package/src/fonthooks.js +64 -0
  61. package/src/fonts.js +301 -0
  62. package/src/foreignnodes.js +519 -0
  63. package/src/frame/child.js +33 -0
  64. package/src/frame/childmain.js +274 -0
  65. package/src/frame/env.js +140 -0
  66. package/src/frame/index.js +444 -0
  67. package/src/frame/lifecycle.js +67 -0
  68. package/src/frame/protocol.js +179 -0
  69. package/src/frames.js +73 -0
  70. package/src/glbackend.js +114 -0
  71. package/src/glnodes.js +125 -67
  72. package/src/globalmenu.js +683 -0
  73. package/src/host.d.ts +88 -0
  74. package/src/host.js +42 -0
  75. package/src/idle.js +490 -0
  76. package/src/idlehooks.js +100 -0
  77. package/src/imagesource.js +349 -0
  78. package/src/index.d.ts +475 -0
  79. package/src/index.js +83 -9
  80. package/src/inputtime.js +206 -0
  81. package/src/jsx-dev-runtime.d.ts +21 -0
  82. package/src/jsx-dev-runtime.js +2 -0
  83. package/src/jsx-runtime.d.ts +39 -0
  84. package/src/jsx-runtime.js +6 -0
  85. package/src/keyboard.js +256 -0
  86. package/src/keyboardstate.js +278 -0
  87. package/src/keyboardstatehooks.js +58 -0
  88. package/src/keysyms.d.ts +149 -0
  89. package/src/keysyms.js +270 -0
  90. package/src/locale.js +170 -0
  91. package/src/localehooks.js +47 -0
  92. package/src/menuitem.js +223 -0
  93. package/src/node.d.ts +597 -0
  94. package/src/node.js +44 -0
  95. package/src/nodes.js +9546 -690
  96. package/src/ntk.d.ts +44 -0
  97. package/src/ntk.js +25 -0
  98. package/src/paintcache.js +366 -0
  99. package/src/palette.js +380 -0
  100. package/src/pastestate.js +66 -0
  101. package/src/portal.js +461 -0
  102. package/src/priority.js +26 -0
  103. package/src/refresh/index.d.ts +40 -0
  104. package/src/refresh/index.js +122 -0
  105. package/src/refresh/loader.d.ts +37 -0
  106. package/src/refresh/loader.js +401 -0
  107. package/src/refresh/register.d.ts +5 -0
  108. package/src/refresh/register.js +13 -0
  109. package/src/registry.js +232 -0
  110. package/src/scale.js +626 -0
  111. package/src/scalehooks.js +27 -0
  112. package/src/screencolor.js +640 -0
  113. package/src/screencolorhooks.js +101 -0
  114. package/src/screens.js +754 -0
  115. package/src/screenshooks.js +137 -0
  116. package/src/startup.js +302 -0
  117. package/src/style.d.ts +126 -0
  118. package/src/style.js +33 -0
  119. package/src/styles.js +1482 -6
  120. package/src/svgnodes.js +306 -0
  121. package/src/testing/a11y.js +484 -0
  122. package/src/testing/components.js +414 -0
  123. package/src/testing/events.js +407 -0
  124. package/src/testing/harness.js +455 -0
  125. package/src/testing/index.d.ts +558 -0
  126. package/src/testing/index.js +85 -0
  127. package/src/testing/mock-app.js +463 -0
  128. package/src/testing/pixels.js +152 -0
  129. package/src/testing/queries.js +224 -0
  130. package/src/textrange.js +83 -0
  131. package/src/textselection.js +439 -0
  132. package/src/trace-registry.js +63 -0
  133. package/src/transfer.js +93 -0
  134. package/src/types/appearance.d.ts +84 -0
  135. package/src/types/application.d.ts +173 -0
  136. package/src/types/components.d.ts +820 -0
  137. package/src/types/dbus.d.ts +177 -0
  138. package/src/types/elements.d.ts +897 -0
  139. package/src/types/events.d.ts +549 -0
  140. package/src/types/filedialog.d.ts +260 -0
  141. package/src/types/fonts.d.ts +124 -0
  142. package/src/types/frame.d.ts +146 -0
  143. package/src/types/globalmenu.d.ts +42 -0
  144. package/src/types/nodes.d.ts +199 -0
  145. package/src/types/screencolor.d.ts +84 -0
  146. package/src/types/style.d.ts +434 -0
  147. package/src/types/system.d.ts +287 -0
  148. package/src/windowid.js +151 -0
  149. package/src/windowstate.js +393 -0
  150. package/src/xsettings.js +336 -0
  151. package/src/yoga.d.ts +55 -0
  152. package/src/yoga.js +135 -0
  153. package/src/components/Canvas3D.js +0 -28
  154. package/src/geometry3d.js +0 -223
  155. package/src/pointer3d.js +0 -158
  156. package/src/raycast3d.js +0 -146
  157. package/src/richnodes.js +0 -436
  158. package/src/scene3d.js +0 -683
@@ -0,0 +1,434 @@
1
+ /**
2
+ * The `style` prop: layout (yoga), paint, text, and the three block forms —
3
+ * pseudo-states, window size queries, transitions. See docs/styling.md.
4
+ */
5
+
6
+ /**
7
+ * A CSS colour string (`'#2980b9'`, `'tomato'`, `'rgba(0,0,0,.5)'`), or a
8
+ * `$token` resolved against the nearest `theme` prop — see
9
+ * {@link https://github.com/sidorares/react-x11/blob/master/docs/styling.md#theme-tokens Theme tokens}.
10
+ */
11
+ export type Color = string;
12
+
13
+ /** A yoga length: pixels, a percentage, or `'auto'`. */
14
+ export type Dimension = number | `${number}%` | 'auto';
15
+
16
+ /** A yoga length that has no `auto` form. */
17
+ export type Length = number | `${number}%`;
18
+
19
+ export type FlexDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
20
+
21
+ export type Justify =
22
+ | 'flex-start'
23
+ | 'center'
24
+ | 'flex-end'
25
+ | 'space-between'
26
+ | 'space-around'
27
+ | 'space-evenly';
28
+
29
+ export type Align =
30
+ | 'auto'
31
+ | 'flex-start'
32
+ | 'center'
33
+ | 'flex-end'
34
+ | 'stretch'
35
+ | 'baseline'
36
+ | 'space-between'
37
+ | 'space-around';
38
+
39
+ export type FlexWrap = 'nowrap' | 'wrap' | 'wrap-reverse';
40
+ export type PositionType = 'static' | 'relative' | 'absolute';
41
+ export type Display = 'flex' | 'none';
42
+ export type Overflow = 'visible' | 'hidden' | 'scroll';
43
+ export type BorderStyle = 'solid' | 'dashed';
44
+ export type PointerEvents = 'auto' | 'none';
45
+ export type TextAlign = 'left' | 'right' | 'center' | 'start' | 'end';
46
+ export type FontStyle = 'normal' | 'italic' | 'oblique';
47
+ export type FontWeight = number | 'normal' | 'bold';
48
+
49
+ /**
50
+ * Cursor names, as ntk maps them to the X cursor font. Any other string is
51
+ * passed through to ntk, which may know shapes this list does not.
52
+ */
53
+ export type Cursor =
54
+ | 'default'
55
+ | 'pointer'
56
+ | 'text'
57
+ | 'move'
58
+ | 'crosshair'
59
+ | 'wait'
60
+ | 'progress'
61
+ | 'help'
62
+ | 'not-allowed'
63
+ | 'grab'
64
+ | 'grabbing'
65
+ | 'ew-resize'
66
+ | 'ns-resize'
67
+ | 'nwse-resize'
68
+ | 'nesw-resize'
69
+ | 'col-resize'
70
+ | 'row-resize'
71
+ | 'none'
72
+ | (string & {});
73
+
74
+ /**
75
+ * Which way the boxes under this one run — CSS's `direction`.
76
+ *
77
+ * `'inherit'` is the default and means "whatever is around me"; the floor
78
+ * under the whole tree is the palette's `direction`, which is seeded from the
79
+ * locale. Setting it mirrors this subtree: rows run the other way, and every
80
+ * `*Start`/`*End` edge below swaps sides with it.
81
+ */
82
+ export type Direction = 'ltr' | 'rtl' | 'inherit';
83
+
84
+ /** Everything yoga lays out. */
85
+ export interface LayoutStyle {
86
+ width?: Dimension;
87
+ height?: Dimension;
88
+ minWidth?: Length;
89
+ minHeight?: Length;
90
+ maxWidth?: Length;
91
+ maxHeight?: Length;
92
+ flexDirection?: FlexDirection;
93
+ justifyContent?: Justify;
94
+ alignItems?: Align;
95
+ alignSelf?: Align;
96
+ alignContent?: Align;
97
+ flexWrap?: FlexWrap;
98
+ /**
99
+ * CSS's shorthand: `flex: 1` is `flexGrow: 1, flexShrink: 1,
100
+ * flexBasis: 0` — take this share of what is left, from a base size of
101
+ * nothing. `'auto'` grows and shrinks from the content's own size,
102
+ * `'none'` does neither. A longhand written beside it wins.
103
+ */
104
+ flex?: number | 'auto' | 'none';
105
+ flexGrow?: number;
106
+ /** How eagerly this item gives up the space it has **above its content**;
107
+ * `1` by default, as in CSS. It never shrinks past what is inside it —
108
+ * say `minWidth: 0` (or an `overflow` that clips) for that. */
109
+ flexShrink?: number;
110
+ flexBasis?: Dimension;
111
+ position?: PositionType;
112
+ top?: Length;
113
+ right?: Length;
114
+ bottom?: Length;
115
+ left?: Length;
116
+ margin?: Dimension;
117
+ marginTop?: Dimension;
118
+ marginRight?: Dimension;
119
+ marginBottom?: Dimension;
120
+ marginLeft?: Dimension;
121
+ padding?: Length;
122
+ paddingTop?: Length;
123
+ paddingRight?: Length;
124
+ paddingBottom?: Length;
125
+ paddingLeft?: Length;
126
+ /**
127
+ * The **logical** horizontal edges: the side the text starts at and the
128
+ * side it ends at, whichever those are under the direction in force. They
129
+ * override their physical counterparts even in LTR, the way CSS's
130
+ * `padding-inline-start` overrides `padding-left`.
131
+ */
132
+ start?: Length;
133
+ end?: Length;
134
+ marginStart?: Dimension;
135
+ marginEnd?: Dimension;
136
+ paddingStart?: Length;
137
+ paddingEnd?: Length;
138
+ gap?: number;
139
+ rowGap?: number;
140
+ columnGap?: number;
141
+ aspectRatio?: number;
142
+ display?: Display;
143
+ overflow?: Overflow;
144
+ borderWidth?: number;
145
+ /** Per-side widths override `borderWidth` the way `paddingTop` overrides
146
+ * `padding`. Layout properties: yoga sees each edge, so a 3px left bar
147
+ * insets content on the left only. */
148
+ borderTopWidth?: number;
149
+ borderRightWidth?: number;
150
+ borderBottomWidth?: number;
151
+ borderLeftWidth?: number;
152
+ /** The logical sides, which win over the physical ones. */
153
+ borderStartWidth?: number;
154
+ borderEndWidth?: number;
155
+ direction?: Direction;
156
+ }
157
+
158
+ /**
159
+ * Properties that only affect painting, never geometry — the only ones a
160
+ * `:hover`/`:focus`/`:active`/`:disabled`/`:drag-over`/`:dragging` block
161
+ * may set, because a state block that could reflow the tree would jitter
162
+ * on pointer move.
163
+ */
164
+ export interface PaintStyle {
165
+ backgroundColor?: Color;
166
+ /**
167
+ * A gradient behind the node, in the box the layout gave it:
168
+ * `'linear-gradient(#2b5876, #4e4376)'`, `'linear-gradient(135deg, $accent,
169
+ * $accentActive)'`, or `'none'`.
170
+ *
171
+ * CSS's grammar and CSS's geometry — an angle in degrees clockwise from
172
+ * "up", the `to bottom right` keywords, `%`/`px` stop positions — with two
173
+ * differences: only `linear-gradient` exists (a radial or conic one is a
174
+ * `<canvas onDraw>`), and a colour stop may be a `$token`. It paints over
175
+ * `backgroundColor`, which is the CSS order, so a translucent gradient
176
+ * tints the colour underneath it.
177
+ */
178
+ backgroundImage?: string;
179
+ /**
180
+ * A shadow cast outside the box:
181
+ * `'0 2px 8px rgba(0, 0, 0, .4)'`, `'0 1px 2px #0003, 0 8px 24px $shadow'`
182
+ * (any `$token` the theme names), or `'none'`.
183
+ *
184
+ * `<x> <y> [blur] [spread] [colour]` per shadow, comma-separated, painted
185
+ * first-on-top like CSS's. The colour may be left out, which means the
186
+ * node's own `color`. Outer shadows only — `inset` throws — and ignored on
187
+ * `<window>`/`<popup>`, which own no pixels outside themselves.
188
+ */
189
+ boxShadow?: string;
190
+ borderColor?: Color;
191
+ /** Per-side colours fall back to `borderColor`. Paint properties, legal in
192
+ * state blocks like it. */
193
+ borderTopColor?: Color;
194
+ borderRightColor?: Color;
195
+ borderBottomColor?: Color;
196
+ borderLeftColor?: Color;
197
+ /** …and the logical sides, matching `borderStartWidth`/`borderEndWidth`. */
198
+ borderStartColor?: Color;
199
+ borderEndColor?: Color;
200
+ /** Rounds the background, the border and the child clip. Requires uniform
201
+ * borders — same width and colour on all four sides; a non-uniform border
202
+ * paints square and ignores the radius. */
203
+ borderRadius?: number;
204
+ zIndex?: number;
205
+ /**
206
+ * The focus-ring family. Painted *outside* the border box and never seen
207
+ * by yoga — which is why CSS grew `outline` separately from `border`, and
208
+ * why switching one on cannot move the thing it surrounds.
209
+ *
210
+ * A focusable node draws one on `:focus-visible` with no styling at all;
211
+ * these override it, and `outlineWidth: 0` opts out.
212
+ */
213
+ outlineWidth?: number;
214
+ outlineColor?: Color;
215
+ /** The gap between the border box and the ring. Default 1. */
216
+ outlineOffset?: number;
217
+ }
218
+
219
+ /**
220
+ * Which edges of the text a `<text>`'s box is measured to.
221
+ *
222
+ * `'cap-alphabetic'` is CSS's `text-box-trim: trim-both` with
223
+ * `text-box-edge: cap alphabetic`: the box becomes the capitals down to the
224
+ * last baseline, so padding around a label is measured from the letters
225
+ * rather than from the font's ascent and descent — and centring centres what
226
+ * you can see. `lineHeight` is not an alternative: it scales the line box
227
+ * and the leading still splits evenly, moving both edges by the same amount.
228
+ */
229
+ export type TextBoxTrim = 'none' | 'cap-alphabetic';
230
+ export type TextWrap = 'wrap' | 'nowrap';
231
+
232
+ /** CSS's `text-overflow`: what the end of a `<text>` that did not fit looks
233
+ * like. `'clip'` slices it mid-glyph, `'ellipsis'` ends it in a `…`. */
234
+ export type TextOverflow = 'clip' | 'ellipsis';
235
+
236
+ export type TextRendering =
237
+ 'auto' | 'optimizeSpeed' | 'optimizeLegibility' | 'geometricPrecision';
238
+
239
+ /** Text properties. All affect measurement except `color`. */
240
+ export interface TextStyle {
241
+ color?: Color;
242
+ fontFamily?: string;
243
+ fontSize?: number;
244
+ fontWeight?: FontWeight;
245
+ fontStyle?: FontStyle;
246
+ /** A variable font's axes, by OpenType tag: `{ wdth: 87.5, slnt: -8 }`.
247
+ * The `wght` axis is already driven by `fontWeight`, so this is for the
248
+ * rest. Axes the font does not have are ignored and values clamp to each
249
+ * axis's range. Compared by value, so an object literal is fine. */
250
+ fontVariationSettings?: Record<string, number>;
251
+ /** CSS's `text-rendering`, picking the glyph path (ntk >= 7.2.0).
252
+ * `'geometricPrecision'` puts glyph origins exactly where shaping asked —
253
+ * what display text and animated variable fonts want, since cached glyphs
254
+ * can only land on whole pixels. `'optimizeSpeed'` keeps the cached path
255
+ * at any size. `'auto'` (default) lets size decide. Changing it repaints
256
+ * without reflowing: it cannot move anything. */
257
+ textRendering?: TextRendering;
258
+ textAlign?: TextAlign;
259
+ lineHeight?: number;
260
+ /** CSS's `text-wrap`. `'nowrap'` measures the text at unbounded width, so
261
+ * it stays on one line and overflows its box horizontally rather than
262
+ * wrapping to fit — what a fixed-height row wants, since a wrapped line in
263
+ * one is sliced rather than shown. Default `'wrap'`.
264
+ *
265
+ * With `textOverflow: 'ellipsis'` it measures against the box instead:
266
+ * there is nothing to elide off an unbounded line. See `textOverflow`. */
267
+ textWrap?: TextWrap;
268
+ /**
269
+ * CSS's `text-overflow`, on text that was cut short by `maxLines`. Default
270
+ * `'clip'`, which slices mid-glyph; `'ellipsis'` ends the last kept line in
271
+ * a `…` — set in that line's own font, cut on a grapheme boundary with the
272
+ * tail re-shaped, and on the visually last run, so an RTL line ends on the
273
+ * left. What a truncated `<text>` reports to a screen reader, and what its
274
+ * caret indices index into, is the whole string either way.
275
+ *
276
+ * **On its own it means one line**, since there is nothing to elide without
277
+ * a cap: `maxLines` is how to say two or three instead.
278
+ */
279
+ textOverflow?: TextOverflow;
280
+ /**
281
+ * How many lines are kept — CSS's `-webkit-line-clamp`, under the name the
282
+ * platforms that got a clean shot at it chose. Unlimited by default, and
283
+ * `1` when `textOverflow: 'ellipsis'` is set without it. Lines past the cap
284
+ * are dropped before the box is measured, so the height is the kept lines'.
285
+ */
286
+ maxLines?: number;
287
+ /** Default `'none'`. Applies to `<text>`; the editable controls keep their
288
+ * full line box, which their caret and selection geometry are measured
289
+ * against. */
290
+ textBoxTrim?: TextBoxTrim;
291
+ }
292
+
293
+ /** What a pseudo-state block may change: paint properties, plus `color`. */
294
+ export interface StateStyle extends PaintStyle {
295
+ color?: Color;
296
+ }
297
+
298
+ /** How far outside the box the pointer still counts as hitting it. A number
299
+ * grows every side; the object form grows only the sides it names. */
300
+ export type HitSlop =
301
+ number | { top?: number; right?: number; bottom?: number; left?: number };
302
+
303
+ /** Every property a style may set, before the block forms. */
304
+ export interface StyleProperties extends LayoutStyle, PaintStyle, TextStyle {
305
+ borderStyle?: BorderStyle;
306
+ cursor?: Cursor;
307
+ pointerEvents?: PointerEvents;
308
+ /**
309
+ * Hit testing only: it never grows the drawing and never reaches yoga, so
310
+ * a 16px control can have a 24px target without the layout moving.
311
+ */
312
+ hitSlop?: HitSlop;
313
+ }
314
+
315
+ /**
316
+ * How long a change takes: one duration in ms for everything animatable, or
317
+ * a duration per property. Enums, percentages, `'auto'` and `zIndex` snap
318
+ * rather than animate.
319
+ */
320
+ export type Transition = number | { [K in keyof StyleProperties]?: number };
321
+
322
+ /** The easing curves a loop can name. A `transition` has one fixed ease-out
323
+ * and does not take this: a change that ends looks right slowing into its
324
+ * new value, where a cycle that restarts would stutter at the wrap. */
325
+ export type Easing = 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out';
326
+
327
+ /** One property's loop. `from` defaults to what the style declares for the
328
+ * property, which is also where it rests when nothing is running it. */
329
+ export interface AnimationSpec {
330
+ from?: unknown;
331
+ to: unknown;
332
+ /** One crossing, in ms. */
333
+ duration: number;
334
+ /** Default `'linear'`. */
335
+ easing?: Easing;
336
+ /** Turn around at each end instead of wrapping back to `from`. */
337
+ alternate?: boolean;
338
+ }
339
+
340
+ /**
341
+ * A property that travels between two values and keeps doing it — the
342
+ * looping sibling of {@link Transition}, which is how long it takes to
343
+ * arrive somewhere and is over when it gets there.
344
+ *
345
+ * ```jsx
346
+ * <box style={{ position: 'absolute', start: '-40%', width: '40%',
347
+ * animation: { start: { to: '100%', duration: 1100 } } }} />
348
+ * ```
349
+ *
350
+ * Loops run on the window's frame clock, claim the moving node's region as
351
+ * their damage, and stop themselves when the window is unmapped, minimized
352
+ * or fully obscured, when anything above the node hides it, and on a
353
+ * desktop that asked for reduced motion. See docs/styling.md#loops.
354
+ */
355
+ export type Animation = { [K in keyof StyleProperties]?: AnimationSpec };
356
+
357
+ /**
358
+ * A window size query — the X11 analogue of `@media`, asking about the
359
+ * window a style is laid out in: `'@width >= 600'`, `'@height < 400'`.
360
+ * Unlike a state block, a size query may set layout properties.
361
+ */
362
+ export type SizeQuery = `@${'width' | 'height'} ${string}`;
363
+
364
+ /** The named blocks a style may carry, beside its own properties. */
365
+ export interface StyleBlocks {
366
+ transition?: Transition;
367
+ animation?: Animation;
368
+ /**
369
+ * **Provisional.** A prototype for ntk#37, kept out of `docs/` on purpose:
370
+ * the shape may change or be withdrawn, so do not build on it yet.
371
+ *
372
+ * The pointer is heading for this node but has not arrived — a
373
+ * prediction from its trajectory, not a fact about where it is. Lowest
374
+ * precedence of the state blocks for exactly that reason: once the pointer
375
+ * really lands, `:hover` is the truth and wins.
376
+ *
377
+ * Declaring it registers the node as an attention candidate; see
378
+ * `unstable_onAttention` for the handler half.
379
+ */
380
+ ':attention'?: StateStyle;
381
+ ':hover'?: StateStyle;
382
+ /** Set while focus is on this node **or inside it** — CSS's
383
+ * `:focus-within`, and the way a row highlights while the field in it is
384
+ * being typed into. Lower precedence than `:focus`, which is the narrower
385
+ * statement. */
386
+ ':focus-within'?: StateStyle;
387
+ ':focus'?: StateStyle;
388
+ /** Focus that arrived from the keyboard rather than from a press — CSS's
389
+ * `:focus-visible`. This is where a focus ring belongs: a ring on every
390
+ * click is noise, and a ring on Tab is the only cue a keyboard user has. */
391
+ ':focus-visible'?: StateStyle;
392
+ ':active'?: StateStyle;
393
+ ':disabled'?: StateStyle;
394
+ /** Set while a drag is over this node or a descendant — the same
395
+ * ancestor-path rule `:hover` follows, and like it, not filtered by
396
+ * whether the node would accept the drop. */
397
+ ':drag-over'?: StateStyle;
398
+ /** Set on a drag source for the duration of the drag. */
399
+ ':dragging'?: StateStyle;
400
+ }
401
+
402
+ /**
403
+ * A style: the properties themselves, the state blocks, and any number of
404
+ * size-query blocks keyed `'@width >= 600'`.
405
+ */
406
+ export type Style = StyleProperties &
407
+ StyleBlocks & { [K in SizeQuery]?: StyleProperties };
408
+
409
+ /**
410
+ * What a `style` prop accepts: an object, or a nested array of them with
411
+ * falsy entries skipped and later entries winning. This is what replaces the
412
+ * *selector* cascade — precedence is written at the call site rather than
413
+ * resolved by specificity. Inheritance is a separate thing and does happen:
414
+ * the ink, the face and the size travel down the tree (`INHERITED_TEXT_PROPS`).
415
+ */
416
+ export type StyleProp = Style | false | null | undefined | readonly StyleProp[];
417
+
418
+ /** A sheet of named styles, as returned by `createStyles`. */
419
+ export type StyleSheet<T> = { readonly [K in keyof T]: Readonly<Style> };
420
+
421
+ /**
422
+ * Declare styles once, outside render. Identity is the point: a hoisted
423
+ * style object lets the renderer skip an update with a `===` check. It also
424
+ * validates keys, which a bare object literal cannot — and so does this
425
+ * signature: the parameter is mapped rather than a bare type parameter so
426
+ * each value keeps `Style` as its contextual type, which is what makes
427
+ * TypeScript reject an unknown property instead of widening it away.
428
+ */
429
+ export function createStyles<T extends Record<string, unknown>>(sheet: {
430
+ [K in keyof T]: Style;
431
+ }): StyleSheet<T>;
432
+
433
+ /** Flatten a `StyleProp` into a single style object. */
434
+ export function flattenStyle(style: StyleProp): Style;