@flyfish-group/file-viewer-web 1.0.9

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.
Files changed (201) hide show
  1. package/LICENSE +160 -0
  2. package/README.md +41 -0
  3. package/dist/index.d.ts +60 -0
  4. package/dist/index.js +165 -0
  5. package/dist/node.d.ts +23 -0
  6. package/dist/node.js +43 -0
  7. package/package.json +67 -0
  8. package/scripts/copy-assets.mjs +59 -0
  9. package/viewer/assets/AudioViewer-0CSMvCtp.css +1 -0
  10. package/viewer/assets/AudioViewer-HHLkFx24.js +1 -0
  11. package/viewer/assets/CadViewer-BYC0zQ0T.js +1 -0
  12. package/viewer/assets/CadViewer-Cv8b95Gj.css +1 -0
  13. package/viewer/assets/CodeViewer-HGV-dwr6.css +1 -0
  14. package/viewer/assets/CodeViewer-VQE6BewI.js +4 -0
  15. package/viewer/assets/DrawingViewer-BtEGTvJQ.js +2 -0
  16. package/viewer/assets/DrawingViewer-CHm6iXmV.css +1 -0
  17. package/viewer/assets/EpubViewer-5hOhOgl5.js +2 -0
  18. package/viewer/assets/EpubViewer-Cci0l1Vm.css +1 -0
  19. package/viewer/assets/ImageViewer-D2_fTk_7.css +10 -0
  20. package/viewer/assets/ImageViewer-D8t2LOeu.js +1 -0
  21. package/viewer/assets/MarkdownViewer-47tSKoCN.css +1 -0
  22. package/viewer/assets/MarkdownViewer-CauCMix8.js +64 -0
  23. package/viewer/assets/OfdViewer-DZCDN3UD.css +1 -0
  24. package/viewer/assets/OfdViewer-d-bt92VG.js +2 -0
  25. package/viewer/assets/PdfView-BmvyynSl.js +558 -0
  26. package/viewer/assets/PdfView-CS_IFVnD.css +1 -0
  27. package/viewer/assets/PptxRender-BQ5mqB0E.css +1 -0
  28. package/viewer/assets/PptxRender-DPUrsWGR.js +32 -0
  29. package/viewer/assets/UmdViewer-DgDIrlID.js +3 -0
  30. package/viewer/assets/UmdViewer-DpObj56a.css +1 -0
  31. package/viewer/assets/XlsxTable-BxlH06s2.css +1 -0
  32. package/viewer/assets/XlsxTable-Dca8o5_N.js +5 -0
  33. package/viewer/assets/ar-SA-G6X2FPQ2-DWAZRxPu.js +10 -0
  34. package/viewer/assets/arc-Dimj_7G-.js +1 -0
  35. package/viewer/assets/architecture-7EHR7CIX-PuoqTBea.js +1 -0
  36. package/viewer/assets/architectureDiagram-3BPJPVTR-ourcMGqp.js +36 -0
  37. package/viewer/assets/az-AZ-76LH7QW2-CD-SA1wC.js +1 -0
  38. package/viewer/assets/bg-BG-XCXSNQG7-lFFvFyxW.js +5 -0
  39. package/viewer/assets/blockDiagram-GPEHLZMM-DETJLwVU.js +132 -0
  40. package/viewer/assets/bn-BD-2XOGV67Q-CuUcZaL8.js +5 -0
  41. package/viewer/assets/c4Diagram-AAUBKEIU-DCfnD0yS.js +10 -0
  42. package/viewer/assets/ca-ES-6MX7JW3Y-Cj4OlC6R.js +8 -0
  43. package/viewer/assets/channel-Cvj3_InT.js +1 -0
  44. package/viewer/assets/chunk-2J33WTMH-vXxffsmH.js +1 -0
  45. package/viewer/assets/chunk-3OPIFGDE-C9LtEwmG.js +62 -0
  46. package/viewer/assets/chunk-4BX2VUAB-CIKyExbu.js +1 -0
  47. package/viewer/assets/chunk-55IACEB6-uprZKw0K.js +1 -0
  48. package/viewer/assets/chunk-5ZQYHXKU-C2girjDc.js +2 -0
  49. package/viewer/assets/chunk-6U3AYISY-sM9HnDSj.js +12 -0
  50. package/viewer/assets/chunk-727SXJPM-BJJusOVj.js +206 -0
  51. package/viewer/assets/chunk-AGHRB4JF-vbzngFky.js +1 -0
  52. package/viewer/assets/chunk-AQP2D5EJ-BPoH0fiI.js +231 -0
  53. package/viewer/assets/chunk-BSJP7CBP-9m7kELGq.js +1 -0
  54. package/viewer/assets/chunk-CSCIHK7Q-OdsAx3G8.js +124 -0
  55. package/viewer/assets/chunk-EIO257PC-B13QElRc.js +22 -0
  56. package/viewer/assets/chunk-FMBD7UC4-DiXlV5mw.js +15 -0
  57. package/viewer/assets/chunk-K2UTITRG-CJkr0tXj.js +35 -0
  58. package/viewer/assets/chunk-KSCS5N6A-WSLcjFr5.js +10 -0
  59. package/viewer/assets/chunk-L5ZTLDWV-B_HlbJUe.js +1 -0
  60. package/viewer/assets/chunk-LZXEDZCA-Cqd1LSkM.js +2 -0
  61. package/viewer/assets/chunk-ND2GUHAM-28eJdx7E.js +1 -0
  62. package/viewer/assets/chunk-NZK2D7GU-BUIZFEFT.js +1 -0
  63. package/viewer/assets/chunk-O5CBEL6O-DZNjSn6F.js +70 -0
  64. package/viewer/assets/chunk-QZHKN3VN-DQmrlo26.js +1 -0
  65. package/viewer/assets/chunk-SRAX5OIU-D2mqL_eA.js +1 -0
  66. package/viewer/assets/chunk-WU5MYG2G-CI2E4kog.js +1 -0
  67. package/viewer/assets/chunk-XPW4576I-CvDbpA2d.js +32 -0
  68. package/viewer/assets/chunk-Z3N5DIM6-DVAc8Qv7.js +1 -0
  69. package/viewer/assets/chunk-ZUYEQ4TG-DaQMhOk1.js +7 -0
  70. package/viewer/assets/classDiagram-4FO5ZUOK-BR_8dE4R.js +1 -0
  71. package/viewer/assets/classDiagram-v2-Q7XG4LA2-BSPdc-Mh.js +1 -0
  72. package/viewer/assets/cose-bilkent-S5V4N54A-DT4OXn3T.js +1 -0
  73. package/viewer/assets/cs-CZ-2BRQDIVT-9YP2OnzR.js +11 -0
  74. package/viewer/assets/cytoscape.esm-DQPqE0MR.js +321 -0
  75. package/viewer/assets/da-DK-5WZEPLOC-DyH5OvyC.js +5 -0
  76. package/viewer/assets/dagre-BM42HDAG-BQqjetsc.js +4 -0
  77. package/viewer/assets/dagre-D7L3ChvY.js +1 -0
  78. package/viewer/assets/de-DE-XR44H4JA-Dm-lIYs8.js +8 -0
  79. package/viewer/assets/defaultLocale-GXPQCpCV.js +1 -0
  80. package/viewer/assets/diagram-2AECGRRQ-DQj687EE.js +43 -0
  81. package/viewer/assets/diagram-5GNKFQAL-C9cKajpJ.js +10 -0
  82. package/viewer/assets/diagram-KO2AKTUF-BrHr9ddz.js +3 -0
  83. package/viewer/assets/diagram-LMA3HP47-B_3VIpAA.js +24 -0
  84. package/viewer/assets/diagram-OG6HWLK6-CKGkIofl.js +24 -0
  85. package/viewer/assets/directory-open-01563666-DJpMaT5E.js +1 -0
  86. package/viewer/assets/directory-open-4ed118d0-vrMz6VGC.js +1 -0
  87. package/viewer/assets/dist-BWLXExfL.js +27 -0
  88. package/viewer/assets/dist-Bl_HJvJC.js +1 -0
  89. package/viewer/assets/dist-CDIdMEAB.js +7 -0
  90. package/viewer/assets/docx-preview-CiJ_X4bw.js +20 -0
  91. package/viewer/assets/el-GR-BZB4AONW-r581kidc.js +10 -0
  92. package/viewer/assets/en-B4ZKOASM-Crn8bm25.js +1 -0
  93. package/viewer/assets/erDiagram-TEJ5UH35-BEdSv6Fr.js +85 -0
  94. package/viewer/assets/es-ES-U4NZUMDT-Cwbu6VfM.js +9 -0
  95. package/viewer/assets/eu-ES-A7QVB2H4-BQQ8mY2m.js +11 -0
  96. package/viewer/assets/eventmodeling-FCH6USID-ClPyqCMG.js +1 -0
  97. package/viewer/assets/fa-IR-HGAKTJCU-eYy7h0Hx.js +8 -0
  98. package/viewer/assets/fi-FI-Z5N7JZ37-0dUJDB5b.js +6 -0
  99. package/viewer/assets/file-open-002ab408-D8YX4_im.js +1 -0
  100. package/viewer/assets/file-open-7c801643-ssV9zcu_.js +1 -0
  101. package/viewer/assets/file-save-3189631c-DxUkN-yO.js +1 -0
  102. package/viewer/assets/file-save-745eba88-VPL_lGKy.js +1 -0
  103. package/viewer/assets/flowDiagram-I6XJVG4X-BuWsqPkc.js +162 -0
  104. package/viewer/assets/fr-FR-RHASNOE6-CcYw1Zvt.js +9 -0
  105. package/viewer/assets/ganttDiagram-6RSMTGT7-CJySS69b.js +292 -0
  106. package/viewer/assets/gitGraph-WXDBUCRP-ce180Qdx.js +1 -0
  107. package/viewer/assets/gitGraphDiagram-PVQCEYII-DR2VhZO_.js +106 -0
  108. package/viewer/assets/gl-ES-HMX3MZ6V-C3Iv5ndX.js +10 -0
  109. package/viewer/assets/graphlib-Bk2wNdF0.js +1 -0
  110. package/viewer/assets/he-IL-6SHJWFNN-CL8Or2hC.js +10 -0
  111. package/viewer/assets/hi-IN-IWLTKZ5I-DgAD87B-.js +4 -0
  112. package/viewer/assets/hu-HU-A5ZG7DT2-B8ITrvUt.js +7 -0
  113. package/viewer/assets/id-ID-SAP4L64H-VQ2OqDi1.js +10 -0
  114. package/viewer/assets/image-GAAHSSAO-DbYjE9JA.js +1 -0
  115. package/viewer/assets/image-blob-reduce.esm-Co0wHMYu.js +2 -0
  116. package/viewer/assets/index-0hvuUhZv.js +106 -0
  117. package/viewer/assets/index-Bwjgtadn.css +1 -0
  118. package/viewer/assets/info-J43DQDTF-CMRAUPs-.js +1 -0
  119. package/viewer/assets/infoDiagram-5YYISTIA-DxNv4IA7.js +2 -0
  120. package/viewer/assets/init-Bj57mB65.js +1 -0
  121. package/viewer/assets/ishikawaDiagram-YF4QCWOH-2rCqsio7.js +70 -0
  122. package/viewer/assets/it-IT-JPQ66NNP-D777F8zf.js +11 -0
  123. package/viewer/assets/ja-JP-DBVTYXUO-D1PJdPJe.js +8 -0
  124. package/viewer/assets/journeyDiagram-JHISSGLW-DQQq5Lp7.js +139 -0
  125. package/viewer/assets/jszip.min-D1xSKQ08.js +2 -0
  126. package/viewer/assets/kaa-6HZHGXH3-fRgBr8Mi.js +1 -0
  127. package/viewer/assets/kab-KAB-ZGHBKWFO-DlQ49dRn.js +8 -0
  128. package/viewer/assets/kanban-definition-UN3LZRKU-B5eO6Mg1.js +89 -0
  129. package/viewer/assets/katex-C22v-RF3.js +257 -0
  130. package/viewer/assets/kk-KZ-P5N5QNE5-Hq_H-Gj0.js +1 -0
  131. package/viewer/assets/km-KH-HSX4SM5Z-BhI31DxZ.js +11 -0
  132. package/viewer/assets/ko-KR-MTYHY66A-ImUZQcvz.js +9 -0
  133. package/viewer/assets/ku-TR-6OUDTVRD-DfaC8QXn.js +9 -0
  134. package/viewer/assets/linear-CjCAJGt1.js +1 -0
  135. package/viewer/assets/logo-DG62cSZK.png +0 -0
  136. package/viewer/assets/lt-LT-XHIRWOB4-I-ZCC3dU.js +3 -0
  137. package/viewer/assets/lv-LV-5QDEKY6T-Qq5QdgfN.js +7 -0
  138. package/viewer/assets/mermaid-parser.core-Bdy3q53b.js +161 -0
  139. package/viewer/assets/mindmap-definition-RKZ34NQL-m96D2ClP.js +96 -0
  140. package/viewer/assets/mr-IN-CRQNXWMA-BeP3PnlU.js +13 -0
  141. package/viewer/assets/my-MM-5M5IBNSE-BYx0eFn7.js +1 -0
  142. package/viewer/assets/nb-NO-T6EIAALU-C9J5JzGe.js +10 -0
  143. package/viewer/assets/nl-NL-IS3SIHDZ-CMVLrD7F.js +8 -0
  144. package/viewer/assets/nn-NO-6E72VCQL-BBxsrvc2.js +8 -0
  145. package/viewer/assets/oc-FR-POXYY2M6-CHEXPovt.js +8 -0
  146. package/viewer/assets/ofd-D8TA6tcU.js +6 -0
  147. package/viewer/assets/ordinal-CEZ33b-s.js +1 -0
  148. package/viewer/assets/pa-IN-N4M65BXN-Bnyu119-.js +4 -0
  149. package/viewer/assets/packet-YPE3B663-mGtuymGQ.js +1 -0
  150. package/viewer/assets/pdf.worker-BZPf8fJG.js +50 -0
  151. package/viewer/assets/percentages-BXMCSKIN-CBvdjJLu.js +1 -0
  152. package/viewer/assets/pica-CB7jwGa3.js +2 -0
  153. package/viewer/assets/pie-DUmD7IHG.js +1 -0
  154. package/viewer/assets/pie-LRSECV5Y-CGMZQePM.js +1 -0
  155. package/viewer/assets/pieDiagram-4H26LBE5-DVleOheM.js +30 -0
  156. package/viewer/assets/pl-PL-T2D74RX3-Cw72z8vE.js +9 -0
  157. package/viewer/assets/pptx.worker-c0GnmoEE.js +23 -0
  158. package/viewer/assets/prod-Npfld6sP.js +149 -0
  159. package/viewer/assets/pt-BR-5N22H2LF-ok3TV3dt.js +9 -0
  160. package/viewer/assets/pt-PT-UZXXM6DQ-BX423IXU.js +9 -0
  161. package/viewer/assets/quadrantDiagram-W4KKPZXB-CV_EkNJ-.js +7 -0
  162. package/viewer/assets/radar-GUYGQ44K-C81hKZN2.js +1 -0
  163. package/viewer/assets/requirementDiagram-4Y6WPE33-B_kmlnjO.js +84 -0
  164. package/viewer/assets/ro-RO-JPDTUUEW-Pv4aDgxu.js +11 -0
  165. package/viewer/assets/rough.esm-BrTFrov0.js +1 -0
  166. package/viewer/assets/roundRect-BDOnP7qU.js +1 -0
  167. package/viewer/assets/ru-RU-B4JR7IUQ-BGRCDPgW.js +9 -0
  168. package/viewer/assets/sankeyDiagram-5OEKKPKP-CCXvqmNS.js +40 -0
  169. package/viewer/assets/sequenceDiagram-3UESZ5HK-CoR9l1O_.js +162 -0
  170. package/viewer/assets/sheet.worker-DXcmIjpw.js +68 -0
  171. package/viewer/assets/si-LK-N5RQ5JYF-CSeZ8jFh.js +1 -0
  172. package/viewer/assets/sk-SK-C5VTKIMK-BrMoO_Q1.js +6 -0
  173. package/viewer/assets/sl-SI-NN7IZMDC-B_x--94y.js +6 -0
  174. package/viewer/assets/src-BBw8FbvP.js +1 -0
  175. package/viewer/assets/src-BbUo_1sw.js +5 -0
  176. package/viewer/assets/stateDiagram-AJRCARHV-DdTaUVJA.js +1 -0
  177. package/viewer/assets/stateDiagram-v2-BHNVJYJU-D9_r8kG7.js +1 -0
  178. package/viewer/assets/subset-shared.chunk-DpZLNUjP.js +1 -0
  179. package/viewer/assets/subset-worker.chunk-DoDHTOze.js +1 -0
  180. package/viewer/assets/sv-SE-XGPEYMSR-BB4gq_Zc.js +10 -0
  181. package/viewer/assets/ta-IN-2NMHFXQM-9zxtttPw.js +9 -0
  182. package/viewer/assets/th-TH-HPSO5L25-Bu674ZxS.js +2 -0
  183. package/viewer/assets/time-0omzMTb_.js +1 -0
  184. package/viewer/assets/timeline-definition-PNZ67QCA-CLUsDmue.js +120 -0
  185. package/viewer/assets/tr-TR-DEFEU3FU-BOU8hW6c.js +7 -0
  186. package/viewer/assets/treeView-BLDUP644-NZTNRLdP.js +1 -0
  187. package/viewer/assets/treemap-LRROVOQU-BMknj0en.js +1 -0
  188. package/viewer/assets/uk-UA-QMV73CPH-DExt1pCB.js +6 -0
  189. package/viewer/assets/vennDiagram-CIIHVFJN-DFmAzwyu.js +34 -0
  190. package/viewer/assets/vi-VN-M7AON7JQ-ChzDxy_w.js +5 -0
  191. package/viewer/assets/wardley-L42UT6IY-D9i-Iven.js +1 -0
  192. package/viewer/assets/wardleyDiagram-YWT4CUSO-DpnSL_l7.js +78 -0
  193. package/viewer/assets/worker-ref-zQl5Zn-S.js +1 -0
  194. package/viewer/assets/xlsx-ff7ER-JZ.png +0 -0
  195. package/viewer/assets/xychartDiagram-2RQKCTM6-DTybmPGf.js +7 -0
  196. package/viewer/assets/zh-CN-LNUGB5OW-AIyEr3br.js +10 -0
  197. package/viewer/assets/zh-HK-E62DVLB3-CyQvIghB.js +1 -0
  198. package/viewer/assets/zh-TW-RAJ6MFWO-C9bb32Ou.js +9 -0
  199. package/viewer/favicon.ico +0 -0
  200. package/viewer/flyfish-viewer-manifest.json +5 -0
  201. package/viewer/index.html +14 -0
package/LICENSE ADDED
@@ -0,0 +1,160 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright
13
+ owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other entities
16
+ that control, are controlled by, or are under common control with that entity.
17
+ For the purposes of this definition, "control" means (i) the power, direct or
18
+ indirect, to cause the direction or management of such entity, whether by
19
+ contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
20
+ outstanding shares, or (iii) beneficial ownership of such entity.
21
+
22
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
23
+ permissions granted by this License.
24
+
25
+ "Source" form shall mean the preferred form for making modifications, including
26
+ but not limited to software source code, documentation source, and configuration
27
+ files.
28
+
29
+ "Object" form shall mean any form resulting from mechanical transformation or
30
+ translation of a Source form, including but not limited to compiled object code,
31
+ generated documentation, and conversions to other media types.
32
+
33
+ "Work" shall mean the work of authorship, whether in Source or Object form,
34
+ made available under the License, as indicated by a copyright notice that is
35
+ included in or attached to the work.
36
+
37
+ "Derivative Works" shall mean any work, whether in Source or Object form, that
38
+ is based on (or derived from) the Work and for which the editorial revisions,
39
+ annotations, elaborations, or other modifications represent, as a whole, an
40
+ original work of authorship. For the purposes of this License, Derivative Works
41
+ shall not include works that remain separable from, or merely link (or bind by
42
+ name) to the interfaces of, the Work and Derivative Works thereof.
43
+
44
+ "Contribution" shall mean any work of authorship, including the original version
45
+ of the Work and any modifications or additions to that Work or Derivative Works
46
+ thereof, that is intentionally submitted to Licensor for inclusion in the Work by
47
+ the copyright owner or by an individual or Legal Entity authorized to submit on
48
+ behalf of the copyright owner. For the purposes of this definition, "submitted"
49
+ means any form of electronic, verbal, or written communication sent to the
50
+ Licensor or its representatives, including but not limited to communication on
51
+ electronic mailing lists, source code control systems, and issue tracking systems
52
+ that are managed by, or on behalf of, the Licensor for the purpose of discussing
53
+ and improving the Work, but excluding communication that is conspicuously marked
54
+ or otherwise designated in writing by the copyright owner as "Not a
55
+ Contribution."
56
+
57
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
58
+ of whom a Contribution has been received by Licensor and subsequently
59
+ incorporated within the Work.
60
+
61
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
62
+ License, each Contributor hereby grants to You a perpetual, worldwide,
63
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
64
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
65
+ sublicense, and distribute the Work and such Derivative Works in Source or
66
+ Object form.
67
+
68
+ 3. Grant of Patent License. Subject to the terms and conditions of this License,
69
+ each Contributor hereby grants to You a perpetual, worldwide, non-exclusive,
70
+ no-charge, royalty-free, irrevocable (except as stated in this section) patent
71
+ license to make, have made, use, offer to sell, sell, import, and otherwise
72
+ transfer the Work, where such license applies only to those patent claims
73
+ licensable by such Contributor that are necessarily infringed by their
74
+ Contribution(s) alone or by combination of their Contribution(s) with the Work to
75
+ which such Contribution(s) was submitted. If You institute patent litigation
76
+ against any entity (including a cross-claim or counterclaim in a lawsuit)
77
+ alleging that the Work or a Contribution incorporated within the Work
78
+ constitutes direct or contributory patent infringement, then any patent licenses
79
+ granted to You under this License for that Work shall terminate as of the date
80
+ such litigation is filed.
81
+
82
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
83
+ Derivative Works thereof in any medium, with or without modifications, and in
84
+ Source or Object form, provided that You meet the following conditions:
85
+
86
+ (a) You must give any other recipients of the Work or Derivative Works a copy of
87
+ this License; and
88
+
89
+ (b) You must cause any modified files to carry prominent notices stating that
90
+ You changed the files; and
91
+
92
+ (c) You must retain, in the Source form of any Derivative Works that You
93
+ distribute, all copyright, patent, trademark, and attribution notices from the
94
+ Source form of the Work, excluding those notices that do not pertain to any part
95
+ of the Derivative Works; and
96
+
97
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then
98
+ any Derivative Works that You distribute must include a readable copy of the
99
+ attribution notices contained within such NOTICE file, excluding those notices
100
+ that do not pertain to any part of the Derivative Works, in at least one of the
101
+ following places: within a NOTICE text file distributed as part of the Derivative
102
+ Works; within the Source form or documentation, if provided along with the
103
+ Derivative Works; or, within a display generated by the Derivative Works, if and
104
+ wherever such third-party notices normally appear. The contents of the NOTICE
105
+ file are for informational purposes only and do not modify the License. You may
106
+ add Your own attribution notices within Derivative Works that You distribute,
107
+ alongside or as an addendum to the NOTICE text from the Work, provided that such
108
+ additional attribution notices cannot be construed as modifying the License.
109
+
110
+ You may add Your own copyright statement to Your modifications and may provide
111
+ additional or different license terms and conditions for use, reproduction, or
112
+ distribution of Your modifications, or for any such Derivative Works as a whole,
113
+ provided Your use, reproduction, and distribution of the Work otherwise complies
114
+ with the conditions stated in this License.
115
+
116
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
117
+ Contribution intentionally submitted for inclusion in the Work by You to the
118
+ Licensor shall be under the terms and conditions of this License, without any
119
+ additional terms or conditions. Notwithstanding the above, nothing herein shall
120
+ supersede or modify the terms of any separate license agreement you may have
121
+ executed with Licensor regarding such Contributions.
122
+
123
+ 6. Trademarks. This License does not grant permission to use the trade names,
124
+ trademarks, service marks, or product names of the Licensor, except as required
125
+ for reasonable and customary use in describing the origin of the Work and
126
+ reproducing the content of the NOTICE file.
127
+
128
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
129
+ writing, Licensor provides the Work (and each Contributor provides its
130
+ Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
131
+ KIND, either express or implied, including, without limitation, any warranties or
132
+ conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
133
+ PARTICULAR PURPOSE. You are solely responsible for determining the
134
+ appropriateness of using or redistributing the Work and assume any risks
135
+ associated with Your exercise of permissions under this License.
136
+
137
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
138
+ tort (including negligence), contract, or otherwise, unless required by
139
+ applicable law (such as deliberate and grossly negligent acts) or agreed to in
140
+ writing, shall any Contributor be liable to You for damages, including any
141
+ direct, indirect, special, incidental, or consequential damages of any character
142
+ arising as a result of this License or out of the use or inability to use the
143
+ Work (including but not limited to damages for loss of goodwill, work stoppage,
144
+ computer failure or malfunction, or any and all other commercial damages or
145
+ losses), even if such Contributor has been advised of the possibility of such
146
+ damages.
147
+
148
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or
149
+ Derivative Works thereof, You may choose to offer, and charge a fee for,
150
+ acceptance of support, warranty, indemnity, or other liability obligations and/or
151
+ rights consistent with this License. However, in accepting such obligations, You
152
+ may act only on Your own behalf and on Your sole responsibility, not on behalf of
153
+ any other Contributor, and only if You agree to indemnify, defend, and hold each
154
+ Contributor harmless for any liability incurred by, or claims asserted against,
155
+ such Contributor by reason of your accepting any such warranty or additional
156
+ liability.
157
+
158
+ END OF TERMS AND CONDITIONS
159
+
160
+ Copyright 2026 Flyfish Viewer
package/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # @flyfish-group/file-viewer-web
2
+
3
+ 纯 Web 文件预览组件。只提供私有化部署路线: npm 包随包携带 Vue 基线 viewer 产物,安装后会自动复制到宿主项目的 `public/file-viewer`,组件默认加载 `/file-viewer/index.html`。
4
+
5
+ ```bash
6
+ pnpm add @flyfish-group/file-viewer-web
7
+ ```
8
+
9
+ ```ts
10
+ import { mountViewerFrame } from '@flyfish-group/file-viewer-web'
11
+
12
+ mountViewerFrame(document.getElementById('viewer')!, {
13
+ url: 'https://example.com/demo.pdf'
14
+ })
15
+ ```
16
+
17
+ 鉴权文件可以由宿主系统先下载成 `Blob`,再通过 `file` 和 `name` 推送给 iframe。
18
+
19
+ ```ts
20
+ const blob = await fetch('/api/files/contract', { credentials: 'include' }).then(res => res.blob())
21
+
22
+ mountViewerFrame(document.getElementById('viewer')!, {
23
+ file: blob,
24
+ name: 'contract.pdf'
25
+ })
26
+ ```
27
+
28
+ 如果你的静态目录不是 `public/file-viewer`,可以在安装后手动复制一次:
29
+
30
+ ```bash
31
+ npx file-viewer-copy-assets ./public/vendor/file-viewer
32
+ ```
33
+
34
+ 然后在组件里覆盖 `viewerUrl`:
35
+
36
+ ```ts
37
+ mountViewerFrame(el, {
38
+ viewerUrl: '/vendor/file-viewer/index.html',
39
+ url
40
+ })
41
+ ```
@@ -0,0 +1,60 @@
1
+ export type FileRef = File | Blob | ArrayBuffer;
2
+ export type ViewerFrameParamValue = string | number | boolean | null | undefined;
3
+ export interface ViewerFrameOptions {
4
+ /**
5
+ * 私有化部署后的 Vue 基线预览器页面地址。
6
+ *
7
+ * 默认使用安装后复制到宿主项目的 `/file-viewer/index.html`。
8
+ */
9
+ viewerUrl?: string;
10
+ /**
11
+ * 远端文件地址。会透传为预览器的 `url` 查询参数。
12
+ */
13
+ url?: string;
14
+ /**
15
+ * 本地二进制输入。优先级高于 `url`,会通过 postMessage 推送给 iframe。
16
+ */
17
+ file?: FileRef;
18
+ /**
19
+ * 当 file 是 Blob 或 ArrayBuffer 时用于识别扩展名。
20
+ */
21
+ name?: string;
22
+ /**
23
+ * 允许推送二进制的宿主 origin。默认取当前页面 origin。
24
+ */
25
+ from?: string;
26
+ /**
27
+ * postMessage 的目标 origin。默认从 viewerUrl 推导。
28
+ */
29
+ targetOrigin?: string;
30
+ /**
31
+ * 预留给后续 Vue 基线页面扩展的查询参数。
32
+ */
33
+ params?: Record<string, ViewerFrameParamValue>;
34
+ }
35
+ export interface CreateViewerFrameOptions extends ViewerFrameOptions {
36
+ autoPostFile?: boolean;
37
+ className?: string;
38
+ style?: Partial<CSSStyleDeclaration>;
39
+ title?: string;
40
+ }
41
+ export interface ViewerFrameController {
42
+ readonly frame: HTMLIFrameElement;
43
+ readonly src: string;
44
+ destroy(): void;
45
+ postFile(): boolean;
46
+ reload(): void;
47
+ update(options: ViewerFrameOptions): string;
48
+ }
49
+ export declare const DEFAULT_VIEWER_PUBLIC_DIR = "/file-viewer";
50
+ export declare const DEFAULT_VIEWER_URL = "/file-viewer/index.html";
51
+ export declare const getCurrentOrigin: () => string;
52
+ export declare const getViewerUrl: (viewerUrl?: string) => string;
53
+ export declare const getViewerOrigin: (viewerUrl?: string) => string;
54
+ export declare const getSourceFilename: (options: Pick<ViewerFrameOptions, "file" | "name" | "url">) => string;
55
+ export declare const buildViewerSrc: (options?: ViewerFrameOptions) => string;
56
+ export declare const toMessageBlob: (file?: FileRef) => Blob | undefined;
57
+ export declare const postFileToViewer: (frame: HTMLIFrameElement | null | undefined, options: ViewerFrameOptions) => boolean;
58
+ export declare const syncViewerFrame: (frame: HTMLIFrameElement | null | undefined, options: ViewerFrameOptions) => string;
59
+ export declare const createViewerFrame: (options?: CreateViewerFrameOptions) => HTMLIFrameElement;
60
+ export declare const mountViewerFrame: (container: HTMLElement, initialOptions?: CreateViewerFrameOptions) => ViewerFrameController;
package/dist/index.js ADDED
@@ -0,0 +1,165 @@
1
+ export const DEFAULT_VIEWER_PUBLIC_DIR = '/file-viewer';
2
+ export const DEFAULT_VIEWER_URL = `${DEFAULT_VIEWER_PUBLIC_DIR}/index.html`;
3
+ const DEFAULT_FRAME_TITLE = 'Flyfish Viewer 文件预览';
4
+ const canUseDom = () => typeof window !== 'undefined' && typeof document !== 'undefined';
5
+ const isFile = (value) => {
6
+ return typeof File !== 'undefined' && value instanceof File;
7
+ };
8
+ const isBlob = (value) => {
9
+ return typeof Blob !== 'undefined' && value instanceof Blob;
10
+ };
11
+ const isArrayBuffer = (value) => {
12
+ return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;
13
+ };
14
+ const createUrl = (viewerUrl) => {
15
+ if (canUseDom()) {
16
+ return new URL(viewerUrl || DEFAULT_VIEWER_URL, window.location.href);
17
+ }
18
+ return new URL(viewerUrl || DEFAULT_VIEWER_URL, 'http://localhost');
19
+ };
20
+ const isAbsoluteUrl = (value) => {
21
+ return !!value && (/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(value) || value.startsWith('//'));
22
+ };
23
+ const serializeViewerUrl = (url, viewerUrl) => {
24
+ if (isAbsoluteUrl(viewerUrl)) {
25
+ return url.toString();
26
+ }
27
+ return url.pathname + url.search + url.hash;
28
+ };
29
+ const appendSearchParam = (target, key, value) => {
30
+ if (value === undefined || value === null || value === '') {
31
+ target.searchParams.delete(key);
32
+ return;
33
+ }
34
+ target.searchParams.set(key, String(value));
35
+ };
36
+ export const getCurrentOrigin = () => {
37
+ return canUseDom() ? window.location.origin : '';
38
+ };
39
+ export const getViewerUrl = (viewerUrl) => viewerUrl || DEFAULT_VIEWER_URL;
40
+ export const getViewerOrigin = (viewerUrl) => {
41
+ if (!viewerUrl && !canUseDom()) {
42
+ return '';
43
+ }
44
+ return createUrl(viewerUrl).origin;
45
+ };
46
+ export const getSourceFilename = (options) => {
47
+ var _a;
48
+ if (isFile(options.file) && options.file.name) {
49
+ return options.file.name;
50
+ }
51
+ if (options.name) {
52
+ return options.name;
53
+ }
54
+ if (options.url) {
55
+ const clean = ((_a = options.url.split('?')[0]) === null || _a === void 0 ? void 0 : _a.split('#')[0]) || options.url;
56
+ return clean.substring(clean.lastIndexOf('/') + 1) || clean;
57
+ }
58
+ return 'preview.bin';
59
+ };
60
+ export const buildViewerSrc = (options = {}) => {
61
+ const src = createUrl(options.viewerUrl);
62
+ Object.entries(options.params || {}).forEach(([key, value]) => {
63
+ appendSearchParam(src, key, value);
64
+ });
65
+ if (options.file) {
66
+ appendSearchParam(src, 'url', undefined);
67
+ appendSearchParam(src, 'name', getSourceFilename(options));
68
+ appendSearchParam(src, 'from', options.from || getCurrentOrigin());
69
+ return serializeViewerUrl(src, options.viewerUrl);
70
+ }
71
+ appendSearchParam(src, 'name', undefined);
72
+ appendSearchParam(src, 'from', undefined);
73
+ appendSearchParam(src, 'url', options.url);
74
+ return serializeViewerUrl(src, options.viewerUrl);
75
+ };
76
+ export const toMessageBlob = (file) => {
77
+ if (!file) {
78
+ return undefined;
79
+ }
80
+ if (isBlob(file)) {
81
+ return file;
82
+ }
83
+ if (isArrayBuffer(file)) {
84
+ return new Blob([file]);
85
+ }
86
+ return undefined;
87
+ };
88
+ export const postFileToViewer = (frame, options) => {
89
+ const data = toMessageBlob(options.file);
90
+ const targetWindow = frame === null || frame === void 0 ? void 0 : frame.contentWindow;
91
+ if (!data || !targetWindow) {
92
+ return false;
93
+ }
94
+ targetWindow.postMessage(data, options.targetOrigin || getViewerOrigin(options.viewerUrl));
95
+ return true;
96
+ };
97
+ export const syncViewerFrame = (frame, options) => {
98
+ if (!frame || !canUseDom()) {
99
+ return '';
100
+ }
101
+ const nextSrc = buildViewerSrc(options);
102
+ if (frame.getAttribute('src') !== nextSrc) {
103
+ frame.setAttribute('src', nextSrc);
104
+ }
105
+ return nextSrc;
106
+ };
107
+ export const createViewerFrame = (options = {}) => {
108
+ if (!canUseDom()) {
109
+ throw new Error('createViewerFrame 只能在浏览器环境中使用');
110
+ }
111
+ const frame = document.createElement('iframe');
112
+ frame.setAttribute('src', buildViewerSrc(options));
113
+ frame.title = options.title || DEFAULT_FRAME_TITLE;
114
+ frame.style.width = '100%';
115
+ frame.style.height = '100%';
116
+ frame.style.border = '0';
117
+ frame.style.display = 'block';
118
+ if (options.className) {
119
+ frame.className = options.className;
120
+ }
121
+ if (options.style) {
122
+ Object.assign(frame.style, options.style);
123
+ }
124
+ if (options.autoPostFile !== false) {
125
+ frame.addEventListener('load', () => {
126
+ postFileToViewer(frame, options);
127
+ });
128
+ }
129
+ return frame;
130
+ };
131
+ export const mountViewerFrame = (container, initialOptions = {}) => {
132
+ let options = initialOptions;
133
+ let src = buildViewerSrc(options);
134
+ const frame = createViewerFrame({ ...options, autoPostFile: false });
135
+ const handleLoad = () => {
136
+ postFileToViewer(frame, options);
137
+ };
138
+ frame.addEventListener('load', handleLoad);
139
+ container.appendChild(frame);
140
+ return {
141
+ frame,
142
+ get src() {
143
+ return src;
144
+ },
145
+ destroy() {
146
+ frame.removeEventListener('load', handleLoad);
147
+ frame.remove();
148
+ },
149
+ postFile() {
150
+ return postFileToViewer(frame, options);
151
+ },
152
+ reload() {
153
+ frame.src = src;
154
+ },
155
+ update(nextOptions) {
156
+ options = { ...options, ...nextOptions };
157
+ const previousSrc = frame.src;
158
+ src = syncViewerFrame(frame, options);
159
+ if (frame.src === previousSrc) {
160
+ postFileToViewer(frame, options);
161
+ }
162
+ return src;
163
+ }
164
+ };
165
+ };
package/dist/node.d.ts ADDED
@@ -0,0 +1,23 @@
1
+ export interface CopyViewerAssetsOptions {
2
+ /**
3
+ * 目标静态目录。默认是宿主项目的 `public/file-viewer`。
4
+ */
5
+ targetDir?: string;
6
+ /**
7
+ * 覆盖默认 viewer 源目录,主要用于测试或内部发布流程。
8
+ */
9
+ sourceDir?: string;
10
+ /**
11
+ * 复制前是否清空目标目录。默认清空,避免旧 hash 资源残留。
12
+ */
13
+ clean?: boolean;
14
+ }
15
+ export declare const DEFAULT_VIEWER_PUBLIC_DIR = "public/file-viewer";
16
+ export declare const DEFAULT_VIEWER_PUBLIC_URL = "/file-viewer/index.html";
17
+ export declare const getViewerAssetDir: () => string;
18
+ export declare const getDefaultViewerTargetDir: () => string;
19
+ export declare const copyViewerAssets: (options?: CopyViewerAssetsOptions) => Promise<{
20
+ sourceDir: string;
21
+ targetDir: string;
22
+ viewerUrl: string;
23
+ }>;
package/dist/node.js ADDED
@@ -0,0 +1,43 @@
1
+ import { cp, mkdir, readdir, rm } from 'node:fs/promises';
2
+ import { existsSync } from 'node:fs';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { dirname, resolve } from 'node:path';
5
+ const distDir = dirname(fileURLToPath(import.meta.url));
6
+ const packageDir = resolve(distDir, '..');
7
+ export const DEFAULT_VIEWER_PUBLIC_DIR = 'public/file-viewer';
8
+ export const DEFAULT_VIEWER_PUBLIC_URL = '/file-viewer/index.html';
9
+ export const getViewerAssetDir = () => resolve(packageDir, 'viewer');
10
+ export const getDefaultViewerTargetDir = () => {
11
+ return resolve(process.env.INIT_CWD || process.cwd(), DEFAULT_VIEWER_PUBLIC_DIR);
12
+ };
13
+ const removeMacMetadata = async (dir) => {
14
+ const entries = await readdir(dir, { withFileTypes: true });
15
+ await Promise.all(entries.map(entry => {
16
+ const path = resolve(dir, entry.name);
17
+ if (entry.name === '.DS_Store') {
18
+ return rm(path, { force: true });
19
+ }
20
+ if (entry.isDirectory()) {
21
+ return removeMacMetadata(path);
22
+ }
23
+ return undefined;
24
+ }));
25
+ };
26
+ export const copyViewerAssets = async (options = {}) => {
27
+ const sourceDir = resolve(options.sourceDir || getViewerAssetDir());
28
+ const targetDir = resolve(options.targetDir || getDefaultViewerTargetDir());
29
+ if (!existsSync(resolve(sourceDir, 'index.html'))) {
30
+ throw new Error(`缺少 viewer 构建产物: ${sourceDir}`);
31
+ }
32
+ if (options.clean !== false) {
33
+ await rm(targetDir, { force: true, recursive: true });
34
+ }
35
+ await mkdir(targetDir, { recursive: true });
36
+ await cp(sourceDir, targetDir, { recursive: true });
37
+ await removeMacMetadata(targetDir);
38
+ return {
39
+ sourceDir,
40
+ targetDir,
41
+ viewerUrl: DEFAULT_VIEWER_PUBLIC_URL
42
+ };
43
+ };
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@flyfish-group/file-viewer-web",
3
+ "version": "1.0.9",
4
+ "private": false,
5
+ "type": "module",
6
+ "description": "Private-deploy pure web component for Flyfish Viewer",
7
+ "keywords": [
8
+ "file-viewer",
9
+ "document-preview",
10
+ "iframe",
11
+ "vanilla-js",
12
+ "web"
13
+ ],
14
+ "publishConfig": {
15
+ "access": "public",
16
+ "registry": "https://registry.npmjs.org/"
17
+ },
18
+ "author": {
19
+ "name": "Wangyu",
20
+ "email": "wybaby168@gmail.com"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/flyfish-dev/file-viewer.git",
25
+ "directory": "packages/web"
26
+ },
27
+ "homepage": "https://github.com/flyfish-dev/file-viewer",
28
+ "bugs": {
29
+ "url": "https://github.com/flyfish-dev/file-viewer/issues"
30
+ },
31
+ "main": "./dist/index.js",
32
+ "module": "./dist/index.js",
33
+ "types": "./dist/index.d.ts",
34
+ "exports": {
35
+ ".": {
36
+ "types": "./dist/index.d.ts",
37
+ "import": "./dist/index.js",
38
+ "default": "./dist/index.js"
39
+ },
40
+ "./node": {
41
+ "types": "./dist/node.d.ts",
42
+ "import": "./dist/node.js",
43
+ "default": "./dist/node.js"
44
+ },
45
+ "./viewer/*": "./viewer/*",
46
+ "./package.json": "./package.json"
47
+ },
48
+ "bin": {
49
+ "file-viewer-copy-assets": "./scripts/copy-assets.mjs"
50
+ },
51
+ "files": [
52
+ "dist",
53
+ "scripts",
54
+ "viewer",
55
+ "README.md"
56
+ ],
57
+ "devDependencies": {
58
+ "@types/node": "^25.8.0",
59
+ "typescript": "^6.0.3"
60
+ },
61
+ "license": "Apache-2.0",
62
+ "scripts": {
63
+ "build": "tsc -b tsconfig.json",
64
+ "postinstall": "node ./scripts/copy-assets.mjs --postinstall",
65
+ "type-check": "tsc -b tsconfig.json"
66
+ }
67
+ }
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env node
2
+ import { cp, mkdir, readdir, rm } from 'node:fs/promises'
3
+ import { existsSync } from 'node:fs'
4
+ import { dirname, resolve } from 'node:path'
5
+ import { fileURLToPath } from 'node:url'
6
+
7
+ const scriptFile = fileURLToPath(import.meta.url)
8
+ const packageDir = resolve(dirname(scriptFile), '..')
9
+ const sourceDir = resolve(packageDir, 'viewer')
10
+ const isPostinstall = process.argv.includes('--postinstall')
11
+ const explicitTarget = process.argv.slice(2).find(arg => !arg.startsWith('--'))
12
+ const targetDir = resolve(
13
+ process.env.FILE_VIEWER_PUBLIC_DIR ||
14
+ explicitTarget ||
15
+ resolve(process.env.INIT_CWD || process.cwd(), 'public/file-viewer')
16
+ )
17
+
18
+ const skip = process.env.FILE_VIEWER_SKIP_ASSET_COPY === '1' ||
19
+ process.env.FILE_VIEWER_SKIP_ASSET_COPY === 'true'
20
+
21
+ if (skip) {
22
+ process.exit(0)
23
+ }
24
+
25
+ // Workspace installs should not mutate the repository automatically.
26
+ if (isPostinstall && !packageDir.includes('node_modules')) {
27
+ process.exit(0)
28
+ }
29
+
30
+ if (!existsSync(resolve(sourceDir, 'index.html'))) {
31
+ const message = `[file-viewer-web] 缺少 viewer 构建产物: ${sourceDir}`
32
+ if (isPostinstall) {
33
+ console.warn(message)
34
+ process.exit(0)
35
+ }
36
+ console.error(message)
37
+ process.exit(1)
38
+ }
39
+
40
+ const removeMacMetadata = async dir => {
41
+ const entries = await readdir(dir, { withFileTypes: true })
42
+ await Promise.all(entries.map(entry => {
43
+ const path = resolve(dir, entry.name)
44
+ if (entry.name === '.DS_Store') {
45
+ return rm(path, { force: true })
46
+ }
47
+ if (entry.isDirectory()) {
48
+ return removeMacMetadata(path)
49
+ }
50
+ return undefined
51
+ }))
52
+ }
53
+
54
+ await rm(targetDir, { force: true, recursive: true })
55
+ await mkdir(targetDir, { recursive: true })
56
+ await cp(sourceDir, targetDir, { recursive: true })
57
+ await removeMacMetadata(targetDir)
58
+
59
+ console.log(`[file-viewer-web] viewer assets copied to ${targetDir}`)
@@ -0,0 +1 @@
1
+ .audio-viewer[data-v-608bd328]{background:linear-gradient(135deg,#0e74901a,#0000 34%),linear-gradient(#f5f8fb 0%,#edf2f7 100%);justify-content:center;align-items:center;width:100%;min-height:100%;padding:28px;display:flex}.audio-card[data-v-608bd328]{background:#ffffffeb;border:1px solid #0f172a14;border-radius:8px;grid-template-columns:86px minmax(0,1fr);align-items:center;gap:18px;width:min(100%,640px);padding:24px;display:grid;box-shadow:0 20px 52px #0f172a21}.audio-art[data-v-608bd328]{background:linear-gradient(135deg,#0f766e,#2dd4bf);border-radius:8px;width:86px;height:86px;position:relative;box-shadow:inset 0 0 0 1px #ffffff3d}.audio-art span[data-v-608bd328]{border:8px solid #ffffffe0;border-radius:999px;position:absolute;inset:18px}.audio-art i[data-v-608bd328]{background:#ffffffe6;border-radius:10px 10px 4px 4px;width:18px;height:36px;position:absolute;bottom:20px;right:18px}.audio-copy[data-v-608bd328]{min-width:0}.audio-kicker[data-v-608bd328]{color:#0f766e;letter-spacing:0;font-size:12px;font-weight:800}.audio-copy strong[data-v-608bd328]{color:#132235;margin-top:5px;font-size:23px;line-height:1.15;display:block}.audio-copy p[data-v-608bd328]{color:#64748b;margin:8px 0 0;font-size:13px;line-height:1.7}.audio-meter[data-v-608bd328]{color:#64748b;font-variant-numeric:tabular-nums;grid-column:1/-1;grid-template-columns:48px minmax(0,1fr) 48px;align-items:center;gap:10px;font-size:12px;display:grid}.audio-progress[data-v-608bd328]{background:#0f766e1f;border-radius:999px;height:6px;overflow:hidden}.audio-progress i[data-v-608bd328]{border-radius:inherit;background:linear-gradient(90deg,#0f766e,#2dd4bf);height:100%;transition:width .18s;display:block}.audio-control[data-v-608bd328]{grid-column:1/-1;width:100%;height:42px}@media (width<=560px){.audio-viewer[data-v-608bd328]{padding:16px}.audio-card[data-v-608bd328]{grid-template-columns:1fr}.audio-art[data-v-608bd328]{width:72px;height:72px}}
@@ -0,0 +1 @@
1
+ import{E as e,S as t,T as n,_ as r,b as i,d as a,h as o,m as s,o as c,r as l,s as u,u as d}from"./index-0hvuUhZv.js";var f={class:`audio-viewer`},p={class:`audio-card`},m={class:`audio-copy`},h={class:`audio-kicker`},g={class:`audio-meter`},_={class:`audio-progress`,"aria-hidden":`true`},v=[`src`],y=l(a({__name:`AudioViewer`,props:{data:{},type:{}},setup(a){let l=a,y=t(null),b=t(``),x=t(0),S=t(0),C=t(!1),w={aac:`audio/aac`,flac:`audio/flac`,m4a:`audio/mp4`,mp3:`audio/mpeg`,mpeg:`audio/mpeg`,oga:`audio/ogg`,ogg:`audio/ogg`,opus:`audio/ogg; codecs=opus`,wav:`audio/wav`,weba:`audio/webm`},T=c(()=>l.type.trim().toLowerCase()),E=c(()=>w[T.value]||`audio/*`),D=c(()=>T.value.toUpperCase()||`AUDIO`),O=c(()=>!Number.isFinite(S.value)||S.value<=0?0:Math.min(100,Math.max(0,x.value/S.value*100))),k=e=>{if(!Number.isFinite(e)||e<=0)return`00:00`;let t=Math.floor(e/60),n=Math.floor(e%60);return`${String(t).padStart(2,`0`)}:${String(n).padStart(2,`0`)}`},A=()=>{b.value&&=(URL.revokeObjectURL(b.value),``)},j=()=>{A(),x.value=0,S.value=0,C.value=!1,b.value=URL.createObjectURL(new Blob([l.data],{type:E.value}))},M=()=>{S.value=y.value?.duration||0,C.value=!0},N=()=>{x.value=y.value?.currentTime||0};return o(j),i(()=>[l.data,l.type],j),s(A),(t,i)=>(r(),d(`div`,f,[u(`section`,p,[i[2]||=u(`div`,{class:`audio-art`},[u(`span`),u(`i`)],-1),u(`div`,m,[u(`span`,h,e(D.value),1),i[0]||=u(`strong`,null,`音频预览`,-1),i[1]||=u(`p`,null,`使用浏览器原生播放器打开,兼容性取决于当前浏览器支持的音频编码。`,-1)]),u(`div`,g,[u(`span`,null,e(k(x.value)),1),u(`div`,_,[u(`i`,{style:n({width:`${O.value}%`})},null,4)]),u(`span`,null,e(C.value?k(S.value):`--:--`),1)]),u(`audio`,{ref_key:`audioRef`,ref:y,class:`audio-control`,src:b.value,controls:``,preload:`metadata`,onLoadedmetadata:M,onTimeupdate:N},` 当前浏览器不支持音频播放。 `,40,v)])]))}}),[[`__scopeId`,`data-v-608bd328`]]);export{y as default};
@@ -0,0 +1 @@
1
+ import{E as e,S as t,_ as n,a as r,d as i,h as a,l as o,m as s,p as c,r as l,s as u,t as d,u as f,v as p,w as m}from"./index-0hvuUhZv.js";var h={class:`cad-viewer`},g={class:`cad-toolbar`},_={class:`cad-tools`},v={class:`cad-body`},y={key:0,class:`cad-layers`},b=[`onClick`],x={class:`cad-canvas-wrap`},S={key:0,class:`cad-state`},C={key:1,class:`cad-state error`},w=l(i({__name:`CadViewer`,props:{data:{},type:{}},setup(i){let l=i,w=t(null),T=t([]),E=t(`pan`),D=t(`loading`),O=t(``),k=null,A=null,j={dwg:`DWG 是专有 CAD 格式,当前 Apache 许可包未内置 GPL 转换器。请优先上传 DXF,或在业务侧转换为 DXF 后预览。`},M=e=>e instanceof Error?e.message:typeof e==`string`?e:JSON.stringify(e),N=e=>{E.value=e,k?.setTool(e)},P=()=>{k?.resize(),k?.fitToView()},F=e=>{let t=e.isOff;k?.setLayerVisible(e.name,t),T.value=T.value.map(n=>n.name===e.name?{...n,isOff:!t}:n)},I=async()=>{let e=w.value;if(e){D.value=`loading`,O.value=``;try{let{CadViewer:t}=await d(async()=>{let{CadViewer:e}=await import(`./dist-CDIdMEAB.js`);return{CadViewer:e}},[],import.meta.url);k?.destroy(),k=new t(e,{theme:`light`,initialTool:E.value,worker:!1}),k.loadArrayBuffer(l.data),await c(),P(),T.value=k.getLayers(),D.value=`ready`}catch(e){console.error(e),D.value=`error`,O.value=M(e)||`CAD 图纸解析失败`}}},L=async()=>{let e=l.type.toLowerCase();if(j[e]){D.value=`error`,O.value=j[e];return}await I()};return a(()=>{L();let e=w.value;e&&(A=new ResizeObserver(()=>{k?.resize(),k?.requestRender()}),A.observe(e))}),s(()=>{A?.disconnect(),A=null,k?.destroy(),k=null}),(t,a)=>(n(),f(`div`,h,[u(`div`,g,[u(`div`,_,[u(`button`,{type:`button`,class:m({active:E.value===`pan`}),onClick:a[0]||=e=>N(`pan`)},`平移`,2),u(`button`,{type:`button`,class:m({active:E.value===`select`}),onClick:a[1]||=e=>N(`select`)},`选择`,2),u(`button`,{type:`button`,class:m({active:E.value===`measure`}),onClick:a[2]||=e=>N(`measure`)},`测量`,2),u(`button`,{type:`button`,onClick:P},`适配`)]),u(`span`,null,e(i.type.toUpperCase()),1)]),u(`div`,v,[T.value.length?(n(),f(`aside`,y,[(n(!0),f(r,null,p(T.value,t=>(n(),f(`button`,{key:t.name,type:`button`,class:m({muted:t.isOff}),onClick:e=>F(t)},e(t.name),11,b))),128))])):o(``,!0),u(`div`,x,[u(`canvas`,{ref_key:`canvas`,ref:w},null,512),D.value===`loading`?(n(),f(`div`,S,`正在解析 CAD...`)):D.value===`error`?(n(),f(`div`,C,e(O.value),1)):o(``,!0)])])]))}}),[[`__scopeId`,`data-v-cf49f0f1`]]);export{w as default};
@@ -0,0 +1 @@
1
+ .cad-viewer[data-v-cf49f0f1]{color:#142335;background:#f8fafc;flex-direction:column;height:100%;min-height:100%;display:flex}.cad-toolbar[data-v-cf49f0f1]{background:#fff;border-bottom:1px solid #0f172a14;justify-content:space-between;align-items:center;gap:16px;min-height:46px;padding:0 12px;display:flex}.cad-toolbar span[data-v-cf49f0f1]{color:#64748b;letter-spacing:0;font-size:12px;font-weight:800}.cad-tools[data-v-cf49f0f1]{gap:6px;display:flex}.cad-tools button[data-v-cf49f0f1],.cad-layers button[data-v-cf49f0f1]{cursor:pointer;border:0;transition:background-color .18s,color .18s}.cad-tools button[data-v-cf49f0f1]{color:#475569;background:#0f172a0f;border-radius:8px;min-height:30px;padding:0 10px;font-size:12px;font-weight:700}.cad-tools button.active[data-v-cf49f0f1],.cad-tools button[data-v-cf49f0f1]:hover{color:#16804f;background:#21a36624}.cad-body[data-v-cf49f0f1]{flex:1;grid-template-columns:minmax(132px,180px) minmax(0,1fr);min-height:0;display:grid}.cad-layers[data-v-cf49f0f1]{background:#fff;border-right:1px solid #0f172a14;min-height:0;padding:10px;overflow:auto}.cad-layers button[data-v-cf49f0f1]{color:#334155;text-align:left;text-overflow:ellipsis;white-space:nowrap;background:#0f172a0d;border-radius:7px;width:100%;min-height:30px;margin-bottom:6px;padding:0 8px;display:block;overflow:hidden}.cad-layers button.muted[data-v-cf49f0f1]{color:#94a3b8;text-decoration:line-through}.cad-canvas-wrap[data-v-cf49f0f1]{min-width:0;min-height:0;position:relative;overflow:hidden}.cad-canvas-wrap canvas[data-v-cf49f0f1]{width:100%;height:100%;display:block}.cad-state[data-v-cf49f0f1]{color:#64748b;text-align:center;background:#f8fafce6;justify-content:center;align-items:center;padding:24px;line-height:1.7;display:flex;position:absolute;inset:0}.cad-state.error[data-v-cf49f0f1]{color:#b42318}@media (width<=720px){.cad-body[data-v-cf49f0f1]{grid-template-columns:1fr}.cad-layers[data-v-cf49f0f1]{display:none}}
@@ -0,0 +1 @@
1
+ pre code.hljs{padding:1em;display:block;overflow-x:auto}code.hljs{padding:3px 5px}.hljs{color:#c9d1d9;background:#0d1117}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#ff7b72}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#d2a8ff}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-variable,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id{color:#79c0ff}.hljs-regexp,.hljs-string,.hljs-meta .hljs-string{color:#a5d6ff}.hljs-built_in,.hljs-symbol{color:#ffa657}.hljs-comment,.hljs-code,.hljs-formula{color:#8b949e}.hljs-name,.hljs-quote,.hljs-selector-tag,.hljs-selector-pseudo{color:#7ee787}.hljs-subst{color:#c9d1d9}.hljs-section{color:#1f6feb;font-weight:700}.hljs-bullet{color:#f2cc60}.hljs-emphasis{color:#c9d1d9;font-style:italic}.hljs-strong{color:#c9d1d9;font-weight:700}.hljs-addition{color:#aff5b4;background-color:#033a16}.hljs-deletion{color:#ffdcd7;background-color:#67060c}.code-viewer[data-v-b59da2ad]{color:#e6edf3;background:#0d1117;min-height:100%}.code-toolbar[data-v-b59da2ad]{z-index:1;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:#0d1117eb;border-bottom:1px solid #8b949e3d;justify-content:space-between;align-items:center;gap:16px;height:42px;padding:0 16px;display:flex;position:sticky;top:0}.code-toolbar span[data-v-b59da2ad],.code-toolbar strong[data-v-b59da2ad]{color:#8b949e;letter-spacing:0;font-size:12px;font-weight:700}.code-area[data-v-b59da2ad]{background:0 0;min-width:min-content;margin:0;padding:18px 20px 28px;display:block;overflow:auto}.code-area code[data-v-b59da2ad]{color:inherit;tab-size:2;white-space:pre;background:0 0;padding:0;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,monospace;font-size:13px;line-height:1.7;display:block;overflow:visible}