diff --git a/package.json b/package.json index 5a177cf..5bad7d5 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "lodash-es": "^4.17.21", "lucide-vue-next": "^0.559.0", "markdown-it": "^14.1.0", + "masonry-layout": "^4.2.2", "pinia": "^3.0.3", "pinia-plugin-persist": "^1.0.0", "reka-ui": "^2.6.1", @@ -63,6 +64,7 @@ "@types/canvas-confetti": "^1.6.4", "@types/lodash-es": "^4.17.12", "@types/markdown-it": "^14.1.2", + "@types/masonry-layout": "^4.2.8", "@types/node": "^25.0.0", "@types/three": "0.166.0", "@typescript-eslint/eslint-plugin": "^8.49.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index edfd465..650d91a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -47,6 +47,9 @@ importers: markdown-it: specifier: ^14.1.0 version: 14.1.0 + masonry-layout: + specifier: ^4.2.2 + version: 4.2.2 pinia: specifier: ^3.0.3 version: 3.0.3(typescript@5.9.3)(vue@3.5.13(typescript@5.9.3)) @@ -138,6 +141,9 @@ importers: '@types/markdown-it': specifier: ^14.1.2 version: 14.1.2 + '@types/masonry-layout': + specifier: ^4.2.8 + version: 4.2.8 '@types/node': specifier: ^25.0.0 version: 25.0.0 @@ -1857,6 +1863,9 @@ packages: '@types/estree@1.0.8': resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==} + '@types/jquery@3.5.33': + resolution: {integrity: sha512-SeyVJXlCZpEki5F0ghuYe+L+PprQta6nRZqhONt9F13dWBtR/ftoaIbdRQ7cis7womE+X2LKhsDdDtkkDhJS6g==} + '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} @@ -1872,6 +1881,9 @@ packages: '@types/markdown-it@14.1.2': resolution: {integrity: sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==} + '@types/masonry-layout@4.2.8': + resolution: {integrity: sha512-Et2to22C31FG1UFaHRBL6BznMOhrur3Ckr9gvR7fRVmPgxqiwCEKZtV8GpFscHyNAKhZ0QlkwXJRPnJvxZUKQw==} + '@types/mdast@4.0.4': resolution: {integrity: sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==} @@ -1887,6 +1899,9 @@ packages: '@types/node@25.0.0': resolution: {integrity: sha512-rl78HwuZlaDIUSeUKkmogkhebA+8K1Hy7tddZuJ3D0xV8pZSfsYGTsliGUol1JPzu9EKnTxPC4L1fiWouStRew==} + '@types/sizzle@2.3.10': + resolution: {integrity: sha512-TC0dmN0K8YcWEAEfiPi5gJP14eJe30TTGjkvek3iM/1NdHHsdCA/Td6GvNndMOo/iSnIsZ4HuuhrYPDAmbxzww==} + '@types/sortablejs@1.15.9': resolution: {integrity: sha512-7HP+rZGE2p886PKV9c9OJzLBI6BBJu1O7lJGYnPyG3fS4/duUCcngkNCjsLwIMV+WMqANe3tt4irrXHSIe68OQ==} @@ -2881,6 +2896,9 @@ packages: resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} engines: {node: '>=6'} + desandro-matches-selector@2.0.2: + resolution: {integrity: sha512-+1q0nXhdzg1IpIJdMKalUwvvskeKnYyEe3shPRwedNcWtnhEKT3ZxvFjzywHDeGcKViIxTCAoOYQWP1qD7VNyg==} + detect-libc@1.0.3: resolution: {integrity: sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==} engines: {node: '>=0.10'} @@ -3245,6 +3263,9 @@ packages: resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==} engines: {node: '>= 0.6'} + ev-emitter@1.1.1: + resolution: {integrity: sha512-ipiDYhdQSCZ4hSbX4rMW+XzNKMD1prg/sTvoVmSLkuQ1MVlwjJQQA+sW8tMYR3BLUr9KjodFV4pvzunvRhd33Q==} + events@3.3.0: resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==} engines: {node: '>=0.8.x'} @@ -3335,6 +3356,9 @@ packages: resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} engines: {node: '>=10'} + fizzy-ui-utils@2.0.7: + resolution: {integrity: sha512-CZXDVXQ1If3/r8s0T+v+qVeMshhfcuq0rqIFgJnrtd+Bu8GmDmqMjntjUePypVtjHXKJ6V4sw9zeyox34n9aCg==} + flat-cache@4.0.1: resolution: {integrity: sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==} engines: {node: '>=16'} @@ -3410,6 +3434,9 @@ packages: get-intrinsic@1.2.2: resolution: {integrity: sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==} + get-size@2.0.3: + resolution: {integrity: sha512-lXNzT/h/dTjTxRbm9BXb+SGxxzkm97h/PCIKtlN/CBCxxmkkIVV21udumMS93MuVTDX583gqc94v3RjuHmI+2Q==} + get-stream@9.0.1: resolution: {integrity: sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA==} engines: {node: '>=18'} @@ -4088,6 +4115,9 @@ packages: markdown-table@3.0.4: resolution: {integrity: sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==} + masonry-layout@4.2.2: + resolution: {integrity: sha512-iGtAlrpHNyxaR19CvKC3npnEcAwszXoyJiI8ARV2ePi7fmYhIud25MHK8Zx4P0LCC4d3TNO9+rFa1KoK1OEOaA==} + mdast-util-find-and-replace@3.0.2: resolution: {integrity: sha512-Tmd1Vg/m3Xz43afeNxDIhWRtFZgM2VLyaf4vSTYwudTyeuTneoL3qtWMA5jeLyz/O1vDJmmV4QuScFCA2tBPwg==} @@ -4428,6 +4458,9 @@ packages: resolution: {integrity: sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==} engines: {node: '>= 0.8.0'} + outlayer@2.1.1: + resolution: {integrity: sha512-+GplXsCQ3VrbGujAeHEzP9SXsBmJxzn/YdDSQZL0xqBmAWBmortu2Y9Gwdp9J0bgDQ8/YNIPMoBM13nTwZfAhw==} + p-limit@3.1.0: resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} engines: {node: '>=10'} @@ -7438,6 +7471,10 @@ snapshots: '@types/estree@1.0.8': {} + '@types/jquery@3.5.33': + dependencies: + '@types/sizzle': 2.3.10 + '@types/json-schema@7.0.15': {} '@types/linkify-it@5.0.0': {} @@ -7453,6 +7490,10 @@ snapshots: '@types/linkify-it': 5.0.0 '@types/mdurl': 2.0.0 + '@types/masonry-layout@4.2.8': + dependencies: + '@types/jquery': 3.5.33 + '@types/mdast@4.0.4': dependencies: '@types/unist': 3.0.3 @@ -7469,6 +7510,8 @@ snapshots: dependencies: undici-types: 7.16.0 + '@types/sizzle@2.3.10': {} + '@types/sortablejs@1.15.9': {} '@types/stats.js@0.17.3': {} @@ -8640,6 +8683,8 @@ snapshots: dequal@2.0.3: {} + desandro-matches-selector@2.0.2: {} + detect-libc@1.0.3: optional: true @@ -9104,6 +9149,8 @@ snapshots: etag@1.8.1: {} + ev-emitter@1.1.1: {} + events@3.3.0: optional: true @@ -9219,6 +9266,10 @@ snapshots: locate-path: 6.0.0 path-exists: 4.0.0 + fizzy-ui-utils@2.0.7: + dependencies: + desandro-matches-selector: 2.0.2 + flat-cache@4.0.1: dependencies: flatted: 3.2.9 @@ -9281,6 +9332,8 @@ snapshots: has-symbols: 1.0.3 hasown: 2.0.0 + get-size@2.0.3: {} + get-stream@9.0.1: dependencies: '@sec-ant/readable-stream': 0.4.1 @@ -9886,6 +9939,11 @@ snapshots: markdown-table@3.0.4: {} + masonry-layout@4.2.2: + dependencies: + get-size: 2.0.3 + outlayer: 2.1.1 + mdast-util-find-and-replace@3.0.2: dependencies: '@types/mdast': 4.0.4 @@ -10415,6 +10473,12 @@ snapshots: prelude-ls: 1.2.1 type-check: 0.4.0 + outlayer@2.1.1: + dependencies: + ev-emitter: 1.1.1 + fizzy-ui-utils: 2.0.7 + get-size: 2.0.3 + p-limit@3.1.0: dependencies: yocto-queue: 0.1.0 diff --git a/public/readme-en.md b/src/assets/md/readme-en.md similarity index 100% rename from public/readme-en.md rename to src/assets/md/readme-en.md diff --git a/public/readme-zhCn.md b/src/assets/md/readme-zhCn.md similarity index 100% rename from public/readme-zhCn.md rename to src/assets/md/readme-zhCn.md diff --git a/src/components.d.ts b/src/components.d.ts index 3a2f22d..d40878a 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -62,5 +62,6 @@ declare module 'vue' { SvgIcon: typeof import('./components/SvgIcon/index.vue')['default'] Switch: typeof import('./components/ui/switch/Switch.vue')['default'] ToTop: typeof import('./components/ToTop/index.vue')['default'] + Waterfall: typeof import('./components/Waterfall/index.vue')['default'] } } diff --git a/src/components/FileUpload/index.vue b/src/components/FileUpload/index.vue index 1cc2b5e..7628862 100644 --- a/src/components/FileUpload/index.vue +++ b/src/components/FileUpload/index.vue @@ -2,7 +2,7 @@ import type { IFileData } from './type' import { ListMusic, Upload, X } from 'lucide-vue-next' import { ref } from 'vue' -import { readFileAsJsonData, readFileData } from '@/utils/file' +import { getBlobObjectUrl, readFileAsJsonData, readFileData, readFileDataAsBlob } from '@/utils/file' const props = defineProps<{ limitType?: string @@ -21,13 +21,14 @@ async function handleFileChange(e: Event) { if (props.mode === 'json') { const fileRes = await readFileAsJsonData(file) const jsonData = JSON.parse(fileRes) - fileData.value = { dataUrl: jsonData, fileName: file.name, type } + fileData.value = { data: jsonData, fileName: file.name, type } originFileName.value = file.name emits('uploadFile', fileData.value) return } - const { dataUrl, fileName } = await readFileData(file) - fileData.value = { dataUrl, fileName, type } + const { data: blobData, fileName } = await readFileDataAsBlob(file) + console.log('datafile', blobData, fileName) + fileData.value = { data: blobData, fileName, type } originFileName.value = fileName emits('uploadFile', fileData.value) } @@ -46,7 +47,7 @@ function removeFile() { @change="handleFileChange" >