Finalize local12 formatting and document guarded browser APIs
This commit is contained in:
@@ -1,12 +1,3 @@
|
||||
import {
|
||||
deleteLibrary,
|
||||
getAdminConfig,
|
||||
getStorage,
|
||||
updateAdminConfig,
|
||||
updateLibrary,
|
||||
type AdminConfigDto,
|
||||
type LibraryResponseDto,
|
||||
} from '@immich/sdk';
|
||||
import { eventManager } from '#lib/managers/event-manager.svelte.ts';
|
||||
import { executeMutation, queryClient } from '#lib/queries/client.ts';
|
||||
import { getAdminConfigQuery, updateAdminConfigMutation } from '#lib/queries/config-admin.query.ts';
|
||||
@@ -19,6 +10,15 @@ import {
|
||||
} from '#lib/queries/library.query.ts';
|
||||
import { getServerConfigQuery, getStorageQuery } from '#lib/queries/server-info.query.ts';
|
||||
import { handleError } from '#lib/utils/handle-error.ts';
|
||||
import {
|
||||
deleteLibrary,
|
||||
getAdminConfig,
|
||||
getStorage,
|
||||
updateAdminConfig,
|
||||
updateLibrary,
|
||||
type AdminConfigDto,
|
||||
type LibraryResponseDto,
|
||||
} from '@immich/sdk';
|
||||
|
||||
vi.mock('@immich/ui', () => ({ toastManager: { primary: vi.fn(), info: vi.fn() } }));
|
||||
vi.mock('#lib/utils/handle-error.ts', () => ({ handleError: vi.fn() }));
|
||||
|
||||
@@ -1,12 +1,3 @@
|
||||
import {
|
||||
createUserAdmin,
|
||||
deleteUserAdmin,
|
||||
restoreUserAdmin,
|
||||
searchUsersAdmin,
|
||||
updateUserAdmin,
|
||||
type UserAdminResponseDto,
|
||||
} from '@immich/sdk';
|
||||
import { QueryObserver } from '@tanstack/svelte-query';
|
||||
import { eventManager } from '#lib/managers/event-manager.svelte.ts';
|
||||
import { executeMutation, queryClient } from '#lib/queries/client.ts';
|
||||
import {
|
||||
@@ -18,6 +9,15 @@ import {
|
||||
updateUserAdminMutation,
|
||||
} from '#lib/queries/user-admin.query.ts';
|
||||
import { handleError } from '#lib/utils/handle-error.ts';
|
||||
import {
|
||||
createUserAdmin,
|
||||
deleteUserAdmin,
|
||||
restoreUserAdmin,
|
||||
searchUsersAdmin,
|
||||
updateUserAdmin,
|
||||
type UserAdminResponseDto,
|
||||
} from '@immich/sdk';
|
||||
import { QueryObserver } from '@tanstack/svelte-query';
|
||||
|
||||
vi.mock('#lib', () => ({ getHeatmapRange: vi.fn() }));
|
||||
vi.mock('@immich/ui', () => ({ toastManager: { primary: vi.fn(), info: vi.fn() } }));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { getUserAdminActions } from '#lib/services/user-admin.service.ts';
|
||||
import { UserStatus, type UserAdminResponseDto } from '@immich/sdk';
|
||||
import type { MessageFormatter } from 'svelte-i18n';
|
||||
import { getUserAdminActions } from '#lib/services/user-admin.service.ts';
|
||||
|
||||
vi.mock('$app/navigation', () => ({ goto: vi.fn() }));
|
||||
vi.mock('@immich/ui', () => ({ modalManager: { show: vi.fn(), showDialog: vi.fn() } }));
|
||||
|
||||
@@ -121,6 +121,7 @@ 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;
|
||||
@@ -145,7 +146,7 @@ export const calculateFittedFontSize = (
|
||||
return clamp((1.4 * fitWidth) / text.length, MIN_FONT_SIZE, MAX_FONT_SIZE);
|
||||
}
|
||||
|
||||
// Unsupported in Safari iOS <16.6; falls back to default canvas font, giving less accurate but functional sizing
|
||||
// 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);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { TimelineAsset } from '#lib/managers/timeline-manager/types.ts';
|
||||
import { locale } from '#lib/stores/preferences.store.ts';
|
||||
import { getAltText } from '#lib/utils/thumbnail-util.ts';
|
||||
import { AssetVisibility } from '@immich/sdk';
|
||||
import { init, register, waitLocale } from 'svelte-i18n';
|
||||
import { get } from 'svelte/store';
|
||||
import { locale } from '#lib/stores/preferences.store.ts';
|
||||
|
||||
interface Person {
|
||||
name: string;
|
||||
|
||||
@@ -11,6 +11,7 @@ export async function acquireWakeLock() {
|
||||
return;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line tscompat/tscompat -- The feature check above guards Wake Lock access.
|
||||
if (sentinel && !sentinel.released) {
|
||||
return;
|
||||
}
|
||||
@@ -19,6 +20,7 @@ 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);
|
||||
@@ -36,6 +38,7 @@ 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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user