react-dockable-desktop 7.8.0 → 7.9.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/CHANGELOG.md CHANGED
@@ -10,6 +10,69 @@ replacement and the version that removes the old API.
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [7.9.0] — 2026-10-06
14
+
15
+ Control over where users can move panels: per-panel-type rules and an app-wide veto, all opt-in.
16
+ Without them nothing changes, and the app's own API calls are never restricted.
17
+
18
+ ### Added
19
+
20
+ - **`canFloat` and `canDock` per panel type**, next to `canDrag`, `canMinimize` and `canClose`.
21
+ `canFloat: false` keeps a panel in the grid: a tab drag can't end in a floating window (dropped on
22
+ nothing or on a corner, it stays where it was), and "Float Window" and the taskbar's "Maximize" are
23
+ hidden. `canDock: false` keeps a panel floating: dragging it offers no group, tab or edge targets.
24
+ - **`canDrop`, an app-wide veto.** `createWorkspace({ canDrop: ({ panelId, component, to }) => boolean })`
25
+ is asked for every place a dragged panel could go, and for the "Float" and "Maximize" menu items.
26
+ `to` is a `PanelDropTarget`: a group (`leafId` and a `position`, `'center'` also covering a drop
27
+ between tabs), a workspace `edge`, or a `float` (a corner `anchor`, or `null` for a tab dropped on
28
+ nothing). A forbidden target isn't offered: its drop zone, edge or corner doesn't appear, and
29
+ releasing there does nothing. It's asked again at release, so a rule that changes mid-drag holds.
30
+ Positions are the ones the move applies: under RTL, the zone drawn on the screen's right is `'left'`.
31
+ If it throws, the move is allowed and the error is logged. New types: `PanelDrop`, `PanelDropTarget`.
32
+ - Both apply only to what the user does. `floatPanel`, `dockPanelToGroup`, `openPanel` and the other
33
+ calls always work.
34
+ - **`startPointerDrag` takes an optional `onCancel`**, called instead of `onEnd` when the drag is cut
35
+ short (see Fixed).
36
+
37
+ ### Fixed
38
+
39
+ - **A drag built on `startPointerDrag` could outlive its element.** It ended only on pointerup or
40
+ pointercancel, so a window losing focus mid-drag, or the dragged element being removed (an overlay
41
+ widget closed during its own drag, a panel closed during a splitter drag), left its listeners
42
+ attached and its classes on the page, such as the resize cursor. It now also ends on window blur
43
+ and on a lost pointer capture (listened for on the document, where browsers fire it when the
44
+ capturing element is removed). The built-in splitters, window resize handles, sidebar resizer and
45
+ overlay widgets all use it.
46
+ - **The API check missed part of the public API.** Types the API refers to without exporting
47
+ (the workspace config's own type behind `WorkspaceConfig`, among others) were left out of
48
+ `api/react-dockable-desktop.api.md`, so a member removed from them would not have failed CI. The
49
+ report now includes them (`includeForgottenExports`), and `scripts/api-check.mjs` compares them by
50
+ name: 172 declarations are tracked instead of 161. Found while checking that `canDrop` appeared
51
+ in the report.
52
+
53
+ ### Docs
54
+
55
+ - **`keepAlive: false`:** a guard the panel registered with `useBeforeClose` is not active while the
56
+ panel is unmounted (it goes with the component); its dirty flag still is, so closing a hidden
57
+ dirty panel still asks first. Now said in the Panel Registry guide and the option's TSDoc.
58
+
59
+ ### Tests
60
+
61
+ - `ReleaseB.test.tsx` (16 tests): `canFloat` (no float on nothing, no corners, no "Float Window", the
62
+ app's `floatPanel` still works), `canDock` (no group or edge targets, only corners; the app can
63
+ still dock it), `canDrop` (its argument, vetoed zones and edges not offered, RTL positions, tab
64
+ insertion into a vetoed group, a rule changed mid-drag in a tab drag and in a window drag, a
65
+ throwing `canDrop`, no rules meaning every target), and `startPointerDrag` ending on blur and on a
66
+ lost capture. Each rule was seen failing with it broken; the two safety layers (not offered while
67
+ hovering, asked again at release) are pinned separately.
68
+ - `dockZones.browser.ts` (18 tests, real Chrome): a tab dropped on each group zone and each workspace
69
+ edge lands where the user pointed, on screen, in LTR and RTL. With the RTL flip removed, exactly the
70
+ RTL left/right cases fail.
71
+ - `ReleaseA.test.tsx`: empty groups inside a split keep the built-in message; only the root group
72
+ shows the `emptyWorkspace` view. 7.8.0 behaved this way, but no test pinned it. A redundant
73
+ root-only check in `WorkspaceGrid` was removed: nested grids never receive the prop, which is
74
+ what the new test now proves. (Found while porting 7.8.0 to vdd.)
75
+
13
76
  ## [7.8.0] — 2026-10-06
14
77
 
15
78
  More control over how the desktop looks and where panels open, all opt-in: without the new options,
@@ -1106,7 +1169,8 @@ All of the above is additive and backward-compatible: every new field is optiona
1106
1169
 
1107
1170
  ---
1108
1171
 
1109
- [Unreleased]: https://github.com/felipecarrillo100/react-dockable-desktop/compare/v7.8.0...HEAD
1172
+ [Unreleased]: https://github.com/felipecarrillo100/react-dockable-desktop/compare/v7.9.0...HEAD
1173
+ [7.9.0]: https://github.com/felipecarrillo100/react-dockable-desktop/compare/v7.8.0...v7.9.0
1110
1174
  [7.8.0]: https://github.com/felipecarrillo100/react-dockable-desktop/compare/v7.7.4...v7.8.0
1111
1175
  [7.7.4]: https://github.com/felipecarrillo100/react-dockable-desktop/compare/v7.7.3...v7.7.4
1112
1176
  [7.7.3]: https://github.com/felipecarrillo100/react-dockable-desktop/compare/v7.7.2...v7.7.3
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # React Dockable Desktop
2
2
 
3
- [![npm version](https://img.shields.io/badge/npm-v7.8.0-blue.svg)](https://www.npmjs.com/package/react-dockable-desktop)
3
+ [![npm version](https://img.shields.io/badge/npm-v7.9.0-blue.svg)](https://www.npmjs.com/package/react-dockable-desktop)
4
4
  [![TypeScript](https://img.shields.io/badge/TypeScript-first-3178c6.svg)](https://www.typescriptlang.org/)
5
5
  [![Touch Ready](https://img.shields.io/badge/touch-iPad%20%7C%20Android-success.svg)](#touch--mobile)
6
6
  [![license](https://img.shields.io/badge/license-MIT-green.svg)](#license)
@@ -25,6 +25,7 @@ serialised layout format**, so a layout saved by either library loads in the oth
25
25
 
26
26
  - **Split-Docking Grid** — drag panels to split any zone into rows/columns or group into tabbed containers
27
27
  - **Workspace Edge Docking** — drag to the outer edges to dock a panel as a full-width or full-height strip
28
+ - **Docking Rules** — keep a panel type in the grid (`canFloat: false`) or floating (`canDock: false`), and veto any move with one `canDrop` function; forbidden targets simply aren't offered
28
29
  - **Floating Windows** — pop panels into freely resizable floating windows; 8-direction resize handles (N/NE/E/SE/S/SW/W/NW), maximize, minimize; drag to a workspace corner to anchor it there — anchored windows stack with 8 px gaps and reposition when the viewport resizes
29
30
  - **Panel Overlay** — per-panel overlay layer with anchored toolbars (`RddPanelToolbar`, `RddToolbarButton`, `RddToolbarToggle`, async search) and corner-anchored floating windows that stack, drag, and dock; an axis can span the panel instead of carrying a fixed size, so a strip or column tracks the panel as it resizes — set declaratively or by dragging an edge out until it snaps; `useFloatingWidgets()` opens N named windows dynamically from data or event handlers
30
31
  - **Touch & Mobile Ready** — full iPad and Android support: long-press to drag tabs, touch resize, 44px coarse-pointer targets throughout