npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@affino/dockview-vue

v0.2.3

Published

Vue 3 workspace layout and docking components for Affino

Readme

@affino/dockview-vue

Vue 3 presentation components for @affino/dockview-core.

pnpm add @affino/dockview-core @affino/dockview-vue vue

Import the stylesheet once in the application entry point. The Vue package declares Vue ^3.3.0 as a peer dependency and Core ^0.1.0 as its runtime dependency.

import { AffinoSplitView, AffinoDockview } from "@affino/dockview-vue"
import "@affino/dockview-vue/style.css"

Complete registered workspace

The Core owns serializable placement and commands; the application owns the component map, initial layout, close policy, and persistence destination. The example below uses a realistic three-column editor workspace. Panel instance IDs are distinct from reusable component definitions.

<script setup lang="ts">
import { defineComponent, h } from "vue"
import { createDockviewEngine } from "@affino/dockview-core"
import { AffinoDockview, type DockviewPanelComponents } from "@affino/dockview-vue"
import "@affino/dockview-vue/style.css"

const engine = createDockviewEngine({
  panels: [
    { id: "explorer", title: "Explorer", closable: false, movable: false },
    { id: "document:42", type: "document", title: "Network Model", dirty: true },
    { id: "document:43", type: "document", title: "Protection Study" },
    { id: "inspector", title: "Inspector", collapsible: true, maximizable: true },
    { id: "chat", title: "Chat" },
  ],
  layout: {
    version: 1,
    root: {
      id: "workspace",
      type: "split",
      axis: "x",
      children: [
        { id: "explorer-group", type: "tabs", panelIds: ["explorer"], activePanelId: "explorer" },
        { id: "editor-group", type: "tabs", panelIds: ["document:42", "document:43"], activePanelId: "document:42" },
        { id: "inspector-group", type: "tabs", panelIds: ["inspector", "chat"], activePanelId: "inspector" },
      ],
      sizes: [
        { mode: "fixed", value: 260, min: 180, max: 420 },
        { mode: "flex", value: 1, min: 320 },
        { mode: "fixed", value: 340, min: 240, max: 520 },
      ],
    },
  },
})

const panel = (name: string) => defineComponent({ setup: () => () => h("section", name) })
const panelComponents: DockviewPanelComponents = {
  explorer: panel("Project files"),
  "document:42": panel("Network Model editor"),
  "document:43": panel("Protection Study editor"),
  inspector: panel("Selection properties"),
  chat: panel("Workspace chat"),
}

const beforeClose = async (panelId: string) => {
  // Ask the application document/session layer about unsaved work here.
  return panelId !== "document:42" || window.confirm("Close the Network Model editor?")
}

const savedLayout = () => localStorage.setItem("workspace-layout", engine.serialize())
const restoreLayout = () => {
  const value = localStorage.getItem("workspace-layout")
  if (value) engine.restore(value)
}
</script>

<template>
  <div class="application-workspace">
    <AffinoDockview
      workspace-id="engineering-workspace"
      :engine="engine"
      :panels="panelComponents"
      :before-close="beforeClose"
      :render-policies="{ 'chat': 'lazy' }"
      @layout-change="savedLayout"
    >
      <template #headerActions="actions">
        <button v-if="actions.collapsed" type="button" :aria-label="`Expand ${actions.groupId}`" @click="actions.expand()">Expand</button>
        <button v-else-if="actions.canCollapse" type="button" :aria-label="`Collapse ${actions.groupId}`" @click="actions.collapse(28)">Collapse</button>
        <button v-if="actions.maximized" type="button" aria-label="Restore workspace" @click="actions.restore()">Restore</button>
        <button v-else-if="actions.canMaximize" type="button" :aria-label="`Maximize ${actions.groupId}`" @click="actions.maximize()">Maximize</button>
      </template>
    </AffinoDockview>
    <button type="button" @click="restoreLayout">Restore saved layout</button>
  </div>
</template>

Register panel definitions before restoring a saved layout. The same component can be mapped to multiple IDs, with each ID preserving its own runtime instance and application resource identity. The headerActions slot receives group identity, current state, eligibility flags, and callbacks; controls remain consumer-owned.

AffinoSplitView takes axis="x" | "y" and pane descriptors with a stable id, optional size: { mode: "fixed", value: 260, min: 180, max: 420 } or size: { mode: "flex", value: 1 }, optional cross-axis panel constraints, and content. The slot form uses AffinoSplitPane with the same id and size object. Fixed value is preferred pixels; flex value is a unitless weight. Min/max values are pixels in the split's axis. It measures its own container with ResizeObserver, renders Core-resolved geometry, and supports pointer resizing with preview/commit separation, Escape and pointer cancellation, and arrow resizing (10 px; Shift+arrows 50 px). It emits one layout-change after a committed mutation. Its component ref exposes engine, setPreferredSize, resizeChild, equalize, and reset.

The visible splitter thickness and hit target are independently customizable with --affino-splitter-size / splitterSize and splitterHitSize. Color hooks include --affino-splitter-color, --affino-splitter-hover, --affino-splitter-active, and --affino-splitter-focus. Keyboard resizing is disabled for handles adjacent to a size spec with resizable: false.

AffinoDockview takes a Core engine and a panel component map keyed by panel instance ID. It uses pointer activation on tab headers (5 px default threshold), supports tab reordering and center/left/right/top/bottom docking, and uses Core getDockCandidate / commitDockCandidate for preview and commit. The committed DOM remains the hit-test surface during a drag; the preview rectangle comes from the candidate's Core resolution, so speculative layout changes cannot move drop targets under the pointer. Pointer release outside the scoped workspace, Escape, pointer cancellation, stale Core state, or disposal cancels the gesture. workspaceId identifies the local boundary; nested instances only target zones inside their own root. Candidate splitters reuse the Core sizing model and remain keyboard/pointer resizable. The component exposes the Core engine and cancelDock; it emits layout-change for committed engine changes and dock-rejected with the reason for rejected drops.

During a drag, the hovered group shows a compact five-direction indicator. The center + means add to that tab group; the arrows mean split on that edge. Large transparent hit zones remain for pointer tolerance, while only the hovered direction is highlighted. Core-rejected directions are muted and dashed; the active rejected direction uses the invalid color and never renders a valid placement preview. Directional previews use the target panel group's exact rectangle from getDockCandidate(...).resolved. Center docking does not shade the whole target group: it marks the actual before/after tab insertion point, or the end of the tab list when dropping into the center area. Existing tab reordering markers are unchanged.

Tab-group presentation actions use the same engine commands as application controls: collapseRegion(groupId, size?), expandRegion(groupId), maximizeGroup(groupId), and restorePresentation(). The default headerActions controls expose collapse/expand and maximize/restore. Supply a scoped headerActions slot to render application controls; its immutable object provides groupId, collapsed, maximized, eligibility flags, and callbacks. collapsedSize sets the default rail content size (28 px); pass zero to collapse to zero content size. Zero-size regions can always be recovered through a consumer control or engine command. Maximize hides sibling groups without deactivating their tabs or discarding canonical layout mutations. Collapse and maximize retain panel hosts according to the existing render policy.

Group headers are visible by default. Set showGroupHeaders="false" to omit headers and give each panel host the full resolved group height. A tab-group layout node can override this default with the serializable showHeader: true | false field; group.showHeader ?? showGroupHeaders determines visibility. Hidden headers have no tab, action, or overflow controls in the DOM, and their drop zones use the full group bounds.

The scoped groupHeader slot replaces the default header content whenever that group's header is visible. It receives groupId, readonly panelIds, reactive activePanelId, actions, tab descriptors, and tablistProps. Each tab descriptor includes stable panelId, current title/state, activate(), close(), and typed bindings for a native button. Bind tablistProps to the tablist and tab.bindings to each tab button to retain tab semantics, keyboard activation, and drag/drop hit testing. Use tab.close() to keep the normal close guard and close request behavior. actions provides collapse, expand, maximize, and restore callbacks. When groupHeader is supplied, headerActions is not rendered or invoked; render controls from actions in the custom header instead. Without groupHeader, the current default header remains unchanged and headerActions continues to replace only its action controls.

<AffinoDockview :engine="engine" :panels="panels">
  <template #groupHeader="header">
    <div class="affino-dock-tabs" v-bind="header.tablistProps">
      <button v-for="tab in header.tabs" :key="tab.panelId" v-bind="tab.bindings">
        {{ tab.title }}
      </button>
    </div>
    <button type="button" @click="header.actions.maximize()">Maximize</button>
  </template>
</AffinoDockview>

Custom headers own their visual markup and must bind the supplied tab props to preserve built-in interactions. Their content is hosted in the normal 30 px group-header strip; the slot does not change Dockview's layout topology or panel instance ownership.

Panel component vnodes use stable instance keys and live as keyed hosts in the Dockview root rather than under group subtrees, so moving a panel between groups does not reparent its component. renderPolicies is a runtime-only map keyed by panel instance ID: eager (default) mounts every open panel and retains it while open; lazy mounts on first activation and retains it while open; active-only mounts only the active tab and disposes on deactivation. Closing disposes the Vue host. Reopening mounts a fresh component instance. Resizing, tab reorder, and docking do not remount retained hosts.

Panel definitions can be changed through the Core engine's registerPanel, updatePanelMetadata, and unregisterPanel methods. The panels prop maps panel instance IDs to Vue components; multiple IDs may map to the same component definition. title, icon, accessibleLabel, dirty, disabled, and closable are presentation metadata. Dirty state remains application-owned. Metadata updates rerender headers without recreating panel content. An open definition cannot be unregistered; close it first.

Tab headers remain horizontally scrollable. The accessible “All tabs” native selector provides activation for every tab at narrow widths, including clipped tabs, and scrolls the selected header into view; its adjacent close action closes the selected tab. Disabled metadata prevents activation through both UI and Core commands. Dragging is supported from visible tab headers; the selector itself is not a drag source. The component accepts an optional async beforeClose(panelId) guard for UI close requests and emits close-request. Repeated requests for the same panel are ignored; rejection leaves layout/content intact. Accepted results are applied to that original panel ID, and pending requests are invalidated if that panel closes or the workspace is disposed. Direct Core closePanel commands remain explicit application-authorized operations and do not invoke the UI guard.

Applications own the component registry and persistence; use engine.serialize(), engine.restore(value), and engine.reset() directly. Serialized state version 2 wraps the canonical v1 layout with collapsed-region preferences; legacy raw v1 layouts remain accepted. Maximization is transient. Definitions must be registered before restoration to retain their panel placements; unavailable panel IDs are removed and later registration does not automatically open them. User-facing reset actions that may close panels remain application-owned and should run through the application's close guards.

CSS properties include --affino-splitter-size, --affino-splitter-color, --affino-splitter-hover, --affino-splitter-active, --affino-splitter-focus, --affino-dock-tab-height, --affino-dock-tab-gap, --affino-dock-tab-max-width, --affino-dock-tab-insertion, --affino-dock-active-tab, --affino-dock-border, --affino-dock-panel-background, --affino-dock-drop-zone, --affino-dock-drop-active, --affino-dock-drop-invalid, --affino-dock-drop-indicator-background, --affino-dock-drop-indicator-color, --affino-dock-drop-indicator-border, --affino-dock-drop-indicator-active-color, --affino-dock-drop-indicator-unavailable-background, --affino-dock-drop-indicator-unavailable-color, --affino-dock-preview-border, --affino-dock-preview-background, --affino-dock-drag-background, and --affino-dock-drag-border.

Each SplitView owns an independent Core engine; nested Dockview instances have independent pointer target scopes. AffinoDockview provides layout-change and dock-rejected events plus the engine's typed command surface for keyboard-accessible application actions. Docking into a collapsed group, directional docking while maximized, and split resizing while maximized are rejected. Center docking into the maximized group and opening an unassigned panel into it are supported. Reset remains an explicit application operation. The dedicated browser acceptance measures presentation changes and checks panel host identity/mount counts. See the Dockview infrastructure audit for current milestone status.

Keyboard and theme hooks

The native tab buttons support left/right arrows plus Home/End, and the all-tabs selector is keyboard-operable using native select behavior. Split separators expose role="separator", orientation and size values; aria-disabled, focusability, pointer handling, and keyboard handling share the same resize eligibility. A separator is disabled when either adjacent region is collapsed or is a split with no visible descendant groups. Arrow keys resize by 10 px, or 50 px with Shift. Focus-visible styles are included. Collapse/maximize controls are ordinary buttons and can be replaced or augmented through the header slot. The consumer should keep a visible application-level path to expand a zero-size collapsed region.

The stylesheet provides --affino-* custom properties for splitter geometry/colors, tab sizing and active state, group/panel surfaces, drag/drop zones, previews, and focus. Set them on the Dockview or an ancestor to supply light/dark themes; no theme or z-index scale is imposed.

Compatibility and unsupported features

Layout persistence is delegated to Core. The version 2 serialized wrapper adds collapsed preferences around the stable version 1 tree; version 1 raw layouts still restore. Maximize, Vue component instances, close requests, drag state, and measured bounds are transient. Missing registered panel definitions are removed and normalized during restore. beforeClose applies to UI close requests only; direct Core close/replace/reset commands are application-authorized and bypass it. Route reset and destructive application actions through the same application close guard.

This release does not provide floating windows, cross-window or cross-workspace docking, multi-monitor layouts, remote persistence, or application document/unsaved-state management. Overflow activation and close are supported for clipped tabs; drag begins from visible tab headers, not from the native overflow selector.