@react-pdf-kit/viewer 2.9.0-beta.0 → 2.9.0-rc.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.
@@ -6,14 +6,15 @@ import { useLoadWorker as r } from "../utils/hooks/useLoadWorker.js";
6
6
  import { jsx as i } from "react/jsx-runtime";
7
7
  //#region lib/components/RPConfig.tsx
8
8
  var a = (a) => {
9
- let { children: o, customVariables: s, customDarkVariables: c, workerUrl: l, wasmUrl: u, standardFontDataUrl: d, licenseKey: f, ...p } = a, { workerUrlAdded: m } = r(l);
9
+ let { children: o, customVariables: s, customDarkVariables: c, workerUrl: l, wasmUrl: u, iccUrl: d, standardFontDataUrl: f, licenseKey: p, ...m } = a, { workerUrlAdded: h } = r(l);
10
10
  return /* @__PURE__ */ i(t, {
11
- licenseKey: f,
11
+ licenseKey: p,
12
12
  children: /* @__PURE__ */ i(e, {
13
- workerUrlAdded: m,
13
+ workerUrlAdded: h,
14
14
  wasmUrl: u,
15
- standardFontDataUrl: d,
16
- ...p,
15
+ iccUrl: d,
16
+ standardFontDataUrl: f,
17
+ ...m,
17
18
  children: /* @__PURE__ */ i(n, {
18
19
  customDarkVariables: c,
19
20
  customVariables: s,
@@ -4,6 +4,7 @@ import { jsx as n } from "react/jsx-runtime";
4
4
  var r = e({
5
5
  workerUrlAdded: !1,
6
6
  wasmUrl: void 0,
7
+ iccUrl: void 0,
7
8
  standardFontDataUrl: void 0
8
9
  }), i = () => t(r), a = (e) => {
9
10
  let { children: t, ...i } = e;
@@ -378,6 +378,7 @@ export interface PdfProperties {
378
378
  export interface ConfigContextType {
379
379
  workerUrlAdded: boolean;
380
380
  wasmUrl?: string;
381
+ iccUrl?: string;
381
382
  standardFontDataUrl?: string;
382
383
  }
383
384
  export declare enum ThemeVariables {
@@ -3,7 +3,7 @@ import { LicenseType as t } from "../types.js";
3
3
  import { appConsole as n } from "../appConsole.js";
4
4
  import { useCallback as r, useEffect as i, useState as a } from "react";
5
5
  //#region lib/utils/hooks/useLicense.ts
6
- var o = /* @__PURE__ */ new Date("2026-08-10T06:12:32.238Z"), s = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvIokvErJ0Fctu0jduSAx\ngr+5Har/VSuZLlOunS28hnlqqA+OF1apHL7RYkjBosS15yvviYdLrVWYHpHnoY4b\nHLQ9I6YX6FMB9T/VbB4xLdVdKvfi8r49aTScl5EKuSpgpPgz2VSJTfvVGcRuth/Y\nBm7PPGYdL2l2gvKDxchmmsHFPukGki9L4JOUeIVX0GXAxabENckaEH/iC1NZhX+W\nvXnpHeHuIIKlZ16LSivXNgo6BH2Z3GFdg4G3cAaXr6qNP8fsacYNqv2SpTW1viFD\nvzcGRabN25gpJAp9/syeScefWH3OiJY1lmw88oTiJbjIoiq6AkPhfn3G9mF54nvR\nkwIDAQAB\n-----END PUBLIC KEY-----", c = "Please visit https://app.react-pdf-kit.dev to generate a new license key.", l = {
6
+ var o = /* @__PURE__ */ new Date("2026-08-14T08:55:34.158Z"), s = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvIokvErJ0Fctu0jduSAx\ngr+5Har/VSuZLlOunS28hnlqqA+OF1apHL7RYkjBosS15yvviYdLrVWYHpHnoY4b\nHLQ9I6YX6FMB9T/VbB4xLdVdKvfi8r49aTScl5EKuSpgpPgz2VSJTfvVGcRuth/Y\nBm7PPGYdL2l2gvKDxchmmsHFPukGki9L4JOUeIVX0GXAxabENckaEH/iC1NZhX+W\nvXnpHeHuIIKlZ16LSivXNgo6BH2Z3GFdg4G3cAaXr6qNP8fsacYNqv2SpTW1viFD\nvzcGRabN25gpJAp9/syeScefWH3OiJY1lmw88oTiJbjIoiq6AkPhfn3G9mF54nvR\nkwIDAQAB\n-----END PUBLIC KEY-----", c = "Please visit https://app.react-pdf-kit.dev to generate a new license key.", l = {
7
7
  invalidLicense: `You are currently using without a valid license. ${c}`,
8
8
  mismatchedDomain: `Your license key is not valid for the current domain / IP. ${c}`,
9
9
  expired: `Your license key has expired. ${c}`,
@@ -24,41 +24,45 @@ function _(e) {
24
24
  return t.cause = e, t;
25
25
  }
26
26
  var v = (a, o, c = {}) => {
27
- let [p, v] = d(), { workerUrlAdded: y, wasmUrl: b, standardFontDataUrl: x } = n(), [S, C] = d(/* @__PURE__ */ new Map()), w = u(), [T, E] = d(0), [D, O] = d(!1), [k, A] = d(), { password: j, passwordError: M, setPasswordError: N, passwordRequired: P, setPasswordRequired: F } = i(), { onLoadError: I, onLoaded: L, onLoadProgress: R, disableAutoFetch: z, disableStream: B, rangeChunkSize: V, withCredentials: H, httpHeaders: U } = c;
27
+ let [p, v] = d(), { workerUrlAdded: y, wasmUrl: b, iccUrl: x, standardFontDataUrl: S } = n(), [C, w] = d(/* @__PURE__ */ new Map()), T = u(), [E, D] = d(0), [O, k] = d(!1), [A, j] = d(), { password: M, passwordError: N, setPasswordError: P, passwordRequired: F, setPasswordRequired: I } = i(), { onLoadError: L, onLoaded: R, onLoadProgress: z, disableAutoFetch: B, disableStream: V, rangeChunkSize: H, withCredentials: U, httpHeaders: W } = c;
28
28
  return l(() => {
29
- R && R(T);
30
- }, [T, R]), l(() => {
29
+ z && z(E);
30
+ }, [E, z]), l(() => {
31
31
  if (!y || !a) return;
32
- E(0), A(void 0), w.current = Date.now();
33
- let t = w.current, n = {
32
+ D(0), j(void 0), T.current = Date.now();
33
+ let t = T.current, n = {
34
34
  url: a,
35
35
  cMapPacked: o?.isCompressed ?? !0,
36
36
  ...o?.url && { cMapUrl: o.url },
37
- ...j && { password: j },
38
- ...z !== void 0 && { disableAutoFetch: z },
39
- ...B !== void 0 && { disableStream: B },
40
- ...V !== void 0 && { rangeChunkSize: V },
41
- ...H !== void 0 && { withCredentials: H },
42
- ...U !== void 0 && { httpHeaders: U },
37
+ ...M && { password: M },
38
+ ...B !== void 0 && { disableAutoFetch: B },
39
+ ...V !== void 0 && { disableStream: V },
40
+ ...H !== void 0 && { rangeChunkSize: H },
41
+ ...U !== void 0 && { withCredentials: U },
42
+ ...W !== void 0 && { httpHeaders: W },
43
43
  ...b && { wasmUrl: b },
44
- ...x && { standardFontDataUrl: x },
44
+ ...x && {
45
+ iccUrl: x,
46
+ useWorkerFetch: !0
47
+ },
48
+ ...S && { standardFontDataUrl: S },
45
49
  verbosity: f.VerbosityLevel.ERRORS
46
50
  };
47
51
  try {
48
52
  let i = f.getDocument(n);
49
53
  i.onProgress = (e) => {
50
- if (t === w.current) {
54
+ if (t === T.current) {
51
55
  let { loaded: t, total: n } = e;
52
- E(n ? Math.min(100, Math.round(t / n * 100)) : 0);
56
+ D(n ? Math.min(100, Math.round(t / n * 100)) : 0);
53
57
  }
54
- }, O(!0), v(void 0);
55
- let a = i.promise.then(async (n) => !b && m(await n.getData()) ? (t === w.current && (v(void 0), A(e.WASM_URL_REQUIRED)), r.error(s), I?.(g()), n) : (t === w.current && (v(n), E(100)), L && L(n), F(!1), N(""), n)).catch((t) => {
58
+ }, k(!0), v(void 0);
59
+ let a = i.promise.then(async (n) => !b && m(await n.getData()) ? (t === T.current && (v(void 0), j(e.WASM_URL_REQUIRED)), r.error(s), L?.(g()), n) : (t === T.current && (v(n), D(100)), R && R(n), I(!1), P(""), n)).catch((t) => {
56
60
  if (t instanceof Error && t.name === "PasswordException") {
57
61
  let e = t.code;
58
- F(!0), e === f.PasswordResponses.INCORRECT_PASSWORD ? N("Incorrect password") : N(void 0);
59
- } else t instanceof Error && t.name === "InvalidPDFException" && j ? (F(!0), N("Incorrect password")) : t instanceof Error && t.name === "InvalidPDFException" ? (A(e.INVALID_OR_CORRUPTED_PDF), I?.(h(t))) : I && I(t);
62
+ I(!0), e === f.PasswordResponses.INCORRECT_PASSWORD ? P("Incorrect password") : P(void 0);
63
+ } else t instanceof Error && t.name === "InvalidPDFException" && M ? (I(!0), P("Incorrect password")) : t instanceof Error && t.name === "InvalidPDFException" ? (j(e.INVALID_OR_CORRUPTED_PDF), L?.(h(t))) : L && L(t);
60
64
  }).finally(() => {
61
- O(!1);
65
+ k(!1);
62
66
  });
63
67
  return () => {
64
68
  a.finally(() => {
@@ -66,21 +70,22 @@ var v = (a, o, c = {}) => {
66
70
  });
67
71
  };
68
72
  } catch (t) {
69
- A(e.NOT_SUPPORTED), I?.(_(t));
73
+ j(e.NOT_SUPPORTED), L?.(_(t));
70
74
  }
71
75
  }, [
72
76
  a,
73
77
  y,
74
78
  b,
75
79
  x,
76
- j,
77
- I,
78
- L
80
+ S,
81
+ M,
82
+ L,
83
+ R
79
84
  ]), l(() => {
80
- if (P) return;
85
+ if (F) return;
81
86
  let n = /* @__PURE__ */ new Map();
82
- if (!p || D) {
83
- C(n);
87
+ if (!p || O) {
88
+ w(n);
84
89
  return;
85
90
  }
86
91
  let r = p.numPages, i = [];
@@ -99,23 +104,23 @@ var v = (a, o, c = {}) => {
99
104
  thumbnailScale: i,
100
105
  defaultRotation: a.rotation
101
106
  });
102
- }), C(n);
107
+ }), w(n);
103
108
  }).catch((t) => {
104
- v(void 0), A(e.INVALID_OR_CORRUPTED_PDF), I?.(h(t));
109
+ v(void 0), j(e.INVALID_OR_CORRUPTED_PDF), L?.(h(t));
105
110
  });
106
111
  }, [
107
112
  p,
108
- D,
109
- P,
110
- I
113
+ O,
114
+ F,
115
+ L
111
116
  ]), {
112
117
  pdf: p,
113
- pages: S,
114
- loading: D,
115
- error: k,
116
- loadingProgress: T,
117
- passwordRequired: P,
118
- passwordError: M
118
+ pages: C,
119
+ loading: O,
120
+ error: A,
121
+ loadingProgress: E,
122
+ passwordRequired: F,
123
+ passwordError: N
119
124
  };
120
125
  };
121
126
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pdf-kit/viewer",
3
- "version": "2.9.0-beta.0",
3
+ "version": "2.9.0-rc.0",
4
4
  "private": false,
5
5
  "description": "A react-pdf-viewer component for React and Next.js. Suitable for react-pdf document.",
6
6
  "keywords": [