react-dockable-desktop 3.1.0 → 4.0.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 +77 -22
- package/dist/index.cjs +5 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +674 -210
- package/dist/index.d.ts +674 -210
- package/dist/index.js +5 -6
- package/dist/index.js.map +1 -1
- package/dist/styles.css +876 -237
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# React Dockable Desktop
|
|
1
|
+
# React Dockable Desktop
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/react-dockable-desktop)
|
|
4
4
|
[](https://www.typescriptlang.org/)
|
|
5
5
|
[](#touch--mobile)
|
|
6
6
|
[](#license)
|
|
@@ -19,7 +19,8 @@ A premium dockable layout engine for React. Build desktop-class applications wit
|
|
|
19
19
|
|
|
20
20
|
- **Split-Docking Grid** — drag panels to split any zone into rows/columns or group into tabbed containers
|
|
21
21
|
- **Workspace Edge Docking** — drag to the outer edges to dock a panel as a full-width or full-height strip
|
|
22
|
-
- **Floating Windows** — pop panels into freely resizable floating windows; 8-direction resize handles (N/NE/E/SE/S/SW/W/NW), maximize, minimize
|
|
22
|
+
- **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
|
|
23
|
+
- **Panel Overlay** — per-panel overlay layer with anchored toolbars (`PanelToolbar`, `ToolbarButton`, `ToolbarToggle`, async search) and corner-anchored floating windows that stack, drag, and dock; `usePanelFloatingWindowManager()` opens N named windows dynamically from data or event handlers
|
|
23
24
|
- **Touch & Mobile Ready** — full iPad and Android support: long-press to drag tabs, touch resize, 44px coarse-pointer targets throughout
|
|
24
25
|
- **Zero-Unmount DOM Persistence** — panel DOM nodes are moved, never destroyed; WebGL, maps, terminals, and forms retain full state
|
|
25
26
|
- **i18n & RTL** — full Right-to-Left layout support; `dir="rtl"` flips every control, tab order, and drop zone automatically
|
|
@@ -27,6 +28,8 @@ A premium dockable layout engine for React. Build desktop-class applications wit
|
|
|
27
28
|
- **Imperative API** — `WorkspaceClient` opens, closes, focuses, and serializes panels from anywhere — inside or outside React
|
|
28
29
|
- **Layout Serialization** — save and restore the full workspace as a JSON string; survives page reloads
|
|
29
30
|
- **7 Built-in Skins** — VSCode, macOS, Chrome, Slate, Nord, Obsidian, Tokyo — all fully themeable via CSS variables
|
|
31
|
+
- **Toast Notifications** — imperative singleton `toast.info/success/warning/error/promise()` with queue, pause-on-hover, progress bar, and a `ToastAdapter` interface for delegating to a third-party notification library
|
|
32
|
+
- **Zero extra dependencies** — no runtime dependencies beyond React itself; everything is bundled in
|
|
30
33
|
- **TypeScript-first** — complete type definitions included; no separate `@types/` package needed
|
|
31
34
|
|
|
32
35
|
---
|
|
@@ -34,17 +37,16 @@ A premium dockable layout engine for React. Build desktop-class applications wit
|
|
|
34
37
|
## Installation
|
|
35
38
|
|
|
36
39
|
```bash
|
|
37
|
-
npm install react-dockable-desktop
|
|
40
|
+
npm install react-dockable-desktop
|
|
38
41
|
```
|
|
39
42
|
|
|
40
|
-
Import styles in your app entry file
|
|
43
|
+
Import styles in your app entry file:
|
|
41
44
|
|
|
42
45
|
```ts
|
|
43
|
-
import 'replace-react-contexify/styles.css';
|
|
44
46
|
import 'react-dockable-desktop/styles.css';
|
|
45
47
|
```
|
|
46
48
|
|
|
47
|
-
**Requirements:** React ≥ 16.8 · Node ≥ 18
|
|
49
|
+
**Requirements:** React ≥ 16.8 · Node ≥ 18 · No other runtime dependencies
|
|
48
50
|
|
|
49
51
|
---
|
|
50
52
|
|
|
@@ -146,6 +148,11 @@ Call these inside any component within the `DockableDesktopProvider` tree:
|
|
|
146
148
|
| `usePanelContext()` | `{ publish, subscribe }` | Inter-panel typed event bus |
|
|
147
149
|
| `useFormContainer()` | `FormContainerContract` | Dirty state, close guards, dynamic panel title/icon |
|
|
148
150
|
| `usePanelId()` | `string` | The panel's own instance ID — no prop drilling needed |
|
|
151
|
+
| `useToolbar()` | `ToolbarContextValue` | Read/write Toolbar state (active tool, modifiers) from any panel |
|
|
152
|
+
| `useSidebar()` | `SidebarContextValue` | Open/close Sidebar tabs from any component in the Sidebar tree |
|
|
153
|
+
| `useSidebarTab()` | `SidebarTabContext` | Self-control for content inside a Sidebar tab |
|
|
154
|
+
| `usePanelContextMenu(items)` | `void` | Inject dynamic context menu items into this panel's right-click menu |
|
|
155
|
+
| `usePanelFloatingWindowManager()` | `PanelFloatingWindowManagerHandle` | Open/close N named floating windows inside a panel overlay at runtime; each independently anchored, dockable, and resizable |
|
|
149
156
|
| `useRegistry()` | `PanelRegistryClass` | The scoped panel registry for the current provider |
|
|
150
157
|
| `useFormatMessage()` | `MessageFormatter` | i18n formatter matching the current provider's locale |
|
|
151
158
|
|
|
@@ -165,10 +172,10 @@ const panelCount = useWindowManagerState(s => Object.keys(s.panels).length);
|
|
|
165
172
|
const workspace = new WorkspaceClient({ panels, initialState?, formatMessage?, dir? });
|
|
166
173
|
|
|
167
174
|
// Panel lifecycle
|
|
168
|
-
workspace.openPanel(id, component, options?) // options: title, initialTarget,
|
|
175
|
+
workspace.openPanel(id, component, options?) // options: title, initialTarget, anchor
|
|
169
176
|
workspace.closePanel(id)
|
|
170
177
|
workspace.focusPanel(id) // raises floating / selects tab for docked
|
|
171
|
-
workspace.floatPanel(id, rect?)
|
|
178
|
+
workspace.floatPanel(id, rect?, anchor?) // detach to a floating window; optional corner anchor
|
|
172
179
|
workspace.dockPanel(id) // return floating to the grid
|
|
173
180
|
workspace.minimizePanel(id)
|
|
174
181
|
workspace.restorePanel(id)
|
|
@@ -256,19 +263,28 @@ Touch support is built in for v3.1.0+. No extra setup required:
|
|
|
256
263
|
|
|
257
264
|
## i18n & RTL
|
|
258
265
|
|
|
266
|
+
The library does **not** auto-detect direction — the consuming app owns it. Two things must be wired together:
|
|
267
|
+
|
|
259
268
|
```tsx
|
|
269
|
+
// 1. Keep html[dir] in sync for portals (ContextMenu, flyout, Toast)
|
|
270
|
+
// that render into document.body and need CSS direction inheritance.
|
|
271
|
+
useEffect(() => {
|
|
272
|
+
document.documentElement.dir = isRtl ? 'rtl' : 'ltr';
|
|
273
|
+
}, [isRtl]);
|
|
274
|
+
|
|
275
|
+
// 2. Pass dir prop to the provider — controls workspace layout engine.
|
|
260
276
|
<DockableDesktopProvider
|
|
261
|
-
dir=
|
|
277
|
+
dir={isRtl ? 'rtl' : 'ltr'}
|
|
262
278
|
formatMessage={(msg) => intl.formatMessage({ id: msg.id, defaultMessage: msg.defaultMessage })}
|
|
263
279
|
predefinedMessages={customMessages}
|
|
264
280
|
>
|
|
265
281
|
```
|
|
266
282
|
|
|
267
|
-
`dir` can be `'ltr'` (default) or `'rtl'`. All layout, split directions, tab ordering, drop zones, and context menus flip automatically.
|
|
283
|
+
`dir` can be `'ltr'` (default) or `'rtl'`. All layout, split directions, tab ordering, floating window controls, drop zones, sidebars, and context menus flip automatically.
|
|
268
284
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
285
|
+
Direction is **independent of locale** — you can have Arabic translations with LTR layout, or RTL without locale changes.
|
|
286
|
+
|
|
287
|
+
See the [RTL Support guide](https://felipecarrillo100.github.io/react-dockable-desktop/guide/rtl) for the complete wiring pattern and macOS skin notes.
|
|
272
288
|
|
|
273
289
|
---
|
|
274
290
|
|
|
@@ -281,19 +297,56 @@ workspace.setDirection('rtl');
|
|
|
281
297
|
<WindowManager skin="tokyo" />
|
|
282
298
|
```
|
|
283
299
|
|
|
284
|
-
|
|
300
|
+
| Skin | Character | Active state (Sidebar & Toolbar) |
|
|
301
|
+
|------|-----------|----------------------------------|
|
|
302
|
+
| `vscode` | VS Code dark (default) | Transparent fill, 2 px accent bar |
|
|
303
|
+
| `macos` | Glass Chip — accent fill, rounded corners | 36 px floating chip, white inner ring |
|
|
304
|
+
| `chrome` | Google Chrome tab geometry | Sidebar: half-pill bridge. Toolbar: 2 px bar |
|
|
305
|
+
| `slate` | Fluent Slate — deep navy | Floating 36 px accent-tinted pill |
|
|
306
|
+
| `nord` | Arctic Frost — muted Nord palette | Short horizontal line below icon |
|
|
307
|
+
| `obsidian` | Vercel Midnight — pure black/white | Deep glow + icon drop-shadow |
|
|
308
|
+
| `tokyo` | Tokyo Night — purple accent | Neon glow + vivid icon drop-shadow |
|
|
285
309
|
|
|
286
|
-
Create your own skin by overriding CSS custom properties under a `[data-workspace-skin="myskin"]` selector. See the [Theming Guide](https://felipecarrillo100.github.io/react-dockable-desktop/guide/theming) for the full variable reference.
|
|
310
|
+
All built-in skins include dark and light variants. Create your own skin by overriding CSS custom properties under a `[data-workspace-skin="myskin"]` selector. See the [Theming Guide](https://felipecarrillo100.github.io/react-dockable-desktop/guide/theming) for the full variable reference and the [Per-skin active state guide](https://felipecarrillo100.github.io/react-dockable-desktop/guide/theming#per-skin-active-state-design-language) to customise the Sidebar/Toolbar active indicator in your own skin.
|
|
287
311
|
|
|
288
312
|
---
|
|
289
313
|
|
|
290
314
|
## What's New
|
|
291
315
|
|
|
316
|
+
### v4.3.0
|
|
317
|
+
- **Workspace corner anchor zones** — drag any panel (floating or docked tab) to a workspace corner to pin it there. Four 80×80 px snap zones appear during drag; same visual style as the inner panel drop zones. Anchored windows stack with 8 px gaps, uncapped, and reposition automatically on viewport resize.
|
|
318
|
+
- **`anchor` option on `openPanel` and `floatPanel`** — spawn a new floating window pre-anchored: `openPanel('id', 'comp', { initialTarget: 'floating', anchor: 'top-right' })` or `floatPanel('id', undefined, 'bottom-left')`.
|
|
319
|
+
- **`defaultAnchor` in panel registry** — set `defaultAnchor: 'top-left'` in `PanelRegistryEntry.defaultOptions` so every instance of that component opens anchored.
|
|
320
|
+
- **Full RTL support** — floating window drop zones, edge triggers, and corner snap zones all mirror correctly when `dir="rtl"`.
|
|
321
|
+
- **Removed:** `openPanel` options `stickyRight` / `stickyBottom` (replaced by `anchor`). Saved layouts are automatically migrated.
|
|
322
|
+
|
|
323
|
+
### v4.2.0
|
|
324
|
+
- **Toast Notifications** — zero-dependency `toast.info/success/warning/error/promise()` singleton. `<ToastContainer>` renders via `createPortal`; supports configurable position, width, max-visible queue, pause-on-hover, opt-in progress bar, and auto-dismiss. `ToastAdapter` lets you delegate to Ant Design, MUI, Sonner, or any other notification library without changing call sites. All colors inherit the active skin automatically.
|
|
325
|
+
|
|
326
|
+
### v4.1.0
|
|
327
|
+
- **Panel Overlay system** — `PanelOverlayRoot`, `PanelToolbar`, `PanelFloatingWindow`, and `usePanelFloatingWindowManager` bring per-panel toolbars and dynamically-spawned corner-anchored floating info windows to any panel.
|
|
328
|
+
- **`usePanelFloatingWindowManager()`** — imperative hook for opening N named floating windows from data or event handlers; all windows share z-ordering, drag, and corner-docking infrastructure.
|
|
329
|
+
- **Toolbar primitives** — `ToolbarButton`, `ToolbarToggle`, `PanelToolbarSeparator`, `ToolbarSpacer`, `ToolbarCenter`, `ToolbarSearchInput` compose panel toolbar content.
|
|
330
|
+
|
|
331
|
+
### v4.0.0
|
|
332
|
+
- **Built-in `<ContextMenu>`** — zero-dependency context menu, portal-rendered and styled with design tokens. No extra package or CSS import needed.
|
|
333
|
+
- **`ContextMenuAdapter` interface** — swap the default menu for your own design-system implementation via `<WindowManager contextMenuAdapter={...} />`.
|
|
334
|
+
- **New exports** — `ContextMenu`, `DefaultContextMenuAdapter`, `ContextMenuHandle`, `ContextMenuAdapter`, `ShowContextMenuOptions`.
|
|
335
|
+
|
|
336
|
+
### v3.2.0
|
|
337
|
+
- **Per-skin active state design language** — Sidebar tabs and Toolbar buttons now use a per-skin visual pattern (transparent bar, floating chip, pill, line, neon glow), driven by new CSS design tokens — fully overridable in custom skins. CSS-only, no API changes.
|
|
338
|
+
- **Documentation overhaul** — All guides updated to cover the full v3.1.0 API surface.
|
|
339
|
+
|
|
292
340
|
### v3.1.0
|
|
293
|
-
- **
|
|
294
|
-
-
|
|
295
|
-
- **
|
|
296
|
-
- **
|
|
341
|
+
- **`<Toolbar>` component** — Vertical/horizontal strip hosting `action`, `radio`, `toggle`, `group`, and `separator` items. `useToolbar()` reads/writes state from any panel. `ToolbarGroupItem` adds a collapsed tool-family flyout with controlled mode support.
|
|
342
|
+
- **`<WindowManager taskbarVisibility>`** — Three modes: `'always'` (permanent bar, new default), `'compact'` (shows only with minimized panels), `'autohide'` (overlay bar with 8 px peek strip).
|
|
343
|
+
- **Sidebar resizable drawer** — Drag the drawer edge to resize. Props: `defaultWidth` (px), `minWidth`, `maxWidth`, `onWidthChange`. `drawerWidth` (string) deprecated.
|
|
344
|
+
- **Sidebar `visible` / `stripVisible`** — `visible` collapses the entire sidebar; `stripVisible` collapses only the activity bar. New handle methods: `showStrip()`, `hideStrip()`, `setWidth(px)`, `getWidth()`.
|
|
345
|
+
- **`useSidebar()` / `useSidebarTab()` hooks** — Programmatic Sidebar control from any component in the tree.
|
|
346
|
+
- **`usePanelContextMenu()` hook** — Inject dynamic right-click context menu items from inside a panel component.
|
|
347
|
+
- **Touch & iPad/Android support** — Pointer Events migration; long-press (300 ms) activates tab drag; taskbar chips support hover preview and long-press context menu on touch.
|
|
348
|
+
- **8-direction resize handles** — Floating windows now have N, NE, E, SE, S, SW, W, NW resize handles.
|
|
349
|
+
- **Skin scope fix** — `data-workspace-skin` now applied to `document.documentElement` so Toolbar and Sidebar always inherit the correct skin.
|
|
297
350
|
|
|
298
351
|
### v3.0.0
|
|
299
352
|
- **`DockableDesktopProvider`** — single composite provider replaces the manual `WindowManagerProvider + PanelProvider` nesting
|
|
@@ -310,7 +363,7 @@ Create your own skin by overriding CSS custom properties under a `[data-workspac
|
|
|
310
363
|
| `bringToFront(id)` | `focusPanel(id)` — works for both floating and docked panels |
|
|
311
364
|
| `setActivePanel(id)` | `focusPanel(id)` |
|
|
312
365
|
|
|
313
|
-
Full details in the [Migration Guide](https://felipecarrillo100.github.io/react-dockable-desktop/guide/migration).
|
|
366
|
+
Full details in the [Migration Guide](https://felipecarrillo100.github.io/react-dockable-desktop/guide/migration) and the [Changelog](https://github.com/felipecarrillo100/react-dockable-desktop/releases).
|
|
314
367
|
|
|
315
368
|
---
|
|
316
369
|
|
|
@@ -333,7 +386,9 @@ Complete guides, API reference, and interactive demo at:
|
|
|
333
386
|
| [Theming](https://felipecarrillo100.github.io/react-dockable-desktop/guide/theming) | CSS variables, custom skins, dark/light modes |
|
|
334
387
|
| [Advanced Topics](https://felipecarrillo100.github.io/react-dockable-desktop/guide/advanced) | RTL, multiple workspaces, custom header actions |
|
|
335
388
|
| [Best Practices](https://felipecarrillo100.github.io/react-dockable-desktop/guide/best-practices) | Patterns for production-ready implementations |
|
|
336
|
-
| [
|
|
389
|
+
| [Panel Overlay](https://felipecarrillo100.github.io/react-dockable-desktop/guide/panel-overlay) | `PanelOverlayRoot`, panel toolbars, `PanelFloatingWindow`, `usePanelFloatingWindowManager` |
|
|
390
|
+
| [Toast Notifications](https://felipecarrillo100.github.io/react-dockable-desktop/guide/toast) | `toast` singleton, `<ToastContainer>`, queue behaviour, theming, `ToastAdapter` |
|
|
391
|
+
| [Migration Guide](https://felipecarrillo100.github.io/react-dockable-desktop/guide/migration) | Upgrade from v1 → v2 → v3 → v4 |
|
|
337
392
|
| [API Reference](https://felipecarrillo100.github.io/react-dockable-desktop/api/) | Full type-level reference for all exports |
|
|
338
393
|
|
|
339
394
|
---
|