dockview-vue 5.2.0 → 6.0.0

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.
package/README.md CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
  ##
18
18
 
19
- ![](https://github.com/mathuo/dockview/blob/HEAD/packages/docs/static/img/splashscreen.gif?raw=true)
19
+ ![](https://github.com/mathuo/dockview/blob/HEAD/packages/docs/static/img/splashscreenv2.png?raw=true)
20
20
 
21
21
  Please see the website: https://dockview.dev
22
22
 
@@ -28,6 +28,8 @@ Please see the website: https://dockview.dev
28
28
  - Tab and Group docking / Drag n' Drop
29
29
  - Popout Windows
30
30
  - Floating Groups
31
+ - Edge Groups
32
+ - Tab Groups
31
33
  - Extensive API
32
34
  - Supports Shadow DOMs
33
35
  - High test coverage
@@ -1,10 +1,7 @@
1
1
  "use strict";
2
2
  var __defProp = Object.defineProperty;
3
3
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
- var __publicField = (obj, key, value) => {
5
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
- return value;
7
- };
4
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
8
5
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
9
6
  const dockviewCore = require("dockview-core");
10
7
  const vue = require("vue");
@@ -157,6 +154,9 @@ class VueHeaderActionsRenderer extends AbstractVueRenderer {
157
154
  }),
158
155
  props.api.onDidActiveChange(() => {
159
156
  this.updateProps();
157
+ }),
158
+ props.api.onDidLocationChange((event) => {
159
+ this.updateLocation(event.location);
160
160
  })
161
161
  );
162
162
  (_a = this._renderDisposable) == null ? void 0 : _a.dispose();
@@ -179,13 +179,75 @@ class VueHeaderActionsRenderer extends AbstractVueRenderer {
179
179
  activePanel: this.group.model.activePanel,
180
180
  isGroupActive: this.group.api.isActive,
181
181
  group: this.group,
182
- headerPosition: this.group.model.headerPosition
182
+ headerPosition: this.group.model.headerPosition,
183
+ location: this.group.api.location
183
184
  };
184
185
  }
185
186
  updateProps() {
186
187
  var _a;
187
188
  (_a = this._renderDisposable) == null ? void 0 : _a.update({ params: this.buildEnrichedProps() });
188
189
  }
190
+ updateLocation(location) {
191
+ var _a;
192
+ (_a = this._renderDisposable) == null ? void 0 : _a.update({ params: { location } });
193
+ }
194
+ }
195
+ class VueContextMenuItemRenderer extends AbstractVueRenderer {
196
+ constructor() {
197
+ super(...arguments);
198
+ __publicField(this, "_renderDisposable");
199
+ }
200
+ init(props) {
201
+ var _a;
202
+ (_a = this._renderDisposable) == null ? void 0 : _a.dispose();
203
+ this._renderDisposable = mountVueComponent(
204
+ this.component,
205
+ this.parent,
206
+ { params: props },
207
+ this.element
208
+ );
209
+ }
210
+ dispose() {
211
+ var _a;
212
+ (_a = this._renderDisposable) == null ? void 0 : _a.dispose();
213
+ }
214
+ }
215
+ class VueTabGroupChipRenderer extends AbstractVueRenderer {
216
+ constructor(component, parent) {
217
+ super(component, parent);
218
+ __publicField(this, "_renderDisposable");
219
+ this.element.style.height = "";
220
+ this.element.style.width = "";
221
+ this.element.style.display = "inline-flex";
222
+ }
223
+ get element() {
224
+ return this._element;
225
+ }
226
+ init(params) {
227
+ var _a;
228
+ (_a = this._renderDisposable) == null ? void 0 : _a.dispose();
229
+ this._renderDisposable = mountVueComponent(
230
+ this.component,
231
+ this.parent,
232
+ {
233
+ params: {
234
+ tabGroup: params.tabGroup,
235
+ api: params.api
236
+ }
237
+ },
238
+ this.element
239
+ );
240
+ }
241
+ update(params) {
242
+ var _a;
243
+ (_a = this._renderDisposable) == null ? void 0 : _a.update({
244
+ params: { tabGroup: params.tabGroup }
245
+ });
246
+ }
247
+ dispose() {
248
+ var _a;
249
+ (_a = this._renderDisposable) == null ? void 0 : _a.dispose();
250
+ }
189
251
  }
190
252
  class VuePart {
191
253
  constructor(element, vueComponent, parent, props) {
@@ -236,12 +298,17 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
236
298
  theme: {},
237
299
  disableTabsOverflowList: { type: Boolean },
238
300
  scrollbars: {},
239
- tabAnimation: {},
301
+ getTabContextMenuItems: { type: Function },
302
+ getTabGroupChipContextMenuItems: { type: Function },
303
+ createTabGroupChipComponent: { type: Function },
304
+ tabGroupColors: {},
305
+ tabGroupAccent: {},
240
306
  watermarkComponent: {},
241
307
  defaultTabComponent: {},
242
308
  rightHeaderActionsComponent: {},
243
309
  leftHeaderActionsComponent: {},
244
- prefixHeaderActionsComponent: {}
310
+ prefixHeaderActionsComponent: {},
311
+ tabGroupChipComponent: {}
245
312
  },
246
313
  emits: ["ready"],
247
314
  setup(__props, { emit: __emit }) {
@@ -266,11 +333,108 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
266
333
  }
267
334
  );
268
335
  });
336
+ const inst = vue.getCurrentInstance();
337
+ vue.watch(
338
+ () => props.tabGroupChipComponent,
339
+ (newValue) => {
340
+ if (instance.value) {
341
+ instance.value.updateOptions({
342
+ createTabGroupChipComponent: newValue ? () => {
343
+ const component = findComponent(inst, newValue);
344
+ return new VueTabGroupChipRenderer(component, inst);
345
+ } : void 0
346
+ });
347
+ }
348
+ }
349
+ );
350
+ vue.watch(
351
+ () => props.defaultTabComponent,
352
+ (newValue) => {
353
+ if (instance.value) {
354
+ instance.value.updateOptions({
355
+ defaultTabComponent: newValue,
356
+ createTabComponent(options) {
357
+ let component = findComponent(inst, options.name);
358
+ if (!component && newValue) {
359
+ component = findComponent(inst, newValue);
360
+ }
361
+ if (component) {
362
+ return new VueRenderer(component, inst);
363
+ }
364
+ return void 0;
365
+ }
366
+ });
367
+ }
368
+ }
369
+ );
370
+ vue.watch(
371
+ () => props.watermarkComponent,
372
+ (newValue) => {
373
+ if (instance.value) {
374
+ instance.value.updateOptions({
375
+ createWatermarkComponent: newValue ? () => {
376
+ const component = findComponent(inst, newValue);
377
+ return new VueWatermarkRenderer(component, inst);
378
+ } : void 0
379
+ });
380
+ }
381
+ }
382
+ );
383
+ vue.watch(
384
+ () => props.rightHeaderActionsComponent,
385
+ (newValue) => {
386
+ if (instance.value) {
387
+ instance.value.updateOptions({
388
+ createRightHeaderActionComponent: newValue ? (group) => {
389
+ const component = findComponent(inst, newValue);
390
+ return new VueHeaderActionsRenderer(
391
+ component,
392
+ inst,
393
+ group
394
+ );
395
+ } : void 0
396
+ });
397
+ }
398
+ }
399
+ );
400
+ vue.watch(
401
+ () => props.leftHeaderActionsComponent,
402
+ (newValue) => {
403
+ if (instance.value) {
404
+ instance.value.updateOptions({
405
+ createLeftHeaderActionComponent: newValue ? (group) => {
406
+ const component = findComponent(inst, newValue);
407
+ return new VueHeaderActionsRenderer(
408
+ component,
409
+ inst,
410
+ group
411
+ );
412
+ } : void 0
413
+ });
414
+ }
415
+ }
416
+ );
417
+ vue.watch(
418
+ () => props.prefixHeaderActionsComponent,
419
+ (newValue) => {
420
+ if (instance.value) {
421
+ instance.value.updateOptions({
422
+ createPrefixHeaderActionComponent: newValue ? (group) => {
423
+ const component = findComponent(inst, newValue);
424
+ return new VueHeaderActionsRenderer(
425
+ component,
426
+ inst,
427
+ group
428
+ );
429
+ } : void 0
430
+ });
431
+ }
432
+ }
433
+ );
269
434
  vue.onMounted(() => {
270
435
  if (!el.value) {
271
436
  throw new Error("dockview-vue: element is not mounted");
272
437
  }
273
- const inst = vue.getCurrentInstance();
274
438
  if (!inst) {
275
439
  throw new Error("dockview-vue: getCurrentInstance() returned null");
276
440
  }
@@ -316,10 +480,28 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
316
480
  props.rightHeaderActionsComponent
317
481
  );
318
482
  return new VueHeaderActionsRenderer(component, inst, group);
319
- } : void 0
483
+ } : void 0,
484
+ createContextMenuItemComponent: (options) => {
485
+ if (!options.component) {
486
+ return void 0;
487
+ }
488
+ const component = findComponent(inst, options.component);
489
+ return new VueContextMenuItemRenderer(component, inst);
490
+ }
320
491
  };
492
+ const coreOptions = extractCoreOptions(props);
493
+ if (props.defaultTabComponent) {
494
+ frameworkOptions.defaultTabComponent = props.defaultTabComponent;
495
+ }
496
+ if (props.tabGroupChipComponent) {
497
+ const chipComponentName = props.tabGroupChipComponent;
498
+ coreOptions.createTabGroupChipComponent = () => {
499
+ const component = findComponent(inst, chipComponentName);
500
+ return new VueTabGroupChipRenderer(component, inst);
501
+ };
502
+ }
321
503
  const api = dockviewCore.createDockview(el.value, {
322
- ...extractCoreOptions(props),
504
+ ...coreOptions,
323
505
  ...frameworkOptions
324
506
  });
325
507
  const { clientWidth, clientHeight } = el.value;
@@ -617,16 +799,17 @@ exports.DockviewVue = _sfc_main$3;
617
799
  exports.GridviewVue = _sfc_main$1;
618
800
  exports.PaneviewVue = _sfc_main;
619
801
  exports.SplitviewVue = _sfc_main$2;
802
+ exports.VueContextMenuItemRenderer = VueContextMenuItemRenderer;
620
803
  exports.VueHeaderActionsRenderer = VueHeaderActionsRenderer;
621
804
  exports.VuePart = VuePart;
622
805
  exports.VueRenderer = VueRenderer;
806
+ exports.VueTabGroupChipRenderer = VueTabGroupChipRenderer;
623
807
  exports.VueWatermarkRenderer = VueWatermarkRenderer;
624
808
  exports.findComponent = findComponent;
625
809
  exports.mountVueComponent = mountVueComponent;
626
810
  Object.keys(dockviewCore).forEach((k) => {
627
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k))
628
- Object.defineProperty(exports, k, {
629
- enumerable: true,
630
- get: () => dockviewCore[k]
631
- });
811
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
812
+ enumerable: true,
813
+ get: () => dockviewCore[k]
814
+ });
632
815
  });
@@ -1,12 +1,9 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
7
- import { DockviewMutableDisposable, DockviewCompositeDisposable, PROPERTY_KEYS_DOCKVIEW, createDockview, SplitviewPanel, SplitviewApi, PROPERTY_KEYS_SPLITVIEW, createSplitview, GridviewPanel, GridviewApi, PROPERTY_KEYS_GRIDVIEW, createGridview, PROPERTY_KEYS_PANEVIEW, createPaneview } from "dockview-core";
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ import { DockviewMutableDisposable, DockviewCompositeDisposable, PROPERTY_KEYS_DOCKVIEW, createDockview, SplitviewPanel, SplitviewApi, createSplitview, PROPERTY_KEYS_SPLITVIEW, GridviewPanel, GridviewApi, createGridview, PROPERTY_KEYS_GRIDVIEW, createPaneview, PROPERTY_KEYS_PANEVIEW } from "dockview-core";
8
5
  export * from "dockview-core";
9
- import { createVNode, render, cloneVNode, defineComponent, ref, watch, onMounted, getCurrentInstance, markRaw, onBeforeUnmount, openBlock, createElementBlock } from "vue";
6
+ import { createVNode, render, cloneVNode, defineComponent, ref, watch, getCurrentInstance, onMounted, markRaw, onBeforeUnmount, openBlock, createElementBlock } from "vue";
10
7
  function findComponent(parent, name) {
11
8
  var _a, _b;
12
9
  let instance = parent;
@@ -156,6 +153,9 @@ class VueHeaderActionsRenderer extends AbstractVueRenderer {
156
153
  }),
157
154
  props.api.onDidActiveChange(() => {
158
155
  this.updateProps();
156
+ }),
157
+ props.api.onDidLocationChange((event) => {
158
+ this.updateLocation(event.location);
159
159
  })
160
160
  );
161
161
  (_a = this._renderDisposable) == null ? void 0 : _a.dispose();
@@ -178,13 +178,75 @@ class VueHeaderActionsRenderer extends AbstractVueRenderer {
178
178
  activePanel: this.group.model.activePanel,
179
179
  isGroupActive: this.group.api.isActive,
180
180
  group: this.group,
181
- headerPosition: this.group.model.headerPosition
181
+ headerPosition: this.group.model.headerPosition,
182
+ location: this.group.api.location
182
183
  };
183
184
  }
184
185
  updateProps() {
185
186
  var _a;
186
187
  (_a = this._renderDisposable) == null ? void 0 : _a.update({ params: this.buildEnrichedProps() });
187
188
  }
189
+ updateLocation(location) {
190
+ var _a;
191
+ (_a = this._renderDisposable) == null ? void 0 : _a.update({ params: { location } });
192
+ }
193
+ }
194
+ class VueContextMenuItemRenderer extends AbstractVueRenderer {
195
+ constructor() {
196
+ super(...arguments);
197
+ __publicField(this, "_renderDisposable");
198
+ }
199
+ init(props) {
200
+ var _a;
201
+ (_a = this._renderDisposable) == null ? void 0 : _a.dispose();
202
+ this._renderDisposable = mountVueComponent(
203
+ this.component,
204
+ this.parent,
205
+ { params: props },
206
+ this.element
207
+ );
208
+ }
209
+ dispose() {
210
+ var _a;
211
+ (_a = this._renderDisposable) == null ? void 0 : _a.dispose();
212
+ }
213
+ }
214
+ class VueTabGroupChipRenderer extends AbstractVueRenderer {
215
+ constructor(component, parent) {
216
+ super(component, parent);
217
+ __publicField(this, "_renderDisposable");
218
+ this.element.style.height = "";
219
+ this.element.style.width = "";
220
+ this.element.style.display = "inline-flex";
221
+ }
222
+ get element() {
223
+ return this._element;
224
+ }
225
+ init(params) {
226
+ var _a;
227
+ (_a = this._renderDisposable) == null ? void 0 : _a.dispose();
228
+ this._renderDisposable = mountVueComponent(
229
+ this.component,
230
+ this.parent,
231
+ {
232
+ params: {
233
+ tabGroup: params.tabGroup,
234
+ api: params.api
235
+ }
236
+ },
237
+ this.element
238
+ );
239
+ }
240
+ update(params) {
241
+ var _a;
242
+ (_a = this._renderDisposable) == null ? void 0 : _a.update({
243
+ params: { tabGroup: params.tabGroup }
244
+ });
245
+ }
246
+ dispose() {
247
+ var _a;
248
+ (_a = this._renderDisposable) == null ? void 0 : _a.dispose();
249
+ }
188
250
  }
189
251
  class VuePart {
190
252
  constructor(element, vueComponent, parent, props) {
@@ -235,12 +297,17 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
235
297
  theme: {},
236
298
  disableTabsOverflowList: { type: Boolean },
237
299
  scrollbars: {},
238
- tabAnimation: {},
300
+ getTabContextMenuItems: { type: Function },
301
+ getTabGroupChipContextMenuItems: { type: Function },
302
+ createTabGroupChipComponent: { type: Function },
303
+ tabGroupColors: {},
304
+ tabGroupAccent: {},
239
305
  watermarkComponent: {},
240
306
  defaultTabComponent: {},
241
307
  rightHeaderActionsComponent: {},
242
308
  leftHeaderActionsComponent: {},
243
- prefixHeaderActionsComponent: {}
309
+ prefixHeaderActionsComponent: {},
310
+ tabGroupChipComponent: {}
244
311
  },
245
312
  emits: ["ready"],
246
313
  setup(__props, { emit: __emit }) {
@@ -265,11 +332,108 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
265
332
  }
266
333
  );
267
334
  });
335
+ const inst = getCurrentInstance();
336
+ watch(
337
+ () => props.tabGroupChipComponent,
338
+ (newValue) => {
339
+ if (instance.value) {
340
+ instance.value.updateOptions({
341
+ createTabGroupChipComponent: newValue ? () => {
342
+ const component = findComponent(inst, newValue);
343
+ return new VueTabGroupChipRenderer(component, inst);
344
+ } : void 0
345
+ });
346
+ }
347
+ }
348
+ );
349
+ watch(
350
+ () => props.defaultTabComponent,
351
+ (newValue) => {
352
+ if (instance.value) {
353
+ instance.value.updateOptions({
354
+ defaultTabComponent: newValue,
355
+ createTabComponent(options) {
356
+ let component = findComponent(inst, options.name);
357
+ if (!component && newValue) {
358
+ component = findComponent(inst, newValue);
359
+ }
360
+ if (component) {
361
+ return new VueRenderer(component, inst);
362
+ }
363
+ return void 0;
364
+ }
365
+ });
366
+ }
367
+ }
368
+ );
369
+ watch(
370
+ () => props.watermarkComponent,
371
+ (newValue) => {
372
+ if (instance.value) {
373
+ instance.value.updateOptions({
374
+ createWatermarkComponent: newValue ? () => {
375
+ const component = findComponent(inst, newValue);
376
+ return new VueWatermarkRenderer(component, inst);
377
+ } : void 0
378
+ });
379
+ }
380
+ }
381
+ );
382
+ watch(
383
+ () => props.rightHeaderActionsComponent,
384
+ (newValue) => {
385
+ if (instance.value) {
386
+ instance.value.updateOptions({
387
+ createRightHeaderActionComponent: newValue ? (group) => {
388
+ const component = findComponent(inst, newValue);
389
+ return new VueHeaderActionsRenderer(
390
+ component,
391
+ inst,
392
+ group
393
+ );
394
+ } : void 0
395
+ });
396
+ }
397
+ }
398
+ );
399
+ watch(
400
+ () => props.leftHeaderActionsComponent,
401
+ (newValue) => {
402
+ if (instance.value) {
403
+ instance.value.updateOptions({
404
+ createLeftHeaderActionComponent: newValue ? (group) => {
405
+ const component = findComponent(inst, newValue);
406
+ return new VueHeaderActionsRenderer(
407
+ component,
408
+ inst,
409
+ group
410
+ );
411
+ } : void 0
412
+ });
413
+ }
414
+ }
415
+ );
416
+ watch(
417
+ () => props.prefixHeaderActionsComponent,
418
+ (newValue) => {
419
+ if (instance.value) {
420
+ instance.value.updateOptions({
421
+ createPrefixHeaderActionComponent: newValue ? (group) => {
422
+ const component = findComponent(inst, newValue);
423
+ return new VueHeaderActionsRenderer(
424
+ component,
425
+ inst,
426
+ group
427
+ );
428
+ } : void 0
429
+ });
430
+ }
431
+ }
432
+ );
268
433
  onMounted(() => {
269
434
  if (!el.value) {
270
435
  throw new Error("dockview-vue: element is not mounted");
271
436
  }
272
- const inst = getCurrentInstance();
273
437
  if (!inst) {
274
438
  throw new Error("dockview-vue: getCurrentInstance() returned null");
275
439
  }
@@ -315,10 +479,28 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
315
479
  props.rightHeaderActionsComponent
316
480
  );
317
481
  return new VueHeaderActionsRenderer(component, inst, group);
318
- } : void 0
482
+ } : void 0,
483
+ createContextMenuItemComponent: (options) => {
484
+ if (!options.component) {
485
+ return void 0;
486
+ }
487
+ const component = findComponent(inst, options.component);
488
+ return new VueContextMenuItemRenderer(component, inst);
489
+ }
319
490
  };
491
+ const coreOptions = extractCoreOptions(props);
492
+ if (props.defaultTabComponent) {
493
+ frameworkOptions.defaultTabComponent = props.defaultTabComponent;
494
+ }
495
+ if (props.tabGroupChipComponent) {
496
+ const chipComponentName = props.tabGroupChipComponent;
497
+ coreOptions.createTabGroupChipComponent = () => {
498
+ const component = findComponent(inst, chipComponentName);
499
+ return new VueTabGroupChipRenderer(component, inst);
500
+ };
501
+ }
320
502
  const api = createDockview(el.value, {
321
- ...extractCoreOptions(props),
503
+ ...coreOptions,
322
504
  ...frameworkOptions
323
505
  });
324
506
  const { clientWidth, clientHeight } = el.value;
@@ -617,9 +799,11 @@ export {
617
799
  _sfc_main$1 as GridviewVue,
618
800
  _sfc_main as PaneviewVue,
619
801
  _sfc_main$2 as SplitviewVue,
802
+ VueContextMenuItemRenderer,
620
803
  VueHeaderActionsRenderer,
621
804
  VuePart,
622
805
  VueRenderer,
806
+ VueTabGroupChipRenderer,
623
807
  VueWatermarkRenderer,
624
808
  findComponent,
625
809
  mountVueComponent