react-dockable-desktop 7.10.1 → 7.11.0-next.1

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,139 @@ replacement and the version that removes the old API.
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [7.11.0-next.1] — 2026-11-19
14
+
15
+ **Pre-release** on npm's `next` tag, from the first feedback on 7.11.0-next.0. Additions and fixes
16
+ to widgets out of the panel only; nothing else changes.
17
+
18
+ ### Added
19
+
20
+ - **`useWidget().panelId`:** the id of the widget's own panel while it is out of its panel, for
21
+ workspace calls such as `updatePanelTitle`; `null` while it is in the panel. No need to compose
22
+ `'<ownerId>/<widgetId>'` yourself.
23
+ - **Out of the panel, the title icon opens the widget's menu, as it does in the panel.** Docked or a
24
+ tab, the tab's icon opens the same menu as a right-click on the tab; floating, the title bar's
25
+ icon opens the same menu as its ⋮ button (so, as that button, only with a `titleMenu`). Right-click
26
+ and ⋮ stay; ordinary panels' icons are unchanged. The icon gets
27
+ `.rdd-workspace-tab-icon--menu` / `.rdd-window-title-icon--menu`. With your own
28
+ `renderTabContent`, the tab's icon is yours and opens nothing.
29
+
30
+ ### Fixed
31
+
32
+ - **A widget's panel now brings its owner's panel contribution.** While it was the active panel,
33
+ `useActiveContribution()` (and so `useMergedToolbarItems` / `useMergedSidebarTabs`) gave `null`, so
34
+ the owner's toolbar items and sidebar tabs vanished while the user worked in the widget. It now
35
+ gives the owner's. Ordinary panels are unchanged.
36
+ - **A title set on a widget's panel is kept across moves out of the panel.** A move from one place out
37
+ of the panel to another (docked to floating, say) replaces the widget's panel, and the new one took
38
+ the widget's `title`, dropping one set with `updatePanelTitle`. It now keeps the title it had. A
39
+ re-open still applies the widget's `title`, which is the recommended place for a live title.
40
+
41
+ ### Docs
42
+
43
+ - **Widgets Out of the Panel:** a new section, "Content with its own view" (a place keeps its camera,
44
+ a range keeps what is visible); where the menu opens in each place; `panelId`; the title and
45
+ contribution notes.
46
+
47
+ ## [7.11.0-next.0] — 2026-11-19
48
+
49
+ **Pre-release** on npm's `next` tag (`npm install react-dockable-desktop@next`), for feedback before
50
+ 7.11.0. Widgets that can leave their panel: a managed floating widget can be docked beside its
51
+ panel, become a tab in its group, or float as a window of its own, and come back, without its
52
+ content remounting. Its placement can be saved and restored; iframes can be kept from reloading
53
+ 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).
54
+ Additions only: an app that uses none of it sees no change, apart from the points under **Changed** below.
55
+
56
+ ### Added
57
+
58
+ - **`useFloatingWidgets().move(id, to)` and `.location(id)`: a managed widget can leave its panel
59
+ and come back, without remounting its content.** `to` is a `WidgetTarget`:
60
+ `{ to: 'docked', position, size? }` beside its owner panel, `{ to: 'tabbed' }` in the owner's group,
61
+ `{ to: 'floating', rect? }`, or `{ to: 'panel' }` back to where it last was in the panel. Out of the
62
+ panel it is a workspace panel of its own (`'<ownerId>/<widgetId>'`), with the widget's title and icon:
63
+ the user can move, minimise and close it like any other, and it appears in `getOpenPanelIds()`, the
64
+ taskbar and the panel events, but never in `saveLayout()`. The content stays rendered in the owner
65
+ panel's tree, so it keeps its state and its owner's contexts (`usePanel()` is still the owner).
66
+ - **`move()` returns a `MoveResult`** instead of throwing; a refusal (`not-open`, `owner-not-docked`,
67
+ `owner-not-kept-alive`, `no-workspace`) changes nothing.
68
+ - **Closing it in the page closes the widget:** the × on its tab or title bar, its menu's Close, or
69
+ `closePanel()` on it. So do `close(id)`, `closeAll()` and the owner panel closing.
70
+ - **The owner hidden or minimised** leaves the widget out and on screen.
71
+ - **`loadLayout()`** never keeps a widget's panel; the widget goes back into its own panel.
72
+ - New types: `WidgetTarget`, `WidgetLocation` (`'panel' | 'docked' | 'tabbed' | 'floating' |
73
+ 'minimized'`) and `MoveResult`.
74
+ - **`ManagedWidget.canDock` and `.canFloat`:** whether the user may dock or float the widget out of
75
+ its panel. Out of the panel they are its workspace panel's rules for drags and drops (with your
76
+ `canDrop`), as `canDock` / `canFloat` are for panel types. Both default to `false`, restrict the
77
+ user only (`move()` always works), and change with another `open()`.
78
+ - **`ManagedWidget.titleMenu(w)`:** the menu on the widget's title icon, in your own words. It is
79
+ given a `WidgetMenuContext` (`{ id, location, canDock, canFloat, move, close }`) and returns
80
+ `ContextMenuItem[]`, built each time the menu opens.
81
+ - In the panel, the title icon becomes a button that opens the items. Without an icon it shows a
82
+ menu glyph. Without `titleMenu` nothing changes.
83
+ - Out of the panel, the items lead its tab's menu and its floating title-bar menu, before the
84
+ built-in Minimize and Close. The built-in Float isn't offered for such a panel, because your
85
+ items replace it.
86
+ - New type: `WidgetMenuContext`.
87
+ - **`useWidget()`:** inside a managed widget's content, the widget's own side; `null` elsewhere.
88
+ `usePanel()` there is still the owner panel.
89
+ - It gives `{ id, ownerPanelId, location, onWillMove, onMoved }`. `location` re-renders the
90
+ component when it changes.
91
+ - **`onWillMove(cb)`** is called just before the content element moves to another container: in or
92
+ out of its panel, between docked, tabbed and floating, minimised or restored. Your own `move()`
93
+ calls, the user's drags and menus, and a layout load sending it home all count. Save what a move
94
+ would disturb here, such as a map's view.
95
+ - **`onMoved(cb)`** is called once the element is in its new container and has its new size (when
96
+ it has none, as when minimised, on the next frames). Restore it there.
97
+ - Both return their unsubscribe function, and neither is called for a close.
98
+ - New type: `WidgetHandle`.
99
+ - **`useFloatingWidgets().placement(id)` and `open(id, { placement })`: a widget opens where it was
100
+ after a reload.** `placement()` returns a `WidgetPlacement`: opaque, versioned, plain JSON, the same
101
+ in vdd and ndd. Store it with your panel's own state.
102
+ - It records where the widget is in the panel (corner, stretch, docked or free, size), or where it
103
+ is out of it (docked beside its owner, tabbed, floating) together with where it goes back to.
104
+ - A free position is kept as an offset from the panel corner it was nearest, so it keeps its gap on a
105
+ bigger or smaller panel, and mirrors in RTL.
106
+ - Given back in `open()`, it applies only on the first open of an id, as `anchor` does. A value that
107
+ can't be read (another version, broken fields) uses the config's own `anchor`, size and `stretch`
108
+ instead.
109
+ - A valid value is clamped into the panel as it is now. In a panel that has no size yet (a
110
+ background tab), a free position waits until the panel is shown.
111
+ - A placement out of the panel moves the widget out after it opens; if that's refused, the widget
112
+ stays in the panel.
113
+ - New type: `WidgetPlacement`.
114
+ - **`focusPanel(id, { restore: true })`** on the workspace (`useWorkspace()`, `createWorkspace()`):
115
+ also restores a minimised panel before focusing it, with `restorePanel`'s events. It is a second
116
+ overload; `focusPanel(id)` behaves as before (a minimised panel becomes the active one but stays
117
+ minimised), and the `WorkspaceActions` type is unchanged.
118
+ - **`updatePanelProps(id, props | (prev) => next)`:** replaces the props an open panel was opened
119
+ with, or derives them from the current ones. The panel re-renders with them, `serializable` is
120
+ re-checked (so `saveLayout()` saves or excludes it accordingly), and `layout:changed` is
121
+ published. It does nothing for a panel that isn't open.
122
+ - **`preserveEmbeds`**, on a panel type's `defaultOptions` and on a managed widget: an `<iframe>` (or
123
+ other embedded document or media) inside doesn't reload when the panel or widget moves: docked,
124
+ floated, minimised, restored, the grid changing around it, or a widget out of its panel and
125
+ back. The library then moves the element with `moveBefore()` where the browser has it (Chrome
126
+ and Edge 133+, Firefox 144+); in the others (Safari) an iframe reloads as before. Off by default.
127
+ A widget with it also moves its owner panel's element this way, since that element carries the
128
+ widget.
129
+ - **`PanelInfo.owner` and the `PanelOwner` type.** Set on a panel that shows a managed widget moved out
130
+ of its owner panel: `{ panelId, widgetId }`. Such a panel has the reserved component `'rdd:widget'`,
131
+ exists only at runtime, and is never written by `saveLayout()` (nor reported by `onPanelsExcluded`).
132
+ A layout that names one, which only a hand-made JSON can, loads without it.
133
+
134
+ ### Changed
135
+
136
+ - **A widget opened with `useFloatingWidgets().open()` now renders its content once, into its own
137
+ element:** `div.rdd-panel-float__content`, the only child of `.rdd-panel-float__body`, with
138
+ `width: 100%; height: 100%`. Content laid out with `height: 100%` fills the widget exactly as before,
139
+ and the body still scrolls. CSS that targets the body's direct child (`.rdd-panel-float__body > …`)
140
+ no longer matches; drop the `>` or target your own class. `RddFloatingWidget` is unchanged.
141
+ - **The widget's whole placement now lives in the overlay:** docked or free, its free position and its
142
+ size, as well as the anchor and stretch moved there in 7.10.1. Nothing changes on screen.
143
+ - **A pointerdown anywhere in such a widget's content brings it to the front,** even when the content
144
+ stops the event's propagation.
145
+
13
146
  ## [7.10.1] — 2026-11-18
14
147
 
15
148
  Internal groundwork for widgets that can leave their panel (a planned feature). No API change and
@@ -1207,7 +1340,9 @@ All of the above is additive and backward-compatible: every new field is optiona
1207
1340
 
1208
1341
  ---
1209
1342
 
1210
- [Unreleased]: https://github.com/felipecarrillo100/react-dockable-desktop/compare/v7.10.1...HEAD
1343
+ [Unreleased]: https://github.com/felipecarrillo100/react-dockable-desktop/compare/v7.11.0-next.1...HEAD
1344
+ [7.11.0-next.1]: https://github.com/felipecarrillo100/react-dockable-desktop/compare/v7.11.0-next.0...v7.11.0-next.1
1345
+ [7.11.0-next.0]: https://github.com/felipecarrillo100/react-dockable-desktop/compare/v7.10.1...v7.11.0-next.0
1211
1346
  [7.10.1]: https://github.com/felipecarrillo100/react-dockable-desktop/compare/v7.10.0...v7.10.1
1212
1347
  [7.10.0]: https://github.com/felipecarrillo100/react-dockable-desktop/compare/v7.9.0...v7.10.0
1213
1348
  [7.9.0]: https://github.com/felipecarrillo100/react-dockable-desktop/compare/v7.8.0...v7.9.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.1-blue.svg)](https://www.npmjs.com/package/react-dockable-desktop)
3
+ [![npm version](https://img.shields.io/badge/npm-v7.11.0--next.1-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 |