From d00a7e2783a5db5692c8bbaac7e7b9c14a4acbcc Mon Sep 17 00:00:00 2001 From: rehlert Date: Fri, 12 Jun 2026 12:31:44 +0200 Subject: [PATCH] renders preview of zips --- .idea/workspace.xml | 18 ++- package.json | 3 +- pnpm-lock.yaml | 134 +++++++++++++++++ src/lib/components/AttachmentPreview.svelte | 89 ++++++++++++ .../ProcessedZipArchiveEditor.svelte | 136 ++++++++++++++++++ src/routes/+page.svelte | 20 ++- 6 files changed, 389 insertions(+), 11 deletions(-) create mode 100644 src/lib/components/AttachmentPreview.svelte create mode 100644 src/lib/components/ProcessedZipArchiveEditor.svelte diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 6fb4981..b672b2e 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,7 +3,8 @@ - + + @@ -89,7 +98,8 @@ - diff --git a/package.json b/package.json index 57060a1..58a5eec 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "dependencies": { "@skeletonlabs/skeleton": "^4.15.2", "@skeletonlabs/skeleton-svelte": "^4.15.2", - "fflate": "^0.8.3" + "fflate": "^0.8.3", + "pdfjs-dist": "^6.0.227" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7eeef8e..f9df5cc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,6 +17,9 @@ importers: fflate: specifier: ^0.8.3 version: 0.8.3 + pdfjs-dist: + specifier: ^6.0.227 + version: 6.0.227 devDependencies: '@sveltejs/adapter-auto': specifier: ^7.0.1 @@ -100,6 +103,81 @@ packages: '@jridgewell/trace-mapping@0.3.31': resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==} + '@napi-rs/canvas-android-arm64@1.0.0': + resolution: {integrity: sha512-3hNKJObUK7JsCF9aJlVCs1J0/KE/gGfZNeK8MO1ge6bB3aicr5walGme9t9No1f/oyk9GgvdAT/rjSdsx3gbIw==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [android] + + '@napi-rs/canvas-darwin-arm64@1.0.0': + resolution: {integrity: sha512-ZIja19/BiGz2puhki+WUYSRriwFeFJ8Mi9eK3hZdSS85w4Y60cuEAJVhMCfKwswQkKkUtrnzdKMBuO7TupvexA==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [darwin] + + '@napi-rs/canvas-darwin-x64@1.0.0': + resolution: {integrity: sha512-hImggWc82jqZVpEsFR9S7PE9OQYjq/H/D7vwCGB6X1jRH+UVBP1+1niJTPBOat1B154T6GKK7/kcFtoWgjgFzQ==} + engines: {node: '>= 10'} + cpu: [x64] + os: [darwin] + + '@napi-rs/canvas-linux-arm-gnueabihf@1.0.0': + resolution: {integrity: sha512-hlJRy6d+kWLKVOG/+1rEvNQVURZ0DxxRPJsLmEWwhwiXZUJc0BF5o9esALHSEP4CoJK4wChRtj3hnyBgVx2oWA==} + engines: {node: '>= 10'} + cpu: [arm] + os: [linux] + + '@napi-rs/canvas-linux-arm64-gnu@1.0.0': + resolution: {integrity: sha512-5Hru4T3RXkosRQafcjelv7AUzw9mXqmGYsxnzeDDOWveFCJyEPMSJltvGCM+jfH98seOCbfwm9KyFg6Jm5FhAA==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@napi-rs/canvas-linux-arm64-musl@1.0.0': + resolution: {integrity: sha512-LTUl9jS8WsLSUGaxQZKQkxfluOJRpgvBuxxdM4pYcjib+di8AU4OzQc6+L6SzGMLcKc9H0RAjojRatBhTMqYdg==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@napi-rs/canvas-linux-riscv64-gnu@1.0.0': + resolution: {integrity: sha512-Iz931SAZf+WVDzpjk52Q3ffW3zw0YflFwEZMgs036Wfu1kX/LrwT9wGjsuSqyduqefUkl91/vTdAjn8hQu5ezA==} + engines: {node: '>= 10'} + cpu: [riscv64] + os: [linux] + libc: [glibc] + + '@napi-rs/canvas-linux-x64-gnu@1.0.0': + resolution: {integrity: sha512-pFEQ5eFK4JusgN1K6KkO9DKP/Hi1WMJOkF8Ch03/khTc4bFbCKkCCsJG4YcOMOW9bI4XbT2/eMAWxhO0xaWgPA==} + engines: {node: '>= 10'} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@napi-rs/canvas-linux-x64-musl@1.0.0': + resolution: {integrity: sha512-jnvr8NrLHiZ3NCiOKWqDbkI4Ah+QDrqtZ+sddPZBltEb1mQ2coSvCSJYfict+oAwcm0c970oTmVySpjKP/lnaA==} + engines: {node: '>= 10'} + cpu: [x64] + os: [linux] + libc: [musl] + + '@napi-rs/canvas-win32-arm64-msvc@1.0.0': + resolution: {integrity: sha512-y2j9/Gfd5joqiqxdP/L1smqjQ+uAx3C4N0EC7bDHrnZEEH8ToM/OC5p3uHvtj4Lq591aHj+ArL01UDLNwT5HgQ==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [win32] + + '@napi-rs/canvas-win32-x64-msvc@1.0.0': + resolution: {integrity: sha512-qwdhh9N6Gge/hC4pL9S1tQp0iKwhSl/dYjg7+RGp9k26iRGRi5MqqUyKGOXIWli0zOcuy5Y2wIH/jk2ry6i/jA==} + engines: {node: '>= 10'} + cpu: [x64] + os: [win32] + + '@napi-rs/canvas@1.0.0': + resolution: {integrity: sha512-Jqxcy1XOIqj+lH9sl1GT+il6GR3uQv13vI2mrwubP3uT8Olak2ClDrK2RnxlQKjwv8BRr4b3ug0YR7c6hBX8wg==} + engines: {node: '>= 10'} + '@napi-rs/wasm-runtime@1.1.5': resolution: {integrity: sha512-AWPoBRJ9tsnVhor4sjO7rkni+7p+2IAEFj6cx06UgP10jkQHqay/36uRV/bFkgrh18D9vb4cr8Q0Pthskgzy+Q==} peerDependencies: @@ -720,6 +798,10 @@ packages: resolution: {integrity: sha512-AWGB9WFcRXOQs48Z/udjI5ZcZMHXwX8XPByNpOydgcGsDLIzjGizhoMWJyKAWze7AVW/2W1i+/gPX4YtKe5cyg==} engines: {node: '>=12.20.0'} + pdfjs-dist@6.0.227: + resolution: {integrity: sha512-/P6M4SXw+70waMVLUM7rdRtvo+dEzqE1t6W/zQNvBETo2MaRa5rrvCcAYdfWGiUzadTgM0lJmRApUrW0d9zgKg==} + engines: {node: '>=22.13.0 || >=24'} + picocolors@1.1.1: resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} @@ -973,6 +1055,54 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.5 + '@napi-rs/canvas-android-arm64@1.0.0': + optional: true + + '@napi-rs/canvas-darwin-arm64@1.0.0': + optional: true + + '@napi-rs/canvas-darwin-x64@1.0.0': + optional: true + + '@napi-rs/canvas-linux-arm-gnueabihf@1.0.0': + optional: true + + '@napi-rs/canvas-linux-arm64-gnu@1.0.0': + optional: true + + '@napi-rs/canvas-linux-arm64-musl@1.0.0': + optional: true + + '@napi-rs/canvas-linux-riscv64-gnu@1.0.0': + optional: true + + '@napi-rs/canvas-linux-x64-gnu@1.0.0': + optional: true + + '@napi-rs/canvas-linux-x64-musl@1.0.0': + optional: true + + '@napi-rs/canvas-win32-arm64-msvc@1.0.0': + optional: true + + '@napi-rs/canvas-win32-x64-msvc@1.0.0': + optional: true + + '@napi-rs/canvas@1.0.0': + optionalDependencies: + '@napi-rs/canvas-android-arm64': 1.0.0 + '@napi-rs/canvas-darwin-arm64': 1.0.0 + '@napi-rs/canvas-darwin-x64': 1.0.0 + '@napi-rs/canvas-linux-arm-gnueabihf': 1.0.0 + '@napi-rs/canvas-linux-arm64-gnu': 1.0.0 + '@napi-rs/canvas-linux-arm64-musl': 1.0.0 + '@napi-rs/canvas-linux-riscv64-gnu': 1.0.0 + '@napi-rs/canvas-linux-x64-gnu': 1.0.0 + '@napi-rs/canvas-linux-x64-musl': 1.0.0 + '@napi-rs/canvas-win32-arm64-msvc': 1.0.0 + '@napi-rs/canvas-win32-x64-msvc': 1.0.0 + optional: true + '@napi-rs/wasm-runtime@1.1.5(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0)': dependencies: '@emnapi/core': 1.10.0 @@ -1656,6 +1786,10 @@ snapshots: obug@2.1.2: {} + pdfjs-dist@6.0.227: + optionalDependencies: + '@napi-rs/canvas': 1.0.0 + picocolors@1.1.1: {} picomatch@4.0.4: {} diff --git a/src/lib/components/AttachmentPreview.svelte b/src/lib/components/AttachmentPreview.svelte new file mode 100644 index 0000000..e8ddec7 --- /dev/null +++ b/src/lib/components/AttachmentPreview.svelte @@ -0,0 +1,89 @@ + + +{#if attachment.kind === "image"} + {#if imageUrl} + {attachment.name} + {/if} +{:else if previewError} +
+ {previewError} +
+{:else} + +{/if} diff --git a/src/lib/components/ProcessedZipArchiveEditor.svelte b/src/lib/components/ProcessedZipArchiveEditor.svelte new file mode 100644 index 0000000..922b193 --- /dev/null +++ b/src/lib/components/ProcessedZipArchiveEditor.svelte @@ -0,0 +1,136 @@ + + +
+
+
+

{archive.name}

+

+ {attachments.length} relevante Datei{attachments.length === 1 ? "" : "en"} +

+
+
+ +
    + {#each attachments as attachment, index (attachment.path)} +
  • handleDragStart(index, event)} + ondragover={(event) => handleDragOver(index, event)} + ondrop={(event) => handleDrop(index, event)} + ondragend={handleDragEnd} + > +
    + + + +
    + + +
  • + {/each} +
+
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 1ae991d..b2557ea 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,5 +1,6 @@ {#snippet content()} @@ -48,13 +55,14 @@ {#if processedZipFiles.length > 0} -
    - {#each processedZipFiles as file} -
  • - {file.name} - {file.attachments.length} relevante Datei{file.attachments.length === 1 ? "" : "en"} -
  • +
    + {#each processedZipFiles as file, index} + updateProcessedZipFile(index, updatedArchive)} + /> {/each} -
+ {/if}