fix(dockview-vue): accept components via prop (resolves #1301)#1302
Open
mathuo wants to merge 2 commits into
Open
fix(dockview-vue): accept components via prop (resolves #1301)#1302mathuo wants to merge 2 commits into
mathuo wants to merge 2 commits into
Conversation
…r API Adds `components` and `tabComponents` map props to <DockviewVue>, and lets singular slot props (defaultTabComponent, watermarkComponent, *HeaderActions, chip, ghost) take a component object directly. Resolves issue #1301 where <script setup> users were forced to register every panel component globally via app.component() because findComponent only walked the instance tree and app registry. Fully additive — existing Options-API and global-registry registration paths still work. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
componentsandtabComponentsmap props to<DockviewVue>, and lets every singular slot prop (defaultTabComponent,watermarkComponent,*HeaderActionsComponent,tabGroupChipComponent,groupDragGhostComponent) accept a component object directly — matching the React (packages/dockview/src/dockview/dockview.tsx) and Angular (packages/dockview-angular/src/lib/dockview/types.ts) APIs.main.tsto find the component to render in the panel #1301:<script setup>users were forced to register every panel component globally viaapp.component(...)inmain.ts, becausefindComponentonly walked the instance-component tree and the app registry — neither of which<script setup>imports populate. Now<DockviewVue :components="{ Foo: MyFoo }" />works without any global registration.app.component(...)paths still resolve as before.defaultTabComponentas a component object uses aDEFAULT_VUE_TABsentinel routed throughcreateTabComponent, mirroring React'sDEFAULT_REACT_TAB.components: Record<string, string>on splitview/gridview/paneview types (nowRecord<string, VueComponent>and actually wired throughuseViewComponent).Test plan
yarn workspace dockview-vue run test --runvue-tsctype check clean —yarn workspace dockview-vue run build:typesfindComponentmap-priority/fallthrough/error paths,resolveComponentall branches,<DockviewVue>with barecomponentsprop (no global registration),tabComponentsmap, every singular slot prop accepting a component object, sentinel routing fordefaultTabComponent, runtime map swap, equivalent coverage for splitview/gridview/paneview<script setup>app to confirm the reporter's scenario (recommended before merge)packages/docs/docs/core/panels/register.mdx,packages/docs/docs/overview/quickstart.mdxrewritten to show the new<script setup>+:componentspattern)Fixes #1301
🤖 Generated with Claude Code