diff --git a/apps/playground/src/app/page.tsx b/apps/playground/src/app/page.tsx index 35b18eb..45fe32c 100755 --- a/apps/playground/src/app/page.tsx +++ b/apps/playground/src/app/page.tsx @@ -26,6 +26,7 @@ import { type FileInfo, type FileType, type HtmlTrustedPreviewRequest, + type PreviewSizePolicyConfig, detectFileType, detectFileMeta, PluginPreviewRenderer, @@ -52,6 +53,14 @@ setAssetBasePath(process.env.NEXT_PUBLIC_BASE_PATH || ""); // (PDF, DOCX, PPTX, XLSX, RTF, ZIP, EPUB and base formats). const previewRegistry = createFullPreviewRegistry(); +// Playground-only limit. Library consumers retain the default 20/50/100 MB policy. +const MB = 1024 * 1024; +const DEMO_PREVIEW_POLICY = { + warningBytes: 20 * MB, + confirmBytes: 35 * MB, + maxBytes: 50 * MB, +} satisfies PreviewSizePolicyConfig; + const FILE_TYPE_ICONS: Record = { pdf: "πŸ“„", markdown: "πŸ“", @@ -238,6 +247,7 @@ export default function Home() { try { const info = await processRemoteUrl(currentUrl, { signal: controller.signal, + maxBytes: DEMO_PREVIEW_POLICY.maxBytes, onProgress: setRemoteProgress, }); @@ -416,6 +426,9 @@ export default function Home() { onChange={handleFileInput} accept="*" /> +

+ Preview files up to 50 MB each +

)} - {/* Preview content β€” PluginPreviewRenderer applies its own - LargeFileGate. Thresholds are tuned for the demo: warn at - 2 MB, require confirmation at 3 MB, block at 5 MB. */} + {/* Preview content β€” the Demo gates files at 20/35/50 MB. */}
diff --git a/docs/github-pages-release-checklist.md b/docs/github-pages-release-checklist.md index ee32458..d17deff 100644 --- a/docs/github-pages-release-checklist.md +++ b/docs/github-pages-release-checklist.md @@ -122,20 +122,22 @@ Expected: unknown β†’ Preview Not Available ``` -## 8. Check Large File Hint +## 8. Check Demo Preview Size Limit (50 MB) -Upload a file >= 20MB of type: +The **Playground demo** has its own policy: warn at 20 MiB, require confirmation at 35 MiB, and block previews above 50 MiB (50 Γ— 1024 Γ— 1024 bytes). The reusable library retains its default thresholds. -```txt -PDF / DOCX / PPTX / XLSX / ZIP / EPUB -``` +Test local PDF / DOCX / PPTX / XLSX / ZIP / EPUB files through both **Browse Files** and drag-and-drop: -Expected: +| File size | Expected | +| --- | --- | +| Less than 20 MiB | Preview normally | +| 20–under 35 MiB | Show a warning, continue preview | +| 35–50 MiB (inclusive) | Require explicit confirmation before preview | +| Greater than 50 MiB | Block local preview and offer download | -```txt -Large file hint appears -User can still proceed with preview -``` +The **remote URL** loader must enforce the same 50 MiB cap before or during download. Verify that a remote file above the limit produces a clear error (subject to CORS). A file exactly 50 MiB must remain eligible for preview. + +The limit applies per file, not to the total size of the selected files. Large-file parsing may still be slow or require significant memory even when the size policy allows it. ## 9. Check Browser Console