Panels, Keep-Alive & Resize Events
Live Examples
1. Keep-Alive (DOM Reparenting)
Each view keeps a persistent host DOM (div.rd-view-host) that is reparented without unmounting across splits, floating windows, and pop-outs (using Element.moveBefore() when supported).
text
[div.rd-view-host (mounted once · React Portal / Vue Teleport / Svelte mount)]
│
├──▶ Docked Split Group (DOM reparented · 0 unmounts)
├──▶ Floating Window (DOM reparented · 0 unmounts)
└──▶ OS Browser Pop-out (adopted node · 0 unmounts)Zero State Loss
React/Vue/Svelte component state, WebGPU/WebGL canvases, video playback, and form inputs survive splits, floating tear-offs, and multi-monitor pop-out roundtrips without unmounting.
2. View Render Props (RedDokiaViewRenderProps)
Every view component receives these props:
| Prop | Type | Description |
|---|---|---|
viewId | string | Unique view identifier |
viewSchema | RedDokiaViewSchema | Active view schema (including runtime updateView patches) |
groupId | string | Host docked group or floating window ID |
active | boolean | true when this tab is the active tab of its group |
visible | boolean | true when currently visible on screen (not hidden in a collapsed EdgeBar or background tab) |
isFloating | boolean | true when detached inside an in-app floating window |
isPopout | boolean | true when detached inside a native OS browser pop-out window |
width / height | number | Solved pixel dimensions of the view body |
params | TParams | Custom parameters (e.g. { entityId: 42 }) |
layoutState | RedDokiaLayoutState | Reactive workbench state (themeId, activeGroupId, rootGrid, etc.) |
geometry | RedDokiaSolvedGeometry | Full solved layout geometry (viewRects, groupRects, sashes) |
controller | RedDokiaController | Imperative workbench controller |
3. Dynamic Parameterized Views (templateId + params)
Register a template view once and spawn parameterized instances at runtime:
ts
controller.openView('entity-dragon', {
templateId: 'entity-detail',
title: 'Dragon Boss',
params: { entityId: 'dragon', hp: 9999 },
});4. External Resize Events (onViewResize)
Fires once per frame with a viewId-keyed map (Readonly<Record<string, RedDokiaResizeEvent>>) for resized visible views, including each view's host DOM element.
| Field | Type | Description |
|---|---|---|
viewId / groupId | string | Resized view and host group IDs |
left / top | number | Position relative to workbench stage (px) |
width / height | number | Solved pixel dimensions (px) |
element | HTMLElement | null | Persistent div.rd-view-host DOM element (works in docked, floating, and pop-out windows) |
tsx
<RedDokia
views={views}
layout={layout}
onViewResize={(events) => {
const evt = events['live-canvas'];
if (!evt) return;
const canvas = evt.element?.querySelector('canvas');
// Sync WebGPU / chart viewport with evt.width, evt.height, or canvas.clientWidth
}}
/>vue
<template>
<RedDokia
:views="views"
:layout="layout"
@view-resize="(events) => handleResize(events)"
/>
</template>svelte
<RedDokia
views={views}
layout={layout}
onViewResize={(events) => handleResize(events)}
/>ts
const dock = new RedDokia(container, {
views,
layout,
onViewResize(events) {
const evt = events['live-canvas'];
if (evt?.element) {
const canvas = evt.element.querySelector('canvas');
// Resize external renderer cleanly
}
},
});