Changelog
Source:NEWS.md
dockViewR (development version)
Breaking changes
-
move_panel()now places the moved panel with the samepositionvocabulary asadd_panel()andpanel()— a list carrying areferencePanelorreferenceGroupplus adirection(one of “above”, “below”, “left”, “right”, “within”) and an optionalindex— replacing the previous scalarposition/group/indexarguments. Server-side callers can now express “move panel X next to panel Y” with the same placement grammar they use to add panels.
New features
- Added
set_size()to resize the group a panel belongs to from the server. The caller gives a single target fraction of the group’s splitview along its axis; the other groups in that split keep their relative sizes and share the remaining space.
Bug fixes
input$<dock_id>_stateis now emitted once per layout gesture rather than on everyonDidLayoutChangeframe. The per-frame stream was the source of theonDidLayoutChange → resize → onDidLayoutChangefeedback loop that pegged the main thread on boards with many resize-sensitive widgets (e.g. ECharts); the layout-tolerance heuristic that previously absorbed its sub-pixel echo is gone. Each discrete gesture (panel add / remove / move, group add / remove, active panel / group change, maximize, restore, and the pointer-up that ends a sash drag) coalesces into a single update, so a compound gesture that fires several dockview events still emits one settled_statecarrying the final layout — consumers no longer need to debounce the burst themselves. Widget re-fit is likewise driven off the gestures, not the layout stream. The initial layout is captured once; a container / window resize has no gesture boundary, so it is debounced and persisted once it settles, so_statealways reflects the live dock.input$<dock_id>_state-sourcetags that resize update"client"(environmental, not server-initiated).Upgrade the bundled
dockview-coreto 4.13.1, which carries the upstream fix for panel content not rendering when a panel is dragged to an extreme drop target: https://github.com/mathuo/dockview/issues/1031.
dockViewR 0.3.0
CRAN release: 2025-12-06
Breaking changes
In the previous API, we relied on input$<dock_id>_state to perform checks on panel ids but this was no reliable. For instance, calling add_panel() in an observeEvent(), the state was not up to date as you had to wait for the next reactive flush to get an update of the input. This lead to unconvenient workarounds when manipulating the dock from the server. Now, checks are performed UI side an raise JS warnings in the console and optionally Shiny notification when options(dockViewR.mode = "dev").
- Added
dock_view_proxy()to create a reactive proxy to a dock instance. -
add_panel()dock_idparameter is changed todock. It now expects a dock proxy created withdock_view_proxy(). This is to be more consistent with other htmlwidgets. Same applies forremove_panel(),select_panel()andmove_panel(). -
dock_state()and all related functions also expect a dock proxy created withdock_view_proxy(). -
update_dock_view()also relies ondock_view_proxy(). - All proxy method return the dock invisibly so you can chain calls.
We reworked the infrastructure around adding and removing tabs using new_add_tab_plugin() and new_remove_tab_plugin(). See the updated documentation for more details. This also impacts the way add_tab and remove parameters are used in dock_view() and panel() respectively, which weren’t very safe in the previous API.
New features
- Add
set_panel_title()to change the title of a panel from the server of a Shiny app. - Add new
input[["<dock_ID>_n-panels"]],input[["<dock_ID>_n-groups"]],input[["<dock_ID>_active-panel"]],input[["<dock_ID>_active-group"]]as subset ofinput[["<dock_ID>_state"]]. Priority is normal so any observer listening to those input won’t trigger when there is no change in the layout. - Add new
input[["<dock_ID>_restored"]]as a callback when the dock get restored after callingrestore_dock(). - Add new
input[["<dock_ID>_state-source"]], emitted alongside everyinput[["<dock_ID>_state"]]update to report what produced the change:"server"when R drove the dock — the initial render, or a proxy call (restore_dock(),add_panel(),remove_panel(),move_panel(),move_group(),move_group2(),select_panel(),set_panel_title()), including the proxy call your server makes in response to the built-in add (+) and close (x) tab buttons, which round-trip through Shiny — and"client"when the widget changed its own layout directly, such as a user drag, sash resize, or tab activation. An app that mirrors_stateback into server-side layout state can use this to ignore its own echoes instead of feeding a restore/reconcile loop (#70). Attribution is causal (a flag carried across dockview’s microtask-batchedonDidLayoutChange), not time-based. - Fix #53: Added
get_active_views()], a convenience function that returns the active view in each group andget_active_panel()], another convenience function that returns the active panel in the active group. - Allow initialising a dock with no panels (default to
list()). - Added
input[["<dock_ID>_initialized"]]within anonRendercallback. Allows to track when the dock is ready to perform actions server side. - In
add_panel(): if noreferencePanelorreferenceGroupis provided, the panel is added relative to the container. - Fix:
get_groups_ids()now correctly returns all group ids (nested groups were not returned). - Fix #52: Reworked
add_tabparameter indock_view(). By default, there is adefault_add_tab_callback()that setsinput[["<dock_ID>_panel-to-add"]], so you can create observers with custom logic, including removing the panel withadd_panel(). An example of usage is available at https://github.com/cynkra/dockViewR/blob/main/inst/examples/add_panel/app.R. - Fix: typo in
abyss-spacedtheme caused the theme not to be applied. - Fix: options in
...were not passed to the dockview JS constructor. (:clown:) - Fix #48: dock state is saved before panels are added.
- Remove unecessary content in saved JSON state (dependencies, head, singletons). They should already be present in the app when initialising the graph.
- Fix: update input layout state when layout is restored.
- Added
styleparameter topanel(). This allows to customize the style of the panel container. It expects a named list with CSS properties and values. We kept old default values for backward compatibility, but you can now overwrite them. - Upgrade dockview JS to 4.10.0. Fix Windows shaking issue: https://github.com/mathuo/dockview/issues/988.
dockViewR 0.2.0
CRAN release: 2025-07-10
- Bump dockview JS to 4.4.0.
- Add
update_dock_view()to update a dock instance from the server of a Shiny app. - Add
input[["<dock_ID>_added-panel"]]to track which panel has been added. This can be useful in a shiny app context. - Add
input[["<dock_ID>_removed-panel"]]to track which panel has been removed. This can be useful in a shiny app context. - Add
select_panel()function to select a specific panel by id from the server. - Add
removeparameter toadd_panel()to allow panels to be removable or not. It expects a list with two fields: enable and mode. Enable is a boolean (default to FALSE) and mode is one ofmanual,auto(default to auto). In auto mode, dockview JS removes the panel when it is closed and all its content. If you need more control over the panel removal, set it to manual. Doing so, clicking on remove triggers a custom input on the server side,input[["<dock_ID>_panel-to-remove"]], so you can create observers with custom logic, including removing the panel withremove_panel(). An example of usage is available at https://github.com/cynkra/dockViewR/blob/main/inst/examples/add_panel/app.R. - Add
add_tabparameter todock_view()to allow controlling the add tab behavior. By default, it is disabled. You can activate it by passinglist(enable = TRUE). By default, a JS callback inserts a panel into the dock with instructions on how to overwrite it by content created from the server of a Shiny app. This control is global, that is, you can’t have panel for which add_tab is enabled and another for which it is disabled due to constraints imposed by the JS api.