@dashfoo/core 0.1.0 → 0.3.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.
- package/README.md +16 -6
- package/dist/index.d.ts +221 -884
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -186,6 +186,7 @@ call them directly for custom drag logic.
|
|
|
186
186
|
|
|
187
187
|
```ts
|
|
188
188
|
resolveDockTarget(pointer, rect, opts?): DockTarget;
|
|
189
|
+
dockZonePolygons(rect, opts?): Array<DockZone>;
|
|
189
190
|
zoneRect(rect, location): Rect;
|
|
190
191
|
```
|
|
191
192
|
|
|
@@ -196,6 +197,13 @@ corners). It accepts `{ bandFraction }` to tune the band. `zoneRect` returns the
|
|
|
196
197
|
region the dock indicator highlights for a `DockLocation`: the whole tabset for a
|
|
197
198
|
`center` stack, the matching half for a split. `Point` and `Rect` are exported.
|
|
198
199
|
|
|
200
|
+
`dockZonePolygons` enumerates the full hit-region partition behind
|
|
201
|
+
`resolveDockTarget` as five polygons (`{ location, points }`): the inner center
|
|
202
|
+
rect and four edge trapezoids whose seams run from each rect corner to the
|
|
203
|
+
matching inner corner. The two functions share the band default, so a map
|
|
204
|
+
painted from the polygons always agrees with the live hit-test — use it to
|
|
205
|
+
visualize drop zones or to build custom drop indicators.
|
|
206
|
+
|
|
199
207
|
## History (undo / redo)
|
|
200
208
|
|
|
201
209
|
A small `past` / `present` / `future` structure that wraps the reducer. `present`
|
|
@@ -214,7 +222,7 @@ if (canRedo(history)) history = redo(history);
|
|
|
214
222
|
Every dispatched action is its own undo step; there is no coalescing. A splitter
|
|
215
223
|
drag still lands as one step because react-resizable-panels v4 commits a single
|
|
216
224
|
`adjustSplit` when the drag is released, not a per-frame stream. Any new dispatch
|
|
217
|
-
clears the redo `future`.
|
|
225
|
+
clears the redo `future`. History keeps the most recent `HISTORY_LIMIT` (100) steps; older snapshots are dropped.
|
|
218
226
|
|
|
219
227
|
## Serialize
|
|
220
228
|
|
|
@@ -261,9 +269,11 @@ const current = actor.getSnapshot().context.history.present;
|
|
|
261
269
|
The drag/dock interaction lifecycle (`idle` → `dragging` → `idle`), driven by
|
|
262
270
|
abstract events the dnd-kit adapter maps from pointer and keyboard input. It owns
|
|
263
271
|
transient drag state only and never touches the document. On a valid `DROP` it
|
|
264
|
-
**emits** a `COMMIT` carrying a `moveNode` action (the drag subject is a tab)
|
|
265
|
-
`moveTabset` action (the subject is a whole tabset, dragged by its grip),
|
|
266
|
-
|
|
272
|
+
**emits** a `COMMIT` carrying a `moveNode` action (the drag subject is a tab), a
|
|
273
|
+
`moveTabset` action (the subject is a whole tabset, dragged by its grip), or an
|
|
274
|
+
`addNode` action (an `external` subject — content dragged in from outside the
|
|
275
|
+
layout, carrying the `TabNode` to insert), which the React layer forwards to
|
|
276
|
+
`dashfooMachine`.
|
|
267
277
|
|
|
268
278
|
| Event | Payload |
|
|
269
279
|
| -------- | -------------------- |
|
|
@@ -295,8 +305,8 @@ the React layer forwards to `dashfooMachine`.
|
|
|
295
305
|
`findAttributedNode`, `findTabsetParent`, `findDuplicateIds`;
|
|
296
306
|
types `AttributedNode`, `TabContainer`, `TabLocation`.
|
|
297
307
|
|
|
298
|
-
`geometry` — `resolveDockTarget`, `zoneRect`; types
|
|
299
|
-
`BandOptions`, `Point`, `Rect`.
|
|
308
|
+
`geometry` — `resolveDockTarget`, `dockZonePolygons`, `zoneRect`; types
|
|
309
|
+
`DockTarget`, `DockZone`, `BandOptions`, `Point`, `Rect`.
|
|
300
310
|
|
|
301
311
|
`history` — `createHistory`, `dispatch`, `undo`, `redo`, `canUndo`, `canRedo`;
|
|
302
312
|
type `History`.
|