@l1yp/file-viewer 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +134 -0
- package/dist/FileViewer.js +7 -0
- package/dist/FileViewer.vue.d.ts +37 -0
- package/dist/FileViewer.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/_virtual/_plugin-vue_export-helper.js +8 -0
- package/dist/components/AppxViewer.js +7 -0
- package/dist/components/AppxViewer.vue.d.ts +18 -0
- package/dist/components/AppxViewer.vue_vue_type_script_setup_true_lang.js +174 -0
- package/dist/components/ArchiveBrowser.js +7 -0
- package/dist/components/ArchiveBrowser.vue.d.ts +18 -0
- package/dist/components/ArchiveBrowser.vue_vue_type_script_setup_true_lang.js +279 -0
- package/dist/components/AudioViewer.js +7 -0
- package/dist/components/AudioViewer.vue.d.ts +21 -0
- package/dist/components/AudioViewer.vue_vue_type_script_setup_true_lang.js +201 -0
- package/dist/components/BinObjBrowser.js +7 -0
- package/dist/components/BinObjBrowser.vue.d.ts +19 -0
- package/dist/components/BinObjBrowser.vue_vue_type_script_setup_true_lang.js +141 -0
- package/dist/components/CertViewer.js +7 -0
- package/dist/components/CertViewer.vue.d.ts +17 -0
- package/dist/components/CertViewer.vue_vue_type_script_setup_true_lang.js +251 -0
- package/dist/components/ClassViewer.js +7 -0
- package/dist/components/ClassViewer.vue.d.ts +15 -0
- package/dist/components/ClassViewer.vue_vue_type_script_setup_true_lang.js +164 -0
- package/dist/components/CodeBlock.js +7 -0
- package/dist/components/CodeBlock.vue.d.ts +17 -0
- package/dist/components/CodeBlock.vue_vue_type_script_setup_true_lang.js +79 -0
- package/dist/components/CodeView.js +7 -0
- package/dist/components/CodeView.vue.d.ts +21 -0
- package/dist/components/CodeView.vue_vue_type_script_setup_true_lang.js +180 -0
- package/dist/components/CsvViewer.js +7 -0
- package/dist/components/CsvViewer.vue.d.ts +26 -0
- package/dist/components/CsvViewer.vue_vue_type_script_setup_true_lang.js +187 -0
- package/dist/components/DicomViewer.js +7 -0
- package/dist/components/DicomViewer.vue.d.ts +30 -0
- package/dist/components/DicomViewer.vue_vue_type_script_setup_true_lang.js +362 -0
- package/dist/components/DocxViewer.js +7 -0
- package/dist/components/DocxViewer.vue.d.ts +19 -0
- package/dist/components/DocxViewer.vue_vue_type_script_setup_true_lang.js +59 -0
- package/dist/components/DrawioViewer.js +7 -0
- package/dist/components/DrawioViewer.vue.d.ts +16 -0
- package/dist/components/DrawioViewer.vue_vue_type_script_setup_true_lang.js +38 -0
- package/dist/components/DxfViewer.js +7 -0
- package/dist/components/DxfViewer.vue.d.ts +14 -0
- package/dist/components/DxfViewer.vue_vue_type_script_setup_true_lang.js +239 -0
- package/dist/components/EbookViewer.js +7 -0
- package/dist/components/EbookViewer.vue.d.ts +22 -0
- package/dist/components/EbookViewer.vue_vue_type_script_setup_true_lang.js +170 -0
- package/dist/components/EmlViewer.js +7 -0
- package/dist/components/EmlViewer.vue.d.ts +21 -0
- package/dist/components/EmlViewer.vue_vue_type_script_setup_true_lang.js +193 -0
- package/dist/components/EplViewer.js +7 -0
- package/dist/components/EplViewer.vue.d.ts +19 -0
- package/dist/components/EplViewer.vue_vue_type_script_setup_true_lang.js +201 -0
- package/dist/components/FileViewerBody.js +7 -0
- package/dist/components/FileViewerBody.vue.d.ts +47 -0
- package/dist/components/FileViewerBody.vue_vue_type_script_setup_true_lang.js +599 -0
- package/dist/components/FileViewerPanel.js +7 -0
- package/dist/components/FileViewerPanel.vue.d.ts +3 -0
- package/dist/components/FileViewerPanel.vue_vue_type_script_setup_true_lang.js +207 -0
- package/dist/components/FontViewer.js +7 -0
- package/dist/components/FontViewer.vue.d.ts +17 -0
- package/dist/components/FontViewer.vue_vue_type_script_setup_true_lang.js +120 -0
- package/dist/components/FrontmatterCard.js +7 -0
- package/dist/components/FrontmatterCard.vue.d.ts +11 -0
- package/dist/components/FrontmatterCard.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/components/GeoViewer.js +7 -0
- package/dist/components/GeoViewer.vue.d.ts +17 -0
- package/dist/components/GeoViewer.vue_vue_type_script_setup_true_lang.js +255 -0
- package/dist/components/HarViewer.js +7 -0
- package/dist/components/HarViewer.vue.d.ts +20 -0
- package/dist/components/HarViewer.vue_vue_type_script_setup_true_lang.js +322 -0
- package/dist/components/HexViewer.js +7 -0
- package/dist/components/HexViewer.vue.d.ts +22 -0
- package/dist/components/HexViewer.vue_vue_type_script_setup_true_lang.js +121 -0
- package/dist/components/HprofViewer.js +7 -0
- package/dist/components/HprofViewer.vue.d.ts +27 -0
- package/dist/components/HprofViewer.vue_vue_type_script_setup_true_lang.js +561 -0
- package/dist/components/ImageLightbox.js +7 -0
- package/dist/components/ImageLightbox.vue.d.ts +3 -0
- package/dist/components/ImageLightbox.vue_vue_type_script_setup_true_lang.js +86 -0
- package/dist/components/InlineText.d.ts +29 -0
- package/dist/components/InlineText.js +21 -0
- package/dist/components/JksViewer.js +7 -0
- package/dist/components/JksViewer.vue.d.ts +22 -0
- package/dist/components/JksViewer.vue_vue_type_script_setup_true_lang.js +353 -0
- package/dist/components/JsonlViewer.js +7 -0
- package/dist/components/JsonlViewer.vue.d.ts +15 -0
- package/dist/components/JsonlViewer.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/components/LogViewer.js +7 -0
- package/dist/components/LogViewer.vue.d.ts +29 -0
- package/dist/components/LogViewer.vue_vue_type_script_setup_true_lang.js +670 -0
- package/dist/components/LrcViewer.js +7 -0
- package/dist/components/LrcViewer.vue.d.ts +17 -0
- package/dist/components/LrcViewer.vue_vue_type_script_setup_true_lang.js +106 -0
- package/dist/components/MarkdownTable.js +7 -0
- package/dist/components/MarkdownTable.vue.d.ts +19 -0
- package/dist/components/MarkdownTable.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/components/MarkdownText.d.ts +30 -0
- package/dist/components/MarkdownText.js +21 -0
- package/dist/components/MhtViewer.js +7 -0
- package/dist/components/MhtViewer.vue.d.ts +22 -0
- package/dist/components/MhtViewer.vue_vue_type_script_setup_true_lang.js +112 -0
- package/dist/components/MindMapView.js +7 -0
- package/dist/components/MindMapView.vue.d.ts +23 -0
- package/dist/components/MindMapView.vue_vue_type_script_setup_true_lang.js +337 -0
- package/dist/components/MissingDependency.js +7 -0
- package/dist/components/MissingDependency.vue.d.ts +17 -0
- package/dist/components/MissingDependency.vue_vue_type_script_setup_true_lang.js +37 -0
- package/dist/components/ModelViewer.js +7 -0
- package/dist/components/ModelViewer.vue.d.ts +18 -0
- package/dist/components/ModelViewer.vue_vue_type_script_setup_true_lang.js +157 -0
- package/dist/components/MsiViewer.js +7 -0
- package/dist/components/MsiViewer.vue.d.ts +19 -0
- package/dist/components/MsiViewer.vue_vue_type_script_setup_true_lang.js +136 -0
- package/dist/components/NotebookViewer.js +7 -0
- package/dist/components/NotebookViewer.vue.d.ts +20 -0
- package/dist/components/NotebookViewer.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/components/PdfViewer.js +7 -0
- package/dist/components/PdfViewer.vue.d.ts +19 -0
- package/dist/components/PdfViewer.vue_vue_type_script_setup_true_lang.js +114 -0
- package/dist/components/PptxViewer.js +7 -0
- package/dist/components/PptxViewer.vue.d.ts +20 -0
- package/dist/components/PptxViewer.vue_vue_type_script_setup_true_lang.js +73 -0
- package/dist/components/PsdViewer.js +7 -0
- package/dist/components/PsdViewer.vue.d.ts +15 -0
- package/dist/components/PsdViewer.vue_vue_type_script_setup_true_lang.js +218 -0
- package/dist/components/QmcAudioViewer.js +7 -0
- package/dist/components/QmcAudioViewer.vue.d.ts +18 -0
- package/dist/components/QmcAudioViewer.vue_vue_type_script_setup_true_lang.js +92 -0
- package/dist/components/RasterViewer.js +7 -0
- package/dist/components/RasterViewer.vue.d.ts +21 -0
- package/dist/components/RasterViewer.vue_vue_type_script_setup_true_lang.js +161 -0
- package/dist/components/RtfViewer.js +7 -0
- package/dist/components/RtfViewer.vue.d.ts +21 -0
- package/dist/components/RtfViewer.vue_vue_type_script_setup_true_lang.js +66 -0
- package/dist/components/SevenZipBrowser.js +7 -0
- package/dist/components/SevenZipBrowser.vue.d.ts +13 -0
- package/dist/components/SevenZipBrowser.vue_vue_type_script_setup_true_lang.js +366 -0
- package/dist/components/SqliteViewer.js +7 -0
- package/dist/components/SqliteViewer.vue.d.ts +18 -0
- package/dist/components/SqliteViewer.vue_vue_type_script_setup_true_lang.js +186 -0
- package/dist/components/SubtitleViewer.js +7 -0
- package/dist/components/SubtitleViewer.vue.d.ts +15 -0
- package/dist/components/SubtitleViewer.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/XlsxChart.js +7 -0
- package/dist/components/XlsxChart.vue.d.ts +14 -0
- package/dist/components/XlsxChart.vue_vue_type_script_setup_true_lang.js +240 -0
- package/dist/components/XlsxViewer.js +7 -0
- package/dist/components/XlsxViewer.vue.d.ts +22 -0
- package/dist/components/XlsxViewer.vue_vue_type_script_setup_true_lang.js +814 -0
- package/dist/components/XmindViewer.js +7 -0
- package/dist/components/XmindViewer.vue.d.ts +13 -0
- package/dist/components/XmindViewer.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/ZipBrowser.js +7 -0
- package/dist/components/ZipBrowser.vue.d.ts +14 -0
- package/dist/components/ZipBrowser.vue_vue_type_script_setup_true_lang.js +326 -0
- package/dist/components/ZoomImage.js +7 -0
- package/dist/components/ZoomImage.vue.d.ts +29 -0
- package/dist/components/ZoomImage.vue_vue_type_script_setup_true_lang.js +147 -0
- package/dist/components/epl/EplCodeBlock.js +7 -0
- package/dist/components/epl/EplCodeBlock.vue.d.ts +15 -0
- package/dist/components/epl/EplCodeBlock.vue_vue_type_script_setup_true_lang.js +72 -0
- package/dist/components/epl/EplDoc.js +7 -0
- package/dist/components/epl/EplDoc.vue.d.ts +19 -0
- package/dist/components/epl/EplDoc.vue_vue_type_script_setup_true_lang.js +327 -0
- package/dist/components/epl/EplMethod.js +7 -0
- package/dist/components/epl/EplMethod.vue.d.ts +14 -0
- package/dist/components/epl/EplMethod.vue_vue_type_script_setup_true_lang.js +100 -0
- package/dist/components/epl/EplResource.js +7 -0
- package/dist/components/epl/EplResource.vue.d.ts +15 -0
- package/dist/components/epl/EplResource.vue_vue_type_script_setup_true_lang.js +204 -0
- package/dist/components/epl/EplTree.js +7 -0
- package/dist/components/epl/EplTree.vue.d.ts +27 -0
- package/dist/components/epl/EplTree.vue_vue_type_script_setup_true_lang.js +123 -0
- package/dist/components/epl/EplVarTable.js +7 -0
- package/dist/components/epl/EplVarTable.vue.d.ts +21 -0
- package/dist/components/epl/EplVarTable.vue_vue_type_script_setup_true_lang.js +60 -0
- package/dist/components/epl/docTypes.d.ts +12 -0
- package/dist/components/epl/numbering.d.ts +21 -0
- package/dist/components/epl/numbering.js +14 -0
- package/dist/components/icons/Icon.js +7 -0
- package/dist/components/icons/Icon.vue.d.ts +14 -0
- package/dist/components/icons/Icon.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/components/icons/iconPaths.d.ts +60 -0
- package/dist/components/icons/iconPaths.js +54 -0
- package/dist/components/optionalViewer.d.ts +14 -0
- package/dist/components/optionalViewer.js +37 -0
- package/dist/components/ui/ClampBlock.d.ts +82 -0
- package/dist/components/ui/ClampBlock.js +63 -0
- package/dist/composables/useFileViewer.d.ts +428 -0
- package/dist/composables/useFileViewer.js +27 -0
- package/dist/composables/useLightbox.d.ts +33 -0
- package/dist/composables/useLightbox.js +17 -0
- package/dist/composables/useLogRules.d.ts +47 -0
- package/dist/composables/useLogRules.js +74 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +30 -0
- package/dist/lib/aes.d.ts +25 -0
- package/dist/lib/aes.js +99 -0
- package/dist/lib/appx.d.ts +66 -0
- package/dist/lib/appx.js +112 -0
- package/dist/lib/archive.d.ts +29 -0
- package/dist/lib/asn1.d.ts +47 -0
- package/dist/lib/asn1.js +122 -0
- package/dist/lib/binobj.d.ts +69 -0
- package/dist/lib/binobj.js +430 -0
- package/dist/lib/brotli.d.ts +14 -0
- package/dist/lib/brotli.js +16 -0
- package/dist/lib/bzip2.d.ts +14 -0
- package/dist/lib/bzip2.js +161 -0
- package/dist/lib/classfile.d.ts +72 -0
- package/dist/lib/classfile.js +210 -0
- package/dist/lib/codePreview.d.ts +22 -0
- package/dist/lib/codePreview.js +27 -0
- package/dist/lib/codefold.d.ts +14 -0
- package/dist/lib/codefold.js +30 -0
- package/dist/lib/codeformat.d.ts +21 -0
- package/dist/lib/codeformat.js +130 -0
- package/dist/lib/csv.d.ts +19 -0
- package/dist/lib/csv.js +74 -0
- package/dist/lib/des.d.ts +17 -0
- package/dist/lib/des.js +928 -0
- package/dist/lib/diagram.d.ts +5 -0
- package/dist/lib/diagram.js +479 -0
- package/dist/lib/dicom.d.ts +69 -0
- package/dist/lib/dicom.js +442 -0
- package/dist/lib/dicomCodecs.d.ts +28 -0
- package/dist/lib/dicomCodecs.js +156 -0
- package/dist/lib/dicomRender.d.ts +46 -0
- package/dist/lib/dicomRender.js +114 -0
- package/dist/lib/dxf.d.ts +86 -0
- package/dist/lib/dxf.js +399 -0
- package/dist/lib/eml.d.ts +40 -0
- package/dist/lib/eml.js +46 -0
- package/dist/lib/encoding.d.ts +28 -0
- package/dist/lib/encoding.js +44 -0
- package/dist/lib/epl/code/ast.d.ts +150 -0
- package/dist/lib/epl/code/codeDataParser.d.ts +3 -0
- package/dist/lib/epl/code/codeDataParser.js +330 -0
- package/dist/lib/epl/code/codeLines.d.ts +20 -0
- package/dist/lib/epl/code/codeLines.js +191 -0
- package/dist/lib/epl/code/structures.d.ts +86 -0
- package/dist/lib/epl/code/textCode.d.ts +29 -0
- package/dist/lib/epl/code/textCode.js +150 -0
- package/dist/lib/epl/code/variable.d.ts +25 -0
- package/dist/lib/epl/eplDocument.d.ts +21 -0
- package/dist/lib/epl/eplDocument.js +36 -0
- package/dist/lib/epl/imageList.d.ts +28 -0
- package/dist/lib/epl/imageList.js +66 -0
- package/dist/lib/epl/index.d.ts +53 -0
- package/dist/lib/epl/index.js +45 -0
- package/dist/lib/epl/io/binaryReader.d.ts +56 -0
- package/dist/lib/epl/io/binaryReader.js +119 -0
- package/dist/lib/epl/io/encoding.d.ts +16 -0
- package/dist/lib/epl/io/encoding.js +27 -0
- package/dist/lib/epl/model/eplSystemId.d.ts +64 -0
- package/dist/lib/epl/model/eplSystemId.js +16 -0
- package/dist/lib/epl/model/section.d.ts +46 -0
- package/dist/lib/epl/names/eplLibData.js +39 -0
- package/dist/lib/epl/names/idToNameMap.d.ts +33 -0
- package/dist/lib/epl/names/idToNameMap.js +130 -0
- package/dist/lib/epl/names/libNameProvider.d.ts +15 -0
- package/dist/lib/epl/names/libNameProvider.js +18 -0
- package/dist/lib/epl/program.d.ts +120 -0
- package/dist/lib/epl/program.js +134 -0
- package/dist/lib/epl/projectFileReader.d.ts +23 -0
- package/dist/lib/epl/projectFileReader.js +65 -0
- package/dist/lib/epl/sections/code.d.ts +20 -0
- package/dist/lib/epl/sections/esystemInfo.d.ts +14 -0
- package/dist/lib/epl/sections/losable.d.ts +11 -0
- package/dist/lib/epl/sections/projectConfig.d.ts +23 -0
- package/dist/lib/epl/sections/resource.d.ts +57 -0
- package/dist/lib/fb2.d.ts +14 -0
- package/dist/lib/fb2.js +62 -0
- package/dist/lib/fileType.d.ts +315 -0
- package/dist/lib/fileType.js +800 -0
- package/dist/lib/fonts.d.ts +8 -0
- package/dist/lib/fonts.js +4 -0
- package/dist/lib/format.d.ts +16 -0
- package/dist/lib/format.js +38 -0
- package/dist/lib/frontmatter.d.ts +13 -0
- package/dist/lib/frontmatter.js +23 -0
- package/dist/lib/geo.d.ts +30 -0
- package/dist/lib/geo.js +235 -0
- package/dist/lib/har.d.ts +171 -0
- package/dist/lib/har.js +397 -0
- package/dist/lib/highlight.d.ts +18 -0
- package/dist/lib/highlight.js +34 -0
- package/dist/lib/highlightLangs.d.ts +15 -0
- package/dist/lib/highlightLangs.js +93 -0
- package/dist/lib/hprof.d.ts +211 -0
- package/dist/lib/hprof.js +709 -0
- package/dist/lib/ipynb.d.ts +48 -0
- package/dist/lib/ipynb.js +130 -0
- package/dist/lib/jks.d.ts +86 -0
- package/dist/lib/jks.js +167 -0
- package/dist/lib/jsonl.d.ts +29 -0
- package/dist/lib/jsonl.js +24 -0
- package/dist/lib/lrc.d.ts +32 -0
- package/dist/lib/lrc.js +84 -0
- package/dist/lib/lzma.d.ts +70 -0
- package/dist/lib/lzma.js +204 -0
- package/dist/lib/markdown/blocks.d.ts +9 -0
- package/dist/lib/markdown/blocks.js +221 -0
- package/dist/lib/markdown/index.d.ts +3 -0
- package/dist/lib/markdown/inline.d.ts +33 -0
- package/dist/lib/markdown/inline.js +84 -0
- package/dist/lib/markdown/math.d.ts +5 -0
- package/dist/lib/markdown/math.js +25 -0
- package/dist/lib/markdown/segmentize.d.ts +11 -0
- package/dist/lib/markdown/segmentize.js +28 -0
- package/dist/lib/markdown/styles.d.ts +26 -0
- package/dist/lib/markdown/styles.js +135 -0
- package/dist/lib/mht.d.ts +51 -0
- package/dist/lib/mht.js +122 -0
- package/dist/lib/midi.d.ts +28 -0
- package/dist/lib/midi.js +84 -0
- package/dist/lib/mime.d.ts +82 -0
- package/dist/lib/mime.js +151 -0
- package/dist/lib/mindmap.d.ts +51 -0
- package/dist/lib/mindmap.js +113 -0
- package/dist/lib/mobi.d.ts +15 -0
- package/dist/lib/mobi.js +68 -0
- package/dist/lib/msi.d.ts +50 -0
- package/dist/lib/msi.js +332 -0
- package/dist/lib/optionalDep.d.ts +26 -0
- package/dist/lib/optionalDep.js +20 -0
- package/dist/lib/pkcs12.d.ts +56 -0
- package/dist/lib/pkcs12.js +356 -0
- package/dist/lib/qmc.d.ts +50 -0
- package/dist/lib/qmc.js +213 -0
- package/dist/lib/rar.d.ts +16 -0
- package/dist/lib/rar.js +40 -0
- package/dist/lib/rawPreview.d.ts +12 -0
- package/dist/lib/rawPreview.js +54 -0
- package/dist/lib/rc2.d.ts +12 -0
- package/dist/lib/rc2.js +298 -0
- package/dist/lib/resolveInput.d.ts +22 -0
- package/dist/lib/resolveInput.js +55 -0
- package/dist/lib/rtf.d.ts +53 -0
- package/dist/lib/rtf.js +413 -0
- package/dist/lib/sevenZip.d.ts +82 -0
- package/dist/lib/sevenZip.js +395 -0
- package/dist/lib/sha1.d.ts +24 -0
- package/dist/lib/sha1.js +53 -0
- package/dist/lib/sha256.d.ts +21 -0
- package/dist/lib/sha256.js +119 -0
- package/dist/lib/speechAudio.d.ts +36 -0
- package/dist/lib/speechAudio.js +85 -0
- package/dist/lib/sqlite.d.ts +38 -0
- package/dist/lib/sqlite.js +104 -0
- package/dist/lib/subtitle.d.ts +26 -0
- package/dist/lib/subtitle.js +99 -0
- package/dist/lib/tarball.d.ts +20 -0
- package/dist/lib/tarball.js +248 -0
- package/dist/lib/viewerFormats.d.ts +35 -0
- package/dist/lib/viewerFormats.js +83 -0
- package/dist/lib/viewerKind.d.ts +36 -0
- package/dist/lib/viewerKind.js +233 -0
- package/dist/lib/x509.d.ts +68 -0
- package/dist/lib/x509.js +267 -0
- package/dist/lib/xlsx.d.ts +55 -0
- package/dist/lib/xlsx.js +321 -0
- package/dist/lib/xlsxCharts.d.ts +34 -0
- package/dist/lib/xlsxCharts.js +152 -0
- package/dist/lib/xmind.d.ts +6 -0
- package/dist/lib/xmind.js +124 -0
- package/dist/lib/zip.d.ts +56 -0
- package/dist/lib/zip.js +169 -0
- package/dist/style.css +2 -0
- package/dist/types.d.ts +42 -0
- package/package.json +128 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import e from "./MissingDependency.js";
|
|
2
|
+
import { formatBytes as t } from "../lib/format.js";
|
|
3
|
+
import n from "./icons/Icon.js";
|
|
4
|
+
import { isMissingModule as r } from "../lib/optionalDep.js";
|
|
5
|
+
import { Fragment as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createVNode as l, defineComponent as u, normalizeClass as d, normalizeStyle as f, onBeforeUnmount as p, openBlock as m, ref as h, renderList as g, shallowRef as _, toDisplayString as v, unref as y, watch as b } from "vue";
|
|
6
|
+
//#region src/components/PsdViewer.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
+
var x = { class: "psd" }, S = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "psd__msg"
|
|
10
|
+
}, C = {
|
|
11
|
+
key: 1,
|
|
12
|
+
class: "psd__msg psd__gate"
|
|
13
|
+
}, w = {
|
|
14
|
+
key: 3,
|
|
15
|
+
class: "psd__msg psd__msg--error"
|
|
16
|
+
}, T = { class: "psd__bar" }, E = { class: "psd__dim" }, D = {
|
|
17
|
+
key: 0,
|
|
18
|
+
class: "psd__dim"
|
|
19
|
+
}, O = {
|
|
20
|
+
key: 1,
|
|
21
|
+
class: "psd__dim"
|
|
22
|
+
}, k = {
|
|
23
|
+
key: 0,
|
|
24
|
+
class: "psd__layers"
|
|
25
|
+
}, A = ["title", "onClick"], ee = { class: "psd__thumb" }, te = ["src"], ne = {
|
|
26
|
+
key: 1,
|
|
27
|
+
class: "psd__thumb--group"
|
|
28
|
+
}, j = { class: "psd__name" }, M = {
|
|
29
|
+
key: 0,
|
|
30
|
+
class: "psd__blend"
|
|
31
|
+
}, N = {
|
|
32
|
+
key: 1,
|
|
33
|
+
class: "psd__op"
|
|
34
|
+
}, P = 60 * 1024 * 1024, F = /*@__PURE__*/ u({
|
|
35
|
+
__name: "PsdViewer",
|
|
36
|
+
props: {
|
|
37
|
+
url: {},
|
|
38
|
+
name: {},
|
|
39
|
+
size: {}
|
|
40
|
+
},
|
|
41
|
+
setup(u) {
|
|
42
|
+
let F = u, I = h("loading"), L = h(""), R = h(null), z = h(!0), B = 0, V = 0, H = _([]), U = _([]), W = /* @__PURE__ */ new Map(), G = h(/* @__PURE__ */ new Set()), K, q = h(), J = h(0), Y = {
|
|
43
|
+
normal: "source-over",
|
|
44
|
+
multiply: "multiply",
|
|
45
|
+
screen: "screen",
|
|
46
|
+
overlay: "overlay",
|
|
47
|
+
darken: "darken",
|
|
48
|
+
lighten: "lighten",
|
|
49
|
+
"color dodge": "color-dodge",
|
|
50
|
+
"linear dodge": "lighter",
|
|
51
|
+
"color burn": "color-burn",
|
|
52
|
+
"hard light": "hard-light",
|
|
53
|
+
"soft light": "soft-light",
|
|
54
|
+
difference: "difference",
|
|
55
|
+
exclusion: "exclusion",
|
|
56
|
+
hue: "hue",
|
|
57
|
+
saturation: "saturation",
|
|
58
|
+
color: "color",
|
|
59
|
+
luminosity: "luminosity"
|
|
60
|
+
};
|
|
61
|
+
function X(e) {
|
|
62
|
+
if (!e.width || !e.height) return;
|
|
63
|
+
let t = document.createElement("canvas");
|
|
64
|
+
t.width = 34, t.height = 34;
|
|
65
|
+
let n = t.getContext("2d");
|
|
66
|
+
if (!n) return;
|
|
67
|
+
let r = Math.min(34 / e.width, 34 / e.height), i = e.width * r, a = e.height * r;
|
|
68
|
+
return n.drawImage(e, (34 - i) / 2, (34 - a) / 2, i, a), t.toDataURL();
|
|
69
|
+
}
|
|
70
|
+
function re(e) {
|
|
71
|
+
W.clear();
|
|
72
|
+
let t = /* @__PURE__ */ new Set(), n = 0;
|
|
73
|
+
function r(e, i, a) {
|
|
74
|
+
let o = [];
|
|
75
|
+
for (let s of e ?? []) {
|
|
76
|
+
let e = Array.isArray(s.children), c = {
|
|
77
|
+
id: n++,
|
|
78
|
+
name: s.name || (e ? "组" : "图层"),
|
|
79
|
+
depth: i,
|
|
80
|
+
isGroup: e,
|
|
81
|
+
opacity: typeof s.opacity == "number" ? s.opacity : 1,
|
|
82
|
+
blend: s.blendMode || "normal",
|
|
83
|
+
left: s.left ?? 0,
|
|
84
|
+
top: s.top ?? 0,
|
|
85
|
+
canvas: e ? void 0 : s.canvas,
|
|
86
|
+
parentId: a,
|
|
87
|
+
children: []
|
|
88
|
+
};
|
|
89
|
+
W.set(c.id, c), s.hidden && t.add(c.id), c.canvas && (c.thumb = X(c.canvas)), e && (c.children = r(s.children, i + 1, c.id)), o.push(c);
|
|
90
|
+
}
|
|
91
|
+
return o;
|
|
92
|
+
}
|
|
93
|
+
let i = r(e.children, 0, -1), a = [], o = (e) => {
|
|
94
|
+
for (let t of e) t.isGroup ? o(t.children) : t.canvas && a.push(t);
|
|
95
|
+
};
|
|
96
|
+
o(i);
|
|
97
|
+
let s = [], c = (e) => {
|
|
98
|
+
for (let t of [...e].reverse()) s.push(t), t.isGroup && c(t.children);
|
|
99
|
+
};
|
|
100
|
+
c(i), H.value = a, U.value = s, G.value = t, J.value = a.length, K = a.length ? void 0 : e.canvas;
|
|
101
|
+
}
|
|
102
|
+
function Z(e) {
|
|
103
|
+
let t = W.get(e);
|
|
104
|
+
for (; t;) {
|
|
105
|
+
if (G.value.has(t.id)) return !1;
|
|
106
|
+
t = t.parentId >= 0 ? W.get(t.parentId) : void 0;
|
|
107
|
+
}
|
|
108
|
+
return !0;
|
|
109
|
+
}
|
|
110
|
+
function Q() {
|
|
111
|
+
let e = q.value;
|
|
112
|
+
if (!e) return;
|
|
113
|
+
e.width = B || K?.width || 1, e.height = V || K?.height || 1;
|
|
114
|
+
let t = e.getContext("2d");
|
|
115
|
+
if (t) {
|
|
116
|
+
if (t.clearRect(0, 0, e.width, e.height), K) {
|
|
117
|
+
t.drawImage(K, 0, 0);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
for (let e of H.value) !e.canvas || !Z(e.id) || (t.globalAlpha = Math.max(0, Math.min(1, e.opacity)), t.globalCompositeOperation = Y[e.blend] ?? "source-over", t.drawImage(e.canvas, e.left, e.top));
|
|
121
|
+
t.globalAlpha = 1, t.globalCompositeOperation = "source-over";
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function ie(e) {
|
|
125
|
+
let t = new Set(G.value);
|
|
126
|
+
t.has(e.id) ? t.delete(e.id) : t.add(e.id), G.value = t, Q();
|
|
127
|
+
}
|
|
128
|
+
function ae() {
|
|
129
|
+
if (F.url) {
|
|
130
|
+
if (F.size && F.size > P) {
|
|
131
|
+
I.value = "gate";
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
$();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
async function $() {
|
|
138
|
+
if (F.url) {
|
|
139
|
+
I.value = "loading", L.value = "", R.value = null;
|
|
140
|
+
try {
|
|
141
|
+
let e = await fetch(F.url);
|
|
142
|
+
if (!e.ok) throw Error(`HTTP ${e.status}`);
|
|
143
|
+
let t = await e.arrayBuffer(), { readPsd: n } = await import("ag-psd"), r = n(t, { skipThumbnail: !0 });
|
|
144
|
+
B = r.width, V = r.height, re(r), I.value = "ready", requestAnimationFrame(Q);
|
|
145
|
+
} catch (e) {
|
|
146
|
+
r(e) ? R.value = ["ag-psd"] : L.value = e instanceof Error ? e.message : String(e), I.value = "error";
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return b(() => F.url, ae, { immediate: !0 }), p(() => {
|
|
151
|
+
H.value = [], U.value = [], W.clear();
|
|
152
|
+
}), (r, u) => (m(), s("div", x, [I.value === "loading" ? (m(), s("p", S, "正在解码 PSD…")) : I.value === "gate" ? (m(), s("div", C, [c("p", null, "该 PSD 较大(" + v(y(t)(F.size)) + "),将在浏览器内逐图层解码。是否继续?", 1), c("button", {
|
|
153
|
+
type: "button",
|
|
154
|
+
class: "psd__btn",
|
|
155
|
+
onClick: $
|
|
156
|
+
}, "解码并预览")])) : R.value ? (m(), a(e, {
|
|
157
|
+
key: 2,
|
|
158
|
+
pkg: R.value,
|
|
159
|
+
label: "PSD",
|
|
160
|
+
"download-url": F.url,
|
|
161
|
+
"download-name": F.name
|
|
162
|
+
}, null, 8, [
|
|
163
|
+
"pkg",
|
|
164
|
+
"download-url",
|
|
165
|
+
"download-name"
|
|
166
|
+
])) : I.value === "error" ? (m(), s("div", w, [c("p", null, "解码失败:" + v(L.value), 1), c("button", {
|
|
167
|
+
type: "button",
|
|
168
|
+
class: "psd__btn",
|
|
169
|
+
onClick: $
|
|
170
|
+
}, "重试")])) : (m(), s(i, { key: 4 }, [
|
|
171
|
+
c("div", T, [
|
|
172
|
+
u[1] ||= c("span", { class: "psd__badge" }, "PSD", -1),
|
|
173
|
+
c("span", E, v(y(B)) + "×" + v(y(V)), 1),
|
|
174
|
+
J.value ? (m(), s("span", D, v(J.value) + " 图层", 1)) : o("", !0),
|
|
175
|
+
F.size ? (m(), s("span", O, v(y(t)(F.size)), 1)) : o("", !0),
|
|
176
|
+
u[2] ||= c("span", { class: "psd__spacer" }, null, -1),
|
|
177
|
+
c("button", {
|
|
178
|
+
type: "button",
|
|
179
|
+
class: d(["psd__toggle", { "psd__toggle--on": !z.value }]),
|
|
180
|
+
onClick: u[0] ||= (e) => z.value = !z.value
|
|
181
|
+
}, v(z.value ? "原始大小" : "适应"), 3)
|
|
182
|
+
]),
|
|
183
|
+
c("div", { class: d(["psd__stage", { "psd__stage--fit": z.value }]) }, [c("canvas", {
|
|
184
|
+
ref_key: "stage",
|
|
185
|
+
ref: q,
|
|
186
|
+
class: d(["psd__canvas", { "psd__canvas--fit": z.value }])
|
|
187
|
+
}, null, 2)], 2),
|
|
188
|
+
U.value.length ? (m(), s("ul", k, [(m(!0), s(i, null, g(U.value, (e) => (m(), s("li", {
|
|
189
|
+
key: e.id,
|
|
190
|
+
class: d(["psd__layer", {
|
|
191
|
+
"psd__layer--group": e.isGroup,
|
|
192
|
+
"psd__layer--off": !Z(e.id)
|
|
193
|
+
}]),
|
|
194
|
+
style: f({ paddingLeft: 10 + e.depth * 14 + "px" })
|
|
195
|
+
}, [
|
|
196
|
+
c("button", {
|
|
197
|
+
type: "button",
|
|
198
|
+
class: d(["psd__eye", { "psd__eye--off": G.value.has(e.id) }]),
|
|
199
|
+
title: G.value.has(e.id) ? "显示" : "隐藏",
|
|
200
|
+
onClick: (t) => ie(e)
|
|
201
|
+
}, [l(n, {
|
|
202
|
+
name: "eye",
|
|
203
|
+
size: 14
|
|
204
|
+
})], 10, A),
|
|
205
|
+
c("span", ee, [e.thumb ? (m(), s("img", {
|
|
206
|
+
key: 0,
|
|
207
|
+
src: e.thumb,
|
|
208
|
+
alt: ""
|
|
209
|
+
}, null, 8, te)) : (m(), s("span", ne))]),
|
|
210
|
+
c("span", j, v(e.name), 1),
|
|
211
|
+
e.blend === "normal" ? o("", !0) : (m(), s("span", M, v(e.blend), 1)),
|
|
212
|
+
e.opacity < 1 ? (m(), s("span", N, v(Math.round(e.opacity * 100)) + "%", 1)) : o("", !0)
|
|
213
|
+
], 6))), 128))])) : o("", !0)
|
|
214
|
+
], 64))]));
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
//#endregion
|
|
218
|
+
export { F as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e from "../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "./QmcAudioViewer.vue_vue_type_script_setup_true_lang.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
//#region src/components/QmcAudioViewer.vue
|
|
5
|
+
var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-b95a2049"]]);
|
|
6
|
+
//#endregion
|
|
7
|
+
export { n as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Side-viewer player for QQ Music encrypted audio (`.mflac` / `.mgg` / …). Fetches the encrypted bytes from
|
|
3
|
+
* the download URL, DECRYPTS them in-browser (see lib/qmc.ts) — recovering the embedded key and undoing the
|
|
4
|
+
* QMCv2 stream cipher — then plays the resulting FLAC/OGG/MP3 through a native <audio> from a typed Blob URL.
|
|
5
|
+
*
|
|
6
|
+
* The panel's own download button would only fetch the still-encrypted file, so this viewer surfaces its own
|
|
7
|
+
* "download decrypted" action (the playable audio with the right extension). Decryption is pure + fast
|
|
8
|
+
* (tens of ms even for ~60MB), but it loads the whole file into memory, so very large files are gated behind
|
|
9
|
+
* a confirm like the plain AudioViewer.
|
|
10
|
+
*/
|
|
11
|
+
type __VLS_Props = {
|
|
12
|
+
url?: string;
|
|
13
|
+
name: string;
|
|
14
|
+
size?: number;
|
|
15
|
+
};
|
|
16
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const _default: typeof __VLS_export;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { fileExt as e } from "../lib/fileType.js";
|
|
2
|
+
import { formatBytes as t } from "../lib/format.js";
|
|
3
|
+
import n from "./icons/Icon.js";
|
|
4
|
+
import { QmcError as r, decryptQmc as i } from "../lib/qmc.js";
|
|
5
|
+
import { computed as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createVNode as l, defineComponent as u, onBeforeUnmount as d, openBlock as f, ref as p, toDisplayString as m, unref as h, watch as g } from "vue";
|
|
6
|
+
//#region src/components/QmcAudioViewer.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
+
var _ = { class: "qmc" }, v = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "qmc__msg"
|
|
10
|
+
}, y = {
|
|
11
|
+
key: 1,
|
|
12
|
+
class: "qmc__msg"
|
|
13
|
+
}, b = {
|
|
14
|
+
key: 2,
|
|
15
|
+
class: "qmc__msg qmc__gate"
|
|
16
|
+
}, x = {
|
|
17
|
+
key: 3,
|
|
18
|
+
class: "qmc__msg qmc__msg--error"
|
|
19
|
+
}, S = {
|
|
20
|
+
key: 4,
|
|
21
|
+
class: "qmc__player"
|
|
22
|
+
}, C = { class: "qmc__icon" }, w = { class: "qmc__name" }, T = { class: "qmc__meta" }, E = { class: "qmc__badge" }, D = { key: 0 }, O = ["src"], k = ["href", "download"], A = 100 * 1024 * 1024, j = /*@__PURE__*/ u({
|
|
23
|
+
__name: "QmcAudioViewer",
|
|
24
|
+
props: {
|
|
25
|
+
url: {},
|
|
26
|
+
name: {},
|
|
27
|
+
size: {}
|
|
28
|
+
},
|
|
29
|
+
setup(u) {
|
|
30
|
+
let j = u, M = p("loading"), N = p(""), P = p(""), F = p(""), I = p(0), L = a(() => {
|
|
31
|
+
let t = j.name || "audio", n = e(t);
|
|
32
|
+
return n ? t.slice(0, t.length - n.length - 1) : t;
|
|
33
|
+
}), R = a(() => `${L.value}.${F.value || "audio"}`);
|
|
34
|
+
function z() {
|
|
35
|
+
P.value &&= (URL.revokeObjectURL(P.value), "");
|
|
36
|
+
}
|
|
37
|
+
async function B() {
|
|
38
|
+
if (j.url) {
|
|
39
|
+
M.value = "loading", N.value = "", z();
|
|
40
|
+
try {
|
|
41
|
+
let e = await fetch(j.url);
|
|
42
|
+
if (!e.ok) throw Error(`HTTP ${e.status}`);
|
|
43
|
+
let t = await e.arrayBuffer();
|
|
44
|
+
M.value = "decrypting", await new Promise((e) => setTimeout(e, 0));
|
|
45
|
+
let n = i(t);
|
|
46
|
+
F.value = n.format, I.value = n.data.length, P.value = URL.createObjectURL(new Blob([n.data], { type: n.mime })), M.value = "ready";
|
|
47
|
+
} catch (e) {
|
|
48
|
+
N.value = e instanceof r || e instanceof Error ? e.message : String(e), M.value = "error";
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function V() {
|
|
53
|
+
if (j.size && j.size > A) {
|
|
54
|
+
M.value = "gate";
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
B();
|
|
58
|
+
}
|
|
59
|
+
return g(() => j.url, V, { immediate: !0 }), d(z), (e, r) => (f(), s("div", _, [M.value === "loading" ? (f(), s("p", v, "正在加载…")) : M.value === "decrypting" ? (f(), s("p", y, "正在解密…")) : M.value === "gate" ? (f(), s("div", b, [c("p", null, "该文件较大(" + m(h(t)(j.size)) + "),将在浏览器内加载并解密。是否继续?", 1), c("button", {
|
|
60
|
+
type: "button",
|
|
61
|
+
class: "qmc__btn",
|
|
62
|
+
onClick: B
|
|
63
|
+
}, "加载并解密")])) : M.value === "error" ? (f(), s("div", x, [c("p", null, "无法解密:" + m(N.value), 1), c("button", {
|
|
64
|
+
type: "button",
|
|
65
|
+
class: "qmc__btn",
|
|
66
|
+
onClick: B
|
|
67
|
+
}, "重试")])) : (f(), s("div", S, [
|
|
68
|
+
c("div", C, [l(n, {
|
|
69
|
+
name: "music",
|
|
70
|
+
size: 40
|
|
71
|
+
})]),
|
|
72
|
+
c("div", w, m(j.name), 1),
|
|
73
|
+
c("div", T, [c("span", E, m(F.value.toUpperCase()) + " · 已解密", 1), I.value ? (f(), s("span", D, m(h(t)(I.value)), 1)) : o("", !0)]),
|
|
74
|
+
c("audio", {
|
|
75
|
+
class: "qmc__audio",
|
|
76
|
+
src: P.value,
|
|
77
|
+
controls: "",
|
|
78
|
+
preload: "metadata"
|
|
79
|
+
}, null, 8, O),
|
|
80
|
+
c("a", {
|
|
81
|
+
class: "qmc__dl",
|
|
82
|
+
href: P.value,
|
|
83
|
+
download: R.value
|
|
84
|
+
}, [l(n, {
|
|
85
|
+
name: "download",
|
|
86
|
+
size: 14
|
|
87
|
+
}), r[0] ||= c("span", null, "下载解密后的音频", -1)], 8, k)
|
|
88
|
+
]))]));
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
//#endregion
|
|
92
|
+
export { j as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e from "../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "./RasterViewer.vue_vue_type_script_setup_true_lang.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
//#region src/components/RasterViewer.vue
|
|
5
|
+
var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-76bced18"]]);
|
|
6
|
+
//#endregion
|
|
7
|
+
export { n as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Side-viewer for raster image formats the browser can't decode in a plain <img>. Fetches the bytes and
|
|
3
|
+
* decodes them to a viewable raster in-browser, then shows the result (fit-to-pane, with an actual-size
|
|
4
|
+
* toggle). Each decoder is DYNAMICALLY imported in its branch, so opening a TIFF never pulls the PSD/HEIC
|
|
5
|
+
* code (and vice-versa).
|
|
6
|
+
*
|
|
7
|
+
* - tiff: UTIF (utif2) → RGBA → canvas; multi-page TIFFs get a page switcher.
|
|
8
|
+
* - psd: ag-psd readPsd() → the composited canvas.
|
|
9
|
+
* - heic/heif: heic2any (libheif) → a PNG blob.
|
|
10
|
+
* - raw (cr2/nef/arw/dng/…): BEST EFFORT — no in-browser demosaic, so we extract the embedded JPEG preview
|
|
11
|
+
* (see lib/rawPreview.ts). Usually the camera's full-size preview; a file without one can't be shown here.
|
|
12
|
+
*/
|
|
13
|
+
type __VLS_Props = {
|
|
14
|
+
url?: string;
|
|
15
|
+
name: string;
|
|
16
|
+
size?: number;
|
|
17
|
+
kind: 'tiff' | 'psd' | 'heic' | 'raw';
|
|
18
|
+
};
|
|
19
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
declare const _default: typeof __VLS_export;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import e from "./MissingDependency.js";
|
|
2
|
+
import { formatBytes as t } from "../lib/format.js";
|
|
3
|
+
import { isMissingModule as n } from "../lib/optionalDep.js";
|
|
4
|
+
import { Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, defineComponent as l, normalizeClass as u, onBeforeUnmount as d, openBlock as f, ref as p, toDisplayString as m, unref as h, watch as g } from "vue";
|
|
5
|
+
//#region src/components/RasterViewer.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var _ = { class: "ras" }, v = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "ras__msg"
|
|
9
|
+
}, y = {
|
|
10
|
+
key: 1,
|
|
11
|
+
class: "ras__msg ras__gate"
|
|
12
|
+
}, b = {
|
|
13
|
+
key: 3,
|
|
14
|
+
class: "ras__msg ras__msg--error"
|
|
15
|
+
}, x = { class: "ras__bar" }, S = { class: "ras__badge" }, C = {
|
|
16
|
+
key: 0,
|
|
17
|
+
class: "ras__hint"
|
|
18
|
+
}, w = ["disabled"], T = { class: "ras__page" }, E = ["disabled"], D = ["src", "alt"], O = 80 * 1024 * 1024, k = /*@__PURE__*/ l({
|
|
19
|
+
__name: "RasterViewer",
|
|
20
|
+
props: {
|
|
21
|
+
url: {},
|
|
22
|
+
name: {},
|
|
23
|
+
size: {},
|
|
24
|
+
kind: {}
|
|
25
|
+
},
|
|
26
|
+
setup(l) {
|
|
27
|
+
let k = l, A = p("loading"), j = p(""), M = p(null), N = p([]), P = p(0), F = p(!0), I = [], L = {
|
|
28
|
+
tiff: "TIFF",
|
|
29
|
+
psd: "PSD",
|
|
30
|
+
heic: "HEIC",
|
|
31
|
+
raw: "RAW"
|
|
32
|
+
}, R = {
|
|
33
|
+
tiff: ["utif2"],
|
|
34
|
+
psd: ["ag-psd"],
|
|
35
|
+
heic: ["heic2any"]
|
|
36
|
+
};
|
|
37
|
+
function z() {
|
|
38
|
+
for (let e of I) URL.revokeObjectURL(e);
|
|
39
|
+
I = [], N.value = [], P.value = 0;
|
|
40
|
+
}
|
|
41
|
+
function B(e) {
|
|
42
|
+
return new Promise((t, n) => {
|
|
43
|
+
e.toBlob((e) => {
|
|
44
|
+
if (!e) return n(/* @__PURE__ */ Error("canvas 编码失败"));
|
|
45
|
+
let r = URL.createObjectURL(e);
|
|
46
|
+
I.push(r), t(r);
|
|
47
|
+
}, "image/png");
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
async function V(e) {
|
|
51
|
+
let t = await import("utif2"), n = t.decode(e), r = [];
|
|
52
|
+
for (let i of n) {
|
|
53
|
+
try {
|
|
54
|
+
t.decodeImage(e, i);
|
|
55
|
+
} catch {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (!i.width || !i.height) continue;
|
|
59
|
+
let n = t.toRGBA8(i), a = document.createElement("canvas");
|
|
60
|
+
a.width = i.width, a.height = i.height;
|
|
61
|
+
let o = a.getContext("2d");
|
|
62
|
+
o && (o.putImageData(new ImageData(new Uint8ClampedArray(n), i.width, i.height), 0, 0), r.push(await B(a)));
|
|
63
|
+
}
|
|
64
|
+
if (!r.length) throw Error("未能解码该 TIFF");
|
|
65
|
+
return r;
|
|
66
|
+
}
|
|
67
|
+
async function H(e) {
|
|
68
|
+
let { readPsd: t } = await import("ag-psd"), n = t(e, {
|
|
69
|
+
skipLayerImageData: !0,
|
|
70
|
+
skipThumbnail: !0
|
|
71
|
+
});
|
|
72
|
+
if (!n.canvas) throw Error("该 PSD 没有可显示的合成图像");
|
|
73
|
+
return [await B(n.canvas)];
|
|
74
|
+
}
|
|
75
|
+
async function U(e) {
|
|
76
|
+
let t = (await import("heic2any")).default, n = await t({
|
|
77
|
+
blob: new Blob([e]),
|
|
78
|
+
toType: "image/png"
|
|
79
|
+
}), r = Array.isArray(n) ? n[0] : n, i = URL.createObjectURL(r);
|
|
80
|
+
return I.push(i), [i];
|
|
81
|
+
}
|
|
82
|
+
async function W(e) {
|
|
83
|
+
let { extractLargestJpeg: t } = await import("../lib/rawPreview.js"), n = t(e);
|
|
84
|
+
if (!n) throw Error("未能从该 RAW 文件提取内嵌预览(可下载后用专业工具打开)");
|
|
85
|
+
let r = URL.createObjectURL(new Blob([n], { type: "image/jpeg" }));
|
|
86
|
+
return I.push(r), [r];
|
|
87
|
+
}
|
|
88
|
+
async function G() {
|
|
89
|
+
if (k.url) {
|
|
90
|
+
A.value = "loading", j.value = "", M.value = null, z();
|
|
91
|
+
try {
|
|
92
|
+
let e = await fetch(k.url);
|
|
93
|
+
if (!e.ok) throw Error(`HTTP ${e.status}`);
|
|
94
|
+
let t = await e.arrayBuffer(), n;
|
|
95
|
+
n = k.kind === "tiff" ? await V(t) : k.kind === "psd" ? await H(t) : k.kind === "heic" ? await U(t) : await W(t), N.value = n, P.value = 0, A.value = "ready";
|
|
96
|
+
} catch (e) {
|
|
97
|
+
let t = R[k.kind];
|
|
98
|
+
t && n(e) ? M.value = t : j.value = e instanceof Error ? e.message : String(e), A.value = "error";
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function K() {
|
|
103
|
+
if (k.size && k.size > O) {
|
|
104
|
+
A.value = "gate";
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
G();
|
|
108
|
+
}
|
|
109
|
+
let q = i(() => N.value.length > 1);
|
|
110
|
+
return g(() => [k.url, k.kind], K, { immediate: !0 }), d(z), (n, i) => (f(), s("div", _, [A.value === "loading" ? (f(), s("p", v, "正在解码 " + m(L[k.kind]) + "…", 1)) : A.value === "gate" ? (f(), s("div", y, [c("p", null, "该图像较大(" + m(h(t)(k.size)) + "),将在浏览器内解码。是否继续?", 1), c("button", {
|
|
111
|
+
type: "button",
|
|
112
|
+
class: "ras__btn",
|
|
113
|
+
onClick: G
|
|
114
|
+
}, "解码并预览")])) : M.value ? (f(), a(e, {
|
|
115
|
+
key: 2,
|
|
116
|
+
pkg: M.value,
|
|
117
|
+
label: L[k.kind],
|
|
118
|
+
"download-url": k.url,
|
|
119
|
+
"download-name": k.name
|
|
120
|
+
}, null, 8, [
|
|
121
|
+
"pkg",
|
|
122
|
+
"label",
|
|
123
|
+
"download-url",
|
|
124
|
+
"download-name"
|
|
125
|
+
])) : A.value === "error" ? (f(), s("div", b, [c("p", null, "解码失败:" + m(j.value), 1), c("button", {
|
|
126
|
+
type: "button",
|
|
127
|
+
class: "ras__btn",
|
|
128
|
+
onClick: G
|
|
129
|
+
}, "重试")])) : (f(), s(r, { key: 4 }, [c("div", x, [
|
|
130
|
+
c("span", S, m(L[k.kind]), 1),
|
|
131
|
+
k.kind === "raw" ? (f(), s("span", C, "内嵌预览(非完整 RAW 解码)")) : o("", !0),
|
|
132
|
+
q.value ? (f(), s(r, { key: 1 }, [
|
|
133
|
+
c("button", {
|
|
134
|
+
type: "button",
|
|
135
|
+
class: "ras__nav",
|
|
136
|
+
disabled: P.value === 0,
|
|
137
|
+
onClick: i[0] ||= (e) => P.value--
|
|
138
|
+
}, " ‹ ", 8, w),
|
|
139
|
+
c("span", T, m(P.value + 1) + "/" + m(N.value.length), 1),
|
|
140
|
+
c("button", {
|
|
141
|
+
type: "button",
|
|
142
|
+
class: "ras__nav",
|
|
143
|
+
disabled: P.value === N.value.length - 1,
|
|
144
|
+
onClick: i[1] ||= (e) => P.value++
|
|
145
|
+
}, " › ", 8, E)
|
|
146
|
+
], 64)) : o("", !0),
|
|
147
|
+
i[3] ||= c("span", { class: "ras__spacer" }, null, -1),
|
|
148
|
+
c("button", {
|
|
149
|
+
type: "button",
|
|
150
|
+
class: u(["ras__nav ras__nav--text", { "ras__nav--on": !F.value }]),
|
|
151
|
+
onClick: i[2] ||= (e) => F.value = !F.value
|
|
152
|
+
}, m(F.value ? "原始大小" : "适应"), 3)
|
|
153
|
+
]), c("div", { class: u(["ras__stage", { "ras__stage--fit": F.value }]) }, [c("img", {
|
|
154
|
+
class: u(["ras__img", { "ras__img--fit": F.value }]),
|
|
155
|
+
src: N.value[P.value],
|
|
156
|
+
alt: k.name
|
|
157
|
+
}, null, 10, D)], 2)], 64))]));
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
//#endregion
|
|
161
|
+
export { k as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e from "../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "./RtfViewer.vue_vue_type_script_setup_true_lang.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
//#region src/components/RtfViewer.vue
|
|
5
|
+
var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-be38fd1e"]]);
|
|
6
|
+
//#endregion
|
|
7
|
+
export { n as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Side-viewer Rich Text (`.rtf`) renderer. Fetches the document BYTES (needed for `\'hh` charset decoding) and
|
|
3
|
+
* interprets the RTF entirely in-browser via the hand-rolled {@link parseRtf} → {@link rtfToHtml} (zero deps,
|
|
4
|
+
* like the eml / mht / har viewers). The produced HTML is OUR markup — every text byte escaped, only numeric
|
|
5
|
+
* sizes / `#rrggbb` colors / sanitized font names emitted — so it's safe to inline with `v-html` (same posture
|
|
6
|
+
* as DrawioViewer/WidgetBlock). It renders onto a white "paper" sheet (like DocxViewer) so the document's own
|
|
7
|
+
* colors read correctly in both light and dark themes.
|
|
8
|
+
*
|
|
9
|
+
* Entry shape mirrors the other self-fetching viewers: a real download URL for a held attachment, or a blob URL
|
|
10
|
+
* minted by an archive browser from already-extracted bytes. Large files are gated behind a confirm (all parsing
|
|
11
|
+
* is in-memory) like EmlViewer.
|
|
12
|
+
*/
|
|
13
|
+
type __VLS_Props = {
|
|
14
|
+
/** Download / blob URL of the .rtf bytes. */
|
|
15
|
+
url?: string;
|
|
16
|
+
name: string;
|
|
17
|
+
size?: number;
|
|
18
|
+
};
|
|
19
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
declare const _default: typeof __VLS_export;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { parseRtf as e, rtfToHtml as t } from "../lib/rtf.js";
|
|
2
|
+
import { computed as n, createElementBlock as r, createElementVNode as i, defineComponent as a, onBeforeUnmount as o, openBlock as s, ref as c, toDisplayString as l, watch as u } from "vue";
|
|
3
|
+
//#region src/components/RtfViewer.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var d = { class: "rtf" }, f = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "rtf__msg"
|
|
7
|
+
}, p = {
|
|
8
|
+
key: 1,
|
|
9
|
+
class: "rtf__msg rtf__gate"
|
|
10
|
+
}, m = {
|
|
11
|
+
key: 2,
|
|
12
|
+
class: "rtf__msg rtf__msg--error"
|
|
13
|
+
}, h = {
|
|
14
|
+
key: 3,
|
|
15
|
+
class: "rtf__scroll"
|
|
16
|
+
}, g = ["innerHTML"], _ = {
|
|
17
|
+
key: 1,
|
|
18
|
+
class: "rtf__msg"
|
|
19
|
+
}, v = 16 * 1024 * 1024, y = /*@__PURE__*/ a({
|
|
20
|
+
__name: "RtfViewer",
|
|
21
|
+
props: {
|
|
22
|
+
url: {},
|
|
23
|
+
name: {},
|
|
24
|
+
size: {}
|
|
25
|
+
},
|
|
26
|
+
setup(a) {
|
|
27
|
+
let y = a, b = c("loading"), x = c(""), S = c(""), C = n(() => b.value === "ready" && S.value.replace(/<[^>]+>/g, "").trim() === "");
|
|
28
|
+
async function w() {
|
|
29
|
+
if (y.url) {
|
|
30
|
+
b.value = "loading", x.value = "", S.value = "";
|
|
31
|
+
try {
|
|
32
|
+
let n = await fetch(y.url);
|
|
33
|
+
if (!n.ok) throw Error(`HTTP ${n.status}`);
|
|
34
|
+
let r = await n.arrayBuffer();
|
|
35
|
+
S.value = t(e(new Uint8Array(r))), b.value = "ready";
|
|
36
|
+
} catch (e) {
|
|
37
|
+
x.value = e instanceof Error ? e.message : String(e), b.value = "error";
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function T() {
|
|
42
|
+
if (y.size && y.size > v) {
|
|
43
|
+
b.value = "gate";
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
w();
|
|
47
|
+
}
|
|
48
|
+
return u(() => y.url, T, { immediate: !0 }), o(() => {
|
|
49
|
+
S.value = "";
|
|
50
|
+
}), (e, t) => (s(), r("div", d, [b.value === "loading" ? (s(), r("p", f, "正在渲染 RTF 文档…")) : b.value === "gate" ? (s(), r("div", p, [i("p", null, "文件较大(" + l(((y.size ?? 0) / 1024 / 1024).toFixed(1)) + " MB),是否继续解析预览?", 1), i("button", {
|
|
51
|
+
type: "button",
|
|
52
|
+
class: "rtf__btn",
|
|
53
|
+
onClick: w
|
|
54
|
+
}, "继续预览")])) : b.value === "error" ? (s(), r("div", m, [i("p", null, "渲染失败:" + l(x.value), 1), i("button", {
|
|
55
|
+
type: "button",
|
|
56
|
+
class: "rtf__btn",
|
|
57
|
+
onClick: w
|
|
58
|
+
}, "重试")])) : (s(), r("div", h, [C.value ? (s(), r("p", _, "(此文档没有可显示的文本内容)")) : (s(), r("article", {
|
|
59
|
+
key: 0,
|
|
60
|
+
class: "rtf__paper",
|
|
61
|
+
innerHTML: S.value
|
|
62
|
+
}, null, 8, g))]))]));
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
//#endregion
|
|
66
|
+
export { y as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e from "../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "./SevenZipBrowser.vue_vue_type_script_setup_true_lang.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
//#region src/components/SevenZipBrowser.vue
|
|
5
|
+
var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-c8a21efa"]]);
|
|
6
|
+
//#endregion
|
|
7
|
+
export { n as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The side viewer's 7z mode — the LZMA counterpart to {@link ZipBrowser}. Fetches an archive's bytes, parses +
|
|
3
|
+
* decompresses them entirely in-browser (see lib/sevenZip.ts, which carries its own LZMA decoder since browsers
|
|
4
|
+
* ship none), and browses the contents. Selecting an entry extracts just that one, wraps it in a blob URL, and
|
|
5
|
+
* hands it to {@link FileViewerBody} (so a file inside the 7z previews with every viewer a top-level file gets).
|
|
6
|
+
*/
|
|
7
|
+
type __VLS_Props = {
|
|
8
|
+
url: string;
|
|
9
|
+
name: string;
|
|
10
|
+
};
|
|
11
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|