Align local web integrations with updated lint rules and Cast types
This commit is contained in:
@@ -61,16 +61,14 @@
|
||||
currentMemories.flatMap((memory) => {
|
||||
const asset = memory.assets[frame % memory.assets.length];
|
||||
return asset
|
||||
? [
|
||||
{
|
||||
id: memory.id,
|
||||
title: $memoryLaneTitle(memory),
|
||||
href: Route.viewMemory({ id: memory.id, assetId: asset.id }),
|
||||
alt: $t('memory_lane_title', { values: { title: $getAltText(toTimelineAsset(asset)) } }),
|
||||
src: getAssetMediaUrl({ id: asset.id }),
|
||||
type: memory.type,
|
||||
},
|
||||
]
|
||||
? {
|
||||
id: memory.id,
|
||||
title: $memoryLaneTitle(memory),
|
||||
href: Route.viewMemory({ id: memory.id, assetId: asset.id }),
|
||||
alt: $t('memory_lane_title', { values: { title: $getAltText(toTimelineAsset(asset)) } }),
|
||||
src: getAssetMediaUrl({ id: asset.id }),
|
||||
type: memory.type,
|
||||
}
|
||||
: [];
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -24,5 +24,5 @@ export function updateObject(target: any, source: any): boolean {
|
||||
return updated;
|
||||
}
|
||||
export function isMismatched<T>(option: T | undefined, value: T): boolean {
|
||||
return option === undefined ? false : option !== value;
|
||||
return option !== undefined && option !== value;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ class SidebarStore {
|
||||
|
||||
/** Toggles the sidebar visibility, if available at the current screen width. */
|
||||
toggle() {
|
||||
this.isOpen = mediaQueryManager.isFullSidebar ? true : !this.isOpen;
|
||||
this.isOpen = mediaQueryManager.isFullSidebar || !this.isOpen;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { authManager } from '#lib/managers/auth-manager.svelte.ts';
|
||||
import { CastDestinationType, CastState, type ICastDestination } from '#lib/managers/cast-manager.svelte.ts';
|
||||
import 'chromecast-caf-sender';
|
||||
import { Duration } from 'luxon';
|
||||
|
||||
const FRAMEWORK_LINK = 'https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1';
|
||||
|
||||
@@ -121,7 +121,6 @@ export const calculateFittedFontSize = (
|
||||
return clamp(fontSize, MIN_FONT_SIZE, MAX_FONT_SIZE);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line tscompat/tscompat -- This assigns the Canvas 2D font property, not a font() method.
|
||||
context.font = getReferenceFont();
|
||||
|
||||
let maxCharWidth = 0;
|
||||
@@ -146,7 +145,6 @@ export const calculateFittedFontSize = (
|
||||
return clamp((1.4 * fitWidth) / text.length, MIN_FONT_SIZE, MAX_FONT_SIZE);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line tscompat/tscompat -- This assigns the Canvas 2D font property, not a font() method.
|
||||
context.font = getReferenceFont();
|
||||
|
||||
const metrics = context.measureText(text);
|
||||
|
||||
@@ -11,7 +11,6 @@ export async function acquireWakeLock() {
|
||||
return;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line tscompat/tscompat -- The feature check above guards Wake Lock access.
|
||||
if (sentinel && !sentinel.released) {
|
||||
return;
|
||||
}
|
||||
@@ -20,7 +19,6 @@ export async function acquireWakeLock() {
|
||||
}
|
||||
acquiring = true;
|
||||
try {
|
||||
// eslint-disable-next-line tscompat/tscompat -- Browsers without Wake Lock return before this call.
|
||||
sentinel = await navigator.wakeLock.request('screen');
|
||||
} catch (error) {
|
||||
console.warn('Failed to acquire wake lock:', error);
|
||||
@@ -38,7 +36,6 @@ export async function releaseWakeLock() {
|
||||
// Unset first to avoid race condition after await
|
||||
sentinel = undefined;
|
||||
|
||||
// eslint-disable-next-line tscompat/tscompat -- A sentinel is only acquired on browsers supporting Wake Lock.
|
||||
await toReleaseSentinel.release();
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -226,7 +226,7 @@
|
||||
return { albumId, order: album.order };
|
||||
});
|
||||
|
||||
const isShared = $derived(viewMode === AlbumPageViewMode.SELECT_ASSETS ? false : album.albumUsers.length > 1);
|
||||
const isShared = $derived(viewMode !== AlbumPageViewMode.SELECT_ASSETS && album.albumUsers.length > 1);
|
||||
|
||||
$effect(() => {
|
||||
if (assetViewerManager.isViewing || !isShared) {
|
||||
@@ -248,10 +248,10 @@
|
||||
const isEditor = $derived(isAlbumEditor(album));
|
||||
|
||||
const isSelectionMode = $derived(
|
||||
viewMode === AlbumPageViewMode.SELECT_ASSETS ? true : viewMode === AlbumPageViewMode.SELECT_THUMBNAIL,
|
||||
viewMode === AlbumPageViewMode.SELECT_ASSETS || viewMode === AlbumPageViewMode.SELECT_THUMBNAIL,
|
||||
);
|
||||
const singleSelect = $derived(
|
||||
viewMode === AlbumPageViewMode.SELECT_ASSETS ? false : viewMode === AlbumPageViewMode.SELECT_THUMBNAIL,
|
||||
viewMode !== AlbumPageViewMode.SELECT_ASSETS && viewMode === AlbumPageViewMode.SELECT_THUMBNAIL,
|
||||
);
|
||||
const showArchiveIcon = $derived(viewMode !== AlbumPageViewMode.SELECT_ASSETS);
|
||||
const onSelect = ({ id }: { id: string }) => {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { onDestroy } from 'svelte';
|
||||
import { t } from 'svelte-i18n';
|
||||
|
||||
let gCastEnabled = $state(authManager.authenticated ? authManager.preferences.cast.gCastEnabled : false);
|
||||
let gCastEnabled = $state(authManager.authenticated && authManager.preferences.cast.gCastEnabled);
|
||||
|
||||
onDestroy(async () => {
|
||||
try {
|
||||
|
||||
+2
-3
@@ -5,14 +5,13 @@
|
||||
"paths": {
|
||||
"#i18n/*": ["../i18n/*"],
|
||||
"#test-data/*": ["./src/test-data/*"],
|
||||
"#tests/*": ["./src/../tests/*"],
|
||||
"chromecast-caf-sender": ["./node_modules/@types/chromecast-caf-sender/index.d.ts"]
|
||||
"#tests/*": ["./src/../tests/*"]
|
||||
},
|
||||
"rootDir": ".",
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"target": "es2022",
|
||||
"types": ["$app/types", "vitest/globals"]
|
||||
"types": ["$app/types", "vitest/globals", "chromecast-caf-sender"]
|
||||
},
|
||||
"exclude": ["vite.config.ts", "src/service-worker/*"],
|
||||
"extends": "$app/tsconfig",
|
||||
|
||||
Reference in New Issue
Block a user