Prepare v2 and shared code for exactOptionalPropertyTypes (#5065)

This commit is contained in:
Sam Dornan
2026-10-03 00:38:46 -04:00
committed by GitHub
parent 893c77f47d
commit fbfa12cf07
123 changed files with 408 additions and 435 deletions

View File

@@ -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 = {}) {

View File

@@ -33,7 +33,7 @@ async function createToken({
}: {
name: string;
scopes: string[];
expires_in?: string;
expires_in?: string | undefined;
}) {
return api.post<ClientTokenCreateSchema>("/client-tokens", {
name,

View File

@@ -15,7 +15,7 @@ type VirtualCollection = VirtualCollectionSchema;
type SmartCollection = SmartCollectionSchema;
export type UpdatedCollection = Collection & {
artwork?: File;
artwork?: File | undefined;
url_cover?: string | null;
};

View File

@@ -30,8 +30,8 @@ async function approve({
}: {
userCode: string;
approvedScopes: string[];
deviceName?: string;
expiresIn?: string;
deviceName?: string | undefined;
expiresIn?: string | undefined;
}) {
return api.post<DeviceAuthApproveResponse>("/auth/device/approve", {
user_code: userCode,

View File

@@ -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<Platform>(`/platforms/${platform.id}`, payload);

View File

@@ -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<void> {
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<GetRomsResponse>(`/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<SimilarRomSchema[]>(`/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<RecommendedRomSchema[]>("/recommendations", {
params: { limit, ...(refresh ? { refresh: true } : {}) },
signal,
...config,
});
}
async function getRom({
romId,
signal,
...config
}: {
romId: number;
signal?: AbortSignal;
}) {
return api.get<DetailedRom>(`/roms/${romId}`, { signal });
return api.get<DetailedRom>(`/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<SimpleRom>(`/roms/${romId}/simple`, { signal });
return api.get<SimpleRom>(`/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<SoundtrackTrackMetaSchema[]>(
`/roms/${romId}/soundtracks/metadata`,
{
signal,
},
config,
);
}

View File

@@ -49,7 +49,7 @@ export function sessionScreenshotFile(
type SaveUploadInput = Omit<AddSaveInput, "saveFile" | "screenshotFile"> & {
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<DetailedRomSchema, "id">;
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;
}

View File

@@ -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<AddStateInput, "stateFile" | "screenshotFile"> & {
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<DetailedRomSchema, "id">;
statesToUpload: StateUploadInput[];
emulator?: string;
emulator?: string | undefined;
}) {
const promises = statesToUpload.map(({ stateFile, screenshotFile }) => {
const formData = buildFormInput<StateUploadInput>([

View File

@@ -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,
};
}

View File

@@ -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();

View File

@@ -257,7 +257,10 @@ async function archiveSave(
async function uploadSave(
entry: PendingAsset,
rom: { id: number; fs_name_no_ext: string },
): Promise<{ upload?: PromiseSettledResult<unknown>; archived?: true }> {
): Promise<{
upload?: PromiseSettledResult<unknown> | 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;
}

View File

@@ -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.

View File

@@ -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<DetailedRom> = {}) {
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" }));

View File

@@ -22,12 +22,12 @@ type AudioTagKey =
"title" | "artist" | "album" | "year" | "genre" | "track" | "disc";
export type PlayerMeta = {
[K in AudioTagKey]?: NonNullable<TrackMetaSchema[K]>;
[K in AudioTagKey]?: NonNullable<TrackMetaSchema[K]> | 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<

View File

@@ -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;

View File

@@ -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) {

View File

@@ -32,7 +32,7 @@ export interface AdminUserDraft {
email: string;
password: string;
repeatPassword: string;
avatar?: File;
avatar?: File | undefined;
}
defineOptions({ inheritAttrs: false });

View File

@@ -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<Props>(), {

View File

@@ -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

View File

@@ -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<Props>(), {

View File

@@ -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,
},

View File

@@ -73,7 +73,7 @@ interface ScanOption {
title: string;
subtitle: string;
value: ScanType;
disabled?: string;
disabled?: string | undefined;
}
const scanOptions = computed<ScanOption[]>(() => [

View File

@@ -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;

View File

@@ -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;

View File

@@ -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. */

View File

@@ -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;
}

View File

@@ -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. */

View File

@@ -20,7 +20,7 @@ defineOptions({ inheritAttrs: false });
withDefaults(
defineProps<{
title?: string;
title?: string | undefined;
}>(),
{
title: undefined,

View File

@@ -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,

View File

@@ -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<Props>(), {

View File

@@ -15,7 +15,7 @@ const { t } = useI18n();
const props = withDefaults(
defineProps<{
metadata: RomRAMetadata | null | undefined;
apiBase?: string;
apiBase?: string | undefined;
earnedAchievementIds?: ReadonlySet<string>;
}>(),
{

View File

@@ -40,7 +40,7 @@ const CATEGORY_SLUG: Record<string, string> = {
type Badge = {
rating: string;
category: string;
rating_cover_url?: string;
rating_cover_url?: string | undefined;
};
// IGDB icon URLs use lowercased rating codes with "+" stripped

View File

@@ -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. */

View File

@@ -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] }>();

View File

@@ -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

View File

@@ -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];

View File

@@ -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;
}>();

View File

@@ -12,7 +12,7 @@ import { useJoinStreamConfirm } from "@/v2/composables/useJoinStreamConfirm";
interface Props {
session: JoinableSession;
webp?: boolean;
webp?: boolean | undefined;
}
const props = withDefaults(defineProps<Props>(), {

View File

@@ -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<Toast[]>([]);

View File

@@ -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

View File

@@ -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;
}

View File

@@ -23,7 +23,7 @@ const props = withDefaults(
initialName?: string;
initialPublic?: boolean;
icon?: string;
confirmIcon?: string;
confirmIcon?: string | undefined;
busy?: boolean;
}>(),
{

View File

@@ -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 },

View File

@@ -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;

View File

@@ -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[];

View File

@@ -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<Props>();

View File

@@ -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",

View File

@@ -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<SortKey>("fsSlug");
const sortDir = ref<"asc" | "desc">("asc");
interface Row {
fsSlug: string;
slug?: string;
displayName?: string;
type: RowType;
}
const TYPE_ORDER: Record<NonNullable<RowType> | "none", number> = {
alias: 0,
variant: 1,

View File

@@ -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 },
);

View File

@@ -15,7 +15,7 @@ defineOptions({ inheritAttrs: false });
interface Props {
modelValue: boolean;
title: string;
description?: string;
description?: string | undefined;
disabled?: boolean;
}

View File

@@ -0,0 +1,8 @@
export type RowType = "alias" | "variant" | "auto" | null;
export interface Row {
fsSlug: string;
slug?: string | undefined;
displayName?: string | undefined;
type: RowType;
}

View File

@@ -72,7 +72,7 @@ function openRom() {
<p class="r-v2-np-card__title" :title="title">{{ title }}</p>
<p class="r-v2-np-card__caption" :title="caption">{{ caption }}</p>
<NowPlayingChips
:key="track?.fileId"
:key="track?.fileId ?? ''"
:tags="meta"
:position="position"
:total="playlist.length"

View File

@@ -9,7 +9,7 @@ import type { NowPlayingTags } from "@/v2/utils/soundtrackTracks";
defineOptions({ inheritAttrs: false });
const props = defineProps<{
tags?: NowPlayingTags;
tags?: NowPlayingTags | undefined;
/** One-based position of the track in the queue. */
position: number;
total: number;

View File

@@ -55,7 +55,7 @@ const props = defineProps<{
totalTracks?: number;
startShuffled?: boolean;
/** Cover shown when the active track has no art of its own. */
fallbackArtUrl?: string;
fallbackArtUrl?: string | undefined;
/** Show the per-track delete button (host gates it on the ROM write grant). */
deletable?: boolean;
/** Opt into the now-playing-rail layout when the container is wide enough. */
@@ -375,7 +375,7 @@ function downloadTrack(track: PanelTrack) {
</p>
<!-- Keyed by track so a new track's chips start from the left. -->
<NowPlayingChips
:key="headerTrack?.id"
:key="headerTrack?.id ?? ''"
:tags="headerTrack?.meta"
:position="headerPosition"
:total="trackCount"

View File

@@ -9,7 +9,7 @@ defineOptions({ inheritAttrs: false });
withDefaults(
defineProps<{
favorite?: boolean;
favorite?: boolean | undefined;
size?: number | string;
}>(),
{ favorite: false, size: 14 },

View File

@@ -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;

View File

@@ -9,7 +9,7 @@ defineOptions({ inheritAttrs: false });
withDefaults(
defineProps<{
to?: string;
label?: string;
label?: string | undefined;
}>(),
{
to: "/login",

View File

@@ -10,7 +10,7 @@ defineOptions({ inheritAttrs: false });
interface Props {
label?: string;
to?: string | object;
to?: string | object | undefined;
}
const props = withDefaults(defineProps<Props>(), {

View File

@@ -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. */

View File

@@ -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<Props>(), {

View File

@@ -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;

View File

@@ -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;
}>();

View File

@@ -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;
}

View File

@@ -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";
}>(),
{

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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();

View File

@@ -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<Props>(), {

View File

@@ -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 },
);

View File

@@ -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<BoxartStyle>;
forceStyle?: MaybeRefOrGetter<BoxartStyle> | 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. */

View File

@@ -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<number>;
fallbackRatio?: MaybeRefOrGetter<number> | undefined;
/** Bump to force a re-pack when measured ratios change (Vue tracks it). */
ratioVersion?: Ref<number> | ComputedRef<number>;
/** Px of detail panel the list row at `position` settles at (0 for the

View File

@@ -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" },

View File

@@ -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) }],
};
});

View File

@@ -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);

View File

@@ -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],
);
},
};

View File

@@ -20,18 +20,18 @@ export interface RTableProps<TItem> {
/** 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 {

View File

@@ -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

View File

@@ -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[];

View File

@@ -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`:

View File

@@ -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<Props>(), {
@@ -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,
});

View File

@@ -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. */

View File

@@ -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<Props>(), {

View File

@@ -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<Props>(), {

View File

@@ -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<Props>(), {

View File

@@ -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 `<span>` (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

View File

@@ -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 `<textarea>` instead of `<input>`. Drops the fixed
* height in favour of a `rows`-driven min-height; everything else
* (variants, density, validation, clearable, labels) keeps working. */
@@ -106,18 +106,20 @@ interface Props {
* hashes, or any "this is where the value resolves to" hint that
* pairs with the field's value. The `#subtitle` slot wins over the
* prop when both are provided; use the slot to drop in an icon. */
subtitle?: string;
subtitle?: string | undefined;
/** Wires the native input as a combobox owning a popup, putting the role
* on the input rather than the outer element (a `<label>` when this field
* owns its visible label). Single-line only: `role="combobox"` is not
* valid on a `<textarea>`. */
popup?: {
/** `id` of the popup element. Omit while it is unmounted, so
* `aria-controls` never points at an element that is not there. */
controls?: string;
expanded: boolean;
kind: "dialog" | "listbox" | "grid";
};
popup?:
| {
/** `id` of the popup element. Omit while it is unmounted, so
* `aria-controls` never points at an element that is not there. */
controls?: string | undefined;
expanded: boolean;
kind: "dialog" | "listbox" | "grid";
}
| undefined;
}
const props = withDefaults(defineProps<Props>(), {

View File

@@ -60,7 +60,7 @@ type Anchor =
interface Props {
/** Open state (controlled). Use v-model. Omit for uncontrolled. */
modelValue?: boolean;
modelValue?: boolean | undefined;
/** Close when the user clicks inside the panel (default: true). */
closeOnContentClick?: boolean;
/** Open on hover instead of click (e.g. dropdown menus on a nav). */
@@ -70,13 +70,13 @@ interface Props {
/** Px gap between activator and panel. */
offset?: number;
/** Override the panel width (default: auto, with a 180 px floor). */
width?: string | number;
width?: string | number | undefined;
/** Cap the panel height: body scrolls beyond it. */
maxHeight?: string | number;
maxHeight?: string | number | undefined;
/** Selectors for what to focus when the panel opens from a keyboard or a
* pad, tried in order. Defaults to the first menu item, which is wrong for
* a panel whose content is not `RMenuItem`s. */
initialFocus?: string | readonly string[];
initialFocus?: string | readonly string[] | undefined;
/** Render a sticky search input at the top. */
searchable?: boolean;
/** v-model:search: current query string. */
@@ -84,7 +84,7 @@ interface Props {
searchPlaceholder?: string;
searchAutoFocus?: boolean;
/** Extra class merged onto the panel element. */
contentClass?: string;
contentClass?: string | undefined;
/** Disable opening entirely. */
disabled?: boolean;
/** On `sm-and-down`, dock the panel as a full-width bottom sheet instead

View File

@@ -24,26 +24,27 @@ defineOptions({ inheritAttrs: false });
type Variant = "default" | "active" | "danger";
interface Props {
label?: string;
icon?: string; // optional mdi class: falls back to the slot
label?: string | undefined;
icon?: string | undefined; // optional mdi class: falls back to the slot
variant?: Variant;
disabled?: boolean;
disabled?: boolean | undefined;
// Routing: mutually exclusive; if neither is set we render a button.
to?: string | object;
href?: string;
to?: string | object | undefined;
href?: string | undefined;
// `closeOnClick` makes the menu parent close when true (default). Handled
// by the parent (RMenu auto-closes); this prop is mainly documentation
// for consumers that wire their own open state.
closeOnClick?: boolean;
// Token-suffix overrides: `"brand-primary"` → `var(--r-color-brand-primary)`.
textColor?: string;
iconColor?: string;
textColor?: string | undefined;
iconColor?: string | undefined;
}
const props = withDefaults(defineProps<Props>(), {
label: undefined,
icon: undefined,
variant: "default",
disabled: false,
to: undefined,
href: undefined,
closeOnClick: true,

View File

@@ -12,17 +12,17 @@ export interface RCarouselProps<TItem> {
/** Wrap from last → first and first → last. */
loop?: boolean;
/** Show "n / total" counter. Defaults to true when `items.length > 1`. */
showCounter?: boolean;
showCounter?: boolean | undefined;
/** Show prev/next arrows. Defaults to true when `items.length > 1`. */
showArrows?: boolean;
showArrows?: boolean | undefined;
/** Show a thumbnail strip below the active item. */
showThumbnails?: boolean;
/** Localised label for the close button. */
closeLabel?: string;
closeLabel?: string | undefined;
/** Localised label for the prev button. */
prevLabel?: string;
prevLabel?: string | undefined;
/** Localised label for the next button. */
nextLabel?: string;
nextLabel?: string | undefined;
/** Accessibility label for the carousel region. */
ariaLabel?: string;
ariaLabel?: string | undefined;
}

View File

@@ -57,7 +57,7 @@ const props = withDefaults(
cancelable?: boolean;
cancelDisabled?: boolean;
/** Replaces the Cancel label (defaults to the chrome `cancel` label). */
cancelText?: string;
cancelText?: string | undefined;
}>(),
{
scrollContent: false,

View File

@@ -29,7 +29,7 @@ export interface EscapableEntry {
persistent: boolean;
/** The surface this entry paints, when it owns one. Read lazily: the
* entry outlives the panel, which mounts only while open. */
panel?: () => HTMLElement | null;
panel?: (() => HTMLElement | null) | undefined;
}
const stack: EscapableEntry[] = [];

View File

@@ -29,15 +29,15 @@ defineOptions({ inheritAttrs: false });
interface Props {
/** Tone keyword: drives colour + default icon. */
type?: "success" | "info" | "warning" | "error";
type?: "success" | "info" | "warning" | "error" | undefined;
variant?: "flat" | "elevated" | "translucent" | "outlined" | "text";
closable?: boolean;
/** MDI icon override, or `false` to suppress the auto-icon. */
icon?: string | false;
icon?: string | false | undefined;
density?: "default" | "comfortable" | "compact";
title?: string;
title?: string | undefined;
/** Shortcut for the default slot. */
text?: string;
text?: string | undefined;
rounded?: string | number | boolean;
/** v-model visibility. */
modelValue?: boolean;

View File

@@ -20,13 +20,13 @@ defineOptions({ inheritAttrs: false });
interface Props {
size?: string | number;
color?: string;
image?: string;
icon?: string;
color?: string | undefined;
image?: string | undefined;
icon?: string | undefined;
/** `false | "0"` → square; `"sm" | "md" | "lg" | "xl"` → token radii;
* `"pill"` → fully pilled; `"circle" | true | undefined` → circle;
* number / px-length → raw value. */
rounded?: string | number | boolean;
rounded?: string | number | boolean | undefined;
variant?: "flat" | "elevated" | "translucent" | "outlined" | "text" | "plain";
}

View File

@@ -32,7 +32,7 @@ type Anchor =
| "end";
interface Props {
content?: string | number;
content?: string | number | undefined;
/** Tone keyword / legacy `romm-*` / any CSS colour. Default `"error"`
* for the red unread-count look. */
color?: string;
@@ -53,7 +53,7 @@ interface Props {
/** Numeric content > `max` is clamped: `max + "+"`. */
max?: number;
/** MDI icon shown inside the badge instead of text. */
icon?: string;
icon?: string | undefined;
}
const props = withDefaults(defineProps<Props>(), {

View File

@@ -56,12 +56,12 @@ defineOptions({ inheritAttrs: false });
interface Props {
variant?: "flat" | "text" | "elevated" | "translucent" | "outlined" | "plain";
color?: string;
color?: string | undefined;
rounded?: string | number | boolean;
loading?: boolean;
/** ms before the spinner appears after `loading` flips true. */
loadingDebounce?: number;
disabled?: boolean;
disabled?: boolean | undefined;
block?: boolean;
size?: "x-small" | "small" | "default" | "large" | "x-large";
/** Absolute height override, sharing the scale with RTextField /
@@ -71,12 +71,12 @@ interface Props {
* comfortable = 40px (= form `density="comfortable"`, = size `default`)
* default = 48px (= form `density="default"`, = size `large`)
* When unset, the size prop drives the height. */
density?: "default" | "comfortable" | "compact";
density?: "default" | "comfortable" | "compact" | undefined;
/** `true` → square icon-only button. `string` → MDI icon rendered as
* the button's sole content (icon-only). */
icon?: string | boolean;
prependIcon?: string;
appendIcon?: string;
icon?: string | boolean | undefined;
prependIcon?: string | undefined;
appendIcon?: string | undefined;
type?: "button" | "submit" | "reset";
/** Translucent currentColor border on top of the chosen variant. */
border?: boolean;
@@ -87,16 +87,16 @@ interface Props {
* surfaces (e.g., toolbar icon buttons next to sliders). */
surface?: boolean;
/** Renders the button as a router-link to this route. */
to?: RouteLocationRaw;
to?: RouteLocationRaw | undefined;
/** Renders the button as an `<a>` href. */
href?: string;
href?: string | undefined;
/** Target for `<a>` mode. */
target?: string;
target?: string | undefined;
/** Native tooltip: when set, RBtn mounts an RTooltip anchored to
* itself that reveals this text on hover / focus. Skips the
* `<RTooltip><template #activator>…` wrapping ceremony for the
* common case of "icon-only button needs a label on hover". */
tooltip?: string;
tooltip?: string | undefined;
/** Tooltip anchor; mapped to floating-ui placement internally. */
tooltipLocation?: TooltipLocation;
/** Delay (ms) before the tooltip appears on hover. */

View File

@@ -25,11 +25,11 @@ defineOptions({ inheritAttrs: false });
interface Props {
variant?: "flat" | "elevated" | "translucent" | "outlined" | "text" | "plain";
color?: string;
elevation?: number | string;
color?: string | undefined;
elevation?: number | string | undefined;
rounded?: string | number | boolean;
title?: string;
subtitle?: string;
title?: string | undefined;
subtitle?: string | undefined;
/** Thin animated bar at the top of the card: indicator that the
* card's content is updating in place. */
loading?: boolean;

View File

@@ -24,19 +24,19 @@ defineOptions({ inheritAttrs: false });
interface Props {
variant?: "flat" | "text" | "elevated" | "translucent" | "outlined" | "plain";
color?: string;
color?: string | undefined;
size?: "x-small" | "small" | "default" | "large" | "x-large";
/** Square corners (small radius): typical of inline metadata tags. */
label?: boolean;
/** Renders a trailing × button that emits `click:close`. */
closable?: boolean;
prependIcon?: string;
appendIcon?: string;
prependIcon?: string | undefined;
appendIcon?: string | undefined;
disabled?: boolean;
/** Overrides the chip's default radius. `false`/`"0"` → square,
* `"full"`/`true` → pill (999px), `"sm"`/`"md"`/`"lg"`/`"xl"` →
* token radii, number → px. */
rounded?: string | number | boolean;
rounded?: string | number | boolean | undefined;
}
const props = withDefaults(defineProps<Props>(), {

View File

@@ -33,7 +33,7 @@ interface Props {
* Horizontal mode only.
*/
fullWidth?: boolean;
thickness?: number | string;
thickness?: number | string | undefined;
}
const props = withDefaults(defineProps<Props>(), {

View File

@@ -10,8 +10,8 @@ defineOptions({ inheritAttrs: false });
interface Props {
icon?: string;
title?: string;
hint?: string;
title?: string | undefined;
hint?: string | undefined;
iconSize?: string | number;
/** Size ladder shared with RBtn / RChip / RTag. */
size?: "x-small" | "small" | "default" | "large" | "x-large";

View File

@@ -15,13 +15,13 @@ defineOptions({ inheritAttrs: false });
interface Props {
/** MDI class name including the prefix, e.g. `mdi-controller`. */
icon?: string;
icon?: string | undefined;
/** Named ladder (`x-small | small | default | large | x-large`),
* bare number (px), or any CSS length (`"1.4em"`, `"20px"`). */
size?: string | number;
size?: string | number | undefined;
/** v2 tone keyword, legacy `romm-*`, or any CSS colour. Omit to
* inherit the parent's text colour. */
color?: string;
color?: string | undefined;
}
const props = withDefaults(defineProps<Props>(), {

Some files were not shown because too many files have changed in this diff Show More