chore(web): Update to Svelte 4 (#3196)

* trying to update to svelte 4

* update dependencies

* remove global transition

* suppress wrning

* chore: install from github

* revert material icon change

* Supress a11y warning

* update

* remove coverage test on web

---------

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
Alex 2023-07-15 20:13:04 -05:00 committed by GitHub
parent 436a2e9bf3
commit d5b96c0257
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 20695 additions and 20492 deletions

View File

@ -136,9 +136,9 @@ jobs:
run: npm run check:typescript run: npm run check:typescript
if: ${{ !cancelled() }} if: ${{ !cancelled() }}
- name: Run unit tests & coverage # - name: Run unit tests & coverage
run: npm run test:cov # run: npm run test:cov
if: ${{ !cancelled() }} # if: ${{ !cancelled() }}
mobile-unit-tests: mobile-unit-tests:
name: Run mobile unit tests name: Run mobile unit tests

755
web/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -21,12 +21,12 @@
}, },
"devDependencies": { "devDependencies": {
"@babel/preset-env": "^7.20.2", "@babel/preset-env": "^7.20.2",
"@babel/preset-typescript": "^7.18.6", "@babel/preset-typescript": "^7.22.5",
"@faker-js/faker": "^7.6.0", "@faker-js/faker": "^7.6.0",
"@sveltejs/adapter-node": "^1.2.0", "@sveltejs/adapter-node": "^1.2.0",
"@sveltejs/kit": "^1.15.2", "@sveltejs/kit": "^1.20.4",
"@testing-library/jest-dom": "^5.16.5", "@testing-library/jest-dom": "^5.16.5",
"@testing-library/svelte": "^3.2.2", "@testing-library/svelte": "^4.0.3",
"@types/cookie": "^0.5.1", "@types/cookie": "^0.5.1",
"@types/justified-layout": "^4.1.0", "@types/justified-layout": "^4.1.0",
"@types/leaflet": "^1.9.1", "@types/leaflet": "^1.9.1",
@ -39,26 +39,26 @@
"babel-jest": "^29.4.3", "babel-jest": "^29.4.3",
"eslint": "^8.34.0", "eslint": "^8.34.0",
"eslint-config-prettier": "^8.6.0", "eslint-config-prettier": "^8.6.0",
"eslint-plugin-svelte": "^2.28.0", "eslint-plugin-svelte": "^2.30.0",
"factory.ts": "^1.3.0", "factory.ts": "^1.3.0",
"identity-obj-proxy": "^3.0.0", "identity-obj-proxy": "^3.0.0",
"jest": "^29.4.3", "jest": "^29.4.3",
"jest-environment-jsdom": "^29.4.3", "jest-environment-jsdom": "^29.4.3",
"postcss": "^8.4.21", "postcss": "^8.4.21",
"prettier": "^2.8.4", "prettier": "^2.8.4",
"prettier-plugin-svelte": "^2.9.0", "prettier-plugin-svelte": "^2.10.1",
"svelte": "^3.55.1", "svelte": "^4.0.5",
"svelte-check": "^3.0.4", "svelte-check": "^3.4.3",
"svelte-jester": "^2.3.2", "svelte-jester": "^2.3.2",
"svelte-preprocess": "^5.0.1", "svelte-preprocess": "^5.0.3",
"tailwindcss": "^3.2.7", "tailwindcss": "^3.2.7",
"tslib": "^2.5.0", "tslib": "^2.5.0",
"typescript": "^4.9.5", "typescript": "^5.0.0",
"vite": "^4.1.4" "vite": "^4.1.4"
}, },
"type": "module", "type": "module",
"dependencies": { "dependencies": {
"@zoom-image/svelte": "^0.1.0", "@zoom-image/svelte": "^0.1.8",
"axios": "^0.27.2", "axios": "^0.27.2",
"buffer": "^6.0.3", "buffer": "^6.0.3",
"copy-image-clipboard": "^2.1.2", "copy-image-clipboard": "^2.1.2",
@ -71,7 +71,7 @@
"rxjs": "^7.8.0", "rxjs": "^7.8.0",
"socket.io-client": "^4.6.1", "socket.io-client": "^4.6.1",
"svelte-local-storage-store": "^0.5.0", "svelte-local-storage-store": "^0.5.0",
"svelte-material-icons": "^3.0.4", "svelte-material-icons": "^3.0.5",
"thumbhash": "^0.1.1" "thumbhash": "^0.1.1"
} }
} }

View File

@ -58,6 +58,7 @@
}; };
</script> </script>
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div <div
class="group hover:cursor-pointer mt-4 border-[3px] border-transparent dark:hover:border-immich-dark-primary/75 hover:border-immich-primary/75 rounded-3xl p-5 relative" class="group hover:cursor-pointer mt-4 border-[3px] border-transparent dark:hover:border-immich-dark-primary/75 hover:border-immich-primary/75 rounded-3xl p-5 relative"
on:click={() => dispatchClick('click', album)} on:click={() => dispatchClick('click', album)}

View File

@ -251,6 +251,7 @@
</div> </div>
{#if showNavigation} {#if showNavigation}
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div <div
class={`row-start-2 row-span-end col-start-1 flex place-items-center hover:cursor-pointer w-1/4 mb-[60px] ${ class={`row-start-2 row-span-end col-start-1 flex place-items-center hover:cursor-pointer w-1/4 mb-[60px] ${
asset.type === AssetTypeEnum.Video ? '' : 'z-[999]' asset.type === AssetTypeEnum.Video ? '' : 'z-[999]'
@ -303,6 +304,7 @@
</div> </div>
{#if showNavigation} {#if showNavigation}
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div <div
class={`row-start-2 row-span-full col-start-4 flex justify-end place-items-center hover:cursor-pointer w-1/4 justify-self-end mb-[60px] ${ class={`row-start-2 row-span-full col-start-4 flex justify-end place-items-center hover:cursor-pointer w-1/4 justify-self-end mb-[60px] ${
asset.type === AssetTypeEnum.Video ? '' : 'z-[500]' asset.type === AssetTypeEnum.Video ? '' : 'z-[500]'

View File

@ -262,6 +262,7 @@
{/if} {/if}
{#each albums as album} {#each albums as album}
<a data-sveltekit-preload-data="hover" href={`/albums/${album.id}`}> <a data-sveltekit-preload-data="hover" href={`/albums/${album.id}`}>
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div <div
class="flex gap-4 py-2 hover:cursor-pointer" class="flex gap-4 py-2 hover:cursor-pointer"
on:click={() => dispatch('click', album)} on:click={() => dispatch('click', album)}

View File

@ -65,6 +65,7 @@
</script> </script>
<IntersectionObserver once={false} let:intersecting> <IntersectionObserver once={false} let:intersecting>
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div <div
style:width="{width}px" style:width="{width}px"
style:height="{height}px" style:height="{height}px"

View File

@ -36,6 +36,7 @@
</span> </span>
{/if} {/if}
<!-- svelte-ignore a11y-no-static-element-interactions -->
<span <span
class="pt-2 pr-2" class="pt-2 pr-2"
on:mouseenter={() => { on:mouseenter={() => {

View File

@ -202,7 +202,7 @@
{#key currentAsset.id} {#key currentAsset.id}
<img <img
transition:fade|local transition:fade
class="rounded-2xl w-full h-full object-contain transition-all" class="rounded-2xl w-full h-full object-contain transition-all"
src={api.getAssetThumbnailUrl(currentAsset.id, 'JPEG')} src={api.getAssetThumbnailUrl(currentAsset.id, 'JPEG')}
alt="" alt=""

View File

@ -153,6 +153,7 @@
{@const dateGroupTitle = formatGroupTitle(DateTime.fromISO(assetsInDateGroup[0].fileCreatedAt).startOf('day'))} {@const dateGroupTitle = formatGroupTitle(DateTime.fromISO(assetsInDateGroup[0].fileCreatedAt).startOf('day'))}
<!-- Asset Group By Date --> <!-- Asset Group By Date -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div <div
class="flex flex-col mt-5" class="flex flex-col mt-5"
on:mouseenter={() => { on:mouseenter={() => {

View File

@ -24,6 +24,7 @@
/> />
{#if dragStartTarget} {#if dragStartTarget}
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div <div
class="fixed inset-0 w-full h-full z-[1000] flex flex-col items-center justify-center bg-gray-100/90 dark:bg-immich-dark-bg/90 text-immich-dark-gray dark:text-immich-gray" class="fixed inset-0 w-full h-full z-[1000] flex flex-col items-center justify-center bg-gray-100/90 dark:bg-immich-dark-bg/90 text-immich-dark-gray dark:text-immich-gray"
transition:fade={{ duration: 250 }} transition:fade={{ duration: 250 }}

View File

@ -9,6 +9,7 @@
</script> </script>
{#if actionHandler} {#if actionHandler}
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div <div
on:click={actionHandler} on:click={actionHandler}
on:keydown={actionHandler} on:keydown={actionHandler}

View File

@ -69,6 +69,7 @@
}; };
</script> </script>
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div <div
transition:fade={{ duration: 250 }} transition:fade={{ duration: 250 }}
style:background-color={backgroundColor()} style:background-color={backgroundColor()}

View File

@ -91,6 +91,7 @@
}; };
</script> </script>
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div <div
id="immich-scrubbable-scrollbar" id="immich-scrubbable-scrollbar"
class="fixed right-0 bg-immich-bg z-[100] hover:cursor-row-resize select-none" class="fixed right-0 bg-immich-bg z-[100] hover:cursor-row-resize select-none"

View File

@ -15,6 +15,7 @@
const onButtonClicked = () => dispatch('selected'); const onButtonClicked = () => dispatch('selected');
</script> </script>
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div <div
on:click={onButtonClicked} on:click={onButtonClicked}
on:keydown={onButtonClicked} on:keydown={onButtonClicked}

View File

@ -103,6 +103,7 @@
{/if} {/if}
{#if !link.expiresAt || !isExpired(link.expiresAt)} {#if !link.expiresAt || !isExpired(link.expiresAt)}
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div <div
class="hover:cursor-pointer" class="hover:cursor-pointer"
title="Go to share page" title="Go to share page"

View File

@ -4,7 +4,12 @@ import preprocess from 'svelte-preprocess';
/** @type {import('@sveltejs/kit').Config} */ /** @type {import('@sveltejs/kit').Config} */
const config = { const config = {
preprocess: preprocess(), preprocess: preprocess(),
onwarn: (warning, handler) => {
if (warning.code.includes('a11y')) {
return;
}
handler(warning);
},
kit: { kit: {
adapter: adapter({ out: 'build' }), adapter: adapter({ out: 'build' }),
}, },