@react-x11/components 0.4.0 → 0.6.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 (248) hide show
  1. package/README.md +143 -8
  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 +8 -2
  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/markdown/ast.d.ts +80 -6
  140. package/dist/markdown/ast.d.ts.map +1 -1
  141. package/dist/markdown/ast.js +13 -4
  142. package/dist/markdown/ast.js.map +1 -1
  143. package/dist/markdown/expressions.d.ts +27 -0
  144. package/dist/markdown/expressions.d.ts.map +1 -0
  145. package/dist/markdown/expressions.js +203 -0
  146. package/dist/markdown/expressions.js.map +1 -0
  147. package/dist/markdown/index.d.ts +61 -2
  148. package/dist/markdown/index.d.ts.map +1 -1
  149. package/dist/markdown/index.js +101 -2
  150. package/dist/markdown/index.js.map +1 -1
  151. package/dist/markdown/parse.d.ts +1 -1
  152. package/dist/markdown/parse.d.ts.map +1 -1
  153. package/dist/markdown/parse.js +163 -15
  154. package/dist/markdown/parse.js.map +1 -1
  155. package/dist/markdown/spans.d.ts.map +1 -1
  156. package/dist/markdown/spans.js +4 -0
  157. package/dist/markdown/spans.js.map +1 -1
  158. package/dist/markdown/tags.d.ts +35 -0
  159. package/dist/markdown/tags.d.ts.map +1 -0
  160. package/dist/markdown/tags.js +213 -0
  161. package/dist/markdown/tags.js.map +1 -0
  162. package/dist/reorder/hx.d.ts +18 -0
  163. package/dist/reorder/hx.d.ts.map +1 -0
  164. package/dist/reorder/hx.js +10 -0
  165. package/dist/reorder/hx.js.map +1 -0
  166. package/dist/reorder/index.d.ts +314 -0
  167. package/dist/reorder/index.d.ts.map +1 -0
  168. package/dist/reorder/index.js +1539 -0
  169. package/dist/reorder/index.js.map +1 -0
  170. package/dist/reorder/model.d.ts +107 -0
  171. package/dist/reorder/model.d.ts.map +1 -0
  172. package/dist/reorder/model.js +162 -0
  173. package/dist/reorder/model.js.map +1 -0
  174. package/dist/richtext/node.d.ts +15 -5
  175. package/dist/richtext/node.d.ts.map +1 -1
  176. package/dist/richtext/node.js +40 -11
  177. package/dist/richtext/node.js.map +1 -1
  178. package/dist/richtext/runs.d.ts +35 -13
  179. package/dist/richtext/runs.d.ts.map +1 -1
  180. package/dist/richtext/runs.js +83 -27
  181. package/dist/richtext/runs.js.map +1 -1
  182. package/dist/tabs/index.d.ts +17 -0
  183. package/dist/tabs/index.d.ts.map +1 -1
  184. package/dist/tabs/index.js +849 -186
  185. package/dist/tabs/index.js.map +1 -1
  186. package/dist/terminal/vt/fonts.d.ts +45 -15
  187. package/dist/terminal/vt/fonts.d.ts.map +1 -1
  188. package/dist/terminal/vt/fonts.js +89 -19
  189. package/dist/terminal/vt/fonts.js.map +1 -1
  190. package/dist/terminal/vt/node.d.ts +42 -0
  191. package/dist/terminal/vt/node.d.ts.map +1 -1
  192. package/dist/terminal/vt/node.js +95 -11
  193. package/dist/terminal/vt/node.js.map +1 -1
  194. package/dist/terminal/vt/renderer.d.ts.map +1 -1
  195. package/dist/terminal/vt/renderer.js +13 -3
  196. package/dist/terminal/vt/renderer.js.map +1 -1
  197. package/package.json +14 -3
  198. package/src/charts/components.ts +14 -7
  199. package/src/charts/node.ts +81 -26
  200. package/src/charts/render.ts +16 -6
  201. package/src/code-editor/node.ts +147 -53
  202. package/src/flow/draw.ts +104 -35
  203. package/src/flow/index.ts +33 -13
  204. package/src/flow/model.ts +4 -2
  205. package/src/flow/node.ts +158 -59
  206. package/src/flow/types.ts +46 -21
  207. package/src/formula/index.ts +4 -2
  208. package/src/formula/node.ts +24 -5
  209. package/src/html/controls.ts +4 -1
  210. package/src/html/css/cascade.ts +18 -7
  211. package/src/html/css/parse.ts +46 -21
  212. package/src/html/css/style.ts +6 -1
  213. package/src/html/css/values.ts +25 -9
  214. package/src/html/index.ts +1 -0
  215. package/src/html/layout/boxes.ts +19 -9
  216. package/src/html/layout/inline.ts +23 -1
  217. package/src/html/node.ts +110 -17
  218. package/src/html/paint.ts +17 -2
  219. package/src/index.ts +102 -0
  220. package/src/maps/clip.ts +184 -0
  221. package/src/maps/gzip.ts +66 -0
  222. package/src/maps/index.ts +316 -0
  223. package/src/maps/labels.ts +442 -0
  224. package/src/maps/mvt.ts +857 -0
  225. package/src/maps/node.ts +1819 -0
  226. package/src/maps/overlay.ts +639 -0
  227. package/src/maps/paint.ts +978 -0
  228. package/src/maps/proj.ts +641 -0
  229. package/src/maps/sources.ts +425 -0
  230. package/src/maps/style.ts +309 -0
  231. package/src/maps/styles.ts +1040 -0
  232. package/src/maps/tiles.ts +676 -0
  233. package/src/maps/types.ts +260 -0
  234. package/src/markdown/ast.ts +85 -9
  235. package/src/markdown/expressions.ts +223 -0
  236. package/src/markdown/index.ts +190 -5
  237. package/src/markdown/parse.ts +230 -15
  238. package/src/markdown/spans.ts +4 -0
  239. package/src/markdown/tags.ts +240 -0
  240. package/src/reorder/hx.ts +31 -0
  241. package/src/reorder/index.ts +2223 -0
  242. package/src/reorder/model.ts +232 -0
  243. package/src/richtext/node.ts +49 -14
  244. package/src/richtext/runs.ts +115 -30
  245. package/src/tabs/index.ts +1040 -204
  246. package/src/terminal/vt/fonts.ts +128 -36
  247. package/src/terminal/vt/node.ts +105 -12
  248. package/src/terminal/vt/renderer.ts +13 -3
@@ -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,k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