From fbfa12cf073792f5fe18617f33cbb5b2e1450d11 Mon Sep 17 00:00:00 2001 From: Sam Dornan Date: Sat, 3 Oct 2026 00:38:46 -0400 Subject: [PATCH] Prepare v2 and shared code for exactOptionalPropertyTypes (#5065) --- frontend/src/services/api/audit.ts | 16 +++--- frontend/src/services/api/client-token.ts | 2 +- frontend/src/services/api/collection.ts | 2 +- frontend/src/services/api/device-auth.ts | 4 +- frontend/src/services/api/platform.ts | 4 +- frontend/src/services/api/rom.ts | 46 ++++++++-------- frontend/src/services/api/save.ts | 16 +++--- frontend/src/services/api/state.ts | 8 +-- frontend/src/services/cache/api.ts | 9 +--- frontend/src/services/pending-asset.test.ts | 2 +- frontend/src/services/pending-asset.ts | 7 ++- frontend/src/stores/native.ts | 4 +- frontend/src/stores/roms.test.ts | 11 ++-- frontend/src/stores/soundtrackPlayer.ts | 10 ++-- frontend/src/types/emitter.d.ts | 19 ++++--- frontend/src/utils/downloadPath.ts | 2 +- .../src/v2/components/Auth/SetupStepAdmin.vue | 2 +- .../Collections/CollectionListRow.vue | 2 +- .../Collections/CollectionPickerRow.vue | 2 +- .../components/Collections/CollectionTile.vue | 4 +- .../Dialogs/CreateSmartCollectionDialog.vue | 3 +- .../Dialogs/RefreshMetadataDialog.vue | 2 +- .../components/Dialogs/SearchCoverDialog.vue | 9 +--- .../v2/components/Gallery/GalleryShell.vue | 2 +- .../v2/components/Gallery/GalleryToolbar.vue | 2 +- .../v2/components/Gallery/GameListHeader.vue | 2 +- .../src/v2/components/Gallery/GameListRow.vue | 4 +- .../src/v2/components/Gallery/InfoPanel.vue | 2 +- .../src/v2/components/Gallery/SettingsTab.vue | 9 ++-- .../src/v2/components/GameCard/GameCard.vue | 8 +-- .../GameDetails/AchievementsTab.vue | 2 +- .../GameDetails/AgeRatingBadges.vue | 2 +- .../components/GameDetails/MarkdownViewer.vue | 2 +- .../v2/components/GameDetails/MediaShelf.vue | 2 +- .../v2/components/GameDetails/PdfViewer.vue | 2 +- .../components/GameDetails/ScreenshotsTab.vue | 16 +++--- .../v2/components/GameDetails/TextViewer.vue | 2 +- .../v2/components/Home/LiveSessionCard.vue | 2 +- .../Notifications/NotificationHost.vue | 6 +-- .../components/Platforms/PlatformListRow.vue | 2 +- .../v2/components/Platforms/PlatformTile.vue | 6 +-- .../v2/components/Player/MemoryCardDialog.vue | 2 +- .../v2/components/Scan/ScanProviderSelect.vue | 2 +- .../v2/components/Settings/EditUserDialog.vue | 10 ++-- .../Settings/FolderMappingPlatformCell.vue | 10 +--- .../Settings/FolderMappingTypeCell.vue | 5 +- .../Settings/FolderMappingsSection.test.ts | 8 +-- .../Settings/FolderMappingsSection.vue | 9 +--- .../components/Settings/ScanPriorityList.vue | 2 +- .../components/Settings/SettingsToggleRow.vue | 2 +- .../components/Settings/folderMappingRow.ts | 8 +++ .../components/Soundtrack/NowPlayingCard.vue | 2 +- .../components/Soundtrack/NowPlayingChips.vue | 2 +- .../src/v2/components/Soundtrack/Panel.vue | 4 +- .../components/shared/AssetFavoriteMark.vue | 2 +- .../src/v2/components/shared/AssetStrip.vue | 4 +- .../src/v2/components/shared/AuthBackLink.vue | 2 +- frontend/src/v2/components/shared/BackBtn.vue | 2 +- frontend/src/v2/components/shared/CardRow.vue | 4 +- .../src/v2/components/shared/CoverArtPip.vue | 4 +- .../src/v2/components/shared/GameCover.vue | 8 +-- .../src/v2/components/shared/ListSortMenu.vue | 2 +- .../MetadataProviderCard.vue | 8 +-- .../v2/components/shared/PasswordField.vue | 6 +-- .../src/v2/components/shared/PlatformIcon.vue | 10 ++-- .../v2/components/shared/PlatformSelect.vue | 14 ++--- .../shared/RecommendationReason.vue | 2 +- frontend/src/v2/components/shared/Stat.vue | 4 +- frontend/src/v2/components/shared/Tile.vue | 4 +- .../src/v2/composables/useCoverArt/index.ts | 4 +- .../useGalleryVirtualItems/index.ts | 2 +- .../src/v2/composables/useGamepad/index.ts | 2 +- .../v2/composables/useMediaSession/index.ts | 4 +- .../src/v2/composables/useSnackbar/index.ts | 22 +++----- .../src/v2/lib/InputNavigation.stories.ts | 4 +- frontend/src/v2/lib/data/RTable/types.ts | 8 +-- .../src/v2/lib/forms/RCheckbox/RCheckbox.vue | 16 +++--- .../forms/RComboboxField/RComboboxField.vue | 8 +-- .../v2/lib/forms/RDateField/RDateField.vue | 4 +- .../src/v2/lib/forms/RDropzone/RDropzone.vue | 16 +++--- frontend/src/v2/lib/forms/RForm/RForm.vue | 2 +- frontend/src/v2/lib/forms/RRating/RRating.vue | 6 +-- frontend/src/v2/lib/forms/RSelect/RSelect.vue | 20 +++---- frontend/src/v2/lib/forms/RSlider/RSlider.vue | 2 +- frontend/src/v2/lib/forms/RSwitch/RSwitch.vue | 4 +- .../v2/lib/forms/RTextField/RTextField.vue | 52 ++++++++++--------- frontend/src/v2/lib/menus/RMenu/RMenu.vue | 10 ++-- .../src/v2/lib/menus/RMenuItem/RMenuItem.vue | 15 +++--- .../src/v2/lib/overlays/RCarousel/types.ts | 12 ++--- .../src/v2/lib/overlays/RDialog/RDialog.vue | 2 +- .../v2/lib/overlays/RDialog/escapeStack.ts | 2 +- .../src/v2/lib/primitives/RAlert/RAlert.vue | 8 +-- .../src/v2/lib/primitives/RAvatar/RAvatar.vue | 8 +-- .../src/v2/lib/primitives/RBadge/RBadge.vue | 4 +- frontend/src/v2/lib/primitives/RBtn/RBtn.vue | 20 +++---- .../src/v2/lib/primitives/RCard/RCard.vue | 8 +-- .../src/v2/lib/primitives/RChip/RChip.vue | 8 +-- .../v2/lib/primitives/RDivider/RDivider.vue | 2 +- .../primitives/REmptyState/REmptyState.vue | 4 +- .../src/v2/lib/primitives/RIcon/RIcon.vue | 6 +-- frontend/src/v2/lib/primitives/RImg/RImg.vue | 10 ++-- .../RLetterHeading/RLetterHeading.vue | 2 +- .../RProgressCircular/RProgressCircular.vue | 4 +- .../RProgressLinear/RProgressLinear.vue | 6 +-- .../RSliderBtnGroup.stories.ts | 10 ++-- .../RSliderBtnGroup/RSliderBtnGroup.vue | 4 +- .../src/v2/lib/primitives/RSteps/RSteps.vue | 4 +- frontend/src/v2/lib/primitives/RTag/RTag.vue | 8 +-- .../structural/RCollapsible/RCollapsible.vue | 6 +-- .../RExpandTransition/RExpandTransition.vue | 2 +- .../src/v2/lib/structural/RList/RList.vue | 2 +- .../v2/lib/structural/RListItem/RListItem.vue | 20 ++++--- .../v2/lib/structural/RToolbar/RToolbar.vue | 8 +-- .../v2/lib/structural/RTooltip/RTooltip.vue | 14 ++--- .../RVirtualScroller/RVirtualScroller.vue | 10 ++-- frontend/src/v2/utils/playerFirmware.ts | 5 +- frontend/src/v2/utils/playerFullscreen.ts | 2 +- .../src/v2/utils/smartCollectionCriteria.ts | 4 +- frontend/src/v2/utils/soundtrackTracks.ts | 20 ++++--- frontend/src/v2/utils/tween.ts | 2 +- frontend/src/v2/views/Jukebox/BrowseMode.vue | 10 ++-- frontend/src/v2/views/Player/JsDos.test.ts | 2 +- .../src/v2/views/Settings/MetadataSources.vue | 2 +- 123 files changed, 408 insertions(+), 435 deletions(-) create mode 100644 frontend/src/v2/components/Settings/folderMappingRow.ts diff --git a/frontend/src/services/api/audit.ts b/frontend/src/services/api/audit.ts index 0f9a7cae5..ead275d27 100644 --- a/frontend/src/services/api/audit.ts +++ b/frontend/src/services/api/audit.ts @@ -5,15 +5,15 @@ import type { import api from "@/services/api"; export interface AuditEventsQuery { - actorIds?: number[]; - categories?: AuditCategory[]; - since?: string; - until?: string; - search?: string; + actorIds?: number[] | undefined; + categories?: AuditCategory[] | undefined; + since?: string | undefined; + until?: string | undefined; + search?: string | undefined; /** Pins later pages to the events the first page saw. */ - maxId?: number; - limit?: number; - offset?: number; + maxId?: number | undefined; + limit?: number | undefined; + offset?: number | undefined; } async function getAuditEvents(query: AuditEventsQuery = {}) { diff --git a/frontend/src/services/api/client-token.ts b/frontend/src/services/api/client-token.ts index 0fbf75faa..0f385b56b 100644 --- a/frontend/src/services/api/client-token.ts +++ b/frontend/src/services/api/client-token.ts @@ -33,7 +33,7 @@ async function createToken({ }: { name: string; scopes: string[]; - expires_in?: string; + expires_in?: string | undefined; }) { return api.post("/client-tokens", { name, diff --git a/frontend/src/services/api/collection.ts b/frontend/src/services/api/collection.ts index dead88e5e..00a6bc239 100644 --- a/frontend/src/services/api/collection.ts +++ b/frontend/src/services/api/collection.ts @@ -15,7 +15,7 @@ type VirtualCollection = VirtualCollectionSchema; type SmartCollection = SmartCollectionSchema; export type UpdatedCollection = Collection & { - artwork?: File; + artwork?: File | undefined; url_cover?: string | null; }; diff --git a/frontend/src/services/api/device-auth.ts b/frontend/src/services/api/device-auth.ts index a594d89a5..21b98745c 100644 --- a/frontend/src/services/api/device-auth.ts +++ b/frontend/src/services/api/device-auth.ts @@ -30,8 +30,8 @@ async function approve({ }: { userCode: string; approvedScopes: string[]; - deviceName?: string; - expiresIn?: string; + deviceName?: string | undefined; + expiresIn?: string | undefined; }) { return api.post("/auth/device/approve", { user_code: userCode, diff --git a/frontend/src/services/api/platform.ts b/frontend/src/services/api/platform.ts index 2875ebf70..61a5f4819 100644 --- a/frontend/src/services/api/platform.ts +++ b/frontend/src/services/api/platform.ts @@ -35,10 +35,10 @@ async function updatePlatform({ description, }: { platform: Platform; - description?: string; + description?: string | undefined; }) { const payload: UpdatePlatformInput = { - custom_name: platform.custom_name, + custom_name: platform.custom_name ?? null, ...(description !== undefined ? { description } : {}), }; return api.put(`/platforms/${platform.id}`, payload); diff --git a/frontend/src/services/api/rom.ts b/frontend/src/services/api/rom.ts index 3c635e44b..29dc0609d 100644 --- a/frontend/src/services/api/rom.ts +++ b/frontend/src/services/api/rom.ts @@ -49,11 +49,11 @@ async function uploadRomChunked({ platformId: number; file: File; /** Upload into this ROM's folder instead of the platform folder. */ - romId?: number; + romId?: number | undefined; /** Subfolder inside the ROM folder; empty or omitted for the root. */ - folder?: string; + folder?: string | undefined; /** Replace a file of the same name in the ROM folder. */ - overwrite?: boolean; + overwrite?: boolean | undefined; }): Promise { const uploadStore = storeUpload(); const totalChunks = Math.ceil(file.size / UPLOAD_CHUNK_SIZE); @@ -441,7 +441,7 @@ export function buildGetRomsQuery({ async function getRoms({ signal, ...params }: GetRomsParams) { return api.get(`/roms`, { params: buildGetRomsQuery(params), - signal, + ...(signal ? { signal } : {}), }); } @@ -486,7 +486,7 @@ export const RECOMMENDED_ROMS_LIMIT = 15; async function getSimilarRoms({ romId, limit = SIMILAR_ROMS_LIMIT, - signal, + ...config }: { romId: number; limit?: number; @@ -494,7 +494,7 @@ async function getSimilarRoms({ }) { return api.get(`/roms/${romId}/similar`, { params: { limit }, - signal, + ...config, }); } @@ -502,7 +502,7 @@ async function getSimilarRoms({ async function getRecommendedRoms({ limit = RECOMMENDED_ROMS_LIMIT, refresh = false, - signal, + ...config }: { limit?: number; refresh?: boolean; @@ -510,23 +510,23 @@ async function getRecommendedRoms({ } = {}) { return api.get("/recommendations", { params: { limit, ...(refresh ? { refresh: true } : {}) }, - signal, + ...config, }); } async function getRom({ romId, - signal, + ...config }: { romId: number; signal?: AbortSignal; }) { - return api.get(`/roms/${romId}`, { signal }); + return api.get(`/roms/${romId}`, config); } async function getRomSimple({ romId, - signal, + ...config }: { romId: number; signal?: AbortSignal; @@ -535,7 +535,7 @@ async function getRomSimple({ // notes / saves / states / screenshots / collections arrays. Designed // for the v2 gallery card's per-card fetch path. Detail-level data is // pulled on demand (game details page, quick-note dialog open). - return api.get(`/roms/${romId}/simple`, { signal }); + return api.get(`/roms/${romId}/simple`, config); } async function getRandomRom({ @@ -596,8 +596,8 @@ async function createPhysicalRom({ upc, }: { platformId: number; - name?: string; - upc?: string; + name?: string | undefined; + upc?: string | undefined; }) { const payload: PhysicalRomCreateForm = { platform_id: platformId, @@ -665,12 +665,12 @@ async function bulkDownloadRoms({ smartCollectionId, filename, }: { - romIDs?: number[]; - platformId?: number; - collectionId?: number; - virtualCollectionId?: string; - smartCollectionId?: number; - filename?: string; + romIDs?: number[] | undefined; + platformId?: number | undefined; + collectionId?: number | undefined; + virtualCollectionId?: string | undefined; + smartCollectionId?: number | undefined; + filename?: string | undefined; }) { const queryParams = new URLSearchParams(); if (platformId != null) { @@ -870,16 +870,14 @@ async function removeScreenshot({ async function getSoundtrackMetadata({ romId, - signal, + ...config }: { romId: number; signal?: AbortSignal; }) { return api.get( `/roms/${romId}/soundtracks/metadata`, - { - signal, - }, + config, ); } diff --git a/frontend/src/services/api/save.ts b/frontend/src/services/api/save.ts index 22640a0a4..3b9e9b43f 100644 --- a/frontend/src/services/api/save.ts +++ b/frontend/src/services/api/save.ts @@ -49,7 +49,7 @@ export function sessionScreenshotFile( type SaveUploadInput = Omit & { saveFile: File; - screenshotFile?: File; + screenshotFile?: File | undefined; }; type UpdateSaveUploadInput = Omit< @@ -57,17 +57,17 @@ type UpdateSaveUploadInput = Omit< "saveFile" | "screenshotFile" > & { saveFile: File; - screenshotFile?: File; + screenshotFile?: File | undefined; }; interface SaveVersionParams { rom: Pick; - emulator?: string; - deviceId?: string; - slot?: string; - autocleanup?: boolean; + emulator?: string | undefined; + deviceId?: string | undefined; + slot?: string | undefined; + autocleanup?: boolean | undefined; /** Skip the stale-device conflict check and the content-hash dedupe. */ - overwrite?: boolean; + overwrite?: boolean | undefined; } function saveVersionQuery({ @@ -169,7 +169,7 @@ function sendSaveOnUnload({ body: saveFormData(saveFile), keepalive: true, credentials: "same-origin", - headers: csrfToken ? { "x-csrftoken": csrfToken } : undefined, + ...(csrfToken ? { headers: { "x-csrftoken": csrfToken } } : {}), }).catch(() => undefined); return true; } diff --git a/frontend/src/services/api/state.ts b/frontend/src/services/api/state.ts index e49203e3d..a65bf5ba3 100644 --- a/frontend/src/services/api/state.ts +++ b/frontend/src/services/api/state.ts @@ -27,7 +27,7 @@ export function sessionStateFiles( capturedAt: Date, stateBytes: ArrayBuffer, screenshotBytes?: ArrayBuffer, -): { stateFile: File; screenshotFile?: File } { +): { stateFile: File; screenshotFile?: File | undefined } { const name = sessionStateName(rom, capturedAt); const type = "application/octet-stream"; return { @@ -40,7 +40,7 @@ export function sessionStateFiles( type StateUploadInput = Omit & { stateFile: File; - screenshotFile?: File; + screenshotFile?: File | undefined; }; type UpdateStateUploadInput = Omit< @@ -48,7 +48,7 @@ type UpdateStateUploadInput = Omit< "stateFile" | "screenshotFile" > & { stateFile: File; - screenshotFile?: File; + screenshotFile?: File | undefined; }; async function uploadStates({ @@ -58,7 +58,7 @@ async function uploadStates({ }: { rom: Pick; statesToUpload: StateUploadInput[]; - emulator?: string; + emulator?: string | undefined; }) { const promises = statesToUpload.map(({ stateFile, screenshotFile }) => { const formData = buildFormInput([ diff --git a/frontend/src/services/cache/api.ts b/frontend/src/services/cache/api.ts index 7cde3fd97..71c6e0503 100644 --- a/frontend/src/services/cache/api.ts +++ b/frontend/src/services/cache/api.ts @@ -1,10 +1,5 @@ // trunk-ignore-all(eslint/@typescript-eslint/no-explicit-any) -import type { - AxiosRequestConfig, - AxiosResponse, - AxiosHeaders, - Method, -} from "axios"; +import type { AxiosRequestConfig, AxiosResponse, Method } from "axios"; import type { CustomLimitOffsetPage_SimpleRomSchema_ as GetRomsResponse } from "@/__generated__/models/CustomLimitOffsetPage_SimpleRomSchema_"; import { buildGetRomsQuery, type GetRomsParams } from "@/services/api/rom"; import cacheService from "@/services/cache"; @@ -40,13 +35,11 @@ class CachedApiService { method: Method, url: string, params?: any, - headers?: AxiosHeaders, ): AxiosRequestConfig { return { method, url, params, - headers, }; } diff --git a/frontend/src/services/pending-asset.test.ts b/frontend/src/services/pending-asset.test.ts index 38e4d770e..7095e6c3d 100644 --- a/frontend/src/services/pending-asset.test.ts +++ b/frontend/src/services/pending-asset.test.ts @@ -335,7 +335,7 @@ describe("syncPendingAssets", () => { // A row from before the stem was stored asks the rom for it instead. it("names an older row's files after the rom it belongs to", async () => { - queue({ id: "save:older", fsNameNoExt: undefined, screenshotBytes: shot }); + delete queue({ id: "save:older", screenshotBytes: shot }).fsNameNoExt; await syncPendingAssets(); diff --git a/frontend/src/services/pending-asset.ts b/frontend/src/services/pending-asset.ts index d76a25f8f..ea60da5be 100644 --- a/frontend/src/services/pending-asset.ts +++ b/frontend/src/services/pending-asset.ts @@ -257,7 +257,10 @@ async function archiveSave( async function uploadSave( entry: PendingAsset, rom: { id: number; fs_name_no_ext: string }, -): Promise<{ upload?: PromiseSettledResult; archived?: true }> { +): Promise<{ + upload?: PromiseSettledResult | undefined; + archived?: true; +}> { const slot = entry.slot ?? AUTOSAVE_SLOT; const [uploaded] = await saveApi.uploadSaves({ rom, @@ -368,7 +371,7 @@ export interface SyncedAsset { kind: PendingAssetKind; romId: number; name: string; - cover?: string | null; + cover?: string | null | undefined; /** Kept as a separate save, its slot holding newer progress from another device. */ archived?: true; } diff --git a/frontend/src/stores/native.ts b/frontend/src/stores/native.ts index b40c59728..4d371ba9a 100644 --- a/frontend/src/stores/native.ts +++ b/frontend/src/stores/native.ts @@ -35,7 +35,7 @@ export type { LaunchState, PlatformSupport } from "@/types/rommNative"; export interface NativeLaunchChoice { /** The core to try first. A name the shell cannot find is one it installs, so * this is honoured even for a core the machine has never had. */ - core?: string | null; + core?: string | null | undefined; /** Whether to start the emulator fullscreen. Undefined asks for nothing, * leaving the emulator's own configuration to decide. */ fullscreen?: boolean; @@ -309,7 +309,7 @@ export const useNativeStore = defineStore("native", () => { // The page's core first: the shell installs the first candidate it // cannot find, so the rest are there for a core that is not published. cores: coresFor(rom, choice.core), - name: rom.name ?? undefined, + ...(rom.name == null ? {} : { name: rom.name }), // Sent whatever the shell advertises: an older one drops an unknown // field and starts the emulator as its own config says, which is // where it was before the page could ask. diff --git a/frontend/src/stores/roms.test.ts b/frontend/src/stores/roms.test.ts index e7c11038a..b77b7390e 100644 --- a/frontend/src/stores/roms.test.ts +++ b/frontend/src/stores/roms.test.ts @@ -1,9 +1,12 @@ import { describe, expect, it } from "vitest"; -import storeRoms, { DETAILED_ROM_CACHE_SIZE } from "@/stores/roms"; +import storeRoms, { + DETAILED_ROM_CACHE_SIZE, + type DetailedRom, +} from "@/stores/roms"; import { makeDetailedRom, makeRom } from "@/utils/rom.fixtures"; -function detailed(id: number, summary?: string) { - return makeDetailedRom({ id, name: `Game ${id}`, summary }); +function detailed(id: number, extra: Partial = {}) { + return makeDetailedRom({ id, name: `Game ${id}`, ...extra }); } describe("detailed rom cache", () => { @@ -45,7 +48,7 @@ describe("detailed rom cache", () => { it("merges a SimpleRom write over the detailed record", () => { const roms = storeRoms(); - roms.cacheDetailedRom(detailed(5, "detailed")); + roms.cacheDetailedRom(detailed(5, { summary: "detailed" })); roms.update(makeRom({ id: 5, name: "Renamed" })); diff --git a/frontend/src/stores/soundtrackPlayer.ts b/frontend/src/stores/soundtrackPlayer.ts index b9ee78e19..332aa68f0 100644 --- a/frontend/src/stores/soundtrackPlayer.ts +++ b/frontend/src/stores/soundtrackPlayer.ts @@ -22,12 +22,12 @@ type AudioTagKey = "title" | "artist" | "album" | "year" | "genre" | "track" | "disc"; export type PlayerMeta = { - [K in AudioTagKey]?: NonNullable; + [K in AudioTagKey]?: NonNullable | undefined; } & { - duration?: number; - coverUrl?: string; - folderCoverUrl?: string; - gameArtworkUrl?: string; + duration?: number | undefined; + coverUrl?: string | undefined; + folderCoverUrl?: string | undefined; + gameArtworkUrl?: string | undefined; }; export type SoundtrackArtworkRom = Pick< diff --git a/frontend/src/types/emitter.d.ts b/frontend/src/types/emitter.d.ts index c5094f334..d956a960d 100644 --- a/frontend/src/types/emitter.d.ts +++ b/frontend/src/types/emitter.d.ts @@ -10,13 +10,16 @@ import type { DetailedRom, SimpleRom } from "@/stores/roms"; import type { User } from "@/stores/users"; export type SnackbarStatus = { - id?: number; + /** Stable id: useful when deduplicating repeated notifications. */ + id?: number | undefined; msg: string; - timeout?: number; - icon?: string; - color?: string; + /** Auto-dismiss timeout in ms. Defaults to NotificationHost's 3000ms. */ + timeout?: number | undefined; + /** Override the default icon for the tone. */ + icon?: string | undefined; + color?: string | undefined; /** Artwork shown in place of the icon, e.g. the cover of the game it concerns. */ - image?: string | null; + image?: string | null | undefined; }; export type Events = { @@ -43,8 +46,8 @@ export type Events = { * through the manual-match flow. Collection-cover edits omit it. */ showSearchCoverDialog: { term: string; - platformId?: number; - rom?: SimpleRom; + platformId?: number | undefined; + rom?: SimpleRom | undefined; }; updateUrlCover: string; showEditRomDialog: SimpleRom; @@ -118,7 +121,7 @@ export type Events = { showDeleteManualDialog: { rom: DetailedRom; isPrimary: boolean; - fileId?: number; + fileId?: number | undefined; }; showManualUploadTargetDialog: { rom: DetailedRom; diff --git a/frontend/src/utils/downloadPath.ts b/frontend/src/utils/downloadPath.ts index 4c486df2c..0047b4343 100644 --- a/frontend/src/utils/downloadPath.ts +++ b/frontend/src/utils/downloadPath.ts @@ -13,7 +13,7 @@ export function getDownloadPath({ rom: SimpleRom; fileIDs?: number[]; purpose?: "play"; - format?: string; + format?: string | undefined; }) { const queryParams = new URLSearchParams(); if (fileIDs.length > 0) { diff --git a/frontend/src/v2/components/Auth/SetupStepAdmin.vue b/frontend/src/v2/components/Auth/SetupStepAdmin.vue index 2e2f1e0a6..55c2b5dd8 100644 --- a/frontend/src/v2/components/Auth/SetupStepAdmin.vue +++ b/frontend/src/v2/components/Auth/SetupStepAdmin.vue @@ -32,7 +32,7 @@ export interface AdminUserDraft { email: string; password: string; repeatPassword: string; - avatar?: File; + avatar?: File | undefined; } defineOptions({ inheritAttrs: false }); diff --git a/frontend/src/v2/components/Collections/CollectionListRow.vue b/frontend/src/v2/components/Collections/CollectionListRow.vue index 00e0ebd39..a1b315f90 100644 --- a/frontend/src/v2/components/Collections/CollectionListRow.vue +++ b/frontend/src/v2/components/Collections/CollectionListRow.vue @@ -35,7 +35,7 @@ interface Props { kind?: Kind; /** Owner-set visibility; public ones carry the globe. Virtual * collections are autogenerated and never carry a public/private state. */ - isPublic?: boolean; + isPublic?: boolean | undefined; } const props = withDefaults(defineProps(), { diff --git a/frontend/src/v2/components/Collections/CollectionPickerRow.vue b/frontend/src/v2/components/Collections/CollectionPickerRow.vue index afd54d209..0b4926532 100644 --- a/frontend/src/v2/components/Collections/CollectionPickerRow.vue +++ b/frontend/src/v2/components/Collections/CollectionPickerRow.vue @@ -20,7 +20,7 @@ interface Props { * - "some" → some are, some aren't (bulk-only, drawn with a dash) * - "all" → every selected ROM is already in this collection */ state: "off" | "some" | "all"; - isPublic?: boolean; + isPublic?: boolean | undefined; busy?: boolean; // Thumb diameter in px. Drives both the grid first-column width and // the CollectionMosaic width so the label column always lines up with diff --git a/frontend/src/v2/components/Collections/CollectionTile.vue b/frontend/src/v2/components/Collections/CollectionTile.vue index 0d65662b3..cb8a4d761 100644 --- a/frontend/src/v2/components/Collections/CollectionTile.vue +++ b/frontend/src/v2/components/Collections/CollectionTile.vue @@ -28,11 +28,11 @@ interface Props { kind?: Kind; /** Owner-set visibility; public ones carry the globe. Virtual * collections are autogenerated and never carry a public/private state. */ - isPublic?: boolean; + isPublic?: boolean | undefined; /** Stable id used to derive the shared-element morph tag. Optional: * if absent the tile still navigates but won't participate in the * morph (some callers pass a virtual/smart wrapper object). */ - id?: number | string; + id?: number | string | undefined; } const props = withDefaults(defineProps(), { diff --git a/frontend/src/v2/components/Dialogs/CreateSmartCollectionDialog.vue b/frontend/src/v2/components/Dialogs/CreateSmartCollectionDialog.vue index 53476e7d4..d29e8bd60 100644 --- a/frontend/src/v2/components/Dialogs/CreateSmartCollectionDialog.vue +++ b/frontend/src/v2/components/Dialogs/CreateSmartCollectionDialog.vue @@ -190,10 +190,11 @@ async function submit() { submitting.value = true; try { + const trimmedDescription = description.value.trim(); const data = await collectionApi.createSmartCollection({ smartCollection: { name: name.value.trim(), - description: description.value.trim() || undefined, + ...(trimmedDescription ? { description: trimmedDescription } : {}), filter_criteria: snapshot.value, is_public: isPublic.value, }, diff --git a/frontend/src/v2/components/Dialogs/RefreshMetadataDialog.vue b/frontend/src/v2/components/Dialogs/RefreshMetadataDialog.vue index f8e7e57f0..fb70abc29 100644 --- a/frontend/src/v2/components/Dialogs/RefreshMetadataDialog.vue +++ b/frontend/src/v2/components/Dialogs/RefreshMetadataDialog.vue @@ -73,7 +73,7 @@ interface ScanOption { title: string; subtitle: string; value: ScanType; - disabled?: string; + disabled?: string | undefined; } const scanOptions = computed(() => [ diff --git a/frontend/src/v2/components/Dialogs/SearchCoverDialog.vue b/frontend/src/v2/components/Dialogs/SearchCoverDialog.vue index f6766ba74..7dd48844a 100644 --- a/frontend/src/v2/components/Dialogs/SearchCoverDialog.vue +++ b/frontend/src/v2/components/Dialogs/SearchCoverDialog.vue @@ -157,14 +157,7 @@ const showNoFilterMatch = computed( () => !searching.value && hasRawResults.value && !hasResults.value, ); -function openHandler({ - term, - rom, -}: { - term: string; - platformId?: number; - rom?: SimpleRom; -}) { +function openHandler({ term, rom }: Events["showSearchCoverDialog"]) { clearDialog(); searchText.value = term; sourceRom.value = rom ?? null; diff --git a/frontend/src/v2/components/Gallery/GalleryShell.vue b/frontend/src/v2/components/Gallery/GalleryShell.vue index 6a26ea8a5..dcabded7e 100644 --- a/frontend/src/v2/components/Gallery/GalleryShell.vue +++ b/frontend/src/v2/components/Gallery/GalleryShell.vue @@ -109,7 +109,7 @@ interface Props { /** "Not found" mode: replaces all body items with a single empty row. */ notFound?: boolean; /** Override the empty-state message in not-found mode. */ - notFoundMessage?: string; + notFoundMessage?: string | undefined; /** Whether GameCards should display the platform badge corner (Search / * Collection: yes; Platform: no, since the cards already share a platform). */ showPlatformBadge?: boolean; diff --git a/frontend/src/v2/components/Gallery/GalleryToolbar.vue b/frontend/src/v2/components/Gallery/GalleryToolbar.vue index 099c8d5a7..7f0e09a8a 100644 --- a/frontend/src/v2/components/Gallery/GalleryToolbar.vue +++ b/frontend/src/v2/components/Gallery/GalleryToolbar.vue @@ -85,7 +85,7 @@ const props = withDefaults( sortKeyItems?: readonly SortOption[]; /** Offers the gallery's order without a sort key (Search's relevance) * under this name; it has no direction, so the toggle hides under it. */ - unsortedLabel?: string; + unsortedLabel?: string | undefined; /** Whether that order is the one applied. */ unsorted?: boolean; /** Show the search field on the left. v-model:search controls its value. */ diff --git a/frontend/src/v2/components/Gallery/GameListHeader.vue b/frontend/src/v2/components/Gallery/GameListHeader.vue index 12416c66f..f1bac95dd 100644 --- a/frontend/src/v2/components/Gallery/GameListHeader.vue +++ b/frontend/src/v2/components/Gallery/GameListHeader.vue @@ -39,7 +39,7 @@ interface Props { showPlatformColumn?: boolean; /** Names the gallery's order without a sort key (Search's relevance), and * lets a third click on a column return to it. */ - unsortedLabel?: string; + unsortedLabel?: string | undefined; /** Whether that order is the one applied. */ unsorted?: boolean; } diff --git a/frontend/src/v2/components/Gallery/GameListRow.vue b/frontend/src/v2/components/Gallery/GameListRow.vue index 1f8b1960e..2af0e9e8f 100644 --- a/frontend/src/v2/components/Gallery/GameListRow.vue +++ b/frontend/src/v2/components/Gallery/GameListRow.vue @@ -63,11 +63,11 @@ interface Props { /** Absolute position in the active gallery (0-indexed). Serves as the * lookup key into the store's `byPosition` map; the shell drives the * windowed fetch that fills it. Pass either this or `rom`, not both. */ - position?: number; + position?: number | undefined; /** Static ROM data: used by non-gallery surfaces (Settings → Missing * games) that already own the rom list. When provided, the row skips * the galleryRoms position lookup. */ - rom?: SimpleRom | null; + rom?: SimpleRom | null | undefined; /** Cover variant: when the browser supports webp the thumb URL is * rewritten to .webp before the request. Wired from the shell so the * choice is decided once per gallery render, not per row. */ diff --git a/frontend/src/v2/components/Gallery/InfoPanel.vue b/frontend/src/v2/components/Gallery/InfoPanel.vue index a47341580..7db988b61 100644 --- a/frontend/src/v2/components/Gallery/InfoPanel.vue +++ b/frontend/src/v2/components/Gallery/InfoPanel.vue @@ -20,7 +20,7 @@ defineOptions({ inheritAttrs: false }); withDefaults( defineProps<{ - title?: string; + title?: string | undefined; }>(), { title: undefined, diff --git a/frontend/src/v2/components/Gallery/SettingsTab.vue b/frontend/src/v2/components/Gallery/SettingsTab.vue index 973f1766f..58729e733 100644 --- a/frontend/src/v2/components/Gallery/SettingsTab.vue +++ b/frontend/src/v2/components/Gallery/SettingsTab.vue @@ -91,12 +91,9 @@ async function save() { try { // Send each field only when it actually changed. const { data } = await platformApi.updatePlatform({ - platform: { - ...props.platform, - custom_name: nameDirty.value - ? customName.value.trim() - : props.platform.custom_name, - }, + platform: nameDirty.value + ? { ...props.platform, custom_name: customName.value.trim() } + : props.platform, description: descriptionDirty.value ? description.value.trim() : undefined, diff --git a/frontend/src/v2/components/GameCard/GameCard.vue b/frontend/src/v2/components/GameCard/GameCard.vue index 680820f68..356b7ea7e 100644 --- a/frontend/src/v2/components/GameCard/GameCard.vue +++ b/frontend/src/v2/components/GameCard/GameCard.vue @@ -65,7 +65,7 @@ defineOptions({ inheritAttrs: false }); interface Props { rom: SimpleRom; - to?: string; + to?: string | undefined; hero?: boolean; /** Card scale tier. Drives the cover art width/height via the shared * `--r-card-art-w/h` tokens, and the hero variant's `--r-hero-w/h` @@ -105,7 +105,7 @@ interface Props { /** Override the resolved cover URL. Used for local preview blobs * (edit dialog) and external provider URLs (match dialog source * variants). Bypasses the path/webp/url_cover chain. */ - coverSrc?: string | null; + coverSrc?: string | null | undefined; /** When a `coverSrc` override is shown (e.g. the continue-playing * screenshot), float a small 2D cover-art thumbnail in the bottom-right * corner so the game stays identifiable. No-op without a `coverSrc`. */ @@ -116,7 +116,7 @@ interface Props { * `gallerySelection` so a single source of truth (the store) * drives every selected card across the gallery. Left unset, a static * card gets no `aria-pressed`. */ - selected?: boolean; + selected?: boolean | undefined; /** Opt the card into the gallery's multi-select store. When true: * the card reads its selected state from `gallerySelection`, * shows a checkbox affordance (on hover or whenever the gallery @@ -130,7 +130,7 @@ interface Props { * shift-range selection uses. Provided by `GalleryShell`. Required * when `selectable` is true (the composable needs a position to * store/restore the range anchor). */ - position?: number; + position?: number | undefined; } const props = withDefaults(defineProps(), { diff --git a/frontend/src/v2/components/GameDetails/AchievementsTab.vue b/frontend/src/v2/components/GameDetails/AchievementsTab.vue index 218b1c028..42cf84650 100644 --- a/frontend/src/v2/components/GameDetails/AchievementsTab.vue +++ b/frontend/src/v2/components/GameDetails/AchievementsTab.vue @@ -15,7 +15,7 @@ const { t } = useI18n(); const props = withDefaults( defineProps<{ metadata: RomRAMetadata | null | undefined; - apiBase?: string; + apiBase?: string | undefined; earnedAchievementIds?: ReadonlySet; }>(), { diff --git a/frontend/src/v2/components/GameDetails/AgeRatingBadges.vue b/frontend/src/v2/components/GameDetails/AgeRatingBadges.vue index cbacc970b..5471de85a 100644 --- a/frontend/src/v2/components/GameDetails/AgeRatingBadges.vue +++ b/frontend/src/v2/components/GameDetails/AgeRatingBadges.vue @@ -40,7 +40,7 @@ const CATEGORY_SLUG: Record = { type Badge = { rating: string; category: string; - rating_cover_url?: string; + rating_cover_url?: string | undefined; }; // IGDB icon URLs use lowercased rating codes with "+" stripped diff --git a/frontend/src/v2/components/GameDetails/MarkdownViewer.vue b/frontend/src/v2/components/GameDetails/MarkdownViewer.vue index 42207f1df..74f56a3e4 100644 --- a/frontend/src/v2/components/GameDetails/MarkdownViewer.vue +++ b/frontend/src/v2/components/GameDetails/MarkdownViewer.vue @@ -24,7 +24,7 @@ const props = defineProps<{ /** ROM id + file id persist the reading position; without them the progress * bar still tracks the session's scroll. */ romId?: number; - fileId?: number; + fileId?: number | undefined; /** Show a danger-tinted delete button at the end of the toolbar. */ deletable?: boolean; /** Show a re-download button when a scraped source URL exists. */ diff --git a/frontend/src/v2/components/GameDetails/MediaShelf.vue b/frontend/src/v2/components/GameDetails/MediaShelf.vue index f2d7a16ef..76cf68d9a 100644 --- a/frontend/src/v2/components/GameDetails/MediaShelf.vue +++ b/frontend/src/v2/components/GameDetails/MediaShelf.vue @@ -19,7 +19,7 @@ const props = defineProps<{ items: MediaShelfItem[]; captions?: boolean; compact?: boolean; - isPinned?: (key: string) => boolean; + isPinned?: ((key: string) => boolean) | undefined; }>(); const emit = defineEmits<{ "toggle-pin": [key: string] }>(); diff --git a/frontend/src/v2/components/GameDetails/PdfViewer.vue b/frontend/src/v2/components/GameDetails/PdfViewer.vue index 1cc16c188..7d79cb2f1 100644 --- a/frontend/src/v2/components/GameDetails/PdfViewer.vue +++ b/frontend/src/v2/components/GameDetails/PdfViewer.vue @@ -20,7 +20,7 @@ const props = defineProps<{ /** ROM id + file id persist the reading position; without them the progress * bar still tracks the session's page. */ romId?: number; - fileId?: number; + fileId?: number | undefined; /** Show a danger-tinted delete button at the end of the toolbar. */ deletable?: boolean; /** Show a re-download button (next to Download) when a scraped source diff --git a/frontend/src/v2/components/GameDetails/ScreenshotsTab.vue b/frontend/src/v2/components/GameDetails/ScreenshotsTab.vue index cb4760962..11e054bd4 100644 --- a/frontend/src/v2/components/GameDetails/ScreenshotsTab.vue +++ b/frontend/src/v2/components/GameDetails/ScreenshotsTab.vue @@ -24,20 +24,20 @@ defineOptions({ inheritAttrs: false }); export type ScreenshotItem = { url: string; pinKey: string; - id?: number; - isOwn?: boolean; - isPublic?: boolean; - username?: string; - userId?: number | null; - userAvatarPath?: string | null; - userUpdatedAt?: string | null; + id?: number | undefined; + isOwn?: boolean | undefined; + isPublic?: boolean | undefined; + username?: string | undefined; + userId?: number | null | undefined; + userAvatarPath?: string | null | undefined; + userUpdatedAt?: string | null | undefined; }; const props = defineProps<{ screenshots: ScreenshotItem[]; deletable?: boolean; editable?: boolean; - isPinned?: (key: string) => boolean; + isPinned?: ((key: string) => boolean) | undefined; }>(); const emit = defineEmits<{ edit: [shot: ScreenshotItem]; diff --git a/frontend/src/v2/components/GameDetails/TextViewer.vue b/frontend/src/v2/components/GameDetails/TextViewer.vue index 18c2ac329..e435ec496 100644 --- a/frontend/src/v2/components/GameDetails/TextViewer.vue +++ b/frontend/src/v2/components/GameDetails/TextViewer.vue @@ -22,7 +22,7 @@ const props = defineProps<{ /** ROM id + file id persist the reading position; without them the progress * bar still tracks the session's scroll. */ romId?: number; - fileId?: number; + fileId?: number | undefined; /** Show a danger-tinted delete button at the end of the toolbar. */ deletable?: boolean; }>(); diff --git a/frontend/src/v2/components/Home/LiveSessionCard.vue b/frontend/src/v2/components/Home/LiveSessionCard.vue index c4c7229e6..5606e054d 100644 --- a/frontend/src/v2/components/Home/LiveSessionCard.vue +++ b/frontend/src/v2/components/Home/LiveSessionCard.vue @@ -12,7 +12,7 @@ import { useJoinStreamConfirm } from "@/v2/composables/useJoinStreamConfirm"; interface Props { session: JoinableSession; - webp?: boolean; + webp?: boolean | undefined; } const props = withDefaults(defineProps(), { diff --git a/frontend/src/v2/components/Notifications/NotificationHost.vue b/frontend/src/v2/components/Notifications/NotificationHost.vue index 64d938a11..a9cec7e6f 100644 --- a/frontend/src/v2/components/Notifications/NotificationHost.vue +++ b/frontend/src/v2/components/Notifications/NotificationHost.vue @@ -21,10 +21,10 @@ const { t } = useI18n(); type Toast = { id: number; msg: string; - icon?: string; - image?: string | null; + icon?: string | undefined; + image?: string | null | undefined; tone: SnackbarTone; - timer?: number; + timer?: number | undefined; }; const toasts = ref([]); diff --git a/frontend/src/v2/components/Platforms/PlatformListRow.vue b/frontend/src/v2/components/Platforms/PlatformListRow.vue index 773402458..09b72ff34 100644 --- a/frontend/src/v2/components/Platforms/PlatformListRow.vue +++ b/frontend/src/v2/components/Platforms/PlatformListRow.vue @@ -29,7 +29,7 @@ defineOptions({ inheritAttrs: false }); interface Props { id: number | string; slug: string; - fsSlug?: string; + fsSlug?: string | undefined; displayName: string; romCount?: number | null; /** Optional metadata: same axes the toolbar can group by. Each diff --git a/frontend/src/v2/components/Platforms/PlatformTile.vue b/frontend/src/v2/components/Platforms/PlatformTile.vue index fd982fcf6..c6650b37a 100644 --- a/frontend/src/v2/components/Platforms/PlatformTile.vue +++ b/frontend/src/v2/components/Platforms/PlatformTile.vue @@ -22,12 +22,12 @@ interface Props { /** Platform slug used to pick the shipped icon. */ slug: string; /** Filesystem slug, used when no icon ships for `slug`. */ - fsSlug?: string; + fsSlug?: string | undefined; displayName: string; romCount?: number | null; /** Override destination; otherwise derived from `id`. */ - to?: string | object; - id?: number | string; + to?: string | object | undefined; + id?: number | string | undefined; variant?: Variant; } diff --git a/frontend/src/v2/components/Player/MemoryCardDialog.vue b/frontend/src/v2/components/Player/MemoryCardDialog.vue index fa5585758..84ba9c623 100644 --- a/frontend/src/v2/components/Player/MemoryCardDialog.vue +++ b/frontend/src/v2/components/Player/MemoryCardDialog.vue @@ -23,7 +23,7 @@ const props = withDefaults( initialName?: string; initialPublic?: boolean; icon?: string; - confirmIcon?: string; + confirmIcon?: string | undefined; busy?: boolean; }>(), { diff --git a/frontend/src/v2/components/Scan/ScanProviderSelect.vue b/frontend/src/v2/components/Scan/ScanProviderSelect.vue index c2fb3d462..0f09198ce 100644 --- a/frontend/src/v2/components/Scan/ScanProviderSelect.vue +++ b/frontend/src/v2/components/Scan/ScanProviderSelect.vue @@ -13,7 +13,7 @@ withDefaults( label: string; icon: string; launchboxSelected?: boolean; - launchboxRemote?: boolean; + launchboxRemote?: boolean | undefined; }>(), // An explicit undefined stops Vue casting an unbound boolean prop to false. { launchboxSelected: false, launchboxRemote: undefined }, diff --git a/frontend/src/v2/components/Settings/EditUserDialog.vue b/frontend/src/v2/components/Settings/EditUserDialog.vue index cc4b8effd..d2cddd121 100644 --- a/frontend/src/v2/components/Settings/EditUserDialog.vue +++ b/frontend/src/v2/components/Settings/EditUserDialog.vue @@ -204,7 +204,7 @@ async function save() { const { data } = await userApi.updateUser(user.value); // Group, overrides and hidden entities apply to non-admins (admins bypass). - let nextGroupId = data.permission_group_id; + let nextUser = data; if (!isAdmin.value) { const groupChanged = groupId.value !== originalGroupId.value; const overridesChanged = @@ -213,9 +213,11 @@ async function save() { await permissionsApi.updateUserPermissions(userId, { set_group: groupChanged, permission_group_id: groupId.value, - overrides: overridesChanged ? overrides.value : undefined, + overrides: overridesChanged ? overrides.value : null, }); - if (groupChanged) nextGroupId = groupId.value; + if (groupChanged) { + nextUser = { ...data, permission_group_id: groupId.value }; + } } await Promise.all([ ...diffHidden( @@ -236,7 +238,7 @@ async function save() { snackbar.success(t("settings.user-updated", { username: data.username }), { icon: "mdi-check-bold", }); - usersStore.update({ ...data, permission_group_id: nextGroupId }); + usersStore.update(nextUser); if (data.id === auth.user?.id) auth.setCurrentUser(data); emitter?.emit("refreshDrawer", null); show.value = false; diff --git a/frontend/src/v2/components/Settings/FolderMappingPlatformCell.vue b/frontend/src/v2/components/Settings/FolderMappingPlatformCell.vue index a1626259e..b783c4481 100644 --- a/frontend/src/v2/components/Settings/FolderMappingPlatformCell.vue +++ b/frontend/src/v2/components/Settings/FolderMappingPlatformCell.vue @@ -16,18 +16,10 @@ import { RIcon } from "@v2/lib"; import { computed } from "vue"; import { useI18n } from "vue-i18n"; import type { Platform } from "@/stores/platforms"; +import type { Row } from "@/v2/components/Settings/folderMappingRow"; import CachedPlatformIcon from "@/v2/components/shared/CachedPlatformIcon.vue"; import PlatformSelect from "@/v2/components/shared/PlatformSelect.vue"; -type RowType = "alias" | "variant" | "auto" | null; - -interface Row { - fsSlug: string; - slug?: string; - displayName?: string; - type: RowType; -} - interface Props { row: Row; supportedPlatforms: Platform[]; diff --git a/frontend/src/v2/components/Settings/FolderMappingTypeCell.vue b/frontend/src/v2/components/Settings/FolderMappingTypeCell.vue index 4bf6bba81..d6c083d28 100644 --- a/frontend/src/v2/components/Settings/FolderMappingTypeCell.vue +++ b/frontend/src/v2/components/Settings/FolderMappingTypeCell.vue @@ -22,8 +22,7 @@ import { RIcon, RSelect, RTag } from "@v2/lib"; import { computed } from "vue"; import { useI18n } from "vue-i18n"; - -type RowType = "alias" | "variant" | "auto" | null; +import type { Row } from "@/v2/components/Settings/folderMappingRow"; interface TypeItem { value: "alias" | "variant"; @@ -32,7 +31,7 @@ interface TypeItem { } interface Props { - row: { fsSlug: string; slug?: string; displayName?: string; type: RowType }; + row: Row; canEdit: boolean; } const props = defineProps(); diff --git a/frontend/src/v2/components/Settings/FolderMappingsSection.test.ts b/frontend/src/v2/components/Settings/FolderMappingsSection.test.ts index 77fbcc73b..9614c1ca8 100644 --- a/frontend/src/v2/components/Settings/FolderMappingsSection.test.ts +++ b/frontend/src/v2/components/Settings/FolderMappingsSection.test.ts @@ -4,6 +4,7 @@ import storeAuth from "@/stores/auth"; import storeConfig from "@/stores/config"; import storeHeartbeat from "@/stores/heartbeat"; import FolderMappingsSection from "./FolderMappingsSection.vue"; +import type { Row } from "./folderMappingRow"; const { getSupportedPlatforms, @@ -46,13 +47,6 @@ vi.mock("@/v2/composables/usePlatformIconCache", () => ({ const N64 = { id: 1, slug: "n64", name: "Nintendo 64", display_name: "N64" }; const PS2 = { id: 2, slug: "ps2", name: "PlayStation 2", display_name: "PS2" }; -interface Row { - fsSlug: string; - slug?: string; - displayName?: string; - type: "alias" | "variant" | "auto" | null; -} - // Exposes the built rows and renders the Platform cell the edit actions hang off. const RTableStub = { name: "RTable", diff --git a/frontend/src/v2/components/Settings/FolderMappingsSection.vue b/frontend/src/v2/components/Settings/FolderMappingsSection.vue index beefde9d4..bcf074b2b 100644 --- a/frontend/src/v2/components/Settings/FolderMappingsSection.vue +++ b/frontend/src/v2/components/Settings/FolderMappingsSection.vue @@ -30,6 +30,7 @@ import storeHeartbeat from "@/stores/heartbeat"; import type { Platform } from "@/stores/platforms"; import FolderMappingPlatformCell from "@/v2/components/Settings/FolderMappingPlatformCell.vue"; import FolderMappingTypeCell from "@/v2/components/Settings/FolderMappingTypeCell.vue"; +import type { Row, RowType } from "@/v2/components/Settings/folderMappingRow"; import { prefetchPlatformIcons } from "@/v2/composables/usePlatformIconCache"; import { useSnackbar } from "@/v2/composables/useSnackbar"; @@ -47,19 +48,11 @@ const search = ref(""); const loading = ref(false); const helpOpen = ref(false); -type RowType = "alias" | "variant" | "auto" | null; type SortKey = "fsSlug" | "displayName" | "type"; const sortKey = ref("fsSlug"); const sortDir = ref<"asc" | "desc">("asc"); -interface Row { - fsSlug: string; - slug?: string; - displayName?: string; - type: RowType; -} - const TYPE_ORDER: Record | "none", number> = { alias: 0, variant: 1, diff --git a/frontend/src/v2/components/Settings/ScanPriorityList.vue b/frontend/src/v2/components/Settings/ScanPriorityList.vue index 7898fbe21..b18a383c9 100644 --- a/frontend/src/v2/components/Settings/ScanPriorityList.vue +++ b/frontend/src/v2/components/Settings/ScanPriorityList.vue @@ -30,7 +30,7 @@ const props = withDefaults( /** Accept typed values outside `sources`, which become suggestions. */ allowCustom?: boolean; /** Placeholder for the free-text input shown with `allow-custom`. */ - inputPlaceholder?: string; + inputPlaceholder?: string | undefined; }>(), { disabled: false, allowCustom: false, inputPlaceholder: undefined }, ); diff --git a/frontend/src/v2/components/Settings/SettingsToggleRow.vue b/frontend/src/v2/components/Settings/SettingsToggleRow.vue index bd6abc535..fa1bbfa86 100644 --- a/frontend/src/v2/components/Settings/SettingsToggleRow.vue +++ b/frontend/src/v2/components/Settings/SettingsToggleRow.vue @@ -15,7 +15,7 @@ defineOptions({ inheritAttrs: false }); interface Props { modelValue: boolean; title: string; - description?: string; + description?: string | undefined; disabled?: boolean; } diff --git a/frontend/src/v2/components/Settings/folderMappingRow.ts b/frontend/src/v2/components/Settings/folderMappingRow.ts new file mode 100644 index 000000000..26ca8b8f9 --- /dev/null +++ b/frontend/src/v2/components/Settings/folderMappingRow.ts @@ -0,0 +1,8 @@ +export type RowType = "alias" | "variant" | "auto" | null; + +export interface Row { + fsSlug: string; + slug?: string | undefined; + displayName?: string | undefined; + type: RowType; +} diff --git a/frontend/src/v2/components/Soundtrack/NowPlayingCard.vue b/frontend/src/v2/components/Soundtrack/NowPlayingCard.vue index 1df7510e2..48fa2ff41 100644 --- a/frontend/src/v2/components/Soundtrack/NowPlayingCard.vue +++ b/frontend/src/v2/components/Soundtrack/NowPlayingCard.vue @@ -72,7 +72,7 @@ function openRom() {

{{ title }}

{{ caption }}

(), { favorite: false, size: 14 }, diff --git a/frontend/src/v2/components/shared/AssetStrip.vue b/frontend/src/v2/components/shared/AssetStrip.vue index 4d5ba9c00..773fe175d 100644 --- a/frontend/src/v2/components/shared/AssetStrip.vue +++ b/frontend/src/v2/components/shared/AssetStrip.vue @@ -46,8 +46,8 @@ const props = withDefaults( markPublic?: boolean; layout?: AssetLayout; /** Why an asset cannot be picked here; a reason disables its tile. */ - disabledReason?: (asset: Asset) => string | null; - groupBy?: "emulator"; + disabledReason?: ((asset: Asset) => string | null) | undefined; + groupBy?: "emulator" | undefined; /** Manage mode: lead each tile with a checkbox for bulk actions. Distinct * from `selectable`, which is the player's single-asset picker. */ checkable?: boolean; diff --git a/frontend/src/v2/components/shared/AuthBackLink.vue b/frontend/src/v2/components/shared/AuthBackLink.vue index 53a9992f2..a01391dab 100644 --- a/frontend/src/v2/components/shared/AuthBackLink.vue +++ b/frontend/src/v2/components/shared/AuthBackLink.vue @@ -9,7 +9,7 @@ defineOptions({ inheritAttrs: false }); withDefaults( defineProps<{ to?: string; - label?: string; + label?: string | undefined; }>(), { to: "/login", diff --git a/frontend/src/v2/components/shared/BackBtn.vue b/frontend/src/v2/components/shared/BackBtn.vue index 433c3f3d1..4d81f756d 100644 --- a/frontend/src/v2/components/shared/BackBtn.vue +++ b/frontend/src/v2/components/shared/BackBtn.vue @@ -10,7 +10,7 @@ defineOptions({ inheritAttrs: false }); interface Props { label?: string; - to?: string | object; + to?: string | object | undefined; } const props = withDefaults(defineProps(), { diff --git a/frontend/src/v2/components/shared/CardRow.vue b/frontend/src/v2/components/shared/CardRow.vue index af9528301..102f3c28a 100644 --- a/frontend/src/v2/components/shared/CardRow.vue +++ b/frontend/src/v2/components/shared/CardRow.vue @@ -21,8 +21,8 @@ defineOptions({ inheritAttrs: false }); const { t } = useI18n(); interface Props { - title?: string; - count?: number | string; + title?: string | undefined; + count?: number | string | undefined; /** Horizontal gap between children in the scroll track. */ gap?: string; /** Title font size: defaults to 14.5px. Accepts any CSS length. */ diff --git a/frontend/src/v2/components/shared/CoverArtPip.vue b/frontend/src/v2/components/shared/CoverArtPip.vue index 48ded614d..fce1bbd47 100644 --- a/frontend/src/v2/components/shared/CoverArtPip.vue +++ b/frontend/src/v2/components/shared/CoverArtPip.vue @@ -16,11 +16,11 @@ interface Props { /** The rom whose cover to resolve (gallery cards have the full rom). */ rom?: CoverArtRom | null; /** Explicit cover URL, for surfaces that only have the path (activity). */ - coverSrc?: string | null; + coverSrc?: string | null | undefined; /** Alt / placeholder text for the inner cover. */ title?: string; /** Webp override, forwarded to GameCover. */ - webp?: boolean; + webp?: boolean | undefined; } withDefaults(defineProps(), { diff --git a/frontend/src/v2/components/shared/GameCover.vue b/frontend/src/v2/components/shared/GameCover.vue index 109fe9eb1..c925dfe57 100644 --- a/frontend/src/v2/components/shared/GameCover.vue +++ b/frontend/src/v2/components/shared/GameCover.vue @@ -52,14 +52,14 @@ interface Props { identified?: boolean; /** Explicit cover URL override (preview blobs, external provider art). * Renders as plain box art regardless of the gallery style. */ - coverSrc?: string | null; + coverSrc?: string | null | undefined; /** Force a specific boxart style (defaults to the gallery preference). */ - forceStyle?: BoxartStyle; + forceStyle?: BoxartStyle | undefined; /** The surface this cover renders on, picks up the per-context * boxart-style override (details / play pages). */ - styleContext?: BoxartContext; + styleContext?: BoxartContext | undefined; /** Webp override; falls back to `useWebpSupport`. */ - webp?: boolean; + webp?: boolean | undefined; /** External hover/focus state → drives spin + hover video. The surface * that owns interactivity (GameCard) passes this. */ active?: boolean; diff --git a/frontend/src/v2/components/shared/ListSortMenu.vue b/frontend/src/v2/components/shared/ListSortMenu.vue index 48ccc9e88..112ff8a53 100644 --- a/frontend/src/v2/components/shared/ListSortMenu.vue +++ b/frontend/src/v2/components/shared/ListSortMenu.vue @@ -12,7 +12,7 @@ const props = defineProps<{ sortKey: K | null; sortDir: "asc" | "desc"; /** Offers the list's order without a sort key (Search's relevance) under this name. */ - unsortedLabel?: string; + unsortedLabel?: string | undefined; /** Whether that order is the one applied. */ unsorted?: boolean; }>(); diff --git a/frontend/src/v2/components/shared/MetadataProviderCard/MetadataProviderCard.vue b/frontend/src/v2/components/shared/MetadataProviderCard/MetadataProviderCard.vue index 33df91f66..8d392a3a3 100644 --- a/frontend/src/v2/components/shared/MetadataProviderCard/MetadataProviderCard.vue +++ b/frontend/src/v2/components/shared/MetadataProviderCard/MetadataProviderCard.vue @@ -23,12 +23,12 @@ interface Props { * by headings (the scan reference dialog) pass a heading level. */ nameTag?: "span" | "h3" | "h4"; /** Small uppercase descriptor under the name (tile layout). */ - subtitle?: string; - status?: ProviderCardStatus; + subtitle?: string | undefined; + status?: ProviderCardStatus | undefined; /** Mono pill with the env-var / config instructions. */ - setupHint?: string; + setupHint?: string | undefined; /** Warning-tinted pill for a provider caveat. */ - caveat?: string; + caveat?: string | undefined; /** Faded look for a provider that is disabled / not configured. */ dimmed?: boolean; } diff --git a/frontend/src/v2/components/shared/PasswordField.vue b/frontend/src/v2/components/shared/PasswordField.vue index 8bac58ebd..2b280fcb3 100644 --- a/frontend/src/v2/components/shared/PasswordField.vue +++ b/frontend/src/v2/components/shared/PasswordField.vue @@ -17,12 +17,12 @@ defineOptions({ inheritAttrs: false }); const props = withDefaults( defineProps<{ modelValue?: string; - label?: string; + label?: string | undefined; autocomplete?: string; disabled?: boolean; // eslint-disable-next-line @typescript-eslint/no-explicit-any - rules?: Array<(value: any) => true | string>; - prependInnerIcon?: string; + rules?: Array<(value: any) => true | string> | undefined; + prependInnerIcon?: string | undefined; variant?: "outlined" | "filled" | "underlined" | "plain"; }>(), { diff --git a/frontend/src/v2/components/shared/PlatformIcon.vue b/frontend/src/v2/components/shared/PlatformIcon.vue index e8580caff..fbbbfefd2 100644 --- a/frontend/src/v2/components/shared/PlatformIcon.vue +++ b/frontend/src/v2/components/shared/PlatformIcon.vue @@ -14,17 +14,17 @@ defineOptions({ inheritAttrs: false }); interface Props { /** Primary slug (platform.name in the stores). */ - name?: string; + name?: string | undefined; /** Alias for `name`. */ - slug?: string; + slug?: string | undefined; /** Filesystem slug, tried only when no icon ships for `slug`. */ - fsSlug?: string; + fsSlug?: string | undefined; /** Explicit override. */ - src?: string; + src?: string | undefined; size?: number | string; alt?: string; /** Tooltip text override. Falls back to `alt`. */ - title?: string; + title?: string | undefined; /** Show RTooltip on hover (default `true`). */ showTooltip?: boolean; } diff --git a/frontend/src/v2/components/shared/PlatformSelect.vue b/frontend/src/v2/components/shared/PlatformSelect.vue index 63ccaedda..3341c63b0 100644 --- a/frontend/src/v2/components/shared/PlatformSelect.vue +++ b/frontend/src/v2/components/shared/PlatformSelect.vue @@ -96,7 +96,7 @@ type ClearableAllowed = null extends Model : false; interface Props { - modelValue?: Model; + modelValue?: Model | undefined; items: Platform[]; /** Which Platform field the v-model binds to. Default `id`. * `slug` is used by FolderMapping (the table works in slug space) @@ -113,22 +113,22 @@ interface Props { closableChips?: boolean; disabled?: boolean; loading?: boolean; - label?: string; - placeholder?: string; + label?: string | undefined; + placeholder?: string | undefined; /** Games-first menu + divider until the user types in panel search. Default false. */ promoteFilled?: boolean; - searchPlaceholder?: string; + searchPlaceholder?: string | undefined; variant?: "outlined" | "filled" | "underlined" | "plain"; density?: "default" | "comfortable" | "compact"; hideDetails?: boolean | "auto"; - prefixLabel?: "stacked" | "inline"; - prependInnerIcon?: string; + prefixLabel?: "stacked" | "inline" | undefined; + prependInnerIcon?: string | undefined; /** Scan-style rich row: category icon, family, missing-fs, rom-count. */ showMeta?: boolean; /** Never-scanned folders. */ markUnscanned?: boolean; /** Label for the never-scanned marker */ - unscannedLabel?: string; + unscannedLabel?: string | undefined; /** Icon size inside list rows. Defaults to 28 (Scan uses 32, dialogs 22-24). */ iconSize?: number; } diff --git a/frontend/src/v2/components/shared/RecommendationReason.vue b/frontend/src/v2/components/shared/RecommendationReason.vue index 9ab4eceda..2b8476285 100644 --- a/frontend/src/v2/components/shared/RecommendationReason.vue +++ b/frontend/src/v2/components/shared/RecommendationReason.vue @@ -10,7 +10,7 @@ import { reasonIcon, reasonLabel } from "@/v2/utils/similarityReasons"; const props = defineProps<{ reasons: SimilarityReasonSchema[]; // Captions the card in place of the first facet. - seedRomName?: string | null; + seedRomName?: string | null | undefined; }>(); const { t } = useI18n(); diff --git a/frontend/src/v2/components/shared/Stat.vue b/frontend/src/v2/components/shared/Stat.vue index b4b93ff36..bc85aae40 100644 --- a/frontend/src/v2/components/shared/Stat.vue +++ b/frontend/src/v2/components/shared/Stat.vue @@ -7,8 +7,8 @@ import { useAnimatedNumber } from "@/v2/composables/useAnimatedNumber"; defineOptions({ inheritAttrs: false }); interface Props { - value?: string | number; - label?: string; + value?: string | number | undefined; + label?: string | undefined; } const props = withDefaults(defineProps(), { diff --git a/frontend/src/v2/components/shared/Tile.vue b/frontend/src/v2/components/shared/Tile.vue index 8a0fb37cf..08f7e9130 100644 --- a/frontend/src/v2/components/shared/Tile.vue +++ b/frontend/src/v2/components/shared/Tile.vue @@ -9,12 +9,12 @@ defineOptions({ inheritAttrs: false }); const props = withDefaults( defineProps<{ /** Renders a router-link when set, a button otherwise. */ - to?: RouteLocationRaw; + to?: RouteLocationRaw | undefined; /** `comfortable` for platform tiles, `compact` for the jukebox's. */ density?: "comfortable" | "compact"; /** Fixed-width tile for horizontal card rows. */ row?: boolean; - focusKey?: string; + focusKey?: string | undefined; }>(), { to: undefined, density: "comfortable", row: true, focusKey: undefined }, ); diff --git a/frontend/src/v2/composables/useCoverArt/index.ts b/frontend/src/v2/composables/useCoverArt/index.ts index 81b2f0e6c..0e13741e0 100644 --- a/frontend/src/v2/composables/useCoverArt/index.ts +++ b/frontend/src/v2/composables/useCoverArt/index.ts @@ -175,7 +175,7 @@ interface ComputeOptions { /** Explicit cover URL that bypasses the resolution chain (preview * blobs, external provider URLs). Treated as final: no webp rewrite, * no alt-art swap. */ - coverSrc?: string | null; + coverSrc?: string | null | undefined; } /** Pure resolution core: no Vue, no stores. Exported for unit tests and @@ -233,7 +233,7 @@ export function computeCoverArt( export interface UseCoverArtOptions { /** Override the gallery-wide `boxartStyle` preference (stories, * pickers that always show box art). */ - forceStyle?: MaybeRefOrGetter; + forceStyle?: MaybeRefOrGetter | undefined; /** The surface this cover renders on: resolves the per-context * boxart-style override (details / play pages). Defaults to the * gallery-wide preference. `forceStyle` still wins. */ diff --git a/frontend/src/v2/composables/useGalleryVirtualItems/index.ts b/frontend/src/v2/composables/useGalleryVirtualItems/index.ts index 9f47fb91f..0584e3131 100644 --- a/frontend/src/v2/composables/useGalleryVirtualItems/index.ts +++ b/frontend/src/v2/composables/useGalleryVirtualItems/index.ts @@ -154,7 +154,7 @@ interface Options { * with no artwork paints its placeholder at that ratio and never * measures, and one waiting on its image paints there until it loads. * Defaults to box art (2/3). */ - fallbackRatio?: MaybeRefOrGetter; + fallbackRatio?: MaybeRefOrGetter | undefined; /** Bump to force a re-pack when measured ratios change (Vue tracks it). */ ratioVersion?: Ref | ComputedRef; /** Px of detail panel the list row at `position` settles at (0 for the diff --git a/frontend/src/v2/composables/useGamepad/index.ts b/frontend/src/v2/composables/useGamepad/index.ts index 3d2abcc30..2e21358e3 100644 --- a/frontend/src/v2/composables/useGamepad/index.ts +++ b/frontend/src/v2/composables/useGamepad/index.ts @@ -101,7 +101,7 @@ declare global { } } -type Binding = { key: string; code?: string }; +type Binding = { key: string; code: string }; const ARROWS = { up: { key: "ArrowUp", code: "ArrowUp" }, diff --git a/frontend/src/v2/composables/useMediaSession/index.ts b/frontend/src/v2/composables/useMediaSession/index.ts index faa61ebcf..d0e977d21 100644 --- a/frontend/src/v2/composables/useMediaSession/index.ts +++ b/frontend/src/v2/composables/useMediaSession/index.ts @@ -112,8 +112,8 @@ export function useMediaSession(blocked: () => boolean = () => false): void { if (!store.track) return null; return { title: store.meta.title || store.track.fileName, - artist: store.meta.artist, - album: store.meta.album, + artist: store.meta.artist ?? "", + album: store.meta.album ?? "", artwork: [{ src: playerCoverUrl(store.meta) }], }; }); diff --git a/frontend/src/v2/composables/useSnackbar/index.ts b/frontend/src/v2/composables/useSnackbar/index.ts index 58f80f390..039fb33dd 100644 --- a/frontend/src/v2/composables/useSnackbar/index.ts +++ b/frontend/src/v2/composables/useSnackbar/index.ts @@ -14,23 +14,18 @@ // drop the free-form `color` string and accept the tone directly. import type { Emitter } from "mitt"; import { inject } from "vue"; -import type { Events } from "@/types/emitter"; +import type { Events, SnackbarStatus } from "@/types/emitter"; import storeNotificationInbox from "@/v2/stores/notificationInbox"; export type SnackbarTone = "success" | "error" | "warning" | "info"; -export interface SnackbarOptions { - /** Auto-dismiss timeout in ms. Defaults to NotificationHost's 3000ms. */ - timeout?: number; - /** Override the default icon for the tone. */ - icon?: string; - /** Stable id: useful when deduplicating repeated notifications. */ - id?: number; - /** Artwork shown in place of the icon, e.g. the cover of the game it concerns. */ - image?: string | null; +export interface SnackbarOptions extends Pick< + SnackbarStatus, + "id" | "timeout" | "icon" | "image" +> { /** Also keeps it in the user's notifications, optionally with a detail * line and an in-app link. */ - persist?: boolean | { body?: string; link?: string }; + persist?: boolean | { body?: string; link?: string } | undefined; } /** The icon for a tone, where the caller gives none. */ @@ -73,9 +68,8 @@ export function useSnackbar() { await storeNotificationInbox().send({ level: tone, title: msg, - body: extra.body, - link: extra.link, - icon: opts.icon, + ...extra, + ...(opts.icon === undefined ? {} : { icon: opts.icon }), }); } catch (error) { console.error("Could not keep the notification:", error); diff --git a/frontend/src/v2/lib/InputNavigation.stories.ts b/frontend/src/v2/lib/InputNavigation.stories.ts index f62933d24..e10906be6 100644 --- a/frontend/src/v2/lib/InputNavigation.stories.ts +++ b/frontend/src/v2/lib/InputNavigation.stories.ts @@ -19,7 +19,7 @@ const TITLES = [ "Secret of Mana", "F-Zero", "Star Fox", -]; +] as const; const meta: Meta = { title: "Input Navigation", @@ -78,7 +78,7 @@ export const KeyboardNavigation: Story = { await expect(canvas.getByRole("button", { name: TITLES[1] })).toHaveFocus(); await userEvent.keyboard("{Enter}"); await expect(canvas.getByTestId("last-picked")).toHaveTextContent( - TITLES[1]!, + TITLES[1], ); }, }; diff --git a/frontend/src/v2/lib/data/RTable/types.ts b/frontend/src/v2/lib/data/RTable/types.ts index 99e8f3115..49093193a 100644 --- a/frontend/src/v2/lib/data/RTable/types.ts +++ b/frontend/src/v2/lib/data/RTable/types.ts @@ -20,18 +20,18 @@ export interface RTableProps { /** Empty-state icon when `items` is empty and not loading. */ emptyIcon?: string; /** Empty-state message. */ - emptyMessage?: string; + emptyMessage?: string | undefined; /** Whether rows respond to hover / click. Click-binding is opt-in * via the `row:click` listener: this just toggles the cursor. */ clickableRows?: boolean; /** Per-row CSS row-height. Default uses `--r-list-row-h` token. */ - rowHeight?: string; + rowHeight?: string | undefined; /** Extra class merged into each row: useful for variant rows. */ - rowClass?: string | ((row: TItem) => string | undefined); + rowClass?: string | ((row: TItem) => string | undefined) | undefined; /** Horizontal-scroll floor (number → px). When set, header + body keep * this min-width and the table scrolls horizontally below it instead * of shrinking columns: useful for many-column tables on mobile. */ - minWidth?: string | number; + minWidth?: string | number | undefined; } export interface RTableColumn { diff --git a/frontend/src/v2/lib/forms/RCheckbox/RCheckbox.vue b/frontend/src/v2/lib/forms/RCheckbox/RCheckbox.vue index 8411c53de..32456aac8 100644 --- a/frontend/src/v2/lib/forms/RCheckbox/RCheckbox.vue +++ b/frontend/src/v2/lib/forms/RCheckbox/RCheckbox.vue @@ -34,25 +34,25 @@ import type { RCheckboxState } from "./types"; defineOptions({ inheritAttrs: false }); interface Props { - modelValue?: boolean | null; - label?: string; + modelValue?: boolean | null | undefined; + label?: string | undefined; /** Secondary line under the label, most useful in `variant="card"`. */ - subtitle?: string; + subtitle?: string | undefined; disabled?: boolean; indeterminate?: boolean; /** Opt into N-state cycling. Ordered list, first entry = empty state. * The current value is driven by `stateValue`. */ - states?: RCheckboxState[]; + states?: RCheckboxState[] | undefined; /** Current multi-state value (only read when `states` is set). */ - stateValue?: string; + stateValue?: string | undefined; /** Accessible name for a labelless checkbox (e.g. matrix cells). */ - ariaLabel?: string; + ariaLabel?: string | undefined; /** Reserve vertical space for error messages. */ hideDetails?: boolean | "auto"; size?: "xs" | "sm" | "md" | "lg"; - shape?: "square" | "rounded" | "circle"; + shape?: "square" | "rounded" | "circle" | undefined; /** Tone for the check fill + active border. */ - color?: string; + color?: string | undefined; variant?: "box" | "card"; /** Box-only mode: drops the row's vertical breathing padding (4px * top/bottom) and the box↔label gap so the checkbox can be diff --git a/frontend/src/v2/lib/forms/RComboboxField/RComboboxField.vue b/frontend/src/v2/lib/forms/RComboboxField/RComboboxField.vue index 11efb3ce3..964f304a6 100644 --- a/frontend/src/v2/lib/forms/RComboboxField/RComboboxField.vue +++ b/frontend/src/v2/lib/forms/RComboboxField/RComboboxField.vue @@ -43,16 +43,16 @@ interface Props { /** Optional suggestion list. Typed values that don't match are still * committed: this is autocomplete, not enforcement. */ items?: string[]; - label?: string; - placeholder?: string; + label?: string | undefined; + placeholder?: string | undefined; /** `stacked` → label above the field. `inline` → label as a left * prefix on the field. Mirrors RTextField. */ prefixLabel?: "stacked" | "inline" | null; variant?: "outlined" | "filled" | "underlined" | "plain"; density?: "default" | "comfortable" | "compact"; hideDetails?: boolean; - hint?: string; - errorMessages?: string | string[]; + hint?: string | undefined; + errorMessages?: string | string[] | undefined; /** Checked against the committed chips, like RSelect's rules; the field * reports to an enclosing RForm. */ rules?: Rule[]; diff --git a/frontend/src/v2/lib/forms/RDateField/RDateField.vue b/frontend/src/v2/lib/forms/RDateField/RDateField.vue index 01687c19d..b1b8d7616 100644 --- a/frontend/src/v2/lib/forms/RDateField/RDateField.vue +++ b/frontend/src/v2/lib/forms/RDateField/RDateField.vue @@ -44,9 +44,9 @@ interface Props { /** Latest selectable date. Days after are rendered but disabled. */ max?: Date | number | string | null; /** Footer "today" shortcut label. Defaults to "Today". */ - todayLabel?: string; + todayLabel?: string | undefined; /** Footer "clear" shortcut label. Defaults to "Clear". */ - clearLabel?: string; + clearLabel?: string | undefined; /** Hide the today/clear footer row. */ hideFooter?: boolean; /** Disable opening the picker. RTextField also accepts `disabled`: diff --git a/frontend/src/v2/lib/forms/RDropzone/RDropzone.vue b/frontend/src/v2/lib/forms/RDropzone/RDropzone.vue index 20d80d8ae..e95b56553 100644 --- a/frontend/src/v2/lib/forms/RDropzone/RDropzone.vue +++ b/frontend/src/v2/lib/forms/RDropzone/RDropzone.vue @@ -25,9 +25,9 @@ interface Props { /** Allow selecting / dropping more than one file. */ multiple?: boolean; /** `accept` attribute for the underlying file input (e.g. "image/*"). */ - accept?: string; + accept?: string | undefined; /** MIME types passed to the drop filter; omit to accept anything. */ - dataTypes?: string[]; + dataTypes?: string[] | undefined; disabled?: boolean; /** Overlay mode: render the default slot + a drag-over overlay. */ overlay?: boolean; @@ -37,16 +37,16 @@ interface Props { * Works where `height: 100%` can't, e.g. a parent sized by min-height. */ fill?: boolean; // CTA copy / icons (ignored in overlay mode except `activeIcon`). - title?: string; - hint?: string; + title?: string | undefined; + hint?: string | undefined; icon?: string; activeIcon?: string; /** Title swapped in while dragging over the CTA (falls back to `title`). */ - activeTitle?: string; + activeTitle?: string | undefined; /** Overlay caption shown while dragging over filled content. */ - releaseLabel?: string; + releaseLabel?: string | undefined; /** Accessible label for the underlying (visually hidden) file input. */ - inputLabel?: string; + inputLabel?: string | undefined; } const props = withDefaults(defineProps(), { @@ -79,7 +79,7 @@ const { isOverDropZone } = useDropZone(rootRef, { if (props.disabled || !files || files.length === 0) return; emit("files", props.multiple ? files : files.slice(0, 1)); }, - dataTypes: props.dataTypes, + ...(props.dataTypes ? { dataTypes: props.dataTypes } : {}), multiple: props.multiple, preventDefaultForUnhandled: true, }); diff --git a/frontend/src/v2/lib/forms/RForm/RForm.vue b/frontend/src/v2/lib/forms/RForm/RForm.vue index 3166381db..891778233 100644 --- a/frontend/src/v2/lib/forms/RForm/RForm.vue +++ b/frontend/src/v2/lib/forms/RForm/RForm.vue @@ -17,7 +17,7 @@ defineOptions({ inheritAttrs: false }); interface Props { /** v-model: true when every registered field passes its rules. */ - modelValue?: boolean; + modelValue?: boolean | undefined; /** Disable the Enter-to-submit shortcut. */ disableEnterSubmit?: boolean; /** Disable the scroll-to-first-error helper. */ diff --git a/frontend/src/v2/lib/forms/RRating/RRating.vue b/frontend/src/v2/lib/forms/RRating/RRating.vue index ac97db9f1..f5045e3bd 100644 --- a/frontend/src/v2/lib/forms/RRating/RRating.vue +++ b/frontend/src/v2/lib/forms/RRating/RRating.vue @@ -22,7 +22,7 @@ interface Props { /** Tone for filled icons. Keyword or kebab-case token. */ color?: string; /** Tone for the *active* portion. Defaults to `color`. */ - activeColor?: string; + activeColor?: string | undefined; emptyIcon?: string; fullIcon?: string; halfIcon?: string; @@ -35,9 +35,9 @@ interface Props { /** Whether to react to hover (preview on hover). */ hover?: boolean; /** Accessible labels per item (e.g. ["bad","ok","good","great","perfect"]). */ - itemLabels?: string[]; + itemLabels?: string[] | undefined; /** Optional shared aria-label for the whole row. */ - ariaLabel?: string; + ariaLabel?: string | undefined; } const props = withDefaults(defineProps(), { diff --git a/frontend/src/v2/lib/forms/RSelect/RSelect.vue b/frontend/src/v2/lib/forms/RSelect/RSelect.vue index 1e5a33e7b..c6b7cf4c7 100644 --- a/frontend/src/v2/lib/forms/RSelect/RSelect.vue +++ b/frontend/src/v2/lib/forms/RSelect/RSelect.vue @@ -79,10 +79,10 @@ type ClearableAllowed = unknown extends Model interface Props { /** Typed by the bound ref; RSelect trusts it matches the items' keys. */ - modelValue?: Model; + modelValue?: Model | undefined; items?: readonly Item[]; - label?: string; - placeholder?: string; + label?: string | undefined; + placeholder?: string | undefined; variant?: "outlined" | "filled" | "underlined" | "plain"; density?: "default" | "comfortable" | "compact"; itemTitle?: string | ((item: Item) => string); @@ -100,14 +100,14 @@ interface Props { loading?: boolean; hideDetails?: boolean | "auto"; required?: boolean; - prependInnerIcon?: string; + prependInnerIcon?: string | undefined; appendInnerIcon?: string; rules?: Rule[]; - hint?: string; + hint?: string | undefined; error?: boolean; errorMessages?: string | string[]; /** "stacked": label above; "inline": label as a left well. */ - prefixLabel?: "stacked" | "inline"; + prefixLabel?: "stacked" | "inline" | undefined; /** Accent for focus + selected items. Defaults to brand-primary. */ color?: string; /** Adds a sticky search input at the top of the panel that filters @@ -115,7 +115,7 @@ interface Props { searchable?: boolean; /** v-model:search: current query string. */ search?: string; - searchPlaceholder?: string; + searchPlaceholder?: string | undefined; /** Where to place the menu relative to the activator. */ menuLocation?: "bottom" | "top" | "bottom start" | "bottom end" | "top start" | "top end"; @@ -145,12 +145,12 @@ interface Props { showAllOption?: boolean; /** Label used by the "All" row in the menu and as the activator * display when nothing is selected. Defaults to "All". */ - allOptionLabel?: string; + allOptionLabel?: string | undefined; /** Items it matches get a divider below their row, setting them apart * from the ones that follow. */ - dividerAfter?: (item: Item) => boolean; + dividerAfter?: ((item: Item) => boolean) | undefined; /** Tip revealed from an info icon in the trailing label well. */ - info?: string; + info?: string | undefined; } const props = withDefaults(defineProps(), { diff --git a/frontend/src/v2/lib/forms/RSlider/RSlider.vue b/frontend/src/v2/lib/forms/RSlider/RSlider.vue index 03bcf8e5e..289d6d287 100644 --- a/frontend/src/v2/lib/forms/RSlider/RSlider.vue +++ b/frontend/src/v2/lib/forms/RSlider/RSlider.vue @@ -37,7 +37,7 @@ interface Props { * keyboard focus or drag. */ scrubber?: boolean; /** ARIA label when no visible label exists. */ - ariaLabel?: string; + ariaLabel?: string | undefined; } const props = withDefaults(defineProps(), { diff --git a/frontend/src/v2/lib/forms/RSwitch/RSwitch.vue b/frontend/src/v2/lib/forms/RSwitch/RSwitch.vue index 53d93e2f0..70fbc6da1 100644 --- a/frontend/src/v2/lib/forms/RSwitch/RSwitch.vue +++ b/frontend/src/v2/lib/forms/RSwitch/RSwitch.vue @@ -13,13 +13,13 @@ defineOptions({ inheritAttrs: false }); interface Props { modelValue: boolean; /** Optional inline label rendered next to the switch. */ - label?: string; + label?: string | undefined; /** Visual size: `default` is the 36×20 track, `small` shrinks to * 28×16. Both keep the same hit-area on touch / pad. */ size?: "default" | "small"; disabled?: boolean; /** Accessible label for the switch when there's no visible label. */ - ariaLabel?: string; + ariaLabel?: string | undefined; /** Render as a passive `` (no button semantics, no click * handler, no role). Useful when an outer wrapper already owns the * interactive surface: e.g. `SettingsToggleRow` is a button whose diff --git a/frontend/src/v2/lib/forms/RTextField/RTextField.vue b/frontend/src/v2/lib/forms/RTextField/RTextField.vue index 885e1af25..bcc7065fd 100644 --- a/frontend/src/v2/lib/forms/RTextField/RTextField.vue +++ b/frontend/src/v2/lib/forms/RTextField/RTextField.vue @@ -44,33 +44,33 @@ defineOptions({ inheritAttrs: false }); type Rule = (value: any) => true | string; interface Props { - modelValue?: string | number | null; - label?: string; - placeholder?: string; + modelValue?: string | number | null | undefined; + label?: string | undefined; + placeholder?: string | undefined; type?: string; /** Native input length cap. */ - maxlength?: number; + maxlength?: number | undefined; variant?: "outlined" | "filled" | "underlined" | "plain"; density?: "default" | "comfortable" | "compact"; - prependInnerIcon?: string; - appendInnerIcon?: string; + prependInnerIcon?: string | undefined; + appendInnerIcon?: string | undefined; /** Tooltip text shown on hover/focus over the prepend-inner * adornment. Useful for clickable adornments (copy buttons, etc.) * to label their action. */ - prependInnerTooltip?: string; + prependInnerTooltip?: string | undefined; /** Tooltip text shown on hover/focus over the append-inner * adornment. The canonical use is the password-reveal eye icon. */ - appendInnerTooltip?: string; + appendInnerTooltip?: string | undefined; /** Accessible name for the interactive prepend-inner adornment button. * Falls back to `prependInnerTooltip`. */ - prependInnerLabel?: string; + prependInnerLabel?: string | undefined; /** Accessible name for the interactive append-inner adornment button. * Falls back to `appendInnerTooltip`. */ - appendInnerLabel?: string; - autocomplete?: string; - name?: string; - rules?: Rule[]; - hint?: string; + appendInnerLabel?: string | undefined; + autocomplete?: string | undefined; + name?: string | undefined; + rules?: Rule[] | undefined; + hint?: string | undefined; hideDetails?: boolean | "auto"; required?: boolean; disabled?: boolean; @@ -79,16 +79,16 @@ interface Props { clearable?: boolean; autofocus?: boolean; error?: boolean; - errorMessages?: string | string[]; + errorMessages?: string | string[] | undefined; /** "stacked": label above; "inline": label as a left well. */ - prefixLabel?: "stacked" | "inline"; + prefixLabel?: "stacked" | "inline" | undefined; /** Accent for focus + clearable hover. Defaults to brand-primary. */ color?: string; /** Force the focused appearance regardless of the input's own focus * state. Used by wrappers (RDateField, popover activators) that move * real focus into a teleported panel but still want the field to read * as active. Additive: internal focus also triggers the look. */ - focused?: boolean; + focused?: boolean | undefined; /** Render as a `