@dashfoo/core 0.5.2 → 1.1.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 +19 -12
- package/dist/index.d.ts +317 -113
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +373 -267
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -183,10 +183,10 @@ getFirstTabset(model): TabsetNode | undefined;
|
|
|
183
183
|
findTabset(model, tabsetId): TabsetNode | undefined;
|
|
184
184
|
findTab(model, tabId): TabLocation | undefined; // searches tabsets
|
|
185
185
|
findFloat(model, floatId): FloatNode | undefined;
|
|
186
|
-
findRow(
|
|
186
|
+
findRow(model, rowId): RowNode | undefined;
|
|
187
187
|
findRootContaining(model, nodeId): RowNode | undefined; // which root holds a node
|
|
188
188
|
findAttributedNode(model, id): AttributedNode | undefined; // row, tabset, or tab
|
|
189
|
-
findTabsetParent(
|
|
189
|
+
findTabsetParent(model, tabsetId): { index: number; parent: RowNode } | undefined;
|
|
190
190
|
findDuplicateIds(model): Array<string>; // ids used more than once
|
|
191
191
|
```
|
|
192
192
|
|
|
@@ -225,14 +225,14 @@ indicator rect. The @dnd-kit adapter in `@dashfoo/react` feeds them rects; you c
|
|
|
225
225
|
call them directly for custom drag logic.
|
|
226
226
|
|
|
227
227
|
```ts
|
|
228
|
-
resolveDockTarget(pointer, rect, opts?):
|
|
228
|
+
resolveDockTarget(pointer, rect, opts?): DockLocation;
|
|
229
229
|
dockZonePolygons(rect, opts?): Array<DockZone>;
|
|
230
230
|
zoneRect(rect, location): Rect;
|
|
231
231
|
```
|
|
232
232
|
|
|
233
|
-
`resolveDockTarget` decides where a drag over a tabset should land: `
|
|
234
|
-
when the pointer is in the interior, or `{
|
|
235
|
-
|
|
233
|
+
`resolveDockTarget` decides where a drag over a tabset should land: `"center"`
|
|
234
|
+
when the pointer is in the interior, or `split-${edge}` when it is within an
|
|
235
|
+
outer band of one of the four edges (default 22%; the closer edge wins in
|
|
236
236
|
corners). It accepts `{ bandFraction }` to tune the band. `zoneRect` returns the
|
|
237
237
|
region the dock indicator highlights for a `DockLocation`: the whole tabset for a
|
|
238
238
|
`center` stack, the matching half for a split. `Point` and `Rect` are exported.
|
|
@@ -252,8 +252,9 @@ these arrays and supplies the dragged boundary index.
|
|
|
252
252
|
|
|
253
253
|
```ts
|
|
254
254
|
resolveSnapTargets(config: SnapConfig, panelCount: number): number[]; // grid positions inside 0..100
|
|
255
|
-
|
|
256
|
-
|
|
255
|
+
resolveSnapGrid(config: SnapConfig | null, panelCount: number): SnapGrid;
|
|
256
|
+
snapSizes(sizes: number[], boundaryIndex: number, grid: SnapGrid): { sizes: number[]; snapped: boolean };
|
|
257
|
+
snapEnabled(grid: SnapGrid): boolean;
|
|
257
258
|
```
|
|
258
259
|
|
|
259
260
|
`resolveSnapTargets` builds the grid for a row from its config and panel count: the
|
|
@@ -262,8 +263,14 @@ union of the `step` grid (multiples of a fixed percent) and the `divisions` grid
|
|
|
262
263
|
the panel count). `snapSizes` snaps the boundary between panel `boundaryIndex` and
|
|
263
264
|
the next onto the nearest target within `threshold` (default `4`), moving only that
|
|
264
265
|
pair so siblings keep their size. It is a no-op when the grid is empty, the index
|
|
265
|
-
is out of range, or the correction would drive a panel negative.
|
|
266
|
-
|
|
266
|
+
is out of range, or the correction would drive a panel negative.
|
|
267
|
+
|
|
268
|
+
`resolveSnapGrid` is the entry point: it resolves the targets once for a row and
|
|
269
|
+
carries the threshold alongside them, and every other function takes that
|
|
270
|
+
`SnapGrid`. `snapEnabled` is then just "does this grid have any target", which
|
|
271
|
+
is why a config with no reachable target (`{ step: 100 }`, or
|
|
272
|
+
`{ divisions: "panels" }` on a one-panel row) reports off rather than arming the
|
|
273
|
+
per-move snap path. `SnapConfig` is the
|
|
267
274
|
`{ step?, divisions?, threshold? }` shape carried by `global.snap` and
|
|
268
275
|
`RowNode.snap`.
|
|
269
276
|
|
|
@@ -370,9 +377,9 @@ layout, carrying the `TabNode` to insert), which the React layer forwards to
|
|
|
370
377
|
types `AttributedNode`, `TabContainer`, `TabLocation`.
|
|
371
378
|
|
|
372
379
|
`geometry`: `resolveDockTarget`, `dockZonePolygons`, `zoneRect`; types
|
|
373
|
-
`
|
|
380
|
+
`DockZone`, `BandOptions`, `Point`, `Rect`.
|
|
374
381
|
|
|
375
|
-
`snap`: `resolveSnapTargets`, `snapSizes`, `snapEnabled`, `DEFAULT_SNAP_THRESHOLD`;
|
|
382
|
+
`snap`: `resolveSnapGrid`, `resolveSnapTargets`, `snapSizes`, `snapEnabled`, `DEFAULT_SNAP_THRESHOLD`;
|
|
376
383
|
type `SnapResult`.
|
|
377
384
|
|
|
378
385
|
`history`: `createHistory`, `dispatch`, `undo`, `redo`, `canUndo`, `canRedo`;
|