@swisper.ai/web-file-preview 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -196,7 +196,7 @@ function oe() {
196
196
  }
197
197
  //#endregion
198
198
  //#region src/components/file-preview/file-preview.tsx
199
- var L = O(() => import("./csv-renderer-CbvmuQ2R.js").then((e) => e.CsvRenderer)), R = O(() => import("./docx-renderer-BzldhxpS.js").then((e) => e.DocxRenderer)), z = O(() => import("./spreadsheet-renderer-C-WtggqE.js").then((e) => (e.applySpreadsheetWasmSource(F().spreadsheet), e.SpreadsheetRenderer))), B = O(() => import("./pdf-renderer-DzQMsDqU.js").then((e) => (e.applyPdfiumWasmUrl(F().pdf), e.PdfRenderer))), V = O(() => import("./markdown-renderer-B72_fv0Z.js").then((e) => e.MarkdownRenderer)), H = {
199
+ var L = O(() => import("./csv-renderer-CbvmuQ2R.js").then((e) => e.CsvRenderer)), R = O(() => import("./docx-renderer-BzldhxpS.js").then((e) => e.DocxRenderer)), z = O(() => import("./spreadsheet-renderer-C-WtggqE.js").then((e) => (e.applySpreadsheetWasmSource(F().spreadsheet), e.SpreadsheetRenderer))), B = O(() => import("./pdf-renderer-BbQMj8uz.js").then((e) => (e.applyPdfiumWasmUrl(F().pdf), e.PdfRenderer))), V = O(() => import("./markdown-renderer-B72_fv0Z.js").then((e) => e.MarkdownRenderer)), H = {
200
200
  pdf: B,
201
201
  image: A,
202
202
  video: j,
@@ -633,7 +633,7 @@ function Ne() {
633
633
  var Pe = {
634
634
  image: me,
635
635
  html: de,
636
- pdf: O(() => import("./pdf-thumbnail-BYW10Fds.js").then((e) => (e.applyPdfiumWasmUrl(F().pdf), e.PdfThumbnail))),
636
+ pdf: O(() => import("./pdf-thumbnail-DuanRuLw.js").then((e) => (e.applyPdfiumWasmUrl(F().pdf), e.PdfThumbnail))),
637
637
  spreadsheet: O(() => import("./spreadsheet-thumbnail-ogiqIBYM.js").then((e) => (e.applySpreadsheetThumbnailWasmSource(F().spreadsheet), e.SpreadsheetThumbnail))),
638
638
  presentation: O(() => import("./presentation-thumbnail-lqRflvhE.js").then((e) => (e.applyPresentationThumbnailWasmSource(F().presentation), e.PresentationThumbnail))),
639
639
  docx: O(() => import("./docx-thumbnail-BIGhlNi8.js").then((e) => (e.applyDocxThumbnailWasmSource(F().docx), e.DocxThumbnail))),
@@ -4,11 +4,11 @@ function r(n) {
4
4
  t = n ?? e;
5
5
  }
6
6
  function i() {
7
- return n ??= import("./worker-engine-Xfe-G3n0.js").then(({ createPdfiumEngine: e }) => e(t, {})).catch((e) => {
7
+ return n ??= import("./worker-engine-DBU5WIrV.js").then(({ createPdfiumEngine: e }) => e(t, {})).catch((e) => {
8
8
  throw n = null, e;
9
9
  }), n;
10
10
  }
11
11
  //#endregion
12
12
  export { i as n, r as t };
13
13
 
14
- //# sourceMappingURL=pdf-engine-BtVPDh84.js.map
14
+ //# sourceMappingURL=pdf-engine-DWOclI_R.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pdf-engine-BtVPDh84.js","names":["DEFAULT_PDFIUM_WASM_URL","pdfiumWasmUrl","sharedEnginePromise","applyPdfiumWasmUrl","url","loadSharedPdfEngine","createPdfiumEngine","error"],"sources":["../src/components/file-preview/components/pdf/pdf-engine.ts"],"sourcesContent":["/**\n * The one PDFium engine every PDF preview shares. Adapted from the Extend UI registry's\n * `lib/pdf-thumbnail-utils.ts`, keeping only the engine loader; its thumbnail and document\n * caches are not used, because the viewer renders thumbnails through its own plugin.\n */\nimport type { PdfEngine } from '@embedpdf/models';\n\nconst PDFIUM_VERSION = '2.15.0';\nconst DEFAULT_PDFIUM_WASM_URL = `https://cdn.jsdelivr.net/npm/@embedpdf/pdfium@${PDFIUM_VERSION}/dist/pdfium.wasm`;\nlet pdfiumWasmUrl = DEFAULT_PDFIUM_WASM_URL;\nlet sharedEnginePromise: Promise<PdfEngine> | null = null;\n\n/**\n * Hands the host's configured PDFium WASM URL to the engine. Called by the lazy loader in\n * `file-preview.tsx` rather than read from `wasm-sources` here: importing a module the\n * entry also imports would split a shared chunk out of the published `index.es.js`.\n *\n * Only takes effect before the engine's first load; the engine is created once.\n */\nexport function applyPdfiumWasmUrl(url: string | undefined) {\n pdfiumWasmUrl = url ?? DEFAULT_PDFIUM_WASM_URL;\n}\n\nexport function loadSharedPdfEngine() {\n sharedEnginePromise ??= import('@embedpdf/engines/pdfium-worker-engine')\n .then(({ createPdfiumEngine }) => createPdfiumEngine(pdfiumWasmUrl, {}))\n .catch((error: unknown) => {\n // Forget the failure, so the next preview retries: a dropped connection or a CDN\n // blip would otherwise fail every PDF until the page is reloaded.\n sharedEnginePromise = null;\n throw error;\n });\n\n return sharedEnginePromise;\n}\n"],"mappings":";AAQA,IAAMA,IAA0B,yEAC5BC,IAAgBD,GAChBE,IAAiD;AASrD,SAAgBC,EAAmB,GAAyB;CAC1D,IAAgBC,KAAOJ;AACzB;AAEA,SAAgBK,IAAsB;CAUpC,OATA,MAAwB,OAAO,8BAAyC,CACrE,MAAM,EAAE,4BAAyBC,EAAmBL,GAAe,CAAC,CAAC,CAAC,CAAC,CACvE,OAAO,MAAmB;EAIzB,MADA,IAAsB,MAChBM;CACR,CAAC,GAEIL;AACT"}
1
+ {"version":3,"file":"pdf-engine-DWOclI_R.js","names":["DEFAULT_PDFIUM_WASM_URL","pdfiumWasmUrl","sharedEnginePromise","applyPdfiumWasmUrl","url","loadSharedPdfEngine","createPdfiumEngine","error"],"sources":["../src/components/file-preview/components/pdf/pdf-engine.ts"],"sourcesContent":["/**\n * The one PDFium engine every PDF preview shares. Adapted from the Extend UI registry's\n * `lib/pdf-thumbnail-utils.ts`, keeping only the engine loader; its thumbnail and document\n * caches are not used, because the viewer renders thumbnails through its own plugin.\n */\nimport type { PdfEngine } from '@embedpdf/models';\n\nconst PDFIUM_VERSION = '2.15.0';\nconst DEFAULT_PDFIUM_WASM_URL = `https://cdn.jsdelivr.net/npm/@embedpdf/pdfium@${PDFIUM_VERSION}/dist/pdfium.wasm`;\nlet pdfiumWasmUrl = DEFAULT_PDFIUM_WASM_URL;\nlet sharedEnginePromise: Promise<PdfEngine> | null = null;\n\n/**\n * Hands the host's configured PDFium WASM URL to the engine. Called by the lazy loader in\n * `file-preview.tsx` rather than read from `wasm-sources` here: importing a module the\n * entry also imports would split a shared chunk out of the published `index.es.js`.\n *\n * Only takes effect before the engine's first load; the engine is created once.\n */\nexport function applyPdfiumWasmUrl(url: string | undefined) {\n pdfiumWasmUrl = url ?? DEFAULT_PDFIUM_WASM_URL;\n}\n\nexport function loadSharedPdfEngine() {\n sharedEnginePromise ??= import('@embedpdf/engines/pdfium-worker-engine')\n .then(({ createPdfiumEngine }) => createPdfiumEngine(pdfiumWasmUrl, {}))\n .catch((error: unknown) => {\n // Forget the failure, so the next preview retries: a dropped connection or a CDN\n // blip would otherwise fail every PDF until the page is reloaded.\n sharedEnginePromise = null;\n throw error;\n });\n\n return sharedEnginePromise;\n}\n"],"mappings":";AAQA,IAAMA,IAA0B,yEAC5BC,IAAgBD,GAChBE,IAAiD;AASrD,SAAgBC,EAAmB,GAAyB;CAC1D,IAAgBC,KAAOJ;AACzB;AAEA,SAAgBK,IAAsB;CAUpC,OATA,MAAwB,OAAO,8BAAyC,CACrE,MAAM,EAAE,4BAAyBC,EAAmBL,GAAe,CAAC,CAAC,CAAC,CAAC,CACvE,OAAO,MAAmB;EAIzB,MADA,IAAsB,MAChBM;CACR,CAAC,GAEIL;AACT"}
@@ -2,14 +2,14 @@ import { n as e, o as t, r as n } from "./dist-Cve0Jg0R.js";
2
2
  import { _ as r, a as i, c as a, d as o, f as s, h as c, i as l, l as u, m as d, n as f, o as p, p as m, s as h, u as g, v as _, y as v } from "./dist-CZsb0xlY.js";
3
3
  import { a as y, i as b, n as x, o as S, r as C, t as ee } from "./viewer-layout-Dnt3S9JD.js";
4
4
  import { a as te, i as ne, n as re, o as ie, r as ae, t as oe } from "./viewer-toolbar-IsseYFsm.js";
5
- import { n as se, t as ce } from "./pdf-engine-BtVPDh84.js";
5
+ import { n as se, t as ce } from "./pdf-engine-DWOclI_R.js";
6
6
  import * as w from "react";
7
7
  import { Fragment as T, createContext as E, useCallback as D, useContext as O, useEffect as k, useLayoutEffect as le, useMemo as A, useRef as j, useState as M } from "react";
8
8
  import { cn as ue } from "@swisper.ai/web-core";
9
9
  import { Fragment as de, jsx as N, jsxs as P } from "react/jsx-runtime";
10
10
  import { flushSync as fe } from "react-dom";
11
11
  import { RotateIcon as pe } from "@swisper.ai/icons";
12
- //#region ../../node_modules/.pnpm/@embedpdf+core@2.15.1_preact@10.29.8_react-dom@18.3.1_react@18.3.1__react@18.3.1_svelte_c067d941a6cc491e718f091c4b219b73/node_modules/@embedpdf/core/dist/index.js
12
+ //#region ../../node_modules/.pnpm/@embedpdf+core@2.15.1_preact@10.29.8_react-dom@18.3.1_react@18.3.1__react@18.3.1_svelte_367bb0fafa82acb0d9916b230ceac187/node_modules/@embedpdf/core/dist/index.js
13
13
  var me = class {
14
14
  constructor() {
15
15
  this.dependencyGraph = /* @__PURE__ */ new Map();
@@ -1075,7 +1075,7 @@ function pt(e) {
1075
1075
  return new ft(e);
1076
1076
  }
1077
1077
  //#endregion
1078
- //#region ../../node_modules/.pnpm/@embedpdf+core@2.15.1_preact@10.29.8_react-dom@18.3.1_react@18.3.1__react@18.3.1_svelte_c067d941a6cc491e718f091c4b219b73/node_modules/@embedpdf/core/dist/react/index.js
1078
+ //#region ../../node_modules/.pnpm/@embedpdf+core@2.15.1_preact@10.29.8_react-dom@18.3.1_react@18.3.1__react@18.3.1_svelte_367bb0fafa82acb0d9916b230ceac187/node_modules/@embedpdf/core/dist/react/index.js
1079
1079
  var mt = E({
1080
1080
  registry: null,
1081
1081
  coreState: null,
@@ -1207,7 +1207,7 @@ function yt(e) {
1207
1207
  }
1208
1208
  i.Print, i.ModifyContents, i.CopyContents, i.ModifyAnnotations, i.FillForms, i.ExtractForAccessibility, i.AssembleDocument, i.PrintHighQuality, i.Print, i.ModifyContents, i.CopyContents, i.ModifyAnnotations, i.FillForms, i.ExtractForAccessibility, i.AssembleDocument, i.PrintHighQuality, i.Print, i.ModifyContents, i.CopyContents, i.ModifyAnnotations, i.FillForms, i.ExtractForAccessibility, i.AssembleDocument, i.PrintHighQuality;
1209
1209
  //#endregion
1210
- //#region ../../node_modules/.pnpm/@embedpdf+plugin-document-manager@2.15.1_@embedpdf+core@2.15.1_preact@10.29.8_react-dom_76122dc1e841b11788618e05e7d74b78/node_modules/@embedpdf/plugin-document-manager/dist/index.js
1210
+ //#region ../../node_modules/.pnpm/@embedpdf+plugin-document-manager@2.15.1_@embedpdf+core@2.15.1_preact@10.29.8_react-dom_ba409d590cea20198dcdaadd7a93a714/node_modules/@embedpdf/plugin-document-manager/dist/index.js
1211
1211
  var bt = class extends z {
1212
1212
  constructor(e, t, n) {
1213
1213
  super(e, t), this.id = e, this.documentOpened$ = U(), this.documentClosed$ = U(), this.activeDocumentChanged$ = U(), this.documentError$ = U(), this.documentOrderChanged$ = U(), this.openFileRequest$ = H(), this.loadOptions = /* @__PURE__ */ new Map(), this.maxDocuments = n?.maxDocuments;
@@ -2516,7 +2516,7 @@ function En({ documentId: e, pageIndex: t, scale: n, dpr: r, style: i, ...a }) {
2516
2516
  }) });
2517
2517
  }
2518
2518
  //#endregion
2519
- //#region ../../node_modules/.pnpm/@embedpdf+plugin-rotate@2.15.1_@embedpdf+core@2.15.1_preact@10.29.8_react-dom@18.3.1_re_d1914e9797e0e7f91a91ebae91c9a857/node_modules/@embedpdf/plugin-rotate/dist/index.js
2519
+ //#region ../../node_modules/.pnpm/@embedpdf+plugin-rotate@2.15.1_@embedpdf+core@2.15.1_preact@10.29.8_react-dom@18.3.1_re_27f9ac4ff262ef72e666e9f006714c02/node_modules/@embedpdf/plugin-rotate/dist/index.js
2520
2520
  var Dn = "rotate", On = {
2521
2521
  id: Dn,
2522
2522
  name: "Rotate Plugin",
@@ -2725,7 +2725,7 @@ function Gn({ children: e, documentId: t, pageIndex: n, rotation: r, scale: i, s
2725
2725
  }) : null;
2726
2726
  }
2727
2727
  //#endregion
2728
- //#region ../../node_modules/.pnpm/@embedpdf+plugin-scroll@2.15.1_@embedpdf+core@2.15.1_preact@10.29.8_react-dom@18.3.1_re_fc257cb6f12dcb4c9f99db0a2ec5836b/node_modules/@embedpdf/plugin-scroll/dist/index.js
2728
+ //#region ../../node_modules/.pnpm/@embedpdf+plugin-scroll@2.15.1_@embedpdf+core@2.15.1_preact@10.29.8_react-dom@18.3.1_re_114feb29732aa906aba7a4be46aa685c/node_modules/@embedpdf/plugin-scroll/dist/index.js
2729
2729
  var q = /* @__PURE__ */ ((e) => (e.Vertical = "vertical", e.Horizontal = "horizontal", e))(q || {}), Kn = class {
2730
2730
  constructor(e) {
2731
2731
  this.pageGap = e.pageGap ?? 20, this.viewportGap = e.viewportGap ?? 20, this.bufferSize = e.bufferSize ?? 2;
@@ -4874,7 +4874,7 @@ function Ii({ documentId: e, meta: t, style: n, ...r }) {
4874
4874
  }) : null;
4875
4875
  }
4876
4876
  //#endregion
4877
- //#region ../../node_modules/.pnpm/@embedpdf+plugin-tiling@2.15.1_79381b7faa0da81f7903415a0681170f/node_modules/@embedpdf/plugin-tiling/dist/index.js
4877
+ //#region ../../node_modules/.pnpm/@embedpdf+plugin-tiling@2.15.1_07482e1e0702d06cfefe17bfb7dbc0cf/node_modules/@embedpdf/plugin-tiling/dist/index.js
4878
4878
  var Li = "tiling", Ri = {
4879
4879
  id: Li,
4880
4880
  name: "Tiling Plugin",
@@ -5215,7 +5215,7 @@ function na({ documentId: e, pageIndex: t, scale: n, style: r, ...i }) {
5215
5215
  });
5216
5216
  }
5217
5217
  //#endregion
5218
- //#region ../../node_modules/.pnpm/@embedpdf+plugin-viewport@2.15.1_@embedpdf+core@2.15.1_preact@10.29.8_react-dom@18.3.1__0fff4e5cd8df0abc359cfe6b0b20d46a/node_modules/@embedpdf/plugin-viewport/dist/index.js
5218
+ //#region ../../node_modules/.pnpm/@embedpdf+plugin-viewport@2.15.1_@embedpdf+core@2.15.1_preact@10.29.8_react-dom@18.3.1__37e567d9b51749bbf03fb993c3199b5c/node_modules/@embedpdf/plugin-viewport/dist/index.js
5219
5219
  var ra = "viewport", ia = {
5220
5220
  id: ra,
5221
5221
  name: "Viewport Plugin",
@@ -5723,7 +5723,7 @@ function za(e) {
5723
5723
  }, [t, e]), n;
5724
5724
  }
5725
5725
  //#endregion
5726
- //#region ../../node_modules/.pnpm/@embedpdf+plugin-zoom@2.15.1_1159ffeff0a14a3d7a28cc360e63a696/node_modules/@embedpdf/plugin-zoom/dist/index.js
5726
+ //#region ../../node_modules/.pnpm/@embedpdf+plugin-zoom@2.15.1_729c4d6860be0fd2739f6f206450c215/node_modules/@embedpdf/plugin-zoom/dist/index.js
5727
5727
  var Z = /* @__PURE__ */ ((e) => (e.Automatic = "automatic", e.FitPage = "fit-page", e.FitWidth = "fit-width", e))(Z || {}), Q = /* @__PURE__ */ ((e) => (e[e.Center = 0] = "Center", e[e.Top = 1] = "Top", e))(Q || {}), Ba = "zoom", Va = {
5728
5728
  id: Ba,
5729
5729
  name: "Zoom Plugin",
@@ -7061,4 +7061,4 @@ function Ho({ objectUrl: e, fileName: t, className: n, onLoad: r, onError: i, ro
7061
7061
  //#endregion
7062
7062
  export { Ho as PdfRenderer, ce as applyPdfiumWasmUrl };
7063
7063
 
7064
- //# sourceMappingURL=pdf-renderer-DzQMsDqU.js.map
7064
+ //# sourceMappingURL=pdf-renderer-BbQMj8uz.js.map