Skip to content

Panels, Keep-Alive & Resize Events ​

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:

PropTypeDescription
viewIdstringUnique view identifier
viewSchemaRedDokiaViewSchemaActive view schema (including runtime updateView patches)
groupIdstringHost docked group or floating window ID
activebooleantrue when this tab is the active tab of its group
visiblebooleantrue when currently visible on screen (not hidden in a collapsed EdgeBar or background tab)
isFloatingbooleantrue when detached inside an in-app floating window
isPopoutbooleantrue when detached inside a native OS browser pop-out window
width / heightnumberSolved pixel dimensions of the view body
paramsTParamsCustom parameters (e.g. { entityId: 42 })
layoutStateRedDokiaLayoutStateReactive workbench state (themeId, activeGroupId, rootGrid, etc.)
geometryRedDokiaSolvedGeometryFull solved layout geometry (viewRects, groupRects, sashes)
controllerRedDokiaControllerImperative 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.

FieldTypeDescription
viewId / groupIdstringResized view and host group IDs
left / topnumberPosition relative to workbench stage (px)
width / heightnumberSolved pixel dimensions (px)
elementHTMLElement | nullPersistent 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
    }
  },
});