@react-x11/components 0.4.0 → 0.5.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 (219) hide show
  1. package/README.md +125 -4
  2. package/dist/charts/components.d.ts +3 -1
  3. package/dist/charts/components.d.ts.map +1 -1
  4. package/dist/charts/components.js +8 -4
  5. package/dist/charts/components.js.map +1 -1
  6. package/dist/charts/node.d.ts +13 -6
  7. package/dist/charts/node.d.ts.map +1 -1
  8. package/dist/charts/node.js +75 -24
  9. package/dist/charts/node.js.map +1 -1
  10. package/dist/charts/render.d.ts +4 -0
  11. package/dist/charts/render.d.ts.map +1 -1
  12. package/dist/charts/render.js +11 -6
  13. package/dist/charts/render.js.map +1 -1
  14. package/dist/code-editor/node.d.ts +47 -16
  15. package/dist/code-editor/node.d.ts.map +1 -1
  16. package/dist/code-editor/node.js +121 -51
  17. package/dist/code-editor/node.js.map +1 -1
  18. package/dist/flow/draw.d.ts +19 -1
  19. package/dist/flow/draw.d.ts.map +1 -1
  20. package/dist/flow/draw.js +64 -35
  21. package/dist/flow/draw.js.map +1 -1
  22. package/dist/flow/index.d.ts.map +1 -1
  23. package/dist/flow/index.js +24 -8
  24. package/dist/flow/index.js.map +1 -1
  25. package/dist/flow/model.d.ts +4 -2
  26. package/dist/flow/model.d.ts.map +1 -1
  27. package/dist/flow/model.js +4 -2
  28. package/dist/flow/model.js.map +1 -1
  29. package/dist/flow/node.d.ts +40 -9
  30. package/dist/flow/node.d.ts.map +1 -1
  31. package/dist/flow/node.js +142 -53
  32. package/dist/flow/node.js.map +1 -1
  33. package/dist/flow/types.d.ts +46 -21
  34. package/dist/flow/types.d.ts.map +1 -1
  35. package/dist/formula/index.d.ts +4 -2
  36. package/dist/formula/index.d.ts.map +1 -1
  37. package/dist/formula/index.js.map +1 -1
  38. package/dist/formula/node.d.ts +5 -1
  39. package/dist/formula/node.d.ts.map +1 -1
  40. package/dist/formula/node.js +19 -3
  41. package/dist/formula/node.js.map +1 -1
  42. package/dist/html/controls.d.ts +4 -1
  43. package/dist/html/controls.d.ts.map +1 -1
  44. package/dist/html/controls.js.map +1 -1
  45. package/dist/html/css/cascade.d.ts +11 -5
  46. package/dist/html/css/cascade.d.ts.map +1 -1
  47. package/dist/html/css/cascade.js +18 -8
  48. package/dist/html/css/cascade.js.map +1 -1
  49. package/dist/html/css/parse.d.ts +15 -10
  50. package/dist/html/css/parse.d.ts.map +1 -1
  51. package/dist/html/css/parse.js +41 -16
  52. package/dist/html/css/parse.js.map +1 -1
  53. package/dist/html/css/style.d.ts +3 -0
  54. package/dist/html/css/style.d.ts.map +1 -1
  55. package/dist/html/css/style.js +3 -1
  56. package/dist/html/css/style.js.map +1 -1
  57. package/dist/html/css/values.d.ts +14 -1
  58. package/dist/html/css/values.d.ts.map +1 -1
  59. package/dist/html/css/values.js +11 -8
  60. package/dist/html/css/values.js.map +1 -1
  61. package/dist/html/index.d.ts.map +1 -1
  62. package/dist/html/index.js +1 -0
  63. package/dist/html/index.js.map +1 -1
  64. package/dist/html/layout/boxes.d.ts +12 -5
  65. package/dist/html/layout/boxes.d.ts.map +1 -1
  66. package/dist/html/layout/boxes.js +7 -4
  67. package/dist/html/layout/boxes.js.map +1 -1
  68. package/dist/html/layout/inline.d.ts.map +1 -1
  69. package/dist/html/layout/inline.js +22 -1
  70. package/dist/html/layout/inline.js.map +1 -1
  71. package/dist/html/node.d.ts +22 -8
  72. package/dist/html/node.d.ts.map +1 -1
  73. package/dist/html/node.js +97 -15
  74. package/dist/html/node.js.map +1 -1
  75. package/dist/html/paint.d.ts +3 -0
  76. package/dist/html/paint.d.ts.map +1 -1
  77. package/dist/html/paint.js +2 -2
  78. package/dist/html/paint.js.map +1 -1
  79. package/dist/index.d.ts +7 -1
  80. package/dist/index.d.ts.map +1 -1
  81. package/dist/index.js +21 -0
  82. package/dist/index.js.map +1 -1
  83. package/dist/maps/clip.d.ts +43 -0
  84. package/dist/maps/clip.d.ts.map +1 -0
  85. package/dist/maps/clip.js +171 -0
  86. package/dist/maps/clip.js.map +1 -0
  87. package/dist/maps/gzip.d.ts +15 -0
  88. package/dist/maps/gzip.d.ts.map +1 -0
  89. package/dist/maps/gzip.js +56 -0
  90. package/dist/maps/gzip.js.map +1 -0
  91. package/dist/maps/index.d.ts +55 -0
  92. package/dist/maps/index.d.ts.map +1 -0
  93. package/dist/maps/index.js +141 -0
  94. package/dist/maps/index.js.map +1 -0
  95. package/dist/maps/labels.d.ts +123 -0
  96. package/dist/maps/labels.d.ts.map +1 -0
  97. package/dist/maps/labels.js +323 -0
  98. package/dist/maps/labels.js.map +1 -0
  99. package/dist/maps/mvt.d.ts +244 -0
  100. package/dist/maps/mvt.d.ts.map +1 -0
  101. package/dist/maps/mvt.js +820 -0
  102. package/dist/maps/mvt.js.map +1 -0
  103. package/dist/maps/node.d.ts +278 -0
  104. package/dist/maps/node.d.ts.map +1 -0
  105. package/dist/maps/node.js +1459 -0
  106. package/dist/maps/node.js.map +1 -0
  107. package/dist/maps/overlay.d.ts +157 -0
  108. package/dist/maps/overlay.d.ts.map +1 -0
  109. package/dist/maps/overlay.js +472 -0
  110. package/dist/maps/overlay.js.map +1 -0
  111. package/dist/maps/paint.d.ts +226 -0
  112. package/dist/maps/paint.d.ts.map +1 -0
  113. package/dist/maps/paint.js +705 -0
  114. package/dist/maps/paint.js.map +1 -0
  115. package/dist/maps/proj.d.ts +281 -0
  116. package/dist/maps/proj.d.ts.map +1 -0
  117. package/dist/maps/proj.js +451 -0
  118. package/dist/maps/proj.js.map +1 -0
  119. package/dist/maps/sources.d.ts +256 -0
  120. package/dist/maps/sources.d.ts.map +1 -0
  121. package/dist/maps/sources.js +210 -0
  122. package/dist/maps/sources.js.map +1 -0
  123. package/dist/maps/style.d.ts +141 -0
  124. package/dist/maps/style.d.ts.map +1 -0
  125. package/dist/maps/style.js +147 -0
  126. package/dist/maps/style.js.map +1 -0
  127. package/dist/maps/styles.d.ts +82 -0
  128. package/dist/maps/styles.d.ts.map +1 -0
  129. package/dist/maps/styles.js +898 -0
  130. package/dist/maps/styles.js.map +1 -0
  131. package/dist/maps/tiles.d.ts +283 -0
  132. package/dist/maps/tiles.d.ts.map +1 -0
  133. package/dist/maps/tiles.js +469 -0
  134. package/dist/maps/tiles.js.map +1 -0
  135. package/dist/maps/types.d.ts +244 -0
  136. package/dist/maps/types.d.ts.map +1 -0
  137. package/dist/maps/types.js +2 -0
  138. package/dist/maps/types.js.map +1 -0
  139. package/dist/reorder/hx.d.ts +18 -0
  140. package/dist/reorder/hx.d.ts.map +1 -0
  141. package/dist/reorder/hx.js +10 -0
  142. package/dist/reorder/hx.js.map +1 -0
  143. package/dist/reorder/index.d.ts +314 -0
  144. package/dist/reorder/index.d.ts.map +1 -0
  145. package/dist/reorder/index.js +1539 -0
  146. package/dist/reorder/index.js.map +1 -0
  147. package/dist/reorder/model.d.ts +107 -0
  148. package/dist/reorder/model.d.ts.map +1 -0
  149. package/dist/reorder/model.js +162 -0
  150. package/dist/reorder/model.js.map +1 -0
  151. package/dist/richtext/node.d.ts +15 -5
  152. package/dist/richtext/node.d.ts.map +1 -1
  153. package/dist/richtext/node.js +40 -11
  154. package/dist/richtext/node.js.map +1 -1
  155. package/dist/richtext/runs.d.ts +35 -13
  156. package/dist/richtext/runs.d.ts.map +1 -1
  157. package/dist/richtext/runs.js +83 -27
  158. package/dist/richtext/runs.js.map +1 -1
  159. package/dist/tabs/index.d.ts +17 -0
  160. package/dist/tabs/index.d.ts.map +1 -1
  161. package/dist/tabs/index.js +849 -186
  162. package/dist/tabs/index.js.map +1 -1
  163. package/dist/terminal/vt/fonts.d.ts +45 -15
  164. package/dist/terminal/vt/fonts.d.ts.map +1 -1
  165. package/dist/terminal/vt/fonts.js +89 -19
  166. package/dist/terminal/vt/fonts.js.map +1 -1
  167. package/dist/terminal/vt/node.d.ts +42 -0
  168. package/dist/terminal/vt/node.d.ts.map +1 -1
  169. package/dist/terminal/vt/node.js +95 -11
  170. package/dist/terminal/vt/node.js.map +1 -1
  171. package/dist/terminal/vt/renderer.d.ts.map +1 -1
  172. package/dist/terminal/vt/renderer.js +13 -3
  173. package/dist/terminal/vt/renderer.js.map +1 -1
  174. package/package.json +13 -3
  175. package/src/charts/components.ts +14 -7
  176. package/src/charts/node.ts +81 -26
  177. package/src/charts/render.ts +16 -6
  178. package/src/code-editor/node.ts +147 -53
  179. package/src/flow/draw.ts +104 -35
  180. package/src/flow/index.ts +33 -13
  181. package/src/flow/model.ts +4 -2
  182. package/src/flow/node.ts +158 -59
  183. package/src/flow/types.ts +46 -21
  184. package/src/formula/index.ts +4 -2
  185. package/src/formula/node.ts +24 -5
  186. package/src/html/controls.ts +4 -1
  187. package/src/html/css/cascade.ts +18 -7
  188. package/src/html/css/parse.ts +46 -21
  189. package/src/html/css/style.ts +6 -1
  190. package/src/html/css/values.ts +25 -9
  191. package/src/html/index.ts +1 -0
  192. package/src/html/layout/boxes.ts +19 -9
  193. package/src/html/layout/inline.ts +23 -1
  194. package/src/html/node.ts +110 -17
  195. package/src/html/paint.ts +17 -2
  196. package/src/index.ts +98 -0
  197. package/src/maps/clip.ts +184 -0
  198. package/src/maps/gzip.ts +66 -0
  199. package/src/maps/index.ts +316 -0
  200. package/src/maps/labels.ts +442 -0
  201. package/src/maps/mvt.ts +857 -0
  202. package/src/maps/node.ts +1819 -0
  203. package/src/maps/overlay.ts +639 -0
  204. package/src/maps/paint.ts +978 -0
  205. package/src/maps/proj.ts +641 -0
  206. package/src/maps/sources.ts +425 -0
  207. package/src/maps/style.ts +309 -0
  208. package/src/maps/styles.ts +1040 -0
  209. package/src/maps/tiles.ts +676 -0
  210. package/src/maps/types.ts +260 -0
  211. package/src/reorder/hx.ts +31 -0
  212. package/src/reorder/index.ts +2223 -0
  213. package/src/reorder/model.ts +232 -0
  214. package/src/richtext/node.ts +49 -14
  215. package/src/richtext/runs.ts +115 -30
  216. package/src/tabs/index.ts +1040 -204
  217. package/src/terminal/vt/fonts.ts +128 -36
  218. package/src/terminal/vt/node.ts +105 -12
  219. package/src/terminal/vt/renderer.ts +13 -3
@@ -0,0 +1,244 @@
1
+ import type { Style } from 'react-x11/style';
2
+ import type { ReactNode, Ref } from 'react';
3
+ import type { LngLat, LngLatBounds, MapCamera, TileId } from './proj.js';
4
+ import type { MapSource } from './sources.js';
5
+ import type { MapStyle } from './style.js';
6
+ import type { MapMarker, MapOverlay } from './overlay.js';
7
+ export type { LngLat, LngLatBounds, MapCamera };
8
+ export type { MapSource, TileData, TileRequest } from './sources.js';
9
+ export type { MapMarker, MapOverlay, OverlayPalette } from './overlay.js';
10
+ export type { MapStyle, MapStyleLayer, MapFilter, FillLayer, LineLayer, CircleLayer, SymbolLayer, Zoomed, } from './style.js';
11
+ /** Where a pointer event happened, in every space that could be wanted. */
12
+ export interface MapPointerEvent {
13
+ /** Geographic. */
14
+ lngLat: LngLat;
15
+ /** Pane-local logical pixels. */
16
+ x: number;
17
+ y: number;
18
+ /** The marker under the pointer, when there was one. */
19
+ marker: MapMarker | null;
20
+ /** Modifier state, as the synthetic event reported it. */
21
+ shiftKey: boolean;
22
+ ctrlKey: boolean;
23
+ altKey: boolean;
24
+ metaKey: boolean;
25
+ /** `1` left, `2` middle, `3` right. */
26
+ button: number;
27
+ }
28
+ /** What one frame cost — for a performance HUD, and what
29
+ * `scripts/bench/maps.ts` reads. */
30
+ export interface MapFrameStats {
31
+ /** Milliseconds spent rasterizing tiles into their surfaces this frame.
32
+ * Bounded by `rasterBudgetMs` except for the one run that crossed it. */
33
+ rasterMs: number;
34
+ /** …and compositing them, drawing the labels, overlays and markers. */
35
+ drawMs: number;
36
+ /** Tiles the cover asked for. */
37
+ tiles: number;
38
+ /** …of which were composited from their own finished surface. Under
39
+ * `progressive` this also counts the half-drawn ones. */
40
+ ready: number;
41
+ /** …and how many were drawn from a coarser ancestor instead, scaled up.
42
+ * What covers a hole while zooming *in*. */
43
+ fromAncestor: number;
44
+ /** …and how many from their finer descendants, scaled down. What covers
45
+ * a hole while zooming *out*, where there is no ancestor to borrow. */
46
+ fromDescendant: number;
47
+ /** Tiles still to rasterize — non-zero means the map is still sharpening
48
+ * and another frame is already scheduled. */
49
+ pending: number;
50
+ /** Labels placed, and labels drawn. */
51
+ labels: number;
52
+ /**
53
+ * Tiles in the cover whose load failed and are waiting on a retry.
54
+ *
55
+ * Here because a map whose tiles all fail looks exactly like a map that
56
+ * is still loading — an empty background and nothing else — and the
57
+ * difference is not something a user can see.
58
+ */
59
+ errors: number;
60
+ /** Bytes of rendered surfaces the cache is holding. */
61
+ surfaceBytes: number;
62
+ /**
63
+ * What this pass repainted, in device pixels, or `null` for a full one.
64
+ *
65
+ * The number to watch when a map looks busy: a frame that is only
66
+ * continuing a rasterization should claim almost nothing, because the
67
+ * tile being drawn is a second surface nobody is looking at. A run of
68
+ * full-pane damage while tiles are still landing means something is
69
+ * asking for repaints it does not need — which on a backend that paints
70
+ * many frames a second reads as flashing.
71
+ */
72
+ damage: {
73
+ x: number;
74
+ y: number;
75
+ width: number;
76
+ height: number;
77
+ } | null;
78
+ /** What the rasterizer did, summed over the tiles drawn this frame. */
79
+ draw: {
80
+ features: number;
81
+ vertices: number;
82
+ decimated: number;
83
+ culled: number;
84
+ batches: number;
85
+ };
86
+ }
87
+ /** Options for framing a box. */
88
+ export interface FitBoundsOptions {
89
+ /** Logical pixels kept clear on every side. 24 by default. */
90
+ padding?: number;
91
+ maxZoom?: number;
92
+ }
93
+ /** The imperative surface, through `ref`. */
94
+ export interface MapHandle {
95
+ getCamera(): MapCamera;
96
+ setCamera(camera: Partial<MapCamera>): void;
97
+ panBy(dx: number, dy: number): void;
98
+ zoomIn(step?: number): void;
99
+ zoomOut(step?: number): void;
100
+ zoomTo(zoom: number): void;
101
+ /** Frame a box. */
102
+ fitBounds(bounds: LngLatBounds, options?: FitBoundsOptions): void;
103
+ /** Frame every marker, or the ones named. */
104
+ fitMarkers(ids?: readonly string[], options?: FitBoundsOptions): void;
105
+ /** What the pane can see. `west > east` across the antimeridian. */
106
+ getBounds(): LngLatBounds;
107
+ /** Geography to pane-local logical pixels, and back. */
108
+ project(position: LngLat): {
109
+ x: number;
110
+ y: number;
111
+ };
112
+ unproject(x: number, y: number): LngLat;
113
+ /** The marker at a pane-local point, or null. */
114
+ markerAt(x: number, y: number): MapMarker | null;
115
+ /** Throw away every rendered tile — after a style edit an application
116
+ * made in place, which the map cannot see. */
117
+ refresh(): void;
118
+ /** What the last frame cost. */
119
+ stats(): MapFrameStats | null;
120
+ }
121
+ /** What the `<mapview>` element takes. `<Map>` adds the uncontrolled
122
+ * camera and the box around it. */
123
+ export interface MapViewProps {
124
+ /**
125
+ * Where tiles come from, drawn in order — a basemap, then an overlay
126
+ * pyramid over it. Empty draws the style's background and nothing else,
127
+ * which is what a map with only markers on it wants.
128
+ */
129
+ sources?: readonly MapSource[];
130
+ /** How to draw them. Defaults to {@link shortbreadStyle} in the theme's
131
+ * light or dark palette. */
132
+ mapStyle?: MapStyle;
133
+ /**
134
+ * The camera, controlled. Leave it out and the **element** owns it —
135
+ * which is not just a convenience: an element-owned camera means a pan is
136
+ * a blit and a claim, with no React render in the loop at all.
137
+ */
138
+ camera?: MapCamera;
139
+ /** Where an element-owned camera starts. Read once, at construction. */
140
+ defaultCamera?: MapCamera;
141
+ onCameraChange?: (camera: MapCamera) => void;
142
+ /** Fired when a gesture ends and the camera has settled — the moment to
143
+ * fetch what is now on screen. */
144
+ onMoveEnd?: (camera: MapCamera) => void;
145
+ minZoom?: number;
146
+ maxZoom?: number;
147
+ markers?: readonly MapMarker[];
148
+ overlays?: readonly MapOverlay[];
149
+ onMapClick?: (event: MapPointerEvent) => void;
150
+ onMarkerClick?: (marker: MapMarker, event: MapPointerEvent) => void;
151
+ /**
152
+ * The marker under the pointer, or null when it left every marker.
153
+ *
154
+ * `event` is null for the leave that comes from the pointer leaving the
155
+ * map altogether: there is no position on the map to report, and
156
+ * inventing one would be worse than saying so.
157
+ */
158
+ onMarkerHover?: (marker: MapMarker | null, event: MapPointerEvent | null) => void;
159
+ /** `false` freezes the camera: no drag, no wheel, no keys. The map still
160
+ * draws and still reports clicks. */
161
+ interactive?: boolean;
162
+ /**
163
+ * Show a tile as it is drawn rather than when it is finished.
164
+ *
165
+ * `false` by default, which is what every other map client does: a tile
166
+ * appears whole, and until it does the coarser one already in the cache
167
+ * is scaled up in its place. `true` composites a tile's surface as soon
168
+ * as it exists — so a dense tile arrives as water, then landuse, then
169
+ * road casings, then roads, across a dozen frames — which is honest about
170
+ * what the renderer is doing and does not look like a map.
171
+ *
172
+ * The one thing the default costs is a transition that invalidates every
173
+ * surface at once: a `mapStyle` change, `refresh()`, or a display-scale
174
+ * change leaves no finished tile *and* no finished ancestor, so the map
175
+ * drops to its background colour until the new tiles land. `true` shows
176
+ * it repainting instead.
177
+ */
178
+ progressive?: boolean;
179
+ /**
180
+ * Milliseconds a frame may spend rasterizing tiles. 8 by default, which
181
+ * leaves the rest of a 60 Hz frame for everything else; a tile that takes
182
+ * longer than the budget is finished over the frames after it. `0`
183
+ * suspends rasterization, which is what a gesture does on its own.
184
+ */
185
+ rasterBudgetMs?: number;
186
+ /**
187
+ * Device pixels per logical pixel for the tile surfaces, if not the
188
+ * display's.
189
+ *
190
+ * Lowering it to 1 on a retina panel makes rasterization about 1.6×
191
+ * quicker and the basemap correspondingly softer; labels, markers and
192
+ * overlays are unaffected, since none of them goes through a tile
193
+ * surface. Worth having on a slow machine, and worth knowing about before
194
+ * reaching for it.
195
+ */
196
+ rasterScale?: number;
197
+ /** Bytes of rendered tile surfaces to keep. 128 MB by default. */
198
+ surfaceBudget?: number;
199
+ /**
200
+ * Vertices after which the rasterizer flushes its path. 12,000 by
201
+ * default.
202
+ *
203
+ * A real trade on X11, where a fill becomes one coverage-mask upload and
204
+ * a bigger path is fewer of them over the same pixels. It used to be a
205
+ * per-backend trade — `CGContextStrokePath` was quadratic in the number
206
+ * of subpaths, so the Cocoa backend wanted the opposite value and this
207
+ * element probed for it — and react-x11 2.6.1 chunks that stroke inside
208
+ * the backend instead (react-x11#457). Set it only with a profile in
209
+ * hand.
210
+ */
211
+ batchVertices?: number;
212
+ /** What the licence requires, drawn in the corner. Taken from the
213
+ * sources when they carry one; `''` removes it, which is the
214
+ * application saying it has put the attribution somewhere else. */
215
+ attribution?: string;
216
+ /** Called once per painted frame with what it cost. */
217
+ onFrame?: (stats: MapFrameStats) => void;
218
+ /**
219
+ * Called once per failed tile load, with whatever the source threw.
220
+ *
221
+ * Nothing is drawn for a failed tile, so without this a source that is
222
+ * misconfigured, rate-limited or down is indistinguishable from one that
223
+ * is slow. The tile is retried on a backoff (0.5 s doubling to 30 s), so
224
+ * this fires again for each retry rather than once and forever.
225
+ */
226
+ onTileError?: (error: unknown, tile: TileId & {
227
+ sourceId: string;
228
+ }) => void;
229
+ style?: Style;
230
+ role?: string;
231
+ 'aria-label'?: string;
232
+ 'data-testname'?: string;
233
+ ref?: Ref<unknown>;
234
+ }
235
+ /** What `<Map>` takes. */
236
+ export interface MapProps extends Omit<MapViewProps, 'ref'> {
237
+ ref?: Ref<MapHandle>;
238
+ /** Anything absolutely positioned over the map — a legend, a control
239
+ * panel. Laid out as siblings of the drawn pane rather than inside it,
240
+ * because a registered element paints its children *before* its own
241
+ * drawing and anything inside would be painted over. */
242
+ children?: ReactNode;
243
+ }
244
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/maps/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,O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KAAK,EAAE,eAAe,GAAG,IAAI,KAC1B,IAAI,CAAC;IACV;0CACsC;IACtC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;;;;;;;;;;;OAeG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;;;;;;OAWG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;wEAEoE;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uDAAuD;IACvD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACzC;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC5E,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;CACpB;AAED,0BAA0B;AAC1B,MAAM,WAAW,QAAS,SAAQ,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC;IACzD,GAAG,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;IACrB;;;6DAGyD;IACzD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/maps/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import type { Key, ReactElement, ReactNode } from 'react';
2
+ import type { ReactX11Elements, Theme } from 'react-x11';
3
+ /** The host elements, by name. */
4
+ export type Host = ReactX11Elements;
5
+ interface CommonProps {
6
+ key?: Key;
7
+ /** Honoured by every node at runtime; declared only on `<window>` — the
8
+ * same narrow declaration the calendar works around. */
9
+ theme?: Theme | Record<string, string | number>;
10
+ /** The query hook every component forwards (docs/README.md,
11
+ * "Conventions"). react-x11 passes `data-*` through; the declarations
12
+ * just do not spell it, so it is added here rather than cast away at
13
+ * every call site. */
14
+ 'data-testname'?: string;
15
+ }
16
+ export declare function hx<K extends keyof Host>(type: K, props?: (Omit<Host[K], 'theme'> & CommonProps) | null, ...children: ReactNode[]): ReactElement;
17
+ export {};
18
+ //# sourceMappingURL=hx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hx.d.ts","sourceRoot":"","sources":["../../src/reorder/hx.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEzD,kCAAkC;AAClC,MAAM,MAAM,IAAI,GAAG,gBAAgB,CAAC;AAEpC,UAAU,WAAW;IACnB,GAAG,CAAC,EAAE,GAAG,CAAC;IACV;6DACyD;IACzD,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAChD;;;2BAGuB;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,EAAE,CAAC,CAAC,SAAS,MAAM,IAAI,EACrC,IAAI,EAAE,CAAC,EACP,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,WAAW,CAAC,GAAG,IAAI,EACrD,GAAG,QAAQ,EAAE,SAAS,EAAE,GACvB,YAAY,CAEd"}
@@ -0,0 +1,10 @@
1
+ // `React.createElement`, typed against react-x11's host elements — a copy of
2
+ // `src/tabs/hx.ts`, duplicated on purpose: components in this package do not
3
+ // import each other (a lateral import welds two components into one
4
+ // tree-shaking unit — see AGENTS.md), and thirty shared lines are cheaper
5
+ // than that. See `src/internal/hx.ts` for the full why of the shape.
6
+ import React from 'react';
7
+ export function hx(type, props, ...children) {
8
+ return React.createElement(type, props, ...children);
9
+ }
10
+ //# sourceMappingURL=hx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hx.js","sourceRoot":"","sources":["../../src/reorder/hx.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,6EAA6E;AAC7E,oEAAoE;AACpE,0EAA0E;AAC1E,qEAAqE;AACrE,OAAO,KAAK,MAAM,OAAO,CAAC;AAmB1B,MAAM,UAAU,EAAE,CAChB,IAAO,EACP,KAAqD,EACrD,GAAG,QAAqB;IAExB,OAAO,KAAK,CAAC,aAAa,CAAC,IAAc,EAAE,KAAc,EAAE,GAAG,QAAQ,CAAC,CAAC;AAC1E,CAAC"}
@@ -0,0 +1,314 @@
1
+ import type { ReactElement, ReactNode } from 'react';
2
+ import type { DragEndEvent, DragEvent, DragSourceProps, DropAccept, DropEvent } from 'react-x11';
3
+ import type { Style } from 'react-x11/style';
4
+ import type { ReorderEdge, ReorderId, ReorderOrientation } from './model.js';
5
+ export { arrayMove, closestSlot, insertAtSlot, insertManyAtSlot, isNoopSlot, moveManyToSlot, moveToSlot, slotMark, } from './model.js';
6
+ export type { ReorderEdge, ReorderId, ReorderOrientation, ReorderPoint, ReorderRect, ReorderSlot, } from './model.js';
7
+ /** What `style` props here accept, matching the rest of the package. */
8
+ type StyleInput = Style | Style[];
9
+ /**
10
+ * The private payload type every item offers. The scope suffix is what
11
+ * `dropAccept` matches on — see the header. Exported because it is the one
12
+ * string only this component writes (the tree-shaking guard keys on it),
13
+ * and because an app's own dropzone may want to refuse or take a list item
14
+ * by name.
15
+ */
16
+ export declare const REORDER_TYPE = "application/x-react-x11-reorder";
17
+ /** Where a drag is being driven from. */
18
+ export type ReorderInput = 'pointer' | 'keyboard';
19
+ /** A move within one list. `items` is the ids in their new order — what an
20
+ * app holding ids sets its state to — and `from`/`to` are what one holding
21
+ * objects hands to `arrayMove`. `ids` is everything that moved, which is
22
+ * `[id]` unless a multi-drag carried a selection. */
23
+ export interface ReorderChange {
24
+ items: ReorderId[];
25
+ id: ReorderId;
26
+ ids: ReorderId[];
27
+ from: number;
28
+ to: number;
29
+ }
30
+ /** An item from another `<ReorderList>` in the group landed here. `items` is
31
+ * this list's ids with `id` already in place; `source` is where it came
32
+ * from — hello-pangea's `{ droppableId, index }`, by other names. `action`
33
+ * is `'copy'` when the source offered a copy, and then it keeps its own. */
34
+ export interface ReorderInsert {
35
+ items: ReorderId[];
36
+ id: ReorderId;
37
+ ids: ReorderId[];
38
+ index: number;
39
+ action: 'move' | 'copy';
40
+ source: {
41
+ list: string | undefined;
42
+ index: number;
43
+ };
44
+ event: DropEvent;
45
+ }
46
+ /** An item of this list was taken by something else: another list in the
47
+ * group (`to` says which, and where), or — `to: null` — a plain
48
+ * `dropAccept` node in the app, or another application, that accepted a
49
+ * `move`. Fires only for a move; a copy leaves the item where it is. */
50
+ export interface ReorderRemove {
51
+ items: ReorderId[];
52
+ id: ReorderId;
53
+ ids: ReorderId[];
54
+ index: number;
55
+ to: {
56
+ list: string | undefined;
57
+ index: number;
58
+ } | null;
59
+ event: DragEndEvent;
60
+ }
61
+ /** A drop *onto* an item rather than between two — `combine` on the list
62
+ * that took it. The dragged item is still the source list's until the app
63
+ * removes it: a merge is the app's operation, so nothing is reordered and
64
+ * `onRemove` fires on the source exactly as it does for a cross-list move. */
65
+ export interface ReorderCombine {
66
+ id: ReorderId;
67
+ ids: ReorderId[];
68
+ /** The item it was dropped onto, and where that item is. */
69
+ into: ReorderId;
70
+ index: number;
71
+ source: {
72
+ list: string | undefined;
73
+ index: number;
74
+ };
75
+ event: DropEvent;
76
+ }
77
+ /** A foreign payload — files, text, anything `accept` took — dropped at a
78
+ * slot. The event is core's, so `files`, `text` and `getData` are on it. */
79
+ export interface ReorderDrop {
80
+ index: number;
81
+ event: DropEvent;
82
+ }
83
+ /** What `canDrop` is asked, once per pointer position and again at the drop.
84
+ * A list item drag names `id`/`ids`/`source`; a foreign payload leaves them
85
+ * undefined and empty, and `event.types` is what it is offering. */
86
+ export interface ReorderDropQuery {
87
+ id?: ReorderId;
88
+ ids: ReorderId[];
89
+ source: {
90
+ list: string | undefined;
91
+ index: number;
92
+ } | null;
93
+ /** The slot it would land at. */
94
+ index: number;
95
+ /** The item it would merge into, when the pointer is in a combine band. */
96
+ combine: ReorderId | null;
97
+ event: DragEvent;
98
+ }
99
+ /** The drag started — a press past the threshold, or a keyboard lift. Fires
100
+ * on the list the item belongs to. */
101
+ export interface ReorderDragStart {
102
+ id: ReorderId;
103
+ ids: ReorderId[];
104
+ index: number;
105
+ input: ReorderInput;
106
+ }
107
+ /** Where the drag is now. Fires on the list the item belongs to, whichever
108
+ * list the pointer is over — `over` is null over anything that is not a
109
+ * list in the group. `over.index` is the index the item would **land at**,
110
+ * which is what `onReorder`'s `to` and `onInsert`'s `index` will say, not
111
+ * the raw gap it is hovering. */
112
+ export interface ReorderDragUpdate {
113
+ id: ReorderId;
114
+ ids: ReorderId[];
115
+ from: number;
116
+ over: {
117
+ list: string | undefined;
118
+ index: number;
119
+ } | null;
120
+ combine: ReorderId | null;
121
+ input: ReorderInput;
122
+ }
123
+ /** The gesture is over, however it ended. Fires on the list the item
124
+ * belongs to, after `onReorder`/`onInsert`/`onRemove`. */
125
+ export interface ReorderDragEnd {
126
+ id: ReorderId;
127
+ ids: ReorderId[];
128
+ from: number;
129
+ to: {
130
+ list: string | undefined;
131
+ index: number;
132
+ } | null;
133
+ combine: ReorderId | null;
134
+ reason: 'drop' | 'cancel';
135
+ input: ReorderInput;
136
+ }
137
+ /** What `styles.item` and `renderPreview` are handed. */
138
+ export interface ReorderItemState {
139
+ id: ReorderId;
140
+ /** The pointer is dragging this item. */
141
+ dragging: boolean;
142
+ /** The keyboard has lifted this item. */
143
+ lifted: boolean;
144
+ disabled: boolean;
145
+ /** Which of this item's edges the indicator is on, while a drag is over
146
+ * the list. */
147
+ edge: ReorderEdge | null;
148
+ /** A drop here would merge into this item rather than land beside it —
149
+ * the list's `combine`, and the pointer in this item's middle band. */
150
+ combining: boolean;
151
+ /** While the pointer drags this item: whether whatever is under the
152
+ * pointer would take it — a list in the group, a dropzone in the app,
153
+ * another application. False otherwise, the keyboard's lift included. */
154
+ accepted: boolean;
155
+ /** This render is the ghost's copy of the item, not the item in the list.
156
+ * What a child that renders in both asks before it draws its lighter
157
+ * version. */
158
+ preview: boolean;
159
+ /** Everything travelling with this item — `[id]`, unless the list's
160
+ * `selected` held it and a multi-drag picked the set up. */
161
+ ids: readonly ReorderId[];
162
+ }
163
+ export interface ReorderStyles {
164
+ /** The state seam: merged over the item's own `style`, so it can replace
165
+ * the wash a held item wears. */
166
+ item?: (state: ReorderItemState) => StyleInput | null | undefined | false;
167
+ handle?: StyleInput;
168
+ /** The insertion line, and the outline a combining item wears — the state
169
+ * tells them apart. */
170
+ indicator?: StyleInput;
171
+ /** The card the default preview draws the item's children in. */
172
+ preview?: StyleInput;
173
+ }
174
+ /** How big the ghost is. A function is asked once, at the drag's start. */
175
+ export type ReorderPreviewSize = {
176
+ width: number;
177
+ height: number;
178
+ } | ((state: ReorderItemState) => {
179
+ width: number;
180
+ height: number;
181
+ });
182
+ export interface ReorderListProps {
183
+ /** Names this list in the events other lists receive (`source.list`,
184
+ * `to.list`). */
185
+ id?: string;
186
+ /** Lists sharing a group accept each other's items. Without one a list
187
+ * takes only its own. */
188
+ group?: string;
189
+ /** Which way the items run. Decides the indicator's edge and the arrow
190
+ * keys; the root's `flexDirection` follows it. Default `'vertical'`. */
191
+ orientation?: ReorderOrientation;
192
+ /** Nothing drags, nothing lifts, nothing lands. */
193
+ disabled?: boolean;
194
+ /** The ids a multi-drag picks up together: dragging one of them carries
195
+ * all of them, in this list's own order. The app holds the selection. */
196
+ selected?: readonly ReorderId[];
197
+ /** An item moved within this list. */
198
+ onReorder?: (change: ReorderChange) => void;
199
+ /** An item arrived from another list in the group. */
200
+ onInsert?: (change: ReorderInsert) => void;
201
+ /** An item of this list was moved elsewhere. */
202
+ onRemove?: (change: ReorderRemove) => void;
203
+ /** A drop *onto* one of this list's items. Needs `combine`. */
204
+ onCombine?: (change: ReorderCombine) => void;
205
+ /** Whether the middle of an item is a merge target rather than an edge.
206
+ * Without `onCombine` it is inert. Default false. */
207
+ combine?: boolean;
208
+ /** The last word on whether a drop lands here, asked per pointer position
209
+ * and again at the drop. It can only *refuse* what `group`/`accept`
210
+ * already matched — see the header. */
211
+ canDrop?: (query: ReorderDropQuery) => boolean;
212
+ /** Foreign payloads the list takes, in core's `dropAccept` vocabulary —
213
+ * `['files']`, `'text/plain'`, a predicate. Without it every drag that is
214
+ * not a list item is refused. */
215
+ accept?: DropAccept;
216
+ /** A foreign payload landed, at `index`. */
217
+ onDrop?: (drop: ReorderDrop) => void;
218
+ /** The drag started: a press past the threshold, or a keyboard lift. */
219
+ onDragStart?: (ev: ReorderDragStart) => void;
220
+ /** Where the drag is now — one per pointer position that changed the
221
+ * answer, and one per keyboard step. */
222
+ onDragUpdate?: (ev: ReorderDragUpdate) => void;
223
+ /** The gesture is over, after the change events. */
224
+ onDragEnd?: (ev: ReorderDragEnd) => void;
225
+ /**
226
+ * The ghost that follows the pointer while an item is held.
227
+ *
228
+ * `'auto'` (the default, and what `true` means) is a `<popup>`: a window
229
+ * of its own, so it follows the pointer out of the list, out of the
230
+ * window, and over other applications, on both backends.
231
+ *
232
+ * `'inline'` draws it as a box inside the list instead — no second window
233
+ * per drag, which a remote display may prefer, at the cost of a ghost
234
+ * that stops at the window's edge. `false` leaves only the cursor and the
235
+ * indicator.
236
+ */
237
+ preview?: boolean | 'auto' | 'popup' | 'inline';
238
+ /** What the ghost shows. Default: the item's children again, on a card. */
239
+ renderPreview?: (state: ReorderItemState) => ReactNode;
240
+ /** How big the ghost is. Default: the item's own size. */
241
+ previewSize?: ReorderPreviewSize;
242
+ /** Whether the ghost flies to where the item landed instead of vanishing,
243
+ * and for how long (default 180ms). Off under the desktop's reduced
244
+ * motion, whatever this says. */
245
+ dropAnimation?: boolean | number;
246
+ styles?: ReorderStyles;
247
+ style?: StyleInput;
248
+ 'data-testname'?: string;
249
+ children?: ReactNode;
250
+ }
251
+ export interface ReorderItemProps {
252
+ id: ReorderId;
253
+ /** Not draggable and not liftable — but still a slot others land beside. */
254
+ disabled?: boolean;
255
+ /** Offered beside the reorder payload, for other targets in the app and
256
+ * for other applications — core's `dragData`, thunks and all. */
257
+ dragData?: DragSourceProps['dragData'];
258
+ /** What the drag offers. Default `['move']`; `['copy']` makes this list a
259
+ * palette — the item stays, and the list that takes it gets
260
+ * `onInsert({ action: 'copy' })`. */
261
+ dragActions?: Array<'copy' | 'move' | 'link'>;
262
+ /** Let a press on a control inside the item start a drag anyway. Off by
263
+ * default, so a text field, a slider or a button inside a card keeps the
264
+ * press — see the header. Moot when the item has a handle. */
265
+ dragFromInteractive?: boolean;
266
+ /** What a screen reader calls the item. Default: its own text. */
267
+ 'aria-label'?: string;
268
+ style?: StyleInput;
269
+ 'data-testname'?: string;
270
+ /** The content — or a function of the item's state, for content that
271
+ * reacts to the drag. `useReorderItem()` is the same thing for a
272
+ * component deeper inside. */
273
+ children?: ReactNode | ((state: ReorderItemState) => ReactNode);
274
+ }
275
+ export interface ReorderHandleProps {
276
+ /** Default "Drag to reorder". */
277
+ 'aria-label'?: string;
278
+ style?: StyleInput;
279
+ 'data-testname'?: string;
280
+ /** Default: a grip of six dots. */
281
+ children?: ReactNode;
282
+ }
283
+ /**
284
+ * The state of the `<ReorderItem>` a component is rendered inside — what
285
+ * function `children` are handed, for a component deeper in the item. Reads
286
+ * `preview` to tell the ghost's copy from the item in the list.
287
+ */
288
+ export declare function useReorderItem(): ReorderItemState;
289
+ /**
290
+ * `<ReorderList onReorder>` around `<ReorderItem id>`s.
291
+ *
292
+ * <ReorderList onReorder={(e) => setTodos((l) => arrayMove(l, e.from, e.to))}>
293
+ * {todos.map((t) => (
294
+ * <ReorderItem key={t.id} id={t.id}><text>{t.title}</text></ReorderItem>
295
+ * ))}
296
+ * </ReorderList>
297
+ *
298
+ * The order is read from the tree the list rendered, so it is written once —
299
+ * there is no `items` array to keep beside the children.
300
+ */
301
+ export declare function ReorderList(props: ReorderListProps): ReactElement;
302
+ /**
303
+ * `<ReorderItem id>` — one item. Draggable by any part of itself, unless a
304
+ * `<ReorderHandle>` inside it takes that over; a tab stop, with the keyboard
305
+ * model on it, for the same "unless".
306
+ */
307
+ export declare function ReorderItem(props: ReorderItemProps): ReactElement;
308
+ /**
309
+ * `<ReorderHandle>` — the one part of an item that drags it. Rendering one
310
+ * inside a `<ReorderItem>` is the whole opt-in: the item stops being the
311
+ * press target and the tab stop, and this is both.
312
+ */
313
+ export declare function ReorderHandle(props: ReorderHandleProps): ReactElement;
314
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/reorder/index.ts"],"names":[],"mappings":"AAiHA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAQhE,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EAET,eAAe,EAEf,UAAU,EACV,SAAS,EAIV,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AA6B7C,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,kBAAkB,EAEnB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,SAAS,EACT,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,UAAU,EACV,QAAQ,GACT,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,WAAW,EACX,SAAS,EAC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