@dashfoo/core 1.1.0 → 1.1.2
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 +12 -12
- package/dist/index.d.ts +123 -123
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -10
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -24,12 +24,12 @@ slipped into `config` fails parsing instead of corrupting a saved layout.
|
|
|
24
24
|
|
|
25
25
|
```ts
|
|
26
26
|
type Dashfoo = {
|
|
27
|
-
version:
|
|
27
|
+
version: 1;
|
|
28
28
|
global: GlobalAttributes;
|
|
29
29
|
layout: RowNode; // the root is always a row
|
|
30
30
|
activeTabsetId?: string;
|
|
31
31
|
maximizedTabsetId?: string;
|
|
32
|
-
floats
|
|
32
|
+
floats: FloatNode[]; // floating panels, each its own layout subtree
|
|
33
33
|
};
|
|
34
34
|
```
|
|
35
35
|
|
|
@@ -164,7 +164,7 @@ tree canonical so downstream code never has to defend against degenerate shapes:
|
|
|
164
164
|
- simplifies a single-child row by lifting its lone child (which inherits the
|
|
165
165
|
lifted row's weight, so sizing is preserved)
|
|
166
166
|
- absorbs a root that reduces to a single nested row
|
|
167
|
-
-
|
|
167
|
+
- preserves schema-normalized selection and weights (`parseModel` supplies defaults and clamps selection)
|
|
168
168
|
- forces `activeTabsetId` / `maximizedTabsetId` to point at a tabset that exists
|
|
169
169
|
(falling back to the first tabset, or clearing)
|
|
170
170
|
- heals each floating panel's own layout and drops a float once it empties
|
|
@@ -210,8 +210,8 @@ import { reducer } from "@dashfoo/core";
|
|
|
210
210
|
const floated = reducer(model, { type: "floatTabset", tabsetId: "left" });
|
|
211
211
|
floated.floats; // [{ type: "float", id, layout: RowNode, geometry }]
|
|
212
212
|
|
|
213
|
-
// Dock it back
|
|
214
|
-
const docked = reducer(floated, { type: "dockFloat", floatId: floated.floats
|
|
213
|
+
// Dock it back as its own panel and drop the float.
|
|
214
|
+
const docked = reducer(floated, { type: "dockFloat", floatId: floated.floats[0].id });
|
|
215
215
|
```
|
|
216
216
|
|
|
217
217
|
`normalize` runs over each float's layout too and drops a float once its last
|
|
@@ -251,13 +251,13 @@ it stays framework-free; the React adapter maps rrp's id-keyed layout to/from
|
|
|
251
251
|
these arrays and supplies the dragged boundary index.
|
|
252
252
|
|
|
253
253
|
```ts
|
|
254
|
-
|
|
254
|
+
// resolveSnapGrid(config, panelCount).targets contains positions inside 0..100
|
|
255
255
|
resolveSnapGrid(config: SnapConfig | null, panelCount: number): SnapGrid;
|
|
256
256
|
snapSizes(sizes: number[], boundaryIndex: number, grid: SnapGrid): { sizes: number[]; snapped: boolean };
|
|
257
257
|
snapEnabled(grid: SnapGrid): boolean;
|
|
258
258
|
```
|
|
259
259
|
|
|
260
|
-
`
|
|
260
|
+
`resolveSnapGrid` builds the grid for a row from its config and panel count: the
|
|
261
261
|
union of the `step` grid (multiples of a fixed percent) and the `divisions` grid
|
|
262
262
|
(even splits: multiples of `100/d`, where `d` is the number or, for `"panels"`,
|
|
263
263
|
the panel count). `snapSizes` snaps the boundary between panel `boundaryIndex` and
|
|
@@ -337,7 +337,7 @@ const current = actor.getSnapshot().context.history.present;
|
|
|
337
337
|
### dragDockMachine
|
|
338
338
|
|
|
339
339
|
The drag/dock interaction lifecycle (`idle` → `dragging` → `idle`), driven by
|
|
340
|
-
abstract events the dnd-kit adapter maps from pointer
|
|
340
|
+
abstract events the dnd-kit adapter maps from pointer input. It owns
|
|
341
341
|
transient drag state only and never touches the document. On a valid `DROP` it
|
|
342
342
|
**emits** a `COMMIT` carrying a `moveNode` action (the drag subject is a tab), a
|
|
343
343
|
`moveTabset` action (the subject is a whole tabset, dragged by its grip), or an
|
|
@@ -357,7 +357,7 @@ layout, carrying the `TabNode` to insert), which the React layer forwards to
|
|
|
357
357
|
`schema`: `dashfooSchema`, `rowNodeSchema`, `tabsetNodeSchema`, `tabNodeSchema`,
|
|
358
358
|
`floatNodeSchema`, `geometrySchema`, `dimensionSchema`, `snapSchema`, `edgeSchema`,
|
|
359
359
|
`unitSchema`, `orientationSchema`, `globalAttributesSchema`,
|
|
360
|
-
`jsonValueSchema`; types `Dashfoo`, `RowNode`, `TabsetNode`, `TabNode`,
|
|
360
|
+
`jsonValueSchema`, `tabsetNodeObjectSchema`; types `Dashfoo`, `DashfooInput`, `RowNodeInput`, `RowNode`, `TabsetNode`, `TabNode`,
|
|
361
361
|
`FloatNode`, `Geometry`, `Dimension`, `SnapConfig`, `Edge`, `Unit`, `Orientation`,
|
|
362
362
|
`GlobalAttributes`, `Node`, `Json`.
|
|
363
363
|
|
|
@@ -379,8 +379,8 @@ types `AttributedNode`, `TabContainer`, `TabLocation`.
|
|
|
379
379
|
`geometry`: `resolveDockTarget`, `dockZonePolygons`, `zoneRect`; types
|
|
380
380
|
`DockZone`, `BandOptions`, `Point`, `Rect`.
|
|
381
381
|
|
|
382
|
-
`snap`: `resolveSnapGrid`, `
|
|
383
|
-
|
|
382
|
+
`snap`: `resolveSnapGrid`, `decideSnap`, `settleSnap`, `snapSizes`, `snapEnabled`, `DEFAULT_SNAP_THRESHOLD`;
|
|
383
|
+
types `SnapResult`, `SnapGrid`, `SnapDecision`.
|
|
384
384
|
|
|
385
385
|
`history`: `createHistory`, `dispatch`, `undo`, `redo`, `canUndo`, `canRedo`;
|
|
386
386
|
type `History`.
|
|
@@ -391,7 +391,7 @@ type `History`.
|
|
|
391
391
|
tabsets, the building block for a narrow-screen breakpoint).
|
|
392
392
|
|
|
393
393
|
`machines`: `dashfooMachine`, `dragDockMachine`; types `DashfooContext`,
|
|
394
|
-
`DashfooEvent`, `
|
|
394
|
+
`DashfooEvent`, `DragContext`, `DragEvent`, `DragSubject`,
|
|
395
395
|
`DragEmitted`.
|
|
396
396
|
|
|
397
397
|
## License
|