@lamberl-lee/file-preview 0.2.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.
Files changed (263) hide show
  1. package/COPYING +674 -0
  2. package/LICENSE +165 -0
  3. package/README.md +165 -0
  4. package/dist/AudioPreview.d.ts +9 -0
  5. package/dist/AudioPreview.js +29 -0
  6. package/dist/AudioPreview.js.map +1 -0
  7. package/dist/CodePreview.d.ts +10 -0
  8. package/dist/CodePreview.js +121 -0
  9. package/dist/CodePreview.js.map +1 -0
  10. package/dist/CsvPreview.d.ts +9 -0
  11. package/dist/CsvPreview.js +117 -0
  12. package/dist/CsvPreview.js.map +1 -0
  13. package/dist/DocxPreview.d.ts +11 -0
  14. package/dist/DocxPreview.js +89 -0
  15. package/dist/DocxPreview.js.map +1 -0
  16. package/dist/EpubPreview.d.ts +9 -0
  17. package/dist/EpubPreview.js +693 -0
  18. package/dist/EpubPreview.js.map +1 -0
  19. package/dist/HtmlPreview.d.ts +9 -0
  20. package/dist/HtmlPreview.js +60 -0
  21. package/dist/HtmlPreview.js.map +1 -0
  22. package/dist/ImagePreview.d.ts +9 -0
  23. package/dist/ImagePreview.js +44 -0
  24. package/dist/ImagePreview.js.map +1 -0
  25. package/dist/LargeFileGate.d.ts +12 -0
  26. package/dist/LargeFileGate.js +88 -0
  27. package/dist/LargeFileGate.js.map +1 -0
  28. package/dist/MarkdownPreview.d.ts +8 -0
  29. package/dist/MarkdownPreview.js +140 -0
  30. package/dist/MarkdownPreview.js.map +1 -0
  31. package/dist/PdfPreview.d.ts +11 -0
  32. package/dist/PdfPreview.js +206 -0
  33. package/dist/PdfPreview.js.map +1 -0
  34. package/dist/PlainTextLargePreview.d.ts +9 -0
  35. package/dist/PlainTextLargePreview.js +62 -0
  36. package/dist/PlainTextLargePreview.js.map +1 -0
  37. package/dist/PluginPreviewRenderer.d.ts +13 -0
  38. package/dist/PluginPreviewRenderer.js +89 -0
  39. package/dist/PluginPreviewRenderer.js.map +1 -0
  40. package/dist/PptxPreview.d.ts +16 -0
  41. package/dist/PptxPreview.js +376 -0
  42. package/dist/PptxPreview.js.map +1 -0
  43. package/dist/PreviewErrorBoundary.d.ts +29 -0
  44. package/dist/PreviewErrorBoundary.js +53 -0
  45. package/dist/PreviewErrorBoundary.js.map +1 -0
  46. package/dist/PreviewFallback.d.ts +18 -0
  47. package/dist/PreviewFallback.js +143 -0
  48. package/dist/PreviewFallback.js.map +1 -0
  49. package/dist/PreviewLoading.d.ts +8 -0
  50. package/dist/PreviewLoading.js +14 -0
  51. package/dist/PreviewLoading.js.map +1 -0
  52. package/dist/RtfPreview.d.ts +10 -0
  53. package/dist/RtfPreview.js +240 -0
  54. package/dist/RtfPreview.js.map +1 -0
  55. package/dist/ShikiSourceView.d.ts +11 -0
  56. package/dist/ShikiSourceView.js +112 -0
  57. package/dist/ShikiSourceView.js.map +1 -0
  58. package/dist/SvgPreview.d.ts +9 -0
  59. package/dist/SvgPreview.js +89 -0
  60. package/dist/SvgPreview.js.map +1 -0
  61. package/dist/TextPreview.d.ts +9 -0
  62. package/dist/TextPreview.js +9 -0
  63. package/dist/TextPreview.js.map +1 -0
  64. package/dist/VideoPreview.d.ts +9 -0
  65. package/dist/VideoPreview.js +18 -0
  66. package/dist/VideoPreview.js.map +1 -0
  67. package/dist/XlsxPreview.d.ts +12 -0
  68. package/dist/XlsxPreview.js +856 -0
  69. package/dist/XlsxPreview.js.map +1 -0
  70. package/dist/ZipPreview.d.ts +9 -0
  71. package/dist/ZipPreview.js +153 -0
  72. package/dist/ZipPreview.js.map +1 -0
  73. package/dist/core/binary.d.ts +10 -0
  74. package/dist/core/binary.js +27 -0
  75. package/dist/core/binary.js.map +1 -0
  76. package/dist/core/config.d.ts +17 -0
  77. package/dist/core/config.js +19 -0
  78. package/dist/core/config.js.map +1 -0
  79. package/dist/core/download.d.ts +5 -0
  80. package/dist/core/download.js +20 -0
  81. package/dist/core/download.js.map +1 -0
  82. package/dist/core/i18n.d.ts +101 -0
  83. package/dist/core/i18n.js +200 -0
  84. package/dist/core/i18n.js.map +1 -0
  85. package/dist/core/plugin.d.ts +38 -0
  86. package/dist/core/plugin.js +46 -0
  87. package/dist/core/plugin.js.map +1 -0
  88. package/dist/core/registry.d.ts +13 -0
  89. package/dist/core/registry.js +33 -0
  90. package/dist/core/registry.js.map +1 -0
  91. package/dist/core/source.d.ts +14 -0
  92. package/dist/core/source.js +131 -0
  93. package/dist/core/source.js.map +1 -0
  94. package/dist/core/types.d.ts +88 -0
  95. package/dist/core/types.js +27 -0
  96. package/dist/core/types.js.map +1 -0
  97. package/dist/hooks/useObjectUrlFromSource.d.ts +9 -0
  98. package/dist/hooks/useObjectUrlFromSource.js +50 -0
  99. package/dist/hooks/useObjectUrlFromSource.js.map +1 -0
  100. package/dist/hooks/useSourceBase64.d.ts +10 -0
  101. package/dist/hooks/useSourceBase64.js +32 -0
  102. package/dist/hooks/useSourceBase64.js.map +1 -0
  103. package/dist/hooks/useSourceText.d.ts +10 -0
  104. package/dist/hooks/useSourceText.js +32 -0
  105. package/dist/hooks/useSourceText.js.map +1 -0
  106. package/dist/icons.d.ts +44 -0
  107. package/dist/icons.js +248 -0
  108. package/dist/icons.js.map +1 -0
  109. package/dist/index.d.ts +36 -0
  110. package/dist/index.js +147 -0
  111. package/dist/index.js.map +1 -0
  112. package/dist/limits.d.ts +26 -0
  113. package/dist/limits.js +45 -0
  114. package/dist/limits.js.map +1 -0
  115. package/dist/performance-limits.d.ts +27 -0
  116. package/dist/performance-limits.js +54 -0
  117. package/dist/performance-limits.js.map +1 -0
  118. package/dist/plugins/audio-plugin.d.ts +7 -0
  119. package/dist/plugins/audio-plugin.js +11 -0
  120. package/dist/plugins/audio-plugin.js.map +1 -0
  121. package/dist/plugins/builtin-plugins.d.ts +9 -0
  122. package/dist/plugins/builtin-plugins.js +43 -0
  123. package/dist/plugins/builtin-plugins.js.map +1 -0
  124. package/dist/plugins/csv-plugin.d.ts +7 -0
  125. package/dist/plugins/csv-plugin.js +11 -0
  126. package/dist/plugins/csv-plugin.js.map +1 -0
  127. package/dist/plugins/docx-plugin.d.ts +7 -0
  128. package/dist/plugins/docx-plugin.js +15 -0
  129. package/dist/plugins/docx-plugin.js.map +1 -0
  130. package/dist/plugins/epub-plugin.d.ts +7 -0
  131. package/dist/plugins/epub-plugin.js +15 -0
  132. package/dist/plugins/epub-plugin.js.map +1 -0
  133. package/dist/plugins/html-plugin.d.ts +7 -0
  134. package/dist/plugins/html-plugin.js +11 -0
  135. package/dist/plugins/html-plugin.js.map +1 -0
  136. package/dist/plugins/image-plugin.d.ts +7 -0
  137. package/dist/plugins/image-plugin.js +11 -0
  138. package/dist/plugins/image-plugin.js.map +1 -0
  139. package/dist/plugins/markdown-plugin.d.ts +7 -0
  140. package/dist/plugins/markdown-plugin.js +11 -0
  141. package/dist/plugins/markdown-plugin.js.map +1 -0
  142. package/dist/plugins/pdf-plugin.d.ts +7 -0
  143. package/dist/plugins/pdf-plugin.js +15 -0
  144. package/dist/plugins/pdf-plugin.js.map +1 -0
  145. package/dist/plugins/pptx-plugin.d.ts +7 -0
  146. package/dist/plugins/pptx-plugin.js +15 -0
  147. package/dist/plugins/pptx-plugin.js.map +1 -0
  148. package/dist/plugins/rtf-plugin.d.ts +7 -0
  149. package/dist/plugins/rtf-plugin.js +15 -0
  150. package/dist/plugins/rtf-plugin.js.map +1 -0
  151. package/dist/plugins/source-code-plugin.d.ts +7 -0
  152. package/dist/plugins/source-code-plugin.js +11 -0
  153. package/dist/plugins/source-code-plugin.js.map +1 -0
  154. package/dist/plugins/svg-plugin.d.ts +7 -0
  155. package/dist/plugins/svg-plugin.js +11 -0
  156. package/dist/plugins/svg-plugin.js.map +1 -0
  157. package/dist/plugins/text-plugin.d.ts +7 -0
  158. package/dist/plugins/text-plugin.js +11 -0
  159. package/dist/plugins/text-plugin.js.map +1 -0
  160. package/dist/plugins/video-plugin.d.ts +7 -0
  161. package/dist/plugins/video-plugin.js +11 -0
  162. package/dist/plugins/video-plugin.js.map +1 -0
  163. package/dist/plugins/xlsx-plugin.d.ts +7 -0
  164. package/dist/plugins/xlsx-plugin.js +15 -0
  165. package/dist/plugins/xlsx-plugin.js.map +1 -0
  166. package/dist/plugins/zip-plugin.d.ts +7 -0
  167. package/dist/plugins/zip-plugin.js +15 -0
  168. package/dist/plugins/zip-plugin.js.map +1 -0
  169. package/dist/preview-adapters/AudioPreviewAdapter.d.ts +8 -0
  170. package/dist/preview-adapters/AudioPreviewAdapter.js +31 -0
  171. package/dist/preview-adapters/AudioPreviewAdapter.js.map +1 -0
  172. package/dist/preview-adapters/CsvPreviewAdapter.d.ts +8 -0
  173. package/dist/preview-adapters/CsvPreviewAdapter.js +28 -0
  174. package/dist/preview-adapters/CsvPreviewAdapter.js.map +1 -0
  175. package/dist/preview-adapters/DocxPreviewAdapter.d.ts +8 -0
  176. package/dist/preview-adapters/DocxPreviewAdapter.js +16 -0
  177. package/dist/preview-adapters/DocxPreviewAdapter.js.map +1 -0
  178. package/dist/preview-adapters/EpubPreviewAdapter.d.ts +8 -0
  179. package/dist/preview-adapters/EpubPreviewAdapter.js +28 -0
  180. package/dist/preview-adapters/EpubPreviewAdapter.js.map +1 -0
  181. package/dist/preview-adapters/HtmlPreviewAdapter.d.ts +8 -0
  182. package/dist/preview-adapters/HtmlPreviewAdapter.js +28 -0
  183. package/dist/preview-adapters/HtmlPreviewAdapter.js.map +1 -0
  184. package/dist/preview-adapters/ImagePreviewAdapter.d.ts +8 -0
  185. package/dist/preview-adapters/ImagePreviewAdapter.js +31 -0
  186. package/dist/preview-adapters/ImagePreviewAdapter.js.map +1 -0
  187. package/dist/preview-adapters/MarkdownPreviewAdapter.d.ts +8 -0
  188. package/dist/preview-adapters/MarkdownPreviewAdapter.js +28 -0
  189. package/dist/preview-adapters/MarkdownPreviewAdapter.js.map +1 -0
  190. package/dist/preview-adapters/PdfPreviewAdapter.d.ts +8 -0
  191. package/dist/preview-adapters/PdfPreviewAdapter.js +16 -0
  192. package/dist/preview-adapters/PdfPreviewAdapter.js.map +1 -0
  193. package/dist/preview-adapters/PptxPreviewAdapter.d.ts +8 -0
  194. package/dist/preview-adapters/PptxPreviewAdapter.js +16 -0
  195. package/dist/preview-adapters/PptxPreviewAdapter.js.map +1 -0
  196. package/dist/preview-adapters/RtfPreviewAdapter.d.ts +8 -0
  197. package/dist/preview-adapters/RtfPreviewAdapter.js +54 -0
  198. package/dist/preview-adapters/RtfPreviewAdapter.js.map +1 -0
  199. package/dist/preview-adapters/SourceCodePreviewAdapter.d.ts +8 -0
  200. package/dist/preview-adapters/SourceCodePreviewAdapter.js +35 -0
  201. package/dist/preview-adapters/SourceCodePreviewAdapter.js.map +1 -0
  202. package/dist/preview-adapters/SvgPreviewAdapter.d.ts +8 -0
  203. package/dist/preview-adapters/SvgPreviewAdapter.js +28 -0
  204. package/dist/preview-adapters/SvgPreviewAdapter.js.map +1 -0
  205. package/dist/preview-adapters/TextPreviewAdapter.d.ts +8 -0
  206. package/dist/preview-adapters/TextPreviewAdapter.js +28 -0
  207. package/dist/preview-adapters/TextPreviewAdapter.js.map +1 -0
  208. package/dist/preview-adapters/UnsupportedPluginPreview.d.ts +11 -0
  209. package/dist/preview-adapters/UnsupportedPluginPreview.js +34 -0
  210. package/dist/preview-adapters/UnsupportedPluginPreview.js.map +1 -0
  211. package/dist/preview-adapters/VideoPreviewAdapter.d.ts +8 -0
  212. package/dist/preview-adapters/VideoPreviewAdapter.js +31 -0
  213. package/dist/preview-adapters/VideoPreviewAdapter.js.map +1 -0
  214. package/dist/preview-adapters/XlsxPreviewAdapter.d.ts +8 -0
  215. package/dist/preview-adapters/XlsxPreviewAdapter.js +17 -0
  216. package/dist/preview-adapters/XlsxPreviewAdapter.js.map +1 -0
  217. package/dist/preview-adapters/ZipPreviewAdapter.d.ts +8 -0
  218. package/dist/preview-adapters/ZipPreviewAdapter.js +28 -0
  219. package/dist/preview-adapters/ZipPreviewAdapter.js.map +1 -0
  220. package/dist/remote-url.d.ts +20 -0
  221. package/dist/remote-url.js +478 -0
  222. package/dist/remote-url.js.map +1 -0
  223. package/dist/rtf/load-rtfjs.d.ts +42 -0
  224. package/dist/rtf/load-rtfjs.js +71 -0
  225. package/dist/rtf/load-rtfjs.js.map +1 -0
  226. package/dist/rtf/normalize-codepage.d.ts +33 -0
  227. package/dist/rtf/normalize-codepage.js +88 -0
  228. package/dist/rtf/normalize-codepage.js.map +1 -0
  229. package/dist/shiki.d.ts +35 -0
  230. package/dist/shiki.js +128 -0
  231. package/dist/shiki.js.map +1 -0
  232. package/dist/styles/AudioPreview.css +35 -0
  233. package/dist/styles/CsvPreview.css +106 -0
  234. package/dist/styles/DocxPreview.css +93 -0
  235. package/dist/styles/EpubPreview.css +509 -0
  236. package/dist/styles/HtmlPreview.css +15 -0
  237. package/dist/styles/ImagePreview.css +45 -0
  238. package/dist/styles/LargeFileGate.css +55 -0
  239. package/dist/styles/MarkdownPreview.css +291 -0
  240. package/dist/styles/PdfPreview.css +68 -0
  241. package/dist/styles/PlainTextLargePreview.css +85 -0
  242. package/dist/styles/PluginDebugBar.css +30 -0
  243. package/dist/styles/PptxPreview.css +207 -0
  244. package/dist/styles/PreviewFallback.css +88 -0
  245. package/dist/styles/PreviewLoading.css +13 -0
  246. package/dist/styles/RtfPreview.css +99 -0
  247. package/dist/styles/ShikiSourceView.css +159 -0
  248. package/dist/styles/SvgPreview.css +99 -0
  249. package/dist/styles/VideoPreview.css +19 -0
  250. package/dist/styles/ViewModeBar.css +38 -0
  251. package/dist/styles/XlsxPreview.css +361 -0
  252. package/dist/styles/ZipPreview.css +86 -0
  253. package/dist/styles/base.css +238 -0
  254. package/dist/styles/index.css +39 -0
  255. package/dist/support-status.d.ts +19 -0
  256. package/dist/support-status.js +174 -0
  257. package/dist/support-status.js.map +1 -0
  258. package/dist/utils.d.ts +17 -0
  259. package/dist/utils.js +205 -0
  260. package/dist/utils.js.map +1 -0
  261. package/package.json +125 -0
  262. package/scripts/copy-pdf-worker.mjs +31 -0
  263. package/scripts/copy-rtfjs-bundles.mjs +49 -0
package/dist/index.js ADDED
@@ -0,0 +1,147 @@
1
+ import {
2
+ PluginPreviewRenderer
3
+ } from "./PluginPreviewRenderer";
4
+ import { ALL_FILE_TYPES } from "./core/types";
5
+ import {
6
+ PreviewPluginRegistry,
7
+ createPreviewPluginRegistry
8
+ } from "./core/registry";
9
+ import {
10
+ readSourceAsArrayBuffer,
11
+ readSourceAsText,
12
+ readSourceAsBase64,
13
+ createObjectUrlFromSource,
14
+ getSourceName,
15
+ getSourceMimeType,
16
+ getSourceSize
17
+ } from "./core/source";
18
+ import {
19
+ readBinaryPreviewAsArrayBuffer,
20
+ readBinaryPreviewAsUint8Array
21
+ } from "./core/binary";
22
+ import { downloadSource } from "./core/download";
23
+ import {
24
+ setAssetBasePath,
25
+ getAssetBasePath,
26
+ resolveAssetPath
27
+ } from "./core/config";
28
+ import {
29
+ zhCN,
30
+ enUS,
31
+ LocaleProvider,
32
+ useLocale,
33
+ getDefaultLocale
34
+ } from "./core/i18n";
35
+ import { detectFileType } from "./utils";
36
+ import {
37
+ PREVIEW_SUPPORT_MATRIX,
38
+ getPreviewSupportMeta,
39
+ isPluginSupportedFileType,
40
+ isUnsupportedFileType,
41
+ isDegradedFileType
42
+ } from "./support-status";
43
+ import {
44
+ PREVIEW_SIZE_LIMITS,
45
+ getPreviewSizeLevel,
46
+ getPreviewSizePolicy
47
+ } from "./performance-limits";
48
+ import {
49
+ XLSX_PREVIEW_LIMITS,
50
+ FILE_PREVIEW_LIMITS,
51
+ shouldHighlight,
52
+ truncateContent
53
+ } from "./limits";
54
+ import { LargeFileGate } from "./LargeFileGate";
55
+ import {
56
+ builtinPreviewPlugins,
57
+ createBuiltinPreviewRegistry
58
+ } from "./plugins/builtin-plugins";
59
+ import { audioPlugin } from "./plugins/audio-plugin";
60
+ import { csvPlugin } from "./plugins/csv-plugin";
61
+ import { docxPlugin } from "./plugins/docx-plugin";
62
+ import { epubPlugin } from "./plugins/epub-plugin";
63
+ import { htmlPlugin } from "./plugins/html-plugin";
64
+ import { imagePlugin } from "./plugins/image-plugin";
65
+ import { markdownPlugin } from "./plugins/markdown-plugin";
66
+ import { pdfPlugin } from "./plugins/pdf-plugin";
67
+ import { pptxPlugin } from "./plugins/pptx-plugin";
68
+ import { rtfPlugin } from "./plugins/rtf-plugin";
69
+ import { sourceCodePlugin } from "./plugins/source-code-plugin";
70
+ import { svgPlugin } from "./plugins/svg-plugin";
71
+ import { textPlugin } from "./plugins/text-plugin";
72
+ import { videoPlugin } from "./plugins/video-plugin";
73
+ import { xlsxPlugin } from "./plugins/xlsx-plugin";
74
+ import { zipPlugin } from "./plugins/zip-plugin";
75
+ import {
76
+ processRemoteUrl,
77
+ RemoteUrlError
78
+ } from "./remote-url";
79
+ import {
80
+ useSourceText
81
+ } from "./hooks/useSourceText";
82
+ import {
83
+ useSourceBase64
84
+ } from "./hooks/useSourceBase64";
85
+ import { useObjectUrlFromSource } from "./hooks/useObjectUrlFromSource";
86
+ export {
87
+ ALL_FILE_TYPES,
88
+ FILE_PREVIEW_LIMITS,
89
+ LargeFileGate,
90
+ LocaleProvider,
91
+ PREVIEW_SIZE_LIMITS,
92
+ PREVIEW_SUPPORT_MATRIX,
93
+ PluginPreviewRenderer,
94
+ PreviewPluginRegistry,
95
+ RemoteUrlError,
96
+ XLSX_PREVIEW_LIMITS,
97
+ audioPlugin,
98
+ builtinPreviewPlugins,
99
+ createBuiltinPreviewRegistry,
100
+ createObjectUrlFromSource,
101
+ createPreviewPluginRegistry,
102
+ csvPlugin,
103
+ detectFileType,
104
+ docxPlugin,
105
+ downloadSource,
106
+ enUS,
107
+ epubPlugin,
108
+ getAssetBasePath,
109
+ getDefaultLocale,
110
+ getPreviewSizeLevel,
111
+ getPreviewSizePolicy,
112
+ getPreviewSupportMeta,
113
+ getSourceMimeType,
114
+ getSourceName,
115
+ getSourceSize,
116
+ htmlPlugin,
117
+ imagePlugin,
118
+ isDegradedFileType,
119
+ isPluginSupportedFileType,
120
+ isUnsupportedFileType,
121
+ markdownPlugin,
122
+ pdfPlugin,
123
+ pptxPlugin,
124
+ processRemoteUrl,
125
+ readBinaryPreviewAsArrayBuffer,
126
+ readBinaryPreviewAsUint8Array,
127
+ readSourceAsArrayBuffer,
128
+ readSourceAsBase64,
129
+ readSourceAsText,
130
+ resolveAssetPath,
131
+ rtfPlugin,
132
+ setAssetBasePath,
133
+ shouldHighlight,
134
+ sourceCodePlugin,
135
+ svgPlugin,
136
+ textPlugin,
137
+ truncateContent,
138
+ useLocale,
139
+ useObjectUrlFromSource,
140
+ useSourceBase64,
141
+ useSourceText,
142
+ videoPlugin,
143
+ xlsxPlugin,
144
+ zhCN,
145
+ zipPlugin
146
+ };
147
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @lamberl-lee/file-preview — public API\n *\n * Quick start:\n *\n * import { PluginPreviewRenderer, setAssetBasePath } from \"@lamberl-lee/file-preview\";\n * import \"@lamberl-lee/file-preview/styles/index.css\";\n *\n * setAssetBasePath(\"/static\"); // where you serve PDF.js worker + RTF.js bundles\n * <PluginPreviewRenderer file={fileInfo} />\n */\n\n// ─── Top-level renderer ───────────────────────────────────────────────────\nexport {\n PluginPreviewRenderer,\n type PluginPreviewRendererProps,\n} from \"./PluginPreviewRenderer\";\n\n// ─── Core abstractions ────────────────────────────────────────────────────\nexport type {\n PreviewSource,\n NormalizedFile,\n FileType,\n FileInfo,\n} from \"./core/types\";\nexport { ALL_FILE_TYPES } from \"./core/types\";\nexport type { PreviewPlugin } from \"./core/plugin\";\nexport {\n PreviewPluginRegistry,\n createPreviewPluginRegistry,\n} from \"./core/registry\";\n\n// Source utilities — read PreviewSource as text / ArrayBuffer / base64 / object URL.\nexport {\n readSourceAsArrayBuffer,\n readSourceAsText,\n readSourceAsBase64,\n createObjectUrlFromSource,\n getSourceName,\n getSourceMimeType,\n getSourceSize,\n type ReadSourceOptions,\n} from \"./core/source\";\nexport {\n readBinaryPreviewAsArrayBuffer,\n readBinaryPreviewAsUint8Array,\n type BinaryPreviewInput,\n} from \"./core/binary\";\nexport { downloadSource } from \"./core/download\";\n\n// Runtime configuration — base path for static assets (PDF.js worker, RTF.js bundles).\nexport {\n setAssetBasePath,\n getAssetBasePath,\n resolveAssetPath,\n} from \"./core/config\";\n\n// Internationalization — locale messages + provider hook.\nexport {\n zhCN,\n enUS,\n LocaleProvider,\n useLocale,\n getDefaultLocale,\n type LocaleMessages,\n} from \"./core/i18n\";\n\n// ─── File detection ───────────────────────────────────────────────────────\nexport { detectFileType } from \"./utils\";\n\n// Support matrix — which renderers cover which file types.\nexport {\n PREVIEW_SUPPORT_MATRIX,\n getPreviewSupportMeta,\n isPluginSupportedFileType,\n isUnsupportedFileType,\n isDegradedFileType,\n type PreviewSupportStatus,\n type PreviewSupportMeta,\n type RendererSupportState,\n} from \"./support-status\";\n\n// ─── Performance / size limits ────────────────────────────────────────────\nexport {\n PREVIEW_SIZE_LIMITS,\n getPreviewSizeLevel,\n getPreviewSizePolicy,\n type PreviewSizeLevel,\n type PreviewSizePolicy,\n} from \"./performance-limits\";\nexport {\n XLSX_PREVIEW_LIMITS,\n FILE_PREVIEW_LIMITS,\n shouldHighlight,\n truncateContent,\n} from \"./limits\";\nexport { LargeFileGate } from \"./LargeFileGate\";\n\n// ─── Built-in plugins (full registry) ─────────────────────────────────────\nexport {\n builtinPreviewPlugins,\n createBuiltinPreviewRegistry,\n} from \"./plugins/builtin-plugins\";\n\n// Individual plugins — for custom registries that drop or replace formats.\nexport { audioPlugin } from \"./plugins/audio-plugin\";\nexport { csvPlugin } from \"./plugins/csv-plugin\";\nexport { docxPlugin } from \"./plugins/docx-plugin\";\nexport { epubPlugin } from \"./plugins/epub-plugin\";\nexport { htmlPlugin } from \"./plugins/html-plugin\";\nexport { imagePlugin } from \"./plugins/image-plugin\";\nexport { markdownPlugin } from \"./plugins/markdown-plugin\";\nexport { pdfPlugin } from \"./plugins/pdf-plugin\";\nexport { pptxPlugin } from \"./plugins/pptx-plugin\";\nexport { rtfPlugin } from \"./plugins/rtf-plugin\";\nexport { sourceCodePlugin } from \"./plugins/source-code-plugin\";\nexport { svgPlugin } from \"./plugins/svg-plugin\";\nexport { textPlugin } from \"./plugins/text-plugin\";\nexport { videoPlugin } from \"./plugins/video-plugin\";\nexport { xlsxPlugin } from \"./plugins/xlsx-plugin\";\nexport { zipPlugin } from \"./plugins/zip-plugin\";\n\n// ─── Remote URL loader ────────────────────────────────────────────────────\nexport {\n processRemoteUrl,\n RemoteUrlError,\n type RemoteUrlErrorCode,\n type RemoteLoadProgress,\n type ProcessRemoteUrlOptions,\n} from \"./remote-url\";\n\n// ─── React hooks ──────────────────────────────────────────────────────────\nexport {\n useSourceText,\n type SourceTextState,\n} from \"./hooks/useSourceText\";\nexport {\n useSourceBase64,\n type SourceBase64State,\n} from \"./hooks/useSourceBase64\";\nexport { useObjectUrlFromSource } from \"./hooks/useObjectUrlFromSource\";\n"],"mappings":"AAaA;AAAA,EACE;AAAA,OAEK;AASP,SAAS,sBAAsB;AAE/B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP,SAAS,sBAAsB;AAG/B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAGP,SAAS,sBAAsB;AAG/B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,qBAAqB;AAG9B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAGP,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAC1B,SAAS,wBAAwB;AACjC,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAG1B;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AAGP;AAAA,EACE;AAAA,OAEK;AACP;AAAA,EACE;AAAA,OAEK;AACP,SAAS,8BAA8B;","names":[]}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * File preview size/line limits and related helpers.
3
+ * Prevents Shiki from hanging or crashing on very large files.
4
+ */
5
+ declare const XLSX_PREVIEW_LIMITS: {
6
+ /** Fast mode renders at most this many rows */
7
+ readonly FAST_MODE_ROW_LIMIT: 1000;
8
+ /** Files larger than this default to fast mode */
9
+ readonly LARGE_FILE_SIZE: number;
10
+ /** Files larger than this are not recommended for fidelity mode */
11
+ readonly MAX_FIDELITY_FILE_SIZE: number;
12
+ };
13
+ declare const FILE_PREVIEW_LIMITS: {
14
+ /** Skip Shiki highlighting above this byte size */
15
+ readonly SHIKI_MAX_FILE_SIZE: number;
16
+ /** Skip Shiki highlighting above this line count */
17
+ readonly SHIKI_MAX_LINES: 5000;
18
+ /** Skip code-block highlighting inside Markdown above this byte size */
19
+ readonly SHIKI_MAX_CODE_BLOCK_SIZE: number;
20
+ /** Truncate display content to this size for plain-text fallback */
21
+ readonly MAX_DISPLAY_SIZE: number;
22
+ };
23
+ declare function shouldHighlight(content: string): boolean;
24
+ declare function truncateContent(content: string, maxSize?: number): string;
25
+
26
+ export { FILE_PREVIEW_LIMITS, XLSX_PREVIEW_LIMITS, shouldHighlight, truncateContent };
package/dist/limits.js ADDED
@@ -0,0 +1,45 @@
1
+ const XLSX_PREVIEW_LIMITS = {
2
+ /** Fast mode renders at most this many rows */
3
+ FAST_MODE_ROW_LIMIT: 1e3,
4
+ /** Files larger than this default to fast mode */
5
+ LARGE_FILE_SIZE: 10 * 1024 * 1024,
6
+ // 10 MB
7
+ /** Files larger than this are not recommended for fidelity mode */
8
+ MAX_FIDELITY_FILE_SIZE: 30 * 1024 * 1024
9
+ // 30 MB
10
+ };
11
+ const FILE_PREVIEW_LIMITS = {
12
+ /** Skip Shiki highlighting above this byte size */
13
+ SHIKI_MAX_FILE_SIZE: 500 * 1024,
14
+ // 500 KB
15
+ /** Skip Shiki highlighting above this line count */
16
+ SHIKI_MAX_LINES: 5e3,
17
+ /** Skip code-block highlighting inside Markdown above this byte size */
18
+ SHIKI_MAX_CODE_BLOCK_SIZE: 50 * 1024,
19
+ // 50 KB
20
+ /** Truncate display content to this size for plain-text fallback */
21
+ MAX_DISPLAY_SIZE: 2 * 1024 * 1024
22
+ // 2 MB
23
+ };
24
+ function shouldHighlight(content) {
25
+ if (content.length > FILE_PREVIEW_LIMITS.SHIKI_MAX_FILE_SIZE) return false;
26
+ const lines = content.split("\n").length;
27
+ if (lines > FILE_PREVIEW_LIMITS.SHIKI_MAX_LINES) return false;
28
+ return true;
29
+ }
30
+ function truncateContent(content, maxSize = FILE_PREVIEW_LIMITS.MAX_DISPLAY_SIZE) {
31
+ if (content.length <= maxSize) return content;
32
+ return content.slice(0, maxSize) + "\n\n... [\u5185\u5BB9\u5DF2\u622A\u65AD\uFF0C\u4EC5\u663E\u793A\u524D " + formatFileSizeForTruncation(maxSize) + "]";
33
+ }
34
+ function formatFileSizeForTruncation(bytes) {
35
+ if (bytes < 1024) return `${bytes} B`;
36
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
37
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
38
+ }
39
+ export {
40
+ FILE_PREVIEW_LIMITS,
41
+ XLSX_PREVIEW_LIMITS,
42
+ shouldHighlight,
43
+ truncateContent
44
+ };
45
+ //# sourceMappingURL=limits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/limits.ts"],"sourcesContent":["/**\n * File preview size/line limits and related helpers.\n * Prevents Shiki from hanging or crashing on very large files.\n */\n\nexport const XLSX_PREVIEW_LIMITS = {\n /** Fast mode renders at most this many rows */\n FAST_MODE_ROW_LIMIT: 1000,\n /** Files larger than this default to fast mode */\n LARGE_FILE_SIZE: 10 * 1024 * 1024, // 10 MB\n /** Files larger than this are not recommended for fidelity mode */\n MAX_FIDELITY_FILE_SIZE: 30 * 1024 * 1024, // 30 MB\n} as const;\n\nexport const FILE_PREVIEW_LIMITS = {\n /** Skip Shiki highlighting above this byte size */\n SHIKI_MAX_FILE_SIZE: 500 * 1024, // 500 KB\n /** Skip Shiki highlighting above this line count */\n SHIKI_MAX_LINES: 5000,\n /** Skip code-block highlighting inside Markdown above this byte size */\n SHIKI_MAX_CODE_BLOCK_SIZE: 50 * 1024, // 50 KB\n /** Truncate display content to this size for plain-text fallback */\n MAX_DISPLAY_SIZE: 2 * 1024 * 1024, // 2 MB\n} as const;\n\nexport function shouldHighlight(content: string): boolean {\n if (content.length > FILE_PREVIEW_LIMITS.SHIKI_MAX_FILE_SIZE) return false;\n const lines = content.split(\"\\n\").length;\n if (lines > FILE_PREVIEW_LIMITS.SHIKI_MAX_LINES) return false;\n return true;\n}\n\nexport function truncateContent(content: string, maxSize: number = FILE_PREVIEW_LIMITS.MAX_DISPLAY_SIZE): string {\n if (content.length <= maxSize) return content;\n return content.slice(0, maxSize) + \"\\n\\n... [内容已截断,仅显示前 \" + formatFileSizeForTruncation(maxSize) + \"]\";\n}\n\n// Private helper for truncateContent message (avoids circular dependency on utils.ts).\n// Uses a simpler format; the public version in utils.ts is the canonical one for UI.\nfunction formatFileSizeForTruncation(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n"],"mappings":"AAKO,MAAM,sBAAsB;AAAA;AAAA,EAEjC,qBAAqB;AAAA;AAAA,EAErB,iBAAiB,KAAK,OAAO;AAAA;AAAA;AAAA,EAE7B,wBAAwB,KAAK,OAAO;AAAA;AACtC;AAEO,MAAM,sBAAsB;AAAA;AAAA,EAEjC,qBAAqB,MAAM;AAAA;AAAA;AAAA,EAE3B,iBAAiB;AAAA;AAAA,EAEjB,2BAA2B,KAAK;AAAA;AAAA;AAAA,EAEhC,kBAAkB,IAAI,OAAO;AAAA;AAC/B;AAEO,SAAS,gBAAgB,SAA0B;AACxD,MAAI,QAAQ,SAAS,oBAAoB,oBAAqB,QAAO;AACrE,QAAM,QAAQ,QAAQ,MAAM,IAAI,EAAE;AAClC,MAAI,QAAQ,oBAAoB,gBAAiB,QAAO;AACxD,SAAO;AACT;AAEO,SAAS,gBAAgB,SAAiB,UAAkB,oBAAoB,kBAA0B;AAC/G,MAAI,QAAQ,UAAU,QAAS,QAAO;AACtC,SAAO,QAAQ,MAAM,GAAG,OAAO,IAAI,2EAAyB,4BAA4B,OAAO,IAAI;AACrG;AAIA,SAAS,4BAA4B,OAAuB;AAC1D,MAAI,QAAQ,KAAM,QAAO,GAAG,KAAK;AACjC,MAAI,QAAQ,OAAO,KAAM,QAAO,IAAI,QAAQ,MAAM,QAAQ,CAAC,CAAC;AAC5D,SAAO,IAAI,SAAS,OAAO,OAAO,QAAQ,CAAC,CAAC;AAC9C;","names":[]}
@@ -0,0 +1,27 @@
1
+ import { FileType } from './core/types.js';
2
+
3
+ /**
4
+ * Unified preview size policy for large files.
5
+ * Defines thresholds for warning, confirmation, and blocking previews.
6
+ */
7
+
8
+ declare const PREVIEW_SIZE_LIMITS: {
9
+ readonly warning: number;
10
+ readonly confirm: number;
11
+ readonly block: number;
12
+ };
13
+ type PreviewSizeLevel = "normal" | "warning" | "confirm" | "block";
14
+ interface PreviewSizePolicy {
15
+ level: PreviewSizeLevel;
16
+ shouldWarn: boolean;
17
+ shouldConfirm: boolean;
18
+ shouldBlock: boolean;
19
+ message: string | null;
20
+ }
21
+ declare function getPreviewSizeLevel(size: number): PreviewSizeLevel;
22
+ declare function getPreviewSizePolicy(input: {
23
+ size: number;
24
+ fileType?: FileType;
25
+ }): PreviewSizePolicy;
26
+
27
+ export { PREVIEW_SIZE_LIMITS, type PreviewSizeLevel, type PreviewSizePolicy, getPreviewSizeLevel, getPreviewSizePolicy };
@@ -0,0 +1,54 @@
1
+ const PREVIEW_SIZE_LIMITS = {
2
+ warning: 20 * 1024 * 1024,
3
+ confirm: 50 * 1024 * 1024,
4
+ block: 100 * 1024 * 1024
5
+ };
6
+ function getPreviewSizeLevel(size) {
7
+ if (size >= PREVIEW_SIZE_LIMITS.block) return "block";
8
+ if (size >= PREVIEW_SIZE_LIMITS.confirm) return "confirm";
9
+ if (size >= PREVIEW_SIZE_LIMITS.warning) return "warning";
10
+ return "normal";
11
+ }
12
+ function getPreviewSizePolicy(input) {
13
+ const level = getPreviewSizeLevel(input.size);
14
+ if (level === "block") {
15
+ return {
16
+ level,
17
+ shouldWarn: true,
18
+ shouldConfirm: false,
19
+ shouldBlock: true,
20
+ message: "This file is very large and may freeze the browser. Browser-side preview is disabled by default."
21
+ };
22
+ }
23
+ if (level === "confirm") {
24
+ return {
25
+ level,
26
+ shouldWarn: true,
27
+ shouldConfirm: true,
28
+ shouldBlock: false,
29
+ message: "This file is large and may take time to preview. Continue only if you trust the file and your browser has enough memory."
30
+ };
31
+ }
32
+ if (level === "warning") {
33
+ return {
34
+ level,
35
+ shouldWarn: true,
36
+ shouldConfirm: false,
37
+ shouldBlock: false,
38
+ message: "This file is relatively large. Preview may be slower depending on your browser and device."
39
+ };
40
+ }
41
+ return {
42
+ level,
43
+ shouldWarn: false,
44
+ shouldConfirm: false,
45
+ shouldBlock: false,
46
+ message: null
47
+ };
48
+ }
49
+ export {
50
+ PREVIEW_SIZE_LIMITS,
51
+ getPreviewSizeLevel,
52
+ getPreviewSizePolicy
53
+ };
54
+ //# sourceMappingURL=performance-limits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/performance-limits.ts"],"sourcesContent":["/**\n * Unified preview size policy for large files.\n * Defines thresholds for warning, confirmation, and blocking previews.\n */\n\nimport type { FileType } from \"./utils\";\n\nexport const PREVIEW_SIZE_LIMITS = {\n warning: 20 * 1024 * 1024,\n confirm: 50 * 1024 * 1024,\n block: 100 * 1024 * 1024,\n} as const;\n\nexport type PreviewSizeLevel = \"normal\" | \"warning\" | \"confirm\" | \"block\";\n\nexport interface PreviewSizePolicy {\n level: PreviewSizeLevel;\n shouldWarn: boolean;\n shouldConfirm: boolean;\n shouldBlock: boolean;\n message: string | null;\n}\n\nexport function getPreviewSizeLevel(size: number): PreviewSizeLevel {\n if (size >= PREVIEW_SIZE_LIMITS.block) return \"block\";\n if (size >= PREVIEW_SIZE_LIMITS.confirm) return \"confirm\";\n if (size >= PREVIEW_SIZE_LIMITS.warning) return \"warning\";\n return \"normal\";\n}\n\nexport function getPreviewSizePolicy(input: {\n size: number;\n fileType?: FileType;\n}): PreviewSizePolicy {\n const level = getPreviewSizeLevel(input.size);\n\n if (level === \"block\") {\n return {\n level,\n shouldWarn: true,\n shouldConfirm: false,\n shouldBlock: true,\n message:\n \"This file is very large and may freeze the browser. Browser-side preview is disabled by default.\",\n };\n }\n\n if (level === \"confirm\") {\n return {\n level,\n shouldWarn: true,\n shouldConfirm: true,\n shouldBlock: false,\n message:\n \"This file is large and may take time to preview. Continue only if you trust the file and your browser has enough memory.\",\n };\n }\n\n if (level === \"warning\") {\n return {\n level,\n shouldWarn: true,\n shouldConfirm: false,\n shouldBlock: false,\n message:\n \"This file is relatively large. Preview may be slower depending on your browser and device.\",\n };\n }\n\n return {\n level,\n shouldWarn: false,\n shouldConfirm: false,\n shouldBlock: false,\n message: null,\n };\n}\n"],"mappings":"AAOO,MAAM,sBAAsB;AAAA,EACjC,SAAS,KAAK,OAAO;AAAA,EACrB,SAAS,KAAK,OAAO;AAAA,EACrB,OAAO,MAAM,OAAO;AACtB;AAYO,SAAS,oBAAoB,MAAgC;AAClE,MAAI,QAAQ,oBAAoB,MAAO,QAAO;AAC9C,MAAI,QAAQ,oBAAoB,QAAS,QAAO;AAChD,MAAI,QAAQ,oBAAoB,QAAS,QAAO;AAChD,SAAO;AACT;AAEO,SAAS,qBAAqB,OAGf;AACpB,QAAM,QAAQ,oBAAoB,MAAM,IAAI;AAE5C,MAAI,UAAU,SAAS;AACrB,WAAO;AAAA,MACL;AAAA,MACA,YAAY;AAAA,MACZ,eAAe;AAAA,MACf,aAAa;AAAA,MACb,SACE;AAAA,IACJ;AAAA,EACF;AAEA,MAAI,UAAU,WAAW;AACvB,WAAO;AAAA,MACL;AAAA,MACA,YAAY;AAAA,MACZ,eAAe;AAAA,MACf,aAAa;AAAA,MACb,SACE;AAAA,IACJ;AAAA,EACF;AAEA,MAAI,UAAU,WAAW;AACvB,WAAO;AAAA,MACL;AAAA,MACA,YAAY;AAAA,MACZ,eAAe;AAAA,MACf,aAAa;AAAA,MACb,SACE;AAAA,IACJ;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,eAAe;AAAA,IACf,aAAa;AAAA,IACb,SAAS;AAAA,EACX;AACF;","names":[]}
@@ -0,0 +1,7 @@
1
+ import { PreviewPlugin } from '../core/plugin.js';
2
+ import 'react';
3
+ import '../core/types.js';
4
+
5
+ declare const audioPlugin: PreviewPlugin;
6
+
7
+ export { audioPlugin };
@@ -0,0 +1,11 @@
1
+ const audioPlugin = {
2
+ id: "builtin.audio",
3
+ name: "Audio Preview",
4
+ priority: 100,
5
+ match: (file) => file.fileType === "audio",
6
+ load: () => import("../preview-adapters/AudioPreviewAdapter")
7
+ };
8
+ export {
9
+ audioPlugin
10
+ };
11
+ //# sourceMappingURL=audio-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/plugins/audio-plugin.ts"],"sourcesContent":["import type { PreviewPlugin } from \"../core/plugin\";\n\nexport const audioPlugin: PreviewPlugin = {\n id: \"builtin.audio\",\n name: \"Audio Preview\",\n priority: 100,\n match: (file) => file.fileType === \"audio\",\n load: () => import(\"../preview-adapters/AudioPreviewAdapter\"),\n};"],"mappings":"AAEO,MAAM,cAA6B;AAAA,EACxC,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,UAAU;AAAA,EACV,OAAO,CAAC,SAAS,KAAK,aAAa;AAAA,EACnC,MAAM,MAAM,OAAO,yCAAyC;AAC9D;","names":[]}
@@ -0,0 +1,9 @@
1
+ import { PreviewPluginRegistry } from '../core/registry.js';
2
+ import { PreviewPlugin } from '../core/plugin.js';
3
+ import '../core/types.js';
4
+ import 'react';
5
+
6
+ declare const builtinPreviewPlugins: PreviewPlugin[];
7
+ declare function createBuiltinPreviewRegistry(): PreviewPluginRegistry;
8
+
9
+ export { builtinPreviewPlugins, createBuiltinPreviewRegistry };
@@ -0,0 +1,43 @@
1
+ import { createPreviewPluginRegistry } from "../core/registry";
2
+ import { imagePlugin } from "./image-plugin";
3
+ import { pdfPlugin } from "./pdf-plugin";
4
+ import { sourceCodePlugin } from "./source-code-plugin";
5
+ import { textPlugin } from "./text-plugin";
6
+ import { audioPlugin } from "./audio-plugin";
7
+ import { videoPlugin } from "./video-plugin";
8
+ import { svgPlugin } from "./svg-plugin";
9
+ import { csvPlugin } from "./csv-plugin";
10
+ import { markdownPlugin } from "./markdown-plugin";
11
+ import { htmlPlugin } from "./html-plugin";
12
+ import { rtfPlugin } from "./rtf-plugin";
13
+ import { zipPlugin } from "./zip-plugin";
14
+ import { epubPlugin } from "./epub-plugin";
15
+ import { docxPlugin } from "./docx-plugin";
16
+ import { pptxPlugin } from "./pptx-plugin";
17
+ import { xlsxPlugin } from "./xlsx-plugin";
18
+ const builtinPreviewPlugins = [
19
+ pdfPlugin,
20
+ sourceCodePlugin,
21
+ textPlugin,
22
+ imagePlugin,
23
+ audioPlugin,
24
+ videoPlugin,
25
+ svgPlugin,
26
+ csvPlugin,
27
+ markdownPlugin,
28
+ htmlPlugin,
29
+ rtfPlugin,
30
+ zipPlugin,
31
+ epubPlugin,
32
+ docxPlugin,
33
+ pptxPlugin,
34
+ xlsxPlugin
35
+ ];
36
+ function createBuiltinPreviewRegistry() {
37
+ return createPreviewPluginRegistry(builtinPreviewPlugins);
38
+ }
39
+ export {
40
+ builtinPreviewPlugins,
41
+ createBuiltinPreviewRegistry
42
+ };
43
+ //# sourceMappingURL=builtin-plugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/plugins/builtin-plugins.ts"],"sourcesContent":["import { createPreviewPluginRegistry, type PreviewPluginRegistry } from \"../core/registry\";\nimport type { PreviewPlugin } from \"../core/plugin\";\nimport { imagePlugin } from \"./image-plugin\";\nimport { pdfPlugin } from \"./pdf-plugin\";\nimport { sourceCodePlugin } from \"./source-code-plugin\";\nimport { textPlugin } from \"./text-plugin\";\nimport { audioPlugin } from \"./audio-plugin\";\nimport { videoPlugin } from \"./video-plugin\";\nimport { svgPlugin } from \"./svg-plugin\";\nimport { csvPlugin } from \"./csv-plugin\";\nimport { markdownPlugin } from \"./markdown-plugin\";\nimport { htmlPlugin } from \"./html-plugin\";\nimport { rtfPlugin } from \"./rtf-plugin\";\nimport { zipPlugin } from \"./zip-plugin\";\nimport { epubPlugin } from \"./epub-plugin\";\nimport { docxPlugin } from \"./docx-plugin\";\nimport { pptxPlugin } from \"./pptx-plugin\";\nimport { xlsxPlugin } from \"./xlsx-plugin\";\n\nexport const builtinPreviewPlugins: PreviewPlugin[] = [\n pdfPlugin,\n sourceCodePlugin,\n textPlugin,\n imagePlugin,\n audioPlugin,\n videoPlugin,\n svgPlugin,\n csvPlugin,\n markdownPlugin,\n htmlPlugin,\n rtfPlugin,\n zipPlugin,\n epubPlugin,\n docxPlugin,\n pptxPlugin,\n xlsxPlugin,\n];\n\nexport function createBuiltinPreviewRegistry(): PreviewPluginRegistry {\n return createPreviewPluginRegistry(builtinPreviewPlugins);\n}"],"mappings":"AAAA,SAAS,mCAA+D;AAExE,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,wBAAwB;AACjC,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAEpB,MAAM,wBAAyC;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,SAAS,+BAAsD;AACpE,SAAO,4BAA4B,qBAAqB;AAC1D;","names":[]}
@@ -0,0 +1,7 @@
1
+ import { PreviewPlugin } from '../core/plugin.js';
2
+ import 'react';
3
+ import '../core/types.js';
4
+
5
+ declare const csvPlugin: PreviewPlugin;
6
+
7
+ export { csvPlugin };
@@ -0,0 +1,11 @@
1
+ const csvPlugin = {
2
+ id: "builtin.csv",
3
+ name: "CSV Preview",
4
+ priority: 100,
5
+ match: (file) => file.fileType === "csv",
6
+ load: () => import("../preview-adapters/CsvPreviewAdapter")
7
+ };
8
+ export {
9
+ csvPlugin
10
+ };
11
+ //# sourceMappingURL=csv-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/plugins/csv-plugin.ts"],"sourcesContent":["import type { PreviewPlugin } from \"../core/plugin\";\n\nexport const csvPlugin: PreviewPlugin = {\n id: \"builtin.csv\",\n name: \"CSV Preview\",\n priority: 100,\n match: (file) => file.fileType === \"csv\",\n load: () => import(\"../preview-adapters/CsvPreviewAdapter\"),\n};"],"mappings":"AAEO,MAAM,YAA2B;AAAA,EACtC,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,UAAU;AAAA,EACV,OAAO,CAAC,SAAS,KAAK,aAAa;AAAA,EACnC,MAAM,MAAM,OAAO,uCAAuC;AAC5D;","names":[]}
@@ -0,0 +1,7 @@
1
+ import { PreviewPlugin } from '../core/plugin.js';
2
+ import 'react';
3
+ import '../core/types.js';
4
+
5
+ declare const docxPlugin: PreviewPlugin;
6
+
7
+ export { docxPlugin };
@@ -0,0 +1,15 @@
1
+ import { loadWithOptionalDep } from "../core/plugin";
2
+ const docxPlugin = {
3
+ id: "builtin.docx",
4
+ name: "DOCX Preview",
5
+ priority: 100,
6
+ match: (file) => file.fileType === "docx",
7
+ load: loadWithOptionalDep(
8
+ () => import("../preview-adapters/DocxPreviewAdapter"),
9
+ { package: "docx-preview", featureLabel: "DOCX preview" }
10
+ )
11
+ };
12
+ export {
13
+ docxPlugin
14
+ };
15
+ //# sourceMappingURL=docx-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/plugins/docx-plugin.ts"],"sourcesContent":["import { loadWithOptionalDep, type PreviewPlugin } from \"../core/plugin\";\n\nexport const docxPlugin: PreviewPlugin = {\n id: \"builtin.docx\",\n name: \"DOCX Preview\",\n priority: 100,\n match: (file) => file.fileType === \"docx\",\n load: loadWithOptionalDep(\n () => import(\"../preview-adapters/DocxPreviewAdapter\"),\n { package: \"docx-preview\", featureLabel: \"DOCX preview\" },\n ),\n};\n"],"mappings":"AAAA,SAAS,2BAA+C;AAEjD,MAAM,aAA4B;AAAA,EACvC,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,UAAU;AAAA,EACV,OAAO,CAAC,SAAS,KAAK,aAAa;AAAA,EACnC,MAAM;AAAA,IACJ,MAAM,OAAO,wCAAwC;AAAA,IACrD,EAAE,SAAS,gBAAgB,cAAc,eAAe;AAAA,EAC1D;AACF;","names":[]}
@@ -0,0 +1,7 @@
1
+ import { PreviewPlugin } from '../core/plugin.js';
2
+ import 'react';
3
+ import '../core/types.js';
4
+
5
+ declare const epubPlugin: PreviewPlugin;
6
+
7
+ export { epubPlugin };
@@ -0,0 +1,15 @@
1
+ import { loadWithOptionalDep } from "../core/plugin";
2
+ const epubPlugin = {
3
+ id: "builtin.epub",
4
+ name: "EPUB Preview",
5
+ priority: 100,
6
+ match: (file) => file.fileType === "epub",
7
+ load: loadWithOptionalDep(
8
+ () => import("../preview-adapters/EpubPreviewAdapter"),
9
+ { package: "jszip", featureLabel: "EPUB preview" }
10
+ )
11
+ };
12
+ export {
13
+ epubPlugin
14
+ };
15
+ //# sourceMappingURL=epub-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/plugins/epub-plugin.ts"],"sourcesContent":["import { loadWithOptionalDep, type PreviewPlugin } from \"../core/plugin\";\n\nexport const epubPlugin: PreviewPlugin = {\n id: \"builtin.epub\",\n name: \"EPUB Preview\",\n priority: 100,\n match: (file) => file.fileType === \"epub\",\n load: loadWithOptionalDep(\n () => import(\"../preview-adapters/EpubPreviewAdapter\"),\n { package: \"jszip\", featureLabel: \"EPUB preview\" },\n ),\n};\n"],"mappings":"AAAA,SAAS,2BAA+C;AAEjD,MAAM,aAA4B;AAAA,EACvC,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,UAAU;AAAA,EACV,OAAO,CAAC,SAAS,KAAK,aAAa;AAAA,EACnC,MAAM;AAAA,IACJ,MAAM,OAAO,wCAAwC;AAAA,IACrD,EAAE,SAAS,SAAS,cAAc,eAAe;AAAA,EACnD;AACF;","names":[]}
@@ -0,0 +1,7 @@
1
+ import { PreviewPlugin } from '../core/plugin.js';
2
+ import 'react';
3
+ import '../core/types.js';
4
+
5
+ declare const htmlPlugin: PreviewPlugin;
6
+
7
+ export { htmlPlugin };
@@ -0,0 +1,11 @@
1
+ const htmlPlugin = {
2
+ id: "builtin.html",
3
+ name: "HTML Preview",
4
+ priority: 100,
5
+ match: (file) => file.fileType === "html",
6
+ load: () => import("../preview-adapters/HtmlPreviewAdapter")
7
+ };
8
+ export {
9
+ htmlPlugin
10
+ };
11
+ //# sourceMappingURL=html-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/plugins/html-plugin.ts"],"sourcesContent":["import type { PreviewPlugin } from \"../core/plugin\";\n\nexport const htmlPlugin: PreviewPlugin = {\n id: \"builtin.html\",\n name: \"HTML Preview\",\n priority: 100,\n match: (file) => file.fileType === \"html\",\n load: () => import(\"../preview-adapters/HtmlPreviewAdapter\"),\n};"],"mappings":"AAEO,MAAM,aAA4B;AAAA,EACvC,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,UAAU;AAAA,EACV,OAAO,CAAC,SAAS,KAAK,aAAa;AAAA,EACnC,MAAM,MAAM,OAAO,wCAAwC;AAC7D;","names":[]}
@@ -0,0 +1,7 @@
1
+ import { PreviewPlugin } from '../core/plugin.js';
2
+ import 'react';
3
+ import '../core/types.js';
4
+
5
+ declare const imagePlugin: PreviewPlugin;
6
+
7
+ export { imagePlugin };
@@ -0,0 +1,11 @@
1
+ const imagePlugin = {
2
+ id: "builtin.image",
3
+ name: "Image Preview",
4
+ priority: 100,
5
+ match: (file) => file.fileType === "image",
6
+ load: () => import("../preview-adapters/ImagePreviewAdapter")
7
+ };
8
+ export {
9
+ imagePlugin
10
+ };
11
+ //# sourceMappingURL=image-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/plugins/image-plugin.ts"],"sourcesContent":["import type { PreviewPlugin } from \"../core/plugin\";\n\nexport const imagePlugin: PreviewPlugin = {\n id: \"builtin.image\",\n name: \"Image Preview\",\n priority: 100,\n match: (file) => file.fileType === \"image\",\n load: () => import(\"../preview-adapters/ImagePreviewAdapter\"),\n};\n"],"mappings":"AAEO,MAAM,cAA6B;AAAA,EACxC,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,UAAU;AAAA,EACV,OAAO,CAAC,SAAS,KAAK,aAAa;AAAA,EACnC,MAAM,MAAM,OAAO,yCAAyC;AAC9D;","names":[]}
@@ -0,0 +1,7 @@
1
+ import { PreviewPlugin } from '../core/plugin.js';
2
+ import 'react';
3
+ import '../core/types.js';
4
+
5
+ declare const markdownPlugin: PreviewPlugin;
6
+
7
+ export { markdownPlugin };
@@ -0,0 +1,11 @@
1
+ const markdownPlugin = {
2
+ id: "builtin.markdown",
3
+ name: "Markdown Preview",
4
+ priority: 100,
5
+ match: (file) => file.fileType === "markdown",
6
+ load: () => import("../preview-adapters/MarkdownPreviewAdapter")
7
+ };
8
+ export {
9
+ markdownPlugin
10
+ };
11
+ //# sourceMappingURL=markdown-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/plugins/markdown-plugin.ts"],"sourcesContent":["import type { PreviewPlugin } from \"../core/plugin\";\n\nexport const markdownPlugin: PreviewPlugin = {\n id: \"builtin.markdown\",\n name: \"Markdown Preview\",\n priority: 100,\n match: (file) => file.fileType === \"markdown\",\n load: () => import(\"../preview-adapters/MarkdownPreviewAdapter\"),\n};"],"mappings":"AAEO,MAAM,iBAAgC;AAAA,EAC3C,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,UAAU;AAAA,EACV,OAAO,CAAC,SAAS,KAAK,aAAa;AAAA,EACnC,MAAM,MAAM,OAAO,4CAA4C;AACjE;","names":[]}
@@ -0,0 +1,7 @@
1
+ import { PreviewPlugin } from '../core/plugin.js';
2
+ import 'react';
3
+ import '../core/types.js';
4
+
5
+ declare const pdfPlugin: PreviewPlugin;
6
+
7
+ export { pdfPlugin };
@@ -0,0 +1,15 @@
1
+ import { loadWithOptionalDep } from "../core/plugin";
2
+ const pdfPlugin = {
3
+ id: "builtin.pdf",
4
+ name: "PDF Preview",
5
+ priority: 100,
6
+ match: (file) => file.fileType === "pdf",
7
+ load: loadWithOptionalDep(
8
+ () => import("../preview-adapters/PdfPreviewAdapter"),
9
+ { package: "pdfjs-dist", featureLabel: "PDF preview" }
10
+ )
11
+ };
12
+ export {
13
+ pdfPlugin
14
+ };
15
+ //# sourceMappingURL=pdf-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/plugins/pdf-plugin.ts"],"sourcesContent":["import { loadWithOptionalDep, type PreviewPlugin } from \"../core/plugin\";\n\nexport const pdfPlugin: PreviewPlugin = {\n id: \"builtin.pdf\",\n name: \"PDF Preview\",\n priority: 100,\n match: (file) => file.fileType === \"pdf\",\n load: loadWithOptionalDep(\n () => import(\"../preview-adapters/PdfPreviewAdapter\"),\n { package: \"pdfjs-dist\", featureLabel: \"PDF preview\" },\n ),\n};\n"],"mappings":"AAAA,SAAS,2BAA+C;AAEjD,MAAM,YAA2B;AAAA,EACtC,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,UAAU;AAAA,EACV,OAAO,CAAC,SAAS,KAAK,aAAa;AAAA,EACnC,MAAM;AAAA,IACJ,MAAM,OAAO,uCAAuC;AAAA,IACpD,EAAE,SAAS,cAAc,cAAc,cAAc;AAAA,EACvD;AACF;","names":[]}
@@ -0,0 +1,7 @@
1
+ import { PreviewPlugin } from '../core/plugin.js';
2
+ import 'react';
3
+ import '../core/types.js';
4
+
5
+ declare const pptxPlugin: PreviewPlugin;
6
+
7
+ export { pptxPlugin };
@@ -0,0 +1,15 @@
1
+ import { loadWithOptionalDep } from "../core/plugin";
2
+ const pptxPlugin = {
3
+ id: "builtin.pptx",
4
+ name: "PPTX Preview",
5
+ priority: 100,
6
+ match: (file) => file.fileType === "pptx",
7
+ load: loadWithOptionalDep(
8
+ () => import("../preview-adapters/PptxPreviewAdapter"),
9
+ { package: "pptx-preview", featureLabel: "PPTX preview" }
10
+ )
11
+ };
12
+ export {
13
+ pptxPlugin
14
+ };
15
+ //# sourceMappingURL=pptx-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/plugins/pptx-plugin.ts"],"sourcesContent":["import { loadWithOptionalDep, type PreviewPlugin } from \"../core/plugin\";\n\nexport const pptxPlugin: PreviewPlugin = {\n id: \"builtin.pptx\",\n name: \"PPTX Preview\",\n priority: 100,\n match: (file) => file.fileType === \"pptx\",\n load: loadWithOptionalDep(\n () => import(\"../preview-adapters/PptxPreviewAdapter\"),\n { package: \"pptx-preview\", featureLabel: \"PPTX preview\" },\n ),\n};\n"],"mappings":"AAAA,SAAS,2BAA+C;AAEjD,MAAM,aAA4B;AAAA,EACvC,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,UAAU;AAAA,EACV,OAAO,CAAC,SAAS,KAAK,aAAa;AAAA,EACnC,MAAM;AAAA,IACJ,MAAM,OAAO,wCAAwC;AAAA,IACrD,EAAE,SAAS,gBAAgB,cAAc,eAAe;AAAA,EAC1D;AACF;","names":[]}