react-dockable-desktop 7.10.0 → 7.11.0-next.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,121 @@ replacement and the version that removes the old API.
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [7.11.0-next.0] — 2026-11-19
14
+
15
+ **Pre-release** on npm's `next` tag (`npm install react-dockable-desktop@next`), for feedback before
16
+ 7.11.0. Widgets that can leave their panel: a managed floating widget can be docked beside its
17
+ panel, become a tab in its group, or float as a window of its own, and come back, without its
18
+ content remounting. Its placement can be saved and restored; iframes can be kept from reloading
19
+ when panels and widgets move. See the new guide, [Widgets Out of the Panel](https://felipecarrillo100.github.io/react-dockable-desktop/guide/widgets-out-of-the-panel).
20
+ Additions only: an app that uses none of it sees no change, apart from the points under **Changed** below.
21
+
22
+ ### Added
23
+
24
+ - **`useFloatingWidgets().move(id, to)` and `.location(id)`: a managed widget can leave its panel
25
+ and come back, without remounting its content.** `to` is a `WidgetTarget`:
26
+ `{ to: 'docked', position, size? }` beside its owner panel, `{ to: 'tabbed' }` in the owner's group,
27
+ `{ to: 'floating', rect? }`, or `{ to: 'panel' }` back to where it last was in the panel. Out of the
28
+ panel it is a workspace panel of its own (`'<ownerId>/<widgetId>'`), with the widget's title and icon:
29
+ the user can move, minimise and close it like any other, and it appears in `getOpenPanelIds()`, the
30
+ taskbar and the panel events, but never in `saveLayout()`. The content stays rendered in the owner
31
+ panel's tree, so it keeps its state and its owner's contexts (`usePanel()` is still the owner).
32
+ - **`move()` returns a `MoveResult`** instead of throwing; a refusal (`not-open`, `owner-not-docked`,
33
+ `owner-not-kept-alive`, `no-workspace`) changes nothing.
34
+ - **Closing it in the page closes the widget:** the × on its tab or title bar, its menu's Close, or
35
+ `closePanel()` on it. So do `close(id)`, `closeAll()` and the owner panel closing.
36
+ - **The owner hidden or minimised** leaves the widget out and on screen.
37
+ - **`loadLayout()`** never keeps a widget's panel; the widget goes back into its own panel.
38
+ - New types: `WidgetTarget`, `WidgetLocation` (`'panel' | 'docked' | 'tabbed' | 'floating' |
39
+ 'minimized'`) and `MoveResult`.
40
+ - **`ManagedWidget.canDock` and `.canFloat`:** whether the user may dock or float the widget out of
41
+ its panel. Out of the panel they are its workspace panel's rules for drags and drops (with your
42
+ `canDrop`), as `canDock` / `canFloat` are for panel types. Both default to `false`, restrict the
43
+ user only (`move()` always works), and change with another `open()`.
44
+ - **`ManagedWidget.titleMenu(w)`:** the menu on the widget's title icon, in your own words. It is
45
+ given a `WidgetMenuContext` (`{ id, location, canDock, canFloat, move, close }`) and returns
46
+ `ContextMenuItem[]`, built each time the menu opens.
47
+ - In the panel, the title icon becomes a button that opens the items. Without an icon it shows a
48
+ menu glyph. Without `titleMenu` nothing changes.
49
+ - Out of the panel, the items lead its tab's menu and its floating title-bar menu, before the
50
+ built-in Minimize and Close. The built-in Float isn't offered for such a panel, because your
51
+ items replace it.
52
+ - New type: `WidgetMenuContext`.
53
+ - **`useWidget()`:** inside a managed widget's content, the widget's own side; `null` elsewhere.
54
+ `usePanel()` there is still the owner panel.
55
+ - It gives `{ id, ownerPanelId, location, onWillMove, onMoved }`. `location` re-renders the
56
+ component when it changes.
57
+ - **`onWillMove(cb)`** is called just before the content element moves to another container: in or
58
+ out of its panel, between docked, tabbed and floating, minimised or restored. Your own `move()`
59
+ calls, the user's drags and menus, and a layout load sending it home all count. Save what a move
60
+ would disturb here, such as a map's view.
61
+ - **`onMoved(cb)`** is called once the element is in its new container and has its new size (when
62
+ it has none, as when minimised, on the next frames). Restore it there.
63
+ - Both return their unsubscribe function, and neither is called for a close.
64
+ - New type: `WidgetHandle`.
65
+ - **`useFloatingWidgets().placement(id)` and `open(id, { placement })`: a widget opens where it was
66
+ after a reload.** `placement()` returns a `WidgetPlacement`: opaque, versioned, plain JSON, the same
67
+ in vdd and ndd. Store it with your panel's own state.
68
+ - It records where the widget is in the panel (corner, stretch, docked or free, size), or where it
69
+ is out of it (docked beside its owner, tabbed, floating) together with where it goes back to.
70
+ - A free position is kept as an offset from the panel corner it was nearest, so it keeps its gap on a
71
+ bigger or smaller panel, and mirrors in RTL.
72
+ - Given back in `open()`, it applies only on the first open of an id, as `anchor` does. A value that
73
+ can't be read (another version, broken fields) uses the config's own `anchor`, size and `stretch`
74
+ instead.
75
+ - A valid value is clamped into the panel as it is now. In a panel that has no size yet (a
76
+ background tab), a free position waits until the panel is shown.
77
+ - A placement out of the panel moves the widget out after it opens; if that's refused, the widget
78
+ stays in the panel.
79
+ - New type: `WidgetPlacement`.
80
+ - **`focusPanel(id, { restore: true })`** on the workspace (`useWorkspace()`, `createWorkspace()`):
81
+ also restores a minimised panel before focusing it, with `restorePanel`'s events. It is a second
82
+ overload; `focusPanel(id)` behaves as before (a minimised panel becomes the active one but stays
83
+ minimised), and the `WorkspaceActions` type is unchanged.
84
+ - **`updatePanelProps(id, props | (prev) => next)`:** replaces the props an open panel was opened
85
+ with, or derives them from the current ones. The panel re-renders with them, `serializable` is
86
+ re-checked (so `saveLayout()` saves or excludes it accordingly), and `layout:changed` is
87
+ published. It does nothing for a panel that isn't open.
88
+ - **`preserveEmbeds`**, on a panel type's `defaultOptions` and on a managed widget: an `<iframe>` (or
89
+ other embedded document or media) inside doesn't reload when the panel or widget moves: docked,
90
+ floated, minimised, restored, the grid changing around it, or a widget out of its panel and
91
+ back. The library then moves the element with `moveBefore()` where the browser has it (Chrome
92
+ and Edge 133+, Firefox 144+); in the others (Safari) an iframe reloads as before. Off by default.
93
+ A widget with it also moves its owner panel's element this way, since that element carries the
94
+ widget.
95
+ - **`PanelInfo.owner` and the `PanelOwner` type.** Set on a panel that shows a managed widget moved out
96
+ of its owner panel: `{ panelId, widgetId }`. Such a panel has the reserved component `'rdd:widget'`,
97
+ exists only at runtime, and is never written by `saveLayout()` (nor reported by `onPanelsExcluded`).
98
+ A layout that names one, which only a hand-made JSON can, loads without it.
99
+
100
+ ### Changed
101
+
102
+ - **A widget opened with `useFloatingWidgets().open()` now renders its content once, into its own
103
+ element:** `div.rdd-panel-float__content`, the only child of `.rdd-panel-float__body`, with
104
+ `width: 100%; height: 100%`. Content laid out with `height: 100%` fills the widget exactly as before,
105
+ and the body still scrolls. CSS that targets the body's direct child (`.rdd-panel-float__body > …`)
106
+ no longer matches; drop the `>` or target your own class. `RddFloatingWidget` is unchanged.
107
+ - **The widget's whole placement now lives in the overlay:** docked or free, its free position and its
108
+ size, as well as the anchor and stretch moved there in 7.10.1. Nothing changes on screen.
109
+ - **A pointerdown anywhere in such a widget's content brings it to the front,** even when the content
110
+ stops the event's propagation.
111
+
112
+ ## [7.10.1] — 2026-11-18
113
+
114
+ Internal groundwork for widgets that can leave their panel (a planned feature). No API change and
115
+ no behaviour change.
116
+
117
+ ### Changed
118
+
119
+ - **Widgets opened with `useFloatingWidgets().open()` now keep their placement in the overlay**
120
+ (`RddPanelOverlay`) instead of inside each widget, as vdd and ndd already do. Their anchor and
121
+ stretch are seeded from the config on the first open, kept when the same id is opened again, and
122
+ reset by closing it, all exactly as before. A drag that ends after its widget closed no longer
123
+ has anywhere to leave a placement behind. `<RddFloatingWidget>` used directly is unchanged.
124
+ - **A hidden panel waits in the hidden store of its workspace's own document**, rather than one
125
+ always found on the global `document`. For a page with one document, which is every page today,
126
+ nothing changes: the store is still `#preserved-dom-container`, hidden, in `<body>`.
127
+
13
128
  ## [7.10.0] — 2026-10-07
14
129
 
15
130
  Your own tab content, and an opt-in typed panel registry. Both opt-in: without them nothing changes.
@@ -1191,7 +1306,9 @@ All of the above is additive and backward-compatible: every new field is optiona
1191
1306
 
1192
1307
  ---
1193
1308
 
1194
- [Unreleased]: https://github.com/felipecarrillo100/react-dockable-desktop/compare/v7.10.0...HEAD
1309
+ [Unreleased]: https://github.com/felipecarrillo100/react-dockable-desktop/compare/v7.11.0-next.0...HEAD
1310
+ [7.11.0-next.0]: https://github.com/felipecarrillo100/react-dockable-desktop/compare/v7.10.1...v7.11.0-next.0
1311
+ [7.10.1]: https://github.com/felipecarrillo100/react-dockable-desktop/compare/v7.10.0...v7.10.1
1195
1312
  [7.10.0]: https://github.com/felipecarrillo100/react-dockable-desktop/compare/v7.9.0...v7.10.0
1196
1313
  [7.9.0]: https://github.com/felipecarrillo100/react-dockable-desktop/compare/v7.8.0...v7.9.0
1197
1314
  [7.8.0]: https://github.com/felipecarrillo100/react-dockable-desktop/compare/v7.7.4...v7.8.0
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.10.0-blue.svg)](https://www.npmjs.com/package/react-dockable-desktop)
3
+ [![npm version](https://img.shields.io/badge/npm-v7.11.0--next.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)
@@ -27,9 +27,9 @@ serialised layout format**, so a layout saved by either library loads in the oth
27
27
  - **Workspace Edge Docking** — drag to the outer edges to dock a panel as a full-width or full-height strip
28
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
29
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
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
+ - **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, and can move one out of its panel (docked beside it, a tab, or floating) and back without remounting it
31
31
  - **Touch & Mobile Ready** — full iPad and Android support: long-press to drag tabs, touch resize, 44px coarse-pointer targets throughout
32
- - **Zero-Unmount DOM Persistence** — panel DOM nodes are moved, never destroyed, across docking, floating, and tab-switching alike, all by default; WebGL, maps, terminals, and forms retain full state with zero integration work (a heavy, rarely shown panel type can opt out with `keepAlive: false`)
32
+ - **Zero-Unmount DOM Persistence** — panel DOM nodes are moved, never destroyed, across docking, floating, and tab-switching alike, all by default; WebGL, maps, terminals, and forms retain full state with zero integration work (a heavy, rarely shown panel type can opt out with `keepAlive: false`; an `<iframe>` can be kept from reloading on moves with `preserveEmbeds: true`, where the browser has `moveBefore()`)
33
33
  - **i18n & RTL** — full Right-to-Left layout support; `dir="rtl"` flips every control, tab order, and drop zone automatically
34
34
  - **Inter-Panel Pub/Sub** — lightweight typed event bus for decoupled panel-to-panel communication
35
35
  - **Your Own Tab Content** — `renderTabContent` puts your icon, title, badge or status dot in every tab; dragging, keyboard and accessibility stay the library's
@@ -191,7 +191,8 @@ Call these inside any component within the `DockableDesktopProvider` tree:
191
191
  | `useSidebarTab()` | `SidebarTabContext` | Self-control for content inside a sidebar tab |
192
192
  | `useContextMenu()` | `(options) => void` | Show the shared context menu at a pointer event or position |
193
193
  | `usePanelContextMenu(items)` | `void` | Inject dynamic context menu items into this panel's right-click menu |
194
- | `useFloatingWidgets()` | `FloatingWidgetsApi` | Open/close N named floating widgets inside a panel overlay at runtime; each independently anchored, dockable, and resizable |
194
+ | `useFloatingWidgets()` | `FloatingWidgetsApi` | Open/close N named floating widgets inside a panel overlay at runtime; each independently anchored, dockable, and resizable. `move()` takes one out of its panel and back, `placement()` saves where it is |
195
+ | `useWidget()` | `WidgetHandle \| null` | Inside a managed widget: its `id`, owner panel, live `location`, and `onWillMove` / `onMoved` around every move |
195
196
  | `useFormatMessage()` | `MessageFormatter` | i18n formatter matching the current provider's locale |
196
197
  | `useMessages()` | `Record<MessageKey, MessageDescriptor>` | The effective built-in message table |
197
198
  | `useHostClasses()` | `HostClasses` | The class props set on the provider (`modalClass`, `windowClass`, …) |
@@ -224,6 +225,7 @@ workspace.openPanel(id, component, options?) // options: title, initialTarget,
224
225
  workspace.closePanel(id) // closes immediately — no guard, no dirty check
225
226
  workspace.requestClosePanel(id, { force?, onConfirm? }) // guarded close; a dirty panel closes only if onConfirm resolves true
226
227
  workspace.focusPanel(id) // raises floating / selects tab for docked
228
+ workspace.focusPanel(id, { restore: true }) // ...and restores a minimized one first
227
229
  workspace.floatPanel(id, rect?, anchor?) // detach to a floating window; optional corner anchor
228
230
  workspace.dockPanel(id) // return floating to the grid
229
231
  workspace.minimizePanel(id)
@@ -240,6 +242,7 @@ workspace.movePanelOrder(id, leafId, index) // move a tab within or betwe
240
242
  workspace.updatePanelTitle(id, title)
241
243
  workspace.setPanelIcon(id, icon) // null restores the registration's icon; never saved
242
244
  workspace.setPanelDirty(id, dirty, options?)
245
+ workspace.updatePanelProps(id, props | prev => next) // new props; re-checks whether the panel can be saved
243
246
 
244
247
  // Synchronous state queries (no hook needed)
245
248
  workspace.isOpen(id) // → boolean
@@ -464,6 +467,7 @@ Complete guides, API reference, and interactive demo at:
464
467
  | [Advanced Topics](https://felipecarrillo100.github.io/react-dockable-desktop/guide/advanced) | RTL, multiple workspaces, custom header actions, custom drag-resize interactions |
465
468
  | [Best Practices](https://felipecarrillo100.github.io/react-dockable-desktop/guide/best-practices) | Patterns for production-ready implementations |
466
469
  | [Panel Overlay](https://felipecarrillo100.github.io/react-dockable-desktop/guide/panel-overlay) | `RddPanelOverlay`, panel toolbars, `RddFloatingWidget`, `useFloatingWidgets` |
470
+ | [Widgets Out of the Panel](https://felipecarrillo100.github.io/react-dockable-desktop/guide/widgets-out-of-the-panel) | Dock, tab or float a managed widget beside its panel; `useWidget`, `placement`, `preserveEmbeds` |
467
471
  | [Toast Notifications](https://felipecarrillo100.github.io/react-dockable-desktop/guide/toast) | `toast` singleton, `<RddToasts>`, queue behaviour, theming, `ToastAdapter` |
468
472
  | [Migration Guide](https://felipecarrillo100.github.io/react-dockable-desktop/guide/migration) | Upgrading across major versions |
469
473
  | [UI Frameworks](https://felipecarrillo100.github.io/react-dockable-desktop/guide/ui-frameworks) | Using it with MUI, Bootstrap or Tailwind: dark mode, z-index, overrides |