@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,362 @@
|
|
|
1
|
+
import { formatBytes as e } from "../lib/format.js";
|
|
2
|
+
import { DicomError as t, readDicom as n } from "../lib/dicom.js";
|
|
3
|
+
import { UnsupportedTransferSyntaxError as r, decodeDicomFrame as i, transferSyntaxName as a } from "../lib/dicomCodecs.js";
|
|
4
|
+
import { autoWindow as o, buildFramePixels as s, renderToImageData as c } from "../lib/dicomRender.js";
|
|
5
|
+
import { Fragment as l, computed as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, defineComponent as m, nextTick as ee, normalizeClass as h, onBeforeUnmount as te, onMounted as ne, openBlock as g, ref as _, renderList as v, toDisplayString as y, unref as re, vModelSelect as ie, vModelText as ae, watch as b, withDirectives as oe, withModifiers as se } from "vue";
|
|
6
|
+
//#region src/components/DicomViewer.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
+
var ce = { class: "dv" }, le = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "dv__msg"
|
|
10
|
+
}, ue = {
|
|
11
|
+
key: 1,
|
|
12
|
+
class: "dv__msg dv__msg--error"
|
|
13
|
+
}, de = ["href", "download"], fe = { class: "dv__bar" }, pe = { class: "dv__group" }, me = { class: "dv__zoom" }, he = { class: "dv__group" }, ge = ["disabled"], _e = ["disabled"], ve = {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: "dv__decoding"
|
|
16
|
+
}, ye = { class: "dv__meta-head" }, be = { class: "dv__meta-title" }, xe = { class: "dv__meta-label" }, Se = { class: "dv__meta-val" }, Ce = {
|
|
17
|
+
key: 0,
|
|
18
|
+
class: "dv__meta-empty"
|
|
19
|
+
}, we = {
|
|
20
|
+
key: 0,
|
|
21
|
+
class: "dv__frames"
|
|
22
|
+
}, Te = ["title"], Ee = ["disabled"], De = ["max"], Oe = ["disabled"], ke = { class: "dv__frameno" }, Ae = {
|
|
23
|
+
key: 1,
|
|
24
|
+
class: "dv__info"
|
|
25
|
+
}, je = {
|
|
26
|
+
key: 0,
|
|
27
|
+
class: "dv__tag"
|
|
28
|
+
}, Me = {
|
|
29
|
+
key: 1,
|
|
30
|
+
class: "dv__series"
|
|
31
|
+
}, Ne = {
|
|
32
|
+
key: 2,
|
|
33
|
+
class: "dv__wl"
|
|
34
|
+
}, Pe = { class: "dv__ts" }, Fe = { key: 3 }, Ie = ["title"], x = /*@__PURE__*/ m({
|
|
35
|
+
__name: "DicomViewer",
|
|
36
|
+
props: {
|
|
37
|
+
url: {},
|
|
38
|
+
name: {},
|
|
39
|
+
size: {},
|
|
40
|
+
slices: {},
|
|
41
|
+
start: {}
|
|
42
|
+
},
|
|
43
|
+
setup(m) {
|
|
44
|
+
let x = m, S = u(() => (x.slices?.length ?? 0) > 1), C = _("loading"), w = _(""), T = _(null), E = _(null), D = _(0), O = _(!1), k = /* @__PURE__ */ new Map(), A = _(!1), j = _(5), M = 0, N = 0, P = _(0), F = _(1), I = _(!1), L = _(1), R = 0, Le = 1, z = _(null), B = _(null), V = 1, H = u(() => T.value?.meta ?? null), U = _(!1), W = u(() => T.value?.tags ?? []), G = u(() => E.value?.mode === "gray"), K = u(() => S.value ? x.slices.length : H.value?.numberOfFrames ?? 1), Re = u(() => H.value ? a(H.value.transferSyntaxUid) : "");
|
|
45
|
+
async function q() {
|
|
46
|
+
C.value = "loading", w.value = "", T.value = null, E.value = null, L.value = 1, I.value = !1, U.value = !1, Q(), k.clear(), N++;
|
|
47
|
+
let e = S.value && x.start != null ? Math.min(Math.max(0, x.start), x.slices.length - 1) : 0;
|
|
48
|
+
D.value = e;
|
|
49
|
+
try {
|
|
50
|
+
if (!S.value) {
|
|
51
|
+
let e = await fetch(x.url ?? "");
|
|
52
|
+
if (!e.ok) throw Error(`HTTP ${e.status}`);
|
|
53
|
+
T.value = n(await e.arrayBuffer());
|
|
54
|
+
}
|
|
55
|
+
await Ve(e, !0) && He();
|
|
56
|
+
} catch (e) {
|
|
57
|
+
ze(e);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function ze(e) {
|
|
61
|
+
w.value = e instanceof t || e instanceof r || e instanceof Error ? e.message : String(e), C.value = "error";
|
|
62
|
+
}
|
|
63
|
+
async function Be(e) {
|
|
64
|
+
if (S.value) {
|
|
65
|
+
let t = n(await x.slices[e].load());
|
|
66
|
+
return T.value ??= t, s(await i(t.meta, t.frameBytes(0)), t.meta);
|
|
67
|
+
}
|
|
68
|
+
let t = T.value;
|
|
69
|
+
return s(await i(t.meta, t.frameBytes(e)), t.meta);
|
|
70
|
+
}
|
|
71
|
+
async function Ve(e, t) {
|
|
72
|
+
if (!S.value && !T.value) return !1;
|
|
73
|
+
let n = k.get(e);
|
|
74
|
+
if (!n) {
|
|
75
|
+
O.value = !0;
|
|
76
|
+
try {
|
|
77
|
+
n = await Be(e), k.set(e, n);
|
|
78
|
+
} catch (e) {
|
|
79
|
+
return ze(e), !1;
|
|
80
|
+
} finally {
|
|
81
|
+
O.value = !1;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (e !== D.value) return !1;
|
|
85
|
+
E.value = n;
|
|
86
|
+
let r = T.value?.meta;
|
|
87
|
+
if (t && n.mode === "gray" && r) {
|
|
88
|
+
let e = r.windowCenter != null && r.windowWidth != null && r.windowWidth > 0 ? {
|
|
89
|
+
center: r.windowCenter,
|
|
90
|
+
width: r.windowWidth
|
|
91
|
+
} : o(n);
|
|
92
|
+
P.value = e.center, F.value = e.width, R = e.center, Le = e.width;
|
|
93
|
+
}
|
|
94
|
+
let i = C.value !== "ready";
|
|
95
|
+
return C.value = "ready", i && (await ee(), X()), Y(), !0;
|
|
96
|
+
}
|
|
97
|
+
async function He() {
|
|
98
|
+
let e = K.value;
|
|
99
|
+
if (e <= 1 || !S.value && !T.value) return;
|
|
100
|
+
let t = ++N;
|
|
101
|
+
for (let n = 0; n < e; n++) {
|
|
102
|
+
if (t !== N) return;
|
|
103
|
+
if (!k.has(n)) try {
|
|
104
|
+
let e = await Be(n);
|
|
105
|
+
if (t !== N) return;
|
|
106
|
+
k.set(n, e);
|
|
107
|
+
} catch {}
|
|
108
|
+
await new Promise((e) => setTimeout(e, 0));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
let J = 0;
|
|
112
|
+
function Ue() {
|
|
113
|
+
J ||= requestAnimationFrame(() => {
|
|
114
|
+
J = 0, Y();
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
function Y() {
|
|
118
|
+
let e = E.value, t = z.value;
|
|
119
|
+
if (!e || !t) return;
|
|
120
|
+
t.width !== e.width && (t.width = e.width), t.height !== e.height && (t.height = e.height);
|
|
121
|
+
let n = t.getContext("2d");
|
|
122
|
+
if (!n) return;
|
|
123
|
+
let r = c(e, {
|
|
124
|
+
windowCenter: P.value,
|
|
125
|
+
windowWidth: F.value,
|
|
126
|
+
invert: I.value
|
|
127
|
+
});
|
|
128
|
+
n.putImageData(r, 0, 0), Z();
|
|
129
|
+
}
|
|
130
|
+
function X() {
|
|
131
|
+
let e = B.value, t = E.value;
|
|
132
|
+
if (!e || !t) return;
|
|
133
|
+
let n = Math.max(1, e.clientWidth - 24), r = Math.max(1, e.clientHeight - 24), i = Math.min(n / t.width, r / t.height);
|
|
134
|
+
V = Number.isFinite(i) && i > 0 ? i : 1;
|
|
135
|
+
}
|
|
136
|
+
function Z() {
|
|
137
|
+
let e = z.value, t = E.value;
|
|
138
|
+
if (!e || !t) return;
|
|
139
|
+
let n = V * L.value;
|
|
140
|
+
e.style.width = `${Math.max(1, Math.round(t.width * n))}px`, e.style.height = `${Math.max(1, Math.round(t.height * n))}px`;
|
|
141
|
+
}
|
|
142
|
+
function We(e) {
|
|
143
|
+
if (e.button !== 0 || !G.value) return;
|
|
144
|
+
e.preventDefault();
|
|
145
|
+
let t = e.currentTarget;
|
|
146
|
+
t.setPointerCapture(e.pointerId);
|
|
147
|
+
let n = e.clientX, r = e.clientY, i = F.value, a = P.value, o = E.value, s = o && o.maxValue - o.minValue || 255, c = Math.max(1, s / 512), l = (e) => {
|
|
148
|
+
F.value = Math.max(1, i + (e.clientX - n) * c), P.value = a + (e.clientY - r) * c, Ue();
|
|
149
|
+
}, u = (e) => {
|
|
150
|
+
t.releasePointerCapture(e.pointerId), t.removeEventListener("pointermove", l), t.removeEventListener("pointerup", u);
|
|
151
|
+
};
|
|
152
|
+
t.addEventListener("pointermove", l), t.addEventListener("pointerup", u);
|
|
153
|
+
}
|
|
154
|
+
function Ge(e) {
|
|
155
|
+
if (e.preventDefault(), K.value > 1 && !e.ctrlKey && !e.shiftKey) {
|
|
156
|
+
Q(), Ke(e.deltaY > 0 ? 1 : -1);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
let t = e.deltaY < 0 ? 1.12 : 1 / 1.12;
|
|
160
|
+
L.value = Math.min(20, Math.max(.1, L.value * t)), Z();
|
|
161
|
+
}
|
|
162
|
+
function Ke(e) {
|
|
163
|
+
let t = K.value;
|
|
164
|
+
t <= 1 || (D.value = Math.min(t - 1, Math.max(0, D.value + e)));
|
|
165
|
+
}
|
|
166
|
+
function qe() {
|
|
167
|
+
A.value ? Q() : Je();
|
|
168
|
+
}
|
|
169
|
+
function Je() {
|
|
170
|
+
if (K.value <= 1 || A.value) return;
|
|
171
|
+
A.value = !0;
|
|
172
|
+
let e = () => {
|
|
173
|
+
if (!A.value) return;
|
|
174
|
+
let t = K.value;
|
|
175
|
+
D.value = (D.value + 1) % t, M = window.setTimeout(e, Math.max(20, Math.round(1e3 / j.value)));
|
|
176
|
+
};
|
|
177
|
+
e();
|
|
178
|
+
}
|
|
179
|
+
function Q() {
|
|
180
|
+
A.value = !1, M &&= (clearTimeout(M), 0);
|
|
181
|
+
}
|
|
182
|
+
function Ye(e) {
|
|
183
|
+
L.value = Math.min(20, Math.max(.1, L.value * e)), Z();
|
|
184
|
+
}
|
|
185
|
+
function Xe() {
|
|
186
|
+
L.value = 1, X(), Z();
|
|
187
|
+
}
|
|
188
|
+
function Ze() {
|
|
189
|
+
L.value = 1, I.value = !1, E.value?.mode === "gray" && (P.value = R, F.value = Le), X(), Y();
|
|
190
|
+
}
|
|
191
|
+
b(D, (e) => {
|
|
192
|
+
C.value === "ready" && Ve(e, !1);
|
|
193
|
+
}), b(I, Ue);
|
|
194
|
+
let $ = null;
|
|
195
|
+
ne(() => {
|
|
196
|
+
q(), typeof ResizeObserver < "u" && B.value && ($ = new ResizeObserver(() => {
|
|
197
|
+
X(), Z();
|
|
198
|
+
}), $.observe(B.value));
|
|
199
|
+
}), b([() => x.url, () => x.slices], q), te(() => {
|
|
200
|
+
Q(), N++, J && cancelAnimationFrame(J), $?.disconnect();
|
|
201
|
+
});
|
|
202
|
+
let Qe = u(() => Math.round(P.value)), $e = u(() => Math.round(F.value)), et = u(() => `${Math.round(V * L.value * 100)}%`);
|
|
203
|
+
return (t, n) => (g(), f("div", ce, [C.value === "loading" ? (g(), f("p", le, "加载并解码 DICOM…")) : C.value === "error" ? (g(), f("div", ue, [
|
|
204
|
+
p("p", null, y(w.value), 1),
|
|
205
|
+
p("a", {
|
|
206
|
+
class: "dv__dl",
|
|
207
|
+
href: m.url,
|
|
208
|
+
download: m.name
|
|
209
|
+
}, "下载原文件", 8, de),
|
|
210
|
+
p("button", {
|
|
211
|
+
type: "button",
|
|
212
|
+
class: "dv__retry",
|
|
213
|
+
onClick: q
|
|
214
|
+
}, "重试")
|
|
215
|
+
])) : (g(), f(l, { key: 2 }, [
|
|
216
|
+
p("div", fe, [p("div", pe, [
|
|
217
|
+
p("button", {
|
|
218
|
+
type: "button",
|
|
219
|
+
class: "dv__btn",
|
|
220
|
+
title: "缩小",
|
|
221
|
+
onClick: n[0] ||= (e) => Ye(1 / 1.2)
|
|
222
|
+
}, "−"),
|
|
223
|
+
p("span", me, y(et.value), 1),
|
|
224
|
+
p("button", {
|
|
225
|
+
type: "button",
|
|
226
|
+
class: "dv__btn",
|
|
227
|
+
title: "放大",
|
|
228
|
+
onClick: n[1] ||= (e) => Ye(1.2)
|
|
229
|
+
}, "+"),
|
|
230
|
+
p("button", {
|
|
231
|
+
type: "button",
|
|
232
|
+
class: "dv__btn",
|
|
233
|
+
title: "适应窗口",
|
|
234
|
+
onClick: Xe
|
|
235
|
+
}, "适应")
|
|
236
|
+
]), p("div", he, [
|
|
237
|
+
p("button", {
|
|
238
|
+
type: "button",
|
|
239
|
+
class: h(["dv__btn", { "dv__btn--on": I.value }]),
|
|
240
|
+
disabled: !G.value,
|
|
241
|
+
title: "反相显示",
|
|
242
|
+
onClick: n[2] ||= (e) => I.value = !I.value
|
|
243
|
+
}, " 反相 ", 10, ge),
|
|
244
|
+
p("button", {
|
|
245
|
+
type: "button",
|
|
246
|
+
class: "dv__btn",
|
|
247
|
+
title: "重置窗位/缩放",
|
|
248
|
+
onClick: Ze
|
|
249
|
+
}, " 重置 "),
|
|
250
|
+
p("button", {
|
|
251
|
+
type: "button",
|
|
252
|
+
class: h(["dv__btn", { "dv__btn--on": U.value }]),
|
|
253
|
+
disabled: !W.value.length,
|
|
254
|
+
title: "DICOM 元数据",
|
|
255
|
+
onClick: n[3] ||= (e) => U.value = !U.value
|
|
256
|
+
}, " 信息 ", 10, _e)
|
|
257
|
+
])]),
|
|
258
|
+
p("div", {
|
|
259
|
+
ref_key: "stageRef",
|
|
260
|
+
ref: B,
|
|
261
|
+
class: "dv__stage",
|
|
262
|
+
onWheel: Ge
|
|
263
|
+
}, [
|
|
264
|
+
p("canvas", {
|
|
265
|
+
ref_key: "canvasRef",
|
|
266
|
+
ref: z,
|
|
267
|
+
class: h(["dv__canvas", { "dv__canvas--wl": G.value }]),
|
|
268
|
+
onPointerdown: We
|
|
269
|
+
}, null, 34),
|
|
270
|
+
O.value ? (g(), f("span", ve, "解码中…")) : d("", !0),
|
|
271
|
+
U.value ? (g(), f("div", {
|
|
272
|
+
key: 1,
|
|
273
|
+
class: "dv__meta",
|
|
274
|
+
onWheel: n[5] ||= se(() => {}, ["stop"])
|
|
275
|
+
}, [
|
|
276
|
+
p("div", ye, [n[10] ||= p("span", null, "DICOM 元数据", -1), p("button", {
|
|
277
|
+
type: "button",
|
|
278
|
+
class: "dv__meta-close",
|
|
279
|
+
title: "关闭",
|
|
280
|
+
onClick: n[4] ||= (e) => U.value = !1
|
|
281
|
+
}, " ✕ ")]),
|
|
282
|
+
(g(!0), f(l, null, v(W.value, (e) => (g(), f("div", {
|
|
283
|
+
key: e.title,
|
|
284
|
+
class: "dv__meta-group"
|
|
285
|
+
}, [p("h4", be, y(e.title), 1), (g(!0), f(l, null, v(e.rows, (e) => (g(), f("div", {
|
|
286
|
+
key: e.label,
|
|
287
|
+
class: "dv__meta-row"
|
|
288
|
+
}, [p("span", xe, y(e.label), 1), p("span", Se, y(e.value), 1)]))), 128))]))), 128)),
|
|
289
|
+
W.value.length ? d("", !0) : (g(), f("p", Ce, "无可显示的元数据"))
|
|
290
|
+
], 32)) : d("", !0)
|
|
291
|
+
], 544),
|
|
292
|
+
K.value > 1 ? (g(), f("div", we, [
|
|
293
|
+
p("button", {
|
|
294
|
+
type: "button",
|
|
295
|
+
class: h(["dv__btn", { "dv__btn--on": A.value }]),
|
|
296
|
+
title: A.value ? "暂停" : "播放(循环)",
|
|
297
|
+
onClick: qe
|
|
298
|
+
}, y(A.value ? "⏸" : "▶"), 11, Te),
|
|
299
|
+
oe(p("select", {
|
|
300
|
+
"onUpdate:modelValue": n[6] ||= (e) => j.value = e,
|
|
301
|
+
class: "dv__fps",
|
|
302
|
+
title: "播放速度(帧/秒)"
|
|
303
|
+
}, [...n[11] ||= [
|
|
304
|
+
p("option", { value: 5 }, "5 fps", -1),
|
|
305
|
+
p("option", { value: 10 }, "10 fps", -1),
|
|
306
|
+
p("option", { value: 15 }, "15 fps", -1),
|
|
307
|
+
p("option", { value: 24 }, "24 fps", -1)
|
|
308
|
+
]], 512), [[
|
|
309
|
+
ie,
|
|
310
|
+
j.value,
|
|
311
|
+
void 0,
|
|
312
|
+
{ number: !0 }
|
|
313
|
+
]]),
|
|
314
|
+
p("button", {
|
|
315
|
+
type: "button",
|
|
316
|
+
class: "dv__btn",
|
|
317
|
+
disabled: D.value <= 0,
|
|
318
|
+
onClick: n[7] ||= (e) => (Q(), D.value = Math.max(0, D.value - 1))
|
|
319
|
+
}, " ‹ ", 8, Ee),
|
|
320
|
+
oe(p("input", {
|
|
321
|
+
"onUpdate:modelValue": n[8] ||= (e) => D.value = e,
|
|
322
|
+
type: "range",
|
|
323
|
+
class: "dv__range",
|
|
324
|
+
min: "0",
|
|
325
|
+
max: K.value - 1,
|
|
326
|
+
step: "1",
|
|
327
|
+
onPointerdown: Q
|
|
328
|
+
}, null, 40, De), [[
|
|
329
|
+
ae,
|
|
330
|
+
D.value,
|
|
331
|
+
void 0,
|
|
332
|
+
{ number: !0 }
|
|
333
|
+
]]),
|
|
334
|
+
p("button", {
|
|
335
|
+
type: "button",
|
|
336
|
+
class: "dv__btn",
|
|
337
|
+
disabled: D.value >= K.value - 1,
|
|
338
|
+
onClick: n[9] ||= (e) => (Q(), D.value = Math.min(K.value - 1, D.value + 1))
|
|
339
|
+
}, " › ", 8, Oe),
|
|
340
|
+
p("span", ke, y(D.value + 1) + " / " + y(K.value), 1),
|
|
341
|
+
n[12] ||= p("span", { class: "dv__hint" }, "滚轮切换层面", -1)
|
|
342
|
+
])) : d("", !0),
|
|
343
|
+
H.value ? (g(), f("div", Ae, [
|
|
344
|
+
H.value.modality ? (g(), f("span", je, y(H.value.modality), 1)) : d("", !0),
|
|
345
|
+
S.value ? (g(), f("span", Me, "序列 · " + y(K.value) + " 层", 1)) : d("", !0),
|
|
346
|
+
p("span", null, y(H.value.columns) + "×" + y(H.value.rows), 1),
|
|
347
|
+
p("span", null, y(H.value.bitsStored) + "/" + y(H.value.bitsAllocated) + "-bit", 1),
|
|
348
|
+
p("span", null, y(H.value.photometric), 1),
|
|
349
|
+
G.value ? (g(), f("span", Ne, "窗位 C " + y(Qe.value) + " · W " + y($e.value), 1)) : d("", !0),
|
|
350
|
+
p("span", Pe, y(Re.value), 1),
|
|
351
|
+
x.size ? (g(), f("span", Fe, y(re(e)(x.size)), 1)) : d("", !0),
|
|
352
|
+
H.value.seriesDescription ? (g(), f("span", {
|
|
353
|
+
key: 4,
|
|
354
|
+
class: "dv__desc",
|
|
355
|
+
title: H.value.seriesDescription
|
|
356
|
+
}, y(H.value.seriesDescription), 9, Ie)) : d("", !0)
|
|
357
|
+
])) : d("", !0)
|
|
358
|
+
], 64))]));
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
//#endregion
|
|
362
|
+
export { x as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e from "../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "./DocxViewer.vue_vue_type_script_setup_true_lang.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
//#region src/components/DocxViewer.vue
|
|
5
|
+
var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-9bff4ace"]]);
|
|
6
|
+
//#endregion
|
|
7
|
+
export { n as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Side-viewer Word (`.docx`) renderer. Fetches the document bytes from the download URL and renders the
|
|
3
|
+
* OOXML to HTML entirely in-browser via docx-preview (https://github.com/VolodymyrBaydalka/docxjs) — a
|
|
4
|
+
* paginated, paper-like preview (white pages on a neutral canvas, like Word). No CDN / network beyond the
|
|
5
|
+
* file fetch: docx-preview bundles its own jszip + renderer, and images are inlined as base64.
|
|
6
|
+
*
|
|
7
|
+
* Two entry shapes mirror the other browsers (DICOM/zip): a real download URL for a held attachment, or a
|
|
8
|
+
* blob URL minted by the archive browsers from already-extracted bytes. docx-preview injects its own CSS
|
|
9
|
+
* into the render container, prefixed with the `className` ('docx') so it can't leak onto the page.
|
|
10
|
+
*/
|
|
11
|
+
type __VLS_Props = {
|
|
12
|
+
/** Download/blob URL of the .docx bytes. */
|
|
13
|
+
url?: string;
|
|
14
|
+
name: string;
|
|
15
|
+
size?: number;
|
|
16
|
+
};
|
|
17
|
+
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>;
|
|
18
|
+
declare const _default: typeof __VLS_export;
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { createCommentVNode as e, createElementBlock as t, createElementVNode as n, defineComponent as r, onBeforeUnmount as i, onMounted as a, openBlock as o, ref as s, toDisplayString as c, vShow as l, watch as u, withDirectives as d } from "vue";
|
|
2
|
+
import { renderAsync as f } from "docx-preview";
|
|
3
|
+
//#region src/components/DocxViewer.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var p = { class: "dx" }, m = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "dx__msg"
|
|
7
|
+
}, h = {
|
|
8
|
+
key: 1,
|
|
9
|
+
class: "dx__msg dx__msg--error"
|
|
10
|
+
}, g = /*@__PURE__*/ r({
|
|
11
|
+
__name: "DocxViewer",
|
|
12
|
+
props: {
|
|
13
|
+
url: {},
|
|
14
|
+
name: {},
|
|
15
|
+
size: {}
|
|
16
|
+
},
|
|
17
|
+
setup(r) {
|
|
18
|
+
let g = r, _ = s("loading"), v = s(""), y = s(null);
|
|
19
|
+
async function b() {
|
|
20
|
+
let e = y.value;
|
|
21
|
+
if (!(!g.url || !e)) {
|
|
22
|
+
_.value = "loading", v.value = "", e.innerHTML = "";
|
|
23
|
+
try {
|
|
24
|
+
let t = await fetch(g.url);
|
|
25
|
+
if (!t.ok) throw Error(`HTTP ${t.status}`);
|
|
26
|
+
let n = await t.arrayBuffer();
|
|
27
|
+
if (y.value !== e || (await f(n, e, void 0, {
|
|
28
|
+
className: "docx",
|
|
29
|
+
inWrapper: !0,
|
|
30
|
+
ignoreWidth: !0,
|
|
31
|
+
ignoreHeight: !0,
|
|
32
|
+
breakPages: !0,
|
|
33
|
+
renderHeaders: !0,
|
|
34
|
+
renderFooters: !0,
|
|
35
|
+
renderFootnotes: !0,
|
|
36
|
+
renderEndnotes: !0,
|
|
37
|
+
useBase64URL: !0
|
|
38
|
+
}), y.value !== e)) return;
|
|
39
|
+
_.value = "ready";
|
|
40
|
+
} catch (e) {
|
|
41
|
+
v.value = e instanceof Error ? e.message : String(e), _.value = "error";
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return a(b), u(() => g.url, b), i(() => {
|
|
46
|
+
y.value && (y.value.innerHTML = "");
|
|
47
|
+
}), (r, i) => (o(), t("div", p, [_.value === "loading" ? (o(), t("p", m, "正在渲染 Word 文档…")) : _.value === "error" ? (o(), t("div", h, [n("p", null, "渲染失败:" + c(v.value), 1), n("button", {
|
|
48
|
+
type: "button",
|
|
49
|
+
class: "dx__retry",
|
|
50
|
+
onClick: b
|
|
51
|
+
}, "重试")])) : e("", !0), d(n("div", {
|
|
52
|
+
ref_key: "docEl",
|
|
53
|
+
ref: y,
|
|
54
|
+
class: "dx__doc"
|
|
55
|
+
}, null, 512), [[l, _.value === "ready"]])]));
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
//#endregion
|
|
59
|
+
export { g as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e from "../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "./DrawioViewer.vue_vue_type_script_setup_true_lang.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
//#region src/components/DrawioViewer.vue
|
|
5
|
+
var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-70c38c16"]]);
|
|
6
|
+
//#endregion
|
|
7
|
+
export { n as default };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type DiagramKind } from '@/lib/diagram';
|
|
2
|
+
/**
|
|
3
|
+
* Renders a .drawio (mxGraph) or .excalidraw scene as an inline SVG (see lib/diagram.ts — hand-rolled,
|
|
4
|
+
* zero-dependency, best-effort). Consumes the text the side viewer already fetched (no second download),
|
|
5
|
+
* like the subtitle/geo/csv renderers. Rendering is async (drawio diagrams are usually DEFLATE-compressed).
|
|
6
|
+
* The produced SVG is OUR markup built from the parsed geometry, so v-html is safe; on a parse failure the
|
|
7
|
+
* user can fall back to the source toggle (raw XML/JSON) or download the file.
|
|
8
|
+
*/
|
|
9
|
+
type __VLS_Props = {
|
|
10
|
+
text: string;
|
|
11
|
+
name: string;
|
|
12
|
+
kind: DiagramKind;
|
|
13
|
+
};
|
|
14
|
+
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>;
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { renderDiagram as e } from "../lib/diagram.js";
|
|
2
|
+
import { createElementBlock as t, createElementVNode as n, defineComponent as r, openBlock as i, ref as a, toDisplayString as o, watch as s } from "vue";
|
|
3
|
+
//#region src/components/DrawioViewer.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var c = { class: "dgm" }, l = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "dgm__msg"
|
|
7
|
+
}, u = {
|
|
8
|
+
key: 1,
|
|
9
|
+
class: "dgm__msg dgm__msg--error"
|
|
10
|
+
}, d = { class: "dgm__hint" }, f = ["innerHTML"], p = /*@__PURE__*/ r({
|
|
11
|
+
__name: "DrawioViewer",
|
|
12
|
+
props: {
|
|
13
|
+
text: {},
|
|
14
|
+
name: {},
|
|
15
|
+
kind: {}
|
|
16
|
+
},
|
|
17
|
+
setup(r) {
|
|
18
|
+
let p = r, m = a("loading"), h = a(""), g = a("");
|
|
19
|
+
async function _() {
|
|
20
|
+
m.value = "loading", g.value = "", h.value = "";
|
|
21
|
+
let t = p.text;
|
|
22
|
+
try {
|
|
23
|
+
let n = await e(t, p.kind);
|
|
24
|
+
if (p.text !== t) return;
|
|
25
|
+
h.value = n, m.value = "ready";
|
|
26
|
+
} catch (e) {
|
|
27
|
+
g.value = e instanceof Error ? e.message : String(e), m.value = "error";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return s(() => [p.text, p.kind], _, { immediate: !0 }), (e, a) => (i(), t("div", c, [m.value === "loading" ? (i(), t("p", l, "正在渲染图表…")) : m.value === "error" ? (i(), t("div", u, [n("p", null, "无法渲染该图表:" + o(g.value), 1), n("p", d, " 可切换到「源码」查看原始 " + o(r.kind === "excalidraw" ? "JSON" : "XML") + ",或下载后用对应工具打开。 ", 1)])) : (i(), t("div", {
|
|
31
|
+
key: 2,
|
|
32
|
+
class: "dgm__scroll",
|
|
33
|
+
innerHTML: h.value
|
|
34
|
+
}, null, 8, f))]));
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
//#endregion
|
|
38
|
+
export { p as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e from "../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "./DxfViewer.vue_vue_type_script_setup_true_lang.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
//#region src/components/DxfViewer.vue
|
|
5
|
+
var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-b18ead98"]]);
|
|
6
|
+
//#endregion
|
|
7
|
+
export { n as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Side-viewer for AutoCAD DXF drawings (.dxf). Fetches the text, parses it in-browser (see lib/dxf.ts —
|
|
3
|
+
* hand-rolled, zero-dependency) into drawable primitives, and draws them as an SVG. DXF Y is up, so the whole
|
|
4
|
+
* drawing is rendered inside a y-flip group (text is flipped back locally to stay upright). Drag to pan, wheel
|
|
5
|
+
* to zoom; toggle layers in the list. Binary DXF isn't supported.
|
|
6
|
+
*/
|
|
7
|
+
type __VLS_Props = {
|
|
8
|
+
url?: string;
|
|
9
|
+
name: string;
|
|
10
|
+
size?: number;
|
|
11
|
+
};
|
|
12
|
+
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>;
|
|
13
|
+
declare const _default: typeof __VLS_export;
|
|
14
|
+
export default _default;
|