feat(16-01): wire shortcut:select-all listener in track-list, queue-panel, and playlist-view

- Add handleSelectAll bound handler calling selection.selectAll() in all three components
- Register/unregister event listeners in connectedCallback/disconnectedCallback
This commit is contained in:
2026-03-07 10:19:07 -05:00
parent f5677628ef
commit 906ea28751
3 changed files with 30 additions and 0 deletions
@@ -277,6 +277,10 @@ export class PlaylistView
this.closePlaylistContextMenu(); this.closePlaylistContextMenu();
}; };
private handleSelectAll = (): void => {
this.selection.selectAll();
};
private clearSelectionHandler = (e: MouseEvent) => { private clearSelectionHandler = (e: MouseEvent) => {
const path = e.composedPath(); const path = e.composedPath();
const isTrackClick = path.some( const isTrackClick = path.some(
@@ -1196,6 +1200,10 @@ export class PlaylistView
'mousedown', 'mousedown',
this.sortDropdownCloseHandler, this.sortDropdownCloseHandler,
); );
document.addEventListener(
'shortcut:select-all',
this.handleSelectAll,
);
} }
override disconnectedCallback() { override disconnectedCallback() {
@@ -1226,6 +1234,10 @@ export class PlaylistView
'mousedown', 'mousedown',
this.sortDropdownCloseHandler, this.sortDropdownCloseHandler,
); );
document.removeEventListener(
'shortcut:select-all',
this.handleSelectAll,
);
} }
override updated() { override updated() {
@@ -92,6 +92,10 @@ export class QueuePanel
@query('track-details') @query('track-details')
private trackDetailsDialog!: TrackDetails; private trackDetailsDialog!: TrackDetails;
private handleSelectAll = (): void => {
this.selection.selectAll();
};
private closePickerHandler = (e: MouseEvent) => { private closePickerHandler = (e: MouseEvent) => {
const path = e.composedPath(); const path = e.composedPath();
const popup = this.addToPlaylistPopup; const popup = this.addToPlaylistPopup;
@@ -475,6 +479,10 @@ export class QueuePanel
'dragend', 'dragend',
this.onDocumentDragEnd, this.onDocumentDragEnd,
); );
document.addEventListener(
'shortcut:select-all',
this.handleSelectAll,
);
} }
override disconnectedCallback() { override disconnectedCallback() {
@@ -499,6 +507,10 @@ export class QueuePanel
'dragend', 'dragend',
this.onDocumentDragEnd, this.onDocumentDragEnd,
); );
document.removeEventListener(
'shortcut:select-all',
this.handleSelectAll,
);
} }
override updated() { override updated() {
@@ -151,6 +151,10 @@ export class TrackList extends LitElement implements SelectionHost, ContextMenuH
private prevSortField: string | null = null; private prevSortField: string | null = null;
private prevSortDir: SortDirection = 'asc'; private prevSortDir: SortDirection = 'asc';
private handleSelectAll = (): void => {
this.selection.selectAll();
};
private clearSelectionHandler = (e: MouseEvent) => { private clearSelectionHandler = (e: MouseEvent) => {
const path = e.composedPath(); const path = e.composedPath();
const isTrackClick = path.some( const isTrackClick = path.some(
@@ -1030,6 +1034,7 @@ export class TrackList extends LitElement implements SelectionHost, ContextMenuH
} }
document.addEventListener('mousedown', this.sortDropdownCloseHandler); document.addEventListener('mousedown', this.sortDropdownCloseHandler);
document.addEventListener('click', this.clearSelectionHandler); document.addEventListener('click', this.clearSelectionHandler);
document.addEventListener('shortcut:select-all', this.handleSelectAll);
document.addEventListener('mousemove', this.onColResizeMove); document.addEventListener('mousemove', this.onColResizeMove);
document.addEventListener('mouseup', this.onColResizeEnd); document.addEventListener('mouseup', this.onColResizeEnd);
@@ -1051,6 +1056,7 @@ export class TrackList extends LitElement implements SelectionHost, ContextMenuH
super.disconnectedCallback(); super.disconnectedCallback();
document.removeEventListener('mousedown', this.sortDropdownCloseHandler); document.removeEventListener('mousedown', this.sortDropdownCloseHandler);
document.removeEventListener('click', this.clearSelectionHandler); document.removeEventListener('click', this.clearSelectionHandler);
document.removeEventListener('shortcut:select-all', this.handleSelectAll);
document.removeEventListener('mousemove', this.onColResizeMove); document.removeEventListener('mousemove', this.onColResizeMove);
document.removeEventListener('mouseup', this.onColResizeEnd); document.removeEventListener('mouseup', this.onColResizeEnd);