replaced track info string map with a struct
This commit is contained in:
@@ -25,6 +25,7 @@ import {
|
||||
import type { ContextMenuHost } from '@utils/context-menu-controller.js';
|
||||
import '@awesome.me/webawesome/dist/components/icon/icon.js';
|
||||
import '@awesome.me/webawesome/dist/components/popup/popup.js';
|
||||
import type WaPopup from '@awesome.me/webawesome/dist/components/popup/popup.js';
|
||||
import '@awesome.me/webawesome/dist/components/dropdown-item/dropdown-item.js';
|
||||
import '@components/playlist-picker/playlist-picker.js';
|
||||
|
||||
@@ -99,17 +100,17 @@ export class ArtistsView
|
||||
private contextMenuArtistId: number | null = null;
|
||||
|
||||
@query('#context-menu')
|
||||
private contextMenuPopup!: HTMLElement;
|
||||
private contextMenuPopup!: WaPopup;
|
||||
|
||||
@query('#playlist-submenu')
|
||||
private playlistSubmenuPopup!: HTMLElement;
|
||||
private playlistSubmenuPopup!: WaPopup;
|
||||
|
||||
getContextMenuPopup(): HTMLElement | undefined {
|
||||
getContextMenuPopup(): WaPopup | undefined {
|
||||
return this.contextMenuPopup;
|
||||
}
|
||||
|
||||
getPlaylistSubmenuPopup():
|
||||
| HTMLElement
|
||||
| WaPopup
|
||||
| undefined {
|
||||
return this.playlistSubmenuPopup;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import { LibraryController } from '@store/controllers/library-controller';
|
||||
import { SearchController } from '@store/controllers/search-controller';
|
||||
import { queueStore } from '@store/queue-store';
|
||||
import '@awesome.me/webawesome/dist/components/popup/popup.js';
|
||||
import type WaPopup from '@awesome.me/webawesome/dist/components/popup/popup.js';
|
||||
import '@awesome.me/webawesome/dist/components/dropdown-item/dropdown-item.js';
|
||||
import '@awesome.me/webawesome/dist/components/icon/icon.js';
|
||||
import '@components/playlist-picker/playlist-picker.js';
|
||||
@@ -290,7 +291,7 @@ export class CoverGrid
|
||||
private sortDropdownOpen = false;
|
||||
|
||||
@query('#sort-dropdown')
|
||||
private sortDropdownPopup!: HTMLElement;
|
||||
private sortDropdownPopup!: WaPopup;
|
||||
|
||||
/** ID of the album whose dropdown is currently open, or null. */
|
||||
@state()
|
||||
@@ -321,17 +322,17 @@ export class CoverGrid
|
||||
splitIndex = 0;
|
||||
|
||||
@query('#context-menu')
|
||||
private contextMenuPopup!: HTMLElement;
|
||||
private contextMenuPopup!: WaPopup;
|
||||
|
||||
@query('#playlist-submenu')
|
||||
private playlistSubmenuPopup!: HTMLElement;
|
||||
private playlistSubmenuPopup!: WaPopup;
|
||||
|
||||
// ContextMenuHost interface.
|
||||
getContextMenuPopup(): HTMLElement | undefined {
|
||||
getContextMenuPopup(): WaPopup | undefined {
|
||||
return this.contextMenuPopup;
|
||||
}
|
||||
|
||||
getPlaylistSubmenuPopup(): HTMLElement | undefined {
|
||||
getPlaylistSubmenuPopup(): WaPopup | undefined {
|
||||
return this.playlistSubmenuPopup;
|
||||
}
|
||||
|
||||
@@ -435,8 +436,8 @@ export class CoverGrid
|
||||
);
|
||||
|
||||
if (popup && anchor) {
|
||||
(popup as any).anchor = anchor;
|
||||
(popup as any).active = true;
|
||||
popup.anchor = anchor;
|
||||
popup.active = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -448,7 +449,7 @@ export class CoverGrid
|
||||
const popup = this.sortDropdownPopup;
|
||||
|
||||
if (popup) {
|
||||
(popup as any).active = false;
|
||||
popup.active = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import {
|
||||
import type { ContextMenuHost } from '@utils/context-menu-controller.js';
|
||||
import '@awesome.me/webawesome/dist/components/icon/icon.js';
|
||||
import '@awesome.me/webawesome/dist/components/popup/popup.js';
|
||||
import type WaPopup from '@awesome.me/webawesome/dist/components/popup/popup.js';
|
||||
import '@awesome.me/webawesome/dist/components/dropdown-item/dropdown-item.js';
|
||||
import '@components/playlist-picker/playlist-picker.js';
|
||||
|
||||
@@ -102,19 +103,19 @@ export class GenresView
|
||||
private contextMenuGenreName: string | null = null;
|
||||
|
||||
@query('#context-menu')
|
||||
private contextMenuPopup!: HTMLElement;
|
||||
private contextMenuPopup!: WaPopup;
|
||||
|
||||
@query('#playlist-submenu')
|
||||
private playlistSubmenuPopup!: HTMLElement;
|
||||
private playlistSubmenuPopup!: WaPopup;
|
||||
|
||||
// ----- ContextMenuHost interface -----
|
||||
|
||||
getContextMenuPopup(): HTMLElement | undefined {
|
||||
getContextMenuPopup(): WaPopup | undefined {
|
||||
return this.contextMenuPopup;
|
||||
}
|
||||
|
||||
getPlaylistSubmenuPopup():
|
||||
| HTMLElement
|
||||
| WaPopup
|
||||
| undefined {
|
||||
return this.playlistSubmenuPopup;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { LitElement, html, css, nothing } from 'lit';
|
||||
import { customElement, state } from 'lit/decorators.js';
|
||||
import '@awesome.me/webawesome/dist/components/icon/icon.js';
|
||||
import '@awesome.me/webawesome/dist/components/popup/popup.js';
|
||||
import type WaPopup from '@awesome.me/webawesome/dist/components/popup/popup.js';
|
||||
import { PlayerController } from '@store/controllers/player-controller';
|
||||
|
||||
const MIN_WIDTH = 120;
|
||||
@@ -220,15 +221,16 @@ export class NowPlaying extends LitElement {
|
||||
this.showCoverPreview = true;
|
||||
|
||||
this.updateComplete.then(() => {
|
||||
const popup = this.shadowRoot?.querySelector(
|
||||
'#cover-preview',
|
||||
);
|
||||
const popup =
|
||||
this.shadowRoot?.querySelector<WaPopup>(
|
||||
'#cover-preview',
|
||||
);
|
||||
const anchor = this.shadowRoot?.querySelector(
|
||||
'.cover-art',
|
||||
);
|
||||
|
||||
if (popup && anchor) {
|
||||
(popup as any).anchor = anchor;
|
||||
popup.anchor = anchor;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2,6 +2,7 @@ import { LitElement, html, css, nothing } from 'lit';
|
||||
import { customElement, state, query } from 'lit/decorators.js';
|
||||
import '@awesome.me/webawesome/dist/components/icon/icon.js';
|
||||
import '@awesome.me/webawesome/dist/components/popup/popup.js';
|
||||
import type WaPopup from '@awesome.me/webawesome/dist/components/popup/popup.js';
|
||||
import '@awesome.me/webawesome/dist/components/dropdown-item/dropdown-item.js';
|
||||
|
||||
import {
|
||||
@@ -63,12 +64,12 @@ export class PlaylistView
|
||||
private selection = new SelectionController(this);
|
||||
private ctxMenu = new ContextMenuController(this);
|
||||
|
||||
getContextMenuPopup(): HTMLElement | undefined {
|
||||
getContextMenuPopup(): WaPopup | undefined {
|
||||
return this.contextMenuPopup;
|
||||
}
|
||||
|
||||
getPlaylistSubmenuPopup():
|
||||
| HTMLElement
|
||||
| WaPopup
|
||||
| undefined {
|
||||
return this.playlistSubmenuPopup;
|
||||
}
|
||||
@@ -199,13 +200,13 @@ export class PlaylistView
|
||||
private dragImageEl: HTMLElement | null = null;
|
||||
|
||||
@query('#context-menu')
|
||||
private contextMenuPopup!: HTMLElement;
|
||||
private contextMenuPopup!: WaPopup;
|
||||
|
||||
@query('#playlist-submenu')
|
||||
private playlistSubmenuPopup!: HTMLElement;
|
||||
private playlistSubmenuPopup!: WaPopup;
|
||||
|
||||
@query('#playlist-context-menu')
|
||||
private playlistContextMenuPopup!: HTMLElement;
|
||||
private playlistContextMenuPopup!: WaPopup;
|
||||
|
||||
@query('track-details')
|
||||
private trackDetailsDialog!: TrackDetails;
|
||||
@@ -1438,21 +1439,17 @@ export class PlaylistView
|
||||
this.playlistContextMenuPopup;
|
||||
|
||||
if (popup) {
|
||||
(popup as any).anchor = {
|
||||
popup.anchor = {
|
||||
getBoundingClientRect() {
|
||||
return {
|
||||
width: 0,
|
||||
height: 0,
|
||||
x: e.clientX,
|
||||
y: e.clientY,
|
||||
top: e.clientY,
|
||||
left: e.clientX,
|
||||
right: e.clientX,
|
||||
bottom: e.clientY,
|
||||
};
|
||||
return new DOMRect(
|
||||
e.clientX,
|
||||
e.clientY,
|
||||
0,
|
||||
0,
|
||||
);
|
||||
},
|
||||
};
|
||||
(popup as any).active = true;
|
||||
popup.active = true;
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -1467,7 +1464,7 @@ export class PlaylistView
|
||||
this.playlistContextMenuPopup;
|
||||
|
||||
if (popup) {
|
||||
(popup as any).active = false;
|
||||
popup.active = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
} from 'lit/decorators.js';
|
||||
import '@awesome.me/webawesome/dist/components/icon/icon.js';
|
||||
import '@awesome.me/webawesome/dist/components/popup/popup.js';
|
||||
import type WaPopup from '@awesome.me/webawesome/dist/components/popup/popup.js';
|
||||
import '@awesome.me/webawesome/dist/components/dropdown-item/dropdown-item.js';
|
||||
import { QueueController } from '@store/controllers/queue-controller';
|
||||
import '@components/playlist-picker/playlist-picker.js';
|
||||
@@ -73,13 +74,13 @@ export class QueuePanel
|
||||
private dragImageEl: HTMLElement | null = null;
|
||||
|
||||
@query('#add-to-playlist-popup')
|
||||
private addToPlaylistPopup!: HTMLElement;
|
||||
private addToPlaylistPopup!: WaPopup;
|
||||
|
||||
@query('#context-menu')
|
||||
private contextMenuPopup!: HTMLElement;
|
||||
private contextMenuPopup!: WaPopup;
|
||||
|
||||
@query('#playlist-submenu')
|
||||
private playlistSubmenuPopup!: HTMLElement;
|
||||
private playlistSubmenuPopup!: WaPopup;
|
||||
|
||||
@query('lit-virtualizer')
|
||||
private virtualizer!: LitVirtualizer;
|
||||
@@ -158,11 +159,11 @@ export class QueuePanel
|
||||
// ContextMenuHost interface
|
||||
// =================================================================
|
||||
|
||||
getContextMenuPopup(): HTMLElement | undefined {
|
||||
getContextMenuPopup(): WaPopup | undefined {
|
||||
return this.contextMenuPopup;
|
||||
}
|
||||
|
||||
getPlaylistSubmenuPopup(): HTMLElement | undefined {
|
||||
getPlaylistSubmenuPopup(): WaPopup | undefined {
|
||||
return this.playlistSubmenuPopup;
|
||||
}
|
||||
|
||||
@@ -536,8 +537,8 @@ export class QueuePanel
|
||||
);
|
||||
|
||||
if (popup && btn) {
|
||||
(popup as any).anchor = btn;
|
||||
(popup as any).active = this.playlistPickerOpen;
|
||||
popup.anchor = btn;
|
||||
popup.active = this.playlistPickerOpen;
|
||||
}
|
||||
|
||||
if (this.playlistPickerOpen) {
|
||||
@@ -557,7 +558,7 @@ export class QueuePanel
|
||||
const popup = this.addToPlaylistPopup;
|
||||
|
||||
if (popup) {
|
||||
(popup as any).active = false;
|
||||
popup.active = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ import type {
|
||||
} from '@lit-labs/virtualizer';
|
||||
import { flow } from '@lit-labs/virtualizer/layouts/flow.js';
|
||||
import '@awesome.me/webawesome/dist/components/popup/popup.js';
|
||||
import type WaPopup from '@awesome.me/webawesome/dist/components/popup/popup.js';
|
||||
import '@awesome.me/webawesome/dist/components/dropdown-item/dropdown-item.js';
|
||||
import '@awesome.me/webawesome/dist/components/icon/icon.js';
|
||||
import '@components/playlist-picker/playlist-picker.js';
|
||||
@@ -104,18 +105,18 @@ export class TrackList extends LitElement implements SelectionHost, ContextMenuH
|
||||
private tracks: library.Track[] = [];
|
||||
|
||||
@query('#context-menu')
|
||||
private contextMenuPopup!: HTMLElement;
|
||||
private contextMenuPopup!: WaPopup;
|
||||
|
||||
@query('#playlist-submenu')
|
||||
private playlistSubmenuPopup!: HTMLElement;
|
||||
private playlistSubmenuPopup!: WaPopup;
|
||||
|
||||
// -- ContextMenuHost interface --
|
||||
|
||||
getContextMenuPopup(): HTMLElement | undefined {
|
||||
getContextMenuPopup(): WaPopup | undefined {
|
||||
return this.contextMenuPopup;
|
||||
}
|
||||
|
||||
getPlaylistSubmenuPopup(): HTMLElement | undefined {
|
||||
getPlaylistSubmenuPopup(): WaPopup | undefined {
|
||||
return this.playlistSubmenuPopup;
|
||||
}
|
||||
|
||||
@@ -169,7 +170,7 @@ export class TrackList extends LitElement implements SelectionHost, ContextMenuH
|
||||
private sortDropdownOpen = false;
|
||||
|
||||
@query('#sort-dropdown')
|
||||
private sortDropdownPopup!: HTMLElement;
|
||||
private sortDropdownPopup!: WaPopup;
|
||||
|
||||
private resizingColumn: number | null = null;
|
||||
private resizeStartX = 0;
|
||||
@@ -1371,8 +1372,8 @@ export class TrackList extends LitElement implements SelectionHost, ContextMenuH
|
||||
);
|
||||
|
||||
if (popup && anchor) {
|
||||
(popup as any).anchor = anchor;
|
||||
(popup as any).active = true;
|
||||
popup.anchor = anchor;
|
||||
popup.active = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1384,7 +1385,7 @@ export class TrackList extends LitElement implements SelectionHost, ContextMenuH
|
||||
const popup = this.sortDropdownPopup;
|
||||
|
||||
if (popup) {
|
||||
(popup as any).active = false;
|
||||
popup.active = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user