dockview-vue 6.0.3 → 6.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -310,7 +310,7 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
310
310
  prefixHeaderActionsComponent: {},
311
311
  tabGroupChipComponent: {}
312
312
  },
313
- emits: ["ready"],
313
+ emits: ["ready", "didDrop", "willDrop"],
314
314
  setup(__props, { emit: __emit }) {
315
315
  function extractCoreOptions(props2) {
316
316
  const coreOptions = dockviewCore.PROPERTY_KEYS_DOCKVIEW.reduce((obj, key) => {
@@ -323,6 +323,7 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
323
323
  const props = __props;
324
324
  const el = vue.ref(null);
325
325
  const instance = vue.ref(null);
326
+ const eventDisposables = [];
326
327
  dockviewCore.PROPERTY_KEYS_DOCKVIEW.forEach((coreOptionKey) => {
327
328
  vue.watch(
328
329
  () => props[coreOptionKey],
@@ -507,9 +508,15 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
507
508
  const { clientWidth, clientHeight } = el.value;
508
509
  api.layout(clientWidth, clientHeight);
509
510
  instance.value = vue.markRaw(api);
511
+ eventDisposables.push(
512
+ api.onDidDrop((event) => emit("didDrop", event)),
513
+ api.onWillDrop((event) => emit("willDrop", event))
514
+ );
510
515
  emit("ready", { api });
511
516
  });
512
517
  vue.onBeforeUnmount(() => {
518
+ eventDisposables.forEach((d) => d.dispose());
519
+ eventDisposables.length = 0;
513
520
  if (instance.value) {
514
521
  instance.value.dispose();
515
522
  }
@@ -525,6 +532,7 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
525
532
  function useViewComponent(config, props, emit) {
526
533
  const el = vue.ref(null);
527
534
  const instance = vue.ref(null);
535
+ const eventDisposables = [];
528
536
  config.propertyKeys.forEach((coreOptionKey) => {
529
537
  vue.watch(
530
538
  () => props[coreOptionKey],
@@ -589,9 +597,14 @@ function useViewComponent(config, props, emit) {
589
597
  const { clientWidth, clientHeight } = el.value;
590
598
  api.layout(clientWidth, clientHeight);
591
599
  instance.value = vue.markRaw(api);
600
+ if (config.onApiCreated) {
601
+ eventDisposables.push(...config.onApiCreated(api));
602
+ }
592
603
  emit("ready", { api });
593
604
  });
594
605
  vue.onBeforeUnmount(() => {
606
+ eventDisposables.forEach((d) => d.dispose());
607
+ eventDisposables.length = 0;
595
608
  if (instance.value) {
596
609
  instance.value.dispose();
597
610
  }
@@ -764,7 +777,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
764
777
  disableDnd: { type: Boolean },
765
778
  className: {}
766
779
  },
767
- emits: ["ready"],
780
+ emits: ["ready", "didDrop"],
768
781
  setup(__props, { emit: __emit }) {
769
782
  function extractCoreOptions(props2) {
770
783
  const coreOptions = dockviewCore.PROPERTY_KEYS_PANEVIEW.reduce((obj, key) => {
@@ -781,7 +794,10 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
781
794
  propertyKeys: dockviewCore.PROPERTY_KEYS_PANEVIEW,
782
795
  createApi: dockviewCore.createPaneview,
783
796
  createView: (id, name, component, instance) => new VuePaneviewPanelView(id, component, instance),
784
- extractCoreOptions
797
+ extractCoreOptions,
798
+ onApiCreated: (api) => [
799
+ api.onDidDrop((event) => emit("didDrop", event))
800
+ ]
785
801
  },
786
802
  props,
787
803
  emit
@@ -309,7 +309,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
309
309
  prefixHeaderActionsComponent: {},
310
310
  tabGroupChipComponent: {}
311
311
  },
312
- emits: ["ready"],
312
+ emits: ["ready", "didDrop", "willDrop"],
313
313
  setup(__props, { emit: __emit }) {
314
314
  function extractCoreOptions(props2) {
315
315
  const coreOptions = PROPERTY_KEYS_DOCKVIEW.reduce((obj, key) => {
@@ -322,6 +322,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
322
322
  const props = __props;
323
323
  const el = ref(null);
324
324
  const instance = ref(null);
325
+ const eventDisposables = [];
325
326
  PROPERTY_KEYS_DOCKVIEW.forEach((coreOptionKey) => {
326
327
  watch(
327
328
  () => props[coreOptionKey],
@@ -506,9 +507,15 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
506
507
  const { clientWidth, clientHeight } = el.value;
507
508
  api.layout(clientWidth, clientHeight);
508
509
  instance.value = markRaw(api);
510
+ eventDisposables.push(
511
+ api.onDidDrop((event) => emit("didDrop", event)),
512
+ api.onWillDrop((event) => emit("willDrop", event))
513
+ );
509
514
  emit("ready", { api });
510
515
  });
511
516
  onBeforeUnmount(() => {
517
+ eventDisposables.forEach((d) => d.dispose());
518
+ eventDisposables.length = 0;
512
519
  if (instance.value) {
513
520
  instance.value.dispose();
514
521
  }
@@ -524,6 +531,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
524
531
  function useViewComponent(config, props, emit) {
525
532
  const el = ref(null);
526
533
  const instance = ref(null);
534
+ const eventDisposables = [];
527
535
  config.propertyKeys.forEach((coreOptionKey) => {
528
536
  watch(
529
537
  () => props[coreOptionKey],
@@ -588,9 +596,14 @@ function useViewComponent(config, props, emit) {
588
596
  const { clientWidth, clientHeight } = el.value;
589
597
  api.layout(clientWidth, clientHeight);
590
598
  instance.value = markRaw(api);
599
+ if (config.onApiCreated) {
600
+ eventDisposables.push(...config.onApiCreated(api));
601
+ }
591
602
  emit("ready", { api });
592
603
  });
593
604
  onBeforeUnmount(() => {
605
+ eventDisposables.forEach((d) => d.dispose());
606
+ eventDisposables.length = 0;
594
607
  if (instance.value) {
595
608
  instance.value.dispose();
596
609
  }
@@ -763,7 +776,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
763
776
  disableDnd: { type: Boolean },
764
777
  className: {}
765
778
  },
766
- emits: ["ready"],
779
+ emits: ["ready", "didDrop"],
767
780
  setup(__props, { emit: __emit }) {
768
781
  function extractCoreOptions(props2) {
769
782
  const coreOptions = PROPERTY_KEYS_PANEVIEW.reduce((obj, key) => {
@@ -780,7 +793,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
780
793
  propertyKeys: PROPERTY_KEYS_PANEVIEW,
781
794
  createApi: createPaneview,
782
795
  createView: (id, name, component, instance) => new VuePaneviewPanelView(id, component, instance),
783
- extractCoreOptions
796
+ extractCoreOptions,
797
+ onApiCreated: (api) => [
798
+ api.onDidDrop((event) => emit("didDrop", event))
799
+ ]
784
800
  },
785
801
  props,
786
802
  emit
@@ -310,7 +310,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
310
310
  prefixHeaderActionsComponent: {},
311
311
  tabGroupChipComponent: {}
312
312
  },
313
- emits: ["ready"],
313
+ emits: ["ready", "didDrop", "willDrop"],
314
314
  setup(__props, { emit: __emit }) {
315
315
  function extractCoreOptions(props2) {
316
316
  const coreOptions = dockviewCore.PROPERTY_KEYS_DOCKVIEW.reduce((obj, key) => {
@@ -323,6 +323,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
323
323
  const props = __props;
324
324
  const el = vue.ref(null);
325
325
  const instance = vue.ref(null);
326
+ const eventDisposables = [];
326
327
  dockviewCore.PROPERTY_KEYS_DOCKVIEW.forEach((coreOptionKey) => {
327
328
  vue.watch(
328
329
  () => props[coreOptionKey],
@@ -507,9 +508,15 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
507
508
  const { clientWidth, clientHeight } = el.value;
508
509
  api.layout(clientWidth, clientHeight);
509
510
  instance.value = vue.markRaw(api);
511
+ eventDisposables.push(
512
+ api.onDidDrop((event) => emit("didDrop", event)),
513
+ api.onWillDrop((event) => emit("willDrop", event))
514
+ );
510
515
  emit("ready", { api });
511
516
  });
512
517
  vue.onBeforeUnmount(() => {
518
+ eventDisposables.forEach((d) => d.dispose());
519
+ eventDisposables.length = 0;
513
520
  if (instance.value) {
514
521
  instance.value.dispose();
515
522
  }
@@ -525,6 +532,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
525
532
  function useViewComponent(config, props, emit) {
526
533
  const el = vue.ref(null);
527
534
  const instance = vue.ref(null);
535
+ const eventDisposables = [];
528
536
  config.propertyKeys.forEach((coreOptionKey) => {
529
537
  vue.watch(
530
538
  () => props[coreOptionKey],
@@ -589,9 +597,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
589
597
  const { clientWidth, clientHeight } = el.value;
590
598
  api.layout(clientWidth, clientHeight);
591
599
  instance.value = vue.markRaw(api);
600
+ if (config.onApiCreated) {
601
+ eventDisposables.push(...config.onApiCreated(api));
602
+ }
592
603
  emit("ready", { api });
593
604
  });
594
605
  vue.onBeforeUnmount(() => {
606
+ eventDisposables.forEach((d) => d.dispose());
607
+ eventDisposables.length = 0;
595
608
  if (instance.value) {
596
609
  instance.value.dispose();
597
610
  }
@@ -764,7 +777,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
764
777
  disableDnd: { type: Boolean },
765
778
  className: {}
766
779
  },
767
- emits: ["ready"],
780
+ emits: ["ready", "didDrop"],
768
781
  setup(__props, { emit: __emit }) {
769
782
  function extractCoreOptions(props2) {
770
783
  const coreOptions = dockviewCore.PROPERTY_KEYS_PANEVIEW.reduce((obj, key) => {
@@ -781,7 +794,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
781
794
  propertyKeys: dockviewCore.PROPERTY_KEYS_PANEVIEW,
782
795
  createApi: dockviewCore.createPaneview,
783
796
  createView: (id, name, component, instance) => new VuePaneviewPanelView(id, component, instance),
784
- extractCoreOptions
797
+ extractCoreOptions,
798
+ onApiCreated: (api) => [
799
+ api.onDidDrop((event) => emit("didDrop", event))
800
+ ]
785
801
  },
786
802
  props,
787
803
  emit
@@ -1,10 +1,12 @@
1
1
  import { type ComponentInternalInstance } from 'vue';
2
+ import type { DockviewIDisposable } from 'dockview-core';
2
3
  export interface ViewComponentConfig<TApi, TOptions, TProps, TEvents, TView, TFrameworkOptions> {
3
4
  componentName: string;
4
5
  propertyKeys: readonly (keyof TOptions)[];
5
6
  createApi: (element: HTMLElement, options: TOptions & TFrameworkOptions) => TApi;
6
7
  createView: (id: string, name: string | undefined, component: any, instance: ComponentInternalInstance) => TView;
7
8
  extractCoreOptions: (props: TProps) => TOptions;
9
+ onApiCreated?: (api: TApi) => DockviewIDisposable[];
8
10
  }
9
11
  export declare function useViewComponent<TApi extends {
10
12
  dispose(): void;
@@ -1,7 +1,11 @@
1
1
  import type { IDockviewVueProps } from './types';
2
2
  declare const _default: import("vue").DefineComponent<IDockviewVueProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
3
  ready: (event: import("dockview-core").DockviewReadyEvent) => any;
4
+ didDrop: (event: import("dockview-core").DockviewDidDropEvent) => any;
5
+ willDrop: (event: import("dockview-core").DockviewWillDropEvent) => any;
4
6
  }, string, import("vue").PublicProps, Readonly<IDockviewVueProps> & Readonly<{
5
7
  onReady?: (event: import("dockview-core").DockviewReadyEvent) => any;
8
+ onDidDrop?: (event: import("dockview-core").DockviewDidDropEvent) => any;
9
+ onWillDrop?: (event: import("dockview-core").DockviewWillDropEvent) => any;
6
10
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
11
  export default _default;
@@ -1,4 +1,4 @@
1
- import { type DockviewOptions, type DockviewReadyEvent } from 'dockview-core';
1
+ import { type DockviewDidDropEvent, type DockviewOptions, type DockviewReadyEvent, type DockviewWillDropEvent } from 'dockview-core';
2
2
  export interface VueProps {
3
3
  watermarkComponent?: string;
4
4
  defaultTabComponent?: string;
@@ -9,5 +9,7 @@ export interface VueProps {
9
9
  }
10
10
  export type VueEvents = {
11
11
  ready: [event: DockviewReadyEvent];
12
+ didDrop: [event: DockviewDidDropEvent];
13
+ willDrop: [event: DockviewWillDropEvent];
12
14
  };
13
15
  export type IDockviewVueProps = DockviewOptions & VueProps;
@@ -1,7 +1,9 @@
1
1
  import type { IPaneviewVueProps } from './types';
2
2
  declare const _default: import("vue").DefineComponent<IPaneviewVueProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
3
  ready: (event: import("./types").PaneviewReadyEvent) => any;
4
+ didDrop: (event: import("dockview-core").PaneviewDropEvent) => any;
4
5
  }, string, import("vue").PublicProps, Readonly<IPaneviewVueProps> & Readonly<{
5
6
  onReady?: (event: import("./types").PaneviewReadyEvent) => any;
7
+ onDidDrop?: (event: import("dockview-core").PaneviewDropEvent) => any;
6
8
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
9
  export default _default;
@@ -1,4 +1,4 @@
1
- import type { PaneviewApi, PaneviewOptions, PaneviewPanelApi } from 'dockview-core';
1
+ import type { PaneviewApi, PaneviewDropEvent, PaneviewOptions, PaneviewPanelApi } from 'dockview-core';
2
2
  export interface PaneviewReadyEvent {
3
3
  api: PaneviewApi;
4
4
  }
@@ -13,4 +13,5 @@ export interface IPaneviewVueProps extends PaneviewOptions {
13
13
  }
14
14
  export type PaneviewVueEvents = {
15
15
  ready: [event: PaneviewReadyEvent];
16
+ didDrop: [event: PaneviewDropEvent];
16
17
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dockview-vue",
3
- "version": "6.0.3",
3
+ "version": "6.0.6",
4
4
  "description": "Vue 3 docking layout manager — tabs, groups, grids, splitviews, drag and drop, floating panels",
5
5
  "keywords": [
6
6
  "splitview",
@@ -67,7 +67,7 @@
67
67
  "format:check": "prettier --check 'src/**/*.{ts,tsx,js,jsx,vue}'"
68
68
  },
69
69
  "dependencies": {
70
- "dockview-core": "^6.0.3"
70
+ "dockview-core": "^6.0.6"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "vue": "^3.4.0"