Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ describe('PointerDropTarget', () => {

(target as any)._onDragOver(makeDragEvent(10, 20));
expect(
element.getElementsByClassName('dv-drop-target-dropzone').length
).toBe(0);
element.getElementsByClassName('dv-drop-target-dropzone')
).toHaveLength(0);
expect(target.state).toBeUndefined();

target.dispose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('advanced overflow seam: free fallback (no module)', () => {
// No search input in the free path.
expect(body!.querySelector('.dv-tabs-overflow-search')).toBeNull();
// The clipped tabs render as rows.
expect(body!.querySelectorAll('.dv-tab').length).toBe(2);
expect(body!.querySelectorAll('.dv-tab')).toHaveLength(2);

dockview.dispose();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ describe('dockviewComponent', () => {
const tabEls = Array.from(
group.element.querySelectorAll('.dv-tab')
) as HTMLElement[];
expect(tabEls.length).toBe(2);
expect(tabEls).toHaveLength(2);

// each tab element resolves to a distinct panel
const r1 = group.model.getPanelForTab(tabEls[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ abstract class BaseTabGroupIndicator implements ITabGroupIndicator {
path: SVGPathElement;
} {
const existing = underline.firstElementChild as SVGSVGElement | null;
if (existing && existing.tagName === 'svg') {
if (existing?.tagName === 'svg') {
return {
svg: existing,
path: existing.firstElementChild as SVGPathElement,
Expand Down
2 changes: 1 addition & 1 deletion packages/dockview-core/src/dockview/dockviewComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3172,7 +3172,7 @@ export class DockviewComponent
value: boolean | undefined
): void {
const service = this._edgeGroupService;
if (!service || !service.includes(group)) {
if (!service?.includes(group)) {
return;
}
service.setAutoHide(group, value);
Expand Down
5 changes: 1 addition & 4 deletions packages/dockview-core/src/gridview/branchNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,7 @@ export class BranchNode extends CompositeDisposable implements IView {
// Honour an explicit `visible` flag for branch children
// too (not just leaves), so a hidden sub-grid restores
// hidden with its cached size rather than visible at 0.
visible:
childDescriptor.visible !== undefined
? childDescriptor.visible
: true,
visible: childDescriptor.visible ?? true,
};
}),
size: this.orthogonalSize,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ describe('advanced overflow: full component integration', () => {
expect(body).toBeTruthy();
expect(body!.querySelector('.dv-tabs-overflow-search')).toBeTruthy();
// scope 'group' (search: true) => every tab is reachable.
expect(body!.querySelectorAll('[role="option"]').length).toBe(4);
expect(body!.querySelectorAll('[role="option"]')).toHaveLength(4);

dockview.dispose();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ describe('drop guide', () => {

// 9 cells but inner+outer of a direction share a position, so the veto
// (which can fire onUnhandledDragOver) must run at most once per position.
expect(gateCalls.length).toBe(new Set(gateCalls).size);
expect(gateCalls).toHaveLength(new Set(gateCalls).size);
expect(gateCalls.length).toBeLessThanOrEqual(5);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ describe('accessibility: keyboard docking', () => {
make(true);
dockview.addPanel({ id: 'p1', component: 'default', title: 'P1' });
dockview.addPanel({ id: 'p2', component: 'default', title: 'P2' });
expect(dockview.groups.length).toBe(1); // p1, p2 tabs in one group
expect(dockview.floatingGroups.length).toBe(0);
expect(dockview.groups).toHaveLength(1); // p1, p2 tabs in one group
expect(dockview.floatingGroups).toHaveLength(0);

fireEvent.keyDown(dockview.element, { key: 'm', ctrlKey: true });
expect(region().textContent).toContain('Moving P2');
Expand All @@ -230,7 +230,7 @@ describe('accessibility: keyboard docking', () => {
});

expect(region().textContent).toBe('P2 floated.');
expect(dockview.floatingGroups.length).toBe(1);
expect(dockview.floatingGroups).toHaveLength(1);
});

test('float is rebindable', () => {
Expand All @@ -245,11 +245,11 @@ describe('accessibility: keyboard docking', () => {
ctrlKey: true,
shiftKey: true,
});
expect(dockview.floatingGroups.length).toBe(0);
expect(dockview.floatingGroups).toHaveLength(0);

// the rebound key does
fireEvent.keyDown(dockview.element, { key: 'f', altKey: true });
expect(dockview.floatingGroups.length).toBe(1);
expect(dockview.floatingGroups).toHaveLength(1);
});

test('does nothing when keyboardNavigation is off (default)', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export class OverflowListView extends CompositeDisposable {
const { context } = this.params;

while (this._list.firstChild) {
this._list.removeChild(this._list.firstChild);
this._list.firstChild.remove();
}
this._rows = [];

Expand Down
8 changes: 5 additions & 3 deletions packages/dockview-enterprise/src/autoEdgeGroupService.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DockviewCompositeDisposable as CompositeDisposable } from 'dockview';
import {
DockviewCompositeDisposable as CompositeDisposable,
DockviewWillDropEvent,
DockviewWillShowOverlayLocationEvent,
EdgeGroupPosition,
Expand All @@ -9,9 +9,11 @@ import {
PositionResolver,
PositionResolverArgs,
PositionResolverResult,
defineModule,
EdgeGroupModule,
IAutoEdgeGroupHost,
IAutoEdgeGroupService,
} from 'dockview';
import { defineModule, EdgeGroupModule } from 'dockview';
import { IAutoEdgeGroupHost, IAutoEdgeGroupService } from 'dockview';

/**
* Distance (px) from the content-area edge within which a drop docks as an
Expand Down
16 changes: 9 additions & 7 deletions packages/dockview-enterprise/src/autoHideEdgeGroupService.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { DockviewCompositeDisposable as CompositeDisposable } from 'dockview';
import { DockviewGroupPanel } from 'dockview';
import { IDockviewPanel } from 'dockview';
import { EdgeGroupPosition } from 'dockview';
import { EdgeGroupPeekOptions } from 'dockview';
import { defineModule, EdgeGroupModule } from 'dockview';
import {
DockviewCompositeDisposable as CompositeDisposable,
DockviewGroupPanel,
IDockviewPanel,
EdgeGroupPosition,
EdgeGroupPeekOptions,
defineModule,
EdgeGroupModule,
createCloseButton,
createDismissableLayer,
createPinButton,
prefersReducedMotion,
resolveOpaqueBackground,
IAutoHideEdgeGroupHost,
IAutoHideEdgeGroupService,
} from 'dockview';
import { IAutoHideEdgeGroupHost, IAutoHideEdgeGroupService } from 'dockview';

/** Height (px) of the title bar; the content/`always` overlay is inset below it
* so nothing paints under the bar. The title bar's own height is set inline to
Expand Down
15 changes: 8 additions & 7 deletions packages/dockview-enterprise/src/contextMenu.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { findRelativeZIndexParent } from 'dockview';
import { DockviewGroupPanel } from 'dockview';
import { IDockviewPanel } from 'dockview';
import {
findRelativeZIndexParent,
DockviewGroupPanel,
IDockviewPanel,
BuiltInChipContextMenuItem,
ContextMenuItemConfig,
ContextMenuItem,
ITabGroup,
TabGroupColorPalette,
defineModule,
IContextMenuHost,
IContextMenuService,
} from 'dockview';
import { ITabGroup } from 'dockview';
import { TabGroupColorPalette } from 'dockview';
import { defineModule } from 'dockview';
import { IContextMenuHost, IContextMenuService } from 'dockview';

function popoverZIndexFor(target: EventTarget | null): string | undefined {
if (!(target instanceof HTMLElement)) {
Expand Down
9 changes: 4 additions & 5 deletions packages/dockview-enterprise/src/dropGuideService.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import {
DockviewCompositeDisposable as CompositeDisposable,
DockviewIDisposable as IDisposable,
} from 'dockview';
import {
DockviewGroupPanel,
DockviewWillShowOverlayLocationEvent,
Position,
PositionResolver,
PositionResolverArgs,
PositionResolverResult,
defineModule,
IDropGuideHost,
IDropGuideService,
AdvancedDnDModule,
} from 'dockview';
import { defineModule } from 'dockview';
import { IDropGuideHost, IDropGuideService } from 'dockview';
import { AdvancedDnDModule } from 'dockview';

/** Size (px) of each compass cell + the gap between them. */
const CELL = 38;
Expand Down
17 changes: 9 additions & 8 deletions packages/dockview-enterprise/src/keyboardDockingService.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import {
DockviewCompositeDisposable as CompositeDisposable,
DockviewIDisposable as IDisposable,
Position,
DockviewGroupPanel,
IDockviewPanel,
resolveMessages,
defineModule,
AdvancedDnDModule,
LiveRegionModule,
IKeyboardNavigationHost,
IKeyboardDockingService,
} from 'dockview';
import { Position } from 'dockview';
import { DockviewGroupPanel } from 'dockview';
import { IDockviewPanel } from 'dockview';
import { resolveMessages } from 'dockview';
import { defineModule } from 'dockview';
import { AdvancedDnDModule } from 'dockview';
import { LiveRegionModule } from 'dockview';
import { IKeyboardNavigationHost, IKeyboardDockingService } from 'dockview';
import {
bindDocumentListeners,
KEYBOARD_MOVE_ATTRIBUTE,
Expand Down
26 changes: 15 additions & 11 deletions packages/dockview-enterprise/src/keyboardNavigationService.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { DockviewCompositeDisposable as CompositeDisposable } from 'dockview';
import { DockviewGroupPanel } from 'dockview';
import { DockviewKeybindings, KeyboardNavigationOptions } from 'dockview';
import { defineModule } from 'dockview';
import { IKeyboardNavigationHost, IKeyboardNavigationService } from 'dockview';
import {
DockviewCompositeDisposable as CompositeDisposable,
DockviewGroupPanel,
DockviewKeybindings,
KeyboardNavigationOptions,
defineModule,
IKeyboardNavigationHost,
IKeyboardNavigationService,
} from 'dockview';
import {
bindDocumentListeners,
KEYBOARD_MOVE_ATTRIBUTE,
Expand Down Expand Up @@ -205,12 +209,12 @@ export class KeyboardNavigationService
const index =
active instanceof HTMLElement ? tabbables.indexOf(active) : -1;
const n = tabbables.length;
const next =
index === -1
? e.shiftKey
? n - 1
: 0
: (index + (e.shiftKey ? -1 : 1) + n) % n;
let next: number;
if (index === -1) {
next = e.shiftKey ? n - 1 : 0;
} else {
next = (index + (e.shiftKey ? -1 : 1) + n) % n;
}
tabbables[next].focus();
return true;
}
Expand Down
6 changes: 1 addition & 5 deletions packages/dockview-enterprise/src/layoutHistoryService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@ import {
DockviewCompositeDisposable as CompositeDisposable,
DockviewEmitter as Emitter,
DockviewEvent as Event,
} from 'dockview';
import {
DockviewComponentOptions,
DockviewLayoutMutationEvent,
DockviewLayoutMutationKind,
SerializedDockview,
} from 'dockview';
import { defineModule } from 'dockview';
import {
defineModule,
ILayoutHistoryHost,
ILayoutHistoryService,
LayoutHistoryChangeEvent,
Expand Down
2 changes: 1 addition & 1 deletion packages/dockview-enterprise/src/licenseValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export function validateLicense(
return 'missing';
}
const parsed = parseLicenseKey(key);
if (!parsed || !parsed.validUntil) {
if (!parsed?.validUntil) {
return 'invalid';
}
// Compare at UTC-date granularity (keys carry dates, not times): a build
Expand Down
3 changes: 2 additions & 1 deletion packages/dockview-enterprise/src/multiRowTabsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import {
OVERFLOW_MAX_TAB_ROWS_VARIABLE as MAX_ROWS_VAR,
OVERFLOW_WRAP_TABS_VERTICAL_TAB_HEIGHT_VARIABLE as VERTICAL_TAB_HEIGHT_VAR,
defineModule,
IMultiRowTabsHost,
IMultiRowTabsService,
} from 'dockview';
import { IMultiRowTabsHost, IMultiRowTabsService } from 'dockview';

function isWrapMode(overflow: DockviewOverflowOptions | undefined): boolean {
return typeof overflow === 'object' && overflow?.mode === 'wrap';
Expand Down
8 changes: 4 additions & 4 deletions packages/dockview-enterprise/src/smartGuidesService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import {
DockviewCompositeDisposable as CompositeDisposable,
DockviewEmitter as Emitter,
DockviewEvent as Event,
} from 'dockview';
import {
Box,
DockviewGroupPanel,
DragModifiers,
Expand All @@ -13,9 +11,11 @@ import {
SmartGuidesSnapPosition,
SmartGuidesSnapTogetherEvent,
SnapModifier,
defineModule,
FloatingGroupModule,
ISmartGuidesHost,
ISmartGuidesService,
} from 'dockview';
import { defineModule, FloatingGroupModule } from 'dockview';
import { ISmartGuidesHost, ISmartGuidesService } from 'dockview';

/** Fraction of the perpendicular extents that must overlap for an edge to read
* as an adjacency (dock-beside) rather than a glancing touch. */
Expand Down
Loading