@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.
- package/COPYING +674 -0
- package/LICENSE +165 -0
- package/README.md +165 -0
- package/dist/AudioPreview.d.ts +9 -0
- package/dist/AudioPreview.js +29 -0
- package/dist/AudioPreview.js.map +1 -0
- package/dist/CodePreview.d.ts +10 -0
- package/dist/CodePreview.js +121 -0
- package/dist/CodePreview.js.map +1 -0
- package/dist/CsvPreview.d.ts +9 -0
- package/dist/CsvPreview.js +117 -0
- package/dist/CsvPreview.js.map +1 -0
- package/dist/DocxPreview.d.ts +11 -0
- package/dist/DocxPreview.js +89 -0
- package/dist/DocxPreview.js.map +1 -0
- package/dist/EpubPreview.d.ts +9 -0
- package/dist/EpubPreview.js +693 -0
- package/dist/EpubPreview.js.map +1 -0
- package/dist/HtmlPreview.d.ts +9 -0
- package/dist/HtmlPreview.js +60 -0
- package/dist/HtmlPreview.js.map +1 -0
- package/dist/ImagePreview.d.ts +9 -0
- package/dist/ImagePreview.js +44 -0
- package/dist/ImagePreview.js.map +1 -0
- package/dist/LargeFileGate.d.ts +12 -0
- package/dist/LargeFileGate.js +88 -0
- package/dist/LargeFileGate.js.map +1 -0
- package/dist/MarkdownPreview.d.ts +8 -0
- package/dist/MarkdownPreview.js +140 -0
- package/dist/MarkdownPreview.js.map +1 -0
- package/dist/PdfPreview.d.ts +11 -0
- package/dist/PdfPreview.js +206 -0
- package/dist/PdfPreview.js.map +1 -0
- package/dist/PlainTextLargePreview.d.ts +9 -0
- package/dist/PlainTextLargePreview.js +62 -0
- package/dist/PlainTextLargePreview.js.map +1 -0
- package/dist/PluginPreviewRenderer.d.ts +13 -0
- package/dist/PluginPreviewRenderer.js +89 -0
- package/dist/PluginPreviewRenderer.js.map +1 -0
- package/dist/PptxPreview.d.ts +16 -0
- package/dist/PptxPreview.js +376 -0
- package/dist/PptxPreview.js.map +1 -0
- package/dist/PreviewErrorBoundary.d.ts +29 -0
- package/dist/PreviewErrorBoundary.js +53 -0
- package/dist/PreviewErrorBoundary.js.map +1 -0
- package/dist/PreviewFallback.d.ts +18 -0
- package/dist/PreviewFallback.js +143 -0
- package/dist/PreviewFallback.js.map +1 -0
- package/dist/PreviewLoading.d.ts +8 -0
- package/dist/PreviewLoading.js +14 -0
- package/dist/PreviewLoading.js.map +1 -0
- package/dist/RtfPreview.d.ts +10 -0
- package/dist/RtfPreview.js +240 -0
- package/dist/RtfPreview.js.map +1 -0
- package/dist/ShikiSourceView.d.ts +11 -0
- package/dist/ShikiSourceView.js +112 -0
- package/dist/ShikiSourceView.js.map +1 -0
- package/dist/SvgPreview.d.ts +9 -0
- package/dist/SvgPreview.js +89 -0
- package/dist/SvgPreview.js.map +1 -0
- package/dist/TextPreview.d.ts +9 -0
- package/dist/TextPreview.js +9 -0
- package/dist/TextPreview.js.map +1 -0
- package/dist/VideoPreview.d.ts +9 -0
- package/dist/VideoPreview.js +18 -0
- package/dist/VideoPreview.js.map +1 -0
- package/dist/XlsxPreview.d.ts +12 -0
- package/dist/XlsxPreview.js +856 -0
- package/dist/XlsxPreview.js.map +1 -0
- package/dist/ZipPreview.d.ts +9 -0
- package/dist/ZipPreview.js +153 -0
- package/dist/ZipPreview.js.map +1 -0
- package/dist/core/binary.d.ts +10 -0
- package/dist/core/binary.js +27 -0
- package/dist/core/binary.js.map +1 -0
- package/dist/core/config.d.ts +17 -0
- package/dist/core/config.js +19 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/download.d.ts +5 -0
- package/dist/core/download.js +20 -0
- package/dist/core/download.js.map +1 -0
- package/dist/core/i18n.d.ts +101 -0
- package/dist/core/i18n.js +200 -0
- package/dist/core/i18n.js.map +1 -0
- package/dist/core/plugin.d.ts +38 -0
- package/dist/core/plugin.js +46 -0
- package/dist/core/plugin.js.map +1 -0
- package/dist/core/registry.d.ts +13 -0
- package/dist/core/registry.js +33 -0
- package/dist/core/registry.js.map +1 -0
- package/dist/core/source.d.ts +14 -0
- package/dist/core/source.js +131 -0
- package/dist/core/source.js.map +1 -0
- package/dist/core/types.d.ts +88 -0
- package/dist/core/types.js +27 -0
- package/dist/core/types.js.map +1 -0
- package/dist/hooks/useObjectUrlFromSource.d.ts +9 -0
- package/dist/hooks/useObjectUrlFromSource.js +50 -0
- package/dist/hooks/useObjectUrlFromSource.js.map +1 -0
- package/dist/hooks/useSourceBase64.d.ts +10 -0
- package/dist/hooks/useSourceBase64.js +32 -0
- package/dist/hooks/useSourceBase64.js.map +1 -0
- package/dist/hooks/useSourceText.d.ts +10 -0
- package/dist/hooks/useSourceText.js +32 -0
- package/dist/hooks/useSourceText.js.map +1 -0
- package/dist/icons.d.ts +44 -0
- package/dist/icons.js +248 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +147 -0
- package/dist/index.js.map +1 -0
- package/dist/limits.d.ts +26 -0
- package/dist/limits.js +45 -0
- package/dist/limits.js.map +1 -0
- package/dist/performance-limits.d.ts +27 -0
- package/dist/performance-limits.js +54 -0
- package/dist/performance-limits.js.map +1 -0
- package/dist/plugins/audio-plugin.d.ts +7 -0
- package/dist/plugins/audio-plugin.js +11 -0
- package/dist/plugins/audio-plugin.js.map +1 -0
- package/dist/plugins/builtin-plugins.d.ts +9 -0
- package/dist/plugins/builtin-plugins.js +43 -0
- package/dist/plugins/builtin-plugins.js.map +1 -0
- package/dist/plugins/csv-plugin.d.ts +7 -0
- package/dist/plugins/csv-plugin.js +11 -0
- package/dist/plugins/csv-plugin.js.map +1 -0
- package/dist/plugins/docx-plugin.d.ts +7 -0
- package/dist/plugins/docx-plugin.js +15 -0
- package/dist/plugins/docx-plugin.js.map +1 -0
- package/dist/plugins/epub-plugin.d.ts +7 -0
- package/dist/plugins/epub-plugin.js +15 -0
- package/dist/plugins/epub-plugin.js.map +1 -0
- package/dist/plugins/html-plugin.d.ts +7 -0
- package/dist/plugins/html-plugin.js +11 -0
- package/dist/plugins/html-plugin.js.map +1 -0
- package/dist/plugins/image-plugin.d.ts +7 -0
- package/dist/plugins/image-plugin.js +11 -0
- package/dist/plugins/image-plugin.js.map +1 -0
- package/dist/plugins/markdown-plugin.d.ts +7 -0
- package/dist/plugins/markdown-plugin.js +11 -0
- package/dist/plugins/markdown-plugin.js.map +1 -0
- package/dist/plugins/pdf-plugin.d.ts +7 -0
- package/dist/plugins/pdf-plugin.js +15 -0
- package/dist/plugins/pdf-plugin.js.map +1 -0
- package/dist/plugins/pptx-plugin.d.ts +7 -0
- package/dist/plugins/pptx-plugin.js +15 -0
- package/dist/plugins/pptx-plugin.js.map +1 -0
- package/dist/plugins/rtf-plugin.d.ts +7 -0
- package/dist/plugins/rtf-plugin.js +15 -0
- package/dist/plugins/rtf-plugin.js.map +1 -0
- package/dist/plugins/source-code-plugin.d.ts +7 -0
- package/dist/plugins/source-code-plugin.js +11 -0
- package/dist/plugins/source-code-plugin.js.map +1 -0
- package/dist/plugins/svg-plugin.d.ts +7 -0
- package/dist/plugins/svg-plugin.js +11 -0
- package/dist/plugins/svg-plugin.js.map +1 -0
- package/dist/plugins/text-plugin.d.ts +7 -0
- package/dist/plugins/text-plugin.js +11 -0
- package/dist/plugins/text-plugin.js.map +1 -0
- package/dist/plugins/video-plugin.d.ts +7 -0
- package/dist/plugins/video-plugin.js +11 -0
- package/dist/plugins/video-plugin.js.map +1 -0
- package/dist/plugins/xlsx-plugin.d.ts +7 -0
- package/dist/plugins/xlsx-plugin.js +15 -0
- package/dist/plugins/xlsx-plugin.js.map +1 -0
- package/dist/plugins/zip-plugin.d.ts +7 -0
- package/dist/plugins/zip-plugin.js +15 -0
- package/dist/plugins/zip-plugin.js.map +1 -0
- package/dist/preview-adapters/AudioPreviewAdapter.d.ts +8 -0
- package/dist/preview-adapters/AudioPreviewAdapter.js +31 -0
- package/dist/preview-adapters/AudioPreviewAdapter.js.map +1 -0
- package/dist/preview-adapters/CsvPreviewAdapter.d.ts +8 -0
- package/dist/preview-adapters/CsvPreviewAdapter.js +28 -0
- package/dist/preview-adapters/CsvPreviewAdapter.js.map +1 -0
- package/dist/preview-adapters/DocxPreviewAdapter.d.ts +8 -0
- package/dist/preview-adapters/DocxPreviewAdapter.js +16 -0
- package/dist/preview-adapters/DocxPreviewAdapter.js.map +1 -0
- package/dist/preview-adapters/EpubPreviewAdapter.d.ts +8 -0
- package/dist/preview-adapters/EpubPreviewAdapter.js +28 -0
- package/dist/preview-adapters/EpubPreviewAdapter.js.map +1 -0
- package/dist/preview-adapters/HtmlPreviewAdapter.d.ts +8 -0
- package/dist/preview-adapters/HtmlPreviewAdapter.js +28 -0
- package/dist/preview-adapters/HtmlPreviewAdapter.js.map +1 -0
- package/dist/preview-adapters/ImagePreviewAdapter.d.ts +8 -0
- package/dist/preview-adapters/ImagePreviewAdapter.js +31 -0
- package/dist/preview-adapters/ImagePreviewAdapter.js.map +1 -0
- package/dist/preview-adapters/MarkdownPreviewAdapter.d.ts +8 -0
- package/dist/preview-adapters/MarkdownPreviewAdapter.js +28 -0
- package/dist/preview-adapters/MarkdownPreviewAdapter.js.map +1 -0
- package/dist/preview-adapters/PdfPreviewAdapter.d.ts +8 -0
- package/dist/preview-adapters/PdfPreviewAdapter.js +16 -0
- package/dist/preview-adapters/PdfPreviewAdapter.js.map +1 -0
- package/dist/preview-adapters/PptxPreviewAdapter.d.ts +8 -0
- package/dist/preview-adapters/PptxPreviewAdapter.js +16 -0
- package/dist/preview-adapters/PptxPreviewAdapter.js.map +1 -0
- package/dist/preview-adapters/RtfPreviewAdapter.d.ts +8 -0
- package/dist/preview-adapters/RtfPreviewAdapter.js +54 -0
- package/dist/preview-adapters/RtfPreviewAdapter.js.map +1 -0
- package/dist/preview-adapters/SourceCodePreviewAdapter.d.ts +8 -0
- package/dist/preview-adapters/SourceCodePreviewAdapter.js +35 -0
- package/dist/preview-adapters/SourceCodePreviewAdapter.js.map +1 -0
- package/dist/preview-adapters/SvgPreviewAdapter.d.ts +8 -0
- package/dist/preview-adapters/SvgPreviewAdapter.js +28 -0
- package/dist/preview-adapters/SvgPreviewAdapter.js.map +1 -0
- package/dist/preview-adapters/TextPreviewAdapter.d.ts +8 -0
- package/dist/preview-adapters/TextPreviewAdapter.js +28 -0
- package/dist/preview-adapters/TextPreviewAdapter.js.map +1 -0
- package/dist/preview-adapters/UnsupportedPluginPreview.d.ts +11 -0
- package/dist/preview-adapters/UnsupportedPluginPreview.js +34 -0
- package/dist/preview-adapters/UnsupportedPluginPreview.js.map +1 -0
- package/dist/preview-adapters/VideoPreviewAdapter.d.ts +8 -0
- package/dist/preview-adapters/VideoPreviewAdapter.js +31 -0
- package/dist/preview-adapters/VideoPreviewAdapter.js.map +1 -0
- package/dist/preview-adapters/XlsxPreviewAdapter.d.ts +8 -0
- package/dist/preview-adapters/XlsxPreviewAdapter.js +17 -0
- package/dist/preview-adapters/XlsxPreviewAdapter.js.map +1 -0
- package/dist/preview-adapters/ZipPreviewAdapter.d.ts +8 -0
- package/dist/preview-adapters/ZipPreviewAdapter.js +28 -0
- package/dist/preview-adapters/ZipPreviewAdapter.js.map +1 -0
- package/dist/remote-url.d.ts +20 -0
- package/dist/remote-url.js +478 -0
- package/dist/remote-url.js.map +1 -0
- package/dist/rtf/load-rtfjs.d.ts +42 -0
- package/dist/rtf/load-rtfjs.js +71 -0
- package/dist/rtf/load-rtfjs.js.map +1 -0
- package/dist/rtf/normalize-codepage.d.ts +33 -0
- package/dist/rtf/normalize-codepage.js +88 -0
- package/dist/rtf/normalize-codepage.js.map +1 -0
- package/dist/shiki.d.ts +35 -0
- package/dist/shiki.js +128 -0
- package/dist/shiki.js.map +1 -0
- package/dist/styles/AudioPreview.css +35 -0
- package/dist/styles/CsvPreview.css +106 -0
- package/dist/styles/DocxPreview.css +93 -0
- package/dist/styles/EpubPreview.css +509 -0
- package/dist/styles/HtmlPreview.css +15 -0
- package/dist/styles/ImagePreview.css +45 -0
- package/dist/styles/LargeFileGate.css +55 -0
- package/dist/styles/MarkdownPreview.css +291 -0
- package/dist/styles/PdfPreview.css +68 -0
- package/dist/styles/PlainTextLargePreview.css +85 -0
- package/dist/styles/PluginDebugBar.css +30 -0
- package/dist/styles/PptxPreview.css +207 -0
- package/dist/styles/PreviewFallback.css +88 -0
- package/dist/styles/PreviewLoading.css +13 -0
- package/dist/styles/RtfPreview.css +99 -0
- package/dist/styles/ShikiSourceView.css +159 -0
- package/dist/styles/SvgPreview.css +99 -0
- package/dist/styles/VideoPreview.css +19 -0
- package/dist/styles/ViewModeBar.css +38 -0
- package/dist/styles/XlsxPreview.css +361 -0
- package/dist/styles/ZipPreview.css +86 -0
- package/dist/styles/base.css +238 -0
- package/dist/styles/index.css +39 -0
- package/dist/support-status.d.ts +19 -0
- package/dist/support-status.js +174 -0
- package/dist/support-status.js.map +1 -0
- package/dist/utils.d.ts +17 -0
- package/dist/utils.js +205 -0
- package/dist/utils.js.map +1 -0
- package/package.json +125 -0
- package/scripts/copy-pdf-worker.mjs +31 -0
- package/scripts/copy-rtfjs-bundles.mjs +49 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const ALL_FILE_TYPES = [
|
|
2
|
+
"pdf",
|
|
3
|
+
"markdown",
|
|
4
|
+
"json",
|
|
5
|
+
"code",
|
|
6
|
+
"docx",
|
|
7
|
+
"doc",
|
|
8
|
+
"pptx",
|
|
9
|
+
"ppt",
|
|
10
|
+
"xlsx",
|
|
11
|
+
"xls",
|
|
12
|
+
"html",
|
|
13
|
+
"zip",
|
|
14
|
+
"svg",
|
|
15
|
+
"rtf",
|
|
16
|
+
"epub",
|
|
17
|
+
"image",
|
|
18
|
+
"text",
|
|
19
|
+
"csv",
|
|
20
|
+
"video",
|
|
21
|
+
"audio",
|
|
22
|
+
"unknown"
|
|
23
|
+
];
|
|
24
|
+
export {
|
|
25
|
+
ALL_FILE_TYPES
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/types.ts"],"sourcesContent":["/**\n * Core types for the preview pipeline.\n *\n * Kept dependency-free so that {@link PreviewSource}, {@link NormalizedFile},\n * {@link FileInfo}, and the {@link FileType} union can be shared between the\n * runtime helpers in `utils.ts` and the plugin/registry layer without forming\n * a cycle.\n */\n\n/**\n * Canonical file-type tags recognized by the built-in plugin registry.\n * Use {@link detectFileType} (in `utils`) to map a filename + MIME pair to one\n * of these values.\n */\nexport const ALL_FILE_TYPES = [\n \"pdf\",\n \"markdown\",\n \"json\",\n \"code\",\n \"docx\",\n \"doc\",\n \"pptx\",\n \"ppt\",\n \"xlsx\",\n \"xls\",\n \"html\",\n \"zip\",\n \"svg\",\n \"rtf\",\n \"epub\",\n \"image\",\n \"text\",\n \"csv\",\n \"video\",\n \"audio\",\n \"unknown\",\n] as const;\n\nexport type FileType = (typeof ALL_FILE_TYPES)[number];\n\n/**\n * Source abstraction read by every preview plugin.\n *\n * Plugins should never touch raw `File`/`Blob`/`ArrayBuffer`/URL directly —\n * always go through `readSourceAsText` / `readSourceAsArrayBuffer` / the\n * matching React hooks. That keeps consumers free to mix local uploads,\n * blobs, decoded buffers, and remote URLs without each plugin re-deriving\n * the data path.\n */\nexport type PreviewSource =\n | {\n kind: \"file\";\n file: File;\n }\n | {\n kind: \"blob\";\n blob: Blob;\n name?: string;\n mimeType?: string;\n }\n | {\n kind: \"arrayBuffer\";\n buffer: ArrayBuffer;\n name?: string;\n mimeType?: string;\n }\n | {\n kind: \"url\";\n url: string;\n name?: string;\n mimeType?: string;\n headers?: Record<string, string>;\n };\n\n/**\n * The shape consumers pass into `<PluginPreviewRenderer file={...} />`.\n *\n * `source` is the only field the plugin pipeline reads. The legacy `content`\n * and `url` fields exist for pre-Stage-18 callers and will be removed in a\n * future major.\n */\nexport interface FileInfo {\n id: string;\n name: string;\n size: number;\n type: string;\n fileType: FileType;\n\n /**\n * Primary source abstraction. Mandatory in Stage 18+.\n * Read via `readSourceAsText` / `readSourceAsArrayBuffer` from `core/source`.\n */\n source: PreviewSource;\n\n /**\n * @deprecated Use `source` + `readSourceAsText`/`readSourceAsArrayBuffer`.\n * Compatibility field for legacy preview components.\n */\n content?: string | null;\n\n /**\n * @deprecated Use `source` or an adapter-local object URL.\n * Compatibility field for legacy media preview components.\n */\n url?: string | null;\n}\n\n/**\n * Slimmer normalized representation used by the registry / plugin internals.\n * Most consumers should work with {@link FileInfo} instead.\n */\nexport interface NormalizedFile {\n id: string;\n name: string;\n size?: number;\n mimeType?: string;\n extension?: string;\n fileType: FileType;\n source: PreviewSource;\n}\n"],"mappings":"AAcO,MAAM,iBAAiB;AAAA,EAC5B;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;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { readSourceAsArrayBuffer } from "../core/source";
|
|
3
|
+
function useObjectUrlFromSource(source, mimeType) {
|
|
4
|
+
const [objectUrl, setObjectUrl] = useState(null);
|
|
5
|
+
const [loading, setLoading] = useState(true);
|
|
6
|
+
const [error, setError] = useState(null);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
let cancelled = false;
|
|
9
|
+
let createdUrl = null;
|
|
10
|
+
setLoading(true);
|
|
11
|
+
setError(null);
|
|
12
|
+
setObjectUrl(null);
|
|
13
|
+
async function run() {
|
|
14
|
+
try {
|
|
15
|
+
if (source.kind === "file") {
|
|
16
|
+
createdUrl = URL.createObjectURL(source.file);
|
|
17
|
+
} else if (source.kind === "blob") {
|
|
18
|
+
createdUrl = URL.createObjectURL(source.blob);
|
|
19
|
+
} else {
|
|
20
|
+
const buffer = await readSourceAsArrayBuffer(source);
|
|
21
|
+
const blob = new Blob([buffer], {
|
|
22
|
+
type: mimeType || "application/octet-stream"
|
|
23
|
+
});
|
|
24
|
+
createdUrl = URL.createObjectURL(blob);
|
|
25
|
+
}
|
|
26
|
+
if (!cancelled) {
|
|
27
|
+
setObjectUrl(createdUrl);
|
|
28
|
+
setLoading(false);
|
|
29
|
+
}
|
|
30
|
+
} catch (err) {
|
|
31
|
+
if (!cancelled) {
|
|
32
|
+
setError(err instanceof Error ? err : new Error(String(err)));
|
|
33
|
+
setLoading(false);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
run();
|
|
38
|
+
return () => {
|
|
39
|
+
cancelled = true;
|
|
40
|
+
if (createdUrl) {
|
|
41
|
+
URL.revokeObjectURL(createdUrl);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}, [source, mimeType]);
|
|
45
|
+
return { objectUrl, loading, error };
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
useObjectUrlFromSource
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=useObjectUrlFromSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useObjectUrlFromSource.ts"],"sourcesContent":["\nimport { useEffect, useState } from \"react\";\nimport type { PreviewSource } from \"../core/types\";\nimport { readSourceAsArrayBuffer } from \"../core/source\";\n\nexport function useObjectUrlFromSource(\n source: PreviewSource,\n mimeType?: string\n): {\n objectUrl: string | null;\n loading: boolean;\n error: Error | null;\n} {\n const [objectUrl, setObjectUrl] = useState<string | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n useEffect(() => {\n let cancelled = false;\n let createdUrl: string | null = null;\n\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setLoading(true);\n setError(null);\n setObjectUrl(null);\n\n async function run() {\n try {\n if (source.kind === \"file\") {\n createdUrl = URL.createObjectURL(source.file);\n } else if (source.kind === \"blob\") {\n createdUrl = URL.createObjectURL(source.blob);\n } else {\n const buffer = await readSourceAsArrayBuffer(source);\n const blob = new Blob([buffer], {\n type: mimeType || \"application/octet-stream\",\n });\n createdUrl = URL.createObjectURL(blob);\n }\n\n if (!cancelled) {\n setObjectUrl(createdUrl);\n setLoading(false);\n }\n } catch (err) {\n if (!cancelled) {\n setError(err instanceof Error ? err : new Error(String(err)));\n setLoading(false);\n }\n }\n }\n\n run();\n\n return () => {\n cancelled = true;\n if (createdUrl) {\n URL.revokeObjectURL(createdUrl);\n }\n };\n }, [source, mimeType]);\n\n return { objectUrl, loading, error };\n}\n"],"mappings":"AACA,SAAS,WAAW,gBAAgB;AAEpC,SAAS,+BAA+B;AAEjC,SAAS,uBACd,QACA,UAKA;AACA,QAAM,CAAC,WAAW,YAAY,IAAI,SAAwB,IAAI;AAC9D,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,IAAI;AAC3C,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAuB,IAAI;AAErD,YAAU,MAAM;AACd,QAAI,YAAY;AAChB,QAAI,aAA4B;AAGhC,eAAW,IAAI;AACf,aAAS,IAAI;AACb,iBAAa,IAAI;AAEjB,mBAAe,MAAM;AACnB,UAAI;AACF,YAAI,OAAO,SAAS,QAAQ;AAC1B,uBAAa,IAAI,gBAAgB,OAAO,IAAI;AAAA,QAC9C,WAAW,OAAO,SAAS,QAAQ;AACjC,uBAAa,IAAI,gBAAgB,OAAO,IAAI;AAAA,QAC9C,OAAO;AACL,gBAAM,SAAS,MAAM,wBAAwB,MAAM;AACnD,gBAAM,OAAO,IAAI,KAAK,CAAC,MAAM,GAAG;AAAA,YAC9B,MAAM,YAAY;AAAA,UACpB,CAAC;AACD,uBAAa,IAAI,gBAAgB,IAAI;AAAA,QACvC;AAEA,YAAI,CAAC,WAAW;AACd,uBAAa,UAAU;AACvB,qBAAW,KAAK;AAAA,QAClB;AAAA,MACF,SAAS,KAAK;AACZ,YAAI,CAAC,WAAW;AACd,mBAAS,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,GAAG,CAAC,CAAC;AAC5D,qBAAW,KAAK;AAAA,QAClB;AAAA,MACF;AAAA,IACF;AAEA,QAAI;AAEJ,WAAO,MAAM;AACX,kBAAY;AACZ,UAAI,YAAY;AACd,YAAI,gBAAgB,UAAU;AAAA,MAChC;AAAA,IACF;AAAA,EACF,GAAG,CAAC,QAAQ,QAAQ,CAAC;AAErB,SAAO,EAAE,WAAW,SAAS,MAAM;AACrC;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PreviewSource } from '../core/types.js';
|
|
2
|
+
|
|
3
|
+
interface SourceBase64State {
|
|
4
|
+
content: string | null;
|
|
5
|
+
loading: boolean;
|
|
6
|
+
error: Error | null;
|
|
7
|
+
}
|
|
8
|
+
declare function useSourceBase64(source: PreviewSource): SourceBase64State;
|
|
9
|
+
|
|
10
|
+
export { type SourceBase64State, useSourceBase64 };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { readSourceAsBase64 } from "../core/source";
|
|
3
|
+
function useSourceBase64(source) {
|
|
4
|
+
const [content, setContent] = useState(null);
|
|
5
|
+
const [loading, setLoading] = useState(true);
|
|
6
|
+
const [error, setError] = useState(null);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
let cancelled = false;
|
|
9
|
+
setLoading(true);
|
|
10
|
+
setError(null);
|
|
11
|
+
setContent(null);
|
|
12
|
+
readSourceAsBase64(source).then((base64) => {
|
|
13
|
+
if (!cancelled) {
|
|
14
|
+
setContent(base64);
|
|
15
|
+
setLoading(false);
|
|
16
|
+
}
|
|
17
|
+
}).catch((err) => {
|
|
18
|
+
if (!cancelled) {
|
|
19
|
+
setError(err instanceof Error ? err : new Error(String(err)));
|
|
20
|
+
setLoading(false);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return () => {
|
|
24
|
+
cancelled = true;
|
|
25
|
+
};
|
|
26
|
+
}, [source]);
|
|
27
|
+
return { content, loading, error };
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
useSourceBase64
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=useSourceBase64.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useSourceBase64.ts"],"sourcesContent":["\nimport { useEffect, useState } from \"react\";\nimport type { PreviewSource } from \"../core/types\";\nimport { readSourceAsBase64 } from \"../core/source\";\n\nexport interface SourceBase64State {\n content: string | null;\n loading: boolean;\n error: Error | null;\n}\n\nexport function useSourceBase64(source: PreviewSource): SourceBase64State {\n const [content, setContent] = useState<string | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n useEffect(() => {\n let cancelled = false;\n\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setLoading(true);\n setError(null);\n setContent(null);\n\n readSourceAsBase64(source)\n .then((base64) => {\n if (!cancelled) {\n setContent(base64);\n setLoading(false);\n }\n })\n .catch((err) => {\n if (!cancelled) {\n setError(err instanceof Error ? err : new Error(String(err)));\n setLoading(false);\n }\n });\n\n return () => {\n cancelled = true;\n };\n }, [source]);\n\n return { content, loading, error };\n}\n"],"mappings":"AACA,SAAS,WAAW,gBAAgB;AAEpC,SAAS,0BAA0B;AAQ5B,SAAS,gBAAgB,QAA0C;AACxE,QAAM,CAAC,SAAS,UAAU,IAAI,SAAwB,IAAI;AAC1D,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,IAAI;AAC3C,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAuB,IAAI;AAErD,YAAU,MAAM;AACd,QAAI,YAAY;AAGhB,eAAW,IAAI;AACf,aAAS,IAAI;AACb,eAAW,IAAI;AAEf,uBAAmB,MAAM,EACtB,KAAK,CAAC,WAAW;AAChB,UAAI,CAAC,WAAW;AACd,mBAAW,MAAM;AACjB,mBAAW,KAAK;AAAA,MAClB;AAAA,IACF,CAAC,EACA,MAAM,CAAC,QAAQ;AACd,UAAI,CAAC,WAAW;AACd,iBAAS,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,GAAG,CAAC,CAAC;AAC5D,mBAAW,KAAK;AAAA,MAClB;AAAA,IACF,CAAC;AAEH,WAAO,MAAM;AACX,kBAAY;AAAA,IACd;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAEX,SAAO,EAAE,SAAS,SAAS,MAAM;AACnC;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PreviewSource } from '../core/types.js';
|
|
2
|
+
|
|
3
|
+
interface SourceTextState {
|
|
4
|
+
content: string | null;
|
|
5
|
+
loading: boolean;
|
|
6
|
+
error: Error | null;
|
|
7
|
+
}
|
|
8
|
+
declare function useSourceText(source: PreviewSource): SourceTextState;
|
|
9
|
+
|
|
10
|
+
export { type SourceTextState, useSourceText };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { readSourceAsText } from "../core/source";
|
|
3
|
+
function useSourceText(source) {
|
|
4
|
+
const [content, setContent] = useState(null);
|
|
5
|
+
const [loading, setLoading] = useState(true);
|
|
6
|
+
const [error, setError] = useState(null);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
let cancelled = false;
|
|
9
|
+
setLoading(true);
|
|
10
|
+
setError(null);
|
|
11
|
+
setContent(null);
|
|
12
|
+
readSourceAsText(source).then((text) => {
|
|
13
|
+
if (!cancelled) {
|
|
14
|
+
setContent(text);
|
|
15
|
+
setLoading(false);
|
|
16
|
+
}
|
|
17
|
+
}).catch((err) => {
|
|
18
|
+
if (!cancelled) {
|
|
19
|
+
setError(err instanceof Error ? err : new Error(String(err)));
|
|
20
|
+
setLoading(false);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return () => {
|
|
24
|
+
cancelled = true;
|
|
25
|
+
};
|
|
26
|
+
}, [source]);
|
|
27
|
+
return { content, loading, error };
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
useSourceText
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=useSourceText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useSourceText.ts"],"sourcesContent":["\nimport { useEffect, useState } from \"react\";\nimport type { PreviewSource } from \"../core/types\";\nimport { readSourceAsText } from \"../core/source\";\n\nexport interface SourceTextState {\n content: string | null;\n loading: boolean;\n error: Error | null;\n}\n\nexport function useSourceText(source: PreviewSource): SourceTextState {\n const [content, setContent] = useState<string | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n useEffect(() => {\n let cancelled = false;\n\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setLoading(true);\n setError(null);\n setContent(null);\n\n readSourceAsText(source)\n .then((text) => {\n if (!cancelled) {\n setContent(text);\n setLoading(false);\n }\n })\n .catch((err) => {\n if (!cancelled) {\n setError(err instanceof Error ? err : new Error(String(err)));\n setLoading(false);\n }\n });\n\n return () => {\n cancelled = true;\n };\n }, [source]);\n\n return { content, loading, error };\n}\n"],"mappings":"AACA,SAAS,WAAW,gBAAgB;AAEpC,SAAS,wBAAwB;AAQ1B,SAAS,cAAc,QAAwC;AACpE,QAAM,CAAC,SAAS,UAAU,IAAI,SAAwB,IAAI;AAC1D,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,IAAI;AAC3C,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAuB,IAAI;AAErD,YAAU,MAAM;AACd,QAAI,YAAY;AAGhB,eAAW,IAAI;AACf,aAAS,IAAI;AACb,eAAW,IAAI;AAEf,qBAAiB,MAAM,EACpB,KAAK,CAAC,SAAS;AACd,UAAI,CAAC,WAAW;AACd,mBAAW,IAAI;AACf,mBAAW,KAAK;AAAA,MAClB;AAAA,IACF,CAAC,EACA,MAAM,CAAC,QAAQ;AACd,UAAI,CAAC,WAAW;AACd,iBAAS,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,GAAG,CAAC,CAAC;AAC5D,mBAAW,KAAK;AAAA,MAClB;AAAA,IACF,CAAC;AAEH,WAAO,MAAM;AACX,kBAAY;AAAA,IACd;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAEX,SAAO,EAAE,SAAS,SAAS,MAAM;AACnC;","names":[]}
|
package/dist/icons.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Inline SVG icon components — zero external dependencies.
|
|
5
|
+
*
|
|
6
|
+
* Each icon mirrors the lucide-react viewBox (0 0 24 24) and stroke style.
|
|
7
|
+
* Consumers can override size via the `size` prop; color follows `currentColor`.
|
|
8
|
+
*/
|
|
9
|
+
interface IconProps extends React.SVGProps<SVGSVGElement> {
|
|
10
|
+
size?: number;
|
|
11
|
+
}
|
|
12
|
+
declare function ChevronLeftIcon(props: IconProps): react.JSX.Element;
|
|
13
|
+
declare function ChevronRightIcon(props: IconProps): react.JSX.Element;
|
|
14
|
+
declare function ChevronDownIcon(props: IconProps): react.JSX.Element;
|
|
15
|
+
declare function DownloadIcon(props: IconProps): react.JSX.Element;
|
|
16
|
+
declare function CopyIcon(props: IconProps): react.JSX.Element;
|
|
17
|
+
declare function CheckIcon(props: IconProps): react.JSX.Element;
|
|
18
|
+
declare function SearchIcon(props: IconProps): react.JSX.Element;
|
|
19
|
+
declare function WrapTextIcon(props: IconProps): react.JSX.Element;
|
|
20
|
+
declare function ExternalLinkIcon(props: IconProps): react.JSX.Element;
|
|
21
|
+
declare function ZoomInIcon(props: IconProps): react.JSX.Element;
|
|
22
|
+
declare function ZoomOutIcon(props: IconProps): react.JSX.Element;
|
|
23
|
+
declare function RotateCwIcon(props: IconProps): react.JSX.Element;
|
|
24
|
+
declare function Maximize2Icon(props: IconProps): react.JSX.Element;
|
|
25
|
+
declare function Minimize2Icon(props: IconProps): react.JSX.Element;
|
|
26
|
+
declare function EyeIcon(props: IconProps): react.JSX.Element;
|
|
27
|
+
declare function Code2Icon(props: IconProps): react.JSX.Element;
|
|
28
|
+
declare function Columns2Icon(props: IconProps): react.JSX.Element;
|
|
29
|
+
declare function Grid3X3Icon(props: IconProps): react.JSX.Element;
|
|
30
|
+
declare function ListIcon(props: IconProps): react.JSX.Element;
|
|
31
|
+
declare function Table2Icon(props: IconProps): react.JSX.Element;
|
|
32
|
+
declare function MonitorIcon(props: IconProps): react.JSX.Element;
|
|
33
|
+
declare function AlertTriangleIcon(props: IconProps): react.JSX.Element;
|
|
34
|
+
declare function AlertCircleIcon(props: IconProps): react.JSX.Element;
|
|
35
|
+
declare function ImageOffIcon(props: IconProps): react.JSX.Element;
|
|
36
|
+
declare function MessageSquareIcon(props: IconProps): react.JSX.Element;
|
|
37
|
+
declare function FileIcon(props: IconProps): react.JSX.Element;
|
|
38
|
+
declare function FolderIcon(props: IconProps): react.JSX.Element;
|
|
39
|
+
declare function FolderOpenIcon(props: IconProps): react.JSX.Element;
|
|
40
|
+
declare function BookOpenIcon(props: IconProps): react.JSX.Element;
|
|
41
|
+
declare function ArrowUpDownIcon(props: IconProps): react.JSX.Element;
|
|
42
|
+
declare function XIcon(props: IconProps): react.JSX.Element;
|
|
43
|
+
|
|
44
|
+
export { AlertCircleIcon, AlertTriangleIcon, ArrowUpDownIcon, BookOpenIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, Code2Icon, Columns2Icon, CopyIcon, DownloadIcon, ExternalLinkIcon, EyeIcon, FileIcon, FolderIcon, FolderOpenIcon, Grid3X3Icon, ImageOffIcon, ListIcon, Maximize2Icon, MessageSquareIcon, Minimize2Icon, MonitorIcon, RotateCwIcon, SearchIcon, Table2Icon, WrapTextIcon, XIcon, ZoomInIcon, ZoomOutIcon };
|
package/dist/icons.js
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Children } from "react";
|
|
3
|
+
const defaults = {
|
|
4
|
+
size: 16,
|
|
5
|
+
fill: "none",
|
|
6
|
+
stroke: "currentColor",
|
|
7
|
+
strokeWidth: 2,
|
|
8
|
+
strokeLinecap: "round",
|
|
9
|
+
strokeLinejoin: "round"
|
|
10
|
+
};
|
|
11
|
+
function icon(props, ...children) {
|
|
12
|
+
const { size = defaults.size, ...rest } = props;
|
|
13
|
+
return /* @__PURE__ */ jsx(
|
|
14
|
+
"svg",
|
|
15
|
+
{
|
|
16
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
17
|
+
width: size,
|
|
18
|
+
height: size,
|
|
19
|
+
viewBox: "0 0 24 24",
|
|
20
|
+
fill: defaults.fill,
|
|
21
|
+
stroke: defaults.stroke,
|
|
22
|
+
strokeWidth: defaults.strokeWidth,
|
|
23
|
+
strokeLinecap: defaults.strokeLinecap,
|
|
24
|
+
strokeLinejoin: defaults.strokeLinejoin,
|
|
25
|
+
...rest,
|
|
26
|
+
children: Children.toArray(children)
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
function ChevronLeftIcon(props) {
|
|
31
|
+
return icon(props, /* @__PURE__ */ jsx("path", { d: "m15 18-6-6 6-6" }));
|
|
32
|
+
}
|
|
33
|
+
function ChevronRightIcon(props) {
|
|
34
|
+
return icon(props, /* @__PURE__ */ jsx("path", { d: "m9 18 6-6-6-6" }));
|
|
35
|
+
}
|
|
36
|
+
function ChevronDownIcon(props) {
|
|
37
|
+
return icon(props, /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" }));
|
|
38
|
+
}
|
|
39
|
+
function DownloadIcon(props) {
|
|
40
|
+
return icon(
|
|
41
|
+
props,
|
|
42
|
+
/* @__PURE__ */ jsx("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
43
|
+
/* @__PURE__ */ jsx("polyline", { points: "7 10 12 15 17 10" }),
|
|
44
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "15", x2: "12", y2: "3" })
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
function CopyIcon(props) {
|
|
48
|
+
return icon(
|
|
49
|
+
props,
|
|
50
|
+
/* @__PURE__ */ jsx("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" }),
|
|
51
|
+
/* @__PURE__ */ jsx("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
function CheckIcon(props) {
|
|
55
|
+
return icon(props, /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" }));
|
|
56
|
+
}
|
|
57
|
+
function SearchIcon(props) {
|
|
58
|
+
return icon(props, /* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "8" }), /* @__PURE__ */ jsx("path", { d: "m21 21-4.3-4.3" }));
|
|
59
|
+
}
|
|
60
|
+
function WrapTextIcon(props) {
|
|
61
|
+
return icon(
|
|
62
|
+
props,
|
|
63
|
+
/* @__PURE__ */ jsx("line", { x1: "3", y1: "6", x2: "21", y2: "6" }),
|
|
64
|
+
/* @__PURE__ */ jsx("line", { x1: "3", y1: "12", x2: "21", y2: "12" }),
|
|
65
|
+
/* @__PURE__ */ jsx("line", { x1: "3", y1: "18", x2: "15", y2: "18" }),
|
|
66
|
+
/* @__PURE__ */ jsx("path", { d: "M18 14.5a2.5 2.5 0 0 1 0 5" })
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
function ExternalLinkIcon(props) {
|
|
70
|
+
return icon(
|
|
71
|
+
props,
|
|
72
|
+
/* @__PURE__ */ jsx("path", { d: "M15 3h6v6" }),
|
|
73
|
+
/* @__PURE__ */ jsx("path", { d: "M10 14 21 3" }),
|
|
74
|
+
/* @__PURE__ */ jsx("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
function ZoomInIcon(props) {
|
|
78
|
+
return icon(
|
|
79
|
+
props,
|
|
80
|
+
/* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "8" }),
|
|
81
|
+
/* @__PURE__ */ jsx("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" }),
|
|
82
|
+
/* @__PURE__ */ jsx("line", { x1: "11", y1: "8", x2: "11", y2: "14" }),
|
|
83
|
+
/* @__PURE__ */ jsx("line", { x1: "8", y1: "11", x2: "14", y2: "11" })
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
function ZoomOutIcon(props) {
|
|
87
|
+
return icon(
|
|
88
|
+
props,
|
|
89
|
+
/* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "8" }),
|
|
90
|
+
/* @__PURE__ */ jsx("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" }),
|
|
91
|
+
/* @__PURE__ */ jsx("line", { x1: "8", y1: "11", x2: "14", y2: "11" })
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
function RotateCwIcon(props) {
|
|
95
|
+
return icon(
|
|
96
|
+
props,
|
|
97
|
+
/* @__PURE__ */ jsx("path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8" }),
|
|
98
|
+
/* @__PURE__ */ jsx("path", { d: "M21 3v5h-5" })
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
function Maximize2Icon(props) {
|
|
102
|
+
return icon(
|
|
103
|
+
props,
|
|
104
|
+
/* @__PURE__ */ jsx("path", { d: "M15 3h6v6" }),
|
|
105
|
+
/* @__PURE__ */ jsx("path", { d: "M9 21H3v-6" }),
|
|
106
|
+
/* @__PURE__ */ jsx("path", { d: "M21 3l-7 7" }),
|
|
107
|
+
/* @__PURE__ */ jsx("path", { d: "M3 21l7-7" })
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
function Minimize2Icon(props) {
|
|
111
|
+
return icon(
|
|
112
|
+
props,
|
|
113
|
+
/* @__PURE__ */ jsx("path", { d: "M8 3v3a2 2 0 0 1-2 2H3" }),
|
|
114
|
+
/* @__PURE__ */ jsx("path", { d: "M21 8h-3a2 2 0 0 1-2-2V3" }),
|
|
115
|
+
/* @__PURE__ */ jsx("path", { d: "M3 16h3a2 2 0 0 1 2 2v3" }),
|
|
116
|
+
/* @__PURE__ */ jsx("path", { d: "M16 21v-3a2 2 0 0 1 2-2h3" })
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
function EyeIcon(props) {
|
|
120
|
+
return icon(props, /* @__PURE__ */ jsx("path", { d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" }), /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "3" }));
|
|
121
|
+
}
|
|
122
|
+
function Code2Icon(props) {
|
|
123
|
+
return icon(props, /* @__PURE__ */ jsx("path", { d: "m18 16 4-4-4-4" }), /* @__PURE__ */ jsx("path", { d: "m6 8-4 4 4 4" }), /* @__PURE__ */ jsx("path", { d: "m14.5 4-5 16" }));
|
|
124
|
+
}
|
|
125
|
+
function Columns2Icon(props) {
|
|
126
|
+
return icon(props, /* @__PURE__ */ jsx("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }), /* @__PURE__ */ jsx("line", { x1: "12", y1: "3", x2: "12", y2: "21" }));
|
|
127
|
+
}
|
|
128
|
+
function Grid3X3Icon(props) {
|
|
129
|
+
return icon(props, /* @__PURE__ */ jsx("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }), /* @__PURE__ */ jsx("line", { x1: "3", y1: "9", x2: "21", y2: "9" }), /* @__PURE__ */ jsx("line", { x1: "3", y1: "15", x2: "21", y2: "15" }), /* @__PURE__ */ jsx("line", { x1: "9", y1: "3", x2: "9", y2: "21" }), /* @__PURE__ */ jsx("line", { x1: "15", y1: "3", x2: "15", y2: "21" }));
|
|
130
|
+
}
|
|
131
|
+
function ListIcon(props) {
|
|
132
|
+
return icon(props, /* @__PURE__ */ jsx("line", { x1: "8", y1: "6", x2: "21", y2: "6" }), /* @__PURE__ */ jsx("line", { x1: "8", y1: "12", x2: "21", y2: "12" }), /* @__PURE__ */ jsx("line", { x1: "8", y1: "18", x2: "21", y2: "18" }), /* @__PURE__ */ jsx("line", { x1: "3", y1: "6", x2: "3.01", y2: "6" }), /* @__PURE__ */ jsx("line", { x1: "3", y1: "12", x2: "3.01", y2: "12" }), /* @__PURE__ */ jsx("line", { x1: "3", y1: "18", x2: "3.01", y2: "18" }));
|
|
133
|
+
}
|
|
134
|
+
function Table2Icon(props) {
|
|
135
|
+
return icon(props, /* @__PURE__ */ jsx("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }), /* @__PURE__ */ jsx("line", { x1: "3", y1: "9", x2: "21", y2: "9" }), /* @__PURE__ */ jsx("line", { x1: "3", y1: "15", x2: "21", y2: "15" }), /* @__PURE__ */ jsx("line", { x1: "9", y1: "3", x2: "9", y2: "21" }), /* @__PURE__ */ jsx("line", { x1: "15", y1: "3", x2: "15", y2: "21" }));
|
|
136
|
+
}
|
|
137
|
+
function MonitorIcon(props) {
|
|
138
|
+
return icon(props, /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
139
|
+
/* @__PURE__ */ jsx("rect", { width: "20", height: "14", x: "2", y: "3", rx: "2" }),
|
|
140
|
+
", ",
|
|
141
|
+
/* @__PURE__ */ jsx("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
|
|
142
|
+
", ",
|
|
143
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
|
|
144
|
+
] }));
|
|
145
|
+
}
|
|
146
|
+
function AlertTriangleIcon(props) {
|
|
147
|
+
return icon(
|
|
148
|
+
props,
|
|
149
|
+
/* @__PURE__ */ jsx("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" }),
|
|
150
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "9", x2: "12", y2: "13" }),
|
|
151
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
function AlertCircleIcon(props) {
|
|
155
|
+
return icon(
|
|
156
|
+
props,
|
|
157
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
|
|
158
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
|
|
159
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
function ImageOffIcon(props) {
|
|
163
|
+
return icon(
|
|
164
|
+
props,
|
|
165
|
+
/* @__PURE__ */ jsx("line", { x1: "2", y1: "2", x2: "22", y2: "22" }),
|
|
166
|
+
/* @__PURE__ */ jsx("path", { d: "M10.41 10.41a2 2 0 1 1-2.83-2.83" }),
|
|
167
|
+
/* @__PURE__ */ jsx("line", { x1: "13.5", y1: "13.5", x2: "17", y2: "17" }),
|
|
168
|
+
/* @__PURE__ */ jsx("path", { d: "M8.5 17H5a2 2 0 0 1-2-2V5a2 2 0 0 1 .59-1.42" }),
|
|
169
|
+
/* @__PURE__ */ jsx("path", { d: "M18.42 5.58A2 2 0 0 1 21 7v8.86" }),
|
|
170
|
+
/* @__PURE__ */ jsx("path", { d: "M22 17H14.5" }),
|
|
171
|
+
/* @__PURE__ */ jsx("path", { d: "m2 2 20 20" })
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
function MessageSquareIcon(props) {
|
|
175
|
+
return icon(props, /* @__PURE__ */ jsx("path", { d: "M20 7v7a2 2 0 0 1-2 2H6l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2" }));
|
|
176
|
+
}
|
|
177
|
+
function FileIcon(props) {
|
|
178
|
+
return icon(props, /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
179
|
+
/* @__PURE__ */ jsx("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
|
|
180
|
+
", ",
|
|
181
|
+
/* @__PURE__ */ jsx("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" })
|
|
182
|
+
] }));
|
|
183
|
+
}
|
|
184
|
+
function FolderIcon(props) {
|
|
185
|
+
return icon(props, /* @__PURE__ */ jsx("path", { d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" }));
|
|
186
|
+
}
|
|
187
|
+
function FolderOpenIcon(props) {
|
|
188
|
+
return icon(props, /* @__PURE__ */ jsx("path", { d: "m6 14 1.5-2.8A2 2 0 0 1 9.4 10H20a2 2 0 0 1 1.95 2.518l-1.992 7A2 2 0 0 1 18.008 21H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4.928a2 2 0 0 1 1.69.9l.814 1.1A2 2 0 0 0 13.116 6H20a2 2 0 0 1 2 2v3" }));
|
|
189
|
+
}
|
|
190
|
+
function BookOpenIcon(props) {
|
|
191
|
+
return icon(props, /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
192
|
+
/* @__PURE__ */ jsx("path", { d: "M12 7v14" }),
|
|
193
|
+
", ",
|
|
194
|
+
/* @__PURE__ */ jsx("path", { d: "M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-5a4 4 0 0 0-4 4 4 4 0 0 0-4-4z" })
|
|
195
|
+
] }));
|
|
196
|
+
}
|
|
197
|
+
function ArrowUpDownIcon(props) {
|
|
198
|
+
return icon(props, /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
199
|
+
/* @__PURE__ */ jsx("path", { d: "m21 16-4 4-4-4" }),
|
|
200
|
+
", ",
|
|
201
|
+
/* @__PURE__ */ jsx("path", { d: "M17 20V4" }),
|
|
202
|
+
", ",
|
|
203
|
+
/* @__PURE__ */ jsx("path", { d: "m3 8 4-4 4 4" }),
|
|
204
|
+
", ",
|
|
205
|
+
/* @__PURE__ */ jsx("path", { d: "M7 4v16" })
|
|
206
|
+
] }));
|
|
207
|
+
}
|
|
208
|
+
function XIcon(props) {
|
|
209
|
+
return icon(props, /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
210
|
+
/* @__PURE__ */ jsx("path", { d: "M18 6 6 18" }),
|
|
211
|
+
", ",
|
|
212
|
+
/* @__PURE__ */ jsx("path", { d: "m6 6 12 12" })
|
|
213
|
+
] }));
|
|
214
|
+
}
|
|
215
|
+
export {
|
|
216
|
+
AlertCircleIcon,
|
|
217
|
+
AlertTriangleIcon,
|
|
218
|
+
ArrowUpDownIcon,
|
|
219
|
+
BookOpenIcon,
|
|
220
|
+
CheckIcon,
|
|
221
|
+
ChevronDownIcon,
|
|
222
|
+
ChevronLeftIcon,
|
|
223
|
+
ChevronRightIcon,
|
|
224
|
+
Code2Icon,
|
|
225
|
+
Columns2Icon,
|
|
226
|
+
CopyIcon,
|
|
227
|
+
DownloadIcon,
|
|
228
|
+
ExternalLinkIcon,
|
|
229
|
+
EyeIcon,
|
|
230
|
+
FileIcon,
|
|
231
|
+
FolderIcon,
|
|
232
|
+
FolderOpenIcon,
|
|
233
|
+
Grid3X3Icon,
|
|
234
|
+
ImageOffIcon,
|
|
235
|
+
ListIcon,
|
|
236
|
+
Maximize2Icon,
|
|
237
|
+
MessageSquareIcon,
|
|
238
|
+
Minimize2Icon,
|
|
239
|
+
MonitorIcon,
|
|
240
|
+
RotateCwIcon,
|
|
241
|
+
SearchIcon,
|
|
242
|
+
Table2Icon,
|
|
243
|
+
WrapTextIcon,
|
|
244
|
+
XIcon,
|
|
245
|
+
ZoomInIcon,
|
|
246
|
+
ZoomOutIcon
|
|
247
|
+
};
|
|
248
|
+
//# sourceMappingURL=icons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/icons.tsx"],"sourcesContent":["/**\n * Inline SVG icon components — zero external dependencies.\n *\n * Each icon mirrors the lucide-react viewBox (0 0 24 24) and stroke style.\n * Consumers can override size via the `size` prop; color follows `currentColor`.\n */\n\nimport { Children } from \"react\";\n\ninterface IconProps extends React.SVGProps<SVGSVGElement> {\n size?: number;\n}\n\nconst defaults: IconProps = {\n size: 16,\n fill: \"none\",\n stroke: \"currentColor\",\n strokeWidth: 2,\n strokeLinecap: \"round\" as const,\n strokeLinejoin: \"round\" as const,\n};\n\nfunction icon(props: IconProps, ...children: React.ReactNode[]) {\n const { size = defaults.size, ...rest } = props;\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill={defaults.fill}\n stroke={defaults.stroke}\n strokeWidth={defaults.strokeWidth}\n strokeLinecap={defaults.strokeLinecap}\n strokeLinejoin={defaults.strokeLinejoin}\n {...rest}\n >\n {Children.toArray(children)}\n </svg>\n );\n}\n\n/* ── Navigation ── */\n\nexport function ChevronLeftIcon(props: IconProps) {\n return icon(props, <path d=\"m15 18-6-6 6-6\" />);\n}\n\nexport function ChevronRightIcon(props: IconProps) {\n return icon(props, <path d=\"m9 18 6-6-6-6\" />);\n}\n\nexport function ChevronDownIcon(props: IconProps) {\n return icon(props, <path d=\"m6 9 6 6 6-6\" />);\n}\n\n/* ── Actions ── */\n\nexport function DownloadIcon(props: IconProps) {\n return icon(\n props,\n <path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" />,\n <polyline points=\"7 10 12 15 17 10\" />,\n <line x1=\"12\" y1=\"15\" x2=\"12\" y2=\"3\" />,\n );\n}\n\nexport function CopyIcon(props: IconProps) {\n return icon(\n props,\n <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />,\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />,\n );\n}\n\nexport function CheckIcon(props: IconProps) {\n return icon(props, <path d=\"M20 6 9 17l-5-5\" />);\n}\n\nexport function SearchIcon(props: IconProps) {\n return icon(props, <circle cx=\"11\" cy=\"11\" r=\"8\" />, <path d=\"m21 21-4.3-4.3\" />);\n}\n\nexport function WrapTextIcon(props: IconProps) {\n return icon(\n props,\n <line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\" />,\n <line x1=\"3\" y1=\"12\" x2=\"21\" y2=\"12\" />,\n <line x1=\"3\" y1=\"18\" x2=\"15\" y2=\"18\" />,\n <path d=\"M18 14.5a2.5 2.5 0 0 1 0 5\" />,\n );\n}\n\nexport function ExternalLinkIcon(props: IconProps) {\n return icon(\n props,\n <path d=\"M15 3h6v6\" />,\n <path d=\"M10 14 21 3\" />,\n <path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\" />,\n );\n}\n\n/* ── Zoom & Rotate ── */\n\nexport function ZoomInIcon(props: IconProps) {\n return icon(\n props,\n <circle cx=\"11\" cy=\"11\" r=\"8\" />,\n <line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\" />,\n <line x1=\"11\" y1=\"8\" x2=\"11\" y2=\"14\" />,\n <line x1=\"8\" y1=\"11\" x2=\"14\" y2=\"11\" />,\n );\n}\n\nexport function ZoomOutIcon(props: IconProps) {\n return icon(\n props,\n <circle cx=\"11\" cy=\"11\" r=\"8\" />,\n <line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\" />,\n <line x1=\"8\" y1=\"11\" x2=\"14\" y2=\"11\" />,\n );\n}\n\nexport function RotateCwIcon(props: IconProps) {\n return icon(\n props,\n <path d=\"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8\" />,\n <path d=\"M21 3v5h-5\" />,\n );\n}\n\nexport function Maximize2Icon(props: IconProps) {\n return icon(\n props,\n <path d=\"M15 3h6v6\" />,\n <path d=\"M9 21H3v-6\" />,\n <path d=\"M21 3l-7 7\" />,\n <path d=\"M3 21l7-7\" />,\n );\n}\n\nexport function Minimize2Icon(props: IconProps) {\n return icon(\n props,\n <path d=\"M8 3v3a2 2 0 0 1-2 2H3\" />,\n <path d=\"M21 8h-3a2 2 0 0 1-2-2V3\" />,\n <path d=\"M3 16h3a2 2 0 0 1 2 2v3\" />,\n <path d=\"M16 21v-3a2 2 0 0 1 2-2h3\" />,\n );\n}\n\n/* ── View modes ── */\n\nexport function EyeIcon(props: IconProps) {\n return icon(props, <path d=\"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0\" />, <circle cx=\"12\" cy=\"12\" r=\"3\" />);\n}\n\nexport function Code2Icon(props: IconProps) {\n return icon(props, <path d=\"m18 16 4-4-4-4\" />, <path d=\"m6 8-4 4 4 4\" />, <path d=\"m14.5 4-5 16\" />);\n}\n\nexport function Columns2Icon(props: IconProps) {\n return icon(props, <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />, <line x1=\"12\" y1=\"3\" x2=\"12\" y2=\"21\" />);\n}\n\nexport function Grid3X3Icon(props: IconProps) {\n return icon(props, <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />, <line x1=\"3\" y1=\"9\" x2=\"21\" y2=\"9\" />, <line x1=\"3\" y1=\"15\" x2=\"21\" y2=\"15\" />, <line x1=\"9\" y1=\"3\" x2=\"9\" y2=\"21\" />, <line x1=\"15\" y1=\"3\" x2=\"15\" y2=\"21\" />);\n}\n\nexport function ListIcon(props: IconProps) {\n return icon(props, <line x1=\"8\" y1=\"6\" x2=\"21\" y2=\"6\" />, <line x1=\"8\" y1=\"12\" x2=\"21\" y2=\"12\" />, <line x1=\"8\" y1=\"18\" x2=\"21\" y2=\"18\" />, <line x1=\"3\" y1=\"6\" x2=\"3.01\" y2=\"6\" />, <line x1=\"3\" y1=\"12\" x2=\"3.01\" y2=\"12\" />, <line x1=\"3\" y1=\"18\" x2=\"3.01\" y2=\"18\" />);\n}\n\nexport function Table2Icon(props: IconProps) {\n return icon(props, <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />, <line x1=\"3\" y1=\"9\" x2=\"21\" y2=\"9\" />, <line x1=\"3\" y1=\"15\" x2=\"21\" y2=\"15\" />, <line x1=\"9\" y1=\"3\" x2=\"9\" y2=\"21\" />, <line x1=\"15\" y1=\"3\" x2=\"15\" y2=\"21\" />);\n}\n\nexport function MonitorIcon(props: IconProps) {\n return icon(props, <><rect width=\"20\" height=\"14\" x=\"2\" y=\"3\" rx=\"2\" />, <line x1=\"8\" y1=\"21\" x2=\"16\" y2=\"21\" />, <line x1=\"12\" y1=\"17\" x2=\"12\" y2=\"21\" /></>);\n}\n\n/* ── Alerts & Status ── */\n\nexport function AlertTriangleIcon(props: IconProps) {\n return icon(\n props,\n <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" />,\n <line x1=\"12\" y1=\"9\" x2=\"12\" y2=\"13\" />,\n <line x1=\"12\" y1=\"17\" x2=\"12.01\" y2=\"17\" />,\n );\n}\n\nexport function AlertCircleIcon(props: IconProps) {\n return icon(\n props,\n <circle cx=\"12\" cy=\"12\" r=\"10\" />,\n <line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"12\" />,\n <line x1=\"12\" y1=\"16\" x2=\"12.01\" y2=\"16\" />,\n );\n}\n\nexport function ImageOffIcon(props: IconProps) {\n return icon(\n props,\n <line x1=\"2\" y1=\"2\" x2=\"22\" y2=\"22\" />,\n <path d=\"M10.41 10.41a2 2 0 1 1-2.83-2.83\" />,\n <line x1=\"13.5\" y1=\"13.5\" x2=\"17\" y2=\"17\" />,\n <path d=\"M8.5 17H5a2 2 0 0 1-2-2V5a2 2 0 0 1 .59-1.42\" />,\n <path d=\"M18.42 5.58A2 2 0 0 1 21 7v8.86\" />,\n <path d=\"M22 17H14.5\" />,\n <path d=\"m2 2 20 20\" />,\n );\n}\n\nexport function MessageSquareIcon(props: IconProps) {\n return icon(props, <path d=\"M20 7v7a2 2 0 0 1-2 2H6l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2\" />);\n}\n\n/* ── File & Folder ── */\n\nexport function FileIcon(props: IconProps) {\n return icon(props, <><path d=\"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z\" />, <path d=\"M14 2v4a2 2 0 0 0 2 2h4\" /></>);\n}\n\nexport function FolderIcon(props: IconProps) {\n return icon(props, <path d=\"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z\" />);\n}\n\nexport function FolderOpenIcon(props: IconProps) {\n return icon(props, <path d=\"m6 14 1.5-2.8A2 2 0 0 1 9.4 10H20a2 2 0 0 1 1.95 2.518l-1.992 7A2 2 0 0 1 18.008 21H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4.928a2 2 0 0 1 1.69.9l.814 1.1A2 2 0 0 0 13.116 6H20a2 2 0 0 1 2 2v3\" />);\n}\n\nexport function BookOpenIcon(props: IconProps) {\n return icon(props, <><path d=\"M12 7v14\" />, <path d=\"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-5a4 4 0 0 0-4 4 4 4 0 0 0-4-4z\" /></>);\n}\n\n/* ── Sort ── */\n\nexport function ArrowUpDownIcon(props: IconProps) {\n return icon(props, <><path d=\"m21 16-4 4-4-4\" />, <path d=\"M17 20V4\" />, <path d=\"m3 8 4-4 4 4\" />, <path d=\"M7 4v16\" /></>);\n}\n\n/* ── Close ── */\n\nexport function XIcon(props: IconProps) {\n return icon(props, <><path d=\"M18 6 6 18\" />, <path d=\"m6 6 12 12\" /></>);\n}\n"],"mappings":"AAyBI,SAyJiB,UAzJjB,KAyJiB,YAzJjB;AAlBJ,SAAS,gBAAgB;AAMzB,MAAM,WAAsB;AAAA,EAC1B,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,eAAe;AAAA,EACf,gBAAgB;AAClB;AAEA,SAAS,KAAK,UAAqB,UAA6B;AAC9D,QAAM,EAAE,OAAO,SAAS,MAAM,GAAG,KAAK,IAAI;AAC1C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,MACN,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,SAAQ;AAAA,MACR,MAAM,SAAS;AAAA,MACf,QAAQ,SAAS;AAAA,MACjB,aAAa,SAAS;AAAA,MACtB,eAAe,SAAS;AAAA,MACxB,gBAAgB,SAAS;AAAA,MACxB,GAAG;AAAA,MAEH,mBAAS,QAAQ,QAAQ;AAAA;AAAA,EAC5B;AAEJ;AAIO,SAAS,gBAAgB,OAAkB;AAChD,SAAO,KAAK,OAAO,oBAAC,UAAK,GAAE,kBAAiB,CAAE;AAChD;AAEO,SAAS,iBAAiB,OAAkB;AACjD,SAAO,KAAK,OAAO,oBAAC,UAAK,GAAE,iBAAgB,CAAE;AAC/C;AAEO,SAAS,gBAAgB,OAAkB;AAChD,SAAO,KAAK,OAAO,oBAAC,UAAK,GAAE,gBAAe,CAAE;AAC9C;AAIO,SAAS,aAAa,OAAkB;AAC7C,SAAO;AAAA,IACL;AAAA,IACA,oBAAC,UAAK,GAAE,6CAA4C;AAAA,IACpD,oBAAC,cAAS,QAAO,oBAAmB;AAAA,IACpC,oBAAC,UAAK,IAAG,MAAK,IAAG,MAAK,IAAG,MAAK,IAAG,KAAI;AAAA,EACvC;AACF;AAEO,SAA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A,IAAE;AAAA,IAAE,oBAAC,UAAK,GAAE,cAAa;AAAA,KAAE,CAAG;AAC1E;","names":[]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export { PluginPreviewRenderer, PluginPreviewRendererProps } from './PluginPreviewRenderer.js';
|
|
2
|
+
export { ALL_FILE_TYPES, FileInfo, FileType, NormalizedFile, PreviewSource } from './core/types.js';
|
|
3
|
+
export { PreviewPlugin } from './core/plugin.js';
|
|
4
|
+
export { PreviewPluginRegistry, createPreviewPluginRegistry } from './core/registry.js';
|
|
5
|
+
export { ReadSourceOptions, createObjectUrlFromSource, getSourceMimeType, getSourceName, getSourceSize, readSourceAsArrayBuffer, readSourceAsBase64, readSourceAsText } from './core/source.js';
|
|
6
|
+
export { BinaryPreviewInput, readBinaryPreviewAsArrayBuffer, readBinaryPreviewAsUint8Array } from './core/binary.js';
|
|
7
|
+
export { downloadSource } from './core/download.js';
|
|
8
|
+
export { getAssetBasePath, resolveAssetPath, setAssetBasePath } from './core/config.js';
|
|
9
|
+
export { LocaleMessages, LocaleProvider, enUS, getDefaultLocale, useLocale, zhCN } from './core/i18n.js';
|
|
10
|
+
export { detectFileType } from './utils.js';
|
|
11
|
+
export { PREVIEW_SUPPORT_MATRIX, PreviewSupportMeta, PreviewSupportStatus, RendererSupportState, getPreviewSupportMeta, isDegradedFileType, isPluginSupportedFileType, isUnsupportedFileType } from './support-status.js';
|
|
12
|
+
export { PREVIEW_SIZE_LIMITS, PreviewSizeLevel, PreviewSizePolicy, getPreviewSizeLevel, getPreviewSizePolicy } from './performance-limits.js';
|
|
13
|
+
export { FILE_PREVIEW_LIMITS, XLSX_PREVIEW_LIMITS, shouldHighlight, truncateContent } from './limits.js';
|
|
14
|
+
export { LargeFileGate } from './LargeFileGate.js';
|
|
15
|
+
export { builtinPreviewPlugins, createBuiltinPreviewRegistry } from './plugins/builtin-plugins.js';
|
|
16
|
+
export { audioPlugin } from './plugins/audio-plugin.js';
|
|
17
|
+
export { csvPlugin } from './plugins/csv-plugin.js';
|
|
18
|
+
export { docxPlugin } from './plugins/docx-plugin.js';
|
|
19
|
+
export { epubPlugin } from './plugins/epub-plugin.js';
|
|
20
|
+
export { htmlPlugin } from './plugins/html-plugin.js';
|
|
21
|
+
export { imagePlugin } from './plugins/image-plugin.js';
|
|
22
|
+
export { markdownPlugin } from './plugins/markdown-plugin.js';
|
|
23
|
+
export { pdfPlugin } from './plugins/pdf-plugin.js';
|
|
24
|
+
export { pptxPlugin } from './plugins/pptx-plugin.js';
|
|
25
|
+
export { rtfPlugin } from './plugins/rtf-plugin.js';
|
|
26
|
+
export { sourceCodePlugin } from './plugins/source-code-plugin.js';
|
|
27
|
+
export { svgPlugin } from './plugins/svg-plugin.js';
|
|
28
|
+
export { textPlugin } from './plugins/text-plugin.js';
|
|
29
|
+
export { videoPlugin } from './plugins/video-plugin.js';
|
|
30
|
+
export { xlsxPlugin } from './plugins/xlsx-plugin.js';
|
|
31
|
+
export { zipPlugin } from './plugins/zip-plugin.js';
|
|
32
|
+
export { ProcessRemoteUrlOptions, RemoteLoadProgress, RemoteUrlError, RemoteUrlErrorCode, processRemoteUrl } from './remote-url.js';
|
|
33
|
+
export { SourceTextState, useSourceText } from './hooks/useSourceText.js';
|
|
34
|
+
export { SourceBase64State, useSourceBase64 } from './hooks/useSourceBase64.js';
|
|
35
|
+
export { useObjectUrlFromSource } from './hooks/useObjectUrlFromSource.js';
|
|
36
|
+
import 'react';
|