chore: svelte-kit-2 (#6103)

* chore: upgrade svelte

* chore: type imports

* chore: types
This commit is contained in:
Jason Rasmussen
2024-01-20 13:47:41 -05:00
committed by GitHub
parent 4ebb9974ff
commit 6e066aa220
108 changed files with 376 additions and 1323 deletions
@@ -37,7 +37,7 @@
import { downloadArchive } from '$lib/utils/asset-utils';
import { openFileUploadDialog } from '$lib/utils/file-uploader';
import { handleError } from '$lib/utils/handle-error';
import { ActivityResponseDto, ReactionLevel, ReactionType, UserResponseDto, api } from '@api';
import { type ActivityResponseDto, ReactionLevel, ReactionType, type UserResponseDto, api } from '@api';
import Icon from '$lib/components/elements/icon.svelte';
import type { PageData } from './$types';
import { clickOutside } from '$lib/utils/click-outside';
@@ -6,8 +6,8 @@ export const load: PageLoad = async ({ params }) => {
const albumId = params.albumId;
if (albumId) {
throw redirect(302, `${AppRoute.ALBUMS}/${albumId}`);
redirect(302, `${AppRoute.ALBUMS}/${albumId}`);
} else {
throw redirect(302, AppRoute.PHOTOS);
redirect(302, AppRoute.PHOTOS);
}
};
@@ -1,5 +1,5 @@
import { notificationController, NotificationType } from '$lib/components/shared-components/notification/notification';
import { api, CreateAlbumDto } from '@api';
import { api, type CreateAlbumDto } from '@api';
import { albumFactory } from '@test-data';
import { get } from 'svelte/store';
import { useAlbums } from '../albums.bloc';
+1 -1
View File
@@ -1,6 +1,6 @@
import type { OnShowContextMenuDetail } from '$lib/components/album-page/album-card';
import { notificationController, NotificationType } from '$lib/components/shared-components/notification/notification';
import { AlbumResponseDto, api } from '@api';
import { type AlbumResponseDto, api } from '@api';
import { derived, get, writable } from 'svelte/store';
type AlbumsProps = { albums: AlbumResponseDto[] };
@@ -3,5 +3,5 @@ import { redirect } from '@sveltejs/kit';
import type { PageLoad } from './$types';
export const load: PageLoad = async () => {
throw redirect(302, AppRoute.ARCHIVE);
redirect(302, AppRoute.ARCHIVE);
};
+1 -1
View File
@@ -3,7 +3,7 @@
import Thumbnail from '$lib/components/assets/thumbnail/thumbnail.svelte';
import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte';
import { AppRoute } from '$lib/constants';
import { SearchExploreResponseDto, api } from '@api';
import { type SearchExploreResponseDto, api } from '@api';
import type { PageData } from './$types';
export let data: PageData;
@@ -3,5 +3,5 @@ import { redirect } from '@sveltejs/kit';
import type { PageLoad } from './$types';
export const load: PageLoad = async () => {
throw redirect(302, AppRoute.FAVORITES);
redirect(302, AppRoute.FAVORITES);
};
+1 -1
View File
@@ -8,7 +8,7 @@
import { assetViewingStore } from '$lib/stores/asset-viewing.store';
import { mapSettings } from '$lib/stores/preferences.store';
import { featureFlags } from '$lib/stores/server-config.store';
import { MapMarkerResponseDto, api } from '@api';
import { type MapMarkerResponseDto, api } from '@api';
import { isEqual, omit } from 'lodash-es';
import { DateTime, Duration } from 'luxon';
import { onDestroy, onMount } from 'svelte';
+1 -1
View File
@@ -5,5 +5,5 @@ import type { PageLoad } from './$types';
export const load = (async () => {
await authenticate();
throw redirect(302, AppRoute.MEMORY);
redirect(302, AppRoute.MEMORY);
}) satisfies PageLoad;
@@ -3,5 +3,5 @@ import { redirect } from '@sveltejs/kit';
import type { PageLoad } from './$types';
export const load = (async () => {
throw redirect(302, AppRoute.PHOTOS);
redirect(302, AppRoute.PHOTOS);
}) satisfies PageLoad;
+1 -1
View File
@@ -4,7 +4,7 @@
import PeopleCard from '$lib/components/faces-page/people-card.svelte';
import FullScreenModal from '$lib/components/shared-components/full-screen-modal.svelte';
import Button from '$lib/components/elements/buttons/button.svelte';
import { api, PeopleUpdateItem, type PersonResponseDto } from '@api';
import { api, type PeopleUpdateItem, type PersonResponseDto } from '@api';
import { goto } from '$app/navigation';
import { AppRoute } from '$lib/constants';
import { handleError } from '$lib/utils/handle-error';
@@ -30,7 +30,7 @@
import { AssetStore } from '$lib/stores/assets.store';
import { websocketStore } from '$lib/stores/websocket';
import { handleError } from '$lib/utils/handle-error';
import { AssetResponseDto, PersonResponseDto, api } from '@api';
import { type AssetResponseDto, type PersonResponseDto, api } from '@api';
import { onMount } from 'svelte';
import type { PageData } from './$types';
import { clickOutside } from '$lib/utils/click-outside';
@@ -3,5 +3,5 @@ import { redirect } from '@sveltejs/kit';
import type { PageLoad } from './$types';
export const load = (async ({ params }) => {
throw redirect(302, `${AppRoute.PEOPLE}/${params.personId}`);
redirect(302, `${AppRoute.PEOPLE}/${params.personId}`);
}) satisfies PageLoad;
@@ -3,5 +3,5 @@ import { redirect } from '@sveltejs/kit';
import type { PageLoad } from './$types';
export const load = (async () => {
throw redirect(302, AppRoute.PHOTOS);
redirect(302, AppRoute.PHOTOS);
}) satisfies PageLoad;
+1 -1
View File
@@ -1,5 +1,5 @@
import { authenticate } from '$lib/utils/auth';
import { SearchResponseDto, api } from '@api';
import { type SearchResponseDto, api } from '@api';
import type { PageLoad } from './$types';
export const load = (async (data) => {
@@ -3,5 +3,5 @@ import { redirect } from '@sveltejs/kit';
import type { PageLoad } from './$types';
export const load = (async () => {
throw redirect(302, AppRoute.SEARCH);
redirect(302, AppRoute.SEARCH);
}) satisfies PageLoad;
+1 -1
View File
@@ -37,7 +37,7 @@ export const load = (async ({ params }) => {
};
}
throw error(404, {
error(404, {
message: 'Invalid shared link',
});
}
@@ -1,6 +1,6 @@
<script lang="ts">
import ControlAppBar from '$lib/components/shared-components/control-app-bar.svelte';
import { api, copyToClipboard, makeSharedLinkUrl, SharedLinkResponseDto } from '@api';
import { api, copyToClipboard, makeSharedLinkUrl, type SharedLinkResponseDto } from '@api';
import { goto } from '$app/navigation';
import SharedLinkCard from '$lib/components/sharedlinks-page/shared-link-card.svelte';
import {
@@ -3,5 +3,5 @@ import { redirect } from '@sveltejs/kit';
import type { PageLoad } from './$types';
export const load = (async () => {
throw redirect(302, AppRoute.TRASH);
redirect(302, AppRoute.TRASH);
}) satisfies PageLoad;
+1 -1
View File
@@ -18,7 +18,7 @@
import { api } from '@api';
import { closeWebsocketConnection, openWebsocketConnection } from '$lib/stores/websocket';
import { user } from '$lib/stores/user.store';
import { ThemeSetting, colorTheme, handleToggleTheme } from '$lib/stores/preferences.store';
import { type ThemeSetting, colorTheme, handleToggleTheme } from '$lib/stores/preferences.store';
import { Theme } from '$lib/constants';
let showNavigationLoadingBar = false;
+2 -2
View File
@@ -10,13 +10,13 @@ export const csr = true;
export const load = (async () => {
const authenticated = await isLoggedIn();
if (authenticated) {
throw redirect(302, AppRoute.PHOTOS);
redirect(302, AppRoute.PHOTOS);
}
const { data } = await api.serverInfoApi.getServerConfig();
if (data.isInitialized) {
// Redirect to login page if there exists an admin account (i.e. server is initialized)
throw redirect(302, AppRoute.AUTH_LOGIN);
redirect(302, AppRoute.AUTH_LOGIN);
}
return {
+1 -1
View File
@@ -3,5 +3,5 @@ import { redirect } from '@sveltejs/kit';
import type { PageLoad } from './$types';
export const load = (async () => {
throw redirect(302, AppRoute.ADMIN_USER_MANAGEMENT);
redirect(302, AppRoute.ADMIN_USER_MANAGEMENT);
}) satisfies PageLoad;
@@ -3,7 +3,7 @@
import LinkButton from '$lib/components/elements/buttons/link-button.svelte';
import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte';
import { AppRoute } from '$lib/constants';
import { AllJobStatusResponseDto, api } from '@api';
import { type AllJobStatusResponseDto, api } from '@api';
import { onDestroy, onMount } from 'svelte';
import Icon from '$lib/components/elements/icon.svelte';
import type { PageData } from './$types';
+1 -1
View File
@@ -11,7 +11,7 @@
import { downloadManager } from '$lib/stores/download';
import { downloadBlob } from '$lib/utils/asset-utils';
import { handleError } from '$lib/utils/handle-error';
import { FileReportItemDto, api, copyToClipboard } from '@api';
import { type FileReportItemDto, api, copyToClipboard } from '@api';
import Icon from '$lib/components/elements/icon.svelte';
import type { PageData } from './$types';
import { mdiWrench, mdiCheckAll, mdiDownload, mdiRefresh, mdiContentCopy } from '@mdi/js';
@@ -17,7 +17,7 @@
import { downloadManager } from '$lib/stores/download';
import { featureFlags } from '$lib/stores/server-config.store';
import { downloadBlob } from '$lib/utils/asset-utils';
import { SystemConfigDto, copyToClipboard } from '@api';
import { type SystemConfigDto, copyToClipboard } from '@api';
import Icon from '$lib/components/elements/icon.svelte';
import type { PageData } from './$types';
import NewVersionCheckSettings from '$lib/components/admin-page/settings/new-version-check-settings/new-version-check-settings.svelte';
@@ -1,5 +1,5 @@
<script lang="ts">
import { api, UserResponseDto } from '@api';
import { api, type UserResponseDto } from '@api';
import { onMount } from 'svelte';
import Icon from '$lib/components/elements/icon.svelte';
import FullScreenModal from '$lib/components/shared-components/full-screen-modal.svelte';
+1 -1
View File
@@ -7,7 +7,7 @@ import { getSavedUser } from '$lib/stores/user.store';
export const load = (async () => {
await authenticate();
if (!getSavedUser().shouldChangePassword) {
throw redirect(302, AppRoute.PHOTOS);
redirect(302, AppRoute.PHOTOS);
}
return {
+1 -1
View File
@@ -7,7 +7,7 @@ export const load = (async () => {
const { data } = await api.serverInfoApi.getServerConfig();
if (!data.isInitialized) {
// Admin not registered
throw redirect(302, AppRoute.AUTH_REGISTER);
redirect(302, AppRoute.AUTH_REGISTER);
}
return {
+1 -1
View File
@@ -7,7 +7,7 @@ export const load = (async () => {
const { data } = await api.serverInfoApi.getServerConfig();
if (data.isInitialized) {
// Admin has been registered, redirect to login
throw redirect(302, AppRoute.AUTH_LOGIN);
redirect(302, AppRoute.AUTH_LOGIN);
}
return {